speckit-kit 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,176 @@
1
+ function MX(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function px(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s1={exports:{}},im={};var tL;function RX(){if(tL)return im;tL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var a=null;if(o!==void 0&&(a=""+o),i.key!==void 0&&(a=""+i.key),"key"in i){o={};for(var c in i)c!=="key"&&(o[c]=i[c])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:a,ref:i!==void 0?i:null,props:o}}return im.Fragment=t,im.jsx=n,im.jsxs=n,im}var nL;function AX(){return nL||(nL=1,s1.exports=RX()),s1.exports}var N=AX(),a1={exports:{}},om={},l1={exports:{}},c1={};var rL;function OX(){return rL||(rL=1,(function(e){function t(j,K){var G=j.length;j.push(K);e:for(;0<G;){var J=G-1>>>1,F=j[J];if(0<i(F,K))j[J]=K,j[G]=F,G=J;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var K=j[0],G=j.pop();if(G!==K){j[0]=G;e:for(var J=0,F=j.length,U=F>>>1;J<U;){var Q=2*(J+1)-1,z=j[Q],ne=Q+1,ce=j[ne];if(0>i(z,G))ne<F&&0>i(ce,z)?(j[J]=ce,j[ne]=G,J=ne):(j[J]=z,j[Q]=G,J=Q);else if(ne<F&&0>i(ce,G))j[J]=ce,j[ne]=G,J=ne;else break e}}return K}function i(j,K){var G=j.sortIndex-K.sortIndex;return G!==0?G:j.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();e.unstable_now=function(){return a.now()-c}}var u=[],d=[],h=1,p=null,y=3,g=!1,v=!1,S=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function M(j){for(var K=n(d);K!==null;){if(K.callback===null)r(d);else if(K.startTime<=j)r(d),K.sortIndex=K.expirationTime,t(u,K);else break;K=n(d)}}function D(j){if(S=!1,M(j),!v)if(n(u)!==null)v=!0,T||(T=!0,P());else{var K=n(d);K!==null&&V(D,K.startTime-j)}}var T=!1,C=-1,O=5,q=-1;function I(){return x?!0:!(e.unstable_now()-q<O)}function L(){if(x=!1,T){var j=e.unstable_now();q=j;var K=!0;try{e:{v=!1,S&&(S=!1,_(C),C=-1),g=!0;var G=y;try{t:{for(M(j),p=n(u);p!==null&&!(p.expirationTime>j&&I());){var J=p.callback;if(typeof J=="function"){p.callback=null,y=p.priorityLevel;var F=J(p.expirationTime<=j);if(j=e.unstable_now(),typeof F=="function"){p.callback=F,M(j),K=!0;break t}p===n(u)&&r(u),M(j)}else r(u);p=n(u)}if(p!==null)K=!0;else{var U=n(d);U!==null&&V(D,U.startTime-j),K=!1}}break e}finally{p=null,y=G,g=!1}K=void 0}}finally{K?P():T=!1}}}var P;if(typeof E=="function")P=function(){E(L)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,$=B.port2;B.port1.onmessage=L,P=function(){$.postMessage(null)}}else P=function(){k(L,0)};function V(j,K){C=k(function(){j(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(j){switch(y){case 1:case 2:case 3:var K=3;break;default:K=y}var G=y;y=K;try{return j()}finally{y=G}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(j,K){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var G=y;y=j;try{return K()}finally{y=G}},e.unstable_scheduleCallback=function(j,K,G){var J=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?J+G:J):G=J,j){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=G+F,j={id:h++,callback:K,priorityLevel:j,startTime:G,expirationTime:F,sortIndex:-1},G>J?(j.sortIndex=G,t(d,j),n(u)===null&&j===n(d)&&(S?(_(C),C=-1):S=!0,V(D,G-J))):(j.sortIndex=F,t(u,j),v||g||(v=!0,T||(T=!0,P()))),j},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(j){var K=y;return function(){var G=y;y=K;try{return j.apply(this,arguments)}finally{y=G}}}})(c1)),c1}var iL;function DX(){return iL||(iL=1,l1.exports=OX()),l1.exports}var u1={exports:{}},bt={};var oL;function PX(){if(oL)return bt;oL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.iterator;function g(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,x={};function k(U,Q,z){this.props=U,this.context=Q,this.refs=x,this.updater=z||v}k.prototype.isReactComponent={},k.prototype.setState=function(U,Q){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,Q,"setState")},k.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function _(){}_.prototype=k.prototype;function E(U,Q,z){this.props=U,this.context=Q,this.refs=x,this.updater=z||v}var M=E.prototype=new _;M.constructor=E,S(M,k.prototype),M.isPureReactComponent=!0;var D=Array.isArray;function T(){}var C={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function q(U,Q,z){var ne=z.ref;return{$$typeof:e,type:U,key:Q,ref:ne!==void 0?ne:null,props:z}}function I(U,Q){return q(U.type,Q,U.props)}function L(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function P(U){var Q={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(z){return Q[z]})}var B=/\/+/g;function $(U,Q){return typeof U=="object"&&U!==null&&U.key!=null?P(""+U.key):Q.toString(36)}function V(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(T,T):(U.status="pending",U.then(function(Q){U.status==="pending"&&(U.status="fulfilled",U.value=Q)},function(Q){U.status==="pending"&&(U.status="rejected",U.reason=Q)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function j(U,Q,z,ne,ce){var Z=typeof U;(Z==="undefined"||Z==="boolean")&&(U=null);var ee=!1;if(U===null)ee=!0;else switch(Z){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(U.$$typeof){case e:case t:ee=!0;break;case h:return ee=U._init,j(ee(U._payload),Q,z,ne,ce)}}if(ee)return ce=ce(U),ee=ne===""?"."+$(U,0):ne,D(ce)?(z="",ee!=null&&(z=ee.replace(B,"$&/")+"/"),j(ce,Q,z,"",function(ye){return ye})):ce!=null&&(L(ce)&&(ce=I(ce,z+(ce.key==null||U&&U.key===ce.key?"":(""+ce.key).replace(B,"$&/")+"/")+ee)),Q.push(ce)),1;ee=0;var me=ne===""?".":ne+":";if(D(U))for(var fe=0;fe<U.length;fe++)ne=U[fe],Z=me+$(ne,fe),ee+=j(ne,Q,z,Z,ce);else if(fe=g(U),typeof fe=="function")for(U=fe.call(U),fe=0;!(ne=U.next()).done;)ne=ne.value,Z=me+$(ne,fe++),ee+=j(ne,Q,z,Z,ce);else if(Z==="object"){if(typeof U.then=="function")return j(V(U),Q,z,ne,ce);throw Q=String(U),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ee}function K(U,Q,z){if(U==null)return U;var ne=[],ce=0;return j(U,ne,"","",function(Z){return Q.call(z,Z,ce++)}),ne}function G(U){if(U._status===-1){var Q=U._result;Q=Q(),Q.then(function(z){(U._status===0||U._status===-1)&&(U._status=1,U._result=z)},function(z){(U._status===0||U._status===-1)&&(U._status=2,U._result=z)}),U._status===-1&&(U._status=0,U._result=Q)}if(U._status===1)return U._result.default;throw U._result}var J=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},F={map:K,forEach:function(U,Q,z){K(U,function(){Q.apply(this,arguments)},z)},count:function(U){var Q=0;return K(U,function(){Q++}),Q},toArray:function(U){return K(U,function(Q){return Q})||[]},only:function(U){if(!L(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return bt.Activity=p,bt.Children=F,bt.Component=k,bt.Fragment=n,bt.Profiler=i,bt.PureComponent=E,bt.StrictMode=r,bt.Suspense=u,bt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,bt.__COMPILER_RUNTIME={__proto__:null,c:function(U){return C.H.useMemoCache(U)}},bt.cache=function(U){return function(){return U.apply(null,arguments)}},bt.cacheSignal=function(){return null},bt.cloneElement=function(U,Q,z){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ne=S({},U.props),ce=U.key;if(Q!=null)for(Z in Q.key!==void 0&&(ce=""+Q.key),Q)!O.call(Q,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&Q.ref===void 0||(ne[Z]=Q[Z]);var Z=arguments.length-2;if(Z===1)ne.children=z;else if(1<Z){for(var ee=Array(Z),me=0;me<Z;me++)ee[me]=arguments[me+2];ne.children=ee}return q(U.type,ce,ne)},bt.createContext=function(U){return U={$$typeof:a,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},bt.createElement=function(U,Q,z){var ne,ce={},Z=null;if(Q!=null)for(ne in Q.key!==void 0&&(Z=""+Q.key),Q)O.call(Q,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ce[ne]=Q[ne]);var ee=arguments.length-2;if(ee===1)ce.children=z;else if(1<ee){for(var me=Array(ee),fe=0;fe<ee;fe++)me[fe]=arguments[fe+2];ce.children=me}if(U&&U.defaultProps)for(ne in ee=U.defaultProps,ee)ce[ne]===void 0&&(ce[ne]=ee[ne]);return q(U,Z,ce)},bt.createRef=function(){return{current:null}},bt.forwardRef=function(U){return{$$typeof:c,render:U}},bt.isValidElement=L,bt.lazy=function(U){return{$$typeof:h,_payload:{_status:-1,_result:U},_init:G}},bt.memo=function(U,Q){return{$$typeof:d,type:U,compare:Q===void 0?null:Q}},bt.startTransition=function(U){var Q=C.T,z={};C.T=z;try{var ne=U(),ce=C.S;ce!==null&&ce(z,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(T,J)}catch(Z){J(Z)}finally{Q!==null&&z.types!==null&&(Q.types=z.types),C.T=Q}},bt.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},bt.use=function(U){return C.H.use(U)},bt.useActionState=function(U,Q,z){return C.H.useActionState(U,Q,z)},bt.useCallback=function(U,Q){return C.H.useCallback(U,Q)},bt.useContext=function(U){return C.H.useContext(U)},bt.useDebugValue=function(){},bt.useDeferredValue=function(U,Q){return C.H.useDeferredValue(U,Q)},bt.useEffect=function(U,Q){return C.H.useEffect(U,Q)},bt.useEffectEvent=function(U){return C.H.useEffectEvent(U)},bt.useId=function(){return C.H.useId()},bt.useImperativeHandle=function(U,Q,z){return C.H.useImperativeHandle(U,Q,z)},bt.useInsertionEffect=function(U,Q){return C.H.useInsertionEffect(U,Q)},bt.useLayoutEffect=function(U,Q){return C.H.useLayoutEffect(U,Q)},bt.useMemo=function(U,Q){return C.H.useMemo(U,Q)},bt.useOptimistic=function(U,Q){return C.H.useOptimistic(U,Q)},bt.useReducer=function(U,Q,z){return C.H.useReducer(U,Q,z)},bt.useRef=function(U){return C.H.useRef(U)},bt.useState=function(U){return C.H.useState(U)},bt.useSyncExternalStore=function(U,Q,z){return C.H.useSyncExternalStore(U,Q,z)},bt.useTransition=function(){return C.H.useTransition()},bt.version="19.2.0",bt}var sL;function ny(){return sL||(sL=1,u1.exports=PX()),u1.exports}var d1={exports:{}},vi={};var aL;function NX(){if(aL)return vi;aL=1;var e=ny();function t(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)d+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(u,d,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:u,containerInfo:d,implementation:h}}var a=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return vi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,vi.createPortal=function(u,d){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return o(u,d,null,h)},vi.flushSync=function(u){var d=a.T,h=r.p;try{if(a.T=null,r.p=2,u)return u()}finally{a.T=d,r.p=h,r.d.f()}},vi.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(u,d))},vi.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},vi.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var h=d.as,p=c(h,d.crossOrigin),y=typeof d.integrity=="string"?d.integrity:void 0,g=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;h==="style"?r.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:y,fetchPriority:g}):h==="script"&&r.d.X(u,{crossOrigin:p,integrity:y,fetchPriority:g,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},vi.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var h=c(d.as,d.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(u)},vi.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var h=d.as,p=c(h,d.crossOrigin);r.d.L(u,h,{crossOrigin:p,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})}},vi.preloadModule=function(u,d){if(typeof u=="string")if(d){var h=c(d.as,d.crossOrigin);r.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(u)},vi.requestFormReset=function(u){r.d.r(u)},vi.unstable_batchedUpdates=function(u,d){return u(d)},vi.useFormState=function(u,d,h){return a.H.useFormState(u,d,h)},vi.useFormStatus=function(){return a.H.useHostTransitionStatus()},vi.version="19.2.0",vi}var lL;function X3(){if(lL)return d1.exports;lL=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),d1.exports=NX(),d1.exports}var cL;function LX(){if(cL)return om;cL=1;var e=DX(),t=ny(),n=X3();function r(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f])}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 i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var l=s,f=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(f=l.return),s=l.return;while(s)}return l.tag===3?f: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 c(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 u(s){if(o(s)!==s)throw Error(r(188))}function d(s){var l=s.alternate;if(!l){if(l=o(s),l===null)throw Error(r(188));return l!==s?null:s}for(var f=s,m=l;;){var b=f.return;if(b===null)break;var w=b.alternate;if(w===null){if(m=b.return,m!==null){f=m;continue}break}if(b.child===w.child){for(w=b.child;w;){if(w===f)return u(b),s;if(w===m)return u(b),l;w=w.sibling}throw Error(r(188))}if(f.return!==m.return)f=b,m=w;else{for(var R=!1,H=b.child;H;){if(H===f){R=!0,f=b,m=w;break}if(H===m){R=!0,m=b,f=w;break}H=H.sibling}if(!R){for(H=w.child;H;){if(H===f){R=!0,f=w,m=b;break}if(H===m){R=!0,m=w,f=b;break}H=H.sibling}if(!R)throw Error(r(189))}}if(f.alternate!==m)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?s:l}function h(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=h(s),l!==null)return l;s=s.sibling}return null}var p=Object.assign,y=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=L&&s[L]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function $(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case k:return"Profiler";case x:return"StrictMode";case D:return"Suspense";case T:return"SuspenseList";case q:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case v:return"Portal";case E:return s.displayName||"Context";case _:return(s._context.displayName||"Context")+".Consumer";case M:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case C:return l=s.displayName||null,l!==null?l:$(s.type)||"Memo";case O:l=s._payload,s=s._init;try{return $(s(l))}catch{}}return null}var V=Array.isArray,j=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},J=[],F=-1;function U(s){return{current:s}}function Q(s){0>F||(s.current=J[F],J[F]=null,F--)}function z(s,l){F++,J[F]=s.current,s.current=l}var ne=U(null),ce=U(null),Z=U(null),ee=U(null);function me(s,l){switch(z(Z,l),z(ce,s),z(ne,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?_2(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=_2(l),s=E2(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Q(ne),z(ne,s)}function fe(){Q(ne),Q(ce),Q(Z)}function ye(s){s.memoizedState!==null&&z(ee,s);var l=ne.current,f=E2(l,s.type);l!==f&&(z(ce,s),z(ne,f))}function ie(s){ce.current===s&&(Q(ne),Q(ce)),ee.current===s&&(Q(ee),em._currentValue=G)}var xe,ke;function Ke(s){if(xe===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);xe=l&&l[1]||"",ke=-1<f.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+xe+s+ke}var Xe=!1;function Je(s,l){if(!s||Xe)return"";Xe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(pe){var de=pe}Reflect.construct(s,[],ve)}else{try{ve.call()}catch(pe){de=pe}s.call(ve.prototype)}}else{try{throw Error()}catch(pe){de=pe}(ve=s())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(pe){if(pe&&de&&typeof pe.stack=="string")return[pe.stack,de.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=m.DetermineComponentFrameRoot(),R=w[0],H=w[1];if(R&&H){var X=R.split(`
4
+ `),le=H.split(`
5
+ `);for(b=m=0;m<X.length&&!X[m].includes("DetermineComponentFrameRoot");)m++;for(;b<le.length&&!le[b].includes("DetermineComponentFrameRoot");)b++;if(m===X.length||b===le.length)for(m=X.length-1,b=le.length-1;1<=m&&0<=b&&X[m]!==le[b];)b--;for(;1<=m&&0<=b;m--,b--)if(X[m]!==le[b]){if(m!==1||b!==1)do if(m--,b--,0>b||X[m]!==le[b]){var ge=`
6
+ `+X[m].replace(" at new "," at ");return s.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",s.displayName)),ge}while(1<=m&&0<=b);break}}}finally{Xe=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?Ke(f):""}function dt(s,l){switch(s.tag){case 26:case 27:case 5:return Ke(s.type);case 16:return Ke("Lazy");case 13:return s.child!==l&&l!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return Je(s.type,!1);case 11:return Je(s.type.render,!1);case 1:return Je(s.type,!0);case 31:return Ke("Activity");default:return""}}function Ht(s){try{var l="",f=null;do l+=dt(s,f),f=s,s=s.return;while(s);return l}catch(m){return`
7
+ Error generating stack: `+m.message+`
8
+ `+m.stack}}var Et=Object.prototype.hasOwnProperty,Ue=e.unstable_scheduleCallback,Mn=e.unstable_cancelCallback,nn=e.unstable_shouldYield,Rn=e.unstable_requestPaint,pt=e.unstable_now,Zn=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,We=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,Jt=e.log,Gt=e.unstable_setDisableYieldValue,gt=null,mt=null;function Le(s){if(typeof Jt=="function"&&Gt(s),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(gt,s)}catch{}}var tt=Math.clz32?Math.clz32:Me,ln=Math.log,oe=Math.LN2;function Me(s){return s>>>=0,s===0?32:31-(ln(s)/oe|0)|0}var Be=256,Ee=262144,De=4194304;function Re(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 _e(s,l,f){var m=s.pendingLanes;if(m===0)return 0;var b=0,w=s.suspendedLanes,R=s.pingedLanes;s=s.warmLanes;var H=m&134217727;return H!==0?(m=H&~w,m!==0?b=Re(m):(R&=H,R!==0?b=Re(R):f||(f=H&~s,f!==0&&(b=Re(f))))):(H=m&~w,H!==0?b=Re(H):R!==0?b=Re(R):f||(f=m&~s,f!==0&&(b=Re(f)))),b===0?0:l!==0&&l!==b&&(l&w)===0&&(w=b&-b,f=l&-l,w>=f||w===32&&(f&4194048)!==0)?l:b}function Tt(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function Hr(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 ei(){var s=De;return De<<=1,(De&62914560)===0&&(De=4194304),s}function Lt(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function Rt(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function yt(s,l,f,m,b,w){var R=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var H=s.entanglements,X=s.expirationTimes,le=s.hiddenUpdates;for(f=R&~f;0<f;){var ge=31-tt(f),ve=1<<ge;H[ge]=0,X[ge]=-1;var de=le[ge];if(de!==null)for(le[ge]=null,ge=0;ge<de.length;ge++){var pe=de[ge];pe!==null&&(pe.lane&=-536870913)}f&=~ve}m!==0&&At(s,m,0),w!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=w&~(R&~l))}function At(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var m=31-tt(l);s.entangledLanes|=l,s.entanglements[m]=s.entanglements[m]|1073741824|f&261930}function Nr(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var m=31-tt(f),b=1<<m;b&l|s[m]&l&&(s[m]|=l),f&=~b}}function Nn(s,l){var f=l&-l;return f=(f&42)!==0?1:Ct(f),(f&(s.suspendedLanes|l))!==0?0:f}function Ct(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 xn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function pn(){var s=K.p;return s!==0?s:(s=window.event,s===void 0?32:G2(s.type))}function Ea(s,l){var f=K.p;try{return K.p=s,l()}finally{K.p=f}}var Lr=Math.random().toString(36).slice(2),cn="__reactFiber$"+Lr,wn="__reactProps$"+Lr,Us="__reactContainer$"+Lr,qs="__reactEvents$"+Lr,Vc="__reactListeners$"+Lr,Rd="__reactHandles$"+Lr,ib="__reactResources$"+Lr,Tl="__reactMarker$"+Lr;function Hc(s){delete s[cn],delete s[wn],delete s[qs],delete s[Vc],delete s[Rd]}function Ta(s){var l=s[cn];if(l)return l;for(var f=s.parentNode;f;){if(l=f[Us]||f[cn]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=O2(s);s!==null;){if(f=s[cn])return f;s=O2(s)}return l}s=f,f=s.parentNode}return null}function Do(s){if(s=s[cn]||s[Us]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Ca(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(r(33))}function Kc(s){var l=s[ib];return l||(l=s[ib]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Kr(s){s[Tl]=!0}var fD=new Set,hD={};function Wc(s,l){Ad(s,l),Ad(s+"Capture",l)}function Ad(s,l){for(hD[s]=l,s=0;s<l.length;s++)fD.add(l[s])}var SY=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]*$"),pD={},mD={};function xY(s){return Et.call(mD,s)?!0:Et.call(pD,s)?!1:SY.test(s)?mD[s]=!0:(pD[s]=!0,!1)}function ob(s,l,f){if(xY(l))if(f===null)s.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+f)}}function sb(s,l,f){if(f===null)s.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+f)}}function Ia(s,l,f,m){if(m===null)s.removeAttribute(f);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(f);return}s.setAttributeNS(l,f,""+m)}}function Po(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function gD(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function wY(s,l,f){var m=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,w=m.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return b.call(this)},set:function(R){f=""+R,w.call(this,R)}}),Object.defineProperty(s,l,{enumerable:m.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function Zw(s){if(!s._valueTracker){var l=gD(s)?"checked":"value";s._valueTracker=wY(s,l,""+s[l])}}function yD(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var f=l.getValue(),m="";return s&&(m=gD(s)?s.checked?"true":"false":s.value),s=m,s!==f?(l.setValue(s),!0):!1}function ab(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 kY=/[\n"\\]/g;function No(s){return s.replace(kY,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ek(s,l,f,m,b,w,R,H){s.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?s.type=R:s.removeAttribute("type"),l!=null?R==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+Po(l)):s.value!==""+Po(l)&&(s.value=""+Po(l)):R!=="submit"&&R!=="reset"||s.removeAttribute("value"),l!=null?tk(s,R,Po(l)):f!=null?tk(s,R,Po(f)):m!=null&&s.removeAttribute("value"),b==null&&w!=null&&(s.defaultChecked=!!w),b!=null&&(s.checked=b&&typeof b!="function"&&typeof b!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?s.name=""+Po(H):s.removeAttribute("name")}function bD(s,l,f,m,b,w,R,H){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(s.type=w),l!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||l!=null)){Zw(s);return}f=f!=null?""+Po(f):"",l=l!=null?""+Po(l):f,H||l===s.value||(s.value=l),s.defaultValue=l}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,s.checked=H?s.checked:!!m,s.defaultChecked=!!m,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(s.name=R),Zw(s)}function tk(s,l,f){l==="number"&&ab(s.ownerDocument)===s||s.defaultValue===""+f||(s.defaultValue=""+f)}function Od(s,l,f,m){if(s=s.options,l){l={};for(var b=0;b<f.length;b++)l["$"+f[b]]=!0;for(f=0;f<s.length;f++)b=l.hasOwnProperty("$"+s[f].value),s[f].selected!==b&&(s[f].selected=b),b&&m&&(s[f].defaultSelected=!0)}else{for(f=""+Po(f),l=null,b=0;b<s.length;b++){if(s[b].value===f){s[b].selected=!0,m&&(s[b].defaultSelected=!0);return}l!==null||s[b].disabled||(l=s[b])}l!==null&&(l.selected=!0)}}function vD(s,l,f){if(l!=null&&(l=""+Po(l),l!==s.value&&(s.value=l),f==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=f!=null?""+Po(f):""}function SD(s,l,f,m){if(l==null){if(m!=null){if(f!=null)throw Error(r(92));if(V(m)){if(1<m.length)throw Error(r(93));m=m[0]}f=m}f==null&&(f=""),l=f}f=Po(l),s.defaultValue=f,m=s.textContent,m===f&&m!==""&&m!==null&&(s.value=m),Zw(s)}function Dd(s,l){if(l){var f=s.firstChild;if(f&&f===s.lastChild&&f.nodeType===3){f.nodeValue=l;return}}s.textContent=l}var _Y=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 xD(s,l,f){var m=l.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?m?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":m?s.setProperty(l,f):typeof f!="number"||f===0||_Y.has(l)?l==="float"?s.cssFloat=f:s[l]=(""+f).trim():s[l]=f+"px"}function wD(s,l,f){if(l!=null&&typeof l!="object")throw Error(r(62));if(s=s.style,f!=null){for(var m in f)!f.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?s.setProperty(m,""):m==="float"?s.cssFloat="":s[m]="");for(var b in l)m=l[b],l.hasOwnProperty(b)&&f[b]!==m&&xD(s,b,m)}else for(var w in l)l.hasOwnProperty(w)&&xD(s,w,l[w])}function nk(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 EY=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"]]),TY=/^[\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 lb(s){return TY.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ma(){}var rk=null;function ik(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Pd=null,Nd=null;function kD(s){var l=Do(s);if(l&&(s=l.stateNode)){var f=s[wn]||null;e:switch(s=l.stateNode,l.type){case"input":if(ek(s,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),l=f.name,f.type==="radio"&&l!=null){for(f=s;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+No(""+l)+'"][type="radio"]'),l=0;l<f.length;l++){var m=f[l];if(m!==s&&m.form===s.form){var b=m[wn]||null;if(!b)throw Error(r(90));ek(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(l=0;l<f.length;l++)m=f[l],m.form===s.form&&yD(m)}break e;case"textarea":vD(s,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&Od(s,!!f.multiple,l,!1)}}}var ok=!1;function _D(s,l,f){if(ok)return s(l,f);ok=!0;try{var m=s(l);return m}finally{if(ok=!1,(Pd!==null||Nd!==null)&&(Yb(),Pd&&(l=Pd,s=Nd,Nd=Pd=null,kD(l),s)))for(l=0;l<s.length;l++)kD(s[l])}}function yp(s,l){var f=s.stateNode;if(f===null)return null;var m=f[wn]||null;if(m===null)return null;f=m[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":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(f&&typeof f!="function")throw Error(r(231,l,typeof f));return f}var Ra=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sk=!1;if(Ra)try{var bp={};Object.defineProperty(bp,"passive",{get:function(){sk=!0}}),window.addEventListener("test",bp,bp),window.removeEventListener("test",bp,bp)}catch{sk=!1}var Cl=null,ak=null,cb=null;function ED(){if(cb)return cb;var s,l=ak,f=l.length,m,b="value"in Cl?Cl.value:Cl.textContent,w=b.length;for(s=0;s<f&&l[s]===b[s];s++);var R=f-s;for(m=1;m<=R&&l[f-m]===b[w-m];m++);return cb=b.slice(s,1<m?1-m:void 0)}function ub(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 db(){return!0}function TD(){return!1}function Hi(s){function l(f,m,b,w,R){this._reactName=f,this._targetInst=b,this.type=m,this.nativeEvent=w,this.target=R,this.currentTarget=null;for(var H in s)s.hasOwnProperty(H)&&(f=s[H],this[H]=f?f(w):w[H]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?db:TD,this.isPropagationStopped=TD,this}return p(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=db)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=db)},persist:function(){},isPersistent:db}),l}var Gc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fb=Hi(Gc),vp=p({},Gc,{view:0,detail:0}),CY=Hi(vp),lk,ck,Sp,hb=p({},vp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dk,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!==Sp&&(Sp&&s.type==="mousemove"?(lk=s.screenX-Sp.screenX,ck=s.screenY-Sp.screenY):ck=lk=0,Sp=s),lk)},movementY:function(s){return"movementY"in s?s.movementY:ck}}),CD=Hi(hb),IY=p({},hb,{dataTransfer:0}),MY=Hi(IY),RY=p({},vp,{relatedTarget:0}),uk=Hi(RY),AY=p({},Gc,{animationName:0,elapsedTime:0,pseudoElement:0}),OY=Hi(AY),DY=p({},Gc,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),PY=Hi(DY),NY=p({},Gc,{data:0}),ID=Hi(NY),LY={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$Y={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"},jY={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function FY(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=jY[s])?!!l[s]:!1}function dk(){return FY}var zY=p({},vp,{key:function(s){if(s.key){var l=LY[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=ub(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?$Y[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dk,charCode:function(s){return s.type==="keypress"?ub(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ub(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),BY=Hi(zY),UY=p({},hb,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),MD=Hi(UY),qY=p({},vp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dk}),VY=Hi(qY),HY=p({},Gc,{propertyName:0,elapsedTime:0,pseudoElement:0}),KY=Hi(HY),WY=p({},hb,{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}),GY=Hi(WY),YY=p({},Gc,{newState:0,oldState:0}),QY=Hi(YY),XY=[9,13,27,32],fk=Ra&&"CompositionEvent"in window,xp=null;Ra&&"documentMode"in document&&(xp=document.documentMode);var JY=Ra&&"TextEvent"in window&&!xp,RD=Ra&&(!fk||xp&&8<xp&&11>=xp),AD=" ",OD=!1;function DD(s,l){switch(s){case"keyup":return XY.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function PD(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ld=!1;function ZY(s,l){switch(s){case"compositionend":return PD(l);case"keypress":return l.which!==32?null:(OD=!0,AD);case"textInput":return s=l.data,s===AD&&OD?null:s;default:return null}}function eQ(s,l){if(Ld)return s==="compositionend"||!fk&&DD(s,l)?(s=ED(),cb=ak=Cl=null,Ld=!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 RD&&l.locale!=="ko"?null:l.data;default:return null}}var tQ={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 ND(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!tQ[s.type]:l==="textarea"}function LD(s,l,f,m){Pd?Nd?Nd.push(m):Nd=[m]:Pd=m,l=nv(l,"onChange"),0<l.length&&(f=new fb("onChange","change",null,f,m),s.push({event:f,listeners:l}))}var wp=null,kp=null;function nQ(s){b2(s,0)}function pb(s){var l=Ca(s);if(yD(l))return s}function $D(s,l){if(s==="change")return l}var jD=!1;if(Ra){var hk;if(Ra){var pk="oninput"in document;if(!pk){var FD=document.createElement("div");FD.setAttribute("oninput","return;"),pk=typeof FD.oninput=="function"}hk=pk}else hk=!1;jD=hk&&(!document.documentMode||9<document.documentMode)}function zD(){wp&&(wp.detachEvent("onpropertychange",BD),kp=wp=null)}function BD(s){if(s.propertyName==="value"&&pb(kp)){var l=[];LD(l,kp,s,ik(s)),_D(nQ,l)}}function rQ(s,l,f){s==="focusin"?(zD(),wp=l,kp=f,wp.attachEvent("onpropertychange",BD)):s==="focusout"&&zD()}function iQ(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pb(kp)}function oQ(s,l){if(s==="click")return pb(l)}function sQ(s,l){if(s==="input"||s==="change")return pb(l)}function aQ(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var ao=typeof Object.is=="function"?Object.is:aQ;function _p(s,l){if(ao(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var f=Object.keys(s),m=Object.keys(l);if(f.length!==m.length)return!1;for(m=0;m<f.length;m++){var b=f[m];if(!Et.call(l,b)||!ao(s[b],l[b]))return!1}return!0}function UD(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function qD(s,l){var f=UD(s);s=0;for(var m;f;){if(f.nodeType===3){if(m=s+f.textContent.length,s<=l&&m>=l)return{node:f,offset:l-s};s=m}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=UD(f)}}function VD(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?VD(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function HD(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=ab(s.document);l instanceof s.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)s=l.contentWindow;else break;l=ab(s.document)}return l}function mk(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 lQ=Ra&&"documentMode"in document&&11>=document.documentMode,$d=null,gk=null,Ep=null,yk=!1;function KD(s,l,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;yk||$d==null||$d!==ab(m)||(m=$d,"selectionStart"in m&&mk(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Ep&&_p(Ep,m)||(Ep=m,m=nv(gk,"onSelect"),0<m.length&&(l=new fb("onSelect","select",null,l,f),s.push({event:l,listeners:m}),l.target=$d)))}function Yc(s,l){var f={};return f[s.toLowerCase()]=l.toLowerCase(),f["Webkit"+s]="webkit"+l,f["Moz"+s]="moz"+l,f}var jd={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionrun:Yc("Transition","TransitionRun"),transitionstart:Yc("Transition","TransitionStart"),transitioncancel:Yc("Transition","TransitionCancel"),transitionend:Yc("Transition","TransitionEnd")},bk={},WD={};Ra&&(WD=document.createElement("div").style,"AnimationEvent"in window||(delete jd.animationend.animation,delete jd.animationiteration.animation,delete jd.animationstart.animation),"TransitionEvent"in window||delete jd.transitionend.transition);function Qc(s){if(bk[s])return bk[s];if(!jd[s])return s;var l=jd[s],f;for(f in l)if(l.hasOwnProperty(f)&&f in WD)return bk[s]=l[f];return s}var GD=Qc("animationend"),YD=Qc("animationiteration"),QD=Qc("animationstart"),cQ=Qc("transitionrun"),uQ=Qc("transitionstart"),dQ=Qc("transitioncancel"),XD=Qc("transitionend"),JD=new Map,vk="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(" ");vk.push("scrollEnd");function hs(s,l){JD.set(s,l),Wc(l,[s])}var mb=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)},Lo=[],Fd=0,Sk=0;function gb(){for(var s=Fd,l=Sk=Fd=0;l<s;){var f=Lo[l];Lo[l++]=null;var m=Lo[l];Lo[l++]=null;var b=Lo[l];Lo[l++]=null;var w=Lo[l];if(Lo[l++]=null,m!==null&&b!==null){var R=m.pending;R===null?b.next=b:(b.next=R.next,R.next=b),m.pending=b}w!==0&&ZD(f,b,w)}}function yb(s,l,f,m){Lo[Fd++]=s,Lo[Fd++]=l,Lo[Fd++]=f,Lo[Fd++]=m,Sk|=m,s.lanes|=m,s=s.alternate,s!==null&&(s.lanes|=m)}function xk(s,l,f,m){return yb(s,l,f,m),bb(s)}function Xc(s,l){return yb(s,null,null,l),bb(s)}function ZD(s,l,f){s.lanes|=f;var m=s.alternate;m!==null&&(m.lanes|=f);for(var b=!1,w=s.return;w!==null;)w.childLanes|=f,m=w.alternate,m!==null&&(m.childLanes|=f),w.tag===22&&(s=w.stateNode,s===null||s._visibility&1||(b=!0)),s=w,w=w.return;return s.tag===3?(w=s.stateNode,b&&l!==null&&(b=31-tt(f),s=w.hiddenUpdates,m=s[b],m===null?s[b]=[l]:m.push(l),l.lane=f|536870912),w):null}function bb(s){if(50<Wp)throw Wp=0,R_=null,Error(r(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var zd={};function fQ(s,l,f,m){this.tag=s,this.key=f,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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lo(s,l,f,m){return new fQ(s,l,f,m)}function wk(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Aa(s,l){var f=s.alternate;return f===null?(f=lo(s.tag,l,s.key,s.mode),f.elementType=s.elementType,f.type=s.type,f.stateNode=s.stateNode,f.alternate=s,s.alternate=f):(f.pendingProps=l,f.type=s.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=s.flags&65011712,f.childLanes=s.childLanes,f.lanes=s.lanes,f.child=s.child,f.memoizedProps=s.memoizedProps,f.memoizedState=s.memoizedState,f.updateQueue=s.updateQueue,l=s.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=s.sibling,f.index=s.index,f.ref=s.ref,f.refCleanup=s.refCleanup,f}function eP(s,l){s.flags&=65011714;var f=s.alternate;return f===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=f.childLanes,s.lanes=f.lanes,s.child=f.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=f.memoizedProps,s.memoizedState=f.memoizedState,s.updateQueue=f.updateQueue,s.type=f.type,l=f.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function vb(s,l,f,m,b,w){var R=0;if(m=s,typeof s=="function")wk(s)&&(R=1);else if(typeof s=="string")R=yX(s,f,ne.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case q:return s=lo(31,f,l,b),s.elementType=q,s.lanes=w,s;case S:return Jc(f.children,b,w,l);case x:R=8,b|=24;break;case k:return s=lo(12,f,l,b|2),s.elementType=k,s.lanes=w,s;case D:return s=lo(13,f,l,b),s.elementType=D,s.lanes=w,s;case T:return s=lo(19,f,l,b),s.elementType=T,s.lanes=w,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case E:R=10;break e;case _:R=9;break e;case M:R=11;break e;case C:R=14;break e;case O:R=16,m=null;break e}R=29,f=Error(r(130,s===null?"null":typeof s,"")),m=null}return l=lo(R,f,l,b),l.elementType=s,l.type=m,l.lanes=w,l}function Jc(s,l,f,m){return s=lo(7,s,m,l),s.lanes=f,s}function kk(s,l,f){return s=lo(6,s,null,l),s.lanes=f,s}function tP(s){var l=lo(18,null,null,0);return l.stateNode=s,l}function _k(s,l,f){return l=lo(4,s.children!==null?s.children:[],s.key,l),l.lanes=f,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var nP=new WeakMap;function $o(s,l){if(typeof s=="object"&&s!==null){var f=nP.get(s);return f!==void 0?f:(l={value:s,source:l,stack:Ht(l)},nP.set(s,l),l)}return{value:s,source:l,stack:Ht(l)}}var Bd=[],Ud=0,Sb=null,Tp=0,jo=[],Fo=0,Il=null,Vs=1,Hs="";function Oa(s,l){Bd[Ud++]=Tp,Bd[Ud++]=Sb,Sb=s,Tp=l}function rP(s,l,f){jo[Fo++]=Vs,jo[Fo++]=Hs,jo[Fo++]=Il,Il=s;var m=Vs;s=Hs;var b=32-tt(m)-1;m&=~(1<<b),f+=1;var w=32-tt(l)+b;if(30<w){var R=b-b%5;w=(m&(1<<R)-1).toString(32),m>>=R,b-=R,Vs=1<<32-tt(l)+b|f<<b|m,Hs=w+s}else Vs=1<<w|f<<b|m,Hs=s}function Ek(s){s.return!==null&&(Oa(s,1),rP(s,1,0))}function Tk(s){for(;s===Sb;)Sb=Bd[--Ud],Bd[Ud]=null,Tp=Bd[--Ud],Bd[Ud]=null;for(;s===Il;)Il=jo[--Fo],jo[Fo]=null,Hs=jo[--Fo],jo[Fo]=null,Vs=jo[--Fo],jo[Fo]=null}function iP(s,l){jo[Fo++]=Vs,jo[Fo++]=Hs,jo[Fo++]=Il,Vs=l.id,Hs=l.overflow,Il=s}var ti=null,Ln=null,Vt=!1,Ml=null,zo=!1,Ck=Error(r(519));function Rl(s){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cp($o(l,s)),Ck}function oP(s){var l=s.stateNode,f=s.type,m=s.memoizedProps;switch(l[cn]=s,l[wn]=m,f){case"dialog":Dt("cancel",l),Dt("close",l);break;case"iframe":case"object":case"embed":Dt("load",l);break;case"video":case"audio":for(f=0;f<Yp.length;f++)Dt(Yp[f],l);break;case"source":Dt("error",l);break;case"img":case"image":case"link":Dt("error",l),Dt("load",l);break;case"details":Dt("toggle",l);break;case"input":Dt("invalid",l),bD(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Dt("invalid",l);break;case"textarea":Dt("invalid",l),SD(l,m.value,m.defaultValue,m.children)}f=m.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||l.textContent===""+f||m.suppressHydrationWarning===!0||w2(l.textContent,f)?(m.popover!=null&&(Dt("beforetoggle",l),Dt("toggle",l)),m.onScroll!=null&&Dt("scroll",l),m.onScrollEnd!=null&&Dt("scrollend",l),m.onClick!=null&&(l.onclick=Ma),l=!0):l=!1,l||Rl(s,!0)}function sP(s){for(ti=s.return;ti;)switch(ti.tag){case 5:case 31:case 13:zo=!1;return;case 27:case 3:zo=!0;return;default:ti=ti.return}}function qd(s){if(s!==ti)return!1;if(!Vt)return sP(s),Vt=!0,!1;var l=s.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=s.type,f=!(f!=="form"&&f!=="button")||H_(s.type,s.memoizedProps)),f=!f),f&&Ln&&Rl(s),sP(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Ln=A2(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Ln=A2(s)}else l===27?(l=Ln,Vl(s.type)?(s=Q_,Q_=null,Ln=s):Ln=l):Ln=ti?Uo(s.stateNode.nextSibling):null;return!0}function Zc(){Ln=ti=null,Vt=!1}function Ik(){var s=Ml;return s!==null&&(Yi===null?Yi=s:Yi.push.apply(Yi,s),Ml=null),s}function Cp(s){Ml===null?Ml=[s]:Ml.push(s)}var Mk=U(null),eu=null,Da=null;function Al(s,l,f){z(Mk,l._currentValue),l._currentValue=f}function Pa(s){s._currentValue=Mk.current,Q(Mk)}function Rk(s,l,f){for(;s!==null;){var m=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),s===f)break;s=s.return}}function Ak(s,l,f,m){var b=s.child;for(b!==null&&(b.return=s);b!==null;){var w=b.dependencies;if(w!==null){var R=b.child;w=w.firstContext;e:for(;w!==null;){var H=w;w=b;for(var X=0;X<l.length;X++)if(H.context===l[X]){w.lanes|=f,H=w.alternate,H!==null&&(H.lanes|=f),Rk(w.return,f,s),m||(R=null);break e}w=H.next}}else if(b.tag===18){if(R=b.return,R===null)throw Error(r(341));R.lanes|=f,w=R.alternate,w!==null&&(w.lanes|=f),Rk(R,f,s),R=null}else R=b.child;if(R!==null)R.return=b;else for(R=b;R!==null;){if(R===s){R=null;break}if(b=R.sibling,b!==null){b.return=R.return,R=b;break}R=R.return}b=R}}function Vd(s,l,f,m){s=null;for(var b=l,w=!1;b!==null;){if(!w){if((b.flags&524288)!==0)w=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var R=b.alternate;if(R===null)throw Error(r(387));if(R=R.memoizedProps,R!==null){var H=b.type;ao(b.pendingProps.value,R.value)||(s!==null?s.push(H):s=[H])}}else if(b===ee.current){if(R=b.alternate,R===null)throw Error(r(387));R.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(s!==null?s.push(em):s=[em])}b=b.return}s!==null&&Ak(l,s,f,m),l.flags|=262144}function xb(s){for(s=s.firstContext;s!==null;){if(!ao(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function tu(s){eu=s,Da=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function ni(s){return aP(eu,s)}function wb(s,l){return eu===null&&tu(s),aP(s,l)}function aP(s,l){var f=l._currentValue;if(l={context:l,memoizedValue:f,next:null},Da===null){if(s===null)throw Error(r(308));Da=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else Da=Da.next=l;return f}var hQ=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(f,m){s.push(m)}};this.abort=function(){l.aborted=!0,s.forEach(function(f){return f()})}},pQ=e.unstable_scheduleCallback,mQ=e.unstable_NormalPriority,kr={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ok(){return{controller:new hQ,data:new Map,refCount:0}}function Ip(s){s.refCount--,s.refCount===0&&pQ(mQ,function(){s.controller.abort()})}var Mp=null,Dk=0,Hd=0,Kd=null;function gQ(s,l){if(Mp===null){var f=Mp=[];Dk=0,Hd=L_(),Kd={status:"pending",value:void 0,then:function(m){f.push(m)}}}return Dk++,l.then(lP,lP),l}function lP(){if(--Dk===0&&Mp!==null){Kd!==null&&(Kd.status="fulfilled");var s=Mp;Mp=null,Hd=0,Kd=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function yQ(s,l){var f=[],m={status:"pending",value:null,reason:null,then:function(b){f.push(b)}};return s.then(function(){m.status="fulfilled",m.value=l;for(var b=0;b<f.length;b++)(0,f[b])(l)},function(b){for(m.status="rejected",m.reason=b,b=0;b<f.length;b++)(0,f[b])(void 0)}),m}var cP=j.S;j.S=function(s,l){KN=pt(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&gQ(s,l),cP!==null&&cP(s,l)};var nu=U(null);function Pk(){var s=nu.current;return s!==null?s:kn.pooledCache}function kb(s,l){l===null?z(nu,nu.current):z(nu,l.pool)}function uP(){var s=Pk();return s===null?null:{parent:kr._currentValue,pool:s}}var Wd=Error(r(460)),Nk=Error(r(474)),_b=Error(r(542)),Eb={then:function(){}};function dP(s){return s=s.status,s==="fulfilled"||s==="rejected"}function fP(s,l,f){switch(f=s[f],f===void 0?s.push(l):f!==l&&(l.then(Ma,Ma),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,pP(s),s;default:if(typeof l.status=="string")l.then(Ma,Ma);else{if(s=kn,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=l,s.status="pending",s.then(function(m){if(l.status==="pending"){var b=l;b.status="fulfilled",b.value=m}},function(m){if(l.status==="pending"){var b=l;b.status="rejected",b.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,pP(s),s}throw iu=l,Wd}}function ru(s){try{var l=s._init;return l(s._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(iu=f,Wd):f}}var iu=null;function hP(){if(iu===null)throw Error(r(459));var s=iu;return iu=null,s}function pP(s){if(s===Wd||s===_b)throw Error(r(483))}var Gd=null,Rp=0;function Tb(s){var l=Rp;return Rp+=1,Gd===null&&(Gd=[]),fP(Gd,s,l)}function Ap(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function Cb(s,l){throw l.$$typeof===y?Error(r(525)):(s=Object.prototype.toString.call(l),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function mP(s){function l(re,te){if(s){var se=re.deletions;se===null?(re.deletions=[te],re.flags|=16):se.push(te)}}function f(re,te){if(!s)return null;for(;te!==null;)l(re,te),te=te.sibling;return null}function m(re){for(var te=new Map;re!==null;)re.key!==null?te.set(re.key,re):te.set(re.index,re),re=re.sibling;return te}function b(re,te){return re=Aa(re,te),re.index=0,re.sibling=null,re}function w(re,te,se){return re.index=se,s?(se=re.alternate,se!==null?(se=se.index,se<te?(re.flags|=67108866,te):se):(re.flags|=67108866,te)):(re.flags|=1048576,te)}function R(re){return s&&re.alternate===null&&(re.flags|=67108866),re}function H(re,te,se,be){return te===null||te.tag!==6?(te=kk(se,re.mode,be),te.return=re,te):(te=b(te,se),te.return=re,te)}function X(re,te,se,be){var Ye=se.type;return Ye===S?ge(re,te,se.props.children,be,se.key):te!==null&&(te.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===O&&ru(Ye)===te.type)?(te=b(te,se.props),Ap(te,se),te.return=re,te):(te=vb(se.type,se.key,se.props,null,re.mode,be),Ap(te,se),te.return=re,te)}function le(re,te,se,be){return te===null||te.tag!==4||te.stateNode.containerInfo!==se.containerInfo||te.stateNode.implementation!==se.implementation?(te=_k(se,re.mode,be),te.return=re,te):(te=b(te,se.children||[]),te.return=re,te)}function ge(re,te,se,be,Ye){return te===null||te.tag!==7?(te=Jc(se,re.mode,be,Ye),te.return=re,te):(te=b(te,se),te.return=re,te)}function ve(re,te,se){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=kk(""+te,re.mode,se),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case g:return se=vb(te.type,te.key,te.props,null,re.mode,se),Ap(se,te),se.return=re,se;case v:return te=_k(te,re.mode,se),te.return=re,te;case O:return te=ru(te),ve(re,te,se)}if(V(te)||P(te))return te=Jc(te,re.mode,se,null),te.return=re,te;if(typeof te.then=="function")return ve(re,Tb(te),se);if(te.$$typeof===E)return ve(re,wb(re,te),se);Cb(re,te)}return null}function de(re,te,se,be){var Ye=te!==null?te.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return Ye!==null?null:H(re,te,""+se,be);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case g:return se.key===Ye?X(re,te,se,be):null;case v:return se.key===Ye?le(re,te,se,be):null;case O:return se=ru(se),de(re,te,se,be)}if(V(se)||P(se))return Ye!==null?null:ge(re,te,se,be,null);if(typeof se.then=="function")return de(re,te,Tb(se),be);if(se.$$typeof===E)return de(re,te,wb(re,se),be);Cb(re,se)}return null}function pe(re,te,se,be,Ye){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return re=re.get(se)||null,H(te,re,""+be,Ye);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case g:return re=re.get(be.key===null?se:be.key)||null,X(te,re,be,Ye);case v:return re=re.get(be.key===null?se:be.key)||null,le(te,re,be,Ye);case O:return be=ru(be),pe(re,te,se,be,Ye)}if(V(be)||P(be))return re=re.get(se)||null,ge(te,re,be,Ye,null);if(typeof be.then=="function")return pe(re,te,se,Tb(be),Ye);if(be.$$typeof===E)return pe(re,te,se,wb(te,be),Ye);Cb(te,be)}return null}function $e(re,te,se,be){for(var Ye=null,Yt=null,qe=te,xt=te=0,jt=null;qe!==null&&xt<se.length;xt++){qe.index>xt?(jt=qe,qe=null):jt=qe.sibling;var Qt=de(re,qe,se[xt],be);if(Qt===null){qe===null&&(qe=jt);break}s&&qe&&Qt.alternate===null&&l(re,qe),te=w(Qt,te,xt),Yt===null?Ye=Qt:Yt.sibling=Qt,Yt=Qt,qe=jt}if(xt===se.length)return f(re,qe),Vt&&Oa(re,xt),Ye;if(qe===null){for(;xt<se.length;xt++)qe=ve(re,se[xt],be),qe!==null&&(te=w(qe,te,xt),Yt===null?Ye=qe:Yt.sibling=qe,Yt=qe);return Vt&&Oa(re,xt),Ye}for(qe=m(qe);xt<se.length;xt++)jt=pe(qe,re,xt,se[xt],be),jt!==null&&(s&&jt.alternate!==null&&qe.delete(jt.key===null?xt:jt.key),te=w(jt,te,xt),Yt===null?Ye=jt:Yt.sibling=jt,Yt=jt);return s&&qe.forEach(function(Yl){return l(re,Yl)}),Vt&&Oa(re,xt),Ye}function nt(re,te,se,be){if(se==null)throw Error(r(151));for(var Ye=null,Yt=null,qe=te,xt=te=0,jt=null,Qt=se.next();qe!==null&&!Qt.done;xt++,Qt=se.next()){qe.index>xt?(jt=qe,qe=null):jt=qe.sibling;var Yl=de(re,qe,Qt.value,be);if(Yl===null){qe===null&&(qe=jt);break}s&&qe&&Yl.alternate===null&&l(re,qe),te=w(Yl,te,xt),Yt===null?Ye=Yl:Yt.sibling=Yl,Yt=Yl,qe=jt}if(Qt.done)return f(re,qe),Vt&&Oa(re,xt),Ye;if(qe===null){for(;!Qt.done;xt++,Qt=se.next())Qt=ve(re,Qt.value,be),Qt!==null&&(te=w(Qt,te,xt),Yt===null?Ye=Qt:Yt.sibling=Qt,Yt=Qt);return Vt&&Oa(re,xt),Ye}for(qe=m(qe);!Qt.done;xt++,Qt=se.next())Qt=pe(qe,re,xt,Qt.value,be),Qt!==null&&(s&&Qt.alternate!==null&&qe.delete(Qt.key===null?xt:Qt.key),te=w(Qt,te,xt),Yt===null?Ye=Qt:Yt.sibling=Qt,Yt=Qt);return s&&qe.forEach(function(IX){return l(re,IX)}),Vt&&Oa(re,xt),Ye}function yn(re,te,se,be){if(typeof se=="object"&&se!==null&&se.type===S&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case g:e:{for(var Ye=se.key;te!==null;){if(te.key===Ye){if(Ye=se.type,Ye===S){if(te.tag===7){f(re,te.sibling),be=b(te,se.props.children),be.return=re,re=be;break e}}else if(te.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===O&&ru(Ye)===te.type){f(re,te.sibling),be=b(te,se.props),Ap(be,se),be.return=re,re=be;break e}f(re,te);break}else l(re,te);te=te.sibling}se.type===S?(be=Jc(se.props.children,re.mode,be,se.key),be.return=re,re=be):(be=vb(se.type,se.key,se.props,null,re.mode,be),Ap(be,se),be.return=re,re=be)}return R(re);case v:e:{for(Ye=se.key;te!==null;){if(te.key===Ye)if(te.tag===4&&te.stateNode.containerInfo===se.containerInfo&&te.stateNode.implementation===se.implementation){f(re,te.sibling),be=b(te,se.children||[]),be.return=re,re=be;break e}else{f(re,te);break}else l(re,te);te=te.sibling}be=_k(se,re.mode,be),be.return=re,re=be}return R(re);case O:return se=ru(se),yn(re,te,se,be)}if(V(se))return $e(re,te,se,be);if(P(se)){if(Ye=P(se),typeof Ye!="function")throw Error(r(150));return se=Ye.call(se),nt(re,te,se,be)}if(typeof se.then=="function")return yn(re,te,Tb(se),be);if(se.$$typeof===E)return yn(re,te,wb(re,se),be);Cb(re,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,te!==null&&te.tag===6?(f(re,te.sibling),be=b(te,se),be.return=re,re=be):(f(re,te),be=kk(se,re.mode,be),be.return=re,re=be),R(re)):f(re,te)}return function(re,te,se,be){try{Rp=0;var Ye=yn(re,te,se,be);return Gd=null,Ye}catch(qe){if(qe===Wd||qe===_b)throw qe;var Yt=lo(29,qe,null,re.mode);return Yt.lanes=be,Yt.return=re,Yt}finally{}}}var ou=mP(!0),gP=mP(!1),Ol=!1;function Lk(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $k(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 Dl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Pl(s,l,f){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(Zt&2)!==0){var b=m.pending;return b===null?l.next=l:(l.next=b.next,b.next=l),m.pending=l,l=bb(s),ZD(s,null,f),l}return yb(s,m,l,f),bb(s)}function Op(s,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194048)!==0)){var m=l.lanes;m&=s.pendingLanes,f|=m,l.lanes=f,Nr(s,f)}}function jk(s,l){var f=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,f===m)){var b=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var R={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?b=w=R:w=w.next=R,f=f.next}while(f!==null);w===null?b=w=l:w=w.next=l}else b=w=l;f={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:w,shared:m.shared,callbacks:m.callbacks},s.updateQueue=f;return}s=f.lastBaseUpdate,s===null?f.firstBaseUpdate=l:s.next=l,f.lastBaseUpdate=l}var Fk=!1;function Dp(){if(Fk){var s=Kd;if(s!==null)throw s}}function Pp(s,l,f,m){Fk=!1;var b=s.updateQueue;Ol=!1;var w=b.firstBaseUpdate,R=b.lastBaseUpdate,H=b.shared.pending;if(H!==null){b.shared.pending=null;var X=H,le=X.next;X.next=null,R===null?w=le:R.next=le,R=X;var ge=s.alternate;ge!==null&&(ge=ge.updateQueue,H=ge.lastBaseUpdate,H!==R&&(H===null?ge.firstBaseUpdate=le:H.next=le,ge.lastBaseUpdate=X))}if(w!==null){var ve=b.baseState;R=0,ge=le=X=null,H=w;do{var de=H.lane&-536870913,pe=de!==H.lane;if(pe?($t&de)===de:(m&de)===de){de!==0&&de===Hd&&(Fk=!0),ge!==null&&(ge=ge.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var $e=s,nt=H;de=l;var yn=f;switch(nt.tag){case 1:if($e=nt.payload,typeof $e=="function"){ve=$e.call(yn,ve,de);break e}ve=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=nt.payload,de=typeof $e=="function"?$e.call(yn,ve,de):$e,de==null)break e;ve=p({},ve,de);break e;case 2:Ol=!0}}de=H.callback,de!==null&&(s.flags|=64,pe&&(s.flags|=8192),pe=b.callbacks,pe===null?b.callbacks=[de]:pe.push(de))}else pe={lane:de,tag:H.tag,payload:H.payload,callback:H.callback,next:null},ge===null?(le=ge=pe,X=ve):ge=ge.next=pe,R|=de;if(H=H.next,H===null){if(H=b.shared.pending,H===null)break;pe=H,H=pe.next,pe.next=null,b.lastBaseUpdate=pe,b.shared.pending=null}}while(!0);ge===null&&(X=ve),b.baseState=X,b.firstBaseUpdate=le,b.lastBaseUpdate=ge,w===null&&(b.shared.lanes=0),Fl|=R,s.lanes=R,s.memoizedState=ve}}function yP(s,l){if(typeof s!="function")throw Error(r(191,s));s.call(l)}function bP(s,l){var f=s.callbacks;if(f!==null)for(s.callbacks=null,s=0;s<f.length;s++)yP(f[s],l)}var Yd=U(null),Ib=U(0);function vP(s,l){s=qa,z(Ib,s),z(Yd,l),qa=s|l.baseLanes}function zk(){z(Ib,qa),z(Yd,Yd.current)}function Bk(){qa=Ib.current,Q(Yd),Q(Ib)}var co=U(null),Bo=null;function Nl(s){var l=s.alternate;z(ur,ur.current&1),z(co,s),Bo===null&&(l===null||Yd.current!==null||l.memoizedState!==null)&&(Bo=s)}function Uk(s){z(ur,ur.current),z(co,s),Bo===null&&(Bo=s)}function SP(s){s.tag===22?(z(ur,ur.current),z(co,s),Bo===null&&(Bo=s)):Ll()}function Ll(){z(ur,ur.current),z(co,co.current)}function uo(s){Q(co),Bo===s&&(Bo=null),Q(ur)}var ur=U(0);function Mb(s){for(var l=s;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||G_(f)||Y_(f)))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 Na=0,St=null,mn=null,_r=null,Rb=!1,Qd=!1,su=!1,Ab=0,Np=0,Xd=null,bQ=0;function er(){throw Error(r(321))}function qk(s,l){if(l===null)return!1;for(var f=0;f<l.length&&f<s.length;f++)if(!ao(s[f],l[f]))return!1;return!0}function Vk(s,l,f,m,b,w){return Na=w,St=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,j.H=s===null||s.memoizedState===null?rN:o_,su=!1,w=f(m,b),su=!1,Qd&&(w=wP(l,f,m,b)),xP(s),w}function xP(s){j.H=jp;var l=mn!==null&&mn.next!==null;if(Na=0,_r=mn=St=null,Rb=!1,Np=0,Xd=null,l)throw Error(r(300));s===null||Er||(s=s.dependencies,s!==null&&xb(s)&&(Er=!0))}function wP(s,l,f,m){St=s;var b=0;do{if(Qd&&(Xd=null),Np=0,Qd=!1,25<=b)throw Error(r(301));if(b+=1,_r=mn=null,s.updateQueue!=null){var w=s.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}j.H=iN,w=l(f,m)}while(Qd);return w}function vQ(){var s=j.H,l=s.useState()[0];return l=typeof l.then=="function"?Lp(l):l,s=s.useState()[0],(mn!==null?mn.memoizedState:null)!==s&&(St.flags|=1024),l}function Hk(){var s=Ab!==0;return Ab=0,s}function Kk(s,l,f){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~f}function Wk(s){if(Rb){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Rb=!1}Na=0,_r=mn=St=null,Qd=!1,Np=Ab=0,Xd=null}function Mi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _r===null?St.memoizedState=_r=s:_r=_r.next=s,_r}function dr(){if(mn===null){var s=St.alternate;s=s!==null?s.memoizedState:null}else s=mn.next;var l=_r===null?St.memoizedState:_r.next;if(l!==null)_r=l,mn=s;else{if(s===null)throw St.alternate===null?Error(r(467)):Error(r(310));mn=s,s={memoizedState:mn.memoizedState,baseState:mn.baseState,baseQueue:mn.baseQueue,queue:mn.queue,next:null},_r===null?St.memoizedState=_r=s:_r=_r.next=s}return _r}function Ob(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lp(s){var l=Np;return Np+=1,Xd===null&&(Xd=[]),s=fP(Xd,s,l),l=St,(_r===null?l.memoizedState:_r.next)===null&&(l=l.alternate,j.H=l===null||l.memoizedState===null?rN:o_),s}function Db(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Lp(s);if(s.$$typeof===E)return ni(s)}throw Error(r(438,String(s)))}function Gk(s){var l=null,f=St.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var m=St.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(b){return b.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),f===null&&(f=Ob(),St.updateQueue=f),f.memoCache=l,f=l.data[l.index],f===void 0)for(f=l.data[l.index]=Array(s),m=0;m<s;m++)f[m]=I;return l.index++,f}function La(s,l){return typeof l=="function"?l(s):l}function Pb(s){var l=dr();return Yk(l,mn,s)}function Yk(s,l,f){var m=s.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=f;var b=s.baseQueue,w=m.pending;if(w!==null){if(b!==null){var R=b.next;b.next=w.next,w.next=R}l.baseQueue=b=w,m.pending=null}if(w=s.baseState,b===null)s.memoizedState=w;else{l=b.next;var H=R=null,X=null,le=l,ge=!1;do{var ve=le.lane&-536870913;if(ve!==le.lane?($t&ve)===ve:(Na&ve)===ve){var de=le.revertLane;if(de===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),ve===Hd&&(ge=!0);else if((Na&de)===de){le=le.next,de===Hd&&(ge=!0);continue}else ve={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},X===null?(H=X=ve,R=w):X=X.next=ve,St.lanes|=de,Fl|=de;ve=le.action,su&&f(w,ve),w=le.hasEagerState?le.eagerState:f(w,ve)}else de={lane:ve,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},X===null?(H=X=de,R=w):X=X.next=de,St.lanes|=ve,Fl|=ve;le=le.next}while(le!==null&&le!==l);if(X===null?R=w:X.next=H,!ao(w,s.memoizedState)&&(Er=!0,ge&&(f=Kd,f!==null)))throw f;s.memoizedState=w,s.baseState=R,s.baseQueue=X,m.lastRenderedState=w}return b===null&&(m.lanes=0),[s.memoizedState,m.dispatch]}function Qk(s){var l=dr(),f=l.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=s;var m=f.dispatch,b=f.pending,w=l.memoizedState;if(b!==null){f.pending=null;var R=b=b.next;do w=s(w,R.action),R=R.next;while(R!==b);ao(w,l.memoizedState)||(Er=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),f.lastRenderedState=w}return[w,m]}function kP(s,l,f){var m=St,b=dr(),w=Vt;if(w){if(f===void 0)throw Error(r(407));f=f()}else f=l();var R=!ao((mn||b).memoizedState,f);if(R&&(b.memoizedState=f,Er=!0),b=b.queue,Zk(TP.bind(null,m,b,s),[s]),b.getSnapshot!==l||R||_r!==null&&_r.memoizedState.tag&1){if(m.flags|=2048,Jd(9,{destroy:void 0},EP.bind(null,m,b,f,l),null),kn===null)throw Error(r(349));w||(Na&127)!==0||_P(m,l,f)}return f}function _P(s,l,f){s.flags|=16384,s={getSnapshot:l,value:f},l=St.updateQueue,l===null?(l=Ob(),St.updateQueue=l,l.stores=[s]):(f=l.stores,f===null?l.stores=[s]:f.push(s))}function EP(s,l,f,m){l.value=f,l.getSnapshot=m,CP(l)&&IP(s)}function TP(s,l,f){return f(function(){CP(l)&&IP(s)})}function CP(s){var l=s.getSnapshot;s=s.value;try{var f=l();return!ao(s,f)}catch{return!0}}function IP(s){var l=Xc(s,2);l!==null&&Qi(l,s,2)}function Xk(s){var l=Mi();if(typeof s=="function"){var f=s;if(s=f(),su){Le(!0);try{f()}finally{Le(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:s},l}function MP(s,l,f,m){return s.baseState=f,Yk(s,mn,typeof m=="function"?m:La)}function SQ(s,l,f,m,b){if($b(s))throw Error(r(485));if(s=l.action,s!==null){var w={payload:b,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){w.listeners.push(R)}};j.T!==null?f(!0):w.isTransition=!1,m(w),f=l.pending,f===null?(w.next=l.pending=w,RP(l,w)):(w.next=f.next,l.pending=f.next=w)}}function RP(s,l){var f=l.action,m=l.payload,b=s.state;if(l.isTransition){var w=j.T,R={};j.T=R;try{var H=f(b,m),X=j.S;X!==null&&X(R,H),AP(s,l,H)}catch(le){Jk(s,l,le)}finally{w!==null&&R.types!==null&&(w.types=R.types),j.T=w}}else try{w=f(b,m),AP(s,l,w)}catch(le){Jk(s,l,le)}}function AP(s,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(m){OP(s,l,m)},function(m){return Jk(s,l,m)}):OP(s,l,f)}function OP(s,l,f){l.status="fulfilled",l.value=f,DP(l),s.state=f,l=s.pending,l!==null&&(f=l.next,f===l?s.pending=null:(f=f.next,l.next=f,RP(s,f)))}function Jk(s,l,f){var m=s.pending;if(s.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=f,DP(l),l=l.next;while(l!==m)}s.action=null}function DP(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function PP(s,l){return l}function NP(s,l){if(Vt){var f=kn.formState;if(f!==null){e:{var m=St;if(Vt){if(Ln){t:{for(var b=Ln,w=zo;b.nodeType!==8;){if(!w){b=null;break t}if(b=Uo(b.nextSibling),b===null){b=null;break t}}w=b.data,b=w==="F!"||w==="F"?b:null}if(b){Ln=Uo(b.nextSibling),m=b.data==="F!";break e}}Rl(m)}m=!1}m&&(l=f[0])}}return f=Mi(),f.memoizedState=f.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:PP,lastRenderedState:l},f.queue=m,f=eN.bind(null,St,m),m.dispatch=f,m=Xk(!1),w=i_.bind(null,St,!1,m.queue),m=Mi(),b={state:l,dispatch:null,action:s,pending:null},m.queue=b,f=SQ.bind(null,St,b,w,f),b.dispatch=f,m.memoizedState=s,[l,f,!1]}function LP(s){var l=dr();return $P(l,mn,s)}function $P(s,l,f){if(l=Yk(s,l,PP)[0],s=Pb(La)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=Lp(l)}catch(R){throw R===Wd?_b:R}else m=l;l=dr();var b=l.queue,w=b.dispatch;return f!==l.memoizedState&&(St.flags|=2048,Jd(9,{destroy:void 0},xQ.bind(null,b,f),null)),[m,w,s]}function xQ(s,l){s.action=l}function jP(s){var l=dr(),f=mn;if(f!==null)return $P(l,f,s);dr(),l=l.memoizedState,f=dr();var m=f.queue.dispatch;return f.memoizedState=s,[l,m,!1]}function Jd(s,l,f,m){return s={tag:s,create:f,deps:m,inst:l,next:null},l=St.updateQueue,l===null&&(l=Ob(),St.updateQueue=l),f=l.lastEffect,f===null?l.lastEffect=s.next=s:(m=f.next,f.next=s,s.next=m,l.lastEffect=s),s}function FP(){return dr().memoizedState}function Nb(s,l,f,m){var b=Mi();St.flags|=s,b.memoizedState=Jd(1|l,{destroy:void 0},f,m===void 0?null:m)}function Lb(s,l,f,m){var b=dr();m=m===void 0?null:m;var w=b.memoizedState.inst;mn!==null&&m!==null&&qk(m,mn.memoizedState.deps)?b.memoizedState=Jd(l,w,f,m):(St.flags|=s,b.memoizedState=Jd(1|l,w,f,m))}function zP(s,l){Nb(8390656,8,s,l)}function Zk(s,l){Lb(2048,8,s,l)}function wQ(s){St.flags|=4;var l=St.updateQueue;if(l===null)l=Ob(),St.updateQueue=l,l.events=[s];else{var f=l.events;f===null?l.events=[s]:f.push(s)}}function BP(s){var l=dr().memoizedState;return wQ({ref:l,nextImpl:s}),function(){if((Zt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function UP(s,l){return Lb(4,2,s,l)}function qP(s,l){return Lb(4,4,s,l)}function VP(s,l){if(typeof l=="function"){s=s();var f=l(s);return function(){typeof f=="function"?f():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function HP(s,l,f){f=f!=null?f.concat([s]):null,Lb(4,4,VP.bind(null,l,s),f)}function e_(){}function KP(s,l){var f=dr();l=l===void 0?null:l;var m=f.memoizedState;return l!==null&&qk(l,m[1])?m[0]:(f.memoizedState=[s,l],s)}function WP(s,l){var f=dr();l=l===void 0?null:l;var m=f.memoizedState;if(l!==null&&qk(l,m[1]))return m[0];if(m=s(),su){Le(!0);try{s()}finally{Le(!1)}}return f.memoizedState=[m,l],m}function t_(s,l,f){return f===void 0||(Na&1073741824)!==0&&($t&261930)===0?s.memoizedState=l:(s.memoizedState=f,s=GN(),St.lanes|=s,Fl|=s,f)}function GP(s,l,f,m){return ao(f,l)?f:Yd.current!==null?(s=t_(s,f,m),ao(s,l)||(Er=!0),s):(Na&42)===0||(Na&1073741824)!==0&&($t&261930)===0?(Er=!0,s.memoizedState=f):(s=GN(),St.lanes|=s,Fl|=s,l)}function YP(s,l,f,m,b){var w=K.p;K.p=w!==0&&8>w?w:8;var R=j.T,H={};j.T=H,i_(s,!1,l,f);try{var X=b(),le=j.S;if(le!==null&&le(H,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var ge=yQ(X,m);$p(s,l,ge,po(s))}else $p(s,l,m,po(s))}catch(ve){$p(s,l,{then:function(){},status:"rejected",reason:ve},po())}finally{K.p=w,R!==null&&H.types!==null&&(R.types=H.types),j.T=R}}function kQ(){}function n_(s,l,f,m){if(s.tag!==5)throw Error(r(476));var b=QP(s).queue;YP(s,b,l,G,f===null?kQ:function(){return XP(s),f(m)})}function QP(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:G},next:null};var f={};return l.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:f},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function XP(s){var l=QP(s);l.next===null&&(l=s.alternate.memoizedState),$p(s,l.next.queue,{},po())}function r_(){return ni(em)}function JP(){return dr().memoizedState}function ZP(){return dr().memoizedState}function _Q(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var f=po();s=Dl(f);var m=Pl(l,s,f);m!==null&&(Qi(m,l,f),Op(m,l,f)),l={cache:Ok()},s.payload=l;return}l=l.return}}function EQ(s,l,f){var m=po();f={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},$b(s)?tN(l,f):(f=xk(s,l,f,m),f!==null&&(Qi(f,s,m),nN(f,l,m)))}function eN(s,l,f){var m=po();$p(s,l,f,m)}function $p(s,l,f,m){var b={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if($b(s))tN(l,b);else{var w=s.alternate;if(s.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var R=l.lastRenderedState,H=w(R,f);if(b.hasEagerState=!0,b.eagerState=H,ao(H,R))return yb(s,l,b,0),kn===null&&gb(),!1}catch{}finally{}if(f=xk(s,l,b,m),f!==null)return Qi(f,s,m),nN(f,l,m),!0}return!1}function i_(s,l,f,m){if(m={lane:2,revertLane:L_(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},$b(s)){if(l)throw Error(r(479))}else l=xk(s,f,m,2),l!==null&&Qi(l,s,2)}function $b(s){var l=s.alternate;return s===St||l!==null&&l===St}function tN(s,l){Qd=Rb=!0;var f=s.pending;f===null?l.next=l:(l.next=f.next,f.next=l),s.pending=l}function nN(s,l,f){if((f&4194048)!==0){var m=l.lanes;m&=s.pendingLanes,f|=m,l.lanes=f,Nr(s,f)}}var jp={readContext:ni,use:Db,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};jp.useEffectEvent=er;var rN={readContext:ni,use:Db,useCallback:function(s,l){return Mi().memoizedState=[s,l===void 0?null:l],s},useContext:ni,useEffect:zP,useImperativeHandle:function(s,l,f){f=f!=null?f.concat([s]):null,Nb(4194308,4,VP.bind(null,l,s),f)},useLayoutEffect:function(s,l){return Nb(4194308,4,s,l)},useInsertionEffect:function(s,l){Nb(4,2,s,l)},useMemo:function(s,l){var f=Mi();l=l===void 0?null:l;var m=s();if(su){Le(!0);try{s()}finally{Le(!1)}}return f.memoizedState=[m,l],m},useReducer:function(s,l,f){var m=Mi();if(f!==void 0){var b=f(l);if(su){Le(!0);try{f(l)}finally{Le(!1)}}}else b=l;return m.memoizedState=m.baseState=b,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:b},m.queue=s,s=s.dispatch=EQ.bind(null,St,s),[m.memoizedState,s]},useRef:function(s){var l=Mi();return s={current:s},l.memoizedState=s},useState:function(s){s=Xk(s);var l=s.queue,f=eN.bind(null,St,l);return l.dispatch=f,[s.memoizedState,f]},useDebugValue:e_,useDeferredValue:function(s,l){var f=Mi();return t_(f,s,l)},useTransition:function(){var s=Xk(!1);return s=YP.bind(null,St,s.queue,!0,!1),Mi().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,f){var m=St,b=Mi();if(Vt){if(f===void 0)throw Error(r(407));f=f()}else{if(f=l(),kn===null)throw Error(r(349));($t&127)!==0||_P(m,l,f)}b.memoizedState=f;var w={value:f,getSnapshot:l};return b.queue=w,zP(TP.bind(null,m,w,s),[s]),m.flags|=2048,Jd(9,{destroy:void 0},EP.bind(null,m,w,f,l),null),f},useId:function(){var s=Mi(),l=kn.identifierPrefix;if(Vt){var f=Hs,m=Vs;f=(m&~(1<<32-tt(m)-1)).toString(32)+f,l="_"+l+"R_"+f,f=Ab++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=bQ++,l="_"+l+"r_"+f.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:r_,useFormState:NP,useActionState:NP,useOptimistic:function(s){var l=Mi();l.memoizedState=l.baseState=s;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=i_.bind(null,St,!0,f),f.dispatch=l,[s,l]},useMemoCache:Gk,useCacheRefresh:function(){return Mi().memoizedState=_Q.bind(null,St)},useEffectEvent:function(s){var l=Mi(),f={impl:s};return l.memoizedState=f,function(){if((Zt&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},o_={readContext:ni,use:Db,useCallback:KP,useContext:ni,useEffect:Zk,useImperativeHandle:HP,useInsertionEffect:UP,useLayoutEffect:qP,useMemo:WP,useReducer:Pb,useRef:FP,useState:function(){return Pb(La)},useDebugValue:e_,useDeferredValue:function(s,l){var f=dr();return GP(f,mn.memoizedState,s,l)},useTransition:function(){var s=Pb(La)[0],l=dr().memoizedState;return[typeof s=="boolean"?s:Lp(s),l]},useSyncExternalStore:kP,useId:JP,useHostTransitionStatus:r_,useFormState:LP,useActionState:LP,useOptimistic:function(s,l){var f=dr();return MP(f,mn,s,l)},useMemoCache:Gk,useCacheRefresh:ZP};o_.useEffectEvent=BP;var iN={readContext:ni,use:Db,useCallback:KP,useContext:ni,useEffect:Zk,useImperativeHandle:HP,useInsertionEffect:UP,useLayoutEffect:qP,useMemo:WP,useReducer:Qk,useRef:FP,useState:function(){return Qk(La)},useDebugValue:e_,useDeferredValue:function(s,l){var f=dr();return mn===null?t_(f,s,l):GP(f,mn.memoizedState,s,l)},useTransition:function(){var s=Qk(La)[0],l=dr().memoizedState;return[typeof s=="boolean"?s:Lp(s),l]},useSyncExternalStore:kP,useId:JP,useHostTransitionStatus:r_,useFormState:jP,useActionState:jP,useOptimistic:function(s,l){var f=dr();return mn!==null?MP(f,mn,s,l):(f.baseState=s,[s,f.queue.dispatch])},useMemoCache:Gk,useCacheRefresh:ZP};iN.useEffectEvent=BP;function s_(s,l,f,m){l=s.memoizedState,f=f(m,l),f=f==null?l:p({},l,f),s.memoizedState=f,s.lanes===0&&(s.updateQueue.baseState=f)}var a_={enqueueSetState:function(s,l,f){s=s._reactInternals;var m=po(),b=Dl(m);b.payload=l,f!=null&&(b.callback=f),l=Pl(s,b,m),l!==null&&(Qi(l,s,m),Op(l,s,m))},enqueueReplaceState:function(s,l,f){s=s._reactInternals;var m=po(),b=Dl(m);b.tag=1,b.payload=l,f!=null&&(b.callback=f),l=Pl(s,b,m),l!==null&&(Qi(l,s,m),Op(l,s,m))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var f=po(),m=Dl(f);m.tag=2,l!=null&&(m.callback=l),l=Pl(s,m,f),l!==null&&(Qi(l,s,f),Op(l,s,f))}};function oN(s,l,f,m,b,w,R){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,w,R):l.prototype&&l.prototype.isPureReactComponent?!_p(f,m)||!_p(b,w):!0}function sN(s,l,f,m){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,m),l.state!==s&&a_.enqueueReplaceState(l,l.state,null)}function au(s,l){var f=l;if("ref"in l){f={};for(var m in l)m!=="ref"&&(f[m]=l[m])}if(s=s.defaultProps){f===l&&(f=p({},f));for(var b in s)f[b]===void 0&&(f[b]=s[b])}return f}function aN(s){mb(s)}function lN(s){console.error(s)}function cN(s){mb(s)}function jb(s,l){try{var f=s.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function uN(s,l,f){try{var m=s.onCaughtError;m(f.value,{componentStack:f.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function l_(s,l,f){return f=Dl(f),f.tag=3,f.payload={element:null},f.callback=function(){jb(s,l)},f}function dN(s){return s=Dl(s),s.tag=3,s}function fN(s,l,f,m){var b=f.type.getDerivedStateFromError;if(typeof b=="function"){var w=m.value;s.payload=function(){return b(w)},s.callback=function(){uN(l,f,m)}}var R=f.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(s.callback=function(){uN(l,f,m),typeof b!="function"&&(zl===null?zl=new Set([this]):zl.add(this));var H=m.stack;this.componentDidCatch(m.value,{componentStack:H!==null?H:""})})}function TQ(s,l,f,m,b){if(f.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=f.alternate,l!==null&&Vd(l,f,b,!0),f=co.current,f!==null){switch(f.tag){case 31:case 13:return Bo===null?Qb():f.alternate===null&&tr===0&&(tr=3),f.flags&=-257,f.flags|=65536,f.lanes=b,m===Eb?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([m]):l.add(m),D_(s,m,b)),!1;case 22:return f.flags|=65536,m===Eb?f.flags|=16384:(l=f.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},f.updateQueue=l):(f=l.retryQueue,f===null?l.retryQueue=new Set([m]):f.add(m)),D_(s,m,b)),!1}throw Error(r(435,f.tag))}return D_(s,m,b),Qb(),!1}if(Vt)return l=co.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,m!==Ck&&(s=Error(r(422),{cause:m}),Cp($o(s,f)))):(m!==Ck&&(l=Error(r(423),{cause:m}),Cp($o(l,f))),s=s.current.alternate,s.flags|=65536,b&=-b,s.lanes|=b,m=$o(m,f),b=l_(s.stateNode,m,b),jk(s,b),tr!==4&&(tr=2)),!1;var w=Error(r(520),{cause:m});if(w=$o(w,f),Kp===null?Kp=[w]:Kp.push(w),tr!==4&&(tr=2),l===null)return!0;m=$o(m,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,s=b&-b,f.lanes|=s,s=l_(f.stateNode,m,s),jk(f,s),!1;case 1:if(l=f.type,w=f.stateNode,(f.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(zl===null||!zl.has(w))))return f.flags|=65536,b&=-b,f.lanes|=b,b=dN(b),fN(b,s,f,m),jk(f,b),!1}f=f.return}while(f!==null);return!1}var c_=Error(r(461)),Er=!1;function ri(s,l,f,m){l.child=s===null?gP(l,null,f,m):ou(l,s.child,f,m)}function hN(s,l,f,m,b){f=f.render;var w=l.ref;if("ref"in m){var R={};for(var H in m)H!=="ref"&&(R[H]=m[H])}else R=m;return tu(l),m=Vk(s,l,f,R,w,b),H=Hk(),s!==null&&!Er?(Kk(s,l,b),$a(s,l,b)):(Vt&&H&&Ek(l),l.flags|=1,ri(s,l,m,b),l.child)}function pN(s,l,f,m,b){if(s===null){var w=f.type;return typeof w=="function"&&!wk(w)&&w.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=w,mN(s,l,w,m,b)):(s=vb(f.type,null,m,l,l.mode,b),s.ref=l.ref,s.return=l,l.child=s)}if(w=s.child,!y_(s,b)){var R=w.memoizedProps;if(f=f.compare,f=f!==null?f:_p,f(R,m)&&s.ref===l.ref)return $a(s,l,b)}return l.flags|=1,s=Aa(w,m),s.ref=l.ref,s.return=l,l.child=s}function mN(s,l,f,m,b){if(s!==null){var w=s.memoizedProps;if(_p(w,m)&&s.ref===l.ref)if(Er=!1,l.pendingProps=m=w,y_(s,b))(s.flags&131072)!==0&&(Er=!0);else return l.lanes=s.lanes,$a(s,l,b)}return u_(s,l,f,m,b)}function gN(s,l,f,m){var b=m.children,w=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(w=w!==null?w.baseLanes|f:f,s!==null){for(m=l.child=s.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~w}else m=0,l.child=null;return yN(s,l,w,f,m)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&kb(l,w!==null?w.cachePool:null),w!==null?vP(l,w):zk(),SP(l);else return m=l.lanes=536870912,yN(s,l,w!==null?w.baseLanes|f:f,f,m)}else w!==null?(kb(l,w.cachePool),vP(l,w),Ll(),l.memoizedState=null):(s!==null&&kb(l,null),zk(),Ll());return ri(s,l,b,f),l.child}function Fp(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function yN(s,l,f,m,b){var w=Pk();return w=w===null?null:{parent:kr._currentValue,pool:w},l.memoizedState={baseLanes:f,cachePool:w},s!==null&&kb(l,null),zk(),SP(l),s!==null&&Vd(s,l,m,!0),l.childLanes=b,null}function Fb(s,l){return l=Bb({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function bN(s,l,f){return ou(l,s.child,null,f),s=Fb(l,l.pendingProps),s.flags|=2,uo(l),l.memoizedState=null,s}function CQ(s,l,f){var m=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(Vt){if(m.mode==="hidden")return s=Fb(l,m),l.lanes=536870912,Fp(null,s);if(Uk(l),(s=Ln)?(s=R2(s,zo),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:Il!==null?{id:Vs,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},f=tP(s),f.return=l,l.child=f,ti=l,Ln=null)):s=null,s===null)throw Rl(l);return l.lanes=536870912,null}return Fb(l,m)}var w=s.memoizedState;if(w!==null){var R=w.dehydrated;if(Uk(l),b)if(l.flags&256)l.flags&=-257,l=bN(s,l,f);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(r(558));else if(Er||Vd(s,l,f,!1),b=(f&s.childLanes)!==0,Er||b){if(m=kn,m!==null&&(R=Nn(m,f),R!==0&&R!==w.retryLane))throw w.retryLane=R,Xc(s,R),Qi(m,s,R),c_;Qb(),l=bN(s,l,f)}else s=w.treeContext,Ln=Uo(R.nextSibling),ti=l,Vt=!0,Ml=null,zo=!1,s!==null&&iP(l,s),l=Fb(l,m),l.flags|=4096;return l}return s=Aa(s.child,{mode:m.mode,children:m.children}),s.ref=l.ref,l.child=s,s.return=l,s}function zb(s,l){var f=l.ref;if(f===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(r(284));(s===null||s.ref!==f)&&(l.flags|=4194816)}}function u_(s,l,f,m,b){return tu(l),f=Vk(s,l,f,m,void 0,b),m=Hk(),s!==null&&!Er?(Kk(s,l,b),$a(s,l,b)):(Vt&&m&&Ek(l),l.flags|=1,ri(s,l,f,b),l.child)}function vN(s,l,f,m,b,w){return tu(l),l.updateQueue=null,f=wP(l,m,f,b),xP(s),m=Hk(),s!==null&&!Er?(Kk(s,l,w),$a(s,l,w)):(Vt&&m&&Ek(l),l.flags|=1,ri(s,l,f,w),l.child)}function SN(s,l,f,m,b){if(tu(l),l.stateNode===null){var w=zd,R=f.contextType;typeof R=="object"&&R!==null&&(w=ni(R)),w=new f(m,w),l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=a_,l.stateNode=w,w._reactInternals=l,w=l.stateNode,w.props=m,w.state=l.memoizedState,w.refs={},Lk(l),R=f.contextType,w.context=typeof R=="object"&&R!==null?ni(R):zd,w.state=l.memoizedState,R=f.getDerivedStateFromProps,typeof R=="function"&&(s_(l,f,R,m),w.state=l.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(R=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),R!==w.state&&a_.enqueueReplaceState(w,w.state,null),Pp(l,m,w,b),Dp(),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(s===null){w=l.stateNode;var H=l.memoizedProps,X=au(f,H);w.props=X;var le=w.context,ge=f.contextType;R=zd,typeof ge=="object"&&ge!==null&&(R=ni(ge));var ve=f.getDerivedStateFromProps;ge=typeof ve=="function"||typeof w.getSnapshotBeforeUpdate=="function",H=l.pendingProps!==H,ge||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(H||le!==R)&&sN(l,w,m,R),Ol=!1;var de=l.memoizedState;w.state=de,Pp(l,m,w,b),Dp(),le=l.memoizedState,H||de!==le||Ol?(typeof ve=="function"&&(s_(l,f,ve,m),le=l.memoizedState),(X=Ol||oN(l,f,X,m,de,le,R))?(ge||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(l.flags|=4194308)):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=le),w.props=m,w.state=le,w.context=R,m=X):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{w=l.stateNode,$k(s,l),R=l.memoizedProps,ge=au(f,R),w.props=ge,ve=l.pendingProps,de=w.context,le=f.contextType,X=zd,typeof le=="object"&&le!==null&&(X=ni(le)),H=f.getDerivedStateFromProps,(le=typeof H=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(R!==ve||de!==X)&&sN(l,w,m,X),Ol=!1,de=l.memoizedState,w.state=de,Pp(l,m,w,b),Dp();var pe=l.memoizedState;R!==ve||de!==pe||Ol||s!==null&&s.dependencies!==null&&xb(s.dependencies)?(typeof H=="function"&&(s_(l,f,H,m),pe=l.memoizedState),(ge=Ol||oN(l,f,ge,m,de,pe,X)||s!==null&&s.dependencies!==null&&xb(s.dependencies))?(le||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(m,pe,X),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(m,pe,X)),typeof w.componentDidUpdate=="function"&&(l.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof w.componentDidUpdate!="function"||R===s.memoizedProps&&de===s.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||R===s.memoizedProps&&de===s.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=pe),w.props=m,w.state=pe,w.context=X,m=ge):(typeof w.componentDidUpdate!="function"||R===s.memoizedProps&&de===s.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||R===s.memoizedProps&&de===s.memoizedState||(l.flags|=1024),m=!1)}return w=m,zb(s,l),m=(l.flags&128)!==0,w||m?(w=l.stateNode,f=m&&typeof f.getDerivedStateFromError!="function"?null:w.render(),l.flags|=1,s!==null&&m?(l.child=ou(l,s.child,null,b),l.child=ou(l,null,f,b)):ri(s,l,f,b),l.memoizedState=w.state,s=l.child):s=$a(s,l,b),s}function xN(s,l,f,m){return Zc(),l.flags|=256,ri(s,l,f,m),l.child}var d_={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function f_(s){return{baseLanes:s,cachePool:uP()}}function h_(s,l,f){return s=s!==null?s.childLanes&~f:0,l&&(s|=ho),s}function wN(s,l,f){var m=l.pendingProps,b=!1,w=(l.flags&128)!==0,R;if((R=w)||(R=s!==null&&s.memoizedState===null?!1:(ur.current&2)!==0),R&&(b=!0,l.flags&=-129),R=(l.flags&32)!==0,l.flags&=-33,s===null){if(Vt){if(b?Nl(l):Ll(),(s=Ln)?(s=R2(s,zo),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:Il!==null?{id:Vs,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},f=tP(s),f.return=l,l.child=f,ti=l,Ln=null)):s=null,s===null)throw Rl(l);return Y_(s)?l.lanes=32:l.lanes=536870912,null}var H=m.children;return m=m.fallback,b?(Ll(),b=l.mode,H=Bb({mode:"hidden",children:H},b),m=Jc(m,b,f,null),H.return=l,m.return=l,H.sibling=m,l.child=H,m=l.child,m.memoizedState=f_(f),m.childLanes=h_(s,R,f),l.memoizedState=d_,Fp(null,m)):(Nl(l),p_(l,H))}var X=s.memoizedState;if(X!==null&&(H=X.dehydrated,H!==null)){if(w)l.flags&256?(Nl(l),l.flags&=-257,l=m_(s,l,f)):l.memoizedState!==null?(Ll(),l.child=s.child,l.flags|=128,l=null):(Ll(),H=m.fallback,b=l.mode,m=Bb({mode:"visible",children:m.children},b),H=Jc(H,b,f,null),H.flags|=2,m.return=l,H.return=l,m.sibling=H,l.child=m,ou(l,s.child,null,f),m=l.child,m.memoizedState=f_(f),m.childLanes=h_(s,R,f),l.memoizedState=d_,l=Fp(null,m));else if(Nl(l),Y_(H)){if(R=H.nextSibling&&H.nextSibling.dataset,R)var le=R.dgst;R=le,m=Error(r(419)),m.stack="",m.digest=R,Cp({value:m,source:null,stack:null}),l=m_(s,l,f)}else if(Er||Vd(s,l,f,!1),R=(f&s.childLanes)!==0,Er||R){if(R=kn,R!==null&&(m=Nn(R,f),m!==0&&m!==X.retryLane))throw X.retryLane=m,Xc(s,m),Qi(R,s,m),c_;G_(H)||Qb(),l=m_(s,l,f)}else G_(H)?(l.flags|=192,l.child=s.child,l=null):(s=X.treeContext,Ln=Uo(H.nextSibling),ti=l,Vt=!0,Ml=null,zo=!1,s!==null&&iP(l,s),l=p_(l,m.children),l.flags|=4096);return l}return b?(Ll(),H=m.fallback,b=l.mode,X=s.child,le=X.sibling,m=Aa(X,{mode:"hidden",children:m.children}),m.subtreeFlags=X.subtreeFlags&65011712,le!==null?H=Aa(le,H):(H=Jc(H,b,f,null),H.flags|=2),H.return=l,m.return=l,m.sibling=H,l.child=m,Fp(null,m),m=l.child,H=s.child.memoizedState,H===null?H=f_(f):(b=H.cachePool,b!==null?(X=kr._currentValue,b=b.parent!==X?{parent:X,pool:X}:b):b=uP(),H={baseLanes:H.baseLanes|f,cachePool:b}),m.memoizedState=H,m.childLanes=h_(s,R,f),l.memoizedState=d_,Fp(s.child,m)):(Nl(l),f=s.child,s=f.sibling,f=Aa(f,{mode:"visible",children:m.children}),f.return=l,f.sibling=null,s!==null&&(R=l.deletions,R===null?(l.deletions=[s],l.flags|=16):R.push(s)),l.child=f,l.memoizedState=null,f)}function p_(s,l){return l=Bb({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Bb(s,l){return s=lo(22,s,null,l),s.lanes=0,s}function m_(s,l,f){return ou(l,s.child,null,f),s=p_(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function kN(s,l,f){s.lanes|=l;var m=s.alternate;m!==null&&(m.lanes|=l),Rk(s.return,l,f)}function g_(s,l,f,m,b,w){var R=s.memoizedState;R===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:b,treeForkCount:w}:(R.isBackwards=l,R.rendering=null,R.renderingStartTime=0,R.last=m,R.tail=f,R.tailMode=b,R.treeForkCount=w)}function _N(s,l,f){var m=l.pendingProps,b=m.revealOrder,w=m.tail;m=m.children;var R=ur.current,H=(R&2)!==0;if(H?(R=R&1|2,l.flags|=128):R&=1,z(ur,R),ri(s,l,m,f),m=Vt?Tp:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&kN(s,f,l);else if(s.tag===19)kN(s,f,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(b){case"forwards":for(f=l.child,b=null;f!==null;)s=f.alternate,s!==null&&Mb(s)===null&&(b=f),f=f.sibling;f=b,f===null?(b=l.child,l.child=null):(b=f.sibling,f.sibling=null),g_(l,!1,b,f,w,m);break;case"backwards":case"unstable_legacy-backwards":for(f=null,b=l.child,l.child=null;b!==null;){if(s=b.alternate,s!==null&&Mb(s)===null){l.child=b;break}s=b.sibling,b.sibling=f,f=b,b=s}g_(l,!0,f,null,w,m);break;case"together":g_(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function $a(s,l,f){if(s!==null&&(l.dependencies=s.dependencies),Fl|=l.lanes,(f&l.childLanes)===0)if(s!==null){if(Vd(s,l,f,!1),(f&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(r(153));if(l.child!==null){for(s=l.child,f=Aa(s,s.pendingProps),l.child=f,f.return=l;s.sibling!==null;)s=s.sibling,f=f.sibling=Aa(s,s.pendingProps),f.return=l;f.sibling=null}return l.child}function y_(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&xb(s)))}function IQ(s,l,f){switch(l.tag){case 3:me(l,l.stateNode.containerInfo),Al(l,kr,s.memoizedState.cache),Zc();break;case 27:case 5:ye(l);break;case 4:me(l,l.stateNode.containerInfo);break;case 10:Al(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Uk(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(Nl(l),l.flags|=128,null):(f&l.child.childLanes)!==0?wN(s,l,f):(Nl(l),s=$a(s,l,f),s!==null?s.sibling:null);Nl(l);break;case 19:var b=(s.flags&128)!==0;if(m=(f&l.childLanes)!==0,m||(Vd(s,l,f,!1),m=(f&l.childLanes)!==0),b){if(m)return _N(s,l,f);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),z(ur,ur.current),m)break;return null;case 22:return l.lanes=0,gN(s,l,f,l.pendingProps);case 24:Al(l,kr,s.memoizedState.cache)}return $a(s,l,f)}function EN(s,l,f){if(s!==null)if(s.memoizedProps!==l.pendingProps)Er=!0;else{if(!y_(s,f)&&(l.flags&128)===0)return Er=!1,IQ(s,l,f);Er=(s.flags&131072)!==0}else Er=!1,Vt&&(l.flags&1048576)!==0&&rP(l,Tp,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(s=ru(l.elementType),l.type=s,typeof s=="function")wk(s)?(m=au(s,m),l.tag=1,l=SN(null,l,s,m,f)):(l.tag=0,l=u_(null,l,s,m,f));else{if(s!=null){var b=s.$$typeof;if(b===M){l.tag=11,l=hN(null,l,s,m,f);break e}else if(b===C){l.tag=14,l=pN(null,l,s,m,f);break e}}throw l=$(s)||s,Error(r(306,l,""))}}return l;case 0:return u_(s,l,l.type,l.pendingProps,f);case 1:return m=l.type,b=au(m,l.pendingProps),SN(s,l,m,b,f);case 3:e:{if(me(l,l.stateNode.containerInfo),s===null)throw Error(r(387));m=l.pendingProps;var w=l.memoizedState;b=w.element,$k(s,l),Pp(l,m,null,f);var R=l.memoizedState;if(m=R.cache,Al(l,kr,m),m!==w.cache&&Ak(l,[kr],f,!0),Dp(),m=R.element,w.isDehydrated)if(w={element:m,isDehydrated:!1,cache:R.cache},l.updateQueue.baseState=w,l.memoizedState=w,l.flags&256){l=xN(s,l,m,f);break e}else if(m!==b){b=$o(Error(r(424)),l),Cp(b),l=xN(s,l,m,f);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(Ln=Uo(s.firstChild),ti=l,Vt=!0,Ml=null,zo=!0,f=gP(l,null,m,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling}else{if(Zc(),m===b){l=$a(s,l,f);break e}ri(s,l,m,f)}l=l.child}return l;case 26:return zb(s,l),s===null?(f=L2(l.type,null,l.pendingProps,null))?l.memoizedState=f:Vt||(f=l.type,s=l.pendingProps,m=rv(Z.current).createElement(f),m[cn]=l,m[wn]=s,ii(m,f,s),Kr(m),l.stateNode=m):l.memoizedState=L2(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return ye(l),s===null&&Vt&&(m=l.stateNode=D2(l.type,l.pendingProps,Z.current),ti=l,zo=!0,b=Ln,Vl(l.type)?(Q_=b,Ln=Uo(m.firstChild)):Ln=b),ri(s,l,l.pendingProps.children,f),zb(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Vt&&((b=m=Ln)&&(m=iX(m,l.type,l.pendingProps,zo),m!==null?(l.stateNode=m,ti=l,Ln=Uo(m.firstChild),zo=!1,b=!0):b=!1),b||Rl(l)),ye(l),b=l.type,w=l.pendingProps,R=s!==null?s.memoizedProps:null,m=w.children,H_(b,w)?m=null:R!==null&&H_(b,R)&&(l.flags|=32),l.memoizedState!==null&&(b=Vk(s,l,vQ,null,null,f),em._currentValue=b),zb(s,l),ri(s,l,m,f),l.child;case 6:return s===null&&Vt&&((s=f=Ln)&&(f=oX(f,l.pendingProps,zo),f!==null?(l.stateNode=f,ti=l,Ln=null,s=!0):s=!1),s||Rl(l)),null;case 13:return wN(s,l,f);case 4:return me(l,l.stateNode.containerInfo),m=l.pendingProps,s===null?l.child=ou(l,null,m,f):ri(s,l,m,f),l.child;case 11:return hN(s,l,l.type,l.pendingProps,f);case 7:return ri(s,l,l.pendingProps,f),l.child;case 8:return ri(s,l,l.pendingProps.children,f),l.child;case 12:return ri(s,l,l.pendingProps.children,f),l.child;case 10:return m=l.pendingProps,Al(l,l.type,m.value),ri(s,l,m.children,f),l.child;case 9:return b=l.type._context,m=l.pendingProps.children,tu(l),b=ni(b),m=m(b),l.flags|=1,ri(s,l,m,f),l.child;case 14:return pN(s,l,l.type,l.pendingProps,f);case 15:return mN(s,l,l.type,l.pendingProps,f);case 19:return _N(s,l,f);case 31:return CQ(s,l,f);case 22:return gN(s,l,f,l.pendingProps);case 24:return tu(l),m=ni(kr),s===null?(b=Pk(),b===null&&(b=kn,w=Ok(),b.pooledCache=w,w.refCount++,w!==null&&(b.pooledCacheLanes|=f),b=w),l.memoizedState={parent:m,cache:b},Lk(l),Al(l,kr,b)):((s.lanes&f)!==0&&($k(s,l),Pp(l,null,null,f),Dp()),b=s.memoizedState,w=l.memoizedState,b.parent!==m?(b={parent:m,cache:m},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),Al(l,kr,m)):(m=w.cache,Al(l,kr,m),m!==b.cache&&Ak(l,[kr],f,!0))),ri(s,l,l.pendingProps.children,f),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function ja(s){s.flags|=4}function b_(s,l,f,m,b){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(b&335544128)===b)if(s.stateNode.complete)s.flags|=8192;else if(JN())s.flags|=8192;else throw iu=Eb,Nk}else s.flags&=-16777217}function TN(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!B2(l))if(JN())s.flags|=8192;else throw iu=Eb,Nk}function Ub(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?ei():536870912,s.lanes|=l,nf|=l)}function zp(s,l){if(!Vt)switch(s.tailMode){case"hidden":l=s.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?s.tail=null:f.sibling=null;break;case"collapsed":f=s.tail;for(var m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function $n(s){var l=s.alternate!==null&&s.alternate.child===s.child,f=0,m=0;if(l)for(var b=s.child;b!==null;)f|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=s,b=b.sibling;else for(b=s.child;b!==null;)f|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=s,b=b.sibling;return s.subtreeFlags|=m,s.childLanes=f,l}function MQ(s,l,f){var m=l.pendingProps;switch(Tk(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $n(l),null;case 1:return $n(l),null;case 3:return f=l.stateNode,m=null,s!==null&&(m=s.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),Pa(kr),fe(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(s===null||s.child===null)&&(qd(l)?ja(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Ik())),$n(l),null;case 26:var b=l.type,w=l.memoizedState;return s===null?(ja(l),w!==null?($n(l),TN(l,w)):($n(l),b_(l,b,null,m,f))):w?w!==s.memoizedState?(ja(l),$n(l),TN(l,w)):($n(l),l.flags&=-16777217):(s=s.memoizedProps,s!==m&&ja(l),$n(l),b_(l,b,s,m,f)),null;case 27:if(ie(l),f=Z.current,b=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==m&&ja(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return $n(l),null}s=ne.current,qd(l)?oP(l):(s=D2(b,m,f),l.stateNode=s,ja(l))}return $n(l),null;case 5:if(ie(l),b=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==m&&ja(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return $n(l),null}if(w=ne.current,qd(l))oP(l);else{var R=rv(Z.current);switch(w){case 1:w=R.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:w=R.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":w=R.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":w=R.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":w=R.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof m.is=="string"?R.createElement("select",{is:m.is}):R.createElement("select"),m.multiple?w.multiple=!0:m.size&&(w.size=m.size);break;default:w=typeof m.is=="string"?R.createElement(b,{is:m.is}):R.createElement(b)}}w[cn]=l,w[wn]=m;e:for(R=l.child;R!==null;){if(R.tag===5||R.tag===6)w.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===l)break e;for(;R.sibling===null;){if(R.return===null||R.return===l)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}l.stateNode=w;e:switch(ii(w,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&ja(l)}}return $n(l),b_(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,f),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==m&&ja(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(r(166));if(s=Z.current,qd(l)){if(s=l.stateNode,f=l.memoizedProps,m=null,b=ti,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}s[cn]=l,s=!!(s.nodeValue===f||m!==null&&m.suppressHydrationWarning===!0||w2(s.nodeValue,f)),s||Rl(l,!0)}else s=rv(s).createTextNode(m),s[cn]=l,l.stateNode=s}return $n(l),null;case 31:if(f=l.memoizedState,s===null||s.memoizedState!==null){if(m=qd(l),f!==null){if(s===null){if(!m)throw Error(r(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[cn]=l}else Zc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;$n(l),s=!1}else f=Ik(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=f),s=!0;if(!s)return l.flags&256?(uo(l),l):(uo(l),null);if((l.flags&128)!==0)throw Error(r(558))}return $n(l),null;case 13:if(m=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(b=qd(l),m!==null&&m.dehydrated!==null){if(s===null){if(!b)throw Error(r(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[cn]=l}else Zc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;$n(l),b=!1}else b=Ik(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=b),b=!0;if(!b)return l.flags&256?(uo(l),l):(uo(l),null)}return uo(l),(l.flags&128)!==0?(l.lanes=f,l):(f=m!==null,s=s!==null&&s.memoizedState!==null,f&&(m=l.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),w=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(w=m.memoizedState.cachePool.pool),w!==b&&(m.flags|=2048)),f!==s&&f&&(l.child.flags|=8192),Ub(l,l.updateQueue),$n(l),null);case 4:return fe(),s===null&&z_(l.stateNode.containerInfo),$n(l),null;case 10:return Pa(l.type),$n(l),null;case 19:if(Q(ur),m=l.memoizedState,m===null)return $n(l),null;if(b=(l.flags&128)!==0,w=m.rendering,w===null)if(b)zp(m,!1);else{if(tr!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(w=Mb(s),w!==null){for(l.flags|=128,zp(m,!1),s=w.updateQueue,l.updateQueue=s,Ub(l,s),l.subtreeFlags=0,s=f,f=l.child;f!==null;)eP(f,s),f=f.sibling;return z(ur,ur.current&1|2),Vt&&Oa(l,m.treeForkCount),l.child}s=s.sibling}m.tail!==null&&pt()>Wb&&(l.flags|=128,b=!0,zp(m,!1),l.lanes=4194304)}else{if(!b)if(s=Mb(w),s!==null){if(l.flags|=128,b=!0,s=s.updateQueue,l.updateQueue=s,Ub(l,s),zp(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!Vt)return $n(l),null}else 2*pt()-m.renderingStartTime>Wb&&f!==536870912&&(l.flags|=128,b=!0,zp(m,!1),l.lanes=4194304);m.isBackwards?(w.sibling=l.child,l.child=w):(s=m.last,s!==null?s.sibling=w:l.child=w,m.last=w)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=pt(),s.sibling=null,f=ur.current,z(ur,b?f&1|2:f&1),Vt&&Oa(l,m.treeForkCount),s):($n(l),null);case 22:case 23:return uo(l),Bk(),m=l.memoizedState!==null,s!==null?s.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(f&536870912)!==0&&(l.flags&128)===0&&($n(l),l.subtreeFlags&6&&(l.flags|=8192)):$n(l),f=l.updateQueue,f!==null&&Ub(l,f.retryQueue),f=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048),s!==null&&Q(nu),null;case 24:return f=null,s!==null&&(f=s.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),Pa(kr),$n(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function RQ(s,l){switch(Tk(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Pa(kr),fe(),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(uo(l),l.alternate===null)throw Error(r(340));Zc()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(uo(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Zc()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return Q(ur),null;case 4:return fe(),null;case 10:return Pa(l.type),null;case 22:case 23:return uo(l),Bk(),s!==null&&Q(nu),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Pa(kr),null;case 25:return null;default:return null}}function CN(s,l){switch(Tk(l),l.tag){case 3:Pa(kr),fe();break;case 26:case 27:case 5:ie(l);break;case 4:fe();break;case 31:l.memoizedState!==null&&uo(l);break;case 13:uo(l);break;case 19:Q(ur);break;case 10:Pa(l.type);break;case 22:case 23:uo(l),Bk(),s!==null&&Q(nu);break;case 24:Pa(kr)}}function Bp(s,l){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var b=m.next;f=b;do{if((f.tag&s)===s){m=void 0;var w=f.create,R=f.inst;m=w(),R.destroy=m}f=f.next}while(f!==b)}}catch(H){dn(l,l.return,H)}}function $l(s,l,f){try{var m=l.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var w=b.next;m=w;do{if((m.tag&s)===s){var R=m.inst,H=R.destroy;if(H!==void 0){R.destroy=void 0,b=l;var X=f,le=H;try{le()}catch(ge){dn(b,X,ge)}}}m=m.next}while(m!==w)}}catch(ge){dn(l,l.return,ge)}}function IN(s){var l=s.updateQueue;if(l!==null){var f=s.stateNode;try{bP(l,f)}catch(m){dn(s,s.return,m)}}}function MN(s,l,f){f.props=au(s.type,s.memoizedProps),f.state=s.memoizedState;try{f.componentWillUnmount()}catch(m){dn(s,l,m)}}function Up(s,l){try{var f=s.ref;if(f!==null){switch(s.tag){case 26:case 27:case 5:var m=s.stateNode;break;case 30:m=s.stateNode;break;default:m=s.stateNode}typeof f=="function"?s.refCleanup=f(m):f.current=m}}catch(b){dn(s,l,b)}}function Ks(s,l){var f=s.ref,m=s.refCleanup;if(f!==null)if(typeof m=="function")try{m()}catch(b){dn(s,l,b)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(b){dn(s,l,b)}else f.current=null}function RN(s){var l=s.type,f=s.memoizedProps,m=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":f.autoFocus&&m.focus();break e;case"img":f.src?m.src=f.src:f.srcSet&&(m.srcset=f.srcSet)}}catch(b){dn(s,s.return,b)}}function v_(s,l,f){try{var m=s.stateNode;JQ(m,s.type,f,l),m[wn]=l}catch(b){dn(s,s.return,b)}}function AN(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Vl(s.type)||s.tag===4}function S_(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||AN(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&&Vl(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 x_(s,l,f){var m=s.tag;if(m===5||m===6)s=s.stateNode,l?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(s,l):(l=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,l.appendChild(s),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=Ma));else if(m!==4&&(m===27&&Vl(s.type)&&(f=s.stateNode,l=null),s=s.child,s!==null))for(x_(s,l,f),s=s.sibling;s!==null;)x_(s,l,f),s=s.sibling}function qb(s,l,f){var m=s.tag;if(m===5||m===6)s=s.stateNode,l?f.insertBefore(s,l):f.appendChild(s);else if(m!==4&&(m===27&&Vl(s.type)&&(f=s.stateNode),s=s.child,s!==null))for(qb(s,l,f),s=s.sibling;s!==null;)qb(s,l,f),s=s.sibling}function ON(s){var l=s.stateNode,f=s.memoizedProps;try{for(var m=s.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);ii(l,m,f),l[cn]=s,l[wn]=f}catch(w){dn(s,s.return,w)}}var Fa=!1,Tr=!1,w_=!1,DN=typeof WeakSet=="function"?WeakSet:Set,Wr=null;function AQ(s,l){if(s=s.containerInfo,q_=uv,s=HD(s),mk(s)){if("selectionStart"in s)var f={start:s.selectionStart,end:s.selectionEnd};else e:{f=(f=s.ownerDocument)&&f.defaultView||window;var m=f.getSelection&&f.getSelection();if(m&&m.rangeCount!==0){f=m.anchorNode;var b=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var R=0,H=-1,X=-1,le=0,ge=0,ve=s,de=null;t:for(;;){for(var pe;ve!==f||b!==0&&ve.nodeType!==3||(H=R+b),ve!==w||m!==0&&ve.nodeType!==3||(X=R+m),ve.nodeType===3&&(R+=ve.nodeValue.length),(pe=ve.firstChild)!==null;)de=ve,ve=pe;for(;;){if(ve===s)break t;if(de===f&&++le===b&&(H=R),de===w&&++ge===m&&(X=R),(pe=ve.nextSibling)!==null)break;ve=de,de=ve.parentNode}ve=pe}f=H===-1||X===-1?null:{start:H,end:X}}else f=null}f=f||{start:0,end:0}}else f=null;for(V_={focusedElem:s,selectionRange:f},uv=!1,Wr=l;Wr!==null;)if(l=Wr,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Wr=s;else for(;Wr!==null;){switch(l=Wr,w=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(f=0;f<s.length;f++)b=s[f],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&w!==null){s=void 0,f=l,b=w.memoizedProps,w=w.memoizedState,m=f.stateNode;try{var $e=au(f.type,b);s=m.getSnapshotBeforeUpdate($e,w),m.__reactInternalSnapshotBeforeUpdate=s}catch(nt){dn(f,f.return,nt)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,f=s.nodeType,f===9)W_(s);else if(f===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":W_(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(r(163))}if(s=l.sibling,s!==null){s.return=l.return,Wr=s;break}Wr=l.return}}function PN(s,l,f){var m=f.flags;switch(f.tag){case 0:case 11:case 15:Ba(s,f),m&4&&Bp(5,f);break;case 1:if(Ba(s,f),m&4)if(s=f.stateNode,l===null)try{s.componentDidMount()}catch(R){dn(f,f.return,R)}else{var b=au(f.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(b,l,s.__reactInternalSnapshotBeforeUpdate)}catch(R){dn(f,f.return,R)}}m&64&&IN(f),m&512&&Up(f,f.return);break;case 3:if(Ba(s,f),m&64&&(s=f.updateQueue,s!==null)){if(l=null,f.child!==null)switch(f.child.tag){case 27:case 5:l=f.child.stateNode;break;case 1:l=f.child.stateNode}try{bP(s,l)}catch(R){dn(f,f.return,R)}}break;case 27:l===null&&m&4&&ON(f);case 26:case 5:Ba(s,f),l===null&&m&4&&RN(f),m&512&&Up(f,f.return);break;case 12:Ba(s,f);break;case 31:Ba(s,f),m&4&&$N(s,f);break;case 13:Ba(s,f),m&4&&jN(s,f),m&64&&(s=f.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(f=zQ.bind(null,f),sX(s,f))));break;case 22:if(m=f.memoizedState!==null||Fa,!m){l=l!==null&&l.memoizedState!==null||Tr,b=Fa;var w=Tr;Fa=m,(Tr=l)&&!w?Ua(s,f,(f.subtreeFlags&8772)!==0):Ba(s,f),Fa=b,Tr=w}break;case 30:break;default:Ba(s,f)}}function NN(s){var l=s.alternate;l!==null&&(s.alternate=null,NN(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&Hc(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 Bn=null,Ki=!1;function za(s,l,f){for(f=f.child;f!==null;)LN(s,l,f),f=f.sibling}function LN(s,l,f){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(gt,f)}catch{}switch(f.tag){case 26:Tr||Ks(f,l),za(s,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:Tr||Ks(f,l);var m=Bn,b=Ki;Vl(f.type)&&(Bn=f.stateNode,Ki=!1),za(s,l,f),Xp(f.stateNode),Bn=m,Ki=b;break;case 5:Tr||Ks(f,l);case 6:if(m=Bn,b=Ki,Bn=null,za(s,l,f),Bn=m,Ki=b,Bn!==null)if(Ki)try{(Bn.nodeType===9?Bn.body:Bn.nodeName==="HTML"?Bn.ownerDocument.body:Bn).removeChild(f.stateNode)}catch(w){dn(f,l,w)}else try{Bn.removeChild(f.stateNode)}catch(w){dn(f,l,w)}break;case 18:Bn!==null&&(Ki?(s=Bn,I2(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,f.stateNode),df(s)):I2(Bn,f.stateNode));break;case 4:m=Bn,b=Ki,Bn=f.stateNode.containerInfo,Ki=!0,za(s,l,f),Bn=m,Ki=b;break;case 0:case 11:case 14:case 15:$l(2,f,l),Tr||$l(4,f,l),za(s,l,f);break;case 1:Tr||(Ks(f,l),m=f.stateNode,typeof m.componentWillUnmount=="function"&&MN(f,l,m)),za(s,l,f);break;case 21:za(s,l,f);break;case 22:Tr=(m=Tr)||f.memoizedState!==null,za(s,l,f),Tr=m;break;default:za(s,l,f)}}function $N(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{df(s)}catch(f){dn(l,l.return,f)}}}function jN(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{df(s)}catch(f){dn(l,l.return,f)}}function OQ(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new DN),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new DN),l;default:throw Error(r(435,s.tag))}}function Vb(s,l){var f=OQ(s);l.forEach(function(m){if(!f.has(m)){f.add(m);var b=BQ.bind(null,s,m);m.then(b,b)}})}function Wi(s,l){var f=l.deletions;if(f!==null)for(var m=0;m<f.length;m++){var b=f[m],w=s,R=l,H=R;e:for(;H!==null;){switch(H.tag){case 27:if(Vl(H.type)){Bn=H.stateNode,Ki=!1;break e}break;case 5:Bn=H.stateNode,Ki=!1;break e;case 3:case 4:Bn=H.stateNode.containerInfo,Ki=!0;break e}H=H.return}if(Bn===null)throw Error(r(160));LN(w,R,b),Bn=null,Ki=!1,w=b.alternate,w!==null&&(w.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)FN(l,s),l=l.sibling}var ps=null;function FN(s,l){var f=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Wi(l,s),Gi(s),m&4&&($l(3,s,s.return),Bp(3,s),$l(5,s,s.return));break;case 1:Wi(l,s),Gi(s),m&512&&(Tr||f===null||Ks(f,f.return)),m&64&&Fa&&(s=s.updateQueue,s!==null&&(m=s.callbacks,m!==null&&(f=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=f===null?m:f.concat(m))));break;case 26:var b=ps;if(Wi(l,s),Gi(s),m&512&&(Tr||f===null||Ks(f,f.return)),m&4){var w=f!==null?f.memoizedState:null;if(m=s.memoizedState,f===null)if(m===null)if(s.stateNode===null){e:{m=s.type,f=s.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":w=b.getElementsByTagName("title")[0],(!w||w[Tl]||w[cn]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=b.createElement(m),b.head.insertBefore(w,b.querySelector("head > title"))),ii(w,m,f),w[cn]=s,Kr(w),m=w;break e;case"link":var R=F2("link","href",b).get(m+(f.href||""));if(R){for(var H=0;H<R.length;H++)if(w=R[H],w.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&w.getAttribute("rel")===(f.rel==null?null:f.rel)&&w.getAttribute("title")===(f.title==null?null:f.title)&&w.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){R.splice(H,1);break t}}w=b.createElement(m),ii(w,m,f),b.head.appendChild(w);break;case"meta":if(R=F2("meta","content",b).get(m+(f.content||""))){for(H=0;H<R.length;H++)if(w=R[H],w.getAttribute("content")===(f.content==null?null:""+f.content)&&w.getAttribute("name")===(f.name==null?null:f.name)&&w.getAttribute("property")===(f.property==null?null:f.property)&&w.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&w.getAttribute("charset")===(f.charSet==null?null:f.charSet)){R.splice(H,1);break t}}w=b.createElement(m),ii(w,m,f),b.head.appendChild(w);break;default:throw Error(r(468,m))}w[cn]=s,Kr(w),m=w}s.stateNode=m}else z2(b,s.type,s.stateNode);else s.stateNode=j2(b,m,s.memoizedProps);else w!==m?(w===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):w.count--,m===null?z2(b,s.type,s.stateNode):j2(b,m,s.memoizedProps)):m===null&&s.stateNode!==null&&v_(s,s.memoizedProps,f.memoizedProps)}break;case 27:Wi(l,s),Gi(s),m&512&&(Tr||f===null||Ks(f,f.return)),f!==null&&m&4&&v_(s,s.memoizedProps,f.memoizedProps);break;case 5:if(Wi(l,s),Gi(s),m&512&&(Tr||f===null||Ks(f,f.return)),s.flags&32){b=s.stateNode;try{Dd(b,"")}catch($e){dn(s,s.return,$e)}}m&4&&s.stateNode!=null&&(b=s.memoizedProps,v_(s,b,f!==null?f.memoizedProps:b)),m&1024&&(w_=!0);break;case 6:if(Wi(l,s),Gi(s),m&4){if(s.stateNode===null)throw Error(r(162));m=s.memoizedProps,f=s.stateNode;try{f.nodeValue=m}catch($e){dn(s,s.return,$e)}}break;case 3:if(sv=null,b=ps,ps=iv(l.containerInfo),Wi(l,s),ps=b,Gi(s),m&4&&f!==null&&f.memoizedState.isDehydrated)try{df(l.containerInfo)}catch($e){dn(s,s.return,$e)}w_&&(w_=!1,zN(s));break;case 4:m=ps,ps=iv(s.stateNode.containerInfo),Wi(l,s),Gi(s),ps=m;break;case 12:Wi(l,s),Gi(s);break;case 31:Wi(l,s),Gi(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Vb(s,m)));break;case 13:Wi(l,s),Gi(s),s.child.flags&8192&&s.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(Kb=pt()),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Vb(s,m)));break;case 22:b=s.memoizedState!==null;var X=f!==null&&f.memoizedState!==null,le=Fa,ge=Tr;if(Fa=le||b,Tr=ge||X,Wi(l,s),Tr=ge,Fa=le,Gi(s),m&8192)e:for(l=s.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(f===null||X||Fa||Tr||lu(s)),f=null,l=s;;){if(l.tag===5||l.tag===26){if(f===null){X=f=l;try{if(w=X.stateNode,b)R=w.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{H=X.stateNode;var ve=X.memoizedProps.style,de=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;H.style.display=de==null||typeof de=="boolean"?"":(""+de).trim()}}catch($e){dn(X,X.return,$e)}}}else if(l.tag===6){if(f===null){X=l;try{X.stateNode.nodeValue=b?"":X.memoizedProps}catch($e){dn(X,X.return,$e)}}}else if(l.tag===18){if(f===null){X=l;try{var pe=X.stateNode;b?M2(pe,!0):M2(X.stateNode,!1)}catch($e){dn(X,X.return,$e)}}}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;f===l&&(f=null),l=l.return}f===l&&(f=null),l.sibling.return=l.return,l=l.sibling}m&4&&(m=s.updateQueue,m!==null&&(f=m.retryQueue,f!==null&&(m.retryQueue=null,Vb(s,f))));break;case 19:Wi(l,s),Gi(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Vb(s,m)));break;case 30:break;case 21:break;default:Wi(l,s),Gi(s)}}function Gi(s){var l=s.flags;if(l&2){try{for(var f,m=s.return;m!==null;){if(AN(m)){f=m;break}m=m.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var b=f.stateNode,w=S_(s);qb(s,w,b);break;case 5:var R=f.stateNode;f.flags&32&&(Dd(R,""),f.flags&=-33);var H=S_(s);qb(s,H,R);break;case 3:case 4:var X=f.stateNode.containerInfo,le=S_(s);x_(s,le,X);break;default:throw Error(r(161))}}catch(ge){dn(s,s.return,ge)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function zN(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;zN(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function Ba(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)PN(s,l.alternate,l),l=l.sibling}function lu(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:$l(4,l,l.return),lu(l);break;case 1:Ks(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&MN(l,l.return,f),lu(l);break;case 27:Xp(l.stateNode);case 26:case 5:Ks(l,l.return),lu(l);break;case 22:l.memoizedState===null&&lu(l);break;case 30:lu(l);break;default:lu(l)}s=s.sibling}}function Ua(s,l,f){for(f=f&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,b=s,w=l,R=w.flags;switch(w.tag){case 0:case 11:case 15:Ua(b,w,f),Bp(4,w);break;case 1:if(Ua(b,w,f),m=w,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(le){dn(m,m.return,le)}if(m=w,b=m.updateQueue,b!==null){var H=m.stateNode;try{var X=b.shared.hiddenCallbacks;if(X!==null)for(b.shared.hiddenCallbacks=null,b=0;b<X.length;b++)yP(X[b],H)}catch(le){dn(m,m.return,le)}}f&&R&64&&IN(w),Up(w,w.return);break;case 27:ON(w);case 26:case 5:Ua(b,w,f),f&&m===null&&R&4&&RN(w),Up(w,w.return);break;case 12:Ua(b,w,f);break;case 31:Ua(b,w,f),f&&R&4&&$N(b,w);break;case 13:Ua(b,w,f),f&&R&4&&jN(b,w);break;case 22:w.memoizedState===null&&Ua(b,w,f),Up(w,w.return);break;case 30:break;default:Ua(b,w,f)}l=l.sibling}}function k_(s,l){var f=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==f&&(s!=null&&s.refCount++,f!=null&&Ip(f))}function __(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Ip(s))}function ms(s,l,f,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)BN(s,l,f,m),l=l.sibling}function BN(s,l,f,m){var b=l.flags;switch(l.tag){case 0:case 11:case 15:ms(s,l,f,m),b&2048&&Bp(9,l);break;case 1:ms(s,l,f,m);break;case 3:ms(s,l,f,m),b&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Ip(s)));break;case 12:if(b&2048){ms(s,l,f,m),s=l.stateNode;try{var w=l.memoizedProps,R=w.id,H=w.onPostCommit;typeof H=="function"&&H(R,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(X){dn(l,l.return,X)}}else ms(s,l,f,m);break;case 31:ms(s,l,f,m);break;case 13:ms(s,l,f,m);break;case 23:break;case 22:w=l.stateNode,R=l.alternate,l.memoizedState!==null?w._visibility&2?ms(s,l,f,m):qp(s,l):w._visibility&2?ms(s,l,f,m):(w._visibility|=2,Zd(s,l,f,m,(l.subtreeFlags&10256)!==0||!1)),b&2048&&k_(R,l);break;case 24:ms(s,l,f,m),b&2048&&__(l.alternate,l);break;default:ms(s,l,f,m)}}function Zd(s,l,f,m,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var w=s,R=l,H=f,X=m,le=R.flags;switch(R.tag){case 0:case 11:case 15:Zd(w,R,H,X,b),Bp(8,R);break;case 23:break;case 22:var ge=R.stateNode;R.memoizedState!==null?ge._visibility&2?Zd(w,R,H,X,b):qp(w,R):(ge._visibility|=2,Zd(w,R,H,X,b)),b&&le&2048&&k_(R.alternate,R);break;case 24:Zd(w,R,H,X,b),b&&le&2048&&__(R.alternate,R);break;default:Zd(w,R,H,X,b)}l=l.sibling}}function qp(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var f=s,m=l,b=m.flags;switch(m.tag){case 22:qp(f,m),b&2048&&k_(m.alternate,m);break;case 24:qp(f,m),b&2048&&__(m.alternate,m);break;default:qp(f,m)}l=l.sibling}}var Vp=8192;function ef(s,l,f){if(s.subtreeFlags&Vp)for(s=s.child;s!==null;)UN(s,l,f),s=s.sibling}function UN(s,l,f){switch(s.tag){case 26:ef(s,l,f),s.flags&Vp&&s.memoizedState!==null&&bX(f,ps,s.memoizedState,s.memoizedProps);break;case 5:ef(s,l,f);break;case 3:case 4:var m=ps;ps=iv(s.stateNode.containerInfo),ef(s,l,f),ps=m;break;case 22:s.memoizedState===null&&(m=s.alternate,m!==null&&m.memoizedState!==null?(m=Vp,Vp=16777216,ef(s,l,f),Vp=m):ef(s,l,f));break;default:ef(s,l,f)}}function qN(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 Hp(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];Wr=m,HN(m,s)}qN(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)VN(s),s=s.sibling}function VN(s){switch(s.tag){case 0:case 11:case 15:Hp(s),s.flags&2048&&$l(9,s,s.return);break;case 3:Hp(s);break;case 12:Hp(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Hb(s)):Hp(s);break;default:Hp(s)}}function Hb(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];Wr=m,HN(m,s)}qN(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:$l(8,l,l.return),Hb(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,Hb(l));break;default:Hb(l)}s=s.sibling}}function HN(s,l){for(;Wr!==null;){var f=Wr;switch(f.tag){case 0:case 11:case 15:$l(8,f,l);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var m=f.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Ip(f.memoizedState.cache)}if(m=f.child,m!==null)m.return=f,Wr=m;else e:for(f=s;Wr!==null;){m=Wr;var b=m.sibling,w=m.return;if(NN(m),m===f){Wr=null;break e}if(b!==null){b.return=w,Wr=b;break e}Wr=w}}}var DQ={getCacheForType:function(s){var l=ni(kr),f=l.data.get(s);return f===void 0&&(f=s(),l.data.set(s,f)),f},cacheSignal:function(){return ni(kr).controller.signal}},PQ=typeof WeakMap=="function"?WeakMap:Map,Zt=0,kn=null,Ot=null,$t=0,un=0,fo=null,jl=!1,tf=!1,E_=!1,qa=0,tr=0,Fl=0,cu=0,T_=0,ho=0,nf=0,Kp=null,Yi=null,C_=!1,Kb=0,KN=0,Wb=1/0,Gb=null,zl=null,$r=0,Bl=null,rf=null,Va=0,I_=0,M_=null,WN=null,Wp=0,R_=null;function po(){return(Zt&2)!==0&&$t!==0?$t&-$t:j.T!==null?L_():pn()}function GN(){if(ho===0)if(($t&536870912)===0||Vt){var s=Ee;Ee<<=1,(Ee&3932160)===0&&(Ee=262144),ho=s}else ho=536870912;return s=co.current,s!==null&&(s.flags|=32),ho}function Qi(s,l,f){(s===kn&&(un===2||un===9)||s.cancelPendingCommit!==null)&&(of(s,0),Ul(s,$t,ho,!1)),Rt(s,f),((Zt&2)===0||s!==kn)&&(s===kn&&((Zt&2)===0&&(cu|=f),tr===4&&Ul(s,$t,ho,!1)),Ws(s))}function YN(s,l,f){if((Zt&6)!==0)throw Error(r(327));var m=!f&&(l&127)===0&&(l&s.expiredLanes)===0||Tt(s,l),b=m?$Q(s,l):O_(s,l,!0),w=m;do{if(b===0){tf&&!m&&Ul(s,l,0,!1);break}else{if(f=s.current.alternate,w&&!NQ(f)){b=O_(s,l,!1),w=!1;continue}if(b===2){if(w=l,s.errorRecoveryDisabledLanes&w)var R=0;else R=s.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){l=R;e:{var H=s;b=Kp;var X=H.current.memoizedState.isDehydrated;if(X&&(of(H,R).flags|=256),R=O_(H,R,!1),R!==2){if(E_&&!X){H.errorRecoveryDisabledLanes|=w,cu|=w,b=4;break e}w=Yi,Yi=b,w!==null&&(Yi===null?Yi=w:Yi.push.apply(Yi,w))}b=R}if(w=!1,b!==2)continue}}if(b===1){of(s,0),Ul(s,l,0,!0);break}e:{switch(m=s,w=b,w){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:Ul(m,l,ho,!jl);break e;case 2:Yi=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(b=Kb+300-pt(),10<b)){if(Ul(m,l,ho,!jl),_e(m,0,!0)!==0)break e;Va=l,m.timeoutHandle=T2(QN.bind(null,m,f,Yi,Gb,C_,l,ho,cu,nf,jl,w,"Throttled",-0,0),b);break e}QN(m,f,Yi,Gb,C_,l,ho,cu,nf,jl,w,null,-0,0)}}break}while(!0);Ws(s)}function QN(s,l,f,m,b,w,R,H,X,le,ge,ve,de,pe){if(s.timeoutHandle=-1,ve=l.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ma},UN(l,w,ve);var $e=(w&62914560)===w?Kb-pt():(w&4194048)===w?KN-pt():0;if($e=vX(ve,$e),$e!==null){Va=w,s.cancelPendingCommit=$e(i2.bind(null,s,l,w,f,m,b,R,H,X,ge,ve,null,de,pe)),Ul(s,w,R,!le);return}}i2(s,l,w,f,m,b,R,H,X)}function NQ(s){for(var l=s;;){var f=l.tag;if((f===0||f===11||f===15)&&l.flags&16384&&(f=l.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var m=0;m<f.length;m++){var b=f[m],w=b.getSnapshot;b=b.value;try{if(!ao(w(),b))return!1}catch{return!1}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;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 Ul(s,l,f,m){l&=~T_,l&=~cu,s.suspendedLanes|=l,s.pingedLanes&=~l,m&&(s.warmLanes|=l),m=s.expirationTimes;for(var b=l;0<b;){var w=31-tt(b),R=1<<w;m[w]=-1,b&=~R}f!==0&&At(s,f,l)}function Yb(){return(Zt&6)===0?(Gp(0),!1):!0}function A_(){if(Ot!==null){if(un===0)var s=Ot.return;else s=Ot,Da=eu=null,Wk(s),Gd=null,Rp=0,s=Ot;for(;s!==null;)CN(s.alternate,s),s=s.return;Ot=null}}function of(s,l){var f=s.timeoutHandle;f!==-1&&(s.timeoutHandle=-1,tX(f)),f=s.cancelPendingCommit,f!==null&&(s.cancelPendingCommit=null,f()),Va=0,A_(),kn=s,Ot=f=Aa(s.current,null),$t=l,un=0,fo=null,jl=!1,tf=Tt(s,l),E_=!1,nf=ho=T_=cu=Fl=tr=0,Yi=Kp=null,C_=!1,(l&8)!==0&&(l|=l&32);var m=s.entangledLanes;if(m!==0)for(s=s.entanglements,m&=l;0<m;){var b=31-tt(m),w=1<<b;l|=s[b],m&=~w}return qa=l,gb(),f}function XN(s,l){St=null,j.H=jp,l===Wd||l===_b?(l=hP(),un=3):l===Nk?(l=hP(),un=4):un=l===c_?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,fo=l,Ot===null&&(tr=1,jb(s,$o(l,s.current)))}function JN(){var s=co.current;return s===null?!0:($t&4194048)===$t?Bo===null:($t&62914560)===$t||($t&536870912)!==0?s===Bo:!1}function ZN(){var s=j.H;return j.H=jp,s===null?jp:s}function e2(){var s=j.A;return j.A=DQ,s}function Qb(){tr=4,jl||($t&4194048)!==$t&&co.current!==null||(tf=!0),(Fl&134217727)===0&&(cu&134217727)===0||kn===null||Ul(kn,$t,ho,!1)}function O_(s,l,f){var m=Zt;Zt|=2;var b=ZN(),w=e2();(kn!==s||$t!==l)&&(Gb=null,of(s,l)),l=!1;var R=tr;e:do try{if(un!==0&&Ot!==null){var H=Ot,X=fo;switch(un){case 8:A_(),R=6;break e;case 3:case 2:case 9:case 6:co.current===null&&(l=!0);var le=un;if(un=0,fo=null,sf(s,H,X,le),f&&tf){R=0;break e}break;default:le=un,un=0,fo=null,sf(s,H,X,le)}}LQ(),R=tr;break}catch(ge){XN(s,ge)}while(!0);return l&&s.shellSuspendCounter++,Da=eu=null,Zt=m,j.H=b,j.A=w,Ot===null&&(kn=null,$t=0,gb()),R}function LQ(){for(;Ot!==null;)t2(Ot)}function $Q(s,l){var f=Zt;Zt|=2;var m=ZN(),b=e2();kn!==s||$t!==l?(Gb=null,Wb=pt()+500,of(s,l)):tf=Tt(s,l);e:do try{if(un!==0&&Ot!==null){l=Ot;var w=fo;t:switch(un){case 1:un=0,fo=null,sf(s,l,w,1);break;case 2:case 9:if(dP(w)){un=0,fo=null,n2(l);break}l=function(){un!==2&&un!==9||kn!==s||(un=7),Ws(s)},w.then(l,l);break e;case 3:un=7;break e;case 4:un=5;break e;case 7:dP(w)?(un=0,fo=null,n2(l)):(un=0,fo=null,sf(s,l,w,7));break;case 5:var R=null;switch(Ot.tag){case 26:R=Ot.memoizedState;case 5:case 27:var H=Ot;if(R?B2(R):H.stateNode.complete){un=0,fo=null;var X=H.sibling;if(X!==null)Ot=X;else{var le=H.return;le!==null?(Ot=le,Xb(le)):Ot=null}break t}}un=0,fo=null,sf(s,l,w,5);break;case 6:un=0,fo=null,sf(s,l,w,6);break;case 8:A_(),tr=6;break e;default:throw Error(r(462))}}jQ();break}catch(ge){XN(s,ge)}while(!0);return Da=eu=null,j.H=m,j.A=b,Zt=f,Ot!==null?0:(kn=null,$t=0,gb(),tr)}function jQ(){for(;Ot!==null&&!nn();)t2(Ot)}function t2(s){var l=EN(s.alternate,s,qa);s.memoizedProps=s.pendingProps,l===null?Xb(s):Ot=l}function n2(s){var l=s,f=l.alternate;switch(l.tag){case 15:case 0:l=vN(f,l,l.pendingProps,l.type,void 0,$t);break;case 11:l=vN(f,l,l.pendingProps,l.type.render,l.ref,$t);break;case 5:Wk(l);default:CN(f,l),l=Ot=eP(l,qa),l=EN(f,l,qa)}s.memoizedProps=s.pendingProps,l===null?Xb(s):Ot=l}function sf(s,l,f,m){Da=eu=null,Wk(l),Gd=null,Rp=0;var b=l.return;try{if(TQ(s,b,l,f,$t)){tr=1,jb(s,$o(f,s.current)),Ot=null;return}}catch(w){if(b!==null)throw Ot=b,w;tr=1,jb(s,$o(f,s.current)),Ot=null;return}l.flags&32768?(Vt||m===1?s=!0:tf||($t&536870912)!==0?s=!1:(jl=s=!0,(m===2||m===9||m===3||m===6)&&(m=co.current,m!==null&&m.tag===13&&(m.flags|=16384))),r2(l,s)):Xb(l)}function Xb(s){var l=s;do{if((l.flags&32768)!==0){r2(l,jl);return}s=l.return;var f=MQ(l.alternate,l,qa);if(f!==null){Ot=f;return}if(l=l.sibling,l!==null){Ot=l;return}Ot=l=s}while(l!==null);tr===0&&(tr=5)}function r2(s,l){do{var f=RQ(s.alternate,s);if(f!==null){f.flags&=32767,Ot=f;return}if(f=s.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(s=s.sibling,s!==null)){Ot=s;return}Ot=s=f}while(s!==null);tr=6,Ot=null}function i2(s,l,f,m,b,w,R,H,X){s.cancelPendingCommit=null;do Jb();while($r!==0);if((Zt&6)!==0)throw Error(r(327));if(l!==null){if(l===s.current)throw Error(r(177));if(w=l.lanes|l.childLanes,w|=Sk,yt(s,f,w,R,H,X),s===kn&&(Ot=kn=null,$t=0),rf=l,Bl=s,Va=f,I_=w,M_=b,WN=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,UQ(Ne,function(){return c2(),null})):(s.callbackNode=null,s.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=j.T,j.T=null,b=K.p,K.p=2,R=Zt,Zt|=4;try{AQ(s,l,f)}finally{Zt=R,K.p=b,j.T=m}}$r=1,o2(),s2(),a2()}}function o2(){if($r===1){$r=0;var s=Bl,l=rf,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=j.T,j.T=null;var m=K.p;K.p=2;var b=Zt;Zt|=4;try{FN(l,s);var w=V_,R=HD(s.containerInfo),H=w.focusedElem,X=w.selectionRange;if(R!==H&&H&&H.ownerDocument&&VD(H.ownerDocument.documentElement,H)){if(X!==null&&mk(H)){var le=X.start,ge=X.end;if(ge===void 0&&(ge=le),"selectionStart"in H)H.selectionStart=le,H.selectionEnd=Math.min(ge,H.value.length);else{var ve=H.ownerDocument||document,de=ve&&ve.defaultView||window;if(de.getSelection){var pe=de.getSelection(),$e=H.textContent.length,nt=Math.min(X.start,$e),yn=X.end===void 0?nt:Math.min(X.end,$e);!pe.extend&&nt>yn&&(R=yn,yn=nt,nt=R);var re=qD(H,nt),te=qD(H,yn);if(re&&te&&(pe.rangeCount!==1||pe.anchorNode!==re.node||pe.anchorOffset!==re.offset||pe.focusNode!==te.node||pe.focusOffset!==te.offset)){var se=ve.createRange();se.setStart(re.node,re.offset),pe.removeAllRanges(),nt>yn?(pe.addRange(se),pe.extend(te.node,te.offset)):(se.setEnd(te.node,te.offset),pe.addRange(se))}}}}for(ve=[],pe=H;pe=pe.parentNode;)pe.nodeType===1&&ve.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<ve.length;H++){var be=ve[H];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}uv=!!q_,V_=q_=null}finally{Zt=b,K.p=m,j.T=f}}s.current=l,$r=2}}function s2(){if($r===2){$r=0;var s=Bl,l=rf,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=j.T,j.T=null;var m=K.p;K.p=2;var b=Zt;Zt|=4;try{PN(s,l.alternate,l)}finally{Zt=b,K.p=m,j.T=f}}$r=3}}function a2(){if($r===4||$r===3){$r=0,Rn();var s=Bl,l=rf,f=Va,m=WN;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?$r=5:($r=0,rf=Bl=null,l2(s,s.pendingLanes));var b=s.pendingLanes;if(b===0&&(zl=null),xn(f),l=l.stateNode,mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(gt,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=j.T,b=K.p,K.p=2,j.T=null;try{for(var w=s.onRecoverableError,R=0;R<m.length;R++){var H=m[R];w(H.value,{componentStack:H.stack})}}finally{j.T=l,K.p=b}}(Va&3)!==0&&Jb(),Ws(s),b=s.pendingLanes,(f&261930)!==0&&(b&42)!==0?s===R_?Wp++:(Wp=0,R_=s):Wp=0,Gp(0)}}function l2(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Ip(l)))}function Jb(){return o2(),s2(),a2(),c2()}function c2(){if($r!==5)return!1;var s=Bl,l=I_;I_=0;var f=xn(Va),m=j.T,b=K.p;try{K.p=32>f?32:f,j.T=null,f=M_,M_=null;var w=Bl,R=Va;if($r=0,rf=Bl=null,Va=0,(Zt&6)!==0)throw Error(r(331));var H=Zt;if(Zt|=4,VN(w.current),BN(w,w.current,R,f),Zt=H,Gp(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(gt,w)}catch{}return!0}finally{K.p=b,j.T=m,l2(s,l)}}function u2(s,l,f){l=$o(f,l),l=l_(s.stateNode,l,2),s=Pl(s,l,2),s!==null&&(Rt(s,2),Ws(s))}function dn(s,l,f){if(s.tag===3)u2(s,s,f);else for(;l!==null;){if(l.tag===3){u2(l,s,f);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(zl===null||!zl.has(m))){s=$o(f,s),f=dN(2),m=Pl(l,f,2),m!==null&&(fN(f,m,l,s),Rt(m,2),Ws(m));break}}l=l.return}}function D_(s,l,f){var m=s.pingCache;if(m===null){m=s.pingCache=new PQ;var b=new Set;m.set(l,b)}else b=m.get(l),b===void 0&&(b=new Set,m.set(l,b));b.has(f)||(E_=!0,b.add(f),s=FQ.bind(null,s,l,f),l.then(s,s))}function FQ(s,l,f){var m=s.pingCache;m!==null&&m.delete(l),s.pingedLanes|=s.suspendedLanes&f,s.warmLanes&=~f,kn===s&&($t&f)===f&&(tr===4||tr===3&&($t&62914560)===$t&&300>pt()-Kb?(Zt&2)===0&&of(s,0):T_|=f,nf===$t&&(nf=0)),Ws(s)}function d2(s,l){l===0&&(l=ei()),s=Xc(s,l),s!==null&&(Rt(s,l),Ws(s))}function zQ(s){var l=s.memoizedState,f=0;l!==null&&(f=l.retryLane),d2(s,f)}function BQ(s,l){var f=0;switch(s.tag){case 31:case 13:var m=s.stateNode,b=s.memoizedState;b!==null&&(f=b.retryLane);break;case 19:m=s.stateNode;break;case 22:m=s.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(l),d2(s,f)}function UQ(s,l){return Ue(s,l)}var Zb=null,af=null,P_=!1,ev=!1,N_=!1,ql=0;function Ws(s){s!==af&&s.next===null&&(af===null?Zb=af=s:af=af.next=s),ev=!0,P_||(P_=!0,VQ())}function Gp(s,l){if(!N_&&ev){N_=!0;do for(var f=!1,m=Zb;m!==null;){if(s!==0){var b=m.pendingLanes;if(b===0)var w=0;else{var R=m.suspendedLanes,H=m.pingedLanes;w=(1<<31-tt(42|s)+1)-1,w&=b&~(R&~H),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,m2(m,w))}else w=$t,w=_e(m,m===kn?w:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(w&3)===0||Tt(m,w)||(f=!0,m2(m,w));m=m.next}while(f);N_=!1}}function qQ(){f2()}function f2(){ev=P_=!1;var s=0;ql!==0&&eX()&&(s=ql);for(var l=pt(),f=null,m=Zb;m!==null;){var b=m.next,w=h2(m,l);w===0?(m.next=null,f===null?Zb=b:f.next=b,b===null&&(af=f)):(f=m,(s!==0||(w&3)!==0)&&(ev=!0)),m=b}$r!==0&&$r!==5||Gp(s),ql!==0&&(ql=0)}function h2(s,l){for(var f=s.suspendedLanes,m=s.pingedLanes,b=s.expirationTimes,w=s.pendingLanes&-62914561;0<w;){var R=31-tt(w),H=1<<R,X=b[R];X===-1?((H&f)===0||(H&m)!==0)&&(b[R]=Hr(H,l)):X<=l&&(s.expiredLanes|=H),w&=~H}if(l=kn,f=$t,f=_e(s,s===l?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m=s.callbackNode,f===0||s===l&&(un===2||un===9)||s.cancelPendingCommit!==null)return m!==null&&m!==null&&Mn(m),s.callbackNode=null,s.callbackPriority=0;if((f&3)===0||Tt(s,f)){if(l=f&-f,l===s.callbackPriority)return l;switch(m!==null&&Mn(m),xn(f)){case 2:case 8:f=we;break;case 32:f=Ne;break;case 268435456:f=Ve;break;default:f=Ne}return m=p2.bind(null,s),f=Ue(f,m),s.callbackPriority=l,s.callbackNode=f,l}return m!==null&&m!==null&&Mn(m),s.callbackPriority=2,s.callbackNode=null,2}function p2(s,l){if($r!==0&&$r!==5)return s.callbackNode=null,s.callbackPriority=0,null;var f=s.callbackNode;if(Jb()&&s.callbackNode!==f)return null;var m=$t;return m=_e(s,s===kn?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m===0?null:(YN(s,m,l),h2(s,pt()),s.callbackNode!=null&&s.callbackNode===f?p2.bind(null,s):null)}function m2(s,l){if(Jb())return null;YN(s,l,!0)}function VQ(){nX(function(){(Zt&6)!==0?Ue(ue,qQ):f2()})}function L_(){if(ql===0){var s=Hd;s===0&&(s=Be,Be<<=1,(Be&261888)===0&&(Be=256)),ql=s}return ql}function g2(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:lb(""+s)}function y2(s,l){var f=l.ownerDocument.createElement("input");return f.name=l.name,f.value=l.value,s.id&&f.setAttribute("form",s.id),l.parentNode.insertBefore(f,l),s=new FormData(s),f.parentNode.removeChild(f),s}function HQ(s,l,f,m,b){if(l==="submit"&&f&&f.stateNode===b){var w=g2((b[wn]||null).action),R=m.submitter;R&&(l=(l=R[wn]||null)?g2(l.formAction):R.getAttribute("formAction"),l!==null&&(w=l,R=null));var H=new fb("action","action",null,m,b);s.push({event:H,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ql!==0){var X=R?y2(b,R):new FormData(b);n_(f,{pending:!0,data:X,method:b.method,action:w},null,X)}}else typeof w=="function"&&(H.preventDefault(),X=R?y2(b,R):new FormData(b),n_(f,{pending:!0,data:X,method:b.method,action:w},w,X))},currentTarget:b}]})}}for(var $_=0;$_<vk.length;$_++){var j_=vk[$_],KQ=j_.toLowerCase(),WQ=j_[0].toUpperCase()+j_.slice(1);hs(KQ,"on"+WQ)}hs(GD,"onAnimationEnd"),hs(YD,"onAnimationIteration"),hs(QD,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(cQ,"onTransitionRun"),hs(uQ,"onTransitionStart"),hs(dQ,"onTransitionCancel"),hs(XD,"onTransitionEnd"),Ad("onMouseEnter",["mouseout","mouseover"]),Ad("onMouseLeave",["mouseout","mouseover"]),Ad("onPointerEnter",["pointerout","pointerover"]),Ad("onPointerLeave",["pointerout","pointerover"]),Wc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Wc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Wc("onBeforeInput",["compositionend","keypress","textInput","paste"]),Wc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Wc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Wc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yp="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(" "),GQ=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yp));function b2(s,l){l=(l&4)!==0;for(var f=0;f<s.length;f++){var m=s[f],b=m.event;m=m.listeners;e:{var w=void 0;if(l)for(var R=m.length-1;0<=R;R--){var H=m[R],X=H.instance,le=H.currentTarget;if(H=H.listener,X!==w&&b.isPropagationStopped())break e;w=H,b.currentTarget=le;try{w(b)}catch(ge){mb(ge)}b.currentTarget=null,w=X}else for(R=0;R<m.length;R++){if(H=m[R],X=H.instance,le=H.currentTarget,H=H.listener,X!==w&&b.isPropagationStopped())break e;w=H,b.currentTarget=le;try{w(b)}catch(ge){mb(ge)}b.currentTarget=null,w=X}}}}function Dt(s,l){var f=l[qs];f===void 0&&(f=l[qs]=new Set);var m=s+"__bubble";f.has(m)||(v2(l,s,2,!1),f.add(m))}function F_(s,l,f){var m=0;l&&(m|=4),v2(f,s,m,l)}var tv="_reactListening"+Math.random().toString(36).slice(2);function z_(s){if(!s[tv]){s[tv]=!0,fD.forEach(function(f){f!=="selectionchange"&&(GQ.has(f)||F_(f,!1,s),F_(f,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[tv]||(l[tv]=!0,F_("selectionchange",!1,l))}}function v2(s,l,f,m){switch(G2(l)){case 2:var b=wX;break;case 8:b=kX;break;default:b=t1}f=b.bind(null,l,f,s),b=void 0,!sk||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),m?b!==void 0?s.addEventListener(l,f,{capture:!0,passive:b}):s.addEventListener(l,f,!0):b!==void 0?s.addEventListener(l,f,{passive:b}):s.addEventListener(l,f,!1)}function B_(s,l,f,m,b){var w=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var H=m.stateNode.containerInfo;if(H===b)break;if(R===4)for(R=m.return;R!==null;){var X=R.tag;if((X===3||X===4)&&R.stateNode.containerInfo===b)return;R=R.return}for(;H!==null;){if(R=Ta(H),R===null)return;if(X=R.tag,X===5||X===6||X===26||X===27){m=w=R;continue e}H=H.parentNode}}m=m.return}_D(function(){var le=w,ge=ik(f),ve=[];e:{var de=JD.get(s);if(de!==void 0){var pe=fb,$e=s;switch(s){case"keypress":if(ub(f)===0)break e;case"keydown":case"keyup":pe=BY;break;case"focusin":$e="focus",pe=uk;break;case"focusout":$e="blur",pe=uk;break;case"beforeblur":case"afterblur":pe=uk;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=CD;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=MY;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=VY;break;case GD:case YD:case QD:pe=OY;break;case XD:pe=KY;break;case"scroll":case"scrollend":pe=CY;break;case"wheel":pe=GY;break;case"copy":case"cut":case"paste":pe=PY;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=MD;break;case"toggle":case"beforetoggle":pe=QY}var nt=(l&4)!==0,yn=!nt&&(s==="scroll"||s==="scrollend"),re=nt?de!==null?de+"Capture":null:de;nt=[];for(var te=le,se;te!==null;){var be=te;if(se=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||se===null||re===null||(be=yp(te,re),be!=null&&nt.push(Qp(te,be,se))),yn)break;te=te.return}0<nt.length&&(de=new pe(de,$e,null,f,ge),ve.push({event:de,listeners:nt}))}}if((l&7)===0){e:{if(de=s==="mouseover"||s==="pointerover",pe=s==="mouseout"||s==="pointerout",de&&f!==rk&&($e=f.relatedTarget||f.fromElement)&&(Ta($e)||$e[Us]))break e;if((pe||de)&&(de=ge.window===ge?ge:(de=ge.ownerDocument)?de.defaultView||de.parentWindow:window,pe?($e=f.relatedTarget||f.toElement,pe=le,$e=$e?Ta($e):null,$e!==null&&(yn=o($e),nt=$e.tag,$e!==yn||nt!==5&&nt!==27&&nt!==6)&&($e=null)):(pe=null,$e=le),pe!==$e)){if(nt=CD,be="onMouseLeave",re="onMouseEnter",te="mouse",(s==="pointerout"||s==="pointerover")&&(nt=MD,be="onPointerLeave",re="onPointerEnter",te="pointer"),yn=pe==null?de:Ca(pe),se=$e==null?de:Ca($e),de=new nt(be,te+"leave",pe,f,ge),de.target=yn,de.relatedTarget=se,be=null,Ta(ge)===le&&(nt=new nt(re,te+"enter",$e,f,ge),nt.target=se,nt.relatedTarget=yn,be=nt),yn=be,pe&&$e)t:{for(nt=YQ,re=pe,te=$e,se=0,be=re;be;be=nt(be))se++;be=0;for(var Ye=te;Ye;Ye=nt(Ye))be++;for(;0<se-be;)re=nt(re),se--;for(;0<be-se;)te=nt(te),be--;for(;se--;){if(re===te||te!==null&&re===te.alternate){nt=re;break t}re=nt(re),te=nt(te)}nt=null}else nt=null;pe!==null&&S2(ve,de,pe,nt,!1),$e!==null&&yn!==null&&S2(ve,yn,$e,nt,!0)}}e:{if(de=le?Ca(le):window,pe=de.nodeName&&de.nodeName.toLowerCase(),pe==="select"||pe==="input"&&de.type==="file")var Yt=$D;else if(ND(de))if(jD)Yt=sQ;else{Yt=iQ;var qe=rQ}else pe=de.nodeName,!pe||pe.toLowerCase()!=="input"||de.type!=="checkbox"&&de.type!=="radio"?le&&nk(le.elementType)&&(Yt=$D):Yt=oQ;if(Yt&&(Yt=Yt(s,le))){LD(ve,Yt,f,ge);break e}qe&&qe(s,de,le),s==="focusout"&&le&&de.type==="number"&&le.memoizedProps.value!=null&&tk(de,"number",de.value)}switch(qe=le?Ca(le):window,s){case"focusin":(ND(qe)||qe.contentEditable==="true")&&($d=qe,gk=le,Ep=null);break;case"focusout":Ep=gk=$d=null;break;case"mousedown":yk=!0;break;case"contextmenu":case"mouseup":case"dragend":yk=!1,KD(ve,f,ge);break;case"selectionchange":if(lQ)break;case"keydown":case"keyup":KD(ve,f,ge)}var xt;if(fk)e:{switch(s){case"compositionstart":var jt="onCompositionStart";break e;case"compositionend":jt="onCompositionEnd";break e;case"compositionupdate":jt="onCompositionUpdate";break e}jt=void 0}else Ld?DD(s,f)&&(jt="onCompositionEnd"):s==="keydown"&&f.keyCode===229&&(jt="onCompositionStart");jt&&(RD&&f.locale!=="ko"&&(Ld||jt!=="onCompositionStart"?jt==="onCompositionEnd"&&Ld&&(xt=ED()):(Cl=ge,ak="value"in Cl?Cl.value:Cl.textContent,Ld=!0)),qe=nv(le,jt),0<qe.length&&(jt=new ID(jt,s,null,f,ge),ve.push({event:jt,listeners:qe}),xt?jt.data=xt:(xt=PD(f),xt!==null&&(jt.data=xt)))),(xt=JY?ZY(s,f):eQ(s,f))&&(jt=nv(le,"onBeforeInput"),0<jt.length&&(qe=new ID("onBeforeInput","beforeinput",null,f,ge),ve.push({event:qe,listeners:jt}),qe.data=xt)),HQ(ve,s,le,f,ge)}b2(ve,l)})}function Qp(s,l,f){return{instance:s,listener:l,currentTarget:f}}function nv(s,l){for(var f=l+"Capture",m=[];s!==null;){var b=s,w=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||w===null||(b=yp(s,f),b!=null&&m.unshift(Qp(s,b,w)),b=yp(s,l),b!=null&&m.push(Qp(s,b,w))),s.tag===3)return m;s=s.return}return[]}function YQ(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function S2(s,l,f,m,b){for(var w=l._reactName,R=[];f!==null&&f!==m;){var H=f,X=H.alternate,le=H.stateNode;if(H=H.tag,X!==null&&X===m)break;H!==5&&H!==26&&H!==27||le===null||(X=le,b?(le=yp(f,w),le!=null&&R.unshift(Qp(f,le,X))):b||(le=yp(f,w),le!=null&&R.push(Qp(f,le,X)))),f=f.return}R.length!==0&&s.push({event:l,listeners:R})}var QQ=/\r\n?/g,XQ=/\u0000|\uFFFD/g;function x2(s){return(typeof s=="string"?s:""+s).replace(QQ,`
9
+ `).replace(XQ,"")}function w2(s,l){return l=x2(l),x2(s)===l}function gn(s,l,f,m,b,w){switch(f){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||Dd(s,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&Dd(s,""+m);break;case"className":sb(s,"class",m);break;case"tabIndex":sb(s,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":sb(s,f,m);break;case"style":wD(s,m,w);break;case"data":if(l!=="object"){sb(s,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(f);break}m=lb(""+m),s.setAttribute(f,m);break;case"action":case"formAction":if(typeof m=="function"){s.setAttribute(f,"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 w=="function"&&(f==="formAction"?(l!=="input"&&gn(s,l,"name",b.name,b,null),gn(s,l,"formEncType",b.formEncType,b,null),gn(s,l,"formMethod",b.formMethod,b,null),gn(s,l,"formTarget",b.formTarget,b,null)):(gn(s,l,"encType",b.encType,b,null),gn(s,l,"method",b.method,b,null),gn(s,l,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(f);break}m=lb(""+m),s.setAttribute(f,m);break;case"onClick":m!=null&&(s.onclick=Ma);break;case"onScroll":m!=null&&Dt("scroll",s);break;case"onScrollEnd":m!=null&&Dt("scrollend",s);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"multiple":s.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":s.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){s.removeAttribute("xlink:href");break}f=lb(""+m),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(f,""+m):s.removeAttribute(f);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":m&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":m===!0?s.setAttribute(f,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(f,m):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?s.setAttribute(f,m):s.removeAttribute(f);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?s.removeAttribute(f):s.setAttribute(f,m);break;case"popover":Dt("beforetoggle",s),Dt("toggle",s),ob(s,"popover",m);break;case"xlinkActuate":Ia(s,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Ia(s,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Ia(s,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Ia(s,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Ia(s,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Ia(s,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Ia(s,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Ia(s,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Ia(s,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":ob(s,"is",m);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=EY.get(f)||f,ob(s,f,m))}}function U_(s,l,f,m,b,w){switch(f){case"style":wD(s,m,w);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"children":typeof m=="string"?Dd(s,m):(typeof m=="number"||typeof m=="bigint")&&Dd(s,""+m);break;case"onScroll":m!=null&&Dt("scroll",s);break;case"onScrollEnd":m!=null&&Dt("scrollend",s);break;case"onClick":m!=null&&(s.onclick=Ma);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hD.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(b=f.endsWith("Capture"),l=f.slice(2,b?f.length-7:void 0),w=s[wn]||null,w=w!=null?w[f]:null,typeof w=="function"&&s.removeEventListener(l,w,b),typeof m=="function")){typeof w!="function"&&w!==null&&(f in s?s[f]=null:s.hasAttribute(f)&&s.removeAttribute(f)),s.addEventListener(l,m,b);break e}f in s?s[f]=m:m===!0?s.setAttribute(f,""):ob(s,f,m)}}}function ii(s,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Dt("error",s),Dt("load",s);var m=!1,b=!1,w;for(w in f)if(f.hasOwnProperty(w)){var R=f[w];if(R!=null)switch(w){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:gn(s,l,w,R,f,null)}}b&&gn(s,l,"srcSet",f.srcSet,f,null),m&&gn(s,l,"src",f.src,f,null);return;case"input":Dt("invalid",s);var H=w=R=b=null,X=null,le=null;for(m in f)if(f.hasOwnProperty(m)){var ge=f[m];if(ge!=null)switch(m){case"name":b=ge;break;case"type":R=ge;break;case"checked":X=ge;break;case"defaultChecked":le=ge;break;case"value":w=ge;break;case"defaultValue":H=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,l));break;default:gn(s,l,m,ge,f,null)}}bD(s,w,H,X,le,R,b,!1);return;case"select":Dt("invalid",s),m=R=w=null;for(b in f)if(f.hasOwnProperty(b)&&(H=f[b],H!=null))switch(b){case"value":w=H;break;case"defaultValue":R=H;break;case"multiple":m=H;default:gn(s,l,b,H,f,null)}l=w,f=R,s.multiple=!!m,l!=null?Od(s,!!m,l,!1):f!=null&&Od(s,!!m,f,!0);return;case"textarea":Dt("invalid",s),w=b=m=null;for(R in f)if(f.hasOwnProperty(R)&&(H=f[R],H!=null))switch(R){case"value":m=H;break;case"defaultValue":b=H;break;case"children":w=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(91));break;default:gn(s,l,R,H,f,null)}SD(s,m,b,w);return;case"option":for(X in f)if(f.hasOwnProperty(X)&&(m=f[X],m!=null))switch(X){case"selected":s.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:gn(s,l,X,m,f,null)}return;case"dialog":Dt("beforetoggle",s),Dt("toggle",s),Dt("cancel",s),Dt("close",s);break;case"iframe":case"object":Dt("load",s);break;case"video":case"audio":for(m=0;m<Yp.length;m++)Dt(Yp[m],s);break;case"image":Dt("error",s),Dt("load",s);break;case"details":Dt("toggle",s);break;case"embed":case"source":case"link":Dt("error",s),Dt("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(le in f)if(f.hasOwnProperty(le)&&(m=f[le],m!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:gn(s,l,le,m,f,null)}return;default:if(nk(l)){for(ge in f)f.hasOwnProperty(ge)&&(m=f[ge],m!==void 0&&U_(s,l,ge,m,f,void 0));return}}for(H in f)f.hasOwnProperty(H)&&(m=f[H],m!=null&&gn(s,l,H,m,f,null))}function JQ(s,l,f,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,w=null,R=null,H=null,X=null,le=null,ge=null;for(pe in f){var ve=f[pe];if(f.hasOwnProperty(pe)&&ve!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":X=ve;default:m.hasOwnProperty(pe)||gn(s,l,pe,null,m,ve)}}for(var de in m){var pe=m[de];if(ve=f[de],m.hasOwnProperty(de)&&(pe!=null||ve!=null))switch(de){case"type":w=pe;break;case"name":b=pe;break;case"checked":le=pe;break;case"defaultChecked":ge=pe;break;case"value":R=pe;break;case"defaultValue":H=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,l));break;default:pe!==ve&&gn(s,l,de,pe,m,ve)}}ek(s,R,H,X,le,ge,w,b);return;case"select":pe=R=H=de=null;for(w in f)if(X=f[w],f.hasOwnProperty(w)&&X!=null)switch(w){case"value":break;case"multiple":pe=X;default:m.hasOwnProperty(w)||gn(s,l,w,null,m,X)}for(b in m)if(w=m[b],X=f[b],m.hasOwnProperty(b)&&(w!=null||X!=null))switch(b){case"value":de=w;break;case"defaultValue":H=w;break;case"multiple":R=w;default:w!==X&&gn(s,l,b,w,m,X)}l=H,f=R,m=pe,de!=null?Od(s,!!f,de,!1):!!m!=!!f&&(l!=null?Od(s,!!f,l,!0):Od(s,!!f,f?[]:"",!1));return;case"textarea":pe=de=null;for(H in f)if(b=f[H],f.hasOwnProperty(H)&&b!=null&&!m.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:gn(s,l,H,null,m,b)}for(R in m)if(b=m[R],w=f[R],m.hasOwnProperty(R)&&(b!=null||w!=null))switch(R){case"value":de=b;break;case"defaultValue":pe=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==w&&gn(s,l,R,b,m,w)}vD(s,de,pe);return;case"option":for(var $e in f)if(de=f[$e],f.hasOwnProperty($e)&&de!=null&&!m.hasOwnProperty($e))switch($e){case"selected":s.selected=!1;break;default:gn(s,l,$e,null,m,de)}for(X in m)if(de=m[X],pe=f[X],m.hasOwnProperty(X)&&de!==pe&&(de!=null||pe!=null))switch(X){case"selected":s.selected=de&&typeof de!="function"&&typeof de!="symbol";break;default:gn(s,l,X,de,m,pe)}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 nt in f)de=f[nt],f.hasOwnProperty(nt)&&de!=null&&!m.hasOwnProperty(nt)&&gn(s,l,nt,null,m,de);for(le in m)if(de=m[le],pe=f[le],m.hasOwnProperty(le)&&de!==pe&&(de!=null||pe!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,l));break;default:gn(s,l,le,de,m,pe)}return;default:if(nk(l)){for(var yn in f)de=f[yn],f.hasOwnProperty(yn)&&de!==void 0&&!m.hasOwnProperty(yn)&&U_(s,l,yn,void 0,m,de);for(ge in m)de=m[ge],pe=f[ge],!m.hasOwnProperty(ge)||de===pe||de===void 0&&pe===void 0||U_(s,l,ge,de,m,pe);return}}for(var re in f)de=f[re],f.hasOwnProperty(re)&&de!=null&&!m.hasOwnProperty(re)&&gn(s,l,re,null,m,de);for(ve in m)de=m[ve],pe=f[ve],!m.hasOwnProperty(ve)||de===pe||de==null&&pe==null||gn(s,l,ve,de,m,pe)}function k2(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ZQ(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,f=performance.getEntriesByType("resource"),m=0;m<f.length;m++){var b=f[m],w=b.transferSize,R=b.initiatorType,H=b.duration;if(w&&H&&k2(R)){for(R=0,H=b.responseEnd,m+=1;m<f.length;m++){var X=f[m],le=X.startTime;if(le>H)break;var ge=X.transferSize,ve=X.initiatorType;ge&&k2(ve)&&(X=X.responseEnd,R+=ge*(X<H?1:(H-le)/(X-le)))}if(--m,l+=8*(w+R)/(b.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 q_=null,V_=null;function rv(s){return s.nodeType===9?s:s.ownerDocument}function _2(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 E2(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 H_(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 K_=null;function eX(){var s=window.event;return s&&s.type==="popstate"?s===K_?!1:(K_=s,!0):(K_=null,!1)}var T2=typeof setTimeout=="function"?setTimeout:void 0,tX=typeof clearTimeout=="function"?clearTimeout:void 0,C2=typeof Promise=="function"?Promise:void 0,nX=typeof queueMicrotask=="function"?queueMicrotask:typeof C2<"u"?function(s){return C2.resolve(null).then(s).catch(rX)}:T2;function rX(s){setTimeout(function(){throw s})}function Vl(s){return s==="head"}function I2(s,l){var f=l,m=0;do{var b=f.nextSibling;if(s.removeChild(f),b&&b.nodeType===8)if(f=b.data,f==="/$"||f==="/&"){if(m===0){s.removeChild(b),df(l);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")Xp(s.ownerDocument.documentElement);else if(f==="head"){f=s.ownerDocument.head,Xp(f);for(var w=f.firstChild;w;){var R=w.nextSibling,H=w.nodeName;w[Tl]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&w.rel.toLowerCase()==="stylesheet"||f.removeChild(w),w=R}}else f==="body"&&Xp(s.ownerDocument.body);f=b}while(f);df(l)}function M2(s,l){var f=s;s=0;do{var m=f.nextSibling;if(f.nodeType===1?l?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(l?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),m&&m.nodeType===8)if(f=m.data,f==="/$"){if(s===0)break;s--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||s++;f=m}while(f)}function W_(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var f=l;switch(l=l.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":W_(f),Hc(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}s.removeChild(f)}}function iX(s,l,f,m){for(;s.nodeType===1;){var b=f;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(m){if(!s[Tl])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(w=s.getAttribute("rel"),w==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(w!==b.rel||s.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||s.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||s.getAttribute("title")!==(b.title==null?null:b.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(w=s.getAttribute("src"),(w!==(b.src==null?null:b.src)||s.getAttribute("type")!==(b.type==null?null:b.type)||s.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&w&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var w=b.name==null?null:""+b.name;if(b.type==="hidden"&&s.getAttribute("name")===w)return s}else return s;if(s=Uo(s.nextSibling),s===null)break}return null}function oX(s,l,f){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!f||(s=Uo(s.nextSibling),s===null))return null;return s}function R2(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Uo(s.nextSibling),s===null))return null;return s}function G_(s){return s.data==="$?"||s.data==="$~"}function Y_(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function sX(s,l){var f=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||f.readyState!=="loading")l();else{var m=function(){l(),f.removeEventListener("DOMContentLoaded",m)};f.addEventListener("DOMContentLoaded",m),s._reactRetry=m}}function Uo(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 Q_=null;function A2(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var f=s.data;if(f==="/$"||f==="/&"){if(l===0)return Uo(s.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}s=s.nextSibling}return null}function O2(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var f=s.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(l===0)return s;l--}else f!=="/$"&&f!=="/&"||l++}s=s.previousSibling}return null}function D2(s,l,f){switch(l=rv(f),s){case"html":if(s=l.documentElement,!s)throw Error(r(452));return s;case"head":if(s=l.head,!s)throw Error(r(453));return s;case"body":if(s=l.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Xp(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);Hc(s)}var qo=new Map,P2=new Set;function iv(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Ha=K.d;K.d={f:aX,r:lX,D:cX,C:uX,L:dX,m:fX,X:pX,S:hX,M:mX};function aX(){var s=Ha.f(),l=Yb();return s||l}function lX(s){var l=Do(s);l!==null&&l.tag===5&&l.type==="form"?XP(l):Ha.r(s)}var lf=typeof document>"u"?null:document;function N2(s,l,f){var m=lf;if(m&&typeof l=="string"&&l){var b=No(l);b='link[rel="'+s+'"][href="'+b+'"]',typeof f=="string"&&(b+='[crossorigin="'+f+'"]'),P2.has(b)||(P2.add(b),s={rel:s,crossOrigin:f,href:l},m.querySelector(b)===null&&(l=m.createElement("link"),ii(l,"link",s),Kr(l),m.head.appendChild(l)))}}function cX(s){Ha.D(s),N2("dns-prefetch",s,null)}function uX(s,l){Ha.C(s,l),N2("preconnect",s,l)}function dX(s,l,f){Ha.L(s,l,f);var m=lf;if(m&&s&&l){var b='link[rel="preload"][as="'+No(l)+'"]';l==="image"&&f&&f.imageSrcSet?(b+='[imagesrcset="'+No(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(b+='[imagesizes="'+No(f.imageSizes)+'"]')):b+='[href="'+No(s)+'"]';var w=b;switch(l){case"style":w=cf(s);break;case"script":w=uf(s)}qo.has(w)||(s=p({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:s,as:l},f),qo.set(w,s),m.querySelector(b)!==null||l==="style"&&m.querySelector(Jp(w))||l==="script"&&m.querySelector(Zp(w))||(l=m.createElement("link"),ii(l,"link",s),Kr(l),m.head.appendChild(l)))}}function fX(s,l){Ha.m(s,l);var f=lf;if(f&&s){var m=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+No(m)+'"][href="'+No(s)+'"]',w=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=uf(s)}if(!qo.has(w)&&(s=p({rel:"modulepreload",href:s},l),qo.set(w,s),f.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Zp(w)))return}m=f.createElement("link"),ii(m,"link",s),Kr(m),f.head.appendChild(m)}}}function hX(s,l,f){Ha.S(s,l,f);var m=lf;if(m&&s){var b=Kc(m).hoistableStyles,w=cf(s);l=l||"default";var R=b.get(w);if(!R){var H={loading:0,preload:null};if(R=m.querySelector(Jp(w)))H.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":l},f),(f=qo.get(w))&&X_(s,f);var X=R=m.createElement("link");Kr(X),ii(X,"link",s),X._p=new Promise(function(le,ge){X.onload=le,X.onerror=ge}),X.addEventListener("load",function(){H.loading|=1}),X.addEventListener("error",function(){H.loading|=2}),H.loading|=4,ov(R,l,m)}R={type:"stylesheet",instance:R,count:1,state:H},b.set(w,R)}}}function pX(s,l){Ha.X(s,l);var f=lf;if(f&&s){var m=Kc(f).hoistableScripts,b=uf(s),w=m.get(b);w||(w=f.querySelector(Zp(b)),w||(s=p({src:s,async:!0},l),(l=qo.get(b))&&J_(s,l),w=f.createElement("script"),Kr(w),ii(w,"link",s),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(b,w))}}function mX(s,l){Ha.M(s,l);var f=lf;if(f&&s){var m=Kc(f).hoistableScripts,b=uf(s),w=m.get(b);w||(w=f.querySelector(Zp(b)),w||(s=p({src:s,async:!0,type:"module"},l),(l=qo.get(b))&&J_(s,l),w=f.createElement("script"),Kr(w),ii(w,"link",s),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(b,w))}}function L2(s,l,f,m){var b=(b=Z.current)?iv(b):null;if(!b)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(l=cf(f.href),f=Kc(b).hoistableStyles,m=f.get(l),m||(m={type:"style",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){s=cf(f.href);var w=Kc(b).hoistableStyles,R=w.get(s);if(R||(b=b.ownerDocument||b,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(s,R),(w=b.querySelector(Jp(s)))&&!w._p&&(R.instance=w,R.state.loading=5),qo.has(s)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},qo.set(s,f),w||gX(b,s,f,R.state))),l&&m===null)throw Error(r(528,""));return R}if(l&&m!==null)throw Error(r(529,""));return null;case"script":return l=f.async,f=f.src,typeof f=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=uf(f),f=Kc(b).hoistableScripts,m=f.get(l),m||(m={type:"script",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function cf(s){return'href="'+No(s)+'"'}function Jp(s){return'link[rel="stylesheet"]['+s+"]"}function $2(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function gX(s,l,f,m){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=s.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),ii(l,"link",f),Kr(l),s.head.appendChild(l))}function uf(s){return'[src="'+No(s)+'"]'}function Zp(s){return"script[async]"+s}function j2(s,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var m=s.querySelector('style[data-href~="'+No(f.href)+'"]');if(m)return l.instance=m,Kr(m),m;var b=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return m=(s.ownerDocument||s).createElement("style"),Kr(m),ii(m,"style",b),ov(m,f.precedence,s),l.instance=m;case"stylesheet":b=cf(f.href);var w=s.querySelector(Jp(b));if(w)return l.state.loading|=4,l.instance=w,Kr(w),w;m=$2(f),(b=qo.get(b))&&X_(m,b),w=(s.ownerDocument||s).createElement("link"),Kr(w);var R=w;return R._p=new Promise(function(H,X){R.onload=H,R.onerror=X}),ii(w,"link",m),l.state.loading|=4,ov(w,f.precedence,s),l.instance=w;case"script":return w=uf(f.src),(b=s.querySelector(Zp(w)))?(l.instance=b,Kr(b),b):(m=f,(b=qo.get(w))&&(m=p({},f),J_(m,b)),s=s.ownerDocument||s,b=s.createElement("script"),Kr(b),ii(b,"link",m),s.head.appendChild(b),l.instance=b);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,ov(m,f.precedence,s));return l.instance}function ov(s,l,f){for(var m=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,w=b,R=0;R<m.length;R++){var H=m[R];if(H.dataset.precedence===l)w=H;else if(w!==b)break}w?w.parentNode.insertBefore(s,w.nextSibling):(l=f.nodeType===9?f.head:f,l.insertBefore(s,l.firstChild))}function X_(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function J_(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var sv=null;function F2(s,l,f){if(sv===null){var m=new Map,b=sv=new Map;b.set(f,m)}else b=sv,m=b.get(f),m||(m=new Map,b.set(f,m));if(m.has(s))return m;for(m.set(s,null),f=f.getElementsByTagName(s),b=0;b<f.length;b++){var w=f[b];if(!(w[Tl]||w[cn]||s==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var R=w.getAttribute(l)||"";R=s+R;var H=m.get(R);H?H.push(w):m.set(R,[w])}}return m}function z2(s,l,f){s=s.ownerDocument||s,s.head.insertBefore(f,l==="title"?s.querySelector("head > title"):null)}function yX(s,l,f){if(f===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 B2(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function bX(s,l,f,m){if(f.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var b=cf(m.href),w=l.querySelector(Jp(b));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=av.bind(s),l.then(s,s)),f.state.loading|=4,f.instance=w,Kr(w);return}w=l.ownerDocument||l,m=$2(m),(b=qo.get(b))&&X_(m,b),w=w.createElement("link"),Kr(w);var R=w;R._p=new Promise(function(H,X){R.onload=H,R.onerror=X}),ii(w,"link",m),f.instance=w}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(f,l),(l=f.state.preload)&&(f.state.loading&3)===0&&(s.count++,f=av.bind(s),l.addEventListener("load",f),l.addEventListener("error",f))}}var Z_=0;function vX(s,l){return s.stylesheets&&s.count===0&&cv(s,s.stylesheets),0<s.count||0<s.imgCount?function(f){var m=setTimeout(function(){if(s.stylesheets&&cv(s,s.stylesheets),s.unsuspend){var w=s.unsuspend;s.unsuspend=null,w()}},6e4+l);0<s.imgBytes&&Z_===0&&(Z_=62500*ZQ());var b=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&cv(s,s.stylesheets),s.unsuspend)){var w=s.unsuspend;s.unsuspend=null,w()}},(s.imgBytes>Z_?50:800)+l);return s.unsuspend=f,function(){s.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function av(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cv(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var lv=null;function cv(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,lv=new Map,l.forEach(SX,s),lv=null,av.call(s))}function SX(s,l){if(!(l.state.loading&4)){var f=lv.get(s);if(f)var m=f.get(null);else{f=new Map,lv.set(s,f);for(var b=s.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<b.length;w++){var R=b[w];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(f.set(R.dataset.precedence,R),m=R)}m&&f.set(null,m)}b=l.instance,R=b.getAttribute("data-precedence"),w=f.get(R)||m,w===m&&f.set(null,b),f.set(R,b),this.count++,m=av.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),w?w.parentNode.insertBefore(b,w.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(b,s.firstChild)),l.state.loading|=4}}var em={$$typeof:E,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function xX(s,l,f,m,b,w,R,H,X){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=Lt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lt(0),this.hiddenUpdates=Lt(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=w,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function U2(s,l,f,m,b,w,R,H,X,le,ge,ve){return s=new xX(s,l,f,R,X,le,ge,ve,H),l=1,w===!0&&(l|=24),w=lo(3,null,null,l),s.current=w,w.stateNode=s,l=Ok(),l.refCount++,s.pooledCache=l,l.refCount++,w.memoizedState={element:m,isDehydrated:f,cache:l},Lk(w),s}function q2(s){return s?(s=zd,s):zd}function V2(s,l,f,m,b,w){b=q2(b),m.context===null?m.context=b:m.pendingContext=b,m=Dl(l),m.payload={element:f},w=w===void 0?null:w,w!==null&&(m.callback=w),f=Pl(s,m,l),f!==null&&(Qi(f,s,l),Op(f,s,l))}function H2(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var f=s.retryLane;s.retryLane=f!==0&&f<l?f:l}}function e1(s,l){H2(s,l),(s=s.alternate)&&H2(s,l)}function K2(s){if(s.tag===13||s.tag===31){var l=Xc(s,67108864);l!==null&&Qi(l,s,67108864),e1(s,67108864)}}function W2(s){if(s.tag===13||s.tag===31){var l=po();l=Ct(l);var f=Xc(s,l);f!==null&&Qi(f,s,l),e1(s,l)}}var uv=!0;function wX(s,l,f,m){var b=j.T;j.T=null;var w=K.p;try{K.p=2,t1(s,l,f,m)}finally{K.p=w,j.T=b}}function kX(s,l,f,m){var b=j.T;j.T=null;var w=K.p;try{K.p=8,t1(s,l,f,m)}finally{K.p=w,j.T=b}}function t1(s,l,f,m){if(uv){var b=n1(m);if(b===null)B_(s,l,m,dv,f),Y2(s,m);else if(EX(b,s,l,f,m))m.stopPropagation();else if(Y2(s,m),l&4&&-1<_X.indexOf(s)){for(;b!==null;){var w=Do(b);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var R=Re(w.pendingLanes);if(R!==0){var H=w;for(H.pendingLanes|=2,H.entangledLanes|=2;R;){var X=1<<31-tt(R);H.entanglements[1]|=X,R&=~X}Ws(w),(Zt&6)===0&&(Wb=pt()+500,Gp(0))}}break;case 31:case 13:H=Xc(w,2),H!==null&&Qi(H,w,2),Yb(),e1(w,2)}if(w=n1(m),w===null&&B_(s,l,m,dv,f),w===b)break;b=w}b!==null&&m.stopPropagation()}else B_(s,l,m,null,f)}}function n1(s){return s=ik(s),r1(s)}var dv=null;function r1(s){if(dv=null,s=Ta(s),s!==null){var l=o(s);if(l===null)s=null;else{var f=l.tag;if(f===13){if(s=a(l),s!==null)return s;s=null}else if(f===31){if(s=c(l),s!==null)return s;s=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return dv=s,null}function G2(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(Zn()){case ue:return 2;case we:return 8;case Ne:case We:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var i1=!1,Hl=null,Kl=null,Wl=null,tm=new Map,nm=new Map,Gl=[],_X="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 Y2(s,l){switch(s){case"focusin":case"focusout":Hl=null;break;case"dragenter":case"dragleave":Kl=null;break;case"mouseover":case"mouseout":Wl=null;break;case"pointerover":case"pointerout":tm.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":nm.delete(l.pointerId)}}function rm(s,l,f,m,b,w){return s===null||s.nativeEvent!==w?(s={blockedOn:l,domEventName:f,eventSystemFlags:m,nativeEvent:w,targetContainers:[b]},l!==null&&(l=Do(l),l!==null&&K2(l)),s):(s.eventSystemFlags|=m,l=s.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),s)}function EX(s,l,f,m,b){switch(l){case"focusin":return Hl=rm(Hl,s,l,f,m,b),!0;case"dragenter":return Kl=rm(Kl,s,l,f,m,b),!0;case"mouseover":return Wl=rm(Wl,s,l,f,m,b),!0;case"pointerover":var w=b.pointerId;return tm.set(w,rm(tm.get(w)||null,s,l,f,m,b)),!0;case"gotpointercapture":return w=b.pointerId,nm.set(w,rm(nm.get(w)||null,s,l,f,m,b)),!0}return!1}function Q2(s){var l=Ta(s.target);if(l!==null){var f=o(l);if(f!==null){if(l=f.tag,l===13){if(l=a(f),l!==null){s.blockedOn=l,Ea(s.priority,function(){W2(f)});return}}else if(l===31){if(l=c(f),l!==null){s.blockedOn=l,Ea(s.priority,function(){W2(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){s.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}s.blockedOn=null}function fv(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var f=n1(s.nativeEvent);if(f===null){f=s.nativeEvent;var m=new f.constructor(f.type,f);rk=m,f.target.dispatchEvent(m),rk=null}else return l=Do(f),l!==null&&K2(l),s.blockedOn=f,!1;l.shift()}return!0}function X2(s,l,f){fv(s)&&f.delete(l)}function TX(){i1=!1,Hl!==null&&fv(Hl)&&(Hl=null),Kl!==null&&fv(Kl)&&(Kl=null),Wl!==null&&fv(Wl)&&(Wl=null),tm.forEach(X2),nm.forEach(X2)}function hv(s,l){s.blockedOn===l&&(s.blockedOn=null,i1||(i1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,TX)))}var pv=null;function J2(s){pv!==s&&(pv=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){pv===s&&(pv=null);for(var l=0;l<s.length;l+=3){var f=s[l],m=s[l+1],b=s[l+2];if(typeof m!="function"){if(r1(m||f)===null)continue;break}var w=Do(f);w!==null&&(s.splice(l,3),l-=3,n_(w,{pending:!0,data:b,method:f.method,action:m},m,b))}}))}function df(s){function l(X){return hv(X,s)}Hl!==null&&hv(Hl,s),Kl!==null&&hv(Kl,s),Wl!==null&&hv(Wl,s),tm.forEach(l),nm.forEach(l);for(var f=0;f<Gl.length;f++){var m=Gl[f];m.blockedOn===s&&(m.blockedOn=null)}for(;0<Gl.length&&(f=Gl[0],f.blockedOn===null);)Q2(f),f.blockedOn===null&&Gl.shift();if(f=(s.ownerDocument||s).$$reactFormReplay,f!=null)for(m=0;m<f.length;m+=3){var b=f[m],w=f[m+1],R=b[wn]||null;if(typeof w=="function")R||J2(f);else if(R){var H=null;if(w&&w.hasAttribute("formAction")){if(b=w,R=w[wn]||null)H=R.formAction;else if(r1(b)!==null)continue}else H=R.action;typeof H=="function"?f[m+1]=H:(f.splice(m,3),m-=3),J2(f)}}}function Z2(){function s(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(R){return b=R})},focusReset:"manual",scroll:"manual"})}function l(){b!==null&&(b(),b=null),m||setTimeout(f,20)}function f(){if(!m&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(f,100),function(){m=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function o1(s){this._internalRoot=s}mv.prototype.render=o1.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(r(409));var f=l.current,m=po();V2(f,m,s,l,null,null)},mv.prototype.unmount=o1.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;V2(s.current,2,null,s,null,null),Yb(),l[Us]=null}};function mv(s){this._internalRoot=s}mv.prototype.unstable_scheduleHydration=function(s){if(s){var l=pn();s={blockedOn:null,target:s,priority:l};for(var f=0;f<Gl.length&&l!==0&&l<Gl[f].priority;f++);Gl.splice(f,0,s),f===0&&Q2(s)}};var eL=t.version;if(eL!=="19.2.0")throw Error(r(527,eL,"19.2.0"));K.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=d(l),s=s!==null?h(s):null,s=s===null?null:s.stateNode,s};var CX={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var gv=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!gv.isDisabled&&gv.supportsFiber)try{gt=gv.inject(CX),mt=gv}catch{}}return om.createRoot=function(s,l){if(!i(s))throw Error(r(299));var f=!1,m="",b=aN,w=lN,R=cN;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError)),l=U2(s,1,!1,null,null,f,m,null,b,w,R,Z2),s[Us]=l.current,z_(s),new o1(l)},om.hydrateRoot=function(s,l,f){if(!i(s))throw Error(r(299));var m=!1,b="",w=aN,R=lN,H=cN,X=null;return f!=null&&(f.unstable_strictMode===!0&&(m=!0),f.identifierPrefix!==void 0&&(b=f.identifierPrefix),f.onUncaughtError!==void 0&&(w=f.onUncaughtError),f.onCaughtError!==void 0&&(R=f.onCaughtError),f.onRecoverableError!==void 0&&(H=f.onRecoverableError),f.formState!==void 0&&(X=f.formState)),l=U2(s,1,!0,l,f??null,m,b,X,w,R,H,Z2),l.context=q2(null),f=l.current,m=po(),m=Ct(m),b=Dl(m),b.callback=null,Pl(f,b,m),f=m,l.current.lanes=f,Rt(l,f),Ws(l),s[Us]=l.current,z_(s),new mv(l)},om.version="19.2.0",om}var uL;function $X(){if(uL)return a1.exports;uL=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),a1.exports=LX(),a1.exports}var jX=$X(),A=ny();const bn=px(A),zI=MX({__proto__:null,default:bn},[A]),FX=e=>typeof e=="function",W=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(i){return t(i,n)}};case 3:return function(n,r,i){return arguments.length>=3?t(n,r,i):function(o){return t(o,n,r)}};case 4:return function(n,r,i,o){return arguments.length>=4?t(n,r,i,o):function(a){return t(a,n,r,i)}};case 5:return function(n,r,i,o,a){return arguments.length>=5?t(n,r,i,o,a):function(c){return t(c,n,r,i,o)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(r){return t(r,...n)}}}},Mt=e=>e,mx=e=>()=>e,sT=mx(!0),Bf=mx(!1),J3=mx(void 0),VS=J3;function Y(e,t,n,r,i,o,a,c,u){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return a(o(i(r(n(t(e))))));case 8:return c(a(o(i(r(n(t(e)))))));case 9:return u(c(a(o(i(r(n(t(e))))))));default:{let d=arguments[0];for(let h=1;h<arguments.length;h++)d=arguments[h](d);return d}}}const BI=e=>(t,n)=>t===n||e(t,n),zX=W(2,(e,t)=>BI((n,r)=>e(t(n),t(r)))),BX=e=>BI((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),dL="effect/GlobalValue";let sm;const Wt=(e,t)=>(sm||(globalThis[dL]??=new Map,sm=globalThis[dL]),sm.has(e)||sm.set(e,t()),sm.get(e)),Ps=e=>typeof e=="string",Uu=e=>typeof e=="number",gx=e=>typeof e=="boolean",yx=e=>typeof e=="bigint",aT=e=>typeof e=="symbol",ry=FX,UX=e=>e===void 0,qX=e=>!1,UI=e=>typeof e=="object"&&e!==null,xl=e=>UI(e)||ry(e),st=W(2,(e,t)=>xl(e)&&t in e),Z3=W(2,(e,t)=>st(e,"_tag")&&e._tag===t),ff=e=>e==null,VX=e=>e!=null,HX=e=>e instanceof Date,eU=e=>typeof e=="string"||st(e,Symbol.iterator),KX=e=>UI(e)&&!Array.isArray(e),WX=e=>st(e,"then")&&ry(e.then),bx=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let tU=class nU{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new nU(this.self)}};const GX=335903614,YX=4150755663,QX=1481765933,XX=1284865837,JX=9007199254740992,ZX=134217728;class eJ{_state;constructor(t,n,r,i){return ff(n)&&ff(t)?(n=Math.random()*4294967295>>>0,t=0):ff(n)&&(n=t,t=0),ff(i)&&ff(r)?(i=this._state?this._state[3]:YX,r=this._state?this._state[2]:GX):ff(i)&&(i=r,r=0),this._state=new Int32Array([0,0,r>>>0,((i||0)|1)>>>0]),this._next(),fL(this._state,this._state[0],this._state[1],t>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(t*ZX+n)/JX}_next(){const t=this._state[0]>>>0,n=this._state[1]>>>0;tJ(this._state,t,n,QX,XX),fL(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,i=(n>>>18|t<<14)>>>0;r=(r^t)>>>0,i=(i^n)>>>0;const o=(i>>>27|r<<5)>>>0,a=t>>>27,c=(-a>>>0&31)>>>0;return(o>>>a|o<<c)>>>0}}function tJ(e,t,n,r,i){let o=(n>>>16)*(i&65535)>>>0,a=(n&65535)*(i>>>16)>>>0,c=(n&65535)*(i&65535)>>>0,u=(n>>>16)*(i>>>16)+((a>>>16)+(o>>>16))>>>0;a=a<<16>>>0,c=c+a>>>0,c>>>0<a>>>0&&(u=u+1>>>0),o=o<<16>>>0,c=c+o>>>0,c>>>0<o>>>0&&(u=u+1>>>0),u=u+Math.imul(n,r)>>>0,u=u+Math.imul(t,i)>>>0,e[0]=u,e[1]=c}function fL(e,t,n,r,i){let o=t+r>>>0;const a=n+i>>>0;a>>>0<n>>>0&&(o=o+1|0),e[0]=o,e[1]=a}const lT=Symbol.for("effect/Utils/YieldWrap");class iy{#e;constructor(t){this.#e=t}[lT](){return this.#e}}function nJ(e){if(typeof e=="object"&&e!==null&&lT in e)return e[lT]();throw new Error(bx("yieldWrapGet"))}const Vo=Wt("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),rU={effect_internal_function:e=>e()},rJ={effect_internal_function:e=>{try{return e()}finally{}}},iJ=rU.effect_internal_function(()=>new Error().stack)?.includes("effect_internal_function")===!0,Di=iJ?rU.effect_internal_function:rJ.effect_internal_function,f1=Wt(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),_t=Symbol.for("effect/Hash"),Ge=e=>{if(Vo.enabled===!0)return 0;switch(typeof e){case"number":return VI(e);case"bigint":return ir(e.toString(10));case"boolean":return ir(String(e));case"symbol":return ir(String(e));case"string":return ir(e);case"undefined":return ir("undefined");case"function":case"object":return e===null?ir("null"):e instanceof Date?Number.isNaN(e.getTime())?ir("Invalid Date"):Ge(e.toISOString()):e instanceof URL?Ge(e.href):oJ(e)?e[_t]():qI(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},qI=e=>(f1.has(e)||f1.set(e,VI(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),f1.get(e)),qt=e=>t=>t*53^e,vx=e=>e&3221225471|e>>>1&1073741824,oJ=e=>st(e,_t),VI=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return vx(t)},ir=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return vx(t)},sJ=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=Y(ir(t[r]),qt(Ge(e[t[r]])));return vx(n)},iU=e=>sJ(e,Object.keys(e)),oy=e=>{let t=6151;for(let n=0;n<e.length;n++)t=Y(t,qt(Ge(e[n])));return vx(t)},Jn=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,_t,{value(){return r},enumerable:!1}),r}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,_t,{value(){return t},enumerable:!1}),t},kt=Symbol.for("effect/Equal");function ht(){return arguments.length===1?e=>HS(e,arguments[0]):HS(arguments[0],arguments[1])}function HS(e,t){if(e===t)return!0;const n=typeof e;if(n!==typeof t)return!1;if(n==="object"||n==="function"){if(e!==null&&t!==null){if(KS(e)&&KS(t))return Ge(e)===Ge(t)&&e[kt](t)?!0:Vo.enabled&&Vo.tester?Vo.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const r=e.getTime(),i=t.getTime();return r===i||Number.isNaN(r)&&Number.isNaN(i)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(Vo.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,i)=>HS(r,t[i]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const r=Object.keys(e),i=Object.keys(t);if(r.length===i.length){for(const o of r)if(!(o in t&&HS(e[o],t[o])))return Vo.tester?Vo.tester(e,t):!1;return!0}}return Vo.tester?Vo.tester(e,t):!1}}return Vo.enabled&&Vo.tester?Vo.tester(e,t):!1}const KS=e=>st(e,kt),HI=()=>ht,Dn=Symbol.for("nodejs.util.inspect.custom"),Hn=e=>{try{if(st(e,"toJSON")&&ry(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Hn)}catch{return{}}return cg(e)},h1="[Circular]";function aJ(e){try{return e.toISOString()}catch{return"Invalid Date"}}function lJ(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function oU(e){return Ps(e)?JSON.stringify(e):String(e)}function Rc(e,t){const n=new WeakSet,r=(a,c)=>{const u=a?.constructor;return u&&u!==Object.prototype.constructor&&u.name?`${u.name}(${c})`:c},i=a=>{try{return Reflect.ownKeys(a)}catch{return["[ownKeys threw]"]}};function o(a,c=0){if(Array.isArray(a))return n.has(a)?h1:(n.add(a),`[${a.map(u=>o(u,c)).join(",")}]`);if(HX(a))return aJ(a);if(st(a,"toString")&&ry(a.toString)&&a.toString!==Object.prototype.toString&&a.toString!==Array.prototype.toString){const u=lJ(a);return a instanceof Error&&a.cause?`${u} (cause: ${o(a.cause,c)})`:u}if(Ps(a))return JSON.stringify(a);if(Uu(a)||a==null||gx(a)||aT(a))return String(a);if(yx(a))return String(a)+"n";if(a instanceof Set||a instanceof Map)return n.has(a)?h1:(n.add(a),`${a.constructor.name}(${o(Array.from(a),c)})`);if(xl(a)){if(n.has(a))return h1;n.add(a);const u=i(a);{const d=`{${u.map(h=>`${oU(h)}:${o(a[h],c)}`).join(",")}}`;return r(a,d)}}return String(a)}return o(e,0)}const vr=e=>JSON.stringify(e,null,2),ih=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?sU(e,t):String(e)}catch{return String(e)}},sU=(e,t)=>{let n=[];const r=JSON.stringify(e,(i,o)=>typeof o=="object"&&o!==null?n.includes(o)?void 0:n.push(o)&&(Mu.fiberRefs!==void 0&&aU(o)?o[KI](Mu.fiberRefs):o):o,t);return n=void 0,r},KI=Symbol.for("effect/Inspectable/Redactable"),aU=e=>typeof e=="object"&&e!==null&&KI in e,Mu=Wt("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),cJ=(e,t)=>{const n=Mu.fiberRefs;Mu.fiberRefs=e;try{return t()}finally{Mu.fiberRefs=n}},cg=e=>aU(e)&&Mu.fiberRefs!==void 0?e[KI](Mu.fiberRefs):e,He=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,i=t.length;r<i;r++)n=t[r](n);return n}}},Bm="Async",Sx="Commit",Qr="Failure",cS="OnFailure",WS="OnSuccess",GS="OnSuccessAndFailure",Xr="Success",lU="Sync",uJ="Tag",Nh="UpdateRuntimeFlags",YS="While",Um="Iterator",cU="WithRuntime",uS="Yield",WI="RevertFlags";let dJ="3.19.13";const GI=()=>dJ,fJ=Symbol.for("effect/Effect"),hJ=Symbol.for("effect/Stream"),pJ=Symbol.for("effect/Sink"),mJ=Symbol.for("effect/Channel"),oh={_R:e=>e,_E:e=>e,_A:e=>e,_V:GI()},gJ={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},yJ={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},sy={[fJ]:oh,[hJ]:oh,[pJ]:gJ,[mJ]:yJ,[kt](e){return this===e},[_t](){return Jn(this,qI(this))},[Symbol.iterator](){return new tU(new iy(this))},pipe(){return He(this,arguments)}},YI={[_t](){return Jn(this,iU(this))},[kt](e){const t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!(r in e&&ht(this[r],e[r])))return!1;return!0}},gd={...sy,_op:Sx},bJ={...gd,...YI},vJ=(function(){function e(){}return e.prototype=gd,e})(),uU=Symbol.for("effect/Option"),dU={...sy,[uU]:{_A:e=>e},[Dn](){return this.toJSON()},toString(){return vr(this.toJSON())}},SJ=Object.assign(Object.create(dU),{_tag:"Some",_op:"Some",[kt](e){return fU(e)&&pU(e)&&ht(this.value,e.value)},[_t](){return Jn(this,qt(Ge(this._tag))(Ge(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:Hn(this.value)}}}),xJ=Ge("None"),wJ=Object.assign(Object.create(dU),{_tag:"None",_op:"None",[kt](e){return fU(e)&&hU(e)},[_t](){return xJ},toJSON(){return{_id:"Option",_tag:this._tag}}}),fU=e=>st(e,uU),hU=e=>e._tag==="None",pU=e=>e._tag==="Some",mU=Object.create(wJ),cT=e=>{const t=Object.create(SJ);return t.value=e,t},gU=Symbol.for("effect/Either"),yU={...sy,[gU]:{_R:e=>e},[Dn](){return this.toJSON()},toString(){return vr(this.toJSON())}},kJ=Object.assign(Object.create(yU),{_tag:"Right",_op:"Right",[kt](e){return QI(e)&&vU(e)&&ht(this.right,e.right)},[_t](){return qt(Ge(this._tag))(Ge(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:Hn(this.right)}}}),_J=Object.assign(Object.create(yU),{_tag:"Left",_op:"Left",[kt](e){return QI(e)&&bU(e)&&ht(this.left,e.left)},[_t](){return qt(Ge(this._tag))(Ge(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:Hn(this.left)}}}),QI=e=>st(e,gU),bU=e=>e._tag==="Left",vU=e=>e._tag==="Right",EJ=e=>{const t=Object.create(_J);return t.left=e,t},TJ=e=>{const t=Object.create(kJ);return t.right=e,t},vt=TJ,ct=EJ,CJ=QI,si=bU,ta=vU,IJ=W(2,(e,t)=>si(e)?ct(t(e.left)):vt(e.right)),MJ=W(2,(e,t)=>ta(e)?vt(t(e.right)):ct(e.left)),$i=W(2,(e,{onLeft:t,onRight:n})=>si(e)?t(e.left):n(e.right)),RJ=$i({onLeft:Mt,onRight:Mt}),SU=W(2,(e,t)=>{if(ta(e))return e.right;throw t(e.left)}),AJ=SU(()=>new Error("getOrThrow called on a Left")),xU=e=>e.length>0,wU=e=>(t,n)=>t===n?0:e(t,n),OJ=wU((e,t)=>e<t?-1:1),kU=W(2,(e,t)=>wU((n,r)=>e(t(n),t(r)))),DJ=e=>W(2,(t,n)=>e(t,n)===1),Ae=()=>mU,Oe=cT,vn=hU,Pe=pU,Xn=W(2,(e,{onNone:t,onSome:n})=>vn(e)?t():n(e.value)),On=W(2,(e,t)=>vn(e)?t():e.value),lc=W(2,(e,t)=>vn(e)?t():e),PJ=W(2,(e,t)=>vn(e)?Oe(t()):e),ay=e=>e==null?Ae():Oe(e),Pi=On(J3),_U=e=>(...t)=>{try{return Oe(e(...t))}catch{return Ae()}},Ru=W(2,(e,t)=>vn(e)?Ae():Oe(t(e.value))),xx=W(2,(e,t)=>vn(e)?Ae():t(e.value)),NJ=W(2,(e,t)=>vn(e)?Ae():ay(t(e.value))),LJ=e=>W(2,(t,n)=>vn(t)?!1:e(t.value,n)),$J=HI(),jJ=LJ($J),FJ=W(2,(e,t)=>vn(e)?!1:t(e.value)),hL=e=>(t,n)=>vn(t)?n:vn(n)?t:Oe(e(t.value,n.value)),zJ=(...e)=>e,wx=e=>new Array(e),BJ=W(2,(e,t)=>{const n=Math.max(1,Math.floor(e)),r=new Array(n);for(let i=0;i<n;i++)r[i]=t(i);return r}),zn=e=>Array.isArray(e)?e:Array.from(e),XI=e=>Array.isArray(e)?e:[e],UJ=W(2,(e,{onEmpty:t,onNonEmpty:n})=>Sr(e)?n(Bi(e),qu(e)):t()),QS=W(2,(e,t)=>[t,...e]),qJ=W(2,(e,t)=>[...e,t]),EU=W(2,(e,t)=>zn(e).concat(zn(t))),VJ=Array.isArray,HJ=e=>e.length===0,KJ=HJ,dS=xU,Sr=xU,TU=(e,t)=>e<0||e>=t.length,WJ=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),GJ=W(2,(e,t)=>{const n=Math.floor(t);return TU(n,e)?Ae():Oe(e[n])}),CU=W(2,(e,t)=>{const n=Math.floor(t);if(TU(n,e))throw new Error(`Index ${n} out of bounds`);return e[n]}),qm=GJ(0),Bi=CU(0),YJ=e=>Sr(e)?Oe(IU(e)):Ae(),IU=e=>e[e.length-1],qu=e=>e.slice(1),QJ=(e,t)=>{let n=0;for(const r of e){if(!t(r,n))break;n++}return n},XJ=W(2,(e,t)=>MU(e,QJ(e,t))),JJ=W(2,(e,t)=>{const n=zn(e);return n.slice(WJ(t,n),n.length)}),pL=e=>Array.from(e).reverse(),ug=W(2,(e,t)=>{const n=Array.from(e);return n.sort(t),n}),mL=W(2,(e,t)=>ZJ(e,t,zJ)),ZJ=W(3,(e,t,n)=>{const r=zn(e),i=zn(t);if(Sr(r)&&Sr(i)){const o=[n(Bi(r),Bi(i))],a=Math.min(r.length,i.length);for(let c=1;c<a;c++)o[c]=n(r[c],i[c]);return o}return[]}),eZ=HI(),MU=W(2,(e,t)=>{const n=Array.from(e),r=Math.floor(t);return Sr(n)?r>=1?tZ(n,r):[[],n]:[n,[]]}),tZ=W(2,(e,t)=>{const n=Math.max(1,Math.floor(t));return n>=e.length?[Tm(e),[]]:[QS(e.slice(1,n),Bi(e)),e.slice(n)]}),Tm=e=>e.slice(),nZ=W(3,(e,t,n)=>{const r=zn(e),i=zn(t);return Sr(r)?Sr(i)?OU(n)(EU(r,i)):r:i}),fS=W(2,(e,t)=>nZ(e,t,eZ)),Vu=()=>[],ws=e=>[e],Au=W(2,(e,t)=>e.map(t)),RU=W(2,(e,t)=>{if(KJ(e))return[];const n=[];for(let r=0;r<e.length;r++){const i=t(e[r],r);for(let o=0;o<i.length;o++)n.push(i[o])}return n}),rZ=RU(Mt),AU=W(2,(e,t)=>{const n=zn(e),r=[];for(let i=0;i<n.length;i++){const o=t(n[i],i);Pe(o)&&r.push(o.value)}return r}),iZ=W(2,(e,t)=>{const n=zn(e),r=[];for(let i=0;i<n.length;i++)t(n[i],i)&&r.push(n[i]);return r}),JI=W(3,(e,t,n)=>zn(e).reduce((r,i,o)=>n(r,i,o),t)),gL=(e,t)=>{const n=[];let r=e,i;for(;Pe(i=t(r));){const[o,a]=i.value;n.push(o),r=a}return n},ZI=BX,OU=W(2,(e,t)=>{const n=zn(e);if(Sr(n)){const r=[Bi(n)],i=qu(n);for(const o of i)r.every(a=>!t(o,a))&&r.push(o);return r}return[]}),oZ=e=>OU(e,HI()),Lh=W(2,(e,t)=>zn(e).join(t)),DU=(e,t)=>{switch(t._tag){case"StringKeyword":case"TemplateLiteral":return Object.keys(e);case"SymbolKeyword":return Object.getOwnPropertySymbols(e);case"Refinement":return DU(e,t.from)}},PU=e=>{let t=!1,n;return()=>(t||(n=e(),t=!0),n)},NU=e=>Array.isArray(e),sZ=e=>!Array.isArray(e),yL=e=>`[${oU(e)}]`,aZ=e=>NU(e)?e.map(yL).join(""):yL(e),yd=(e,t,n,r)=>{let i=e;return t!==void 0&&(i+=`
10
+ details: ${t}`),r&&(i+=`
11
+ schema (${r._tag}): ${r}`),i},lZ=e=>yd("Unsupported key schema",void 0,void 0,e),cZ=e=>yd("Unsupported literal",`literal value: ${Rc(e)}`),bL=e=>yd("Duplicate index signature",`${e} index signature`),uZ=yd("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),dZ=yd("Invalid element","A required element cannot follow an optional element. ts(1257)"),vL=e=>yd("Duplicate property signature transformation",`Duplicate key ${Rc(e)}`),fZ=e=>yd("Duplicate property signature",`Duplicate key ${Rc(e)}`),hZ=Symbol.for("effect/SchemaId/GreaterThan"),pZ=Symbol.for("effect/SchemaId/Int"),sh=OJ,mZ=e=>{const t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)},XS=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),gZ=Symbol.for("effect/annotation/TypeConstructor"),yZ=Symbol.for("effect/annotation/Brand"),bZ=Symbol.for("effect/annotation/SchemaId"),LU=Symbol.for("effect/annotation/Message"),eM=Symbol.for("effect/annotation/MissingMessage"),tM=Symbol.for("effect/annotation/Identifier"),Sa=Symbol.for("effect/annotation/Title"),uT=Symbol.for("effect/annotation/AutoTitle"),ly=Symbol.for("effect/annotation/Description"),$U=Symbol.for("effect/annotation/Examples"),jU=Symbol.for("effect/annotation/Default"),FU=Symbol.for("effect/annotation/JSONSchema"),zU=Symbol.for("effect/annotation/Arbitrary"),BU=Symbol.for("effect/annotation/Pretty"),UU=Symbol.for("effect/annotation/Equivalence"),vZ=Symbol.for("effect/annotation/Documentation"),qU=Symbol.for("effect/annotation/Concurrency"),VU=Symbol.for("effect/annotation/Batching"),HU=Symbol.for("effect/annotation/ParseIssueTitle"),KU=Symbol.for("effect/annotation/ParseOptions"),WU=Symbol.for("effect/annotation/DecodingFallback"),GU=Symbol.for("effect/annotation/Surrogate"),SZ=Symbol.for("effect/annotation/StableFilter"),qi=W(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?Oe(e.annotations[t]):Ae()),xZ=qi(yZ),wZ=qi(LU),kZ=qi(eM),YU=qi(Sa),QU=qi(uT),kx=qi(tM),XU=qi(ly),_Z=qi(qU),EZ=qi(VU),TZ=qi(HU),CZ=qi(KU),IZ=qi(WU),JU=qi(GU),MZ=qi(SZ),RZ=e=>FJ(MZ(e),t=>t===!0),ZU=Symbol.for("effect/annotation/JSONIdentifier"),AZ=qi(ZU),OZ=e=>lc(AZ(e),()=>kx(e));class eq{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(t,n,r,i={}){this.typeParameters=t,this.decodeUnknown=n,this.encodeUnknown=r,this.annotations=i}toString(){return On(pa(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(t=>t.toJSON()),annotations:Dr(this.annotations)}}}const wl=e=>t=>t._tag===e;let JS=class{literal;annotations;_tag="Literal";constructor(t,n={}){this.literal=t,this.annotations=n}toString(){return On(pa(this),()=>Rc(this.literal))}toJSON(){return{_tag:this._tag,literal:yx(this.literal)?String(this.literal):this.literal,annotations:Dr(this.annotations)}}};const SL=wl("Literal"),DZ=new JS(null);class PZ{symbol;annotations;_tag="UniqueSymbol";constructor(t,n={}){this.symbol=t,this.annotations=n}toString(){return On(pa(this),()=>Rc(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:Dr(this.annotations)}}}class NZ{annotations;_tag="UndefinedKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const dT=new NZ({[Sa]:"undefined"});class LZ{annotations;_tag="VoidKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const $Z=new LZ({[Sa]:"void"});class jZ{annotations;_tag="NeverKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const nM=new jZ({[Sa]:"never"});class FZ{annotations;_tag="UnknownKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const zZ=new FZ({[Sa]:"unknown"});class BZ{annotations;_tag="AnyKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const tq=new BZ({[Sa]:"any"});class UZ{annotations;_tag="StringKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const qZ=new UZ({[Sa]:"string",[ly]:"a string"}),VZ=wl("StringKeyword");class HZ{annotations;_tag="NumberKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const KZ=new HZ({[Sa]:"number",[ly]:"a number"});class WZ{annotations;_tag="BooleanKeyword";constructor(t={}){this.annotations=t}toString(){return Ac(this)}toJSON(){return{_tag:this._tag,annotations:Dr(this.annotations)}}}const GZ=new WZ({[Sa]:"boolean",[ly]:"a boolean"}),YZ=wl("SymbolKeyword");let _x=class{type;annotations;constructor(t,n={}){this.type=t,this.annotations=n}toJSON(){return{type:this.type.toJSON(),annotations:Dr(this.annotations)}}toString(){return String(this.type)}};class $h extends _x{isOptional;constructor(t,n,r={}){super(t,r),this.isOptional=n}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:Dr(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}const nq=e=>e.map(t=>t.type);class rM{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(t,n,r,i={}){this.elements=t,this.rest=n,this.isReadonly=r,this.annotations=i;let o=!1,a=!1;for(const c of t)if(c.isOptional)o=!0;else if(o){a=!0;break}if(a||o&&n.length>1)throw new Error(dZ)}toString(){return On(pa(this),()=>QZ(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(t=>t.toJSON()),rest:this.rest.map(t=>t.toJSON()),isReadonly:this.isReadonly,annotations:Dr(this.annotations)}}}const QZ=e=>{const t=e.elements.map(String).join(", ");return UJ(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{const i=String(n),o=i.includes(" | ")?`(${i})`:i;if(r.length>0){const a=r.map(String).join(", ");return e.elements.length>0?`readonly [${t}, ...${o}[], ${a}]`:`readonly [...${o}[], ${a}]`}else return e.elements.length>0?`readonly [${t}, ...${o}[]]`:`ReadonlyArray<${i}>`}})},iM=wl("TupleType");class Si extends $h{name;isReadonly;constructor(t,n,r,i,o){super(n,r,o),this.name=t,this.isReadonly=i}toString(){return(this.isReadonly?"readonly ":"")+String(this.name)+(this.isOptional?"?":"")+": "+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:Dr(this.annotations)}}}const rq=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return rq(e.from)}return!1};class Ex{type;isReadonly;parameter;constructor(t,n,r){if(this.type=n,this.isReadonly=r,rq(t))this.parameter=t;else throw new Error(uZ)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class Ou{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(t,n,r={}){this.annotations=r;const i={};for(let a=0;a<t.length;a++){const c=t[a].name;if(Object.prototype.hasOwnProperty.call(i,c))throw new Error(fZ(c));i[c]=null}const o={string:!1,symbol:!1};for(let a=0;a<n.length;a++){const c=uq(n[a].parameter);if(VZ(c)){if(o.string)throw new Error(bL("string"));o.string=!0}else if(YZ(c)){if(o.symbol)throw new Error(bL("symbol"));o.symbol=!0}}this.propertySignatures=t,this.indexSignatures=n}toString(){return On(pa(this),()=>XZ(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(t=>t.toJSON()),indexSignatures:this.indexSignatures.map(t=>t.toJSON()),annotations:Dr(this.annotations)}}}const xL=e=>e.map(String).join("; "),XZ=e=>{if(e.propertySignatures.length>0){const t=e.propertySignatures.map(String).join("; ");return e.indexSignatures.length>0?`{ ${t}; ${xL(e.indexSignatures)} }`:`{ ${t} }`}else return e.indexSignatures.length>0?`{ ${xL(e.indexSignatures)} }`:"{}"},oM=wl("TypeLiteral"),JZ=ug(kU(sh,e=>{switch(e._tag){case"AnyKeyword":return 0;case"UnknownKeyword":return 1;case"ObjectKeyword":return 2;case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":return 3}return 4})),ZZ={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},iq=e=>RU(e,t=>cy(t)?iq(t.types):[t]),eee=e=>{const t=JZ(e),n=[],r={},i=[];for(const o of t)switch(o._tag){case"NeverKeyword":break;case"AnyKeyword":return[tq];case"UnknownKeyword":return[zZ];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{r[o._tag]||(r[o._tag]=o,n.push(o));break}case"Literal":{const a=typeof o.literal;switch(a){case"string":case"number":case"bigint":case"boolean":{const c=ZZ[a];!r[c]&&!i.includes(o.literal)&&(i.push(o.literal),n.push(o));break}case"object":{i.includes(o.literal)||(i.push(o.literal),n.push(o));break}}break}case"UniqueSymbol":{!r.SymbolKeyword&&!i.includes(o.symbol)&&(i.push(o.symbol),n.push(o));break}case"TupleType":{r.ObjectKeyword||n.push(o);break}case"TypeLiteral":{o.propertySignatures.length===0&&o.indexSignatures.length===0?r["{}"]||(r["{}"]=o,n.push(o)):r.ObjectKeyword||n.push(o);break}default:n.push(o)}return n};let Xs=class fT{types;annotations;static make=(t,n)=>sM(t)?new fT(t,n):t.length===1?t[0]:nM;static unify=(t,n)=>fT.make(eee(iq(t)),n);_tag="Union";constructor(t,n={}){this.types=t,this.annotations=n}toString(){return On(pa(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map(t=>t.toJSON()),annotations:Dr(this.annotations)}}};const tee=(e,t)=>e.map(t),sM=e=>e.length>1,cy=wl("Union"),p1=Wt(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class oq{f;annotations;_tag="Suspend";constructor(t,n={}){this.f=t,this.annotations=n,this.f=PU(t)}toString(){return pa(this).pipe(lc(()=>xx(_U(this.f)(),t=>pa(t))),On(()=>"<suspended schema>"))}toJSON(){const t=this.f();let n=p1.get(t);return n||(p1.set(t,{_tag:this._tag}),n={_tag:this._tag,ast:t.toJSON(),annotations:Dr(this.annotations)},p1.set(t,n),n)}}const aM=wl("Suspend");let sq=class{from;filter;annotations;_tag="Refinement";constructor(t,n,r={}){this.from=t,this.filter=n,this.annotations=r}toString(){return kx(this).pipe(On(()=>Xn(dq(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:t=>Hu(this.from)?String(this.from)+" & "+t:t})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:Dr(this.annotations)}}};const Hu=wl("Refinement"),m1={};let nee=class{from;to;transformation;annotations;_tag="Transformation";constructor(t,n,r,i={}){this.from=t,this.to=n,this.transformation=r,this.annotations=i}toString(){return On(pa(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:Dr(this.annotations)}}};const lM=wl("Transformation");let ree=class{from;to;decode;encode;constructor(t,n,r,i){this.from=t,this.to=n,this.decode=r,this.encode=i}};class iee{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(t){this.propertySignatureTransformations=t;const n={},r={};for(const i of t){const o=i.from;if(n[o])throw new Error(vL(o));n[o]=!0;const a=i.to;if(r[a])throw new Error(vL(a));r[a]=!0}}}const cM=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[tM];const i={...r,...t},o=JU(e);return Pe(o)&&(i[GU]=cM(o.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},oee="[\\s\\S]*?",see="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",aq=(e,t)=>{switch(e._tag){case"Literal":return XS(String(e.literal));case"StringKeyword":return oee;case"NumberKeyword":return see;case"TemplateLiteral":return lq(e);case"Union":return e.types.map(n=>aq(n)).join("|")}},aee=(e,t,n,r)=>cy(e)?`(${t})`:t,lq=(e,t,n)=>{let r="";if(e.head!==""){const i=XS(e.head);r+=i}for(const i of e.spans){const o=aq(i.type);if(r+=aee(i.type,o),i.literal!==""){const a=XS(i.literal);r+=a}}return r},lee=e=>new RegExp(`^${lq(e)}$`),wL=(e,t)=>{const n=[],r=[],i=o=>{switch(o._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":r.push(new Ex(o,t,!0));break;case"Literal":if(Ps(o.literal)||Uu(o.literal))n.push(new Si(o.literal,t,!1,!0));else throw new Error(cZ(o.literal));break;case"Enums":{for(const[a,c]of o.enums)n.push(new Si(c,t,!1,!0));break}case"UniqueSymbol":n.push(new Si(o.symbol,t,!1,!0));break;case"Union":o.types.forEach(i);break;default:throw new Error(lZ(o))}};return i(e),{propertySignatures:n,indexSignatures:r}},cq=e=>t=>{let n;for(const r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},cee=cq([$U,jU,FU,zU,BU,UU]),Ai=e=>{switch(e._tag){case"Declaration":{const t=Qo(e.typeParameters,Ai);return t===e.typeParameters?e:new eq(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case"TupleType":{const t=Qo(e.elements,i=>{const o=Ai(i.type);return o===i.type?i:new $h(o,i.isOptional)}),n=nq(e.rest),r=Qo(n,Ai);return t===e.elements&&r===n?e:new rM(t,r.map(i=>new _x(i)),e.isReadonly,e.annotations)}case"TypeLiteral":{const t=Qo(e.propertySignatures,r=>{const i=Ai(r.type);return i===r.type?r:new Si(r.name,i,r.isOptional,r.isReadonly)}),n=Qo(e.indexSignatures,r=>{const i=Ai(r.type);return i===r.type?r:new Ex(r.parameter,i,r.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new Ou(t,n,e.annotations)}case"Union":{const t=Qo(e.types,Ai);return t===e.types?e:Xs.make(t,e.annotations)}case"Suspend":return new oq(()=>Ai(e.f()),e.annotations);case"Refinement":{const t=Ai(e.from);return t===e.from?e:new sq(t,e.filter,e.annotations)}case"Transformation":{const t=cee(e);return Ai(t!==void 0?cM(e.to,t):e.to)}}return e};function Qo(e,t){let n=!1;const r=wx(e.length);for(let i=0;i<e.length;i++){const o=e[i],a=t(o);a!==o&&(n=!0),r[i]=a}return n?r:e}const Gs=(e,t)=>{switch(e._tag){case"Declaration":{const n=Qo(e.typeParameters,r=>Gs(r));return n===e.typeParameters?e:new eq(n,e.decodeUnknown,e.encodeUnknown)}case"TupleType":{const n=Qo(e.elements,o=>{const a=Gs(o.type);return a===o.type?o:new $h(a,o.isOptional)}),r=nq(e.rest),i=Qo(r,o=>Gs(o));return n===e.elements&&i===r?e:new rM(n,i.map(o=>new _x(o)),e.isReadonly)}case"TypeLiteral":{const n=Qo(e.propertySignatures,i=>{const o=Gs(i.type);return o===i.type?i:new Si(i.name,o,i.isOptional,i.isReadonly)}),r=Qo(e.indexSignatures,i=>{const o=Gs(i.type);return o===i.type?i:new Ex(i.parameter,o,i.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new Ou(n,r)}case"Union":{const n=Qo(e.types,r=>Gs(r));return n===e.types?e:Xs.make(n)}case"Suspend":{let n;const r=OZ(e);return Pe(r)&&(n={[ZU]:`${r.value}Encoded`}),new oq(()=>Gs(e.f()),n)}case"Refinement":return Gs(e.from);case"Transformation":return Gs(e.from)}return e},kL=e=>Gs(e),Dr=e=>{const t={};for(const n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},uq=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return e;case"Refinement":return uq(e.from)}},Ac=e=>On(pa(e),()=>e._tag);function uee(e){return Xn(xZ(e),{onNone:()=>"",onSome:t=>t.map(n=>` & Brand<${Rc(n)}>`).join("")})}const dq=e=>YU(e).pipe(lc(()=>XU(e)),lc(()=>QU(e)),Ru(t=>t+uee(e))),pa=e=>lc(kx(e),()=>dq(e)),fq=Symbol.for("effect/Context/Tag"),ZS=Symbol.for("effect/Context/Reference"),dee="effect/STM",fee=Symbol.for(dee),uM={...sy,_op:"Tag",[fee]:oh,[fq]:{_Service:e=>e,_Identifier:e=>e},toString(){return vr(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[Dn](){return this.toJSON()},of(e){return e},context(e){return mq(this,e)}},hee={...uM,[ZS]:ZS},pee=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;const r=Object.create(uM);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},mee=e=>()=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;function r(){}return Object.setPrototypeOf(r,uM),r.key=e,Object.defineProperty(r,"stack",{get(){return n.stack}}),r},gee=()=>(e,t)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function i(){}return Object.setPrototypeOf(i,hee),i.key=e,i.defaultValue=t.defaultValue,Object.defineProperty(i,"stack",{get(){return r.stack}}),i},hq=Symbol.for("effect/Context"),yee={[hq]:{_Services:e=>e},[kt](e){if(pq(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!ht(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[_t](){return Jn(this,VI(this.unsafeMap.size))},pipe(){return He(this,arguments)},toString(){return vr(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(Hn)}},[Dn](){return this.toJSON()}},Ku=e=>{const t=Object.create(yee);return t.unsafeMap=e,t},bee=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
12
+ `);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(t.message=t.message+` (defined at ${r[1]})`)}}if(t.stack){const n=t.stack.split(`
13
+ `);n.splice(1,3),t.stack=n.join(`
14
+ `)}return t},pq=e=>st(e,hq),vee=e=>st(e,fq),See=e=>st(e,ZS),xee=Ku(new Map),wee=()=>xee,mq=(e,t)=>Ku(new Map([[e.key,t]])),kee=W(3,(e,t,n)=>{const r=new Map(e.unsafeMap);return r.set(t.key,n),Ku(r)}),g1=Wt("effect/Context/defaultValueCache",()=>new Map),dM=e=>{if(g1.has(e.key))return g1.get(e.key);const t=e.defaultValue();return g1.set(e.key,t),t},_ee=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):dM(t),gq=W(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(ZS in t)return dM(t);throw bee(t)}return e.unsafeMap.get(t.key)}),Eee=gq,Tee=W(2,(e,t)=>e.unsafeMap.has(t.key)?cT(e.unsafeMap.get(t.key)):See(t)?cT(dM(t)):mU),Cee=W(2,(e,t)=>{const n=new Map(e.unsafeMap);for(const[r,i]of t.unsafeMap)n.set(r,i);return Ku(n)}),Iee=(...e)=>{const t=new Map;for(let n=0;n<e.length;n++)e[n].unsafeMap.forEach((r,i)=>{t.set(i,r)});return Ku(t)},ds=pee,Mee=pq,ah=vee,uy=wee,Tx=mq,oc=kee,ma=Eee,yq=gq,ts=Tee,Oc=Cee,Ree=Iee,tn=mee,Cx=gee,bq=Symbol.for("effect/Chunk");function Aee(e,t,n,r,i){for(let o=t;o<Math.min(e.length,t+i);o++)n[r+o-t]=e[o];return n}const vq=[],Oee=e=>BI((t,n)=>t.length===n.length&&As(t).every((r,i)=>e(r,oa(n,i)))),Dee=Oee(ht),Pee={[bq]:{_A:e=>e},toString(){return vr(this.toJSON())},toJSON(){return{_id:"Chunk",values:As(this).map(Hn)}},[Dn](){return this.toJSON()},[kt](e){return fM(e)&&Dee(this,e)},[_t](){return Jn(this,oy(As(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return vq[Symbol.iterator]();default:return As(this)[Symbol.iterator]()}},pipe(){return He(this,arguments)}},nr=e=>{const t=Object.create(Pee);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=_s,t.right=_s;break}case"ISingleton":{t.length=1,t.depth=0,t.left=_s,t.right=_s;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=_s,t.right=_s;break}}return t},fM=e=>st(e,bq),_s=nr({_tag:"IEmpty"}),an=()=>_s,y1=(...e)=>$ee(e),In=e=>nr({_tag:"ISingleton",a:e}),ga=e=>fM(e)?e:Ns(zn(e)),hT=(e,t,n)=>{switch(e.backing._tag){case"IArray":{Aee(e.backing.array,0,t,n,e.length);break}case"IConcat":{hT(e.left,t,n),hT(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,i=n;for(;r<e.length;)t[i]=oa(e,r),r+=1,i+=1;break}}},Nee=e=>{switch(e.backing._tag){case"IEmpty":return vq;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return hT(e,t,0),e.backing={_tag:"IArray",array:t},e.left=_s,e.right=_s,e.depth=0,t}}},As=Nee,Lee=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return nr({_tag:"IArray",array:pL(e.backing.array)});case"IConcat":return nr({_tag:"IConcat",left:cl(e.backing.right),right:cl(e.backing.left)});case"ISlice":return Ns(pL(As(e)))}},cl=Lee,Sq=W(2,(e,t)=>t<0||t>=e.length?Ae():Oe(oa(e,t))),Ns=e=>e.length===0?an():e.length===1?In(e[0]):nr({_tag:"IArray",array:e}),$ee=e=>Ns(e),oa=W(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?oa(e.left,t):oa(e.right,t-e.left.length);case"ISlice":return oa(e.backing.chunk,t+e.backing.offset)}}),lh=W(2,(e,t)=>qr(e,In(t))),Jr=W(2,(e,t)=>qr(In(t),e)),pT=W(2,(e,t)=>{if(t<=0)return _s;if(t>=e.length)return e;switch(e.backing._tag){case"ISlice":return nr({_tag:"ISlice",chunk:e.backing.chunk,length:t,offset:e.backing.offset});case"IConcat":return t>e.left.length?nr({_tag:"IConcat",left:e.left,right:pT(e.right,t-e.left.length)}):pT(e.left,t);default:return nr({_tag:"ISlice",chunk:e,offset:0,length:t})}}),Wu=W(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return _s;switch(e.backing._tag){case"ISlice":return nr({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?Wu(e.right,t-e.left.length):nr({_tag:"IConcat",left:Wu(e.left,t),right:e.right});default:return nr({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),qr=W(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const n=t.depth-e.depth;if(Math.abs(n)<=1)return nr({_tag:"IConcat",left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){const r=qr(e.right,t);return nr({_tag:"IConcat",left:e.left,right:r})}else{const r=qr(e.right.right,t);if(r.depth===e.depth-3){const i=nr({_tag:"IConcat",left:e.right.left,right:r});return nr({_tag:"IConcat",left:e.left,right:i})}else{const i=nr({_tag:"IConcat",left:e.left,right:e.right.left});return nr({_tag:"IConcat",left:i,right:r})}}else if(t.right.depth>=t.left.depth){const r=qr(e,t.left);return nr({_tag:"IConcat",left:r,right:t.right})}else{const r=qr(e,t.left.left);if(r.depth===t.depth-3){const i=nr({_tag:"IConcat",left:r,right:t.left.right});return nr({_tag:"IConcat",left:i,right:t.right})}else{const i=nr({_tag:"IConcat",left:t.left.right,right:t.right});return nr({_tag:"IConcat",left:r,right:i})}}}),xq=W(2,(e,t)=>Ns(AU(e,t))),dy=W(2,(e,t)=>Ns(iZ(e,t))),jh=e=>e.length===0,ul=e=>e.length>0,Ix=Sq(0),hM=e=>oa(e,0),na=hM,jee=e=>Sq(e,e.length-1),wq=W(2,(e,t)=>e.backing._tag==="ISingleton"?In(t(e.backing.a,0)):Ns(Y(As(e),Au((n,r)=>t(n,r))))),Fee=W(2,(e,t)=>[pT(e,t),Wu(e,t)]),zee=W(2,(e,t)=>{let n=0;for(const r of As(e)){if(t(r))break;n++}return Fee(e,n)}),el=e=>Wu(e,1),kq=JI,mT=Symbol.for("effect/Duration"),_q=BigInt(0),_L=BigInt(24),yv=BigInt(60),gT=BigInt(1e3),EL=BigInt(1e6),TL=BigInt(1e9),Bee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ro=e=>{if(Eq(e))return e;if(Uu(e))return dl(e);if(yx(e))return b1(e);if(Array.isArray(e)&&e.length===2&&e.every(Uu))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?Gu:e[0]===1/0||e[1]===1/0?Kee:b1(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(Ps(e)){const t=Bee.exec(e);if(t){const[n,r,i]=t,o=Number(r);switch(i){case"nano":case"nanos":return b1(BigInt(r));case"micro":case"micros":return Wee(BigInt(r));case"milli":case"millis":return dl(o);case"second":case"seconds":return Gee(o);case"minute":case"minutes":return Yee(o);case"hour":case"hours":return Qee(o);case"day":case"days":return Xee(o);case"week":case"weeks":return Jee(o)}}}throw new Error("Invalid DurationInput")},Uee=_U(Ro),CL={_tag:"Millis",millis:0},qee={_tag:"Infinity"},Vee={[mT]:mT,[_t](){return Jn(this,iU(this.value))},[kt](e){return Eq(e)&&ate(this,e)},toString(){return`Duration(${cte(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:ete(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}},cs=e=>{const t=Object.create(Vee);return Uu(e)?isNaN(e)||e<=0?t.value=CL:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=qee:e<=_q?t.value=CL:t.value={_tag:"Nanos",nanos:e},t},Eq=e=>st(e,mT),Hee=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===_q;case"Infinity":return!1}},Gu=cs(0),Kee=cs(1/0),b1=e=>cs(e),Wee=e=>cs(e*gT),dl=e=>cs(e),Gee=e=>cs(e*1e3),Yee=e=>cs(e*6e4),Qee=e=>cs(e*36e5),Xee=e=>cs(e*864e5),Jee=e=>cs(e*6048e5),Yu=e=>tte(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),Zee=e=>{const t=Ro(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},ete=e=>{const t=Ro(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/TL),Number(t.value.nanos%TL)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},tte=W(2,(e,t)=>{const n=Ro(e);switch(n.value._tag){case"Nanos":return t.onNanos(n.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(n.value.millis)}}),fy=W(3,(e,t,n)=>{const r=Ro(e),i=Ro(t);if(r.value._tag==="Infinity"||i.value._tag==="Infinity")return n.onMillis(Yu(r),Yu(i));if(r.value._tag==="Nanos"||i.value._tag==="Nanos"){const o=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),a=i.value._tag==="Nanos"?i.value.nanos:BigInt(Math.round(i.value.millis*1e6));return n.onNanos(o,a)}return n.onMillis(r.value.millis,i.value.millis)}),nte=(e,t)=>fy(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),rte=W(2,(e,t)=>fy(e,t,{onMillis:(n,r)=>cs(n+r),onNanos:(n,r)=>cs(n+r)})),ite=W(2,(e,t)=>fy(e,t,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),ote=W(2,(e,t)=>fy(e,t,{onMillis:(n,r)=>n>r,onNanos:(n,r)=>n>r})),ste=W(2,(e,t)=>fy(e,t,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),ate=W(2,(e,t)=>nte(Ro(e),Ro(t))),lte=e=>{const t=Ro(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const n=Zee(t),r=n/EL,i=r/gT,o=i/yv,a=o/yv,c=a/_L;return{days:Number(c),hours:Number(a%_L),minutes:Number(o%yv),seconds:Number(i%yv),millis:Number(r%gT),nanos:Number(n%EL)}},cte=e=>{const t=Ro(e);if(t.value._tag==="Infinity")return"Infinity";if(Hee(t))return"0";const n=lte(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(" ")},Qu=5,pM=Math.pow(2,Qu),ute=pM-1,dte=pM/2,fte=pM/4;function hte(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function ch(e,t){return t>>>e&ute}function Df(e){return 1<<e}function Tq(e,t){return hte(e&t-1)}const pte=(e,t)=>({value:e,previous:t});function Uf(e,t,n,r){let i=r;if(!e){const o=r.length;i=new Array(o);for(let a=0;a<o;++a)i[a]=r[a]}return i[t]=n,i}function Cq(e,t,n){const r=n.length-1;let i=0,o=0,a=n;if(e)i=o=t;else for(a=new Array(r);i<t;)a[o++]=n[i++];for(++i;i<=r;)a[o++]=n[i++];return e&&(a.length=r),a}function mte(e,t,n,r){const i=r.length;if(e){let u=i;for(;u>=t;)r[u--]=r[u];return r[t]=n,r}let o=0,a=0;const c=new Array(i+1);for(;o<t;)c[a++]=r[o++];for(c[t]=n;o<i;)c[++a]=r[o++];return c}class pc{_tag="EmptyNode";modify(t,n,r,i,o,a){const c=r(Ae());return vn(c)?new pc:(++a.value,new Du(t,i,o,c))}}function Ms(e){return Z3(e,"EmptyNode")}function gte(e){return Ms(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function Mx(e,t){return Ms(e)?!1:t===e.edit}class Du{edit;hash;key;value;_tag="LeafNode";constructor(t,n,r,i){this.edit=t,this.hash=n,this.key=r,this.value=i}modify(t,n,r,i,o,a){if(ht(o,this.key)){const u=r(this.value);return u===this.value?this:vn(u)?(--a.value,new pc):Mx(this,t)?(this.value=u,this):new Du(t,i,o,u)}const c=r(Ae());return vn(c)?this:(++a.value,Iq(t,n,this.hash,this,i,new Du(t,i,o,c)))}}class mM{edit;hash;children;_tag="CollisionNode";constructor(t,n,r){this.edit=t,this.hash=n,this.children=r}modify(t,n,r,i,o,a){if(i===this.hash){const u=Mx(this,t),d=this.updateCollisionList(u,t,this.hash,this.children,r,o,a);return d===this.children?this:d.length>1?new mM(t,this.hash,d):d[0]}const c=r(Ae());return vn(c)?this:(++a.value,Iq(t,n,this.hash,this,i,new Du(t,i,o,c)))}updateCollisionList(t,n,r,i,o,a,c){const u=i.length;for(let h=0;h<u;++h){const p=i[h];if("key"in p&&ht(a,p.key)){const y=p.value,g=o(y);return g===y?i:vn(g)?(--c.value,Cq(t,h,i)):Uf(t,h,new Du(n,r,a,g),i)}}const d=o(Ae());return vn(d)?i:(++c.value,Uf(t,u,new Du(n,r,a,d),i))}}class uh{edit;mask;children;_tag="IndexedNode";constructor(t,n,r){this.edit=t,this.mask=n,this.children=r}modify(t,n,r,i,o,a){const c=this.mask,u=this.children,d=ch(n,i),h=Df(d),p=Tq(c,h),y=c&h,g=Mx(this,t);if(!y){const _=new pc().modify(t,n+Qu,r,i,o,a);return _?u.length>=dte?bte(t,d,_,c,u):new uh(t,c|h,mte(g,p,_,u)):this}const v=u[p],S=v.modify(t,n+Qu,r,i,o,a);if(v===S)return this;let x=c,k;if(Ms(S)){if(x&=~h,!x)return new pc;if(u.length<=2&&gte(u[p^1]))return u[p^1];k=Cq(g,p,u)}else k=Uf(g,p,S,u);return g?(this.mask=x,this.children=k,this):new uh(t,x,k)}}class gM{edit;size;children;_tag="ArrayNode";constructor(t,n,r){this.edit=t,this.size=n,this.children=r}modify(t,n,r,i,o,a){let c=this.size;const u=this.children,d=ch(n,i),h=u[d],p=(h||new pc).modify(t,n+Qu,r,i,o,a);if(h===p)return this;const y=Mx(this,t);let g;if(Ms(h)&&!Ms(p))++c,g=Uf(y,d,p,u);else if(!Ms(h)&&Ms(p)){if(--c,c<=fte)return yte(t,c,d,u);g=Uf(y,d,new pc,u)}else g=Uf(y,d,p,u);return y?(this.size=c,this.children=g,this):new gM(t,c,g)}}function yte(e,t,n,r){const i=new Array(t-1);let o=0,a=0;for(let c=0,u=r.length;c<u;++c)if(c!==n){const d=r[c];d&&!Ms(d)&&(i[o++]=d,a|=1<<c)}return new uh(e,a,i)}function bte(e,t,n,r,i){const o=[];let a=r,c=0;for(let u=0;a;++u)a&1&&(o[u]=i[c++]),a>>>=1;return o[t]=n,new gM(e,c+1,o)}function vte(e,t,n,r,i,o){if(n===i)return new mM(e,n,[o,r]);const a=ch(t,n),c=ch(t,i);if(a===c)return u=>new uh(e,Df(a)|Df(c),[u]);{const u=a<c?[r,o]:[o,r];return new uh(e,Df(a)|Df(c),u)}}function Iq(e,t,n,r,i,o){let a,c=t;for(;;){const u=vte(e,c,n,r,i,o);if(typeof u=="function")a=pte(u,a),c=c+Qu;else{let d=u;for(;a!=null;)d=a.value(d),a=a.previous;return d}}}const Mq="effect/HashMap",yT=Symbol.for(Mq),Ste={[yT]:yT,[Symbol.iterator](){return new Rx(this,(e,t)=>[e,t])},[_t](){let e=Ge(Mq);for(const t of this)e^=Y(Ge(t[0]),qt(Ge(t[1])));return Jn(this,e)},[kt](e){if(kte(e)){if(e._size!==this._size)return!1;for(const t of this){const n=Y(e,bM(t[0],Ge(t[0])));if(vn(n))return!1;if(!ht(t[1],n.value))return!1}return!0}return!1},toString(){return vr(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(Hn)}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}},yM=(e,t,n,r)=>{const i=Object.create(Ste);return i._editable=e,i._edit=t,i._root=n,i._size=r,i};class Rx{map;f;v;constructor(t,n){this.map=t,this.f=n,this.v=Rq(this.map._root,this.f,void 0)}next(){if(vn(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=e0(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new Rx(this.map,this.f)}}const e0=e=>e?Aq(e[0],e[1],e[2],e[3],e[4]):Ae(),Rq=(e,t,n=void 0)=>{switch(e._tag){case"LeafNode":return Pe(e.value)?Oe({value:t(e.key,e.value.value),cont:n}):e0(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=e.children;return Aq(r.length,r,0,t,n)}default:return e0(n)}},Aq=(e,t,n,r,i)=>{for(;n<e;){const o=t[n++];if(o&&!Ms(o))return Rq(o,r,[e,t,n,r,i])}return e0(i)},xte=yM(!1,0,new pc,0),Ax=()=>xte,wte=e=>{const t=Dq(Ax());for(const n of e)dg(t,n[0],n[1]);return Ite(t)},kte=e=>st(e,yT),_te=e=>e&&Ms(e._root),Ete=W(2,(e,t)=>bM(e,t,Ge(t))),bM=W(3,(e,t,n)=>{let r=e._root,i=0;for(;;)switch(r._tag){case"LeafNode":return ht(t,r.key)?r.value:Ae();case"CollisionNode":{if(n===r.hash){const o=r.children;for(let a=0,c=o.length;a<c;++a){const u=o[a];if("key"in u&&ht(t,u.key))return u.value}}return Ae()}case"IndexedNode":{const o=ch(i,n),a=Df(o);if(r.mask&a){r=r.children[Tq(r.mask,a)],i+=Qu;break}return Ae()}case"ArrayNode":{if(r=r.children[ch(i,n)],r){i+=Qu;break}return Ae()}default:return Ae()}}),Tte=W(2,(e,t)=>Pe(bM(e,t,Ge(t)))),dg=W(3,(e,t,n)=>vM(e,t,()=>Oe(n))),Cte=W(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:yM(e._editable,e._edit,t,n)),Oq=e=>new Rx(e,t=>t),t0=e=>e._size,Dq=e=>yM(!0,e._edit+1,e._root,e._size),Ite=e=>(e._editable=!1,e),vM=W(3,(e,t,n)=>Mte(e,t,Ge(t),n)),Mte=W(4,(e,t,n,r)=>{const i={value:e._size},o=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,i);return Y(e,Cte(o,i.value))}),IL=W(2,(e,t)=>vM(e,t,Ae)),Rte=W(2,(e,t)=>Ox(e,Ax(),(n,r,i)=>dg(n,i,t(r,i)))),Ate=W(2,(e,t)=>Ox(e,void 0,(n,r,i)=>t(r,i))),Ox=W(3,(e,t,n)=>{const r=e._root;if(r._tag==="LeafNode")return Pe(r.value)?n(t,r.value.value,r.key):t;if(r._tag==="EmptyNode")return t;const i=[r.children];let o;for(;o=i.pop();)for(let a=0,c=o.length;a<c;){const u=o[a++];u&&!Ms(u)&&(u._tag==="LeafNode"?Pe(u.value)&&(t=n(t,u.value.value,u.key)):i.push(u.children))}return t}),Pq="effect/HashSet",bT=Symbol.for(Pq),Ote={[bT]:bT,[Symbol.iterator](){return Oq(this._keyMap)},[_t](){return Jn(this,qt(Ge(this._keyMap))(Ge(Pq)))},[kt](e){return Dte(e)?t0(this._keyMap)===t0(e._keyMap)&&ht(this._keyMap,e._keyMap):!1},toString(){return vr(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(Hn)}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}},Dx=e=>{const t=Object.create(Ote);return t._keyMap=e,t},Dte=e=>st(e,bT),Pte=Dx(Ax()),Px=()=>Pte,Nte=e=>{const t=SM(Px());for(const n of e)fg(t,n);return xM(t)},Lte=(...e)=>{const t=SM(Px());for(const n of e)fg(t,n);return xM(t)},$te=W(2,(e,t)=>Tte(e._keyMap,t)),jte=e=>t0(e._keyMap),SM=e=>Dx(Dq(e._keyMap)),xM=e=>(e._keyMap._editable=!1,e),Nq=W(2,(e,t)=>{const n=SM(e);return t(n),xM(n)}),fg=W(2,(e,t)=>e._keyMap._editable?(dg(t,!0)(e._keyMap),e):Dx(dg(t,!0)(e._keyMap))),Lq=W(2,(e,t)=>e._keyMap._editable?(IL(t)(e._keyMap),e):Dx(IL(t)(e._keyMap))),Fte=W(2,(e,t)=>Nq(e,n=>{for(const r of t)Lq(n,r)})),zte=W(2,(e,t)=>Nq(Px(),n=>{Bte(e,r=>fg(n,r));for(const r of t)fg(n,r)})),Bte=W(2,(e,t)=>Ate(e._keyMap,(n,r)=>t(r))),Ute=W(3,(e,t,n)=>Ox(e._keyMap,t,(r,i,o)=>n(r,o))),Xu=Px,qte=Nte,wM=Lte,Vte=$te,kM=jte,qf=fg,_M=Lq,ML=Fte,hg=zte,pg=Ute,RL=Symbol.for("effect/MutableRef"),Hte={[RL]:RL,toString(){return vr(this.toJSON())},toJSON(){return{_id:"MutableRef",current:Hn(this.current)}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}},bd=e=>{const t=Object.create(Hte);return t.current=e,t},Kte=W(3,(e,t,n)=>ht(t,e.current)?(e.current=n,!0):!1),Ft=e=>e.current,vd=W(2,(e,t)=>(e.current=t,e)),Nx="effect/FiberId",Ju=Symbol.for(Nx),dh="None",vT="Runtime",ST="Composite",Wte=ir(`${Nx}-${dh}`);let Gte=class{[Ju]=Ju;_tag=dh;id=-1;startTimeMillis=-1;[_t](){return Wte}[kt](t){return EM(t)&&t._tag===dh}toString(){return vr(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[Dn](){return this.toJSON()}};class Yte{id;startTimeMillis;[Ju]=Ju;_tag=vT;constructor(t,n){this.id=t,this.startTimeMillis=n}[_t](){return Jn(this,ir(`${Nx}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[kt](t){return EM(t)&&t._tag===vT&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return vr(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[Dn](){return this.toJSON()}}let Qte=class{left;right;[Ju]=Ju;_tag=ST;constructor(t,n){this.left=t,this.right=n}_hash;[_t](){return Y(ir(`${Nx}-${this._tag}`),qt(Ge(this.left)),qt(Ge(this.right)),Jn(this))}[kt](t){return EM(t)&&t._tag===ST&&ht(this.left,t.left)&&ht(this.right,t.right)}toString(){return vr(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,left:Hn(this.left),right:Hn(this.right)}}[Dn](){return this.toJSON()}};const $q=new Gte,EM=e=>st(e,Ju),jq=W(2,(e,t)=>e._tag===dh?t:t._tag===dh?e:new Qte(e,t)),Xte=e=>Y(e,pg($q,(t,n)=>jq(n)(t))),xT=e=>{switch(e._tag){case dh:return Xu();case vT:return wM(e.id);case ST:return Y(xT(e.left),hg(xT(e.right)))}},AL=Wt(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>bd(0)),Lx=e=>Array.from(xT(e)).map(n=>`#${n}`).join(","),Jte=()=>{const e=Ft(AL);return Y(AL,vd(e+1)),new Yte(e,Date.now())},Zu=$q,Zte=jq,ene=Xte,tne=Lx,Fq=Jte,TM=Ax,nne=wte,rne=_te,zq=Ete,n0=dg,Bq=Oq,Uq=t0,ine=vM,one=Rte,qq=Ox,mg=Symbol.for("effect/List"),wT=e=>zn(e),sne=e=>zX(ZI(e),wT),ane=sne(ht),lne={[mg]:mg,_tag:"Cons",toString(){return vr(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:wT(this).map(Hn)}},[Dn](){return this.toJSON()},[kt](e){return Hq(e)&&this._tag===e._tag&&ane(this,e)},[_t](){return Jn(this,oy(wT(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const n=t.head;return t=t.tail,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},pipe(){return He(this,arguments)}},r0=(e,t)=>{const n=Object.create(lne);return n.head=e,n.tail=t,n},cne=ir("Nil"),une={[mg]:mg,_tag:"Nil",toString(){return vr(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[Dn](){return this.toJSON()},[_t](){return cne},[kt](e){return Hq(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return He(this,arguments)}},Vq=Object.create(une),Hq=e=>st(e,mg),il=e=>e._tag==="Nil",CM=e=>e._tag==="Cons",dne=()=>Vq,ed=(e,t)=>r0(e,t),fh=dne,IM=e=>r0(e,Vq),fne=W(2,(e,t)=>pne(t,e)),hne=W(2,(e,t)=>ed(t,e)),pne=W(2,(e,t)=>{if(il(e))return t;if(il(t))return e;{const n=r0(t.head,e);let r=n,i=t.tail;for(;!il(i);){const o=r0(i.head,e);r.tail=o,r=o,i=i.tail}return n}}),mne=W(3,(e,t,n)=>{let r=t,i=e;for(;!il(i);)r=n(r,i.head),i=i.tail;return r}),gne=e=>{let t=fh(),n=e;for(;!il(n);)t=hne(t,n.head),n=n.tail;return t},MM=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=YI,e})(),yne=Symbol.for("effect/DifferContextPatch");function OL(e){return e}const hy={...MM.prototype,[yne]:{_Value:OL,_Patch:OL}},bne=Object.assign(Object.create(hy),{_tag:"Empty"}),vne=Object.create(bne),Kq=()=>vne,Sne=Object.assign(Object.create(hy),{_tag:"AndThen"}),xne=(e,t)=>{const n=Object.create(Sne);return n.first=e,n.second=t,n},wne=Object.assign(Object.create(hy),{_tag:"AddService"}),kne=(e,t)=>{const n=Object.create(wne);return n.key=e,n.service=t,n},_ne=Object.assign(Object.create(hy),{_tag:"RemoveService"}),Ene=e=>{const t=Object.create(_ne);return t.key=e,t},Tne=Object.assign(Object.create(hy),{_tag:"UpdateService"}),Cne=(e,t)=>{const n=Object.create(Tne);return n.key=e,n.update=t,n},Ine=(e,t)=>{const n=new Map(e.unsafeMap);let r=Kq();for(const[i,o]of t.unsafeMap.entries())if(n.has(i)){const a=n.get(i);n.delete(i),ht(a,o)||(r=hS(Cne(i,()=>o))(r))}else n.delete(i),r=hS(kne(i,o))(r);for(const[i]of n.entries())r=hS(Ene(i))(r);return r},hS=W(2,(e,t)=>xne(e,t)),Mne=W(2,(e,t)=>{if(e._tag==="Empty")return t;let n=!1,r=In(e);const i=new Map(t.unsafeMap);for(;ul(r);){const a=na(r),c=el(r);switch(a._tag){case"Empty":{r=c;break}case"AddService":{i.set(a.key,a.service),r=c;break}case"AndThen":{r=Jr(Jr(c,a.second),a.first);break}case"RemoveService":{i.delete(a.key),r=c;break}case"UpdateService":{i.set(a.key,a.update(i.get(a.key))),n=!0,r=c;break}}}if(!n)return Ku(i);const o=new Map;for(const[a]of t.unsafeMap)i.has(a)&&(o.set(a,i.get(a)),i.delete(a));for(const[a,c]of i)o.set(a,c);return Ku(o)}),Rne=Symbol.for("effect/DifferHashSetPatch");function v1(e){return e}const $x={...MM.prototype,[Rne]:{_Value:v1,_Key:v1,_Patch:v1}},Ane=Object.assign(Object.create($x),{_tag:"Empty"}),One=Object.create(Ane),Wq=()=>One,Dne=Object.assign(Object.create($x),{_tag:"AndThen"}),Pne=(e,t)=>{const n=Object.create(Dne);return n.first=e,n.second=t,n},Nne=Object.assign(Object.create($x),{_tag:"Add"}),Lne=e=>{const t=Object.create(Nne);return t.value=e,t},$ne=Object.assign(Object.create($x),{_tag:"Remove"}),jne=e=>{const t=Object.create($ne);return t.value=e,t},Fne=(e,t)=>{const[n,r]=pg([e,Wq()],([i,o],a)=>Vte(a)(i)?[_M(a)(i),o]:[i,kT(Lne(a))(o)])(t);return pg(r,(i,o)=>kT(jne(o))(i))(n)},kT=W(2,(e,t)=>Pne(e,t)),zne=W(2,(e,t)=>{if(e._tag==="Empty")return t;let n=t,r=In(e);for(;ul(r);){const i=na(r),o=el(r);switch(i._tag){case"Empty":{r=o;break}case"AndThen":{r=Jr(i.first)(Jr(i.second)(o));break}case"Add":{n=qf(i.value)(n),r=o;break}case"Remove":n=_M(i.value)(n),r=o}}return n}),Bne=Symbol.for("effect/DifferReadonlyArrayPatch");function DL(e){return e}const py={...MM.prototype,[Bne]:{_Value:DL,_Patch:DL}},Une=Object.assign(Object.create(py),{_tag:"Empty"}),qne=Object.create(Une),Gq=()=>qne,Vne=Object.assign(Object.create(py),{_tag:"AndThen"}),Hne=(e,t)=>{const n=Object.create(Vne);return n.first=e,n.second=t,n},Kne=Object.assign(Object.create(py),{_tag:"Append"}),Wne=e=>{const t=Object.create(Kne);return t.values=e,t},Gne=Object.assign(Object.create(py),{_tag:"Slice"}),Yne=(e,t)=>{const n=Object.create(Gne);return n.from=e,n.until=t,n},Qne=Object.assign(Object.create(py),{_tag:"Update"}),Xne=(e,t)=>{const n=Object.create(Qne);return n.index=e,n.patch=t,n},Jne=e=>{let t=0,n=Gq();for(;t<e.oldValue.length&&t<e.newValue.length;){const r=e.oldValue[t],i=e.newValue[t],o=e.differ.diff(r,i);ht(o,e.differ.empty)||(n=pS(n,Xne(t,o))),t=t+1}return t<e.oldValue.length&&(n=pS(n,Yne(0,t))),t<e.newValue.length&&(n=pS(n,Wne(JJ(t)(e.newValue)))),n},pS=W(2,(e,t)=>Hne(e,t)),Zne=W(3,(e,t,n)=>{if(e._tag==="Empty")return t;let r=t.slice(),i=ws(e);for(;dS(i);){const o=Bi(i),a=qu(i);switch(o._tag){case"Empty":{i=a;break}case"AndThen":{a.unshift(o.first,o.second),i=a;break}case"Append":{for(const c of o.values)r.push(c);i=a;break}case"Slice":{r=r.slice(o.from,o.until),i=a;break}case"Update":{r[o.index]=n.patch(o.patch,r[o.index]),i=a;break}}}return r}),ere=Symbol.for("effect/Differ"),tre={[ere]:{_P:Mt,_V:Mt},pipe(){return He(this,arguments)}},Fh=e=>{const t=Object.create(tre);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},nre=()=>Fh({empty:Kq(),combine:(e,t)=>hS(t)(e),diff:(e,t)=>Ine(e,t),patch:(e,t)=>Mne(t)(e)}),rre=()=>Fh({empty:Wq(),combine:(e,t)=>kT(t)(e),diff:(e,t)=>Fne(e,t),patch:(e,t)=>zne(t)(e)}),ire=e=>Fh({empty:Gq(),combine:(t,n)=>pS(t,n),diff:(t,n)=>Jne({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>Zne(t,n,e)}),Yq=()=>ore((e,t)=>t),ore=e=>Fh({empty:Mt,combine:(t,n)=>t===Mt?n:n===Mt?t:r=>n(t(r)),diff:(t,n)=>ht(t,n)?Mt:mx(n),patch:(t,n)=>e(n,t(n))}),gg=255,Qq=8,_T=e=>e&gg,ET=e=>e>>Qq&gg,my=(e,t)=>(e&gg)+((t&e&gg)<<Qq),sre=my(0,0),are=e=>my(e,e),lre=e=>my(e,0),cre=W(2,(e,t)=>my(_T(e)&~t,ET(e))),ure=W(2,(e,t)=>e|t),dre=e=>~e>>>0&gg,fre=0,Sd=1,hre=2,Xq=4,TT=16,Jq=32,pre=e=>jx(e,Jq),mre=W(2,(e,t)=>e&~t),gre=W(2,(e,t)=>e|t),ic=e=>Zq(e)&&!bre(e),Zq=e=>jx(e,Sd),jx=W(2,(e,t)=>(e&t)!==0),eV=(...e)=>e.reduce((t,n)=>t|n,0),yre=eV(fre),PL=e=>jx(e,Xq),bre=e=>jx(e,TT),Pu=W(2,(e,t)=>my(e^t,t)),Vf=W(2,(e,t)=>e&(dre(_T(t))|ET(t))|_T(t)&ET(t)),NL=Fh({empty:sre,diff:(e,t)=>Pu(e,t),combine:(e,t)=>ure(t)(e),patch:(e,t)=>Vf(t,e)}),vre=are,tV=lre,LL=cre,nV=(e,t)=>({_tag:"Par",left:e,right:t}),bv=(e,t)=>({_tag:"Seq",left:e,right:t}),Sre=e=>{let t=IM(e),n=fh();for(;;){const[r,i]=mne(t,[rV(),fh()],([o,a],c)=>{const[u,d]=xre(c);return[Tre(o,u),fne(a,d)]});if(n=wre(n,r),il(i))return gne(n);t=i}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},xre=e=>{let t=e,n=rV(),r=fh(),i=fh();for(;;)switch(t._tag){case"Empty":{if(il(r))return[n,i];t=r.head,r=r.tail;break}case"Par":{r=ed(t.right,r),t=t.left;break}case"Seq":{const o=t.left,a=t.right;switch(o._tag){case"Empty":{t=a;break}case"Par":{const c=o.left,u=o.right;t=nV(bv(c,a),bv(u,a));break}case"Seq":{const c=o.left,u=o.right;t=bv(c,bv(u,a));break}case"Single":{t=o,i=ed(a,i);break}}break}case"Single":{if(n=Ere(n,t),il(r))return[n,i];t=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},wre=(e,t)=>{if(il(e))return IM(S1(t));if(Cre(t))return e;const n=Dre(e.head),r=Ire(t);return n.length===1&&r.length===1&&ht(n[0],r[0])?ed(Ore(e.head,S1(t)),e.tail):ed(S1(t),e)},kre=Symbol.for("effect/RequestBlock/RequestBlockParallel"),_re={_R:e=>e};class RM{map;[kre]=_re;constructor(t){this.map=t}}const rV=()=>new RM(TM()),Ere=(e,t)=>new RM(ine(e.map,t.dataSource,n=>PJ(Ru(n,lh(t.blockedRequest)),()=>In(t.blockedRequest)))),Tre=(e,t)=>new RM(qq(e.map,t.map,(n,r,i)=>n0(n,i,Xn(zq(n,i),{onNone:()=>r,onSome:o=>qr(r,o)})))),Cre=e=>rne(e.map),Ire=e=>Array.from(Bq(e.map)),S1=e=>Are(one(e.map,t=>In(t))),Mre=Symbol.for("effect/RequestBlock/RequestBlockSequential"),Rre={_R:e=>e};class iV{map;[Mre]=Rre;constructor(t){this.map=t}}const Are=e=>new iV(e),Ore=(e,t)=>new iV(qq(t.map,e.map,(n,r,i)=>n0(n,i,Xn(zq(n,i),{onNone:()=>an(),onSome:o=>qr(o,r)})))),Dre=e=>Array.from(Bq(e.map)),Pre=e=>Array.from(e.map),xd="Die",td="Empty",wd="Fail",zh="Interrupt",hh="Parallel",ph="Sequential",oV="effect/Cause",sV=Symbol.for(oV),Nre={_E:e=>e},Bh={[sV]:Nre,[_t](){return Y(Ge(oV),qt(Ge(Hre(this))),Jn(this))},[kt](e){return aV(e)&&Vre(this,e)},pipe(){return He(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:Hn(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:Hn(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:Hn(this.left),right:Hn(this.right)}}},toString(){return Dc(this)},[Dn](){return this.toJSON()}},fl=(()=>{const e=Object.create(Bh);return e._tag=td,e})(),mc=e=>{const t=Object.create(Bh);return t._tag=wd,t.error=e,t},To=e=>{const t=Object.create(Bh);return t._tag=xd,t.defect=e,t},Jo=e=>{const t=Object.create(Bh);return t._tag=zh,t.fiberId=e,t},gc=(e,t)=>{const n=Object.create(Bh);return n._tag=hh,n.left=e,n.right=t,n},Yr=(e,t)=>{const n=Object.create(Bh);return n._tag=ph,n.left=e,n.right=t,n},aV=e=>st(e,sV),Lre=e=>e._tag===td,$re=e=>e._tag===wd,lV=e=>e._tag===xd,AM=e=>e._tag===td?!0:mh(e,!0,(t,n)=>{switch(n._tag){case td:return Oe(t);case xd:case wd:case zh:return Oe(!1);default:return Ae()}}),cV=e=>Pe(zre(e)),Fx=e=>OM(void 0,Wre)(e),uV=e=>cl(mh(e,an(),(t,n)=>n._tag===wd?Oe(Y(t,Jr(n.error))):Ae())),dV=e=>cl(mh(e,an(),(t,n)=>n._tag===xd?Oe(Y(t,Jr(n.defect))):Ae())),fV=e=>mh(e,Xu(),(t,n)=>n._tag===zh?Oe(Y(t,qf(n.fiberId))):Ae()),hV=e=>zx(e,t=>t._tag===wd?Oe(t.error):Ae()),pV=e=>{const t=hV(e);switch(t._tag){case"None":return vt(e);case"Some":return ct(t.value)}},jre=e=>zx(e,t=>t._tag===xd?Oe(t.defect):Ae()),Fre=e=>Bx(e,{onEmpty:Oe(fl),onFail:Ru(mc),onDie:t=>Oe(To(t)),onInterrupt:t=>Oe(Jo(t)),onSequential:hL(Yr),onParallel:hL(gc)}),zre=e=>zx(e,t=>t._tag===zh?Oe(t.fiberId):Ae()),$L=e=>Bx(e,{onEmpty:fl,onFail:()=>fl,onDie:To,onInterrupt:Jo,onSequential:Yr,onParallel:gc}),Bre=e=>Bx(e,{onEmpty:fl,onFail:To,onDie:To,onInterrupt:Jo,onSequential:Yr,onParallel:gc}),Ure=W(2,(e,t)=>qre(e,n=>mc(t(n)))),qre=W(2,(e,t)=>Bx(e,{onEmpty:fl,onFail:n=>t(n),onDie:n=>To(n),onInterrupt:n=>Jo(n),onSequential:(n,r)=>Yr(n,r),onParallel:(n,r)=>gc(n,r)})),Vre=(e,t)=>{let n=In(e),r=In(t);for(;ul(n)&&ul(r);){const[i,o]=Y(na(n),mh([Xu(),an()],([u,d],h)=>{const[p,y]=CT(h);return Oe([Y(u,hg(p)),Y(d,qr(y))])})),[a,c]=Y(na(r),mh([Xu(),an()],([u,d],h)=>{const[p,y]=CT(h);return Oe([Y(u,hg(p)),Y(d,qr(y))])}));if(!ht(i,a))return!1;n=o,r=c}return!0},Hre=e=>Kre(In(e),an()),Kre=(e,t)=>{for(;;){const[n,r]=Y(e,JI([Xu(),an()],([o,a],c)=>{const[u,d]=CT(c);return[Y(o,hg(u)),Y(a,qr(d))]})),i=kM(n)>0?Y(t,Jr(n)):t;if(jh(r))return cl(i);e=r,t=i}throw new Error(bx("Cause.flattenCauseLoop"))},zx=W(2,(e,t)=>{const n=[e];for(;n.length>0;){const r=n.pop(),i=t(r);switch(i._tag){case"None":{switch(r._tag){case ph:case hh:{n.push(r.right),n.push(r.left);break}}break}case"Some":return i}}return Ae()}),CT=e=>{let t=e;const n=[];let r=Xu(),i=an();for(;t!==void 0;)switch(t._tag){case td:{if(n.length===0)return[r,i];t=n.pop();break}case wd:{if(r=qf(r,y1(t._tag,t.error)),n.length===0)return[r,i];t=n.pop();break}case xd:{if(r=qf(r,y1(t._tag,t.defect)),n.length===0)return[r,i];t=n.pop();break}case zh:{if(r=qf(r,y1(t._tag,t.fiberId)),n.length===0)return[r,i];t=n.pop();break}case ph:{switch(t.left._tag){case td:{t=t.right;break}case ph:{t=Yr(t.left.left,Yr(t.left.right,t.right));break}case hh:{t=gc(Yr(t.left.left,t.right),Yr(t.left.right,t.right));break}default:{i=Jr(i,t.right),t=t.left;break}}break}case hh:{n.push(t.right),t=t.left;break}}throw new Error(bx("Cause.evaluateCauseLoop"))},Wre={emptyCase:sT,failCase:Bf,dieCase:Bf,interruptCase:sT,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},jL="SequentialCase",FL="ParallelCase",Bx=W(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:i,onParallel:o,onSequential:a})=>OM(e,void 0,{emptyCase:()=>n,failCase:(c,u)=>r(u),dieCase:(c,u)=>t(u),interruptCase:(c,u)=>i(u),sequentialCase:(c,u,d)=>a(u,d),parallelCase:(c,u,d)=>o(u,d)})),mh=W(3,(e,t,n)=>{let r=t,i=e;const o=[];for(;i!==void 0;){const a=n(r,i);switch(r=Pe(a)?a.value:r,i._tag){case ph:{o.push(i.right),i=i.left;break}case hh:{o.push(i.right),i=i.left;break}default:{i=void 0;break}}i===void 0&&o.length>0&&(i=o.pop())}return r}),OM=W(3,(e,t,n)=>{const r=[e],i=[];for(;r.length>0;){const a=r.pop();switch(a._tag){case td:{i.push(vt(n.emptyCase(t)));break}case wd:{i.push(vt(n.failCase(t,a.error)));break}case xd:{i.push(vt(n.dieCase(t,a.defect)));break}case zh:{i.push(vt(n.interruptCase(t,a.fiberId)));break}case ph:{r.push(a.right),r.push(a.left),i.push(ct({_tag:jL}));break}case hh:{r.push(a.right),r.push(a.left),i.push(ct({_tag:FL}));break}}}const o=[];for(;i.length>0;){const a=i.pop();switch(a._tag){case"Left":{switch(a.left._tag){case jL:{const c=o.pop(),u=o.pop(),d=n.sequentialCase(t,c,u);o.push(d);break}case FL:{const c=o.pop(),u=o.pop(),d=n.parallelCase(t,c,u);o.push(d);break}}break}case"Right":{o.push(a.right);break}}}if(o.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return o.pop()}),Dc=(e,t)=>Fx(e)?"All fibers interrupted without errors.":gV(e).map(function(n){return t?.renderErrorCause!==!0||n.cause===void 0?n.stack:`${n.stack} {
15
+ ${mV(n.cause," ")}
16
+ }`}).join(`
17
+ `),mV=(e,t)=>{const n=e.stack.split(`
18
+ `);let r=`${t}[cause]: ${n[0]}`;for(let i=1,o=n.length;i<o;i++)r+=`
19
+ ${t}${n[i]}`;return e.cause&&(r+=` {
20
+ ${mV(e.cause,`${t} `)}
21
+ ${t}}`),r};class i0 extends globalThis.Error{span=void 0;constructor(t){const n=typeof t=="object"&&t!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1,super(Gre(t),n&&"cause"in t&&typeof t.cause<"u"?{cause:new i0(t.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=r,this.name=t instanceof Error?t.name:"Error",n&&(gh in t&&(this.span=t[gh]),Object.keys(t).forEach(i=>{i in this||(this[i]=t[i])})),this.stack=Xre(`${this.name}: ${this.message}`,t instanceof Error&&t.stack?t.stack:"",this.span)}}const Gre=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(st(e,"toString")&&ry(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return sU(e)},Yre=/\((.*)\)/g,Qre=Wt("effect/Tracer/spanToTrace",()=>new WeakMap),Xre=(e,t,n)=>{const r=[e],i=t.startsWith(e)?t.slice(e.length).split(`
22
+ `):t.split(`
23
+ `);for(let o=1;o<i.length;o++){if(i[o].includes(" at new BaseEffectError")||i[o].includes(" at new YieldableError")){o++;continue}if(i[o].includes("Generator.next")||i[o].includes("effect_internal_function"))break;r.push(i[o].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let o=n,a=0;for(;o&&o._tag==="Span"&&a<10;){const c=Qre.get(o);if(typeof c=="function"){const u=c();if(typeof u=="string"){const d=u.matchAll(Yre);let h=!1;for(const[,p]of d)h=!0,r.push(` at ${o.name} (${p})`);h||r.push(` at ${o.name} (${u.replace(/^at /,"")})`)}else r.push(` at ${o.name}`)}else r.push(` at ${o.name}`);o=Pi(o.parent),a++}}return r.join(`
24
+ `)},gh=Symbol.for("effect/SpanAnnotation"),gV=e=>OM(e,void 0,{emptyCase:()=>[],dieCase:(t,n)=>[new i0(n)],failCase:(t,n)=>[new i0(n)],interruptCase:()=>[],parallelCase:(t,n,r)=>[...n,...r],sequentialCase:(t,n,r)=>[...n,...r]}),gy="Pending",Ux="Done",Jre="effect/Deferred",Zre=Symbol.for(Jre),eie={_E:e=>e,_A:e=>e},tie=e=>({_tag:gy,joiners:e}),yV=e=>({_tag:Ux,effect:e});class yy{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new yy(this.self)}}const bV=(e,t)=>{const n=new Pr("Blocked");return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},nie=e=>{const t=new Pr("RunBlocked");return t.effect_instruction_i0=e,t},yh=Symbol.for("effect/Effect");class rie{patch;op;_op=WI;constructor(t,n){this.patch=t,this.op=n}}class Pr{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[yh]=oh;constructor(t){this._op=t}[kt](t){return this===t}[_t](){return Jn(this,qI(this))}pipe(){return He(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:Hn(this.effect_instruction_i0),effect_instruction_i1:Hn(this.effect_instruction_i1),effect_instruction_i2:Hn(this.effect_instruction_i2)}}toString(){return vr(this.toJSON())}[Dn](){return this.toJSON()}[Symbol.iterator](){return new yy(new iy(this))}}class vV{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[yh]=oh;constructor(t){this._op=t,this._tag=t}[kt](t){return Yx(t)&&t._op==="Failure"&&ht(this.effect_instruction_i0,t.effect_instruction_i0)}[_t](){return Y(ir(this._tag),qt(Ge(this.effect_instruction_i0)),Jn(this))}get cause(){return this.effect_instruction_i0}pipe(){return He(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return vr(this.toJSON())}[Dn](){return this.toJSON()}[Symbol.iterator](){return new yy(new iy(this))}}class SV{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[yh]=oh;constructor(t){this._op=t,this._tag=t}[kt](t){return Yx(t)&&t._op==="Success"&&ht(this.effect_instruction_i0,t.effect_instruction_i0)}[_t](){return Y(ir(this._tag),qt(Ge(this.effect_instruction_i0)),Jn(this))}get value(){return this.effect_instruction_i0}pipe(){return He(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:Hn(this.value)}}toString(){return vr(this.toJSON())}[Dn](){return this.toJSON()}[Symbol.iterator](){return new yy(new iy(this))}}const xa=e=>st(e,yh),Nt=e=>{const t=new Pr(cU);return t.effect_instruction_i0=e,t},xV=W(3,(e,t,n)=>us(r=>Se(e,i=>Se(sa(lt(()=>r(t(i)))),o=>lt(()=>n(i,o)).pipe(Ao({onFailure:a=>{switch(o._tag){case Qr:return xr(Yr(o.effect_instruction_i0,a));case Xr:return xr(a)}},onSuccess:()=>o})))))),Zr=W(2,(e,t)=>Se(e,()=>Ie(t))),Ci=e=>Zr(e,void 0),wV=function(){const e=new Pr(Sx);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw new Error(bx("you're not supposed to end up here"))}return e},o0=(e,t=Zu)=>{const n=new Pr(Bm);let r;return n.effect_instruction_i0=i=>{r=e(i)},n.effect_instruction_i1=t,qh(n,i=>xa(r)?r:hn)},kV=(e,t=Zu)=>lt(()=>o0(e,t)),ya=(e,t=Zu)=>wV(e,function(){let n,r;function i(u){n?n(u):r===void 0&&(r=u)}const o=new Pr(Bm);o.effect_instruction_i0=u=>{n=u,r&&u(r)},o.effect_instruction_i1=t;let a,c;return this.effect_instruction_i0.length!==1?(c=new AbortController,a=Di(()=>this.effect_instruction_i0(i,c.signal))):a=Di(()=>this.effect_instruction_i0(i)),a||c?qh(o,u=>(c&&c.abort(),a??hn)):o}),_V=W(2,(e,t)=>{const n=new Pr(cS);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),yg=W(2,(e,t)=>hl(e,{onFailure:t,onSuccess:Ie})),zL=Symbol.for("effect/OriginalAnnotation"),DM=(e,t)=>Pe(t)?new Proxy(e,{has(n,r){return r===gh||r===zL||r in n},get(n,r){return r===gh?t.value:r===zL?e:n[r]}}):e,ra=e=>xl(e)&&!(gh in e)?Nt(t=>xr(To(DM(e,zM(t))))):xr(To(e)),EV=e=>TV(()=>To(new Rie(e))),bh=e=>hl(e,{onFailure:t=>Ie(ct(t)),onSuccess:t=>Ie(vt(t))}),sa=e=>CV(e,{onFailure:rn,onSuccess:or}),Rr=e=>xl(e)&&!(gh in e)?Nt(t=>xr(mc(DM(e,zM(t))))):xr(mc(e)),by=e=>Se(Ce(e),Rr),xr=e=>{const t=new vV(Qr);return t.effect_instruction_i0=e,t},TV=e=>Se(Ce(e),xr),vy=Nt(e=>Ie(e.id())),Uh=e=>Nt(t=>e(t.id())),Se=W(2,(e,t)=>{const n=new Pr(WS);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),iie=e=>{const t=new Pr("OnStep");return t.effect_instruction_i0=e,t},kd=e=>Se(e,Mt),CV=W(2,(e,t)=>Ao(e,{onFailure:n=>Ie(t.onFailure(n)),onSuccess:n=>Ie(t.onSuccess(n))})),Ao=W(2,(e,t)=>{const n=new Pr(GS);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),hl=W(2,(e,t)=>Ao(e,{onFailure:n=>{if(dV(n).length>0)return xr(Bre(n));const i=uV(n);return i.length>0?t.onFailure(hM(i)):xr(n)},onSuccess:t.onSuccess})),tl=W(2,(e,t)=>lt(()=>{const n=zn(e),r=wx(n.length);let i=0;return Zr(PM({while:()=>i<n.length,body:()=>t(n[i],i),step:o=>{r[i++]=o}}),r)})),qx=W(2,(e,t)=>lt(()=>{const n=zn(e);let r=0;return PM({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),zr=Se(vy,e=>IV(e)),IV=e=>xr(Jo(e)),Vx=e=>{const t=new Pr(Nh);return t.effect_instruction_i0=vre(Sd),t.effect_instruction_i1=()=>e,t},oie=W(2,(e,t)=>us(n=>Se(sa(n(e)),r=>qie(t,r)))),ot=W(2,(e,t)=>Se(e,n=>Ce(()=>t(n)))),MV=W(2,(e,t)=>hl(e,{onFailure:n=>by(()=>t.onFailure(n)),onSuccess:n=>Ce(()=>t.onSuccess(n))})),Hx=W(2,(e,t)=>Ao(e,{onFailure:n=>{const r=pV(n);switch(r._tag){case"Left":return by(()=>t(r.left));case"Right":return xr(r.right)}},onSuccess:Ie})),nd=W(2,(e,t)=>us(n=>Ao(n(e),{onFailure:r=>{const i=rn(r);return Ao(t(i),{onFailure:o=>rn(Yr(r,o)),onSuccess:()=>i})},onSuccess:r=>{const i=or(r);return Br(t(i),i)}}))),qh=W(2,(e,t)=>nd(e,Qx({onFailure:n=>Fx(n)?Ci(t(fV(n))):hn,onSuccess:()=>hn}))),sie=e=>aie(e,Mt),aie=W(2,(e,t)=>hl(e,{onFailure:n=>ra(t(n)),onSuccess:Ie})),Ie=e=>{const t=new SV(Xr);return t.effect_instruction_i0=e,t},lt=e=>{const t=new Pr(Sx);return t.commit=e,t},Ce=e=>{const t=new Pr(lU);return t.effect_instruction_i0=e,t},Sy=W(e=>e.length===3||e.length===2&&!(xl(e[1])&&"onlyEffect"in e[1]),(e,t)=>Se(e,n=>{const r=typeof t=="function"?t(n):t;return xa(r)?Zr(r,n):WX(r)?o0(i=>{r.then(o=>i(Ie(n)),o=>i(Rr(new UV(o,"An unknown error occurred in Effect.tap"))))}):Ie(n)})),lie=e=>Nt(t=>{const n=t.getFiberRef(RT),r=Y(n,On(()=>t.scope()));return e(Vh(RT,Oe(r)))}),_d=e=>{const t=new Pr(Nh);return t.effect_instruction_i0=tV(Sd),t.effect_instruction_i1=()=>e,t},us=e=>wV(e,function(){const t=new Pr(Nh);return t.effect_instruction_i0=tV(Sd),t.effect_instruction_i1=n=>Zq(n)?Di(()=>this.effect_instruction_i0(Vx)):Di(()=>this.effect_instruction_i0(_d)),t}),hn=Ie(void 0),cie=e=>{const t=new Pr(Nh);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Kx=W(2,(e,t)=>Se(t,n=>n?Y(e,ot(Oe)):Ie(Ae()))),PM=e=>{const t=new Pr(YS);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},IT=e=>lt(()=>{const t=new Pr(Um);return t.effect_instruction_i0=e(),t}),RV=function(){const e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return IT(()=>e(Y))},uie=(e,...t)=>Object.defineProperty(t.length===0?function(...n){return IT(()=>e.apply(this,n))}:function(...n){let r=IT(()=>e.apply(this,n));for(const i of t)r=i(r,...n);return r},"length",{value:e.length,configurable:!0}),die=W(2,(e,t)=>{const n=new Pr(Nh);return n.effect_instruction_i0=t,n.effect_instruction_i1=()=>e,n}),xy=e=>{const t=new Pr(uS);return typeof e?.priority<"u"?Eie(t,e.priority):t},AV=W(2,(e,t)=>Se(e,n=>ot(t,r=>[n,r]))),Wx=W(2,(e,t)=>Se(e,n=>Zr(t,n))),Br=W(2,(e,t)=>Se(e,()=>t)),OV=W(3,(e,t,n)=>Se(e,r=>ot(t,i=>n(r,i)))),Gx=e=>Se(vy,t=>Y(e,nl(t))),nl=W(2,(e,t)=>Se(e.interruptAsFork(t),()=>e.await)),fie={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return He(this,arguments)}},hie={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return He(this,arguments)}},pie={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return He(this,arguments)}},DV={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return He(this,arguments)}},PV={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return He(this,arguments)}},NV={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return He(this,arguments)}},mie={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return He(this,arguments)}},gie={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return He(this,arguments)}},yie="effect/FiberRef",bie=Symbol.for(yie),vie={_A:e=>e},wy=e=>Nt(t=>or(t.getFiberRef(e))),ky=W(2,(e,t)=>Se(wy(e),t)),s0=W(2,(e,t)=>Sie(e,()=>[void 0,t])),Sie=W(2,(e,t)=>Nt(n=>{const[r,i]=t(n.getFiberRef(e));return n.setFiberRef(e,i),Ie(r)})),Vh=W(3,(e,t,n)=>xV(Wx(wy(t),s0(t,n)),()=>e,r=>s0(t,r))),LV=W(3,(e,t,n)=>ky(t,r=>Vh(e,t,n(r)))),Vi=(e,t)=>Hh(e,{differ:Yq(),fork:t?.fork??Mt,join:t?.join}),xie=e=>{const t=rre();return Hh(e,{differ:t,fork:t.empty})},wie=e=>{const t=ire(Yq());return Hh(e,{differ:t,fork:t.empty})},$V=e=>{const t=nre();return Hh(e,{differ:t,fork:t.empty})},Hh=(e,t)=>({...gd,[bie]:vie,initial:e,commit(){return wy(this)},diff:(r,i)=>t.differ.diff(r,i),combine:(r,i)=>t.differ.combine(r,i),patch:r=>i=>t.differ.patch(r,i),fork:t.fork,join:t.join??((r,i)=>i)}),kie=e=>Hh(e,{differ:NL,fork:NL.empty}),Pc=Wt(Symbol.for("effect/FiberRef/currentContext"),()=>$V(uy())),_y=Wt(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>Vi(0)),jV=Wt(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>Vi(2048)),FV=Wt(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>Vi(TM())),zV=Wt(Symbol.for("effect/FiberRef/currentLogLevel"),()=>Vi(PV)),_ie=Wt(Symbol.for("effect/FiberRef/currentLogSpan"),()=>Vi(fh())),Eie=W(2,(e,t)=>Vh(e,_y,t)),Tie=Wt(Symbol.for("effect/FiberRef/currentConcurrency"),()=>Vi("unbounded")),Cie=Wt(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>Vi(!0)),Iie=Wt(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>Vi(Oe(NV))),Mie=Wt(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>Vi(Oe(DV))),MT=Wt(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>wie(Vu())),RT=Wt(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>Vi(Ae(),{fork:()=>Ae(),join:(e,t)=>e})),vv=Wt(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>Vi(fl,{fork:()=>fl,join:(e,t)=>e})),BL=Symbol.for("effect/Scope"),UL=Symbol.for("effect/CloseableScope"),BV=(e,t)=>e.addFinalizer(()=>Ci(t)),a0=(e,t)=>e.addFinalizer(t),AT=(e,t)=>e.close(t),Xa=(e,t)=>e.fork(t),NM=(function(){class e extends globalThis.Error{commit(){return Rr(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[Dn](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
25
+ ${this.stack.split(`
26
+ `).slice(1).join(`
27
+ `)}`:this.toString():"Bun"in globalThis?Dc(mc(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,bJ),e})(),LM=(e,t)=>{class n extends NM{_tag=t}return Object.assign(n.prototype,e),n.prototype.name=t,n},qL=Symbol.for("effect/Cause/errors/RuntimeException"),Rie=LM({[qL]:qL},"RuntimeException"),Aie=Symbol.for("effect/Cause/errors/InterruptedException"),Oie=e=>st(e,Aie),VL=Symbol.for("effect/Cause/errors/NoSuchElement"),$M=LM({[VL]:VL},"NoSuchElementException"),HL=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),Die=LM({[HL]:HL},"InvalidPubSubCapacityException"),KL=Symbol.for("effect/Cause/errors/UnknownException"),UV=(function(){class e extends NM{_tag="UnknownException";error;constructor(n,r){super(r??"An unknown error occurred",{cause:n}),this.error=n}}return Object.assign(e.prototype,{[KL]:KL,name:"UnknownException"}),e})(),Yx=e=>xa(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),Pie=e=>e._tag==="Failure",Nie=e=>e._tag==="Success",Lie=W(2,(e,t)=>{switch(e._tag){case Qr:return rn(e.effect_instruction_i0);case Xr:return or(t)}}),x1=e=>Lie(e,void 0),Hf=(e,t)=>Bie(e,t?.parallel?gc:Yr),qV=e=>rn(To(e)),OT=e=>rn(mc(e)),rn=e=>{const t=new vV(Qr);return t.effect_instruction_i0=e,t},$ie=W(2,(e,t)=>{switch(e._tag){case Qr:return rn(e.effect_instruction_i0);case Xr:return t(e.effect_instruction_i0)}}),jie=e=>Y(e,$ie(Mt)),VV=e=>rn(Jo(e)),mS=W(2,(e,t)=>{switch(e._tag){case Qr:return rn(e.effect_instruction_i0);case Xr:return or(t(e.effect_instruction_i0))}}),Qx=W(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case Qr:return t(e.effect_instruction_i0);case Xr:return n(e.effect_instruction_i0)}}),DT=W(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case Qr:return t(e.effect_instruction_i0);case Xr:return n(e.effect_instruction_i0)}}),or=e=>{const t=new SV(Xr);return t.effect_instruction_i0=e,t},ns=or(void 0),Fie=W(2,(e,t)=>jM(e,t,{onSuccess:(n,r)=>[n,r],onFailure:Yr})),zie=W(2,(e,t)=>jM(e,t,{onSuccess:(n,r)=>r,onFailure:Yr})),jM=W(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case Qr:switch(t._tag){case Xr:return rn(e.effect_instruction_i0);case Qr:return rn(n(e.effect_instruction_i0,t.effect_instruction_i0))}case Xr:switch(t._tag){case Xr:return or(r(e.effect_instruction_i0,t.effect_instruction_i0));case Qr:return rn(t.effect_instruction_i0)}}}),Bie=(e,t)=>{const n=ga(e);return ul(n)?Y(el(n),JI(Y(na(n),mS(In)),(r,i)=>Y(r,jM(i,{onSuccess:(o,a)=>Y(o,Jr(a)),onFailure:t}))),mS(cl),mS(r=>As(r)),Oe):Ae()},Kh=e=>({...gd,[Zre]:eie,state:bd(tie([])),commit(){return Ls(this)},blockingOn:e}),Ey=()=>Se(vy,e=>Uie(e)),Uie=e=>Ce(()=>Kh(e)),Ls=e=>kV(t=>{const n=Ft(e.state);switch(n._tag){case Ux:return t(n.effect);case gy:return n.joiners.push(t),Hie(e,t)}},e.blockingOn),Xx=W(2,(e,t)=>Ce(()=>{const n=Ft(e.state);switch(n._tag){case Ux:return!1;case gy:{vd(e.state,yV(t));for(let r=0,i=n.joiners.length;r<i;r++)n.joiners[r](t);return!0}}})),qie=W(2,(e,t)=>Xx(e,t)),HV=W(2,(e,t)=>Xx(e,xr(t))),Jx=W(2,(e,t)=>Xx(e,IV(t))),Vie=e=>Ce(()=>Ft(e.state)._tag===Ux),Ty=W(2,(e,t)=>Xx(e,Ie(t))),Zx=(e,t)=>{const n=Ft(e.state);if(n._tag===gy){vd(e.state,yV(t));for(let r=0,i=n.joiners.length;r<i;r++)n.joiners[r](t)}},Hie=(e,t)=>Ce(()=>{const n=Ft(e.state);if(n._tag===gy){const r=n.joiners.indexOf(t);r>=0&&n.joiners.splice(r,1)}}),Kie=Nt(e=>or(e.currentContext)),ew=()=>Kie,Ed=e=>Se(ew(),e),Wh=W(2,(e,t)=>Vh(Pc,t)(e)),FM=W(2,(e,t)=>LV(Pc,n=>Oc(n,t))(e)),KV=W(2,(e,t)=>Ed(n=>Wh(e,t(n)))),zM=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?Oe(t):Ae()},br=Ey,Un=Ls,WV=HV,PT=Vie,hi=Ty,GV=Pie,bg=Nie,Wie=Hf,Gie=qV,Vm=OT,rs=rn,Yie=jie,Qie=mS,ji=Qx,Zo=or,ks=ns,WL=Fie,vg=zie,GL=Symbol.for("effect/MutableHashMap"),Xie={[GL]:GL,[Symbol.iterator](){return new BM(this)},toString(){return vr(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(Hn)}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}};class BM{self;referentialIterator;bucketIterator;constructor(t){this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new Jie(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new BM(this.self)}}class Jie{backing;constructor(t){this.backing=t}currentBucket;next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const Zie=()=>{const e=Object.create(Xie);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},yu=W(2,(e,t)=>{if(KS(t)===!1)return e.referential.has(t)?Oe(e.referential.get(t)):Ae();const n=t[_t](),r=e.buckets.get(n);return r===void 0?Ae():eoe(e,r,t)}),eoe=(e,t,n,r=!1)=>{for(let i=0,o=t.length;i<o;i++)if(n[kt](t[i][0])){const a=t[i][1];return r&&(t.splice(i,1),e.bucketsSize--),Oe(a)}return Ae()},am=W(2,(e,t)=>Pe(yu(e,t))),lm=W(3,(e,t,n)=>{if(KS(t)===!1)return e.referential.set(t,n),e;const r=t[_t](),i=e.buckets.get(r);return i===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(toe(e,i,t),i.push([t,n]),e.bucketsSize++,e)}),toe=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(n[kt](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},YL=Symbol.for("effect/MutableList"),noe={[YL]:YL,[Symbol.iterator](){let e=!1,t=this.head;return{next(){if(e)return this.return();if(t==null)return e=!0,this.return();const n=t.value;return t=t.next,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},toString(){return vr(this.toJSON())},toJSON(){return{_id:"MutableList",values:Array.from(this).map(Hn)}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}},roe=e=>({value:e,removed:!1,prev:void 0,next:void 0}),ioe=()=>{const e=Object.create(noe);return e.head=void 0,e.tail=void 0,e._length=0,e},YV=e=>UM(e)===0,UM=e=>e._length,ooe=W(2,(e,t)=>{const n=roe(t);return e.head===void 0&&(e.head=n),e.tail===void 0||(e.tail.next=n,n.prev=e.tail),e.tail=n,e._length+=1,e}),soe=e=>{const t=e.head;if(t!==void 0)return aoe(e,t),t.value},aoe=(e,t)=>{t.removed||(t.removed=!0,t.prev!==void 0&&t.next!==void 0?(t.prev.next=t.next,t.next.prev=t.prev):t.prev!==void 0?(e.tail=t.prev,t.prev.next=void 0):t.next!==void 0?(e.head=t.next,t.next.prev=void 0):(e.tail=void 0,e.head=void 0),e._length>0&&(e._length-=1))},QL=Symbol.for("effect/MutableQueue"),qn=Symbol.for("effect/mutable/MutableQueue/Empty"),loe={[QL]:QL,[Symbol.iterator](){return Array.from(this.queue)[Symbol.iterator]()},toString(){return vr(this.toJSON())},toJSON(){return{_id:"MutableQueue",values:Array.from(this).map(Hn)}},[Dn](){return this.toJSON()},pipe(){return He(this,arguments)}},QV=e=>{const t=Object.create(loe);return t.queue=ioe(),t.capacity=e,t},XV=e=>QV(e),Cy=()=>QV(void 0),qM=e=>UM(e.queue),Nu=e=>YV(e.queue),coe=e=>e.capacity===void 0?1/0:e.capacity,yc=W(2,(e,t)=>{const n=UM(e.queue);return e.capacity!==void 0&&n===e.capacity?!1:(ooe(t)(e.queue),!0)}),VM=W(2,(e,t)=>{const n=t[Symbol.iterator]();let r,i=an(),o=!0;for(;o&&(r=n.next())&&!r.done;)o=yc(r.value)(e);for(;r!=null&&!r.done;)i=Jr(r.value)(i),r=n.next();return cl(i)}),aa=W(2,(e,t)=>YV(e.queue)?t:soe(e.queue)),tw=W(2,(e,t)=>{let n=an(),r=0;for(;r<t;){const i=aa(qn)(e);if(i===qn)break;n=Jr(i)(n),r+=1}return cl(n)}),uoe="effect/Clock",XL=Symbol.for(uoe),nw=ds("effect/Clock"),doe=2**31-1,JL={unsafeSchedule(e,t){const n=Yu(t);if(n>doe)return Bf;let r=!1;const i=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(i),!r)}},ZL=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))})(),foe=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return ZL;const t=ZL()-e.bigint();return()=>t+e.bigint()})();class hoe{[XL]=XL;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return foe()}currentTimeMillis=Ce(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=Ce(()=>this.unsafeCurrentTimeNanos());scheduler(){return Ie(JL)}sleep(t){return ya(n=>{const r=JL.unsafeSchedule(()=>n(hn),t);return Ci(Ce(r))})}}const poe=()=>new hoe,HM="And",KM="Or",WM="InvalidData",GM="MissingData",YM="SourceUnavailable",QM="Unsupported",moe="effect/ConfigError",e$=Symbol.for(moe),Gh={_tag:"ConfigError",[e$]:e$},JV=(e,t)=>{const n=Object.create(Gh);return n._op=HM,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},ZV=(e,t)=>{const n=Object.create(Gh);return n._op=KM,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},e4=(e,t,n={pathDelim:"."})=>{const r=Object.create(Gh);return r._op=WM,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${Y(this.path,Lh(n.pathDelim))}: "${this.message}")`}}),r},rd=(e,t,n={pathDelim:"."})=>{const r=Object.create(Gh);return r._op=GM,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${Y(this.path,Lh(n.pathDelim))}: "${this.message}")`}}),r},goe=(e,t,n,r={pathDelim:"."})=>{const i=Object.create(Gh);return i._op=YM,i.path=e,i.message=t,i.cause=n,Object.defineProperty(i,"toString",{enumerable:!1,value(){return`(Source unavailable at ${Y(this.path,Lh(r.pathDelim))}: "${this.message}")`}}),i},yoe=(e,t,n={pathDelim:"."})=>{const r=Object.create(Gh);return r._op=QM,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${Y(this.path,Lh(n.pathDelim))}: "${this.message}")`}}),r},wu=W(2,(e,t)=>{switch(e._op){case HM:return JV(wu(e.left,t),wu(e.right,t));case KM:return ZV(wu(e.left,t),wu(e.right,t));case WM:return e4([...t,...e.path],e.message);case GM:return rd([...t,...e.path],e.message);case YM:return goe([...t,...e.path],e.message,e.cause);case QM:return yoe([...t,...e.path],e.message)}}),boe={andCase:(e,t,n)=>t&&n,orCase:(e,t,n)=>t&&n,invalidDataCase:Bf,missingDataCase:sT,sourceUnavailableCase:Bf,unsupportedCase:Bf},voe=W(3,(e,t,n)=>{const r=[e],i=[];for(;r.length>0;){const a=r.pop();switch(a._op){case HM:{r.push(a.right),r.push(a.left),i.push(ct({_op:"AndCase"}));break}case KM:{r.push(a.right),r.push(a.left),i.push(ct({_op:"OrCase"}));break}case WM:{i.push(vt(n.invalidDataCase(t,a.path,a.message)));break}case GM:{i.push(vt(n.missingDataCase(t,a.path,a.message)));break}case YM:{i.push(vt(n.sourceUnavailableCase(t,a.path,a.message,a.cause)));break}case QM:{i.push(vt(n.unsupportedCase(t,a.path,a.message)));break}}}const o=[];for(;i.length>0;){const a=i.pop();switch(a._op){case"Left":{switch(a.left._op){case"AndCase":{const c=o.pop(),u=o.pop(),d=n.andCase(t,c,u);o.push(d);break}case"OrCase":{const c=o.pop(),u=o.pop(),d=n.orCase(t,c,u);o.push(d);break}}break}case"Right":{o.push(a.right);break}}}if(o.length===0)throw new Error("BUG: ConfigError.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return o.pop()}),Soe=e=>voe(e,void 0,boe),xoe={_tag:"Empty"},w1=W(2,(e,t)=>{let n=IM(t),r=e;for(;CM(n);){const i=n.head;switch(i._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=ed(i.first,ed(i.second,n.tail));break}case"MapName":{r=Au(r,i.f),n=n.tail;break}case"Nested":{r=QS(r,i.name),n=n.tail;break}case"Unnested":{if(Y(qm(r),jJ(i.name)))r=qu(r),n=n.tail;else return ct(rd(r,`Expected ${i.name} to be in path in ConfigProvider#unnested`));break}}}return vt(r)}),t4="Constant",woe="Fail",n4="Fallback",koe="Described",r4="Lazy",i4="MapOrFail",o4="Nested",s4="Primitive",_oe="Sequence",Eoe="HashMap",Toe="ZipWith";var t$={};const l0=(e,t)=>[...e,...t],Coe="effect/ConfigProvider",n$=Symbol.for(Coe),a4=ds("effect/ConfigProvider"),Ioe="effect/ConfigProviderFlat",r$=Symbol.for(Ioe),Moe=e=>({[n$]:n$,pipe(){return He(this,arguments)},...e}),Roe=e=>({[r$]:r$,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),Aoe=e=>Moe({load:t=>Se(Ho(e,Vu(),t,!1),n=>Xn(qm(n),{onNone:()=>Rr(rd(Vu(),`Expected a single value having structure: ${t}`)),onSome:Ie})),flattened:e}),Ooe=e=>{const{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},e),r=u=>Y(u,Lh(t)),i=u=>u.split(t),o=()=>typeof process<"u"&&"env"in process&&typeof t$=="object"?t$:{};return Aoe(Roe({load:(u,d,h=!0)=>{const p=r(u),y=o(),g=p in y?Oe(y[p]):Ae();return Y(g,Hx(()=>rd(u,`Expected ${p} to exist in the process context`)),Se(v=>$oe(v,u,d,n,h)))},enumerateChildren:u=>Ce(()=>{const d=o(),y=Object.keys(d).map(g=>i(g.toUpperCase())).filter(g=>{for(let v=0;v<u.length;v++){const S=Y(u,CU(v)),x=g[v];if(x===void 0||S!==x)return!1}return!0}).flatMap(g=>g.slice(u.length,u.length+1));return qte(y)}),patch:xoe}))},Doe=(e,t,n,r)=>{const i=gL(n.length,u=>u>=r.length?Ae():Oe([e(u),u+1])),o=gL(r.length,u=>u>=n.length?Ae():Oe([t(u),u+1])),a=l0(n,i),c=l0(r,o);return[a,c]},Poe=(e,t)=>{let n=t;if(n._tag==="Nested"){const r=e.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return e},Ho=(e,t,n,r)=>{const i=n;switch(i._tag){case t4:return Ie(ws(i.value));case koe:return lt(()=>Ho(e,t,i.config,r));case woe:return Rr(rd(t,i.message));case n4:return Y(lt(()=>Ho(e,t,i.first,r)),yg(o=>i.condition(o)?Y(Ho(e,t,i.second,r),yg(a=>Rr(ZV(o,a)))):Rr(o)));case r4:return lt(()=>Ho(e,t,i.config(),r));case i4:return lt(()=>Y(Ho(e,t,i.original,r),Se(tl(o=>Y(i.mapOrFail(o),Hx(wu(Poe(t,i.original))))))));case o4:return lt(()=>Ho(e,l0(t,ws(i.name)),i.config,r));case s4:return Y(w1(t,e.patch),Se(o=>Y(e.load(o,i,r),Se(a=>{if(a.length===0){const c=Y(YJ(o),On(()=>"<n/a>"));return Rr(rd([],`Expected ${i.description} with name ${c}`))}return Ie(a)}))));case _oe:return Y(w1(t,e.patch),Se(o=>Y(e.enumerateChildren(o),Se(Foe),Se(a=>a.length===0?lt(()=>ot(Ho(e,t,i.config,!0),ws)):Y(tl(a,c=>Ho(e,qJ(t,`[${c}]`),i.config,!0)),ot(c=>{const u=rZ(c);return u.length===0?ws(Vu()):ws(u)}))))));case Eoe:return lt(()=>Y(w1(t,e.patch),Se(o=>Y(e.enumerateChildren(o),Se(a=>Y(a,tl(c=>Ho(e,l0(o,ws(c)),i.valueConfig,r)),ot(c=>c.length===0?ws(TM()):Y(joe(c),Au(u=>nne(mL(zn(a),u)))))))))));case Toe:return lt(()=>Y(Ho(e,t,i.left,r),bh,Se(o=>Y(Ho(e,t,i.right,r),bh,Se(a=>{if(si(o)&&si(a))return Rr(JV(o.left,a.left));if(si(o)&&ta(a))return Rr(o.left);if(ta(o)&&si(a))return Rr(a.left);if(ta(o)&&ta(a)){const c=Y(t,Lh(".")),u=Noe(t,c),[d,h]=Doe(u,u,Y(o.right,Au(vt)),Y(a.right,Au(vt)));return Y(d,mL(h),tl(([p,y])=>Y(AV(p,y),ot(([g,v])=>i.zip(g,v)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},Noe=(e,t)=>n=>ct(rd(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),Loe=(e,t)=>e.split(new RegExp(`\\s*${XS(t)}\\s*`)),$oe=(e,t,n,r,i)=>i?Y(Loe(e,r),tl(o=>n.parse(o.trim())),Hx(wu(t))):Y(n.parse(e),MV({onFailure:wu(t),onSuccess:ws})),joe=e=>Object.keys(e[0]).map(t=>e.map(n=>n[t])),Foe=e=>Y(tl(e,Boe),MV({onFailure:()=>Vu(),onSuccess:ug(sh)}),bh,ot(RJ)),zoe=/^(\[(\d+)\])$/,Boe=e=>{const t=e.match(zoe);if(t!==null){const n=t[2];return Y(n!==void 0&&n.length>0?Oe(n):Ae(),xx(Uoe))}return Ae()},Uoe=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?Ae():Oe(t)},i$=Symbol.for("effect/Console"),rw=ds("effect/Console"),qoe={[i$]:i$,assert(e,...t){return Ce(()=>{console.assert(e,...t)})},clear:Ce(()=>{console.clear()}),count(e){return Ce(()=>{console.count(e)})},countReset(e){return Ce(()=>{console.countReset(e)})},debug(...e){return Ce(()=>{console.debug(...e)})},dir(e,t){return Ce(()=>{console.dir(e,t)})},dirxml(...e){return Ce(()=>{console.dirxml(...e)})},error(...e){return Ce(()=>{console.error(...e)})},group(e){return e?.collapsed?Ce(()=>console.groupCollapsed(e?.label)):Ce(()=>console.group(e?.label))},groupEnd:Ce(()=>{console.groupEnd()}),info(...e){return Ce(()=>{console.info(...e)})},log(...e){return Ce(()=>{console.log(...e)})},table(e,t){return Ce(()=>{console.table(e,t)})},time(e){return Ce(()=>console.time(e))},timeEnd(e){return Ce(()=>console.timeEnd(e))},timeLog(e,...t){return Ce(()=>{console.timeLog(e,...t)})},trace(...e){return Ce(()=>{console.trace(...e)})},warn(...e){return Ce(()=>{console.warn(...e)})},unsafe:console},Voe="effect/Random",o$=Symbol.for(Voe),Hoe=ds("effect/Random");class Koe{seed;[o$]=o$;PRNG;constructor(t){this.seed=t,this.PRNG=new eJ(t)}get next(){return Ce(()=>this.PRNG.number())}get nextBoolean(){return ot(this.next,t=>t>.5)}get nextInt(){return Ce(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,n){return ot(this.next,r=>(n-t)*r+t)}nextIntBetween(t,n){return Ce(()=>this.PRNG.integer(n-t)+t)}shuffle(t){return Woe(t,n=>this.nextIntBetween(0,n))}}const Woe=(e,t)=>lt(()=>Y(Ce(()=>Array.from(e)),Se(n=>{const r=[];for(let i=n.length;i>=2;i=i-1)r.push(i);return Y(r,qx(i=>Y(t(i),ot(o=>Goe(n,i-1,o)))),Zr(ga(n)))}))),Goe=(e,t,n)=>{const r=e[t];return e[t]=e[n],e[n]=r,e},Yoe=e=>new Koe(Ge(e)),s$=Symbol.for("effect/Tracer"),Qoe=e=>({[s$]:s$,...e}),l4=ds("effect/Tracer"),c4=ds("effect/ParentSpan"),a$=(function(){const e="abcdef0123456789",t=e.length;return function(n){let r="";for(let i=0;i<n;i++)r+=e.charAt(Math.floor(Math.random()*t));return r}})();class Xoe{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(t,n,r,i,o,a){this.name=t,this.parent=n,this.context=r,this.startTime=o,this.kind=a,this.status={_tag:"Started",startTime:o},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:a$(32),this.spanId=a$(16),this.links=Array.from(i)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}}const Joe=Qoe({span:(e,t,n,r,i,o)=>new Xoe(e,t,n,r,i,o),context:e=>e()}),Zoe=Y(uy(),oc(nw,poe()),oc(rw,qoe),oc(Hoe,Yoe(Math.random())),oc(a4,Ooe()),oc(l4,Joe)),vh=Wt(Symbol.for("effect/DefaultServices/currentServices"),()=>$V(Zoe)),ese=e=>{const t=Ro(e);return XM(n=>n.sleep(t))},u4=e=>Nt(t=>e(t.currentDefaultServices)),XM=e=>u4(t=>e(t.unsafeMap.get(nw.key))),tse=XM(e=>e.currentTimeMillis),nse=e=>u4(t=>e(t.unsafeMap.get(a4.key))),rse=e=>nse(t=>t.load(e)),JM=ese,Sg=tse,ise=XM;function ose(e){return new bc(e)}function sse(){return ose(new Map)}const l$=Symbol.for("effect/FiberRefs");class bc{locals;[l$]=l$;constructor(t){this.locals=t}pipe(){return He(this,arguments)}}const ase=(e,t,n,r=!1)=>{const i=e;let o=t,a=n,c=r,u;for(;u===void 0;)if(Sr(o)&&Sr(a)){const d=Bi(o)[0],h=qu(o),p=Bi(a)[0],y=Bi(a)[1],g=qu(a);d.startTimeMillis<p.startTimeMillis?(a=g,c=!0):d.startTimeMillis>p.startTimeMillis?o=h:d.id<p.id?(a=g,c=!0):d.id>p.id?o=h:u=[y,c]}else u=[i.initial,!0];return u},lse=W(3,(e,t,n)=>{const r=new Map(e.locals);return n.locals.forEach((i,o)=>{const a=i[0][1];if(!i[0][0][kt](t)){if(!r.has(o)){if(ht(a,o.initial))return;r.set(o,[[t,o.join(o.initial,a)]]);return}const c=r.get(o),[u,d]=ase(o,c,i);if(d){const h=o.diff(u,a),p=c[0][1],y=o.join(p,o.patch(h)(p));if(!ht(p,y)){let g;const v=c[0][0];v[kt](t)?g=[[v,y],...c.slice(1)]:g=[[t,y],...c],r.set(o,g)}}}}),new bc(r)}),cse=W(2,(e,t)=>{const n=new Map;return d4(e,n,t),new bc(n)}),d4=(e,t,n)=>{e.locals.forEach((r,i)=>{const o=r[0][1],a=i.patch(i.fork)(o);ht(o,a)?t.set(i,r):t.set(i,[[n,a],...r])})},f4=W(2,(e,t)=>{const n=new Map(e.locals);return n.delete(t),new bc(n)}),use=W(2,(e,t)=>e.locals.has(t)?Oe(Bi(e.locals.get(t))[1]):Ae()),xg=W(2,(e,t)=>Y(use(e,t),On(()=>t.initial))),NT=W(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new bc(new Map([[n,[[t,r]]]]));const i=new Map(e.locals);return LT(i,t,n,r),new bc(i)}),LT=(e,t,n,r)=>{const i=e.get(n)??[];let o;if(Sr(i)){const[a,c]=Bi(i);if(a[kt](t)){if(ht(c,r))return;o=[[t,r],...i.slice(1)]}else o=[[t,r],...i]}else o=[[t,r]];e.set(n,o)},dse=W(2,(e,{entries:t,forkAs:n})=>{if(e.locals.size===0)return new bc(new Map(t));const r=new Map(e.locals);return n!==void 0&&d4(e,r,n),t.forEach(([i,o])=>{o.length===1?LT(r,o[0][0],i,o[0][1]):o.forEach(([a,c])=>{LT(r,a,i,c)})}),new bc(r)}),ZM=xg,fse=dse,hse=sse,pse=fie,mse=hie,h4=pie,p4=DV,m4=PV,g4=NV,gse=mie,yse=gie,bse=Y(sh,kU(e=>e.ordinal)),vse=DJ(bse),Sse=e=>{switch(e){case"All":return pse;case"Debug":return g4;case"Error":return h4;case"Fatal":return mse;case"Info":return m4;case"Trace":return gse;case"None":return yse;case"Warning":return p4}},y4=e=>e.replace(/[\s="]/g,"_"),eR=e=>t=>`${y4(t.label)}=${e-t.startTime}ms`,xse=sy,wse=gd,kse=vJ;class Yh extends kse{}const Sh=Symbol.for("effect/Readable"),tR=Symbol.for("effect/Ref"),nR={_A:e=>e};class _se extends Yh{ref;commit(){return this.get}[tR]=nR;[Sh]=Sh;constructor(t){super(),this.ref=t,this.get=Ce(()=>Ft(this.ref))}get;modify(t){return Ce(()=>{const n=Ft(this.ref),[r,i]=t(n);return n!==i&&vd(i)(this.ref),r})}}const rR=e=>new _se(bd(e)),c0=e=>Ce(()=>rR(e)),la=e=>e.get,Kf=W(2,(e,t)=>e.modify(()=>[void 0,t])),b4=W(2,(e,t)=>e.modify(t)),u0=W(2,(e,t)=>e.modify(n=>[void 0,t(n)])),Ese=W(2,(e,t)=>e.modify(n=>{const r=t(n);return[r,r]})),Tse=tR,Kn=c0,Ui=la,mr=b4,id=Kf,is=u0,Cse=Ese,v4="Empty",S4="Add",x4="Remove",w4="Update",k4="AndThen",Ise={_tag:v4},_4=(e,t)=>{const n=new Map(e.locals);let r=Ise;for(const[i,o]of t.locals.entries()){const a=Bi(o)[1],c=n.get(i);if(c!==void 0){const u=Bi(c)[1];ht(u,a)||(r=k1({_tag:w4,fiberRef:i,patch:i.diff(u,a)})(r))}else r=k1({_tag:S4,fiberRef:i,value:a})(r);n.delete(i)}for(const[i]of n.entries())r=k1({_tag:x4,fiberRef:i})(r);return r},k1=W(2,(e,t)=>({_tag:k4,first:e,second:t})),E4=W(3,(e,t,n)=>{let r=n,i=ws(e);for(;Sr(i);){const o=Bi(i),a=qu(i);switch(o._tag){case v4:{i=a;break}case S4:{r=NT(r,{fiberId:t,fiberRef:o.fiberRef,value:o.value}),i=a;break}case x4:{r=f4(r,o.fiberRef),i=a;break}case w4:{const c=xg(r,o.fiberRef);r=NT(r,{fiberId:t,fiberRef:o.fiberRef,value:o.fiberRef.patch(o.patch)(c)}),i=a;break}case k4:{i=QS(o.first)(QS(o.second)(a));break}}}return r}),T4="effect/MetricLabel",$T=Symbol.for(T4);class Mse{key;value;[$T]=$T;_hash;constructor(t,n){this.key=t,this.value=n,this._hash=ir(T4+this.key+this.value)}[_t](){return this._hash}[kt](t){return Ase(t)&&this.key===t.key&&this.value===t.value}pipe(){return He(this,arguments)}}const Rse=(e,t)=>new Mse(e,t),Ase=e=>st(e,$T),Ose=W(e=>xa(e[0]),function(){const e=arguments;return LV(e[0],FV,typeof e[1]=="string"?n0(e[1],e[2]):t=>Object.entries(e[1]).reduce((n,[r,i])=>n0(n,r,i),t))}),Dse=e=>ot(e,Oe),Pse=W(2,(e,t)=>Ao(e,{onFailure:n=>{const r=t(n);switch(r._tag){case"None":return xr(n);case"Some":return r.value}},onSuccess:Ie})),Nse=ise,C4=e=>Kse(e,$se,_4),I4=W(2,(e,t)=>hl(e,{onFailure:n=>Ie(t.onFailure(n)),onSuccess:n=>Ie(t.onSuccess(n))})),Lse=e=>{const t=Se(Se(e,()=>xy()),()=>t);return t},$se=Nt(e=>Ie(e.getFiberRefs())),jse=e=>I4(e,{onFailure:VS,onSuccess:VS}),iw=e=>(...t)=>{const n=ay(e);let r;for(let i=0,o=t.length;i<o;i++){const a=t[i];aV(a)&&(r!==void 0?r=Yr(r,a):r=a,t=[...t.slice(0,i),...t.slice(i+1)],i--)}return r===void 0&&(r=fl),Nt(i=>(i.log(t,r,n),hn))},Fse=iw(g4),zse=iw(m4),Bse=iw(p4),Use=iw(h4),c$=W(2,(e,t)=>Ao(e,{onFailure:n=>TV(()=>t(n)),onSuccess:Ie})),qse=e=>ot(e,t=>!t),M4=e=>Yse((t,n)=>Y(e,E4(t,n))),Vse=e=>e.length>=1?ya((t,n)=>{try{e(n).then(r=>t(Ie(r)),r=>t(ra(r)))}catch(r){t(ra(r))}}):ya(t=>{try{e().then(n=>t(Ie(n)),n=>t(ra(n)))}catch(n){t(ra(n))}}),R4=W(3,(e,t,n)=>Ed(r=>Wh(e,oc(r,t,n)))),jT=W(3,(e,t,n)=>Ed(r=>Se(n,i=>Wh(e,Y(r,oc(t,i)))))),iR=JM,Hse=Ie(Ae()),Kse=W(3,(e,t,n)=>Se(t,r=>Se(e,i=>ot(t,o=>[n(r,o),i])))),Wse=W(2,(e,t)=>Ao(e,{onFailure:n=>Br(t(n),xr(n)),onSuccess:Ie})),Gse=e=>{let t,n;typeof e=="function"?t=e:(t=e.try,n=e.catch);const r=i=>n?by(()=>n(i)):Rr(new UV(i,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?ya((i,o)=>{try{t(o).then(a=>i(Ie(a)),a=>i(r(a)))}catch(a){i(r(a))}}):ya(i=>{try{t().then(o=>i(Ie(o)),o=>i(r(o)))}catch(o){i(r(o))}})},Yse=e=>Nt(t=>(t.setFiberRefs(e(t.id(),t.getFiberRefs())),hn)),Qse=W(2,(e,t)=>lt(()=>t()?ot(e,Oe):Ie(Ae()))),Xse=e=>ot(ew(),ts(e)),A4="Sequential",O4="Parallel",Jse="ParallelN",cc={_tag:A4},FT={_tag:O4},Zse=e=>({_tag:Jse,parallelism:e}),eae=e=>e._tag===A4,tae=e=>e._tag===O4,d0=cc,zT=FT,BT=Zse,wg=_4,kg=E4,ow="effect/FiberStatus",od=Symbol.for(ow),f0="Done",u$="Running",d$="Suspended",nae=ir(`${ow}-${f0}`);let rae=class{[od]=od;_tag=f0;[_t](){return nae}[kt](t){return oR(t)&&t._tag===f0}};class iae{runtimeFlags;[od]=od;_tag=u$;constructor(t){this.runtimeFlags=t}[_t](){return Y(Ge(ow),qt(Ge(this._tag)),qt(Ge(this.runtimeFlags)),Jn(this))}[kt](t){return oR(t)&&t._tag===u$&&this.runtimeFlags===t.runtimeFlags}}class oae{runtimeFlags;blockingOn;[od]=od;_tag=d$;constructor(t,n){this.runtimeFlags=t,this.blockingOn=n}[_t](){return Y(Ge(ow),qt(Ge(this._tag)),qt(Ge(this.runtimeFlags)),qt(Ge(this.blockingOn)),Jn(this))}[kt](t){return oR(t)&&t._tag===d$&&this.runtimeFlags===t.runtimeFlags&&ht(this.blockingOn,t.blockingOn)}}const sae=new rae,aae=e=>new iae(e),lae=(e,t)=>new oae(e,t),oR=e=>st(e,od),cae=e=>e._tag===f0,uae=sae,D4=aae,dae=lae,fae=cae,hae=Symbol.for("effect/Micro"),h0=Symbol.for("effect/Micro/MicroExit"),f$=Symbol.for("effect/Micro/MicroCause"),pae={_E:Mt};class P4 extends globalThis.Error{_tag;traces;[f$];constructor(t,n,r){const i=`MicroCause.${t}`;let o,a,c;if(n instanceof globalThis.Error){o=`(${i}) ${n.name}`,a=n.message;const u=a.split(`
28
+ `).length;c=n.stack?`(${i}) ${n.stack.split(`
29
+ `).slice(0,u+3).join(`
30
+ `)}`:`${o}: ${a}`}else o=i,a=ih(n,0),c=`${o}: ${a}`;r.length>0&&(c+=`
31
+ ${r.join(`
32
+ `)}`),super(a),this._tag=t,this.traces=r,this[f$]=pae,this.name=o,this.stack=c}pipe(){return He(this,arguments)}toString(){return this.stack}[Dn](){return this.stack}}class mae extends P4{defect;constructor(t,n=[]){super("Die",t,n),this.defect=t}}const gae=(e,t=[])=>new mae(e,t);class yae extends P4{constructor(t=[]){super("Interrupt","interrupted",t)}}const bae=(e=[])=>new yae(e),vae=e=>e._tag==="Interrupt",h$=Symbol.for("effect/Micro/MicroFiber"),Sae={_A:Mt,_E:Mt};class xae{context;interruptible;[h$];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(t,n=!0){this.context=t,this.interruptible=n,this[h$]=Sae}getRef(t){return _ee(this.context,t)}addObserver(t){return this._exit?(t(this._exit),VS):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(uR))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const i=this._yielded;this._yielded=void 0,i()}const n=this.runLoop(t);if(n===Sv)return;const r=p$.interruptChildren&&p$.interruptChildren(this);if(r!==void 0)return this.evaluate(m0(r,()=>n));this._exit=n;for(let i=0;i<this._observers.length;i++)this._observers[i](n);this._observers.length=0}runLoop(t){let n=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(dR).shouldYield(this)){n=!0;const i=r;r=m0(Tae,()=>i)}if(r=r[UT](this),r===Sv){const i=this._yielded;return h0 in i?(this._yielded=void 0,i):Sv}}}catch(i){return st(r,UT)?qT(i):qT(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[p0]&&n[p0](this);if(r)return{[t]:r};if(n[t])return n}}_yielded=void 0;yieldWith(t){return this._yielded=t,Sv}children(){return this._children??=new Set}}const p$=Wt("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),N4=Symbol.for("effect/Micro/identifier"),Ur=Symbol.for("effect/Micro/args"),UT=Symbol.for("effect/Micro/evaluate"),xh=Symbol.for("effect/Micro/successCont"),Wf=Symbol.for("effect/Micro/failureCont"),p0=Symbol.for("effect/Micro/ensureCont"),Sv=Symbol.for("effect/Micro/Yield"),wae={_A:Mt,_E:Mt,_R:Mt},kae={...xse,_op:"Micro",[hae]:wae,pipe(){return He(this,arguments)},[Symbol.iterator](){return new tU(new iy(this))},toJSON(){return{_id:"Micro",op:this[N4],...Ur in this?{args:this[Ur]}:void 0}},toString(){return vr(this)},[Dn](){return vr(this)}};function _ae(e){return qT("Micro.evaluate: Not implemented")}const sw=e=>({...kae,[N4]:e.op,[UT]:e.eval??_ae,[xh]:e.contA,[Wf]:e.contE,[p0]:e.ensure}),sR=e=>{const t=sw(e);return function(){const n=Object.create(t);return n[Ur]=e.single===!1?arguments:arguments[0],n}},L4=e=>{const t={...sw(e),[h0]:h0,_tag:e.op,get[e.prop](){return this[Ur]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[Ur]}},[kt](n){return Mae(n)&&n._tag===e.op&&ht(this[Ur],n[Ur])},[_t](){return Jn(this,qt(ir(e.op))(Ge(this[Ur])))}};return function(n){const r=Object.create(t);return r[Ur]=n,r[xh]=void 0,r[Wf]=void 0,r[p0]=void 0,r}},aR=L4({op:"Success",prop:"value",eval(e){const t=e.getCont(xh);return t?t[xh](this[Ur],e):e.yieldWith(this)}}),$4=L4({op:"Failure",prop:"cause",eval(e){let t=e.getCont(Wf);for(;vae(this[Ur])&&t&&e.interruptible;)t=e.getCont(Wf);return t?t[Wf](this[Ur],e):e.yieldWith(this)}}),Eae=sR({op:"Yield",eval(e){let t=!1;return e.getRef(dR).scheduleTask(()=>{t||e.evaluate(Rae)},this[Ur]??0),e.yieldWith(()=>{t=!0})}}),Tae=Eae(0),Cae=aR(void 0),lR=sR({op:"WithMicroFiber",eval(e){return this[Ur](e)}}),m0=W(2,(e,t)=>{const n=Object.create(Iae);return n[Ur]=e,n[xh]=t,n}),Iae=sw({op:"OnSuccess",eval(e){return e._stack.push(this),this[Ur]}}),Mae=e=>st(e,h0),j4=aR,cR=$4,uR=cR(bae()),qT=e=>cR(gae(e)),Rae=j4(void 0),Aae="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class F4{tasks=[];running=!1;scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,Aae(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n<r;n++)t[n]()}shouldYield(t){return t.currentOpCount>=t.getRef(Pae)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const Oae=W(2,(e,t)=>lR(n=>{const r=n.context;return n.context=t(r),$ae(e,()=>(n.context=r,Cae))})),Dae=W(2,(e,t)=>Oae(e,Oc(t)));class Pae extends Cx()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class dR extends Cx()("effect/Micro/currentScheduler",{defaultValue:()=>new F4}){}const Nae=W(2,(e,t)=>{const n=Object.create(Lae);return n[Ur]=e,n[xh]=t.onSuccess,n[Wf]=t.onFailure,n}),Lae=sw({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[Ur]}}),$ae=W(2,(e,t)=>Fae(n=>Nae(n(e),{onFailure:r=>m0(t(cR(r)),()=>$4(r)),onSuccess:r=>m0(t(j4(r)),()=>aR(r))}))),z4=sR({op:"SetInterruptible",ensure(e){if(e.interruptible=this[Ur],e._interrupted&&e.interruptible)return()=>uR}}),jae=e=>lR(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(z4(!1)),t._interrupted?uR:e)),Fae=e=>lR(t=>t.interruptible?(t.interruptible=!1,t._stack.push(z4(!0)),e(jae)):e(Mt)),zae=(e,t)=>{const n=new xae(dR.context(new F4));return n.evaluate(e),n};class B4{buckets=[];scheduleTask(t,n){const r=this.buckets.length;let i,o=0;for(;o<r&&this.buckets[o][0]<=n;o++)i=this.buckets[o];i&&i[0]===n?i[1].push(t):o===r?this.buckets.push([n,[t]]):this.buckets.splice(o,0,[n,[t]])}}class Bae{maxNextTickBeforeTimer;running=!1;tasks=new B4;constructor(t){this.maxNextTickBeforeTimer=t}starveInternal(t){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,i]of n)for(let o=0;o<i.length;o++)i[o]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(jV)?t.getFiberRef(_y):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const U4=Wt(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new Bae(2048));class q4{tasks=new B4;deferred=!1;scheduleTask(t,n){this.deferred?U4.scheduleTask(t,n):this.tasks.scheduleTask(t,n)}shouldYield(t){return t.currentOpCount>t.getFiberRef(jV)?t.getFiberRef(_y):!1}flush(){for(;this.tasks.buckets.length>0;){const t=this.tasks.buckets;this.tasks.buckets=[];for(const[n,r]of t)for(let i=0;i<r.length;i++)r[i]()}this.deferred=!0}}const fR=Wt(Symbol.for("effect/FiberRef/currentScheduler"),()=>Vi(U4)),V4=Wt(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Vi(new Map)),m$=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return ky(Tie,i=>i==="unbounded"?n():i>1?r(i):t());default:return e>1?r(e):t()}},hR="InterruptSignal",pR="Stateful",mR="Resume",gR="YieldNow",_1=e=>({_tag:hR,cause:e}),gS=e=>({_tag:pR,onFiber:e}),hf=e=>({_tag:mR,effect:e}),Uae=()=>({_tag:gR}),qae="effect/FiberScope",g0=Symbol.for(qae);class Vae{[g0]=g0;fiberId=Zu;roots=new Set;add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}class Hae{fiberId;parent;[g0]=g0;constructor(t,n){this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(gS(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const Kae=e=>new Hae(e.id(),e),Iy=Wt(Symbol.for("effect/FiberScope/Global"),()=>new Vae),Wae="effect/Fiber",Gae=Symbol.for(Wae),Yae={_E:e=>e,_A:e=>e},Qae="effect/Fiber",Xae=Symbol.for(Qae),Jae=e=>e.await,Zae=e=>e.inheritAll,_g=e=>Wx(kd(e.await),e.inheritAll);({...gd});const ele=e=>e.poll,uu="effect/FiberCurrent",tle="effect/Logger",nle=Symbol.for(tle),rle={_Message:e=>e,_Output:e=>e},My=e=>({[nle]:rle,log:e,pipe(){return He(this,arguments)}}),ile=/^[^\s"=]*$/,ole=(e,t)=>({annotations:n,cause:r,date:i,fiberId:o,logLevel:a,message:c,spans:u})=>{const d=v=>v.match(ile)?v:e(v),h=(v,S)=>`${y4(v)}=${d(S)}`,p=(v,S)=>" "+h(v,S);let y=h("timestamp",i.toISOString());y+=p("level",a.label),y+=p("fiber",Lx(o));const g=XI(c);for(let v=0;v<g.length;v++)y+=p("message",ih(g[v],t));Lre(r)||(y+=p("cause",Dc(r,{renderErrorCause:!0})));for(const v of u)y+=" "+eR(i.getTime())(v);for(const[v,S]of n)y+=p(v,ih(S,t));return y},sle=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,ale=My(ole(sle)),H4=e=>{switch(typeof e){case"bigint":case"function":case"symbol":return String(e);default:return Hn(e)}},lle=(e,...t)=>{let n="";for(let r=0;r<t.length;r++)n+=`\x1B[${t[r]}m`;return n+e+"\x1B[0m"},cle=(e,...t)=>e,Yo={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},ule={None:[],All:[],Trace:[Yo.gray],Debug:[Yo.blue],Info:[Yo.green],Warning:[Yo.yellow],Error:[Yo.red],Fatal:[Yo.bgBrightRed,Yo.black]},dle={None:"",All:"",Trace:"color:gray",Debug:"color:blue",Info:"color:green",Warning:"color:orange",Error:"color:red",Fatal:"background-color:red;color:white"},fle=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`,K4=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null,hle=K4&&process.stdout.isTTY===!0,ple=K4||"Deno"in globalThis,mle=e=>{const t=e?.mode??"auto",r=(t==="auto"?ple?"tty":"browser":t)==="browser",i=typeof e?.colors=="boolean"?e.colors:hle||r,o=e?.formatDate??fle;return r?yle({colors:i,formatDate:o}):gle({colors:i,formatDate:o,stderr:e?.stderr===!0})},gle=e=>{const t=e.colors?lle:cle;return My(({annotations:n,cause:r,context:i,date:o,fiberId:a,logLevel:c,message:u,spans:d})=>{const h=ZM(i,vh),p=ma(h,rw).unsafe,y=e.stderr===!0?p.error:p.log,g=XI(u);let v=t(`[${e.formatDate(o)}]`,Yo.white)+` ${t(c.label,...ule[c._tag])} (${Lx(a)})`;if(CM(d)){const x=o.getTime(),k=eR(x);for(const _ of d)v+=" "+k(_)}v+=":";let S=0;if(g.length>0){const x=H4(g[0]);typeof x=="string"&&(v+=" "+t(x,Yo.bold,Yo.cyan),S++)}if(y(v),p.group(),AM(r)||y(Dc(r,{renderErrorCause:!0})),S<g.length)for(;S<g.length;S++)y(cg(g[S]));if(Uq(n)>0)for(const[x,k]of n)y(t(`${x}:`,Yo.bold,Yo.white),cg(k));p.groupEnd()})},yle=e=>{const t=e.colors?"%c":"";return My(({annotations:n,cause:r,context:i,date:o,fiberId:a,logLevel:c,message:u,spans:d})=>{const h=ZM(i,vh),p=ma(h,rw).unsafe,y=XI(u);let g=`${t}[${e.formatDate(o)}]`;const v=[];if(e.colors&&v.push("color:gray"),g+=` ${t}${c.label}${t} (${Lx(a)})`,e.colors&&v.push(dle[c._tag],""),CM(d)){const x=o.getTime(),k=eR(x);for(const _ of d)g+=" "+k(_)}g+=":";let S=0;if(y.length>0){const x=H4(y[0]);typeof x=="string"&&(g+=` ${t}${x}`,e.colors&&v.push("color:deepskyblue"),S++)}if(p.groupCollapsed(g,...v),AM(r)||p.error(Dc(r,{renderErrorCause:!0})),S<y.length)for(;S<y.length;S++)p.log(cg(y[S]));if(Uq(n)>0)for(const[x,k]of n){const _=cg(k);e.colors?p.log(`%c${x}:`,"color:gray",_):p.log(`${x}:`,_)}p.groupEnd()})},W4="effect/MetricBoundaries",VT=Symbol.for(W4);class ble{values;[VT]=VT;constructor(t){this.values=t,this._hash=Y(ir(W4),qt(oy(this.values)))}_hash;[_t](){return this._hash}[kt](t){return vle(t)&&ht(this.values,t.values)}pipe(){return He(this,arguments)}}const vle=e=>st(e,VT),Sle=e=>{const t=Y(e,EU(In(Number.POSITIVE_INFINITY)),oZ);return new ble(t)},xle=e=>Y(BJ(e.count-1,t=>e.start*Math.pow(e.factor,t)),Ns,Sle),wle="effect/MetricKeyType",G4=Symbol.for(wle),Y4="effect/MetricKeyType/Counter",HT=Symbol.for(Y4),kle="effect/MetricKeyType/Frequency",_le=Symbol.for(kle),Ele="effect/MetricKeyType/Gauge",Tle=Symbol.for(Ele),Q4="effect/MetricKeyType/Histogram",KT=Symbol.for(Q4),Cle="effect/MetricKeyType/Summary",Ile=Symbol.for(Cle),X4={_In:e=>e,_Out:e=>e};class Mle{incremental;bigint;[G4]=X4;[HT]=HT;constructor(t,n){this.incremental=t,this.bigint=n,this._hash=ir(Y4)}_hash;[_t](){return this._hash}[kt](t){return J4(t)}pipe(){return He(this,arguments)}}class Rle{boundaries;[G4]=X4;[KT]=KT;constructor(t){this.boundaries=t,this._hash=Y(ir(Q4),qt(Ge(this.boundaries)))}_hash;[_t](){return this._hash}[kt](t){return Z4(t)&&ht(this.boundaries,t.boundaries)}pipe(){return He(this,arguments)}}const Ale=e=>new Mle(e?.incremental??!1,e?.bigint??!1),Ole=e=>new Rle(e),J4=e=>st(e,HT),Dle=e=>st(e,_le),Ple=e=>st(e,Tle),Z4=e=>st(e,KT),Nle=e=>st(e,Ile),Lle="effect/MetricKey",e5=Symbol.for(Lle),$le={_Type:e=>e},jle=ZI(ht);class yR{name;keyType;description;tags;[e5]=$le;constructor(t,n,r,i=[]){this.name=t,this.keyType=n,this.description=r,this.tags=i,this._hash=Y(ir(this.name+this.description),qt(Ge(this.keyType)),qt(oy(this.tags)))}_hash;[_t](){return this._hash}[kt](t){return Fle(t)&&this.name===t.name&&ht(this.keyType,t.keyType)&&ht(this.description,t.description)&&jle(this.tags,t.tags)}pipe(){return He(this,arguments)}}const Fle=e=>st(e,e5),zle=(e,t)=>new yR(e,Ale(t),ay(t?.description)),Ble=(e,t,n)=>new yR(e,Ole(t),ay(n)),Ule=W(2,(e,t)=>t.length===0?e:new yR(e.name,e.keyType,e.description,fS(e.tags,t))),qle="effect/MetricState",Ry=Symbol.for(qle),t5="effect/MetricState/Counter",WT=Symbol.for(t5),n5="effect/MetricState/Frequency",GT=Symbol.for(n5),r5="effect/MetricState/Gauge",YT=Symbol.for(r5),i5="effect/MetricState/Histogram",QT=Symbol.for(i5),o5="effect/MetricState/Summary",XT=Symbol.for(o5),Ay={_A:e=>e};class Vle{count;[Ry]=Ay;[WT]=WT;constructor(t){this.count=t}[_t](){return Y(Ge(t5),qt(Ge(this.count)),Jn(this))}[kt](t){return tce(t)&&this.count===t.count}pipe(){return He(this,arguments)}}const Hle=ZI(ht);class Kle{occurrences;[Ry]=Ay;[GT]=GT;constructor(t){this.occurrences=t}_hash;[_t](){return Y(ir(n5),qt(oy(zn(this.occurrences.entries()))),Jn(this))}[kt](t){return nce(t)&&Hle(zn(this.occurrences.entries()),zn(t.occurrences.entries()))}pipe(){return He(this,arguments)}}class Wle{value;[Ry]=Ay;[YT]=YT;constructor(t){this.value=t}[_t](){return Y(Ge(r5),qt(Ge(this.value)),Jn(this))}[kt](t){return rce(t)&&this.value===t.value}pipe(){return He(this,arguments)}}class Gle{buckets;count;min;max;sum;[Ry]=Ay;[QT]=QT;constructor(t,n,r,i,o){this.buckets=t,this.count=n,this.min=r,this.max=i,this.sum=o}[_t](){return Y(Ge(i5),qt(Ge(this.buckets)),qt(Ge(this.count)),qt(Ge(this.min)),qt(Ge(this.max)),qt(Ge(this.sum)),Jn(this))}[kt](t){return ice(t)&&ht(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return He(this,arguments)}}class Yle{error;quantiles;count;min;max;sum;[Ry]=Ay;[XT]=XT;constructor(t,n,r,i,o,a){this.error=t,this.quantiles=n,this.count=r,this.min=i,this.max=o,this.sum=a}[_t](){return Y(Ge(o5),qt(Ge(this.error)),qt(Ge(this.quantiles)),qt(Ge(this.count)),qt(Ge(this.min)),qt(Ge(this.max)),qt(Ge(this.sum)),Jn(this))}[kt](t){return oce(t)&&this.error===t.error&&ht(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return He(this,arguments)}}const Qle=e=>new Vle(e),Xle=e=>new Kle(e),Jle=e=>new Wle(e),Zle=e=>new Gle(e.buckets,e.count,e.min,e.max,e.sum),ece=e=>new Yle(e.error,e.quantiles,e.count,e.min,e.max,e.sum),tce=e=>st(e,WT),nce=e=>st(e,GT),rce=e=>st(e,YT),ice=e=>st(e,QT),oce=e=>st(e,XT),sce="effect/MetricHook",ace=Symbol.for(sce),lce={_In:e=>e,_Out:e=>e},Oy=e=>({[ace]:lce,pipe(){return He(this,arguments)},...e}),g$=BigInt(0),cce=e=>{let t=e.keyType.bigint?g$:0;const n=e.keyType.incremental?e.keyType.bigint?i=>i>=g$:i=>i>=0:i=>!0,r=i=>{n(i)&&(t=t+i)};return Oy({get:()=>Qle(t),update:r,modify:r})},uce=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const i=t.get(r)??0;t.set(r,i+1)};return Oy({get:()=>Xle(t),update:n,modify:n})},dce=(e,t)=>{let n=t;return Oy({get:()=>Jle(n),update:r=>{n=r},modify:r=>{n=n+r}})},fce=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),i=new Float64Array(n);let o=0,a=0,c=Number.MAX_VALUE,u=Number.MIN_VALUE;Y(t,ug(sh),Au((p,y)=>{i[y]=p}));const d=p=>{let y=0,g=n;for(;y!==g;){const v=Math.floor(y+(g-y)/2),S=i[v];p<=S?g=v:y=v,g===y+1&&(p<=i[y]?g=y:y=g)}r[y]=r[y]+1,o=o+1,a=a+p,p<c&&(c=p),p>u&&(u=p)},h=()=>{const p=wx(n);let y=0;for(let g=0;g<n;g++){const v=i[g],S=r[g];y=y+S,p[g]=[v,y]}return p};return Oy({get:()=>Zle({buckets:h(),count:o,min:c,max:u,sum:a}),update:d,modify:d})},hce=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:i}=e.keyType,o=Y(i,ug(sh)),a=wx(r);let c=0,u=0,d=0,h=0,p=0;const y=v=>{const S=[];let x=0;for(;x!==r-1;){const k=a[x];if(k!=null){const[_,E]=k,M=dl(v-_);ste(M,Gu)&&ite(M,n)&&S.push(E)}x=x+1}return pce(t,o,ug(S,sh))},g=(v,S)=>{if(r>0){c=c+1;const x=c%r;a[x]=[S,v]}h=u===0?v:Math.min(h,v),p=u===0?v:Math.max(p,v),u=u+1,d=d+v};return Oy({get:()=>ece({error:t,quantiles:y(Date.now()),count:u,min:h,max:p,sum:d}),update:([v,S])=>g(v,S),modify:([v,S])=>g(v,S)})},pce=(e,t,n)=>{const r=n.length;if(!Sr(t))return Vu();const i=t[0],o=t.slice(1),a=y$(e,r,Ae(),0,i,n),c=ws(a);return o.forEach(u=>{c.push(y$(e,r,a.value,a.consumed,u,a.rest))}),Au(c,u=>[u.quantile,u.value])},y$=(e,t,n,r,i,o)=>{let a=e,c=t,u=n,d=r,h=i,p=o,y=e,g=t,v=n,S=r,x=i,k=o;for(;;){if(!Sr(p))return{quantile:h,value:Ae(),consumed:d,rest:[]};if(h===1)return{quantile:h,value:Oe(IU(p)),consumed:d+p.length,rest:[]};const _=Bi(p),E=XJ(p,O=>O===_),M=h*c,D=a/2*M,T=d+E[0].length,C=Math.abs(T-M);if(T<M-D){y=a,g=c,v=qm(p),S=T,x=h,k=E[1],a=y,c=g,u=v,d=S,h=x,p=k;continue}if(T>M+D){const O=vn(u)?Oe(_):u;return{quantile:h,value:O,consumed:d,rest:p}}switch(u._tag){case"None":{y=a,g=c,v=qm(p),S=T,x=h,k=E[1],a=y,c=g,u=v,d=S,h=x,p=k;continue}case"Some":{const O=Math.abs(M-u.value);if(C<O){y=a,g=c,v=qm(p),S=T,x=h,k=E[1],a=y,c=g,u=v,d=S,h=x,p=k;continue}return{quantile:h,value:Oe(u.value),consumed:d,rest:p}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},mce="effect/MetricPair",gce=Symbol.for(mce),yce={_Type:e=>e},bce=(e,t)=>({[gce]:yce,metricKey:e,metricState:t,pipe(){return He(this,arguments)}}),vce="effect/MetricRegistry",b$=Symbol.for(vce);class Sce{[b$]=b$;map=Zie();snapshot(){const t=[];for(const[n,r]of this.map)t.push(bce(n,r.get()));return t}get(t){const n=Y(this.map,yu(t),Pi);if(n==null){if(J4(t.keyType))return this.getCounter(t);if(Ple(t.keyType))return this.getGauge(t);if(Dle(t.keyType))return this.getFrequency(t);if(Z4(t.keyType))return this.getHistogram(t);if(Nle(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=Y(this.map,yu(t),Pi);if(n==null){const r=cce(t);Y(this.map,am(t))||Y(this.map,lm(t,r)),n=r}return n}getFrequency(t){let n=Y(this.map,yu(t),Pi);if(n==null){const r=uce(t);Y(this.map,am(t))||Y(this.map,lm(t,r)),n=r}return n}getGauge(t){let n=Y(this.map,yu(t),Pi);if(n==null){const r=dce(t,t.keyType.bigint?BigInt(0):0);Y(this.map,am(t))||Y(this.map,lm(t,r)),n=r}return n}getHistogram(t){let n=Y(this.map,yu(t),Pi);if(n==null){const r=fce(t);Y(this.map,am(t))||Y(this.map,lm(t,r)),n=r}return n}getSummary(t){let n=Y(this.map,yu(t),Pi);if(n==null){const r=hce(t);Y(this.map,am(t))||Y(this.map,lm(t,r)),n=r}return n}}const xce=()=>new Sce,wce="effect/Metric",kce=Symbol.for(wce),_ce={_Type:e=>e,_In:e=>e,_Out:e=>e},v$=Wt(Symbol.for("effect/Metric/globalMetricRegistry"),()=>xce()),s5=function(e,t,n,r){const i=Object.assign(o=>Sy(o,a=>Ice(i,a)),{[kce]:_ce,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return He(this,arguments)}});return i},aw=(e,t)=>a5(zle(e,t)),a5=e=>{let t;const n=new WeakMap,r=i=>{if(i.length===0)return t!==void 0||(t=v$.get(e)),t;let o=n.get(i);return o!==void 0||(o=v$.get(Ule(e,i)),n.set(i,o)),o};return s5(e.keyType,(i,o)=>r(o).update(i),i=>r(i).get(),(i,o)=>r(o).modify(i))},Ece=(e,t,n)=>a5(Ble(e,t,n)),Tce=W(3,(e,t,n)=>Cce(e,[Rse(t,n)])),Cce=W(2,(e,t)=>s5(e.keyType,(n,r)=>e.unsafeUpdate(n,fS(t,r)),n=>e.unsafeValue(fS(t,n)),(n,r)=>e.unsafeModify(n,fS(t,r)))),Ice=W(2,(e,t)=>ky(MT,n=>Ce(()=>e.unsafeUpdate(t,n))));({...YI});const Mce=W(2,(e,t)=>ky(V4,n=>Ce(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,Zx(r.result,t))}}))),Rce="effect/Supervisor",lw=Symbol.for(Rce),bR={_T:e=>e};class cw{underlying;value0;[lw]=bR;constructor(t,n){this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,i){this.underlying.onStart(t,n,r,i)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new cw(this,Y(this.value,ot(t)))}zip(t){return new uw(this,t)}}class uw{left;right;_tag="Zip";[lw]=bR;constructor(t,n){this.left=t,this.right=n}get value(){return AV(this.left.value,this.right.value)}onStart(t,n,r,i){this.left.onStart(t,n,r,i),this.right.onStart(t,n,r,i)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new cw(this,Y(this.value,ot(t)))}zip(t){return new uw(this,t)}}const l5=e=>st(e,lw)&&Z3(e,"Zip");class Ace{effect;[lw]=bR;constructor(t){this.effect=t}get value(){return this.effect}onStart(t,n,r,i){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new cw(this,Y(this.value,ot(t)))}zip(t){return new uw(this,t)}onRun(t,n){return t()}}const Oce=e=>new Ace(e),dw=Wt("effect/Supervisor/none",()=>Oce(hn)),Dce=Fh,c5="Empty",u5="AddSupervisor",d5="RemoveSupervisor",f5="AndThen",Hm={_tag:c5},yS=(e,t)=>({_tag:f5,first:e,second:t}),Pce=(e,t)=>Nce(t,In(e)),Nce=(e,t)=>{let n=e,r=t;for(;ul(r);){const i=na(r);switch(i._tag){case c5:{r=el(r);break}case u5:{n=n.zip(i.supervisor),r=el(r);break}case d5:{n=JT(n,i.supervisor),r=el(r);break}case f5:{r=Jr(i.first)(Jr(i.second)(el(r)));break}}}return n},JT=(e,t)=>ht(e,t)?dw:l5(e)?JT(e.left,t).zip(JT(e.right,t)):e,y0=e=>ht(e,dw)?Xu():l5(e)?Y(y0(e.left),hg(y0(e.right))):wM(e),Lce=(e,t)=>{if(ht(e,t))return Hm;const n=y0(e),r=y0(t),i=Y(r,ML(n),pg(Hm,(a,c)=>yS(a,{_tag:u5,supervisor:c}))),o=Y(n,ML(r),pg(Hm,(a,c)=>yS(a,{_tag:d5,supervisor:c})));return yS(i,o)},$ce=Dce({empty:Hm,patch:Pce,combine:yS,diff:Lce}),jce=aw("effect_fiber_started",{incremental:!0}),S$=aw("effect_fiber_active"),Fce=aw("effect_fiber_successes",{incremental:!0}),zce=aw("effect_fiber_failures",{incremental:!0}),Bce=Tce(Ece("effect_fiber_lifetimes",xle({start:.5,factor:2,count:35})),"time_unit","milliseconds"),cm="Continue",Uce="Done",x$="Yield",qce={_E:e=>e,_A:e=>e},xv=e=>{throw new Error(`BUG: FiberRuntime - ${ih(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},Ka=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),Wa=Wt("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),um={[WS]:(e,t,n)=>Di(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>or(or(n)),[GS]:(e,t,n)=>Di(()=>t.effect_instruction_i2(n)),[WI]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),ic(e.currentRuntimeFlags)&&e.isInterrupted()?rn(e.getInterruptedCause()):or(n)),[YS]:(e,t,n)=>(Di(()=>t.effect_instruction_i2(n)),Di(()=>t.effect_instruction_i0())?(e.pushStack(t),Di(()=>t.effect_instruction_i1())):hn),[Um]:(e,t,n)=>{for(;;){const r=Di(()=>t.effect_instruction_i0.next(n));if(r.done)return or(r.value);const i=nJ(r.value);if(Yx(i)){if(i._tag==="Failure")return i}else return e.pushStack(t),i;n=i.value}}},Vce={[hR]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),ic(t)?rn(r.cause):n),[mR]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[pR]:(e,t,n,r)=>(r.onFiber(e,D4(t)),n),[gR]:(e,t,n,r)=>Se(xy(),()=>n)},Hce=e=>qx(Sre(e),t=>Os(Pre(t),([n,r])=>{const i=new Map,o=[];for(const c of r){o.push(As(c));for(const u of c)i.set(u.request,u)}const a=o.flat();return Vh(fue(n.runAll(o),a,()=>a.forEach(c=>{c.listeners.interrupted=!0})),V4,i)},!1,!1)),Kce=GI();class h5 extends Yh{[Gae]=Yae;[Xae]=qce;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(t,n,r){if(super(),this.currentRuntimeFlags=r,this._fiberId=t,this._fiberRefs=n,PL(r)){const i=this.getFiberRef(MT);jce.unsafeUpdate(1,i),S$.unsafeUpdate(1,i)}this.refreshRefCache()}commit(){return _g(this)}id(){return this._fiberId}resume(t){this.tell(hf(t))}get status(){return this.ask((t,n)=>n)}get runtimeFlags(){return this.ask((t,n)=>fae(n)?t.currentRuntimeFlags:n.runtimeFlags)}scope(){return Kae(this)}get children(){return this.ask(t=>Array.from(t.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(vv)}fiberRefs(){return this.ask(t=>t.getFiberRefs())}ask(t){return lt(()=>{const n=Kh(this._fiberId);return this.tell(gS((r,i)=>{Zx(n,Ce(()=>t(r,i)))})),Ls(n)})}tell(t){this._queue.push(t),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return ya(t=>{const n=r=>t(Ie(r));return this.tell(gS((r,i)=>{r._exitValue!==null?n(this._exitValue):r.addObserver(n)})),Ce(()=>this.tell(gS((r,i)=>{r.removeObserver(n)})))},this.id())}get inheritAll(){return Nt((t,n)=>{const r=t.id(),i=t.getFiberRefs(),o=n.runtimeFlags,a=this.getFiberRefs(),c=lse(i,r,a);t.setFiberRefs(c);const u=t.getFiberRef(E$),d=Y(Pu(o,u),LL(Sd),LL(TT));return cie(d)})}get poll(){return Ce(()=>ay(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(t){return Ce(()=>this.tell(_1(Jo(t))))}unsafeInterruptAsFork(t){this.tell(_1(Jo(t)))}addObserver(t){this._exitValue!==null?t(this._exitValue):this._observers.push(t)}removeObserver(t){this._observers=this._observers.filter(n=>n!==t)}getFiberRefs(){return this.setFiberRef(E$,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(t){this._fiberRefs=f4(this._fiberRefs,t)}getFiberRef(t){return this._fiberRefs.locals.has(t)?this._fiberRefs.locals.get(t)[0][1]:t.initial}setFiberRef(t,n){this._fiberRefs=NT(this._fiberRefs,{fiberId:this._fiberId,fiberRef:t,value:n}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(vh),this.currentTracer=this.currentDefaultServices.unsafeMap.get(l4.key),this.currentSupervisor=this.getFiberRef(uue),this.currentScheduler=this.getFiberRef(fR),this.currentContext=this.getFiberRef(Pc),this.currentSpan=this.currentContext.unsafeMap.get(c4.key)}setFiberRefs(t){this._fiberRefs=t,this.refreshRefCache()}addChild(t){this.getChildren().add(t)}removeChild(t){this.getChildren().delete(t)}transferChildren(t){const n=this._children;if(this._children=null,n!==null&&n.size>0)for(const r of n)r._exitValue===null&&t.add(this.currentRuntimeFlags,r)}drainQueueOnCurrentThread(){let t=!0;for(;t;){let n=cm;const r=globalThis[uu];globalThis[uu]=this;try{for(;n===cm;)n=this._queue.length===0?Uce:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[uu]=r}this._queue.length>0&&!this._running?(this._running=!0,n===x$?(this.drainQueueLaterOnExecutor(),t=!1):t=!0):t=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(_y))}drainQueueWhileRunning(t,n){let r=n;for(;this._queue.length>0;){const i=this._queue.splice(0,1)[0];r=Vce[i._tag](this,t,r,i)}return r}isInterrupted(){return!AM(this.getFiberRef(vv))}addInterruptedCause(t){const n=this.getFiberRef(vv);this.setFiberRef(vv,Yr(n,t))}processNewInterruptSignal(t){this.addInterruptedCause(t),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let t=!1;for(const n of this._children)n.tell(_1(Jo(this.id()))),t=!0;return t}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const t=this._children.values();this._children=null;let n=!1;return PM({while:()=>!n,body:()=>{const i=t.next();return i.done?Ce(()=>{n=!0}):Ci(i.value.await)},step:()=>{}})}return null}reportExitValue(t){if(PL(this.currentRuntimeFlags)){const n=this.getFiberRef(MT),r=this.id().startTimeMillis,i=Date.now();switch(Bce.unsafeUpdate(i-r,n),S$.unsafeUpdate(-1,n),t._tag){case Xr:{Fce.unsafeUpdate(1,n);break}case Qr:{zce.unsafeUpdate(1,n);break}}}if(t._tag==="Failure"){const n=this.getFiberRef(Iie);!Fx(t.cause)&&n._tag==="Some"&&this.log("Fiber terminated with an unhandled error",t.cause,n)}}setExitValue(t){this._exitValue=t,this.reportExitValue(t);for(let n=this._observers.length-1;n>=0;n--)this._observers[n](t);this._observers=[]}getLoggers(){return this.getFiberRef(fw)}log(t,n,r){const i=Pe(r)?r.value:this.getFiberRef(zV),o=this.getFiberRef(Wce);if(vse(o,i))return;const a=this.getFiberRef(_ie),c=this.getFiberRef(FV),u=this.getLoggers(),d=this.getFiberRefs();if(kM(u)>0){const h=ma(this.getFiberRef(vh),nw),p=new Date(h.unsafeCurrentTimeMillis());cJ(d,()=>{for(const y of u)y.log({fiberId:this.id(),logLevel:i,message:t,cause:n,context:d,spans:a,annotations:c,date:p})})}}evaluateMessageWhileSuspended(t){switch(t._tag){case gR:return x$;case hR:return this.processNewInterruptSignal(t.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(rn(t.cause)),this._asyncInterruptor=null),cm;case mR:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(t.effect),cm;case pR:return t.onFiber(this,this._exitValue!==null?uae:dae(this.currentRuntimeFlags,this._asyncBlockingOn)),cm;default:return xv(t)}}evaluateEffect(t){this.currentSupervisor.onResume(this);try{let n=ic(this.currentRuntimeFlags)&&this.isInterrupted()?rn(this.getInterruptedCause()):t;for(;n!==null;){const r=n,i=this.runLoop(r);if(i===Ka){const o=Wa.currentOp;Wa.currentOp=null,o._op===uS?pre(this.currentRuntimeFlags)?(this.tell(Uae()),this.tell(hf(ns)),n=null):n=ns:o._op===Bm&&(n=null)}else{this.currentRuntimeFlags=Y(this.currentRuntimeFlags,gre(TT));const o=this.interruptAllChildren();o!==null?n=Se(o,()=>i):(this._queue.length===0?this.setExitValue(i):this.tell(hf(i)),n=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(t){if(this._running)this.tell(hf(t));else{this._running=!0;const n=globalThis[uu];globalThis[uu]=this;try{this.evaluateEffect(t)}finally{this._running=!1,globalThis[uu]=n,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(t){this.tell(hf(t))}patchRuntimeFlags(t,n){const r=Vf(t,n);return globalThis[uu]=this,this.currentRuntimeFlags=r,r}initiateAsync(t,n){let r=!1;const i=o=>{r||(r=!0,this.tell(hf(o)))};ic(t)&&(this._asyncInterruptor=i);try{n(i)}catch(o){i(xr(To(o)))}}pushStack(t){this._stack.push(t),t._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const t=this._stack.pop();if(t)return t._op==="OnStep"&&this._steps.pop(),t}getNextSuccessCont(){let t=this.popStack();for(;t;){if(t._op!==cS)return t;t=this.popStack()}}getNextFailCont(){let t=this.popStack();for(;t;){if(t._op!==WS&&t._op!==YS&&t._op!==Um)return t;t=this.popStack()}}[uJ](t){return Ce(()=>yq(this.currentContext,t))}Left(t){return Rr(t.left)}None(t){return Rr(new $M)}Right(t){return or(t.right)}Some(t){return or(t.value)}Micro(t){return o0(n=>{let r=n;const i=zae(Dae(t,this.currentContext));return i.addObserver(o=>{if(o._tag==="Success")return r(or(o.value));switch(o.cause._tag){case"Interrupt":return r(rn(Jo(Zu)));case"Fail":return r(Rr(o.cause.error));case"Die":return r(ra(o.cause.defect))}}),o0(o=>{r=a=>{o(hn)},i.unsafeInterrupt()})})}[lU](t){const n=Di(()=>t.effect_instruction_i0()),r=this.getNextSuccessCont();return r!==void 0?(r._op in um||xv(r),um[r._op](this,r,n)):(Wa.currentOp=or(n),Ka)}[Xr](t){const n=t,r=this.getNextSuccessCont();return r!==void 0?(r._op in um||xv(r),um[r._op](this,r,n.effect_instruction_i0)):(Wa.currentOp=n,Ka)}[Qr](t){const n=t.effect_instruction_i0,r=this.getNextFailCont();if(r!==void 0)switch(r._op){case cS:case GS:return ic(this.currentRuntimeFlags)&&this.isInterrupted()?rn($L(n)):Di(()=>r.effect_instruction_i1(n));case"OnStep":return ic(this.currentRuntimeFlags)&&this.isInterrupted()?rn($L(n)):or(rn(n));case WI:return this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),ic(this.currentRuntimeFlags)&&this.isInterrupted()?rn(Yr(n,this.getInterruptedCause())):rn(n);default:xv(r)}else return Wa.currentOp=rn(n),Ka}[cU](t){return Di(()=>t.effect_instruction_i0(this,D4(this.currentRuntimeFlags)))}Blocked(t){const n=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){const i=[],o=this._steps[this._steps.length-1];let a=this.popStack();for(;a&&a._op!=="OnStep";)i.push(a),a=this.popStack();this.setFiberRefs(o.refs),this.currentRuntimeFlags=o.flags;const c=wg(o.refs,n),u=Pu(o.flags,r);return or(bV(t.effect_instruction_i0,Nt(d=>{for(;i.length>0;)d.pushStack(i.pop());return d.setFiberRefs(kg(d.id(),d.getFiberRefs())(c)),d.currentRuntimeFlags=Vf(u)(d.currentRuntimeFlags),t.effect_instruction_i1})))}return us(i=>Se(hw(nie(t.effect_instruction_i0)),()=>i(t.effect_instruction_i1)))}RunBlocked(t){return Hce(t.effect_instruction_i0)}[Nh](t){const n=t.effect_instruction_i0,r=this.currentRuntimeFlags,i=Vf(r,n);if(ic(i)&&this.isInterrupted())return rn(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,n),t.effect_instruction_i1){const o=Pu(i,r);return this.pushStack(new rie(o,t)),Di(()=>t.effect_instruction_i1(r))}else return ns}[WS](t){return this.pushStack(t),t.effect_instruction_i0}OnStep(t){return this.pushStack(t),t.effect_instruction_i0}[cS](t){return this.pushStack(t),t.effect_instruction_i0}[GS](t){return this.pushStack(t),t.effect_instruction_i0}[Bm](t){return this._asyncBlockingOn=t.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,t.effect_instruction_i0),Wa.currentOp=t,Ka}[uS](t){return this._isYielding=!1,Wa.currentOp=t,Ka}[YS](t){const n=t.effect_instruction_i0,r=t.effect_instruction_i1;return n()?(this.pushStack(t),r()):ns}[Um](t){return um[Um](this,t,void 0)}[Sx](t){return Di(()=>t.commit())}runLoop(t){let n=t;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&hre)!==0&&this.currentSupervisor.onEffect(this,n),this._queue.length>0&&(n=this.drainQueueWhileRunning(this.currentRuntimeFlags,n)),!this._isYielding){this.currentOpCount+=1;const r=this.currentScheduler.shouldYield(this);if(r!==!1){this._isYielding=!0,this.currentOpCount=0;const i=n;n=Se(xy({priority:r}),()=>i)}}try{if(n=this.currentTracer.context(()=>{if(Kce!==n[yh]._V){const r=this.getFiberRef(Mie);if(r._tag==="Some"){const i=n[yh]._V;this.log(`Executing an Effect versioned ${i} with a Runtime of version ${GI()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,fl,r)}}return this[n._op](n)},this),n===Ka){const r=Wa.currentOp;return r._op===uS||r._op===Bm?Ka:(Wa.currentOp=null,r._op===Xr||r._op===Qr?r:rn(To(r)))}}catch(r){n!==Ka&&!st(n,"_op")||!(n._op in this)?n=EV(`Not a valid effect: ${ih(n)}`):Oie(r)?n=rn(Yr(To(r),Jo(Zu))):n=ra(r)}}}run=()=>{this.drainQueueOnCurrentThread()}}const Wce=Wt("effect/FiberRef/currentMinimumLogLevel",()=>Vi(Sse("Info"))),Gce=e=>My(t=>{const n=ZM(t.context,vh);ma(n,rw).unsafe.log(e.log(t))}),p5=Wt(Symbol.for("effect/Logger/defaultLogger"),()=>Gce(ale)),Yce=Wt(Symbol.for("effect/Logger/tracerLogger"),()=>My(({annotations:e,cause:t,context:n,fiberId:r,logLevel:i,message:o})=>{const a=ts(xg(n,Pc),c4);if(a._tag==="None"||a.value._tag==="ExternalSpan")return;const c=yq(xg(n,vh),nw),u={};for(const[d,h]of e)u[d]=h;u["effect.fiberId"]=tne(r),u["effect.logLevel"]=i.label,t!==null&&t._tag!=="Empty"&&(u["effect.cause"]=Dc(t,{renderErrorCause:!0})),a.value.event(ih(Array.isArray(o)&&o.length===1?o[0]:o),c.unsafeCurrentTimeNanos(),u)})),fw=Wt(Symbol.for("effect/FiberRef/currentLoggers"),()=>xie(wM(p5,Yce))),m5=W(e=>xa(e[0]),(e,t)=>_d(Sy(e,n=>g5(r=>t(n,r))))),g5=e=>Nt(t=>{const n=t.getFiberRefs(),r=mre(t.currentRuntimeFlags,Sd);return Se(b5,i=>a0(i,o=>Nt(a=>{const c=a.getFiberRefs(),u=a.currentRuntimeFlags,d=wg(c,n),h=Pu(u,r),p=wg(n,c);return a.setFiberRefs(kg(d,a.id(),n)),Eg(die(e(o),h),Ce(()=>{a.setFiberRefs(kg(p,a.id(),a.getFiberRefs()))}))})))}),Qce=e=>{if(Array.isArray(e)||eU(e))return[e,Ae()];const t=Object.keys(e),n=t.length;return[t.map(r=>e[r]),Oe(r=>{const i={};for(let o=0;o<n;o++)i[t[o]]=r[o];return i})]},Xce=(e,t,n)=>{const r=[];for(const i of e)r.push(bh(i));return Se(wh(r,Mt,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),i=>{const o=Ae(),a=i.length,c=new Array(a),u=new Array(a);let d=!1;for(let h=0;h<a;h++){const p=i[h];p._tag==="Left"?(c[h]=Oe(p.left),d=!0):(u[h]=p.right,c[h]=o)}return d?t._tag==="Some"?Rr(t.value(c)):Rr(c):n?.discard?hn:t._tag==="Some"?Ie(t.value(u)):Ie(u)})},Jce=(e,t,n)=>{const r=[];for(const i of e)r.push(bh(i));return n?.discard?wh(r,Mt,{concurrency:n?.concurrency,batching:n?.batching,discard:!0,concurrentFinalizers:n?.concurrentFinalizers}):ot(wh(r,Mt,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),i=>t._tag==="Some"?t.value(i):i)},vR=(e,t)=>{const[n,r]=Qce(e);return t?.mode==="validate"?Xce(n,r,t):t?.mode==="either"?Jce(n,r,t):t?.discard!==!0&&r._tag==="Some"?ot(wh(n,Mt,t),r.value):wh(n,Mt,t)},wh=W(e=>eU(e[0]),(e,t,n)=>Nt(r=>{const i=n?.batching===!0||n?.batching==="inherit"&&r.getFiberRef(Cie);return n?.discard?m$(n.concurrency,()=>pf(d0,n?.concurrentFinalizers)(o=>i?Os(e,(a,c)=>o(t(a,c)),!0,!1,1):qx(e,(a,c)=>o(t(a,c)))),()=>pf(zT,n?.concurrentFinalizers)(o=>Os(e,(a,c)=>o(t(a,c)),i,!1)),o=>pf(BT(o),n?.concurrentFinalizers)(a=>Os(e,(c,u)=>a(t(c,u)),i,!1,o))):m$(n?.concurrency,()=>pf(d0,n?.concurrentFinalizers)(o=>i?ZT(e,1,(a,c)=>o(t(a,c)),!0):tl(e,(a,c)=>o(t(a,c)))),()=>pf(zT,n?.concurrentFinalizers)(o=>SR(e,(a,c)=>o(t(a,c)),i)),o=>pf(BT(o),n?.concurrentFinalizers)(a=>ZT(e,o,(c,u)=>a(t(c,u)),i)))})),SR=(e,t,n)=>lt(()=>{const r=zn(e),i=new Array(r.length);return Br(Os(r,(a,c)=>Se(t(a,c),u=>Ce(()=>i[c]=u)),n,!1),Ie(i))}),Os=(e,t,n,r,i)=>us(o=>lie(a=>Nt(c=>{let u=Array.from(e).reverse(),d=u.length;if(d===0)return hn;let h=0,p=!1;const y=i?Math.min(u.length,i):u.length,g=new Set,v=new Array,S=()=>g.forEach(O=>{O.currentScheduler.scheduleTask(()=>{O.unsafeInterruptAsFork(c.id())},0)}),x=new Array,k=new Array,_=new Array,E=()=>{const O=v.filter(({exit:q})=>q._tag==="Failure").sort((q,I)=>q.index<I.index?-1:q.index===I.index?0:1).map(({exit:q})=>q);return O.length===0&&O.push(ns),O},M=(O,q=!1)=>{const I=_d(a(O)),L=eue(I,c,c.currentRuntimeFlags,Iy);return c.currentScheduler.scheduleTask(()=>{q&&L.unsafeInterruptAsFork(c.id()),L.resume(I)},0),L},D=()=>{r||(d-=u.length,u=[]),p=!0,S()},T=n?iie:sa,C=M(ya(O=>{const q=(L,P)=>{L._op==="Blocked"?_.push(L):(v.push({index:P,exit:L}),L._op==="Failure"&&!p&&D())},I=()=>{if(u.length>0){const L=u.pop();let P=h++;const B=()=>{const K=u.pop();return P=h++,Se(xy(),()=>Se(T(o(t(K,P))),$))},$=K=>u.length>0&&(q(K,P),u.length>0)?B():Ie(K),V=Se(T(o(t(L,P))),$),j=M(V);x.push(j),g.add(j),p&&j.currentScheduler.scheduleTask(()=>{j.unsafeInterruptAsFork(c.id())},0),j.addObserver(K=>{let G;if(K._op==="Failure"?G=K:G=K.effect_instruction_i0,k.push(j),g.delete(j),q(G,P),v.length===d)O(Ie(On(Hf(E(),{parallel:!0}),()=>ns)));else if(_.length+v.length===d){const J=E(),F=_.map(U=>U.effect_instruction_i0).reduce(nV);O(Ie(bV(F,Os([On(Hf(J,{parallel:!0}),()=>ns),..._.map(U=>U.effect_instruction_i1)],U=>U,n,!0,i))))}else I()})}};for(let L=0;L<y;L++)I()}));return Ci(nd(kd(o(_g(C))),Qx({onFailure:O=>{D();const q=_.length+1,I=Math.min(typeof i=="number"?i:_.length,_.length),L=Array.from(_);return ya(P=>{let B=0,$=0;const V=(K,G)=>J=>{B++,B===q&&P(or(rn(O))),L.length>0&&G&&j()},j=()=>{M(L.pop(),!0).addObserver(V($,!0)),$++};C.addObserver(V($,!1)),$++;for(let K=0;K<I;K++)j()})},onSuccess:()=>tl(k,O=>O.inheritAll)})))}))),ZT=(e,t,n,r)=>lt(()=>{const i=zn(e),o=new Array(i.length);return Br(Os(i,(c,u)=>ot(n(c,u),d=>o[u]=d),r,!1,t),Ie(o))}),Zce=e=>Nt((t,n)=>Ie(xR(e,t,n.runtimeFlags))),hw=e=>tue(e,Iy),xR=(e,t,n,r=null)=>{const i=b0(e,t,n,r);return i.resume(e),i},eue=(e,t,n,r=null)=>b0(e,t,n,r),b0=(e,t,n,r=null)=>{const i=Fq(),o=t.getFiberRefs(),a=cse(o,i),c=new h5(i,a,n),u=xg(a,Pc),d=c.currentSupervisor;return d.onStart(u,e,Oe(t),c),c.addObserver(p=>d.onEnd(p,c)),(r!==null?r:Y(t.getFiberRef(RT),On(()=>t.scope()))).add(n,c),c},tue=(e,t)=>Nt((n,r)=>Ie(xR(e,n,r.runtimeFlags,t))),w$=e=>Ed(t=>Xn(ts(t,Nc),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return Se(Xa(n,zT),r=>Xh(e,r))}}})),k$=e=>t=>Ed(n=>Xn(ts(n,Nc),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:Se(Xa(r,BT(e)),i=>Xh(t,i))})),pf=(e,t)=>n=>Ed(r=>Xn(ts(r,Nc),{onNone:()=>n(Mt),onSome:i=>{if(t===!0){const o=e._tag==="Parallel"?w$:e._tag==="Sequential"?_$:k$(e.parallelism);switch(i.strategy._tag){case"Parallel":return o(n(w$));case"Sequential":return o(n(_$));case"ParallelN":return o(n(k$(i.strategy.parallelism)))}}else return n(Mt)}})),wR=e=>Se(Nc,e),y5=e=>Se(Qh(),t=>nd(e(t),n=>t.close(n))),nue=e=>Se(Qh(),t=>lue(e,t)),_$=e=>Ed(t=>Xn(ts(t,Nc),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return Se(Xa(n,d0),r=>Xh(e,r))}}})),rue=W(e=>xa(e[1]),(e,t,n)=>Dy(e,t,(r,i)=>[r,i],n)),iue=W(e=>xa(e[1]),(e,t,n)=>n?.concurrent!==!0&&(n?.batching===void 0||n.batching===!1)?Wx(e,t):Dy(e,t,(r,i)=>r,n)),oue=W(e=>xa(e[1]),(e,t,n)=>n?.concurrent!==!0&&(n?.batching===void 0||n.batching===!1)?Br(e,t):Dy(e,t,(r,i)=>i,n)),Dy=W(e=>xa(e[1]),(e,t,n,r)=>ot(vR([e,t],{concurrency:r?.concurrent?2:1,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),([i,o])=>n(i,o))),Nc=ds("effect/Scope"),b5=Nc,sue=(e,t)=>{e.state._tag==="Open"&&e.state.finalizers.set({},t)},aue={[BL]:BL,[UL]:UL,pipe(){return He(this,arguments)},fork(e){return Ce(()=>{const t=v5(e);if(this.state._tag==="Closed")return t.state=this.state,t;const n={},r=i=>t.close(i);return this.state.finalizers.set(n,r),sue(t,i=>Ce(()=>{this.state._tag==="Open"&&this.state.finalizers.delete(n)})),t})},close(e){return lt(()=>{if(this.state._tag==="Closed")return hn;const t=Array.from(this.state.finalizers.values()).reverse();return this.state={_tag:"Closed",exit:e},t.length===0?hn:eae(this.strategy)?Y(tl(t,n=>sa(n(e))),Se(n=>Y(Hf(n),Ru(x1),On(()=>ns)))):tae(this.strategy)?Y(SR(t,n=>sa(n(e)),!1),Se(n=>Y(Hf(n,{parallel:!0}),Ru(x1),On(()=>ns)))):Y(ZT(t,this.strategy.parallelism,n=>sa(n(e)),!1),Se(n=>Y(Hf(n,{parallel:!0}),Ru(x1),On(()=>ns))))})},addFinalizer(e){return lt(()=>this.state._tag==="Closed"?e(this.state.exit):(this.state.finalizers.set({},e),hn))}},v5=(e=cc)=>{const t=Object.create(aue);return t.strategy=e,t.state={_tag:"Open",finalizers:new Map},t},Qh=(e=cc)=>Ce(()=>v5(e)),Xh=W(2,(e,t)=>KV(e,Oc(Tx(Nc,t)))),lue=W(2,(e,t)=>Y(e,Xh(t),nd(n=>t.close(n)))),cue=e=>Hh(e,{differ:$ce,fork:Hm}),S5=W(2,(e,t)=>Ci(m5(Se(wy(e),n=>Zr(s0(e,t),n)),n=>s0(e,n)))),kR=W(2,(e,t)=>ky(e,n=>S5(e,t(n)))),E$=kie(yre),uue=cue(dw),due=e=>Ci(hw(Gx(e))),x5=W(3,(e,t,n)=>k5(e,t,{onSelfWin:(r,i)=>Se(r.await,o=>{switch(o._tag){case Xr:return Se(r.inheritAll,()=>n.onSelfDone(o,i));case Qr:return n.onSelfDone(o,i)}}),onOtherWin:(r,i)=>Se(r.await,o=>{switch(o._tag){case Xr:return Se(r.inheritAll,()=>n.onOtherDone(o,i));case Qr:return n.onOtherDone(o,i)}})})),w5=W(2,(e,t)=>Uh(n=>x5(e,t,{onSelfDone:(r,i)=>DT(r,{onFailure:o=>Y(_g(i),c$(a=>gc(o,a))),onSuccess:o=>Y(i,nl(n),Zr(o))}),onOtherDone:(r,i)=>DT(r,{onFailure:o=>Y(_g(i),c$(a=>gc(a,o))),onSuccess:o=>Y(i,nl(n),Zr(o))})}))),k5=W(3,(e,t,n)=>Nt((r,i)=>{const o=i.runtimeFlags,a=bd(!0),c=b0(e,r,o,n.selfScope),u=b0(t,r,o,n.otherScope);return ya(d=>{c.addObserver(()=>T$(c,u,n.onSelfWin,a,d)),u.addObserver(()=>T$(u,c,n.onOtherWin,a,d)),c.startFork(e),u.startFork(t)},Zte(c.id(),u.id()))})),T$=(e,t,n,r,i)=>{Kte(!0,!1)(r)&&i(n(e,t))},Eg=W(2,(e,t)=>us(n=>Ao(n(e),{onFailure:r=>Ao(t,{onFailure:i=>xr(Yr(r,i)),onSuccess:()=>xr(r)}),onSuccess:r=>Zr(t,r)}))),fue=(e,t,n)=>Uh(r=>Se(Se(hw(Vx(e)),i=>ya(o=>{const a=t.map(d=>d.listeners.count),c=()=>{a.every(d=>d===0)&&t.every(d=>d.result.state.current._tag==="Pending"?!0:!!(d.result.state.current._tag==="Done"&&Yx(d.result.state.current.effect)&&d.result.state.current.effect._tag==="Failure"&&cV(d.result.state.current.effect.cause)))&&(u.forEach(d=>d()),n?.(),o(Gx(i)))};i.addObserver(d=>{u.forEach(h=>h()),o(d)});const u=t.map((d,h)=>{const p=y=>{a[h]=y,c()};return d.listeners.addObserver(p),()=>d.listeners.removeObserver(p)});return c(),Ce(()=>{u.forEach(d=>d())})})),()=>lt(()=>{const i=t.flatMap(o=>o.state.completed?[]:[o]);return qx(i,o=>Mce(o.request,VV(r)))}))),pw=mc,Tg=To,hue=Jo,pue=$re,mue=lV,kh=cV,Km=Fx,v0=uV,_h=dV,gue=fV,_5=hV,E5=pV,yue=Fre,T5=jre,C5=Ure,Lc=Dc,bue="effect/ScheduleInterval",S0=Symbol.for(bue),I5={[S0]:S0,startMillis:0,endMillis:0},_R=(e,t)=>e>t?I5:{[S0]:S0,startMillis:e,endMillis:t},vue=W(2,(e,t)=>Sue(e,t)===e),Sue=W(2,(e,t)=>e.endMillis<=t.startMillis?e:t.endMillis<=e.startMillis?t:e.startMillis<t.startMillis?e:t.startMillis<e.startMillis?t:e.endMillis<=t.endMillis?e:t),xue=e=>e.startMillis>=e.endMillis,wue=W(2,(e,t)=>{const n=Math.max(e.startMillis,t.startMillis),r=Math.min(e.endMillis,t.endMillis);return _R(n,r)}),kue=e=>dl(e.endMillis-e.startMillis),_ue=e=>_R(e,Number.POSITIVE_INFINITY),C$=_R,M5=I5,Eue=vue,Tue=xue,Cue=wue,Iue=kue,Mue=_ue,Rue="effect/ScheduleIntervals",I$=Symbol.for(Rue),R5=e=>({[I$]:I$,intervals:e}),Aue=W(2,(e,t)=>Oue(e.intervals,t.intervals,an())),Oue=(e,t,n)=>{let r=e,i=t,o=n;for(;ul(r)&&ul(i);){const a=Y(na(r),Cue(na(i))),c=Tue(a)?o:Y(o,Jr(a));Y(na(r),Eue(na(i)))?r=el(r):i=el(i),o=c}return R5(cl(o))},eC=e=>Y(e.intervals,Ix,On(()=>M5)).startMillis,Due=e=>Y(e.intervals,Ix,On(()=>M5)).endMillis,Pue=W(2,(e,t)=>eC(e)<eC(t)),Nue=e=>ul(e.intervals),Lue=R5,$ue=Aue,tC=eC,nC=Due,jue=Pue,Fue=Nue,ER="Continue",A5="Done",zue=e=>({_tag:ER,intervals:e}),Bue=e=>({_tag:ER,intervals:Lue(In(e))}),Uue={_tag:A5},que=e=>e._tag===ER,Vue=e=>e._tag===A5,Hue=zue,O5=Bue,Cg=Uue,M$=que,Ig=Vue,Kue=Nc,uc=BV,Wue=a0,di=AT,Jh=Xh,D5=Xa,Wm=Qh;class Gue{permits;waiters=new Set;taken=0;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take=t=>kV(n=>{if(this.free<t){const r=()=>{this.free<t||(this.waiters.delete(r),this.taken+=t,n(Ie(t)))};return this.waiters.add(r),Ce(()=>{this.waiters.delete(r)})}return this.taken+=t,n(Ie(t))});updateTakenUnsafe(t,n){return this.taken=n(this.taken),this.waiters.size>0&&t.getFiberRef(fR).scheduleTask(()=>{const r=this.waiters.values();let i=r.next();for(;i.done===!1&&this.free>0;)i.value(),i=r.next()},t.getFiberRef(_y)),Ie(this.free)}updateTaken(t){return Nt(n=>this.updateTakenUnsafe(n,t))}resize=t=>Ci(Nt(n=>(this.permits=t,this.free<0?hn:this.updateTakenUnsafe(n,r=>r))));release=t=>this.updateTaken(n=>n-t);releaseAll=this.updateTaken(t=>0);withPermits=t=>n=>us(r=>Se(r(this.take(t)),i=>Eg(r(n),this.release(i))));withPermitsIfAvailable=t=>n=>us(r=>lt(()=>this.free<t?Hse:(this.taken+=t,Eg(r(Dse(n)),this.release(t)))))}const P5=e=>new Gue(e),Yue=e=>Ce(()=>P5(e)),N5=W(2,(e,t)=>Nt((n,r)=>{const i=t,o=xR(e,n,r.runtimeFlags,Iy);if(i.state._tag==="Open"){const a=()=>Uh(u=>ht(u,o.id())?hn:Ci(Gx(o))),c={};i.state.finalizers.set(c,a),o.addObserver(()=>{i.state._tag!=="Closed"&&i.state.finalizers.delete(c)})}else o.unsafeInterruptAsFork(n.id());return Ie(o)})),Que=e=>wR(t=>N5(e,t)),Xue=W(2,(e,t)=>Y(sa(e),w5(sa(t)),n=>kd(n))),Jue=W(2,(e,{duration:t,onTimeout:n})=>kd(Zue(e,{onTimeout:()=>by(n),onSuccess:Ie,duration:t}))),Zue=W(2,(e,{duration:t,onSuccess:n,onTimeout:r})=>Uh(i=>us(o=>k5(o(e),Vx(iR(t)),{onSelfWin:(a,c)=>Se(a.await,u=>u._tag==="Success"?Se(a.inheritAll,()=>Zr(nl(c,i),n(u.value))):Se(nl(c,i),()=>rn(u.cause))),onOtherWin:(a,c)=>Se(a.await,u=>u._tag==="Success"?Se(a.inheritAll,()=>Zr(nl(c,i),r())):Se(nl(c,i),()=>rn(u.cause))),otherScope:Iy})))),ede="effect/Ref/SynchronizedRef",L5=Symbol.for(ede),$5={_A:e=>e};class tde extends Yh{ref;withLock;[L5]=$5;[tR]=nR;[Sh]=Sh;constructor(t,n){super(),this.ref=t,this.withLock=n,this.get=la(this.ref)}get;commit(){return this.get}modify(t){return this.modifyEffect(n=>Ie(t(n)))}modifyEffect(t){return this.withLock(Y(Se(la(this.ref),t),Se(([n,r])=>Zr(Kf(this.ref,r),n))))}}const nde=e=>Ce(()=>j5(e)),j5=e=>{const t=rR(e),n=P5(1);return new tde(t,n.withPermits(1))},rC=Symbol.for("effect/ManagedRuntime"),rde="Fold",ide="Fresh",ode="FromEffect",sde="Scoped",ade="Suspend",lde="Provide",F5="ProvideMerge",cde="MergeAll",vc=Jae,R$=Zae,fi=Gx,z5=nl,x0=due,Pf=_g,iC=ele,Zh=e=>function(){if(arguments.length===1){const t=arguments[0];return(n,...r)=>e(t,n,...r)}return e.apply(this,arguments)},Py=Zh((e,t,n)=>{const r=Fq(),i=[[Pc,[[r,e.context]]]];n?.scheduler&&i.push([fR,[[r,n.scheduler]]]);let o=fse(e.fiberRefs,{entries:i,forkAs:r});n?.updateRefs&&(o=n.updateRefs(o,r));const a=new h5(r,o,e.runtimeFlags);let c=t;n?.scope&&(c=Se(D5(n.scope,cc),d=>Br(BV(d,Uh(h=>ht(h,a.id())?hn:nl(a,h))),nd(t,h=>di(d,h)))));const u=a.currentSupervisor;return u!==dw&&(u.onStart(e.context,c,Ae(),a),a.addObserver(d=>u.onEnd(d,a))),Iy.add(e.runtimeFlags,a),n?.immediate===!1?a.resume(c):a.start(c),a}),oC=Zh((e,t,n={})=>{const r=Py(e,t,n);return n.onExit&&r.addObserver(i=>{n.onExit(i)}),(i,o)=>oC(e)(Y(r,z5(i??Zu)),{...o,onExit:o?.onExit?a=>o.onExit(Yie(a)):void 0})}),B5=Zh((e,t)=>{const n=TR(e)(t);if(n._tag==="Failure")throw U5(n.effect_instruction_i0);return n.effect_instruction_i0});class ude extends Error{fiber;_tag="AsyncFiberException";constructor(t){super(`Fiber #${t.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=t,this.name=this._tag,this.stack=this.message}}const dde=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new ude(e);return Error.stackTraceLimit=t,n},E1=Symbol.for("effect/Runtime/FiberFailure"),wv=Symbol.for("effect/Runtime/FiberFailure/Cause");class fde extends Error{[E1];[wv];constructor(t){const n=gV(t)[0];super(n?.message||"An error has occurred"),this[E1]=E1,this[wv]=t,this.name=n?`(FiberFailure) ${n.name}`:"FiberFailure",n?.stack&&(this.stack=n.stack)}toJSON(){return{_id:"FiberFailure",cause:this[wv].toJSON()}}toString(){return"(FiberFailure) "+Dc(this[wv],{renderErrorCause:!0})}[Dn](){return this.toString()}}const U5=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new fde(e);return Error.stackTraceLimit=t,n},q5=e=>{const t=e;switch(t._op){case"Failure":case"Success":return t;case"Left":return OT(t.left);case"Right":return or(t.right);case"Some":return or(t.value);case"None":return OT(new $M)}},TR=Zh((e,t)=>{const n=q5(t);if(n)return n;const r=new q4,i=Py(e)(t,{scheduler:r});r.flush();const o=i.unsafePoll();return o||qV(DM(dde(i),zM(i)))}),V5=Zh((e,t,n)=>CR(e,t,n).then(r=>{switch(r._tag){case Xr:return r.effect_instruction_i0;case Qr:throw U5(r.effect_instruction_i0)}})),CR=Zh((e,t,n)=>new Promise(r=>{const i=q5(t);i&&r(i);const o=Py(e)(t);o.addObserver(a=>{r(a)}),n?.signal!==void 0&&(n.signal.aborted?o.unsafeInterruptAsFork(o.id()):n.signal.addEventListener("abort",()=>{o.unsafeInterruptAsFork(o.id())},{once:!0}))}));class H5{context;runtimeFlags;fiberRefs;constructor(t,n,r){this.context=t,this.runtimeFlags=n,this.fiberRefs=r}pipe(){return He(this,arguments)}}const hde=e=>new H5(e.context,e.runtimeFlags,e.fiberRefs),K5=()=>Nt((e,t)=>Ie(new H5(e.getFiberRef(Pc),t.runtimeFlags,e.getFiberRefs()))),pde=eV(Sd,Jq,Xq),Sc=hde({context:uy(),runtimeFlags:pde,fiberRefs:hse()}),sC=Py(Sc),T1=V5(Sc),mde=CR(Sc),aC=B5(Sc),gde=TR(Sc),yde=W(2,(e,t)=>e.modifyEffect(t)),bde="effect/Layer",IR=Symbol.for(bde),vde={_RIn:e=>e,_E:e=>e,_ROut:e=>e},xc={[IR]:vde,pipe(){return He(this,arguments)}},Sde="effect/Layer/MemoMap",C1=Symbol.for(Sde),xde=Cx()("effect/Layer/CurrentMemoMap",{defaultValue:()=>G5()}),wde=e=>st(e,IR),kde=e=>e._op_layer===ide;class W5{ref;[C1];constructor(t){this.ref=t,this[C1]=C1}getOrElseMemoize(t,n){return Y(yde(this.ref,r=>{const i=r.get(t);if(i!==void 0){const[o,a]=i,c=Y(o,Se(([u,d])=>Y(M4(u),Zr(d))),nd(Qx({onFailure:()=>hn,onSuccess:()=>a0(n,a)})));return Ie([c,r])}return Y(c0(0),Se(o=>Y(Ey(),Se(a=>Y(c0(()=>hn),ot(c=>{const u=us(h=>Y(Qh(),Se(p=>Y(h(Se(Q5(t,p,!0),y=>C4(y(this)))),sa,Se(y=>{switch(y._tag){case Qr:return Y(HV(a,y.effect_instruction_i0),Br(AT(p,y)),Br(xr(y.effect_instruction_i0)));case Xr:return Y(Kf(c,g=>Y(AT(p,g),Kx(b4(o,v=>[v===1,v-1])),Ci)),Br(u0(o,g=>g+1)),Br(a0(n,g=>Y(Ce(()=>r.delete(t)),Br(la(c)),Se(v=>v(g))))),Br(Ty(a,y.effect_instruction_i0)),Zr(y.effect_instruction_i0[1]))}}))))),d=[Y(Ls(a),nd(DT({onFailure:()=>hn,onSuccess:()=>u0(o,h=>h+1)}))),h=>Y(la(c),Se(p=>p(h)))];return[u,kde(t)?r:r.set(t,d)]}))))))}),kd)}}const _de=lt(()=>ot(nde(new Map),e=>new W5(e))),G5=()=>new W5(j5(new Map)),MR=W(2,(e,t)=>Se(_de,n=>Y5(e,n,t))),Y5=W(3,(e,t,n)=>Se(Q5(e,n),r=>R4(r(t),xde,t))),Q5=(e,t,n=!1)=>{const r=e;switch(r._op_layer){case"Locally":return Ce(()=>i=>r.f(i.getOrElseMemoize(r.self,t)));case"ExtendScope":return Ce(()=>i=>wR(o=>i.getOrElseMemoize(r.layer,o)));case"Fold":return Ce(()=>i=>Y(i.getOrElseMemoize(r.layer,t),Ao({onFailure:o=>i.getOrElseMemoize(r.failureK(o),t),onSuccess:o=>i.getOrElseMemoize(r.successK(o),t)})));case"Fresh":return Ce(()=>i=>Y(r.layer,MR(t)));case"FromEffect":return Ce(n?()=>i=>r.effect:()=>i=>i.getOrElseMemoize(e,t));case"Provide":return Ce(()=>i=>Y(i.getOrElseMemoize(r.first,t),Se(o=>Y(i.getOrElseMemoize(r.second,t),Wh(o)))));case"Scoped":return Ce(n?()=>i=>Xh(r.effect,t):()=>i=>i.getOrElseMemoize(e,t));case"Suspend":return Ce(()=>i=>i.getOrElseMemoize(r.evaluate(),t));case"ProvideMerge":return Ce(()=>i=>Y(i.getOrElseMemoize(r.first,t),OV(i.getOrElseMemoize(r.second,t),r.zipK)));case"ZipWith":return RV(function*(){const i=yield*Xa(t,FT),o=yield*Xa(i,cc),a=yield*Xa(i,cc);return c=>Y(c.getOrElseMemoize(r.first,o),Dy(c.getOrElseMemoize(r.second,a),r.zipK,{concurrent:!0}))});case"MergeAll":{const i=r.layers;return ot(Xa(t,FT),o=>a=>{const c=new Array(i.length);return ot(Os(i,uie(function*(u,d){const h=yield*Xa(o,cc),p=yield*a.getOrElseMemoize(u,h);c[d]=p}),!1,!1),()=>Ree(...c))})}}},Ede=()=>Ny(ew()),Tde=e=>X5(pw(e)),X5=e=>Ny(xr(e)),J5=W(2,(e,t)=>Ade(e,{onFailure:Tde,onSuccess:t})),Cde=W(2,(e,t)=>{const n=ah(e),r=n?e:t;return Ny(ot(n?t:e,o=>Tx(r,o)))});function Ny(e){const t=Object.create(xc);return t._op_layer=ode,t.effect=e,t}const Ide=(e,t)=>Ly(S5(e,t)),Mde=(e,t)=>Ly(kR(e,t)),Rde=W(2,(e,{onFailure:t,onSuccess:n})=>{const r=Object.create(xc);return r._op_layer=rde,r.layer=e,r.failureK=t,r.successK=n,r}),Ade=W(2,(e,{onFailure:t,onSuccess:n})=>Rde(e,{onFailure:r=>{const i=E5(r);switch(i._tag){case"Left":return t(i.left);case"Right":return X5(i.right)}},onSuccess:n})),RR=(...e)=>{const t=Object.create(xc);return t._op_layer=cde,t.layers=e,t},Z5=W(2,(e,t)=>{const n=ah(e),r=n?e:t;return eH(ot(n?t:e,o=>Tx(r,o)))}),Ly=e=>eH(Y(e,Zr(uy()))),eH=e=>{const t=Object.create(xc);return t._op_layer=sde,t.effect=e,t},Ode=W(2,(e,t)=>{const n=ah(e);return Ny(Ie(Tx(n?e:t,n?t:e)))}),tH=e=>Ny(Ie(e)),Dde=tH(uy()),Pde=e=>{const t=Object.create(xc);return t._op_layer=ade,t.evaluate=e,t},Nde=W(2,(e,t)=>Se(wR(n=>Y5(e,t,n)),n=>Y(K5(),Wh(n)))),nH=W(2,(e,t)=>Pde(()=>{const n=Object.create(xc);return n._op_layer=lde,n.first=Object.create(xc,{_op_layer:{value:F5,enumerable:!0},first:{value:Ede(),enumerable:!0},second:{value:Array.isArray(t)?RR(...t):t},zipK:{value:(r,i)=>Y(r,Oc(i))}}),n.second=e,n})),Lde=W(2,(e,t)=>{const n=Object.create(xc);return n._op_layer=F5,n.first=t,n.second=nH(e,t),n.zipK=(r,i)=>Y(r,Oc(i)),n}),$de=e=>{const t=ds("effect/Layer/unwrapScoped/Layer.Layer<R1, E1, A>");return J5(Z5(t,e),n=>ma(n,t))},A$=W(2,(e,t)=>y5(n=>Se(MR(t,n),r=>FM(e,r)))),O$=W(2,(e,t)=>{const n=wg(Sc.fiberRefs,t.fiberRefs),r=Pu(Sc.runtimeFlags,t.runtimeFlags);return us(i=>Nt(o=>{const a=o.getFiberRef(Pc),c=o.getFiberRefs(),u=kg(o.id(),c)(n),d=o.currentRuntimeFlags,h=Vf(r)(d),p=wg(u,c),y=Pu(h,d);return o.setFiberRefs(u),o.currentRuntimeFlags=h,Eg(FM(i(e),Oc(a,t.context)),Nt(g=>(g.setFiberRefs(kg(g.id(),g.getFiberRefs())(p)),g.currentRuntimeFlags=Vf(y)(g.currentRuntimeFlags),hn)))}))}),jde=W(2,(e,t)=>Array.isArray(t)?A$(e,RR(...t)):wde(t)?A$(e,t):Mee(t)?FM(e,t):rC in t?Se(t.runtimeEffect,n=>O$(e,n)):O$(e,t)),Fde=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return{BaseEffectError:class extends NM{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError})(),zde=e=>{const t={BaseEffectError:class extends Fde{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},Bde="effect/Schedule",rH=Symbol.for(Bde),Ude=e=>st(e,rH),qde="effect/ScheduleDriver",Vde=Symbol.for(qde),lC={start:0,now:0,input:void 0,output:void 0,elapsed:Gu,elapsedSincePrevious:Gu,recurrence:0},cC=Cx()("effect/Schedule/CurrentIterationMetadata",{defaultValue:()=>lC}),Hde={_Out:e=>e,_In:e=>e,_R:e=>e},Kde={_Out:e=>e,_In:e=>e,_R:e=>e};class Wde{initial;step;[rH]=Hde;constructor(t,n){this.initial=t,this.step=n}pipe(){return He(this,arguments)}}const D$=(e,t,n,r)=>u0(e,i=>i.recurrence===0?{now:t,input:n,output:r,recurrence:i.recurrence+1,elapsed:Gu,elapsedSincePrevious:Gu,start:t}:{now:t,input:n,output:r,recurrence:i.recurrence+1,elapsed:dl(t-i.start),elapsedSincePrevious:dl(t-i.now),start:i.start});class Gde{schedule;ref;[Vde]=Kde;constructor(t,n){this.schedule=t,this.ref=n}get state(){return ot(la(this.ref),t=>t[1])}get last(){return Se(la(this.ref),([t,n])=>{switch(t._tag){case"None":return by(()=>new $M);case"Some":return Ie(t.value)}})}iterationMeta=rR(lC);get reset(){return Kf(this.ref,[Ae(),this.schedule.initial]).pipe(Wx(Kf(this.iterationMeta,lC)))}next(t){return Y(ot(la(this.ref),n=>n[1]),Se(n=>Y(Sg,Se(r=>Y(lt(()=>this.schedule.step(r,t,n)),Se(([i,o,a])=>{const c=Kf(this.ref,[Oe(o),i]);if(Ig(a))return c.pipe(Br(Rr(Ae())));const u=tC(a.intervals)-r;if(u<=0)return c.pipe(Br(D$(this.iterationMeta,r,t,o)),Zr(o));const d=dl(u);return Y(c,Br(D$(this.iterationMeta,r,t,o)),Br(iR(d)),Zr(o))}))))))}}const ep=(e,t)=>new Wde(e,t),Yde=W(2,(e,t)=>Qde(e,n=>Ce(()=>t(n)))),Qde=W(2,(e,t)=>nfe(e,(n,r)=>ot(t(n),i=>rte(r,Ro(i))))),Xde=W(2,(e,t)=>AR(e,(n,r)=>Ce(()=>t(n,r)))),AR=W(2,(e,t)=>ep(e.initial,(n,r,i)=>Se(e.step(n,r,i),([o,a,c])=>Ig(c)?Ie([o,a,Cg]):ot(t(r,a),u=>u?[o,a,c]:[o,a,Cg])))),iH=e=>Y(c0([Ae(),e.initial]),ot(t=>new Gde(e,t))),Jde=W(2,(e,t)=>Zde(e,t,$ue)),Zde=W(3,(e,t,n)=>ep([e.initial,t.initial],(r,i,o)=>Y(OV(e.step(r,i,o[0]),t.step(r,i,o[1]),(a,c)=>[a,c]),Se(([[a,c,u],[d,h,p]])=>M$(u)&&M$(p)?uC(e,t,i,a,c,u.intervals,d,h,p.intervals,n):Ie([[a,d],[c,h],Cg]))))),uC=(e,t,n,r,i,o,a,c,u,d)=>{const h=d(o,u);return Fue(h)?Ie([[r,a],[i,c],Hue(h)]):Y(o,jue(u))?Se(e.step(nC(o),n,r),([p,y,g])=>Ig(g)?Ie([[p,a],[y,c],Cg]):uC(e,t,n,p,y,g.intervals,a,c,u,d)):Se(t.step(nC(u),n,a),([p,y,g])=>Ig(g)?Ie([[r,p],[i,y],Cg]):uC(e,t,n,r,i,o,p,y,g.intervals,d))},efe=W(2,(e,t)=>tfe(e,n=>Ce(()=>t(n)))),tfe=W(2,(e,t)=>ep(e.initial,(n,r,i)=>Se(e.step(n,r,i),([o,a,c])=>ot(t(a),u=>[o,u,c])))),nfe=W(2,(e,t)=>ep(e.initial,(n,r,i)=>Se(e.step(n,r,i),([o,a,c])=>{if(Ig(c))return Ie([o,a,c]);const u=c.intervals,d=Iue(C$(n,tC(u)));return ot(t(a,d),h=>{const p=Ro(h),y=tC(u),g=n+Yu(p),v=g-y,S=Math.max(0,nC(u)+v),x=C$(g,S);return[o,a,O5(x)]})}))),rfe=e=>ep(e.initial,(t,n,r)=>Y(e.step(t,n,r),ot(([i,o,a])=>[i,n,a]))),ife=e=>cfe(OR,t=>t<e),ofe=e=>Yde(OR,()=>e),sfe=(e,t)=>ep(e,(n,r,i)=>Ce(()=>[t(i),i,O5(Mue(n))])),afe=W(2,(e,t)=>AR(e,(n,r)=>qse(t(n)))),lfe=W(2,(e,t)=>AR(e,(n,r)=>t(n))),cfe=W(2,(e,t)=>Xde(e,(n,r)=>t(r))),bS=Symbol.for("effect/Schedule/ScheduleDefect");class ufe{error;[bS];constructor(t){this.error=t,this[bS]=bS}}const dfe=e=>st(e,bS),P$=e=>yg(e,t=>ra(new ufe(t))),ffe=e=>Xn(zx(e,t=>lV(t)&&dfe(t.defect)?Oe(t.defect):Ae()),{onNone:()=>e,onSome:t=>mc(t.error)}),hfe=e=>_V(e,t=>xr(ffe(t))),N$=W(2,(e,t)=>mfe(e,t,(n,r)=>Rr(n))),pfe=W(2,(e,t)=>{if(Ude(t))return N$(e,t);const n=t.schedule??rfe(OR),r=t.while?lfe(n,a=>{const c=t.while(a);return typeof c=="boolean"?Ie(c):P$(c)}):n,i=t.until?afe(r,a=>{const c=t.until(a);return typeof c=="boolean"?Ie(c):P$(c)}):r,o=t.times?Jde(i,ife(t.times)).pipe(efe(a=>a[0])):i;return hfe(N$(e,o))}),mfe=W(3,(e,t,n)=>Se(iH(t),r=>hl(e,{onFailure:i=>n(i,Ae()),onSuccess:i=>oH(jT(e,cC,la(r.iterationMeta)),r,(o,a)=>jT(n(o,a),cC,la(r.iterationMeta)),i)}))),oH=(e,t,n,r)=>hl(t.next(r),{onFailure:()=>sie(t.last),onSuccess:i=>hl(e,{onFailure:o=>n(o,Oe(i)),onSuccess:o=>oH(e,t,n,o)})}),OR=sfe(0,e=>e+1),Td=xa,$c=vR,sn=wh,L$=Nt,Qa=Rr,gr=xr,Mg=ra,Js=EV,ae=RV,gfe=Vse,on=Ie,En=lt,Ze=Ce,he=hn,wc=xy,Rg=yg,zt=_V,I1=Pse,yfe=jse,dm=Gse,mf=zr,wo=Vx,sc=_d,DR=us,pi=Zr,fn=Ci,Qe=ot,PR=Hx,sH=xV,Cf=g5,_o=Eg,NR=b5,dC=y5,bfe=nue,vfe=C4,Sfe=Uh,aH=Zce,xfe=hw,no=N5,Vn=Que,wfe=Nse,kfe=iR,_fe=Jue,lH=ew,cH=KV,Eh=jde,ci=R4,Efe=jT,ft=Xse,vo=bh,en=sa,uH=oie,Tfe=Qse,ze=Se,Cs=kd,M1=w5,Cfe=Xue,LR=x5,li=Sy,$R=Wse,jR=Lse,$$=pfe,lr=Vh,Ife=M4,Mfe=I4,w0=CV,ko=Ao,Rfe=hl,dH=Fse,Afe=zse,Ofe=Bse,dc=Use,FR=Ose,Dfe=K5,zR=Yue,Pfe=sC,k0=aC,Th=rue,BR=iue,rt=oue,mw=Dy,Oo=Vi,ut=wy,fH=fw,hH=zV,Nfe=e=>Ly(kR(fw,qf(e))),Lfe=e=>Ly(kR(fw,_M(e))),$fe=W(2,(e,t)=>J5(Lfe(e),()=>Nfe(t))),jfe=IR,gw=MR,Ffe=Cde,fc=Dde,ol=RR,$y=Ide,jy=Mde,_0=Z5,zfe=Ly,ca=Ode,Bfe=tH,pH=nH,Ufe=Lde,qfe=$de,Vfe="effect/QueueEnqueue",mH=Symbol.for(Vfe),Hfe="effect/QueueDequeue",UR=Symbol.for(Hfe),Kfe="effect/QueueStrategy",qR=Symbol.for(Kfe),Wfe="effect/BackingQueue",Gfe=Symbol.for(Wfe),VR={_A:e=>e},Yfe={_A:e=>e},gH={_In:e=>e},HR={_Out:e=>e};class Qfe extends Yh{queue;takers;shutdownHook;shutdownFlag;strategy;[mH]=gH;[UR]=HR;constructor(t,n,r,i,o){super(),this.queue=t,this.takers=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=o}pipe(){return He(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return lt(()=>yg(this.unsafeSize(),()=>zr))}unsafeSize(){return Ft(this.shutdownFlag)?Ae():Oe(this.queue.length()-qM(this.takers)+this.strategy.surplusSize())}get isEmpty(){return ot(this.size,t=>t<=0)}get isFull(){return ot(this.size,t=>t>=this.capacity())}get shutdown(){return _d(Nt(t=>(Y(this.shutdownFlag,vd(!0)),Y(Os(Gf(this.takers),n=>Jx(n,t.id()),!1,!1),Br(this.strategy.shutdown),Kx(Ty(this.shutdownHook,void 0)),Ci))))}get isShutdown(){return Ce(()=>Ft(this.shutdownFlag))}get awaitShutdown(){return Ls(this.shutdownHook)}isActive(){return!Ft(this.shutdownFlag)}unsafeOffer(t){if(Ft(this.shutdownFlag))return!1;let n;if(this.queue.length()===0){const i=Y(this.takers,aa(qn));i!==qn?(Lu(i,t),n=!0):n=!1}else n=!1;if(n)return!0;const r=this.queue.offer(t);return ku(this.strategy,this.queue,this.takers),r}offer(t){return lt(()=>{if(Ft(this.shutdownFlag))return zr;let n;if(this.queue.length()===0){const i=Y(this.takers,aa(qn));i!==qn?(Lu(i,t),n=!0):n=!1}else n=!1;if(n)return Ie(!0);const r=this.queue.offer(t);return ku(this.strategy,this.queue,this.takers),r?Ie(!0):this.strategy.handleSurplus([t],this.queue,this.takers,this.shutdownFlag)})}offerAll(t){return lt(()=>{if(Ft(this.shutdownFlag))return zr;const n=zn(t),r=this.queue.length()===0?zn(ghe(this.takers,n.length)):Vu,[i,o]=Y(n,MU(r.length));for(let c=0;c<r.length;c++){const u=r[c],d=i[c];Lu(u,d)}if(o.length===0)return Ie(!0);const a=this.queue.offerAll(o);return ku(this.strategy,this.queue,this.takers),jh(a)?Ie(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return Nt(t=>{if(Ft(this.shutdownFlag))return zr;const n=this.queue.poll(qn);if(n!==qn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),Ie(n);{const r=Kh(t.id());return Y(lt(()=>(Y(this.takers,yc(r)),ku(this.strategy,this.queue,this.takers),Ft(this.shutdownFlag)?zr:Ls(r))),qh(()=>Ce(()=>yhe(this.takers,r))))}})}get takeAll(){return lt(()=>Ft(this.shutdownFlag)?zr:Ce(()=>{const t=this.queue.pollUpTo(Number.POSITIVE_INFINITY);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),ga(t)}))}takeUpTo(t){return lt(()=>Ft(this.shutdownFlag)?zr:Ce(()=>{const n=this.queue.pollUpTo(t);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),ga(n)}))}takeBetween(t,n){return lt(()=>yH(this,t,n,an()))}}const yH=(e,t,n,r)=>n<t?Ie(r):Y(lhe(e,n),Se(i=>{const o=t-i.length;return o===1?Y(fC(e),ot(a=>Y(r,qr(i),lh(a)))):o>1?Y(fC(e),Se(a=>yH(e,o-1,n-i.length-1,Y(r,qr(i),lh(a))))):Ie(Y(r,qr(i)))})),Xfe=e=>Y(Ce(()=>XV(e)),Se(t=>KR(WR(t),uhe()))),Jfe=e=>Y(Ce(()=>XV(e)),Se(t=>KR(WR(t),fhe()))),Zfe=()=>Y(Ce(()=>Cy()),Se(e=>KR(WR(e),dhe()))),ehe=(e,t,n,r,i)=>new Qfe(e,t,n,r,i),KR=(e,t)=>Y(Ey(),ot(n=>ehe(e,Cy(),n,bd(!1),t)));class the{mutable;[Gfe]=Yfe;constructor(t){this.mutable=t}poll(t){return aa(this.mutable,t)}pollUpTo(t){return tw(this.mutable,t)}offerAll(t){return VM(this.mutable,t)}offer(t){return yc(this.mutable,t)}capacity(){return coe(this.mutable)}length(){return qM(this.mutable)}}const WR=e=>new the(e),nhe=e=>e.size,rhe=e=>e.isShutdown,ihe=e=>e.shutdown,ohe=W(2,(e,t)=>e.offer(t)),she=e=>ot(e.takeUpTo(1),Ix),fC=e=>e.take,ahe=e=>e.takeAll,lhe=W(2,(e,t)=>e.takeUpTo(t)),che=W(3,(e,t,n)=>e.takeBetween(t,n)),uhe=()=>new hhe,dhe=()=>new phe,fhe=()=>new mhe;let hhe=class{[qR]=VR;putters=Cy();surplusSize(){return qM(this.putters)}onCompleteTakersWithEmptyQueue(t){for(;!Nu(this.putters)&&!Nu(t);){const n=aa(t,void 0),r=aa(this.putters,void 0);r[2]&&Lu(r[1],!0),Lu(n,r[0])}}get shutdown(){return Y(vy,Se(t=>Y(Ce(()=>Gf(this.putters)),Se(n=>Os(n,([r,i,o])=>o?Y(Jx(i,t),Ci):hn,!1,!1)))))}handleSurplus(t,n,r,i){return Nt(o=>{const a=Kh(o.id());return Y(lt(()=>(this.unsafeOffer(t,a),this.unsafeOnQueueEmptySpace(n,r),ku(this,n,r),Ft(i)?zr:Ls(a))),qh(()=>Ce(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(t,n){let r=!0;for(;r&&(t.capacity()===Number.POSITIVE_INFINITY||t.length()<t.capacity());){const i=Y(this.putters,aa(qn));if(i===qn)r=!1;else{const o=t.offer(i[0]);o&&i[2]?Lu(i[1],!0):o||E0(this.putters,Y(Gf(this.putters),Jr(i))),ku(this,t,n)}}}unsafeOffer(t,n){const r=zn(t);for(let i=0;i<r.length;i++){const o=r[i];i===r.length-1?Y(this.putters,yc([o,n,!0])):Y(this.putters,yc([o,n,!1]))}}unsafeRemove(t){E0(this.putters,Y(Gf(this.putters),dy(([,n])=>n!==t)))}},phe=class{[qR]=VR;surplusSize(){return 0}get shutdown(){return hn}onCompleteTakersWithEmptyQueue(){}handleSurplus(t,n,r,i){return Ie(!1)}unsafeOnQueueEmptySpace(t,n){}},mhe=class{[qR]=VR;surplusSize(){return 0}get shutdown(){return hn}onCompleteTakersWithEmptyQueue(){}handleSurplus(t,n,r,i){return Ce(()=>(this.unsafeOffer(n,t),ku(this,n,r),!0))}unsafeOnQueueEmptySpace(t,n){}unsafeOffer(t,n){const r=n[Symbol.iterator]();let i,o=!0;for(;!(i=r.next()).done&&o;){if(t.capacity()===0)return;t.poll(qn),o=t.offer(i.value)}}};const Lu=(e,t)=>Zx(e,Ie(t)),E0=(e,t)=>Y(e,VM(t)),Gf=e=>Y(e,tw(Number.POSITIVE_INFINITY)),ghe=(e,t)=>Y(e,tw(t)),yhe=(e,t)=>{E0(e,Y(Gf(e),dy(n=>t!==n)))},ku=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){const i=Y(n,aa(qn));if(i!==qn){const o=t.poll(qn);o!==qn?(Lu(i,o),e.unsafeOnQueueEmptySpace(t,n)):E0(n,Y(Gf(n),Jr(i))),r=!0}else r=!1}r&&t.length()===0&&!Nu(n)&&e.onCompleteTakersWithEmptyQueue(n)},Gn=Symbol.for("effect/PubSub/AbsentValue"),bH=(e,t)=>n=>{n.has(e)||n.set(e,new Set),n.get(e).add(t)},bhe=(e,t)=>n=>{if(!n.has(e))return;const r=n.get(e);r.delete(t),r.size===0&&n.delete(e)},vhe=e=>lt(()=>{const t=vH(e);return GR(t,new Hhe)}),She=e=>lt(()=>{const t=vH(e);return GR(t,new Whe)}),xhe=e=>lt(()=>{const t=The(e);return GR(t,new Khe)}),whe=e=>e.shutdown,khe=W(2,(e,t)=>e.publish(t)),_he=W(2,(e,t)=>e.publishAll(t)),Ehe=e=>e.subscribe,vH=e=>{const t=typeof e=="number"?{capacity:e}:e;zhe(t.capacity);const n=t.replay&&t.replay>0?new wH(Math.ceil(t.replay)):void 0;return t.capacity===1?new Dhe(n):mZ(t.capacity)===t.capacity?new Ahe(t.capacity,n):new Mhe(t.capacity,n)},The=e=>new Nhe(e?.replay?new wH(e.replay):void 0),Che=(e,t,n)=>ot(Ey(),r=>Ihe(e,t,e.subscribe(),Cy(),r,bd(!1),n)),Ihe=(e,t,n,r,i,o,a)=>new $he(e,t,n,r,i,o,a,e.replayWindow());class Mhe{capacity;replayBuffer;array;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new yw(this.replayBuffer):bw}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;if(this.subscriberCount!==0){const n=this.publisherIndex%this.capacity;this.array[n]=t,this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return this.replayBuffer&&this.replayBuffer.offer(t),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),an();const n=ga(t),r=n.length,i=this.publisherIndex-this.subscribersIndex,o=this.capacity-i,a=Math.min(r,o);if(a===0)return n;let c=0;const u=this.publisherIndex+a;for(;this.publisherIndex!==u;){const d=oa(n,c++),h=this.publisherIndex%this.capacity;this.array[h]=d,this.subscribers[h]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer&&this.replayBuffer.offer(d)}return Wu(n,c)}slide(){if(this.subscribersIndex!==this.publisherIndex){const t=this.subscribersIndex%this.capacity;this.array[t]=Gn,this.subscribers[t]=0,this.subscribersIndex+=1}this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new Rhe(this,this.publisherIndex,!1)}}class Rhe{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(t){if(this.unsubscribed)return t;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){const n=this.subscriberIndex%this.self.capacity,r=this.self.array[n];return this.self.subscribers[n]-=1,this.self.subscribers[n]===0&&(this.self.array[n]=Gn,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return t}pollUpTo(t){if(this.unsubscribed)return an();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);const n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return an();const i=[],o=this.subscriberIndex+r;for(;this.subscriberIndex!==o;){const a=this.subscriberIndex%this.self.capacity,c=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=Gn,this.self.subscribersIndex+=1),i.push(c),this.subscriberIndex+=1}return ga(i)}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){const t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Gn,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}}class Ahe{capacity;replayBuffer;array;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new yw(this.replayBuffer):bw}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;if(this.subscriberCount!==0){const n=this.publisherIndex&this.mask;this.array[n]=t,this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return this.replayBuffer&&this.replayBuffer.offer(t),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),an();const n=ga(t),r=n.length,i=this.publisherIndex-this.subscribersIndex,o=this.capacity-i,a=Math.min(r,o);if(a===0)return n;let c=0;const u=this.publisherIndex+a;for(;this.publisherIndex!==u;){const d=oa(n,c++),h=this.publisherIndex&this.mask;this.array[h]=d,this.subscribers[h]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer&&this.replayBuffer.offer(d)}return Wu(n,c)}slide(){if(this.subscribersIndex!==this.publisherIndex){const t=this.subscribersIndex&this.mask;this.array[t]=Gn,this.subscribers[t]=0,this.subscribersIndex+=1}this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new Ohe(this,this.publisherIndex,!1)}}class Ohe{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(t){if(this.unsubscribed)return t;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){const n=this.subscriberIndex&this.self.mask,r=this.self.array[n];return this.self.subscribers[n]-=1,this.self.subscribers[n]===0&&(this.self.array[n]=Gn,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return t}pollUpTo(t){if(this.unsubscribed)return an();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);const n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return an();const i=[],o=this.subscriberIndex+r;for(;this.subscriberIndex!==o;){const a=this.subscriberIndex&this.self.mask,c=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=Gn,this.self.subscribersIndex+=1),i.push(c),this.subscriberIndex+=1}return ga(i)}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){const t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Gn,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}}class Dhe{replayBuffer;publisherIndex=0;subscriberCount=0;subscribers=0;value=Gn;capacity=1;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new yw(this.replayBuffer):bw}pipe(){return He(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){return this.isFull()?!1:(this.subscriberCount!==0&&(this.value=t,this.subscribers=this.subscriberCount,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(t),!0)}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),an();const n=ga(t);return jh(n)?n:this.publish(hM(n))?Wu(n,1):n}slide(){this.isFull()&&(this.subscribers=0,this.value=Gn),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new Phe(this,this.publisherIndex,!1)}}class Phe{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(t){if(this.isEmpty())return t;const n=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gn),this.subscriberIndex+=1,n}pollUpTo(t){if(this.isEmpty()||t<1)return an();const n=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gn),this.subscriberIndex+=1,In(n)}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gn)))}}class Nhe{replayBuffer;publisherHead={value:Gn,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new yw(this.replayBuffer):bw}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){const n=this.publisherTail.subscribers;return n!==0&&(this.publisherTail.next={value:t,subscribers:n,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(t),!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(const n of t)this.publish(n);else this.replayBuffer&&this.replayBuffer.offerAll(t);return an()}slide(){this.publisherHead!==this.publisherTail&&(this.publisherHead=this.publisherHead.next,this.publisherHead.value=Gn,this.subscribersIndex+=1),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new Lhe(this,this.publisherTail,this.publisherIndex,!1)}}class Lhe{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,n,r,i){this.self=t,this.subscriberHead=n,this.subscriberIndex=r,this.unsubscribed=i}isEmpty(){if(this.unsubscribed)return!0;let t=!0,n=!0;for(;n;)this.subscriberHead===this.self.publisherTail?n=!1:this.subscriberHead.next.value!==Gn?(t=!1,n=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(t){if(this.unsubscribed)return t;let n=!0,r=t;for(;n;)if(this.subscriberHead===this.self.publisherTail)n=!1;else{const i=this.subscriberHead.next.value;i!==Gn&&(r=i,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gn,this.self.subscribersIndex+=1),n=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){const n=[],r=Gn;let i=0;for(;i!==t;){const o=this.poll(r);o===r?i=t:(n.push(o),i+=1)}return ga(n)}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==Gn&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gn,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}}class $he extends Yh{pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;[UR]=HR;constructor(t,n,r,i,o,a,c,u){super(),this.pubsub=t,this.subscribers=n,this.subscription=r,this.pollers=i,this.shutdownHook=o,this.shutdownFlag=a,this.strategy=c,this.replayWindow=u}commit(){return this.take}pipe(){return He(this,arguments)}capacity(){return this.pubsub.capacity}isActive(){return!Ft(this.shutdownFlag)}get size(){return lt(()=>Ft(this.shutdownFlag)?zr:Ie(this.subscription.size()+this.replayWindow.remaining))}unsafeSize(){return Ft(this.shutdownFlag)?Ae():Oe(this.subscription.size()+this.replayWindow.remaining)}get isFull(){return lt(()=>Ft(this.shutdownFlag)?zr:Ie(this.subscription.size()===this.capacity()))}get isEmpty(){return ot(this.size,t=>t===0)}get shutdown(){return _d(Nt(t=>(vd(this.shutdownFlag,!0),Y(SR(Yf(this.pollers),n=>Jx(n,t.id()),!1),Br(Ce(()=>{this.subscribers.delete(this.subscription),this.subscription.unsubscribe(),this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers)})),Kx(Ty(this.shutdownHook,void 0)),Ci))))}get isShutdown(){return Ce(()=>Ft(this.shutdownFlag))}get awaitShutdown(){return Ls(this.shutdownHook)}get take(){return Nt(t=>{if(Ft(this.shutdownFlag))return zr;if(this.replayWindow.remaining>0){const r=this.replayWindow.take();return Ie(r)}const n=Nu(this.pollers)?this.subscription.poll(qn):qn;if(n===qn){const r=Kh(t.id());return Y(lt(()=>(Y(this.pollers,yc(r)),Y(this.subscribers,bH(this.subscription,this.pollers)),this.strategy.unsafeCompletePollers(this.pubsub,this.subscribers,this.subscription,this.pollers),Ft(this.shutdownFlag)?zr:Ls(r))),qh(()=>Ce(()=>Vhe(this.pollers,r))))}else return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),Ie(n)})}get takeAll(){return lt(()=>{if(Ft(this.shutdownFlag))return zr;const t=Nu(this.pollers)?Bhe(this.subscription):an();return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),this.replayWindow.remaining>0?Ie(qr(this.replayWindow.takeAll(),t)):Ie(t)})}takeUpTo(t){return lt(()=>{if(Ft(this.shutdownFlag))return zr;let n;if(this.replayWindow.remaining>=t){const i=this.replayWindow.takeN(t);return Ie(i)}else this.replayWindow.remaining>0&&(n=this.replayWindow.takeAll(),t=t-n.length);const r=Nu(this.pollers)?Uhe(this.subscription,t):an();return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),Ie(n?qr(n,r):r)})}takeBetween(t,n){return lt(()=>SH(this,t,n,an()))}}const SH=(e,t,n,r)=>n<t?Ie(r):Y(e.takeUpTo(n),Se(i=>{const o=t-i.length;return o===1?Y(e.take,ot(a=>Y(r,qr(i),lh(a)))):o>1?Y(e.take,Se(a=>SH(e,o-1,n-i.length-1,Y(r,qr(i),lh(a))))):Ie(Y(r,qr(i)))}));class jhe{pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;[mH]=gH;[UR]=HR;constructor(t,n,r,i,o,a){this.pubsub=t,this.subscribers=n,this.scope=r,this.shutdownHook=i,this.shutdownFlag=o,this.strategy=a}capacity(){return this.pubsub.capacity}get size(){return lt(()=>Ft(this.shutdownFlag)?zr:Ce(()=>this.pubsub.size()))}unsafeSize(){return Ft(this.shutdownFlag)?Ae():Oe(this.pubsub.size())}get isFull(){return ot(this.size,t=>t===this.capacity())}get isEmpty(){return ot(this.size,t=>t===0)}get awaitShutdown(){return Ls(this.shutdownHook)}get isShutdown(){return Ce(()=>Ft(this.shutdownFlag))}get shutdown(){return _d(Nt(t=>(Y(this.shutdownFlag,vd(!0)),Y(this.scope.close(VV(t.id())),Br(this.strategy.shutdown),Kx(Ty(this.shutdownHook,void 0)),Ci))))}publish(t){return lt(()=>Ft(this.shutdownFlag)?zr:this.pubsub.publish(t)?(this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),Ie(!0)):this.strategy.handleSurplus(this.pubsub,this.subscribers,In(t),this.shutdownFlag))}isActive(){return!Ft(this.shutdownFlag)}unsafeOffer(t){return Ft(this.shutdownFlag)?!1:this.pubsub.publish(t)?(this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),!0):!1}publishAll(t){return lt(()=>{if(Ft(this.shutdownFlag))return zr;const n=qhe(this.pubsub,t);return this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),jh(n)?Ie(!0):this.strategy.handleSurplus(this.pubsub,this.subscribers,n,this.shutdownFlag)})}get subscribe(){const t=Sy(vR([this.scope.fork(cc),Che(this.pubsub,this.subscribers,this.strategy)]),n=>n[0].addFinalizer(()=>n[1].shutdown));return ot(m5(t,(n,r)=>n[0].close(r)),n=>n[1])}offer(t){return this.publish(t)}offerAll(t){return this.publishAll(t)}pipe(){return He(this,arguments)}}const GR=(e,t)=>Se(Qh(),n=>ot(Ey(),r=>Fhe(e,new Map,n,r,bd(!1),t))),Fhe=(e,t,n,r,i,o)=>new jhe(e,t,n,r,i,o),zhe=e=>{if(e<=0)throw new Die(`Cannot construct PubSub with capacity of ${e}`)},xH=(e,t)=>{Zx(e,Ie(t))},T0=(e,t)=>Y(e,VM(t)),Yf=e=>Y(e,tw(Number.POSITIVE_INFINITY)),Bhe=e=>e.pollUpTo(Number.POSITIVE_INFINITY),Uhe=(e,t)=>e.pollUpTo(t),qhe=(e,t)=>e.publishAll(t),Vhe=(e,t)=>{T0(e,Y(Yf(e),dy(n=>n!==t)))};class Hhe{publishers=Cy();get shutdown(){return Se(vy,t=>Se(Ce(()=>Yf(this.publishers)),n=>Os(n,([r,i,o])=>o?Y(Jx(i,t),Ci):hn,!1,!1)))}handleSurplus(t,n,r,i){return Nt(o=>{const a=Kh(o.id());return Y(lt(()=>(this.unsafeOffer(r,a),this.unsafeOnPubSubEmptySpace(t,n),this.unsafeCompleteSubscribers(t,n),Ft(i)?zr:Ls(a))),qh(()=>Ce(()=>this.unsafeRemove(a))))})}unsafeOnPubSubEmptySpace(t,n){let r=!0;for(;r&&!t.isFull();){const i=Y(this.publishers,aa(qn));if(i===qn)r=!1;else{const o=t.publish(i[0]);o&&i[2]?xH(i[1],!0):o||T0(this.publishers,Y(Yf(this.publishers),Jr(i))),this.unsafeCompleteSubscribers(t,n)}}}unsafeCompletePollers(t,n,r,i){return YR(this,t,n,r,i)}unsafeCompleteSubscribers(t,n){return QR(this,t,n)}unsafeOffer(t,n){const r=t[Symbol.iterator]();let i=r.next();if(!i.done)for(;;){const o=i.value;if(i=r.next(),i.done){Y(this.publishers,yc([o,n,!0]));break}Y(this.publishers,yc([o,n,!1]))}}unsafeRemove(t){T0(this.publishers,Y(Yf(this.publishers),dy(([n,r])=>r!==t)))}}class Khe{get shutdown(){return hn}handleSurplus(t,n,r,i){return Ie(!1)}unsafeOnPubSubEmptySpace(t,n){}unsafeCompletePollers(t,n,r,i){return YR(this,t,n,r,i)}unsafeCompleteSubscribers(t,n){return QR(this,t,n)}}class Whe{get shutdown(){return hn}handleSurplus(t,n,r,i){return Ce(()=>(this.unsafeSlidingPublish(t,r),this.unsafeCompleteSubscribers(t,n),!0))}unsafeOnPubSubEmptySpace(t,n){}unsafeCompletePollers(t,n,r,i){return YR(this,t,n,r,i)}unsafeCompleteSubscribers(t,n){return QR(this,t,n)}unsafeSlidingPublish(t,n){const r=n[Symbol.iterator]();let i=r.next();if(!i.done&&t.capacity>0){let o=i.value,a=!0;for(;a;){t.slide();const c=t.publish(o);c&&(i=r.next())&&!i.done?o=i.value:c&&(a=!1)}}}}const YR=(e,t,n,r,i)=>{let o=!0;for(;o&&!r.isEmpty();){const a=Y(i,aa(qn));if(a===qn)Y(n,bhe(r,i)),Nu(i)?o=!1:Y(n,bH(r,i));else{const c=r.poll(qn);c===qn?T0(i,Y(Yf(i),Jr(a))):(xH(a,c),e.unsafeOnPubSubEmptySpace(t,n))}}},QR=(e,t,n)=>{for(const[r,i]of n)for(const o of i)e.unsafeCompletePollers(t,n,r,o)};class wH{capacity;constructor(t){this.capacity=t}head={value:Gn,next:null};tail=this.head;size=0;index=0;slide(){this.index++}offer(t){this.tail.value=t,this.tail.next={value:Gn,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1}offerAll(t){for(const n of t)this.offer(n)}}class yw{buffer;head;index;remaining;constructor(t){this.buffer=t,this.index=t.index,this.remaining=t.size,this.head=t.head}fastForward(){for(;this.index<this.buffer.index;)this.head=this.head.next,this.index++}take(){if(this.remaining===0)return;this.index<this.buffer.index&&this.fastForward(),this.remaining--;const t=this.head.value;return this.head=this.head.next,t}takeN(t){if(this.remaining===0)return an();this.index<this.buffer.index&&this.fastForward();const n=Math.min(t,this.remaining),r=new Array(n);for(let i=0;i<n;i++){const o=this.head.value;this.head=this.head.next,r[i]=o}return this.remaining-=n,Ns(r)}takeAll(){return this.takeN(this.remaining)}}const bw={remaining:0,take:()=>{},takeN:()=>an(),takeAll:()=>an()},Ghe=vhe,Yhe=She,C0=xhe,j$=whe,sl=khe,Qhe=_he,F$=Ehe,XR=Xfe,Xhe=Jfe,Qf=Zfe,Jhe=nhe,Zhe=rhe,Ch=ihe,sr=ohe,z$=she,Ag=fC,B$=ahe,epe=che,kH="Continue",tpe="Close",npe="Yield",rpe="effect/ChannelChildExecutorDecision",U$=Symbol.for(rpe),ipe={[U$]:U$},_H=e=>{const t=Object.create(ipe);return t._tag=kH,t},vS="ContinuationK",ope="ContinuationFinalizer",EH=Symbol.for("effect/ChannelContinuation"),TH={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutDone:e=>e,_OutErr2:e=>e,_OutElem:e=>e,_OutDone2:e=>e};class CH{onSuccess;onHalt;_tag=vS;[EH]=TH;constructor(t,n){this.onSuccess=t,this.onHalt=n}onExit(t){return GV(t)?this.onHalt(t.cause):this.onSuccess(t.value)}}class spe{finalizer;_tag=ope;[EH]=TH;constructor(t){this.finalizer=t}}const IH="PullAfterNext",ape="PullAfterAllEnqueued",lpe="effect/ChannelUpstreamPullStrategy",cpe=Symbol.for(lpe),upe={_A:e=>e},dpe={[cpe]:upe},MH=e=>{const t=Object.create(dpe);return t._tag=IH,t.emitSeparator=e,t},RH="BracketOut",AH="Bridge",JR="ConcatAll",OH="Emit",DH="Ensuring",PH="Fail",NH="Fold",LH="FromEffect",$H="PipeTo",fpe="Provide",jH="Read",FH="Succeed",zH="SucceedNow",BH="Suspend",hpe="effect/Channel",UH=Symbol.for(hpe),ppe={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},io={[UH]:ppe,pipe(){return He(this,arguments)}},qH=e=>st(e,UH)||Td(e),mpe=W(2,(e,t)=>{const n=Object.create(io);return n._tag=RH,n.acquire=()=>e,n.finalizer=t,n}),VH=(e,t,n)=>{const r=Object.create(io);return r._tag=JR,r.combineInners=t,r.combineAll=n,r.onPull=()=>MH(Ae()),r.onEmit=()=>_H,r.value=()=>e,r.k=Mt,r},gpe=W(4,(e,t,n,r)=>{const i=Object.create(io);return i._tag=JR,i.combineInners=n,i.combineAll=r,i.onPull=()=>MH(Ae()),i.onEmit=()=>_H,i.value=()=>e,i.k=t,i}),ZR=W(2,(e,t)=>{const n=Object.create(io);return n._tag=AH,n.input=t,n.channel=e,n}),ype=W(2,(e,t)=>{const n=Object.create(io);return n._tag=DH,n.channel=e,n.finalizer=t,n}),vw=e=>Fn(pw(e)),Fn=e=>bpe(()=>e),bpe=e=>{const t=Object.create(io);return t._tag=PH,t.error=e,t},Xt=W(2,(e,t)=>{const n=Object.create(io);return n._tag=NH,n.channel=e,n.k=new CH(t,Fn),n}),pr=e=>{const t=Object.create(io);return t._tag=LH,t.effect=()=>e,t},gi=W(2,(e,t)=>{const n=Object.create(io);return n._tag=$H,n.left=()=>e,n.right=()=>t,n}),eA=e=>fs({onInput:e.onInput,onFailure:t=>$i(E5(t),{onLeft:e.onFailure,onRight:Fn}),onDone:e.onDone}),fs=e=>{const t=Object.create(io);return t._tag=jH,t.more=e.onInput,t.done=new CH(e.onDone,e.onFailure),t},tA=e=>HH(()=>e),sd=e=>{const t=Object.create(io);return t._tag=zH,t.terminal=e,t},nA=e=>{const t=Object.create(io);return t._tag=BH,t.channel=e,t},HH=e=>{const t=Object.create(io);return t._tag=FH,t.evaluate=e,t},Vr=sd(void 0),Tn=e=>{const t=Object.create(io);return t._tag=OH,t.out=e,t},Fy="Done",zy="Emit",tp="FromEffect",By="Read",vpe=Symbol.for("effect/ChannelState"),Spe={_E:e=>e,_R:e=>e},Sw={[vpe]:Spe},gf=()=>{const e=Object.create(Sw);return e._tag=Fy,e},R1=()=>{const e=Object.create(Sw);return e._tag=zy,e},fm=e=>{const t=Object.create(Sw);return t._tag=tp,t.effect=e,t},A1=(e,t,n,r)=>{const i=Object.create(Sw);return i._tag=By,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},I0=e=>e._tag===tp,xpe=e=>I0(e)?e.effect:he,q$=e=>I0(e)?yfe(e.effect):void 0,KH="PullFromChild",hC="PullFromUpstream",pC="DrainChildExecutors",WH="Emit";class kv{childExecutor;parentSubexecutor;onEmit;_tag=KH;constructor(t,n,r){this.childExecutor=t,this.parentSubexecutor=n,this.onEmit=r}close(t){const n=this.childExecutor.close(t),r=this.parentSubexecutor.close(t);return n!==void 0&&r!==void 0?mw(en(n),en(r),(i,o)=>Y(i,vg(o))):n!==void 0?n:r!==void 0?r:void 0}enqueuePullFromChild(t){return this}}class xu{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=hC;constructor(t,n,r,i,o,a,c,u){this.upstreamExecutor=t,this.createChild=n,this.lastDone=r,this.activeChildExecutors=i,this.combineChildResults=o,this.combineWithChildResult=a,this.onPull=c,this.onEmit=u}close(t){const n=this.upstreamExecutor.close(t),i=[...this.activeChildExecutors.map(o=>o!==void 0?o.childExecutor.close(t):void 0),n].reduce((o,a)=>o!==void 0&&a!==void 0?mw(o,en(a),(c,u)=>vg(c,u)):o!==void 0?o:a!==void 0?en(a):void 0,void 0);return i}enqueuePullFromChild(t){return new xu(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,t],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}}class Nf{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=pC;constructor(t,n,r,i,o,a,c){this.upstreamExecutor=t,this.lastDone=n,this.activeChildExecutors=r,this.upstreamDone=i,this.combineChildResults=o,this.combineWithChildResult=a,this.onPull=c}close(t){const n=this.upstreamExecutor.close(t),i=[...this.activeChildExecutors.map(o=>o!==void 0?o.childExecutor.close(t):void 0),n].reduce((o,a)=>o!==void 0&&a!==void 0?mw(o,en(a),(c,u)=>vg(c,u)):o!==void 0?o:a!==void 0?en(a):void 0,void 0);return i}enqueuePullFromChild(t){return new Nf(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}}class O1{value;next;_tag=WH;constructor(t,n){this.value=t,this.next=n}close(t){const n=this.next.close(t);return n}enqueuePullFromChild(t){return this}}const wpe="Pulled",kpe="NoUpstream",_pe="effect/ChannelUpstreamPullRequest",Epe=Symbol.for(_pe),Tpe={_A:e=>e},GH={[Epe]:Tpe},V$=e=>{const t=Object.create(GH);return t._tag=wpe,t.value=e,t},Cpe=e=>{const t=Object.create(GH);return t._tag=kpe,t.activeDownstreamCount=e,t};class _u{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(t,n,r){this._currentChannel=t,this._executeCloseLastSubstream=r,this._providedEnv=n}run(){let t;for(;t===void 0;)if(this._cancelled!==void 0)t=this.processCancellation();else if(this._activeSubexecutor!==void 0)t=this.runSubexecutor();else try{if(this._currentChannel===void 0)t=gf();else switch(Td(this._currentChannel)&&(this._currentChannel=pr(this._currentChannel)),this._currentChannel._tag){case RH:{t=this.runBracketOut(this._currentChannel);break}case AH:{const n=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){const r=this._input;this._input=void 0;const i=()=>ze(n.awaitRead(),()=>En(()=>{const o=r.run();switch(o._tag){case Fy:return ji(r.getDone(),{onFailure:a=>n.error(a),onSuccess:a=>n.done(a)});case zy:return ze(n.emit(r.getEmit()),()=>i());case tp:return ko(o.effect,{onFailure:a=>n.error(a),onSuccess:()=>i()});case By:return rA(o,()=>i(),a=>n.error(a))}}));t=fm(ze(xfe(wo(i())),o=>Ze(()=>this.addFinalizer(a=>ze(fi(o),()=>En(()=>{const c=this.restorePipe(a,r);return c!==void 0?c:he}))))))}break}case JR:{const n=new _u(this._currentChannel.value(),this._providedEnv,i=>Ze(()=>{const o=this._closeLastSubstream===void 0?he:this._closeLastSubstream;this._closeLastSubstream=Y(o,rt(i))}));n._input=this._input;const r=this._currentChannel;this._activeSubexecutor=new xu(n,i=>r.k(i),void 0,[],(i,o)=>r.combineInners(i,o),(i,o)=>r.combineAll(i,o),i=>r.onPull(i),i=>r.onEmit(i)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case OH:{this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor!==void 0?void 0:Vr,t=R1();break}case DH:{this.runEnsuring(this._currentChannel);break}case PH:{t=this.doneHalt(this._currentChannel.error());break}case NH:{this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break}case LH:{const n=this._providedEnv===void 0?this._currentChannel.effect():Y(this._currentChannel.effect(),Eh(this._providedEnv));t=fm(ko(n,{onFailure:r=>{const i=this.doneHalt(r);return i!==void 0&&I0(i)?i.effect:he},onSuccess:r=>{const i=this.doneSucceed(r);return i!==void 0&&I0(i)?i.effect:he}}));break}case $H:{const n=this._input,r=new _u(this._currentChannel.left(),this._providedEnv,i=>this._executeCloseLastSubstream(i));r._input=n,this._input=r,this.addFinalizer(i=>{const o=this.restorePipe(i,n);return o!==void 0?o:he}),this._currentChannel=this._currentChannel.right();break}case fpe:{const n=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>Ze(()=>{this._providedEnv=n}));break}case jH:{const n=this._currentChannel;t=A1(this._input,Mt,r=>{try{this._currentChannel=n.more(r)}catch(i){this._currentChannel=n.done.onExit(Gie(i))}},r=>{const i=o=>n.done.onExit(o);this._currentChannel=i(r)});break}case FH:{t=this.doneSucceed(this._currentChannel.evaluate());break}case zH:{t=this.doneSucceed(this._currentChannel.terminal);break}case BH:{this._currentChannel=this._currentChannel.channel();break}}}catch(n){this._currentChannel=Fn(Tg(n))}return t}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(t){this._cancelled=t}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(t){this._inProgressFinalizer=t}popAllFinalizers(t){const n=[];let r=this._doneStack.pop();for(;r;)r._tag==="ContinuationFinalizer"&&n.push(r.finalizer),r=this._doneStack.pop();const i=n.length===0?he:P1(n,t);return this.storeInProgressFinalizer(i),i}popNextFinalizers(){const t=[];for(;this._doneStack.length!==0;){const n=this._doneStack[this._doneStack.length-1];if(n._tag===vS)return t;t.push(n),this._doneStack.pop()}return t}restorePipe(t,n){const r=this._input;return this._input=n,r!==void 0?r.close(t):he}close(t){let n;const r=this._inProgressFinalizer;r!==void 0&&(n=Y(r,_o(Ze(()=>this.clearInProgressFinalizer()))));let i;const o=this.popAllFinalizers(t);o!==void 0&&(i=Y(o,_o(Ze(()=>this.clearInProgressFinalizer()))));const a=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(t);if(!(a===void 0&&n===void 0&&i===void 0))return Y(en(D1(a)),Th(en(D1(n))),Th(en(D1(i))),Qe(([[c,u],d])=>Y(c,vg(u),vg(d))),sc,ze(c=>En(()=>c)))}doneSucceed(t){if(this._doneStack.length===0)return this._done=Zo(t),this._currentChannel=void 0,gf();const n=this._doneStack[this._doneStack.length-1];if(n._tag===vS){this._doneStack.pop(),this._currentChannel=n.onSuccess(t);return}const r=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=r.reverse(),this._done=Zo(t),this._currentChannel=void 0,gf();const i=P1(r.map(a=>a.finalizer),Zo(t));this.storeInProgressFinalizer(i);const o=Y(i,_o(Ze(()=>this.clearInProgressFinalizer())),sc,ze(()=>Ze(()=>this.doneSucceed(t))));return fm(o)}doneHalt(t){if(this._doneStack.length===0)return this._done=rs(t),this._currentChannel=void 0,gf();const n=this._doneStack[this._doneStack.length-1];if(n._tag===vS){this._doneStack.pop();try{this._currentChannel=n.onHalt(t)}catch(a){this._currentChannel=Fn(Tg(a))}return}const r=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=r.reverse(),this._done=rs(t),this._currentChannel=void 0,gf();const i=P1(r.map(a=>a.finalizer),rs(t));this.storeInProgressFinalizer(i);const o=Y(i,_o(Ze(()=>this.clearInProgressFinalizer())),sc,ze(()=>Ze(()=>this.doneHalt(t))));return fm(o)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,gf()}runBracketOut(t){const n=sc(ko(this.provide(t.acquire()),{onFailure:r=>Ze(()=>{this._currentChannel=Fn(r)}),onSuccess:r=>Ze(()=>{this.addFinalizer(i=>this.provide(t.finalizer(r,i))),this._currentChannel=Tn(r)})}));return fm(n)}provide(t){return this._providedEnv===void 0?t:Y(t,Eh(this._providedEnv))}runEnsuring(t){this.addFinalizer(t.finalizer),this._currentChannel=t.channel}addFinalizer(t){this._doneStack.push(new spe(t))}runSubexecutor(){const t=this._activeSubexecutor;switch(t._tag){case KH:return this.pullFromChild(t.childExecutor,t.parentSubexecutor,t.onEmit,t);case hC:return this.pullFromUpstream(t);case pC:return this.drainChildExecutors(t);case WH:return this._emitted=t.value,this._activeSubexecutor=t.next,R1()}}replaceSubexecutor(t){this._currentChannel=void 0,this._activeSubexecutor=t}finishWithExit(t){const n=ji(t,{onFailure:r=>this.doneHalt(r),onSuccess:r=>this.doneSucceed(r)});return this._activeSubexecutor=void 0,n===void 0?he:xpe(n)}finishSubexecutorWithCloseEffect(t,...n){this.addFinalizer(()=>Y(n,sn(i=>Y(Ze(()=>i(t)),ze(o=>o!==void 0?o:he)),{discard:!0})));const r=Y(t,ji({onFailure:i=>this.doneHalt(i),onSuccess:i=>this.doneSucceed(i)}));return this._activeSubexecutor=void 0,r}applyUpstreamPullStrategy(t,n,r){switch(r._tag){case IH:{const i=!t||n.some(o=>o!==void 0);return[r.emitSeparator,i?[void 0,...n]:n]}case ape:{const i=!t||n.some(o=>o!==void 0);return[r.emitSeparator,i?[...n,void 0]:n]}}}pullFromChild(t,n,r,i){return A1(t,Mt,o=>{const a=r(o);switch(a._tag){case kH:break;case tpe:{this.finishWithDoneValue(t,n,a.value);break}case npe:{const c=n.enqueuePullFromChild(i);this.replaceSubexecutor(c);break}}this._activeSubexecutor=new O1(o,this._activeSubexecutor)},ji({onFailure:o=>{const a=this.handleSubexecutorFailure(t,n,o);return a===void 0?void 0:q$(a)},onSuccess:o=>{this.finishWithDoneValue(t,n,o)}}))}finishWithDoneValue(t,n,r){const i=n;switch(i._tag){case hC:{const o=new xu(i.upstreamExecutor,i.createChild,i.lastDone!==void 0?i.combineChildResults(i.lastDone,r):r,i.activeChildExecutors,i.combineChildResults,i.combineWithChildResult,i.onPull,i.onEmit);this._closeLastSubstream=t.close(Zo(r)),this.replaceSubexecutor(o);break}case pC:{const o=new Nf(i.upstreamExecutor,i.lastDone!==void 0?i.combineChildResults(i.lastDone,r):r,i.activeChildExecutors,i.upstreamDone,i.combineChildResults,i.combineWithChildResult,i.onPull);this._closeLastSubstream=t.close(Zo(r)),this.replaceSubexecutor(o);break}}}handleSubexecutorFailure(t,n,r){return this.finishSubexecutorWithCloseEffect(rs(r),i=>n.close(i),i=>t.close(i))}pullFromUpstream(t){if(t.activeChildExecutors.length===0)return this.performPullFromUpstream(t);const n=t.activeChildExecutors[0],r=new xu(t.upstreamExecutor,t.createChild,t.lastDone,t.activeChildExecutors.slice(1),t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit);if(n===void 0)return this.performPullFromUpstream(r);this.replaceSubexecutor(new kv(n.childExecutor,r,n.onEmit))}performPullFromUpstream(t){return A1(t.upstreamExecutor,n=>{const r=this._closeLastSubstream===void 0?he:this._closeLastSubstream;return this._closeLastSubstream=void 0,Y(this._executeCloseLastSubstream(r),rt(n))},n=>{if(this._closeLastSubstream!==void 0){const a=this._closeLastSubstream;return this._closeLastSubstream=void 0,Y(this._executeCloseLastSubstream(a),Qe(()=>{const c=new _u(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);c._input=this._input;const[u,d]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(V$(n)));this._activeSubexecutor=new kv(c,new xu(t.upstreamExecutor,t.createChild,t.lastDone,d,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Pe(u)&&(this._activeSubexecutor=new O1(u.value,this._activeSubexecutor))}))}const r=new _u(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;const[i,o]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(V$(n)));this._activeSubexecutor=new kv(r,new xu(t.upstreamExecutor,t.createChild,t.lastDone,o,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Pe(i)&&(this._activeSubexecutor=new O1(i.value,this._activeSubexecutor))},n=>{if(t.activeChildExecutors.some(o=>o!==void 0)){const o=new Nf(t.upstreamExecutor,t.lastDone,[void 0,...t.activeChildExecutors],t.upstreamExecutor.getDone(),t.combineChildResults,t.combineWithChildResult,t.onPull);if(this._closeLastSubstream!==void 0){const a=this._closeLastSubstream;return this._closeLastSubstream=void 0,Y(this._executeCloseLastSubstream(a),Qe(()=>this.replaceSubexecutor(o)))}this.replaceSubexecutor(o);return}const r=this._closeLastSubstream,i=this.finishSubexecutorWithCloseEffect(Y(n,Qie(o=>t.combineWithChildResult(t.lastDone,o))),()=>r,o=>t.upstreamExecutor.close(o));return i===void 0?void 0:q$(i)})}drainChildExecutors(t){if(t.activeChildExecutors.length===0){const o=this._closeLastSubstream;return o!==void 0&&this.addFinalizer(()=>on(o)),this.finishSubexecutorWithCloseEffect(t.upstreamDone,()=>o,a=>t.upstreamExecutor.close(a))}const n=t.activeChildExecutors[0],r=t.activeChildExecutors.slice(1);if(n===void 0){const[o,a]=this.applyUpstreamPullStrategy(!0,r,t.onPull(Cpe(r.reduce((c,u)=>u!==void 0?c+1:c,0))));return this.replaceSubexecutor(new Nf(t.upstreamExecutor,t.lastDone,a,t.upstreamDone,t.combineChildResults,t.combineWithChildResult,t.onPull)),Pe(o)?(this._emitted=o.value,R1()):void 0}const i=new Nf(t.upstreamExecutor,t.lastDone,r,t.upstreamDone,t.combineChildResults,t.combineWithChildResult,t.onPull);this.replaceSubexecutor(new kv(n.childExecutor,i,n.onEmit))}}const D1=e=>e!==void 0?e:he,P1=(e,t)=>Y(sn(e,n=>en(n(t))),Qe(n=>Y(Wie(n),On(()=>ks))),ze(n=>En(()=>n))),rA=(e,t,n)=>{const r=[e],i=()=>{const o=r.pop();if(o===void 0||o.upstream===void 0)return Js("Unexpected end of input for channel execution");const a=o.upstream.run();switch(a._tag){case zy:{const c=o.onEmit(o.upstream.getEmit());return r.length===0?c===void 0?En(t):Y(c,ko({onFailure:n,onSuccess:t})):c===void 0?En(()=>i()):Y(c,ko({onFailure:n,onSuccess:()=>i()}))}case Fy:{const c=o.onDone(o.upstream.getDone());return r.length===0?c===void 0?En(t):Y(c,ko({onFailure:n,onSuccess:t})):c===void 0?En(()=>i()):Y(c,ko({onFailure:n,onSuccess:()=>i()}))}case tp:return r.push(o),Y(o.onEffect(a.effect),zt(c=>En(()=>{const u=o.onDone(rs(c));return u===void 0?he:u})),ko({onFailure:n,onSuccess:()=>i()}));case By:return r.push(o),r.push(a),En(()=>i())}};return i()},iA=W(2,(e,t)=>{const n=(r,i,o)=>sH(Ze(()=>new _u(e,void 0,Mt)),a=>En(()=>SS(a.run(),a).pipe(uH(r),rt(Un(r)),BR(Un(i)))),(a,c)=>{const u=a.close(c);return u===void 0?he:$R(u,d=>uc(o,gr(d)))});return DR(r=>$c([D5(t,d0),br(),br()]).pipe(ze(([i,o,a])=>r(n(o,a,i)).pipe(no(t),ze(c=>t.addFinalizer(u=>{const d=GV(u)?gue(u.cause):void 0;return PT(o).pipe(ze(h=>h?hi(a,void 0).pipe(rt(vc(c)),rt(R$(c))):hi(a,void 0).pipe(rt(d&&kM(d)>0?z5(c,ene(d)):fi(c)),rt(R$(c)))))}).pipe(rt(r(Un(o)))))))))}),SS=(e,t)=>{const n=e;switch(n._tag){case tp:return Y(n.effect,ze(()=>SS(t.run(),t)));case zy:return SS(t.run(),t);case Fy:return En(()=>t.getDone());case By:return rA(n,()=>SS(t.run(),t),gr)}},Ipe="Done",Mpe="Await",Rpe="effect/ChannelMergeDecision",Ape=Symbol.for(Rpe),Ope={[Ape]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},H$=e=>{const t=Object.create(Ope);return t._tag=Mpe,t.f=e,t},YH="BothRunning",QH="LeftDone",XH="RightDone",Dpe="effect/ChannelMergeState",K$=Symbol.for(Dpe),oA={[K$]:K$},N1=(e,t)=>{const n=Object.create(oA);return n._tag=YH,n.left=e,n.right=t,n},W$=e=>{const t=Object.create(oA);return t._tag=QH,t.f=e,t},G$=e=>{const t=Object.create(oA);return t._tag=XH,t.f=e,t},JH="BackPressure",ZH="BufferSliding",Ppe="effect/ChannelMergeStrategy",Y$=Symbol.for(Ppe),eK={[Y$]:Y$},Npe=e=>{const t=Object.create(eK);return t._tag=JH,t},Lpe=e=>{const t=Object.create(eK);return t._tag=ZH,t},$pe=W(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case JH:return t();case ZH:return n()}}),If="Empty",Cm="Emit",Im="Error",Mm="Done",tK=e=>({_tag:If,notifyProducer:e}),L1=e=>({_tag:Cm,notifyConsumers:e}),jpe=e=>({_tag:Im,cause:e}),Fpe=e=>({_tag:Mm,done:e});class zpe{ref;constructor(t){this.ref=t}awaitRead(){return Cs(mr(this.ref,t=>t._tag===If?[Un(t.notifyProducer),t]:[he,t]))}get close(){return Sfe(t=>this.error(hue(t)))}done(t){return Cs(mr(this.ref,n=>{switch(n._tag){case If:return[Un(n.notifyProducer),n];case Cm:return[sn(n.notifyConsumers,r=>hi(r,ct(t)),{discard:!0}),Fpe(t)];case Im:return[mf,n];case Mm:return[mf,n]}}))}emit(t){return ze(br(),n=>Cs(mr(this.ref,r=>{switch(r._tag){case If:return[Un(r.notifyProducer),r];case Cm:{const i=r.notifyConsumers[0],o=r.notifyConsumers.slice(1);if(i!==void 0)return[hi(i,vt(t)),o.length===0?tK(n):L1(o)];throw new Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues")}case Im:return[mf,r];case Mm:return[mf,r]}})))}error(t){return Cs(mr(this.ref,n=>{switch(n._tag){case If:return[Un(n.notifyProducer),n];case Cm:return[sn(n.notifyConsumers,r=>WV(r,t),{discard:!0}),jpe(t)];case Im:return[mf,n];case Mm:return[mf,n]}}))}get take(){return this.takeWith(t=>rs(C5(t,ct)),t=>Zo(t),t=>Vm(vt(t)))}takeWith(t,n,r){return ze(br(),i=>Cs(mr(this.ref,o=>{switch(o._tag){case If:return[rt(hi(o.notifyProducer,void 0),w0(Un(i),{onFailure:t,onSuccess:$i({onLeft:r,onRight:n})})),L1([i])];case Cm:return[w0(Un(i),{onFailure:t,onSuccess:$i({onLeft:r,onRight:n})}),L1([...o.notifyConsumers,i])];case Im:return[on(t(o.cause)),o];case Mm:return[on(r(o.done)),o]}})))}}const sA=()=>Y(br(),ze(e=>Kn(tK(e))),Qe(e=>new zpe(e))),M0=W(2,(e,t)=>gpe(e,t,()=>{},()=>{})),aA=e=>{const t=fs({onInput:()=>t,onFailure:Fn,onDone:tA});return gi(e,t)},nK=W(2,(e,t)=>ype(e,()=>t)),Bpe=e=>Xt(e,Mt),xw=e=>Ar(e.takeWith(Fn,t=>Xt(Tn(t),()=>xw(e)),tA)),rK=()=>eA({onInput:e=>Xt(Tn(e),()=>rK()),onFailure:vw,onDone:sd}),iK=W(2,(e,t)=>Xt(e,n=>HH(()=>t(n)))),ww=W(2,(e,t)=>{const n=eA({onInput:r=>Xt(Tn(t(r)),()=>n),onFailure:vw,onDone:sd});return gi(e,n)}),Upe=W(3,(e,t,n)=>cA(r=>ae(function*(){const i=yield*sA(),o=xw(i),a=yield*XR(n);yield*uc(r,Ch(a));const c=yield*br(),u=n===Number.POSITIVE_INFINITY?p=>Mt:(yield*zR(n)).withPermits;yield*(yield*o.pipe(gi(e),Xf(r))).pipe(ko({onFailure:p=>sr(a,gr(p)),onSuccess:$i({onLeft:p=>rt(wo(u(n)(he)),fn(sr(a,on(ct(p))))),onRight:p=>ae(function*(){const y=yield*br(),g=yield*br();yield*sr(a,Qe(Un(y),vt)),yield*hi(g,void 0).pipe(rt(DR(v=>en(v(Un(c))).pipe(Cfe(en(v(t(p)))),ze(Mt))).pipe($R(v=>WV(c,v)),uH(y))),u(1),no(r)),yield*Un(g)})})}),jR,wo,no(r));const h=Ar(w0(Cs(Ag(a)),{onFailure:Fn,onSuccess:$i({onLeft:sd,onRight:p=>Xt(Tn(p),()=>h)})}));return ZR(h,i)}))),qpe=e=>t=>Vpe(e)(t,VS),Vpe=({bufferSize:e=16,concurrency:t,mergeStrategy:n=Npe()})=>(r,i)=>cA(o=>ae(function*(){const a=t==="unbounded"?Number.MAX_SAFE_INTEGER:t,c=yield*sA(),u=xw(c),d=yield*XR(e);yield*uc(o,Ch(d));const h=yield*Qf();yield*uc(o,Ch(h));const p=yield*Kn(Ae()),y=yield*br(),g=(yield*zR(a)).withPermits,v=yield*Xf(gi(u,r),o);function S(k){return k.pipe(ze($i({onLeft:_=>on(Oe(_)),onRight:_=>pi(sr(d,on(vt(_))),Ae())})),$$({until:_=>Pe(_)}),ze(_=>is(p,Xn({onNone:()=>Oe(_.value),onSome:E=>Oe(i(E,_.value))}))),zt(_=>kh(_)?gr(_):sr(d,gr(_)).pipe(rt(hi(y,void 0)),fn)))}yield*v.pipe(ko({onFailure:k=>sr(d,gr(k)).pipe(rt(on(!1))),onSuccess:$i({onLeft:k=>LR(wo(Un(y)),wo(g(a)(he)),{onSelfDone:(_,E)=>pi(fi(E),!1),onOtherDone:(_,E)=>rt(fi(E),Ui(p).pipe(ze(Xn({onNone:()=>sr(d,on(ct(k))),onSome:M=>sr(d,on(ct(i(M,k))))})),pi(!1)))}),onRight:k=>$pe(n,{onBackPressure:()=>ae(function*(){const _=yield*br(),E=dC(D=>Xf(gi(u,k),D).pipe(ze(T=>M1(en(S(T)),en(wo(Un(y))))),ze(Mt)));return yield*hi(_,void 0).pipe(rt(E),g(1),no(o)),yield*Un(_),!(yield*PT(y))}),onBufferSliding:()=>ae(function*(){const _=yield*br(),E=yield*br(),M=yield*Jhe(h);yield*Ag(h).pipe(ze(C=>hi(C,void 0)),Tfe(()=>M>=a)),yield*sr(h,_);const D=dC(C=>Xf(gi(u,k),C).pipe(ze(O=>en(S(O)).pipe(M1(en(wo(Un(y)))),M1(en(wo(Un(_)))))),ze(Mt)));return yield*hi(E,void 0).pipe(rt(D),g(1),no(o)),yield*Un(E),!(yield*PT(y))})})})}),$$({while:k=>k}),no(o));const x=Y(Ag(d),Cs,w0({onFailure:Fn,onSuccess:$i({onLeft:sd,onRight:k=>Xt(Tn(k),()=>x)})}),Ar);return ZR(x,c)})),oK=W(3,(e,t,n)=>qpe(n)(ww(e,t))),Hpe=W(2,(e,t)=>{function n(r){return ae(function*(){const i=yield*sA(),o=xw(i),a=yield*Xf(gi(o,e),r),c=yield*Xf(gi(o,t.other),r);function u(h,p,y){return(g,v,S)=>{function x(k){const _=k;return _._tag===Ipe?on(pr(rt(fi(p),_.effect))):Qe(vc(p),ji({onFailure:E=>pr(_.f(rs(E))),onSuccess:$i({onLeft:E=>pr(_.f(Zo(E))),onRight:E=>Uy(Tn(E),d(S(_.f)))})}))}return ji(h,{onFailure:k=>x(g(rs(k))),onSuccess:$i({onLeft:k=>x(g(Zo(k))),onRight:k=>on(Xt(Tn(k),()=>Xt(pr(no(wo(y),r)),_=>d(v(_,p)))))})})}}function d(h){switch(h._tag){case YH:{const p=wo(Pf(h.left)),y=wo(Pf(h.right));return Ar(LR(p,y,{onSelfDone:(g,v)=>rt(fi(v),u(g,h.right,a)(t.onSelfDone,N1,S=>W$(S))),onOtherDone:(g,v)=>rt(fi(v),u(g,h.left,c)(t.onOtherDone,(S,x)=>N1(x,S),S=>G$(S)))}))}case QH:return Ar(Qe(en(c),ji({onFailure:p=>pr(h.f(rs(p))),onSuccess:$i({onLeft:p=>pr(h.f(Zo(p))),onRight:p=>Xt(Tn(p),()=>d(W$(h.f)))})})));case XH:return Ar(Qe(en(a),ji({onFailure:p=>pr(h.f(rs(p))),onSuccess:$i({onLeft:p=>pr(h.f(Zo(p))),onRight:p=>Xt(Tn(p),()=>d(G$(h.f)))})})))}}return pr(L$(h=>{const p=L$(v=>(v.transferChildren(h.scope()),he)),y=wo(a).pipe(_o(p),no(r)),g=wo(c).pipe(_o(p),no(r));return mw(y,g,(v,S)=>N1(v,S))})).pipe(Xt(d),ZR(i))})}return cA(n)}),lA=W(2,(e,t)=>nA(()=>{let n;const r=eA({onInput:o=>Xt(Tn(o),()=>r),onFailure:o=>(n=Qpe(o),Fn(Tg(n))),onDone:sd}),i=fs({onInput:o=>Y(Tn(o),Xt(()=>i)),onFailure:o=>mue(o)&&Xpe(o.defect)&&ht(o.defect,n)?vw(o.defect.error):Fn(o),onDone:sd});return gi(gi(gi(e,r),t),i)})),Kpe=e=>dC(t=>iA(e,t)),Wpe=e=>Kpe(aA(e)),sK=e=>Ar(DR(t=>Qe(Wm(),n=>mpe($R(t(Jh(e,n)),r=>di(n,rs(r))),(r,i)=>di(n,i))))),aK=e=>Gpe(Qe(NR,t=>Xt(pr(e(t)),Tn))),Xf=W(2,(e,t)=>Th(Ze(()=>new _u(e,void 0,Mt)),Dfe()).pipe(li(([n,r])=>Wue(t,i=>{const o=n.close(i);return o!==void 0?Eh(o,r):he})),sc,Qe(([n])=>En(()=>mC(n.run(),n))))),mC=(e,t)=>{const n=e;switch(n._tag){case Fy:return ji(t.getDone(),{onFailure:gr,onSuccess:r=>on(ct(r))});case zy:return on(vt(t.getEmit()));case tp:return Y(n.effect,ze(()=>mC(t.run(),t)));case By:return rA(n,()=>mC(t.run(),t),r=>gr(r))}},Ar=e=>Bpe(pr(e)),Gpe=e=>VH(sK(e),(t,n)=>t,(t,n)=>t),cA=e=>VH(aK(e),(t,n)=>t,(t,n)=>t),kw=e=>lK(0,e.length,e),lK=(e,t,n)=>e===t?Vr:Y(Tn(Y(n,oa(e))),Xt(()=>lK(e+1,t,n))),Ype=W(e=>qH(e[1]),(e,t,n)=>n?.concurrent?Hpe(e,{other:t,onSelfDone:r=>H$(i=>En(()=>WL(r,i))),onOtherDone:r=>H$(i=>En(()=>WL(i,r)))}):Xt(e,r=>iK(t,i=>[r,i]))),Uy=W(e=>qH(e[1]),(e,t,n)=>n?.concurrent?iK(Ype(e,t,{concurrent:!0}),r=>r[1]):Xt(e,()=>t)),gC=Symbol.for("effect/Channel/ChannelException"),Qpe=e=>({_tag:"ChannelException",[gC]:gC,error:e}),Xpe=e=>st(e,gC),Jpe=Symbol.for("effect/Sink"),Zpe={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};class uA{channel;[Jpe]=Zpe;constructor(t){this.channel=t}pipe(){return He(this,arguments)}}const eme=new uA(aA(rK())),tme=e=>{const t=fs({onInput:n=>Y(pr(sn(n,r=>e(r),{discard:!0})),Xt(()=>t)),onFailure:Fn,onDone:()=>Vr});return new uA(t)},nme=e=>new uA(pr(e)),cK=e=>Td(e)?cK(nme(e)):e.channel,rme=iH,ime=ofe,ome=cC,uK="NotStarted",dK="Previous",fK="Current",sme={_tag:uK},ame=e=>({_tag:dK,fiber:e}),lme=e=>({_tag:fK,fiber:e}),cme=Symbol.for("effect/Stream/Handoff"),hK="Empty",pK="Full",mK=e=>({_tag:hK,notifyConsumer:e}),ume=(e,t)=>({_tag:pK,value:e,notifyProducer:t}),gK=(e,t)=>n=>{switch(n._tag){case hK:return e(n.notifyConsumer);case pK:return t(n.value,n.notifyProducer)}},dme={_A:e=>e},fme=()=>Y(br(),ze(e=>Kn(mK(e))),Qe(e=>({[cme]:dme,ref:e}))),xS=W(2,(e,t)=>ze(br(),n=>Cs(mr(e.ref,r=>Y(r,gK(i=>[rt(hi(i,void 0),Un(n)),ume(t,n)],(i,o)=>[ze(Un(o),()=>Y(e,xS(t))),r])))))),yC=e=>ze(br(),t=>Cs(mr(e.ref,n=>Y(n,gK(r=>[ze(Un(r),()=>yC(e)),n],(r,i)=>[pi(hi(i,void 0),r),mK(t)]))))),wS="Emit",kS="Halt",_S="End",hme=e=>({_tag:wS,elements:e}),pme=e=>({_tag:kS,cause:e}),mme=e=>({_tag:_S,reason:e}),gme="effect/Take",yme=Symbol.for(gme),bme={_A:e=>e,_E:e=>e};class _w{exit;[yme]=bme;constructor(t){this.exit=t}pipe(){return He(this,arguments)}}const Q$=e=>new _w(Zo(e)),X$=new _w(Vm(Ae())),vme=e=>new _w(rs(Y(e,C5(Oe)))),Sme=e=>new _w(Zo(In(e))),xme=()=>Qa(Ae()),wme=e=>PR(gr(e),Oe),kme="UpstreamEnd",_me={_tag:kme},Eme="effect/Stream",yK=Symbol.for(Eme),Tme={_R:e=>e,_E:e=>e,_A:e=>e};class cr{channel;[yK]=Tme;constructor(t){this.channel=t}pipe(){return He(this,arguments)}}const bK=e=>st(e,yK)||Td(e),dA=4096,Cme=e=>Y(e,Ime((t,n)=>ht(n)(t))),Ime=W(2,(e,t)=>{const n=r=>fs({onInput:i=>{const[o,a]=kq(i,[r,an()],([c,u],d)=>Pe(c)&&t(c.value,d)?[Oe(d),u]:[Oe(d),Y(u,lh(d))]);return Xt(Tn(a),()=>n(o))},onFailure:Fn,onDone:()=>Vr});return new cr(Y(Qn(e),gi(n(Ae()))))}),vK=W(2,(e,t)=>new cr(Y(Qn(e),Uy(Qn(t))))),Mme=W(2,(e,t)=>Cd(e,()=>t)),Rme=W(2,(e,t)=>OK(n=>ae(function*(){const r=yield*fme();function i(c){return JM(t).pipe(pi(c),no(n),Qe(u=>a(ame(u))))}const o=fs({onInput:c=>Xn(jee(c),{onNone:()=>o,onSome:u=>pr(xS(r,hme(In(u)))).pipe(Xt(()=>o))}),onFailure:c=>pr(xS(r,pme(c))),onDone:()=>pr(xS(r,mme(_me)))});function a(c){switch(c._tag){case uK:return Ar(yC(r).pipe(Qe(u=>{switch(u._tag){case wS:return Ar(i(u.elements));case kS:return Fn(u.cause);case _S:return Vr}})));case dK:return Ar(yC(r).pipe(no(n),ze(u=>LR(Pf(c.fiber),Pf(u),{onSelfDone:(d,h)=>ji(d,{onFailure:p=>fi(h).pipe(pi(Fn(p))),onSuccess:p=>fi(h).pipe(rt(on(Tn(p).pipe(Xt(()=>a(lme(u)))))))}),onOtherDone:(d,h)=>ji(d,{onFailure:p=>fi(h).pipe(pi(Fn(p))),onSuccess:p=>{switch(p._tag){case wS:return fi(h).pipe(rt(i(p.elements)));case kS:return fi(h).pipe(pi(Fn(p.cause)));case _S:return Pf(h).pipe(Qe(y=>Tn(y).pipe(Uy(Vr))))}}})}))));case fK:return Ar(Pf(c.fiber).pipe(Qe(u=>{switch(u._tag){case wS:return Ar(i(u.elements));case kS:return Fn(u.cause);case _S:return Vr}})))}}return IK(c=>gi(Qn(e),o).pipe(iA(c),no(c))).pipe(Mme(new cr(a(sme))))}))),bC=W(2,(e,t)=>new cr(Y(Qn(e),nK(t)))),Ame=W(2,(e,t)=>EK(e,dy(t))),Ome=W(2,(e,t)=>EK(e,xq(t))),Cd=W(e=>bK(e[0]),(e,t,n)=>{const r=n?.bufferSize??16;return n?.switch?vC(n?.concurrency,()=>J$(e,1,r,t),i=>J$(e,i,r,t)):vC(n?.concurrency,()=>new cr(M0(Qn(e),i=>Y(i,wq(o=>Qn(t(o))),kq(Vr,(o,a)=>Y(o,Uy(a)))))),i=>new cr(Y(Qn(e),M0(kw),oK(o=>Qn(t(o)),n))))}),vC=(e,t,n)=>{switch(e){case void 0:return t();case"unbounded":return n(Number.MAX_SAFE_INTEGER);default:return e>1?n(e):t()}},J$=W(4,(e,t,n,r)=>new cr(Y(Qn(e),M0(kw),oK(i=>Qn(r(i)),{concurrency:t,mergeStrategy:Lpe(),bufferSize:n})))),Ew=W(e=>bK(e[0]),(e,t)=>Cd(e,Mt,t)),Dme=e=>{const t=fs({onInput:n=>Xt(kw(n),()=>t),onFailure:Fn,onDone:()=>Vr});return new cr(Y(Qn(e),gi(t)))},Pme=e=>{const t=(r,i)=>{const[o,a]=Y(r,zee(u=>!bg(u))),c=Y(Ix(a),Xn({onNone:()=>i,onSome:ji({onFailure:u=>Xn(yue(u),{onNone:()=>Vr,onSome:Fn}),onSuccess:()=>Vr})}));return Y(Tn(Y(o,xq(u=>bg(u)?Oe(u.value):Ae()))),Xt(()=>c))},n=fs({onInput:r=>t(r,n),onFailure:r=>Fn(r),onDone:()=>Vr});return new cr(Y(Qn(e),gi(n)))},SK=e=>Dme(Pme(Y(e,_K(t=>t.exit)))),Qn=e=>{if("channel"in e)return e.channel;if(Td(e))return Qn(qy(e));throw new TypeError("Expected a Stream.")},xK=e=>new cr(jh(e)?Vr:Tn(e)),qy=e=>Y(e,PR(Oe),Nme),Nme=e=>new cr(Ar(Mfe(e,{onFailure:Xn({onNone:()=>Vr,onSome:vw}),onSuccess:t=>Tn(In(t))}))),wK=(e,t)=>{const n=t?.maxChunkSize??dA;if(t?.scoped){const i=Qe(F$(e),o=>Og(o,{maxChunkSize:n,shutdown:!0}));return t.shutdown?Qe(i,bC(j$(e))):i}const r=Cd(CK(F$(e)),i=>Og(i,{maxChunkSize:n}));return t?.shutdown?bC(r,j$(e)):r},kK=e=>MK(()=>fM(e)?xK(e):Lme(e[Symbol.iterator]())),Lme=(e,t=dA)=>Y(Ze(()=>{let n=[];const r=i=>Y(Ze(()=>{let o=i.next();if(t===1)return o.done?Vr:Y(Tn(In(o.value)),Xt(()=>r(i)));n=[];let a=0;for(;o.done===!1&&(n.push(o.value),a=a+1,!(a>=t));)o=i.next();return a>0?Y(Tn(Ns(n)),Xt(()=>r(i))):Vr}),Ar);return new cr(r(e))}),Zme),Og=(e,t)=>Y(epe(e,1,t?.maxChunkSize??dA),zt(n=>Y(Zhe(e),ze(r=>r&&kh(n)?xme():wme(n)))),zme,t?.shutdown?bC(Ch(e)):Mt),$me=(...e)=>kK(e),_K=W(2,(e,t)=>new cr(Y(Qn(e),ww(wq(t))))),EK=W(2,(e,t)=>new cr(Y(Qn(e),ww(t)))),SC=W(2,(e,t)=>{const n=r=>{const i=r.next();if(i.done)return fs({onInput:o=>n(o[Symbol.iterator]()),onFailure:Fn,onDone:tA});{const o=i.value;return Ar(Qe(t(o),a=>Xt(Tn(In(a)),()=>n(r))))}};return new cr(Y(Qn(e),gi(nA(()=>n(an()[Symbol.iterator]())))))}),jme=W(3,(e,t,n)=>new cr(Y(Qn(e),M0(kw),Upe(n,t),ww(In)))),Fme=W(e=>Symbol.iterator in e[0],(e,t)=>Ew(kK(e),t)),zme=e=>RK(e,t=>Y(Qe(t,n=>Oe([n,t])),Rg(Xn({onNone:()=>on(Ae()),onSome:Qa})))),Bme=(e,t)=>Ume(on(e),t),Ume=(e,t)=>Cd(qy(Th(e,rme(t))),([n,r])=>{const i=Efe(ome,Ui(r.iterationMeta));return vK(Hme(n),Jme(n,o=>Rfe(r.next(o),{onFailure:on,onSuccess:()=>Qe(i(e),a=>Oe([a,a]))})))}),TK=W(2,(e,t)=>Qn(e).pipe(lA(cK(t)),Wpe)),qme=e=>TK(e,eme),Vme=W(2,(e,t)=>TK(e,tme(t))),CK=e=>new cr(nK(sK(Y(e,Qe(In))),he)),IK=e=>new cr(aK(t=>e(t).pipe(Qe(In)))),Hme=e=>xK(In(e)),MK=e=>new cr(nA(()=>Qn(e()))),Kme=W(2,(e,t)=>SC(e,n=>pi(t(n),n))),Wme=W(2,(e,t)=>Gme(e,{...t,cost:n=>on(t.cost(n))})),Gme=W(2,(e,t)=>t.strategy==="enforce"?Yme(e,t.cost,t.units,t.duration,t.burst??0):Qme(e,t.cost,t.units,t.duration,t.burst??0)),Yme=(e,t,n,r,i)=>{const o=(c,u)=>fs({onInput:d=>Y(t(d),Th(Sg),Qe(([h,p])=>{const g=(p-u)/Yu(r),v=c+g*n,S=n+i<0?Number.POSITIVE_INFINITY:n+i,x=v<0?S:Math.min(v,S);return h<=x?Y(Tn(d),Xt(()=>o(x-h,p))):o(c,u)}),Ar),onFailure:Fn,onDone:()=>Vr}),a=Y(Sg,Qe(c=>o(n,c)),Ar);return new cr(Y(Qn(e),lA(a)))},Qme=(e,t,n,r,i)=>{const o=(c,u)=>fs({onInput:d=>Y(t(d),Th(Sg),Qe(([h,p])=>{const g=(p-u)/Yu(r),v=c+g*n,S=n+i<0?Number.POSITIVE_INFINITY:n+i,k=(v<0?S:Math.min(v,S))-h,_=k>=0?0:-k/n,E=dl(Math.max(0,_*Yu(r)));return ote(E,Gu)?Y(pr(JM(E)),Uy(Tn(d)),Xt(()=>o(k,p))):Xt(Tn(d),()=>o(k,p))}),Ar),onFailure:Fn,onDone:()=>Vr}),a=Y(Sg,Qe(c=>o(n,c)),Ar);return new cr(Y(Qn(e),lA(a)))},Xme=e=>Bme(void 0,ime(e)),RK=(e,t)=>MK(()=>{const n=r=>Ar(Qe(t(r),Xn({onNone:()=>Vr,onSome:([i,o])=>Xt(Tn(i),()=>n(o))})));return new cr(n(e))}),Jme=(e,t)=>RK(e,n=>Y(t(n),Qe(Ru(([r,i])=>[In(r),i])))),Zme=e=>Ew(qy(e)),AK=e=>Ew(CK(e)),OK=e=>Ew(IK(t=>e(t))),DK=Soe,ege="effect/Config",tge=Symbol.for(ege),nge={_A:e=>e},np={...gd,[tge]:nge,commit(){return rse(this)}},rge=e=>{const t=lge("a number property",n=>{const r=Number(n);return Number.isNaN(r)?ct(e4([],`Expected a number value but received ${Rc(n)}`)):vt(r)});return e===void 0?t:sge(t,e)},ige=W(2,(e,t)=>oge(e,n=>vt(t(n)))),oge=W(2,(e,t)=>{const n=Object.create(np);return n._tag=i4,n.original=e,n.mapOrFail=t,n}),sge=W(2,(e,t)=>{const n=Object.create(np);return n._tag=o4,n.name=t,n.config=e,n}),PK=W(2,(e,t)=>{const n=Object.create(np);return n._tag=n4,n.first=e,n.second=cge(t.orElse),n.condition=t.if,n}),age=e=>Y(e,ige(Oe),PK({orElse:()=>NK(Ae()),if:DK})),lge=(e,t)=>{const n=Object.create(np);return n._tag=s4,n.description=e,n.parse=t,n},NK=e=>{const t=Object.create(np);return t._tag=t4,t.value=e,t.parse=()=>vt(e),t},cge=e=>{const t=Object.create(np);return t._tag=r4,t.config=e,t},uge=W(2,(e,t)=>PK(e,{orElse:()=>NK(t),if:DK})),_v=rge,dge=age,$1=uge,fge="effect/GroupBy",LK=Symbol.for(fge),hge={_R:e=>e,_E:e=>e,_K:e=>e,_V:e=>e},pge=e=>st(e,LK),mge=W(e=>pge(e[0]),(e,t,n)=>Cd(e.grouped,([r,i])=>t(r,SK(Og(i,{shutdown:!0}))),{concurrency:"unbounded",bufferSize:n?.bufferSize??16})),gge=e=>({[LK]:hge,pipe(){return He(this,arguments)},grouped:e}),yge=W(e=>typeof e[0]!="function",(e,t,n)=>n?.key?mge(bge(e,n.key,{bufferSize:n.bufferSize}),(r,i)=>SC(i,t)):vC(n?.concurrency,()=>SC(e,t),r=>n?.unordered?Cd(e,i=>qy(t(i)),{concurrency:r}):jme(e,r,t))),bge=W(e=>typeof e[0]!="function",(e,t,n)=>{const r=(i,o)=>fs({onInput:a=>Xt(pr(sn(vge(a,t),([c,u])=>{const d=i.get(c);return d===void 0?Y(XR(n?.bufferSize??16),ze(h=>Y(Ze(()=>{i.set(c,h)}),rt(sr(o,Sme([c,h]))),rt(Y(sr(h,Q$(u)),I1(p=>Km(p)?Oe(he):Ae())))))):I1(sr(d,Q$(u)),h=>Km(h)?Oe(he):Ae())},{discard:!0})),()=>r(i,o)),onFailure:a=>pr(sr(o,vme(a))),onDone:()=>pr(Y(sn(i.entries(),([a,c])=>Y(sr(c,X$),I1(u=>Km(u)?Oe(he):Ae())),{discard:!0}),rt(sr(o,X$))))});return gge(OK(i=>ae(function*(){const o=new Map,a=yield*Qf();return yield*uc(i,Ch(a)),yield*Qn(e).pipe(gi(r(o,a)),aA,iA(i),no(i),pi(SK(Og(a,{shutdown:!0}))))})))}),vge=W(2,(e,t)=>{const n=[],r=e[Symbol.iterator](),i=new Map;let o;for(;(o=r.next())&&!o.done;){const a=o.value,c=t(a);if(i.has(c))i.get(c).push(a);else{const u=[a];n.push([c,u]),i.set(c,u)}}return Ns(n.map(a=>[a[0],Ns(a[1])]))});class oi{path;actual;issue;_tag="Pointer";constructor(t,n,r){this.path=t,this.actual=n,this.issue=r}}class Z${actual;message;_tag="Unexpected";constructor(t,n){this.actual=t,this.message=n}}class hm{ast;message;_tag="Missing";actual=void 0;constructor(t,n){this.ast=t,this.message=n}}class fr{ast;actual;issues;output;_tag="Composite";constructor(t,n,r,i){this.ast=t,this.actual=n,this.issues=r,this.output=i}}class j1{ast;actual;kind;issue;_tag="Refinement";constructor(t,n,r,i){this.ast=t,this.actual=n,this.kind=r,this.issue=i}}class F1{ast;actual;kind;issue;_tag="Transformation";constructor(t,n,r,i){this.ast=t,this.actual=n,this.kind=r,this.issue=i}}class Ja{ast;actual;message;_tag="Type";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}class ej{ast;actual;message;_tag="Forbidden";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}const tj=Symbol.for("effect/Schema/ParseErrorTypeId");class Sge extends zde("ParseError"){[tj]=tj;get message(){return this.toString()}toString(){return TS.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[Dn](){return this.toJSON()}}const xge=e=>new Sge({issue:e}),Zi=CJ,$u=W(2,(e,t)=>Zi(e)?$i(e,{onLeft:ct,onRight:t}):ze(e,t)),Qs=W(2,(e,t)=>Zi(e)?MJ(e,t):Qe(e,t)),z1=W(2,(e,t)=>Zi(e)?IJ(e,t):PR(e,t)),$K=W(2,(e,t)=>Zi(e)?$i(e,{onLeft:t,onRight:vt}):Rg(e,t)),fA=(e,t)=>t===void 0||Uu(t)?e:e===void 0?t:{...e,...t},wge=(e,t,n)=>{const r=yo(e);return(i,o)=>r(i,fA(n,o))},jK=(e,t,n)=>{const r=wge(e,t,n);return(i,o)=>SU(r(i,o),xge)},kge=(e,t)=>jK(e.ast,!0,t),FK=(e,t)=>jK(Ai(e.ast),!0,t),hA=(e,t)=>{const n=yo(Ai(e.ast));return(r,i)=>ta(n(r,{exact:!0,...fA(t,i)}))},_ge=Wt(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),yo=(e,t)=>{const n=_ge,r=n.get(e);if(r)return r;const i=Ege(e),o=CZ(e),a=Pe(o)?(d,h)=>i(d,fA(h,o.value)):i,c=IZ(e),u=Pe(c)?(d,h)=>ES($K(a(d,h),c.value),e,d,h):a;return n.set(e,u),u},B1=e=>Pi(_Z(e)),U1=e=>Pi(EZ(e)),Ege=(e,t)=>{switch(e._tag){case"Refinement":{const n=yo(e.from);return(r,i)=>{i=i??m1;const o=i?.errors==="all",a=$u($K(n(r,i),c=>{const u=new j1(e,r,"From",c);return o&&RZ(e)&&UK(c)?Xn(e.filter(r,i,e),{onNone:()=>ct(u),onSome:d=>ct(new fr(e,r,[u,new j1(e,r,"Predicate",d)]))}):ct(u)}),c=>Xn(e.filter(c,i,e),{onNone:()=>vt(c),onSome:u=>ct(new j1(e,r,"Predicate",u))}));return ES(a,e,r,i)}}case"Transformation":{const n=Ige(e.transformation),r=yo(e.from),i=yo(e.to);return(o,a)=>ES($u(z1(r(o,a),c=>new F1(e,o,"Encoded",c)),c=>$u(z1(n(c,a??m1,e,o),u=>new F1(e,o,"Transformation",u)),u=>z1(i(u,a),d=>new F1(e,o,"Type",d)))),e,o,a)}case"Declaration":{const n=e.decodeUnknown(...e.typeParameters);return(r,i)=>ES(n(r,i??m1,e),e,r,i)}case"Literal":return mo(e,n=>n===e.literal);case"UniqueSymbol":return mo(e,n=>n===e.symbol);case"UndefinedKeyword":return mo(e,UX);case"NeverKeyword":return mo(e,qX);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return vt;case"StringKeyword":return mo(e,Ps);case"NumberKeyword":return mo(e,Uu);case"BooleanKeyword":return mo(e,gx);case"BigIntKeyword":return mo(e,yx);case"SymbolKeyword":return mo(e,aT);case"ObjectKeyword":return mo(e,xl);case"Enums":return mo(e,n=>e.enums.some(([r,i])=>i===n));case"TemplateLiteral":{const n=lee(e);return mo(e,r=>Ps(r)&&n.test(r))}case"TupleType":{const n=e.elements.map(d=>yo(d.type)),r=e.rest.map(d=>yo(d.type));let i=e.elements.filter(d=>!d.isOptional);e.rest.length>0&&(i=i.concat(e.rest.slice(1)));const o=i.length,a=e.elements.length>0?e.elements.map((d,h)=>h).join(" | "):"never",c=B1(e),u=U1(e);return(d,h)=>{if(!VJ(d))return ct(new Ja(e,d));const p=h?.errors==="all",y=[];let g=0;const v=[],S=d.length;for(let E=S;E<=o-1;E++){const M=new oi(E,d,new hm(i[E-S]));if(p){y.push([g++,M]);continue}else return ct(new fr(e,d,M,v))}if(e.rest.length===0)for(let E=e.elements.length;E<=S-1;E++){const M=new oi(E,d,new Z$(d[E],`is unexpected, expected: ${a}`));if(p){y.push([g++,M]);continue}else return ct(new fr(e,d,M,v))}let x=0,k;for(;x<n.length;x++)if(S<x+1){if(e.elements[x].isOptional)continue}else{const E=n[x],M=E(d[x],h);if(Zi(M)){if(si(M)){const D=new oi(x,d,M.left);if(p){y.push([g++,D]);continue}else return ct(new fr(e,d,D,gs(v)))}v.push([g++,M.right])}else{const D=g++,T=x;k||(k=[]),k.push(({es:C,output:O})=>ze(vo(M),q=>{if(si(q)){const I=new oi(T,d,q.left);return p?(C.push([D,I]),he):ct(new fr(e,d,I,gs(O)))}return O.push([D,q.right]),he}))}}if(Sr(r)){const[E,...M]=r;for(;x<S-M.length;x++){const D=E(d[x],h);if(Zi(D))if(si(D)){const T=new oi(x,d,D.left);if(p){y.push([g++,T]);continue}else return ct(new fr(e,d,T,gs(v)))}else v.push([g++,D.right]);else{const T=g++,C=x;k||(k=[]),k.push(({es:O,output:q})=>ze(vo(D),I=>{if(si(I)){const L=new oi(C,d,I.left);return p?(O.push([T,L]),he):ct(new fr(e,d,L,gs(q)))}else return q.push([T,I.right]),he}))}}for(let D=0;D<M.length;D++)if(x+=D,!(S<x+1)){const T=M[D](d[x],h);if(Zi(T)){if(si(T)){const C=new oi(x,d,T.left);if(p){y.push([g++,C]);continue}else return ct(new fr(e,d,C,gs(v)))}v.push([g++,T.right])}else{const C=g++,O=x;k||(k=[]),k.push(({es:q,output:I})=>ze(vo(T),L=>{if(si(L)){const P=new oi(O,d,L.left);return p?(q.push([C,P]),he):ct(new fr(e,d,P,gs(I)))}return I.push([C,L.right]),he}))}}}const _=({es:E,output:M})=>dS(E)?ct(new fr(e,d,gs(E),gs(M))):vt(gs(M));if(k&&k.length>0){const E=k;return En(()=>{const M={es:Tm(y),output:Tm(v)};return ze(sn(E,D=>D(M),{concurrency:c,batching:u,discard:!0}),()=>_(M))})}return _({output:v,es:y})}}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return mo(e,VX);const n=[],r={},i=[];for(const h of e.propertySignatures)n.push([yo(h.type),h]),r[h.name]=null,i.push(h.name);const o=e.indexSignatures.map(h=>[yo(h.parameter),yo(h.type),h.parameter]),a=Xs.make(e.indexSignatures.map(h=>h.parameter).concat(i.map(h=>aT(h)?new PZ(h):new JS(h)))),c=yo(a),u=B1(e),d=U1(e);return(h,p)=>{if(!KX(h))return ct(new Ja(e,h));const y=p?.errors==="all",g=[];let v=0;const S=p?.onExcessProperty==="error",x=p?.onExcessProperty==="preserve",k={};let _;if(S||x){_=Reflect.ownKeys(h);for(const T of _){const C=c(T,p);if(Zi(C)&&si(C))if(S){const O=new oi(T,h,new Z$(h[T],`is unexpected, expected: ${String(a)}`));if(y){g.push([v++,O]);continue}else return ct(new fr(e,h,O,k))}else k[T]=h[T]}}let E;const M=p?.exact===!0;for(let T=0;T<n.length;T++){const C=n[T][1],O=C.name,q=Object.prototype.hasOwnProperty.call(h,O);if(!q){if(C.isOptional)continue;if(M){const P=new oi(O,h,new hm(C));if(y){g.push([v++,P]);continue}else return ct(new fr(e,h,P,k))}}const I=n[T][0],L=I(h[O],p);if(Zi(L)){if(si(L)){const P=new oi(O,h,q?L.left:new hm(C));if(y){g.push([v++,P]);continue}else return ct(new fr(e,h,P,k))}k[O]=L.right}else{const P=v++,B=O;E||(E=[]),E.push(({es:$,output:V})=>ze(vo(L),j=>{if(si(j)){const K=new oi(B,h,q?j.left:new hm(C));return y?($.push([P,K]),he):ct(new fr(e,h,K,V))}return V[B]=j.right,he}))}}for(let T=0;T<o.length;T++){const C=o[T],O=C[0],q=C[1],I=DU(h,C[2]);for(const L of I){const P=O(L,p);if(Zi(P)&&ta(P)){const B=q(h[L],p);if(Zi(B))if(si(B)){const $=new oi(L,h,B.left);if(y){g.push([v++,$]);continue}else return ct(new fr(e,h,$,k))}else Object.prototype.hasOwnProperty.call(r,L)||(k[L]=B.right);else{const $=v++,V=L;E||(E=[]),E.push(({es:j,output:K})=>ze(vo(B),G=>{if(si(G)){const J=new oi(V,h,G.left);return y?(j.push([$,J]),he):ct(new fr(e,h,J,K))}else return Object.prototype.hasOwnProperty.call(r,L)||(K[L]=G.right),he}))}}}}const D=({es:T,output:C})=>{if(dS(T))return ct(new fr(e,h,gs(T),C));if(p?.propertyOrder==="original"){const O=_||Reflect.ownKeys(h);for(const I of i)O.indexOf(I)===-1&&O.push(I);const q={};for(const I of O)Object.prototype.hasOwnProperty.call(C,I)&&(q[I]=C[I]);return vt(q)}return vt(C)};if(E&&E.length>0){const T=E;return En(()=>{const C={es:Tm(g),output:Object.assign({},k)};return ze(sn(T,O=>O(C),{concurrency:u,batching:d,discard:!0}),()=>D(C))})}return D({es:g,output:k})}}case"Union":{const n=Tge(e.types),r=Reflect.ownKeys(n.keys),i=r.length,o=e.types.length,a=new Map;for(let d=0;d<o;d++)a.set(e.types[d],yo(e.types[d]));const c=B1(e)??1,u=U1(e);return(d,h)=>{const p=[];let y=0,g=[];if(i>0)if(UI(d))for(let x=0;x<i;x++){const k=r[x],_=n.keys[k].buckets;if(Object.prototype.hasOwnProperty.call(d,k)){const E=String(d[k]);if(Object.prototype.hasOwnProperty.call(_,E))g=g.concat(_[E]);else{const{candidates:M,literals:D}=n.keys[k],T=Xs.make(D),C=M.length===o?new Ou([new Si(k,T,!1,!0)],[]):Xs.make(M);p.push([y++,new fr(C,d,new oi(k,d,new Ja(T,d[k])))])}}else{const{candidates:E,literals:M}=n.keys[k],D=new Si(k,Xs.make(M),!1,!0),T=E.length===o?new Ou([D],[]):Xs.make(E);p.push([y++,new fr(T,d,new oi(k,d,new hm(D)))])}}else{const x=n.candidates.length===o?e:Xs.make(n.candidates);p.push([y++,new Ja(x,d)])}n.otherwise.length>0&&(g=g.concat(n.otherwise));let v;for(let x=0;x<g.length;x++){const k=g[x],_=a.get(k)(d,h);if(Zi(_)&&(!v||v.length===0)){if(ta(_))return _;p.push([y++,_.left])}else{const E=y++;v||(v=[]),v.push(M=>En(()=>"finalResult"in M?he:ze(vo(_),D=>(ta(D)?M.finalResult=D:M.es.push([E,D.left]),he))))}}const S=x=>dS(x)?x.length===1&&x[0][1]._tag==="Type"?ct(x[0][1]):ct(new fr(e,d,gs(x))):ct(new Ja(e,d));if(v&&v.length>0){const x=v;return En(()=>{const k={es:Tm(p)};return ze(sn(x,_=>_(k),{concurrency:c,batching:u,discard:!0}),()=>"finalResult"in k?k.finalResult:S(k.es))})}return S(p)}}case"Suspend":{const n=PU(()=>yo(e.f()));return(r,i)=>n()(r,i)}}},mo=(e,t)=>n=>t(n)?vt(n):ct(new Ja(e,n)),Rm=(e,t)=>{switch(e._tag){case"Declaration":{const n=JU(e);if(Pe(n))return Rm(n.value);break}case"TypeLiteral":{const n=[];for(let r=0;r<e.propertySignatures.length;r++){const i=e.propertySignatures[r],o=kL(i.type);SL(o)&&!i.isOptional&&n.push([i.name,o])}return n}case"TupleType":{const n=[];for(let r=0;r<e.elements.length;r++){const i=e.elements[r],o=kL(i.type);SL(o)&&!i.isOptional&&n.push([r,o])}return n}case"Refinement":return Rm(e.from);case"Suspend":return Rm(e.f());case"Transformation":return Rm(e.from)}return[]},Tge=(e,t)=>{const n={},r=[],i=[];for(let o=0;o<e.length;o++){const a=e[o],c=Rm(a);if(c.length>0){i.push(a);for(let u=0;u<c.length;u++){const[d,h]=c[u],p=String(h.literal);n[d]=n[d]||{buckets:{},literals:[],candidates:[]};const y=n[d].buckets;if(Object.prototype.hasOwnProperty.call(y,p)){if(u<c.length-1)continue;y[p].push(a),n[d].literals.push(h),n[d].candidates.push(a)}else{y[p]=[a],n[d].literals.push(h),n[d].candidates.push(a);break}}}else r.push(a)}return{keys:n,otherwise:r,candidates:i}},ES=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||Zi(e))return e;const i=new q4,o=Pfe(e,{scheduler:i});i.flush();const a=o.unsafePoll();if(a){if(bg(a))return vt(a.value);const c=a.cause;return pue(c)?ct(c.error):ct(new ej(t,n,Lc(c)))}return ct(new ej(t,n,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},Cge=([e],[t])=>e>t?1:e<t?-1:0;function gs(e){return e.sort(Cge).map(t=>t[1])}const Ige=(e,t)=>{switch(e._tag){case"FinalTransformation":return e.decode;case"ComposeTransformation":return vt;case"TypeLiteralTransformation":return n=>{let r=vt(n);for(const i of e.propertySignatureTransformations){const[o,a]=[i.from,i.to],c=i.decode;r=Qs(r,d=>{const h=c(Object.prototype.hasOwnProperty.call(d,o)?Oe(d[o]):Ae());return delete d[o],Pe(h)&&(d[a]=h.value),d})}return r}}},Ri=(e,t=[])=>({value:e,forest:t}),TS={formatIssue:e=>Qs(Mf(e),Mge),formatIssueSync:e=>{const t=TS.formatIssue(e);return Zi(t)?AJ(t):k0(t)},formatError:e=>TS.formatIssue(e.issue),formatErrorSync:e=>TS.formatIssueSync(e.issue)},Mge=e=>e.value+zK(`
33
+ `,e.forest),zK=(e,t)=>{let n="";const r=t.length;let i;for(let o=0;o<r;o++){i=t[o];const a=o===r-1;n+=e+(a?"└":"├")+"─ "+i.value,n+=zK(e+(r>1&&!a?"│ ":" "),i.forest)}return n},Rge=e=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},Age=e=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},BK=e=>"ast"in e?Oe(e.ast):Ae(),xC=vt(void 0),Oge=e=>BK(e).pipe(xx(wZ),Xn({onNone:()=>xC,onSome:t=>{const n=t(e);return Ps(n)?vt({message:n,override:!1}):Td(n)?Qe(n,r=>({message:r,override:!1})):Ps(n.message)?vt({message:n.message,override:n.override}):Qe(n.message,r=>({message:r,override:n.override}))}})),pA=e=>t=>t._tag===e,UK=pA("Composite"),nj=pA("Refinement"),rj=pA("Transformation"),Gm=e=>$u(Oge(e),t=>t!==void 0?!t.override&&(UK(e)||nj(e)&&e.kind==="From"||rj(e)&&e.kind!=="Transformation")?rj(e)||nj(e)?Gm(e.issue):xC:vt(t.message):xC),qK=e=>BK(e).pipe(xx(TZ),NJ(t=>t(e)),Pi);function Dge(e){return XU(e).pipe(lc(()=>YU(e)),lc(()=>QU(e)),lc(()=>kx(e)),On(()=>`{ ${e.from} | filter }`))}function Pge(e){return e.message!==void 0?e.message:`Expected ${Hu(e.ast)?Dge(e.ast):String(e.ast)}, actual ${Rc(e.actual)}`}const Nge=e=>Qs(Gm(e),t=>t??qK(e)??Pge(e)),Ev=e=>qK(e)??String(e.ast),Lge=e=>e.message??"is forbidden",$ge=e=>e.message??"is unexpected",jge=e=>{const t=kZ(e.ast);if(Pe(t)){const n=t.value();return Ps(n)?vt(n):n}return vt(e.message??"is missing")},Mf=e=>{switch(e._tag){case"Type":return Qs(Nge(e),Ri);case"Forbidden":return vt(Ri(Ev(e),[Ri(Lge(e))]));case"Unexpected":return vt(Ri($ge(e)));case"Missing":return Qs(jge(e),Ri);case"Transformation":return $u(Gm(e),t=>t!==void 0?vt(Ri(t)):Qs(Mf(e.issue),n=>Ri(Ev(e),[Ri(Rge(e.kind),[n])])));case"Refinement":return $u(Gm(e),t=>t!==void 0?vt(Ri(t)):Qs(Mf(e.issue),n=>Ri(Ev(e),[Ri(Age(e.kind),[n])])));case"Pointer":return Qs(Mf(e.issue),t=>Ri(aZ(e.path),[t]));case"Composite":return $u(Gm(e),t=>{if(t!==void 0)return vt(Ri(t));const n=Ev(e);return NU(e.issues)?Qs(sn(e.issues,Mf),r=>Ri(n,r)):Qs(Mf(e.issues),r=>Ri(n,[r]))})}},Fge=$fe,zge=p5,Bge=mle;function yf(e,t){return Se(e.runtimeEffect,n=>Nt(r=>(r.setFiberRefs(n.fiberRefs),r.currentRuntimeFlags=n.runtimeFlags,Wh(t,n.context))))}const Uge={...wse,[rC]:rC,pipe(){return He(this,arguments)},commit(){return this.runtimeEffect}},qge=(e,t)=>{t=t??G5();const n=aC(Qh());let r;const i=Nt(a=>(r||(r=sC(Sy(Jh(Nde(e,t),n),c=>{o.cachedRuntime=c}),{scope:n,scheduler:a.currentScheduler})),kd(r.await))),o=Object.assign(Object.create(Uge),{memoMap:t,scope:n,runtimeEffect:i,cachedRuntime:void 0,runtime(){return o.cachedRuntime===void 0?T1(o.runtimeEffect):Promise.resolve(o.cachedRuntime)},dispose(){return T1(o.disposeEffect)},disposeEffect:lt(()=>(o.runtimeEffect=ra("ManagedRuntime disposed"),o.cachedRuntime=void 0,di(o.scope,ns))),runFork(a,c){return o.cachedRuntime===void 0?sC(yf(o,a),c):Py(o.cachedRuntime)(a,c)},runSyncExit(a){return o.cachedRuntime===void 0?gde(yf(o,a)):TR(o.cachedRuntime)(a)},runSync(a){return o.cachedRuntime===void 0?aC(yf(o,a)):B5(o.cachedRuntime)(a)},runPromiseExit(a,c){return o.cachedRuntime===void 0?mde(yf(o,a),c):CR(o.cachedRuntime)(a,c)},runCallback(a,c){return o.cachedRuntime===void 0?oC(Sc)(yf(o,a),c):oC(o.cachedRuntime)(a,c)},runPromise(a,c){return o.cachedRuntime===void 0?T1(yf(o,a),c):V5(o.cachedRuntime)(a,c)}});return o},Vge=qge,Hge=W(e=>xl(e[0]),(e,...t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}),Kge=W(e=>xl(e[0]),(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n}),Dg=Symbol.for("effect/Schema");function oo(e){return class{[Dg]=ij;static ast=e;static annotations(n){return oo(jc(this.ast,n))}static pipe(){return He(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[Dg]=ij}}const ij={_A:e=>e,_I:e=>e,_R:e=>e},oj={typeConstructor:gZ,schemaId:bZ,message:LU,missingMessage:eM,identifier:tM,title:Sa,description:ly,examples:$U,default:jU,documentation:vZ,jsonSchema:FU,arbitrary:zU,pretty:BU,equivalence:UU,concurrency:qU,batching:VU,parseIssueTitle:HU,parseOptions:KU,decodingFallback:WU},Tw=e=>{if(!e)return{};const t={...e};for(const n in oj)if(n in e){const r=oj[n];t[r]=e[n],delete t[n]}return t},jc=(e,t)=>cM(e,Tw(t)),Pg=e=>st(e,Dg)&&xl(e[Dg]);function Wge(e){return sM(e)?Xs.make(tee(e,t=>new JS(t))):new JS(e[0])}function VK(e,t=Wge(e)){return class extends oo(t){static annotations(r){return VK(this.literals,jc(this.ast,r))}static literals=[...e]}}function mi(...e){return Sr(e)?VK(e):HK}class Gge extends oo(dT){}class vs extends oo($Z){}class Yge extends oo(DZ){}class HK extends oo(nM){}class Qge extends oo(tq){}class Ut extends oo(qZ){}class ar extends oo(KZ){}class Eo extends oo(GZ){}const Xge=e=>Xs.make(e.map(t=>t.ast));function KK(e,t=Xge(e)){return class extends oo(t){static annotations(r){return KK(this.members,jc(this.ast,r))}static members=[...e]}}function rp(...e){return sM(e)?KK(e):Sr(e)?e[0]:HK}const bo=e=>rp(e,Yge),Jge=e=>rp(e,Gge),Zge=(e,t)=>new rM(e.map(n=>Pg(n)?new $h(n.ast,!1):n.ast),t.map(n=>Pg(n)?new _x(n.ast):n.ast),!0);function WK(e,t,n=Zge(e,t)){return class extends oo(n){static annotations(i){return WK(this.elements,this.rest,jc(this.ast,i))}static elements=[...e];static rest=[...t]}}function GK(e,t){return class extends WK([],[e],t){static annotations(r){return GK(this.value,jc(this.ast,r))}static value=e}}const CS=e=>GK(e),wC=e=>e?'"?:"':'":"';class YK extends $h{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(t,n,r,i,o){super(t,n,i),this.isReadonly=r,this.defaultValue=o}toString(){const t=wC(this.isOptional),n=String(this.type);return`PropertySignature<${t}, ${n}, never, ${t}, ${n}>`}}class eye extends $h{isReadonly;defaultValue;constructor(t,n,r,i,o){super(t,n,i),this.isReadonly=r,this.defaultValue=o}}const tye=e=>e===void 0?"never":Ps(e)?JSON.stringify(e):String(e);class nye{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(t,n,r,i){this.from=t,this.to=n,this.decode=r,this.encode=i}toString(){return`PropertySignature<${wC(this.to.isOptional)}, ${this.to.type}, ${tye(this.from.fromKey)}, ${wC(this.from.isOptional)}, ${this.from.type}>`}}const QK=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new YK(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new nye(e.from,new eye(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},XK=Symbol.for("effect/PropertySignature"),JK=e=>st(e,XK);class mA{ast;[Dg];[XK]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(t){this.ast=t}pipe(){return He(this,arguments)}annotations(t){return new mA(QK(this.ast,Tw(t)))}toString(){return String(this.ast)}}class gA extends mA{from;constructor(t,n){super(t),this.from=n}annotations(t){return new gA(QK(this.ast,Tw(t)),this.from)}}const Ym=e=>{const t=e.ast===dT||e.ast===nM?dT:Jge(e).ast;return new gA(new YK(t,!0,!0,{},void 0),e)},rye=cq([eM]),iye=(e,t)=>{const n=Reflect.ownKeys(e),r=[];if(n.length>0){const o=[],a=[],c=[];for(let u=0;u<n.length;u++){const d=n[u],h=e[d];if(JK(h)){const p=h.ast;switch(p._tag){case"PropertySignatureDeclaration":{const y=p.type,g=p.isOptional,v=p.annotations;o.push(new Si(d,y,g,!0,rye(p))),a.push(new Si(d,Ai(y),g,!0,v)),r.push(new Si(d,y,g,!0,v));break}case"PropertySignatureTransformation":{const y=p.from.fromKey??d;o.push(new Si(y,p.from.type,p.from.isOptional,!0,p.from.annotations)),a.push(new Si(d,p.to.type,p.to.isOptional,!0,p.to.annotations)),c.push(new ree(y,d,p.decode,p.encode));break}}}else o.push(new Si(d,h.ast,!1,!0)),a.push(new Si(d,Ai(h.ast),!1,!0)),r.push(new Si(d,h.ast,!1,!0))}if(Sr(c)){const u=[],d=[];for(const h of t){const{indexSignatures:p,propertySignatures:y}=wL(h.key.ast,h.value.ast);y.forEach(g=>{o.push(g),a.push(new Si(g.name,Ai(g.type),g.isOptional,g.isReadonly,g.annotations))}),p.forEach(g=>{u.push(g),d.push(new Ex(g.parameter,Ai(g.type),g.isReadonly))})}return new nee(new Ou(o,u,{[uT]:"Struct (Encoded side)"}),new Ou(a,d,{[uT]:"Struct (Type side)"}),new iee(c))}}const i=[];for(const o of t){const{indexSignatures:a,propertySignatures:c}=wL(o.key.ast,o.value.ast);c.forEach(u=>r.push(u)),a.forEach(u=>i.push(u))}return new Ou(r,i)},oye=(e,t)=>{const n=Reflect.ownKeys(e);for(const r of n){const i=e[r];if(t[r]===void 0&&JK(i)){const o=i.ast,a=o._tag==="PropertySignatureDeclaration"?o.defaultValue:o.to.defaultValue;a!==void 0&&(t[r]=a())}}return t};function yA(e,t,n=iye(e,t)){return class extends oo(n){static annotations(i){return yA(this.fields,this.records,jc(this.ast,i))}static fields={...e};static records=[...t];static make=(i,o)=>{const a=oye(e,{...i});return r6(o)?a:FK(this)(a)};static pick(...i){return yi(Hge(e,...i))}static omit(...i){return yi(Kge(e,...i))}}}function yi(e,...t){return yA(e,t)}function ZK(e,t,n){return class extends yA({},[{key:e,value:t}],n){static annotations(i){return ZK(e,t,jc(this.ast,i))}static key=e;static value=t}}const Rf=e=>ZK(e.key,e.value),sye=Symbol.for("effect/SchemaId/Refine");function e6(e,t,n){return class extends oo(n){static annotations(i){return e6(this.from,this.filter,jc(this.ast,i))}static[sye]=e;static from=e;static filter=t;static make=(i,o)=>r6(o)?i:FK(this)(i)}}const sj=(e,t,n)=>{if(gx(e))return e?Ae():Oe(new Ja(t,n));if(Ps(e))return Oe(new Ja(t,n,e));if(e!==void 0){if("_tag"in e)return Oe(e);const r=new Ja(t,n,e.message);return Oe(Sr(e.path)?new oi(e.path,n,r):r)}return Ae()},aye=(e,t,n)=>{if(sZ(e))return sj(e,t,n);if(Sr(e)){const r=AU(e,i=>sj(i,t,n));if(Sr(r))return Oe(r.length===1?r[0]:new fr(t,n,r))}return Ae()};function t6(e,t){return n=>{function r(o,a,c){return aye(e(o,a,c),c,o)}const i=new sq(n.ast,r,Tw(t));return e6(n,r,i)}}const lye=hZ,cye=(e,t)=>n=>n.pipe(t6(r=>r>e,{schemaId:lye,title:`greaterThan(${e})`,description:"a positive number",jsonSchema:{exclusiveMinimum:e},...t})),uye=pZ,dye=e=>t=>t.pipe(t6(n=>Number.isSafeInteger(n),{schemaId:uye,title:"int",description:"an integer",jsonSchema:{type:"integer"},...e})),n6=e=>cye(0,{title:"positive",...e});class fye extends ar.pipe(dye({identifier:"Int"})){}function r6(e){return gx(e)?e:e?.disableValidation??!1}const aj=Cme,hye=Rme,Es=Ame,pye=Ome,mye=Cd,gye=qy,Am=wK,yye=Og,Rs=_K,Ng=yge,bye=Fme,Qm=qme,ba=Vme,vye=Kme,Sye=Wme,xye=Xme,q1=AK,lj=Symbol.for("effect/Subscribable"),wye=L5,kye="effect/SubscriptionRef",_ye=Symbol.for(kye),Eye={_A:e=>e};class Tye extends Yh{ref;pubsub;semaphore;[Sh]=Sh;[lj]=lj;[Tse]=nR;[wye]=$5;[_ye]=Eye;constructor(t,n,r){super(),this.ref=t,this.pubsub=n,this.semaphore=r,this.get=Ui(this.ref)}commit(){return this.get}get;get changes(){return Y(Ui(this.ref),ze(t=>Qe(wK(this.pubsub,{scoped:!0}),n=>vK($me(t),n))),this.semaphore.withPermits(1),AK)}modify(t){return this.modifyEffect(n=>on(t(n)))}modifyEffect(t){return Y(Ui(this.ref),ze(t),ze(([n,r])=>Y(id(this.ref,r),pi(n),BR(sl(this.pubsub,r)))),this.semaphore.withPermits(1))}}const Cye=e=>Ui(e.ref),Iye=e=>Y($c([C0(),Kn(e),zR(1)]),Qe(([t,n,r])=>new Tye(n,t,r))),Mye=W(2,(e,t)=>Y(id(e.ref,t),BR(sl(e.pubsub,t)),e.semaphore.withPermits(1))),Xm=Cye,Rye=Iye,Aye=Mye,Oye={maxDepth:6,maxObjectKeys:32,maxArrayLength:32,maxStringLength:256,maxJsonBytes:4*1024,oversizedPreviewBytes:256},du=(e,t,n)=>e.length<=t?e:(n.oversized+=1,e.slice(0,t)),Tv=(e,t)=>e?e==="non_serializable"||t==="non_serializable"?"non_serializable":e==="oversized"||t==="oversized"?"oversized":"unknown":t;function Dye(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Pye=(e,t)=>Number.isFinite(e)?e:(t.nonSerializable+=1,String(e)),kC=(e,t,n,r,i)=>{if(e===null)return null;switch(typeof e){case"string":return du(e,t.maxStringLength,n);case"number":return Pye(e,n);case"boolean":return e;case"bigint":return n.nonSerializable+=1,du(e.toString(),t.maxStringLength,n);case"symbol":return n.nonSerializable+=1,du(e.toString(),t.maxStringLength,n);case"function":return n.nonSerializable+=1,"[Function]";case"undefined":return n.dropped+=1,null}if(i>=t.maxDepth)return n.oversized+=1,"[Truncated]";if(e instanceof Date)return e.toISOString();if(e instanceof Error)return n.nonSerializable+=1,{name:du(e.name,t.maxStringLength,n),message:du(e.message,t.maxStringLength,n)};if(typeof e=="object"){if(r.has(e))return n.nonSerializable+=1,"[Circular]";r.add(e)}if(Array.isArray(e)){const u=[],d=Math.min(e.length,t.maxArrayLength);for(let h=0;h<d;h++)u.push(kC(e[h],t,n,r,i+1));return e.length>d&&(n.oversized+=1,u.push(`[...${e.length-d} more]`)),u}if(!Dye(e))return n.nonSerializable+=1,du(String(e),t.maxStringLength,n);const o=Object.entries(e),a=Math.min(o.length,t.maxObjectKeys),c={};for(let u=0;u<a;u++){const[d,h]=o[u],p=du(d,t.maxStringLength,n);if(h===void 0){n.dropped+=1;continue}c[p]=kC(h,t,n,r,i+1)}return o.length>a&&(n.oversized+=1,c.__truncatedKeys=o.length-a),c},Gr=(e,t)=>{const n={...Oye},r={dropped:0,oversized:0,nonSerializable:0},i=new WeakSet;let o;const a=kC(e,n,r,i,0);r.nonSerializable>0&&(o=Tv(o,"non_serializable")),r.oversized>0&&(o=Tv(o,"oversized"));try{const c=JSON.stringify(a);if(c.length>n.maxJsonBytes){o=Tv(o,"oversized");const u=c.slice(0,Math.min(n.oversizedPreviewBytes,n.maxJsonBytes));return{value:{_tag:"oversized",bytes:c.length,preview:u},stats:{dropped:r.dropped,oversized:r.oversized+1,nonSerializable:r.nonSerializable},downgrade:o}}}catch{return o=Tv(o,"non_serializable"),{value:"[Unserializable]",stats:{dropped:r.dropped,oversized:r.oversized,nonSerializable:r.nonSerializable+1},downgrade:o}}return{value:a,stats:{dropped:r.dropped,oversized:r.oversized,nonSerializable:r.nonSerializable},downgrade:o}},Nye=(e,t)=>e.length<=t?{value:e,truncated:!1}:{value:e.slice(0,t),truncated:!0},Lye=e=>{try{return{ok:!0,json:JSON.stringify(e)}}catch{return{ok:!1}}},$ye=e=>{if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);if(e instanceof Error)return e.message||e.name||"Error";if(e&&typeof e=="object"&&"message"in e&&typeof e.message=="string")return e.message;try{const t=Lc(e,{renderErrorCause:!0});if(typeof t=="string"&&t.length>0)return t}catch{}return"Unknown error"},Zs=(e,t)=>{const r=$ye(e),{value:i,truncated:o}=Nye(r,256),a={message:i};if(e instanceof Error){e.name&&e.name!=="Error"&&(a.name=e.name);const u=e;return typeof u.code=="string"&&u.code.length>0?a.code=u.code:typeof u.code=="number"&&Number.isFinite(u.code)&&(a.code=String(u.code)),typeof u.hint=="string"&&u.hint.length>0&&(a.hint=u.hint),{errorSummary:a,downgrade:o?"oversized":void 0}}if(e&&typeof e=="object"){const u=e;typeof u.name=="string"&&u.name.length>0&&(a.name=u.name),typeof u.code=="string"&&u.code.length>0&&(a.code=u.code),typeof u.hint=="string"&&u.hint.length>0&&(a.hint=u.hint)}return Lye(e).ok?o?{errorSummary:a,downgrade:"oversized"}:i==="Unknown error"?{errorSummary:a,downgrade:"unknown"}:{errorSummary:a}:{errorSummary:a,downgrade:"non_serializable"}},ad=Oo(void 0);class Vy extends tn("Logix/EffectOpMiddleware")(){}const jye=e=>t=>e.reduceRight((n,r)=>r({...t,effect:n}),t.effect),Fye=(e,t)=>ae(function*(){const n=yield*ut(ad),r=e.meta?.linkId,i=typeof r=="string"&&r.length>0?r:n??e.id,o={...e,meta:{...e.meta??{},linkId:i}},a=t.length?jye(t)(o):o.effect;return yield*lr(ad,i)(a)}),ro=Oo([]),kc=Oo(void 0),i6=Oo(void 0),o6=Oo(void 0),Ei=Oo("off"),s6=Oo({sampleEveryN:32,topK:3}),zye=e=>jy(s6,()=>e);let cj=0;const Bye=()=>(cj+=1,cj),Uye=(e,t)=>`${e}::e${t}`,Cr=(e,t)=>e?t?e==="non_serializable"||t==="non_serializable"?"non_serializable":e==="oversized"||t==="oversized"?"oversized":"unknown":e:t,uj=new Set,dj=new Set,fj=new Map,Jm=new Map,qye=(e,t)=>{const n=Jm.get(e);if(!n){Jm.set(e,[t]);return}n.push(t),n.length>64&&n.shift()},Vye=(e,t)=>{const n=Jm.get(e);if(!n||n.length===0){Jm.delete(e);return}for(const r of n){const i=r;i.txnId==null&&(i.txnId=t.txnId),(typeof i.txnSeq!="number"||i.txnSeq<=0)&&(i.txnSeq=t.txnSeq)}Jm.delete(e)},Ih=e=>{const t=e.moduleId??"unknown",n=(()=>{try{return Lc(e.cause,{renderErrorCause:!0})}catch{try{return JSON.stringify(e.cause,null,2)}catch{return String(e.cause)}}})(),r=`[Logix][module=${t}] lifecycle:error
34
+ ${n}`;return dc(r).pipe(FR({"logix.moduleId":t,"logix.event":"lifecycle:error","logix.cause":n}))},Mh=e=>{const t=e.moduleId??"unknown",n=`[Logix][module=${t}] diagnostic(${e.severity})`,r=`code=${e.code} message=${e.message}${e.actionTag?` action=${e.actionTag}`:""}${e.hint?`
35
+ hint: ${e.hint}`:""}`,i=`${n}
36
+ ${r}`,o=e.severity==="warning"?Ofe(i):e.severity==="info"?Afe(i):dc(i),a={"logix.moduleId":t,"logix.event":`diagnostic(${e.severity})`,"logix.diagnostic.code":e.code,"logix.diagnostic.message":e.message};return e.hint&&(a["logix.diagnostic.hint"]=e.hint),e.actionTag&&(a["logix.diagnostic.actionTag"]=e.actionTag),o.pipe(FR(a))},Hye=$y(ro,[]),a6={record:e=>e.type==="lifecycle:error"?Ih(e):e.type==="diagnostic"&&e.severity!=="info"?Mh(e):he},Kye=$y(ro,[a6]),bA=e=>e.length===1&&e[0]===a6,Wye={record:e=>e.type==="lifecycle:error"?Ih(e):e.type==="diagnostic"?Mh(e):dH({debugEvent:e})};$y(ro,[Wye]);const vA=typeof window<"u"&&typeof document<"u",SA=e=>{if(typeof e.type=="string"&&e.type.startsWith("trace:")){const t=e.moduleId??"unknown",n=e.type;return Ze(()=>{console.groupCollapsed("%c[Logix]%c trace %c"+t+"%c "+String(n),"color:#6b7280;font-weight:bold","color:#3b82f6","color:#9ca3af","color:#6b7280"),console.log(e),console.groupEnd()})}if(e.type==="lifecycle:error"){const t=e.moduleId??"unknown",n=(()=>{try{return Lc(e.cause,{renderErrorCause:!0})}catch{try{return JSON.stringify(e.cause,null,2)}catch{return String(e.cause)}}})(),r=`${t}|${n}`;return uj.has(r)?he:(uj.add(r),Ze(()=>{console.groupCollapsed("%c[Logix]%c lifecycle:error %c"+t,"color:#ef4444;font-weight:bold","color:#ef4444","color:#9ca3af"),console.error(n),console.groupEnd()}))}if(e.type==="diagnostic"){const t=e.moduleId??"unknown",n=`code=${e.code} message=${e.message}${e.actionTag?` action=${e.actionTag}`:""}${e.hint?`
37
+ hint: ${e.hint}`:""}`,r=e.severity==="warning"?"color:#d97706":e.severity==="info"?"color:#3b82f6":"color:#ef4444",i=e.severity==="warning"?"diagnostic(warning)":e.severity==="info"?"diagnostic(info)":"diagnostic(error)",o=`${t}|${e.code}|${e.message}`;return dj.has(o)?he:(dj.add(o),Ze(()=>{console.groupCollapsed("%c[Logix]%c "+i+"%c module="+t,"color:#6b7280;font-weight:bold",r,"color:#9ca3af"),e.severity==="warning"?console.warn(n):e.severity==="info"?console.info(n):console.error(n),console.groupEnd()}))}return he},Gye={record:e=>vA?SA(e):e.type==="lifecycle:error"?Ih(e):e.type==="diagnostic"?Mh(e):dH({debugEvent:e})},Yye=$y(ro,[Gye]),Qye={record:e=>vA?e.type==="lifecycle:error"||e.type==="diagnostic"&&e.severity!=="info"?SA(e):he:e.type==="lifecycle:error"?Ih(e):e.type==="diagnostic"&&e.severity!=="info"?Mh(e):he},Xye=$y(ro,[Qye]);Fge(zge,Bge({mode:"browser",colors:!0}));const it=e=>ae(function*(){const t=yield*ut(ro);if(bA(t)){if(e.type==="lifecycle:error"){yield*Ih(e);return}if(e.type==="diagnostic"){e.severity!=="info"?yield*Mh(e):yield*he;return}yield*he;return}if(t.length===0){if(vA){if(e.type==="lifecycle:error"||e.type==="diagnostic"){yield*SA(e);return}yield*he;return}if(e.type==="lifecycle:error"){yield*Ih(e);return}if(e.type==="diagnostic"){yield*Mh(e);return}yield*he;return}const n=e,r=yield*ut(Ei);let i;const o=()=>(i===void 0&&(i=Date.now()),i);if(n.timestamp===void 0&&(r!=="off"||n.type==="lifecycle:error"||n.type==="diagnostic")&&(n.timestamp=o()),r!=="off"&&n.runtimeLabel===void 0){const a=yield*ut(kc);a&&(n.runtimeLabel=a)}if(n.type==="diagnostic"&&n.txnId===void 0){const a=yield*ut(i6);a&&(n.txnId=a)}if(r!=="off"&&n.type==="trace:effectop"&&n.linkId===void 0){const a=yield*ut(ad);a&&(n.linkId=a)}if(t.length===1){yield*t[0].record(n);return}yield*sn(t,a=>a.record(n),{discard:!0})}),Jye=(e,t)=>{const n=t?.diagnosticsLevel??"full";if(n==="off")return;const r=n==="light"||n==="sampled",i=typeof e.timestamp=="number"&&Number.isFinite(e.timestamp)?e.timestamp:Date.now(),o=e.moduleId,a=typeof o=="string"&&o.length>0?o:"unknown",c=e.instanceId,u=typeof c=="string"&&c.length>0?c:"unknown",d=e.runtimeLabel,h=typeof d=="string"&&d.length>0?d:void 0,p=e.txnSeq,y=typeof p=="number"&&Number.isFinite(p)&&p>=0?Math.floor(p):0,g=e.txnId,v=typeof g=="string"&&g.length>0?g:y>0?`${u}::t${y}`:void 0,S=(()=>{const T=e.linkId;if(typeof T=="string"&&T.length>0)return T;if(typeof e.type!="string"||!e.type.startsWith("trace:"))return;const q=e.data?.meta?.linkId;if(typeof q=="string"&&q.length>0)return q})(),x=t?.eventSeq,k=typeof x=="number"&&Number.isFinite(x)&&x>0?Math.floor(x):Bye(),E={eventId:Uye(u,k),eventSeq:k,moduleId:a,instanceId:u,runtimeLabel:h,txnSeq:y,txnId:v,linkId:S,timestamp:i};let M;const D=T=>M?{...T,downgrade:{reason:M}}:T;switch(e.type){case"module:init":return D({...E,kind:"lifecycle",label:"module:init"});case"module:destroy":return D({...E,kind:"lifecycle",label:"module:destroy"});case"lifecycle:phase":{const T=e,C=r?{type:"lifecycle:phase",phase:T.phase,name:T.name}:{type:"lifecycle:phase",phase:T.phase,name:T.name,payload:T.payload},O=Gr(C);return t?.onMetaProjection?.({stats:O.stats,downgrade:O.downgrade}),M=Cr(M,O.downgrade),D({...E,kind:"lifecycle",label:T.name,meta:O.value})}case"action:dispatch":{const T=e.action,C=e.actionTag,O=typeof C=="string"&&C.length>0?C:T?._tag??T?.type,q=String(O??"action:dispatch"),I=q.length>0?q:"unknown",L=e.unknownAction===!0?!0:void 0,P=r?{actionTag:I,...L?{unknownAction:!0}:{}}:{action:T,...L?{unknownAction:!0}:{}},B=Gr(P);return t?.onMetaProjection?.({stats:B.stats,downgrade:B.downgrade}),M=Cr(M,B.downgrade),L&&(M=Cr(M,"unknown")),D({...E,kind:"action",label:I,meta:B.value})}case"state:update":{const T=e,C=()=>{const L=t?.resolveConvergeStaticIr;if(!L)return;const P=T.staticIrDigest;if(typeof P!="string"||P.length===0)return;const B=T.dirtySet;if(!B||typeof B!="object"||Array.isArray(B))return;const $=B.rootIds;if(!Array.isArray($)||$.length===0)return;const j=L(P)?.fieldPaths;if(!Array.isArray(j)||j.length===0)return;const K=[];for(const G of $){if(typeof G!="number"||!Number.isFinite(G))continue;const J=Math.floor(G);if(J<0)continue;const F=j[J];!Array.isArray(F)||F.length===0||F.every(U=>typeof U=="string"&&U.length>0)&&K.push(F)}return K.length>0?K:void 0},O=(()=>{const L=C();if(!L)return T.dirtySet;const P=T.dirtySet;return!P||typeof P!="object"||Array.isArray(P)?T.dirtySet:{...P,rootPaths:L}})(),q=r?{state:T.state,dirtySet:O,patchCount:T.patchCount,patchesTruncated:T.patchesTruncated,patchesTruncatedReason:T.patchesTruncatedReason,staticIrDigest:T.staticIrDigest,commitMode:T.commitMode,priority:T.priority,originKind:T.originKind,originName:T.originName}:{state:T.state,dirtySet:O,patchCount:T.patchCount,patchesTruncated:T.patchesTruncated,patchesTruncatedReason:T.patchesTruncatedReason,staticIrDigest:T.staticIrDigest,commitMode:T.commitMode,priority:T.priority,originKind:T.originKind,originName:T.originName,traitSummary:T.traitSummary,replayEvent:T.replayEvent},I=Gr(q);return t?.onMetaProjection?.({stats:I.stats,downgrade:I.downgrade}),M=Cr(M,I.downgrade),v&&(fj.set(u,{txnId:v,txnSeq:y}),Vye(u,{txnId:v,txnSeq:y})),D({...E,kind:"state",label:"state:update",meta:I.value})}case"process:start":case"process:stop":case"process:restart":case"process:trigger":case"process:dispatch":case"process:error":{const T=e,C=typeof T.timestampMs=="number"&&Number.isFinite(T.timestampMs)?T.timestampMs:i,O={identity:T.identity,severity:T.severity,eventSeq:T.eventSeq,timestampMs:T.timestampMs,trigger:T.trigger,dispatch:T.dispatch,error:T.error},q=Gr(O);t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade);const I=T.type==="process:error"||T.type==="process:restart"?T.error:void 0;return D({...E,timestamp:C,kind:"process",label:T.type,meta:q.value,errorSummary:I})}case"lifecycle:error":{const T=e,C=Zs(T.cause);M=Cr(M,C.downgrade);const O=r?{type:"lifecycle:error",phase:T.phase,name:T.hook}:{type:"lifecycle:error",phase:T.phase,name:T.hook,hook:T.hook,taskId:T.taskId,origin:T.origin,txnSeq:T.txnSeq,opSeq:T.opSeq},q=Gr(O);return t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade),D({...E,kind:"lifecycle",label:"lifecycle:error",meta:q.value,errorSummary:C.errorSummary})}case"diagnostic":{const T=e,C={code:T.code,severity:T.severity,message:T.message,hint:T.hint,actionTag:T.actionTag,kind:T.kind,trigger:T.trigger},O=Gr(C);return t?.onMetaProjection?.({stats:O.stats,downgrade:O.downgrade}),M=Cr(M,O.downgrade),D({...E,kind:"diagnostic",label:T.code,meta:O.value})}default:{if(typeof e.type!="string"||!e.type.startsWith("trace:"))return;if(e.type==="trace:txn-lane"){const C=e.data,O=C?.evidence??C,q=Gr(O);t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade);const I=typeof O?.kind=="string"&&O.kind.length>0?String(O.kind):"txn-lane";return D({...E,kind:"txn-lane",label:I,meta:q.value})}if(e.type==="trace:react-render"||e.type==="trace:react-selector"){const C=e.data,O=Gr(r?{componentLabel:C?.componentLabel,selectorKey:C?.selectorKey,fieldPaths:C?.fieldPaths,selectorId:C?.selectorId,lane:C?.lane,producer:C?.producer,fallbackReason:C?.fallbackReason,readsDigest:C?.readsDigest,equalsKind:C?.equalsKind,strictModePhase:C?.strictModePhase}:{componentLabel:C?.componentLabel,selectorKey:C?.selectorKey,fieldPaths:C?.fieldPaths,selectorId:C?.selectorId,lane:C?.lane,producer:C?.producer,fallbackReason:C?.fallbackReason,readsDigest:C?.readsDigest,equalsKind:C?.equalsKind,strictModePhase:C?.strictModePhase,meta:C?.meta});t?.onMetaProjection?.({stats:O.stats,downgrade:O.downgrade}),M=Cr(M,O.downgrade);const q=typeof C?.componentLabel=="string"&&C.componentLabel.length>0?C.componentLabel:e.type==="trace:react-selector"?"react-selector":"react-render",I=fj.get(u),L=typeof C?.meta?.txnSeq=="number"&&Number.isFinite(C.meta.txnSeq)&&C.meta.txnSeq>=0?Math.floor(C.meta.txnSeq):void 0,B=(typeof C?.meta?.txnId=="string"&&C.meta.txnId.length>0?C.meta.txnId:void 0)??E.txnId??I?.txnId,$=L??(E.txnSeq>0?E.txnSeq:I?.txnSeq??E.txnSeq),V=D({...E,txnId:B,txnSeq:$,kind:e.type==="trace:react-selector"?"react-selector":"react-render",label:q,meta:O.value});return u!=="unknown"&&(V.txnId==null||V.txnSeq<=0)&&qye(u,V),V}if(e.type==="trace:selector:eval"){const C=e.data,O={selectorId:C?.selectorId,lane:C?.lane,producer:C?.producer,fallbackReason:C?.fallbackReason,readsDigest:C?.readsDigest,equalsKind:C?.equalsKind,changed:C?.changed,evalMs:C?.evalMs},q=Gr(O);return t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade),D({...E,kind:"devtools",label:e.type,meta:q.value})}if(e.type==="trace:exec-vm"){const C=e.data,O={version:C?.version,stage:C?.stage,hit:C?.hit,reasonCode:C?.reasonCode??C?.reason,reasonDetail:C?.reasonDetail,execIrVersion:C?.execIrVersion,execIrHash:C?.execIrHash,serviceId:C?.serviceId,implId:C?.implId},q=Gr(O);return t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade),D({...E,kind:"devtools",label:e.type,meta:q.value})}if(e.type==="trace:trait:converge"){const C=$=>{const V=t?.resolveConvergeStaticIr;if(!V)return;const j=$.staticIrDigest;if(typeof j!="string"||j.length===0)return;const K=$.rootIds;if(!Array.isArray(K)||K.length===0)return;const J=V(j)?.fieldPaths;if(!Array.isArray(J)||J.length===0)return;const F=[];for(const U of K){if(typeof U!="number"||!Number.isFinite(U))continue;const Q=Math.floor(U);if(Q<0||Q>=J.length)continue;const z=J[Q];Array.isArray(z)&&F.push(z)}return F.length>0?F:void 0},O=$=>{if(!$||typeof $!="object"||Array.isArray($))return $;const V=$,j=V.dirty;if(!j||typeof j!="object"||Array.isArray(j))return $;const K=C({staticIrDigest:V.staticIrDigest,rootIds:j?.rootIds});return K?{...V,dirty:{...j,rootPaths:K}}:$},q=$=>{if(!$||typeof $!="object"||Array.isArray($))return $;const V=$,j=V.dirty,K=C({staticIrDigest:V.staticIrDigest,rootIds:j?.rootIds}),G=j&&typeof j=="object"&&!Array.isArray(j)?{dirtyAll:j.dirtyAll,...typeof j.reason=="string"?{reason:j.reason}:null,...Array.isArray(j.rootIds)?{rootIds:j.rootIds}:null,...typeof j.rootIdsTruncated=="boolean"?{rootIdsTruncated:j.rootIdsTruncated}:null,...K?{rootPaths:K}:null}:void 0,{top3:J,dirtyRoots:F,...U}=V;return G?{...U,dirty:G}:U},I=$=>{if(!$||typeof $!="object"||Array.isArray($))return $;const V=$,j=V.dirty,K=j&&typeof j=="object"&&!Array.isArray(j)?{dirtyAll:j.dirtyAll,...typeof j.reason=="string"?{reason:j.reason}:null}:void 0,{dirtyRoots:G,...J}=V;return K?{...J,dirty:K}:J},L=e.data,P=n==="light"?q(L):n==="sampled"?I(L):O(L),B=Gr(P);return t?.onMetaProjection?.({stats:B.stats,downgrade:B.downgrade}),M=Cr(M,B.downgrade),D({...E,kind:"trait:converge",label:"trait:converge",meta:B.value})}if(e.type==="trace:trait:check"){const C=L=>{if(!L||typeof L!="object"||Array.isArray(L))return L;const P=L,B=P.degraded,$=B&&typeof B=="object"&&!Array.isArray(B)?{kind:B.kind}:void 0,{degraded:V,...j}=P;return $?{...j,degraded:$}:j},O=e.data,q=r?C(O):O,I=Gr(q);return t?.onMetaProjection?.({stats:I.stats,downgrade:I.downgrade}),M=Cr(M,I.downgrade),D({...E,kind:"trait:check",label:"trait:check",meta:I.value})}if(e.type==="trace:trait:validate"){const C=e.data,O=Gr(C);return t?.onMetaProjection?.({stats:O.stats,downgrade:O.downgrade}),M=Cr(M,O.downgrade),D({...E,kind:"trait:validate",label:"trait:validate",meta:O.value})}if(e.type==="trace:module:traits"){const C=e.data,O=r?{digest:C?.digest,count:C?.count}:{digest:C?.digest,count:C?.count,traits:C?.traits,provenanceIndex:C?.provenanceIndex},q=Gr(O);return t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade),D({...E,kind:"devtools",label:e.type,meta:q.value})}if(e.type==="trace:module:traits:conflict"){const C=e.data,O=r?{conflictCount:C?.conflictCount,traitIds:C?.traitIds}:{conflictCount:C?.conflictCount,conflicts:C?.conflicts},q=Gr(O);return t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade),D({...E,kind:"devtools",label:e.type,meta:q.value})}if(e.type==="trace:module:descriptor"){const C=e.data,O=r?{id:C?.id,traits:C?.traits,source:C?.source}:{data:C},q=Gr(O);return t?.onMetaProjection?.({stats:q.stats,downgrade:q.downgrade}),M=Cr(M,q.downgrade),D({...E,kind:"devtools",label:e.type,meta:q.value})}if(e.type==="trace:effectop"){const C=e.data,O=C?.meta,q=C?.kind??"service",I=typeof C?.name=="string"?C.name:"effectop",L=typeof O?.moduleId=="string"?O.moduleId:a,P=typeof O?.txnId=="string"&&O.txnId.length>0?O.txnId:E.txnId,B=typeof O?.txnSeq=="number"&&Number.isFinite(O.txnSeq)&&O.txnSeq>=0?Math.floor(O.txnSeq):E.txnSeq,$=r?{id:C?.id,kind:C?.kind,name:C?.name,meta:O}:{id:C?.id,kind:C?.kind,name:C?.name,payload:C?.payload,meta:O},V=Gr($);return t?.onMetaProjection?.({stats:V.stats,downgrade:V.downgrade}),M=Cr(M,V.downgrade),D({...E,moduleId:L,txnId:P,txnSeq:B,kind:q,label:I,meta:V.value})}const T=Gr(r?{data:void 0}:{data:e.data});return t?.onMetaProjection?.({stats:T.stats,downgrade:T.downgrade}),M=Cr(M,T.downgrade),D({...E,kind:"devtools",label:e.type,meta:T.value})}}},Cv=new Map,V1=new Map,H1=new Map,hj=new Map,l6=new Map,K1=new Set,pj={dropped:0,oversized:0};let _C=500;const Zye=new Set;let W1=!1;const ebe=()=>{W1||(W1=!0,queueMicrotask(()=>{W1=!1;for(const e of Zye)e()}))};let c6=!1;const EC=()=>{ebe()},tbe=e=>{if(c6=!0,typeof e?.bufferSize=="number"&&Number.isFinite(e.bufferSize)){const t=Math.floor(e.bufferSize),n=t>=0?t:0;n!==_C&&(_C=n,EC())}},nbe=()=>c6,rbe=e=>{l6.set(e.staticIrDigest,e)},ibe={register:rbe},obe={record:e=>ae(function*(){const t=yield*ut(Ei);let n=!1;if(e.type==="trace:instanceLabel"){const o=e.instanceId,a=e.data,c=a&&typeof a=="object"&&"label"in a?String(a.label):void 0;o&&c&&(hj.set(o,c),n=!0)}if(e.type==="module:init"||e.type==="module:destroy"){const o=e.moduleId??"unknown",a=e.runtimeLabel??"unknown",c=e.instanceId,u=`${a}::${o}`,d=Cv.get(u)??0;if(e.type==="module:init"){if(Cv.set(u,d+1),n=!0,c){const h=`${a}::${o}::${c}`;K1.add(h),V1.delete(h)&&(n=!0),H1.delete(h)&&(n=!0)}}else{const h=d-1;if(h<=0?Cv.delete(u)&&(n=!0):(Cv.set(u,h),n=!0),c){const p=`${a}::${o}::${c}`;K1.delete(p),V1.delete(p)&&(n=!0),H1.delete(p)&&(n=!0),hj.delete(c)&&(n=!0),n=!0}}}let r=!1;const i=Jye(e,{diagnosticsLevel:t,resolveConvergeStaticIr:o=>l6.get(o),onMetaProjection:({stats:o})=>{(o.dropped!==0||o.oversized!==0)&&(r=!0),pj.dropped+=o.dropped,pj.oversized+=o.oversized}});if(r&&(n=!0),!i){n&&EC();return}if(i.kind==="state"&&i.label==="state:update"){const a=`${i.runtimeLabel??"unknown"}::${i.moduleId}::${i.instanceId}`;if(K1.has(a)&&i.meta&&typeof i.meta=="object"&&!Array.isArray(i.meta)){const c=i.meta;"state"in c&&(V1.set(a,c.state),n=!0),"traitSummary"in c&&c.traitSummary!==void 0&&(H1.set(a,c.traitSummary),n=!0)}}_C>0&&(n=!0),n&&EC()})},u6=Oo([]),sbe=e=>jy(u6,t=>[...t,...e]);var abe={};const d6=()=>{try{const e=abe;return typeof e?.NODE_ENV=="string"?e.NODE_ENV:void 0}catch{return}},Sn=()=>d6()!=="production",lbe=()=>Sn()?"full":"light";class cbe extends tn("@logixjs/core/StateTransactionRuntimeConfig")(){}const Cw=cbe;class ube extends tn("@logixjs/core/ReadQueryStrictGateRuntimeConfig")(){}const f6=ube;class dbe extends tn("@logixjs/core/ReplayModeConfig")(){}const mj=dbe;class fbe extends tn("@logixjs/core/StateTransactionOverrides")(){}const hc=fbe;class hbe extends tn("@logixjs/core/ConcurrencyPolicy")(){}const h6=hbe;class pbe extends tn("@logixjs/core/ConcurrencyPolicyOverrides")(){}const mbe=pbe,gbe=e=>{switch(e){case"reducer":case"trait-computed":case"trait-link":case"source-refresh":case"devtools":case"perf":case"unknown":return e;default:return typeof e=="string"&&e.startsWith("source:")?"source-refresh":"unknown"}},IS=e=>!(!e||e==="*"||/^\d+$/.test(e)||e.includes("[")||e.includes("]")),Fi=e=>{if(typeof e=="string"){const r=vbe(e);if(!r||r.length===0)return;const i=r.filter(IS);return i.length>0?i:void 0}if(e.length===0)return;let t=!1;for(const r of e)if(!IS(r)){t=!0;break}if(!t)return e;const n=e.filter(IS);return n.length>0?n:void 0},xA=(e,t)=>{const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const i=e[r],o=t[r];if(i!==o)return i<o?-1:1}return e.length-t.length},TC=(e,t)=>{if(e.length>t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},ybe=e=>{const t={children:new Map},n=new Map,r=new Set;for(let i=0;i<e.length;i++){const o=e[i];let a=t;for(const c of o){const u=a.children;let d=u.get(c);d||(d={children:new Map},u.set(c,d)),a=d}if(a.id=i,o.length>0&&o.some(c=>c.includes("."))){const c=o.join(".");r.add(c),n.delete(c)}if(o.length>0&&o.every(c=>!c.includes(".")&&!c.includes("[")&&!c.includes("]"))){const c=o.join(".");if(r.has(c))continue;if(n.has(c)){r.add(c),n.delete(c);continue}n.set(c,i)}}return{fieldPaths:e,root:t,pathStringToId:n}},R0=(e,t)=>{let n=e.root;for(const r of t){const i=n.children.get(r);if(!i)return;n=i}return n.id},bbe=e=>{let t=2166136261;for(const n of e)t^=n>>>0,t=Math.imul(t,16777619);return t>>>0},p6=e=>{if(e.dirtyAllReason)return{dirtyAll:!0,reason:e.dirtyAllReason,rootIds:[],rootCount:0,keySize:0,keyHash:0};let t=!1,n=!1,r=!1;const i=[];for(const h of e.dirtyPaths??[]){if(h==="*"){t=!0;continue}if(typeof h=="number"){if(!Number.isFinite(h)){n=!0;continue}const g=Math.floor(h);if(g<0){n=!0;continue}if(!e.registry.fieldPaths[g]){r=!0;continue}i.push(g);continue}if(typeof h=="string"){const g=e.registry.pathStringToId?.get(h);if(g!=null){i.push(g);continue}r=!0;continue}const p=Fi(h);if(!p){n=!0;continue}const y=R0(e.registry,p);if(y==null){r=!0;continue}i.push(y)}if(n)return{dirtyAll:!0,reason:"nonTrackablePatch",rootIds:[],rootCount:0,keySize:0,keyHash:0};if(r)return{dirtyAll:!0,reason:"fallbackPolicy",rootIds:[],rootCount:0,keySize:0,keyHash:0};if(t)return{dirtyAll:!0,reason:"unknownWrite",rootIds:[],rootCount:0,keySize:0,keyHash:0};const o=e.registry.fieldPaths;i.sort((h,p)=>{const y=o[h],g=o[p];if(!y||!g)return h-p;const v=xA(y,g);return v!==0?v:h-p});const a=[];let c;for(let h=0;h<i.length;h++){const p=i[h],y=o[p];y&&(c&&TC(c,y)||(a.push(p),c=y))}if(!(a.length>0))return{dirtyAll:!0,reason:"unknownWrite",rootIds:[],rootCount:0,keySize:0,keyHash:0};a.sort((h,p)=>h-p);const d=bbe(a);return{dirtyAll:!1,rootIds:a,rootCount:a.length,keySize:a.length,keyHash:d}},vbe=e=>{if(!e||e==="*")return;const t=e.split(".").filter(r=>r.length>0),n=[];for(const r of t){if(!r)continue;if(r==="*")return;if(r.endsWith("[]")){const o=r.slice(0,-2);o&&n.push(o);continue}const i=/^(.+)\[(\d+)\]$/.exec(r);if(i){n.push(i[1]);continue}if(!/^\d+$/.test(r)){if(r.includes("[")||r.includes("]"))return;n.push(r)}}return n},_c=e=>{if(e===null)return"null";const t=typeof e;if(t==="string")return JSON.stringify(e);if(t==="number")return Number.isFinite(e)?String(e):"null";if(t==="boolean")return e?"true":"false";if(Array.isArray(e))return`[${e.map(_c).join(",")}]`;if(t==="object"){const n=e;return`{${Object.keys(n).sort((i,o)=>i.localeCompare(o)).map(i=>`${JSON.stringify(i)}:${_c(n[i])}`).join(",")}}`}return"null"},ip=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t*16777619>>>0;return t.toString(16).padStart(8,"0")},Sbe=e=>{if(!e||e.length===0)return[];const t=[];for(const n of e){const r=Fi(n);r&&t.push(r)}return t},xbe=e=>e?Fi(e):void 0,m6=e=>{switch(e.kind){case"computed-update":return"computed";case"link-propagate":return"link";case"source-refresh":return"source";case"check-validate":return"check"}},wbe=(e,t)=>{const n=t.targetFieldPath;if(!n)return;const r=m6(t);return e.entries.find(i=>i.fieldPath===n&&(i.kind===r||r==="check"&&i.kind==="check"||r==="source"&&i.kind==="source"||r==="link"&&i.kind==="link"||r==="computed"&&i.kind==="computed"))},kbe=e=>{if(e){if(e.kind==="computed"||e.kind==="source")return e.meta.deps;if(e.kind==="link"){const t=e.meta.from;return t?[t]:[]}if(e.kind==="check"){const t=e.meta?.rules??{},n=[];for(const r of Object.keys(t)){const o=t[r]?.deps;o&&n.push(...o)}return n}}},_be=e=>{const t=e.moduleId,n=e.version??"009",r=new Map;for(const u of e.program.graph.nodes){const d=u.meta;if(!d||typeof d!="object")continue;const h=typeof d.label=="string"?d.label:void 0,p=typeof d.description=="string"?d.description:void 0,y=Array.isArray(d.tags)&&d.tags.every(_=>typeof _=="string")?d.tags:void 0,g=typeof d.group=="string"?d.group:void 0,v=typeof d.docsUrl=="string"?d.docsUrl:void 0,S=typeof d.cacheGroup=="string"?d.cacheGroup:void 0,x=d.annotations,k=x&&typeof x=="object"&&!Array.isArray(x)?x:void 0;(h||p||y||g||v||S||k)&&r.set(u.id,{label:h,description:p,tags:y,group:g,docsUrl:v,cacheGroup:S,annotations:k})}const i=e.program.plan.steps.map(u=>{const d=m6(u),h=wbe(e.program,u),p=Sbe(kbe(h)),y=u.targetFieldPath,g=xbe(y),v=g?[g]:[],S=y?r.get(y):void 0,x={nodeId:u.id,kind:d,reads:p,writes:d==="check"?[]:v,meta:S};return d!=="check"&&y&&!g?{...x,writesUnknown:!0}:x}),o=e.program.graph.edges.map(u=>({edgeId:u.id,from:u.from,to:u.to,kind:u.kind})),a={version:n,moduleId:t,nodes:i,edges:o},c=`stir:${n}:${ip(_c(a))}`;return{...a,digest:c}},gj=new Map,Ebe=new Map,Tbe=8,yj=(e,t)=>{if(!Sn())return;const r=_be({program:t,moduleId:e,version:"009"}).digest;let i=gj.get(e);if(i||(i=new Map,gj.set(e,i)),i.set(r,t),Ebe.set(e,r),i.size>Tbe){const o=i.keys().next().value;o&&i.delete(o)}},g6=Symbol.for("@logixjs/core/runtimeInternals"),y6=Symbol.for("@logixjs/core/boundInternals"),Cbe=Symbol.for("@logixjs/core/moduleTraitsProgram"),wA=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},Ibe=(e,t)=>{wA(e,g6,t)},Mbe=(e,t)=>{wA(e,y6,t)},bj=(e,t)=>{wA(e,Cbe,t)},G1=(e,t)=>{const n=typeof e=="string"&&e.length>0?e:"unknown",r=typeof t=="string"&&t.length>0?t:"unknown";return`moduleId=${n}, instanceId=${r}`},kA=e=>{const t=e,n=e[g6];if(!n){const i=Sn()?["[MissingRuntimeInternals] Runtime internals not installed on ModuleRuntime instance.",`scope: ${G1(t.moduleId,t.instanceId)}`,"fix:","- Ensure ModuleRuntime.make calls internalHooks.installInternalHooks (020 foundation).","- If you created a mock runtime for tests, attach internals or avoid calling internal-only APIs."].join(`
38
+ `):"Runtime internals not installed";throw new Error(i)}const r=t.instanceId;if(typeof r=="string"&&r.length>0&&r!==n.instanceId)throw new Error(Sn()?["[InconsistentRuntimeInternals] Runtime internals instanceId mismatch.",`runtime: ${G1(t.moduleId,r)}`,`internals: ${G1(n.moduleId,n.instanceId)}`].join(`
39
+ `):"Runtime internals mismatch");return n},ld=e=>{const t=e[y6];if(!t){const n=Sn()?["[MissingBoundInternals] Bound internals not installed on Bound API instance.","fix:","- Ensure BoundApiRuntime attaches internals (020 foundation).","- If you created a mock bound for tests, attach internals or avoid calling internal-only APIs."].join(`
40
+ `):"Bound internals not installed";throw new Error(n)}return t},Hy={currentDebugSinks:ro,currentRuntimeLabel:kc,currentDiagnosticsLevel:Ei},b6=e=>jy(Ei,()=>e),Rbe=e=>zye(e),cd=nbe,wi=it,Abe=e=>e&&e!=="auto"?e:d6()==="production"?"prod":"dev",vj=e=>{const t=Abe(e?.mode),n=e?.diagnosticsLevel,r=(()=>{switch(t){case"off":return Hye;case"prod":return Kye;case"dev":case"auto":return e?.devConsole==="diagnostic"?Xye:Yye}})();return n?ol(r,b6(n)):r},Obe=e=>jy(ro,t=>[...t,...e]);function Dbe(e,t){const r=(h=>typeof h=="object"&&h!==null&&"_op_layer"in h)(e),i=r?e:fc,o=r?t:e;tbe(o);const a=Obe([obe]),c=sbe([ibe]),u=b6(o?.diagnosticsLevel??"light"),d=o?.traitConvergeDiagnosticsSampling?Rbe(o.traitConvergeDiagnosticsSampling):fc;return Ufe(ol(a,u,d,c),i)}const Pbe=e=>jy(Hy.currentRuntimeLabel,()=>e),Zm=e=>typeof e=="function"&&e._kind==="ActionToken"&&typeof e.tag=="string"&&Pg(e.schema),Nbe=(e,t,n)=>{const r=((...i)=>({_tag:e,payload:i[0]}));return r._kind="ActionToken",r.tag=e,r.schema=t,r},v6=e=>{const t={};for(const[n,r]of Object.entries(e)){if(Pg(r)){t[n]=Nbe(n,r);continue}if(Zm(r)){if(r.tag!==n)throw new Error(`[Logix.Action] actionTag MUST equal key: key="${n}", token.tag="${r.tag}"`);t[n]=r;continue}throw new Error(`[Logix.Action] invalid action def for key "${n}"`)}return t},Sj=ds("@logixjs/LifecycleManager"),Iv=(e,t)=>t.pipe(ko({onSuccess:()=>he,onFailure:n=>dc(`[${e}] failed: ${Lc(n)}`)})),bf=(e,t)=>`${e}:${t}`,Lbe=e=>ae(function*(){const t={maxEventsPerInstance:20,maxEventBytes:4096},n=yield*Kn({identity:e,status:"creating"}),r=[],i=[],o=[],a=[],c=[],u=[],d=[],h=Ui(n),p=(B,$,V)=>it({type:"lifecycle:phase",moduleId:e.moduleId,instanceId:e.instanceId,phase:B,name:$,payload:V}),y=(B,$)=>is(n,V=>({...V,identity:{...V.identity,...$?.runtimeLabel?{runtimeLabel:$.runtimeLabel}:null},status:B,...$?.initOutcome!==void 0?{initOutcome:$.initOutcome}:null,...$?.initProgress!==void 0?{initProgress:$.initProgress}:null})),g=(B,$)=>{const V=r.length;r.push({taskId:bf("initRequired",V),kind:"initRequired",order:V,name:$?.name,effect:B})},v=(B,$)=>{const V=i.length;i.push({taskId:bf("start",V),kind:"start",order:V,name:$?.name,fatalOnFailure:$?.fatalOnFailure,effect:B})},S=(B,$)=>{const V=o.length;o.push({taskId:bf("destroy",V),kind:"destroy",order:V,name:$?.name,effect:B})},x=B=>{d.push(B)},k=(B,$)=>{const V=a.length;a.push({taskId:bf("platformSuspend",V),kind:"platformSuspend",order:V,name:$?.name,effect:B})},_=(B,$)=>{const V=c.length;c.push({taskId:bf("platformResume",V),kind:"platformResume",order:V,name:$?.name,effect:B})},E=(B,$)=>{const V=u.length;u.push({taskId:bf("platformReset",V),kind:"platformReset",order:V,name:$?.name,effect:B})},M=(B,$)=>kh(B)?he:it({type:"lifecycle:error",moduleId:$.moduleId,instanceId:$.instanceId,cause:B,phase:$.phase,hook:$.hook,taskId:$.taskId,txnSeq:$.txnSeq,opSeq:$.opSeq,origin:$.origin}).pipe(rt(sn(d,V=>V(B,$).pipe(zt(j=>dc(`[lifecycle.onError] failed: ${Lc(j)}`))),{discard:!0}))),D=ae(function*(){const B=r.length;if(B===0){yield*y("ready",{initProgress:{total:0,completed:0},initOutcome:{status:"success"}});return}const $=Date.now();yield*p("init","initRequired:start",{total:B}),yield*y("initializing",{initProgress:{total:B,completed:0,current:0,startedAt:$}});let V=0;for(let j=0;j<r.length;j++){yield*y("initializing",{initProgress:{total:B,completed:V,current:j,startedAt:$}});const K=r[j],G=yield*en(K.effect);if(G._tag==="Success"){V+=1,yield*y("initializing",{initProgress:{total:B,completed:V,current:j+1,startedAt:$}});continue}const J=Zs(G.cause);return yield*M(G.cause,{phase:"init",hook:"initRequired",moduleId:e.moduleId,instanceId:e.instanceId,taskId:K.taskId,origin:"initRequired"}),yield*y("failed",{initProgress:{total:B,completed:V,current:j,startedAt:$},initOutcome:{status:"failure",error:J.errorSummary}}),yield*gr(G.cause)}yield*p("init","initRequired:success",{total:B}),yield*y("ready",{initProgress:{total:B,completed:V,current:B,startedAt:$},initOutcome:{status:"success"}})}),T=p("run","start:schedule",{total:i.length}).pipe(rt(sn(i,B=>Vn(B.effect.pipe(zt($=>M($,{phase:"run",hook:"start",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"start"})))).pipe(fn),{discard:!0,concurrency:"unbounded"}))),C=ae(function*(){yield*p("destroy","destroy:start",{total:o.length}),yield*y("terminating");for(let B=o.length-1;B>=0;B--){const $=o[B];yield*Iv("lifecycle.onDestroy",$.effect.pipe(zt(V=>M(V,{phase:"destroy",hook:"destroy",moduleId:e.moduleId,instanceId:e.instanceId,taskId:$.taskId,origin:"destroy"}))))}yield*y("terminated"),yield*p("destroy","destroy:done",{total:o.length})}),O=ae(function*(){if(a.length!==0){yield*p("platform","signal:suspend",{total:a.length});for(const B of a)yield*Iv("lifecycle.onSuspend",B.effect.pipe(zt($=>M($,{phase:"platform",hook:"suspend",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"platform.suspend"}))))}}),q=ae(function*(){if(c.length!==0){yield*p("platform","signal:resume",{total:c.length});for(const B of c)yield*Iv("lifecycle.onResume",B.effect.pipe(zt($=>M($,{phase:"platform",hook:"resume",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"platform.resume"}))))}}),I=ae(function*(){if(u.length!==0){yield*p("platform","signal:reset",{total:u.length});for(const B of u)yield*Iv("lifecycle.onReset",B.effect.pipe(zt($=>M($,{phase:"platform",hook:"reset",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"platform.reset"}))))}}),L=Ze(()=>({initRequired:r.map(({effect:B,...$})=>$),start:i.map(({effect:B,...$})=>$),destroy:o.map(({effect:B,...$})=>$),platformSuspend:a.map(({effect:B,...$})=>$),platformResume:c.map(({effect:B,...$})=>$),platformReset:u.map(({effect:B,...$})=>$)})),P=Ze(()=>d.length>0);return{identity:e,budgets:t,registerPlatformSuspend:k,registerPlatformResume:_,registerPlatformReset:E,registerInitRequired:g,registerStart:v,registerDestroy:S,registerOnError:x,getStatus:h,setStatus:y,notifyError:M,runPlatformSuspend:O,runPlatformResume:q,runPlatformReset:I,runInitRequired:D,runStart:T,runDestroy:C,hasOnErrorHandlers:P,getTaskSnapshot:L}}),$be=()=>{const e=globalThis.performance;return e&&typeof e.now=="function"?e.now():Date.now()},jbe=e=>{const t=e.instrumentation??"full",n=e.captureSnapshots??t==="full",r={txnId:"",txnSeq:0,origin:{kind:"unknown"},startedAt:0,baseState:void 0,draft:void 0,initialStateSnapshot:void 0,patches:[],patchCount:0,patchesTruncated:!1,dirtyPathIds:new Set,dirtyAllReason:void 0},i={config:{instrumentation:t,captureSnapshots:n,now:e.now??$be,moduleId:e.moduleId,instanceId:e.instanceId,getFieldPathIdRegistry:e.getFieldPathIdRegistry},current:void 0,nextTxnSeq:0,scratch:r,recordPatch:()=>{}},o=(u,d,h,p,y,g)=>{const v=i.current;v&&(v.patchCount+=1,xj(v,u,d))},a=256,c=(u,d,h,p,y,g)=>{const v=i.current;if(!v)return;v.patchCount+=1;const S=v.patchCount-1,x=xj(v,u,d);if(v.patchesTruncated||v.patches.length>=a){v.patchesTruncated=!0;return}v.patches.push({opSeq:S,...x!=null?{pathId:x}:null,...h!==void 0?{from:h}:null,...p!==void 0?{to:p}:null,reason:gbe(d),...y?{traitNodeId:y}:null,...typeof g=="number"&&Number.isFinite(g)&&g>=0?{stepId:Math.floor(g)}:null})};return i.recordPatch=t==="full"?c:o,i},Fbe=(e,t,n)=>{const{config:r}=e,i=r.now,o=i();e.nextTxnSeq+=1;const a=e.nextTxnSeq,u=`${r.instanceId??"unknown"}::t${a}`,d=r.captureSnapshots?n:void 0,h=e.scratch;h.txnId=u,h.txnSeq=a,h.origin=t,h.startedAt=o,h.baseState=n,h.draft=n,h.initialStateSnapshot=d,h.patches.length=0,h.patchCount=0,h.patchesTruncated=!1,h.fieldPathIdRegistry=e.config.getFieldPathIdRegistry?.(),h.dirtyPathIds.clear(),h.dirtyAllReason=void 0,e.current=h},xj=(e,t,n)=>{if(e.dirtyAllReason)return;if(t===void 0){e.dirtyAllReason="customMutation";return}if(t==="*"){e.dirtyAllReason="unknownWrite";return}const r=e.fieldPathIdRegistry;if(!r){e.dirtyAllReason=n==="reducer"?"customMutation":"fallbackPolicy";return}let i;if(typeof t=="number"){if(!Number.isFinite(t)){e.dirtyAllReason="nonTrackablePatch";return}const o=Math.floor(t);if(o<0){e.dirtyAllReason="nonTrackablePatch";return}if(!r.fieldPaths[o]){e.dirtyAllReason="fallbackPolicy";return}i=o}else if(typeof t=="string"){const o=r.pathStringToId?.get(t);if(o==null){e.dirtyAllReason="fallbackPolicy";return}i=o}else{const o=Fi(t);if(!o){e.dirtyAllReason="nonTrackablePatch";return}const a=R0(r,o);if(a==null){e.dirtyAllReason="fallbackPolicy";return}i=a}return e.dirtyPathIds.add(i),i},Za=(e,t)=>{const n=e.current;n&&(n.draft=t)},wj=(e,t,n,r,i,o,a)=>{e.recordPatch(t,n,r,i,o,a)},zbe=(e,t)=>ae(function*(){const n=e.current;if(!n)return;const{config:r}=e,i=r.now,o=n.draft;if(Object.is(o,n.baseState)){e.current=void 0;return}yield*Aye(t,o);const a=i(),c=Math.max(0,a-n.startedAt),u=n.fieldPathIdRegistry,d=u==null?{dirtyAll:!0,reason:n.dirtyAllReason??"fallbackPolicy",rootIds:[],rootCount:0,keySize:0,keyHash:0}:p6({dirtyPaths:n.dirtyPathIds,registry:u,dirtyAllReason:n.dirtyAllReason}),h={txnId:n.txnId,txnSeq:n.txnSeq,origin:n.origin,startedAt:n.startedAt,endedAt:a,durationMs:c,dirtySet:d,patchCount:n.patchCount,patchesTruncated:n.patchesTruncated,...n.patchesTruncated?{patchesTruncatedReason:"max_patches"}:null,initialStateSnapshot:n.initialStateSnapshot,finalStateSnapshot:r.captureSnapshots?o:void 0,patches:e.config.instrumentation==="full"?n.patches.slice():[],moduleId:r.moduleId,instanceId:r.instanceId};return e.current=void 0,h}),Bbe=e=>{e.current=void 0};class Ube extends tn("@logixjs/core/RuntimeServicesRuntimeConfig")(){}const qbe=Ube;class Vbe extends tn("@logixjs/core/RuntimeServicesProviderOverrides")(){}const Hbe=Vbe;class Kbe extends tn("@logixjs/core/RuntimeServicesInstanceOverrides")(){}const Wbe=Kbe;class Gbe extends tn("@logixjs/core/FullCutoverGateMode")(){}const Ybe=Gbe,kj=["builtin","runtime_default","runtime_module","provider","instance"],Qbe=(e,t)=>{const n=kj.indexOf(e),r=kj.indexOf(t);return n>=r?e:t},Xbe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Jbe=e=>{if(!Xbe(e))return;const t=e.implId,n=e.notes;return{implId:typeof t=="string"&&t.length>0?t:void 0,notes:typeof n=="string"&&n.length>0?n:void 0}},Zbe=e=>ae(function*(){const t=yield*ft(qbe),n=yield*ft(Hbe),r=yield*ft(Wbe),i=Pe(t)?t.value:void 0,o=Pe(n)?n.value:void 0,a=Pe(r)?r.value:void 0,c=e.moduleId,u=c&&i?.servicesByModuleId?i.servicesByModuleId[c]:void 0,d=c&&o?.servicesByModuleId?o.servicesByModuleId[c]:void 0;return{runtimeDefault:i?.services,runtimeModule:u,provider:o?.services,providerModule:d,instance:a}});class eve extends tn("@logixjs/core/RuntimeServicesRegistry")(){}const tve=eve,Mv=(e,t,n)=>{const r=t[0];if(!r)throw new Error(`[Logix] RuntimeKernel registry missing builtin impl for: ${e}`);let i;const o=(y,g)=>{const v=g?Jbe(g[e]):void 0;!v||!v.implId||(i={scope:y,override:v})};if(o("runtime_default",n.runtimeDefault),o("runtime_module",n.runtimeModule),o("provider",n.provider),o("provider",n.providerModule),o("instance",n.instance),!i)return{impl:r,binding:{serviceId:e,implId:r.implId,implVersion:r.implVersion,scope:"builtin",overridden:!1,notes:r.notes},overridesApplied:[]};const a=i.override.implId,c=t.find(y=>y.implId===a),u=c??r,d=c==null,h=d?`Unknown implId "${a}", falling back to builtin "${r.implId}"`:void 0,p=[i.override.notes,u.notes,h].filter(y=>typeof y=="string"&&y.length>0).join("; ");return{impl:u,binding:{serviceId:e,implId:u.implId,implVersion:u.implVersion,scope:i.scope,overridden:!0,notes:p.length>0?p:void 0},overridesApplied:[d?`${i.scope}:${e}=${a} (fallback=${r.implId})`:`${i.scope}:${e}=${a}`]}},nve=e=>{let t="builtin";for(const n of e.bindings)t=Qbe(t,n.scope);return{moduleId:e.moduleId,instanceId:e.instanceId,scope:t,bindings:e.bindings,overridesApplied:e.overridesApplied}},rve=Symbol.for("@logixjs/core/runtimeServicesEvidence"),ive=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},ove=(e,t)=>{ive(e,rve,t)},sve={requiredServiceIds:["txnQueue","operationRunner","transaction","dispatch"]},ave=e=>e==="core"?"builtin":e,lve=e=>{const t=new Set;for(const n of e){if(!n.includes("(fallback="))continue;const r=n.indexOf(":");if(r<0)continue;const i=n.indexOf("=",r+1);if(i<0)continue;const o=n.slice(r+1,i);o.length>0&&t.add(o)}return Array.from(t).sort((n,r)=>n.localeCompare(r))},cve=e=>{const t=new Map;for(const r of e.bindings)t.set(r.serviceId,r);const n=[];for(const r of e.requiredServiceIds){const o=t.get(r)?.implId;(!o||o!==e.expectedImplId)&&n.push(r)}return n},uve=e=>{const t=ave(e.requestedKernelId),n=e.coverageMatrix??sve,r=lve(e.runtimeServicesEvidence.overridesApplied),i=cve({expectedImplId:t,requiredServiceIds:n.requiredServiceIds,bindings:e.runtimeServicesEvidence.bindings}),o=i.length===0&&r.length===0,a=e.mode==="fullCutover"?o?"PASS":"FAIL":"PASS",c=e.runtimeServicesEvidence.moduleId,d={moduleId:typeof c=="string"&&c.length>0?c:"unknown",instanceId:e.runtimeServicesEvidence.instanceId,txnSeq:0},h=e.diagnosticsLevel??"off";return{version:"v1",mode:e.mode,requestedKernelId:e.requestedKernelId,verdict:a,fullyActivated:o,missingServiceIds:i,fallbackServiceIds:r,anchor:d,...h==="off"?{}:{details:{expectedImplId:t,bindings:e.runtimeServicesEvidence.bindings,overridesApplied:e.runtimeServicesEvidence.overridesApplied}}}},dve=e=>typeof e=="string"&&e.length>0&&/^[a-z0-9-]+$/.test(e),fve={kernelId:"core",packageName:"@logixjs/core"},hve=(e,t=fve)=>{if(typeof e!="object"||e===null||Array.isArray(e))return t;const n=e;return!dve(n.kernelId)||typeof n.packageName!="string"||n.packageName.length===0?t:{kernelId:n.kernelId,packageName:n.packageName,...typeof n.packageVersion=="string"&&n.packageVersion.length>0?{packageVersion:n.packageVersion}:{},...typeof n.buildId=="string"&&n.buildId.length>0?{buildId:n.buildId}:{},...Array.isArray(n.capabilities)&&n.capabilities.every(r=>typeof r=="string")?{capabilities:n.capabilities}:{}}};class pve extends tn("@logixjs/core/KernelImplementationRef")(){}const mve=pve,gve=()=>ae(function*(){const e=yield*ft(mve);return hve(Pe(e)?e.value:void 0)}),yve=Symbol.for("@logixjs/core/kernelImplementationRef"),bve=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},vve=(e,t)=>{bve(e,yve,t)};class Rv extends tn("@logixjs/core/RuntimeServiceBuiltins")(){}const Sve=e=>typeof e=="string"&&e.length>0?e:void 0,Lg=e=>typeof e=="number"&&Number.isInteger(e)&&e>0?e:void 0,rl=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,MS=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,$g=e=>typeof e=="boolean"?e:void 0;class xve extends tn("@logixjs/core/RunSession")(){}const pl=xve,Y1=Symbol.for("@logixjs/core/runSession/nextRunSeq");let _j=0;const wve=()=>{try{const e=globalThis,n=(typeof e[Y1]=="number"?e[Y1]:0)+1;return e[Y1]=n,n}catch{return _j+=1,_j}},kve=e=>`run-${e}.${wve()}`,_ve=()=>{const e=new Set,t=new Map;return{once:n=>e.has(n)?!1:(e.add(n),!0),nextSeq:(n,r)=>{const i=t.get(n)??new Map;t.has(n)||t.set(n,i);const a=(i.get(r)??0)+1;return i.set(r,a),a},clear:()=>{e.clear(),t.clear()}}},Eve=e=>{const t=e?.startedAt??Date.now();return{runId:e?.runId??kve(t),source:e?.source??{host:"unknown"},startedAt:t,local:e?.local??_ve()}},Tve=e=>ca(pl,Eve());class Cve extends tn("@logixjs/core/EvidenceCollector")(){}const Ive=Cve;let Ej=0;const Mve=()=>(Ej+=1,Ej),Rve=(e,t)=>e?`${e}::o${t}`:`o${t}`,jg=e=>({...e.id?{id:e.id,meta:e.meta}:(()=>{const t=e.meta??{},n=t.instanceId,r=typeof t.opSeq=="number"&&Number.isFinite(t.opSeq)?Math.floor(t.opSeq):Mve();return{id:Rve(n,r),meta:t.opSeq===r?t:{...t,opSeq:r}}})(),kind:e.kind,name:e.name,payload:e.payload,effect:e.effect}),Fg=(e,t)=>Fye(e,t),Ave=()=>ft(Vy).pipe(Qe(e=>Pe(e)?e.value.stack:[])),Ove=e=>{const{optionsModuleId:t,instanceId:n,txnContext:r}=e;return(o,a,c,u)=>ae(function*(){const d=yield*Ave(),h=r.current?.txnId,p=yield*ut(ad),y=yield*ut(kc),{linkId:g,...v}=c.meta??{},S={...v,moduleId:c.meta?.moduleId??t,instanceId:c.meta?.instanceId??n,runtimeLabel:c.meta?.runtimeLabel??y,txnSeq:c.meta?.txnSeq??r.current?.txnSeq,txnId:c.meta?.txnId??h},x=S;if(!(typeof x.opSeq=="number"&&Number.isFinite(x.opSeq))){const T=yield*ft(pl);if(Pe(T)){const C=x.instanceId??"global";x.opSeq=T.value.local.nextSeq("opSeq",C)}}const k=jg({kind:o,name:a,payload:c.payload,effect:u,meta:S}),_=p??k.id,E=k.meta?.linkId===_?k:{...k,meta:{...k.meta??{},linkId:_}},M=d.length?Fg(E,d):E.effect,D=typeof x.opSeq=="number"&&Number.isFinite(x.opSeq)?Math.floor(x.opSeq):void 0;return yield*lr(ad,_)(lr(o6,D)(M))})},Tj=(e,t,n)=>Object.assign(new Error(e==="ReducerDuplicateError"?`[ModuleRuntime] Duplicate primary reducer for tag "${t}". Each action tag must have at most one primary reducer.`:`[ModuleRuntime] Late primary reducer registration for tag "${t}". Reducers must be registered before the first dispatch of this tag.`),{_tag:e,tag:t,moduleId:n}),Cj=(e,t)=>Ze(()=>{const n=As(_h(e));let r,i;for(const c of n){if(!c||typeof c!="object")continue;const u=c;u._tag==="ReducerDuplicateError"?r=u:u._tag==="ReducerLateRegistrationError"&&(i=u)}const o=[];if(r&&o.push(it({type:"diagnostic",moduleId:r.moduleId??t,code:"reducer::duplicate",severity:"error",message:`Primary reducer for tag "${r.tag}" is already registered and cannot be redefined.`,hint:"Ensure each Action tag defines a single primary reducer. If it is defined in both Module.reducers and $.reducer, keep the Module.reducers version or merge into one definition.",actionTag:r.tag})),i&&o.push(it({type:"diagnostic",moduleId:i.moduleId??t,code:"reducer::late_registration",severity:"error",message:`Primary reducer for tag "${i.tag}" was registered after actions with this tag had already been dispatched.`,hint:'Move this reducer to Module.make({ reducers }), or ensure $.reducer("tag", ...) runs before the first dispatch.',actionTag:i.tag})),o.length===0)return he;let a=he;for(const c of o)a=a.pipe(rt(c));return a}).pipe(Cs),Dve=e=>{const{optionsModuleId:t,instanceId:n,declaredActionTags:r,initialReducers:i,txnContext:o,readState:a,setStateInternal:c,recordStatePatch:u,actionHub:d,actionCommitHub:h,diagnostics:p,enqueueTransaction:y,resolveConcurrencyPolicy:g,runOperation:v,runWithStateTransaction:S,isDevEnv:x}=e,k=P=>{const B=P?._tag;if(typeof B=="string"&&B.length>0)return B;const $=P?.type;if(typeof $=="string"&&$.length>0)return $;if(B!=null)return String(B);if($!=null)return String($)},_=new Map;if(i)for(const[P,B]of Object.entries(i))_.set(P,B);const E=new Set,M=(P,B)=>{if(_.has(P))throw Tj("ReducerDuplicateError",P,t);if(E.has(P))throw Tj("ReducerLateRegistrationError",P,t);_.set(P,B)},D=P=>{const B=k(P);if(B==null||_.size===0)return he;const $=B.length>0?B:"unknown";E.add($);const V=_.get($);return V?a.pipe(ze(j=>ae(function*(){const K=[],J=V(j,P,F=>{if(typeof F=="string"){F.length>0&&K.push(F);return}if(typeof F=="number"){Number.isFinite(F)&&K.push(Math.floor(F));return}F.length>0&&K.push(F)});if(!Object.is(J,j)){if(o.current){if(K.length>0){Za(o,J);for(const F of K)u(F,"reducer");return}Za(o,J),u("*","reducer",void 0,J),x()&&(yield*it({type:"diagnostic",moduleId:t,instanceId:n,txnSeq:o.current?.txnSeq,txnId:o.current?.txnId,trigger:o.current?.origin,code:"state_transaction::dirty_all_fallback",severity:"warning",message:"Reducer writeback did not provide field-level dirty-set evidence; falling back to dirtyAll scheduling.",hint:"Prefer Logix.Module.Reducer.mutate(...) or $.state.mutate(...) inside the transaction to produce field-level patchPaths.",kind:"dirty_all_fallback:reducer"}));return}yield*c(J,"*","reducer",void 0,J)}}))):he},T=(P,B)=>({kind:"action",name:P,details:{_tag:k(B)??"unknown",path:typeof B?.payload?.path=="string"?B.payload.path:void 0,op:(()=>{const $=k(B)??"";return $.includes("Remove")||$.includes("remove")?"remove":$.includes("Append")||$.includes("Prepend")||$.includes("Insert")||$.includes("Swap")||$.includes("Move")||$.includes("append")||$.includes("prepend")||$.includes("insert")||$.includes("swap")||$.includes("move")?"insert":$.includes("Unset")||$.includes("unset")?"unset":"set"})()}}),C=P=>ae(function*(){yield*D(P);const B=k(P),$=typeof B=="string"&&B.length>0?B:"unknown",V=r?!r.has($):!1;yield*it({type:"action:dispatch",moduleId:t,action:P,actionTag:$,...V?{unknownAction:!0}:{},instanceId:n,txnSeq:o.current?.txnSeq,txnId:o.current?.txnId});const j=o.current;if(j){const K={txnSeq:j.txnSeq,txnId:j.txnId,commitMode:j.commitMode??"normal",priority:j.priority??"normal",originKind:j.origin.kind,originName:j.origin.name};yield*sl(h,{value:P,meta:K})}}),O=P=>v("action","action:dispatch",{payload:P,meta:{moduleId:t,instanceId:n}},S(T("dispatch",P),()=>C(P))).pipe(fn),q=P=>v("action","action:dispatchLowPriority",{payload:P,meta:{moduleId:t,instanceId:n}},S(T("dispatchLowPriority",P),()=>ae(function*(){o.current&&(o.current.commitMode="lowPriority",o.current.priority="low"),yield*C(P)}))).pipe(fn),I=P=>P.length===0?he:v("action","action:dispatchBatch",{payload:P,meta:{moduleId:t,instanceId:n}},S({kind:"action",name:"dispatchBatch",details:{count:P.length}},()=>ae(function*(){o.current&&(o.current.commitMode="batch",o.current.priority="normal");for(const B of P)yield*C(B)}))).pipe(fn),L=(P,B)=>ae(function*(){const $=Date.now();yield*B;const V=Date.now()-$;if(V<=0)return;const j=yield*g();yield*p.emitPressureIfNeeded({policy:j,trigger:{kind:"actionHub",name:P},saturatedDurationMs:V})});return{registerReducer:M,dispatch:P=>y(O(P)).pipe(rt(L("publish",sl(d,P)))),dispatchBatch:P=>y(I(P)).pipe(rt(L("publishAll",Qhe(d,P)))),dispatchLowPriority:P=>y(q(P)).pipe(rt(L("publish",sl(d,P))))}},Pve=e=>{const t=e?._tag;if(typeof t=="string"&&t.length>0)return t;const n=e?.type;if(typeof n=="string"&&n.length>0)return n;if(t!=null)return String(t);if(n!=null)return String(n)},Nve=(e,t)=>Pve(e)===t,Lve=(e,t)=>{const n=e.get(t);if(n)return n;const r={nextHandlerSeq:0,handlerIds:new WeakMap};return e.set(t,r),r},$ve=(e,t)=>{const n=e.handlerIds.get(t);if(n)return n;e.nextHandlerSeq+=1;const r=`h${e.nextHandlerSeq}`;return e.handlerIds.set(t,r),r},jve=e=>{const{moduleId:t,instanceId:n,actions$:r}=e,i=new Map,o=new Map,a=d=>{const h=o.get(d);if(h)return h;const p={handlers:new Map,watcherStarted:!1};return o.set(d,p),p},c=(d,h)=>{if(h.watcherStarted)return he;h.watcherStarted=!0;const p=ba(r.pipe(Es(y=>Nve(y,d))),y=>ae(function*(){const g=Array.from(h.handlers.values());if(g.length===0)return;const v=y?.payload;yield*sn(g,S=>Vn(ae(function*(){const x=yield*en(S.handler(v));if(x._tag==="Success")return;const{errorSummary:k,downgrade:_}=Zs(x.cause),E=_?` (downgrade=${_})`:"";yield*it({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::handler_failure",severity:"error",message:`Effect handler failed for actionTag="${S.actionTag}" sourceKey="${S.sourceKey}".${E}`,hint:`${k.name?`${k.name}: `:""}${k.message}`,actionTag:S.actionTag,kind:"effect_handler_failure",trigger:{kind:"effect",name:"handler",details:{actionTag:S.actionTag,sourceKey:S.sourceKey,logicUnitId:S.logicUnitId}}})})),{discard:!0})})).pipe(zt(y=>it({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::watcher_crashed",severity:"error",message:`Effect watcher crashed for actionTag="${d}".`,hint:Zs(y).errorSummary.message,actionTag:d,kind:"effect_watcher_crashed"})));return Vn(p).pipe(fn)};return{registerEffect:d=>ae(function*(){const h=d.actionTag,p=d.handler,y=d.logicUnit?.logicUnitId??"unknown",g=d.logicUnit?.logicUnitLabel??`logicUnit:${y}`,v=d.logicUnit?.path,S=Lve(i,y),x=$ve(S,p),k=`${y}::${x}`,_=a(h);return _.handlers.has(k)?(yield*it({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::duplicate_registration",severity:"warning",message:`Duplicate effect registration ignored for actionTag="${h}" sourceKey="${k}".`,hint:"The runtime de-duplicates effect handlers by (actionTag, sourceKey). If you see this unexpectedly, check repeated setup registration or accidental double-mounting.",actionTag:h,kind:"effect_duplicate_registration",trigger:{kind:"effect",name:"register",details:{actionTag:h,sourceKey:k,phase:d.phase,logicUnitId:y,logicUnitLabel:g,logicUnitPath:v}}}),{sourceKey:k,duplicate:!0}):(_.handlers.set(k,{actionTag:h,sourceKey:k,handler:p,phase:d.phase,logicUnitId:y,logicUnitLabel:g,logicUnitPath:v}),d.phase==="run"&&(yield*it({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::dynamic_registration",severity:"warning",message:`Effect registered in run phase for actionTag="${h}" sourceKey="${k}".`,hint:"Run-phase registration only affects future actions; prefer registering effects during setup for deterministic behavior.",actionTag:h,kind:"effect_dynamic_registration",trigger:{kind:"effect",name:"register:run",details:{actionTag:h,sourceKey:k,logicUnitId:y,logicUnitLabel:g,logicUnitPath:v}}})),yield*c(h,_),{sourceKey:k,duplicate:!1})})}},os=Oo(!1),CC=Oo(!1),Ij=(e,t)=>typeof e=="function"?e(t):e,Fve=e=>({pending:{kind:"task:pending",name:e},success:{kind:"service-callback",name:"task:success"},failure:{kind:"service-callback",name:"task:failure"}}),_A=e=>ae(function*(){return(yield*ut(os))?(Sn()&&(yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:e.code,severity:e.severity,message:e.message,hint:e.hint,actionTag:e.actionTag,kind:e.kind})),!0):!1}),Mj=e=>e.resolveConcurrencyPolicy?e.resolveConcurrencyPolicy().pipe(Qe(t=>t.concurrencyLimit)):on(16),Av=(e,t,n,r)=>ae(function*(){if(yield*_A({moduleId:t.moduleId,instanceId:t.instanceId,code:"logic::invalid_usage",severity:"error",message:"run*Task is not allowed inside a synchronous StateTransaction body (it may deadlock the txnQueue).",hint:"Call run*Task from the run section of a watcher (e.g. $.onAction/$.onState/$.on); do not call it directly inside a reducer / trait.run / synchronous transaction body. For long-lived flows, use a multi-entry pattern (pending → IO → writeback).",kind:"run_task_in_transaction"}))return;const o=Fve(n.triggerName),a={pending:n.origin?.pending??o.pending,success:n.origin?.success??o.success,failure:n.origin?.failure??o.failure},c=n.pending;c&&(yield*sc(t.runWithStateTransaction(a.pending,()=>fn(Ij(c,e)))));const u=Ij(n.effect,e),d=yield*en(u);if(r&&!(yield*r))return;if(d._tag==="Success"){const y=n.success;y&&(yield*t.runWithStateTransaction(a.success,()=>fn(y(d.value,e))));return}const h=d.cause;if(kh(h))return;const p=n.failure;p&&(yield*t.runWithStateTransaction(a.failure,()=>fn(p(h,e))))}).pipe(zt(i=>it({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"task_runner::unhandled_failure",severity:"error",message:"TaskRunner encountered an unhandled failure (pending/IO/writeback).",hint:"Add a failure writeback for this task or handle errors explicitly upstream; avoid fire-and-forget swallowing errors.",actionTag:n.triggerName,kind:"task_runner_unhandled_failure",trigger:{kind:"task",name:n.triggerName}}).pipe(rt(dc("TaskRunner error",i))))),Ov=(e,t,n,r)=>t==="latest"?ae(function*(){const i=yield*Kn(0),o=yield*Kn(void 0);return yield*ba(e,c=>ae(function*(){const u=yield*Cse(i,y=>y+1),d=yield*Ui(o);d&&(yield*x0(d));const h=Ui(i).pipe(Qe(y=>y===u)),p=yield*aH(Av(c,n,r,h));yield*id(o,p)}))}):t==="exhaust"?ae(function*(){const i=yield*Mj(n),o=yield*Kn(!1),a=c=>ae(function*(){if(yield*mr(o,d=>d?[!1,d]:[!0,!0]))try{yield*Av(c,n,r)}finally{yield*id(o,!1)}});return yield*Qm(e.pipe(Ng(a,{concurrency:i})))}):t==="parallel"?ae(function*(){const i=yield*Mj(n);return yield*Qm(e.pipe(Ng(o=>Av(o,n,r),{concurrency:i})))}):ba(e,i=>Av(i,n,r)),Rj=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0};class Aj{capacity;buckets=new Map;head;tail;size_=0;hits_=0;misses_=0;evicts_=0;disabled_=!1;disableReason_;constructor(t){const n=Math.floor(t);this.capacity=n>0?n:0}isDisabled(){return this.disabled_}disable(t){this.disabled_||this.disableInternal(t)}get(t,n){if(this.capacity<=0||this.disabled_)return;const r=this.buckets.get(t);if(!r){this.misses_+=1;return}for(const i of r)if(Rj(i.rootIds,n))return this.hits_+=1,this.touch(i),i.planStepIds;this.misses_+=1}set(t,n,r){if(this.capacity<=0||this.disabled_)return;const i=this.buckets.get(t)??[];for(const a of i)if(Rj(a.rootIds,n)){a.planStepIds=r,this.touch(a),this.buckets.has(t)||this.buckets.set(t,i);return}const o={hash:t,rootIds:n,planStepIds:r};for(i.push(o),this.buckets.set(t,i),this.attachFront(o),this.size_+=1;this.size_>this.capacity;)this.evictOne();this.maybeTriggerLowHitRateProtection()}evidence(t){return{capacity:this.capacity,size:this.size_,hits:this.hits_,misses:this.misses_,evicts:this.evicts_,hit:t.hit,...typeof t.keySize=="number"?{keySize:t.keySize}:null,...t.hit?null:t.missReason?{missReason:t.missReason}:null,...this.disabled_?{disabled:!0,disableReason:this.disableReason_??"unknown"}:null}}maybeTriggerLowHitRateProtection(){if(this.disabled_||this.capacity<=0)return;const t=this.hits_+this.misses_;t<Math.max(64,this.capacity+1)||(t>0?this.hits_/t:1)>.01||this.disable("low_hit_rate")}disableInternal(t){this.disabled_=!0,this.disableReason_=t,this.clearEntries()}clearEntries(){this.buckets.clear(),this.head=void 0,this.tail=void 0,this.size_=0}attachFront(t){t.prev=void 0,t.next=this.head,this.head?this.head.prev=t:this.tail=t,this.head=t}detach(t){const n=t.prev,r=t.next;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,t.prev=void 0,t.next=void 0}touch(t){this.head!==t&&(this.detach(t),this.attachFront(t))}evictOne(){const t=this.tail;if(!t)return;this.detach(t);const n=this.buckets.get(t.hash);if(n){const r=n.indexOf(t);r>=0&&n.splice(r,1),n.length===0&&this.buckets.delete(t.hash)}this.size_=Math.max(0,this.size_-1),this.evicts_+=1}}class IC extends Error{constructor(t,n,r=[]){super(n),this.code=t,this.fields=r,this.name="StateTraitConfigError"}_tag="StateTraitConfigError"}const A0=e=>`converge_ir_v2:${ip(_c({writersKey:e.writersKey,depsKey:e.depsKey,fieldPathsKey:e.fieldPathsKey}))}`,zve=e=>({staticIrDigest:A0(e.ir),moduleId:e.moduleId,instanceId:e.instanceId,generation:e.ir.generation,fieldPaths:e.ir.fieldPaths,stepOutFieldPathIdByStepId:Array.from(e.ir.stepOutFieldPathIdByStepId),stepSchedulingByStepId:e.ir.stepSchedulingByStepId.slice(),topoOrder:e.ir.topoOrder.slice(),buildDurationMs:e.ir.buildDurationMs}),S6=(e,t)=>{let n=e;for(let r=0;r<t.length;r++){if(n==null)return;n=n[t[r]]}return n},Oj=e=>typeof e=="object"&&e!==null,Dj=e=>{if(Array.isArray(e))return e.slice();const t=Object.getPrototypeOf(e),n=t===null?Object.create(null):Object.create(t);return Object.assign(n,e)};class Bve{root;owned=new WeakSet;copies=new WeakMap;constructor(t){this.root=t}getRoot(){return this.root}getAt(t){return S6(this.root,t)}setAt(t,n,r){if(t.length===0)return;this.root=this.ensureOwnedRoot();let i=this.root;for(let o=0;o<t.length-1;o++){const a=t[o],c=i[a];if(!Oj(c)){const h={};this.owned.add(h),i[a]=h,i=h;continue}if(this.owned.has(c)){i=c;continue}const u=this.copies.get(c),d=u??Dj(c);u||this.copies.set(c,d),this.owned.add(d),i[a]=d,i=d}i[t[t.length-1]]=n}ensureOwnedRoot(){const t=this.root;if(!Oj(t))return this.root;if(this.owned.has(t))return this.root;const n=this.copies.get(t),r=n??Dj(t);return n||this.copies.set(t,r),this.owned.add(r),r}}class Pj{root;keys=[];prev=[];had=[];constructor(t){this.root=t}getRoot(){return this.root}getAt(t){return t.length===1?this.root[t[0]]:S6(this.root,t)}setAt(t,n,r){if(t.length!==1)throw new Error("[StateTrait.converge] ShallowInPlaceDraft only supports root-level writes");const i=t[0],o=this.root,a=Object.prototype.hasOwnProperty.call(o,i);this.keys.push(i),this.had.push(a),this.prev.push(a?o[i]:void 0),o[i]=n}rollback(){const t=this.root;for(let n=this.keys.length-1;n>=0;n--){const r=this.keys[n];this.had[n]?t[r]=this.prev[n]:delete t[r]}this.keys.length=0,this.prev.length=0,this.had.length=0}}const Nj=new Set,EA=e=>ft(pl).pipe(Qe(t=>Pe(t)?t.value.local.once(e):Nj.has(e)?!1:(Nj.add(e),!0))),Dv=(e,t=10)=>e.length===0?"":e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")}, …(+${e.length-t})`,Uve=e=>ae(function*(){const t=`${e.moduleId??"unknown"}::${e.instanceId??"unknown"}::${e.kind}::${e.fieldPath}`;(yield*EA(`deps_mismatch:${t}`))&&(yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"state_trait::deps_mismatch",severity:"warning",message:`[deps] ${e.kind} "${e.fieldPath}" declared=[${Dv(e.diff.declared)}] reads=[${Dv(e.diff.reads)}] missing=[${Dv(e.diff.missing)}] unused=[${Dv(e.diff.unused)}]`,hint:'deps is the single source of truth for dependencies: incremental scheduling / reverse closures / performance optimizations rely on deps only. Keep deps consistent with actual reads; if you really depend on the whole object, declare a coarser-grained dep (e.g. "profile") to cover sub-field reads.',kind:`deps_mismatch:${e.kind}`}))}),bu=(e,t,n=new Set)=>{if(t.length===0)return!0;let r=e;for(;;){if(aM(r)){if(n.has(r))return!0;n.add(r),r=r.f();continue}if(Hu(r)){r=r.from;continue}break}if(lM(r))return bu(r.to,t,n)||bu(r.from,t,n);if(cy(r))return r.types.some(o=>bu(o,t,n));if(iM(r)){const o=[];for(const a of r.elements)o.push(a.type);for(const a of r.rest)o.push(a.type);return o.length===0?!0:o.some(a=>bu(a,t,n))}if(oM(r)){const[o,...a]=t;for(const c of r.propertySignatures)if(String(c.name)===o)return bu(c.type,a,n);for(const c of r.indexSignatures){let u=c.parameter;for(;Hu(u);)u=u.from;const d=u?._tag;if(d==="StringKeyword"||d==="TemplateLiteral")return bu(c.type,a,n)}return!1}const i=r?._tag;return i==="AnyKeyword"||i==="UnknownKeyword"||i==="ObjectKeyword"||i==="Declaration"},qve=(e,t)=>{if(!t||t==="$root")return!0;const n=Fi(t);if(!n)return!1;const r=n[0]==="$root"?n.slice(1):n;return bu(e,r)},Vve=e=>{if(e.kind==="fieldPath")return`- ${e.entryKind} "${e.entryFieldPath}" fieldPath="${e.path}"`;if(e.kind==="dep"){const t=e.ruleName?` rule="${e.ruleName}"`:"";return`- ${e.entryKind} "${e.entryFieldPath}" deps="${e.path}"${t}`}return e.kind==="link_from"?`- link "${e.entryFieldPath}" from="${e.path}"`:e.kind==="check_writeback"?`- check "${e.entryFieldPath}" writeback="${e.path}"`:`- ${e.entryKind} "${e.entryFieldPath}" path="${e.path}"`},Hve=(e,t)=>ae(function*(){if(!Sn())return;const n=yield*ut(Ei);if(n==="off")return;const r=`${t.moduleId??"unknown"}::${t.instanceId}`;if(!(yield*EA(`schema_mismatch:${r}`)))return;const o=e.schemaPaths??[];if(o.length===0)return;const a=e.stateSchema.ast,c=[],u=new Set;for(const p of o){if(qve(a,p.path))continue;const y=`${p.kind}|${p.entryKind}|${p.entryFieldPath}|${p.ruleName??""}|${p.path}`;u.has(y)||(u.add(y),c.push(p))}if(c.length===0)return;const d=n==="light"?8:24,h=c.slice(0,d).map(Vve);c.length>d&&h.push(`- …(+${c.length-d})`),yield*it({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"state_trait::schema_mismatch",severity:"warning",message:`[schema] The following paths are not declared in stateSchema (total ${c.length}):
41
+ ${h.join(`
42
+ `)}`,hint:"StateTrait writeback will create missing objects/fields. Declare all fieldPath/deps/link.from and errors.* writeback paths in stateSchema, or fix typos in trait paths.",kind:"schema_mismatch"})}),Kve=Oo(!1);class Lj{size;words;touchedWords;touchedFlags;touchedCount=0;constructor(t,n){const r=Math.max(0,Math.floor(t));this.size=r;const i=Math.ceil(r/32);this.words=new Uint32Array(i),n?.clearStrategy==="touched-words"?(this.touchedWords=new Uint32Array(i),this.touchedFlags=new Uint8Array(i)):(this.touchedWords=void 0,this.touchedFlags=void 0)}clear(){if(!this.touchedWords){this.words.fill(0);return}for(let t=0;t<this.touchedCount;t++){const n=this.touchedWords[t];this.words[n]=0,this.touchedFlags[n]=0}this.touchedCount=0}has(t){if(!(t>=0&&t<this.size))return!1;const n=t/32|0,r=t&31;return(this.words[n]&1<<r)!==0}add(t){if(!(t>=0&&t<this.size))return;const n=t/32|0,i=1<<(t&31),o=this.words[n];(o&i)===0&&(this.words[n]=o|i,this.touchedWords&&this.touchedFlags[n]!==1&&(this.touchedFlags[n]=1,this.touchedWords[this.touchedCount]=n,this.touchedCount+=1))}}const x6=e=>{const t=e.generation,n=e.fieldPathIdRegistry,r=n.fieldPaths,i=r.length,o=new Int32Array(i+1);let a=0;for(let I=0;I<i;I++)o[I]=a,a+=r[I]?.length??0;o[i]=a;const c=new Int32Array(a);for(let I=0;I<i;I++){const L=r[I];if(!L)continue;let P=n.root,B=o[I];for(const $ of L){const V=P.children.get($);if(!V)throw new Error(`[StateTrait.converge] Failed to resolve prefix trie node for pathId=${String(I)} seg=${$}`);P=V;const j=P.id;if(typeof j!="number")throw new Error(`[StateTrait.converge] Missing FieldPathId for prefix of pathId=${String(I)} seg=${$}`);c[B]=j,B+=1}}const u=Int32Array.from(e.topoOrder),d=e.stepsById.length,h=new Uint8Array(d);for(let I=0;I<d;I++)h[I]=e.stepSchedulingByStepId[I]==="deferred"?1:0;const p=[],y=[];for(const I of u)h[I]===1?y.push(I):p.push(I);const g=Int32Array.from(p),v=Int32Array.from(y),S=new Array(d),x=new Int32Array(d),k=new Int32Array(d);k.fill(-1);for(let I=0;I<d;I++){const L=e.stepsById[I];if(L?S[I]=L.kind==="computed"?`computed:${L.fieldPath}`:L.kind==="link"?`link:${L.fieldPath}`:L.fieldPath:S[I]=String(I),x[I]=e.stepOutFieldPathIdByStepId[I],L?.kind==="link"){const P=e.stepDepsFieldPathIdsByStepId[I];P&&P.length>0&&(k[I]=P[0])}}const _=new Int32Array(d+1);let E=0;for(let I=0;I<d;I++){_[I]=E;const L=e.stepDepsFieldPathIdsByStepId[I];E+=L?.length??0}_[d]=E;const M=new Int32Array(E);for(let I=0;I<d;I++){const L=e.stepDepsFieldPathIdsByStepId[I];if(!L||L.length===0)continue;let P=_[I];for(let B=0;B<L.length;B++)M[P]=L[B],P+=1}let D=!0;for(let I=0;I<d;I++){const L=x[I],P=r[L];if(!P||P.length!==1){D=!1;break}}const T=new Int32Array(i);for(let I=0;I<d;I++){const L=x[I];{const $=o[L],V=o[L+1];for(let j=$;j<V;j++){const K=c[j];T[K]=T[K]+1|0}}const P=_[I],B=_[I+1];for(let $=P;$<B;$++){const V=M[$],j=o[V],K=o[V+1];for(let G=j;G<K;G++){const J=c[G];T[J]=T[J]+1|0}}}const C=new Int32Array(i+1);let O=0;for(let I=0;I<i;I++)C[I]=O,O+=T[I];C[i]=O;const q=new Int32Array(O);for(let I=0;I<i;I++)T[I]=C[I];for(let I=0;I<d;I++){const L=x[I];{const $=o[L],V=o[L+1];for(let j=$;j<V;j++){const K=c[j],G=T[K];q[G]=I,T[K]=G+1}}const P=_[I],B=_[I+1];for(let $=P;$<B;$++){const V=M[$],j=o[V],K=o[V+1];for(let G=j;G<K;G++){const J=c[G],F=T[J];q[F]=I,T[J]=F+1}}}return{generation:t,fieldPathsById:r,prefixFieldPathIdsByPathId:c,prefixOffsetsByPathId:o,triggerStepIdsByFieldPathId:q,triggerStepOffsetsByFieldPathId:C,topoOrderInt32:u,topoOrderImmediateInt32:g,topoOrderDeferredInt32:v,stepSchedulingByStepId:h,stepLabelByStepId:S,stepOutFieldPathIdByStepId:x,stepFromFieldPathIdByStepId:k,allOutPathsShallow:D,stepDepsFieldPathIds:M,stepDepsOffsetsByStepId:_,scratch:{dirtyPrefixBitSet:new Lj(i),reachableStepBitSet:new Lj(d),dirtyPrefixQueue:new Int32Array(i),planStepIds:new Int32Array(d)}}},$j=e=>!e||typeof e!="object"?!1:Array.isArray(e)?!0:!(e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Map||e instanceof Set||e instanceof WeakMap||e instanceof WeakSet),Q1=e=>e==="__proto__"||e==="prototype"||e==="constructor",Wve=e=>{const t=Array.from(e).filter(i=>typeof i=="string"&&i.length>0);t.sort();const n=(i,o)=>o!==i&&o.startsWith(i+"."),r=[];for(const i of t){let o=!1;for(const a of t)if(n(i,a)){o=!0;break}o||r.push(i)}return r.sort(),r},jj=(e,t)=>e===t||t.startsWith(e+"."),MC=(e,t)=>{const n=Array.from(new Set(e)).filter(a=>typeof a=="string"&&a.length>0);n.sort();const r=Array.from(new Set(t)).filter(a=>typeof a=="string"&&a.length>0);r.sort();const i=r.filter(a=>n.every(c=>!jj(c,a))),o=n.filter(a=>r.every(c=>!jj(a,c)));if(!(i.length===0&&o.length===0))return{reads:r,declared:n,missing:i,unused:o}},RC=(e,t)=>{if(!$j(t))return{value:e(t),reads:[]};const n=new Set,r=new WeakMap,i=new WeakMap,o=(h,p)=>$j(h)?c(h,p):h,a=h=>{if(h&&(typeof h=="object"||typeof h=="function")){const p=i.get(h);if(p)return p}return h},c=(h,p)=>{let y=r.get(h);y||(y=new Map,r.set(h,y));const g=y.get(p);if(g)return g;const v=x=>{x&&n.add(x)},S=new Proxy(h,{get:(x,k,_)=>{if(typeof k=="symbol")return Reflect.get(x,k,_);const E=String(k);if(Q1(E))return Reflect.get(x,k,_);const M=p?`${p}.${E}`:E;v(M);const D=Reflect.get(x,k,_);return o(D,M)},has:(x,k)=>{if(typeof k=="symbol")return Reflect.has(x,k);const _=String(k);if(!Q1(_)){const E=p?`${p}.${_}`:_;v(E)}return Reflect.has(x,k)},ownKeys:x=>(p&&v(p),Reflect.ownKeys(x)),getOwnPropertyDescriptor:(x,k)=>{if(typeof k=="symbol")return Reflect.getOwnPropertyDescriptor(x,k);const _=String(k);if(!Q1(_)){const E=p?`${p}.${_}`:_;v(E)}return Reflect.getOwnPropertyDescriptor(x,k)},set:()=>{throw new Error("[deps-trace] Attempted to mutate state during deps tracing (state is readonly in dev-mode diagnostics).")},defineProperty:()=>{throw new Error("[deps-trace] Attempted to define property on state during deps tracing (state is readonly in dev-mode diagnostics).")},deleteProperty:()=>{throw new Error("[deps-trace] Attempted to delete property on state during deps tracing (state is readonly in dev-mode diagnostics).")}});return y.set(p,S),i.set(S,h),S},u=c(t,"");return{value:a(e(u)),reads:Wve(n)}},Gve=()=>ft(Vy).pipe(Qe(e=>Pe(e)?e.value.stack:[])),w6=e=>e.kind==="computed"?"computed":e.kind==="link"?"link":void 0,Yve=e=>e.kind==="computed"?e.meta?.deps??[]:e.kind==="link"?[e.meta.from]:[],k6=(e,t,n)=>{if(e.kind==="computed"){const r=e.meta?.equals;return r?r(t,n):Object.is(t,n)}return Object.is(t,n)},Qve=(e,t,n,r,i)=>{const o=w6(i);if(!o)return!1;const a=o==="computed"?"trait-computed":"trait-link",c=o==="link"?i.meta.from:void 0,u=t.stepOutFieldPathIdByStepId[r],d=t.fieldPathsById[u],h=t.stepFromFieldPathIdByStepId[r],p=h>=0?t.fieldPathsById[h]:void 0,y=n.getRoot(),g=n.getAt(d);let v;if(o==="computed"){const x=i.meta.derive;v=x(y)}else{if(!p)throw new Error(`[StateTrait.converge] Missing link.from FieldPathId: from="${String(c)}"`);v=n.getAt(p)}return k6(i,g,v)?!1:(n.setAt(d,v,g),e.setDraft(n.getRoot()),e.recordPatch(u,a,g,v),!0)},X1=(e,t,n,r,i,o,a,c)=>{const u=e.moduleId,d=e.instanceId,h=i.fieldPath,p=w6(i);if(!p)return on(!1);const y=p==="computed"?"trait-computed":"trait-link",g=p==="computed"?"trait-computed":"trait-link",v=p==="computed"?"computed:update":"link:propagate",S=Yve(i),x=p==="link"?i.meta.from:void 0,k=t.stepOutFieldPathIdByStepId[r],_=t.fieldPathsById[k],E=t.stepFromFieldPathIdByStepId[r],M=E>=0?t.fieldPathsById[E]:void 0;return ae(function*(){const D=a==="off"?void 0:t.stepLabelByStepId[r]??String(r);let T=!1;if(p==="computed"&&o&&Sn()){const I=`${u??"unknown"}::${d??"unknown"}::computed::${h}`;T=yield*EA(`deps_trace:settled:${I}`)}const C=Ze(()=>{const I=n.getRoot(),L=n.getAt(_);let P,B;if(p==="computed"){const V=i.meta.derive;if(T){const j=RC(K=>V(K),I);P=j.value,B=MC(i.meta.deps??[],j.reads)}else P=V(I)}else{if(!M)throw new Error(`[StateTrait.converge] Missing link.from FieldPathId: from="${String(x)}"`);P=n.getAt(M)}return k6(i,L,P)?{changed:!1,depsDiff:B}:(n.setAt(_,P,L),e.setDraft(n.getRoot()),e.recordPatch(k,y,L,P,void 0,r),{changed:!0,depsDiff:B})}).pipe(ze(({changed:I,depsDiff:L})=>L&&p==="computed"?Uve({moduleId:u,instanceId:d,kind:"computed",fieldPath:h,diff:L}).pipe(pi(I)):on(I))),O={moduleId:u,instanceId:d,txnSeq:e.txnSeq,txnId:e.txnId,fieldPath:h,deps:S,...p==="link"?{from:x,to:h}:null,...D?{stepId:D}:null};if(!(typeof O.opSeq=="number"&&Number.isFinite(O.opSeq))){const I=yield*ft(pl);if(Pe(I)){const L=d??"global";O.opSeq=I.value.local.nextSeq("opSeq",L)}}const q=jg({kind:g,name:v,effect:C,meta:O});return c.length===0?yield*C:yield*Fg(q,c)})},pm=e=>{let t,n,r;for(const i of e){const o=i.durationMs;if(!t||o>t.durationMs){r=n,n=t,t=i;continue}if(!n||o>n.durationMs){r=n,n=i;continue}(!r||o>r.durationMs)&&(r=i)}return t?n?r?[t,n,r]:[t,n]:[t]:[]},Fj=e=>{if(typeof e!="number"||!Number.isFinite(e))return;const t=Math.floor(e);return t>0?t:void 0},zj=e=>{const{hotspots:t,next:n,topK:r}=e;if(r<=0)return;const i=(()=>{for(let o=0;o<t.length;o++)if(n.durationMs>t[o].durationMs)return o;return t.length})();i>=r||(t.splice(i,0,n),t.length>r&&(t.length=r))},Xve=(e,t)=>ae(function*(){yield*Hve(e,t);const n=t.now();let r,i=n;const o=t.getDraft(),a=t.requestedMode??"auto",c=[];let u=a==="dirty"?"dirty":"full";const d=e.convergeIr;if(!d)return{_tag:"Noop"};let h=e.convergeExecIr;if((!h||h.generation!==d.generation)&&(h=x6(d),e.convergeExecIr=h),d.configError)throw new IC(d.configError.code,d.configError.message,d.configError.fields);const p=d.stepsById??[],y=p.length;if(y===0)return{_tag:"Noop"};const g=yield*Gve(),v=yield*ut(Ei),S=yield*ut(ro),x=S.length>0&&!bA(S),k=x,_=x&&v!=="off",E=yield*ut(Kve);let M;if(v==="sampled"){const Ee=yield*ut(s6),De=Fj(Ee.sampleEveryN)??32,Re=Fj(Ee.topK)??3,_e=t.txnSeq,Tt=typeof _e=="number"&&Number.isFinite(_e)&&_e>0?(Math.floor(_e)-1)%De===0:!1;M={strategy:"txnSeq_interval",sampleEveryN:De,topK:Re,sampled:Tt}}const D=x&&(v==="full"||M?.sampled===!0),T=v==="full"?3:M?.topK??3,C=D?[]:void 0,O=t.schedulingScope??"all",q=t.schedulingScopeStepIds??(O==="immediate"?h.topoOrderImmediateInt32:O==="deferred"?h.topoOrderDeferredInt32:h.topoOrderInt32),I=q.length,L=h.topoOrderImmediateInt32.length,P=h.topoOrderDeferredInt32.length,B=P>0?{scope:O,immediateStepCount:L,deferredStepCount:P}:void 0;P>0&&(O==="immediate"&&!c.includes("time_slicing_immediate")?c.push("time_slicing_immediate"):O==="deferred"&&!c.includes("time_slicing_deferred")&&c.push("time_slicing_deferred"));const $=Ee=>x?it({type:"trace:trait:converge",moduleId:t.moduleId,instanceId:t.instanceId,txnSeq:t.txnSeq,txnId:t.txnId,data:Ee}):he,V=d.fieldPathIdRegistry,j=t.dirtyPaths==null?[]:(Array.isArray(t.dirtyPaths),t.dirtyPaths),K=p6({dirtyPaths:j,registry:V,dirtyAllReason:t.dirtyAllReason}),G=3,J=1.05,F=k?K.dirtyAll?{dirtyAll:!0,reason:K.reason??"unknownWrite",rootCount:0,rootIds:[],rootIdsTruncated:!1}:{dirtyAll:!1,rootCount:K.rootCount,rootIds:K.rootIds.slice(0,G),rootIdsTruncated:K.rootIds.length>G}:void 0,U=t.configScope??"builtin",Q=t.generation??{generation:d.generation};Q.generation;const z=_?A0(d):"",ne=a==="auto"?t.decisionBudgetMs:void 0,ce=t.cacheMissReasonHint;ce==="generation_bumped"&&!c.includes("generation_bumped")&&c.push("generation_bumped");const Z=()=>typeof ne=="number"&&Number.isFinite(ne)&&ne>0&&t.now()-n>ne,ee=()=>{c.includes("budget_cutoff")||c.push("budget_cutoff")},me=h.prefixFieldPathIdsByPathId,fe=h.prefixOffsetsByPathId,ye=h.scratch.dirtyPrefixBitSet,ie=h.scratch.reachableStepBitSet,xe=h.scratch.dirtyPrefixQueue,ke=h.scratch.planStepIds,Ke=h.triggerStepIdsByFieldPathId,Xe=h.triggerStepOffsetsByFieldPathId,Je=Ee=>{const De=fe[Ee],Re=fe[Ee+1];if(!(De==null||Re==null))for(let _e=De;_e<Re;_e++)ye.add(me[_e])},dt=Ee=>{const De=fe[Ee],Re=fe[Ee+1];if(De==null||Re==null)return!1;for(let _e=De;_e<Re;_e++)if(ye.has(me[_e]))return!0;return!1},Ht=Ee=>{const De=h.stepOutFieldPathIdByStepId[Ee];if(typeof De=="number"&&dt(De))return!0;const Re=h.stepDepsOffsetsByStepId[Ee],_e=h.stepDepsOffsetsByStepId[Ee+1];if(Re==null||_e==null)return!1;for(let Tt=Re;Tt<_e;Tt++)if(dt(h.stepDepsFieldPathIds[Tt]))return!0;return!1},Et=(Ee,De)=>{if(y<32||t.schedulingScopeStepIds!=null){ye.clear();for(let Nn=0;Nn<Ee.length;Nn++)Je(Ee[Nn]);let yt=0,At=0;for(let Nn=0;Nn<q.length;Nn++){const Ct=q[Nn];if(De?.stopOnDecisionBudget&&(At+=1,At>=32&&(At=0,Z())))return ye.clear(),{budgetCutoff:!0};Ht(Ct)&&(ke[yt]=Ct,yt+=1,Je(h.stepOutFieldPathIdByStepId[Ct]))}const Nr=E?ke.subarray(0,yt):new Int32Array(yt);return!E&&yt>0&&Nr.set(ke.subarray(0,yt)),ye.clear(),{plan:Nr}}ye.clear(),ie.clear();let Re=0;const _e=yt=>{const At=fe[yt],Nr=fe[yt+1];if(!(At==null||Nr==null))for(let Nn=At;Nn<Nr;Nn++){const Ct=me[Nn];ye.has(Ct)||(ye.add(Ct),xe[Re]=Ct,Re+=1)}};for(let yt=0;yt<Ee.length;yt++)_e(Ee[yt]);const Tt=yt=>{if(O==="all")return!0;const At=h.stepSchedulingByStepId[yt];return O==="immediate"?At===0:At===1};let Hr=0,ei=0;for(;Hr<Re;){if(De?.stopOnDecisionBudget&&(ei+=1,ei>=32&&(ei=0,Z())))return ye.clear(),{budgetCutoff:!0};const yt=xe[Hr];Hr+=1;const At=Xe[yt],Nr=Xe[yt+1];if(!(At==null||Nr==null))for(let Nn=At;Nn<Nr;Nn++){const Ct=Ke[Nn];Tt(Ct)&&(ie.has(Ct)||(ie.add(Ct),_e(h.stepOutFieldPathIdByStepId[Ct])))}}let Lt=0;for(let yt=0;yt<q.length;yt++){const At=q[yt];ie.has(At)&&(ke[Lt]=At,Lt+=1)}const Rt=E?ke.subarray(0,Lt):new Int32Array(Lt);return!E&&Lt>0&&Rt.set(ke.subarray(0,Lt)),ye.clear(),{plan:Rt}},Ue=t.planCache;ce==="generation_bumped"&&typeof Q.generationBumpCount=="number"&&Q.generationBumpCount>=3&&Ue&&!Ue.isDisabled()&&Ue.disable("generation_thrash");const Mn=!!Ue&&!Ue.isDisabled()&&t.schedulingScopeStepIds==null&&!K.dirtyAll&&K.rootIds.length>0,nn=K.keyHash^(O==="all"?0:O==="immediate"?1:2),Rn=Mn?K.rootIds:void 0;let pt=_?{capacity:0,size:0,hits:0,misses:0,evicts:0,hit:!1}:void 0,Zn,ue;const we=Ee=>{if(K.dirtyAll){pt&&Ue&&(pt=Ue.evidence({hit:!1,keySize:K.keySize,missReason:Ee?.missReason??"unknown"}));const _e=q;return Zn=_e.length,{plan:_e,hit:!1}}if(Mn&&Ue&&Rn){const _e=Ue.get(nn,Rn);if(_e)return pt&&(pt=Ue.evidence({hit:!0,keySize:K.keySize})),Zn=_e.length,{plan:_e,hit:!0}}if(Ee?.stopOnDecisionBudget&&y>=32&&Z())return pt&&Ue&&(pt=Ue.evidence({hit:!1,keySize:K.keySize,missReason:Ee?.missReason??"unknown"})),{hit:!1,budgetCutoff:!0};const De=Et(K.rootIds,{stopOnDecisionBudget:Ee?.stopOnDecisionBudget});if(De.budgetCutoff)return pt&&Ue&&(pt=Ue.evidence({hit:!1,keySize:K.keySize,missReason:Ee?.missReason??"unknown"})),{hit:!1,budgetCutoff:!0};const Re=De.plan??new Int32Array(0);return Mn&&Ue&&Rn&&Ue.set(nn,Rn,E?Re.slice():Re),pt&&Ue&&(pt=Ue.evidence({hit:!1,keySize:K.keySize,missReason:Ee?.missReason??"not_cached"})),Zn=Re.length,{plan:Re,hit:!1}},Ne=.75,We=.9;if(a==="auto")if(t.txnSeq===1)u="full",c.push("cold_start");else if(K.dirtyAll)u="full",c.push("dirty_all"),c.push("unknown_write");else if(K.rootIds.length===0)u="full",c.push("unknown_write");else if((I>0?K.rootCount/I:1)>=Ne)u="full",c.push("near_full");else{const{plan:De,hit:Re,budgetCutoff:_e}=we({missReason:ce??"not_cached",stopOnDecisionBudget:ne!=null});_e||!De?(u="full",ee()):(ue=De,c.push(Re?"cache_hit":"cache_miss"),(I>0?De.length/I:1)>=We?(u="full",c.push("near_full")):u="dirty")}else if(c.push("module_override"),u==="dirty"){const{plan:Ee,hit:De}=we({missReason:ce??"not_cached"});ue=Ee,K.dirtyAll?c.push("dirty_all"):Ue&&K.rootIds.length>0&&c.push(De?"cache_hit":"cache_miss")}pt?.disabled&&pt.disableReason==="low_hit_rate"&&!c.includes("low_hit_rate_protection")&&c.push("low_hit_rate_protection"),i=t.now(),a==="auto"&&(r=Math.max(0,i-n));let Ve=0;const Jt=Ee=>{const De={totalSteps:y,executedSteps:Ee.executedSteps,skippedSteps:Math.max(0,y-Ee.executedSteps),changedSteps:Ve,...typeof Zn=="number"?{affectedSteps:Zn}:null},Re={requestedMode:a,executedMode:u,outcome:Ee.outcome,configScope:U,staticIrDigest:z,executionBudgetMs:t.budgetMs,executionDurationMs:Ee.executionDurationMs,...a==="auto"&&t.decisionBudgetMs!=null?{decisionBudgetMs:t.decisionBudgetMs}:null,...a==="auto"&&r!=null?{decisionDurationMs:r}:null,reasons:c,stepStats:De};return k?_?{...Re,thresholds:{floorRatio:J},dirty:F,cache:pt,generation:Q,staticIr:{fieldPathCount:d.fieldPaths.length,stepCount:y,buildDurationMs:d.buildDurationMs},...B?{timeSlicing:B}:{},...M?{diagnosticsSampling:M}:{},...C&&C.length>0?{top3:C.slice()}:{}}:{...Re,dirty:F}:Re},Gt=v==="full"?[]:void 0;let gt=0;const Le=t.allowInPlaceDraft===!0&&h.allOutPathsShallow?new Pj(o):new Bve(o);let tt=0;const ln=()=>{Le instanceof Pj&&Le.rollback(),t.setDraft(o)};try{if(u==="dirty"&&!ue){const{plan:Re}=we({missReason:ce??"not_cached"});ue=Re}let Ee;if(u==="dirty"&&!K.dirtyAll){ye.clear();const Re=K.rootIds;for(let _e=0;_e<Re.length;_e++)Je(Re[_e]);Ee=ye}const De=u==="dirty"&&ue?ue:q;for(let Re=0;Re<De.length;Re++){const _e=De[Re],Tt=p[_e];if(!Tt)continue;const Hr=Tt.fieldPath;if(Gt){if(t.now()-i>t.budgetMs){ln();const Lt=Math.max(0,t.now()-i),Rt=pm(Gt),yt={mode:u,budgetMs:t.budgetMs,totalDurationMs:Lt,totalSteps:y,executedSteps:gt,skippedSteps:Math.max(0,y-gt),changedSteps:Ve,top3:Rt};c.includes("budget_cutoff")||c.push("budget_cutoff");const At=Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:Lt});return At&&v!=="off"&&(yield*$(At)),{_tag:"Degraded",reason:"budget_exceeded",summary:yt,...At?{decision:At}:null}}}else if(tt+=1,tt>=32&&(tt=0,t.now()-i>t.budgetMs)){ln(),c.includes("budget_cutoff")||c.push("budget_cutoff");const Lt=Math.max(0,t.now()-i),Rt=x?Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:Lt}):void 0;return Rt&&v!=="off"&&(yield*$(Rt)),{_tag:"Degraded",reason:"budget_exceeded",...Rt?{decision:Rt}:null}}if(u==="dirty"&&Ee&&!Ht(_e))continue;if(gt+=1,Gt){const Lt=t.now(),Rt=yield*en(X1(t,h,Le,_e,Tt,x,v,g)),yt=t.now(),At=Math.max(0,yt-Lt),Nr=Tt.kind==="computed"?"computed":"link",Nn=h.stepLabelByStepId[_e]??String(_e),Ct=Rt._tag==="Success"?Rt.value:!1;if(C&&zj({hotspots:C,topK:T,next:{kind:Nr,stepId:_e,outFieldPathId:h.stepOutFieldPathIdByStepId[_e],durationMs:At,changed:Ct}}),Gt.push({stepId:Nn,kind:Nr,fieldPath:Hr,durationMs:At,changed:Ct}),Rt._tag==="Failure"){const xn=Zs(Rt.cause);ln();const pn=Math.max(0,t.now()-i),Ea=pm(Gt),Lr={mode:u,budgetMs:t.budgetMs,totalDurationMs:pn,totalSteps:y,executedSteps:gt,skippedSteps:Math.max(0,y-gt),changedSteps:Ve,top3:Ea},cn=Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:pn});return cn&&v!=="off"&&(yield*$(cn)),{_tag:"Degraded",reason:"runtime_error",errorSummary:xn.errorSummary,errorDowngrade:xn.downgrade,summary:Lr,...cn?{decision:cn}:null}}Rt.value&&(Ve+=1,u==="dirty"&&Ee&&Je(h.stepOutFieldPathIdByStepId[_e]));continue}if(C){const Lt=t.now(),Rt=yield*en(X1(t,h,Le,_e,Tt,x,v,g)),yt=t.now(),At=Math.max(0,yt-Lt),Nr=Tt.kind==="computed"?"computed":"link",Nn=Rt._tag==="Success"?Rt.value:!1;if(zj({hotspots:C,topK:T,next:{kind:Nr,stepId:_e,outFieldPathId:h.stepOutFieldPathIdByStepId[_e],durationMs:At,changed:Nn}}),Rt._tag==="Failure"){const Ct=Zs(Rt.cause);ln();const xn=Math.max(0,t.now()-i),pn=Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:xn});return pn&&v!=="off"&&(yield*$(pn)),{_tag:"Degraded",reason:"runtime_error",errorSummary:Ct.errorSummary,errorDowngrade:Ct.downgrade,...pn?{decision:pn}:null}}Nn&&(Ve+=1,u==="dirty"&&Ee&&Je(h.stepOutFieldPathIdByStepId[_e]));continue}if(v==="off"&&g.length===0){try{Qve(t,h,Le,_e,Tt)&&(Ve+=1,u==="dirty"&&Ee&&Je(h.stepOutFieldPathIdByStepId[_e]))}catch(Lt){const Rt=Zs(Lt);ln();const yt=Math.max(0,t.now()-i),At=x?Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:yt}):void 0;return At&&v!=="off"&&(yield*$(At)),{_tag:"Degraded",reason:"runtime_error",errorSummary:Rt.errorSummary,errorDowngrade:Rt.downgrade,...At?{decision:At}:null}}continue}const ei=yield*en(X1(t,h,Le,_e,Tt,x,v,g));if(ei._tag==="Failure"){const Lt=Zs(ei.cause);ln();const Rt=Math.max(0,t.now()-i),yt=x?Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:Rt}):void 0;return yt&&v!=="off"&&(yield*$(yt)),{_tag:"Degraded",reason:"runtime_error",errorSummary:Lt.errorSummary,errorDowngrade:Lt.downgrade,...yt?{decision:yt}:null}}ei.value&&(Ve+=1,u==="dirty"&&Ee&&Je(h.stepOutFieldPathIdByStepId[_e]))}}catch(Ee){if(Ee instanceof IC)throw Ee;const De=Zs(Ee);ln();const Re=Math.max(0,t.now()-i),_e=Gt?{mode:u,budgetMs:t.budgetMs,totalDurationMs:Re,totalSteps:y,executedSteps:gt,skippedSteps:Math.max(0,y-gt),changedSteps:Ve,top3:pm(Gt)}:void 0,Tt=x?Jt({outcome:"Degraded",executedSteps:gt,executionDurationMs:Re}):void 0;return Tt&&v!=="off"&&(yield*$(Tt)),{_tag:"Degraded",reason:"runtime_error",errorSummary:De.errorSummary,errorDowngrade:De.downgrade,..._e?{summary:_e}:null,...Tt?{decision:Tt}:null}}const oe=Math.max(0,t.now()-i),Me=Ve>0?"Converged":"Noop",Be=x?Jt({outcome:Me,executedSteps:gt,executionDurationMs:oe}):void 0;return Be&&v!=="off"&&(yield*$(Be)),Ve>0?{_tag:"Converged",patchCount:Ve,...Gt?{summary:{mode:u,budgetMs:t.budgetMs,totalDurationMs:oe,totalSteps:y,executedSteps:gt,skippedSteps:Math.max(0,y-gt),changedSteps:Ve,top3:pm(Gt)}}:null,...Be?{decision:Be}:null}:{_tag:"Noop",...Gt?{summary:{mode:u,budgetMs:t.budgetMs,totalDurationMs:oe,totalSteps:y,executedSteps:gt,skippedSteps:Math.max(0,y-gt),changedSteps:Ve,top3:pm(Gt)}}:null,...Be?{decision:Be}:null}}),hr={Remove:"remove",Replace:"replace",Add:"add"},_6=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Jve=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),RS=Symbol.iterator,Co={mutable:"mutable",immutable:"immutable"},TA={};function eg(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Bj(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const r=Reflect.getOwnPropertyDescriptor(n,t);if(r)return r;n=Reflect.getPrototypeOf(n)}}}function CA(e){return Object.getPrototypeOf(e)===Set.prototype}function IA(e){return Object.getPrototypeOf(e)===Map.prototype}function So(e){var t;return(t=e.copy)!==null&&t!==void 0?t:e.original}function Ec(e){return!!Bt(e)}function Bt(e){return typeof e!="object"?null:e?.[_6]}function MA(e){var t;const n=Bt(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function $s(e,t){if(!e||typeof e!="object")return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!t?.mark&&((n=t.mark(e,Co))===Co.immutable||typeof n=="function")}function E6(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=Bt(ml(n,e.key));if(r!==null&&r?.original!==e.original)return null;const i=e.parent.type===3,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||eg(n,o)))return null;t.push(o)}if(e.parent)return E6(e.parent,t);t.reverse();try{Zve(e.copy,t)}catch{return null}return t}function Id(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function ml(e,t){return Id(e)===2?e.get(t):e[t]}function Ky(e,t,n){Id(e)===2?e.set(t,n):e[t]=n}function J1(e,t){const n=Bt(e);return(n?So(n):e)[t]}function al(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function AC(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function Eu(e,t){return t?e:[""].concat(e).map(n=>{const r=`${n}`;return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function Zve(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if(e=ml(Id(e)===3?Array.from(e):e,r),typeof e!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return e}function eSe(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach(n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);if(r.enumerable&&r.configurable&&r.writable){t[n]=e[n];return}r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r)}),t}const tSe=Object.prototype.propertyIsEnumerable;function T6(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!CA(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}else if(e instanceof Map){if(!IA(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Co),n!==void 0)&&n!==Co.mutable){if(n===Co.immutable)return eSe(e);if(typeof n=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}else if(typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype){const r={};return Object.keys(e).forEach(i=>{r[i]=e[i]}),Object.getOwnPropertySymbols(e).forEach(i=>{tSe.call(e,i)&&(r[i]=e[i])}),r}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Ni(e){e.copy||(e.copy=T6(e.original,e.options))}function Om(e){if(!$s(e))return MA(e);if(Array.isArray(e))return e.map(Om);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,Om(i)]);if(!IA(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Map(n)}if(e instanceof Set){const n=Array.from(e).map(Om);if(!CA(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Set(n)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Om(e[n]);return t}function AS(e){return Ec(e)?Om(e):e}function ua(e){var t;e.assignedMap=(t=e.assignedMap)!==null&&t!==void 0?t:new Map,e.operated||(e.operated=!0,e.parent&&ua(e.parent))}function Uj(){throw new Error("Cannot modify frozen object")}function Af(e,t,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const a=n.has(e)?n.get(e):e;if(r.length>0){const c=r.indexOf(a);if(a&&typeof a=="object"&&c!==-1)throw r[0]===a?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,c).map((u,d)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const h=r[d];return typeof u=="object"&&(h instanceof Map||h instanceof Set)?Array.from(h.keys()).indexOf(u):u}).join("/")}`);r.push(a),i.push(t)}else r.push(a)}if(Object.isFrozen(e)||Ec(e)){r.pop(),i.pop();return}switch(Id(e)){case 2:for(const[c,u]of e)Af(c,c,n,r,i),Af(u,c,n,r,i);e.set=e.clear=e.delete=Uj;break;case 3:for(const c of e)Af(c,c,n,r,i);e.add=e.clear=e.delete=Uj;break;case 1:Object.freeze(e);let a=0;for(const c of e)Af(c,a,n,r,i),a+=1;break;default:Object.freeze(e),Object.keys(e).forEach(c=>{const u=e[c];Af(u,c,n,r,i)})}r.pop(),i.pop()}function RA(e,t){const n=Id(e);if(n===0)Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)});else if(n===1){let r=0;for(const i of e)t(r,i,e),r+=1}else e.forEach((r,i)=>t(i,r,e))}function C6(e,t,n){if(Ec(e)||!$s(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),RA(e,(o,a)=>{var c;if(Ec(a)){const u=Bt(a);Ni(u);const d=!((c=u.assignedMap)===null||c===void 0)&&c.size||u.operated?u.copy:u.original;Ky(r?i:e,o,d)}else C6(a,t,n)}),i){const o=e,a=Array.from(o);o.clear(),a.forEach(c=>{o.add(i.has(c)?i.get(c):c)})}}function nSe(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&C6(ml(n,t),e.finalities.handledSet,e.options)}function OC(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(MA(t))}))}function DC(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=E6(e);o&&t(e,o,n,r)}e.finalized=!0}}function AA(e,t,n,r){const i=Bt(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((o,a)=>{var c;const u=e.type===3?e.setMap:e.copy;if(al(ml(u,t),n)){let d=i.original;i.copy&&(d=i.copy),OC(e),DC(e,r,o,a),e.options.enableAutoFreeze&&(e.options.updatedValues=(c=e.options.updatedValues)!==null&&c!==void 0?c:new WeakMap,e.options.updatedValues.set(d,i.original)),Ky(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),$s(n,e.options)&&e.finalities.draft.push(()=>{const o=e.type===3?e.setMap:e.copy;al(ml(o,t),n)&&nSe(e,t)})}function rSe(e,t,n,r,i){let{original:o,assignedMap:a,options:c}=e,u=e.copy;u.length<o.length&&([o,u]=[u,o],[n,r]=[r,n]);for(let d=0;d<o.length;d+=1)if(a.get(d.toString())&&u[d]!==o[d]){const h=t.concat([d]),p=Eu(h,i);n.push({op:hr.Replace,path:p,value:AS(u[d])}),r.push({op:hr.Replace,path:p,value:AS(o[d])})}for(let d=o.length;d<u.length;d+=1){const h=t.concat([d]),p=Eu(h,i);n.push({op:hr.Add,path:p,value:AS(u[d])})}if(o.length<u.length){const{arrayLengthAssignment:d=!0}=c.enablePatches;if(d){const h=t.concat(["length"]),p=Eu(h,i);r.push({op:hr.Replace,path:p,value:o.length})}else for(let h=u.length;o.length<h;h-=1){const p=t.concat([h-1]),y=Eu(p,i);r.push({op:hr.Remove,path:y})}}}function iSe({original:e,copy:t,assignedMap:n},r,i,o,a){n.forEach((c,u)=>{const d=ml(e,u),h=AS(ml(t,u)),p=c?eg(e,u)?hr.Replace:hr.Add:hr.Remove;if(al(d,h)&&p===hr.Replace)return;const y=r.concat(u),g=Eu(y,a);i.push(p===hr.Remove?{op:p,path:g}:{op:p,path:g,value:h}),o.push(p===hr.Add?{op:hr.Remove,path:g}:p===hr.Remove?{op:hr.Add,path:g,value:d}:{op:hr.Replace,path:g,value:d})})}function oSe({original:e,copy:t},n,r,i,o){let a=0;e.forEach(c=>{if(!t.has(c)){const u=n.concat([a]),d=Eu(u,o);r.push({op:hr.Remove,path:d,value:c}),i.unshift({op:hr.Add,path:d,value:c})}a+=1}),a=0,t.forEach(c=>{if(!e.has(c)){const u=n.concat([a]),d=Eu(u,o);r.push({op:hr.Add,path:d,value:c}),i.unshift({op:hr.Remove,path:d,value:c})}a+=1})}function zg(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return iSe(e,t,n,r,i);case 1:return rSe(e,t,n,r,i);case 3:return oSe(e,t,n,r,i)}}const O0=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!$s(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},PC={get size(){return So(Bt(this)).size},has(e){return So(Bt(this)).has(e)},set(e,t){const n=Bt(this),r=So(n);return(!r.has(e)||!al(r.get(e),t))&&(Ni(n),ua(n),n.assignedMap.set(e,!0),n.copy.set(e,t),AA(n,e,t,zg)),this},delete(e){if(!this.has(e))return!1;const t=Bt(this);return Ni(t),ua(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=Bt(this);if(this.size){Ni(e),ua(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){const n=Bt(this);So(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=Bt(this),i=So(r).get(e),o=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Co))===Co.mutable;if(r.options.strict&&O0(i,r.options,o),o||r.finalized||!$s(i,r.options)||i!==r.original.get(e))return i;const a=TA.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Ni(r),r.copy.set(e,a),a},keys(){return So(Bt(this)).keys()},values(){const e=this.keys();return{[RS]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[RS]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[RS](){return this.entries()}},sSe=Reflect.ownKeys(PC),qj=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const a=o.value;let c=e.setMap.get(a);const u=Bt(c),d=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,c,Co))===Co.mutable;if(e.options.strict&&O0(a,e.options,d),!d&&!u&&$s(a,e.options)&&!e.finalized&&e.original.has(a)){const h=TA.createDraft({original:a,parentDraft:e,key:a,finalities:e.finalities,options:e.options});e.setMap.set(a,h),c=h}else u&&(c=u.proxy);return{done:!1,value:n?c:[c,c]}},D0={get size(){return Bt(this).setMap.size},has(e){const t=Bt(this);if(t.setMap.has(e))return!0;Ni(t);const n=Bt(e);return!!(n&&t.setMap.has(n.original))},add(e){const t=Bt(this);return this.has(e)||(Ni(t),ua(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),AA(t,e,e,zg)),this},delete(e){if(!this.has(e))return!1;const t=Bt(this);Ni(t),ua(t);const n=Bt(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=Bt(this);Ni(e),ua(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=Bt(this);Ni(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:qj(e,t,{isValuesIterator:!0})}},entries(){const e=Bt(this);Ni(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:qj(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[RS](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(D0,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const aSe=Reflect.ownKeys(D0),I6={get(e,t,n){var r,i;const o=(r=e.copy)===null||r===void 0?void 0:r[t];if(o&&e.finalities.draftsCache.has(o))return o;if(t===_6)return e;let a;if(e.options.mark){const d=t==="size"&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(a=e.options.mark(d,Co),a===Co.mutable)return e.options.strict&&O0(d,e.options,!0),d}const c=So(e);if(c instanceof Map&&sSe.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(PC,"size").get.call(e.proxy):PC[t].bind(e.proxy);if(c instanceof Set&&aSe.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(D0,"size").get.call(e.proxy):D0[t].bind(e.proxy);if(!eg(c,t)){const d=Bj(c,t);return d?"value"in d?d.value:(i=d.get)===null||i===void 0?void 0:i.call(e.proxy):void 0}const u=c[t];if(e.options.strict&&O0(u,e.options),e.finalized||!$s(u,e.options))return u;if(u===J1(e.original,t)){if(Ni(e),e.copy[t]=OA({original:e.original[t],parentDraft:e,key:e.type===1?Number(t):t,finalities:e.finalities,options:e.options}),typeof a=="function"){const d=Bt(e.copy[t]);return Ni(d),ua(d),d.copy}return e.copy[t]}return Ec(u)&&e.finalities.draftsCache.add(u),u},set(e,t,n){var r;if(e.type===3||e.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(e.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const o=Bj(So(e),t);if(o?.set)return o.set.call(e.proxy,n),!0;const a=J1(So(e),t),c=Bt(a);return c&&al(c.original,n)?(e.copy[t]=n,e.assignedMap=(r=e.assignedMap)!==null&&r!==void 0?r:new Map,e.assignedMap.set(t,!1),!0):(al(n,a)&&(n!==void 0||eg(e.original,t))||(Ni(e),ua(e),eg(e.original,t)&&al(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,AA(e,t,n,zg)),!0)},has(e,t){return t in So(e)},ownKeys(e){return Reflect.ownKeys(So(e))},getOwnPropertyDescriptor(e,t){const n=So(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},getPrototypeOf(e){return Reflect.getPrototypeOf(e.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return e.type===1?I6.set.call(this,e,t,void 0,e.proxy):(J1(e.original,t)!==void 0||t in e.original?(Ni(e),ua(e),e.assignedMap.set(t,!1)):(e.assignedMap=(n=e.assignedMap)!==null&&n!==void 0?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function OA(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,a=Id(t),c={type:a,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:a===3?new Map(t.entries()):void 0};(r||"key"in e)&&(c.key=r);const{proxy:u,revoke:d}=Proxy.revocable(a===1?Object.assign([],c):c,I6);if(i.revoke.push(d),c.proxy=u,n){const h=n;h.finalities.draft.push((p,y)=>{var g,v;const S=Bt(u);let x=h.type===3?h.setMap:h.copy;const k=ml(x,r),_=Bt(k);if(_){let E=_.original;_.operated&&(E=MA(k)),OC(_),DC(_,zg,p,y),h.options.enableAutoFreeze&&(h.options.updatedValues=(g=h.options.updatedValues)!==null&&g!==void 0?g:new WeakMap,h.options.updatedValues.set(E,_.original)),Ky(x,r,E)}(v=S.callbacks)===null||v===void 0||v.forEach(E=>{E(p,y)})})}else{const h=Bt(u);h.finalities.draft.push((p,y)=>{OC(h),DC(h,zg,p,y)})}return u}TA.createDraft=OA;function lSe(e,t,n,r,i){var o;const a=Bt(e),c=(o=a?.original)!==null&&o!==void 0?o:e,u=!!t.length;if(a?.operated)for(;a.finalities.draft.length>0;)a.finalities.draft.pop()(n,r);const d=u?t[0]:a?a.operated?a.copy:a.original:e;return a&&AC(a),i&&Af(d,d,a?.options.updatedValues),[d,n&&u?[{op:hr.Replace,path:[],value:t[0]}]:n,r&&u?[{op:hr.Replace,path:[],value:c}]:r]}function cSe(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const c=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,Co))===Co.mutable||!$s(e,t)?e:OA({original:e,parentDraft:null,finalities:r,options:t});return[c,(u=[])=>{const[d,h,p]=lSe(c,u,i,o,t.enableAutoFreeze);return t.enablePatches?[d,h,p]:d}]}function NC(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;RA(n,(o,a,c)=>{const u=Bt(a);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const d=u.original;if(c instanceof Set){const h=Array.from(c);c.clear(),h.forEach(p=>c.add(o===p?d:p))}else Ky(c,o,d)}else typeof a=="object"&&a!==null&&(e.value=a,e.isRoot=!1,NC(e))}),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function M6(e){var t;const n=Bt(e);if(!$s(e,n?.options))return e;const r=Id(e);if(n&&!n.operated)return n.original;let i;function o(){i=r===2?IA(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):T6(e,n?.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(RA(i,(a,c)=>{if(n&&al(ml(n.original,a),c))return;const u=M6(c);u!==c&&(i===e&&o(),Ky(i,a,u))}),r===3){const a=(t=n?.original)!==null&&t!==void 0?t:i;return CA(a)?new Set(i):new(Object.getPrototypeOf(a)).constructor(i)}return i}function Vj(e){if(!Ec(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return M6(e)}const uSe=e=>function t(n,r,i){var o,a,c;if(typeof n=="function"&&typeof r!="function")return function(D,...T){return t(D,C=>n.call(this,C,...T),r)};const u=n,d=r;let h=i;if(typeof r!="function"&&(h=r),h!==void 0&&Object.prototype.toString.call(h)!=="[object Object]")throw new Error(`Invalid options: ${h}, 'options' should be an object.`);h=Object.assign(Object.assign({},e),h);const p=Ec(u)?Vj(u):u,y=Array.isArray(h.mark)?((D,T)=>{for(const C of h.mark){if(typeof C!="function")throw new Error(`Invalid mark: ${C}, 'mark' should be a function.`);const O=C(D,T);if(O)return O}}):h.mark,g=(o=h.enablePatches)!==null&&o!==void 0?o:!1,v=(a=h.strict)!==null&&a!==void 0?a:!1,x={enableAutoFreeze:(c=h.enableAutoFreeze)!==null&&c!==void 0?c:!1,mark:y,strict:v,enablePatches:g};if(!$s(p,x)&&typeof p=="object"&&p!==null)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[k,_]=cSe(p,x);if(typeof r!="function"){if(!$s(p,x))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[k,_]}let E;try{E=d(k)}catch(D){throw AC(Bt(k)),D}const M=D=>{const T=Bt(k);if(!Ec(D)){if(D!==void 0&&!al(D,k)&&T?.operated)throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const O=D?.[Jve];if(O){const q=O[0];return x.strict&&typeof D=="object"&&D!==null&&NC({rootDraft:T,value:D,useRawReturn:!0}),_([q])}if(D!==void 0)return typeof D=="object"&&D!==null&&NC({rootDraft:T,value:D}),_([D])}if(D===k||D===void 0)return _([]);const C=Bt(D);if(x===C.options){if(C.operated)throw new Error("Cannot return a modified child draft.");return _([Vj(D)])}return _([D])};return E instanceof Promise?E.then(M,D=>{throw AC(Bt(k)),D}):M(E)},Iw=uSe();Object.prototype.constructor.toString();const dSe=e=>{const t=new Map;for(const n of e.graph.edges){const r=t.get(n.from)??[];r.push(n.to),t.set(n.from,r)}return{_tag:"StateTraitDependencyGraph",reverseAdj:t}},fSe=(e,t)=>{const n=new Set,r=[t];for(;r.length;){const i=r.shift();if(!i)break;if(n.has(i))continue;n.add(i);const o=e.reverseAdj.get(i);if(o)for(const a of o)r.push(a)}return n},ju=Symbol.for("logix.state-trait.validate.skip"),DA=e=>e?e.split(".").map(t=>/^[0-9]+$/.test(t)?Number(t):t):[],Ko=(e,t)=>{if(!t||e==null)return e;const n=DA(t);let r=e;for(const i of n){if(r==null)return;r=r[i]}return r},hSe=(e,t,n)=>{if(!t)return;const r=DA(t);if(r.length===0)return;let i=e;for(let a=0;a<r.length-1;a++){const c=r[a],u=r[a+1],d=i[c];(d==null||typeof d!="object")&&(i[c]=typeof u=="number"?[]:{}),i=i[c]}const o=r[r.length-1];i[o]=n},pSe=(e,t)=>{if(!t)return;const n=DA(t);if(n.length===0)return;let r=e;for(let o=0;o<n.length-1;o++){const a=n[o],c=r[a];if(c==null||typeof c!="object")return;r=c}const i=n[n.length-1];if(Array.isArray(r)&&typeof i=="number"){r[i]=void 0;return}r&&typeof r=="object"&&delete r[i]},Oi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Is=e=>e??void 0,mSe=e=>{if(e.length!==0){if(e.length===1)return e[0];if(e.every(Oi)){const t={};for(const n of e)for(const r of Object.keys(n)){const i=Is(n[r]);i!==void 0&&(r in t||(t[r]=i))}return Object.keys(t).length>0?t:void 0}return e[0]}},gSe=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e,n=t.message;if(typeof n!="string"||n.length===0)return!1;for(const i of Object.keys(t))if(i!=="message"&&i!=="code"&&i!=="details")return!1;const r=t.code;return!(r!==void 0&&(typeof r!="string"||r.length===0))},P0=e=>{if(e==null)return 0;if(typeof e=="string")return e.length>0?1:0;if(Array.isArray(e))return e.reduce((t,n)=>t+P0(n),0);if(typeof e=="object"){if(gSe(e))return 1;let t=0;for(const[n,r]of Object.entries(e))n!=="$rowId"&&(t+=P0(r));return t}return 1},Hj=(()=>{const e=globalThis.performance;return e&&typeof e.now=="function"?()=>e.now():()=>Date.now()})(),ySe=e=>e==="set"||e==="unset"||e==="insert"||e==="remove",R6=e=>Fi(e)??["$root"],bSe=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},vSe=(e,t)=>{const n=e?.details,r=Oi(n)?n:void 0,i=r&&typeof r._tag=="string"?r._tag:void 0,o=e?.kind&&e.kind.length>0?e.kind:"unknown",a=i&&i.length>0?`${o}:${i}`:e?.name&&e.name.length>0?`${o}:${e.name}`:o,c=r?.op,u=ySe(c)?c:"set",d=r&&typeof r.path=="string"?r.path:void 0,h=R6(d??t);return{kind:a,path:h,op:u}},SSe=e=>e.trackBy?"trackBy":e.rowIdStore?"store":"index",xSe=(e,t,n)=>{if(n!=="trackBy"&&e.op==="set"&&bSe(e.path,t))return{kind:"rowId:degraded:no_trackBy_root_replace",message:"list root was replaced without trackBy; rowId stability is degraded"}},wSe=(e,t)=>{if(!Oi(t))return e;const n=e?{...e}:{};for(const r of Object.keys(t)){const i=Is(t[r]);i!==void 0&&(r in n||(n[r]=i))}return Object.keys(n).length>0?n:void 0},kSe=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0},LC=(e,t)=>{if(!e||typeof e!="object")return[];const n=e.deps;if(!Array.isArray(n))return[];const r=`${t}[].`,i=[];for(const o of n)if(typeof o=="string"){if(o.startsWith(r)){const a=o.slice(r.length);a&&i.push(a);continue}o.length>0&&!o.includes(".")&&!o.includes("[")&&!o.includes("]")&&i.push(o)}return Array.from(new Set(i)).sort()},_Se=(e,t,n,r)=>{const i=e.meta.rules,o=Object.keys(i).sort();let a,c,u,d=!1,h=!1;const p=new Set,y=n.scope.listPath??n.scope.fieldPath,g=S=>{c||(c=[]);const x=Math.max(c.length,S.length);c.length<x&&(c.length=x);for(let k=0;k<S.length;k++){const _=wSe(c[k],S[k]);c[k]=_}},v=(S,x,k,_)=>{if(x.length===0||k<=0)return{affectedRows:0,changedRows:0,setCount:0,clearedCount:0};let E=0,M=0,D=0,T=0;for(let C=0;C<k;C++){const O=Ko(r?.trace?.errorsRoot,`${S}.rows.${C}`),q=Oi(O)?O:void 0,I=_?.[C],L=Oi(I)?I:void 0;let P=!1,B=!1,$=!1;for(const V of x){const j=Is(q?.[V]),K=Is(L?.[V]);j!==void 0&&(P=!0),K!==void 0&&(B=!0),!Object.is(j,K)&&($=!0,K===void 0?j!==void 0&&(T+=1):D+=1)}(P||B)&&(E+=1),$&&(M+=1)}return{affectedRows:E,changedRows:M,setCount:D,clearedCount:T}};for(const S of o){const x=i[S],k=r?.trace?.listPath&&r?.trace?.errorsRoot,_=k?Hj():0;try{const E=typeof x=="function"?x(t,n):x&&typeof x=="object"?x.validate(t,n):void 0;if(E===ju)continue;d=!0;for(const D of LC(x,y))p.add(D);if(k){const D=r.trace.listPath,T=r.trace.errorsBasePath,C=LC(x,D),O=Array.isArray(t)?t.length:0,q=Array.isArray(E)?E:Oi(E)&&Array.isArray(E.rows)?E.rows:void 0,I=v(T,C,O,q),L=Math.max(0,Hj()-_);u||(u=[]),u.push({ruleId:`${e.fieldPath}#${S}`,summary:{scannedRows:O,affectedRows:I.affectedRows,changedRows:I.changedRows,setCount:I.setCount,clearedCount:I.clearedCount,durationMs:L}})}if(E===void 0)continue;if(Array.isArray(E)){g(E);continue}if(Oi(E)){const D=E.rows,T=Object.prototype.hasOwnProperty.call(E,"$list");T&&(h=!0);const C=Is(E.$list);if(C!==void 0&&a===void 0&&(a=C),Array.isArray(D))g(D);else if(!T&&C===void 0){const O=Is(E);O!==void 0&&a===void 0&&(a=O),h=!0}continue}const M=Is(E);M!==void 0&&a===void 0&&(a=M),h=!0}catch{}}return d?{listError:a,rows:c,traces:u,touchedKeys:p,touchedListError:h}:ju},Kj=e=>{if(!e)return e;const t=e.split(".").filter(Boolean),n=[];for(const r of t){if(/^[0-9]+$/.test(r)){if(n.length===0)continue;const i=n[n.length-1];i.endsWith("[]")||(n[n.length-1]=`${i}[]`);continue}n.push(r)}return n.join(".")},ESe=e=>{if(e.kind==="root")return[];if(e.kind==="field")return[Kj(e.path)];if(e.kind==="list")return[e.path,`${e.path}[]`];const t=`${e.path}[]`,n=e.field?Kj(e.field):void 0;return[n?`${t}.${n}`:t]},$C=e=>{if(!Array.isArray(e)||e.length===0)return[];const t=[];for(const n of e)!Number.isInteger(n)||n<0||t.push(n);return t},N0=(e,t)=>{const n=$C(t);return n.length===0?`${e}@@`:`${e}@@${n.join(",")}`},TSe=e=>{const t=new Map;for(const n of e){if(n.target.kind!=="item")continue;const r=N0(n.target.path,n.target.listIndexPath),i=t.get(r)??new Set;i.add(n.target.index),t.set(r,i)}return t},CSe=e=>{const t=new Set,n=new Set;for(const r of e)if(r.target.kind==="list"&&r.target.path){if(r.target.listIndexPath&&r.target.listIndexPath.length>0){n.add(N0(r.target.path,r.target.listIndexPath));continue}t.add(r.target.path)}return{all:t,instances:n}},ISe=e=>{const t={submit:4,blur:3,valueChange:2,manual:1};let n="manual",r=t[n];for(const i of e){const o=t[i.mode];o>r&&(r=o,n=i.mode)}return n},MSe=(e,t,n)=>{const r=e.meta.rules,i=Object.keys(r).sort(),o=[];let a=!1;for(const c of i){const u=r[c];try{const d=typeof u=="function"?u(t,n):u&&typeof u=="object"?u.validate(t,n):void 0;if(d===ju)continue;a=!0;const h=Is(d);h!==void 0&&o.push(h)}catch{}}return a?mSe(o):ju},RSe=(e,t,n)=>ae(function*(){const i=(yield*ut(Ei))!=="off",o=i?[]:void 0;yield*Ze(()=>{if(n.length===0)return;const a=e.entries.filter(U=>U.kind==="check");if(a.length===0)return;const c=n.some(U=>U.target.kind==="root"),u=t.getDraft(),d=(()=>{if(c)return new Set(a.map(z=>z.fieldPath));const U=dSe(e),Q=new Set;for(const z of n)for(const ne of ESe(z.target))for(const ce of fSe(U,ne))Q.add(ce);return Q})(),h=a.filter(U=>d.has(U.fieldPath));if(h.length===0)return;const p=ISe(n);i&&o&&o.push({type:"trace:trait:validate",moduleId:t.moduleId,instanceId:t.instanceId,txnSeq:t.txnSeq,txnId:t.txnId,data:{mode:p,requestCount:n.length,selectedCheckCount:h.length,hasRoot:c}});const y=TSe(n),g=CSe(n),v=g.all,S=g.instances,x=(()=>{const U=new Map;for(const Q of n){if(Q.target.kind!=="item"&&Q.target.kind!=="list")continue;const z=N0(Q.target.path,Q.target.listIndexPath);U.set(z,$C(Q.target.listIndexPath))}return U})(),k=[],_=(()=>{const U=new Map,Q=t.listConfigs??[];for(const z of Q)!z||typeof z.path!="string"||U.set(z.path,z);return U})(),E=(U,Q)=>{if(!U||typeof U!="object")return;const z=Q.split(".");let ne=U;for(const ce of z){if(ne==null)return;ne=ne[ce]}return ne},M=(U,Q)=>Q===void 0?`check:${U}`:`check:${U}@${Q}`,D=Array.from(_.keys()),T=new Set(D),C=U=>{const Q=U.split(".").filter(Boolean);let z;for(let ne=1;ne<Q.length;ne++){const ce=Q.slice(0,ne).join(".");T.has(ce)&&(z=ce)}return z},O=new Map,q=new Map;for(const U of D){const Q=C(U);O.set(U,Q);const z=Q?U.slice(Q.length+1):U;q.set(U,z)}const I=(U,Q)=>{const z=$C(Q);let ne=0,ce=O.get(U);for(;ce;)ne+=1,ce=O.get(ce);if(ne===0)return[];if(z.length===ne)return z},L=new Map,P=(U,Q)=>{const z=O.get(U),ne=z?`${U}@@#${Q.join(",")}`:`${U}@@root`,ce=L.get(ne);if(ce)return ce;const Z=_.get(U),ee=Z&&typeof Z.trackBy=="string"?Z.trackBy:void 0;if(!z){const Et=Ko(u,U),Ue=Array.isArray(Et)?Et:[],Mn=t.rowIdStore?t.rowIdStore.ensureList(U,Ue,ee):void 0,nn={listPath:U,listIndexPath:[],valuePath:U,errorBasePath:`errors.${U}`,items:Ue,trackBy:ee,rowIds:Mn};return L.set(ne,nn),nn}if(Q.length===0)return;const me=Q.slice(0,-1),fe=Q[Q.length-1],ye=P(z,me);if(!ye||fe<0||fe>=ye.items.length)return;const ie=q.get(U)??"";if(!ie)return;const xe=`${ye.valuePath}.${fe}.${ie}`,ke=`${ye.errorBasePath}.rows.${fe}.${ie}`,Ke=Ko(u,xe),Xe=Array.isArray(Ke)?Ke:[],Je=ye.rowIds?.[fe]??(t.rowIdStore?t.rowIdStore.getRowId(z,fe,ye.parentRowId):void 0),dt=t.rowIdStore?t.rowIdStore.ensureList(U,Xe,ee,Je):void 0,Ht={listPath:U,listIndexPath:Q,valuePath:xe,errorBasePath:ke,parentRowId:Je,items:Xe,trackBy:ee,rowIds:dt};return L.set(ne,Ht),Ht},B=U=>{const Q=O.get(U);if(!Q){const ce=P(U,[]);return ce?[ce]:[]}const z=B(Q),ne=[];for(const ce of z)for(let Z=0;Z<ce.items.length;Z++){const ee=[...ce.listIndexPath,Z],me=P(U,ee);me&&ne.push(me)}return ne},$=new Map,V=(U,Q,z)=>{const ne=`${U.errorBasePath}.rows.${Q}`,ce=$.get(ne);if(ce)return ce;const Z=Ko(u,ne),ee=Oi(Z)?{...Z}:{},me={listPath:U.listPath,listIndexPath:U.listIndexPath,parentRowId:U.parentRowId,index:Q,errorBasePath:U.errorBasePath,errorPath:ne,prev:Z,next:ee,stepId:z,removed:!1};return $.set(ne,me),me},j=(U,Q,z)=>{if(Q.size===0)return;const ne=z?Object.keys(z):[],ce=Object.keys(U.next).filter(ee=>ee!=="$rowId"),Z=new Set;for(const ee of ce)Q.has(ee)&&Z.add(ee);for(const ee of ne)Q.has(ee)&&Z.add(ee);if(Z.size!==0)for(const ee of Z){const me=Is(z?.[ee]);me===void 0?delete U.next[ee]:U.next[ee]=me}};for(const U of h){const Q=U.fieldPath;if(_.get(Q)){const fe=Q,ye=(()=>{if(c||v.has(fe))return B(fe);const ie=new Set;for(const ke of S)ke.startsWith(`${fe}@@`)&&ie.add(ke);for(const ke of y.keys())ke.startsWith(`${fe}@@`)&&ie.add(ke);if(ie.size===0)return B(fe);const xe=[];for(const ke of ie){const Ke=x.get(ke),Xe=I(fe,Ke);if(!Xe)continue;const Je=P(fe,Xe);Je&&xe.push(Je)}return xe})();for(const ie of ye){const xe=ie.items,ke=i?vSe(t.origin,fe):void 0,Ke=i?R6(fe):void 0,Xe=i?SSe({trackBy:ie.trackBy,rowIdStore:t.rowIdStore}):void 0,Je=i&&ke&&Ke&&Xe?xSe(ke,Ke,Xe):void 0,dt=_Se(U,xe,{mode:p,state:u,scope:{fieldPath:Q,listPath:fe,listIndexPath:ie.listIndexPath}},i?{trace:{listPath:fe,errorsBasePath:ie.errorBasePath,errorsRoot:u}}:void 0);if(dt===ju)continue;const Ht=dt.touchedKeys;if(i&&o&&ke&&Ke&&Xe&&dt.traces&&dt.traces.length>0)for(const ue of dt.traces){const we={ruleId:ue.ruleId,scopeFieldPath:Ke,mode:p,trigger:ke,summary:ue.summary,rowIdMode:Xe};Je&&(we.degraded=Je),o.push({type:"trace:trait:check",moduleId:t.moduleId,instanceId:t.instanceId,txnSeq:t.txnSeq,txnId:t.txnId,data:we})}const Et=`${ie.errorBasePath}.$list`,Ue=Ko(u,Et),Mn=Is(dt.listError);dt.touchedListError&&!Object.is(Ue,Mn)&&k.push({errorPath:Et,prev:Ue,next:Mn,stepId:M(Q)});const nn=dt.rows??[],Rn=Ko(u,`${ie.errorBasePath}.rows`),pt=Array.isArray(Rn)?Rn.length:0,Zn=Math.max(xe.length,nn.length,pt);for(let ue=0;ue<Zn;ue++){const we=`${ie.errorBasePath}.rows.${ue}`,Ne=$.get(we);if(ue>=xe.length){if((Ne?.prev??Ko(u,we))===void 0&&!Ne)continue;const tt=Ne??V(ie,ue,M(Q,ue));tt.removed=!0;for(const ln of Object.keys(tt.next))delete tt.next[ln];continue}const We=nn[ue],Ve=Oi(We)?We:void 0;if(Ne){j(Ne,Ht,Ve);continue}if(Ve&&Object.keys(Ve).some(Le=>Ht.has(Le))){const Le=V(ie,ue,M(Q,ue));j(Le,Ht,Ve);continue}const Gt=Ko(u,we),gt=Oi(Gt)&&Object.keys(Gt).some(Le=>Le!=="$rowId"&&Ht.has(Le)),mt=Oi(Gt)&&Object.keys(Gt).length===1&&Object.keys(Gt)[0]==="$rowId";if(gt||mt){const Le=V(ie,ue,M(Q,ue));j(Le,Ht,void 0)}}}continue}if(Q.endsWith("[]")){const fe=Q.slice(0,-2),ye=(()=>{if(c||v.has(fe))return B(fe);const ke=new Set;for(const Xe of S)Xe.startsWith(`${fe}@@`)&&ke.add(Xe);for(const Xe of y.keys())Xe.startsWith(`${fe}@@`)&&ke.add(Xe);if(ke.size===0)return B(fe);const Ke=[];for(const Xe of ke){const Je=x.get(Xe),dt=I(fe,Je);if(!dt)continue;const Ht=P(fe,dt);Ht&&Ke.push(Ht)}return Ke})(),ie=U.meta.rules,xe=Object.keys(ie).sort();for(const ke of ye){const Ke=N0(fe,ke.listIndexPath),Xe=c||v.has(fe)||S.has(Ke)?ke.items.map((Je,dt)=>dt):Array.from(y.get(Ke)??[]);if(Xe.length!==0)for(const Je of Xe){if(Je<0||Je>=ke.items.length)continue;const dt=`${ke.valuePath}.${Je}`,Ht=Ko(u,dt),Et=`${ke.errorBasePath}.rows.${Je}`,Ue=Ko(u,Et),Mn=Oi(Ue)?Ue:void 0,nn=Oi(Ue)&&Object.keys(Ue).length===1&&Object.keys(Ue)[0]==="$rowId";let Rn,pt;const Zn={mode:p,state:u,scope:{fieldPath:Q,listPath:fe,listIndexPath:ke.listIndexPath,index:Je}},ue=()=>Rn||(Rn=V(ke,Je,M(Q,Je)),Rn);for(const we of xe){const Ne=ie[we];try{const We=typeof Ne=="function"?Ne(Ht,Zn):Ne&&typeof Ne=="object"?Ne.validate(Ht,Zn):void 0;if(We===ju)continue;const Ve=LC(Ne,fe);if(Ve.length===0)continue;const Jt=Oi(We)?We:void 0,Gt=Jt&&Object.keys(Jt).some(Le=>Le!=="$rowId"&&Ve.includes(Le)),gt=Mn&&Object.keys(Mn).some(Le=>Le!=="$rowId"&&Ve.includes(Le));if(!Rn&&!Gt&&!gt&&!nn)continue;const mt=ue();for(const Le of Ve){if(Le==="$rowId"||pt?.has(Le))continue;const tt=Is(Jt?.[Le]);tt===void 0?delete mt.next[Le]:(mt.next[Le]=tt,pt||(pt=new Set),pt.add(Le))}}catch{}}}}continue}const ne=Q==="$root"?u:Ko(u,Q),ce=MSe(U,ne,{mode:p,state:u,scope:{fieldPath:Q}});if(ce===ju)continue;const ee=(()=>{const fe=U?.meta?.writeback,ye=fe&&typeof fe=="object"?fe.path:void 0;return typeof ye=="string"&&ye.startsWith("errors.")?ye:void 0})()??`errors.${Q}`,me=Ko(u,ee);Object.is(me,ce)||k.push({errorPath:ee,prev:me,next:ce,stepId:M(Q)})}for(const U of $.values()){const Q=U.prev,z=(()=>{if(U.removed||(delete U.next.$rowId,Object.keys(U.next).filter(fe=>fe!=="$rowId").length===0))return;const ce=P(U.listPath,U.listIndexPath),Z=ce?.items[U.index],me={$rowId:(()=>{if(ce?.trackBy){const ye=E(Z,ce.trackBy);if(ye!==void 0)return String(ye)}const fe=ce?.rowIds?.[U.index]??t.rowIdStore?.getRowId(U.listPath,U.index,U.parentRowId);return typeof fe=="string"&&fe.length>0?fe:String(U.index)})(),...U.next};return Oi(Q)&&kSe(Q,me)?Q:me})();Object.is(Q,z)||k.push({errorPath:U.errorPath,prev:Q,next:z,stepId:U.stepId})}if(k.length===0)return;const K="unknown",G=u&&typeof u=="object"&&u.$form&&typeof u.$form=="object"&&!Array.isArray(u.$form)&&typeof u.$form.errorCount=="number"?u.$form.errorCount:void 0,J=G===void 0?0:k.reduce((U,Q)=>U+(P0(Q.next)-P0(Q.prev)),0),F=Iw(u,U=>{for(const Q of k)Q.next===void 0?pSe(U,Q.errorPath):hSe(U,Q.errorPath,Q.next);if(G!==void 0&&J!==0){const Q=U.$form;Q&&typeof Q=="object"&&!Array.isArray(Q)&&(Q.errorCount=Math.max(0,G+J))}});t.setDraft(F);for(const U of k){const Q=Fi(U.errorPath)??[];t.recordPatch(Q,K,U.prev,U.next)}}),o&&o.length>0&&(yield*sn(o,a=>it(a),{discard:!0}))}),ASe=e=>{const t=new WeakSet,n=r=>{if(r===null)return null;if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="bigint")return r.toString();if(typeof r>"u")return"__undefined__";if(typeof r=="symbol")return`__symbol__:${String(r)}`;if(typeof r=="function")return"__function__";if(Array.isArray(r))return r.map(i=>n(i));if(r instanceof Date)return`__date__:${r.toISOString()}`;if(r instanceof Error)return{_tag:"Error",name:r.name,message:r.message};if(r&&typeof r=="object"){const i=r;if(t.has(i))return"__cycle__";t.add(i);const o=r,a=Object.keys(o).sort(),c={};for(const u of a)c[u]=n(o[u]);return c}return String(r)};try{return JSON.stringify(n(e))}catch{return String(e)}},Wj=e=>ASe(e),Wo={idle:()=>({status:"idle",keyHash:void 0,data:void 0,error:void 0}),loading:e=>({status:"loading",keyHash:e.keyHash,data:void 0,error:void 0}),success:e=>({status:"success",keyHash:e.keyHash,data:e.data,error:void 0}),error:e=>({status:"error",keyHash:e.keyHash,data:void 0,error:e.error})};class OSe extends tn("@logixjs/core/ResourceRegistry")(){}const Gj={ResourceRegistryTag:OSe};class L0 extends tn("@logixjs/core/ReplayLog")(){}ae(function*(){return yield*(yield*L0).snapshot});ae(function*(){yield*(yield*L0).resetCursor});const A6=e=>e?e.split(".").map(t=>/^[0-9]+$/.test(t)?Number(t):t):[],es=(e,t)=>{if(!t||e==null)return e;const n=A6(t);let r=e;for(const i of n){if(r==null)return;if(typeof i=="number"){r=Array.isArray(r)?r[i]:r[String(i)];continue}r=r[i]}return r},Bg=(e,t,n)=>{if(!t)return;const r=A6(t);if(r.length===0)return;let i=e;for(let a=0;a<r.length-1;a++){const c=r[a],u=r[a+1],d=i?.[c];(d==null||typeof d!="object")&&(i[c]=typeof u=="number"?[]:{}),i=i[c]}const o=r[r.length-1];i[o]=n},O6=e=>{const t=typeof e=="string"?e.trim():"";if(!t)return;const n=t.split(".").filter(Boolean);let r=-1;for(let c=0;c<n.length;c++)n[c].endsWith("[]")&&(r=c);if(r<0)return;const i=c=>c.endsWith("[]")?c.slice(0,-2):c,o=n.slice(0,r+1).map(i).join("."),a=n.slice(r+1).map(i).join(".");return{listPath:o,itemPath:a}},Dm=(e,t,n)=>n?`${e}.${t}.${n}`:`${e}.${t}`,$0=(e,t)=>{if(!e||typeof e!="object")return;const n=t.split(".");let r=e;for(const i of n){if(r==null)return;r=r[i]}return r},Yj=(e,t)=>{const n=new Map;for(let r=0;r<e.length;r++){const i=e[r],o=n.get(i)??[];o.push(r),n.set(i,o)}for(let r=0;r<t.length;r++){const i=t[r],o=n.get(i);if(!o||o.length===0)continue;if(o.shift()!==r)return!0}return!1},Qj=(e,t)=>e.every(n=>$0(n,t)!==void 0),DSe=(e,t,n)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is($0(e[r],n),$0(t[r],n)))return!1;return!0},PSe=(e,t,n,r)=>{const i=r??(()=>{let h=0;return()=>(h+=1,`r${h}`)})();if(!e)return{ids:t.map(()=>i()),removed:[]};if(e.itemsRef===t)return{ids:e.ids,removed:[]};if(e.itemsRef.length===t.length){if(n){if(Qj(e.itemsRef,n)&&Qj(t,n)){if(DSe(e.itemsRef,t,n))return{ids:e.ids,removed:[]}}else if(!Yj(e.itemsRef,t))return{ids:e.ids,removed:[]}}else if(!Yj(e.itemsRef,t))return{ids:e.ids,removed:[]}}const a=h=>{if(!n)return h;const p=$0(h,n);return p!==void 0?p:h},c=new Map;for(let h=0;h<e.itemsRef.length;h++){const p=a(e.itemsRef[h]),y=c.get(p)??[];y.push(e.ids[h]),c.set(p,y)}const u=[];for(let h=0;h<t.length;h++){const p=a(t[h]),y=c.get(p);y&&y.length>0?u.push(y.shift()):u.push(i())}const d=[];for(const h of c.values())d.push(...h);return{ids:u,removed:d}},NSe=e=>{const t=new Map;for(let n=0;n<e.length;n++)t.set(e[n],n);return t};class LSe{constructor(t){this.instanceId=t}lists=new Map;removalListeners=new Map;rowIdIndex=new Map;nextRowSeq=0;listKey=(t,n)=>n?`${t}@@${n}`:t;makeRowId=()=>(this.nextRowSeq+=1,this.instanceId?`${this.instanceId}::r${this.nextRowSeq}`:`r${this.nextRowSeq}`);notifyRemoved(t,n){const r=this.removalListeners.get(t);if(!(!r||r.size===0))for(const i of r)try{i(n)}catch{}}removeDescendants(t){const n=[];for(const[r,i]of this.lists.entries())i.parentRowId===t&&n.push(r);for(const r of n){const i=this.lists.get(r);if(i){this.lists.delete(r);for(let o=0;o<i.ids.length;o++){const a=i.ids[o];this.rowIdIndex.delete(a),this.notifyRemoved(i.listPath,a),this.removeDescendants(a)}}}}onRemoved(t,n){const r=this.removalListeners.get(t)??new Set;return r.add(n),this.removalListeners.set(t,r),()=>{const i=this.removalListeners.get(t);i&&(i.delete(n),i.size===0&&this.removalListeners.delete(t))}}getRowId(t,n,r){const i=this.lists.get(this.listKey(t,r));return i?i.ids[n]:void 0}getIndex(t,n){const r=this.rowIdIndex.get(n);if(r&&r.listPath===t)return r.index}ensureList(t,n,r,i){const o=this.listKey(t,i),a=this.lists.get(o),{ids:c,removed:u}=PSe(a,n,r??a?.trackBy,this.makeRowId),d={listPath:t,parentRowId:i,itemsRef:n,ids:c,indexById:NSe(c),trackBy:r??a?.trackBy};if(this.lists.set(o,d),u.length>0)for(const h of u)this.rowIdIndex.delete(h),this.notifyRemoved(t,h),this.removeDescendants(h);for(let h=0;h<c.length;h++){const p=c[h];this.rowIdIndex.set(p,{key:o,listPath:t,index:h})}return c}updateAll(t,n){const r=new Map,i=[];for(const y of n){if(!y||typeof y.path!="string")continue;const g=y.path.trim();g&&(r.set(g,y),i.push(g))}const o=new Set(i),a=y=>{const g=y.split(".").filter(Boolean);let v;for(let S=1;S<g.length;S++){const x=g.slice(0,S).join(".");o.has(x)&&(v=x)}return v},c=new Map,u=new Map,d=new Map;for(const y of i){const g=a(y);c.set(y,g);const v=g?y.slice(g.length+1):y;u.set(y,v);const S=d.get(g)??[];S.push(y),d.set(g,S)}const h=(d.get(void 0)??[]).slice().sort((y,g)=>y.localeCompare(g)),p=(y,g,v)=>{const S=r.get(y),x=Array.isArray(v)?v:[],k=this.ensureList(y,x,S?.trackBy,g),_=(d.get(y)??[]).slice().sort((E,M)=>E.localeCompare(M));if(_.length!==0)for(let E=0;E<x.length;E++){const M=x[E],D=k[E];if(D)for(const T of _){const C=u.get(T)??"",O=C?es(M,C):void 0;p(T,D,O)}}};for(const y of h){const g=es(t,y);p(y,void 0,g)}}}const $Se=e=>{const t=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];if(!r||typeof r!="object"||r._tag!=="StateTraitList")continue;const o=r.identityHint?.trackBy;t.push({path:n,trackBy:typeof o=="string"?o:void 0})}return t},jC=e=>ft(pl).pipe(Qe(t=>Pe(t)?t.value.local.once(e):!0)),Pv=(e,t=10)=>e.length===0?"":e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")}, …(+${e.length-t})`,Xj=e=>ae(function*(){const t=`${e.instanceId??"unknown"}::${e.kind}::${e.fieldPath}`;(yield*jC(`deps_mismatch:${t}`))&&(yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"state_trait::deps_mismatch",severity:"warning",message:`[deps] ${e.kind} "${e.fieldPath}" declared=[${Pv(e.diff.declared)}] reads=[${Pv(e.diff.reads)}] missing=[${Pv(e.diff.missing)}] unused=[${Pv(e.diff.unused)}]`,hint:'deps is the single source of truth for dependencies: incremental scheduling / reverse closures / performance optimizations rely on deps only. Keep deps consistent with actual reads; if you really depend on the whole object, declare a coarser-grained dep (e.g. "profile") to cover sub-field reads.',kind:`deps_mismatch:${e.kind}`}))}),Jj=()=>ft(Vy).pipe(Qe(e=>Pe(e)?e.value.stack:[])),j0=(e,t,n,r,i,o)=>{const a=Fi(t)??[];try{ld(e).txn.recordStatePatch(a,n,r,i,o)}catch{}},ec=(e,t)=>{try{ld(e).txn.recordReplayEvent(t)}catch{}},mm=e=>{try{const t=ld(e);return{moduleId:t.moduleId,instanceId:t.instanceId}}catch{return{moduleId:void 0,instanceId:void 0}}},Z1=(e,t,n,r,i,o)=>ae(function*(){let a=!1;return yield*e.state.mutate(c=>{const u=es(c,t);Object.is(u,n)||(a=!0,Bg(c,t,n),j0(e,t,r,u,n,o))}),a}),Nv=(e,t,n,r,i,o,a,c)=>ae(function*(){let u=!1;return yield*e.state.mutate(d=>{const h=es(d,t);if((h&&typeof h=="object"?h.keyHash:void 0)!==n)return;const y=h;Object.is(y,r)||(u=!0,Bg(d,t,r),c&&ec(e,c),j0(e,t,i,y,r,a))}),u}),jSe=(e,t)=>Ze(()=>{const n=t.getDraft(),r=[];for(const a of e.entries){if(a.kind!=="source")continue;const c=a.fieldPath,u=O6(c);if(u){const y=es(n,u.listPath),g=Array.isArray(y)?y:[];for(let v=0;v<g.length;v++){const S=g[v];let x;try{x=a.meta.key(S)}catch{continue}if(x!==void 0)continue;const k=Dm(u.listPath,v,u.itemPath),_=es(n,k);if((_&&typeof _=="object"?_.status:void 0)==="idle"){const M=_?.data,D=_?.error;if(M===void 0&&D===void 0)continue}r.push({fieldPath:k,prev:_})}continue}let d;try{d=a.meta.key(n)}catch{continue}if(d!==void 0)continue;const h=es(n,c);if((h&&typeof h=="object"?h.status:void 0)==="idle"){const y=h?.data,g=h?.error;if(y===void 0&&g===void 0)continue}r.push({fieldPath:c,prev:h})}if(r.length===0)return;const i="source-refresh",o=Iw(n,a=>{for(const c of r)Bg(a,c.fieldPath,Wo.idle())});t.setDraft(o);for(const a of r){const c=Fi(a.fieldPath)??[];t.recordPatch(c,i,a.prev,Wo.idle(),`source:${a.fieldPath}:idle`)}}),FSe=(e,t,n)=>{if(!t.targetFieldPath)return he;const r=t.targetFieldPath,i=t.resourceId??n.meta.resource,o=O6(r);let a;try{a=ld(e)}catch{return he}const c=a.traits.registerSourceRefresh,u=(S,x,k)=>{if(!x||S!=="live")return he;const _=k&&typeof k=="object"&&k._tag==="ResourceSnapshot"?k:{_tag:"ResourceSnapshot",resourceId:i,fieldPath:k.fieldPath,keyHash:k.keyHash,concurrency:k.concurrency,phase:k.phase,snapshot:k.snapshot,timestamp:Date.now(),moduleId:k.moduleId,instanceId:k.instanceId};return x.record(_)};if(o){const S=a.traits.rowIdStore;if(!S)return he;const x=o.listPath,k=o.itemPath;if(!k)return he;const E=n.meta.concurrency??"switch",M=new Map,D=new Map;let T=0;S.onRemoved(x,I=>{D.delete(I),M.delete(I)});const C=(I,L,P,B)=>ae(function*(){let $;return yield*e.state.mutate(V=>{const j=S.getIndex(x,I);if(j===void 0)return;const K=Dm(x,j,k),G=es(V,K);Object.is(G,L)||($=K,Bg(V,K,L),j0(e,K,P,G,L,t.debugInfo?.graphNodeId))}),$}),O=(I,L,P,B,$,V)=>ae(function*(){let j;return yield*e.state.mutate(K=>{const G=S.getIndex(x,I);if(G===void 0)return;const J=Dm(x,G,k),F=es(K,J);if((F&&typeof F=="object"?F.keyHash:void 0)!==L)return;const Q=F;if(!Object.is(Q,P)){if(j=J,Bg(K,J,P),V){const{moduleId:z,instanceId:ne}=mm(e);ec(e,{_tag:"ResourceSnapshot",resourceId:i,fieldPath:J,keyHash:L,concurrency:E,phase:V,snapshot:P,timestamp:Date.now(),moduleId:z,instanceId:ne})}j0(e,J,B,Q,P,t.debugInfo?.graphNodeId)}}),j}),q=(I,L,P,B,$)=>ae(function*(){const{moduleId:V,instanceId:j}=mm(e),K=S.getIndex(x,I),G=K===void 0?void 0:Dm(x,K,k);let J=Wo.loading({keyHash:P});if(B==="replay"&&$&&G){const ne=yield*$.consumeNextResourceSnapshot({resourceId:i,fieldPath:G,keyHash:P,phase:"loading"});ne&&(J=ne.snapshot)}const F=yield*C(I,J,"source-refresh");if(F){const ne={_tag:"ResourceSnapshot",resourceId:i,fieldPath:F,keyHash:P,concurrency:E,phase:"loading",snapshot:J,timestamp:Date.now(),moduleId:V,instanceId:j};ec(e,ne),yield*u(B,$,ne)}const U=ae(function*(){if(B==="replay"&&$){yield*wc();const xe=F??G;if(!xe)return yield*he;const ke=yield*$.consumeNextResourceSnapshot({resourceId:i,fieldPath:xe,keyHash:P});return ke?(ke.phase==="success"?yield*O(I,P,ke.snapshot,"source-refresh",`source:${r}:${I}:success`,"success"):ke.phase==="error"&&(yield*O(I,P,ke.snapshot,"source-refresh",`source:${r}:${I}:error`,"error")),yield*he):yield*he}const ne=yield*Jj(),ce=yield*ft(Gj.ResourceRegistryTag),ee=(Pe(ce)?ce.value:void 0)?.specs.get(i);if(!ee)return yield*he;const me=ee.load(L),fe={moduleId:V,instanceId:j,fieldPath:r,resourceId:i,key:L,keyHash:P,rowId:I,traitNodeId:t.debugInfo?.graphNodeId,stepId:t.id};if(!(typeof fe.opSeq=="number"&&Number.isFinite(fe.opSeq))){const xe=yield*ft(pl);if(Pe(xe)){const ke=j??"global";fe.opSeq=xe.value.local.nextSeq("opSeq",ke)}}const ye=jg({kind:"service",name:i,effect:me,meta:fe}),ie=yield*en(Fg(ye,ne));if(ie._tag==="Success"){const xe=Wo.success({keyHash:P,data:ie.value}),ke=yield*O(I,P,xe,"source-refresh",`source:${r}:${I}:success`,"success");ke&&(yield*u(B,$,{_tag:"ResourceSnapshot",resourceId:i,fieldPath:ke,keyHash:P,concurrency:E,phase:"success",snapshot:xe,timestamp:Date.now(),moduleId:V,instanceId:j}))}else{const xe=Wo.error({keyHash:P,error:ie.cause}),ke=yield*O(I,P,xe,"source-refresh",`source:${r}:${I}:error`,"error");ke&&(yield*u(B,$,{_tag:"ResourceSnapshot",resourceId:i,fieldPath:ke,keyHash:P,concurrency:E,phase:"error",snapshot:xe,timestamp:Date.now(),moduleId:V,instanceId:j}))}}).pipe(zt(()=>he)),Q=yield*Vn(lr(os,!1)(U)),z=T+=1;M.set(I,{gen:z,fiber:Q,keyHash:P}),yield*Vn(lr(os,!1)(vc(Q).pipe(rt(Ze(()=>{const ne=M.get(I);ne&&ne.gen===z&&M.delete(I)})),rt(E==="exhaust-trailing"?ae(function*(){const ne=D.get(I);D.delete(I),ne&&(yield*q(I,ne.key,ne.keyHash,B,$))}):he),zt(()=>he))))});return c(r,I=>ae(function*(){const{moduleId:L,instanceId:P}=mm(e),B=yield*ft(mj),$=Pe(B)?B.value.mode:"live",V=yield*ft(L0),j=Pe(V)?V.value:void 0,K=yield*ut(CC),G=es(I,x),J=Array.isArray(G)?G:[],F=S.ensureList(x,J),U=`${P??"unknown"}::source::${r}`;if(Sn()&&(yield*jC(`deps_trace_settled:${U}`)))try{const Q=J[0];if(Q!==void 0){const ne=RC(Z=>n.meta.key(Z),Q).reads.map(Z=>Z?`${x}[].${Z}`:`${x}[]`),ce=MC(n.meta.deps??[],ne);ce&&(yield*Xj({moduleId:L,instanceId:P,kind:"source",fieldPath:r,diff:ce}))}}catch{}for(let Q=0;Q<J.length;Q++){const z=F[Q];if(!z)continue;const ne=Dm(x,Q,k),ce=es(I,ne);let Z;try{Z=n.meta.key(J[Q])}catch{Z=void 0}const ee=M.get(z);if(Z===void 0){if(D.delete(z),M.delete(z),ce&&typeof ce=="object"&&ce.status==="idle"&&ce.data===void 0&&ce.error===void 0)continue;const ye=Wo.idle(),ie=yield*C(z,ye,"source-refresh");if(ie){const xe={_tag:"ResourceSnapshot",resourceId:i,fieldPath:ie,keyHash:void 0,concurrency:E,phase:"idle",snapshot:ye,timestamp:Date.now(),moduleId:L,instanceId:P};ec(e,xe),yield*u($,j,xe)}continue}const me=Wj(Z);if(!K&&ee&&ee.keyHash===me)continue;const fe=ce&&typeof ce=="object"?ce.keyHash:void 0;if(!(!K&&!ee&&fe===me)){if(E==="exhaust-trailing"&&ee){D.set(z,{key:Z,keyHash:me});const ye=Wo.loading({keyHash:me}),ie=yield*C(z,ye,"source-refresh");if(ie){const xe={_tag:"ResourceSnapshot",resourceId:i,fieldPath:ie,keyHash:me,concurrency:E,phase:"loading",snapshot:ye,timestamp:Date.now(),moduleId:L,instanceId:P};ec(e,xe),yield*u($,j,xe)}continue}E==="switch"&&ee&&(D.delete(z),M.delete(z)),yield*q(z,Z,me,$,j)}}})),he}let d,h=0,p;const g=n.meta.concurrency??"switch",v=(S,x,k,_)=>ae(function*(){const{moduleId:E,instanceId:M}=mm(e);let D=Wo.loading({keyHash:x});if(k==="replay"&&_){const I=yield*_.consumeNextResourceSnapshot({resourceId:i,fieldPath:r,keyHash:x,phase:"loading"});I&&(D=I.snapshot)}if(yield*Z1(e,r,D,"source-refresh",`source:${r}:loading`,t.debugInfo?.graphNodeId)){const I={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:x,concurrency:g,phase:"loading",snapshot:D,timestamp:Date.now(),moduleId:E,instanceId:M};ec(e,I),yield*u(k,_,I)}const C=ae(function*(){if(k==="replay"&&_){yield*wc();const G=yield*_.consumeNextResourceSnapshot({resourceId:i,fieldPath:r,keyHash:x});if(!G)return yield*he;if(G.phase==="success"){const J={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:x,concurrency:g,phase:"success",snapshot:G.snapshot,timestamp:Date.now(),moduleId:E,instanceId:M};yield*Nv(e,r,x,G.snapshot,"source-refresh",`source:${r}:success`,t.debugInfo?.graphNodeId,J)}else if(G.phase==="error"){const J={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:x,concurrency:g,phase:"error",snapshot:G.snapshot,timestamp:Date.now(),moduleId:E,instanceId:M};yield*Nv(e,r,x,G.snapshot,"source-refresh",`source:${r}:error`,t.debugInfo?.graphNodeId,J)}return yield*he}const I=yield*Jj(),L=yield*ft(Gj.ResourceRegistryTag),B=(Pe(L)?L.value:void 0)?.specs.get(i);if(!B)return yield*he;const $=B.load(S),V={moduleId:E,instanceId:M,fieldPath:r,resourceId:i,key:S,keyHash:x,traitNodeId:t.debugInfo?.graphNodeId,stepId:t.id};if(!(typeof V.opSeq=="number"&&Number.isFinite(V.opSeq))){const G=yield*ft(pl);if(Pe(G)){const J=M??"global";V.opSeq=G.value.local.nextSeq("opSeq",J)}}const j=jg({kind:"trait-source",name:i,effect:$,meta:V}),K=yield*en(Fg(j,I));if(K._tag==="Success"){const G=Wo.success({keyHash:x,data:K.value}),J={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:x,concurrency:g,phase:"success",snapshot:G,timestamp:Date.now(),moduleId:E,instanceId:M};(yield*Nv(e,r,x,G,"source-refresh",`source:${r}:success`,t.debugInfo?.graphNodeId,J))&&(yield*u(k,_,J))}else{const G=Wo.error({keyHash:x,error:K.cause}),J={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:x,concurrency:g,phase:"error",snapshot:G,timestamp:Date.now(),moduleId:E,instanceId:M};(yield*Nv(e,r,x,G,"source-refresh",`source:${r}:error`,t.debugInfo?.graphNodeId,J))&&(yield*u(k,_,J))}}).pipe(zt(()=>he)),O=yield*Vn(lr(os,!1)(C)),q=h+=1;d={gen:q,fiber:O,keyHash:x},yield*Vn(lr(os,!1)(vc(O).pipe(rt(Ze(()=>{d&&d.gen===q&&(d=void 0)})),rt(g==="exhaust-trailing"?ae(function*(){const I=p;p=void 0,I&&(yield*v(I.key,I.keyHash,k,_))}):he),zt(()=>he))))});return c(r,S=>ae(function*(){const{moduleId:x,instanceId:k}=mm(e),_=yield*ft(mj),E=Pe(_)?_.value.mode:"live",M=yield*ft(L0),D=Pe(M)?M.value:void 0,T=yield*ut(CC);let C;try{C=n.meta.key(S)}catch{C=void 0}const O=`${k??"unknown"}::source::${r}`;if(Sn()&&(yield*jC(`deps_trace_settled:${O}`)))try{const I=RC(P=>n.meta.key(P),S),L=MC(n.meta.deps??[],I.reads);L&&(yield*Xj({moduleId:x,instanceId:k,kind:"source",fieldPath:r,diff:L}))}catch{}if(C===void 0){d&&(yield*x0(d.fiber),d=void 0),p=void 0;const I=Wo.idle();if(yield*Z1(e,r,I,"source-refresh",`source:${r}:idle`,t.debugInfo?.graphNodeId)){const P={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:void 0,concurrency:g,phase:"idle",snapshot:I,timestamp:Date.now(),moduleId:x,instanceId:k};ec(e,P),yield*u(E,D,P)}return}const q=Wj(C);if(!T){if(d&&d.keyHash===q)return;const I=es(S,r),L=I&&typeof I=="object"?I.keyHash:void 0,P=I&&typeof I=="object"?I.status:void 0;if(P&&P!=="idle"&&L===q)return}if(g==="exhaust-trailing"&&d){p={key:C,keyHash:q};const I=Wo.loading({keyHash:q});if(yield*Z1(e,r,I,"source-refresh",`source:${r}:loading`,t.debugInfo?.graphNodeId)){const P={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:q,concurrency:g,phase:"loading",snapshot:I,timestamp:Date.now(),moduleId:x,instanceId:k};ec(e,P),yield*u(E,D,P)}return}g==="switch"&&d&&(yield*x0(d.fiber),d=void 0,p=void 0),yield*v(C,q,E,D)})),he},Zj=Symbol.for("@logixjs/core/dirtyAllSetStateHint"),zSe=e=>{if(!e||typeof e!="object")return;const t=e,n=t.sliceStart,r=t.sliceEnd;if(typeof n!="number"||typeof r!="number"||!Number.isFinite(n)||!Number.isFinite(r))return;const i=Math.floor(n),o=Math.floor(r);if(!(i<0||o<=i))return{start:i,end:o}},BSe=e=>{const{moduleId:t,optionsModuleId:n,instanceId:r,stateRef:i,commitHub:o,shouldPublishCommitHub:a,recordStatePatch:c,onCommit:u,enqueueTransaction:d,runOperation:h,txnContext:p,traitConvergeTimeSlicing:y,traitRuntime:g,resolveTraitConvergeConfig:v,isDevEnv:S,maxTxnHistory:x,txnHistory:k,txnById:_}=e,E=ae(function*(){const C=yield*ut(os),O=p.current;return C&&O?O.draft:yield*Xm(i)}),M=(C,O)=>lr(os,!0)(ae(function*(){const q=yield*Xm(i);Fbe(p,C,q);const I=p.current;I.stateTraitValidateRequests=[],I.commitMode="normal",I.priority="normal";const L=p.current?.txnId,P=p.current?.txnSeq;let B;try{B=yield*en(lr(i6,L)(ae(function*(){let $;if(S()){const j=yield*aH(O()),K=5;let G=yield*iC(j);for(let F=0;F<K&&vn(G);F++)yield*wc(),G=yield*iC(j);vn(G)&&(yield*it({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:P,txnId:L,trigger:C,code:"state_transaction::async_escape",severity:"error",message:"Synchronous StateTransaction body escaped the transaction window (async/await detected).",hint:"No IO/await/sleep/promises inside the transaction window; use run*Task (pending → IO → writeback) or move async logic outside the transaction.",kind:"async_in_transaction"}));const J=yield*vc(j);yield*ji(J,{onFailure:F=>gr(F),onSuccess:()=>he})}else yield*O();const V=g.getProgram();if(V&&p.current){const j=yield*v();y.latestConvergeConfig=j;const K=j.traitConvergeTimeSlicing,G=C.kind==="trait:deferred_flush",J=V.convergeExecIr!=null&&V.convergeExecIr.topoOrderDeferredInt32.length>0,F=K.enabled===!0&&J,U=G?"deferred":F?"immediate":"all",Q=G?zSe(C.details):void 0,z=Q&&V.convergeExecIr?V.convergeExecIr.topoOrderDeferredInt32.subarray(Q.start,Q.end):void 0,ne=yield*en(Xve(V,{moduleId:n,instanceId:r,txnSeq:P,txnId:L,configScope:j.configScope,now:p.config.now,budgetMs:j.traitConvergeBudgetMs,decisionBudgetMs:j.traitConvergeDecisionBudgetMs,requestedMode:z?"full":j.traitConvergeMode,schedulingScope:U,...z?{schedulingScopeStepIds:z}:{},dirtyAllReason:p.current?.dirtyAllReason,dirtyPaths:p.current?.dirtyPathIds,allowInPlaceDraft:p.current!=null&&!Object.is(p.current.draft,p.current.baseState),planCache:g.getConvergePlanCache(),generation:g.getConvergeGeneration(),cacheMissReasonHint:g.getPendingCacheMissReason(),getDraft:()=>p.current.draft,setDraft:me=>{Za(p,me)},recordPatch:(me,fe,ye,ie,xe,ke)=>c(me,fe,ye,ie,xe,ke)}));if(g.getPendingCacheMissReason()==="generation_bumped"&&g.setPendingCacheMissReason(void 0),ne._tag==="Failure"){const fe=[...v0(ne.cause),..._h(ne.cause)].find(ye=>ye instanceof IC);if(fe){const ye=fe.fields??[];yield*it({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:P,txnId:L,trigger:C,code:"state_trait::config_error",severity:"error",message:fe.message,hint:fe.code==="CYCLE_DETECTED"?`computed/link graph has a cycle: ${ye.join(", ")}`:`multiple writers detected for the same field: ${ye.join(", ")}`,kind:`state_trait_config_error:${fe.code}`})}return yield*gr(ne.cause)}const ce=ne.value,Z=p.current?.dirtyAllReason,ee=F&&!G&&!Z?Array.from(p.current.dirtyPathIds):void 0;if(F&&!G&&ce._tag!=="Degraded"&&(Z!=null||ee!=null&&ee.length>0)){const me=Date.now();if(y.firstPendingAtMs=y.firstPendingAtMs??me,y.lastTouchedAtMs=me,Z!=null)y.backlogDirtyAllReason=Z,y.backlogDirtyPaths.clear();else if(!y.backlogDirtyAllReason&&ee)for(const Ke of ee)y.backlogDirtyPaths.add(Ke);const fe=yield*ut(kc),ye=yield*ut(Ei),ie=yield*ut(ro),xe=yield*ft(hc),ke=Pe(xe)?xe.value:void 0;y.capturedContext={runtimeLabel:fe,diagnosticsLevel:ye,debugSinks:ie,overrides:ke},yield*sr(y.signal,void 0)}$=ce.decision?{converge:ce.decision}:void 0,ce._tag==="Degraded"&&(yield*it({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:P,code:ce.reason==="budget_exceeded"?"trait::budget_exceeded":"trait::runtime_error",severity:"warning",message:ce.reason==="budget_exceeded"?"Trait converge exceeded budget; derived fields are frozen for this operation window.":"Trait converge failed at runtime; derived fields are frozen for this operation window.",hint:ce.reason==="budget_exceeded"?"Check whether computed/check contains heavy computation; move it to source/task or split into cacheable derived pieces.":"Check computed/link/check for invalid inputs or impure logic; add equals or guards if needed.",kind:"trait_degraded"}))}if(V&&p.current){const j=G=>{if(G.length<=1)return G;const J={submit:4,blur:3,valueChange:2,manual:1};let F="manual",U=J[F],Q=!1;for(const Z of G){const ee=J[Z.mode];ee>U&&(U=ee,F=Z.mode),Z.target.kind==="root"&&(Q=!0)}if(Q)return[{mode:F,target:{kind:"root"}}];const z=Z=>{switch(Z.kind){case"field":return`field:${Z.path}`;case"list":return`list:${Z.path}`;case"item":return`item:${Z.path}:${Z.index}:${Z.field??""}`;case"root":return"root"}},ne=[],ce=new Map;for(const Z of G){const ee=z(Z.target),me=ce.get(ee);if(!me){ce.set(ee,Z),ne.push(ee);continue}J[Z.mode]>J[me.mode]&&ce.set(ee,{...me,mode:Z.mode})}return ne.map(Z=>ce.get(Z)).filter(Boolean)},K=p.current.stateTraitValidateRequests;if(K&&K.length>0){const G=j(K);yield*RSe(V,{moduleId:n,instanceId:r,txnSeq:p.current.txnSeq,txnId:p.current.txnId,origin:p.current.origin,rowIdStore:g.rowIdStore,listConfigs:g.getListConfigs(),getDraft:()=>p.current.draft,setDraft:J=>{Za(p,J)},recordPatch:(J,F,U,Q,z,ne)=>c(J,F,U,Q,z,ne)},G)}}V&&p.current&&(yield*jSe(V,{moduleId:n,instanceId:r,getDraft:()=>p.current.draft,setDraft:j=>{Za(p,j)},recordPatch:(j,K,G,J,F,U)=>c(j,K,G,J,F,U)})),yield*h("state","state:update",{meta:{moduleId:n,instanceId:r}},ae(function*(){const j=p.current?.lastReplayEvent,K=p.current?.commitMode??"normal",G=p.current?.priority??"normal",J=p.current?p.current[Zj]===!0:!1,F=yield*zbe(p,i);if(F){if((J||F.origin.kind==="state"&&F.origin.name==="setState")&&S()&&F.dirtySet?.dirtyAll===!0&&(yield*it({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:F.txnSeq,txnId:F.txnId,trigger:F.origin,code:"state_transaction::dirty_all_fallback",severity:"warning",message:"setState/state.update did not provide field-level dirty-set evidence; falling back to dirtyAll scheduling.",hint:"Prefer $.state.mutate(...) or Logix.Module.Reducer.mutate(...) to produce field-level patchPaths; otherwise converge/validate degrades to full-path scheduling.",kind:"dirty_all_fallback:set_state"})),(S()||p.config.instrumentation==="full")&&(k.push(F),_.set(F.txnId,F),k.length>x)){const me=k.shift();me&&_.delete(me.txnId)}const Q=F.finalStateSnapshot!==void 0?F.finalStateSnapshot:yield*Xm(i),z=g.getListConfigs();z.length>0&&g.rowIdStore.updateAll(Q,z);const ne={txnSeq:F.txnSeq,txnId:F.txnId,commitMode:K,priority:G,originKind:F.origin.kind,originName:F.origin.name};(!a||a())&&(yield*sl(o,{value:Q,meta:ne}));const ce=yield*ut(Ei);u&&ce==="off"&&(yield*u({state:Q,meta:ne,dirtySet:F.dirtySet,diagnosticsLevel:ce}));const Z=yield*ut(ro);if(Z.length>0&&!bA(Z)){const me=ce!=="off",fe=me?(()=>{const ie=V?.convergeIr;if(!(!ie||ie.configError))return A0(ie)})():void 0,ye=me?(()=>{const ie=ce==="full"?32:3;if(F.dirtySet.dirtyAll)return{dirtyAll:!0,reason:F.dirtySet.reason??"unknownWrite",rootIds:[],rootCount:0,keySize:0,keyHash:0,rootIdsTruncated:!1};const xe=F.dirtySet.rootIds;return{dirtyAll:!1,rootIds:xe.slice(0,ie),rootCount:F.dirtySet.rootCount,keySize:F.dirtySet.keySize,keyHash:F.dirtySet.keyHash,rootIdsTruncated:xe.length>ie}})():void 0;yield*it({type:"state:update",moduleId:n,state:Q,instanceId:r,txnSeq:F.txnSeq,txnId:F.txnId,staticIrDigest:fe,dirtySet:ye,patchCount:F.patchCount,patchesTruncated:F.patchesTruncated,...F.patchesTruncated?{patchesTruncatedReason:F.patchesTruncatedReason}:null,commitMode:K,priority:G,originKind:F.origin.kind,originName:F.origin.name,traitSummary:$,replayEvent:j})}u&&ce!=="off"&&(yield*u({state:Q,meta:ne,dirtySet:F.dirtySet,diagnosticsLevel:ce}))}}))})))}finally{}if(B._tag==="Failure")return Bbe(p),yield*gr(B.cause)}));return{readState:E,setStateInternal:(C,O,q,I,L,P,B)=>ae(function*(){if((yield*ut(os))&&p.current){const V=p.current;Za(p,C),c(O,q,I,L,P,B),O==="*"&&(V[Zj]=!0);return}yield*d(h("state","state:update",{payload:C,meta:{moduleId:t,instanceId:r}},M({kind:"state",name:"setState"},()=>Ze(()=>{Za(p,C),c(O,q,I,L,P,B)}))))}),runWithStateTransaction:M,__logixGetExecVmAssemblyEvidence:()=>{const O=g.getProgram()?.convergeIr;return!O||O.configError?void 0:{convergeStaticIrDigest:A0(O),convergeGeneration:O.generation}}}},USe=e=>e==="unbounded"?"unbounded":Lg(e),qSe=e=>()=>ae(function*(){const c=yield*ft(h6),u=yield*ft(mbe),d=Pe(c)?c.value:void 0,h=Pe(u)?u.value:void 0;let p=16,y="builtin",g=16,v="builtin",S=4096,x=!1,k="builtin",_=1e3,E=5e3,M=3e4,D="builtin";const T=(B,$)=>{if(!B)return;let V=!1;const j=USe(B.concurrencyLimit);j&&(p=j,y=$,j!=="unbounded"&&(g=j,v=$),V=!0);const K=Lg(B.losslessBackpressureCapacity);K!=null&&(S=K,V=!0);const G=$g(B.allowUnbounded);G!=null&&(x=G,k=$,V=!0);const J=B.pressureWarningThreshold;if(J&&typeof J=="object"){const U=Lg(J.backlogCount);U!=null&&(_=U,V=!0);const Q=rl(J.backlogDurationMs);Q!=null&&(E=Q,V=!0)}const F=rl(B.warningCooldownMs);F!=null&&(M=F,V=!0),V&&(D=$)},C=e.moduleId,O=C&&d?.overridesByModuleId?d.overridesByModuleId[C]:void 0,q=C&&h?.overridesByModuleId?h.overridesByModuleId[C]:void 0;T(d,"runtime_default"),T(O,"runtime_module"),T(h,"provider"),T(q,"provider");const I=p,L=y;typeof p=="string"&&!x&&(p=g,y=v);const P={concurrencyLimit:p,losslessBackpressureCapacity:S,allowUnbounded:x,pressureWarningThreshold:{backlogCount:_,backlogDurationMs:E},warningCooldownMs:M,configScope:D,concurrencyLimitScope:y,requestedConcurrencyLimit:I,requestedConcurrencyLimitScope:L,allowUnboundedScope:k};return e.diagnostics&&(yield*e.diagnostics.emitUnboundedPolicyIfNeeded({policy:P,trigger:{kind:"concurrencyPolicy",name:"resolve"}})),P}),vf=MS,Lv=$g,VSe=e=>{const t=Lv(e.stateTransaction?.txnLanes?.enabled)??!0,n=vf(e.stateTransaction?.txnLanes?.budgetMs)??1,r=vf(e.stateTransaction?.txnLanes?.debounceMs)??0,i=vf(e.stateTransaction?.txnLanes?.maxLagMs)??50,o=Lv(e.stateTransaction?.txnLanes?.allowCoalesce)??!0,a=e.stateTransaction?.txnLanes?.yieldStrategy==="inputPending"?"inputPending":"baseline";return()=>ae(function*(){const c=yield*ft(Cw),u=yield*ft(hc),d=Pe(c)?c.value:void 0,h=Pe(u)?u.value:void 0;let p=t,y=n,g=r,v=i,S=o,x=a,k,_="builtin";const E=(q,I)=>{if(!q)return;const L=q.txnLanes!=null?q.txnLanes:q;if(!L||typeof L!="object")return;let P=!1;const B=Lv(L.enabled);B!=null&&(p=B,P=!0);const $=L.overrideMode;($==="forced_off"||$==="forced_sync")&&(k=$,P=!0);const V=vf(L.budgetMs);V!=null&&(y=V,P=!0);const j=vf(L.debounceMs);j!=null&&(g=j,P=!0);const K=vf(L.maxLagMs);K!=null&&(v=K,P=!0);const G=Lv(L.allowCoalesce);G!=null&&(S=G,P=!0);const J=L.yieldStrategy;(J==="baseline"||J==="inputPending")&&(x=J,P=!0),P&&(_=I)},M=e.moduleId,D=M&&d?.txnLanesOverridesByModuleId?d.txnLanesOverridesByModuleId[M]:void 0,T=M&&h?.txnLanesOverridesByModuleId?h.txnLanesOverridesByModuleId[M]:void 0;E(d,"runtime_default"),E(D,"runtime_module"),E(h,"provider"),E(T,"provider");const C=k?!1:p;return{enabled:C,...k?{overrideMode:k}:{},configScope:_,budgetMs:y,debounceMs:g,maxLagMs:v,allowCoalesce:S,yieldStrategy:x,queueMode:C?"lanes":"fifo"}})},Ql=rl,eF=e=>e==="auto"||e==="full"||e==="dirty"?e:void 0,tF=e=>typeof e=="boolean"?e:void 0,HSe=e=>{const t=Ql(e.stateTransaction?.traitConvergeBudgetMs)??200,n=Ql(e.stateTransaction?.traitConvergeDecisionBudgetMs)??.5,r=eF(e.stateTransaction?.traitConvergeMode)??"auto",i=tF(e.stateTransaction?.traitConvergeTimeSlicing?.enabled)??!1,o=Ql(e.stateTransaction?.traitConvergeTimeSlicing?.debounceMs)??16,a=Ql(e.stateTransaction?.traitConvergeTimeSlicing?.maxLagMs)??200;return()=>ae(function*(){const c=yield*ft(Cw),u=yield*ft(hc),d=Pe(c)?c.value:void 0,h=Pe(u)?u.value:void 0;let p=r,y=t,g=n,v=i,S=o,x=a,k="builtin";const _=(T,C)=>{if(!T)return;let O=!1;const q=eF(T.traitConvergeMode);q&&(p=q,O=!0);const I=Ql(T.traitConvergeBudgetMs);I!=null&&(y=I,O=!0);const L=Ql(T.traitConvergeDecisionBudgetMs);L!=null&&(g=L,O=!0);const P=T.traitConvergeTimeSlicing;if(P&&typeof P=="object"){const B=tF(P.enabled);B!=null&&(v=B,O=!0);const $=Ql(P.debounceMs);$!=null&&(S=$,O=!0);const V=Ql(P.maxLagMs);V!=null&&(x=V,O=!0)}O&&(k=C)},E=e.moduleId,M=E&&d?.traitConvergeOverridesByModuleId?d.traitConvergeOverridesByModuleId[E]:void 0,D=E&&h?.traitConvergeOverridesByModuleId?h.traitConvergeOverridesByModuleId[E]:void 0;return _(d,"runtime_default"),_(M,"runtime_module"),_(h,"provider"),_(D,"provider"),{traitConvergeMode:p,traitConvergeBudgetMs:y,traitConvergeDecisionBudgetMs:g,traitConvergeTimeSlicing:{enabled:v,debounceMs:S,maxLagMs:x},configScope:k}})},nF=e=>{const t=new Set;for(const n of e){const r=n.trim();r&&t.add(r)}return Array.from(t).sort((n,r)=>n.localeCompare(r))},D6=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),F0=(e,t)=>{if(e===null)return null;if(typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(!(t>=6)){if(Array.isArray(e)){const n=[];for(const r of e){const i=F0(r,t+1);i!==void 0&&n.push(i)}return n}if(D6(e)){const n=Object.keys(e).sort(),r={};for(const i of n){const o=F0(e[i],t+1);o!==void 0&&(r[i]=o)}return r}}},PA=e=>{if(e==null||typeof e!="object"||Array.isArray(e))return;const t=e,n={},r=d=>{const h=t[d];if(typeof h!="string")return;const p=h.trim();p&&(n[d]=p)};r("label"),r("description"),r("group"),r("docsUrl"),r("cacheGroup");const i=t.canonical;typeof i=="boolean"&&(n.canonical=i);const o=t.tags;if(typeof o=="string"){const d=nF([o]);d.length>0&&(n.tags=d)}else if(Array.isArray(o)){const d=nF(o.filter(h=>typeof h=="string"));d.length>0&&(n.tags=d)}const a={},c=Object.keys(t).filter(d=>d.startsWith("x-")).sort((d,h)=>d.localeCompare(h));for(const d of c){const h=F0(t[d],0);h!==void 0&&(a[d]=h)}const u=t.annotations;if(D6(u)){const d=Object.keys(u).filter(h=>h.startsWith("x-")).sort((h,p)=>h.localeCompare(p));for(const h of d){const p=F0(u[h],0);p!==void 0&&(a[h]=p)}}return Object.keys(a).length>0&&(n.annotations=a),Object.keys(n).length>0?n:void 0},rF=e=>{const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];return JSON.stringify(t)},iF=(e,t)=>e===t?!0:!e||!t?!1:rF(e)===rF(t),KSe=(e,t)=>{const n=e.meta;if(!n)return{meta:t.meta,origin:t.origin,conflicts:e.conflicts};if(iF(n,t.meta))return e;const r=[...e.conflicts??[]],i=c=>{r.some(d=>d.origin===c.origin&&iF(d.meta,c.meta))||r.push(c)},o=n.canonical===!0,a=t.meta.canonical===!0;return!o&&a?(i({origin:e.origin??"unknown",meta:n}),{meta:t.meta,origin:t.origin,conflicts:r}):(i({origin:t.origin,meta:t.meta}),{meta:n,origin:e.origin??t.origin,conflicts:r})},WSe=e=>{const t=[],n=u=>typeof u=="object"&&u!==null&&u._tag==="StateTraitNode",r=u=>typeof u=="object"&&u!==null&&u._tag==="StateTraitList",i=(u,d)=>u?d?`${u}.${d}`:u:d,o=(u,d)=>!u||u.length===0?[]:u.map(h=>d?i(d,h):h),a=(u,d,h)=>{if(u.kind==="computed"){const p=u.meta,y=p.deps,g=y!==void 0?o(y,h):void 0;return{...u,fieldPath:d,meta:{...p,deps:g}}}if(u.kind==="source"){const p=u.meta,y=p.deps,g=y!==void 0?o(y,h):void 0;return{...u,fieldPath:d,meta:{...p,deps:g,_fieldPath:d}}}if(u.kind==="link"){const p=u.meta,y=o([p.from],h)[0]??p.from;return{...u,fieldPath:d,meta:{...p,from:y}}}return{...u,fieldPath:d}},c=(u,d,h,p)=>{const y=(v,S)=>{const x=S.fieldPath??v,k=d?i(d,String(x)):String(x);t.push(a(S,k,d))},g=v=>{if(!v)return;if(typeof v.kind=="string"){y("",v);return}const S=v;for(const x in S){if(!Object.prototype.hasOwnProperty.call(S,x))continue;const k=S[x];k&&y(x,k)}};if(g(h.computed),g(h.source),g(h.link),h.check){const v={},S=p?.checkDepsPrefix??(d.endsWith("[]")?d:""),x=k=>!k||k.length===0?[]:k.map(_=>_===""?u:S?i(S,_):_);for(const k of Object.keys(h.check)){const _=h.check[k];if(typeof _=="function"){v[k]=_;continue}if(_&&typeof _=="object"){const E=PA(_.meta);v[k]={..._,deps:x(_.deps),meta:E};continue}}t.push({fieldPath:u,kind:"check",meta:{rules:v,writeback:{kind:"errors"}}})}};for(const u in e){if(!Object.prototype.hasOwnProperty.call(e,u))continue;const d=e[u];if(!d)continue;if(r(d)){const y=u;d.item&&c(`${y}[]`,`${y}[]`,d.item),d.list&&c(y,y,d.list,{checkDepsPrefix:`${y}[]`});continue}if(n(d)){u==="$root"?c("$root","",d):c(u,u,d);continue}const h=d,p=h.fieldPath??u;t.push(a(h,String(p),""))}return t},GSe=e=>{const t=new Map,n=o=>typeof o=="object"&&o!==null&&o._tag==="StateTraitNode",r=o=>typeof o=="object"&&o!==null&&o._tag==="StateTraitList",i=(o,a)=>{const c=PA(a.meta);c&&t.set(o,c)};for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const a=e[o];if(a){if(r(a)){const c=o;a.item&&i(`${c}[]`,a.item),a.list&&i(c,a.list);continue}if(n(a)){i(o==="$root"?"$root":o,a);continue}}}return t},oF=()=>typeof globalThis.performance<"u"&&typeof globalThis.performance.now=="function"?globalThis.performance.now():Date.now(),OS=e=>e.kind==="computed"?e.meta?.deps??[]:[e.meta.from],YSe=e=>{const t=new Map;for(const c of e){const u=t.get(c.fieldPath);if(u)return{order:[],configError:{code:"MULTIPLE_WRITERS",message:`[StateTrait.converge] Multiple writers for field "${c.fieldPath}" (${u.kind} + ${c.kind}).`,fields:[c.fieldPath]}};t.set(c.fieldPath,c)}const n=new Set;for(const c of e)n.add(c.fieldPath);const r=new Map,i=new Map;for(const c of n)r.set(c,0),i.set(c,[]);for(const c of e){const u=c.fieldPath,d=OS(c);for(const h of d)n.has(h)&&(i.get(h).push(u),r.set(u,(r.get(u)??0)+1))}const o=[];for(const[c,u]of r.entries())u===0&&o.push(c);const a=[];for(;o.length;){const c=o.shift();a.push(c);const u=i.get(c);for(const d of u){const h=(r.get(d)??0)-1;r.set(d,h),h===0&&o.push(d)}}if(a.length!==n.size){const c=Array.from(n).filter(u=>!a.includes(u));return{order:[],configError:{code:"CYCLE_DETECTED",message:`[StateTrait.converge] Cycle detected in computed/link graph: ${c.join(", ")}`,fields:c}}}return{order:a}},QSe=e=>{const t=new Map,n=i=>{const o=Fi(i);o&&t.set(JSON.stringify(o),o)},r=(i,o,a)=>{let c=i;for(;;){if(aM(c)){if(a.has(c))return;a.add(c),c=c.f();continue}if(Hu(c)){c=c.from;continue}break}if(lM(c)){r(c.to,o,a),r(c.from,o,a);return}if(cy(c)){for(const u of c.types)r(u,o,a);return}if(iM(c)){for(const u of c.elements)r(u.type,o,a);for(const u of c.rest)r(u.type,o,a);return}if(oM(c)){for(const u of c.propertySignatures){const d=String(u.name);if(!d)continue;const h=[...o,d];n(h),r(u.type,h,a)}return}};return r(e.ast,[],new Set),Array.from(t.values()).sort(xA)},XSe=(e,t)=>{const n=oF(),r=0,i=t.filter(M=>M.kind==="computed"||M.kind==="link"),o=i.map(M=>`${M.kind}:${M.fieldPath}`).sort().join("|"),a=i.map(M=>{const D=OS(M).slice().sort().join(","),T=M.meta?.scheduling==="deferred"?"d":"i";return`${M.kind}:${M.fieldPath}@${T}=>${D}`}).sort().join("|"),c=new Map;for(const M of i)c.set(M.fieldPath,M);const u=i.length>0?YSe(i):{order:[]},d=u.configError?[]:u.order.map(M=>c.get(M)),h=new Map,p=M=>{for(let D=1;D<=M.length;D++){const T=M.slice(0,D),C=JSON.stringify(T);h.has(C)||h.set(C,T)}};for(const M of QSe(e))p(M);for(const M of i){const D=Fi(M.fieldPath);D&&p(D);for(const T of OS(M)){const C=Fi(T);C&&p(C)}}const y=Array.from(h.values()).sort(xA),g=ybe(y),v=ip(_c(y)),S=[],x=[],k=[];for(const M of d){const D=Fi(M.fieldPath),T=D!=null?R0(g,D):void 0;if(T==null)throw new Error(`[StateTrait.build] Failed to map converge output fieldPath "${M.fieldPath}" to FieldPathId.`);const C=[];for(const O of OS(M)){const q=Fi(O);if(!q)continue;const I=R0(g,q);I!=null&&C.push(I)}S.push(T),x.push(C),k.push(M.meta?.scheduling==="deferred"?"deferred":"immediate")}const _=d.map((M,D)=>D),E=Math.max(0,oF()-n);return{generation:r,writersKey:o,depsKey:a,fieldPathsKey:v,fieldPaths:y,fieldPathIdRegistry:g,...u.configError?{configError:u.configError}:null,stepsById:d,stepOutFieldPathIdByStepId:S,stepDepsFieldPathIdsByStepId:x,stepSchedulingByStepId:k,topoOrder:_,buildDurationMs:E}},JSe=e=>{const t=[];if(e.kind==="computed"){const r=e.meta.deps;r&&t.push(...r)}else if(e.kind==="source"){const r=e.meta.deps;r&&t.push(...r)}else if(e.kind==="link")t.push(e.meta.from);else if(e.kind==="check"){const r=e.meta?.rules??{};for(const i of Object.keys(r)){const o=r[i];if(o&&typeof o=="object"){const a=o.deps;a&&t.push(...a)}}}return{fieldId:e.fieldPath,kind:e.kind,meta:e.meta,deps:t}},ZSe=(e,t)=>{const n=new Map,r=[],i=[],o=new Map,a=[],c=h=>{let p=n.get(h);return p||(p={id:h,path:h,traits:[]},n.set(h,p)),p};for(const h of e){const p=h.fieldPath,y=c(p),g=JSe(h);if(y.traits.push(g),h.kind==="computed"){const v=`computed:${p}`;a.push({id:v,kind:"computed-update",targetFieldPath:p});const S=h.meta.deps;if(S)for(const x of S)c(x),i.push({id:`computed:${x}->${p}`,from:x,to:p,kind:"computed"})}else if(h.kind==="link"){const v=h.meta.from;c(v);const S=`link:${v}->${p}`;i.push({id:S,from:v,to:p,kind:"link"}),a.push({id:`link:${p}`,kind:"link-propagate",targetFieldPath:p,sourceFieldPaths:[v],debugInfo:{graphEdgeId:S}})}else if(h.kind==="source"){const v=h.meta.resource,S=PA(h.meta.meta),x=o.get(v);if(x){const _=[...x.ownerFields,p];let E=x.meta,M=x.metaOrigin,D=x.metaConflicts;if(S){const T=KSe({meta:E,origin:M,conflicts:D},{origin:p,meta:S});E=T.meta,M=T.origin,D=T.conflicts}o.set(v,{...x,ownerFields:_,meta:E,metaOrigin:M,metaConflicts:D})}else o.set(v,{resourceId:v,keySelector:`StateTrait.source@${p}`,ownerFields:[p],meta:S,metaOrigin:S?p:void 0});a.push({id:`source:${p}`,kind:"source-refresh",targetFieldPath:p,resourceId:v,keySelectorId:`StateTrait.source@${p}`});const k=h.meta.deps;if(k)for(const _ of k)c(_),i.push({id:`source-dep:${_}->${p}`,from:_,to:p,kind:"source-dep"})}else if(h.kind==="check"&&(a.push({id:`check:${p}`,kind:"check-validate",targetFieldPath:p}),g.deps.length>0))for(const v of g.deps)c(v),i.push({id:`check-dep:${v}->${p}`,from:v,to:p,kind:"check-dep"})}for(const h of n.values())r.push({id:h.id,field:h,traits:h.traits,meta:t.get(h.id)});return{graph:{_tag:"StateTraitGraph",nodes:r,edges:i,resources:Array.from(o.values())},plan:{_tag:"StateTraitPlan",steps:a}}},e0e=e=>{const t=new Map;for(const o of e){if(o.kind!=="link")continue;const a=t.get(o.from)??[];a.push(o.to),t.set(o.from,a)}const n=new Set,r=new Set,i=o=>{if(r.has(o))throw new Error(`[StateTrait.build] link cycle detected at field "${o}". Please check link traits for circular dependencies.`);if(n.has(o))return;n.add(o),r.add(o);const a=t.get(o);if(a)for(const c of a)i(c);r.delete(o)};for(const o of t.keys())n.has(o)||i(o)},t0e=e=>{const t=new Map,n=i=>{if(!i.path)return;const o=`${i.kind}|${i.entryKind}|${i.entryFieldPath}|${i.ruleName??""}|${i.path}`;t.set(o,i)},r=i=>{const o=i.meta?.writeback,a=o&&typeof o=="object"?o.path:void 0,c=typeof a=="string"&&a.startsWith("errors.")?a:void 0;if(c)return c;const u=i.fieldPath;return u.endsWith("[]")?`errors.${u.slice(0,-2)}`:`errors.${u}`};for(const i of e){if(n({kind:"fieldPath",entryKind:i.kind,entryFieldPath:i.fieldPath,path:i.fieldPath}),i.kind==="computed"||i.kind==="source"){const o=i.meta?.deps??[];for(const a of o)n({kind:"dep",entryKind:i.kind,entryFieldPath:i.fieldPath,path:a})}if(i.kind==="link"&&n({kind:"link_from",entryKind:"link",entryFieldPath:i.fieldPath,path:i.meta.from}),i.kind==="check"){n({kind:"check_writeback",entryKind:"check",entryFieldPath:i.fieldPath,path:r(i)});const o=i.meta?.rules??{};for(const a of Object.keys(o)){const c=o[a];if(!c||typeof c!="object")continue;const u=c.deps??[];for(const d of u)n({kind:"dep",entryKind:"check",entryFieldPath:i.fieldPath,ruleName:a,path:d})}}}return Array.from(t.entries()).sort((i,o)=>i[0].localeCompare(o[0])).map(([,i])=>i)},P6=(e,t)=>{const n=WSe(t),r=GSe(t);for(const a of n){if(a.kind==="computed"&&a.meta.deps===void 0)throw new Error(`[StateTrait.build] Missing explicit deps for computed "${a.fieldPath}". Please use StateTrait.computed({ deps: [...], get: ... }).`);if(a.kind==="source"&&a.meta.deps===void 0)throw new Error(`[StateTrait.build] Missing explicit deps for source "${a.fieldPath}". Please provide meta.deps for StateTrait.source({ deps: [...], ... }).`);if(a.kind==="check"){const c=a.meta?.rules??{};for(const u of Object.keys(c)){const d=c[u];if(typeof d=="function"||!d||typeof d!="object")throw new Error(`[StateTrait.build] Missing explicit deps for check "${a.fieldPath}" rule "${u}". Please use { deps: [...], validate: ... } form.`);if(d.deps===void 0)throw new Error(`[StateTrait.build] Missing explicit deps for check "${a.fieldPath}" rule "${u}". Please provide deps: [...].`)}}}const{graph:i,plan:o}=ZSe(n,r);return e0e(i.edges),{stateSchema:e,spec:t,entries:n,graph:i,plan:o,convergeIr:XSe(e,n),schemaPaths:t0e(n)}},n0e=e=>Ze(()=>{const{runtime:t,runtimeInternals:n}=e;Ibe(t,n)});class r0e extends tn("@logixjs/core/RootContext")(){}const z0=r0e,NA=e=>{switch(e.type){case"app":return`app:${e.appId}`;case"moduleInstance":return`moduleInstance:${e.moduleId}::${e.instanceId}`;case"uiSubtree":return`uiSubtree:${e.subtreeId}`}},i0e=e=>`${e.processId}@@${NA(e.scope)}`,sF=e=>{const t=NA(e.identity.scope);return`process:${e.identity.processId}::${t}::r${e.runSeq}`},N6=4096,o0e=16,aF=(e,t)=>{const n=t?.defaultGuard??N6,r=typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):"unbounded";return{configured:r,guard:r==="unbounded"?n:r}},s0e=e=>ae(function*(){const t=e.policy,n=e.defaultQueueGuard??N6;if(t.mode==="latest"){const y=yield*Kn({fiber:void 0,runningId:0,nextId:0}),g=v=>ae(function*(){const S=e.assignTriggerSeq(v),[x,k,_]=yield*mr(y,M=>{const D=M.nextId+1;return[[M.fiber,M.runningId,D],{...M,nextId:D,runningId:D}]});if(x&&k!==0){const M=yield*iC(x);vn(M)&&(yield*x0(x))}const E=yield*Vn(e.run(S).pipe(_o(is(y,M=>M.runningId===_?{...M,runningId:0}:M))));yield*is(y,M=>({...M,fiber:E}))});return yield*ba(e.stream,g)}const r=yield*Kn(!1),i=yield*Kn({running:!1,queue:[],peak:0}),o=yield*Kn({active:0,queue:[],peak:0}),a=aF(t.maxQueue,{defaultGuard:n}),c=aF(void 0,{defaultGuard:n}),u=typeof t.maxParallel=="number"&&Number.isFinite(t.maxParallel)&&t.maxParallel>=1?Math.floor(t.maxParallel):e.defaultParallelLimit??o0e,d=()=>En(()=>mr(i,y=>{if(y.running||y.queue.length===0)return[Ae(),y];const[g,...v]=y.queue;return[Oe(g),{...y,running:!0,queue:v}]}).pipe(ze(y=>Xn(y,{onNone:()=>he,onSome:g=>Vn(e.run(g).pipe(_o(is(i,v=>({...v,running:!1}))),rt(d()))).pipe(fn)})))),h=()=>En(()=>mr(o,y=>{if(y.active>=u||y.queue.length===0)return[Ae(),y];const[g,...v]=y.queue;return[Oe(g),{...y,active:y.active+1,queue:v}]}).pipe(ze(y=>Xn(y,{onNone:()=>he,onSome:g=>Vn(e.run(g).pipe(_o(is(o,v=>({...v,active:Math.max(0,v.active-1)}))),rt(h()))).pipe(fn,rt(h()))})))),p=y=>ae(function*(){const g=e.assignTriggerSeq(y);if(t.mode==="drop"){if(!(yield*mr(r,x=>x?[!1,x]:[!0,!0]))){yield*e.onDrop(g);return}yield*Vn(e.run(g).pipe(_o(id(r,!1))));return}if(t.mode==="parallel"){const S=yield*mr(o,x=>{const k=[...x.queue,g];return[k.length,{...x,queue:k,peak:Math.max(x.peak,k.length)}]});if(S>c.guard){const x=yield*Ui(o);yield*e.onQueueOverflow({mode:"parallel",currentLength:S,peak:x.peak,limit:c,policy:t});return}yield*h();return}const v=yield*mr(i,S=>{const x=[...S.queue,g];return[x.length,{...S,queue:x,peak:Math.max(S.peak,x.length)}]});if(v>a.guard){const S=yield*Ui(i);yield*e.onQueueOverflow({mode:"serial",currentLength:v,peak:S.peak,limit:a,policy:t});return}yield*d()});return yield*ba(e.stream,p)}),L6=4*1024,a0e=50,l0e=1,c0e=e=>({maxEvents:a0e,maxBytes:L6,emitted:0,dropped:0,downgraded:0,summaryEmitted:!1}),u0e=e=>({type:"process:trigger",identity:e.sourceEvent.identity,trigger:e.sourceEvent.trigger,severity:"warning",eventSeq:e.sourceEvent.eventSeq,timestampMs:e.sourceEvent.timestampMs,error:{message:"Process run event budget exceeded; further trigger/dispatch events are suppressed.",code:"process::event_budget_exceeded",hint:`maxEvents=${e.maxEvents} maxBytes=${e.maxBytes} emitted=${e.emitted} dropped=${e.dropped} downgraded=${e.downgraded}`}}),d0e=(e,t)=>{const n=Math.max(0,e.maxEvents),r=Math.max(0,e.maxBytes);if(e.summaryEmitted)return[{_tag:"drop"},{...e,dropped:e.dropped+1}];const o=Math.max(0,n-l0e);if(e.emitted<o){const d=FC(t,{maxBytes:r});return[{_tag:"emit",event:d.event},{...e,emitted:e.emitted+1,downgraded:e.downgraded+(d.downgraded?1:0)}]}const a=e.dropped+1,c=u0e({sourceEvent:t,maxEvents:n,maxBytes:r,emitted:e.emitted,dropped:a,downgraded:e.downgraded}),u=FC(c,{maxBytes:r});return[{_tag:"emitSummary",event:u.event},{...e,emitted:Math.min(n,e.emitted+1),dropped:a,downgraded:e.downgraded+(u.downgraded?1:0),summaryEmitted:!0}]},lF=e=>{const t=JSON.stringify(e);return typeof Buffer<"u"?Buffer.byteLength(t,"utf8"):new TextEncoder().encode(t).length},B0=(e,t)=>e.length<=t?e:e.slice(0,t),f0e=e=>{const t=typeof e.message=="string"&&e.message.length>0?e.message:"Error",n=typeof e.hint=="string"&&e.hint.length>0?B0(e.hint,1024):void 0;return{name:typeof e.name=="string"&&e.name.length>0?e.name:void 0,message:B0(t,256),code:typeof e.code=="string"&&e.code.length>0?e.code:void 0,hint:n}},FC=(e,t)=>{const n=t?.maxBytes??L6;let r=!1,i=e;if(e.error){const u=f0e(e.error);(u.message!==e.error.message||u.hint!==e.error.hint||u.code!==e.error.code||u.name!==e.error.name)&&(r=!0,i={...e,error:u})}if(lF(i)<=n)return{event:i,downgraded:r};if(!i.error?.hint)return{event:i,downgraded:!0};const o=i.error.hint,a=[512,256,128,64,32,0];for(const u of a){const d=u===0?void 0:B0(o,u),h={...i,error:{...i.error,hint:d}};if(lF(h)<=n)return{event:h,downgraded:!0}}return{event:i.error?{...i,error:{...i.error,message:B0(i.error.message,96),hint:void 0}}:i,downgraded:!0}},$6=Symbol.for("@logixjs/core/processMeta"),h0e=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},p0e=e=>e[$6],m0e=(e,t)=>(h0e(e,$6,t),e),zC=e=>typeof e=="object"&&e!==null,g0e=e=>{if(!zC(e))return;const t=e.ast;if(t&&!(typeof t!="object"&&typeof t!="function"))return t},Pm=(e,t,n)=>{const r=new Error(t);return r.code="process::invalid_dot_path",r.hint=n??["Expected dot-path syntax: segments separated by '.', numeric segments represent array indices.",`path: ${e}`,"","examples:","- count","- user.name","- items.0.id"].join(`
43
+ `),r},y0e=e=>Pm(e,"Invalid dot-path: path does not match the state schema.",["The module state schema does not contain the requested dot-path.",`path: ${e}`,"","fix:","- Ensure the path exists in the state schema.","- Use numeric segments for array indices (e.g. items.0.id)."].join(`
44
+ `)),b0e=e=>{if(typeof e!="string"||e.length===0)return{ok:!1,error:Pm(String(e),"dot-path must be a non-empty string")};const t=e.split(".");if(t.length===0)return{ok:!1,error:Pm(e,"dot-path must contain at least one segment")};const n=[];for(let r=0;r<t.length;r++){const i=t[r];if(i.length===0)return{ok:!1,error:Pm(e,`Invalid dot-path: empty segment at index ${r}.`,["Expected dot-path syntax: segments separated by '.', numeric segments represent array indices.",`path: ${e}`,"","examples:","- count","- user.name","- items.0.id","","fix:","- Remove consecutive dots or trailing dots."].join(`
45
+ `))};if(/^[0-9]+$/.test(i)){const o=Number(i);if(!Number.isFinite(o)||o<0)return{ok:!1,error:Pm(e,`Invalid array index segment "${i}" at index ${r}.`)};n.push(Math.floor(o));continue}n.push(i)}return{ok:!0,segments:n}},tc=(e,t,n)=>{if(t.length===0)return e;let r=e;for(;;){if(aM(r)){if(n.has(r))return;n.add(r),r=r.f();continue}if(Hu(r)){r=r.from;continue}break}if(lM(r)){const o=tc(r.from,t,n);return o||tc(r.to,t,n)}if(cy(r)){for(const o of r.types){const a=tc(o,t,n);if(a)return a}return}if(iM(r)){const[o,...a]=t;if(typeof o!="number")return;const c=o<r.elements.length?r.elements[o]:r.rest.length>0?r.rest[0]:void 0;return c?tc(c.type,a,n):void 0}if(oM(r)){const[o,...a]=t;if(o===void 0)return;if(typeof o=="string"){for(const c of r.propertySignatures)if(String(c.name)===o)return tc(c.type,a,n)}for(const c of r.indexSignatures){let u=c.parameter;for(;Hu(u);)u=u.from;const d=u?._tag,h=d==="StringKeyword"||d==="TemplateLiteral",p=d==="NumberKeyword";if(typeof o=="string"&&h||typeof o=="number"&&p)return tc(c.type,a,n)}}const i=r?._tag;if(i==="AnyKeyword"||i==="UnknownKeyword"||i==="ObjectKeyword"||i==="Declaration")return r},v0e=e=>t=>{let n=t;for(const r of e){if(n==null)return;if(typeof r=="number"){if(Array.isArray(n)){n=n[r];continue}if(zC(n)){n=n[String(r)];continue}return}if(zC(n)){n=n[r];continue}return}return n},S0e=(e,t)=>{const n=b0e(e);return n.ok?t&&!tc(t,n.segments,new Set)?{ok:!1,error:y0e(e)}:{ok:!0,selector:v0e(n.segments),segments:n.segments}:{ok:!1,error:n.error}},x0e=()=>({failureTimes:[]}),w0e=(e,t,n)=>{if(e.mode==="failStop")return{decision:"stop",nextState:t,withinWindowFailures:t.failureTimes.length,maxRestarts:0,windowMs:e.windowMs};const r=e.maxRestarts,i=typeof r=="number"&&Number.isFinite(r)&&r>=0?Math.floor(r):0;if(i<=0)return{decision:"stop",nextState:t,withinWindowFailures:t.failureTimes.length,maxRestarts:i,windowMs:e.windowMs};const o=e.windowMs,a=typeof o=="number"&&Number.isFinite(o)&&o>0?Math.floor(o):void 0,c=[...t.failureTimes,n],u=a?c.filter(g=>g>=n-a):c,d=i+1,h=u.length>d?u.slice(u.length-d):u,p=h.length;return{decision:p<=i?"restart":"stop",nextState:{failureTimes:h},withinWindowFailures:p,maxRestarts:i,windowMs:a}};class LA extends tn("@logixjs/core/ProcessRuntime")(){}const cF=Oo(void 0),uF=Oo(void 0),eE="runtime:boot",k0e=e=>`process:${e}`,_0e=e=>{const t=e.trigger;if(!t)return{};if((t.kind==="moduleAction"||t.kind==="moduleStateChange")&&typeof t.instanceId=="string"&&typeof t.txnSeq=="number"&&Number.isFinite(t.txnSeq)&&t.txnSeq>=1){const n=Math.floor(t.txnSeq);return{txnSeq:n,txnId:`${t.instanceId}::t${n}`}}return{}},dF=(e,t)=>{const n=e.type==="moduleInstance"?e.moduleId:void 0,r=e.type==="moduleInstance"?e.instanceId:void 0;return _A({moduleId:n,instanceId:r,code:"process::invalid_usage",severity:"error",message:"ProcessRuntime scheduling is not allowed inside a synchronous StateTransaction body (it may deadlock the txnQueue).",hint:"Trigger/schedule Process outside the transaction window (e.g. in a watcher's run section or a separate fiber); do not trigger Process directly inside a reducer / synchronous transaction body.",kind:t})},E0e=e=>{try{const t=kA(e);return g0e(t.stateSchema)}catch{return}},T0e=(e,t)=>{const n=e.hint;return typeof n=="string"&&n.length>0?(n.includes("moduleId=")||(e.hint=`moduleId=${t}
46
+ ${n}`),e):(e.hint=`moduleId=${t}`,e)},tE=e=>{if(!e||typeof e!="object")return;const t=e;if(typeof t._tag=="string"&&t._tag.length>0)return t._tag;if(typeof t.type=="string"&&t.type.length>0)return t.type},C0e=e=>ae(function*(){const t=yield*NR,n=500,r=new Map,i=new Map,o=[],a=yield*Yhe(Math.max(1,Math.min(2048,n))),c=()=>{if(o.length<=n)return;const T=o.length-n;o.splice(0,T)},u=T=>ae(function*(){if((yield*ut(Ei))==="off")return;const O=T.identity.identity.processId,q=sF(T.identity),I=k0e(O),{txnSeq:L,txnId:P}=_0e(T);yield*it({type:T.type,moduleId:I,instanceId:q,identity:T.identity,severity:T.severity,eventSeq:T.eventSeq,timestampMs:T.timestampMs,trigger:T.trigger,dispatch:T.dispatch,error:T.error,txnSeq:L,txnId:P})}),d=T=>ae(function*(){o.push(T),c(),yield*sl(a,T),yield*u(T)}),h=T=>ae(function*(){const C=yield*ut(uF);if(C){const q=yield*mr(C,I=>{const[L,P]=d0e(I,T);return[L,P]});(q._tag==="emit"||q._tag==="emitSummary")&&(yield*d(q.event));return}const O=FC(T);yield*d(O.event)}),p=(T,C,O,q,I)=>{if(!Sn())return he;const L=T.type==="moduleInstance"?T.moduleId:void 0,P=T.type==="moduleInstance"?T.instanceId:void 0;return it({type:"diagnostic",moduleId:L,instanceId:P,code:O,severity:"error",message:q,hint:I,actionTag:C,kind:"process_runtime"})},y=T=>{const C=T.definition.requires??[],O=[];for(const L of T.definition.triggers)(L.kind==="moduleAction"||L.kind==="moduleStateChange")&&O.push(L.moduleId);const q=Array.from(new Set([...C,...O]));if(q.length===0)return[];const I=[];for(const L of q){if(typeof L!="string"||L.length===0)continue;const P=tn(`@logixjs/Module/${L}`)(),B=ts(T.env,P);vn(B)&&I.push(L)}return I},g=(T,C)=>ae(function*(){if(T.status.status==="stopped"||T.status.status==="failed"||T.status.status==="stopping")return;const O=T.fiber;T.status={...T.status,status:"stopping",stoppedReason:C},O&&(yield*fi(O)),yield*Ch(T.platformTriggersQueue),T.status={...T.status,status:"stopped",stoppedReason:C},T.fiber=void 0;const q={type:"process:stop",identity:T.identity,severity:"info",eventSeq:T.nextEventSeq++,timestampMs:Date.now()};yield*h(q);const I=r.get(T.installationKey);I?.pendingStart&&(I.pendingStart=void 0,yield*v(T.installationKey))}),v=T=>ae(function*(){const C=r.get(T);if(!C||(C.pendingStart=void 0,yield*dF(C.identity.scope,"process_start_in_transaction")))return;const q=C.currentInstanceId;if(q){const ie=i.get(q);if(ie&&(ie.status.status==="running"||ie.status.status==="starting"))return}const I=C.nextRunSeq++,L={identity:C.identity,runSeq:I},P=sF(L),B=yield*Xhe(64),$={installationKey:T,processInstanceId:P,identity:L,processId:C.identity.processId,scope:C.identity.scope,forkScope:C.forkScope,platformTriggersQueue:B,status:{identity:L,status:"starting"},nextEventSeq:1,nextTriggerSeq:1};i.set(P,$),C.currentInstanceId=P,C.forkScope!==t&&(yield*uc(C.forkScope,En(()=>{const ie=$.status.status;return ie==="stopped"||ie==="failed"||ie==="stopping"?he:g($,"scopeDisposed")}).pipe(zt(()=>he)))),yield*h({type:"process:start",identity:L,severity:"info",eventSeq:$.nextEventSeq++,timestampMs:Date.now()});const V=y(C);if(V.length>0){const ie=Sn()?["Strict scope dependency resolution: missing required modules in the current scope.",`missing: ${V.join(", ")}`,"","fix:","- Provide the missing module implementation(s) in the same scope via imports.",` Example: RootModule.implement({ imports: [${V[0]}.implement(...).impl], processes: [...] })`,"- Do not rely on cross-scope fallbacks / guessing instances."].join(`
47
+ `):void 0,xe={message:`Missing dependencies in scope: ${V.join(", ")}`,code:"process::missing_dependency",hint:ie};$.status={...$.status,status:"failed",stoppedReason:"failed",lastError:xe},yield*h({type:"process:error",identity:L,severity:"error",eventSeq:$.nextEventSeq++,timestampMs:Date.now(),error:xe}),yield*p(C.identity.scope,C.identity.processId,"process::missing_dependency",xe.message,ie);return}const j=C.definition.diagnosticsLevel!=="off",K=C.env,J=(()=>{if(!j)return K;const ie=C.definition.requires??[];if(ie.length===0)return K;const xe=Array.from(new Set(ie));let ke=K;for(const Ke of xe){if(typeof Ke!="string"||Ke.length===0)continue;const Xe=tn(`@logixjs/Module/${Ke}`)(),Je=ts(K,Xe);if(vn(Je))continue;const dt=Je.value,Ht=Ue=>ae(function*(){const Mn=yield*ut(cF);if(!Mn)return;const nn=tE(Ue)??"unknown",Rn=typeof dt.moduleId=="string"?dt.moduleId:Ke,pt=typeof dt.instanceId=="string"?dt.instanceId:"unknown",Zn={type:"process:dispatch",identity:L,trigger:Mn,dispatch:{moduleId:Rn,instanceId:pt,actionId:nn},severity:"info",eventSeq:$.nextEventSeq++,timestampMs:Date.now()};yield*h(Zn)}),Et={...dt,dispatch:Ue=>dt.dispatch(Ue).pipe(li(()=>Ht(Ue))),dispatchLowPriority:Ue=>dt.dispatchLowPriority(Ue).pipe(li(()=>Ht(Ue))),dispatchBatch:Ue=>dt.dispatchBatch(Ue).pipe(li(()=>sn(Ue,Ht,{discard:!0})))};ke=oc(Xe,Et)(ke)}return ke})(),F=Eh(C.process,J),U=ie=>ae(function*(){if(ie.kind==="timer"){const mt=Uee(ie.timerId);if(vn(mt)){const Le=new Error(`[ProcessRuntime] invalid timerId (expected DurationInput): ${ie.timerId}`);return Le.code="process::invalid_timer_id",Le.hint="timerId must be a valid DurationInput string, e.g. '10 millis', '1 seconds', '5 minutes'.",yield*Qa(Le)}return xye(mt.value).pipe(Rs(()=>({kind:"timer",name:ie.name,timerId:ie.timerId})))}if(ie.kind==="moduleAction"){const mt=tn(`@logixjs/Module/${ie.moduleId}`)(),Le=ts(K,mt);if(vn(Le))return yield*Qa(new Error(`Missing module runtime in scope: ${ie.moduleId}`));const tt=Le.value;if(!j){const oe=tt.actions$;if(!oe){const Me=new Error("ModuleRuntime does not provide actions$ (required for moduleAction trigger).");return Me.code="process::missing_action_stream",Me.hint=`moduleId=${ie.moduleId}`,yield*Qa(Me)}return oe.pipe(Es(Me=>tE(Me)===ie.actionId),Rs(()=>({kind:"moduleAction",name:ie.name,moduleId:ie.moduleId,instanceId:tt.instanceId,actionId:ie.actionId,txnSeq:1})))}const ln=tt.actionsWithMeta$;if(!ln){const oe=new Error("ModuleRuntime does not provide actionsWithMeta$ (required for moduleAction trigger).");return oe.code="process::missing_action_meta_stream",oe.hint=`moduleId=${ie.moduleId}`,yield*Qa(oe)}return ln.pipe(Es(oe=>tE(oe.value)===ie.actionId),Rs(oe=>{const Me=oe?.meta?.txnSeq;return{kind:"moduleAction",name:ie.name,moduleId:ie.moduleId,instanceId:tt.instanceId,actionId:ie.actionId,txnSeq:typeof Me=="number"?Me:1}}))}const xe=tn(`@logixjs/Module/${ie.moduleId}`)(),ke=ts(K,xe);if(vn(ke))return yield*Qa(new Error(`Missing module runtime in scope: ${ie.moduleId}`));const Ke=ke.value,Xe=E0e(Ke),Je=S0e(ie.path,Xe);if(!Je.ok)return yield*Qa(T0e(Je.error,ie.moduleId));const dt=Je.selector,Ht=yield*Kn(Ae()),Et=j,Ue=Et?yield*Kn({windowStartedMs:Date.now(),triggersInWindow:0,lastWarningAtMs:0}):void 0,Mn=127,nn=4,Rn=1e3,pt=Sn()?20:200,Zn=3e4;let ue=0,we=0,Ne=0,We=0;const Ve=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),Jt=Et?mt=>{if(ue+=1,(ue&Mn)!==0)return dt(mt);const Le=Ve(),tt=dt(mt),ln=Ve()-Le;return we+=1,ln>=nn&&(Ne+=1),ln>We&&(We=ln),tt}:dt,Gt=mt=>Ue?ae(function*(){const Le=Date.now(),tt=yield*mr(Ue,Me=>{const Be=Le-Me.windowStartedMs>=Rn,Ee=Be?Le:Me.windowStartedMs,De=Be?1:Me.triggersInWindow+1,Re=Le-Me.lastWarningAtMs<Zn,_e=De>=pt,Tt=We>=nn&&we>0,Hr=!Re&&(_e||Tt),ei=Hr?{windowStartedMs:Le,triggersInWindow:0,lastWarningAtMs:Le}:{...Me,windowStartedMs:Ee,triggersInWindow:De};return[{shouldWarn:Hr,tooFrequent:_e,tooSlow:Tt,triggersInWindow:De},ei]});if(!tt.shouldWarn)return;const ln=tt.tooFrequent?"process::selector_high_frequency":"process::selector_slow",oe=[`moduleId=${ie.moduleId}`,`path=${ie.path}`,`windowMs=${Rn}`,`triggersInWindow=${tt.triggersInWindow}`,`threshold=${pt}`,`cooldownMs=${Zn}`,"","selector sampling:",`calls=${ue}`,`sampled=${we}`,`slowSamples(>=${nn}ms)=${Ne}`,`maxSampleMs=${We.toFixed(2)}`,"","notes:","- Ensure the selected value is stable (prefer primitive/tuple; avoid returning fresh objects).","- Narrow the path to reduce change frequency; avoid selecting large objects."].join(`
48
+ `);we=0,Ne=0,We=0,yield*h({type:"process:trigger",identity:L,trigger:mt,severity:"warning",eventSeq:$.nextEventSeq++,timestampMs:Date.now(),error:{message:"moduleStateChange selector diagnostics warning",code:ln,hint:oe}})}):he,gt=Ke.changesWithMeta(Jt).pipe(Ng(mt=>Ui(Ht).pipe(ze(Le=>Pe(Le)&&Object.is(Le.value,mt.value)?on(Ae()):id(Ht,Oe(mt.value)).pipe(pi(Oe(mt)))))),pye(mt=>mt),Rs(mt=>{const Le=mt?.meta?.txnSeq;return{kind:"moduleStateChange",name:ie.name,moduleId:ie.moduleId,instanceId:Ke.instanceId,path:ie.path,txnSeq:typeof Le=="number"?Le:1}}));return Et?gt.pipe(vye(Gt)):gt}),Q=(ie,xe)=>lr(cF,ie)(F.pipe(zt(ke=>Km(ke)?he:hi(xe,ke).pipe(fn,Rg(()=>he))))),z=(ie,xe)=>j?ae(function*(){const ke=yield*Kn(c0e());return yield*lr(uF,ke)(ce(ie,"info").pipe(rt(Q(ie,xe))))}):Q(ie,xe),ne=ie=>j?{...ie,triggerSeq:$.nextTriggerSeq++}:ie,ce=(ie,xe)=>{if(!j)return he;const ke={type:"process:trigger",identity:L,trigger:ie,severity:xe,eventSeq:$.nextEventSeq++,timestampMs:Date.now()};return h(ke)},Z=C.definition.concurrency,ee=C.definition.triggers.some(ie=>ie.kind==="platformEvent"&&ie.platformEvent===eE),me=C.definition.triggers.find(ie=>ie.kind==="platformEvent"&&ie.platformEvent===eE),fe=ae(function*(){const ie=yield*br(),xe=yye($.platformTriggersQueue),ke=C.definition.triggers.filter(Et=>Et.kind!=="platformEvent"),Ke=yield*sn(ke,U),Xe=bye([xe,...Ke],{concurrency:"unbounded"}),dt=yield*Vn(s0e({stream:Xe,policy:Z,assignTriggerSeq:ne,run:Et=>z(Et,ie),onDrop:Et=>ce(Et,"warning"),onQueueOverflow:Et=>{const Ue=new Error("Process trigger queue overflow (serial maxQueue guard).");return Ue.code="process::serial_queue_overflow",Ue.hint=[`mode=${Et.mode}`,`queue: current=${Et.currentLength} peak=${Et.peak}`,`maxQueue: configured=${Et.limit.configured} guard=${Et.limit.guard}`,`policy: ${JSON.stringify(Et.policy)}`,"","fix:","- Configure concurrency.maxQueue (serial) to a finite value, or switch to mode=latest/drop to avoid unbounded backlog."].join(`
49
+ `),hi(ie,pw(Ue)).pipe(fn,Rg(()=>he))}}));ee&&(yield*sr($.platformTriggersQueue,{kind:"platformEvent",name:me?.name,platformEvent:eE}));const Ht=yield*Un(ie);return yield*fi(dt),yield*gr(Ht)}),ye=yield*no(C.forkScope)(bfe(fe).pipe(zt(ie=>ae(function*(){if(Km(ie)){if($.status.status==="stopping")return;$.status={...$.status,status:"stopped",stoppedReason:"scopeDisposed"},$.fiber=void 0,yield*sc(h({type:"process:stop",identity:L,severity:"info",eventSeq:$.nextEventSeq++,timestampMs:Date.now()}));const Je=r.get(T);Je?.pendingStart&&(Je.pendingStart=void 0,yield*v(T));return}const xe=On(_5(ie),()=>On(T5(ie),()=>ie)),Ke=Zs(xe).errorSummary;$.status={...$.status,status:"failed",stoppedReason:"failed",lastError:Ke},yield*h({type:"process:error",identity:L,severity:"error",eventSeq:$.nextEventSeq++,timestampMs:Date.now(),error:Ke});const Xe=w0e(C.definition.errorPolicy,C.supervision,Date.now());C.supervision=Xe.nextState,Xe.decision==="restart"?(yield*h({type:"process:restart",identity:L,severity:"warning",eventSeq:$.nextEventSeq++,timestampMs:Date.now(),error:Ke}),yield*v(T)):yield*p(C.identity.scope,C.identity.processId,"process::failed_stop","Process failed and stopped (failStop / restart limit reached).",`processId=${C.identity.processId} scopeKey=${C.scopeKey} failures=${Xe.withinWindowFailures} maxRestarts=${Xe.maxRestarts}`)}))));$.fiber=ye,$.status={...$.status,status:"running"},yield*wc()}),S=(T,C)=>ae(function*(){const O=p0e(T);if(!O)return;const q=yield*lH(),I=yield*ft(Kue),L=Pe(I)?I.value:t,P=NA(C.scope),B={processId:O.definition.processId,scope:C.scope},$=i0e(B),V=r.get($);if(V){if(V.env=q,V.forkScope=L,V.enabled=C.enabled??!0,V.installedAt=C.installedAt??V.installedAt,!V.enabled)return V.pendingStart=void 0,{identity:B,enabled:V.enabled,installedAt:V.installedAt};const G=V.currentInstanceId,J=G?i.get(G):void 0,F=J?.status.status;return F==="running"||F==="starting"?((C.mode??"switch")==="switch"&&J&&J.forkScope!==L?(V.pendingStart={forkScope:L},yield*uc(L,Ze(()=>{const Q=r.get($);Q&&Q.pendingStart?.forkScope===L&&(Q.pendingStart=void 0)}))):V.pendingStart=void 0,{identity:B,enabled:V.enabled,installedAt:V.installedAt}):F==="stopping"?((C.mode??"switch")==="switch"?(V.pendingStart={forkScope:L},yield*uc(L,Ze(()=>{const Q=r.get($);Q&&Q.pendingStart?.forkScope===L&&(Q.pendingStart=void 0)}))):V.pendingStart=void 0,{identity:B,enabled:V.enabled,installedAt:V.installedAt}):(V.pendingStart=void 0,yield*v($),{identity:B,enabled:V.enabled,installedAt:V.installedAt})}const j=En(()=>T);m0e(j,{...O,installationScope:C.scope});const K={identity:B,scopeKey:P,definition:O.definition,env:q,forkScope:L,process:j,kind:O.kind??"process",enabled:C.enabled??!0,installedAt:C.installedAt,nextRunSeq:1,supervision:x0e(),pendingStart:void 0};return r.set($,K),K.enabled&&(yield*v($)),{identity:B,enabled:K.enabled,installedAt:K.installedAt}}),x=T=>Ze(()=>{const C=T?.scopeType,O=T?.scopeKey,q=[];for(const I of r.values())C&&I.identity.scope.type!==C||O&&I.scopeKey!==O||q.push({identity:I.identity,enabled:I.enabled,installedAt:I.installedAt});return q}),k=T=>Ze(()=>i.get(T)?.status),_=(T,C)=>En(()=>{const O=i.get(T);return O?dF(O.scope,"process_control_in_transaction").pipe(ze(q=>{if(q)return he;if(C.action==="stop")return g(O,"manualStop");if(C.action==="restart")return g(O,"manualStop").pipe(ze(()=>{const I=r.get(O.installationKey);return I?(I.currentInstanceId=void 0,v(O.installationKey)):he}));if(C.action==="start"){if(O.status.status==="running"||O.status.status==="starting")return he;const I=r.get(O.installationKey);return I?(I.currentInstanceId=void 0,v(O.installationKey)):he}return he})):he}),E=T=>ae(function*(){if(yield*_A({code:"process::invalid_usage",severity:"error",message:"ProcessRuntime platform events are not allowed inside a synchronous StateTransaction body (it may deadlock the txnQueue).",hint:"Deliver platformEvent outside the transaction window.",kind:"process_platform_event_in_transaction"}))return;const O=Array.from(i.values()),q=T.eventName;yield*sn(O,I=>En(()=>{if(I.status.status!=="starting"&&I.status.status!=="running")return he;const L=r.get(I.installationKey);if(!L)return he;const P=L.definition.triggers.filter(B=>B.kind==="platformEvent"&&B.platformEvent===q);return P.length===0?he:sn(P,B=>sr(I.platformTriggersQueue,{kind:"platformEvent",name:B.name,platformEvent:B.platformEvent}),{discard:!0})}),{discard:!0})}),M=Am(a),D=()=>Ze(()=>o.slice());return yield*Cf(()=>ae(function*(){for(const T of r.values())T.pendingStart=void 0;for(const T of i.values())T.fiber&&(yield*g(T,"scopeDisposed"))}).pipe(zt(T=>Ze(()=>{Sn()&&console.warn("[ProcessRuntime] finalizer failed",Lc(T))})))),{install:S,listInstallations:x,getInstanceStatus:k,controlInstance:_,deliverPlatformEvent:E,events:M,getEventsSnapshot:D}}),I0e=e=>_0(LA,C0e());function j6(e){if(!e||typeof e!="object"&&typeof e!="function")return!1;const t=e;return typeof t.selectorId=="string"&&typeof t.select=="function"&&Array.isArray(t.reads)}const DS=e=>{const t=[],n=new Set;for(const r of e){const i=typeof r=="number"?`n:${r}`:`s:${r}`;n.has(i)||(n.add(i),t.push(r))}return t.slice().sort((r,i)=>String(r).localeCompare(String(i)))},M0e=e=>Number.parseInt(e,16),$v=e=>{const t=DS(e);return{count:t.length,hash:M0e(ip(_c(t)))}},jv=e=>`rq_${ip(_c(e))}`;let fF=0;const hF=new WeakMap,R0e=e=>{const t=hF.get(e);if(t)return t;fF+=1;const n=`rq_u${fF}`;return hF.set(e,n),n},F6=e=>{const t=e.trim();if(t.startsWith("(")&&t.endsWith(")")){const n=t.slice(1,-1).trim();if(!n.startsWith("(")||!n.endsWith(")"))return n}return t},A0e=e=>{const t=e.indexOf("=>");if(t<0)return;const n=e.slice(0,t).trim(),r=e.slice(t+2).trim(),i=F6(n);if(/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i)){if(r.startsWith("{")){const o=r.match(/^\{\s*return\s+(.+?);?\s*\}\s*$/s);return o?{param:i,body:o[1]?.trim()??""}:void 0}return{param:i,body:r}}},O0e=e=>{const n=e.trim().match(/^function\s*(?:[A-Za-z_$][A-Za-z0-9_$]*\s*)?\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*\)\s*\{\s*return\s+(.+?);?\s*\}\s*$/s);if(!n)return;const r=n[1]?.trim()??"";if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(r))return;const i=n[2]?.trim()??"";if(i.length!==0)return{param:r,body:i}},D0e=e=>{const t=A0e(e)??O0e(e);if(!t)return;const n=F6(t.body).trim().replace(/;$/,"").trim();{const r=new RegExp(`^${t.param}\\.([A-Za-z0-9_$]+(?:\\.[A-Za-z0-9_$]+)*)$`),i=n.match(r);if(i)return{kind:"path",path:i[1]}}if(n.startsWith("{")&&n.endsWith("}")){const r=n.slice(1,-1).trim();if(r.length===0)return{kind:"struct",entries:[]};const i=r.split(",").map(a=>a.trim()).filter(a=>a.length>0),o=[];for(const a of i){const c=a.indexOf(":");if(c<0)return;const u=a.slice(0,c).trim(),d=a.slice(c+1).trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(u))return;const h=new RegExp(`^${t.param}\\.([A-Za-z0-9_$]+(?:\\.[A-Za-z0-9_$]+)*)$`),p=d.match(h);if(!p)return;o.push([u,p[1]])}return o.sort((a,c)=>a[0].localeCompare(c[0])),{kind:"struct",entries:o}}},pF=2048,Fv=new WeakMap,nE=new Map,P0e=(e,t)=>{const n=e.get(t);if(n!==void 0)return e.delete(t),e.set(t,n),n},mF=(e,t,n,r)=>{if(e.has(t)&&e.delete(t),e.set(t,n),e.size<=r)return;const i=e.keys().next().value;i!==void 0&&e.delete(i)},N0e=e=>{try{return e.toString()}catch{return""}},z6=e=>{if(j6(e)){const g=DS(e.reads),v=g.length>0?$v(g):void 0,S=e.equalsKind,x={selectorId:e.selectorId,debugKey:e.debugKey,lane:"static",producer:"manual",reads:g,readsDigest:v,equalsKind:S};return{...e,reads:g,lane:"static",producer:"manual",readsDigest:v,staticIr:x}}const t=e,n=(typeof t?.debugKey=="string"&&t.debugKey.length>0?t.debugKey:void 0)??(typeof t.name=="string"&&t.name.length>0?t.name:void 0),r=Array.isArray(t?.fieldPaths)?t.fieldPaths.filter(g=>typeof g=="string"):void 0;if(r&&r.length>0){const g=DS(r),v=$v(g),S=jv({kind:"reads",reads:g});return{selectorId:S,debugKey:n,reads:g,select:t,equalsKind:"objectIs",lane:"static",producer:"jit",readsDigest:v,staticIr:{selectorId:S,debugKey:n,lane:"static",producer:"jit",reads:g,readsDigest:v,equalsKind:"objectIs"}}}const i=Fv.get(t);if(i){const g={selectorId:i.selectorId,debugKey:n,lane:"static",producer:"jit",reads:i.reads,readsDigest:i.readsDigest,equalsKind:i.equalsKind};return{selectorId:i.selectorId,debugKey:n,reads:i.reads,select:t,equalsKind:i.equalsKind,lane:"static",producer:"jit",readsDigest:i.readsDigest,staticIr:g}}const o=N0e(t).trim(),a=o.length>0?P0e(nE,o):void 0;if(a){Fv.set(t,a);const g={selectorId:a.selectorId,debugKey:n,lane:"static",producer:"jit",reads:a.reads,readsDigest:a.readsDigest,equalsKind:a.equalsKind};return{selectorId:a.selectorId,debugKey:n,reads:a.reads,select:t,equalsKind:a.equalsKind,lane:"static",producer:"jit",readsDigest:a.readsDigest,staticIr:g}}const c=o.length>0?D0e(o):void 0;if(c?.kind==="path"){const g=[c.path],v=$v(g),S=jv({kind:"path",path:c.path}),x={selectorId:S,reads:g,readsDigest:v,equalsKind:"objectIs"};return Fv.set(t,x),mF(nE,o,x,pF),{selectorId:S,debugKey:n,reads:g,select:t,equalsKind:"objectIs",lane:"static",producer:"jit",readsDigest:v,staticIr:{selectorId:S,debugKey:n,lane:"static",producer:"jit",reads:g,readsDigest:v,equalsKind:"objectIs"}}}if(c?.kind==="struct"){const g=DS(c.entries.map(([,_])=>_)),v=$v(g),S=jv({kind:"struct",entries:c.entries}),x={selectorId:S,reads:g,readsDigest:v,equalsKind:"shallowStruct"};return Fv.set(t,x),mF(nE,o,x,pF),{selectorId:S,debugKey:n,reads:g,select:t,equalsKind:"shallowStruct",lane:"static",producer:"jit",readsDigest:v,staticIr:{selectorId:S,debugKey:n,lane:"static",producer:"jit",reads:g,readsDigest:v,equalsKind:"shallowStruct"}}}const u=o.includes("=>")||o.startsWith("function")?"unsupportedSyntax":"missingDeps",d=o.length===0||o.includes("[native code]"),h=!n||d?"unstableSelectorId":u,p=h==="unstableSelectorId"?R0e(t):jv({kind:"dynamic",debugKey:n,src:o});return{selectorId:p,debugKey:n,reads:[],select:t,equalsKind:"objectIs",lane:"dynamic",producer:"dynamic",fallbackReason:h,staticIr:{selectorId:p,debugKey:n,lane:"dynamic",producer:"dynamic",fallbackReason:h,equalsKind:"objectIs"}}},gF=e=>{if(!e||e.length===0)return;const t=e.map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0},L0e=e=>{const t=e.config.mode==="warn"?"warning":"error";return{type:"diagnostic",moduleId:e.details.moduleId,instanceId:e.details.instanceId,txnSeq:e.details.txnSeq,code:"read_query::strict_gate",severity:t,message:`ReadQuery strict gate violated: selector entered dynamic lane (selectorId=${e.details.selectorId}, reason=${e.details.fallbackReason}).`,hint:"Fix: make the selector statically compilable (AOT/JIT) or pass an explicit ReadQuery; or disable/narrow the gate via RuntimeOptions.readQuery.strictGate.requireStatic / denyFallbackReasons.",kind:"read_query:strict_gate",trigger:{kind:"read_query",name:"strict_gate",details:e.details}}},$0e=e=>Object.assign(new Error(`[ReadQueryStrictGateError] selector entered dynamic lane (selectorId=${e.details.selectorId}, reason=${e.details.fallbackReason}).`),{_tag:"ReadQueryStrictGateError",details:e.details}),j0e=e=>{if(e.config.mode==="off")return{verdict:"PASS"};if(e.compiled.lane!=="dynamic")return{verdict:"PASS"};const t=e.compiled.fallbackReason??"missingDeps",r=!!e.config.denyFallbackReasons?.includes(t),i=gF(e.config.requireStatic?.selectorIds),o=gF(e.config.requireStatic?.modules),a=!!i||!!o,c=!!i?.includes(e.compiled.selectorId),u=!!o?.includes(e.moduleId);if(!r&&!(!a||c||u))return{verdict:"PASS"};const h=r?"denyFallbackReason":a?c?"requireStatic:selectorId":"requireStatic:module":"requireStatic:global",p={moduleId:e.moduleId,instanceId:e.instanceId,txnSeq:e.txnSeq,selectorId:e.compiled.selectorId,debugKey:e.compiled.debugKey,fallbackReason:t,rule:h},y=L0e({config:e.config,details:p});if(e.config.mode==="warn")return{verdict:"WARN",diagnostic:y,details:p};const g=$0e({details:p});return{verdict:"FAIL",diagnostic:y,error:g,details:p}},rE=e=>e[0]??"",yF=(e,t)=>TC(e,t)||TC(t,e),F0e=(e,t)=>{if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object"||Array.isArray(e)||Array.isArray(t))return!1;const n=e,r=t,i=Object.keys(n),o=Object.keys(r);if(i.length!==o.length)return!1;for(const a of i)if(!Object.prototype.hasOwnProperty.call(r,a)||!Object.is(n[a],r[a]))return!1;return!0},bF=(e,t,n)=>e.equalsKind==="custom"&&typeof e.equals=="function"?e.equals(t,n):e.equalsKind==="shallowStruct"?F0e(t,n):Object.is(t,n),zv=()=>{const e=globalThis.performance;return e&&typeof e.now=="function"?e.now():Date.now()},z0e=e=>{const{moduleId:t,instanceId:n,getFieldPathIdRegistry:r}=e,i=new Map,o=new Map;return{ensureEntry:d=>{const h=i.get(d.selectorId);return h?on(h):ae(function*(){const p=yield*C0(),y=d.reads.filter(S=>typeof S=="string").map(S=>Fi(S)).filter(S=>S!=null),g=Array.from(new Set(y.map(rE)));for(const S of g){const x=o.get(S);x?x.add(d.selectorId):o.set(S,new Set([d.selectorId]))}const v={selectorId:d.selectorId,readQuery:d,reads:y,readRootKeys:g,hub:p,subscriberCount:0,cachedAtTxnSeq:0,hasValue:!1,cachedValue:void 0};return i.set(d.selectorId,v),v})},releaseEntry:d=>{const h=i.get(d);if(h&&(h.subscriberCount=Math.max(0,h.subscriberCount-1),!(h.subscriberCount>0))){i.delete(d);for(const p of h.readRootKeys){const y=o.get(p);y&&(y.delete(d),y.size===0&&o.delete(p))}}},onCommit:(d,h,p,y)=>ae(function*(){if(i.size===0)return;const g=y==="light"||y==="full"||y==="sampled",v=p.dirtyAll||p.rootIds.length===0?void 0:r?.(),S=k=>{if(!v||!Number.isFinite(k))return;const _=Math.floor(k);if(_<0)return;const E=v.fieldPaths[_];return E&&Array.isArray(E)?E:void 0};if(i.size===1){const k=i.values().next().value;if(!k||k.subscriberCount===0||!(()=>{if(p.dirtyAll||k.reads.length===0||!v)return!0;for(const I of p.rootIds){const L=S(I);if(!L)return!0;const P=rE(L);if(!(k.readRootKeys.length>0&&!k.readRootKeys.includes(P))){for(const B of k.reads)if(yF(L,B))return!0}}return!1})())return;let E;const M=g?zv():void 0;try{E=k.readQuery.select(d)}catch{g&&(yield*it({type:"diagnostic",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,code:"read_query::eval_error",severity:"error",message:"ReadQuery selector threw during evaluation.",hint:"Selectors must be pure and not throw; check the selector implementation and inputs.",kind:"read_query_eval_error",trigger:{kind:"read_query",name:"selector:eval",details:{selectorId:k.selectorId}}}));return}const D=g&&M!=null?Math.max(0,zv()-M):void 0,T=k.hasValue,C=k.cachedValue,O=T?bF(k.readQuery,C,E):!1,q=!T||!O;q&&(k.cachedValue=E,k.hasValue=!0,k.cachedAtTxnSeq=h.txnSeq,yield*sl(k.hub,{value:k.cachedValue,meta:h})),g&&(yield*it({type:"trace:selector:eval",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,data:{selectorId:k.selectorId,lane:k.readQuery.lane,producer:k.readQuery.producer,fallbackReason:k.readQuery.fallbackReason,readsDigest:k.readQuery.readsDigest,equalsKind:k.readQuery.equalsKind,changed:q,evalMs:D}}));return}const x=new Set;if(p.dirtyAll)for(const[k,_]of i.entries())_.subscriberCount>0&&x.add(k);else if(v)for(const k of p.rootIds){const _=S(k);if(!_){for(const[D,T]of i.entries())T.subscriberCount>0&&x.add(D);break}const E=rE(_),M=o.get(E);if(M)for(const D of M){if(x.has(D))continue;const T=i.get(D);if(!(!T||T.subscriberCount===0)){if(T.reads.length===0){x.add(D);continue}for(const C of T.reads)if(yF(_,C)){x.add(D);break}}}}else for(const[k,_]of i.entries())_.subscriberCount>0&&x.add(k);if(x.size!==0)for(const k of x){const _=i.get(k);if(!_||_.subscriberCount===0)continue;let E;const M=g?zv():void 0;try{E=_.readQuery.select(d)}catch{g&&(yield*it({type:"diagnostic",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,code:"read_query::eval_error",severity:"error",message:"ReadQuery selector threw during evaluation.",hint:"Selectors must be pure and not throw; check the selector implementation and inputs.",kind:"read_query_eval_error",trigger:{kind:"read_query",name:"selector:eval",details:{selectorId:k}}}));continue}const D=g&&M!=null?Math.max(0,zv()-M):void 0,T=_.hasValue,C=_.cachedValue,O=T?bF(_.readQuery,C,E):!1,q=!T||!O;q&&(_.cachedValue=E,_.hasValue=!0,_.cachedAtTxnSeq=h.txnSeq,yield*sl(_.hub,{value:_.cachedValue,meta:h})),g&&(yield*it({type:"trace:selector:eval",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,data:{selectorId:k,lane:_.readQuery.lane,producer:_.readQuery.producer,fallbackReason:_.readQuery.fallbackReason,readsDigest:_.readQuery.readsDigest,equalsKind:_.readQuery.equalsKind,changed:q,evalMs:D}}))}})}},B6=new WeakMap,U6=new Map,B0e=(e,t)=>{B6.set(e,t)},U0e=e=>{B6.delete(e)},q0e=(e,t)=>{U6.set(e,t)},V0e=e=>{U6.delete(e)},H0e=e=>ae(function*(){const t=yield*ft(hc),n=yield*ut(Ei),r=yield*ut(kc),i=yield*ut(ro);return{linkId:(yield*ut(ad))??e.nextLinkId(),runtimeLabel:r,diagnosticsLevel:n,debugSinks:i,overridesOpt:t}}),K0e=(e,t)=>(Pe(e.overridesOpt)?ci(t,hc,e.overridesOpt.value):t).pipe(lr(ad,e.linkId),lr(kc,e.runtimeLabel),lr(Ei,e.diagnosticsLevel),lr(ro,e.debugSinks)),W0e=e=>ae(function*(){const t=yield*Qf(),n=yield*Qf(),r=yield*Qf(),i=e.diagnostics;let o=0;const a=()=>(o+=1,`${e.instanceId}::l${o}`),c=yield*br(),u=yield*Kn({backlogCount:0,waiters:0,signal:c}),d=yield*br(),h=yield*Kn({backlogCount:0,waiters:0,signal:d}),p=v=>ae(function*(){let S;const x=yield*br();yield*is(v,k=>{const _=k.backlogCount>0?k.backlogCount-1:0;return k.waiters<=0?{backlogCount:_,waiters:0,signal:k.signal}:(S=k.signal,{backlogCount:_,waiters:k.waiters,signal:x})}),S&&(yield*hi(S,void 0))}),y=(v,S)=>ae(function*(){(yield*ut(os))&&(yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"state_transaction::enqueue_in_transaction",severity:"error",message:"enqueueTransaction is not allowed inside a synchronous StateTransaction body (it may deadlock or violate backpressure constraints).",hint:"Move dispatch/setState calls outside the transaction window, or use a multi-entry pattern (pending → IO → writeback).",kind:"enqueue_in_transaction"}),yield*Js("enqueueTransaction is not allowed inside a synchronous StateTransaction body"));const k=v==="urgent"?u:h;let _;for(;;){const E=yield*e.resolveConcurrencyPolicy(),M=yield*mr(k,C=>C.backlogCount<S?[{_tag:"acquired"},{backlogCount:C.backlogCount+1,waiters:C.waiters,signal:C.signal}]:[{_tag:"wait",backlogCount:C.backlogCount,signal:C.signal},C]);if(M._tag==="acquired")return;const D=Date.now();_===void 0&&(_=D);const T=D-_;yield*i.emitPressureIfNeeded({policy:E,trigger:{kind:"txnQueue",name:`enqueueTransaction.${v}`},backlogCount:M.backlogCount,saturatedDurationMs:T}),yield*sH(is(k,C=>({backlogCount:C.backlogCount,waiters:C.waiters+1,signal:C.signal})).pipe(pi(M.signal)),C=>Un(C),()=>is(k,C=>({backlogCount:C.backlogCount,waiters:C.waiters>0?C.waiters-1:0,signal:C.signal})))}});return yield*Vn(jR(ae(function*(){for(yield*Ag(r);;){const v=yield*z$(t);if(Pe(v)){yield*v.value;continue}const S=yield*z$(n);if(Pe(S)){yield*S.value;continue}break}}))),(v,S)=>ae(function*(){const x=S?v:"urgent",k=S||v,_=x==="urgent"?u:h,M=(yield*e.resolveConcurrencyPolicy()).losslessBackpressureCapacity;yield*y(x,M);const D=yield*br(),T=yield*H0e({nextLinkId:a}),O=K0e(T,k).pipe(en,ze(L=>hi(D,L)),fn,_o(p(_)));yield*sc($c([sr(x==="urgent"?t:n,O),sr(r,void 0)]));const I=yield*Un(D);return yield*ji(I,{onFailure:L=>gr(L),onSuccess:L=>on(L)})})}),vF=(e,t)=>e.hasOnErrorHandlers.pipe(ze(n=>n||!t?he:it({type:"diagnostic",moduleId:t,code:"lifecycle::missing_on_error",severity:"warning",message:`Module "${t}" received a lifecycle error but has no $.lifecycle.onError handler registered.`,hint:"Add $.lifecycle.onError((cause, context) => ...) at the beginning of this Module's logic to handle logic errors consistently."}))),SF=(e,t)=>Ze(()=>{const r=As(_h(e)).find(a=>a&&typeof a=="object"&&a.name==="MissingModuleRuntimeError");if(!r)return he;const i=typeof r.tokenId=="string"?r.tokenId:"<unknown module id>",o=Array.isArray(r.fix)&&r.fix.every(a=>typeof a=="string")?r.fix.join(`
50
+ `):void 0;return it({type:"diagnostic",moduleId:t,code:"assembly::missing_module_runtime",severity:"error",message:`Missing Module runtime provider for "${i}".`,hint:o??"Provide the child implementation in the same scope (imports), or provide a root singleton at app root.",kind:"assembly_failure"})}).pipe(Cs),G0e=()=>Sn(),Y0e="Service not found:",iE=(e,t)=>ae(function*(){let n;try{n=Lc(e,{renderErrorCause:!0})}catch{return}n.includes(Y0e)&&(yield*it({type:"diagnostic",moduleId:t,code:"logic::env_service_not_found",severity:"warning",message:n,hint:"Logic attempted to access an Env service before it was provided. This is a known initialization timing noise in Runtime/React integration. If it happens once during early startup and everything works afterward, it's likely harmless; if it persists or correlates with app issues, verify Runtime.make / RuntimeProvider.layer provides the service."}),yield*it({type:"diagnostic",moduleId:t,code:"logic::invalid_phase",severity:"error",message:"$.use is not allowed before Env is fully ready.",hint:"Avoid reading services during setup or before Env is ready; move Env access to the Logic run section, or wrap init via $.lifecycle.onInitRequired.",kind:"env_service_not_ready"}))}),BC=ds("@logixjs/LogicPhaseService");class q6 extends tn("@logixjs/LogicUnitService")(){}const xF=(e,t,n,r)=>Object.assign(new Error(`[LogicPhaseError] ${t} is not allowed in ${n} phase (kind=${e}).`),{_tag:"LogicPhaseError",kind:e,api:t,phase:n,moduleId:r}),oE=(e,t)=>ae(function*(){if(!G0e())return;const n=[...v0(e),..._h(e)];for(const r of n){const i=r;if(i&&i._tag==="LogicPhaseError"){const o=i,a=o.kind==="use_in_setup"||o.kind==="lifecycle_in_setup"?"The setup phase must not read Env/services or run long-lived logic; move the relevant calls to the run phase.":o.kind==="lifecycle_in_run"?"Do not register $.lifecycle.* in the run phase (setup-only). Move lifecycle registrations to the synchronous part of Module.logic builder (before return).":o.kind==="traits_in_run"||o.kind==="traits_declare_in_run"?"Traits are frozen after setup; move $.traits.declare to LogicPlan.setup or the setup registration phase of Module.logic builder.":"Move logic to the run phase; keep setup for registrations only.";yield*it({type:"diagnostic",moduleId:o.moduleId??t,code:"logic::invalid_phase",severity:"error",message:`${o.api??o.kind} is not allowed in ${o.phase} phase.`,hint:a,kind:o.kind});return}}}),V6=Symbol.for("logix.module.logic.meta"),$A=e=>{if(!(!e||typeof e!="object"&&typeof e!="function"))return e[V6]},Ug=(e,t)=>{try{Object.defineProperty(e,V6,{value:t,enumerable:!1,configurable:!0})}catch{}return e},Q0e=(e,t)=>{const n=$A(e);return Ug(e,{...n??{},...t})},UC=ds("@logixjs/Platform"),H6=Symbol.for("@logixjs/core/logicPlanEffect"),K6=Symbol.for("@logixjs/core/logicPhaseRef"),W6=Symbol.for("@logixjs/core/logicSkipRun"),jA=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},X0e=e=>{!e||typeof e!="object"||jA(e,H6,!0)},qC=e=>!!(e&&typeof e=="object"&&e[H6]===!0),Bv=(e,t)=>{!e||typeof e!="object"||jA(e,K6,t)},Xl=e=>{if(!(!e||typeof e!="object"))return e[K6]},J0e=e=>{!e||typeof e!="object"||jA(e,W6,!0)},Z0e=e=>!!(e&&typeof e=="object"&&e[W6]===!0),Uv=()=>({current:"run"}),exe=e=>{const{tag:t,logics:n,runtime:r,lifecycle:i,moduleId:o,instanceId:a}=e,c=o;return ae(function*(){const u=(_,E,M)=>{const D=ci(ci(_,Sj,i),t,r),T=FR({"logix.moduleId":c})(D),C=M?ci(T,q6,M):T;return E?ci(C,BC,{get current(){return E.current}}):C},d=_=>_?`${_.file}:${_.line}:${_.column}`:void 0,h=(_,E)=>{const M=$A(_),D=M?.resolvedId??M?.id??`logic#${E+1}`,T=M?.resolvedIdKind??(M?.id?"explicit":"derived"),C=M?.resolvedName??M?.name??D,O=M?.resolvedKind??M?.kind,q=O&&O.length>0?`${O}:`:"",I=M?.resolvedSource??M?.source;return{logicUnitId:D,logicUnitIdKind:T,logicUnitLabel:`logicUnit:${q}${C}`,path:d(I)}},p=_=>{if(kh(_))return gr(_);const E=[...v0(_),..._h(_)].some(D=>D?._tag==="LogicPhaseError"),M=i.notifyError(_,{phase:"run",hook:"unknown",moduleId:o,instanceId:a,origin:"logic.fork"}).pipe(li(()=>vF(i,o)),li(()=>SF(_,o)),li(()=>Cj(_,o)),li(()=>iE(_,o)),li(()=>oE(_,o)));return E?M:M.pipe(ze(()=>gr(_)))},y=_=>kh(_)?gr(_):he.pipe(li(()=>vF(i,o)),li(()=>SF(_,o)),li(()=>Cj(_,o)),li(()=>iE(_,o)),li(()=>oE(_,o)),rt(gr(_))),g=_=>!!(_&&typeof _=="object"&&"run"in _&&"setup"in _),v=(_,E)=>{const M=Xl(_)??E??Uv();if(g(_)){const T=_;return Xl(T)||Bv(T,M),T}const D={setup:he,run:_};return Bv(D,M),D},S=[];let x=0;for(const _ of n){const E=h(_,x);if(x+=1,g(_)){const T=Xl(_)??Uv(),C=u(_.setup,T,E),O=u(_.run,T,E);T.current="setup",yield*C.pipe(zt(p)),S.push(Ze(()=>{T.current="run"}).pipe(rt(Vn(O.pipe(zt(p)))),fn));continue}if(qC(_)){const T=Xl(_)??Uv(),C=()=>(()=>{const $={setup:he,run:he};return Bv($,T),J0e($),$})();T.current="setup";const O=yield*u(_,T,E).pipe(ko({onSuccess:$=>on(v($,T)),onFailure:$=>[...v0($),..._h($)].some(j=>j?._tag==="LogicPhaseError")?oE($,o).pipe(rt(p($)),pi(C())):iE($,o).pipe(rt(p($)),rt(gr($)))})),q=!!Xl(O),I=Xl(O)??T;q||Bv(O,I);const L=u(O.setup,I,E),P=u(O.run,I,E),B=Z0e(O);I.current="setup",yield*L.pipe(zt(p)),B||S.push(Ze(()=>{I.current="run"}).pipe(rt(Vn(P.pipe(zt(p)))),fn));continue}const M=Xl(_),D=u(_,M,E).pipe(zt(p));S.push(ae(function*(){const T=yield*Vn(D);yield*Vn(vc(T).pipe(ze(C=>ji(C,{onFailure:()=>he,onSuccess:O=>{const q=I=>{const L=Xl(I)??Uv(),P=u(I.setup,L,E),B=u(I.run,L,E);return L.current="setup",P.pipe(zt(p),rt(Ze(()=>{L.current="run"}).pipe(rt(Vn(B.pipe(zt(p)))),fn)))};return g(O)?q(O):qC(O)?u(O,M,E).pipe(Qe(I=>v(I,M)),ko({onFailure:I=>p(I),onSuccess:I=>q(I)})):he}}))))}))}yield*i.runInitRequired.pipe(zt(y));const k=yield*ft(UC);if(Pe(k)){const _=k.value,E=yield*i.getTaskSnapshot,M={current:"run"},D={get current(){return M.current}},T=O=>ci(ci(ci(ci(O,UC,_),Sj,i),t,r),BC,D),C=(O,q)=>Vn(q(T(O==="suspend"?i.runPlatformSuspend:O==="resume"?i.runPlatformResume:i.runPlatformReset).pipe(fn)).pipe(zt(I=>i.notifyError(I,{phase:"platform",hook:O,moduleId:o,instanceId:a,origin:"platform.subscribe"})))).pipe(fn);E.platformSuspend.length>0&&(yield*C("suspend",_.lifecycle.onSuspend)),E.platformResume.length>0&&(yield*C("resume",_.lifecycle.onResume)),E.platformReset.length>0&&typeof _.lifecycle.onReset=="function"&&(yield*C("reset",_.lifecycle.onReset))}yield*sn(S,_=>_,{discard:!0}),yield*i.runStart,yield*wc()})},txe=e=>`${e.kind}::${typeof e.name=="string"?e.name:""}`,nxe=wfe(e=>e.currentTimeMillis),rxe=e=>ae(function*(){const t=yield*Kn({}),n=yield*Kn(!1),r=yield*Kn(!1);return{emitPressureIfNeeded:a=>ae(function*(){const c=a.policy,u=a.backlogCount??0,d=a.saturatedDurationMs??0,h=c.pressureWarningThreshold;if(!(u>=h.backlogCount||d>=h.backlogDurationMs))return;const y=c.warningCooldownMs,g=yield*nxe,v=txe(a.trigger),S=yield*mr(t,k=>{const _=k[v];return _&&g-_.lastEmittedAtMs<y?[{_tag:"suppress"},{...k,[v]:{lastEmittedAtMs:_.lastEmittedAtMs,suppressedCount:_.suppressedCount+1}}]:[{_tag:"emit",suppressedCount:_?.suppressedCount??0},{...k,[v]:{lastEmittedAtMs:g,suppressedCount:0}}]});if(S._tag==="suppress")return;const x={configScope:c.concurrencyLimitScope,limit:c.concurrencyLimit,backlogCount:u,saturatedDurationMs:d,threshold:{backlogCount:h.backlogCount,backlogDurationMs:h.backlogDurationMs},cooldownMs:y,degradeStrategy:S.suppressedCount>0?"cooldown":"none",suppressedCount:S.suppressedCount,sampleRate:1,droppedCount:0};typeof a.inFlight=="number"&&Number.isFinite(a.inFlight)&&(x.inFlight=a.inFlight),yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"concurrency::pressure",severity:"warning",message:"Concurrency pressure detected (backpressure / saturation).",hint:"Reduce trigger frequency, split work, switch to runLatest or batch processing; or tune concurrency/backpressure limits via concurrencyPolicy.",kind:"concurrency:pressure",trigger:{kind:a.trigger.kind,name:a.trigger.name,details:x}})}),emitUnboundedPolicyIfNeeded:a=>ae(function*(){const c=a.policy;if(c.concurrencyLimit==="unbounded"&&c.allowUnbounded===!0){if(!(yield*mr(n,g=>g?[!1,!0]:[!0,!0])))return;const y={configScope:c.concurrencyLimitScope,limit:c.concurrencyLimit};yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"concurrency::unbounded_enabled",severity:"error",message:"Unbounded concurrency is enabled (risk: resource exhaustion).",hint:"Enable only for short-lived, controlled, cancelable fan-out; prefer bounded concurrency and increase gradually; avoid piling up long-running or never-ending tasks under unbounded.",kind:"concurrency:unbounded_enabled",trigger:{kind:a.trigger.kind,name:a.trigger.name,details:y}});return}if(!(c.requestedConcurrencyLimit==="unbounded"&&c.concurrencyLimit!=="unbounded")||!(yield*mr(r,p=>p?[!1,!0]:[!0,!0])))return;const h={configScope:c.requestedConcurrencyLimitScope,limit:c.requestedConcurrencyLimit};yield*it({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"concurrency::unbounded_requires_opt_in",severity:"error",message:"Unbounded concurrency was requested but is not allowed; falling back to bounded concurrency.",hint:"If you really need unbounded, explicitly set concurrencyPolicy.allowUnbounded = true; otherwise set concurrencyPolicy.concurrencyLimit to a positive integer limit.",kind:"concurrency:unbounded_blocked",trigger:{kind:a.trigger.kind,name:a.trigger.name,details:h}})})}});let wF=0;const ixe=()=>(wF+=1,`i${wF}`),kF=(e,t={})=>ae(function*(){const r=t.createState?yield*t.createState:yield*Rye(e),i=yield*C0(),o=yield*C0();let a=0;const c=q1(ae(function*(){return a+=1,yield*Cf(()=>Ze(()=>{a=Math.max(0,a-1)})),Am(i)})),u=t.moduleId??"unknown",d=Sve(t.instanceId)??ixe(),h=yield*ut(kc),p=yield*Lbe({moduleId:u,instanceId:d,runtimeLabel:h}),y=yield*rxe({moduleId:t.moduleId,instanceId:d}),g=yield*ft(Cw),v=Pe(g)?g.value.instrumentation:void 0,S=t.stateTransaction?.instrumentation??v??lbe(),x=HSe({moduleId:t.moduleId,stateTransaction:t.stateTransaction}),k=qSe({moduleId:t.moduleId,diagnostics:y}),_=VSe({moduleId:t.moduleId,stateTransaction:t.stateTransaction}),E=t.createActionHub?yield*t.createActionHub:yield*ae(function*(){const oe=yield*k();return yield*Ghe(oe.losslessBackpressureCapacity)}),M=128,D={program:void 0,convergePlanCache:void 0,convergeGeneration:{generation:0,generationBumpCount:0},pendingCacheMissReason:void 0,lastConvergeIrKeys:void 0,listConfigs:[]},T=new LSe(d),C=z0e({moduleId:u,instanceId:d,getFieldPathIdRegistry:()=>{const oe=D.program?.convergeIr;if(!(!oe||oe.configError))return oe.fieldPathIdRegistry}}),O=jbe({moduleId:u,instanceId:d,instrumentation:S,getFieldPathIdRegistry:()=>{const oe=D.program?.convergeIr;if(!(!oe||oe.configError))return oe.fieldPathIdRegistry}}),q=(oe,Me,Be,Ee,De,Re)=>{wj(O,oe,Me,Be,Ee,De,Re)},I=oe=>{O.current&&Za(O,oe)},P={signal:yield*Qf(),backlogDirtyPaths:new Set,backlogDirtyAllReason:void 0,firstPendingAtMs:void 0,lastTouchedAtMs:void 0,latestConvergeConfig:void 0,capturedContext:void 0},B={frozen:!1,contributions:[],snapshot:void 0},$=500,V=[],j=new Map,K=yield*gve(),G=yield*Zbe({moduleId:t.moduleId}),J=yield*ft(tve),F=Pe(J)?J.value:void 0,U=(oe,Me)=>{const Be=F?.implsByServiceId[oe];if(!Be||Be.length===0)return Me;const Ee=Be,De=new Set,Re=[];for(const _e of Me)De.add(_e.implId),Re.push(_e);for(const _e of Ee)!_e||typeof _e.implId!="string"||_e.implId.length===0||De.has(_e.implId)||(De.add(_e.implId),Re.push(_e));return Re},Q=W0e({moduleId:t.moduleId,instanceId:d,resolveConcurrencyPolicy:k,diagnostics:y}),z=Mv("txnQueue",U("txnQueue",[{implId:"builtin",implVersion:"v1",make:Q},{implId:"trace",implVersion:"v1",make:Q,notes:"no-op wrapper (used for override isolation tests)"}]),G),ne=yield*z.impl.make.pipe(ci(Rv,{getBuiltinMake:oe=>oe==="txnQueue"?Q:Js(`[Logix] builtin make not available: ${oe}`)})),ce=on(Ove({optionsModuleId:t.moduleId,instanceId:d,txnContext:O})),Z=Mv("operationRunner",U("operationRunner",[{implId:"builtin",implVersion:"v1",make:ce}]),G),ee=yield*Z.impl.make.pipe(ci(Rv,{getBuiltinMake:oe=>oe==="operationRunner"?ce:Js(`[Logix] builtin make not available: ${oe}`)}));yield*ee("lifecycle","module:init",{meta:{moduleId:u,instanceId:d}},it({type:"module:init",moduleId:u,instanceId:d}));const me=yield*Xm(r);yield*ee("state","state:init",{meta:{moduleId:u,instanceId:d}},it({type:"state:update",moduleId:u,state:me,instanceId:d,txnSeq:0}));const fe=Ze(()=>BSe({moduleId:u,optionsModuleId:t.moduleId,instanceId:d,stateRef:r,commitHub:i,shouldPublishCommitHub:()=>a>0,recordStatePatch:q,onCommit:({state:oe,meta:Me,dirtySet:Be,diagnosticsLevel:Ee})=>C.onCommit(oe,Me,Be,Ee),enqueueTransaction:ne,runOperation:ee,txnContext:O,traitConvergeTimeSlicing:P,traitRuntime:{getProgram:()=>D.program,getConvergePlanCache:()=>D.convergePlanCache,getConvergeGeneration:()=>D.convergeGeneration,getPendingCacheMissReason:()=>D.pendingCacheMissReason,setPendingCacheMissReason:oe=>{D.pendingCacheMissReason=oe},rowIdStore:T,getListConfigs:()=>D.listConfigs},resolveTraitConvergeConfig:x,isDevEnv:Sn,maxTxnHistory:$,txnHistory:V,txnById:j})),ye=Mv("transaction",U("transaction",[{implId:"builtin",implVersion:"v1",make:fe}]),G),{readState:ie,setStateInternal:xe,runWithStateTransaction:ke}=yield*ye.impl.make.pipe(ci(Rv,{getBuiltinMake:oe=>oe==="transaction"?fe:Js(`[Logix] builtin make not available: ${oe}`)}));let Ke=0,Xe=0;const Je=oe=>{let Me=0,Be,Ee;const De={dirtyPathCount:oe.dirtyPathsSnapshot.length};return oe.dirtyAllReason&&(De.dirtyAllReason=oe.dirtyAllReason),oe.slice&&(De.sliceStart=oe.slice.start,De.sliceEnd=oe.slice.end,De.sliceTotal=oe.slice.total),ne(oe.lane,ee("lifecycle","trait:deferredConvergeFlush",{payload:{dirtyPathCount:oe.dirtyPathsSnapshot.length},meta:{moduleId:u,instanceId:d}},ke({kind:"trait:deferred_flush",name:"trait:deferredConvergeFlush",details:De},()=>ae(function*(){const Re=O.current;if(Re&&(Me=Re.txnSeq,Be=Re.txnId),oe.captureOpSeq){const _e=yield*ut(o6);typeof _e=="number"&&Number.isFinite(_e)&&_e>=0&&(Ee=Math.floor(_e))}if(Re){oe.dirtyAllReason&&(Re.dirtyAllReason=oe.dirtyAllReason);for(const _e of oe.dirtyPathsSnapshot)typeof _e=="number"&&Number.isFinite(_e)&&_e>=0&&Re.dirtyPathIds.add(Math.floor(_e))}})))).pipe(pi({txnSeq:Me,txnId:Be,opSeq:Ee}))};yield*Vn(jR(ae(function*(){for(yield*Ag(P.signal);;){const Ct=P.latestConvergeConfig?.traitConvergeTimeSlicing;if(!Ct?.enabled){P.backlogDirtyPaths.clear(),P.backlogDirtyAllReason=void 0,P.firstPendingAtMs=void 0,P.lastTouchedAtMs=void 0;return}const xn=Date.now(),pn=P.firstPendingAtMs??xn;P.firstPendingAtMs=pn;const Ea=P.capturedContext,Lr=yield*Ea?.overrides?ci(_(),hc,Ea.overrides):_(),cn=Lr.enabled?Lr.debounceMs:Ct.debounceMs,wn=Lr.enabled?Lr.maxLagMs:Ct.maxLagMs,Us=Math.max(0,xn-pn),qs=Math.max(0,wn-Us);if(qs<=0)break;const Vc=Math.max(0,Math.min(cn,qs));Vc>0?yield*kfe(dl(Vc)):yield*wc();const Rd=yield*B$(P.signal);if(jh(Rd))break}const oe=Array.from(P.backlogDirtyPaths);P.backlogDirtyPaths.clear();const Me=P.backlogDirtyAllReason;P.backlogDirtyAllReason=void 0;const Be=P.firstPendingAtMs;if(P.firstPendingAtMs=void 0,P.lastTouchedAtMs=void 0,oe.length===0&&!Me)return;const Ee=D.program;if(!Ee?.convergeExecIr||Ee.convergeExecIr.topoOrderDeferredInt32.length===0)return;const De=P.capturedContext,Re=yield*De?.overrides?ci(_(),hc,De.overrides):_(),_e=De!=null&&De.diagnosticsLevel!=="off",Tt=_e&&(Re.enabled||Re.overrideMode!=null),Hr=Ct=>{let xn=Ct;return De?.overrides&&(xn=ci(xn,hc,De.overrides)),De&&(xn=xn.pipe(lr(kc,De.runtimeLabel),lr(Ei,De.diagnosticsLevel),lr(ro,De.debugSinks))),xn},ei=Be??Date.now();if(!Re.enabled){const Ct=yield*Hr(Je({dirtyPathsSnapshot:oe,dirtyAllReason:Me,lane:"urgent",captureOpSeq:Tt}));if(Tt){const xn=Re.overrideMode==="forced_off"?["forced_off"]:Re.overrideMode==="forced_sync"?["forced_sync"]:["disabled"],pn={anchor:{moduleId:u,instanceId:d,txnSeq:Ct.txnSeq,...typeof Ct.opSeq=="number"?{opSeq:Ct.opSeq}:{}},lane:"urgent",kind:"trait:deferred_flush",policy:Re,backlog:{pendingCount:0,ageMs:Math.max(0,Date.now()-ei),coalescedCount:Ke,canceledCount:Xe},starvation:{triggered:!1},reasons:xn};yield*Hr(it({type:"trace:txn-lane",moduleId:u,instanceId:d,txnSeq:Ct.txnSeq,txnId:Ct.txnId,data:{evidence:pn}}))}return}const Lt=Ee.convergeExecIr.topoOrderDeferredInt32.length;let Rt=0,yt=Math.min(32,Lt),At=0,Nr=Date.now();const Nn=()=>{const xn=globalThis.navigator?.scheduling,pn=xn?.isInputPending;if(typeof pn!="function")return!1;try{return!!pn.call(xn)}catch{return!1}};for(;Rt<Lt;){const Ct=Math.max(0,Date.now()-ei),xn=Ct>=Re.maxLagMs,pn=xn?Math.max(Re.budgetMs,Re.budgetMs*4):Re.budgetMs,Ea=Rt,Lr=Math.min(Lt,Rt+yt),{sliceDurationMs:cn,anchor:wn}=yield*Hr(ae(function*(){const Do=Date.now(),Ca=yield*Je({dirtyPathsSnapshot:oe,dirtyAllReason:Me,lane:"nonUrgent",slice:{start:Ea,end:Lr,total:Lt},captureOpSeq:_e});return{sliceDurationMs:Math.max(0,Date.now()-Do),anchor:Ca}}));Rt=Lr,yield*B$(P.signal);const Us=P.backlogDirtyPaths.size>0||P.backlogDirtyAllReason!=null,qs=Re.allowCoalesce&&!xn&&Us,Vc=Math.max(0,Date.now()-Nr),Rd=pn>0&&Number.isFinite(pn)&&Vc>=pn,ib=Vc>=16,Tl=!qs&&Re.yieldStrategy==="inputPending"?Nn():!1,Hc=Rt<Lt&&!qs&&(Tl||Rd||ib),Ta=Hc?Tl?"input_pending":Rd?"budget_exceeded":"forced_frame_yield":"none";if(_e&&(yield*Hr(ae(function*(){const Do=["queued_non_urgent"];xn&&Do.push("max_lag_forced","starvation_protection"),Ta==="budget_exceeded"&&Do.push("budget_yield");const Ca={anchor:{moduleId:u,instanceId:d,txnSeq:wn.txnSeq,...typeof wn.opSeq=="number"?{opSeq:wn.opSeq}:{}},lane:"nonUrgent",kind:"trait:deferred_flush",policy:Re,backlog:{pendingCount:Math.max(0,Lt-Lr),ageMs:Ct,coalescedCount:Ke,canceledCount:Xe},budget:{budgetMs:pn,sliceDurationMs:cn,yieldCount:At,yielded:Hc,yieldReason:Ta},starvation:xn?{triggered:!0,reason:"max_lag_exceeded"}:{triggered:!1},reasons:Do};yield*it({type:"trace:txn-lane",moduleId:u,instanceId:d,txnSeq:wn.txnSeq,txnId:wn.txnId,data:{evidence:Ca}})}))),qs){Ke+=1,Xe+=1,_e&&(yield*Hr(it({type:"trace:txn-lane",moduleId:u,instanceId:d,txnSeq:wn.txnSeq,txnId:wn.txnId,data:{evidence:{anchor:{moduleId:u,instanceId:d,txnSeq:wn.txnSeq,...typeof wn.opSeq=="number"?{opSeq:wn.opSeq}:{}},lane:"nonUrgent",kind:"trait:deferred_flush",policy:Re,backlog:{pendingCount:Math.max(0,Lt-Rt),ageMs:Ct,coalescedCount:Ke,canceledCount:Xe},budget:{budgetMs:pn,sliceDurationMs:cn,yieldCount:At,yielded:!1,yieldReason:"none"},starvation:{triggered:!1},reasons:["coalesced","canceled"]}}}))),yield*sr(P.signal,void 0);break}pn>0&&Number.isFinite(pn)&&(cn>pn&&yt>1?yt=Math.max(1,Math.floor(yt/2)):cn<pn/2&&(yt=Math.min(Lt,yt*2))),Hc&&(At+=1,Nr=Date.now(),yield*wc())}(P.backlogDirtyPaths.size>0||P.backlogDirtyAllReason!=null)&&(yield*sr(P.signal,void 0))})));const dt=(()=>{const oe=t.tag?.shape?.actionMap;if(!(!oe||typeof oe!="object"))return new Set(Object.keys(oe))})(),Ht=Ze(()=>Dve({optionsModuleId:t.moduleId,instanceId:d,declaredActionTags:dt,initialReducers:t.reducers,txnContext:O,readState:ie,setStateInternal:xe,recordStatePatch:q,actionHub:E,actionCommitHub:o,diagnostics:y,enqueueTransaction:ne,resolveConcurrencyPolicy:k,runOperation:ee,runWithStateTransaction:ke,isDevEnv:Sn})),Et=Mv("dispatch",U("dispatch",[{implId:"builtin",implVersion:"v1",make:Ht}]),G),Ue=yield*Et.impl.make.pipe(ci(Rv,{getBuiltinMake:oe=>oe==="dispatch"?Ht:Js(`[Logix] builtin make not available: ${oe}`)})),Mn=nve({moduleId:t.moduleId,instanceId:d,bindings:[z.binding,Z.binding,ye.binding,Et.binding],overridesApplied:[...z.overridesApplied,...Z.overridesApplied,...ye.overridesApplied,...Et.overridesApplied]});if(K.kernelId!=="core"){const oe=yield*ft(Ybe);if((Pe(oe)?oe.value:"trial")==="fullCutover"){const Be=uve({mode:"fullCutover",requestedKernelId:K.kernelId,runtimeServicesEvidence:Mn,diagnosticsLevel:Sn()?"light":"off"});if(Be.verdict==="FAIL"){const Ee=Sn()?["[FullCutoverGateFailed] Runtime assembly detected implicit fallback / missing bindings under fullCutover mode.",`requestedKernelId: ${K.kernelId}`,`missingServiceIds: ${Be.missingServiceIds.join(",")}`,`fallbackServiceIds: ${Be.fallbackServiceIds.join(",")}`,`anchor: moduleId=${Be.anchor.moduleId}, instanceId=${Be.anchor.instanceId}, txnSeq=${Be.anchor.txnSeq}`].join(`
51
+ `):"Full cutover gate failed",De=new Error(Ee);throw De.name="FullCutoverGateFailed",De.gate=Be,De.instanceId=d,De.moduleId=t.moduleId,De}}}const nn={moduleId:u,instanceId:d,lifecycleStatus:p.getStatus,getState:ie,setState:oe=>xe(oe,"*","unknown",void 0,oe),dispatch:oe=>Ue.dispatch(oe),dispatchBatch:oe=>Ue.dispatchBatch(oe),dispatchLowPriority:oe=>Ue.dispatchLowPriority(oe),actions$:Am(E),actionsWithMeta$:Am(o),changes:oe=>Rs(r.changes,oe).pipe(aj),changesWithMeta:oe=>Rs(c,({value:Me,meta:Be})=>({value:oe(Me),meta:Be})),changesReadQueryWithMeta:oe=>{const Me=oe?.staticIr!=null&&typeof oe?.lane=="string"&&typeof oe?.producer=="string"?oe:z6(oe);return Me.lane!=="static"?q1(ae(function*(){const Be=yield*ft(f6);if(Pe(Be)){const Ee=j0e({config:Be.value,moduleId:u,instanceId:d,txnSeq:0,compiled:Me});Ee.verdict==="WARN"?yield*it(Ee.diagnostic):Ee.verdict==="FAIL"&&(yield*it(Ee.diagnostic),yield*Mg(Ee.error))}return Rs(c,({value:Ee,meta:De})=>({value:Me.select(Ee),meta:De}))})):q1(ae(function*(){const Be=yield*C.ensureEntry(Me);if(Be.subscriberCount+=1,yield*Cf(()=>Ze(()=>{C.releaseEntry(Me.selectorId)})),!Be.hasValue){const Ee=yield*ie;try{Be.cachedValue=Me.select(Ee),Be.hasValue=!0,Be.cachedAtTxnSeq=0}catch{}}return Am(Be.hub)}))},ref:oe=>{if(!oe)return r;const Me={get:Qe(Xm(r),oe),modify:()=>Js("Cannot write to a derived ref")};return{ref:Me,pubsub:{publish:()=>on(!0)},semaphore:{withPermits:()=>Ee=>Ee},get:Me.get,modify:Me.modify,changes:Rs(r.changes,oe).pipe(aj)}}};vve(nn,K),ove(nn,Mn);const Rn=yield*ft(Ive);Pe(Rn)&&(Rn.value.setKernelImplementationRef(K),(yield*ut(Ei))!=="off"&&Rn.value.setRuntimeServicesEvidence(Mn));const pt=yield*ut(u6),Zn=oe=>{if(pt.length!==0)for(const Me of pt)Me.register(oe)},ue=new Map;yield*Cf(()=>Ze(()=>{ue.clear()}));const we=new Map;for(const oe of t.imports??[]){const Me=yield*ft(oe);Pe(Me)&&we.set(oe,Me.value)}const Ne={kind:"imports-scope",get:oe=>we.get(oe)},We=t.moduleId!=null?`${t.moduleId}::${d}`:void 0;We&&q0e(We,nn);const Ve=(oe,Me)=>{const Be=oe.convergeIr,Ee=Be?{writersKey:Be.writersKey,depsKey:Be.depsKey}:void 0,De=Me?.bumpReason;let Re;if(D.lastConvergeIrKeys&&Ee?De?Re=De:D.lastConvergeIrKeys.writersKey!==Ee.writersKey?Re="writers_changed":D.lastConvergeIrKeys.depsKey!==Ee.depsKey&&(Re="deps_changed"):D.lastConvergeIrKeys&&!Ee&&(Re=De??"unknown"),Re){const ei=D.convergeGeneration.generation+1,Lt=(D.convergeGeneration.generationBumpCount??0)+1;D.convergeGeneration={generation:ei,generationBumpCount:Lt,lastBumpReason:Re},D.pendingCacheMissReason="generation_bumped",D.convergePlanCache=new Aj(M)}D.lastConvergeIrKeys=Ee;const _e=Be?{...Be,generation:D.convergeGeneration.generation}:void 0,Tt=_e&&!_e.configError?x6(_e):void 0;D.program={...oe,convergeIr:_e,convergeExecIr:Tt},D.listConfigs=$Se(oe.spec),D.convergePlanCache||(D.convergePlanCache=new Aj(M)),Me?.exportStaticIr!==!1&&_e&&!_e.configError&&pt.length>0&&Zn(zve({ir:_e,moduleId:t.moduleId??"unknown",instanceId:d}))};if(!D.program){const oe=t.tag?.stateSchema;if(oe)try{Ve(P6(oe,{}),{exportStaticIr:!1})}catch{}}const Jt=oe=>{if(!O.current)return;const Me=O.current,Be=Me.stateTraitValidateRequests??[];Be.push(oe),Me.stateTraitValidateRequests=Be},Gt=oe=>{if(!O.current)return;const Me=O.current;Me.lastReplayEvent={...oe,txnId:Me.txnId,trigger:Me.origin}},gt=(oe,Me)=>ne(ee(oe.kind,oe.name?`txn:${oe.name}`:"txn",{meta:{moduleId:t.moduleId,instanceId:d}},ke(oe,Me))),mt=(oe,Me)=>ne(ae(function*(){if(!Sn())return;const Be=j.get(oe);if(!Be)return;const Ee=Me==="before"?Be.initialStateSnapshot:Be.finalStateSnapshot;Ee!==void 0&&(yield*ke({kind:"devtools",name:"time-travel",details:{baseTxnId:oe,mode:Me}},()=>Ze(()=>{Za(O,Ee),wj(O,"*","devtools")})))})),Le=t.tag?.stateSchema,tt=jve({moduleId:t.moduleId,instanceId:d,actions$:nn.actions$}),ln={moduleId:t.moduleId,instanceId:d,stateSchema:Le,lifecycle:{registerInitRequired:(oe,Me)=>{p.registerInitRequired(oe,Me)},registerStart:(oe,Me)=>{p.registerStart(oe,Me)},registerDestroy:(oe,Me)=>{p.registerDestroy(oe,Me)},registerOnError:oe=>{p.registerOnError(oe)},registerPlatformSuspend:(oe,Me)=>{p.registerPlatformSuspend(oe,Me)},registerPlatformResume:(oe,Me)=>{p.registerPlatformResume(oe,Me)},registerPlatformReset:(oe,Me)=>{p.registerPlatformReset(oe,Me)}},imports:Ne,txn:{instrumentation:S,registerReducer:Ue.registerReducer,runWithStateTransaction:gt,updateDraft:I,recordStatePatch:q,recordReplayEvent:Gt,applyTransactionSnapshot:mt},concurrency:{resolveConcurrencyPolicy:k},txnLanes:{resolveTxnLanePolicy:_},traits:{rowIdStore:T,getListConfigs:()=>D.listConfigs,registerSourceRefresh:(oe,Me)=>{ue.set(oe,Me)},getSourceRefreshHandler:oe=>ue.get(oe),registerStateTraitProgram:Ve,enqueueStateTraitValidateRequest:Jt,registerModuleTraitsContribution:oe=>{if(B.frozen)throw new Error("[ModuleTraitsFrozen] Cannot register traits contribution after finalize/freeze.");B.contributions.push(oe)},freezeModuleTraits:()=>{B.frozen=!0},getModuleTraitsContributions:()=>B.contributions,getModuleTraitsSnapshot:()=>B.snapshot,setModuleTraitsSnapshot:oe=>{B.snapshot=oe}},effects:{registerEffect:oe=>tt.registerEffect(oe)},devtools:{registerConvergeStaticIr:Zn}};if(yield*n0e({runtime:nn,runtimeInternals:ln}),yield*Cf(()=>Ze(()=>{we.clear()})),t.tag&&B0e(t.tag,nn),yield*Cf(()=>p.runDestroy.pipe(ze(()=>ee("lifecycle","module:destroy",{meta:{moduleId:t.moduleId,instanceId:d}},it({type:"module:destroy",moduleId:t.moduleId,instanceId:d}))),li(()=>Ze(()=>{t.tag&&U0e(t.tag),We&&V0e(We)})))),t.tag&&t.logics?.length&&(yield*exe({tag:t.tag,logics:t.logics,runtime:nn,lifecycle:p,moduleId:u,instanceId:d})),t.processes&&t.processes.length>0){const oe=yield*lH(),Me=ts(oe,z0);if(!(Pe(Me)&&Array.isArray(Me.value.appModuleIds)&&Me.value.appModuleIds.includes(u))){const Ee=ts(oe,LA),De=Pe(Ee)?Ee.value:void 0,Re={type:"moduleInstance",moduleId:u,instanceId:d};yield*sn(t.processes,_e=>ae(function*(){if(De){const Tt=De.install(_e,{scope:Re,enabled:!0,installedAt:"moduleRuntime"});if((t.tag?yield*Tt.pipe(ci(t.tag,nn)):yield*Tt)!==void 0)return}yield*Vn(_e)}),{discard:!0})}}return nn}),oxe=(e,t)=>Iw(e,t),sxe=e=>{if(typeof e=="string")return e.trim().length>0?"*":void 0;if(!Array.isArray(e))return;const t=[];for(const n of e)if(typeof n=="string"){IS(n)&&t.push(n);continue}return t.length===0?"*":t},U0=(e,t)=>{const n=Iw(e,t,{enablePatches:{pathAsArray:!0,arrayLengthAssignment:!1}});if(!Array.isArray(n))return{nextState:n,patchPaths:[]};const r=n[0],i=n[1]??[],o=new Map;for(const a of i){const c=sxe(a?.path);if(!c)continue;const u=c==="*"?"*":JSON.stringify(c);o.has(u)||o.set(u,c)}return{nextState:r,patchPaths:Array.from(o.values())}},axe=()=>ft(Vy).pipe(Qe(e=>Pe(e)?e.value.stack:[])),lxe=e=>{if(!e)return{};if(typeof e!="object"&&typeof e!="function")return{};const t=e;return{moduleId:typeof t.moduleId=="string"?t.moduleId:void 0,instanceId:typeof t.instanceId=="string"?t.instanceId:void 0}},cxe=(e,t)=>typeof e=="function"?e(t):e,G6=(e,t)=>{const n=lxe(e),r=()=>t?t.concurrency.resolveConcurrencyPolicy().pipe(Qe(u=>u.concurrencyLimit)):on(16),i=(u,d,h,p)=>ae(function*(){const y=yield*axe(),g={...p?.meta??{},policy:p?.policy,tags:p?.tags,trace:p?.trace,moduleId:n.moduleId,instanceId:n.instanceId};if(!(typeof g.opSeq=="number"&&Number.isFinite(g.opSeq))){const S=yield*ft(pl);if(Pe(S)){const x=g.instanceId??"global";g.opSeq=S.value.local.nextSeq("opSeq",x)}}const v=jg({kind:"flow",name:u,payload:d,effect:h,meta:g});return yield*Fg(v,y)}),o=u=>d=>cxe(u,d),a=(u,d)=>h=>ba(h,p=>i("flow.run",p,o(u)(p),d)),c=(u,d)=>h=>ae(function*(){const p=yield*r();return yield*Qm(h.pipe(Ng(y=>i("flow.runParallel",y,o(u)(y),d),{concurrency:p}))).pipe(zt(y=>it({type:"diagnostic",moduleId:n.moduleId,instanceId:n.instanceId,code:"flow::unhandled_failure",severity:"error",message:"Flow watcher (runParallel) failed with an unhandled error.",hint:"Handle errors explicitly inside the watcher (catch/catchAll) or write back via TaskRunner failure; avoid silent failures.",kind:"flow_unhandled_failure",trigger:{kind:"flow",name:"runParallel"}}).pipe(rt(gr(y)))))});return{fromAction:u=>e.actions$.pipe(Es(u)),fromState:u=>e.changes(j6(u)?u.select:u),debounce:u=>d=>hye(d,u),throttle:u=>d=>Sye(d,{cost:()=>1,units:1,duration:u,strategy:"enforce"}),filter:u=>d=>Es(d,u),run:(u,d)=>h=>a(u,d)(h),runParallel:(u,d)=>h=>c(u,d)(h),runLatest:(u,d)=>h=>Qm(Rs(h,p=>i("flow.runLatest",p,o(u)(p),d)).pipe(mye(p=>gye(p),{switch:!0}))),runExhaust:(u,d)=>h=>ae(function*(){const p=yield*r(),y=yield*Kn(!1),g=v=>ae(function*(){if(yield*mr(y,x=>x?[!1,x]:[!0,!0]))try{yield*i("flow.runExhaust",v,o(u)(v),d)}finally{yield*id(y,!1)}});return yield*Qm(h.pipe(Ng(g,{concurrency:p})))})}},uxe=e=>{let t;const n={with:(r,i)=>(t||r(e)&&(t=i(e)),n),otherwise:r=>t||r(e),exhaustive:()=>t||Js("[FluentMatch] Non-exhaustive match: no pattern matched value")};return n},dxe=e=>{let t;const n={with:(r,i)=>(t||e._tag===r&&(t=i(e)),n),otherwise:r=>t||r(e),exhaustive:()=>t||Js("[FluentMatchTag] Non-exhaustive match: no tag handler matched value")};return n},fxe=e=>typeof e?.id=="string"?String(e.id):typeof e?.key=="string"?String(e.key):"<unknown tag>",_F=(e,t,n)=>{const r=Sn(),i=fxe(e),o=r?["- Provide it when creating the runtime tree (Logix.Runtime.make(...,{ layer }) / ManagedRuntime.make(Layer.mergeAll(...))).","- If you're in React and want the current runtime environment singleton, use useModule(ModuleTag).","- Do not rely on nested RuntimeProvider.layer to mock Root.resolve."]:[],a=r?["[MissingRootProviderError] Cannot resolve Tag from root provider.",n?`
52
+ ${n}`:"",`tokenId: ${i}`,`entrypoint: ${t}`,"mode: global","startScope: root","","fix:",...o].filter(u=>u.length>0).join(`
53
+ `):"[MissingRootProviderError] tag not found in root provider",c=new Error(a);return c.name="MissingRootProviderError",c.tokenId=i,c.entrypoint=t,c.mode="global",c.startScope={kind:"root"},c.fix=o,c},hxe=(e,t)=>ae(function*(){const n=t?.entrypoint??"logic.root.resolve",r=yield*z0,i=r.context??(t?.waitForReady?yield*r.ready:void 0);if(!i)return yield*Mg(_F(e,n,"reason: rootContextNotReady"));try{return ma(i,e)}catch{return yield*Mg(_F(e,n))}}),Nm=(e,t)=>{const n=G6(e,t);return(r,i)=>{const o=(d,h)=>t.txn.runWithStateTransaction(d,h),a={moduleId:e.moduleId,instanceId:t.instanceId,runWithStateTransaction:o,resolveConcurrencyPolicy:t.concurrency.resolveConcurrencyPolicy},c={debounce:d=>Nm(e,t)(n.debounce(d)(r),i),throttle:d=>Nm(e,t)(n.throttle(d)(r),i),filter:d=>Nm(e,t)(n.filter(d)(r),i),map:d=>Nm(e,t)(r.pipe(Rs(d)),i),run(d,h){return n.run(d,h)(r)},runLatest(d,h){return n.runLatest(d,h)(r)},runExhaust(d,h){return n.runExhaust(d,h)(r)},runParallel(d,h){return n.runParallel(d,h)(r)},runFork:d=>Vn(n.run(d)(r)).pipe(fn),runParallelFork:d=>Vn(n.runParallel(d)(r)).pipe(fn),runTask:d=>Ov(r,"task",a,{...d,triggerName:d.triggerName??i}),runParallelTask:d=>Ov(r,"parallel",a,{...d,triggerName:d.triggerName??i}),runLatestTask:d=>Ov(r,"latest",a,{...d,triggerName:d.triggerName??i}),runExhaustTask:d=>Ov(r,"exhaust",a,{...d,triggerName:d.triggerName??i}),toStream:()=>r,update:d=>ba(r,h=>a.runWithStateTransaction({kind:"watcher:update",name:i},()=>ae(function*(){const p=yield*e.getState,y=d(p,h);if(Td(y)){const g=yield*en(y);if(g._tag==="Failure"){yield*dc("Flow error",g.cause);return}yield*e.setState(g.value);return}yield*e.setState(y)}))).pipe(zt(h=>dc("Flow error",h))),mutate:d=>ba(r,h=>a.runWithStateTransaction({kind:"watcher:mutate",name:i},()=>ae(function*(){const p=yield*e.getState,y=t.txn.recordStatePatch,g=t.txn.updateDraft,{nextState:v,patchPaths:S}=U0(p,x=>{d(x,h)});for(const x of S)y(x,"unknown");g(v)}))).pipe(zt(h=>dc("Flow error",h)))};return Object.assign(c,{pipe:function(){const d=arguments;let h=c;for(let p=0;p<d.length;p++)h=d[p](h);return h}})}};function pxe(e,t,n){const r=kA(t),i=n?.getPhase??(()=>"run"),o=()=>(n?.phaseService?.current??i())==="setup"?"setup":"run",a=(P,B)=>{if((n?.phaseService?.current??i())==="setup")throw xF(P,B,"setup",n?.moduleId)},c=G6(t,r),u=P=>Nm(P,r),d=P=>it({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"logic::invalid_phase",severity:"error",message:`${P} is setup-only and is not allowed in run phase.`,hint:"Move $.lifecycle.* calls to the synchronous part of Module.logic builder (before return) for registration; for dynamic resource cleanup in the run phase, use Effect.acquireRelease / Scope finalizer instead of registering onDestroy late.",kind:"lifecycle_in_run"}),h=(P,B)=>u(t)(P,B),p=P=>ft(pl).pipe(Qe(B=>Pe(B)?B.value.local.once(P):!0));let y;const g=P=>!!(P&&typeof P=="object"&&(P._kind==="ModuleDef"||P._kind==="Module")&&"tag"in P&&ah(P.tag)),v=(P,B)=>{const $=new Proxy({},{get:(G,J)=>F=>B.dispatch({_tag:J,payload:F})}),V={read:G=>Qe(B.getState,G),changes:B.changes,dispatch:B.dispatch,actions$:B.actions$,actions:$},j=Symbol.for("logix.module.handle.extend"),K=P?.[j];return typeof K=="function"?K(B,V)??V:V},S=(P,B)=>ae(function*(){if(y==="off")return;const $=`module_descriptor:${String(B.instanceId??"unknown")}`;if(!(yield*p($)))return;const j=Object.keys(P.tag?.shape?.actionMap??{}),K=Symbol.for("logix.module.internal"),J=(P[K]?.mounted??[]).map(Z=>({kind:String(Z?.kind??"user"),id:String(Z?.id??""),derived:Z?.derived?!0:void 0,name:typeof Z?.name=="string"?Z.name:void 0})),F=P.schemas&&typeof P.schemas=="object"?Object.keys(P.schemas):void 0,U=P.meta&&typeof P.meta=="object"?P.meta:void 0,Q=P.dev?.source,z=r.traits.getModuleTraitsSnapshot(),ne=z?{digest:z.digest,count:z.traits.length}:void 0,ce={id:P.id,moduleId:String(B.moduleId),instanceId:String(B.instanceId),actionKeys:j,logicUnits:J,schemaKeys:F,meta:U,source:Q,traits:ne};yield*it({type:"trace:module:descriptor",moduleId:B.moduleId,instanceId:B.instanceId,data:ce})}),x=P=>ae(function*(){const B=typeof P?.id=="string"?P.id:void 0,$=typeof n?.moduleId=="string"?n.moduleId:t.moduleId;if(B&&B===t.moduleId)return t;const V=r.imports.get(P);if(V)return V;if(typeof n?.moduleId!="string"){const J=yield*ft(P);if(Pe(J))return J.value}const j=B??"<unknown module id>",K=Sn()?["- Provide the child implementation in the same scope (imports).",` Example: ${$??"ParentModule"}.implement({ imports: [${B??"ChildModule"}.impl], ... })`,"- If you intentionally want a root singleton, provide it at app root (Runtime.make(...,{ layer }) / root imports),"," and use Root.resolve(ModuleTag) (instead of $.use) at the callsite."]:[],G=new Error(Sn()?["[MissingModuleRuntimeError] Cannot resolve ModuleRuntime for ModuleTag.","",`tokenId: ${j}`,"entrypoint: logic.$.use","mode: strict",`from: ${$??"<unknown module id>"}`,`startScope: moduleId=${$??"<unknown>"}, instanceId=${String(t.instanceId??"<unknown>")}`,"","fix:",...K].join(`
54
+ `):"[MissingModuleRuntimeError] module runtime not found");return G.tokenId=j,G.entrypoint="logic.$.use",G.mode="strict",G.from=$,G.startScope={moduleId:$,instanceId:String(t.instanceId??"<unknown>")},G.fix=K,G.name="MissingModuleRuntimeError",yield*Mg(G)}),k={read:t.getState,update:P=>ae(function*(){if(yield*ut(os)){const V=yield*t.getState;return yield*t.setState(P(V))}const $=()=>ze(t.getState,V=>t.setState(P(V)));return yield*r?r.txn.runWithStateTransaction({kind:"state",name:"update"},$):$()}),mutate:P=>ae(function*(){const B=r?.txn.recordStatePatch,$=r?.txn.updateDraft;if(yield*ut(os)){const K=yield*t.getState,{nextState:G,patchPaths:J}=U0(K,F=>{P(F)});for(const F of J)B?.(F,"unknown");$?.(G);return}const j=()=>ae(function*(){const K=yield*t.getState,{nextState:G,patchPaths:J}=U0(K,F=>{P(F)});for(const F of J)B?.(F,"unknown");$?.(G)});return yield*r?r.txn.runWithStateTransaction({kind:"state",name:"mutate"},j):j()}),ref:t.ref},_=e.actionMap,E=new Map,M=P=>Object.prototype.hasOwnProperty.call(_,P),D=new Proxy({},{get:(P,B)=>{if(typeof B!="string"||!M(B))return;const $=E.get(B);if($)return $;const V=_[B],j=(...K)=>t.dispatch(V(...K));return E.set(B,j),j},has:(P,B)=>typeof B=="string"&&M(B),ownKeys:()=>Object.keys(_),getOwnPropertyDescriptor:(P,B)=>{if(typeof B=="string"&&M(B))return{enumerable:!0,configurable:!0}}}),L={root:{resolve:P=>(a("root_resolve_in_setup","$.root.resolve"),hxe(P,{entrypoint:"logic.$.root.resolve",waitForReady:!0}))},state:k,actions:_,dispatchers:D,dispatch:(...P)=>{const[B,$]=P;return typeof B=="string"?t.dispatch({_tag:B,payload:$}):Zm(B)?t.dispatch(B($)):t.dispatch(B)},flow:c,match:P=>uxe(P),matchTag:P=>dxe(P),lifecycle:{onInitRequired:P=>o()==="run"?d("$.lifecycle.onInitRequired"):(r.lifecycle.registerInitRequired(P),he),onStart:P=>o()==="run"?d("$.lifecycle.onStart"):(r.lifecycle.registerStart(P),he),onInit:P=>o()==="run"?d("$.lifecycle.onInit"):(r.lifecycle.registerInitRequired(P),he),onDestroy:P=>o()==="run"?d("$.lifecycle.onDestroy"):(r.lifecycle.registerDestroy(P),he),onError:P=>o()==="run"?d("$.lifecycle.onError"):(r.lifecycle.registerOnError(P),he),onSuspend:P=>o()==="run"?d("$.lifecycle.onSuspend"):(r.lifecycle.registerPlatformSuspend(fn(P)),he),onResume:P=>o()==="run"?d("$.lifecycle.onResume"):(r.lifecycle.registerPlatformResume(fn(P)),he),onReset:P=>o()==="run"?d("$.lifecycle.onReset"):(r.lifecycle.registerPlatformReset(fn(P)),he)},traits:{declare:P=>{if(o()==="run")throw xF("traits_declare_in_run","$.traits.declare","run",n?.moduleId);if(!P||typeof P!="object")throw new Error("[InvalidTraitsDeclaration] $.traits.declare expects an object.");const B=n?.logicUnit??{logicUnitId:"unknown",logicUnitIdKind:"derived",logicUnitLabel:"logicUnit:unknown",path:void 0};r.traits.registerModuleTraitsContribution({traits:P,provenance:{originType:"logicUnit",originId:B.logicUnitId,originIdKind:B.logicUnitIdKind,originLabel:B.logicUnitLabel,path:B.path}})},source:{refresh:(P,B)=>ae(function*(){const $=r.traits.getSourceRefreshHandler(P);if(!$)return yield*he;const V=B?.force===!0,j=G=>V?lr(CC,!0)($(G)):$(G);if(yield*ut(os)){const G=yield*t.getState;return yield*j(G)}return yield*r.txn.runWithStateTransaction({kind:"source-refresh",name:P},()=>ae(function*(){const G=yield*t.getState;return yield*j(G)}))})}},reducer:(P,B)=>Ze(()=>{r.txn.registerReducer(String(P),B)}),effect:(P,B)=>ae(function*(){if(!Zm(P))return yield*Js("[BoundApi.effect] token must be an ActionToken");const $=o(),V=n?.logicUnit;yield*r.effects.registerEffect({actionTag:P.tag,handler:B,phase:$,...V?{logicUnit:{logicUnitId:V.logicUnitId,logicUnitLabel:V.logicUnitLabel,path:V.path}}:{}})}),use:new Proxy(()=>{},{apply:(P,B,[$])=>{if(a("use_in_setup","$.use"),g($)){const V=$,j=V.tag,K=x(j).pipe(Qe(F=>v(j,F))),G=x(j).pipe(li(F=>S(V,F)),Qe(F=>v(j,F))),J=ut(Ei).pipe(li(F=>{y=F}),ze(F=>F==="off"?K:G));return En(()=>y==="off"?K:y!==void 0?G:J)}return ah($)?$._kind==="ModuleTag"?x($).pipe(Qe(j=>v($,j))):$:Mg("BoundApi.use: unsupported argument")}}),onAction:new Proxy(()=>{},{apply:(P,B,$)=>{a("use_in_setup","$.onAction");const V=$[0];if(Zm(V)){const j=V.tag;return h(t.actions$.pipe(Es(K=>K._tag===j||K.type===j),Rs(K=>K.payload)),j)}if(typeof V=="function")return h(t.actions$.pipe(Es(V)));if(typeof V=="string")return h(t.actions$.pipe(Es(j=>j._tag===V||j.type===V)),V);if(typeof V=="object"&&V!==null){if("_tag"in V)return h(t.actions$.pipe(Es(j=>j._tag===V._tag)),String(V._tag));if(Pg(V))return h(t.actions$.pipe(Es(j=>!!kge(V)(j))))}return h(t.actions$)},get:(P,B)=>{if(a("use_in_setup","$.onAction"),typeof B=="string")return h(t.actions$.pipe(Es($=>$._tag===B||$.type===B)),B)}}),onState:P=>(a("use_in_setup","$.onState"),h(t.changes(P))),on:P=>(a("use_in_setup","$.on"),h(P))};return Mbe(L,r),L}function mxe(e,t){const n={stateSchema:t.state,actionSchema:rp(...Object.entries(t.actions).map(([c,u])=>{const d=u.schema;return yi(d===vs?{_tag:mi(c),payload:Ym(d)}:{_tag:mi(c),payload:d})})),actionMap:t.actions},r=t.reducers&&Object.fromEntries(Object.entries(t.reducers).map(([c,u])=>[c,(d,h,p)=>u(d,h,p)]));class i extends tn(`@logixjs/Module/${e}`)(){}const o=i,a=Object.assign(o,{_kind:"ModuleTag",id:e,shape:n,stateSchema:n.stateSchema,actionSchema:n.actionSchema,actions:n.actionMap,reducers:t.reducers,logic:c=>{const u=ae(function*(){const d=yield*o,h=yield*ft(q6).pipe(Qe(Pi)),p=yield*ft(BC).pipe(Qe(Pi)),y=pxe(n,d,{getPhase:()=>p?.current??"run",phaseService:p,moduleId:e,logicUnit:h});let g;try{g=c(y)}catch(x){if(x?._tag==="LogicPhaseError")return yield*Qa(x);throw x}return qC(g)?yield*g:(x=>!!(x&&typeof x=="object"&&"setup"in x&&"run"in x))(g)?g:{setup:he,run:g}});return X0e(u),u},live:(c,...u)=>_0(o,kF(c,{tag:o,logics:u,moduleId:e,reducers:r})),implement:c=>{const u=(c.imports??[]).flatMap(S=>S._tag==="ModuleImpl"?[S.module]:[]),d=_0(o,kF(c.initial,{tag:o,logics:c.logics||[],processes:c.processes||[],moduleId:e,imports:u,reducers:r,stateTransaction:c.stateTransaction})),h=c.processes??[],p=S=>({_tag:"ModuleImpl",module:a,layer:S,processes:h,stateTransaction:c.stateTransaction,withLayer:x=>{const k=S.pipe(pH(x)),_=ol(k,x);return p(_)},withLayers:(...x)=>x.reduce((k,_)=>k.withLayer(_),p(S))}),y=p(d);return(c.imports??[]).reduce((S,x)=>{const k=x._tag==="ModuleImpl"?x.layer:x;return S.withLayer(k)},y)}});return a}const gxe=e=>{const t=new Map;for(const n of e){const r=t.get(n.fieldPath)??[];r.push(n),t.set(n.fieldPath,r)}return t},yxe=(e,t)=>{try{ld(e).traits.registerStateTraitProgram(t,{bumpReason:"logic_installed"})}catch{}const n=gxe(t.entries),r=i=>{if(!i.targetFieldPath||i.kind!=="source-refresh")return he;const o=n.get(i.targetFieldPath);if(!o||o.length===0)return he;const a=o.find(c=>c.kind==="source");return a?FSe(e,i,a):he};return sn(t.plan.steps,i=>r(i)).pipe(fn)},EF=(e,t)=>P6(e,t),bxe=(e,t)=>yxe(e,t);class vxe extends Error{constructor(t,n){super([`[ModuleTraitsConflictError] Conflicting traitIds found (moduleId=${t}).`,...n.map(r=>r.kind==="duplicate_traitId"?`- duplicate ${r.traitId}: ${r.sources.map(i=>`${i.originType}:${i.originId}`).join(", ")}`:r.kind==="missing_requires"?`- missing requires for ${r.traitId}: ${(r.missing??[]).join(", ")}; sources=${r.sources.map(i=>`${i.originType}:${i.originId}`).join(", ")}`:`- excludes violation for ${r.traitId}: present=${(r.present??[]).join(", ")}; sources=${r.sources.map(i=>`${i.originType}:${i.originId}`).join(", ")}`)].join(`
55
+ `)),this.moduleId=t,this.conflicts=n}_tag="ModuleTraitsConflictError"}const Sxe=e=>`${e.originType}:${e.originId}:${e.originIdKind}:${e.originLabel}:${e.path??""}`,TF=(e,t)=>{const n=e.originType.localeCompare(t.originType);if(n!==0)return n;const r=e.originId.localeCompare(t.originId);if(r!==0)return r;const i=e.originIdKind.localeCompare(t.originIdKind);if(i!==0)return i;const o=e.originLabel.localeCompare(t.originLabel);return o!==0?o:String(e.path??"").localeCompare(String(t.path??""))},CF=e=>e==="module"?0:1,xxe=(e,t)=>{const n=CF(e.provenance.originType)-CF(t.provenance.originType);if(n!==0)return n;const r=e.provenance.originId.localeCompare(t.provenance.originId);return r!==0?r:e.traitId.localeCompare(t.traitId)},Y6=e=>{if(!Array.isArray(e))return[];const t=[];for(const n of e){if(typeof n!="string")continue;const r=n.trim();r&&t.push(r)}return t},wxe=e=>!e||typeof e!="object"?[]:Y6(e.requires),kxe=e=>!e||typeof e!="object"?[]:Y6(e.excludes),_xe=(e,t)=>{if(t&&typeof t=="object"){const n=t.name;if(typeof n=="string"&&n.trim().length>0)return n.trim()}return e},Exe=e=>{if(e&&typeof e=="object"){const t=e.description;if(typeof t=="string"&&t.trim().length>0)return t.trim()}},Txe=e=>{const t=new Map,n=new Map,r=[...e.contributions].sort((v,S)=>TF(v.provenance,S.provenance));for(const v of r){const S=v.traits;if(!(!S||typeof S!="object"))for(const x of Object.keys(S).sort((k,_)=>k.localeCompare(_))){const k=S[x];if(k===void 0)continue;const _=t.get(x);if(!_){t.set(x,{value:k,provenance:v.provenance});continue}const E=n.get(x)??[_.provenance];E.push(v.provenance),n.set(x,E)}}const i=[],o=v=>{const S=new Map;for(const x of v.sources)S.set(Sxe(x),x);i.push({...v,sources:Array.from(S.values()).sort(TF)})};for(const v of Array.from(n.keys()).sort((S,x)=>S.localeCompare(x)))o({kind:"duplicate_traitId",traitId:v,sources:n.get(v)??[]});const a={},c={},u=[],d=[];for(const v of t.keys()){const S=t.get(v);S&&d.push({traitId:v,value:S.value,provenance:S.provenance})}const h=d.slice().sort(xxe).map(v=>v.traitId);for(const v of h){const S=t.get(v);S&&(a[v]=S.value,c[v]=S.provenance,u.push({traitId:v,name:_xe(v,S.value),description:Exe(S.value)}))}const p=new Set(h);for(const v of h){const S=t.get(v);if(!S)continue;const x=wxe(S.value);if(x.length>0){const _=x.filter(E=>!p.has(E));_.length>0&&o({kind:"missing_requires",traitId:v,missing:Array.from(new Set(_)).sort((E,M)=>E.localeCompare(M)),sources:[S.provenance]})}const k=kxe(S.value);if(k.length>0){const _=k.filter(E=>p.has(E));if(_.length>0){const E=[];for(const M of _){const D=t.get(M);D&&E.push(D.provenance)}o({kind:"excludes_violation",traitId:v,present:Array.from(new Set(_)).sort((M,D)=>M.localeCompare(D)),sources:[S.provenance,...E]})}}}if(i.length>0){const v={duplicate_traitId:0,missing_requires:1,excludes_violation:2};throw i.sort((S,x)=>{const k=v[S.kind]-v[x.kind];return k!==0?k:S.traitId.localeCompare(x.traitId)}),new vxe(e.moduleId,i)}const y={moduleId:e.moduleId,traits:u,provenanceIndex:c},g=`mtraits:023:${ip(_c(y))}`;return{merged:a,snapshot:{moduleId:e.moduleId,digest:g,traits:u,provenanceIndex:c}}},Q6={mutate:e=>(t,n,r)=>{const i=n?.payload;if(!r)return oxe(t,c=>{e(c,i)});const{nextState:o,patchPaths:a}=U0(t,c=>{e(c,i)});for(const c of a)r(c);return o},mutateMap:e=>{const t={};for(const n of Object.keys(e)){const r=e[n];typeof r=="function"&&(t[n]=Q6.mutate(r))}return t}},Cxe=(e,t)=>mxe(e,t),Ixe=(e,t)=>{const n=v6(t.actions),r=Cxe(e,{state:t.state,actions:n,reducers:t.reducers}),i=t.state,o=t.traits,a=o?EF(i,o):void 0;a&&(bj(r,a),yj(e,a));const c=h=>{const p=r.logic(y=>({setup:Ze(()=>{if(!h||typeof h!="object")return;ld(y).traits.registerModuleTraitsContribution({traits:h,provenance:{originType:"module",originId:e,originIdKind:"explicit",originLabel:`module:${e}`}})}),run:he}));return Ug(p,{id:"__logix_internal:traits:module_contrib",kind:"internal",name:"traits:module_contrib",moduleId:e}),p},u=()=>{const h=r.logic(p=>({setup:ae(function*(){const y=ld(p),g=yield*ut(Ei),v=y.traits.getModuleTraitsContributions();let S,x;try{({merged:S,snapshot:x}=Txe({moduleId:e,contributions:v}))}catch(E){if(g!=="off"&&E&&typeof E=="object"&&E._tag==="ModuleTraitsConflictError"){const M=Array.isArray(E.conflicts)?E.conflicts:[],D=M.map(C=>C&&typeof C=="object"?C.traitId:void 0).filter(C=>typeof C=="string"&&C.length>0).slice(0,20),T=g==="full"?{conflictCount:M.length,conflicts:M}:{conflictCount:M.length,traitIds:D};yield*it({type:"trace:module:traits:conflict",moduleId:e,instanceId:y.instanceId,data:T})}throw E}if(y.traits.setModuleTraitsSnapshot(x),y.traits.freezeModuleTraits(),g!=="off"){const E=g==="full"?{digest:x.digest,count:x.traits.length,traits:x.traits,provenanceIndex:x.provenanceIndex}:{digest:x.digest,count:x.traits.length};yield*it({type:"trace:module:traits",moduleId:e,instanceId:y.instanceId,data:E})}if(Object.keys(S).length===0)return;const _=v.length===1&&v[0]?.provenance?.originType==="module"&&a?a:EF(i,S);bj(r,_),yj(e,_),yield*bxe(p,_)}),run:he}));return Ug(h,{id:"__logix_internal:traits:finalize",kind:"internal",name:"traits:finalize",moduleId:e}),h},d=r.implement;return r.implement=(h=>{const p=h.logics??[],y=t.traits?[c(t.traits)]:[],g=u(),v=[...y,...p,g];return d({...h,logics:v})}),r},Mxe=(e,t)=>Ug(e,t),sE=Symbol.for("logix.module.internal"),Rxe=Symbol.for("logix.module.effects.declared"),X6=e=>{if(!e||typeof e!="object")return!1;const t=e._kind;return t!=="ModuleDef"&&t!=="Module"?!1:ah(e.tag)},Axe=e=>X6(e)?typeof e.impl=="object"&&e.impl!==null&&e.impl._tag==="ModuleImpl":!1,Oxe=e=>Array.isArray(e)?{logic:e[0],options:e[1]}:{logic:e},Dxe=(e,t,n)=>{const r=$A(t),i=n?.id,o=r?.id,a=(n?.kind??r?.kind??"user").trim()||"user",c=n?.name??r?.name??(typeof o=="string"&&o.length>0?o:void 0),u=n?.source??r?.source;if(typeof i=="string"&&i.trim().length>0)return{id:i.trim(),derived:!1,kind:a,name:c,source:u,logic:t,origin:{explicitId:i.trim(),defaultId:o}};if(typeof o=="string"&&o.trim().length>0)return{id:o.trim(),derived:!1,kind:a,name:c,source:u,logic:t,origin:{defaultId:o.trim()}};const d=new Set(e.map(v=>v.id)),h=(c??a??"logic").trim()||"logic",p=h.replace(/\s+/g,"_");let y=1;for(;d.has(`${p}#${y}`);)y+=1;return{id:`${p}#${y}`,derived:!0,kind:a,name:c??h,source:u,logic:t,origin:{derivedBase:h}}},IF=(e,t,n)=>{const r=Dxe(e,n.logic,n.options);Q0e(r.logic,{resolvedId:r.id,resolvedIdKind:r.derived?"derived":"explicit",resolvedKind:r.kind,resolvedName:r.name,resolvedSource:r.source});const i=e.findIndex(u=>u.id===r.id);if(i<0)return{mounted:[...e,r],overrides:t};const o=e[i],a=[...e.slice(0,i),...e.slice(i+1),r],c=[...t,{id:r.id,from:{kind:o.kind,name:o.name,source:o.source,order:i},to:{kind:r.kind,name:r.name,source:r.source,order:a.length-1}}];return{mounted:a,overrides:c}},MF=e=>e?`${e.file}:${e.line}:${e.column}`:"unknown",Pxe=(e,t)=>t.length===0?he:e.logic(()=>ae(function*(){if(!Sn()||(yield*ut(Hy.currentDiagnosticsLevel))==="off")return;const r=yield*e;yield*sn(t,i=>wi({type:"diagnostic",moduleId:r.moduleId,instanceId:r.instanceId,code:"module_logic::override",severity:"warning",message:`logicUnitId "${i.id}" overridden (last-write-wins).`,hint:`from(#${i.from.order}) kind=${i.from.kind} name=${i.from.name??"unknown"} source=${MF(i.from.source)}
56
+ to(#${i.to.order}) kind=${i.to.kind} name=${i.to.name??"unknown"} source=${MF(i.to.source)}`,kind:"logic_unit_override"}),{discard:!0})})),Nxe=(e,t,n)=>{if(!t||typeof t!="object"||Object.keys(t).length===0)return he;const r=e.logic(i=>({setup:ae(function*(){const o=i.actions,a=i.effect;if(typeof a!="function")return;const c=new WeakMap;for(const u of Object.keys(t).sort()){const d=o[u];if(!Zm(d))continue;const h=t[u];if(Array.isArray(h))for(const p of h){if(typeof p!="function")continue;let y=c.get(p);y||(y=g=>p(i,g),c.set(p,y)),yield*a(d,y)}}}),run:he}));return Ug(r,{id:"__logix_internal:effects:declared",kind:"internal",name:"effects:declared",moduleId:n}),r},RF=e=>{const t=e.tag;return(n,r)=>{const i=t.logic(a=>{const c=Object.create(a);return c.self=En(()=>a.use(e)),n(c)}),o={id:r?.id,kind:r?.kind,name:r?.name,source:r?.source,moduleId:e.id};return Mxe(i,o)}},Lxe=(e,t)=>{const n=e.actions,r={};for(const v of Object.keys(r))if(v in n&&n[v]!==r[v])throw new Error(`[Logix.Module.make] action key "${v}" already exists; overriding action schemas is not supported (define a new action tag instead).`);const i={...e.actions,...t?.actions},o=v6(i),c=(()=>{const v=e.effects??{},S={},x=Array.from(new Set([...Object.keys(v),...Object.keys(S)])).sort();if(x.length===0)return;const k={};for(const _ of x){if(!(_ in o))throw new Error(`[Logix.Module.make] effect key "${_}" does not exist in actionMap.`);const E=v[_],M=S[_],D=Array.isArray(E)?E:E===void 0?[]:null,T=Array.isArray(M)?M:M===void 0?[]:null;if(D===null)throw new Error(`[Logix.Module.make] effects["${_}"] must be an array of handlers.`);if(T===null)throw new Error(`[Logix.Module.make] effects["${_}"] must be an array of handlers.`);const C=[...D,...T].filter(O=>O!==void 0);for(const O of C)if(typeof O!="function")throw new Error(`[Logix.Module.make] effects["${_}"] handlers must be functions.`);C.length>0&&(k[_]=C)}return Object.keys(k).length>0?k:void 0})(),u=v=>{if(!v)return{};const S={};for(const x of Object.keys(v)){const k=v[x];typeof k=="function"&&(S[x]=Q6.mutate(k))}return S},d={...u(e.immerReducers),...e.reducers??{},...u(t?.immerReducers)};for(const v of Object.keys(d))if(!(v in o))throw new Error(`[Logix.Module.make] reducer key "${v}" does not exist in actionMap.`);const h=e.schemas||t?.schemas?{...e.schemas??{}}:void 0,p=e.meta||t?.meta?{...e.meta??{}}:void 0,y=e.services||t?.services?{...e.services??{}}:void 0,g=e.dev||t?.dev?{...e.dev??{}}:void 0;return{...e,actions:o,reducers:Object.keys(d).length>0?d:void 0,effects:c,schemas:h,meta:p,services:y,dev:g}};function $xe(e,t,n){const r=Lxe(t,n),i=Ixe(e,{state:r.state,actions:r.actions,reducers:r.reducers,traits:r.traits});r.effects&&typeof r.effects=="object"&&Object.keys(r.effects).length>0&&Object.defineProperty(i,Rxe,{value:r.effects,enumerable:!1,configurable:!0,writable:!1});const o={_kind:"ModuleDef",id:e,tag:i,shape:i.shape,stateSchema:i.stateSchema,actionSchema:i.actionSchema,actions:r.actions,reducers:r.reducers,effects:r.effects,live:i.live,schemas:r.schemas,meta:r.meta,services:r.services,dev:r.dev};return o.logic=RF(o),o.implement=a=>{const c=a.initial,u=a.imports,d=a.processes,h=a.stateTransaction,p=(a.logics??[]).reduce((v,S)=>IF(v.mounted,v.overrides,{logic:S}),{mounted:[],overrides:[]}),y=v=>{const S=Pxe(i,v.overrides),x=Nxe(i,r.effects,e),k=[...v.mounted.map(E=>E.logic),x,S];let _=i.implement({initial:c,logics:k,imports:u,processes:d,stateTransaction:h});for(const E of v.layers)_=_.withLayer(E);return _},g=v=>{const S={initial:c,imports:u,processes:d,stateTransaction:h,mounted:v.mounted,overrides:v.overrides,layers:v.layers,rebuild:()=>y(v)},x={...o,_kind:"Module",impl:y(v)};return Object.defineProperty(x,sE,{value:S,enumerable:!1,configurable:!0}),x.logic=RF(x),x.withLogic=(k,_)=>x.withLogics([k,_]),x.withLogics=(...k)=>{const _=x[sE],M=k.map(Oxe).reduce((D,T)=>IF(D.mounted,D.overrides,T),{mounted:_.mounted,overrides:_.overrides});return g({mounted:M.mounted,overrides:M.overrides,layers:_.layers})},x.withLayer=k=>{const _=x[sE];return g({mounted:_.mounted,overrides:_.overrides,layers:[..._.layers,k]})},x.withLayers=(...k)=>k.reduce((_,E)=>_.withLayer(E),x),x};return g({mounted:p.mounted,overrides:p.overrides,layers:[]})},o}ds("@logixjs/Runtime");const jxe=z6,AF=e=>{const t=e;return typeof t.key=="string"?t.key:typeof t._id=="string"?t._id:typeof t.toString=="function"?t.toString():"[unknown-tag]"},Fxe=e=>{const t=new Map;for(const n of e){const r=String(n.module.id),i=n.module,o=AF(i),a={key:o,tag:i,ownerModuleId:r,source:"module"},c=t.get(o);if(c?c.push(a):t.set(o,[a]),n.serviceTags&&n.serviceTags.length>0)for(const u of n.serviceTags){const d=AF(u),h={key:d,tag:u,ownerModuleId:r,source:"service"},p=t.get(d);p?p.push(h):t.set(d,[h])}}return t},zxe=e=>{const t=Fxe(e),n=[];for(const[o,a]of t){if(a.length<=1)continue;const c=new Set;for(const u of a)c.add(u.ownerModuleId);c.size>1&&n.push({key:o,conflicts:a})}if(n.length===0)return;const r=`[Logix] Tag collision detected:
57
+ `+n.map(o=>{const a=`- key: ${o.key}`,c=o.conflicts.map(u=>` - owner: ${u.ownerModuleId}, source: ${u.source}`);return[a,...c].join(`
58
+ `)}).join(`
59
+ `);throw Object.assign(new Error(r),{_tag:"TagCollisionError",collisions:n})},Bxe=e=>{const t=new Set;for(const p of e.modules){const y=String(p.module.id);if(t.has(y))throw new Error(`[Logix] Duplicate Module ID/Tag detected: "${y}".
60
+ Ensure all modules in the application Runtime have unique IDs.`);t.add(y)}zxe(e.modules);const n=e.stateTransaction?ca(Cw,e.stateTransaction):fc,r=e.concurrencyPolicy?ca(h6,e.concurrencyPolicy):fc,i=e.readQueryStrictGate?ca(f6,e.readQueryStrictGate):fc,o=e.modules.map(p=>String(p.module.id)),a=o.length===1?o[0]:o.slice().sort().join("~"),c=ol(e.layer,n,r,i,I0e(),Ffe(z0,ae(function*(){return{context:void 0,ready:yield*br(),appId:a,appModuleIds:o}}))),u=e.modules.map(p=>pH(p.layer,c)),d=u.length>0?ol(c,...u):c,h=qfe(ae(function*(){const p=yield*NR,[y,g]=yield*vfe(gw(d,p)),v=ma(g,z0);v.context=g,yield*hi(v.ready,g);const S=ma(g,LA);yield*sn(e.processes,k=>ae(function*(){(yield*Eh(S.install(k,{scope:{type:"app",appId:a},enabled:!0,installedAt:"appRuntime"}),g))===void 0&&(yield*Vn(Eh(e.onError?zt(k,e.onError):k,g)))}),{discard:!0});const x=zfe(Ife(y));return ol(Bfe(g),x)}));return{definition:e,layer:h,makeRuntime:()=>Vge(h)}},Uxe=(e,t)=>{const n=qxe(t)?t:ca(e,t);return{module:e,layer:n}},qxe=e=>typeof e=="object"&&e!==null&&jfe in e,Vxe=e=>t=>ae(function*(){if(t.meta?.policy?.disableObservers)return yield*t.effect;if(!e?.filter||e.filter(t)){const n=t.meta??{},r={id:t.id,kind:t.kind,name:t.name,payload:t.payload,meta:t.meta};yield*wi({type:"trace:effectop",moduleId:typeof n.moduleId=="string"?n.moduleId:void 0,instanceId:typeof n.instanceId=="string"?n.instanceId:void 0,runtimeLabel:typeof n.runtimeLabel=="string"?n.runtimeLabel:void 0,txnSeq:typeof n.txnSeq=="number"&&Number.isFinite(n.txnSeq)?Math.floor(n.txnSeq):void 0,data:r})}return yield*t.effect}),Hxe=(e,t)=>[...e,Vxe(t)],Kxe=(e,t)=>{let n=e;if(t?.observer!==!1){const r=t?.observer;n=Hxe(n,r===void 0?void 0:r)}return n},yr=()=>Sn();class Wxe extends tn("@logixjs/core/ScopeRegistry")(){}class IFe extends tn("@logixjs/core/ScopeRegistry/ScopedRuntime")(){}const Gxe=()=>{let e=0;const t=new Map,n=(d,h)=>{const p=t.get(d);if(p){const v=p.get(h);if(v)return v;const S=[];return p.set(h,S),S}const y=[],g=new Map;return g.set(h,y),t.set(d,g),y},r=(d,h)=>{const p=t.get(d);if(!p)return;const y=p.get(h);y&&y.length===0&&p.delete(h),p.size===0&&t.delete(d)};return{register:(d,h,p)=>{e+=1;const y=e,g=n(d,h);return yr()&&g.length>0&&console.debug(`[ScopeRegistry] Multiple registrations detected for scopeId="${d}". This is allowed (LIFO), but usually indicates scopeId collisions or missing cleanup.`),g.push({leaseId:y,value:p}),{release:()=>{const S=t.get(d)?.get(h);if(!S||S.length===0)return;const x=S[S.length-1];if(x&&x.leaseId===y){S.pop(),r(d,h);return}const k=S.findIndex(_=>_.leaseId===y);k>=0&&(S.splice(k,1),r(d,h))}}},get:(d,h)=>{const p=t.get(d)?.get(h);if(!(!p||p.length===0))return p[p.length-1].value},clearToken:(d,h)=>{const p=t.get(d);p&&(p.delete(h),p.size===0&&t.delete(d))},clearScope:d=>{t.delete(d)},clearAll:()=>{t.clear()}}},Yxe=()=>ca(Wxe,Gxe()),Qxe=fye.pipe(n6());ar.pipe(n6());const Xxe=rp(mi("auto"),mi("full"),mi("dirty")),Jxe=rp(mi("full"),mi("light")),Zxe=rp(mi("unbounded"),Qxe),Ts=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),q0=(e,t)=>{Sn()&&t.length!==0&&console.warn(["[Logix] Invalid runtime config detected.",`context: ${e}`,"issues:"].concat(t.map(n=>`- ${n}`)).join(`
61
+ `))},Tu=(e,t,n)=>{const r=[];for(const i of Object.keys(e))t.has(i)||r.push(`${n}${i}: unknown key`);return r},OF=(e,t)=>{const n=[];if("concurrencyLimit"in e&&e.concurrencyLimit!=null&&(hA(Zxe)(e.concurrencyLimit)||n.push(`${t}concurrencyLimit: expected positive int | "unbounded"`)),"losslessBackpressureCapacity"in e&&e.losslessBackpressureCapacity!=null&&Lg(e.losslessBackpressureCapacity)==null&&n.push(`${t}losslessBackpressureCapacity: expected positive int`),"allowUnbounded"in e&&e.allowUnbounded!=null&&$g(e.allowUnbounded)==null&&n.push(`${t}allowUnbounded: expected boolean`),"pressureWarningThreshold"in e&&e.pressureWarningThreshold!=null){const r=e.pressureWarningThreshold;if(!Ts(r))n.push(`${t}pressureWarningThreshold: expected object`);else{const i=r.backlogCount;i!=null&&Lg(i)==null&&n.push(`${t}pressureWarningThreshold.backlogCount: expected positive int`);const o=r.backlogDurationMs;o!=null&&rl(o)==null&&n.push(`${t}pressureWarningThreshold.backlogDurationMs: expected positive number`)}}return"warningCooldownMs"in e&&e.warningCooldownMs!=null&&rl(e.warningCooldownMs)==null&&n.push(`${t}warningCooldownMs: expected positive number`),n},ewe=(e,t)=>{if(!Sn()||e==null)return;if(!Ts(e)){q0(t,["expected object"]);return}const n=e,r=[];r.push(...Tu(n,new Set(["concurrencyLimit","losslessBackpressureCapacity","allowUnbounded","pressureWarningThreshold","warningCooldownMs","overridesByModuleId"]),"")),r.push(...OF(n,""));const i=n.overridesByModuleId;if(i!=null)if(!Ts(i))r.push("overridesByModuleId: expected record");else for(const[o,a]of Object.entries(i)){const c=`overridesByModuleId.${o}.`;if(a!=null){if(!Ts(a)){r.push(`${c}<value>: expected object`);continue}r.push(...Tu(a,new Set(["concurrencyLimit","losslessBackpressureCapacity","allowUnbounded","pressureWarningThreshold","warningCooldownMs"]),c)),r.push(...OF(a,c))}}q0(t,r)},DF=(e,t)=>{const n=[];if("traitConvergeMode"in e&&e.traitConvergeMode!=null&&(hA(Xxe)(e.traitConvergeMode)||n.push(`${t}traitConvergeMode: expected "auto" | "full" | "dirty"`)),"traitConvergeBudgetMs"in e&&e.traitConvergeBudgetMs!=null&&rl(e.traitConvergeBudgetMs)==null&&n.push(`${t}traitConvergeBudgetMs: expected positive number`),"traitConvergeDecisionBudgetMs"in e&&e.traitConvergeDecisionBudgetMs!=null&&rl(e.traitConvergeDecisionBudgetMs)==null&&n.push(`${t}traitConvergeDecisionBudgetMs: expected positive number`),"traitConvergeTimeSlicing"in e&&e.traitConvergeTimeSlicing!=null){const r=e.traitConvergeTimeSlicing;if(!Ts(r))n.push(`${t}traitConvergeTimeSlicing: expected object`);else{const i=`${t}traitConvergeTimeSlicing.`;n.push(...Tu(r,new Set(["enabled","debounceMs","maxLagMs"]),i)),"enabled"in r&&r.enabled!=null&&typeof r.enabled!="boolean"&&n.push(`${i}enabled: expected boolean`),"debounceMs"in r&&r.debounceMs!=null&&rl(r.debounceMs)==null&&n.push(`${i}debounceMs: expected positive number`),"maxLagMs"in r&&r.maxLagMs!=null&&rl(r.maxLagMs)==null&&n.push(`${i}maxLagMs: expected positive number`)}}return n},PF=(e,t)=>{const n=[];if("enabled"in e&&e.enabled!=null&&$g(e.enabled)==null&&n.push(`${t}enabled: expected boolean`),"overrideMode"in e&&e.overrideMode!=null){const r=e.overrideMode;(typeof r!="string"||r!=="forced_off"&&r!=="forced_sync")&&n.push(`${t}overrideMode: expected "forced_off" | "forced_sync"`)}if("budgetMs"in e&&e.budgetMs!=null&&MS(e.budgetMs)==null&&n.push(`${t}budgetMs: expected non-negative number`),"debounceMs"in e&&e.debounceMs!=null&&MS(e.debounceMs)==null&&n.push(`${t}debounceMs: expected non-negative number`),"maxLagMs"in e&&e.maxLagMs!=null&&MS(e.maxLagMs)==null&&n.push(`${t}maxLagMs: expected non-negative number`),"allowCoalesce"in e&&e.allowCoalesce!=null&&$g(e.allowCoalesce)==null&&n.push(`${t}allowCoalesce: expected boolean`),"yieldStrategy"in e&&e.yieldStrategy!=null){const r=e.yieldStrategy;(typeof r!="string"||r!=="baseline"&&r!=="inputPending")&&n.push(`${t}yieldStrategy: expected "baseline" | "inputPending"`)}return n},twe=(e,t)=>{if(!Sn()||e==null)return;if(!Ts(e)){q0(t,["expected object"]);return}const n=[];n.push(...Tu(e,new Set(["instrumentation","traitConvergeBudgetMs","traitConvergeDecisionBudgetMs","traitConvergeMode","traitConvergeTimeSlicing","traitConvergeOverridesByModuleId","txnLanes","txnLanesOverridesByModuleId"]),"")),"instrumentation"in e&&e.instrumentation!=null&&(hA(Jxe)(e.instrumentation)||n.push('instrumentation: expected "full" | "light"')),n.push(...DF(e,""));const r=e.txnLanes;if(r!=null)if(!Ts(r))n.push("txnLanes: expected object");else{const a="txnLanes.";n.push(...Tu(r,new Set(["enabled","overrideMode","budgetMs","debounceMs","maxLagMs","allowCoalesce","yieldStrategy"]),a)),n.push(...PF(r,a))}const i=e.traitConvergeOverridesByModuleId;if(i!=null)if(!Ts(i))n.push("traitConvergeOverridesByModuleId: expected record");else for(const[a,c]of Object.entries(i)){const u=`traitConvergeOverridesByModuleId.${a}.`;if(c!=null){if(!Ts(c)){n.push(`${u}<value>: expected object`);continue}n.push(...Tu(c,new Set(["traitConvergeMode","traitConvergeBudgetMs","traitConvergeDecisionBudgetMs","traitConvergeTimeSlicing"]),u)),n.push(...DF(c,u))}}const o=e.txnLanesOverridesByModuleId;if(o!=null)if(!Ts(o))n.push("txnLanesOverridesByModuleId: expected record");else for(const[a,c]of Object.entries(o)){const u=`txnLanesOverridesByModuleId.${a}.`;if(c!=null){if(!Ts(c)){n.push(`${u}<value>: expected object`);continue}n.push(...Tu(c,new Set(["enabled","overrideMode","budgetMs","debounceMs","maxLagMs","allowCoalesce","yieldStrategy"]),u)),n.push(...PF(c,u))}}q0(t,n)},nwe=e=>e?._tag==="ModuleImpl"?e:e?.impl,rwe=(e,t)=>{const n=nwe(e);ewe(t?.concurrencyPolicy,"Runtime.make options.concurrencyPolicy"),twe(t?.stateTransaction,"Runtime.make options.stateTransaction");const r=t?.debug===!0?vj():t?.debug?vj(t.debug):fc,i=t?.layer??fc,o=t?.debug?ol(i,r):i;let a=t?.middleware??[];const c=t?.devtools===!0?{}:t?.devtools;if(t?.devtools){const S=c?.observer===!1?!1:c?.observer;a=Kxe(a,{observer:S})}const u=a.length>0?ca(Vy,{stack:a}):fc,d=t?.label!=null?ol(Pbe(t.label),o):o,h=t?.devtools?Dbe(d,{bufferSize:c?.bufferSize,diagnosticsLevel:c?.diagnosticsLevel,traitConvergeDiagnosticsSampling:c?.traitConvergeDiagnosticsSampling}):d,p=ol(Tve(),Yxe(),h,u),y=(()=>{const S=t?.readQuery?.strictGate;if(!S)return;const x=S.mode??"off";if(x!=="off")return{mode:x,requireStatic:S.requireStatic,denyFallbackReasons:S.denyFallbackReasons}})(),g={layer:p,modules:[Uxe(n.module,n.layer)],processes:n.processes??[],onError:t?.onError,stateTransaction:t?.stateTransaction,concurrencyPolicy:t?.concurrencyPolicy,readQueryStrictGate:y};return Bxe(g).makeRuntime()},J6=UC;class iwe{lifecycle={onSuspend:t=>he,onResume:t=>he,onReset:t=>he};emitSuspend=()=>he;emitResume=()=>he;emitReset=()=>he}ca(J6,new iwe);const owe=()=>typeof window<"u"&&typeof document<"u"?"browser":typeof process<"u"&&typeof process?.versions?.node=="string"?"node":"unknown",swe=e=>({kind:e,isNode:e==="node",isBrowser:e==="browser"});class awe extends tn("@logixjs/RuntimeHost")(){}const lwe=e=>ca(awe,e);lwe(swe(owe()));const cwe=e=>kA(e).imports,Rh=A.createContext(null);class Lm extends tn("@logixjs/react/RuntimeConfig")(){}const eo={gcTime:500,initTimeoutMs:void 0,lowPriorityDelayMs:16,lowPriorityMaxDelayMs:50},$m={gcTime:eo.gcTime,initTimeoutMs:eo.initTimeoutMs,lowPriorityDelayMs:eo.lowPriorityDelayMs,lowPriorityMaxDelayMs:eo.lowPriorityMaxDelayMs,source:"default"},ac={gcTime:_v("logix.react.gc_time").pipe($1(eo.gcTime)),initTimeoutMs:dge(_v("logix.react.init_timeout_ms")),lowPriorityDelayMs:_v("logix.react.low_priority_delay_ms").pipe($1(eo.lowPriorityDelayMs)),lowPriorityMaxDelayMs:_v("logix.react.low_priority_max_delay_ms").pipe($1(eo.lowPriorityMaxDelayMs))};ae(function*(){const e=yield*ft(Lm);return Pe(e)?e.value.gcTime:yield*ac.gcTime}),ae(function*(){const e=yield*ft(Lm);if(Pe(e)){const n=e.value.initTimeoutMs;return n===void 0?Ae():Oe(n)}return yield*ac.initTimeoutMs}),ae(function*(){const e=yield*ft(Lm);return Pe(e)?e.value.lowPriorityDelayMs??eo.lowPriorityDelayMs??16:yield*ac.lowPriorityDelayMs}),ae(function*(){const e=yield*ft(Lm);return Pe(e)?e.value.lowPriorityMaxDelayMs??eo.lowPriorityMaxDelayMs??50:yield*ac.lowPriorityMaxDelayMs});const NF={load:ae(function*(){const e=yield*ft(Lm);if(Pe(e))return{gcTime:e.value.gcTime,initTimeoutMs:e.value.initTimeoutMs,lowPriorityDelayMs:e.value.lowPriorityDelayMs??eo.lowPriorityDelayMs??16,lowPriorityMaxDelayMs:e.value.lowPriorityMaxDelayMs??eo.lowPriorityMaxDelayMs??50,source:"runtime"};const t=yield*ac.gcTime,n=yield*ac.initTimeoutMs,r=Pi(n),i=yield*ac.lowPriorityDelayMs,o=yield*ac.lowPriorityMaxDelayMs;return t!==eo.gcTime||Pe(n)||i!==eo.lowPriorityDelayMs||o!==eo.lowPriorityMaxDelayMs?{gcTime:t,initTimeoutMs:r,lowPriorityDelayMs:i,lowPriorityMaxDelayMs:o,source:"config"}:$m})};var uwe={};const Z6="LOGIX_DOCS_PREFIX",VC=e=>e.replace(/\/+$/,""),e9=e=>e.startsWith("/")?e:`/${e}`,dwe=e=>{try{const n=uwe?.[e];return typeof n=="string"?n:void 0}catch{return}},LF=()=>{try{const e=globalThis?.location?.origin;return typeof e=="string"&&e.length>0?e:void 0}catch{return}},fwe=()=>{const e=dwe(Z6),t=e?VC(e.trim()):void 0;if(t&&t.length>0){if(/^https?:\/\//i.test(t))return t;const r=LF();return r?VC(`${r}${e9(t)}`):t}const n=LF();return n?`${n}/zh/docs`:void 0},hwe=e=>{const t=fwe(),n=e9(e);return t?`${VC(t)}${n}`:n},pwe=()=>hwe("/guide/essentials/react-integration"),mwe=()=>Z6,$F=new WeakMap,gwe=100,ywe=16,bwe=({phase:e,policyMode:t})=>{const[n,r]=A.useState(0);A.useEffect(()=>{const o=performance.now(),a=setInterval(()=>{r(Math.round(performance.now()-o))},100);return()=>{clearInterval(a)}},[]);const i=e==="provider.gating"?"Logix 运行时准备中…":"Logix 模块解析中…";return N.jsxs("div",{style:{padding:12,fontSize:13,lineHeight:1.4,opacity:.85,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:[N.jsxs("div",{children:[i," ",n,"ms"]}),N.jsxs("div",{style:{marginTop:6,opacity:.8},children:["policy.mode=",t,"(想“无等待”→ sync;想“少闪烁”→ defer+preload)"]})]})},vwe=e=>e.fallback!==void 0?e.fallback:yr()?N.jsx(bwe,{phase:e.phase,policyMode:e.policyMode}):null,Swe=e=>{!yr()&&!cd()||e.runtime.runPromise(wi({type:"trace:react.fallback.duration",data:{phase:e.phase,policyMode:e.policyMode,durationMs:Math.round(e.durationMs*100)/100,blockers:e.blockers}})).catch(()=>{})},xwe=e=>{if(!yr())return;const t=gwe,n=e.durationMs>=t,r=e.phase==="react.suspense"&&e.policyMode!=="sync"&&e.durationMs>=ywe&&e.durationMs<t;if(!n&&!r)return;const i=e.runtime,o=$F.get(i)??new Set;$F.set(i,o);const c=`${n?"visible":"flash"}::${e.phase}::${e.policyMode}::${e.blockers??"none"}`;if(o.has(c))return;o.add(c);const u=`Docs: ${pwe()} (override via ${mwe()})`,d=n?"[Logix][React] Fallback visible":"[Logix][React] Suspense fallback resolved quickly",h=n?e.phase==="provider.gating"?e.policyMode==="sync"?'Hint: You are using policy.mode="sync", but the provider is still waiting for dependencies (layer/config). Consider using "suspend"/"defer" (default UX), and/or make your layer/config ready earlier.':"Hint: RuntimeProvider is still waiting for dependencies (layer/config/preload). Provide a fallback, use defer+preload, or switch to sync (deterministic, but render-blocking).":'Hint: Suspense fallback is active (module resolve). If you prefer fewer fallbacks, use defer+preload; if you prefer “no waiting”, switch to policy.mode="sync" (moves the cost to render-time sync blocking).':'Hint: This fallback is short. If you want to eliminate the flicker, consider policy.mode="sync" (but it may introduce render-time sync blocking).',p=r?'Example: <RuntimeProvider policy={{ mode: "sync" }} fallback={<Loading />}>…</RuntimeProvider>':e.phase==="provider.gating"?'Example: <RuntimeProvider policy={{ mode: "defer", preload: [MyImpl] }} fallback={<Loading />}>…</RuntimeProvider>':'Example: <RuntimeProvider policy={{ mode: "sync" }} fallback={<Loading />}>…</RuntimeProvider>';(n?console.warn:console.info)(d,`(${Math.round(e.durationMs)}ms)`,`
62
+ `,`phase=${e.phase}`,`
63
+ `,`policy.mode=${e.policyMode}`,e.blockers?`
64
+ blockers=${e.blockers}`:"",`
65
+ `,h,`
66
+ `,p,`
67
+ `,u)},wwe=({runtime:e,phase:t,policyMode:n,blockers:r,children:i})=>(A.useEffect(()=>{const o=performance.now();return()=>{const a=performance.now()-o;Swe({runtime:e,phase:t,policyMode:n,durationMs:a,blockers:r}),xwe({runtime:e,phase:t,policyMode:n,durationMs:a,blockers:r})}},[e,t,n,r]),N.jsx(N.Fragment,{children:i})),kwe=({children:e})=>N.jsx(N.Fragment,{children:e}),jF=e=>{const n=yr()||cd()?wwe:kwe;return N.jsx(n,{...e})},_we=e=>e instanceof Error?e.stack??e.message:String(e),fu=e=>{yr()&&console.debug("[RuntimeProvider] Scope.close failed",_we(e))},t9=(e,t,n,r)=>{const i=A.useRef(null),[o,a]=A.useState(()=>({binding:null,isLoading:n&&!!t,runtime:e,layer:t,enabled:n}));A.useEffect(()=>{if(!n||!t){const S=i.current;S&&(i.current=null,e.runPromise(di(S.scope,ks)).catch(fu)),a(x=>x.binding===null&&x.isLoading===!1&&x.layer===void 0&&x.enabled===n?x:{binding:null,isLoading:!1,runtime:x.runtime,layer:void 0,enabled:n});return}const u=i.current;if(u&&u.runtime===e&&u.layer===t&&u.enabled===n){a({binding:u,isLoading:!1,runtime:e,layer:t,enabled:n});return}const d=u??o.binding;yr()&&d&&d.layer!==t&&n&&t&&console.warn("[RuntimeProvider] Rebuilding layer due to a new layer reference. Memoize the Layer in the caller to avoid repeated rebuilds and resource churn."),u&&(i.current=null,e.runPromise(di(u.scope,ks)).catch(fu));let h=!1;a({binding:null,isLoading:!0,runtime:e,layer:t,enabled:n});const p=k0(Wm()),y=ae(function*(){const S=yield*gw(t,p),x=M=>cH(Jh(M,p),D=>Oc(D,S)),k=yield*x(ut(fH)),_=yield*x(ut(hH)),E=yield*x(ut(Hy.currentDebugSinks));return{context:S,loggers:k,logLevel:_,debugSinks:E}}),g=S=>{if(h)return e.runPromise(di(p,ks)).catch(fu);const x=i.current,k={context:S.context,loggers:S.loggers,logLevel:S.logLevel,debugSinks:S.debugSinks,scope:p,runtime:e,layer:t,enabled:n};return i.current=k,a({binding:k,isLoading:!1,runtime:e,layer:t,enabled:n}),x?e.runPromise(di(x.scope,ks)).catch(fu):Promise.resolve()};let v=!1;try{const S=e.runSync(y);v=!0,g(S)}catch{}return v||e.runPromise(y).then(g).catch(S=>{if(r){const x=Tg(S);e.runFork(r(x,{source:"provider",phase:"provider.layer.build"}).pipe(zt(()=>he)))}e.runPromise(di(p,ks)).catch(fu),h||(console.error("[RuntimeProvider] Failed to build layer",S),a({binding:null,isLoading:!1,runtime:e,layer:t,enabled:n}))}),()=>{h=!0;const S=i.current;if(S){i.current=null,e.runPromise(di(S.scope,ks)).catch(fu);return}e.runPromise(di(p,ks)).catch(fu)}},[e,t,n,r]);const c=o.binding!==null&&o.runtime===e&&o.layer===t&&o.enabled===n&&n&&!!t;return{binding:c?o.binding:null,isLoading:c?o.isLoading:n&&!!t}},n9=(e,t,n,r,i,o)=>{if(t.length===0&&n.length===0&&r.length===0&&i.length===0&&o.length===0)return e;const a=d=>t.reduceRight((h,p)=>cH(h,y=>Oc(y,p)),n.reduceRight((h,p)=>Jh(h,p),d)),c=d=>{const h=r.length>0?r[r.length-1]:null,p=i.length>0?i[i.length-1]:null,y=o.length>0?o[o.length-1]:null;let g=d;return h&&(g=lr(fH,h)(g)),p&&(g=lr(hH,p)(g)),y&&y.length>0&&(g=lr(Hy.currentDebugSinks,y)(g)),g};return{...e,runFork:(d,h)=>e.runFork(c(a(d)),h),runPromise:(d,h)=>e.runPromise(c(a(d)),h),runPromiseExit:(d,h)=>e.runPromiseExit(c(a(d)),h),runSync:d=>e.runSync(c(a(d))),runSyncExit:d=>e.runSyncExit(c(a(d))),runCallback:(d,h)=>e.runCallback(c(a(d)),h)}};yi({value:ar});const Ewe=yi({id:Ut,warehouseId:Ut});yi({items:CS(Ewe),digest:Ut,errors:Qge});const FF="__LOGIX_REACT_YIELD_BUDGET_MEMORY__",Twe=()=>{const e=globalThis,t=e[FF];if(t&&t.byRuntime instanceof WeakMap)return t;const n={byRuntime:new WeakMap};return e[FF]=n,n},zF=e=>{const t=Twe(),n=t.byRuntime.get(e);if(n)return n;const r=new Map;return t.byRuntime.set(e,r),r},Cwe=(e,t)=>{if(e.length===0)return Number.NaN;const n=Math.min(1,Math.max(0,t)),r=Math.floor(n*(e.length-1));return e[r]},Iwe=e=>{if(e.length===0)return Number.NaN;const t=e.slice().sort((n,r)=>n-r);return Cwe(t,.95)},jm={shouldYield(e){const t=e.policy?.onlyWhenOverBudgetMs;if(t===void 0)return{shouldYield:!0,reason:"budgetDisabled",p95Ms:void 0};const n=zF(e.runtime),r=n.get(e.workloadKey)??{seen:!1,samplesMs:[]};if(n.has(e.workloadKey)||n.set(e.workloadKey,r),!r.seen)return r.seen=!0,{shouldYield:!0,reason:"firstRun",p95Ms:void 0};if(r.samplesMs.length===0)return{shouldYield:!0,reason:"insufficientSamples",p95Ms:void 0};const i=Iwe(r.samplesMs);return Number.isFinite(i)?i>t?{shouldYield:!0,reason:"overBudget",p95Ms:i}:{shouldYield:!1,reason:"underBudget",p95Ms:i}:{shouldYield:!0,reason:"insufficientSamples",p95Ms:void 0}},record(e){if(!Number.isFinite(e.durationMs)||e.durationMs<0)return;const t=zF(e.runtime),n=t.get(e.workloadKey)??{seen:!0,samplesMs:[]};t.has(e.workloadKey)||t.set(e.workloadKey,n),n.samplesMs.push(e.durationMs),n.samplesMs.length>20&&n.samplesMs.shift()}},BF=new WeakMap,Mwe=500,aE=500,Rwe=5,Awe=e=>e instanceof Error?e.stack??e.message:String(e),UF=new Set,ys=(e,t)=>{if(!yr())return;const n=Awe(t);if(n.includes("ManagedRuntime disposed"))return;const r=`${e}
68
+ ${n}`;UF.has(r)||(UF.add(r),console.debug(e,n))},qF=e=>{const t=Pi(_5(e));if(t!==void 0)return t;const n=Pi(T5(e));return n!==void 0?n:e},VF=e=>{switch(e){case"none":return he;case"microtask":return wc();case"macrotask":return gfe(()=>new Promise(t=>{setTimeout(t,0)}))}},HF=(e,t,n)=>{const r=n?.strategy??"microtask";if(r==="none")return{strategy:"none",reason:"disabled"};if(n?.onlyWhenOverBudgetMs===void 0)return{strategy:r};const o=jm.shouldYield({runtime:e,workloadKey:t,policy:n});return o.shouldYield?{strategy:r,reason:o.reason,p95Ms:o.p95Ms}:{strategy:"none",reason:o.reason,p95Ms:o.p95Ms}},KF=new Set;class Owe{constructor(t,n=Mwe){this.runtime=t,this.gcDelayMs=n}entries=new Map;scheduleGC(t,n){if(n.gcTimeout)return;const r=n.gcTime;if(!Number.isFinite(r))return;const i=r<=0?0:r;n.gcTimeout=setTimeout(()=>{const o=this.entries.get(t);if(!(!o||o!==n)&&(o.gcTimeout=void 0,!(o.refCount>0||o.preloadRefCount>0))){if(o.status==="pending"){this.scheduleGC(t,o);return}this.runtime.runPromise(di(o.scope,ks)).catch(a=>{ys("[ModuleCache] Scope.close failed",a)}),this.runtime.runPromise(wi({type:"trace:react.module-instance",moduleId:o.ownerId,instanceId:o.value?.instanceId,data:{event:"gc",key:t}})).catch(a=>{ys("[ModuleCache] Debug.record failed",a)}),this.entries.delete(t)}},i)}read(t,n,r,i,o){const a=this.entries.get(t);if(a){if(yr()&&a.ownerId!==void 0&&i!==void 0&&a.ownerId!==i)throw console.error("[ModuleCache.read] resource key ownership mismatch:",`key="${t}" previously owned by "${a.ownerId}",`,`but now requested by "${i}".`),new Error(`[ModuleCache.read] resource key "${t}" has already been claimed by module "${a.ownerId}", but is now requested by module "${i}". Within the same ManagedRuntime, a given key must not be shared across different ModuleImpl definitions. Please ensure each ModuleImpl uses a distinct key when sharing ModuleRuntime instances.`);if(a.status==="pending")throw a.promise;if(a.status==="error")throw a.error;return a.value}const c=k0(Wm()),u=`${o?.entrypoint??"unknown"}::${i??"unknown"}`,d=HF(this.runtime,u,o?.yield),h={scope:c,status:"pending",promise:Promise.resolve(null),refCount:0,preloadRefCount:0,gcTime:r??this.gcDelayMs,ownerId:i,createdBy:"read",workloadKey:u,yieldStrategy:d.strategy};this.scheduleGC(t,h);const p=performance.now(),y=VF(d.strategy).pipe(rt(n(c))),g=this.runtime.runFork(y);h.fiber=g;const v=this.runtime.runPromise(vc(g)).then(S=>{if(bg(S))return S.value;throw qF(S.cause)});throw v.then(S=>{h.status="success",h.value=S;const x=performance.now()-p;return jm.record({runtime:this.runtime,workloadKey:u,durationMs:x}),(yr()||cd())&&(this.runtime.runPromise(wi({type:"trace:react.module.init",moduleId:i,instanceId:S.instanceId,data:{mode:"suspend",key:t,durationMs:Math.round(x*100)/100,yieldStrategy:d.strategy,yieldReason:d.reason,yieldP95Ms:d.p95Ms}})).catch(k=>{ys("[ModuleCache] Debug.record failed",k)}),this.runtime.runPromise(wi({type:"trace:react.module-instance",moduleId:i,instanceId:S.instanceId,data:{event:"attach",key:t,mode:"suspend",gcTime:h.gcTime}})).catch(k=>{ys("[ModuleCache] Debug.record failed",k)})),S}).catch(S=>{throw h.status="error",h.error=S,h.gcTime=aE,h.gcTimeout&&(clearTimeout(h.gcTimeout),h.gcTimeout=void 0),this.scheduleGC(t,h),jm.record({runtime:this.runtime,workloadKey:u,durationMs:performance.now()-p}),this.runtime.runPromise(di(c,Vm(S))).catch(x=>{ys("[ModuleCache] Scope.close failed",x)}),S}),this.entries.set(t,h),h.promise=v,v}readSync(t,n,r,i,o){const a=this.entries.get(t);if(a){if(yr()&&a.ownerId!==void 0&&i!==void 0&&a.ownerId!==i)throw console.error("[ModuleCache.readSync] resource key ownership mismatch:",`key="${t}" previously owned by "${a.ownerId}",`,`but now requested by "${i}".`),new Error(`[ModuleCache.readSync] resource key "${t}" has already been claimed by module "${a.ownerId}", but is now requested by module "${i}". Within the same ManagedRuntime, a given key must not be shared across different ModuleImpl definitions. Please ensure each ModuleImpl uses a distinct key when sharing ModuleRuntime instances.`);if(a.status==="error")throw a.error;if(a.status==="pending")throw new Error(`[ModuleCache.readSync] encountered pending entry for key="${t}". This usually indicates that the same resource key is being used by both suspend:true (async) and sync consumers. Please either give different keys to async/sync callers, or stick to a single access mode for this resource.`);return a.value}const c=this.runtime.runSync(Wm()),u=performance.now();try{const d=this.runtime.runSync(n(c)),h=performance.now()-u,p={scope:c,status:"success",promise:Promise.resolve(d),value:d,refCount:0,preloadRefCount:0,gcTime:r??this.gcDelayMs,ownerId:i,createdBy:"read",workloadKey:`${o?.entrypoint??"unknown"}::${i??"unknown"}`,yieldStrategy:"none"};if(this.scheduleGC(t,p),this.entries.set(t,p),yr()){const y=o?.warnSyncBlockingThresholdMs??Rwe;if(y>0&&h>y){const g=`${o?.entrypoint??"unknown"}::${i??"unknown"}::${t}`;if(!KF.has(g)){KF.add(g);const v=o?.policyMode==="defer"?'Fix: 当前 policy.mode="defer":请检查该模块是否在 policy.preload 列表中;未预加载的模块仍可能触发二次 fallback 或同步重活。':'Fix: 建议切换到 policy.mode="suspend"(默认),并提供 RuntimeProvider.fallback;必要时启用 yield 策略。',S=o?.policyMode==="defer"?'Example: <RuntimeProvider policy={{ mode: "defer", preload: [MyImpl] }} fallback={<Loading />}>…</RuntimeProvider>':'Example: <RuntimeProvider policy={{ mode: "suspend" }} fallback={<Loading />}>…</RuntimeProvider>';console.warn("[Logix][React] Render-phase sync blocking detected",`(${Math.round(h*100)/100}ms > ${y}ms)`,`
69
+ `,`entrypoint=${o?.entrypoint??"unknown"}`,`
70
+ `,`ownerId=${i??"unknown"}`,`
71
+ `,`key=${t}`,`
72
+ `,v,`
73
+ `,S,`
74
+ `,"Docs: apps/docs/content/docs/guide/essentials/react-integration.md")}}}return(yr()||cd())&&(this.runtime.runPromise(wi({type:"trace:react.module.init",moduleId:i,instanceId:d.instanceId,data:{mode:"sync",key:t,durationMs:Math.round(h*100)/100,yieldStrategy:"none"}})).catch(y=>{ys("[ModuleCache] Debug.record failed",y)}),this.runtime.runPromise(wi({type:"trace:react.module-instance",moduleId:i,instanceId:d.instanceId,data:{event:"attach",key:t,mode:"sync",gcTime:p.gcTime}})).catch(y=>{ys("[ModuleCache] Debug.record failed",y)})),d}catch(d){this.runtime.runPromise(di(c,Vm(d))).catch(p=>{ys("[ModuleCache] Scope.close failed",p)});const h={scope:c,status:"error",promise:Promise.reject(d),error:d,refCount:0,preloadRefCount:0,gcTime:aE,ownerId:i,createdBy:"read",workloadKey:`${o?.entrypoint??"unknown"}::${i??"unknown"}`,yieldStrategy:"none"};throw this.scheduleGC(t,h),this.entries.set(t,h),d}}preload(t,n,r){const i=this.entries.get(t);if(i)return i.status==="success"?(i.preloadRefCount+=1,{promise:Promise.resolve(i.value),cancel:()=>{this.cancelPreload(t,i)}}):i.status==="error"?{promise:Promise.reject(i.error),cancel:()=>{}}:(i.preloadRefCount+=1,{promise:i.promise,cancel:()=>{this.cancelPreload(t,i)}});const o=k0(Wm()),a=r?.ownerId,c=r?.gcTime??this.gcDelayMs,u=`${r?.entrypoint??"unknown"}::${a??"unknown"}`,d=HF(this.runtime,u,r?.yield),h={scope:o,status:"pending",promise:Promise.resolve(null),refCount:0,preloadRefCount:1,gcTime:c,ownerId:a,createdBy:"preload",workloadKey:u,yieldStrategy:d.strategy};this.scheduleGC(t,h),this.entries.set(t,h);const p=performance.now(),y=VF(d.strategy).pipe(rt(n(o))),g=this.runtime.runFork(y);h.fiber=g;const v=this.runtime.runPromise(vc(g)).then(S=>{if(bg(S))return S.value;throw qF(S.cause)});return h.promise=v,v.then(S=>{h.status="success",h.value=S,jm.record({runtime:this.runtime,workloadKey:u,durationMs:performance.now()-p})}).catch(S=>{h.status="error",h.error=S,h.gcTime=aE,h.gcTimeout&&(clearTimeout(h.gcTimeout),h.gcTimeout=void 0),this.scheduleGC(t,h),jm.record({runtime:this.runtime,workloadKey:u,durationMs:performance.now()-p}),this.runtime.runPromise(di(o,Vm(S))).catch(x=>{ys("[ModuleCache] Scope.close failed",x)})}),{promise:v,cancel:()=>{this.cancelPreload(t,h)}}}cancelPreload(t,n){const r=this.entries.get(t);if(!(!r||r!==n)&&(n.preloadRefCount=Math.max(0,n.preloadRefCount-1),!(n.preloadRefCount>0)&&!(n.refCount>0))){if(n.status==="pending"){if(n.createdBy!=="preload"){this.scheduleGC(t,n);return}const i=n.fiber;n.fiber=void 0,this.entries.delete(t),i&&this.runtime.runFork(fi(i)),this.runtime.runPromise(di(n.scope,ks)).catch(o=>{ys("[ModuleCache] Scope.close failed",o)});return}n.gcTimeout&&(clearTimeout(n.gcTimeout),n.gcTimeout=void 0),this.scheduleGC(t,n)}}retain(t){const n=this.entries.get(t);return n?(n.refCount+=1,n.gcTimeout&&(clearTimeout(n.gcTimeout),n.gcTimeout=void 0),()=>{this.release(t)}):()=>{}}release(t){const n=this.entries.get(t);n&&(n.refCount-=1,!(n.refCount>0)&&this.scheduleGC(t,n))}dispose(){for(const[t,n]of this.entries)n.gcTimeout&&clearTimeout(n.gcTimeout),this.runtime.runPromise(di(n.scope,ks)).catch(r=>{ys("[ModuleCache] Scope.close failed",r)}),this.entries.delete(t)}}const FA=(e,t,n)=>{const r=BF.get(e);if(r&&r.version===n)return r.cache;r&&r.cache.dispose();const i=new Owe(e,t.gcTime);return BF.set(e,{version:n,cache:i}),i},Dwe=e=>{if(e===null)return"null";const t=typeof e;return t==="string"?`s:${e}`:t==="number"?`n:${e}`:t==="boolean"?`b:${e}`:`${t}:${Object.prototype.toString.call(e)}`},Pwe=e=>(yr()&&e.some(n=>{if(n===null)return!1;const r=typeof n;return r==="object"||r==="function"})&&console.warn("[ModuleCache] deps contains non-primitive values. stableHash() only distinguishes primitives (string/number/boolean/null/undefined); object/function entries may not trigger expected cache updates. Consider passing explicit primitive deps or controlling invalidation via `key`."),e.map(Dwe).join("|")),r9=5,Nwe=5,Lwe="microtask",i9=e=>!!e&&typeof e=="object"&&e._tag==="ModuleImpl",o9=e=>!e||typeof e!="object"&&typeof e!="function"?!1:e._kind==="ModuleTag",s9=e=>`preload:impl:${e}`,a9=e=>`preload:tag:${e}`,l9=e=>({strategy:e?.strategy??Lwe,onlyWhenOverBudgetMs:e?.onlyWhenOverBudgetMs}),$we=e=>{if(!e)return null;const t=Array.isArray(e)?{handles:e}:e,n=[];for(const r of t.handles??[])(i9(r)||o9(r))&&n.push(r);return{handles:n,concurrency:Math.max(1,t.concurrency??r9),yield:l9(t.yield)}},jwe=e=>{const t=e.parentPolicy?.mode,n=e.policy?.mode??(t!==void 0?t:"suspend"),r=n==="sync"?"sync":"suspend",i=n==="defer"?$we(e.policy?.preload):null,o=new Map,a=new Map;if(i){for(const c of i.handles)if(i9(c)){const u=c.module.id??"ModuleImpl";o.set(u,s9(u))}else if(o9(c)){const u=c.id??"ModuleTag";a.set(u,a9(u))}}return{mode:n,moduleImplMode:r,moduleTagMode:r,syncBudgetMs:Math.max(0,e.policy?.syncBudgetMs??e.parentPolicy?.syncBudgetMs??Nwe),yield:l9(e.policy?.yield??e.parentPolicy?.yield),preload:i?{...i,keysByModuleId:o,keysByTagId:a}:null}},WF=new WeakMap,Fwe=({layer:e,runtime:t,children:n,fallback:r,policy:i,onError:o})=>{const a=A.useContext(Rh),c=zwe(t,a),u=A.useMemo(()=>jwe({policy:i,parentPolicy:a?.policy??null}),[i,a?.policy]),d=bn.useRef(o);d.current=o;const{binding:h}=t9(c,e,!!e,d.current),p=A.useMemo(()=>o?{record:L=>{const P=d.current;return P?L.type==="lifecycle:error"?P(L.cause,{source:"provider",phase:"debug.lifecycle_error",moduleId:L.moduleId,instanceId:L.instanceId,runtimeLabel:L.runtimeLabel}).pipe(zt(()=>he)):L.type==="diagnostic"&&L.severity==="error"?P(pw({code:L.code,message:L.message,hint:L.hint}),{source:"provider",phase:"debug.diagnostic_error",code:L.code,message:L.message,hint:L.hint,moduleId:L.moduleId,instanceId:L.instanceId,runtimeLabel:L.runtimeLabel}).pipe(zt(()=>he)):he:he}}:null,[!!o]),y=A.useMemo(()=>{if(!p)return[];if(h)return h.debugSinks;try{return c.runSync(ut(Hy.currentDebugSinks))}catch{return[]}},[c,h,p]),g=A.useMemo(()=>h||p?n9(c,h?[h.context]:[],h?[h.scope]:[],h?[h.loggers]:[],h?[h.logLevel]:[],[p?[p,...y]:h?h.debugSinks:[]]):c,[c,y,h,p]),v=bn.useRef(!1),[S,x]=A.useState(()=>{const I=u.syncBudgetMs;if(I<=0)return{snapshot:$m,version:1,loaded:!1,loadMode:"none"};if(WF.has(c))return{snapshot:$m,version:1,loaded:!1,loadMode:"none"};const L=performance.now();try{const P=g.runSync(NF.load),B=performance.now()-L,$=B>I;return $&&WF.set(c,!0),{snapshot:P,version:1,loaded:!$,loadMode:"sync",syncDurationMs:B,syncOverBudget:$}}catch{return{snapshot:$m,version:1,loaded:!1,loadMode:"none"}}});A.useEffect(()=>{S.loadMode==="sync"&&(v.current||(v.current=!0,g.runPromise(wi({type:"trace:react.runtime.config.snapshot",data:{source:S.snapshot.source,mode:"sync",durationMs:S.syncDurationMs!==void 0?Math.round(S.syncDurationMs*100)/100:void 0,syncBudgetMs:u.syncBudgetMs,overBudget:!!S.syncOverBudget}})).catch(()=>{})))},[S,u.syncBudgetMs,g]),A.useEffect(()=>{let I=!1;return g.runPromise(NF.load).then(L=>{I||(x(P=>{if(P.snapshot.gcTime===L.gcTime&&P.snapshot.initTimeoutMs===L.initTimeoutMs&&P.snapshot.lowPriorityDelayMs===L.lowPriorityDelayMs&&P.snapshot.lowPriorityMaxDelayMs===L.lowPriorityMaxDelayMs&&P.snapshot.source===L.source&&P.loaded)return P;const $=P.snapshot.gcTime!==L.gcTime;return{snapshot:L,version:$?P.version+1:P.version,loaded:!0,loadMode:"async"}}),g.runPromise(wi({type:"trace:react.runtime.config.snapshot",data:{source:L.source,mode:"async"}})).catch(()=>{}))}).catch(L=>{I||(console.debug("[RuntimeProvider] Failed to load React runtime config snapshot, fallback to default.",L),x(P=>({snapshot:$m,version:P.version,loaded:!0,loadMode:"async"})))}),()=>{I=!0}},[g]);const k=A.useMemo(()=>({runtime:g,reactConfigSnapshot:S.snapshot,configVersion:S.version,policy:u}),[g,S,u]),_=!e||h!==null,E=S.loaded,M=I=>vwe({fallback:r,phase:I,policyMode:u.mode}),[D,T]=A.useState(!1);A.useEffect(()=>{if(u.mode!=="defer"){T(!1);return}T(!1)},[u.mode]);const C=bn.useRef(null);if(A.useEffect(()=>{if(u.mode!=="defer")return;if(T(!1),!u.preload){T(!0);return}if(!_||!E)return;let I=!1;const L=FA(g,S.snapshot,S.version),P=u.preload.handles;if(P.length===0){T(!0);return}const B=Math.max(1,u.preload.concurrency??r9),$=new Set;return C.current=$,(async()=>{const j=P.slice(),K=async J=>{if(I)return;const F=performance.now();if(J?._tag==="ModuleImpl"){const Z=J.module?.id??"ModuleImpl",ee=u.preload.keysByModuleId.get(Z)??s9(Z),me=ie=>gw(J.layer,ie).pipe(Qe(xe=>ma(xe,J.module))),fe=L.preload(ee,me,{ownerId:Z,yield:u.preload.yield,entrypoint:"react.runtime.preload",policyMode:"defer"});$.add(fe.cancel),await fe.promise;const ye=performance.now()-F;g.runPromise(wi({type:"trace:react.module.preload",moduleId:Z,data:{mode:"defer",handleKind:"ModuleImpl",key:ee,durationMs:Math.round(ye*100)/100,concurrency:B,yieldStrategy:u.preload.yield.strategy,yieldOnlyWhenOverBudgetMs:u.preload.yield.onlyWhenOverBudgetMs}})).catch(()=>{});return}const U=J.id??"ModuleTag",Q=u.preload.keysByTagId.get(U)??a9(U),z=Z=>J.pipe(Jh(Z)),ne=L.preload(Q,z,{ownerId:U,yield:u.preload.yield,entrypoint:"react.runtime.preload",policyMode:"defer"});$.add(ne.cancel),await ne.promise;const ce=performance.now()-F;g.runPromise(wi({type:"trace:react.module.preload",data:{mode:"defer",handleKind:"ModuleTag",tokenId:U,key:Q,durationMs:Math.round(ce*100)/100,concurrency:B,yieldStrategy:u.preload.yield.strategy,yieldOnlyWhenOverBudgetMs:u.preload.yield.onlyWhenOverBudgetMs}})).catch(()=>{})},G=Array.from({length:Math.min(B,j.length)},async()=>{for(;!I;){const J=j.shift();if(!J)return;await K(J)}});await Promise.all(G)})().then(()=>{I||T(!0)}).catch(j=>{I||(d.current&&g.runFork(d.current(Tg(j),{source:"provider",phase:"provider.layer.build"}).pipe(zt(()=>he))),T(!0))}),()=>{I=!0,C.current=null;for(const j of $)j()}},[u,_,E,g,S,d]),A.useEffect(()=>{if(u.mode!=="defer"||!D)return;const I=C.current;if(!I||I.size===0)return;C.current=null;const L=Array.from(I);let P=!1;const B=()=>{if(!P){P=!0;for(const V of L)V()}},$=setTimeout(B,0);return()=>{clearTimeout($),B()}},[u.mode,D]),!(_&&E&&(u.mode!=="defer"||D))){const I=[_?null:"layer",E?null:"config",u.mode!=="defer"||D?null:"preload"].filter(P=>P!==null),L=I.length>0?I.join("+"):void 0;return N.jsx(jF,{runtime:g,phase:"provider.gating",policyMode:u.mode,blockers:L,children:M("provider.gating")})}const q=u.mode==="sync"?n:N.jsx(bn.Suspense,{fallback:N.jsx(jF,{runtime:g,phase:"react.suspense",policyMode:u.mode,children:M("react.suspense")}),children:n});return bn.createElement(Rh.Provider,{value:k},q)},zwe=(e,t)=>{const n=e??t?.runtime;if(!n)throw new Error(`[RuntimeProvider] Missing runtime.
75
+
76
+ Fix:
77
+ - Provide \`runtime\` prop: <RuntimeProvider runtime={runtime}>...
78
+ - Or nest under an ancestor RuntimeProvider that provides \`runtime\`.
79
+ `);return n};class Mw extends Error{constructor(t){super(`[${t}] RuntimeProvider not found.
80
+
81
+ Fix:
82
+ - Wrap your app (or the calling component subtree) with <RuntimeProvider runtime={runtime}>.
83
+ - If using nested providers, ensure an ancestor RuntimeProvider provides \`runtime\`.
84
+ - If you intended to call this hook outside React, use @logixjs/core directly.
85
+ `),this.name="RuntimeProviderNotFoundError"}}function zA(e){const t=A.useContext(Rh);if(!t)throw new Mw("useRuntime");A.useRef(null);const n=A.useMemo(()=>{},[e?.layer,e?.layers]),r=A.useRef(null);A.useEffect(()=>{yr()&&(r.current=null)},[e?.layers]);const{binding:i}=t9(t.runtime,n,!!n);return A.useMemo(()=>i?n9(t.runtime,[i.context],[i.scope],[i.loggers],[i.logLevel],[i.debugSinks]):t.runtime,[t.runtime,i])}const V0=e=>typeof e=="object"&&e!==null&&"runtime"in e&&"actions"in e&&"dispatch"in e,c9=e=>{const t=new Map;return new Proxy({},{get:(r,i)=>{if(t.has(i))return t.get(i);if(i==="dispatch")return t.set(i,e),e;if(i==="then"||typeof i!="string")return;const o=(...a)=>{const c=a[0];e({_tag:i,payload:c})};return t.set(i,o),o}})};function HC(e,t){const n=new Map;if(t){const i={};for(const[o,a]of Object.entries(t)){const c=Object.assign(((...u)=>{const d=a(...u);return e(d),d}),a);i[o]=c}return i}return new Proxy({},{get:(i,o)=>{if(n.has(o))return n.get(o);if(o==="then"||o==="dispatch"||typeof o!="string")return;const a=(...c)=>{const u=c[0],d={_tag:o,payload:u};return e(d),d};return n.set(o,a),a}})}const Bwe=Symbol.for("logix.module.handle.extend"),Uwe=e=>typeof e=="object"&&e!==null||typeof e=="function",qwe=(e,t,n)=>{if(!Uwe(e))return n;const r=e[Bwe];if(typeof r!="function")return n;const i=r(t,n);return!i||typeof i!="object"?n:{...n,...i}},GF=e=>typeof e=="object"&&e!==null&&"dispatch"in e&&"getState"in e;function BA(e){const t=zA(),n=A.useContext(Rh);if(!n)throw new Mw("useModuleRuntime");const r=A.useMemo(()=>FA(n.runtime,n.reactConfigSnapshot,n.configVersion),[n.runtime,n.reactConfigSnapshot,n.configVersion]),i=!V0(e)&&!GF(e),o=A.useMemo(()=>{if(V0(e))return e.runtime;if(GF(e))return e;const a=e,c=a.id??"ModuleTag",d=n.policy.preload?.keysByTagId.get(c)??`tag:${c}`,h=n.policy.moduleTagMode,p=y=>a.pipe(Jh(y));return h==="suspend"?r.read(d,p,void 0,c,{entrypoint:"react.useModuleRuntime",policyMode:n.policy.mode,yield:n.policy.yield}):r.readSync(d,p,void 0,c,{entrypoint:"react.useModuleRuntime",policyMode:n.policy.mode,warnSyncBlockingThresholdMs:5})},[r,n.policy,e]);return A.useEffect(()=>{if(!i||!yr()&&!cd())return;const a=e?.id??"ModuleTag",c=wi({type:"trace:react.moduleTag.resolve",moduleId:o.moduleId,instanceId:o.instanceId,data:{mode:n.policy.moduleTagMode,tokenId:a,yieldStrategy:n.policy.yield.strategy}});t.runFork(c)},[t,n.policy,o,e,i]),o}var lE={exports:{}},cE={},uE={exports:{}},dE={};var YF;function Vwe(){if(YF)return dE;YF=1;var e=ny();function t(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function c(p,y){var g=y(),v=r({inst:{value:g,getSnapshot:y}}),S=v[0].inst,x=v[1];return o(function(){S.value=g,S.getSnapshot=y,u(S)&&x({inst:S})},[p,g,y]),i(function(){return u(S)&&x({inst:S}),p(function(){u(S)&&x({inst:S})})},[p]),a(g),g}function u(p){var y=p.getSnapshot;p=p.value;try{var g=y();return!n(p,g)}catch{return!0}}function d(p,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return dE.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,dE}var QF;function Hwe(){return QF||(QF=1,uE.exports=Vwe()),uE.exports}var XF;function Kwe(){if(XF)return cE;XF=1;var e=ny(),t=Hwe();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,c=e.useMemo,u=e.useDebugValue;return cE.useSyncExternalStoreWithSelector=function(d,h,p,y,g){var v=o(null);if(v.current===null){var S={hasValue:!1,value:null};v.current=S}else S=v.current;v=c(function(){function k(T){if(!_){if(_=!0,E=T,T=y(T),g!==void 0&&S.hasValue){var C=S.value;if(g(C,T))return M=C}return M=T}if(C=M,r(E,T))return C;var O=y(T);return g!==void 0&&g(C,O)?(E=T,C):(E=T,M=O)}var _=!1,E,M,D=p===void 0?null:p;return[function(){return k(h())},D===null?void 0:function(){return k(D())}]},[h,p,y,g]);var x=i(d,v[0],v[1]);return a(function(){S.hasValue=!0,S.value=x},[x]),u(x),x},cE}var JF;function Wwe(){return JF||(JF=1,lE.exports=Kwe()),lE.exports}var Gwe=Wwe();const ZF=new WeakMap,Ywe=e=>{const t=ZF.get(e);if(t)return t;const n=new WeakMap;return ZF.set(e,n),n},Qwe=(e,t,n)=>{const r=Ywe(e),i=r.get(t);if(i)return i;let o;const a=new Set,c=n?.lowPriorityDelayMs??16,u=n?.lowPriorityMaxDelayMs??50;let d=!1,h=!1,p,y,g;const v=()=>{if(!h)return;h=!1,p!=null&&(clearTimeout(p),p=void 0),y!=null&&(clearTimeout(y),y=void 0);const C=globalThis.cancelAnimationFrame;C&&typeof g=="number"&&(C(g),g=void 0)},S=()=>{d=!1,v();for(const C of a)C()},x=C=>{if(C==="low"){if(d||h)return;h=!0;const O=()=>{h&&S()},q=globalThis.requestAnimationFrame;q?g=q(O):p=setTimeout(O,c),y=setTimeout(O,u);return}v(),!d&&(d=!0,queueMicrotask(S))};let k;const _=()=>{k||(k=e.runFork(ba(t.changesWithMeta(C=>C),({value:C,meta:O})=>Ze(()=>{o=C,x(O.priority)}))))},E=()=>{if(o!==void 0)try{const C=e.runSync(t.getState);(o===void 0||!Object.is(o,C))&&(o=C,x("normal"))}catch{}},T={getSnapshot:()=>(o!==void 0||(o=e.runSync(t.getState)),o),subscribe:C=>(a.add(C),_(),E(),()=>{if(a.delete(C),a.size>0)return;const O=k;O&&(k=void 0,v(),e.runFork(fi(O)))})};return r.set(t,T),T},KC=e=>typeof e=="object"&&e!==null,ez=e=>KC(e)&&typeof e[Symbol.iterator]=="function",u9=(e,t)=>{if(Object.is(e,t))return!0;if(!KC(e)||!KC(t))return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Object.is(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[i,o]of e)if(!t.has(i)||!Object.is(o,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}if(ez(e)&&ez(t)){const i=e[Symbol.iterator](),o=t[Symbol.iterator]();for(;;){const a=i.next(),c=o.next();if(a.done||c.done)return a.done===c.done;if(!Object.is(a.value,c.value))return!1}}const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0},tz=new WeakMap,Xwe=e=>{const t=tz.get(e);if(t)return t;const n=new WeakMap;return tz.set(e,n),n},Jwe=(e,t)=>{const n=e.get(t);if(n)return n;const r=new Map;return e.set(t,r),r},Zwe=(e,t,n)=>e.equalsKind==="custom"&&typeof e.equals=="function"?e.equals(t,n):e.equalsKind==="shallowStruct"?u9(t,n):Object.is(t,n),eke=(e,t,n,r)=>{const i=Xwe(e),o=Jwe(i,t),a=o.get(n.selectorId);if(a)return a;let c;const u=new Set,d=r?.lowPriorityDelayMs??16,h=r?.lowPriorityMaxDelayMs??50;let p=!1,y=!1,g,v,S;const x=()=>{if(!y)return;y=!1,g!=null&&(clearTimeout(g),g=void 0),v!=null&&(clearTimeout(v),v=void 0);const q=globalThis.cancelAnimationFrame;q&&typeof S=="number"&&(q(S),S=void 0)},k=()=>{p=!1,x();for(const q of u)q()},_=q=>{if(q==="low"){if(p||y)return;y=!0;const I=()=>{y&&k()},L=globalThis.requestAnimationFrame;L?S=L(I):g=setTimeout(I,d),v=setTimeout(I,h);return}x(),!p&&(p=!0,queueMicrotask(k))};let E;const M=()=>{E||(E=e.runFork(ba(t.changesReadQueryWithMeta(n),({value:q,meta:I})=>Ze(()=>{c=q,_(I.priority)}))))},D=()=>{if(c!==void 0)try{const q=e.runSync(t.getState),I=n.select(q);(c===void 0||!Zwe(n,c,I))&&(c=I,_("normal"))}catch{}},O={getSnapshot:()=>{if(c!==void 0)return c;const q=e.runSync(t.getState);return c=n.select(q),c},subscribe:q=>(u.add(q),M(),D(),()=>{if(u.delete(q),u.size>0)return;const I=E;I&&(E=void 0,x(),e.runFork(fi(I)))})};return o.set(n.selectorId,O),O};function Ji(e,t,n){const r=A.useContext(Rh);if(!r)throw new Mw("useSelector");const i=r.runtime,o=BA(e),a=t??(y=>y),c=A.useMemo(()=>typeof t=="function"?jxe(t):void 0,[t]),u=A.useMemo(()=>typeof n=="function"?n:typeof t!="function"?Object.is:c?.equalsKind==="shallowStruct"?u9:Object.is,[n,t,c?.equalsKind]),d=typeof t=="function"&&c?.lane==="static",h=A.useMemo(()=>d&&c?eke(i,o,c,{lowPriorityDelayMs:r.reactConfigSnapshot.lowPriorityDelayMs,lowPriorityMaxDelayMs:r.reactConfigSnapshot.lowPriorityMaxDelayMs}):Qwe(i,o,{lowPriorityDelayMs:r.reactConfigSnapshot.lowPriorityDelayMs,lowPriorityMaxDelayMs:r.reactConfigSnapshot.lowPriorityMaxDelayMs}),[o,i,r.reactConfigSnapshot.lowPriorityDelayMs,r.reactConfigSnapshot.lowPriorityMaxDelayMs,c,d]),p=Gwe.useSyncExternalStoreWithSelector(h.subscribe,h.getSnapshot,h.getSnapshot,d?y=>y:y=>a(y),u);return A.useEffect(()=>{if(!yr()&&!cd())return;const y=o.instanceId;let g,v;if(typeof t=="function"){const x=t,k=x.fieldPaths;if(Array.isArray(k)){const E=k.filter(M=>typeof M=="string");g=E.length>0?E.slice():void 0}const _=x.debugKey;v=typeof _=="string"&&_.length>0?_:typeof t.name=="string"&&t.name.length>0?t.name:void 0}const S=wi({type:"trace:react-selector",moduleId:o.moduleId,instanceId:y,data:{componentLabel:"useSelector",selectorKey:v,fieldPaths:g,selectorId:c?.selectorId,lane:c?.lane,producer:c?.producer,fallbackReason:c?.fallbackReason,readsDigest:c?.readsDigest,equalsKind:c?.equalsKind,strictModePhase:"commit"}});i.runFork(S)},[i,o,t,p,c]),p}const nz=(e,t,n)=>{const r=e.get(t);if(r)return r;const i=n();return e.set(t,i),i},tke=new WeakMap,d9=(e,t,n)=>{const r=nz(tke,e,()=>new WeakMap),i=nz(r,t,()=>new WeakMap),o=i.get(n);if(o)return o;const c=cwe(t).get(n);if(c){const g=Object.assign(k=>{e.runFork(c.dispatch(k))},{batch:k=>{e.runFork(c.dispatchBatch(k))},lowPriority:k=>{e.runFork(c.dispatchLowPriority(k))}}),v=c9(g),S=HC(g,n.actions),x={def:n,runtime:c,dispatch:g,actions:v,dispatchers:S,imports:{get:k=>d9(e,c,k)},getState:c.getState,setState:c.setState,actions$:c.actions$,changes:c.changes,ref:c.ref};return i.set(n,x),x}const u=t.moduleId,d=String(n.id),h=t.instanceId,p=yr()?["- Ensure the child is imported in the same scope.",` Example: ${u}.implement({ imports: [${d}.impl], ... })`,"- Ensure parentRuntime is an instance scope (not a ModuleTag singleton)."," Example: useModule(ParentImpl, { key }) / useModule(ParentImpl) / useLocalModule(ParentModule, ...)","- If you intentionally want a singleton (not an imported child), use useModule(Child.tag) (ModuleTag) in the current React runtime environment.","- If you intentionally want the root provider singleton (ignore RuntimeProvider.layer overrides), use runtime.runSync(Root.resolve(Child.tag))."]:[],y=new Error(yr()?["[MissingImportedModuleError] Cannot resolve imported module from parent imports scope.","",`tokenId: ${d}`,"entrypoint: react.useImportedModule/imports.get","mode: strict",`startScope: moduleId=${u}, instanceId=${h}`,"","fix:",...p].join(`
86
+ `):"[MissingImportedModuleError] imported module runtime not found");throw y.tokenId=d,y.entrypoint="react.useImportedModule/imports.get",y.mode="strict",y.startScope={moduleId:u,instanceId:h},y.fix=p,y.name="MissingImportedModuleError",y},nke=()=>bn.useId(),hu=e=>!!e&&typeof e=="object"&&e._tag==="ModuleImpl",rz=e=>Axe(e),iz=e=>X6(e)&&e._kind==="ModuleDef";function rke(e,t,n){const r=zA(),i=bn.useContext(Rh);if(!i)throw new Mw("useModule");const o=rz(e)?e.impl:iz(e)?e.tag:e;let a,c;if(hu(o))typeof t=="function"?a=t:t&&typeof t=="object"&&(c=t);else if(typeof t=="function"||t===void 0)a=t;else if(t&&typeof t=="object")throw new Error("useModule(handle, options) 仅支持 ModuleImpl 句柄");let u;if(hu(o)){const S=bn.useMemo(()=>FA(r,i.reactConfigSnapshot,i.configVersion),[r,i.reactConfigSnapshot,i.configVersion]),x=c?.deps??[],k=Pwe(x),_=c?.suspend===!0,E=_||c?.suspend!==!1&&i.policy.moduleImplMode==="suspend",M=c?.gcTime??i.reactConfigSnapshot.gcTime;let D=E?c?.initTimeoutMs:void 0;if(E&&D===void 0&&(D=i.reactConfigSnapshot.initTimeoutMs),_&&(!c||!c.key)&&yr())throw new Error("[useModule] suspend:true 模式必须显式提供 options.key;请在 Suspense 边界外生成稳定 ID(例如 useId() 或业务 id),并在 useModule(Impl, { suspend: true, key }) 中传入该值。");const T=nke(),C=o.module.id??"ModuleImpl",q=i.policy.preload?.keysByModuleId.get(C)??c?.key??(E?`impl:${C}`:`impl:${C}:${T}`),I=k?`${q}:${k}`:q,L=C,P=bn.useMemo(()=>V=>gw(o.layer,V).pipe(Qe(j=>ma(j,o.module))),[o]),B=bn.useMemo(()=>!E||D===void 0?P:V=>P(V).pipe(_fe({duration:D,onTimeout:()=>new Error(`[useModule] Module "${L}" initialization timed out after ${D}ms`)})),[P,E,D,L]),$=E?S.read(I,B,M,L,{entrypoint:"react.useModule",policyMode:i.policy.mode,yield:i.policy.yield}):S.readSync(I,B,M,L,{entrypoint:"react.useModule",policyMode:i.policy.mode,warnSyncBlockingThresholdMs:5});bn.useEffect(()=>S.retain(I),[S,I]),u=$}else u=BA(o);if(bn.useEffect(()=>{if(!hu(o))return;const S=c,x=S&&"label"in S&&S.label||S&&S.key;if(!x)return;const k=wi({type:"trace:instanceLabel",moduleId:o.module.id,instanceId:u.instanceId,data:{label:x}});r.runFork(k)},[r,u,o,c]),bn.useEffect(()=>{if(!yr()&&!cd()||!u.instanceId)return;const S=wi({type:"trace:react-render",moduleId:u.moduleId,instanceId:u.instanceId,data:{componentLabel:"useModule",strictModePhase:"commit"}});r.runFork(S)},[r,u]),a)return hu(o)?Ji(u,a,n):Ji(o,a,n);const d=bn.useMemo(()=>{if(rz(e)||iz(e))return e;if(V0(e))return e.def;if(hu(e))return e.module;if(e&&(typeof e=="object"||typeof e=="function")&&e._kind==="ModuleTag")return e;if(hu(o))return o.module;if(V0(o))return o.def;if(o&&(typeof o=="object"||typeof o=="function")&&o._kind==="ModuleTag")return o},[e,o]),h=bn.useMemo(()=>{if(!d||typeof d!="object"&&typeof d!="function")return;const S=d;if(!(!S.actions||typeof S.actions!="object"))return S.actions},[d]),p=bn.useMemo(()=>Object.assign(x=>{r.runFork(u.dispatch(x))},{batch:x=>{r.runFork(u.dispatchBatch(x))},lowPriority:x=>{r.runFork(u.dispatchLowPriority(x))}}),[r,u]),y=bn.useMemo(()=>hu(o)?o.module:o,[o]),g=bn.useMemo(()=>c9(p),[p]),v=bn.useMemo(()=>h?HC(p,h):HC(p),[p,h]);return bn.useMemo(()=>{const S={def:d,runtime:u,dispatch:p,actions:g,dispatchers:v,imports:{get:x=>d9(r,u,x)},getState:u.getState,setState:u.setState,actions$:u.actions$,changes:u.changes,ref:u.ref};return qwe(y,u,S)},[r,u,p,g,v,y,d])}function ike(e){const t=zA(),n=BA(e);return A.useMemo(()=>Object.assign(i=>{t.runFork(n.dispatch(i))},{batch:i=>{t.runFork(n.dispatchBatch(i))},lowPriority:i=>{t.runFork(n.dispatchLowPriority(i))}}),[t,n])}class oke{constructor(t,n,r){this.suspendRef=t,this.resumeRef=n,this.resetRef=r}lifecycle={onSuspend:t=>is(this.suspendRef,n=>[...n,t]).pipe(fn),onResume:t=>is(this.resumeRef,n=>[...n,t]).pipe(fn),onReset:t=>is(this.resetRef,n=>[...n,t]).pipe(fn)};emitSuspend=()=>Ui(this.suspendRef).pipe(ze(t=>sn(t,n=>n,{discard:!0})));emitResume=()=>Ui(this.resumeRef).pipe(ze(t=>sn(t,n=>n,{discard:!0})));emitReset=()=>Ui(this.resetRef).pipe(ze(t=>sn(t,n=>n,{discard:!0})))}const ske=ae(function*(){const e=yield*Kn([]),t=yield*Kn([]),n=yield*Kn([]);return new oke(e,t,n)});_0(J6,ske);var oz="popstate";function ake(e={}){function t(r,i){let{pathname:o,search:a,hash:c}=r.location;return WC("",{pathname:o,search:a,hash:c},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:qg(i)}return cke(t,n,null,e)}function Or(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function js(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function lke(){return Math.random().toString(36).substring(2,10)}function sz(e,t){return{usr:e.state,key:e.key,idx:t}}function WC(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Wy(t):t,state:n,key:t&&t.key||r||lke()}}function qg({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Wy(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function cke(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:o=!1}=r,a=i.history,c="POP",u=null,d=h();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function h(){return(a.state||{idx:null}).idx}function p(){c="POP";let x=h(),k=x==null?null:x-d;d=x,u&&u({action:c,location:S.location,delta:k})}function y(x,k){c="PUSH";let _=WC(S.location,x,k);d=h()+1;let E=sz(_,d),M=S.createHref(_);try{a.pushState(E,"",M)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(M)}o&&u&&u({action:c,location:S.location,delta:1})}function g(x,k){c="REPLACE";let _=WC(S.location,x,k);d=h();let E=sz(_,d),M=S.createHref(_);a.replaceState(E,"",M),o&&u&&u({action:c,location:S.location,delta:0})}function v(x){return uke(x)}let S={get action(){return c},get location(){return e(i,a)},listen(x){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(oz,p),u=x,()=>{i.removeEventListener(oz,p),u=null}},createHref(x){return t(i,x)},createURL:v,encodeLocation(x){let k=v(x);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:g,go(x){return a.go(x)}};return S}function uke(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Or(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:qg(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function f9(e,t,n="/"){return dke(e,t,n,!1)}function dke(e,t,n,r){let i=typeof t=="string"?Wy(t):t,o=gl(i.pathname||"/",n);if(o==null)return null;let a=h9(e);fke(a);let c=null;for(let u=0;c==null&&u<a.length;++u){let d=m9(o);c=xke(a[u],d,r)}return c}function h9(e,t=[],n=[],r="",i=!1){let o=(a,c,u=i,d)=>{let h={relativePath:d===void 0?a.path||"":d,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&u)return;Or(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let p=ll([r,h.relativePath]),y=n.concat(h);a.children&&a.children.length>0&&(Or(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),h9(a.children,t,y,p,u)),!(a.path==null&&!a.index)&&t.push({path:p,score:vke(p,a.index),routesMeta:y})};return e.forEach((a,c)=>{if(a.path===""||!a.path?.includes("?"))o(a,c);else for(let u of p9(a.path))o(a,c,!0,u)}),t}function p9(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let a=p9(r.join("/")),c=[];return c.push(...a.map(u=>u===""?o:[o,u].join("/"))),i&&c.push(...a),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function fke(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ske(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var hke=/^:[\w-]+$/,pke=3,mke=2,gke=1,yke=10,bke=-2,az=e=>e==="*";function vke(e,t){let n=e.split("/"),r=n.length;return n.some(az)&&(r+=bke),t&&(r+=mke),n.filter(i=>!az(i)).reduce((i,o)=>i+(hke.test(o)?pke:o===""?gke:yke),r)}function Ske(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function xke(e,t,n=!1){let{routesMeta:r}=e,i={},o="/",a=[];for(let c=0;c<r.length;++c){let u=r[c],d=c===r.length-1,h=o==="/"?t:t.slice(o.length)||"/",p=Vg({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},h),y=u.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=Vg({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!p)return null;Object.assign(i,p.params),a.push({params:i,pathname:ll([o,p.pathname]),pathnameBase:Cke(ll([o,p.pathnameBase])),route:y}),p.pathnameBase!=="/"&&(o=ll([o,p.pathnameBase]))}return a}function Vg(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wke(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],a=o.replace(/(.)\/+$/,"$1"),c=i.slice(1);return{params:r.reduce((d,{paramName:h,isOptional:p},y)=>{if(h==="*"){let v=c[y]||"";a=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}const g=c[y];return p&&!g?d[h]=void 0:d[h]=(g||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:a,pattern:e}}function wke(e,t=!1,n=!0){js(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function m9(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return js(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function gl(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var kke=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_ke=e=>kke.test(e);function Eke(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Wy(e):e,o;if(n)if(_ke(n))o=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),js(!1,`Pathnames cannot have embedded double slashes - normalizing ${a} -> ${n}`)}n.startsWith("/")?o=lz(n.substring(1),"/"):o=lz(n,t)}else o=t;return{pathname:o,search:Ike(r),hash:Mke(i)}}function lz(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function fE(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Tke(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function g9(e){let t=Tke(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function y9(e,t,n,r=!1){let i;typeof e=="string"?i=Wy(e):(i={...e},Or(!i.pathname||!i.pathname.includes("?"),fE("?","pathname","search",i)),Or(!i.pathname||!i.pathname.includes("#"),fE("#","pathname","hash",i)),Or(!i.search||!i.search.includes("#"),fE("#","search","hash",i)));let o=e===""||i.pathname==="",a=o?"/":i.pathname,c;if(a==null)c=n;else{let p=t.length-1;if(!r&&a.startsWith("..")){let y=a.split("/");for(;y[0]==="..";)y.shift(),p-=1;i.pathname=y.join("/")}c=p>=0?t[p]:"/"}let u=Eke(i,c),d=a&&a!=="/"&&a.endsWith("/"),h=(o||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(d||h)&&(u.pathname+="/"),u}var ll=e=>e.join("/").replace(/\/\/+/g,"/"),Cke=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ike=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Mke=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Rke(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var b9=["POST","PUT","PATCH","DELETE"];new Set(b9);var Ake=["GET",...b9];new Set(Ake);var op=A.createContext(null);op.displayName="DataRouter";var Rw=A.createContext(null);Rw.displayName="DataRouterState";A.createContext(!1);var v9=A.createContext({isTransitioning:!1});v9.displayName="ViewTransition";var Oke=A.createContext(new Map);Oke.displayName="Fetchers";var Dke=A.createContext(null);Dke.displayName="Await";var wa=A.createContext(null);wa.displayName="Navigation";var Aw=A.createContext(null);Aw.displayName="Location";var kl=A.createContext({outlet:null,matches:[],isDataRoute:!1});kl.displayName="Route";var UA=A.createContext(null);UA.displayName="RouteError";function Pke(e,{relative:t}={}){Or(sp(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=A.useContext(wa),{hash:i,pathname:o,search:a}=Gy(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:ll([n,o])),r.createHref({pathname:c,search:a,hash:i})}function sp(){return A.useContext(Aw)!=null}function Fc(){return Or(sp(),"useLocation() may be used only in the context of a <Router> component."),A.useContext(Aw).location}function cz(e){Or(sp(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Fc();return A.useMemo(()=>Vg(e,m9(t)),[t,e])}var S9="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function x9(e){A.useContext(wa).static||A.useLayoutEffect(e)}function w9(){let{isDataRoute:e}=A.useContext(kl);return e?Wke():Nke()}function Nke(){Or(sp(),"useNavigate() may be used only in the context of a <Router> component.");let e=A.useContext(op),{basename:t,navigator:n}=A.useContext(wa),{matches:r}=A.useContext(kl),{pathname:i}=Fc(),o=JSON.stringify(g9(r)),a=A.useRef(!1);return x9(()=>{a.current=!0}),A.useCallback((u,d={})=>{if(js(a.current,S9),!a.current)return;if(typeof u=="number"){n.go(u);return}let h=y9(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ll([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,o,i,e])}A.createContext(null);function Gy(e,{relative:t}={}){let{matches:n}=A.useContext(kl),{pathname:r}=Fc(),i=JSON.stringify(g9(n));return A.useMemo(()=>y9(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function Lke(e,t,n,r,i){Or(sp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=A.useContext(wa),{matches:a}=A.useContext(kl),c=a[a.length-1],u=c?c.params:{},d=c?c.pathname:"/",h=c?c.pathnameBase:"/",p=c&&c.route;{let _=p&&p.path||"";k9(d,!p||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
87
+
88
+ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let y=Fc(),g;g=y;let v=g.pathname||"/",S=v;if(h!=="/"){let _=h.replace(/^\//,"").split("/");S="/"+v.replace(/^\//,"").split("/").slice(_.length).join("/")}let x=f9(e,{pathname:S});return js(p||x!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),js(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),Bke(x&&x.map(_=>Object.assign({},_,{params:Object.assign({},u,_.params),pathname:ll([h,o.encodeLocation?o.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?h:ll([h,o.encodeLocation?o.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),a,n,r,i)}function $ke(){let e=Kke(),t=Rke(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=A.createElement(A.Fragment,null,A.createElement("p",null,"💿 Hey developer 👋"),A.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",A.createElement("code",{style:o},"ErrorBoundary")," or"," ",A.createElement("code",{style:o},"errorElement")," prop on your route.")),A.createElement(A.Fragment,null,A.createElement("h2",null,"Unexpected Application Error!"),A.createElement("h3",{style:{fontStyle:"italic"}},t),n?A.createElement("pre",{style:i},n):null,a)}var jke=A.createElement($ke,null),Fke=class extends A.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?A.createElement(kl.Provider,{value:this.props.routeContext},A.createElement(UA.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function zke({routeContext:e,match:t,children:n}){let r=A.useContext(op);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(kl.Provider,{value:e},n)}function Bke(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=n?.errors;if(a!=null){let h=o.findIndex(p=>p.route.id&&a?.[p.route.id]!==void 0);Or(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let c=!1,u=-1;if(n)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(u=h),p.route.id){let{loaderData:y,errors:g}=n,v=p.route.loader&&!y.hasOwnProperty(p.route.id)&&(!g||g[p.route.id]===void 0);if(p.route.lazy||v){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}let d=n&&r?(h,p)=>{r(h,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:p})}:void 0;return o.reduceRight((h,p,y)=>{let g,v=!1,S=null,x=null;n&&(g=a&&p.route.id?a[p.route.id]:void 0,S=p.route.errorElement||jke,c&&(u<0&&y===0?(k9("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,x=null):u===y&&(v=!0,x=p.route.hydrateFallbackElement||null)));let k=t.concat(o.slice(0,y+1)),_=()=>{let E;return g?E=S:v?E=x:p.route.Component?E=A.createElement(p.route.Component,null):p.route.element?E=p.route.element:E=h,A.createElement(zke,{match:p,routeContext:{outlet:h,matches:k,isDataRoute:n!=null},children:E})};return n&&(p.route.ErrorBoundary||p.route.errorElement||y===0)?A.createElement(Fke,{location:n.location,revalidation:n.revalidation,component:S,error:g,children:_(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):_()},null)}function qA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Uke(e){let t=A.useContext(op);return Or(t,qA(e)),t}function qke(e){let t=A.useContext(Rw);return Or(t,qA(e)),t}function Vke(e){let t=A.useContext(kl);return Or(t,qA(e)),t}function VA(e){let t=Vke(e),n=t.matches[t.matches.length-1];return Or(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Hke(){return VA("useRouteId")}function Kke(){let e=A.useContext(UA),t=qke("useRouteError"),n=VA("useRouteError");return e!==void 0?e:t.errors?.[n]}function Wke(){let{router:e}=Uke("useNavigate"),t=VA("useNavigate"),n=A.useRef(!1);return x9(()=>{n.current=!0}),A.useCallback(async(i,o={})=>{js(n.current,S9),n.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:t,...o}))},[e,t])}var uz={};function k9(e,t,n){!t&&!uz[e]&&(uz[e]=!0,js(!1,n))}A.memo(Gke);function Gke({routes:e,future:t,state:n,unstable_onError:r}){return Lke(e,void 0,n,r,t)}function Yke({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:o=!1}){Or(!sp(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=e.replace(/^\/*/,"/"),c=A.useMemo(()=>({basename:a,navigator:i,static:o,future:{}}),[a,i,o]);typeof n=="string"&&(n=Wy(n));let{pathname:u="/",search:d="",hash:h="",state:p=null,key:y="default"}=n,g=A.useMemo(()=>{let v=gl(u,a);return v==null?null:{location:{pathname:v,search:d,hash:h,state:p,key:y},navigationType:r}},[a,u,d,h,p,y,r]);return js(g!=null,`<Router basename="${a}"> is not able to match the URL "${u}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:A.createElement(wa.Provider,{value:c},A.createElement(Aw.Provider,{children:t,value:g}))}var PS="get",NS="application/x-www-form-urlencoded";function Ow(e){return e!=null&&typeof e.tagName=="string"}function Qke(e){return Ow(e)&&e.tagName.toLowerCase()==="button"}function Xke(e){return Ow(e)&&e.tagName.toLowerCase()==="form"}function Jke(e){return Ow(e)&&e.tagName.toLowerCase()==="input"}function Zke(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function e_e(e,t){return e.button===0&&(!t||t==="_self")&&!Zke(e)}var qv=null;function t_e(){if(qv===null)try{new FormData(document.createElement("form"),0),qv=!1}catch{qv=!0}return qv}var n_e=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function hE(e){return e!=null&&!n_e.has(e)?(js(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${NS}"`),null):e}function r_e(e,t){let n,r,i,o,a;if(Xke(e)){let c=e.getAttribute("action");r=c?gl(c,t):null,n=e.getAttribute("method")||PS,i=hE(e.getAttribute("enctype"))||NS,o=new FormData(e)}else if(Qke(e)||Jke(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(r=u?gl(u,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||PS,i=hE(e.getAttribute("formenctype"))||hE(c.getAttribute("enctype"))||NS,o=new FormData(c,e),!t_e()){let{name:d,type:h,value:p}=e;if(h==="image"){let y=d?`${d}.`:"";o.append(`${y}x`,"0"),o.append(`${y}y`,"0")}else d&&o.append(d,p)}}else{if(Ow(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=PS,r=null,i=NS,a=e}return o&&i==="text/plain"&&(a=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function HA(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function i_e(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&gl(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function o_e(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function s_e(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function a_e(e,t,n){let r=await Promise.all(e.map(async i=>{let o=t.routes[i.route.id];if(o){let a=await o_e(o,n);return a.links?a.links():[]}return[]}));return d_e(r.flat(1).filter(s_e).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function dz(e,t,n,r,i,o){let a=(u,d)=>n[d]?u.route.id!==n[d].route.id:!0,c=(u,d)=>n[d].pathname!==u.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==u.params["*"];return o==="assets"?t.filter((u,d)=>a(u,d)||c(u,d)):o==="data"?t.filter((u,d)=>{let h=r.routes[u.route.id];if(!h||!h.hasLoader)return!1;if(a(u,d)||c(u,d))return!0;if(u.route.shouldRevalidate){let p=u.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function l_e(e,t,{includeHydrateFallback:n}={}){return c_e(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function c_e(e){return[...new Set(e)]}function u_e(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function d_e(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let o=JSON.stringify(u_e(i));return n.has(o)||(n.add(o),r.push({key:o,link:i})),r},[])}function _9(){let e=A.useContext(op);return HA(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function f_e(){let e=A.useContext(Rw);return HA(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var KA=A.createContext(void 0);KA.displayName="FrameworkContext";function E9(){let e=A.useContext(KA);return HA(e,"You must render this element inside a <HydratedRouter> element"),e}function h_e(e,t){let n=A.useContext(KA),[r,i]=A.useState(!1),[o,a]=A.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:d,onMouseLeave:h,onTouchStart:p}=t,y=A.useRef(null);A.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let S=k=>{k.forEach(_=>{a(_.isIntersecting)})},x=new IntersectionObserver(S,{threshold:.5});return y.current&&x.observe(y.current),()=>{x.disconnect()}}},[e]),A.useEffect(()=>{if(r){let S=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(S)}}},[r]);let g=()=>{i(!0)},v=()=>{i(!1),a(!1)};return n?e!=="intent"?[o,y,{}]:[o,y,{onFocus:gm(c,g),onBlur:gm(u,v),onMouseEnter:gm(d,g),onMouseLeave:gm(h,v),onTouchStart:gm(p,g)}]:[!1,y,{}]}function gm(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function p_e({page:e,...t}){let{router:n}=_9(),r=A.useMemo(()=>f9(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?A.createElement(g_e,{page:e,matches:r,...t}):null}function m_e(e){let{manifest:t,routeModules:n}=E9(),[r,i]=A.useState([]);return A.useEffect(()=>{let o=!1;return a_e(e,t,n).then(a=>{o||i(a)}),()=>{o=!0}},[e,t,n]),r}function g_e({page:e,matches:t,...n}){let r=Fc(),{manifest:i,routeModules:o}=E9(),{basename:a}=_9(),{loaderData:c,matches:u}=f_e(),d=A.useMemo(()=>dz(e,t,u,i,r,"data"),[e,t,u,i,r]),h=A.useMemo(()=>dz(e,t,u,i,r,"assets"),[e,t,u,i,r]),p=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let v=new Set,S=!1;if(t.forEach(k=>{let _=i.routes[k.route.id];!_||!_.hasLoader||(!d.some(E=>E.route.id===k.route.id)&&k.route.id in c&&o[k.route.id]?.shouldRevalidate||_.hasClientLoader?S=!0:v.add(k.route.id))}),v.size===0)return[];let x=i_e(e,a,"data");return S&&v.size>0&&x.searchParams.set("_routes",t.filter(k=>v.has(k.route.id)).map(k=>k.route.id).join(",")),[x.pathname+x.search]},[a,c,r,i,d,t,e,o]),y=A.useMemo(()=>l_e(h,i),[h,i]),g=m_e(h);return A.createElement(A.Fragment,null,p.map(v=>A.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...n})),y.map(v=>A.createElement("link",{key:v,rel:"modulepreload",href:v,...n})),g.map(({key:v,link:S})=>A.createElement("link",{key:v,nonce:n.nonce,...S})))}function y_e(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var T9=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{T9&&(window.__reactRouterVersion="7.9.6")}catch{}function b_e({basename:e,children:t,window:n}){let r=A.useRef();r.current==null&&(r.current=ake({window:n,v5Compat:!0}));let i=r.current,[o,a]=A.useState({action:i.action,location:i.location}),c=A.useCallback(u=>{A.startTransition(()=>a(u))},[a]);return A.useLayoutEffect(()=>i.listen(c),[i,c]),A.createElement(Yke,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:i})}var C9=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Hg=A.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:o,replace:a,state:c,target:u,to:d,preventScrollReset:h,viewTransition:p,...y},g){let{basename:v}=A.useContext(wa),S=typeof d=="string"&&C9.test(d),x,k=!1;if(typeof d=="string"&&S&&(x=d,T9))try{let q=new URL(window.location.href),I=d.startsWith("//")?new URL(q.protocol+d):new URL(d),L=gl(I.pathname,v);I.origin===q.origin&&L!=null?d=L+I.search+I.hash:k=!0}catch{js(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let _=Pke(d,{relative:i}),[E,M,D]=h_e(r,y),T=w_e(d,{replace:a,state:c,target:u,preventScrollReset:h,relative:i,viewTransition:p});function C(q){t&&t(q),q.defaultPrevented||T(q)}let O=A.createElement("a",{...y,...D,href:x||_,onClick:k||o?t:C,ref:y_e(g,M),target:u,"data-discover":!S&&n==="render"?"true":void 0});return E&&!S?A.createElement(A.Fragment,null,O,A.createElement(p_e,{page:_})):O});Hg.displayName="Link";var v_e=A.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:a,viewTransition:c,children:u,...d},h){let p=Gy(a,{relative:d.relative}),y=Fc(),g=A.useContext(Rw),{navigator:v,basename:S}=A.useContext(wa),x=g!=null&&C_e(p)&&c===!0,k=v.encodeLocation?v.encodeLocation(p).pathname:p.pathname,_=y.pathname,E=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;n||(_=_.toLowerCase(),E=E?E.toLowerCase():null,k=k.toLowerCase()),E&&S&&(E=gl(E,S)||E);const M=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let D=_===k||!i&&_.startsWith(k)&&_.charAt(M)==="/",T=E!=null&&(E===k||!i&&E.startsWith(k)&&E.charAt(k.length)==="/"),C={isActive:D,isPending:T,isTransitioning:x},O=D?t:void 0,q;typeof r=="function"?q=r(C):q=[r,D?"active":null,T?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let I=typeof o=="function"?o(C):o;return A.createElement(Hg,{...d,"aria-current":O,className:q,ref:h,style:I,to:a,viewTransition:c},typeof u=="function"?u(C):u)});v_e.displayName="NavLink";var S_e=A.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:o,method:a=PS,action:c,onSubmit:u,relative:d,preventScrollReset:h,viewTransition:p,...y},g)=>{let v=E_e(),S=T_e(c,{relative:d}),x=a.toLowerCase()==="get"?"get":"post",k=typeof c=="string"&&C9.test(c),_=E=>{if(u&&u(E),E.defaultPrevented)return;E.preventDefault();let M=E.nativeEvent.submitter,D=M?.getAttribute("formmethod")||a;v(M||E.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:i,state:o,relative:d,preventScrollReset:h,viewTransition:p})};return A.createElement("form",{ref:g,method:x,action:S,onSubmit:r?u:_,...y,"data-discover":!k&&e==="render"?"true":void 0})});S_e.displayName="Form";function x_e(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function I9(e){let t=A.useContext(op);return Or(t,x_e(e)),t}function w_e(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:o,viewTransition:a}={}){let c=w9(),u=Fc(),d=Gy(e,{relative:o});return A.useCallback(h=>{if(e_e(h,t)){h.preventDefault();let p=n!==void 0?n:qg(u)===qg(d);c(e,{replace:p,state:r,preventScrollReset:i,relative:o,viewTransition:a})}},[u,c,d,n,r,t,e,i,o,a])}var k_e=0,__e=()=>`__${String(++k_e)}__`;function E_e(){let{router:e}=I9("useSubmit"),{basename:t}=A.useContext(wa),n=Hke();return A.useCallback(async(r,i={})=>{let{action:o,method:a,encType:c,formData:u,body:d}=r_e(r,t);if(i.navigate===!1){let h=i.fetcherKey||__e();await e.fetch(h,n,i.action||o,{preventScrollReset:i.preventScrollReset,formData:u,body:d,formMethod:i.method||a,formEncType:i.encType||c,flushSync:i.flushSync})}else await e.navigate(i.action||o,{preventScrollReset:i.preventScrollReset,formData:u,body:d,formMethod:i.method||a,formEncType:i.encType||c,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,n])}function T_e(e,{relative:t}={}){let{basename:n}=A.useContext(wa),r=A.useContext(kl);Or(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),o={...Gy(e||".",{relative:t})},a=Fc();if(e==null){o.search=a.search;let c=new URLSearchParams(o.search),u=c.getAll("index");if(u.some(h=>h==="")){c.delete("index"),u.filter(p=>p).forEach(p=>c.append("index",p));let h=c.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ll([n,o.pathname])),qg(o)}function C_e(e,{relative:t}={}){let n=A.useContext(v9);Or(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=I9("useViewTransitionState"),i=Gy(e,{relative:t});if(!n.isTransitioning)return!1;let o=gl(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=gl(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Vg(i.pathname,a)!=null||Vg(i.pathname,o)!=null}var Yy=X3();const I_e=px(Yy);function M9(e){const t=e.split(/\r?\n/),n=[],r=/^(#{1,6})\s+(.+?)\s*$/,i=/^User\s+Story\s+(?<num>\d+)\b(?<rest>.*)$/i,o=/\(\s*Priority\s*:\s*(?<priority>P\d+)\s*\)\s*$/i;for(let a=0;a<t.length;a++){const u=(t[a]??"").match(r);if(!u)continue;const h=(u[2]??"").trim().match(i);if(!h?.groups?.num)continue;const p=Number.parseInt(h.groups.num,10);if(!Number.isFinite(p))continue;let y=(h.groups.rest??"").trim();const g=y.match(o);g&&(y=y.slice(0,g.index).trim()),y=y.replace(/^[-–—::]\s*/,"").trim(),n.push({code:`US${p}`,index:p,title:y||`User Story ${p}`,line:a+1})}return n.sort((a,c)=>a.index-c.index)}function WA(e){const t=e.match(/\b(?:FR|NFR|SC)-\d{3}\b/g)??[];return Array.from(new Set(t)).sort()}function fz(e){const t=new Map;for(const n of e){const r=WA(n.raw);for(const i of r){const o=t.get(i)??{done:0,total:0};o.total+=1,n.checked&&(o.done+=1),t.set(i,o)}}return Array.from(t.entries()).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>({code:n,total:r.total,done:r.done}))}function hz(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fu(e){let t=e.title;return e.taskId&&(t=t.replace(new RegExp(`^\\s*${hz(e.taskId)}\\b\\s*`),""),t=t.replace(/^\s*[-–—·::]\s*/,"")),e.story&&(t=t.replace(new RegExp(`\\s*\\[${hz(e.story)}\\]\\s*`,"g")," ")),e.parallel&&(t=t.replace(/\s*\[P\]\s*/g," ")),t=t.replace(/\s{2,}/g," ").trim(),t||e.title}function H0(e){const t=e.length,n=e.filter(r=>r.checked).length;return{total:t,done:n,todo:t-n}}const GA=A.createContext({});function YA(e){const t=A.useRef(null);return t.current===null&&(t.current=e()),t.current}const QA=typeof window<"u",R9=QA?A.useLayoutEffect:A.useEffect,Dw=A.createContext(null);function XA(e,t){e.indexOf(t)===-1&&e.push(t)}function JA(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const yl=(e,t,n)=>n>t?t:n<e?e:n;let ZA=()=>{};const bl={},A9=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function O9(e){return typeof e=="object"&&e!==null}const D9=e=>/^0[^.\s]+$/u.test(e);function eO(e){let t;return()=>(t===void 0&&(t=e()),t)}const ls=e=>e,M_e=(e,t)=>n=>t(e(n)),Qy=(...e)=>e.reduce(M_e),Kg=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class tO{constructor(){this.subscriptions=[]}add(t){return XA(this.subscriptions,t),()=>JA(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o<i;o++){const a=this.subscriptions[o];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const da=e=>e*1e3,ss=e=>e/1e3;function P9(e,t){return t?e*(1e3/t):0}const N9=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,R_e=1e-7,A_e=12;function O_e(e,t,n,r,i){let o,a,c=0;do a=t+(n-t)/2,o=N9(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>R_e&&++c<A_e);return a}function Xy(e,t,n,r){if(e===t&&n===r)return ls;const i=o=>O_e(o,0,1,e,n);return o=>o===0||o===1?o:N9(i(o),t,r)}const L9=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$9=e=>t=>1-e(1-t),j9=Xy(.33,1.53,.69,.99),nO=$9(j9),F9=L9(nO),z9=e=>(e*=2)<1?.5*nO(e):.5*(2-Math.pow(2,-10*(e-1))),rO=e=>1-Math.sin(Math.acos(e)),B9=$9(rO),U9=L9(rO),D_e=Xy(.42,0,1,1),P_e=Xy(0,0,.58,1),q9=Xy(.42,0,.58,1),N_e=e=>Array.isArray(e)&&typeof e[0]!="number",V9=e=>Array.isArray(e)&&typeof e[0]=="number",L_e={linear:ls,easeIn:D_e,easeInOut:q9,easeOut:P_e,circIn:rO,circInOut:U9,circOut:B9,backIn:nO,backInOut:F9,backOut:j9,anticipate:z9},$_e=e=>typeof e=="string",pz=e=>{if(V9(e)){ZA(e.length===4);const[t,n,r,i]=e;return Xy(t,n,r,i)}else if($_e(e))return L_e[e];return e},Vv=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function j_e(e,t){let n=new Set,r=new Set,i=!1,o=!1;const a=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function u(h){a.has(h)&&(d.schedule(h),e()),h(c)}const d={schedule:(h,p=!1,y=!1)=>{const v=y&&i?n:r;return p&&a.add(h),v.has(h)||v.add(h),h},cancel:h=>{r.delete(h),a.delete(h)},process:h=>{if(c=h,i){o=!0;return}i=!0,[n,r]=[r,n],n.forEach(u),n.clear(),i=!1,o&&(o=!1,d.process(h))}};return d}const F_e=40;function H9(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,a=Vv.reduce((E,M)=>(E[M]=j_e(o),E),{}),{setup:c,read:u,resolveKeyframes:d,preUpdate:h,update:p,preRender:y,render:g,postRender:v}=a,S=()=>{const E=bl.useManualTiming?i.timestamp:performance.now();n=!1,bl.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(E-i.timestamp,F_e),1)),i.timestamp=E,i.isProcessing=!0,c.process(i),u.process(i),d.process(i),h.process(i),p.process(i),y.process(i),g.process(i),v.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(S))},x=()=>{n=!0,r=!0,i.isProcessing||e(S)};return{schedule:Vv.reduce((E,M)=>{const D=a[M];return E[M]=(T,C=!1,O=!1)=>(n||x(),D.schedule(T,C,O)),E},{}),cancel:E=>{for(let M=0;M<Vv.length;M++)a[Vv[M]].cancel(E)},state:i,steps:a}}const{schedule:Wn,cancel:Tc,state:ai,steps:pE}=H9(typeof requestAnimationFrame<"u"?requestAnimationFrame:ls,!0);let LS;function z_e(){LS=void 0}const to={now:()=>(LS===void 0&&to.set(ai.isProcessing||bl.useManualTiming?ai.timestamp:performance.now()),LS),set:e=>{LS=e,queueMicrotask(z_e)}},K9=e=>t=>typeof t=="string"&&t.startsWith(e),W9=K9("--"),B_e=K9("var(--"),iO=e=>B_e(e)?U_e.test(e.split("/*")[0].trim()):!1,U_e=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ap={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Wg={...ap,transform:e=>yl(0,1,e)},Hv={...ap,default:1},tg=e=>Math.round(e*1e5)/1e5,oO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function q_e(e){return e==null}const V_e=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,sO=(e,t)=>n=>!!(typeof n=="string"&&V_e.test(n)&&n.startsWith(e)||t&&!q_e(n)&&Object.prototype.hasOwnProperty.call(n,t)),G9=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,o,a,c]=r.match(oO);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:c!==void 0?parseFloat(c):1}},H_e=e=>yl(0,255,e),mE={...ap,transform:e=>Math.round(H_e(e))},Cu={test:sO("rgb","red"),parse:G9("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+mE.transform(e)+", "+mE.transform(t)+", "+mE.transform(n)+", "+tg(Wg.transform(r))+")"};function K_e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const GC={test:sO("#"),parse:K_e,transform:Cu.transform},Jy=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),nc=Jy("deg"),fa=Jy("%"),at=Jy("px"),W_e=Jy("vh"),G_e=Jy("vw"),mz={...fa,parse:e=>fa.parse(e)/100,transform:e=>fa.transform(e*100)},Lf={test:sO("hsl","hue"),parse:G9("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+fa.transform(tg(t))+", "+fa.transform(tg(n))+", "+tg(Wg.transform(r))+")"},Mr={test:e=>Cu.test(e)||GC.test(e)||Lf.test(e),parse:e=>Cu.test(e)?Cu.parse(e):Lf.test(e)?Lf.parse(e):GC.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Cu.transform(e):Lf.transform(e),getAnimatableNone:e=>{const t=Mr.parse(e);return t.alpha=0,Mr.transform(t)}},Y_e=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Q_e(e){return isNaN(e)&&typeof e=="string"&&(e.match(oO)?.length||0)+(e.match(Y_e)?.length||0)>0}const Y9="number",Q9="color",X_e="var",J_e="var(",gz="${}",Z_e=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Gg(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const c=t.replace(Z_e,u=>(Mr.test(u)?(r.color.push(o),i.push(Q9),n.push(Mr.parse(u))):u.startsWith(J_e)?(r.var.push(o),i.push(X_e),n.push(u)):(r.number.push(o),i.push(Y9),n.push(parseFloat(u))),++o,gz)).split(gz);return{values:n,split:c,indexes:r,types:i}}function X9(e){return Gg(e).values}function J9(e){const{split:t,types:n}=Gg(e),r=t.length;return i=>{let o="";for(let a=0;a<r;a++)if(o+=t[a],i[a]!==void 0){const c=n[a];c===Y9?o+=tg(i[a]):c===Q9?o+=Mr.transform(i[a]):o+=i[a]}return o}}const e1e=e=>typeof e=="number"?0:Mr.test(e)?Mr.getAnimatableNone(e):e;function t1e(e){const t=X9(e);return J9(e)(t.map(e1e))}const Cc={test:Q_e,parse:X9,createTransformer:J9,getAnimatableNone:t1e};function gE(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function n1e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const c=n<.5?n*(1+t):n+t-n*t,u=2*n-c;i=gE(u,c,e+1/3),o=gE(u,c,e),a=gE(u,c,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}function K0(e,t){return n=>n>0?t:e}const Yn=(e,t,n)=>e+(t-e)*n,yE=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},r1e=[GC,Cu,Lf],i1e=e=>r1e.find(t=>t.test(e));function yz(e){const t=i1e(e);if(!t)return!1;let n=t.parse(e);return t===Lf&&(n=n1e(n)),n}const bz=(e,t)=>{const n=yz(e),r=yz(t);if(!n||!r)return K0(e,t);const i={...n};return o=>(i.red=yE(n.red,r.red,o),i.green=yE(n.green,r.green,o),i.blue=yE(n.blue,r.blue,o),i.alpha=Yn(n.alpha,r.alpha,o),Cu.transform(i))},YC=new Set(["none","hidden"]);function o1e(e,t){return YC.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function s1e(e,t){return n=>Yn(e,t,n)}function aO(e){return typeof e=="number"?s1e:typeof e=="string"?iO(e)?K0:Mr.test(e)?bz:c1e:Array.isArray(e)?Z9:typeof e=="object"?Mr.test(e)?bz:a1e:K0}function Z9(e,t){const n=[...e],r=n.length,i=e.map((o,a)=>aO(o)(o,t[a]));return o=>{for(let a=0;a<r;a++)n[a]=i[a](o);return n}}function a1e(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=aO(e[i])(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}}function l1e(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],a=e.indexes[o][r[o]],c=e.values[a]??0;n[i]=c,r[o]++}return n}const c1e=(e,t)=>{const n=Cc.createTransformer(t),r=Gg(e),i=Gg(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?YC.has(e)&&!i.values.length||YC.has(t)&&!r.values.length?o1e(e,t):Qy(Z9(l1e(r,i),i.values),n):K0(e,t)};function e8(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Yn(e,t,n):aO(e)(e,t)}const u1e=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Wn.update(t,n),stop:()=>Tc(t),now:()=>ai.isProcessing?ai.timestamp:to.now()}},t8=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let o=0;o<i;o++)r+=Math.round(e(o/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},W0=2e4;function lO(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<W0;)t+=n,r=e.next(t);return t>=W0?1/0:t}function d1e(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(lO(r),W0);return{type:"keyframes",ease:o=>r.next(i*o).value/t,duration:ss(i)}}const f1e=5;function n8(e,t,n){const r=Math.max(t-f1e,0);return P9(n-e(r),t-r)}const rr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},bE=.001;function h1e({duration:e=rr.duration,bounce:t=rr.bounce,velocity:n=rr.velocity,mass:r=rr.mass}){let i,o,a=1-t;a=yl(rr.minDamping,rr.maxDamping,a),e=yl(rr.minDuration,rr.maxDuration,ss(e)),a<1?(i=d=>{const h=d*a,p=h*e,y=h-n,g=QC(d,a),v=Math.exp(-p);return bE-y/g*v},o=d=>{const p=d*a*e,y=p*n+n,g=Math.pow(a,2)*Math.pow(d,2)*e,v=Math.exp(-p),S=QC(Math.pow(d,2),a);return(-i(d)+bE>0?-1:1)*((y-g)*v)/S}):(i=d=>{const h=Math.exp(-d*e),p=(d-n)*e+1;return-bE+h*p},o=d=>{const h=Math.exp(-d*e),p=(n-d)*(e*e);return h*p});const c=5/e,u=m1e(i,o,c);if(e=da(e),isNaN(u))return{stiffness:rr.stiffness,damping:rr.damping,duration:e};{const d=Math.pow(u,2)*r;return{stiffness:d,damping:a*2*Math.sqrt(r*d),duration:e}}}const p1e=12;function m1e(e,t,n){let r=n;for(let i=1;i<p1e;i++)r=r-e(r)/t(r);return r}function QC(e,t){return e*Math.sqrt(1-t*t)}const g1e=["duration","bounce"],y1e=["stiffness","damping","mass"];function vz(e,t){return t.some(n=>e[n]!==void 0)}function b1e(e){let t={velocity:rr.velocity,stiffness:rr.stiffness,damping:rr.damping,mass:rr.mass,isResolvedFromDuration:!1,...e};if(!vz(e,y1e)&&vz(e,g1e))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*yl(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:rr.mass,stiffness:i,damping:o}}else{const n=h1e(e);t={...t,...n,mass:rr.mass},t.isResolvedFromDuration=!0}return t}function G0(e=rr.visualDuration,t=rr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],c={done:!1,value:o},{stiffness:u,damping:d,mass:h,duration:p,velocity:y,isResolvedFromDuration:g}=b1e({...n,velocity:-ss(n.velocity||0)}),v=y||0,S=d/(2*Math.sqrt(u*h)),x=a-o,k=ss(Math.sqrt(u/h)),_=Math.abs(x)<5;r||(r=_?rr.restSpeed.granular:rr.restSpeed.default),i||(i=_?rr.restDelta.granular:rr.restDelta.default);let E;if(S<1){const D=QC(k,S);E=T=>{const C=Math.exp(-S*k*T);return a-C*((v+S*k*x)/D*Math.sin(D*T)+x*Math.cos(D*T))}}else if(S===1)E=D=>a-Math.exp(-k*D)*(x+(v+k*x)*D);else{const D=k*Math.sqrt(S*S-1);E=T=>{const C=Math.exp(-S*k*T),O=Math.min(D*T,300);return a-C*((v+S*k*x)*Math.sinh(O)+D*x*Math.cosh(O))/D}}const M={calculatedDuration:g&&p||null,next:D=>{const T=E(D);if(g)c.done=D>=p;else{let C=D===0?v:0;S<1&&(C=D===0?da(v):n8(E,D,T));const O=Math.abs(C)<=r,q=Math.abs(a-T)<=i;c.done=O&&q}return c.value=c.done?a:T,c},toString:()=>{const D=Math.min(lO(M),W0),T=t8(C=>M.next(D*C).value,D,30);return D+"ms "+T},toTransition:()=>{}};return M}G0.applyToOptions=e=>{const t=d1e(e,100,G0);return e.ease=t.ease,e.duration=da(t.duration),e.type="keyframes",e};function XC({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:c,max:u,restDelta:d=.5,restSpeed:h}){const p=e[0],y={done:!1,value:p},g=O=>c!==void 0&&O<c||u!==void 0&&O>u,v=O=>c===void 0?u:u===void 0||Math.abs(c-O)<Math.abs(u-O)?c:u;let S=n*t;const x=p+S,k=a===void 0?x:a(x);k!==x&&(S=k-p);const _=O=>-S*Math.exp(-O/r),E=O=>k+_(O),M=O=>{const q=_(O),I=E(O);y.done=Math.abs(q)<=d,y.value=y.done?k:I};let D,T;const C=O=>{g(y.value)&&(D=O,T=G0({keyframes:[y.value,v(y.value)],velocity:n8(E,O,y.value),damping:i,stiffness:o,restDelta:d,restSpeed:h}))};return C(0),{calculatedDuration:null,next:O=>{let q=!1;return!T&&D===void 0&&(q=!0,M(O),C(O)),D!==void 0&&O>=D?T.next(O-D):(!q&&M(O),y)}}}function v1e(e,t,n){const r=[],i=n||bl.mix||e8,o=e.length-1;for(let a=0;a<o;a++){let c=i(e[a],e[a+1]);if(t){const u=Array.isArray(t)?t[a]||ls:t;c=Qy(u,c)}r.push(c)}return r}function S1e(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const o=e.length;if(ZA(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=v1e(t,r,i),u=c.length,d=h=>{if(a&&h<e[0])return t[0];let p=0;if(u>1)for(;p<e.length-2&&!(h<e[p+1]);p++);const y=Kg(e[p],e[p+1],h);return c[p](y)};return n?h=>d(yl(e[0],e[o-1],h)):d}function x1e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Kg(0,t,r);e.push(Yn(n,1,i))}}function w1e(e){const t=[0];return x1e(t,e.length-1),t}function k1e(e,t){return e.map(n=>n*t)}function _1e(e,t){return e.map(()=>t||q9).splice(0,e.length-1)}function ng({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=N_e(r)?r.map(pz):pz(r),o={done:!1,value:t[0]},a=k1e(n&&n.length===t.length?n:w1e(t),e),c=S1e(a,t,{ease:Array.isArray(i)?i:_1e(t,i)});return{calculatedDuration:e,next:u=>(o.value=c(u),o.done=u>=e,o)}}const E1e=e=>e!==null;function cO(e,{repeat:t,repeatType:n="loop"},r,i=1){const o=e.filter(E1e),c=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!c||r===void 0?o[c]:r}const T1e={decay:XC,inertia:XC,tween:ng,keyframes:ng,spring:G0};function r8(e){typeof e.type=="string"&&(e.type=T1e[e.type])}class uO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const C1e=e=>e/100;class dO extends uO{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==to.now()&&this.tick(to.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;r8(t);const{type:n=ng,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:a=0}=t;let{keyframes:c}=t;const u=n||ng;u!==ng&&typeof c[0]!="number"&&(this.mixKeyframes=Qy(C1e,e8(c[0],c[1])),c=[0,100]);const d=u({...t,keyframes:c});o==="mirror"&&(this.mirroredGenerator=u({...t,keyframes:[...c].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=lO(d));const{calculatedDuration:h}=d;this.calculatedDuration=h,this.resolvedDuration=h+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:a,resolvedDuration:c,calculatedDuration:u}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:h,repeat:p,repeatType:y,repeatDelay:g,type:v,onUpdate:S,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const k=this.currentTime-d*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?k<0:k>i;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let E=this.currentTime,M=r;if(p){const O=Math.min(this.currentTime,i)/c;let q=Math.floor(O),I=O%1;!I&&O>=1&&(I=1),I===1&&q--,q=Math.min(q,p+1),!!(q%2)&&(y==="reverse"?(I=1-I,g&&(I-=g/c)):y==="mirror"&&(M=a)),E=yl(0,1,I)*c}const D=_?{done:!1,value:h[0]}:M.next(E);o&&(D.value=o(D.value));let{done:T}=D;!_&&u!==null&&(T=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return C&&v!==XC&&(D.value=cO(h,this.options,x,this.speed)),S&&S(D.value),C&&this.finish(),D}then(t,n){return this.finished.then(t,n)}get duration(){return ss(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+ss(t)}get time(){return ss(this.currentTime)}set time(t){t=da(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(to.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=ss(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=u1e,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(to.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function I1e(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Iu=e=>e*180/Math.PI,JC=e=>{const t=Iu(Math.atan2(e[1],e[0]));return ZC(t)},M1e={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JC,rotateZ:JC,skewX:e=>Iu(Math.atan(e[1])),skewY:e=>Iu(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ZC=e=>(e=e%360,e<0&&(e+=360),e),Sz=JC,xz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),wz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),R1e={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:xz,scaleY:wz,scale:e=>(xz(e)+wz(e))/2,rotateX:e=>ZC(Iu(Math.atan2(e[6],e[5]))),rotateY:e=>ZC(Iu(Math.atan2(-e[2],e[0]))),rotateZ:Sz,rotate:Sz,skewX:e=>Iu(Math.atan(e[4])),skewY:e=>Iu(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eI(e){return e.includes("scale")?1:0}function tI(e,t){if(!e||e==="none")return eI(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=R1e,i=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=M1e,i=c}if(!i)return eI(t);const o=r[t],a=i[1].split(",").map(O1e);return typeof o=="function"?o(a):a[o]}const A1e=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return tI(n,t)};function O1e(e){return parseFloat(e.trim())}const lp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],cp=new Set(lp),kz=e=>e===ap||e===at,D1e=new Set(["x","y","z"]),P1e=lp.filter(e=>!D1e.has(e));function N1e(e){const t=[];return P1e.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const zu={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>tI(t,"x"),y:(e,{transform:t})=>tI(t,"y")};zu.translateX=zu.x;zu.translateY=zu.y;const Bu=new Set;let nI=!1,rI=!1,iI=!1;function i8(){if(rI){const e=Array.from(Bu).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=N1e(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,a])=>{r.getValue(o)?.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rI=!1,nI=!1,Bu.forEach(e=>e.complete(iI)),Bu.clear()}function o8(){Bu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rI=!0)})}function L1e(){iI=!0,o8(),i8(),iI=!1}class fO{constructor(t,n,r,i,o,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(Bu.add(this),nI||(nI=!0,Wn.read(o8),Wn.resolveKeyframes(i8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const o=i?.get(),a=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,a);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=a),i&&o===void 0&&i.set(t[0])}I1e(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Bu.delete(this)}cancel(){this.state==="scheduled"&&(Bu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const $1e=e=>e.startsWith("--");function j1e(e,t,n){$1e(t)?e.style.setProperty(t,n):e.style[t]=n}const F1e=eO(()=>window.ScrollTimeline!==void 0),z1e={};function B1e(e,t){const n=eO(e);return()=>z1e[t]??n()}const s8=B1e(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Fm=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,_z={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Fm([0,.65,.55,1]),circOut:Fm([.55,0,1,.45]),backIn:Fm([.31,.01,.66,-.59]),backOut:Fm([.33,1.53,.69,.99])};function a8(e,t){if(e)return typeof e=="function"?s8()?t8(e,t):"ease-out":V9(e)?Fm(e):Array.isArray(e)?e.map(n=>a8(n,t)||_z.easeOut):_z[e]}function U1e(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:a="loop",ease:c="easeOut",times:u}={},d=void 0){const h={[t]:n};u&&(h.offset=u);const p=a8(c,i);Array.isArray(p)&&(h.easing=p);const y={delay:r,duration:i,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"};return d&&(y.pseudoElement=d),e.animate(h,y)}function l8(e){return typeof e=="function"&&"applyToOptions"in e}function q1e({type:e,...t}){return l8(e)&&s8()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class V1e extends uO{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:c,onComplete:u}=t;this.isPseudoElement=!!o,this.allowFlatten=a,this.options=t,ZA(typeof t.type!="string");const d=q1e(t);this.animation=U1e(n,r,i,d,o),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const h=cO(i,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(h):j1e(n,r,h),this.animation.cancel()}u?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return ss(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+ss(t)}get time(){return ss(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=da(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&F1e()?(this.animation.timeline=t,ls):n(this)}}const c8={anticipate:z9,backInOut:F9,circInOut:U9};function H1e(e){return e in c8}function K1e(e){typeof e.ease=="string"&&H1e(e.ease)&&(e.ease=c8[e.ease])}const Ez=10;class W1e extends V1e{constructor(t){K1e(t),r8(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...a}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const c=new dO({...a,autoplay:!1}),u=da(this.finishedTime??this.time);n.setWithVelocity(c.sample(u-Ez).value,c.sample(u).value,Ez),c.stop()}}const Tz=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Cc.test(e)||e==="0")&&!e.startsWith("url("));function G1e(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Y1e(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],a=Tz(i,t),c=Tz(o,t);return!a||!c?!1:G1e(e)||(n==="spring"||l8(n))&&r}function oI(e){e.duration=0,e.type="keyframes"}const Q1e=new Set(["opacity","clipPath","filter","transform"]),X1e=eO(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function J1e(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return X1e()&&n&&Q1e.has(n)&&(n!=="transform"||!d)&&!u&&!r&&i!=="mirror"&&o!==0&&a!=="inertia"}const Z1e=40;class eEe extends uO{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:a="loop",keyframes:c,name:u,motionValue:d,element:h,...p}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=to.now();const y={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:a,name:u,motionValue:d,element:h,...p},g=h?.KeyframeResolver||fO;this.keyframeResolver=new g(c,(v,S,x)=>this.onKeyframesResolved(v,S,y,!x),u,d,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,i){this.keyframeResolver=void 0;const{name:o,type:a,velocity:c,delay:u,isHandoff:d,onUpdate:h}=r;this.resolvedAt=to.now(),Y1e(t,o,a,c)||((bl.instantAnimations||!u)&&h?.(cO(t,r,n)),t[0]=t[t.length-1],oI(r),r.repeat=0);const y={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>Z1e?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},g=!d&&J1e(y)?new W1e({...y,element:y.motionValue.owner.current}):new dO(y);g.finished.then(()=>this.notifyFinished()).catch(ls),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),L1e()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const tEe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nEe(e){const t=tEe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function u8(e,t,n=1){const[r,i]=nEe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return A9(a)?parseFloat(a):a}return iO(i)?u8(i,t,n+1):i}function hO(e,t){return e?.[t]??e?.default??e}const d8=new Set(["width","height","top","left","right","bottom",...lp]),rEe={test:e=>e==="auto",parse:e=>e},f8=e=>t=>t.test(e),h8=[ap,at,fa,nc,G_e,W_e,rEe],Cz=e=>h8.find(f8(e));function iEe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||D9(e):!0}const oEe=new Set(["brightness","contrast","saturate","opacity"]);function sEe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(oO)||[];if(!r)return e;const i=n.replace(r,"");let o=oEe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const aEe=/\b([a-z-]*)\(.*?\)/gu,sI={...Cc,getAnimatableNone:e=>{const t=e.match(aEe);return t?t.map(sEe).join(" "):e}},Iz={...ap,transform:Math.round},lEe={rotate:nc,rotateX:nc,rotateY:nc,rotateZ:nc,scale:Hv,scaleX:Hv,scaleY:Hv,scaleZ:Hv,skew:nc,skewX:nc,skewY:nc,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:Wg,originX:mz,originY:mz,originZ:at},pO={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,backgroundPositionX:at,backgroundPositionY:at,...lEe,zIndex:Iz,fillOpacity:Wg,strokeOpacity:Wg,numOctaves:Iz},cEe={...pO,color:Mr,backgroundColor:Mr,outlineColor:Mr,fill:Mr,stroke:Mr,borderColor:Mr,borderTopColor:Mr,borderRightColor:Mr,borderBottomColor:Mr,borderLeftColor:Mr,filter:sI,WebkitFilter:sI},p8=e=>cEe[e];function m8(e,t){let n=p8(e);return n!==sI&&(n=Cc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const uEe=new Set(["auto","none","0"]);function dEe(e,t,n){let r=0,i;for(;r<e.length&&!i;){const o=e[r];typeof o=="string"&&!uEe.has(o)&&Gg(o).values.length&&(i=e[r]),r++}if(i&&n)for(const o of t)e[o]=m8(n,i)}class fEe extends fO{constructor(t,n,r,i,o){super(t,n,r,i,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let d=t[u];if(typeof d=="string"&&(d=d.trim(),iO(d))){const h=u8(d,n.current);h!==void 0&&(t[u]=h),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!d8.has(r)||t.length!==2)return;const[i,o]=t,a=Cz(i),c=Cz(o);if(a!==c)if(kz(a)&&kz(c))for(let u=0;u<t.length;u++){const d=t[u];typeof d=="string"&&(t[u]=parseFloat(d))}else zu[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||iEe(t[i]))&&r.push(i);r.length&&dEe(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=zu[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,a=r[o];r[o]=zu[n](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,u])=>{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function hEe(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const g8=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function y8(e){return O9(e)&&"offsetHeight"in e}const Mz=30,pEe=e=>!isNaN(parseFloat(e));class mEe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=to.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=to.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=pEe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new tO);const r=this.events[t].add(n);return t==="change"?()=>{r(),Wn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Mz)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Mz);return P9(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ah(e,t){return new mEe(e,t)}const{schedule:mO}=H9(queueMicrotask,!1),Ss={x:!1,y:!1};function b8(){return Ss.x||Ss.y}function gEe(e){return e==="x"||e==="y"?Ss[e]?null:(Ss[e]=!0,()=>{Ss[e]=!1}):Ss.x||Ss.y?null:(Ss.x=Ss.y=!0,()=>{Ss.x=Ss.y=!1})}function v8(e,t){const n=hEe(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Rz(e){return!(e.pointerType==="touch"||b8())}function yEe(e,t,n={}){const[r,i,o]=v8(e,n),a=c=>{if(!Rz(c))return;const{target:u}=c,d=t(u,c);if(typeof d!="function"||!u)return;const h=p=>{Rz(p)&&(d(p),u.removeEventListener("pointerleave",h))};u.addEventListener("pointerleave",h,i)};return r.forEach(c=>{c.addEventListener("pointerenter",a,i)}),o}const S8=(e,t)=>t?e===t?!0:S8(e,t.parentElement):!1,gO=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,bEe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function vEe(e){return bEe.has(e.tagName)||e.tabIndex!==-1}const $S=new WeakSet;function Az(e){return t=>{t.key==="Enter"&&e(t)}}function vE(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const SEe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Az(()=>{if($S.has(n))return;vE(n,"down");const i=Az(()=>{vE(n,"up")}),o=()=>vE(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Oz(e){return gO(e)&&!b8()}function xEe(e,t,n={}){const[r,i,o]=v8(e,n),a=c=>{const u=c.currentTarget;if(!Oz(c))return;$S.add(u);const d=t(u,c),h=(g,v)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",y),$S.has(u)&&$S.delete(u),Oz(g)&&typeof d=="function"&&d(g,{success:v})},p=g=>{h(g,u===window||u===document||n.useGlobalTarget||S8(u,g.target))},y=g=>{h(g,!1)};window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",y,i)};return r.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",a,i),y8(c)&&(c.addEventListener("focus",d=>SEe(d,i)),!vEe(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),o}function x8(e){return O9(e)&&"ownerSVGElement"in e}function wEe(e){return x8(e)&&e.tagName==="svg"}const ki=e=>!!(e&&e.getVelocity),kEe=[...h8,Mr,Cc],_Ee=e=>kEe.find(f8(e)),yO=A.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Dz(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function EEe(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Dz(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Dz(e[i],null)}}}}function TEe(...e){return A.useCallback(EEe(...e),e)}class CEe extends A.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,i=y8(r)&&r.offsetWidth||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left}return null}componentDidUpdate(){}render(){return this.props.children}}function IEe({children:e,isPresent:t,anchorX:n,root:r}){const i=A.useId(),o=A.useRef(null),a=A.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:c}=A.useContext(yO),u=TEe(o,e?.ref);return A.useInsertionEffect(()=>{const{width:d,height:h,top:p,left:y,right:g}=a.current;if(t||!o.current||!d||!h)return;const v=n==="left"?`left: ${y}`:`right: ${g}`;o.current.dataset.motionPopId=i;const S=document.createElement("style");c&&(S.nonce=c);const x=r??document.head;return x.appendChild(S),S.sheet&&S.sheet.insertRule(`
89
+ [data-motion-pop-id="${i}"] {
90
+ position: absolute !important;
91
+ width: ${d}px !important;
92
+ height: ${h}px !important;
93
+ ${v}px !important;
94
+ top: ${p}px !important;
95
+ }
96
+ `),()=>{x.contains(S)&&x.removeChild(S)}},[t]),N.jsx(CEe,{isPresent:t,childRef:o,sizeRef:a,children:A.cloneElement(e,{ref:u})})}const MEe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a,anchorX:c,root:u})=>{const d=YA(REe),h=A.useId();let p=!0,y=A.useMemo(()=>(p=!1,{id:h,initial:t,isPresent:n,custom:i,onExitComplete:g=>{d.set(g,!0);for(const v of d.values())if(!v)return;r&&r()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,r]);return o&&p&&(y={...y}),A.useMemo(()=>{d.forEach((g,v)=>d.set(v,!1))},[n]),A.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),a==="popLayout"&&(e=N.jsx(IEe,{isPresent:n,anchorX:c,root:u,children:e})),N.jsx(Dw.Provider,{value:y,children:e})};function REe(){return new Map}function w8(e=!0){const t=A.useContext(Dw);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=A.useId();A.useEffect(()=>{if(e)return i(o)},[e]);const a=A.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,a]:[!0]}const Kv=e=>e.key||"";function Pz(e){const t=[];return A.Children.forEach(e,n=>{A.isValidElement(n)&&t.push(n)}),t}const AEe=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o="sync",propagate:a=!1,anchorX:c="left",root:u})=>{const[d,h]=w8(a),p=A.useMemo(()=>Pz(e),[e]),y=a&&!d?[]:p.map(Kv),g=A.useRef(!0),v=A.useRef(p),S=YA(()=>new Map),[x,k]=A.useState(p),[_,E]=A.useState(p);R9(()=>{g.current=!1,v.current=p;for(let T=0;T<_.length;T++){const C=Kv(_[T]);y.includes(C)?S.delete(C):S.get(C)!==!0&&S.set(C,!1)}},[_,y.length,y.join("-")]);const M=[];if(p!==x){let T=[...p];for(let C=0;C<_.length;C++){const O=_[C],q=Kv(O);y.includes(q)||(T.splice(C,0,O),M.push(O))}return o==="wait"&&M.length&&(T=M),E(Pz(T)),k(p),null}const{forceRender:D}=A.useContext(GA);return N.jsx(N.Fragment,{children:_.map(T=>{const C=Kv(T),O=a&&!d?!1:p===_||y.includes(C),q=()=>{if(S.has(C))S.set(C,!0);else return;let I=!0;S.forEach(L=>{L||(I=!1)}),I&&(D?.(),E(v.current),a&&h?.(),r&&r())};return N.jsx(MEe,{isPresent:O,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:u,onExitComplete:O?void 0:q,anchorX:c,children:T},C)})})},k8=A.createContext({strict:!1}),Nz={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Oh={};for(const e in Nz)Oh[e]={isEnabled:t=>Nz[e].some(n=>!!t[n])};function OEe(e){for(const t in e)Oh[t]={...Oh[t],...e[t]}}const DEe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Y0(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||DEe.has(e)}let _8=e=>!Y0(e);function PEe(e){typeof e=="function"&&(_8=t=>t.startsWith("on")?!Y0(t):e(t))}try{PEe(require("@emotion/is-prop-valid").default)}catch{}function NEe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(_8(i)||n===!0&&Y0(i)||!t&&!Y0(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const Pw=A.createContext({});function Nw(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Yg(e){return typeof e=="string"||Array.isArray(e)}const bO=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],vO=["initial",...bO];function Lw(e){return Nw(e.animate)||vO.some(t=>Yg(e[t]))}function E8(e){return!!(Lw(e)||e.variants)}function LEe(e,t){if(Lw(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Yg(n)?n:void 0,animate:Yg(r)?r:void 0}}return e.inherit!==!1?t:{}}function $Ee(e){const{initial:t,animate:n}=LEe(e,A.useContext(Pw));return A.useMemo(()=>({initial:t,animate:n}),[Lz(t),Lz(n)])}function Lz(e){return Array.isArray(e)?e.join(" "):e}function $z(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ym={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=$z(e,t.target.x),r=$z(e,t.target.y);return`${n}% ${r}%`}},jEe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Cc.parse(e);if(i.length>5)return r;const o=Cc.createTransformer(e),a=typeof i[0]!="number"?1:0,c=n.x.scale*t.x,u=n.y.scale*t.y;i[0+a]/=c,i[1+a]/=u;const d=Yn(c,u,.5);return typeof i[2+a]=="number"&&(i[2+a]/=d),typeof i[3+a]=="number"&&(i[3+a]/=d),o(i)}},aI={borderRadius:{...ym,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ym,borderTopRightRadius:ym,borderBottomLeftRadius:ym,borderBottomRightRadius:ym,boxShadow:jEe};function T8(e,{layout:t,layoutId:n}){return cp.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!aI[e]||e==="opacity")}const FEe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},zEe=lp.length;function BEe(e,t,n){let r="",i=!0;for(let o=0;o<zEe;o++){const a=lp[o],c=e[a];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(a.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||n){const d=g8(c,pO[a]);if(!u){i=!1;const h=FEe[a]||a;r+=`${h}(${d}) `}n&&(t[a]=d)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function SO(e,t,n){const{style:r,vars:i,transformOrigin:o}=e;let a=!1,c=!1;for(const u in t){const d=t[u];if(cp.has(u)){a=!0;continue}else if(W9(u)){i[u]=d;continue}else{const h=g8(d,pO[u]);u.startsWith("origin")?(c=!0,o[u]=h):r[u]=h}}if(t.transform||(a||n?r.transform=BEe(t,e.transform,n):r.transform&&(r.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:h=0}=o;r.transformOrigin=`${u} ${d} ${h}`}}const xO=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function C8(e,t,n){for(const r in t)!ki(t[r])&&!T8(r,n)&&(e[r]=t[r])}function UEe({transformTemplate:e},t){return A.useMemo(()=>{const n=xO();return SO(n,t,e),Object.assign({},n.vars,n.style)},[t])}function qEe(e,t){const n=e.style||{},r={};return C8(r,n,e),Object.assign(r,UEe(e,t)),r}function VEe(e,t){const n={},r=qEe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const HEe={offset:"stroke-dashoffset",array:"stroke-dasharray"},KEe={offset:"strokeDashoffset",array:"strokeDasharray"};function WEe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?HEe:KEe;e[o.offset]=at.transform(-r);const a=at.transform(t),c=at.transform(n);e[o.array]=`${a} ${c}`}function I8(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:a=0,...c},u,d,h){if(SO(e,c,d),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:y}=e;p.transform&&(y.transform=p.transform,delete p.transform),(y.transform||p.transformOrigin)&&(y.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),y.transform&&(y.transformBox=h?.transformBox??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),i!==void 0&&WEe(p,i,o,a,!1)}const M8=()=>({...xO(),attrs:{}}),R8=e=>typeof e=="string"&&e.toLowerCase()==="svg";function GEe(e,t,n,r){const i=A.useMemo(()=>{const o=M8();return I8(o,t,R8(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};C8(o,e.style,e),i.style={...o,...i.style}}return i}const YEe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function wO(e){return typeof e!="string"||e.includes("-")?!1:!!(YEe.indexOf(e)>-1||/[A-Z]/u.test(e))}function QEe(e,t,n,{latestValues:r},i,o=!1){const c=(wO(e)?GEe:VEe)(t,r,i,e),u=NEe(t,typeof e=="string",o),d=e!==A.Fragment?{...u,...c,ref:n}:{},{children:h}=t,p=A.useMemo(()=>ki(h)?h.get():h,[h]);return A.createElement(e,{...d,children:p})}function jz(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function kO(e,t,n,r){if(typeof t=="function"){const[i,o]=jz(r);t=t(n!==void 0?n:e.custom,i,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,o]=jz(r);t=t(n!==void 0?n:e.custom,i,o)}return t}function jS(e){return ki(e)?e.get():e}function XEe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:JEe(n,r,i,e),renderState:t()}}function JEe(e,t,n,r){const i={},o=r(e,{});for(const y in o)i[y]=jS(o[y]);let{initial:a,animate:c}=e;const u=Lw(e),d=E8(e);t&&d&&!u&&e.inherit!==!1&&(a===void 0&&(a=t.initial),c===void 0&&(c=t.animate));let h=n?n.initial===!1:!1;h=h||a===!1;const p=h?c:a;if(p&&typeof p!="boolean"&&!Nw(p)){const y=Array.isArray(p)?p:[p];for(let g=0;g<y.length;g++){const v=kO(e,y[g]);if(v){const{transitionEnd:S,transition:x,...k}=v;for(const _ in k){let E=k[_];if(Array.isArray(E)){const M=h?E.length-1:0;E=E[M]}E!==null&&(i[_]=E)}for(const _ in S)i[_]=S[_]}}}return i}const A8=e=>(t,n)=>{const r=A.useContext(Pw),i=A.useContext(Dw),o=()=>XEe(e,t,r,i);return n?o():YA(o)};function _O(e,t,n){const{style:r}=e,i={};for(const o in r)(ki(r[o])||t.style&&ki(t.style[o])||T8(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(i[o]=r[o]);return i}const ZEe=A8({scrapeMotionValuesFromProps:_O,createRenderState:xO});function O8(e,t,n){const r=_O(e,t,n);for(const i in e)if(ki(e[i])||ki(t[i])){const o=lp.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[o]=e[i]}return r}const eTe=A8({scrapeMotionValuesFromProps:O8,createRenderState:M8}),tTe=Symbol.for("motionComponentSymbol");function $f(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function nTe(e,t,n){return A.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):$f(n)&&(n.current=r))},[t])}const EO=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),rTe="framerAppearId",D8="data-"+EO(rTe),P8=A.createContext({});function iTe(e,t,n,r,i){const{visualElement:o}=A.useContext(Pw),a=A.useContext(k8),c=A.useContext(Dw),u=A.useContext(yO).reducedMotion,d=A.useRef(null);r=r||a.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u}));const h=d.current,p=A.useContext(P8);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&oTe(d.current,n,i,p);const y=A.useRef(!1);A.useInsertionEffect(()=>{h&&y.current&&h.update(n,c)});const g=n[D8],v=A.useRef(!!g&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return R9(()=>{h&&(y.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),v.current&&h.animationState&&h.animationState.animateChanges())}),A.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),v.current=!1),h.enteringChildren=void 0)}),h}function oTe(e,t,n,r){const{layoutId:i,layout:o,drag:a,dragConstraints:c,layoutScroll:u,layoutRoot:d,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:N8(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!a||c&&$f(c),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:u,layoutRoot:d})}function N8(e){if(e)return e.options.allowProjection!==!1?e.projection:N8(e.parent)}function SE(e,{forwardMotionProps:t=!1}={},n,r){n&&OEe(n);const i=wO(e)?eTe:ZEe;function o(c,u){let d;const h={...A.useContext(yO),...c,layoutId:sTe(c)},{isStatic:p}=h,y=$Ee(c),g=i(c,p);if(!p&&QA){aTe();const v=lTe(h);d=v.MeasureLayout,y.visualElement=iTe(e,g,h,r,v.ProjectionNode)}return N.jsxs(Pw.Provider,{value:y,children:[d&&y.visualElement?N.jsx(d,{visualElement:y.visualElement,...h}):null,QEe(e,c,nTe(g,y.visualElement,u),g,p,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const a=A.forwardRef(o);return a[tTe]=e,a}function sTe({layoutId:e}){const t=A.useContext(GA).id;return t&&e!==void 0?t+"-"+e:e}function aTe(e,t){A.useContext(k8).strict}function lTe(e){const{drag:t,layout:n}=Oh;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function cTe(e,t){if(typeof Proxy>"u")return SE;const n=new Map,r=(o,a)=>SE(o,a,e,t),i=(o,a)=>r(o,a);return new Proxy(i,{get:(o,a)=>a==="create"?r:(n.has(a)||n.set(a,SE(a,void 0,e,t)),n.get(a))})}function L8({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function uTe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function dTe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function xE(e){return e===void 0||e===1}function lI({scale:e,scaleX:t,scaleY:n}){return!xE(e)||!xE(t)||!xE(n)}function vu(e){return lI(e)||$8(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function $8(e){return Fz(e.x)||Fz(e.y)}function Fz(e){return e&&e!=="0%"}function Q0(e,t,n){const r=e-n,i=t*r;return n+i}function zz(e,t,n,r,i){return i!==void 0&&(e=Q0(e,i,r)),Q0(e,n,r)+t}function cI(e,t=0,n=1,r,i){e.min=zz(e.min,t,n,r,i),e.max=zz(e.max,t,n,r,i)}function j8(e,{x:t,y:n}){cI(e.x,t.translate,t.scale,t.originPoint),cI(e.y,n.translate,n.scale,n.originPoint)}const Bz=.999999999999,Uz=1.0000000000001;function fTe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let c=0;c<i;c++){o=n[c],a=o.projectionDelta;const{visualElement:u}=o.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Ff(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,j8(e,a)),r&&vu(o.latestValues)&&Ff(e,o.latestValues))}t.x<Uz&&t.x>Bz&&(t.x=1),t.y<Uz&&t.y>Bz&&(t.y=1)}function jf(e,t){e.min=e.min+t,e.max=e.max+t}function qz(e,t,n,r,i=.5){const o=Yn(e.min,e.max,i);cI(e,t,n,o,r)}function Ff(e,t){qz(e.x,t.x,t.scaleX,t.scale,t.originX),qz(e.y,t.y,t.scaleY,t.scale,t.originY)}function F8(e,t){return L8(dTe(e.getBoundingClientRect(),t))}function hTe(e,t,n){const r=F8(e,n),{scroll:i}=t;return i&&(jf(r.x,i.offset.x),jf(r.y,i.offset.y)),r}const Vz=()=>({translate:0,scale:1,origin:0,originPoint:0}),zf=()=>({x:Vz(),y:Vz()}),Hz=()=>({min:0,max:0}),Fr=()=>({x:Hz(),y:Hz()}),uI={current:null},z8={current:!1};function pTe(){if(z8.current=!0,!!QA)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>uI.current=e.matches;e.addEventListener("change",t),t()}else uI.current=!1}const mTe=new WeakMap;function gTe(e,t,n){for(const r in t){const i=t[r],o=n[r];if(ki(i))e.addValue(r,i);else if(ki(o))e.addValue(r,Ah(i,{owner:e}));else if(o!==i)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(r);e.addValue(r,Ah(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Kz=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class yTe{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:o,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fO,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,Wn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=Lw(n),this.isVariantNode=E8(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const y in p){const g=p[y];u[y]!==void 0&&ki(g)&&g.set(u[y])}}mount(t){this.current=t,mTe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),z8.current||pTe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:uI.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Tc(this.notifyUpdate),Tc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=cp.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Wn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Oh){const n=Oh[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Fr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Kz.length;r++){const i=Kz[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const o="on"+i,a=t[o];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=gTe(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ah(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(A9(r)||D9(r))?r=parseFloat(r):!_Ee(r)&&Cc.test(n)&&(r=m8(t,n)),this.setBaseTarget(t,ki(r)?r.get():r)),ki(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=kO(this.props,n,this.presenceContext?.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ki(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new tO),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){mO.render(this.render)}}class B8 extends yTe{constructor(){super(...arguments),this.KeyframeResolver=fEe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ki(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function U8(e,{style:t,vars:n},r,i){const o=e.style;let a;for(a in t)o[a]=t[a];i?.applyProjectionStyles(o,r);for(a in n)o.setProperty(a,n[a])}function bTe(e){return window.getComputedStyle(e)}class vTe extends B8{constructor(){super(...arguments),this.type="html",this.renderInstance=U8}readValueFromInstance(t,n){if(cp.has(n))return this.projection?.isProjecting?eI(n):A1e(t,n);{const r=bTe(t),i=(W9(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return F8(t,n)}build(t,n,r){SO(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return _O(t,n,r)}}const q8=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function STe(e,t,n,r){U8(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(q8.has(i)?i:EO(i),t.attrs[i])}class xTe extends B8{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Fr}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(cp.has(n)){const r=p8(n);return r&&r.default||0}return n=q8.has(n)?n:EO(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return O8(t,n,r)}build(t,n,r){I8(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){STe(t,n,r,i)}mount(t){this.isSVGTag=R8(t.tagName),super.mount(t)}}const wTe=(e,t)=>wO(e)?new xTe(t):new vTe(t,{allowProjection:e!==A.Fragment});function Jf(e,t,n){const r=e.getProps();return kO(r,t,n!==void 0?n:r.custom,e)}const dI=e=>Array.isArray(e);function kTe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ah(n))}function _Te(e){return dI(e)?e[e.length-1]||0:e}function ETe(e,t){const n=Jf(e,t);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const a in o){const c=_Te(o[a]);kTe(e,a,c)}}function TTe(e){return!!(ki(e)&&e.add)}function fI(e,t){const n=e.getValue("willChange");if(TTe(n))return n.add(t);if(!n&&bl.WillChange){const r=new bl.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function V8(e){return e.props[D8]}const CTe=e=>e!==null;function ITe(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(CTe),o=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[o]}const MTe={type:"spring",stiffness:500,damping:25,restSpeed:10},RTe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ATe={type:"keyframes",duration:.8},OTe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},DTe=(e,{keyframes:t})=>t.length>2?ATe:cp.has(e)?e.startsWith("scale")?RTe(t[1]):MTe:OTe;function PTe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:c,from:u,elapsed:d,...h}){return!!Object.keys(h).length}const TO=(e,t,n,r={},i,o)=>a=>{const c=hO(r,e)||{},u=c.delay||r.delay||0;let{elapsed:d=0}=r;d=d-da(u);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-d,onUpdate:y=>{t.set(y),c.onUpdate&&c.onUpdate(y)},onComplete:()=>{a(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:o?void 0:i};PTe(c)||Object.assign(h,DTe(e,h)),h.duration&&(h.duration=da(h.duration)),h.repeatDelay&&(h.repeatDelay=da(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let p=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(oI(h),h.delay===0&&(p=!0)),(bl.instantAnimations||bl.skipAnimations)&&(p=!0,oI(h),h.delay=0),h.allowFlatten=!c.type&&!c.ease,p&&!o&&t.get()!==void 0){const y=ITe(h.keyframes,c);if(y!==void 0){Wn.update(()=>{h.onUpdate(y),h.onComplete()});return}}return c.isSync?new dO(h):new eEe(h)};function NTe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function H8(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:a,...c}=t;r&&(o=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const h in c){const p=e.getValue(h,e.latestValues[h]??null),y=c[h];if(y===void 0||d&&NTe(d,h))continue;const g={delay:n,...hO(o||{},h)},v=p.get();if(v!==void 0&&!p.isAnimating&&!Array.isArray(y)&&y===v&&!g.velocity)continue;let S=!1;if(window.MotionHandoffAnimation){const k=V8(e);if(k){const _=window.MotionHandoffAnimation(k,h,Wn);_!==null&&(g.startTime=_,S=!0)}}fI(e,h),p.start(TO(h,p,y,e.shouldReduceMotion&&d8.has(h)?{type:!1}:g,e,S));const x=p.animation;x&&u.push(x)}return a&&Promise.all(u).then(()=>{Wn.update(()=>{a&&ETe(e,a)})}),u}function K8(e,t,n,r=0,i=1){const o=Array.from(e).sort((d,h)=>d.sortNodePosition(h)).indexOf(t),a=e.size,c=(a-1)*r;return typeof n=="function"?n(o,a):i===1?o*r:c-o*r}function hI(e,t,n={}){const r=Jf(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(H8(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=i;return LTe(e,t,u,d,h,p,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,a]:[a,o];return u().then(()=>d())}else return Promise.all([o(),a(n.delay)])}function LTe(e,t,n=0,r=0,i=0,o=1,a){const c=[];for(const u of e.variantChildren)u.notify("AnimationStart",t),c.push(hI(u,t,{...a,delay:n+(typeof r=="function"?0:r)+K8(e.variantChildren,u,r,i,o)}).then(()=>u.notify("AnimationComplete",t)));return Promise.all(c)}function $Te(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>hI(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=hI(e,t,n);else{const i=typeof t=="function"?Jf(e,t,n.custom):t;r=Promise.all(H8(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}function W8(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const jTe=vO.length;function G8(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?G8(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<jTe;n++){const r=vO[n],i=e.props[r];(Yg(i)||i===!1)&&(t[r]=i)}return t}const FTe=[...bO].reverse(),zTe=bO.length;function BTe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>$Te(e,n,r)))}function UTe(e){let t=BTe(e),n=Wz(),r=!0;const i=u=>(d,h)=>{const p=Jf(e,h,u==="exit"?e.presenceContext?.custom:void 0);if(p){const{transition:y,transitionEnd:g,...v}=p;d={...d,...v,...g}}return d};function o(u){t=u(e)}function a(u){const{props:d}=e,h=G8(e.parent)||{},p=[],y=new Set;let g={},v=1/0;for(let x=0;x<zTe;x++){const k=FTe[x],_=n[k],E=d[k]!==void 0?d[k]:h[k],M=Yg(E),D=k===u?_.isActive:null;D===!1&&(v=x);let T=E===h[k]&&E!==d[k]&&M;if(T&&r&&e.manuallyAnimateOnMount&&(T=!1),_.protectedKeys={...g},!_.isActive&&D===null||!E&&!_.prevProp||Nw(E)||typeof E=="boolean")continue;const C=qTe(_.prevProp,E);let O=C||k===u&&_.isActive&&!T&&M||x>v&&M,q=!1;const I=Array.isArray(E)?E:[E];let L=I.reduce(i(k),{});D===!1&&(L={});const{prevResolvedValues:P={}}=_,B={...P,...L},$=K=>{O=!0,y.has(K)&&(q=!0,y.delete(K)),_.needsAnimating[K]=!0;const G=e.getValue(K);G&&(G.liveStyle=!1)};for(const K in B){const G=L[K],J=P[K];if(g.hasOwnProperty(K))continue;let F=!1;dI(G)&&dI(J)?F=!W8(G,J):F=G!==J,F?G!=null?$(K):y.add(K):G!==void 0&&y.has(K)?$(K):_.protectedKeys[K]=!0}_.prevProp=E,_.prevResolvedValues=L,_.isActive&&(g={...g,...L}),r&&e.blockInitialAnimation&&(O=!1);const V=T&&C;O&&(!V||q)&&p.push(...I.map(K=>{const G={type:k};if(typeof K=="string"&&r&&!V&&e.manuallyAnimateOnMount&&e.parent){const{parent:J}=e,F=Jf(J,K);if(J.enteringChildren&&F){const{delayChildren:U}=F.transition||{};G.delay=K8(J.enteringChildren,e,U)}}return{animation:K,options:G}}))}if(y.size){const x={};if(typeof d.initial!="boolean"){const k=Jf(e,Array.isArray(d.initial)?d.initial[0]:d.initial);k&&k.transition&&(x.transition=k.transition)}y.forEach(k=>{const _=e.getBaseTarget(k),E=e.getValue(k);E&&(E.liveStyle=!0),x[k]=_??null}),p.push({animation:x})}let S=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(S=!1),r=!1,S?t(p):Promise.resolve()}function c(u,d){if(n[u].isActive===d)return Promise.resolve();e.variantChildren?.forEach(p=>p.animationState?.setActive(u,d)),n[u].isActive=d;const h=a(u);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:a,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Wz()}}}function qTe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!W8(t,e):!1}function pu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Wz(){return{animate:pu(!0),whileInView:pu(),whileHover:pu(),whileTap:pu(),whileDrag:pu(),whileFocus:pu(),exit:pu()}}class zc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class VTe extends zc{constructor(t){super(t),t.animationState||(t.animationState=UTe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Nw(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let HTe=0;class KTe extends zc{constructor(){super(...arguments),this.id=HTe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const WTe={animation:{Feature:VTe},exit:{Feature:KTe}};function Qg(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Zy(e){return{point:{x:e.pageX,y:e.pageY}}}const GTe=e=>t=>gO(t)&&e(t,Zy(t));function rg(e,t,n,r){return Qg(e,t,GTe(n),r)}const Y8=1e-4,YTe=1-Y8,QTe=1+Y8,Q8=.01,XTe=0-Q8,JTe=0+Q8;function zi(e){return e.max-e.min}function ZTe(e,t,n){return Math.abs(e-t)<=n}function Gz(e,t,n,r=.5){e.origin=r,e.originPoint=Yn(t.min,t.max,e.origin),e.scale=zi(n)/zi(t),e.translate=Yn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=YTe&&e.scale<=QTe||isNaN(e.scale))&&(e.scale=1),(e.translate>=XTe&&e.translate<=JTe||isNaN(e.translate))&&(e.translate=0)}function ig(e,t,n,r){Gz(e.x,t.x,n.x,r?r.originX:void 0),Gz(e.y,t.y,n.y,r?r.originY:void 0)}function Yz(e,t,n){e.min=n.min+t.min,e.max=e.min+zi(t)}function eCe(e,t,n){Yz(e.x,t.x,n.x),Yz(e.y,t.y,n.y)}function Qz(e,t,n){e.min=t.min-n.min,e.max=e.min+zi(t)}function X0(e,t,n){Qz(e.x,t.x,n.x),Qz(e.y,t.y,n.y)}function Go(e){return[e("x"),e("y")]}const X8=({current:e})=>e?e.ownerDocument.defaultView:null,Xz=(e,t)=>Math.abs(e-t);function tCe(e,t){const n=Xz(e.x,t.x),r=Xz(e.y,t.y);return Math.sqrt(n**2+r**2)}class J8{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:a=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=kE(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,v=tCe(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!v)return;const{point:S}=y,{timestamp:x}=ai;this.history.push({...S,timestamp:x});const{onStart:k,onMove:_}=this.handlers;g||(k&&k(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),_&&_(this.lastMoveEvent,y)},this.handlePointerMove=(y,g)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=wE(g,this.transformPagePoint),Wn.update(this.updatePoint,!0)},this.handlePointerUp=(y,g)=>{this.end();const{onEnd:v,onSessionEnd:S,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=kE(y.type==="pointercancel"?this.lastMoveEventInfo:wE(g,this.transformPagePoint),this.history);this.startEvent&&v&&v(y,k),S&&S(y,k)},!gO(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=i||window;const c=Zy(t),u=wE(c,this.transformPagePoint),{point:d}=u,{timestamp:h}=ai;this.history=[{...d,timestamp:h}];const{onSessionStart:p}=n;p&&p(t,kE(u,this.history)),this.removeListeners=Qy(rg(this.contextWindow,"pointermove",this.handlePointerMove),rg(this.contextWindow,"pointerup",this.handlePointerUp),rg(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Tc(this.updatePoint)}}function wE(e,t){return t?{point:t(e.point)}:e}function Jz(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kE({point:e},t){return{point:e,delta:Jz(e,Z8(t)),offset:Jz(e,nCe(t)),velocity:rCe(t,.1)}}function nCe(e){return e[0]}function Z8(e){return e[e.length-1]}function rCe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=Z8(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>da(t)));)n--;if(!r)return{x:0,y:0};const o=ss(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function iCe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Yn(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Yn(n,e,r.max):Math.min(e,n)),e}function Zz(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function oCe(e,{top:t,left:n,bottom:r,right:i}){return{x:Zz(e.x,n,i),y:Zz(e.y,t,r)}}function eB(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function sCe(e,t){return{x:eB(e.x,t.x),y:eB(e.y,t.y)}}function aCe(e,t){let n=.5;const r=zi(e),i=zi(t);return i>r?n=Kg(t.min,t.max-r,e.min):r>i&&(n=Kg(e.min,e.max-i,t.min)),yl(0,1,n)}function lCe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const pI=.35;function cCe(e=pI){return e===!1?e=0:e===!0&&(e=pI),{x:tB(e,"left","right"),y:tB(e,"top","bottom")}}function tB(e,t,n){return{min:nB(e,t),max:nB(e,n)}}function nB(e,t){return typeof e=="number"?e:e[t]||0}const uCe=new WeakMap;class dCe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Fr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=p=>{const{dragSnapToOrigin:y}=this.getProps();y?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Zy(p).point)},a=(p,y)=>{const{drag:g,dragPropagation:v,onDragStart:S}=this.getProps();if(g&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=gEe(g),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=y,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Go(k=>{let _=this.getAxisMotionValue(k).get()||0;if(fa.test(_)){const{projection:E}=this.visualElement;if(E&&E.layout){const M=E.layout.layoutBox[k];M&&(_=zi(M)*(parseFloat(_)/100))}}this.originPoint[k]=_}),S&&Wn.postRender(()=>S(p,y)),fI(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},c=(p,y)=>{this.latestPointerEvent=p,this.latestPanInfo=y;const{dragPropagation:g,dragDirectionLock:v,onDirectionLock:S,onDrag:x}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:k}=y;if(v&&this.currentDirection===null){this.currentDirection=fCe(k),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",y.point,k),this.updateAxis("y",y.point,k),this.visualElement.render(),x&&x(p,y)},u=(p,y)=>{this.latestPointerEvent=p,this.latestPanInfo=y,this.stop(p,y),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>Go(p=>this.getAnimationState(p)==="paused"&&this.getAxisMotionValue(p).animation?.play()),{dragSnapToOrigin:h}=this.getProps();this.panSession=new J8(t,{onSessionStart:o,onStart:a,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:r,contextWindow:X8(this.visualElement)})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!r)return;const{velocity:a}=i;this.startAnimation(a);const{onDragEnd:c}=this.getProps();c&&Wn.postRender(()=>c(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Wv(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=iCe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&$f(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=oCe(r.layoutBox,t):this.constraints=!1,this.elastic=cCe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Go(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=lCe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!$f(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=hTe(r,i.root,this.visualElement.getTransformPagePoint());let a=sCe(i.layout.layoutBox,o);if(n){const c=n(uTe(a));this.hasMutatedConstraints=!!c,c&&(a=L8(c))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=Go(h=>{if(!Wv(h,n,this.currentDirection))return;let p=u&&u[h]||{};a&&(p={min:0,max:0});const y=i?200:1e6,g=i?40:1e7,v={type:"inertia",velocity:r?t[h]:0,bounceStiffness:y,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...o,...p};return this.startAxisValueAnimation(h,v)});return Promise.all(d).then(c)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return fI(this.visualElement,t),r.start(TO(t,r,0,n,this.visualElement,!1))}stopAnimation(){Go(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Go(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Go(n=>{const{drag:r}=this.getProps();if(!Wv(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:c}=i.layout.layoutBox[n];o.set(t[n]-Yn(a,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!$f(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Go(a=>{const c=this.getAxisMotionValue(a);if(c&&this.constraints!==!1){const u=c.get();i[a]=aCe({min:u,max:u},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Go(a=>{if(!Wv(a,t,null))return;const c=this.getAxisMotionValue(a),{min:u,max:d}=this.constraints[a];c.set(Yn(u,d,i[a]))})}addListeners(){if(!this.visualElement.current)return;uCe.set(this.visualElement,this);const t=this.visualElement.current,n=rg(t,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps();d&&h&&this.start(u)}),r=()=>{const{dragConstraints:u}=this.getProps();$f(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Wn.read(r);const a=Qg(window,"resize",()=>this.scalePositionWithinConstraints()),c=i.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Go(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=u[h].translate,p.set(p.get()+u[h].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=pI,dragMomentum:c=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:c}}}function Wv(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function fCe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class hCe extends zc{constructor(t){super(t),this.removeGroupControls=ls,this.removeListeners=ls,this.controls=new dCe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ls}unmount(){this.removeGroupControls(),this.removeListeners()}}const rB=e=>(t,n)=>{e&&Wn.postRender(()=>e(t,n))};class pCe extends zc{constructor(){super(...arguments),this.removePointerDownListener=ls}onPointerDown(t){this.session=new J8(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:X8(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:rB(t),onStart:rB(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&Wn.postRender(()=>i(o,a))}}}mount(){this.removePointerDownListener=rg(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const FS={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let _E=!1;class mCe extends A.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),_E&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),FS.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,{projection:a}=r;return a&&(a.isPresent=o,_E=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==o?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||Wn.postRender(()=>{const c=a.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),mO.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;_E=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function eW(e){const[t,n]=w8(),r=A.useContext(GA);return N.jsx(mCe,{...e,layoutGroup:r,switchLayoutGroup:A.useContext(P8),isPresent:t,safeToRemove:n})}function gCe(e,t,n){const r=ki(e)?e:Ah(e);return r.start(TO("",r,t,n)),r.animation}const yCe=(e,t)=>e.depth-t.depth;class bCe{constructor(){this.children=[],this.isDirty=!1}add(t){XA(this.children,t),this.isDirty=!0}remove(t){JA(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(yCe),this.isDirty=!1,this.children.forEach(t)}}function vCe(e,t){const n=to.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Tc(r),e(o-t))};return Wn.setup(r,!0),()=>Tc(r)}const tW=["TopLeft","TopRight","BottomLeft","BottomRight"],SCe=tW.length,iB=e=>typeof e=="string"?parseFloat(e):e,oB=e=>typeof e=="number"||at.test(e);function xCe(e,t,n,r,i,o){i?(e.opacity=Yn(0,n.opacity??1,wCe(r)),e.opacityExit=Yn(t.opacity??1,0,kCe(r))):o&&(e.opacity=Yn(t.opacity??1,n.opacity??1,r));for(let a=0;a<SCe;a++){const c=`border${tW[a]}Radius`;let u=sB(t,c),d=sB(n,c);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||oB(u)===oB(d)?(e[c]=Math.max(Yn(iB(u),iB(d),r),0),(fa.test(d)||fa.test(u))&&(e[c]+="%")):e[c]=d}(t.rotate||n.rotate)&&(e.rotate=Yn(t.rotate||0,n.rotate||0,r))}function sB(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const wCe=nW(0,.5,B9),kCe=nW(.5,.95,ls);function nW(e,t,n){return r=>r<e?0:r>t?1:n(Kg(e,t,r))}function aB(e,t){e.min=t.min,e.max=t.max}function bs(e,t){aB(e.x,t.x),aB(e.y,t.y)}function lB(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function cB(e,t,n,r,i){return e-=t,e=Q0(e,1/n,r),i!==void 0&&(e=Q0(e,1/i,r)),e}function _Ce(e,t=0,n=1,r=.5,i,o=e,a=e){if(fa.test(t)&&(t=parseFloat(t),t=Yn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let c=Yn(o.min,o.max,r);e===o&&(c-=t),e.min=cB(e.min,t,n,c,i),e.max=cB(e.max,t,n,c,i)}function uB(e,t,[n,r,i],o,a){_Ce(e,t[n],t[r],t[i],t.scale,o,a)}const ECe=["x","scaleX","originX"],TCe=["y","scaleY","originY"];function dB(e,t,n,r){uB(e.x,t,ECe,n?n.x:void 0,r?r.x:void 0),uB(e.y,t,TCe,n?n.y:void 0,r?r.y:void 0)}function fB(e){return e.translate===0&&e.scale===1}function rW(e){return fB(e.x)&&fB(e.y)}function hB(e,t){return e.min===t.min&&e.max===t.max}function CCe(e,t){return hB(e.x,t.x)&&hB(e.y,t.y)}function pB(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function iW(e,t){return pB(e.x,t.x)&&pB(e.y,t.y)}function mB(e){return zi(e.x)/zi(e.y)}function gB(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class ICe{constructor(){this.members=[]}add(t){XA(this.members,t),t.scheduleRender()}remove(t){if(JA(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function MCe(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y,a=n?.z||0;if((i||o||a)&&(r=`translate3d(${i}px, ${o}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:h,rotateX:p,rotateY:y,skewX:g,skewY:v}=n;d&&(r=`perspective(${d}px) ${r}`),h&&(r+=`rotate(${h}deg) `),p&&(r+=`rotateX(${p}deg) `),y&&(r+=`rotateY(${y}deg) `),g&&(r+=`skewX(${g}deg) `),v&&(r+=`skewY(${v}deg) `)}const c=e.x.scale*t.x,u=e.y.scale*t.y;return(c!==1||u!==1)&&(r+=`scale(${c}, ${u})`),r||"none"}const EE=["","X","Y","Z"],RCe=1e3;let ACe=0;function TE(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function oW(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=V8(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Wn,!(i||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&oW(r)}function sW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},c=t?.()){this.id=ACe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(PCe),this.nodes.forEach(jCe),this.nodes.forEach(FCe),this.nodes.forEach(NCe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new bCe)}addEventListener(a,c){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new tO),this.eventHandlers.get(a).add(c)}notifyListeners(a,...c){const u=this.eventHandlers.get(a);u&&u.notify(...c)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=x8(a)&&!wEe(a),this.instance=a;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||c)&&(this.isLayoutDirty=!0),e){let h,p=0;const y=()=>this.root.updateBlockedByResize=!1;Wn.read(()=>{p=window.innerWidth}),e(a,()=>{const g=window.innerWidth;g!==p&&(p=g,this.root.updateBlockedByResize=!0,h&&h(),h=vCe(y,250),FS.hasAnimatedSinceResize&&(FS.hasAnimatedSinceResize=!1,this.nodes.forEach(vB)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeLayoutChanged:y,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||d.getDefaultTransition()||VCe,{onLayoutAnimationStart:S,onLayoutAnimationComplete:x}=d.getProps(),k=!this.targetLayout||!iW(this.targetLayout,g),_=!p&&y;if(this.options.layoutRoot||this.resumeFrom||_||p&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...hO(v,"layout"),onPlay:S,onComplete:x};(d.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(h,_)}else p||vB(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Tc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(zCe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oW(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const p=this.path[h];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(yB);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(bB);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach($Ce),this.nodes.forEach(OCe),this.nodes.forEach(DCe)):this.nodes.forEach(bB),this.clearAllSnapshots();const c=to.now();ai.delta=yl(0,1e3/60,c-ai.timestamp),ai.timestamp=c,ai.isProcessing=!0,pE.update.process(ai),pE.preRender.process(ai),pE.render.process(ai),ai.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,mO.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(LCe),this.sharedNodes.forEach(BCe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Wn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Wn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!zi(this.snapshot.measuredBox.x)&&!zi(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Fr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(c=!1),c&&this.instance){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!i)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!rW(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,h=d!==this.prevTransformTemplateValue;a&&this.instance&&(c||vu(this.latestValues)||h)&&(i(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return a&&(u=this.removeTransform(u)),HCe(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:a}=this.options;if(!a)return Fr();const c=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(KCe))){const{scroll:d}=this.root;d&&(jf(c.x,d.offset.x),jf(c.y,d.offset.y))}return c}removeElementScroll(a){const c=Fr();if(bs(c,a),this.scroll?.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:p}=d;d!==this.root&&h&&p.layoutScroll&&(h.wasRoot&&bs(c,a),jf(c.x,h.offset.x),jf(c.y,h.offset.y))}return c}applyTransform(a,c=!1){const u=Fr();bs(u,a);for(let d=0;d<this.path.length;d++){const h=this.path[d];!c&&h.options.layoutScroll&&h.scroll&&h!==h.root&&Ff(u,{x:-h.scroll.offset.x,y:-h.scroll.offset.y}),vu(h.latestValues)&&Ff(u,h.latestValues)}return vu(this.latestValues)&&Ff(u,this.latestValues),u}removeTransform(a){const c=Fr();bs(c,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!d.instance||!vu(d.latestValues))continue;lI(d.latestValues)&&d.updateSnapshot();const h=Fr(),p=d.measurePageBox();bs(h,p),dB(c,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,h)}return vu(this.latestValues)&&dB(c,this.latestValues),c}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ai.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(a||u&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:p}=this.options;if(!this.layout||!(h||p))return;this.resolvedRelativeTargetAt=ai.timestamp;const y=this.getClosestProjectingParent();y&&this.linkedParentVersion!==y.layoutVersion&&!y.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(y&&y.layout?this.createRelativeTarget(y,this.layout.layoutBox,y.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Fr(),this.targetWithTransforms=Fr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),eCe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):bs(this.target,this.layout.layoutBox),j8(this.target,this.targetDelta)):bs(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,y&&!!y.resumingFrom==!!this.resumingFrom&&!y.options.layoutScroll&&y.target&&this.animationProgress!==1?this.createRelativeTarget(y,this.target,y.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||lI(this.parent.latestValues)||$8(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,c,u){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Fr(),this.relativeTargetOrigin=Fr(),X0(this.relativeTargetOrigin,c,u),bs(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const a=this.getLead(),c=!!this.resumingFrom||this!==a;let u=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===ai.timestamp&&(u=!1),u)return;const{layout:d,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||h))return;bs(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,y=this.treeScale.y;fTe(this.layoutCorrected,this.treeScale,this.path,c),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Fr());const{target:g}=a;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(lB(this.prevProjectionDelta.x,this.projectionDelta.x),lB(this.prevProjectionDelta.y,this.projectionDelta.y)),ig(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==y||!gB(this.projectionDelta.x,this.prevProjectionDelta.x)||!gB(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=zf(),this.projectionDelta=zf(),this.projectionDeltaWithTransform=zf()}setAnimationOrigin(a,c=!1){const u=this.snapshot,d=u?u.latestValues:{},h={...this.latestValues},p=zf();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const y=Fr(),g=u?u.source:void 0,v=this.layout?this.layout.source:void 0,S=g!==v,x=this.getStack(),k=!x||x.members.length<=1,_=!!(S&&!k&&this.options.crossfade===!0&&!this.path.some(qCe));this.animationProgress=0;let E;this.mixTargetDelta=M=>{const D=M/1e3;SB(p.x,a.x,D),SB(p.y,a.y,D),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(X0(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),UCe(this.relativeTarget,this.relativeTargetOrigin,y,D),E&&CCe(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Fr()),bs(E,this.relativeTarget)),S&&(this.animationValues=h,xCe(h,d,this.latestValues,D,_,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Tc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Wn.update(()=>{FS.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ah(0)),this.currentAnimation=gCe(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),a.onUpdate&&a.onUpdate(c)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RCe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:c,target:u,layout:d,latestValues:h}=a;if(!(!c||!u||!d)){if(this!==a&&this.layout&&d&&aW(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||Fr();const p=zi(this.layout.layoutBox.x);u.x.min=a.target.x.min,u.x.max=u.x.min+p;const y=zi(this.layout.layoutBox.y);u.y.min=a.target.y.min,u.y.max=u.y.min+y}bs(c,u),Ff(c,h),ig(this.projectionDeltaWithTransform,this.layoutCorrected,c,h)}}registerSharedNode(a,c){this.sharedNodes.has(a)||this.sharedNodes.set(a,new ICe),this.sharedNodes.get(a).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){const{layoutId:a}=this.options;return a?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:c,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),a&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let c=!1;const{latestValues:u}=a;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const d={};u.z&&TE("z",a,d,this.animationValues);for(let h=0;h<EE.length;h++)TE(`rotate${EE[h]}`,a,d,this.animationValues),TE(`skew${EE[h]}`,a,d,this.animationValues);a.render();for(const h in d)a.setStaticValue(h,d[h]),this.animationValues&&(this.animationValues[h]=d[h]);a.scheduleRender()}applyProjectionStyles(a,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=jS(c?.pointerEvents)||"",a.transform=u?u(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=jS(c?.pointerEvents)||""),this.hasProjected&&!vu(this.latestValues)&&(a.transform=u?u({},""):"none",this.hasProjected=!1);return}a.visibility="";const h=d.animationValues||d.latestValues;this.applyTransformsToTarget();let p=MCe(this.projectionDeltaWithTransform,this.treeScale,h);u&&(p=u(h,p)),a.transform=p;const{x:y,y:g}=this.projectionDelta;a.transformOrigin=`${y.origin*100}% ${g.origin*100}% 0`,d.animationValues?a.opacity=d===this?h.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:a.opacity=d===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const v in aI){if(h[v]===void 0)continue;const{correct:S,applyTo:x,isCSSVariable:k}=aI[v],_=p==="none"?h[v]:S(h[v],d);if(x){const E=x.length;for(let M=0;M<E;M++)a[x[M]]=_}else k?this.options.visualElement.renderState.vars[v]=_:a[v]=_}this.options.layoutId&&(a.pointerEvents=d===this?jS(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(yB),this.root.sharedNodes.clear()}}}function OCe(e){e.updateLayout()}function DCe(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;i==="size"?Go(h=>{const p=o?t.measuredBox[h]:t.layoutBox[h],y=zi(p);p.min=n[h].min,p.max=p.min+y}):aW(i,t.layoutBox,n)&&Go(h=>{const p=o?t.measuredBox[h]:t.layoutBox[h],y=zi(n[h]);p.max=p.min+y,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+y)});const a=zf();ig(a,n,t.layoutBox);const c=zf();o?ig(c,e.applyTransform(r,!0),t.measuredBox):ig(c,n,t.layoutBox);const u=!rW(a);let d=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:y}=h;if(p&&y){const g=Fr();X0(g,t.layoutBox,p.layoutBox);const v=Fr();X0(v,n,y.layoutBox),iW(g,v)||(d=!0),h.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=g,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:c,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function PCe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function NCe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function LCe(e){e.clearSnapshot()}function yB(e){e.clearMeasurements()}function bB(e){e.isLayoutDirty=!1}function $Ce(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function vB(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function jCe(e){e.resolveTargetDelta()}function FCe(e){e.calcProjection()}function zCe(e){e.resetSkewAndRotation()}function BCe(e){e.removeLeadSnapshot()}function SB(e,t,n){e.translate=Yn(t.translate,0,n),e.scale=Yn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function xB(e,t,n,r){e.min=Yn(t.min,n.min,r),e.max=Yn(t.max,n.max,r)}function UCe(e,t,n,r){xB(e.x,t.x,n.x,r),xB(e.y,t.y,n.y,r)}function qCe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const VCe={duration:.45,ease:[.4,0,.1,1]},wB=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),kB=wB("applewebkit/")&&!wB("chrome/")?Math.round:ls;function _B(e){e.min=kB(e.min),e.max=kB(e.max)}function HCe(e){_B(e.x),_B(e.y)}function aW(e,t,n){return e==="position"||e==="preserve-aspect"&&!ZTe(mB(t),mB(n),.2)}function KCe(e){return e!==e.root&&e.scroll?.wasRoot}const WCe=sW({attachResizeListener:(e,t)=>Qg(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),CE={current:void 0},lW=sW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!CE.current){const e=new WCe({});e.mount(window),e.setOptions({layoutScroll:!0}),CE.current=e}return CE.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),GCe={pan:{Feature:pCe},drag:{Feature:hCe,ProjectionNode:lW,MeasureLayout:eW}};function EB(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=r[i];o&&Wn.postRender(()=>o(t,Zy(t)))}class YCe extends zc{mount(){const{current:t}=this.node;t&&(this.unmount=yEe(t,(n,r)=>(EB(this.node,r,"Start"),i=>EB(this.node,i,"End"))))}unmount(){}}class QCe extends zc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Qy(Qg(this.node.current,"focus",()=>this.onFocus()),Qg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function TB(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=r[i];o&&Wn.postRender(()=>o(t,Zy(t)))}class XCe extends zc{mount(){const{current:t}=this.node;t&&(this.unmount=xEe(t,(n,r)=>(TB(this.node,r,"Start"),(i,{success:o})=>TB(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const mI=new WeakMap,IE=new WeakMap,JCe=e=>{const t=mI.get(e.target);t&&t(e)},ZCe=e=>{e.forEach(JCe)};function eIe({root:e,...t}){const n=e||document;IE.has(n)||IE.set(n,{});const r=IE.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(ZCe,{root:e,...t})),r[i]}function tIe(e,t,n){const r=eIe(t);return mI.set(e,n),r.observe(e),()=>{mI.delete(e),r.unobserve(e)}}const nIe={some:0,all:1};class rIe extends zc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:nIe[i]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),y=d?h:p;y&&y(u)};return tIe(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(iIe(t,n))&&this.startObserver()}unmount(){}}function iIe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const oIe={inView:{Feature:rIe},tap:{Feature:XCe},focus:{Feature:QCe},hover:{Feature:YCe}},sIe={layout:{ProjectionNode:lW,MeasureLayout:eW}},aIe={...WTe,...oIe,...GCe,...sIe},J0=cTe(aIe,wTe);function cW(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=cW(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function uW(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=cW(e))&&(r&&(r+=" "),r+=t);return r}const CB=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,IB=uW,CO=(e,t)=>n=>{var r;if(t?.variants==null)return IB(e,n?.class,n?.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(d=>{const h=n?.[d],p=o?.[d];if(h===null)return null;const y=CB(h)||CB(p);return i[d][y]}),c=n&&Object.entries(n).reduce((d,h)=>{let[p,y]=h;return y===void 0||(d[p]=y),d},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:p,className:y,...g}=h;return Object.entries(g).every(v=>{let[S,x]=v;return Array.isArray(x)?x.includes({...o,...c}[S]):{...o,...c}[S]===x})?[...d,p,y]:d},[]);return IB(e,a,u,n?.class,n?.className)},lIe=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},cIe=(e,t)=>({classGroupId:e,validator:t}),dW=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Z0="-",MB=[],uIe="arbitrary..",dIe=e=>{const t=hIe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return fIe(a);const c=a.split(Z0),u=c[0]===""&&c.length>1?1:0;return fW(c,u,t)},getConflictingClassGroupIds:(a,c)=>{if(c){const u=r[a],d=n[a];return u?d?lIe(d,u):u:d||MB}return n[a]||MB}}},fW=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],o=n.nextPart.get(i);if(o){const d=fW(e,t+1,o);if(d)return d}const a=n.validators;if(a===null)return;const c=t===0?e.join(Z0):e.slice(t).join(Z0),u=a.length;for(let d=0;d<u;d++){const h=a[d];if(h.validator(c))return h.classGroupId}},fIe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?uIe+r:void 0})(),hIe=e=>{const{theme:t,classGroups:n}=e;return pIe(n,t)},pIe=(e,t)=>{const n=dW();for(const r in e){const i=e[r];IO(i,n,r,t)}return n},IO=(e,t,n,r)=>{const i=e.length;for(let o=0;o<i;o++){const a=e[o];mIe(a,t,n,r)}},mIe=(e,t,n,r)=>{if(typeof e=="string"){gIe(e,t,n);return}if(typeof e=="function"){yIe(e,t,n,r);return}bIe(e,t,n,r)},gIe=(e,t,n)=>{const r=e===""?t:hW(t,e);r.classGroupId=n},yIe=(e,t,n,r)=>{if(vIe(e)){IO(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(cIe(n,e))},bIe=(e,t,n,r)=>{const i=Object.entries(e),o=i.length;for(let a=0;a<o;a++){const[c,u]=i[a];IO(u,hW(t,c),n,r)}},hW=(e,t)=>{let n=e;const r=t.split(Z0),i=r.length;for(let o=0;o<i;o++){const a=r[o];let c=n.nextPart.get(a);c||(c=dW(),n.nextPart.set(a,c)),n=c}return n},vIe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,SIe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return i(o,a),a},set(o,a){o in n?n[o]=a:i(o,a)}}},gI="!",RB=":",xIe=[],AB=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),wIe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const o=[];let a=0,c=0,u=0,d;const h=i.length;for(let S=0;S<h;S++){const x=i[S];if(a===0&&c===0){if(x===RB){o.push(i.slice(u,S)),u=S+1;continue}if(x==="/"){d=S;continue}}x==="["?a++:x==="]"?a--:x==="("?c++:x===")"&&c--}const p=o.length===0?i:i.slice(u);let y=p,g=!1;p.endsWith(gI)?(y=p.slice(0,-1),g=!0):p.startsWith(gI)&&(y=p.slice(1),g=!0);const v=d&&d>u?d-u:void 0;return AB(o,g,y,v)};if(t){const i=t+RB,o=r;r=a=>a.startsWith(i)?o(a.slice(i.length)):AB(xIe,!1,a,void 0,!0)}if(n){const i=r;r=o=>n({className:o,parseClassName:i})}return r},kIe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let o=0;o<n.length;o++){const a=n[o],c=a[0]==="[",u=t.has(a);c||u?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(a)):i.push(a)}return i.length>0&&(i.sort(),r.push(...i)),r}},_Ie=e=>({cache:SIe(e.cacheSize),parseClassName:wIe(e),sortModifiers:kIe(e),...dIe(e)}),EIe=/\s+/,TIe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=t,a=[],c=e.trim().split(EIe);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:p,modifiers:y,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:S}=n(h);if(p){u=h+(u.length>0?" "+u:u);continue}let x=!!S,k=r(x?v.substring(0,S):v);if(!k){if(!x){u=h+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=h+(u.length>0?" "+u:u);continue}x=!1}const _=y.length===0?"":y.length===1?y[0]:o(y).join(":"),E=g?_+gI:_,M=E+k;if(a.indexOf(M)>-1)continue;a.push(M);const D=i(k,x);for(let T=0;T<D.length;++T){const C=D[T];a.push(E+C)}u=h+(u.length>0?" "+u:u)}return u},CIe=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=pW(n))&&(i&&(i+=" "),i+=r);return i},pW=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=pW(e[r]))&&(n&&(n+=" "),n+=t);return n},IIe=(e,...t)=>{let n,r,i,o;const a=u=>{const d=t.reduce((h,p)=>p(h),e());return n=_Ie(d),r=n.cache.get,i=n.cache.set,o=c,c(u)},c=u=>{const d=r(u);if(d)return d;const h=TIe(u,n);return i(u,h),h};return o=a,(...u)=>o(CIe(...u))},MIe=[],jr=e=>{const t=n=>n[e]||MIe;return t.isThemeGetter=!0,t},mW=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gW=/^\((?:(\w[\w-]*):)?(.+)\)$/i,RIe=/^\d+\/\d+$/,AIe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OIe=/\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$/,DIe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PIe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NIe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sf=e=>RIe.test(e),It=e=>!!e&&!Number.isNaN(Number(e)),Jl=e=>!!e&&Number.isInteger(Number(e)),ME=e=>e.endsWith("%")&&It(e.slice(0,-1)),Ga=e=>AIe.test(e),LIe=()=>!0,$Ie=e=>OIe.test(e)&&!DIe.test(e),yW=()=>!1,jIe=e=>PIe.test(e),FIe=e=>NIe.test(e),zIe=e=>!je(e)&&!Fe(e),BIe=e=>up(e,SW,yW),je=e=>mW.test(e),mu=e=>up(e,xW,$Ie),RE=e=>up(e,KIe,It),OB=e=>up(e,bW,yW),UIe=e=>up(e,vW,FIe),Gv=e=>up(e,wW,jIe),Fe=e=>gW.test(e),bm=e=>dp(e,xW),qIe=e=>dp(e,WIe),DB=e=>dp(e,bW),VIe=e=>dp(e,SW),HIe=e=>dp(e,vW),Yv=e=>dp(e,wW,!0),up=(e,t,n)=>{const r=mW.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},dp=(e,t,n=!1)=>{const r=gW.exec(e);return r?r[1]?t(r[1]):n:!1},bW=e=>e==="position"||e==="percentage",vW=e=>e==="image"||e==="url",SW=e=>e==="length"||e==="size"||e==="bg-size",xW=e=>e==="length",KIe=e=>e==="number",WIe=e=>e==="family-name",wW=e=>e==="shadow",GIe=()=>{const e=jr("color"),t=jr("font"),n=jr("text"),r=jr("font-weight"),i=jr("tracking"),o=jr("leading"),a=jr("breakpoint"),c=jr("container"),u=jr("spacing"),d=jr("radius"),h=jr("shadow"),p=jr("inset-shadow"),y=jr("text-shadow"),g=jr("drop-shadow"),v=jr("blur"),S=jr("perspective"),x=jr("aspect"),k=jr("ease"),_=jr("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...M(),Fe,je],T=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],O=()=>[Fe,je,u],q=()=>[Sf,"full","auto",...O()],I=()=>[Jl,"none","subgrid",Fe,je],L=()=>["auto",{span:["full",Jl,Fe,je]},Jl,Fe,je],P=()=>[Jl,"auto",Fe,je],B=()=>["auto","min","max","fr",Fe,je],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...O()],K=()=>[Sf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],G=()=>[e,Fe,je],J=()=>[...M(),DB,OB,{position:[Fe,je]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",VIe,BIe,{size:[Fe,je]}],Q=()=>[ME,bm,mu],z=()=>["","none","full",d,Fe,je],ne=()=>["",It,bm,mu],ce=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[It,ME,DB,OB],me=()=>["","none",v,Fe,je],fe=()=>["none",It,Fe,je],ye=()=>["none",It,Fe,je],ie=()=>[It,Fe,je],xe=()=>[Sf,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ga],breakpoint:[Ga],color:[LIe],container:[Ga],"drop-shadow":[Ga],ease:["in","out","in-out"],font:[zIe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ga],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ga],shadow:[Ga],spacing:["px",It],text:[Ga],"text-shadow":[Ga],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sf,je,Fe,x]}],container:["container"],columns:[{columns:[It,je,Fe,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:D()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Jl,"auto",Fe,je]}],basis:[{basis:[Sf,"full","auto",c,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[It,Sf,"auto","initial","none",je]}],grow:[{grow:["",It,Fe,je]}],shrink:[{shrink:["",It,Fe,je]}],order:[{order:[Jl,"first","last","none",Fe,je]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[c,"screen",...K()]}],"min-w":[{"min-w":[c,"screen","none",...K()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[a]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,bm,mu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Fe,RE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ME,je]}],"font-family":[{font:[qIe,je,t]}],"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:[i,Fe,je]}],"line-clamp":[{"line-clamp":[It,"none",Fe,RE]}],leading:[{leading:[o,...O()]}],"list-image":[{"list-image":["none",Fe,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,je]}],"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:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[It,"from-font","auto",Fe,mu]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[It,"auto",Fe,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,je]}],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",Fe,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Jl,Fe,je],radial:["",Fe,je],conic:[Jl,Fe,je]},HIe,UIe]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"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-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:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[It,Fe,je]}],"outline-w":[{outline:["",It,bm,mu]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",h,Yv,Gv]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",p,Yv,Gv]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[It,mu]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",y,Yv,Gv]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[It,Fe,je]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[It]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"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":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"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":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"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":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"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":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"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":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"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":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[Fe,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"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":M()}],"mask-image-conic-pos":[{"mask-conic":[It]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"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:J()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,je]}],filter:[{filter:["","none",Fe,je]}],blur:[{blur:me()}],brightness:[{brightness:[It,Fe,je]}],contrast:[{contrast:[It,Fe,je]}],"drop-shadow":[{"drop-shadow":["","none",g,Yv,Gv]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",It,Fe,je]}],"hue-rotate":[{"hue-rotate":[It,Fe,je]}],invert:[{invert:["",It,Fe,je]}],saturate:[{saturate:[It,Fe,je]}],sepia:[{sepia:["",It,Fe,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,je]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[It,Fe,je]}],"backdrop-contrast":[{"backdrop-contrast":[It,Fe,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",It,Fe,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[It,Fe,je]}],"backdrop-invert":[{"backdrop-invert":["",It,Fe,je]}],"backdrop-opacity":[{"backdrop-opacity":[It,Fe,je]}],"backdrop-saturate":[{"backdrop-saturate":[It,Fe,je]}],"backdrop-sepia":[{"backdrop-sepia":["",It,Fe,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[It,"initial",Fe,je]}],ease:[{ease:["linear","initial",k,Fe,je]}],delay:[{delay:[It,Fe,je]}],animate:[{animate:["none",_,Fe,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Fe,je]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Fe,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],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",Fe,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",Fe,je]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[It,bm,mu,RE]}],stroke:[{stroke:["none",...G()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-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-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-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-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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YIe=IIe(GIe);function bi(...e){return YIe(uW(e))}const QIe=CO("inline-flex items-center rounded-none border border-foreground px-1.5 py-0.5 text-[11px] font-mono font-bold tracking-wider text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-secondary text-secondary-foreground border-foreground",outline:"bg-background border-foreground",info:"bg-info text-info-foreground border-foreground",warning:"bg-warning text-warning-foreground border-foreground",success:"bg-success text-success-foreground border-foreground",danger:"bg-destructive text-destructive-foreground border-destructive"}},defaultVariants:{variant:"default"}});function _n({className:e,variant:t,...n}){return N.jsx("div",{className:bi(QIe({variant:t,className:e})),...n})}function yI({task:e,focused:t,onToggle:n,onOpenDetail:r}){const i=Fu(e),o=e.taskId??`L${e.line}`;return N.jsx(J0.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,scale:.98,transition:{duration:.1}},className:"group relative min-w-0 bg-background transition-all duration-200 hover:bg-muted/30",children:N.jsxs("div",{className:"flex min-w-0 items-start gap-3 p-3 border-l-4 border-transparent transition-all duration-200 group-hover:border-accent",children:[N.jsx("input",{className:"mt-1 h-4 w-4 cursor-pointer accent-primary",type:"checkbox",checked:e.checked,onChange:a=>n(a.target.checked)}),N.jsxs("button",{type:"button",className:"min-w-0 flex-1 overflow-hidden text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50",onClick:r,title:i,children:[N.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[N.jsx(_n,{variant:"outline",children:o}),e.story?N.jsx(_n,{variant:"info",children:e.story}):null,e.parallel?N.jsx(_n,{variant:"warning",children:"P"}):null,N.jsxs("span",{className:"ml-auto font-mono opacity-70",children:["L",e.line]})]}),N.jsx("div",{className:"mt-1.5 min-w-0 break-words text-[13.5px] leading-relaxed text-foreground",children:N.jsx("span",{className:e.checked?"text-muted-foreground line-through opacity-70":void 0,children:i})})]})]})})}function ex({storyCode:e,title:t,stats:n,hint:r,tone:i="default",onOpen:o}){const c=i==="danger"?"danger":"info";return N.jsx(J0.button,{type:"button",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,scale:.98,transition:{duration:.1}},className:"group relative block w-full outline-none bg-background transition-all duration-200 hover:bg-muted/30",onClick:o,title:t,children:N.jsxs("div",{className:"flex min-w-0 items-start gap-3 p-3 border-l-4 border-transparent transition-all duration-200 group-hover:border-accent",children:[N.jsx(_n,{variant:c,className:"mt-0.5 shrink-0",children:e}),N.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[N.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:[n?N.jsxs("span",{className:"font-mono",children:[n.done,"/",n.total]}):N.jsx("span",{children:"—"}),r?N.jsx("span",{className:"truncate opacity-70 normal-case tracking-normal",children:r}):null]}),N.jsx("div",{className:"mt-1 min-w-0 break-words text-sm font-bold font-serif leading-relaxed text-foreground",children:t}),n&&n.total>0?N.jsx("div",{className:"mt-2 flex h-1 w-24 gap-px overflow-hidden opacity-50",children:[...Array(n.total)].map((u,d)=>N.jsx("div",{className:`h-full w-full flex-1 ${d<n.done?"bg-foreground":"bg-border"}`},d))}):null]})]})})}function kW({value:e,onChange:t,size:n="md"}){const r=n==="sm"?"h-6":"h-8",i=n==="sm"?"text-[10px]":"text-xs";return N.jsx("div",{role:"tablist","aria-label":"View Mode",className:"inline-flex items-center border border-border divide-x divide-border bg-background",children:["us","task"].map(o=>{const a=e===o;return N.jsx("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>t(o),className:`
97
+ ${r} px-3 min-w-[60px]
98
+ flex items-center justify-center
99
+ font-mono uppercase tracking-widest ${i}
100
+ transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring/50
101
+ ${a?"bg-foreground text-background font-bold":"bg-background text-muted-foreground hover:bg-muted hover:text-foreground"}
102
+ `,children:o},o)})})}function PB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function MO(...e){return t=>{let n=!1;const r=e.map(i=>{const o=PB(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():PB(e[i],null)}}}}function wr(...e){return A.useCallback(MO(...e),e)}var XIe=Symbol.for("react.lazy"),tx=zI[" use ".trim().toString()];function JIe(e){return typeof e=="object"&&e!==null&&"then"in e}function _W(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===XIe&&"_payload"in e&&JIe(e._payload)}function ZIe(e){const t=eMe(e),n=A.forwardRef((r,i)=>{let{children:o,...a}=r;_W(o)&&typeof tx=="function"&&(o=tx(o._payload));const c=A.Children.toArray(o),u=c.find(nMe);if(u){const d=u.props.children,h=c.map(p=>p===u?A.Children.count(d)>1?A.Children.only(null):A.isValidElement(d)?d.props.children:null:p);return N.jsx(t,{...a,ref:i,children:A.isValidElement(d)?A.cloneElement(d,void 0,h):null})}return N.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var EW=ZIe("Slot");function eMe(e){const t=A.forwardRef((n,r)=>{let{children:i,...o}=n;if(_W(i)&&typeof tx=="function"&&(i=tx(i._payload)),A.isValidElement(i)){const a=iMe(i),c=rMe(o,i.props);return i.type!==A.Fragment&&(c.ref=r?MO(r,a):a),A.cloneElement(i,c)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tMe=Symbol("radix.slottable");function nMe(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tMe}function rMe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{const u=o(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function iMe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const oMe=CO("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-none text-sm font-bold transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground border border-foreground shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none",secondary:"bg-secondary text-secondary-foreground border border-foreground shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none",outline:"bg-background text-foreground border border-foreground shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none",ghost:"hover:bg-accent text-foreground border border-transparent",destructive:"bg-destructive text-destructive-foreground border border-destructive shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-10 px-6",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ui=A.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const a=r?EW:"button";return N.jsx(a,{ref:o,className:bi(oMe({variant:t,size:n,className:e})),...i})});ui.displayName="Button";function sMe({spec:e,allTasks:t,tasks:n,loading:r,stories:i,loadingStories:o,viewMode:a,globalViewMode:c,hasViewModeOverride:u,focusedTaskLine:d,onToggleTask:h,onOpenTask:p,onOpenSpecDetail:y,onOpenStory:g,onChangeViewMode:v}){const S=A.useMemo(()=>{const M=`${String(e.num).padStart(3,"0")}`,D=e.title.replace(/^Feature Specification\s*[::]\s*/i,"").replace(new RegExp(`^${M}\\s*[-–—·:]\\s*`),"").trim();return{num:M,title:D||e.title}},[e.num,e.title]),x=A.useMemo(()=>{const M=n??[],D=new Map,T=[];for(const O of M){const q=O.story;if(!q){T.push(O);continue}const I=D.get(q)??[];I.push(O),D.set(q,I)}for(const O of D.values())O.sort((q,I)=>q.line-I.line);T.sort((O,q)=>O.line-q.line);const C=Array.from(D.keys()).sort((O,q)=>{const I=Number.parseInt(O.replace(/^US/,""),10),L=Number.parseInt(q.replace(/^US/,""),10);return Number.isFinite(I)&&Number.isFinite(L)?I-L:O.localeCompare(q)});return{byStory:D,storyCodes:C,unassigned:T}},[n]),k=A.useMemo(()=>{const M=[],D=new Set;for(const T of i??[])D.has(T.code)||(D.add(T.code),M.push(T.code));for(const T of x.storyCodes)D.has(T)||(D.add(T),M.push(T));return M},[i,x.storyCodes]),_=A.useMemo(()=>new Map((i??[]).map(M=>[M.code,M])),[i]),E=A.useMemo(()=>{const M=t??n??[],D=new Map;for(const C of M){const O=C.story;if(!O)continue;const q=D.get(O)??[];q.push(C),D.set(O,q)}const T=new Map;for(const[C,O]of D.entries())T.set(C,H0(O));return T},[t,n]);return N.jsxs("div",{className:"group flex h-full w-[360px] flex-col overflow-hidden bg-background transition-all duration-500 hover:bg-muted/20",children:[N.jsxs("div",{className:"sticky top-0 z-10 border-b border-border/10 bg-background px-4 py-3 transition-colors duration-300 group-hover:bg-muted/10 relative overflow-hidden",children:[N.jsx("div",{className:"flex items-start gap-3 relative z-10",children:N.jsx("div",{className:"min-w-0 flex-1",children:N.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[N.jsx(_n,{variant:"outline",className:"mt-0.5 shrink-0 font-mono text-[10px] opacity-50 group-hover:opacity-100 transition-opacity",children:S.num}),N.jsxs("div",{className:"min-w-0 flex-1",children:[N.jsx("div",{className:"break-words text-lg font-bold font-serif text-foreground/80 leading-tight line-clamp-2 transition-colors duration-300 group-hover:text-foreground pr-8",children:S.title}),N.jsx("div",{className:"mt-1 font-mono text-[10px] text-muted-foreground opacity-40 uppercase tracking-widest truncate group-hover:opacity-70 transition-opacity",children:e.id})]})]})})}),e.taskStats&&N.jsx("div",{className:`absolute top-1 right-2 pointer-events-none select-none transform rotate-12 border-2 border-double rounded-sm px-1 py-0.5 text-[9px] font-mono font-black uppercase tracking-widest transition-opacity duration-300
103
+ ${e.taskStats.todo===0?"border-success text-success opacity-80":"border-foreground/40 text-muted-foreground opacity-60 group-hover:opacity-100"}`,children:e.taskStats.todo===0?"PASSED":`${e.taskStats.done}/${e.taskStats.total}`}),N.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-border/40 pt-2",children:[N.jsx("div",{className:"flex items-center gap-2",children:N.jsx(kW,{size:"sm",value:a,onChange:v})}),N.jsx(ui,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] uppercase tracking-widest font-mono text-muted-foreground hover:text-foreground",onClick:y,children:"Read Spec →"})]})]}),N.jsxs("div",{className:"relative scrollbar-none flex-1 overflow-x-hidden overflow-y-auto px-0 py-0",children:[r?N.jsx("div",{className:"absolute inset-x-0 top-0 z-20 h-0.5 w-full overflow-hidden bg-transparent",children:N.jsx("div",{className:"h-full w-full animate-indeterminate-bar bg-accent/50 origin-left"})}):null,!r&&!n?N.jsx("div",{className:"p-4 text-center text-xs font-mono text-muted-foreground uppercase tracking-widest border-b border-dashed border-border/60",children:"No Data"}):null,n||i?N.jsx("div",{className:`transition-opacity duration-200 ${r?"opacity-50 pointer-events-none grayscale":"opacity-100"}`,children:a==="task"?N.jsxs("div",{className:"flex flex-col divide-y divide-dashed divide-border/60 border-b border-dashed border-border/60",children:[n&&n.length===0?N.jsx("div",{className:"p-8 text-center text-xs font-mono text-muted-foreground uppercase tracking-widest",children:"Empty"}):null,(n??[]).map(M=>N.jsx(yI,{task:M,focused:M.line===d,onToggle:D=>h(M,D),onOpenDetail:()=>p(M)},`${e.id}:${M.line}`))]}):N.jsxs("div",{className:"flex flex-col divide-y divide-dashed divide-border/60 border-b border-dashed border-border/60",children:[k.length===0&&x.unassigned.length===0?N.jsx("div",{className:"p-8 text-center text-xs font-mono text-muted-foreground uppercase tracking-widest",children:"No Stories"}):null,k.map(M=>{const D=E.get(M),T=_.get(M)??null,C=!o&&T===null,O=T?.title??M,q=D?`Todo ${D.todo}`:null;return N.jsx(ex,{storyCode:M,title:O,stats:D,hint:q,tone:C?"danger":"default",onOpen:()=>g(M)},M)}),x.unassigned.length>0?N.jsx(ex,{storyCode:"—",title:"Unassigned",stats:H0(x.unassigned),hint:null,onOpen:y}):null]})}):null]})]})}function jn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function aMe(e,t){const n=A.createContext(t),r=o=>{const{children:a,...c}=o,u=A.useMemo(()=>c,Object.values(c));return N.jsx(n.Provider,{value:u,children:a})};r.displayName=e+"Provider";function i(o){const a=A.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function $w(e,t=[]){let n=[];function r(o,a){const c=A.createContext(a),u=n.length;n=[...n,a];const d=p=>{const{scope:y,children:g,...v}=p,S=y?.[e]?.[u]||c,x=A.useMemo(()=>v,Object.values(v));return N.jsx(S.Provider,{value:x,children:g})};d.displayName=o+"Provider";function h(p,y){const g=y?.[e]?.[u]||c,v=A.useContext(g);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[d,h]}const i=()=>{const o=n.map(a=>A.createContext(a));return function(c){const u=c?.[e]||o;return A.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return i.scopeName=e,[r,lMe(i,...t)]}function lMe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((c,{useScope:u,scopeName:d})=>{const p=u(o)[`__scope${d}`];return{...c,...p}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ti=globalThis?.document?A.useLayoutEffect:()=>{},cMe=zI[" useId ".trim().toString()]||(()=>{}),uMe=0;function Zf(e){const[t,n]=A.useState(cMe());return Ti(()=>{n(r=>r??String(uMe++))},[e]),t?`radix-${t}`:""}var dMe=zI[" useInsertionEffect ".trim().toString()]||Ti;function bI({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=fMe({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:i;{const h=A.useRef(e!==void 0);A.useEffect(()=>{const p=h.current;p!==c&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=c},[c,r])}const d=A.useCallback(h=>{if(c){const p=hMe(h)?h(e):h;p!==e&&a.current?.(p)}else o(h)},[c,e,o,a]);return[u,d]}function fMe({defaultProp:e,onChange:t}){const[n,r]=A.useState(e),i=A.useRef(n),o=A.useRef(t);return dMe(()=>{o.current=t},[t]),A.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function hMe(e){return typeof e=="function"}function Xg(e){const t=pMe(e),n=A.forwardRef((r,i)=>{const{children:o,...a}=r,c=A.Children.toArray(o),u=c.find(gMe);if(u){const d=u.props.children,h=c.map(p=>p===u?A.Children.count(d)>1?A.Children.only(null):A.isValidElement(d)?d.props.children:null:p);return N.jsx(t,{...a,ref:i,children:A.isValidElement(d)?A.cloneElement(d,void 0,h):null})}return N.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function pMe(e){const t=A.forwardRef((n,r)=>{const{children:i,...o}=n;if(A.isValidElement(i)){const a=bMe(i),c=yMe(o,i.props);return i.type!==A.Fragment&&(c.ref=r?MO(r,a):a),A.cloneElement(i,c)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mMe=Symbol("radix.slottable");function gMe(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mMe}function yMe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{const u=o(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function bMe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pn=vMe.reduce((e,t)=>{const n=Xg(`Primitive.${t}`),r=A.forwardRef((i,o)=>{const{asChild:a,...c}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),N.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function SMe(e,t){e&&Yy.flushSync(()=>e.dispatchEvent(t))}function ud(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...n)=>t.current?.(...n),[])}function xMe(e,t=globalThis?.document){const n=ud(e);A.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var wMe="DismissableLayer",vI="dismissableLayer.update",kMe="dismissableLayer.pointerDownOutside",_Me="dismissableLayer.focusOutside",NB,TW=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),RO=A.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...u}=e,d=A.useContext(TW),[h,p]=A.useState(null),y=h?.ownerDocument??globalThis?.document,[,g]=A.useState({}),v=wr(t,C=>p(C)),S=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(x),_=h?S.indexOf(h):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,M=_>=k,D=CMe(C=>{const O=C.target,q=[...d.branches].some(I=>I.contains(O));!M||q||(i?.(C),a?.(C),C.defaultPrevented||c?.())},y),T=IMe(C=>{const O=C.target;[...d.branches].some(I=>I.contains(O))||(o?.(C),a?.(C),C.defaultPrevented||c?.())},y);return xMe(C=>{_===d.layers.size-1&&(r?.(C),!C.defaultPrevented&&c&&(C.preventDefault(),c()))},y),A.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(NB=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),LB(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=NB)}},[h,y,n,d]),A.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),LB())},[h,d]),A.useEffect(()=>{const C=()=>g({});return document.addEventListener(vI,C),()=>document.removeEventListener(vI,C)},[]),N.jsx(Pn.div,{...u,ref:v,style:{pointerEvents:E?M?"auto":"none":void 0,...e.style},onFocusCapture:jn(e.onFocusCapture,T.onFocusCapture),onBlurCapture:jn(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:jn(e.onPointerDownCapture,D.onPointerDownCapture)})});RO.displayName=wMe;var EMe="DismissableLayerBranch",TMe=A.forwardRef((e,t)=>{const n=A.useContext(TW),r=A.useRef(null),i=wr(t,r);return A.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),N.jsx(Pn.div,{...e,ref:i})});TMe.displayName=EMe;function CMe(e,t=globalThis?.document){const n=ud(e),r=A.useRef(!1),i=A.useRef(()=>{});return A.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let u=function(){CW(kMe,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function IMe(e,t=globalThis?.document){const n=ud(e),r=A.useRef(!1);return A.useEffect(()=>{const i=o=>{o.target&&!r.current&&CW(_Me,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function LB(){const e=new CustomEvent(vI);document.dispatchEvent(e)}function CW(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?SMe(i,o):i.dispatchEvent(o)}var AE="focusScope.autoFocusOnMount",OE="focusScope.autoFocusOnUnmount",$B={bubbles:!1,cancelable:!0},MMe="FocusScope",AO=A.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[c,u]=A.useState(null),d=ud(i),h=ud(o),p=A.useRef(null),y=wr(t,S=>u(S)),g=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(r){let S=function(E){if(g.paused||!c)return;const M=E.target;c.contains(M)?p.current=M:rc(p.current,{select:!0})},x=function(E){if(g.paused||!c)return;const M=E.relatedTarget;M!==null&&(c.contains(M)||rc(p.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const D of E)D.removedNodes.length>0&&rc(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",x);const _=new MutationObserver(k);return c&&_.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",x),_.disconnect()}}},[r,c,g.paused]),A.useEffect(()=>{if(c){FB.add(g);const S=document.activeElement;if(!c.contains(S)){const k=new CustomEvent(AE,$B);c.addEventListener(AE,d),c.dispatchEvent(k),k.defaultPrevented||(RMe(NMe(IW(c)),{select:!0}),document.activeElement===S&&rc(c))}return()=>{c.removeEventListener(AE,d),setTimeout(()=>{const k=new CustomEvent(OE,$B);c.addEventListener(OE,h),c.dispatchEvent(k),k.defaultPrevented||rc(S??document.body,{select:!0}),c.removeEventListener(OE,h),FB.remove(g)},0)}}},[c,d,h,g]);const v=A.useCallback(S=>{if(!n&&!r||g.paused)return;const x=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(x&&k){const _=S.currentTarget,[E,M]=AMe(_);E&&M?!S.shiftKey&&k===M?(S.preventDefault(),n&&rc(E,{select:!0})):S.shiftKey&&k===E&&(S.preventDefault(),n&&rc(M,{select:!0})):k===_&&S.preventDefault()}},[n,r,g.paused]);return N.jsx(Pn.div,{tabIndex:-1,...a,ref:y,onKeyDown:v})});AO.displayName=MMe;function RMe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(rc(r,{select:t}),document.activeElement!==n)return}function AMe(e){const t=IW(e),n=jB(t,e),r=jB(t.reverse(),e);return[n,r]}function IW(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function jB(e,t){for(const n of e)if(!OMe(n,{upTo:t}))return n}function OMe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function DMe(e){return e instanceof HTMLInputElement&&"select"in e}function rc(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&DMe(e)&&t&&e.select()}}var FB=PMe();function PMe(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=zB(e,t),e.unshift(t)},remove(t){e=zB(e,t),e[0]?.resume()}}}function zB(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function NMe(e){return e.filter(t=>t.tagName!=="A")}var LMe="Portal",OO=A.forwardRef((e,t)=>{const{container:n,...r}=e,[i,o]=A.useState(!1);Ti(()=>o(!0),[]);const a=n||i&&globalThis?.document?.body;return a?I_e.createPortal(N.jsx(Pn.div,{...r,ref:t}),a):null});OO.displayName=LMe;function $Me(e,t){return A.useReducer((n,r)=>t[n][r]??n,e)}var jw=e=>{const{present:t,children:n}=e,r=jMe(t),i=typeof n=="function"?n({present:r.isPresent}):A.Children.only(n),o=wr(r.ref,FMe(i));return typeof n=="function"||r.isPresent?A.cloneElement(i,{ref:o}):null};jw.displayName="Presence";function jMe(e){const[t,n]=A.useState(),r=A.useRef(null),i=A.useRef(e),o=A.useRef("none"),a=e?"mounted":"unmounted",[c,u]=$Me(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const d=Qv(r.current);o.current=c==="mounted"?d:"none"},[c]),Ti(()=>{const d=r.current,h=i.current;if(h!==e){const y=o.current,g=Qv(d);e?u("MOUNT"):g==="none"||d?.display==="none"?u("UNMOUNT"):u(h&&y!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ti(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,p=g=>{const S=Qv(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&S&&(u("ANIMATION_END"),!i.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},y=g=>{g.target===t&&(o.current=Qv(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:A.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Qv(e){return e?.animationName||"none"}function FMe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var DE=0;function MW(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??BB()),document.body.insertAdjacentElement("beforeend",e[1]??BB()),DE++,()=>{DE===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),DE--}},[])}function BB(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ea=function(){return ea=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ea.apply(this,arguments)};function RW(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function zMe(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var zS="right-scroll-bar-position",BS="width-before-scroll-bar",BMe="with-scroll-bars-hidden",UMe="--removed-body-scroll-bar-size";function PE(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function qMe(e,t){var n=A.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var VMe=typeof window<"u"?A.useLayoutEffect:A.useEffect,UB=new WeakMap;function HMe(e,t){var n=qMe(null,function(r){return e.forEach(function(i){return PE(i,r)})});return VMe(function(){var r=UB.get(n);if(r){var i=new Set(r),o=new Set(e),a=n.current;i.forEach(function(c){o.has(c)||PE(c,null)}),o.forEach(function(c){i.has(c)||PE(c,a)})}UB.set(n,e)},[e]),n}function KMe(e){return e}function WMe(e,t){t===void 0&&(t=KMe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(c){return c!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var c=n;n=[],c.forEach(o),a=n}var u=function(){var h=a;a=[],h.forEach(o)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(h){a.push(h),d()},filter:function(h){return a=a.filter(h),n}}}};return i}function GMe(e){e===void 0&&(e={});var t=WMe(null);return t.options=ea({async:!0,ssr:!1},e),t}var AW=function(e){var t=e.sideCar,n=RW(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return A.createElement(r,ea({},n))};AW.isSideCarExport=!0;function YMe(e,t){return e.useMedium(t),AW}var OW=GMe(),NE=function(){},Fw=A.forwardRef(function(e,t){var n=A.useRef(null),r=A.useState({onScrollCapture:NE,onWheelCapture:NE,onTouchMoveCapture:NE}),i=r[0],o=r[1],a=e.forwardProps,c=e.children,u=e.className,d=e.removeScrollBar,h=e.enabled,p=e.shards,y=e.sideCar,g=e.noRelative,v=e.noIsolation,S=e.inert,x=e.allowPinchZoom,k=e.as,_=k===void 0?"div":k,E=e.gapMode,M=RW(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=y,T=HMe([n,t]),C=ea(ea({},M),i);return A.createElement(A.Fragment,null,h&&A.createElement(D,{sideCar:OW,removeScrollBar:d,shards:p,noRelative:g,noIsolation:v,inert:S,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:E}),a?A.cloneElement(A.Children.only(c),ea(ea({},C),{ref:T})):A.createElement(_,ea({},C,{className:u,ref:T}),c))});Fw.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fw.classNames={fullWidth:BS,zeroRight:zS};var QMe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function XMe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=QMe();return t&&e.setAttribute("nonce",t),e}function JMe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ZMe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var eRe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=XMe())&&(JMe(t,n),ZMe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tRe=function(){var e=eRe();return function(t,n){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},DW=function(){var e=tRe(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},nRe={left:0,top:0,right:0,gap:0},LE=function(e){return parseInt(e||"",10)||0},rRe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[LE(n),LE(r),LE(i)]},iRe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nRe;var t=rRe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},oRe=DW(),eh="data-scroll-locked",sRe=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),`
104
+ .`.concat(BMe,` {
105
+ overflow: hidden `).concat(r,`;
106
+ padding-right: `).concat(c,"px ").concat(r,`;
107
+ }
108
+ body[`).concat(eh,`] {
109
+ overflow: hidden `).concat(r,`;
110
+ overscroll-behavior: contain;
111
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
112
+ padding-left: `.concat(i,`px;
113
+ padding-top: `).concat(o,`px;
114
+ padding-right: `).concat(a,`px;
115
+ margin-left:0;
116
+ margin-top:0;
117
+ margin-right: `).concat(c,"px ").concat(r,`;
118
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
119
+ }
120
+
121
+ .`).concat(zS,` {
122
+ right: `).concat(c,"px ").concat(r,`;
123
+ }
124
+
125
+ .`).concat(BS,` {
126
+ margin-right: `).concat(c,"px ").concat(r,`;
127
+ }
128
+
129
+ .`).concat(zS," .").concat(zS,` {
130
+ right: 0 `).concat(r,`;
131
+ }
132
+
133
+ .`).concat(BS," .").concat(BS,` {
134
+ margin-right: 0 `).concat(r,`;
135
+ }
136
+
137
+ body[`).concat(eh,`] {
138
+ `).concat(UMe,": ").concat(c,`px;
139
+ }
140
+ `)},qB=function(){var e=parseInt(document.body.getAttribute(eh)||"0",10);return isFinite(e)?e:0},aRe=function(){A.useEffect(function(){return document.body.setAttribute(eh,(qB()+1).toString()),function(){var e=qB()-1;e<=0?document.body.removeAttribute(eh):document.body.setAttribute(eh,e.toString())}},[])},lRe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;aRe();var o=A.useMemo(function(){return iRe(i)},[i]);return A.createElement(oRe,{styles:sRe(o,!t,i,n?"":"!important")})},SI=!1;if(typeof window<"u")try{var Xv=Object.defineProperty({},"passive",{get:function(){return SI=!0,!0}});window.addEventListener("test",Xv,Xv),window.removeEventListener("test",Xv,Xv)}catch{SI=!1}var xf=SI?{passive:!1}:!1,cRe=function(e){return e.tagName==="TEXTAREA"},PW=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cRe(e)&&n[t]==="visible")},uRe=function(e){return PW(e,"overflowY")},dRe=function(e){return PW(e,"overflowX")},VB=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=NW(e,r);if(i){var o=LW(e,r),a=o[1],c=o[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},fRe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},hRe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},NW=function(e,t){return e==="v"?uRe(t):dRe(t)},LW=function(e,t){return e==="v"?fRe(t):hRe(t)},pRe=function(e,t){return e==="h"&&t==="rtl"?-1:1},mRe=function(e,t,n,r,i){var o=pRe(e,window.getComputedStyle(t).direction),a=o*r,c=n.target,u=t.contains(c),d=!1,h=a>0,p=0,y=0;do{if(!c)break;var g=LW(e,c),v=g[0],S=g[1],x=g[2],k=S-x-o*v;(v||k)&&NW(e,c)&&(p+=k,y+=v);var _=c.parentNode;c=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(h&&Math.abs(p)<1||!h&&Math.abs(y)<1)&&(d=!0),d},Jv=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},HB=function(e){return[e.deltaX,e.deltaY]},KB=function(e){return e&&"current"in e?e.current:e},gRe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},yRe=function(e){return`
141
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
142
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
143
+ `)},bRe=0,wf=[];function vRe(e){var t=A.useRef([]),n=A.useRef([0,0]),r=A.useRef(),i=A.useState(bRe++)[0],o=A.useState(DW)[0],a=A.useRef(e);A.useEffect(function(){a.current=e},[e]),A.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=zMe([e.lockRef.current],(e.shards||[]).map(KB),!0).filter(Boolean);return S.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var c=A.useCallback(function(S,x){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!a.current.allowPinchZoom;var k=Jv(S),_=n.current,E="deltaX"in S?S.deltaX:_[0]-k[0],M="deltaY"in S?S.deltaY:_[1]-k[1],D,T=S.target,C=Math.abs(E)>Math.abs(M)?"h":"v";if("touches"in S&&C==="h"&&T.type==="range")return!1;var O=window.getSelection(),q=O&&O.anchorNode,I=q?q===T||q.contains(T):!1;if(I)return!1;var L=VB(C,T);if(!L)return!0;if(L?D=C:(D=C==="v"?"h":"v",L=VB(C,T)),!L)return!1;if(!r.current&&"changedTouches"in S&&(E||M)&&(r.current=D),!D)return!0;var P=r.current||D;return mRe(P,x,S,P==="h"?E:M)},[]),u=A.useCallback(function(S){var x=S;if(!(!wf.length||wf[wf.length-1]!==o)){var k="deltaY"in x?HB(x):Jv(x),_=t.current.filter(function(D){return D.name===x.type&&(D.target===x.target||x.target===D.shadowParent)&&gRe(D.delta,k)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var E=(a.current.shards||[]).map(KB).filter(Boolean).filter(function(D){return D.contains(x.target)}),M=E.length>0?c(x,E[0]):!a.current.noIsolation;M&&x.cancelable&&x.preventDefault()}}},[]),d=A.useCallback(function(S,x,k,_){var E={name:S,delta:x,target:k,should:_,shadowParent:SRe(k)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(M){return M!==E})},1)},[]),h=A.useCallback(function(S){n.current=Jv(S),r.current=void 0},[]),p=A.useCallback(function(S){d(S.type,HB(S),S.target,c(S,e.lockRef.current))},[]),y=A.useCallback(function(S){d(S.type,Jv(S),S.target,c(S,e.lockRef.current))},[]);A.useEffect(function(){return wf.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:y}),document.addEventListener("wheel",u,xf),document.addEventListener("touchmove",u,xf),document.addEventListener("touchstart",h,xf),function(){wf=wf.filter(function(S){return S!==o}),document.removeEventListener("wheel",u,xf),document.removeEventListener("touchmove",u,xf),document.removeEventListener("touchstart",h,xf)}},[]);var g=e.removeScrollBar,v=e.inert;return A.createElement(A.Fragment,null,v?A.createElement(o,{styles:yRe(i)}):null,g?A.createElement(lRe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function SRe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xRe=YMe(OW,vRe);var DO=A.forwardRef(function(e,t){return A.createElement(Fw,ea({},e,{ref:t,sideCar:xRe}))});DO.classNames=Fw.classNames;var wRe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},kf=new WeakMap,Zv=new WeakMap,eS={},$E=0,$W=function(e){return e&&(e.host||$W(e.parentNode))},kRe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=$W(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},_Re=function(e,t,n,r){var i=kRe(t,Array.isArray(e)?e:[e]);eS[n]||(eS[n]=new WeakMap);var o=eS[n],a=[],c=new Set,u=new Set(i),d=function(p){!p||c.has(p)||(c.add(p),d(p.parentNode))};i.forEach(d);var h=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(y){if(c.has(y))h(y);else try{var g=y.getAttribute(r),v=g!==null&&g!=="false",S=(kf.get(y)||0)+1,x=(o.get(y)||0)+1;kf.set(y,S),o.set(y,x),a.push(y),S===1&&v&&Zv.set(y,!0),x===1&&y.setAttribute(n,"true"),v||y.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),c.clear(),$E++,function(){a.forEach(function(p){var y=kf.get(p)-1,g=o.get(p)-1;kf.set(p,y),o.set(p,g),y||(Zv.has(p)||p.removeAttribute(r),Zv.delete(p)),g||p.removeAttribute(n)}),$E--,$E||(kf=new WeakMap,kf=new WeakMap,Zv=new WeakMap,eS={})}},jW=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=wRe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),_Re(r,i,n,"aria-hidden")):function(){return null}},zw="Dialog",[FW]=$w(zw),[ERe,Bs]=FW(zw),zW=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,c=A.useRef(null),u=A.useRef(null),[d,h]=bI({prop:r,defaultProp:i??!1,onChange:o,caller:zw});return N.jsx(ERe,{scope:t,triggerRef:c,contentRef:u,contentId:Zf(),titleId:Zf(),descriptionId:Zf(),open:d,onOpenChange:h,onOpenToggle:A.useCallback(()=>h(p=>!p),[h]),modal:a,children:n})};zW.displayName=zw;var BW="DialogTrigger",TRe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Bs(BW,n),o=wr(t,i.triggerRef);return N.jsx(Pn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":LO(i.open),...r,ref:o,onClick:jn(e.onClick,i.onOpenToggle)})});TRe.displayName=BW;var PO="DialogPortal",[CRe,UW]=FW(PO,{forceMount:void 0}),qW=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Bs(PO,t);return N.jsx(CRe,{scope:t,forceMount:n,children:A.Children.map(r,a=>N.jsx(jw,{present:n||o.open,children:N.jsx(OO,{asChild:!0,container:i,children:a})}))})};qW.displayName=PO;var nx="DialogOverlay",VW=A.forwardRef((e,t)=>{const n=UW(nx,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Bs(nx,e.__scopeDialog);return o.modal?N.jsx(jw,{present:r||o.open,children:N.jsx(MRe,{...i,ref:t})}):null});VW.displayName=nx;var IRe=Xg("DialogOverlay.RemoveScroll"),MRe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Bs(nx,n);return N.jsx(DO,{as:IRe,allowPinchZoom:!0,shards:[i.contentRef],children:N.jsx(Pn.div,{"data-state":LO(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),dd="DialogContent",HW=A.forwardRef((e,t)=>{const n=UW(dd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Bs(dd,e.__scopeDialog);return N.jsx(jw,{present:r||o.open,children:o.modal?N.jsx(RRe,{...i,ref:t}):N.jsx(ARe,{...i,ref:t})})});HW.displayName=dd;var RRe=A.forwardRef((e,t)=>{const n=Bs(dd,e.__scopeDialog),r=A.useRef(null),i=wr(t,n.contentRef,r);return A.useEffect(()=>{const o=r.current;if(o)return jW(o)},[]),N.jsx(KW,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:jn(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:jn(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0;(a.button===2||c)&&o.preventDefault()}),onFocusOutside:jn(e.onFocusOutside,o=>o.preventDefault())})}),ARe=A.forwardRef((e,t)=>{const n=Bs(dd,e.__scopeDialog),r=A.useRef(!1),i=A.useRef(!1);return N.jsx(KW,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;n.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),KW=A.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...a}=e,c=Bs(dd,n),u=A.useRef(null),d=wr(t,u);return MW(),N.jsxs(N.Fragment,{children:[N.jsx(AO,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:N.jsx(RO,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":LO(c.open),...a,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),N.jsxs(N.Fragment,{children:[N.jsx(PRe,{titleId:c.titleId}),N.jsx(LRe,{contentRef:u,descriptionId:c.descriptionId})]})]})}),NO="DialogTitle",WW=A.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Bs(NO,n);return N.jsx(Pn.h2,{id:i.titleId,...r,ref:t})});WW.displayName=NO;var GW="DialogDescription",ORe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Bs(GW,n);return N.jsx(Pn.p,{id:i.descriptionId,...r,ref:t})});ORe.displayName=GW;var YW="DialogClose",DRe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Bs(YW,n);return N.jsx(Pn.button,{type:"button",...r,ref:t,onClick:jn(e.onClick,()=>i.onOpenChange(!1))})});DRe.displayName=YW;function LO(e){return e?"open":"closed"}var QW="DialogTitleWarning",[RFe,XW]=aMe(QW,{contentName:dd,titleName:NO,docsSlug:"dialog"}),PRe=({titleId:e})=>{const t=XW(QW),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
144
+
145
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
146
+
147
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return A.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},NRe="DialogDescriptionWarning",LRe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${XW(NRe).contentName}}.`;return A.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},$Re=zW,jRe=qW,FRe=VW,JW=HW,ZW=WW;const zRe=$Re,BRe=jRe,$O=A.forwardRef(({className:e,children:t,overlayClassName:n,motionProps:r,...i},o)=>N.jsxs(BRe,{forceMount:!0,children:[N.jsx(FRe,{asChild:!0,children:N.jsx(J0.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:bi("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n)})}),N.jsx(JW,{asChild:!0,ref:o,...i,children:N.jsx(J0.div,{initial:{opacity:0,x:"100%"},animate:{opacity:1,x:0},exit:{opacity:0,x:"100%"},transition:{type:"spring",damping:25,stiffness:200},...r,className:bi("fixed right-0 top-0 z-50 h-screen w-screen bg-background shadow-lg outline-none sm:max-w-md",e),children:t})})]}));$O.displayName=JW.displayName;function eG({open:e,onOpenChange:t,children:n}){return N.jsx(zRe,{open:e,onOpenChange:t,children:N.jsx(AEe,{children:e&&n})})}function URe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const qRe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VRe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HRe={};function WB(e,t){return(HRe.jsx?VRe:qRe).test(e)}const KRe=/[ \t\n\f\r]/g;function WRe(e){return typeof e=="object"?e.type==="text"?GB(e.value):!1:GB(e)}function GB(e){return e.replace(KRe,"")===""}class eb{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}eb.prototype.normal={};eb.prototype.property={};eb.prototype.space=void 0;function tG(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new eb(n,r,t)}function xI(e){return e.toLowerCase()}class so{constructor(t,n){this.attribute=n,this.property=t}}so.prototype.attribute="";so.prototype.booleanish=!1;so.prototype.boolean=!1;so.prototype.commaOrSpaceSeparated=!1;so.prototype.commaSeparated=!1;so.prototype.defined=!1;so.prototype.mustUseProperty=!1;so.prototype.number=!1;so.prototype.overloadedBoolean=!1;so.prototype.property="";so.prototype.spaceSeparated=!1;so.prototype.space=void 0;let GRe=0;const wt=Md(),Ir=Md(),wI=Md(),Te=Md(),An=Md(),th=Md(),go=Md();function Md(){return 2**++GRe}const kI=Object.freeze(Object.defineProperty({__proto__:null,boolean:wt,booleanish:Ir,commaOrSpaceSeparated:go,commaSeparated:th,number:Te,overloadedBoolean:wI,spaceSeparated:An},Symbol.toStringTag,{value:"Module"})),jE=Object.keys(kI);class jO extends so{constructor(t,n,r,i){let o=-1;if(super(t,n),YB(this,"space",i),typeof r=="number")for(;++o<jE.length;){const a=jE[o];YB(this,jE[o],(r&kI[a])===kI[a])}}}jO.prototype.defined=!0;function YB(e,t,n){n&&(e[t]=n)}function fp(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new jO(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[xI(r)]=r,n[xI(o.attribute)]=r}return new eb(t,n,e.space)}const nG=fp({properties:{ariaActiveDescendant:null,ariaAtomic:Ir,ariaAutoComplete:null,ariaBusy:Ir,ariaChecked:Ir,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:An,ariaCurrent:null,ariaDescribedBy:An,ariaDetails:null,ariaDisabled:Ir,ariaDropEffect:An,ariaErrorMessage:null,ariaExpanded:Ir,ariaFlowTo:An,ariaGrabbed:Ir,ariaHasPopup:null,ariaHidden:Ir,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:An,ariaLevel:Te,ariaLive:null,ariaModal:Ir,ariaMultiLine:Ir,ariaMultiSelectable:Ir,ariaOrientation:null,ariaOwns:An,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:Ir,ariaReadOnly:Ir,ariaRelevant:null,ariaRequired:Ir,ariaRoleDescription:An,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:Ir,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function rG(e,t){return t in e?e[t]:t}function iG(e,t){return rG(e,t.toLowerCase())}const YRe=fp({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:th,acceptCharset:An,accessKey:An,action:null,allow:null,allowFullScreen:wt,allowPaymentRequest:wt,allowUserMedia:wt,alt:null,as:null,async:wt,autoCapitalize:null,autoComplete:An,autoFocus:wt,autoPlay:wt,blocking:An,capture:null,charSet:null,checked:wt,cite:null,className:An,cols:Te,colSpan:null,content:null,contentEditable:Ir,controls:wt,controlsList:An,coords:Te|th,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wt,defer:wt,dir:null,dirName:null,disabled:wt,download:wI,draggable:Ir,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wt,formTarget:null,headers:An,height:Te,hidden:wI,high:Te,href:null,hrefLang:null,htmlFor:An,httpEquiv:An,id:null,imageSizes:null,imageSrcSet:null,inert:wt,inputMode:null,integrity:null,is:null,isMap:wt,itemId:null,itemProp:An,itemRef:An,itemScope:wt,itemType:An,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wt,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:wt,muted:wt,name:null,nonce:null,noModule:wt,noValidate:wt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:wt,optimum:Te,pattern:null,ping:An,placeholder:null,playsInline:wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wt,referrerPolicy:null,rel:An,required:wt,reversed:wt,rows:Te,rowSpan:Te,sandbox:An,scope:null,scoped:wt,seamless:wt,selected:wt,shadowRootClonable:wt,shadowRootDelegatesFocus:wt,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:Ir,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:wt,useMap:null,value:Ir,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:An,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wt,declare:wt,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:wt,noHref:wt,noShade:wt,noWrap:wt,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:Ir,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wt,disableRemotePlayback:wt,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:iG}),QRe=fp({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:go,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:An,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:th,g2:th,glyphName:th,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:go,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Te,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:An,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:go,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:go,rev:go,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:go,requiredFeatures:go,requiredFonts:go,requiredFormats:go,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:go,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:go,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:go,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:rG}),oG=fp({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),sG=fp({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:iG}),aG=fp({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),XRe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},JRe=/[A-Z]/g,QB=/-[a-z]/g,ZRe=/^data[-\w.:]+$/i;function eAe(e,t){const n=xI(t);let r=t,i=so;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZRe.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(QB,nAe);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!QB.test(o)){let a=o.replace(JRe,tAe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=jO}return new i(r,t)}function tAe(e){return"-"+e.toLowerCase()}function nAe(e){return e.charAt(1).toUpperCase()}const rAe=tG([nG,YRe,oG,sG,aG],"html"),FO=tG([nG,QRe,oG,sG,aG],"svg");function iAe(e){return e.join(" ").trim()}var _f={},FE,XB;function oAe(){if(XB)return FE;XB=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
148
+ `,d="/",h="*",p="",y="comment",g="declaration";function v(x,k){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];k=k||{};var _=1,E=1;function M($){var V=$.match(t);V&&(_+=V.length);var j=$.lastIndexOf(u);E=~j?$.length-j:E+$.length}function D(){var $={line:_,column:E};return function(V){return V.position=new T($),q(),V}}function T($){this.start=$,this.end={line:_,column:E},this.source=k.source}T.prototype.content=x;function C($){var V=new Error(k.source+":"+_+":"+E+": "+$);if(V.reason=$,V.filename=k.source,V.line=_,V.column=E,V.source=x,!k.silent)throw V}function O($){var V=$.exec(x);if(V){var j=V[0];return M(j),x=x.slice(j.length),V}}function q(){O(n)}function I($){var V;for($=$||[];V=L();)V!==!1&&$.push(V);return $}function L(){var $=D();if(!(d!=x.charAt(0)||h!=x.charAt(1))){for(var V=2;p!=x.charAt(V)&&(h!=x.charAt(V)||d!=x.charAt(V+1));)++V;if(V+=2,p===x.charAt(V-1))return C("End of comment missing");var j=x.slice(2,V-2);return E+=2,M(j),x=x.slice(V),E+=2,$({type:y,comment:j})}}function P(){var $=D(),V=O(r);if(V){if(L(),!O(i))return C("property missing ':'");var j=O(o),K=$({type:g,property:S(V[0].replace(e,p)),value:j?S(j[0].replace(e,p)):p});return O(a),K}}function B(){var $=[];I($);for(var V;V=P();)V!==!1&&($.push(V),I($));return $}return q(),B()}function S(x){return x?x.replace(c,p):p}return FE=v,FE}var JB;function sAe(){if(JB)return _f;JB=1;var e=_f&&_f.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(_f,"__esModule",{value:!0}),_f.default=n;const t=e(oAe());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),c=typeof i=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:d,value:h}=u;c?i(d,h,u):h&&(o=o||{},o[d]=h)}),o}return _f}var vm={},ZB;function aAe(){if(ZB)return vm;ZB=1,Object.defineProperty(vm,"__esModule",{value:!0}),vm.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},a=function(d,h){return h.toUpperCase()},c=function(d,h){return"".concat(h,"-")},u=function(d,h){return h===void 0&&(h={}),o(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(t,a))};return vm.camelCase=u,vm}var Sm,e3;function lAe(){if(e3)return Sm;e3=1;var e=Sm&&Sm.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(sAe()),n=aAe();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(c,u){c&&u&&(a[(0,n.camelCase)(c,o)]=u)}),a}return r.default=r,Sm=r,Sm}var cAe=lAe();const uAe=px(cAe),lG=cG("end"),zO=cG("start");function cG(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function dAe(e){const t=zO(e),n=lG(e);if(t&&n)return{start:t,end:n}}function og(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?t3(e.position):"start"in e||"end"in e?t3(e):"line"in e||"column"in e?_I(e):""}function _I(e){return n3(e&&e.line)+":"+n3(e&&e.column)}function t3(e){return _I(e&&e.start)+"-"+_I(e&&e.end)}function n3(e){return e&&typeof e=="number"?e:1}class Ii extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=og(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ii.prototype.file="";Ii.prototype.name="";Ii.prototype.reason="";Ii.prototype.message="";Ii.prototype.stack="";Ii.prototype.column=void 0;Ii.prototype.line=void 0;Ii.prototype.ancestors=void 0;Ii.prototype.cause=void 0;Ii.prototype.fatal=void 0;Ii.prototype.place=void 0;Ii.prototype.ruleId=void 0;Ii.prototype.source=void 0;const BO={}.hasOwnProperty,fAe=new Map,hAe=/[A-Z]/g,pAe=new Set(["table","tbody","thead","tfoot","tr"]),mAe=new Set(["td","th"]),uG="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gAe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_Ae(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=kAe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?FO:rAe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=dG(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function dG(e,t,n){if(t.type==="element")return yAe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return bAe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return SAe(e,t,n);if(t.type==="mdxjsEsm")return vAe(e,t);if(t.type==="root")return xAe(e,t,n);if(t.type==="text")return wAe(e,t)}function yAe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=FO,e.schema=i),e.ancestors.push(t);const o=hG(e,t.tagName,!1),a=EAe(e,t);let c=qO(e,t);return pAe.has(t.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!WRe(u):!0})),fG(e,a,o,t),UO(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function bAe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jg(e,t.position)}function vAe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jg(e,t.position)}function SAe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=FO,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:hG(e,t.name,!0),a=TAe(e,t),c=qO(e,t);return fG(e,a,o,t),UO(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function xAe(e,t,n){const r={};return UO(r,qO(e,t)),e.create(t,e.Fragment,r,n)}function wAe(e,t){return t.value}function fG(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function UO(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function kAe(e,t,n){return r;function r(i,o,a,c){const d=Array.isArray(a.children)?n:t;return c?d(o,a,c):d(o,a)}}function _Ae(e,t){return n;function n(r,i,o,a){const c=Array.isArray(o.children),u=zO(r);return t(i,o,a,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function EAe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&BO.call(t.properties,i)){const o=CAe(e,i,t.properties[i]);if(o){const[a,c]=o;e.tableCellAlignToStyle&&a==="align"&&typeof c=="string"&&mAe.has(t.tagName)?r=c:n[a]=c}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function TAe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const c=a.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else Jg(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,o=e.evaluater.evaluateExpression(c.expression)}else Jg(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function qO(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:fAe;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const d=i.get(u)||0;a=u+"-"+d,i.set(u,d+1)}}const c=dG(e,o,a);c!==void 0&&n.push(c)}return n}function CAe(e,t,n){const r=eAe(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?URe(n):iAe(n)),r.property==="style"){let i=typeof n=="object"?n:IAe(e,String(n));return e.stylePropertyNameCase==="css"&&(i=MAe(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?XRe[r.property]||r.property:r.attribute,n]}}function IAe(e,t){try{return uAe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ii("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=uG+"#cannot-parse-style-attribute",i}}function hG(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const c=WB(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}r=a}else r=WB(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return BO.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jg(e)}function Jg(e,t){const n=new Ii("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=uG+"#cannot-handle-mdx-estrees-without-createevaluater",n}function MAe(e){const t={};let n;for(n in e)BO.call(e,n)&&(t[RAe(n)]=e[n]);return t}function RAe(e){let t=e.replace(hAe,AAe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function AAe(e){return"-"+e.toLowerCase()}const zE={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},OAe={};function VO(e,t){const n=OAe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pG(e,r,i)}function pG(e,t,n){if(DAe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return r3(e.children,t,n)}return Array.isArray(e)?r3(e,t,n):""}function r3(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=pG(e[i],t,n);return r.join("")}function DAe(e){return!!(e&&typeof e=="object")}const i3=document.createElement("i");function HO(e){const t="&"+e+";";i3.innerHTML=t;const n=i3.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Io(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function Xo(e,t){return e.length>0?(Io(e,e.length,0,t),e):t}const o3={}.hasOwnProperty;function mG(e){const t={};let n=-1;for(;++n<e.length;)PAe(t,e[n]);return t}function PAe(e,t){let n;for(n in t){const i=(o3.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){o3.call(i,a)||(i[a]=[]);const c=o[a];NAe(i[a],Array.isArray(c)?c:c?[c]:[])}}}function NAe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Io(e,0,0,r)}function gG(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ds(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Li=Bc(/[A-Za-z]/),_i=Bc(/[\dA-Za-z]/),LAe=Bc(/[#-'*+\--9=?A-Z^-~]/);function rx(e){return e!==null&&(e<32||e===127)}const EI=Bc(/\d/),$Ae=Bc(/[\dA-Fa-f]/),jAe=Bc(/[!-/:-@[-`{-~]/);function et(e){return e!==null&&e<-2}function Cn(e){return e!==null&&(e<0||e===32)}function Pt(e){return e===-2||e===-1||e===32}const Bw=Bc(new RegExp("\\p{P}|\\p{S}","u")),fd=Bc(/\s/);function Bc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hp(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&_i(e.charCodeAt(n+1))&&_i(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(a=String.fromCharCode(o,c),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Kt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(u){return Pt(u)?(e.enter(n),c(u)):t(u)}function c(u){return Pt(u)&&o++<i?(e.consume(u),c):(e.exit(n),t(u))}}const FAe={tokenize:zAe};function zAe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Kt(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),o(c)}function o(c){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(c)}function a(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return et(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),a)}}const BAe={tokenize:UAe},s3={tokenize:qAe};function UAe(e){const t=this,n=[];let r=0,i,o,a;return c;function c(E){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,u,d)(E)}return d(E)}function u(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const M=t.events.length;let D=M,T;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){T=t.events[D][1].end;break}k(r);let C=M;for(;C<t.events.length;)t.events[C][1].end={...T},C++;return Io(t.events,D+1,0,t.events.slice(M)),t.events.length=C,d(E)}return c(E)}function d(E){if(r===n.length){if(!i)return y(E);if(i.currentConstruct&&i.currentConstruct.concrete)return v(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(s3,h,p)(E)}function h(E){return i&&_(),k(r),y(E)}function p(E){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,v(E)}function y(E){return t.containerState={},e.attempt(s3,g,v)(E)}function g(E){return r++,n.push([t.currentConstruct,t.containerState]),y(E)}function v(E){if(E===null){i&&_(),k(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),S(E)}function S(E){if(E===null){x(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return et(E)?(e.consume(E),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(E),S)}function x(E,M){const D=t.sliceStream(E);if(M&&D.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(D),t.parser.lazy[E.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<a&&(!i.events[T][1].end||i.events[T][1].end.offset>a))return;const C=t.events.length;let O=C,q,I;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(q){I=t.events[O][1].end;break}q=!0}for(k(r),T=C;T<t.events.length;)t.events[T][1].end={...I},T++;Io(t.events,O+1,0,t.events.slice(C)),t.events.length=T}}function k(E){let M=n.length;for(;M-- >E;){const D=n[M];t.containerState=D[1],D[0].exit.call(t,e)}n.length=E}function _(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function qAe(e,t,n){return Kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Dh(e){if(e===null||Cn(e)||fd(e))return 1;if(Bw(e))return 2}function Uw(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const TI={name:"attention",resolveAll:VAe,tokenize:HAe};function VAe(e,t){let n=-1,r,i,o,a,c,u,d,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},y={...e[n][1].start};a3(p,-u),a3(y,u),a={type:u>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...a.start},end:{...c.end}},e[r][1].end={...a.start},e[n][1].start={...c.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Xo(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Xo(d,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),d=Xo(d,Uw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Xo(d,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,d=Xo(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Io(e,r-1,n-r+3,d),n=r+d.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HAe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Dh(r);let o;return a;function a(u){return o=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===o)return e.consume(u),c;const d=e.exit("attentionSequence"),h=Dh(u),p=!h||h===2&&i||n.includes(u),y=!i||i===2&&h||n.includes(r);return d._open=!!(o===42?p:p&&(i||!y)),d._close=!!(o===42?y:y&&(h||!p)),t(u)}}function a3(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const KAe={name:"autolink",tokenize:WAe};function WAe(e,t,n){let r=0;return i;function i(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(g){return Li(g)?(e.consume(g),a):g===64?n(g):d(g)}function a(g){return g===43||g===45||g===46||_i(g)?(r=1,c(g)):d(g)}function c(g){return g===58?(e.consume(g),r=0,u):(g===43||g===45||g===46||_i(g))&&r++<32?(e.consume(g),c):(r=0,d(g))}function u(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||rx(g)?n(g):(e.consume(g),u)}function d(g){return g===64?(e.consume(g),h):LAe(g)?(e.consume(g),d):n(g)}function h(g){return _i(g)?p(g):n(g)}function p(g){return g===46?(e.consume(g),r=0,h):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):y(g)}function y(g){if((g===45||_i(g))&&r++<63){const v=g===45?y:p;return e.consume(g),v}return n(g)}}const tb={partial:!0,tokenize:GAe};function GAe(e,t,n){return r;function r(o){return Pt(o)?Kt(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||et(o)?t(o):n(o)}}const yG={continuation:{tokenize:QAe},exit:XAe,name:"blockQuote",tokenize:YAe};function YAe(e,t,n){const r=this;return i;function i(a){if(a===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return Pt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function QAe(e,t,n){const r=this;return i;function i(a){return Pt(a)?Kt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(yG,t,n)(a)}}function XAe(e){e.exit("blockQuote")}const bG={name:"characterEscape",tokenize:JAe};function JAe(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return jAe(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const vG={name:"characterReference",tokenize:ZAe};function ZAe(e,t,n){const r=this;let i=0,o,a;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),o=31,a=_i,h(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=$Ae,h):(e.enter("characterReferenceValue"),o=7,a=EI,h(p))}function h(p){if(p===59&&i){const y=e.exit("characterReferenceValue");return a===_i&&!HO(r.sliceSerialize(y))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(p)&&i++<o?(e.consume(p),h):n(p)}}const l3={partial:!0,tokenize:tOe},c3={concrete:!0,name:"codeFenced",tokenize:eOe};function eOe(e,t,n){const r=this,i={partial:!0,tokenize:D};let o=0,a=0,c;return u;function u(T){return d(T)}function d(T){const C=r.events[r.events.length-1];return o=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,c=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(T)}function h(T){return T===c?(a++,e.consume(T),h):a<3?n(T):(e.exit("codeFencedFenceSequence"),Pt(T)?Kt(e,p,"whitespace")(T):p(T))}function p(T){return T===null||et(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(l3,S,M)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===null||et(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(T)):Pt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Kt(e,g,"whitespace")(T)):T===96&&T===c?n(T):(e.consume(T),y)}function g(T){return T===null||et(T)?p(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===null||et(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(T)):T===96&&T===c?n(T):(e.consume(T),v)}function S(T){return e.attempt(i,M,x)(T)}function x(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),k}function k(T){return o>0&&Pt(T)?Kt(e,_,"linePrefix",o+1)(T):_(T)}function _(T){return T===null||et(T)?e.check(l3,S,M)(T):(e.enter("codeFlowValue"),E(T))}function E(T){return T===null||et(T)?(e.exit("codeFlowValue"),_(T)):(e.consume(T),E)}function M(T){return e.exit("codeFenced"),t(T)}function D(T,C,O){let q=0;return I;function I(V){return T.enter("lineEnding"),T.consume(V),T.exit("lineEnding"),L}function L(V){return T.enter("codeFencedFence"),Pt(V)?Kt(T,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):P(V)}function P(V){return V===c?(T.enter("codeFencedFenceSequence"),B(V)):O(V)}function B(V){return V===c?(q++,T.consume(V),B):q>=a?(T.exit("codeFencedFenceSequence"),Pt(V)?Kt(T,$,"whitespace")(V):$(V)):O(V)}function $(V){return V===null||et(V)?(T.exit("codeFencedFence"),C(V)):O(V)}}}function tOe(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const BE={name:"codeIndented",tokenize:rOe},nOe={partial:!0,tokenize:iOe};function rOe(e,t,n){const r=this;return i;function i(d){return e.enter("codeIndented"),Kt(e,o,"linePrefix",5)(d)}function o(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?u(d):et(d)?e.attempt(nOe,a,u)(d):(e.enter("codeFlowValue"),c(d))}function c(d){return d===null||et(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),c)}function u(d){return e.exit("codeIndented"),t(d)}}function iOe(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):et(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Kt(e,o,"linePrefix",5)(a)}function o(a){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(a):et(a)?i(a):n(a)}}const oOe={name:"codeText",previous:aOe,resolve:sOe,tokenize:lOe};function sOe(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function aOe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lOe(e,t,n){let r=0,i,o;return a;function a(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),r++,c):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(o=e.enter("codeTextSequence"),i=0,h(p)):et(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||et(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),d)}function h(p){return p===96?(e.consume(p),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",d(p))}}class cOe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&xm(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),xm(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xm(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);xm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);xm(this.left,n.reverse())}}}function xm(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function SG(e){const t={};let n=-1,r,i,o,a,c,u,d;const h=new cOe(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,uOe(h,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=h.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},c=h.slice(i,n),c.unshift(r),h.splice(i,n-i+1,c))}}return Io(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!d}function uOe(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const c=a.events,u=[],d={};let h,p,y=-1,g=n,v=0,S=0;const x=[S];for(;g;){for(;e.get(++i)[1]!==g;);o.push(i),g._tokenizer||(h=r.sliceStream(g),g.next||h.push(null),p&&a.defineSkip(g.start),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),p=g,g=g.next}for(g=n;++y<c.length;)c[y][0]==="exit"&&c[y-1][0]==="enter"&&c[y][1].type===c[y-1][1].type&&c[y][1].start.line!==c[y][1].end.line&&(S=y+1,x.push(S),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(a.events=[],g?(g._tokenizer=void 0,g.previous=void 0):x.pop(),y=x.length;y--;){const k=c.slice(x[y],x[y+1]),_=o.pop();u.push([_,_+k.length-1]),e.splice(_,2,k)}for(u.reverse(),y=-1;++y<u.length;)d[v+u[y][0]]=v+u[y][1],v+=u[y][1]-u[y][0]-1;return d}const dOe={resolve:hOe,tokenize:pOe},fOe={partial:!0,tokenize:mOe};function hOe(e){return SG(e),e}function pOe(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?o(c):et(c)?e.check(fOe,a,o)(c):(e.consume(c),i)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function a(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function mOe(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Kt(e,o,"linePrefix")}function o(a){if(a===null||et(a))return n(a);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function xG(e,t,n,r,i,o,a,c,u){const d=u||Number.POSITIVE_INFINITY;let h=0;return p;function p(k){return k===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(k),e.exit(o),y):k===null||k===32||k===41||rx(k)?n(k):(e.enter(r),e.enter(a),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(k))}function y(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===62?(e.exit("chunkString"),e.exit(c),y(k)):k===null||k===60||et(k)?n(k):(e.consume(k),k===92?v:g)}function v(k){return k===60||k===62||k===92?(e.consume(k),g):g(k)}function S(k){return!h&&(k===null||k===41||Cn(k))?(e.exit("chunkString"),e.exit(c),e.exit(a),e.exit(r),t(k)):h<d&&k===40?(e.consume(k),h++,S):k===41?(e.consume(k),h--,S):k===null||k===32||k===40||rx(k)?n(k):(e.consume(k),k===92?x:S)}function x(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function wG(e,t,n,r,i,o){const a=this;let c=0,u;return d;function d(g){return e.enter(r),e.enter(i),e.consume(g),e.exit(i),e.enter(o),h}function h(g){return c>999||g===null||g===91||g===93&&!u||g===94&&!c&&"_hiddenFootnoteSupport"in a.parser.constructs?n(g):g===93?(e.exit(o),e.enter(i),e.consume(g),e.exit(i),e.exit(r),t):et(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===null||g===91||g===93||et(g)||c++>999?(e.exit("chunkString"),h(g)):(e.consume(g),u||(u=!Pt(g)),g===92?y:p)}function y(g){return g===91||g===92||g===93?(e.consume(g),c++,p):p(g)}}function kG(e,t,n,r,i,o){let a;return c;function c(y){return y===34||y===39||y===40?(e.enter(r),e.enter(i),e.consume(y),e.exit(i),a=y===40?41:y,u):n(y)}function u(y){return y===a?(e.enter(i),e.consume(y),e.exit(i),e.exit(r),t):(e.enter(o),d(y))}function d(y){return y===a?(e.exit(o),u(a)):y===null?n(y):et(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Kt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===a||y===null||et(y)?(e.exit("chunkString"),d(y)):(e.consume(y),y===92?p:h)}function p(y){return y===a||y===92?(e.consume(y),h):h(y)}}function sg(e,t){let n;return r;function r(i){return et(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Pt(i)?Kt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const gOe={name:"definition",tokenize:bOe},yOe={partial:!0,tokenize:vOe};function bOe(e,t,n){const r=this;let i;return o;function o(g){return e.enter("definition"),a(g)}function a(g){return wG.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function c(g){return i=Ds(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),u):n(g)}function u(g){return Cn(g)?sg(e,d)(g):d(g)}function d(g){return xG(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function h(g){return e.attempt(yOe,p,p)(g)}function p(g){return Pt(g)?Kt(e,y,"whitespace")(g):y(g)}function y(g){return g===null||et(g)?(e.exit("definition"),r.parser.defined.push(i),t(g)):n(g)}}function vOe(e,t,n){return r;function r(c){return Cn(c)?sg(e,i)(c):n(c)}function i(c){return kG(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Pt(c)?Kt(e,a,"whitespace")(c):a(c)}function a(c){return c===null||et(c)?t(c):n(c)}}const SOe={name:"hardBreakEscape",tokenize:xOe};function xOe(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return et(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const wOe={name:"headingAtx",resolve:kOe,tokenize:_Oe};function kOe(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Io(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function _Oe(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),o(h)}function o(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||Cn(h)?(e.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||et(h)?(e.exit("atxHeading"),t(h)):Pt(h)?Kt(e,c,"whitespace")(h):(e.enter("atxHeadingText"),d(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),c(h))}function d(h){return h===null||h===35||Cn(h)?(e.exit("atxHeadingText"),c(h)):(e.consume(h),d)}}const EOe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],u3=["pre","script","style","textarea"],TOe={concrete:!0,name:"htmlFlow",resolveTo:MOe,tokenize:ROe},COe={partial:!0,tokenize:OOe},IOe={partial:!0,tokenize:AOe};function MOe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ROe(e,t,n){const r=this;let i,o,a,c,u;return d;function d(z){return h(z)}function h(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),p}function p(z){return z===33?(e.consume(z),y):z===47?(e.consume(z),o=!0,S):z===63?(e.consume(z),i=3,r.interrupt?t:F):Li(z)?(e.consume(z),a=String.fromCharCode(z),x):n(z)}function y(z){return z===45?(e.consume(z),i=2,g):z===91?(e.consume(z),i=5,c=0,v):Li(z)?(e.consume(z),i=4,r.interrupt?t:F):n(z)}function g(z){return z===45?(e.consume(z),r.interrupt?t:F):n(z)}function v(z){const ne="CDATA[";return z===ne.charCodeAt(c++)?(e.consume(z),c===ne.length?r.interrupt?t:P:v):n(z)}function S(z){return Li(z)?(e.consume(z),a=String.fromCharCode(z),x):n(z)}function x(z){if(z===null||z===47||z===62||Cn(z)){const ne=z===47,ce=a.toLowerCase();return!ne&&!o&&u3.includes(ce)?(i=1,r.interrupt?t(z):P(z)):EOe.includes(a.toLowerCase())?(i=6,ne?(e.consume(z),k):r.interrupt?t(z):P(z)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):o?_(z):E(z))}return z===45||_i(z)?(e.consume(z),a+=String.fromCharCode(z),x):n(z)}function k(z){return z===62?(e.consume(z),r.interrupt?t:P):n(z)}function _(z){return Pt(z)?(e.consume(z),_):I(z)}function E(z){return z===47?(e.consume(z),I):z===58||z===95||Li(z)?(e.consume(z),M):Pt(z)?(e.consume(z),E):I(z)}function M(z){return z===45||z===46||z===58||z===95||_i(z)?(e.consume(z),M):D(z)}function D(z){return z===61?(e.consume(z),T):Pt(z)?(e.consume(z),D):E(z)}function T(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),u=z,C):Pt(z)?(e.consume(z),T):O(z)}function C(z){return z===u?(e.consume(z),u=null,q):z===null||et(z)?n(z):(e.consume(z),C)}function O(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||Cn(z)?D(z):(e.consume(z),O)}function q(z){return z===47||z===62||Pt(z)?E(z):n(z)}function I(z){return z===62?(e.consume(z),L):n(z)}function L(z){return z===null||et(z)?P(z):Pt(z)?(e.consume(z),L):n(z)}function P(z){return z===45&&i===2?(e.consume(z),j):z===60&&i===1?(e.consume(z),K):z===62&&i===4?(e.consume(z),U):z===63&&i===3?(e.consume(z),F):z===93&&i===5?(e.consume(z),J):et(z)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(COe,Q,B)(z)):z===null||et(z)?(e.exit("htmlFlowData"),B(z)):(e.consume(z),P)}function B(z){return e.check(IOe,$,Q)(z)}function $(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),V}function V(z){return z===null||et(z)?B(z):(e.enter("htmlFlowData"),P(z))}function j(z){return z===45?(e.consume(z),F):P(z)}function K(z){return z===47?(e.consume(z),a="",G):P(z)}function G(z){if(z===62){const ne=a.toLowerCase();return u3.includes(ne)?(e.consume(z),U):P(z)}return Li(z)&&a.length<8?(e.consume(z),a+=String.fromCharCode(z),G):P(z)}function J(z){return z===93?(e.consume(z),F):P(z)}function F(z){return z===62?(e.consume(z),U):z===45&&i===2?(e.consume(z),F):P(z)}function U(z){return z===null||et(z)?(e.exit("htmlFlowData"),Q(z)):(e.consume(z),U)}function Q(z){return e.exit("htmlFlow"),t(z)}}function AOe(e,t,n){const r=this;return i;function i(a){return et(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function OOe(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(tb,t,n)}}const DOe={name:"htmlText",tokenize:POe};function POe(e,t,n){const r=this;let i,o,a;return c;function c(F){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(F),u}function u(F){return F===33?(e.consume(F),d):F===47?(e.consume(F),D):F===63?(e.consume(F),E):Li(F)?(e.consume(F),O):n(F)}function d(F){return F===45?(e.consume(F),h):F===91?(e.consume(F),o=0,v):Li(F)?(e.consume(F),_):n(F)}function h(F){return F===45?(e.consume(F),g):n(F)}function p(F){return F===null?n(F):F===45?(e.consume(F),y):et(F)?(a=p,K(F)):(e.consume(F),p)}function y(F){return F===45?(e.consume(F),g):p(F)}function g(F){return F===62?j(F):F===45?y(F):p(F)}function v(F){const U="CDATA[";return F===U.charCodeAt(o++)?(e.consume(F),o===U.length?S:v):n(F)}function S(F){return F===null?n(F):F===93?(e.consume(F),x):et(F)?(a=S,K(F)):(e.consume(F),S)}function x(F){return F===93?(e.consume(F),k):S(F)}function k(F){return F===62?j(F):F===93?(e.consume(F),k):S(F)}function _(F){return F===null||F===62?j(F):et(F)?(a=_,K(F)):(e.consume(F),_)}function E(F){return F===null?n(F):F===63?(e.consume(F),M):et(F)?(a=E,K(F)):(e.consume(F),E)}function M(F){return F===62?j(F):E(F)}function D(F){return Li(F)?(e.consume(F),T):n(F)}function T(F){return F===45||_i(F)?(e.consume(F),T):C(F)}function C(F){return et(F)?(a=C,K(F)):Pt(F)?(e.consume(F),C):j(F)}function O(F){return F===45||_i(F)?(e.consume(F),O):F===47||F===62||Cn(F)?q(F):n(F)}function q(F){return F===47?(e.consume(F),j):F===58||F===95||Li(F)?(e.consume(F),I):et(F)?(a=q,K(F)):Pt(F)?(e.consume(F),q):j(F)}function I(F){return F===45||F===46||F===58||F===95||_i(F)?(e.consume(F),I):L(F)}function L(F){return F===61?(e.consume(F),P):et(F)?(a=L,K(F)):Pt(F)?(e.consume(F),L):q(F)}function P(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),i=F,B):et(F)?(a=P,K(F)):Pt(F)?(e.consume(F),P):(e.consume(F),$)}function B(F){return F===i?(e.consume(F),i=void 0,V):F===null?n(F):et(F)?(a=B,K(F)):(e.consume(F),B)}function $(F){return F===null||F===34||F===39||F===60||F===61||F===96?n(F):F===47||F===62||Cn(F)?q(F):(e.consume(F),$)}function V(F){return F===47||F===62||Cn(F)?q(F):n(F)}function j(F){return F===62?(e.consume(F),e.exit("htmlTextData"),e.exit("htmlText"),t):n(F)}function K(F){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),G}function G(F){return Pt(F)?Kt(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):J(F)}function J(F){return e.enter("htmlTextData"),a(F)}}const KO={name:"labelEnd",resolveAll:jOe,resolveTo:FOe,tokenize:zOe},NOe={tokenize:BOe},LOe={tokenize:UOe},$Oe={tokenize:qOe};function jOe(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Io(e,0,e.length,n),e}function FOe(e,t){let n=e.length,r=0,i,o,a,c;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return c=[["enter",u,t],["enter",d,t]],c=Xo(c,e.slice(o+1,o+r+3)),c=Xo(c,[["enter",h,t]]),c=Xo(c,Uw(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),c=Xo(c,[["exit",h,t],e[a-2],e[a-1],["exit",d,t]]),c=Xo(c,e.slice(a+1)),c=Xo(c,[["exit",u,t]]),Io(e,o,e.length,c),e}function zOe(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return c;function c(y){return o?o._inactive?p(y):(a=r.parser.defined.includes(Ds(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),u):n(y)}function u(y){return y===40?e.attempt(NOe,h,a?h:p)(y):y===91?e.attempt(LOe,h,a?d:p)(y):a?h(y):p(y)}function d(y){return e.attempt($Oe,h,p)(y)}function h(y){return t(y)}function p(y){return o._balanced=!0,n(y)}}function BOe(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return Cn(p)?sg(e,o)(p):o(p)}function o(p){return p===41?h(p):xG(e,a,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function a(p){return Cn(p)?sg(e,u)(p):h(p)}function c(p){return n(p)}function u(p){return p===34||p===39||p===40?kG(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):h(p)}function d(p){return Cn(p)?sg(e,h)(p):h(p)}function h(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function UOe(e,t,n){const r=this;return i;function i(c){return wG.call(r,e,o,a,"reference","referenceMarker","referenceString")(c)}function o(c){return r.parser.defined.includes(Ds(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function a(c){return n(c)}}function qOe(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const VOe={name:"labelStartImage",resolveAll:KO.resolveAll,tokenize:HOe};function HOe(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),a):n(c)}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const KOe={name:"labelStartLink",resolveAll:KO.resolveAll,tokenize:WOe};function WOe(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const UE={name:"lineEnding",tokenize:GOe};function GOe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Kt(e,t,"linePrefix")}}const US={name:"thematicBreak",tokenize:YOe};function YOe(e,t,n){let r=0,i;return o;function o(d){return e.enter("thematicBreak"),a(d)}function a(d){return i=d,c(d)}function c(d){return d===i?(e.enter("thematicBreakSequence"),u(d)):r>=3&&(d===null||et(d))?(e.exit("thematicBreak"),t(d)):n(d)}function u(d){return d===i?(e.consume(d),r++,u):(e.exit("thematicBreakSequence"),Pt(d)?Kt(e,c,"whitespace")(d):c(d))}}const Xi={continuation:{tokenize:ZOe},exit:tDe,name:"list",tokenize:JOe},QOe={partial:!0,tokenize:nDe},XOe={partial:!0,tokenize:eDe};function JOe(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return c;function c(g){const v=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:EI(g)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(US,n,d)(g):d(g);if(!r.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(g)}return n(g)}function u(g){return EI(g)&&++a<10?(e.consume(g),u):(!r.interrupt||a<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),d(g)):n(g)}function d(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,e.check(tb,r.interrupt?n:h,e.attempt(QOe,y,p))}function h(g){return r.containerState.initialBlankLine=!0,o++,y(g)}function p(g){return Pt(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),y):n(g)}function y(g){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function ZOe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(tb,i,o);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Kt(e,t,"listItemIndent",r.containerState.size+1)(c)}function o(c){return r.containerState.furtherBlankLines||!Pt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(XOe,t,a)(c))}function a(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Kt(e,e.attempt(Xi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function eDe(e,t,n){const r=this;return Kt(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function tDe(e){e.exit(this.containerState.type)}function nDe(e,t,n){const r=this;return Kt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Pt(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const d3={name:"setextUnderline",resolveTo:rDe,tokenize:iDe};function rDe(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function iDe(e,t,n){const r=this;let i;return o;function o(d){let h=r.events.length,p;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){p=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=d,a(d)):n(d)}function a(d){return e.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(e.consume(d),c):(e.exit("setextHeadingLineSequence"),Pt(d)?Kt(e,u,"lineSuffix")(d):u(d))}function u(d){return d===null||et(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const oDe={tokenize:sDe};function sDe(e){const t=this,n=e.attempt(tb,r,e.attempt(this.parser.constructs.flowInitial,i,Kt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(dOe,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aDe={resolveAll:EG()},lDe=_G("string"),cDe=_G("text");function _G(e){return{resolveAll:EG(e==="text"?uDe:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,c);return a;function a(h){return d(h)?o(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return d(h)?(n.exit("data"),o(h)):(n.consume(h),u)}function d(h){if(h===null)return!0;const p=i[h];let y=-1;if(p)for(;++y<p.length;){const g=p[y];if(!g.previous||g.previous.call(r,r.previous))return!0}return!1}}}function EG(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function uDe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,c=0,u;for(;o--;){const d=i[o];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)c++,a--;if(a)break;a=-1}else if(d===-2)u=!0,c++;else if(d!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const d={type:n===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const dDe={42:Xi,43:Xi,45:Xi,48:Xi,49:Xi,50:Xi,51:Xi,52:Xi,53:Xi,54:Xi,55:Xi,56:Xi,57:Xi,62:yG},fDe={91:gOe},hDe={[-2]:BE,[-1]:BE,32:BE},pDe={35:wOe,42:US,45:[d3,US],60:TOe,61:d3,95:US,96:c3,126:c3},mDe={38:vG,92:bG},gDe={[-5]:UE,[-4]:UE,[-3]:UE,33:VOe,38:vG,42:TI,60:[KAe,DOe],91:KOe,92:[SOe,bG],93:KO,95:TI,96:oOe},yDe={null:[TI,aDe]},bDe={null:[42,95]},vDe={null:[]},SDe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:bDe,contentInitial:fDe,disable:vDe,document:dDe,flow:pDe,flowInitial:hDe,insideSpan:yDe,string:mDe,text:gDe},Symbol.toStringTag,{value:"Module"}));function xDe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],c=[];const u={attempt:C(D),check:C(T),consume:_,enter:E,exit:M,interrupt:C(T,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:v,parser:e,previous:null,sliceSerialize:y,sliceStream:g,write:p};let h=t.tokenize.call(d,u);return t.resolveAll&&o.push(t),d;function p(L){return a=Xo(a,L),x(),a[a.length-1]!==null?[]:(O(t,0),d.events=Uw(o,d.events,d),d.events)}function y(L,P){return kDe(g(L),P)}function g(L){return wDe(a,L)}function v(){const{_bufferIndex:L,_index:P,line:B,column:$,offset:V}=r;return{_bufferIndex:L,_index:P,line:B,column:$,offset:V}}function S(L){i[L.line]=L.column,I()}function x(){let L;for(;r._index<a.length;){const P=a[r._index];if(typeof P=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<P.length;)k(P.charCodeAt(r._bufferIndex));else k(P)}}function k(L){h=h(L)}function _(L){et(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,I()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=L}function E(L,P){const B=P||{};return B.type=L,B.start=v(),d.events.push(["enter",B,d]),c.push(B),B}function M(L){const P=c.pop();return P.end=v(),d.events.push(["exit",P,d]),P}function D(L,P){O(L,P.from)}function T(L,P){P.restore()}function C(L,P){return B;function B($,V,j){let K,G,J,F;return Array.isArray($)?Q($):"tokenize"in $?Q([$]):U($);function U(Z){return ee;function ee(me){const fe=me!==null&&Z[me],ye=me!==null&&Z.null,ie=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return Q(ie)(me)}}function Q(Z){return K=Z,G=0,Z.length===0?j:z(Z[G])}function z(Z){return ee;function ee(me){return F=q(),J=Z,Z.partial||(d.currentConstruct=Z),Z.name&&d.parser.constructs.disable.null.includes(Z.name)?ce():Z.tokenize.call(P?Object.assign(Object.create(d),P):d,u,ne,ce)(me)}}function ne(Z){return L(J,F),V}function ce(Z){return F.restore(),++G<K.length?z(K[G]):j}}}function O(L,P){L.resolveAll&&!o.includes(L)&&o.push(L),L.resolve&&Io(d.events,P,d.events.length-P,L.resolve(d.events.slice(P),d)),L.resolveTo&&(d.events=L.resolveTo(d.events,d))}function q(){const L=v(),P=d.previous,B=d.currentConstruct,$=d.events.length,V=Array.from(c);return{from:$,restore:j};function j(){r=L,d.previous=P,d.currentConstruct=B,d.events.length=$,c=V,I()}}function I(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function wDe(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const c=a[0];typeof c=="string"?a[0]=c.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function kDe(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
149
+ `;break}case-3:{a=`\r
150
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function _De(e){const r={constructs:mG([SDe,...(e||{}).extensions||[]]),content:i(FAe),defined:[],document:i(BAe),flow:i(oDe),lazy:{},string:i(lDe),text:i(cDe)};return r;function i(o){return a;function a(c){return xDe(r,o,c)}}}function EDe(e){for(;!SG(e););return e}const f3=/[\0\t\n\r]/g;function TDe(){let e=1,t="",n=!0,r;return i;function i(o,a,c){const u=[];let d,h,p,y,g;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(f3.lastIndex=p,d=f3.exec(o),y=d&&d.index!==void 0?d.index:o.length,g=o.charCodeAt(y),!d){t=o.slice(p);break}if(g===10&&p===y&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),p<y&&(u.push(o.slice(p,y)),e+=y-p),g){case 0:{u.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,u.push(-2);e++<h;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}p=y+1}return c&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const CDe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IDe(e){return e.replace(CDe,MDe)}function MDe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return gG(n.slice(o?2:1),o?16:10)}return HO(n)||e}const TG={}.hasOwnProperty;function RDe(e,t,n){return typeof t!="string"&&(n=t,t=void 0),ADe(n)(EDe(_De(n).document().write(TDe()(e,t,!0))))}function ADe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Et),autolinkProtocol:q,autolinkEmail:q,atxHeading:o(Xe),blockQuote:o(ye),characterEscape:q,characterReference:q,codeFenced:o(ie),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(ie,a),codeText:o(xe,a),codeTextData:q,data:q,codeFlowValue:q,definition:o(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Ke),hardBreakEscape:o(Je),hardBreakTrailing:o(Je),htmlFlow:o(dt,a),htmlFlowData:q,htmlText:o(dt,a),htmlTextData:q,image:o(Ht),label:a,link:o(Et),listItem:o(Mn),listItemValue:y,listOrdered:o(Ue,p),listUnordered:o(Ue),paragraph:o(nn),reference:z,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Xe),strong:o(Rn),thematicBreak:o(Zn)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:fe,autolinkProtocol:me,blockQuote:u(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:Z,characterReference:ee,codeFenced:u(x),codeFencedFence:S,codeFencedFenceInfo:g,codeFencedFenceMeta:v,codeFlowValue:I,codeIndented:u(k),codeText:u(V),codeTextData:I,data:I,definition:u(),definitionDestinationString:M,definitionLabelString:_,definitionTitleString:E,emphasis:u(),hardBreakEscape:u(P),hardBreakTrailing:u(P),htmlFlow:u(B),htmlFlowData:I,htmlText:u($),htmlTextData:I,image:u(K),label:J,labelText:G,lineEnding:L,link:u(j),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ne,resourceDestinationString:F,resourceTitleString:U,resource:Q,setextHeading:u(O),setextHeadingLineSequence:C,setextHeadingText:T,strong:u(),thematicBreak:u()}};CG(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let we={type:"root",children:[]};const Ne={stack:[we],tokenStack:[],config:t,enter:c,exit:d,buffer:a,resume:h,data:n},We=[];let Ve=-1;for(;++Ve<ue.length;)if(ue[Ve][1].type==="listOrdered"||ue[Ve][1].type==="listUnordered")if(ue[Ve][0]==="enter")We.push(Ve);else{const Jt=We.pop();Ve=i(ue,Jt,Ve)}for(Ve=-1;++Ve<ue.length;){const Jt=t[ue[Ve][0]];TG.call(Jt,ue[Ve][1].type)&&Jt[ue[Ve][1].type].call(Object.assign({sliceSerialize:ue[Ve][2].sliceSerialize},Ne),ue[Ve][1])}if(Ne.tokenStack.length>0){const Jt=Ne.tokenStack[Ne.tokenStack.length-1];(Jt[1]||h3).call(Ne,void 0,Jt[0])}for(we.position={start:Zl(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Zl(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<t.transforms.length;)we=t.transforms[Ve](we)||we;return we}function i(ue,we,Ne){let We=we-1,Ve=-1,Jt=!1,Gt,gt,mt,Le;for(;++We<=Ne;){const tt=ue[We];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?Ve++:Ve--,Le=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Gt&&!Le&&!Ve&&!mt&&(mt=We),Le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Le=void 0}if(!Ve&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||Ve===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Gt){let ln=We;for(gt=void 0;ln--;){const oe=ue[ln];if(oe[1].type==="lineEnding"||oe[1].type==="lineEndingBlank"){if(oe[0]==="exit")continue;gt&&(ue[gt][1].type="lineEndingBlank",Jt=!0),oe[1].type="lineEnding",gt=ln}else if(!(oe[1].type==="linePrefix"||oe[1].type==="blockQuotePrefix"||oe[1].type==="blockQuotePrefixWhitespace"||oe[1].type==="blockQuoteMarker"||oe[1].type==="listItemIndent"))break}mt&&(!gt||mt<gt)&&(Gt._spread=!0),Gt.end=Object.assign({},gt?ue[gt][1].start:tt[1].end),ue.splice(gt||We,0,["exit",Gt,tt[2]]),We++,Ne++}if(tt[1].type==="listItemPrefix"){const ln={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Gt=ln,ue.splice(We,0,["enter",ln,tt[2]]),We++,Ne++,mt=void 0,Le=!0}}}return ue[we][1]._spread=Jt,Ne}function o(ue,we){return Ne;function Ne(We){c.call(this,ue(We),We),we&&we.call(this,We)}}function a(){this.stack.push({type:"fragment",children:[]})}function c(ue,we,Ne){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([we,Ne||void 0]),ue.position={start:Zl(we.start),end:void 0}}function u(ue){return we;function we(Ne){ue&&ue.call(this,Ne),d.call(this,Ne)}}function d(ue,we){const Ne=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==ue.type&&(we?we.call(this,ue,We[0]):(We[1]||h3).call(this,ue,We[0]));else throw new Error("Cannot close `"+ue.type+"` ("+og({start:ue.start,end:ue.end})+"): it’s not open");Ne.position.end=Zl(ue.end)}function h(){return VO(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function y(ue){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function g(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.lang=ue}function v(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.meta=ue}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue.replace(/(\r?\n|\r)$/g,"")}function _(ue){const we=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=we,Ne.identifier=Ds(this.sliceSerialize(ue)).toLowerCase()}function E(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.title=ue}function M(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.url=ue}function D(ue){const we=this.stack[this.stack.length-1];if(!we.depth){const Ne=this.sliceSerialize(ue).length;we.depth=Ne}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function C(ue){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function q(ue){const Ne=this.stack[this.stack.length-1].children;let We=Ne[Ne.length-1];(!We||We.type!=="text")&&(We=pt(),We.position={start:Zl(ue.start),end:void 0},Ne.push(We)),this.stack.push(We)}function I(ue){const we=this.stack.pop();we.value+=this.sliceSerialize(ue),we.position.end=Zl(ue.end)}function L(ue){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=we.children[we.children.length-1];Ne.position.end=Zl(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(q.call(this,ue),I.call(this,ue))}function P(){this.data.atHardBreak=!0}function B(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function $(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function V(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function j(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=we,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function K(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=we,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function G(ue){const we=this.sliceSerialize(ue),Ne=this.stack[this.stack.length-2];Ne.label=IDe(we),Ne.identifier=Ds(we).toLowerCase()}function J(){const ue=this.stack[this.stack.length-1],we=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const We=ue.children;Ne.children=We}else Ne.alt=we}function F(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.url=ue}function U(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.title=ue}function Q(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function ne(ue){const we=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=we,Ne.identifier=Ds(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function ce(ue){this.data.characterReferenceType=ue.type}function Z(ue){const we=this.sliceSerialize(ue),Ne=this.data.characterReferenceType;let We;Ne?(We=gG(we,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=HO(we);const Ve=this.stack[this.stack.length-1];Ve.value+=We}function ee(ue){const we=this.stack.pop();we.position.end=Zl(ue.end)}function me(ue){I.call(this,ue);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(ue)}function fe(ue){I.call(this,ue);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(ue)}function ye(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function Xe(){return{type:"heading",depth:0,children:[]}}function Je(){return{type:"break"}}function dt(){return{type:"html",value:""}}function Ht(){return{type:"image",title:null,url:"",alt:null}}function Et(){return{type:"link",title:null,url:"",children:[]}}function Ue(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Mn(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function nn(){return{type:"paragraph",children:[]}}function Rn(){return{type:"strong",children:[]}}function pt(){return{type:"text",value:""}}function Zn(){return{type:"thematicBreak"}}}function Zl(e){return{line:e.line,column:e.column,offset:e.offset}}function CG(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?CG(e,r):ODe(e,r)}}function ODe(e,t){let n;for(n in t)if(TG.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function h3(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+og({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+og({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+og({start:t.start,end:t.end})+") is still open")}function DDe(e){const t=this;t.parser=n;function n(r){return RDe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function PDe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function NDe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
151
+ `}]}function LDe(e,t){const n=t.value?t.value+`
152
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function $De(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jDe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FDe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=hp(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,c+=1,e.footnoteCounts.set(r,c);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const d={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,d),e.applyData(t,d)}function zDe(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BDe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function IG(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function UDe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return IG(e,t);const i={src:hp(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function qDe(e,t){const n={src:hp(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function VDe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function HDe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return IG(e,t);const i={href:hp(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function KDe(e,t){const n={href:hp(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function WDe(e,t,n){const r=e.all(t),i=n?GDe(n):MG(t),o={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let p;h&&h.type==="element"&&h.tagName==="p"?p=h:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const h=r[c];(i||c!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
153
+ `}),h.type==="element"&&h.tagName==="p"&&!i?a.push(...h.children):a.push(h)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
154
+ `});const d={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,d),e.applyData(t,d)}function GDe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=MG(n[r])}return t}function MG(e){const t=e.spread;return t??e.children.length>1}function YDe(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function QDe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XDe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function JDe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZDe(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=zO(t.children[1]),u=lG(t.children[t.children.length-1]);c&&u&&(a.position={start:c,end:u}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function ePe(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,c=a?a.length:t.children.length;let u=-1;const d=[];for(;++u<c;){const p=t.children[u],y={},g=a?a[u]:void 0;g&&(y.align=g);let v={type:"element",tagName:o,properties:y,children:[]};p&&(v.children=e.all(p),e.patch(p,v),v=e.applyData(p,v)),d.push(v)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,h),e.applyData(t,h)}function tPe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const p3=9,m3=32;function nPe(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(g3(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(g3(t.slice(i),i>0,!1)),o.join("")}function g3(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===p3||o===m3;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===p3||o===m3;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function rPe(e,t){const n={type:"text",value:nPe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function iPe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const oPe={blockquote:PDe,break:NDe,code:LDe,delete:$De,emphasis:jDe,footnoteReference:FDe,heading:zDe,html:BDe,imageReference:UDe,image:qDe,inlineCode:VDe,linkReference:HDe,link:KDe,listItem:WDe,list:YDe,paragraph:QDe,root:XDe,strong:JDe,table:ZDe,tableCell:tPe,tableRow:ePe,text:rPe,thematicBreak:iPe,toml:tS,yaml:tS,definition:tS,footnoteDefinition:tS};function tS(){}const RG=-1,qw=0,ag=1,ix=2,WO=3,GO=4,YO=5,QO=6,AG=7,OG=8,y3=typeof self=="object"?self:globalThis,sPe=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case qw:case RG:return n(a,i);case ag:{const c=n([],i);for(const u of a)c.push(r(u));return c}case ix:{const c=n({},i);for(const[u,d]of a)c[r(u)]=r(d);return c}case WO:return n(new Date(a),i);case GO:{const{source:c,flags:u}=a;return n(new RegExp(c,u),i)}case YO:{const c=n(new Map,i);for(const[u,d]of a)c.set(r(u),r(d));return c}case QO:{const c=n(new Set,i);for(const u of a)c.add(r(u));return c}case AG:{const{name:c,message:u}=a;return n(new y3[c](u),i)}case OG:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:c}=new Uint8Array(a);return n(new DataView(c),a)}}return n(new y3[o](a),i)};return r},b3=e=>sPe(new Map,e)(0),Ef="",{toString:aPe}={},{keys:lPe}=Object,wm=e=>{const t=typeof e;if(t!=="object"||!e)return[qw,t];const n=aPe.call(e).slice(8,-1);switch(n){case"Array":return[ag,Ef];case"Object":return[ix,Ef];case"Date":return[WO,Ef];case"RegExp":return[GO,Ef];case"Map":return[YO,Ef];case"Set":return[QO,Ef];case"DataView":return[ag,n]}return n.includes("Array")?[ag,n]:n.includes("Error")?[AG,n]:[ix,n]},nS=([e,t])=>e===qw&&(t==="function"||t==="symbol"),cPe=(e,t,n,r)=>{const i=(a,c)=>{const u=r.push(a)-1;return n.set(c,u),u},o=a=>{if(n.has(a))return n.get(a);let[c,u]=wm(a);switch(c){case qw:{let h=a;switch(u){case"bigint":c=OG,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([RG],a)}return i([c,h],a)}case ag:{if(u){let y=a;return u==="DataView"?y=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(y=new Uint8Array(a)),i([u,[...y]],a)}const h=[],p=i([c,h],a);for(const y of a)h.push(o(y));return p}case ix:{if(u)switch(u){case"BigInt":return i([u,a.toString()],a);case"Boolean":case"Number":case"String":return i([u,a.valueOf()],a)}if(t&&"toJSON"in a)return o(a.toJSON());const h=[],p=i([c,h],a);for(const y of lPe(a))(e||!nS(wm(a[y])))&&h.push([o(y),o(a[y])]);return p}case WO:return i([c,a.toISOString()],a);case GO:{const{source:h,flags:p}=a;return i([c,{source:h,flags:p}],a)}case YO:{const h=[],p=i([c,h],a);for(const[y,g]of a)(e||!(nS(wm(y))||nS(wm(g))))&&h.push([o(y),o(g)]);return p}case QO:{const h=[],p=i([c,h],a);for(const y of a)(e||!nS(wm(y)))&&h.push(o(y));return p}}const{message:d}=a;return i([c,{name:u,message:d}],a)};return o},v3=(e,{json:t,lossy:n}={})=>{const r=[];return cPe(!(t||n),!!t,new Map,r)(e),r},ox=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?b3(v3(e,t)):structuredClone(e):(e,t)=>b3(v3(e,t));function uPe(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function dPe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function fPe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||uPe,r=e.options.footnoteBackLabel||dPe,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const h=e.all(d),p=String(d.identifier).toUpperCase(),y=hp(p.toLowerCase());let g=0;const v=[],S=e.footnoteCounts.get(p);for(;S!==void 0&&++g<=S;){v.length>0&&v.push({type:"text",value:" "});let _=typeof n=="string"?n:n(u,g);typeof _=="string"&&(_={type:"text",value:_}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,g),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const x=h[h.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const _=x.children[x.children.length-1];_&&_.type==="text"?_.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...v)}else h.push(...v);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(d,k),c.push(k)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ox(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
155
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
156
+ `}]}}const Vw=(function(e){if(e==null)return gPe;if(typeof e=="function")return Hw(e);if(typeof e=="object")return Array.isArray(e)?hPe(e):pPe(e);if(typeof e=="string")return mPe(e);throw new Error("Expected function, string, or object as test")});function hPe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Vw(e[n]);return Hw(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function pPe(e){const t=e;return Hw(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function mPe(e){return Hw(t);function t(n){return n&&n.type===e}}function Hw(e){return t;function t(n,r,i){return!!(yPe(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function gPe(){return!0}function yPe(e){return e!==null&&typeof e=="object"&&"type"in e}const DG=[],bPe=!0,CI=!1,vPe="skip";function PG(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Vw(i),a=r?-1:1;c(e,void 0,[])();function c(u,d,h){const p=u&&typeof u=="object"?u:{};if(typeof p.type=="string"){const g=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(u.type+(g?"<"+g+">":""))+")"})}return y;function y(){let g=DG,v,S,x;if((!t||o(u,d,h[h.length-1]||void 0))&&(g=SPe(n(u,h)),g[0]===CI))return g;if("children"in u&&u.children){const k=u;if(k.children&&g[0]!==vPe)for(S=(r?k.children.length:-1)+a,x=h.concat(k);S>-1&&S<k.children.length;){const _=k.children[S];if(v=c(_,S,x)(),v[0]===CI)return v;S=typeof v[1]=="number"?v[1]:S+a}}return g}}}function SPe(e){return Array.isArray(e)?e:typeof e=="number"?[bPe,e]:e==null?DG:[e]}function XO(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),PG(e,o,c,i);function c(u,d){const h=d[d.length-1],p=h?h.children.indexOf(u):void 0;return a(u,p,h)}}const II={}.hasOwnProperty,xPe={};function wPe(e,t){const n=t||xPe,r=new Map,i=new Map,o=new Map,a={...oPe,...n.handlers},c={all:d,applyData:_Pe,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:u,options:n,patch:kPe,wrap:TPe};return XO(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const p=h.type==="definition"?r:i,y=String(h.identifier).toUpperCase();p.has(y)||p.set(y,h)}}),c;function u(h,p){const y=h.type,g=c.handlers[y];if(II.call(c.handlers,y)&&g)return g(c,h,p);if(c.options.passThrough&&c.options.passThrough.includes(y)){if("children"in h){const{children:S,...x}=h,k=ox(x);return k.children=c.all(h),k}return ox(h)}return(c.options.unknownHandler||EPe)(c,h,p)}function d(h){const p=[];if("children"in h){const y=h.children;let g=-1;for(;++g<y.length;){const v=c.one(y[g],h);if(v){if(g&&y[g-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=S3(v.value)),!Array.isArray(v)&&v.type==="element")){const S=v.children[0];S&&S.type==="text"&&(S.value=S3(S.value))}Array.isArray(v)?p.push(...v):p.push(v)}}}return p}}function kPe(e,t){e.position&&(t.position=dAe(e))}function _Pe(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,ox(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function EPe(e,t){const n=t.data||{},r="value"in t&&!(II.call(n,"hProperties")||II.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function TPe(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
157
+ `});++r<e.length;)r&&n.push({type:"text",value:`
158
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
159
+ `}),n}function S3(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function x3(e,t){const n=wPe(e,t),r=n.one(e,void 0),i=fPe(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
160
+ `},i),o}function CPe(e,t){return e&&"run"in e?async function(n,r){const i=x3(n,{file:r,...t});await e.run(i,r)}:function(n,r){return x3(n,{file:r,...e||t})}}function w3(e){if(e)throw e}var qE,k3;function IPe(){if(k3)return qE;k3=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},o=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var h=e.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!p)return!1;var y;for(y in d);return typeof y>"u"||e.call(d,y)},a=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},c=function(d,h){if(h==="__proto__")if(e.call(d,h)){if(r)return r(d,h).value}else return;return d[h]};return qE=function u(){var d,h,p,y,g,v,S=arguments[0],x=1,k=arguments.length,_=!1;for(typeof S=="boolean"&&(_=S,S=arguments[1]||{},x=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});x<k;++x)if(d=arguments[x],d!=null)for(h in d)p=c(S,h),y=c(d,h),S!==y&&(_&&y&&(o(y)||(g=i(y)))?(g?(g=!1,v=p&&i(p)?p:[]):v=p&&o(p)?p:{},a(S,{name:h,newValue:u(_,v,y)})):typeof y<"u"&&a(S,{name:h,newValue:y}));return S},qE}var MPe=IPe();const VE=px(MPe);function MI(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function RPe(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...i);function c(u,...d){const h=e[++o];let p=-1;if(u){a(u);return}for(;++p<i.length;)(d[p]===null||d[p]===void 0)&&(d[p]=i[p]);i=d,h?APe(h,c)(...d):a(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function APe(e,t){let n;return r;function r(...a){const c=e.length>a.length;let u;c&&a.push(i);try{u=e.apply(this,a)}catch(d){const h=d;if(c&&n)throw h;return i(h)}c||(u&&u.then&&typeof u.then=="function"?u.then(o,i):u instanceof Error?i(u):o(u))}function i(a,...c){n||(n=!0,t(a,...c))}function o(a){i(null,a)}}const Ys={basename:OPe,dirname:DPe,extname:PPe,join:NPe,sep:"/"};function OPe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');nb(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(r=i):(c=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function DPe(e){if(nb(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function PPe(e){nb(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const c=e.codePointAt(t);if(c===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),c===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function NPe(...e){let t=-1,n;for(;++t<e.length;)nb(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":LPe(n)}function LPe(e){nb(e);const t=e.codePointAt(0)===47;let n=$Pe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function $Pe(e,t){let n="",r=0,i=-1,o=0,a=-1,c,u;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else c===46&&o>-1?o++:o=-1}return n}function nb(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jPe={cwd:FPe};function FPe(){return"/"}function RI(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function zPe(e){if(typeof e=="string")e=new URL(e);else if(!RI(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return BPe(e)}function BPe(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const HE=["history","path","basename","stem","extname","dirname"];class NG{constructor(t){let n;t?RI(t)?n={path:t}:typeof t=="string"||UPe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":jPe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<HE.length;){const o=HE[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)HE.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ys.basename(this.path):void 0}set basename(t){WE(t,"basename"),KE(t,"basename"),this.path=Ys.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ys.dirname(this.path):void 0}set dirname(t){_3(this.basename,"dirname"),this.path=Ys.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ys.extname(this.path):void 0}set extname(t){if(KE(t,"extname"),_3(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ys.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){RI(t)&&(t=zPe(t)),WE(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ys.basename(this.path,this.extname):void 0}set stem(t){WE(t,"stem"),KE(t,"stem"),this.path=Ys.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ii(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function KE(e,t){if(e&&e.includes(Ys.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ys.sep+"`")}function WE(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function _3(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function UPe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qPe=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),VPe={}.hasOwnProperty;class JO extends qPe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=RPe()}copy(){const t=new JO;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(VE(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(QE("data",this.frozen),this.namespace[t]=n,this):VPe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(QE("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=rS(t),r=this.parser||this.Parser;return GE("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),GE("process",this.parser||this.Parser),YE("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,a){const c=rS(t),u=r.parse(c);r.run(u,c,function(h,p,y){if(h||!p||!y)return d(h);const g=p,v=r.stringify(g,y);WPe(v)?y.value=v:y.result=v,d(h,y)});function d(h,p){h||!p?a(h):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),GE("processSync",this.parser||this.Parser),YE("processSync",this.compiler||this.Compiler),this.process(t,i),T3("processSync","process",n),r;function i(o,a){n=!0,w3(o),r=a}}run(t,n,r){E3(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,c){const u=rS(n);i.run(t,u,d);function d(h,p,y){const g=p||t;h?c(h):a?a(g):r(void 0,g,y)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),T3("runSync","run",r),i;function o(a,c){w3(a),i=c,r=!0}}stringify(t,n){this.freeze();const r=rS(n),i=this.compiler||this.Compiler;return YE("stringify",i),E3(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(QE("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(d){if(typeof d=="function")u(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[h,...p]=d;u(h,p)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(d.plugins),d.settings&&(i.settings=VE(!0,i.settings,d.settings))}function c(d){let h=-1;if(d!=null)if(Array.isArray(d))for(;++h<d.length;){const p=d[h];o(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function u(d,h){let p=-1,y=-1;for(;++p<r.length;)if(r[p][0]===d){y=p;break}if(y===-1)r.push([d,...h]);else if(h.length>0){let[g,...v]=h;const S=r[y][1];MI(S)&&MI(g)&&(g=VE(!0,S,g)),r[y]=[d,g,...v]}}}}const HPe=new JO().freeze();function GE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function YE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function QE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function E3(e){if(!MI(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function T3(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function rS(e){return KPe(e)?e:new NG(e)}function KPe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function WPe(e){return typeof e=="string"||GPe(e)}function GPe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YPe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",C3=[],I3={allowDangerousHtml:!0},QPe=/^(https?|ircs?|mailto|xmpp)$/i,XPe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function JPe(e){const t=ZPe(e),n=eNe(e);return tNe(t.runSync(t.parse(n),n),e)}function ZPe(e){const t=e.rehypePlugins||C3,n=e.remarkPlugins||C3,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...I3}:I3;return HPe().use(DDe).use(n).use(CPe,r).use(t)}function eNe(e){const t=e.children||"",n=new NG;return typeof t=="string"&&(n.value=t),n}function tNe(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,a=t.skipHtml,c=t.unwrapDisallowed,u=t.urlTransform||nNe;for(const h of XPe)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+YPe+h.id,void 0);return XO(e,d),gAe(e,{Fragment:N.Fragment,components:i,ignoreInvalidStyle:!0,jsx:N.jsx,jsxs:N.jsxs,passKeys:!0,passNode:!0});function d(h,p,y){if(h.type==="raw"&&y&&typeof p=="number")return a?y.children.splice(p,1):y.children[p]={type:"text",value:h.value},p;if(h.type==="element"){let g;for(g in zE)if(Object.hasOwn(zE,g)&&Object.hasOwn(h.properties,g)){const v=h.properties[g],S=zE[g];(S===null||S.includes(h.tagName))&&(h.properties[g]=u(String(v||""),g,h))}}if(h.type==="element"){let g=n?!n.includes(h.tagName):o?o.includes(h.tagName):!1;if(!g&&r&&typeof p=="number"&&(g=!r(h,p,y)),g&&y&&typeof p=="number")return c&&h.children?y.children.splice(p,1,...h.children):y.children.splice(p,1),p}}}function nNe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||QPe.test(e.slice(0,t))?e:""}function M3(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function rNe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iNe(e,t,n){const i=Vw((n||{}).ignore||[]),o=oNe(t);let a=-1;for(;++a<o.length;)PG(e,"text",c);function c(d,h){let p=-1,y;for(;++p<h.length;){const g=h[p],v=y?y.children:void 0;if(i(g,v?v.indexOf(g):void 0,y))return;y=g}if(y)return u(d,h)}function u(d,h){const p=h[h.length-1],y=o[a][0],g=o[a][1];let v=0;const x=p.children.indexOf(d);let k=!1,_=[];y.lastIndex=0;let E=y.exec(d.value);for(;E;){const M=E.index,D={index:E.index,input:E.input,stack:[...h,d]};let T=g(...E,D);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?y.lastIndex=M+1:(v!==M&&_.push({type:"text",value:d.value.slice(v,M)}),Array.isArray(T)?_.push(...T):T&&_.push(T),v=M+E[0].length,k=!0),!y.global)break;E=y.exec(d.value)}return k?(v<d.value.length&&_.push({type:"text",value:d.value.slice(v)}),p.children.splice(x,1,..._)):_=[d],x+_.length}}function oNe(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([sNe(i[0]),aNe(i[1])])}return t}function sNe(e){return typeof e=="string"?new RegExp(rNe(e),"g"):e}function aNe(e){return typeof e=="function"?e:function(){return e}}const XE="phrasing",JE=["autolink","link","image","label"];function lNe(){return{transforms:[mNe],enter:{literalAutolink:uNe,literalAutolinkEmail:ZE,literalAutolinkHttp:ZE,literalAutolinkWww:ZE},exit:{literalAutolink:pNe,literalAutolinkEmail:hNe,literalAutolinkHttp:dNe,literalAutolinkWww:fNe}}}function cNe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:XE,notInConstruct:JE},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:XE,notInConstruct:JE},{character:":",before:"[ps]",after:"\\/",inConstruct:XE,notInConstruct:JE}]}}function uNe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ZE(e){this.config.enter.autolinkProtocol.call(this,e)}function dNe(e){this.config.exit.autolinkProtocol.call(this,e)}function fNe(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function hNe(e){this.config.exit.autolinkEmail.call(this,e)}function pNe(e){this.exit(e)}function mNe(e){iNe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gNe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),yNe]],{ignore:["link","linkReference"]})}function gNe(e,t,n,r,i){let o="";if(!LG(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!bNe(n)))return!1;const a=vNe(n+r);if(!a[0])return!1;const c={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[c,{type:"text",value:a[1]}]:c}function yNe(e,t,n,r){return!LG(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bNe(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function vNe(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=M3(e,"(");let o=M3(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function LG(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||fd(n)||Bw(n))&&(!t||n!==47)}$G.peek=INe;function SNe(){this.buffer()}function xNe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function wNe(){this.buffer()}function kNe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function _Ne(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ds(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ENe(e){this.exit(e)}function TNe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ds(this.sliceSerialize(e)).toLowerCase(),n.label=t}function CNe(e){this.exit(e)}function INe(){return"["}function $G(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const a=n.enter("footnoteReference"),c=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),a(),o+=i.move("]"),o}function MNe(){return{enter:{gfmFootnoteCallString:SNe,gfmFootnoteCall:xNe,gfmFootnoteDefinitionLabelString:wNe,gfmFootnoteDefinition:kNe},exit:{gfmFootnoteCallString:_Ne,gfmFootnoteCall:ENe,gfmFootnoteDefinitionLabelString:TNe,gfmFootnoteDefinition:CNe}}}function RNe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:$G},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,a){const c=o.createTracker(a);let u=c.move("[^");const d=o.enter("footnoteDefinition"),h=o.enter("label");return u+=c.move(o.safe(o.associationId(r),{before:u,after:"]"})),h(),u+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),u+=c.move((t?`
161
+ `:" ")+o.indentLines(o.containerFlow(r,c.current()),t?jG:ANe))),d(),u}}function ANe(e,t,n){return t===0?e:jG(e,t,n)}function jG(e,t,n){return(n?"":" ")+e}const ONe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];FG.peek=$Ne;function DNe(){return{canContainEols:["delete"],enter:{strikethrough:NNe},exit:{strikethrough:LNe}}}function PNe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ONe}],handlers:{delete:FG}}}function NNe(e){this.enter({type:"delete",children:[]},e)}function LNe(e){this.exit(e)}function FG(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function $Ne(){return"~"}function jNe(e){return e.length}function FNe(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||jNe,o=[],a=[],c=[],u=[];let d=0,h=-1;for(;++h<e.length;){const S=[],x=[];let k=-1;for(e[h].length>d&&(d=e[h].length);++k<e[h].length;){const _=zNe(e[h][k]);if(n.alignDelimiters!==!1){const E=i(_);x[k]=E,(u[k]===void 0||E>u[k])&&(u[k]=E)}S.push(_)}a[h]=S,c[h]=x}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)o[p]=R3(r[p]);else{const S=R3(r);for(;++p<d;)o[p]=S}p=-1;const y=[],g=[];for(;++p<d;){const S=o[p];let x="",k="";S===99?(x=":",k=":"):S===108?x=":":S===114&&(k=":");let _=n.alignDelimiters===!1?1:Math.max(1,u[p]-x.length-k.length);const E=x+"-".repeat(_)+k;n.alignDelimiters!==!1&&(_=x.length+_+k.length,_>u[p]&&(u[p]=_),g[p]=_),y[p]=E}a.splice(1,0,y),c.splice(1,0,g),h=-1;const v=[];for(;++h<a.length;){const S=a[h],x=c[h];p=-1;const k=[];for(;++p<d;){const _=S[p]||"";let E="",M="";if(n.alignDelimiters!==!1){const D=u[p]-(x[p]||0),T=o[p];T===114?E=" ".repeat(D):T===99?D%2?(E=" ".repeat(D/2+.5),M=" ".repeat(D/2-.5)):(E=" ".repeat(D/2),M=E):M=" ".repeat(D)}n.delimiterStart!==!1&&!p&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||p)&&k.push(" "),n.alignDelimiters!==!1&&k.push(E),k.push(_),n.alignDelimiters!==!1&&k.push(M),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||p!==d-1)&&k.push("|")}v.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return v.join(`
162
+ `)}function zNe(e){return e==null?"":String(e)}function R3(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function BNe(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),UNe);return i(),a}function UNe(e,t,n){return">"+(n?"":" ")+e}function qNe(e,t){return A3(e,t.inConstruct,!0)&&!A3(e,t.notInConstruct,!1)}function A3(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function O3(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
163
+ `&&qNe(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
164
+ `}function VNe(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function HNe(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function KNe(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function WNe(e,t,n,r){const i=KNe(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(HNe(e,n)){const p=n.enter("codeIndented"),y=n.indentLines(o,GNe);return p(),y}const c=n.createTracker(r),u=i.repeat(Math.max(VNe(o,i)+1,3)),d=n.enter("codeFenced");let h=c.move(u);if(e.lang){const p=n.enter(`codeFencedLang${a}`);h+=c.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${a}`);h+=c.move(" "),h+=c.move(n.safe(e.meta,{before:h,after:`
165
+ `,encode:["`"],...c.current()})),p()}return h+=c.move(`
166
+ `),o&&(h+=c.move(o+`
167
+ `)),h+=c.move(u),d(),h}function GNe(e,t,n){return(n?"":" ")+e}function ZO(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function YNe(e,t,n,r){const i=ZO(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let c=n.enter("label");const u=n.createTracker(r);let d=u.move("[");return d+=u.move(n.safe(n.associationId(e),{before:d,after:"]",...u.current()})),d+=u.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(n.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(c=n.enter("destinationRaw"),d+=u.move(n.safe(e.url,{before:d,after:e.title?" ":`
168
+ `,...u.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=u.move(" "+i),d+=u.move(n.safe(e.title,{before:d,after:i,...u.current()})),d+=u.move(i),c()),a(),d}function QNe(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Zg(e){return"&#x"+e.toString(16).toUpperCase()+";"}function sx(e,t,n){const r=Dh(e),i=Dh(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}zG.peek=XNe;function zG(e,t,n,r){const i=QNe(n),o=n.enter("emphasis"),a=n.createTracker(r),c=a.move(i);let u=a.move(n.containerPhrasing(e,{after:i,before:c,...a.current()}));const d=u.charCodeAt(0),h=sx(r.before.charCodeAt(r.before.length-1),d,i);h.inside&&(u=Zg(d)+u.slice(1));const p=u.charCodeAt(u.length-1),y=sx(r.after.charCodeAt(0),p,i);y.inside&&(u=u.slice(0,-1)+Zg(p));const g=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:h.outside},c+u+g}function XNe(e,t,n){return n.options.emphasis||"*"}function JNe(e,t){let n=!1;return XO(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,CI}),!!((!e.depth||e.depth<3)&&VO(e)&&(t.options.setext||n))}function ZNe(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(JNe(e,n)){const h=n.enter("headingSetext"),p=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:`
169
+ `,after:`
170
+ `});return p(),h(),y+`
171
+ `+(i===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
172
+ `))+1))}const a="#".repeat(i),c=n.enter("headingAtx"),u=n.enter("phrasing");o.move(a+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
173
+ `,...o.current()});return/^[\t ]/.test(d)&&(d=Zg(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),u(),c(),d}BG.peek=e2e;function BG(e){return e.value||""}function e2e(){return"<"}UG.peek=t2e;function UG(e,t,n,r){const i=ZO(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let c=n.enter("label");const u=n.createTracker(r);let d=u.move("![");return d+=u.move(n.safe(e.alt,{before:d,after:"]",...u.current()})),d+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(n.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(c=n.enter("destinationRaw"),d+=u.move(n.safe(e.url,{before:d,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=u.move(" "+i),d+=u.move(n.safe(e.title,{before:d,after:i,...u.current()})),d+=u.move(i),c()),d+=u.move(")"),a(),d}function t2e(){return"!"}qG.peek=n2e;function qG(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("![");const d=n.safe(e.alt,{before:u,after:"]",...c.current()});u+=c.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...c.current()});return a(),n.stack=h,o(),i==="full"||!d||d!==p?u+=c.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function n2e(){return"!"}VG.peek=r2e;function VG(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],c=n.compilePattern(a);let u;if(a.atBreak)for(;u=c.exec(r);){let d=u.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(u.index+1)}}return i+r+i}function r2e(){return"`"}function HG(e,t){const n=VO(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}KG.peek=i2e;function KG(e,t,n,r){const i=ZO(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let c,u;if(HG(e,n)){const h=n.stack;n.stack=[],c=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,{before:p,after:">",...a.current()})),p+=a.move(">"),c(),n.stack=h,p}c=n.enter("link"),u=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(u=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),u(),e.title&&(u=n.enter(`title${o}`),d+=a.move(" "+i),d+=a.move(n.safe(e.title,{before:d,after:i,...a.current()})),d+=a.move(i),u()),d+=a.move(")"),c(),d}function i2e(e,t,n){return HG(e,n)?"<":"["}WG.peek=o2e;function WG(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("[");const d=n.containerPhrasing(e,{before:u,after:"]",...c.current()});u+=c.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...c.current()});return a(),n.stack=h,o(),i==="full"||!d||d!==p?u+=c.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function o2e(){return"["}function eD(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function s2e(e){const t=eD(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function a2e(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function GG(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function l2e(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?a2e(n):eD(n);const c=e.ordered?a==="."?")":".":s2e(n);let u=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),GG(n)===a&&h){let p=-1;for(;++p<e.children.length;){const y=e.children[p];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=c),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),d}function c2e(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function u2e(e,t,n,r){const i=c2e(n);let o=n.bulletCurrent||eD(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const c=n.createTracker(r);c.move(o+" ".repeat(a-o.length)),c.shift(a);const u=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,c.current()),h);return u(),d;function h(p,y,g){return y?(g?"":" ".repeat(a))+p:(g?o:o+" ".repeat(a-o.length))+p}}function d2e(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const f2e=Vw(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function h2e(e,t,n,r){return(e.children.some(function(a){return f2e(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function p2e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}YG.peek=m2e;function YG(e,t,n,r){const i=p2e(n),o=n.enter("strong"),a=n.createTracker(r),c=a.move(i+i);let u=a.move(n.containerPhrasing(e,{after:i,before:c,...a.current()}));const d=u.charCodeAt(0),h=sx(r.before.charCodeAt(r.before.length-1),d,i);h.inside&&(u=Zg(d)+u.slice(1));const p=u.charCodeAt(u.length-1),y=sx(r.after.charCodeAt(0),p,i);y.inside&&(u=u.slice(0,-1)+Zg(p));const g=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:h.outside},c+u+g}function m2e(e,t,n){return n.options.strong||"*"}function g2e(e,t,n,r){return n.safe(e.value,r)}function y2e(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function b2e(e,t,n){const r=(GG(n)+(n.options.ruleSpaces?" ":"")).repeat(y2e(n));return n.options.ruleSpaces?r.slice(0,-1):r}const QG={blockquote:BNe,break:O3,code:WNe,definition:YNe,emphasis:zG,hardBreak:O3,heading:ZNe,html:BG,image:UG,imageReference:qG,inlineCode:VG,link:KG,linkReference:WG,list:l2e,listItem:u2e,paragraph:d2e,root:h2e,strong:YG,text:g2e,thematicBreak:b2e};function v2e(){return{enter:{table:S2e,tableData:D3,tableHeader:D3,tableRow:w2e},exit:{codeText:k2e,table:x2e,tableData:eT,tableHeader:eT,tableRow:eT}}}function S2e(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function x2e(e){this.exit(e),this.data.inTable=void 0}function w2e(e){this.enter({type:"tableRow",children:[]},e)}function eT(e){this.exit(e)}function D3(e){this.enter({type:"tableCell",children:[]},e)}function k2e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_2e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function _2e(e,t){return t==="|"?t:e}function E2e(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
174
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:a,tableCell:u,tableRow:c}};function a(g,v,S,x){return d(h(g,S,x),g.align)}function c(g,v,S,x){const k=p(g,S,x),_=d([k]);return _.slice(0,_.indexOf(`
175
+ `))}function u(g,v,S,x){const k=S.enter("tableCell"),_=S.enter("phrasing"),E=S.containerPhrasing(g,{...x,before:o,after:o});return _(),k(),E}function d(g,v){return FNe(g,{align:v,alignDelimiters:r,padding:n,stringLength:i})}function h(g,v,S){const x=g.children;let k=-1;const _=[],E=v.enter("table");for(;++k<x.length;)_[k]=p(x[k],v,S);return E(),_}function p(g,v,S){const x=g.children;let k=-1;const _=[],E=v.enter("tableRow");for(;++k<x.length;)_[k]=u(x[k],g,v,S);return E(),_}function y(g,v,S){let x=QG.inlineCode(g,v,S);return S.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function T2e(){return{exit:{taskListCheckValueChecked:P3,taskListCheckValueUnchecked:P3,paragraph:I2e}}}function C2e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:M2e}}}function P3(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function I2e(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const c=i[o];if(c.type==="paragraph"){a=c;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function M2e(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(a);let u=QG.listItem(e,t,n,{...r,...c.current()});return o&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),u;function d(h){return h+a}}function R2e(){return[lNe(),MNe(),DNe(),v2e(),T2e()]}function A2e(e){return{extensions:[cNe(),RNe(e),PNe(),E2e(e),C2e()]}}const O2e={tokenize:j2e,partial:!0},XG={tokenize:F2e,partial:!0},JG={tokenize:z2e,partial:!0},ZG={tokenize:B2e,partial:!0},D2e={tokenize:U2e,partial:!0},e7={name:"wwwAutolink",tokenize:L2e,previous:n7},t7={name:"protocolAutolink",tokenize:$2e,previous:r7},_l={name:"emailAutolink",tokenize:N2e,previous:i7},ka={};function P2e(){return{text:ka}}let gu=48;for(;gu<123;)ka[gu]=_l,gu++,gu===58?gu=65:gu===91&&(gu=97);ka[43]=_l;ka[45]=_l;ka[46]=_l;ka[95]=_l;ka[72]=[_l,t7];ka[104]=[_l,t7];ka[87]=[_l,e7];ka[119]=[_l,e7];function N2e(e,t,n){const r=this;let i,o;return a;function a(p){return!AI(p)||!i7.call(r,r.previous)||tD(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return AI(p)?(e.consume(p),c):p===64?(e.consume(p),u):n(p)}function u(p){return p===46?e.check(D2e,h,d)(p):p===45||p===95||_i(p)?(o=!0,e.consume(p),u):h(p)}function d(p){return e.consume(p),i=!0,u}function h(p){return o&&i&&Li(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function L2e(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!n7.call(r,r.previous)||tD(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(O2e,e.attempt(XG,e.attempt(JG,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function $2e(e,t,n){const r=this;let i="",o=!1;return a;function a(p){return(p===72||p===104)&&r7.call(r,r.previous)&&!tD(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Li(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const y=i.toLowerCase();if(y==="http"||y==="https")return e.consume(p),u}return n(p)}function u(p){return p===47?(e.consume(p),o?d:(o=!0,u)):n(p)}function d(p){return p===null||rx(p)||Cn(p)||fd(p)||Bw(p)?n(p):e.attempt(XG,e.attempt(JG,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function j2e(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function F2e(e,t,n){let r,i,o;return a;function a(d){return d===46||d===95?e.check(ZG,u,c)(d):d===null||Cn(d)||fd(d)||d!==45&&Bw(d)?u(d):(o=!0,e.consume(d),a)}function c(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),a}function u(d){return i||r||!o?n(d):t(d)}}function z2e(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(ZG,t,o)(a):a===null||Cn(a)||fd(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function B2e(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),o):c===93?(e.consume(c),i):c===60||c===null||Cn(c)||fd(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||Cn(c)||fd(c)?t(c):r(c)}function o(c){return Li(c)?a(c):n(c)}function a(c){return c===59?(e.consume(c),r):Li(c)?(e.consume(c),a):n(c)}}function U2e(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return _i(o)?n(o):t(o)}}function n7(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Cn(e)}function r7(e){return!Li(e)}function i7(e){return!(e===47||AI(e))}function AI(e){return e===43||e===45||e===46||e===95||_i(e)}function tD(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const q2e={tokenize:X2e,partial:!0};function V2e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:G2e,continuation:{tokenize:Y2e},exit:Q2e}},text:{91:{name:"gfmFootnoteCall",tokenize:W2e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:H2e,resolveTo:K2e}}}}function H2e(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!a||!a._balanced)return n(u);const d=Ds(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function K2e(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function W2e(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),u}function u(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!a||p===null||p===91||Cn(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return i.includes(Ds(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Cn(p)||(a=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function G2e(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,c;return u;function u(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(v)}function h(v){if(a>999||v===93&&!c||v===null||v===91||Cn(v))return n(v);if(v===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=Ds(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Cn(v)||(c=!0),a++,e.consume(v),v===92?p:h}function p(v){return v===91||v===92||v===93?(e.consume(v),a++,h):h(v)}function y(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),i.includes(o)||i.push(o),Kt(e,g,"gfmFootnoteDefinitionWhitespace")):n(v)}function g(v){return t(v)}}function Y2e(e,t,n){return e.check(tb,t,e.attempt(q2e,t,n))}function Q2e(e){e.exit("gfmFootnoteDefinition")}function X2e(e,t,n){const r=this;return Kt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function J2e(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,c){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let d=u;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[u][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[u][1].end)},p={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[u][1].start)},y=[["enter",h,c],["enter",a[d][1],c],["exit",a[d][1],c],["enter",p,c]],g=c.parser.constructs.insideSpan.null;g&&Io(y,y.length,0,Uw(g,a.slice(d+1,u),c)),Io(y,y.length,0,[["exit",p,c],["enter",a[u][1],c],["exit",a[u][1],c],["exit",h,c]]),Io(a,d-1,u-d+3,y),u=d+y.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function o(a,c,u){const d=this.previous,h=this.events;let p=0;return y;function y(v){return d===126&&h[h.length-1][1].type!=="characterEscape"?u(v):(a.enter("strikethroughSequenceTemporary"),g(v))}function g(v){const S=Dh(d);if(v===126)return p>1?u(v):(a.consume(v),p++,g);if(p<2&&!n)return u(v);const x=a.exit("strikethroughSequenceTemporary"),k=Dh(v);return x._open=!k||k===2&&!!S,x._close=!S||S===2&&!!k,c(v)}}}class Z2e{constructor(){this.map=[]}add(t,n,r){eLe(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function eLe(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function tLe(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function nLe(){return{flow:{null:{name:"table",tokenize:rLe,resolveAll:iLe}}}}function rLe(e,t,n){const r=this;let i=0,o=0,a;return c;function c(I){let L=r.events.length-1;for(;L>-1;){const $=r.events[L][1].type;if($==="lineEnding"||$==="linePrefix")L--;else break}const P=L>-1?r.events[L][1].type:null,B=P==="tableHead"||P==="tableRow"?T:u;return B===T&&r.parser.lazy[r.now().line]?n(I):B(I)}function u(I){return e.enter("tableHead"),e.enter("tableRow"),d(I)}function d(I){return I===124||(a=!0,o+=1),h(I)}function h(I){return I===null?n(I):et(I)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),g):n(I):Pt(I)?Kt(e,h,"whitespace")(I):(o+=1,a&&(a=!1,i+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),p(I)))}function p(I){return I===null||I===124||Cn(I)?(e.exit("data"),h(I)):(e.consume(I),I===92?y:p)}function y(I){return I===92||I===124?(e.consume(I),p):p(I)}function g(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,Pt(I)?Kt(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):v(I))}function v(I){return I===45||I===58?x(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),S):D(I)}function S(I){return Pt(I)?Kt(e,x,"whitespace")(I):x(I)}function x(I){return I===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),k):I===45?(o+=1,k(I)):I===null||et(I)?M(I):D(I)}function k(I){return I===45?(e.enter("tableDelimiterFiller"),_(I)):D(I)}function _(I){return I===45?(e.consume(I),_):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return Pt(I)?Kt(e,M,"whitespace")(I):M(I)}function M(I){return I===124?v(I):I===null||et(I)?!a||i!==o?D(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):D(I)}function D(I){return n(I)}function T(I){return e.enter("tableRow"),C(I)}function C(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),C):I===null||et(I)?(e.exit("tableRow"),t(I)):Pt(I)?Kt(e,C,"whitespace")(I):(e.enter("data"),O(I))}function O(I){return I===null||I===124||Cn(I)?(e.exit("data"),C(I)):(e.consume(I),I===92?q:O)}function q(I){return I===92||I===124?(e.consume(I),O):O(I)}}function iLe(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],c=!1,u=0,d,h,p;const y=new Z2e;for(;++n<e.length;){const g=e[n],v=g[1];g[0]==="enter"?v.type==="tableHead"?(c=!1,u!==0&&(N3(y,t,u,d,h),h=void 0,u=0),d={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(n,0,[["enter",d,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],a=[0,n+1,0,0],c&&(c=!1,h={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(n,0,[["enter",h,t]])),i=v.type==="tableDelimiterRow"?2:h?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],p=iS(y,t,o,i,void 0,p),o=[0,0,0,0]),a[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],p=iS(y,t,o,i,void 0,p)),o=a,a=[o[1],n,0,0])):v.type==="tableHead"?(c=!0,u=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(u=n,o[1]!==0?(a[0]=a[1],p=iS(y,t,o,i,n,p)):a[1]!==0&&(p=iS(y,t,a,i,n,p)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&N3(y,t,u,d,h),y.consume(t.events),n=-1;++n<t.events.length;){const g=t.events[n];g[0]==="enter"&&g[1].type==="table"&&(g[1]._align=tLe(t.events,n))}return e}function iS(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},Of(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const u=Of(t.events,n[1]);if(o={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Of(t.events,n[2]),h=Of(t.events,n[3]),p={type:c,start:Object.assign({},d),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const y=t.events[n[2]],g=t.events[n[3]];if(y[1].end=Object.assign({},g[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,S=n[3]-n[2]-1;e.add(v,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(o.end=Object.assign({},Of(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function N3(e,t,n,r,i){const o=[],a=Of(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function Of(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const oLe={name:"tasklistCheck",tokenize:aLe};function sLe(){return{text:{91:oLe}}}function aLe(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),o)}function o(u){return Cn(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(u)}function c(u){return et(u)?t(u):Pt(u)?e.check({tokenize:lLe},t,n)(u):n(u)}}function lLe(e,t,n){return Kt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function cLe(e){return mG([P2e(),V2e(),J2e(e),nLe(),sLe()])}const uLe={};function dLe(e){const t=this,n=e||uLe,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(cLe(n)),o.push(R2e()),a.push(A2e(n))}function Ya(e){const t=e?.position?.start?.line;return typeof t=="number"?t:null}function Tf(e){switch(e){case 1:return"mt-4 text-lg font-semibold text-foreground";case 2:return"mt-4 text-base font-semibold text-foreground";case 3:return"mt-3 text-sm font-semibold text-foreground";default:return"mt-3 text-sm font-semibold text-foreground"}}function o7({markdown:e,highlightLine:t}){if(e.trim()==="")return N.jsx("div",{className:"text-sm text-muted-foreground",children:"(空)"});const n=i=>typeof t=="number"&&i===t,r=i=>{const o=Ya(i);return o?{"data-md-line":o}:{}};return N.jsx("div",{className:"min-w-0",children:N.jsx(JPe,{remarkPlugins:[dLe],components:{h1:({node:i,children:o})=>{const a=Ya(i);return N.jsx("h1",{...r(i),className:[Tf(1),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h2:({node:i,children:o})=>{const a=Ya(i);return N.jsx("h2",{...r(i),className:[Tf(2),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h3:({node:i,children:o})=>{const a=Ya(i);return N.jsx("h3",{...r(i),className:[Tf(3),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h4:({node:i,children:o})=>{const a=Ya(i);return N.jsx("h4",{...r(i),className:[Tf(4),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h5:({node:i,children:o})=>{const a=Ya(i);return N.jsx("h5",{...r(i),className:[Tf(5),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h6:({node:i,children:o})=>{const a=Ya(i);return N.jsx("h6",{...r(i),className:[Tf(6),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},hr:()=>N.jsx("hr",{className:"my-2 border-border/60"}),p:({node:i,children:o})=>{const a=Ya(i);return N.jsx("p",{"data-md-line":a??void 0,className:["whitespace-pre-wrap break-words text-sm leading-6 text-foreground/90",n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},ul:({children:i})=>N.jsx("ul",{className:"ml-5 list-disc space-y-1 text-sm text-foreground/90",children:i}),ol:({children:i})=>N.jsx("ol",{className:"ml-5 list-decimal space-y-1 text-sm text-foreground/90",children:i}),li:({node:i,children:o})=>{const a=Ya(i);return N.jsx("li",{"data-md-line":a??void 0,className:["whitespace-pre-wrap break-words",n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},a:({href:i,children:o})=>N.jsx("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary/60",children:o}),pre:({children:i})=>N.jsx("pre",{className:"max-w-full overflow-x-auto rounded-xl border border-border/60 bg-muted p-3 font-mono text-xs leading-5 text-foreground",children:i}),code:({node:i,className:o,children:a,...c})=>{const u=typeof a=="string"?a:Array.isArray(a)&&a.every(h=>typeof h=="string")?a.join(""):null;return(o?.includes("language-")??!1)||(u?.includes(`
176
+ `)??!1)?N.jsx("code",{className:o,...c,children:a}):N.jsx("code",{className:["rounded bg-muted px-1 py-0.5 font-mono text-[12px] text-foreground",o??null].filter(Boolean).join(" "),...c,children:a})},input:({node:i,type:o,...a})=>o!=="checkbox"?N.jsx("input",{type:o,...a}):N.jsx("input",{type:"checkbox",className:"mr-2 align-middle",disabled:!0,readOnly:!0,...a}),table:({children:i})=>N.jsx("div",{className:"max-w-full overflow-x-auto",children:N.jsx("table",{className:"w-full border-collapse text-sm text-foreground/90",children:i})}),th:({children:i})=>N.jsx("th",{className:"border border-border/60 bg-muted px-2 py-1 text-left font-medium",children:i}),td:({children:i})=>N.jsx("td",{className:"border border-border/60 px-2 py-1 align-top",children:i}),blockquote:({children:i})=>N.jsx("blockquote",{className:"border-l-2 border-border/60 pl-3 text-sm text-muted-foreground",children:i})},children:e})})}function fLe({tasks:e,highlightLine:t,onOpenTask:n}){const r=A.useMemo(()=>Array.from(e).sort((i,o)=>i.line-o.line),[e]);return r.length===0?N.jsx("div",{className:"text-sm text-muted-foreground",children:"No tasks in tasks.md"}):N.jsx("div",{className:"flex flex-col gap-0 divide-y divide-dashed divide-border/40 pr-2",children:r.map(i=>{const o=Fu(i),a=WA(i.raw),c=t===i.line,u=i.taskId??`L${i.line}`;return N.jsxs("button",{id:`task-line-${i.line}`,type:"button",className:c?"group relative flex w-full items-start gap-3 bg-accent/10 px-3 py-3 text-left transition-colors hover:bg-accent/15":"group relative flex w-full items-start gap-3 px-3 py-3 text-left transition-colors hover:bg-muted/40",onClick:()=>n(i),children:[N.jsx("span",{className:i.checked?"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-none border border-success bg-success/10 text-[10px] font-bold text-success-foreground":"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-none border border-border bg-background transition-colors group-hover:border-foreground",children:i.checked?"✓":""}),N.jsxs("div",{className:"min-w-0 flex-1",children:[N.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[N.jsx(_n,{variant:"outline",className:"h-5 rounded-none px-1 font-mono text-[10px] text-muted-foreground group-hover:border-foreground group-hover:text-foreground",children:u}),i.story?N.jsx(_n,{variant:"outline",className:"h-5 rounded-none border-border px-1 font-mono text-[10px] text-muted-foreground group-hover:border-foreground group-hover:text-foreground",children:i.story}):null,i.parallel?N.jsx(_n,{variant:"outline",className:"h-5 rounded-none border-warning/50 px-1 font-mono text-[10px] text-warning group-hover:border-warning",children:"P"}):null,N.jsxs("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground opacity-50",children:["L",i.line]})]}),N.jsx("div",{className:i.checked?"mt-1.5 break-words text-sm font-serif text-muted-foreground line-through opacity-60":"mt-1.5 break-words text-sm font-serif text-foreground font-medium",children:o}),a.length>0?N.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:a.map(d=>N.jsx("span",{className:"inline-block border-b border-dashed border-muted-foreground/30 font-mono text-[10px] text-muted-foreground",children:d},d))}):null]})]},i.line)})})}const hLe=2e3,pLe=["spec.md","quickstart.md","data-model.md","research.md","plan.md","tasks.md"];function mLe(e){switch(e){case"spec.md":return"Requirements";case"quickstart.md":return"Quickstart";case"data-model.md":return"Data Model";case"research.md":return"Research";case"plan.md":return"Implementation";case"tasks.md":return"Tasks Checklist"}}function gLe({open:e,specId:t,spec:n,tasks:r,fileName:i,viewMode:o,loadingFile:a,fileError:c,content:u,loadingSpec:d,specError:h,specMarkdown:p,artifactExists:y,expandedStoryCode:g,pendingScrollToTaskLine:v,pendingScrollToStoryLine:S,highlightTaskLine:x,isFullscreen:k,onToggleFullscreen:_,onClose:E,onSelectFile:M,onSetViewMode:D,onChangeContent:T,onSave:C,onToggleStory:O,onJumpToTaskLine:q,onDidScrollToTaskLine:I,onJumpToStoryLine:L,onDidScrollToStoryLine:P,onClearHighlight:B,onOpenTask:$}){const V=n?.id??t,j=A.useRef(null),[K,G]=A.useState(null),J=A.useRef(null),F=A.useMemo(()=>pLe.filter(Z=>y[Z]===!0),[y]);A.useEffect(()=>{F.length!==0&&(F.includes(i)||M(F[0]??"spec.md"))},[F,i,M]),A.useEffect(()=>()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},[]),A.useEffect(()=>{if(o!=="preview"||i!=="tasks.md"||v===null)return;const Z=`task-line-${v}`,ee=document.getElementById(Z);if(!ee)return;const me=v;ee.scrollIntoView({block:"center",behavior:"smooth"}),I(me);const fe=window.setTimeout(()=>{B()},1500);return()=>window.clearTimeout(fe)},[o,i,v,r,I,B]),A.useEffect(()=>{if(o!=="preview"||i!=="spec.md"||S===null)return;const Z=j.current;if(!Z)return;const ee=[`h1[data-md-line="${S}"]`,`h2[data-md-line="${S}"]`,`h3[data-md-line="${S}"]`,`h4[data-md-line="${S}"]`,`h5[data-md-line="${S}"]`,`h6[data-md-line="${S}"]`,`[data-md-line="${S}"]`].join(", "),me=Z.querySelector(ee);if(!(me instanceof HTMLElement))return;const fe=S;requestAnimationFrame(()=>{me.scrollIntoView({block:"center",behavior:"smooth"}),P(fe),G(fe),J.current!==null&&(window.clearTimeout(J.current),J.current=null),J.current=window.setTimeout(()=>{G(ye=>ye===fe?null:ye),J.current=null},hLe)})},[o,i,S,u,P]);const U=A.useMemo(()=>M9(p),[p]),Q=A.useMemo(()=>new Map(U.map(Z=>[Z.code,Z])),[U]),z=A.useMemo(()=>{const Z=r??[],ee=new Map,me=[];for(const ye of Z){const ie=ye.story;if(!ie){me.push(ye);continue}const xe=ee.get(ie)??[];xe.push(ye),ee.set(ie,xe)}for(const ye of ee.values())ye.sort((ie,xe)=>ie.line-xe.line);me.sort((ye,ie)=>ye.line-ie.line);const fe=Array.from(ee.keys()).sort((ye,ie)=>{const xe=Number.parseInt(ye.replace(/^US/,""),10),ke=Number.parseInt(ie.replace(/^US/,""),10);return Number.isFinite(xe)&&Number.isFinite(ke)?xe-ke:ye.localeCompare(ie)});return{byStory:ee,storyCodes:fe,unassigned:me}},[r]),ne=A.useMemo(()=>{const Z=Array.from(new Set([...z.storyCodes,...Array.from(Q.keys())])).sort((me,fe)=>{const ye=Number.parseInt(me.replace(/^US/,""),10),ie=Number.parseInt(fe.replace(/^US/,""),10);return Number.isFinite(ye)&&Number.isFinite(ie)?ye-ie:me.localeCompare(fe)}),ee=[];for(const me of Z){const fe=Q.get(me)??null,ye=z.byStory.get(me)??[],ie=fz(ye);ee.push({storyCode:me,storyTitle:fe?.title??me,storyLine:fe?.line??null,tasks:ye,refStats:ie,stats:H0(ye),missingInSpec:fe===null})}return ee},[z.byStory,z.storyCodes,Q]),ce=A.useMemo(()=>{if(z.unassigned.length===0)return null;const Z=fz(z.unassigned);return{tasks:z.unassigned,refStats:Z,stats:H0(z.unassigned)}},[z.unassigned]);return N.jsx(eG,{open:e,onOpenChange:Z=>!Z&&E(),children:N.jsxs($O,{className:k?"fixed inset-0 h-full w-full sm:max-w-none rounded-none border-none shadow-none outline-none":"w-[1200px] sm:max-w-none rounded-none border-l border-border bg-background shadow-none outline-none",overlayClassName:k?"hidden":"bg-foreground/20 transition-opacity duration-300",motionProps:{initial:k?!1:{x:"100%"},animate:{x:0},exit:k?{x:0}:{x:"100%"},transition:k?{duration:0}:{type:"spring",stiffness:350,damping:40}},"aria-describedby":void 0,children:[N.jsx(ZW,{className:"sr-only",children:"Spec Detail"}),N.jsx("div",{className:k?"absolute inset-0":"h-full w-full",children:t?N.jsxs("div",{className:"flex h-full flex-col bg-background",children:[N.jsxs("div",{className:"relative flex-none overflow-hidden border-b-4 border-double border-border/40 bg-background px-6 py-5",children:[N.jsxs("div",{className:"relative z-10 flex items-start justify-between gap-6",children:[N.jsxs("div",{className:"min-w-0",children:[N.jsxs("div",{className:"flex items-center gap-3",children:[N.jsx("div",{className:"font-mono text-xs font-bold text-muted-foreground opacity-50",children:n?String(n.num).padStart(3,"0"):"---"}),N.jsx("div",{className:"truncate text-2xl font-bold font-serif tracking-tight text-foreground",children:n?.title??"—"})]}),N.jsx("div",{className:"mt-1 flex items-center gap-2",children:V?N.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted-foreground opacity-70",children:V}):null})]}),N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx(ui,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 rounded-none border border-transparent hover:border-border hover:bg-muted focus-visible:ring-0",onClick:_,"aria-label":k?"Exit fullscreen":"Fullscreen",children:k?N.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 3H5a2 2 0 0 0-2 2v4m18 0V5a2 2 0 0 0-2-2h-4M3 15v4a2 2 0 0 0 2 2h4m10 0h4a2 2 0 0 0 2-2v-4"})}):N.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3m8 0h3a2 2 0 0 0 2-2v-3"})})}),N.jsx(ui,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 rounded-none border border-transparent hover:border-border hover:bg-destructive/10 hover:text-destructive focus-visible:ring-0",onClick:E,"aria-label":"Close",children:N.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),n?.taskStats&&N.jsx("div",{className:`pointer-events-none absolute right-16 top-2 select-none border-4 border-double px-2 py-1 font-mono text-sm font-black uppercase tracking-widest opacity-20 transition-opacity duration-300 md:right-32 md:top-4 md:text-xl md:opacity-10 ${n.taskStats.todo===0?"rotate-12 border-success text-success":"-rotate-12 border-foreground text-foreground"}`,children:n.taskStats.todo===0?"PASSED":"WORK IN PROGRESS"})]}),N.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[N.jsxs("div",{className:"flex w-[200px] shrink-0 flex-col border-r border-border/50 bg-background",children:[N.jsx("div",{className:"px-4 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Artifacts"}),N.jsx("div",{className:"scrollbar-none flex-1 space-y-0.5 overflow-y-auto px-2 pb-3",children:F.map(Z=>{const ee=i===Z;return N.jsxs("button",{type:"button",className:ee?"group w-full border-l-2 border-foreground bg-muted/30 px-4 py-3 text-left transition-all duration-300":"group w-full border-l-2 border-transparent px-4 py-3 text-left transition-all duration-300 hover:bg-muted/10 hover:border-border/50",onClick:()=>M(Z),children:[N.jsx("div",{className:`font-mono text-[13px] ${ee?"font-medium text-foreground":"text-muted-foreground"}`,children:Z}),N.jsx("div",{className:`mt-0.5 text-[11px] ${ee?"text-muted-foreground":"text-muted-foreground/70 group-hover:text-muted-foreground"}`,children:mLe(Z)})]},Z)})})]}),N.jsxs("div",{className:"flex w-[480px] shrink-0 flex-col border-r border-border/30 bg-background",children:[N.jsxs("div",{className:"flex h-12 flex-none items-center border-b border-border/30 px-4",children:[N.jsx("div",{className:"text-xs font-semibold text-foreground",children:"Correlation (US → Tasks → Refs)"}),h?N.jsx("div",{className:"mt-2 rounded-md border border-destructive/20 bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:h}):null]}),N.jsxs("div",{className:"scrollbar-none flex-1 overflow-y-auto p-4",children:[r!==void 0&&ne.length===0&&!ce?N.jsx("div",{className:"text-sm text-muted-foreground",children:"No correlated tasks found in current spec."}):null,N.jsxs("div",{className:"flex flex-col gap-0 divide-y divide-dashed divide-border/40",children:[ne.map(Z=>N.jsxs("div",{className:"py-6 px-2 transition-colors duration-500 hover:bg-muted/5 group",children:[N.jsxs("div",{className:"flex items-start justify-between gap-3",children:[N.jsx("div",{className:"min-w-0",children:N.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[Z.storyLine!==null?N.jsx("button",{type:"button",className:Z.missingInSpec?"mt-0.5 shrink-0 cursor-pointer rounded-none border border-destructive px-1.5 py-0.5 font-mono text-[11px] font-bold text-destructive transition-colors hover:bg-destructive hover:text-destructive-foreground":"mt-0.5 shrink-0 cursor-pointer rounded-none border border-border px-1.5 py-0.5 font-mono text-[11px] font-bold text-muted-foreground transition-colors hover:border-foreground hover:bg-foreground hover:text-background",onClick:()=>L(Z.storyLine??1),children:Z.storyCode}):N.jsx("span",{className:Z.missingInSpec?"mt-0.5 shrink-0 rounded-none border border-destructive px-1.5 py-0.5 font-mono text-[11px] font-bold text-destructive":"mt-0.5 shrink-0 rounded-none border border-border px-1.5 py-0.5 font-mono text-[11px] font-bold text-muted-foreground",children:Z.storyCode}),N.jsxs("div",{className:"min-w-0",children:[N.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:Z.storyTitle}),N.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:Z.missingInSpec?"User Story title not found in spec.md":`spec.md#L${Z.storyLine??1}`})]})]})}),N.jsxs("div",{className:"flex shrink-0 items-start gap-2",children:[N.jsxs(_n,{variant:"outline",className:"font-mono text-[11px] rounded-none",children:[Z.stats.done,"/",Z.stats.total]}),Z.tasks.length>0?N.jsx(ui,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 py-0.5 text-[11px]",onClick:()=>O(Z.storyCode),children:g===Z.storyCode?"Collapse":"Expand"}):null]})]}),N.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-none bg-border/40",children:N.jsx("div",{className:"h-full bg-success",style:{width:Z.stats.total>0?`${Math.round(Z.stats.done/Z.stats.total*100)}%`:"0%"}})}),N.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:Z.tasks.map(ee=>{const me=Fu(ee);return N.jsx("button",{type:"button",className:ee.checked?"rounded-none bg-success/10 px-2 py-1 text-[11px] text-success-foreground hover:bg-success/15":"rounded-none bg-muted px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",title:ee.taskId?`${ee.taskId} · ${me}`:me,onClick:()=>q(ee.line),children:ee.taskId??`L${ee.line}`},ee.line)})}),Z.refStats.length>0?N.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:Z.refStats.map(ee=>N.jsxs(_n,{variant:"outline",className:"font-mono text-[11px] rounded-none",title:`${ee.done}/${ee.total}`,children:[ee.code," ",ee.done,"/",ee.total]},ee.code))}):null,Z.tasks.length>0&&g===Z.storyCode?N.jsx("div",{className:"mt-3 space-y-2",children:Z.tasks.map(ee=>{const me=Fu(ee),fe=WA(ee.raw);return N.jsxs("div",{className:"group/task flex flex-col p-2 transition-colors duration-300 hover:bg-muted/20 border-l-2 border-transparent hover:border-accent/50",children:[N.jsxs("div",{className:"flex items-start gap-2",children:[N.jsx("button",{type:"button",className:"min-w-0 flex-1 break-words text-left text-sm text-foreground outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50 rounded-none",onClick:()=>$(ee),children:N.jsx("span",{className:ee.checked?"line-through text-muted-foreground opacity-80":void 0,children:ee.taskId?`${ee.taskId} · ${me}`:me})}),N.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground opacity-70",children:["L",ee.line]})]}),fe.length>0?N.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:fe.map(ye=>N.jsx(_n,{variant:"outline",className:"font-mono text-[11px] text-muted-foreground rounded-none",children:ye},ye))}):null]},ee.line)})}):null]},Z.storyCode)),ce?N.jsxs("div",{className:"py-6 px-2 border-t border-dashed border-border/40",children:[N.jsxs("div",{className:"flex items-start justify-between gap-3",children:[N.jsx("div",{className:"min-w-0",children:N.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[N.jsx(_n,{variant:"outline",className:"mt-0.5 shrink-0 font-mono text-[11px] rounded-none",children:"Unassigned"}),N.jsxs("div",{className:"min-w-0",children:[N.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:"Tasks without [USn]"}),N.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:"No `[USn]` tags in tasks.md"})]})]})}),N.jsxs(_n,{variant:"outline",className:"font-mono text-[11px] rounded-none",children:[ce.stats.done,"/",ce.stats.total]})]}),N.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:ce.tasks.map(Z=>{const ee=Fu(Z);return N.jsx("button",{type:"button",className:Z.checked?"rounded-none bg-success/10 px-2 py-1 text-[11px] text-success-foreground hover:bg-success/15":"rounded-none bg-muted px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",title:Z.taskId?`${Z.taskId} · ${ee}`:ee,onClick:()=>q(Z.line),children:Z.taskId??`L${Z.line}`},Z.line)})}),ce.refStats.length>0?N.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:ce.refStats.map(Z=>N.jsxs(_n,{variant:"outline",className:"font-mono text-[11px] rounded-none",title:`${Z.done}/${Z.total}`,children:[Z.code," ",Z.done,"/",Z.total]},Z.code))}):null]}):null]})]})]}),N.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden bg-card",children:[N.jsxs("div",{className:"flex h-12 flex-none items-center justify-between border-b border-border/30 bg-card px-4",children:[N.jsx("div",{className:"min-w-0",children:N.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:i})}),N.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[o==="edit"?N.jsx(ui,{type:"button",size:"sm",variant:"outline",className:"h-7 border-border px-3 font-mono text-[10px] tracking-wider hover:bg-foreground hover:text-background",disabled:a,onClick:C,children:"SAVE"}):null,N.jsxs("div",{className:"flex items-center border border-border bg-background",children:[N.jsx("button",{type:"button",className:o==="preview"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>D("preview"),children:"PREVIEW"}),N.jsx("div",{className:"h-3 w-px bg-border"}),N.jsx("button",{type:"button",className:o==="edit"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>D("edit"),children:"EDIT"})]})]})]}),c?N.jsx("div",{className:"mt-2 rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:c}):null,N.jsx("div",{className:"flex-1 overflow-hidden",children:o==="edit"?N.jsx("textarea",{className:"h-full w-full resize-none border-0 bg-transparent p-4 font-mono text-xs leading-5 text-foreground outline-none placeholder:text-muted-foreground",value:u,onChange:Z=>T(Z.target.value),placeholder:a?"Loading…":"File Content"}):N.jsx("div",{ref:j,className:"scrollbar-none h-full overflow-y-auto p-4",children:i==="tasks.md"&&r?N.jsx(fLe,{tasks:r,highlightLine:x,onOpenTask:$}):N.jsx(o7,{markdown:u,highlightLine:i==="spec.md"?K:null})})})]})]})]}):null})]})})}function L3(e,[t,n]){return Math.min(n,Math.max(t,e))}function yLe(e){const t=e+"CollectionProvider",[n,r]=$w(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=S=>{const{scope:x,children:k}=S,_=bn.useRef(null),E=bn.useRef(new Map).current;return N.jsx(i,{scope:x,itemMap:E,collectionRef:_,children:k})};a.displayName=t;const c=e+"CollectionSlot",u=Xg(c),d=bn.forwardRef((S,x)=>{const{scope:k,children:_}=S,E=o(c,k),M=wr(x,E.collectionRef);return N.jsx(u,{ref:M,children:_})});d.displayName=c;const h=e+"CollectionItemSlot",p="data-radix-collection-item",y=Xg(h),g=bn.forwardRef((S,x)=>{const{scope:k,children:_,...E}=S,M=bn.useRef(null),D=wr(x,M),T=o(h,k);return bn.useEffect(()=>(T.itemMap.set(M,{ref:M,...E}),()=>void T.itemMap.delete(M))),N.jsx(y,{[p]:"",ref:D,children:_})});g.displayName=h;function v(S){const x=o(e+"CollectionConsumer",S);return bn.useCallback(()=>{const _=x.collectionRef.current;if(!_)return[];const E=Array.from(_.querySelectorAll(`[${p}]`));return Array.from(x.itemMap.values()).sort((T,C)=>E.indexOf(T.ref.current)-E.indexOf(C.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:a,Slot:d,ItemSlot:g},v,r]}var bLe=A.createContext(void 0);function vLe(e){const t=A.useContext(bLe);return e||t||"ltr"}const SLe=["top","right","bottom","left"],Ic=Math.min,xo=Math.max,ax=Math.round,oS=Math.floor,ha=e=>({x:e,y:e}),xLe={left:"right",right:"left",bottom:"top",top:"bottom"},wLe={start:"end",end:"start"};function OI(e,t,n){return xo(e,Ic(t,n))}function vl(e,t){return typeof e=="function"?e(t):e}function Sl(e){return e.split("-")[0]}function pp(e){return e.split("-")[1]}function nD(e){return e==="x"?"y":"x"}function rD(e){return e==="y"?"height":"width"}const kLe=new Set(["top","bottom"]);function ia(e){return kLe.has(Sl(e))?"y":"x"}function iD(e){return nD(ia(e))}function _Le(e,t,n){n===void 0&&(n=!1);const r=pp(e),i=iD(e),o=rD(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=lx(a)),[a,lx(a)]}function ELe(e){const t=lx(e);return[DI(e),t,DI(t)]}function DI(e){return e.replace(/start|end/g,t=>wLe[t])}const $3=["left","right"],j3=["right","left"],TLe=["top","bottom"],CLe=["bottom","top"];function ILe(e,t,n){switch(e){case"top":case"bottom":return n?t?j3:$3:t?$3:j3;case"left":case"right":return t?TLe:CLe;default:return[]}}function MLe(e,t,n,r){const i=pp(e);let o=ILe(Sl(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(DI)))),o}function lx(e){return e.replace(/left|right|bottom|top/g,t=>xLe[t])}function RLe(e){return{top:0,right:0,bottom:0,left:0,...e}}function s7(e){return typeof e!="number"?RLe(e):{top:e,right:e,bottom:e,left:e}}function cx(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function F3(e,t,n){let{reference:r,floating:i}=e;const o=ia(t),a=iD(t),c=rD(a),u=Sl(t),d=o==="y",h=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,y=r[c]/2-i[c]/2;let g;switch(u){case"top":g={x:h,y:r.y-i.height};break;case"bottom":g={x:h,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:p};break;case"left":g={x:r.x-i.width,y:p};break;default:g={x:r.x,y:r.y}}switch(pp(t)){case"start":g[a]-=y*(n&&d?-1:1);break;case"end":g[a]+=y*(n&&d?-1:1);break}return g}const ALe=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,c=o.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:p}=F3(d,r,u),y=r,g={},v=0;for(let S=0;S<c.length;S++){const{name:x,fn:k}=c[S],{x:_,y:E,data:M,reset:D}=await k({x:h,y:p,initialPlacement:r,placement:y,strategy:i,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});h=_??h,p=E??p,g={...g,[x]:{...g[x],...M}},D&&v<=50&&(v++,typeof D=="object"&&(D.placement&&(y=D.placement),D.rects&&(d=D.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):D.rects),{x:h,y:p}=F3(d,y,u)),S=-1)}return{x:h,y:p,placement:y,strategy:i,middlewareData:g}};async function ey(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:c,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:y=!1,padding:g=0}=vl(t,e),v=s7(g),x=c[y?p==="floating"?"reference":"floating":p],k=cx(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:d,rootBoundary:h,strategy:u})),_=p==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),M=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},D=cx(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:E,strategy:u}):_);return{top:(k.top-D.top+v.top)/M.y,bottom:(D.bottom-k.bottom+v.bottom)/M.y,left:(k.left-D.left+v.left)/M.x,right:(D.right-k.right+v.right)/M.x}}const OLe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:a,elements:c,middlewareData:u}=t,{element:d,padding:h=0}=vl(e,t)||{};if(d==null)return{};const p=s7(h),y={x:n,y:r},g=iD(i),v=rD(g),S=await a.getDimensions(d),x=g==="y",k=x?"top":"left",_=x?"bottom":"right",E=x?"clientHeight":"clientWidth",M=o.reference[v]+o.reference[g]-y[g]-o.floating[v],D=y[g]-o.reference[g],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let C=T?T[E]:0;(!C||!await(a.isElement==null?void 0:a.isElement(T)))&&(C=c.floating[E]||o.floating[v]);const O=M/2-D/2,q=C/2-S[v]/2-1,I=Ic(p[k],q),L=Ic(p[_],q),P=I,B=C-S[v]-L,$=C/2-S[v]/2+O,V=OI(P,$,B),j=!u.arrow&&pp(i)!=null&&$!==V&&o.reference[v]/2-($<P?I:L)-S[v]/2<0,K=j?$<P?$-P:$-B:0;return{[g]:y[g]+K,data:{[g]:V,centerOffset:$-V-K,...j&&{alignmentOffset:K}},reset:j}}}),DLe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:a,initialPlacement:c,platform:u,elements:d}=t,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:y,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:S=!0,...x}=vl(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=Sl(i),_=ia(c),E=Sl(c)===c,M=await(u.isRTL==null?void 0:u.isRTL(d.floating)),D=y||(E||!S?[lx(c)]:ELe(c)),T=v!=="none";!y&&T&&D.push(...MLe(c,S,v,M));const C=[c,...D],O=await ey(t,x),q=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(h&&q.push(O[k]),p){const $=_Le(i,a,M);q.push(O[$[0]],O[$[1]])}if(I=[...I,{placement:i,overflows:q}],!q.every($=>$<=0)){var L,P;const $=(((L=o.flip)==null?void 0:L.index)||0)+1,V=C[$];if(V&&(!(p==="alignment"?_!==ia(V):!1)||I.every(G=>ia(G.placement)===_?G.overflows[0]>0:!0)))return{data:{index:$,overflows:I},reset:{placement:V}};let j=(P=I.filter(K=>K.overflows[0]<=0).sort((K,G)=>K.overflows[1]-G.overflows[1])[0])==null?void 0:P.placement;if(!j)switch(g){case"bestFit":{var B;const K=(B=I.filter(G=>{if(T){const J=ia(G.placement);return J===_||J==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(J=>J>0).reduce((J,F)=>J+F,0)]).sort((G,J)=>G[1]-J[1])[0])==null?void 0:B[0];K&&(j=K);break}case"initialPlacement":j=c;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function z3(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function B3(e){return SLe.some(t=>e[t]>=0)}const PLe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=vl(e,t);switch(r){case"referenceHidden":{const o=await ey(t,{...i,elementContext:"reference"}),a=z3(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:B3(a)}}}case"escaped":{const o=await ey(t,{...i,altBoundary:!0}),a=z3(o,n.floating);return{data:{escapedOffsets:a,escaped:B3(a)}}}default:return{}}}}},a7=new Set(["left","top"]);async function NLe(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Sl(n),c=pp(n),u=ia(n)==="y",d=a7.has(a)?-1:1,h=o&&u?-1:1,p=vl(t,e);let{mainAxis:y,crossAxis:g,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof v=="number"&&(g=c==="end"?v*-1:v),u?{x:g*h,y:y*d}:{x:y*d,y:g*h}}const LLe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:a,middlewareData:c}=t,u=await NLe(t,e);return a===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:o+u.y,data:{...u,placement:a}}}}},$Le=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:c={fn:x=>{let{x:k,y:_}=x;return{x:k,y:_}}},...u}=vl(e,t),d={x:n,y:r},h=await ey(t,u),p=ia(Sl(i)),y=nD(p);let g=d[y],v=d[p];if(o){const x=y==="y"?"top":"left",k=y==="y"?"bottom":"right",_=g+h[x],E=g-h[k];g=OI(_,g,E)}if(a){const x=p==="y"?"top":"left",k=p==="y"?"bottom":"right",_=v+h[x],E=v-h[k];v=OI(_,v,E)}const S=c.fn({...t,[y]:g,[p]:v});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[y]:o,[p]:a}}}}}},jLe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=vl(e,t),h={x:n,y:r},p=ia(i),y=nD(p);let g=h[y],v=h[p];const S=vl(c,t),x=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(u){const E=y==="y"?"height":"width",M=o.reference[y]-o.floating[E]+x.mainAxis,D=o.reference[y]+o.reference[E]-x.mainAxis;g<M?g=M:g>D&&(g=D)}if(d){var k,_;const E=y==="y"?"width":"height",M=a7.has(Sl(i)),D=o.reference[p]-o.floating[E]+(M&&((k=a.offset)==null?void 0:k[p])||0)+(M?0:x.crossAxis),T=o.reference[p]+o.reference[E]+(M?0:((_=a.offset)==null?void 0:_[p])||0)-(M?x.crossAxis:0);v<D?v=D:v>T&&(v=T)}return{[y]:g,[p]:v}}}},FLe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:a,elements:c}=t,{apply:u=()=>{},...d}=vl(e,t),h=await ey(t,d),p=Sl(i),y=pp(i),g=ia(i)==="y",{width:v,height:S}=o.floating;let x,k;p==="top"||p==="bottom"?(x=p,k=y===(await(a.isRTL==null?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(k=p,x=y==="end"?"top":"bottom");const _=S-h.top-h.bottom,E=v-h.left-h.right,M=Ic(S-h[x],_),D=Ic(v-h[k],E),T=!t.middlewareData.shift;let C=M,O=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=_),T&&!y){const I=xo(h.left,0),L=xo(h.right,0),P=xo(h.top,0),B=xo(h.bottom,0);g?O=v-2*(I!==0||L!==0?I+L:xo(h.left,h.right)):C=S-2*(P!==0||B!==0?P+B:xo(h.top,h.bottom))}await u({...t,availableWidth:O,availableHeight:C});const q=await a.getDimensions(c.floating);return v!==q.width||S!==q.height?{reset:{rects:!0}}:{}}}};function Kw(){return typeof window<"u"}function mp(e){return l7(e)?(e.nodeName||"").toLowerCase():"#document"}function Mo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _a(e){var t;return(t=(l7(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function l7(e){return Kw()?e instanceof Node||e instanceof Mo(e).Node:!1}function Fs(e){return Kw()?e instanceof Element||e instanceof Mo(e).Element:!1}function va(e){return Kw()?e instanceof HTMLElement||e instanceof Mo(e).HTMLElement:!1}function U3(e){return!Kw()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mo(e).ShadowRoot}const zLe=new Set(["inline","contents"]);function rb(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=zs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zLe.has(i)}const BLe=new Set(["table","td","th"]);function ULe(e){return BLe.has(mp(e))}const qLe=[":popover-open",":modal"];function Ww(e){return qLe.some(t=>{try{return e.matches(t)}catch{return!1}})}const VLe=["transform","translate","scale","rotate","perspective"],HLe=["transform","translate","scale","rotate","perspective","filter"],KLe=["paint","layout","strict","content"];function oD(e){const t=sD(),n=Fs(e)?zs(e):e;return VLe.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||HLe.some(r=>(n.willChange||"").includes(r))||KLe.some(r=>(n.contain||"").includes(r))}function WLe(e){let t=Mc(e);for(;va(t)&&!Ph(t);){if(oD(t))return t;if(Ww(t))return null;t=Mc(t)}return null}function sD(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const GLe=new Set(["html","body","#document"]);function Ph(e){return GLe.has(mp(e))}function zs(e){return Mo(e).getComputedStyle(e)}function Gw(e){return Fs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mc(e){if(mp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||U3(e)&&e.host||_a(e);return U3(t)?t.host:t}function c7(e){const t=Mc(e);return Ph(t)?e.ownerDocument?e.ownerDocument.body:e.body:va(t)&&rb(t)?t:c7(t)}function ty(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=c7(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),a=Mo(i);if(o){const c=PI(a);return t.concat(a,a.visualViewport||[],rb(i)?i:[],c&&n?ty(c):[])}return t.concat(i,ty(i,[],n))}function PI(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function u7(e){const t=zs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=va(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,c=ax(n)!==o||ax(r)!==a;return c&&(n=o,r=a),{width:n,height:r,$:c}}function aD(e){return Fs(e)?e:e.contextElement}function nh(e){const t=aD(e);if(!va(t))return ha(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=u7(t);let a=(o?ax(n.width):n.width)/r,c=(o?ax(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const YLe=ha(0);function d7(e){const t=Mo(e);return!sD()||!t.visualViewport?YLe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function QLe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mo(e)?!1:t}function hd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=aD(e);let a=ha(1);t&&(r?Fs(r)&&(a=nh(r)):a=nh(e));const c=QLe(o,n,r)?d7(o):ha(0);let u=(i.left+c.x)/a.x,d=(i.top+c.y)/a.y,h=i.width/a.x,p=i.height/a.y;if(o){const y=Mo(o),g=r&&Fs(r)?Mo(r):r;let v=y,S=PI(v);for(;S&&r&&g!==v;){const x=nh(S),k=S.getBoundingClientRect(),_=zs(S),E=k.left+(S.clientLeft+parseFloat(_.paddingLeft))*x.x,M=k.top+(S.clientTop+parseFloat(_.paddingTop))*x.y;u*=x.x,d*=x.y,h*=x.x,p*=x.y,u+=E,d+=M,v=Mo(S),S=PI(v)}}return cx({width:h,height:p,x:u,y:d})}function Yw(e,t){const n=Gw(e).scrollLeft;return t?t.left+n:hd(_a(e)).left+n}function f7(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Yw(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function XLe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",a=_a(r),c=t?Ww(t.floating):!1;if(r===a||c&&o)return n;let u={scrollLeft:0,scrollTop:0},d=ha(1);const h=ha(0),p=va(r);if((p||!p&&!o)&&((mp(r)!=="body"||rb(a))&&(u=Gw(r)),va(r))){const g=hd(r);d=nh(r),h.x=g.x+r.clientLeft,h.y=g.y+r.clientTop}const y=a&&!p&&!o?f7(a,u):ha(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+h.x+y.x,y:n.y*d.y-u.scrollTop*d.y+h.y+y.y}}function JLe(e){return Array.from(e.getClientRects())}function ZLe(e){const t=_a(e),n=Gw(e),r=e.ownerDocument.body,i=xo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=xo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Yw(e);const c=-n.scrollTop;return zs(r).direction==="rtl"&&(a+=xo(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:c}}const q3=25;function e$e(e,t){const n=Mo(e),r=_a(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,c=0,u=0;if(i){o=i.width,a=i.height;const h=sD();(!h||h&&t==="fixed")&&(c=i.offsetLeft,u=i.offsetTop)}const d=Yw(r);if(d<=0){const h=r.ownerDocument,p=h.body,y=getComputedStyle(p),g=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,v=Math.abs(r.clientWidth-p.clientWidth-g);v<=q3&&(o-=v)}else d<=q3&&(o+=d);return{width:o,height:a,x:c,y:u}}const t$e=new Set(["absolute","fixed"]);function n$e(e,t){const n=hd(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=va(e)?nh(e):ha(1),a=e.clientWidth*o.x,c=e.clientHeight*o.y,u=i*o.x,d=r*o.y;return{width:a,height:c,x:u,y:d}}function V3(e,t,n){let r;if(t==="viewport")r=e$e(e,n);else if(t==="document")r=ZLe(_a(e));else if(Fs(t))r=n$e(t,n);else{const i=d7(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return cx(r)}function h7(e,t){const n=Mc(e);return n===t||!Fs(n)||Ph(n)?!1:zs(n).position==="fixed"||h7(n,t)}function r$e(e,t){const n=t.get(e);if(n)return n;let r=ty(e,[],!1).filter(c=>Fs(c)&&mp(c)!=="body"),i=null;const o=zs(e).position==="fixed";let a=o?Mc(e):e;for(;Fs(a)&&!Ph(a);){const c=zs(a),u=oD(a);!u&&c.position==="fixed"&&(i=null),(o?!u&&!i:!u&&c.position==="static"&&!!i&&t$e.has(i.position)||rb(a)&&!u&&h7(e,a))?r=r.filter(h=>h!==a):i=c,a=Mc(a)}return t.set(e,r),r}function i$e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?Ww(t)?[]:r$e(t,this._c):[].concat(n),r],c=a[0],u=a.reduce((d,h)=>{const p=V3(t,h,i);return d.top=xo(p.top,d.top),d.right=Ic(p.right,d.right),d.bottom=Ic(p.bottom,d.bottom),d.left=xo(p.left,d.left),d},V3(t,c,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function o$e(e){const{width:t,height:n}=u7(e);return{width:t,height:n}}function s$e(e,t,n){const r=va(t),i=_a(t),o=n==="fixed",a=hd(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const u=ha(0);function d(){u.x=Yw(i)}if(r||!r&&!o)if((mp(t)!=="body"||rb(i))&&(c=Gw(t)),r){const g=hd(t,!0,o,t);u.x=g.x+t.clientLeft,u.y=g.y+t.clientTop}else i&&d();o&&!r&&i&&d();const h=i&&!r&&!o?f7(i,c):ha(0),p=a.left+c.scrollLeft-u.x-h.x,y=a.top+c.scrollTop-u.y-h.y;return{x:p,y,width:a.width,height:a.height}}function tT(e){return zs(e).position==="static"}function H3(e,t){if(!va(e)||zs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _a(e)===n&&(n=n.ownerDocument.body),n}function p7(e,t){const n=Mo(e);if(Ww(e))return n;if(!va(e)){let i=Mc(e);for(;i&&!Ph(i);){if(Fs(i)&&!tT(i))return i;i=Mc(i)}return n}let r=H3(e,t);for(;r&&ULe(r)&&tT(r);)r=H3(r,t);return r&&Ph(r)&&tT(r)&&!oD(r)?n:r||WLe(e)||n}const a$e=async function(e){const t=this.getOffsetParent||p7,n=this.getDimensions,r=await n(e.floating);return{reference:s$e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function l$e(e){return zs(e).direction==="rtl"}const c$e={convertOffsetParentRelativeRectToViewportRelativeRect:XLe,getDocumentElement:_a,getClippingRect:i$e,getOffsetParent:p7,getElementRects:a$e,getClientRects:JLe,getDimensions:o$e,getScale:nh,isElement:Fs,isRTL:l$e};function m7(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function u$e(e,t){let n=null,r;const i=_a(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function a(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),o();const d=e.getBoundingClientRect(),{left:h,top:p,width:y,height:g}=d;if(c||t(),!y||!g)return;const v=oS(p),S=oS(i.clientWidth-(h+y)),x=oS(i.clientHeight-(p+g)),k=oS(h),E={rootMargin:-v+"px "+-S+"px "+-x+"px "+-k+"px",threshold:xo(0,Ic(1,u))||1};let M=!0;function D(T){const C=T[0].intersectionRatio;if(C!==u){if(!M)return a();C?a(!1,C):r=setTimeout(()=>{a(!1,1e-7)},1e3)}C===1&&!m7(d,e.getBoundingClientRect())&&a(),M=!1}try{n=new IntersectionObserver(D,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(D,E)}n.observe(e)}return a(!0),o}function d$e(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=aD(e),h=i||o?[...d?ty(d):[],...ty(t)]:[];h.forEach(k=>{i&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const p=d&&c?u$e(d,n):null;let y=-1,g=null;a&&(g=new ResizeObserver(k=>{let[_]=k;_&&_.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var E;(E=g)==null||E.observe(t)})),n()}),d&&!u&&g.observe(d),g.observe(t));let v,S=u?hd(e):null;u&&x();function x(){const k=hd(e);S&&!m7(S,k)&&n(),S=k,v=requestAnimationFrame(x)}return n(),()=>{var k;h.forEach(_=>{i&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),p?.(),(k=g)==null||k.disconnect(),g=null,u&&cancelAnimationFrame(v)}}const f$e=LLe,h$e=$Le,p$e=DLe,m$e=FLe,g$e=PLe,K3=OLe,y$e=jLe,b$e=(e,t,n)=>{const r=new Map,i={platform:c$e,...n},o={...i.platform,_c:r};return ALe(e,t,{...i,platform:o})};var v$e=typeof document<"u",S$e=function(){},qS=v$e?A.useLayoutEffect:S$e;function ux(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ux(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!ux(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function g7(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function W3(e,t){const n=g7(e);return Math.round(t*n)/n}function nT(e){const t=A.useRef(e);return qS(()=>{t.current=e}),t}function x$e(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:a}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[h,p]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,g]=A.useState(r);ux(y,r)||g(r);const[v,S]=A.useState(null),[x,k]=A.useState(null),_=A.useCallback(G=>{G!==T.current&&(T.current=G,S(G))},[]),E=A.useCallback(G=>{G!==C.current&&(C.current=G,k(G))},[]),M=o||v,D=a||x,T=A.useRef(null),C=A.useRef(null),O=A.useRef(h),q=u!=null,I=nT(u),L=nT(i),P=nT(d),B=A.useCallback(()=>{if(!T.current||!C.current)return;const G={placement:t,strategy:n,middleware:y};L.current&&(G.platform=L.current),b$e(T.current,C.current,G).then(J=>{const F={...J,isPositioned:P.current!==!1};$.current&&!ux(O.current,F)&&(O.current=F,Yy.flushSync(()=>{p(F)}))})},[y,t,n,L,P]);qS(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(G=>({...G,isPositioned:!1})))},[d]);const $=A.useRef(!1);qS(()=>($.current=!0,()=>{$.current=!1}),[]),qS(()=>{if(M&&(T.current=M),D&&(C.current=D),M&&D){if(I.current)return I.current(M,D,B);B()}},[M,D,B,I,q]);const V=A.useMemo(()=>({reference:T,floating:C,setReference:_,setFloating:E}),[_,E]),j=A.useMemo(()=>({reference:M,floating:D}),[M,D]),K=A.useMemo(()=>{const G={position:n,left:0,top:0};if(!j.floating)return G;const J=W3(j.floating,h.x),F=W3(j.floating,h.y);return c?{...G,transform:"translate("+J+"px, "+F+"px)",...g7(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:F}},[n,c,j.floating,h.x,h.y]);return A.useMemo(()=>({...h,update:B,refs:V,elements:j,floatingStyles:K}),[h,B,V,j,K])}const w$e=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?K3({element:r.current,padding:i}).fn(n):{}:r?K3({element:r,padding:i}).fn(n):{}}}},k$e=(e,t)=>({...f$e(e),options:[e,t]}),_$e=(e,t)=>({...h$e(e),options:[e,t]}),E$e=(e,t)=>({...y$e(e),options:[e,t]}),T$e=(e,t)=>({...p$e(e),options:[e,t]}),C$e=(e,t)=>({...m$e(e),options:[e,t]}),I$e=(e,t)=>({...g$e(e),options:[e,t]}),M$e=(e,t)=>({...w$e(e),options:[e,t]});var R$e="Arrow",y7=A.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return N.jsx(Pn.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:N.jsx("polygon",{points:"0,0 30,0 15,10"})})});y7.displayName=R$e;var A$e=y7;function O$e(e){const[t,n]=A.useState(void 0);return Ti(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,c;if("borderBoxSize"in o){const u=o.borderBoxSize,d=Array.isArray(u)?u[0]:u;a=d.inlineSize,c=d.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var lD="Popper",[b7,v7]=$w(lD),[D$e,S7]=b7(lD),x7=e=>{const{__scopePopper:t,children:n}=e,[r,i]=A.useState(null);return N.jsx(D$e,{scope:t,anchor:r,onAnchorChange:i,children:n})};x7.displayName=lD;var w7="PopperAnchor",k7=A.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=S7(w7,n),a=A.useRef(null),c=wr(t,a),u=A.useRef(null);return A.useEffect(()=>{const d=u.current;u.current=r?.current||a.current,d!==u.current&&o.onAnchorChange(u.current)}),r?null:N.jsx(Pn.div,{...i,ref:c})});k7.displayName=w7;var cD="PopperContent",[P$e,N$e]=b7(cD),_7=A.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:y=!1,updatePositionStrategy:g="optimized",onPlaced:v,...S}=e,x=S7(cD,n),[k,_]=A.useState(null),E=wr(t,ee=>_(ee)),[M,D]=A.useState(null),T=O$e(M),C=T?.width??0,O=T?.height??0,q=r+(o!=="center"?"-"+o:""),I=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},L=Array.isArray(d)?d:[d],P=L.length>0,B={padding:I,boundary:L.filter($$e),altBoundary:P},{refs:$,floatingStyles:V,placement:j,isPositioned:K,middlewareData:G}=x$e({strategy:"fixed",placement:q,whileElementsMounted:(...ee)=>d$e(...ee,{animationFrame:g==="always"}),elements:{reference:x.anchor},middleware:[k$e({mainAxis:i+O,alignmentAxis:a}),u&&_$e({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?E$e():void 0,...B}),u&&T$e({...B}),C$e({...B,apply:({elements:ee,rects:me,availableWidth:fe,availableHeight:ye})=>{const{width:ie,height:xe}=me.reference,ke=ee.floating.style;ke.setProperty("--radix-popper-available-width",`${fe}px`),ke.setProperty("--radix-popper-available-height",`${ye}px`),ke.setProperty("--radix-popper-anchor-width",`${ie}px`),ke.setProperty("--radix-popper-anchor-height",`${xe}px`)}}),M&&M$e({element:M,padding:c}),j$e({arrowWidth:C,arrowHeight:O}),y&&I$e({strategy:"referenceHidden",...B})]}),[J,F]=C7(j),U=ud(v);Ti(()=>{K&&U?.()},[K,U]);const Q=G.arrow?.x,z=G.arrow?.y,ne=G.arrow?.centerOffset!==0,[ce,Z]=A.useState();return Ti(()=>{k&&Z(window.getComputedStyle(k).zIndex)},[k]),N.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:K?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[G.transformOrigin?.x,G.transformOrigin?.y].join(" "),...G.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:N.jsx(P$e,{scope:n,placedSide:J,onArrowChange:D,arrowX:Q,arrowY:z,shouldHideArrow:ne,children:N.jsx(Pn.div,{"data-side":J,"data-align":F,...S,ref:E,style:{...S.style,animation:K?void 0:"none"}})})})});_7.displayName=cD;var E7="PopperArrow",L$e={top:"bottom",right:"left",bottom:"top",left:"right"},T7=A.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=N$e(E7,r),a=L$e[o.placedSide];return N.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:N.jsx(A$e,{...i,ref:n,style:{...i.style,display:"block"}})})});T7.displayName=E7;function $$e(e){return e!==null}var j$e=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,c=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[d,h]=C7(n),p={start:"0%",center:"50%",end:"100%"}[h],y=(i.arrow?.x??0)+c/2,g=(i.arrow?.y??0)+u/2;let v="",S="";return d==="bottom"?(v=a?p:`${y}px`,S=`${-u}px`):d==="top"?(v=a?p:`${y}px`,S=`${r.floating.height+u}px`):d==="right"?(v=`${-u}px`,S=a?p:`${g}px`):d==="left"&&(v=`${r.floating.width+u}px`,S=a?p:`${g}px`),{data:{x:v,y:S}}}});function C7(e){const[t,n="center"]=e.split("-");return[t,n]}var F$e=x7,z$e=k7,B$e=_7,U$e=T7;function q$e(e){const t=A.useRef({value:e,previous:e});return A.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var I7=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),V$e="VisuallyHidden",H$e=A.forwardRef((e,t)=>N.jsx(Pn.span,{...e,ref:t,style:{...I7,...e.style}}));H$e.displayName=V$e;var K$e=[" ","Enter","ArrowUp","ArrowDown"],W$e=[" ","Enter"],pd="Select",[Qw,Xw,G$e]=yLe(pd),[gp]=$w(pd,[G$e,v7]),Jw=v7(),[Y$e,Uc]=gp(pd),[Q$e,X$e]=gp(pd),M7=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:a,defaultValue:c,onValueChange:u,dir:d,name:h,autoComplete:p,disabled:y,required:g,form:v}=e,S=Jw(t),[x,k]=A.useState(null),[_,E]=A.useState(null),[M,D]=A.useState(!1),T=vLe(d),[C,O]=bI({prop:r,defaultProp:i??!1,onChange:o,caller:pd}),[q,I]=bI({prop:a,defaultProp:c,onChange:u,caller:pd}),L=A.useRef(null),P=x?v||!!x.closest("form"):!0,[B,$]=A.useState(new Set),V=Array.from(B).map(j=>j.props.value).join(";");return N.jsx(F$e,{...S,children:N.jsxs(Y$e,{required:g,scope:t,trigger:x,onTriggerChange:k,valueNode:_,onValueNodeChange:E,valueNodeHasChildren:M,onValueNodeHasChildrenChange:D,contentId:Zf(),value:q,onValueChange:I,open:C,onOpenChange:O,dir:T,triggerPointerDownPosRef:L,disabled:y,children:[N.jsx(Qw.Provider,{scope:t,children:N.jsx(Q$e,{scope:e.__scopeSelect,onNativeOptionAdd:A.useCallback(j=>{$(K=>new Set(K).add(j))},[]),onNativeOptionRemove:A.useCallback(j=>{$(K=>{const G=new Set(K);return G.delete(j),G})},[]),children:n})}),P?N.jsxs(Z7,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:p,value:q,onChange:j=>I(j.target.value),disabled:y,form:v,children:[q===void 0?N.jsx("option",{value:""}):null,Array.from(B)]},V):null]})})};M7.displayName=pd;var R7="SelectTrigger",A7=A.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=Jw(n),a=Uc(R7,n),c=a.disabled||r,u=wr(t,a.onTriggerChange),d=Xw(n),h=A.useRef("touch"),[p,y,g]=tY(S=>{const x=d().filter(E=>!E.disabled),k=x.find(E=>E.value===a.value),_=nY(x,S,k);_!==void 0&&a.onValueChange(_.value)}),v=S=>{c||(a.onOpenChange(!0),g()),S&&(a.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return N.jsx(z$e,{asChild:!0,...o,children:N.jsx(Pn.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":eY(a.value)?"":void 0,...i,ref:u,onClick:jn(i.onClick,S=>{S.currentTarget.focus(),h.current!=="mouse"&&v(S)}),onPointerDown:jn(i.onPointerDown,S=>{h.current=S.pointerType;const x=S.target;x.hasPointerCapture(S.pointerId)&&x.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(v(S),S.preventDefault())}),onKeyDown:jn(i.onKeyDown,S=>{const x=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&y(S.key),!(x&&S.key===" ")&&K$e.includes(S.key)&&(v(),S.preventDefault())})})})});A7.displayName=R7;var O7="SelectValue",D7=A.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:a="",...c}=e,u=Uc(O7,n),{onValueNodeHasChildrenChange:d}=u,h=o!==void 0,p=wr(t,u.onValueNodeChange);return Ti(()=>{d(h)},[d,h]),N.jsx(Pn.span,{...c,ref:p,style:{pointerEvents:"none"},children:eY(u.value)?N.jsx(N.Fragment,{children:a}):o})});D7.displayName=O7;var J$e="SelectIcon",P7=A.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return N.jsx(Pn.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});P7.displayName=J$e;var Z$e="SelectPortal",N7=e=>N.jsx(OO,{asChild:!0,...e});N7.displayName=Z$e;var md="SelectContent",L7=A.forwardRef((e,t)=>{const n=Uc(md,e.__scopeSelect),[r,i]=A.useState();if(Ti(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?Yy.createPortal(N.jsx($7,{scope:e.__scopeSelect,children:N.jsx(Qw.Slot,{scope:e.__scopeSelect,children:N.jsx("div",{children:e.children})})}),o):null}return N.jsx(j7,{...e,ref:t})});L7.displayName=md;var xs=10,[$7,qc]=gp(md),eje="SelectContentImpl",tje=Xg("SelectContent.RemoveScroll"),j7=A.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:a,side:c,sideOffset:u,align:d,alignOffset:h,arrowPadding:p,collisionBoundary:y,collisionPadding:g,sticky:v,hideWhenDetached:S,avoidCollisions:x,...k}=e,_=Uc(md,n),[E,M]=A.useState(null),[D,T]=A.useState(null),C=wr(t,ee=>M(ee)),[O,q]=A.useState(null),[I,L]=A.useState(null),P=Xw(n),[B,$]=A.useState(!1),V=A.useRef(!1);A.useEffect(()=>{if(E)return jW(E)},[E]),MW();const j=A.useCallback(ee=>{const[me,...fe]=P().map(xe=>xe.ref.current),[ye]=fe.slice(-1),ie=document.activeElement;for(const xe of ee)if(xe===ie||(xe?.scrollIntoView({block:"nearest"}),xe===me&&D&&(D.scrollTop=0),xe===ye&&D&&(D.scrollTop=D.scrollHeight),xe?.focus(),document.activeElement!==ie))return},[P,D]),K=A.useCallback(()=>j([O,E]),[j,O,E]);A.useEffect(()=>{B&&K()},[B,K]);const{onOpenChange:G,triggerPointerDownPosRef:J}=_;A.useEffect(()=>{if(E){let ee={x:0,y:0};const me=ye=>{ee={x:Math.abs(Math.round(ye.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(ye.pageY)-(J.current?.y??0))}},fe=ye=>{ee.x<=10&&ee.y<=10?ye.preventDefault():E.contains(ye.target)||G(!1),document.removeEventListener("pointermove",me),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",fe,{capture:!0})}}},[E,G,J]),A.useEffect(()=>{const ee=()=>G(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[G]);const[F,U]=tY(ee=>{const me=P().filter(ie=>!ie.disabled),fe=me.find(ie=>ie.ref.current===document.activeElement),ye=nY(me,ee,fe);ye&&setTimeout(()=>ye.ref.current.focus())}),Q=A.useCallback((ee,me,fe)=>{const ye=!V.current&&!fe;(_.value!==void 0&&_.value===me||ye)&&(q(ee),ye&&(V.current=!0))},[_.value]),z=A.useCallback(()=>E?.focus(),[E]),ne=A.useCallback((ee,me,fe)=>{const ye=!V.current&&!fe;(_.value!==void 0&&_.value===me||ye)&&L(ee)},[_.value]),ce=r==="popper"?NI:F7,Z=ce===NI?{side:c,sideOffset:u,align:d,alignOffset:h,arrowPadding:p,collisionBoundary:y,collisionPadding:g,sticky:v,hideWhenDetached:S,avoidCollisions:x}:{};return N.jsx($7,{scope:n,content:E,viewport:D,onViewportChange:T,itemRefCallback:Q,selectedItem:O,onItemLeave:z,itemTextRefCallback:ne,focusSelectedItem:K,selectedItemText:I,position:r,isPositioned:B,searchRef:F,children:N.jsx(DO,{as:tje,allowPinchZoom:!0,children:N.jsx(AO,{asChild:!0,trapped:_.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:jn(i,ee=>{_.trigger?.focus({preventScroll:!0}),ee.preventDefault()}),children:N.jsx(RO,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:N.jsx(ce,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:ee=>ee.preventDefault(),...k,...Z,onPlaced:()=>$(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:jn(k.onKeyDown,ee=>{const me=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!me&&ee.key.length===1&&U(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let ye=P().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const ie=ee.target,xe=ye.indexOf(ie);ye=ye.slice(xe+1)}setTimeout(()=>j(ye)),ee.preventDefault()}})})})})})})});j7.displayName=eje;var nje="SelectItemAlignedPosition",F7=A.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=Uc(md,n),a=qc(md,n),[c,u]=A.useState(null),[d,h]=A.useState(null),p=wr(t,C=>h(C)),y=Xw(n),g=A.useRef(!1),v=A.useRef(!0),{viewport:S,selectedItem:x,selectedItemText:k,focusSelectedItem:_}=a,E=A.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&S&&x&&k){const C=o.trigger.getBoundingClientRect(),O=d.getBoundingClientRect(),q=o.valueNode.getBoundingClientRect(),I=k.getBoundingClientRect();if(o.dir!=="rtl"){const ie=I.left-O.left,xe=q.left-ie,ke=C.left-xe,Ke=C.width+ke,Xe=Math.max(Ke,O.width),Je=window.innerWidth-xs,dt=L3(xe,[xs,Math.max(xs,Je-Xe)]);c.style.minWidth=Ke+"px",c.style.left=dt+"px"}else{const ie=O.right-I.right,xe=window.innerWidth-q.right-ie,ke=window.innerWidth-C.right-xe,Ke=C.width+ke,Xe=Math.max(Ke,O.width),Je=window.innerWidth-xs,dt=L3(xe,[xs,Math.max(xs,Je-Xe)]);c.style.minWidth=Ke+"px",c.style.right=dt+"px"}const L=y(),P=window.innerHeight-xs*2,B=S.scrollHeight,$=window.getComputedStyle(d),V=parseInt($.borderTopWidth,10),j=parseInt($.paddingTop,10),K=parseInt($.borderBottomWidth,10),G=parseInt($.paddingBottom,10),J=V+j+B+G+K,F=Math.min(x.offsetHeight*5,J),U=window.getComputedStyle(S),Q=parseInt(U.paddingTop,10),z=parseInt(U.paddingBottom,10),ne=C.top+C.height/2-xs,ce=P-ne,Z=x.offsetHeight/2,ee=x.offsetTop+Z,me=V+j+ee,fe=J-me;if(me<=ne){const ie=L.length>0&&x===L[L.length-1].ref.current;c.style.bottom="0px";const xe=d.clientHeight-S.offsetTop-S.offsetHeight,ke=Math.max(ce,Z+(ie?z:0)+xe+K),Ke=me+ke;c.style.height=Ke+"px"}else{const ie=L.length>0&&x===L[0].ref.current;c.style.top="0px";const ke=Math.max(ne,V+S.offsetTop+(ie?Q:0)+Z)+fe;c.style.height=ke+"px",S.scrollTop=me-ne+S.offsetTop}c.style.margin=`${xs}px 0`,c.style.minHeight=F+"px",c.style.maxHeight=P+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[y,o.trigger,o.valueNode,c,d,S,x,k,o.dir,r]);Ti(()=>E(),[E]);const[M,D]=A.useState();Ti(()=>{d&&D(window.getComputedStyle(d).zIndex)},[d]);const T=A.useCallback(C=>{C&&v.current===!0&&(E(),_?.(),v.current=!1)},[E,_]);return N.jsx(ije,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:N.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:N.jsx(Pn.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});F7.displayName=nje;var rje="SelectPopperPosition",NI=A.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=xs,...o}=e,a=Jw(n);return N.jsx(B$e,{...a,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});NI.displayName=rje;var[ije,uD]=gp(md,{}),LI="SelectViewport",z7=A.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=qc(LI,n),a=uD(LI,n),c=wr(t,o.onViewportChange),u=A.useRef(0);return N.jsxs(N.Fragment,{children:[N.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),N.jsx(Qw.Slot,{scope:n,children:N.jsx(Pn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:jn(i.onScroll,d=>{const h=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:y}=a;if(y?.current&&p){const g=Math.abs(u.current-h.scrollTop);if(g>0){const v=window.innerHeight-xs*2,S=parseFloat(p.style.minHeight),x=parseFloat(p.style.height),k=Math.max(S,x);if(k<v){const _=k+g,E=Math.min(v,_),M=_-E;p.style.height=E+"px",p.style.bottom==="0px"&&(h.scrollTop=M>0?M:0,p.style.justifyContent="flex-end")}}}u.current=h.scrollTop})})})]})});z7.displayName=LI;var B7="SelectGroup",[oje,sje]=gp(B7),aje=A.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Zf();return N.jsx(oje,{scope:n,id:i,children:N.jsx(Pn.div,{role:"group","aria-labelledby":i,...r,ref:t})})});aje.displayName=B7;var U7="SelectLabel",q7=A.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=sje(U7,n);return N.jsx(Pn.div,{id:i.id,...r,ref:t})});q7.displayName=U7;var dx="SelectItem",[lje,V7]=gp(dx),H7=A.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...a}=e,c=Uc(dx,n),u=qc(dx,n),d=c.value===r,[h,p]=A.useState(o??""),[y,g]=A.useState(!1),v=wr(t,_=>u.itemRefCallback?.(_,r,i)),S=Zf(),x=A.useRef("touch"),k=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return N.jsx(lje,{scope:n,value:r,disabled:i,textId:S,isSelected:d,onItemTextChange:A.useCallback(_=>{p(E=>E||(_?.textContent??"").trim())},[]),children:N.jsx(Qw.ItemSlot,{scope:n,value:r,disabled:i,textValue:h,children:N.jsx(Pn.div,{role:"option","aria-labelledby":S,"data-highlighted":y?"":void 0,"aria-selected":d&&y,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:v,onFocus:jn(a.onFocus,()=>g(!0)),onBlur:jn(a.onBlur,()=>g(!1)),onClick:jn(a.onClick,()=>{x.current!=="mouse"&&k()}),onPointerUp:jn(a.onPointerUp,()=>{x.current==="mouse"&&k()}),onPointerDown:jn(a.onPointerDown,_=>{x.current=_.pointerType}),onPointerMove:jn(a.onPointerMove,_=>{x.current=_.pointerType,i?u.onItemLeave?.():x.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:jn(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:jn(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(W$e.includes(_.key)&&k(),_.key===" "&&_.preventDefault())})})})})});H7.displayName=dx;var zm="SelectItemText",K7=A.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,a=Uc(zm,n),c=qc(zm,n),u=V7(zm,n),d=X$e(zm,n),[h,p]=A.useState(null),y=wr(t,k=>p(k),u.onItemTextChange,k=>c.itemTextRefCallback?.(k,u.value,u.disabled)),g=h?.textContent,v=A.useMemo(()=>N.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:S,onNativeOptionRemove:x}=d;return Ti(()=>(S(v),()=>x(v)),[S,x,v]),N.jsxs(N.Fragment,{children:[N.jsx(Pn.span,{id:u.textId,...o,ref:y}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Yy.createPortal(o.children,a.valueNode):null]})});K7.displayName=zm;var W7="SelectItemIndicator",G7=A.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return V7(W7,n).isSelected?N.jsx(Pn.span,{"aria-hidden":!0,...r,ref:t}):null});G7.displayName=W7;var $I="SelectScrollUpButton",Y7=A.forwardRef((e,t)=>{const n=qc($I,e.__scopeSelect),r=uD($I,e.__scopeSelect),[i,o]=A.useState(!1),a=wr(t,r.onScrollButtonChange);return Ti(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollTop>0;o(d)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?N.jsx(X7,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});Y7.displayName=$I;var jI="SelectScrollDownButton",Q7=A.forwardRef((e,t)=>{const n=qc(jI,e.__scopeSelect),r=uD(jI,e.__scopeSelect),[i,o]=A.useState(!1),a=wr(t,r.onScrollButtonChange);return Ti(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollHeight-u.clientHeight,h=Math.ceil(u.scrollTop)<d;o(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?N.jsx(X7,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});Q7.displayName=jI;var X7=A.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=qc("SelectScrollButton",n),a=A.useRef(null),c=Xw(n),u=A.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return A.useEffect(()=>()=>u(),[u]),Ti(()=>{c().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),N.jsx(Pn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:jn(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:jn(i.onPointerMove,()=>{o.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:jn(i.onPointerLeave,()=>{u()})})}),cje="SelectSeparator",J7=A.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return N.jsx(Pn.div,{"aria-hidden":!0,...r,ref:t})});J7.displayName=cje;var FI="SelectArrow",uje=A.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Jw(n),o=Uc(FI,n),a=qc(FI,n);return o.open&&a.position==="popper"?N.jsx(U$e,{...i,...r,ref:t}):null});uje.displayName=FI;var dje="SelectBubbleInput",Z7=A.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=A.useRef(null),o=wr(r,i),a=q$e(t);return A.useEffect(()=>{const c=i.current;if(!c)return;const u=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==t&&h){const p=new Event("change",{bubbles:!0});h.call(c,t),c.dispatchEvent(p)}},[a,t]),N.jsx(Pn.select,{...n,style:{...I7,...n.style},ref:o,defaultValue:t})});Z7.displayName=dje;function eY(e){return e===""||e===void 0}function tY(e){const t=ud(e),n=A.useRef(""),r=A.useRef(0),i=A.useCallback(a=>{const c=n.current+a;t(c),(function u(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[t]),o=A.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return A.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function nY(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=fje(e,Math.max(o,0));i.length===1&&(a=a.filter(d=>d!==n));const u=a.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function fje(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hje=M7,rY=A7,pje=D7,mje=P7,gje=N7,iY=L7,yje=z7,oY=q7,sY=H7,bje=K7,vje=G7,aY=Y7,lY=Q7,cY=J7;const Sje=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xje=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),G3=e=>{const t=xje(e);return t.charAt(0).toUpperCase()+t.slice(1)},uY=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),wje=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var kje={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const _je=A.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:a,...c},u)=>A.createElement("svg",{ref:u,...kje,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uY("lucide",i),...!o&&!wje(c)&&{"aria-hidden":"true"},...c},[...a.map(([d,h])=>A.createElement(d,h)),...Array.isArray(o)?o:[o]]));const dD=(e,t)=>{const n=A.forwardRef(({className:r,...i},o)=>A.createElement(_je,{ref:o,iconNode:t,className:uY(`lucide-${Sje(G3(e))}`,`lucide-${e}`,r),...i}));return n.displayName=G3(e),n};const Eje=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Tje=dD("check",Eje);const Cje=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],dY=dD("chevron-down",Cje);const Ije=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Mje=dD("chevron-up",Ije),Rje=hje,Aje=pje,fY=A.forwardRef(({className:e,children:t,...n},r)=>N.jsxs(rY,{ref:r,className:bi("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,N.jsx(mje,{asChild:!0,children:N.jsx(dY,{className:"h-4 w-4 opacity-50"})})]}));fY.displayName=rY.displayName;const hY=A.forwardRef(({className:e,...t},n)=>N.jsx(aY,{ref:n,className:bi("flex cursor-default items-center justify-center py-1",e),...t,children:N.jsx(Mje,{className:"h-4 w-4"})}));hY.displayName=aY.displayName;const pY=A.forwardRef(({className:e,...t},n)=>N.jsx(lY,{ref:n,className:bi("flex cursor-default items-center justify-center py-1",e),...t,children:N.jsx(dY,{className:"h-4 w-4"})}));pY.displayName=lY.displayName;const mY=A.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>N.jsx(gje,{children:N.jsxs(iY,{ref:i,className:bi("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[N.jsx(hY,{}),N.jsx(yje,{className:bi("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),N.jsx(pY,{})]})}));mY.displayName=iY.displayName;const Oje=A.forwardRef(({className:e,...t},n)=>N.jsx(oY,{ref:n,className:bi("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Oje.displayName=oY.displayName;const Su=A.forwardRef(({className:e,children:t,...n},r)=>N.jsxs(sY,{ref:r,className:bi("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[N.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:N.jsx(vje,{children:N.jsx(Tje,{className:"h-4 w-4"})})}),N.jsx(bje,{children:t})]}));Su.displayName=sY.displayName;const Dje=A.forwardRef(({className:e,...t},n)=>N.jsx(cY,{ref:n,className:bi("-mx-1 my-1 h-px bg-muted",e),...t}));Dje.displayName=cY.displayName;function Pje(e,t,n){const r=e.scrollTop,i=t-r,o=performance.now();function a(c){const u=c-o,d=Math.min(u/n,1),h=1-Math.pow(1-d,3);e.scrollTop=r+i*h,d<1&&requestAnimationFrame(a)}requestAnimationFrame(a)}const sS="speckit-task-highlight",Nje=3e3;function Lje({open:e,specId:t,task:n,fileName:r,viewMode:i,content:o,loading:a,error:c,onClose:u,onSelectFile:d,onSetViewMode:h,onChangeContent:p,onSave:y}){const g=A.useRef(null),v=A.useRef(null),S=A.useRef(null),x=A.useRef(null),k=A.useMemo(()=>{if(!n)return"详情";const _=Fu(n);return n.taskId?n.taskId+" · "+_:_},[n]);return A.useEffect(()=>()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null),S.current&&(S.current.classList.remove(sS),S.current=null)},[]),A.useEffect(()=>{if(!n||r!=="tasks.md"||i!=="preview"||v.current===n.line)return;const _=g.current;if(!_)return;const E=_.querySelector(`[data-md-line="${n.line}"]`),M=Array.from(new Set([n.taskId,Fu(n),n.title])).filter(T=>typeof T=="string"&&T.trim()!==""),D=E??(M.length>0?Array.from(_.querySelectorAll("li")).find(T=>{const C=T.textContent??"";return M.some(O=>C.includes(O))})??null:null);D instanceof HTMLElement&&(v.current=n.line,requestAnimationFrame(()=>{const T=_.getBoundingClientRect(),C=D.getBoundingClientRect(),O=C.top-T.top,q=_.scrollTop+O-_.clientHeight/2+C.height/2;Pje(_,q,600),x.current!==null&&(window.clearTimeout(x.current),x.current=null);const I=S.current;I&&I!==D&&I.classList.remove(sS),D.classList.add(sS),S.current=D,x.current=window.setTimeout(()=>{D.classList.remove(sS),S.current===D&&(S.current=null),x.current=null},Nje)}))},[n,r,i,o]),N.jsx(eG,{open:e,onOpenChange:_=>!_&&u(),children:N.jsxs($O,{className:"right-4 top-4 bottom-4 h-auto w-[800px] sm:max-w-none rounded-none border border-border shadow-2xl outline-none",overlayClassName:"bg-black/10 backdrop-blur-[1px]",motionProps:{initial:{opacity:0,x:20,scale:.98},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:20,scale:.98},transition:{type:"spring",damping:25,stiffness:300}},"aria-describedby":void 0,children:[N.jsx(ZW,{className:"sr-only",children:"Task Detail"}),t&&n?N.jsxs("div",{className:"flex h-full flex-col bg-background",children:[N.jsx("div",{className:"flex-none border-b-4 border-double border-border/40 bg-background px-6 py-5",children:N.jsxs("div",{className:"flex items-start justify-between gap-6",children:[N.jsxs("div",{className:"min-w-0",children:[N.jsx("div",{className:"text-xl font-bold font-serif leading-6 text-foreground break-words",children:k}),N.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[N.jsx(_n,{variant:"outline",className:"rounded-none font-mono",children:t}),N.jsxs(_n,{variant:"outline",className:"rounded-none font-mono",children:["L",n.line]})]})]}),N.jsx(ui,{type:"button",variant:"ghost",size:"icon",onClick:u,"aria-label":"Close",children:N.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),N.jsx("div",{className:"flex h-12 flex-none items-center border-b border-border/30 bg-background px-6",children:N.jsxs("div",{className:"flex w-full items-center justify-between",children:[N.jsxs("div",{className:"flex items-center gap-3",children:[N.jsx("label",{className:"font-mono text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Source"}),N.jsx("div",{className:"relative",children:N.jsxs(Rje,{value:r,onValueChange:_=>d(_),children:[N.jsx(fY,{className:"h-7 w-40 rounded-none border-border bg-background px-3 font-mono text-[11px] text-foreground transition-colors hover:border-foreground focus:ring-0",children:N.jsx(Aje,{placeholder:"Select Source"})}),N.jsxs(mY,{className:"rounded-none border-border bg-popover font-mono text-[11px]",children:[N.jsx(Su,{value:"tasks.md",className:"rounded-none text-[11px]",children:"tasks.md"}),N.jsx(Su,{value:"quickstart.md",className:"rounded-none text-[11px]",children:"quickstart.md"}),N.jsx(Su,{value:"data-model.md",className:"rounded-none text-[11px]",children:"data-model.md"}),N.jsx(Su,{value:"research.md",className:"rounded-none text-[11px]",children:"research.md"}),N.jsx(Su,{value:"plan.md",className:"rounded-none text-[11px]",children:"plan.md"}),N.jsx(Su,{value:"spec.md",className:"rounded-none text-[11px]",children:"spec.md"})]})]})})]}),N.jsxs("div",{className:"flex items-center gap-3",children:[c?N.jsx("span",{className:"text-xs text-destructive",children:c}):null,i==="edit"&&N.jsx(ui,{type:"button",size:"sm",variant:"outline",className:"h-7 rounded-none border-border px-3 font-mono text-[10px] tracking-wider hover:bg-foreground hover:text-background",disabled:a,onClick:y,children:a?"SAVING...":"SAVE"}),N.jsxs("div",{className:"flex items-center border border-border bg-background",children:[N.jsx("button",{type:"button",className:i==="preview"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>h("preview"),children:"PREVIEW"}),N.jsx("div",{className:"h-3 w-px bg-border"}),N.jsx("button",{type:"button",className:i==="edit"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>h("edit"),children:"EDIT"})]})]})]})}),N.jsx("div",{className:"flex-1 overflow-hidden bg-card",children:i==="preview"?N.jsx("div",{ref:g,className:"scrollbar-none h-full overflow-y-auto p-6",children:N.jsx(o7,{markdown:o})}):N.jsx("textarea",{className:"h-full w-full resize-none border-0 bg-transparent p-6 font-mono text-[13px] leading-6 text-foreground outline-none placeholder:text-muted-foreground",value:o,onChange:_=>p(_.target.value),placeholder:a?"加载中…":"文件内容…",spellCheck:!1})})]}):null]})})}const fx=mi("spec.md","plan.md","tasks.md","quickstart.md","data-model.md","research.md"),$je=yi({total:ar,done:ar,todo:ar}),jje=yi({id:Ut,num:ar,title:Ut,taskStats:Ym($je)}),Fje=yi({line:ar,checked:Eo,raw:Ut,title:Ut,taskId:Ym(Ut),parallel:Ym(Eo),story:Ym(Ut)}),zje=yi({code:Ut,index:ar,title:Ut,line:ar}),Bje=yi({open:Eo,specId:bo(Ut),fileName:fx,viewMode:mi("preview","edit"),loadingFile:Eo,fileError:bo(Ut),content:Ut,expandedStoryCode:bo(Ut),pendingScrollToTaskLine:bo(ar),pendingScrollToStoryLine:bo(ar),highlightTaskLine:bo(ar),loadingSpec:Eo,specError:bo(Ut),specMarkdown:Ut,artifactExists:Rf({key:Ut,value:Eo})}),Uje=yi({open:Eo,specId:bo(Ut),taskLine:bo(ar),fileName:fx,viewMode:mi("preview","edit"),loading:Eo,error:bo(Ut),content:Ut}),gY=yi({specId:Ut,line:ar}),qje=yi({hideDoneTasks:Eo,viewMode:mi("task","us"),viewModeBySpec:Rf({key:Ut,value:mi("task","us")}),refreshSeq:ar,error:bo(Ut),specs:CS(jje),tasksBySpec:Rf({key:Ut,value:CS(Fje)}),loadingBySpec:Rf({key:Ut,value:Eo}),storiesBySpec:Rf({key:Ut,value:CS(zje)}),loadingStoriesBySpec:Rf({key:Ut,value:Eo}),specDetail:Bje,taskDetail:Uje,focusedTask:bo(gY)}),Vje={"board/refresh":vs,"board/setHideDone":Eo,"board/setViewMode":mi("task","us"),"board/setSpecViewMode":yi({specId:Ut,mode:mi("task","us")}),"board/clearSpecViewMode":Ut,"board/toggleTask":yi({specId:Ut,line:ar,checked:Eo}),"specDetail/open":Ut,"specDetail/close":vs,"specDetail/selectFile":fx,"specDetail/setViewMode":mi("preview","edit"),"specDetail/setContent":Ut,"specDetail/save":vs,"specDetail/toggleStory":Ut,"specDetail/jumpToTask":ar,"specDetail/didScrollToTask":ar,"specDetail/jumpToStory":ar,"specDetail/didScrollToStory":ar,"specDetail/clearHighlight":vs,"taskDetail/open":yi({specId:Ut,line:ar}),"taskDetail/close":vs,"taskDetail/selectFile":fx,"taskDetail/setViewMode":mi("preview","edit"),"taskDetail/setContent":Ut,"taskDetail/save":vs,"board/focusNext":vs,"board/focusPrev":vs,"board/toggleFocusedTask":vs,"board/openFocusedTask":vs,"board/setFocusedTask":bo(gY)},El=$xe("SpeckitKanbanApp",{state:qje,actions:Vje});class rh extends Error{status;tag;constructor(t,n,r){super(`[${t}] ${n}: ${r}`),this.status=t,this.tag=n}}async function km(e,t){const n=await fetch(e,t);if(n.ok)return await n.json();if((n.headers.get("content-type")??"").includes("application/json")){const i=await n.json();throw new rh(n.status,i._tag??"Error",i.message??"Unknown error")}throw new rh(n.status,"Error",await n.text())}const _m={listSpecs:()=>km("/api/specs"),listTasks:e=>km(`/api/specs/${encodeURIComponent(e)}/tasks`),toggleTask:(e,t,n)=>km(`/api/specs/${encodeURIComponent(e)}/tasks/toggle`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({line:t,checked:n})}),readFile:(e,t)=>km(`/api/specs/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`),writeFile:(e,t,n)=>km(`/api/specs/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:n})})};class as extends tn("SpecboardApi")(){}const lg=e=>e instanceof rh&&e.status===404&&e.tag==="NotFoundError",xi=e=>e instanceof Error?e.message:String(e),Hje=()=>typeof window>"u"?!1:/^\/specs\/[^/]+\/?$/.test(window.location.pathname),hx=e=>{const t=e.length,n=e.filter(r=>r.checked).length;return{total:t,done:n,todo:t-n}},Y3=(e,t)=>e.viewModeBySpec[t]??e.viewMode,yY=e=>e.hideDoneTasks?e.specs.filter(t=>{const n=t.taskStats;return!n||n.total===0?!0:n.todo>0}):e.specs,Q3=e=>{const t=yY(e);if(!e.specDetail.open)return t;const n=e.specDetail.specId;if(!n||t.some(i=>i.id===n))return t;const r=e.specs.find(i=>i.id===n);return r?[...t,r]:t},Kje=El.logic(e=>({setup:he,run:ae(function*(){const t=e.onAction("board/setHideDone").mutate((o,a)=>{o.hideDoneTasks=a.payload}),n=e.onAction("board/setViewMode").mutate((o,a)=>{o.viewMode=a.payload,o.viewModeBySpec={}}),r=e.onAction("board/setSpecViewMode").mutate((o,a)=>{o.viewModeBySpec[a.payload.specId]=a.payload.mode}),i=e.onAction("board/clearSpecViewMode").mutate((o,a)=>{delete o.viewModeBySpec[a.payload]});yield*$c([t,n,r,i],{concurrency:"unbounded"})})})),Wje=El.logic(e=>({setup:he,run:ae(function*(){const t=yield*e.use(as),n=yield*vo(t.listSpecs());yield*e.state.mutate(i=>{if(n._tag==="Left"){i.error=xi(n.left),i.specs=[],i.tasksBySpec={},i.loadingBySpec={},i.storiesBySpec={},i.loadingStoriesBySpec={};return}i.error=null,i.specs=Array.from(n.right.items),i.tasksBySpec={},i.loadingBySpec={},i.storiesBySpec={},i.loadingStoriesBySpec={}}),yield*e.onAction("board/refresh").runLatestTask({pending:i=>e.state.mutate(o=>{o.error=null,o.refreshSeq+=1,o.tasksBySpec={},o.loadingBySpec={},o.storiesBySpec={},o.loadingStoriesBySpec={}}),effect:i=>ae(function*(){return yield*(yield*e.use(as)).listSpecs()}),success:(i,o)=>e.state.mutate(a=>{a.specs=Array.from(i.items)}),failure:(i,o)=>e.state.mutate(a=>{a.error=xi(i)})})})})),Gje=El.logic(e=>({setup:he,run:ae(function*(){yield*e.flow.fromState(r=>{const i=r,o=Q3(i),a=o.map(d=>d.id).join("|"),c=o.map(d=>`${d.id}:${Y3(i,d.id)}`).join("|"),u=[i.specDetail.open?`specDetail:${i.specDetail.specId??""}`:"specDetail:off",i.taskDetail.open?`taskDetail:${i.taskDetail.specId??""}:${i.taskDetail.taskLine??""}`:"taskDetail:off"].join("|");return`${a}::${c}::${i.refreshSeq}::${u}`}).pipe(e.flow.runLatest(ae(function*(){const r=yield*e.state.read;if(Hje()||r.specDetail.open||r.taskDetail.open)return;const i=yield*e.use(as),o=Q3(r);yield*sn(o,a=>ae(function*(){const c=yield*e.state.read,u=a.id,d=c.tasksBySpec[u]!==void 0,h=c.loadingBySpec[u]??!1,p=Y3(c,u),y=c.storiesBySpec[u]!==void 0,g=c.loadingStoriesBySpec[u]??!1,v=!d&&!h,S=p==="us"&&!y&&!g;v&&(yield*ae(function*(){yield*e.state.mutate(k=>{k.loadingBySpec[u]=!0});const x=yield*vo(i.listTasks(u));yield*e.state.mutate(k=>{if(x._tag==="Right"){k.tasksBySpec[u]=Array.from(x.right.tasks);return}if(lg(x.left)){k.tasksBySpec[u]=[];return}k.error=xi(x.left),k.tasksBySpec[u]=[]})}).pipe(_o(e.state.mutate(x=>{x.loadingBySpec[u]=!1})))),S&&(yield*ae(function*(){yield*e.state.mutate(k=>{k.loadingStoriesBySpec[u]=!0});const x=yield*vo(i.readFile(u,"spec.md"));yield*e.state.mutate(k=>{if(x._tag==="Right"){k.storiesBySpec[u]=Array.from(M9(x.right.content));return}if(lg(x.left)){k.storiesBySpec[u]=[];return}k.error=xi(x.left),k.storiesBySpec[u]=[]})}).pipe(_o(e.state.mutate(x=>{x.loadingStoriesBySpec[u]=!1}))))}),{concurrency:4})})))})})),Yje=El.logic(e=>({setup:he,run:ae(function*(){const t=(i,o,a)=>ae(function*(){const c=yield*e.use(as),u=yield*vo(c.toggleTask(i,o,a));yield*e.state.mutate(d=>{if(u._tag==="Left"){d.error=xi(u.left);return}const h=Array.from(u.right.tasks);d.tasksBySpec[i]=h;const p=hx(h);d.specs=d.specs.map(y=>y.id===i?{...y,taskStats:p}:y)})}),n=e.onAction("board/toggleTask").runParallelFork(i=>t(i.payload.specId,i.payload.line,i.payload.checked)),r=e.onAction("board/toggleFocusedTask").runParallelFork(()=>ae(function*(){const i=yield*e.state.read,o=i.focusedTask;if(!o)return;const c=i.tasksBySpec[o.specId]?.find(u=>u.line===o.line);c&&(yield*t(o.specId,o.line,!c.checked))}));yield*$c([n,r],{concurrency:"unbounded"})})})),Qje=El.logic(e=>({setup:he,run:ae(function*(){const t=e.onAction("specDetail/close").mutate(g=>{g.specDetail.open=!1,g.specDetail.specId=null,g.specDetail.viewMode="preview"}),n=e.onAction("specDetail/toggleStory").mutate((g,v)=>{g.specDetail.expandedStoryCode=g.specDetail.expandedStoryCode===v.payload?null:v.payload}),r=e.onAction("specDetail/jumpToStory").mutate((g,v)=>{g.specDetail.fileName="spec.md",g.specDetail.viewMode="preview",g.specDetail.loadingFile=!1,g.specDetail.fileError=null,g.specDetail.content=g.specDetail.specMarkdown,g.specDetail.pendingScrollToStoryLine=v.payload}),i=e.onAction("specDetail/selectFile").runLatestTask({pending:g=>e.state.mutate(v=>{v.specDetail.fileName=g.payload,v.specDetail.viewMode="preview",v.specDetail.loadingFile=!0,v.specDetail.fileError=null}),effect:g=>ae(function*(){const S=(yield*e.state.read).specDetail.specId;if(!S)return{name:g.payload,content:"",isNotFound:!1};const x=yield*e.use(as),k=yield*vo(x.readFile(S,g.payload));return k._tag==="Right"?{name:g.payload,content:k.right.content,isNotFound:!1}:{name:g.payload,content:"",isNotFound:lg(k.left),error:xi(k.left)}}),success:g=>e.state.mutate(v=>{if(v.specDetail.loadingFile=!1,g.isNotFound){v.specDetail.fileError=g.error??"文件不存在",v.specDetail.artifactExists[g.name]=!1;return}if("error"in g&&g.error){v.specDetail.fileError=g.error;return}v.specDetail.content=g.content,v.specDetail.artifactExists[g.name]=!0,g.name==="spec.md"&&(v.specDetail.specMarkdown=g.content,v.specDetail.specError=null)}),failure:g=>e.state.mutate(v=>{v.specDetail.loadingFile=!1,v.specDetail.fileError=xi(g)})}),o=e.onAction("specDetail/setViewMode").mutate((g,v)=>{g.specDetail.viewMode=v.payload}),a=e.onAction("specDetail/setContent").mutate((g,v)=>{g.specDetail.content=v.payload,g.specDetail.fileName==="spec.md"&&(g.specDetail.specMarkdown=v.payload)}),c=e.onAction("specDetail/open").runLatestTask({pending:g=>e.state.mutate(v=>{v.specDetail.open=!0,v.specDetail.specId=g.payload,v.specDetail.fileName="spec.md",v.specDetail.viewMode="preview",v.specDetail.loadingFile=!0,v.specDetail.fileError=null,v.specDetail.content="",v.specDetail.expandedStoryCode=null,v.specDetail.pendingScrollToTaskLine=null,v.specDetail.pendingScrollToStoryLine=null,v.specDetail.highlightTaskLine=null,v.specDetail.loadingSpec=!0,v.specDetail.specError=null,v.specDetail.specMarkdown="",v.specDetail.artifactExists={}}),effect:g=>ae(function*(){const v=yield*e.use(as),S=g.payload,x=yield*vo(v.readFile(S,"spec.md")),k=yield*vo(v.listTasks(S)),E=yield*sn(["quickstart.md","data-model.md","research.md","plan.md","tasks.md"],M=>v.readFile(S,M).pipe(pi({name:M,exists:!0}),Rg(()=>on({name:M,exists:!1}))),{concurrency:"unbounded"});return{specId:S,specMd:x,tasks:k,checks:E}}),success:g=>e.state.mutate(v=>{v.specDetail.loadingFile=!1,v.specDetail.loadingSpec=!1;for(const S of g.checks)S.exists===!0&&(v.specDetail.artifactExists[S.name]=!0),S.exists===!1&&(v.specDetail.artifactExists[S.name]=!1);if(g.tasks._tag==="Right"){const S=Array.from(g.tasks.right.tasks);v.tasksBySpec[g.specId]=S;const x=hx(S);v.specs=v.specs.map(k=>k.id===g.specId?{...k,taskStats:x}:k)}else lg(g.tasks.left)?v.tasksBySpec[g.specId]=[]:v.error=xi(g.tasks.left);if(g.specMd._tag==="Right"){v.specDetail.content=g.specMd.right.content,v.specDetail.specMarkdown=g.specMd.right.content,v.specDetail.artifactExists["spec.md"]=!0,v.specDetail.specError=null;return}v.specDetail.specError=xi(g.specMd.left),lg(g.specMd.left)&&(v.specDetail.artifactExists["spec.md"]=!1)}),failure:g=>e.state.mutate(v=>{v.specDetail.loadingFile=!1,v.specDetail.loadingSpec=!1,v.specDetail.fileError=xi(g),v.specDetail.specError=xi(g)})}),u=e.onAction("specDetail/jumpToTask").mutate((g,v)=>{g.specDetail.fileName="tasks.md",g.specDetail.viewMode="preview",g.specDetail.pendingScrollToTaskLine=v.payload}),d=e.onAction("specDetail/didScrollToTask").mutate((g,v)=>{g.specDetail.pendingScrollToTaskLine=null,g.specDetail.highlightTaskLine=v.payload}),h=e.onAction("specDetail/didScrollToStory").mutate(g=>{g.specDetail.pendingScrollToStoryLine=null}),p=e.onAction("specDetail/clearHighlight").mutate(g=>{g.specDetail.highlightTaskLine=null}),y=e.onAction("specDetail/save").runExhaustTask({pending:()=>e.state.mutate(g=>{g.specDetail.loadingFile=!0,g.specDetail.fileError=null}),effect:()=>ae(function*(){const g=yield*e.use(as),v=yield*e.state.read,S=v.specDetail.specId;if(!S)return{kind:"noop"};const x=v.specDetail.fileName,k=v.specDetail.content;if(yield*g.writeFile(S,x,k),x==="tasks.md"){const _=yield*g.listTasks(S);return{kind:"tasks",specId:S,tasks:_.tasks}}return x==="spec.md"?{kind:"specs",specs:(yield*g.listSpecs()).items}:{kind:"ok",specId:S,name:x}}),success:g=>e.state.mutate(v=>{if(v.specDetail.loadingFile=!1,g.kind!=="noop"){if(g.kind==="tasks"){v.tasksBySpec[g.specId]=Array.from(g.tasks),v.specs=v.specs.map(S=>S.id===g.specId?{...S,taskStats:hx(g.tasks)}:S),v.specDetail.artifactExists["tasks.md"]=!0;return}if(g.kind==="specs"){v.specs=Array.from(g.specs),v.specDetail.artifactExists["spec.md"]=!0;return}v.specDetail.artifactExists[v.specDetail.fileName]=!0}}),failure:g=>e.state.mutate(v=>{v.specDetail.loadingFile=!1,v.specDetail.fileError=xi(g)})});yield*$c([c,t,i,o,a,y,n,r,u,d,h,p],{concurrency:"unbounded"})})})),Xje=El.logic(e=>({setup:he,run:ae(function*(){const t=e.onAction("taskDetail/close").mutate(u=>{u.taskDetail.open=!1,u.taskDetail.specId=null,u.taskDetail.taskLine=null}),n=e.onAction("taskDetail/selectFile").runLatestTask({pending:u=>e.state.mutate(d=>{d.taskDetail.fileName=u.payload,d.taskDetail.viewMode="preview",d.taskDetail.loading=!0,d.taskDetail.error=null}),effect:u=>ae(function*(){const h=(yield*e.state.read).taskDetail.specId;return h?{content:(yield*(yield*e.use(as)).readFile(h,u.payload)).content}:{content:""}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.content=u.content}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=xi(u)})}),r=e.onAction("taskDetail/setContent").mutate((u,d)=>{u.taskDetail.content=d.payload}),i=e.onAction("taskDetail/setViewMode").mutate((u,d)=>{u.taskDetail.viewMode=d.payload}),o=e.onAction("taskDetail/open").runLatestTask({pending:u=>e.state.mutate(d=>{d.taskDetail.open=!0,d.taskDetail.specId=u.payload.specId,d.taskDetail.taskLine=u.payload.line,d.taskDetail.fileName="tasks.md",d.taskDetail.viewMode="preview",d.taskDetail.loading=!0,d.taskDetail.error=null,d.taskDetail.content=""}),effect:u=>ae(function*(){return{content:(yield*(yield*e.use(as)).readFile(u.payload.specId,"tasks.md")).content}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.content=u.content}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=xi(u)})}),a=e.onAction("board/openFocusedTask").runLatestTask({pending:()=>e.state.mutate(u=>{const d=u.focusedTask;d&&(u.taskDetail.open=!0,u.taskDetail.specId=d.specId,u.taskDetail.taskLine=d.line,u.taskDetail.fileName="tasks.md",u.taskDetail.viewMode="preview",u.taskDetail.loading=!0,u.taskDetail.error=null,u.taskDetail.content="")}),effect:()=>ae(function*(){const d=(yield*e.state.read).taskDetail.specId;return d?{content:(yield*(yield*e.use(as)).readFile(d,"tasks.md")).content}:{content:""}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.content=u.content}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=xi(u)})}),c=e.onAction("taskDetail/save").runExhaustTask({pending:()=>e.state.mutate(u=>{u.taskDetail.loading=!0,u.taskDetail.error=null}),effect:()=>ae(function*(){const u=yield*e.use(as),d=yield*e.state.read,h=d.taskDetail.specId;if(!h)return{kind:"noop"};const p=d.taskDetail.fileName,y=d.taskDetail.content;if(yield*u.writeFile(h,p,y),p==="tasks.md"){const g=yield*u.listTasks(h);return{kind:"tasks",specId:h,tasks:g.tasks}}return p==="spec.md"?{kind:"specs",specs:(yield*u.listSpecs()).items}:{kind:"ok"}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,u.kind==="tasks"?(d.tasksBySpec[u.specId]=Array.from(u.tasks),d.specs=d.specs.map(h=>h.id===u.specId?{...h,taskStats:hx(u.tasks)}:h)):u.kind==="specs"&&(d.specs=Array.from(u.specs))}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=xi(u)})});yield*$c([o,a,t,n,r,c,i],{concurrency:"unbounded"})})})),Jje=El.logic(e=>({setup:he,run:ae(function*(){const t=o=>{const a=yY(o),c=[];for(const u of a){const d=o.tasksBySpec[u.id];if(!d)continue;const h=o.hideDoneTasks?d.filter(p=>!p.checked):d;if(!(o.hideDoneTasks&&h.length===0))for(const p of h)c.push({specId:u.id,task:p})}return c},n=e.onAction("board/focusNext").mutate(o=>{const a=t(o);if(a.length===0)return;const c=o.focusedTask;if(!c){o.focusedTask={specId:a[0].specId,line:a[0].task.line};return}const u=a.findIndex(d=>d.specId===c.specId&&d.task.line===c.line);if(u===-1){o.focusedTask={specId:a[0].specId,line:a[0].task.line};return}if(u<a.length-1){const d=a[u+1];o.focusedTask={specId:d.specId,line:d.task.line}}}),r=e.onAction("board/focusPrev").mutate(o=>{const a=t(o);if(a.length===0)return;const c=o.focusedTask;if(!c){const d=a[a.length-1];o.focusedTask={specId:d.specId,line:d.task.line};return}const u=a.findIndex(d=>d.specId===c.specId&&d.task.line===c.line);if(u===-1){const d=a[a.length-1];o.focusedTask={specId:d.specId,line:d.task.line};return}if(u>0){const d=a[u-1];o.focusedTask={specId:d.specId,line:d.task.line}}}),i=e.onAction("board/setFocusedTask").mutate((o,a)=>{o.focusedTask=a.payload});yield*$c([n,r,i],{concurrency:"unbounded"})})})),Zje={hideDoneTasks:!0,viewMode:"us",viewModeBySpec:{},refreshSeq:0,error:null,specs:[],tasksBySpec:{},loadingBySpec:{},storiesBySpec:{},loadingStoriesBySpec:{},specDetail:{open:!1,specId:null,fileName:"spec.md",viewMode:"preview",loadingFile:!1,fileError:null,content:"",expandedStoryCode:null,pendingScrollToTaskLine:null,pendingScrollToStoryLine:null,highlightTaskLine:null,loadingSpec:!1,specError:null,specMarkdown:"",artifactExists:{}},taskDetail:{open:!1,specId:null,taskLine:null,fileName:"tasks.md",viewMode:"preview",loading:!1,error:null,content:""},focusedTask:null},bY=El.implement({initial:Zje,logics:[Wje,Kje,Gje,Yje,Qje,Xje,Jje]});bY.impl;function eFe({specDetailOpen:e,taskDetailOpen:t,onCloseDrawers:n,dispatch:r}){A.useEffect(()=>{const i=o=>{if(!(o.target instanceof HTMLInputElement||o.target instanceof HTMLTextAreaElement||o.target instanceof HTMLSelectElement)&&!(e||t))switch(o.key){case"j":case"ArrowDown":o.preventDefault(),r({_tag:"board/focusNext"});break;case"k":case"ArrowUp":o.preventDefault(),r({_tag:"board/focusPrev"});break;case" ":o.preventDefault(),r({_tag:"board/toggleFocusedTask"});break;case"Enter":o.preventDefault(),r({_tag:"board/openFocusedTask"});break}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e,t,n,r])}const tFe=CO("bg-card text-card-foreground",{variants:{variant:{elevated:"bg-card border border-border shadow-[var(--shadow-elevated)]",inset:"bg-muted/10 border border-border shadow-[var(--shadow-inset)]",flat:"bg-card border border-border"},padding:{none:"",sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{variant:"elevated",padding:"md"}});function aS({className:e,variant:t,padding:n,asChild:r=!1,...i}){const o=r?EW:"div";return N.jsx(o,{className:bi(tFe({variant:t,padding:n,className:e})),...i})}function rT({className:e,...t}){return N.jsx("div",{className:bi("flex flex-col gap-1.5",e),...t})}function iT({className:e,...t}){return N.jsx("p",{className:bi("text-base font-semibold leading-tight",e),...t})}function oT({className:e,...t}){return N.jsx("p",{className:bi("text-sm text-muted-foreground",e),...t})}function lS({className:e,...t}){return N.jsx("div",{className:bi("min-w-0",e),...t})}function nFe(){return N.jsxs("div",{className:"h-screen w-screen overflow-hidden bg-background",children:[N.jsx("header",{className:"border-b-4 border-double border-border/40 bg-background",children:N.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between gap-4 px-6 py-6",children:[N.jsxs("div",{className:"min-w-0",children:[N.jsx("div",{className:"text-2xl font-bold font-serif tracking-tight text-foreground",children:"Speckit Kit"}),N.jsx("div",{className:"mt-1 text-sm text-muted-foreground font-mono italic",children:"Design System Showcase · Vol. 1"})]}),N.jsxs("nav",{className:"flex items-center gap-2",children:[N.jsx(ui,{asChild:!0,variant:"ghost",size:"sm",className:"font-serif",children:N.jsx(Hg,{to:"/",children:"← Back to Kanban"})}),N.jsx(ui,{asChild:!0,variant:"secondary",size:"sm",className:"font-mono text-xs uppercase tracking-wider",children:N.jsx(Hg,{to:"/design-system",children:"System"})})]})]})}),N.jsx("main",{className:"scrollbar-none h-full overflow-y-auto pb-16",children:N.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-12 px-6 py-12",children:[N.jsxs("section",{children:[N.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[N.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Buttons"}),N.jsx(_n,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"ui/button"})]}),N.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[N.jsx(ui,{children:"Default"}),N.jsx(ui,{variant:"secondary",children:"Secondary"}),N.jsx(ui,{variant:"outline",children:"Outline"}),N.jsx(ui,{variant:"ghost",children:"Ghost"}),N.jsx(ui,{variant:"destructive",children:"Destructive"}),N.jsx(ui,{disabled:!0,children:"Disabled"})]})]}),N.jsxs("section",{children:[N.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[N.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Badges / Stamps"}),N.jsx(_n,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"ui/badge"})]}),N.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[N.jsx(_n,{children:"Default"}),N.jsx(_n,{variant:"info",children:"Info"}),N.jsx(_n,{variant:"success",children:"Success"}),N.jsx(_n,{variant:"warning",children:"Warning"}),N.jsx(_n,{variant:"danger",children:"Danger"}),N.jsx(_n,{variant:"outline",children:"Outline"})]})]}),N.jsxs("section",{children:[N.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[N.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Cards / Panes"}),N.jsx(_n,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"ui/card"})]}),N.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[N.jsxs(aS,{variant:"elevated",children:[N.jsxs(rT,{children:[N.jsx(iT,{className:"font-serif",children:"Elevated"}),N.jsx(oT,{children:"Hard shadow lift"})]}),N.jsx(lS,{children:N.jsx("div",{className:"text-sm text-muted-foreground",children:"Used for main content blocks."})})]}),N.jsxs(aS,{variant:"inset",children:[N.jsxs(rT,{children:[N.jsx(iT,{className:"font-serif",children:"Inset"}),N.jsx(oT,{children:"Recessed grouping"})]}),N.jsx(lS,{children:N.jsx("div",{className:"text-sm text-muted-foreground",children:"Used for containers."})})]}),N.jsxs(aS,{variant:"flat",children:[N.jsxs(rT,{children:[N.jsx(iT,{className:"font-serif",children:"Flat"}),N.jsx(oT,{children:"Structure only"})]}),N.jsx(lS,{children:N.jsx("div",{className:"text-sm text-muted-foreground",children:"Used for static data."})})]})]})]}),N.jsxs("section",{children:[N.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[N.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Interactives & Motion"}),N.jsx(_n,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"Real Components"})]}),N.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-8 md:grid-cols-2",children:[N.jsxs("div",{className:"space-y-4",children:[N.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Task Cards (Spring Entry + Hover Lift)"}),N.jsxs("div",{className:"w-[360px] space-y-2",children:[N.jsx(yI,{task:{line:1,checked:!1,raw:"- [ ] T-101 Implement login flow",title:"Implement login flow",taskId:"T-101",story:"US1"},onToggle:()=>{},onOpenDetail:()=>{}}),N.jsx(yI,{task:{line:2,checked:!0,raw:"- [x] T-102 Setup database schema",title:"Setup database schema",taskId:"T-102",parallel:!0},onToggle:()=>{},onOpenDetail:()=>{}})]})]}),N.jsxs("div",{className:"space-y-4",children:[N.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"User Story Cards"}),N.jsxs("div",{className:"w-[360px] space-y-2",children:[N.jsx(ex,{storyCode:"US1",title:"User Authentication",stats:{total:5,done:2,todo:3},hint:"Todo 3",onOpen:()=>{}}),N.jsx(ex,{storyCode:"US2",title:"Payment Gateway Integration",stats:void 0,tone:"danger",hint:"Missing in spec",onOpen:()=>{}})]})]})]})]}),N.jsxs("section",{children:[N.jsxs("div",{className:"flex items-center gap-3",children:[N.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Highlight"}),N.jsx(_n,{variant:"outline",className:"font-mono",children:".speckit-task-highlight"})]}),N.jsx("div",{className:"mt-4",children:N.jsx(aS,{variant:"flat",children:N.jsx(lS,{children:N.jsx("div",{className:"speckit-task-highlight inline-block rounded-xl px-2 py-1 text-sm bg-muted",children:"这个块用于验证「滚动居中 + 2 秒高亮」的视觉效果"})})})})]})]})})]})}function rFe(e){return`/specs/${encodeURIComponent(e)}`}function iFe(){const e=rke(El),t=ike(e),n=w9(),i=cz("/specs/:specId")?.params?.specId??null,o=i!==null,a=cz("/design-system")!==null,c=Ji(e,L=>L.hideDoneTasks),u=Ji(e,L=>L.viewMode),d=Ji(e,L=>L.viewModeBySpec),h=Ji(e,L=>L.storiesBySpec),p=Ji(e,L=>L.loadingStoriesBySpec),y=Ji(e,L=>L.error),g=Ji(e,L=>L.specs),v=Ji(e,L=>L.tasksBySpec),S=Ji(e,L=>L.loadingBySpec),x=Ji(e,L=>L.specDetail),k=Ji(e,L=>L.taskDetail),_=Ji(e,L=>L.focusedTask);A.useEffect(()=>{i&&(x.open&&x.specId===i||t({_tag:"specDetail/open",payload:i}))},[i,x.open,x.specId,t]);const E=A.useCallback(()=>{o&&n("/"),t({_tag:"specDetail/close"})},[o,n,t]),M=A.useCallback(()=>{const L=x.specId;if(L){if(o){n("/");return}n(rFe(L))}},[x.specId,o,n]),D=A.useCallback(()=>{t({_tag:"taskDetail/close"}),o&&n("/"),t({_tag:"specDetail/close"})},[t,o,n]);eFe({specDetailOpen:x.open||o,taskDetailOpen:k.open,onCloseDrawers:D,dispatch:t});const T=A.useMemo(()=>c?g.filter(L=>{const P=L.taskStats;return!P||P.total===0?!0:P.todo>0}):g,[g,c]),C=A.useMemo(()=>T.map(L=>{const P=v[L.id],B=c&&P?P.filter(J=>!J.checked):P,V=P!==void 0&&P.length>0&&B?.length===0,j=c&&V,K=d[L.id]??u,G=d[L.id]??null;return{spec:L,allTasks:P,tasks:B,loading:S[L.id]??!1,stories:h[L.id],loadingStories:p[L.id]??!1,viewMode:K,viewModeOverride:G,hide:j}}).filter(L=>!L.hide),[T,v,S,h,p,c,u,d]),O=A.useMemo(()=>!x.open||!x.specId?null:g.find(L=>L.id===x.specId)??null,[x.open,x.specId,g]),q=A.useMemo(()=>!k.open||!k.specId||k.taskLine===null?null:(v[k.specId]??[]).find(P=>P.line===k.taskLine)??null,[k.open,k.specId,k.taskLine,v]),I=k.open||x.open&&!o;return a?N.jsx(nFe,{}):N.jsxs("div",{className:"h-screen w-screen overflow-hidden bg-background",children:[!o&&N.jsxs("div",{className:`flex h-full flex-col bg-background transition-all duration-300 ease-out ${I?"opacity-30 pointer-events-none grayscale":""}`,children:[N.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-4 border-b-4 border-double border-border/40 bg-background px-6 py-4",children:[N.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[N.jsx("h1",{className:"text-2xl font-black tracking-tight text-foreground font-serif",children:"Speckit Board"}),N.jsx("div",{className:"hidden border-l-2 border-border pl-4 md:block",children:N.jsx("div",{className:"font-mono text-[10px] font-bold uppercase tracking-widest text-muted-foreground opacity-60",children:"Specifications · Stories · Tasks"})})]}),N.jsx("div",{className:"justify-self-center",children:N.jsx(kW,{value:u,onChange:L=>t({_tag:"board/setViewMode",payload:L})})}),N.jsxs("div",{className:"flex items-center justify-self-end gap-6",children:[N.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[N.jsxs("div",{className:"relative flex items-center justify-center",children:[N.jsx("input",{className:"peer h-4 w-4 appearance-none border border-border bg-background transition-colors checked:bg-foreground checked:border-foreground hover:border-foreground/50 rounded-none cursor-pointer",type:"checkbox",checked:c,onChange:L=>t({_tag:"board/setHideDone",payload:L.target.checked})}),N.jsx("svg",{className:"pointer-events-none absolute h-3 w-3 text-background opacity-0 peer-checked:opacity-100",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),N.jsx("span",{className:"font-mono text-[11px] font-bold uppercase tracking-wider group-hover:text-foreground",children:"Hide Done"})]}),N.jsx("div",{className:"h-6 w-px bg-border/40"}),N.jsx(Hg,{to:"/design-system",className:"font-mono text-[11px] font-bold uppercase tracking-wider text-muted-foreground hover:text-foreground hover:underline underline-offset-4 decoration-border",children:"Design System"}),N.jsx(ui,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-none border-border hover:bg-foreground hover:text-background transition-colors",onClick:()=>window.location.reload(),title:"Refresh",children:N.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),y?N.jsx("div",{className:"border-b border-destructive/20 bg-destructive/10 px-6 py-2 text-sm text-destructive",children:y}):null,N.jsx("div",{className:"scrollbar-none flex-1 overflow-x-auto overflow-y-hidden bg-background p-0",children:N.jsx("div",{className:"flex h-full min-w-max divide-x divide-border/30 border-l border-border/30",children:C.map(({spec:L,allTasks:P,tasks:B,loading:$,stories:V,loadingStories:j,viewMode:K,viewModeOverride:G})=>N.jsx(sMe,{spec:L,allTasks:P,tasks:B,loading:$,stories:V,loadingStories:j,viewMode:K,globalViewMode:u,hasViewModeOverride:G!==null,focusedTaskLine:_?.specId===L.id?_.line:null,onOpenSpecDetail:()=>t({_tag:"specDetail/open",payload:L.id}),onToggleTask:(J,F)=>t({_tag:"board/toggleTask",payload:{specId:L.id,line:J.line,checked:F}}),onOpenTask:J=>t({_tag:"taskDetail/open",payload:{specId:L.id,line:J.line}}),onOpenStory:J=>{t.batch([{_tag:"specDetail/open",payload:L.id},{_tag:"specDetail/toggleStory",payload:J}])},onChangeViewMode:J=>{if(J===u){if(G===null)return;t({_tag:"board/clearSpecViewMode",payload:L.id});return}G!==J&&t({_tag:"board/setSpecViewMode",payload:{specId:L.id,mode:J}})}},L.id))})})]}),N.jsx(gLe,{open:x.open||o,specId:x.specId??i,spec:O,tasks:x.specId?v[x.specId]:void 0,fileName:x.fileName,viewMode:x.viewMode,loadingFile:x.loadingFile,fileError:x.fileError,content:x.content,loadingSpec:x.loadingSpec,specError:x.specError,specMarkdown:x.specMarkdown,artifactExists:x.artifactExists,expandedStoryCode:x.expandedStoryCode,pendingScrollToTaskLine:x.pendingScrollToTaskLine,pendingScrollToStoryLine:x.pendingScrollToStoryLine,highlightTaskLine:x.highlightTaskLine,isFullscreen:o,onToggleFullscreen:M,onClose:E,onSelectFile:L=>t({_tag:"specDetail/selectFile",payload:L}),onSetViewMode:L=>t({_tag:"specDetail/setViewMode",payload:L}),onChangeContent:L=>t({_tag:"specDetail/setContent",payload:L}),onSave:()=>t({_tag:"specDetail/save"}),onToggleStory:L=>t({_tag:"specDetail/toggleStory",payload:L}),onJumpToTaskLine:L=>t({_tag:"specDetail/jumpToTask",payload:L}),onDidScrollToTaskLine:L=>t({_tag:"specDetail/didScrollToTask",payload:L}),onJumpToStoryLine:L=>t({_tag:"specDetail/jumpToStory",payload:L}),onDidScrollToStoryLine:L=>t({_tag:"specDetail/didScrollToStory",payload:L}),onClearHighlight:()=>t({_tag:"specDetail/clearHighlight"}),onOpenTask:L=>{x.specId&&t({_tag:"taskDetail/open",payload:{specId:x.specId,line:L.line}})}}),N.jsx(Lje,{open:k.open,specId:k.specId,task:q,fileName:k.fileName,viewMode:k.viewMode,content:k.content,loading:k.loading,error:k.error,onClose:()=>t({_tag:"taskDetail/close"}),onSelectFile:L=>t({_tag:"taskDetail/selectFile",payload:L}),onSetViewMode:L=>t({_tag:"taskDetail/setViewMode",payload:L}),onChangeContent:L=>t({_tag:"taskDetail/setContent",payload:L}),onSave:()=>t({_tag:"taskDetail/save"})})]})}const Em=e=>e instanceof rh?e:e instanceof Error?new rh(0,"Error",e.message):new rh(0,"Error",String(e)),oFe=ca(as,{listSpecs:()=>dm({try:()=>_m.listSpecs(),catch:Em}),listTasks:e=>dm({try:()=>_m.listTasks(e),catch:Em}),toggleTask:(e,t,n)=>dm({try:()=>_m.toggleTask(e,t,n),catch:Em}),readFile:(e,t)=>dm({try:()=>_m.readFile(e,t),catch:Em}),writeFile:(e,t,n)=>dm({try:()=>_m.writeFile(e,t,n),catch:Em})}),sFe=oFe,aFe=bY,lFe=rwe(aFe,{label:"SpeckitKanban",layer:sFe}),vY=document.getElementById("app");if(!vY)throw new Error("Root element #app not found");jX.createRoot(vY).render(N.jsx(Fwe,{runtime:lFe,policy:{mode:"sync"},children:N.jsx(b_e,{children:N.jsx(iFe,{})})}));