@mastra/deployer-vercel 1.1.4-alpha.0 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/studio/assets/{chunk-PWJL5CTE-D_XVAV7z.js → chunk-PWJL5CTE-Dv4maY2A.js} +1 -1
- package/dist/studio/assets/{index-CgHCtBXq.js → index-0ogwceH9.js} +1 -1
- package/dist/studio/assets/{index-l77wCrIl.js → index-3147QKVW.js} +1 -1
- package/dist/studio/assets/{index-Cr6Y_Jof.js → index-BRlWCzSh.js} +1 -1
- package/dist/studio/assets/{index-oG9dowad.js → index-BkcTqPVm.js} +1 -1
- package/dist/studio/assets/{index-BJh94DZc.js → index-BuCne47J.js} +1 -1
- package/dist/studio/assets/{index-BhSuEm_p.js → index-BwpOMbRD.js} +1 -1
- package/dist/studio/assets/{index-POcKmAX6.js → index-BxPl_9JX.js} +1 -1
- package/dist/studio/assets/{index-DyVLBkbU.js → index-CEuoXL3V.js} +1 -1
- package/dist/studio/assets/{index-BHGXURPl.js → index-Ce7l__85.js} +1 -1
- package/dist/studio/assets/{index-DHJD5ZyK.js → index-CpUCA2LC.js} +1 -1
- package/dist/studio/assets/{index-Chwi49oR.js → index-Cymq8ErC.js} +1 -1
- package/dist/studio/assets/{index-DpDp-WqO.js → index-D4LBNnnu.js} +1 -1
- package/dist/studio/assets/{index-ClbIuQ_V.js → index-DAS2hCYZ.js} +1 -1
- package/dist/studio/assets/{index-iL7CEiaJ.js → index-DT5Y2foR.js} +1 -1
- package/dist/studio/assets/{index-cwBsVttq.js → index-DkLlZWtE.js} +1 -1
- package/dist/studio/assets/{index-DOmXbeTt.js → index-DvGJHdrs.js} +1 -1
- package/dist/studio/assets/{index-C4lOZyCE.js → index-K8sMzO3W.js} +1 -1
- package/dist/studio/assets/{index-DZz2mPEp.js → index-L-kG6ngL.js} +1 -1
- package/dist/studio/assets/{main-DIRBKMs5.js → main-DaYXkE3d.js} +6 -6
- package/dist/studio/assets/{token-6GSAFR2W-USHIPDRT-w-9JAN9G.js → token-6GSAFR2W-USHIPDRT-D13tY_KD.js} +1 -1
- package/dist/studio/assets/token-util-NEHG7TUY-AXWAPLPA-DWvovtwo.js +1 -0
- package/dist/studio/index.html +1 -1
- package/package.json +6 -6
- package/dist/studio/assets/token-util-NEHG7TUY-AXWAPLPA-Cgrx5Y2h.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{_ as Qe}from"./index-DOmXbeTt.js";function _Te(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var SR=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ju(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s3={exports:{}},_1={};var Ole;function yrt(){if(Ole)return _1;Ole=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+s.key),"key"in s){a={};for(var i in s)i!=="key"&&(a[i]=s[i])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:o,ref:s!==void 0?s:null,props:a}}return _1.Fragment=t,_1.jsx=n,_1.jsxs=n,_1}var kle;function vrt(){return kle||(kle=1,s3.exports=yrt()),s3.exports}var l=vrt(),a3={exports:{}},Kn={},_le;function xrt(){if(_le)return Kn;_le=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),h=Symbol.iterator;function g(z){return z===null||typeof z!="object"?null:(z=h&&z[h]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(z,R,Q){this.props=z,this.context=R,this.refs=x,this.updater=Q||b}w.prototype.isReactComponent={},w.prototype.setState=function(z,R){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,R,"setState")},w.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function O(){}O.prototype=w.prototype;function _(z,R,Q){this.props=z,this.context=R,this.refs=x,this.updater=Q||b}var C=_.prototype=new O;C.constructor=_,y(C,w.prototype),C.isPureReactComponent=!0;var E=Array.isArray;function T(){}var N={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(z,R,Q){var G=Q.ref;return{$$typeof:t,type:z,key:R,ref:G!==void 0?G:null,props:Q}}function P(z,R){return I(z.type,R,z.props)}function $(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function U(z){var R={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Q){return R[Q]})}var L=/\/+/g;function B(z,R){return typeof z=="object"&&z!==null&&z.key!=null?U(""+z.key):R.toString(36)}function H(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(T,T):(z.status="pending",z.then(function(R){z.status==="pending"&&(z.status="fulfilled",z.value=R)},function(R){z.status==="pending"&&(z.status="rejected",z.reason=R)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function q(z,R,Q,G,J){var ee=typeof z;(ee==="undefined"||ee==="boolean")&&(z=null);var ne=!1;if(z===null)ne=!0;else switch(ee){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(z.$$typeof){case t:case n:ne=!0;break;case f:return ne=z._init,q(ne(z._payload),R,Q,G,J)}}if(ne)return J=J(z),ne=G===""?"."+B(z,0):G,E(J)?(Q="",ne!=null&&(Q=ne.replace(L,"$&/")+"/"),q(J,R,Q,"",function(ye){return ye})):J!=null&&($(J)&&(J=P(J,Q+(J.key==null||z&&z.key===J.key?"":(""+J.key).replace(L,"$&/")+"/")+ne)),R.push(J)),1;ne=0;var ae=G===""?".":G+":";if(E(z))for(var ce=0;ce<z.length;ce++)G=z[ce],ee=ae+B(G,ce),ne+=q(G,R,Q,ee,J);else if(ce=g(z),typeof ce=="function")for(z=ce.call(z),ce=0;!(G=z.next()).done;)G=G.value,ee=ae+B(G,ce++),ne+=q(G,R,Q,ee,J);else if(ee==="object"){if(typeof z.then=="function")return q(H(z),R,Q,G,J);throw R=String(z),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return ne}function V(z,R,Q){if(z==null)return z;var G=[],J=0;return q(z,G,"","",function(ee){return R.call(Q,ee,J++)}),G}function W(z){if(z._status===-1){var R=z._result;R=R(),R.then(function(Q){(z._status===0||z._status===-1)&&(z._status=1,z._result=Q)},function(Q){(z._status===0||z._status===-1)&&(z._status=2,z._result=Q)}),z._status===-1&&(z._status=0,z._result=R)}if(z._status===1)return z._result.default;throw z._result}var D=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(R))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",z);return}console.error(z)},Z={map:V,forEach:function(z,R,Q){V(z,function(){R.apply(this,arguments)},Q)},count:function(z){var R=0;return V(z,function(){R++}),R},toArray:function(z){return V(z,function(R){return R})||[]},only:function(z){if(!$(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Kn.Activity=p,Kn.Children=Z,Kn.Component=w,Kn.Fragment=r,Kn.Profiler=a,Kn.PureComponent=_,Kn.StrictMode=s,Kn.Suspense=u,Kn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Kn.__COMPILER_RUNTIME={__proto__:null,c:function(z){return N.H.useMemoCache(z)}},Kn.cache=function(z){return function(){return z.apply(null,arguments)}},Kn.cacheSignal=function(){return null},Kn.cloneElement=function(z,R,Q){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var G=y({},z.props),J=z.key;if(R!=null)for(ee in R.key!==void 0&&(J=""+R.key),R)!A.call(R,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&R.ref===void 0||(G[ee]=R[ee]);var ee=arguments.length-2;if(ee===1)G.children=Q;else if(1<ee){for(var ne=Array(ee),ae=0;ae<ee;ae++)ne[ae]=arguments[ae+2];G.children=ne}return I(z.type,J,G)},Kn.createContext=function(z){return z={$$typeof:i,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},Kn.createElement=function(z,R,Q){var G,J={},ee=null;if(R!=null)for(G in R.key!==void 0&&(ee=""+R.key),R)A.call(R,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=R[G]);var ne=arguments.length-2;if(ne===1)J.children=Q;else if(1<ne){for(var ae=Array(ne),ce=0;ce<ne;ce++)ae[ce]=arguments[ce+2];J.children=ae}if(z&&z.defaultProps)for(G in ne=z.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(z,ee,J)},Kn.createRef=function(){return{current:null}},Kn.forwardRef=function(z){return{$$typeof:c,render:z}},Kn.isValidElement=$,Kn.lazy=function(z){return{$$typeof:f,_payload:{_status:-1,_result:z},_init:W}},Kn.memo=function(z,R){return{$$typeof:d,type:z,compare:R===void 0?null:R}},Kn.startTransition=function(z){var R=N.T,Q={};N.T=Q;try{var G=z(),J=N.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,D)}catch(ee){D(ee)}finally{R!==null&&Q.types!==null&&(R.types=Q.types),N.T=R}},Kn.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Kn.use=function(z){return N.H.use(z)},Kn.useActionState=function(z,R,Q){return N.H.useActionState(z,R,Q)},Kn.useCallback=function(z,R){return N.H.useCallback(z,R)},Kn.useContext=function(z){return N.H.useContext(z)},Kn.useDebugValue=function(){},Kn.useDeferredValue=function(z,R){return N.H.useDeferredValue(z,R)},Kn.useEffect=function(z,R){return N.H.useEffect(z,R)},Kn.useEffectEvent=function(z){return N.H.useEffectEvent(z)},Kn.useId=function(){return N.H.useId()},Kn.useImperativeHandle=function(z,R,Q){return N.H.useImperativeHandle(z,R,Q)},Kn.useInsertionEffect=function(z,R){return N.H.useInsertionEffect(z,R)},Kn.useLayoutEffect=function(z,R){return N.H.useLayoutEffect(z,R)},Kn.useMemo=function(z,R){return N.H.useMemo(z,R)},Kn.useOptimistic=function(z,R){return N.H.useOptimistic(z,R)},Kn.useReducer=function(z,R,Q){return N.H.useReducer(z,R,Q)},Kn.useRef=function(z){return N.H.useRef(z)},Kn.useState=function(z){return N.H.useState(z)},Kn.useSyncExternalStore=function(z,R,Q){return N.H.useSyncExternalStore(z,R,Q)},Kn.useTransition=function(){return N.H.useTransition()},Kn.version="19.2.3",Kn}var Ele;function Qw(){return Ele||(Ele=1,a3.exports=xrt()),a3.exports}var S=Qw();const xe=Ju(S),Hw=_Te({__proto__:null,default:xe},[S]);var o3={exports:{}},E1={},i3={exports:{}},l3={};var Cle;function wrt(){return Cle||(Cle=1,(function(e){function t(H,q){var V=H.length;H.push(q);e:for(;0<V;){var W=V-1>>>1,D=H[W];if(0<s(D,q))H[W]=q,H[V]=D,V=W;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var q=H[0],V=H.pop();if(V!==q){H[0]=V;e:for(var W=0,D=H.length,Z=D>>>1;W<Z;){var z=2*(W+1)-1,R=H[z],Q=z+1,G=H[Q];if(0>s(R,V))Q<D&&0>s(G,R)?(H[W]=G,H[Q]=V,W=Q):(H[W]=R,H[z]=V,W=z);else if(Q<D&&0>s(G,V))H[W]=G,H[Q]=V,W=Q;else break e}}return q}function s(H,q){var V=H.sortIndex-q.sortIndex;return V!==0?V:H.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,i=o.now();e.unstable_now=function(){return o.now()-i}}var c=[],u=[],d=1,f=null,p=3,h=!1,g=!1,b=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function _(H){for(var q=n(u);q!==null;){if(q.callback===null)r(u);else if(q.startTime<=H)r(u),q.sortIndex=q.expirationTime,t(c,q);else break;q=n(u)}}function C(H){if(b=!1,_(H),!g)if(n(c)!==null)g=!0,E||(E=!0,$());else{var q=n(u);q!==null&&B(C,q.startTime-H)}}var E=!1,T=-1,N=5,A=-1;function I(){return y?!0:!(e.unstable_now()-A<N)}function P(){if(y=!1,E){var H=e.unstable_now();A=H;var q=!0;try{e:{g=!1,b&&(b=!1,w(T),T=-1),h=!0;var V=p;try{t:{for(_(H),f=n(c);f!==null&&!(f.expirationTime>H&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,p=f.priorityLevel;var D=W(f.expirationTime<=H);if(H=e.unstable_now(),typeof D=="function"){f.callback=D,_(H),q=!0;break t}f===n(c)&&r(c),_(H)}else r(c);f=n(c)}if(f!==null)q=!0;else{var Z=n(u);Z!==null&&B(C,Z.startTime-H),q=!1}}break e}finally{f=null,p=V,h=!1}q=void 0}}finally{q?$():E=!1}}}var $;if(typeof O=="function")$=function(){O(P)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,L=U.port2;U.port1.onmessage=P,$=function(){L.postMessage(null)}}else $=function(){x(P,0)};function B(H,q){T=x(function(){H(e.unstable_now())},q)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(H){switch(p){case 1:case 2:case 3:var q=3;break;default:q=p}var V=p;p=q;try{return H()}finally{p=V}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(H,q){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var V=p;p=H;try{return q()}finally{p=V}},e.unstable_scheduleCallback=function(H,q,V){var W=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?W+V:W):V=W,H){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=V+D,H={id:d++,callback:q,priorityLevel:H,startTime:V,expirationTime:D,sortIndex:-1},V>W?(H.sortIndex=V,t(u,H),n(c)===null&&H===n(u)&&(b?(w(T),T=-1):b=!0,B(C,V-W))):(H.sortIndex=D,t(c,H),g||h||(g=!0,E||(E=!0,$()))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var q=p;return function(){var V=p;p=q;try{return H.apply(this,arguments)}finally{p=V}}}})(l3)),l3}var Tle;function Srt(){return Tle||(Tle=1,i3.exports=wrt()),i3.exports}var c3={exports:{}},ki={};var Nle;function Ort(){if(Nle)return ki;Nle=1;var e=Qw();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" 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},s=Symbol.for("react.portal");function a(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function i(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return ki.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ki.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return a(c,u,null,d)},ki.flushSync=function(c){var u=o.T,d=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=u,r.p=d,r.d.f()}},ki.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},ki.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},ki.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=i(d,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,h=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:p,fetchPriority:h}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:p,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},ki.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=i(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},ki.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=i(d,u.crossOrigin);r.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},ki.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=i(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},ki.requestFormReset=function(c){r.d.r(c)},ki.unstable_batchedUpdates=function(c,u){return c(u)},ki.useFormState=function(c,u,d){return o.H.useFormState(c,u,d)},ki.useFormStatus=function(){return o.H.useHostTransitionStatus()},ki.version="19.2.3",ki}var jle;function ETe(){if(jle)return c3.exports;jle=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(),c3.exports=Ort(),c3.exports}var Ale;function krt(){if(Ale)return E1;Ale=1;var e={env:{}};var t=Srt(),n=Qw(),r=ETe();function s(m){var v="https://react.dev/errors/"+m;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var k=2;k<arguments.length;k++)v+="&args[]="+encodeURIComponent(arguments[k])}return"Minified React error #"+m+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(m){return!(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)}function o(m){var v=m,k=m;if(m.alternate)for(;v.return;)v=v.return;else{m=v;do v=m,(v.flags&4098)!==0&&(k=v.return),m=v.return;while(m)}return v.tag===3?k:null}function i(m){if(m.tag===13){var v=m.memoizedState;if(v===null&&(m=m.alternate,m!==null&&(v=m.memoizedState)),v!==null)return v.dehydrated}return null}function c(m){if(m.tag===31){var v=m.memoizedState;if(v===null&&(m=m.alternate,m!==null&&(v=m.memoizedState)),v!==null)return v.dehydrated}return null}function u(m){if(o(m)!==m)throw Error(s(188))}function d(m){var v=m.alternate;if(!v){if(v=o(m),v===null)throw Error(s(188));return v!==m?null:m}for(var k=m,j=v;;){var M=k.return;if(M===null)break;var F=M.alternate;if(F===null){if(j=M.return,j!==null){k=j;continue}break}if(M.child===F.child){for(F=M.child;F;){if(F===k)return u(M),m;if(F===j)return u(M),v;F=F.sibling}throw Error(s(188))}if(k.return!==j.return)k=M,j=F;else{for(var X=!1,oe=M.child;oe;){if(oe===k){X=!0,k=M,j=F;break}if(oe===j){X=!0,j=M,k=F;break}oe=oe.sibling}if(!X){for(oe=F.child;oe;){if(oe===k){X=!0,k=F,j=M;break}if(oe===j){X=!0,j=F,k=M;break}oe=oe.sibling}if(!X)throw Error(s(189))}}if(k.alternate!==j)throw Error(s(190))}if(k.tag!==3)throw Error(s(188));return k.stateNode.current===k?m:v}function f(m){var v=m.tag;if(v===5||v===26||v===27||v===6)return m;for(m=m.child;m!==null;){if(v=f(m),v!==null)return v;m=m.sibling}return null}var p=Object.assign,h=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),_=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function U(m){return m===null||typeof m!="object"?null:(m=$&&m[$]||m["@@iterator"],typeof m=="function"?m:null)}var L=Symbol.for("react.client.reference");function B(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===L?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case y:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof m=="object")switch(m.$$typeof){case b:return"Portal";case _:return m.displayName||"Context";case O:return(m._context.displayName||"Context")+".Consumer";case C:var v=m.render;return m=m.displayName,m||(m=v.displayName||v.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case N:return v=m.displayName||null,v!==null?v:B(m.type)||"Memo";case A:v=m._payload,m=m._init;try{return B(m(v))}catch{}}return null}var H=Array.isArray,q=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},D=[],Z=-1;function z(m){return{current:m}}function R(m){0>Z||(m.current=D[Z],D[Z]=null,Z--)}function Q(m,v){Z++,D[Z]=m.current,m.current=v}var G=z(null),J=z(null),ee=z(null),ne=z(null);function ae(m,v){switch(Q(ee,v),Q(J,m),Q(G,null),v.nodeType){case 9:case 11:m=(m=v.documentElement)&&(m=m.namespaceURI)?Hie(m):0;break;default:if(m=v.tagName,v=v.namespaceURI)v=Hie(v),m=Gie(v,m);else switch(m){case"svg":m=1;break;case"math":m=2;break;default:m=0}}R(G),Q(G,m)}function ce(){R(G),R(J),R(ee)}function ye(m){m.memoizedState!==null&&Q(ne,m);var v=G.current,k=Gie(v,m.type);v!==k&&(Q(J,m),Q(G,k))}function Y(m){J.current===m&&(R(G),R(J)),ne.current===m&&(R(ne),w1._currentValue=W)}var se,te;function he(m){if(se===void 0)try{throw Error()}catch(k){var v=k.stack.trim().match(/\n( *(at )?)/);se=v&&v[1]||"",te=-1<k.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-0ogwceH9.js","./index-DvGJHdrs.js","./index-DT5Y2foR.js","./index-L-kG6ngL.js","./index-K8sMzO3W.js","./index-DAS2hCYZ.js","./index-D4LBNnnu.js","./index-CEuoXL3V.js","./index-BkcTqPVm.js","./index-Ce7l__85.js","./index-Cymq8ErC.js","./index-BxPl_9JX.js","./index-BuCne47J.js","./index-3147QKVW.js","./index-CpUCA2LC.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-BwpOMbRD.js","./index-BRlWCzSh.js","./token-util-NEHG7TUY-AXWAPLPA-DWvovtwo.js","./chunk-PWJL5CTE-Dv4maY2A.js","./token-6GSAFR2W-USHIPDRT-D13tY_KD.js","./index-DkLlZWtE.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as Qe}from"./index-DvGJHdrs.js";function _Te(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var SR=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ju(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s3={exports:{}},_1={};var Ole;function yrt(){if(Ole)return _1;Ole=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+s.key),"key"in s){a={};for(var i in s)i!=="key"&&(a[i]=s[i])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:o,ref:s!==void 0?s:null,props:a}}return _1.Fragment=t,_1.jsx=n,_1.jsxs=n,_1}var kle;function vrt(){return kle||(kle=1,s3.exports=yrt()),s3.exports}var l=vrt(),a3={exports:{}},Kn={},_le;function xrt(){if(_le)return Kn;_le=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),h=Symbol.iterator;function g(z){return z===null||typeof z!="object"?null:(z=h&&z[h]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(z,R,Q){this.props=z,this.context=R,this.refs=x,this.updater=Q||b}w.prototype.isReactComponent={},w.prototype.setState=function(z,R){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,R,"setState")},w.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function O(){}O.prototype=w.prototype;function _(z,R,Q){this.props=z,this.context=R,this.refs=x,this.updater=Q||b}var C=_.prototype=new O;C.constructor=_,y(C,w.prototype),C.isPureReactComponent=!0;var E=Array.isArray;function T(){}var N={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(z,R,Q){var G=Q.ref;return{$$typeof:t,type:z,key:R,ref:G!==void 0?G:null,props:Q}}function P(z,R){return I(z.type,R,z.props)}function $(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function U(z){var R={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Q){return R[Q]})}var L=/\/+/g;function B(z,R){return typeof z=="object"&&z!==null&&z.key!=null?U(""+z.key):R.toString(36)}function H(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(T,T):(z.status="pending",z.then(function(R){z.status==="pending"&&(z.status="fulfilled",z.value=R)},function(R){z.status==="pending"&&(z.status="rejected",z.reason=R)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function q(z,R,Q,G,J){var ee=typeof z;(ee==="undefined"||ee==="boolean")&&(z=null);var ne=!1;if(z===null)ne=!0;else switch(ee){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(z.$$typeof){case t:case n:ne=!0;break;case f:return ne=z._init,q(ne(z._payload),R,Q,G,J)}}if(ne)return J=J(z),ne=G===""?"."+B(z,0):G,E(J)?(Q="",ne!=null&&(Q=ne.replace(L,"$&/")+"/"),q(J,R,Q,"",function(ye){return ye})):J!=null&&($(J)&&(J=P(J,Q+(J.key==null||z&&z.key===J.key?"":(""+J.key).replace(L,"$&/")+"/")+ne)),R.push(J)),1;ne=0;var ae=G===""?".":G+":";if(E(z))for(var ce=0;ce<z.length;ce++)G=z[ce],ee=ae+B(G,ce),ne+=q(G,R,Q,ee,J);else if(ce=g(z),typeof ce=="function")for(z=ce.call(z),ce=0;!(G=z.next()).done;)G=G.value,ee=ae+B(G,ce++),ne+=q(G,R,Q,ee,J);else if(ee==="object"){if(typeof z.then=="function")return q(H(z),R,Q,G,J);throw R=String(z),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return ne}function V(z,R,Q){if(z==null)return z;var G=[],J=0;return q(z,G,"","",function(ee){return R.call(Q,ee,J++)}),G}function W(z){if(z._status===-1){var R=z._result;R=R(),R.then(function(Q){(z._status===0||z._status===-1)&&(z._status=1,z._result=Q)},function(Q){(z._status===0||z._status===-1)&&(z._status=2,z._result=Q)}),z._status===-1&&(z._status=0,z._result=R)}if(z._status===1)return z._result.default;throw z._result}var D=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(R))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",z);return}console.error(z)},Z={map:V,forEach:function(z,R,Q){V(z,function(){R.apply(this,arguments)},Q)},count:function(z){var R=0;return V(z,function(){R++}),R},toArray:function(z){return V(z,function(R){return R})||[]},only:function(z){if(!$(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Kn.Activity=p,Kn.Children=Z,Kn.Component=w,Kn.Fragment=r,Kn.Profiler=a,Kn.PureComponent=_,Kn.StrictMode=s,Kn.Suspense=u,Kn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Kn.__COMPILER_RUNTIME={__proto__:null,c:function(z){return N.H.useMemoCache(z)}},Kn.cache=function(z){return function(){return z.apply(null,arguments)}},Kn.cacheSignal=function(){return null},Kn.cloneElement=function(z,R,Q){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var G=y({},z.props),J=z.key;if(R!=null)for(ee in R.key!==void 0&&(J=""+R.key),R)!A.call(R,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&R.ref===void 0||(G[ee]=R[ee]);var ee=arguments.length-2;if(ee===1)G.children=Q;else if(1<ee){for(var ne=Array(ee),ae=0;ae<ee;ae++)ne[ae]=arguments[ae+2];G.children=ne}return I(z.type,J,G)},Kn.createContext=function(z){return z={$$typeof:i,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},Kn.createElement=function(z,R,Q){var G,J={},ee=null;if(R!=null)for(G in R.key!==void 0&&(ee=""+R.key),R)A.call(R,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=R[G]);var ne=arguments.length-2;if(ne===1)J.children=Q;else if(1<ne){for(var ae=Array(ne),ce=0;ce<ne;ce++)ae[ce]=arguments[ce+2];J.children=ae}if(z&&z.defaultProps)for(G in ne=z.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(z,ee,J)},Kn.createRef=function(){return{current:null}},Kn.forwardRef=function(z){return{$$typeof:c,render:z}},Kn.isValidElement=$,Kn.lazy=function(z){return{$$typeof:f,_payload:{_status:-1,_result:z},_init:W}},Kn.memo=function(z,R){return{$$typeof:d,type:z,compare:R===void 0?null:R}},Kn.startTransition=function(z){var R=N.T,Q={};N.T=Q;try{var G=z(),J=N.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,D)}catch(ee){D(ee)}finally{R!==null&&Q.types!==null&&(R.types=Q.types),N.T=R}},Kn.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Kn.use=function(z){return N.H.use(z)},Kn.useActionState=function(z,R,Q){return N.H.useActionState(z,R,Q)},Kn.useCallback=function(z,R){return N.H.useCallback(z,R)},Kn.useContext=function(z){return N.H.useContext(z)},Kn.useDebugValue=function(){},Kn.useDeferredValue=function(z,R){return N.H.useDeferredValue(z,R)},Kn.useEffect=function(z,R){return N.H.useEffect(z,R)},Kn.useEffectEvent=function(z){return N.H.useEffectEvent(z)},Kn.useId=function(){return N.H.useId()},Kn.useImperativeHandle=function(z,R,Q){return N.H.useImperativeHandle(z,R,Q)},Kn.useInsertionEffect=function(z,R){return N.H.useInsertionEffect(z,R)},Kn.useLayoutEffect=function(z,R){return N.H.useLayoutEffect(z,R)},Kn.useMemo=function(z,R){return N.H.useMemo(z,R)},Kn.useOptimistic=function(z,R){return N.H.useOptimistic(z,R)},Kn.useReducer=function(z,R,Q){return N.H.useReducer(z,R,Q)},Kn.useRef=function(z){return N.H.useRef(z)},Kn.useState=function(z){return N.H.useState(z)},Kn.useSyncExternalStore=function(z,R,Q){return N.H.useSyncExternalStore(z,R,Q)},Kn.useTransition=function(){return N.H.useTransition()},Kn.version="19.2.3",Kn}var Ele;function Qw(){return Ele||(Ele=1,a3.exports=xrt()),a3.exports}var S=Qw();const xe=Ju(S),Hw=_Te({__proto__:null,default:xe},[S]);var o3={exports:{}},E1={},i3={exports:{}},l3={};var Cle;function wrt(){return Cle||(Cle=1,(function(e){function t(H,q){var V=H.length;H.push(q);e:for(;0<V;){var W=V-1>>>1,D=H[W];if(0<s(D,q))H[W]=q,H[V]=D,V=W;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var q=H[0],V=H.pop();if(V!==q){H[0]=V;e:for(var W=0,D=H.length,Z=D>>>1;W<Z;){var z=2*(W+1)-1,R=H[z],Q=z+1,G=H[Q];if(0>s(R,V))Q<D&&0>s(G,R)?(H[W]=G,H[Q]=V,W=Q):(H[W]=R,H[z]=V,W=z);else if(Q<D&&0>s(G,V))H[W]=G,H[Q]=V,W=Q;else break e}}return q}function s(H,q){var V=H.sortIndex-q.sortIndex;return V!==0?V:H.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,i=o.now();e.unstable_now=function(){return o.now()-i}}var c=[],u=[],d=1,f=null,p=3,h=!1,g=!1,b=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function _(H){for(var q=n(u);q!==null;){if(q.callback===null)r(u);else if(q.startTime<=H)r(u),q.sortIndex=q.expirationTime,t(c,q);else break;q=n(u)}}function C(H){if(b=!1,_(H),!g)if(n(c)!==null)g=!0,E||(E=!0,$());else{var q=n(u);q!==null&&B(C,q.startTime-H)}}var E=!1,T=-1,N=5,A=-1;function I(){return y?!0:!(e.unstable_now()-A<N)}function P(){if(y=!1,E){var H=e.unstable_now();A=H;var q=!0;try{e:{g=!1,b&&(b=!1,w(T),T=-1),h=!0;var V=p;try{t:{for(_(H),f=n(c);f!==null&&!(f.expirationTime>H&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,p=f.priorityLevel;var D=W(f.expirationTime<=H);if(H=e.unstable_now(),typeof D=="function"){f.callback=D,_(H),q=!0;break t}f===n(c)&&r(c),_(H)}else r(c);f=n(c)}if(f!==null)q=!0;else{var Z=n(u);Z!==null&&B(C,Z.startTime-H),q=!1}}break e}finally{f=null,p=V,h=!1}q=void 0}}finally{q?$():E=!1}}}var $;if(typeof O=="function")$=function(){O(P)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,L=U.port2;U.port1.onmessage=P,$=function(){L.postMessage(null)}}else $=function(){x(P,0)};function B(H,q){T=x(function(){H(e.unstable_now())},q)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(H){switch(p){case 1:case 2:case 3:var q=3;break;default:q=p}var V=p;p=q;try{return H()}finally{p=V}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(H,q){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var V=p;p=H;try{return q()}finally{p=V}},e.unstable_scheduleCallback=function(H,q,V){var W=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?W+V:W):V=W,H){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=V+D,H={id:d++,callback:q,priorityLevel:H,startTime:V,expirationTime:D,sortIndex:-1},V>W?(H.sortIndex=V,t(u,H),n(c)===null&&H===n(u)&&(b?(w(T),T=-1):b=!0,B(C,V-W))):(H.sortIndex=D,t(c,H),g||h||(g=!0,E||(E=!0,$()))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var q=p;return function(){var V=p;p=q;try{return H.apply(this,arguments)}finally{p=V}}}})(l3)),l3}var Tle;function Srt(){return Tle||(Tle=1,i3.exports=wrt()),i3.exports}var c3={exports:{}},ki={};var Nle;function Ort(){if(Nle)return ki;Nle=1;var e=Qw();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" 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},s=Symbol.for("react.portal");function a(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function i(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return ki.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ki.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return a(c,u,null,d)},ki.flushSync=function(c){var u=o.T,d=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=u,r.p=d,r.d.f()}},ki.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},ki.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},ki.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=i(d,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,h=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:p,fetchPriority:h}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:p,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},ki.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=i(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},ki.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=i(d,u.crossOrigin);r.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},ki.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=i(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},ki.requestFormReset=function(c){r.d.r(c)},ki.unstable_batchedUpdates=function(c,u){return c(u)},ki.useFormState=function(c,u,d){return o.H.useFormState(c,u,d)},ki.useFormStatus=function(){return o.H.useHostTransitionStatus()},ki.version="19.2.3",ki}var jle;function ETe(){if(jle)return c3.exports;jle=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(),c3.exports=Ort(),c3.exports}var Ale;function krt(){if(Ale)return E1;Ale=1;var e={env:{}};var t=Srt(),n=Qw(),r=ETe();function s(m){var v="https://react.dev/errors/"+m;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var k=2;k<arguments.length;k++)v+="&args[]="+encodeURIComponent(arguments[k])}return"Minified React error #"+m+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(m){return!(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)}function o(m){var v=m,k=m;if(m.alternate)for(;v.return;)v=v.return;else{m=v;do v=m,(v.flags&4098)!==0&&(k=v.return),m=v.return;while(m)}return v.tag===3?k:null}function i(m){if(m.tag===13){var v=m.memoizedState;if(v===null&&(m=m.alternate,m!==null&&(v=m.memoizedState)),v!==null)return v.dehydrated}return null}function c(m){if(m.tag===31){var v=m.memoizedState;if(v===null&&(m=m.alternate,m!==null&&(v=m.memoizedState)),v!==null)return v.dehydrated}return null}function u(m){if(o(m)!==m)throw Error(s(188))}function d(m){var v=m.alternate;if(!v){if(v=o(m),v===null)throw Error(s(188));return v!==m?null:m}for(var k=m,j=v;;){var M=k.return;if(M===null)break;var F=M.alternate;if(F===null){if(j=M.return,j!==null){k=j;continue}break}if(M.child===F.child){for(F=M.child;F;){if(F===k)return u(M),m;if(F===j)return u(M),v;F=F.sibling}throw Error(s(188))}if(k.return!==j.return)k=M,j=F;else{for(var X=!1,oe=M.child;oe;){if(oe===k){X=!0,k=M,j=F;break}if(oe===j){X=!0,j=M,k=F;break}oe=oe.sibling}if(!X){for(oe=F.child;oe;){if(oe===k){X=!0,k=F,j=M;break}if(oe===j){X=!0,j=F,k=M;break}oe=oe.sibling}if(!X)throw Error(s(189))}}if(k.alternate!==j)throw Error(s(190))}if(k.tag!==3)throw Error(s(188));return k.stateNode.current===k?m:v}function f(m){var v=m.tag;if(v===5||v===26||v===27||v===6)return m;for(m=m.child;m!==null;){if(v=f(m),v!==null)return v;m=m.sibling}return null}var p=Object.assign,h=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),_=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function U(m){return m===null||typeof m!="object"?null:(m=$&&m[$]||m["@@iterator"],typeof m=="function"?m:null)}var L=Symbol.for("react.client.reference");function B(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===L?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case y:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof m=="object")switch(m.$$typeof){case b:return"Portal";case _:return m.displayName||"Context";case O:return(m._context.displayName||"Context")+".Consumer";case C:var v=m.render;return m=m.displayName,m||(m=v.displayName||v.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case N:return v=m.displayName||null,v!==null?v:B(m.type)||"Memo";case A:v=m._payload,m=m._init;try{return B(m(v))}catch{}}return null}var H=Array.isArray,q=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},D=[],Z=-1;function z(m){return{current:m}}function R(m){0>Z||(m.current=D[Z],D[Z]=null,Z--)}function Q(m,v){Z++,D[Z]=m.current,m.current=v}var G=z(null),J=z(null),ee=z(null),ne=z(null);function ae(m,v){switch(Q(ee,v),Q(J,m),Q(G,null),v.nodeType){case 9:case 11:m=(m=v.documentElement)&&(m=m.namespaceURI)?Hie(m):0;break;default:if(m=v.tagName,v=v.namespaceURI)v=Hie(v),m=Gie(v,m);else switch(m){case"svg":m=1;break;case"math":m=2;break;default:m=0}}R(G),Q(G,m)}function ce(){R(G),R(J),R(ee)}function ye(m){m.memoizedState!==null&&Q(ne,m);var v=G.current,k=Gie(v,m.type);v!==k&&(Q(J,m),Q(G,k))}function Y(m){J.current===m&&(R(G),R(J)),ne.current===m&&(R(ne),w1._currentValue=W)}var se,te;function he(m){if(se===void 0)try{throw Error()}catch(k){var v=k.stack.trim().match(/\n( *(at )?)/);se=v&&v[1]||"",te=-1<k.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<k.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+se+m+te}var le=!1;function ge(m,v){if(!m||le)return"";le=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var j={DetermineComponentFrameRoot:function(){try{if(v){var tt=function(){throw Error()};if(Object.defineProperty(tt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(tt,[])}catch(He){var Fe=He}Reflect.construct(m,[],tt)}else{try{tt.call()}catch(He){Fe=He}m.call(tt.prototype)}}else{try{throw Error()}catch(He){Fe=He}(tt=m())&&typeof tt.catch=="function"&&tt.catch(function(){})}}catch(He){if(He&&Fe&&typeof He.stack=="string")return[He.stack,Fe.stack]}return[null,null]}};j.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var M=Object.getOwnPropertyDescriptor(j.DetermineComponentFrameRoot,"name");M&&M.configurable&&Object.defineProperty(j.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var F=j.DetermineComponentFrameRoot(),X=F[0],oe=F[1];if(X&&oe){var be=X.split(`
|
|
5
5
|
`),$e=oe.split(`
|
|
@@ -128,7 +128,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
128
128
|
constructor(\${params}) {
|
|
129
129
|
\${}
|
|
130
130
|
}
|
|
131
|
-
}`,{label:"class",detail:"definition",type:"keyword"}),Al('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Al('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Q4e=lJ.concat([Al("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Al("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Al("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),pve=new Z$e,H4e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function $1(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const k4t=["FunctionDeclaration"],_4t={FunctionDeclaration:$1("function"),ClassDeclaration:$1("class"),ClassExpression:()=>!0,EnumDeclaration:$1("constant"),TypeAliasDeclaration:$1("type"),NamespaceDeclaration:$1("namespace"),VariableDefinition(e,t){e.matchContext(k4t)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function G4e(e,t){let n=pve.get(t);if(n)return n;let r=[],s=!0;function a(o,i){let c=e.sliceString(o.from,o.to);r.push({label:c,type:i})}return t.cursor(ws.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let i=_4t[o.name];if(i&&i(o,a)||H4e.has(o.name))return!1}else if(o.to-o.from>8192){for(let i of G4e(e,o.node))r.push(i);return!1}}),pve.set(t,r),r}const gI=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,cJ=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function W4e(e){let t=$s(e.state).resolveInner(e.pos,-1);if(cJ.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&gI.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let s=t;s;s=s.parent)H4e.has(s.name)&&(r=r.concat(G4e(e.state.doc,s)));return{options:r,from:n?t.from:e.pos,validFor:gI}}function oB(e,t,n){var r;let s=[];for(;;){let a=t.firstChild,o;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:n};if(a?.name=="MemberExpression"&&((r=o=a.lastChild)===null||r===void 0?void 0:r.name)=="PropertyName")s.push(e(o)),t=a;else return null}}function Z4e(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=$s(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?oB(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?oB(t,n.parent,""):cJ.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&gI.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?oB(t,n,""):e.explicit?{path:[],name:""}:null}function E4t(e,t){let n=e,r=[],s=new Set;for(let a=0;;a++){for(let i of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(i)||s.has(i))continue;s.add(i);let c;try{c=n[i]}catch{continue}r.push({label:i,type:typeof c=="function"?/^[A-Z]/.test(i)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let o=Object.getPrototypeOf(e);if(!o)return r;e=o}}function C4t(e){let t=new Map;return n=>{let r=Z4e(n);if(!r)return null;let s=e;for(let o of r.path)if(s=s[o],!s)return null;let a=t.get(s);return a||t.set(s,a=E4t(s,!r.path.length)),{from:n.pos-r.name.length,options:a,validFor:gI}}}const Fu=Ry.define({name:"javascript",parser:O4t.configure({props:[yv.add({IfStatement:E0({except:/^\s*({|else\b)/}),TryStatement:E0({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:OMt,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:SMt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":E0({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),vv.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":BK,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Y4e={test:e=>/^JSX/.test(e.name),facet:S$({commentTokens:{block:{open:"{/*",close:"*/}"}}})},uJ=Fu.configure({dialect:"ts"},"typescript"),dJ=Fu.configure({dialect:"jsx",props:[LK.add(e=>e.isTop?[Y4e]:void 0)]}),fJ=Fu.configure({dialect:"jsx ts",props:[LK.add(e=>e.isTop?[Y4e]:void 0)]},"typescript");let X4e=e=>({label:e,type:"keyword"});const K4e="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(X4e),T4t=K4e.concat(["declare","implements","private","protected","public"].map(X4e));function bI(e={}){let t=e.jsx?e.typescript?fJ:dJ:e.typescript?uJ:Fu,n=e.typescript?Q4e.concat(T4t):lJ.concat(K4e);return new Py(t,[Fu.data.of({autocomplete:l$t(cJ,G2e(n))}),Fu.data.of({autocomplete:W4e}),e.jsx?J4e:[]])}function N4t(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function hve(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const j4t=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),J4e=it.inputHandler.of((e,t,n,r,s)=>{if((j4t?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Fu.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:o}=a,i=o.changeByRange(c=>{var u;let{head:d}=c,f=$s(o).resolveInner(d-1,-1),p;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(r=="/"&&f.name=="JSXStartCloseTag"){let h=f.parent,g=h.parent;if(g&&h.from==d-2&&((p=hve(o.doc,g.firstChild,d))||((u=g.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let b=`${p}>`;return{range:We.cursor(d+b.length,-1),changes:{from:d,insert:b}}}}else if(r==">"){let h=N4t(f);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(d,d+2))&&(p=hve(o.doc,h,d)))return{range:c,changes:{from:d,insert:`</${p}>`}}}}return{range:c}});return i.changes.empty?!1:(e.dispatch([a,o.update(i,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function A4t(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((n,r)=>{var s;!((s=n.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[r]=2)})),n=>{let{state:r}=n,s=[];for(let{from:a,to:o}of Fu.findRegions(r)){let i=r.doc.lineAt(a),c={line:i.number-1,col:a-i.from,pos:a};for(let u of e.verify(r.sliceDoc(a,o),t))s.push(R4t(u,r.doc,c))}return s}}function mve(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function R4t(e,t,n){let r=mve(e.line,e.column,t,n),s={from:r,to:e.endLine!=null&&e.endColumn!=1?mve(e.endLine,e.endColumn,t,n):r,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:o}=e.fix,i=a[0]+n.pos-r,c=a[1]+n.pos-r;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+i,to:d+c,insert:o},scrollIntoView:!0})}}]}return s}const pj=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:J4e,completionPath:Z4e,esLint:A4t,javascript:bI,javascriptLanguage:Fu,jsxLanguage:dJ,localCompletionSource:W4e,scopeCompletionSource:C4t,snippets:lJ,tsxLanguage:fJ,typescriptLanguage:uJ,typescriptSnippets:Q4e},Symbol.toStringTag,{value:"Module"})),D1=["_blank","_self","_top","_parent"],iB=["ascii","utf-8","utf-16","latin1","latin1"],lB=["get","post","put","delete"],cB=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Sc=["true","false"],yn={},I4t={a:{attrs:{href:null,ping:null,type:null,media:null,target:D1,hreflang:null}},abbr:yn,address:yn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:yn,aside:yn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:yn,base:{attrs:{href:null,target:D1}},bdi:yn,bdo:yn,blockquote:{attrs:{cite:null}},body:yn,br:yn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:cB,formmethod:lB,formnovalidate:["novalidate"],formtarget:D1,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:yn,center:yn,cite:yn,code:yn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:yn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:yn,div:yn,dl:yn,dt:yn,em:yn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:yn,figure:yn,footer:yn,form:{attrs:{action:null,name:null,"accept-charset":iB,autocomplete:["on","off"],enctype:cB,method:lB,novalidate:["novalidate"],target:D1}},h1:yn,h2:yn,h3:yn,h4:yn,h5:yn,h6:yn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:yn,hgroup:yn,hr:yn,html:{attrs:{manifest:null}},i:yn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:cB,formmethod:lB,formnovalidate:["novalidate"],formtarget:D1,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:yn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:yn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:yn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:iB,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:yn,noscript:yn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:yn,param:{attrs:{name:null,value:null}},pre:yn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:yn,rt:yn,ruby:yn,samp:yn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:iB}},section:yn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:yn,source:{attrs:{src:null,type:null,media:null}},span:yn,strong:yn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:yn,summary:yn,sup:yn,table:yn,tbody:yn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:yn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:yn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:yn,time:{attrs:{datetime:null}},title:yn,tr:yn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:yn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:yn},eLe={accesskey:null,class:null,contenteditable:Sc,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Sc,autocorrect:Sc,autocapitalize:Sc,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Sc,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Sc,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Sc,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Sc,"aria-hidden":Sc,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Sc,"aria-multiselectable":Sc,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Sc,"aria-relevant":null,"aria-required":Sc,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},tLe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of tLe)eLe[e]=null;let p_=class{constructor(t,n){this.tags={...I4t,...t},this.globalAttrs={...eLe,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};p_.default=new p_;function nw(e,t,n=e.length){if(!t)return"";let r=t.firstChild,s=r&&r.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,n)):""}function rw(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function nLe(e,t,n){let r=n.tags[nw(e,rw(t))];return r?.children||n.allTags}function pJ(e,t){let n=[];for(let r=rw(t);r&&!r.type.isTop;r=rw(r.parent)){let s=nw(e,r);if(s&&r.lastChild.name=="CloseTag")break;s&&n.indexOf(s)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(s)}return n}const rLe=/^[:\-\.\w\u00b7-\uffff]*$/;function gve(e,t,n,r,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",o=rw(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:s,options:nLe(e.doc,o,t).map(i=>({label:i,type:"type"})).concat(pJ(e.doc,n).map((i,c)=>({label:"/"+i,apply:"/"+i+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function bve(e,t,n,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:pJ(e.doc,t).map((a,o)=>({label:a,apply:a+s,type:"type",boost:99-o})),validFor:rLe}}function P4t(e,t,n,r){let s=[],a=0;for(let o of nLe(e.doc,n,t))s.push({label:"<"+o,type:"type"});for(let o of pJ(e.doc,n))s.push({label:"</"+o+">",type:"type",boost:99-a++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function M4t(e,t,n,r,s){let a=rw(n),o=a?t.tags[nw(e.doc,a)]:null,i=o&&o.attrs?Object.keys(o.attrs):[],c=o&&o.globalAttrs===!1?i:i.length?i.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:rLe}}function $4t(e,t,n,r,s){var a;let o=(a=n.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),i=[],c;if(o){let u=e.sliceDoc(o.from,o.to),d=t.globalAttrs[u];if(!d){let f=rw(n),p=f?t.tags[nw(e.doc,f)]:null;d=p?.attrs&&p.attrs[u]}if(d){let f=e.sliceDoc(r,s).toLowerCase(),p='"',h='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",h=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let g of d)i.push({label:g,apply:p+g+h,type:"constant"})}}return{from:r,to:s,options:i,validFor:c}}function sLe(e,t){let{state:n,pos:r}=t,s=$s(n).resolveInner(r,-1),a=s.resolve(r);for(let o=r,i;a==s&&(i=s.childBefore(o));){let c=i.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=i,o=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?bve(n,s,s.from,r):gve(n,e,s,s.from,r):s.name=="StartTag"||s.name=="IncompleteTag"?gve(n,e,s,r,r):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?bve(n,s,r,r):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?M4t(n,e,s,s.name=="AttributeName"?s.from:r,r):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?$4t(n,e,s,s.name=="Is"?r:s.from,r):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?P4t(n,e,s,r):null}function aLe(e){return sLe(p_.default,e)}function oLe(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new p_(t,n):p_.default;return s=>sLe(r,s)}const D4t=Fu.parser.configure({top:"SingleExpression"}),iLe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:uJ.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:dJ.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:fJ.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:D4t},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Fu.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:f_.parser}],lLe=[{name:"style",parser:f_.parser.configure({top:"Styles"})}].concat(tLe.map(e=>({name:e,parser:Fu.parser}))),cLe=Ry.define({name:"html",parser:f2t.configure({props:[yv.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let r=e.node;;){let s=r.lastChild;if(!s||s.name!="Element"||s.to!=r.to)break;t=r=s}return t&&!((n=t.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),vv.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),z2e.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ok=cLe.configure({wrap:M4e(iLe,lLe)});function uLe(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=M4e((e.nestedLanguages||[]).concat(iLe),(e.nestedAttributes||[]).concat(lLe)));let r=n?cLe.configure({wrap:n,dialect:t}):t?ok.configure({dialect:t}):ok;return new Py(r,[ok.data.of({autocomplete:oLe(e)}),e.autoCloseTags!==!1?dLe:[],bI().support,q4e().support])}const yve=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),dLe=it.inputHandler.of((e,t,n,r,s)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!ok.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:o}=a,i=o.changeByRange(c=>{var u,d,f;let p=o.doc.sliceString(c.from-1,c.to)==r,{head:h}=c,g=$s(o).resolveInner(h,-1),b;if(p&&r==">"&&g.name=="EndTag"){let y=g.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=nw(o.doc,y.parent,h))&&!yve.has(b)){let x=h+(o.doc.sliceString(h,h+1)===">"?1:0),w=`</${b}>`;return{range:c,changes:{from:h,to:x,insert:w}}}}else if(p&&r=="/"&&g.name=="IncompleteCloseTag"){let y=g.parent;if(g.from==h-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(b=nw(o.doc,y,h))&&!yve.has(b)){let x=h+(o.doc.sliceString(h,h+1)===">"?1:0),w=`${b}>`;return{range:We.cursor(h+w.length,-1),changes:{from:h,to:x,insert:w}}}}return{range:c}});return i.changes.empty?!1:(e.dispatch([a,o.update(i,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),L4t=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:dLe,html:uLe,htmlCompletionSource:aLe,htmlCompletionSourceWith:oLe,htmlLanguage:ok},Symbol.toStringTag,{value:"Module"})),fLe=S$({commentTokens:{block:{open:"<!--",close:"-->"}}}),pLe=new Wn,hLe=hDt.configure({props:[vv.add(e=>!e.is("Block")||e.is("Document")||XH(e)!=null||F4t(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),pLe.add(XH),yv.add({Document:()=>null}),Gm.add({Document:fLe})]});function XH(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function F4t(e){return e.name=="OrderedList"||e.name=="BulletList"}function z4t(e,t){let n=e;for(;;){let r=n.nextSibling,s;if(!r||(s=XH(r.type))!=null&&s<=t)break;n=r}return n.to}const B4t=T2e.of((e,t,n)=>{for(let r=$s(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let s=r.type.prop(pLe);if(s==null)continue;let a=z4t(r,s);if(a>n)return{from:n,to:a}}return null});function hJ(e){return new Dc(fLe,e,[],"markdown")}const mLe=hJ(hLe),U4t=hLe.configure([_Dt,CDt,EDt,TDt,{props:[vv.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),Dy=hJ(U4t);function q4t(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=Be.matchLanguageName(e,n,!0),r instanceof Be)return r.support?r.support.language.parser:Iy.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class uB{constructor(t,n,r,s,a,o,i){this.node=t,this.from=n,this.to=r,this.spaceBefore=s,this.spaceAfter=a,this.type=o,this.item=i}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length<t;)r+=" ";return r}else{for(let s=this.to-this.from-r.length-this.spaceAfter.length;s>0;s--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+bLe(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function gLe(e,t){let n=[],r=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&n.push(s)}for(let s=n.length-1;s>=0;s--){let a=n[s],o,i=t.lineAt(a.from),c=a.from-i.from;if(a.name=="Blockquote"&&(o=/^ *>( ?)/.exec(i.text.slice(c))))r.push(new uB(a,c,c+o[0].length,"",o[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(i.text.slice(c)))){let u=o[3],d=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new uB(a.parent,c,c+d,o[1],u,o[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(i.text.slice(c)))){let u=o[4],d=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),r.push(new uB(a.parent,c,c+d,o[1],u,f,a))}}return r}function bLe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function dB(e,t,n,r=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let i=bLe(a,t),c=+i[2];if(s>=0){if(c!=s+1)return;n.push({from:a.from+i[1].length,to:a.from+i[0].length,insert:String(s+2+r)})}s=c}let o=a.nextSibling;if(!o)break;a=o}}function mJ(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(lS)!=" ")return e;let r=Ud(e,4,n),s="";for(let a=r;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(n)}const yLe=(e={})=>({state:t,dispatch:n})=>{let r=$s(t),{doc:s}=t,a=null,o=t.changeByRange(i=>{if(!i.empty||!Dy.isActiveAt(t,i.from,-1)&&!Dy.isActiveAt(t,i.from,1))return a={range:i};let c=i.from,u=s.lineAt(c),d=gLe(r.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:i};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:i};let p=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&p){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,_,C="";O&&O.item?(_=u.from+O.from,C=O.marker(s,1)):_=u.from+(O?O.to:0);let E=[{from:_,to:c,insert:C}];return f.node.name=="OrderedList"&&dB(f.item,s,E,-2),O&&O.node.name=="OrderedList"&&dB(O.item,s,E),{range:We.cursor(_+C.length),changes:E}}else{let O=xve(d,t,u);return{range:We.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&p&&u.from){let x=s.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:i.map(O),changes:O}}}let h=[];f.node.name=="OrderedList"&&dB(f.item,s,h);let g=f.item&&f.item.from<u.from,b="";if(!g||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)b+=x==w&&!g?d[x].marker(s,1):d[x].blank(x<w?Ud(u.text,4,d[x+1].from)-b.length:null);let y=c;for(;y>u.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return b=mJ(b,t),V4t(f.node,t.doc)&&(b=xve(d,t,u)+t.lineBreak+b),h.push({from:y,to:c,insert:t.lineBreak+b}),{range:We.cursor(y+b.length+1),changes:h}});return a?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},vLe=yLe();function vve(e){return e.name=="QuoteMark"||e.name=="ListMark"}function V4t(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let s=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1)<a.number}function xve(e,t,n){let r="";for(let s=0,a=e.length-2;s<=a;s++)r+=e[s].blank(s<a?Ud(n.text,4,e[s+1].from)-r.length:null,s<a);return mJ(r,t)}function Q4t(e,t){let n=e.resolveInner(t,-1),r=t;vve(n)&&(r=n.from,n=n.parent);for(let s;s=n.childBefore(r);)if(vve(s))r=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")n=s.lastChild,r=n.to;else break;return n}const xLe=({state:e,dispatch:t})=>{let n=$s(e),r=null,s=e.changeByRange(a=>{let o=a.from,{doc:i}=e;if(a.empty&&Dy.isActiveAt(e,a.from)){let c=i.lineAt(o),u=gLe(Q4t(n,o),i);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(o-c.from>f&&!/\S/.test(c.text.slice(f,o-c.from)))return{range:We.cursor(c.from+f),changes:{from:c.from+f,to:o}};if(o-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let p=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let h=d.blank(Ud(c.text,4,d.to)-Ud(c.text,4,d.from));return p==c.from&&(h=mJ(h,e)),{range:We.cursor(p+h.length),changes:{from:p,to:c.from+d.to,insert:h}}}if(p<o)return{range:We.cursor(p),changes:{from:p,to:o}}}}}return r={range:a}});return r?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},wLe=[{key:"Enter",run:vLe},{key:"Backspace",run:xLe}],SLe=uLe({matchClosingTags:!1});function gJ(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:s}=mLe,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:i=SLe}=e;if(!(s instanceof C$))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[i.support,B4t],d;o&&u.push(OLe),n instanceof Py?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?q4t(t,d):void 0;c.push(gDt({codeParser:f,htmlParser:i.language.parser})),r&&u.push(Jd.high(iS.of(wLe)));let p=hJ(s.configure(c));return a&&u.push(p.data.of({autocomplete:H4t})),new Py(p,u)}function H4t(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let s=$s(t).resolveInner(n,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:n-r[0].length,to:n,options:G4t(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let fB=null;function G4t(){if(fB)return fB;let e=aLe(new HK(br.create({extensions:SLe}),0,!0));return fB=e?e.options:[]}const W4t=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,OLe=it.domEventHandlers({paste:(e,t)=>{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!Dy.isActiveAt(t.state,r.from,1)))return!1;let a=$s(t.state),o=!1;return a.iterate({from:r.from,to:r.to,enter:i=>{(i.from>r.from||W4t.test(i.name))&&(o=!0)},leave:i=>{i.to<r.to&&(o=!0)}}),o?!1:(t.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),Z4t=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:mLe,deleteMarkupBackward:xLe,insertNewlineContinueMarkup:vLe,insertNewlineContinueMarkupCommand:yLe,markdown:gJ,markdownKeymap:wLe,markdownLanguage:Dy,pasteURLAsLink:OLe},Symbol.toStringTag,{value:"Module"}));function st(e){return new Py(UK.define(e))}function xm(e){return Qe(()=>import("./index-CgHCtBXq.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const kLe=[Be.of({name:"C",extensions:["c","h","ino"],load(){return Qe(()=>import("./index-iL7CEiaJ.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Be.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Qe(()=>import("./index-iL7CEiaJ.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Be.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return xm("Cassandra")}}),Be.of({name:"CSS",extensions:["css"],load(){return Qe(()=>Promise.resolve().then(()=>H2t),void 0,import.meta.url).then(e=>e.css())}}),Be.of({name:"Go",extensions:["go"],load(){return Qe(()=>import("./index-DZz2mPEp.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),Be.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Qe(()=>Promise.resolve().then(()=>L4t),void 0,import.meta.url).then(e=>e.html())}}),Be.of({name:"Java",extensions:["java"],load(){return Qe(()=>import("./index-C4lOZyCE.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),Be.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript())}}),Be.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Qe(()=>import("./index-ClbIuQ_V.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),Be.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Qe(()=>Promise.resolve().then(()=>o$t),void 0,import.meta.url).then(e=>e.json())}}),Be.of({name:"JSX",extensions:["jsx"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Be.of({name:"LESS",extensions:["less"],load(){return Qe(()=>import("./index-DpDp-WqO.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),Be.of({name:"Liquid",extensions:["liquid"],load(){return Qe(()=>import("./index-DyVLBkbU.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),Be.of({name:"MariaDB SQL",load(){return xm("MariaSQL")}}),Be.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Qe(()=>Promise.resolve().then(()=>Z4t),void 0,import.meta.url).then(e=>e.markdown())}}),Be.of({name:"MS SQL",load(){return xm("MSSQL")}}),Be.of({name:"MySQL",load(){return xm("MySQL")}}),Be.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Qe(()=>import("./index-oG9dowad.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),Be.of({name:"PLSQL",extensions:["pls"],load(){return xm("PLSQL")}}),Be.of({name:"PostgreSQL",load(){return xm("PostgreSQL")}}),Be.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Qe(()=>import("./index-BHGXURPl.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),Be.of({name:"Rust",extensions:["rs"],load(){return Qe(()=>import("./index-Chwi49oR.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),Be.of({name:"Sass",extensions:["sass"],load(){return Qe(()=>import("./index-POcKmAX6.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Be.of({name:"SCSS",extensions:["scss"],load(){return Qe(()=>import("./index-POcKmAX6.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),Be.of({name:"SQL",extensions:["sql"],load(){return xm("StandardSQL")}}),Be.of({name:"SQLite",load(){return xm("SQLite")}}),Be.of({name:"TSX",extensions:["tsx"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Be.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Be.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Qe(()=>import("./index-BJh94DZc.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),Be.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Qe(()=>import("./index-l77wCrIl.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),Be.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Qe(()=>import("./index-DHJD5ZyK.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),Be.of({name:"APL",extensions:["dyalog","apl"],load(){return Qe(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>st(e.apl))}}),Be.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Qe(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>st(e.asciiArmor))}}),Be.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Qe(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>st(e.asn1({})))}}),Be.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Qe(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>st(e.asterisk))}}),Be.of({name:"Brainfuck",extensions:["b","bf"],load(){return Qe(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>st(e.brainfuck))}}),Be.of({name:"Cobol",extensions:["cob","cpy"],load(){return Qe(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>st(e.cobol))}}),Be.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.csharp))}}),Be.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Qe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Be.of({name:"ClojureScript",extensions:["cljs"],load(){return Qe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Be.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Qe(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>st(e.gss))}}),Be.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Qe(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>st(e.cmake))}}),Be.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Qe(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>st(e.coffeeScript))}}),Be.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Qe(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>st(e.commonLisp))}}),Be.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Qe(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>st(e.cypher))}}),Be.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Qe(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>st(e.cython))}}),Be.of({name:"Crystal",extensions:["cr"],load(){return Qe(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>st(e.crystal))}}),Be.of({name:"D",extensions:["d"],load(){return Qe(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>st(e.d))}}),Be.of({name:"Dart",extensions:["dart"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.dart))}}),Be.of({name:"diff",extensions:["diff","patch"],load(){return Qe(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>st(e.diff))}}),Be.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Qe(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>st(e.dockerFile))}}),Be.of({name:"DTD",extensions:["dtd"],load(){return Qe(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>st(e.dtd))}}),Be.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Qe(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>st(e.dylan))}}),Be.of({name:"EBNF",load(){return Qe(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>st(e.ebnf))}}),Be.of({name:"ECL",extensions:["ecl"],load(){return Qe(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>st(e.ecl))}}),Be.of({name:"edn",extensions:["edn"],load(){return Qe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Be.of({name:"Eiffel",extensions:["e"],load(){return Qe(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>st(e.eiffel))}}),Be.of({name:"Elm",extensions:["elm"],load(){return Qe(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>st(e.elm))}}),Be.of({name:"Erlang",extensions:["erl"],load(){return Qe(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>st(e.erlang))}}),Be.of({name:"Esper",load(){return Qe(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>st(e.esper))}}),Be.of({name:"Factor",extensions:["factor"],load(){return Qe(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>st(e.factor))}}),Be.of({name:"FCL",load(){return Qe(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>st(e.fcl))}}),Be.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Qe(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>st(e.forth))}}),Be.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Qe(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>st(e.fortran))}}),Be.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Qe(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>st(e.fSharp))}}),Be.of({name:"Gas",extensions:["s"],load(){return Qe(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>st(e.gas))}}),Be.of({name:"Gherkin",extensions:["feature"],load(){return Qe(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>st(e.gherkin))}}),Be.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Qe(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>st(e.groovy))}}),Be.of({name:"Haskell",extensions:["hs"],load(){return Qe(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>st(e.haskell))}}),Be.of({name:"Haxe",extensions:["hx"],load(){return Qe(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>st(e.haxe))}}),Be.of({name:"HXML",extensions:["hxml"],load(){return Qe(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>st(e.hxml))}}),Be.of({name:"HTTP",load(){return Qe(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>st(e.http))}}),Be.of({name:"IDL",extensions:["pro"],load(){return Qe(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>st(e.idl))}}),Be.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Qe(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>st(e.jsonld))}}),Be.of({name:"Julia",extensions:["jl"],load(){return Qe(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>st(e.julia))}}),Be.of({name:"Kotlin",extensions:["kt","kts"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.kotlin))}}),Be.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Qe(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>st(e.liveScript))}}),Be.of({name:"Lua",extensions:["lua"],load(){return Qe(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>st(e.lua))}}),Be.of({name:"mIRC",extensions:["mrc"],load(){return Qe(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>st(e.mirc))}}),Be.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Qe(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>st(e.mathematica))}}),Be.of({name:"Modelica",extensions:["mo"],load(){return Qe(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>st(e.modelica))}}),Be.of({name:"MUMPS",extensions:["mps"],load(){return Qe(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>st(e.mumps))}}),Be.of({name:"Mbox",extensions:["mbox"],load(){return Qe(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>st(e.mbox))}}),Be.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Qe(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>st(e.nginx))}}),Be.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Qe(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>st(e.nsis))}}),Be.of({name:"NTriples",extensions:["nt","nq"],load(){return Qe(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>st(e.ntriples))}}),Be.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.objectiveC))}}),Be.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.objectiveCpp))}}),Be.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Qe(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>st(e.oCaml))}}),Be.of({name:"Octave",extensions:["m"],load(){return Qe(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>st(e.octave))}}),Be.of({name:"Oz",extensions:["oz"],load(){return Qe(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>st(e.oz))}}),Be.of({name:"Pascal",extensions:["p","pas"],load(){return Qe(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>st(e.pascal))}}),Be.of({name:"Perl",extensions:["pl","pm"],load(){return Qe(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>st(e.perl))}}),Be.of({name:"Pig",extensions:["pig"],load(){return Qe(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>st(e.pig))}}),Be.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Qe(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>st(e.powerShell))}}),Be.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Qe(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>st(e.properties))}}),Be.of({name:"ProtoBuf",extensions:["proto"],load(){return Qe(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>st(e.protobuf))}}),Be.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Qe(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>st(e.pug))}}),Be.of({name:"Puppet",extensions:["pp"],load(){return Qe(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>st(e.puppet))}}),Be.of({name:"Q",extensions:["q"],load(){return Qe(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>st(e.q))}}),Be.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Qe(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>st(e.r))}}),Be.of({name:"RPM Changes",load(){return Qe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmChanges))}}),Be.of({name:"RPM Spec",extensions:["spec"],load(){return Qe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmSpec))}}),Be.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Qe(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>st(e.ruby))}}),Be.of({name:"SAS",extensions:["sas"],load(){return Qe(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>st(e.sas))}}),Be.of({name:"Scala",extensions:["scala"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.scala))}}),Be.of({name:"Scheme",extensions:["scm","ss"],load(){return Qe(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>st(e.scheme))}}),Be.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Qe(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>st(e.shell))}}),Be.of({name:"Sieve",extensions:["siv","sieve"],load(){return Qe(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>st(e.sieve))}}),Be.of({name:"Smalltalk",extensions:["st"],load(){return Qe(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>st(e.smalltalk))}}),Be.of({name:"Solr",load(){return Qe(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>st(e.solr))}}),Be.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Qe(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>st(e.sml))}}),Be.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Qe(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>st(e.sparql))}}),Be.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Qe(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>st(e.spreadsheet))}}),Be.of({name:"Squirrel",extensions:["nut"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.squirrel))}}),Be.of({name:"Stylus",extensions:["styl"],load(){return Qe(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>st(e.stylus))}}),Be.of({name:"Swift",extensions:["swift"],load(){return Qe(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>st(e.swift))}}),Be.of({name:"sTeX",load(){return Qe(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>st(e.stex))}}),Be.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Qe(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>st(e.stex))}}),Be.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Qe(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>st(e.verilog))}}),Be.of({name:"Tcl",extensions:["tcl"],load(){return Qe(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>st(e.tcl))}}),Be.of({name:"Textile",extensions:["textile"],load(){return Qe(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>st(e.textile))}}),Be.of({name:"TiddlyWiki",load(){return Qe(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>st(e.tiddlyWiki))}}),Be.of({name:"Tiki wiki",load(){return Qe(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>st(e.tiki))}}),Be.of({name:"TOML",extensions:["toml"],load(){return Qe(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>st(e.toml))}}),Be.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Qe(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>st(e.troff))}}),Be.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Qe(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>st(e.ttcn))}}),Be.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Qe(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>st(e.ttcnCfg))}}),Be.of({name:"Turtle",extensions:["ttl"],load(){return Qe(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>st(e.turtle))}}),Be.of({name:"Web IDL",extensions:["webidl"],load(){return Qe(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>st(e.webIDL))}}),Be.of({name:"VB.NET",extensions:["vb"],load(){return Qe(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>st(e.vb))}}),Be.of({name:"VBScript",extensions:["vbs"],load(){return Qe(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>st(e.vbScript))}}),Be.of({name:"Velocity",extensions:["vtl"],load(){return Qe(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>st(e.velocity))}}),Be.of({name:"Verilog",extensions:["v"],load(){return Qe(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>st(e.verilog))}}),Be.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Qe(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>st(e.vhdl))}}),Be.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Qe(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>st(e.xQuery))}}),Be.of({name:"Yacas",extensions:["ys"],load(){return Qe(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>st(e.yacas))}}),Be.of({name:"Z80",extensions:["z80"],load(){return Qe(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>st(e.z80))}}),Be.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Qe(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>st(e.mscgen))}}),Be.of({name:"Xù",extensions:["xu"],load(){return Qe(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>st(e.xu))}}),Be.of({name:"MsGenny",extensions:["msgenny"],load(){return Qe(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>st(e.msgenny))}}),Be.of({name:"Vue",extensions:["vue"],load(){return Qe(()=>import("./index-BhSuEm_p.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),Be.of({name:"Angular Template",load(){return Qe(()=>import("./index-Cr6Y_Jof.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];var Y4t=e=>{var{theme:t,settings:n={},styles:r=[]}=e,s={".cm-gutters":{}},a={};n.background&&(a.backgroundColor=n.background),n.backgroundImage&&(a.backgroundImage=n.backgroundImage),n.foreground&&(a.color=n.foreground),n.fontSize&&(a.fontSize=n.fontSize),(n.background||n.foreground)&&(s["&"]=a),n.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(s[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(s[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(s[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(s[".cm-content"]={caretColor:n.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var o={};n.gutterActiveForeground&&(o.color=n.gutterActiveForeground),n.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:n.lineHighlight},o.backgroundColor=n.lineHighlight),s[".cm-activeLineGutter"]=o,n.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var i=it.theme(s,{dark:t==="dark"}),c=xv.define(r),u=[i,_$(c)];return u},X4t={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},K4t=[{tag:re.comment,color:"#6272a4"},{tag:re.string,color:"#f1fa8c"},{tag:re.atom,color:"#bd93f9"},{tag:re.meta,color:"#f8f8f2"},{tag:[re.keyword,re.operator,re.tagName],color:"#ff79c6"},{tag:[re.function(re.propertyName),re.propertyName],color:"#66d9ef"},{tag:[re.definition(re.variableName),re.function(re.variableName),re.className,re.attributeName],color:"#50fa7b"},{tag:re.atom,color:"#bd93f9"}],T$=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return Y4t({theme:t,settings:Jf({},X4t,n),styles:[...K4t,...r]})};T$();const J4t=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=yJ(e.state,n.from);return r.line?eLt(e):r.block?nLt(e):!1};function bJ(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const eLt=bJ(aLt,0),tLt=bJ(_Le,0),nLt=bJ((e,t)=>_Le(e,t,sLt(t)),0);function yJ(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const L1=50;function rLt(e,{open:t,close:n},r,s){let a=e.sliceDoc(r-L1,r),o=e.sliceDoc(s,s+L1),i=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,u=a.length-i;if(a.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-i,margin:i&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-r<=2*L1?d=f=e.sliceDoc(r,s):(d=e.sliceDoc(r,r+L1),f=e.sliceDoc(s-L1,s));let p=/^\s*/.exec(d)[0].length,h=/\s*$/.exec(f)[0].length,g=f.length-h-n.length;return d.slice(p,p+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:r+p+t.length,margin:/\s/.test(d.charAt(p+t.length))?1:0},close:{pos:s-h-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function sLt(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function _Le(e,t,n=t.selection.ranges){let r=n.map(a=>yJ(t,a.from).block);if(!r.every(a=>a))return null;let s=n.map((a,o)=>rLt(t,r[o],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(n.map((a,o)=>s[o]?[]:[{from:a.from,insert:r[o].open+" "},{from:a.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let o=0,i;o<s.length;o++)if(i=s[o]){let c=r[o],{open:u,close:d}=i;a.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:a}}return null}function aLt(e,t,n=t.selection.ranges){let r=[],s=-1;for(let{from:a,to:o}of n){let i=r.length,c=1e9,u=yJ(t,a).line;if(u){for(let d=a;d<=o;){let f=t.doc.lineAt(d);if(f.from>s&&(a==o||o>f.from)){s=f.from;let p=/^\s*/.exec(f.text)[0].length,h=p==f.length,g=f.text.slice(p,p+u.length)==u?p:-1;p<f.text.length&&p<c&&(c=p),r.push({line:f,comment:g,token:u,indent:p,empty:h,single:!1})}d=f.to+1}if(c<1e9)for(let d=i;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==i+1&&(r[i].single=!0)}}if(e!=2&&r.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:i,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&a.push({from:i.from+u,insert:c+" "});let o=t.changes(a);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&r.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:i,token:c}of r)if(i>=0){let u=o.from+i,d=u+c.length;o.text[d-o.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const KH=fp.define(),oLt=fp.define(),iLt=Lt.define(),ELe=Lt.define({combine(e){return pp(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),CLe=lo.define({create(){return $f.empty},update(e,t){let n=t.state.facet(ELe),r=t.annotation(KH);if(r){let c=Vl.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=yI(d,d.length,n.minDepth,c):d=jLe(d,t.startState.selection),new $f(u==0?r.rest:d,u==0?d:r.rest)}let s=t.annotation(oLt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(wo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Vl.fromTransaction(t),o=t.annotation(wo.time),i=t.annotation(wo.userEvent);return a?e=e.addChanges(a,o,i,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,i,n.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new $f(e.done.map(Vl.fromJSON),e.undone.map(Vl.fromJSON))}});function lLt(e={}){return[CLe,ELe.of(e),it.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?TLe:t.inputType=="historyRedo"?JH:null;return r?(t.preventDefault(),r(n)):!1}})]}function N$(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(CLe,!1);if(!s)return!1;let a=s.pop(e,n,t);return a?(r(a),!0):!1}}const TLe=N$(0,!1),JH=N$(1,!1),cLt=N$(0,!0),uLt=N$(1,!0);class Vl{constructor(t,n,r,s,a){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new Vl(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Vl(t.changes&&go.fromJSON(t.changes),[],t.mapped&&Vf.fromJSON(t.mapped),t.startSelection&&We.fromJSON(t.startSelection),t.selectionsAfter.map(We.fromJSON))}static fromTransaction(t,n){let r=Mu;for(let s of t.startState.facet(iLt)){let a=s(t);a.length&&(r=r.concat(a))}return!r.length&&t.changes.empty?null:new Vl(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Mu)}static selection(t){return new Vl(void 0,Mu,void 0,void 0,t)}}function yI(e,t,n,r){let s=t+1>n+20?t-n-1:0,a=e.slice(s,t);return a.push(r),a}function dLt(e,t){let n=[],r=!1;return e.iterChangedRanges((s,a)=>n.push(s,a)),t.iterChangedRanges((s,a,o,i)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];i>=u&&o<=d&&(r=!0)}}),r}function fLt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function NLe(e,t){return e.length?t.length?e.concat(t):e:t}const Mu=[],pLt=200;function jLe(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-pLt));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),yI(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Vl.selection([t])]}function hLt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function pB(e,t){if(!e.length)return e;let n=e.length,r=Mu;for(;n;){let s=mLt(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,n);return a[n-1]=s,a}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[Vl.selection(r)]:Mu}function mLt(e,t,n){let r=NLe(e.selectionsAfter.length?e.selectionsAfter.map(i=>i.map(t)):Mu,n);if(!e.changes)return Vl.selection(r);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Vl(s,Fn.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}const gLt=/^(input\.type|delete)($|\.)/;class $f{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new $f(this.done,this.undone):this}addChanges(t,n,r,s,a){let o=this.done,i=o[o.length-1];return i&&i.changes&&!i.changes.empty&&t.changes&&(!r||gLt.test(r))&&(!i.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,dLt(i.changes,t.changes))||r=="input.type.compose")?o=yI(o,o.length-1,s.minDepth,new Vl(t.changes.compose(i.changes),NLe(Fn.mapEffects(t.effects,i.changes),i.effects),i.mapped,i.startSelection,Mu)):o=yI(o,o.length,s.minDepth,t),new $f(o,Mu,n,r)}addSelection(t,n,r,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Mu;return a.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&fLt(a[a.length-1],t)?this:new $f(jLe(this.done,t),this.undone,n,r)}addMapping(t){return new $f(pB(this.done,t),pB(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],o=a.selectionsAfter[0]||n.selection;if(r&&a.selectionsAfter.length)return n.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:KH.of({side:t,rest:hLt(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let i=s.length==1?Mu:s.slice(0,s.length-1);return a.mapped&&(i=pB(i,a.mapped)),n.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:KH.of({side:t,rest:i,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}$f.empty=new $f(Mu,Mu);const bLt=[{key:"Mod-z",run:TLe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:JH,preventDefault:!0},{linux:"Ctrl-Shift-z",run:JH,preventDefault:!0},{key:"Mod-u",run:cLt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:uLt,preventDefault:!0}];function uS(e,t){return We.create(e.ranges.map(t),e.mainIndex)}function ef(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function tf({state:e,dispatch:t},n){let r=uS(e.selection,n);return r.eq(e.selection,!0)?!1:(t(ef(e,r)),!0)}function j$(e,t){return We.cursor(t?e.to:e.from)}function ALe(e,t){return tf(e,n=>n.empty?e.moveByChar(n,t):j$(n,t))}function Qi(e){return e.textDirectionAt(e.state.selection.main.head)==qs.LTR}const RLe=e=>ALe(e,!Qi(e)),ILe=e=>ALe(e,Qi(e));function PLe(e,t){return tf(e,n=>n.empty?e.moveByGroup(n,t):j$(n,t))}const yLt=e=>PLe(e,!Qi(e)),vLt=e=>PLe(e,Qi(e));function xLt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function A$(e,t,n){let r=$s(e).resolveInner(t.head),s=n?Wn.closedBy:Wn.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;xLt(e,u,s)?r=u:c=n?u.to:u.from}let a=r.type.prop(s),o,i;return a&&(o=n?Mf(e,r.from,1):Mf(e,r.to,-1))&&o.matched?i=n?o.end.to:o.end.from:i=n?r.to:r.from,We.cursor(i,n?-1:1)}const wLt=e=>tf(e,t=>A$(e.state,t,!Qi(e))),SLt=e=>tf(e,t=>A$(e.state,t,Qi(e)));function MLe(e,t){return tf(e,n=>{if(!n.empty)return j$(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const $Le=e=>MLe(e,!1),DLe=e=>MLe(e,!0);function LLe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let a of e.state.facet(it.scrollMargins)){let o=a(e);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function FLe(e,t){let n=LLe(e),{state:r}=e,s=uS(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):j$(o,t));if(s.eq(r.selection))return!1;let a;if(n.selfScroll){let o=e.coordsAtPos(r.selection.main.head),i=e.scrollDOM.getBoundingClientRect(),c=i.top+n.marginTop,u=i.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(a=it.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(ef(r,s),{effects:a}),!0}const wve=e=>FLe(e,!1),eG=e=>FLe(e,!0);function Qg(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let a=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&t.head!=r.from+a&&(s=We.cursor(r.from+a))}return s}const OLt=e=>tf(e,t=>Qg(e,t,!0)),kLt=e=>tf(e,t=>Qg(e,t,!1)),_Lt=e=>tf(e,t=>Qg(e,t,!Qi(e))),ELt=e=>tf(e,t=>Qg(e,t,Qi(e))),CLt=e=>tf(e,t=>We.cursor(e.lineBlockAt(t.head).from,1)),TLt=e=>tf(e,t=>We.cursor(e.lineBlockAt(t.head).to,-1));function NLt(e,t,n){let r=!1,s=uS(e.selection,a=>{let o=Mf(e,a.head,-1)||Mf(e,a.head,1)||a.head>0&&Mf(e,a.head-1,1)||a.head<e.doc.length&&Mf(e,a.head+1,-1);if(!o||!o.end)return a;r=!0;let i=o.start.from==a.head?o.end.to:o.end.from;return We.cursor(i)});return r?(t(ef(e,s)),!0):!1}const jLt=({state:e,dispatch:t})=>NLt(e,t);function nd(e,t){let n=uS(e.state.selection,r=>{let s=t(r);return We.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(ef(e.state,n)),!0)}function zLe(e,t){return nd(e,n=>e.moveByChar(n,t))}const BLe=e=>zLe(e,!Qi(e)),ULe=e=>zLe(e,Qi(e));function qLe(e,t){return nd(e,n=>e.moveByGroup(n,t))}const ALt=e=>qLe(e,!Qi(e)),RLt=e=>qLe(e,Qi(e)),ILt=e=>nd(e,t=>A$(e.state,t,!Qi(e))),PLt=e=>nd(e,t=>A$(e.state,t,Qi(e)));function VLe(e,t){return nd(e,n=>e.moveVertically(n,t))}const QLe=e=>VLe(e,!1),HLe=e=>VLe(e,!0);function GLe(e,t){return nd(e,n=>e.moveVertically(n,t,LLe(e).height))}const Sve=e=>GLe(e,!1),Ove=e=>GLe(e,!0),MLt=e=>nd(e,t=>Qg(e,t,!0)),$Lt=e=>nd(e,t=>Qg(e,t,!1)),DLt=e=>nd(e,t=>Qg(e,t,!Qi(e))),LLt=e=>nd(e,t=>Qg(e,t,Qi(e))),FLt=e=>nd(e,t=>We.cursor(e.lineBlockAt(t.head).from)),zLt=e=>nd(e,t=>We.cursor(e.lineBlockAt(t.head).to)),kve=({state:e,dispatch:t})=>(t(ef(e,{anchor:0})),!0),_ve=({state:e,dispatch:t})=>(t(ef(e,{anchor:e.doc.length})),!0),Eve=({state:e,dispatch:t})=>(t(ef(e,{anchor:e.selection.main.anchor,head:0})),!0),Cve=({state:e,dispatch:t})=>(t(ef(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),BLt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ULt=({state:e,dispatch:t})=>{let n=R$(e).map(({from:r,to:s})=>We.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:We.create(n),userEvent:"select"})),!0},qLt=({state:e,dispatch:t})=>{let n=uS(e.selection,r=>{let s=$s(e),a=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:i}=o;if((i.from<r.from&&i.to>=r.to||i.to>r.to&&i.from<=r.from)&&o.next)return We.range(i.to,i.from)}return r});return n.eq(e.selection)?!1:(t(ef(e,n)),!0)};function WLe(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let a of n.selection.ranges){let o=n.doc.lineAt(a.head);if(t?o.to<e.state.doc.length:o.from>0)for(let i=a;;){let c=e.moveVertically(i,t);if(c.head<o.from||c.head>o.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==i.head)break;i=c}}}return s.length==r.ranges.length?!1:(e.dispatch(ef(n,We.create(s,s.length-1))),!0)}const VLt=e=>WLe(e,!1),QLt=e=>WLe(e,!0),HLt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=We.create([n.main]):n.main.empty||(r=We.create([We.cursor(n.main.head)])),r?(t(ef(e,r)),!0):!1};function iC(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(a=>{let{from:o,to:i}=a;if(o==i){let c=t(a);c<o?(n="delete.backward",c=hj(e,c,!1)):c>o&&(n="delete.forward",c=hj(e,c,!0)),o=Math.min(o,c),i=Math.max(i,c)}else o=hj(e,o,!1),i=hj(e,i,!0);return o==i?{range:a}:{changes:{from:o,to:i},range:We.cursor(o,o<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?it.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function hj(e,t,n){if(e instanceof it)for(let r of e.state.facet(it.atomicRanges).map(s=>s(e)))r.between(t,t,(s,a)=>{s<t&&a>t&&(t=n?a:s)});return t}const ZLe=(e,t,n)=>iC(e,r=>{let s=r.from,{state:a}=e,o=a.doc.lineAt(s),i,c;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(i=o.text.slice(0,s-o.from))){if(i[i.length-1]==" ")return s-1;let u=Ud(i,a.tabSize),d=u%My(a)||My(a);for(let f=0;f<d&&i[i.length-1-f]==" ";f++)s--;c=s}else c=Go(o.text,s-o.from,t,t)+o.from,c==s&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,s-o.from))&&(c=Go(o.text,c-o.from,!1,!1)+o.from);return c}),tG=e=>ZLe(e,!1,!0),YLe=e=>ZLe(e,!0,!1),XLe=(e,t)=>iC(e,n=>{let r=n.head,{state:s}=e,a=s.doc.lineAt(r),o=s.charCategorizer(r);for(let i=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let c=Go(a.text,r-a.from,t)+a.from,u=a.text.slice(Math.min(r,c)-a.from,Math.max(r,c)-a.from),d=o(u);if(i!=null&&d!=i)break;(u!=" "||r!=n.head)&&(i=d),r=c}return r}),KLe=e=>XLe(e,!1),GLt=e=>XLe(e,!0),WLt=e=>iC(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ZLt=e=>iC(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),YLt=e=>iC(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),XLt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ur.of(["",""])},range:We.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},KLt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,a=e.doc.lineAt(s),o=s==a.from?s-1:Go(a.text,s-a.from,!1)+a.from,i=s==a.to?s+1:Go(a.text,s-a.from,!0)+a.from;return{changes:{from:o,to:i,insert:e.doc.slice(s,i).append(e.doc.slice(o,s))},range:We.cursor(i)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function R$(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=a.to,o.ranges.push(r)}else t.push({from:s.from,to:a.to,ranges:[r]});n=a.number+1}return t}function JLe(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let a of R$(e)){if(n?a.to==e.doc.length:a.from==0)continue;let o=e.doc.lineAt(n?a.to+1:a.from-1),i=o.length+1;if(n){r.push({from:a.to,to:o.to},{from:a.from,insert:o.text+e.lineBreak});for(let c of a.ranges)s.push(We.range(Math.min(e.doc.length,c.anchor+i),Math.min(e.doc.length,c.head+i)))}else{r.push({from:o.from,to:a.from},{from:a.to,insert:e.lineBreak+o.text});for(let c of a.ranges)s.push(We.range(c.anchor-i,c.head-i))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:We.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const JLt=({state:e,dispatch:t})=>JLe(e,t,!1),e3t=({state:e,dispatch:t})=>JLe(e,t,!0);function e3e(e,t,n){if(e.readOnly)return!1;let r=[];for(let a of R$(e))n?r.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):r.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const t3t=({state:e,dispatch:t})=>e3e(e,t,!1),n3t=({state:e,dispatch:t})=>e3e(e,t,!0),r3t=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(R$(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),r=uS(t.selection,s=>{let a;if(e.lineWrapping){let o=e.lineBlockAt(s.head),i=e.coordsAtPos(s.head,s.assoc||1);i&&(a=o.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function s3t(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=$s(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),a;return r&&s&&r.to<=t&&s.from>=t&&(a=r.type.prop(Wn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const Tve=t3e(!1),a3t=t3e(!0);function t3e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:a,to:o}=s,i=t.doc.lineAt(a),c=!e&&a==o&&s3t(t,a);e&&(a=o=(o<=i.to?i:t.doc.lineAt(o)).to);let u=new O$(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=FK(u,a);for(d==null&&(d=Ud(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));o<i.to&&/\s/.test(i.text[o-i.from]);)o++;c?{from:a,to:o}=c:a>i.from&&a<i.from+100&&!/\S/.test(i.text.slice(0,a))&&(a=i.from);let f=["",s_(t,d)];return c&&f.push(s_(t,u.lineIndent(i.from,-1))),{changes:{from:a,to:o,insert:Ur.of(f)},range:We.cursor(a+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function vJ(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let i=e.doc.lineAt(o);i.number>n&&(r.empty||r.to>i.from)&&(t(i,s,r),n=i.number),o=i.to+1}let a=e.changes(s);return{changes:s,range:We.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}const o3t=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new O$(e,{overrideIndentation:a=>{let o=n[a];return o??-1}}),s=vJ(e,(a,o,i)=>{let c=FK(r,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=s_(e,c);(u!=d||i.from<a.from+u.length)&&(n[a.from]=c,o.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},n3e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(vJ(e,(n,r)=>{r.push({from:n.from,insert:e.facet(lS)})}),{userEvent:"input.indent"})),!0),r3e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(vJ(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let a=Ud(s,e.tabSize),o=0,i=s_(e,Math.max(0,a-My(e)));for(;o<s.length&&o<i.length&&s.charCodeAt(o)==i.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:i.slice(o)})}),{userEvent:"delete.dedent"})),!0),i3t=e=>(e.setTabFocusMode(),!0),l3t=[{key:"Ctrl-b",run:RLe,shift:BLe,preventDefault:!0},{key:"Ctrl-f",run:ILe,shift:ULe},{key:"Ctrl-p",run:$Le,shift:QLe},{key:"Ctrl-n",run:DLe,shift:HLe},{key:"Ctrl-a",run:CLt,shift:FLt},{key:"Ctrl-e",run:TLt,shift:zLt},{key:"Ctrl-d",run:YLe},{key:"Ctrl-h",run:tG},{key:"Ctrl-k",run:WLt},{key:"Ctrl-Alt-h",run:KLe},{key:"Ctrl-o",run:XLt},{key:"Ctrl-t",run:KLt},{key:"Ctrl-v",run:eG}],c3t=[{key:"ArrowLeft",run:RLe,shift:BLe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yLt,shift:ALt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:_Lt,shift:DLt,preventDefault:!0},{key:"ArrowRight",run:ILe,shift:ULe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vLt,shift:RLt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:ELt,shift:LLt,preventDefault:!0},{key:"ArrowUp",run:$Le,shift:QLe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:kve,shift:Eve},{mac:"Ctrl-ArrowUp",run:wve,shift:Sve},{key:"ArrowDown",run:DLe,shift:HLe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_ve,shift:Cve},{mac:"Ctrl-ArrowDown",run:eG,shift:Ove},{key:"PageUp",run:wve,shift:Sve},{key:"PageDown",run:eG,shift:Ove},{key:"Home",run:kLt,shift:$Lt,preventDefault:!0},{key:"Mod-Home",run:kve,shift:Eve},{key:"End",run:OLt,shift:MLt,preventDefault:!0},{key:"Mod-End",run:_ve,shift:Cve},{key:"Enter",run:Tve,shift:Tve},{key:"Mod-a",run:BLt},{key:"Backspace",run:tG,shift:tG,preventDefault:!0},{key:"Delete",run:YLe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:KLe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:GLt,preventDefault:!0},{mac:"Mod-Backspace",run:ZLt,preventDefault:!0},{mac:"Mod-Delete",run:YLt,preventDefault:!0}].concat(l3t.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),u3t=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wLt,shift:ILt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:SLt,shift:PLt},{key:"Alt-ArrowUp",run:JLt},{key:"Shift-Alt-ArrowUp",run:t3t},{key:"Alt-ArrowDown",run:e3t},{key:"Shift-Alt-ArrowDown",run:n3t},{key:"Mod-Alt-ArrowUp",run:VLt},{key:"Mod-Alt-ArrowDown",run:QLt},{key:"Escape",run:HLt},{key:"Mod-Enter",run:a3t},{key:"Alt-l",mac:"Ctrl-l",run:ULt},{key:"Mod-i",run:qLt,preventDefault:!0},{key:"Mod-[",run:r3e},{key:"Mod-]",run:n3e},{key:"Mod-Alt-\\",run:o3t},{key:"Shift-Mod-k",run:r3t},{key:"Shift-Mod-\\",run:jLt},{key:"Mod-/",run:J4t},{key:"Alt-A",run:tLt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:i3t}].concat(c3t),d3t={key:"Tab",run:n3e,shift:r3e},Nve=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class sw{constructor(t,n,r=0,s=t.length,a,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,s),this.bufferStart=r,this.normalize=a?i=>a(Nve(i)):Nve,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return $l(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=wK(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Nf(t);let s=this.normalize(n);if(s.length)for(let a=0,o=r;;a++){let i=s.charCodeAt(a),c=this.match(i,o,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}o==r&&a<n.length&&n.charCodeAt(a)==i&&o++}}}match(t,n,r){let s=null;for(let a=0;a<this.matches.length;a+=2){let o=this.matches[a],i=!1;this.query.charCodeAt(o)==t&&(o==this.query.length-1?s={from:this.matches[a+1],to:r}:(this.matches[a]++,i=!0)),i||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(sw.prototype[Symbol.iterator]=function(){return this});const s3e={from:-1,to:-1,match:/.*/.exec("")},xJ="gm"+(/x/.unicode==null?"":"u");class a3e{constructor(t,n,r,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=s3e,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new o3e(t,n,r,s,a);this.re=new RegExp(n,xJ+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let o=t.lineAt(s);this.curLineStart=o.from,this.matchPos=vI(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=vI(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const hB=new WeakMap;class T0{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let s=hB.get(t);if(!s||s.from>=r||s.to<=n){let i=new T0(n,t.sliceString(n,r));return hB.set(t,i),i}if(s.from==n&&s.to==r)return s;let{text:a,from:o}=s;return o>n&&(a=t.sliceString(n,o)+a,o=n),s.to<r&&(a+=t.sliceString(s.to,r)),hB.set(t,new T0(o,a)),new T0(n,a.slice(n-o,r-o))}}class o3e{constructor(t,n,r,s,a){this.text=t,this.to=a,this.done=!1,this.value=s3e,this.matchPos=vI(t,s),this.re=new RegExp(n,xJ+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=T0.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=vI(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=T0.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(a3e.prototype[Symbol.iterator]=o3e.prototype[Symbol.iterator]=function(){return this});function f3t(e){try{return new RegExp(e,xJ),!0}catch{return!1}}function vI(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function nG(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=zs("input",{class:"cm-textfield",name:"line",value:t}),r=zs("form",{class:"cm-gotoLine",onkeydown:a=>{a.keyCode==27?(a.preventDefault(),e.dispatch({effects:ik.of(!1)}),e.focus()):a.keyCode==13&&(a.preventDefault(),s())},onsubmit:a=>{a.preventDefault(),s()}},zs("label",e.state.phrase("Go to line"),": ",n)," ",zs("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),zs("button",{name:"close",onclick:()=>{e.dispatch({effects:ik.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function s(){let a=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!a)return;let{state:o}=e,i=o.doc.lineAt(o.selection.main.head),[,c,u,d,f]=a,p=d?+d.slice(1):0,h=u?+u:i.number;if(u&&f){let y=h/100;c&&(y=y*(c=="-"?-1:1)+i.number/o.doc.lines),h=Math.round(o.doc.lines*y)}else u&&c&&(h=h*(c=="-"?-1:1)+i.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,h))),b=We.cursor(g.from+Math.max(0,Math.min(p,g.length)));e.dispatch({effects:[ik.of(!1),it.scrollIntoView(b.from,{y:"center"})],selection:b}),e.focus()}return{dom:r}}const ik=Fn.define(),jve=lo.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(ik)&&(e=n.value);return e},provide:e=>r_.from(e,t=>t?nG:null)}),p3t=e=>{let t=n_(e,nG);if(!t){let n=[ik.of(!0)];e.state.field(jve,!1)==null&&n.push(Fn.appendConfig.of([jve,h3t])),e.dispatch({effects:n}),t=n_(e,nG)}return t&&t.dom.querySelector("input").select(),!0},h3t=it.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),m3t={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g3t=Lt.define({combine(e){return pp(e,m3t,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function b3t(e){return[S3t,w3t]}const y3t=Qt.mark({class:"cm-selectionMatch"}),v3t=Qt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ave(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=wa.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=wa.Word)}function x3t(e,t,n,r){return e(t.sliceDoc(n,n+1))==wa.Word&&e(t.sliceDoc(r-1,r))==wa.Word}const w3t=Pa.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(g3t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Qt.none;let s=r.main,a,o=null;if(s.empty){if(!t.highlightWordAroundCursor)return Qt.none;let c=n.wordAt(s.head);if(!c)return Qt.none;o=n.charCategorizer(s.head),a=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return Qt.none;if(t.wholeWords){if(a=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(Ave(o,n,s.from,s.to)&&x3t(o,n,s.from,s.to)))return Qt.none}else if(a=n.sliceDoc(s.from,s.to),!a)return Qt.none}let i=[];for(let c of e.visibleRanges){let u=new sw(n.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||Ave(o,n,d,f))&&(s.empty&&d<=s.from&&f>=s.to?i.push(v3t.range(d,f)):(d>=s.to||f<=s.from)&&i.push(y3t.range(d,f)),i.length>t.maxMatches))return Qt.none}}return Qt.set(i)}},{decorations:e=>e.decorations}),S3t=it.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),O3t=({state:e,dispatch:t})=>{let{selection:n}=e,r=We.create(n.ranges.map(s=>e.wordAt(s.head)||We.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function k3t(e,t){let{main:n,ranges:r}=e.selection,s=e.wordAt(n.head),a=s&&s.from==n.from&&s.to==n.to;for(let o=!1,i=new sw(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(o)return null;i=new sw(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(c=>c.from==i.value.from))continue;if(a){let c=e.wordAt(i.value.from);if(!c||c.from!=i.value.from||c.to!=i.value.to)continue}return i.value}}const _3t=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(a=>a.from===a.to))return O3t({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=r))return!1;let s=k3t(e,r);return s?(t(e.update({selection:e.selection.addRange(We.range(s.from,s.to),!1),effects:it.scrollIntoView(s.to)})),!0):!1},dS=Lt.define({combine(e){return pp(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new D3t(t),scrollToMatch:t=>it.scrollIntoView(t)})}});class i3e{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||f3t(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
131
|
+
}`,{label:"class",detail:"definition",type:"keyword"}),Al('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Al('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Q4e=lJ.concat([Al("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Al("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Al("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),pve=new Z$e,H4e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function $1(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const k4t=["FunctionDeclaration"],_4t={FunctionDeclaration:$1("function"),ClassDeclaration:$1("class"),ClassExpression:()=>!0,EnumDeclaration:$1("constant"),TypeAliasDeclaration:$1("type"),NamespaceDeclaration:$1("namespace"),VariableDefinition(e,t){e.matchContext(k4t)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function G4e(e,t){let n=pve.get(t);if(n)return n;let r=[],s=!0;function a(o,i){let c=e.sliceString(o.from,o.to);r.push({label:c,type:i})}return t.cursor(ws.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let i=_4t[o.name];if(i&&i(o,a)||H4e.has(o.name))return!1}else if(o.to-o.from>8192){for(let i of G4e(e,o.node))r.push(i);return!1}}),pve.set(t,r),r}const gI=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,cJ=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function W4e(e){let t=$s(e.state).resolveInner(e.pos,-1);if(cJ.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&gI.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let s=t;s;s=s.parent)H4e.has(s.name)&&(r=r.concat(G4e(e.state.doc,s)));return{options:r,from:n?t.from:e.pos,validFor:gI}}function oB(e,t,n){var r;let s=[];for(;;){let a=t.firstChild,o;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:n};if(a?.name=="MemberExpression"&&((r=o=a.lastChild)===null||r===void 0?void 0:r.name)=="PropertyName")s.push(e(o)),t=a;else return null}}function Z4e(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=$s(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?oB(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?oB(t,n.parent,""):cJ.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&gI.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?oB(t,n,""):e.explicit?{path:[],name:""}:null}function E4t(e,t){let n=e,r=[],s=new Set;for(let a=0;;a++){for(let i of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(i)||s.has(i))continue;s.add(i);let c;try{c=n[i]}catch{continue}r.push({label:i,type:typeof c=="function"?/^[A-Z]/.test(i)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let o=Object.getPrototypeOf(e);if(!o)return r;e=o}}function C4t(e){let t=new Map;return n=>{let r=Z4e(n);if(!r)return null;let s=e;for(let o of r.path)if(s=s[o],!s)return null;let a=t.get(s);return a||t.set(s,a=E4t(s,!r.path.length)),{from:n.pos-r.name.length,options:a,validFor:gI}}}const Fu=Ry.define({name:"javascript",parser:O4t.configure({props:[yv.add({IfStatement:E0({except:/^\s*({|else\b)/}),TryStatement:E0({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:OMt,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:SMt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":E0({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),vv.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":BK,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Y4e={test:e=>/^JSX/.test(e.name),facet:S$({commentTokens:{block:{open:"{/*",close:"*/}"}}})},uJ=Fu.configure({dialect:"ts"},"typescript"),dJ=Fu.configure({dialect:"jsx",props:[LK.add(e=>e.isTop?[Y4e]:void 0)]}),fJ=Fu.configure({dialect:"jsx ts",props:[LK.add(e=>e.isTop?[Y4e]:void 0)]},"typescript");let X4e=e=>({label:e,type:"keyword"});const K4e="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(X4e),T4t=K4e.concat(["declare","implements","private","protected","public"].map(X4e));function bI(e={}){let t=e.jsx?e.typescript?fJ:dJ:e.typescript?uJ:Fu,n=e.typescript?Q4e.concat(T4t):lJ.concat(K4e);return new Py(t,[Fu.data.of({autocomplete:l$t(cJ,G2e(n))}),Fu.data.of({autocomplete:W4e}),e.jsx?J4e:[]])}function N4t(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function hve(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const j4t=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),J4e=it.inputHandler.of((e,t,n,r,s)=>{if((j4t?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Fu.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:o}=a,i=o.changeByRange(c=>{var u;let{head:d}=c,f=$s(o).resolveInner(d-1,-1),p;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(r=="/"&&f.name=="JSXStartCloseTag"){let h=f.parent,g=h.parent;if(g&&h.from==d-2&&((p=hve(o.doc,g.firstChild,d))||((u=g.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let b=`${p}>`;return{range:We.cursor(d+b.length,-1),changes:{from:d,insert:b}}}}else if(r==">"){let h=N4t(f);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(d,d+2))&&(p=hve(o.doc,h,d)))return{range:c,changes:{from:d,insert:`</${p}>`}}}}return{range:c}});return i.changes.empty?!1:(e.dispatch([a,o.update(i,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function A4t(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((n,r)=>{var s;!((s=n.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[r]=2)})),n=>{let{state:r}=n,s=[];for(let{from:a,to:o}of Fu.findRegions(r)){let i=r.doc.lineAt(a),c={line:i.number-1,col:a-i.from,pos:a};for(let u of e.verify(r.sliceDoc(a,o),t))s.push(R4t(u,r.doc,c))}return s}}function mve(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function R4t(e,t,n){let r=mve(e.line,e.column,t,n),s={from:r,to:e.endLine!=null&&e.endColumn!=1?mve(e.endLine,e.endColumn,t,n):r,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:o}=e.fix,i=a[0]+n.pos-r,c=a[1]+n.pos-r;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+i,to:d+c,insert:o},scrollIntoView:!0})}}]}return s}const pj=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:J4e,completionPath:Z4e,esLint:A4t,javascript:bI,javascriptLanguage:Fu,jsxLanguage:dJ,localCompletionSource:W4e,scopeCompletionSource:C4t,snippets:lJ,tsxLanguage:fJ,typescriptLanguage:uJ,typescriptSnippets:Q4e},Symbol.toStringTag,{value:"Module"})),D1=["_blank","_self","_top","_parent"],iB=["ascii","utf-8","utf-16","latin1","latin1"],lB=["get","post","put","delete"],cB=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Sc=["true","false"],yn={},I4t={a:{attrs:{href:null,ping:null,type:null,media:null,target:D1,hreflang:null}},abbr:yn,address:yn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:yn,aside:yn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:yn,base:{attrs:{href:null,target:D1}},bdi:yn,bdo:yn,blockquote:{attrs:{cite:null}},body:yn,br:yn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:cB,formmethod:lB,formnovalidate:["novalidate"],formtarget:D1,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:yn,center:yn,cite:yn,code:yn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:yn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:yn,div:yn,dl:yn,dt:yn,em:yn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:yn,figure:yn,footer:yn,form:{attrs:{action:null,name:null,"accept-charset":iB,autocomplete:["on","off"],enctype:cB,method:lB,novalidate:["novalidate"],target:D1}},h1:yn,h2:yn,h3:yn,h4:yn,h5:yn,h6:yn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:yn,hgroup:yn,hr:yn,html:{attrs:{manifest:null}},i:yn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:cB,formmethod:lB,formnovalidate:["novalidate"],formtarget:D1,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:yn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:yn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:yn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:iB,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:yn,noscript:yn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:yn,param:{attrs:{name:null,value:null}},pre:yn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:yn,rt:yn,ruby:yn,samp:yn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:iB}},section:yn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:yn,source:{attrs:{src:null,type:null,media:null}},span:yn,strong:yn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:yn,summary:yn,sup:yn,table:yn,tbody:yn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:yn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:yn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:yn,time:{attrs:{datetime:null}},title:yn,tr:yn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:yn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:yn},eLe={accesskey:null,class:null,contenteditable:Sc,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Sc,autocorrect:Sc,autocapitalize:Sc,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Sc,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Sc,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Sc,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Sc,"aria-hidden":Sc,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Sc,"aria-multiselectable":Sc,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Sc,"aria-relevant":null,"aria-required":Sc,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},tLe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of tLe)eLe[e]=null;let p_=class{constructor(t,n){this.tags={...I4t,...t},this.globalAttrs={...eLe,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};p_.default=new p_;function nw(e,t,n=e.length){if(!t)return"";let r=t.firstChild,s=r&&r.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,n)):""}function rw(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function nLe(e,t,n){let r=n.tags[nw(e,rw(t))];return r?.children||n.allTags}function pJ(e,t){let n=[];for(let r=rw(t);r&&!r.type.isTop;r=rw(r.parent)){let s=nw(e,r);if(s&&r.lastChild.name=="CloseTag")break;s&&n.indexOf(s)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(s)}return n}const rLe=/^[:\-\.\w\u00b7-\uffff]*$/;function gve(e,t,n,r,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",o=rw(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:s,options:nLe(e.doc,o,t).map(i=>({label:i,type:"type"})).concat(pJ(e.doc,n).map((i,c)=>({label:"/"+i,apply:"/"+i+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function bve(e,t,n,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:pJ(e.doc,t).map((a,o)=>({label:a,apply:a+s,type:"type",boost:99-o})),validFor:rLe}}function P4t(e,t,n,r){let s=[],a=0;for(let o of nLe(e.doc,n,t))s.push({label:"<"+o,type:"type"});for(let o of pJ(e.doc,n))s.push({label:"</"+o+">",type:"type",boost:99-a++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function M4t(e,t,n,r,s){let a=rw(n),o=a?t.tags[nw(e.doc,a)]:null,i=o&&o.attrs?Object.keys(o.attrs):[],c=o&&o.globalAttrs===!1?i:i.length?i.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:rLe}}function $4t(e,t,n,r,s){var a;let o=(a=n.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),i=[],c;if(o){let u=e.sliceDoc(o.from,o.to),d=t.globalAttrs[u];if(!d){let f=rw(n),p=f?t.tags[nw(e.doc,f)]:null;d=p?.attrs&&p.attrs[u]}if(d){let f=e.sliceDoc(r,s).toLowerCase(),p='"',h='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",h=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let g of d)i.push({label:g,apply:p+g+h,type:"constant"})}}return{from:r,to:s,options:i,validFor:c}}function sLe(e,t){let{state:n,pos:r}=t,s=$s(n).resolveInner(r,-1),a=s.resolve(r);for(let o=r,i;a==s&&(i=s.childBefore(o));){let c=i.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=i,o=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?bve(n,s,s.from,r):gve(n,e,s,s.from,r):s.name=="StartTag"||s.name=="IncompleteTag"?gve(n,e,s,r,r):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?bve(n,s,r,r):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?M4t(n,e,s,s.name=="AttributeName"?s.from:r,r):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?$4t(n,e,s,s.name=="Is"?r:s.from,r):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?P4t(n,e,s,r):null}function aLe(e){return sLe(p_.default,e)}function oLe(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new p_(t,n):p_.default;return s=>sLe(r,s)}const D4t=Fu.parser.configure({top:"SingleExpression"}),iLe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:uJ.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:dJ.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:fJ.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:D4t},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Fu.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:f_.parser}],lLe=[{name:"style",parser:f_.parser.configure({top:"Styles"})}].concat(tLe.map(e=>({name:e,parser:Fu.parser}))),cLe=Ry.define({name:"html",parser:f2t.configure({props:[yv.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let r=e.node;;){let s=r.lastChild;if(!s||s.name!="Element"||s.to!=r.to)break;t=r=s}return t&&!((n=t.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),vv.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),z2e.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ok=cLe.configure({wrap:M4e(iLe,lLe)});function uLe(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=M4e((e.nestedLanguages||[]).concat(iLe),(e.nestedAttributes||[]).concat(lLe)));let r=n?cLe.configure({wrap:n,dialect:t}):t?ok.configure({dialect:t}):ok;return new Py(r,[ok.data.of({autocomplete:oLe(e)}),e.autoCloseTags!==!1?dLe:[],bI().support,q4e().support])}const yve=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),dLe=it.inputHandler.of((e,t,n,r,s)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!ok.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:o}=a,i=o.changeByRange(c=>{var u,d,f;let p=o.doc.sliceString(c.from-1,c.to)==r,{head:h}=c,g=$s(o).resolveInner(h,-1),b;if(p&&r==">"&&g.name=="EndTag"){let y=g.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=nw(o.doc,y.parent,h))&&!yve.has(b)){let x=h+(o.doc.sliceString(h,h+1)===">"?1:0),w=`</${b}>`;return{range:c,changes:{from:h,to:x,insert:w}}}}else if(p&&r=="/"&&g.name=="IncompleteCloseTag"){let y=g.parent;if(g.from==h-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(b=nw(o.doc,y,h))&&!yve.has(b)){let x=h+(o.doc.sliceString(h,h+1)===">"?1:0),w=`${b}>`;return{range:We.cursor(h+w.length,-1),changes:{from:h,to:x,insert:w}}}}return{range:c}});return i.changes.empty?!1:(e.dispatch([a,o.update(i,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),L4t=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:dLe,html:uLe,htmlCompletionSource:aLe,htmlCompletionSourceWith:oLe,htmlLanguage:ok},Symbol.toStringTag,{value:"Module"})),fLe=S$({commentTokens:{block:{open:"<!--",close:"-->"}}}),pLe=new Wn,hLe=hDt.configure({props:[vv.add(e=>!e.is("Block")||e.is("Document")||XH(e)!=null||F4t(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),pLe.add(XH),yv.add({Document:()=>null}),Gm.add({Document:fLe})]});function XH(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function F4t(e){return e.name=="OrderedList"||e.name=="BulletList"}function z4t(e,t){let n=e;for(;;){let r=n.nextSibling,s;if(!r||(s=XH(r.type))!=null&&s<=t)break;n=r}return n.to}const B4t=T2e.of((e,t,n)=>{for(let r=$s(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let s=r.type.prop(pLe);if(s==null)continue;let a=z4t(r,s);if(a>n)return{from:n,to:a}}return null});function hJ(e){return new Dc(fLe,e,[],"markdown")}const mLe=hJ(hLe),U4t=hLe.configure([_Dt,CDt,EDt,TDt,{props:[vv.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),Dy=hJ(U4t);function q4t(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=Be.matchLanguageName(e,n,!0),r instanceof Be)return r.support?r.support.language.parser:Iy.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class uB{constructor(t,n,r,s,a,o,i){this.node=t,this.from=n,this.to=r,this.spaceBefore=s,this.spaceAfter=a,this.type=o,this.item=i}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length<t;)r+=" ";return r}else{for(let s=this.to-this.from-r.length-this.spaceAfter.length;s>0;s--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+bLe(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function gLe(e,t){let n=[],r=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&n.push(s)}for(let s=n.length-1;s>=0;s--){let a=n[s],o,i=t.lineAt(a.from),c=a.from-i.from;if(a.name=="Blockquote"&&(o=/^ *>( ?)/.exec(i.text.slice(c))))r.push(new uB(a,c,c+o[0].length,"",o[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(i.text.slice(c)))){let u=o[3],d=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new uB(a.parent,c,c+d,o[1],u,o[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(i.text.slice(c)))){let u=o[4],d=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),r.push(new uB(a.parent,c,c+d,o[1],u,f,a))}}return r}function bLe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function dB(e,t,n,r=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let i=bLe(a,t),c=+i[2];if(s>=0){if(c!=s+1)return;n.push({from:a.from+i[1].length,to:a.from+i[0].length,insert:String(s+2+r)})}s=c}let o=a.nextSibling;if(!o)break;a=o}}function mJ(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(lS)!=" ")return e;let r=Ud(e,4,n),s="";for(let a=r;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(n)}const yLe=(e={})=>({state:t,dispatch:n})=>{let r=$s(t),{doc:s}=t,a=null,o=t.changeByRange(i=>{if(!i.empty||!Dy.isActiveAt(t,i.from,-1)&&!Dy.isActiveAt(t,i.from,1))return a={range:i};let c=i.from,u=s.lineAt(c),d=gLe(r.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:i};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:i};let p=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&p){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,_,C="";O&&O.item?(_=u.from+O.from,C=O.marker(s,1)):_=u.from+(O?O.to:0);let E=[{from:_,to:c,insert:C}];return f.node.name=="OrderedList"&&dB(f.item,s,E,-2),O&&O.node.name=="OrderedList"&&dB(O.item,s,E),{range:We.cursor(_+C.length),changes:E}}else{let O=xve(d,t,u);return{range:We.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&p&&u.from){let x=s.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:i.map(O),changes:O}}}let h=[];f.node.name=="OrderedList"&&dB(f.item,s,h);let g=f.item&&f.item.from<u.from,b="";if(!g||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)b+=x==w&&!g?d[x].marker(s,1):d[x].blank(x<w?Ud(u.text,4,d[x+1].from)-b.length:null);let y=c;for(;y>u.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return b=mJ(b,t),V4t(f.node,t.doc)&&(b=xve(d,t,u)+t.lineBreak+b),h.push({from:y,to:c,insert:t.lineBreak+b}),{range:We.cursor(y+b.length+1),changes:h}});return a?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},vLe=yLe();function vve(e){return e.name=="QuoteMark"||e.name=="ListMark"}function V4t(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let s=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1)<a.number}function xve(e,t,n){let r="";for(let s=0,a=e.length-2;s<=a;s++)r+=e[s].blank(s<a?Ud(n.text,4,e[s+1].from)-r.length:null,s<a);return mJ(r,t)}function Q4t(e,t){let n=e.resolveInner(t,-1),r=t;vve(n)&&(r=n.from,n=n.parent);for(let s;s=n.childBefore(r);)if(vve(s))r=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")n=s.lastChild,r=n.to;else break;return n}const xLe=({state:e,dispatch:t})=>{let n=$s(e),r=null,s=e.changeByRange(a=>{let o=a.from,{doc:i}=e;if(a.empty&&Dy.isActiveAt(e,a.from)){let c=i.lineAt(o),u=gLe(Q4t(n,o),i);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(o-c.from>f&&!/\S/.test(c.text.slice(f,o-c.from)))return{range:We.cursor(c.from+f),changes:{from:c.from+f,to:o}};if(o-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let p=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let h=d.blank(Ud(c.text,4,d.to)-Ud(c.text,4,d.from));return p==c.from&&(h=mJ(h,e)),{range:We.cursor(p+h.length),changes:{from:p,to:c.from+d.to,insert:h}}}if(p<o)return{range:We.cursor(p),changes:{from:p,to:o}}}}}return r={range:a}});return r?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},wLe=[{key:"Enter",run:vLe},{key:"Backspace",run:xLe}],SLe=uLe({matchClosingTags:!1});function gJ(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:s}=mLe,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:i=SLe}=e;if(!(s instanceof C$))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[i.support,B4t],d;o&&u.push(OLe),n instanceof Py?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?q4t(t,d):void 0;c.push(gDt({codeParser:f,htmlParser:i.language.parser})),r&&u.push(Jd.high(iS.of(wLe)));let p=hJ(s.configure(c));return a&&u.push(p.data.of({autocomplete:H4t})),new Py(p,u)}function H4t(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let s=$s(t).resolveInner(n,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:n-r[0].length,to:n,options:G4t(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let fB=null;function G4t(){if(fB)return fB;let e=aLe(new HK(br.create({extensions:SLe}),0,!0));return fB=e?e.options:[]}const W4t=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,OLe=it.domEventHandlers({paste:(e,t)=>{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!Dy.isActiveAt(t.state,r.from,1)))return!1;let a=$s(t.state),o=!1;return a.iterate({from:r.from,to:r.to,enter:i=>{(i.from>r.from||W4t.test(i.name))&&(o=!0)},leave:i=>{i.to<r.to&&(o=!0)}}),o?!1:(t.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),Z4t=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:mLe,deleteMarkupBackward:xLe,insertNewlineContinueMarkup:vLe,insertNewlineContinueMarkupCommand:yLe,markdown:gJ,markdownKeymap:wLe,markdownLanguage:Dy,pasteURLAsLink:OLe},Symbol.toStringTag,{value:"Module"}));function st(e){return new Py(UK.define(e))}function xm(e){return Qe(()=>import("./index-0ogwceH9.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const kLe=[Be.of({name:"C",extensions:["c","h","ino"],load(){return Qe(()=>import("./index-DT5Y2foR.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Be.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Qe(()=>import("./index-DT5Y2foR.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Be.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return xm("Cassandra")}}),Be.of({name:"CSS",extensions:["css"],load(){return Qe(()=>Promise.resolve().then(()=>H2t),void 0,import.meta.url).then(e=>e.css())}}),Be.of({name:"Go",extensions:["go"],load(){return Qe(()=>import("./index-L-kG6ngL.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),Be.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Qe(()=>Promise.resolve().then(()=>L4t),void 0,import.meta.url).then(e=>e.html())}}),Be.of({name:"Java",extensions:["java"],load(){return Qe(()=>import("./index-K8sMzO3W.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),Be.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript())}}),Be.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Qe(()=>import("./index-DAS2hCYZ.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),Be.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Qe(()=>Promise.resolve().then(()=>o$t),void 0,import.meta.url).then(e=>e.json())}}),Be.of({name:"JSX",extensions:["jsx"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Be.of({name:"LESS",extensions:["less"],load(){return Qe(()=>import("./index-D4LBNnnu.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),Be.of({name:"Liquid",extensions:["liquid"],load(){return Qe(()=>import("./index-CEuoXL3V.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),Be.of({name:"MariaDB SQL",load(){return xm("MariaSQL")}}),Be.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Qe(()=>Promise.resolve().then(()=>Z4t),void 0,import.meta.url).then(e=>e.markdown())}}),Be.of({name:"MS SQL",load(){return xm("MSSQL")}}),Be.of({name:"MySQL",load(){return xm("MySQL")}}),Be.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Qe(()=>import("./index-BkcTqPVm.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),Be.of({name:"PLSQL",extensions:["pls"],load(){return xm("PLSQL")}}),Be.of({name:"PostgreSQL",load(){return xm("PostgreSQL")}}),Be.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Qe(()=>import("./index-Ce7l__85.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),Be.of({name:"Rust",extensions:["rs"],load(){return Qe(()=>import("./index-Cymq8ErC.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),Be.of({name:"Sass",extensions:["sass"],load(){return Qe(()=>import("./index-BxPl_9JX.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Be.of({name:"SCSS",extensions:["scss"],load(){return Qe(()=>import("./index-BxPl_9JX.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),Be.of({name:"SQL",extensions:["sql"],load(){return xm("StandardSQL")}}),Be.of({name:"SQLite",load(){return xm("SQLite")}}),Be.of({name:"TSX",extensions:["tsx"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Be.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Qe(()=>Promise.resolve().then(()=>pj),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Be.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Qe(()=>import("./index-BuCne47J.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),Be.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Qe(()=>import("./index-3147QKVW.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),Be.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Qe(()=>import("./index-CpUCA2LC.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),Be.of({name:"APL",extensions:["dyalog","apl"],load(){return Qe(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>st(e.apl))}}),Be.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Qe(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>st(e.asciiArmor))}}),Be.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Qe(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>st(e.asn1({})))}}),Be.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Qe(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>st(e.asterisk))}}),Be.of({name:"Brainfuck",extensions:["b","bf"],load(){return Qe(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>st(e.brainfuck))}}),Be.of({name:"Cobol",extensions:["cob","cpy"],load(){return Qe(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>st(e.cobol))}}),Be.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.csharp))}}),Be.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Qe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Be.of({name:"ClojureScript",extensions:["cljs"],load(){return Qe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Be.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Qe(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>st(e.gss))}}),Be.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Qe(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>st(e.cmake))}}),Be.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Qe(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>st(e.coffeeScript))}}),Be.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Qe(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>st(e.commonLisp))}}),Be.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Qe(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>st(e.cypher))}}),Be.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Qe(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>st(e.cython))}}),Be.of({name:"Crystal",extensions:["cr"],load(){return Qe(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>st(e.crystal))}}),Be.of({name:"D",extensions:["d"],load(){return Qe(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>st(e.d))}}),Be.of({name:"Dart",extensions:["dart"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.dart))}}),Be.of({name:"diff",extensions:["diff","patch"],load(){return Qe(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>st(e.diff))}}),Be.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Qe(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>st(e.dockerFile))}}),Be.of({name:"DTD",extensions:["dtd"],load(){return Qe(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>st(e.dtd))}}),Be.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Qe(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>st(e.dylan))}}),Be.of({name:"EBNF",load(){return Qe(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>st(e.ebnf))}}),Be.of({name:"ECL",extensions:["ecl"],load(){return Qe(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>st(e.ecl))}}),Be.of({name:"edn",extensions:["edn"],load(){return Qe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Be.of({name:"Eiffel",extensions:["e"],load(){return Qe(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>st(e.eiffel))}}),Be.of({name:"Elm",extensions:["elm"],load(){return Qe(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>st(e.elm))}}),Be.of({name:"Erlang",extensions:["erl"],load(){return Qe(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>st(e.erlang))}}),Be.of({name:"Esper",load(){return Qe(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>st(e.esper))}}),Be.of({name:"Factor",extensions:["factor"],load(){return Qe(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>st(e.factor))}}),Be.of({name:"FCL",load(){return Qe(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>st(e.fcl))}}),Be.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Qe(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>st(e.forth))}}),Be.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Qe(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>st(e.fortran))}}),Be.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Qe(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>st(e.fSharp))}}),Be.of({name:"Gas",extensions:["s"],load(){return Qe(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>st(e.gas))}}),Be.of({name:"Gherkin",extensions:["feature"],load(){return Qe(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>st(e.gherkin))}}),Be.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Qe(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>st(e.groovy))}}),Be.of({name:"Haskell",extensions:["hs"],load(){return Qe(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>st(e.haskell))}}),Be.of({name:"Haxe",extensions:["hx"],load(){return Qe(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>st(e.haxe))}}),Be.of({name:"HXML",extensions:["hxml"],load(){return Qe(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>st(e.hxml))}}),Be.of({name:"HTTP",load(){return Qe(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>st(e.http))}}),Be.of({name:"IDL",extensions:["pro"],load(){return Qe(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>st(e.idl))}}),Be.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Qe(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>st(e.jsonld))}}),Be.of({name:"Julia",extensions:["jl"],load(){return Qe(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>st(e.julia))}}),Be.of({name:"Kotlin",extensions:["kt","kts"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.kotlin))}}),Be.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Qe(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>st(e.liveScript))}}),Be.of({name:"Lua",extensions:["lua"],load(){return Qe(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>st(e.lua))}}),Be.of({name:"mIRC",extensions:["mrc"],load(){return Qe(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>st(e.mirc))}}),Be.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Qe(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>st(e.mathematica))}}),Be.of({name:"Modelica",extensions:["mo"],load(){return Qe(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>st(e.modelica))}}),Be.of({name:"MUMPS",extensions:["mps"],load(){return Qe(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>st(e.mumps))}}),Be.of({name:"Mbox",extensions:["mbox"],load(){return Qe(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>st(e.mbox))}}),Be.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Qe(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>st(e.nginx))}}),Be.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Qe(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>st(e.nsis))}}),Be.of({name:"NTriples",extensions:["nt","nq"],load(){return Qe(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>st(e.ntriples))}}),Be.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.objectiveC))}}),Be.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.objectiveCpp))}}),Be.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Qe(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>st(e.oCaml))}}),Be.of({name:"Octave",extensions:["m"],load(){return Qe(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>st(e.octave))}}),Be.of({name:"Oz",extensions:["oz"],load(){return Qe(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>st(e.oz))}}),Be.of({name:"Pascal",extensions:["p","pas"],load(){return Qe(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>st(e.pascal))}}),Be.of({name:"Perl",extensions:["pl","pm"],load(){return Qe(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>st(e.perl))}}),Be.of({name:"Pig",extensions:["pig"],load(){return Qe(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>st(e.pig))}}),Be.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Qe(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>st(e.powerShell))}}),Be.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Qe(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>st(e.properties))}}),Be.of({name:"ProtoBuf",extensions:["proto"],load(){return Qe(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>st(e.protobuf))}}),Be.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Qe(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>st(e.pug))}}),Be.of({name:"Puppet",extensions:["pp"],load(){return Qe(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>st(e.puppet))}}),Be.of({name:"Q",extensions:["q"],load(){return Qe(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>st(e.q))}}),Be.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Qe(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>st(e.r))}}),Be.of({name:"RPM Changes",load(){return Qe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmChanges))}}),Be.of({name:"RPM Spec",extensions:["spec"],load(){return Qe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmSpec))}}),Be.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Qe(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>st(e.ruby))}}),Be.of({name:"SAS",extensions:["sas"],load(){return Qe(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>st(e.sas))}}),Be.of({name:"Scala",extensions:["scala"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.scala))}}),Be.of({name:"Scheme",extensions:["scm","ss"],load(){return Qe(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>st(e.scheme))}}),Be.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Qe(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>st(e.shell))}}),Be.of({name:"Sieve",extensions:["siv","sieve"],load(){return Qe(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>st(e.sieve))}}),Be.of({name:"Smalltalk",extensions:["st"],load(){return Qe(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>st(e.smalltalk))}}),Be.of({name:"Solr",load(){return Qe(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>st(e.solr))}}),Be.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Qe(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>st(e.sml))}}),Be.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Qe(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>st(e.sparql))}}),Be.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Qe(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>st(e.spreadsheet))}}),Be.of({name:"Squirrel",extensions:["nut"],load(){return Qe(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>st(e.squirrel))}}),Be.of({name:"Stylus",extensions:["styl"],load(){return Qe(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>st(e.stylus))}}),Be.of({name:"Swift",extensions:["swift"],load(){return Qe(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>st(e.swift))}}),Be.of({name:"sTeX",load(){return Qe(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>st(e.stex))}}),Be.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Qe(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>st(e.stex))}}),Be.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Qe(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>st(e.verilog))}}),Be.of({name:"Tcl",extensions:["tcl"],load(){return Qe(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>st(e.tcl))}}),Be.of({name:"Textile",extensions:["textile"],load(){return Qe(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>st(e.textile))}}),Be.of({name:"TiddlyWiki",load(){return Qe(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>st(e.tiddlyWiki))}}),Be.of({name:"Tiki wiki",load(){return Qe(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>st(e.tiki))}}),Be.of({name:"TOML",extensions:["toml"],load(){return Qe(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>st(e.toml))}}),Be.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Qe(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>st(e.troff))}}),Be.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Qe(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>st(e.ttcn))}}),Be.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Qe(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>st(e.ttcnCfg))}}),Be.of({name:"Turtle",extensions:["ttl"],load(){return Qe(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>st(e.turtle))}}),Be.of({name:"Web IDL",extensions:["webidl"],load(){return Qe(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>st(e.webIDL))}}),Be.of({name:"VB.NET",extensions:["vb"],load(){return Qe(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>st(e.vb))}}),Be.of({name:"VBScript",extensions:["vbs"],load(){return Qe(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>st(e.vbScript))}}),Be.of({name:"Velocity",extensions:["vtl"],load(){return Qe(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>st(e.velocity))}}),Be.of({name:"Verilog",extensions:["v"],load(){return Qe(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>st(e.verilog))}}),Be.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Qe(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>st(e.vhdl))}}),Be.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Qe(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>st(e.xQuery))}}),Be.of({name:"Yacas",extensions:["ys"],load(){return Qe(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>st(e.yacas))}}),Be.of({name:"Z80",extensions:["z80"],load(){return Qe(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>st(e.z80))}}),Be.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Qe(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>st(e.mscgen))}}),Be.of({name:"Xù",extensions:["xu"],load(){return Qe(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>st(e.xu))}}),Be.of({name:"MsGenny",extensions:["msgenny"],load(){return Qe(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>st(e.msgenny))}}),Be.of({name:"Vue",extensions:["vue"],load(){return Qe(()=>import("./index-BwpOMbRD.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),Be.of({name:"Angular Template",load(){return Qe(()=>import("./index-BRlWCzSh.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];var Y4t=e=>{var{theme:t,settings:n={},styles:r=[]}=e,s={".cm-gutters":{}},a={};n.background&&(a.backgroundColor=n.background),n.backgroundImage&&(a.backgroundImage=n.backgroundImage),n.foreground&&(a.color=n.foreground),n.fontSize&&(a.fontSize=n.fontSize),(n.background||n.foreground)&&(s["&"]=a),n.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(s[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(s[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(s[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(s[".cm-content"]={caretColor:n.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var o={};n.gutterActiveForeground&&(o.color=n.gutterActiveForeground),n.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:n.lineHighlight},o.backgroundColor=n.lineHighlight),s[".cm-activeLineGutter"]=o,n.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var i=it.theme(s,{dark:t==="dark"}),c=xv.define(r),u=[i,_$(c)];return u},X4t={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},K4t=[{tag:re.comment,color:"#6272a4"},{tag:re.string,color:"#f1fa8c"},{tag:re.atom,color:"#bd93f9"},{tag:re.meta,color:"#f8f8f2"},{tag:[re.keyword,re.operator,re.tagName],color:"#ff79c6"},{tag:[re.function(re.propertyName),re.propertyName],color:"#66d9ef"},{tag:[re.definition(re.variableName),re.function(re.variableName),re.className,re.attributeName],color:"#50fa7b"},{tag:re.atom,color:"#bd93f9"}],T$=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return Y4t({theme:t,settings:Jf({},X4t,n),styles:[...K4t,...r]})};T$();const J4t=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=yJ(e.state,n.from);return r.line?eLt(e):r.block?nLt(e):!1};function bJ(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const eLt=bJ(aLt,0),tLt=bJ(_Le,0),nLt=bJ((e,t)=>_Le(e,t,sLt(t)),0);function yJ(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const L1=50;function rLt(e,{open:t,close:n},r,s){let a=e.sliceDoc(r-L1,r),o=e.sliceDoc(s,s+L1),i=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,u=a.length-i;if(a.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-i,margin:i&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-r<=2*L1?d=f=e.sliceDoc(r,s):(d=e.sliceDoc(r,r+L1),f=e.sliceDoc(s-L1,s));let p=/^\s*/.exec(d)[0].length,h=/\s*$/.exec(f)[0].length,g=f.length-h-n.length;return d.slice(p,p+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:r+p+t.length,margin:/\s/.test(d.charAt(p+t.length))?1:0},close:{pos:s-h-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function sLt(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function _Le(e,t,n=t.selection.ranges){let r=n.map(a=>yJ(t,a.from).block);if(!r.every(a=>a))return null;let s=n.map((a,o)=>rLt(t,r[o],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(n.map((a,o)=>s[o]?[]:[{from:a.from,insert:r[o].open+" "},{from:a.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let o=0,i;o<s.length;o++)if(i=s[o]){let c=r[o],{open:u,close:d}=i;a.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:a}}return null}function aLt(e,t,n=t.selection.ranges){let r=[],s=-1;for(let{from:a,to:o}of n){let i=r.length,c=1e9,u=yJ(t,a).line;if(u){for(let d=a;d<=o;){let f=t.doc.lineAt(d);if(f.from>s&&(a==o||o>f.from)){s=f.from;let p=/^\s*/.exec(f.text)[0].length,h=p==f.length,g=f.text.slice(p,p+u.length)==u?p:-1;p<f.text.length&&p<c&&(c=p),r.push({line:f,comment:g,token:u,indent:p,empty:h,single:!1})}d=f.to+1}if(c<1e9)for(let d=i;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==i+1&&(r[i].single=!0)}}if(e!=2&&r.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:i,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&a.push({from:i.from+u,insert:c+" "});let o=t.changes(a);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&r.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:i,token:c}of r)if(i>=0){let u=o.from+i,d=u+c.length;o.text[d-o.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const KH=fp.define(),oLt=fp.define(),iLt=Lt.define(),ELe=Lt.define({combine(e){return pp(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),CLe=lo.define({create(){return $f.empty},update(e,t){let n=t.state.facet(ELe),r=t.annotation(KH);if(r){let c=Vl.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=yI(d,d.length,n.minDepth,c):d=jLe(d,t.startState.selection),new $f(u==0?r.rest:d,u==0?d:r.rest)}let s=t.annotation(oLt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(wo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Vl.fromTransaction(t),o=t.annotation(wo.time),i=t.annotation(wo.userEvent);return a?e=e.addChanges(a,o,i,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,i,n.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new $f(e.done.map(Vl.fromJSON),e.undone.map(Vl.fromJSON))}});function lLt(e={}){return[CLe,ELe.of(e),it.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?TLe:t.inputType=="historyRedo"?JH:null;return r?(t.preventDefault(),r(n)):!1}})]}function N$(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(CLe,!1);if(!s)return!1;let a=s.pop(e,n,t);return a?(r(a),!0):!1}}const TLe=N$(0,!1),JH=N$(1,!1),cLt=N$(0,!0),uLt=N$(1,!0);class Vl{constructor(t,n,r,s,a){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new Vl(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Vl(t.changes&&go.fromJSON(t.changes),[],t.mapped&&Vf.fromJSON(t.mapped),t.startSelection&&We.fromJSON(t.startSelection),t.selectionsAfter.map(We.fromJSON))}static fromTransaction(t,n){let r=Mu;for(let s of t.startState.facet(iLt)){let a=s(t);a.length&&(r=r.concat(a))}return!r.length&&t.changes.empty?null:new Vl(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Mu)}static selection(t){return new Vl(void 0,Mu,void 0,void 0,t)}}function yI(e,t,n,r){let s=t+1>n+20?t-n-1:0,a=e.slice(s,t);return a.push(r),a}function dLt(e,t){let n=[],r=!1;return e.iterChangedRanges((s,a)=>n.push(s,a)),t.iterChangedRanges((s,a,o,i)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];i>=u&&o<=d&&(r=!0)}}),r}function fLt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function NLe(e,t){return e.length?t.length?e.concat(t):e:t}const Mu=[],pLt=200;function jLe(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-pLt));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),yI(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Vl.selection([t])]}function hLt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function pB(e,t){if(!e.length)return e;let n=e.length,r=Mu;for(;n;){let s=mLt(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,n);return a[n-1]=s,a}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[Vl.selection(r)]:Mu}function mLt(e,t,n){let r=NLe(e.selectionsAfter.length?e.selectionsAfter.map(i=>i.map(t)):Mu,n);if(!e.changes)return Vl.selection(r);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Vl(s,Fn.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}const gLt=/^(input\.type|delete)($|\.)/;class $f{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new $f(this.done,this.undone):this}addChanges(t,n,r,s,a){let o=this.done,i=o[o.length-1];return i&&i.changes&&!i.changes.empty&&t.changes&&(!r||gLt.test(r))&&(!i.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,dLt(i.changes,t.changes))||r=="input.type.compose")?o=yI(o,o.length-1,s.minDepth,new Vl(t.changes.compose(i.changes),NLe(Fn.mapEffects(t.effects,i.changes),i.effects),i.mapped,i.startSelection,Mu)):o=yI(o,o.length,s.minDepth,t),new $f(o,Mu,n,r)}addSelection(t,n,r,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Mu;return a.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&fLt(a[a.length-1],t)?this:new $f(jLe(this.done,t),this.undone,n,r)}addMapping(t){return new $f(pB(this.done,t),pB(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],o=a.selectionsAfter[0]||n.selection;if(r&&a.selectionsAfter.length)return n.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:KH.of({side:t,rest:hLt(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let i=s.length==1?Mu:s.slice(0,s.length-1);return a.mapped&&(i=pB(i,a.mapped)),n.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:KH.of({side:t,rest:i,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}$f.empty=new $f(Mu,Mu);const bLt=[{key:"Mod-z",run:TLe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:JH,preventDefault:!0},{linux:"Ctrl-Shift-z",run:JH,preventDefault:!0},{key:"Mod-u",run:cLt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:uLt,preventDefault:!0}];function uS(e,t){return We.create(e.ranges.map(t),e.mainIndex)}function ef(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function tf({state:e,dispatch:t},n){let r=uS(e.selection,n);return r.eq(e.selection,!0)?!1:(t(ef(e,r)),!0)}function j$(e,t){return We.cursor(t?e.to:e.from)}function ALe(e,t){return tf(e,n=>n.empty?e.moveByChar(n,t):j$(n,t))}function Qi(e){return e.textDirectionAt(e.state.selection.main.head)==qs.LTR}const RLe=e=>ALe(e,!Qi(e)),ILe=e=>ALe(e,Qi(e));function PLe(e,t){return tf(e,n=>n.empty?e.moveByGroup(n,t):j$(n,t))}const yLt=e=>PLe(e,!Qi(e)),vLt=e=>PLe(e,Qi(e));function xLt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function A$(e,t,n){let r=$s(e).resolveInner(t.head),s=n?Wn.closedBy:Wn.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;xLt(e,u,s)?r=u:c=n?u.to:u.from}let a=r.type.prop(s),o,i;return a&&(o=n?Mf(e,r.from,1):Mf(e,r.to,-1))&&o.matched?i=n?o.end.to:o.end.from:i=n?r.to:r.from,We.cursor(i,n?-1:1)}const wLt=e=>tf(e,t=>A$(e.state,t,!Qi(e))),SLt=e=>tf(e,t=>A$(e.state,t,Qi(e)));function MLe(e,t){return tf(e,n=>{if(!n.empty)return j$(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const $Le=e=>MLe(e,!1),DLe=e=>MLe(e,!0);function LLe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let a of e.state.facet(it.scrollMargins)){let o=a(e);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function FLe(e,t){let n=LLe(e),{state:r}=e,s=uS(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):j$(o,t));if(s.eq(r.selection))return!1;let a;if(n.selfScroll){let o=e.coordsAtPos(r.selection.main.head),i=e.scrollDOM.getBoundingClientRect(),c=i.top+n.marginTop,u=i.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(a=it.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(ef(r,s),{effects:a}),!0}const wve=e=>FLe(e,!1),eG=e=>FLe(e,!0);function Qg(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let a=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&t.head!=r.from+a&&(s=We.cursor(r.from+a))}return s}const OLt=e=>tf(e,t=>Qg(e,t,!0)),kLt=e=>tf(e,t=>Qg(e,t,!1)),_Lt=e=>tf(e,t=>Qg(e,t,!Qi(e))),ELt=e=>tf(e,t=>Qg(e,t,Qi(e))),CLt=e=>tf(e,t=>We.cursor(e.lineBlockAt(t.head).from,1)),TLt=e=>tf(e,t=>We.cursor(e.lineBlockAt(t.head).to,-1));function NLt(e,t,n){let r=!1,s=uS(e.selection,a=>{let o=Mf(e,a.head,-1)||Mf(e,a.head,1)||a.head>0&&Mf(e,a.head-1,1)||a.head<e.doc.length&&Mf(e,a.head+1,-1);if(!o||!o.end)return a;r=!0;let i=o.start.from==a.head?o.end.to:o.end.from;return We.cursor(i)});return r?(t(ef(e,s)),!0):!1}const jLt=({state:e,dispatch:t})=>NLt(e,t);function nd(e,t){let n=uS(e.state.selection,r=>{let s=t(r);return We.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(ef(e.state,n)),!0)}function zLe(e,t){return nd(e,n=>e.moveByChar(n,t))}const BLe=e=>zLe(e,!Qi(e)),ULe=e=>zLe(e,Qi(e));function qLe(e,t){return nd(e,n=>e.moveByGroup(n,t))}const ALt=e=>qLe(e,!Qi(e)),RLt=e=>qLe(e,Qi(e)),ILt=e=>nd(e,t=>A$(e.state,t,!Qi(e))),PLt=e=>nd(e,t=>A$(e.state,t,Qi(e)));function VLe(e,t){return nd(e,n=>e.moveVertically(n,t))}const QLe=e=>VLe(e,!1),HLe=e=>VLe(e,!0);function GLe(e,t){return nd(e,n=>e.moveVertically(n,t,LLe(e).height))}const Sve=e=>GLe(e,!1),Ove=e=>GLe(e,!0),MLt=e=>nd(e,t=>Qg(e,t,!0)),$Lt=e=>nd(e,t=>Qg(e,t,!1)),DLt=e=>nd(e,t=>Qg(e,t,!Qi(e))),LLt=e=>nd(e,t=>Qg(e,t,Qi(e))),FLt=e=>nd(e,t=>We.cursor(e.lineBlockAt(t.head).from)),zLt=e=>nd(e,t=>We.cursor(e.lineBlockAt(t.head).to)),kve=({state:e,dispatch:t})=>(t(ef(e,{anchor:0})),!0),_ve=({state:e,dispatch:t})=>(t(ef(e,{anchor:e.doc.length})),!0),Eve=({state:e,dispatch:t})=>(t(ef(e,{anchor:e.selection.main.anchor,head:0})),!0),Cve=({state:e,dispatch:t})=>(t(ef(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),BLt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ULt=({state:e,dispatch:t})=>{let n=R$(e).map(({from:r,to:s})=>We.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:We.create(n),userEvent:"select"})),!0},qLt=({state:e,dispatch:t})=>{let n=uS(e.selection,r=>{let s=$s(e),a=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:i}=o;if((i.from<r.from&&i.to>=r.to||i.to>r.to&&i.from<=r.from)&&o.next)return We.range(i.to,i.from)}return r});return n.eq(e.selection)?!1:(t(ef(e,n)),!0)};function WLe(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let a of n.selection.ranges){let o=n.doc.lineAt(a.head);if(t?o.to<e.state.doc.length:o.from>0)for(let i=a;;){let c=e.moveVertically(i,t);if(c.head<o.from||c.head>o.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==i.head)break;i=c}}}return s.length==r.ranges.length?!1:(e.dispatch(ef(n,We.create(s,s.length-1))),!0)}const VLt=e=>WLe(e,!1),QLt=e=>WLe(e,!0),HLt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=We.create([n.main]):n.main.empty||(r=We.create([We.cursor(n.main.head)])),r?(t(ef(e,r)),!0):!1};function iC(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(a=>{let{from:o,to:i}=a;if(o==i){let c=t(a);c<o?(n="delete.backward",c=hj(e,c,!1)):c>o&&(n="delete.forward",c=hj(e,c,!0)),o=Math.min(o,c),i=Math.max(i,c)}else o=hj(e,o,!1),i=hj(e,i,!0);return o==i?{range:a}:{changes:{from:o,to:i},range:We.cursor(o,o<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?it.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function hj(e,t,n){if(e instanceof it)for(let r of e.state.facet(it.atomicRanges).map(s=>s(e)))r.between(t,t,(s,a)=>{s<t&&a>t&&(t=n?a:s)});return t}const ZLe=(e,t,n)=>iC(e,r=>{let s=r.from,{state:a}=e,o=a.doc.lineAt(s),i,c;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(i=o.text.slice(0,s-o.from))){if(i[i.length-1]==" ")return s-1;let u=Ud(i,a.tabSize),d=u%My(a)||My(a);for(let f=0;f<d&&i[i.length-1-f]==" ";f++)s--;c=s}else c=Go(o.text,s-o.from,t,t)+o.from,c==s&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,s-o.from))&&(c=Go(o.text,c-o.from,!1,!1)+o.from);return c}),tG=e=>ZLe(e,!1,!0),YLe=e=>ZLe(e,!0,!1),XLe=(e,t)=>iC(e,n=>{let r=n.head,{state:s}=e,a=s.doc.lineAt(r),o=s.charCategorizer(r);for(let i=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let c=Go(a.text,r-a.from,t)+a.from,u=a.text.slice(Math.min(r,c)-a.from,Math.max(r,c)-a.from),d=o(u);if(i!=null&&d!=i)break;(u!=" "||r!=n.head)&&(i=d),r=c}return r}),KLe=e=>XLe(e,!1),GLt=e=>XLe(e,!0),WLt=e=>iC(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ZLt=e=>iC(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),YLt=e=>iC(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),XLt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ur.of(["",""])},range:We.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},KLt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,a=e.doc.lineAt(s),o=s==a.from?s-1:Go(a.text,s-a.from,!1)+a.from,i=s==a.to?s+1:Go(a.text,s-a.from,!0)+a.from;return{changes:{from:o,to:i,insert:e.doc.slice(s,i).append(e.doc.slice(o,s))},range:We.cursor(i)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function R$(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=a.to,o.ranges.push(r)}else t.push({from:s.from,to:a.to,ranges:[r]});n=a.number+1}return t}function JLe(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let a of R$(e)){if(n?a.to==e.doc.length:a.from==0)continue;let o=e.doc.lineAt(n?a.to+1:a.from-1),i=o.length+1;if(n){r.push({from:a.to,to:o.to},{from:a.from,insert:o.text+e.lineBreak});for(let c of a.ranges)s.push(We.range(Math.min(e.doc.length,c.anchor+i),Math.min(e.doc.length,c.head+i)))}else{r.push({from:o.from,to:a.from},{from:a.to,insert:e.lineBreak+o.text});for(let c of a.ranges)s.push(We.range(c.anchor-i,c.head-i))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:We.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const JLt=({state:e,dispatch:t})=>JLe(e,t,!1),e3t=({state:e,dispatch:t})=>JLe(e,t,!0);function e3e(e,t,n){if(e.readOnly)return!1;let r=[];for(let a of R$(e))n?r.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):r.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const t3t=({state:e,dispatch:t})=>e3e(e,t,!1),n3t=({state:e,dispatch:t})=>e3e(e,t,!0),r3t=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(R$(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),r=uS(t.selection,s=>{let a;if(e.lineWrapping){let o=e.lineBlockAt(s.head),i=e.coordsAtPos(s.head,s.assoc||1);i&&(a=o.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function s3t(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=$s(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),a;return r&&s&&r.to<=t&&s.from>=t&&(a=r.type.prop(Wn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const Tve=t3e(!1),a3t=t3e(!0);function t3e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:a,to:o}=s,i=t.doc.lineAt(a),c=!e&&a==o&&s3t(t,a);e&&(a=o=(o<=i.to?i:t.doc.lineAt(o)).to);let u=new O$(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=FK(u,a);for(d==null&&(d=Ud(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));o<i.to&&/\s/.test(i.text[o-i.from]);)o++;c?{from:a,to:o}=c:a>i.from&&a<i.from+100&&!/\S/.test(i.text.slice(0,a))&&(a=i.from);let f=["",s_(t,d)];return c&&f.push(s_(t,u.lineIndent(i.from,-1))),{changes:{from:a,to:o,insert:Ur.of(f)},range:We.cursor(a+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function vJ(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let i=e.doc.lineAt(o);i.number>n&&(r.empty||r.to>i.from)&&(t(i,s,r),n=i.number),o=i.to+1}let a=e.changes(s);return{changes:s,range:We.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}const o3t=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new O$(e,{overrideIndentation:a=>{let o=n[a];return o??-1}}),s=vJ(e,(a,o,i)=>{let c=FK(r,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=s_(e,c);(u!=d||i.from<a.from+u.length)&&(n[a.from]=c,o.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},n3e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(vJ(e,(n,r)=>{r.push({from:n.from,insert:e.facet(lS)})}),{userEvent:"input.indent"})),!0),r3e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(vJ(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let a=Ud(s,e.tabSize),o=0,i=s_(e,Math.max(0,a-My(e)));for(;o<s.length&&o<i.length&&s.charCodeAt(o)==i.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:i.slice(o)})}),{userEvent:"delete.dedent"})),!0),i3t=e=>(e.setTabFocusMode(),!0),l3t=[{key:"Ctrl-b",run:RLe,shift:BLe,preventDefault:!0},{key:"Ctrl-f",run:ILe,shift:ULe},{key:"Ctrl-p",run:$Le,shift:QLe},{key:"Ctrl-n",run:DLe,shift:HLe},{key:"Ctrl-a",run:CLt,shift:FLt},{key:"Ctrl-e",run:TLt,shift:zLt},{key:"Ctrl-d",run:YLe},{key:"Ctrl-h",run:tG},{key:"Ctrl-k",run:WLt},{key:"Ctrl-Alt-h",run:KLe},{key:"Ctrl-o",run:XLt},{key:"Ctrl-t",run:KLt},{key:"Ctrl-v",run:eG}],c3t=[{key:"ArrowLeft",run:RLe,shift:BLe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yLt,shift:ALt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:_Lt,shift:DLt,preventDefault:!0},{key:"ArrowRight",run:ILe,shift:ULe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vLt,shift:RLt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:ELt,shift:LLt,preventDefault:!0},{key:"ArrowUp",run:$Le,shift:QLe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:kve,shift:Eve},{mac:"Ctrl-ArrowUp",run:wve,shift:Sve},{key:"ArrowDown",run:DLe,shift:HLe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_ve,shift:Cve},{mac:"Ctrl-ArrowDown",run:eG,shift:Ove},{key:"PageUp",run:wve,shift:Sve},{key:"PageDown",run:eG,shift:Ove},{key:"Home",run:kLt,shift:$Lt,preventDefault:!0},{key:"Mod-Home",run:kve,shift:Eve},{key:"End",run:OLt,shift:MLt,preventDefault:!0},{key:"Mod-End",run:_ve,shift:Cve},{key:"Enter",run:Tve,shift:Tve},{key:"Mod-a",run:BLt},{key:"Backspace",run:tG,shift:tG,preventDefault:!0},{key:"Delete",run:YLe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:KLe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:GLt,preventDefault:!0},{mac:"Mod-Backspace",run:ZLt,preventDefault:!0},{mac:"Mod-Delete",run:YLt,preventDefault:!0}].concat(l3t.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),u3t=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wLt,shift:ILt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:SLt,shift:PLt},{key:"Alt-ArrowUp",run:JLt},{key:"Shift-Alt-ArrowUp",run:t3t},{key:"Alt-ArrowDown",run:e3t},{key:"Shift-Alt-ArrowDown",run:n3t},{key:"Mod-Alt-ArrowUp",run:VLt},{key:"Mod-Alt-ArrowDown",run:QLt},{key:"Escape",run:HLt},{key:"Mod-Enter",run:a3t},{key:"Alt-l",mac:"Ctrl-l",run:ULt},{key:"Mod-i",run:qLt,preventDefault:!0},{key:"Mod-[",run:r3e},{key:"Mod-]",run:n3e},{key:"Mod-Alt-\\",run:o3t},{key:"Shift-Mod-k",run:r3t},{key:"Shift-Mod-\\",run:jLt},{key:"Mod-/",run:J4t},{key:"Alt-A",run:tLt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:i3t}].concat(c3t),d3t={key:"Tab",run:n3e,shift:r3e},Nve=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class sw{constructor(t,n,r=0,s=t.length,a,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,s),this.bufferStart=r,this.normalize=a?i=>a(Nve(i)):Nve,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return $l(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=wK(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Nf(t);let s=this.normalize(n);if(s.length)for(let a=0,o=r;;a++){let i=s.charCodeAt(a),c=this.match(i,o,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}o==r&&a<n.length&&n.charCodeAt(a)==i&&o++}}}match(t,n,r){let s=null;for(let a=0;a<this.matches.length;a+=2){let o=this.matches[a],i=!1;this.query.charCodeAt(o)==t&&(o==this.query.length-1?s={from:this.matches[a+1],to:r}:(this.matches[a]++,i=!0)),i||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(sw.prototype[Symbol.iterator]=function(){return this});const s3e={from:-1,to:-1,match:/.*/.exec("")},xJ="gm"+(/x/.unicode==null?"":"u");class a3e{constructor(t,n,r,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=s3e,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new o3e(t,n,r,s,a);this.re=new RegExp(n,xJ+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let o=t.lineAt(s);this.curLineStart=o.from,this.matchPos=vI(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=vI(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const hB=new WeakMap;class T0{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let s=hB.get(t);if(!s||s.from>=r||s.to<=n){let i=new T0(n,t.sliceString(n,r));return hB.set(t,i),i}if(s.from==n&&s.to==r)return s;let{text:a,from:o}=s;return o>n&&(a=t.sliceString(n,o)+a,o=n),s.to<r&&(a+=t.sliceString(s.to,r)),hB.set(t,new T0(o,a)),new T0(n,a.slice(n-o,r-o))}}class o3e{constructor(t,n,r,s,a){this.text=t,this.to=a,this.done=!1,this.value=s3e,this.matchPos=vI(t,s),this.re=new RegExp(n,xJ+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=T0.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=vI(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=T0.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(a3e.prototype[Symbol.iterator]=o3e.prototype[Symbol.iterator]=function(){return this});function f3t(e){try{return new RegExp(e,xJ),!0}catch{return!1}}function vI(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function nG(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=zs("input",{class:"cm-textfield",name:"line",value:t}),r=zs("form",{class:"cm-gotoLine",onkeydown:a=>{a.keyCode==27?(a.preventDefault(),e.dispatch({effects:ik.of(!1)}),e.focus()):a.keyCode==13&&(a.preventDefault(),s())},onsubmit:a=>{a.preventDefault(),s()}},zs("label",e.state.phrase("Go to line"),": ",n)," ",zs("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),zs("button",{name:"close",onclick:()=>{e.dispatch({effects:ik.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function s(){let a=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!a)return;let{state:o}=e,i=o.doc.lineAt(o.selection.main.head),[,c,u,d,f]=a,p=d?+d.slice(1):0,h=u?+u:i.number;if(u&&f){let y=h/100;c&&(y=y*(c=="-"?-1:1)+i.number/o.doc.lines),h=Math.round(o.doc.lines*y)}else u&&c&&(h=h*(c=="-"?-1:1)+i.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,h))),b=We.cursor(g.from+Math.max(0,Math.min(p,g.length)));e.dispatch({effects:[ik.of(!1),it.scrollIntoView(b.from,{y:"center"})],selection:b}),e.focus()}return{dom:r}}const ik=Fn.define(),jve=lo.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(ik)&&(e=n.value);return e},provide:e=>r_.from(e,t=>t?nG:null)}),p3t=e=>{let t=n_(e,nG);if(!t){let n=[ik.of(!0)];e.state.field(jve,!1)==null&&n.push(Fn.appendConfig.of([jve,h3t])),e.dispatch({effects:n}),t=n_(e,nG)}return t&&t.dom.querySelector("input").select(),!0},h3t=it.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),m3t={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g3t=Lt.define({combine(e){return pp(e,m3t,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function b3t(e){return[S3t,w3t]}const y3t=Qt.mark({class:"cm-selectionMatch"}),v3t=Qt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ave(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=wa.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=wa.Word)}function x3t(e,t,n,r){return e(t.sliceDoc(n,n+1))==wa.Word&&e(t.sliceDoc(r-1,r))==wa.Word}const w3t=Pa.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(g3t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Qt.none;let s=r.main,a,o=null;if(s.empty){if(!t.highlightWordAroundCursor)return Qt.none;let c=n.wordAt(s.head);if(!c)return Qt.none;o=n.charCategorizer(s.head),a=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return Qt.none;if(t.wholeWords){if(a=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(Ave(o,n,s.from,s.to)&&x3t(o,n,s.from,s.to)))return Qt.none}else if(a=n.sliceDoc(s.from,s.to),!a)return Qt.none}let i=[];for(let c of e.visibleRanges){let u=new sw(n.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||Ave(o,n,d,f))&&(s.empty&&d<=s.from&&f>=s.to?i.push(v3t.range(d,f)):(d>=s.to||f<=s.from)&&i.push(y3t.range(d,f)),i.length>t.maxMatches))return Qt.none}}return Qt.set(i)}},{decorations:e=>e.decorations}),S3t=it.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),O3t=({state:e,dispatch:t})=>{let{selection:n}=e,r=We.create(n.ranges.map(s=>e.wordAt(s.head)||We.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function k3t(e,t){let{main:n,ranges:r}=e.selection,s=e.wordAt(n.head),a=s&&s.from==n.from&&s.to==n.to;for(let o=!1,i=new sw(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(o)return null;i=new sw(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(c=>c.from==i.value.from))continue;if(a){let c=e.wordAt(i.value.from);if(!c||c.from!=i.value.from||c.to!=i.value.to)continue}return i.value}}const _3t=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(a=>a.from===a.to))return O3t({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=r))return!1;let s=k3t(e,r);return s?(t(e.update({selection:e.selection.addRange(We.range(s.from,s.to),!1),effects:it.scrollIntoView(s.to)})),!0):!1},dS=Lt.define({combine(e){return pp(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new D3t(t),scrollToMatch:t=>it.scrollIntoView(t)})}});class i3e{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||f3t(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
132
132
|
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new N3t(this):new C3t(this)}getCursor(t,n=0,r){let s=t.doc?t:br.create({doc:t});return r==null&&(r=s.doc.length),this.regexp?Fx(this,s,n,r):Lx(this,s,n,r)}}class l3e{constructor(t){this.spec=t}}function Lx(e,t,n,r){return new sw(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:s=>s.toLowerCase(),e.wholeWord?E3t(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function E3t(e,t){return(n,r,s,a)=>((a>n||a+s.length<r)&&(a=Math.max(0,n-2),s=e.sliceString(a,Math.min(e.length,r+2))),(t(xI(s,n-a))!=wa.Word||t(wI(s,n-a))!=wa.Word)&&(t(wI(s,r-a))!=wa.Word||t(xI(s,r-a))!=wa.Word))}class C3t extends l3e{constructor(t){super(t)}nextMatch(t,n,r){let s=Lx(this.spec,t,r,t.doc.length).nextOverlapping();if(s.done){let a=Math.min(t.doc.length,n+this.spec.unquoted.length);s=Lx(this.spec,t,0,a).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(t,n,r){for(let s=r;;){let a=Math.max(n,s-1e4-this.spec.unquoted.length),o=Lx(this.spec,t,a,s),i=null;for(;!o.nextOverlapping().done;)i=o.value;if(i)return i;if(a==n)return null;s-=1e4}}prevMatch(t,n,r){let s=this.prevMatchInRange(t,0,n);return s||(s=this.prevMatchInRange(t,Math.max(0,r-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let r=Lx(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let a=Lx(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function Fx(e,t,n,r){return new a3e(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?T3t(t.charCategorizer(t.selection.main.head)):void 0},n,r)}function xI(e,t){return e.slice(Go(e,t,!1),t)}function wI(e,t){return e.slice(t,Go(e,t))}function T3t(e){return(t,n,r)=>!r[0].length||(e(xI(r.input,r.index))!=wa.Word||e(wI(r.input,r.index))!=wa.Word)&&(e(wI(r.input,r.index+r[0].length))!=wa.Word||e(xI(r.input,r.index+r[0].length))!=wa.Word)}class N3t extends l3e{nextMatch(t,n,r){let s=Fx(this.spec,t,r,t.doc.length).next();return s.done&&(s=Fx(this.spec,t,0,n).next()),s.done?null:s.value}prevMatchInRange(t,n,r){for(let s=1;;s++){let a=Math.max(n,r-s*1e4),o=Fx(this.spec,t,a,r),i=null;for(;!o.next().done;)i=o.value;if(i&&(a==n||i.from>a+10))return i;if(a==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let a=+r.slice(0,s);if(a>0&&a<t.match.length)return t.match[a]+r.slice(s)}return n})}matchAll(t,n){let r=Fx(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let a=Fx(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const h_=Fn.define(),wJ=Fn.define(),rg=lo.define({create(e){return new mB(rG(e).create(),null)},update(e,t){for(let n of t.effects)n.is(h_)?e=new mB(n.value.create(),e.panel):n.is(wJ)&&(e=new mB(e.query,n.value?SJ:null));return e},provide:e=>r_.from(e,t=>t.panel)});class mB{constructor(t,n){this.query=t,this.panel=n}}const j3t=Qt.mark({class:"cm-searchMatch"}),A3t=Qt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),R3t=Pa.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(rg))}update(e){let t=e.state.field(rg);(t!=e.startState.field(rg)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Qt.none;let{view:n}=this,r=new ec;for(let s=0,a=n.visibleRanges,o=a.length;s<o;s++){let{from:i,to:c}=a[s];for(;s<o-1&&c>a[s+1].from-500;)c=a[++s].to;e.highlight(n.state,i,c,(u,d)=>{let f=n.state.selection.ranges.some(p=>p.from==u&&p.to==d);r.add(u,d,f?A3t:j3t)})}return r.finish()}},{decorations:e=>e.decorations});function lC(e){return t=>{let n=t.state.field(rg,!1);return n&&n.query.spec.valid?e(t,n):d3e(t)}}const SI=lC((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let s=We.single(r.from,r.to),a=e.state.facet(dS);return e.dispatch({selection:s,effects:[OJ(e,r),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),u3e(e),!0}),OI=lC((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,s=t.prevMatch(n,r,r);if(!s)return!1;let a=We.single(s.from,s.to),o=e.state.facet(dS);return e.dispatch({selection:a,effects:[OJ(e,s),o.scrollToMatch(a.main,e)],userEvent:"select.search"}),u3e(e),!0}),I3t=lC((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:We.create(n.map(r=>We.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),P3t=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,a=[],o=0;for(let i=new sw(e.doc,e.sliceDoc(r,s));!i.next().done;){if(a.length>1e3)return!1;i.value.from==r&&(o=a.length),a.push(We.range(i.value.from,i.value.to))}return t(e.update({selection:We.create(a,o),userEvent:"select.search.matches"})),!0},Rve=lC((e,{query:t})=>{let{state:n}=e,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,i=[],c,u,d=[];o.from==r&&o.to==s&&(u=n.toText(t.getReplacement(o)),i.push({from:o.from,to:o.to,insert:u}),o=t.nextMatch(n,o.from,o.to),d.push(it.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=e.state.changes(i);return o&&(c=We.single(o.from,o.to).map(f),d.push(OJ(e,o)),d.push(n.facet(dS).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),M3t=lC((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(s=>{let{from:a,to:o}=s;return{from:a,to:o,insert:t.getReplacement(s)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:it.announce.of(r),userEvent:"input.replace.all"}),!0});function SJ(e){return e.state.facet(dS).createPanel(e)}function rG(e,t){var n,r,s,a,o;let i=e.selection.main,c=i.empty||i.to>i.from+100?"":e.sliceDoc(i.from,i.to);if(t&&!c)return t;let u=e.facet(dS);return new i3e({search:((n=t?.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(s=t?.literal)!==null&&s!==void 0?s:u.literal,regexp:(a=t?.regexp)!==null&&a!==void 0?a:u.regexp,wholeWord:(o=t?.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function c3e(e){let t=n_(e,SJ);return t&&t.dom.querySelector("[main-field]")}function u3e(e){let t=c3e(e);t&&t==e.root.activeElement&&t.select()}const d3e=e=>{let t=e.state.field(rg,!1);if(t&&t.panel){let n=c3e(e);if(n&&n!=e.root.activeElement){let r=rG(e.state,t.query.spec);r.valid&&e.dispatch({effects:h_.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[wJ.of(!0),t?h_.of(rG(e.state,t.query.spec)):Fn.appendConfig.of(F3t)]});return!0},f3e=e=>{let t=e.state.field(rg,!1);if(!t||!t.panel)return!1;let n=n_(e,SJ);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:wJ.of(!1)}),!0},$3t=[{key:"Mod-f",run:d3e,scope:"editor search-panel"},{key:"F3",run:SI,shift:OI,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:SI,shift:OI,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:f3e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:P3t},{key:"Mod-Alt-g",run:p3t},{key:"Mod-d",run:_3t,preventDefault:!0}];class D3t{constructor(t){this.view=t;let n=this.query=t.state.field(rg).query.spec;this.commit=this.commit.bind(this),this.searchField=zs("input",{value:n.search,placeholder:Oc(t,"Find"),"aria-label":Oc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=zs("input",{value:n.replace,placeholder:Oc(t,"Replace"),"aria-label":Oc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=zs("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=zs("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=zs("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,a,o){return zs("button",{class:"cm-button",name:s,onclick:a,type:"button"},o)}this.dom=zs("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>SI(t),[Oc(t,"next")]),r("prev",()=>OI(t),[Oc(t,"previous")]),r("select",()=>I3t(t),[Oc(t,"all")]),zs("label",null,[this.caseField,Oc(t,"match case")]),zs("label",null,[this.reField,Oc(t,"regexp")]),zs("label",null,[this.wordField,Oc(t,"by word")]),...t.state.readOnly?[]:[zs("br"),this.replaceField,r("replace",()=>Rve(t),[Oc(t,"replace")]),r("replaceAll",()=>M3t(t),[Oc(t,"replace all")])],zs("button",{name:"close",onclick:()=>f3e(t),"aria-label":Oc(t,"close"),type:"button"},["×"])])}commit(){let t=new i3e({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:h_.of(t)}))}keydown(t){fPt(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?OI:SI)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Rve(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(h_)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(dS).top}}function Oc(e,t){return e.state.phrase(t)}const mj=30,gj=/[\s\.,:;?!]/;function OJ(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),s=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-mj),o=Math.min(s,n+mj),i=e.state.sliceDoc(a,o);if(a!=r.from){for(let c=0;c<mj;c++)if(!gj.test(i[c+1])&&gj.test(i[c])){i=i.slice(c);break}}if(o!=s){for(let c=i.length-1;c>i.length-mj;c--)if(!gj.test(i[c-1])&&gj.test(i[c])){i=i.slice(0,c);break}}return it.announce.of(`${e.state.phrase("current match")}. ${i} ${e.state.phrase("on line")} ${r.number}.`)}const L3t=it.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),F3t=[rg,Jd.low(R3t),L3t];class Ive{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class Hb{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let s=r.facet(m_).markerFilter;s&&(t=s(t,r));let a=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),o=new ec,i=[],c=0;for(let d=0;;){let f=d==a.length?null:a[d];if(!f&&!i.length)break;let p,h;for(i.length?(p=c,h=i.reduce((b,y)=>Math.min(b,y.to),f&&f.from>p?f.from:1e8)):(p=f.from,h=f.to,i.push(f),d++);d<a.length;){let b=a[d];if(b.from==p&&(b.to>b.from||b.to==p))i.push(b),d++,h=Math.min(b.to,h);else{h=Math.min(b.from,h);break}}let g=K3t(i);if(i.some(b=>b.from==b.to||b.from==b.to-1&&r.doc.lineAt(b.from).to==b.from))o.add(p,p,Qt.widget({widget:new W3t(g),diagnostics:i.slice()}));else{let b=i.reduce((y,x)=>x.markClass?y+" "+x.markClass:y,"");o.add(p,h,Qt.mark({class:"cm-lintRange cm-lintRange-"+g+b,diagnostics:i.slice(),inclusiveEnd:i.some(y=>y.to>h)}))}c=h;for(let b=0;b<i.length;b++)i[b].to<=c&&i.splice(b--,1)}let u=o.finish();return new Hb(u,n,aw(u))}}function aw(e,t=null,n=0){let r=null;return e.between(n,1e9,(s,a,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!r)r=new Ive(s,a,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Ive(r.from,a,r.diagnostic)}}),r}function z3t(e,t){let n=t.pos,r=t.end||n,s=e.state.facet(m_).hideOn(e,n,r);if(s!=null)return s;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(p3e))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function B3t(e,t){return e.field(Lc,!1)?t:t.concat(Fn.appendConfig.of(J3t))}const p3e=Fn.define(),kJ=Fn.define(),h3e=Fn.define(),Lc=lo.define({create(){return new Hb(Qt.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,s=e.panel;if(e.selected){let a=t.changes.mapPos(e.selected.from,1);r=aw(n,e.selected.diagnostic,a)||aw(n,null,a)}!n.size&&s&&t.state.facet(m_).autoPanel&&(s=null),e=new Hb(n,s,r)}for(let n of t.effects)if(n.is(p3e)){let r=t.state.facet(m_).autoPanel?n.value.length?g_.open:null:e.panel;e=Hb.init(n.value,r,t.state)}else n.is(kJ)?e=new Hb(e.diagnostics,n.value?g_.open:null,e.selected):n.is(h3e)&&(e=new Hb(e.diagnostics,e.panel,n.value));return e},provide:e=>[r_.from(e,t=>t.panel),it.decorations.from(e,t=>t.diagnostics)]}),U3t=Qt.mark({class:"cm-lintRange cm-lintRange-active"});function q3t(e,t,n){let{diagnostics:r}=e.state.field(Lc),s,a=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return s=d.diagnostics,a=c,o=u,!1});let i=e.state.facet(m_).tooltipFilter;return s&&i&&(s=i(s,e.state)),s?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:V3t(e,s)}}}:null}function V3t(e,t){return zs("ul",{class:"cm-tooltip-lint"},t.map(n=>g3e(e,n,!1)))}const Q3t=e=>{let t=e.state.field(Lc,!1);(!t||!t.panel)&&e.dispatch({effects:B3t(e.state,[kJ.of(!0)])});let n=n_(e,g_.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Pve=e=>{let t=e.state.field(Lc,!1);return!t||!t.panel?!1:(e.dispatch({effects:kJ.of(!1)}),!0)},H3t=e=>{let t=e.state.field(Lc,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},G3t=[{key:"Mod-Shift-m",run:Q3t,preventDefault:!0},{key:"F8",run:H3t}],m_=Lt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...pp(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Mve,tooltipFilter:Mve,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,s,a)=>t(r,s,a)||n(r,s,a):t:n,autoPanel:(t,n)=>t||n})}}});function Mve(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function m3e(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!t.some(a=>a.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function g3e(e,t,n){var r;let s=n?m3e(t.actions):[];return zs("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},zs("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((a,o)=>{let i=!1,c=h=>{if(h.preventDefault(),i)return;i=!0;let g=aw(e.state.field(Lc).diagnostics,t);g&&a.apply(e,g.from,g.to)},{name:u}=a,d=s[o]?u.indexOf(s[o]):-1,f=d<0?u:[u.slice(0,d),zs("u",u.slice(d,d+1)),u.slice(d+1)],p=a.markClass?" "+a.markClass:"";return zs("button",{type:"button",class:"cm-diagnosticAction"+p,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[o]})"`}.`},f)}),t.source&&zs("div",{class:"cm-diagnosticSource"},t.source))}class W3t extends ru{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return zs("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class $ve{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=g3e(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class g_{constructor(t){this.view=t,this.items=[];let n=s=>{if(s.keyCode==27)Pve(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=m3e(a.actions);for(let i=0;i<o.length;i++)if(o[i].toUpperCase().charCodeAt(0)==s.keyCode){let c=aw(this.view.state.field(Lc).diagnostics,a);c&&a.actions[i].apply(t,c.from,c.to)}}else return;s.preventDefault()},r=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=zs("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=zs("div",{class:"cm-panel-lint"},this.list,zs("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Pve(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Lc).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(Lc),r=0,s=!1,a=null,o=new Set;for(t.between(0,this.view.state.doc.length,(i,c,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let f=-1,p;for(let h=r;h<this.items.length;h++)if(this.items[h].diagnostic==d){f=h;break}f<0?(p=new $ve(this.view,d),this.items.splice(r,0,p),s=!0):(p=this.items[f],f>r&&(this.items.splice(r,f-r),s=!0)),n&&p.diagnostic==n.diagnostic?p.dom.hasAttribute("aria-selected")||(p.dom.setAttribute("aria-selected","true"),a=p):p.dom.hasAttribute("aria-selected")&&p.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new $ve(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:i,panel:c})=>{let u=c.height/this.list.offsetHeight;i.top<c.top?this.list.scrollTop-=(c.top-i.top)/u:i.bottom>c.bottom&&(this.list.scrollTop+=(i.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Lc),r=aw(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:h3e.of(r)})}static open(t){return new g_(t)}}function Z3t(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function bj(e){return Z3t(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Y3t=it.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:bj("#d11")},".cm-lintRange-warning":{backgroundImage:bj("orange")},".cm-lintRange-info":{backgroundImage:bj("#999")},".cm-lintRange-hint":{backgroundImage:bj("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function X3t(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function K3t(e){let t="hint",n=1;for(let r of e){let s=X3t(r.severity);s>n&&(n=s,t=r.severity)}return t}const J3t=[Lc,it.decorations.compute([Lc],e=>{let{selected:t,panel:n}=e.field(Lc);return!t||!n||t.from==t.to?Qt.none:Qt.set([U3t.range(t.from,t.to)])}),JPt(q3t,{hideOn:z3t}),Y3t];var Dve=function(t){t===void 0&&(t={});var{crosshairCursor:n=!1}=t,r=[];t.closeBracketsKeymap!==!1&&(r=r.concat(W$t)),t.defaultKeymap!==!1&&(r=r.concat(u3t)),t.searchKeymap!==!1&&(r=r.concat($3t)),t.historyKeymap!==!1&&(r=r.concat(bLt)),t.foldKeymap!==!1&&(r=r.concat(IMt)),t.completionKeymap!==!1&&(r=r.concat(r4e)),t.lintKeymap!==!1&&(r=r.concat(G3t));var s=[];return t.lineNumbers!==!1&&s.push(cMt()),t.highlightActiveLineGutter!==!1&&s.push(fMt()),t.highlightSpecialChars!==!1&&s.push(TPt()),t.history!==!1&&s.push(lLt()),t.foldGutter!==!1&&s.push(DMt()),t.drawSelection!==!1&&s.push(yPt()),t.dropCursor!==!1&&s.push(OPt()),t.allowMultipleSelections!==!1&&s.push(br.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&s.push(_Mt()),t.syntaxHighlighting!==!1&&s.push(_$(BMt,{fallback:!0})),t.bracketMatching!==!1&&s.push(WMt()),t.closeBrackets!==!1&&s.push(V$t()),t.autocompletion!==!1&&s.push(n4e()),t.rectangularSelection!==!1&&s.push(UPt()),n!==!1&&s.push(QPt()),t.highlightActiveLine!==!1&&s.push(PPt()),t.highlightSelectionMatches!==!1&&s.push(b3t()),t.tabSize&&typeof t.tabSize=="number"&&s.push(lS.of(" ".repeat(t.tabSize))),s.concat([iS.of(r.flat())]).filter(Boolean)};const e5t="#e5c07b",Lve="#e06c75",t5t="#56b6c2",n5t="#ffffff",WA="#abb2bf",sG="#7d8799",r5t="#61afef",s5t="#98c379",Fve="#d19a66",a5t="#c678dd",o5t="#21252b",zve="#2c313a",Bve="#282c34",gB="#353a42",i5t="#3E4451",Uve="#528bff",l5t=it.theme({"&":{color:WA,backgroundColor:Bve},".cm-content":{caretColor:Uve},".cm-cursor, .cm-dropCursor":{borderLeftColor:Uve},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:i5t},".cm-panels":{backgroundColor:o5t,color:WA},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Bve,color:sG,border:"none"},".cm-activeLineGutter":{backgroundColor:zve},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:gB},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:gB,borderBottomColor:gB},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:zve,color:WA}}},{dark:!0}),c5t=xv.define([{tag:re.keyword,color:a5t},{tag:[re.name,re.deleted,re.character,re.propertyName,re.macroName],color:Lve},{tag:[re.function(re.variableName),re.labelName],color:r5t},{tag:[re.color,re.constant(re.name),re.standard(re.name)],color:Fve},{tag:[re.definition(re.name),re.separator],color:WA},{tag:[re.typeName,re.className,re.number,re.changed,re.annotation,re.modifier,re.self,re.namespace],color:e5t},{tag:[re.operator,re.operatorKeyword,re.url,re.escape,re.regexp,re.link,re.special(re.string)],color:t5t},{tag:[re.meta,re.comment],color:sG},{tag:re.strong,fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.link,color:sG,textDecoration:"underline"},{tag:re.heading,fontWeight:"bold",color:Lve},{tag:[re.atom,re.bool,re.special(re.variableName)],color:Fve},{tag:[re.processingInstruction,re.string,re.inserted],color:s5t},{tag:re.invalid,color:n5t}]),u5t=[l5t,_$(c5t)];var d5t=it.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),f5t=function(t){t===void 0&&(t={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:a="light",placeholder:o="",basicSetup:i=!0}=t,c=[];switch(n&&c.unshift(iS.of([d3t])),i&&(typeof i=="boolean"?c.unshift(Dve()):c.unshift(Dve(i))),o&&c.unshift(LPt(o)),a){case"light":c.push(d5t);break;case"dark":c.push(u5t);break;case"none":break;default:c.push(a);break}return r===!1&&c.push(it.editable.of(!1)),s&&c.push(br.readOnly.of(!0)),[...c]},p5t=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class h5t{constructor(t,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}let qve=class{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}};var bB=null,m5t=()=>typeof window>"u"?new qve:(bB||(bB=new qve),bB),Vve=fp.define(),g5t=200,b5t=[];function y5t(e){var{value:t,selection:n,onChange:r,onStatistics:s,onCreateEditor:a,onUpdate:o,extensions:i=b5t,autoFocus:c,theme:u="light",height:d=null,minHeight:f=null,maxHeight:p=null,width:h=null,minWidth:g=null,maxWidth:b=null,placeholder:y="",editable:x=!0,readOnly:w=!1,indentWithTab:O=!0,basicSetup:_=!0,root:C,initialState:E}=e,[T,N]=S.useState(),[A,I]=S.useState(),[P,$]=S.useState(),U=S.useState(()=>({current:null}))[0],L=S.useState(()=>({current:null}))[0],B=it.theme({"&":{height:d,minHeight:f,maxHeight:p,width:h,minWidth:g,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),H=it.updateListener.of(W=>{if(W.docChanged&&typeof r=="function"&&!W.transactions.some(z=>z.annotation(Vve))){U.current?U.current.reset():(U.current=new h5t(()=>{if(L.current){var z=L.current;L.current=null,z()}U.current=null},g5t),m5t().add(U.current));var D=W.state.doc,Z=D.toString();r(Z,W)}s&&s(p5t(W))}),q=f5t({theme:u,editable:x,readOnly:w,placeholder:y,indentWithTab:O,basicSetup:_}),V=[H,B,...q];return o&&typeof o=="function"&&V.push(it.updateListener.of(o)),V=V.concat(i),S.useLayoutEffect(()=>{if(T&&!P){var W={doc:t,selection:n,extensions:V},D=E?br.fromJSON(E.json,W,E.fields):br.create(W);if($(D),!A){var Z=new it({state:D,parent:T,root:C});I(Z),a&&a(Z,D)}}return()=>{A&&($(void 0),I(void 0))}},[T,P]),S.useEffect(()=>{e.container&&N(e.container)},[e.container]),S.useEffect(()=>()=>{A&&(A.destroy(),I(void 0)),U.current&&(U.current.cancel(),U.current=null)},[A]),S.useEffect(()=>{c&&A&&A.focus()},[c,A]),S.useEffect(()=>{A&&A.dispatch({effects:Fn.reconfigure.of(V)})},[u,i,d,f,p,h,g,b,y,x,w,O,_,r,o]),S.useEffect(()=>{if(t!==void 0){var W=A?A.state.doc.toString():"";if(A&&t!==W){var D=U.current&&!U.current.isDone,Z=()=>{A&&t!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:t||""},annotations:[Vve.of(!0)]})};D?L.current=Z:Z()}}},[t,A]),{state:P,setState:$,view:A,setView:I,container:T,setContainer:N}}var v5t=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Xc=S.forwardRef((e,t)=>{var{className:n,value:r="",selection:s,extensions:a=[],onChange:o,onStatistics:i,onCreateEditor:c,onUpdate:u,autoFocus:d,theme:f="light",height:p,minHeight:h,maxHeight:g,width:b,minWidth:y,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:_,editable:C,readOnly:E,root:T,initialState:N}=e,A=SX(e,v5t),I=S.useRef(null),{state:P,view:$,container:U,setContainer:L}=y5t({root:T,value:r,autoFocus:d,theme:f,height:p,minHeight:h,maxHeight:g,width:b,minWidth:y,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:_,editable:C,readOnly:E,selection:s,onChange:o,onStatistics:i,onCreateEditor:c,onUpdate:u,extensions:a,initialState:N});S.useImperativeHandle(t,()=>({editor:I.current,state:P,view:$}),[I,U,P,$]);var B=S.useCallback(q=>{I.current=q,L(q)},[L]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var H=typeof f=="string"?"cm-theme-"+f:"cm-theme";return l.jsx("div",Jf({ref:B,className:""+H+(n?" "+n:"")},A))});Xc.displayName="CodeMirror";function x5t(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const w5t=e=>{switch(e){case"success":return k5t;case"info":return E5t;case"warning":return _5t;case"error":return C5t;default:return null}},S5t=Array(12).fill(0),O5t=({visible:e,className:t})=>xe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},xe.createElement("div",{className:"sonner-spinner"},S5t.map((n,r)=>xe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),k5t=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},xe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),_5t=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},xe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),E5t=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},xe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),C5t=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},xe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),T5t=xe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},xe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),xe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),N5t=()=>{const[e,t]=xe.useState(document.hidden);return xe.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let aG=1;class j5t{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,a=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:aG++,o=this.toasts.find(c=>c.id===a),i=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...t,id:a,title:r}),{...c,...t,id:a,dismissible:i,title:r}):c):this.addToast({title:r,...s,dismissible:i,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=r!==void 0,o;const i=s.then(async u=>{if(o=["resolve",u],xe.isValidElement(u))a=!1,this.create({id:r,type:"default",message:u});else if(R5t(u)&&!u.ok){a=!1;const f=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,g=typeof f=="object"&&!xe.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:p,...g})}else if(u instanceof Error){a=!1;const f=typeof n.error=="function"?await n.error(u):n.error,p=typeof n.description=="function"?await n.description(u):n.description,g=typeof f=="object"&&!xe.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:p,...g})}else if(n.success!==void 0){a=!1;const f=typeof n.success=="function"?await n.success(u):n.success,p=typeof n.description=="function"?await n.description(u):n.description,g=typeof f=="object"&&!xe.isValidElement(f)?f:{message:f};this.create({id:r,type:"success",description:p,...g})}}).catch(async u=>{if(o=["reject",u],n.error!==void 0){a=!1;const d=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,h=typeof d=="object"&&!xe.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...h})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,d)=>i.then(()=>o[0]==="reject"?d(o[1]):u(o[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=n?.id||aG++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Rl=new j5t,A5t=(e,t)=>{const n=t?.id||aG++;return Rl.addToast({title:e,...t,id:n}),n},R5t=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",I5t=A5t,P5t=()=>Rl.toasts,M5t=()=>Rl.getActiveToasts(),Di=Object.assign(I5t,{success:Rl.success,info:Rl.info,warning:Rl.warning,error:Rl.error,custom:Rl.custom,message:Rl.message,promise:Rl.promise,dismiss:Rl.dismiss,loading:Rl.loading},{getHistory:P5t,getToasts:M5t});x5t("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function yj(e){return e.label!==void 0}const $5t=3,D5t="24px",L5t="16px",Qve=4e3,F5t=356,z5t=14,B5t=45,U5t=200;function gf(...e){return e.filter(Boolean).join(" ")}function q5t(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const V5t=e=>{var t,n,r,s,a,o,i,c,u;const{invert:d,toast:f,unstyled:p,interacting:h,setHeights:g,visibleToasts:b,heights:y,index:x,toasts:w,expanded:O,removeToast:_,defaultRichColors:C,closeButton:E,style:T,cancelButtonStyle:N,actionButtonStyle:A,className:I="",descriptionClassName:P="",duration:$,position:U,gap:L,expandByDefault:B,classNames:H,icons:q,closeButtonAriaLabel:V="Close toast"}=e,[W,D]=xe.useState(null),[Z,z]=xe.useState(null),[R,Q]=xe.useState(!1),[G,J]=xe.useState(!1),[ee,ne]=xe.useState(!1),[ae,ce]=xe.useState(!1),[ye,Y]=xe.useState(!1),[se,te]=xe.useState(0),[he,le]=xe.useState(0),ge=xe.useRef(f.duration||$||Qve),je=xe.useRef(null),Oe=xe.useRef(null),ie=x===0,de=x+1<=b,pe=f.type,Ce=f.dismissible!==!1,Ee=f.className||"",ve=f.descriptionClassName||"",ue=xe.useMemo(()=>y.findIndex(lt=>lt.toastId===f.id)||0,[y,f.id]),_e=xe.useMemo(()=>{var lt;return(lt=f.closeButton)!=null?lt:E},[f.closeButton,E]),De=xe.useMemo(()=>f.duration||$||Qve,[f.duration,$]),Ke=xe.useRef(0),pt=xe.useRef(0),Et=xe.useRef(0),Ct=xe.useRef(null),[fn,yt]=U.split("-"),dt=xe.useMemo(()=>y.reduce((lt,bn,an)=>an>=ue?lt:lt+bn.height,0),[y,ue]),Ue=N5t(),et=f.invert||d,Ye=pe==="loading";pt.current=xe.useMemo(()=>ue*L+dt,[ue,dt]),xe.useEffect(()=>{ge.current=De},[De]),xe.useEffect(()=>{Q(!0)},[]),xe.useEffect(()=>{const lt=Oe.current;if(lt){const bn=lt.getBoundingClientRect().height;return le(bn),g(an=>[{toastId:f.id,height:bn,position:f.position},...an]),()=>g(an=>an.filter(kn=>kn.toastId!==f.id))}},[g,f.id]),xe.useLayoutEffect(()=>{if(!R)return;const lt=Oe.current,bn=lt.style.height;lt.style.height="auto";const an=lt.getBoundingClientRect().height;lt.style.height=bn,le(an),g(kn=>kn.find(wn=>wn.toastId===f.id)?kn.map(wn=>wn.toastId===f.id?{...wn,height:an}:wn):[{toastId:f.id,height:an,position:f.position},...kn])},[R,f.title,f.description,g,f.id,f.jsx,f.action,f.cancel]);const Ht=xe.useCallback(()=>{J(!0),te(pt.current),g(lt=>lt.filter(bn=>bn.toastId!==f.id)),setTimeout(()=>{_(f)},U5t)},[f,_,g,pt]);xe.useEffect(()=>{if(f.promise&&pe==="loading"||f.duration===1/0||f.type==="loading")return;let lt;return O||h||Ue?(()=>{if(Et.current<Ke.current){const kn=new Date().getTime()-Ke.current;ge.current=ge.current-kn}Et.current=new Date().getTime()})():ge.current!==1/0&&(Ke.current=new Date().getTime(),lt=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),Ht()},ge.current)),()=>clearTimeout(lt)},[O,h,f,pe,Ue,Ht]),xe.useEffect(()=>{f.delete&&(Ht(),f.onDismiss==null||f.onDismiss.call(f,f))},[Ht,f.delete]);function mn(){var lt;if(q?.loading){var bn;return xe.createElement("div",{className:gf(H?.loader,f==null||(bn=f.classNames)==null?void 0:bn.loader,"sonner-loader"),"data-visible":pe==="loading"},q.loading)}return xe.createElement(O5t,{className:gf(H?.loader,f==null||(lt=f.classNames)==null?void 0:lt.loader),visible:pe==="loading"})}const pr=f.icon||q?.[pe]||w5t(pe);var ct,ar;return xe.createElement("li",{tabIndex:0,ref:Oe,className:gf(I,Ee,H?.toast,f==null||(t=f.classNames)==null?void 0:t.toast,H?.default,H?.[pe],f==null||(n=f.classNames)==null?void 0:n[pe]),"data-sonner-toast":"","data-rich-colors":(ct=f.richColors)!=null?ct:C,"data-styled":!(f.jsx||f.unstyled||p),"data-mounted":R,"data-promise":!!f.promise,"data-swiped":ye,"data-removed":G,"data-visible":de,"data-y-position":fn,"data-x-position":yt,"data-index":x,"data-front":ie,"data-swiping":ee,"data-dismissible":Ce,"data-type":pe,"data-invert":et,"data-swipe-out":ae,"data-swipe-direction":Z,"data-expanded":!!(O||B&&R),"data-testid":f.testId,style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${G?se:pt.current}px`,"--initial-height":B?"auto":`${he}px`,...T,...f.style},onDragEnd:()=>{ne(!1),D(null),Ct.current=null},onPointerDown:lt=>{lt.button!==2&&(Ye||!Ce||(je.current=new Date,te(pt.current),lt.target.setPointerCapture(lt.pointerId),lt.target.tagName!=="BUTTON"&&(ne(!0),Ct.current={x:lt.clientX,y:lt.clientY})))},onPointerUp:()=>{var lt,bn,an;if(ae||!Ce)return;Ct.current=null;const kn=Number(((lt=Oe.current)==null?void 0:lt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Kt=Number(((bn=Oe.current)==null?void 0:bn.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),wn=new Date().getTime()-((an=je.current)==null?void 0:an.getTime()),Bt=W==="x"?kn:Kt,pa=Math.abs(Bt)/wn;if(Math.abs(Bt)>=B5t||pa>.11){te(pt.current),f.onDismiss==null||f.onDismiss.call(f,f),z(W==="x"?kn>0?"right":"left":Kt>0?"down":"up"),Ht(),ce(!0);return}else{var fe,Se;(fe=Oe.current)==null||fe.style.setProperty("--swipe-amount-x","0px"),(Se=Oe.current)==null||Se.style.setProperty("--swipe-amount-y","0px")}Y(!1),ne(!1),D(null)},onPointerMove:lt=>{var bn,an,kn;if(!Ct.current||!Ce||((bn=window.getSelection())==null?void 0:bn.toString().length)>0)return;const wn=lt.clientY-Ct.current.y,Bt=lt.clientX-Ct.current.x;var pa;const fe=(pa=e.swipeDirections)!=null?pa:q5t(U);!W&&(Math.abs(Bt)>1||Math.abs(wn)>1)&&D(Math.abs(Bt)>Math.abs(wn)?"x":"y");let Se={x:0,y:0};const Ae=ze=>1/(1.5+Math.abs(ze)/20);if(W==="y"){if(fe.includes("top")||fe.includes("bottom"))if(fe.includes("top")&&wn<0||fe.includes("bottom")&&wn>0)Se.y=wn;else{const ze=wn*Ae(wn);Se.y=Math.abs(ze)<Math.abs(wn)?ze:wn}}else if(W==="x"&&(fe.includes("left")||fe.includes("right")))if(fe.includes("left")&&Bt<0||fe.includes("right")&&Bt>0)Se.x=Bt;else{const ze=Bt*Ae(Bt);Se.x=Math.abs(ze)<Math.abs(Bt)?ze:Bt}(Math.abs(Se.x)>0||Math.abs(Se.y)>0)&&Y(!0),(an=Oe.current)==null||an.style.setProperty("--swipe-amount-x",`${Se.x}px`),(kn=Oe.current)==null||kn.style.setProperty("--swipe-amount-y",`${Se.y}px`)}},_e&&!f.jsx&&pe!=="loading"?xe.createElement("button",{"aria-label":V,"data-disabled":Ye,"data-close-button":!0,onClick:Ye||!Ce?()=>{}:()=>{Ht(),f.onDismiss==null||f.onDismiss.call(f,f)},className:gf(H?.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},(ar=q?.close)!=null?ar:T5t):null,(pe||f.icon||f.promise)&&f.icon!==null&&(q?.[pe]!==null||f.icon)?xe.createElement("div",{"data-icon":"",className:gf(H?.icon,f==null||(s=f.classNames)==null?void 0:s.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||mn():null,f.type!=="loading"?pr:null):null,xe.createElement("div",{"data-content":"",className:gf(H?.content,f==null||(a=f.classNames)==null?void 0:a.content)},xe.createElement("div",{"data-title":"",className:gf(H?.title,f==null||(o=f.classNames)==null?void 0:o.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?xe.createElement("div",{"data-description":"",className:gf(P,ve,H?.description,f==null||(i=f.classNames)==null?void 0:i.description)},typeof f.description=="function"?f.description():f.description):null),xe.isValidElement(f.cancel)?f.cancel:f.cancel&&yj(f.cancel)?xe.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||N,onClick:lt=>{yj(f.cancel)&&Ce&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,lt),Ht())},className:gf(H?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,xe.isValidElement(f.action)?f.action:f.action&&yj(f.action)?xe.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||A,onClick:lt=>{yj(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,lt),!lt.defaultPrevented&&Ht())},className:gf(H?.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function Hve(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Q5t(e,t){const n={};return[e,t].forEach((r,s)=>{const a=s===1,o=a?"--mobile-offset":"--offset",i=a?L5t:D5t;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=i:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(i)}),n}const H5t=xe.forwardRef(function(t,n){const{id:r,invert:s,position:a="bottom-right",hotkey:o=["altKey","KeyT"],expand:i,closeButton:c,className:u,offset:d,mobileOffset:f,theme:p="light",richColors:h,duration:g,style:b,visibleToasts:y=$5t,toastOptions:x,dir:w=Hve(),gap:O=z5t,icons:_,containerAriaLabel:C="Notifications"}=t,[E,T]=xe.useState([]),N=xe.useMemo(()=>r?E.filter(R=>R.toasterId===r):E.filter(R=>!R.toasterId),[E,r]),A=xe.useMemo(()=>Array.from(new Set([a].concat(N.filter(R=>R.position).map(R=>R.position)))),[N,a]),[I,P]=xe.useState([]),[$,U]=xe.useState(!1),[L,B]=xe.useState(!1),[H,q]=xe.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=xe.useRef(null),W=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=xe.useRef(null),Z=xe.useRef(!1),z=xe.useCallback(R=>{T(Q=>{var G;return(G=Q.find(J=>J.id===R.id))!=null&&G.delete||Rl.dismiss(R.id),Q.filter(({id:J})=>J!==R.id)})},[]);return xe.useEffect(()=>Rl.subscribe(R=>{if(R.dismiss){requestAnimationFrame(()=>{T(Q=>Q.map(G=>G.id===R.id?{...G,delete:!0}:G))});return}setTimeout(()=>{RY.flushSync(()=>{T(Q=>{const G=Q.findIndex(J=>J.id===R.id);return G!==-1?[...Q.slice(0,G),{...Q[G],...R},...Q.slice(G+1)]:[R,...Q]})})})}),[E]),xe.useEffect(()=>{if(p!=="system"){q(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:Q})=>{q(Q?"dark":"light")})}catch{R.addListener(({matches:G})=>{try{q(G?"dark":"light")}catch(J){console.error(J)}})}},[p]),xe.useEffect(()=>{E.length<=1&&U(!1)},[E]),xe.useEffect(()=>{const R=Q=>{var G;if(o.every(ne=>Q[ne]||Q.code===ne)){var ee;U(!0),(ee=V.current)==null||ee.focus()}Q.code==="Escape"&&(document.activeElement===V.current||(G=V.current)!=null&&G.contains(document.activeElement))&&U(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[o]),xe.useEffect(()=>{if(V.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,Z.current=!1)}},[V.current]),xe.createElement("section",{ref:n,"aria-label":`${C} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((R,Q)=>{var G;const[J,ee]=R.split("-");return N.length?xe.createElement("ol",{key:R,dir:w==="auto"?Hve():w,tabIndex:-1,ref:V,className:u,"data-sonner-toaster":!0,"data-sonner-theme":H,"data-y-position":J,"data-x-position":ee,style:{"--front-toast-height":`${((G=I[0])==null?void 0:G.height)||0}px`,"--width":`${F5t}px`,"--gap":`${O}px`,...b,...Q5t(d,f)},onBlur:ne=>{Z.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(Z.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||Z.current||(Z.current=!0,D.current=ne.relatedTarget)},onMouseEnter:()=>U(!0),onMouseMove:()=>U(!0),onMouseLeave:()=>{L||U(!1)},onDragEnd:()=>U(!1),onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||B(!0)},onPointerUp:()=>B(!1)},N.filter(ne=>!ne.position&&Q===0||ne.position===R).map((ne,ae)=>{var ce,ye;return xe.createElement(V5t,{key:ne.id,icons:_,index:ae,toast:ne,defaultRichColors:h,duration:(ce=x?.duration)!=null?ce:g,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:s,visibleToasts:y,closeButton:(ye=x?.closeButton)!=null?ye:c,interacting:L,position:R,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:z,toasts:N.filter(Y=>Y.position==ne.position),heights:I.filter(Y=>Y.position==ne.position),setHeights:P,expandByDefault:i,gap:O,expanded:$,swipeDirections:t.swipeDirections})})):null}))});function G5t(e){if(typeof e!="object"||e===null)return String(e);try{const t=JSON.stringify(e);return t==="{}"?String(e):t}catch{return String(e)}}function I$(e,t={}){const n={fallbackMessage:"Unknown error",maxDepth:5,supportSerialization:!0,serializeStack:!0},r=t?{...n,...t}:n,{fallbackMessage:s,maxDepth:a,supportSerialization:o,serializeStack:i}=r;if(e&&e instanceof Error)return o&&oG(e,i,{maxDepth:a}),e;let c;if(e&&typeof e=="object"){const u=e&&"message"in e&&typeof e.message=="string"?e.message:G5t(e),d="cause"in e&&e.cause!==void 0?e.cause instanceof Error?e.cause:a>0?I$(e.cause,{...r,maxDepth:a-1}):void 0:void 0;c=new Error(u,d?{cause:d}:void 0),Object.assign(c,e),c.stack="stack"in e&&typeof e.stack=="string"?e.stack:void 0}else e&&typeof e=="string"?(c=new Error(e),c.stack=void 0):c=new Error(s);return o&&oG(c,i,{maxDepth:a}),c}var W5t=5;function oG(e,t=!0,n){const r=n?.maxDepth??W5t,s=n?.currentDepth??0;e.toJSON||(e.cause instanceof Error&&s<r&&oG(e.cause,t,{maxDepth:r,currentDepth:s+1}),Object.defineProperty(e,"toJSON",{value:function(){const a={message:this.message,name:this.name};t&&this.stack!==void 0&&(a.stack=this.stack),this.cause!==void 0&&(this.cause instanceof Error&&"toJSON"in this.cause&&typeof this.cause.toJSON=="function"?a.cause=this.cause.toJSON():a.cause=this.cause);const o=this;for(const i in o)o.hasOwnProperty(i)&&!(i in a)&&i!=="toJSON"&&(a[i]=o[i]);return a},enumerable:!1,writable:!0,configurable:!0}))}var Z5t=class extends Error{id;domain;category;details={};message;cause;constructor(e,t){const n=t?I$(t,{serializeStack:!1,fallbackMessage:"Unknown error"}):void 0,r=e.text??n?.message??"Unknown error";super(r,{cause:n}),this.id=e.id,this.domain=e.domain,this.category=e.category,this.details=e.details??{},this.message=r,this.cause=n,Object.setPrototypeOf(this,new.target.prototype)}toJSONDetails(){return{message:this.message,domain:this.domain,category:this.category,details:this.details}}toJSON(){return{message:this.message,domain:this.domain,category:this.category,code:this.id,details:this.details,cause:this.cause?.toJSON?.()}}toString(){return JSON.stringify(this.toJSON())}},Ly=class extends Z5t{},Y5t="ai-sdk",X5t=class{#e;"~standard";constructor(e){this.#e=e,this["~standard"]={version:1,vendor:Y5t,validate:this.#t.bind(this),jsonSchema:{input:this.#s.bind(this),output:this.#s.bind(this)}}}#t(e){if(!this.#e.validate)return{value:e};try{const t=this.#e.validate(e);return t&&typeof t=="object"&&"then"in t&&typeof t.then=="function"?Promise.resolve(t).then(n=>this.#n(n)).catch(n=>({issues:[{message:`Schema validation error: ${n instanceof Error?n.message:"Unknown validation error"}`}]})):this.#n(t)}catch(t){return{issues:[{message:`Schema validation error: ${t instanceof Error?t.message:"Unknown validation error"}`}]}}}#n(e){return e.success?{value:e.value}:{issues:[{message:e.error.message}]}}#s(e){const{target:t}=e,n=JSON.parse(JSON.stringify(this.#e.jsonSchema));if(!n.$schema)switch(t){case"draft-07":n.$schema="http://json-schema.org/draft-07/schema#";break;case"draft-2020-12":n.$schema="https://json-schema.org/draft/2020-12/schema";break}return n}getSchema(){return this.#e}getJsonSchema(){return this.#e.jsonSchema}};function K5t(e){return new X5t(e)}var J5t=Object.create,b3e=Object.defineProperty,e6t=Object.getOwnPropertyDescriptor,y3e=Object.getOwnPropertyNames,t6t=Object.getPrototypeOf,n6t=Object.prototype.hasOwnProperty,Gve=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Zt=(e,t)=>function(){return t||(0,e[y3e(e)[0]])((t={exports:{}}).exports,t),t.exports},r6t=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of y3e(t))!n6t.call(e,s)&&s!==n&&b3e(e,s,{get:()=>t[s],enumerable:!(r=e6t(t,s))||r.enumerable});return e},_J=(e,t,n)=>(n=e!=null?J5t(t6t(e)):{},r6t(b3e(n,"default",{value:e,enumerable:!0}),e)),EJ=Zt({"../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(e,t){var n=t.exports=function(a,o,i){typeof o=="function"&&(i=o,o={}),i=o.cb||i;var c=typeof i=="function"?i:i.pre||function(){},u=i.post||function(){};r(o,c,u,a,"",a)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(a,o,i,c,u,d,f,p,h,g){if(c&&typeof c=="object"&&!Array.isArray(c)){o(c,u,d,f,p,h,g);for(var b in c){var y=c[b];if(Array.isArray(y)){if(b in n.arrayKeywords)for(var x=0;x<y.length;x++)r(a,o,i,y[x],u+"/"+b+"/"+x,d,u,b,c,x)}else if(b in n.propsKeywords){if(y&&typeof y=="object")for(var w in y)r(a,o,i,y[w],u+"/"+b+"/"+s(w),d,u,b,c,w)}else(b in n.keywords||a.allKeys&&!(b in n.skipKeywords))&&r(a,o,i,y,u+"/"+b,d,u,b,c)}i(c,u,d,f,p,h,g)}}function s(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}}}),kI=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(x){if(super(),!e.IDENTIFIER.test(x))throw new Error("CodeGen: name must be a valid identifier");this.str=x}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(x){super(),this._items=typeof x=="string"?[x]:x}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const x=this._items[0];return x===""||x==='""'}get str(){var x;return(x=this._str)!==null&&x!==void 0?x:this._str=this._items.reduce((w,O)=>`${w}${O}`,"")}get names(){var x;return(x=this._names)!==null&&x!==void 0?x:this._names=this._items.reduce((w,O)=>(O instanceof n&&(w[O.str]=(w[O.str]||0)+1),w),{})}};e._Code=r,e.nil=new r("");function s(x,...w){const O=[x[0]];let _=0;for(;_<w.length;)i(O,w[_]),O.push(x[++_]);return new r(O)}e._=s;var a=new r("+");function o(x,...w){const O=[h(x[0])];let _=0;for(;_<w.length;)O.push(a),i(O,w[_]),O.push(a,h(x[++_]));return c(O),new r(O)}e.str=o;function i(x,w){w instanceof r?x.push(...w._items):w instanceof n?x.push(w):x.push(f(w))}e.addCodeArg=i;function c(x){let w=1;for(;w<x.length-1;){if(x[w]===a){const O=u(x[w-1],x[w+1]);if(O!==void 0){x.splice(w-1,3,O);continue}x[w++]="+"}w++}}function u(x,w){if(w==='""')return x;if(x==='""')return w;if(typeof x=="string")return w instanceof n||x[x.length-1]!=='"'?void 0:typeof w!="string"?`${x.slice(0,-1)}${w}"`:w[0]==='"'?x.slice(0,-1)+w.slice(1):void 0;if(typeof w=="string"&&w[0]==='"'&&!(x instanceof n))return`"${x}${w.slice(1)}`}function d(x,w){return w.emptyStr()?x:x.emptyStr()?w:o`${x}${w}`}e.strConcat=d;function f(x){return typeof x=="number"||typeof x=="boolean"||x===null?x:h(Array.isArray(x)?x.join(","):x)}function p(x){return new r(h(x))}e.stringify=p;function h(x){return JSON.stringify(x).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function g(x){return typeof x=="string"&&e.IDENTIFIER.test(x)?new r(`.${x}`):s`[${x}]`}e.getProperty=g;function b(x){if(typeof x=="string"&&e.IDENTIFIER.test(x))return new r(`${x}`);throw new Error(`CodeGen: invalid export name: ${x}, use explicit $id name mapping`)}e.getEsmExportName=b;function y(x){return new r(x.toString())}e.regexpCode=y}}),Wve=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=kI(),n=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}},r;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var s=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=s;var a=class extends t.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,t._)`.${new t.Name(u)}[${d}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`,i=class extends s{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?o:t.nil}}get(){return this._scope}name(c){return new a(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const f=this.toName(c),{prefix:p}=f,h=(d=u.key)!==null&&d!==void 0?d:u.ref;let g=this._values[p];if(g){const x=g.get(h);if(x)return x}else g=this._values[p]=new Map;g.set(h,f);const b=this._scope[p]||(this._scope[p]=[]),y=b.length;return b[y]=u.ref,f.setValue(u,{property:p,itemIndex:y}),f}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,t._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,f=>{if(f.value===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return f.value.code},u,d)}_reduceValues(c,u,d={},f){let p=t.nil;for(const h in c){const g=c[h];if(!g)continue;const b=d[h]=d[h]||new Map;g.forEach(y=>{if(b.has(y))return;b.set(y,r.Started);let x=u(y);if(x){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;p=(0,t._)`${p}${w} ${y} = ${x};${this.opts._n}`}else if(x=f?.(y))p=(0,t._)`${p}${x}${this.opts._n}`;else throw new n(y);b.set(y,r.Completed)})}return p}};e.ValueScope=i}}),Cr=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=kI(),n=Wve(),r=kI();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var s=Wve();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var a=class{optimizeNodes(){return this}optimizeNames(R,Q){return this}},o=class extends a{constructor(R,Q,G){super(),this.varKind=R,this.name=Q,this.rhs=G}render({es5:R,_n:Q}){const G=R?n.varKinds.var:this.varKind,J=this.rhs===void 0?"":` = ${this.rhs}`;return`${G} ${this.name}${J};`+Q}optimizeNames(R,Q){if(R[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,R,Q)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},i=class extends a{constructor(R,Q,G){super(),this.lhs=R,this.rhs=Q,this.sideEffects=G}render({_n:R}){return`${this.lhs} = ${this.rhs};`+R}optimizeNames(R,Q){if(!(this.lhs instanceof t.Name&&!R[this.lhs.str]&&!this.sideEffects))return this.rhs=L(this.rhs,R,Q),this}get names(){const R=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(R,this.rhs)}},c=class extends i{constructor(R,Q,G,J){super(R,G,J),this.op=Q}render({_n:R}){return`${this.lhs} ${this.op}= ${this.rhs};`+R}},u=class extends a{constructor(R){super(),this.label=R,this.names={}}render({_n:R}){return`${this.label}:`+R}},d=class extends a{constructor(R){super(),this.label=R,this.names={}}render({_n:R}){return`break${this.label?` ${this.label}`:""};`+R}},f=class extends a{constructor(R){super(),this.error=R}render({_n:R}){return`throw ${this.error};`+R}get names(){return this.error.names}},p=class extends a{constructor(R){super(),this.code=R}render({_n:R}){return`${this.code};`+R}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(R,Q){return this.code=L(this.code,R,Q),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},h=class extends a{constructor(R=[]){super(),this.nodes=R}render(R){return this.nodes.reduce((Q,G)=>Q+G.render(R),"")}optimizeNodes(){const{nodes:R}=this;let Q=R.length;for(;Q--;){const G=R[Q].optimizeNodes();Array.isArray(G)?R.splice(Q,1,...G):G?R[Q]=G:R.splice(Q,1)}return R.length>0?this:void 0}optimizeNames(R,Q){const{nodes:G}=this;let J=G.length;for(;J--;){const ee=G[J];ee.optimizeNames(R,Q)||(B(R,ee.names),G.splice(J,1))}return G.length>0?this:void 0}get names(){return this.nodes.reduce((R,Q)=>$(R,Q.names),{})}},g=class extends h{render(R){return"{"+R._n+super.render(R)+"}"+R._n}},b=class extends h{},y=class extends g{};y.kind="else";var x=class ZA extends g{constructor(Q,G){super(G),this.condition=Q}render(Q){let G=`if(${this.condition})`+super.render(Q);return this.else&&(G+="else "+this.else.render(Q)),G}optimizeNodes(){super.optimizeNodes();const Q=this.condition;if(Q===!0)return this.nodes;let G=this.else;if(G){const J=G.optimizeNodes();G=this.else=Array.isArray(J)?new y(J):J}if(G)return Q===!1?G instanceof ZA?G:G.nodes:this.nodes.length?this:new ZA(H(Q),G instanceof ZA?[G]:G.nodes);if(!(Q===!1||!this.nodes.length))return this}optimizeNames(Q,G){var J;if(this.else=(J=this.else)===null||J===void 0?void 0:J.optimizeNames(Q,G),!!(super.optimizeNames(Q,G)||this.else))return this.condition=L(this.condition,Q,G),this}get names(){const Q=super.names;return U(Q,this.condition),this.else&&$(Q,this.else.names),Q}};x.kind="if";var w=class extends g{};w.kind="for";var O=class extends w{constructor(R){super(),this.iteration=R}render(R){return`for(${this.iteration})`+super.render(R)}optimizeNames(R,Q){if(super.optimizeNames(R,Q))return this.iteration=L(this.iteration,R,Q),this}get names(){return $(super.names,this.iteration.names)}},_=class extends w{constructor(R,Q,G,J){super(),this.varKind=R,this.name=Q,this.from=G,this.to=J}render(R){const Q=R.es5?n.varKinds.var:this.varKind,{name:G,from:J,to:ee}=this;return`for(${Q} ${G}=${J}; ${G}<${ee}; ${G}++)`+super.render(R)}get names(){const R=U(super.names,this.from);return U(R,this.to)}},C=class extends w{constructor(R,Q,G,J){super(),this.loop=R,this.varKind=Q,this.name=G,this.iterable=J}render(R){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(R)}optimizeNames(R,Q){if(super.optimizeNames(R,Q))return this.iterable=L(this.iterable,R,Q),this}get names(){return $(super.names,this.iterable.names)}},E=class extends g{constructor(R,Q,G){super(),this.name=R,this.args=Q,this.async=G}render(R){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(R)}};E.kind="func";var T=class extends h{render(R){return"return "+super.render(R)}};T.kind="return";var N=class extends g{render(R){let Q="try"+super.render(R);return this.catch&&(Q+=this.catch.render(R)),this.finally&&(Q+=this.finally.render(R)),Q}optimizeNodes(){var R,Q;return super.optimizeNodes(),(R=this.catch)===null||R===void 0||R.optimizeNodes(),(Q=this.finally)===null||Q===void 0||Q.optimizeNodes(),this}optimizeNames(R,Q){var G,J;return super.optimizeNames(R,Q),(G=this.catch)===null||G===void 0||G.optimizeNames(R,Q),(J=this.finally)===null||J===void 0||J.optimizeNames(R,Q),this}get names(){const R=super.names;return this.catch&&$(R,this.catch.names),this.finally&&$(R,this.finally.names),R}},A=class extends g{constructor(R){super(),this.error=R}render(R){return`catch(${this.error})`+super.render(R)}};A.kind="catch";var I=class extends g{render(R){return"finally"+super.render(R)}};I.kind="finally";var P=class{constructor(R,Q={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Q,_n:Q.lines?`
|
|
133
133
|
`:""},this._extScope=R,this._scope=new n.Scope({parent:R}),this._nodes=[new b]}toString(){return this._root.render(this.opts)}name(R){return this._scope.name(R)}scopeName(R){return this._extScope.name(R)}scopeValue(R,Q){const G=this._extScope.value(R,Q);return(this._values[G.prefix]||(this._values[G.prefix]=new Set)).add(G),G}getScopeValue(R,Q){return this._extScope.getValue(R,Q)}scopeRefs(R){return this._extScope.scopeRefs(R,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(R,Q,G,J){const ee=this._scope.toName(Q);return G!==void 0&&J&&(this._constants[ee.str]=G),this._leafNode(new o(R,ee,G)),ee}const(R,Q,G){return this._def(n.varKinds.const,R,Q,G)}let(R,Q,G){return this._def(n.varKinds.let,R,Q,G)}var(R,Q,G){return this._def(n.varKinds.var,R,Q,G)}assign(R,Q,G){return this._leafNode(new i(R,Q,G))}add(R,Q){return this._leafNode(new c(R,e.operators.ADD,Q))}code(R){return typeof R=="function"?R():R!==t.nil&&this._leafNode(new p(R)),this}object(...R){const Q=["{"];for(const[G,J]of R)Q.length>1&&Q.push(","),Q.push(G),(G!==J||this.opts.es5)&&(Q.push(":"),(0,t.addCodeArg)(Q,J));return Q.push("}"),new t._Code(Q)}if(R,Q,G){if(this._blockNode(new x(R)),Q&&G)this.code(Q).else().code(G).endIf();else if(Q)this.code(Q).endIf();else if(G)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(R){return this._elseNode(new x(R))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(x,y)}_for(R,Q){return this._blockNode(R),Q&&this.code(Q).endFor(),this}for(R,Q){return this._for(new O(R),Q)}forRange(R,Q,G,J,ee=this.opts.es5?n.varKinds.var:n.varKinds.let){const ne=this._scope.toName(R);return this._for(new _(ee,ne,Q,G),()=>J(ne))}forOf(R,Q,G,J=n.varKinds.const){const ee=this._scope.toName(R);if(this.opts.es5){const ne=Q instanceof t.Name?Q:this.var("_arr",Q);return this.forRange("_i",0,(0,t._)`${ne}.length`,ae=>{this.var(ee,(0,t._)`${ne}[${ae}]`),G(ee)})}return this._for(new C("of",J,ee,Q),()=>G(ee))}forIn(R,Q,G,J=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(R,(0,t._)`Object.keys(${Q})`,G);const ee=this._scope.toName(R);return this._for(new C("in",J,ee,Q),()=>G(ee))}endFor(){return this._endBlockNode(w)}label(R){return this._leafNode(new u(R))}break(R){return this._leafNode(new d(R))}return(R){const Q=new T;if(this._blockNode(Q),this.code(R),Q.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(T)}try(R,Q,G){if(!Q&&!G)throw new Error('CodeGen: "try" without "catch" and "finally"');const J=new N;if(this._blockNode(J),this.code(R),Q){const ee=this.name("e");this._currNode=J.catch=new A(ee),Q(ee)}return G&&(this._currNode=J.finally=new I,this.code(G)),this._endBlockNode(A,I)}throw(R){return this._leafNode(new f(R))}block(R,Q){return this._blockStarts.push(this._nodes.length),R&&this.code(R).endBlock(Q),this}endBlock(R){const Q=this._blockStarts.pop();if(Q===void 0)throw new Error("CodeGen: not in self-balancing block");const G=this._nodes.length-Q;if(G<0||R!==void 0&&G!==R)throw new Error(`CodeGen: wrong number of nodes: ${G} vs ${R} expected`);return this._nodes.length=Q,this}func(R,Q=t.nil,G,J){return this._blockNode(new E(R,Q,G)),J&&this.code(J).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(R=1){for(;R-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(R){return this._currNode.nodes.push(R),this}_blockNode(R){this._currNode.nodes.push(R),this._nodes.push(R)}_endBlockNode(R,Q){const G=this._currNode;if(G instanceof R||Q&&G instanceof Q)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${Q?`${R.kind}/${Q.kind}`:R.kind}"`)}_elseNode(R){const Q=this._currNode;if(!(Q instanceof x))throw new Error('CodeGen: "else" without "if"');return this._currNode=Q.else=R,this}get _root(){return this._nodes[0]}get _currNode(){const R=this._nodes;return R[R.length-1]}set _currNode(R){const Q=this._nodes;Q[Q.length-1]=R}};e.CodeGen=P;function $(R,Q){for(const G in Q)R[G]=(R[G]||0)+(Q[G]||0);return R}function U(R,Q){return Q instanceof t._CodeOrName?$(R,Q.names):R}function L(R,Q,G){if(R instanceof t.Name)return J(R);if(!ee(R))return R;return new t._Code(R._items.reduce((ne,ae)=>(ae instanceof t.Name&&(ae=J(ae)),ae instanceof t._Code?ne.push(...ae._items):ne.push(ae),ne),[]));function J(ne){const ae=G[ne.str];return ae===void 0||Q[ne.str]!==1?ne:(delete Q[ne.str],ae)}function ee(ne){return ne instanceof t._Code&&ne._items.some(ae=>ae instanceof t.Name&&Q[ae.str]===1&&G[ae.str]!==void 0)}}function B(R,Q){for(const G in Q)R[G]=(R[G]||0)-(Q[G]||0)}function H(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:(0,t._)`!${z(R)}`}e.not=H;var q=Z(e.operators.AND);function V(...R){return R.reduce(q)}e.and=V;var W=Z(e.operators.OR);function D(...R){return R.reduce(W)}e.or=D;function Z(R){return(Q,G)=>Q===t.nil?G:G===t.nil?Q:(0,t._)`${z(Q)} ${R} ${z(G)}`}function z(R){return R instanceof t.Name?R:(0,t._)`(${R})`}}}),Xr=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Cr(),n=kI();function r(E){const T={};for(const N of E)T[N]=!0;return T}e.toHash=r;function s(E,T){return typeof T=="boolean"?T:Object.keys(T).length===0?!0:(a(E,T),!o(T,E.self.RULES.all))}e.alwaysValidSchema=s;function a(E,T=E.schema){const{opts:N,self:A}=E;if(!N.strictSchema||typeof T=="boolean")return;const I=A.RULES.keywords;for(const P in T)I[P]||C(E,`unknown keyword: "${P}"`)}e.checkUnknownRules=a;function o(E,T){if(typeof E=="boolean")return!E;for(const N in E)if(T[N])return!0;return!1}e.schemaHasRules=o;function i(E,T){if(typeof E=="boolean")return!E;for(const N in E)if(N!=="$ref"&&T.all[N])return!0;return!1}e.schemaHasRulesButRef=i;function c({topSchemaRef:E,schemaPath:T},N,A,I){if(!I){if(typeof N=="number"||typeof N=="boolean")return N;if(typeof N=="string")return(0,t._)`${N}`}return(0,t._)`${E}${T}${(0,t.getProperty)(A)}`}e.schemaRefOrVal=c;function u(E){return p(decodeURIComponent(E))}e.unescapeFragment=u;function d(E){return encodeURIComponent(f(E))}e.escapeFragment=d;function f(E){return typeof E=="number"?`${E}`:E.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=f;function p(E){return E.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function h(E,T){if(Array.isArray(E))for(const N of E)T(N);else T(E)}e.eachItem=h;function g({mergeNames:E,mergeToName:T,mergeValues:N,resultToName:A}){return(I,P,$,U)=>{const L=$===void 0?P:$ instanceof t.Name?(P instanceof t.Name?E(I,P,$):T(I,P,$),$):P instanceof t.Name?(T(I,$,P),P):N(P,$);return U===t.Name&&!(L instanceof t.Name)?A(I,L):L}}e.mergeEvaluated={props:g({mergeNames:(E,T,N)=>E.if((0,t._)`${N} !== true && ${T} !== undefined`,()=>{E.if((0,t._)`${T} === true`,()=>E.assign(N,!0),()=>E.assign(N,(0,t._)`${N} || {}`).code((0,t._)`Object.assign(${N}, ${T})`))}),mergeToName:(E,T,N)=>E.if((0,t._)`${N} !== true`,()=>{T===!0?E.assign(N,!0):(E.assign(N,(0,t._)`${N} || {}`),y(E,N,T))}),mergeValues:(E,T)=>E===!0?!0:{...E,...T},resultToName:b}),items:g({mergeNames:(E,T,N)=>E.if((0,t._)`${N} !== true && ${T} !== undefined`,()=>E.assign(N,(0,t._)`${T} === true ? true : ${N} > ${T} ? ${N} : ${T}`)),mergeToName:(E,T,N)=>E.if((0,t._)`${N} !== true`,()=>E.assign(N,T===!0?!0:(0,t._)`${N} > ${T} ? ${N} : ${T}`)),mergeValues:(E,T)=>E===!0?!0:Math.max(E,T),resultToName:(E,T)=>E.var("items",T)})};function b(E,T){if(T===!0)return E.var("props",!0);const N=E.var("props",(0,t._)`{}`);return T!==void 0&&y(E,N,T),N}e.evaluatedPropsToName=b;function y(E,T,N){Object.keys(N).forEach(A=>E.assign((0,t._)`${T}${(0,t.getProperty)(A)}`,!0))}e.setEvaluated=y;var x={};function w(E,T){return E.scopeValue("func",{ref:T,code:x[T.code]||(x[T.code]=new n._Code(T.code))})}e.useFunc=w;var O;(function(E){E[E.Num=0]="Num",E[E.Str=1]="Str"})(O||(e.Type=O={}));function _(E,T,N){if(E instanceof t.Name){const A=T===O.Num;return N?A?(0,t._)`"[" + ${E} + "]"`:(0,t._)`"['" + ${E} + "']"`:A?(0,t._)`"/" + ${E}`:(0,t._)`"/" + ${E}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return N?(0,t.getProperty)(E).toString():"/"+f(E)}e.getErrorPath=_;function C(E,T,N=E.opts.strictSchema){if(N){if(T=`strict mode: ${T}`,N===!0)throw new Error(T);E.self.logger.warn(T)}}e.checkStrictMode=C}}),Hg=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js"(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Cr(),n={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=n}}),P$=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Cr(),n=Xr(),r=Hg();e.keywordError={message:({keyword:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:x})=>x?(0,t.str)`"${y}" keyword must be ${x} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function s(y,x=e.keywordError,w,O){const{it:_}=y,{gen:C,compositeRule:E,allErrors:T}=_,N=f(y,x,w);O??(E||T)?c(C,N):u(_,(0,t._)`[${N}]`)}e.reportError=s;function a(y,x=e.keywordError,w){const{it:O}=y,{gen:_,compositeRule:C,allErrors:E}=O,T=f(y,x,w);c(_,T),C||E||u(O,r.default.vErrors)}e.reportExtraError=a;function o(y,x){y.assign(r.default.errors,x),y.if((0,t._)`${r.default.vErrors} !== null`,()=>y.if(x,()=>y.assign((0,t._)`${r.default.vErrors}.length`,x),()=>y.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function i({gen:y,keyword:x,schemaValue:w,data:O,errsCount:_,it:C}){if(_===void 0)throw new Error("ajv implementation error");const E=y.name("err");y.forRange("i",_,r.default.errors,T=>{y.const(E,(0,t._)`${r.default.vErrors}[${T}]`),y.if((0,t._)`${E}.instancePath === undefined`,()=>y.assign((0,t._)`${E}.instancePath`,(0,t.strConcat)(r.default.instancePath,C.errorPath))),y.assign((0,t._)`${E}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${x}`),C.opts.verbose&&(y.assign((0,t._)`${E}.schema`,w),y.assign((0,t._)`${E}.data`,O))})}e.extendErrors=i;function c(y,x){const w=y.const("err",x);y.if((0,t._)`${r.default.vErrors} === null`,()=>y.assign(r.default.vErrors,(0,t._)`[${w}]`),(0,t._)`${r.default.vErrors}.push(${w})`),y.code((0,t._)`${r.default.errors}++`)}function u(y,x){const{gen:w,validateName:O,schemaEnv:_}=y;_.$async?w.throw((0,t._)`new ${y.ValidationError}(${x})`):(w.assign((0,t._)`${O}.errors`,x),w.return(!1))}var d={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(y,x,w){const{createErrors:O}=y.it;return O===!1?(0,t._)`{}`:p(y,x,w)}function p(y,x,w={}){const{gen:O,it:_}=y,C=[h(_,w),g(y,w)];return b(y,x,C),O.object(...C)}function h({errorPath:y},{instancePath:x}){const w=x?(0,t.str)`${y}${(0,n.getErrorPath)(x,n.Type.Str)}`:y;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,w)]}function g({keyword:y,it:{errSchemaPath:x}},{schemaPath:w,parentSchema:O}){let _=O?x:(0,t.str)`${x}/${y}`;return w&&(_=(0,t.str)`${_}${(0,n.getErrorPath)(w,n.Type.Str)}`),[d.schemaPath,_]}function b(y,{params:x,message:w},O){const{keyword:_,data:C,schemaValue:E,it:T}=y,{opts:N,propertyName:A,topSchemaRef:I,schemaPath:P}=T;O.push([d.keyword,_],[d.params,typeof x=="function"?x(y):x||(0,t._)`{}`]),N.messages&&O.push([d.message,typeof w=="function"?w(y):w]),N.verbose&&O.push([d.schema,E],[d.parentSchema,(0,t._)`${I}${P}`],[r.default.data,C]),A&&O.push([d.propertyName,A])}}}),s6t=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=P$(),n=Cr(),r=Hg(),s={message:"boolean schema is false"};function a(c){const{gen:u,schema:d,validateName:f}=c;d===!1?i(c,!1):typeof d=="object"&&d.$async===!0?u.return(r.default.data):(u.assign((0,n._)`${f}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=a;function o(c,u){const{gen:d,schema:f}=c;f===!1?(d.var(u,!1),i(c)):d.var(u,!0)}e.boolOrEmptySchema=o;function i(c,u){const{gen:d,data:f}=c,p={gen:d,keyword:"false schema",data:f,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(p,s,void 0,u)}}}),v3e=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=["string","number","integer","boolean","null","object","array"],n=new Set(t);function r(a){return typeof a=="string"&&n.has(a)}e.isJSONType=r;function s(){const a={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...a,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},a.number,a.string,a.array,a.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=s}}),x3e=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:s,self:a},o){const i=a.RULES.types[o];return i&&i!==!0&&n(s,i)}e.schemaHasRulesForType=t;function n(s,a){return a.rules.some(o=>r(s,o))}e.shouldUseGroup=n;function r(s,a){var o;return s[a.keyword]!==void 0||((o=a.definition.implements)===null||o===void 0?void 0:o.some(i=>s[i]!==void 0))}e.shouldUseRule=r}}),_I=Zt({"../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=v3e(),n=x3e(),r=P$(),s=Cr(),a=Xr(),o;(function(O){O[O.Correct=0]="Correct",O[O.Wrong=1]="Wrong"})(o||(e.DataType=o={}));function i(O){const _=c(O.type);if(_.includes("null")){if(O.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!_.length&&O.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');O.nullable===!0&&_.push("null")}return _}e.getSchemaTypes=i;function c(O){const _=Array.isArray(O)?O:O?[O]:[];if(_.every(t.isJSONType))return _;throw new Error("type must be JSONType or JSONType[]: "+_.join(","))}e.getJSONTypes=c;function u(O,_){const{gen:C,data:E,opts:T}=O,N=f(_,T.coerceTypes),A=_.length>0&&!(N.length===0&&_.length===1&&(0,n.schemaHasRulesForType)(O,_[0]));if(A){const I=b(_,E,T.strictNumbers,o.Wrong);C.if(I,()=>{N.length?p(O,_,N):x(O)})}return A}e.coerceAndCheckDataType=u;var d=new Set(["string","number","integer","boolean","null"]);function f(O,_){return _?O.filter(C=>d.has(C)||_==="array"&&C==="array"):[]}function p(O,_,C){const{gen:E,data:T,opts:N}=O,A=E.let("dataType",(0,s._)`typeof ${T}`),I=E.let("coerced",(0,s._)`undefined`);N.coerceTypes==="array"&&E.if((0,s._)`${A} == 'object' && Array.isArray(${T}) && ${T}.length == 1`,()=>E.assign(T,(0,s._)`${T}[0]`).assign(A,(0,s._)`typeof ${T}`).if(b(_,T,N.strictNumbers),()=>E.assign(I,T))),E.if((0,s._)`${I} !== undefined`);for(const $ of C)(d.has($)||$==="array"&&N.coerceTypes==="array")&&P($);E.else(),x(O),E.endIf(),E.if((0,s._)`${I} !== undefined`,()=>{E.assign(T,I),h(O,I)});function P($){switch($){case"string":E.elseIf((0,s._)`${A} == "number" || ${A} == "boolean"`).assign(I,(0,s._)`"" + ${T}`).elseIf((0,s._)`${T} === null`).assign(I,(0,s._)`""`);return;case"number":E.elseIf((0,s._)`${A} == "boolean" || ${T} === null
|
|
134
134
|
|| (${A} == "string" && ${T} && ${T} == +${T})`).assign(I,(0,s._)`+${T}`);return;case"integer":E.elseIf((0,s._)`${A} === "boolean" || ${T} === null
|
|
@@ -340,7 +340,7 @@ Error message: ${Lne(n)}`,cause:n}),this[BQe]=!0,this.value=t}static isInstance(
|
|
|
340
340
|
]))`;continue}else if(s[u]==="$"){a+=`($|(?=[\r
|
|
341
341
|
]))`;continue}}if(r.s&&s[u]==="."){a+=i?`${s[u]}\r
|
|
342
342
|
`:`[${s[u]}\r
|
|
343
|
-
]`;continue}a+=s[u],s[u]==="\\"?o=!0:i&&s[u]==="]"?i=!1:!i&&s[u]==="["&&(i=!0)}return a}function ZQe(e,t){var n,r,s,a,o,i;const c={type:"object",additionalProperties:(n=ks(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===Pe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=WQe(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Pe.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&((i=e.keyType._def.type._def.checks)!=null&&i.length)){const{type:u,...d}=HQe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function qcn(e,t){if(t.mapStrategy==="record")return ZQe(e,t);const n=ks(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Jc(),r=ks(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Jc();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function Vcn(e){const t=e.values,r=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(r.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r}}function Qcn(){return{not:Jc()}}function Hcn(){return{type:"null"}}var UW={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Gcn(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in UW&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((s,a)=>{const o=UW[a._def.typeName];return o&&!s.includes(o)?[...s,o]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((s,a)=>{const o=typeof a._def.value;switch(o){case"string":case"number":case"boolean":return[...s,o];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(r.length===n.length){const s=r.filter((a,o,i)=>i.indexOf(a)===o);return{type:s.length>1?s:s[0],enum:n.reduce((a,o)=>a.includes(o._def.value)?a:[...a,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(a=>!r.includes(a))],[])};return Wcn(e,t)}var Wcn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>ks(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function Zcn(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[UW[e.innerType._def.typeName],"null"]};const n=ks(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Ycn(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function Xcn(e,t){const n={type:"object",properties:{}},r=[],s=e.shape();for(const o in s){let i=s[o];if(i===void 0||i._def===void 0)continue;const c=Jcn(i),u=ks(i._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});u!==void 0&&(n.properties[o]=u,c||r.push(o))}r.length&&(n.required=r);const a=Kcn(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Kcn(e,t){if(e.catchall._def.typeName!=="ZodNever")return ks(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Jcn(e){try{return e.isOptional()}catch{return!0}}var eun=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return ks(e.innerType._def,t);const r=ks(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Jc()},r]}:Jc()},tun=(e,t)=>{if(t.pipeStrategy==="input")return ks(e.in._def,t);if(t.pipeStrategy==="output")return ks(e.out._def,t);const n=ks(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ks(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(s=>s!==void 0)}};function nun(e,t){return ks(e.type._def,t)}function run(e,t){const r={type:"array",uniqueItems:!0,items:ks(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function sun(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>ks(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ks(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>ks(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function aun(){return{not:Jc()}}function oun(){return Jc()}var iun=(e,t)=>ks(e.innerType._def,t),lun=(e,t,n)=>{switch(t){case Pe.ZodString:return WQe(e,n);case Pe.ZodNumber:return Ycn(e);case Pe.ZodObject:return Xcn(e,n);case Pe.ZodBigInt:return Acn(e);case Pe.ZodBoolean:return Rcn();case Pe.ZodDate:return GQe(e,n);case Pe.ZodUndefined:return aun();case Pe.ZodNull:return Hcn();case Pe.ZodArray:return jcn(e,n);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return Gcn(e,n);case Pe.ZodIntersection:return Fcn(e,n);case Pe.ZodTuple:return sun(e,n);case Pe.ZodRecord:return ZQe(e,n);case Pe.ZodLiteral:return zcn(e);case Pe.ZodEnum:return Dcn(e);case Pe.ZodNativeEnum:return Vcn(e);case Pe.ZodNullable:return Zcn(e,n);case Pe.ZodOptional:return eun(e,n);case Pe.ZodMap:return qcn(e,n);case Pe.ZodSet:return run(e,n);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return nun(e,n);case Pe.ZodNaN:case Pe.ZodNever:return Qcn();case Pe.ZodEffects:return $cn(e,n);case Pe.ZodAny:return Jc();case Pe.ZodUnknown:return oun();case Pe.ZodDefault:return Mcn(e,n);case Pe.ZodBranded:return HQe(e,n);case Pe.ZodReadonly:return iun(e,n);case Pe.ZodCatch:return Icn(e,n);case Pe.ZodPipeline:return tun(e,n);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(r=>{})()}};function ks(e,t,n=!1){var r;const s=t.seen.get(e);if(t.override){const c=(r=t.override)==null?void 0:r.call(t,e,t,s,n);if(c!==Tcn)return c}if(s&&!n){const c=cun(s,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const o=lun(e,e.typeName,t),i=typeof o=="function"?ks(o(),t):o;if(i&&uun(e,t,i),t.postProcess){const c=t.postProcess(i,e,t);return a.jsonSchema=i,c}return a.jsonSchema=i,i}var cun=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ccn(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Jc()):t.$refStrategy==="seen"?Jc():void 0}},uun=(e,t,n)=>(e.description&&(n.description=e.description),n),dun=e=>{const t=Ncn(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},fun=(e,t)=>{var n;const r=dun(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var p;return{...u,[d]:(p=ks(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:Jc()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=(n=ks(e._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Jc(),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(o.title=i);const c=a===void 0?s?{...o,[r.definitionPath]:s}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...s,[a]:o}};return c.$schema="http://json-schema.org/draft-07/schema#",c},pun=fun;function hun(e,t){var n;const r=(n=void 0)!=null?n:!1;return zne(()=>pun(e,{$refStrategy:r?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function mun(e,t){var n;const r=(n=void 0)!=null?n:!1;return zne(()=>lD(e,{target:"draft-7",io:"output",reused:r?"ref":"inline"}),{validate:async s=>{const a=await Iee(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function gun(e){return"_zod"in e}function jv(e,t){return gun(e)?mun(e):hun(e)}var qW=Symbol.for("vercel.ai.schema");function zne(e,{validate:t}={}){return{[qW]:!0,_type:void 0,[gP]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function bun(e){return typeof e=="object"&&e!==null&&qW in e&&e[qW]===!0&&"jsonSchema"in e&&"validate"in e}function yun(e){return e==null?zne({properties:{},additionalProperties:!1}):bun(e)?e:typeof e=="function"?e():jv(e)}function vun(e){return e?.replace(/\/$/,"")}var xun={},YQe=c2({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(p,h)=>{for(var g in h)n(p,g,{get:h[g],enumerable:!0})},i=(p,h,g,b)=>{if(h&&typeof h=="object"||typeof h=="function")for(let y of s(h))!a.call(p,y)&&y!==g&&n(p,y,{get:()=>h[y],enumerable:!(b=r(h,y))||b.enumerable});return p},c=p=>i(n({},"__esModule",{value:!0}),p),u={};o(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),wun=c2({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(g,b)=>{for(var y in b)n(g,y,{get:b[y],enumerable:!0})},i=(g,b,y,x)=>{if(b&&typeof b=="object"||typeof b=="function")for(let w of s(b))!a.call(g,w)&&w!==y&&n(g,w,{get:()=>b[w],enumerable:!(x=r(b,w))||x.enumerable});return g},c=g=>i(n({},"__esModule",{value:!0}),g),u={};o(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h}),t.exports=c(u);var d=YQe(),f=Zln();async function p(){let g="",b;try{g=h()}catch(y){b=y}try{const[{getTokenPayload:y,isExpired:x},{refreshToken:w}]=await Promise.all([await Qe(()=>import("./token-util-NEHG7TUY-AXWAPLPA-Cgrx5Y2h.js"),__vite__mapDeps([23,24,1]),import.meta.url),await Qe(()=>import("./token-6GSAFR2W-USHIPDRT-w-9JAN9G.js"),__vite__mapDeps([25,24,1]),import.meta.url)]);(!g||x(y(g)))&&(await w(),g=h())}catch(y){throw b?.message&&y instanceof Error&&(y.message=`${b.message}
|
|
343
|
+
]`;continue}a+=s[u],s[u]==="\\"?o=!0:i&&s[u]==="]"?i=!1:!i&&s[u]==="["&&(i=!0)}return a}function ZQe(e,t){var n,r,s,a,o,i;const c={type:"object",additionalProperties:(n=ks(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===Pe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=WQe(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Pe.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&((i=e.keyType._def.type._def.checks)!=null&&i.length)){const{type:u,...d}=HQe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function qcn(e,t){if(t.mapStrategy==="record")return ZQe(e,t);const n=ks(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Jc(),r=ks(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Jc();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function Vcn(e){const t=e.values,r=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(r.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r}}function Qcn(){return{not:Jc()}}function Hcn(){return{type:"null"}}var UW={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Gcn(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in UW&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((s,a)=>{const o=UW[a._def.typeName];return o&&!s.includes(o)?[...s,o]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((s,a)=>{const o=typeof a._def.value;switch(o){case"string":case"number":case"boolean":return[...s,o];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(r.length===n.length){const s=r.filter((a,o,i)=>i.indexOf(a)===o);return{type:s.length>1?s:s[0],enum:n.reduce((a,o)=>a.includes(o._def.value)?a:[...a,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(a=>!r.includes(a))],[])};return Wcn(e,t)}var Wcn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>ks(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function Zcn(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[UW[e.innerType._def.typeName],"null"]};const n=ks(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Ycn(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function Xcn(e,t){const n={type:"object",properties:{}},r=[],s=e.shape();for(const o in s){let i=s[o];if(i===void 0||i._def===void 0)continue;const c=Jcn(i),u=ks(i._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});u!==void 0&&(n.properties[o]=u,c||r.push(o))}r.length&&(n.required=r);const a=Kcn(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Kcn(e,t){if(e.catchall._def.typeName!=="ZodNever")return ks(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Jcn(e){try{return e.isOptional()}catch{return!0}}var eun=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return ks(e.innerType._def,t);const r=ks(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Jc()},r]}:Jc()},tun=(e,t)=>{if(t.pipeStrategy==="input")return ks(e.in._def,t);if(t.pipeStrategy==="output")return ks(e.out._def,t);const n=ks(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ks(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(s=>s!==void 0)}};function nun(e,t){return ks(e.type._def,t)}function run(e,t){const r={type:"array",uniqueItems:!0,items:ks(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function sun(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>ks(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ks(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>ks(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function aun(){return{not:Jc()}}function oun(){return Jc()}var iun=(e,t)=>ks(e.innerType._def,t),lun=(e,t,n)=>{switch(t){case Pe.ZodString:return WQe(e,n);case Pe.ZodNumber:return Ycn(e);case Pe.ZodObject:return Xcn(e,n);case Pe.ZodBigInt:return Acn(e);case Pe.ZodBoolean:return Rcn();case Pe.ZodDate:return GQe(e,n);case Pe.ZodUndefined:return aun();case Pe.ZodNull:return Hcn();case Pe.ZodArray:return jcn(e,n);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return Gcn(e,n);case Pe.ZodIntersection:return Fcn(e,n);case Pe.ZodTuple:return sun(e,n);case Pe.ZodRecord:return ZQe(e,n);case Pe.ZodLiteral:return zcn(e);case Pe.ZodEnum:return Dcn(e);case Pe.ZodNativeEnum:return Vcn(e);case Pe.ZodNullable:return Zcn(e,n);case Pe.ZodOptional:return eun(e,n);case Pe.ZodMap:return qcn(e,n);case Pe.ZodSet:return run(e,n);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return nun(e,n);case Pe.ZodNaN:case Pe.ZodNever:return Qcn();case Pe.ZodEffects:return $cn(e,n);case Pe.ZodAny:return Jc();case Pe.ZodUnknown:return oun();case Pe.ZodDefault:return Mcn(e,n);case Pe.ZodBranded:return HQe(e,n);case Pe.ZodReadonly:return iun(e,n);case Pe.ZodCatch:return Icn(e,n);case Pe.ZodPipeline:return tun(e,n);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(r=>{})()}};function ks(e,t,n=!1){var r;const s=t.seen.get(e);if(t.override){const c=(r=t.override)==null?void 0:r.call(t,e,t,s,n);if(c!==Tcn)return c}if(s&&!n){const c=cun(s,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const o=lun(e,e.typeName,t),i=typeof o=="function"?ks(o(),t):o;if(i&&uun(e,t,i),t.postProcess){const c=t.postProcess(i,e,t);return a.jsonSchema=i,c}return a.jsonSchema=i,i}var cun=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ccn(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Jc()):t.$refStrategy==="seen"?Jc():void 0}},uun=(e,t,n)=>(e.description&&(n.description=e.description),n),dun=e=>{const t=Ncn(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},fun=(e,t)=>{var n;const r=dun(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var p;return{...u,[d]:(p=ks(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:Jc()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=(n=ks(e._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Jc(),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(o.title=i);const c=a===void 0?s?{...o,[r.definitionPath]:s}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...s,[a]:o}};return c.$schema="http://json-schema.org/draft-07/schema#",c},pun=fun;function hun(e,t){var n;const r=(n=void 0)!=null?n:!1;return zne(()=>pun(e,{$refStrategy:r?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function mun(e,t){var n;const r=(n=void 0)!=null?n:!1;return zne(()=>lD(e,{target:"draft-7",io:"output",reused:r?"ref":"inline"}),{validate:async s=>{const a=await Iee(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function gun(e){return"_zod"in e}function jv(e,t){return gun(e)?mun(e):hun(e)}var qW=Symbol.for("vercel.ai.schema");function zne(e,{validate:t}={}){return{[qW]:!0,_type:void 0,[gP]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function bun(e){return typeof e=="object"&&e!==null&&qW in e&&e[qW]===!0&&"jsonSchema"in e&&"validate"in e}function yun(e){return e==null?zne({properties:{},additionalProperties:!1}):bun(e)?e:typeof e=="function"?e():jv(e)}function vun(e){return e?.replace(/\/$/,"")}var xun={},YQe=c2({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(p,h)=>{for(var g in h)n(p,g,{get:h[g],enumerable:!0})},i=(p,h,g,b)=>{if(h&&typeof h=="object"||typeof h=="function")for(let y of s(h))!a.call(p,y)&&y!==g&&n(p,y,{get:()=>h[y],enumerable:!(b=r(h,y))||b.enumerable});return p},c=p=>i(n({},"__esModule",{value:!0}),p),u={};o(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),wun=c2({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(g,b)=>{for(var y in b)n(g,y,{get:b[y],enumerable:!0})},i=(g,b,y,x)=>{if(b&&typeof b=="object"||typeof b=="function")for(let w of s(b))!a.call(g,w)&&w!==y&&n(g,w,{get:()=>b[w],enumerable:!(x=r(b,w))||x.enumerable});return g},c=g=>i(n({},"__esModule",{value:!0}),g),u={};o(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h}),t.exports=c(u);var d=YQe(),f=Zln();async function p(){let g="",b;try{g=h()}catch(y){b=y}try{const[{getTokenPayload:y,isExpired:x},{refreshToken:w}]=await Promise.all([await Qe(()=>import("./token-util-NEHG7TUY-AXWAPLPA-DWvovtwo.js"),__vite__mapDeps([23,24,1]),import.meta.url),await Qe(()=>import("./token-6GSAFR2W-USHIPDRT-D13tY_KD.js"),__vite__mapDeps([25,24,1]),import.meta.url)]);(!g||x(y(g)))&&(await w(),g=h())}catch(y){throw b?.message&&y instanceof Error&&(y.message=`${b.message}
|
|
344
344
|
${y.message}`),new f.VercelOidcTokenError("Failed to refresh OIDC token",y)}return g}function h(){const g=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??xun.VERCEL_OIDC_TOKEN;if(!g)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return g}}}),XQe=c2({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/index.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(p,h)=>{for(var g in h)n(p,g,{get:h[g],enumerable:!0})},i=(p,h,g,b)=>{if(h&&typeof h=="object"||typeof h=="function")for(let y of s(h))!a.call(p,y)&&y!==g&&n(p,y,{get:()=>h[y],enumerable:!(b=r(h,y))||b.enumerable});return p},c=p=>i(n({},"__esModule",{value:!0}),p),u={};o(u,{getContext:()=>f.getContext,getVercelOidcToken:()=>d.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync}),t.exports=c(u);var d=wun(),f=YQe()}}),Sun=OQe(XQe()),Oun=OQe(XQe()),kun="vercel.ai.gateway.error",oq=Symbol.for(kun),v1e,x1e,eu=class KQe extends(x1e=Error,v1e=oq,x1e){constructor({message:t,statusCode:n=500,cause:r}){super(t),this[v1e]=!0,this.statusCode=n,this.cause=r}static isInstance(t){return KQe.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&oq in t&&t[oq]===!0}},JQe="GatewayAuthenticationError",_un=`vercel.ai.gateway.error.${JQe}`,w1e=Symbol.for(_un),S1e,O1e,eHe=class tHe extends(O1e=eu,S1e=w1e,O1e){constructor({message:t="Authentication failed",statusCode:n=401,cause:r}={}){super({message:t,statusCode:n,cause:r}),this[S1e]=!0,this.name=JQe,this.type="authentication_error"}static isInstance(t){return eu.hasMarker(t)&&w1e in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:r="Authentication failed",statusCode:s=401,cause:a}){let o;return t?o=`AI Gateway authentication failed: Invalid API key.
|
|
345
345
|
|
|
346
346
|
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
@@ -433,7 +433,7 @@ ${J.current.stack}
|
|
|
433
433
|
`&&(I=`
|
|
434
434
|
`);var W=0,D=!1;this.parse=function(Z,z,R){if(typeof Z!="string")throw new Error("Input must be a string");var Q=Z.length,G=A.length,J=I.length,ee=P.length,ne=T($),ae=[],ce=[],ye=[],Y=W=0;if(!Z)return Ee();if(L||L!==!1&&Z.indexOf(q)===-1){for(var se=Z.split(I),te=0;te<se.length;te++){if(ye=se[te],W+=ye.length,te!==se.length-1)W+=I.length;else if(R)return Ee();if(!P||ye.substring(0,ee)!==P){if(ne){if(ae=[],ie(ye.split(A)),ve(),D)return Ee()}else ie(ye.split(A));if(U&&U<=te)return ae=ae.slice(0,U),Ee(!0)}}return Ee()}for(var he=Z.indexOf(A,W),le=Z.indexOf(I,W),ge=new RegExp(y(V)+y(q),"g"),je=Z.indexOf(q,W);;)if(Z[W]===q)for(je=W,W++;;){if((je=Z.indexOf(q,je+1))===-1)return R||ce.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ae.length,index:W}),pe();if(je===Q-1)return pe(Z.substring(W,je).replace(ge,q));if(q===V&&Z[je+1]===V)je++;else if(q===V||je===0||Z[je-1]!==V){he!==-1&&he<je+1&&(he=Z.indexOf(A,je+1));var Oe=de((le=le!==-1&&le<je+1?Z.indexOf(I,je+1):le)===-1?he:Math.min(he,le));if(Z.substr(je+1+Oe,G)===A){ye.push(Z.substring(W,je).replace(ge,q)),Z[W=je+1+Oe+G]!==q&&(je=Z.indexOf(q,W)),he=Z.indexOf(A,W),le=Z.indexOf(I,W);break}if(Oe=de(le),Z.substring(je+1+Oe,je+1+Oe+J)===I){if(ye.push(Z.substring(W,je).replace(ge,q)),Ce(je+1+Oe+J),he=Z.indexOf(A,W),je=Z.indexOf(q,W),ne&&(ve(),D))return Ee();if(U&&ae.length>=U)return Ee(!0);break}ce.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ae.length,index:W}),je++}}else if(P&&ye.length===0&&Z.substring(W,W+ee)===P){if(le===-1)return Ee();W=le+J,le=Z.indexOf(I,W),he=Z.indexOf(A,W)}else if(he!==-1&&(he<le||le===-1))ye.push(Z.substring(W,he)),W=he+G,he=Z.indexOf(A,W);else{if(le===-1)break;if(ye.push(Z.substring(W,le)),Ce(le+J),ne&&(ve(),D))return Ee();if(U&&ae.length>=U)return Ee(!0)}return pe();function ie(ue){ae.push(ue),Y=W}function de(ue){var _e=0;return _e=ue!==-1&&(ue=Z.substring(je+1,ue))&&ue.trim()===""?ue.length:_e}function pe(ue){return R||(ue===void 0&&(ue=Z.substring(W)),ye.push(ue),W=Q,ie(ye),ne&&ve()),Ee()}function Ce(ue){W=ue,ie(ye),ye=[],le=Z.indexOf(I,W)}function Ee(ue){if(N.header&&!z&&ae.length&&!H){var _e=ae[0],De=Object.create(null),Ke=new Set(_e);let pt=!1;for(let Et=0;Et<_e.length;Et++){let Ct=_e[Et];if(De[Ct=T(N.transformHeader)?N.transformHeader(Ct,Et):Ct]){let fn,yt=De[Ct];for(;fn=Ct+"_"+yt,yt++,Ke.has(fn););Ke.add(fn),_e[Et]=fn,De[Ct]++,pt=!0,(B=B===null?{}:B)[fn]=Ct}else De[Ct]=1,_e[Et]=Ct;Ke.add(Ct)}pt&&console.warn("Duplicate headers found and renamed."),H=!0}return{data:ae,errors:ce,meta:{delimiter:A,linebreak:I,aborted:D,truncated:!!ue,cursor:Y+(z||0),renamedHeaders:B}}}function ve(){$(Ee()),ae=[],ce=[]}},this.abort=function(){D=!0},this.getCharIndex=function(){return W}}function w(N){var A=N.data,I=i[A.workerId],P=!1;if(A.error)I.userError(A.error,A.file);else if(A.results&&A.results.data){var $={abort:function(){P=!0,O(A.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_,resume:_};if(T(I.userStep)){for(var U=0;U<A.results.data.length&&(I.userStep({data:A.results.data[U],errors:A.results.errors,meta:A.results.meta},$),!P);U++);delete A.results}else T(I.userChunk)&&(I.userChunk(A.results,$,A.file),delete A.results)}A.finished&&!P&&O(A.workerId,A.results)}function O(N,A){var I=i[N];T(I.userComplete)&&I.userComplete(A),I.terminate(),delete i[N]}function _(){throw new Error("Not implemented.")}function C(N){if(typeof N!="object"||N===null)return N;var A,I=Array.isArray(N)?[]:{};for(A in N)I[A]=C(N[A]);return I}function E(N,A){return function(){N.apply(A,arguments)}}function T(N){return typeof N=="function"}return u.parse=function(N,A){var I=(A=A||{}).dynamicTyping||!1;if(T(I)&&(A.dynamicTypingFunction=I,I={}),A.dynamicTyping=I,A.transform=!!T(A.transform)&&A.transform,!A.worker||!u.WORKERS_SUPPORTED)return I=null,u.NODE_STREAM_INPUT,typeof N=="string"?(N=(P=>P.charCodeAt(0)!==65279?P:P.slice(1))(N),I=new(A.download?f:h)(A)):N.readable===!0&&T(N.read)&&T(N.on)?I=new g(A):(r.File&&N instanceof File||N instanceof Object)&&(I=new p(A)),I.stream(N);(I=(()=>{var P;return!!u.WORKERS_SUPPORTED&&(P=(()=>{var $=r.URL||r.webkitURL||null,U=n.toString();return u.BLOB_URL||(u.BLOB_URL=$.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",U,")();"],{type:"text/javascript"})))})(),(P=new r.Worker(P)).onmessage=w,P.id=c++,i[P.id]=P)})()).userStep=A.step,I.userChunk=A.chunk,I.userComplete=A.complete,I.userError=A.error,A.step=T(A.step),A.chunk=T(A.chunk),A.complete=T(A.complete),A.error=T(A.error),delete A.worker,I.postMessage({input:N,config:A,workerId:I.id})},u.unparse=function(N,A){var I=!1,P=!0,$=",",U=`\r
|
|
435
435
|
`,L='"',B=L+L,H=!1,q=null,V=!1,W=((()=>{if(typeof A=="object"){if(typeof A.delimiter!="string"||u.BAD_DELIMITERS.filter(function(z){return A.delimiter.indexOf(z)!==-1}).length||($=A.delimiter),typeof A.quotes!="boolean"&&typeof A.quotes!="function"&&!Array.isArray(A.quotes)||(I=A.quotes),typeof A.skipEmptyLines!="boolean"&&typeof A.skipEmptyLines!="string"||(H=A.skipEmptyLines),typeof A.newline=="string"&&(U=A.newline),typeof A.quoteChar=="string"&&(L=A.quoteChar),typeof A.header=="boolean"&&(P=A.header),Array.isArray(A.columns)){if(A.columns.length===0)throw new Error("Option columns is empty");q=A.columns}A.escapeChar!==void 0&&(B=A.escapeChar+L),A.escapeFormulae instanceof RegExp?V=A.escapeFormulae:typeof A.escapeFormulae=="boolean"&&A.escapeFormulae&&(V=/^[=+\-@\t\r].*$/)}})(),new RegExp(y(L),"g"));if(typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(N)){if(!N.length||Array.isArray(N[0]))return D(null,N,H);if(typeof N[0]=="object")return D(q||Object.keys(N[0]),N,H)}else if(typeof N=="object")return typeof N.data=="string"&&(N.data=JSON.parse(N.data)),Array.isArray(N.data)&&(N.fields||(N.fields=N.meta&&N.meta.fields||q),N.fields||(N.fields=Array.isArray(N.data[0])?N.fields:typeof N.data[0]=="object"?Object.keys(N.data[0]):[]),Array.isArray(N.data[0])||typeof N.data[0]=="object"||(N.data=[N.data])),D(N.fields||[],N.data||[],H);throw new Error("Unable to serialize unrecognized input");function D(z,R,Q){var G="",J=(typeof z=="string"&&(z=JSON.parse(z)),typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(z)&&0<z.length),ee=!Array.isArray(R[0]);if(J&&P){for(var ne=0;ne<z.length;ne++)0<ne&&(G+=$),G+=Z(z[ne],ne);0<R.length&&(G+=U)}for(var ae=0;ae<R.length;ae++){var ce=(J?z:R[ae]).length,ye=!1,Y=J?Object.keys(R[ae]).length===0:R[ae].length===0;if(Q&&!J&&(ye=Q==="greedy"?R[ae].join("").trim()==="":R[ae].length===1&&R[ae][0].length===0),Q==="greedy"&&J){for(var se=[],te=0;te<ce;te++){var he=ee?z[te]:te;se.push(R[ae][he])}ye=se.join("").trim()===""}if(!ye){for(var le=0;le<ce;le++){0<le&&!Y&&(G+=$);var ge=J&&ee?z[le]:le;G+=Z(R[ae][ge],le)}ae<R.length-1&&(!Q||0<ce&&!Y)&&(G+=U)}}return G}function Z(z,R){var Q,G;return z==null?"":z.constructor===Date?JSON.stringify(z).slice(1,25):(G=!1,V&&typeof z=="string"&&V.test(z)&&(z="'"+z,G=!0),Q=z.toString().replace(W,B),(G=G||I===!0||typeof I=="function"&&I(z,R)||Array.isArray(I)&&I[R]||((J,ee)=>{for(var ne=0;ne<ee.length;ne++)if(-1<J.indexOf(ee[ne]))return!0;return!1})(Q,u.BAD_DELIMITERS)||-1<Q.indexOf($)||Q.charAt(0)===" "||Q.charAt(Q.length-1)===" ")?L+Q+L:Q)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
|
|
436
|
-
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!a&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=b,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=h,u.ReadableStreamStreamer=g,r.jQuery&&((s=r.jQuery).fn.parse=function(N){var A=N.config||{},I=[];return this.each(function(U){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)I.push({file:this.files[L],inputElem:this,instanceConfig:s.extend({},A)})}),P(),this;function P(){if(I.length===0)T(N.complete)&&N.complete();else{var U,L,B,H,q=I[0];if(T(N.before)){var V=N.before(q.file,q.inputElem);if(typeof V=="object"){if(V.action==="abort")return U="AbortError",L=q.file,B=q.inputElem,H=V.reason,void(T(N.error)&&N.error({name:U},L,B,H));if(V.action==="skip")return void $();typeof V.config=="object"&&(q.instanceConfig=s.extend(q.instanceConfig,V.config))}else if(V==="skip")return void $()}var W=q.instanceConfig.complete;q.instanceConfig.complete=function(D){T(W)&&W(D,q.file,q.inputElem),$()},u.parse(q.file,q.instanceConfig)}}function $(){I.splice(0,1),P()}}),o&&(r.onmessage=function(N){N=N.data,u.WORKER_ID===void 0&&N&&(u.WORKER_ID=N.workerId),typeof N.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(N.input,N.config),finished:!0}):(r.File&&N.input instanceof File||N.input instanceof Object)&&(N=u.parse(N.input,N.config))&&r.postMessage({workerId:u.WORKER_ID,results:N,finished:!0})}),(f.prototype=Object.create(d.prototype)).constructor=f,(p.prototype=Object.create(d.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(g.prototype=Object.create(d.prototype)).constructor=g,u})})(fR)),fR.exports}var V0n=q0n();const UWe=Ju(V0n);var t_e=1,Q0n=.9,H0n=.8,G0n=.17,SV=.1,OV=.999,W0n=.9999,Z0n=.99,Y0n=/[\\\/_+.#"@\[\(\{&]/,X0n=/[\\\/_+.#"@\[\(\{&]/g,K0n=/[\s-]/,qWe=/[\s-]/g;function oZ(e,t,n,r,s,a,o){if(a===t.length)return s===e.length?t_e:Z0n;var i=`${s},${a}`;if(o[i]!==void 0)return o[i];for(var c=r.charAt(a),u=n.indexOf(c,s),d=0,f,p,h,g;u>=0;)f=oZ(e,t,n,r,u+1,a+1,o),f>d&&(u===s?f*=t_e:Y0n.test(e.charAt(u-1))?(f*=H0n,h=e.slice(s,u-1).match(X0n),h&&s>0&&(f*=Math.pow(OV,h.length))):K0n.test(e.charAt(u-1))?(f*=Q0n,g=e.slice(s,u-1).match(qWe),g&&s>0&&(f*=Math.pow(OV,g.length))):(f*=G0n,s>0&&(f*=Math.pow(OV,u-s))),e.charAt(u)!==t.charAt(a)&&(f*=W0n)),(f<SV&&n.charAt(u-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(u-1)!==r.charAt(a))&&(p=oZ(e,t,n,r,u+1,a+2,o),p*SV>f&&(f=p*SV)),f>d&&(d=f),u=n.indexOf(c,u+1);return o[i]=d,d}function n_e(e){return e.toLowerCase().replace(qWe," ")}function J0n(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,oZ(e,t,n_e(e),n_e(t),0,0,{})}var tO='[cmdk-group=""]',kV='[cmdk-group-items=""]',ewn='[cmdk-group-heading=""]',VWe='[cmdk-item=""]',r_e=`${VWe}:not([aria-disabled="true"])`,iZ="cmdk-item-select",qx="data-value",twn=(e,t,n)=>J0n(e,t,n),QWe=S.createContext(void 0),eT=()=>S.useContext(QWe),HWe=S.createContext(void 0),Mre=()=>S.useContext(HWe),GWe=S.createContext(void 0),WWe=S.forwardRef((e,t)=>{let n=Vx(()=>{var z,R;return{search:"",value:(R=(z=e.value)!=null?z:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Vx(()=>new Set),s=Vx(()=>new Map),a=Vx(()=>new Map),o=Vx(()=>new Set),i=ZWe(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:g,disablePointerSelection:b=!1,vimBindings:y=!0,...x}=e,w=io(),O=io(),_=io(),C=S.useRef(null),E=fwn();ev(()=>{if(d!==void 0){let z=d.trim();n.current.value=z,T.emit()}},[d]),ev(()=>{E(6,U)},[]);let T=S.useMemo(()=>({subscribe:z=>(o.current.add(z),()=>o.current.delete(z)),snapshot:()=>n.current,setState:(z,R,Q)=>{var G,J,ee,ne;if(!Object.is(n.current[z],R)){if(n.current[z]=R,z==="search")$(),I(),E(1,P);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ae=document.getElementById(_);ae?ae.focus():(G=document.getElementById(w))==null||G.focus()}if(E(7,()=>{var ae;n.current.selectedItemId=(ae=L())==null?void 0:ae.id,T.emit()}),Q||E(5,U),((J=i.current)==null?void 0:J.value)!==void 0){let ae=R??"";(ne=(ee=i.current).onValueChange)==null||ne.call(ee,ae);return}}T.emit()}},emit:()=>{o.current.forEach(z=>z())}}),[]),N=S.useMemo(()=>({value:(z,R,Q)=>{var G;R!==((G=a.current.get(z))==null?void 0:G.value)&&(a.current.set(z,{value:R,keywords:Q}),n.current.filtered.items.set(z,A(R,Q)),E(2,()=>{I(),T.emit()}))},item:(z,R)=>(r.current.add(z),R&&(s.current.has(R)?s.current.get(R).add(z):s.current.set(R,new Set([z]))),E(3,()=>{$(),I(),n.current.value||P(),T.emit()}),()=>{a.current.delete(z),r.current.delete(z),n.current.filtered.items.delete(z);let Q=L();E(4,()=>{$(),Q?.getAttribute("id")===z&&P(),T.emit()})}),group:z=>(s.current.has(z)||s.current.set(z,new Set),()=>{a.current.delete(z),s.current.delete(z)}),filter:()=>i.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:w,inputId:_,labelId:O,listInnerRef:C}),[]);function A(z,R){var Q,G;let J=(G=(Q=i.current)==null?void 0:Q.filter)!=null?G:twn;return z?J(z,n.current.search,R):0}function I(){if(!n.current.search||i.current.shouldFilter===!1)return;let z=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(G=>{let J=s.current.get(G),ee=0;J.forEach(ne=>{let ae=z.get(ne);ee=Math.max(ae,ee)}),R.push([G,ee])});let Q=C.current;B().sort((G,J)=>{var ee,ne;let ae=G.getAttribute("id"),ce=J.getAttribute("id");return((ee=z.get(ce))!=null?ee:0)-((ne=z.get(ae))!=null?ne:0)}).forEach(G=>{let J=G.closest(kV);J?J.appendChild(G.parentElement===J?G:G.closest(`${kV} > *`)):Q.appendChild(G.parentElement===Q?G:G.closest(`${kV} > *`))}),R.sort((G,J)=>J[1]-G[1]).forEach(G=>{var J;let ee=(J=C.current)==null?void 0:J.querySelector(`${tO}[${qx}="${encodeURIComponent(G[0])}"]`);ee?.parentElement.appendChild(ee)})}function P(){let z=B().find(Q=>Q.getAttribute("aria-disabled")!=="true"),R=z?.getAttribute(qx);T.setState("value",R||void 0)}function $(){var z,R,Q,G;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let ee of r.current){let ne=(R=(z=a.current.get(ee))==null?void 0:z.value)!=null?R:"",ae=(G=(Q=a.current.get(ee))==null?void 0:Q.keywords)!=null?G:[],ce=A(ne,ae);n.current.filtered.items.set(ee,ce),ce>0&&J++}for(let[ee,ne]of s.current)for(let ae of ne)if(n.current.filtered.items.get(ae)>0){n.current.filtered.groups.add(ee);break}n.current.filtered.count=J}function U(){var z,R,Q;let G=L();G&&(((z=G.parentElement)==null?void 0:z.firstChild)===G&&((Q=(R=G.closest(tO))==null?void 0:R.querySelector(ewn))==null||Q.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function L(){var z;return(z=C.current)==null?void 0:z.querySelector(`${VWe}[aria-selected="true"]`)}function B(){var z;return Array.from(((z=C.current)==null?void 0:z.querySelectorAll(r_e))||[])}function H(z){let R=B()[z];R&&T.setState("value",R.getAttribute(qx))}function q(z){var R;let Q=L(),G=B(),J=G.findIndex(ne=>ne===Q),ee=G[J+z];(R=i.current)!=null&&R.loop&&(ee=J+z<0?G[G.length-1]:J+z===G.length?G[0]:G[J+z]),ee&&T.setState("value",ee.getAttribute(qx))}function V(z){let R=L(),Q=R?.closest(tO),G;for(;Q&&!G;)Q=z>0?uwn(Q,tO):dwn(Q,tO),G=Q?.querySelector(r_e);G?T.setState("value",G.getAttribute(qx)):q(z)}let W=()=>H(B().length-1),D=z=>{z.preventDefault(),z.metaKey?W():z.altKey?V(1):q(1)},Z=z=>{z.preventDefault(),z.metaKey?H(0):z.altKey?V(-1):q(-1)};return S.createElement(ei.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:z=>{var R;(R=x.onKeyDown)==null||R.call(x,z);let Q=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||Q))switch(z.key){case"n":case"j":{y&&z.ctrlKey&&D(z);break}case"ArrowDown":{D(z);break}case"p":case"k":{y&&z.ctrlKey&&Z(z);break}case"ArrowUp":{Z(z);break}case"Home":{z.preventDefault(),H(0);break}case"End":{z.preventDefault(),W();break}case"Enter":{z.preventDefault();let G=L();if(G){let J=new Event(iZ);G.dispatchEvent(J)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:hwn},c),k2(e,z=>S.createElement(HWe.Provider,{value:T},S.createElement(QWe.Provider,{value:N},z))))}),nwn=S.forwardRef((e,t)=>{var n,r;let s=io(),a=S.useRef(null),o=S.useContext(GWe),i=eT(),c=ZWe(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o?.forceMount;ev(()=>{if(!u)return i.item(s,o?.id)},[u]);let d=YWe(s,a,[e.value,e.children,a],e.keywords),f=Mre(),p=Ig(E=>E.value&&E.value===d.current),h=Ig(E=>u||i.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=a.current;if(!(!E||e.disabled))return E.addEventListener(iZ,g),()=>E.removeEventListener(iZ,g)},[h,e.onSelect,e.disabled]);function g(){var E,T;b(),(T=(E=c.current).onSelect)==null||T.call(E,d.current)}function b(){f.setState("value",d.current,!0)}if(!h)return null;let{disabled:y,value:x,onSelect:w,forceMount:O,keywords:_,...C}=e;return S.createElement(ei.div,{ref:Xf(a,t),...C,id:s,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!p,"data-disabled":!!y,"data-selected":!!p,onPointerMove:y||i.getDisablePointerSelection()?void 0:b,onClick:y?void 0:g},e.children)}),rwn=S.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...a}=e,o=io(),i=S.useRef(null),c=S.useRef(null),u=io(),d=eT(),f=Ig(h=>s||d.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);ev(()=>d.group(o),[]),YWe(o,i,[e.value,e.heading,c]);let p=S.useMemo(()=>({id:o,forceMount:s}),[s]);return S.createElement(ei.div,{ref:Xf(i,t),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&S.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),k2(e,h=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},S.createElement(GWe.Provider,{value:p},h))))}),swn=S.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=S.useRef(null),a=Ig(o=>!o.search);return!n&&!a?null:S.createElement(ei.div,{ref:Xf(s,t),...r,"cmdk-separator":"",role:"separator"})}),awn=S.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,a=Mre(),o=Ig(u=>u.search),i=Ig(u=>u.selectedItemId),c=eT();return S.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),S.createElement(ei.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":i,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||a.setState("search",u.target.value),n?.(u.target.value)}})}),own=S.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,a=S.useRef(null),o=S.useRef(null),i=Ig(u=>u.selectedItemId),c=eT();return S.useEffect(()=>{if(o.current&&a.current){let u=o.current,d=a.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(f),p.unobserve(u)}}},[]),S.createElement(ei.div,{ref:Xf(a,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:c.listId},k2(e,u=>S.createElement("div",{ref:Xf(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),iwn=S.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:a,container:o,...i}=e;return S.createElement(vM,{open:n,onOpenChange:r},S.createElement(xM,{container:o},S.createElement($E,{"cmdk-overlay":"",className:s}),S.createElement(DE,{"aria-label":e.label,"cmdk-dialog":"",className:a},S.createElement(WWe,{ref:t,...i}))))}),lwn=S.forwardRef((e,t)=>Ig(n=>n.filtered.count===0)?S.createElement(ei.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),cwn=S.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...a}=e;return S.createElement(ei.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},k2(e,o=>S.createElement("div",{"aria-hidden":!0},o)))}),fc=Object.assign(WWe,{List:own,Item:nwn,Input:awn,Group:rwn,Separator:swn,Dialog:iwn,Empty:lwn,Loading:cwn});function uwn(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function dwn(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ZWe(e){let t=S.useRef(e);return ev(()=>{t.current=e}),t}var ev=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Vx(e){let t=S.useRef();return t.current===void 0&&(t.current=e()),t}function Ig(e){let t=Mre(),n=()=>e(t.snapshot());return S.useSyncExternalStore(t.subscribe,n,n)}function YWe(e,t,n,r=[]){let s=S.useRef(),a=eT();return ev(()=>{var o;let i=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());a.value(e,i,c),(o=t.current)==null||o.setAttribute(qx,i),s.current=i}),s}var fwn=()=>{let[e,t]=S.useState(),n=Vx(()=>new Map);return ev(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function pwn(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function k2({asChild:e,children:t},n){return e&&S.isValidElement(t)?S.cloneElement(pwn(t),{ref:t.ref},n(t.props.children)):n(t)}var hwn={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class bo{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}offset(t,n=t){return new bo(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}}function tv(e,t,n,r,s,a){if(e==r)return[];let o=Dre(e,t,n,r,s,a),i=Lre(e,t+o,n,r,s+o,a);t+=o,n-=i,s+=o,a-=i;let c=n-t,u=a-s;if(!c||!u)return[new bo(t,n,s,a)];if(c>u){let f=e.slice(t,n).indexOf(r.slice(s,a));if(f>-1)return[new bo(t,t+f,s,s),new bo(t+f+u,n,a,a)]}else if(u>c){let f=r.slice(s,a).indexOf(e.slice(t,n));if(f>-1)return[new bo(t,t,s,s+f),new bo(n,n,s+f+c,a)]}if(c==1||u==1)return[new bo(t,n,s,a)];let d=JWe(e,t,n,r,s,a);if(d){let[f,p,h]=d;return tv(e,t,f,r,s,p).concat(tv(e,f+h,n,r,p+h,a))}return mwn(e,t,n,r,s,a)}let jO=1e9,AO=0,$re=!1;function mwn(e,t,n,r,s,a){let o=n-t,i=a-s;if(jO<1e9&&Math.min(o,i)>jO*16||AO>0&&Date.now()>AO)return Math.min(o,i)>jO*64?[new bo(t,n,s,a)]:s_e(e,t,n,r,s,a);let c=Math.ceil((o+i)/2);_V.reset(c),EV.reset(c);let u=(h,g)=>e.charCodeAt(t+h)==r.charCodeAt(s+g),d=(h,g)=>e.charCodeAt(n-h-1)==r.charCodeAt(a-g-1),f=(o-i)%2!=0?EV:null,p=f?null:_V;for(let h=0;h<c;h++){if(h>jO||AO>0&&!(h&63)&&Date.now()>AO)return s_e(e,t,n,r,s,a);let g=_V.advance(h,o,i,c,f,!1,u)||EV.advance(h,o,i,c,p,!0,d);if(g)return gwn(e,t,n,t+g[0],r,s,a,s+g[1])}return[new bo(t,n,s,a)]}class XWe{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,n,r,s,a,o,i){for(let c=-t+this.start;c<=t-this.end;c+=2){let u=s+c,d=c==-t||c!=t&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,f=d-c;for(;d<n&&f<r&&i(d,f);)d++,f++;if(this.vec[u]=d,d>n)this.end+=2;else if(f>r)this.start+=2;else if(a){let p=s+(n-r)-c;if(p>=0&&p<this.len&&a.vec[p]!=-1)if(o){let h=a.vec[p];if(h>=n-d)return[h,s+h-p]}else{let h=n-a.vec[p];if(d>=h)return[d,f]}}}return null}}const _V=new XWe,EV=new XWe;function gwn(e,t,n,r,s,a,o,i){let c=!1;return!Lw(e,r)&&++r==n&&(c=!0),!Lw(s,i)&&++i==o&&(c=!0),c?[new bo(t,n,a,o)]:tv(e,t,r,s,a,i).concat(tv(e,r,n,s,i,o))}function KWe(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function Dre(e,t,n,r,s,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(s))return 0;let o=KWe(n-t,a-s);for(let i=t,c=s;;){let u=i+o,d=c+o;if(u>n||d>a||e.slice(i,u)!=r.slice(c,d)){if(o==1)return i-t-(Lw(e,i)?0:1);o=o>>1}else{if(u==n||d==a)return u-t;i=u,c=d}}}function Lre(e,t,n,r,s,a){if(t==n||s==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=KWe(n-t,a-s);for(let i=n,c=a;;){let u=i-o,d=c-o;if(u<t||d<s||e.slice(u,i)!=r.slice(d,c)){if(o==1)return n-i-(Lw(e,i)?0:1);o=o>>1}else{if(u==t||d==s)return n-u;i=u,c=d}}}function lZ(e,t,n,r,s,a,o,i){let c=r.slice(s,a),u=null;for(;;){if(u||o<i)return u;for(let d=t+o;;){Lw(e,d)||d++;let f=d+o;if(Lw(e,f)||(f+=f==d+1?1:-1),f>=n)break;let p=e.slice(d,f),h=-1;for(;(h=c.indexOf(p,h+1))!=-1;){let g=Dre(e,f,n,r,s+h+p.length,a),b=Lre(e,t,d,r,s,s+h),y=p.length+g+b;(!u||u[2]<y)&&(u=[d-b,s+h-b,y])}d=f}if(i<0)return u;o=o>>1}}function JWe(e,t,n,r,s,a){let o=n-t,i=a-s;if(o<i){let c=JWe(r,s,a,e,t,n);return c&&[c[1],c[0],c[2]]}return o<4||i*2<o?null:lZ(e,t,n,r,s,a,Math.floor(o/4),-1)}function s_e(e,t,n,r,s,a){$re=!0;let o=n-t,i=a-s,c;if(o<i){let p=lZ(r,s,a,e,t,n,Math.floor(o/6),50);c=p&&[p[1],p[0],p[2]]}else c=lZ(e,t,n,r,s,a,Math.floor(i/6),50);if(!c)return[new bo(t,n,s,a)];let[u,d,f]=c;return tv(e,t,u,r,s,d).concat(tv(e,u+f,n,r,d+f,a))}function eZe(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],s=e[n];r.toA>s.fromA-t&&r.toB>s.fromB-t&&(e[n-1]=new bo(r.fromA,s.toA,r.fromB,s.toB),e.splice(n--,1))}}function bwn(e,t,n){for(;;){eZe(n,1);let r=!1;for(let s=0;s<n.length;s++){let a=n[s],o,i;(o=Dre(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[s]=new bo(a.fromA+o,a.toA,a.fromB+o,a.toB)),(i=Lre(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[s]=new bo(a.fromA,a.toA-i,a.fromB,a.toB-i));let c=a.toA-a.fromA,u=a.toB-a.fromB;if(c&&u)continue;let d=a.fromA-(s?n[s-1].toA:0),f=(s<n.length-1?n[s+1].fromA:e.length)-a.toA;if(!d||!f)continue;let p=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);d<=p.length&&e.slice(a.fromA-d,a.fromA)==p.slice(p.length-d)?(n[s]=new bo(a.fromA-d,a.toA-d,a.fromB-d,a.toB-d),r=!0):f<=p.length&&e.slice(a.toA,a.toA+f)==p.slice(0,f)&&(n[s]=new bo(a.fromA+f,a.toA+f,a.fromB+f,a.toB+f),r=!0)}if(!r)break}return n}function ywn(e,t,n){for(let r=0,s=0;s<e.length;s++){let a=e[s],o=a.toA-a.fromA,i=a.toB-a.fromB;if(o&&i||o>3||i>3){let c=s==e.length-1?t.length:e[s+1].fromA,u=a.fromA-r,d=c-a.toA,f=o_e(t,a.fromA,u),p=a_e(t,a.toA,d),h=a.fromA-f,g=p-a.toA;if((!o||!i)&&h&&g){let b=Math.max(o,i),[y,x,w]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];b>h&&t.slice(f,a.fromA)==y.slice(w-h,w)?(a=e[s]=new bo(f,f+o,a.fromB-h,a.toB-h),f=a.fromA,p=a_e(t,a.toA,c-a.toA)):b>g&&t.slice(a.toA,p)==y.slice(x,x+g)&&(a=e[s]=new bo(p-o,p,a.fromB+g,a.toB+g),p=a.toA,f=o_e(t,a.fromA,a.fromA-r)),h=a.fromA-f,g=p-a.toA}if(h||g)a=e[s]=new bo(a.fromA-h,a.toA+g,a.fromB-h,a.toB+g);else if(o){if(!i){let b=l_e(t,a.fromA,a.toA),y,x=b<0?-1:i_e(t,a.toA,a.fromA);b>-1&&(y=b-a.fromA)<=d&&t.slice(a.fromA,b)==t.slice(a.toA,a.toA+y)?a=e[s]=a.offset(y):x>-1&&(y=a.toA-x)<=u&&t.slice(a.fromA-y,a.fromA)==t.slice(x,a.toA)&&(a=e[s]=a.offset(-y))}}else{let b=l_e(n,a.fromB,a.toB),y,x=b<0?-1:i_e(n,a.toB,a.fromB);b>-1&&(y=b-a.fromB)<=d&&n.slice(a.fromB,b)==n.slice(a.toB,a.toB+y)?a=e[s]=a.offset(y):x>-1&&(y=a.toB-x)<=u&&n.slice(a.fromB-y,a.fromB)==n.slice(x,a.toB)&&(a=e[s]=a.offset(-y))}}r=a.toA}return eZe(e,3),e}let my;try{my=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function tZe(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function nZe(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?tZe(n)?1:0:my?!aZe(n)||t==e.length-1?my.test(String.fromCharCode(n))?1:0:my.test(e.slice(t,t+2))?2:0:0}function rZe(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?tZe(n)?1:0:my?!oZe(n)||t==1?my.test(String.fromCharCode(n))?1:0:my.test(e.slice(t-2,t))?2:0:0}const sZe=8;function a_e(e,t,n){if(t==e.length||!rZe(e,t))return t;for(let r=t,s=t+n,a=0;a<sZe;a++){let o=nZe(e,r);if(!o||r+o>s)return r;r+=o}return t}function o_e(e,t,n){if(!t||!nZe(e,t))return t;for(let r=t,s=t-n,a=0;a<sZe;a++){let o=rZe(e,r);if(!o||r-o<s)return r;r-=o}return t}function i_e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function l_e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const aZe=e=>e>=55296&&e<=56319,oZe=e=>e>=56320&&e<=57343;function Lw(e,t){return!t||t==e.length||!aZe(e.charCodeAt(t-1))||!oZe(e.charCodeAt(t))}function vwn(e,t,n){var r;let s=n?.override;return s?s(e,t):(jO=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,AO=n?.timeout?Date.now()+n.timeout:0,$re=!1,bwn(e,t,tv(e,0,e.length,t,0,t.length)))}function iZe(){return!$re}function lZe(e,t,n){return ywn(vwn(e,t,n),e,t)}const Af=Lt.define({combine:e=>e[0]}),cZ=Fn.define(),xwn=Lt.define(),Fw=lo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(cZ)&&(e=n.value);for(let n of t.state.facet(xwn))e=n(e,t);return e}});class M0{constructor(t,n,r,s,a,o=!0){this.changes=t,this.fromA=n,this.toA=r,this.fromB=s,this.toB=a,this.precise=o}offset(t,n){return t||n?new M0(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,n,r){let s=lZe(t.toString(),n.toString(),r);return cZe(s,t,n,0,0,iZe())}static updateA(t,n,r,s,a){return p_e(f_e(t,s,!0,r.length),t,n,r,a)}static updateB(t,n,r,s,a){return p_e(f_e(t,s,!1,n.length),t,n,r,a)}}function c_e(e,t,n,r){let s=n.lineAt(e),a=r.lineAt(t);return s.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[s.from,a.from]}function u_e(e,t,n,r){let s=n.lineAt(e),a=r.lineAt(t);return s.from==e&&a.from==t?[e,t]:[s.to+1,a.to+1]}function cZe(e,t,n,r,s,a){let o=[];for(let i=0;i<e.length;i++){let c=e[i],[u,d]=c_e(c.fromA+r,c.fromB+s,t,n),[f,p]=u_e(c.toA+r,c.toB+s,t,n),h=[c.offset(-u+r,-d+s)];for(;i<e.length-1;){let g=e[i+1],[b,y]=c_e(g.fromA+r,g.fromB+s,t,n);if(b>f+1&&y>p+1)break;h.push(g.offset(-u+r,-d+s)),[f,p]=u_e(g.toA+r,g.toB+s,t,n),i++}o.push(new M0(h,u,Math.max(u,f),d,Math.max(d,p),a))}return o}const rA=1e3;function d_e(e,t,n,r){let s=0,a=e.length;for(;;){if(s==a){let d=0,f=0;s&&({toA:d,toB:f}=e[s-1]);let p=t-(n?d:f);return[d+p,f+p]}let o=s+a>>1,i=e[o],[c,u]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(c>t)a=o;else if(u<=t)s=o+1;else return r?[i.fromA,i.fromB]:[i.toA,i.toB]}}function f_e(e,t,n,r){let s=[];return t.iterChangedRanges((a,o,i,c)=>{let u=0,d=n?t.length:r,f=0,p=n?r:t.length;a>rA&&([u,f]=d_e(e,a-rA,n,!0)),o<t.length-rA&&([d,p]=d_e(e,o+rA,n,!1));let h=c-i-(o-a),g,[b,y]=n?[h,0]:[0,h];s.length&&(g=s[s.length-1]).toA>=u?s[s.length-1]={fromA:g.fromA,fromB:g.fromB,toA:d,toB:p,diffA:g.diffA+b,diffB:g.diffB+y}:s.push({fromA:u,toA:d,fromB:f,toB:p,diffA:b,diffB:y})}),s}function p_e(e,t,n,r,s){if(!e.length)return t;let a=[];for(let o=0,i=0,c=0,u=0;;o++){let d=o==e.length?null:e[o],f=d?d.fromA+i:n.length,p=d?d.fromB+c:r.length;for(;u<t.length;){let y=t[u];if(d&&(y.toA+i>f||y.toB+c>p))break;a.push(y.offset(i,c)),u++}if(!d)break;let h=d.toA+i+d.diffA,g=d.toB+c+d.diffB,b=lZe(n.sliceString(f,h),r.sliceString(p,g),s);for(let y of cZe(b,n,r,f,p,iZe()))a.push(y);for(i+=d.diffA,c+=d.diffB;u<t.length;){let y=t[u];if(y.fromA+i>h&&y.fromB+c>g)break;u++}}return a}const wwn={scanLimit:500},uZe=Pa.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=g_e(e))}update(e){(e.docChanged||e.viewportChanged||Swn(e.startState,e.state)||Own(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=g_e(e.view))}},{decorations:e=>e.deco}),sA=Jd.low(S2e({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(uZe))===null||t===void 0?void 0:t.gutter)||xr.empty}}));function Swn(e,t){return e.field(Fw,!1)!=t.field(Fw,!1)}function Own(e,t){return e.facet(Af)!=t.facet(Af)}const h_e=Qt.line({class:"cm-changedLine"}),kwn=Qt.mark({class:"cm-changedText"}),_wn=Qt.mark({tagName:"ins",class:"cm-insertedLine"}),Ewn=Qt.mark({tagName:"del",class:"cm-deletedLine"}),m_e=new class extends ep{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Cwn(e,t,n,r,s,a){let o=n?e.fromA:e.fromB,i=n?e.toA:e.toB,c=0;if(o!=i){s.add(o,o,h_e),s.add(o,i,n?Ewn:_wn),a&&a.add(o,o,m_e);for(let u=t.iterRange(o,i-1),d=o;!u.next().done;){if(u.lineBreak){d++,s.add(d,d,h_e),a&&a.add(d,d,m_e);continue}let f=d+u.value.length;if(r)for(;c<e.changes.length;){let p=e.changes[c],h=o+(n?p.fromA:p.fromB),g=o+(n?p.toA:p.toB),b=Math.max(d,h),y=Math.min(f,g);if(b<y&&s.add(b,y,kwn),g<f)c++;else break}d=f}}}function g_e(e){let t=e.state.field(Fw),{side:n,highlightChanges:r,markGutter:s,overrideChunk:a}=e.state.facet(Af),o=n=="a",i=new ec,c=s?new ec:null,{from:u,to:d}=e.viewport;for(let f of t){if((o?f.fromA:f.fromB)>=d)break;(o?f.toA:f.toB)>u&&(!a||!a(e.state,f,i,c))&&Cwn(f,e.state.doc,o,r,i,c)}return{deco:i.finish(),gutter:c&&c.finish()}}class aA extends ru{constructor(t){super(),this.height=t}eq(t){return this.height==t.height}toDOM(){let t=document.createElement("div");return t.className="cm-mergeSpacer",t.style.height=this.height+"px",t}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const AP=Fn.define({map:(e,t)=>e.map(t)}),RO=lo.define({create:()=>Qt.none,update:(e,t)=>{for(let n of t.effects)if(n.is(AP))return n.value;return e.map(t.changes)},provide:e=>it.decorations.from(e)}),oA=.01;function b_e(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Twn(e,t,n){let r=new ec,s=new ec,a=e.state.field(RO).iter(),o=t.state.field(RO).iter(),i=0,c=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let y=0;;y++){let x=y<n.length?n[y]:null,w=x?x.fromA:e.state.doc.length,O=x?x.fromB:t.state.doc.length;if(i<w){let _=e.lineBlockAt(i).top+u,C=t.lineBlockAt(c).top+d,E=_-C;E<-oA?(u-=E,r.add(i,i,Qt.widget({widget:new aA(-E),block:!0,side:-1}))):E>oA&&(d+=E,s.add(c,c,Qt.widget({widget:new aA(E),block:!0,side:-1})))}if(w>i+1e3&&i<f.from&&w>f.from&&c<p.from&&O>p.from){let _=Math.min(f.from-i,p.from-c);i+=_,c+=_,y--}else if(x)i=x.toA,c=x.toB;else break;for(;a.value&&a.from<i;)u-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)d-=o.value.spec.widget.height,o.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;o.value;)d-=o.value.spec.widget.height,o.next();let h=e.contentHeight+u-(t.contentHeight+d);h<oA?r.add(e.state.doc.length,e.state.doc.length,Qt.widget({widget:new aA(-h),block:!0,side:1})):h>oA&&s.add(t.state.doc.length,t.state.doc.length,Qt.widget({widget:new aA(h),block:!0,side:1}));let g=r.finish(),b=s.finish();b_e(g,e.state.field(RO))||e.dispatch({effects:AP.of(g)}),b_e(b,t.state.field(RO))||t.dispatch({effects:AP.of(b)})}const uZ=Fn.define({map:(e,t)=>t.mapPos(e)});class Nwn extends ru{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=t.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",r=>{let s=t.posAtDOM(r.target);t.dispatch({effects:uZ.of(s)});let{side:a,sibling:o}=t.state.facet(Af);o&&o().dispatch({effects:uZ.of(jwn(s,t.state.field(Fw),a=="a"))})}),n}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function jwn(e,t,n){let r=0,s=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return s+(e-r);[r,s]=n?[o.toA,o.toB]:[o.toB,o.toA]}}const Awn=lo.define({create(e){return Qt.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(uZ)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>it.decorations.from(e)});function y_e({margin:e=3,minSize:t=4}){return Awn.init(n=>Rwn(n,e,t))}function Rwn(e,t,n){let r=new ec,s=e.facet(Af).side=="a",a=e.field(Fw),o=1;for(let i=0;;i++){let c=i<a.length?a[i]:null,u=i?o+t:1,d=c?e.doc.lineAt(s?c.fromA:c.fromB).number-1-t:e.doc.lines,f=d-u+1;if(f>=n&&r.add(e.doc.line(u).from,e.doc.line(d).to,Qt.replace({widget:new Nwn(f),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,s?c.toA:c.toB)).number}return r.finish()}const Iwn=it.styleModule.of(new Oh({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Pwn=it.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),v_e=new oS,iA=new oS;class Mwn{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||wwn;let n=[Jd.low(uZe),Pwn,Iwn,RO,it.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(p=>p.effects.some(h=>h.is(AP)))&&this.measure()})],r=[Af.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(sA);let s=br.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],it.editorAttributes.of({class:"cm-merge-a"}),iA.of(r),n]}),a=[Af.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&a.push(sA);let o=br.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],it.editorAttributes.of({class:"cm-merge-b"}),iA.of(a),n]});this.chunks=M0.build(s.doc,o.doc,this.diffConf);let i=[Fw.init(()=>this.chunks),v_e.of(t.collapseUnchanged?y_e(t.collapseUnchanged):[])];s=s.update({effects:Fn.appendConfig.of(i)}).state,o=o.update({effects:Fn.appendConfig.of(i)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let c=t.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(c=="a-b"?u:d),this.editorDOM.appendChild(c=="a-b"?d:u),this.a=new it({state:s,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new it({state:o,parent:d,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,n){if(t.some(r=>r.docChanged)){let r=t[t.length-1],s=t.reduce((o,i)=>o.compose(i.changes),go.empty(t[0].startState.doc.length));this.chunks=n==this.a?M0.updateA(this.chunks,r.newDoc,this.b.state.doc,s,this.diffConf):M0.updateB(this.chunks,this.a.state.doc,r.newDoc,s,this.diffConf),n.update([...t,r.state.update({effects:cZ.of(this.chunks)})]);let a=n==this.a?this.b:this.a;a.update([a.state.update({effects:cZ.of(this.chunks)})]),this.scheduleMeasure()}else n.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let a=t.orientation!="b-a";if(a!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let o=this.a.dom.parentNode,i=this.b.dom.parentNode;o.remove(),i.remove(),this.editorDOM.insertBefore(a?o:i,this.editorDOM.firstChild),this.editorDOM.appendChild(a?i:o),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let a=!!this.revertDOM,o=this.revertToA,i=this.renderRevert;"revertControls"in t&&(a=!!t.revertControls,o=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(i=t.renderRevertControl),this.setupRevertControls(a,o,i)}let n="highlightChanges"in t,r="gutter"in t,s="collapseUnchanged"in t;if(n||r||s){let a=[],o=[];if(n||r){let i=this.a.state.facet(Af),c=r?t.gutter!==!1:i.markGutter,u=n?t.highlightChanges!==!1:i.highlightChanges;a.push(iA.reconfigure([Af.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?sA:[]])),o.push(iA.reconfigure([Af.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?sA:[]]))}if(s){let i=v_e.reconfigure(t.collapseUnchanged?y_e(t.collapseUnchanged):[]);a.push(i),o.push(i)}this.a.dispatch({effects:a}),this.b.dispatch({effects:o})}this.scheduleMeasure()}setupRevertControls(t,n,r){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=r,!t&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):t&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",s=>this.revertClicked(s)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let t=this.dom.ownerDocument.defaultView||window;this.measuring=t.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){Twn(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,n=t.firstChild,r=this.a.viewport,s=this.b.viewport;for(let a=0;a<this.chunks.length;a++){let o=this.chunks[a];if(o.fromA>r.to||o.fromB>s.to)break;if(o.fromA<r.from||o.fromB<s.from)continue;let i=this.a.lineBlockAt(o.fromA).top+"px";for(;n&&+n.dataset.chunk<a;)n=x_e(n);n&&n.dataset.chunk==String(a)?(n.style.top!=i&&(n.style.top=i),n=n.nextSibling):t.insertBefore(this.renderRevertButton(i,a),n)}for(;n;)n=x_e(n)}renderRevertButton(t,n){let r;if(this.renderRevert)r=this.renderRevert();else{r=document.createElement("button");let s=this.a.state.phrase("Revert this chunk");r.setAttribute("aria-label",s),r.setAttribute("title",s),r.textContent=this.revertToLeft?"⇜":"⇝"}return r.style.top=t,r.setAttribute("data-chunk",String(n)),r}revertClicked(t){let n=t.target,r;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(r=this.chunks[n.dataset.chunk])){let[s,a,o,i,c,u]=this.revertToA?[this.b,this.a,r.fromB,r.toB,r.fromA,r.toA]:[this.a,this.b,r.fromA,r.toA,r.fromB,r.toB],d=s.state.sliceDoc(o,Math.max(o,i-1));o!=i&&u<=a.state.doc.length&&(d+=s.state.lineBreak),a.dispatch({changes:{from:c,to:Math.min(a.state.doc.length,u),insert:d},userEvent:"revert"}),t.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function x_e(e){let t=e.nextSibling;return e.remove(),t}const CV=[400,401,403,404];function ta(e){return!e||typeof e!="object"?!1:"status"in e&&e.status===403||"statusCode"in e&&e.statusCode===403?!0:"message"in e?e.message.includes("status: 403"):!1}function dZe(e){if(!e||typeof e!="object")return!1;if("status"in e){const t=e.status;return CV.includes(t)}if("statusCode"in e){const t=e.statusCode;return CV.includes(t)}if("message"in e){const t=e.message;return CV.some(n=>t.includes(`status: ${n}`))}return!1}function $wn(e,t){return dZe(t)?!1:e<3}function Dwn(e,t){return t in e&&typeof e[t]=="function"}const Jo=e=>{const t=["listWorkspaces","getWorkspace"],n=gY.has("workspaces-v1"),r=t.every(s=>Dwn(e,s));return n&&r},fZe=e=>{if(!(!e||typeof e!="object")){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}},Lwn=(e,t)=>fZe(e)===t,Fwn=e=>{const t=fZe(e);return t!==void 0&&t>=400&&t<500},dZ=e=>{if(Lwn(e,501))return!0;if(e&&typeof e=="object"&&"message"in e){const t=e.message;return t.includes("Workspace v1 not supported")||t.includes("501")}return!1},Rv=(e,t)=>Fwn(t)||dZ(t)||dZe(t)?!1:e<3;function pZe(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=pZe(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hZe(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=pZe(e))&&(r&&(r+=" "),r+=t);return r}const zwn=(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},Bwn=(e,t)=>({classGroupId:e,validator:t}),mZe=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),RP="-",w_e=[],Uwn="arbitrary..",qwn=e=>{const t=Qwn(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Vwn(o);const i=o.split(RP),c=i[0]===""&&i.length>1?1:0;return gZe(i,c,t)},getConflictingClassGroupIds:(o,i)=>{if(i){const c=r[o],u=n[o];return c?u?zwn(u,c):c:u||w_e}return n[o]||w_e}}},gZe=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const u=gZe(e,t+1,a);if(u)return u}const o=n.validators;if(o===null)return;const i=t===0?e.join(RP):e.slice(t).join(RP),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(i))return d.classGroupId}},Vwn=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?Uwn+r:void 0})(),Qwn=e=>{const{theme:t,classGroups:n}=e;return Hwn(n,t)},Hwn=(e,t)=>{const n=mZe();for(const r in e){const s=e[r];Fre(s,n,r,t)}return n},Fre=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const o=e[a];Gwn(o,t,n,r)}},Gwn=(e,t,n,r)=>{if(typeof e=="string"){Wwn(e,t,n);return}if(typeof e=="function"){Zwn(e,t,n,r);return}Ywn(e,t,n,r)},Wwn=(e,t,n)=>{const r=e===""?t:bZe(t,e);r.classGroupId=n},Zwn=(e,t,n,r)=>{if(Xwn(e)){Fre(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Bwn(n,e))},Ywn=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];Fre(c,bZe(t,i),n,r)}},bZe=(e,t)=>{let n=e;const r=t.split(RP),s=r.length;for(let a=0;a<s;a++){const o=r[a];let i=n.nextPart.get(o);i||(i=mZe(),n.nextPart.set(o,i)),n=i}return n},Xwn=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Kwn=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in n?n[a]=o:s(a,o)}}},fZ="!",S_e=":",Jwn=[],O_e=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),eSn=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let o=0,i=0,c=0,u;const d=s.length;for(let b=0;b<d;b++){const y=s[b];if(o===0&&i===0){if(y===S_e){a.push(s.slice(c,b)),c=b+1;continue}if(y==="/"){u=b;continue}}y==="["?o++:y==="]"?o--:y==="("?i++:y===")"&&i--}const f=a.length===0?s:s.slice(c);let p=f,h=!1;f.endsWith(fZ)?(p=f.slice(0,-1),h=!0):f.startsWith(fZ)&&(p=f.slice(1),h=!0);const g=u&&u>c?u-c:void 0;return O_e(a,h,p,g)};if(t){const s=t+S_e,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):O_e(Jwn,!1,o,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},tSn=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const o=n[a],i=o[0]==="[",c=t.has(o);i||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},nSn=e=>({cache:Kwn(e.cacheSize),parseClassName:eSn(e),sortModifiers:tSn(e),...qwn(e)}),rSn=/\s+/,sSn=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,o=[],i=e.trim().split(rSn);let c="";for(let u=i.length-1;u>=0;u-=1){const d=i[u],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:b}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!b,x=r(y?g.substring(0,b):g);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=r(g),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=p.length===0?"":p.length===1?p[0]:a(p).join(":"),O=h?w+fZ:w,_=O+x;if(o.indexOf(_)>-1)continue;o.push(_);const C=s(x,y);for(let E=0;E<C.length;++E){const T=C[E];o.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},aSn=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=yZe(n))&&(s&&(s+=" "),s+=r);return s},yZe=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yZe(e[r]))&&(n&&(n+=" "),n+=t);return n},k_e=(e,...t)=>{let n,r,s,a;const o=c=>{const u=t.reduce((d,f)=>f(d),e());return n=nSn(u),r=n.cache.get,s=n.cache.set,a=i,i(c)},i=c=>{const u=r(c);if(u)return u;const d=sSn(c,n);return s(c,d),d};return a=o,(...c)=>a(aSn(...c))},oSn=[],No=e=>{const t=n=>n[e]||oSn;return t.isThemeGetter=!0,t},vZe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xZe=/^\((?:(\w[\w-]*):)?(.+)\)$/i,iSn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lSn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cSn=/\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$/,uSn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dSn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fSn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Cm=e=>iSn.test(e),mr=e=>!!e&&!Number.isNaN(Number(e)),Tm=e=>!!e&&Number.isInteger(Number(e)),TV=e=>e.endsWith("%")&&mr(e.slice(0,-1)),Gp=e=>lSn.test(e),wZe=()=>!0,pSn=e=>cSn.test(e)&&!uSn.test(e),zre=()=>!1,hSn=e=>dSn.test(e),mSn=e=>fSn.test(e),gSn=e=>!sn(e)&&!cn(e),bSn=e=>Xg(e,kZe,zre),sn=e=>vZe.test(e),Rb=e=>Xg(e,_Ze,pSn),__e=e=>Xg(e,_Sn,mr),ySn=e=>Xg(e,CZe,wZe),vSn=e=>Xg(e,EZe,zre),E_e=e=>Xg(e,SZe,zre),xSn=e=>Xg(e,OZe,mSn),lA=e=>Xg(e,TZe,hSn),cn=e=>xZe.test(e),nO=e=>Iv(e,_Ze),wSn=e=>Iv(e,EZe),C_e=e=>Iv(e,SZe),SSn=e=>Iv(e,kZe),OSn=e=>Iv(e,OZe),cA=e=>Iv(e,TZe,!0),kSn=e=>Iv(e,CZe,!0),Xg=(e,t,n)=>{const r=vZe.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Iv=(e,t,n=!1)=>{const r=xZe.exec(e);return r?r[1]?t(r[1]):n:!1},SZe=e=>e==="position"||e==="percentage",OZe=e=>e==="image"||e==="url",kZe=e=>e==="length"||e==="size"||e==="bg-size",_Ze=e=>e==="length",_Sn=e=>e==="number",EZe=e=>e==="family-name",CZe=e=>e==="number"||e==="weight",TZe=e=>e==="shadow",T_e=()=>{const e=No("color"),t=No("font"),n=No("text"),r=No("font-weight"),s=No("tracking"),a=No("leading"),o=No("breakpoint"),i=No("container"),c=No("spacing"),u=No("radius"),d=No("shadow"),f=No("inset-shadow"),p=No("text-shadow"),h=No("drop-shadow"),g=No("blur"),b=No("perspective"),y=No("aspect"),x=No("ease"),w=No("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[..._(),cn,sn],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],N=()=>[cn,sn,c],A=()=>[Cm,"full","auto",...N()],I=()=>[Tm,"none","subgrid",cn,sn],P=()=>["auto",{span:["full",Tm,cn,sn]},Tm,cn,sn],$=()=>[Tm,"auto",cn,sn],U=()=>["auto","min","max","fr",cn,sn],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...N()],q=()=>[Cm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],V=()=>[Cm,"screen","full","dvw","lvw","svw","min","max","fit",...N()],W=()=>[Cm,"screen","full","lh","dvh","lvh","svh","min","max","fit",...N()],D=()=>[e,cn,sn],Z=()=>[..._(),C_e,E_e,{position:[cn,sn]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",SSn,bSn,{size:[cn,sn]}],Q=()=>[TV,nO,Rb],G=()=>["","none","full",u,cn,sn],J=()=>["",mr,nO,Rb],ee=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[mr,TV,C_e,E_e],ce=()=>["","none",g,cn,sn],ye=()=>["none",mr,cn,sn],Y=()=>["none",mr,cn,sn],se=()=>[mr,cn,sn],te=()=>[Cm,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gp],breakpoint:[Gp],color:[wZe],container:[Gp],"drop-shadow":[Gp],ease:["in","out","in-out"],font:[gSn],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gp],shadow:[Gp],spacing:["px",mr],text:[Gp],"text-shadow":[Gp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Cm,sn,cn,y]}],container:["container"],columns:[{columns:[mr,sn,cn,i]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:C()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Tm,"auto",cn,sn]}],basis:[{basis:[Cm,"full","auto",i,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mr,Cm,"auto","initial","none",sn]}],grow:[{grow:["",mr,cn,sn]}],shrink:[{shrink:["",mr,cn,sn]}],order:[{order:[Tm,"first","last","none",cn,sn]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pbs:[{pbs:N()}],pbe:[{pbe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[i,"screen",...q()]}],"min-w":[{"min-w":[i,"screen","none",...q()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,nO,Rb]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,kSn,ySn]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",TV,sn]}],"font-family":[{font:[wSn,vSn,t]}],"font-features":[{"font-features":[sn]}],"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:[s,cn,sn]}],"line-clamp":[{"line-clamp":[mr,"none",cn,__e]}],leading:[{leading:[a,...N()]}],"list-image":[{"list-image":["none",cn,sn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",cn,sn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[mr,"from-font","auto",cn,Rb]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[mr,"auto",cn,sn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cn,sn]}],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",cn,sn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tm,cn,sn],radial:["",cn,sn],conic:[Tm,cn,sn]},OSn,xSn]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mr,cn,sn]}],"outline-w":[{outline:["",mr,nO,Rb]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,cA,lA]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",f,cA,lA]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[mr,Rb]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",p,cA,lA]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[mr,cn,sn]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[mr]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[cn,sn]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[mr]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",cn,sn]}],filter:[{filter:["","none",cn,sn]}],blur:[{blur:ce()}],brightness:[{brightness:[mr,cn,sn]}],contrast:[{contrast:[mr,cn,sn]}],"drop-shadow":[{"drop-shadow":["","none",h,cA,lA]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",mr,cn,sn]}],"hue-rotate":[{"hue-rotate":[mr,cn,sn]}],invert:[{invert:["",mr,cn,sn]}],saturate:[{saturate:[mr,cn,sn]}],sepia:[{sepia:["",mr,cn,sn]}],"backdrop-filter":[{"backdrop-filter":["","none",cn,sn]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[mr,cn,sn]}],"backdrop-contrast":[{"backdrop-contrast":[mr,cn,sn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mr,cn,sn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mr,cn,sn]}],"backdrop-invert":[{"backdrop-invert":["",mr,cn,sn]}],"backdrop-opacity":[{"backdrop-opacity":[mr,cn,sn]}],"backdrop-saturate":[{"backdrop-saturate":[mr,cn,sn]}],"backdrop-sepia":[{"backdrop-sepia":["",mr,cn,sn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",cn,sn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mr,"initial",cn,sn]}],ease:[{ease:["linear","initial",x,cn,sn]}],delay:[{delay:[mr,cn,sn]}],animate:[{animate:["none",w,cn,sn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,cn,sn]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Y()}],"scale-x":[{"scale-x":Y()}],"scale-y":[{"scale-y":Y()}],"scale-z":[{"scale-z":Y()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[cn,sn,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",cn,sn]}],"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":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mbs":[{"scroll-mbs":N()}],"scroll-mbe":[{"scroll-mbe":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pbs":[{"scroll-pbs":N()}],"scroll-pbe":[{"scroll-pbe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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",cn,sn]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[mr,nO,Rb,__e]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ESn=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:s={},override:a={}})=>(IO(e,"cacheSize",t),IO(e,"prefix",n),IO(e,"experimentalParseClassName",r),uA(e.theme,a.theme),uA(e.classGroups,a.classGroups),uA(e.conflictingClassGroups,a.conflictingClassGroups),uA(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),IO(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),dA(e.theme,s.theme),dA(e.classGroups,s.classGroups),dA(e.conflictingClassGroups,s.conflictingClassGroups),dA(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),NZe(e,s,"orderSensitiveModifiers"),e),IO=(e,t,n)=>{n!==void 0&&(e[t]=n)},uA=(e,t)=>{if(t)for(const n in t)IO(e,n,t[n])},dA=(e,t)=>{if(t)for(const n in t)NZe(e,t,n)},NZe=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},CSn=(e,...t)=>typeof e=="function"?k_e(T_e,e,...t):k_e(()=>ESn(T_e(),e),...t),TSn=Object.keys({...dMe,...iyt}),NSn=Object.keys(pyt),jSn=Object.keys(lyt),ASn=Object.keys(cyt),RSn=Object.keys(oyt),Ib=Object.keys(fyt),ISn=Object.keys(uyt).concat(Object.keys(dyt)),PSn=CSn({extend:{theme:{color:TSn,spacing:NSn,radius:RSn,leading:ASn,shadow:ISn},classGroups:{"font-size":[{text:jSn}],h:[{h:Ib}],w:[{w:Ib}],size:[{size:Ib}],"min-h":[{"min-h":Ib}],"min-w":[{"min-w":Ib}],"max-h":[{"max-h":Ib}],"max-w":[{"max-w":Ib}]}}});function K(...e){return PSn(hZe(e))}const Mi={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},tT="focus:outline-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",MSn="focus-within:outline-none focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",$Sn="rounded-md",Bre="bg-white/5 border-2 border-white/10 text-neutral4 hover:text-neutral5 hover:border-white/20 rounded-lg",Ure="outline-none focus-visible:outline-none focus-visible:border-accent1",qre="disabled:opacity-50 disabled:cursor-not-allowed",DSn={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},Te=({children:e,className:t,size:n="default",...r})=>l.jsx("span",{className:K("block",DSn[n],t),...r,children:e}),sd=Opt,zn=kpt,Bn=_pt,$n=S.forwardRef(({className:e,sideOffset:t=4,children:n,...r},s)=>l.jsx(Ept,{children:l.jsxs(xPe,{ref:s,sideOffset:t,className:K("z-50 overflow-hidden rounded-md bg-surface6 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...r,children:[n,l.jsx(Cpt,{className:"fill-surface6"})]})}));$n.displayName=xPe.displayName;const LSn={sm:`${Mi.sm} w-form-sm`,md:`${Mi.md} w-form-md`,lg:`${Mi.lg} w-form-lg`,default:`${Mi.default}`},FSn={sm:"sm",md:"default",lg:"lg",default:"default"},zSn={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},BSn="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",_s=xe.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:s="default",disabled:a,...o},i)=>l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{ref:i,disabled:a,"aria-label":typeof n=="string"?n:void 0,className:K(BSn,tT,zSn[s],LSn[r],a&&"active:scale-100",e),...o,children:l.jsx(Te,{size:FSn[r],children:t})})}),l.jsx($n,{children:n})]}));_s.displayName="IconButton";const USn={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},qSn={mono:"font-mono"},we=({as:e="p",className:t,variant:n="ui-md",font:r,...s})=>l.jsx(e,{className:K(USn[n],r&&qSn[r],t),...s}),An={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},Kg={visible:"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},VSn={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},jZe=({src:e,name:t,size:n="sm",interactive:r=!1})=>l.jsx("div",{className:K(VSn[n],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",An.all,r&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?l.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):l.jsx(we,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),_2=({copiedDuration:e=1500}={})=>{const[t,n]=S.useState(!1);return{isCopied:t,copyToClipboard:s=>{s&&navigator.clipboard.writeText(s).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},QSn=EAt({style:aK.coldarkDark,customStyle:{margin:0,backgroundColor:"black"}}),HSn=()=>l.jsx(Vwt,{remarkPlugins:[O$e],className:"aui-md",components:ZSn}),N_e=S.memo(HSn),GSn=({language:e,code:t})=>{const{isCopied:n,copyToClipboard:r}=_2(),s=()=>{!t||n||r(t)};return l.jsxs("div",{style:{background:"hsl(0 0% 100% / 0.06)",borderTopRightRadius:"0.5rem",borderTopLeftRadius:"0.5rem",marginTop:"0.5rem",border:"1px solid hsl(0 0% 20.4%)",borderBottom:"none"},className:"flex items-center justify-between gap-4 px-4 py-2 text-sm font-semibold text-white",children:[l.jsx("span",{className:"lowercase [&>span]:text-xs",children:e}),l.jsx(_s,{variant:"light",size:"md",tooltip:"Copy",onClick:s,children:l.jsxs("span",{className:"grid",children:[l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",n?"scale-100":"scale-0"),children:l.jsx(Es,{size:14})},"checkmark"),l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",n?"scale-0":"scale-100"),children:l.jsx(Li,{size:14})},"copy")]})})]})},WSn=({alt:e,src:t,...n})=>{const[r,s]=S.useState(!1);return S.useEffect(()=>{s(!1)},[t]),r||!t?l.jsxs("div",{children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",width:"150",height:"150",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})}),l.jsx("p",{className:"text-xs italic text-neutral3 -mt-2.5 mb-2.5",children:"Image link is broken"})]}):l.jsx("img",{src:t,alt:e,...n,onError:()=>{s(!0)}})},ZSn=Twt({h1:({className:e,...t})=>l.jsx("h1",{className:K("mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",e),...t,style:{marginBottom:"2rem"}}),h2:({className:e,...t})=>l.jsx("h2",{className:K("mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"2rem"}}),h3:({className:e,...t})=>l.jsx("h3",{className:K("scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h4:({className:e,...t})=>l.jsx("h4",{className:K("scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h5:({className:e,...t})=>l.jsx("h5",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),h6:({className:e,...t})=>l.jsx("h6",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),p:({className:e,...t})=>l.jsx("p",{className:K("leading-7 first:mt-0 last:mb-0",e),...t}),a:({className:e,...t})=>l.jsx("a",{className:K("text-neutral6 font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>l.jsx("blockquote",{className:K("border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>l.jsx("ul",{className:K("my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>l.jsx("ol",{className:K("my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>l.jsx("hr",{className:K("my-5 border-b",e),...t}),table:({className:e,...t})=>l.jsx("table",{className:K("my-5 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>l.jsx("th",{className:K("bg-surface4 px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),td:({className:e,...t})=>l.jsx("td",{className:K("border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>l.jsx("tr",{className:K("m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",e),...t}),sup:({className:e,...t})=>l.jsx("sup",{className:K("[&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>l.jsx("pre",{...t,style:{borderBottomRightRadius:"0.5rem",borderBottomLeftRadius:"0.5rem",background:"transparent",fontSize:"0.875rem",marginBottom:"0.5rem",border:"1px solid hsl(0 0% 20.4%)"},className:K("overflow-x-auto p-4 text-white",e)}),code:function({className:t,...n}){const r=XMe();return l.jsxs("pre",{style:{fontSize:"0.875rem",display:"inline"},children:[l.jsx("code",{className:K(!r&&"bg-surface4 rounded border font-semibold",t),...n,style:{fontWeight:"400",paddingBlock:r?0:"0.1em",paddingInline:r?0:"0.3em"}})," "]})},CodeHeader:GSn,SyntaxHighlighter:QSn,img:WSn}),YSn=({reason:e,tripwire:t})=>{const[n,r]=S.useState(!1),s=t&&(t.retry!==void 0||t.tripwirePayload||t.processorId);return l.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-950/20 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3 p-4",children:[l.jsx(XE,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm font-medium text-amber-200 mb-1",children:"Content Blocked"}),l.jsx("p",{className:"text-sm text-amber-300/90",children:e})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>r(!n),className:"w-full flex items-center gap-2 px-4 py-2 text-xs text-amber-400/70 hover:text-amber-400 hover:bg-amber-900/20 transition-colors border-t border-amber-500/20",children:[n?l.jsx(fs,{className:"w-3.5 h-3.5"}):l.jsx(xs,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Details"})]}),n&&l.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-amber-500/20 bg-amber-950/10",children:[t.retry!==void 0&&l.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[l.jsx(YE,{className:"w-3.5 h-3.5 text-amber-400/60"}),l.jsxs("span",{className:"text-xs text-amber-300/70",children:["Retry:"," ",t.retry?l.jsx("span",{className:"text-green-400",children:"Allowed"}):l.jsx("span",{className:"text-red-400",children:"Not allowed"})]})]}),t.processorId&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(MX,{className:"w-3.5 h-3.5 text-amber-400/60"}),l.jsxs("span",{className:"text-xs text-amber-300/70",children:["Processor:"," ",l.jsx("code",{className:"px-1.5 py-0.5 rounded bg-amber-900/30 text-amber-200 font-mono",children:t.processorId})]})]}),t.tripwirePayload!==void 0&&t.tripwirePayload!==null&&l.jsxs("div",{className:"pt-1",children:[l.jsx("p",{className:"text-xs text-amber-400/60 mb-1.5",children:"Metadata:"}),l.jsx("pre",{className:"text-xs text-amber-200/80 bg-amber-900/30 rounded p-2 overflow-x-auto font-mono",children:String(JSON.stringify(t.tripwirePayload,null,2))})]})]})]})]})},$o=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),l.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),XSn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),l.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),Vre=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),Qre=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),Uo=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),E2=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:l.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_22095",children:l.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),Hre=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[l.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"white"}),l.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"white"}),l.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"white"}),l.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"white"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_20513",children:l.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),KSn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),l.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),l.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),AZe=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),Gre=e=>l.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),JSn=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),zi=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),ES=e=>l.jsx(eyt,{...e}),yl=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),Zu=e=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),l.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),e1n=e=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function $0(e){return l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),l.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),l.jsx("path",{d:"M15 2v2"}),l.jsx("path",{d:"M15 20v2"}),l.jsx("path",{d:"M2 15h2"}),l.jsx("path",{d:"M2 9h2"}),l.jsx("path",{d:"M20 15h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M9 2v2"}),l.jsx("path",{d:"M9 20v2"})]})}const t1n={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},n1n={warning:bl,destructive:$d,info:Ri},Ld=({children:e,variant:t="destructive",className:n})=>{const r=n1n[t];return l.jsx("div",{className:K(t1n[t],"p-3 rounded-md border shadow-sm",An.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",n),children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Te,{className:"mt-0.5 flex-shrink-0",children:l.jsx(r,{})}),l.jsx("div",{className:"text-neutral4",children:e})]})})},Fd=({children:e,as:t="h5"})=>l.jsx(we,{as:t,variant:"ui-md",className:"font-semibold",children:e}),Pg=({children:e,as:t="p"})=>l.jsx(we,{as:t,variant:"ui-sm",children:e}),r1n={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},s1n={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},_t=({icon:e,variant:t="default",className:n,children:r,...s})=>l.jsxs("div",{className:K("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",An.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":r1n[t],n),...s,children:[e&&l.jsx("span",{className:s1n[t],children:l.jsx(Te,{children:e})}),r]}),a1n=()=>{const e=tr(({part:o})=>o),[t,n]=S.useState(!1),r=e.text||"",s=e.metadata||{};if(s?.status==="tripwire")return l.jsx(YSn,{reason:r,tripwire:s.tripwire});if(s?.status==="warning")return l.jsxs(Ld,{variant:"warning",children:[l.jsx(Fd,{as:"h5",children:"Warning"}),l.jsx(Pg,{as:"p",children:r})]});if(s?.status==="error")return l.jsxs(Ld,{variant:"destructive",children:[l.jsx(Fd,{as:"h5",children:"Error"}),l.jsx(Pg,{as:"p",children:r})]});const a=s?.completionResult;if(a)return l.jsxs("div",{className:"mb-2 space-y-2",children:[l.jsxs("button",{onClick:()=>n(o=>!o),className:"flex items-center gap-2",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",t?"rotate-90":"rotate-180")})}),l.jsxs(_t,{variant:"info",icon:l.jsx(NX,{}),children:[t?"Show":"Hide"," completion check"]})]}),!t&&l.jsxs(Ld,{variant:"info",children:[l.jsx(Fd,{as:"h5",children:a?.passed?"Complete":"Not Complete"}),l.jsx(N_e,{})]})]});try{const o=r.trim();if(o.startsWith("__ERROR__:")){const i=o.substring(10);return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[l.jsx($d,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),l.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i})]})]})}else if(o.startsWith("Error:")){const i=o.substring(6).trim();return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[l.jsx($d,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),l.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i})]})]})}return l.jsx(N_e,{})}catch{return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[l.jsx($d,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),l.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:String(r)})]})]})}},Cc="mastra_workspace",Ef={FILESYSTEM:{READ_FILE:`${Cc}_read_file`,WRITE_FILE:`${Cc}_write_file`,EDIT_FILE:`${Cc}_edit_file`,LIST_FILES:`${Cc}_list_files`,DELETE:`${Cc}_delete`,FILE_STAT:`${Cc}_file_stat`,MKDIR:`${Cc}_mkdir`},SANDBOX:{EXECUTE_COMMAND:`${Cc}_execute_command`,GET_PROCESS_OUTPUT:`${Cc}_get_process_output`,KILL_PROCESS:`${Cc}_kill_process`},SEARCH:{SEARCH:`${Cc}_search`,INDEX:`${Cc}_index`}},o1n={duration:5e3,cancel:{label:l.jsx(Te,{children:l.jsx(Pr,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card [&>[data-content]]:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"!bg-transparent hover:!bg-surface2 !border-none !rounded-md !p-1.5 !m-0 !text-neutral3 hover:!text-neutral6 shrink-0 transition-all",actionButton:"!bg-white flex items-center justify-center font-medium !text-black order-last hover:opacity-80"}};function Gc(e){const{classNames:t,...n}=o1n,{classNames:r,...s}=e||{};return{...n,classNames:{...t,title:K(t?.title,r?.title),toast:K(t?.toast,r?.toast),cancelButton:K(t?.cancelButton,r?.cancelButton),actionButton:K(t?.actionButton,r?.actionButton),description:K(t?.description,r?.description)},...s}}const qe=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Di(n,Gc(t)));if(xe.isValidElement(e))return Di(e,Gc(t));if(typeof e=="string")return Di(e,Gc(t));throw new Error("Invalid message type")};qe.success=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent1 shrink-0",children:l.jsx(jX,{})}),classNames:{...t.classNames,toast:K("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.success(e,Gc(n));case"object":return e.forEach(r=>Di.success(r,Gc(n)))}};qe.error=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent2 shrink-0",children:l.jsx(ky,{})}),classNames:{...t.classNames,toast:K("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.error(e,Gc(n));case"object":return e.forEach(r=>Di.error(r,Gc(n)))}};qe.warning=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent6 shrink-0",children:l.jsx($d,{})}),classNames:{...t.classNames,toast:K("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.warning(e,Gc(n));case"object":return e.forEach(r=>Di.warning(r,Gc(n)))}};qe.info=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent3 shrink-0",children:l.jsx(Ri,{})}),classNames:{...t.classNames,toast:K("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.info(e,Gc(n));case"object":return e.forEach(r=>Di.info(r,Gc(n)))}};qe.custom=(e,t={})=>Di(e,Gc(t));qe.dismiss=e=>{e&&Di.dismiss(e)};qe.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:s,onError:a,options:o={}})=>Di.promise(e,{loading:t??"Loading...",success:i=>(s?.(i),n),error:i=>(a?.(i),r||i?.message||"Error..."),...Gc(o)});function Zd({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=S.useState(!1),s=S.useRef(null),a=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{qe.success(t),r(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{qe.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:a}}const i1n={sm:`${Mi.sm} text-ui-sm px-[.75em]`,md:`${Mi.md} text-ui-md px-[.75em]`,default:`${Mi.default} text-ui-md px-[.85em] `,lg:`${Mi.lg} text-ui-lg px-[1em] `},l1n={default:"bg-white/10 border-2 border-transparent hover:text-white hover:bg-white/15 active:bg-white/20 text-neutral4",primary:"bg-white/20 border-2 border-transparent hover:text-white hover:bg-white/25 active:bg-white/30 text-neutral5",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral4 hover:bg-white/10 active:bg-white/15 text-neutral3",inputLike:Bre,light:"",outline:""},c1n=K("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",qre,Ure),u1n={light:"default",outline:"default"};function d1n(e){return u1n[e]??e}function CS(e){const t=d1n(e?.variant||"default"),n=e?.size||"default";return K(c1n,l1n[t],i1n[n],e?.iconOnly&&"[&>svg]:opacity-75")}function RZe(e){const t=[];return xe.Children.forEach(e,n=>{xe.isValidElement(n)&&n.type===xe.Fragment?t.push(...RZe(n.props.children)):t.push(n)}),t}function f1n(e){const t=RZe(e);return t.length>0&&t.every(n=>xe.isValidElement(n))}const me=xe.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:s,children:a,...o},i)=>{const c=t||"button",u=f1n(a);return l.jsx(c,{ref:i,disabled:s,className:K(CS({variant:r,size:n,iconOnly:u}),e),...o,children:a})});me.displayName="Button";const nv=xe.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx(me,{ref:n,...t})}),e&&l.jsx($n,{children:e})]}));nv.displayName="ButtonWithTooltip";function Zo({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:s}){const[a,o]=S.useState(!1),{handleCopy:i}=Zd({text:e,copyMessage:t}),c=()=>{i(),o(!0),setTimeout(()=>o(!1),2e3)};return l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx(me,{onClick:c,type:"button",size:r,className:s,"aria-label":a?"Copied!":n,children:a?l.jsx(Es,{}):l.jsx(Li,{})})}),l.jsx($n,{children:a?"Copied!":n})]})}const p1n=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,h1n=Qt.mark({class:"cm-variable-highlight"}),j_e=new y2e({regexp:p1n,decoration:()=>h1n}),m1n=Pa.fromClass(class{decorations;constructor(e){this.decorations=j_e.createDeco(e)}update(e){this.decorations=j_e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),g1n=m1n;function b1n(e,t=5){if(!e?.properties)return[];const n=[];function r(s,a,o){if(o>t)return;const i=Array.isArray(s.type)?s.type.join(" | "):s.type;if(n.push({path:a,label:a,description:s.description??s.title,type:i}),s.properties)for(const[c,u]of Object.entries(s.properties))r(u,`${a}.${c}`,o+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))r(u,`${a}[].${c}`,o+1)}for(const[s,a]of Object.entries(e.properties))r(a,s,1);return n}function y1n(e){const t=b1n(e);return n4e({override:[v1n(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function v1n(e){return t=>{const r=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!r)return null;const s=r[1]??"",a=t.pos-s.length,o=s?e.filter(c=>c.path.toLowerCase().startsWith(s.toLowerCase())):e;if(o.length===0)return null;const i=o.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,p)=>{const b=u.state.sliceDoc(p,p+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:p,insert:b},selection:{anchor:f+b.length}})}}));return{from:a,options:i,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const Jg=()=>S.useMemo(()=>{const e=T$({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[re.className,re.propertyName]},{tag:re.heading,color:"#ff79c6",fontWeight:"bold"},{tag:[re.heading1,re.heading2,re.heading3,re.heading4,re.heading5,re.heading6],color:"#ff79c6",fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic",color:"#f8f8f2"},{tag:re.strong,fontWeight:"bold",color:"#f8f8f2"},{tag:re.link,color:"#8be9fd",textDecoration:"underline"},{tag:re.url,color:"#8be9fd"},{tag:re.monospace,color:"#f1fa8c"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.quote,fontStyle:"italic",color:"#6272a4"}]}),t=it.theme({".cm-editor":{colorScheme:"dark",backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"#939393"},".cm-tooltip-autocomplete":{backgroundColor:"#282a36",border:"1px solid #44475a",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.4)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"#f8f8f2"},".cm-completionDetail":{color:"#A1A1AA",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"#282a36",border:"1px solid #44475a",color:"#6272a4",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"#44475a",color:"#f8f8f2"},".cm-line .cm-variable-highlight":{color:"#F59E0B !important",fontWeight:"500"}});return[e,t]},[]),Vs=S.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:s,language:a="json",highlightVariables:o=!1,placeholder:i,wordWrap:c=!1,schema:u,autoFocus:d,...f},p)=>{const h=Jg(),g=e?JSON.stringify(e,null,2):t??"",b=S.useMemo(()=>{const y=[];return a==="json"?y.push(Vc):a==="markdown"&&(y.push(gJ({base:Dy,codeLanguages:kLe})),y.push(it.lineWrapping)),o&&a==="markdown"&&y.push(g1n),u&&a==="markdown"&&y.push(y1n(u)),y},[a,o,u]);return l.jsxs("div",{className:K("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...f,children:[r&&l.jsx(Zo,{content:g,className:"absolute top-2 right-2 z-20"}),l.jsx(Xc,{ref:p,value:g,theme:h,extensions:b,onChange:n,"aria-label":"Code editor",placeholder:i,height:"100%",style:{height:"100%"},autoFocus:d})]})});async function x1n(e,t){const{codeToTokens:n,bundledLanguages:r}=await Qe(async()=>{const{codeToTokens:a,bundledLanguages:o}=await import("./index-cwBsVttq.js");return{codeToTokens:a,bundledLanguages:o}},__vite__mapDeps([26,1]),import.meta.url);if(!(t in r))return null;const{tokens:s}=await n(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}const C2=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:s=!0,extraInfo:a,"data-testid":o})=>{const[i,c]=S.useState(t);return S.useEffect(()=>{c(t)},[t]),l.jsxs("div",{className:"mb-4","data-testid":o,children:[l.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[l.jsxs("button",{onClick:s?()=>c(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!s,type:"button",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",i?"rotate-90":"rotate-180")})}),l.jsx(_t,{icon:n,children:r})]}),a]}),!i&&l.jsx("div",{className:"pt-2",children:l.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})},as=vM,IZe=ije,w1n=xM,PZe=S.forwardRef(({className:e,...t},n)=>l.jsx($E,{ref:n,className:K("fixed inset-0 z-50 bg-overlay 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",e),...t}));PZe.displayName=$E.displayName;const ts=S.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(w1n,{children:[l.jsx(PZe,{}),l.jsxs(DE,{ref:r,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,l.jsxs(OM,{className:K("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[l.jsx(Pr,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ts.displayName=DE.displayName;const os=({className:e,...t})=>l.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});os.displayName="DialogHeader";const TS=({className:e,...t})=>l.jsx("div",{className:K("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});TS.displayName="DialogFooter";const is=({className:e,...t})=>l.jsx("div",{className:K("overflow-y-auto px-6 max-h-[50vh]",e),...t});is.displayName="DialogBody";const ns=S.forwardRef(({className:e,...t},n)=>l.jsx(wM,{ref:n,className:K("text-ui-md font-medium",e),...t}));ns.displayName=wM.displayName;const Js=S.forwardRef(({className:e,...t},n)=>l.jsx(SM,{ref:n,className:K("sr-only",e),...t}));Js.displayName=SM.displayName;const S1n=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let s=null;if(r)try{s=typeof r=="object"?l.jsx(Vs,{data:r}):l.jsx(Vs,{data:JSON.parse(r)})}catch{s=l.jsx("pre",{className:"whitespace-pre-wrap",children:r})}return l.jsx(as,{open:t,onOpenChange:n,children:l.jsxs(ts,{children:[l.jsxs(os,{children:[l.jsx(ns,{children:"Agent Network Metadata"}),l.jsx(Js,{children:"View the metadata of the agent's network choice."})]}),l.jsxs(is,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(we,{className:"text-neutral3",children:"Selection Reason"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),s&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(we,{className:"text-neutral3",children:"Input"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:s})]})]})]})})},Wre=({selectionReason:e,input:t})=>{const[n,r]=S.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(_s,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(s=>!s),children:l.jsx(jbt,{className:"text-neutral3 size-5"})}),l.jsx(S1n,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},MZe=S.createContext(void 0);function O1n({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:o,isRunning:i,toolCallApprovals:c,networkToolCallApprovals:u}){return l.jsx(MZe.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:o,isRunning:i,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function k1n(){const e=S.useContext(MZe);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const nT=({toolCalled:e,toolCallId:t,toolApprovalMetadata:n,toolName:r,isNetwork:s,isGenerateMode:a})=>{const{approveToolcall:o,declineToolcall:i,approveToolcallGenerate:c,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:f,approveNetworkToolcall:p,declineNetworkToolcall:h,networkToolCallApprovals:g}=k1n(),b=()=>{s?p(r,n?.runId):a?c(t):o(t)},y=()=>{s?h(r,n?.runId):a?u(t):i(t)},x=s?g?.[n?.runId?`${n.runId}-${r}`:r]?.status:f?.[t]?.status;return n&&!e?l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsxs(me,{onClick:b,disabled:d||!!x,className:x==="approved"?"!text-accent1":"",children:[l.jsx(Te,{children:l.jsx(Es,{})}),"Approve"]}),l.jsxs(me,{onClick:y,disabled:d||!!x,className:x==="declined"?"!text-accent2":"",children:[l.jsx(Te,{children:l.jsx(Pr,{})}),"Decline"]})]})]}):null},_1n=({toolName:e,args:t,result:n,metadata:r,toolOutput:s,toolCallId:a,toolApprovalMetadata:o,suspendPayload:i,isNetwork:c,toolCalled:u})=>{let d=null;try{const{__mastraMetadata:y,...x}=typeof t=="object"?t:JSON.parse(t);d=l.jsx(Vs,{data:x,"data-testid":"tool-args"})}catch{d=l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:t})}let f=typeof n=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:n}):l.jsx(Vs,{data:n,"data-testid":"tool-result"}),p=typeof i=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:i}):l.jsx(Vs,{data:i,"data-testid":"tool-suspend-payload"});const h=r?.mode==="network"?r.selectionReason:void 0,g=r?.mode==="network"?r.agentInput:void 0,b=u??(n||s.length>0);return l.jsx(C2,{"data-testid":"tool-badge",icon:l.jsx(zi,{className:"text-accent6"}),title:e,extraInfo:r?.mode==="network"&&l.jsx(Wre,{selectionReason:h||"",input:g}),initialCollapsed:!(o??i),children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),d]}),p!==void 0&&i&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool suspend payload"}),p]}),f!==void 0&&n&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool result"}),f]}),s.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool output"}),l.jsx("div",{className:"h-40 overflow-y-auto",children:l.jsx(Vs,{data:s,"data-testid":"tool-output"})})]}),l.jsx(nT,{toolCalled:b,toolCallId:a,toolApprovalMetadata:o,toolName:e,isNetwork:c,isGenerateMode:r?.mode==="generate"})]})})},$Ze=S.createContext({Link:S.forwardRef(()=>null),navigate:()=>{},paths:{agentLink:()=>"",agentsLink:()=>"",agentToolLink:()=>"",agentSkillLink:()=>"",agentThreadLink:()=>"",agentNewThreadLink:()=>"",workflowsLink:()=>"",workflowLink:()=>"",networkLink:()=>"",networkNewThreadLink:()=>"",networkThreadLink:()=>"",scorerLink:()=>"",cmsScorersCreateLink:()=>"",cmsScorerEditLink:()=>"",cmsAgentCreateLink:()=>"",cmsAgentEditLink:()=>"",promptBlockLink:()=>"",promptBlocksLink:()=>"",cmsPromptBlockCreateLink:()=>"",cmsPromptBlockEditLink:()=>"",toolLink:()=>"",skillLink:()=>"",workspacesLink:()=>"",workspaceLink:()=>"",workspaceSkillLink:()=>"",processorsLink:()=>"",processorLink:()=>"",mcpServerLink:()=>"",mcpServerToolLink:()=>"",workflowRunLink:()=>"",datasetLink:()=>"",datasetItemLink:()=>"",datasetExperimentLink:()=>""}}),E1n=({children:e,Link:t,navigate:n,paths:r})=>l.jsx($Ze.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),Gt=()=>{const e=S.useContext($Ze);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},C1n=e=>{switch(e){case"running":return"bg-green-500";case"starting":case"initializing":return"bg-yellow-500";case"stopped":case"paused":return"bg-gray-500";case"error":case"failed":return"bg-red-500";default:return"bg-accent6"}},T1n=(e,t)=>{const[n,r]=S.useState(0),s=S.useRef(null);return S.useEffect(()=>{if(e){r(0),s.current=t||Date.now();const a=setInterval(()=>{s.current&&r(Date.now()-s.current)},100);return()=>clearInterval(a)}else s.current=null},[e,t]),n},N1n=({command:e,content:t,maxHeight:n="20rem",onCopy:r,isCopied:s})=>{const a=S.useRef(null);return S.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[t]),l.jsxs("div",{className:"rounded-md border border-border1 overflow-hidden",children:[e&&l.jsxs("div",{className:"px-3 py-2 bg-surface3 border-b border-border1 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"text-neutral6 text-xs shrink-0",children:"$"}),l.jsx("code",{className:"text-xs text-neutral-300 font-mono truncate",children:e})]}),r&&l.jsx(_s,{variant:"light",size:"sm",tooltip:"Copy output",onClick:r,className:"shrink-0",children:l.jsxs("span",{className:"grid",children:[l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-100":"scale-0"),children:l.jsx(Es,{size:14})}),l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-0":"scale-100"),children:l.jsx(Li,{size:14})})]})})]}),l.jsx("pre",{ref:a,style:{maxHeight:n},className:"overflow-x-auto overflow-y-auto p-3 text-sm text-neutral-300 font-mono whitespace-pre-wrap bg-black",children:t||l.jsx("span",{className:"text-neutral6 italic",children:"No output"})})]})},j1n=({toolName:e,args:t,result:n,metadata:r,toolCallId:s,toolApprovalMetadata:a,isNetwork:o,toolCalled:i})=>{const c=tr(W=>W.message),u=S.useMemo(()=>c.content.filter(D=>D.type==="data"),[c.content]),[d,f]=S.useState(!1),{isCopied:p,copyToClipboard:h}=_2(),{Link:g}=Gt(),b=u.find(W=>W.name==="sandbox-command"&&W.data?.toolCallId===s);let y="";try{const W=typeof t=="object"?t:JSON.parse(t);e===Ef.SANDBOX.EXECUTE_COMMAND?y=W.command||"":(e===Ef.SANDBOX.GET_PROCESS_OUTPUT||e===Ef.SANDBOX.KILL_PROCESS)&&(y=b?.data?.command||`PID ${W.pid}`)}catch{y=e}const x=u.filter(W=>(W.name==="sandbox-stdout"||W.name==="sandbox-stderr")&&W.data?.toolCallId===s),w=u.find(W=>W.name==="workspace-metadata"&&W.data?.toolCallId===s),O=w?.data,_=u.find(W=>W.name==="sandbox-exit"&&W.data?.toolCallId===s),C=!!_||typeof n=="string",E=!!w,T=E&&!C,N=i??(C||E),A=_?.data?.exitCode,I=_?.data?.success,P=_?.data?.executionTimeMs,$=_?.data?.killed,L=x.map(W=>W.data?.output||"").join("")||(typeof n=="string"?n:""),B=e===Ef.SANDBOX.EXECUTE_COMMAND?"Execute Command":e===Ef.SANDBOX.GET_PROCESS_OUTPUT?"Get Process Output":e===Ef.SANDBOX.KILL_PROCESS?"Kill Process":e,H=x[0]?.data?.timestamp,q=T1n(T,H),V=()=>{!L||p||h(L)};return l.jsxs("div",{className:"mb-4","data-testid":"sandbox-execution-badge",children:[l.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[l.jsxs("button",{onClick:()=>f(W=>!W),className:"flex items-center gap-2 min-w-0",type:"button",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",d?"rotate-90":"rotate-180")})}),l.jsx(_t,{icon:l.jsx(Dbt,{className:"text-accent6",size:16}),children:B}),O?.sandbox&&l.jsxs(g,{href:O.id?`/workspaces/${O.id}`:"/workspaces",className:"flex items-center gap-1.5 text-xs text-neutral6 px-1.5 py-0.5 rounded bg-surface3 border border-border1 hover:bg-surface4 hover:border-border2 transition-colors",onClick:W=>W.stopPropagation(),children:[l.jsx("span",{className:K("w-1.5 h-1.5 rounded-full",C1n(O.sandbox.status))}),l.jsx("span",{children:O.sandbox.name||O.sandbox.provider})]})]}),l.jsx("div",{className:"flex items-center gap-2",children:T?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-accent6",children:[l.jsx("span",{className:"w-1.5 h-1.5 bg-accent6 rounded-full animate-pulse"}),l.jsx("span",{className:"animate-pulse",children:"running"})]}),l.jsxs("span",{className:"text-neutral6 text-xs tabular-nums",children:[q,"ms"]})]}):l.jsxs(l.Fragment,{children:[A!==void 0&&(I?l.jsx(Es,{className:"text-green-400",size:14}):$?l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-orange-500/20 text-orange-400",children:"killed"}):l.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-red-500/20 text-red-400",children:["exit ",A]})),P!==void 0&&l.jsxs("span",{className:"text-neutral6 text-xs",children:[P,"ms"]})]})})]}),!d&&l.jsxs("div",{className:"pt-2",children:[(L||y)&&l.jsx(N1n,{command:y,content:L,onCopy:L?V:void 0,isCopied:p}),l.jsx(nT,{toolCalled:N,toolCallId:s,toolApprovalMetadata:a,toolName:e,isNetwork:o,isGenerateMode:r?.mode==="generate"})]})]})},A1n=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:s,isNetwork:a,toolCalled:o})=>{const[i,c]=S.useState(!s),{isCopied:u,copyToClipboard:d}=_2();S.useEffect(()=>{c(!s)},[s]);const{Link:f}=Gt();let p={path:"."};try{p=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:h=".",maxDepth:g,showHidden:b,dirsOnly:y,exclude:x,extension:w}=p,O=[];g!==void 0&&g!==3&&O.push(`depth: ${g}`),b&&O.push("hidden"),y&&O.push("dirs only"),x&&O.push(`exclude: ${x}`),w&&O.push(`ext: ${w}`);let _="",C="";if(typeof n=="string"&&n){const $=n.lastIndexOf(`
|
|
436
|
+
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!a&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=b,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=h,u.ReadableStreamStreamer=g,r.jQuery&&((s=r.jQuery).fn.parse=function(N){var A=N.config||{},I=[];return this.each(function(U){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)I.push({file:this.files[L],inputElem:this,instanceConfig:s.extend({},A)})}),P(),this;function P(){if(I.length===0)T(N.complete)&&N.complete();else{var U,L,B,H,q=I[0];if(T(N.before)){var V=N.before(q.file,q.inputElem);if(typeof V=="object"){if(V.action==="abort")return U="AbortError",L=q.file,B=q.inputElem,H=V.reason,void(T(N.error)&&N.error({name:U},L,B,H));if(V.action==="skip")return void $();typeof V.config=="object"&&(q.instanceConfig=s.extend(q.instanceConfig,V.config))}else if(V==="skip")return void $()}var W=q.instanceConfig.complete;q.instanceConfig.complete=function(D){T(W)&&W(D,q.file,q.inputElem),$()},u.parse(q.file,q.instanceConfig)}}function $(){I.splice(0,1),P()}}),o&&(r.onmessage=function(N){N=N.data,u.WORKER_ID===void 0&&N&&(u.WORKER_ID=N.workerId),typeof N.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(N.input,N.config),finished:!0}):(r.File&&N.input instanceof File||N.input instanceof Object)&&(N=u.parse(N.input,N.config))&&r.postMessage({workerId:u.WORKER_ID,results:N,finished:!0})}),(f.prototype=Object.create(d.prototype)).constructor=f,(p.prototype=Object.create(d.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(g.prototype=Object.create(d.prototype)).constructor=g,u})})(fR)),fR.exports}var V0n=q0n();const UWe=Ju(V0n);var t_e=1,Q0n=.9,H0n=.8,G0n=.17,SV=.1,OV=.999,W0n=.9999,Z0n=.99,Y0n=/[\\\/_+.#"@\[\(\{&]/,X0n=/[\\\/_+.#"@\[\(\{&]/g,K0n=/[\s-]/,qWe=/[\s-]/g;function oZ(e,t,n,r,s,a,o){if(a===t.length)return s===e.length?t_e:Z0n;var i=`${s},${a}`;if(o[i]!==void 0)return o[i];for(var c=r.charAt(a),u=n.indexOf(c,s),d=0,f,p,h,g;u>=0;)f=oZ(e,t,n,r,u+1,a+1,o),f>d&&(u===s?f*=t_e:Y0n.test(e.charAt(u-1))?(f*=H0n,h=e.slice(s,u-1).match(X0n),h&&s>0&&(f*=Math.pow(OV,h.length))):K0n.test(e.charAt(u-1))?(f*=Q0n,g=e.slice(s,u-1).match(qWe),g&&s>0&&(f*=Math.pow(OV,g.length))):(f*=G0n,s>0&&(f*=Math.pow(OV,u-s))),e.charAt(u)!==t.charAt(a)&&(f*=W0n)),(f<SV&&n.charAt(u-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(u-1)!==r.charAt(a))&&(p=oZ(e,t,n,r,u+1,a+2,o),p*SV>f&&(f=p*SV)),f>d&&(d=f),u=n.indexOf(c,u+1);return o[i]=d,d}function n_e(e){return e.toLowerCase().replace(qWe," ")}function J0n(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,oZ(e,t,n_e(e),n_e(t),0,0,{})}var tO='[cmdk-group=""]',kV='[cmdk-group-items=""]',ewn='[cmdk-group-heading=""]',VWe='[cmdk-item=""]',r_e=`${VWe}:not([aria-disabled="true"])`,iZ="cmdk-item-select",qx="data-value",twn=(e,t,n)=>J0n(e,t,n),QWe=S.createContext(void 0),eT=()=>S.useContext(QWe),HWe=S.createContext(void 0),Mre=()=>S.useContext(HWe),GWe=S.createContext(void 0),WWe=S.forwardRef((e,t)=>{let n=Vx(()=>{var z,R;return{search:"",value:(R=(z=e.value)!=null?z:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Vx(()=>new Set),s=Vx(()=>new Map),a=Vx(()=>new Map),o=Vx(()=>new Set),i=ZWe(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:g,disablePointerSelection:b=!1,vimBindings:y=!0,...x}=e,w=io(),O=io(),_=io(),C=S.useRef(null),E=fwn();ev(()=>{if(d!==void 0){let z=d.trim();n.current.value=z,T.emit()}},[d]),ev(()=>{E(6,U)},[]);let T=S.useMemo(()=>({subscribe:z=>(o.current.add(z),()=>o.current.delete(z)),snapshot:()=>n.current,setState:(z,R,Q)=>{var G,J,ee,ne;if(!Object.is(n.current[z],R)){if(n.current[z]=R,z==="search")$(),I(),E(1,P);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ae=document.getElementById(_);ae?ae.focus():(G=document.getElementById(w))==null||G.focus()}if(E(7,()=>{var ae;n.current.selectedItemId=(ae=L())==null?void 0:ae.id,T.emit()}),Q||E(5,U),((J=i.current)==null?void 0:J.value)!==void 0){let ae=R??"";(ne=(ee=i.current).onValueChange)==null||ne.call(ee,ae);return}}T.emit()}},emit:()=>{o.current.forEach(z=>z())}}),[]),N=S.useMemo(()=>({value:(z,R,Q)=>{var G;R!==((G=a.current.get(z))==null?void 0:G.value)&&(a.current.set(z,{value:R,keywords:Q}),n.current.filtered.items.set(z,A(R,Q)),E(2,()=>{I(),T.emit()}))},item:(z,R)=>(r.current.add(z),R&&(s.current.has(R)?s.current.get(R).add(z):s.current.set(R,new Set([z]))),E(3,()=>{$(),I(),n.current.value||P(),T.emit()}),()=>{a.current.delete(z),r.current.delete(z),n.current.filtered.items.delete(z);let Q=L();E(4,()=>{$(),Q?.getAttribute("id")===z&&P(),T.emit()})}),group:z=>(s.current.has(z)||s.current.set(z,new Set),()=>{a.current.delete(z),s.current.delete(z)}),filter:()=>i.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:w,inputId:_,labelId:O,listInnerRef:C}),[]);function A(z,R){var Q,G;let J=(G=(Q=i.current)==null?void 0:Q.filter)!=null?G:twn;return z?J(z,n.current.search,R):0}function I(){if(!n.current.search||i.current.shouldFilter===!1)return;let z=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(G=>{let J=s.current.get(G),ee=0;J.forEach(ne=>{let ae=z.get(ne);ee=Math.max(ae,ee)}),R.push([G,ee])});let Q=C.current;B().sort((G,J)=>{var ee,ne;let ae=G.getAttribute("id"),ce=J.getAttribute("id");return((ee=z.get(ce))!=null?ee:0)-((ne=z.get(ae))!=null?ne:0)}).forEach(G=>{let J=G.closest(kV);J?J.appendChild(G.parentElement===J?G:G.closest(`${kV} > *`)):Q.appendChild(G.parentElement===Q?G:G.closest(`${kV} > *`))}),R.sort((G,J)=>J[1]-G[1]).forEach(G=>{var J;let ee=(J=C.current)==null?void 0:J.querySelector(`${tO}[${qx}="${encodeURIComponent(G[0])}"]`);ee?.parentElement.appendChild(ee)})}function P(){let z=B().find(Q=>Q.getAttribute("aria-disabled")!=="true"),R=z?.getAttribute(qx);T.setState("value",R||void 0)}function $(){var z,R,Q,G;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let ee of r.current){let ne=(R=(z=a.current.get(ee))==null?void 0:z.value)!=null?R:"",ae=(G=(Q=a.current.get(ee))==null?void 0:Q.keywords)!=null?G:[],ce=A(ne,ae);n.current.filtered.items.set(ee,ce),ce>0&&J++}for(let[ee,ne]of s.current)for(let ae of ne)if(n.current.filtered.items.get(ae)>0){n.current.filtered.groups.add(ee);break}n.current.filtered.count=J}function U(){var z,R,Q;let G=L();G&&(((z=G.parentElement)==null?void 0:z.firstChild)===G&&((Q=(R=G.closest(tO))==null?void 0:R.querySelector(ewn))==null||Q.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function L(){var z;return(z=C.current)==null?void 0:z.querySelector(`${VWe}[aria-selected="true"]`)}function B(){var z;return Array.from(((z=C.current)==null?void 0:z.querySelectorAll(r_e))||[])}function H(z){let R=B()[z];R&&T.setState("value",R.getAttribute(qx))}function q(z){var R;let Q=L(),G=B(),J=G.findIndex(ne=>ne===Q),ee=G[J+z];(R=i.current)!=null&&R.loop&&(ee=J+z<0?G[G.length-1]:J+z===G.length?G[0]:G[J+z]),ee&&T.setState("value",ee.getAttribute(qx))}function V(z){let R=L(),Q=R?.closest(tO),G;for(;Q&&!G;)Q=z>0?uwn(Q,tO):dwn(Q,tO),G=Q?.querySelector(r_e);G?T.setState("value",G.getAttribute(qx)):q(z)}let W=()=>H(B().length-1),D=z=>{z.preventDefault(),z.metaKey?W():z.altKey?V(1):q(1)},Z=z=>{z.preventDefault(),z.metaKey?H(0):z.altKey?V(-1):q(-1)};return S.createElement(ei.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:z=>{var R;(R=x.onKeyDown)==null||R.call(x,z);let Q=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||Q))switch(z.key){case"n":case"j":{y&&z.ctrlKey&&D(z);break}case"ArrowDown":{D(z);break}case"p":case"k":{y&&z.ctrlKey&&Z(z);break}case"ArrowUp":{Z(z);break}case"Home":{z.preventDefault(),H(0);break}case"End":{z.preventDefault(),W();break}case"Enter":{z.preventDefault();let G=L();if(G){let J=new Event(iZ);G.dispatchEvent(J)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:hwn},c),k2(e,z=>S.createElement(HWe.Provider,{value:T},S.createElement(QWe.Provider,{value:N},z))))}),nwn=S.forwardRef((e,t)=>{var n,r;let s=io(),a=S.useRef(null),o=S.useContext(GWe),i=eT(),c=ZWe(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o?.forceMount;ev(()=>{if(!u)return i.item(s,o?.id)},[u]);let d=YWe(s,a,[e.value,e.children,a],e.keywords),f=Mre(),p=Ig(E=>E.value&&E.value===d.current),h=Ig(E=>u||i.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=a.current;if(!(!E||e.disabled))return E.addEventListener(iZ,g),()=>E.removeEventListener(iZ,g)},[h,e.onSelect,e.disabled]);function g(){var E,T;b(),(T=(E=c.current).onSelect)==null||T.call(E,d.current)}function b(){f.setState("value",d.current,!0)}if(!h)return null;let{disabled:y,value:x,onSelect:w,forceMount:O,keywords:_,...C}=e;return S.createElement(ei.div,{ref:Xf(a,t),...C,id:s,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!p,"data-disabled":!!y,"data-selected":!!p,onPointerMove:y||i.getDisablePointerSelection()?void 0:b,onClick:y?void 0:g},e.children)}),rwn=S.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...a}=e,o=io(),i=S.useRef(null),c=S.useRef(null),u=io(),d=eT(),f=Ig(h=>s||d.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);ev(()=>d.group(o),[]),YWe(o,i,[e.value,e.heading,c]);let p=S.useMemo(()=>({id:o,forceMount:s}),[s]);return S.createElement(ei.div,{ref:Xf(i,t),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&S.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),k2(e,h=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},S.createElement(GWe.Provider,{value:p},h))))}),swn=S.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=S.useRef(null),a=Ig(o=>!o.search);return!n&&!a?null:S.createElement(ei.div,{ref:Xf(s,t),...r,"cmdk-separator":"",role:"separator"})}),awn=S.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,a=Mre(),o=Ig(u=>u.search),i=Ig(u=>u.selectedItemId),c=eT();return S.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),S.createElement(ei.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":i,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||a.setState("search",u.target.value),n?.(u.target.value)}})}),own=S.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,a=S.useRef(null),o=S.useRef(null),i=Ig(u=>u.selectedItemId),c=eT();return S.useEffect(()=>{if(o.current&&a.current){let u=o.current,d=a.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(f),p.unobserve(u)}}},[]),S.createElement(ei.div,{ref:Xf(a,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:c.listId},k2(e,u=>S.createElement("div",{ref:Xf(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),iwn=S.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:a,container:o,...i}=e;return S.createElement(vM,{open:n,onOpenChange:r},S.createElement(xM,{container:o},S.createElement($E,{"cmdk-overlay":"",className:s}),S.createElement(DE,{"aria-label":e.label,"cmdk-dialog":"",className:a},S.createElement(WWe,{ref:t,...i}))))}),lwn=S.forwardRef((e,t)=>Ig(n=>n.filtered.count===0)?S.createElement(ei.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),cwn=S.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...a}=e;return S.createElement(ei.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},k2(e,o=>S.createElement("div",{"aria-hidden":!0},o)))}),fc=Object.assign(WWe,{List:own,Item:nwn,Input:awn,Group:rwn,Separator:swn,Dialog:iwn,Empty:lwn,Loading:cwn});function uwn(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function dwn(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ZWe(e){let t=S.useRef(e);return ev(()=>{t.current=e}),t}var ev=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Vx(e){let t=S.useRef();return t.current===void 0&&(t.current=e()),t}function Ig(e){let t=Mre(),n=()=>e(t.snapshot());return S.useSyncExternalStore(t.subscribe,n,n)}function YWe(e,t,n,r=[]){let s=S.useRef(),a=eT();return ev(()=>{var o;let i=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());a.value(e,i,c),(o=t.current)==null||o.setAttribute(qx,i),s.current=i}),s}var fwn=()=>{let[e,t]=S.useState(),n=Vx(()=>new Map);return ev(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function pwn(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function k2({asChild:e,children:t},n){return e&&S.isValidElement(t)?S.cloneElement(pwn(t),{ref:t.ref},n(t.props.children)):n(t)}var hwn={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class bo{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}offset(t,n=t){return new bo(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}}function tv(e,t,n,r,s,a){if(e==r)return[];let o=Dre(e,t,n,r,s,a),i=Lre(e,t+o,n,r,s+o,a);t+=o,n-=i,s+=o,a-=i;let c=n-t,u=a-s;if(!c||!u)return[new bo(t,n,s,a)];if(c>u){let f=e.slice(t,n).indexOf(r.slice(s,a));if(f>-1)return[new bo(t,t+f,s,s),new bo(t+f+u,n,a,a)]}else if(u>c){let f=r.slice(s,a).indexOf(e.slice(t,n));if(f>-1)return[new bo(t,t,s,s+f),new bo(n,n,s+f+c,a)]}if(c==1||u==1)return[new bo(t,n,s,a)];let d=JWe(e,t,n,r,s,a);if(d){let[f,p,h]=d;return tv(e,t,f,r,s,p).concat(tv(e,f+h,n,r,p+h,a))}return mwn(e,t,n,r,s,a)}let jO=1e9,AO=0,$re=!1;function mwn(e,t,n,r,s,a){let o=n-t,i=a-s;if(jO<1e9&&Math.min(o,i)>jO*16||AO>0&&Date.now()>AO)return Math.min(o,i)>jO*64?[new bo(t,n,s,a)]:s_e(e,t,n,r,s,a);let c=Math.ceil((o+i)/2);_V.reset(c),EV.reset(c);let u=(h,g)=>e.charCodeAt(t+h)==r.charCodeAt(s+g),d=(h,g)=>e.charCodeAt(n-h-1)==r.charCodeAt(a-g-1),f=(o-i)%2!=0?EV:null,p=f?null:_V;for(let h=0;h<c;h++){if(h>jO||AO>0&&!(h&63)&&Date.now()>AO)return s_e(e,t,n,r,s,a);let g=_V.advance(h,o,i,c,f,!1,u)||EV.advance(h,o,i,c,p,!0,d);if(g)return gwn(e,t,n,t+g[0],r,s,a,s+g[1])}return[new bo(t,n,s,a)]}class XWe{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,n,r,s,a,o,i){for(let c=-t+this.start;c<=t-this.end;c+=2){let u=s+c,d=c==-t||c!=t&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,f=d-c;for(;d<n&&f<r&&i(d,f);)d++,f++;if(this.vec[u]=d,d>n)this.end+=2;else if(f>r)this.start+=2;else if(a){let p=s+(n-r)-c;if(p>=0&&p<this.len&&a.vec[p]!=-1)if(o){let h=a.vec[p];if(h>=n-d)return[h,s+h-p]}else{let h=n-a.vec[p];if(d>=h)return[d,f]}}}return null}}const _V=new XWe,EV=new XWe;function gwn(e,t,n,r,s,a,o,i){let c=!1;return!Lw(e,r)&&++r==n&&(c=!0),!Lw(s,i)&&++i==o&&(c=!0),c?[new bo(t,n,a,o)]:tv(e,t,r,s,a,i).concat(tv(e,r,n,s,i,o))}function KWe(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function Dre(e,t,n,r,s,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(s))return 0;let o=KWe(n-t,a-s);for(let i=t,c=s;;){let u=i+o,d=c+o;if(u>n||d>a||e.slice(i,u)!=r.slice(c,d)){if(o==1)return i-t-(Lw(e,i)?0:1);o=o>>1}else{if(u==n||d==a)return u-t;i=u,c=d}}}function Lre(e,t,n,r,s,a){if(t==n||s==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=KWe(n-t,a-s);for(let i=n,c=a;;){let u=i-o,d=c-o;if(u<t||d<s||e.slice(u,i)!=r.slice(d,c)){if(o==1)return n-i-(Lw(e,i)?0:1);o=o>>1}else{if(u==t||d==s)return n-u;i=u,c=d}}}function lZ(e,t,n,r,s,a,o,i){let c=r.slice(s,a),u=null;for(;;){if(u||o<i)return u;for(let d=t+o;;){Lw(e,d)||d++;let f=d+o;if(Lw(e,f)||(f+=f==d+1?1:-1),f>=n)break;let p=e.slice(d,f),h=-1;for(;(h=c.indexOf(p,h+1))!=-1;){let g=Dre(e,f,n,r,s+h+p.length,a),b=Lre(e,t,d,r,s,s+h),y=p.length+g+b;(!u||u[2]<y)&&(u=[d-b,s+h-b,y])}d=f}if(i<0)return u;o=o>>1}}function JWe(e,t,n,r,s,a){let o=n-t,i=a-s;if(o<i){let c=JWe(r,s,a,e,t,n);return c&&[c[1],c[0],c[2]]}return o<4||i*2<o?null:lZ(e,t,n,r,s,a,Math.floor(o/4),-1)}function s_e(e,t,n,r,s,a){$re=!0;let o=n-t,i=a-s,c;if(o<i){let p=lZ(r,s,a,e,t,n,Math.floor(o/6),50);c=p&&[p[1],p[0],p[2]]}else c=lZ(e,t,n,r,s,a,Math.floor(i/6),50);if(!c)return[new bo(t,n,s,a)];let[u,d,f]=c;return tv(e,t,u,r,s,d).concat(tv(e,u+f,n,r,d+f,a))}function eZe(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],s=e[n];r.toA>s.fromA-t&&r.toB>s.fromB-t&&(e[n-1]=new bo(r.fromA,s.toA,r.fromB,s.toB),e.splice(n--,1))}}function bwn(e,t,n){for(;;){eZe(n,1);let r=!1;for(let s=0;s<n.length;s++){let a=n[s],o,i;(o=Dre(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[s]=new bo(a.fromA+o,a.toA,a.fromB+o,a.toB)),(i=Lre(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[s]=new bo(a.fromA,a.toA-i,a.fromB,a.toB-i));let c=a.toA-a.fromA,u=a.toB-a.fromB;if(c&&u)continue;let d=a.fromA-(s?n[s-1].toA:0),f=(s<n.length-1?n[s+1].fromA:e.length)-a.toA;if(!d||!f)continue;let p=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);d<=p.length&&e.slice(a.fromA-d,a.fromA)==p.slice(p.length-d)?(n[s]=new bo(a.fromA-d,a.toA-d,a.fromB-d,a.toB-d),r=!0):f<=p.length&&e.slice(a.toA,a.toA+f)==p.slice(0,f)&&(n[s]=new bo(a.fromA+f,a.toA+f,a.fromB+f,a.toB+f),r=!0)}if(!r)break}return n}function ywn(e,t,n){for(let r=0,s=0;s<e.length;s++){let a=e[s],o=a.toA-a.fromA,i=a.toB-a.fromB;if(o&&i||o>3||i>3){let c=s==e.length-1?t.length:e[s+1].fromA,u=a.fromA-r,d=c-a.toA,f=o_e(t,a.fromA,u),p=a_e(t,a.toA,d),h=a.fromA-f,g=p-a.toA;if((!o||!i)&&h&&g){let b=Math.max(o,i),[y,x,w]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];b>h&&t.slice(f,a.fromA)==y.slice(w-h,w)?(a=e[s]=new bo(f,f+o,a.fromB-h,a.toB-h),f=a.fromA,p=a_e(t,a.toA,c-a.toA)):b>g&&t.slice(a.toA,p)==y.slice(x,x+g)&&(a=e[s]=new bo(p-o,p,a.fromB+g,a.toB+g),p=a.toA,f=o_e(t,a.fromA,a.fromA-r)),h=a.fromA-f,g=p-a.toA}if(h||g)a=e[s]=new bo(a.fromA-h,a.toA+g,a.fromB-h,a.toB+g);else if(o){if(!i){let b=l_e(t,a.fromA,a.toA),y,x=b<0?-1:i_e(t,a.toA,a.fromA);b>-1&&(y=b-a.fromA)<=d&&t.slice(a.fromA,b)==t.slice(a.toA,a.toA+y)?a=e[s]=a.offset(y):x>-1&&(y=a.toA-x)<=u&&t.slice(a.fromA-y,a.fromA)==t.slice(x,a.toA)&&(a=e[s]=a.offset(-y))}}else{let b=l_e(n,a.fromB,a.toB),y,x=b<0?-1:i_e(n,a.toB,a.fromB);b>-1&&(y=b-a.fromB)<=d&&n.slice(a.fromB,b)==n.slice(a.toB,a.toB+y)?a=e[s]=a.offset(y):x>-1&&(y=a.toB-x)<=u&&n.slice(a.fromB-y,a.fromB)==n.slice(x,a.toB)&&(a=e[s]=a.offset(-y))}}r=a.toA}return eZe(e,3),e}let my;try{my=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function tZe(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function nZe(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?tZe(n)?1:0:my?!aZe(n)||t==e.length-1?my.test(String.fromCharCode(n))?1:0:my.test(e.slice(t,t+2))?2:0:0}function rZe(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?tZe(n)?1:0:my?!oZe(n)||t==1?my.test(String.fromCharCode(n))?1:0:my.test(e.slice(t-2,t))?2:0:0}const sZe=8;function a_e(e,t,n){if(t==e.length||!rZe(e,t))return t;for(let r=t,s=t+n,a=0;a<sZe;a++){let o=nZe(e,r);if(!o||r+o>s)return r;r+=o}return t}function o_e(e,t,n){if(!t||!nZe(e,t))return t;for(let r=t,s=t-n,a=0;a<sZe;a++){let o=rZe(e,r);if(!o||r-o<s)return r;r-=o}return t}function i_e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function l_e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const aZe=e=>e>=55296&&e<=56319,oZe=e=>e>=56320&&e<=57343;function Lw(e,t){return!t||t==e.length||!aZe(e.charCodeAt(t-1))||!oZe(e.charCodeAt(t))}function vwn(e,t,n){var r;let s=n?.override;return s?s(e,t):(jO=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,AO=n?.timeout?Date.now()+n.timeout:0,$re=!1,bwn(e,t,tv(e,0,e.length,t,0,t.length)))}function iZe(){return!$re}function lZe(e,t,n){return ywn(vwn(e,t,n),e,t)}const Af=Lt.define({combine:e=>e[0]}),cZ=Fn.define(),xwn=Lt.define(),Fw=lo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(cZ)&&(e=n.value);for(let n of t.state.facet(xwn))e=n(e,t);return e}});class M0{constructor(t,n,r,s,a,o=!0){this.changes=t,this.fromA=n,this.toA=r,this.fromB=s,this.toB=a,this.precise=o}offset(t,n){return t||n?new M0(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,n,r){let s=lZe(t.toString(),n.toString(),r);return cZe(s,t,n,0,0,iZe())}static updateA(t,n,r,s,a){return p_e(f_e(t,s,!0,r.length),t,n,r,a)}static updateB(t,n,r,s,a){return p_e(f_e(t,s,!1,n.length),t,n,r,a)}}function c_e(e,t,n,r){let s=n.lineAt(e),a=r.lineAt(t);return s.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[s.from,a.from]}function u_e(e,t,n,r){let s=n.lineAt(e),a=r.lineAt(t);return s.from==e&&a.from==t?[e,t]:[s.to+1,a.to+1]}function cZe(e,t,n,r,s,a){let o=[];for(let i=0;i<e.length;i++){let c=e[i],[u,d]=c_e(c.fromA+r,c.fromB+s,t,n),[f,p]=u_e(c.toA+r,c.toB+s,t,n),h=[c.offset(-u+r,-d+s)];for(;i<e.length-1;){let g=e[i+1],[b,y]=c_e(g.fromA+r,g.fromB+s,t,n);if(b>f+1&&y>p+1)break;h.push(g.offset(-u+r,-d+s)),[f,p]=u_e(g.toA+r,g.toB+s,t,n),i++}o.push(new M0(h,u,Math.max(u,f),d,Math.max(d,p),a))}return o}const rA=1e3;function d_e(e,t,n,r){let s=0,a=e.length;for(;;){if(s==a){let d=0,f=0;s&&({toA:d,toB:f}=e[s-1]);let p=t-(n?d:f);return[d+p,f+p]}let o=s+a>>1,i=e[o],[c,u]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(c>t)a=o;else if(u<=t)s=o+1;else return r?[i.fromA,i.fromB]:[i.toA,i.toB]}}function f_e(e,t,n,r){let s=[];return t.iterChangedRanges((a,o,i,c)=>{let u=0,d=n?t.length:r,f=0,p=n?r:t.length;a>rA&&([u,f]=d_e(e,a-rA,n,!0)),o<t.length-rA&&([d,p]=d_e(e,o+rA,n,!1));let h=c-i-(o-a),g,[b,y]=n?[h,0]:[0,h];s.length&&(g=s[s.length-1]).toA>=u?s[s.length-1]={fromA:g.fromA,fromB:g.fromB,toA:d,toB:p,diffA:g.diffA+b,diffB:g.diffB+y}:s.push({fromA:u,toA:d,fromB:f,toB:p,diffA:b,diffB:y})}),s}function p_e(e,t,n,r,s){if(!e.length)return t;let a=[];for(let o=0,i=0,c=0,u=0;;o++){let d=o==e.length?null:e[o],f=d?d.fromA+i:n.length,p=d?d.fromB+c:r.length;for(;u<t.length;){let y=t[u];if(d&&(y.toA+i>f||y.toB+c>p))break;a.push(y.offset(i,c)),u++}if(!d)break;let h=d.toA+i+d.diffA,g=d.toB+c+d.diffB,b=lZe(n.sliceString(f,h),r.sliceString(p,g),s);for(let y of cZe(b,n,r,f,p,iZe()))a.push(y);for(i+=d.diffA,c+=d.diffB;u<t.length;){let y=t[u];if(y.fromA+i>h&&y.fromB+c>g)break;u++}}return a}const wwn={scanLimit:500},uZe=Pa.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=g_e(e))}update(e){(e.docChanged||e.viewportChanged||Swn(e.startState,e.state)||Own(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=g_e(e.view))}},{decorations:e=>e.deco}),sA=Jd.low(S2e({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(uZe))===null||t===void 0?void 0:t.gutter)||xr.empty}}));function Swn(e,t){return e.field(Fw,!1)!=t.field(Fw,!1)}function Own(e,t){return e.facet(Af)!=t.facet(Af)}const h_e=Qt.line({class:"cm-changedLine"}),kwn=Qt.mark({class:"cm-changedText"}),_wn=Qt.mark({tagName:"ins",class:"cm-insertedLine"}),Ewn=Qt.mark({tagName:"del",class:"cm-deletedLine"}),m_e=new class extends ep{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Cwn(e,t,n,r,s,a){let o=n?e.fromA:e.fromB,i=n?e.toA:e.toB,c=0;if(o!=i){s.add(o,o,h_e),s.add(o,i,n?Ewn:_wn),a&&a.add(o,o,m_e);for(let u=t.iterRange(o,i-1),d=o;!u.next().done;){if(u.lineBreak){d++,s.add(d,d,h_e),a&&a.add(d,d,m_e);continue}let f=d+u.value.length;if(r)for(;c<e.changes.length;){let p=e.changes[c],h=o+(n?p.fromA:p.fromB),g=o+(n?p.toA:p.toB),b=Math.max(d,h),y=Math.min(f,g);if(b<y&&s.add(b,y,kwn),g<f)c++;else break}d=f}}}function g_e(e){let t=e.state.field(Fw),{side:n,highlightChanges:r,markGutter:s,overrideChunk:a}=e.state.facet(Af),o=n=="a",i=new ec,c=s?new ec:null,{from:u,to:d}=e.viewport;for(let f of t){if((o?f.fromA:f.fromB)>=d)break;(o?f.toA:f.toB)>u&&(!a||!a(e.state,f,i,c))&&Cwn(f,e.state.doc,o,r,i,c)}return{deco:i.finish(),gutter:c&&c.finish()}}class aA extends ru{constructor(t){super(),this.height=t}eq(t){return this.height==t.height}toDOM(){let t=document.createElement("div");return t.className="cm-mergeSpacer",t.style.height=this.height+"px",t}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const AP=Fn.define({map:(e,t)=>e.map(t)}),RO=lo.define({create:()=>Qt.none,update:(e,t)=>{for(let n of t.effects)if(n.is(AP))return n.value;return e.map(t.changes)},provide:e=>it.decorations.from(e)}),oA=.01;function b_e(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Twn(e,t,n){let r=new ec,s=new ec,a=e.state.field(RO).iter(),o=t.state.field(RO).iter(),i=0,c=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let y=0;;y++){let x=y<n.length?n[y]:null,w=x?x.fromA:e.state.doc.length,O=x?x.fromB:t.state.doc.length;if(i<w){let _=e.lineBlockAt(i).top+u,C=t.lineBlockAt(c).top+d,E=_-C;E<-oA?(u-=E,r.add(i,i,Qt.widget({widget:new aA(-E),block:!0,side:-1}))):E>oA&&(d+=E,s.add(c,c,Qt.widget({widget:new aA(E),block:!0,side:-1})))}if(w>i+1e3&&i<f.from&&w>f.from&&c<p.from&&O>p.from){let _=Math.min(f.from-i,p.from-c);i+=_,c+=_,y--}else if(x)i=x.toA,c=x.toB;else break;for(;a.value&&a.from<i;)u-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)d-=o.value.spec.widget.height,o.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;o.value;)d-=o.value.spec.widget.height,o.next();let h=e.contentHeight+u-(t.contentHeight+d);h<oA?r.add(e.state.doc.length,e.state.doc.length,Qt.widget({widget:new aA(-h),block:!0,side:1})):h>oA&&s.add(t.state.doc.length,t.state.doc.length,Qt.widget({widget:new aA(h),block:!0,side:1}));let g=r.finish(),b=s.finish();b_e(g,e.state.field(RO))||e.dispatch({effects:AP.of(g)}),b_e(b,t.state.field(RO))||t.dispatch({effects:AP.of(b)})}const uZ=Fn.define({map:(e,t)=>t.mapPos(e)});class Nwn extends ru{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=t.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",r=>{let s=t.posAtDOM(r.target);t.dispatch({effects:uZ.of(s)});let{side:a,sibling:o}=t.state.facet(Af);o&&o().dispatch({effects:uZ.of(jwn(s,t.state.field(Fw),a=="a"))})}),n}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function jwn(e,t,n){let r=0,s=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return s+(e-r);[r,s]=n?[o.toA,o.toB]:[o.toB,o.toA]}}const Awn=lo.define({create(e){return Qt.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(uZ)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>it.decorations.from(e)});function y_e({margin:e=3,minSize:t=4}){return Awn.init(n=>Rwn(n,e,t))}function Rwn(e,t,n){let r=new ec,s=e.facet(Af).side=="a",a=e.field(Fw),o=1;for(let i=0;;i++){let c=i<a.length?a[i]:null,u=i?o+t:1,d=c?e.doc.lineAt(s?c.fromA:c.fromB).number-1-t:e.doc.lines,f=d-u+1;if(f>=n&&r.add(e.doc.line(u).from,e.doc.line(d).to,Qt.replace({widget:new Nwn(f),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,s?c.toA:c.toB)).number}return r.finish()}const Iwn=it.styleModule.of(new Oh({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Pwn=it.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),v_e=new oS,iA=new oS;class Mwn{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||wwn;let n=[Jd.low(uZe),Pwn,Iwn,RO,it.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(p=>p.effects.some(h=>h.is(AP)))&&this.measure()})],r=[Af.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(sA);let s=br.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],it.editorAttributes.of({class:"cm-merge-a"}),iA.of(r),n]}),a=[Af.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&a.push(sA);let o=br.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],it.editorAttributes.of({class:"cm-merge-b"}),iA.of(a),n]});this.chunks=M0.build(s.doc,o.doc,this.diffConf);let i=[Fw.init(()=>this.chunks),v_e.of(t.collapseUnchanged?y_e(t.collapseUnchanged):[])];s=s.update({effects:Fn.appendConfig.of(i)}).state,o=o.update({effects:Fn.appendConfig.of(i)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let c=t.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(c=="a-b"?u:d),this.editorDOM.appendChild(c=="a-b"?d:u),this.a=new it({state:s,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new it({state:o,parent:d,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,n){if(t.some(r=>r.docChanged)){let r=t[t.length-1],s=t.reduce((o,i)=>o.compose(i.changes),go.empty(t[0].startState.doc.length));this.chunks=n==this.a?M0.updateA(this.chunks,r.newDoc,this.b.state.doc,s,this.diffConf):M0.updateB(this.chunks,this.a.state.doc,r.newDoc,s,this.diffConf),n.update([...t,r.state.update({effects:cZ.of(this.chunks)})]);let a=n==this.a?this.b:this.a;a.update([a.state.update({effects:cZ.of(this.chunks)})]),this.scheduleMeasure()}else n.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let a=t.orientation!="b-a";if(a!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let o=this.a.dom.parentNode,i=this.b.dom.parentNode;o.remove(),i.remove(),this.editorDOM.insertBefore(a?o:i,this.editorDOM.firstChild),this.editorDOM.appendChild(a?i:o),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let a=!!this.revertDOM,o=this.revertToA,i=this.renderRevert;"revertControls"in t&&(a=!!t.revertControls,o=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(i=t.renderRevertControl),this.setupRevertControls(a,o,i)}let n="highlightChanges"in t,r="gutter"in t,s="collapseUnchanged"in t;if(n||r||s){let a=[],o=[];if(n||r){let i=this.a.state.facet(Af),c=r?t.gutter!==!1:i.markGutter,u=n?t.highlightChanges!==!1:i.highlightChanges;a.push(iA.reconfigure([Af.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?sA:[]])),o.push(iA.reconfigure([Af.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?sA:[]]))}if(s){let i=v_e.reconfigure(t.collapseUnchanged?y_e(t.collapseUnchanged):[]);a.push(i),o.push(i)}this.a.dispatch({effects:a}),this.b.dispatch({effects:o})}this.scheduleMeasure()}setupRevertControls(t,n,r){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=r,!t&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):t&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",s=>this.revertClicked(s)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let t=this.dom.ownerDocument.defaultView||window;this.measuring=t.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){Twn(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,n=t.firstChild,r=this.a.viewport,s=this.b.viewport;for(let a=0;a<this.chunks.length;a++){let o=this.chunks[a];if(o.fromA>r.to||o.fromB>s.to)break;if(o.fromA<r.from||o.fromB<s.from)continue;let i=this.a.lineBlockAt(o.fromA).top+"px";for(;n&&+n.dataset.chunk<a;)n=x_e(n);n&&n.dataset.chunk==String(a)?(n.style.top!=i&&(n.style.top=i),n=n.nextSibling):t.insertBefore(this.renderRevertButton(i,a),n)}for(;n;)n=x_e(n)}renderRevertButton(t,n){let r;if(this.renderRevert)r=this.renderRevert();else{r=document.createElement("button");let s=this.a.state.phrase("Revert this chunk");r.setAttribute("aria-label",s),r.setAttribute("title",s),r.textContent=this.revertToLeft?"⇜":"⇝"}return r.style.top=t,r.setAttribute("data-chunk",String(n)),r}revertClicked(t){let n=t.target,r;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(r=this.chunks[n.dataset.chunk])){let[s,a,o,i,c,u]=this.revertToA?[this.b,this.a,r.fromB,r.toB,r.fromA,r.toA]:[this.a,this.b,r.fromA,r.toA,r.fromB,r.toB],d=s.state.sliceDoc(o,Math.max(o,i-1));o!=i&&u<=a.state.doc.length&&(d+=s.state.lineBreak),a.dispatch({changes:{from:c,to:Math.min(a.state.doc.length,u),insert:d},userEvent:"revert"}),t.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function x_e(e){let t=e.nextSibling;return e.remove(),t}const CV=[400,401,403,404];function ta(e){return!e||typeof e!="object"?!1:"status"in e&&e.status===403||"statusCode"in e&&e.statusCode===403?!0:"message"in e?e.message.includes("status: 403"):!1}function dZe(e){if(!e||typeof e!="object")return!1;if("status"in e){const t=e.status;return CV.includes(t)}if("statusCode"in e){const t=e.statusCode;return CV.includes(t)}if("message"in e){const t=e.message;return CV.some(n=>t.includes(`status: ${n}`))}return!1}function $wn(e,t){return dZe(t)?!1:e<3}function Dwn(e,t){return t in e&&typeof e[t]=="function"}const Jo=e=>{const t=["listWorkspaces","getWorkspace"],n=gY.has("workspaces-v1"),r=t.every(s=>Dwn(e,s));return n&&r},fZe=e=>{if(!(!e||typeof e!="object")){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}},Lwn=(e,t)=>fZe(e)===t,Fwn=e=>{const t=fZe(e);return t!==void 0&&t>=400&&t<500},dZ=e=>{if(Lwn(e,501))return!0;if(e&&typeof e=="object"&&"message"in e){const t=e.message;return t.includes("Workspace v1 not supported")||t.includes("501")}return!1},Rv=(e,t)=>Fwn(t)||dZ(t)||dZe(t)?!1:e<3;function pZe(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=pZe(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hZe(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=pZe(e))&&(r&&(r+=" "),r+=t);return r}const zwn=(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},Bwn=(e,t)=>({classGroupId:e,validator:t}),mZe=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),RP="-",w_e=[],Uwn="arbitrary..",qwn=e=>{const t=Qwn(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Vwn(o);const i=o.split(RP),c=i[0]===""&&i.length>1?1:0;return gZe(i,c,t)},getConflictingClassGroupIds:(o,i)=>{if(i){const c=r[o],u=n[o];return c?u?zwn(u,c):c:u||w_e}return n[o]||w_e}}},gZe=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const u=gZe(e,t+1,a);if(u)return u}const o=n.validators;if(o===null)return;const i=t===0?e.join(RP):e.slice(t).join(RP),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(i))return d.classGroupId}},Vwn=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?Uwn+r:void 0})(),Qwn=e=>{const{theme:t,classGroups:n}=e;return Hwn(n,t)},Hwn=(e,t)=>{const n=mZe();for(const r in e){const s=e[r];Fre(s,n,r,t)}return n},Fre=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const o=e[a];Gwn(o,t,n,r)}},Gwn=(e,t,n,r)=>{if(typeof e=="string"){Wwn(e,t,n);return}if(typeof e=="function"){Zwn(e,t,n,r);return}Ywn(e,t,n,r)},Wwn=(e,t,n)=>{const r=e===""?t:bZe(t,e);r.classGroupId=n},Zwn=(e,t,n,r)=>{if(Xwn(e)){Fre(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Bwn(n,e))},Ywn=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];Fre(c,bZe(t,i),n,r)}},bZe=(e,t)=>{let n=e;const r=t.split(RP),s=r.length;for(let a=0;a<s;a++){const o=r[a];let i=n.nextPart.get(o);i||(i=mZe(),n.nextPart.set(o,i)),n=i}return n},Xwn=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Kwn=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in n?n[a]=o:s(a,o)}}},fZ="!",S_e=":",Jwn=[],O_e=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),eSn=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let o=0,i=0,c=0,u;const d=s.length;for(let b=0;b<d;b++){const y=s[b];if(o===0&&i===0){if(y===S_e){a.push(s.slice(c,b)),c=b+1;continue}if(y==="/"){u=b;continue}}y==="["?o++:y==="]"?o--:y==="("?i++:y===")"&&i--}const f=a.length===0?s:s.slice(c);let p=f,h=!1;f.endsWith(fZ)?(p=f.slice(0,-1),h=!0):f.startsWith(fZ)&&(p=f.slice(1),h=!0);const g=u&&u>c?u-c:void 0;return O_e(a,h,p,g)};if(t){const s=t+S_e,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):O_e(Jwn,!1,o,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},tSn=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const o=n[a],i=o[0]==="[",c=t.has(o);i||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},nSn=e=>({cache:Kwn(e.cacheSize),parseClassName:eSn(e),sortModifiers:tSn(e),...qwn(e)}),rSn=/\s+/,sSn=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,o=[],i=e.trim().split(rSn);let c="";for(let u=i.length-1;u>=0;u-=1){const d=i[u],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:b}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!b,x=r(y?g.substring(0,b):g);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=r(g),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=p.length===0?"":p.length===1?p[0]:a(p).join(":"),O=h?w+fZ:w,_=O+x;if(o.indexOf(_)>-1)continue;o.push(_);const C=s(x,y);for(let E=0;E<C.length;++E){const T=C[E];o.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},aSn=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=yZe(n))&&(s&&(s+=" "),s+=r);return s},yZe=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yZe(e[r]))&&(n&&(n+=" "),n+=t);return n},k_e=(e,...t)=>{let n,r,s,a;const o=c=>{const u=t.reduce((d,f)=>f(d),e());return n=nSn(u),r=n.cache.get,s=n.cache.set,a=i,i(c)},i=c=>{const u=r(c);if(u)return u;const d=sSn(c,n);return s(c,d),d};return a=o,(...c)=>a(aSn(...c))},oSn=[],No=e=>{const t=n=>n[e]||oSn;return t.isThemeGetter=!0,t},vZe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xZe=/^\((?:(\w[\w-]*):)?(.+)\)$/i,iSn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lSn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cSn=/\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$/,uSn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dSn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fSn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Cm=e=>iSn.test(e),mr=e=>!!e&&!Number.isNaN(Number(e)),Tm=e=>!!e&&Number.isInteger(Number(e)),TV=e=>e.endsWith("%")&&mr(e.slice(0,-1)),Gp=e=>lSn.test(e),wZe=()=>!0,pSn=e=>cSn.test(e)&&!uSn.test(e),zre=()=>!1,hSn=e=>dSn.test(e),mSn=e=>fSn.test(e),gSn=e=>!sn(e)&&!cn(e),bSn=e=>Xg(e,kZe,zre),sn=e=>vZe.test(e),Rb=e=>Xg(e,_Ze,pSn),__e=e=>Xg(e,_Sn,mr),ySn=e=>Xg(e,CZe,wZe),vSn=e=>Xg(e,EZe,zre),E_e=e=>Xg(e,SZe,zre),xSn=e=>Xg(e,OZe,mSn),lA=e=>Xg(e,TZe,hSn),cn=e=>xZe.test(e),nO=e=>Iv(e,_Ze),wSn=e=>Iv(e,EZe),C_e=e=>Iv(e,SZe),SSn=e=>Iv(e,kZe),OSn=e=>Iv(e,OZe),cA=e=>Iv(e,TZe,!0),kSn=e=>Iv(e,CZe,!0),Xg=(e,t,n)=>{const r=vZe.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Iv=(e,t,n=!1)=>{const r=xZe.exec(e);return r?r[1]?t(r[1]):n:!1},SZe=e=>e==="position"||e==="percentage",OZe=e=>e==="image"||e==="url",kZe=e=>e==="length"||e==="size"||e==="bg-size",_Ze=e=>e==="length",_Sn=e=>e==="number",EZe=e=>e==="family-name",CZe=e=>e==="number"||e==="weight",TZe=e=>e==="shadow",T_e=()=>{const e=No("color"),t=No("font"),n=No("text"),r=No("font-weight"),s=No("tracking"),a=No("leading"),o=No("breakpoint"),i=No("container"),c=No("spacing"),u=No("radius"),d=No("shadow"),f=No("inset-shadow"),p=No("text-shadow"),h=No("drop-shadow"),g=No("blur"),b=No("perspective"),y=No("aspect"),x=No("ease"),w=No("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[..._(),cn,sn],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],N=()=>[cn,sn,c],A=()=>[Cm,"full","auto",...N()],I=()=>[Tm,"none","subgrid",cn,sn],P=()=>["auto",{span:["full",Tm,cn,sn]},Tm,cn,sn],$=()=>[Tm,"auto",cn,sn],U=()=>["auto","min","max","fr",cn,sn],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...N()],q=()=>[Cm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],V=()=>[Cm,"screen","full","dvw","lvw","svw","min","max","fit",...N()],W=()=>[Cm,"screen","full","lh","dvh","lvh","svh","min","max","fit",...N()],D=()=>[e,cn,sn],Z=()=>[..._(),C_e,E_e,{position:[cn,sn]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",SSn,bSn,{size:[cn,sn]}],Q=()=>[TV,nO,Rb],G=()=>["","none","full",u,cn,sn],J=()=>["",mr,nO,Rb],ee=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[mr,TV,C_e,E_e],ce=()=>["","none",g,cn,sn],ye=()=>["none",mr,cn,sn],Y=()=>["none",mr,cn,sn],se=()=>[mr,cn,sn],te=()=>[Cm,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gp],breakpoint:[Gp],color:[wZe],container:[Gp],"drop-shadow":[Gp],ease:["in","out","in-out"],font:[gSn],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gp],shadow:[Gp],spacing:["px",mr],text:[Gp],"text-shadow":[Gp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Cm,sn,cn,y]}],container:["container"],columns:[{columns:[mr,sn,cn,i]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:C()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Tm,"auto",cn,sn]}],basis:[{basis:[Cm,"full","auto",i,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mr,Cm,"auto","initial","none",sn]}],grow:[{grow:["",mr,cn,sn]}],shrink:[{shrink:["",mr,cn,sn]}],order:[{order:[Tm,"first","last","none",cn,sn]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pbs:[{pbs:N()}],pbe:[{pbe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[i,"screen",...q()]}],"min-w":[{"min-w":[i,"screen","none",...q()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,nO,Rb]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,kSn,ySn]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",TV,sn]}],"font-family":[{font:[wSn,vSn,t]}],"font-features":[{"font-features":[sn]}],"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:[s,cn,sn]}],"line-clamp":[{"line-clamp":[mr,"none",cn,__e]}],leading:[{leading:[a,...N()]}],"list-image":[{"list-image":["none",cn,sn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",cn,sn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[mr,"from-font","auto",cn,Rb]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[mr,"auto",cn,sn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cn,sn]}],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",cn,sn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tm,cn,sn],radial:["",cn,sn],conic:[Tm,cn,sn]},OSn,xSn]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mr,cn,sn]}],"outline-w":[{outline:["",mr,nO,Rb]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,cA,lA]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",f,cA,lA]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[mr,Rb]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",p,cA,lA]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[mr,cn,sn]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[mr]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[cn,sn]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[mr]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",cn,sn]}],filter:[{filter:["","none",cn,sn]}],blur:[{blur:ce()}],brightness:[{brightness:[mr,cn,sn]}],contrast:[{contrast:[mr,cn,sn]}],"drop-shadow":[{"drop-shadow":["","none",h,cA,lA]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",mr,cn,sn]}],"hue-rotate":[{"hue-rotate":[mr,cn,sn]}],invert:[{invert:["",mr,cn,sn]}],saturate:[{saturate:[mr,cn,sn]}],sepia:[{sepia:["",mr,cn,sn]}],"backdrop-filter":[{"backdrop-filter":["","none",cn,sn]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[mr,cn,sn]}],"backdrop-contrast":[{"backdrop-contrast":[mr,cn,sn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mr,cn,sn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mr,cn,sn]}],"backdrop-invert":[{"backdrop-invert":["",mr,cn,sn]}],"backdrop-opacity":[{"backdrop-opacity":[mr,cn,sn]}],"backdrop-saturate":[{"backdrop-saturate":[mr,cn,sn]}],"backdrop-sepia":[{"backdrop-sepia":["",mr,cn,sn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",cn,sn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mr,"initial",cn,sn]}],ease:[{ease:["linear","initial",x,cn,sn]}],delay:[{delay:[mr,cn,sn]}],animate:[{animate:["none",w,cn,sn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,cn,sn]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Y()}],"scale-x":[{"scale-x":Y()}],"scale-y":[{"scale-y":Y()}],"scale-z":[{"scale-z":Y()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[cn,sn,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",cn,sn]}],"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":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mbs":[{"scroll-mbs":N()}],"scroll-mbe":[{"scroll-mbe":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pbs":[{"scroll-pbs":N()}],"scroll-pbe":[{"scroll-pbe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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",cn,sn]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[mr,nO,Rb,__e]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ESn=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:s={},override:a={}})=>(IO(e,"cacheSize",t),IO(e,"prefix",n),IO(e,"experimentalParseClassName",r),uA(e.theme,a.theme),uA(e.classGroups,a.classGroups),uA(e.conflictingClassGroups,a.conflictingClassGroups),uA(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),IO(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),dA(e.theme,s.theme),dA(e.classGroups,s.classGroups),dA(e.conflictingClassGroups,s.conflictingClassGroups),dA(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),NZe(e,s,"orderSensitiveModifiers"),e),IO=(e,t,n)=>{n!==void 0&&(e[t]=n)},uA=(e,t)=>{if(t)for(const n in t)IO(e,n,t[n])},dA=(e,t)=>{if(t)for(const n in t)NZe(e,t,n)},NZe=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},CSn=(e,...t)=>typeof e=="function"?k_e(T_e,e,...t):k_e(()=>ESn(T_e(),e),...t),TSn=Object.keys({...dMe,...iyt}),NSn=Object.keys(pyt),jSn=Object.keys(lyt),ASn=Object.keys(cyt),RSn=Object.keys(oyt),Ib=Object.keys(fyt),ISn=Object.keys(uyt).concat(Object.keys(dyt)),PSn=CSn({extend:{theme:{color:TSn,spacing:NSn,radius:RSn,leading:ASn,shadow:ISn},classGroups:{"font-size":[{text:jSn}],h:[{h:Ib}],w:[{w:Ib}],size:[{size:Ib}],"min-h":[{"min-h":Ib}],"min-w":[{"min-w":Ib}],"max-h":[{"max-h":Ib}],"max-w":[{"max-w":Ib}]}}});function K(...e){return PSn(hZe(e))}const Mi={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},tT="focus:outline-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",MSn="focus-within:outline-none focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",$Sn="rounded-md",Bre="bg-white/5 border-2 border-white/10 text-neutral4 hover:text-neutral5 hover:border-white/20 rounded-lg",Ure="outline-none focus-visible:outline-none focus-visible:border-accent1",qre="disabled:opacity-50 disabled:cursor-not-allowed",DSn={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},Te=({children:e,className:t,size:n="default",...r})=>l.jsx("span",{className:K("block",DSn[n],t),...r,children:e}),sd=Opt,zn=kpt,Bn=_pt,$n=S.forwardRef(({className:e,sideOffset:t=4,children:n,...r},s)=>l.jsx(Ept,{children:l.jsxs(xPe,{ref:s,sideOffset:t,className:K("z-50 overflow-hidden rounded-md bg-surface6 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...r,children:[n,l.jsx(Cpt,{className:"fill-surface6"})]})}));$n.displayName=xPe.displayName;const LSn={sm:`${Mi.sm} w-form-sm`,md:`${Mi.md} w-form-md`,lg:`${Mi.lg} w-form-lg`,default:`${Mi.default}`},FSn={sm:"sm",md:"default",lg:"lg",default:"default"},zSn={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},BSn="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",_s=xe.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:s="default",disabled:a,...o},i)=>l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{ref:i,disabled:a,"aria-label":typeof n=="string"?n:void 0,className:K(BSn,tT,zSn[s],LSn[r],a&&"active:scale-100",e),...o,children:l.jsx(Te,{size:FSn[r],children:t})})}),l.jsx($n,{children:n})]}));_s.displayName="IconButton";const USn={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},qSn={mono:"font-mono"},we=({as:e="p",className:t,variant:n="ui-md",font:r,...s})=>l.jsx(e,{className:K(USn[n],r&&qSn[r],t),...s}),An={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},Kg={visible:"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},VSn={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},jZe=({src:e,name:t,size:n="sm",interactive:r=!1})=>l.jsx("div",{className:K(VSn[n],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",An.all,r&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?l.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):l.jsx(we,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),_2=({copiedDuration:e=1500}={})=>{const[t,n]=S.useState(!1);return{isCopied:t,copyToClipboard:s=>{s&&navigator.clipboard.writeText(s).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},QSn=EAt({style:aK.coldarkDark,customStyle:{margin:0,backgroundColor:"black"}}),HSn=()=>l.jsx(Vwt,{remarkPlugins:[O$e],className:"aui-md",components:ZSn}),N_e=S.memo(HSn),GSn=({language:e,code:t})=>{const{isCopied:n,copyToClipboard:r}=_2(),s=()=>{!t||n||r(t)};return l.jsxs("div",{style:{background:"hsl(0 0% 100% / 0.06)",borderTopRightRadius:"0.5rem",borderTopLeftRadius:"0.5rem",marginTop:"0.5rem",border:"1px solid hsl(0 0% 20.4%)",borderBottom:"none"},className:"flex items-center justify-between gap-4 px-4 py-2 text-sm font-semibold text-white",children:[l.jsx("span",{className:"lowercase [&>span]:text-xs",children:e}),l.jsx(_s,{variant:"light",size:"md",tooltip:"Copy",onClick:s,children:l.jsxs("span",{className:"grid",children:[l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",n?"scale-100":"scale-0"),children:l.jsx(Es,{size:14})},"checkmark"),l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",n?"scale-0":"scale-100"),children:l.jsx(Li,{size:14})},"copy")]})})]})},WSn=({alt:e,src:t,...n})=>{const[r,s]=S.useState(!1);return S.useEffect(()=>{s(!1)},[t]),r||!t?l.jsxs("div",{children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",width:"150",height:"150",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})}),l.jsx("p",{className:"text-xs italic text-neutral3 -mt-2.5 mb-2.5",children:"Image link is broken"})]}):l.jsx("img",{src:t,alt:e,...n,onError:()=>{s(!0)}})},ZSn=Twt({h1:({className:e,...t})=>l.jsx("h1",{className:K("mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",e),...t,style:{marginBottom:"2rem"}}),h2:({className:e,...t})=>l.jsx("h2",{className:K("mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"2rem"}}),h3:({className:e,...t})=>l.jsx("h3",{className:K("scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h4:({className:e,...t})=>l.jsx("h4",{className:K("scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h5:({className:e,...t})=>l.jsx("h5",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),h6:({className:e,...t})=>l.jsx("h6",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),p:({className:e,...t})=>l.jsx("p",{className:K("leading-7 first:mt-0 last:mb-0",e),...t}),a:({className:e,...t})=>l.jsx("a",{className:K("text-neutral6 font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>l.jsx("blockquote",{className:K("border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>l.jsx("ul",{className:K("my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>l.jsx("ol",{className:K("my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>l.jsx("hr",{className:K("my-5 border-b",e),...t}),table:({className:e,...t})=>l.jsx("table",{className:K("my-5 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>l.jsx("th",{className:K("bg-surface4 px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),td:({className:e,...t})=>l.jsx("td",{className:K("border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>l.jsx("tr",{className:K("m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",e),...t}),sup:({className:e,...t})=>l.jsx("sup",{className:K("[&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>l.jsx("pre",{...t,style:{borderBottomRightRadius:"0.5rem",borderBottomLeftRadius:"0.5rem",background:"transparent",fontSize:"0.875rem",marginBottom:"0.5rem",border:"1px solid hsl(0 0% 20.4%)"},className:K("overflow-x-auto p-4 text-white",e)}),code:function({className:t,...n}){const r=XMe();return l.jsxs("pre",{style:{fontSize:"0.875rem",display:"inline"},children:[l.jsx("code",{className:K(!r&&"bg-surface4 rounded border font-semibold",t),...n,style:{fontWeight:"400",paddingBlock:r?0:"0.1em",paddingInline:r?0:"0.3em"}})," "]})},CodeHeader:GSn,SyntaxHighlighter:QSn,img:WSn}),YSn=({reason:e,tripwire:t})=>{const[n,r]=S.useState(!1),s=t&&(t.retry!==void 0||t.tripwirePayload||t.processorId);return l.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-950/20 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3 p-4",children:[l.jsx(XE,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm font-medium text-amber-200 mb-1",children:"Content Blocked"}),l.jsx("p",{className:"text-sm text-amber-300/90",children:e})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>r(!n),className:"w-full flex items-center gap-2 px-4 py-2 text-xs text-amber-400/70 hover:text-amber-400 hover:bg-amber-900/20 transition-colors border-t border-amber-500/20",children:[n?l.jsx(fs,{className:"w-3.5 h-3.5"}):l.jsx(xs,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Details"})]}),n&&l.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-amber-500/20 bg-amber-950/10",children:[t.retry!==void 0&&l.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[l.jsx(YE,{className:"w-3.5 h-3.5 text-amber-400/60"}),l.jsxs("span",{className:"text-xs text-amber-300/70",children:["Retry:"," ",t.retry?l.jsx("span",{className:"text-green-400",children:"Allowed"}):l.jsx("span",{className:"text-red-400",children:"Not allowed"})]})]}),t.processorId&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(MX,{className:"w-3.5 h-3.5 text-amber-400/60"}),l.jsxs("span",{className:"text-xs text-amber-300/70",children:["Processor:"," ",l.jsx("code",{className:"px-1.5 py-0.5 rounded bg-amber-900/30 text-amber-200 font-mono",children:t.processorId})]})]}),t.tripwirePayload!==void 0&&t.tripwirePayload!==null&&l.jsxs("div",{className:"pt-1",children:[l.jsx("p",{className:"text-xs text-amber-400/60 mb-1.5",children:"Metadata:"}),l.jsx("pre",{className:"text-xs text-amber-200/80 bg-amber-900/30 rounded p-2 overflow-x-auto font-mono",children:String(JSON.stringify(t.tripwirePayload,null,2))})]})]})]})]})},$o=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),l.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),XSn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),l.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),Vre=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),Qre=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),Uo=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),E2=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:l.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_22095",children:l.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),Hre=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[l.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"white"}),l.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"white"}),l.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"white"}),l.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"white"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_20513",children:l.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),KSn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),l.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),l.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),AZe=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),Gre=e=>l.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),JSn=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),zi=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),ES=e=>l.jsx(eyt,{...e}),yl=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),Zu=e=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),l.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),e1n=e=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function $0(e){return l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),l.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),l.jsx("path",{d:"M15 2v2"}),l.jsx("path",{d:"M15 20v2"}),l.jsx("path",{d:"M2 15h2"}),l.jsx("path",{d:"M2 9h2"}),l.jsx("path",{d:"M20 15h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M9 2v2"}),l.jsx("path",{d:"M9 20v2"})]})}const t1n={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},n1n={warning:bl,destructive:$d,info:Ri},Ld=({children:e,variant:t="destructive",className:n})=>{const r=n1n[t];return l.jsx("div",{className:K(t1n[t],"p-3 rounded-md border shadow-sm",An.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",n),children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Te,{className:"mt-0.5 flex-shrink-0",children:l.jsx(r,{})}),l.jsx("div",{className:"text-neutral4",children:e})]})})},Fd=({children:e,as:t="h5"})=>l.jsx(we,{as:t,variant:"ui-md",className:"font-semibold",children:e}),Pg=({children:e,as:t="p"})=>l.jsx(we,{as:t,variant:"ui-sm",children:e}),r1n={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},s1n={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},_t=({icon:e,variant:t="default",className:n,children:r,...s})=>l.jsxs("div",{className:K("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",An.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":r1n[t],n),...s,children:[e&&l.jsx("span",{className:s1n[t],children:l.jsx(Te,{children:e})}),r]}),a1n=()=>{const e=tr(({part:o})=>o),[t,n]=S.useState(!1),r=e.text||"",s=e.metadata||{};if(s?.status==="tripwire")return l.jsx(YSn,{reason:r,tripwire:s.tripwire});if(s?.status==="warning")return l.jsxs(Ld,{variant:"warning",children:[l.jsx(Fd,{as:"h5",children:"Warning"}),l.jsx(Pg,{as:"p",children:r})]});if(s?.status==="error")return l.jsxs(Ld,{variant:"destructive",children:[l.jsx(Fd,{as:"h5",children:"Error"}),l.jsx(Pg,{as:"p",children:r})]});const a=s?.completionResult;if(a)return l.jsxs("div",{className:"mb-2 space-y-2",children:[l.jsxs("button",{onClick:()=>n(o=>!o),className:"flex items-center gap-2",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",t?"rotate-90":"rotate-180")})}),l.jsxs(_t,{variant:"info",icon:l.jsx(NX,{}),children:[t?"Show":"Hide"," completion check"]})]}),!t&&l.jsxs(Ld,{variant:"info",children:[l.jsx(Fd,{as:"h5",children:a?.passed?"Complete":"Not Complete"}),l.jsx(N_e,{})]})]});try{const o=r.trim();if(o.startsWith("__ERROR__:")){const i=o.substring(10);return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[l.jsx($d,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),l.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i})]})]})}else if(o.startsWith("Error:")){const i=o.substring(6).trim();return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[l.jsx($d,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),l.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i})]})]})}return l.jsx(N_e,{})}catch{return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[l.jsx($d,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),l.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:String(r)})]})]})}},Cc="mastra_workspace",Ef={FILESYSTEM:{READ_FILE:`${Cc}_read_file`,WRITE_FILE:`${Cc}_write_file`,EDIT_FILE:`${Cc}_edit_file`,LIST_FILES:`${Cc}_list_files`,DELETE:`${Cc}_delete`,FILE_STAT:`${Cc}_file_stat`,MKDIR:`${Cc}_mkdir`},SANDBOX:{EXECUTE_COMMAND:`${Cc}_execute_command`,GET_PROCESS_OUTPUT:`${Cc}_get_process_output`,KILL_PROCESS:`${Cc}_kill_process`},SEARCH:{SEARCH:`${Cc}_search`,INDEX:`${Cc}_index`}},o1n={duration:5e3,cancel:{label:l.jsx(Te,{children:l.jsx(Pr,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card [&>[data-content]]:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"!bg-transparent hover:!bg-surface2 !border-none !rounded-md !p-1.5 !m-0 !text-neutral3 hover:!text-neutral6 shrink-0 transition-all",actionButton:"!bg-white flex items-center justify-center font-medium !text-black order-last hover:opacity-80"}};function Gc(e){const{classNames:t,...n}=o1n,{classNames:r,...s}=e||{};return{...n,classNames:{...t,title:K(t?.title,r?.title),toast:K(t?.toast,r?.toast),cancelButton:K(t?.cancelButton,r?.cancelButton),actionButton:K(t?.actionButton,r?.actionButton),description:K(t?.description,r?.description)},...s}}const qe=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Di(n,Gc(t)));if(xe.isValidElement(e))return Di(e,Gc(t));if(typeof e=="string")return Di(e,Gc(t));throw new Error("Invalid message type")};qe.success=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent1 shrink-0",children:l.jsx(jX,{})}),classNames:{...t.classNames,toast:K("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.success(e,Gc(n));case"object":return e.forEach(r=>Di.success(r,Gc(n)))}};qe.error=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent2 shrink-0",children:l.jsx(ky,{})}),classNames:{...t.classNames,toast:K("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.error(e,Gc(n));case"object":return e.forEach(r=>Di.error(r,Gc(n)))}};qe.warning=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent6 shrink-0",children:l.jsx($d,{})}),classNames:{...t.classNames,toast:K("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.warning(e,Gc(n));case"object":return e.forEach(r=>Di.warning(r,Gc(n)))}};qe.info=(e,t={})=>{const n={...t,icon:l.jsx(Te,{className:"text-accent3 shrink-0",children:l.jsx(Ri,{})}),classNames:{...t.classNames,toast:K("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Di.info(e,Gc(n));case"object":return e.forEach(r=>Di.info(r,Gc(n)))}};qe.custom=(e,t={})=>Di(e,Gc(t));qe.dismiss=e=>{e&&Di.dismiss(e)};qe.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:s,onError:a,options:o={}})=>Di.promise(e,{loading:t??"Loading...",success:i=>(s?.(i),n),error:i=>(a?.(i),r||i?.message||"Error..."),...Gc(o)});function Zd({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=S.useState(!1),s=S.useRef(null),a=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{qe.success(t),r(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{qe.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:a}}const i1n={sm:`${Mi.sm} text-ui-sm px-[.75em]`,md:`${Mi.md} text-ui-md px-[.75em]`,default:`${Mi.default} text-ui-md px-[.85em] `,lg:`${Mi.lg} text-ui-lg px-[1em] `},l1n={default:"bg-white/10 border-2 border-transparent hover:text-white hover:bg-white/15 active:bg-white/20 text-neutral4",primary:"bg-white/20 border-2 border-transparent hover:text-white hover:bg-white/25 active:bg-white/30 text-neutral5",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral4 hover:bg-white/10 active:bg-white/15 text-neutral3",inputLike:Bre,light:"",outline:""},c1n=K("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",qre,Ure),u1n={light:"default",outline:"default"};function d1n(e){return u1n[e]??e}function CS(e){const t=d1n(e?.variant||"default"),n=e?.size||"default";return K(c1n,l1n[t],i1n[n],e?.iconOnly&&"[&>svg]:opacity-75")}function RZe(e){const t=[];return xe.Children.forEach(e,n=>{xe.isValidElement(n)&&n.type===xe.Fragment?t.push(...RZe(n.props.children)):t.push(n)}),t}function f1n(e){const t=RZe(e);return t.length>0&&t.every(n=>xe.isValidElement(n))}const me=xe.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:s,children:a,...o},i)=>{const c=t||"button",u=f1n(a);return l.jsx(c,{ref:i,disabled:s,className:K(CS({variant:r,size:n,iconOnly:u}),e),...o,children:a})});me.displayName="Button";const nv=xe.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx(me,{ref:n,...t})}),e&&l.jsx($n,{children:e})]}));nv.displayName="ButtonWithTooltip";function Zo({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:s}){const[a,o]=S.useState(!1),{handleCopy:i}=Zd({text:e,copyMessage:t}),c=()=>{i(),o(!0),setTimeout(()=>o(!1),2e3)};return l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx(me,{onClick:c,type:"button",size:r,className:s,"aria-label":a?"Copied!":n,children:a?l.jsx(Es,{}):l.jsx(Li,{})})}),l.jsx($n,{children:a?"Copied!":n})]})}const p1n=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,h1n=Qt.mark({class:"cm-variable-highlight"}),j_e=new y2e({regexp:p1n,decoration:()=>h1n}),m1n=Pa.fromClass(class{decorations;constructor(e){this.decorations=j_e.createDeco(e)}update(e){this.decorations=j_e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),g1n=m1n;function b1n(e,t=5){if(!e?.properties)return[];const n=[];function r(s,a,o){if(o>t)return;const i=Array.isArray(s.type)?s.type.join(" | "):s.type;if(n.push({path:a,label:a,description:s.description??s.title,type:i}),s.properties)for(const[c,u]of Object.entries(s.properties))r(u,`${a}.${c}`,o+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))r(u,`${a}[].${c}`,o+1)}for(const[s,a]of Object.entries(e.properties))r(a,s,1);return n}function y1n(e){const t=b1n(e);return n4e({override:[v1n(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function v1n(e){return t=>{const r=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!r)return null;const s=r[1]??"",a=t.pos-s.length,o=s?e.filter(c=>c.path.toLowerCase().startsWith(s.toLowerCase())):e;if(o.length===0)return null;const i=o.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,p)=>{const b=u.state.sliceDoc(p,p+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:p,insert:b},selection:{anchor:f+b.length}})}}));return{from:a,options:i,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const Jg=()=>S.useMemo(()=>{const e=T$({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[re.className,re.propertyName]},{tag:re.heading,color:"#ff79c6",fontWeight:"bold"},{tag:[re.heading1,re.heading2,re.heading3,re.heading4,re.heading5,re.heading6],color:"#ff79c6",fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic",color:"#f8f8f2"},{tag:re.strong,fontWeight:"bold",color:"#f8f8f2"},{tag:re.link,color:"#8be9fd",textDecoration:"underline"},{tag:re.url,color:"#8be9fd"},{tag:re.monospace,color:"#f1fa8c"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.quote,fontStyle:"italic",color:"#6272a4"}]}),t=it.theme({".cm-editor":{colorScheme:"dark",backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"#939393"},".cm-tooltip-autocomplete":{backgroundColor:"#282a36",border:"1px solid #44475a",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.4)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"#f8f8f2"},".cm-completionDetail":{color:"#A1A1AA",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"#282a36",border:"1px solid #44475a",color:"#6272a4",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"#44475a",color:"#f8f8f2"},".cm-line .cm-variable-highlight":{color:"#F59E0B !important",fontWeight:"500"}});return[e,t]},[]),Vs=S.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:s,language:a="json",highlightVariables:o=!1,placeholder:i,wordWrap:c=!1,schema:u,autoFocus:d,...f},p)=>{const h=Jg(),g=e?JSON.stringify(e,null,2):t??"",b=S.useMemo(()=>{const y=[];return a==="json"?y.push(Vc):a==="markdown"&&(y.push(gJ({base:Dy,codeLanguages:kLe})),y.push(it.lineWrapping)),o&&a==="markdown"&&y.push(g1n),u&&a==="markdown"&&y.push(y1n(u)),y},[a,o,u]);return l.jsxs("div",{className:K("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...f,children:[r&&l.jsx(Zo,{content:g,className:"absolute top-2 right-2 z-20"}),l.jsx(Xc,{ref:p,value:g,theme:h,extensions:b,onChange:n,"aria-label":"Code editor",placeholder:i,height:"100%",style:{height:"100%"},autoFocus:d})]})});async function x1n(e,t){const{codeToTokens:n,bundledLanguages:r}=await Qe(async()=>{const{codeToTokens:a,bundledLanguages:o}=await import("./index-DkLlZWtE.js");return{codeToTokens:a,bundledLanguages:o}},__vite__mapDeps([26,1]),import.meta.url);if(!(t in r))return null;const{tokens:s}=await n(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}const C2=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:s=!0,extraInfo:a,"data-testid":o})=>{const[i,c]=S.useState(t);return S.useEffect(()=>{c(t)},[t]),l.jsxs("div",{className:"mb-4","data-testid":o,children:[l.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[l.jsxs("button",{onClick:s?()=>c(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!s,type:"button",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",i?"rotate-90":"rotate-180")})}),l.jsx(_t,{icon:n,children:r})]}),a]}),!i&&l.jsx("div",{className:"pt-2",children:l.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})},as=vM,IZe=ije,w1n=xM,PZe=S.forwardRef(({className:e,...t},n)=>l.jsx($E,{ref:n,className:K("fixed inset-0 z-50 bg-overlay 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",e),...t}));PZe.displayName=$E.displayName;const ts=S.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(w1n,{children:[l.jsx(PZe,{}),l.jsxs(DE,{ref:r,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,l.jsxs(OM,{className:K("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[l.jsx(Pr,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ts.displayName=DE.displayName;const os=({className:e,...t})=>l.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});os.displayName="DialogHeader";const TS=({className:e,...t})=>l.jsx("div",{className:K("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});TS.displayName="DialogFooter";const is=({className:e,...t})=>l.jsx("div",{className:K("overflow-y-auto px-6 max-h-[50vh]",e),...t});is.displayName="DialogBody";const ns=S.forwardRef(({className:e,...t},n)=>l.jsx(wM,{ref:n,className:K("text-ui-md font-medium",e),...t}));ns.displayName=wM.displayName;const Js=S.forwardRef(({className:e,...t},n)=>l.jsx(SM,{ref:n,className:K("sr-only",e),...t}));Js.displayName=SM.displayName;const S1n=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let s=null;if(r)try{s=typeof r=="object"?l.jsx(Vs,{data:r}):l.jsx(Vs,{data:JSON.parse(r)})}catch{s=l.jsx("pre",{className:"whitespace-pre-wrap",children:r})}return l.jsx(as,{open:t,onOpenChange:n,children:l.jsxs(ts,{children:[l.jsxs(os,{children:[l.jsx(ns,{children:"Agent Network Metadata"}),l.jsx(Js,{children:"View the metadata of the agent's network choice."})]}),l.jsxs(is,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(we,{className:"text-neutral3",children:"Selection Reason"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),s&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(we,{className:"text-neutral3",children:"Input"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:s})]})]})]})})},Wre=({selectionReason:e,input:t})=>{const[n,r]=S.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(_s,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(s=>!s),children:l.jsx(jbt,{className:"text-neutral3 size-5"})}),l.jsx(S1n,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},MZe=S.createContext(void 0);function O1n({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:o,isRunning:i,toolCallApprovals:c,networkToolCallApprovals:u}){return l.jsx(MZe.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:o,isRunning:i,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function k1n(){const e=S.useContext(MZe);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const nT=({toolCalled:e,toolCallId:t,toolApprovalMetadata:n,toolName:r,isNetwork:s,isGenerateMode:a})=>{const{approveToolcall:o,declineToolcall:i,approveToolcallGenerate:c,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:f,approveNetworkToolcall:p,declineNetworkToolcall:h,networkToolCallApprovals:g}=k1n(),b=()=>{s?p(r,n?.runId):a?c(t):o(t)},y=()=>{s?h(r,n?.runId):a?u(t):i(t)},x=s?g?.[n?.runId?`${n.runId}-${r}`:r]?.status:f?.[t]?.status;return n&&!e?l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsxs(me,{onClick:b,disabled:d||!!x,className:x==="approved"?"!text-accent1":"",children:[l.jsx(Te,{children:l.jsx(Es,{})}),"Approve"]}),l.jsxs(me,{onClick:y,disabled:d||!!x,className:x==="declined"?"!text-accent2":"",children:[l.jsx(Te,{children:l.jsx(Pr,{})}),"Decline"]})]})]}):null},_1n=({toolName:e,args:t,result:n,metadata:r,toolOutput:s,toolCallId:a,toolApprovalMetadata:o,suspendPayload:i,isNetwork:c,toolCalled:u})=>{let d=null;try{const{__mastraMetadata:y,...x}=typeof t=="object"?t:JSON.parse(t);d=l.jsx(Vs,{data:x,"data-testid":"tool-args"})}catch{d=l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:t})}let f=typeof n=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:n}):l.jsx(Vs,{data:n,"data-testid":"tool-result"}),p=typeof i=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:i}):l.jsx(Vs,{data:i,"data-testid":"tool-suspend-payload"});const h=r?.mode==="network"?r.selectionReason:void 0,g=r?.mode==="network"?r.agentInput:void 0,b=u??(n||s.length>0);return l.jsx(C2,{"data-testid":"tool-badge",icon:l.jsx(zi,{className:"text-accent6"}),title:e,extraInfo:r?.mode==="network"&&l.jsx(Wre,{selectionReason:h||"",input:g}),initialCollapsed:!(o??i),children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),d]}),p!==void 0&&i&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool suspend payload"}),p]}),f!==void 0&&n&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool result"}),f]}),s.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool output"}),l.jsx("div",{className:"h-40 overflow-y-auto",children:l.jsx(Vs,{data:s,"data-testid":"tool-output"})})]}),l.jsx(nT,{toolCalled:b,toolCallId:a,toolApprovalMetadata:o,toolName:e,isNetwork:c,isGenerateMode:r?.mode==="generate"})]})})},$Ze=S.createContext({Link:S.forwardRef(()=>null),navigate:()=>{},paths:{agentLink:()=>"",agentsLink:()=>"",agentToolLink:()=>"",agentSkillLink:()=>"",agentThreadLink:()=>"",agentNewThreadLink:()=>"",workflowsLink:()=>"",workflowLink:()=>"",networkLink:()=>"",networkNewThreadLink:()=>"",networkThreadLink:()=>"",scorerLink:()=>"",cmsScorersCreateLink:()=>"",cmsScorerEditLink:()=>"",cmsAgentCreateLink:()=>"",cmsAgentEditLink:()=>"",promptBlockLink:()=>"",promptBlocksLink:()=>"",cmsPromptBlockCreateLink:()=>"",cmsPromptBlockEditLink:()=>"",toolLink:()=>"",skillLink:()=>"",workspacesLink:()=>"",workspaceLink:()=>"",workspaceSkillLink:()=>"",processorsLink:()=>"",processorLink:()=>"",mcpServerLink:()=>"",mcpServerToolLink:()=>"",workflowRunLink:()=>"",datasetLink:()=>"",datasetItemLink:()=>"",datasetExperimentLink:()=>""}}),E1n=({children:e,Link:t,navigate:n,paths:r})=>l.jsx($Ze.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),Gt=()=>{const e=S.useContext($Ze);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},C1n=e=>{switch(e){case"running":return"bg-green-500";case"starting":case"initializing":return"bg-yellow-500";case"stopped":case"paused":return"bg-gray-500";case"error":case"failed":return"bg-red-500";default:return"bg-accent6"}},T1n=(e,t)=>{const[n,r]=S.useState(0),s=S.useRef(null);return S.useEffect(()=>{if(e){r(0),s.current=t||Date.now();const a=setInterval(()=>{s.current&&r(Date.now()-s.current)},100);return()=>clearInterval(a)}else s.current=null},[e,t]),n},N1n=({command:e,content:t,maxHeight:n="20rem",onCopy:r,isCopied:s})=>{const a=S.useRef(null);return S.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[t]),l.jsxs("div",{className:"rounded-md border border-border1 overflow-hidden",children:[e&&l.jsxs("div",{className:"px-3 py-2 bg-surface3 border-b border-border1 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"text-neutral6 text-xs shrink-0",children:"$"}),l.jsx("code",{className:"text-xs text-neutral-300 font-mono truncate",children:e})]}),r&&l.jsx(_s,{variant:"light",size:"sm",tooltip:"Copy output",onClick:r,className:"shrink-0",children:l.jsxs("span",{className:"grid",children:[l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-100":"scale-0"),children:l.jsx(Es,{size:14})}),l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-0":"scale-100"),children:l.jsx(Li,{size:14})})]})})]}),l.jsx("pre",{ref:a,style:{maxHeight:n},className:"overflow-x-auto overflow-y-auto p-3 text-sm text-neutral-300 font-mono whitespace-pre-wrap bg-black",children:t||l.jsx("span",{className:"text-neutral6 italic",children:"No output"})})]})},j1n=({toolName:e,args:t,result:n,metadata:r,toolCallId:s,toolApprovalMetadata:a,isNetwork:o,toolCalled:i})=>{const c=tr(W=>W.message),u=S.useMemo(()=>c.content.filter(D=>D.type==="data"),[c.content]),[d,f]=S.useState(!1),{isCopied:p,copyToClipboard:h}=_2(),{Link:g}=Gt(),b=u.find(W=>W.name==="sandbox-command"&&W.data?.toolCallId===s);let y="";try{const W=typeof t=="object"?t:JSON.parse(t);e===Ef.SANDBOX.EXECUTE_COMMAND?y=W.command||"":(e===Ef.SANDBOX.GET_PROCESS_OUTPUT||e===Ef.SANDBOX.KILL_PROCESS)&&(y=b?.data?.command||`PID ${W.pid}`)}catch{y=e}const x=u.filter(W=>(W.name==="sandbox-stdout"||W.name==="sandbox-stderr")&&W.data?.toolCallId===s),w=u.find(W=>W.name==="workspace-metadata"&&W.data?.toolCallId===s),O=w?.data,_=u.find(W=>W.name==="sandbox-exit"&&W.data?.toolCallId===s),C=!!_||typeof n=="string",E=!!w,T=E&&!C,N=i??(C||E),A=_?.data?.exitCode,I=_?.data?.success,P=_?.data?.executionTimeMs,$=_?.data?.killed,L=x.map(W=>W.data?.output||"").join("")||(typeof n=="string"?n:""),B=e===Ef.SANDBOX.EXECUTE_COMMAND?"Execute Command":e===Ef.SANDBOX.GET_PROCESS_OUTPUT?"Get Process Output":e===Ef.SANDBOX.KILL_PROCESS?"Kill Process":e,H=x[0]?.data?.timestamp,q=T1n(T,H),V=()=>{!L||p||h(L)};return l.jsxs("div",{className:"mb-4","data-testid":"sandbox-execution-badge",children:[l.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[l.jsxs("button",{onClick:()=>f(W=>!W),className:"flex items-center gap-2 min-w-0",type:"button",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",d?"rotate-90":"rotate-180")})}),l.jsx(_t,{icon:l.jsx(Dbt,{className:"text-accent6",size:16}),children:B}),O?.sandbox&&l.jsxs(g,{href:O.id?`/workspaces/${O.id}`:"/workspaces",className:"flex items-center gap-1.5 text-xs text-neutral6 px-1.5 py-0.5 rounded bg-surface3 border border-border1 hover:bg-surface4 hover:border-border2 transition-colors",onClick:W=>W.stopPropagation(),children:[l.jsx("span",{className:K("w-1.5 h-1.5 rounded-full",C1n(O.sandbox.status))}),l.jsx("span",{children:O.sandbox.name||O.sandbox.provider})]})]}),l.jsx("div",{className:"flex items-center gap-2",children:T?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-accent6",children:[l.jsx("span",{className:"w-1.5 h-1.5 bg-accent6 rounded-full animate-pulse"}),l.jsx("span",{className:"animate-pulse",children:"running"})]}),l.jsxs("span",{className:"text-neutral6 text-xs tabular-nums",children:[q,"ms"]})]}):l.jsxs(l.Fragment,{children:[A!==void 0&&(I?l.jsx(Es,{className:"text-green-400",size:14}):$?l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-orange-500/20 text-orange-400",children:"killed"}):l.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-red-500/20 text-red-400",children:["exit ",A]})),P!==void 0&&l.jsxs("span",{className:"text-neutral6 text-xs",children:[P,"ms"]})]})})]}),!d&&l.jsxs("div",{className:"pt-2",children:[(L||y)&&l.jsx(N1n,{command:y,content:L,onCopy:L?V:void 0,isCopied:p}),l.jsx(nT,{toolCalled:N,toolCallId:s,toolApprovalMetadata:a,toolName:e,isNetwork:o,isGenerateMode:r?.mode==="generate"})]})]})},A1n=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:s,isNetwork:a,toolCalled:o})=>{const[i,c]=S.useState(!s),{isCopied:u,copyToClipboard:d}=_2();S.useEffect(()=>{c(!s)},[s]);const{Link:f}=Gt();let p={path:"."};try{p=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:h=".",maxDepth:g,showHidden:b,dirsOnly:y,exclude:x,extension:w}=p,O=[];g!==void 0&&g!==3&&O.push(`depth: ${g}`),b&&O.push("hidden"),y&&O.push("dirs only"),x&&O.push(`exclude: ${x}`),w&&O.push(`ext: ${w}`);let _="",C="";if(typeof n=="string"&&n){const $=n.lastIndexOf(`
|
|
437
437
|
|
|
438
438
|
`);$!==-1?(_=n.slice(0,$),C=n.slice($+2)):_=n}const E=!!_,T=o??E,N=tr($=>$.message),I=S.useMemo(()=>N.content.find(U=>U.type==="data"&&U.name==="workspace-metadata"&&U.data?.toolCallId===r),[N.content,r])?.data,P=()=>{!_||u||d(_)};return l.jsxs("div",{className:"mb-4","data-testid":"file-tree-badge",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsxs("button",{onClick:()=>c($=>!$),className:"flex items-center gap-2 min-w-0",type:"button",children:[l.jsx(Te,{children:l.jsx(fv,{className:K("transition-all",i?"rotate-90":"rotate-180")})}),l.jsxs(_t,{icon:l.jsx(agt,{className:"text-accent6",size:16}),children:["List Files ",l.jsx("span",{className:"text-neutral6 font-normal ml-1",children:h}),O.length>0&&l.jsxs("span",{className:"text-neutral4 font-normal ml-1",children:["(",O.join(", "),")"]})]})]}),I?.filesystem&&l.jsxs(f,{href:I.id?`/workspaces/${I.id}?path=${encodeURIComponent(h)}`:"/workspaces",className:"flex items-center gap-1.5 text-xs text-neutral6 px-1.5 py-0.5 rounded bg-surface3 border border-border1 hover:bg-surface4 hover:border-border2 transition-colors",children:[l.jsx(FQ,{className:"size-3"}),l.jsx("span",{children:I.name||I.filesystem.name})]}),i&&E&&C&&l.jsx("span",{className:"text-neutral6 text-xs",children:C})]}),!i&&l.jsxs("div",{className:"pt-2",children:[s&&!T&&l.jsxs("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),l.jsx(Vs,{data:p,"data-testid":"tool-args"})]}),l.jsx(nT,{toolCalled:T,toolCallId:r,toolApprovalMetadata:s,toolName:e,isNetwork:a})]}),T&&_&&l.jsxs("div",{className:"rounded-md border border-border1 bg-surface2 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border1 bg-surface3",children:[C&&l.jsx("span",{className:"text-neutral6 text-xs",children:C}),l.jsx(_s,{variant:"light",size:"sm",tooltip:"Copy tree",onClick:P,disabled:!_,children:l.jsxs("span",{className:"grid",children:[l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",u?"scale-100":"scale-0"),children:l.jsx(Es,{size:14})}),l.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",u?"scale-0":"scale-100"),children:l.jsx(Li,{size:14})})]})})]}),l.jsx("pre",{className:"p-3 text-xs font-mono text-mastra-el-6 overflow-x-auto whitespace-pre max-h-[300px] overflow-y-auto",children:_})]}),T&&!E&&l.jsx("div",{className:"rounded-md border border-border1 bg-surface2 px-3 py-2",children:l.jsx("span",{className:"text-xs text-neutral6",children:"Loading..."})})]})]})};function pZ(e){const t={},n=e.context||{};Object.entries(n).forEach(([o,i])=>{if(o!=="input"&&"status"in i){const c=i,u=c.status==="failed"&&c.tripwire!==void 0;t[o]={status:c.status,output:"output"in c?c.output:void 0,payload:"payload"in c?c.payload:void 0,suspendPayload:"suspendPayload"in c?c.suspendPayload:void 0,suspendOutput:"suspendOutput"in c?c.suspendOutput:void 0,resumePayload:"resumePayload"in c?c.resumePayload:void 0,error:u?void 0:"error"in c?c.error:void 0,tripwire:u?c.tripwire:void 0,startedAt:"startedAt"in c?c.startedAt:Date.now(),endedAt:"endedAt"in c?c.endedAt:void 0,suspendedAt:"suspendedAt"in c?c.suspendedAt:void 0,resumedAt:"resumedAt"in c?c.resumedAt:void 0}}});const r=Object.entries(t).flatMap(([o,i])=>{if(i?.status==="suspended"){const c=i?.suspendPayload?.__workflow_meta?.path;return c?[[o,...c]]:[[o]]}return[]}),s=r?.[0]?.[0],a=s?t[s]?.suspendPayload:void 0;return{input:n.input,steps:t,status:e.status,...e.status==="success"?{result:e.result}:{},...e.status==="failed"?{error:e.error}:{},...e.status==="suspended"?{suspended:r,suspendPayload:a}:{},...e.status==="tripwire"&&e.tripwire?{tripwire:{reason:e.tripwire.reason,retry:e.tripwire.retry,metadata:e.tripwire.metadata,processorId:e.tripwire.processorId}}:{}}}const rT=()=>{const[e,t]=S.useState(!1),n=S.useCallback(r=>{if(r){const s=new IntersectionObserver(([a])=>{t(a.isIntersecting)});return s.observe(r),()=>s.disconnect()}},[]);return{inView:e,setRef:n}},zr=OY()(qVt(e=>({requestContext:{},setRequestContext:t=>e({requestContext:t})}),{name:"mastra-playground-store"})),sT=e=>{const t=Xe(),{requestContext:n}=zr();return qt({queryKey:["workflow",e],queryFn:()=>e?t.getWorkflow(e).details(n):null,enabled:!!e,retry:!1,refetchOnWindowFocus:!1,throwOnError:!1})},hZ=20;function R1n(e,t,n){if(!(e.runs.length<hZ))return n+1}function I1n(e){const t=new Set;return e.pages.flatMap(n=>n.runs).filter(n=>t.has(n.runId)?!1:(t.add(n.runId),!0))}const DZe=(e,{enabled:t=!0}={})=>{const n=Xe(),{inView:r,setRef:s}=rT(),a=bS({queryKey:["workflow-runs",e],queryFn:({pageParam:u})=>n.getWorkflow(e).runs({limit:hZ,offset:u*hZ}),initialPageParam:0,getNextPageParam:R1n,select:I1n,retry:!1,enabled:t,refetchInterval:5e3}),{hasNextPage:o,isFetchingNextPage:i,fetchNextPage:c}=a;return S.useEffect(()=>{r&&o&&!i&&c()},[r,o,i,c]),{...a,setEndOfListElement:s}},LZe=(e,t,n)=>{const r=Xe();return qt({queryKey:["workflow-run",e,t],queryFn:()=>r.getWorkflow(e).runById(t),enabled:!!(e&&t),gcTime:0,staleTime:0,refetchInterval:n})},P1n=e=>{const t=Xe(),n=Ts();return Ln({mutationFn:({runId:r})=>t.getWorkflow(e).deleteRunById(r),onSuccess:()=>{n.invalidateQueries({queryKey:["workflow-runs",e]}),qe.success("Workflow run deleted successfully")},onError:()=>{qe.error("Failed to delete workflow run")}})},FZe=S.createContext(null);function T2(){const e=S.useContext(FZe);if(!e)throw new Error("useWorkflowStepDetail must be used within WorkflowStepDetailProvider");return e}function M1n({children:e}){const[t,n]=S.useState(null),r=S.useCallback(({stepName:o,stepId:i,mapConfig:c})=>{n({type:"map-config",stepName:o,stepId:i,mapConfig:c})},[]),s=S.useCallback(({label:o,stepGraph:i,fullStep:c})=>{n({type:"nested-graph",stepName:o,nestedGraph:{label:o,stepGraph:i,fullStep:c}})},[]),a=S.useCallback(()=>{n(null)},[]);return l.jsx(FZe.Provider,{value:{stepDetail:t,showMapConfig:r,showNestedGraph:s,closeStepDetail:a},children:e})}function $1n({entityId:e,entityType:t}){const[n,r]=S.useState(void 0),s=`tracing-options-${t}:${e}`;return S.useEffect(()=>{try{const i=localStorage.getItem(s);if(i){const c=JSON.parse(i);r(c||void 0)}}catch(i){console.error(i)}},[s]),{settings:n,setSettings:i=>{r(c=>({...c,...i})),localStorage.setItem(s,JSON.stringify({...i,entityId:e,entityType:t}))},resetAll:()=>{r(void 0),localStorage.removeItem(s)},entityType:t}}const zZe=S.createContext({setSettings:()=>{},resetAll:()=>{},settings:void 0,entityType:void 0}),BZe=({children:e,entityId:t,entityType:n})=>{const r=$1n({entityId:t,entityType:n});return l.jsx(zZe.Provider,{value:r,children:e})},Zre=()=>S.useContext(zZe),vp=S.createContext({});function Yre({children:e,snapshot:t,workflowId:n,initialRunId:r,withoutTimeTravel:s=!1}){const[a,o]=S.useState(()=>t?pZ(t):null),[i,c]=S.useState(()=>t?.context?.input??null),[u,d]=S.useState(()=>r??""),[f,p]=S.useState(!1),[h,g]=S.useState(!1),b=f||["success","failed","canceled","bailed"].includes(a?.status??"")?void 0:5e3,{isLoading:y,data:x}=LZe(n,r??"",b),w=S.useMemo(()=>x&&r?{context:{input:x?.payload,...x?.steps},status:x?.status,result:x?.result,error:x?.error,runId:r,serializedStepGraph:x?.serializedStepGraph,value:x?.initialState}:void 0,[x,r]),{data:O,isLoading:_,error:C}=sT(n),{settings:E}=Zre(),T=FVt(),{streamWorkflow:N,streamResult:A,isStreaming:I,observeWorkflowStream:P,closeStreamsAndReset:$,resumeWorkflowStream:U,timeTravelWorkflowStream:L}=LVt({debugMode:h,tracingOptions:E?.tracingOptions,onError:q=>qe.error(q.message)}),B=zVt(),H=()=>{o(null),c(null)};return S.useEffect(()=>{p(!1)},[r]),S.useEffect(()=>{w?.runId&&(o(pZ(w)),w.value&&Object.keys(w.value).length>0?c({initialState:w.value,inputData:w.context?.input}):c(w.context?.input),d(w.runId))},[w]),l.jsx(vp.Provider,{value:{workflowId:n,result:a,setResult:o,payload:i,setPayload:c,clearData:H,snapshot:t,runId:u,setRunId:d,workflowError:C??null,workflow:O??void 0,isLoading:_,createWorkflowRun:T.mutateAsync,streamWorkflow:q=>(p(!0),N.mutateAsync(q)),resumeWorkflow:q=>(p(!0),U.mutateAsync(q)),streamResult:A,isStreamingWorkflow:I,isCancellingWorkflowRun:B.isPending,cancelWorkflowRun:B.mutateAsync,observeWorkflowStream:q=>(p(!0),P.mutate(q)),closeStreamsAndReset:$,timeTravelWorkflowStream:q=>(p(!0),L.mutateAsync(q)),runSnapshot:w,isLoadingRunExecutionResult:y,withoutTimeTravel:s,debugMode:h,setDebugMode:g},children:l.jsx(M1n,{children:e})})}function cr({className:e,...t}){return l.jsx("div",{className:K("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:translate-x-[-100%]","before:animate-[shimmer_2s_infinite]","before:bg-gradient-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const D1n=e=>e.replace(/[-_\s]+(.)?/g,(n,r)=>r?r.toUpperCase():"").replace(/^(.)/,n=>n.toLowerCase()).replace(/([A-Z])/g," $1").replace(/^./,n=>n.toUpperCase()).trim(),L1n=(e,t,n)=>{if(!e.startsWith("mapping_"))return e;const r=c=>c.split(" ").map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join(" "),s=c=>{const u=c.replace(/Step$/,"").replace(/[-_]/g," ").trim();return r(u)},a=(c,u)=>c.length===0?u?"End":"Start":c.length===1?s(c[0]):`${c.length} Steps`,o=a(t,!1),i=a(n,!0);return`${o} → ${i} Map`},F1n=(e,t)=>{const n=new Wwe.graphlib.Graph().setDefaultEdgeLabel(()=>({}));n.setGraph({rankdir:"TB"}),t.forEach(a=>n.setEdge(a.source,a.target)),e.forEach(a=>n.setNode(a.id,{...a,width:a.measured?.width??274,height:a.measured?.height??(a?.data?.isLarge?260:100)})),Wwe.layout(n);const r=n.graph()?.width?n.graph().width/2:0,s=n.graph()?.height?n.graph().height/2:0;return{nodes:e.map(a=>{const o=n.node(a.id),i=o.x-(a.measured?.width??274)/2,c=o.y-(a.measured?.height??(a?.data?.isLarge?260:100))/2;return{...a,position:{x:i,y:c}}}),edges:t,fullWidth:r,fullHeight:s}},yd={animated:!0,markerEnd:{type:P_.ArrowClosed,width:20,height:20,color:"#8e8e8e"}},mZ=({stepFlow:e,xIndex:t,yIndex:n,prevNodeIds:r,prevStepIds:s,nextStepFlow:a,condition:o,allPrevNodeIds:i})=>{let c=[],u=[];if((a?.type==="step"||a?.type==="foreach"||a?.type==="loop")&&(c=[i?.includes(a.step.id)?`${a.step.id}-${n+1}`:a.step.id],u=[a.step.id]),(a?.type==="sleep"||a?.type==="sleepUntil")&&(c=[i?.includes(a.id)?`${a.id}-${n+1}`:a.id],u=[a.id]),a?.type==="parallel"&&(c=a?.steps.map(d=>{const f=d.step.id;return i?.includes(f)?`${f}-${n+1}`:f})||[],u=a?.steps.map(d=>d.step.id)||[]),a?.type==="conditional"&&(c=a?.serializedConditions.map(d=>d.id)||[],u=a?.steps?.map(d=>d.step.id)||[]),e.type==="step"||e.type==="foreach"){const d=e.step.component==="WORKFLOW",f=i?.includes(e.step.id)?`${e.step.id}-${n}`:e.step.id,p=[...o?[{id:o.id,position:{x:t*300,y:n*100},type:"condition-node",data:{label:o.id,previousStepId:s[s.length-1],nextStepId:e.step.id,withoutTopHandle:!r.length,withoutBottomHandle:!c.length,isLarge:!0,conditions:[{type:"when",fnString:o.fn}]}}]:[],{id:f,position:{x:t*300,y:(n+(o?1:0))*100},type:d?"nested-node":"default-node",data:{label:L1n(e.step.id,s,u),stepId:e.step.id,description:e.step.description,withoutTopHandle:o?!1:!r.length,withoutBottomHandle:!c.length,stepGraph:d?e.step.serializedStepFlow:void 0,mapConfig:e.step.mapConfig,canSuspend:e.step.canSuspend,isForEach:e.type==="foreach",metadata:e.step.metadata}}],h=[...o?[...(r||[]).map((g,b)=>({id:`e${g}-${o.id}`,source:g,data:{previousStepId:s[b],nextStepId:e.step.id},target:o.id,...yd})),{id:`e${o.id}-${f}`,source:o.id,data:{previousStepId:s[s.length-1],nextStepId:e.step.id,conditionNode:!0},target:f,...yd}]:(r||[]).map((g,b)=>({id:`e${g}-${f}`,source:g,data:{previousStepId:s[b],nextStepId:e.step.id},target:f,...yd})),...(c||[]).map((g,b)=>({id:`e${f}-${g}`,source:f,data:{previousStepId:e.step.id,nextStepId:u[b]},target:g,...yd}))];return{nodes:p,edges:h,nextPrevNodeIds:[f],nextPrevStepIds:[e.step.id]}}if(e.type==="sleep"||e.type==="sleepUntil"){const d=i?.includes(e.id)?`${e.id}-${n}`:e.id,f=[...o?[{id:o.id,position:{x:t*300,y:n*100},type:"condition-node",data:{label:o.id,previousStepId:s[s.length-1],nextStepId:e.id,withoutTopHandle:!1,withoutBottomHandle:!c.length,isLarge:!0,conditions:[{type:"when",fnString:o.fn}]}}]:[],{id:d,position:{x:t*300,y:(n+(o?1:0))*100},type:"default-node",data:{label:e.id,withoutTopHandle:o?!1:!r.length,withoutBottomHandle:!c.length,...e.type==="sleepUntil"?{date:e.date}:{duration:e.duration}}}],p=[...r.length?o?[...r.map((h,g)=>({id:`e${h}-${o.id}`,source:h,data:{previousStepId:s[g],nextStepId:e.id},target:o.id,...yd})),{id:`e${o.id}-${d}`,source:o.id,data:{previousStepId:s[s.length-1],nextStepId:e.id},target:d,...yd}]:r.map((h,g)=>({id:`e${h}-${d}`,source:h,data:{previousStepId:s[g],nextStepId:e.id},target:d,...yd})):[],...c.length?c.map((h,g)=>({id:`e${d}-${h}`,source:d,data:{previousStepId:e.id,nextStepId:u[g]},target:h,...yd})):[]];return{nodes:f,edges:p,nextPrevNodeIds:[d],nextPrevStepIds:[e.id]}}if(e.type==="loop"){const{step:d,serializedCondition:f,loopType:p}=e,h=d.component==="WORKFLOW",g=[{id:d.id,position:{x:t*300,y:n*100},type:h?"nested-node":"default-node",data:{label:d.id,description:d.description,withoutTopHandle:!r.length,withoutBottomHandle:!1,stepGraph:h?d.serializedStepFlow:void 0,canSuspend:d.canSuspend,metadata:d.metadata}},{id:f.id,position:{x:t*300,y:(n+1)*100},type:"condition-node",data:{label:f.id,previousStepId:d.id,nextStepId:u[0],withoutTopHandle:!1,withoutBottomHandle:!c.length,isLarge:!0,conditions:[{type:p,fnString:f.fn}]}}],b=[...r.length?r.map((y,x)=>({id:`e${y}-${d.id}`,source:y,data:{previousStepId:s[x],nextStepId:d.id},target:d.id,...yd})):[],{id:`e${d.id}-${f.id}`,source:d.id,data:{previousStepId:d.id,nextStepId:u[0]},target:f.id,...yd},...c.length?c.map((y,x)=>({id:`e${f.id}-${y}`,source:f.id,data:{previousStepId:d.id,nextStepId:u[x]},target:y,...yd})):[]];return{nodes:g,edges:b,nextPrevNodeIds:[f.id],nextPrevStepIds:[d.id]}}if(e.type==="parallel"){let d=[],f=[],p=[];return e.steps.forEach((h,g)=>{const{nodes:b,edges:y,nextPrevStepIds:x}=mZ({stepFlow:h,xIndex:g,yIndex:n,prevNodeIds:r,prevStepIds:s,nextStepFlow:a,allPrevNodeIds:i}),w=b.map(O=>({...O,data:{...O.data,isParallel:!0}}));d.push(...w),f.push(...y),p.push(...x)}),{nodes:d,edges:f,nextPrevNodeIds:d.map(h=>h.id),nextPrevStepIds:p}}if(e.type==="conditional"){let d=[],f=[],p=[];return e.steps.forEach((h,g)=>{const{nodes:b,edges:y,nextPrevStepIds:x}=mZ({stepFlow:h,xIndex:g,yIndex:n,prevNodeIds:r,prevStepIds:s,nextStepFlow:a,condition:e.serializedConditions[g],allPrevNodeIds:i});d.push(...b),f.push(...y),p.push(...x)}),{nodes:d,edges:f,nextPrevNodeIds:d.filter(({type:h})=>h!=="condition-node").map(h=>h.id),nextPrevStepIds:p}}return{nodes:[],edges:[],nextPrevNodeIds:[],nextPrevStepIds:[]}},UZe=({stepGraph:e})=>{if(!e)return{nodes:[],edges:[]};if(e.length===0)return{nodes:[],edges:[]};let t=[],n=[],r=[],s=[],a=[];for(let c=0;c<e.length;c++){const{nodes:u,edges:d,nextPrevNodeIds:f,nextPrevStepIds:p}=mZ({stepFlow:e[c],xIndex:c,yIndex:c,prevNodeIds:r,prevStepIds:s,nextStepFlow:c===e.length-1?void 0:e[c+1],allPrevNodeIds:a});t.push(...u),n.push(...d),r=f,s=p,a.push(...r)}const{nodes:o,edges:i}=F1n(t,n);return{nodes:o,edges:i}},Yd=oit,Yu=xe.forwardRef(({className:e,children:t,...n},r)=>l.jsx(MY,{ref:r,className:K("-outline-offset-2",An.colors,Kg.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...n,children:t}));Yu.displayName=MY.displayName;const Xu=xe.forwardRef(({className:e,children:t,...n},r)=>l.jsx(DY,{ref:r,className:K("overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1","duration-normal ease-out-custom",e),...n,children:t}));Xu.displayName=DY.displayName;const ro={sleep:"#A855F7",forEach:"#F97316",map:"#F97316",parallel:"#3B82F6",suspend:"#EC4899",after:"#14B8A6",workflow:"#8B5CF6",when:"#ECB047",dountil:"#8B5CF6",dowhile:"#06B6D4",until:"#F59E0B",while:"#10B981",if:"#3B82F6",else:"#6B7280"},Io={sleep:qR,sleepUntil:Iht,forEach:G0,map:G0,parallel:uMe,suspend:ZPe,after:pv,workflow:nMe,when:sMe,dountil:ybt,dowhile:xbt,until:qR,while:YE,if:tMe,else:Nmt},A_e=e=>{switch(e){case"when":return{icon:Io.when,color:ro.when};case"dountil":return{icon:Io.dountil,color:ro.dountil};case"dowhile":return{icon:Io.dowhile,color:ro.dowhile};case"until":return{icon:Io.until,color:ro.until};case"while":return{icon:Io.while,color:ro.while};case"if":return{icon:Io.if,color:ro.if};case"else":return{icon:Io.else,color:ro.else};default:return{icon:void 0,color:void 0}}},qZe=e=>{const t=!!(e.duration||e.date),n=!!e.isForEach,r=!!(e.mapConfig&&!e.isForEach),s=!!e.stepGraph,a=t||e.canSuspend||e.isParallel||n||r||s;return{isSleepNode:t,isForEachNode:n,isMapNode:r,isNestedWorkflow:s,hasSpecialBadge:a}},VZe=(e,{enabled:t=!0})=>{const n=S.useRef(t);xe.useEffect(()=>{if(!t||!e?.current)return;const r=e.current,s=new MutationObserver(()=>{n.current&&r.scrollTo({top:r.scrollHeight,behavior:"smooth"})});s.observe(r,{childList:!0,subtree:!0,characterData:!0});const a=o=>{const i=o.target,c=i.scrollTop+i.clientHeight,u=i.scrollHeight;c>=u-1?n.current=!0:n.current=!1};return r.addEventListener("scroll",a),()=>{r.removeEventListener("scroll",a),s.disconnect()}},[t,e])},Ds=S.forwardRef(({className:e,children:t,viewPortClassName:n,maxHeight:r,autoScroll:s=!1,...a},o)=>{const i=S.useRef(null);return VZe(i,{enabled:s}),l.jsxs(iIe,{ref:o,className:K("relative overflow-hidden",e),...a,children:[l.jsx(Jdt,{ref:i,className:K("h-full w-full rounded-[inherit] [&>div]:!block",n),style:r?{maxHeight:r}:void 0,children:t}),l.jsx(QZe,{}),l.jsx(eft,{})]})});Ds.displayName=iIe.displayName;const QZe=S.forwardRef(({className:e,orientation:t="vertical",...n},r)=>l.jsx(dX,{ref:r,orientation:t,className:K("flex touch-none select-none transition-all duration-normal ease-out-custom","opacity-0 hover:opacity-100 data-[state=visible]:opacity-100",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e),...n,children:l.jsx(nIe,{className:"relative flex-1 rounded-full bg-neutral2 hover:bg-neutral3 transition-colors duration-normal"})}));QZe.displayName=dX.displayName;const aT=()=>{const e=S.useContext(vp),t=e.result?.steps??{};return{steps:Object.entries(t).reduce((r,[s,a])=>{const o="tripwire"in a&&a.tripwire;return{...r,[s]:{error:o?void 0:"error"in a?a.error:void 0,tripwire:o?a.tripwire:void 0,startedAt:a.startedAt,endedAt:"endedAt"in a?a.endedAt:void 0,status:a.status,output:"output"in a?a.output:void 0,input:a.payload,resumeData:"resumePayload"in a?a.resumePayload:void 0,suspendOutput:"suspendOutput"in a?a.suspendOutput:void 0,suspendPayload:"suspendPayload"in a?a.suspendPayload:void 0,foreachProgress:"foreachProgress"in a?a.foreachProgress:void 0}}},{}),runId:e.runId}},Qx=({data:e,language:t="auto"})=>{const n=Jg(),r=o=>{if(t==="javascript")return[bI(),it.lineWrapping];if(t==="json")return[Vc,it.lineWrapping];try{return JSON.parse(o),[Vc,it.lineWrapping]}catch{return o.includes("=>")||o.includes("function")||o.includes("const ")||o.includes("return ")?[bI(),it.lineWrapping]:[it.lineWrapping]}};if(typeof e!="string"){const o=JSON.stringify(e,null,2);return l.jsxs("div",{className:"max-h-[500px] overflow-auto relative",children:[l.jsx("div",{className:"absolute right-2 top-2 bg-surface4 rounded-full z-10",children:l.jsx(Zo,{content:o})}),l.jsx("div",{className:"bg-surface4 rounded-lg p-4",children:l.jsx(Xc,{value:o,theme:n,extensions:[Vc,it.lineWrapping]})})]})}const s=r(e);let a=e;try{const o=JSON.parse(e);a=JSON.stringify(o,null,2)}catch{}return l.jsxs("div",{className:"max-h-[500px] overflow-auto relative",children:[l.jsx("div",{className:"absolute right-2 top-2 bg-surface4 rounded-full z-10",children:l.jsx(Zo,{content:e})}),l.jsx("div",{className:"bg-surface4 rounded-lg p-4",children:l.jsx(Xc,{value:a,theme:n,extensions:s})})]})},z1n=xe.forwardRef(({children:e,...t},n)=>l.jsx("form",{ref:n,className:"space-y-4",...t,children:e})),B1n=["boolean","object","array"],U1n=({label:e,children:t,id:n,field:r,error:s})=>{const a=B1n.includes(r.type);return l.jsxs("div",{className:"pb-4 last:pb-0",children:[!a&&l.jsxs(we,{as:"label",variant:"ui-sm",className:"text-neutral3 pb-1 block",htmlFor:n,children:[e,r.required&&l.jsx("span",{className:"text-accent2",children:" *"})]}),t,r.fieldConfig?.description&&l.jsx(we,{as:"p",variant:"ui-sm",className:"text-neutral6",children:r.fieldConfig.description}),s&&l.jsx(we,{as:"p",variant:"ui-sm",className:"text-accent2",children:s})]})},q1n=({error:e})=>l.jsx(Ld,{variant:"destructive",children:l.jsx(Fd,{children:e})}),V1n=({children:e})=>l.jsx(me,{type:"submit",children:e}),R_e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,I_e=hZe,Xre=(e,t)=>n=>{var r;if(t?.variants==null)return I_e(e,n?.class,n?.className);const{variants:s,defaultVariants:a}=t,o=Object.keys(s).map(u=>{const d=n?.[u],f=a?.[u];if(d===null)return null;const p=R_e(d)||R_e(f);return s[u][p]}),i=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...h}=d;return Object.entries(h).every(g=>{let[b,y]=g;return Array.isArray(y)?y.includes({...a,...i}[b]):{...a,...i}[b]===y})?[...u,f,p]:u},[]);return I_e(e,o,c,n?.class,n?.className)},Q1n=Xre(K("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:K(Bre,Ure,qre),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Mi.sm} text-ui-sm px-[.75em]`,md:`${Mi.md} text-ui-md px-[.75em]`,default:`${Mi.default} text-ui-md px-[.85em]`,lg:`${Mi.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),vn=S.forwardRef(({className:e,size:t,testId:n,variant:r,type:s,error:a,...o},i)=>l.jsx("input",{type:s,className:K(Q1n({variant:r,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:i,"aria-invalid":a,...o}));vn.displayName="Input";const H1n=({inputProps:e,error:t,field:n,id:r})=>{const{key:s,...a}=e;return l.jsx(vn,{id:r,className:t?"border-accent2":"",...a,defaultValue:n.default})},G1n=({inputProps:e,error:t,field:n,id:r})=>{const{key:s,...a}=e;return l.jsx(vn,{id:r,type:"number",className:t?"border-accent2":"",...a,defaultValue:n.default!==void 0?Number(n.default):void 0,onChange:o=>{const i=o.target.value;i!==""&&!isNaN(Number(i))&&a.onChange({target:{value:i,name:e.name}})},onBlur:o=>{const i=o.target.value;i!==""&&!isNaN(Number(i))&&a.onChange({target:{value:Number(i),name:e.name}})}})},lc=S.forwardRef(({className:e,...t},n)=>l.jsx(qY,{ref:n,className:K("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",An.all,"hover:border-neutral5 hover:shadow-md",tT,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:bg-accent1 data-[state=checked]:border-accent1 data-[state=checked]:text-surface1","data-[state=checked]:shadow-glow-accent1",e),...t,children:l.jsx(Aje,{className:K("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:l.jsx(Es,{className:"h-3.5 w-3.5 stroke-[3]"})})}));lc.displayName=qY.displayName;const W1n=({field:e,label:t,id:n,inputProps:r,value:s})=>l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(lc,{id:n,onCheckedChange:a=>{const o={target:{name:r.name,value:a}};r.onChange(o)},defaultChecked:e.default,disabled:r.disabled||r.readOnly}),l.jsxs(we,{as:"label",variant:"ui-sm",className:"text-neutral3",htmlFor:n,children:[t,e.required&&l.jsx("span",{className:"text-accent2",children:" *"})]})]});function HZe({className:e,classNames:t,showOutsideDays:n=!0,...r}){return l.jsx(Znn,{showOutsideDays:n,className:K("p-3",e),classNames:{months:"flex flex-col space-y-4 sm:space-y-0 ",month:"space-y-4 text-ui-sm ",caption:"flex justify-between pt-1 items-center pl-2",caption_label:"text-text font-medium ",nav:"flex items-center",nav_button_previous:K("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_next:K("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),dropdown_month:"w-full border-collapse space-y-1",weeknumber:"flex",day:K("relative p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-surface5 [&:has([aria-selected].day-outside)]:bg-surface5/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",r.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md","h-8 w-8 p-0 hover:bg-lightGray-7/50 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"!bg-neutral6/50 !text-surface2 hover:bg-neutral6 rounded-md hover:text-surface2 focus:bg-neutral6 focus:text-surface2",day_today:"bg-neutral6/10 text-neutral5",day_outside:"day-outside text-neutral3 opacity-50 aria-selected:bg-surface5/50 aria-selected:text-neutral3 aria-selected:opacity-30",day_disabled:"text-neutral3 opacity-50",day_range_middle:"aria-selected:bg-surface5 aria-selected:text-neutral5",day_hidden:"invisible",head_cell:"text-ui-xs text-neutral3",...t},...r})}const oT=Ndt,NS=jdt,Pv=S.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>l.jsx(Adt,{children:l.jsx(PRe,{ref:s,align:t,sideOffset:n,className:K("z-50 w-72 rounded-md border border-border1 bg-surface3 text-neutral5 shadow-md focus-visible:outline-none 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",e&&/\bp-\S+/.test(e)?!1:"p-4",e),...r})}));Pv.displayName=PRe.displayName;function GZe({children:e,...t}){const[n,r]=S.useState(!1),s=S.useRef(void 0),a=S.useCallback(()=>{clearTimeout(s.current),r(!0)},[]),o=S.useCallback(()=>{s.current=setTimeout(()=>r(!1),150)},[]);return S.useEffect(()=>()=>clearTimeout(s.current),[]),l.jsx(oT,{open:n,onOpenChange:r,...t,children:l.jsx("span",{onMouseEnter:a,onMouseLeave:o,onFocusCapture:a,onBlurCapture:o,style:{display:"contents"},children:e})})}const ka=Eft,_a=Cft,ca=S.forwardRef(({className:e,children:t,variant:n="inputLike",size:r="default",...s},a)=>l.jsxs(RIe,{ref:a,className:K(CS({variant:n,size:r}),"justify-between [&>svg]:opacity-100",e),...s,children:[t,l.jsx(Tft,{asChild:!0,children:l.jsx(fs,{className:K("h-4 w-4 text-neutral3",An.colors)})})]}));ca.displayName=RIe.displayName;const ua=S.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(Nft,{children:l.jsx(IIe,{ref:s,className:K("relative z-50 min-w-[8rem] max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-md border border-border1 bg-surface3 text-neutral5 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:l.jsx(jft,{className:K("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));ua.displayName=IIe.displayName;const Dr=S.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(PIe,{ref:r,className:K("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-neutral5 text-sm",An.colors,"hover:bg-surface5 hover:text-neutral5","focus:bg-surface5 focus:text-neutral5","data-[state=checked]:bg-accent1Dark data-[state=checked]:text-accent1","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(Rft,{children:l.jsx(Es,{className:"h-4 w-4 text-accent1"})})}),l.jsx(Aft,{children:t})]}));Dr.displayName=PIe.displayName;const NV=["12","1","2","3","4","5","6","7","8","9","10","11"],fA=["00","15","30","45","59"],pA=["AM","PM"];function Z1n({defaultValue:e,onValueChange:t,className:n}){const[r,s]=S.useState("12"),[a,o]=S.useState("00"),[i,c]=S.useState("AM");S.useEffect(()=>{if(e){const p=/^(\d{1,2}):(\d{2})(?::\d{2})?\s*(AM|PM|am|pm)?$/,h=e.match(p);if(h){let g=parseInt(h[1],10);const b=parseInt(h[2],10),y=h[3]?.toUpperCase();g>=1&&g<=12&&b>=0&&b<=59&&(s(g.toString()),o(b===0?"00":b.toString()),c(y||"AM"))}}},[e]);const u=p=>{s(p),t(`${NV[+p]}:${a} ${i}`.trim())},d=p=>{o(fA[+p]),t(`${r}:${fA[+p]} ${i}`.trim())},f=p=>{c(pA[+p]),t(`${r}:${a} ${pA[+p]}`.trim())};return l.jsxs("div",{className:K("flex gap-2 items-center",n),children:[l.jsxs(ka,{name:"hour",value:NV.indexOf(r).toString(),onValueChange:u,children:[l.jsx(ca,{size:"sm",children:l.jsx(_a,{placeholder:"Select..."})}),l.jsx(ua,{children:NV.map((p,h)=>l.jsx(Dr,{value:`${h}`,children:p},p))})]}),":",l.jsxs(ka,{name:"minute",value:fA.indexOf(a).toString(),onValueChange:d,children:[l.jsx(ca,{size:"sm",children:l.jsx(_a,{placeholder:"Select..."})}),l.jsx(ua,{children:fA.map((p,h)=>l.jsx(Dr,{value:`${h}`,children:p},p))})]}),l.jsxs(ka,{name:"period",value:pA.indexOf(i).toString(),onValueChange:f,children:[l.jsx(ca,{size:"sm",children:l.jsx(_a,{placeholder:"Select..."})}),l.jsx(ua,{children:pA.map((p,h)=>l.jsx(Dr,{value:`${h}`,children:p},p))})]})]})}function Y1n({children:e,className:t}){return l.jsx("div",{className:K("grid gap-2 text-neutral4",t),children:e})}function X1n({children:e}){return l.jsxs("p",{className:K("text-ui-sm text-neutral4 flex items-center gap-2","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:text-red-400"),children:[l.jsx(bl,{})," ",e]})}function K1n({children:e}){return l.jsx("p",{className:"text-neutral3 text-ui-sm",children:e})}function J1n({children:e,name:t,required:n,size:r="default",className:s}){return l.jsxs("label",{htmlFor:`input-${t}`,className:K("text-ui-smd text-neutral3 flex justify-between items-center ","[.horizontal-field-block_&]:grid [.horizontal-field-block_&]:content-start",{"text-ui-md":r==="bigger"},s),children:[e,n&&l.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}function eOn({children:e,className:t,layout:n="vertical",labelColumnWidth:r}){return console.log({labelColumnWidth:r,layout:n}),l.jsx("div",{className:K("grid gap-2 text-neutral4",{"horizontal-field-block grid-cols-[auto_1fr] items-baseline":n==="horizontal"},t),style:n==="horizontal"&&r?{gridTemplateColumns:`${r} 1fr`}:void 0,children:e})}const so=Object.assign({},{Layout:eOn,Column:Y1n,Label:J1n,HelpText:K1n,ErrorMsg:X1n});function Mg({name:e,value:t,label:n,labelIsHidden:r=!1,labelColumnWidth:s,helpText:a,errorMsg:o,required:i=!1,disabled:c=!1,labelSize:u,layout:d="vertical",placeholder:f,size:p="default",testId:h,className:g,...b}){return l.jsxs(so.Layout,{layout:d,labelColumnWidth:s,className:g,children:[d==="horizontal"?l.jsx(so.Column,{children:l.jsx(so.Label,{name:e,required:i,size:u||"bigger",children:r?l.jsx(Kl,{children:n}):n})}):null,l.jsxs(so.Column,{children:[!r&&d==="vertical"?l.jsx(so.Label,{name:e,required:i,size:u||"default",children:n}):null,l.jsx(vn,{name:e,disabled:c,required:i,value:t,placeholder:f,"data-testid":h,size:p,...b}),a&&l.jsx(so.HelpText,{children:a}),o&&l.jsx(so.ErrorMsg,{children:o})]})]})}const IP=({value:e,minValue:t,maxValue:n,defaultTimeStrValue:r,onValueChange:s,children:a,className:o,placeholder:i,...c})=>{const[u,d]=S.useState(!1);return l.jsxs(oT,{open:u,onOpenChange:d,children:[l.jsx(NS,{asChild:!0,children:a||l.jsx(nOn,{value:e,placeholder:i,className:o,"data-testid":"datepicker-button"})}),l.jsx(Pv,{className:"backdrop-blur-4xl w-auto !p-0 bg-surface4 max-w-[16.5rem]",align:"start","data-testid":"datepicker-calendar",children:l.jsx(tOn,{value:e,minValue:t,maxValue:n,onValueChange:s,setOpenPopover:d,defaultTimeStrValue:r,...c})})]})};function hA({date:e,timeStr:t=""}){if(!Zm(e))return null;if(t){const n=Gn(e,"yyyy-MM-dd"),r=new Date(`${n} ${t}`);if(Zm(r))return r}return e}const tOn=({value:e,minValue:t,maxValue:n,onValueChange:r,setOpenPopover:s,placeholder:a,className:o,defaultTimeStrValue:i,...c})=>{const[u,d]=S.useState(null),[f,p]=S.useState(e?Gn(hA({date:e,timeStr:i})||"","PP p"):""),[h,g]=S.useState(i||""),[b,y]=S.useState(e?new Date(e):void 0),x=vS(U=>{Zm(U)&&(y(U),r?.(U),s?.(!1))},500),w=U=>{p(U.currentTarget.value);const L=new Date(U.currentTarget.value);x(L)},O=U=>{Zm(U)?n&&U>n?(d(`The selected date should be before ${Gn(n,"PP p")}`),p("")):t&&U<t?(d(`The selected date should be after ${Gn(t,"PP p")}`),p("")):(p(Gn(U,"PP p")),d("")):(p(""),d(""))},_=new Date(f),C=Zm(_),E=C&&_.getTime()!==e?.getTime(),T=U=>{if(y(U),U){const L=hA({date:U,timeStr:h});O(L||"")}else O("")},N=U=>{if(y(U),U){const L=hA({date:U,timeStr:h});O(L||"")}else O("")},A=U=>{if(g(U),C){const L=hA({date:_,timeStr:U});O(L||"")}},I=()=>{s?.(!1)},P=()=>{Zm(_)&&r(_),s?.(!1)},$=()=>{r(void 0),y(void 0),p(""),g(""),s?.(!1)};return l.jsxs("div",{"aria-label":"Choose date",className:K("relative flex flex-col",o),onKeyDown:U=>{U.stopPropagation(),U.key==="Escape"&&s?.(!1)},children:[l.jsx(Mg,{name:"date-range",type:"text",value:f,onChange:w,placeholder:a,className:"m-4 mb-0 !w-auto"}),u&&l.jsxs("div",{className:K("text-ui-md m-4 mb-0 text-neutral3","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mt-0.5 [&>svg]:text-red-500 [&>svg]:float-left [&>svg]:mr-2"),children:[l.jsx($d,{})," ",u]}),l.jsx(HZe,{mode:"single",month:b,selected:b,onMonthChange:N,onSelect:T,...c}),l.jsx(Z1n,{onValueChange:A,className:"m-4 mt-0 w-auto",defaultValue:e?Gn(new Date(e),"hh:mm a"):i}),l.jsxs("div",{className:"grid grid-cols-[1fr_2fr] gap-2 m-4 mt-0",children:[E&&l.jsx(me,{tabIndex:0,size:"md",onClick:$,type:"button",children:"Clear"}),l.jsx(me,{tabIndex:0,type:"button",size:"md",variant:E?"primary":"default",onClick:()=>{C?P():I()},children:E?"Apply":"Cancel"})]})]})},nOn=S.forwardRef(({value:e,placeholder:t,className:n,...r},s)=>l.jsxs(me,{ref:s,className:K("justify-start",n),variant:"inputLike",...r,children:[l.jsx(CX,{className:"h-4 w-4"}),e?l.jsx("span",{className:"text-white",children:Gn(e,"PP p")}):l.jsx("span",{className:"text-gray",children:t??"Pick a date"})]})),rOn=({inputProps:e,field:t,error:n,id:r})=>{const{key:s,...a}=e,[o,i]=S.useState(void 0),[c,u]=S.useState(!1);S.useEffect(()=>{if(t.default){const p=new Date(t.default);Zm(p)&&i(p)}},[t]);const d=p=>{i(p),p&&a.onChange({target:{value:p.toISOString(),name:e.name}}),u(!1)},f=()=>{i(void 0),a.onChange({target:{value:"",name:e.name}}),u(!1)};return l.jsxs(oT,{open:c,onOpenChange:u,children:[l.jsx(NS,{asChild:!0,children:l.jsxs(me,{id:r,variant:"light",size:"lg",className:K("w-full",n?"border-accent2":""),children:[l.jsx(CX,{className:"h-4 w-4"}),o?l.jsx("span",{className:"text-white",children:Gn(o,"PPP")}):l.jsx("span",{className:"text-gray",children:"Pick a date"})]})}),l.jsxs(Pv,{className:"w-auto p-0 bg-surface4",align:"start",children:[l.jsx(HZe,{mode:"single",selected:o,onSelect:d,month:o,onMonthChange:i}),o&&l.jsx("div",{className:"p-3 pt-0",children:l.jsx(me,{variant:"light",size:"lg",className:"w-full",onClick:f,children:"Clear"})})]})]})},sOn=({field:e,inputProps:t,error:n,id:r,value:s})=>{const{key:a,...o}=t;return l.jsxs(ka,{...o,value:s,onValueChange:i=>{const c={target:{value:i,name:t.name}};o.onChange(c)},children:[l.jsx(ca,{id:r,className:n?"border-accent2":"",children:l.jsx(_a,{placeholder:"Select an option"})}),l.jsx(ua,{children:(e.options||[]).map(([i,c])=>l.jsx(Dr,{value:i,children:c},i))})]})},aOn=({label:e,children:t})=>{const n=e!==""&&e!=="",[r,s]=S.useState(!1);return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex items-center",children:[n&&l.jsxs(we,{as:"h3",variant:"ui-sm",className:"text-neutral3 flex items-center gap-1 pb-2",children:[l.jsx(Te,{size:"sm",children:l.jsx(Yc,{})}),e]}),l.jsx(me,{onClick:()=>s(!r),type:"button",className:"ml-auto px-1",size:"sm",children:l.jsx(Te,{size:"sm",children:l.jsx(fs,{className:K("transition-all",r?"rotate-180":"rotate-0")})})})]}),r&&l.jsx("div",{className:n?"flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4":"",children:t})]})},oOn=({label:e,children:t,onAddItem:n})=>l.jsxs("div",{children:[l.jsxs("div",{className:"flex gap-2 justify-between",children:[l.jsxs(we,{as:"h3",variant:"ui-sm",className:"text-neutral3 pb-2 flex items-center gap-1",children:[l.jsx(Te,{size:"sm",children:l.jsx(Tht,{})}),e]}),l.jsx(sd,{children:l.jsxs(zn,{delayDuration:0,children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{onClick:n,type:"button",className:"text-neutral3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-neutral6 h-icon-sm w-icon-sm",children:l.jsx(Te,{size:"sm",children:l.jsx(Gr,{})})})}),l.jsx($n,{children:"Add item"})]})})]}),l.jsx("div",{className:"flex flex-col gap-1",children:t})]}),iOn=({children:e,onRemove:t})=>l.jsxs("div",{className:"pl-4 border-l border-border1",children:[e,l.jsxs(me,{onClick:t,type:"button",children:[l.jsx(Te,{size:"sm",children:l.jsx(DX,{})}),"Delete"]})]}),lOn=({inputProps:e,field:t,error:n,id:r})=>{const{key:s,onChange:a,...o}=e,[i,c]=S.useState(()=>Object.entries(t.default||{}).map(([g,b])=>({id:g||xo(),key:g,value:b})));S.useEffect(()=>{i.length===0&&c([{id:xo(),key:"",value:""}])},[i]);const u=S.useCallback(g=>{const b=g.reduce((y,x)=>(x.key&&(y[x.key]=x.value),y),{});a?.({target:{value:b,name:e.name}})},[a,e.name]),d=(g,b,y)=>{c(x=>x.map(w=>w.id===g?{...w,[b]:y}:w))},f=()=>{u(i)},p=()=>{const g=[...i,{id:xo(),key:"",value:""}];c(g),u(g)},h=g=>{const b=i.filter(y=>y.id!==g);b.length===0&&b.push({id:xo(),key:"",value:""}),c(b),u(b)};return l.jsxs("div",{className:"space-y-3",children:[i.map(g=>l.jsxs("div",{className:"relative space-y-2 rounded-lg border p-4",children:[l.jsx(me,{type:"button",className:"absolute right-2 top-2",onClick:()=>h(g.id),children:l.jsx(DX,{className:"h-4 w-4"})}),l.jsxs("div",{className:"space-y-2 pt-6",children:[l.jsx(vn,{placeholder:"Key",value:g.key,onChange:b=>d(g.id,"key",b.target.value),onBlur:f}),l.jsx(vn,{placeholder:"Value",value:g.value,onChange:b=>d(g.id,"value",b.target.value),onBlur:f})]})]},g.id)),l.jsxs(me,{type:"button",className:"w-full",onClick:p,children:[l.jsx(Gr,{className:"mr-2 h-4 w-4"}),"Add Key-Value Pair"]})]})},cOn=({field:e,path:t})=>{const{uiComponents:n}=mne();return l.jsx(n.ObjectWrapper,{label:z_(e),field:e,children:Object.entries(e.schema).map(([r,s])=>l.jsx(gy,{field:s,path:[...t,s.key]},`${t.join(".")}.${s.key}`))})},uOn=({field:e,path:t})=>{const{uiComponents:n}=mne(),{control:r}=Ev(),{fields:s,append:a,remove:o}=grn({control:r,name:t.join(".")}),i=e.schema?.[0]?.type;let c;i==="object"?c={}:i==="array"?c=[]:c=null;const u=e.schema?.[0];return u?l.jsx(n.ArrayWrapper,{label:z_(e),field:e,onAddItem:()=>a(c),children:s.map((d,f)=>l.jsx(n.ArrayElementWrapper,{onRemove:()=>o(f),index:f,children:l.jsx(gy,{field:u,path:[...t,f.toString()]})},d.id))}):l.jsx(n.ErrorMessage,{error:`[AutoForm] Unable to determine array element schema for "${z_(e)}"`})},gy=({field:e,path:t})=>{const{formComponents:n,uiComponents:r}=mne(),{register:s,formState:{errors:a},getValues:o}=Ev(),i=t.join("."),c=Zrn(a,t)?.message,u=o(i),d=e.fieldConfig?.fieldWrapper||r.FieldWrapper;let f=()=>l.jsx(r.ErrorMessage,{error:`[AutoForm Configuration Error] No component found for type "${e.type}" nor a fallback`});return e.type==="array"?f=uOn:e.type==="object"?f=cOn:e.type in n?f=n[e.type]:"fallback"in n&&(f=n.fallback),l.jsx(d,{label:z_(e),error:c,id:i,field:e,children:l.jsx(f,{label:z_(e),field:e,value:u,error:c,id:i,path:t,inputProps:{required:e.required,error:c,key:`${i}-input`,...e.fieldConfig?.inputProps,...s(i)}},i)})},dOn=({field:e,inputProps:t})=>{const n=t.name?.split(".")??[];return e.schema?.map((r,s)=>l.jsxs("div",{children:[l.jsx(gy,{field:r,path:n},n.join(".")),s<(e.schema?.length??0)-1&&l.jsx(we,{variant:"ui-xs",className:"text-center",children:"OR"})]},r.key))},fOn=({field:e,path:t})=>{const{watch:n}=Ev(),r=t.join("."),s=n(r),o=(e.schema?.flatMap(p=>p.schema||[])||[])?.filter(p=>p.fieldConfig?.customData?.isLiteral)||[],i=o[0],c=o?.reduce((p,h)=>{const g=(h.fieldConfig?.customData?.literalValues??[]).map(b=>[b,b]);return p.options?.push(...g),p},{key:i.key,required:i.required,type:"select",default:i.default,description:i.description,options:[],fieldConfig:i.fieldConfig}),u=e.schema?.reduce((p,h)=>{const g=h.schema?.find(x=>x.fieldConfig?.customData?.isLiteral),b=g?.fieldConfig?.customData?.literalValues?.[0],y=h.schema?.filter(x=>x.key!==g?.key)??[];return b&&(p[b]=y),p},{}),d=e.schema?.filter(p=>!p.schema?.find(g=>g.fieldConfig?.customData?.isLiteral)),f=s?.[c.key];return l.jsxs("div",{children:[l.jsx(gy,{field:c,path:[...t,c.key]},`${r}.${c.key}`),f&&u?.[f]&&u[f].map(p=>l.jsx(gy,{field:p,path:[...t,p.key]},`${r}.${p.key}`)),d&&d.map(p=>l.jsx(gy,{field:p,path:[...t,p.key]},`${r}.${p.key}`))]},e.key)};function PP(e){const t={};for(const n in e){const r=e[n];if(![null,void 0,"",[],{}].includes(r))if(Array.isArray(r)){const a=r.map(o=>{if(typeof o=="object"){const i=PP(o);return Object.keys(i).length>0?i:null}return o}).filter(o=>o!==null);a.length>0&&(t[n]=a)}else if(typeof r=="object"){const s=PP(r);Object.keys(s).length>0&&(t[n]=s)}else t[n]=r}return t}function Xd(e){return Function("z",`"use strict";return (${e});`)(rBt)}function pOn({schema:e,onSubmit:t=()=>{},defaultValues:n,values:r,children:s,uiComponents:a,formComponents:o,withSubmit:i=!1,onFormInit:c=()=>{},formProps:u={}}){const d=S.useMemo(()=>yrn(e),[e]),f=QC({defaultValues:{...vrn(e),...n},values:r});S.useEffect(()=>{c&&c(f)},[c,f]);const p=S.useCallback(async g=>{const b=PP(g),y=e.validateSchema(b);if(y.success)await t(y.data,f);else{f.clearErrors();let x=!1;y.errors?.forEach(w=>{const O=w.path.join(".");f.setError(O,{type:"custom",message:w.message},{shouldFocus:!x}),x=!0;const _=w.path?.slice?.(0,-1);_?.length>0&&f.setError(_.join("."),{type:"custom",message:w.message})})}},[e,t,f]),h=S.useMemo(()=>({schema:d,uiComponents:a,formComponents:o}),[d,a,o]);return l.jsx(Knn,{...f,children:l.jsx(Trn,{value:h,children:l.jsxs(a.Form,{onSubmit:f.handleSubmit(p),...u,children:[d.fields.map(g=>l.jsx(gy,{field:g,path:[g.key]},g.key)),s,i&&l.jsx(a.SubmitButton,{children:"Submit"})]})})})}const hOn={Form:z1n,FieldWrapper:U1n,ErrorMessage:q1n,SubmitButton:V1n,ObjectWrapper:aOn,ArrayWrapper:oOn,ArrayElementWrapper:iOn};function mOn({uiComponents:e,formComponents:t,readOnly:n,...r}){const s=S.useMemo(()=>({...hOn,...e}),[e]),a=S.useMemo(()=>{const o=i=>n===void 0?i:{...i,readOnly:n};return{string:i=>l.jsx(H1n,{...i,inputProps:o(i.inputProps)}),number:i=>l.jsx(G1n,{...i,inputProps:o(i.inputProps)}),boolean:i=>l.jsx(W1n,{...i,inputProps:o(i.inputProps)}),date:i=>l.jsx(rOn,{...i,inputProps:o(i.inputProps)}),select:i=>l.jsx(sOn,{...i,inputProps:o(i.inputProps)}),record:i=>l.jsx(lOn,{...i,inputProps:o(i.inputProps)}),union:i=>l.jsx(dOn,{...i,inputProps:o(i.inputProps)}),"discriminated-union":i=>l.jsx(fOn,{...i,inputProps:o(i.inputProps)}),...t}},[n,t]);return l.jsx(pOn,{...r,uiComponents:s,formComponents:a})}const gOn=Xre("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=S.forwardRef(({className:e,...t},n)=>l.jsx(dRe,{ref:n,className:K(gOn(),e),...t}));xt.displayName=dRe.displayName;function WZe(e){return e!=null&&typeof e=="object"&&"_zod"in e}function Bi(e){if(!(e==null||typeof e!="object"))return WZe(e)?e._zod.def:e._def}function bOn(e){return typeof e.isOptional=="function"?e.isOptional():typeof e.safeParse=="function"?e.safeParse(void 0).success:!1}function zd(e){if(e.shape&&typeof e.shape=="object")return e.shape;const t=Bi(e);if(t?.shape)return typeof t.shape=="function"?t.shape():t.shape}function gZ(e){const t=Bi(e);return t?"innerType"in t?gZ(t.innerType):"schema"in t?gZ(t.schema):e:e}function yOn(e){const t=Bi(e);if(t?.entries)return t.entries;if(t?.values)return t.values}function vOn(e){const t=Bi(e);return t?.element??t?.type}function ZZe(e){const t=Bi(e);if(t?.values!==void 0)return Array.isArray(t.values)?t.values[0]:t.values;if(t?.value!==void 0)return t.value}function xOn(e){const t=Bi(e);if(t?.values!==void 0)return t.values;if(t?.value!==void 0)return[t.value]}function wOn(e){const t=Bi(e);if(t?.defaultValue!==void 0)return typeof t.defaultValue=="function"?t.defaultValue():t.defaultValue}function YZe(e){return Bi(e)?.options}function bZ(e){const t=Bi(e);if(t?.left&&t?.right)return{left:t.left,right:t.right};if(e.def?.left&&e.def?.right)return{left:e.def.left,right:e.def.right}}function SOn(e){return Bi(e)?.checks??[]}function OOn(e){return e.some(t=>{if(WZe(t)){const n=Bi(t);return n?.check==="string_format"&&n?.format==="datetime"}return t.kind==="datetime"})}function kOn(e,t){if(t?.fieldType)return t.fieldType;const n=e?.constructor?.name?.slice(1),r=Bi(e),s=typeof r?.type=="string"?`Zod${r.type.charAt(0).toUpperCase()}${r.type.slice(1)}`:void 0,a=r?.typeName??s??n;if(a==="ZodObject"||a==="ZodIntersection")return"object";if(a==="ZodNumber")return"number";if(a==="ZodBoolean")return"boolean";if(a==="ZodString"){const o=SOn(e);return OOn(o)?"date":"string"}if(a==="ZodEnum"||a==="ZodNativeEnum")return"select";if(a==="ZodArray")return"array";if(a==="ZodRecord")return"record";if(a==="ZodUnion"){const o=YZe(e);return o&&o.every(c=>{const u=zd(c);return u?Object.values(u).some(d=>{const f=d?.constructor?.name?.slice(1),p=Bi(d);return f==="ZodLiteral"||p?.typeName==="ZodLiteral"||p?.type==="literal"}):!1})?"discriminated-union":"union"}if(a==="ZodDiscriminatedUnion")return"discriminated-union";if(a==="ZodLiteral"){const o=ZZe(e);return typeof o=="number"?"number":typeof o=="boolean"?"boolean":"string"}return"string"}function i0(e){const t=Bi(e);if(!t)return;const n=wOn(e);if(n!==void 0)return n;const r=ZZe(e);if(r!==void 0&&(t.typeName==="ZodLiteral"||t.type==="literal"||e?.constructor?.name?.slice(1)==="ZodLiteral"))return r;if("innerType"in t)return i0(t.innerType);if("schema"in t)return i0(t.schema);if(zd(e)&&!("left"in t))return pR(e);if("left"in t&&"right"in t){const a=zd(t.left),o=zd(t.right),i=a?pR(t.left):i0(t.left),c=o?pR(t.right):i0(t.right);return{...i,...c}}}function pR(e){const t=zd(e);if(!t)return{};const n={};for(const[r,s]of Object.entries(t)){const a=i0(s);a!==void 0&&(n[r]=a)}return n}function yZ(e){const t=Bi(e);if(t){if(t.typeName==="ZodEffects"&&t.effect?.type==="refinement"){const n=t.effect?.refinement;if(n){const r=Object.getOwnPropertySymbols(n);for(const s of r){const a=n[s];if(a&&typeof a=="object")return a}}}if("innerType"in t)return yZ(t.innerType);if("schema"in t)return yZ(t.schema)}}function Rm(e,t){const n=gZ(t),r=yZ(t);let s=kOn(n,r);const a=i0(t),o=yOn(n);let i=[];o&&(Array.isArray(o)?i=o.map(w=>[w,w]):i=Object.entries(o));let c=[];const u=zd(n);u&&!bZ(n)&&(c=Object.entries(u).map(([w,O])=>Rm(w,O)));const d=YZe(n),f=n?.constructor?.name?.slice(1),p=Bi(n),h=typeof p?.type=="string"?`Zod${p.type.charAt(0).toUpperCase()}${p.type.slice(1)}`:void 0,g=p?.typeName??h??f;(g==="ZodUnion"||g==="ZodDiscriminatedUnion")&&d&&(c=Object.entries(d).map(([w,O])=>Rm(w,O)));const b=bZ(n);if(b){const{left:w,right:O}=b;let _=[],C=[];const E=zd(w);if(E)_=Object.entries(E).map(([N,A])=>Rm(N,A));else{const N=Rm(e,w);_=N.schema??[N],s=N.type}const T=zd(O);if(T)C=Object.entries(T).map(([N,A])=>Rm(N,A));else{const N=Rm(e,O);C=N.schema??[N],s=N.type}c=[..._,...C]}if(g==="ZodArray"){const w=vOn(n);w&&(c=[Rm("0",w)])}const y=g==="ZodLiteral",x=y?xOn(n):void 0;return{key:e,type:s,required:!bOn(t),default:a,description:n.description,fieldConfig:y||Object.keys(r??{})?.length>0?{...r,customData:{...r?.customData??{},...y?{isLiteral:y,literalValues:x}:{}}}:void 0,options:i,schema:c}}function _On(e){const t=zd(e);return t?{fields:Object.entries(t).map(([r,s])=>Rm(r,s))}:{fields:[]}}class EOn{_schema;constructor(t){if(!t)throw new Error("CustomZodProvider: schema is required");this._schema=t}getDefaultValues(){return pR(this._schema)}validateSchema(t){const n=PP(t);try{const r=this._schema.safeParse(n);if(r.success)return{success:!0,data:r.data};{const s=r.error;return{success:!1,errors:(s.issues??s.errors??[]).map(o=>({path:o.path,message:o.message}))}}}catch(r){throw r}}parseSchema(){return _On(this._schema)}}function vZ(e){const t=zd(e);if(t)return Object.keys(t).length===0;const n=bZ(e);return n?vZ(n.left)&&vZ(n.right):!1}function COn(e){return zd(e)!==void 0}function N2({schema:e,onSubmit:t,onValuesChange:n,defaultValues:r,isSubmitLoading:s,submitButtonLabel:a,className:o,readOnly:i,children:c}){const u=S.useRef(null),d=!COn(e),f=S.useRef(n);S.useEffect(()=>{f.current=n},[n]),S.useEffect(()=>()=>{u.current?.unsubscribe()},[]);const p=S.useCallback(O=>{u.current?.unsubscribe(),f.current&&(u.current=O.watch(_=>{const C=d?_&&Object.prototype.hasOwnProperty.call(_,"")?_[""]:{}:_;f.current?.(C)}))},[d]),h=S.useMemo(()=>{if(!e)return null;const O=_=>vZ(_)?ot({}):d?ot({"":_}):_;return new EOn(O(e))},[e,d]),g=S.useMemo(()=>({SubmitButton:({children:O})=>t?l.jsx(me,{className:"w-full",disabled:s,children:s?l.jsx(Sa,{className:"animate-spin"}):a||O}):null}),[t,s,a]),b=S.useMemo(()=>({Label:({value:O})=>l.jsx(xt,{className:"text-sm font-normal",children:O})}),[]),y=S.useMemo(()=>({className:o,noValidate:!0}),[o]),x=S.useMemo(()=>d?r===void 0?void 0:{"":r}:r,[d,r]),w=S.useCallback(async O=>{const _=d?O&&Object.prototype.hasOwnProperty.call(O,"")?O[""]:{}:O;await t?.(_)},[t,d]);return h?l.jsx(mOn,{schema:h,onSubmit:w,onFormInit:p,defaultValues:x,formProps:y,uiComponents:g,formComponents:b,withSubmit:!0,readOnly:i,children:c}):(console.error("no form schema found"),null)}const iT=S.forwardRef(({className:e,...t},n)=>l.jsx(GRe,{className:K("grid gap-2",e),...t,ref:n}));iT.displayName=GRe.displayName;const zc=S.forwardRef(({className:e,...t},n)=>l.jsx(WRe,{ref:n,className:K("aspect-square h-4 w-4 rounded-full border border-neutral3 text-neutral6","shadow-sm",An.all,"hover:border-neutral5 hover:shadow-md",tT,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:border-accent1 data-[state=checked]:shadow-glow-accent1",e),...t,children:l.jsx(Bdt,{className:K("flex items-center justify-center","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:l.jsx(XPe,{className:"h-2 w-2 fill-accent1 text-accent1"})})}));zc.displayName=WRe.displayName;const Kre=({schema:e,defaultValues:t,withoutSubmit:n,isSubmitLoading:r,submitButtonLabel:s,onSubmit:a,children:o,isProcessorWorkflow:i})=>{const[c,u]=S.useState(i?"simple":"form"),[d,f]=S.useState(!1);return S.useEffect(()=>{f(!0)},[]),d?l.jsxs("div",{children:[l.jsx(iT,{disabled:r,value:c,onValueChange:p=>u(p),className:"pb-4",children:l.jsxs("div",{className:"flex flex-row gap-4",children:[i&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(zc,{value:"simple",id:"simple"}),l.jsx(xt,{htmlFor:"simple",className:"!text-neutral3 text-ui-sm",children:"Simple"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(zc,{value:"form",id:"form"}),l.jsx(xt,{htmlFor:"form",className:"!text-neutral3 text-ui-sm",children:"Form"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(zc,{value:"json",id:"json"}),l.jsx(xt,{htmlFor:"json",className:"!text-neutral3 text-ui-sm",children:"JSON"})]})]})}),l.jsx("div",{className:K({"opacity-50 pointer-events-none":r}),children:c==="simple"&&i?l.jsx(NOn,{schema:e,defaultValues:t,isSubmitLoading:r,submitButtonLabel:s,onSubmit:a,withoutSubmit:n,children:o}):c==="form"?l.jsx(N2,{schema:e,defaultValues:t,isSubmitLoading:r,submitButtonLabel:s,onSubmit:n?void 0:a,children:o}):l.jsx(TOn,{schema:e,defaultValues:t,isSubmitLoading:r,submitButtonLabel:s,onSubmit:a,withoutSubmit:n,children:o})})]}):null},TOn=({schema:e,defaultValues:t,isSubmitLoading:n,submitButtonLabel:r,onSubmit:s,withoutSubmit:a,children:o})=>{const[i,c]=S.useState([]),[u,d]=S.useState(()=>JSON.stringify(t??{},null,2)),f=()=>{c([]);try{const h=e.safeParse(JSON.parse(u));h.success?s(h.data):c(h.error.issues.map(g=>`[${g.path.join(".")}] ${g.message}`))}catch{c(["Invalid JSON provided"])}};let p={};try{p=JSON.parse(u)}catch{p={}}return l.jsxs("div",{className:"flex flex-col gap-4",children:[i.length>0&&l.jsxs("div",{className:"border border-accent2 rounded-lg p-2",children:[l.jsxs(we,{as:"p",variant:"ui-md",className:"text-accent2 font-semibold",children:[i.length," errors found"]}),l.jsx("ul",{className:"list-disc list-inside",children:i.map((h,g)=>l.jsx("li",{className:"text-ui-sm text-accent2",children:h},g))})]}),l.jsx(Vs,{data:p,onChange:d}),o,a?null:l.jsx(me,{variant:"light",onClick:f,className:"w-full",size:"lg",children:n?l.jsx(Sa,{className:"animate-spin"}):r})]})},P_e=[{value:"input",label:"Input - Process input messages before LLM"},{value:"inputStep",label:"Input Step - Process at each agentic loop step"},{value:"outputStream",label:"Output Stream - Process streaming chunks"},{value:"outputResult",label:"Output Result - Process complete output"},{value:"outputStep",label:"Output Step - Process after each LLM response"}],NOn=({schema:e,defaultValues:t,isSubmitLoading:n,submitButtonLabel:r,onSubmit:s,withoutSubmit:a,children:o})=>{const[i,c]=S.useState("Hello, this is a test message."),[u,d]=S.useState("input"),[f,p]=S.useState([]),h=()=>{p([]);const b=u==="outputStep"||u==="outputResult"?"assistant":"user",y={messages:[{id:crypto.randomUUID(),role:b,createdAt:new Date().toISOString(),content:{format:2,parts:[{type:"text",text:i}]}}],phase:u};try{const x=e.safeParse(y);x.success?s(x.data):p(x.error.issues.map(w=>`[${w.path.join(".")}] ${w.message}`))}catch{p(["Error processing input"])}};return l.jsxs("div",{className:"flex flex-col gap-4",children:[f.length>0&&l.jsxs("div",{className:"border border-accent2 rounded-lg p-2",children:[l.jsxs(we,{as:"p",variant:"ui-md",className:"text-accent2 font-semibold",children:[f.length," errors found"]}),l.jsx("ul",{className:"list-disc list-inside",children:f.map((g,b)=>l.jsx("li",{className:"text-ui-sm text-accent2",children:g},b))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(we,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Phase"}),l.jsxs(ka,{value:u,onValueChange:d,children:[l.jsx(ca,{className:"w-full",children:l.jsx(_a,{placeholder:"Select phase"})}),l.jsx(ua,{children:P_e.map(g=>l.jsx(Dr,{value:g.value,children:g.value},g.value))})]}),l.jsx(we,{variant:"ui-xs",className:"text-neutral4",children:P_e.find(g=>g.value===u)?.label})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(we,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Test Message"}),l.jsx("textarea",{value:i,onChange:g=>c(g.target.value),placeholder:"Enter a test message...",rows:4,className:"w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-none focus:ring-2 focus:ring-accent1"})]}),o,a?null:l.jsx(me,{variant:"light",onClick:h,className:"w-full",size:"lg",children:n?l.jsx(Sa,{className:"animate-spin"}):r})]})};let M_e;const jOn=()=>M_e??=Promise.all([Qe(()=>import("./standalone-DS4gw9AE.js"),[],import.meta.url),Qe(()=>import("./babel-CmeIX3PZ.js"),[],import.meta.url),Qe(()=>import("./estree-CwOGYdhi.js"),[],import.meta.url)]).catch(e=>{throw M_e=void 0,e}),D0=async e=>{const[t,n,r]=await jOn();return await t.format(e,{semi:!1,parser:"json",printWidth:80,tabWidth:2,plugins:[n,r]})},bE=e=>{try{const t=JSON.parse(e);return!!t&&typeof t=="object"}catch{return!1}},Jre=S.createContext(null);function j2({children:e}){const{requestContext:t}=zr(),[n,r]=S.useState(t),s=o=>r(o),a=()=>{r({})};return l.jsx(Jre.Provider,{value:{schemaValues:n,setSchemaValues:s,clearSchemaValues:a},children:e})}function ese(){const e=S.useContext(Jre);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function ti(){const{requestContext:e}=zr(),n=S.useContext(Jre)?.schemaValues??{};return{...e??{},...n}}const rO="text-neutral3 hover:text-neutral6",$_e=e=>{try{return e==null?"{}":JSON.stringify(e,null,2)}catch{return"{}"}},jV=({label:e,value:t,onChange:n,helperText:r,exampleCode:s})=>{const a=Jg(),{handleCopy:o}=Zd({text:t}),{handleCopy:i}=Zd({text:s??"{}"}),[c,u]=S.useState(null),[d,f]=S.useState(!1),[p,h]=S.useState(!1),g=async()=>{if(u(null),!t.trim()){n("{}");return}if(!bE(t)){u("Invalid JSON");return}try{const b=await D0(t);n(b)}catch{u("Unable to format JSON")}};return l.jsxs(l.Fragment,{children:[p&&l.jsxs("div",{className:"border border-border1 rounded-lg bg-surface3 p-3 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(we,{as:"p",variant:"ui-sm",className:"text-neutral3",children:["Example ",e]}),l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{type:"button",onClick:i,className:rO,"aria-label":"Copy example JSON",children:l.jsx(Te,{children:l.jsx(Li,{})})})}),l.jsx($n,{children:"Copy example JSON"})]})]}),l.jsx(Xc,{value:s,theme:a,extensions:[Vc],className:"h-[150px] w-full overflow-y-scroll bg-surface3 rounded-lg overflow-scroll p-3"})]}),l.jsxs(Yd,{className:"border border-border1 rounded-lg bg-surface3",open:d,onOpenChange:f,children:[l.jsxs("div",{className:"flex items-center justify-between w-full px-3",children:[l.jsxs("div",{children:[l.jsx(we,{as:"label",variant:"ui-md",className:"text-neutral3",children:e}),r&&l.jsx(we,{variant:"ui-xs",className:"text-neutral3",children:r})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{type:"button",onClick:g,className:rO,"aria-label":"Format JSON",children:l.jsx(Te,{children:l.jsx(Yc,{})})})}),l.jsx($n,{children:"Format JSON"})]}),l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{type:"button",onClick:o,className:rO,"aria-label":"Copy JSON",children:l.jsx(Te,{children:l.jsx(Li,{})})})}),l.jsx($n,{children:"Copy JSON"})]}),s&&l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>h(!p),className:rO,"aria-label":p?"Hide example JSON":"View example JSON",children:l.jsx(Te,{children:p?l.jsx(qmt,{}):l.jsx(Zl,{})})})}),l.jsx($n,{children:"View example JSON"})]}),l.jsx(Yu,{asChild:!0,children:l.jsx("button",{type:"button",className:rO,"aria-label":d?`Collapse ${e}`:`Expand ${e}`,children:l.jsx(Te,{className:K("transition-transform",d?"rotate-0":"-rotate-90"),children:l.jsx(fs,{})})})})]})]}),l.jsxs(Xu,{className:"space-y-2",children:[l.jsx(Xc,{value:t,onChange:n,theme:a,extensions:[Vc],className:"h-[260px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"}),c&&l.jsx(we,{variant:"ui-sm",className:"text-accent2",children:c})]})]})]})},AV=({stepKey:e,closeModal:t,isPerStepRun:n,isContinueRun:r,buttonText:s="Start time travel",inputData:a})=>{const{result:o,workflow:i,timeTravelWorkflowStream:c,runId:u,workflowId:d,setDebugMode:f}=S.useContext(vp),p=ti(),h=a?{payload:a}:o?.steps?.[e],[g,b]=S.useState(()=>"{}"),[y,x]=S.useState(()=>"{}"),[w,O]=S.useState(()=>"{}"),[_,C]=S.useState(null),[E,T]=S.useState(!1),N=i?.allSteps?.[e],{schema:A}=S.useMemo(()=>{if(!N?.inputSchema)return{schema:ba(Ve(),pl())};try{const P=jg(N.inputSchema),$=i?.stateSchema?Xd(Gd(jg(i.stateSchema))):null,U=Xd(Gd(P));return{schema:$?ot({inputData:U,initialState:$.optional()}):U,schemaError:null}}catch(P){return console.error("Failed to parse step schema",P),{schema:ba(Ve(),pl())}}},[N?.inputSchema,i?.stateSchema]),I=async P=>{C(null),T(!0);try{const $=g.trim()?JSON.parse(g):{},U=y.trim()?JSON.parse(y):{},L=w.trim()?JSON.parse(w):{},{initialState:B,inputData:H}=P??{},q=i?.stateSchema?H:P,V={runId:u,workflowId:d,step:e,inputData:q,initialState:B,resumeData:Object.keys($)?.length>0?$:void 0,context:Object.keys(U)?.length>0?U:void 0,nestedStepsContext:Object.keys(L)?.length>0?L:void 0,requestContext:p,...r?{perStep:!1}:{}};r&&f(!1),c(V),t()}catch($){console.error("Invalid JSON provided",$),C($ instanceof Error?$.message:"Error time traveling workflow")}finally{T(!1)}};return l.jsx(sd,{children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(we,{as:"p",variant:"ui-lg",className:"text-neutral3",children:"Input data"}),l.jsxs(we,{variant:"ui-xs",className:"text-neutral3",children:["Step: ",e]})]}),l.jsx(Kre,{schema:A,defaultValues:h?.payload,isSubmitLoading:E,submitButtonLabel:s,onSubmit:I,children:l.jsxs("div",{className:"space-y-4 pb-4",children:[n||r?null:l.jsxs(l.Fragment,{children:[l.jsx(jV,{label:"Resume Data (JSON)",value:g,onChange:b,helperText:"Provide any resume payloads that should be passed to the step."}),l.jsx(jV,{label:"Context (JSON)",value:y,onChange:x,helperText:"Only include top level steps (no nested workflow steps) that are required in the time travel execution.",exampleCode:$_e({stepId:{status:"success",payload:{value:"test value"},output:{value:"test output"}}})}),l.jsx(jV,{label:"Nested Step Context (JSON)",value:w,onChange:O,helperText:"Includes nested workflow steps that are required in the time travel execution.",exampleCode:$_e({nestedWorkflowId:{stepId:{status:"success",payload:{value:"test value"},output:{value:"test output"}}}})})]}),_&&l.jsx(we,{variant:"ui-sm",className:"text-accent2",children:_})]})})]})})},tse=({input:e,output:t,resumeData:n,suspendOutput:r,error:s,tripwire:a,mapConfig:o,stepName:i,stepId:c,onShowNestedGraph:u,status:d,stepKey:f,stepsFlow:p})=>{const[h,g]=S.useState(!1),[b,y]=S.useState(!1),[x,w]=S.useState(!1),[O,_]=S.useState(!1),[C,E]=S.useState(!1),[T,N]=S.useState(!1),[A,I]=S.useState(!1),[P,$]=S.useState(!1),{withoutTimeTravel:U,debugMode:L,result:B,runSnapshot:H,timeTravelWorkflowStream:q,runId:V,workflowId:W,setDebugMode:D}=S.useContext(vp),{showMapConfig:Z,stepDetail:z,closeStepDetail:R}=T2(),Q=ti(),G=B?.status??H?.status,J="max-w-4xl w-full",ee=!U&&f&&!o&&G!=="running"&&G!=="paused",ne=f&&L&&G==="paused",ae=S.useMemo(()=>{if(!f||!ne)return;const ge=p?.[f]??[];if(ge.length===0)return;if(ge.length>1)return{hasMultiSteps:!0,input:ge.reduce((Oe,ie)=>(B?.steps?.[ie]?.status==="success"&&(Oe[ie]=B?.steps?.[ie].output),Oe),{})};const je=ge[0];if(B?.steps?.[je]?.status==="success")return{hasMultiSteps:!1,input:B?.steps?.[je].output}},[f,p,ne,B]),ce=ne&&ae&&!B?.steps[f],ye=z?.type==="map-config"&&z?.stepName===i,Y=z?.type==="nested-graph"&&z?.stepName===i,se="ring-2 ring-accent1 ring-offset-1 ring-offset-transparent",te=()=>{ye?R():Z({stepName:i,stepId:c,mapConfig:o})},he=()=>{Y?R():u?.()},le=ge=>{const je={runId:V,workflowId:W,step:f,inputData:ae?.hasMultiSteps?void 0:ae?.input,requestContext:Q,...ge?{perStep:!1}:{},...ae?.hasMultiSteps?{context:Object.keys(ae.input)?.reduce((Oe,ie)=>(Oe[ie]={output:ae.input[ie]},Oe),{})}:{}};ge&&D(!1),q(je)};return l.jsx(l.Fragment,{children:(e||t||s||a||o||n||u||ee||ce)&&l.jsxs("div",{className:K("flex flex-wrap items-center bg-surface4 border-t border-border1 px-2 py-1 gap-2 rounded-b-lg",d==="success"&&"bg-accent1Dark",d==="failed"&&"bg-accent2Dark",d==="tripwire"&&"bg-amber-900/40 border-amber-500/20",d==="suspended"&&"bg-accent3Dark",d==="waiting"&&"bg-accent5Dark",d==="running"&&"bg-accent6Dark"),children:[u&&l.jsx(me,{onClick:he,className:K(Y&&se),size:"sm",children:"View nested graph"}),ee&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>N(!0),size:"sm",children:"Time travel"}),l.jsx(as,{open:T,onOpenChange:N,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:["Time travel to ",f]}),l.jsx(Js,{children:"Time travel to a specific workflow step"})]}),l.jsx(is,{className:"max-h-[600px]",children:l.jsx(AV,{stepKey:f,closeModal:()=>N(!1)})})]})})]}),ce&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>{o?le():$(!0)},size:"sm",children:"Run step"}),l.jsx(as,{open:P,onOpenChange:$,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:["Run step ",f]}),l.jsx(Js,{children:"Run a specific workflow step"})]}),l.jsx(is,{className:"max-h-[600px]",children:l.jsx(AV,{stepKey:f,closeModal:()=>$(!1),isPerStepRun:!0,buttonText:"Run step",inputData:ae?.input})})]})}),l.jsx(me,{onClick:()=>{o?le(!0):I(!0)},size:"sm",children:"Continue run"}),l.jsx(as,{open:A,onOpenChange:I,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:["Continue run ",f]}),l.jsx(Js,{children:"Continue the workflow run from this step"})]}),l.jsx(is,{className:"max-h-[600px]",children:l.jsx(AV,{stepKey:f,closeModal:()=>I(!1),isContinueRun:!0,buttonText:"Continue run",inputData:ae?.input})})]})})]}),o&&l.jsx(me,{onClick:te,className:K(ye&&se),size:"sm",children:"Map config"}),e&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>g(!0),size:"sm",children:"Input"}),l.jsx(as,{open:h,onOpenChange:g,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:[i," input"]}),l.jsx(Js,{children:"View the input data for this step"})]}),l.jsx(is,{children:l.jsx(Qx,{data:e})})]})})]}),n&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>w(!0),size:"sm",children:"Resume data"}),l.jsx(as,{open:x,onOpenChange:w,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:[i," resume data"]}),l.jsx(Js,{children:"View the resume data for this step"})]}),l.jsx(is,{children:l.jsx(Qx,{data:n})})]})})]}),(t??r)&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>y(!0),size:"sm",children:"Output"}),l.jsx(as,{open:b,onOpenChange:y,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:[i," output"]}),l.jsx(Js,{children:"View the output data for this step"})]}),l.jsx(is,{children:l.jsx(Qx,{data:t??r})})]})})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>_(!0),size:"sm",children:"Error"}),l.jsx(as,{open:O,onOpenChange:_,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:[i," error"]}),l.jsx(Js,{children:"View the error details for this step"})]}),l.jsx(is,{children:l.jsx(Qx,{data:s})})]})})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx(me,{onClick:()=>E(!0),className:"text-amber-400 hover:text-amber-300",size:"sm",children:"Tripwire"}),l.jsx(as,{open:C,onOpenChange:E,children:l.jsxs(ts,{className:J,children:[l.jsxs(os,{children:[l.jsxs(ns,{children:[i," tripwire"]}),l.jsx(Js,{children:"View the tripwire details for this step"})]}),l.jsx(is,{children:l.jsx(Qx,{data:{reason:a.reason,retry:a.retry,metadata:a.metadata,processorId:a.processorId}})})]})})]})]})})};function XZe({data:e}){const{conditions:t,previousStepId:n,nextStepId:r,withoutTopHandle:s}=e,[a,o]=S.useState(!0),[i,c]=S.useState(!1),u=t[0]?.type,d=(t.some(w=>w.fnString)||t?.length>1)&&u!=="else",{steps:f}=aT(),p=f[n],h=f[r],g=p?.status==="failed"&&p?.tripwire!==void 0,b=g?"tripwire":p?.status,{icon:y,color:x}=A_e(u);return l.jsxs(l.Fragment,{children:[!s&&l.jsx(ac,{type:"target",position:dn.Top,style:{visibility:"hidden"}}),l.jsxs("div",{"data-workflow-node":!0,"data-workflow-step-status":b,"data-testid":"workflow-condition-node",className:K("bg-surface3 rounded-lg w-[300px] border border-border1",b==="success"&&h&&"bg-accent1Darker",b==="failed"&&h&&"bg-accent2Darker",b==="tripwire"&&h&&"bg-amber-950/40 border-amber-500/30",!p&&!!h?.status&&"bg-accent1Darker"),children:[l.jsxs(Yd,{open:d?a:!0,onOpenChange:w=>{d&&o(w)},children:[l.jsxs(Yu,{className:"flex items-center justify-between w-full px-3 py-2",children:[l.jsx(_t,{icon:y?l.jsx(y,{className:"text-current",...x?{style:{color:x}}:{}}):null,children:u?.toUpperCase()}),d&&l.jsx(Te,{children:l.jsx(fs,{className:K("transition-transform text-neutral3",{"transform rotate-180":a})})})]}),u==="else"?null:l.jsx(Xu,{className:"flex flex-col gap-2 pb-2",children:t.map((w,O)=>{const _=w.conj||u,{icon:C,color:E}=A_e(_),T=O===0?null:l.jsx(_t,{icon:C?l.jsx(C,{className:"text-current",...E?{style:{color:E}}:{}}):null,children:w.conj?.toLocaleUpperCase()||"WHEN"});return w.fnString?l.jsxs("div",{className:"px-3",children:[l.jsx(Jwe,{theme:bW.oneDark,code:String(w.fnString).trim(),language:"javascript",children:({className:N,style:A,tokens:I,getLineProps:P,getTokenProps:$})=>l.jsx("pre",{className:K("relative font-mono p-3 w-full cursor-pointer rounded-lg text-xs !bg-surface4 whitespace-pre-wrap break-words",N,b==="success"&&h&&"!bg-accent1Dark",b==="failed"&&h&&"!bg-accent2Dark",b==="tripwire"&&h&&"!bg-amber-900/40"),onClick:()=>c(!0),style:A,children:I.map((U,L)=>l.jsxs("div",{...P({line:U}),children:[l.jsx("span",{className:"inline-block mr-2 text-neutral3",children:L+1}),U.map((B,H)=>l.jsx("span",{...$({token:B})},H))]},L))})}),l.jsx(as,{open:i,onOpenChange:c,children:l.jsxs(ts,{className:"max-w-[30rem]",children:[l.jsxs(os,{children:[l.jsx(ns,{className:"sr-only",children:"Condition Function"}),l.jsx(Js,{children:"View the condition function code"})]}),l.jsx(is,{children:l.jsx(Ds,{className:"w-full",maxHeight:"400px",children:l.jsx(Jwe,{theme:bW.oneDark,code:String(w.fnString).trim(),language:"javascript",children:({className:N,style:A,tokens:I,getLineProps:P,getTokenProps:$})=>l.jsx("pre",{className:`${N} relative font-mono text-sm overflow-x-auto p-3 w-full rounded-lg mt-2 dark:bg-zinc-800`,style:{...A,backgroundColor:"#121212",padding:"0 0.75rem 0 0"},children:I.map((U,L)=>l.jsxs("div",{...P({line:U}),children:[l.jsx("span",{className:"inline-block mr-2 text-neutral3",children:L+1}),U.map((B,H)=>l.jsx("span",{...$({token:B})},H))]},L))})})})})]})})]},`${w.fnString}-${O}`):l.jsx(S.Fragment,{children:w.ref?.step?l.jsxs("div",{className:"flex items-center gap-1",children:[T,l.jsxs(we,{variant:"ui-xs",className:" text-neutral3 flex-1",children:[w.ref.step.id||w.ref.step,"'s ",w.ref.path," ",Object.entries(w.query).map(([N,A])=>`${N} ${String(A)}`)]})]}):null},`${w.ref?.path}-${O}`)})})]}),l.jsx(tse,{stepName:r,input:p?.output,mapConfig:e.mapConfig,tripwire:g?p?.tripwire:void 0,status:h?b:void 0})]}),l.jsx(ac,{type:"source",position:dn.Bottom,style:{visibility:"hidden"}})]})}const AOn=(e,t)=>Number(e.toPrecision(t)),KZe=({startedAt:e,endedAt:t})=>{const[n,r]=S.useState(e);S.useEffect(()=>{const a=setInterval(()=>{r(Date.now())},100);return()=>clearInterval(a)},[e]);const s=t?t-e:n-e;return l.jsxs("span",{className:"text-xs text-neutral3",children:[AOn(s,3),"ms"]})};function JZe({data:e,parentWorkflowName:t,stepsFlow:n}){const{steps:r}=aT(),{label:s,stepId:a,description:o,withoutTopHandle:i,withoutBottomHandle:c,mapConfig:u,duration:d,date:f,isParallel:p,canSuspend:h,isForEach:g}=e,b=t?`${t}.${a||s}`:a||s,y=r[b],x=y?.status==="failed"&&y?.tripwire!==void 0,w=x?"tripwire":y?.status,{isSleepNode:O,isForEachNode:_,isMapNode:C,hasSpecialBadge:E}=qZe({duration:d,date:f,isForEach:g,mapConfig:u,canSuspend:h,isParallel:p});return l.jsxs(l.Fragment,{children:[!i&&l.jsx(ac,{type:"target",position:dn.Top,style:{visibility:"hidden"}}),l.jsxs("div",{"data-workflow-node":!0,"data-workflow-step-status":w??"idle","data-testid":"workflow-default-node",className:K("bg-surface3 rounded-lg w-[274px] border border-border1",E?"pt-0":"pt-2",w==="success"&&"bg-accent1Darker",w==="failed"&&"bg-accent2Darker",w==="tripwire"&&"bg-amber-950/40 border-amber-500/30",w==="suspended"&&"bg-accent3Darker",w==="waiting"&&"bg-accent5Darker",w==="running"&&"bg-accent6Darker"),children:[E&&l.jsxs("div",{className:"px-3 pt-2 pb-1 flex gap-1.5 flex-wrap",children:[O&&l.jsx(_t,{icon:f?l.jsx(Io.sleepUntil,{className:"text-current",style:{color:ro.sleep}}):l.jsx(Io.sleep,{className:"text-current",style:{color:ro.sleep}}),children:f?"SLEEP UNTIL":"SLEEP"}),h&&l.jsx(_t,{icon:l.jsx(Io.suspend,{className:"text-current",style:{color:ro.suspend}}),children:"SUSPEND/RESUME"}),p&&l.jsx(_t,{icon:l.jsx(Io.parallel,{className:"text-current",style:{color:ro.parallel}}),children:"PARALLEL"}),_&&l.jsx(_t,{icon:l.jsx(Io.forEach,{className:"text-current",style:{color:ro.forEach}}),children:"FOREACH"}),C&&l.jsx(_t,{icon:l.jsx(Io.map,{className:"text-current",style:{color:ro.map}}),children:"MAP"})]}),l.jsxs("div",{className:K("flex items-center gap-2 px-3",!o&&"pb-2"),children:[l.jsxs(Te,{children:[w==="tripwire"&&l.jsx(XE,{className:"text-amber-400"}),w==="failed"&&l.jsx(Qre,{className:"text-accent2"}),w==="success"&&l.jsx(Vre,{className:"text-accent1"}),w==="suspended"&&l.jsx(lMe,{className:"text-accent3"}),w==="waiting"&&l.jsx(AX,{className:"text-accent5"}),w==="running"&&l.jsx(Sa,{className:"text-accent6 animate-spin"}),!y&&l.jsx(XM,{className:"text-neutral2"})]}),l.jsxs(we,{variant:"ui-lg",className:"text-neutral6 font-medium inline-flex items-center gap-1 justify-between w-full",children:[s," ",y?.startedAt&&l.jsx(KZe,{startedAt:y.startedAt,endedAt:y.endedAt})]})]}),o&&l.jsx(we,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:o}),_&&y?.foreachProgress&&l.jsxs("div",{className:"px-3 pb-2 flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-1.5 bg-surface1 rounded-full overflow-hidden",children:l.jsx("div",{className:K("h-full rounded-full transition-all duration-300",y.foreachProgress.iterationStatus==="failed"?"bg-accent2":"bg-accent1"),style:{width:`${y.foreachProgress.totalCount>0?y.foreachProgress.completedCount/y.foreachProgress.totalCount*100:0}%`}})}),l.jsxs(we,{variant:"ui-xs",className:"text-neutral3 whitespace-nowrap",children:[y.foreachProgress.completedCount," / ",y.foreachProgress.totalCount]})]}),d&&l.jsxs(we,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:["sleeps for ",l.jsxs("strong",{children:[d,"ms"]})]}),f&&l.jsxs(we,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:["sleeps until ",l.jsx("strong",{children:new Date(f).toLocaleString()})]}),l.jsx(tse,{stepName:s,stepId:a,input:y?.input,resumeData:y?.resumeData,output:y?.output,suspendOutput:y?.suspendOutput,error:x?void 0:y?.error,tripwire:x?y?.tripwire:void 0,mapConfig:u,status:w,stepKey:b,stepsFlow:n})]}),!c&&l.jsx(ac,{type:"source",position:dn.Bottom,style:{visibility:"hidden",color:"red"}})]})}function eYe({data:e}){const{steps:t}=e,[n,r]=S.useState(!0);return l.jsxs(Yd,{open:n,onOpenChange:r,className:K("bg-surface4 rounded-md w-[274px] flex flex-col p-2 gap-2"),children:[l.jsx(ac,{type:"target",position:dn.Top,style:{visibility:"hidden"}}),l.jsxs(Yu,{className:"flex items-center justify-between w-full",children:[l.jsx(_t,{icon:l.jsx(Io.after,{className:"text-current",style:{color:ro.after}}),children:"AFTER"}),l.jsx(Te,{children:l.jsx(fs,{className:K("transition-transform text-neutral3",{"transform rotate-180":n})})})]}),l.jsx(Xu,{className:"flex flex-col gap-2",children:t.map(s=>l.jsxs("div",{className:"text-sm bg-surface5 flex items-center gap-1.5 rounded-sm p-2",children:[l.jsx(lgt,{className:"text-current w-4 h-4"}),l.jsx(we,{variant:"ui-xs",className:"text-neutral6 capitalize",children:s})]},s))}),l.jsx(ac,{type:"source",position:dn.Bottom,style:{visibility:"hidden"}})]})}function tYe({data:e}){const{result:t}=e;return l.jsxs("div",{"data-testid":"workflow-loop-result-node","data-workflow-step-status":t?"success":"failed",className:K("bg-surface4 rounded-md w-[274px]"),"data-workflow-node":!0,children:[l.jsx(ac,{type:"target",position:dn.Top,style:{visibility:"hidden"}}),l.jsx("div",{className:"p-2",children:l.jsxs("div",{className:"text-sm bg-surface5 flex items-center gap-1.5 rounded-sm p-2",children:[t?l.jsx(jX,{className:"text-current w-4 h-4"}):l.jsx(ky,{className:"text-current w-4 h-4"}),l.jsx(we,{variant:"ui-xs",className:"text-neutral6 capitalize",children:String(t)})]})}),l.jsx(ac,{type:"source",position:dn.Bottom,style:{visibility:"hidden"}})]})}function nYe({data:e,parentWorkflowName:t,stepsFlow:n}){const{steps:r}=aT(),{showNestedGraph:s}=T2(),{label:a,stepId:o,description:i,withoutTopHandle:c,withoutBottomHandle:u,stepGraph:d,mapConfig:f,isParallel:p,canSuspend:h,isForEach:g}=e,b=t?`${t}.${a}`:a,y=t?`${t}.${o||a}`:o||a,x=r[y],w=x?.status==="failed"&&x?.tripwire!==void 0,O=w?"tripwire":x?.status,{isForEachNode:_,isMapNode:C,isNestedWorkflow:E,hasSpecialBadge:T}=qZe({isForEach:g,mapConfig:f,canSuspend:h,isParallel:p,stepGraph:d});return l.jsxs(l.Fragment,{children:[!c&&l.jsx(ac,{type:"target",position:dn.Top,style:{visibility:"hidden"}}),l.jsxs("div",{"data-testid":"workflow-nested-node","data-workflow-node":!0,"data-workflow-step-status":O,className:K("bg-surface3 rounded-lg w-[274px] border border-border1",T?"pt-0":"pt-2",O==="success"&&"bg-accent1Darker",O==="failed"&&"bg-accent2Darker",O==="tripwire"&&"bg-amber-950/40 border-amber-500/30",O==="suspended"&&"bg-accent3Darker",O==="waiting"&&"bg-accent5Darker",O==="running"&&"bg-accent6Darker"),children:[T&&l.jsxs("div",{className:"px-3 pt-2 pb-1 flex gap-1.5 flex-wrap",children:[h&&l.jsx(_t,{icon:l.jsx(Io.suspend,{className:"text-current",style:{color:ro.suspend}}),children:"SUSPEND/RESUME"}),p&&l.jsx(_t,{icon:l.jsx(Io.parallel,{className:"text-current",style:{color:ro.parallel}}),children:"PARALLEL"}),E&&l.jsx(_t,{icon:l.jsx(Io.workflow,{className:"text-current",style:{color:ro.workflow}}),children:"WORKFLOW"}),_&&l.jsx(_t,{icon:l.jsx(Io.forEach,{className:"text-current",style:{color:ro.forEach}}),children:"FOREACH"}),C&&l.jsx(_t,{icon:l.jsx(Io.map,{className:"text-current",style:{color:ro.map}}),children:"MAP"})]}),l.jsxs("div",{className:K("flex items-center gap-2 px-3",!i&&"pb-2"),children:[l.jsxs(Te,{children:[O==="failed"&&l.jsx(Qre,{className:"text-accent2"}),O==="success"&&l.jsx(Vre,{className:"text-accent1"}),O==="tripwire"&&l.jsx(XE,{className:"text-amber-400"}),O==="suspended"&&l.jsx(lMe,{className:"text-accent3"}),O==="waiting"&&l.jsx(AX,{className:"text-accent5"}),O==="running"&&l.jsx(Sa,{className:"text-accent6 animate-spin"}),!x&&l.jsx(XM,{className:"text-neutral2"})]}),l.jsxs(we,{variant:"ui-lg",className:"text-neutral6 font-medium inline-flex items-center gap-1 justify-between w-full",children:[a," ",x?.startedAt&&l.jsx(KZe,{startedAt:x.startedAt,endedAt:x.endedAt})]})]}),i&&l.jsx(we,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:i}),_&&x?.foreachProgress&&l.jsxs("div",{className:"px-3 pb-2 flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-1.5 bg-surface1 rounded-full overflow-hidden",children:l.jsx("div",{className:K("h-full rounded-full transition-all duration-300",x.foreachProgress.iterationStatus==="failed"?"bg-accent2":"bg-accent1"),style:{width:`${x.foreachProgress.totalCount>0?x.foreachProgress.completedCount/x.foreachProgress.totalCount*100:0}%`}})}),l.jsxs(we,{variant:"ui-xs",className:"text-neutral3 whitespace-nowrap",children:[x.foreachProgress.completedCount," / ",x.foreachProgress.totalCount]})]}),l.jsx(tse,{stepName:a,stepId:o,input:x?.input,resumeData:x?.resumeData,output:x?.output,suspendOutput:x?.suspendOutput,error:x?.error,tripwire:w?x?.tripwire:void 0,mapConfig:f,onShowNestedGraph:()=>s({label:a,fullStep:b,stepGraph:d}),status:O,stepKey:y,stepsFlow:n})]}),!u&&l.jsx(ac,{type:"source",position:dn.Bottom,style:{visibility:"hidden"}})]})}const MP=S.forwardRef(({className:e,...t},n)=>l.jsxs(ZIe,{ref:n,className:K("relative flex w-full touch-none select-none items-center group",e),...t,children:[l.jsx(Wft,{className:K("relative h-1.5 w-full grow overflow-hidden rounded-full bg-neutral2",An.colors),children:l.jsx(Zft,{className:K("absolute h-full bg-accent1",An.all)})}),l.jsx(Yft,{className:K("block h-4 w-4 rounded-full border-2 border-accent1 bg-white shadow-md","transition-all duration-normal ease-out-custom",tT,"hover:scale-110 hover:shadow-lg","active:scale-95","disabled:pointer-events-none disabled:opacity-50")})]}));MP.displayName=ZIe.displayName;const nse=S.forwardRef(({className:e,...t})=>{const{zoom:n}=ZXt(),{zoomTo:r,zoomIn:s,zoomOut:a,fitView:o}=GD();return l.jsxs(LC,{className:K("flex gap-1 rounded-md bg-surface2 p-1 text-neutral6",e),...t,children:[l.jsx(me,{onClick:()=>a({duration:300}),children:l.jsx(Ugt,{className:"h-4 w-4"})}),l.jsx(MP,{className:"w-[140px]",value:[n],min:.01,max:1,step:.01,onValueChange:i=>{r(i[0])}}),l.jsx(me,{onClick:()=>s({duration:300}),children:l.jsx(Gr,{className:"h-4 w-4"})}),l.jsxs(me,{className:"min-w-20 tabular-nums",onClick:()=>r(1,{duration:300}),children:[(100*n).toFixed(0),"%"]}),l.jsx(me,{onClick:()=>o({duration:300,maxZoom:1}),children:l.jsx(Dgt,{className:"h-4 w-4"})})]})});nse.displayName="ZoomSlider";function ROn({workflow:e}){const{nodes:t,edges:n}=UZe(e),[r,s,a]=bUe(t),[o]=yUe(n),{steps:i}=aT(),c=S.useMemo(()=>n.reduce((d,f)=>{if(f.data){const p=f.data.nextStepId,h=f.data.previousStepId;return{...d,[p]:[...new Set([...d[p]||[],h])]}}return d},{}),[n]),u={"default-node":d=>l.jsx(JZe,{...d,stepsFlow:c}),"condition-node":XZe,"after-node":eYe,"loop-result-node":tYe,"nested-node":d=>l.jsx(nYe,{...d,stepsFlow:c})};return l.jsx("div",{className:"w-full h-full bg-surface1",children:l.jsxs(gUe,{nodes:r,edges:o.map(d=>({...d,style:{...d.style,stroke:i[d.data?.previousStepId]?.status==="success"&&i[d.data?.nextStepId]||d.data?.conditionNode&&!i[d.data?.previousStepId]&&i[d.data?.nextStepId]?.status?"#22c55e":void 0}})),nodeTypes:u,onNodesChange:a,fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.01,maxZoom:1,children:[l.jsx(nse,{position:"bottom-left"}),l.jsx(xUe,{variant:Hf.Dots,gap:12,size:.5})]})})}function rYe({workflowId:e,workflow:t,isLoading:n}){const{snapshot:r}=S.useContext(vp);return n?l.jsx("div",{className:"p-4",children:l.jsx(cr,{className:"h-full"})}):t?l.jsx(Hte,{children:l.jsx(ROn,{workflow:r?.serializedStepGraph?{stepGraph:r?.serializedStepGraph}:t})}):l.jsx("div",{className:"grid h-full place-items-center",children:l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx($d,{}),l.jsxs("div",{children:["We couldn't find ",D1n(e)," workflow."]})]})})}const IOn=e=>e&&Object.keys(e).length===0&&e.constructor===Object;async function POn(e){const{baseUrl:t="",headers:n={},apiPrefix:r}=e.options,s=(r||"/api").trim(),a=(s.startsWith("/")?s:`/${s}`).replace(/\/$/,""),o=await fetch(`${t}${a}/auth/capabilities`,{credentials:"include",headers:{"Content-Type":"application/json",...n}});if(!o.ok)throw new Error(`Failed to fetch auth capabilities: ${o.status}`);return o.json()}function lT(){const e=Xe();return qt({queryKey:["auth","capabilities"],queryFn:()=>POn(e),staleTime:60*1e3,retry:!1})}function A2(e){return"user"in e&&e.user!==void 0}function MOn(e,t){if(e==="*")return!0;const n=e.split(":"),r=t.split(":");if(n.length<2||r.length<2)return e===t;const[s,a,o]=n,[i,c,u]=r;return s==="*"?a==="*"?!0:a!==c?!1:o===void 0?!0:o===u:s!==i?!1:a==="*"?o===void 0?!0:o===u:a!==c?!1:o===void 0?!0:o===u}function RV(e,t){return e.some(n=>MOn(n,t))}function xp(){const{data:e,isLoading:t}=lT(),n=e&&A2(e),r=n?e.access:null,s=n?e.capabilities.rbac:!1,a=r?.roles??[],o=r?.permissions??[],i=c=>s?RV(o,c):!0;return{roles:a,permissions:o,isLoading:t,isAuthenticated:!!n,rbacEnabled:s,hasPermission:c=>i(c),hasAllPermissions:c=>s?c.every(u=>RV(o,u)):!0,hasAnyPermission:c=>s?c.some(u=>RV(o,u)):!0,hasRole:c=>s?a.includes(c):!0,canEdit:c=>i(`${c}:write`),canDelete:c=>i(`${c}:delete`),canExecute:c=>i(`${c}:execute`)}}function $On(e,t){return S.useMemo(()=>Object.entries(e?.steps||{}).filter(([n,{status:r}])=>r==="suspended").map(([n,{suspendPayload:r}])=>({stepId:n,runId:t,suspendPayload:r,isLoading:!1})),[e?.steps,t])}function DOn(e){return S.useMemo(()=>{const t=e?.inputSchema,n=e?.stateSchema,r=t?Xd(Gd(jg(t))):null,s=n?Xd(Gd(jg(n))):null;return{zodSchemaToUse:s?ot({inputData:r,initialState:s.optional()}):r,hasStateSchema:!!n}},[e?.inputSchema,e?.stateSchema])}function LOn({zodSchema:e,isStreaming:t,onExecute:n,defaultValues:r,isViewingRun:s,isProcessorWorkflow:a}){return e?l.jsx(Kre,{schema:e,defaultValues:r,isSubmitLoading:t,submitButtonLabel:"Run",onSubmit:n,withoutSubmit:s,isProcessorWorkflow:a}):s?null:l.jsx(me,{className:"w-full",variant:"light",disabled:t,onClick:()=>n(null),children:t?l.jsx(Te,{children:l.jsx(Sa,{className:"animate-spin"})}):"Trigger"})}function FOn({suspendedSteps:e,workflow:t,isStreaming:n,onResume:r}){return n||e.length===0?null:l.jsx(l.Fragment,{children:e.map(s=>{const a=t.allSteps[s.stepId];if(!a||a.isWorkflow)return null;const o=a?.resumeSchema?Xd(Gd(jg(a.resumeSchema))):ba(Ve(),pl());return l.jsxs("div",{className:"flex flex-col px-4",children:[l.jsx(we,{variant:"ui-xs",className:"text-neutral3",children:s.stepId}),s.suspendPayload&&l.jsx("div",{"data-testid":"suspended-payload",children:l.jsx(Vs,{data:s.suspendPayload,className:"w-full overflow-x-auto p-2",showCopyButton:!1})}),l.jsx(Kre,{schema:o,isSubmitLoading:n,submitButtonLabel:"Resume workflow",onSubmit:i=>{const c=s.stepId?.split(".");r({stepId:c,runId:s.runId,suspendPayload:s.suspendPayload,resumeData:i,isLoading:!1})}})]},s.stepId)})})}const zOn=["success","failed","canceled","tripwire"];function BOn({status:e,cancelMessage:t,isCancelling:n,onCancel:r}){return e!=="running"?null:l.jsxs(me,{variant:"light",className:"w-full",onClick:r,disabled:!!t||n||e&&zOn.includes(e),children:[n?l.jsx(Te,{children:l.jsx(Sa,{className:"animate-spin"})}):l.jsx(Te,{children:l.jsx(YPe,{})}),t||"Cancel Workflow Run"]})}const UOn=({header:e,children:t,footer:n})=>{const[r,s]=S.useState(!1);return l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface4",children:[l.jsxs("button",{className:"py-1 px-2 flex items-center gap-3 justify-between w-full",onClick:()=>s(a=>!a),children:[l.jsx("div",{className:"w-full",children:e}),l.jsx(Te,{children:l.jsx(fs,{className:K("text-neutral3 transition-transform -rotate-90",r&&"rotate-0")})})]}),t&&r&&l.jsx("div",{className:"border-t border-border1 max-h-[400px] overflow-y-auto",children:t}),n&&l.jsx("div",{className:"py-1 px-2 border-t border-border1",children:n})]})},qOn=({stepId:e,status:t,result:n,tripwire:r})=>{const[s,a]=S.useState(!1),o=t==="tripwire",i=!!(r&&(r.retry!==void 0||r.metadata!==void 0||r.processorId!==void 0));return l.jsx(UOn,{header:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Te,{children:[t==="success"&&l.jsx(Vre,{className:"text-accent1"}),t==="failed"&&l.jsx(Qre,{className:"text-accent2"}),t==="tripwire"&&l.jsx(XE,{className:"text-amber-400"}),t==="suspended"&&l.jsx(WPe,{className:"text-accent3"}),t==="waiting"&&l.jsx(AX,{className:"text-accent5"}),t==="running"&&l.jsx(Sa,{className:"text-accent6 animate-spin"})]}),l.jsx(we,{as:"span",variant:"ui-lg",className:"text-neutral6 font-medium",children:e.charAt(0).toUpperCase()+e.slice(1)})]}),children:o&&r?l.jsx(VOn,{tripwire:r,isExpanded:s,onToggleExpand:()=>a(!s),hasMetadata:i}):l.jsx(Vs,{data:n})})},VOn=({tripwire:e,isExpanded:t,onToggleExpand:n,hasMetadata:r})=>l.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-950/20 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3 p-4",children:[l.jsx(XE,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm font-medium text-amber-200 mb-1",children:"Content Blocked"}),l.jsx("p",{className:"text-sm text-amber-300/90",children:e.reason||"Tripwire triggered"})]})]}),r&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:n,className:"w-full flex items-center gap-2 px-4 py-2 text-xs text-amber-400/70 hover:text-amber-400 hover:bg-amber-900/20 transition-colors border-t border-amber-500/20",children:[t?l.jsx(fs,{className:"w-3.5 h-3.5"}):l.jsx(xs,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Details"})]}),t&&l.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-amber-500/20 bg-amber-950/10",children:[e.retry!==void 0&&l.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[l.jsx(YE,{className:"w-3.5 h-3.5 text-amber-400/60"}),l.jsxs("span",{className:"text-xs text-amber-300/70",children:["Retry:"," ",e.retry?l.jsx("span",{className:"text-green-400",children:"Allowed"}):l.jsx("span",{className:"text-red-400",children:"Not allowed"})]})]}),e.processorId&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(MX,{className:"w-3.5 h-3.5 text-amber-400/60"}),l.jsxs("span",{className:"text-xs text-amber-300/70",children:["Processor:"," ",l.jsx("code",{className:"px-1.5 py-0.5 rounded bg-amber-900/30 text-amber-200 font-mono",children:e.processorId})]})]}),e.metadata!==void 0&&e.metadata!==null&&l.jsxs("div",{className:"pt-1",children:[l.jsx("p",{className:"text-xs text-amber-400/60 mb-1.5",children:"Metadata:"}),l.jsx("pre",{className:"text-xs text-amber-200/80 bg-amber-900/30 rounded p-2 overflow-x-auto font-mono",children:String(JSON.stringify(e.metadata,null,2))})]})]})]})]});function QOn({steps:e,workflowResult:t}){const n=Object.entries(e).filter(([r,s])=>r!=="input"&&!r.endsWith(".input"));return n.length===0?null:l.jsxs("div",{className:"flex flex-col gap-2 pt-5 border-t border-border1",children:[l.jsx(we,{variant:"ui-xs",className:"text-neutral3",children:"Status"}),l.jsx("div",{className:"flex flex-col gap-4",children:n.map(([r,s])=>{const{status:a}=s;let o,i,c;s.status==="suspended"&&(i=s.suspendOutput),s.status==="success"&&(o=s.output),s.status==="failed"&&(c=s.error);const u=s.status==="failed"&&s.tripwire?s.tripwire:t?.status==="tripwire"?{reason:t?.tripwire?.reason,retry:t?.tripwire?.retry,metadata:t?.tripwire?.metadata,processorId:t?.tripwire?.processorId}:void 0,d=s.status==="failed"&&s.tripwire?"tripwire":a;return l.jsx(qOn,{stepId:r,status:d,result:o??i??c??{},tripwire:u},r)})})]})}function sYe({workflowId:e,paramsRunId:t,setRunId:n,workflow:r,isLoading:s,createWorkflowRun:a,resumeWorkflow:o,streamWorkflow:i,observeWorkflowStream:c,isStreamingWorkflow:u,streamResult:d,isCancellingWorkflowRun:f,cancelWorkflowRun:p}){const h=ti(),{result:g,setResult:b,payload:y,setPayload:x,setRunId:w}=S.useContext(vp),{canExecute:O}=xp(),_=O("workflows"),[C,E]=S.useState(""),[T,N]=S.useState(null),A=g??d,I=$On(A,C),{zodSchemaToUse:P,hasStateSchema:$}=DOn(r),U=async W=>{try{if(!r)return;N(null),b(null);const D=await a({workflowId:e});n?.(D.runId),E(D.runId),w(D.runId);const{initialState:Z,inputData:z}=W??{},R=$?z:W;i({workflowId:e,runId:D.runId,inputData:R,initialState:Z,requestContext:h})}catch{qe.error("Error executing workflow")}},L=async W=>{if(!r)return;N(null);const{stepId:D,runId:Z,resumeData:z}=W,R=await a({workflowId:e,prevRunId:Z});await o({step:D,runId:R.runId,resumeData:z,workflowId:e,requestContext:h})},B=async()=>{const W=await p({workflowId:e,runId:C});N(W)};if(S.useEffect(()=>{t&&c&&(c({workflowId:e,runId:t}),E(t),w(t))},[t]),S.useEffect(()=>{d&&b(d)},[d]),s)return l.jsx(Ds,{className:"h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx(cr,{className:"h-10"}),l.jsx(cr,{className:"h-10"})]})});if(!r)return null;const H=I.length>0,q=A?.steps??{},V=Object.values(q).length>0;return l.jsxs("div",{className:"h-full pt-3 overflow-y-auto",children:[l.jsxs("div",{className:"space-y-4 px-5 pb-5 border-b border-border1",children:[H&&u&&l.jsxs("div",{className:"py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b border-border1",children:[l.jsx(Te,{children:l.jsx(Sa,{className:"animate-spin text-neutral6"})}),l.jsx(we,{children:"Resuming workflow"})]}),!H&&_&&l.jsx(LOn,{zodSchema:P,defaultValues:y,isStreaming:u,onExecute:W=>{x(W),U(W)},isViewingRun:!!t,isProcessorWorkflow:r?.isProcessorWorkflow}),!H&&!_&&l.jsx(we,{variant:"ui-sm",className:"text-neutral3 py-2",children:"You don't have permission to execute workflows."}),l.jsx(FOn,{suspendedSteps:I,workflow:r,isStreaming:u,onResume:L}),l.jsx(BOn,{status:g?.status,cancelMessage:T?.message??null,isCancelling:f,onCancel:B}),V&&l.jsx(QOn,{steps:q,workflowResult:A})]}),g&&!IOn(g)&&l.jsx("div",{className:"p-5 border-b border-border1",children:l.jsx(HOn,{result:g})})]})}const HOn=({result:e})=>{const[t,n]=S.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(me,{variant:"light",onClick:()=>n(!0),className:"w-full truncate",children:[l.jsx(Te,{children:l.jsx(Yc,{className:"text-neutral3"})}),"Open Workflow Execution (JSON)"]}),l.jsx(as,{open:t,onOpenChange:n,children:l.jsxs(ts,{className:"max-w-6xl",children:[l.jsxs(os,{children:[l.jsx(ns,{children:"Workflow Execution (JSON)"}),l.jsx(Js,{children:"JSON view of the workflow execution result"})]}),l.jsx(is,{className:"max-h-[90vh]",children:l.jsx(Vs,{data:e,className:"p-4"})})]})})]})},GOn=({workflowId:e,runId:t,observeWorkflowStream:n,...r})=>{const{runSnapshot:s,isLoadingRunExecutionResult:a}=S.useContext(vp);if(a)return l.jsx("div",{className:"p-4",children:l.jsx(cr,{className:"h-[600px]"})});if(!s||!t)return l.jsx("div",{className:"p-4",children:l.jsx(we,{variant:"ui-md",className:"text-neutral6 text-center",children:"No previous run"})});const o=pZ(s),i=o?.status;if(t)return l.jsx("div",{className:"h-full grid grid-rows-[1fr_auto]",children:l.jsx(sYe,{...r,paramsRunId:t,workflowId:e,observeWorkflowStream:()=>{i!=="success"&&i!=="failed"&&i!=="canceled"&&n?.({workflowId:e,runId:t,storeRunResult:o})}})})};function Hi({iconSlot:e,titleSlot:t,descriptionSlot:n,actionSlot:r,className:s,as:a="h3"}){return l.jsxs("div",{className:K("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&l.jsx("div",{className:"mb-4",children:e}),l.jsx(a,{className:"font-medium text-neutral5 text-ui-lg",children:t}),n&&l.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-md max-w-md",children:n}),r&&l.jsx("div",{className:"mt-5",children:r})]})}function Ya({resource:e,title:t,description:n,actionSlot:r,className:s}){const a="Permission Denied",o=e?`You don't have permission to access ${e}. Contact your administrator for access.`:"You don't have permission to access this resource. Contact your administrator for access.";return l.jsx(Hi,{className:s,iconSlot:l.jsx(Te,{size:"lg",className:"text-neutral3",children:l.jsx(Ibt,{})}),titleSlot:t??a,descriptionSlot:n??o,actionSlot:r})}function Mv({title:e,message:t}){return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsxs("div",{className:"flex flex-col items-center justify-center text-center py-10 px-6",children:[l.jsx("div",{className:"mb-4",children:l.jsx(ky,{className:"h-8 w-8 text-red-900"})}),l.jsx("h3",{className:"font-medium text-neutral4 text-ui-md",children:e}),l.jsx("p",{className:"mt-1.5 text-neutral2 text-ui-md max-w-md",children:t})]})})}function WOn({children:e,className:t}){return l.jsx("div",{className:K("grid grid-rows-[auto_1fr] overflow-y-auto",t),children:e})}function rse(e){return!e||e.length===0?"":e?.map(t=>t.size).join(" ")}function aYe({columns:e,isSelectionActive:t,children:n}){return l.jsx("div",{className:K("sticky top-0 bg-surface3 z-10 rounded-lg px-4 mb-4"),children:l.jsx("div",{className:K("grid gap-4 text-left items-center uppercase text-neutral3 tracking-widest text-ui-xs",{"pl-12 [&>label]:absolute [&>label]:left-0":t}),style:{gridTemplateColumns:rse(e)},children:n})})}function ZOn({children:e,className:t}){return l.jsx("span",{className:K("py-3",t),children:e})}function oYe({children:e}){return l.jsx("ul",{className:"grid content-start",children:e})}function iYe({isSelected:e,children:t,columns:n,className:r}){return l.jsx("li",{className:K("flex border border-transparent py-[3px] pb-[2px] text-neutral5 border-t-surface5 rounded-lg first:border-t-transparent text-ui-md overflow-hidden","[&:last-child>button]:rounded-b-lg","[&.selected-row]:border-white/50 [&.selected-row]:pr-[3px] [&.selected-row]:border-dashed [&.selected-row]:border [&.selected-row]:first:border-t","[&:has(+.selected-row)]:rounded-b-none [&:has(+.selected-row)]:border-b-transparent","[.selected-row+&]:rounded-t-none",An.colors,{"selected-row":e,"grid px-4 gap-4 ":n},r),style:{gridTemplateColumns:rse(n)},children:t})}function YOn({item:e,isFeatured:t,onClick:n,children:r,columns:s,className:a,disabled:o}){const i=()=>{n?.(e?.id)};return l.jsx("button",{onClick:i,className:K("grid w-full px-4 gap-4 text-left items-center rounded-lg",An.colors,Kg.visible,{"bg-surface4":t,"hover:bg-surface4":e&&!t&&!o},a),style:{gridTemplateColumns:rse(s)},disabled:o,children:r})}function XOn({children:e,message:t,className:n,type:r}){return!e&&!t?null:l.jsx("div",{className:K("grid border-t border-border1",n),children:t?l.jsxs("p",{className:K("text-neutral3 text-ui-md text-center grid p-8 justify-center justify-items-center gap-2","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-75",{"[&>svg]:text-red-500":r==="error"}),children:[r==="error"?l.jsx(bl,{}):l.jsx(Ri,{})," ",t]}):e})}function KOn({isLoading:e,hasMore:t,setEndOfListElement:n,loadingText:r="Loading more data...",noMoreDataText:s="No more data to load"}){return n?l.jsxs("div",{ref:n,className:"text-ui-md text-neutral3 opacity-50 flex mt-8 justify-center",children:[e&&r,!t&&!e&&s]}):null}function JOn({currentPage:e,hasMore:t,onNextPage:n,onPrevPage:r}){const s=typeof e=="number"&&e>0||t;return l.jsxs("div",{className:K("flex pt-6 items-center justify-center text-neutral3 text-ui-md gap-8"),children:[l.jsxs("span",{children:["Page ",l.jsx("b",{children:e?e+1:"1"})]}),s&&l.jsxs("div",{className:K("flex gap-4","[&>button]:flex [&>button]:items-center [&>button]:gap-2 [&>button]:text-neutral4 [&>button:hover]:text-neutral5 [&>button]:transition-colors [&>button]:border [&>button]:border-border1 [&>button]:p-1 [&>button]:px-2 [&>button]:rounded-md","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[typeof e=="number"&&e>0&&l.jsxs("button",{onClick:r,children:[l.jsx(eS,{}),"Previous"]}),t&&l.jsxs("button",{onClick:n,children:["Next",l.jsx(qf,{})]})]})]})}function ekn({children:e}){const t=S.useRef(null);return l.jsx("div",{ref:t,className:K("overflow-y-auto"),children:e})}function lYe({children:e,className:t,style:n}){return l.jsx("div",{className:K("",t),style:n,children:e})}function tkn({children:e,className:t}){return l.jsx("div",{className:K("text-neutral4 py-[0.6rem] text-ui-md truncate",t),children:e})}function nkn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function rkn({status:e}){return e?l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("div",{className:K("flex items-center justify-center w-10 relative bg-transparent h-full"),children:l.jsx("div",{className:K("w-[0.5rem] h-[0.5rem] rounded-full",{"bg-green-600":["success","completed"].includes(e),"bg-red-700":["error","failed"].includes(e),"bg-yellow-500":["pending","running"].includes(e)})})})}),l.jsx($n,{children:nkn(e)})]}):null}const skn={small:"text-[11px] pt-[5px] pb-[4px]",default:"text-[12px] pt-[5px] pb-[4px] ",large:"text-[13px] pt-[5px] pb-[4px] "},akn={gray:{bright:"bg-neutral-700",muted:"bg-neutral-700/70"},red:{bright:"bg-red-900",muted:"bg-red-900/70"},orange:{bright:"bg-yellow-900",muted:"bg-yellow-900/70"},blue:{bright:"bg-blue-800",muted:"bg-blue-800/60"},green:{bright:"bg-green-900",muted:"bg-green-900/70"},purple:{bright:"bg-purple-900",muted:"bg-purple-900/60"},yellow:{bright:"bg-yellow-700",muted:"bg-yellow-700/60"},cyan:{bright:"bg-cyan-900",muted:"bg-cyan-900/60"},pink:{bright:"bg-pink-900",muted:"bg-pink-900/70"}},okn={bright:"text-neutral4",muted:"text-neutral3"},Ar=({color:e="gray",size:t="default",intensity:n="bright",className:r,children:s,...a})=>l.jsx("span",{className:K("inline-flex items-center rounded-md uppercase px-[0.5em] gap-[0.4em] tracking-wide font-normal","[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:translate-y-[-0.02em] [&>svg]:mx-[-0.2em]","[&>svg]:opacity-50 [&>svg:first-child:last-child]:opacity-100",skn[t],akn[e][n],okn[n],r),style:{lineHeight:1},...a,children:s});function $P({children:e,className:t}){return l.jsx("div",{className:K("flex gap-[1px] items-center [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:rounded-l-none",t),children:e})}function ikn({version:e,date:t,isLatest:n,isDeleted:r}){return l.jsxs(lYe,{className:K("grid grid-cols-[1fr_auto] pl-1"),children:[l.jsxs("div",{className:K("grid text-neutral3 gap-1 leading-none",{"text-neutral4":n}),children:[l.jsxs("strong",{className:"font-normal",children:["v. ",e]}),l.jsx("em",{className:"text-neutral2 text-ui-sm font-normal",children:t?Gn(new Date(t),"MMM d, yyyy HH:mm"):null})]}),(n||r)&&l.jsxs("div",{className:"flex gap-1 items-center",children:[n&&l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx(Ar,{color:"blue",children:l.jsx(pv,{})})}),l.jsx($n,{children:"Latest version"})]}),r&&l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx(Ar,{color:"red",children:l.jsx(EX,{})})}),l.jsx($n,{children:"Deleted in this version"})]})]})]})}function lkn({id:e,className:t,isShortened:n=!0}){const r=n?e.slice(0,8):e;return l.jsx("div",{className:K("text-neutral2 py-[0.6rem] text-ui-md truncate",t),children:r})}function ckn({date:e,className:t,withTime:n=!1}){const r=e?htn(new Date(e)):!1,s=e?zC(new Date(e))?"Today":Gn(new Date(e),"MMM dd"):"",a=e&&!r?Gn(new Date(e),"yyyy"):"",o=e&&n?`${Gn(new Date(e),"'at' h:mm aaa")}`:"";return l.jsxs("div",{className:K("text-neutral2 text-ui-md truncate",t),children:[s," ",a," ",o]})}function ukn({children:e,href:t,className:n}){const{Link:r}=Gt();return l.jsx(r,{href:t,className:K("w-full px-3 py-[0.6rem] gap-6 text-left items-center rounded-lg flex justify-center","hover:bg-surface4",An.colors,Kg.visible,n),children:e})}function dkn({children:e,className:t}){return l.jsx("label",{className:K("flex w-14 h-full justify-center items-center hover:bg-surface5 rounded-lg",t),children:e})}const Ne=Object.assign(WOn,{Header:aYe,HeaderCol:ZOn,Items:oYe,Scroller:ekn,Row:iYe,RowButton:YOn,Message:XOn,NextPageLoading:KOn,Pagination:JOn,Cell:lYe,TextCell:tkn,StatusCell:rkn,VersionCell:ikn,IdCell:lkn,DateCell:ckn,LinkCell:ukn,LabelCell:dkn}),D_e=["75%","50%","65%","90%","60%","80%"];function fkn({columns:e,numberOfRows:t=3}){const n=(r,s)=>{const a=(r+s+(e?.length||0)+(t||0))%D_e.length;return D_e[a]};return l.jsx(oYe,{children:Array.from({length:t}).map((r,s)=>l.jsx(iYe,{columns:e,className:"py-4",children:(e||[]).map((a,o)=>{const i=`${a.name}-${o}`;return l.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-[1rem] select-none",style:{width:`${n(s,o)}`}},i)})},s))})}function Dh({columns:e,numberOfRows:t}){return l.jsxs(Ne,{children:[l.jsx(aYe,{columns:e}),l.jsx(fkn,{columns:e,numberOfRows:t})]})}function yE({name:e,helpText:t,errorMsg:n,required:r=!1,disabled:s=!1,size:a="default",value:o,label:i,labelIsHidden:c=!1,layout:u="vertical",placeholder:d="Search...",onChange:f,onReset:p,className:h}){return l.jsxs(so.Layout,{layout:u,className:h,children:[u==="horizontal"?l.jsx(so.Column,{children:l.jsx(so.Label,{name:e,required:r,children:c?l.jsx(Kl,{children:i}):i})}):null,l.jsxs(so.Column,{children:[u==="vertical"&&i&&!c?l.jsx(so.Label,{name:e,required:r,children:i}):null,l.jsxs("div",{className:"relative group",children:[l.jsx(vn,{name:e,disabled:s,value:o,placeholder:d,onChange:f,className:"pl-10"}),l.jsx(up,{"aria-hidden":"true",className:"text-neutral4 opacity-50 group-has-[:focus]:opacity-100 absolute top-2 left-3 w-5 h-5"}),p&&o&&l.jsx("button",{type:"button",onClick:p,className:K("absolute top-1/2 right-2 -translate-y-1/2 p-1 rounded",An.all,"hover:bg-surface4","[&>svg]:transition-colors [&>svg]:duration-normal","[&:hover>svg]:text-neutral5"),children:l.jsx(Pr,{className:"text-neutral3 w-[1rem] h-[1rem]"})})]}),t&&l.jsx(so.HelpText,{children:t}),n&&l.jsx(so.ErrorMsg,{children:n})]})]})}const Lh=({onSearch:e,label:t,placeholder:n,debounceMs:r=300})=>{const s=S.useId(),[a,o]=S.useState(""),i=vS(d=>{e(d)},r),c=S.useCallback(d=>{o(d.target.value),i(d.target.value)},[i]),u=S.useCallback(()=>{o(""),e(""),i.cancel()},[e,i]);return l.jsx(yE,{name:s,label:t,labelIsHidden:!0,placeholder:n,value:a,onChange:c,onReset:u,className:"w-full max-w-[30rem] "})};function pkn({children:e,className:t,withLeftSeparator:n,withRightSeparator:r}){return l.jsxs("div",{className:"flex overflow-y-auto w-full",children:[n&&l.jsx(L_e,{}),l.jsx("div",{className:K("grid gap-8 content-start w-full overflow-y-auto",t),children:e}),r&&l.jsx(L_e,{})]})}function L_e(){return l.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})}function hkn({children:e,className:t}){return l.jsx("div",{className:K("grid overflow-y-auto gap-8 content-start",t),children:e})}function mkn({children:e,className:t}){return l.jsx("div",{className:K("flex items-center w-full flex-wrap gap-4 gap-x-6",t),children:e})}const Yt=Object.assign(pkn,{Content:hkn,Toolbar:mkn});function eb({children:e,className:t}){return l.jsx("div",{className:K("grid w-full h-full grid-cols-1 overflow-y-auto",t),children:e})}function gkn({children:e,numOfColumns:t=1,minColumnWidth:n}){const r=S.useRef(null),[s,a]=S.useState(!1),[o,i]=S.useState(!1),c=S.useCallback(()=>{const f=r.current;if(!f)return;const{scrollLeft:p,scrollWidth:h,clientWidth:g}=f;a(p>1),i(p+g<h-1)},[]);S.useEffect(()=>{const f=r.current;if(!f)return;c(),f.addEventListener("scroll",c,{passive:!0});const p=new ResizeObserver(c);return p.observe(f),()=>{f.removeEventListener("scroll",c),p.disconnect()}},[c]);const u=S.useRef(t);S.useEffect(()=>{const f=r.current;f&&(t>u.current&&requestAnimationFrame(()=>{f.scrollTo({left:f.scrollWidth,behavior:"smooth"})}),u.current=t)},[t]),S.useEffect(()=>{const f=p=>{(p.key==="ArrowLeft"||p.key==="ArrowRight")&&(p.preventDefault(),d(p.key==="ArrowLeft"?"left":"right"))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]);const d=f=>{const p=r.current;if(!p)return;const h=Array.from(p.children),g=p.scrollLeft,b=g+p.clientWidth;if(f==="right"){const y=h.find(x=>x.offsetLeft+x.offsetWidth>b+1);y&&p.scrollTo({left:y.offsetLeft+y.offsetWidth-p.clientWidth,behavior:"smooth"})}else{const y=[...h].reverse().find(x=>x.offsetLeft<g-1);y&&p.scrollTo({left:y.offsetLeft,behavior:"smooth"})}};return l.jsxs("div",{className:K("MULTI_COLUMN relative w-full h-full overflow-hidden"),children:[s&&l.jsx(F_e,{direction:"left",onClick:()=>d("left")}),o&&l.jsx(F_e,{direction:"right",onClick:()=>d("right")}),l.jsx("div",{ref:r,className:"grid overflow-x-auto w-full overflow-y-auto h-full",style:{gridTemplateColumns:`repeat(${t}, minmax(${n??"0"}, 1fr))`},children:e})]})}function F_e({direction:e,onClick:t}){const n=e==="left"?UPe:xs,r=e==="left";return l.jsx("div",{className:K("absolute top-0 bottom-0 z-20 w-20 flex items-center justify-center px-5 bg-surface2",r?"left-0":"right-0"),children:l.jsx(me,{onClick:t,className:"w-full h-full px-0","aria-label":`Scroll ${e}`,children:l.jsx(n,{})})})}const bkn=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Hi,{iconSlot:l.jsx(Ah,{}),titleSlot:"No Workflows yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Mastra workflows are not configured yet. ",l.jsx("br",{})," More information in the documentation."]}),actionSlot:l.jsx("div",{className:"grid gap-3 justify-items-center",children:l.jsxs(me,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",children:["Workflows Documentation ",l.jsx(Si,{})]})})})}),z_e=[{name:"name",label:"Name & Description",size:"1fr"},{name:"steps",label:"Steps",size:"120px"}];function ykn({workflows:e,isLoading:t,error:n}){const[r,s]=S.useState(""),{navigate:a,paths:o}=Gt(),i=S.useMemo(()=>Object.keys(e??{}).map(u=>({id:u,...e[u]})),[e]),c=S.useMemo(()=>{const u=r.toLowerCase();return i.filter(d=>d.name.toLowerCase().includes(u)||d.description?.toLowerCase().includes(u))},[i,r]);return n&&ta(n)?l.jsx(Ya,{resource:"workflows"}):n?l.jsx(Mv,{title:"Failed to load workflows",message:n.message}):i.length===0&&!t?l.jsx(bkn,{}):l.jsxs(Yt,{children:[l.jsx(Yt.Toolbar,{children:l.jsx(Lh,{onSearch:s,label:"Filter workflows",placeholder:"Filter by name or description"})}),l.jsx(Yt.Content,{children:t?l.jsx(Dh,{columns:z_e}):l.jsx(Ne,{children:l.jsx(Ne.Items,{children:c.map(u=>{const d=Object.keys(u.steps??{}).length;return l.jsx(Ne.Row,{children:l.jsxs(Ne.RowButton,{columns:z_e,item:{id:u.id},onClick:()=>a(o.workflowLink(u.id)),className:"min-h-16",children:[l.jsxs(Ne.TextCell,{className:"grid",children:[l.jsx("span",{className:"text-neutral4 text-ui-md truncate",children:u.name}),u.description&&l.jsx("span",{className:"text-neutral2 text-ui-md truncate",children:u.description})]}),l.jsxs(Ne.Cell,{className:"text-neutral2 text-ui-sm flex gap-2 items-center",children:[l.jsx(Ar,{children:d})," step",d!==1?"s":""]})]})},u.id)})})})})]})}const cYe=({icon:e,title:t,isLoading:n,children:r})=>l.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[l.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[l.jsx(Te,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),n?l.jsx(cr,{className:"h-3 w-1/3"}):l.jsx("div",{className:"flex min-w-0 items-center gap-4",children:l.jsx(we,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),r&&l.jsx("div",{className:"pt-2",children:r})]}),jS=({children:e,defaultTab:t,value:n,onValueChange:r,className:s})=>{const[a,o]=S.useState(t),i=n!==void 0&&r!==void 0,c=i?n:a,u=d=>{const f=d;i?r(f):o(f)};return l.jsx(spt,{value:c,onValueChange:u,className:K("overflow-y-auto",s),children:e})},AS=({children:e,variant:t="default",className:n})=>l.jsx("div",{className:K("w-full overflow-x-auto",n),children:l.jsx(apt,{className:K("flex items-center relative",{"text-ui-lg":t==="default","[&>button]:py-2 [&>button]:px-6 [&>button]:font-normal [&>button]:text-neutral3 [&>button]:flex-1 [&>button]:border-b [&>button]:border-border1":t==="default",[`[&>button]:${An.colors} [&>button]:hover:text-neutral4`]:t==="default","[&>button[data-state=active]]:text-neutral5 [&>button[data-state=active]]:border-white/50":t==="default","border border-border1 flex justify-stretch rounded-md overflow-hidden text-ui-md min-h-[2.5rem]":t==="buttons",[`[&>button]:flex-1 [&>button]:py-2 [&>button]:px-4 [&>button]:text-neutral3 [&>button]:${An.all}`]:t==="buttons","[&>button]:hover:text-neutral4 [&>button]:hover:bg-surface3":t==="buttons","[&>button[data-state=active]]:text-neutral5 [&>button[data-state=active]]:bg-surface4 [&>button[data-state=active]]:shadow-inner":t==="buttons"},n),children:e})}),gi=({children:e,value:t,onClick:n,onClose:r,className:s})=>l.jsxs(opt,{value:t,className:K("text-sm p-3 text-neutral3 whitespace-nowrap flex-shrink-0 flex items-center justify-center gap-1.5",An.all,Kg.visible,"hover:text-neutral4","data-[state=active]:text-neutral5 data-[state=active]:border-b-2 data-[state=active]:border-white/50",s),onClick:n,children:[e,r&&l.jsx("button",{onClick:a=>{a.stopPropagation(),r()},className:K("p-0.5 hover:bg-surface4 rounded",An.colors,"hover:text-neutral5"),"aria-label":"Close tab",children:l.jsx(Pr,{className:"w-3 h-3"})})]}),fl=({children:e,value:t,className:n})=>l.jsx(ipt,{value:t,className:K("grid py-3 overflow-y-auto ring-offset-background",Kg.visible,n),children:e}),vkn=()=>{const{debugMode:e,setDebugMode:t}=S.useContext(vp);return l.jsxs(l.Fragment,{children:[l.jsx(we,{as:"h3",variant:"ui-md",className:"text-neutral3",children:"Debug Mode"}),l.jsx(lc,{checked:e,onCheckedChange:n=>t(n)})]})},uYe=()=>{const e=Jg(),{settings:t,setSettings:n,entityType:r}=Zre(),s=o=>{if(!o)return n({...t,tracingOptions:void 0});try{const i=JSON.parse(o);typeof i=="object"&&i!==null&&n({...t,tracingOptions:i})}catch{}};let a="{}";try{a=JSON.stringify(t?.tracingOptions,null,2)}catch{}return l.jsxs("div",{className:"space-y-2 px-5 py-2",children:[l.jsx(we,{as:"h3",variant:"ui-md",className:"text-neutral3",children:"Tracing Options"}),l.jsx(Xc,{value:a,onChange:s,theme:e,extensions:[Vc],className:"h-[400px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"}),r==="workflow"&&l.jsx(vkn,{})]})},xkn={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Tn({color:e,className:t,size:n="md"}){return l.jsx("svg",{className:K("animate-spin",xkn[n],t),style:{animationDuration:"800ms",animationTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)"},xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}function wkn({stepGraph:e,open:t,workflowName:n}){const{nodes:r,edges:s}=UZe({stepGraph:e}),[a,o]=S.useState(!1),[i,c,u]=bUe(r),[d]=yUe(s),{steps:f}=aT(),p=S.useMemo(()=>s.reduce((g,b)=>{if(b.data){const y=b.data.nextStepId,x=b.data.previousStepId;return{...g,[y]:[...new Set([...g[y]||[],x])]}}return g},{}),[s]),h={"default-node":g=>l.jsx(JZe,{parentWorkflowName:n,...g,stepsFlow:p}),"condition-node":XZe,"after-node":eYe,"loop-result-node":tYe,"nested-node":g=>l.jsx(nYe,{parentWorkflowName:n,...g,stepsFlow:p})};return S.useEffect(()=>{t&&setTimeout(()=>{o(!0)},500)},[t]),l.jsx("div",{className:"w-full h-full relative bg-surface1",children:a?l.jsxs(gUe,{nodes:i,edges:d.map(g=>({...g,style:{...g.style,stroke:f[`${n}.${g.data?.previousStepId}`]?.status==="success"&&f[`${n}.${g.data?.nextStepId}`]||g.data?.conditionNode&&!f[`${n}.${g.data?.previousStepId}`]&&f[`${n}.${g.data?.nextStepId}`]?.status?"#22c55e":void 0}})),fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.01,maxZoom:1,nodeTypes:h,onNodesChange:u,children:[l.jsx(nse,{position:"bottom-left"}),l.jsx(xUe,{variant:Hf.Lines,gap:12,size:.5})]}):l.jsx("div",{className:"w-full h-full flex items-center justify-center",children:l.jsx(Tn,{})})})}function Skn(){const{stepDetail:e,closeStepDetail:t}=T2();return e?l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border1 bg-surface1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[e.type==="map-config"&&l.jsx(G0,{className:"w-4 h-4",style:{color:ro.map}}),e.type==="nested-graph"&&l.jsx(yl,{className:"w-4 h-4",style:{color:ro.workflow}}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx(we,{variant:"ui-md",className:"text-neutral6 font-medium",children:e.type==="map-config"?`${e.stepName} Config`:`${e.stepName} Workflow`}),e.type==="map-config"&&e.stepId&&e.stepId!==e.stepName&&l.jsx(we,{variant:"ui-xs",className:"text-neutral3",children:e.stepId})]})]}),l.jsx("button",{onClick:t,className:"p-1 hover:bg-surface3 rounded transition-colors","aria-label":"Close",children:l.jsx(Pr,{className:"w-4 h-4 text-neutral3"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto",children:[e.type==="map-config"&&e.mapConfig&&l.jsx(Qx,{data:e.mapConfig}),e.type==="nested-graph"&&e.nestedGraph&&l.jsx("div",{className:"h-full min-h-[400px]",children:l.jsx(Hte,{children:l.jsx(wkn,{stepGraph:e.nestedGraph.stepGraph,open:!0,workflowName:e.nestedGraph.fullStep})},e.nestedGraph.fullStep)})]})]}):null}const R2=({requestContextSchema:e})=>{const{setSchemaValues:t,schemaValues:n}=ese(),r=JSON.stringify(n),s=S.useMemo(()=>{try{const a=jg(e);return Xd(Gd(a))}catch(a){return console.error("Failed to parse requestContextSchema:",a),null}},[e]);return s?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(we,{as:"span",variant:"ui-md",className:"text-neutral3",children:"Request Context"}),l.jsx(Zo,{content:r})]}),l.jsx(N2,{schema:s,onSubmit:t,submitButtonLabel:"Save",defaultValues:n})]}):l.jsx("div",{className:"text-neutral3",children:l.jsx(we,{variant:"ui-sm",children:"Failed to parse request context schema"})})};function Okn(){return S.useMemo(()=>{const e=typeof window<"u"?window.MASTRA_REQUEST_CONTEXT_PRESETS:void 0;if(!e||e==="%%MASTRA_REQUEST_CONTEXT_PRESETS%%")return null;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}catch{console.warn("Failed to parse request context presets")}return null},[])}function kkn({workflowId:e,initialRunId:t}){const{data:n,isLoading:r,error:s}=sT(e),{createWorkflowRun:a,streamWorkflow:o,streamResult:i,isStreamingWorkflow:c,observeWorkflowStream:u,closeStreamsAndReset:d,resumeWorkflow:f,cancelWorkflowRun:p,isCancellingWorkflowRun:h}=S.useContext(vp),{stepDetail:g,closeStepDetail:b}=T2(),[y,x]=S.useState("current-run"),[w,O]=S.useState(""),{handleCopy:_}=Zd({text:e}),C=Object.keys(n?.steps??{}).length,E=S.useMemo(()=>g?g.type==="map-config"?"Map Config":g.type==="nested-graph"?"Nested Workflow":"Node":null,[g]);S.useEffect(()=>{!w&&!t&&d()},[w,t]),S.useEffect(()=>{if(s){const N=s instanceof Error?s.message:"Failed to load workflow";qe.error(`Error loading workflow: ${N}`)}},[s]),S.useEffect(()=>{g?x("node-details"):y==="node-details"&&x("current-run")},[g]);const T=N=>{y==="node-details"&&N!=="node-details"&&b(),x(N)};return s?null:l.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full overflow-y-auto",children:[l.jsx(cYe,{icon:l.jsx(yl,{}),title:n?.name||"",isLoading:r,children:l.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[l.jsxs(zn,{children:[l.jsx(Bn,{asChild:!0,children:l.jsx("button",{onClick:_,className:"h-badge-default",children:l.jsx(_t,{icon:l.jsx(Li,{}),variant:"default",children:e})})}),l.jsx($n,{children:"Copy Workflow ID for use in code"})]}),l.jsxs(_t,{children:[C," step",C>1?"s":""]}),n?.isProcessorWorkflow&&l.jsx(_t,{icon:l.jsx(zk,{className:"h-3 w-3"}),className:"bg-violet-500/20 text-violet-400",children:"Processor"})]})}),l.jsx("div",{className:"flex-1 overflow-auto border-t border-border1 flex flex-col",children:l.jsxs(jS,{defaultTab:"current-run",value:y,onValueChange:T,className:"h-full",children:[l.jsxs(AS,{children:[l.jsx(gi,{value:"current-run",children:"Current Run"}),n?.requestContextSchema&&l.jsx(gi,{value:"request-context",children:"Request Context"}),l.jsx(gi,{value:"run-options",children:"Run Options"}),g&&E&&l.jsxs(gi,{value:"node-details",onClose:()=>{b(),x("current-run")},children:[E," Details"]})]}),l.jsx(fl,{value:"current-run",children:e?t?l.jsx(GOn,{workflowId:e,runId:t,setRunId:O,workflow:n??void 0,isLoading:r,createWorkflowRun:a,streamWorkflow:o,resumeWorkflow:f,streamResult:i,isStreamingWorkflow:c,isCancellingWorkflowRun:h,cancelWorkflowRun:p,observeWorkflowStream:u}):l.jsx(sYe,{workflowId:e,setRunId:O,workflow:n??void 0,isLoading:r,createWorkflowRun:a,streamWorkflow:o,resumeWorkflow:f,streamResult:i,isStreamingWorkflow:c,isCancellingWorkflowRun:h,cancelWorkflowRun:p}):null}),n?.requestContextSchema&&l.jsx(fl,{value:"request-context",children:l.jsx("div",{className:"p-5",children:l.jsx(R2,{requestContextSchema:n.requestContextSchema})})}),l.jsx(fl,{value:"run-options",children:l.jsx(uYe,{})}),g&&l.jsx(fl,{value:"node-details",children:l.jsx(Skn,{})})]})})]})}const Jn={root:"flex flex-col gap-1.5",trigger:"w-full min-w-32 justify-between",triggerError:"border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 opacity-50",placeholder:"text-neutral3",popup:K("min-w-[var(--anchor-width)] w-max max-w-[500px] rounded-md bg-surface3 text-neutral5","shadow-elevated","origin-[var(--transform-origin)]","transition-[transform,scale,opacity] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0"),positioner:"z-[100]",searchContainer:K("flex items-center border-b border-border1 px-3 py-2",An.colors),searchIcon:K("mr-2 h-4 w-4 shrink-0 text-neutral3",An.colors),searchInput:K("flex h-8 w-full rounded-md bg-transparent py-1 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-none",An.colors),empty:"[&:not(:empty)]:block hidden py-6 text-center text-sm text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:K("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm",An.colors,"data-[highlighted]:bg-surface5 data-[highlighted]:text-neutral5"),itemSelected:"data-[selected]:bg-accent1Dark data-[selected]:text-accent1",checkContainer:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:K("h-4 w-4 text-accent1",An.opacity),checkbox:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center rounded border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border1",checkboxIcon:"h-3 w-3 text-white",optionContent:"flex items-center gap-2 w-full min-w-0",optionText:"flex flex-col gap-0.5 min-w-0",optionLabel:"truncate",optionDescription:"text-xs text-neutral3 truncate",optionEnd:"ml-auto",error:"text-xs text-accent2"};function vl({options:e,value:t,onValueChange:n,placeholder:r="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:o,disabled:i=!1,variant:c="inputLike",size:u="default",open:d,onOpenChange:f,container:p,error:h}){const g=e.find(y=>y.value===t)??null,b=y=>{y&&n?.(y.value)};return l.jsxs("div",{className:Jn.root,children:[l.jsxs(zVe,{items:e,value:g,onValueChange:b,disabled:i,open:d,onOpenChange:f,children:[l.jsxs(GVe,{className:K(CS({variant:c,size:u}),Jn.trigger,h&&Jn.triggerError,o),children:[l.jsxs("span",{className:"truncate flex items-center gap-2",children:[g?.start,l.jsx(yin,{placeholder:r})]}),l.jsx(VPe,{className:Jn.chevron})]}),l.jsx(XVe,{container:p,children:l.jsx(JVe,{align:"start",sideOffset:4,className:Jn.positioner,children:l.jsxs(eQe,{className:Jn.popup,children:[l.jsxs("div",{className:Jn.searchContainer,children:[l.jsx(up,{className:Jn.searchIcon}),l.jsx(QVe,{className:Jn.searchInput,placeholder:s})]}),l.jsx(aQe,{className:Jn.empty,children:a}),l.jsx(ZVe,{className:Jn.list,children:y=>l.jsxs(sQe,{value:y,className:K(Jn.item,Jn.itemSelected),children:[l.jsx("span",{className:Jn.checkContainer,children:l.jsx(oln,{children:l.jsx(Es,{className:Jn.checkIcon})})}),l.jsxs("span",{className:Jn.optionContent,children:[y.start,l.jsxs("span",{className:Jn.optionText,children:[l.jsx("span",{className:Jn.optionLabel,children:y.label}),y.description&&l.jsx("span",{className:Jn.optionDescription,children:y.description})]}),y.end?l.jsx("div",{className:Jn.optionEnd,children:y.end}):null]})]},y.value)})]})})})]}),h&&l.jsx("span",{className:Jn.error,children:h})]})}function _kn({options:e,value:t=[],onValueChange:n,placeholder:r="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:o,disabled:i=!1,variant:c="default",size:u="md",open:d,onOpenChange:f,container:p,error:h}){const g=e.filter(x=>t.includes(x.value)),b=x=>{x&&n?.(x.map(w=>w.value))},y=g.length===0?r:`${g.length} selected`;return l.jsxs("div",{className:Jn.root,children:[l.jsxs(zVe,{multiple:!0,items:e,value:g,onValueChange:b,disabled:i,open:d,onOpenChange:f,children:[l.jsxs(GVe,{className:K(CS({variant:c,size:u}),Jn.trigger,h&&Jn.triggerError,o),children:[l.jsx("span",{className:K("truncate",g.length===0&&Jn.placeholder),children:y}),l.jsx(VPe,{className:Jn.chevron})]}),l.jsx(XVe,{container:p,children:l.jsx(JVe,{align:"start",sideOffset:4,className:Jn.positioner,children:l.jsxs(eQe,{className:Jn.popup,children:[l.jsxs("div",{className:Jn.searchContainer,children:[l.jsx(up,{className:Jn.searchIcon}),l.jsx(QVe,{className:Jn.searchInput,placeholder:s})]}),l.jsx(aQe,{className:Jn.empty,children:a}),l.jsx(ZVe,{className:Jn.list,children:x=>{const w=t.includes(x.value);return l.jsxs(sQe,{value:x,className:Jn.item,children:[l.jsx("span",{className:K(Jn.checkbox,w?Jn.checkboxSelected:Jn.checkboxUnselected),children:w&&l.jsx(Es,{className:Jn.checkboxIcon})}),l.jsxs("span",{className:Jn.optionContent,children:[x.start,l.jsxs("span",{className:Jn.optionText,children:[l.jsx("span",{className:Jn.optionLabel,children:x.label}),x.description&&l.jsx("span",{className:Jn.optionDescription,children:x.description})]}),x.end?l.jsx("div",{className:Jn.optionEnd,children:x.end}):null]})]},x.value)}})]})})})]}),h&&l.jsx("span",{className:Jn.error,children:h})]})}const Fh=()=>{const e=Xe(),{requestContext:t}=zr();return qt({queryKey:["workflows",t],queryFn:async()=>{const n=await e.listWorkflows(t),r=Object.entries(n).filter(([s,a])=>!a.isProcessorWorkflow);return r.sort(([,s],[,a])=>s.name.localeCompare(a.name)),Object.fromEntries(r)}})};function Ekn({value:e,onValueChange:t,placeholder:n="Select a workflow...",searchPlaceholder:r="Search workflows...",emptyText:s="No workflows found.",className:a,disabled:o=!1,variant:i="inputLike"}){const{data:c={},isLoading:u,isError:d,error:f}=Fh(),{navigate:p,paths:h}=Gt();S.useEffect(()=>{if(d){const y=f instanceof Error?f.message:"Failed to load workflows";qe.error(`Error loading workflows: ${y}`)}},[d,f]);const g=Object.keys(c).map(y=>({label:c[y]?.name||y,value:y})),b=y=>{t?t(y):y&&y!==e&&p(h.workflowLink(y))};return l.jsx(vl,{options:g,value:e,onValueChange:b,placeholder:u?"Loading workflows...":n,searchPlaceholder:r,emptyText:s,className:a,disabled:o||u||d,variant:i})}function jn({children:e,className:t,style:n}){const r=dYe("MainContentLayout");return l.jsx("main",{className:K("grid grid-rows-[auto_1fr] h-full items-start content-start",t),style:{...n,...r?{border:"3px dotted red"}:{}},children:e})}function xl({children:e,className:t,isCentered:n=!1,isDivided:r=!1,hasLeftServiceColumn:s=!1,style:a}){const o=dYe("MainContentContent"),i=sse({isCentered:n,isDivided:r,hasLeftServiceColumn:s,className:t});return l.jsx("div",{className:i,style:{...a,...o?{border:"3px dotted orange"}:{}},children:e})}const sse=({isCentered:e,isDivided:t,hasLeftServiceColumn:n,className:r})=>K("grid overflow-y-auto h-full ","overflow-x-auto min-w-[min-content]",{"items-start content-start":!e&&!t&&!n,"grid place-items-center":e,"grid-cols-[1fr_1fr]":t&&!n,"grid-cols-[12rem_1fr_1fr]":t&&n,"grid-cols-[auto_1fr]":!t&&n},r);function dYe(e){try{const t=localStorage.getItem("add-dev-style-to-components");return t?t.split(",").map(r=>r.trim()).filter(Boolean).includes(e):!1}catch(t){return console.error("Error reading or parsing localStorage:",t),!1}}const vE=()=>l.jsx(qln,{className:K("w-1.5 bg-surface3","[&[data-separator='hover']]:!bg-surface4","[&[data-separator='active']]:!bg-surface5","focus:outline-none")}),DP=({collapsedSize:e,children:t,direction:n,...r})=>{const[s,a]=S.useState(!1),o=Bln(),i=()=>{o.current&&o.current.expand()};return l.jsx(Y_,{panelRef:o,collapsedSize:e,...r,onResize:c=>{e&&typeof e=="number"&&(c.inPixels<=e?a(!0):s&&a(!1))},children:s?l.jsxs(zn,{children:[l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Bn,{asChild:!0,children:l.jsx(me,{onClick:i,className:"!h-48 border-none",children:l.jsx(Te,{children:n==="left"?l.jsx(qf,{}):l.jsx(eS,{})})})})}),l.jsx($n,{children:"Expand"})]}):t})},Ckn=({workflowId:e,children:t,leftSlot:n,rightSlot:r})=>{const{defaultLayout:s,onLayoutChange:a}=$ne({id:`workflow-layout-${e}`,storage:localStorage}),o=sse({isCentered:!1,isDivided:!0,hasLeftServiceColumn:!!n});return l.jsxs(Mne,{className:o,defaultLayout:s,onLayoutChange:a,children:[n&&l.jsxs(l.Fragment,{children:[l.jsx(DP,{direction:"left",id:"left-slot",minSize:200,maxSize:"30%",defaultSize:200,collapsedSize:60,collapsible:!0,children:n}),l.jsx(vE,{})]}),l.jsx(Y_,{id:"main-slot",children:t}),r&&l.jsxs(l.Fragment,{children:[l.jsx(vE,{}),l.jsx(DP,{direction:"right",id:"right-slot",minSize:300,maxSize:"50%",defaultSize:300,collapsedSize:60,collapsible:!0,children:r})]})]})},ase=()=>l.jsx(C2,{icon:l.jsx(Tn,{color:dMe.neutral3}),title:l.jsx(cr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),Tkn=({result:e,workflowId:t,isStreaming:n,metadata:r,toolCallId:s,toolApprovalMetadata:a,suspendPayload:o,toolName:i,isNetwork:c,toolCalled:u})=>{const{runId:d,status:f}=e||{},{data:p,isLoading:h}=sT(t),{data:g,isLoading:b}=DZe(t,{enabled:!!d&&!n}),y=g?.find(E=>E.runId===d),x=b||!y,w=typeof y?.snapshot=="object"?y?.snapshot:void 0,O=r?.mode==="network"?r.selectionReason:void 0,_=r?.mode==="network"?r.agentInput:void 0;let C=typeof o=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:o}):l.jsx(Vs,{data:o,"data-testid":"tool-suspend-payload"});return h||!p?l.jsx(ase,{}):l.jsxs(C2,{"data-testid":"workflow-badge",icon:l.jsx(yl,{className:"text-accent3"}),title:p.name,initialCollapsed:!1,extraInfo:r?.mode==="network"&&l.jsx(Wre,{selectionReason:O??"",input:_}),children:[!n&&!x&&l.jsx(Yre,{snapshot:w,workflowId:t,initialRunId:d,withoutTimeTravel:!0,children:l.jsx(B_e,{workflowId:t,workflow:p,runId:d})}),n&&l.jsx(B_e,{workflowId:t,workflow:p,runId:d}),C!==void 0&&o&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Workflow suspend payload"}),C]}),l.jsx(nT,{toolCalled:u??!!f,toolCallId:s,toolApprovalMetadata:a,toolName:i,isNetwork:c,isGenerateMode:r?.mode==="generate"})]})},B_e=({workflowId:e,workflow:t,runId:n})=>{const{Link:r}=Gt();return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[l.jsx(me,{as:r,href:`/workflows/${e}/graph`,children:"Go to workflow"}),n&&l.jsx(me,{as:r,href:`/workflows/${e}/graph/${n}`,children:"See run"})]}),l.jsx("div",{className:"rounded-md overflow-hidden h-[60vh] w-full",children:l.jsx(rYe,{workflowId:e,workflow:t})})]})},Nkn=e=>{const{setResult:t}=S.useContext(vp);S.useEffect(()=>{e&&t(e)},[e])},jkn=({agentId:e,messages:t=[],metadata:n,toolCallId:r,toolApprovalMetadata:s,toolName:a,isNetwork:o,suspendPayload:i,toolCalled:c,isComplete:u=!1})=>{const d=n?.mode==="network"?n.selectionReason:void 0,f=n?.mode==="network"?n.agentInput:void 0;let p=t.length>0;o&&(p=c??t.every(g=>g.type==="text"?!0:!!g.toolOutput));let h=typeof i=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:i}):l.jsx(Vs,{data:i,"data-testid":"tool-suspend-payload"});return l.jsxs(C2,{"data-testid":"agent-badge",icon:l.jsx($o,{className:"text-accent1"}),title:e,initialCollapsed:u,extraInfo:n?.mode==="network"&&l.jsx(Wre,{selectionReason:d??"",input:f}),children:[t.map((g,b)=>{if(g.type==="text")return l.jsx(_Ge,{children:g.content},b);let y;try{y=typeof g.toolOutput=="string"?JSON.parse(g.toolOutput):g.toolOutput}catch{y=g.toolOutput}return l.jsx(xe.Fragment,{children:l.jsx(bYe,{toolName:g.toolName,argsText:typeof g.args=="string"?g.args:JSON.stringify(g.args),result:y,args:g.args,status:{type:"complete"},type:"tool-call",toolCallId:g.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream"}})},b)}),h!==void 0&&i&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Agent suspend payload"}),h]}),l.jsx(nT,{toolCalled:p,toolCallId:r,toolApprovalMetadata:s,toolName:a,isNetwork:o,isGenerateMode:n?.mode==="generate"})]})},fYe=({threadId:e,agentId:t,memory:n})=>{const r=Xe(),{requestContext:s}=zr();return qt({queryKey:["memory","messages",e,t,"requestContext"],queryFn:async()=>e?await r.listThreadMessages(e,{agentId:t,requestContext:s}):null,enabled:n&&!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})},Akn=({agentId:e,result:t,metadata:n,toolCallId:r,toolApprovalMetadata:s,toolName:a,isNetwork:o,suspendPayload:i,toolCalled:c,isComplete:u})=>{const{data:d,isLoading:f}=fYe({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return l.jsx(ase,{});const p=d?.messages?kGe(d.messages):[],h=t?.childMessages??IVt(p);return l.jsx(jkn,{agentId:e,messages:h,metadata:n,toolCallId:r,toolApprovalMetadata:s,toolName:a,isNetwork:o,suspendPayload:i,toolCalled:c,isComplete:u})};function zw({children:e}){const t=e.replace(/\\n/g,`
|
|
439
439
|
`);return l.jsx(_Ge,{remarkPlugins:[O$e],components:Ikn,className:"space-y-3",children:t})}const pYe=xe.memo(({children:e,language:t,...n})=>{const[r,s]=S.useState([]);return S.useEffect(()=>{x1n(e,t).then(a=>{a&&s(a)})},[e,t]),r.length?l.jsx("pre",{...n,children:l.jsx("code",{children:r.map((a,o)=>l.jsxs(l.Fragment,{children:[l.jsx("span",{children:a.map((i,c)=>{const u=typeof i.htmlStyle=="string"?void 0:i.htmlStyle;return l.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:i.content},c)})},o),o!==r.length-1&&`
|
|
@@ -484,4 +484,4 @@ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}
|
|
|
484
484
|
`),c=a;c<i.length;c++){var u=i[c];if(!(u.length>1024)){var d=SCe.test(u)?u.replace(SCe,"$1"):u;if(!d.match(/\S*Error: /)){for(var f of n){var p=f(d,e);if(p){o.push(p);break}}if(o.length>=OCe)break}}}return(function(h){if(!h.length)return[];var g=Array.from(h);return g.reverse(),g.slice(0,OCe).map((b=>{return Xt({},b,{filename:b.filename||(y=g,y[y.length-1]||{}).filename,function:b.function||Uw});var y}))})(o)}}class z2n{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=Po(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return HP(t,"DOMException")}isDOMError(t){return HP(t,"DOMError")}}class B2n{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(t){return t.stacktrace||t.stack||void 0}}class U2n{constructor(){}match(t){return HP(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var r,s=n.apply(t.error);return s||{type:"ErrorEvent",value:t.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var q2n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class V2n{match(t){return typeof t=="string"}coerce(t,n){var r,[s,a]=this.getInfos(t);return{type:s??"Error",value:a??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,s=t.match(q2n);return s&&(n=s[1],r=s[2]),[n,r]}}var Q2n=["fatal","error","warning","log","info","debug"];function iet(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(!(s.length>t))return r===n.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class H2n{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,s=this.getErrorPropertyFromObject(t);return s?n.apply(s):{type:this.getType(t),value:this.getValue(t),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return aet(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+iet(t)}isSeverityLevel(t){return Po(t)&&!GZ(t)&&Q2n.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(N2n(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class G2n{match(t){return aet(t)}coerce(t,n){var r,s=t.constructor.name;return{type:s,value:s+" captured as exception with keys: "+iet(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class W2n{match(t){return WZ(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Z2n{match(t){return HP(t,"PromiseRejectionEvent")}coerce(t,n){var r,s=this.getUnhandledRejectionReason(t);return WZ(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}getUnhandledRejectionReason(t){if(WZ(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var cet=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k:function(s){if(Ge&&(eh.DEBUG||Hn.POSTHOG_DEBUG||n)&&!Rt(Ge.console)&&Ge.console){for(var a=("__rrweb_original__"in Ge.console[s])?Ge.console[s].__rrweb_original__:Ge.console[s],o=arguments.length,i=new Array(o>1?o-1:0),c=1;c<o;c++)i[c-1]=arguments[c];a(e,...i)}},info:function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];r.k("log",...a)},warn:function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];r.k("warn",...a)},error:function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];r.k("error",...a)},critical:function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];console.error(e,...a)},uninitializedWarning:s=>{r.error("You must initialize PostHog before calling "+s)},createLogger:(s,a)=>cet(e+" "+s,a)};return r},Ft=cet("[PostHog.js]"),Lo=Ft.createLogger,Y2n=Lo("[ExternalScriptsLoader]"),kCe=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Y2n.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=$t?.querySelectorAll("script");if(r){for(var s,a=function(){if(r[o].src===t){var c=r[o];return c.__posthog_loading_callback_fired?{v:n()}:(c.addEventListener("load",(u=>{c.__posthog_loading_callback_fired=!0,n(void 0,u)})),c.onerror=u=>n(u),{v:void 0})}},o=0;o<r.length;o++)if(s=a())return s.v}var i=()=>{if(!$t)return n("document not found");var c=$t.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=t,c.onload=f=>{c.__posthog_loading_callback_fired=!0,n(void 0,f)},c.onerror=f=>n(f),e.config.prepare_external_dependency_script&&(c=e.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");var u,d=$t.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(c,d[0]):$t.body.appendChild(c)};$t!=null&&$t.body?i():$t?.addEventListener("DOMContentLoaded",i)};Hn.__PosthogExtensions__=Hn.__PosthogExtensions__||{},Hn.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/"+t+".js?v="+e.version;if(t==="remote-config"&&(r="/array/"+e.config.token+"/config.js"),t==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var a=e.requestRouter.endpointFor("assets",r);kCe(e,a,n)},Hn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);kCe(e,r,n)};var GP={};function fg(e,t,n){if(Us(e)){if(mCe&&e.forEach===mCe)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(n,e[r],r)===GP)return}}}function ea(e,t,n){if(!Ps(e)){if(Us(e))return fg(e,t,n);if(k2n(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===GP)return}else for(var s in e)if(set.call(e,s)&&t.call(n,e[s],s)===GP)return}}var ao=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return fg(n,(function(s){for(var a in s)s[a]!==void 0&&(e[a]=s[a])})),e},MS=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return fg(n,(function(s){fg(s,(function(a){e.push(a)}))})),e};function vR(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var _Ce=function(e){try{return e()}catch{return}},X2n=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(s){Ft.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ft.critical(s)}}},Pse=function(e){var t={};return ea(e,(function(n,r){(Po(n)&&n.length>0||op(n))&&(t[r]=n)})),t};function K2n(e,t){return n=e,r=a=>Po(a)&&!Vh(t)?a.slice(0,t):a,s=new Set,(function a(o,i){return o!==Object(o)?r?r(o,i):o:s.has(o)?void 0:(s.add(o),Us(o)?(c=[],fg(o,(u=>{c.push(a(u))}))):(c={},ea(o,((u,d)=>{s.has(u)||(c[d]=a(u,d))}))),c);var c})(n);var n,r,s}var J2n=["herokuapp.com","vercel.app","netlify.app"];function e4n(e){var t=e?.hostname;if(!Po(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of J2n)if(n===r)return!1;return!0}function uet(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function vo(e,t,n,r){var{capture:s=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:s,passive:a})}var det="$people_distinct_id",DO="__alias",LO="__timers",ECe="$autocapture_disabled_server_side",YZ="$heatmaps_enabled_server_side",CCe="$exception_capture_enabled_server_side",XZ="$error_tracking_suppression_rules",TCe="$error_tracking_capture_extension_exceptions",NCe="$web_vitals_enabled_server_side",fet="$dead_clicks_enabled_server_side",jCe="$web_vitals_allowed_metrics",tQ="$session_recording_remote_config",WP="$sesid",pet="$session_is_sampled",d0="$enabled_feature_flags",FO="$early_access_features",KZ="$feature_flag_details",zO="$stored_person_properties",Vb="$stored_group_properties",JZ="$surveys",kA="$surveys_activated",ZP="$flag_call_reported",th="$user_state",eY="$client_session_props",tY="$capture_rate_limit",nY="$initial_campaign_params",rY="$initial_referrer_info",YP="$initial_person_info",XP="$epp",het="__POSTHOG_TOOLBAR__",lO="$posthog_cookieless",t4n=[det,DO,"__cmpns",LO,"$session_recording_enabled_server_side",YZ,WP,d0,XZ,th,FO,KZ,Vb,zO,JZ,ZP,eY,tY,nY,rY,XP,YP];function ACe(e){return e instanceof Element&&(e.id===het||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function e4(e){return!!e&&e.nodeType===1}function pg(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function met(e){return!!e&&e.nodeType===3}function get(e){return!!e&&e.nodeType===11}function Mse(e){return e?K2(e).split(/\s+/):[]}function RCe(e){var t=Ge?.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function KP(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Mse(t)}function bet(e){return Ps(e)?null:K2(e).split(/(\s+)/).filter((t=>CE(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function yT(e){var t="";return sY(e)&&!Oet(e)&&e.childNodes&&e.childNodes.length&&ea(e.childNodes,(function(n){var r;met(n)&&n.textContent&&(t+=(r=bet(n.textContent))!==null&&r!==void 0?r:"")})),K2(t)}function yet(e){return Rt(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var $se=["a","button","form","input","select","textarea","label"];function vet(e,t){if(Rt(t))return!0;var n,r=function(a){if(t.some((o=>a.matches(o))))return{v:!0}};for(var s of e)if(n=r(s))return n.v;return!1}function xet(e){var t=e.parentNode;return!(!t||!e4(t))&&t}var n4n=["next","previous","prev",">","<"],ICe=10,PCe=[".ph-no-rageclick",".ph-no-capture"];function r4n(e,t){if(!Ge||Dse(e))return!1;var n,r,s;if(dg(t)?(n=!!t&&PCe,r=void 0):(n=(s=t?.css_selector_ignorelist)!==null&&s!==void 0?s:PCe,r=t?.content_ignorelist),n===!1)return!1;var{targetElementList:a}=wet(e,!1);return!(function(o,i){if(o===!1||Rt(o))return!1;var c;if(o===!0)c=n4n;else{if(!Us(o))return!1;if(o.length>ICe)return Ft.error("[PostHog] content_ignorelist array cannot exceed "+ICe+" items. Use css_selector_ignorelist for more complex matching."),!1;c=o.map((u=>u.toLowerCase()))}return i.some((u=>{var{safeText:d,ariaLabel:f}=u;return c.some((p=>d.includes(p)||f.includes(p)))}))})(r,a.map((o=>{var i;return{safeText:yT(o).toLowerCase(),ariaLabel:((i=o.getAttribute("aria-label"))==null?void 0:i.toLowerCase().trim())||""}})))&&!vet(a,n)}var Dse=e=>!e||pg(e,"html")||!e4(e),wet=(e,t)=>{if(!Ge||Dse(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],s=e;s.parentNode&&!pg(s,"body");)if(get(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var a=xet(s);if(!a)break;if(t||$se.indexOf(a.tagName.toLowerCase())>-1)n=!0;else{var o=Ge.getComputedStyle(a);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(a),s=a}return{parentIsUsefulElement:n,targetElementList:r}};function s4n(e,t,n,r,s){var a,o,i,c;if(n===void 0&&(n=void 0),!Ge||Dse(e)||(a=n)!=null&&a.url_allowlist&&!RCe(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&RCe(n.url_ignorelist))return!1;if((i=n)!=null&&i.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some((g=>t.type===g)))return!1}var{parentIsUsefulElement:d,targetElementList:f}=wet(e,r);if(!(function(g,b){var y=b?.element_allowlist;if(Rt(y))return!0;var x,w=function(_){if(y.some((C=>_.tagName.toLowerCase()===C)))return{v:!0}};for(var O of g)if(x=w(O))return x.v;return!1})(f,n)||!vet(f,(c=n)==null?void 0:c.css_selector_allowlist))return!1;var p=Ge.getComputedStyle(e);if(p&&p.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return d?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&($se.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function sY(e){for(var t=e;t.parentNode&&!pg(t,"body");t=t.parentNode){var n=KP(t);if(kr(n,"ph-sensitive")||kr(n,"ph-no-capture"))return!1}if(kr(KP(e),"ph-include"))return!0;var r=e.type||"";if(Po(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!(Po(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Oet(e){return!!(pg(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||pg(e,"select")||pg(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ket="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",a4n=new RegExp("^(?:"+ket+")$"),o4n=new RegExp(ket),_et="\\d{3}-?\\d{2}-?\\d{4}",i4n=new RegExp("^("+_et+")$"),l4n=new RegExp("("+_et+")");function CE(e,t){return t===void 0&&(t=!0),!(Ps(e)||Po(e)&&(e=K2(e),(t?a4n:o4n).test((e||"").replace(/[- ]/g,""))||(t?i4n:l4n).test(e)))}function Eet(e){var t=yT(e);return CE(t=(t+" "+Cet(e)).trim())?t:""}function Cet(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ea(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=yT(n);t=(t+" "+s).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+Cet(n)).trim())}catch(a){Ft.error("[AutoCapture]",a)}})),t}function c4n(e){return(function(t){var n=t.map((r=>{var s,a,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var i of(r.attr_class.sort(),r.attr_class))o+="."+i.replace(/"/g,"");var c=Xt({},r.text?{text:r.text}:{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(a=r.nth_of_type)!==null&&a!==void 0?a:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return vR(c).sort(((d,f)=>{var[p]=d,[h]=f;return p.localeCompare(h)})).forEach((d=>{var[f,p]=d;return u[MCe(f.toString())]=MCe(p.toString())})),o+=":",o+=vR(u).map((d=>{var[f,p]=d;return f+'="'+p+'"'})).join("")}));return n.join(";")})((function(t){return t.map((n=>{var r,s,a={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(s=n.attr__href)==null?void 0:s.slice(0,2048),attr_class:u4n(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return vR(n).filter((o=>{var[i]=o;return i.indexOf("attr__")===0})).forEach((o=>{var[i,c]=o;return a.attributes[i]=c})),a}))})(e))}function MCe(e){return e.replace(/"|\\"/g,'\\"')}function u4n(e){var t=e.attr__class;return t?Us(t)?t:Mse(t):void 0}class Tet{constructor(t){this.disabled=t===!1;var n=Qo(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(n-s.y)<this.thresholdPx&&r-s.timestamp<this.timeoutMs){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var nQ="$copy_autocapture",lh=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),JP=e=>{var t=$t?.createElement("a");return Rt(t)?null:(t.href=e,t)},d4n=function(e,t){var n,r;t===void 0&&(t="&");var s=[];return ea(e,(function(a,o){Rt(a)||Rt(o)||o==="undefined"||(n=encodeURIComponent((i=>i instanceof File)(a)?a.name:a.toString()),r=encodeURIComponent(o),s[s.length]=r+"="+n)})),s.join(t)},eM=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var a=r[s].split("=");if(a[0]===t){n=a;break}}if(!Us(n)||n.length<2)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{Ft.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},vT=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",a=r[1],o=s.split("?"),i=o[1],c=o[0],u=(i||"").split("&"),d=[],f=0;f<u.length;f++){var p=u[f].split("=");Us(p)&&(t.includes(p[0])?d.push(p[0]+"="+n):d.push(u[f]))}var h=c;return i!=null&&(h+="?"+d.join("&")),a!=null&&(h+="#"+a),h},tM=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},$Ce=Lo("[AutoCapture]");function rQ(e,t){return t.length>e?t.slice(0,e)+"...":t}function f4n(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!e4(t));return t}function p4n(e,t,n,r){var s=e.tagName.toLowerCase(),a={tag_name:s};$se.indexOf(s)>-1&&!n&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?a.$el_text=rQ(1024,Eet(e)):a.$el_text=rQ(1024,yT(e)));var o=KP(e);o.length>0&&(a.classes=o.filter((function(d){return d!==""}))),ea(e.attributes,(function(d){var f;if((!Oet(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!t&&CE(d.value)&&(f=d.name,!Po(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=Mse(p).join(" ")),a["attr__"+d.name]=rQ(1024,p)}}));for(var i=1,c=1,u=e;u=f4n(u);)i++,u.tagName===e.tagName&&c++;return a.nth_child=i,a.nth_of_type=c,a}function h4n(e,t){for(var n,r,{e:s,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!pg(d,"body");)get(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],h={},g=!1,b=!1;if(ea(u,(_=>{var C=sY(_);_.tagName.toLowerCase()==="a"&&(g=_.getAttribute("href"),g=C&&g&&CE(g)&&g),kr(KP(_),"ph-no-capture")&&(b=!0),p.push(p4n(_,a,o,i));var E=(function(T){if(!sY(T))return{};var N={};return ea(T.attributes,(function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),P=A.value;I&&P&&CE(P)&&(N[I]=P)}})),N})(_);ao(h,E)})),b)return{props:{},explicitNoCapture:b};if(o||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=Eet(e):p[0].$el_text=yT(e)),g){var y,x;p[0].attr__href=g;var w=(y=JP(g))==null?void 0:y.host,O=Ge==null||(x=Ge.location)==null?void 0:x.host;w&&O&&w!==O&&(f=g)}return{props:ao({$event_type:s.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:c4n(p)},(n=p[0])!=null&&n.$el_text?{$el_text:(r=p[0])==null?void 0:r.$el_text}:{},f&&s.type==="click"?{$external_click_url:f}:{},h)}}class m4n{constructor(t){this.P=!1,this.T=null,this.R=!1,this.instance=t,this.rageclicks=new Tet(t.config.rageclick),this.I=null}get F(){var t,n,r=Qo(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map((s=>new RegExp(s))),r.url_ignorelist=(n=r.url_ignorelist)==null?void 0:n.map((s=>new RegExp(s))),r}C(){if(this.isBrowserSupported()){if(Ge&&$t){var t=r=>{r=r||Ge?.event;try{this.M(r)}catch(s){$Ce.error("Failed to capture event",s)}};if(vo($t,"submit",t,{capture:!0}),vo($t,"change",t,{capture:!0}),vo($t,"click",t,{capture:!0}),this.F.capture_copied_text){var n=r=>{r=r||Ge?.event,this.M(r,nQ)};vo($t,"copy",n,{capture:!0}),vo($t,"cut",n,{capture:!0})}}}else $Ce.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.C(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.R=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ECe]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.I=t}getElementSelectors(t){var n,r=[];return(n=this.I)==null||n.forEach((s=>{var a=$t?.querySelectorAll(s);a?.forEach((o=>{t===o&&r.push(s)}))})),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)==null?void 0:t.props[ECe],s=this.T;if(Vh(s)&&!dg(r)&&!this.instance.O())return!1;var a=(n=this.T)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!a}M(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r,s=yet(t);met(s)&&(s=s.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&r4n(s,this.instance.config.rageclick)&&this.M(t,"$rageclick");var a=n===nQ;if(s&&s4n(s,t,this.F,a,a?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:i}=h4n(s,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.F.element_attribute_ignorelist,elementsChainAsString:this.R});if(i)return!1;var c=this.getElementSelectors(s);if(c&&c.length>0&&(o.$element_selectors=c),n===nQ){var u,d=bet(Ge==null||(u=Ge.getSelection())==null?void 0:u.toString()),f=t.type||"clipboard";if(!d)return!1;o.$selected_content=d,o.$copy_type=f}return this.instance.capture(n,o),!0}}}isBrowserSupported(){return ug($t?.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return op(e)&&isFinite(e)&&Math.floor(e)===e});var DCe="0123456789abcdef";class nM{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,s){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||t<0||n<0||r<0||s<0||t>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=t/Math.pow(2,40),a[1]=t/Math.pow(2,32),a[2]=t/Math.pow(2,24),a[3]=t/Math.pow(2,16),a[4]=t/Math.pow(2,8),a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=s>>>24,a[13]=s>>>16,a[14]=s>>>8,a[15]=s,new nM(a)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+DCe.charAt(this.bytes[n]>>>4)+DCe.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new nM(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class g4n{constructor(){this.A=0,this.D=0,this.j=new b4n}generate(){var t=this.generateOrAbort();if(Rt(t)){this.A=0;var n=this.generateOrAbort();if(Rt(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return nM.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var LCe,Net=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Ge&&!Rt(Ge.crypto)&&crypto.getRandomValues&&(Net=e=>crypto.getRandomValues(e));class b4n{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Net(this.N),this.U=0),this.N[this.U++]}}var Km=()=>y4n().toString(),y4n=()=>(LCe||(LCe=new g4n)).generate(),cO="",v4n=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function x4n(e,t){if(t){var n=(function(s,a){if(a===void 0&&(a=$t),cO)return cO;if(!a||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),i=Math.min(o.length,8),c="dmn_chk_"+Km();!cO&&i--;){var u=o.slice(i).join("."),d=c+"=1;domain=."+u+";path=/";a.cookie=d+";max-age=3",a.cookie.includes(c)&&(a.cookie=d+";max-age=0",cO=u)}return cO})(e);if(!n){var r=(s=>{var a=s.match(v4n);return a?a[0]:""})(e);r!==n&&Ft.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Zf={H:()=>!!$t,B:function(e){Ft.error("cookieStore error: "+e)},q:function(e){if($t){try{for(var t=e+"=",n=$t.cookie.split(";").filter((a=>a.length)),r=0;r<n.length;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}},W:function(e){var t;try{t=JSON.parse(Zf.q(e))||{}}catch{}return t},G:function(e,t,n,r,s){if($t)try{var a="",o="",i=x4n($t.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),a="; expires="+c.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+a+"; SameSite=Lax; path=/"+i+o;return u.length>3686.4&&Ft.warn("cookieStore warning: large cookie, len="+u.length),$t.cookie=u,u}catch{return}},V:function(e,t){if($t!=null&&$t.cookie)try{Zf.G(e,"",-1,t)}catch{return}}},sQ=null,Aa={H:function(){if(!Vh(sQ))return sQ;var e=!0;if(Rt(Ge))e=!1;else try{var t="__mplssupport__";Aa.G(t,"xyz"),Aa.q(t)!=='"xyz"'&&(e=!1),Aa.V(t)}catch{e=!1}return e||Ft.error("localStorage unsupported; falling back to cookie store"),sQ=e,e},B:function(e){Ft.error("localStorage error: "+e)},q:function(e){try{return Ge?.localStorage.getItem(e)}catch(t){Aa.B(t)}return null},W:function(e){try{return JSON.parse(Aa.q(e))||{}}catch{}return null},G:function(e,t){try{Ge?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Aa.B(n)}},V:function(e){try{Ge?.localStorage.removeItem(e)}catch(t){Aa.B(t)}}},w4n=["distinct_id",WP,pet,XP,YP],_A=Xt({},Aa,{W:function(e){try{var t={};try{t=Zf.W(e)||{}}catch{}var n=ao(t,JSON.parse(Aa.q(e)||"{}"));return Aa.G(e,n),n}catch{}return null},G:function(e,t,n,r,s,a){try{Aa.G(e,t,void 0,void 0,a);var o={};w4n.forEach((i=>{t[i]&&(o[i]=t[i])})),Object.keys(o).length&&Zf.G(e,o,n,r,s,a)}catch(i){Aa.B(i)}},V:function(e,t){try{Ge?.localStorage.removeItem(e),Zf.V(e,t)}catch(n){Aa.B(n)}}}),EA={},S4n={H:function(){return!0},B:function(e){Ft.error("memoryStorage error: "+e)},q:function(e){return EA[e]||null},W:function(e){return EA[e]||null},G:function(e,t){EA[e]=t},V:function(e){delete EA[e]}},$b=null,fi={H:function(){if(!Vh($b))return $b;if($b=!0,Rt(Ge))$b=!1;else try{var e="__support__";fi.G(e,"xyz"),fi.q(e)!=='"xyz"'&&($b=!1),fi.V(e)}catch{$b=!1}return $b},B:function(e){Ft.error("sessionStorage error: ",e)},q:function(e){try{return Ge?.sessionStorage.getItem(e)}catch(t){fi.B(t)}return null},W:function(e){try{return JSON.parse(fi.q(e))||null}catch{}return null},G:function(e,t){try{Ge?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){fi.B(n)}},V:function(e){try{Ge?.sessionStorage.removeItem(e)}catch(t){fi.B(t)}}},nh=(function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e})({});class O4n{constructor(t){this._instance=t}get F(){return this._instance.config}get consent(){return this.J()?nh.DENIED:this.K}isOptedOut(){return this.F.cookieless_mode==="always"||this.consent===nh.DENIED||this.consent===nh.PENDING&&(this.F.opt_out_capturing_by_default||this.F.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===nh.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.F.cookie_expiration,this.F.cross_subdomain_cookie,this.F.secure_cookie)}reset(){this.Y.V(this.X,this.F.cross_subdomain_cookie)}get X(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+t:"__ph_opt_in_out_"+t)}get K(){var t=this.Y.q(this.X);return JV(t)?nh.GRANTED:kr(C2n,t)?nh.DENIED:nh.PENDING}get Y(){if(!this.Z){var t=this.F.opt_out_capturing_persistence_type;this.Z=t==="localStorage"?Aa:Zf;var n=t==="localStorage"?Zf:Aa;n.q(this.X)&&(this.Z.q(this.X)||this.optInOut(JV(n.q(this.X))),n.V(this.X,this.F.cross_subdomain_cookie))}return this.Z}J(){return!!this.F.respect_dnt&&!!uet([Bc?.doNotTrack,Bc?.msDoNotTrack,Hn.doNotTrack],(t=>JV(t)))}}var CA=Lo("[Dead Clicks]"),k4n=()=>!0,_4n=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(fet)),r=e.instance.config.capture_dead_clicks;return dg(r)?r:!!Qo(r)||n};class jet{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[fet]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var n,r;(n=Hn.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&t(),(r=Hn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?CA.error("failed to load script",s):t()}))}et(){var t;if($t){if(!this.tt&&(t=Hn.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Qo(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.tt=Hn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.tt.start($t),CA.info("starting...")}}else CA.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,CA.info("stopping..."))}}var uO=Lo("[ExceptionAutocapture]");class E4n{constructor(t){var n,r,s;this.rt=()=>{var a;if(Ge&&this.isEnabled&&(a=Hn.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var o=Hn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Hn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Hn.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.F.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.F.capture_unhandled_rejections&&(this.nt=i(this.captureException.bind(this))),!this.ot&&this.F.capture_console_errors&&(this.ot=c(this.captureException.bind(this)))}catch(u){uO.error("failed to start",u),this.lt()}}},this._instance=t,this.ut=!((n=this._instance.persistence)==null||!n.props[CCe]),this.F=this.ht(),this.vt=new T2n({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:uO}),this.startIfEnabled()}ht(){var t=this._instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Qo(t)?n=Xt({},n,t):(Rt(t)?this.ut:t)&&(n=Xt({},n,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.F.capture_console_errors||this.F.capture_unhandled_errors||this.F.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(uO.info("enabled"),this.it(this.rt))}it(t){var n,r;(n=Hn.__PosthogExtensions__)!=null&&n.errorWrappingFunctions&&t(),(r=Hn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return uO.error("failed to load script",s);t()}))}lt(){var t,n,r;(t=this.st)==null||t.call(this),this.st=void 0,(n=this.nt)==null||n.call(this),this.nt=void 0,(r=this.ot)==null||r.call(this),this.ot=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.ut=!!n||!1,this.F=this.ht(),this._instance.persistence&&this._instance.persistence.register({[CCe]:this.ut}),this.startIfEnabled()}captureException(t){var n,r,s=(n=t==null||(r=t.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&n!==void 0?n:"Exception";this.vt.consumeRateLimit(s)?uO.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(t)}}function FCe(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],s=n(r);return ug(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch{return()=>{}}}class C4n{constructor(t){var n;this._instance=t,this.dt=(Ge==null||(n=Ge.location)==null?void 0:n.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Ft.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,Ft.info("History API monitoring stopped")}monitorHistoryChanges(){var t,n;if(Ge&&Ge.history){var r=this;(t=Ge.history.pushState)!=null&&t.__posthog_wrapped__||FCe(Ge.history,"pushState",(s=>function(a,o,i){s.call(this,a,o,i),r.ft("pushState")})),(n=Ge.history.replaceState)!=null&&n.__posthog_wrapped__||FCe(Ge.history,"replaceState",(s=>function(a,o,i){s.call(this,a,o,i),r.ft("replaceState")})),this.gt()}}ft(t){try{var n,r=Ge==null||(n=Ge.location)==null?void 0:n.pathname;if(!r)return;r!==this.dt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.dt=r}catch(s){Ft.error("Error capturing "+t+" pageview",s)}}gt(){if(!this.ct){var t=()=>{this.ft("popstate")};vo(Ge,"popstate",t),this.ct=()=>{Ge&&Ge.removeEventListener("popstate",t)}}}}var aQ=Lo("[SegmentIntegration]");function T4n(e,t){var n=e.config.segment;if(!n)return t();(function(r,s){var a=r.config.segment;if(!a)return s();var o=c=>{var u=()=>c.anonymousId()||Km();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(th,"identified")),s()},i=a.user();"then"in i&&ug(i.then)?i.then((c=>o(c))):o(i)})(e,(()=>{n.register((r=>{Promise&&Promise.resolve||aQ.warn("This browser does not have Promise support, and can not use the segment integration");var s=(a,o)=>{if(!o)return a;a.event.userId||a.event.anonymousId===r.get_distinct_id()||(aQ.info("No userId set, resetting PostHog"),r.reset()),a.event.userId&&a.event.userId!==r.get_distinct_id()&&(aQ.info("UserId set, identifying with PostHog"),r.identify(a.event.userId));var i=r.calculateEventProperties(o,a.event.properties);return a.event.properties=Object.assign({},i,a.event.properties),a};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:a=>s(a,a.event.event),page:a=>s(a,"$pageview"),identify:a=>s(a,"$identify"),screen:a=>s(a,"$screen")}})(e)).then((()=>{t()}))}))}var Aet="posthog-js";function Ret(e,t){var{organization:n,projectId:r,prefix:s,severityAllowList:a=["error"],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return i=>{var c,u,d,f,p;if(!(a==="*"||a.includes(i.level))||!e.__loaded)return i;i.tags||(i.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());i.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=((c=i.exception)==null?void 0:c.values)||[],b=g.map((x=>Xt({},x,{stacktrace:x.stacktrace?Xt({},x.stacktrace,{type:"raw",frames:(x.stacktrace.frames||[]).map((w=>Xt({},w,{platform:"web:javascript"})))}):void 0}))),y={$exception_message:((u=g[0])==null?void 0:u.value)||i.message,$exception_type:(d=g[0])==null?void 0:d.type,$exception_level:i.level,$exception_list:b,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((f=g[0])==null?void 0:f.value)||i.message,$sentry_exception_type:(p=g[0])==null?void 0:p.type,$sentry_tags:i.tags};return n&&r&&(y.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+i.event_id),o&&e.exceptions.sendExceptionEvent(y),i}}class N4n{constructor(t,n,r,s,a,o){this.name=Aet,this.setupOnce=function(i){i(Ret(t,{organization:n,projectId:r,prefix:s,severityAllowList:a,sendExceptionsToPostHog:o==null||o}))}}}var j4n=Ge!=null&&Ge.location?tM(Ge.location.hash,"__posthog")||tM(location.hash,"state"):null,zCe="_postHogToolbarParams",BCe=Lo("[Toolbar]"),Pm=(function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e})(Pm||{});class A4n{constructor(t){this.instance=t}_t(t){Hn.ph_toolbar_state=t}yt(){var t;return(t=Hn.ph_toolbar_state)!==null&&t!==void 0?t:Pm.UNINITIALIZED}maybeLoadToolbar(t,n,r){if(t===void 0&&(t=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),!Ge||!$t)return!1;t=t??Ge.location,r=r??Ge.history;try{if(!n){try{Ge.localStorage.setItem("test","test"),Ge.localStorage.removeItem("test")}catch{return!1}n=Ge?.localStorage}var s,a=j4n||tM(t.hash,"__posthog")||tM(t.hash,"state"),o=a?_Ce((()=>JSON.parse(atob(decodeURIComponent(a)))))||_Ce((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((s=o).source="url",s&&Object.keys(s).length>0&&(o.desiredHash?t.hash=o.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((s=JSON.parse(n.getItem(zCe)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}bt(t){var n=Hn.ph_load_toolbar||Hn.ph_load_editor;!Ps(n)&&ug(n)?n(t,this.instance):BCe.warn("No toolbar load function found")}loadToolbar(t){var n=!($t==null||!$t.getElementById(het));if(!Ge||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=Xt({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Ge.localStorage.setItem(zCe,JSON.stringify(Xt({},s,{source:void 0}))),this.yt()===Pm.LOADED)this.bt(s);else if(this.yt()===Pm.UNINITIALIZED){var a;this._t(Pm.LOADING),(a=Hn.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return BCe.error("[Toolbar] Failed to load",o),void this._t(Pm.UNINITIALIZED);this._t(Pm.LOADED),this.bt(s)})),vo(Ge,"turbolinks:load",(()=>{this._t(Pm.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(t){return this.loadToolbar(t)}maybeLoadEditor(t,n,r){return t===void 0&&(t=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,n,r)}}var R4n=Lo("[TracingHeaders]");class I4n{constructor(t){this.xt=void 0,this.St=void 0,this.rt=()=>{var n,r;Rt(this.xt)&&((n=Hn.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Rt(this.St)&&((r=Hn.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var n,r;(n=Hn.__PosthogExtensions__)!=null&&n.tracingHeadersPatchFns&&t(),(r=Hn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return R4n.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var t,n;this._instance.config.__add_tracing_headers?this.it(this.rt):((t=this.xt)==null||t.call(this),(n=this.St)==null||n.call(this),this.xt=void 0,this.St=void 0)}}var Qu="Mobile",rM="iOS",Bf="Android",TE="Tablet",Iet=Bf+" "+TE,Pet="iPad",Met="Apple",$et=Met+" Watch",NE="Safari",qw="BlackBerry",Det="Samsung",Let=Det+"Browser",Fet=Det+" Internet",sv="Chrome",P4n=sv+" OS",zet=sv+" "+rM,Lse="Internet Explorer",Bet=Lse+" "+Qu,Fse="Opera",M4n=Fse+" Mini",zse="Edge",Uet="Microsoft "+zse,z0="Firefox",qet=z0+" "+rM,jE="Nintendo",AE="PlayStation",B0="Xbox",Vet=Bf+" "+Qu,Qet=Qu+" "+NE,BO="Windows",aY=BO+" Phone",UCe="Nokia",oY="Ouya",Het="Generic",$4n=Het+" "+Qu.toLowerCase(),Get=Het+" "+TE.toLowerCase(),iY="Konqueror",rl="(\\d+(\\.\\d+)?)",oQ=new RegExp("Version/"+rl),D4n=new RegExp(B0,"i"),L4n=new RegExp(AE+" \\w+","i"),F4n=new RegExp(jE+" \\w+","i"),Bse=new RegExp(qw+"|PlayBook|BB10","i"),z4n={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},B4n=(e,t)=>t&&kr(t,Met)||(function(n){return kr(n,NE)&&!kr(n,sv)&&!kr(n,Bf)})(e),Wet=function(e,t){return t=t||"",kr(e," OPR/")&&kr(e,"Mini")?M4n:kr(e," OPR/")?Fse:Bse.test(e)?qw:kr(e,"IE"+Qu)||kr(e,"WPDesktop")?Bet:kr(e,Let)?Fet:kr(e,zse)||kr(e,"Edg/")?Uet:kr(e,"FBIOS")?"Facebook "+Qu:kr(e,"UCWEB")||kr(e,"UCBrowser")?"UC Browser":kr(e,"CriOS")?zet:kr(e,"CrMo")||kr(e,sv)?sv:kr(e,Bf)&&kr(e,NE)?Vet:kr(e,"FxiOS")?qet:kr(e.toLowerCase(),iY.toLowerCase())?iY:B4n(e,t)?kr(e,Qu)?Qet:NE:kr(e,z0)?z0:kr(e,"MSIE")||kr(e,"Trident/")?Lse:kr(e,"Gecko")?z0:""},U4n={[Bet]:[new RegExp("rv:"+rl)],[Uet]:[new RegExp(zse+"?\\/"+rl)],[sv]:[new RegExp("("+sv+"|CrMo)\\/"+rl)],[zet]:[new RegExp("CriOS\\/"+rl)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+rl)],[NE]:[oQ],[Qet]:[oQ],[Fse]:[new RegExp("(Opera|OPR)\\/"+rl)],[z0]:[new RegExp(z0+"\\/"+rl)],[qet]:[new RegExp("FxiOS\\/"+rl)],[iY]:[new RegExp("Konqueror[:/]?"+rl,"i")],[qw]:[new RegExp(qw+" "+rl),oQ],[Vet]:[new RegExp("android\\s"+rl,"i")],[Fet]:[new RegExp(Let+"\\/"+rl)],[Lse]:[new RegExp("(rv:|MSIE )"+rl)],Mozilla:[new RegExp("rv:"+rl)]},q4n=function(e,t){var n=Wet(e,t),r=U4n[n];if(Rt(r))return null;for(var s=0;s<r.length;s++){var a=r[s],o=e.match(a);if(o)return parseFloat(o[o.length-2])}return null},qCe=[[new RegExp(B0+"; "+B0+" (.*?)[);]","i"),e=>[B0,e&&e[1]||""]],[new RegExp(jE,"i"),[jE,""]],[new RegExp(AE,"i"),[AE,""]],[Bse,[qw,""]],[new RegExp(BO,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[aY,""];if(new RegExp(Qu).test(t)&&!/IEMobile\b/.test(t))return[BO+" "+Qu,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],s=z4n[r]||"";return/arm/i.test(t)&&(s="RT"),[BO,s]}return[BO,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[rM,t.join(".")]}return[rM,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Rt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Bf+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Bf+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Bf,t.join(".")]}return[Bf,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[P4n,""]],[/Linux|debian/i,["Linux",""]]],VCe=function(e){return F4n.test(e)?jE:L4n.test(e)?AE:D4n.test(e)?B0:new RegExp(oY,"i").test(e)?oY:new RegExp("("+aY+"|WPDesktop)","i").test(e)?aY:/iPad/.test(e)?Pet:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?$et:Bse.test(e)?qw:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(UCe,"i").test(e)?UCe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(Qu).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Bf:Iet:Bf:new RegExp("(pda|"+Qu+")","i").test(e)?$4n:new RegExp(TE,"i").test(e)&&!new RegExp(TE+" pc","i").test(e)?Get:""},TA="https?://(.*)",$S=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],V4n=MS(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],$S),xT="<masked>",Q4n=["li_fat_id"];function Zet(e,t,n){if(!$t)return{};var r,s=t?MS([],$S,n||[]):[],a=Yet(vT($t.URL,s,xT),e),o=(r={},ea(Q4n,(function(i){var c=Zf.q(i);r[i]=c||null})),r);return ao(o,a)}function Yet(e,t){var n=V4n.concat(t||[]),r={};return ea(n,(function(s){var a=eM(e,s);r[s]=a||null})),r}function Xet(e){var t=(function(a){return a?a.search(TA+"google.([^/?]*)")===0?"google":a.search(TA+"bing.com")===0?"bing":a.search(TA+"yahoo.com")===0?"yahoo":a.search(TA+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!Vh(t)){r.$search_engine=t;var s=$t?eM($t.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function QCe(){return navigator.language||navigator.userLanguage}function Ket(){return $t?.referrer||"$direct"}function Jet(e,t){var n=e?MS([],$S,t||[]):[],r=Fl?.href.substring(0,1e3);return{r:Ket().substring(0,1e3),u:r?vT(r,n,xT):void 0}}function ett(e){var t,{r:n,u:r}=e,s={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=JP(n))==null?void 0:t.host};if(r){s.$current_url=r;var a=JP(r);s.$host=a?.host,s.$pathname=a?.pathname;var o=Yet(r);ao(s,o)}if(n){var i=Xet(n);ao(s,i)}return s}function ttt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function H4n(){try{return new Date().getTimezoneOffset()}catch{return}}function G4n(e,t){if(!Il)return{};var n,r,s,a=e?MS([],$S,t||[]):[],[o,i]=(function(c){for(var u=0;u<qCe.length;u++){var[d,f]=qCe[u],p=d.exec(c),h=p&&(ug(f)?f(p,c):f);if(h)return h}return["",""]})(Il);return ao(Pse({$os:o,$os_version:i,$browser:Wet(Il,navigator.vendor),$device:VCe(Il),$device_type:(r=Il,s=VCe(r),s===Pet||s===Iet||s==="Kobo"||s==="Kindle Fire"||s===Get?TE:s===jE||s===B0||s===AE||s===oY?"Console":s===$et?"Wearable":s?Qu:"Desktop"),$timezone:ttt(),$timezone_offset:H4n()}),{$current_url:vT(Fl?.href,a,xT),$host:Fl?.host,$pathname:Fl?.pathname,$raw_user_agent:Il.length>1e3?Il.substring(0,997)+"...":Il,$browser_version:q4n(Il,navigator.vendor),$browser_language:QCe(),$browser_language_prefix:(n=QCe(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:Ge?.screen.height,$screen_width:Ge?.screen.width,$viewport_height:Ge?.innerHeight,$viewport_width:Ge?.innerWidth,$lib:"web",$lib_version:eh.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Nm=Lo("[Web Vitals]"),HCe=9e5;class W4n{constructor(t){var n;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((r,s)=>Xt({},r,{["$web_vitals_"+s.name+"_event"]:Xt({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=r=>{var s,a=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(Rt(a))Nm.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Tt();Rt(o)||(Ps(r?.name)||Ps(r?.value)?Nm.error("Invalid metric received",r):this.Rt&&r.value>=this.Rt?Nm.error("Ignoring metric with value >= "+this.Rt,r):(this.N.url!==o&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),Rt(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=Rt(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.N.metrics.push(Xt({},r,{$current_url:o,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var r,s,a,o,i=Hn.__PosthogExtensions__;Rt(i)||Rt(i.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:s,onFCP:a,onINP:o}=i.postHogWebVitalsCallbacks),r&&s&&a&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.Pt.bind(this)),this.P=!0):Nm.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Et=!((n=this._instance.persistence)==null||!n.props[NCe]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=Qo(this._instance.config.capture_performance)?(t=this._instance.config.capture_performance)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Rt(r)?((n=this._instance.persistence)==null?void 0:n.props[jCe])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Qo(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var t=Qo(this._instance.config.capture_performance)&&op(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:HCe;return 0<t&&t<=6e4?HCe:t}get isEnabled(){var t=Fl?.protocol;if(t!=="http:"&&t!=="https:")return Nm.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=Qo(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:dg(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return dg(n)?n:this.Et}startIfEnabled(){this.isEnabled&&!this.P&&(Nm.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(t){var n=Qo(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Qo(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[NCe]:n}),this._instance.persistence.register({[jCe]:r})),this.Et=n,this.startIfEnabled()}it(t){var n,r;(n=Hn.__PosthogExtensions__)!=null&&n.postHogWebVitalsCallbacks&&t(),(r=Hn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"web-vitals",(s=>{s?Nm.error("failed to load script",s):t()}))}Tt(){var t=Ge?Ge.location.href:void 0;if(t){var n=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=n?MS([],$S,r||[]):[];return vT(t,s,xT)}Nm.error("Could not determine current URL")}}var Z4n=Lo("[Heatmaps]");function GCe(e){return Qo(e)&&"clientX"in e&&"clientY"in e&&op(e.clientX)&&op(e.clientY)}class Y4n{constructor(t){var n;this.Et=!1,this.P=!1,this.It=null,this.instance=t,this.Et=!((n=this.instance.persistence)==null||!n.props[YZ]),this.rageclicks=new Tet(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return Qo(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Rt(this.instance.config.capture_heatmaps)?Rt(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;Z4n.info("starting..."),this.Ft(),this.Ct()}else{var t;clearInterval((t=this.It)!==null&&t!==void 0?t:void 0),this.Mt(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[YZ]:n}),this.Et=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Ot(t){this.At(t.originalEvent,"deadclick")}Ct(){this.It&&clearInterval(this.It),this.It=(function(t){return t?.visibilityState==="visible"})($t)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ft(){Ge&&$t&&(this.jt=this.Dt.bind(this),vo(Ge,"beforeunload",this.jt),this.Lt=t=>this.At(t||Ge?.event),vo($t,"click",this.Lt,{capture:!0}),this.Nt=t=>this.Ut(t||Ge?.event),vo($t,"mousemove",this.Nt,{capture:!0}),this.zt=new jet(this.instance,k4n,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ct.bind(this),vo($t,"visibilitychange",this.Ht),this.P=!0)}Mt(){var t;Ge&&$t&&(this.jt&&Ge.removeEventListener("beforeunload",this.jt),this.Lt&&$t.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&$t.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&$t.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),(t=this.zt)==null||t.stop(),this.P=!1)}qt(t,n){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(i,c,u){for(var d=i;d&&e4(d)&&!pg(d,"body");){if(d===u)return!1;if(kr(c,Ge?.getComputedStyle(d).position))return!0;d=xet(d)}return!1})(yet(t),["fixed","sticky"],a);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:r),target_fixed:o,type:n}}At(t,n){var r;if(n===void 0&&(n="click"),!ACe(t.target)&&GCe(t)){var s=this.qt(t,n);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Wt(Xt({},s,{type:"rageclick"})),this.Wt(s)}}Ut(t){!ACe(t.target)&&GCe(t)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(t,"mousemove"))}),500))}Wt(t){if(Ge){var n=Ge.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,a=r?MS([],$S,s||[]):[],o=vT(n,a,xT);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(t)}}Dt(){this.N&&!u0(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class X4n{constructor(t){this._instance=t}doPageView(t,n){var r,s=this.Gt(t,n);return this.Vt={pathname:(r=Ge?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var n;return this.Gt(t,(n=this.Vt)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Vt)==null?void 0:t.pageViewId}}Gt(t,n){var r=this.Vt;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:i,maxScrollY:c,maxContentHeight:u,lastContentY:d,maxContentY:f}=a;if(!(Rt(o)||Rt(i)||Rt(c)||Rt(u)||Rt(d)||Rt(f))){o=Math.ceil(o),i=Math.ceil(i),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var p=o<=1?1:zf(i/o,0,1,Ft),h=o<=1?1:zf(c/o,0,1,Ft),g=u<=1?1:zf(d/u,0,1,Ft),b=u<=1?1:zf(f/u,0,1,Ft);s=ao(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:b})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),s}}var Hu=Uint8Array,Wl=Uint16Array,Vw=Uint32Array,Use=new Hu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),qse=new Hu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),WCe=new Hu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ntt=function(e,t){for(var n=new Wl(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var s=new Vw(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)s[a]=a-n[r]<<5|r;return[n,s]},rtt=ntt(Use,2),K4n=rtt[0],lY=rtt[1];K4n[28]=258,lY[258]=28;for(var ZCe=ntt(qse,0)[1],stt=new Wl(32768),la=0;la<32768;++la){var Db=(43690&la)>>>1|(21845&la)<<1;Db=(61680&(Db=(52428&Db)>>>2|(13107&Db)<<2))>>>4|(3855&Db)<<4,stt[la]=((65280&Db)>>>8|(255&Db)<<8)>>>1}var Tk=function(e,t,n){for(var r=e.length,s=0,a=new Wl(t);s<r;++s)++a[e[s]-1];var o,i=new Wl(t);for(s=0;s<t;++s)i[s]=i[s-1]+a[s-1]<<1;for(o=new Wl(r),s=0;s<r;++s)o[s]=stt[i[e[s]-1]++]>>>15-e[s];return o},av=new Hu(288);for(la=0;la<144;++la)av[la]=8;for(la=144;la<256;++la)av[la]=9;for(la=256;la<280;++la)av[la]=7;for(la=280;la<288;++la)av[la]=8;var sM=new Hu(32);for(la=0;la<32;++la)sM[la]=5;var J4n=Tk(av,9),eLn=Tk(sM,5),att=function(e){return(e/8>>0)+(7&e&&1)},ott=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Wl?Wl:e instanceof Vw?Vw:Hu)(n-t);return r.set(e.subarray(t,n)),r},Wp=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},dO=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},iQ=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,a=n.slice();if(!s)return[new Hu(0),0];if(s==1){var o=new Hu(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(C,E){return C.f-E.f})),n.push({s:-1,f:25001});var i=n[0],c=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:i.f+c.f,l:i,r:c};d!=s-1;)i=n[n[u].f<n[f].f?u++:f++],c=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:i.f+c.f,l:i,r:c};var p=a[0].s;for(r=1;r<s;++r)a[r].s>p&&(p=a[r].s);var h=new Wl(p+1),g=cY(n[d-1],h,0);if(g>t){r=0;var b=0,y=g-t,x=1<<y;for(a.sort((function(C,E){return h[E.s]-h[C.s]||C.f-E.f}));r<s;++r){var w=a[r].s;if(!(h[w]>t))break;b+=x-(1<<g-h[w]),h[w]=t}for(b>>>=y;b>0;){var O=a[r].s;h[O]<t?b-=1<<t-h[O]++-1:++r}for(;r>=0&&b;--r){var _=a[r].s;h[_]==t&&(--h[_],++b)}g=t}return[new Hu(h),g]},cY=function(e,t,n){return e.s==-1?Math.max(cY(e.l,t,n+1),cY(e.r,t,n+1)):t[e.s]=n},YCe=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Wl(++t),r=0,s=e[0],a=1,o=function(c){n[r++]=c},i=1;i<=t;++i)if(e[i]==s&&i!=t)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=e[i]}return[n.subarray(0,r),t]},fO=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},uY=function(e,t,n){var r=n.length,s=att(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var a=0;a<r;++a)e[s+a+4]=n[a];return 8*(s+4+r)},XCe=function(e,t,n,r,s,a,o,i,c,u,d){Wp(t,d++,n),++s[256];for(var f=iQ(s,15),p=f[0],h=f[1],g=iQ(a,15),b=g[0],y=g[1],x=YCe(p),w=x[0],O=x[1],_=YCe(b),C=_[0],E=_[1],T=new Wl(19),N=0;N<w.length;++N)T[31&w[N]]++;for(N=0;N<C.length;++N)T[31&C[N]]++;for(var A=iQ(T,7),I=A[0],P=A[1],$=19;$>4&&!I[WCe[$-1]];--$);var U,L,B,H,q=u+5<<3,V=fO(s,av)+fO(a,sM)+o,W=fO(s,p)+fO(a,b)+o+14+3*$+fO(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(q<=V&&q<=W)return uY(t,d,e.subarray(c,c+u));if(Wp(t,d,1+(W<V)),d+=2,W<V){U=Tk(p,h),L=p,B=Tk(b,y),H=b;var D=Tk(I,P);for(Wp(t,d,O-257),Wp(t,d+5,E-1),Wp(t,d+10,$-4),d+=14,N=0;N<$;++N)Wp(t,d+3*N,I[WCe[N]]);d+=3*$;for(var Z=[w,C],z=0;z<2;++z){var R=Z[z];for(N=0;N<R.length;++N){var Q=31&R[N];Wp(t,d,D[Q]),d+=I[Q],Q>15&&(Wp(t,d,R[N]>>>5&127),d+=R[N]>>>12)}}}else U=J4n,L=av,B=eLn,H=sM;for(N=0;N<i;++N)if(r[N]>255){Q=r[N]>>>18&31,dO(t,d,U[Q+257]),d+=L[Q+257],Q>7&&(Wp(t,d,r[N]>>>23&31),d+=Use[Q]);var G=31&r[N];dO(t,d,B[G]),d+=H[G],G>3&&(dO(t,d,r[N]>>>5&8191),d+=qse[G])}else dO(t,d,U[r[N]]),d+=L[r[N]];return dO(t,d,U[256]),d+L[256]},tLn=new Vw([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nLn=(function(){for(var e=new Vw(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),rLn=function(e,t,n,r,s){return(function(a,o,i,c,u,d){var f=a.length,p=new Hu(c+f+5*(1+Math.floor(f/7e3))+u),h=p.subarray(c,p.length-u),g=0;if(!o||f<8)for(var b=0;b<=f;b+=65535){var y=b+65535;y<f?g=uY(h,g,a.subarray(b,y)):(h[b]=d,g=uY(h,g,a.subarray(b,f)))}else{for(var x=tLn[o-1],w=x>>>13,O=8191&x,_=(1<<i)-1,C=new Wl(32768),E=new Wl(_+1),T=Math.ceil(i/3),N=2*T,A=function(ge){return(a[ge]^a[ge+1]<<T^a[ge+2]<<N)&_},I=new Vw(25e3),P=new Wl(288),$=new Wl(32),U=0,L=0,B=(b=0,0),H=0,q=0;b<f;++b){var V=A(b),W=32767&b,D=E[V];if(C[W]=D,E[V]=W,H<=b){var Z=f-b;if((U>7e3||B>24576)&&Z>423){g=XCe(a,h,0,I,P,$,L,B,q,b-q,g),B=U=L=0,q=b;for(var z=0;z<286;++z)P[z]=0;for(z=0;z<30;++z)$[z]=0}var R=2,Q=0,G=O,J=W-D&32767;if(Z>2&&V==A(b-J))for(var ee=Math.min(w,Z)-1,ne=Math.min(32767,b),ae=Math.min(258,Z);J<=ne&&--G&&W!=D;){if(a[b+R]==a[b+R-J]){for(var ce=0;ce<ae&&a[b+ce]==a[b+ce-J];++ce);if(ce>R){if(R=ce,Q=J,ce>ee)break;var ye=Math.min(J,ce-2),Y=0;for(z=0;z<ye;++z){var se=b-J+z+32768&32767,te=se-C[se]+32768&32767;te>Y&&(Y=te,D=se)}}}J+=(W=D)-(D=C[W])+32768&32767}if(Q){I[B++]=268435456|lY[R]<<18|ZCe[Q];var he=31&lY[R],le=31&ZCe[Q];L+=Use[he]+qse[le],++P[257+he],++$[le],H=b+R,++U}else I[B++]=a[b],++P[a[b]]}}g=XCe(a,h,d,I,P,$,L,B,q,b-q,g)}return ott(p,0,c+att(g)+u)})(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},lQ=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function sLn(e,t){t===void 0&&(t={});var n=(function(){var i=4294967295;return{p:function(c){for(var u=i,d=0;d<c.length;++d)u=nLn[255&u^c[d]]^u>>>8;i=u},d:function(){return 4294967295^i}}})(),r=e.length;n.p(e);var s,a=rLn(e,t,10+((s=t).filename&&s.filename.length+1||0),8),o=a.length;return(function(i,c){var u=c.filename;if(i[0]=31,i[1]=139,i[2]=8,i[8]=c.level<2?4:c.level==9?2:0,i[9]=3,c.mtime!=0&&lQ(i,4,Math.floor(new Date(c.mtime||Date.now())/1e3)),u){i[3]=8;for(var d=0;d<=u.length;++d)i[d+10]=u.charCodeAt(d)}})(a,t),lQ(a,o-8,n.d()),lQ(a,o-4,r),a}var aLn=function(e){var t,n,r,s,a="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
|
|
485
485
|
`).replace(/\r/g,`
|
|
486
486
|
`)).length,s=0;s<r;s++){var o=e.charCodeAt(s),i=null;o<128?n++:i=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Vh(i)||(n>t&&(a+=e.substring(t,n)),a+=i,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},oLn=!!QZ||!!VZ,KCe="text/plain",aM=function(e,t,n){var r;n===void 0&&(n=!0);var[s,a]=e.split("?"),o=Xt({},t),i=(r=a?.split("&").map((u=>{var d,[f,p]=u.split("="),h=n&&(d=o[f])!==null&&d!==void 0?d:p;return delete o[f],f+"="+h})))!==null&&r!==void 0?r:[],c=d4n(o);return c&&i.push(c),s+"?"+i.join("&")},UO=(e,t)=>JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t),cQ=e=>{var{data:t,compression:n}=e;if(t){if(n===lh.GZipJS){var r=sLn((function(c,u){var d=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var f=new Hu(c.length+(c.length>>>1)),p=0,h=function(x){f[p++]=x},g=0;g<d;++g){if(p+5>f.length){var b=new Hu(p+8+(d-g<<1));b.set(f),f=b}var y=c.charCodeAt(g);y<128||u?h(y):y<2048?(h(192|y>>>6),h(128|63&y)):y>55295&&y<57344?(h(240|(y=65536+(1047552&y)|1023&c.charCodeAt(++g))>>>18),h(128|y>>>12&63),h(128|y>>>6&63),h(128|63&y)):(h(224|y>>>12),h(128|y>>>6&63),h(128|63&y))}return ott(f,0,p)})(UO(t)),{mtime:0}),s=new Blob([r],{type:KCe});return{contentType:KCe,body:s,estimatedSize:s.size}}if(n===lh.Base64){var a=(function(c){var u,d,f,p,h,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b=0,y=0,x="",w=[];if(!c)return c;c=aLn(c);do u=(h=c.charCodeAt(b++)<<16|c.charCodeAt(b++)<<8|c.charCodeAt(b++))>>18&63,d=h>>12&63,f=h>>6&63,p=63&h,w[y++]=g.charAt(u)+g.charAt(d)+g.charAt(f)+g.charAt(p);while(b<c.length);switch(x=w.join(""),c.length%3){case 1:x=x.slice(0,-2)+"==";break;case 2:x=x.slice(0,-1)+"="}return x})(UO(t)),o=(c=>"data="+encodeURIComponent(typeof c=="string"?c:UO(c)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var i=UO(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}}},xR=[];VZ&&xR.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:s,estimatedSize:a}=(t=cQ(e))!==null&&t!==void 0?t:{},o=new Headers;ea(e.headers,(function(d,f){o.append(f,d)})),r&&o.append("Content-Type",r);var i=e.url,c=null;if(bCe){var u=new bCe;c={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}VZ(i,Xt({method:e?.method||"GET",headers:o,keepalive:e.method==="POST"&&(a||0)<52428.8,body:s,signal:(n=c)==null?void 0:n.signal},e.fetchOptions)).then((d=>d.text().then((f=>{var p={statusCode:d.status,text:f};if(d.status===200)try{p.json=JSON.parse(f)}catch(h){Ft.error(h)}e.callback==null||e.callback(p)})))).catch((d=>{Ft.error(d),e.callback==null||e.callback({statusCode:0,text:d})})).finally((()=>c?clearTimeout(c.timeout):null))}}),QZ&&xR.push({transport:"XHR",method:e=>{var t,n=new QZ;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=(t=cQ(e))!==null&&t!==void 0?t:{};ea(e.headers,(function(a,o){n.setRequestHeader(o,a)})),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(a)}},n.send(s)}}),Bc!=null&&Bc.sendBeacon&&xR.push({transport:"sendBeacon",method:e=>{var t=aM(e.url,{beacon:"1"});try{var n,{contentType:r,body:s}=(n=cQ(e))!==null&&n!==void 0?n:{},a=typeof s=="string"?new Blob([s],{type:r}):s;Bc.sendBeacon(t,a)}catch{}}});var oM=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function JCe(e,t,n){return UO({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var itt={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>oM(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!oM(n,r))))),icontains:(e,t)=>t.map(NA).some((n=>e.map(NA).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(NA).every((n=>e.map(NA).every((r=>!n.includes(r)))))},NA=e=>e.toLowerCase();function ltt(e,t){return!e||Object.entries(e).every((n=>{var[r,s]=n,a=t?.[r];if(Rt(a)||Vh(a))return!1;var o=[String(a)],i=itt[s.operator];return!!i&&i(s.values,o)}))}var uQ=Lo("[Error tracking]");class iLn{constructor(t){var n,r;this.Jt=[],this.Kt=new A2n([new z2n,new Z2n,new U2n,new B2n,new G2n,new H2n,new V2n,new W2n],F2n("web:javascript",M2n,L2n)),this._instance=t,this.Jt=(n=(r=this._instance.persistence)==null?void 0:r.get_property(XZ))!==null&&n!==void 0?n:[]}onRemoteConfig(t){var n,r,s,a=(n=(r=t.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],o=(s=t.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Jt=a,this._instance.persistence&&this._instance.persistence.register({[XZ]:this.Jt,[TCe]:o})}get Yt(){var t,n=!!this._instance.get_property(TCe),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??n)!==null&&t!==void 0&&t}buildProperties(t,n){return this.Kt.buildFromUnknown(t,{syntheticException:n?.syntheticException,mechanism:{handled:n?.handled}})}sendExceptionEvent(t){var n=t.$exception_list;if(this.Xt(n)){if(this.Qt(n))return void uQ.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(n))return void uQ.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(n))return void uQ.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(t){if(t.length===0)return!1;var n=t.reduce(((r,s)=>{var{type:a,value:o}=s;return Po(a)&&a.length>0&&r.$exception_types.push(a),Po(o)&&o.length>0&&r.$exception_values.push(o),r}),{$exception_types:[],$exception_values:[]});return this.Jt.some((r=>{var s=r.values.map((a=>{var o,i=itt[a.operator],c=Us(a.value)?a.value:[a.value],u=(o=n[a.key])!==null&&o!==void 0?o:[];return c.length>0&&i(c,u)}));return r.type==="OR"?s.some(Boolean):s.every(Boolean)}))}Zt(t){return t.flatMap((n=>{var r,s;return(r=(s=n.stacktrace)==null?void 0:s.frames)!==null&&r!==void 0?r:[]})).some((n=>n.filename&&n.filename.startsWith("chrome-extension://")))}ti(t){if(t.length>0){var n,r,s,a,o=(n=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[],i=o[o.length-1];return(s=i==null||(a=i.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Xt(t){return!Ps(t)&&Us(t)}}var wd=Lo("[FeatureFlags]"),pO=Lo("[FeatureFlags]",{debugEnabled:!0}),dQ="$active_feature_flags",Rx="$override_feature_flags",eTe="$feature_flag_payloads",hO="$override_feature_flag_payloads",tTe="$feature_flag_request_id",nTe="$feature_flag_evaluated_at",rTe=e=>{var t={};for(var[n,r]of vR(e||{}))r&&(t[n]=r);return t},lLn=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((n=>t[n].enabled)).filter((n=>{var r;return(r=t[n].metadata)==null?void 0:r.payload})).map((n=>{var r;return[n,(r=t[n].metadata)==null?void 0:r.payload]})))):wd.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},cLn=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({});class uLn{constructor(t){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=t,this.featureFlagEventHandlers=[]}li(){var t=this._instance.config.evaluation_environments;return t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||wd.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var t=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.vi({disableFlags:t})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(KZ),n=this._instance.get_property(Rx),r=this._instance.get_property(hO);if(!r&&!n)return t||{};var s=ao({},t||{}),a=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var o of a){var i,c,u=s[o],d=n?.[o],f=Rt(d)?(i=u?.enabled)!==null&&i!==void 0&&i:!!d,p=Rt(d)?u.variant:typeof d=="string"?d:void 0,h=r?.[o],g=Xt({},u,{enabled:f,variant:f?p??u?.variant:void 0});f!==u?.enabled&&(g.original_enabled=u?.enabled),p!==u?.variant&&(g.original_variant=u?.variant),h&&(g.metadata=Xt({},u?.metadata,{payload:h,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),s[o]=g}return this.ii||(wd.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ii=!0),s}getFlagVariants(){var t=this._instance.get_property(d0),n=this._instance.get_property(Rx);if(!n)return t||{};for(var r=ao({},t),s=Object.keys(n),a=0;a<s.length;a++)r[s[a]]=n[s[a]];return this.ii||(wd.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this.ii=!0),r}getFlagPayloads(){var t=this._instance.get_property(eTe),n=this._instance.get_property(hO);if(!n)return t||{};for(var r=ao({},t||{}),s=Object.keys(n),a=0;a<s.length;a++)r[s[a]]=n[s[a]];return this.ii||(wd.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this.ii=!0),r}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.vi()}),5))}di(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.si=t}vi(t){var n;if(this.di(),!this._instance.O())if(this.ri)this.ni=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Xt({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(zO)||{}),group_properties:this._instance.get_property(Vb)};(t!=null&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.ui()&&(r.evaluation_environments=this.li());var s=this._instance.config.__preview_remote_config,a=s?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",i=this._instance.requestRouter.endpointFor("flags",a+o);s&&(r.timezone=ttt()),this.ri=!0,this._instance.ci({method:"POST",url:i,data:r,compression:this._instance.config.disable_compression?void 0:lh.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var u,d,f=!0;if(c.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),f=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi((d=c.json)!==null&&d!==void 0?d:{})),!r.disable_flags||this.ni)if(this.ai=!f,c.json&&(u=c.json.quotaLimited)!=null&&u.includes(cLn.FeatureFlags))wd.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var p;r.disable_flags||this.receivedFeatureFlags((p=c.json)!==null&&p!==void 0?p:{},f),this.ni&&(this.ni=!1,this.vi())}}})}}getFeatureFlag(t,n){if(n===void 0&&(n={}),this.ei||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[t],s=""+r,a=this._instance.get_property(tTe)||void 0,o=this._instance.get_property(nTe)||void 0,i=this._instance.get_property(ZP)||{};if((n.send_event||!("send_event"in n))&&(!(t in i)||!i[t].includes(s))){var c,u,d,f,p,h,g,b,y;Us(i[t])?i[t].push(s):i[t]=[s],(c=this._instance.persistence)==null||c.register({[ZP]:i});var x=this.getFeatureFlagDetails(t),w={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:o,$feature_flag_bootstrapped_response:((u=this._instance.config.bootstrap)==null||(u=u.featureFlags)==null?void 0:u[t])||null,$feature_flag_bootstrapped_payload:((d=this._instance.config.bootstrap)==null||(d=d.featureFlagPayloads)==null?void 0:d[t])||null,$used_bootstrap_value:!this.ai};Rt(x==null||(f=x.metadata)==null?void 0:f.version)||(w.$feature_flag_version=x.metadata.version);var O,_=(p=x==null||(h=x.reason)==null?void 0:h.description)!==null&&p!==void 0?p:x==null||(g=x.reason)==null?void 0:g.code;_&&(w.$feature_flag_reason=_),x!=null&&(b=x.metadata)!=null&&b.id&&(w.$feature_flag_id=x.metadata.id),Rt(x?.original_variant)&&Rt(x?.original_enabled)||(w.$feature_flag_original_response=Rt(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(y=x.metadata)!=null&&y.original_payload&&(w.$feature_flag_original_payload=x==null||(O=x.metadata)==null?void 0:O.original_payload),this._instance.capture("$feature_flag_called",w)}return r}wd.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var r=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:r};this.ui()&&(s.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:lh.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var o,i=(o=a.json)==null?void 0:o.featureFlagPayloads;n(i?.[t]||void 0)}})}isFeatureEnabled(t,n){if(n===void 0&&(n={}),this.ei||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(t,n);return Rt(r)?void 0:!!r}wd.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((n=>n!==t))}receivedFeatureFlags(t,n){if(this._instance.persistence){this.ei=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(o,i,c,u,d){c===void 0&&(c={}),u===void 0&&(u={}),d===void 0&&(d={});var f=lLn(o),p=f.flags,h=f.featureFlags,g=f.featureFlagPayloads;if(h){var b=o.requestId,y=o.evaluatedAt;if(Us(h)){wd.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(h)for(var w=0;w<h.length;w++)x[h[w]]=!0;i&&i.register({[dQ]:h,[d0]:x})}else{var O=h,_=g,C=p;o.errorsWhileComputingFlags&&(O=Xt({},c,O),_=Xt({},u,_),C=Xt({},d,C)),i&&i.register(Xt({[dQ]:Object.keys(rTe(O)),[d0]:O||{},[eTe]:_||{},[KZ]:C||{}},b?{[tTe]:b}:{},y?{[nTe]:y}:{}))}}})(t,this._instance.persistence,r,s,a),this.pi(n)}}override(t,n){n===void 0&&(n=!1),wd.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return wd.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this._instance.persistence.unregister(Rx),this._instance.persistence.unregister(hO),this.pi(),pO.info("All overrides cleared");if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.ii=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Rx),pO.info("Flag overrides cleared");else if(r.flags){if(Us(r.flags)){for(var s={},a=0;a<r.flags.length;a++)s[r.flags[a]]=!0;this._instance.persistence.register({[Rx]:s})}else this._instance.persistence.register({[Rx]:r.flags});pO.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(hO),pO.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[hO]:r.payloads}),pO.info("Payload overrides set",{payloads:r.payloads}))),void this.pi()}this.pi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ei){var{flags:n,flagVariants:r}=this.gi();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n,r){var s,a=(this._instance.get_property(FO)||[]).find((u=>u.flagKey===t)),o={["$feature_enrollment/"+t]:n},i={$feature_flag:t,$feature_enrollment:n,$set:o};a&&(i.$early_access_feature_name=a.name),r&&(i.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",i),this.setPersonPropertiesForFlags(o,!1);var c=Xt({},this.getFlagVariants(),{[t]:n});(s=this._instance.persistence)==null||s.register({[dQ]:Object.keys(rTe(c)),[d0]:c}),this.pi()}getEarlyAccessFeatures(t,n,r){n===void 0&&(n=!1);var s=this._instance.get_property(FO),a=r?"&"+r.map((o=>"stage="+o)).join("&"):"";if(s&&!n)return t(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:o=>{var i,c;if(o.json){var u=o.json.earlyAccessFeatures;return(i=this._instance.persistence)==null||i.unregister(FO),(c=this._instance.persistence)==null||c.register({[FO]:u}),t(u)}}})}gi(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter((r=>n[r])),flagVariants:Object.keys(n).filter((r=>n[r])).reduce(((r,s)=>(r[s]=n[s],r)),{})}}pi(t){var{flags:n,flagVariants:r}=this.gi();this.featureFlagEventHandlers.forEach((s=>s(n,r,{errorsLoading:t})))}setPersonPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(zO)||{};this._instance.register({[zO]:Xt({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(zO)}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(Vb)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((s=>{r[s]=Xt({},r[s],t[s]),delete t[s]})),this._instance.register({[Vb]:Xt({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this._instance.get_property(Vb)||{};this._instance.register({[Vb]:Xt({},n,{[t]:{}})})}else this._instance.unregister(Vb)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.di(),this.ii=!1}}var dLn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class fQ{constructor(t,n){this.F=t,this.props={},this.mi=!1,this.yi=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(t),this.Y=this.bi(t),this.load(),t.debug&&Ft.info("Persistence loaded",t.persistence,Xt({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.wi}bi(t){dLn.indexOf(t.persistence.toLowerCase())===-1&&(Ft.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Aa.H()?Aa:n==="localstorage+cookie"&&_A.H()?_A:n==="sessionstorage"&&fi.H()?fi:n==="memory"?S4n:n==="cookie"?Zf:_A.H()?_A:Zf}properties(){var t={};return ea(this.props,(function(n,r){if(r===d0&&Qo(n))for(var s=Object.keys(n),a=0;a<s.length;a++)t["$feature/"+s[a]]=n[s[a]];else i=r,c=!1,(Vh(o=t4n)?c:gCe&&o.indexOf===gCe?o.indexOf(i)!=-1:(ea(o,(function(u){if(c||(c=u===i))return GP})),c))||(t[r]=n);var o,i,c})),t}load(){if(!this.wi){var t=this.Y.W(this.yi);t&&(this.props=ao({},t))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Si,this.Ei,this.F.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(t,n,r){if(Qo(t)){Rt(n)&&(n="None"),this.xi=Rt(r)?this.$i:r;var s=!1;if(ea(t,((a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=a,s=!0)})),s)return this.save(),!0}return!1}register(t,n){if(Qo(t)){this.xi=Rt(n)?this.$i:n;var r=!1;if(ea(t,((s,a)=>{t.hasOwnProperty(a)&&this.props[a]!==s&&(this.props[a]=s,r=!0)})),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.mi){var t=Zet(this.F.custom_campaign_params,this.F.mask_personal_data_properties,this.F.custom_personal_data_properties);u0(Pse(t))||this.register(t),this.mi=!0}}update_search_keyword(){var t;this.register((t=$t?.referrer)?Xet(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Ket(),$referring_domain:$t!=null&&$t.referrer&&((t=JP($t.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[nY]||this.props[rY]||this.register_once({[YP]:Jet(this.F.mask_personal_data_properties,this.F.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};ea([rY,nY],(o=>{var i=this.props[o];i&&ea(i,(function(c,u){t["$initial_"+HZ(u)]=c}))}));var n,r,s=this.props[YP];if(s){var a=(n=ett(s),r={},ea(n,(function(o,i){r["$initial_"+HZ(i)]=o})),r);ao(t,a)}return t}safe_merge(t){return ea(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){if(this.$i=this.xi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var s=this.bi(t),a=this.props;this.clear(),this.Y=s,this.props=a,this.save()}}set_disabled(t){this.wi=t,this.wi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Si&&(this.Si=t,this.remove(),this.save())}set_secure(t){t!==this.Ei&&(this.Ei=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[LO]||{};r[t]=n,this.props[LO]=r,this.save()}remove_event_timer(t){var n=(this.props[LO]||{})[t];return Rt(n)||(delete this.props[LO][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var mO=(function(e){return e.Activation="events",e.Cancellation="cancelEvents",e})({});(function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e})({});(function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e})({});(function(e){return e.Top="top",e.Left="left",e.Right="right",e.Bottom="bottom",e})({});var pQ=(function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e})({});(function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e})({});(function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e})({});(function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e})({});var wR=(function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e})({}),sTe=(function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e})({}),ctt=(function(e){return e.Popover="popover",e.Inline="inline",e})({});class Vse{constructor(){this.ki={},this.ki={}}on(t,n){return this.ki[t]||(this.ki[t]=[]),this.ki[t].push(n),()=>{this.ki[t]=this.ki[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.ki[t]||[])r(n);for(var s of this.ki["*"]||[])s(t,n)}}function Ix(e,t,n){if(Ps(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class fLn{constructor(t){this.Pi=new Vse,this.Ti=(n,r)=>this.Ri(n,r)&&this.Ii(n,r)&&this.Fi(n,r)&&this.Ci(n,r),this.Ri=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=t,this.Mi=new Set,this.Oi=new Set}init(){var t;if(!Rt((t=this._instance)==null?void 0:t.Ai)){var n;(n=this._instance)==null||n.Ai(((r,s)=>{this.on(r,s)}))}}register(t){var n,r;if(!Rt((n=this._instance)==null?void 0:n.Ai)&&(t.forEach((o=>{var i,c;(i=this.Oi)==null||i.add(o),(c=o.steps)==null||c.forEach((u=>{var d;(d=this.Mi)==null||d.add(u?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,a=new Set;t.forEach((o=>{var i;(i=o.steps)==null||i.forEach((c=>{c!=null&&c.selector&&a.add(c?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(a)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Mi.has(t)||this.Mi.has(n?.event))&&this.Oi&&((r=this.Oi)==null?void 0:r.size)>0&&this.Oi.forEach((s=>{this.Di(n,s)&&this.Pi.emit("actionCaptured",s.name)}))}ji(t){this.onAction("actionCaptured",(n=>t(n)))}Di(t,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.Ti(t,r))return!0;return!1}onAction(t,n){return this.Pi.on(t,n)}Ii(t,n){if(n!=null&&n.url){var r,s=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!Ix(s,n.url,n.url_matching||"contains"))return!1}return!0}Fi(t,n){return!!this.Li(t,n)&&!!this.Ni(t,n)&&!!this.Ui(t,n)}Li(t,n){var r;if(n==null||!n.href)return!0;var s=this.zi(t);if(s.length>0)return s.some((i=>Ix(i.href,n.href,n.href_matching||"exact")));var a,o=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Ix((a=o.match(/(?::|")href="(.*?)"/))?a[1]:"",n.href,n.href_matching||"exact")}Ni(t,n){var r;if(n==null||!n.text)return!0;var s=this.zi(t);if(s.length>0)return s.some((u=>Ix(u.text,n.text,n.text_matching||"exact")||Ix(u.$el_text,n.text,n.text_matching||"exact")));var a,o,i,c=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(a=(function(u){for(var d,f=[],p=/(?::|")text="(.*?)"/g;!Ps(d=p.exec(u));)f.includes(d[1])||f.push(d[1]);return f})(c),o=n.text,i=n.text_matching||"exact",a.some((u=>Ix(u,o,i))))}Ui(t,n){var r,s;if(n==null||!n.selector)return!0;var a=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(a!=null&&a.includes(n.selector))return!0;var o=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}zi(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t?.properties.$elements}Ci(t,n){return n==null||!n.properties||n.properties.length===0||ltt(n.properties.reduce(((r,s)=>{var a=Us(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:a,operator:s.operator||"exact"},r}),{}),t?.properties)}}var bs=Lo("[Surveys]"),dY="seenSurvey_",pLn=(e,t)=>{var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n},aTe=e=>{var t=""+dY+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+dY+e.id+"_"+e.current_iteration),t},hLn=[pQ.Popover,pQ.Widget,pQ.API],mLn={ignoreConditions:!1,ignoreDelay:!1,displayType:ctt.Popover};class gLn{constructor(t){this._instance=t,this.Hi=new Map,this.Bi=new Map,this.qi=new Map}Wi(t,n){return!!t&<t(t.propertyFilters,n?.properties)}Gi(t,n){var r=new Map;return t.forEach((s=>{var a;(a=s.conditions)==null||(a=a[n])==null||(a=a.values)==null||a.forEach((o=>{if(o!=null&&o.name){var i=r.get(o.name)||[];i.push(s.id),r.set(o.name,i)}}))})),r}Vi(t,n,r){var s,a=(r===mO.Activation?this.Hi:this.Bi).get(t),o=[];return(s=this._instance)==null||s.getSurveys((i=>{o=i.filter((c=>a?.includes(c.id)))})),o.filter((i=>{var c,u=(c=i.conditions)==null||(c=c[r])==null||(c=c.values)==null?void 0:c.find((d=>d.name===t));return this.Wi(u,n)}))}register(t){var n;Rt((n=this._instance)==null?void 0:n.Ai)||(this.Ji(t),this.Ki(t))}Ki(t){var n=t.filter((r=>{var s,a;return((s=r.conditions)==null?void 0:s.actions)&&((a=r.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0}));n.length!==0&&(this.Yi==null&&(this.Yi=new fLn(this._instance),this.Yi.init(),this.Yi.ji((r=>{this.onAction(r)}))),n.forEach((r=>{var s,a,o,i,c;r.conditions&&(s=r.conditions)!=null&&s.actions&&(a=r.conditions)!=null&&(a=a.actions)!=null&&a.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((i=this.Yi)==null||i.register(r.conditions.actions.values),(c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach((u=>{if(u&&u.name){var d=this.qi.get(u.name);d&&d.push(r.id),this.qi.set(u.name,d||[r.id])}})))})))}Ji(t){var n,r=t.filter((a=>{var o,i;return((o=a.conditions)==null?void 0:o.events)&&((i=a.conditions)==null||(i=i.events)==null||(i=i.values)==null?void 0:i.length)>0})),s=t.filter((a=>{var o,i;return((o=a.conditions)==null?void 0:o.cancelEvents)&&((i=a.conditions)==null||(i=i.cancelEvents)==null||(i=i.values)==null?void 0:i.length)>0}));(r.length!==0||s.length!==0)&&((n=this._instance)==null||n.Ai(((a,o)=>{this.onEvent(a,o)})),this.Hi=this.Gi(t,mO.Activation),this.Bi=this.Gi(t,mO.Cancellation))}onEvent(t,n){var r,s=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[kA])||[];if(wR.SHOWN===t&&n&&s.length>0){var a;bs.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:n,existingActivatedSurveys:s});var o=n==null||(a=n.properties)==null?void 0:a.$survey_id;if(o){var i=s.indexOf(o);i>=0&&(s.splice(i,1),this.Xi(s))}}else{if(this.Bi.has(t)){var c=this.Vi(t,n,mO.Cancellation);c.length>0&&(bs.info("cancel event matched, cancelling surveys",{event:t,surveysToCancel:c.map((d=>d.id))}),c.forEach((d=>{var f,p=s.indexOf(d.id);p>=0&&s.splice(p,1),(f=this._instance)==null||f.cancelPendingSurvey(d.id)})),this.Xi(s))}if(this.Hi.has(t)){bs.info("survey event name matched",{event:t,eventPayload:n,surveys:this.Hi.get(t)});var u=this.Vi(t,n,mO.Activation);this.Xi(s.concat(u.map((d=>d.id))||[]))}}}onAction(t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[kA])||[];this.qi.has(t)&&this.Xi(r.concat(this.qi.get(t)||[]))}Xi(t){var n;bs.info("updating activated surveys",{activatedSurveys:t}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[kA]:[...new Set(t)]})}getSurveys(){var t,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[kA];return n||[]}getEventToSurveys(){return this.Hi}Qi(){return this.Yi}}class bLn{constructor(t){this.Zi=void 0,this._surveyManager=null,this.te=!1,this.ie=!1,this.ee=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var n=t.surveys;if(Ps(n))return bs.warn("Flags not loaded yet. Not loading surveys.");var r=Us(n);this.Zi=r?n.length>0:n,bs.info("flags response received, isSurveysEnabled: "+this.Zi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(dY)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.ie)bs.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)bs.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())bs.info("Not loading surveys in cookieless mode without consent.");else{var t=Hn?.__PosthogExtensions__;if(t){if(!Rt(this.Zi)||this._instance.config.advanced_enable_surveys){var n=this.Zi||this._instance.config.advanced_enable_surveys;this.ie=!0;try{var r=t.generateSurveys;if(r)return void this.re(r,n);var s=t.loadExternalDependency;if(!s)return void this.se("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(a=>{a||!t.generateSurveys?this.se("Could not load surveys script",a):this.re(t.generateSurveys,n)}))}catch(a){throw this.se("Error initializing surveys",a),a}finally{this.ie=!1}}}else bs.error("PostHog Extensions not found.")}}re(t,n){this._surveyManager=t(this._instance,n),this._surveyEventReceiver=new gLn(this._instance),bs.info("Surveys loaded successfully"),this.ne({isLoaded:!0})}se(t,n){bs.error(t,n),this.ne({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ee.push(t),this._surveyManager&&this.ne({isLoaded:!0}),()=>{this.ee=this.ee.filter((n=>n!==t))}}getSurveys(t,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return bs.info("Disabled. Not loading surveys."),t([]);var r=this._instance.get_property(JZ);if(r&&!n)return t(r,{isLoaded:!0});if(this.te)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.te=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var a;this.te=!1;var o=s.statusCode;if(o!==200||!s.json){var i="Surveys API could not be loaded, status: "+o;return bs.error(i),t([],{isLoaded:!1,error:i})}var c,u=s.json.surveys||[],d=u.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&((function(p){var h;return!((h=p.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)})(f)||(function(p){var h;return!((h=p.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)})(f))));return d.length>0&&((c=this._surveyEventReceiver)==null||c.register(d)),(a=this._instance.persistence)==null||a.register({[JZ]:u}),t(u,{isLoaded:!0})}})}catch(s){throw this.te=!1,s}}ne(t){for(var n of this.ee)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){bs.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!Ps(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);bs.warn("init was not called")}oe(t){var n=null;return this.getSurveys((r=>{var s;n=(s=r.find((a=>a.id===t)))!==null&&s!==void 0?s:null})),n}ae(t){if(Ps(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof t=="string"?this.oe(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ps(this._surveyManager))return bs.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.ae(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return Ps(this._surveyManager)?(bs.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((r=>{this.getSurveys((s=>{var a,o=(a=s.find((c=>c.id===t)))!==null&&a!==void 0?a:null;if(o){var i=this.ae(o);r({visible:i.eligible,disabledReason:i.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(t,n){var r;if(Ps(this._surveyManager))bs.warn("init was not called");else{var s=typeof t=="string"?this.oe(t):t;if(s!=null&&s.id)if(hLn.includes(s.type)){var a=$t?.querySelector(n);if(a)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(bs.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,i;bs.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(i=this._surveyManager)==null||i.renderSurvey(s,a),bs.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,a);bs.warn("Survey element not found")}else bs.warn("Surveys of type "+s.type+" cannot be rendered in the app");else bs.warn("Survey not found")}}displaySurvey(t,n){var r;if(Ps(this._surveyManager))bs.warn("init was not called");else{var s=this.oe(t);if(s){var a=s;if((r=s.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(a=Xt({},s,{appearance:Xt({},s.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var o=this.canRenderSurvey(s);if(!o.visible)return void bs.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==ctt.Inline?this._surveyManager.handlePopoverSurvey(a):this.renderSurvey(a,n.selector)}else bs.warn("Survey not found")}}cancelPendingSurvey(t){Ps(this._surveyManager)?bs.warn("init was not called"):this._surveyManager.cancelSurvey(t)}}var oTe=Lo("[RateLimiter]");class yLn{constructor(t){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var a=s.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((o=>{oTe.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4}))}catch(o){return void oTe.warn('could not rate limit - continuing. Error: "'+o?.message+'"',{text:a})}},this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=t.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var n,r,s;t===void 0&&(t=!1);var a=new Date().getTime(),o=(n=(r=this.instance.persistence)==null?void 0:r.get_property(tY))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:a};o.tokens+=(a-o.last)/1e3*this.captureEventsPerSecond,o.last=a,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var i=o.tokens<1;return i||t||(o.tokens=Math.max(0,o.tokens-1)),!i||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=i,(s=this.instance.persistence)==null||s.set_property(tY,o),{isRateLimited:i,remainingTokens:o.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Lb=Lo("[RemoteConfig]");class vLn{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Hn._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}le(t){var n,r;(n=Hn.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Hn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(Lb.error("PostHog Extensions not found. Cannot load remote config."),t())}ue(t){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return Lb.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void Lb.warn("Remote config is disabled. Falling back to local config.");this.le((t=>{if(!t)return Lb.info("No config found after loading remote JS config. Falling back to JSON."),void this.ue((n=>{this.fi(n)}));this.fi(t)}))}catch(t){Lb.error("Error loading remote config",t)}}fi(t){t?this._instance.config.__preview_remote_config?(this._instance.fi(t),t.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Lb.info("__preview_remote_config is disabled. Logging config instead",t):Lb.error("Failed to fetch remote config from PostHog.")}}var fY=3e3;class xLn{constructor(t,n){this.he=!0,this.ve=[],this.de=zf(n?.flush_interval_ms||fY,250,5e3,Ft.createLogger("flush interval"),fY),this.ce=t}enqueue(t){this.ve.push(t),this.fe||this.pe()}unload(){this.ge();var t=this.ve.length>0?this._e():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ce(Xt({},r,{transport:"sendBeacon"}))}))}enable(){this.he=!1,this.pe()}pe(){var t=this;this.he||(this.fe=setTimeout((()=>{if(this.ge(),this.ve.length>0){var n=this._e(),r=function(){var a=n[s],o=new Date().getTime();a.data&&Us(a.data)&&ea(a.data,(i=>{i.offset=Math.abs(i.timestamp-o),delete i.timestamp})),t.ce(a)};for(var s in n)r()}}),this.de))}ge(){clearTimeout(this.fe),this.fe=void 0}_e(){var t={};return ea(this.ve,(n=>{var r,s=n,a=(s?s.batchKey:null)||s.url;Rt(t[a])&&(t[a]=Xt({},s,{data:[]})),(r=t[a].data)==null||r.push(s.data)})),this.ve=[],t}}var wLn=["retriesPerformedSoFar"];class SLn{constructor(t){this.me=!1,this.ye=3e3,this.ve=[],this._instance=t,this.ve=[],this.be=!0,!Rt(Ge)&&"onLine"in Ge.navigator&&(this.be=Ge.navigator.onLine,this.we=()=>{this.be=!0,this.Dt()},this.xe=()=>{this.be=!1},vo(Ge,"online",this.we),vo(Ge,"offline",this.xe))}get length(){return this.ve.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=net(t,wLn);op(n)&&n>0&&(r.url=aM(r.url,{retry_count:n})),this._instance.ci(Xt({},r,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(n??0)<10?this.Se(Xt({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(s)}}))}Se(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(o){var i=3e3*Math.pow(2,o),c=i/2,u=Math.min(18e5,i),d=(Math.random()-.5)*(u-c);return Math.ceil(u+d)})(n),s=Date.now()+r;this.ve.push({retryAt:s,requestOptions:t});var a="Enqueued failed request for retry in "+r;navigator.onLine||(a+=" (Browser is offline)"),Ft.warn(a),this.me||(this.me=!0,this.Ee())}Ee(){if(this.$e&&clearTimeout(this.$e),this.ve.length===0)return this.me=!1,void(this.$e=void 0);this.$e=setTimeout((()=>{this.be&&this.ve.length>0&&this.Dt(),this.Ee()}),this.ye)}Dt(){var t=Date.now(),n=[],r=this.ve.filter((a=>a.retryAt<t||(n.push(a),!1)));if(this.ve=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:t}of(this.$e&&(clearTimeout(this.$e),this.$e=void 0),this.me=!1,Rt(Ge)||(this.we&&(Ge.removeEventListener("online",this.we),this.we=void 0),this.xe&&(Ge.removeEventListener("offline",this.xe),this.xe=void 0)),this.ve))try{this._instance.ci(Xt({},t,{transport:"sendBeacon"}))}catch(n){Ft.error(n)}this.ve=[]}}class OLn{constructor(t){this.ke=()=>{var n,r,s,a;this.Pe||(this.Pe={});var o=this.scrollElement(),i=this.scrollY(),c=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=i+(o?.clientHeight||0),d=o?.scrollHeight||0;this.Pe.lastScrollY=Math.ceil(i),this.Pe.maxScrollY=Math.max(i,(n=this.Pe.maxScrollY)!==null&&n!==void 0?n:0),this.Pe.maxScrollHeight=Math.max(c,(r=this.Pe.maxScrollHeight)!==null&&r!==void 0?r:0),this.Pe.lastContentY=u,this.Pe.maxContentY=Math.max(u,(s=this.Pe.maxContentY)!==null&&s!==void 0?s:0),this.Pe.maxContentHeight=Math.max(d,(a=this.Pe.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=t}getContext(){return this.Pe}resetContext(){var t=this.Pe;return setTimeout(this.ke,0),t}startMeasuringScrollPosition(){vo(Ge,"scroll",this.ke,{capture:!0}),vo(Ge,"scrollend",this.ke,{capture:!0}),vo(Ge,"resize",this.ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ge?.document.documentElement;var t=Us(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of t){var r=Ge?.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Ge&&(Ge.scrollY||Ge.pageYOffset||Ge.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Ge&&(Ge.scrollX||Ge.pageXOffset||Ge.document.documentElement.scrollLeft)||0}}var kLn=e=>Jet(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class iTe{constructor(t,n,r,s){this.Te=a=>{var o=this.Re();if(!o||o.sessionId!==a){var i={sessionId:a,props:this.Ie(this._instance)};this.Fe.register({[eY]:i})}},this._instance=t,this.Ce=n,this.Fe=r,this.Ie=s||kLn,this.Ce.onSessionId(this.Te)}Re(){return this.Fe.props[eY]}getSetOnceProps(){var t,n=(t=this.Re())==null?void 0:t.props;return n?"r"in n?ett(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return ea(Pse(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+HZ(r)]=n})),t}}var hQ=Lo("[SessionId]");class lTe{on(t,n){return this.Me.on(t,n)}constructor(t,n,r){var s;if(this.Oe=[],this.Ae=void 0,this.Me=new Vse,this.De=(d,f)=>Math.abs(d-f)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.F=t.config,this.Fe=t.persistence,this.je=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ne=n||Km,this.Ue=r||Km;var a=this.F.persistence_name||this.F.token,o=this.F.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*zf(o,60,36e3,hQ.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ze(),this.He="ph_"+a+"_window_id",this.Be="ph_"+a+"_primary_window_exists",this.qe()){var i=fi.W(this.He),c=fi.W(this.Be);i&&!c?this.je=i:fi.V(this.He),fi.G(this.Be,!0)}if((s=this.F.bootstrap)!=null&&s.sessionID)try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.F.bootstrap.sessionID);this.We(this.F.bootstrap.sessionID,new Date().getTime(),u)}catch(d){hQ.error("Invalid sessionID in bootstrap",d)}this.Ge()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Rt(this.Oe)&&(this.Oe=[]),this.Oe.push(t),this.Le&&t(this.Le,this.je),()=>{this.Oe=this.Oe.filter((n=>n!==t))}}qe(){return this.F.persistence!=="memory"&&!this.Fe.wi&&fi.H()}Ve(t){t!==this.je&&(this.je=t,this.qe()&&fi.G(this.He,t))}Je(){return this.je?this.je:this.qe()?fi.W(this.He):null}We(t,n,r){t===this.Le&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Le=t,this.Fe.register({[WP]:[n,t,r]}))}Ke(){var t=this.Fe.props[WP];return Us(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.We(null,null,null)}destroy(){clearTimeout(this.Ye),this.Ye=void 0,this.Ae&&Ge&&(Ge.removeEventListener("beforeunload",this.Ae,{capture:!1}),this.Ae=void 0),this.Oe=[]}Ge(){this.Ae=()=>{this.qe()&&fi.V(this.Be)},vo(Ge,"beforeunload",this.Ae,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.F.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[s,a,o]=this.Ke(),i=this.Je(),c=op(o)&&o>0&&Math.abs(r-o)>864e5,u=!1,d=!a,f=!d&&!t&&this.De(r,s);d||f||c?(a=this.Ne(),i=this.Ue(),hQ.info("new session ID generated",{sessionId:a,windowId:i,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}}),o=r,u=!0):i||(i=this.Ue(),u=!0);var p=s===0||!t||c?r:s,h=o===0?new Date().getTime():o;return this.Ve(i),this.We(a,p,h),t||this.ze(),u&&this.Oe.forEach((g=>g(a,i,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}:void 0))),{sessionId:a,windowId:i,sessionStartTimestamp:h,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:s}}ze(){clearTimeout(this.Ye),this.Ye=setTimeout((()=>{var[t]=this.Ke();if(this.De(new Date().getTime(),t)){var n=this.Le;this.resetSessionId(),this.Me.emit("forcedIdleReset",{idleSessionId:n})}}),1.1*this.sessionTimeoutMs)}}var _Ln=["$set_once","$set"],jm=Lo("[SiteApps]");class ELn{constructor(t){this._instance=t,this.Xe=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qe(t,n){if(n){var r=this.globalsForEvent(n);this.Xe.push(r),this.Xe.length>1e3&&(this.Xe=this.Xe.slice(10))}}get siteAppLoaders(){var t;return(t=Hn._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ai(this.Qe.bind(this));this.Ze=()=>{t(),this.Xe=[],this.Ze=void 0}}}globalsForEvent(t){var n,r,s,a,o,i,c;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[p,h]of Object.entries(f))u[p]={id:d[p],type:p,properties:h};var{$set_once:g,$set:b}=t;return{event:Xt({},net(t,_Ln),{properties:Xt({},t.properties,b?{$set:Xt({},(n=(r=t.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},b)}:{},g?{$set_once:Xt({},(s=(a=t.properties)==null?void 0:a.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(o=(i=t.properties)==null?void 0:i.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(c=t.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var i;!n.errored&&this.Xe.length&&(jm.info("Processing "+this.Xe.length+" events for site app with id "+t.id),this.Xe.forEach((c=>n.processEvent==null?void 0:n.processEvent(c))),n.processedBuffer=!0),Object.values(this.apps).every((c=>c.processedBuffer||c.errored))&&((i=this.Ze)==null||i.call(this))},s=!1,a=i=>{n.errored=!i,n.loaded=!0,jm.info("Site app with id "+t.id+" "+(i?"loaded":"errored")),s&&r()};try{var{processEvent:o}=t.init({posthog:this._instance,callback:i=>{a(i)}});o&&(n.processEvent=o),s=!0}catch(i){jm.error("Error while initializing PostHog app with config id "+t.id,i),a(!1)}if(s&&n.loaded)try{r()}catch(i){jm.error("Error while processing buffered events PostHog app with config id "+t.id,i),n.errored=!0}}tr(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}ir(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(s){jm.error("Error while processing event "+t.event+" for site app "+r.id,s)}}}onRemoteConfig(t){var n,r,s,a=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.tr(),void this._instance.on("eventCaptured",(u=>this.ir(u)))):void jm.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.Ze)==null||r.call(this),(s=t.siteApps)!=null&&s.length)if(this.isEnabled){var o=function(u){var d;Hn["__$$ph_site_app_"+u]=a._instance,(d=Hn.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(a._instance,c,(f=>{if(f)return jm.error("Error while initializing PostHog app with config id "+u,f)}))};for(var{id:i,url:c}of t.siteApps)o(i)}else jm.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var utt=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&xCe(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>xCe(s?.brand,t))))return!0}catch{}return!!e.webdriver},qO=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),cTe="i.posthog.com";class CLn{constructor(t){this.er={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+cTe,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=qO.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=qO.EU:this.er[this.apiHost]=qO.CUSTOM),this.er[this.apiHost]}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(this.region===qO.CUSTOM)return this.apiHost+n;var r=cTe+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var TLn={icontains:(e,t)=>!!Ge&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Ge&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Ge&&oM(t.href,e),not_regex:(e,t)=>!!Ge&&!oM(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class _i{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((s=>{_i.rr("retrieved web experiments from the server"),n.sr=new Map,s.forEach((a=>{if(a.feature_flag_key){var o;n.sr&&(_i.rr("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=n.sr)==null||o.set(a.feature_flag_key,a));var i=n._instance.getFeatureFlag(a.feature_flag_key);Po(i)&&a.variants[i]&&n.nr(a.name,i,a.variants[i].transforms)}else if(a.variants)for(var c in a.variants){var u=a.variants[c];_i.ar(u)&&n.nr(a.name,c,u.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}onFeatureFlags(t){if(this._is_bot())_i.rr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(Ps(this.sr))return this.sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_i.rr("applying feature flags",t),t.forEach((n=>{var r;if(this.sr&&(r=this.sr)!=null&&r.has(n)){var s,a=this._instance.getFeatureFlag(n),o=(s=this.sr)==null?void 0:s.get(n);a&&o!=null&&o.variants[a]&&this.nr(o.name,a,o.variants[a].transforms)}}))}}previewWebExperiment(){var t=_i.getWindowLocation();if(t!=null&&t.search){var n=eM(t?.search,"__experiment_id"),r=eM(t?.search,"__experiment_variant");n&&r&&(_i.rr("previewing web experiments "+n+" && "+r),this.getWebExperiments((s=>{this.lr(parseInt(n),r,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this._instance.config.disable_web_experiments&&!r)return t([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return t(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return t([]);var o=a.json.experiments||[];return t(o)}})}lr(t,n,r){var s=r.filter((a=>a.id===t));s&&s.length>0&&(_i.rr("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.nr(s[0].name,n,s[0].variants[n].transforms))}static ar(t){return!Ps(t.conditions)&&_i.ur(t)&&_i.hr(t)}static ur(t){var n;if(Ps(t.conditions)||Ps((n=t.conditions)==null?void 0:n.url))return!0;var r,s,a,o=_i.getWindowLocation();return!!o&&((r=t.conditions)==null||!r.url||TLn[(s=(a=t.conditions)==null?void 0:a.urlMatchType)!==null&&s!==void 0?s:"icontains"](t.conditions.url,o))}static getWindowLocation(){return Ge?.location}static hr(t){var n;if(Ps(t.conditions)||Ps((n=t.conditions)==null?void 0:n.utm))return!0;var r=Zet();if(r.utm_source){var s,a,o,i,c,u,d,f,p=(s=t.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((a=t.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==r.utm_campaign,h=(o=t.conditions)==null||(o=o.utm)==null||!o.utm_source||((i=t.conditions)==null||(i=i.utm)==null?void 0:i.utm_source)==r.utm_source,g=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,b=(d=t.conditions)==null||(d=d.utm)==null||!d.utm_term||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return p&&g&&b&&h}return!1}static rr(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];Ft.info("[WebExperiments] "+t,r)}nr(t,n,r){this._is_bot()?_i.rr("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach((s=>{if(s.selector){var a;_i.rr("applying transform of variant "+n+" for experiment "+t+" ",s);var o=(a=document)==null?void 0:a.querySelectorAll(s.selector);o?.forEach((i=>{var c=i;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)}))}})):_i.rr("Control variants leave the page unmodified.")}_is_bot(){return Bc&&this._instance?utt(Bc,this._instance.config.custom_blocked_useragents):void 0}}var NLn=Lo("[PostHog ExternalIntegrations]"),jLn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ALn{constructor(t){this._instance=t}it(t,n){var r;(r=Hn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(s=>{if(s)return NLn.error("failed to load script",s);n()}))}startIfEnabledOrStop(){var t=this,n=function(o){var i,c,u;!s||(i=Hn.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[o]||t.it(jLn[o],(()=>{var d;(d=Hn.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[o])==null||d.start(t._instance)})),!s&&(c=Hn.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[o]&&((u=Hn.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,s]of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n(r)}}}var pY="[SessionRecording]",gO=Lo(pY);class uTe{get started(){var t;return!((t=this.vr)==null||!t.isStarted)}get status(){return this.vr?this.vr.status:this.dr&&!this.cr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.dr=!1,this.pr=void 0,this._instance=t,!this._instance.sessionManager)throw gO.error("started without valid sessionManager"),new Error(pY+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(pY+' cannot be used with cookieless_mode="always"')}get cr(){var t,n=!((t=this._instance.get_property(tQ))==null||!t.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return Ge&&n&&r&&!s}startIfEnabledOrStop(t){var n;if(!this.cr||(n=this.vr)==null||!n.isStarted){var r=!Rt(Object.assign)&&!Rt(Array.from);this.cr&&r?(this.gr(t),gO.info("starting")):this.stopRecording()}}gr(t){var n,r,s;this.cr&&(Hn!=null&&(n=Hn.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=Hn.__PosthogExtensions__)!=null&&r.initSessionRecording?this._r(t):(s=Hn.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.mr,(a=>{if(a)return gO.error("could not load recorder",a);this._r(t)})))}stopRecording(){var t,n;(t=this.pr)==null||t.call(this),this.pr=void 0,(n=this.vr)==null||n.stop()}yr(){var t;(t=this._instance.persistence)==null||t.unregister(pet)}br(t){if(this._instance.persistence){var n,r,s=this._instance.persistence,a=()=>{var o=t.sessionRecording===!1?void 0:t.sessionRecording,i=o?.sampleRate,c=Ps(i)?null:parseFloat(i);Ps(c)&&this.yr();var u=o?.minimumDurationMilliseconds;s.register({[tQ]:Xt({enabled:!!o},o,{networkPayloadCapture:Xt({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Rt(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};a(),(n=this.pr)==null||n.call(this),this.pr=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(a)}}onRemoteConfig(t){"sessionRecording"in t?t.sessionRecording!==!1?(this.br(t),this.dr=!0,this.startIfEnabledOrStop()):this.dr=!0:gO.info("skipping remote config with no sessionRecording",t)}log(t,n){var r;n===void 0&&(n="log"),(r=this.vr)!=null&&r.log?this.vr.log(t,n):gO.warn("log called before recorder was ready")}get mr(){var t,n,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(tQ);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}_r(t){var n,r;if((n=Hn.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.vr||(this.vr=(r=Hn.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.vr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.vr.start(t)}onRRwebEmit(t){var n;(n=this.vr)==null||n.onRRwebEmit==null||n.onRRwebEmit(t)}overrideLinkedFlag(){var t,n;this.vr||(n=this._instance.persistence)==null||n.register({$replay_override_linked_flag:!0}),(t=this.vr)==null||t.overrideLinkedFlag()}overrideSampling(){var t,n;this.vr||(n=this._instance.persistence)==null||n.register({$replay_override_sampling:!0}),(t=this.vr)==null||t.overrideSampling()}overrideTrigger(t){var n,r;this.vr||(r=this._instance.persistence)==null||r.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(n=this.vr)==null||n.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.vr)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,n){var r;return!((r=this.vr)==null||!r.tryAddCustomEvent(t,n))}}var Nk={},hY=()=>{},Gx="posthog",dtt=!oLn&&Il?.indexOf("MSIE")===-1&&Il?.indexOf("Mozilla")===-1,dTe=e=>{var t;return Xt({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:e4n($t?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:hY,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,debug:Fl&&Po(Fl?.search)&&Fl.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ge==null||(t=Ge.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;Ft.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:fY},error_tracking:{},_onCapture:hY,__preview_eager_load_replay:!1},(n=>({rageclick:!(n&&n>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(n&&n>="2025-05-24")||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},fTe=e=>{var t={};Rt(e.process_person)||(t.person_profiles=e.process_person),Rt(e.xhr_headers)||(t.request_headers=e.xhr_headers),Rt(e.cookie_name)||(t.persistence_name=e.cookie_name),Rt(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Rt(e.store_google)||(t.save_campaign_params=e.store_google),Rt(e.verbose)||(t.debug=e.verbose);var n=ao({},t,e);return Us(e.property_blacklist)&&(Rt(e.property_denylist)?n.property_denylist=e.property_blacklist:Us(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ft.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class RLn{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(t){Ft.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class t4{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){this.webPerformance=new RLn,this.Sr=!1,this.version=eh.LIB_VERSION,this.Er=new Vse,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=dTe(),this.SentryIntegration=N4n,this.sentryIntegration=t=>(function(n,r){var s=Ret(n,r);return{name:Aet,processEvent:a=>s(a)}})(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.$r=!1,this.kr=null,this.Pr=null,this.Tr=null,this.featureFlags=new uLn(this),this.toolbar=new A4n(this),this.scrollManager=new OLn(this),this.pageViewManager=new X4n(this),this.surveys=new bLn(this),this.experiments=new _i(this),this.exceptions=new iLn(this),this.rateLimiter=new yLn(this),this.requestRouter=new CLn(this),this.consent=new O4n(this),this.externalIntegrations=new ALn(this),this.people={set:(t,n,r)=>{var s=Po(t)?{[t]:n}:t;this.setPersonProperties(s),r?.({})},set_once:(t,n,r)=>{var s=Po(t)?{[t]:n}:t;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",(t=>Ft.info('send "'+t?.event+'"',t)))}init(t,n,r){if(r&&r!==Gx){var s,a=(s=Nk[r])!==null&&s!==void 0?s:new t4;return a._init(t,n,r),Nk[r]=a,Nk[Gx][r]=a,a}return this._init(t,n,r)}_init(t,n,r){var s;if(n===void 0&&(n={}),Rt(t)||GZ(t))return Ft.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Rr(n.debug),this.Ir=n,this.Fr=[],n.person_profiles&&(this.Pr=n.person_profiles),this.set_config(ao({},dTe(n.defaults),fTe(n),{name:r,token:t})),this.config.on_xhr_error&&Ft.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:lh.GZipJS;var a=this.Cr();this.persistence=new fQ(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new fQ(Xt({},this.config,{persistence:"sessionStorage"}),a);var o=Xt({},this.persistence.props),i=Xt({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Mr=new xLn((w=>this.Or(w)),this.config.request_queue_config),this.Ar=new SLn(this),this.__request_queue=[];var c=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new lTe(this),this.sessionPropsManager=new iTe(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ft.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(c)}),0)):(Ft.info("Initializing extensions synchronously"),this.Dr(c)),eh.DEBUG=eh.DEBUG||this.config.debug,eh.DEBUG&&Ft.info("Starting in debug mode",{this:this,config:n,thisC:Xt({},this.config),p:o,s:i}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,d,f=this.config.get_device_id(Km()),p=(u=n.bootstrap)!=null&&u.isIdentifiedID?f:n.bootstrap.distinctID;this.persistence.set_property(th,(d=n.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:p})}if(this.jr()){var h,g,b=Object.keys(((h=n.bootstrap)==null?void 0:h.featureFlags)||{}).filter((w=>{var O;return!((O=n.bootstrap)==null||(O=O.featureFlags)==null||!O[w])})).reduce(((w,O)=>{var _;return w[O]=((_=n.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[O])||!1,w}),{}),y=Object.keys(((g=n.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter((w=>b[w])).reduce(((w,O)=>{var _,C;return(_=n.bootstrap)!=null&&(_=_.featureFlagPayloads)!=null&&_[O]&&(w[O]=(C=n.bootstrap)==null||(C=C.featureFlagPayloads)==null?void 0:C[O]),w}),{});this.featureFlags.receivedFeatureFlags({featureFlags:b,featureFlagPayloads:y})}if(c)this.register_once({distinct_id:lO,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(Km());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(th,"anonymous")}return vo(Ge,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?T4n(this,(()=>this.Lr())):this.Lr(),ug(this.config._onCapture)&&this.config._onCapture!==hY&&(Ft.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(w=>this.config._onCapture(w.event,w)))),this.config.ip&&Ft.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Dr(t){var n=performance.now();this.historyAutocapture=new C4n(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new I4n(this).startIfEnabledOrStop()})),r.push((()=>{var s;this.siteApps=new ELn(this),(s=this.siteApps)==null||s.init()})),t||r.push((()=>{this.sessionRecording=new uTe(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new m4n(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.heatmaps=new Y4n(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new W4n(this)})),r.push((()=>{this.exceptionObserver=new E4n(this),this.exceptionObserver.startIfEnabled()})),r.push((()=>{this.deadClicksAutocapture=new jet(this,_4n),this.deadClicksAutocapture.startIfEnabled()})),r.push((()=>{if(this.Nr){var s=this.Nr;this.Nr=void 0,this.fi(s)}})),this.Ur(r,n)}Ur(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Ur(t,n)}),0);var r=t.shift();if(r)try{r()}catch(a){Ft.error("Error initializing extension:",a)}}var s=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&Ft.info("PostHog extensions initialized ("+s+"ms)")}fi(t){var n,r,s,a,o,i,c,u;if(!$t||!$t.body)return Ft.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fi(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Nr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=kr(t.supportedCompression,lh.GZipJS)?lh.GZipJS:kr(t.supportedCompression,lh.Base64)?lh.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pr?this.Pr:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(t),(s=this.sessionRecording)==null||s.onRemoteConfig(t),(a=this.autocapture)==null||a.onRemoteConfig(t),(o=this.heatmaps)==null||o.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(i=this.webVitalsAutocapture)==null||i.onRemoteConfig(t),(c=this.exceptionObserver)==null||c.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(t)}Lr(){try{this.config.loaded(this)}catch(t){Ft.critical("`loaded` function failed",t)}this.zr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Hr()}),1),new vLn(this).load(),this.featureFlags.flags()}zr(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Mr)==null||t.enable())}_dom_loaded(){this.is_capturing()&&fg(this.__request_queue,(t=>this.Or(t))),this.__request_queue=[],this.zr()}_handle_unload(){var t,n;this.config.request_batching?(this.Br()&&this.capture("$pageleave"),(t=this.Mr)==null||t.unload(),(n=this.Ar)==null||n.unload()):this.Br()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(t){this.__loaded&&(dtt?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=aM(t.url,{ip:this.config.ip?1:0}),t.headers=Xt({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,s,a,o=Xt({},n);o.timeout=o.timeout||6e4,o.url=aM(o.url,{_:new Date().getTime().toString(),ver:eh.LIB_VERSION,compression:o.compression});var i=(r=o.transport)!==null&&r!==void 0?r:"fetch",c=xR.filter((d=>!o.disableTransport||!d.transport||!o.disableTransport.includes(d.transport))),u=(s=(a=uet(c,(d=>d.transport===i)))==null?void 0:a.method)!==null&&s!==void 0?s:c[0].method;if(!u)throw new Error("No available transport method");u(o)})(Xt({},t,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(s=this.config).on_request_error)==null||r.call(s,n)),t.callback==null||t.callback(n)}}))))}Or(t){this.Ar?this.Ar.retriableRequest(t):this.ci(t)}_execute_array(t){var n,r=[],s=[],a=[];fg(t,(i=>{i&&(n=i[0],Us(n)?a.push(i):ug(i)?i.call(this):Us(i)&&n==="alias"?r.push(i):Us(i)&&n.indexOf("capture")!==-1&&ug(this[n])?a.push(i):s.push(i))}));var o=function(i,c){fg(i,(function(u){if(Us(u[0])){var d=c;ea(u,(function(f){d=d[f[0]].apply(d,f.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),c)};o(r,this),o(s,this),o(a,this)}jr(){var t,n;return((t=this.config.bootstrap)==null?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mr){if(this.is_capturing())if(!Rt(t)&&Po(t)){var a=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(a&&!this.config.__preview_capture_bot_pageviews)){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){n!=null&&n.$current_url&&!Po(n?.$current_url)&&(Ft.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var i=new Date,c=r?.timestamp||i,u=Km(),d={uuid:u,event:t,properties:this.calculateEventProperties(t,n||{},c,u)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&a&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r?.$set&&(d.$set=r?.$set);var f,p=this.qr(r?.$set_once);if(p&&(d.$set_once=p),(d=K2n(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,Rt(r?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=i),t===wR.DISMISSED||t===wR.SENT){var h=n?.[sTe.SURVEY_ID],g=n?.[sTe.SURVEY_ITERATION];f={id:h,current_iteration:g},localStorage.getItem(aTe(f))||localStorage.setItem(aTe(f),"true"),d.$set=Xt({},d.$set,{[pLn({id:h,current_iteration:g},t===wR.SENT?"responded":"dismissed")]:!0})}var b=Xt({},d.properties.$set,d.$set);if(u0(b)||this.setPersonPropertiesForFlags(b),!Ps(this.config.before_send)){var y=this.Wr(d);if(!y)return;d=y}this.Er.emit("eventCaptured",d);var x={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Or(x):this.Mr.enqueue(x),d}Ft.critical("This capture call is ignored due to client rate limiting.")}}else Ft.error("No event name provided to posthog.capture")}else Ft.uninitializedWarning("posthog.capture")}Ai(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,r,s,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=a?void 0:this.persistence.remove_event_timer(t),i=Xt({},n);if(i.token=this.config.token,i.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(i.$cookieless_mode=!0),t==="$snapshot"){var c=Xt({},this.persistence.properties(),this.sessionPersistence.properties());return i.distinct_id=c.distinct_id,(!Po(i.distinct_id)&&!op(i.distinct_id)||GZ(i.distinct_id))&&Ft.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),i}var u,d=G4n(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime());i.$session_id=f,i.$window_id=p}this.sessionPropsManager&&ao(i,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&ao(i,this.sessionRecording.sdkDebugProperties),i.$sdk_debug_retry_queue_size=(h=this.Ar)==null?void 0:h.length}catch(x){i.$sdk_debug_error_capturing_properties=String(x)}if(this.requestRouter.region===qO.CUSTOM&&(i.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||a?t!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),i=ao(i,u),t==="$pageview"&&$t&&(i.title=$t.title),!Rt(o)){var g=r.getTime()-o;i.$duration=parseFloat((g/1e3).toFixed(3))}Il&&this.config.opt_out_useragent_filter&&(i.$browser_type=this._is_bot()?"bot":"browser"),(i=ao({},d,this.persistence.properties(),this.sessionPersistence.properties(),i)).$is_identified=this._isIdentified(),Us(this.config.property_denylist)?ea(this.config.property_denylist,(function(x){delete i[x]})):Ft.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Ft.error("sanitize_properties is deprecated. Use before_send instead"),i=b(i,t));var y=this.Gr();return i.$process_person_profile=y,y&&!a&&this.Vr("_calculate_event_properties"),i}qr(t){var n;if(!this.persistence||!this.Gr()||this.Sr)return t;var r=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),a=ao({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Ft.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),this.Sr=!0,u0(a)?void 0:a}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var s;(s=this.persistence)==null||s.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Jr(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.Er.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}displaySurvey(t,n){n===void 0&&(n=mLn),this.surveys.displaySurvey(t,n)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(t,n)}identify(t,n,r){if(!this.__loaded||!this.persistence)return Ft.uninitializedWarning("posthog.identify");if(op(t)&&(t=t.toString(),Ft.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Ft.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==lO){if(this.Vr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var a=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}t!==s&&t!==this.get_property(DO)&&(this.unregister(DO),this.register({distinct_id:t}));var o=(this.persistence.get_property(th)||"anonymous")==="anonymous";t!==s&&o?(this.persistence.set_property(th,"identified"),this.setPersonPropertiesForFlags(Xt({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.Tr=JCe(t,n,r),this.featureFlags.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),t!==s&&(this.reloadFeatureFlags(),this.unregister(ZP))}}else Ft.critical('The string "'+lO+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ft.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this.Vr("posthog.setPersonProperties")){var r=JCe(this.get_distinct_id(),t,n);this.Tr!==r?(this.setPersonPropertiesForFlags(Xt({},n||{},t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Tr=r):Ft.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this.Vr("posthog.group")){var s=this.getGroups();s[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Xt({},s,{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),s[t]===n||r||this.reloadFeatureFlags()}}else Ft.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0),this.Vr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,s,a;if(Ft.info("reset"),!this.__loaded)return Ft.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(th,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Tr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:lO,$device_id:null},"");else{var i=this.config.get_device_id(Km());this.register_once({distinct_id:i,$device_id:t?i:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&r){var a,o=(a=t.timestampLookBack)!==null&&a!==void 0?a:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(t,n){return t===this.get_property(det)?(Ft.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vr("posthog.alias")?(Rt(n)&&(n=this.get_distinct_id()),t!==n?(this.Jr(DO,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Ft.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Xt({},this.config);if(Qo(t)){var r,s,a,o,i;ao(this.config,fTe(t));var c=this.Cr();(r=this.persistence)==null||r.update_config(this.config,n,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new fQ(Xt({},this.config,{persistence:"sessionStorage"}),c);var u=this.Rr(this.config.debug);dg(u)&&(this.config.debug=u),dg(this.config.debug)&&(this.config.debug?(eh.DEBUG=!0,Aa.H()&&Aa.G("ph_debug","true"),Ft.info("set_config",{config:t,oldConfig:n,newConfig:Xt({},this.config)})):(eh.DEBUG=!1,Aa.H()&&Aa.V("ph_debug"))),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),this.surveys.loadIfEnabled(),this.Kr(),(i=this.externalIntegrations)==null||i.startIfEnabledOrStop()}}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var s,a,o,i,c;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),r.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Xt({},s,n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Gx;return n!==Gx&&(n=Gx+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(th))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(th))==="identified"}Gr(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&u0(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[DO])&&((n=this.persistence)==null||(n=n.props)==null||!n[XP]))}Br(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gr()||this.Vr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vr(t){return this.config.person_profiles==="never"?(Ft.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Jr(XP,!0),!0)}Cr(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||t&&!!n}Kr(){var t,n,r,s,a=this.Cr();return((t=this.persistence)==null?void 0:t.wi)!==a&&((r=this.persistence)==null||r.set_disabled(a)),((n=this.sessionPersistence)==null?void 0:n.wi)!==a&&((s=this.sessionPersistence)==null||s.set_disabled(a)),a}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){var r,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(r=this.sessionManager)==null||r.destroy(),this.sessionManager=new lTe(this),this.persistence&&(this.sessionPropsManager=new iTe(this,this.sessionManager,this.persistence)),this.sessionRecording=new uTe(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Kr(),this.zr(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(Rt(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((s=t?.captureEventName)!==null&&s!==void 0?s:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Hr()}else Ft.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,n;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Kr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:lO,$device_id:null}),(t=this.sessionManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.Hr())):Ft.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===nh.GRANTED?"granted":t===nh.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Kr()}_is_bot(){return Bc?utt(Bc,this.config.custom_blocked_useragents):void 0}Hr(){$t&&($t.visibilityState==="visible"?this.$r||(this.$r=!0,this.capture("$pageview",{title:$t.title},{send_instantly:!0}),this.kr&&($t.removeEventListener("visibilitychange",this.kr),this.kr=null)):this.kr||(this.kr=this.Hr.bind(this),vo($t,"visibilitychange",this.kr)))}debug(t){t===!1?(Ge?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ge?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}O(){var t,n,r,s,a,o,i,c=this.Ir||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Ft.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",s=!1,a=Ft,o=(n="advanced_disable_flags")in(t=c)&&!Rt(t[n]),i=r in t&&!Rt(t[r]),o?t[n]:i?(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[r]):s)}Wr(t){if(Ps(this.config.before_send))return t;var n=Us(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var s of n){if(r=s(r),Ps(r)){var a="Event '"+t.event+"' was rejected in beforeSend function";return _2n(t.event)?Ft.warn(a+". This can cause unexpected behavior."):Ft.info(a),null}r.properties&&!u0(r.properties)||Ft.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var t;return(t=this.pageViewManager.Vt)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Rr(t){var n=dg(t)&&!t,r=Aa.H()&&Aa.q("ph_debug")==="true";return!n&&(!!r||t)}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=X2n(e.prototype[t[n]])})(t4,["identify"]);var pTe,ch=(pTe=Nk[Gx]=new t4,(function(){function e(){e.done||(e.done=!0,dtt=!1,ea(Nk,(function(t){t._dom_loaded()})))}$t!=null&&$t.addEventListener?$t.readyState==="complete"?e():vo($t,"DOMContentLoaded",e,{capture:!1}):Ge&&Ft.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),pTe),ftt=S.createContext({client:ch,bootstrap:void 0});function ptt(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(var a=0,o=r;a<o.length;a++){var i=o[a];if(!s.includes(i)||!ptt(e[i],t[i],n))return!1}return!0}function ILn(e){var t,n,r=e.children,s=e.client,a=e.apiKey,o=e.options,i=S.useRef(null),c=S.useMemo(function(){return s?(a&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),o&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),s):(a||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),ch)},[s,a,JSON.stringify(o)]);return S.useEffect(function(){if(!s){var u=i.current;u?(a!==u.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),o&&!ptt(o,u.options)&&ch.set_config(o),i.current={apiKey:a,options:o??{}}):(ch.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),ch.init(a,o),i.current={apiKey:a,options:o??{}})}},[s,a,JSON.stringify(o)]),xe.createElement(ftt.Provider,{value:{client:c,bootstrap:(t=o?.bootstrap)!==null&&t!==void 0?t:(n=s?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var mQ=function(e){return typeof e=="function"},mY=function(e,t){return mY=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},mY(e,t)};function PLn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");mY(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var MLn={componentStack:null,exceptionEvent:null,error:null},$Ln={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){PLn(t,e);function t(n){var r=e.call(this,n)||this;return r.state=MLn,r}return t.prototype.componentDidCatch=function(n,r){var s=this.props.additionalProperties,a;mQ(s)?a=s(n):typeof s=="object"&&(a=s);var o=this.context.client,i=o.captureException(n,a),c=r.componentStack;this.setState({error:n,componentStack:c,exceptionEvent:i})},t.prototype.render=function(){var n=this.props,r=n.children,s=n.fallback,a=this.state;if(a.componentStack==null)return mQ(r)?r():r;var o=mQ(s)?xe.createElement(s,{error:a.error,componentStack:a.componentStack,exceptionEvent:a.exceptionEvent}):s;return xe.isValidElement(o)?o:(console.warn($Ln.INVALID_FALLBACK),xe.createElement(xe.Fragment,null))},t.contextType=ftt,t})(xe.Component);function DLn({children:e}){return S.useEffect(()=>{if("brave"in navigator){console.info("[Analytics]: Telemetry is disabled for browser constraints.");return}if(window.MASTRA_TELEMETRY_DISABLED){console.info("[Analytics]: Telemetry is disabled.");return}ch.init("phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",{api_host:"https://us.posthog.com"}),ch.register({mastraSource:"playground"})},[]),l.jsx(ILn,{client:ch,children:e})}const LLn=["/swagger-ui","/openapi.json"],FLn=S.forwardRef(({children:e,href:t,...n},r)=>t&&LLn.some(a=>t.startsWith(a))?l.jsx("a",{ref:r,href:t,...n,children:e}):l.jsx(Dt,{ref:r,to:t,viewTransition:!0,...n,children:e}));function zLn(){const{navigate:e}=Gt(),{data:t={},isLoading:n,error:r}=of(),{isCmsAvailable:s}=qh(),{canEdit:a}=xp(),o=s&&a("stored-agents"),i=()=>{e("/cms/agents/create")};return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/agents/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Agents Documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[90rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(gt,{children:[l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:n,children:[l.jsx($o,{})," Agents"]})}),o&&l.jsx(gt.Column,{children:l.jsxs(me,{as:Dt,to:"/cms/agents/create",variant:"primary",children:[l.jsx($D,{}),"Create Agent"]})})]}),l.jsx(vEn,{agents:t,isLoading:n,error:r,onCreateClick:o?i:void 0})]})})]})}function BLn({agentId:e,threadId:t,threads:n,isLoading:r}){const{mutateAsync:s}=nEn(),{paths:a,navigate:o}=Gt(),i=async c=>{await s({threadId:c,agentId:e}),c===t&&o(a.agentNewThreadLink(e))};return l.jsx(cTn,{resourceId:e,resourceType:"agent",threads:n||[],isLoading:r,threadId:t,onDelete:i})}function hTe(){const{agentId:e,threadId:t}=fa(),[n]=Gi(),{data:r,isLoading:s,error:a}=Bh(e),{data:o}=cT(e),i=fu(),c=t==="new",u=S.useMemo(()=>xo(),[t]),d=!!o?.result,{data:f,isLoading:p,refetch:h}=tEn({agentId:e,isMemoryEnabled:d,resourceId:e});S.useEffect(()=>{d&&(t||i(`/agents/${e}/chat/new`))},[d,t,e,i]);const g=n.get("messageId")??void 0,b=S.useMemo(()=>{if(!r)return{modelSettings:{}};const w=r.defaultOptions,{maxOutputTokens:O,..._}=w?.modelSettings??{};return{modelSettings:{..._,...O!==void 0&&{maxTokens:O},...w?.maxSteps!==void 0&&{maxSteps:w.maxSteps},...w?.providerOptions!==void 0&&{providerOptions:w.providerOptions}}}},[r]);if(a&&ta(a))return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"agents"})});if(s)return null;if(!r)return l.jsx("div",{className:"text-center py-4",children:"Agent not found"});const y=c?u:t,x=async()=>{await h(),c&&i(`/agents/${e}/chat/${u}`)};return l.jsx(BZe,{entityId:e,entityType:"agent",children:l.jsx(MYe,{agentId:e,defaultSettings:b,children:l.jsx(j2,{children:l.jsx(G_n,{agentId:e,threadId:y,resourceId:e,children:l.jsx(__n,{children:l.jsx(J_n,{children:l.jsx(Ukn,{children:l.jsx(ITn,{agentId:e,leftSlot:d&&l.jsx(BLn,{agentId:e,threadId:y,threads:f||[],isLoading:p}),rightSlot:l.jsx(jTn,{agentId:e,threadId:y}),children:l.jsx(BYe,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:y,memory:d,refreshThreadList:x,modelList:r?.modelList,messageId:g,isNewThread:c},y)})},`${e}-${y}`)})})})})})})}function ULn(){const{agentId:e}=fa(),[t,n]=S.useState(null),{data:r,isLoading:s,error:a}=Bh(e),{data:o,isLoading:i}=TXe(e,{status:"draft"}),{data:c}=cT(e),u=r?.source==="code",d=s||i,f=!!c?.result,{data:p}=NXe({agentId:e??"",versionId:t??""}),{data:h}=L2({agentId:e??"",params:{sortDirection:"DESC"}}),g=o?.activeVersionId,b=h?.versions?.[0],y=!!(b&&b.id!==g),x=!!t&&!!p,w=x&&t!==b?.id,O=S.useMemo(()=>x&&p?p:o||(r?LKe(r):{}),[x,p,o,r]),{form:_,handlePublish:C,handleSaveDraft:E,isSubmitting:T,isSavingDraft:N,isDirty:A}=bse({mode:"edit",agentId:e??"",dataSource:O,isCodeAgentOverride:u,hasStoredOverride:u&&!!o,onSuccess:()=>{}}),I=S.useCallback(P=>{P===b?.id?n(null):n(P)},[b?.id]);return a&&ta(a)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"agents"})}):d?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Tn,{className:"h-6 w-6"})}):r?l.jsx(j2,{children:l.jsx(FYe,{form:_,mode:"edit",agentId:e,isSubmitting:T,isSavingDraft:N,handlePublish:C,handleSaveDraft:E,isCodeAgentOverride:u,readOnly:w,children:l.jsx(_An,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,hasMemory:f,activeVersionId:g,selectedVersionId:t??void 0,latestVersionId:b?.id,requestContextSchema:r?.requestContextSchema,onVersionSelect:I,isDirty:A,isSavingDraft:N,isPublishing:T,hasDraft:y,readOnly:w,onSaveDraft:E,onPublish:C})})}):l.jsx("div",{className:"text-center py-4",children:"Agent not found"})}function qLn(){const{agentId:e}=fa();return l.jsx(nRn,{agentId:e})}function VLn(){return l.jsx(njn,{})}function QLn(){const{navigate:e,paths:t}=Gt(),n=Sl(),{form:r,handlePublish:s,isSubmitting:a,canPublish:o}=bse({mode:"create",onSuccess:i=>e(t.agentLink(i))});return l.jsxs(jn,{children:[l.jsxs(Vn,{className:"bg-surface1",children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx($o,{})}),"Create an agent"]}),l.jsx(Va,{children:l.jsx(me,{variant:"primary",onClick:s,disabled:a||!o,className:"w-full",children:a?l.jsxs(l.Fragment,{children:[l.jsx(Tn,{className:"h-4 w-4"}),"Creating..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Te,{children:l.jsx(Y8e,{})}),"Create agent"]})})})]}),l.jsx(FKe,{form:r,mode:"create",isSubmitting:a,handlePublish:s,basePath:"/cms/agents/create",currentPath:n.pathname,children:l.jsx(EE,{})})]})}function mTe({agentId:e,selectedVersionId:t,versionData:n,readOnly:r=!1,form:s,handlePublish:a,handleSaveDraft:o,isSubmitting:i,isSavingDraft:c,onVersionSelect:u,activeVersionId:d,latestVersionId:f,hideVersionPanel:p=!1,isCodeAgentOverride:h=!1}){const[,g]=Gi(),b=Sl(),w=!!t&&!!n&&t!==f?l.jsxs(Ld,{variant:"info",className:"mb-4",children:[l.jsx(Fd,{children:"This is a previous version"}),l.jsx(Pg,{as:"p",children:"You are seeing a specific version of the agent."}),l.jsx("div",{className:"pt-2",children:l.jsx(me,{type:"button",variant:"light",size:"sm",onClick:()=>g({}),children:"View latest version"})})]}):void 0,O=p?void 0:l.jsx(tAn,{agentId:e,selectedVersionId:t??void 0,onVersionSelect:u,activeVersionId:d});return l.jsx(FKe,{form:s,mode:"edit",agentId:e,isSubmitting:i,isSavingDraft:c,handlePublish:a,handleSaveDraft:o,readOnly:r,isCodeAgentOverride:h,basePath:`/cms/agents/${e}/edit`,currentPath:b.pathname,banner:w,versionId:t??void 0,rightPanel:O,children:l.jsx(EE,{})})}function HLn(){const{agentId:e}=fa(),{navigate:t,paths:n}=Gt(),r=fu(),s=Sl(),[a,o]=Gi(),i=a.get("versionId"),{data:c,isLoading:u}=Bh(e),{data:d,isLoading:f}=TXe(e,{status:"draft"}),p=c?.source==="code",h=d??null,g=u||f,b=`/cms/agents/${e}/edit`,y=s.pathname===b||s.pathname===`${b}/`;S.useEffect(()=>{p&&y&&r(`${b}/instruction-blocks${s.search}${s.hash}`,{replace:!0})},[p,y,r,b,s.search,s.hash]);const{data:x}=NXe({agentId:e??"",versionId:i??""}),{data:w}=L2({agentId:e??"",params:{sortDirection:"DESC"}}),O=h?.activeVersionId,_=w?.versions?.[0],C=!!(_&&_.id!==O),E=!!i&&!!x,T=S.useMemo(()=>E&&x?x:h||(c?LKe(c):{}),[E,x,h,c]),N=h?.name??c?.name,{form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:$,isSavingDraft:U,isDirty:L}=bse({mode:"edit",agentId:e??"",dataSource:T,isCodeAgentOverride:p,hasStoredOverride:p&&!!d,onSuccess:V=>t(n.agentLink(V))}),B=S.useCallback(V=>{o(V?{versionId:V}:{})},[o]),H=!g&&!h&&!c,q=!g&&!!e&&(!!h||!!c);return l.jsxs(jn,{children:[l.jsxs(Vn,{className:"bg-surface1",children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx($o,{})}),g&&l.jsx(cr,{className:"h-6 w-[200px]"}),H&&"Agent not found",q&&`Edit agent: ${N}`,q&&C&&l.jsx(_t,{variant:"info",children:"Unpublished changes"})]}),q&&l.jsxs(Va,{children:[l.jsx(me,{onClick:P,disabled:!L||U||$,children:U?l.jsxs(l.Fragment,{children:[l.jsx(Tn,{className:"h-4 w-4"}),"Saving..."]}):l.jsxs(l.Fragment,{children:[l.jsx(wqt,{}),"Save"]})}),l.jsx(me,{variant:"primary",onClick:I,disabled:!C&&!L||$||U,children:$?l.jsxs(l.Fragment,{children:[l.jsx(Tn,{className:"h-4 w-4"}),"Publishing..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Y8e,{}),"Publish"]})})]})]}),H?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Agent not found"}),l.jsx("div",{className:"hidden",children:l.jsx(mTe,{agentId:e??"",selectedVersionId:i,versionData:x,readOnly:!0,form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:$,isSavingDraft:U,onVersionSelect:B,activeVersionId:O,latestVersionId:_?.id})})]}):l.jsx(mTe,{agentId:e??"",selectedVersionId:i,versionData:x,form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:$,isSavingDraft:U,onVersionSelect:B,activeVersionId:O,latestVersionId:_?.id,hideVersionPanel:p&&!d,isCodeAgentOverride:p})]})}function GLn(){return l.jsx(LNn,{})}function WLn(){return l.jsx(uKe,{})}function ZLn(){return l.jsx(ojn,{})}function YLn(){return l.jsx(rjn,{})}function XLn(){return l.jsx(Vjn,{})}function KLn(){return l.jsx(pKe,{})}function JLn(){return l.jsx(hjn,{})}function e3n(){return l.jsx(ajn,{})}function t3n(){const{navigate:e,paths:t}=Gt();return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(uk,{})}),"Create a prompt block"]})}),l.jsx(eNn,{onSuccess:n=>e(t.cmsPromptBlockEditLink(n.id))})]})}function gTe(e){return{name:e.name,description:e.description||void 0,content:e.content,rules:e.rules||void 0,requestContextSchema:e.variables||void 0}}function n3n({block:e,blockId:t,selectedVersionId:n,hasDraft:r}){const s=Xe(),a=Ts(),{navigate:o,paths:i}=Gt(),{updateStoredPromptBlock:c}=GXe(t),[u,d]=S.useState(!1),[f,p]=S.useState(!1),{data:h}=sNn({blockId:t,versionId:n??""}),g=!!n&&!!h,b=g?h:e,y=S.useMemo(()=>({name:b.name||"",description:b.description||"",content:b.content||"",rules:b.rules,variables:b.requestContextSchema}),[b]),{form:x}=VXe({initialValues:y}),[w,O]=S.useState(0);S.useEffect(()=>{y&&!x.formState.isDirty&&(x.reset(y),O(E=>E+1))},[y,x]);const _=S.useCallback(async()=>{if(!await x.trigger()){qe.error("Please fill in all required fields");return}p(!0);try{const T=gTe(x.getValues());await c.mutateAsync(T),x.reset(x.getValues()),qe.success("Draft saved")}catch(T){qe.error(`Failed to save draft: ${T instanceof Error?T.message:"Unknown error"}`)}finally{p(!1)}},[x,c]),C=S.useCallback(async()=>{if(!await x.trigger()){qe.error("Please fill in all required fields");return}d(!0);try{const T=gTe(x.getValues());await c.mutateAsync(T);const A=(await s.getStoredPromptBlock(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];if(!A)throw new Error("No version found to publish");await s.getStoredPromptBlock(t).activateVersion(A.id),a.invalidateQueries({queryKey:["stored-prompt-blocks"]}),a.invalidateQueries({queryKey:["stored-prompt-block"]}),a.invalidateQueries({queryKey:["prompt-block-versions",t]}),qe.success("Prompt block published"),o(i.promptBlocksLink())}catch(T){qe.error(`Failed to publish: ${T instanceof Error?T.message:"Unknown error"}`)}finally{d(!1)}},[x,c,s,t,o,i,a]);return l.jsxs(Dg,{leftSlot:l.jsx(UXe,{form:x,onPublish:C,onSaveDraft:_,isSubmitting:u,isSavingDraft:f,isDirty:x.formState.isDirty,hasDraft:r,formResetKey:w,mode:"edit"}),children:[g&&l.jsxs(Ld,{variant:"info",className:"m-4 mb-0",children:[l.jsx(Fd,{children:"This is a previous version"}),l.jsx(Pg,{as:"p",children:"You are seeing a specific version of the prompt block."})]}),l.jsx("form",{className:"h-full",children:l.jsx(qXe,{form:x})})]})}function r3n(){const{promptBlockId:e}=fa(),[t,n]=Gi(),r=t.get("versionId"),{data:s,isLoading:a}=HXe(e,{status:"draft"}),{data:o}=WXe({blockId:e??"",params:{sortDirection:"DESC"}}),i=s?.activeVersionId,c=o?.versions?.[0],u=!!(c&&(!i||c.id!==i)),d=S.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return a?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(uk,{})}),l.jsx(cr,{className:"h-6 w-[200px]"})]})}),l.jsx(Dg,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Tn,{className:"h-8 w-8"})}),children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Tn,{className:"h-8 w-8"})})})]}):!s||!e?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(uk,{})}),"Prompt block not found"]})}),l.jsx(Dg,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"}),children:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(uk,{})}),"Edit prompt block: ",s.name,u&&l.jsx(_t,{variant:"info",children:"Unpublished changes"})]}),l.jsx(Va,{children:l.jsx(oNn,{blockId:e,value:r??"",onValueChange:d,activeVersionId:i})})]}),l.jsx(n3n,{block:s,blockId:e,selectedVersionId:r,hasDraft:u})]})}function s3n(){const{navigate:e,paths:t}=Gt();return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(yh,{})}),"Create a scorer"]})}),l.jsx(MCn,{onSuccess:n=>e(t.scorerLink(n.id))})]})}function bTe(e){return{name:e.name,description:e.description||void 0,type:e.type,model:e.model,instructions:e.instructions||void 0,scoreRange:e.scoreRange,defaultSampling:e.defaultSampling?.type==="ratio"&&typeof e.defaultSampling.rate=="number"?e.defaultSampling:{type:"none"}}}function a3n({scorer:e,scorerId:t,selectedVersionId:n}){const r=Xe(),s=Ts(),{navigate:a,paths:o}=Gt(),{updateStoredScorer:i}=cXe(t),[c,u]=S.useState(!1),[d,f]=S.useState(!1),p=S.useRef(null),{data:h}=DCn({scorerId:t,versionId:n??""}),g=!!n&&!!h,b=g?h:e,y=S.useMemo(()=>({name:b.name||"",description:b.description||"",type:"llm-judge",model:{provider:b.model?.provider||"",name:b.model?.name||""},instructions:b.instructions||"",scoreRange:{min:b.scoreRange?.min??0,max:b.scoreRange?.max??1},defaultSampling:b.defaultSampling}),[b]),{form:x}=lXe({initialValues:y});S.useEffect(()=>{y&&x.reset(y)},[y,x]);const w=S.useCallback(async()=>{if(!await x.trigger()){qe.error("Please fill in all required fields");return}f(!0);try{const C=bTe(x.getValues());await i.mutateAsync(C),qe.success("Draft saved")}catch(C){qe.error(`Failed to save draft: ${C instanceof Error?C.message:"Unknown error"}`)}finally{f(!1)}},[x,i]),O=S.useCallback(async()=>{if(!await x.trigger()){qe.error("Please fill in all required fields");return}u(!0);try{const C=bTe(x.getValues());await i.mutateAsync(C);const T=(await r.getStoredScorer(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];T&&await r.getStoredScorer(t).activateVersion(T.id),s.invalidateQueries({queryKey:["scorers"]}),s.invalidateQueries({queryKey:["stored-scorers"]}),qe.success("Scorer published"),a(o.scorerLink(t))}catch(C){qe.error(`Failed to publish scorer: ${C instanceof Error?C.message:"Unknown error"}`)}finally{u(!1)}},[x,i,r,t,a,o,s]);return l.jsxs(Dg,{leftSlot:l.jsx(oXe,{form:x,onPublish:O,onSaveDraft:w,isSubmitting:c,isSavingDraft:d,formRef:p,mode:"edit"}),children:[g&&l.jsxs(Ld,{variant:"info",className:"m-4 mb-0",children:[l.jsx(Fd,{children:"This is a previous version"}),l.jsx(Pg,{as:"p",children:"You are seeing a specific version of the scorer."})]}),l.jsx("form",{ref:p,className:"h-full",children:l.jsx(iXe,{form:x})})]})}function o3n(){const{scorerId:e}=fa(),[t,n]=Gi(),r=t.get("versionId"),{data:s,isLoading:a}=PCn(e,{status:"draft"}),{data:o}=uXe({scorerId:e??"",params:{sortDirection:"DESC"}}),i=s?.activeVersionId,c=o?.versions?.[0],u=!!(c&&i&&c.id!==i),d=S.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return a?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(yh,{})}),l.jsx(cr,{className:"h-6 w-[200px]"})]})}),l.jsx(Dg,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Tn,{className:"h-8 w-8"})}),children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Tn,{className:"h-8 w-8"})})})]}):!s||!e?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(yh,{})}),"Scorer not found"]})}),l.jsx(Dg,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"}),children:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(yh,{})}),"Edit scorer: ",s.name,u&&l.jsx(_t,{variant:"info",children:"Unpublished changes"})]}),l.jsx(Va,{children:l.jsx(FCn,{scorerId:e,value:r??"",onValueChange:d,variant:"outline",activeVersionId:i})})]}),l.jsx(a3n,{scorer:s,scorerId:e,selectedVersionId:r})]})}function i3n(){const[e,t]=S.useState(!1),{navigate:n,paths:r}=Gt(),{data:s,isLoading:a,error:o}=$v(),i=s?.datasets??[],c=u=>{t(!1),n(r.datasetLink(u))};return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/docs/observability/datasets/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Datasets documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(gt,{children:[l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:a,children:[l.jsx(sc,{})," Datasets"]})}),l.jsx(gt.Column,{children:l.jsxs(me,{variant:"primary",onClick:()=>t(!0),children:[l.jsx($D,{}),"Create Dataset"]})})]}),l.jsx(XRn,{datasets:i,isLoading:a,onCreateClick:()=>t(!0),error:o})]})}),l.jsx(cIn,{open:e,onOpenChange:t,onSuccess:c})]})}function l3n(){const{datasetId:e}=fa(),t=fu(),[n,r]=S.useState(!1),[s,a]=S.useState(!1),[o,i]=S.useState(!1),[c,u]=S.useState(!1),[d,f]=S.useState(null),{data:p,error:h}=zh(e??"");if(!e)return l.jsx(jn,{children:l.jsx(xl,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(h&&ta(h))return l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})});const g=x=>{t(`/datasets/${e}/experiments/${x}`)},b=()=>{t("/datasets")},y=x=>{f(x?.version??null)};return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(BKe,{value:e,variant:"ghost"})})]})}),l.jsxs(xl,{className:"content-stretch",children:[l.jsx(iPn,{datasetId:e,onAddItemClick:()=>a(!0),onEditClick:()=>i(!0),onDeleteClick:()=>u(!0),activeDatasetVersion:d,onVersionSelect:y,experimentTriggerSlot:l.jsxs(me,{variant:"primary",onClick:()=>r(!0),children:[l.jsx(yqt,{}),d!=null?`Run on v${d}`:"Run Experiment"]})}),l.jsx(fPn,{datasetId:e,version:d??void 0,open:n,onOpenChange:r,onSuccess:g}),l.jsx(cPn,{datasetId:e,open:s,onOpenChange:a}),p&&l.jsx(pIn,{open:o,onOpenChange:i,dataset:{id:p.id,name:p.name,description:p?.description||"",inputSchema:p.inputSchema,groundTruthSchema:p.groundTruthSchema}}),p&&l.jsx(hIn,{open:c,onOpenChange:u,datasetId:p.id,datasetName:p.name,onSuccess:b})]})]})}function c3n(){const{datasetId:e,experimentId:t}=fa(),{data:n}=zh(e??""),{data:r,isLoading:s,error:a}=RZ(e,t),{data:o,isLoading:i,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=qKe({datasetId:e,experimentId:t,experimentStatus:r?.status});return!e||!t?null:s?l.jsx(jn,{children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Tn,{})})}):a&&ta(a)?l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})}):a||!r?l.jsx(jn,{children:l.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:Dt,to:`/datasets/${e}`,children:n?.name}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsx(IPn,{experimentId:t,experiment:r}),l.jsx(jPn,{experimentId:t,experimentStatus:r?.status,results:o??[],isLoading:i,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function u3n(){const{datasetId:e}=fa(),[t,n]=Gi(),{data:r,error:s}=zh(e??""),a=t.get("baseline")??"",o=t.get("contender")??"";return s&&ta(s)?l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})}):!e||!a||!o?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsxs(hn,{isCurrent:!0,as:"span",children:[l.jsx(Te,{children:l.jsx(fk,{})}),"Compare Experiments"]})]})}),l.jsx(xl,{children:l.jsxs("div",{className:"text-neutral4 text-center py-8",children:[l.jsx("p",{children:"Select two experiments to compare."}),l.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:Dt,to:`/datasets/${e}`,children:r?.name??e?.slice(0,8)}),l.jsxs(hn,{isCurrent:!0,as:"span",children:[l.jsx(Te,{children:l.jsx(fk,{})}),"Experiments Comparison"]})]})}),l.jsx(xl,{children:l.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[l.jsxs(gt,{children:[l.jsxs(gt.Column,{children:[l.jsxs(gt.Title,{children:[l.jsx(fk,{})," Dataset Experiments Comparison"]}),l.jsxs(gt.Description,{children:["Comparing"," ",l.jsx(Dt,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",l.jsx(Dt,{to:`/datasets/${e}/experiments/${o}`,children:o.slice(0,8)})]})]}),l.jsx(gt.Column,{children:l.jsxs(me,{as:Dt,to:`/datasets/${e}`,children:[l.jsx(gw,{}),"Back to Dataset"]})})]}),l.jsx(DPn,{datasetId:e,experimentIdA:a,experimentIdB:o,onSwap:()=>{n({baseline:o,contender:a})}})]})})]})}function d3n(){const{datasetId:e,itemId:t}=fa(),{Link:n}=Gt(),r=fu(),{data:s,isLoading:a,error:o}=vse(e??"",t??""),{updateItem:i,deleteItem:c}=Oi(),{data:u}=zh(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[p,h]=S.useState(null),g=S.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),b=d?.datasetVersion??0,[y,x]=S.useState(!1),[w,O]=S.useState(g.input),[_,C]=S.useState(g.groundTruth),[E,T]=S.useState(g.metadata),[N,A]=S.useState(b);b!==N&&(A(b),O(g.input),C(g.groundTruth),T(g.metadata));const[I,P]=S.useState(!1),$=z=>{h(f?z:z.isLatest?null:z)},U=()=>{h(null)},L=!f&&p!=null,B=()=>{L||x(!0)},H=()=>{L||P(!0)},q=async()=>{if(!e||!t)return;let z;try{z=JSON.parse(w)}catch{qe.error("Input must be valid JSON");return}let R;if(_.trim())try{R=JSON.parse(_)}catch{qe.error("Ground Truth must be valid JSON");return}let Q;if(E.trim())try{Q=JSON.parse(E)}catch{qe.error("Metadata must be valid JSON");return}try{await i.mutateAsync({datasetId:e,itemId:t,input:z,groundTruth:R,metadata:Q}),qe.success("Item updated successfully"),x(!1)}catch(G){qe.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},V=()=>{d&&(O(JSON.stringify(d.input,null,2)),C(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),qe.success("Item deleted successfully"),P(!1),r(`/datasets/${e}`)}catch(z){qe.error(`Failed to delete item: ${z instanceof Error?z.message:"Unknown error"}`)}},D=p??d,Z=D?{id:t??"",datasetId:e??"",datasetVersion:D.datasetVersion,input:D.input,groundTruth:D.groundTruth,metadata:D.metadata,createdAt:D.createdAt,updatedAt:D.updatedAt}:null;return o&&ta(o)?l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?l.jsx(jn,{children:l.jsx(xl,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):l.jsxs(l.Fragment,{children:[l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:Dt,to:`/datasets/${e}`,children:u?.name}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Item"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(gt,{children:[l.jsxs(gt.Column,{children:[l.jsxs(gt.Title,{children:[l.jsx(tqt,{}),t," ",l.jsx(Zo,{content:t})]}),l.jsx(gt.Description,{children:l.jsxs(Qr,{children:["Item of ",l.jsx(sc,{})," ",u?.name]})}),l.jsxs(gt.Description,{children:[l.jsxs(Qr,{children:[l.jsx(LUt,{})," Created at"," ",d?.createdAt?Gn(new Date(d.createdAt),"MMM d, yyyy"):""]}),l.jsxs(Qr,{children:[l.jsx(MD,{})," Latest version v",d?.datasetVersion??""]})]})]}),l.jsx(gt.Column,{children:!y&&!f&&l.jsxs(Mo,{children:[l.jsxs(me,{onClick:B,disabled:L,title:L?"Return to latest version to edit":void 0,children:[l.jsx(hqt,{})," Edit"]}),l.jsxs(me,{onClick:H,disabled:L,title:L?"Return to latest version to delete":void 0,children:[l.jsx(Nqt,{})," Delete"]})]})})]}),l.jsxs(eb,{className:y?"grid-cols-1":"grid-cols-[1fr_auto]",children:[l.jsxs(Yt,{withRightSeparator:!y,children:[f&&d&&l.jsxs(Vo,{variant:"destructive",children:[l.jsx(QG,{}),l.jsxs(Vo.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&L&&p&&l.jsx(l.Fragment,{children:l.jsxs(Vo,{variant:"warning",children:[l.jsx(QG,{}),l.jsxs(Vo.Message,{children:["Viewing version v",p.datasetVersion]}),l.jsxs(Vo.Button,{onClick:U,children:[l.jsx(RUt,{})," Return to the latest version"]})]})}),y?l.jsx(aJe,{inputValue:w,setInputValue:O,groundTruthValue:_,setGroundTruthValue:C,metadataValue:E,setMetadataValue:T,validationErrors:null,onSave:q,onCancel:V,isSaving:i.isPending}):Z?l.jsx(H2,{item:Z,Link:n}):l.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!y&&l.jsx(Yt,{children:l.jsx(LPn,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:$,onCompareVersionsClick:z=>{r(`/datasets/${e}/items/${t}/versions?ids=${z.join(",")}`)},activeVersion:p?.datasetVersion??null})})]})]})})]}),l.jsx(At,{open:I,onOpenChange:P,children:l.jsxs(At.Content,{children:[l.jsxs(At.Header,{children:[l.jsx(At.Title,{children:"Delete Item"}),l.jsx(At.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),l.jsxs(At.Footer,{children:[l.jsx(At.Cancel,{children:"Cancel"}),l.jsx(At.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function yTe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function f3n(){const{datasetId:e}=fa(),[t,n]=Gi(),r=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=zh(e??""),{Link:o}=Gt(),[i,c]=S.useState(!1),{data:u}=MZ(e??"",r[0]??""),{data:d}=MZ(e??"",r[1]??"");return a&&ta(a)?l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})}):!e||r.length<2?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),l.jsx(xl,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two items to compare."})})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:Dt,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Compare Items"})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:`/datasets/${e}`,variant:"outline",children:[l.jsx(Te,{children:l.jsx(gw,{})}),"Back to Dataset"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:K("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":i}),children:[l.jsxs(gt,{children:[l.jsxs(gt.Column,{children:[l.jsxs(gt.Title,{children:[l.jsx(fk,{}),"Compare Dataset Items"]}),l.jsx(gt.Description,{children:l.jsxs(Qr,{children:["Comparing ",r.length," items of"," ",l.jsx(Dt,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),l.jsx(gt.Column,{children:l.jsxs(Mo,{children:[l.jsxs(me,{as:Dt,to:`/datasets/${e}`,children:[l.jsx(gw,{}),"Back to Dataset"]}),l.jsx(me,{variant:"primary",onClick:()=>c(f=>!f),children:i?l.jsxs(l.Fragment,{children:[l.jsx(X8e,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(ZUt,{})," Diff View"]})})]})})]}),l.jsx(eb,{className:"grid-cols-[1fr_3vw_1fr]",children:r.map((f,p)=>l.jsxs(S.Fragment,{children:[l.jsx(p3n,{datasetId:e,itemId:f,Link:o,idx:p,itemIds:r,showContent:!i,onItemChange:h=>{const g=[...r];g[p]=h,n({items:g.join(",")})}}),p==0&&l.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),i&&u&&d&&l.jsx(gJe,{codeA:yTe(u),codeB:yTe(d)})]})})]})}function p3n({datasetId:e,itemId:t,Link:n,idx:r,itemIds:s,onItemChange:a,showContent:o=!0}){const{data:i,isLoading:c}=MZ(e,t),{data:u}=SE(e),d=new Set(s.filter((p,h)=>h!==r)),f=(u??[]).map(p=>({value:p.id,label:p.id,disabled:d.has(p.id)}));return l.jsxs(Yt,{children:[l.jsxs(Yt.Toolbar,{className:"flex gap-4",children:[l.jsx(D2,{label:"Item",name:`compare-item-${r}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),l.jsxs(me,{as:n,to:`/datasets/${e}/items/${t}`,children:[l.jsx(MD,{}),"Versions"]})]}),o&&l.jsx(Yt.Content,{children:c?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):i?l.jsxs(l.Fragment,{children:[l.jsx(sJe,{item:i}),l.jsx(H2,{item:i,Link:n})]}):l.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function vTe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function h3n(){const{datasetId:e,itemId:t}=fa(),[n,r]=Gi(),[s,a]=S.useState(!1),o=n.get("ids")?.split(",").map(Number).filter(h=>!isNaN(h)&&h>0)??[],{data:i,error:c}=zh(e??""),{Link:u}=Gt(),{data:d}=vse(e??"",t??""),{data:f}=$Z(e??"",t??"",o[0]??0,i?.version),{data:p}=$Z(e??"",t??"",o[1]??0,i?.version);return c&&ta(c)?l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})}):!e||!t||o.length<2?l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(xl,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:Dt,to:`/datasets/${e}`,children:i?.name}),l.jsx(hn,{as:Dt,to:`/datasets/${e}/items/${t}`,children:"Item"}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[l.jsx(Te,{children:l.jsx(gw,{})}),"Back to Item"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:K("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[l.jsxs(gt,{children:[l.jsxs(gt.Column,{children:[l.jsxs(gt.Title,{children:[l.jsx(fk,{}),"Compare Dataset Item Versions"]}),l.jsx(gt.Description,{children:l.jsxs(Qr,{children:["Comparing ",o.length," versions of"," ",l.jsx(Dt,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),l.jsx(gt.Column,{children:l.jsxs(Mo,{children:[l.jsxs(me,{as:Dt,to:`/datasets/${e}/items/${t}`,children:[l.jsx(gw,{}),"Back to Item"]}),l.jsx(me,{variant:"primary",onClick:()=>a(h=>!h),children:s?l.jsxs(l.Fragment,{children:[l.jsx(X8e,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(oqt,{})," Diff View"]})})]})})]}),l.jsx(eb,{className:"grid-cols-[1fr_3vw_1fr]",children:o.map((h,g)=>l.jsxs(S.Fragment,{children:[l.jsx(m3n,{datasetId:e,itemId:t,datasetVersion:h,latestVersion:i?.version,allVersions:d??[],versionNumbers:o,Link:u,idx:g,showContent:!s,onVersionChange:b=>{const y=[...o];y[g]=b,r({ids:y.join(",")})}}),g===0&&l.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},h))}),s&&f&&p&&l.jsx(gJe,{codeA:vTe(f),codeB:vTe(p)})]})})]})}function m3n({datasetId:e,itemId:t,datasetVersion:n,latestVersion:r,allVersions:s,versionNumbers:a,Link:o,idx:i,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=$Z(e,t,n,r),p=new Set(a.filter((b,y)=>y!==i)),h=s.map(b=>{const y=typeof b.updatedAt=="string"?new Date(b.updatedAt):b.updatedAt;return{value:String(b.datasetVersion),label:l.jsxs(l.Fragment,{children:[l.jsxs("b",{children:["v. ",b.datasetVersion]})," - ",Gn(y,"MMM d, yyyy h:mm a"),b.isLatest?l.jsx(Ar,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:p.has(b.datasetVersion)}}),g=d?{id:d.id,datasetId:e,datasetVersion:d.datasetVersion,input:d.input,groundTruth:d.groundTruth,metadata:d.metadata,createdAt:d.createdAt,updatedAt:d.updatedAt}:null;return l.jsxs(Yt,{children:[l.jsxs(Yt.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[l.jsx(MD,{className:"w-6 h-6 opacity-50"}),l.jsx(D2,{label:"Version",name:`compare-version-${i}`,value:String(n),onValueChange:b=>u(Number(b)),options:h,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&l.jsx(Yt.Content,{children:f?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!g?l.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",n," not found"]}):l.jsx(H2,{item:g,Link:o})})]})}function g3n(){const{datasetId:e}=fa(),[t]=Gi(),n=t.get("ids")?.split(",").map(Number).filter(b=>!isNaN(b)&&b>0)??[],r=fu(),{data:s,error:a}=zh(e??""),o=SE(e??"",void 0,n[0]??null),i=SE(e??"",void 0,n[1]??null),c=S.useMemo(()=>o.data??[],[o.data]),u=S.useMemo(()=>i.data??[],[i.data]),d=S.useMemo(()=>{const b=new Map;for(const y of[...c,...u])b.has(y.id)||b.set(y.id,{id:y.id,createdAt:new Date(y.createdAt)});return[...b.values()].sort((y,x)=>x.createdAt.getTime()-y.createdAt.getTime())},[c,u]),f=S.useMemo(()=>new Map(c.map(b=>[b.id,b])),[c]),p=S.useMemo(()=>new Map(u.map(b=>[b.id,b])),[u]);if(a&&ta(a))return l.jsx(jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"datasets"})})});if(!e||n.length<2)return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(xl,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]});const h=(b,y,x)=>{r(`/datasets/${e}/items/${b}/versions?ids=${y?.datasetVersion??""},${x?.datasetVersion??""}`)},g=(b,y)=>{r(`/datasets/${e}/versions?ids=${b},${y}`,{replace:!0})};return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/datasets",children:[l.jsx(Te,{children:l.jsx(sc,{})}),"Datasets"]}),l.jsx(hn,{as:Dt,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),l.jsxs(hn,{isCurrent:!0,as:"span",children:[l.jsx(Te,{children:l.jsx(Mxe,{})}),"Compare Versions"]})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(gt,{children:[l.jsxs(gt.Column,{children:[l.jsxs(gt.Title,{children:[l.jsx(Mxe,{})," Compare Dataset Versions"]}),l.jsx(gt.Description,{children:l.jsxs(Qr,{children:[l.jsx(MD,{})," Comparing ",n.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),l.jsx(gt.Column,{children:l.jsxs(me,{as:Dt,to:`/datasets/${e}`,children:[l.jsx(gw,{}),"Back to Dataset"]})})]}),l.jsx(eb,{children:l.jsxs(Yt,{children:[l.jsx(BPn,{datasetId:e,versionA:String(n[0]),versionB:String(n[1]),onVersionChange:g}),l.jsx(QPn,{datasetId:e,versionA:n[0],versionB:n[1],allItems:d,itemsAMap:f,itemsBMap:p,onItemClick:h})]})})]})})]})}function b3n(){const[e]=Gi(),t=fu(),n=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,o=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(gXe,{redirectUri:n,onSuccess:o,initialMode:s,errorMessage:a})}const y3n=()=>{const{data:e=[],isLoading:t,error:n}=fT();return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["MCP documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx(Zu,{})," MCP Servers"]})})}),l.jsx(mMn,{mcpServers:e,isLoading:t,error:n})]})})]})},v3n=()=>{const{serverId:e}=fa(),{data:t=[],isLoading:n}=fT(),r=t.find(s=>s.id===e);return l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/mcps",children:[l.jsx(Te,{children:l.jsx(Zu,{})}),"MCP Servers"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(fKe,{value:e,variant:"ghost"})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"MCP documentation"]})})]}),l.jsx(vMn,{isLoading:n,server:r})]})},x3n=()=>{const{data:e}=fT(),{serverId:t,toolId:n}=fa(),{data:r,isLoading:s}=yJe(t,n),a=e?.find(c=>c.id===t),o=r?.name,i=a?.name||"";return s||!r?null:l.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/mcps",children:[l.jsx(Te,{children:l.jsx(Zu,{})}),"MCP Servers"]}),l.jsx(hn,{as:Dt,to:`/mcps/${t}`,children:i}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:o})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"MCP documentation"]})})]}),l.jsx(yMn,{toolId:n,serverId:t})]})},w3n=(e,t)=>{const n=Xe();return qt({queryKey:["trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await n.getTrace(e)},enabled:!!e,refetchInterval:3e3,...t})},S3n=async({client:e,page:t,perPage:n,filters:r})=>e.listTraces({pagination:{page:t,perPage:n},filters:r}),O3n=25;function k3n(e,t,n){if(e?.pagination?.hasMore)return n+1}function _3n(e){const t=new Set,n=e.pages.flatMap(s=>s.spans??[]).filter(s=>t.has(s.traceId)?!1:(t.add(s.traceId),!0)),r={};for(const s of e.pages)s.threadTitles&&Object.assign(r,s.threadTitles);return{spans:n,threadTitles:r}}const E3n=({filters:e})=>{const t=Xe(),{inView:n,setRef:r}=rT(),s=bS({queryKey:["traces",e],queryFn:({pageParam:c})=>S3n({client:t,page:c,perPage:O3n,filters:e}),initialPageParam:0,getNextPageParam:k3n,select:_3n,retry:!1,refetchInterval:c=>ta(c.state.error)?!1:3e3}),{hasNextPage:a,isFetchingNextPage:o,fetchNextPage:i}=s;return S.useEffect(()=>{n&&a&&!o&&i()},[n,a,o,i]),{...s,setEndOfListElement:r}};function C3n(){const e=fu(),[t,n]=Gi(),[r,s]=S.useState(),[a,o]=S.useState({value:"all",label:"All",type:"all"}),[i,c]=S.useState(void 0),[u,d]=S.useState(void 0),[f,p]=S.useState(!1),[h,g]=S.useState(!1),{data:b={},isLoading:y}=of(),{data:x,isLoading:w}=Fh(),{data:O={},isLoading:_}=wp(),{data:C,isLoading:E}=w3n(r,{enabled:!!r}),T=t.get("traceId"),N=t.get("spanId"),A=t.get("tab"),I=t.get("scoreId"),{data:P,isLoading:$,isFetchingNextPage:U,hasNextPage:L,setEndOfListElement:B,error:H,isError:q}=E3n({filters:{...a?.type!=="all"&&{entityId:a?.value,entityType:a?.type},...i&&{startedAt:{start:i}},...u&&{endedAt:{end:u}}}}),V=S.useMemo(()=>P?.spans??[],[P?.spans]),W=P?.threadTitles??{};T&&T!==r&&(s(T),g(!0));const D=S.useMemo(()=>(Object.entries(b)||[]).map(([te,he])=>({value:he.id,label:he.name,type:Dw.AGENT})),[b]),Z=S.useMemo(()=>(Object.entries(x||{})||[]).map(([,te])=>({value:te.name,label:te.name,type:Dw.WORKFLOW_RUN})),[x]),z=S.useMemo(()=>[{value:"all",label:"All",type:"all"},...D,...Z],[D,Z]),R=t.get("entity"),Q=z.find(te=>te.value===R);Q&&Q.value!==a?.value&&o(Q);const G=()=>{s(void 0),n({entity:"all",traceId:""}),g(!1),c(void 0),d(void 0),p(!1)},J=(te,he)=>{if(he==="from")return c(te);d(te)},ee=te=>{te?.value&&n({entity:te.value})},ne=te=>{if(te===r)return s(void 0);s(te),g(!0)},ae=q?uMn(H):void 0,ce=S.useMemo(()=>{if(!f)return V.map(ge=>({id:ge.traceId}));const{groups:te,ungrouped:he}=tJe(V),le=[];for(const ge of te)for(const je of ge.traces)le.push({id:je.traceId});for(const ge of he)le.push({id:ge.traceId});return le},[V,f]);if(H&&ta(H))return l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(dk,{})}),"Observability"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Observability documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"traces"})})]});const ye=a?.value!=="all"||i||u,Y=M2({entries:ce,id:r,update:s}),se=$2({entries:ce,id:r,update:s});return l.jsxs(l.Fragment,{children:[l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(dk,{})}),"Observability"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Observability documentation"]})})]}),l.jsx("div",{className:K("grid overflow-y-auto h-full"),children:l.jsxs("div",{className:K("max-w-[100rem] px-12 mx-auto grid content-start gap-8 h-full"),children:[l.jsx(Ek,{title:"Observability",description:"Explore observability traces for your entities",icon:l.jsx(dk,{})}),l.jsx(ARn,{onEntityChange:ee,onReset:G,selectedEntity:a,entityOptions:z,onDateChange:J,selectedDateFrom:i,selectedDateTo:u,isLoading:$||y||w,groupByThread:f,onGroupByThreadChange:p}),$?l.jsx(GYe,{columns:Q2}):l.jsx(PRn,{traces:V,selectedTraceId:r,onTraceClick:ne,errorMsg:ae?.error,setEndOfListElement:B,filtersApplied:!!ye,isFetchingNextPage:U,hasNextPage:L,groupByThread:f,threadTitles:W})]})})]}),l.jsx(KKe,{traceSpans:C?.spans,traceId:r,initialSpanId:N||void 0,initialSpanTab:A==="scores"?"scores":"details",initialScoreId:I||void 0,traceDetails:V.find(te=>te.traceId===r),isOpen:h,onClose:()=>{e("/observability"),g(!1)},onNext:Y,onPrevious:se,isLoadingSpans:E,computeTraceLink:(te,he)=>`/observability?traceId=${te}${he?`&spanId=${he}`:""}`,scorers:O,isLoadingScorers:_})]})}function T3n(){const{Link:e,paths:t}=Gt(),{data:n,isLoading:r}=QXe(),{isCmsAvailable:s}=qh(),a=n?.promptBlocks??[];return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Prompts documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(gt,{children:[l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:r,children:[l.jsx(PD,{})," Prompts"]})}),s&&l.jsx(gt.Column,{children:l.jsxs(me,{variant:"primary",as:e,to:t.cmsPromptBlockCreateLink(),children:[l.jsx($D,{}),"Create Prompt Block"]})})]}),l.jsx(rNn,{promptBlocks:a,isLoading:r})]})})]})}function N3n(){return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(K8e,{})}),"Request Context"]})}),l.jsx(xl,{children:l.jsx(xEn,{children:l.jsx(wZ,{})})})]})}function j3n(){const{Link:e}=Gt(),{data:t={},isLoading:n,error:r}=wp(),{isCmsAvailable:s}=qh();return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Scorers documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(gt,{children:[l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:n,children:[l.jsx(yh,{})," Scorers"]})}),s&&l.jsx(gt.Column,{children:l.jsxs(me,{variant:"primary",as:e,to:"/cms/scorers/create",children:[l.jsx($D,{}),"Create Scorer"]})})]}),l.jsx(YEn,{scorers:t,isLoading:n,error:r})]})})]})}function A3n(){const{scorerId:e}=fa(),[t,n]=Gi(),[r,s]=S.useState(),[a,o]=S.useState(0),[i,c]=S.useState(!1),[u,d]=S.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:f,isLoading:p,error:h}=GEn(e),{data:g={},isLoading:b,error:y}=of(),{data:x,isLoading:w,error:O}=Fh(),{data:_,isLoading:C,error:E}=HEn({scorerId:e,page:a,entityId:u?.value==="all"?void 0:u?.value,entityType:u?.type==="ALL"?void 0:u?.type}),T=S.useMemo(()=>f?.agentIds?.filter(z=>g[z]).map(z=>({value:z,label:g[z].name,type:"AGENT"}))||[],[f?.agentIds,g]),N=S.useMemo(()=>f?.workflowIds?.map(z=>({value:z,label:z,type:"WORKFLOW"}))||[],[f?.workflowIds]),A=S.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...T,...N],[T,N]),I=t.get("entity"),P=A.find(z=>z.value===I);if(P&&P.value!==u?.value&&d(P),S.useEffect(()=>{if(h){const z=h instanceof Error?h.message:"Failed to load scorer";qe.error(`Error loading scorer: ${z}`)}},[h]),S.useEffect(()=>{if(y){const z=y instanceof Error?y.message:"Failed to load agents";qe.error(`Error loading agents: ${z}`)}},[y]),S.useEffect(()=>{if(O){const z=O instanceof Error?O.message:"Failed to load workflows";qe.error(`Error loading workflows: ${z}`)}},[O]),h&&ta(h))return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/scorers",children:[l.jsx(Te,{children:l.jsx(yh,{})}),"Scorers"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"scorers"})})]});if(p||h||y||O)return null;const $=f?.agentIds?.map(z=>({name:z,id:Object.entries(g).find(([,R])=>R.name===z)?.[0]}))||[],U=f?.workflowIds?.map(z=>({name:z,id:Object.entries(x||{}).find(([,R])=>R.name===z)?.[0]}))||[],B=[{key:"entities",label:"Entities",value:([...$.map(z=>({id:z.id,name:z.name,type:"AGENT"})),...U.map(z=>({id:z.id,name:z.name,type:"WORKFLOW"}))]||[]).map(z=>({id:z.id,name:z.name||z.id,path:`${z.type==="AGENT"?"/agents":"/workflows"}/${z.name}`}))}],H=z=>{z?.value&&n({entity:z.value})},q=_?.scores||[],V=_?.pagination,W=z=>{s(z),c(!0)},D=M2({entries:q,id:r,update:s}),Z=$2({entries:q,id:r,update:s});return l.jsxs(l.Fragment,{children:[l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/scorers",children:[l.jsx(Te,{children:l.jsx(yh,{})}),"Scorers"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(WEn,{value:e,variant:"ghost"})})]}),l.jsxs(Va,{children:[f?.scorer?.source==="stored"&&l.jsxs(me,{variant:"light",as:Dt,to:`/cms/scorers/${e}/edit`,children:[l.jsx(Te,{children:l.jsx(gqt,{})}),"Edit"]}),l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Scorers documentation"]})]})]}),l.jsx("div",{className:K("grid overflow-y-auto h-full"),children:l.jsxs("div",{className:K("max-w-[100rem] w-full px-12 mx-auto grid content-start gap-8 h-full"),children:[l.jsx(Ek,{title:f?.scorer?.config?.name||"loading",description:f?.scorer?.config?.description||"loading",icon:l.jsx(yh,{})}),l.jsx(zv,{data:B,LinkComponent:Dt,isLoading:b||w}),l.jsx(QEn,{selectedEntity:u,entityOptions:A,onEntityChange:H,onReset:()=>n({entity:"all"}),isLoading:C||b||w}),C?l.jsx("div",{className:"h-full w-full flex items-center justify-center",children:l.jsx(Tn,{})}):l.jsx(NEn,{scores:q,selectedScoreId:r,pagination:{total:V?.total||0,hasMore:V?.hasMore||!1,perPage:V?.perPage||0,page:V?.page||0},onScoreClick:W,onPageChange:o,errorMsg:E?.message})]})})]}),l.jsx(YYe,{scorerName:f?.scorer?.config?.name,score:R3n(q.find(z=>z.id===r)),isOpen:i,onClose:()=>c(!1),onNext:D,onPrevious:Z,computeTraceLink:(z,R)=>`/observability?traceId=${z}${R?`&spanId=${R}`:""}`})]})}const R3n=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},I3n=()=>{const{baseUrl:e,headers:t}=use();return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Gre,{})}),"Settings"]})}),l.jsx(xl,{children:l.jsx("div",{className:"max-w-2xl mx-auto w-full mt-[4vh]",children:l.jsx(sXe,{initialConfig:{baseUrl:e,headers:t}})})})]})};function P3n(){const[e]=Gi(),t=fu(),n=e.get("redirect")||"/",r=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(gXe,{redirectUri:n,onSuccess:r,initialMode:"signup"})}async function htt(){const e=await fetch("https://mastra.ai/api/templates.json");if(!e.ok)throw new Error(`Failed to fetch templates: ${e.statusText}`);const t=await e.json(),n=[{title:"Weather Agent",slug:"weather-agent",githubUrl:"https://github.com/mastra-ai/weather-agent",description:"Get weather information of any city.",longDescription:"One Agent, one Workflow and one Tool to bring you the weather in your city.",imageURL:"",tags:["Agent","Workflow","Tool"],useCase:"",supportedProviders:["openai","anthropic","google","groq"],agents:["weatherAgent"],tools:["weatherTool"],workflows:["weatherWorkflow"]},...t],r=Array.from(new Set(n.flatMap(a=>a.tags))),s=Array.from(new Set(n.flatMap(a=>a.supportedProviders)));return{templates:n,tags:r,providers:s}}async function M3n({repo:e,owner:t}){const n=await fetch(`https://api.github.com/repos/${t}/${e}`);if(!n.ok)throw new Error(`Failed to fetch template: ${n.statusText}`);const r=await n.json();if(!r.is_template)throw new Error("Repo is not a template, please update the repo settings to make it a template");return{title:r.name,slug:r.name,description:r.description??"",imageURL:"",tags:[],useCase:"",longDescription:r.description??"",githubUrl:r.html_url,supportedProviders:[]}}async function $3n({repoOrSlug:e,owner:t}){const{templates:n}=await htt(),r=n.find(s=>s.slug===e);if(!r){if(e.startsWith("template-")){const a=n.find(o=>`template-${o.slug}`===e);if(a)return a}const s=await M3n({repo:e,owner:t});if(s)return s;throw new Error(`Template ${e} not found`)}return r}async function D3n({repo:e,owner:t,branch:n}){const r=`https://raw.githubusercontent.com/${t}/${e}/${n}/.env.example`,s=await fetch(r);return s.ok?(await s.text()).split(`
|
|
487
|
-
`).reduce((i,c)=>{if(!c||c.startsWith("#"))return i;const[u,d]=c.split("=");return u&&(i[u]=d?.split("")?.every(f=>f==="*")?"":d?.replaceAll('"',"")),i},{}):{}}const L3n=()=>qt({queryKey:["mastra-templates"],queryFn:htt}),F3n=({repoOrSlug:e,owner:t})=>qt({queryKey:["template-repo",e,t],queryFn:()=>$3n({repoOrSlug:e,owner:t})}),z3n=({repo:e,owner:t,branch:n})=>qt({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>D3n({repo:e,owner:t,branch:n})}),B3n=()=>{const e=Xe();return qt({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},U3n=()=>{const e=Xe();return Ln({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},q3n=()=>{const e=Xe();return Ln({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},xTe=(e,t,n)=>{let r={...t};if(!(r.payload?.workflowState?.steps&&Object.keys(r.payload.workflowState.steps).length>0)&&n?.allSteps&&(r.payload={...r.payload,workflowState:{...r.payload?.workflowState,steps:Object.keys(n.allSteps).reduce((a,o)=>(a[o]={id:o,description:n.allSteps[o].description,status:"pending"},a),{})}}),e.type==="start"||e.type==="workflow-start"){const a={};n?.allSteps&&Object.entries(n.allSteps).forEach(([i,c])=>{a[i]={id:c.id,description:c.description,status:"pending"}});const o=e.runId||e.payload?.runId;r={...r,runId:o,eventTimestamp:new Date().toISOString(),status:"running",phase:"initializing",payload:{workflowState:{status:"running",steps:a},currentStep:null}}}if(e.type==="step-start"||e.type==="workflow-step-start"){const a=e.payload.id;r={...r,phase:"processing",payload:{...r.payload,currentStep:{id:a,status:"running",startTime:new Date,...e.payload},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[a]:{...r.payload.workflowState.steps[a],status:"running",startTime:new Date,...e.payload}}}}}}if(e.type==="step-result"||e.type==="workflow-step-result"){const a=e.payload.id,o=e.payload.status,i=e.payload.error;r={...r,payload:{...r.payload,currentStep:{...r.payload.currentStep,status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[a]:{...r.payload.workflowState.steps[a],status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date}}}}},o==="failed"&&i&&(r={...r,status:"failed",error:i,phase:"error",failedStep:{id:a,error:i,description:e.payload.description||a},payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date})}return(e.type==="step-finish"||e.type==="workflow-step-finish")&&(r={...r,payload:{...r.payload,currentStep:null}}),(e.type==="finish"||e.type==="workflow-finish")&&(r.phase==="error"||r.status==="failed"?r={...r,completedAt:new Date}:r={...r,status:e.payload.status||"completed",phase:"completed",payload:{...r.payload,currentStep:null,workflowState:{...r.payload.workflowState,status:e.payload.status||"completed"}},completedAt:new Date}),e.type==="error"&&(r={...r,status:"failed",error:e.payload.error,phase:"error",payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date}),{newState:r}},V3n=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(n){console.warn("Failed to save template state to localStorage:",n)}},mtt=(e,t)=>{const[n,r]=S.useState({}),[s,a]=S.useState(!1);return{streamResult:n,isStreaming:s,processStream:async(i,c)=>{if(a(!0),r({}),!i)throw new Error("No stream returned");const u=i.getReader();let d={runId:c||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:f,value:p}=await u.read();if(f)break;const{newState:h}=xTe(p,d,e);if(d=h,r(h),p.runId||c||t){const g=p.runId||c||t;V3n(g,h)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:p}=xTe({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(p)}finally{a(!1),u.releaseLock()}}}},Q3n=e=>{const t=Xe(),{streamResult:n,isStreaming:r,processStream:s}=mtt(e);return{streamInstall:Ln({mutationFn:async({inputData:o,selectedModel:i,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),p=new dh;p.set("selectedModel",i);const h=await f.stream({inputData:o,requestContext:p},c);await s(h,c);return}catch(f){console.error(`💥 [streamInstall] Attempt ${d} failed:`,f);const p=f?.message?.includes("Failed to fetch")||f?.message?.includes("NetworkError")||f?.message?.includes("network error")||f?.message?.includes("fetch")||f?.code==="NETWORK_ERROR"||f?.name==="TypeError";if(console.warn(`Stream attempt ${d}/3 failed:`,f),p){const h=c?`Network error during template installation (likely hot reload). Please refresh the page to resume from where you left off using runId: ${c}`:"Network error during template installation (likely hot reload). Please try again.";throw console.error("🔌 Stream network error:",h),new Error(h)}throw console.error("❌ [streamInstall] Non-network error or max retries reached, throwing:",f),f}}}),streamResult:n,isStreaming:r}},H3n=e=>{const t=Xe(),{streamResult:n,isStreaming:r,processStream:s}=mtt(e);return{observeInstall:Ln({mutationFn:async({runId:o})=>{for(let u=1;u<=3;u++)try{const f=await t.getAgentBuilderAction("merge-template").observeStream({runId:o});await s(f,o);return}catch(d){console.error(`💥 [observeInstall] Attempt ${u} failed:`,d);const f=d?.message?.includes("Failed to fetch")||d?.message?.includes("NetworkError")||d?.message?.includes("network error")||d?.message?.includes("fetch")||d?.code==="NETWORK_ERROR"||d?.name==="TypeError";if(console.warn(`ObserveStream attempt ${u}/3 failed:`,d),f&&u<3){console.info(`🔄 ObserveStream network error detected (likely hot reload), retrying in 2000ms... (attempt ${u+1}/3)`),await new Promise(p=>setTimeout(p,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:n,isStreaming:r}};function G3n(){const{data:e,isLoading:t}=L3n(),{templates:n,tags:r,providers:s}=e??{templates:[],tags:[],providers:[]};return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Templates documentation"]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[90rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx(wte,{})," Templates"]})})}),l.jsx(xRn,{templates:n,tags:r??[],providers:s??[],isLoading:t})]})})]})}const W3n="1.13.0-alpha.0";function Z3n(){const{templateSlug:e}=fa(),[t,n]=Gi(),[r,s]=S.useState(""),[a,o]=S.useState(""),[i,c]=S.useState(""),[u,d]=S.useState({}),[f,p]=S.useState([]),[h,g]=S.useState(null),[b,y]=S.useState(!1),[x,w]=S.useState(""),[O,_]=S.useState(!1),[C,E]=S.useState(!1),[T,N]=S.useState([]),{data:A,isLoading:I}=F3n({repoOrSlug:e,owner:"mastra-ai"}),$=W3n?.includes("beta")??!1?"beta":"main",{data:U,isLoading:L}=z3n({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:$}),{data:B,isLoading:H}=B3n(),{mutateAsync:q,isPending:V}=U3n(),{mutateAsync:W}=q3n(),{streamInstall:D,streamResult:Z,isStreaming:z}=Q3n(B),{observeInstall:R,streamResult:Q,isStreaming:G}=H3n(B);S.useEffect(()=>{const se=t.get("runId");se&&!b&&!h&&!z&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:se}),w(se),W({runId:se}).then(te=>{const he=te.snapshot;if(he?.status==="success"&&he?.result?.success)y(!0);else if(he?.result?.success===!1)if(he?.result?.validationResults&&!he?.result?.validationResults?.valid&&he?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ge,errors:je}=he.result.validationResults,Oe=`Template installation completed but ${ge} validation issue${ge>1?"s":""} remain unresolved.`;g(Oe),N(je||[])}else g(he?.result?.message||he?.result?.error||"Template installation failed")}).catch(te=>{console.error("❌ Failed to fetch run details:",te),g("Failed to retrieve installation status after reload")}))},[t,b,h,z,G,W]),S.useEffect(()=>{const se=t.get("runId"),te=t.get("resume"),he=t.get("provider");if(se&&te==="true"&&he&&!z&&!G&&!O&&!C&&B){w(se),_(!0);try{W({runId:se}).then(le=>{if(le.snapshot?.status==="running")return R.mutateAsync({runId:se})}).then(()=>{n(le=>{const ge=new URLSearchParams(le);return ge.delete("resume"),ge})}).catch(le=>{console.error("❌ Failed to resume template installation:",le),le.message?.includes("404")||le.message?.includes("not found")?g("Template installation run not found. It may have expired or been completed."):g("Failed to resume template installation. Please try again.")})}catch(le){console.error("❌ Auto-resume failed with error:",le),g("Failed to resume template installation. Please refresh and try again.")}}},[t,e,z,G,O,C,B,W,R,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ee=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(se=>se).join(", "):"n/a",icon:l.jsx(zi,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(se=>se).join(", "):"n/a",icon:l.jsx($o,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(se=>se).join(", "):"n/a",icon:l.jsx(Iqt,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:l.jsx($Ut,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:l.jsx(Cqt,{})}],ne=[{...ee[0]},{...ee[1]},{...ee[2]}].filter(se=>se.value!=="n/a");S.useEffect(()=>{U&&d(U)},[U]),S.useEffect(()=>{const se=Z||Q;se?.phase==="error"&&se?.error&&g(se.error)},[Z?.phase,Z?.error,Q?.phase,Q?.error]);const ae=se=>{s(se)},ce=async se=>(o(se.provider),c(se.modelId),{message:"Model updated successfully"}),ye=async()=>{const se=Object.entries(u).reduce((te,[he,le])=>(le===""&&te.push(he),te),[]);if(se.length>0){p(se);return}if(A){g(null),y(!1),w(""),E(!0);try{const he={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:$,slug:A.slug,variables:u},{runId:le}=await q({});w(le),n(ge=>{const je=new URLSearchParams(ge);return je.set("runId",le),je.set("resume","true"),je.set("provider",r||"openai"),je}),await D.mutateAsync({inputData:he,selectedModel:{provider:a,modelId:i},runId:le})}catch(te){E(!1),g(te?.message||"Template installation failed"),console.error("Template installation failed",te)}}},Y=se=>{const{name:te,value:he}=se.target;he.trim()===""?p(le=>[...le,te]):p(le=>le.filter(ge=>ge!==te)),d(le=>({...le,[te]:he}))};return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/templates",children:[l.jsx(Te,{children:l.jsx(wte,{})}),"Templates"]}),l.jsx(hn,{as:Dt,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),l.jsx("div",{className:K("w-full lg:px-12 h-full overflow-y-scroll"),children:l.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[l.jsx(SRn,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:ee,templateSlug:e}),A&&l.jsxs(l.Fragment,{children:[(z||G)&&l.jsx(TRn,{name:A.title,streamResult:G?Q:Z,runId:x,workflowInfo:B}),b&&l.jsx(NRn,{name:A.title,installedEntities:ne,linkComponent:Dt}),h&&l.jsx(jRn,{errorMsg:h,validationErrors:T.length>0?T:Z?.validationResults?.errors||Q?.validationResults?.errors}),!z&&!G&&!b&&!h&&l.jsx(ORn,{providerOptions:J,selectedProvider:r,onProviderChange:ae,variables:u,setVariables:d,errors:f,setErrors:p,handleInstallTemplate:ye,handleVariableChange:Y,isLoadingEnvVars:L||H,isInstalling:V,defaultModelProvider:a,defaultModelId:i,onModelUpdate:ce})]})]})})]})}const Y3n=()=>{const{toolId:e,agentId:t}=fa();return l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/agents",children:[l.jsx(Te,{children:l.jsx($o,{})}),"Agents"]}),l.jsx(hn,{as:Dt,to:`/agents/${t}/chat`,children:t}),l.jsx(hn,{as:Dt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Tools documentation"]})})]}),l.jsx(xTn,{toolId:e,agentId:t})]})},X3n=()=>{const{toolId:e}=fa();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/tools",children:[l.jsx(Te,{children:l.jsx(zi,{})}),"Tools"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(bRn,{value:e,variant:"ghost"})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Tools documentation"]})})]}),l.jsx(gRn,{toolId:e})]})};function K3n(){const{data:e,isLoading:t,error:n}=Fh();return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Workflows documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx(yl,{})," Workflows"]})})}),l.jsx(ykn,{workflows:e||{},isLoading:t,error:n})]})})]})}const wTe=()=>{const{workflowId:e}=fa(),{data:t,isLoading:n,error:r}=sT(e);return r&&ta(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"workflows"})}):l.jsx(rYe,{workflowId:e,workflow:t??void 0,isLoading:n})};function STe(){const{workspaceId:e}=fa(),[t,n]=Gi(),r=fu(),[s,a]=S.useState(!1),[o,i]=S.useState(!1),[c,u]=S.useState(!1),[d,f]=S.useState(null),[p,h]=S.useState(null),[g,b]=S.useState(!1),y=t.get("file"),x=t.get("tab"),{data:w,error:O,isLoading:_}=mKe(),C=w?.workspaces??[],E=e??C[0]?.id,{data:T,isLoading:N,error:A}=gjn(E),I=ta(O)||ta(A),P=t.get("path")||".",$=dZ(O)||dZ(A),U=E?C.find(Ue=>Ue.id===E):void 0,L=Ue=>{const et=new URLSearchParams(t);for(const[Ye,Ht]of Object.entries(Ue))Ht===null?et.delete(Ye):et.set(Ye,Ht);n(et)},B=Ue=>{b(!1),a(!1),r(`/workspaces/${Ue}`)},H=Ue=>{L({path:Ue==="."||Ue===""?null:Ue,file:null})},q=Ue=>{L({file:Ue})},V=Ue=>{L({tab:Ue})},W=P,D=y,{data:Z,isLoading:z,error:R,refetch:Q}=bjn(W,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:E}),G=vjn(),J=xjn(),{data:ee,isLoading:ne}=gKe(D??"",{enabled:!!D,workspaceId:E}),{data:ae,isLoading:ce,refetch:ye}=Sjn({workspaceId:E}),Y=Njn(),se=jjn(),te=Ajn(),he=T?.isWorkspaceConfigured??!1,le=T?.capabilities?.hasFilesystem??!1,ge=T?.capabilities?.hasSkills??!1,je=T?.capabilities?.canBM25??!1,Oe=T?.capabilities?.canVector??!1,ie=U?.safety?.readOnly??!1,de=le&&!ie,pe=T?.mounts,Ce=pe?.filter(Ue=>!Ue.readOnly).map(Ue=>({path:Ue.path,displayName:Ue.displayName,icon:Ue.icon,provider:Ue.provider,name:Ue.name})),Ee=pe&&pe.length>1?pe.map(Ue=>Ue.path):void 0,ve=S.useCallback(Ue=>{E&&Y.mutate({...Ue,workspaceId:E},{onSuccess:async et=>{if(et.success){u(!1);const{data:Ye,error:Ht}=await ye();if(Ht||!Ye){qe.success(`Skill "${et.skillName}" installed successfully (${et.filesWritten} files)`);return}Ye.skills.some(pr=>pr.name===et.skillName)?qe.success(`Skill "${et.skillName}" installed successfully (${et.filesWritten} files)`):(b(!0),qe.warning(`Skill "${et.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else qe.error("Failed to install skill")},onError:et=>{qe.error(`Failed to install skill: ${et instanceof Error?et.message:"Unknown error"}`)}})},[E,Y,ye]),ue=S.useCallback(Ue=>{E&&(h(Ue),se.mutate({workspaceId:E,skillName:Ue},{onSuccess:et=>{if(h(null),et.updated.length>0){const Ye=et.updated[0];Ye.success?(qe.success(`Skill "${Ue}" updated successfully (${Ye.filesWritten} files)`),ye()):qe.error(`Failed to update skill: ${Ye.error??"Unknown error"}`)}else qe.error("Failed to update skill: No update result returned")},onError:et=>{h(null),qe.error(`Failed to update skill: ${et instanceof Error?et.message:"Unknown error"}`)}}))},[E,se,ye]),_e=S.useCallback(Ue=>{E&&(f(Ue),te.mutate({workspaceId:E,skillName:Ue},{onSuccess:et=>{f(null),et.success?(qe.success(`Skill "${et.skillName}" removed successfully`),ye()):qe.error(`Failed to remove skill "${et.skillName}"`)},onError:et=>{f(null),qe.error(`Failed to remove skill: ${et instanceof Error?et.message:"Unknown error"}`)}}))},[E,te,ye]),Ke=x==="files"&&le?"files":x==="skills"&&ge?"skills":le?"files":ge?"skills":"files",pt=ae?.skills??[],Et=ae?.isSkillsConfigured??!1,Ct=Z?.entries??[],fn=le&&(je||Oe),yt=ge&&Et&&pt.length>0,dt=fn||yt;return I?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"workspaces"})})]}):$?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(Ek,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(Sf,{})}),l.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[l.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:l.jsx(QG,{className:"h-8 w-8 text-amber-500"})}),l.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),l.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",l.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Learn More"]})]})]})})]}):_?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Tn,{})})]}):!N&&!_&&!he?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(Ek,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(Sf,{})}),l.jsx(NMn,{})]})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(Va,{children:[dt&&l.jsxs(me,{variant:"light",onClick:()=>a(!s),children:[l.jsx(Te,{children:l.jsx(kqt,{className:"h-4 w-4"})}),"Search"]}),l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Workspaces documentation"]})]})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[l.jsx(Ek,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(Sf,{})}),C.length>1&&l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>i(!o),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[U?.source==="agent"?l.jsx(XA,{className:"h-4 w-4 text-accent1"}):l.jsx(_B,{className:"h-4 w-4 text-neutral4"}),l.jsxs("span",{className:"flex-1 text-left truncate",children:[U?.name??"Select workspace",U?.source==="agent"&&U.agentName&&l.jsxs("span",{className:"text-neutral4 ml-1",children:["(",U.agentName,")"]})]}),l.jsx(BUt,{className:`h-4 w-4 text-neutral4 transition-transform ${o?"rotate-180":""}`})]}),o&&l.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:C.map(Ue=>l.jsxs("button",{onClick:()=>{B(Ue.id),i(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${U?.id===Ue.id?"bg-surface3":""}`,children:[Ue.source==="agent"?l.jsx(XA,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):l.jsx(_B,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Ue.name}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:Ue.source==="agent"?`Agent: ${Ue.agentName}`:"Global workspace"})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[Ue.safety?.readOnly&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Ue.capabilities.hasFilesystem&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Ue.capabilities.hasSandbox&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Ue.capabilities.hasSkills&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Ue.id))})]}),C.length===1&&U&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[U.source==="agent"?l.jsx(XA,{className:"h-4 w-4 text-accent1"}):l.jsx(_B,{className:"h-4 w-4"}),l.jsx("span",{children:U.name}),U.source==="agent"&&U.agentName&&l.jsxs("span",{className:"text-neutral3",children:["(",U.agentName,")"]}),ie&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&dt&&E&&l.jsx(J3n,{workspaceId:E,canSearchFiles:fn,canSearchSkills:yt,canBM25:je,canVector:Oe,showInitWarning:!N&&T?.status!=="ready",onViewFileResult:Ue=>{L({file:Ue,tab:"files"})},onViewSkillResult:Ue=>{E&&r(`/workspaces/${E}/skills/${encodeURIComponent(Ue)}`)}},E),l.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[le&&l.jsxs("button",{onClick:()=>V("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Ke==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(PD,{className:"h-4 w-4"}),"Files"]}),ge&&l.jsxs("button",{onClick:()=>V("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Ke==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(FI,{className:"h-4 w-4"}),"Skills",Et&&pt.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:pt.length})]})]}),l.jsxs("div",{className:"pb-8",children:[Ke==="files"&&le&&l.jsx("div",{className:"space-y-4",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[l.jsx(_Mn,{entries:Ct,currentPath:W,isLoading:z,error:R,onNavigate:H,onFileSelect:q,onRefresh:()=>Q(),onCreateDirectory:ie?void 0:Ue=>J.mutate({path:Ue,workspaceId:E}),onDelete:ie?void 0:Ue=>G.mutate({path:Ue,recursive:!0,force:!0,workspaceId:E})}),D&&l.jsx(TMn,{path:D,content:ee?.content??"",isLoading:ne,mimeType:ee?.mimeType,onClose:()=>q(null)})]})}),Ke==="skills"&&ge&&l.jsx(LMn,{skills:pt,isLoading:ce,isSkillsConfigured:Et,hasUndiscoveredAgentSkills:g,basePath:E?`/workspaces/${E}/skills`:"/workspaces",onAddSkill:de?()=>u(!0):void 0,onUpdateSkill:de?ue:void 0,onRemoveSkill:de?_e:void 0,updatingSkillName:p??void 0,removingSkillName:d??void 0,mountPaths:Ee}),!le&&!ge&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),E&&de&&l.jsx(VMn,{open:c,onOpenChange:u,workspaceId:E,onInstall:ve,isInstalling:Y.isPending,installedSkillIds:pt.filter(Ue=>Ue.skillsShSource).map(Ue=>`${Ue.skillsShSource.owner}/${Ue.skillsShSource.repo}/${Ue.name}`),installedSkillNames:pt.filter(Ue=>!Ue.skillsShSource).map(Ue=>Ue.name),writableMounts:Ce,installedSkillPaths:Object.fromEntries(pt.filter(Ue=>Ue.path).map(Ue=>[Ue.name,Ue.path]))})]})}function J3n({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:s,showInitWarning:a,onViewFileResult:o,onViewSkillResult:i}){const c=wjn(),u=_jn();return l.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(PD,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&l.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",l.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",l.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),l.jsx(jMn,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:r,canVector:s,onViewResult:o})]}),n&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(FI,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(RMn,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>i(d.skillName)})]})]})}function e5n(){const{skillName:e,workspaceId:t}=fa(),[n]=Gi(),r=e?decodeURIComponent(e):"",s=n.get("agentId"),a=s?decodeURIComponent(s):null,o=a?`/agents/${a}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[i,c]=S.useState(null),{data:u,isLoading:d,error:f}=Ojn(r,{workspaceId:t}),{data:p}=gKe(u?.path?`${u.path}/SKILL.md`:"",{enabled:!!u?.path,workspaceId:t}),{data:h,isLoading:g}=kjn(r,i??"",{enabled:!!i,workspaceId:t}),b=y=>a?l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:o,children:[l.jsx(Te,{children:l.jsx(XA,{className:"h-4 w-4"})}),a]}),l.jsxs(hn,{as:"span",to:"",isCurrent:!0,children:[l.jsx(Te,{children:l.jsx(FI,{className:"h-4 w-4"})}),y]})]}):l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:o,children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(hn,{as:Dt,to:o,children:[l.jsx(Te,{children:l.jsx(FI,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:y})]});return d?l.jsxs(jn,{children:[l.jsx(Vn,{children:b("Loading...")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):f&&ta(f)?l.jsxs(jn,{children:[l.jsx(Vn,{children:b("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"workspaces"})})]}):f||!u?l.jsxs(jn,{children:[l.jsx(Vn,{children:b("Error")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),l.jsx("p",{className:"text-sm text-neutral3",children:f?.message??"Skill not found"})]})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[b(r),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:l.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:l.jsx(UMn,{skill:u,rawSkillMd:p?.content,onReferenceClick:c})})}),l.jsx(qMn,{open:!!i,onOpenChange:y=>!y&&c(null),skillName:r,referencePath:i??"",content:h?.content,isLoading:g})]})}const t5n=[{key:"main",links:[{name:"Agents",url:"/agents",icon:l.jsx($o,{}),isOnMastraPlatform:!0},{name:"Prompts",url:"/prompts",icon:l.jsx(PD,{}),isOnMastraPlatform:!0},{name:"Workflows",url:"/workflows",icon:l.jsx(yl,{}),isOnMastraPlatform:!0},{name:"Processors",url:"/processors",icon:l.jsx(HUt,{}),isOnMastraPlatform:!1},{name:"MCP Servers",url:"/mcps",icon:l.jsx(Zu,{}),isOnMastraPlatform:!0},{name:"Tools",url:"/tools",icon:l.jsx(zi,{}),isOnMastraPlatform:!0},{name:"Scorers",url:"/scorers",icon:l.jsx(yh,{}),isOnMastraPlatform:!0},{name:"Workspaces",url:"/workspaces",icon:l.jsx(Sf,{})},{name:"Request Context",url:"/request-context",icon:l.jsx(K8e,{}),isOnMastraPlatform:!0}]},{key:"observability",separator:!0,links:[{name:"Observability",url:"/observability",icon:l.jsx(dk,{}),isOnMastraPlatform:!0},{name:"Datasets",url:"/datasets",icon:l.jsx(sc,{}),isOnMastraPlatform:!1}]},{key:"Templates",separator:!0,links:[{name:"Templates",url:"/templates",icon:l.jsx(wte,{}),isOnMastraPlatform:!1}]},{key:"Settings",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(Gre,{}),isOnMastraPlatform:!1}]}],n5n={links:[{name:"Mastra APIs",url:"/swagger-ui",icon:l.jsx(XUt,{}),isOnMastraPlatform:!1},{name:"Documentation",url:"https://mastra.ai/en/docs",icon:l.jsx(uk,{}),isOnMastraPlatform:!0},{name:"Github",url:"https://github.com/mastra-ai/mastra",icon:l.jsx(E2,{}),isOnMastraPlatform:!0},{name:"Community",url:"https://discord.gg/BTYqqHKUrf",icon:l.jsx(dqt,{}),isOnMastraPlatform:!0}]};function r5n(){const{state:e}=mJe(),n=Sl().pathname,r=window?.MASTRA_HIDE_CLOUD_CTA==="true",{isMastraPlatform:s}=kJe(),{data:a}=lT(),{isCmsAvailable:o,isLoading:i}=qh(),c=a&&A2(a),u=new Set(["/prompts"]),d=f=>u.has(f.url)&&!o&&!i?!1:s?f.isOnMastraPlatform:!0;return l.jsxs(tl,{children:[l.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?l.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[l.jsx(by,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),c&&l.jsx(J_e,{})]}):c?l.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(by,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),l.jsx(J_e,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[l.jsx(by,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),l.jsx(tl.Nav,{children:t5n.map(f=>{const p=f.links.filter(d),h=p.length>0&&f?.separator;return l.jsxs(tl.NavSection,{children:[f?.title?l.jsx(tl.NavHeader,{state:e,children:f.title}):l.jsx(l.Fragment,{children:h&&l.jsx(tl.NavSeparator,{})}),l.jsx(tl.NavList,{children:p.map(g=>{const b=n.startsWith(g.url);return l.jsx(tl.NavLink,{state:e,link:g,isActive:b},g.name)})})]},f.key)})}),l.jsxs(tl.Bottom,{children:[l.jsx(tl.Nav,{children:l.jsxs(tl.NavSection,{children:[l.jsx(tl.NavSeparator,{}),l.jsxs(tl.NavList,{children:[n5n.links.filter(d).map(f=>l.jsx(tl.NavLink,{link:f,state:e},f.name)),!r&&!s?l.jsx(tl.NavLink,{link:{name:"Share",url:"https://mastra.ai/cloud",icon:l.jsx(qUt,{}),variant:"featured",tooltipMsg:"You're running Mastra Studio locally. Want your team to collaborate?",isOnMastraPlatform:!1},state:e}):null]})]})}),e!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(tl.NavSeparator,{}),l.jsx(CCn,{collapsed:!1})]})]})]})}const s5n=S.createContext({theme:"system",setTheme:()=>null});function a5n({children:e,defaultTheme:t="system"}){const[n,r]=S.useState(t);return S.useEffect(()=>{const s=window.document.documentElement;if(s.classList.remove("light","dark"),n==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";s.classList.add(a);return}s.classList.add(n)},[n]),l.jsx(s5n.Provider,{value:{theme:n,setTheme:r},children:e})}const o5n=({children:e})=>{const{pathname:t}=Sl(),n=["/workflows","/datasets","/agents","/prompts","/processors","/mcps","/tools","/scorers","/templates"].includes(t);return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(H5t,{position:"bottom-right"}),l.jsx(a5n,{defaultTheme:"dark",attribute:"class",children:l.jsx(sd,{delayDuration:0,children:l.jsxs(YPn,{children:[l.jsx(HMn,{}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] h-full",children:[l.jsx(r5n,{}),n?l.jsx(eEe,{children:e}):l.jsx("div",{className:"bg-surface2 my-3 mr-3 rounded-lg border border-border1 overflow-y-auto",children:l.jsx(eEe,{children:e})})]})]})})})]})};function i5n({agentId:e}){const{isCmsAvailable:t}=qh();return l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/agents",children:[l.jsx(Te,{children:l.jsx($o,{})}),"Agents"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(mTn,{value:e,variant:"ghost",showSourceIcon:t})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Agents documentation"]})})]})}const l5n=({children:e})=>{const{agentId:t}=fa(),n=Sl(),{isCmsAvailable:r}=qh(),s=gY.has("datasets"),a=r&&s,o=n.pathname.includes("/playground")?"playground":n.pathname.includes("/traces")?"traces":"chat";return l.jsxs(jn,{className:"grid-rows-[auto_auto_1fr]",children:[l.jsx(i5n,{agentId:t}),l.jsx(EAn,{agentId:t,activeTab:o,showPlayground:a}),e]})};function c5n(){const{data:e={},isLoading:t,error:n}=yse();return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Processors documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx($0,{})," Processors"]})})}),l.jsx(aRn,{processors:e,isLoading:t,error:n})]})})]})}function u5n(){const{processorId:e}=fa(),{data:t,isLoading:n,error:r}=eJe(e);return r&&ta(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/processors",children:[l.jsx(Te,{children:l.jsx($0,{})}),"Processors"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(MDn,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/processors",children:[l.jsx(Te,{children:l.jsx($0,{})}),"Processors"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(cr,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(cr,{className:"h-8 w-48 mb-4"}),l.jsx(cr,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/processors",children:[l.jsx(Te,{children:l.jsx($0,{})}),"Processors"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(dRn,{value:e,variant:"ghost"})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Processors documentation"]})})]}),l.jsx(lRn,{processorId:e})]})}function d5n(){const{data:e={},isLoading:t}=of(),{data:n={},isLoading:r,error:s}=U2(),a=t||r;return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Tools documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:a,children:[l.jsx(zi,{})," Tools"]})})}),l.jsx(hRn,{tools:n,agents:e,isLoading:a,error:s})]})})]})}const f5n={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${t}?agentId=${encodeURIComponent(e)}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,n)=>n?`/agents/${e}/chat/${t}?messageId=${n}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${xo()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t)=>t?`/workspaces/${t}/skills/${e}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t)=>t?`/workspaces/${t}/skills/${e}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`},p5n=()=>{const e=fu(),t=n=>e(n,{viewTransition:!0});return l.jsx(E1n,{Link:FLn,navigate:t,paths:f5n,children:l.jsx(o5n,{children:l.jsx(EE,{})})})},h5n=!!window.MASTRA_CLOUD_API_ENDPOINT,OTe=gY.has("datasets"),kTe=[{index:!0,element:l.jsx(GLn,{})},{path:"instruction-blocks",element:l.jsx(WLn,{})},{path:"tools",element:l.jsx(KLn,{})},{path:"agents",element:l.jsx(VLn,{})},{path:"scorers",element:l.jsx(YLn,{})},{path:"workflows",element:l.jsx(e3n,{})},{path:"skills",element:l.jsx(XLn,{})},{path:"memory",element:l.jsx(ZLn,{})},{path:"variables",element:l.jsx(JLn,{})}],m5n=[{path:"/login",element:l.jsx(b3n,{})},{path:"/signup",element:l.jsx(P3n,{})},{element:l.jsx(p5n,{}),children:[...h5n?[]:[{path:"/settings",element:l.jsx(I3n,{})},{path:"/templates",element:l.jsx(G3n,{})},{path:"/templates/:templateSlug",element:l.jsx(Z3n,{})}],{path:"/scorers",element:l.jsx(j3n,{})},{path:"/scorers/:scorerId",element:l.jsx(A3n,{})},{path:"/observability",element:l.jsx(C3n,{})},{path:"/agents",element:l.jsx(zLn,{})},{path:"/cms/agents/create",element:l.jsx(QLn,{}),children:kTe},{path:"/cms/agents/:agentId/edit",element:l.jsx(HLn,{}),children:kTe},{path:"/cms/scorers/create",element:l.jsx(s3n,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(o3n,{})},{path:"/prompts",element:l.jsx(T3n,{})},{path:"/cms/prompts/create",element:l.jsx(t3n,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(r3n,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(Y3n,{})},{path:"/agents/:agentId",element:l.jsx(l5n,{children:l.jsx(EE,{})}),children:[{index:!0,loader:({params:e})=>WV(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(hTe,{})},{path:"chat/:threadId",element:l.jsx(hTe,{})},...OTe?[{path:"playground",element:l.jsx(ULn,{})}]:[],{path:"traces",element:l.jsx(qLn,{})}]},{path:"/tools",element:l.jsx(d5n,{})},{path:"/tools/:toolId",element:l.jsx(X3n,{})},{path:"/processors",element:l.jsx(c5n,{})},{path:"/processors/:processorId",element:l.jsx(u5n,{})},{path:"/mcps",element:l.jsx(y3n,{})},{path:"/mcps/:serverId",element:l.jsx(v3n,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx(x3n,{})},{path:"/workspaces",element:l.jsx(STe,{})},{path:"/workspaces/:workspaceId",element:l.jsx(STe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(e5n,{})},{path:"/workflows",element:l.jsx(K3n,{})},{path:"/workflows/:workflowId",element:l.jsx(x2n,{children:l.jsx(EE,{})}),children:[{index:!0,loader:({params:e})=>WV(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(wTe,{})},{path:"graph/:runId",element:l.jsx(wTe,{})}]},...OTe?[{path:"/datasets",element:l.jsx(i3n,{})},{path:"/datasets/:datasetId",element:l.jsx(l3n,{})},{path:"/datasets/:datasetId/items/:itemId",element:l.jsx(d3n,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:l.jsx(h3n,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:l.jsx(c3n,{})},{path:"/datasets/:datasetId/experiments",element:l.jsx(u3n,{})},{path:"/datasets/:datasetId/items",element:l.jsx(f3n,{})},{path:"/datasets/:datasetId/versions",element:l.jsx(g3n,{})}]:[],{index:!0,loader:()=>WV("/agents")},{path:"/request-context",element:l.jsx(N3n,{})}]}];function g5n(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:s}=use();if(s)return null;if(!t)return l.jsx(jCn,{});const a=i2n(m5n,{basename:e});return l.jsx(CVt,{baseUrl:t,headers:n,apiPrefix:r,children:l.jsx(DLn,{children:l.jsx(RDn,{router:a})})})}function b5n(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",n=window.MASTRA_SERVER_PORT||4111,r=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",o=s||(a?window.location.origin:`${e}://${t}:${n}`);return l.jsx(cMn,{children:l.jsx(wCn,{endpoint:o,defaultApiPrefix:r,children:l.jsx(g5n,{})})})}Ert.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(b5n,{})}));const v6n=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{Y$e as A,B4e as B,K$e as C,z2e as D,nu as E,Fu as F,p6n as G,Zln as H,ws as I,v6n as J,Ry as L,Z$e as N,c2 as _,hyt as a,jyt as b,x5n as c,xue as d,Py as e,Eyt as f,E0 as g,Nyt as h,yv as i,vv as j,bv as k,l$t as l,G2e as m,Ty as n,$s as o,OMt as p,SMt as q,BK as r,zX as s,re as t,XR as u,Al as v,vyt as w,it as x,We as y,uLe as z};
|
|
487
|
+
`).reduce((i,c)=>{if(!c||c.startsWith("#"))return i;const[u,d]=c.split("=");return u&&(i[u]=d?.split("")?.every(f=>f==="*")?"":d?.replaceAll('"',"")),i},{}):{}}const L3n=()=>qt({queryKey:["mastra-templates"],queryFn:htt}),F3n=({repoOrSlug:e,owner:t})=>qt({queryKey:["template-repo",e,t],queryFn:()=>$3n({repoOrSlug:e,owner:t})}),z3n=({repo:e,owner:t,branch:n})=>qt({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>D3n({repo:e,owner:t,branch:n})}),B3n=()=>{const e=Xe();return qt({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},U3n=()=>{const e=Xe();return Ln({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},q3n=()=>{const e=Xe();return Ln({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},xTe=(e,t,n)=>{let r={...t};if(!(r.payload?.workflowState?.steps&&Object.keys(r.payload.workflowState.steps).length>0)&&n?.allSteps&&(r.payload={...r.payload,workflowState:{...r.payload?.workflowState,steps:Object.keys(n.allSteps).reduce((a,o)=>(a[o]={id:o,description:n.allSteps[o].description,status:"pending"},a),{})}}),e.type==="start"||e.type==="workflow-start"){const a={};n?.allSteps&&Object.entries(n.allSteps).forEach(([i,c])=>{a[i]={id:c.id,description:c.description,status:"pending"}});const o=e.runId||e.payload?.runId;r={...r,runId:o,eventTimestamp:new Date().toISOString(),status:"running",phase:"initializing",payload:{workflowState:{status:"running",steps:a},currentStep:null}}}if(e.type==="step-start"||e.type==="workflow-step-start"){const a=e.payload.id;r={...r,phase:"processing",payload:{...r.payload,currentStep:{id:a,status:"running",startTime:new Date,...e.payload},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[a]:{...r.payload.workflowState.steps[a],status:"running",startTime:new Date,...e.payload}}}}}}if(e.type==="step-result"||e.type==="workflow-step-result"){const a=e.payload.id,o=e.payload.status,i=e.payload.error;r={...r,payload:{...r.payload,currentStep:{...r.payload.currentStep,status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[a]:{...r.payload.workflowState.steps[a],status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date}}}}},o==="failed"&&i&&(r={...r,status:"failed",error:i,phase:"error",failedStep:{id:a,error:i,description:e.payload.description||a},payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date})}return(e.type==="step-finish"||e.type==="workflow-step-finish")&&(r={...r,payload:{...r.payload,currentStep:null}}),(e.type==="finish"||e.type==="workflow-finish")&&(r.phase==="error"||r.status==="failed"?r={...r,completedAt:new Date}:r={...r,status:e.payload.status||"completed",phase:"completed",payload:{...r.payload,currentStep:null,workflowState:{...r.payload.workflowState,status:e.payload.status||"completed"}},completedAt:new Date}),e.type==="error"&&(r={...r,status:"failed",error:e.payload.error,phase:"error",payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date}),{newState:r}},V3n=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(n){console.warn("Failed to save template state to localStorage:",n)}},mtt=(e,t)=>{const[n,r]=S.useState({}),[s,a]=S.useState(!1);return{streamResult:n,isStreaming:s,processStream:async(i,c)=>{if(a(!0),r({}),!i)throw new Error("No stream returned");const u=i.getReader();let d={runId:c||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:f,value:p}=await u.read();if(f)break;const{newState:h}=xTe(p,d,e);if(d=h,r(h),p.runId||c||t){const g=p.runId||c||t;V3n(g,h)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:p}=xTe({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(p)}finally{a(!1),u.releaseLock()}}}},Q3n=e=>{const t=Xe(),{streamResult:n,isStreaming:r,processStream:s}=mtt(e);return{streamInstall:Ln({mutationFn:async({inputData:o,selectedModel:i,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),p=new dh;p.set("selectedModel",i);const h=await f.stream({inputData:o,requestContext:p},c);await s(h,c);return}catch(f){console.error(`💥 [streamInstall] Attempt ${d} failed:`,f);const p=f?.message?.includes("Failed to fetch")||f?.message?.includes("NetworkError")||f?.message?.includes("network error")||f?.message?.includes("fetch")||f?.code==="NETWORK_ERROR"||f?.name==="TypeError";if(console.warn(`Stream attempt ${d}/3 failed:`,f),p){const h=c?`Network error during template installation (likely hot reload). Please refresh the page to resume from where you left off using runId: ${c}`:"Network error during template installation (likely hot reload). Please try again.";throw console.error("🔌 Stream network error:",h),new Error(h)}throw console.error("❌ [streamInstall] Non-network error or max retries reached, throwing:",f),f}}}),streamResult:n,isStreaming:r}},H3n=e=>{const t=Xe(),{streamResult:n,isStreaming:r,processStream:s}=mtt(e);return{observeInstall:Ln({mutationFn:async({runId:o})=>{for(let u=1;u<=3;u++)try{const f=await t.getAgentBuilderAction("merge-template").observeStream({runId:o});await s(f,o);return}catch(d){console.error(`💥 [observeInstall] Attempt ${u} failed:`,d);const f=d?.message?.includes("Failed to fetch")||d?.message?.includes("NetworkError")||d?.message?.includes("network error")||d?.message?.includes("fetch")||d?.code==="NETWORK_ERROR"||d?.name==="TypeError";if(console.warn(`ObserveStream attempt ${u}/3 failed:`,d),f&&u<3){console.info(`🔄 ObserveStream network error detected (likely hot reload), retrying in 2000ms... (attempt ${u+1}/3)`),await new Promise(p=>setTimeout(p,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:n,isStreaming:r}};function G3n(){const{data:e,isLoading:t}=L3n(),{templates:n,tags:r,providers:s}=e??{templates:[],tags:[],providers:[]};return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Templates documentation"]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[90rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx(wte,{})," Templates"]})})}),l.jsx(xRn,{templates:n,tags:r??[],providers:s??[],isLoading:t})]})})]})}const W3n="1.13.0";function Z3n(){const{templateSlug:e}=fa(),[t,n]=Gi(),[r,s]=S.useState(""),[a,o]=S.useState(""),[i,c]=S.useState(""),[u,d]=S.useState({}),[f,p]=S.useState([]),[h,g]=S.useState(null),[b,y]=S.useState(!1),[x,w]=S.useState(""),[O,_]=S.useState(!1),[C,E]=S.useState(!1),[T,N]=S.useState([]),{data:A,isLoading:I}=F3n({repoOrSlug:e,owner:"mastra-ai"}),$=W3n?.includes("beta")??!1?"beta":"main",{data:U,isLoading:L}=z3n({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:$}),{data:B,isLoading:H}=B3n(),{mutateAsync:q,isPending:V}=U3n(),{mutateAsync:W}=q3n(),{streamInstall:D,streamResult:Z,isStreaming:z}=Q3n(B),{observeInstall:R,streamResult:Q,isStreaming:G}=H3n(B);S.useEffect(()=>{const se=t.get("runId");se&&!b&&!h&&!z&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:se}),w(se),W({runId:se}).then(te=>{const he=te.snapshot;if(he?.status==="success"&&he?.result?.success)y(!0);else if(he?.result?.success===!1)if(he?.result?.validationResults&&!he?.result?.validationResults?.valid&&he?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ge,errors:je}=he.result.validationResults,Oe=`Template installation completed but ${ge} validation issue${ge>1?"s":""} remain unresolved.`;g(Oe),N(je||[])}else g(he?.result?.message||he?.result?.error||"Template installation failed")}).catch(te=>{console.error("❌ Failed to fetch run details:",te),g("Failed to retrieve installation status after reload")}))},[t,b,h,z,G,W]),S.useEffect(()=>{const se=t.get("runId"),te=t.get("resume"),he=t.get("provider");if(se&&te==="true"&&he&&!z&&!G&&!O&&!C&&B){w(se),_(!0);try{W({runId:se}).then(le=>{if(le.snapshot?.status==="running")return R.mutateAsync({runId:se})}).then(()=>{n(le=>{const ge=new URLSearchParams(le);return ge.delete("resume"),ge})}).catch(le=>{console.error("❌ Failed to resume template installation:",le),le.message?.includes("404")||le.message?.includes("not found")?g("Template installation run not found. It may have expired or been completed."):g("Failed to resume template installation. Please try again.")})}catch(le){console.error("❌ Auto-resume failed with error:",le),g("Failed to resume template installation. Please refresh and try again.")}}},[t,e,z,G,O,C,B,W,R,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ee=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(se=>se).join(", "):"n/a",icon:l.jsx(zi,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(se=>se).join(", "):"n/a",icon:l.jsx($o,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(se=>se).join(", "):"n/a",icon:l.jsx(Iqt,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:l.jsx($Ut,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:l.jsx(Cqt,{})}],ne=[{...ee[0]},{...ee[1]},{...ee[2]}].filter(se=>se.value!=="n/a");S.useEffect(()=>{U&&d(U)},[U]),S.useEffect(()=>{const se=Z||Q;se?.phase==="error"&&se?.error&&g(se.error)},[Z?.phase,Z?.error,Q?.phase,Q?.error]);const ae=se=>{s(se)},ce=async se=>(o(se.provider),c(se.modelId),{message:"Model updated successfully"}),ye=async()=>{const se=Object.entries(u).reduce((te,[he,le])=>(le===""&&te.push(he),te),[]);if(se.length>0){p(se);return}if(A){g(null),y(!1),w(""),E(!0);try{const he={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:$,slug:A.slug,variables:u},{runId:le}=await q({});w(le),n(ge=>{const je=new URLSearchParams(ge);return je.set("runId",le),je.set("resume","true"),je.set("provider",r||"openai"),je}),await D.mutateAsync({inputData:he,selectedModel:{provider:a,modelId:i},runId:le})}catch(te){E(!1),g(te?.message||"Template installation failed"),console.error("Template installation failed",te)}}},Y=se=>{const{name:te,value:he}=se.target;he.trim()===""?p(le=>[...le,te]):p(le=>le.filter(ge=>ge!==te)),d(le=>({...le,[te]:he}))};return l.jsxs(jn,{children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/templates",children:[l.jsx(Te,{children:l.jsx(wte,{})}),"Templates"]}),l.jsx(hn,{as:Dt,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),l.jsx("div",{className:K("w-full lg:px-12 h-full overflow-y-scroll"),children:l.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[l.jsx(SRn,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:ee,templateSlug:e}),A&&l.jsxs(l.Fragment,{children:[(z||G)&&l.jsx(TRn,{name:A.title,streamResult:G?Q:Z,runId:x,workflowInfo:B}),b&&l.jsx(NRn,{name:A.title,installedEntities:ne,linkComponent:Dt}),h&&l.jsx(jRn,{errorMsg:h,validationErrors:T.length>0?T:Z?.validationResults?.errors||Q?.validationResults?.errors}),!z&&!G&&!b&&!h&&l.jsx(ORn,{providerOptions:J,selectedProvider:r,onProviderChange:ae,variables:u,setVariables:d,errors:f,setErrors:p,handleInstallTemplate:ye,handleVariableChange:Y,isLoadingEnvVars:L||H,isInstalling:V,defaultModelProvider:a,defaultModelId:i,onModelUpdate:ce})]})]})})]})}const Y3n=()=>{const{toolId:e,agentId:t}=fa();return l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/agents",children:[l.jsx(Te,{children:l.jsx($o,{})}),"Agents"]}),l.jsx(hn,{as:Dt,to:`/agents/${t}/chat`,children:t}),l.jsx(hn,{as:Dt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Tools documentation"]})})]}),l.jsx(xTn,{toolId:e,agentId:t})]})},X3n=()=>{const{toolId:e}=fa();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/tools",children:[l.jsx(Te,{children:l.jsx(zi,{})}),"Tools"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(bRn,{value:e,variant:"ghost"})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Tools documentation"]})})]}),l.jsx(gRn,{toolId:e})]})};function K3n(){const{data:e,isLoading:t,error:n}=Fh();return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Workflows documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx(yl,{})," Workflows"]})})}),l.jsx(ykn,{workflows:e||{},isLoading:t,error:n})]})})]})}const wTe=()=>{const{workflowId:e}=fa(),{data:t,isLoading:n,error:r}=sT(e);return r&&ta(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"workflows"})}):l.jsx(rYe,{workflowId:e,workflow:t??void 0,isLoading:n})};function STe(){const{workspaceId:e}=fa(),[t,n]=Gi(),r=fu(),[s,a]=S.useState(!1),[o,i]=S.useState(!1),[c,u]=S.useState(!1),[d,f]=S.useState(null),[p,h]=S.useState(null),[g,b]=S.useState(!1),y=t.get("file"),x=t.get("tab"),{data:w,error:O,isLoading:_}=mKe(),C=w?.workspaces??[],E=e??C[0]?.id,{data:T,isLoading:N,error:A}=gjn(E),I=ta(O)||ta(A),P=t.get("path")||".",$=dZ(O)||dZ(A),U=E?C.find(Ue=>Ue.id===E):void 0,L=Ue=>{const et=new URLSearchParams(t);for(const[Ye,Ht]of Object.entries(Ue))Ht===null?et.delete(Ye):et.set(Ye,Ht);n(et)},B=Ue=>{b(!1),a(!1),r(`/workspaces/${Ue}`)},H=Ue=>{L({path:Ue==="."||Ue===""?null:Ue,file:null})},q=Ue=>{L({file:Ue})},V=Ue=>{L({tab:Ue})},W=P,D=y,{data:Z,isLoading:z,error:R,refetch:Q}=bjn(W,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:E}),G=vjn(),J=xjn(),{data:ee,isLoading:ne}=gKe(D??"",{enabled:!!D,workspaceId:E}),{data:ae,isLoading:ce,refetch:ye}=Sjn({workspaceId:E}),Y=Njn(),se=jjn(),te=Ajn(),he=T?.isWorkspaceConfigured??!1,le=T?.capabilities?.hasFilesystem??!1,ge=T?.capabilities?.hasSkills??!1,je=T?.capabilities?.canBM25??!1,Oe=T?.capabilities?.canVector??!1,ie=U?.safety?.readOnly??!1,de=le&&!ie,pe=T?.mounts,Ce=pe?.filter(Ue=>!Ue.readOnly).map(Ue=>({path:Ue.path,displayName:Ue.displayName,icon:Ue.icon,provider:Ue.provider,name:Ue.name})),Ee=pe&&pe.length>1?pe.map(Ue=>Ue.path):void 0,ve=S.useCallback(Ue=>{E&&Y.mutate({...Ue,workspaceId:E},{onSuccess:async et=>{if(et.success){u(!1);const{data:Ye,error:Ht}=await ye();if(Ht||!Ye){qe.success(`Skill "${et.skillName}" installed successfully (${et.filesWritten} files)`);return}Ye.skills.some(pr=>pr.name===et.skillName)?qe.success(`Skill "${et.skillName}" installed successfully (${et.filesWritten} files)`):(b(!0),qe.warning(`Skill "${et.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else qe.error("Failed to install skill")},onError:et=>{qe.error(`Failed to install skill: ${et instanceof Error?et.message:"Unknown error"}`)}})},[E,Y,ye]),ue=S.useCallback(Ue=>{E&&(h(Ue),se.mutate({workspaceId:E,skillName:Ue},{onSuccess:et=>{if(h(null),et.updated.length>0){const Ye=et.updated[0];Ye.success?(qe.success(`Skill "${Ue}" updated successfully (${Ye.filesWritten} files)`),ye()):qe.error(`Failed to update skill: ${Ye.error??"Unknown error"}`)}else qe.error("Failed to update skill: No update result returned")},onError:et=>{h(null),qe.error(`Failed to update skill: ${et instanceof Error?et.message:"Unknown error"}`)}}))},[E,se,ye]),_e=S.useCallback(Ue=>{E&&(f(Ue),te.mutate({workspaceId:E,skillName:Ue},{onSuccess:et=>{f(null),et.success?(qe.success(`Skill "${et.skillName}" removed successfully`),ye()):qe.error(`Failed to remove skill "${et.skillName}"`)},onError:et=>{f(null),qe.error(`Failed to remove skill: ${et instanceof Error?et.message:"Unknown error"}`)}}))},[E,te,ye]),Ke=x==="files"&&le?"files":x==="skills"&&ge?"skills":le?"files":ge?"skills":"files",pt=ae?.skills??[],Et=ae?.isSkillsConfigured??!1,Ct=Z?.entries??[],fn=le&&(je||Oe),yt=ge&&Et&&pt.length>0,dt=fn||yt;return I?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"workspaces"})})]}):$?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(Ek,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(Sf,{})}),l.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[l.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:l.jsx(QG,{className:"h-8 w-8 text-amber-500"})}),l.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),l.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",l.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Learn More"]})]})]})})]}):_?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Tn,{})})]}):!N&&!_&&!he?l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(Ek,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(Sf,{})}),l.jsx(NMn,{})]})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[l.jsxs(oo,{children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(Va,{children:[dt&&l.jsxs(me,{variant:"light",onClick:()=>a(!s),children:[l.jsx(Te,{children:l.jsx(kqt,{className:"h-4 w-4"})}),"Search"]}),l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Workspaces documentation"]})]})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[l.jsx(Ek,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(Sf,{})}),C.length>1&&l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>i(!o),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[U?.source==="agent"?l.jsx(XA,{className:"h-4 w-4 text-accent1"}):l.jsx(_B,{className:"h-4 w-4 text-neutral4"}),l.jsxs("span",{className:"flex-1 text-left truncate",children:[U?.name??"Select workspace",U?.source==="agent"&&U.agentName&&l.jsxs("span",{className:"text-neutral4 ml-1",children:["(",U.agentName,")"]})]}),l.jsx(BUt,{className:`h-4 w-4 text-neutral4 transition-transform ${o?"rotate-180":""}`})]}),o&&l.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:C.map(Ue=>l.jsxs("button",{onClick:()=>{B(Ue.id),i(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${U?.id===Ue.id?"bg-surface3":""}`,children:[Ue.source==="agent"?l.jsx(XA,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):l.jsx(_B,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Ue.name}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:Ue.source==="agent"?`Agent: ${Ue.agentName}`:"Global workspace"})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[Ue.safety?.readOnly&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Ue.capabilities.hasFilesystem&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Ue.capabilities.hasSandbox&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Ue.capabilities.hasSkills&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Ue.id))})]}),C.length===1&&U&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[U.source==="agent"?l.jsx(XA,{className:"h-4 w-4 text-accent1"}):l.jsx(_B,{className:"h-4 w-4"}),l.jsx("span",{children:U.name}),U.source==="agent"&&U.agentName&&l.jsxs("span",{className:"text-neutral3",children:["(",U.agentName,")"]}),ie&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&dt&&E&&l.jsx(J3n,{workspaceId:E,canSearchFiles:fn,canSearchSkills:yt,canBM25:je,canVector:Oe,showInitWarning:!N&&T?.status!=="ready",onViewFileResult:Ue=>{L({file:Ue,tab:"files"})},onViewSkillResult:Ue=>{E&&r(`/workspaces/${E}/skills/${encodeURIComponent(Ue)}`)}},E),l.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[le&&l.jsxs("button",{onClick:()=>V("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Ke==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(PD,{className:"h-4 w-4"}),"Files"]}),ge&&l.jsxs("button",{onClick:()=>V("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Ke==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(FI,{className:"h-4 w-4"}),"Skills",Et&&pt.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:pt.length})]})]}),l.jsxs("div",{className:"pb-8",children:[Ke==="files"&&le&&l.jsx("div",{className:"space-y-4",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[l.jsx(_Mn,{entries:Ct,currentPath:W,isLoading:z,error:R,onNavigate:H,onFileSelect:q,onRefresh:()=>Q(),onCreateDirectory:ie?void 0:Ue=>J.mutate({path:Ue,workspaceId:E}),onDelete:ie?void 0:Ue=>G.mutate({path:Ue,recursive:!0,force:!0,workspaceId:E})}),D&&l.jsx(TMn,{path:D,content:ee?.content??"",isLoading:ne,mimeType:ee?.mimeType,onClose:()=>q(null)})]})}),Ke==="skills"&&ge&&l.jsx(LMn,{skills:pt,isLoading:ce,isSkillsConfigured:Et,hasUndiscoveredAgentSkills:g,basePath:E?`/workspaces/${E}/skills`:"/workspaces",onAddSkill:de?()=>u(!0):void 0,onUpdateSkill:de?ue:void 0,onRemoveSkill:de?_e:void 0,updatingSkillName:p??void 0,removingSkillName:d??void 0,mountPaths:Ee}),!le&&!ge&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),E&&de&&l.jsx(VMn,{open:c,onOpenChange:u,workspaceId:E,onInstall:ve,isInstalling:Y.isPending,installedSkillIds:pt.filter(Ue=>Ue.skillsShSource).map(Ue=>`${Ue.skillsShSource.owner}/${Ue.skillsShSource.repo}/${Ue.name}`),installedSkillNames:pt.filter(Ue=>!Ue.skillsShSource).map(Ue=>Ue.name),writableMounts:Ce,installedSkillPaths:Object.fromEntries(pt.filter(Ue=>Ue.path).map(Ue=>[Ue.name,Ue.path]))})]})}function J3n({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:s,showInitWarning:a,onViewFileResult:o,onViewSkillResult:i}){const c=wjn(),u=_jn();return l.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(PD,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&l.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",l.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",l.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),l.jsx(jMn,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:r,canVector:s,onViewResult:o})]}),n&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(FI,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(RMn,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>i(d.skillName)})]})]})}function e5n(){const{skillName:e,workspaceId:t}=fa(),[n]=Gi(),r=e?decodeURIComponent(e):"",s=n.get("agentId"),a=s?decodeURIComponent(s):null,o=a?`/agents/${a}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[i,c]=S.useState(null),{data:u,isLoading:d,error:f}=Ojn(r,{workspaceId:t}),{data:p}=gKe(u?.path?`${u.path}/SKILL.md`:"",{enabled:!!u?.path,workspaceId:t}),{data:h,isLoading:g}=kjn(r,i??"",{enabled:!!i,workspaceId:t}),b=y=>a?l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:o,children:[l.jsx(Te,{children:l.jsx(XA,{className:"h-4 w-4"})}),a]}),l.jsxs(hn,{as:"span",to:"",isCurrent:!0,children:[l.jsx(Te,{children:l.jsx(FI,{className:"h-4 w-4"})}),y]})]}):l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:o,children:[l.jsx(Te,{children:l.jsx(Sf,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(hn,{as:Dt,to:o,children:[l.jsx(Te,{children:l.jsx(FI,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:y})]});return d?l.jsxs(jn,{children:[l.jsx(Vn,{children:b("Loading...")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):f&&ta(f)?l.jsxs(jn,{children:[l.jsx(Vn,{children:b("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"workspaces"})})]}):f||!u?l.jsxs(jn,{children:[l.jsx(Vn,{children:b("Error")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),l.jsx("p",{className:"text-sm text-neutral3",children:f?.message??"Skill not found"})]})})]}):l.jsxs(jn,{children:[l.jsxs(Vn,{children:[b(r),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(Te,{children:l.jsx(Uo,{})}),"Documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:l.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:l.jsx(UMn,{skill:u,rawSkillMd:p?.content,onReferenceClick:c})})}),l.jsx(qMn,{open:!!i,onOpenChange:y=>!y&&c(null),skillName:r,referencePath:i??"",content:h?.content,isLoading:g})]})}const t5n=[{key:"main",links:[{name:"Agents",url:"/agents",icon:l.jsx($o,{}),isOnMastraPlatform:!0},{name:"Prompts",url:"/prompts",icon:l.jsx(PD,{}),isOnMastraPlatform:!0},{name:"Workflows",url:"/workflows",icon:l.jsx(yl,{}),isOnMastraPlatform:!0},{name:"Processors",url:"/processors",icon:l.jsx(HUt,{}),isOnMastraPlatform:!1},{name:"MCP Servers",url:"/mcps",icon:l.jsx(Zu,{}),isOnMastraPlatform:!0},{name:"Tools",url:"/tools",icon:l.jsx(zi,{}),isOnMastraPlatform:!0},{name:"Scorers",url:"/scorers",icon:l.jsx(yh,{}),isOnMastraPlatform:!0},{name:"Workspaces",url:"/workspaces",icon:l.jsx(Sf,{})},{name:"Request Context",url:"/request-context",icon:l.jsx(K8e,{}),isOnMastraPlatform:!0}]},{key:"observability",separator:!0,links:[{name:"Observability",url:"/observability",icon:l.jsx(dk,{}),isOnMastraPlatform:!0},{name:"Datasets",url:"/datasets",icon:l.jsx(sc,{}),isOnMastraPlatform:!1}]},{key:"Templates",separator:!0,links:[{name:"Templates",url:"/templates",icon:l.jsx(wte,{}),isOnMastraPlatform:!1}]},{key:"Settings",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(Gre,{}),isOnMastraPlatform:!1}]}],n5n={links:[{name:"Mastra APIs",url:"/swagger-ui",icon:l.jsx(XUt,{}),isOnMastraPlatform:!1},{name:"Documentation",url:"https://mastra.ai/en/docs",icon:l.jsx(uk,{}),isOnMastraPlatform:!0},{name:"Github",url:"https://github.com/mastra-ai/mastra",icon:l.jsx(E2,{}),isOnMastraPlatform:!0},{name:"Community",url:"https://discord.gg/BTYqqHKUrf",icon:l.jsx(dqt,{}),isOnMastraPlatform:!0}]};function r5n(){const{state:e}=mJe(),n=Sl().pathname,r=window?.MASTRA_HIDE_CLOUD_CTA==="true",{isMastraPlatform:s}=kJe(),{data:a}=lT(),{isCmsAvailable:o,isLoading:i}=qh(),c=a&&A2(a),u=new Set(["/prompts"]),d=f=>u.has(f.url)&&!o&&!i?!1:s?f.isOnMastraPlatform:!0;return l.jsxs(tl,{children:[l.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?l.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[l.jsx(by,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),c&&l.jsx(J_e,{})]}):c?l.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(by,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),l.jsx(J_e,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[l.jsx(by,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),l.jsx(tl.Nav,{children:t5n.map(f=>{const p=f.links.filter(d),h=p.length>0&&f?.separator;return l.jsxs(tl.NavSection,{children:[f?.title?l.jsx(tl.NavHeader,{state:e,children:f.title}):l.jsx(l.Fragment,{children:h&&l.jsx(tl.NavSeparator,{})}),l.jsx(tl.NavList,{children:p.map(g=>{const b=n.startsWith(g.url);return l.jsx(tl.NavLink,{state:e,link:g,isActive:b},g.name)})})]},f.key)})}),l.jsxs(tl.Bottom,{children:[l.jsx(tl.Nav,{children:l.jsxs(tl.NavSection,{children:[l.jsx(tl.NavSeparator,{}),l.jsxs(tl.NavList,{children:[n5n.links.filter(d).map(f=>l.jsx(tl.NavLink,{link:f,state:e},f.name)),!r&&!s?l.jsx(tl.NavLink,{link:{name:"Share",url:"https://mastra.ai/cloud",icon:l.jsx(qUt,{}),variant:"featured",tooltipMsg:"You're running Mastra Studio locally. Want your team to collaborate?",isOnMastraPlatform:!1},state:e}):null]})]})}),e!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(tl.NavSeparator,{}),l.jsx(CCn,{collapsed:!1})]})]})]})}const s5n=S.createContext({theme:"system",setTheme:()=>null});function a5n({children:e,defaultTheme:t="system"}){const[n,r]=S.useState(t);return S.useEffect(()=>{const s=window.document.documentElement;if(s.classList.remove("light","dark"),n==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";s.classList.add(a);return}s.classList.add(n)},[n]),l.jsx(s5n.Provider,{value:{theme:n,setTheme:r},children:e})}const o5n=({children:e})=>{const{pathname:t}=Sl(),n=["/workflows","/datasets","/agents","/prompts","/processors","/mcps","/tools","/scorers","/templates"].includes(t);return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(H5t,{position:"bottom-right"}),l.jsx(a5n,{defaultTheme:"dark",attribute:"class",children:l.jsx(sd,{delayDuration:0,children:l.jsxs(YPn,{children:[l.jsx(HMn,{}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] h-full",children:[l.jsx(r5n,{}),n?l.jsx(eEe,{children:e}):l.jsx("div",{className:"bg-surface2 my-3 mr-3 rounded-lg border border-border1 overflow-y-auto",children:l.jsx(eEe,{children:e})})]})]})})})]})};function i5n({agentId:e}){const{isCmsAvailable:t}=qh();return l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/agents",children:[l.jsx(Te,{children:l.jsx($o,{})}),"Agents"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(mTn,{value:e,variant:"ghost",showSourceIcon:t})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Agents documentation"]})})]})}const l5n=({children:e})=>{const{agentId:t}=fa(),n=Sl(),{isCmsAvailable:r}=qh(),s=gY.has("datasets"),a=r&&s,o=n.pathname.includes("/playground")?"playground":n.pathname.includes("/traces")?"traces":"chat";return l.jsxs(jn,{className:"grid-rows-[auto_auto_1fr]",children:[l.jsx(i5n,{agentId:t}),l.jsx(EAn,{agentId:t,activeTab:o,showPlayground:a}),e]})};function c5n(){const{data:e={},isLoading:t,error:n}=yse();return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Processors documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:t,children:[l.jsx($0,{})," Processors"]})})}),l.jsx(aRn,{processors:e,isLoading:t,error:n})]})})]})}function u5n(){const{processorId:e}=fa(),{data:t,isLoading:n,error:r}=eJe(e);return r&&ta(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/processors",children:[l.jsx(Te,{children:l.jsx($0,{})}),"Processors"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ya,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(MDn,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Vn,{children:l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/processors",children:[l.jsx(Te,{children:l.jsx($0,{})}),"Processors"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(cr,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(cr,{className:"h-8 w-48 mb-4"}),l.jsx(cr,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Vn,{children:[l.jsxs(da,{children:[l.jsxs(hn,{as:Dt,to:"/processors",children:[l.jsx(Te,{children:l.jsx($0,{})}),"Processors"]}),l.jsx(hn,{as:"span",to:"",isCurrent:!0,children:l.jsx(dRn,{value:e,variant:"ghost"})})]}),l.jsx(Va,{children:l.jsxs(me,{as:Dt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(Uo,{}),"Processors documentation"]})})]}),l.jsx(lRn,{processorId:e})]})}function d5n(){const{data:e={},isLoading:t}=of(),{data:n={},isLoading:r,error:s}=U2(),a=t||r;return l.jsxs(Gs,{children:[l.jsx(Gs.TopBar,{children:l.jsxs(me,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:["Tools documentation",l.jsx(Wg,{})]})}),l.jsx(Gs.Main,{children:l.jsxs("div",{className:"w-full max-w-[80rem] px-10 mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsx(gt,{children:l.jsx(gt.Column,{children:l.jsxs(gt.Title,{isLoading:a,children:[l.jsx(zi,{})," Tools"]})})}),l.jsx(hRn,{tools:n,agents:e,isLoading:a,error:s})]})})]})}const f5n={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${t}?agentId=${encodeURIComponent(e)}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,n)=>n?`/agents/${e}/chat/${t}?messageId=${n}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${xo()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t)=>t?`/workspaces/${t}/skills/${e}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t)=>t?`/workspaces/${t}/skills/${e}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`},p5n=()=>{const e=fu(),t=n=>e(n,{viewTransition:!0});return l.jsx(E1n,{Link:FLn,navigate:t,paths:f5n,children:l.jsx(o5n,{children:l.jsx(EE,{})})})},h5n=!!window.MASTRA_CLOUD_API_ENDPOINT,OTe=gY.has("datasets"),kTe=[{index:!0,element:l.jsx(GLn,{})},{path:"instruction-blocks",element:l.jsx(WLn,{})},{path:"tools",element:l.jsx(KLn,{})},{path:"agents",element:l.jsx(VLn,{})},{path:"scorers",element:l.jsx(YLn,{})},{path:"workflows",element:l.jsx(e3n,{})},{path:"skills",element:l.jsx(XLn,{})},{path:"memory",element:l.jsx(ZLn,{})},{path:"variables",element:l.jsx(JLn,{})}],m5n=[{path:"/login",element:l.jsx(b3n,{})},{path:"/signup",element:l.jsx(P3n,{})},{element:l.jsx(p5n,{}),children:[...h5n?[]:[{path:"/settings",element:l.jsx(I3n,{})},{path:"/templates",element:l.jsx(G3n,{})},{path:"/templates/:templateSlug",element:l.jsx(Z3n,{})}],{path:"/scorers",element:l.jsx(j3n,{})},{path:"/scorers/:scorerId",element:l.jsx(A3n,{})},{path:"/observability",element:l.jsx(C3n,{})},{path:"/agents",element:l.jsx(zLn,{})},{path:"/cms/agents/create",element:l.jsx(QLn,{}),children:kTe},{path:"/cms/agents/:agentId/edit",element:l.jsx(HLn,{}),children:kTe},{path:"/cms/scorers/create",element:l.jsx(s3n,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(o3n,{})},{path:"/prompts",element:l.jsx(T3n,{})},{path:"/cms/prompts/create",element:l.jsx(t3n,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(r3n,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(Y3n,{})},{path:"/agents/:agentId",element:l.jsx(l5n,{children:l.jsx(EE,{})}),children:[{index:!0,loader:({params:e})=>WV(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(hTe,{})},{path:"chat/:threadId",element:l.jsx(hTe,{})},...OTe?[{path:"playground",element:l.jsx(ULn,{})}]:[],{path:"traces",element:l.jsx(qLn,{})}]},{path:"/tools",element:l.jsx(d5n,{})},{path:"/tools/:toolId",element:l.jsx(X3n,{})},{path:"/processors",element:l.jsx(c5n,{})},{path:"/processors/:processorId",element:l.jsx(u5n,{})},{path:"/mcps",element:l.jsx(y3n,{})},{path:"/mcps/:serverId",element:l.jsx(v3n,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx(x3n,{})},{path:"/workspaces",element:l.jsx(STe,{})},{path:"/workspaces/:workspaceId",element:l.jsx(STe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(e5n,{})},{path:"/workflows",element:l.jsx(K3n,{})},{path:"/workflows/:workflowId",element:l.jsx(x2n,{children:l.jsx(EE,{})}),children:[{index:!0,loader:({params:e})=>WV(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(wTe,{})},{path:"graph/:runId",element:l.jsx(wTe,{})}]},...OTe?[{path:"/datasets",element:l.jsx(i3n,{})},{path:"/datasets/:datasetId",element:l.jsx(l3n,{})},{path:"/datasets/:datasetId/items/:itemId",element:l.jsx(d3n,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:l.jsx(h3n,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:l.jsx(c3n,{})},{path:"/datasets/:datasetId/experiments",element:l.jsx(u3n,{})},{path:"/datasets/:datasetId/items",element:l.jsx(f3n,{})},{path:"/datasets/:datasetId/versions",element:l.jsx(g3n,{})}]:[],{index:!0,loader:()=>WV("/agents")},{path:"/request-context",element:l.jsx(N3n,{})}]}];function g5n(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:s}=use();if(s)return null;if(!t)return l.jsx(jCn,{});const a=i2n(m5n,{basename:e});return l.jsx(CVt,{baseUrl:t,headers:n,apiPrefix:r,children:l.jsx(DLn,{children:l.jsx(RDn,{router:a})})})}function b5n(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",n=window.MASTRA_SERVER_PORT||4111,r=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",o=s||(a?window.location.origin:`${e}://${t}:${n}`);return l.jsx(cMn,{children:l.jsx(wCn,{endpoint:o,defaultApiPrefix:r,children:l.jsx(g5n,{})})})}Ert.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(b5n,{})}));const v6n=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{Y$e as A,B4e as B,K$e as C,z2e as D,nu as E,Fu as F,p6n as G,Zln as H,ws as I,v6n as J,Ry as L,Z$e as N,c2 as _,hyt as a,jyt as b,x5n as c,xue as d,Py as e,Eyt as f,E0 as g,Nyt as h,yv as i,vv as j,bv as k,l$t as l,G2e as m,Ty as n,$s as o,OMt as p,SMt as q,BK as r,zX as s,re as t,XR as u,Al as v,vyt as w,it as x,We as y,uLe as z};
|