@zuplo/editor 1.0.28207841900 → 1.0.28230807336

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/static/js/editor.main-DJeeFilR.js","/static/js/chunk-D9Tnb9aB.js","/static/js/main-CtoNv4T6.js","/static/js/editor.api2-BgpEDUgR.js","/static/css/editor-DU9oqspw.css","/static/js/workers-BAYC34vF.js","/static/js/monaco.contribution-BSMYW0Ik.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,r,t as i}from"./chunk-D9Tnb9aB.js";import{t as a}from"./main-CtoNv4T6.js";var o=i((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),s=i(((e,t)=>{t.exports=o()})),c=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}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,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),l=i(((e,t)=>{t.exports=c()})),u=i((e=>{var t=s();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),d=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=u()})),f=i((e=>{var t=l(),n=s(),r=d();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(o(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return f(a),e;if(s===r)return f(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],ee=-1;function te(e){return{current:e}}function ne(e){0>ee||(e.current=z[ee],z[ee]=null,ee--)}function B(e,t){ee++,z[ee]=e.current,e.current=t}var re=te(null),ie=te(null),ae=te(null),oe=te(null);function se(e,t){switch(B(ae,t),B(ie,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ed(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ed(t),e=Dd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ne(re),B(re,e)}function ce(){ne(re),ne(ie),ne(ae)}function le(e){e.memoizedState!==null&&B(oe,e);var t=re.current,n=Dd(t,e.type);t!==n&&(B(ie,e),B(re,n))}function ue(e){ie.current===e&&(ne(re),ne(ie)),oe.current===e&&(ne(oe),wf._currentValue=R)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/static/js/editor.main-B2OfgmKo.js","/static/js/chunk-D9Tnb9aB.js","/static/js/main-bBnyDs1w.js","/static/js/editor.api2-BgpEDUgR.js","/static/css/editor-DU9oqspw.css","/static/js/workers-BAYC34vF.js","/static/js/monaco.contribution-yPY7zkuW.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,n,r,t as i}from"./chunk-D9Tnb9aB.js";import{t as a}from"./main-bBnyDs1w.js";var o=i((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),s=i(((e,t)=>{t.exports=o()})),c=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}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,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),l=i(((e,t)=>{t.exports=c()})),u=i((e=>{var t=s();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),d=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=u()})),f=i((e=>{var t=l(),n=s(),r=d();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(o(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return f(a),e;if(s===r)return f(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],ee=-1;function te(e){return{current:e}}function ne(e){0>ee||(e.current=z[ee],z[ee]=null,ee--)}function B(e,t){ee++,z[ee]=e.current,e.current=t}var re=te(null),ie=te(null),ae=te(null),oe=te(null);function se(e,t){switch(B(ae,t),B(ie,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ed(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ed(t),e=Dd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ne(re),B(re,e)}function ce(){ne(re),ne(ie),ne(ae)}function le(e){e.memoizedState!==null&&B(oe,e);var t=re.current,n=Dd(t,e.type);t!==n&&(B(ie,e),B(re,n))}function ue(e){ie.current===e&&(ne(re),ne(ie)),oe.current===e&&(ne(oe),wf._currentValue=R)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+de+e+fe}var me=!1;function he(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -90,10 +90,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
90
90
  `},uSe=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},dSe=function(){g.useEffect(function(){return document.body.setAttribute(xw,(uSe()+1).toString()),function(){var e=uSe()-1;e<=0?document.body.removeAttribute(xw):document.body.setAttribute(xw,e.toString())}},[])},fSe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;dSe();var a=g.useMemo(function(){return sSe(i)},[i]);return g.createElement(cSe,{styles:lSe(a,!t,i,n?``:`!important`)})},Sw=!1;if(typeof window<`u`)try{var Cw=Object.defineProperty({},`passive`,{get:function(){return Sw=!0,!0}});window.addEventListener(`test`,Cw,Cw),window.removeEventListener(`test`,Cw,Cw)}catch{Sw=!1}var ww=Sw?{passive:!1}:!1,pSe=function(e){return e.tagName===`TEXTAREA`},mSe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!pSe(e)&&n[t]===`visible`)},hSe=function(e){return mSe(e,`overflowY`)},gSe=function(e){return mSe(e,`overflowX`)},_Se=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),bSe(e,r)){var i=xSe(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},vSe=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ySe=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},bSe=function(e,t){return e===`v`?hSe(t):gSe(t)},xSe=function(e,t){return e===`v`?vSe(t):ySe(t)},SSe=function(e,t){return e===`h`&&t===`rtl`?-1:1},CSe=function(e,t,n,r,i){var a=SSe(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{var p=xSe(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&bSe(e,s)&&(d+=h,f+=m),s=s instanceof ShadowRoot?s.host:s.parentNode}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Tw=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wSe=function(e){return[e.deltaX,e.deltaY]},TSe=function(e){return e&&`current`in e?e.current:e},ESe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},DSe=function(e){return`
91
91
  .block-interactivity-${e} {pointer-events: none;}
92
92
  .allow-interactivity-${e} {pointer-events: all;}
93
- `},OSe=0,Ew=[];function kSe(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(OSe++)[0],a=g.useState(yw)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=zxe([e.lockRef.current],(e.shards||[]).map(TSe),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=g.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Tw(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=_Se(d,u);if(!f)return!0;if(f?l=d:(l=d===`v`?`h`:`v`,f=_Se(d,u)),!f)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var p=r.current||l;return CSe(p,t,e,p===`h`?s:c,!0)},[]),c=g.useCallback(function(e){var n=e;if(!(!Ew.length||Ew[Ew.length-1]!==a)){var r=`deltaY`in n?wSe(n):Tw(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ESe(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(TSe).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=g.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ASe(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=g.useCallback(function(e){n.current=Tw(e),r.current=void 0},[]),d=g.useCallback(function(t){l(t.type,wSe(t),t.target,s(t,e.lockRef.current))},[]),f=g.useCallback(function(t){l(t.type,Tw(t),t.target,s(t,e.lockRef.current))},[]);g.useEffect(function(){return Ew.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ww),document.addEventListener(`touchmove`,c,ww),document.addEventListener(`touchstart`,u,ww),function(){Ew=Ew.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ww),document.removeEventListener(`touchmove`,c,ww),document.removeEventListener(`touchstart`,u,ww)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(a,{styles:DSe(i)}):null,p?g.createElement(fSe,{gapMode:e.gapMode}):null)}function ASe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jSe=Xxe(Zxe,kSe),Dw=g.forwardRef(function(e,t){return g.createElement(vw,fw({},e,{ref:t,sideCar:jSe}))});Dw.classNames=vw.classNames;var Ow=[`Enter`,` `],MSe=[`ArrowDown`,`PageUp`,`Home`],NSe=[`ArrowUp`,`PageDown`,`End`],PSe=[...MSe,...NSe],FSe={ltr:[...Ow,`ArrowRight`],rtl:[...Ow,`ArrowLeft`]},ISe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},kw=`Menu`,[Aw,LSe,RSe]=gp(kw),[jw,zSe]=pp(kw,[RSe,ZC,iw]),Mw=ZC(),BSe=iw(),[VSe,Nw]=jw(kw),[HSe,Pw]=jw(kw),USe=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Mw(t),[c,l]=g.useState(null),u=g.useRef(!1),d=Sp(a),f=$S(i);return g.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,W.jsx)($C,{...s,children:(0,W.jsx)(VSe,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,W.jsx)(HSe,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};USe.displayName=kw;var WSe=`MenuAnchor`,Fw=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Mw(n);return(0,W.jsx)(ew,{...i,...r,ref:t})});Fw.displayName=WSe;var Iw=`MenuPortal`,[GSe,KSe]=jw(Iw,{forceMount:void 0}),qSe=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Nw(Iw,t);return(0,W.jsx)(GSe,{scope:t,forceMount:n,children:(0,W.jsx)(Op,{present:n||a.open,children:(0,W.jsx)(Dp,{asChild:!0,container:i,children:r})})})};qSe.displayName=Iw;var Lw=`MenuContent`,[JSe,Rw]=jw(Lw),YSe=g.forwardRef((e,t)=>{let n=KSe(Lw,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Nw(Lw,e.__scopeMenu),o=Pw(Lw,e.__scopeMenu);return(0,W.jsx)(Aw.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Op,{present:r||a.open,children:(0,W.jsx)(Aw.Slot,{scope:e.__scopeMenu,children:o.modal?(0,W.jsx)(XSe,{...i,ref:t}):(0,W.jsx)(ZSe,{...i,ref:t})})})})}),XSe=g.forwardRef((e,t)=>{let n=Nw(Lw,e.__scopeMenu),r=g.useRef(null),i=fp(t,r);return g.useEffect(()=>{let e=r.current;if(e)return dw(e)},[]),(0,W.jsx)(zw,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:up(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ZSe=g.forwardRef((e,t)=>{let n=Nw(Lw,e.__scopeMenu);return(0,W.jsx)(zw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),QSe=mp(`MenuContent.ScrollLock`),zw=g.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,_=Nw(Lw,n),v=Pw(Lw,n),y=Mw(n),b=BSe(n),x=LSe(n),[S,C]=g.useState(null),w=g.useRef(null),T=fp(t,w,_.onContentChange),E=g.useRef(0),D=g.useRef(``),O=g.useRef(0),k=g.useRef(null),A=g.useRef(`right`),j=g.useRef(0),M=m?Dw:g.Fragment,N=m?{as:QSe,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=OCe(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};g.useEffect(()=>()=>window.clearTimeout(E.current),[]),tC();let F=g.useCallback(e=>A.current===k.current?.side&&ACe(e,k.current?.area),[]);return(0,W.jsx)(JSe,{scope:n,searchRef:D,onItemEnter:g.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:g.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:g.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:g.useCallback(e=>{k.current=e},[]),children:(0,W.jsx)(M,{...N,children:(0,W.jsx)(iC,{asChild:!0,trapped:i,onMountAutoFocus:up(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,W.jsx)(wp,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,W.jsx)(aw,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:up(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,W.jsx)(vxe,{role:`menu`,"aria-orientation":`vertical`,"data-state":TCe(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:up(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!PSe.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);NSe.includes(e.key)&&a.reverse(),ECe(a)}),onBlur:up(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:up(e.onPointerMove,Jw(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});YSe.displayName=Lw;var $Se=`MenuGroup`,Bw=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(Tp.div,{role:`group`,...r,ref:t})});Bw.displayName=$Se;var eCe=`MenuLabel`,tCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(Tp.div,{...r,ref:t})});tCe.displayName=eCe;var Vw=`MenuItem`,nCe=`menu.itemSelect`,Hw=g.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=g.useRef(null),o=Pw(Vw,e.__scopeMenu),s=Rw(Vw,e.__scopeMenu),c=fp(t,a),l=g.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(nCe,{bubbles:!0,cancelable:!0});e.addEventListener(nCe,e=>r?.(e),{once:!0}),hte(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,W.jsx)(rCe,{...i,ref:c,disabled:n,onClick:up(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:up(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:up(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ow.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Hw.displayName=Vw;var rCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Rw(Vw,n),s=BSe(n),c=g.useRef(null),l=fp(t,c),[u,d]=g.useState(!1),[f,p]=g.useState(``);return g.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,W.jsx)(Aw.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,W.jsx)(ow,{asChild:!0,...s,focusable:!r,children:(0,W.jsx)(Tp.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:up(e.onPointerMove,Jw(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:up(e.onPointerLeave,Jw(e=>o.onItemLeave(e))),onFocus:up(e.onFocus,()=>d(!0)),onBlur:up(e.onBlur,()=>d(!1))})})})}),iCe=`MenuCheckboxItem`,aCe=g.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,W.jsx)(fCe,{scope:e.__scopeMenu,checked:n,children:(0,W.jsx)(Hw,{role:`menuitemcheckbox`,"aria-checked":Kw(n)?`mixed`:n,...i,ref:t,"data-state":qw(n),onSelect:up(i.onSelect,()=>r?.(Kw(n)?!0:!n),{checkForDefaultPrevented:!1})})})});aCe.displayName=iCe;var oCe=`MenuRadioGroup`,[sCe,cCe]=jw(oCe,{value:void 0,onValueChange:()=>{}}),lCe=g.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Sp(r);return(0,W.jsx)(sCe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,W.jsx)(Bw,{...i,ref:t})})});lCe.displayName=oCe;var uCe=`MenuRadioItem`,dCe=g.forwardRef((e,t)=>{let{value:n,...r}=e,i=cCe(uCe,e.__scopeMenu),a=n===i.value;return(0,W.jsx)(fCe,{scope:e.__scopeMenu,checked:a,children:(0,W.jsx)(Hw,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":qw(a),onSelect:up(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});dCe.displayName=uCe;var Uw=`MenuItemIndicator`,[fCe,pCe]=jw(Uw,{checked:!1}),mCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=pCe(Uw,n);return(0,W.jsx)(Op,{present:r||Kw(a.checked)||a.checked===!0,children:(0,W.jsx)(Tp.span,{...i,ref:t,"data-state":qw(a.checked)})})});mCe.displayName=Uw;var hCe=`MenuSeparator`,gCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(Tp.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});gCe.displayName=hCe;var _Ce=`MenuArrow`,vCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Mw(n);return(0,W.jsx)(yxe,{...i,...r,ref:t})});vCe.displayName=_Ce;var Ww=`MenuSub`,[yCe,bCe]=jw(Ww),xCe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Nw(Ww,t),o=Mw(t),[s,c]=g.useState(null),[l,u]=g.useState(null),d=Sp(i);return g.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,W.jsx)($C,{...o,children:(0,W.jsx)(VSe,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,W.jsx)(yCe,{scope:t,contentId:oC(),triggerId:oC(),trigger:s,onTriggerChange:c,children:n})})})};xCe.displayName=Ww;var Gw=`MenuSubTrigger`,SCe=g.forwardRef((e,t)=>{let n=Nw(Gw,e.__scopeMenu),r=Pw(Gw,e.__scopeMenu),i=bCe(Gw,e.__scopeMenu),a=Rw(Gw,e.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,W.jsx)(Fw,{asChild:!0,...l,children:(0,W.jsx)(rCe,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":TCe(n.open),...e,ref:dp(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:up(e.onPointerMove,Jw(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:up(e.onPointerLeave,Jw(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:up(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||FSe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});SCe.displayName=Gw;var CCe=`MenuSubContent`,wCe=g.forwardRef((e,t)=>{let n=KSe(Lw,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Nw(Lw,e.__scopeMenu),o=Pw(Lw,e.__scopeMenu),s=bCe(CCe,e.__scopeMenu),c=g.useRef(null),l=fp(t,c);return(0,W.jsx)(Aw.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Op,{present:r||a.open,children:(0,W.jsx)(Aw.Slot,{scope:e.__scopeMenu,children:(0,W.jsx)(zw,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:up(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:up(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:up(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ISe[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});wCe.displayName=CCe;function TCe(e){return e?`open`:`closed`}function Kw(e){return e===`indeterminate`}function qw(e){return Kw(e)?`indeterminate`:e?`checked`:`unchecked`}function ECe(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function DCe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function OCe(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=DCe(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function kCe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ACe(e,t){return t?kCe({x:e.clientX,y:e.clientY},t):!1}function Jw(e){return t=>t.pointerType===`mouse`?e(t):void 0}var jCe=USe,MCe=Fw,NCe=qSe,PCe=YSe,FCe=Bw,ICe=tCe,LCe=Hw,RCe=aCe,zCe=lCe,BCe=dCe,VCe=mCe,HCe=gCe,UCe=vCe,WCe=xCe,GCe=SCe,KCe=wCe,Yw=`DropdownMenu`,[qCe,JCe]=pp(Yw,[zSe]),Xw=zSe(),[YCe,XCe]=qCe(Yw),ZCe=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Xw(t),l=g.useRef(null),[u,d]=Ap({prop:i,defaultProp:a??!1,onChange:o,caller:Yw});return(0,W.jsx)(YCe,{scope:t,triggerId:oC(),triggerRef:l,contentId:oC(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,W.jsx)(jCe,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ZCe.displayName=Yw;var QCe=`DropdownMenuTrigger`,$Ce=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=XCe(QCe,n),o=Xw(n);return(0,W.jsx)(MCe,{asChild:!0,...o,children:(0,W.jsx)(Tp.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:dp(t,a.triggerRef),onPointerDown:up(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:up(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});$Ce.displayName=QCe;var ewe=`DropdownMenuPortal`,twe=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Xw(t);return(0,W.jsx)(NCe,{...r,...n})};twe.displayName=ewe;var nwe=`DropdownMenuContent`,rwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=XCe(nwe,n),a=Xw(n),o=g.useRef(!1);return(0,W.jsx)(PCe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:up(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:up(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});rwe.displayName=nwe;var iwe=`DropdownMenuGroup`,awe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(FCe,{...i,...r,ref:t})});awe.displayName=iwe;var owe=`DropdownMenuLabel`,swe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(ICe,{...i,...r,ref:t})});swe.displayName=owe;var cwe=`DropdownMenuItem`,lwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(LCe,{...i,...r,ref:t})});lwe.displayName=cwe;var uwe=`DropdownMenuCheckboxItem`,dwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(RCe,{...i,...r,ref:t})});dwe.displayName=uwe;var fwe=`DropdownMenuRadioGroup`,pwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(zCe,{...i,...r,ref:t})});pwe.displayName=fwe;var mwe=`DropdownMenuRadioItem`,hwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(BCe,{...i,...r,ref:t})});hwe.displayName=mwe;var gwe=`DropdownMenuItemIndicator`,_we=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(VCe,{...i,...r,ref:t})});_we.displayName=gwe;var vwe=`DropdownMenuSeparator`,ywe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(HCe,{...i,...r,ref:t})});ywe.displayName=vwe;var bwe=`DropdownMenuArrow`,xwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(UCe,{...i,...r,ref:t})});xwe.displayName=bwe;var Swe=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Xw(t),[s,c]=Ap({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,W.jsx)(WCe,{...o,open:s,onOpenChange:c,children:n})},Cwe=`DropdownMenuSubTrigger`,wwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(GCe,{...i,...r,ref:t})});wwe.displayName=Cwe;var Twe=`DropdownMenuSubContent`,Ewe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(KCe,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ewe.displayName=Twe;var Dwe=ZCe,Owe=$Ce,kwe=twe,Awe=rwe,jwe=awe,Mwe=swe,Nwe=lwe,Pwe=dwe,Fwe=_we,Iwe=ywe,Lwe=Swe,Rwe=wwe,zwe=Ewe;function Zw({...e}){return(0,W.jsx)(Dwe,{"data-slot":`dropdown-menu`,...e})}function Qw({...e}){return(0,W.jsx)(Owe,{"data-slot":`dropdown-menu-trigger`,...e})}function $w({className:e,sideOffset:t=4,...n}){return(0,W.jsx)(kwe,{children:(0,W.jsx)(Awe,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:G(`bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e),...n})})}function Bwe({...e}){return(0,W.jsx)(jwe,{"data-slot":`dropdown-menu-group`,...e})}function eT({className:e,inset:t,variant:n=`default`,...r}){return(0,W.jsx)(Nwe,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:G(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function Vwe({className:e,children:t,checked:n,...r}){return(0,W.jsxs)(Pwe,{"data-slot":`dropdown-menu-checkbox-item`,className:G(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,W.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,W.jsx)(Fwe,{children:(0,W.jsx)(mm,{className:`size-4`})})}),t]})}function tT({className:e,inset:t,...n}){return(0,W.jsx)(Mwe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:G(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function nT({className:e,...t}){return(0,W.jsx)(Iwe,{"data-slot":`dropdown-menu-separator`,className:G(`bg-border -mx-1 my-1 h-px`,e),...t})}function Hwe({...e}){return(0,W.jsx)(Lwe,{"data-slot":`dropdown-menu-sub`,...e})}function Uwe({className:e,inset:t,children:n,...r}){return(0,W.jsxs)(Rwe,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:G(`focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,W.jsx)(gm,{className:`ml-auto size-4`})]})}function Wwe({className:e,...t}){return(0,W.jsx)(zwe,{"data-slot":`dropdown-menu-sub-content`,className:G(`bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg`,e),...t})}var Gwe=sm(``,{variants:{variant:{default:`cursor-pointer text-indigo-600 dark:text-indigo-300 hover:underline`,neutral:`cursor-pointer hover:underline`,ghost:`cursor-pointer hover:no-underline`},showIcon:{true:`inline-flex items-center gap-x-1`}},defaultVariants:{variant:`default`}}),rT=({className:e,variant:t,showIcon:n,children:r,...i})=>(0,W.jsxs)(`a`,{target:`_blank`,rel:`noreferrer`,className:G(Gwe({variant:t,showIcon:n,className:e})),...i,children:[r,n&&(0,W.jsx)(Am,{className:`size-[1em]`})]}),Kwe=(0,g.createContext)({});function qwe(e){let t=(0,g.useRef)(null);return t.current===null&&(t.current=e()),t.current}var iT=(0,g.createContext)(null),Jwe=(0,g.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Ywe(e=!0){let t=(0,g.useContext)(iT);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,g.useId)();(0,g.useEffect)(()=>{e&&i(a)},[e]);let o=(0,g.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var aT=typeof window<`u`,Xwe=aT?g.useLayoutEffect:g.useEffect,oT=e=>e,sT=oT,cT=oT,lT={skipAnimations:!1,useManualTiming:!1};function Zwe(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.has(e)||s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var uT=[`read`,`resolveKeyframes`,`update`,`preRender`,`render`,`postRender`],Qwe=40;function $we(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=uT.reduce((e,t)=>(e[t]=Zwe(a),e),{}),{read:s,resolveKeyframes:c,update:l,preRender:u,render:d,postRender:f}=o,p=()=>{let a=lT.useManualTiming?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,Qwe),1),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,i.isProcessing||e(p)};return{schedule:uT.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||m(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<uT.length;t++)o[uT[t]].cancel(e)},state:i,steps:o}}var{schedule:dT,cancel:fT,state:pT,steps:mT}=$we(typeof requestAnimationFrame<`u`?requestAnimationFrame:oT,!0),eTe=(0,g.createContext)({strict:!1}),tTe={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},hT={};for(let e in tTe)hT[e]={isEnabled:t=>tTe[e].some(e=>!!t[e])};function nTe(e){for(let t in e)hT[t]={...hT[t],...e[t]}}var rTe=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function gT(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||rTe.has(e)}function iTe(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var aTe=n((()=>{})),oTe=r({default:()=>cTe}),sTe,cTe,lTe=n((()=>{aTe(),sTe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,cTe=iTe(function(e){return sTe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),uTe=e=>!gT(e);function dTe(e){e&&(uTe=t=>t.startsWith(`on`)?!gT(t):e(t))}try{dTe((lTe(),t(oTe)).default)}catch{}function fTe(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(uTe(i)||n===!0&&gT(i)||!t&&!gT(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}function pTe(e){if(typeof Proxy>`u`)return e;let t=new Map;return new Proxy((...t)=>e(...t),{get:(n,r)=>r===`create`?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}var _T=(0,g.createContext)({});function vT(e){return typeof e==`string`||Array.isArray(e)}function yT(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}var bT=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],xT=[`initial`,...bT];function ST(e){return yT(e.animate)||xT.some(t=>vT(e[t]))}function mTe(e){return!!(ST(e)||e.variants)}function hTe(e,t){if(ST(e)){let{initial:t,animate:n}=e;return{initial:t===!1||vT(t)?t:void 0,animate:vT(n)?n:void 0}}return e.inherit===!1?{}:t}function gTe(e){let{initial:t,animate:n}=hTe(e,(0,g.useContext)(_T));return(0,g.useMemo)(()=>({initial:t,animate:n}),[_Te(t),_Te(n)])}function _Te(e){return Array.isArray(e)?e.join(` `):e}var vTe=Symbol.for(`motionComponentSymbol`);function CT(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function yTe(e,t,n){return(0,g.useCallback)(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n==`function`?n(r):CT(n)&&(n.current=r))},[t])}var wT=e=>e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase(),bTe=`data-`+wT(`framerAppearId`),{schedule:TT,cancel:xTe}=$we(queueMicrotask,!1),STe=(0,g.createContext)({});function CTe(e,t,n,r,i){let{visualElement:a}=(0,g.useContext)(_T),o=(0,g.useContext)(eTe),s=(0,g.useContext)(iT),c=(0,g.useContext)(Jwe).reducedMotion,l=(0,g.useRef)(null);r||=o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:a,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:c}));let u=l.current,d=(0,g.useContext)(STe);u&&!u.projection&&i&&(u.type===`html`||u.type===`svg`)&&wTe(l.current,n,i,d);let f=(0,g.useRef)(!1);(0,g.useInsertionEffect)(()=>{u&&f.current&&u.update(n,s)});let p=n[bTe],m=(0,g.useRef)(!!p&&!window.MotionHandoffIsComplete?.call(window,p)&&window.MotionHasOptimisedAnimation?.call(window,p));return Xwe(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),TT.render(u.render),m.current&&u.animationState&&u.animationState.animateChanges())}),(0,g.useEffect)(()=>{u&&(!m.current&&u.animationState&&u.animationState.animateChanges(),m.current&&=(queueMicrotask(()=>{var e;(e=window.MotionHandoffMarkAsComplete)==null||e.call(window,p)}),!1))}),u}function wTe(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:TTe(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&CT(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}function TTe(e){if(e)return e.options.allowProjection===!1?TTe(e.parent):e.projection}function ETe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&nTe(e);function a(a,o){let s,c={...(0,g.useContext)(Jwe),...a,layoutId:DTe(a)},{isStatic:l}=c,u=gTe(a),d=r(a,l);if(!l&&aT){OTe(c,e);let n=kTe(c);s=n.MeasureLayout,u.visualElement=CTe(i,d,c,t,n.ProjectionNode)}return(0,W.jsxs)(_T.Provider,{value:u,children:[s&&u.visualElement?(0,W.jsx)(s,{visualElement:u.visualElement,...c}):null,n(i,a,yTe(d,u.visualElement,o),d,l,u.visualElement)]})}a.displayName=`motion.${typeof i==`string`?i:`create(${i.displayName??i.name??``})`}`;let o=(0,g.forwardRef)(a);return o[vTe]=i,o}function DTe({layoutId:e}){let t=(0,g.useContext)(Kwe).id;return t&&e!==void 0?t+`-`+e:e}function OTe(e,t){(0,g.useContext)(eTe).strict}function kTe(e){let{drag:t,layout:n}=hT;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}var ATe=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function ET(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(ATe.indexOf(e)>-1||/[A-Z]/u.test(e))}function jTe(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function DT(e,t,n,r){if(typeof t==`function`){let[i,a]=jTe(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=jTe(r);t=t(n===void 0?e.custom:n,i,a)}return t}var OT=e=>Array.isArray(e),MTe=e=>!!(e&&typeof e==`object`&&e.mix&&e.toValue),NTe=e=>OT(e)?e[e.length-1]||0:e,kT=e=>!!(e&&e.getVelocity);function AT(e){let t=kT(e)?e.get():e;return MTe(t)?t.toValue():t}function PTe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,a){let o={latestValues:ITe(r,i,a,e),renderState:t()};return n&&(o.onMount=e=>n({props:r,current:e,...o}),o.onUpdate=e=>n(e)),o}var FTe=e=>(t,n)=>{let r=(0,g.useContext)(_T),i=(0,g.useContext)(iT),a=()=>PTe(e,t,r,i);return n?a():qwe(a)};function ITe(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=AT(a[e]);let{initial:o,animate:s}=e,c=ST(e),l=mTe(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!yT(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=DT(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var jT=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],MT=new Set(jT),LTe=e=>t=>typeof t==`string`&&t.startsWith(e),RTe=LTe(`--`),zTe=LTe(`var(--`),NT=e=>zTe(e)?BTe.test(e.split(`/*`)[0].trim()):!1,BTe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,VTe=(e,t)=>t&&typeof e==`number`?t.transform(e):e,PT=(e,t,n)=>n>t?t:n<e?e:n,FT={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},IT={...FT,transform:e=>PT(0,1,e)},LT={...FT,default:1},RT=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),zT=RT(`deg`),BT=RT(`%`),VT=RT(`px`),HTe=RT(`vh`),UTe=RT(`vw`),WTe={...BT,parse:e=>BT.parse(e)/100,transform:e=>BT.transform(e*100)},GTe={borderWidth:VT,borderTopWidth:VT,borderRightWidth:VT,borderBottomWidth:VT,borderLeftWidth:VT,borderRadius:VT,radius:VT,borderTopLeftRadius:VT,borderTopRightRadius:VT,borderBottomRightRadius:VT,borderBottomLeftRadius:VT,width:VT,maxWidth:VT,height:VT,maxHeight:VT,top:VT,right:VT,bottom:VT,left:VT,padding:VT,paddingTop:VT,paddingRight:VT,paddingBottom:VT,paddingLeft:VT,margin:VT,marginTop:VT,marginRight:VT,marginBottom:VT,marginLeft:VT,backgroundPositionX:VT,backgroundPositionY:VT},KTe={rotate:zT,rotateX:zT,rotateY:zT,rotateZ:zT,scale:LT,scaleX:LT,scaleY:LT,scaleZ:LT,skew:zT,skewX:zT,skewY:zT,distance:VT,translateX:VT,translateY:VT,translateZ:VT,x:VT,y:VT,z:VT,perspective:VT,transformPerspective:VT,opacity:IT,originX:WTe,originY:WTe,originZ:VT},qTe={...FT,transform:Math.round},HT={...GTe,...KTe,zIndex:qTe,size:VT,fillOpacity:IT,strokeOpacity:IT,numOctaves:qTe},JTe={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},YTe=jT.length;function XTe(e,t,n){let r=``,i=!0;for(let a=0;a<YTe;a++){let o=jT[a],s=e[o];if(s===void 0)continue;let c=!0;if(c=typeof s==`number`?s===(o.startsWith(`scale`)?1:0):parseFloat(s)===0,!c||n){let e=VTe(s,HT[o]);if(!c){i=!1;let t=JTe[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function UT(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(MT.has(e)){o=!0;continue}else if(RTe(e)){i[e]=n;continue}else{let t=VTe(n,HT[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=XTe(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var ZTe={offset:`stroke-dashoffset`,array:`stroke-dasharray`},QTe={offset:`strokeDashoffset`,array:`strokeDasharray`};function $Te(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?ZTe:QTe;e[a.offset]=VT.transform(-r);let o=VT.transform(t),s=VT.transform(n);e[a.array]=`${o} ${s}`}function eEe(e,t,n){return typeof e==`string`?e:VT.transform(t+n*e)}function tEe(e,t,n){return`${eEe(t,e.x,e.width)} ${eEe(n,e.y,e.height)}`}function WT(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:a,pathLength:o,pathSpacing:s=1,pathOffset:c=0,...l},u,d){if(UT(e,l,d),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:f,style:p,dimensions:m}=e;f.transform&&(m&&(p.transform=f.transform),delete f.transform),m&&(i!==void 0||a!==void 0||p.transform)&&(p.transformOrigin=tEe(m,i===void 0?.5:i,a===void 0?.5:a)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),o!==void 0&&$Te(f,o,s,c,!1)}var GT=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),nEe=()=>({...GT(),attrs:{}}),KT=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function rEe(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(let t in n)e.style.setProperty(t,n[t])}var iEe=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function aEe(e,t,n,r){rEe(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(iEe.has(n)?n:wT(n),t.attrs[n])}var qT={};function oEe(e){Object.assign(qT,e)}function sEe(e,{layout:t,layoutId:n}){return MT.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!qT[e]||e===`opacity`)}function JT(e,t,n){let{style:r}=e,i={};for(let a in r)(kT(r[a])||t.style&&kT(t.style[a])||sEe(a,e)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}function cEe(e,t,n){let r=JT(e,t,n);for(let n in e)if(kT(e[n])||kT(t[n])){let t=jT.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}function lEe(e,t){try{t.dimensions=typeof e.getBBox==`function`?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}var uEe=[`x`,`y`,`width`,`height`,`cx`,`cy`,`r`],dEe={useVisualState:FTe({scrapeMotionValuesFromProps:cEe,createRenderState:nEe,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let a=!!e.drag;if(!a){for(let e in i)if(MT.has(e)){a=!0;break}}if(!a)return;let o=!t;if(t)for(let n=0;n<uEe.length;n++){let r=uEe[n];e[r]!==t[r]&&(o=!0)}o&&dT.read(()=>{lEe(n,r),dT.render(()=>{WT(r,i,KT(n.tagName),e.transformTemplate),aEe(n,r)})})}})},fEe={useVisualState:FTe({scrapeMotionValuesFromProps:JT,createRenderState:GT})};function pEe(e,t,n){for(let r in t)!kT(t[r])&&!sEe(r,n)&&(e[r]=t[r])}function mEe({transformTemplate:e},t){return(0,g.useMemo)(()=>{let n=GT();return UT(n,t,e),Object.assign({},n.vars,n.style)},[t])}function hEe(e,t){let n=e.style||{},r={};return pEe(r,n,e),Object.assign(r,mEe(e,t)),r}function gEe(e,t){let n={},r=hEe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function _Ee(e,t,n,r){let i=(0,g.useMemo)(()=>{let n=nEe();return WT(n,t,KT(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};pEe(t,e.style,e),i.style={...t,...i.style}}return i}function vEe(e=!1){return(t,n,r,{latestValues:i},a)=>{let o=(ET(t)?_Ee:gEe)(n,i,a,t),s=fTe(n,typeof t==`string`,e),c=t===g.Fragment?{}:{...s,...o,ref:r},{children:l}=n,u=(0,g.useMemo)(()=>kT(l)?l.get():l,[l]);return(0,g.createElement)(t,{...c,children:u})}}function yEe(e,t){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return ETe({...ET(n)?dEe:fEe,preloadedFeatures:e,useRender:vEe(r),createVisualElement:t,Component:n})}}function bEe(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function YT(e,t,n){let r=e.getProps();return DT(r,t,n===void 0?r.custom:n,e)}function XT(e,t){return e?e[t]||e.default||e:void 0}var xEe=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...jT]),ZT;function SEe(){ZT=void 0}var QT={now:()=>(ZT===void 0&&QT.set(pT.isProcessing||lT.useManualTiming?pT.timestamp:performance.now()),ZT),set:e=>{ZT=e,queueMicrotask(SEe)}};function $T(e,t){e.indexOf(t)===-1&&e.push(t)}function eE(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var tE=class{constructor(){this.subscriptions=[]}add(e){return $T(this.subscriptions,e),()=>eE(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};function CEe(e,t){return t?1e3/t*e:0}var wEe=30,TEe=e=>!isNaN(parseFloat(e)),EEe={current:void 0},DEe=class{constructor(e,t={}){this.version=`11.18.2`,this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{let n=QT.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=QT.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TEe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new tE);let n=this.events[e].add(t);return e===`change`?()=>{n(),dT.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return EEe.current&&EEe.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=QT.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>wEe)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,wEe);return CEe(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function nE(e,t){return new DEe(e,t)}function OEe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,nE(n))}function kEe(e,t){let{transitionEnd:n={},transition:r={},...i}=YT(e,t)||{};i={...i,...n};for(let t in i)OEe(e,t,NTe(i[t]))}function AEe(e){return!!(kT(e)&&e.add)}function rE(e,t){let n=e.getValue(`willChange`);if(AEe(n))return n.add(t)}function jEe(e){return e.props[bTe]}function iE(e){let t;return()=>(t===void 0&&(t=e()),t)}var MEe=iE(()=>window.ScrollTimeline!==void 0),NEe=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>`finished`in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e,t){let n=this.animations.map(n=>{if(MEe()&&n.attachTimeline)return n.attachTimeline(e);if(typeof t==`function`)return t(n)});return()=>{n.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get startTime(){return this.getAll(`startTime`)}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll(`flatten`)}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}},PEe=class extends NEe{then(e,t){return Promise.all(this.animations).then(e).catch(t)}},aE=e=>e*1e3,oE=e=>e/1e3,FEe={current:!1};function sE(e){return typeof e==`function`}function IEe(e,t){e.timeline=t,e.onfinish=null}var cE=e=>Array.isArray(e)&&typeof e[0]==`number`,LEe={linearEasing:void 0};function REe(e,t){let n=iE(e);return()=>LEe[t]??n()}var lE=REe(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),uE=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},zEe=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=e(uE(0,i-1,t))+`, `;return`linear(${r.substring(0,r.length-2)})`};function BEe(e){return!!(typeof e==`function`&&lE()||!e||typeof e==`string`&&(e in fE||lE())||cE(e)||Array.isArray(e)&&e.every(BEe))}var dE=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,fE={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:dE([0,.65,.55,1]),circOut:dE([.55,0,1,.45]),backIn:dE([.31,.01,.66,-.59]),backOut:dE([.33,1.53,.69,.99])};function VEe(e,t){if(e)return typeof e==`function`&&lE()?zEe(e,t):cE(e)?dE(e):Array.isArray(e)?e.map(e=>VEe(e,t)||fE.easeOut):fE[e]}var HEe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,UEe=1e-7,WEe=12;function GEe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=HEe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>UEe&&++s<WEe);return o}function pE(e,t,n,r){if(e===t&&n===r)return oT;let i=t=>GEe(t,0,1,e,n);return e=>e===0||e===1?e:HEe(i(e),t,r)}var KEe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,qEe=e=>t=>1-e(1-t),JEe=pE(.33,1.53,.69,.99),mE=qEe(JEe),YEe=KEe(mE),XEe=e=>(e*=2)<1?.5*mE(e):.5*(2-2**(-10*(e-1))),hE=e=>1-Math.sin(Math.acos(e)),ZEe=qEe(hE),QEe=KEe(hE),$Ee=e=>/^0[^.\s]+$/u.test(e);function eDe(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||$Ee(e)}var gE=e=>Math.round(e*1e5)/1e5,_E=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tDe(e){return e==null}var nDe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vE=(e,t)=>n=>!!(typeof n==`string`&&nDe.test(n)&&n.startsWith(e)||t&&!tDe(n)&&Object.prototype.hasOwnProperty.call(n,t)),rDe=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(_E);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},iDe=e=>PT(0,255,e),yE={...FT,transform:e=>Math.round(iDe(e))},bE={test:vE(`rgb`,`red`),parse:rDe(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+yE.transform(e)+`, `+yE.transform(t)+`, `+yE.transform(n)+`, `+gE(IT.transform(r))+`)`};function aDe(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var xE={test:vE(`#`),parse:aDe,transform:bE.transform},SE={test:vE(`hsl`,`hue`),parse:rDe(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+BT.transform(gE(t))+`, `+BT.transform(gE(n))+`, `+gE(IT.transform(r))+`)`},CE={test:e=>bE.test(e)||xE.test(e)||SE.test(e),parse:e=>bE.test(e)?bE.parse(e):SE.test(e)?SE.parse(e):xE.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?bE.transform(e):SE.transform(e)},oDe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function sDe(e){return isNaN(e)&&typeof e==`string`&&(e.match(_E)?.length||0)+(e.match(oDe)?.length||0)>0}var cDe=`number`,lDe=`color`,uDe=`var`,dDe=`var(`,fDe="${}",pDe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wE(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(pDe,e=>(CE.test(e)?(r.color.push(a),i.push(lDe),n.push(CE.parse(e))):e.startsWith(dDe)?(r.var.push(a),i.push(uDe),n.push(e)):(r.number.push(a),i.push(cDe),n.push(parseFloat(e))),++a,fDe)).split(fDe),indexes:r,types:i}}function mDe(e){return wE(e).values}function hDe(e){let{split:t,types:n}=wE(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===cDe?i+=gE(e[a]):t===lDe?i+=CE.transform(e[a]):i+=e[a]}return i}}var gDe=e=>typeof e==`number`?0:e;function _De(e){let t=mDe(e);return hDe(e)(t.map(gDe))}var TE={test:sDe,parse:mDe,createTransformer:hDe,getAnimatableNone:_De},vDe=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function yDe(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(_E)||[];if(!r)return e;let i=n.replace(r,``),a=vDe.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var bDe=/\b([a-z-]*)\(.*?\)/gu,EE={...TE,getAnimatableNone:e=>{let t=e.match(bDe);return t?t.map(yDe).join(` `):e}},xDe={...HT,color:CE,backgroundColor:CE,outlineColor:CE,fill:CE,stroke:CE,borderColor:CE,borderTopColor:CE,borderRightColor:CE,borderBottomColor:CE,borderLeftColor:CE,filter:EE,WebkitFilter:EE},DE=e=>xDe[e];function SDe(e,t){let n=DE(e);return n!==EE&&(n=TE),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var CDe=new Set([`auto`,`none`,`0`]);function wDe(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!CDe.has(t)&&wE(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=SDe(n,i)}var TDe=e=>e===FT||e===VT,EDe=(e,t)=>parseFloat(e.split(`, `)[t]),DDe=(e,t)=>(n,{transform:r})=>{if(r===`none`||!r)return 0;let i=r.match(/^matrix3d\((.+)\)$/u);if(i)return EDe(i[1],t);{let t=r.match(/^matrix\((.+)\)$/u);return t?EDe(t[1],e):0}},ODe=new Set([`x`,`y`,`z`]),kDe=jT.filter(e=>!ODe.has(e));function ADe(e){let t=[];return kDe.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var OE={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:DDe(4,13),y:DDe(5,14)};OE.translateX=OE.x,OE.translateY=OE.y;var kE=new Set,AE=!1,jE=!1;function jDe(){if(jE){let e=Array.from(kE).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ADe(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{var r;(r=e.getValue(t))==null||r.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}jE=!1,AE=!1,kE.forEach(e=>e.complete()),kE.clear()}function MDe(){kE.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(jE=!0)})}function NDe(){MDe(),jDe()}var ME=class{constructor(e,t,n,r,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(kE.add(this),AE||(AE=!0,dT.read(MDe),dT.resolveKeyframes(jDe))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),kE.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,kE.delete(this))}resume(){this.isComplete||this.scheduleResolve()}},PDe=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),FDe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function IDe(e){let t=FDe.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var LDe=4;function RDe(e,t,n=1){cT(n<=LDe,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[r,i]=IDe(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return PDe(e)?parseFloat(e):e}return NT(i)?RDe(i,t,n+1):i}var zDe=e=>t=>t.test(e),BDe=[FT,VT,BT,zT,UTe,HTe,{test:e=>e===`auto`,parse:e=>e}],VDe=e=>BDe.find(zDe(e)),HDe=class extends ME{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),NT(r))){let i=RDe(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!xEe.has(n)||e.length!==2)return;let[r,i]=e,a=VDe(r),o=VDe(i);if(a!==o)if(TDe(a)&&TDe(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)eDe(e[t])&&n.push(t);n.length&&wDe(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=OE[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=OE[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},UDe=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(TE.test(e)||e===`0`)&&!e.startsWith(`url(`));function WDe(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function GDe(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=UDe(i,t),s=UDe(a,t);return sT(o===s,`You are trying to animate ${t} from "${i}" to "${a}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${a} via the \`style\` property.`),!o||!s?!1:WDe(e)||(n===`spring`||sE(n))&&r}var KDe=e=>e!==null;function NE(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(KDe),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}var qDe=40,JDe=class{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=QT.now(),this.options={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>qDe?this.resolvedAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&NDe(),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=QT.now(),this.hasAttemptedResolve=!0;let{name:n,type:r,velocity:i,delay:a,onComplete:o,onUpdate:s,isGenerator:c}=this.options;if(!c&&!GDe(e,n,r,i))if(FEe.current||!a){s&&s(NE(e,this.options,t)),o&&o(),this.resolveFinishedPromise();return}else this.options.duration=0;let l=this.initPlayback(e,t);l!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...l},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type=`keyframes`,this.options.ease=`linear`}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}},YDe=2e4;function XDe(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}var PE=(e,t,n)=>e+(t-e)*n;function FE(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function ZDe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=FE(s,r,e+1/3),a=FE(s,r,e),o=FE(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function IE(e,t){return n=>n>0?t:e}var LE=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},QDe=[xE,bE,SE],$De=e=>QDe.find(t=>t.test(e));function eOe(e){let t=$De(e);if(sT(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let n=t.parse(e);return t===SE&&(n=ZDe(n)),n}var tOe=(e,t)=>{let n=eOe(e),r=eOe(t);if(!n||!r)return IE(e,t);let i={...n};return e=>(i.red=LE(n.red,r.red,e),i.green=LE(n.green,r.green,e),i.blue=LE(n.blue,r.blue,e),i.alpha=PE(n.alpha,r.alpha,e),bE.transform(i))},nOe=(e,t)=>n=>t(e(n)),RE=(...e)=>e.reduce(nOe),zE=new Set([`none`,`hidden`]);function rOe(e,t){return zE.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function iOe(e,t){return n=>PE(e,t,n)}function BE(e){return typeof e==`number`?iOe:typeof e==`string`?NT(e)?IE:CE.test(e)?tOe:cOe:Array.isArray(e)?aOe:typeof e==`object`?CE.test(e)?tOe:oOe:IE}function aOe(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>BE(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function oOe(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=BE(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function sOe(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var cOe=(e,t)=>{let n=TE.createTransformer(t),r=wE(e),i=wE(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?zE.has(e)&&!i.values.length||zE.has(t)&&!r.values.length?rOe(e,t):RE(aOe(sOe(r,i),i.values),n):(sT(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),IE(e,t))};function lOe(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?PE(e,t,n):BE(e)(e,t)}var uOe=5;function dOe(e,t,n){let r=Math.max(t-uOe,0);return CEe(n-e(r),t-r)}var VE={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},HE=.001;function fOe({duration:e=VE.duration,bounce:t=VE.bounce,velocity:n=VE.velocity,mass:r=VE.mass}){let i,a;sT(e<=aE(VE.maxDuration),`Spring duration must be 10 seconds or less`);let o=1-t;o=PT(VE.minDamping,VE.maxDamping,o),e=PT(VE.minDuration,VE.maxDuration,oE(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=UE(t,o),c=Math.exp(-i);return HE-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=UE(t**2,o);return(-i(t)+HE>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-HE+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=mOe(i,a,s);if(e=aE(e),isNaN(c))return{stiffness:VE.stiffness,damping:VE.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var pOe=12;function mOe(e,t,n){let r=n;for(let n=1;n<pOe;n++)r-=e(r)/t(r);return r}function UE(e,t){return e*Math.sqrt(1-t*t)}var hOe=[`duration`,`bounce`],gOe=[`stiffness`,`damping`,`mass`];function _Oe(e,t){return t.some(t=>e[t]!==void 0)}function vOe(e){let t={velocity:VE.velocity,stiffness:VE.stiffness,damping:VE.damping,mass:VE.mass,isResolvedFromDuration:!1,...e};if(!_Oe(e,gOe)&&_Oe(e,hOe))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*PT(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:VE.mass,stiffness:i,damping:a}}else{let n=fOe(e);t={...t,...n,mass:VE.mass},t.isResolvedFromDuration=!0}return t}function yOe(e=VE.visualDuration,t=VE.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=vOe({...n,velocity:-oE(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=oE(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?VE.restSpeed.granular:VE.restSpeed.default,i||=v?VE.restDelta.granular:VE.restDelta.default;let y;if(h<1){let e=UE(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=0;h<1&&(n=e===0?aE(m):dOe(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(XDe(b),YDe),t=zEe(t=>b.next(e*t).value,e,30);return e+`ms `+t}};return b}function bOe({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=yOe({keyframes:[f.value,m(f.value)],velocity:dOe(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}var xOe=pE(.42,0,1,1),SOe=pE(0,0,.58,1),COe=pE(.42,0,.58,1),wOe=e=>Array.isArray(e)&&typeof e[0]!=`number`,TOe={linear:oT,easeIn:xOe,easeInOut:COe,easeOut:SOe,circIn:hE,circInOut:QEe,circOut:ZEe,backIn:mE,backInOut:YEe,backOut:JEe,anticipate:XEe},EOe=e=>{if(cE(e)){cT(e.length===4,`Cubic bezier arrays must contain four numerical values.`);let[t,n,r,i]=e;return pE(t,n,r,i)}else if(typeof e==`string`)return cT(TOe[e]!==void 0,`Invalid easing type '${e}'`),TOe[e];return e};function DOe(e,t,n){let r=[],i=n||lOe,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=RE(Array.isArray(t)?t[n]||oT:t,a)),r.push(a)}return r}function OOe(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(cT(a===t.length,`Both input and output ranges must be the same length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=DOe(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=uE(e[r],e[r+1],n);return s[r](i)};return n?t=>l(PT(e[0],e[a-1],t)):l}function kOe(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=uE(0,t,r);e.push(PE(n,1,i))}}function AOe(e){let t=[0];return kOe(t,e.length-1),t}function jOe(e,t){return e.map(e=>e*t)}function MOe(e,t){return e.map(()=>t||COe).splice(0,e.length-1)}function WE({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=wOe(r)?r.map(EOe):EOe(r),a={done:!1,value:t[0]},o=OOe(jOe(n&&n.length===t.length?n:AOe(t),e),t,{ease:Array.isArray(i)?i:MOe(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var NOe=e=>{let t=({timestamp:t})=>e(t);return{start:()=>dT.update(t,!0),stop:()=>fT(t),now:()=>pT.isProcessing?pT.timestamp:QT.now()}},POe={decay:bOe,inertia:bOe,tween:WE,keyframes:WE,spring:yOe},FOe=e=>e/100,GE=class extends JDe{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState=`running`,this.startTime=null,this.state=`idle`,this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state===`idle`)return;this.teardown();let{onStop:e}=this.options;e&&e()};let{name:t,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new(r?.KeyframeResolver||ME)(i,(e,t)=>this.onKeyframesResolved(e,t),t,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){let{type:t=`keyframes`,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=this.options,o=sE(t)?t:POe[t]||WE,s,c;o!==WE&&typeof e[0]!=`number`&&(s=RE(FOe,lOe(e[0],e[1])),e=[0,100]);let l=o({...this.options,keyframes:e});i===`mirror`&&(c=o({...this.options,keyframes:[...e].reverse(),velocity:-a})),l.calculatedDuration===null&&(l.calculatedDuration=XDe(l));let{calculatedDuration:u}=l,d=u+r,f=d*(n+1)-r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:s,calculatedDuration:u,resolvedDuration:d,totalDuration:f}}onPostResolved(){let{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState===`paused`||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){let{resolved:n}=this;if(!n){let{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}let{finalKeyframe:r,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:s,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(this.startTime===null)return i.next(0);let{delay:d,repeat:f,repeatType:p,repeatDelay:m,onUpdate:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime===null?this.currentTime=Math.round(e-this.startTime)*this.speed:this.currentTime=this.holdTime;let g=this.currentTime-d*(this.speed>=0?1:-1),_=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=l);let v=this.currentTime,y=i;if(f){let e=Math.min(this.currentTime,l)/u,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,f+1),t%2&&(p===`reverse`?(n=1-n,m&&(n-=m/u)):p===`mirror`&&(y=a)),v=PT(0,1,n)*u}let b=_?{done:!1,value:s[0]}:y.next(v);o&&(b.value=o(b.value));let{done:x}=b;!_&&c!==null&&(x=this.speed>=0?this.currentTime>=l:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&r!==void 0&&(b.value=NE(s,this.options,r)),h&&h(b.value),S&&this.finish(),b}get duration(){let{resolved:e}=this;return e?oE(e.calculatedDuration):0}get time(){return oE(this.currentTime)}set time(e){e=aE(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=oE(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState=`running`;return}if(this.isStopped)return;let{driver:e=NOe,onPlay:t,startTime:n}=this.options;this.driver||=e(e=>this.tick(e)),t&&t();let r=this.driver.now();this.holdTime===null?this.startTime?this.state===`finished`&&(this.startTime=r):this.startTime=n??this.calcStartTime():this.startTime=r-this.holdTime,this.state===`finished`&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state=`running`,this.driver.start()}pause(){if(!this._resolved){this.pendingPlayState=`paused`;return}this.state=`paused`,this.holdTime=this.currentTime??0}complete(){this.state!==`running`&&this.play(),this.pendingPlayState=this.state=`finished`,this.holdTime=null}finish(){this.teardown(),this.state=`finished`;let{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state=`idle`,this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}},IOe=new Set([`opacity`,`clipPath`,`filter`,`transform`]);function LOe(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeInOut`,times:c}={}){let l={[t]:n};c&&(l.offset=c);let u=VEe(s,i);return Array.isArray(u)&&(l.easing=u),e.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?`linear`:u,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`})}var ROe=iE(()=>Object.hasOwnProperty.call(Element.prototype,`animate`)),KE=10,zOe=2e4;function BOe(e){return sE(e.type)||e.type===`spring`||!BEe(e.ease)}function VOe(e,t){let n=new GE({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},i=[],a=0;for(;!r.done&&a<zOe;)r=n.sample(a),i.push(r.value),a+=KE;return{times:void 0,keyframes:i,duration:a-KE,ease:`linear`}}var HOe={anticipate:XEe,backInOut:YEe,circInOut:QEe};function UOe(e){return e in HOe}var WOe=class extends JDe{constructor(e){super(e);let{name:t,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new HDe(i,(e,t)=>this.onKeyframesResolved(e,t),t,n,r),this.resolver.scheduleResolve()}initPlayback(e,t){let{duration:n=300,times:r,ease:i,type:a,motionValue:o,name:s,startTime:c}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i==`string`&&lE()&&UOe(i)&&(i=HOe[i]),BOe(this.options)){let{onComplete:t,onUpdate:o,motionValue:s,element:c,...l}=this.options,u=VOe(e,l);e=u.keyframes,e.length===1&&(e[1]=e[0]),n=u.duration,r=u.times,i=u.ease,a=`keyframes`}let l=LOe(o.owner.current,s,e,{...this.options,duration:n,times:r,ease:i});return l.startTime=c??this.calcStartTime(),this.pendingTimeline?(IEe(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{let{onComplete:n}=this.options;o.set(NE(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:n,times:r,type:a,ease:i,keyframes:e}}get duration(){let{resolved:e}=this;if(!e)return 0;let{duration:t}=e;return oE(t)}get time(){let{resolved:e}=this;if(!e)return 0;let{animation:t}=e;return oE(t.currentTime||0)}set time(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.currentTime=aE(e)}get speed(){let{resolved:e}=this;if(!e)return 1;let{animation:t}=e;return t.playbackRate}set speed(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.playbackRate=e}get state(){let{resolved:e}=this;if(!e)return`idle`;let{animation:t}=e;return t.playState}get startTime(){let{resolved:e}=this;if(!e)return null;let{animation:t}=e;return t.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{let{resolved:t}=this;if(!t)return oT;let{animation:n}=t;IEe(n,e)}return oT}play(){if(this.isStopped)return;let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.playState===`finished`&&this.updateFinishedPromise(),t.play()}pause(){let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state===`idle`)return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:e}=this;if(!e)return;let{animation:t,keyframes:n,duration:r,type:i,ease:a,times:o}=e;if(t.playState===`idle`||t.playState===`finished`)return;if(this.time){let{motionValue:e,onUpdate:t,onComplete:s,element:c,...l}=this.options,u=new GE({...l,keyframes:n,duration:r,type:i,ease:a,times:o,isGenerator:!0}),d=aE(this.time);e.setWithVelocity(u.sample(d-KE).value,u.sample(d).value,KE)}let{onStop:s}=this.options;s&&s(),this.cancel()}complete(){let{resolved:e}=this;e&&e.animation.finish()}cancel(){let{resolved:e}=this;e&&e.animation.cancel()}static supports(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ROe()&&n&&IOe.has(n)&&!s&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}},GOe={type:`spring`,stiffness:500,damping:25,restSpeed:10},KOe=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),qOe={type:`keyframes`,duration:.8},JOe={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},YOe=(e,{keyframes:t})=>t.length>2?qOe:MT.has(e)?e.startsWith(`scale`)?KOe(t[1]):GOe:JOe;function XOe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var qE=(e,t,n,r={},i,a)=>o=>{let s=XT(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=aE(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};XOe(s)||(u={...u,...YOe(e,u)}),u.duration&&=aE(u.duration),u.repeatDelay&&=aE(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(d=!0)),(FEe.current||lT.skipAnimations)&&(d=!0,u.duration=0,u.delay=0),d&&!a&&t.get()!==void 0){let e=NE(u.keyframes,s);if(e!==void 0)return dT.update(()=>{u.onUpdate(e),u.onComplete()}),new PEe([])}return!a&&WOe.supports(u)?new WOe(u):new GE(u)};function ZOe({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function QOe(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=t;r&&(a=r);let c=[],l=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||l&&ZOe(l,t))continue;let o={delay:n,...XT(a||{},t)},u=!1;if(window.MotionHandoffAnimation){let n=jEe(e);if(n){let e=window.MotionHandoffAnimation(n,t,dT);e!==null&&(o.startTime=e,u=!0)}}rE(e,t),r.start(qE(t,r,i,e.shouldReduceMotion&&xEe.has(t)?{type:!1}:o,e,u));let d=r.animation;d&&c.push(d)}return o&&Promise.all(c).then(()=>{dT.update(()=>{o&&kEe(e,o)})}),c}function JE(e,t,n={}){let r=YT(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(QOe(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return $Oe(e,t,a+r,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function $Oe(e,t,n=0,r=0,i=1,a){let o=[],s=(e.variantChildren.size-1)*r,c=i===1?(e=0)=>e*r:(e=0)=>s-e*r;return Array.from(e.variantChildren).sort(eke).forEach((e,r)=>{e.notify(`AnimationStart`,t),o.push(JE(e,t,{...a,delay:n+c(r)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(o)}function eke(e,t){return e.sortNodePosition(t)}function tke(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>JE(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=JE(e,t,n);else{let i=typeof t==`function`?YT(e,t,n.custom):t;r=Promise.all(QOe(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var nke=xT.length;function rke(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&rke(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<nke;n++){let r=xT[n],i=e.props[r];(vT(i)||i===!1)&&(t[r]=i)}return t}var ike=[...bT].reverse(),ake=bT.length;function oke(e){return t=>Promise.all(t.map(({animation:t,options:n})=>tke(e,t,n)))}function ske(e){let t=oke(e),n=lke(),r=!0,i=t=>(n,r)=>{let i=YT(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function a(n){t=n(e)}function o(a){let{props:o}=e,s=rke(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<ake;t++){let f=ike[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=vT(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&r&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||yT(m)||typeof m==`boolean`)continue;let v=cke(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(i(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},T=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=OT(t)&&OT(n)?!bEe(t,n):t!==n,r?t==null?l.add(e):T(e):t!==void 0&&l.has(e)?T(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),r&&e.blockInitialAnimation&&(y=!1),y&&(!(_&&v)||b)&&c.push(...x.map(e=>({animation:e,options:{type:f}})))}if(l.size){let t={};l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,f?t(c):Promise.resolve()}function s(t,r){var i;if(n[t].isActive===r)return Promise.resolve();(i=e.variantChildren)==null||i.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let a=o(t);for(let e in n)n[e].protectedKeys={};return a}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=lke(),r=!0}}}function cke(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!bEe(t,e):!1}function YE(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function lke(){return{animate:YE(!0),whileInView:YE(),whileHover:YE(),whileTap:YE(),whileDrag:YE(),whileFocus:YE(),exit:YE()}}var XE=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},uke=class extends XE{constructor(e){super(e),e.animationState||=ske(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();yT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}},dke=0,fke={animation:{Feature:uke},exit:{Feature:class extends XE{constructor(){super(...arguments),this.id=dke++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>t(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},ZE={x:!1,y:!1};function pke(){return ZE.x||ZE.y}function mke(e){return e===`x`||e===`y`?ZE[e]?null:(ZE[e]=!0,()=>{ZE[e]=!1}):ZE.x||ZE.y?null:(ZE.x=ZE.y=!0,()=>{ZE.x=ZE.y=!1})}var QE=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function $E(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function eD(e){return{point:{x:e.pageX,y:e.pageY}}}var hke=e=>t=>QE(t)&&e(t,eD(t));function tD(e,t,n,r){return $E(e,t,hke(n),r)}var gke=(e,t)=>Math.abs(e-t);function _ke(e,t){let n=gke(e.x,t.x),r=gke(e.y,t.y);return Math.sqrt(n**2+r**2)}var vke=class{constructor(e,t,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=rD(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=_ke(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=pT;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=nD(t,this.transformPagePoint),dT.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=rD(e.type===`pointercancel`?this.lastMoveEventInfo:nD(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!QE(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.contextWindow=r||window;let a=nD(eD(e),this.transformPagePoint),{point:o}=a,{timestamp:s}=pT;this.history=[{...o,timestamp:s}];let{onSessionStart:c}=t;c&&c(e,rD(a,this.history)),this.removeListeners=RE(tD(this.contextWindow,`pointermove`,this.handlePointerMove),tD(this.contextWindow,`pointerup`,this.handlePointerUp),tD(this.contextWindow,`pointercancel`,this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),fT(this.updatePoint)}};function nD(e,t){return t?{point:t(e.point)}:e}function yke(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rD({point:e},t){return{point:e,delta:yke(e,xke(t)),offset:yke(e,bke(t)),velocity:Ske(t,.1)}}function bke(e){return e[0]}function xke(e){return e[e.length-1]}function Ske(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=xke(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>aE(t)));)n--;if(!r)return{x:0,y:0};let a=oE(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var Cke=1e-4,wke=1-Cke,Tke=1+Cke,Eke=.01,Dke=0-Eke,Oke=0+Eke;function iD(e){return e.max-e.min}function kke(e,t,n){return Math.abs(e-t)<=n}function Ake(e,t,n,r=.5){e.origin=r,e.originPoint=PE(t.min,t.max,e.origin),e.scale=iD(n)/iD(t),e.translate=PE(n.min,n.max,e.origin)-e.originPoint,(e.scale>=wke&&e.scale<=Tke||isNaN(e.scale))&&(e.scale=1),(e.translate>=Dke&&e.translate<=Oke||isNaN(e.translate))&&(e.translate=0)}function aD(e,t,n,r){Ake(e.x,t.x,n.x,r?r.originX:void 0),Ake(e.y,t.y,n.y,r?r.originY:void 0)}function jke(e,t,n){e.min=n.min+t.min,e.max=e.min+iD(t)}function Mke(e,t,n){jke(e.x,t.x,n.x),jke(e.y,t.y,n.y)}function Nke(e,t,n){e.min=t.min-n.min,e.max=e.min+iD(t)}function oD(e,t,n){Nke(e.x,t.x,n.x),Nke(e.y,t.y,n.y)}function Pke(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?PE(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?PE(n,e,r.max):Math.min(e,n)),e}function Fke(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Ike(e,{top:t,left:n,bottom:r,right:i}){return{x:Fke(e.x,n,i),y:Fke(e.y,t,r)}}function Lke(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Rke(e,t){return{x:Lke(e.x,t.x),y:Lke(e.y,t.y)}}function zke(e,t){let n=.5,r=iD(e),i=iD(t);return i>r?n=uE(t.min,t.max-r,e.min):r>i&&(n=uE(e.min,e.max-i,t.min)),PT(0,1,n)}function Bke(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var sD=.35;function Vke(e=sD){return e===!1?e=0:e===!0&&(e=sD),{x:Hke(e,`left`,`right`),y:Hke(e,`top`,`bottom`)}}function Hke(e,t,n){return{min:Uke(e,t),max:Uke(e,n)}}function Uke(e,t){return typeof e==`number`?e:e[t]||0}var Wke=()=>({translate:0,scale:1,origin:0,originPoint:0}),cD=()=>({x:Wke(),y:Wke()}),Gke=()=>({min:0,max:0}),lD=()=>({x:Gke(),y:Gke()});function uD(e){return[e(`x`),e(`y`)]}function Kke({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function qke({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Jke(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function dD(e){return e===void 0||e===1}function fD({scale:e,scaleX:t,scaleY:n}){return!dD(e)||!dD(t)||!dD(n)}function pD(e){return fD(e)||Yke(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Yke(e){return Xke(e.x)||Xke(e.y)}function Xke(e){return e&&e!==`0%`}function mD(e,t,n){return n+t*(e-n)}function Zke(e,t,n,r,i){return i!==void 0&&(e=mD(e,i,r)),mD(e,n,r)+t}function hD(e,t=0,n=1,r,i){e.min=Zke(e.min,t,n,r,i),e.max=Zke(e.max,t,n,r,i)}function Qke(e,{x:t,y:n}){hD(e.x,t.translate,t.scale,t.originPoint),hD(e.y,n.translate,n.scale,n.originPoint)}var $ke=.999999999999,eAe=1.0000000000001;function tAe(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&_D(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Qke(e,o)),r&&pD(a.latestValues)&&_D(e,a.latestValues))}t.x<eAe&&t.x>$ke&&(t.x=1),t.y<eAe&&t.y>$ke&&(t.y=1)}function gD(e,t){e.min+=t,e.max+=t}function nAe(e,t,n,r,i=.5){hD(e,t,n,PE(e.min,e.max,i),r)}function _D(e,t){nAe(e.x,t.x,t.scaleX,t.scale,t.originX),nAe(e.y,t.y,t.scaleY,t.scale,t.originY)}function rAe(e,t){return Kke(Jke(e.getBoundingClientRect(),t))}function iAe(e,t,n){let r=rAe(e,n),{scroll:i}=t;return i&&(gD(r.x,i.offset.x),gD(r.y,i.offset.y)),r}var aAe=({current:e})=>e?e.ownerDocument.defaultView:null,oAe=new WeakMap,sAe=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lD(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){let{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;let r=e=>{let{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(eD(e).point)},i=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=mke(n),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),uD(e=>{let t=this.getAxisMotionValue(e).get()||0;if(BT.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=iD(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&dT.postRender(()=>i(e,t)),rE(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},a=(e,t)=>{let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=cAe(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&a(e,t)},o=(e,t)=>this.stop(e,t),s=()=>uD(e=>this.getAnimationState(e)===`paused`&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new vke(e,{onSessionStart:r,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:aAe(this.visualElement)})}stop(e,t){let n=this.isDragging;if(this.cancel(),!n)return;let{velocity:r}=t;this.startAnimation(r);let{onDragEnd:i}=this.getProps();i&&dT.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!vD(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Pke(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&CT(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=Ike(n.layoutBox,e):this.constraints=!1,this.elastic=Vke(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&uD(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Bke(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!CT(e))return!1;let n=e.current;cT(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=iAe(n,r.root,this.visualElement.getTransformPagePoint()),a=Rke(r.layout.layoutBox,i);if(t){let e=t(qke(a));this.hasMutatedConstraints=!!e,e&&(a=Kke(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=uD(o=>{if(!vD(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return rE(this.visualElement,e),n.start(qE(e,n,0,t,this.visualElement,!1))}stopAnimation(){uD(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){uD(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){uD(t=>{let{drag:n}=this.getProps();if(!vD(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t];i.set(e[t]-PE(n,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!CT(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};uD(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=zke({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),uD(t=>{if(!vD(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(PE(i,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;oAe.set(this.visualElement,this);let e=this.visualElement.current,t=tD(e,`pointerdown`,e=>{let{drag:t,dragListener:n=!0}=this.getProps();t&&n&&this.start(e)}),n=()=>{let{dragConstraints:e}=this.getProps();CT(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,n);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),dT.read(n);let a=$E(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(uD(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=sD,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function vD(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function cAe(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var lAe=class extends XE{constructor(e){super(e),this.removeGroupControls=oT,this.removeListeners=oT,this.controls=new sAe(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||oT}unmount(){this.removeGroupControls(),this.removeListeners()}},uAe=e=>(t,n)=>{e&&dT.postRender(()=>e(t,n))},dAe=class extends XE{constructor(){super(...arguments),this.removePointerDownListener=oT}onPointerDown(e){this.session=new vke(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:aAe(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:uAe(e),onStart:uAe(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&dT.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=tD(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},yD={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function fAe(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var bD={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(VT.test(e))e=parseFloat(e);else return e;return`${fAe(e,t.target.x)}% ${fAe(e,t.target.y)}%`}},pAe={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=TE.parse(e);if(i.length>5)return r;let a=TE.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=PE(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},mAe=class extends g.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;oEe(gAe),i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),yD.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,a=n.projection;return a?(a.isPresent=i,r||e.layoutDependency!==t||t===void 0?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||dT.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),TT.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function hAe(e){let[t,n]=Ywe(),r=(0,g.useContext)(Kwe);return(0,W.jsx)(mAe,{...e,layoutGroup:r,switchLayoutGroup:(0,g.useContext)(STe),isPresent:t,safeToRemove:n})}var gAe={borderRadius:{...bD,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:bD,borderTopRightRadius:bD,borderBottomLeftRadius:bD,borderBottomRightRadius:bD,boxShadow:pAe};function _Ae(e,t,n){let r=kT(e)?e:nE(e);return r.start(qE(``,r,t,n)),r.animation}function vAe(e){return e instanceof SVGElement&&e.tagName!==`svg`}var yAe=(e,t)=>e.depth-t.depth,bAe=class{constructor(){this.children=[],this.isDirty=!1}add(e){$T(this.children,e),this.isDirty=!0}remove(e){eE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(yAe),this.isDirty=!1,this.children.forEach(e)}};function xAe(e,t){let n=QT.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(fT(r),e(a-t))};return dT.read(r,!0),()=>fT(r)}var SAe=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],CAe=SAe.length,wAe=e=>typeof e==`string`?parseFloat(e):e,TAe=e=>typeof e==`number`||VT.test(e);function EAe(e,t,n,r,i,a){i?(e.opacity=PE(0,n.opacity===void 0?1:n.opacity,OAe(r)),e.opacityExit=PE(t.opacity===void 0?1:t.opacity,0,kAe(r))):a&&(e.opacity=PE(t.opacity===void 0?1:t.opacity,n.opacity===void 0?1:n.opacity,r));for(let i=0;i<CAe;i++){let a=`border${SAe[i]}Radius`,o=DAe(t,a),s=DAe(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||TAe(o)===TAe(s)?(e[a]=Math.max(PE(wAe(o),wAe(s),r),0),(BT.test(s)||BT.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=PE(t.rotate||0,n.rotate||0,r))}function DAe(e,t){return e[t]===void 0?e.borderRadius:e[t]}var OAe=AAe(0,.5,ZEe),kAe=AAe(.5,.95,oT);function AAe(e,t,n){return r=>r<e?0:r>t?1:n(uE(e,t,r))}function jAe(e,t){e.min=t.min,e.max=t.max}function xD(e,t){jAe(e.x,t.x),jAe(e.y,t.y)}function MAe(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function NAe(e,t,n,r,i){return e-=t,e=mD(e,1/n,r),i!==void 0&&(e=mD(e,1/i,r)),e}function PAe(e,t=0,n=1,r=.5,i,a=e,o=e){if(BT.test(t)&&(t=parseFloat(t),t=PE(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=PE(a.min,a.max,r);e===a&&(s-=t),e.min=NAe(e.min,t,n,s,i),e.max=NAe(e.max,t,n,s,i)}function FAe(e,t,[n,r,i],a,o){PAe(e,t[n],t[r],t[i],t.scale,a,o)}var IAe=[`x`,`scaleX`,`originX`],LAe=[`y`,`scaleY`,`originY`];function RAe(e,t,n,r){FAe(e.x,t,IAe,n?n.x:void 0,r?r.x:void 0),FAe(e.y,t,LAe,n?n.y:void 0,r?r.y:void 0)}function zAe(e){return e.translate===0&&e.scale===1}function BAe(e){return zAe(e.x)&&zAe(e.y)}function VAe(e,t){return e.min===t.min&&e.max===t.max}function HAe(e,t){return VAe(e.x,t.x)&&VAe(e.y,t.y)}function UAe(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function WAe(e,t){return UAe(e.x,t.x)&&UAe(e.y,t.y)}function GAe(e){return iD(e.x)/iD(e.y)}function KAe(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var qAe=class{constructor(){this.members=[]}add(e){$T(this.members,e),e.scheduleRender()}remove(e){if(eE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t=this.members.findIndex(t=>e===t);if(t===0)return!1;let n;for(let e=t;e>=0;e--){let t=this.members[e];if(t.isPresent!==!1){n=t;break}}return n?(this.promote(n),!0):!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;r===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function JAe(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var SD={type:`projectionFrame`,totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},CD=typeof window<`u`&&window.MotionDebug!==void 0,wD=[``,`X`,`Y`,`Z`],YAe={visibility:`hidden`},XAe=1e3,ZAe=0;function TD(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function QAe(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=jEe(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,dT,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&QAe(r)}function $Ae({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=ZAe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,CD&&(SD.totalNodes=SD.resolvedTargetDeltas=SD.recalculatedProjection=0),this.nodes.forEach(nje),this.nodes.forEach(cje),this.nodes.forEach(lje),this.nodes.forEach(rje),CD&&window.MotionDebug.record(SD)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new bAe)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tE),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,n=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=vAe(t),this.instance=t;let{layoutId:r,layout:i,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(i||r)&&(this.isLayoutDirty=!0),e){let n,r=()=>this.root.updateBlockedByResize=!1;e(t,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=xAe(r,250),yD.hasAnimatedSinceResize&&(yD.hasAnimatedSinceResize=!1,this.nodes.forEach(ED))})}r&&this.root.registerSharedNode(r,this),this.options.animate!==!1&&a&&(r||i)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let i=this.options.transition||a.getDefaultTransition()||mje,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=a.getProps(),c=!this.targetLayout||!WAe(this.targetLayout,r)||n,l=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,l);let t={...XT(i,`layout`),onPlay:o,onComplete:s};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||ED(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,fT(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(uje),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&QAe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(aje);return}this.isUpdating||this.nodes.forEach(oje),this.isUpdating=!1,this.nodes.forEach(sje),this.nodes.forEach(eje),this.nodes.forEach(tje),this.clearAllSnapshots();let e=QT.now();pT.delta=PT(0,1e3/60,e-pT.timestamp),pT.timestamp=e,pT.isProcessing=!0,mT.update.process(pT),mT.preRender.process(pT),mT.render.process(pT),pT.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,TT.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ije),this.sharedNodes.forEach(dje)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dT.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dT.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=lD(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!BAe(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&(t||pD(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),hje(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return lD();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(gje))){let{scroll:e}=this.root;e&&(gD(t.x,e.offset.x),gD(t.y,e.offset.y))}return t}removeElementScroll(e){let t=lD();if(xD(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&xD(t,e),gD(t.x,i.offset.x),gD(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=lD();xD(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&_D(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),pD(r.latestValues)&&_D(n,r.latestValues)}return pD(this.latestValues)&&_D(n,this.latestValues),n}removeTransform(e){let t=lD();xD(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!pD(n.latestValues))continue;fD(n.latestValues)&&n.updateSnapshot();let r=lD();xD(r,n.measurePageBox()),RAe(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return pD(this.latestValues)&&RAe(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==pT.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!(!this.layout||!(r||i))){if(this.resolvedRelativeTargetAt=pT.timestamp,!this.targetDelta&&!this.relativeTarget){let e=this.getClosestProjectingParent();e&&e.layout&&this.animationProgress!==1?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lD(),this.relativeTargetOrigin=lD(),oD(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),xD(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=lD(),this.targetWithTransforms=lD()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Mke(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xD(this.target,this.layout.layoutBox),Qke(this.target,this.targetDelta)):xD(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let e=this.getClosestProjectingParent();e&&!!e.resumingFrom==!!this.resumingFrom&&!e.options.layoutScroll&&e.target&&this.animationProgress!==1?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lD(),this.relativeTargetOrigin=lD(),oD(this.relativeTargetOrigin,this.target,e.target),xD(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}CD&&SD.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||fD(this.parent.latestValues)||Yke(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===pT.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;xD(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;tAe(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=lD());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(MAe(this.prevProjectionDelta.x,this.projectionDelta.x),MAe(this.prevProjectionDelta.y,this.projectionDelta.y)),aD(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!KAe(this.projectionDelta.x,this.prevProjectionDelta.x)||!KAe(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),CD&&SD.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if((t=this.options.visualElement)==null||t.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cD(),this.projectionDelta=cD(),this.projectionDeltaWithTransform=cD()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=cD();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=lD(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(pje));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;DD(a.x,e.x,n),DD(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oD(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),fje(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&HAe(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=lD(),xD(d,this.relativeTarget)),s&&(this.animationValues=i,EAe(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&=(fT(this.pendingAnimation),void 0),this.pendingAnimation=dT.update(()=>{yD.hasAnimatedSinceResize=!0,this.currentAnimation=_Ae(0,XAe,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(XAe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&MD(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||lD();let t=iD(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=iD(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}xD(t,n),_D(t,i),aD(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new qAe),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&TD(`z`,e,r,this.animationValues);for(let t=0;t<wD.length;t++)TD(`rotate${wD[t]}`,e,r,this.animationValues),TD(`skew${wD[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}getProjectionStyles(e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return YAe;let t={visibility:``},n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.opacity=``,t.pointerEvents=AT(e?.pointerEvents)||``,t.transform=n?n(this.latestValues,``):`none`,t;let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){let t={};return this.options.layoutId&&(t.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,t.pointerEvents=AT(e?.pointerEvents)||``),this.hasProjected&&!pD(this.latestValues)&&(t.transform=n?n({},``):`none`,this.hasProjected=!1),t}let i=r.animationValues||r.latestValues;this.applyTransformsToTarget(),t.transform=JAe(this.projectionDeltaWithTransform,this.treeScale,i),n&&(t.transform=n(i,t.transform));let{x:a,y:o}=this.projectionDelta;t.transformOrigin=`${a.origin*100}% ${o.origin*100}% 0`,r.animationValues?t.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:t.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let e in qT){if(i[e]===void 0)continue;let{correct:n,applyTo:a}=qT[e],o=t.transform===`none`?i[e]:n(i[e],r);if(a){let e=a.length;for(let n=0;n<e;n++)t[a[n]]=o}else t[e]=o}return this.options.layoutId&&(t.pointerEvents=r===this?AT(e?.pointerEvents)||``:`none`),t}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(aje),this.root.sharedNodes.clear()}}}function eje(e){e.updateLayout()}function tje(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?uD(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=iD(r);r.min=n[e].min,r.max=r.min+i}):MD(i,t.layoutBox,n)&&uD(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=iD(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=cD();aD(o,n,t.layoutBox);let s=cD();a?aD(s,e.applyTransform(r,!0),t.measuredBox):aD(s,n,t.layoutBox);let c=!BAe(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=lD();oD(o,t.layoutBox,i.layoutBox);let s=lD();oD(s,n,a.layoutBox),WAe(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function nje(e){CD&&SD.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function rje(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ije(e){e.clearSnapshot()}function aje(e){e.clearMeasurements()}function oje(e){e.isLayoutDirty=!1}function sje(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ED(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function cje(e){e.resolveTargetDelta()}function lje(e){e.calcProjection()}function uje(e){e.resetSkewAndRotation()}function dje(e){e.removeLeadSnapshot()}function DD(e,t,n){e.translate=PE(t.translate,0,n),e.scale=PE(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function OD(e,t,n,r){e.min=PE(t.min,n.min,r),e.max=PE(t.max,n.max,r)}function fje(e,t,n,r){OD(e.x,t.x,n.x,r),OD(e.y,t.y,n.y,r)}function pje(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var mje={duration:.45,ease:[.4,0,.1,1]},kD=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),AD=kD(`applewebkit/`)&&!kD(`chrome/`)?Math.round:oT;function jD(e){e.min=AD(e.min),e.max=AD(e.max)}function hje(e){jD(e.x),jD(e.y)}function MD(e,t,n){return e===`position`||e===`preserve-aspect`&&!kke(GAe(t),GAe(n),.2)}function gje(e){return e!==e.root&&e.scroll?.wasRoot}var _je=$Ae({attachResizeListener:(e,t)=>$E(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ND={current:void 0},PD=$Ae({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ND.current){let e=new _je({});e.mount(window),e.setOptions({layoutScroll:!0}),ND.current=e}return ND.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),vje={pan:{Feature:dAe},drag:{Feature:lAe,ProjectionNode:PD,MeasureLayout:hAe}};function yje(e,t,n){if(e instanceof Element)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function FD(e,t){let n=yje(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function ID(e){return t=>{t.pointerType===`touch`||pke()||e(t)}}function bje(e,t,n={}){let[r,i,a]=FD(e,n),o=ID(e=>{let{target:n}=e,r=t(e);if(typeof r!=`function`||!n)return;let a=ID(e=>{r(e),n.removeEventListener(`pointerleave`,a)});n.addEventListener(`pointerleave`,a,i)});return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}function LD(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&dT.postRender(()=>i(t,eD(t)))}var xje=class extends XE{mount(){let{current:e}=this.node;e&&(this.unmount=bje(e,e=>(LD(this.node,e,`Start`),e=>LD(this.node,e,`End`))))}unmount(){}},Sje=class extends XE{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=RE($E(this.node.current,`focus`,()=>this.onFocus()),$E(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}},RD=(e,t)=>t?e===t?!0:RD(e,t.parentElement):!1,Cje=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function wje(e){return Cje.has(e.tagName)||e.tabIndex!==-1}var zD=new WeakSet;function BD(e){return t=>{t.key===`Enter`&&e(t)}}function VD(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Tje=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=BD(()=>{if(zD.has(n))return;VD(n,`down`);let e=BD(()=>{VD(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>VD(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function HD(e){return QE(e)&&!pke()}function Eje(e,t,n={}){let[r,i,a]=FD(e,n),o=e=>{let r=e.currentTarget;if(!HD(e)||zD.has(r))return;zD.add(r);let a=t(e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),!(!HD(e)||!zD.has(r))&&(zD.delete(r),typeof a==`function`&&a(e,{success:t}))},s=e=>{o(e,n.useGlobalTarget||RD(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{!wje(e)&&e.getAttribute(`tabindex`)===null&&(e.tabIndex=0),(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),e.addEventListener(`focus`,e=>Tje(e,i),i)}),a}function UD(e,t,n){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&dT.postRender(()=>i(t,eD(t)))}var Dje=class extends XE{mount(){let{current:e}=this.node;e&&(this.unmount=Eje(e,e=>(UD(this.node,e,`Start`),(e,{success:t})=>UD(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}},WD=new WeakMap,GD=new WeakMap,Oje=e=>{let t=WD.get(e.target);t&&t(e)},kje=e=>{e.forEach(Oje)};function Aje({root:e,...t}){let n=e||document;GD.has(n)||GD.set(n,{});let r=GD.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(kje,{root:e,...t})),r[i]}function jje(e,t,n){let r=Aje(t);return WD.set(e,n),r.observe(e),()=>{WD.delete(e),r.unobserve(e)}}var Mje={some:0,all:1},Nje=class extends XE{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Mje[r]};return jje(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Pje(e,t))&&this.startObserver()}unmount(){}};function Pje({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Fje={inView:{Feature:Nje},tap:{Feature:Dje},focus:{Feature:Sje},hover:{Feature:xje}},Ije={layout:{ProjectionNode:PD,MeasureLayout:hAe}},KD={current:null},qD={current:!1};function Lje(){if(qD.current=!0,aT)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>KD.current=e.matches;e.addListener(t),t()}else KD.current=!1}var Rje=[...BDe,CE,TE],zje=e=>Rje.find(zDe(e)),JD=new WeakMap;function Bje(e,t,n){for(let r in t){let i=t[r],a=n[r];if(kT(i))e.addValue(r,i);else if(kT(a))e.addValue(r,nE(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,nE(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var YD=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Vje=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ME,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=QT.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,dT.render(this.render,!1,!0))};let{latestValues:s,renderState:c,onUpdate:l}=a;this.onUpdate=l,this.latestValues=s,this.baseTarget={...s},this.initialValues=t.initial?{...s}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=ST(t),this.isVariantNode=mTe(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];s[e]!==void 0&&kT(t)&&t.set(s[e],!1)}}mount(e){this.current=e,JD.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),qD.current||Lje(),this.shouldReduceMotion=this.reducedMotionConfig===`never`?!1:this.reducedMotionConfig===`always`?!0:KD.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JD.delete(this.current),this.projection&&this.projection.unmount(),fT(this.notifyUpdate),fT(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=MT.has(e),r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&dT.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on(`renderRequest`,this.scheduleRender),a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i(),a&&a(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in hT){let t=hT[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lD()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<YD.length;t++){let n=YD[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Bje(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=nE(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(PDe(n)||$Ee(n))?n=parseFloat(n):!zje(n)&&TE.test(t)&&(n=SDe(e,t)),this.setBaseTarget(e,kT(n)?n.get():n)),kT(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=DT(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!kT(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new tE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}},XD=class extends Vje{constructor(){super(...arguments),this.KeyframeResolver=HDe}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;kT(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function Hje(e){return window.getComputedStyle(e)}var Uje=class extends XD{constructor(){super(...arguments),this.type=`html`,this.renderInstance=rEe}readValueFromInstance(e,t){if(MT.has(t)){let e=DE(t);return e&&e.default||0}else{let n=Hje(e),r=(RTe(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return rAe(e,t)}build(e,t,n){UT(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return JT(e,t,n)}},Wje=class extends XD{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=lD}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(MT.has(t)){let e=DE(t);return e&&e.default||0}return t=iEe.has(t)?t:wT(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return cEe(e,t,n)}build(e,t,n){WT(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,r){aEe(e,t,n,r)}mount(e){this.isSVGTag=KT(e.tagName),super.mount(e)}},Gje=(e,t)=>ET(e)?new Wje(t):new Uje(t,{allowProjection:e!==g.Fragment}),ZD=pTe(yEe({...fke,...Fje,...vje,...Ije},Gje)),QD={"in-progress":`Build in progress`,failed:`Last build failed`,success:`Gateway deployed`,idle:`No deployment yet`},$D=({status:e,className:t})=>e===`in-progress`?(0,W.jsx)(Hm,{size:14,"aria-label":QD[e],className:G(`animate-spin text-yellow-500`,t)}):(0,W.jsx)(`span`,{role:`img`,"aria-label":QD[e],className:G(`w-2 h-2 shrink-0 rounded-full`,{"bg-green-500":e===`success`,"bg-red-500":e===`failed`,"bg-neutral-400":e===`idle`},t)}),Kje=({children:e,className:t,...n})=>(0,W.jsx)(`div`,{className:G(`sticky flex flex-col w-full border-b px-4 py-3 bg-white dark:bg-[#141412] z-10`,t),style:{top:`var(--banner-height, 0px)`},...n,children:e}),qje=2e3,eO=(e,{onCopy:t,showToast:n=!0}={showToast:!0,onCopy:()=>{}})=>{let r=typeof e==`string`?()=>e:e,[i,a]=(0,g.useState)(`idle`),o=(0,g.useRef)(void 0),s=ah();(0,g.useEffect)(()=>{a(`idle`)},[e]);let c=()=>{a(`copied`),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(`idle`)},qje)};return{copyToClipboard:async()=>{setTimeout(()=>a(e=>e===`idle`?`loading`:e),5);let i=typeof e==`string`?e:await r();try{await navigator.clipboard.writeText(i)}catch{a(`failed`),s.error(`Failed to copy to clipboard`);return}c(),t?.(),n&&s.success((0,W.jsxs)(`div`,{className:`flex gap-2 items-center text-xs font-medium`,children:[(0,W.jsx)(Nre,{strokeWidth:2,size:16}),(0,W.jsx)(`div`,{children:`Copied to clipboard`})]}))},state:i}},tO=(e,t=`api`)=>Jje(e,t)?.url,Jje=(e,t=`api`)=>e.deploymentVersion?.stages.find(e=>e.stage===t),Yje=({count:e})=>!e||e===0?null:(0,W.jsx)(`span`,{className:`absolute top-1 right-0 h-2 w-2 rounded-full bg-blue-400`}),nO=({children:e,to:t,badgeCount:n,end:r})=>(0,W.jsx)(Pr,{end:r,to:t,className:({isActive:e,isPending:t})=>G(`font-medium relative items-center px-2 py-1 rounded-md text-neutral-900 dark:text-white text-sm transition-colors`,`rounded-md hover:text-zuplo-600`,e&&`text-zuplo-700`,t&&`text-zuplo-700 animate-pulse`),children:({isActive:t})=>(0,W.jsxs)(W.Fragment,{children:[t&&(0,W.jsx)(ZD.div,{layoutId:`local-navigation-item-background`,transition:{type:`spring`,bounce:.1,duration:.4},className:`absolute inset-0 rounded-md -z-10 bg-zuplo-100`}),e,(0,W.jsx)(Yje,{count:n})]})}),Xje=()=>{let e=oh(),[t,n]=(0,g.useState)(!1),r=tO(e.environment),{copyToClipboard:i,state:a}=eO(r??``);return(0,W.jsxs)(Zw,{open:t,onOpenChange:n,children:[(0,W.jsx)(Qw,{asChild:!0,children:(0,W.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2 flex justify-between h-8 mt-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)($D,{status:`success`}),`Deployment URLs`]}),(0,W.jsx)(hm,{size:16})]})}),(0,W.jsx)($w,{className:`divide-y p-0`,align:`end`,children:r?(0,W.jsxs)(`div`,{className:`p-4`,children:[(0,W.jsx)(`div`,{className:`font-medium text-lg`,children:`Local Development`}),(0,W.jsx)(`div`,{className:`h-2`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`uppercase text-muted-foreground font-semibold text-xs`,children:`Gateway`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)($D,{status:`success`}),(0,W.jsx)(`div`,{className:`text-sm max-w-52 truncate break-all`,children:(0,W.jsx)(rT,{href:r,target:`_blank`,variant:`ghost`,rel:`noopener noreferrer`,className:`hover:underline`,children:r})}),(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-muted rounded-md transition-colors`,onClick:()=>{i(),n(!1)},children:a===`copied`?(0,W.jsx)(mm,{size:16,className:`text-green-500`}):(0,W.jsx)(Om,{size:16})})]})]})]}):(0,W.jsxs)(`div`,{className:`w-60 p-5 text-center`,children:[(0,W.jsx)(`div`,{className:`text-2xl font-medium`,children:`🙈`}),(0,W.jsx)(`div`,{className:`text-md mt-4`,children:`Deployment URL not configured. Make sure your local gateway is running.`})]})})]})},Zje=()=>(0,W.jsxs)(Kje,{className:`flex-row justify-between`,children:[(0,W.jsxs)(`nav`,{"aria-label":`Sidebar`,className:`flex gap-2 items-center`,children:[(0,W.jsx)(nO,{end:!0,to:`/dev/project/local`,children:`Project`}),(0,W.jsx)(nO,{to:`/dev/project/local/edit`,children:`Code`})]}),(0,W.jsx)(Xje,{})]}),rO=(0,g.createContext)({chromeBottom:0});function Qje({height:e,children:t}){let n={chromeBottom:(0,g.useContext)(rO).chromeBottom+e};return(0,W.jsx)(rO.Provider,{value:n,children:t})}function $je(){return(0,g.useContext)(rO).chromeBottom}var eMe=({children:e,className:t,offset:n=0})=>{let r=$je();return(0,W.jsx)(`div`,{className:G(t),style:{height:`calc(100vh - ${r+n}px)`},children:e})};function iO(e,t,n){let{reference:r,floating:i}=e,a=vC(t),o=yC(t),s=_C(o),c=mC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(hC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}var tMe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iO(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=iO(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function aO(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=pC(t,e),p=SC(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=CC(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=CC(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var nMe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=pC(e,t)||{};if(l==null)return{};let d=SC(u),f={x:n,y:r},p=yC(i),m=_C(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=sC(d[_],T),D=sC(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=fC(O,A,k),M=!c.arrow&&hC(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),rMe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=pC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=mC(r),_=vC(o),v=mC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xC(o)]:Nye(o)),x=p!==`none`;!d&&x&&b.push(...zye(o,m,p,y));let S=[o,...b],C=await aO(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Mye(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==vC(t))||T.every(e=>vC(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function oO(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function sO(e){return Oye.some(t=>e[t]>=0)}var iMe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n}=t,{strategy:r=`referenceHidden`,...i}=pC(e,t);switch(r){case`referenceHidden`:{let e=oO(await aO(t,{...i,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:sO(e)}}}case`escaped`:{let e=oO(await aO(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:sO(e)}}}default:return{}}}}},cO=new Set([`left`,`top`]);async function aMe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mC(n),s=hC(n),c=vC(n)===`y`,l=cO.has(o)?-1:1,u=a&&c?-1:1,d=pC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var oMe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await aMe(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},sMe=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=pC(e,t),l={x:n,y:r},u=await aO(t,c),d=vC(mC(i)),f=gC(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=fC(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=fC(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},cMe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=pC(e,t),u={x:n,y:r},d=vC(i),f=gC(d),p=u[f],m=u[d],h=pC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=cO.has(mC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},lMe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=pC(e,t),u=await aO(t,l),d=mC(i),f=hC(i),p=vC(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=sC(h-u[g],v),x=sC(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=cC(u.left,0),t=cC(u.right,0),n=cC(u.top,0),r=cC(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:cC(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:cC(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function lO(e){let t=IC(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=AC(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=lC(n)!==a||lC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function uO(e){return kC(e)?e:e.contextElement}function dO(e){let t=uO(e);if(!AC(t))return dC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=lO(t),o=(a?lC(n.width):n.width)/r,s=(a?lC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var uMe=dC(0);function fO(e){let t=DC(e);return!PC()||!t.visualViewport?uMe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dMe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==DC(e)?!1:t}function pO(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=uO(e),o=dC(1);t&&(r?kC(r)&&(o=dO(r)):o=dO(e));let s=dMe(a,n,r)?fO(a):dC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=DC(a),t=r&&kC(r)?DC(r):r,n=e,i=BC(n);for(;i&&r&&t!==n;){let e=dO(i),t=i.getBoundingClientRect(),r=IC(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=DC(i),i=BC(n)}}return CC({width:u,height:d,x:c,y:l})}function mO(e,t){let n=LC(e).scrollLeft;return t?t.left+n:pO(OC(e)).left+n}function hO(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-mO(e,n),y:n.top+t.scrollTop}}function fMe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=OC(r),s=t?MC(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=dC(1),u=dC(0),d=AC(r);if((d||!d&&!a)&&((EC(r)!==`body`||jC(o))&&(c=LC(r)),AC(r))){let e=pO(r);l=dO(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?hO(o,c):dC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function pMe(e){return Array.from(e.getClientRects())}function mMe(e){let t=OC(e),n=LC(e),r=e.ownerDocument.body,i=cC(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=cC(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+mO(e),s=-n.scrollTop;return IC(r).direction===`rtl`&&(o+=cC(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var gO=25;function hMe(e,t){let n=DC(e),r=OC(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=PC();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=mO(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=gO&&(a-=o)}else l<=gO&&(a+=l);return{width:a,height:o,x:s,y:c}}var gMe=new Set([`absolute`,`fixed`]);function _Me(e,t){let n=pO(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=AC(e)?dO(e):dC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _O(e,t,n){let r;if(t===`viewport`)r=hMe(e,n);else if(t===`document`)r=mMe(OC(e));else if(kC(t))r=_Me(t,n);else{let n=fO(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return CC(r)}function vO(e,t){let n=RC(e);return n===t||!kC(n)||FC(n)?!1:IC(n).position===`fixed`||vO(n,t)}function vMe(e,t){let n=t.get(e);if(n)return n;let r=zC(e,[],!1).filter(e=>kC(e)&&EC(e)!==`body`),i=null,a=IC(e).position===`fixed`,o=a?RC(e):e;for(;kC(o)&&!FC(o);){let t=IC(o),n=NC(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&gMe.has(i.position)||jC(o)&&!n&&vO(e,o))?r=r.filter(e=>e!==o):i=t,o=RC(o)}return t.set(e,r),r}function yMe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?MC(t)?[]:vMe(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=_O(t,n,i);return e.top=cC(r.top,e.top),e.right=sC(r.right,e.right),e.bottom=sC(r.bottom,e.bottom),e.left=cC(r.left,e.left),e},_O(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function bMe(e){let{width:t,height:n}=lO(e);return{width:t,height:n}}function xMe(e,t,n){let r=AC(t),i=OC(t),a=n===`fixed`,o=pO(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=dC(0);function l(){c.x=mO(i)}if(r||!r&&!a)if((EC(t)!==`body`||jC(i))&&(s=LC(t)),r){let e=pO(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?hO(i,s):dC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function yO(e){return IC(e).position===`static`}function bO(e,t){if(!AC(e)||IC(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return OC(e)===n&&(n=n.ownerDocument.body),n}function xO(e,t){let n=DC(e);if(MC(e))return n;if(!AC(e)){let t=RC(e);for(;t&&!FC(t);){if(kC(t)&&!yO(t))return t;t=RC(t)}return n}let r=bO(e,t);for(;r&&rbe(r)&&yO(r);)r=bO(r,t);return r&&FC(r)&&yO(r)&&!NC(r)?n:r||cbe(e)||n}var SMe=async function(e){let t=this.getOffsetParent||xO,n=this.getDimensions,r=await n(e.floating);return{reference:xMe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CMe(e){return IC(e).direction===`rtl`}var wMe={convertOffsetParentRelativeRectToViewportRelativeRect:fMe,getDocumentElement:OC,getClippingRect:yMe,getOffsetParent:xO,getElementRects:SMe,getClientRects:pMe,getDimensions:bMe,getScale:dO,isElement:kC,isRTL:CMe};function SO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function TMe(e,t){let n=null,r,i=OC(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=uC(d),h=uC(i.clientWidth-(u+f)),g=uC(i.clientHeight-(d+p)),_=uC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:cC(0,sC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!SO(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function EMe(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=uO(e),u=i||a?[...l?zC(l):[],...zC(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?TMe(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?pO(e):null;c&&g();function g(){let t=pO(e);h&&!SO(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var DMe=oMe,OMe=sMe,kMe=rMe,AMe=lMe,jMe=iMe,CO=nMe,MMe=cMe,NMe=(e,t,n)=>{let r=new Map,i={platform:wMe,...n},a={...i.platform,_c:r};return tMe(e,t,{...i,platform:a})},wO=typeof document<`u`?g.useLayoutEffect:function(){};function TO(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!TO(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!TO(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function EO(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function DO(e,t){let n=EO(e);return Math.round(t*n)/n}function OO(e){let t=g.useRef(e);return wO(()=>{t.current=e}),t}function PMe(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=g.useState(r);TO(f,r)||p(r);let[m,h]=g.useState(null),[_,v]=g.useState(null),y=g.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=g.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||_,C=g.useRef(null),w=g.useRef(null),T=g.useRef(u),E=c!=null,D=OO(c),O=OO(i),k=OO(l),A=g.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),NMe(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!TO(T.current,t)&&(T.current=t,rp.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);wO(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=g.useRef(!1);wO(()=>(j.current=!0,()=>{j.current=!1}),[]),wO(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=g.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=g.useMemo(()=>({reference:x,floating:S}),[x,S]),P=g.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=DO(N.floating,u.x),r=DO(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...EO(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var FMe=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:CO({element:r.current,padding:i}).fn(n):r?CO({element:r,padding:i}).fn(n):{}}}},IMe=(e,t)=>({...DMe(e),options:[e,t]}),LMe=(e,t)=>({...OMe(e),options:[e,t]}),RMe=(e,t)=>({...MMe(e),options:[e,t]}),zMe=(e,t)=>({...kMe(e),options:[e,t]}),BMe=(e,t)=>({...AMe(e),options:[e,t]}),VMe=(e,t)=>({...jMe(e),options:[e,t]}),HMe=(e,t)=>({...FMe(e),options:[e,t]}),UMe=`Arrow`,kO=g.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,W.jsx)(xp.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,W.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});kO.displayName=UMe;var WMe=kO,AO=`Popper`,[jO,MO]=pp(AO),[GMe,NO]=jO(AO),PO=e=>{let{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return(0,W.jsx)(GMe,{scope:t,anchor:r,onAnchorChange:i,children:n})};PO.displayName=AO;var FO=`PopperAnchor`,IO=g.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=NO(FO,n),o=g.useRef(null),s=fp(t,o),c=g.useRef(null);return g.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,W.jsx)(xp.div,{...i,ref:s})});IO.displayName=FO;var LO=`PopperContent`,[KMe,qMe]=jO(LO),RO=g.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,_=NO(LO,n),[v,y]=g.useState(null),b=fp(t,e=>y(e)),[x,S]=g.useState(null),C=YC(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(YMe),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=PMe({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>EMe(...e,{animationFrame:p===`always`}),elements:{reference:_.anchor},middleware:[IMe({mainAxis:i+T,alignmentAxis:o}),c&&LMe({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?RMe():void 0,...A}),c&&zMe({...A}),BMe({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&HMe({element:x,padding:s}),XMe({arrowWidth:w,arrowHeight:T}),f&&VMe({strategy:`referenceHidden`,...A})]}),[I,L]=VO(N),R=Sp(m);Ep(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,ee=F.arrow?.y,te=F.arrow?.centerOffset!==0,[ne,B]=g.useState();return Ep(()=>{v&&B(window.getComputedStyle(v).zIndex)},[v]),(0,W.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ne,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,W.jsx)(KMe,{scope:n,placedSide:I,onArrowChange:S,arrowX:z,arrowY:ee,shouldHideArrow:te,children:(0,W.jsx)(xp.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});RO.displayName=LO;var zO=`PopperArrow`,JMe={top:`bottom`,right:`left`,bottom:`top`,left:`right`},BO=g.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qMe(zO,n),a=JMe[i.placedSide];return(0,W.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,W.jsx)(WMe,{...r,ref:t,style:{...r.style,display:`block`}})})});BO.displayName=zO;function YMe(e){return e!==null}var XMe=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=VO(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function VO(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var HO=PO,UO=IO,WO=RO,GO=BO,ZMe=`Portal`,KO=g.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=g.useState(!1);Ep(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?rp.createPortal((0,W.jsx)(xp.div,{...r,ref:t}),o):null});KO.displayName=ZMe;function QMe(e,t){return g.useReducer((e,n)=>t[e][n]??e,e)}var qO=e=>{let{present:t,children:n}=e,r=$Me(t),i=typeof n==`function`?n({present:r.isPresent}):g.Children.only(n),a=fp(r.ref,eNe(i));return typeof n==`function`||r.isPresent?g.cloneElement(i,{ref:a}):null};qO.displayName=`Presence`;function $Me(e){let[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),a=g.useRef(`none`),[o,s]=QMe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return g.useEffect(()=>{let e=JO(r.current);a.current=o===`mounted`?e:`none`},[o]),Ep(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=JO(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ep(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=JO(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=JO(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:g.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function JO(e){return e?.animationName||`none`}function eNe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var YO=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),tNe=`VisuallyHidden`,XO=g.forwardRef((e,t)=>(0,W.jsx)(xp.span,{...e,ref:t,style:{...YO,...e.style}}));XO.displayName=tNe;var nNe=XO,[ZO,rNe]=pp(`Tooltip`,[MO]),QO=MO(),$O=`TooltipProvider`,iNe=700,ek=`tooltip.open`,[aNe,tk]=ZO($O),nk=e=>{let{__scopeTooltip:t,delayDuration:n=iNe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=g.useRef(!0),s=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,W.jsx)(aNe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:g.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};nk.displayName=$O;var rk=`Tooltip`,[oNe,ik]=ZO(rk),ak=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=tk(rk,e.__scopeTooltip),l=QO(t),[u,d]=g.useState(null),f=oC(),p=g.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,_=g.useRef(!1),[v,y]=Ap({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ek))):c.onClose(),a?.(e)},caller:rk}),b=g.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,y(!0)},[y]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{_.current=!0,y(!0),p.current=0},h)},[h,y]);return g.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,W.jsx)(HO,{...l,children:(0,W.jsx)(oNe,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:g.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};ak.displayName=rk;var ok=`TooltipTrigger`,sk=g.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ik(ok,n),a=tk(ok,n),o=QO(n),s=fp(t,g.useRef(null),i.onTriggerChange),c=g.useRef(!1),l=g.useRef(!1),u=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,W.jsx)(UO,{asChild:!0,...o,children:(0,W.jsx)(xp.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:_p(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:_p(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:_p(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:_p(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:_p(e.onBlur,i.onClose),onClick:_p(e.onClick,i.onClose)})})});sk.displayName=ok;var ck=`TooltipPortal`,[sNe,cNe]=ZO(ck,{forceMount:void 0}),lk=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ik(ck,t);return(0,W.jsx)(sNe,{scope:t,forceMount:n,children:(0,W.jsx)(qO,{present:n||a.open,children:(0,W.jsx)(KO,{asChild:!0,container:i,children:r})})})};lk.displayName=ck;var uk=`TooltipContent`,dk=g.forwardRef((e,t)=>{let n=cNe(uk,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ik(uk,e.__scopeTooltip);return(0,W.jsx)(qO,{present:r||o.open,children:o.disableHoverableContent?(0,W.jsx)(fk,{side:i,...a,ref:t}):(0,W.jsx)(lNe,{side:i,...a,ref:t})})}),lNe=g.forwardRef((e,t)=>{let n=ik(uk,e.__scopeTooltip),r=tk(uk,e.__scopeTooltip),i=g.useRef(null),a=fp(t,i),[o,s]=g.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{s(null),d(!1)},[d]),p=g.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=mNe(r,pNe(r,n.getBoundingClientRect())),a=hNe(t.getBoundingClientRect());s(_Ne([...i,...a])),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),g.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!gNe(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,W.jsx)(fk,{...e,ref:a})}),[uNe,dNe]=ZO(rk,{isInside:!1}),fNe=bp(`TooltipContent`),fk=g.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ik(uk,n),l=QO(n),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(ek,u),()=>document.removeEventListener(ek,u)),[u]),g.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,W.jsx)(wp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,W.jsxs)(WO,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,W.jsx)(fNe,{children:r}),(0,W.jsx)(uNe,{scope:n,isInside:!0,children:(0,W.jsx)(nNe,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});dk.displayName=uk;var pk=`TooltipArrow`,mk=g.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=QO(n);return dNe(pk,n).isInside?null:(0,W.jsx)(GO,{...i,...r,ref:t})});mk.displayName=pk;function pNe(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function mNe(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function hNe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function gNe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function _Ne(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),vNe(t)}function vNe(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var yNe=nk,hk=ak,gk=sk,bNe=lk,xNe=dk,_k=mk;function vk({delayDuration:e=0,...t}){return(0,W.jsx)(yNe,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function yk({...e}){return(0,W.jsx)(vk,{children:(0,W.jsx)(hk,{"data-slot":`tooltip`,...e})})}function bk({...e}){return(0,W.jsx)(gk,{"data-slot":`tooltip-trigger`,...e})}function xk({className:e,sideOffset:t=0,children:n,...r}){return(0,W.jsx)(bNe,{children:(0,W.jsxs)(xNe,{"data-slot":`tooltip-content`,sideOffset:t,className:G(`bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,W.jsx)(_k,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}var Sk=({className:e,...t})=>(0,W.jsx)(_k,{...t,className:G(`fill-white -translate-y-px drop-shadow-md [clip-path:inset(0_-10px_-10px_-10px)]`,e)}),Ck=({children:e,content:t,open:n,defaultOpen:r,onOpenChange:i,side:a=`top`,align:o=`center`,className:s,asChild:c=!0,...l})=>t?(0,W.jsxs)(hk,{open:n,defaultOpen:r,onOpenChange:i,children:[(0,W.jsx)(gk,{asChild:c,children:e}),(0,W.jsxs)(xk,{side:a,align:o,className:s,...l,children:[t,(0,W.jsx)(Sk,{})]})]}):e,wk={width:5,height:5,borderRadius:`50%`},SNe=({className:e,color:t=`white`})=>(0,W.jsxs)(ZD.div,{className:`flex items-center gap-1`,initial:`hidden`,animate:`visible`,variants:{visible:{transition:{staggerChildren:.2}}},children:[(0,W.jsx)(ZD.div,{className:G(t===`white`?`bg-white/60`:`bg-zuplo-600/60`,e),variants:{hidden:{opacity:0,y:3},visible:{opacity:1,y:0,transition:{y:{type:`spring`,stiffness:300,damping:10,repeat:1/0,repeatType:`reverse`}}}},style:wk}),(0,W.jsx)(ZD.div,{className:G(t===`white`?`bg-white/60`:`bg-zuplo-600/60`,e),variants:{hidden:{opacity:0,y:3},visible:{opacity:1,y:0,transition:{y:{type:`spring`,stiffness:300,damping:10,repeat:1/0,repeatType:`reverse`}}}},style:wk}),(0,W.jsx)(ZD.div,{className:G(t===`white`?`bg-white/60`:`bg-zuplo-600/60`,e),variants:{hidden:{opacity:0,y:3},visible:{opacity:1,y:0,transition:{y:{type:`spring`,stiffness:300,damping:10,repeat:1/0,repeatType:`reverse`}}}},style:wk})]}),Tk=({children:e,className:t,loading:n,alternative:r,variant:i=`default`})=>(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(`div`,{className:G(t,`transition-opacity`,n&&`opacity-0`),children:e}),(0,W.jsx)(`div`,{className:G(`absolute top-1/2 left-1/2 opacity-0 transform -translate-x-1/2 -translate-y-1/2`,n&&`opacity-100`),children:r??(0,W.jsx)(SNe,{color:i===`default`?`white`:`primary`})})]});function Ek(){return Ek=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ek.apply(null,arguments)}function Dk(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function CNe(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Ok(...e){return t=>e.forEach(e=>CNe(e,t))}function kk(...e){return(0,g.useCallback)(Ok(...e),e)}function wNe(e,t){let n=(0,g.createContext)(t);function r(e){let{children:t,...r}=e,i=(0,g.useMemo)(()=>r,Object.values(r));return(0,g.createElement)(n.Provider,{value:i},t)}function i(r){let i=(0,g.useContext)(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return r.displayName=e+`Provider`,[r,i]}function TNe(e,t=[]){let n=[];function r(t,r){let i=(0,g.createContext)(r),a=n.length;n=[...n,r];function o(t){let{scope:n,children:r,...o}=t,s=n?.[e][a]||i,c=(0,g.useMemo)(()=>o,Object.values(o));return(0,g.createElement)(s.Provider,{value:c},r)}function s(n,o){let s=(0,g.useContext)(o?.[e][a]||i);if(s)return s;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return o.displayName=t+`Provider`,[o,s]}let i=()=>{let t=n.map(e=>(0,g.createContext)(e));return function(n){let r=n?.[e]||t;return(0,g.useMemo)(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ENe(i,...t)]}function ENe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return(0,g.useMemo)(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Ak=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},DNe=g.useId||(()=>void 0),ONe=0;function jk(e){let[t,n]=g.useState(DNe());return Ak(()=>{e||n(e=>e??String(ONe++))},[e]),e||(t?`radix-${t}`:``)}function Mk(e){let t=(0,g.useRef)(e);return(0,g.useEffect)(()=>{t.current=e}),(0,g.useMemo)(()=>(...e)=>t.current?.call(t,...e),[])}function kNe({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=ANe({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=Mk(n);return[o,(0,g.useCallback)(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function ANe({defaultProp:e,onChange:t}){let n=(0,g.useState)(e),[r]=n,i=(0,g.useRef)(r),a=Mk(t);return(0,g.useEffect)(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function Nk(){return Nk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nk.apply(null,arguments)}var Pk=(0,g.forwardRef)((e,t)=>{let{children:n,...r}=e,i=g.Children.toArray(n),a=i.find(MNe);if(a){let e=a.props.children,n=i.map(t=>t===a?g.Children.count(e)>1?g.Children.only(null):(0,g.isValidElement)(e)?e.props.children:null:t);return(0,g.createElement)(Fk,Nk({},r,{ref:t}),(0,g.isValidElement)(e)?(0,g.cloneElement)(e,void 0,n):null)}return(0,g.createElement)(Fk,Nk({},r,{ref:t}),n)});Pk.displayName=`Slot`;var Fk=(0,g.forwardRef)((e,t)=>{let{children:n,...r}=e;return(0,g.isValidElement)(n)?(0,g.cloneElement)(n,{...NNe(r,n.props),ref:t?Ok(t,n.ref):n.ref}):g.Children.count(n)>1?g.Children.only(null):null});Fk.displayName=`SlotClone`;var jNe=({children:e})=>(0,g.createElement)(g.Fragment,null,e);function MNe(e){return(0,g.isValidElement)(e)&&e.type===jNe}function NNe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{a(...e),i(...e)}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}var Ik=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=(0,g.forwardRef)((e,n)=>{let{asChild:r,...i}=e,a=r?Pk:t;return(0,g.useEffect)(()=>{window[Symbol.for(`radix-ui`)]=!0},[]),(0,g.createElement)(a,Nk({},i,{ref:n}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),PNe=(0,g.forwardRef)((e,t)=>{let{container:n=globalThis==null?void 0:globalThis.document?.body,...r}=e;return n?rp.createPortal((0,g.createElement)(Ik.div,Nk({},r,{ref:t})),n):null});function FNe(e,t){return(0,g.useReducer)((e,n)=>t[e][n]??e,e)}var Lk=e=>{let{present:t,children:n}=e,r=INe(t),i=typeof n==`function`?n({present:r.isPresent}):g.Children.only(n),a=kk(r.ref,i.ref);return typeof n==`function`||r.isPresent?(0,g.cloneElement)(i,{ref:a}):null};Lk.displayName=`Presence`;function INe(e){let[t,n]=(0,g.useState)(),r=(0,g.useRef)({}),i=(0,g.useRef)(e),a=(0,g.useRef)(`none`),[o,s]=FNe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return(0,g.useEffect)(()=>{let e=Rk(r.current);a.current=o===`mounted`?e:`none`},[o]),Ak(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Rk(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ak(()=>{if(t){let e=e=>{let n=Rk(r.current).includes(e.animationName);e.target===t&&n&&(0,rp.flushSync)(()=>s(`ANIMATION_END`))},n=e=>{e.target===t&&(a.current=Rk(r.current))};return t.addEventListener(`animationstart`,n),t.addEventListener(`animationcancel`,e),t.addEventListener(`animationend`,e),()=>{t.removeEventListener(`animationstart`,n),t.removeEventListener(`animationcancel`,e),t.removeEventListener(`animationend`,e)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:(0,g.useCallback)(e=>{e&&(r.current=getComputedStyle(e)),n(e)},[])}}function Rk(e){return e?.animationName||`none`}var zk=0;function LNe(){(0,g.useEffect)(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Bk()),document.body.insertAdjacentElement(`beforeend`,e[1]??Bk()),zk++,()=>{zk===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),zk--}},[])}function Bk(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.cssText=`outline: none; opacity: 0; position: fixed; pointer-events: none`,e}var Vk=Jxe(),Hk=function(){},Uk=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:Hk,onWheelCapture:Hk,onTouchMoveCapture:Hk}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,m=e.inert,h=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=pw(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noIsolation`,`inert`,`allowPinchZoom`,`as`]),b=f,x=Gxe([n,t]),S=fw(fw({},y),i);return g.createElement(g.Fragment,null,u&&g.createElement(b,{sideCar:Vk,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:a,allowPinchZoom:!!h,lockRef:n}),o?g.cloneElement(g.Children.only(s),fw(fw({},S),{ref:x})):g.createElement(v,fw({},S,{className:c,ref:x}),s))});Uk.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Uk.classNames={fullWidth:hw,zeroRight:mw};var Wk=!1;if(typeof window<`u`)try{var Gk=Object.defineProperty({},`passive`,{get:function(){return Wk=!0,!0}});window.addEventListener(`test`,Gk,Gk),window.removeEventListener(`test`,Gk,Gk)}catch{Wk=!1}var Kk=Wk?{passive:!1}:!1,RNe=function(e){return e.tagName===`TEXTAREA`},qk=function(e,t){var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!RNe(e)&&n[t]===`visible`)},zNe=function(e){return qk(e,`overflowY`)},BNe=function(e){return qk(e,`overflowX`)},Jk=function(e,t){var n=t;do{if(typeof ShadowRoot<`u`&&n instanceof ShadowRoot&&(n=n.host),Yk(e,n)){var r=Xk(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},VNe=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},HNe=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Yk=function(e,t){return e===`v`?zNe(t):BNe(t)},Xk=function(e,t){return e===`v`?VNe(t):HNe(t)},UNe=function(e,t){return e===`h`&&t===`rtl`?-1:1},WNe=function(e,t,n,r,i){var a=UNe(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{var p=Xk(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Yk(e,s)&&(d+=h,f+=m),s=s.parentNode}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&d===0||!i&&o>d)||!u&&(i&&f===0||!i&&-o>f))&&(l=!0),l},Zk=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qk=function(e){return[e.deltaX,e.deltaY]},$k=function(e){return e&&`current`in e?e.current:e},GNe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KNe=function(e){return`
93
+ `},OSe=0,Ew=[];function kSe(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(OSe++)[0],a=g.useState(yw)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=zxe([e.lockRef.current],(e.shards||[]).map(TSe),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=g.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Tw(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=_Se(d,u);if(!f)return!0;if(f?l=d:(l=d===`v`?`h`:`v`,f=_Se(d,u)),!f)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var p=r.current||l;return CSe(p,t,e,p===`h`?s:c,!0)},[]),c=g.useCallback(function(e){var n=e;if(!(!Ew.length||Ew[Ew.length-1]!==a)){var r=`deltaY`in n?wSe(n):Tw(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ESe(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(TSe).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=g.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ASe(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=g.useCallback(function(e){n.current=Tw(e),r.current=void 0},[]),d=g.useCallback(function(t){l(t.type,wSe(t),t.target,s(t,e.lockRef.current))},[]),f=g.useCallback(function(t){l(t.type,Tw(t),t.target,s(t,e.lockRef.current))},[]);g.useEffect(function(){return Ew.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ww),document.addEventListener(`touchmove`,c,ww),document.addEventListener(`touchstart`,u,ww),function(){Ew=Ew.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ww),document.removeEventListener(`touchmove`,c,ww),document.removeEventListener(`touchstart`,u,ww)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(a,{styles:DSe(i)}):null,p?g.createElement(fSe,{gapMode:e.gapMode}):null)}function ASe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jSe=Xxe(Zxe,kSe),Dw=g.forwardRef(function(e,t){return g.createElement(vw,fw({},e,{ref:t,sideCar:jSe}))});Dw.classNames=vw.classNames;var Ow=[`Enter`,` `],MSe=[`ArrowDown`,`PageUp`,`Home`],NSe=[`ArrowUp`,`PageDown`,`End`],PSe=[...MSe,...NSe],FSe={ltr:[...Ow,`ArrowRight`],rtl:[...Ow,`ArrowLeft`]},ISe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},kw=`Menu`,[Aw,LSe,RSe]=gp(kw),[jw,zSe]=pp(kw,[RSe,ZC,iw]),Mw=ZC(),BSe=iw(),[VSe,Nw]=jw(kw),[HSe,Pw]=jw(kw),USe=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Mw(t),[c,l]=g.useState(null),u=g.useRef(!1),d=Sp(a),f=$S(i);return g.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,W.jsx)($C,{...s,children:(0,W.jsx)(VSe,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,W.jsx)(HSe,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};USe.displayName=kw;var WSe=`MenuAnchor`,Fw=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Mw(n);return(0,W.jsx)(ew,{...i,...r,ref:t})});Fw.displayName=WSe;var Iw=`MenuPortal`,[GSe,KSe]=jw(Iw,{forceMount:void 0}),qSe=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Nw(Iw,t);return(0,W.jsx)(GSe,{scope:t,forceMount:n,children:(0,W.jsx)(Op,{present:n||a.open,children:(0,W.jsx)(Dp,{asChild:!0,container:i,children:r})})})};qSe.displayName=Iw;var Lw=`MenuContent`,[JSe,Rw]=jw(Lw),YSe=g.forwardRef((e,t)=>{let n=KSe(Lw,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Nw(Lw,e.__scopeMenu),o=Pw(Lw,e.__scopeMenu);return(0,W.jsx)(Aw.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Op,{present:r||a.open,children:(0,W.jsx)(Aw.Slot,{scope:e.__scopeMenu,children:o.modal?(0,W.jsx)(XSe,{...i,ref:t}):(0,W.jsx)(ZSe,{...i,ref:t})})})})}),XSe=g.forwardRef((e,t)=>{let n=Nw(Lw,e.__scopeMenu),r=g.useRef(null),i=fp(t,r);return g.useEffect(()=>{let e=r.current;if(e)return dw(e)},[]),(0,W.jsx)(zw,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:up(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ZSe=g.forwardRef((e,t)=>{let n=Nw(Lw,e.__scopeMenu);return(0,W.jsx)(zw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),QSe=mp(`MenuContent.ScrollLock`),zw=g.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,_=Nw(Lw,n),v=Pw(Lw,n),y=Mw(n),b=BSe(n),x=LSe(n),[S,C]=g.useState(null),w=g.useRef(null),T=fp(t,w,_.onContentChange),E=g.useRef(0),D=g.useRef(``),O=g.useRef(0),k=g.useRef(null),A=g.useRef(`right`),j=g.useRef(0),M=m?Dw:g.Fragment,N=m?{as:QSe,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=OCe(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};g.useEffect(()=>()=>window.clearTimeout(E.current),[]),tC();let F=g.useCallback(e=>A.current===k.current?.side&&ACe(e,k.current?.area),[]);return(0,W.jsx)(JSe,{scope:n,searchRef:D,onItemEnter:g.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:g.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:g.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:g.useCallback(e=>{k.current=e},[]),children:(0,W.jsx)(M,{...N,children:(0,W.jsx)(iC,{asChild:!0,trapped:i,onMountAutoFocus:up(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,W.jsx)(wp,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,W.jsx)(aw,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:up(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,W.jsx)(vxe,{role:`menu`,"aria-orientation":`vertical`,"data-state":TCe(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:up(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!PSe.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);NSe.includes(e.key)&&a.reverse(),ECe(a)}),onBlur:up(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:up(e.onPointerMove,Jw(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});YSe.displayName=Lw;var $Se=`MenuGroup`,Bw=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(Tp.div,{role:`group`,...r,ref:t})});Bw.displayName=$Se;var eCe=`MenuLabel`,tCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(Tp.div,{...r,ref:t})});tCe.displayName=eCe;var Vw=`MenuItem`,nCe=`menu.itemSelect`,Hw=g.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=g.useRef(null),o=Pw(Vw,e.__scopeMenu),s=Rw(Vw,e.__scopeMenu),c=fp(t,a),l=g.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(nCe,{bubbles:!0,cancelable:!0});e.addEventListener(nCe,e=>r?.(e),{once:!0}),hte(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,W.jsx)(rCe,{...i,ref:c,disabled:n,onClick:up(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:up(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:up(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ow.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Hw.displayName=Vw;var rCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Rw(Vw,n),s=BSe(n),c=g.useRef(null),l=fp(t,c),[u,d]=g.useState(!1),[f,p]=g.useState(``);return g.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,W.jsx)(Aw.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,W.jsx)(ow,{asChild:!0,...s,focusable:!r,children:(0,W.jsx)(Tp.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:up(e.onPointerMove,Jw(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:up(e.onPointerLeave,Jw(e=>o.onItemLeave(e))),onFocus:up(e.onFocus,()=>d(!0)),onBlur:up(e.onBlur,()=>d(!1))})})})}),iCe=`MenuCheckboxItem`,aCe=g.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,W.jsx)(fCe,{scope:e.__scopeMenu,checked:n,children:(0,W.jsx)(Hw,{role:`menuitemcheckbox`,"aria-checked":Kw(n)?`mixed`:n,...i,ref:t,"data-state":qw(n),onSelect:up(i.onSelect,()=>r?.(Kw(n)?!0:!n),{checkForDefaultPrevented:!1})})})});aCe.displayName=iCe;var oCe=`MenuRadioGroup`,[sCe,cCe]=jw(oCe,{value:void 0,onValueChange:()=>{}}),lCe=g.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Sp(r);return(0,W.jsx)(sCe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,W.jsx)(Bw,{...i,ref:t})})});lCe.displayName=oCe;var uCe=`MenuRadioItem`,dCe=g.forwardRef((e,t)=>{let{value:n,...r}=e,i=cCe(uCe,e.__scopeMenu),a=n===i.value;return(0,W.jsx)(fCe,{scope:e.__scopeMenu,checked:a,children:(0,W.jsx)(Hw,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":qw(a),onSelect:up(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});dCe.displayName=uCe;var Uw=`MenuItemIndicator`,[fCe,pCe]=jw(Uw,{checked:!1}),mCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=pCe(Uw,n);return(0,W.jsx)(Op,{present:r||Kw(a.checked)||a.checked===!0,children:(0,W.jsx)(Tp.span,{...i,ref:t,"data-state":qw(a.checked)})})});mCe.displayName=Uw;var hCe=`MenuSeparator`,gCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(Tp.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});gCe.displayName=hCe;var _Ce=`MenuArrow`,vCe=g.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Mw(n);return(0,W.jsx)(yxe,{...i,...r,ref:t})});vCe.displayName=_Ce;var Ww=`MenuSub`,[yCe,bCe]=jw(Ww),xCe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Nw(Ww,t),o=Mw(t),[s,c]=g.useState(null),[l,u]=g.useState(null),d=Sp(i);return g.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,W.jsx)($C,{...o,children:(0,W.jsx)(VSe,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,W.jsx)(yCe,{scope:t,contentId:oC(),triggerId:oC(),trigger:s,onTriggerChange:c,children:n})})})};xCe.displayName=Ww;var Gw=`MenuSubTrigger`,SCe=g.forwardRef((e,t)=>{let n=Nw(Gw,e.__scopeMenu),r=Pw(Gw,e.__scopeMenu),i=bCe(Gw,e.__scopeMenu),a=Rw(Gw,e.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,W.jsx)(Fw,{asChild:!0,...l,children:(0,W.jsx)(rCe,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":TCe(n.open),...e,ref:dp(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:up(e.onPointerMove,Jw(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:up(e.onPointerLeave,Jw(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:up(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||FSe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});SCe.displayName=Gw;var CCe=`MenuSubContent`,wCe=g.forwardRef((e,t)=>{let n=KSe(Lw,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Nw(Lw,e.__scopeMenu),o=Pw(Lw,e.__scopeMenu),s=bCe(CCe,e.__scopeMenu),c=g.useRef(null),l=fp(t,c);return(0,W.jsx)(Aw.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Op,{present:r||a.open,children:(0,W.jsx)(Aw.Slot,{scope:e.__scopeMenu,children:(0,W.jsx)(zw,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:up(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:up(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:up(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ISe[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});wCe.displayName=CCe;function TCe(e){return e?`open`:`closed`}function Kw(e){return e===`indeterminate`}function qw(e){return Kw(e)?`indeterminate`:e?`checked`:`unchecked`}function ECe(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function DCe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function OCe(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=DCe(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function kCe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ACe(e,t){return t?kCe({x:e.clientX,y:e.clientY},t):!1}function Jw(e){return t=>t.pointerType===`mouse`?e(t):void 0}var jCe=USe,MCe=Fw,NCe=qSe,PCe=YSe,FCe=Bw,ICe=tCe,LCe=Hw,RCe=aCe,zCe=lCe,BCe=dCe,VCe=mCe,HCe=gCe,UCe=vCe,WCe=xCe,GCe=SCe,KCe=wCe,Yw=`DropdownMenu`,[qCe,JCe]=pp(Yw,[zSe]),Xw=zSe(),[YCe,XCe]=qCe(Yw),ZCe=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Xw(t),l=g.useRef(null),[u,d]=Ap({prop:i,defaultProp:a??!1,onChange:o,caller:Yw});return(0,W.jsx)(YCe,{scope:t,triggerId:oC(),triggerRef:l,contentId:oC(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,W.jsx)(jCe,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ZCe.displayName=Yw;var QCe=`DropdownMenuTrigger`,$Ce=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=XCe(QCe,n),o=Xw(n);return(0,W.jsx)(MCe,{asChild:!0,...o,children:(0,W.jsx)(Tp.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:dp(t,a.triggerRef),onPointerDown:up(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:up(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});$Ce.displayName=QCe;var ewe=`DropdownMenuPortal`,twe=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Xw(t);return(0,W.jsx)(NCe,{...r,...n})};twe.displayName=ewe;var nwe=`DropdownMenuContent`,rwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=XCe(nwe,n),a=Xw(n),o=g.useRef(!1);return(0,W.jsx)(PCe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:up(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:up(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});rwe.displayName=nwe;var iwe=`DropdownMenuGroup`,awe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(FCe,{...i,...r,ref:t})});awe.displayName=iwe;var owe=`DropdownMenuLabel`,swe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(ICe,{...i,...r,ref:t})});swe.displayName=owe;var cwe=`DropdownMenuItem`,lwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(LCe,{...i,...r,ref:t})});lwe.displayName=cwe;var uwe=`DropdownMenuCheckboxItem`,dwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(RCe,{...i,...r,ref:t})});dwe.displayName=uwe;var fwe=`DropdownMenuRadioGroup`,pwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(zCe,{...i,...r,ref:t})});pwe.displayName=fwe;var mwe=`DropdownMenuRadioItem`,hwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(BCe,{...i,...r,ref:t})});hwe.displayName=mwe;var gwe=`DropdownMenuItemIndicator`,_we=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(VCe,{...i,...r,ref:t})});_we.displayName=gwe;var vwe=`DropdownMenuSeparator`,ywe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(HCe,{...i,...r,ref:t})});ywe.displayName=vwe;var bwe=`DropdownMenuArrow`,xwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(UCe,{...i,...r,ref:t})});xwe.displayName=bwe;var Swe=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Xw(t),[s,c]=Ap({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,W.jsx)(WCe,{...o,open:s,onOpenChange:c,children:n})},Cwe=`DropdownMenuSubTrigger`,wwe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(GCe,{...i,...r,ref:t})});wwe.displayName=Cwe;var Twe=`DropdownMenuSubContent`,Ewe=g.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Xw(n);return(0,W.jsx)(KCe,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ewe.displayName=Twe;var Dwe=ZCe,Owe=$Ce,kwe=twe,Awe=rwe,jwe=awe,Mwe=swe,Nwe=lwe,Pwe=dwe,Fwe=_we,Iwe=ywe,Lwe=Swe,Rwe=wwe,zwe=Ewe;function Zw({...e}){return(0,W.jsx)(Dwe,{"data-slot":`dropdown-menu`,...e})}function Qw({...e}){return(0,W.jsx)(Owe,{"data-slot":`dropdown-menu-trigger`,...e})}function $w({className:e,sideOffset:t=4,...n}){return(0,W.jsx)(kwe,{children:(0,W.jsx)(Awe,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:G(`bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e),...n})})}function Bwe({...e}){return(0,W.jsx)(jwe,{"data-slot":`dropdown-menu-group`,...e})}function eT({className:e,inset:t,variant:n=`default`,...r}){return(0,W.jsx)(Nwe,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:G(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function Vwe({className:e,children:t,checked:n,...r}){return(0,W.jsxs)(Pwe,{"data-slot":`dropdown-menu-checkbox-item`,className:G(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,W.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,W.jsx)(Fwe,{children:(0,W.jsx)(mm,{className:`size-4`})})}),t]})}function tT({className:e,inset:t,...n}){return(0,W.jsx)(Mwe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:G(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function nT({className:e,...t}){return(0,W.jsx)(Iwe,{"data-slot":`dropdown-menu-separator`,className:G(`bg-border -mx-1 my-1 h-px`,e),...t})}function Hwe({...e}){return(0,W.jsx)(Lwe,{"data-slot":`dropdown-menu-sub`,...e})}function Uwe({className:e,inset:t,children:n,...r}){return(0,W.jsxs)(Rwe,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:G(`focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,W.jsx)(gm,{className:`ml-auto size-4`})]})}function Wwe({className:e,...t}){return(0,W.jsx)(zwe,{"data-slot":`dropdown-menu-sub-content`,className:G(`bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg`,e),...t})}var Gwe=sm(``,{variants:{variant:{default:`cursor-pointer text-indigo-600 dark:text-indigo-300 hover:underline`,neutral:`cursor-pointer hover:underline`,ghost:`cursor-pointer hover:no-underline`},showIcon:{true:`inline-flex items-center gap-x-1`}},defaultVariants:{variant:`default`}}),rT=({className:e,variant:t,showIcon:n,children:r,...i})=>(0,W.jsxs)(`a`,{target:`_blank`,rel:`noreferrer`,className:G(Gwe({variant:t,showIcon:n,className:e})),...i,children:[r,n&&(0,W.jsx)(Am,{className:`size-[1em]`})]}),Kwe=(0,g.createContext)({});function qwe(e){let t=(0,g.useRef)(null);return t.current===null&&(t.current=e()),t.current}var iT=(0,g.createContext)(null),Jwe=(0,g.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Ywe(e=!0){let t=(0,g.useContext)(iT);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,g.useId)();(0,g.useEffect)(()=>{e&&i(a)},[e]);let o=(0,g.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var aT=typeof window<`u`,Xwe=aT?g.useLayoutEffect:g.useEffect,oT=e=>e,sT=oT,cT=oT,lT={skipAnimations:!1,useManualTiming:!1};function Zwe(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.has(e)||s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var uT=[`read`,`resolveKeyframes`,`update`,`preRender`,`render`,`postRender`],Qwe=40;function $we(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=uT.reduce((e,t)=>(e[t]=Zwe(a),e),{}),{read:s,resolveKeyframes:c,update:l,preRender:u,render:d,postRender:f}=o,p=()=>{let a=lT.useManualTiming?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,Qwe),1),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,i.isProcessing||e(p)};return{schedule:uT.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||m(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<uT.length;t++)o[uT[t]].cancel(e)},state:i,steps:o}}var{schedule:dT,cancel:fT,state:pT,steps:mT}=$we(typeof requestAnimationFrame<`u`?requestAnimationFrame:oT,!0),eTe=(0,g.createContext)({strict:!1}),tTe={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},hT={};for(let e in tTe)hT[e]={isEnabled:t=>tTe[e].some(e=>!!t[e])};function nTe(e){for(let t in e)hT[t]={...hT[t],...e[t]}}var rTe=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function gT(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||rTe.has(e)}function iTe(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var aTe=n((()=>{})),oTe=r({default:()=>cTe}),sTe,cTe,lTe=n((()=>{aTe(),sTe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,cTe=iTe(function(e){return sTe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),uTe=e=>!gT(e);function dTe(e){e&&(uTe=t=>t.startsWith(`on`)?!gT(t):e(t))}try{dTe((lTe(),t(oTe)).default)}catch{}function fTe(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(uTe(i)||n===!0&&gT(i)||!t&&!gT(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}function pTe(e){if(typeof Proxy>`u`)return e;let t=new Map;return new Proxy((...t)=>e(...t),{get:(n,r)=>r===`create`?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}var _T=(0,g.createContext)({});function vT(e){return typeof e==`string`||Array.isArray(e)}function yT(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}var bT=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],xT=[`initial`,...bT];function ST(e){return yT(e.animate)||xT.some(t=>vT(e[t]))}function mTe(e){return!!(ST(e)||e.variants)}function hTe(e,t){if(ST(e)){let{initial:t,animate:n}=e;return{initial:t===!1||vT(t)?t:void 0,animate:vT(n)?n:void 0}}return e.inherit===!1?{}:t}function gTe(e){let{initial:t,animate:n}=hTe(e,(0,g.useContext)(_T));return(0,g.useMemo)(()=>({initial:t,animate:n}),[_Te(t),_Te(n)])}function _Te(e){return Array.isArray(e)?e.join(` `):e}var vTe=Symbol.for(`motionComponentSymbol`);function CT(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function yTe(e,t,n){return(0,g.useCallback)(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n==`function`?n(r):CT(n)&&(n.current=r))},[t])}var wT=e=>e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase(),bTe=`data-`+wT(`framerAppearId`),{schedule:TT,cancel:xTe}=$we(queueMicrotask,!1),STe=(0,g.createContext)({});function CTe(e,t,n,r,i){let{visualElement:a}=(0,g.useContext)(_T),o=(0,g.useContext)(eTe),s=(0,g.useContext)(iT),c=(0,g.useContext)(Jwe).reducedMotion,l=(0,g.useRef)(null);r||=o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:a,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:c}));let u=l.current,d=(0,g.useContext)(STe);u&&!u.projection&&i&&(u.type===`html`||u.type===`svg`)&&wTe(l.current,n,i,d);let f=(0,g.useRef)(!1);(0,g.useInsertionEffect)(()=>{u&&f.current&&u.update(n,s)});let p=n[bTe],m=(0,g.useRef)(!!p&&!window.MotionHandoffIsComplete?.call(window,p)&&window.MotionHasOptimisedAnimation?.call(window,p));return Xwe(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),TT.render(u.render),m.current&&u.animationState&&u.animationState.animateChanges())}),(0,g.useEffect)(()=>{u&&(!m.current&&u.animationState&&u.animationState.animateChanges(),m.current&&=(queueMicrotask(()=>{var e;(e=window.MotionHandoffMarkAsComplete)==null||e.call(window,p)}),!1))}),u}function wTe(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:TTe(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&CT(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}function TTe(e){if(e)return e.options.allowProjection===!1?TTe(e.parent):e.projection}function ETe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&nTe(e);function a(a,o){let s,c={...(0,g.useContext)(Jwe),...a,layoutId:DTe(a)},{isStatic:l}=c,u=gTe(a),d=r(a,l);if(!l&&aT){OTe(c,e);let n=kTe(c);s=n.MeasureLayout,u.visualElement=CTe(i,d,c,t,n.ProjectionNode)}return(0,W.jsxs)(_T.Provider,{value:u,children:[s&&u.visualElement?(0,W.jsx)(s,{visualElement:u.visualElement,...c}):null,n(i,a,yTe(d,u.visualElement,o),d,l,u.visualElement)]})}a.displayName=`motion.${typeof i==`string`?i:`create(${i.displayName??i.name??``})`}`;let o=(0,g.forwardRef)(a);return o[vTe]=i,o}function DTe({layoutId:e}){let t=(0,g.useContext)(Kwe).id;return t&&e!==void 0?t+`-`+e:e}function OTe(e,t){(0,g.useContext)(eTe).strict}function kTe(e){let{drag:t,layout:n}=hT;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}var ATe=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function ET(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(ATe.indexOf(e)>-1||/[A-Z]/u.test(e))}function jTe(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function DT(e,t,n,r){if(typeof t==`function`){let[i,a]=jTe(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=jTe(r);t=t(n===void 0?e.custom:n,i,a)}return t}var OT=e=>Array.isArray(e),MTe=e=>!!(e&&typeof e==`object`&&e.mix&&e.toValue),NTe=e=>OT(e)?e[e.length-1]||0:e,kT=e=>!!(e&&e.getVelocity);function AT(e){let t=kT(e)?e.get():e;return MTe(t)?t.toValue():t}function PTe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,a){let o={latestValues:ITe(r,i,a,e),renderState:t()};return n&&(o.onMount=e=>n({props:r,current:e,...o}),o.onUpdate=e=>n(e)),o}var FTe=e=>(t,n)=>{let r=(0,g.useContext)(_T),i=(0,g.useContext)(iT),a=()=>PTe(e,t,r,i);return n?a():qwe(a)};function ITe(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=AT(a[e]);let{initial:o,animate:s}=e,c=ST(e),l=mTe(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!yT(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=DT(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var jT=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],MT=new Set(jT),LTe=e=>t=>typeof t==`string`&&t.startsWith(e),RTe=LTe(`--`),zTe=LTe(`var(--`),NT=e=>zTe(e)?BTe.test(e.split(`/*`)[0].trim()):!1,BTe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,VTe=(e,t)=>t&&typeof e==`number`?t.transform(e):e,PT=(e,t,n)=>n>t?t:n<e?e:n,FT={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},IT={...FT,transform:e=>PT(0,1,e)},LT={...FT,default:1},RT=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),zT=RT(`deg`),BT=RT(`%`),VT=RT(`px`),HTe=RT(`vh`),UTe=RT(`vw`),WTe={...BT,parse:e=>BT.parse(e)/100,transform:e=>BT.transform(e*100)},GTe={borderWidth:VT,borderTopWidth:VT,borderRightWidth:VT,borderBottomWidth:VT,borderLeftWidth:VT,borderRadius:VT,radius:VT,borderTopLeftRadius:VT,borderTopRightRadius:VT,borderBottomRightRadius:VT,borderBottomLeftRadius:VT,width:VT,maxWidth:VT,height:VT,maxHeight:VT,top:VT,right:VT,bottom:VT,left:VT,padding:VT,paddingTop:VT,paddingRight:VT,paddingBottom:VT,paddingLeft:VT,margin:VT,marginTop:VT,marginRight:VT,marginBottom:VT,marginLeft:VT,backgroundPositionX:VT,backgroundPositionY:VT},KTe={rotate:zT,rotateX:zT,rotateY:zT,rotateZ:zT,scale:LT,scaleX:LT,scaleY:LT,scaleZ:LT,skew:zT,skewX:zT,skewY:zT,distance:VT,translateX:VT,translateY:VT,translateZ:VT,x:VT,y:VT,z:VT,perspective:VT,transformPerspective:VT,opacity:IT,originX:WTe,originY:WTe,originZ:VT},qTe={...FT,transform:Math.round},HT={...GTe,...KTe,zIndex:qTe,size:VT,fillOpacity:IT,strokeOpacity:IT,numOctaves:qTe},JTe={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},YTe=jT.length;function XTe(e,t,n){let r=``,i=!0;for(let a=0;a<YTe;a++){let o=jT[a],s=e[o];if(s===void 0)continue;let c=!0;if(c=typeof s==`number`?s===(o.startsWith(`scale`)?1:0):parseFloat(s)===0,!c||n){let e=VTe(s,HT[o]);if(!c){i=!1;let t=JTe[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function UT(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(MT.has(e)){o=!0;continue}else if(RTe(e)){i[e]=n;continue}else{let t=VTe(n,HT[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=XTe(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var ZTe={offset:`stroke-dashoffset`,array:`stroke-dasharray`},QTe={offset:`strokeDashoffset`,array:`strokeDasharray`};function $Te(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?ZTe:QTe;e[a.offset]=VT.transform(-r);let o=VT.transform(t),s=VT.transform(n);e[a.array]=`${o} ${s}`}function eEe(e,t,n){return typeof e==`string`?e:VT.transform(t+n*e)}function tEe(e,t,n){return`${eEe(t,e.x,e.width)} ${eEe(n,e.y,e.height)}`}function WT(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:a,pathLength:o,pathSpacing:s=1,pathOffset:c=0,...l},u,d){if(UT(e,l,d),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:f,style:p,dimensions:m}=e;f.transform&&(m&&(p.transform=f.transform),delete f.transform),m&&(i!==void 0||a!==void 0||p.transform)&&(p.transformOrigin=tEe(m,i===void 0?.5:i,a===void 0?.5:a)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),o!==void 0&&$Te(f,o,s,c,!1)}var GT=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),nEe=()=>({...GT(),attrs:{}}),KT=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function rEe(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(let t in n)e.style.setProperty(t,n[t])}var iEe=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function aEe(e,t,n,r){rEe(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(iEe.has(n)?n:wT(n),t.attrs[n])}var qT={};function oEe(e){Object.assign(qT,e)}function sEe(e,{layout:t,layoutId:n}){return MT.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!qT[e]||e===`opacity`)}function JT(e,t,n){let{style:r}=e,i={};for(let a in r)(kT(r[a])||t.style&&kT(t.style[a])||sEe(a,e)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}function cEe(e,t,n){let r=JT(e,t,n);for(let n in e)if(kT(e[n])||kT(t[n])){let t=jT.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}function lEe(e,t){try{t.dimensions=typeof e.getBBox==`function`?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}var uEe=[`x`,`y`,`width`,`height`,`cx`,`cy`,`r`],dEe={useVisualState:FTe({scrapeMotionValuesFromProps:cEe,createRenderState:nEe,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let a=!!e.drag;if(!a){for(let e in i)if(MT.has(e)){a=!0;break}}if(!a)return;let o=!t;if(t)for(let n=0;n<uEe.length;n++){let r=uEe[n];e[r]!==t[r]&&(o=!0)}o&&dT.read(()=>{lEe(n,r),dT.render(()=>{WT(r,i,KT(n.tagName),e.transformTemplate),aEe(n,r)})})}})},fEe={useVisualState:FTe({scrapeMotionValuesFromProps:JT,createRenderState:GT})};function pEe(e,t,n){for(let r in t)!kT(t[r])&&!sEe(r,n)&&(e[r]=t[r])}function mEe({transformTemplate:e},t){return(0,g.useMemo)(()=>{let n=GT();return UT(n,t,e),Object.assign({},n.vars,n.style)},[t])}function hEe(e,t){let n=e.style||{},r={};return pEe(r,n,e),Object.assign(r,mEe(e,t)),r}function gEe(e,t){let n={},r=hEe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function _Ee(e,t,n,r){let i=(0,g.useMemo)(()=>{let n=nEe();return WT(n,t,KT(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};pEe(t,e.style,e),i.style={...t,...i.style}}return i}function vEe(e=!1){return(t,n,r,{latestValues:i},a)=>{let o=(ET(t)?_Ee:gEe)(n,i,a,t),s=fTe(n,typeof t==`string`,e),c=t===g.Fragment?{}:{...s,...o,ref:r},{children:l}=n,u=(0,g.useMemo)(()=>kT(l)?l.get():l,[l]);return(0,g.createElement)(t,{...c,children:u})}}function yEe(e,t){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return ETe({...ET(n)?dEe:fEe,preloadedFeatures:e,useRender:vEe(r),createVisualElement:t,Component:n})}}function bEe(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function YT(e,t,n){let r=e.getProps();return DT(r,t,n===void 0?r.custom:n,e)}function XT(e,t){return e?e[t]||e.default||e:void 0}var xEe=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...jT]),ZT;function SEe(){ZT=void 0}var QT={now:()=>(ZT===void 0&&QT.set(pT.isProcessing||lT.useManualTiming?pT.timestamp:performance.now()),ZT),set:e=>{ZT=e,queueMicrotask(SEe)}};function $T(e,t){e.indexOf(t)===-1&&e.push(t)}function eE(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var tE=class{constructor(){this.subscriptions=[]}add(e){return $T(this.subscriptions,e),()=>eE(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};function CEe(e,t){return t?1e3/t*e:0}var wEe=30,TEe=e=>!isNaN(parseFloat(e)),EEe={current:void 0},DEe=class{constructor(e,t={}){this.version=`11.18.2`,this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{let n=QT.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=QT.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TEe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new tE);let n=this.events[e].add(t);return e===`change`?()=>{n(),dT.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return EEe.current&&EEe.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=QT.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>wEe)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,wEe);return CEe(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function nE(e,t){return new DEe(e,t)}function OEe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,nE(n))}function kEe(e,t){let{transitionEnd:n={},transition:r={},...i}=YT(e,t)||{};i={...i,...n};for(let t in i)OEe(e,t,NTe(i[t]))}function AEe(e){return!!(kT(e)&&e.add)}function rE(e,t){let n=e.getValue(`willChange`);if(AEe(n))return n.add(t)}function jEe(e){return e.props[bTe]}function iE(e){let t;return()=>(t===void 0&&(t=e()),t)}var MEe=iE(()=>window.ScrollTimeline!==void 0),NEe=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>`finished`in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e,t){let n=this.animations.map(n=>{if(MEe()&&n.attachTimeline)return n.attachTimeline(e);if(typeof t==`function`)return t(n)});return()=>{n.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get startTime(){return this.getAll(`startTime`)}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll(`flatten`)}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}},PEe=class extends NEe{then(e,t){return Promise.all(this.animations).then(e).catch(t)}},aE=e=>e*1e3,oE=e=>e/1e3,FEe={current:!1};function sE(e){return typeof e==`function`}function IEe(e,t){e.timeline=t,e.onfinish=null}var cE=e=>Array.isArray(e)&&typeof e[0]==`number`,LEe={linearEasing:void 0};function REe(e,t){let n=iE(e);return()=>LEe[t]??n()}var lE=REe(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),uE=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},zEe=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=e(uE(0,i-1,t))+`, `;return`linear(${r.substring(0,r.length-2)})`};function BEe(e){return!!(typeof e==`function`&&lE()||!e||typeof e==`string`&&(e in fE||lE())||cE(e)||Array.isArray(e)&&e.every(BEe))}var dE=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,fE={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:dE([0,.65,.55,1]),circOut:dE([.55,0,1,.45]),backIn:dE([.31,.01,.66,-.59]),backOut:dE([.33,1.53,.69,.99])};function VEe(e,t){if(e)return typeof e==`function`&&lE()?zEe(e,t):cE(e)?dE(e):Array.isArray(e)?e.map(e=>VEe(e,t)||fE.easeOut):fE[e]}var HEe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,UEe=1e-7,WEe=12;function GEe(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=HEe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>UEe&&++s<WEe);return o}function pE(e,t,n,r){if(e===t&&n===r)return oT;let i=t=>GEe(t,0,1,e,n);return e=>e===0||e===1?e:HEe(i(e),t,r)}var KEe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,qEe=e=>t=>1-e(1-t),JEe=pE(.33,1.53,.69,.99),mE=qEe(JEe),YEe=KEe(mE),XEe=e=>(e*=2)<1?.5*mE(e):.5*(2-2**(-10*(e-1))),hE=e=>1-Math.sin(Math.acos(e)),ZEe=qEe(hE),QEe=KEe(hE),$Ee=e=>/^0[^.\s]+$/u.test(e);function eDe(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||$Ee(e)}var gE=e=>Math.round(e*1e5)/1e5,_E=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tDe(e){return e==null}var nDe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vE=(e,t)=>n=>!!(typeof n==`string`&&nDe.test(n)&&n.startsWith(e)||t&&!tDe(n)&&Object.prototype.hasOwnProperty.call(n,t)),rDe=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(_E);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},iDe=e=>PT(0,255,e),yE={...FT,transform:e=>Math.round(iDe(e))},bE={test:vE(`rgb`,`red`),parse:rDe(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+yE.transform(e)+`, `+yE.transform(t)+`, `+yE.transform(n)+`, `+gE(IT.transform(r))+`)`};function aDe(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var xE={test:vE(`#`),parse:aDe,transform:bE.transform},SE={test:vE(`hsl`,`hue`),parse:rDe(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+BT.transform(gE(t))+`, `+BT.transform(gE(n))+`, `+gE(IT.transform(r))+`)`},CE={test:e=>bE.test(e)||xE.test(e)||SE.test(e),parse:e=>bE.test(e)?bE.parse(e):SE.test(e)?SE.parse(e):xE.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?bE.transform(e):SE.transform(e)},oDe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function sDe(e){return isNaN(e)&&typeof e==`string`&&(e.match(_E)?.length||0)+(e.match(oDe)?.length||0)>0}var cDe=`number`,lDe=`color`,uDe=`var`,dDe=`var(`,fDe="${}",pDe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wE(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(pDe,e=>(CE.test(e)?(r.color.push(a),i.push(lDe),n.push(CE.parse(e))):e.startsWith(dDe)?(r.var.push(a),i.push(uDe),n.push(e)):(r.number.push(a),i.push(cDe),n.push(parseFloat(e))),++a,fDe)).split(fDe),indexes:r,types:i}}function mDe(e){return wE(e).values}function hDe(e){let{split:t,types:n}=wE(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===cDe?i+=gE(e[a]):t===lDe?i+=CE.transform(e[a]):i+=e[a]}return i}}var gDe=e=>typeof e==`number`?0:e;function _De(e){let t=mDe(e);return hDe(e)(t.map(gDe))}var TE={test:sDe,parse:mDe,createTransformer:hDe,getAnimatableNone:_De},vDe=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function yDe(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(_E)||[];if(!r)return e;let i=n.replace(r,``),a=vDe.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var bDe=/\b([a-z-]*)\(.*?\)/gu,EE={...TE,getAnimatableNone:e=>{let t=e.match(bDe);return t?t.map(yDe).join(` `):e}},xDe={...HT,color:CE,backgroundColor:CE,outlineColor:CE,fill:CE,stroke:CE,borderColor:CE,borderTopColor:CE,borderRightColor:CE,borderBottomColor:CE,borderLeftColor:CE,filter:EE,WebkitFilter:EE},DE=e=>xDe[e];function SDe(e,t){let n=DE(e);return n!==EE&&(n=TE),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var CDe=new Set([`auto`,`none`,`0`]);function wDe(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!CDe.has(t)&&wE(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=SDe(n,i)}var TDe=e=>e===FT||e===VT,EDe=(e,t)=>parseFloat(e.split(`, `)[t]),DDe=(e,t)=>(n,{transform:r})=>{if(r===`none`||!r)return 0;let i=r.match(/^matrix3d\((.+)\)$/u);if(i)return EDe(i[1],t);{let t=r.match(/^matrix\((.+)\)$/u);return t?EDe(t[1],e):0}},ODe=new Set([`x`,`y`,`z`]),kDe=jT.filter(e=>!ODe.has(e));function ADe(e){let t=[];return kDe.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var OE={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:DDe(4,13),y:DDe(5,14)};OE.translateX=OE.x,OE.translateY=OE.y;var kE=new Set,AE=!1,jE=!1;function jDe(){if(jE){let e=Array.from(kE).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ADe(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{var r;(r=e.getValue(t))==null||r.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}jE=!1,AE=!1,kE.forEach(e=>e.complete()),kE.clear()}function MDe(){kE.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(jE=!0)})}function NDe(){MDe(),jDe()}var ME=class{constructor(e,t,n,r,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(kE.add(this),AE||(AE=!0,dT.read(MDe),dT.resolveKeyframes(jDe))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),kE.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,kE.delete(this))}resume(){this.isComplete||this.scheduleResolve()}},PDe=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),FDe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function IDe(e){let t=FDe.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var LDe=4;function RDe(e,t,n=1){cT(n<=LDe,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[r,i]=IDe(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return PDe(e)?parseFloat(e):e}return NT(i)?RDe(i,t,n+1):i}var zDe=e=>t=>t.test(e),BDe=[FT,VT,BT,zT,UTe,HTe,{test:e=>e===`auto`,parse:e=>e}],VDe=e=>BDe.find(zDe(e)),HDe=class extends ME{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),NT(r))){let i=RDe(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!xEe.has(n)||e.length!==2)return;let[r,i]=e,a=VDe(r),o=VDe(i);if(a!==o)if(TDe(a)&&TDe(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)eDe(e[t])&&n.push(t);n.length&&wDe(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=OE[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=OE[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},UDe=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(TE.test(e)||e===`0`)&&!e.startsWith(`url(`));function WDe(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function GDe(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=UDe(i,t),s=UDe(a,t);return sT(o===s,`You are trying to animate ${t} from "${i}" to "${a}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${a} via the \`style\` property.`),!o||!s?!1:WDe(e)||(n===`spring`||sE(n))&&r}var KDe=e=>e!==null;function NE(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(KDe),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}var qDe=40,JDe=class{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=QT.now(),this.options={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>qDe?this.resolvedAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&NDe(),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=QT.now(),this.hasAttemptedResolve=!0;let{name:n,type:r,velocity:i,delay:a,onComplete:o,onUpdate:s,isGenerator:c}=this.options;if(!c&&!GDe(e,n,r,i))if(FEe.current||!a){s&&s(NE(e,this.options,t)),o&&o(),this.resolveFinishedPromise();return}else this.options.duration=0;let l=this.initPlayback(e,t);l!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...l},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type=`keyframes`,this.options.ease=`linear`}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}},YDe=2e4;function XDe(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}var PE=(e,t,n)=>e+(t-e)*n;function FE(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function ZDe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=FE(s,r,e+1/3),a=FE(s,r,e),o=FE(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function IE(e,t){return n=>n>0?t:e}var LE=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},QDe=[xE,bE,SE],$De=e=>QDe.find(t=>t.test(e));function eOe(e){let t=$De(e);if(sT(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let n=t.parse(e);return t===SE&&(n=ZDe(n)),n}var tOe=(e,t)=>{let n=eOe(e),r=eOe(t);if(!n||!r)return IE(e,t);let i={...n};return e=>(i.red=LE(n.red,r.red,e),i.green=LE(n.green,r.green,e),i.blue=LE(n.blue,r.blue,e),i.alpha=PE(n.alpha,r.alpha,e),bE.transform(i))},nOe=(e,t)=>n=>t(e(n)),RE=(...e)=>e.reduce(nOe),zE=new Set([`none`,`hidden`]);function rOe(e,t){return zE.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function iOe(e,t){return n=>PE(e,t,n)}function BE(e){return typeof e==`number`?iOe:typeof e==`string`?NT(e)?IE:CE.test(e)?tOe:cOe:Array.isArray(e)?aOe:typeof e==`object`?CE.test(e)?tOe:oOe:IE}function aOe(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>BE(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function oOe(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=BE(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function sOe(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var cOe=(e,t)=>{let n=TE.createTransformer(t),r=wE(e),i=wE(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?zE.has(e)&&!i.values.length||zE.has(t)&&!r.values.length?rOe(e,t):RE(aOe(sOe(r,i),i.values),n):(sT(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),IE(e,t))};function lOe(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?PE(e,t,n):BE(e)(e,t)}var uOe=5;function dOe(e,t,n){let r=Math.max(t-uOe,0);return CEe(n-e(r),t-r)}var VE={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},HE=.001;function fOe({duration:e=VE.duration,bounce:t=VE.bounce,velocity:n=VE.velocity,mass:r=VE.mass}){let i,a;sT(e<=aE(VE.maxDuration),`Spring duration must be 10 seconds or less`);let o=1-t;o=PT(VE.minDamping,VE.maxDamping,o),e=PT(VE.minDuration,VE.maxDuration,oE(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=UE(t,o),c=Math.exp(-i);return HE-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=UE(t**2,o);return(-i(t)+HE>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-HE+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=mOe(i,a,s);if(e=aE(e),isNaN(c))return{stiffness:VE.stiffness,damping:VE.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var pOe=12;function mOe(e,t,n){let r=n;for(let n=1;n<pOe;n++)r-=e(r)/t(r);return r}function UE(e,t){return e*Math.sqrt(1-t*t)}var hOe=[`duration`,`bounce`],gOe=[`stiffness`,`damping`,`mass`];function _Oe(e,t){return t.some(t=>e[t]!==void 0)}function vOe(e){let t={velocity:VE.velocity,stiffness:VE.stiffness,damping:VE.damping,mass:VE.mass,isResolvedFromDuration:!1,...e};if(!_Oe(e,gOe)&&_Oe(e,hOe))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*PT(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:VE.mass,stiffness:i,damping:a}}else{let n=fOe(e);t={...t,...n,mass:VE.mass},t.isResolvedFromDuration=!0}return t}function yOe(e=VE.visualDuration,t=VE.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=vOe({...n,velocity:-oE(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=oE(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?VE.restSpeed.granular:VE.restSpeed.default,i||=v?VE.restDelta.granular:VE.restDelta.default;let y;if(h<1){let e=UE(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=0;h<1&&(n=e===0?aE(m):dOe(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(XDe(b),YDe),t=zEe(t=>b.next(e*t).value,e,30);return e+`ms `+t}};return b}function bOe({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=yOe({keyframes:[f.value,m(f.value)],velocity:dOe(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}var xOe=pE(.42,0,1,1),SOe=pE(0,0,.58,1),COe=pE(.42,0,.58,1),wOe=e=>Array.isArray(e)&&typeof e[0]!=`number`,TOe={linear:oT,easeIn:xOe,easeInOut:COe,easeOut:SOe,circIn:hE,circInOut:QEe,circOut:ZEe,backIn:mE,backInOut:YEe,backOut:JEe,anticipate:XEe},EOe=e=>{if(cE(e)){cT(e.length===4,`Cubic bezier arrays must contain four numerical values.`);let[t,n,r,i]=e;return pE(t,n,r,i)}else if(typeof e==`string`)return cT(TOe[e]!==void 0,`Invalid easing type '${e}'`),TOe[e];return e};function DOe(e,t,n){let r=[],i=n||lOe,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=RE(Array.isArray(t)?t[n]||oT:t,a)),r.push(a)}return r}function OOe(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(cT(a===t.length,`Both input and output ranges must be the same length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=DOe(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=uE(e[r],e[r+1],n);return s[r](i)};return n?t=>l(PT(e[0],e[a-1],t)):l}function kOe(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=uE(0,t,r);e.push(PE(n,1,i))}}function AOe(e){let t=[0];return kOe(t,e.length-1),t}function jOe(e,t){return e.map(e=>e*t)}function MOe(e,t){return e.map(()=>t||COe).splice(0,e.length-1)}function WE({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=wOe(r)?r.map(EOe):EOe(r),a={done:!1,value:t[0]},o=OOe(jOe(n&&n.length===t.length?n:AOe(t),e),t,{ease:Array.isArray(i)?i:MOe(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var NOe=e=>{let t=({timestamp:t})=>e(t);return{start:()=>dT.update(t,!0),stop:()=>fT(t),now:()=>pT.isProcessing?pT.timestamp:QT.now()}},POe={decay:bOe,inertia:bOe,tween:WE,keyframes:WE,spring:yOe},FOe=e=>e/100,GE=class extends JDe{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState=`running`,this.startTime=null,this.state=`idle`,this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state===`idle`)return;this.teardown();let{onStop:e}=this.options;e&&e()};let{name:t,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new(r?.KeyframeResolver||ME)(i,(e,t)=>this.onKeyframesResolved(e,t),t,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){let{type:t=`keyframes`,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=this.options,o=sE(t)?t:POe[t]||WE,s,c;o!==WE&&typeof e[0]!=`number`&&(s=RE(FOe,lOe(e[0],e[1])),e=[0,100]);let l=o({...this.options,keyframes:e});i===`mirror`&&(c=o({...this.options,keyframes:[...e].reverse(),velocity:-a})),l.calculatedDuration===null&&(l.calculatedDuration=XDe(l));let{calculatedDuration:u}=l,d=u+r,f=d*(n+1)-r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:s,calculatedDuration:u,resolvedDuration:d,totalDuration:f}}onPostResolved(){let{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState===`paused`||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){let{resolved:n}=this;if(!n){let{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}let{finalKeyframe:r,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:s,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(this.startTime===null)return i.next(0);let{delay:d,repeat:f,repeatType:p,repeatDelay:m,onUpdate:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime===null?this.currentTime=Math.round(e-this.startTime)*this.speed:this.currentTime=this.holdTime;let g=this.currentTime-d*(this.speed>=0?1:-1),_=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=l);let v=this.currentTime,y=i;if(f){let e=Math.min(this.currentTime,l)/u,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,f+1),t%2&&(p===`reverse`?(n=1-n,m&&(n-=m/u)):p===`mirror`&&(y=a)),v=PT(0,1,n)*u}let b=_?{done:!1,value:s[0]}:y.next(v);o&&(b.value=o(b.value));let{done:x}=b;!_&&c!==null&&(x=this.speed>=0?this.currentTime>=l:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&r!==void 0&&(b.value=NE(s,this.options,r)),h&&h(b.value),S&&this.finish(),b}get duration(){let{resolved:e}=this;return e?oE(e.calculatedDuration):0}get time(){return oE(this.currentTime)}set time(e){e=aE(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=oE(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState=`running`;return}if(this.isStopped)return;let{driver:e=NOe,onPlay:t,startTime:n}=this.options;this.driver||=e(e=>this.tick(e)),t&&t();let r=this.driver.now();this.holdTime===null?this.startTime?this.state===`finished`&&(this.startTime=r):this.startTime=n??this.calcStartTime():this.startTime=r-this.holdTime,this.state===`finished`&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state=`running`,this.driver.start()}pause(){if(!this._resolved){this.pendingPlayState=`paused`;return}this.state=`paused`,this.holdTime=this.currentTime??0}complete(){this.state!==`running`&&this.play(),this.pendingPlayState=this.state=`finished`,this.holdTime=null}finish(){this.teardown(),this.state=`finished`;let{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state=`idle`,this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}},IOe=new Set([`opacity`,`clipPath`,`filter`,`transform`]);function LOe(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeInOut`,times:c}={}){let l={[t]:n};c&&(l.offset=c);let u=VEe(s,i);return Array.isArray(u)&&(l.easing=u),e.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?`linear`:u,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`})}var ROe=iE(()=>Object.hasOwnProperty.call(Element.prototype,`animate`)),KE=10,zOe=2e4;function BOe(e){return sE(e.type)||e.type===`spring`||!BEe(e.ease)}function VOe(e,t){let n=new GE({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},i=[],a=0;for(;!r.done&&a<zOe;)r=n.sample(a),i.push(r.value),a+=KE;return{times:void 0,keyframes:i,duration:a-KE,ease:`linear`}}var HOe={anticipate:XEe,backInOut:YEe,circInOut:QEe};function UOe(e){return e in HOe}var WOe=class extends JDe{constructor(e){super(e);let{name:t,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new HDe(i,(e,t)=>this.onKeyframesResolved(e,t),t,n,r),this.resolver.scheduleResolve()}initPlayback(e,t){let{duration:n=300,times:r,ease:i,type:a,motionValue:o,name:s,startTime:c}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i==`string`&&lE()&&UOe(i)&&(i=HOe[i]),BOe(this.options)){let{onComplete:t,onUpdate:o,motionValue:s,element:c,...l}=this.options,u=VOe(e,l);e=u.keyframes,e.length===1&&(e[1]=e[0]),n=u.duration,r=u.times,i=u.ease,a=`keyframes`}let l=LOe(o.owner.current,s,e,{...this.options,duration:n,times:r,ease:i});return l.startTime=c??this.calcStartTime(),this.pendingTimeline?(IEe(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{let{onComplete:n}=this.options;o.set(NE(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:n,times:r,type:a,ease:i,keyframes:e}}get duration(){let{resolved:e}=this;if(!e)return 0;let{duration:t}=e;return oE(t)}get time(){let{resolved:e}=this;if(!e)return 0;let{animation:t}=e;return oE(t.currentTime||0)}set time(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.currentTime=aE(e)}get speed(){let{resolved:e}=this;if(!e)return 1;let{animation:t}=e;return t.playbackRate}set speed(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.playbackRate=e}get state(){let{resolved:e}=this;if(!e)return`idle`;let{animation:t}=e;return t.playState}get startTime(){let{resolved:e}=this;if(!e)return null;let{animation:t}=e;return t.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{let{resolved:t}=this;if(!t)return oT;let{animation:n}=t;IEe(n,e)}return oT}play(){if(this.isStopped)return;let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.playState===`finished`&&this.updateFinishedPromise(),t.play()}pause(){let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state===`idle`)return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:e}=this;if(!e)return;let{animation:t,keyframes:n,duration:r,type:i,ease:a,times:o}=e;if(t.playState===`idle`||t.playState===`finished`)return;if(this.time){let{motionValue:e,onUpdate:t,onComplete:s,element:c,...l}=this.options,u=new GE({...l,keyframes:n,duration:r,type:i,ease:a,times:o,isGenerator:!0}),d=aE(this.time);e.setWithVelocity(u.sample(d-KE).value,u.sample(d).value,KE)}let{onStop:s}=this.options;s&&s(),this.cancel()}complete(){let{resolved:e}=this;e&&e.animation.finish()}cancel(){let{resolved:e}=this;e&&e.animation.cancel()}static supports(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return ROe()&&n&&IOe.has(n)&&!s&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}},GOe={type:`spring`,stiffness:500,damping:25,restSpeed:10},KOe=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),qOe={type:`keyframes`,duration:.8},JOe={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},YOe=(e,{keyframes:t})=>t.length>2?qOe:MT.has(e)?e.startsWith(`scale`)?KOe(t[1]):GOe:JOe;function XOe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var qE=(e,t,n,r={},i,a)=>o=>{let s=XT(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=aE(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};XOe(s)||(u={...u,...YOe(e,u)}),u.duration&&=aE(u.duration),u.repeatDelay&&=aE(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(d=!0)),(FEe.current||lT.skipAnimations)&&(d=!0,u.duration=0,u.delay=0),d&&!a&&t.get()!==void 0){let e=NE(u.keyframes,s);if(e!==void 0)return dT.update(()=>{u.onUpdate(e),u.onComplete()}),new PEe([])}return!a&&WOe.supports(u)?new WOe(u):new GE(u)};function ZOe({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function QOe(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=t;r&&(a=r);let c=[],l=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||l&&ZOe(l,t))continue;let o={delay:n,...XT(a||{},t)},u=!1;if(window.MotionHandoffAnimation){let n=jEe(e);if(n){let e=window.MotionHandoffAnimation(n,t,dT);e!==null&&(o.startTime=e,u=!0)}}rE(e,t),r.start(qE(t,r,i,e.shouldReduceMotion&&xEe.has(t)?{type:!1}:o,e,u));let d=r.animation;d&&c.push(d)}return o&&Promise.all(c).then(()=>{dT.update(()=>{o&&kEe(e,o)})}),c}function JE(e,t,n={}){let r=YT(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(QOe(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return $Oe(e,t,a+r,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function $Oe(e,t,n=0,r=0,i=1,a){let o=[],s=(e.variantChildren.size-1)*r,c=i===1?(e=0)=>e*r:(e=0)=>s-e*r;return Array.from(e.variantChildren).sort(eke).forEach((e,r)=>{e.notify(`AnimationStart`,t),o.push(JE(e,t,{...a,delay:n+c(r)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(o)}function eke(e,t){return e.sortNodePosition(t)}function tke(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>JE(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=JE(e,t,n);else{let i=typeof t==`function`?YT(e,t,n.custom):t;r=Promise.all(QOe(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var nke=xT.length;function rke(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&rke(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<nke;n++){let r=xT[n],i=e.props[r];(vT(i)||i===!1)&&(t[r]=i)}return t}var ike=[...bT].reverse(),ake=bT.length;function oke(e){return t=>Promise.all(t.map(({animation:t,options:n})=>tke(e,t,n)))}function ske(e){let t=oke(e),n=lke(),r=!0,i=t=>(n,r)=>{let i=YT(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function a(n){t=n(e)}function o(a){let{props:o}=e,s=rke(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<ake;t++){let f=ike[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=vT(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&r&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||yT(m)||typeof m==`boolean`)continue;let v=cke(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(i(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},T=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=OT(t)&&OT(n)?!bEe(t,n):t!==n,r?t==null?l.add(e):T(e):t!==void 0&&l.has(e)?T(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),r&&e.blockInitialAnimation&&(y=!1),y&&(!(_&&v)||b)&&c.push(...x.map(e=>({animation:e,options:{type:f}})))}if(l.size){let t={};l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,f?t(c):Promise.resolve()}function s(t,r){var i;if(n[t].isActive===r)return Promise.resolve();(i=e.variantChildren)==null||i.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let a=o(t);for(let e in n)n[e].protectedKeys={};return a}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=lke(),r=!0}}}function cke(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!bEe(t,e):!1}function YE(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function lke(){return{animate:YE(!0),whileInView:YE(),whileHover:YE(),whileTap:YE(),whileDrag:YE(),whileFocus:YE(),exit:YE()}}var XE=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},uke=class extends XE{constructor(e){super(e),e.animationState||=ske(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();yT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}},dke=0,fke={animation:{Feature:uke},exit:{Feature:class extends XE{constructor(){super(...arguments),this.id=dke++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>t(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},ZE={x:!1,y:!1};function pke(){return ZE.x||ZE.y}function mke(e){return e===`x`||e===`y`?ZE[e]?null:(ZE[e]=!0,()=>{ZE[e]=!1}):ZE.x||ZE.y?null:(ZE.x=ZE.y=!0,()=>{ZE.x=ZE.y=!1})}var QE=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function $E(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function eD(e){return{point:{x:e.pageX,y:e.pageY}}}var hke=e=>t=>QE(t)&&e(t,eD(t));function tD(e,t,n,r){return $E(e,t,hke(n),r)}var gke=(e,t)=>Math.abs(e-t);function _ke(e,t){let n=gke(e.x,t.x),r=gke(e.y,t.y);return Math.sqrt(n**2+r**2)}var vke=class{constructor(e,t,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=rD(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=_ke(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=pT;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=nD(t,this.transformPagePoint),dT.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=rD(e.type===`pointercancel`?this.lastMoveEventInfo:nD(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!QE(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.contextWindow=r||window;let a=nD(eD(e),this.transformPagePoint),{point:o}=a,{timestamp:s}=pT;this.history=[{...o,timestamp:s}];let{onSessionStart:c}=t;c&&c(e,rD(a,this.history)),this.removeListeners=RE(tD(this.contextWindow,`pointermove`,this.handlePointerMove),tD(this.contextWindow,`pointerup`,this.handlePointerUp),tD(this.contextWindow,`pointercancel`,this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),fT(this.updatePoint)}};function nD(e,t){return t?{point:t(e.point)}:e}function yke(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rD({point:e},t){return{point:e,delta:yke(e,xke(t)),offset:yke(e,bke(t)),velocity:Ske(t,.1)}}function bke(e){return e[0]}function xke(e){return e[e.length-1]}function Ske(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=xke(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>aE(t)));)n--;if(!r)return{x:0,y:0};let a=oE(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var Cke=1e-4,wke=1-Cke,Tke=1+Cke,Eke=.01,Dke=0-Eke,Oke=0+Eke;function iD(e){return e.max-e.min}function kke(e,t,n){return Math.abs(e-t)<=n}function Ake(e,t,n,r=.5){e.origin=r,e.originPoint=PE(t.min,t.max,e.origin),e.scale=iD(n)/iD(t),e.translate=PE(n.min,n.max,e.origin)-e.originPoint,(e.scale>=wke&&e.scale<=Tke||isNaN(e.scale))&&(e.scale=1),(e.translate>=Dke&&e.translate<=Oke||isNaN(e.translate))&&(e.translate=0)}function aD(e,t,n,r){Ake(e.x,t.x,n.x,r?r.originX:void 0),Ake(e.y,t.y,n.y,r?r.originY:void 0)}function jke(e,t,n){e.min=n.min+t.min,e.max=e.min+iD(t)}function Mke(e,t,n){jke(e.x,t.x,n.x),jke(e.y,t.y,n.y)}function Nke(e,t,n){e.min=t.min-n.min,e.max=e.min+iD(t)}function oD(e,t,n){Nke(e.x,t.x,n.x),Nke(e.y,t.y,n.y)}function Pke(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?PE(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?PE(n,e,r.max):Math.min(e,n)),e}function Fke(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Ike(e,{top:t,left:n,bottom:r,right:i}){return{x:Fke(e.x,n,i),y:Fke(e.y,t,r)}}function Lke(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Rke(e,t){return{x:Lke(e.x,t.x),y:Lke(e.y,t.y)}}function zke(e,t){let n=.5,r=iD(e),i=iD(t);return i>r?n=uE(t.min,t.max-r,e.min):r>i&&(n=uE(e.min,e.max-i,t.min)),PT(0,1,n)}function Bke(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var sD=.35;function Vke(e=sD){return e===!1?e=0:e===!0&&(e=sD),{x:Hke(e,`left`,`right`),y:Hke(e,`top`,`bottom`)}}function Hke(e,t,n){return{min:Uke(e,t),max:Uke(e,n)}}function Uke(e,t){return typeof e==`number`?e:e[t]||0}var Wke=()=>({translate:0,scale:1,origin:0,originPoint:0}),cD=()=>({x:Wke(),y:Wke()}),Gke=()=>({min:0,max:0}),lD=()=>({x:Gke(),y:Gke()});function uD(e){return[e(`x`),e(`y`)]}function Kke({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function qke({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Jke(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function dD(e){return e===void 0||e===1}function fD({scale:e,scaleX:t,scaleY:n}){return!dD(e)||!dD(t)||!dD(n)}function pD(e){return fD(e)||Yke(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Yke(e){return Xke(e.x)||Xke(e.y)}function Xke(e){return e&&e!==`0%`}function mD(e,t,n){return n+t*(e-n)}function Zke(e,t,n,r,i){return i!==void 0&&(e=mD(e,i,r)),mD(e,n,r)+t}function hD(e,t=0,n=1,r,i){e.min=Zke(e.min,t,n,r,i),e.max=Zke(e.max,t,n,r,i)}function Qke(e,{x:t,y:n}){hD(e.x,t.translate,t.scale,t.originPoint),hD(e.y,n.translate,n.scale,n.originPoint)}var $ke=.999999999999,eAe=1.0000000000001;function tAe(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&_D(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Qke(e,o)),r&&pD(a.latestValues)&&_D(e,a.latestValues))}t.x<eAe&&t.x>$ke&&(t.x=1),t.y<eAe&&t.y>$ke&&(t.y=1)}function gD(e,t){e.min+=t,e.max+=t}function nAe(e,t,n,r,i=.5){hD(e,t,n,PE(e.min,e.max,i),r)}function _D(e,t){nAe(e.x,t.x,t.scaleX,t.scale,t.originX),nAe(e.y,t.y,t.scaleY,t.scale,t.originY)}function rAe(e,t){return Kke(Jke(e.getBoundingClientRect(),t))}function iAe(e,t,n){let r=rAe(e,n),{scroll:i}=t;return i&&(gD(r.x,i.offset.x),gD(r.y,i.offset.y)),r}var aAe=({current:e})=>e?e.ownerDocument.defaultView:null,oAe=new WeakMap,sAe=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lD(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){let{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;let r=e=>{let{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(eD(e).point)},i=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=mke(n),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),uD(e=>{let t=this.getAxisMotionValue(e).get()||0;if(BT.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=iD(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&dT.postRender(()=>i(e,t)),rE(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},a=(e,t)=>{let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=cAe(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&a(e,t)},o=(e,t)=>this.stop(e,t),s=()=>uD(e=>this.getAnimationState(e)===`paused`&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new vke(e,{onSessionStart:r,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:aAe(this.visualElement)})}stop(e,t){let n=this.isDragging;if(this.cancel(),!n)return;let{velocity:r}=t;this.startAnimation(r);let{onDragEnd:i}=this.getProps();i&&dT.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!vD(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Pke(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&CT(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=Ike(n.layoutBox,e):this.constraints=!1,this.elastic=Vke(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&uD(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Bke(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!CT(e))return!1;let n=e.current;cT(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=iAe(n,r.root,this.visualElement.getTransformPagePoint()),a=Rke(r.layout.layoutBox,i);if(t){let e=t(qke(a));this.hasMutatedConstraints=!!e,e&&(a=Kke(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=uD(o=>{if(!vD(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return rE(this.visualElement,e),n.start(qE(e,n,0,t,this.visualElement,!1))}stopAnimation(){uD(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){uD(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){uD(t=>{let{drag:n}=this.getProps();if(!vD(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t];i.set(e[t]-PE(n,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!CT(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};uD(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=zke({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),uD(t=>{if(!vD(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(PE(i,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;oAe.set(this.visualElement,this);let e=this.visualElement.current,t=tD(e,`pointerdown`,e=>{let{drag:t,dragListener:n=!0}=this.getProps();t&&n&&this.start(e)}),n=()=>{let{dragConstraints:e}=this.getProps();CT(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,n);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),dT.read(n);let a=$E(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(uD(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=sD,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function vD(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function cAe(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var lAe=class extends XE{constructor(e){super(e),this.removeGroupControls=oT,this.removeListeners=oT,this.controls=new sAe(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||oT}unmount(){this.removeGroupControls(),this.removeListeners()}},uAe=e=>(t,n)=>{e&&dT.postRender(()=>e(t,n))},dAe=class extends XE{constructor(){super(...arguments),this.removePointerDownListener=oT}onPointerDown(e){this.session=new vke(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:aAe(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:uAe(e),onStart:uAe(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&dT.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=tD(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},yD={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function fAe(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var bD={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(VT.test(e))e=parseFloat(e);else return e;return`${fAe(e,t.target.x)}% ${fAe(e,t.target.y)}%`}},pAe={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=TE.parse(e);if(i.length>5)return r;let a=TE.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=PE(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},mAe=class extends g.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;oEe(gAe),i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),yD.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,a=n.projection;return a?(a.isPresent=i,r||e.layoutDependency!==t||t===void 0?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||dT.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),TT.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function hAe(e){let[t,n]=Ywe(),r=(0,g.useContext)(Kwe);return(0,W.jsx)(mAe,{...e,layoutGroup:r,switchLayoutGroup:(0,g.useContext)(STe),isPresent:t,safeToRemove:n})}var gAe={borderRadius:{...bD,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:bD,borderTopRightRadius:bD,borderBottomLeftRadius:bD,borderBottomRightRadius:bD,boxShadow:pAe};function _Ae(e,t,n){let r=kT(e)?e:nE(e);return r.start(qE(``,r,t,n)),r.animation}function vAe(e){return e instanceof SVGElement&&e.tagName!==`svg`}var yAe=(e,t)=>e.depth-t.depth,bAe=class{constructor(){this.children=[],this.isDirty=!1}add(e){$T(this.children,e),this.isDirty=!0}remove(e){eE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(yAe),this.isDirty=!1,this.children.forEach(e)}};function xAe(e,t){let n=QT.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(fT(r),e(a-t))};return dT.read(r,!0),()=>fT(r)}var SAe=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],CAe=SAe.length,wAe=e=>typeof e==`string`?parseFloat(e):e,TAe=e=>typeof e==`number`||VT.test(e);function EAe(e,t,n,r,i,a){i?(e.opacity=PE(0,n.opacity===void 0?1:n.opacity,OAe(r)),e.opacityExit=PE(t.opacity===void 0?1:t.opacity,0,kAe(r))):a&&(e.opacity=PE(t.opacity===void 0?1:t.opacity,n.opacity===void 0?1:n.opacity,r));for(let i=0;i<CAe;i++){let a=`border${SAe[i]}Radius`,o=DAe(t,a),s=DAe(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||TAe(o)===TAe(s)?(e[a]=Math.max(PE(wAe(o),wAe(s),r),0),(BT.test(s)||BT.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=PE(t.rotate||0,n.rotate||0,r))}function DAe(e,t){return e[t]===void 0?e.borderRadius:e[t]}var OAe=AAe(0,.5,ZEe),kAe=AAe(.5,.95,oT);function AAe(e,t,n){return r=>r<e?0:r>t?1:n(uE(e,t,r))}function jAe(e,t){e.min=t.min,e.max=t.max}function xD(e,t){jAe(e.x,t.x),jAe(e.y,t.y)}function MAe(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function NAe(e,t,n,r,i){return e-=t,e=mD(e,1/n,r),i!==void 0&&(e=mD(e,1/i,r)),e}function PAe(e,t=0,n=1,r=.5,i,a=e,o=e){if(BT.test(t)&&(t=parseFloat(t),t=PE(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=PE(a.min,a.max,r);e===a&&(s-=t),e.min=NAe(e.min,t,n,s,i),e.max=NAe(e.max,t,n,s,i)}function FAe(e,t,[n,r,i],a,o){PAe(e,t[n],t[r],t[i],t.scale,a,o)}var IAe=[`x`,`scaleX`,`originX`],LAe=[`y`,`scaleY`,`originY`];function RAe(e,t,n,r){FAe(e.x,t,IAe,n?n.x:void 0,r?r.x:void 0),FAe(e.y,t,LAe,n?n.y:void 0,r?r.y:void 0)}function zAe(e){return e.translate===0&&e.scale===1}function BAe(e){return zAe(e.x)&&zAe(e.y)}function VAe(e,t){return e.min===t.min&&e.max===t.max}function HAe(e,t){return VAe(e.x,t.x)&&VAe(e.y,t.y)}function UAe(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function WAe(e,t){return UAe(e.x,t.x)&&UAe(e.y,t.y)}function GAe(e){return iD(e.x)/iD(e.y)}function KAe(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var qAe=class{constructor(){this.members=[]}add(e){$T(this.members,e),e.scheduleRender()}remove(e){if(eE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t=this.members.findIndex(t=>e===t);if(t===0)return!1;let n;for(let e=t;e>=0;e--){let t=this.members[e];if(t.isPresent!==!1){n=t;break}}return n?(this.promote(n),!0):!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;r===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function JAe(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var SD={type:`projectionFrame`,totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},CD=typeof window<`u`&&window.MotionDebug!==void 0,wD=[``,`X`,`Y`,`Z`],YAe={visibility:`hidden`},XAe=1e3,ZAe=0;function TD(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function QAe(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=jEe(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,dT,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&QAe(r)}function $Ae({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=ZAe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,CD&&(SD.totalNodes=SD.resolvedTargetDeltas=SD.recalculatedProjection=0),this.nodes.forEach(nje),this.nodes.forEach(cje),this.nodes.forEach(lje),this.nodes.forEach(rje),CD&&window.MotionDebug.record(SD)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new bAe)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tE),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,n=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=vAe(t),this.instance=t;let{layoutId:r,layout:i,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(i||r)&&(this.isLayoutDirty=!0),e){let n,r=()=>this.root.updateBlockedByResize=!1;e(t,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=xAe(r,250),yD.hasAnimatedSinceResize&&(yD.hasAnimatedSinceResize=!1,this.nodes.forEach(ED))})}r&&this.root.registerSharedNode(r,this),this.options.animate!==!1&&a&&(r||i)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let i=this.options.transition||a.getDefaultTransition()||mje,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=a.getProps(),c=!this.targetLayout||!WAe(this.targetLayout,r)||n,l=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,l);let t={...XT(i,`layout`),onPlay:o,onComplete:s};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||ED(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,fT(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(uje),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&QAe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(aje);return}this.isUpdating||this.nodes.forEach(oje),this.isUpdating=!1,this.nodes.forEach(sje),this.nodes.forEach(eje),this.nodes.forEach(tje),this.clearAllSnapshots();let e=QT.now();pT.delta=PT(0,1e3/60,e-pT.timestamp),pT.timestamp=e,pT.isProcessing=!0,mT.update.process(pT),mT.preRender.process(pT),mT.render.process(pT),pT.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,TT.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ije),this.sharedNodes.forEach(dje)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dT.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dT.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=lD(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!BAe(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&(t||pD(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),hje(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return lD();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(gje))){let{scroll:e}=this.root;e&&(gD(t.x,e.offset.x),gD(t.y,e.offset.y))}return t}removeElementScroll(e){let t=lD();if(xD(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&xD(t,e),gD(t.x,i.offset.x),gD(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=lD();xD(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&_D(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),pD(r.latestValues)&&_D(n,r.latestValues)}return pD(this.latestValues)&&_D(n,this.latestValues),n}removeTransform(e){let t=lD();xD(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!pD(n.latestValues))continue;fD(n.latestValues)&&n.updateSnapshot();let r=lD();xD(r,n.measurePageBox()),RAe(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return pD(this.latestValues)&&RAe(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==pT.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!(!this.layout||!(r||i))){if(this.resolvedRelativeTargetAt=pT.timestamp,!this.targetDelta&&!this.relativeTarget){let e=this.getClosestProjectingParent();e&&e.layout&&this.animationProgress!==1?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lD(),this.relativeTargetOrigin=lD(),oD(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),xD(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=lD(),this.targetWithTransforms=lD()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Mke(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xD(this.target,this.layout.layoutBox),Qke(this.target,this.targetDelta)):xD(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let e=this.getClosestProjectingParent();e&&!!e.resumingFrom==!!this.resumingFrom&&!e.options.layoutScroll&&e.target&&this.animationProgress!==1?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lD(),this.relativeTargetOrigin=lD(),oD(this.relativeTargetOrigin,this.target,e.target),xD(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}CD&&SD.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||fD(this.parent.latestValues)||Yke(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===pT.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;xD(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;tAe(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=lD());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(MAe(this.prevProjectionDelta.x,this.projectionDelta.x),MAe(this.prevProjectionDelta.y,this.projectionDelta.y)),aD(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!KAe(this.projectionDelta.x,this.prevProjectionDelta.x)||!KAe(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),CD&&SD.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if((t=this.options.visualElement)==null||t.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cD(),this.projectionDelta=cD(),this.projectionDeltaWithTransform=cD()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=cD();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=lD(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(pje));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;DD(a.x,e.x,n),DD(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oD(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),fje(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&HAe(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=lD(),xD(d,this.relativeTarget)),s&&(this.animationValues=i,EAe(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&=(fT(this.pendingAnimation),void 0),this.pendingAnimation=dT.update(()=>{yD.hasAnimatedSinceResize=!0,this.currentAnimation=_Ae(0,XAe,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(XAe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&MD(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||lD();let t=iD(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=iD(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}xD(t,n),_D(t,i),aD(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new qAe),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&TD(`z`,e,r,this.animationValues);for(let t=0;t<wD.length;t++)TD(`rotate${wD[t]}`,e,r,this.animationValues),TD(`skew${wD[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}getProjectionStyles(e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return YAe;let t={visibility:``},n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.opacity=``,t.pointerEvents=AT(e?.pointerEvents)||``,t.transform=n?n(this.latestValues,``):`none`,t;let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){let t={};return this.options.layoutId&&(t.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,t.pointerEvents=AT(e?.pointerEvents)||``),this.hasProjected&&!pD(this.latestValues)&&(t.transform=n?n({},``):`none`,this.hasProjected=!1),t}let i=r.animationValues||r.latestValues;this.applyTransformsToTarget(),t.transform=JAe(this.projectionDeltaWithTransform,this.treeScale,i),n&&(t.transform=n(i,t.transform));let{x:a,y:o}=this.projectionDelta;t.transformOrigin=`${a.origin*100}% ${o.origin*100}% 0`,r.animationValues?t.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:t.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let e in qT){if(i[e]===void 0)continue;let{correct:n,applyTo:a}=qT[e],o=t.transform===`none`?i[e]:n(i[e],r);if(a){let e=a.length;for(let n=0;n<e;n++)t[a[n]]=o}else t[e]=o}return this.options.layoutId&&(t.pointerEvents=r===this?AT(e?.pointerEvents)||``:`none`),t}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(aje),this.root.sharedNodes.clear()}}}function eje(e){e.updateLayout()}function tje(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?uD(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=iD(r);r.min=n[e].min,r.max=r.min+i}):MD(i,t.layoutBox,n)&&uD(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=iD(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=cD();aD(o,n,t.layoutBox);let s=cD();a?aD(s,e.applyTransform(r,!0),t.measuredBox):aD(s,n,t.layoutBox);let c=!BAe(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=lD();oD(o,t.layoutBox,i.layoutBox);let s=lD();oD(s,n,a.layoutBox),WAe(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function nje(e){CD&&SD.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function rje(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ije(e){e.clearSnapshot()}function aje(e){e.clearMeasurements()}function oje(e){e.isLayoutDirty=!1}function sje(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ED(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function cje(e){e.resolveTargetDelta()}function lje(e){e.calcProjection()}function uje(e){e.resetSkewAndRotation()}function dje(e){e.removeLeadSnapshot()}function DD(e,t,n){e.translate=PE(t.translate,0,n),e.scale=PE(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function OD(e,t,n,r){e.min=PE(t.min,n.min,r),e.max=PE(t.max,n.max,r)}function fje(e,t,n,r){OD(e.x,t.x,n.x,r),OD(e.y,t.y,n.y,r)}function pje(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var mje={duration:.45,ease:[.4,0,.1,1]},kD=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),AD=kD(`applewebkit/`)&&!kD(`chrome/`)?Math.round:oT;function jD(e){e.min=AD(e.min),e.max=AD(e.max)}function hje(e){jD(e.x),jD(e.y)}function MD(e,t,n){return e===`position`||e===`preserve-aspect`&&!kke(GAe(t),GAe(n),.2)}function gje(e){return e!==e.root&&e.scroll?.wasRoot}var _je=$Ae({attachResizeListener:(e,t)=>$E(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ND={current:void 0},PD=$Ae({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ND.current){let e=new _je({});e.mount(window),e.setOptions({layoutScroll:!0}),ND.current=e}return ND.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),vje={pan:{Feature:dAe},drag:{Feature:lAe,ProjectionNode:PD,MeasureLayout:hAe}};function yje(e,t,n){if(e instanceof Element)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function FD(e,t){let n=yje(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function ID(e){return t=>{t.pointerType===`touch`||pke()||e(t)}}function bje(e,t,n={}){let[r,i,a]=FD(e,n),o=ID(e=>{let{target:n}=e,r=t(e);if(typeof r!=`function`||!n)return;let a=ID(e=>{r(e),n.removeEventListener(`pointerleave`,a)});n.addEventListener(`pointerleave`,a,i)});return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}function LD(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&dT.postRender(()=>i(t,eD(t)))}var xje=class extends XE{mount(){let{current:e}=this.node;e&&(this.unmount=bje(e,e=>(LD(this.node,e,`Start`),e=>LD(this.node,e,`End`))))}unmount(){}},Sje=class extends XE{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=RE($E(this.node.current,`focus`,()=>this.onFocus()),$E(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}},RD=(e,t)=>t?e===t?!0:RD(e,t.parentElement):!1,Cje=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function wje(e){return Cje.has(e.tagName)||e.tabIndex!==-1}var zD=new WeakSet;function BD(e){return t=>{t.key===`Enter`&&e(t)}}function VD(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Tje=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=BD(()=>{if(zD.has(n))return;VD(n,`down`);let e=BD(()=>{VD(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>VD(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function HD(e){return QE(e)&&!pke()}function Eje(e,t,n={}){let[r,i,a]=FD(e,n),o=e=>{let r=e.currentTarget;if(!HD(e)||zD.has(r))return;zD.add(r);let a=t(e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),!(!HD(e)||!zD.has(r))&&(zD.delete(r),typeof a==`function`&&a(e,{success:t}))},s=e=>{o(e,n.useGlobalTarget||RD(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{!wje(e)&&e.getAttribute(`tabindex`)===null&&(e.tabIndex=0),(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),e.addEventListener(`focus`,e=>Tje(e,i),i)}),a}function UD(e,t,n){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&dT.postRender(()=>i(t,eD(t)))}var Dje=class extends XE{mount(){let{current:e}=this.node;e&&(this.unmount=Eje(e,e=>(UD(this.node,e,`Start`),(e,{success:t})=>UD(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}},WD=new WeakMap,GD=new WeakMap,Oje=e=>{let t=WD.get(e.target);t&&t(e)},kje=e=>{e.forEach(Oje)};function Aje({root:e,...t}){let n=e||document;GD.has(n)||GD.set(n,{});let r=GD.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(kje,{root:e,...t})),r[i]}function jje(e,t,n){let r=Aje(t);return WD.set(e,n),r.observe(e),()=>{WD.delete(e),r.unobserve(e)}}var Mje={some:0,all:1},Nje=class extends XE{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Mje[r]};return jje(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Pje(e,t))&&this.startObserver()}unmount(){}};function Pje({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Fje={inView:{Feature:Nje},tap:{Feature:Dje},focus:{Feature:Sje},hover:{Feature:xje}},Ije={layout:{ProjectionNode:PD,MeasureLayout:hAe}},KD={current:null},qD={current:!1};function Lje(){if(qD.current=!0,aT)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>KD.current=e.matches;e.addListener(t),t()}else KD.current=!1}var Rje=[...BDe,CE,TE],zje=e=>Rje.find(zDe(e)),JD=new WeakMap;function Bje(e,t,n){for(let r in t){let i=t[r],a=n[r];if(kT(i))e.addValue(r,i);else if(kT(a))e.addValue(r,nE(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,nE(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var YD=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Vje=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ME,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=QT.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,dT.render(this.render,!1,!0))};let{latestValues:s,renderState:c,onUpdate:l}=a;this.onUpdate=l,this.latestValues=s,this.baseTarget={...s},this.initialValues=t.initial?{...s}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=ST(t),this.isVariantNode=mTe(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];s[e]!==void 0&&kT(t)&&t.set(s[e],!1)}}mount(e){this.current=e,JD.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),qD.current||Lje(),this.shouldReduceMotion=this.reducedMotionConfig===`never`?!1:this.reducedMotionConfig===`always`?!0:KD.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JD.delete(this.current),this.projection&&this.projection.unmount(),fT(this.notifyUpdate),fT(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=MT.has(e),r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&dT.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on(`renderRequest`,this.scheduleRender),a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i(),a&&a(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in hT){let t=hT[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lD()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<YD.length;t++){let n=YD[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Bje(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=nE(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(PDe(n)||$Ee(n))?n=parseFloat(n):!zje(n)&&TE.test(t)&&(n=SDe(e,t)),this.setBaseTarget(e,kT(n)?n.get():n)),kT(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=DT(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!kT(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new tE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}},XD=class extends Vje{constructor(){super(...arguments),this.KeyframeResolver=HDe}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;kT(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function Hje(e){return window.getComputedStyle(e)}var Uje=class extends XD{constructor(){super(...arguments),this.type=`html`,this.renderInstance=rEe}readValueFromInstance(e,t){if(MT.has(t)){let e=DE(t);return e&&e.default||0}else{let n=Hje(e),r=(RTe(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return rAe(e,t)}build(e,t,n){UT(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return JT(e,t,n)}},Wje=class extends XD{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=lD}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(MT.has(t)){let e=DE(t);return e&&e.default||0}return t=iEe.has(t)?t:wT(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return cEe(e,t,n)}build(e,t,n){WT(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,r){aEe(e,t,n,r)}mount(e){this.isSVGTag=KT(e.tagName),super.mount(e)}},Gje=(e,t)=>ET(e)?new Wje(t):new Uje(t,{allowProjection:e!==g.Fragment}),ZD=pTe(yEe({...fke,...Fje,...vje,...Ije},Gje)),QD={"in-progress":`Build in progress`,failed:`Last build failed`,success:`Gateway deployed`,idle:`No deployment yet`},$D=({status:e,className:t})=>e===`in-progress`?(0,W.jsx)(Hm,{size:14,"aria-label":QD[e],className:G(`animate-spin text-yellow-500`,t)}):(0,W.jsx)(`span`,{role:`img`,"aria-label":QD[e],className:G(`w-2 h-2 shrink-0 rounded-full`,{"bg-green-500":e===`success`,"bg-red-500":e===`failed`,"bg-neutral-400":e===`idle`},t)}),Kje=({children:e,className:t,...n})=>(0,W.jsx)(`div`,{className:G(`sticky flex flex-col w-full border-b px-4 py-3 bg-white dark:bg-[#141412] z-10`,t),style:{top:`var(--banner-height, 0px)`},...n,children:e}),qje=2e3,eO=(e,{onCopy:t,showToast:n=!0}={showToast:!0,onCopy:()=>{}})=>{let r=typeof e==`string`?()=>e:e,[i,a]=(0,g.useState)(`idle`),o=(0,g.useRef)(void 0),s=ah();(0,g.useEffect)(()=>{a(`idle`)},[e]);let c=()=>{a(`copied`),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(`idle`)},qje)};return{copyToClipboard:async()=>{setTimeout(()=>a(e=>e===`idle`?`loading`:e),5);let i=typeof e==`string`?e:await r();try{await navigator.clipboard.writeText(i)}catch{a(`failed`),s.error(`Failed to copy to clipboard`);return}c(),t?.(),n&&s.success((0,W.jsxs)(`div`,{className:`flex gap-2 items-center text-xs font-medium`,children:[(0,W.jsx)(Nre,{strokeWidth:2,size:16}),(0,W.jsx)(`div`,{children:`Copied to clipboard`})]}))},state:i}},tO=(e,t=`api`)=>Jje(e,t)?.url,Jje=(e,t=`api`)=>e.deploymentVersion?.stages.find(e=>e.stage===t),Yje=({count:e})=>!e||e===0?null:(0,W.jsx)(`span`,{className:`absolute top-1 right-0 h-2 w-2 rounded-full bg-blue-400`}),nO=({children:e,to:t,badgeCount:n,end:r})=>(0,W.jsx)(Pr,{end:r,to:t,className:({isActive:e,isPending:t})=>G(`font-medium relative items-center px-2 py-1 rounded-md text-neutral-900 dark:text-white text-sm transition-colors`,`rounded-md hover:text-zuplo-600`,e&&`text-zuplo-700`,t&&`text-zuplo-700 animate-pulse`),children:({isActive:t})=>(0,W.jsxs)(W.Fragment,{children:[t&&(0,W.jsx)(ZD.div,{layoutId:`local-navigation-item-background`,transition:{type:`spring`,bounce:.1,duration:.4},className:`absolute inset-0 rounded-md -z-10 bg-zuplo-100`}),e,(0,W.jsx)(Yje,{count:n})]})}),Xje=()=>{let e=oh(),[t,n]=(0,g.useState)(!1),r=tO(e.environment),{copyToClipboard:i,state:a}=eO(r??``);return(0,W.jsxs)(Zw,{open:t,onOpenChange:n,children:[(0,W.jsx)(Qw,{asChild:!0,children:(0,W.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2 flex justify-between h-8 mt-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)($D,{status:`success`}),`Deployment URLs`]}),(0,W.jsx)(hm,{size:16})]})}),(0,W.jsx)($w,{className:`divide-y p-0`,align:`end`,children:r?(0,W.jsxs)(`div`,{className:`p-4`,children:[(0,W.jsx)(`div`,{className:`font-medium text-lg`,children:`Local Development`}),(0,W.jsx)(`div`,{className:`h-2`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`uppercase text-muted-foreground font-semibold text-xs`,children:`Gateway`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)($D,{status:`success`}),(0,W.jsx)(`div`,{className:`text-sm max-w-52 truncate break-all`,children:(0,W.jsx)(rT,{href:r,target:`_blank`,variant:`ghost`,rel:`noopener noreferrer`,className:`hover:underline`,children:r})}),(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-muted rounded-md transition-colors`,onClick:()=>{i(),n(!1)},children:a===`copied`?(0,W.jsx)(mm,{size:16,className:`text-green-500`}):(0,W.jsx)(Om,{size:16})})]})]})]}):(0,W.jsxs)(`div`,{className:`w-60 p-5 text-center`,children:[(0,W.jsx)(`div`,{className:`text-2xl font-medium`,children:`🙈`}),(0,W.jsx)(`div`,{className:`text-md mt-4`,children:`Deployment URL not configured. Make sure your local gateway is running.`})]})})]})},Zje=()=>(0,W.jsxs)(Kje,{className:`flex-row justify-between`,children:[(0,W.jsxs)(`nav`,{"aria-label":`Sidebar`,className:`flex gap-2 items-center`,children:[(0,W.jsx)(nO,{end:!0,to:`/dev/project/local`,children:`Project`}),(0,W.jsx)(nO,{to:`/dev/project/local/edit`,children:`Code`})]}),(0,W.jsx)(Xje,{})]}),rO=(0,g.createContext)({chromeBottom:0});function Qje({height:e,children:t}){let n={chromeBottom:(0,g.useContext)(rO).chromeBottom+e};return(0,W.jsx)(rO.Provider,{value:n,children:t})}function $je(){return(0,g.useContext)(rO).chromeBottom}var eMe=({children:e,className:t,offset:n=0})=>{let r=$je();return(0,W.jsx)(`div`,{className:G(t),style:{height:`calc(100vh - ${r+n}px)`},children:e})};function iO(e,t,n){let{reference:r,floating:i}=e,a=vC(t),o=yC(t),s=_C(o),c=mC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(hC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}var tMe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iO(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=iO(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function aO(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=pC(t,e),p=SC(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=CC(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=CC(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var nMe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=pC(e,t)||{};if(l==null)return{};let d=SC(u),f={x:n,y:r},p=yC(i),m=_C(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=sC(d[_],T),D=sC(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=fC(O,A,k),M=!c.arrow&&hC(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),rMe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=pC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=mC(r),_=vC(o),v=mC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xC(o)]:Nye(o)),x=p!==`none`;!d&&x&&b.push(...zye(o,m,p,y));let S=[o,...b],C=await aO(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Mye(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==vC(t))||T.every(e=>vC(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function oO(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function sO(e){return Oye.some(t=>e[t]>=0)}var iMe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n}=t,{strategy:r=`referenceHidden`,...i}=pC(e,t);switch(r){case`referenceHidden`:{let e=oO(await aO(t,{...i,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:sO(e)}}}case`escaped`:{let e=oO(await aO(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:sO(e)}}}default:return{}}}}},cO=new Set([`left`,`top`]);async function aMe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mC(n),s=hC(n),c=vC(n)===`y`,l=cO.has(o)?-1:1,u=a&&c?-1:1,d=pC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var oMe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await aMe(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},sMe=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=pC(e,t),l={x:n,y:r},u=await aO(t,c),d=vC(mC(i)),f=gC(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=fC(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=fC(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},cMe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=pC(e,t),u={x:n,y:r},d=vC(i),f=gC(d),p=u[f],m=u[d],h=pC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=cO.has(mC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},lMe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=pC(e,t),u=await aO(t,l),d=mC(i),f=hC(i),p=vC(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=sC(h-u[g],v),x=sC(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=cC(u.left,0),t=cC(u.right,0),n=cC(u.top,0),r=cC(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:cC(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:cC(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function lO(e){let t=IC(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=AC(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=lC(n)!==a||lC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function uO(e){return kC(e)?e:e.contextElement}function dO(e){let t=uO(e);if(!AC(t))return dC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=lO(t),o=(a?lC(n.width):n.width)/r,s=(a?lC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var uMe=dC(0);function fO(e){let t=DC(e);return!PC()||!t.visualViewport?uMe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dMe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==DC(e)?!1:t}function pO(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=uO(e),o=dC(1);t&&(r?kC(r)&&(o=dO(r)):o=dO(e));let s=dMe(a,n,r)?fO(a):dC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=DC(a),t=r&&kC(r)?DC(r):r,n=e,i=BC(n);for(;i&&r&&t!==n;){let e=dO(i),t=i.getBoundingClientRect(),r=IC(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=DC(i),i=BC(n)}}return CC({width:u,height:d,x:c,y:l})}function mO(e,t){let n=LC(e).scrollLeft;return t?t.left+n:pO(OC(e)).left+n}function hO(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-mO(e,n),y:n.top+t.scrollTop}}function fMe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=OC(r),s=t?MC(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=dC(1),u=dC(0),d=AC(r);if((d||!d&&!a)&&((EC(r)!==`body`||jC(o))&&(c=LC(r)),AC(r))){let e=pO(r);l=dO(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?hO(o,c):dC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function pMe(e){return Array.from(e.getClientRects())}function mMe(e){let t=OC(e),n=LC(e),r=e.ownerDocument.body,i=cC(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=cC(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+mO(e),s=-n.scrollTop;return IC(r).direction===`rtl`&&(o+=cC(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var gO=25;function hMe(e,t){let n=DC(e),r=OC(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=PC();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=mO(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=gO&&(a-=o)}else l<=gO&&(a+=l);return{width:a,height:o,x:s,y:c}}var gMe=new Set([`absolute`,`fixed`]);function _Me(e,t){let n=pO(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=AC(e)?dO(e):dC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _O(e,t,n){let r;if(t===`viewport`)r=hMe(e,n);else if(t===`document`)r=mMe(OC(e));else if(kC(t))r=_Me(t,n);else{let n=fO(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return CC(r)}function vO(e,t){let n=RC(e);return n===t||!kC(n)||FC(n)?!1:IC(n).position===`fixed`||vO(n,t)}function vMe(e,t){let n=t.get(e);if(n)return n;let r=zC(e,[],!1).filter(e=>kC(e)&&EC(e)!==`body`),i=null,a=IC(e).position===`fixed`,o=a?RC(e):e;for(;kC(o)&&!FC(o);){let t=IC(o),n=NC(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&gMe.has(i.position)||jC(o)&&!n&&vO(e,o))?r=r.filter(e=>e!==o):i=t,o=RC(o)}return t.set(e,r),r}function yMe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?MC(t)?[]:vMe(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=_O(t,n,i);return e.top=cC(r.top,e.top),e.right=sC(r.right,e.right),e.bottom=sC(r.bottom,e.bottom),e.left=cC(r.left,e.left),e},_O(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function bMe(e){let{width:t,height:n}=lO(e);return{width:t,height:n}}function xMe(e,t,n){let r=AC(t),i=OC(t),a=n===`fixed`,o=pO(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=dC(0);function l(){c.x=mO(i)}if(r||!r&&!a)if((EC(t)!==`body`||jC(i))&&(s=LC(t)),r){let e=pO(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?hO(i,s):dC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function yO(e){return IC(e).position===`static`}function bO(e,t){if(!AC(e)||IC(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return OC(e)===n&&(n=n.ownerDocument.body),n}function xO(e,t){let n=DC(e);if(MC(e))return n;if(!AC(e)){let t=RC(e);for(;t&&!FC(t);){if(kC(t)&&!yO(t))return t;t=RC(t)}return n}let r=bO(e,t);for(;r&&rbe(r)&&yO(r);)r=bO(r,t);return r&&FC(r)&&yO(r)&&!NC(r)?n:r||cbe(e)||n}var SMe=async function(e){let t=this.getOffsetParent||xO,n=this.getDimensions,r=await n(e.floating);return{reference:xMe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CMe(e){return IC(e).direction===`rtl`}var wMe={convertOffsetParentRelativeRectToViewportRelativeRect:fMe,getDocumentElement:OC,getClippingRect:yMe,getOffsetParent:xO,getElementRects:SMe,getClientRects:pMe,getDimensions:bMe,getScale:dO,isElement:kC,isRTL:CMe};function SO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function TMe(e,t){let n=null,r,i=OC(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=uC(d),h=uC(i.clientWidth-(u+f)),g=uC(i.clientHeight-(d+p)),_=uC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:cC(0,sC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!SO(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function EMe(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=uO(e),u=i||a?[...l?zC(l):[],...zC(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?TMe(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?pO(e):null;c&&g();function g(){let t=pO(e);h&&!SO(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var DMe=oMe,OMe=sMe,kMe=rMe,AMe=lMe,jMe=iMe,CO=nMe,MMe=cMe,NMe=(e,t,n)=>{let r=new Map,i={platform:wMe,...n},a={...i.platform,_c:r};return tMe(e,t,{...i,platform:a})},wO=typeof document<`u`?g.useLayoutEffect:function(){};function TO(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!TO(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!TO(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function EO(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function DO(e,t){let n=EO(e);return Math.round(t*n)/n}function OO(e){let t=g.useRef(e);return wO(()=>{t.current=e}),t}function PMe(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=g.useState(r);TO(f,r)||p(r);let[m,h]=g.useState(null),[_,v]=g.useState(null),y=g.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=g.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||_,C=g.useRef(null),w=g.useRef(null),T=g.useRef(u),E=c!=null,D=OO(c),O=OO(i),k=OO(l),A=g.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),NMe(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!TO(T.current,t)&&(T.current=t,rp.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);wO(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=g.useRef(!1);wO(()=>(j.current=!0,()=>{j.current=!1}),[]),wO(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=g.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=g.useMemo(()=>({reference:x,floating:S}),[x,S]),P=g.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=DO(N.floating,u.x),r=DO(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...EO(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var FMe=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:CO({element:r.current,padding:i}).fn(n):r?CO({element:r,padding:i}).fn(n):{}}}},IMe=(e,t)=>({...DMe(e),options:[e,t]}),LMe=(e,t)=>({...OMe(e),options:[e,t]}),RMe=(e,t)=>({...MMe(e),options:[e,t]}),zMe=(e,t)=>({...kMe(e),options:[e,t]}),BMe=(e,t)=>({...AMe(e),options:[e,t]}),VMe=(e,t)=>({...jMe(e),options:[e,t]}),HMe=(e,t)=>({...FMe(e),options:[e,t]}),UMe=`Arrow`,kO=g.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,W.jsx)(xp.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,W.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});kO.displayName=UMe;var WMe=kO,AO=`Popper`,[jO,MO]=pp(AO),[GMe,NO]=jO(AO),PO=e=>{let{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return(0,W.jsx)(GMe,{scope:t,anchor:r,onAnchorChange:i,children:n})};PO.displayName=AO;var FO=`PopperAnchor`,IO=g.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=NO(FO,n),o=g.useRef(null),s=fp(t,o),c=g.useRef(null);return g.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,W.jsx)(xp.div,{...i,ref:s})});IO.displayName=FO;var LO=`PopperContent`,[KMe,qMe]=jO(LO),RO=g.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,_=NO(LO,n),[v,y]=g.useState(null),b=fp(t,e=>y(e)),[x,S]=g.useState(null),C=YC(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(YMe),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=PMe({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>EMe(...e,{animationFrame:p===`always`}),elements:{reference:_.anchor},middleware:[IMe({mainAxis:i+T,alignmentAxis:o}),c&&LMe({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?RMe():void 0,...A}),c&&zMe({...A}),BMe({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&HMe({element:x,padding:s}),XMe({arrowWidth:w,arrowHeight:T}),f&&VMe({strategy:`referenceHidden`,...A})]}),[I,L]=VO(N),R=Sp(m);Ep(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,ee=F.arrow?.y,te=F.arrow?.centerOffset!==0,[ne,B]=g.useState();return Ep(()=>{v&&B(window.getComputedStyle(v).zIndex)},[v]),(0,W.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ne,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,W.jsx)(KMe,{scope:n,placedSide:I,onArrowChange:S,arrowX:z,arrowY:ee,shouldHideArrow:te,children:(0,W.jsx)(xp.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});RO.displayName=LO;var zO=`PopperArrow`,JMe={top:`bottom`,right:`left`,bottom:`top`,left:`right`},BO=g.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qMe(zO,n),a=JMe[i.placedSide];return(0,W.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,W.jsx)(WMe,{...r,ref:t,style:{...r.style,display:`block`}})})});BO.displayName=zO;function YMe(e){return e!==null}var XMe=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=VO(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function VO(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var HO=PO,UO=IO,WO=RO,GO=BO,ZMe=`Portal`,KO=g.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=g.useState(!1);Ep(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?rp.createPortal((0,W.jsx)(xp.div,{...r,ref:t}),o):null});KO.displayName=ZMe;function QMe(e,t){return g.useReducer((e,n)=>t[e][n]??e,e)}var qO=e=>{let{present:t,children:n}=e,r=$Me(t),i=typeof n==`function`?n({present:r.isPresent}):g.Children.only(n),a=fp(r.ref,eNe(i));return typeof n==`function`||r.isPresent?g.cloneElement(i,{ref:a}):null};qO.displayName=`Presence`;function $Me(e){let[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),a=g.useRef(`none`),[o,s]=QMe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return g.useEffect(()=>{let e=JO(r.current);a.current=o===`mounted`?e:`none`},[o]),Ep(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=JO(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ep(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=JO(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=JO(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:g.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function JO(e){return e?.animationName||`none`}function eNe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var YO=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),tNe=`VisuallyHidden`,XO=g.forwardRef((e,t)=>(0,W.jsx)(xp.span,{...e,ref:t,style:{...YO,...e.style}}));XO.displayName=tNe;var nNe=XO,[ZO,rNe]=pp(`Tooltip`,[MO]),QO=MO(),$O=`TooltipProvider`,iNe=700,ek=`tooltip.open`,[aNe,tk]=ZO($O),nk=e=>{let{__scopeTooltip:t,delayDuration:n=iNe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=g.useRef(!0),s=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,W.jsx)(aNe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:g.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};nk.displayName=$O;var rk=`Tooltip`,[oNe,ik]=ZO(rk),ak=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=tk(rk,e.__scopeTooltip),l=QO(t),[u,d]=g.useState(null),f=oC(),p=g.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,_=g.useRef(!1),[v,y]=Ap({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ek))):c.onClose(),a?.(e)},caller:rk}),b=g.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,y(!0)},[y]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{_.current=!0,y(!0),p.current=0},h)},[h,y]);return g.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,W.jsx)(HO,{...l,children:(0,W.jsx)(oNe,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:g.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};ak.displayName=rk;var ok=`TooltipTrigger`,sk=g.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ik(ok,n),a=tk(ok,n),o=QO(n),s=fp(t,g.useRef(null),i.onTriggerChange),c=g.useRef(!1),l=g.useRef(!1),u=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,W.jsx)(UO,{asChild:!0,...o,children:(0,W.jsx)(xp.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:_p(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:_p(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:_p(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:_p(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:_p(e.onBlur,i.onClose),onClick:_p(e.onClick,i.onClose)})})});sk.displayName=ok;var ck=`TooltipPortal`,[sNe,cNe]=ZO(ck,{forceMount:void 0}),lk=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ik(ck,t);return(0,W.jsx)(sNe,{scope:t,forceMount:n,children:(0,W.jsx)(qO,{present:n||a.open,children:(0,W.jsx)(KO,{asChild:!0,container:i,children:r})})})};lk.displayName=ck;var uk=`TooltipContent`,dk=g.forwardRef((e,t)=>{let n=cNe(uk,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ik(uk,e.__scopeTooltip);return(0,W.jsx)(qO,{present:r||o.open,children:o.disableHoverableContent?(0,W.jsx)(fk,{side:i,...a,ref:t}):(0,W.jsx)(lNe,{side:i,...a,ref:t})})}),lNe=g.forwardRef((e,t)=>{let n=ik(uk,e.__scopeTooltip),r=tk(uk,e.__scopeTooltip),i=g.useRef(null),a=fp(t,i),[o,s]=g.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{s(null),d(!1)},[d]),p=g.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=mNe(r,pNe(r,n.getBoundingClientRect())),a=hNe(t.getBoundingClientRect());s(_Ne([...i,...a])),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),g.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!gNe(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,W.jsx)(fk,{...e,ref:a})}),[uNe,dNe]=ZO(rk,{isInside:!1}),fNe=bp(`TooltipContent`),fk=g.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ik(uk,n),l=QO(n),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(ek,u),()=>document.removeEventListener(ek,u)),[u]),g.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,W.jsx)(wp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,W.jsxs)(WO,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,W.jsx)(fNe,{children:r}),(0,W.jsx)(uNe,{scope:n,isInside:!0,children:(0,W.jsx)(nNe,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});dk.displayName=uk;var pk=`TooltipArrow`,mk=g.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=QO(n);return dNe(pk,n).isInside?null:(0,W.jsx)(GO,{...i,...r,ref:t})});mk.displayName=pk;function pNe(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function mNe(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function hNe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function gNe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function _Ne(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),vNe(t)}function vNe(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var yNe=nk,hk=ak,gk=sk,bNe=lk,xNe=dk,_k=mk;function vk({delayDuration:e=0,...t}){return(0,W.jsx)(yNe,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function yk({...e}){return(0,W.jsx)(vk,{children:(0,W.jsx)(hk,{"data-slot":`tooltip`,...e})})}function bk({...e}){return(0,W.jsx)(gk,{"data-slot":`tooltip-trigger`,...e})}function xk({className:e,sideOffset:t=0,children:n,...r}){return(0,W.jsx)(bNe,{children:(0,W.jsxs)(xNe,{"data-slot":`tooltip-content`,sideOffset:t,className:G(`bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,W.jsx)(_k,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}var Sk=({className:e,...t})=>(0,W.jsx)(_k,{...t,className:G(`fill-white -translate-y-px drop-shadow-md [clip-path:inset(0_-10px_-10px_-10px)]`,e)}),Ck=({children:e,content:t,open:n,defaultOpen:r,onOpenChange:i,side:a=`top`,align:o=`center`,className:s,asChild:c=!0,...l})=>t?(0,W.jsxs)(hk,{open:n,defaultOpen:r,onOpenChange:i,children:[(0,W.jsx)(gk,{asChild:c,children:e}),(0,W.jsxs)(xk,{side:a,align:o,className:s,...l,children:[t,(0,W.jsx)(Sk,{})]})]}):e,wk={width:5,height:5,borderRadius:`50%`},SNe=({className:e,color:t=`white`})=>{let n=t===`white`?`bg-white/60`:t===`current`?`bg-current/60`:`bg-zuplo-600/60`;return(0,W.jsxs)(ZD.div,{className:`flex items-center gap-1`,initial:`hidden`,animate:`visible`,variants:{visible:{transition:{staggerChildren:.2}}},children:[(0,W.jsx)(ZD.div,{className:G(n,e),variants:{hidden:{opacity:0,y:3},visible:{opacity:1,y:0,transition:{y:{type:`spring`,stiffness:300,damping:10,repeat:1/0,repeatType:`reverse`}}}},style:wk}),(0,W.jsx)(ZD.div,{className:G(n,e),variants:{hidden:{opacity:0,y:3},visible:{opacity:1,y:0,transition:{y:{type:`spring`,stiffness:300,damping:10,repeat:1/0,repeatType:`reverse`}}}},style:wk}),(0,W.jsx)(ZD.div,{className:G(n,e),variants:{hidden:{opacity:0,y:3},visible:{opacity:1,y:0,transition:{y:{type:`spring`,stiffness:300,damping:10,repeat:1/0,repeatType:`reverse`}}}},style:wk})]})},Tk=({children:e,className:t,loading:n,alternative:r})=>(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(`div`,{className:G(t,`transition-opacity`,n&&`opacity-0`),children:e}),(0,W.jsx)(`div`,{className:G(`absolute top-1/2 left-1/2 opacity-0 transform -translate-x-1/2 -translate-y-1/2`,n&&`opacity-100`),children:r??(0,W.jsx)(SNe,{color:`current`})})]});function Ek(){return Ek=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ek.apply(null,arguments)}function Dk(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function CNe(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Ok(...e){return t=>e.forEach(e=>CNe(e,t))}function kk(...e){return(0,g.useCallback)(Ok(...e),e)}function wNe(e,t){let n=(0,g.createContext)(t);function r(e){let{children:t,...r}=e,i=(0,g.useMemo)(()=>r,Object.values(r));return(0,g.createElement)(n.Provider,{value:i},t)}function i(r){let i=(0,g.useContext)(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return r.displayName=e+`Provider`,[r,i]}function TNe(e,t=[]){let n=[];function r(t,r){let i=(0,g.createContext)(r),a=n.length;n=[...n,r];function o(t){let{scope:n,children:r,...o}=t,s=n?.[e][a]||i,c=(0,g.useMemo)(()=>o,Object.values(o));return(0,g.createElement)(s.Provider,{value:c},r)}function s(n,o){let s=(0,g.useContext)(o?.[e][a]||i);if(s)return s;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return o.displayName=t+`Provider`,[o,s]}let i=()=>{let t=n.map(e=>(0,g.createContext)(e));return function(n){let r=n?.[e]||t;return(0,g.useMemo)(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ENe(i,...t)]}function ENe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return(0,g.useMemo)(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Ak=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},DNe=g.useId||(()=>void 0),ONe=0;function jk(e){let[t,n]=g.useState(DNe());return Ak(()=>{e||n(e=>e??String(ONe++))},[e]),e||(t?`radix-${t}`:``)}function Mk(e){let t=(0,g.useRef)(e);return(0,g.useEffect)(()=>{t.current=e}),(0,g.useMemo)(()=>(...e)=>t.current?.call(t,...e),[])}function kNe({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=ANe({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=Mk(n);return[o,(0,g.useCallback)(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function ANe({defaultProp:e,onChange:t}){let n=(0,g.useState)(e),[r]=n,i=(0,g.useRef)(r),a=Mk(t);return(0,g.useEffect)(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function Nk(){return Nk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nk.apply(null,arguments)}var Pk=(0,g.forwardRef)((e,t)=>{let{children:n,...r}=e,i=g.Children.toArray(n),a=i.find(MNe);if(a){let e=a.props.children,n=i.map(t=>t===a?g.Children.count(e)>1?g.Children.only(null):(0,g.isValidElement)(e)?e.props.children:null:t);return(0,g.createElement)(Fk,Nk({},r,{ref:t}),(0,g.isValidElement)(e)?(0,g.cloneElement)(e,void 0,n):null)}return(0,g.createElement)(Fk,Nk({},r,{ref:t}),n)});Pk.displayName=`Slot`;var Fk=(0,g.forwardRef)((e,t)=>{let{children:n,...r}=e;return(0,g.isValidElement)(n)?(0,g.cloneElement)(n,{...NNe(r,n.props),ref:t?Ok(t,n.ref):n.ref}):g.Children.count(n)>1?g.Children.only(null):null});Fk.displayName=`SlotClone`;var jNe=({children:e})=>(0,g.createElement)(g.Fragment,null,e);function MNe(e){return(0,g.isValidElement)(e)&&e.type===jNe}function NNe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{a(...e),i(...e)}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}var Ik=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=(0,g.forwardRef)((e,n)=>{let{asChild:r,...i}=e,a=r?Pk:t;return(0,g.useEffect)(()=>{window[Symbol.for(`radix-ui`)]=!0},[]),(0,g.createElement)(a,Nk({},i,{ref:n}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),PNe=(0,g.forwardRef)((e,t)=>{let{container:n=globalThis==null?void 0:globalThis.document?.body,...r}=e;return n?rp.createPortal((0,g.createElement)(Ik.div,Nk({},r,{ref:t})),n):null});function FNe(e,t){return(0,g.useReducer)((e,n)=>t[e][n]??e,e)}var Lk=e=>{let{present:t,children:n}=e,r=INe(t),i=typeof n==`function`?n({present:r.isPresent}):g.Children.only(n),a=kk(r.ref,i.ref);return typeof n==`function`||r.isPresent?(0,g.cloneElement)(i,{ref:a}):null};Lk.displayName=`Presence`;function INe(e){let[t,n]=(0,g.useState)(),r=(0,g.useRef)({}),i=(0,g.useRef)(e),a=(0,g.useRef)(`none`),[o,s]=FNe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return(0,g.useEffect)(()=>{let e=Rk(r.current);a.current=o===`mounted`?e:`none`},[o]),Ak(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Rk(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ak(()=>{if(t){let e=e=>{let n=Rk(r.current).includes(e.animationName);e.target===t&&n&&(0,rp.flushSync)(()=>s(`ANIMATION_END`))},n=e=>{e.target===t&&(a.current=Rk(r.current))};return t.addEventListener(`animationstart`,n),t.addEventListener(`animationcancel`,e),t.addEventListener(`animationend`,e),()=>{t.removeEventListener(`animationstart`,n),t.removeEventListener(`animationcancel`,e),t.removeEventListener(`animationend`,e)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:(0,g.useCallback)(e=>{e&&(r.current=getComputedStyle(e)),n(e)},[])}}function Rk(e){return e?.animationName||`none`}var zk=0;function LNe(){(0,g.useEffect)(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Bk()),document.body.insertAdjacentElement(`beforeend`,e[1]??Bk()),zk++,()=>{zk===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),zk--}},[])}function Bk(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.cssText=`outline: none; opacity: 0; position: fixed; pointer-events: none`,e}var Vk=Jxe(),Hk=function(){},Uk=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:Hk,onWheelCapture:Hk,onTouchMoveCapture:Hk}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,m=e.inert,h=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=pw(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noIsolation`,`inert`,`allowPinchZoom`,`as`]),b=f,x=Gxe([n,t]),S=fw(fw({},y),i);return g.createElement(g.Fragment,null,u&&g.createElement(b,{sideCar:Vk,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:a,allowPinchZoom:!!h,lockRef:n}),o?g.cloneElement(g.Children.only(s),fw(fw({},S),{ref:x})):g.createElement(v,fw({},S,{className:c,ref:x}),s))});Uk.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Uk.classNames={fullWidth:hw,zeroRight:mw};var Wk=!1;if(typeof window<`u`)try{var Gk=Object.defineProperty({},`passive`,{get:function(){return Wk=!0,!0}});window.addEventListener(`test`,Gk,Gk),window.removeEventListener(`test`,Gk,Gk)}catch{Wk=!1}var Kk=Wk?{passive:!1}:!1,RNe=function(e){return e.tagName===`TEXTAREA`},qk=function(e,t){var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!RNe(e)&&n[t]===`visible`)},zNe=function(e){return qk(e,`overflowY`)},BNe=function(e){return qk(e,`overflowX`)},Jk=function(e,t){var n=t;do{if(typeof ShadowRoot<`u`&&n instanceof ShadowRoot&&(n=n.host),Yk(e,n)){var r=Xk(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},VNe=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},HNe=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Yk=function(e,t){return e===`v`?zNe(t):BNe(t)},Xk=function(e,t){return e===`v`?VNe(t):HNe(t)},UNe=function(e,t){return e===`h`&&t===`rtl`?-1:1},WNe=function(e,t,n,r,i){var a=UNe(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{var p=Xk(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Yk(e,s)&&(d+=h,f+=m),s=s.parentNode}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&d===0||!i&&o>d)||!u&&(i&&f===0||!i&&-o>f))&&(l=!0),l},Zk=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qk=function(e){return[e.deltaX,e.deltaY]},$k=function(e){return e&&`current`in e?e.current:e},GNe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KNe=function(e){return`
94
94
  .block-interactivity-${e} {pointer-events: none;}
95
95
  .allow-interactivity-${e} {pointer-events: all;}
96
- `},qNe=0,eA=[];function JNe(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(qNe++)[0],a=g.useState(function(){return yw()})[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=zxe([e.lockRef.current],(e.shards||[]).map($k),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=g.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2)return!o.current.allowPinchZoom;var i=Zk(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=Jk(d,u);if(!f)return!0;if(f?l=d:(l=d===`v`?`h`:`v`,f=Jk(d,u)),!f)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var p=r.current||l;return WNe(p,t,e,p===`h`?s:c,!0)},[]),c=g.useCallback(function(e){var n=e;if(!(!eA.length||eA[eA.length-1]!==a)){var r=`deltaY`in n?Qk(n):Zk(n),i=t.current.filter(function(e){return e.name===n.type&&e.target===n.target&&GNe(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map($k).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=g.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=g.useCallback(function(e){n.current=Zk(e),r.current=void 0},[]),d=g.useCallback(function(t){l(t.type,Qk(t),t.target,s(t,e.lockRef.current))},[]),f=g.useCallback(function(t){l(t.type,Zk(t),t.target,s(t,e.lockRef.current))},[]);g.useEffect(function(){return eA.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Kk),document.addEventListener(`touchmove`,c,Kk),document.addEventListener(`touchstart`,u,Kk),function(){eA=eA.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Kk),document.removeEventListener(`touchmove`,c,Kk),document.removeEventListener(`touchstart`,u,Kk)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(a,{styles:KNe(i)}):null,p?g.createElement(fSe,{gapMode:`margin`}):null)}var YNe=Xxe(Vk,JNe),tA=g.forwardRef(function(e,t){return g.createElement(Uk,fw({},e,{ref:t,sideCar:YNe}))});tA.classNames=Uk.classNames;var nA=`Dialog`,[rA,XNe]=TNe(nA),[ZNe,iA]=rA(nA),QNe=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=(0,g.useRef)(null),c=(0,g.useRef)(null),[l=!1,u]=kNe({prop:r,defaultProp:i,onChange:a});return(0,g.createElement)(ZNe,{scope:t,triggerRef:s,contentRef:c,contentId:jk(),titleId:jk(),descriptionId:jk(),open:l,onOpenChange:u,onOpenToggle:(0,g.useCallback)(()=>u(e=>!e),[u]),modal:o},n)},$Ne=`DialogTrigger`,ePe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA($Ne,n),a=kk(t,i.triggerRef);return(0,g.createElement)(Ik.button,Ek({type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":dA(i.open)},r,{ref:a,onClick:Dk(e.onClick,i.onOpenToggle)}))}),aA=`DialogPortal`,[tPe,oA]=rA(aA,{forceMount:void 0}),nPe=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=iA(aA,t);return(0,g.createElement)(tPe,{scope:t,forceMount:n},g.Children.map(r,e=>(0,g.createElement)(Lk,{present:n||a.open},(0,g.createElement)(PNe,{asChild:!0,container:i},e))))},sA=`DialogOverlay`,rPe=(0,g.forwardRef)((e,t)=>{let n=oA(sA,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=iA(sA,e.__scopeDialog);return a.modal?(0,g.createElement)(Lk,{present:r||a.open},(0,g.createElement)(iPe,Ek({},i,{ref:t}))):null}),iPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(sA,n);return(0,g.createElement)(tA,{as:Pk,allowPinchZoom:!0,shards:[i.contentRef]},(0,g.createElement)(Ik.div,Ek({"data-state":dA(i.open)},r,{ref:t,style:{pointerEvents:`auto`,...r.style}})))}),cA=`DialogContent`,aPe=(0,g.forwardRef)((e,t)=>{let n=oA(cA,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=iA(cA,e.__scopeDialog);return(0,g.createElement)(Lk,{present:r||a.open},a.modal?(0,g.createElement)(oPe,Ek({},i,{ref:t})):(0,g.createElement)(sPe,Ek({},i,{ref:t})))}),oPe=(0,g.forwardRef)((e,t)=>{let n=iA(cA,e.__scopeDialog),r=(0,g.useRef)(null),i=kk(t,n.contentRef,r);return(0,g.useEffect)(()=>{let e=r.current;if(e)return dw(e)},[]),(0,g.createElement)(lA,Ek({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Dk(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),(t=n.triggerRef.current)==null||t.focus()}),onPointerDownOutside:Dk(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Dk(e.onFocusOutside,e=>e.preventDefault())}))}),sPe=(0,g.forwardRef)((e,t)=>{let n=iA(cA,e.__scopeDialog),r=(0,g.useRef)(!1),i=(0,g.useRef)(!1);return(0,g.createElement)(lA,Ek({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a;if((a=e.onCloseAutoFocus)==null||a.call(e,t),!t.defaultPrevented){var o;r.current||(o=n.triggerRef.current)==null||o.focus(),t.preventDefault()}r.current=!1,i.current=!1},onInteractOutside:t=>{var a;(a=e.onInteractOutside)==null||a.call(e,t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let o=t.target;n.triggerRef.current?.contains(o)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}}))}),lA=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=iA(cA,n),c=kk(t,(0,g.useRef)(null));return LNe(),(0,g.createElement)(g.Fragment,null,(0,g.createElement)(iC,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a},(0,g.createElement)(wp,Ek({role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":dA(s.open)},o,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),uA=`DialogTitle`,cPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(uA,n);return(0,g.createElement)(Ik.h2,Ek({id:i.titleId},r,{ref:t}))}),lPe=`DialogDescription`,uPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(lPe,n);return(0,g.createElement)(Ik.p,Ek({id:i.descriptionId},r,{ref:t}))}),dPe=`DialogClose`,fPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(dPe,n);return(0,g.createElement)(Ik.button,Ek({type:`button`},r,{ref:t,onClick:Dk(e.onClick,()=>i.onOpenChange(!1))}))});function dA(e){return e?`open`:`closed`}var[pPe,mPe]=wNe(`DialogTitleWarning`,{contentName:cA,titleName:uA,docsSlug:`dialog`}),fA=QNe,pA=ePe,mA=nPe,hA=rPe,gA=aPe,_A=cPe,vA=uPe,yA=fPe;function bA({...e}){return(0,W.jsx)(fA,{"data-slot":`dialog`,...e})}function xA({...e}){return(0,W.jsx)(pA,{"data-slot":`dialog-trigger`,...e})}function hPe({...e}){return(0,W.jsx)(mA,{"data-slot":`dialog-portal`,...e})}function SA({...e}){return(0,W.jsx)(yA,{"data-slot":`dialog-close`,...e})}function gPe({className:e,...t}){return(0,W.jsx)(hA,{"data-slot":`dialog-overlay`,className:G(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function CA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,W.jsxs)(hPe,{"data-slot":`dialog-portal`,children:[(0,W.jsx)(gPe,{}),(0,W.jsxs)(gA,{"data-slot":`dialog-content`,className:G(`bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...r,children:[t,n&&(0,W.jsxs)(yA,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,W.jsx)($m,{}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function wA({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`dialog-header`,className:G(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function TA({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`dialog-footer`,className:G(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function EA({className:e,...t}){return(0,W.jsx)(_A,{"data-slot":`dialog-title`,className:G(`text-lg leading-none font-semibold`,e),...t})}function DA({className:e,...t}){return(0,W.jsx)(vA,{"data-slot":`dialog-description`,className:G(`text-muted-foreground text-sm`,e),...t})}function _Pe({open:e,editors:t,onSelect:n,onCancel:r}){let[i,a]=(0,g.useState)(null);return(0,W.jsx)(bA,{open:e,onOpenChange:e=>!e&&r(),children:(0,W.jsxs)(CA,{className:`sm:max-w-md`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Choose Your Editor`}),(0,W.jsx)(DA,{children:`Select which editor you'd like to use for opening files. This preference will be saved for future use.`})]}),(0,W.jsx)(`div`,{className:`space-y-2 py-4`,children:t.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`w-full text-left px-4 py-3 rounded-md border transition-colors ${i===e.id?`border-blue-500 bg-blue-50 dark:bg-blue-950/40`:`border-gray-200 dark:border-neutral-700 hover:border-gray-300 dark:hover:border-neutral-600 hover:bg-gray-50 dark:hover:bg-neutral-800/60`}`,onClick:()=>a(e.id),children:(0,W.jsx)(`div`,{className:`font-medium`,children:e.name})},e.id))}),(0,W.jsxs)(TA,{children:[(0,W.jsx)(Y,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,W.jsx)(Y,{variant:`default`,onClick:()=>{i&&n(i)},disabled:!i,children:`Save Preference`})]})]})})}var OA=`/api/v1/editor`;function vPe(){let[e]=Vr(),[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(!0);(0,g.useEffect)(()=>{(async()=>{try{let e=await fetch(`${OA}/list`);if(!e.ok)throw Error(`Failed to fetch editors: ${e.status}`);o((await e.json()).editors);let t=await fetch(`${OA}/detect`);if(!t.ok)throw Error(`Failed to detect editor: ${t.status}`);let r=await t.json();r.editor&&r.name&&(n(r.editor),i(r.name))}catch(e){kf.error(`Failed to load editor preference`,{error:e})}finally{u(!1)}})()},[]);let d=(0,g.useCallback)(async e=>{try{if((await fetch(`${OA}/preference`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({editor:e})})).ok){let t=a.find(t=>t.id===e);t&&(n(e),i(t.name)),c(!1)}}catch(e){kf.error(`Failed to save editor preference`,{error:e})}},[a]),f=(0,g.useCallback)(async()=>{let n=e.get(`path`);if(!n){kf.warn(`No file path in URL`);return}if(!t){c(!0);return}try{let e=await fetch(`${OA}/open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({file:n})});if(!e.ok){let t=await e.json();kf.error(`Failed to open file in editor`,{error:t.message});return}let t=await e.json();t.url&&window.open(t.url,`_blank`)}catch(e){kf.error(`Failed to open file in editor`,{error:e})}},[e,t]);return{hasEditor:!!t,editorName:r,isLoading:l,showPreferenceDialog:s,setShowPreferenceDialog:c,availableEditors:a,savePreference:d,openInEditor:f}}var kA=`$import(@zuplo/runtime)`,yPe=e=>new Promise(t=>setTimeout(t,e)),AA=e=>{let t=(0,g.useRef)(e);return t.current=e,(0,g.useEffect)(()=>{t.current=e},[e]),t},jA=e=>{let[t,n]=(0,g.useState)(`idle`),[r,i]=(0,g.useState)(),[a,o]=(0,g.useState)(null);return{state:t,error:r,execute:(0,g.useCallback)(async(...t)=>{n(`loading`),o(null),i(void 0);try{let r=await e(...t);return n(`hasValue`),o(r),r}catch(e){throw i(e instanceof Error?e:Error(e)),n(`hasError`),e}},[e]),value:a}},MA=function(e){return e.PRODUCTION=`PRODUCTION`,e.PREVIEW=`PREVIEW`,e.WORKING_COPY=`WORKING_COPY`,e}({});function bPe(e,...t){return e==null?!1:t.includes(e)}var NA=()=>({isReadOnly:oh().environment.environmentType!==MA.WORKING_COPY});function PA(){return new URLSearchParams(Sn().search)}function FA(e,t){let[n,r]=Vr(),i=Object.fromEntries(n);return[n.get(e)??t,t=>r(t===void 0?Object.fromEntries(Object.entries(i).filter(([t])=>t!==e)):{...i,[e]:t})]}function xPe(e,t){let[n,r]=Vr();return[n.get(e)?n.getAll(e):t,t=>r({...Object.fromEntries(n),[e]:t})]}var SPe=i(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),CPe=e(i(((e,t)=>{var n=SPe();t.exports=f;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`;function c(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function l(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function u(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function d(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=d(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function f(e){return e?(e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),_(l(e),!0).map(u)):[]}function p(e){return`{`+e+`}`}function m(e){return/^-?0\d/.test(e)}function h(e,t){return e<=t}function g(e,t){return e>=t}function _(e,t){var r=[],i=n(`{`,`}`,e);if(!i)return[e];var o=i.pre,s=i.post.length?_(i.post,!1):[``];if(/\$$/.test(i.pre))for(var l=0;l<s.length;l++){var u=o+`{`+i.body+`}`+s[l];r.push(u)}else{var f=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),v=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),y=f||v,b=i.body.indexOf(`,`)>=0;if(!y&&!b)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+a+i.post,_(e)):[e];var x;if(y)x=i.body.split(/\.\./);else if(x=d(i.body),x.length===1&&(x=_(x[0],!1).map(p),x.length===1))return s.map(function(e){return i.pre+x[0]+e});var S;if(y){var C=c(x[0]),w=c(x[1]),T=Math.max(x[0].length,x[1].length),E=x.length==3?Math.abs(c(x[2])):1,D=h;w<C&&(E*=-1,D=g);var O=x.some(m);S=[];for(var k=C;D(k,w);k+=E){var A;if(v)A=String.fromCharCode(k),A===`\\`&&(A=``);else if(A=String(k),O){var j=T-A.length;if(j>0){var M=Array(j+1).join(`0`);A=k<0?`-`+M+A.slice(1):M+A}}S.push(A)}}else{S=[];for(var N=0;N<x.length;N++)S.push.apply(S,_(x[N],!1))}for(var N=0;N<S.length;N++)for(var l=0;l<s.length;l++){var u=o+S[N]+s[l];(!t||y||u)&&r.push(u)}}return r}}))()),wPe=1024*64,IA=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>wPe)throw TypeError(`pattern is too long`)},TPe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},LA=e=>e.replace(/[[\]\\-]/g,`\\$&`),EPe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),RA=e=>e.join(``),DPe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(TPe))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(LA(d)+`-`+LA(t)):t===d&&r.push(LA(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(LA(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(LA(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[EPe(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+RA(r)+`]`,p=`[`+(l?``:`^`)+RA(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},zA=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`),OPe=new Set([`!`,`?`,`+`,`*`,`@`]),BA=e=>OPe.has(e),VA=e=>BA(e.type),kPe=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),APe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),jPe=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),HA=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),MPe=`(?!\\.\\.?(?:$|/))`,UA=`(?!\\.)`,NPe=new Set([`[`,`.`]),PPe=new Set([`..`,`.`]),FPe=new Set(`().*{}+?[]^$\\!`),IPe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),WA=`[^/]`,GA=WA+`*?`,KA=WA+`+?`,qA=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...t){for(let n of t)if(n!==``){if(typeof n!=`string`&&!(n instanceof e&&n.#i===this))throw Error(`invalid part: `+n);this.#r.push(n)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;n<this.#a;n++){let r=t.#r[n];if(!(r instanceof e&&r.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(t){let n=new e(this.type,t);for(let e of this.#r)n.copyIn(e);return n}static#f(t,n,r,i,a){let o=i.maxExtglobRecursion??2,s=!1,c=!1,l=-1,u=!1;if(n.type===null){let d=r,f=``;for(;d<t.length;){let r=t.charAt(d++);if(s||r===`\\`){s=!s,f+=r;continue}if(c){d===l+1?(r===`^`||r===`!`)&&(u=!0):r===`]`&&!(d===l+2&&u)&&(c=!1),f+=r;continue}else if(r===`[`){c=!0,l=d,u=!1,f+=r;continue}if(!i.noext&&BA(r)&&t.charAt(d)===`(`&&a<=o){n.push(f),f=``;let o=new e(r,n);d=e.#f(t,o,d,i,a+1),n.push(o);continue}f+=r}return n.push(f),d}let d=r+1,f=new e(null,n),p=[],m=``;for(;d<t.length;){let r=t.charAt(d++);if(s||r===`\\`){s=!s,m+=r;continue}if(c){d===l+1?(r===`^`||r===`!`)&&(u=!0):r===`]`&&!(d===l+2&&u)&&(c=!1),m+=r;continue}else if(r===`[`){c=!0,l=d,u=!1,m+=r;continue}if(BA(r)&&t.charAt(d)===`(`&&(a<=o||n&&n.#h(r))){let o=n&&n.#h(r)?0:1;f.push(m),m=``;let s=new e(r,f);f.push(s),d=e.#f(t,s,d,i,a+o);continue}if(r===`|`){f.push(m),m=``,p.push(f),f=new e(null,n);continue}if(r===`)`)return m===``&&n.#r.length===0&&(n.#u=!0),f.push(m),m=``,n.push(...p,f),d;m+=r}return n.type=null,n.#t=void 0,n.#r=[t.substring(r-1)],d}#p(e){return this.#m(e,APe)}#m(e,t=kPe){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=jPe){return!!t.get(this.type)?.includes(e)}#g(t,n){let r=t.#r[0],i=new e(null,r,this.options);i.#r.push(``),r.push(i),this.#_(t,n)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!HA.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=HA.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}#x(){if(VA(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}static fromGlob(t,n={}){let r=new e(null,void 0,n);return e.#f(t,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(){if(this.#e===this&&(this.#x(),this.#d()),!VA(this)){let t=this.isStart()&&this.isEnd(),n=this.#r.map(n=>{let[r,i,a,o]=typeof n==`string`?e.#S(n,this.#t,t):n.toRegExpSource();return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),r=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&PPe.has(this.#r[0]))){let e=NPe,t=this.#c.dot&&e.has(n.charAt(0))||n.startsWith(`\\.`)&&e.has(n.charAt(2))||n.startsWith(`\\.\\.`)&&e.has(n.charAt(4)),i=!this.#c.dot&&e.has(n.charAt(0));r=t?MPe:i?UA:``}let i=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(i=`(?:$|\\/)`),[r+n+i,zA(n),this.#t=!!this.#t,this.#n]}let t=this.type===`!`?`(?:(?!(?:`:`(?:`,n=this.#r.map(e=>{if(typeof e==`string`)throw Error(`string type in extglob ast??`);let[t,n,r,i]=e.toRegExpSource();return this.#n=this.#n||i,t}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`);if(this.isStart()&&this.isEnd()&&!n&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,zA(this.toString()),!1,!1]}let r=``;if(this.type===`!`&&this.#u)r=(this.isStart()&&!this.#c.dot?UA:``)+KA;else{let e=this.type===`!`?`))`+(this.isStart()&&!this.#c.dot?UA:``)+GA+`)`:this.type===`@`?`)`:`)${this.type}`;r=t+n+e}return[r,zA(n),this.#t=!!this.#t,this.#n]}static#S(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(c!==`*`&&(o=!1),r){r=!1,i+=(FPe.has(c)?`\\`:``)+c;continue}if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=DPe(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?KA:GA,t=!0;continue}if(c===`?`){i+=WA,t=!0;continue}i+=IPe(c)}return[i,zA(e),!!t,a]}},LPe=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),JA=(e,t,n={})=>(IA(t),!n.nocomment&&t.charAt(0)===`#`?!1:new rj(t,n).match(e)),RPe=/^\*+([^+@!?\*\[\(]*)$/,zPe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),BPe=e=>t=>t.endsWith(e),VPe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),HPe=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),UPe=/^\*+\.\*+$/,WPe=e=>!e.startsWith(`.`)&&e.includes(`.`),GPe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),KPe=/^\.\*+$/,qPe=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),JPe=/^\*+$/,YPe=e=>e.length!==0&&!e.startsWith(`.`),XPe=e=>e.length!==0&&e!==`.`&&e!==`..`,ZPe=/^\?+([^+@!?\*\[\(]*)?$/,QPe=([e,t=``])=>{let n=YA([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},$Pe=([e,t=``])=>{let n=XA([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},eFe=([e,t=``])=>{let n=XA([e]);return t?e=>n(e)&&e.endsWith(t):n},tFe=([e,t=``])=>{let n=YA([e]);return t?e=>n(e)&&e.endsWith(t):n},YA=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},XA=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ZA=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,QA={win32:{sep:`\\`},posix:{sep:`/`}};JA.sep=ZA===`win32`?QA.win32.sep:QA.posix.sep;var $A=Symbol(`globstar **`);JA.GLOBSTAR=$A;var nFe=`[^/]*?`,rFe=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,iFe=`(?:(?!(?:\\/|^)\\.).)*?`;JA.filter=(e,t={})=>n=>JA(n,e,t);var ej=(e,t={})=>Object.assign({},e,t);JA.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return JA;let t=JA;return Object.assign((n,r,i={})=>t(n,r,ej(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,ej(e,n))}static defaults(n){return t.defaults(ej(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,ej(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,ej(e,r))}},unescape:(n,r={})=>t.unescape(n,ej(e,r)),escape:(n,r={})=>t.escape(n,ej(e,r)),filter:(n,r={})=>t.filter(n,ej(e,r)),defaults:n=>t.defaults(ej(e,n)),makeRe:(n,r={})=>t.makeRe(n,ej(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,ej(e,r)),match:(n,r,i={})=>t.match(n,r,ej(e,i)),sep:t.sep,GLOBSTAR:$A})};var tj=(e,t={})=>(IA(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:(0,CPe.default)(e));JA.braceExpand=tj,JA.makeRe=(e,t={})=>new rj(e,t).makeRe(),JA.match=(e,t,n={})=>{let r=new rj(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var nj=/[?*]|[+@!]\(.*?\)|\[|\]/,aFe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),rj=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){IA(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ZA,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!nj.test(e[2]))&&!nj.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);r&&(e[t]=r,e[n]=[])}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=e[0]===``&&e[1]===``&&e[2]===`?`&&typeof e[3]==`string`&&/^[a-z]:$/i.test(e[3]),a=t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]);if(n&&a){let n=e[3],a=t[3];n.toLowerCase()===a.toLowerCase()&&(e[3]=a,r=3,i=3)}else if(a&&typeof e[0]==`string`){let n=t[3],r=e[0];n.toLowerCase()===r.toLowerCase()&&(t[3]=r,i=3)}else if(n&&typeof t[0]==`string`){let n=e[3];n.toLowerCase()===t[0].toLowerCase()&&(t[0]=n,r=3)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes($A)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf($A,i),o=t.lastIndexOf($A),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===$A?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===$A)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return tj(this.pattern,this.options)}parse(e){IA(e);let t=this.options;if(e===`**`)return $A;if(e===``)return``;let n,r=null;(n=e.match(JPe))?r=t.dot?XPe:YPe:(n=e.match(RPe))?r=(t.nocase?t.dot?HPe:VPe:t.dot?BPe:zPe)(n[1]):(n=e.match(ZPe))?r=(t.nocase?t.dot?$Pe:QPe:t.dot?eFe:tFe)(n):(n=e.match(UPe))?r=t.dot?GPe:WPe:(n=e.match(KPe))&&(r=qPe);let i=qA.fromGlob(e,this.options).toMMPattern();return r?Object.assign(i,{test:r}):i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?nFe:t.dot?rFe:iFe,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?aFe(e):e===$A?$A:e._src});return t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==$A||a===$A||(a===void 0?i!==void 0&&i!==$A?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|`+n+`)?`:i!==$A&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=$A))}),t.filter(e=>e!==$A).join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return JA.defaults(e).Minimatch}};JA.AST=qA,JA.Minimatch=rj,JA.escape=LPe,JA.unescape=zA;function ij(e){let t=new Date;switch(e){case`7d`:t.setUTCDate(t.getUTCDate()-7);break;case`30d`:t.setUTCDate(t.getUTCDate()-30);break;case`3m`:t.setUTCMonth(t.getUTCMonth()-3);break}return t.toISOString()}async function aj(e,t){let n=t.pageSize??30,{page:r,pageSize:i,order:a=`DESC`,orderBy:o=`periodStart`,...s}=t,{data:c,error:l}=await C_.GET(`/v3/metering/{bucketId}/billing/invoices`,{params:{path:{bucketId:e},query:{page:r,pageSize:n,expand:[`lines`],order:a,orderBy:o,...s}}});if(l||!c)throw l??Error(`Failed to load invoices`);return c}var oFe=15;async function sFe(e,t,n=6){let r=await aj(e,{page:1,pageSize:n,createdAfter:ij(`3m`),order:`DESC`,orderBy:`periodStart`,customers:[t]}),i=r.items??[];if(i.length===0||i.every(e=>e.customer?.id===t))return r;let a=[],o=1;for(;a.length<n&&o<=oFe;){let r=await aj(e,{page:o,pageSize:30,createdAfter:ij(`3m`),order:`DESC`,orderBy:`periodStart`}),i=r.items??[];if(i.length===0)break;for(let e of i)if(e.customer?.id===t&&(a.push(e),a.length>=n))break;let s=r.pageSize??30,c=Math.max(1,Math.ceil((r.totalCount??0)/s));if(o>=c)break;o++}let s=a.slice(0,n);return{...r,items:s,totalCount:s.length,page:1,pageSize:n}}var oj={orderBy:`createdAt`,order:`DESC`},sj=`/v3/metering/{bucketId}/plans`,cFe=`/v3/metering/{bucketId}/customers`;function lFe(e){if(!e)return;let t={};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.status?.length&&(t.status=e.status),Object.keys(t).length>0?t:void 0}function uFe(e,t){let n=lFe(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function dFe(e){if(!e)return;let t={orderBy:e.orderBy??oj.orderBy,order:e.order??oj.order};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.planKey&&(t.planKey=e.planKey),e.name&&(t.name=e.name),e.key&&(t.key=e.key),e.primaryEmail&&(t.primaryEmail=e.primaryEmail),Object.keys(t).length>0?t:void 0}function fFe(e,t){let n=dFe(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function pFe(e){let t={page:e.page??1,pageSize:e.pageSize??30};return e.includeArchived!=null&&(t.includeArchived=e.includeArchived),t}function mFe(e,t,n){return Array.isArray(e)?{items:e,totalCount:e.length,page:t,pageSize:n}:e}var cj={ai:{providerAssignments:{list:(e,t)=>w_.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/ai-provider-assignments`,{params:{path:{accountName:e,projectName:t}}},{select:e=>e.data})}},deployments:{list:(e,t)=>w_.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/deployments`,{params:{path:{accountName:e,projectName:t}}}),versions:{list:e=>w_.queryOptions(`get`,`/v1/deployments/{deploymentName}/versions`,{params:{path:{deploymentName:e}}})}},mcp:{origins:{list:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/{configurationId}/origins`,{params:{path:e}})},teams:{list:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/teams`,{params:{path:e}})},server:{listTeams:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/{configurationId}/servers/{virtualServerId}/teams`,{params:{path:e}})},servers:{list:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/{configurationId}/servers`,{params:{path:e}})}},metering:{customers:{list:(e,t)=>w_.queryOptions(`get`,cFe,fFe(e,t),t?.page==null?void 0:{placeholderData:r_}),get:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}`,{params:{path:{bucketId:e,customerIdOrKey:t}}}),subscriptions:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}/subscriptions`,{params:{path:{bucketId:e,customerIdOrKey:t}}})},plans:{list:(e,t)=>w_.queryOptions(`get`,sj,uFe(e,t),t?.page==null?void 0:{placeholderData:r_}),get:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/plans/{planId}`,{params:{path:{bucketId:e,planId:t}}}),listByKey:(e,t)=>w_.queryOptions(`get`,sj,{params:{path:{bucketId:e},query:{key:[t]}}})},meters:{list:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/meters`,{params:{path:{bucketId:e}}})},configuration:{get:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/monetization-configuration`,{params:{path:{bucketId:e}}})},features:{list:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:t?{includeArchived:t}:void 0}},{select:e=>Array.isArray(e)?e:e.items}),listPaginated:(e,t)=>{let n=t.page??1,r=t.pageSize??30;return w_.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:pFe(t)}},{select:e=>mFe(e,n,r),placeholderData:r_})}},planInvites:{list:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/plan-invites`,{params:{path:{bucketId:e}}})},billingReadiness:{get:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/billing-readiness`,{params:{path:{bucketId:e}}})},stripe:{setup:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/setup/stripe`,{params:{path:{bucketId:e}}})},subscriptions:{get:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}`,{params:{path:{bucketId:e,subscriptionId:t}}}),access:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}/access`,{params:{path:{bucketId:e,subscriptionId:t}}})},invoices:{list:(e,t,n,r,i,a)=>({queryKey:[`metering`,e,`invoices`,t,n,r??`all`,a,i],queryFn:()=>aj(e,{page:n,pageSize:30,createdAfter:ij(t),order:i,orderBy:a,...r?.length?{statuses:r}:{}}),placeholderData:r_}),forCustomer:(e,t)=>({queryKey:[`metering`,e,`invoices`,`customer`,t],queryFn:()=>sFe(e,t)})}}},hFe=async e=>lj(e,await a(()=>import(`./editor.main-DJeeFilR.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),lj=(e,t)=>{let n=e.split(`.`).pop();if(n)return t.languages.getLanguages().find(e=>e.extensions?.includes(`.${n}`))},uj=e=>{let t=Object.entries(e).flatMap(([e,t])=>t?[[e,t]]:[]);return new URLSearchParams(t).toString()},X={user:{preferences:()=>({url:`${U}/v1/users/me/preferences`})},authApiKey:e=>({url:`${U}/v1/auth/api-keys/${e}`}),authAccountApiKeys:e=>({url:`${U}/v1/auth/api-keys?accountName=${e}`}),authCurrentUserAccountRoles:e=>({url:`${U}/v1/auth/users/me?accountName=${e}`}),authUserAccountRoles:(e,t)=>({url:`${U}/v1/auth/users/${t}?accountName=${e}`}),authProjectUsersRoles:(e,t,{includeInheritedRoles:n}={includeInheritedRoles:!1})=>({url:`${U}/v1/auth/users?accountName=${e}&projectName=${t}&includeInheritedRoles=${n}`}),authAccountUsersRoles:e=>({url:`${U}/v1/auth/users?accountName=${e}`}),mfaFactors:()=>({url:`${U}/v1/mfa/factors`}),accountMemberInviteDetails:e=>({url:`${U}/v1/account-member-invites/${e}`}),accountMemberInvites:e=>({url:`${U}/v1/accounts/${e}/account-member-invites`}),accountAuditLogs:(e,t)=>{let n=new URLSearchParams;t?.limit&&n.append(`limit`,t.limit.toString()),t?.offset&&n.append(`offset`,t.offset.toString()),t?.action&&n.append(`action`,t.action),t?.startDate&&n.append(`startDate`,t.startDate),t?.endDate&&n.append(`endDate`,t.endDate),t?.actor&&n.append(`actor`,t.actor),t?.success!==void 0&&n.append(`success`,t.success.toString());let r=n.toString();return{url:`${U}/v1/accounts/${e}/audit-logs${r?`?${r}`:``}`}},account:e=>({url:`${U}/v1/accounts/${e}`}),accounts:()=>({url:`${U}/v1/accounts`}),accountSourceControlRepoList:e=>({url:`${U}/v1/accounts/${e}/$repo-list`}),accountSourceControlAzureProjects:(e,t)=>({url:`${U}/v1/accounts/${e}/source-control/$azure-projects?organization=${t}`}),accountSourceControlNamespaces:e=>({url:`${U}/v1/accounts/${e}/$namespaces`}),accountSourceControlRepos:(e,t,n)=>({url:`${U}/v1/accounts/${e}/$repos?${new URLSearchParams({namespace:t,query:n??``})}`}),accountsSourceControlConfigurations:()=>({url:`${U}/v1/user/me/source-control-configs`}),accountUsageAnalyticsByDate:(e,t,n)=>({url:`${U}/v1/analytics/${e}/usage?from=${t}&to=${n}&version=2`}),billing:e=>({url:`${U}/v1/accounts/${e}/billings`}),buildLogs:(e,t)=>({url:`${U}/v2/deployments/${e}/build-logs/${t}`}),cdnContent:e=>({url:`${Bf}${e}`}),chatIdentity:()=>({url:`${U}/v1/chat-identity`}),knockIdentity:()=>({url:`${U}/v1/knock-identity`}),bucketConfigurations:e=>({url:`${U}/v1/buckets/${e}/configurations`}),bucketConfigurationTeams:e=>({url:`${U}/v1/buckets/${e}/configurations/teams`}),bucketConfigurationApps:e=>({url:`${U}/v1/buckets/${e}/configurations/apps`}),bucketConfiguration:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}`}),bucketConfigurationUsage:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/usage`}),bucketConfigurationMembers:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members`}),bucketConfigurationMember:(e,t,n)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`}),supportedAiProviders:e=>({url:`${U}/v1/buckets/${e}/providers`}),aiProviderAssignments:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`}),hierarchicalQuota:e=>({url:`${U}/v1/hierarchical-quota/${e}`}),bucketConfigurationRequestCount:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/request-count?${uj({startDate:n,endDate:r,granularity:i})}`}),bucketConfigurationCostUsage:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/cost-usage?${uj({startDate:n,endDate:r,granularity:i})}`}),bucketConfigurationTokenUsage:(e,t,n,r,i,a)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/token-usage?${uj({startDate:n,endDate:r,granularity:i,tokenType:a})}`}),bucketConfigurationTtfb:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/ttfb?${uj({startDate:n,endDate:r,granularity:i})}`}),bucketConfigurationBlocksErrorsWarnings:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/blocks-errors-warnings?${uj({startDate:n,endDate:r,granularity:i})}`}),consumer:(e,t)=>({url:`${U}/v1/api-keys/${e}/consumers/${t}`}),consumersForBucket:(e,t)=>{let n=uj({limit:t?.limit?.toString(),offset:t?.offset?.toString(),name:t?.name,email:t?.email});return{url:`${U}/v1/api-keys/${e}/consumers${n?`?${n}`:``}`}},customDomains:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/custom-domains`}),accountCustomDomains:e=>({url:`${U}/v1/accounts/${e}/custom-domains`}),deploymentVersions:e=>({url:`${U}/v1/deployments/${e}/versions`}),environments:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/deployments`}),environmentVariables:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/environment-variables`}),file:(e,t)=>({url:`${U}/v1/deployments/${e}/fs/file?path=${t}`}),fsStats:e=>({url:`${U}/v1/deployments/${e}/fs/stats`}),gitBranches:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$branches`}),projectSyncStatus:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/sync-status`}),maxRpsAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/max-rps?filter=${t}&limit=10${r?`&${r}`:``}`}},meteringBucket:(e,t)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/`}),meteringPlans:(e,t)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans`}),meteringSubscriptions:(e,t)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/subscriptions`}),meteringSubscriptionQuotas:(e,t,n)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/subscriptions/${n}/quotas`}),primaryAnalytics:(e,t)=>({url:`${U}/v2/deployments/${e}/analytics/metrics?filter=${t}`}),project:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}`}),projects:e=>({url:`${U}/v1/accounts/${e}/projects`}),permissions:(e,t)=>({url:`${U}/v1/permissions/${e}/${t}`}),permissionsProject:(e,t)=>({url:`${U}/v1/permissions/project/${e}|${t}`}),permissionsAiTeam:e=>({url:`${U}/v1/permissions/ai_team/${e}`}),logViewerRequests:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/deployments/${e}/logs/requests?${n}`}},logViewerRequestDetail:(e,t,n)=>{let r=new URLSearchParams;n&&r.append(`timestamp`,n);let i=r.toString();return{url:`${U}/v2/deployments/${e}/logs/requests/${t}${i?`?${i}`:``}`}},logViewerHistogram:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/deployments/${e}/logs/histogram?${n}`}},logViewerFacets:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/deployments/${e}/logs/facets?${n}`}},logViewerRequestsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/logs/requests?${n}`}},logViewerRequestDetailScoped:(e,t,n)=>{let r=new URLSearchParams;return r.append(`account`,e.accountName),e.projectName&&r.append(`project`,e.projectName),e.deploymentName&&r.append(`deploymentName`,e.deploymentName),n&&r.append(`timestamp`,n),{url:`${U}/v2/logs/requests/${t}?${r}`}},logViewerHistogramScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/logs/histogram?${n}`}},logViewerFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/logs/facets?${n}`}},tracesListScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),t.limit&&n.append(`limit`,String(t.limit)),t.cursor&&n.append(`cursor`,t.cursor),{url:`${U}/v2/traces?${n}`}},traceDetailScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),{url:`${U}/v2/traces/${encodeURIComponent(t)}?${n}`}},traceStatsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),{url:`${U}/v2/trace-stats?${n}`}},traceFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.facets&&n.append(`facets`,t.facets),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),{url:`${U}/v2/trace-facets?${n}`}},topRpsAnalytics:(e,t,n,r)=>{let i=uj(r);return{url:`${U}/v2/deployments/${e}/analytics/top-rps?filter=${t}${n?`&sortBy=${n}`:``}&limit=10${i?`&${i}`:``}`}},topRpsByIpAnalytics:(e,t,n,r)=>{let i=uj(r);return{url:`${U}/v2/deployments/${e}/analytics/top-rps-by-ip?filter=${t}${n?`&sortBy=${n}`:``}&limit=10${i?`&${i}`:``}`}},topTenIpAddressesAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-ip-addresses?filter=${t}&limit=10${r?`&${r}`:``}`}},topTenLocationsAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-locations?filter=${t}&limit=10${r?`&${r}`:``}`}},topTenRoutesAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-routes?filter=${t}&limit=10${r?`&${r}`:``}`}},topTenSubsAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-subs?filter=${t}&limit=10${r?`&${r}`:``}`}},usersMe:()=>({url:`${U}/v1/users/me`}),identityConnections:e=>({url:`${U}/v1/accounts/${e}/identity-connections`}),identityConnectionTicket:e=>({url:`${U}/v1/accounts/${e}/identity-connections/ticket`}),mcpBucketConfigurations:e=>({url:`${U}/v1/buckets/${e}/mcp/configurations`}),mcpBucketConfigurationTeam:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams/${t}`}),mcpBucketConfigurationsTeams:e=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams`}),mcpGatewayIdpMetadata:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/${t}/idp-metadata`}),mcpGatewayOrigins:(e,t,n)=>{let r=new URLSearchParams;n?.limit&&r.append(`limit`,n.limit.toString()),n?.offset&&r.append(`offset`,n.offset.toString());let i=r.toString();return{url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/origins${i?`?${i}`:``}`}},mcpGatewayOriginServer:(e,t,n)=>({url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/origins/${n}`}),mcpGatewayVirtualServers:(e,t,n)=>{let r=new URLSearchParams;n?.limit&&r.append(`limit`,n.limit.toString()),n?.offset&&r.append(`offset`,n.offset.toString());let i=r.toString();return{url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/servers${i?`?${i}`:``}`}},mcpGatewayVirtualServer:(e,t,n)=>({url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/servers/${n}`}),mcpGatewayVirtualServerTools:(e,t,n)=>({url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/servers/${n}/tools`}),analyticsRequests:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return e.compare&&t.append(`compare`,`previous`),{url:`${U}/v2/analytics/requests?${t}`}},analyticsRequestsField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/requests/fields/${e}?${n}`}},analyticsConsumers:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/consumers?${t}`}},analyticsAgents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/agents?${t}`}},analyticsAgentsTimeSeries:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/agents/timeseries?${t}`}},analyticsBackend:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/backend?${t}`}},analyticsEdge:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/edge?${t}`}},analyticsAiGateway:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/ai-gateway?${t}`}},analyticsAiGatewayField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/ai-gateway/fields/${e}?${n}`}},analyticsAiGatewayTimeseries:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),t.append(`groupBy`,e.groupBy),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.limitGroups&&t.append(`limitGroups`,e.limitGroups.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/ai-gateway/timeseries?${t}`}},analyticsMcp:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/mcp?${t}`}},analyticsGraphql:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/graphql?${t}`}},analyticsMcpField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/mcp/fields/${e}?${n}`}},analyticsMcpCapabilities:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.view&&t.append(`view`,e.view),e.capabilityType&&t.append(`capabilityType`,e.capabilityType),e.limit&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/mcp/capabilities?${t}`}},analyticsMcpEvents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.limit!=null&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/mcp/events?${t}`}},analyticsMcpBreakdown:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/mcp/breakdowns/${e}?${n}`}},analyticsUsage:e=>{let t=new URLSearchParams;return t.append(`account`,e.accountName),t.append(`from`,e.from),t.append(`to`,e.to),{url:`${U}/v2/analytics/usage?${t}`}}},dj={auth:{createApiKey:e=>({url:`${U}/v1/auth/api-keys`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[X.authAccountApiKeys(e.accountName)],acceptableStatuses:[200]}),deleteApiKey:(e,t)=>({url:`${U}/v1/auth/api-keys/${e}`,method:`DELETE`,invalidateKeys:[X.authApiKey(e),X.authAccountApiKeys(t)],acceptableStatuses:[204]}),updateUsersRole:({userId:e,accountName:t,projectName:n,role:r})=>({url:`${U}/v1/auth/users/${e}`,method:`PATCH`,json:!0,body:JSON.stringify({accountName:t,projectName:n,role:r}),parseResponse:!1,invalidateKeys:n?[X.authProjectUsersRoles(t,n,{includeInheritedRoles:!1}),X.authProjectUsersRoles(t,n,{includeInheritedRoles:!0}),X.authAccountUsersRoles(t)]:[X.authAccountUsersRoles(t)],acceptableStatuses:[201,200]})},accounts:{createAccount:e=>({url:`${U}/v1/accounts`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[X.accounts()],acceptableStatuses:[201]}),deleteAccount:e=>({url:`${U}/v1/accounts/${e.name}`,method:`DELETE`,invalidateKeys:[X.accounts()],acceptableStatuses:[200]}),createCustomDomain:({accountName:e,projectName:t,isAlias:n,hostname:r,deploymentName:i,stage:a})=>({url:`${U}/v1/accounts/${e}/custom-domains`,method:`POST`,body:JSON.stringify({hostname:r,isAlias:n,deploymentName:i,stage:a}),invalidateKeys:[X.accounts(),X.projects(e),X.environments(e,t),X.customDomains(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),deleteAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${U}/v1/accounts/${e}/account-member-invites/${t}`,method:`DELETE`,invalidateKeys:[X.accountMemberInvites(e)],acceptableStatuses:[204]}),deleteCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${U}/v1/accounts/${e}/custom-domains?hostname=${n}&deploymentName=${r}`,method:`DELETE`,invalidateKeys:[X.accounts(),X.projects(e),X.environments(e,t),X.customDomains(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[204]}),editCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${U}/v1/accounts/${e}/custom-domains`,method:`PATCH`,body:JSON.stringify({hostname:n,deploymentName:r}),invalidateKeys:[X.accounts(),X.projects(e),X.environments(e,t),X.customDomains(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),resendAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${U}/v1/accounts/${e}/account-member-invites/${t}/$resend`,method:`PATCH`,body:JSON.stringify({}),invalidateKeys:[X.accountMemberInvites(e)],acceptableStatuses:[201]}),billingUpgrade:(e,t,n,r)=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({successUrl:n,cancelUrl:r}),url:`${U}/v1/accounts/${e}/upgrade/${t}`}),updateAccount:({accountName:e,...t})=>({url:`${U}/v1/accounts/${e}`,method:`PATCH`,body:JSON.stringify(t),json:!0,invalidateKeys:[X.accounts()],acceptableStatuses:[200]})},ai:{createBucketConfiguration:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations`,method:`POST`,json:!0,body:JSON.stringify(t),acceptableStatuses:[201,200],invalidateKeys:[X.bucketConfigurations(e),X.bucketConfigurationTeams(e)]}),updateBucketConfiguration:(e,t,n)=>({url:`${U}/v1/buckets/${e}/configurations/${t}`,method:`PATCH`,json:!0,body:JSON.stringify(n),acceptableStatuses:[200,201],invalidateKeys:[X.bucketConfigurationTeams(e),X.bucketConfiguration(e,t),X.bucketConfigurations(e)]}),deleteBucketConfiguration:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[X.bucketConfigurations(e)]}),createBucketConfigurationMember:(e,t,n,r)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members`,method:`POST`,json:!0,body:JSON.stringify({sub:n,role:r}),acceptableStatuses:[201,200],invalidateKeys:[X.bucketConfiguration(e,t),X.bucketConfigurationMembers(e,t)]}),putBucketConfigurationMemberRole:(e,t,n,r)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PUT`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[204,200],invalidateKeys:[X.bucketConfiguration(e,t),X.bucketConfigurationMembers(e,t),X.bucketConfigurationTeams(e)]}),deleteBucketConfigurationMember:(e,t,n)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[X.bucketConfigurationMembers(e,t)]}),updateBucketConfigurationMember:(e,t,n,r)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PATCH`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[200],invalidateKeys:[X.bucketConfigurationMembers(e,t)]}),createBucketAiProvider:(e,{name:t,baseURL:n,label:r,description:i})=>({url:`${U}/v1/buckets/${e}/providers`,method:`POST`,json:!0,body:JSON.stringify({label:r,baseURL:n,name:t,description:i})}),createAiProviderModel:(e,t,{model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,status:o})=>({url:`${U}/v1/buckets/${e}/providers/${t}/models`,method:`POST`,json:!0,body:JSON.stringify({model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,status:o}),invalidateKeys:[X.supportedAiProviders(e)],acceptableStatuses:[200]}),createAiProviderAssignment:(e,t,n)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`,method:`POST`,body:JSON.stringify({...n,metadata:JSON.stringify(n.metadata)}),headers:{"content-type":`application/json`},invalidateKeys:[X.aiProviderAssignments(e,t)],acceptableStatuses:[201]}),updateAiProviderAssignment:(e,t,n,r)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`PATCH`,body:JSON.stringify({...r,...r.metadata?{metadata:JSON.stringify(r.metadata)}:{}}),headers:{"content-type":`application/json`},invalidateKeys:[X.aiProviderAssignments(e,t)],acceptableStatuses:[200]}),deleteAiProviderAssignment:(e,t,n)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`DELETE`,invalidateKeys:[X.aiProviderAssignments(e,t)],acceptableStatuses:[204]})},projects:{createProject:(e,t,{productType:n,...r}={})=>({url:`${U}/v1/accounts/${e}/projects`,method:`POST`,body:JSON.stringify({name:t,productType:n,options:r}),removeKeys:[X.projects(e)],acceptableStatuses:[201]}),createProjectWithRepo:(e,t,n,r,i)=>({url:`${U}/v1/accounts/${e}/projects/$create-with-repo`,method:`POST`,body:JSON.stringify({projectName:t,orgName:n,repositoryName:r,defaultBranch:i}),removeKeys:[X.projects(e)],acceptableStatuses:[201]}),createProjectFromRepo:(e,t,n,r)=>({url:`${U}/v1/accounts/${e}/projects/$create-from-repo`,method:`POST`,body:JSON.stringify({projectName:t,sourceRepoUrl:n,defaultBranch:r}),removeKeys:[X.projects(e)],acceptableStatuses:[201]}),createRepoFromProject:(e,t,n,r,i,a)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$create-repo`,method:`POST`,body:JSON.stringify({orgName:n,repositoryName:r,defaultBranch:i,otherParams:a}),invalidateKeys:[X.projects(e),X.environments(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),connectProjectToRepo:(e,t,n,r,i,a)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$connect`,method:`PATCH`,body:JSON.stringify({orgName:n,repositoryURL:r,defaultBranch:i,forceConnect:a}),invalidateKeys:[X.projects(e),X.environments(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),disconnectProjectFromRepo:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$disconnect`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[X.projects(e)],acceptableStatuses:[201]}),initProject:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$init`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[X.projects(e)],acceptableStatuses:[201]}),deleteProject:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}`,method:`DELETE`,invalidateKeys:[X.projects(e),cj.deployments.list(e,t).queryKey],removeKeys:[X.environments(e,t)],acceptableStatuses:[204]}),archiveProject:e=>({url:`${U}/v1/deployments/${e}/archive`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200]}),updateDefaultBranch:({accountName:e,projectName:t,defaultBranch:n,sourceRepoUrl:r})=>({url:`${U}/v1/accounts/${e}/projects/${t}/$update-default-branch`,method:`PATCH`,body:JSON.stringify({defaultBranch:n,sourceRepoUrl:r}),headers:{"content-type":`application/json`},invalidateKeys:[X.projects(e),cj.deployments.list(e,t).queryKey],removeKeys:[X.environments(e,t)],acceptableStatuses:[200]})},consumers:{createConsumer:e=>{let t={...e.consumer,accountName:e.accountName,projectName:e.projectName,environmentType:e.environmentType};return{url:`${U}/v1/api-keys/${e.bucketId}/consumers`,method:`POST`,body:JSON.stringify(t),headers:{"content-type":`application/json`},invalidateKeys:[X.consumersForBucket(e.bucketId)],acceptableStatuses:[201]}},updateConsumer:e=>({url:`${U}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`PATCH`,body:JSON.stringify({...e.consumer}),headers:{"content-type":`application/json`},invalidateKeys:[X.consumersForBucket(e.bucketId)],acceptableStatuses:[200]}),removeConsumer:e=>({url:`${U}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`DELETE`,invalidateKeys:[X.consumersForBucket(e.bucketId)]})},environmentVariables:{updateEnvironmentVariable:e=>({url:`${U}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.variableData.id}`,method:`PATCH`,body:JSON.stringify(e.variableData),invalidateKeys:[X.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[200]}),createEnvironmentVariable:e=>({url:`${U}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables`,method:`POST`,body:JSON.stringify(e.variableData),invalidateKeys:[X.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[201]}),deleteEnvironmentVariable:e=>({url:`${U}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.id}`,method:`DELETE`,invalidateKeys:[X.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[204]})},users:{updatePreferences:e=>({url:`${U}/v1/users/me/preferences`,method:`PUT`,invalidateKeys:[X.user.preferences()],body:JSON.stringify({data:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]}),requestVerificationEmail:()=>({url:`${U}/v1/users/me/$send-verification-email`,method:`POST`,invalidateKeys:[],acceptableStatuses:[201]}),enrollMfaFactor:e=>({url:`${U}/v1/mfa/factors/enroll`,method:`POST`,body:JSON.stringify({factor:e}),invalidateKeys:[X.mfaFactors()],acceptableStatuses:[200],json:!0}),deleteMfaEnrollment:e=>({url:`${U}/v1/mfa/factors/enrollments/${e}`,method:`DELETE`,invalidateKeys:[X.mfaFactors()],acceptableStatuses:[200]})},sourceControlCredentials:{tokenExchangeSourceControlCredentials:(e,t,n)=>({url:`${U}/v1/accounts/${e}/source-control-configs/${t}/$token-exchange`,method:`POST`,body:JSON.stringify({code:n}),invalidateKeys:[X.accountsSourceControlConfigurations()],acceptableStatuses:[201]}),revokeSourceControlCredentials:(e,t)=>({url:`${U}/v1/accounts/${e}/source-control-configs/${t}/$revoke-token`,method:`DELETE`,invalidateKeys:[X.accountsSourceControlConfigurations()],acceptableStatuses:[204]})},sourceControlOperations:{commitPush:(e,t,n,r)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$commit-push`,method:`POST`,body:JSON.stringify({branchName:r,commitMessage:n}),acceptableStatuses:[201]}),sync:(e,t,n)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$sync`,method:`POST`,body:JSON.stringify({branchName:n}),acceptableStatuses:[201,200],invalidateKeys:[]})},testDesigner:{makeTestRequest:({environmentName:e,testRequest:t,overrideUrl:n})=>{let r={body:t.body,deployment:e,headers:t.headers,method:t.method,overrideUrl:n,path:t.pathname};return{url:`${Lf}/v1/test`,method:`POST`,body:JSON.stringify(r),acceptableStatuses:[200],headers:{"content-type":`application/json`}}}},featureRequest:{requestFeature:({email:e,featureName:t,information:n})=>{let r={featureName:t,information:{email:e,...n}};return{url:`${U}/v1/feature-access-request`,method:`POST`,body:JSON.stringify(r),acceptableStatuses:[200],headers:{"content-type":`application/json`}}}},fileTransactions:{saveFile:({environmentName:e,file:t})=>{let n={"content-type":`text/plain`};return t.lastModified&&(n[`if-unmodified-since`]=new Date(t.lastModified).toUTCString()),{url:`${U}/v1/deployments/${e}/fs/file?path=${t.path}`,method:`POST`,body:t.content,headers:n,acceptableStatuses:[204,200],invalidateKeys:[X.file(e,t.path),X.deploymentVersions(e),cj.deployments.versions.list(e).queryKey]}},renameFile:({environmentName:e,path:t,newPath:n})=>({url:`${U}/v1/deployments/${e}/fs/file?path=${t}`,method:`PATCH`,body:JSON.stringify({newPath:n}),acceptableStatuses:[204,200],headers:{"content-type":`application/json`},invalidateKeys:[]}),saveMultipleFiles:async({environmentName:e,files:t})=>{let n=new FormData,r={};for(let e of t)if(e.lastModified){let t=`x-if-unmodified-since-${encodeURIComponent(e.path)}`;r[t]=new Date(e.lastModified).toUTCString()}for(let{content:e,path:r}of t){let t=(await hFe(r))?.id;n.append(`files[]`,new File([e??``],r,{type:t===`text/typescript`?`text/javascript`:t}),r)}let i=t.map(({path:t})=>X.file(e,t));return{url:`${U}/v1/deployments/${e}/fs/files`,method:`POST`,body:n,headers:r,acceptableStatuses:[204,200],invalidateKeys:[...i,X.deploymentVersions(e),cj.deployments.versions.list(e).queryKey]}},deleteFile:({environmentName:e,filePath:t})=>({url:`${U}/v1/deployments/${e}/fs/delete?path=${t}`,method:`DELETE`,acceptableStatuses:[204,200]})},directories:{createDirectory:({environmentName:e,path:t})=>({url:`${U}/v1/deployments/${e}/fs/dir?path=${t}`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[201]})},environments:{redeploy:({environmentName:e,isWorkingCopy:t,version:n})=>({url:t?`${U}/v1/deployments/${e}/$redeploy`:`${U}/v1/deployments/${e}/versions/${n}/$redeploy`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200],invalidateKeys:[X.deploymentVersions(e),cj.deployments.versions.list(e).queryKey]}),delete:({environmentName:e})=>({url:`${U}/v1/deployments/${e}`,method:`DELETE`,body:JSON.stringify({}),acceptableStatuses:[200]})},accountInvite:{acceptAccountInvite:e=>({url:`${U}/v1/account-member-invites/${e}`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[X.accounts()],acceptableStatuses:[201]}),createAccountInvite:(e,t,n)=>{let r=n?.project?.name?[X.authProjectUsersRoles(e,n.project.name),n.team?.id?X.bucketConfigurationMembers(n.team?.bucketId,n.team?.id):[],X.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!1}),X.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!0})].flat():[];return{url:`${U}/v1/accounts/${e}/account-member-invites`,method:`POST`,body:JSON.stringify({userEmail:t,metadata:n}),invalidateKeys:[X.accountMemberInvites(e),X.authAccountUsersRoles(e),...r],acceptableStatuses:[201]}}},identity:{chatIdentity:e=>({url:`${U}/v1/chat-identity`,method:`POST`,json:!0,headers:{"content-type":`application/json`},body:JSON.stringify(e),invalidateKeys:[X.chatIdentity()],acceptableStatuses:[200]})},metering:{createMeteringPlan:(e,t,n)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans`,method:`POST`,headers:{"Content-Type":`application/json`},invalidateKeys:[X.meteringPlans(e,t),X.meteringBucket(e,t)],body:JSON.stringify(n)}),deleteMeteringPlan:(e,t,n)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[X.meteringPlans(e,t),X.meteringBucket(e,t)],method:`DELETE`}),updateMeteringPlan:(e,t,{id:n,...r})=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[X.meteringPlans(e,t),X.meteringBucket(e,t)],method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})},mcpGateway:{deleteMcpTeam:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams/${t}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[X.mcpBucketConfigurationsTeams(e)]}),createMcpTeam:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams`,method:`POST`,json:!0,body:JSON.stringify(t),acceptableStatuses:[201,200],invalidateKeys:[X.mcpBucketConfigurationsTeams(e)]}),updateMcpTeam:(e,t,n)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams/${t}`,method:`PATCH`,json:!0,body:JSON.stringify(n),acceptableStatuses:[201,200],invalidateKeys:[X.mcpBucketConfigurations(e),X.mcpBucketConfigurationsTeams(e),X.mcpBucketConfigurationTeam(e,t)]})},logs:{sourcemap:e=>({url:`${U}/v1/logs/sourcemap`,method:`POST`,json:!0,body:JSON.stringify(e),acceptableStatuses:[200]})},identityConnections:{createTicket:e=>({url:`${U}/v1/accounts/${e}/identity-connections/ticket`,method:`POST`,json:!0,body:JSON.stringify({}),invalidateKeys:[X.identityConnections(e)],acceptableStatuses:[200]})},migration:{migrateDevPortal:e=>({url:`${U}/v1/migrate/dev-portal`,method:`POST`,json:!1,body:JSON.stringify({deploymentName:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]})}},fj=e=>{let t=g_(),n=Vg(),r=Poe();return{fetch:async i=>{let a=Jf(),o;try{o=await Zse(t=>{let n=new Headers(i.headers);return i.json&&i.method!==`DELETE`&&n.set(`content-type`,`application/json`),n.set(`authorization`,`Bearer ${t}`),n.set(`zuplo-request-id`,a),fetch(i.url,{...e,method:i.method,headers:n,body:i.body})},n,r)}catch(e){throw e instanceof Ff&&e.setTraceId(a),e instanceof TypeError?new Pf({type:`https://zup.fail/api-request-failed`,title:`API request failed`,status:500,instance:i.url,traceId:a}):e}if(!(i.acceptableStatuses??[200]).includes(o.status)){let e=new Ff(`Unexpected response: ${o.status} calling ${i.method}: ${i.url}`,{traceId:a});throw await e.tryReadResponse(o),e}return i.invalidateKeys?.forEach(e=>{if(Array.isArray(e))t.invalidateQueries({queryKey:e,exact:!1});else if(`url`in e&&e.url){let n=e.url.split(`?`)[0];t.invalidateQueries({predicate:e=>{let t=e.queryKey[0];return typeof t==`string`&&t.split(`?`)[0]===n}})}}),i.removeKeys?.forEach(e=>{t.removeQueries({queryKey:[e.url]})}),i.parseResponse===!1?o:i.json?await o.json():o}}},gFe=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.directories.createDirectory(t))})},_Fe=`API request failed`;async function pj(e,t,n={}){let{text:r,extractData:i}=n;if(!e||typeof e!=`string`)throw new Pf({type:`https://zup.fail/missing-url`,title:`Missing URL`});let a=Jf(),o;try{o=await Zse(t=>{let n=new Request(e);return n.headers.set(`authorization`,`Bearer ${t}`),n.headers.set(`zuplo-request-id`,a),fetch(n)},t,()=>{Zf().then(({handleLogout:e})=>e())})}catch(t){throw t instanceof TypeError?new Pf({type:`https://zup.fail/api-request-failed`,title:_Fe,instance:e,traceId:a},{cause:t}):(t instanceof Ff&&t.setTraceId(a),t)}if(!o.ok){let e=new Ff(`Error while making request. Please try again or contact support if the problem persists.`,{traceId:a});throw await e.tryReadResponse(o),e}try{let e=r?await o.clone().text():await o.clone().json();return i?e.data:e}catch(t){let n=await o.clone().text();throw wf.captureException(t,{message:`Failed to parse response of ${e} to JSON`,responseText:n,status:o.status,traceId:a,requestUrl:e}),t}}function vFe(e,t={}){let n=Vg();return qse({queries:e.map(e=>({queryKey:[e.url,t.extractData],queryFn:()=>pj(e.url,n,t)}))})}function mj(e,{text:t,extractData:n=!0,...r}={}){let i=Vg();return x_({queryKey:[e.url,n],queryFn:async({queryKey:e})=>{let[r]=e;return pj(r,i,{text:t,extractData:n})},...r})}function hj(e,{enabled:t,text:n,extractData:r,...i}={}){let a=Vg();return b_({enabled:t,queryKey:[e.url,r],queryFn:async({queryKey:e})=>{let[t]=e;return pj(t,a,{text:n,extractData:r})},...i})}var gj={".ts":`typescript`,".tsx":`typescript`,".js":`javascript`,".jsx":`javascript`,".mjs":`javascript`,".cjs":`javascript`,".json":`json`,".html":`html`,".htm":`html`,".xml":`xml`,".svg":`xml`,".yaml":`yaml`,".yml":`yaml`,".md":`markdown`,".mdx":`markdown`,".css":`css`,".scss":`scss`,".sass":`sass`,".less":`less`,".py":`python`,".rs":`rust`,".go":`go`,".java":`java`,".c":`c`,".cpp":`cpp`,".cs":`csharp`,".php":`php`,".rb":`ruby`,".sh":`shell`,".bash":`shell`,".zsh":`shell`,".sql":`sql`,".graphql":`graphql`,".gql":`graphql`,".env":`plaintext`,".toml":`toml`,".ini":`ini`,".properties":`properties`,".dockerfile":`dockerfile`,Dockerfile:`dockerfile`,".makefile":`makefile`,Makefile:`makefile`};function _j(e){let t=e.split(`/`).pop()||``;if(gj[t])return gj[t];let n=t.lastIndexOf(`.`);return n===-1?`plaintext`:gj[t.slice(n)]||`plaintext`}var yFe=(e,t,n)=>hj(X.file(e,t),{...n,text:!0,select:e=>({content:e,contentType:`text/plain`,language:_j(t),path:t})}),vj=()=>{let e=fj();return S_({mutationFn:async t=>{let n=await e.fetch({...dj.fileTransactions.saveFile(t),parseResponse:!1}),r=n.headers.get(`Last-Modified`),i=r?new Date(r).getTime():void 0;return{...await n.json(),lastModified:i}}})},yj=e=>{let t=fj();return S_({mutationFn:async e=>{if(!e.environmentName||!e.files)throw Error(`No environment name or files provided`);return await(await t.fetch(await dj.fileTransactions.saveMultipleFiles(e))).json()},mutationKey:yj.mutationKey,...e})};yj.mutationKey=[`saveStatus`];var bFe=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.fileTransactions.deleteFile(t))})},xFe=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.fileTransactions.renameFile(t))})},bj=null,xj=null;function SFe(){return xj??=a(()=>import(`./editor.main-DJeeFilR.js`).then(e=>(bj=e,e)),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),xj}function Sj(){let[e,t]=(0,g.useState)(bj);return(0,g.useEffect)(()=>{if(bj){t(bj);return}let e=!0;return SFe().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}function Cj(e,t,n){let r=(0,g.useRef)(!1);(0,g.useEffect)(()=>{if(!e)return;if(!r.current){r.current=!0;return}let i=requestAnimationFrame(()=>{if(n.current)try{e.editor.setTheme(t)}catch{}});return()=>cancelAnimationFrame(i)},[e,t,n])}var wj={display:`flex`,position:`relative`,textAlign:`initial`};function CFe({value:e,defaultValue:t,language:n,defaultLanguage:r,path:i,theme:a=`vs`,line:o,options:s={},overrideServices:c,onChange:l,onMount:u,beforeMount:d,className:f,width:p=`100%`,height:m=`100%`,keepCurrentModel:h=!1,wrapperProps:_}){let v=Sj(),y=(0,g.useRef)(null),b=(0,g.useRef)(null),x=(0,g.useRef)(l);x.current=l;let S=(0,g.useRef)(h);S.current=h;let C=(0,g.useRef)(!1);return(0,g.useEffect)(()=>{if(!v)return;let l=y.current;if(!l)return;d?.(v);let f=i?v.Uri.parse(i):void 0,p=f&&v.editor.getModel(f)||v.editor.createModel(e??t??``,n??r,f),m=v.editor.create(l,{...s,model:p,theme:a},c);b.current=m,o!=null&&m.revealLine(o);let h=m.onDidChangeModelContent(e=>{C.current||x.current?.(m.getValue(),e)});return u?.(m,v),()=>{h.dispose();let e=m.getModel();m.dispose(),S.current||e?.dispose(),b.current=null}},[v]),(0,g.useEffect)(()=>{let t=b.current;if(!t||e===void 0)return;let n=t.getModel();!n||e===n.getValue()||(C.current=!0,t.executeEdits(``,[{range:n.getFullModelRange(),text:e,forceMoveMarkers:!0}]),t.pushUndoStop(),C.current=!1)},[e]),(0,g.useEffect)(()=>{let e=b.current?.getModel();v&&e&&n&&v.editor.setModelLanguage(e,n)},[v,n]),Cj(v,a,b),(0,g.useEffect)(()=>{b.current?.updateOptions(s)},[s]),(0,g.useEffect)(()=>{o!=null&&b.current?.revealLine(o)},[o]),(0,W.jsx)(`section`,{..._,style:{...wj,width:p,height:m},children:(0,W.jsx)(`div`,{ref:y,className:f,style:{width:`100%`}})})}function wFe({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,theme:a=`vs`,options:o={},onMount:s,beforeMount:c,className:l,width:u=`100%`,height:d=`100%`,keepCurrentOriginalModel:f=!1,keepCurrentModifiedModel:p=!1,wrapperProps:m}){let h=Sj(),_=(0,g.useRef)(null),v=(0,g.useRef)(null),y=(0,g.useRef)(f);y.current=f;let b=(0,g.useRef)(p);return b.current=p,(0,g.useEffect)(()=>{if(!h)return;let l=_.current;if(!l)return;c?.(h);let u=h.editor.createDiffEditor(l,{...o,theme:a});return v.current=u,u.setModel({original:h.editor.createModel(e??``,r??n),modified:h.editor.createModel(t??``,i??n)}),s?.(u,h),()=>{let e=u.getModel();u.dispose(),y.current||e?.original.dispose(),b.current||e?.modified.dispose(),v.current=null}},[h]),(0,g.useEffect)(()=>{let t=v.current?.getModel();t&&e!=null&&e!==t.original.getValue()&&t.original.setValue(e)},[e]),(0,g.useEffect)(()=>{let e=v.current?.getModel();e&&t!=null&&t!==e.modified.getValue()&&e.modified.setValue(t)},[t]),Cj(h,a,v),(0,W.jsx)(`section`,{...m,style:{...wj,width:u,height:d},children:(0,W.jsx)(`div`,{ref:_,className:l,style:{width:`100%`}})})}var Tj=(e=[])=>{let t=On(),n=Object.keys(t);if(e.some(e=>!n.includes(e)))throw Error(`${e.join(`, `)} are required`);return t};function Ej(e,t){let n=t.map(e=>e.fileGlob),r=t.flatMap(e=>{let t=[e.folderName];return e.subdirectoryGlob?t.concat(e.subdirectoryGlob):t});return e.filter(e=>e.type===Qr.Directory&&r.some(t=>JA(e.path,t))?!0:n.find(t=>JA(e.path,t))!==void 0)}function TFe(e,t){return(0,g.useCallback)(async()=>Ej(await tp(t,`/`),e),[t,e])}function Dj(){let{logEvent:e}=Rg(),t=Fj(),n=lh(),r=ch(e=>e.showSaveConflict);return yj({onMutate:({files:e})=>{e.forEach(e=>{t({...e,saveState:$r.saving})})},onSuccess:async(e,{files:n})=>{n.forEach(n=>{let r=e.files?.[n.path];kf.debug(`Updated ${n.path} after save - lastModified: ${r}`),t({...n,lastModified:r,saveState:$r.unmodified})})},onError:(i,{files:a})=>{if(i instanceof Error&&`status`in i&&i.status===412){let e=i;if(e.instance)try{let t=JSON.parse(e.instance).conflictedFiles;t&&t.length>0&&r(t[0])}catch(e){kf.error(`Failed to parse conflict error instance data`,{error:e})}return}a.forEach(e=>{t({...e,saveState:$r.modified})}),e(`file-save-failed`,{fileNames:n.map(e=>e.path).join(`, `)})}})}function Oj(){let e=oh(),{logEvent:t,captureException:n}=Rg(),r=Pj(),i=Fj(),a=bFe(),{isReadOnly:o}=NA(),{execute:s}=jA(async s=>{if(o)return{success:!1,error:Error(`Unable to delete file - environment is read-only`)};let c=s.saveState;i({...s,saveState:$r.removing});try{return await a.mutateAsync({environmentName:e.environment.name,filePath:s.path}),r(s.path),t(`file-deleted`,{fileName:s.path,account:e.account.name,project:e.project.name,environment:e.environment.name}),{success:!0}}catch(r){return t(`file-deletion-failed`,{account:e.account.name,project:e.project.name,environment:e.environment.name}),n(r),i({...s,saveState:c}),{success:!1,error:r}}});return s}function kj(){let e=Sj(),{logEvent:t,captureException:n}=Rg(),r=Fj(),i=ch(e=>e.projectTreeNodes),a=vj(),o=oh([`account`,`project`,`environment`]),{execute:s}=jA(async(s,c,l,u,d)=>{if(!e)return;let f=l??u.defaultFileTemplate,p=u.createExtensions[f],m=`${c}/${!p||s.toLowerCase().endsWith(`.${p}`)||s===u.predefinedTemplateFilename?.[f]?s:`${s}.${p}`}`,h=(l&&u.newFileTemplates[l]?.trimStart())??d??``,g=i.find(e=>e.path===m);if(g)return g;if(i.length===0){let e=(await tp(o.environment.name,c).catch(()=>[])).find(e=>e.path===m);if(e)return e}let _={content:h,path:m},v={saveState:$r.new,type:Qr.File,..._};try{r(v),e.editor.createModel(_.content??``,void 0,e.Uri.file(m));let n=await a.mutateAsync({environmentName:o.environment.name,file:_,accountName:o.account.name,projectName:o.project.name});return r({...v,lastModified:n.lastModified,saveState:$r.unmodified}),t(`file-added`,{account:o.account.name,project:o.project.name,environment:o.environment.name,fileName:v.path,strategy:u.name}),_}catch(e){t(`file-creation-failed`,{environment:o.environment.name}),n(e),r({...v,saveState:$r.modified});return}});return s}function EFe(e){let t=Sj(),{logEvent:n,captureException:r}=Rg(),i=Tj([`account`,`project`]),a=Fj(),o=Pj(),s=xFe(),{execute:c}=jA(async(c,l)=>{if(t)try{a({...c,saveState:$r.removing}),await s.mutateAsync({environmentName:e,path:c.path,newPath:l}),a({...c,saveState:$r.new,path:l}),t.editor.createModel(c.content??``,void 0,t.Uri.file(l));let r=t.editor.getModel(t.Uri.file(c.path));a({...c,path:l}),r?.dispose(),o(c.path),n(`file-renamed`,{fileName:c.path,environment:e})}catch(t){n(`file-rename-failed`,{account:i.account,project:i.project,environment:e}),r(t),a({...c,saveState:$r.unmodified});return}});return c}function DFe(e){let t=Sj(),{logEvent:n,captureException:r}=Rg(),i=Fj(),a=gFe(),{execute:o}=jA(async(o,s,c)=>{if(!t)return Error(`Failed to acquire monaco instance. Please refresh the page.`);let l=`${s}/${o}`,u={path:l},d={saveState:$r.new,type:Qr.Directory,...u};try{return i(d),await a.mutateAsync({environmentName:e,path:l}),i({...d,saveState:$r.unmodified}),n(`directory-added`,{fileName:d.path,strategy:c.name,environment:e}),u}catch(t){return n(`directory-creation-failed`,{environment:e}),r(t),i({...d,saveState:$r.modified}),t}});return o}function Aj(){return Mj(PA().get(`path`))}function jj(){let e=Sj(),t=Fj();return(0,g.useCallback)((n,r=!1,i=$r.modified)=>{if(t({...n,saveState:i}),r&&e){let t=e.editor.getModel(e.Uri.file(n.path));t&&t.setValue(n.content??``)}},[e,t])}function Mj(e){return ch(t=>e?t.filesByPath[e]:void 0)}function OFe(e){let t=ch(e=>e.projectTreeNodes),n=[],r=Object.values(e);return t.filter(e=>e.type===Qr.Directory).forEach(e=>{let t=r.find(t=>t.folderName===e.path);if(t)return n.push(t)}),r.sort((e,t)=>e.order-t.order)}function Nj(e){return ch(e=>e.projectTreeNodes).filter(t=>!t.path&&!e.fileGlob?!1:t.type===Qr.Directory&&e.subdirectoryGlob?JA(t.path,e.subdirectoryGlob):JA(t.path,e.fileGlob))}function Pj(){let e=Sj(),t=ch(e=>e.removeFile),n=ch(e=>e.filterProjectTreeNodes);return r=>{e&&e.editor.getModel(e.Uri.file(r))?.dispose(),t(r),n(e=>e.path!==r)}}function Fj(){return ch(e=>e.updateFile)}var kFe=e=>{let t=jj(),n=Mj(e);return e=>{n&&t(n,!0,e)}};function Ij(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Lj(e){return`$import(${e})`}function AFe(e){let t=e.split(`/`).pop();return t?t.replace(`.ts`,``):``}function Rj(e,t){let n=/\$import\((.*?)\)/g.exec(e);if(!n||n.length!==2)return`INVALID IMPORT STATEMENT`;let r=n[1];return t!==void 0&&r.indexOf(t)===0?r.substring(t.length):r}var zj=e=>{let t=``;switch(e){case`GITLAB`:t=`GitLab`;break;case`GITHUB`:t=`GitHub`;break;case`BITBUCKET`:t=`Bitbucket`;break;case`AZURE`:t=`Azure DevOps`;break;default:t=e;break}return t},jFe=(e,t)=>{let n=t.accounts.filter(t=>t.name===e),r;if(n[0].sourceControlConfigurations&&n[0].sourceControlConfigurations.length>0)r=n[0].sourceControlConfigurations[0];else{let e=t.global.filter(e=>e.provider===n[0].sourceControlProvider);r=e.length>0?e[0]:null}return r};function Bj(e){if(!e)return``;if(typeof e==`object`){if(e instanceof Ff)return e.detail??e.title??e.message;if(`message`in e)return e.message}return typeof e==`string`?e:``}var Vj=({error:e,size:t=24})=>{switch(e.status){case 401:return(0,W.jsx)(Um,{size:t});case 403:return(0,W.jsx)(vre,{size:t});case 404:return(0,W.jsx)(kre,{size:t});default:return(0,W.jsx)(ym,{size:t})}},MFe=({error:e})=>(0,W.jsx)(`div`,{className:`flex items-center gap-2 rounded-full border-2 border-neutral-100 bg-neutral-50 text-neutral-300 p-4`,children:(0,W.jsx)(Vj,{error:e})}),NFe=({error:e})=>{switch(e.status){case 401:return(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/accounts/managing-account-members`,children:`Learn more about Managing Account Members`});default:return null}},PFe=({error:e,title:t=`Unable to access`,children:n,className:r,variant:i=`default`})=>(0,W.jsxs)(jS,{variant:i,className:G(`w-full flex items-center gap-8`,r),children:[(0,W.jsx)(MFe,{error:e}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(MS,{children:t}),(0,W.jsxs)(NS,{className:`flex flex-col gap-2`,children:[Bj(e),(0,W.jsx)(NFe,{error:e}),n]})]})]}),Hj=({successMessage:e}={})=>{let t=ah();return{onSuccess:n=>{t.success(n??e,{icon:(0,W.jsx)(mm,{size:18})})},onError:e=>t.error(Bj(e),{icon:e instanceof Ff?(0,W.jsx)(Vj,{error:e,size:18}):(0,W.jsx)(ym,{size:18})})}},Uj=(e,t,n)=>b_({...cj.deployments.list(e,t),...n,select:e=>e.data}),Wj=(e,t={})=>Jse({...cj.deployments.versions.list(e),...t,select:e=>({...e,data:e.data?.map(e=>({...e,stages:[...e.stages].sort((e,t)=>e.stage.localeCompare(t.stage))}))})}),Gj=(e,t={})=>x_(Wj(e,t)),FFe=()=>{let e=oh(),t=Dj(),n=lh();return Gj(e.environment.name),{isPending:t.isPending,isSuccess:t.isSuccess,saveAndDeploy:(0,g.useCallback)(async()=>t.mutateAsync({environmentName:e.environment.name,accountName:e.account.name,projectName:e.project.name,files:n}).catch(e=>{if(!(e instanceof Error&&`status`in e&&e.status===409))throw e}),[t,n,!1,e.environment.name,e.account.name,e.project.name])}},IFe=(e={})=>{let{isReadOnly:t=!1,onSave:n}=e,{saveAndDeploy:r,isPending:i,isSuccess:a}=FFe(),[o,s]=(0,g.useState)(null),c=ch(e=>{let t=0;for(let n of e.projectTreeNodes){let r=n.path?e.filesByPath[n.path]:void 0;r&&r.saveState===$r.modified&&t++}return t}),l=ch(e=>{let t=0;for(let n of e.projectTreeNodes){let r=n.path?e.filesByPath[n.path]:void 0;r&&(r.saveState===$r.modified||r.saveState===$r.saving)&&t++}return t}),u=(0,g.useRef)(null),d=e=>{s(e),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{s(null)},1600)},f=AA(r),p=AA(n),m=ih(e=>e.addToast),h=(0,g.useRef)(!1),_=(0,g.useRef)(!1);return(0,g.useEffect)(()=>{let e=h.current;!e&&i?_.current=l>0:e&&!i&&a&&_.current&&(m({message:`Changes saved`,icon:(0,g.createElement)(mm,{size:18}),duration:2e3}),_.current=!1),h.current=i},[i,a,l,m]),(0,g.useEffect)(()=>{let e=async e=>{try{if(e.code===`KeyS`&&(e.metaKey||e.ctrlKey)){if(e.preventDefault(),t){d(`Read only environment`);return}let n=document.activeElement;if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement){let e=n.selectionEnd;n.blur(),n.focus(),(n instanceof HTMLInputElement&&n.type!==`checkbox`||n instanceof HTMLTextAreaElement)&&n.setSelectionRange(e,e),await yPe(100)}if(c===0){d(`No unsaved changes`);return}p.current?.(),await f.current()}}catch(e){kf.error(`Error saving files`,{error:e}),s(`Error saving files`)}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,c,f,p]),{showTooltip:o,isSaving:i,unsavedChangesCount:c,saveAll:r}},LFe=()=>{let{showTooltip:e,saveAll:t,isSaving:n,unsavedChangesCount:r}=IFe(),{hasEditor:i,editorName:a,isLoading:o,showPreferenceDialog:s,setShowPreferenceDialog:c,availableEditors:l,savePreference:u,openInEditor:d}=vPe();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`sticky bottom-0 h-12 border-t bg-surface-sunken items-center flex px-2 gap-x-2`,children:[(0,W.jsx)(Ck,{open:!!e,content:e??``,children:(0,W.jsx)(Y,{variant:r>0||n?`default`:`ghost`,size:`sm`,className:`text-xs`,"data-test":`save`,disabled:n,onClick:async()=>{await t()},children:(0,W.jsxs)(Tk,{className:`flex items-center gap-1 text-xs relative`,loading:n,children:[`Save`,(0,W.jsx)(`span`,{className:r>0?`text-white`:`text-muted-foreground`,children:`[⌘+S]`})]})})}),!o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`h-6 w-px bg-border`}),(0,W.jsx)(Ck,{content:i?`Open in ${a}`:`Choose editor to open files`,children:(0,W.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:d,className:`text-xs`,children:[(0,W.jsx)(Am,{size:14}),`Open in Editor`]})})]})]}),(0,W.jsx)(_Pe,{open:s,editors:l,onSelect:u,onCancel:()=>c(!1)})]})},Kj=(0,g.createContext)(null);Kj.displayName=`PanelGroupContext`;var qj={group:`data-panel-group`,groupDirection:`data-panel-group-direction`,groupId:`data-panel-group-id`,panel:`data-panel`,panelCollapsible:`data-panel-collapsible`,panelId:`data-panel-id`,panelSize:`data-panel-size`,resizeHandle:`data-resize-handle`,resizeHandleActive:`data-resize-handle-active`,resizeHandleEnabled:`data-panel-resize-handle-enabled`,resizeHandleId:`data-panel-resize-handle-id`,resizeHandleState:`data-resize-handle-state`},Jj=10,Yj=g.useLayoutEffect,Xj=g.useId,RFe=typeof Xj==`function`?Xj:()=>null,zFe=0;function Zj(e=null){let t=RFe(),n=(0,g.useRef)(e||t||null);return n.current===null&&(n.current=``+ zFe++),e??n.current}function Qj({children:e,className:t=``,collapsedSize:n,collapsible:r,defaultSize:i,forwardedRef:a,id:o,maxSize:s,minSize:c,onCollapse:l,onExpand:u,onResize:d,order:f,style:p,tagName:m=`div`,...h}){let _=(0,g.useContext)(Kj);if(_===null)throw Error(`Panel components must be rendered within a PanelGroup container`);let{collapsePanel:v,expandPanel:y,getPanelSize:b,getPanelStyle:x,groupId:S,isPanelCollapsed:C,reevaluatePanelConstraints:w,registerPanel:T,resizePanel:E,unregisterPanel:D}=_,O=Zj(o),k=(0,g.useRef)({callbacks:{onCollapse:l,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:s,minSize:c},id:O,idIsFromProps:o!==void 0,order:f});(0,g.useRef)({didLogMissingDefaultSizeWarning:!1}),Yj(()=>{let{callbacks:e,constraints:t}=k.current,a={...t};k.current.id=O,k.current.idIsFromProps=o!==void 0,k.current.order=f,e.onCollapse=l,e.onExpand=u,e.onResize=d,t.collapsedSize=n,t.collapsible=r,t.defaultSize=i,t.maxSize=s,t.minSize=c,(a.collapsedSize!==t.collapsedSize||a.collapsible!==t.collapsible||a.maxSize!==t.maxSize||a.minSize!==t.minSize)&&w(k.current,a)}),Yj(()=>{let e=k.current;return T(e),()=>{D(e)}},[f,O,T,D]),(0,g.useImperativeHandle)(a,()=>({collapse:()=>{v(k.current)},expand:e=>{y(k.current,e)},getId(){return O},getSize(){return b(k.current)},isCollapsed(){return C(k.current)},isExpanded(){return!C(k.current)},resize:e=>{E(k.current,e)}}),[v,y,b,C,O,E]);let A=x(k.current,i);return(0,g.createElement)(m,{...h,children:e,className:t,id:O,style:{...A,...p},[qj.groupId]:S,[qj.panel]:``,[qj.panelCollapsible]:r||void 0,[qj.panelId]:O,[qj.panelSize]:parseFloat(``+A.flexGrow).toFixed(1)})}var $j=(0,g.forwardRef)((e,t)=>(0,g.createElement)(Qj,{...e,forwardedRef:t}));Qj.displayName=`Panel`,$j.displayName=`forwardRef(Panel)`;var BFe;function VFe(){return BFe}var eM=null,HFe=!0,tM=-1,nM=null;function UFe(e,t){if(t){let e=(t&fM)!==0,n=(t&pM)!==0,r=(t&mM)!==0,i=(t&hM)!==0;if(e)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}switch(e){case`horizontal`:return`ew-resize`;case`intersection`:return`move`;case`vertical`:return`ns-resize`}}function WFe(){nM!==null&&(document.head.removeChild(nM),eM=null,nM=null,tM=-1)}function rM(e,t){if(!HFe)return;let n=UFe(e,t);if(eM!==n){if(eM=n,nM===null){nM=document.createElement(`style`);let e=VFe();e&&nM.setAttribute(`nonce`,e),document.head.appendChild(nM)}if(tM>=0){var r;(r=nM.sheet)==null||r.removeRule(tM)}tM=nM.sheet?.insertRule(`*{cursor: ${n} !important;}`)??-1}}function iM(e){return e.type===`keydown`}function aM(e){return e.type.startsWith(`pointer`)}function oM(e){return e.type.startsWith(`mouse`)}function sM(e){if(aM(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(oM(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function GFe(){if(typeof matchMedia==`function`)return matchMedia(`(pointer:coarse)`).matches?`coarse`:`fine`}function KFe(e,t,n){return n?e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y:e.x<=t.x+t.width&&e.x+e.width>=t.x&&e.y<=t.y+t.height&&e.y+e.height>=t.y}function qFe(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:uM(e),b:uM(t)},r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;AM(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:lM(cM(n.a)),b:lM(cM(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var JFe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function YFe(e){let t=getComputedStyle(dM(e)??e).display;return t===`flex`||t===`inline-flex`}function XFe(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||YFe(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||JFe.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function cM(e){let t=e.length;for(;t--;){let n=e[t];if(AM(n,`Missing node`),XFe(n))return n}return null}function lM(e){return e&&Number(getComputedStyle(e).zIndex)||0}function uM(e){let t=[];for(;e;)t.push(e),e=dM(e);return t}function dM(e){let{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}var fM=1,pM=2,mM=4,hM=8,ZFe=GFe()===`coarse`,gM=[],_M=!1,vM=new Map,yM=new Map,bM=new Set;function QFe(e,t,n,r,i){let{ownerDocument:a}=t,o={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:i},s=vM.get(a)??0;return vM.set(a,s+1),bM.add(o),OM(),function(){yM.delete(e),bM.delete(o);let t=vM.get(a)??1;if(vM.set(a,t-1),OM(),t===1&&vM.delete(a),gM.includes(o)){let e=gM.indexOf(o);e>=0&&gM.splice(e,1),EM(),i(`up`,!0,null)}}}function $Fe(e){let{target:t}=e,{x:n,y:r}=sM(e);_M=!0,wM({target:t,x:n,y:r}),OM(),gM.length>0&&(kM(`down`,e),e.preventDefault(),CM(t)||e.stopImmediatePropagation())}function xM(e){let{x:t,y:n}=sM(e);if(_M&&e.buttons===0&&(_M=!1,kM(`up`,e)),!_M){let{target:r}=e;wM({target:r,x:t,y:n})}kM(`move`,e),EM(),gM.length>0&&e.preventDefault()}function SM(e){let{target:t}=e,{x:n,y:r}=sM(e);yM.clear(),_M=!1,gM.length>0&&(e.preventDefault(),CM(t)||e.stopImmediatePropagation()),kM(`up`,e),wM({target:t,x:n,y:r}),EM(),OM()}function CM(e){let t=e;for(;t;){if(t.hasAttribute(qj.resizeHandle))return!0;t=t.parentElement}return!1}function wM({target:e,x:t,y:n}){gM.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),bM.forEach(e=>{let{element:i,hitAreaMargins:a}=e,o=i.getBoundingClientRect(),{bottom:s,left:c,right:l,top:u}=o,d=ZFe?a.coarse:a.fine;if(t>=c-d&&t<=l+d&&n>=u-d&&n<=s+d){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&qFe(r,i)>0){let e=r,t=!1;for(;e&&!e.contains(i);){if(KFe(e.getBoundingClientRect(),o,!0)){t=!0;break}e=e.parentElement}if(t)return}gM.push(e)}})}function TM(e,t){yM.set(e,t)}function EM(){let e=!1,t=!1;gM.forEach(n=>{let{direction:r}=n;r===`horizontal`?e=!0:t=!0});let n=0;yM.forEach(e=>{n|=e}),e&&t?rM(`intersection`,n):e?rM(`horizontal`,n):t?rM(`vertical`,n):WFe()}var DM=new AbortController;function OM(){DM.abort(),DM=new AbortController;let e={capture:!0,signal:DM.signal};bM.size&&(_M?(gM.length>0&&vM.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`contextmenu`,SM,e),r.addEventListener(`pointerleave`,xM,e),r.addEventListener(`pointermove`,xM,e))}),window.addEventListener(`pointerup`,SM,e),window.addEventListener(`pointercancel`,SM,e)):vM.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`pointerdown`,$Fe,e),r.addEventListener(`pointermove`,xM,e))}))}function kM(e,t){bM.forEach(n=>{let{setResizeHandlerState:r}=n;r(e,gM.includes(n),t)})}function eIe(){let[e,t]=(0,g.useState)(0);return(0,g.useCallback)(()=>t(e=>e+1),[])}function AM(e,t){if(!e)throw console.error(t),Error(t)}function jM(e,t,n=Jj){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function MM(e,t,n=Jj){return jM(e,t,n)===0}function NM(e,t,n){return jM(e,t,n)===0}function tIe(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],a=t[r];if(!NM(i,a,n))return!1}return!0}function PM({panelConstraints:e,panelIndex:t,size:n}){let r=e[t];AM(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,maxSize:o=100,minSize:s=0}=r;if(jM(n,s)<0)if(a){let e=(i+s)/2;n=jM(n,e)<0?i:s}else n=s;return n=Math.min(o,n),n=parseFloat(n.toFixed(Jj)),n}function FM({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(NM(e,0))return t;let o=[...t],[s,c]=r;AM(s!=null,`Invalid first pivot index`),AM(c!=null,`Invalid second pivot index`);let l=0;if(a===`keyboard`){{let r=e<0?c:s,i=n[r];AM(i,`Panel constraints not found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(AM(n!=null,`Previous layout not found for panel index ${r}`),NM(n,a)){let t=l-n;jM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?s:c,i=n[r];AM(i,`No panel constraints found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(AM(n!=null,`Previous layout not found for panel index ${r}`),NM(n,l)){let t=n-a;jM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,i=e<0?c:s,a=0;for(;;){let e=t[i];AM(e!=null,`Previous layout not found for panel index ${i}`);let o=PM({panelConstraints:n,panelIndex:i,size:100})-e;if(a+=o,i+=r,i<0||i>=n.length)break}let o=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-o:o}{let r=e<0?s:c;for(;r>=0&&r<n.length;){let i=Math.abs(e)-Math.abs(l),a=t[r];AM(a!=null,`Previous layout not found for panel index ${r}`);let s=a-i,c=PM({panelConstraints:n,panelIndex:r,size:s});if(!NM(a,c)&&(l+=a-c,o[r]=c,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(tIe(i,o))return i;{let r=e<0?c:s,i=t[r];AM(i!=null,`Previous layout not found for panel index ${r}`);let a=i+l,u=PM({panelConstraints:n,panelIndex:r,size:a});if(o[r]=u,!NM(u,a)){let t=a-u,r=e<0?c:s;for(;r>=0&&r<n.length;){let i=o[r];AM(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=PM({panelConstraints:n,panelIndex:r,size:a});if(NM(i,s)||(t-=s-i,o[r]=s),NM(t,0))break;e>0?r--:r++}}}return NM(o.reduce((e,t)=>t+e,0),100)?o:i}function nIe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,a=0,o=0,s=n[0];return AM(s!=null,`No pivot index found`),t.forEach((e,t)=>{let{constraints:n}=e,{maxSize:c=100,minSize:l=0}=n;t===s?(r=l,i=c):(a+=l,o+=c)}),{valueMax:Math.min(i,100-a),valueMin:Math.max(r,100-o),valueNow:e[s]}}function IM(e,t=document){return Array.from(t.querySelectorAll(`[${qj.resizeHandleId}][data-panel-group-id="${e}"]`))}function LM(e,t,n=document){return IM(e,n).findIndex(e=>e.getAttribute(qj.resizeHandleId)===t)??null}function RM(e,t,n){let r=LM(e,t,n);return r==null?[-1,-1]:[r,r+1]}function zM(e,t=document){return t instanceof HTMLElement&&t?.dataset?.panelGroupId==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function BM(e,t=document){return t.querySelector(`[${qj.resizeHandleId}="${e}"]`)||null}function rIe(e,t,n,r=document){let i=BM(t,r),a=IM(e,r),o=i?a.indexOf(i):-1;return[n[o]?.id??null,n[o+1]?.id??null]}function iIe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:i,panelGroupElement:a,setLayout:o}){(0,g.useRef)({didWarnAboutMissingResizeHandle:!1}),Yj(()=>{if(!a)return;let e=IM(n,a);for(let t=0;t<i.length-1;t++){let{valueMax:n,valueMin:a,valueNow:o}=nIe({layout:r,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(s!=null){let e=i[t];AM(e,`No panel data found for index "${t}"`),s.setAttribute(`aria-controls`,e.id),s.setAttribute(`aria-valuemax`,``+Math.round(n)),s.setAttribute(`aria-valuemin`,``+Math.round(a)),s.setAttribute(`aria-valuenow`,o==null?``:``+Math.round(o))}}return()=>{e.forEach((e,t)=>{e.removeAttribute(`aria-controls`),e.removeAttribute(`aria-valuemax`),e.removeAttribute(`aria-valuemin`),e.removeAttribute(`aria-valuenow`)})}},[n,r,i,a]),(0,g.useEffect)(()=>{if(!a)return;let e=t.current;AM(e,`Eager values not found`);let{panelDataArray:i}=e;AM(zM(n,a)!=null,`No group found for id "${n}"`);let s=IM(n,a);AM(s,`No resize handles found for group id "${n}"`);let c=s.map(e=>{let t=e.getAttribute(qj.resizeHandleId);AM(t,`Resize handle element has no handle id attribute`);let[s,c]=rIe(n,t,i,a);if(s==null||c==null)return()=>{};let l=e=>{if(!e.defaultPrevented)switch(e.key){case`Enter`:{e.preventDefault();let c=i.findIndex(e=>e.id===s);if(c>=0){let e=i[c];AM(e,`No panel data found for index ${c}`);let s=r[c],{collapsedSize:l=0,collapsible:u,minSize:d=0}=e.constraints;if(s!=null&&u){let e=FM({delta:NM(s,l)?d-l:l-s,initialLayout:r,panelConstraints:i.map(e=>e.constraints),pivotIndices:RM(n,t,a),prevLayout:r,trigger:`keyboard`});r!==e&&o(e)}}break}}};return e.addEventListener(`keydown`,l),()=>{e.removeEventListener(`keydown`,l)}});return()=>{c.forEach(e=>e())}},[a,e,t,n,r,i,o])}function VM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function HM(e,t){let n=e===`horizontal`,{x:r,y:i}=sM(t);return n?r:i}function aIe(e,t,n,r,i){let a=n===`horizontal`,o=BM(t,i);AM(o,`No resize handle element found for id "${t}"`);let s=o.getAttribute(qj.groupId);AM(s,`Resize handle element has no group id attribute`);let{initialCursorPosition:c}=r,l=HM(n,e),u=zM(s,i);AM(u,`No group element found for id "${s}"`);let d=u.getBoundingClientRect(),f=a?d.width:d.height;return(l-c)/f*100}function oIe(e,t,n,r,i,a){if(iM(e)){let t=n===`horizontal`,r=0;r=e.shiftKey?100:i??10;let a=0;switch(e.key){case`ArrowDown`:a=t?0:r;break;case`ArrowLeft`:a=t?-r:0;break;case`ArrowRight`:a=t?r:0;break;case`ArrowUp`:a=t?0:-r;break;case`End`:a=100;break;case`Home`:a=-100;break}return a}else return r==null?0:aIe(e,t,n,r,a)}function sIe({panelDataArray:e}){let t=Array(e.length),n=e.map(e=>e.constraints),r=0,i=100;for(let a=0;a<e.length;a++){let e=n[a];AM(e,`Panel constraints not found for index ${a}`);let{defaultSize:o}=e;o!=null&&(r++,t[a]=o,i-=o)}for(let a=0;a<e.length;a++){let o=n[a];AM(o,`Panel constraints not found for index ${a}`);let{defaultSize:s}=o;if(s!=null)continue;let c=e.length-r,l=i/c;r++,t[a]=l,i-=l}return t}function UM(e,t,n){t.forEach((t,r)=>{let i=e[r];AM(i,`Panel data not found for index ${r}`);let{callbacks:a,constraints:o,id:s}=i,{collapsedSize:c=0,collapsible:l}=o,u=n[s];if(u==null||t!==u){n[s]=t;let{onCollapse:e,onExpand:r,onResize:i}=a;i&&i(t,u),l&&(e||r)&&(r&&(u==null||MM(u,c))&&!MM(t,c)&&r(),e&&(u==null||!MM(u,c))&&MM(t,c)&&e())}})}function WM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function cIe({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:a=3}){let o=n[i],s;return s=o==null?e==null?`1`:e.toPrecision(a):r.length===1?`1`:o.toPrecision(a),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:`hidden`,pointerEvents:t===null?void 0:`none`}}function lIe(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function GM(e){try{if(typeof localStorage<`u`)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error(`localStorage not supported in this environment`)}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function KM(e){return`react-resizable-panels:${e}`}function qM(e){return e.map(e=>{let{constraints:t,id:n,idIsFromProps:r,order:i}=e;return r?n:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(`,`)}function JM(e,t){try{let n=KM(e),r=t.getItem(n);if(r){let e=JSON.parse(r);if(typeof e==`object`&&e)return e}}catch{}return null}function uIe(e,t,n){return(JM(e,n)??{})[qM(t)]??null}function dIe(e,t,n,r,i){let a=KM(e),o=qM(t),s=JM(e,i)??{};s[o]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(a,JSON.stringify(s))}catch(e){console.error(e)}}function YM({layout:e,panelConstraints:t}){let n=[...e],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!NM(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];AM(t!=null,`No layout data found for index ${e}`),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];AM(r!=null,`No layout data found for index ${e}`);let a=PM({panelConstraints:t,panelIndex:e,size:r});r!=a&&(i+=r-a,n[e]=a)}if(!NM(i,0))for(let e=0;e<t.length;e++){let r=n[e];AM(r!=null,`No layout data found for index ${e}`);let a=r+i,o=PM({panelConstraints:t,panelIndex:e,size:a});if(r!==o&&(i-=o-r,n[e]=o,NM(i,0)))break}return n}var fIe=100,XM={getItem:e=>(GM(XM),XM.getItem(e)),setItem:(e,t)=>{GM(XM),XM.setItem(e,t)}},ZM={};function QM({autoSaveId:e=null,children:t,className:n=``,direction:r,forwardedRef:i,id:a=null,onLayout:o=null,keyboardResizeBy:s=null,storage:c=XM,style:l,tagName:u=`div`,...d}){let f=Zj(a),p=(0,g.useRef)(null),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)([]),y=eIe(),b=(0,g.useRef)({}),x=(0,g.useRef)(new Map),S=(0,g.useRef)(0),C=(0,g.useRef)({autoSaveId:e,direction:r,dragState:m,id:f,keyboardResizeBy:s,onLayout:o,storage:c}),w=(0,g.useRef)({layout:_,panelDataArray:[],panelDataArrayChanged:!1});(0,g.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,g.useImperativeHandle)(i,()=>({getId:()=>C.current.id,getLayout:()=>{let{layout:e}=w.current;return e},setLayout:e=>{let{onLayout:t}=C.current,{layout:n,panelDataArray:r}=w.current,i=YM({layout:e,panelConstraints:r.map(e=>e.constraints)});VM(n,i)||(v(i),w.current.layout=i,t&&t(i),UM(r,i,b.current))}}),[]),Yj(()=>{C.current.autoSaveId=e,C.current.direction=r,C.current.dragState=m,C.current.id=f,C.current.onLayout=o,C.current.storage=c}),iIe({committedValuesRef:C,eagerValuesRef:w,groupId:f,layout:_,panelDataArray:w.current.panelDataArray,setLayout:v,panelGroupElement:p.current}),(0,g.useEffect)(()=>{let{panelDataArray:t}=w.current;if(e){if(_.length===0||_.length!==t.length)return;let n=ZM[e];n??(n=lIe(dIe,fIe),ZM[e]=n);let r=[...t],i=new Map(x.current);n(e,r,i,_,c)}},[e,_,c]),(0,g.useEffect)(()=>{});let T=(0,g.useCallback)(e=>{let{onLayout:t}=C.current,{layout:n,panelDataArray:r}=w.current;if(e.constraints.collapsible){let i=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:o,pivotIndices:s}=tN(r,e,n);if(AM(o!=null,`Panel size not found for panel "${e.id}"`),!MM(o,a)){x.current.set(e.id,o);let c=FM({delta:eN(r,e)===r.length-1?o-a:a-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:`imperative-api`});WM(n,c)||(v(c),w.current.layout=c,t&&t(c),UM(r,c,b.current))}}},[]),E=(0,g.useCallback)((e,t)=>{let{onLayout:n}=C.current,{layout:r,panelDataArray:i}=w.current;if(e.constraints.collapsible){let a=i.map(e=>e.constraints),{collapsedSize:o=0,panelSize:s=0,minSize:c=0,pivotIndices:l}=tN(i,e,r),u=t??c;if(MM(s,o)){let t=x.current.get(e.id),o=t!=null&&t>=u?t:u,c=FM({delta:eN(i,e)===i.length-1?s-o:o-s,initialLayout:r,panelConstraints:a,pivotIndices:l,prevLayout:r,trigger:`imperative-api`});WM(r,c)||(v(c),w.current.layout=c,n&&n(c),UM(i,c,b.current))}}},[]),D=(0,g.useCallback)(e=>{let{layout:t,panelDataArray:n}=w.current,{panelSize:r}=tN(n,e,t);return AM(r!=null,`Panel size not found for panel "${e.id}"`),r},[]),O=(0,g.useCallback)((e,t)=>{let{panelDataArray:n}=w.current;return cIe({defaultSize:t,dragState:m,layout:_,panelData:n,panelIndex:eN(n,e)})},[m,_]),k=(0,g.useCallback)(e=>{let{layout:t,panelDataArray:n}=w.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=tN(n,e,t);return AM(a!=null,`Panel size not found for panel "${e.id}"`),i===!0&&MM(a,r)},[]),A=(0,g.useCallback)(e=>{let{layout:t,panelDataArray:n}=w.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=tN(n,e,t);return AM(a!=null,`Panel size not found for panel "${e.id}"`),!i||jM(a,r)>0},[]),j=(0,g.useCallback)(e=>{let{panelDataArray:t}=w.current;t.push(e),t.sort((e,t)=>{let n=e.order,r=t.order;return n==null&&r==null?0:n==null?-1:r==null?1:n-r}),w.current.panelDataArrayChanged=!0,y()},[y]);Yj(()=>{if(w.current.panelDataArrayChanged){w.current.panelDataArrayChanged=!1;let{autoSaveId:e,onLayout:t,storage:n}=C.current,{layout:r,panelDataArray:i}=w.current,a=null;if(e){let t=uIe(e,i,n);t&&(x.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}a??=sIe({panelDataArray:i});let o=YM({layout:a,panelConstraints:i.map(e=>e.constraints)});VM(r,o)||(v(o),w.current.layout=o,t&&t(o),UM(i,o,b.current))}}),Yj(()=>{let e=w.current;return()=>{e.layout=[]}},[]);let M=(0,g.useCallback)(e=>{let t=!1,n=p.current;return n&&window.getComputedStyle(n,null).getPropertyValue(`direction`)===`rtl`&&(t=!0),function(n){n.preventDefault();let r=p.current;if(!r)return()=>null;let{direction:i,dragState:a,id:o,keyboardResizeBy:s,onLayout:c}=C.current,{layout:l,panelDataArray:u}=w.current,{initialLayout:d}=a??{},f=RM(o,e,r),m=oIe(n,e,i,a,s,r),h=i===`horizontal`;h&&t&&(m=-m);let g=u.map(e=>e.constraints),_=FM({delta:m,initialLayout:d??l,panelConstraints:g,pivotIndices:f,prevLayout:l,trigger:iM(n)?`keyboard`:`mouse-or-touch`}),y=!WM(l,_);(aM(n)||oM(n))&&S.current!=m&&(S.current=m,!y&&m!==0?h?TM(e,m<0?fM:pM):TM(e,m<0?mM:hM):TM(e,0)),y&&(v(_),w.current.layout=_,c&&c(_),UM(u,_,b.current))}},[]),N=(0,g.useCallback)((e,t)=>{let{onLayout:n}=C.current,{layout:r,panelDataArray:i}=w.current,a=i.map(e=>e.constraints),{panelSize:o,pivotIndices:s}=tN(i,e,r);AM(o!=null,`Panel size not found for panel "${e.id}"`);let c=FM({delta:eN(i,e)===i.length-1?o-t:t-o,initialLayout:r,panelConstraints:a,pivotIndices:s,prevLayout:r,trigger:`imperative-api`});WM(r,c)||(v(c),w.current.layout=c,n&&n(c),UM(i,c,b.current))},[]),P=(0,g.useCallback)((e,t)=>{let{layout:n,panelDataArray:r}=w.current,{collapsedSize:i=0,collapsible:a}=t,{collapsedSize:o=0,collapsible:s,maxSize:c=100,minSize:l=0}=e.constraints,{panelSize:u}=tN(r,e,n);u!=null&&(a&&s&&MM(u,i)?MM(i,o)||N(e,o):u<l?N(e,l):u>c&&N(e,c))},[N]),F=(0,g.useCallback)((e,t)=>{let{direction:n}=C.current,{layout:r}=w.current;if(!p.current)return;let i=BM(e,p.current);AM(i,`Drag handle element not found for id "${e}"`);let a=HM(n,t);h({dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),I=(0,g.useCallback)(()=>{h(null)},[]),L=(0,g.useCallback)(e=>{let{panelDataArray:t}=w.current,n=eN(t,e);n>=0&&(t.splice(n,1),delete b.current[e.id],w.current.panelDataArrayChanged=!0,y())},[y]),R=(0,g.useMemo)(()=>({collapsePanel:T,direction:r,dragState:m,expandPanel:E,getPanelSize:D,getPanelStyle:O,groupId:f,isPanelCollapsed:k,isPanelExpanded:A,reevaluatePanelConstraints:P,registerPanel:j,registerResizeHandle:M,resizePanel:N,startDragging:F,stopDragging:I,unregisterPanel:L,panelGroupElement:p.current}),[T,m,r,E,D,O,f,k,A,P,j,M,N,F,I,L]),z={display:`flex`,flexDirection:r===`horizontal`?`row`:`column`,height:`100%`,overflow:`hidden`,width:`100%`};return(0,g.createElement)(Kj.Provider,{value:R},(0,g.createElement)(u,{...d,children:t,className:n,id:a,ref:p,style:{...z,...l},[qj.group]:``,[qj.groupDirection]:r,[qj.groupId]:f}))}var $M=(0,g.forwardRef)((e,t)=>(0,g.createElement)(QM,{...e,forwardedRef:t}));QM.displayName=`PanelGroup`,$M.displayName=`forwardRef(PanelGroup)`;function eN(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function tN(e,t,n){let r=eN(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],a=n[r];return{...t.constraints,panelSize:a,pivotIndices:i}}function pIe({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){(0,g.useEffect)(()=>{if(e||n==null||r==null)return;let i=BM(t,r);if(i==null)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:case`ArrowUp`:case`End`:case`Home`:e.preventDefault(),n(e);break;case`F6`:{e.preventDefault();let n=i.getAttribute(qj.groupId);AM(n,`No group element found for id "${n}"`);let a=IM(n,r),o=LM(n,t,r);AM(o!==null,`No resize element found for id "${t}"`),a[e.shiftKey?o>0?o-1:a.length-1:o+1<a.length?o+1:0].focus();break}}};return i.addEventListener(`keydown`,a),()=>{i.removeEventListener(`keydown`,a)}},[r,e,t,n])}function nN({children:e=null,className:t=``,disabled:n=!1,hitAreaMargins:r,id:i,onBlur:a,onClick:o,onDragging:s,onFocus:c,onPointerDown:l,onPointerUp:u,style:d={},tabIndex:f=0,tagName:p=`div`,...m}){let h=(0,g.useRef)(null),_=(0,g.useRef)({onClick:o,onDragging:s,onPointerDown:l,onPointerUp:u});(0,g.useEffect)(()=>{_.current.onClick=o,_.current.onDragging=s,_.current.onPointerDown=l,_.current.onPointerUp=u});let v=(0,g.useContext)(Kj);if(v===null)throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);let{direction:y,groupId:b,registerResizeHandle:x,startDragging:S,stopDragging:C,panelGroupElement:w}=v,T=Zj(i),[E,D]=(0,g.useState)(`inactive`),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(null),M=(0,g.useRef)({state:E});Yj(()=>{M.current.state=E}),(0,g.useEffect)(()=>{if(n)j(null);else{let e=x(T);j(()=>e)}},[n,T,x]);let N=r?.coarse??15,P=r?.fine??5;(0,g.useEffect)(()=>{if(n||A==null)return;let e=h.current;AM(e,`Element ref not attached`);let t=!1;return QFe(T,e,y,{coarse:N,fine:P},(e,n,r)=>{if(!n){D(`inactive`);return}switch(e){case`down`:{D(`drag`),t=!1,AM(r,`Expected event to be defined for "down" action`),S(T,r);let{onDragging:e,onPointerDown:n}=_.current;e?.(!0),n?.();break}case`move`:{let{state:e}=M.current;t=!0,e!==`drag`&&D(`hover`),AM(r,`Expected event to be defined for "move" action`),A(r);break}case`up`:{D(`hover`),C();let{onClick:e,onDragging:n,onPointerUp:r}=_.current;n?.(!1),r?.(),t||e?.();break}}})},[N,y,n,P,x,T,A,S,C]),pIe({disabled:n,handleId:T,resizeHandler:A,panelGroupElement:w});let F={touchAction:`none`,userSelect:`none`};return(0,g.createElement)(p,{...m,children:e,className:t,id:i,onBlur:()=>{k(!1),a?.()},onFocus:()=>{k(!0),c?.()},ref:h,role:`separator`,style:{...F,...d},tabIndex:f,[qj.groupDirection]:y,[qj.groupId]:b,[qj.resizeHandle]:``,[qj.resizeHandleActive]:E===`drag`?`pointer`:O?`keyboard`:void 0,[qj.resizeHandleEnabled]:!n,[qj.resizeHandleId]:T,[qj.resizeHandleState]:E})}nN.displayName=`PanelResizeHandle`;var rN=({className:e,...t})=>(0,W.jsx)($M,{className:G(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...t}),iN=$j,aN=({withHandle:e,className:t,...n})=>(0,W.jsx)(nN,{className:G(`relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90`,t),...n,children:e&&(0,W.jsx)(`div`,{className:`z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-border`,children:(0,W.jsx)(Wre,{className:`h-2.5 w-2.5`})})});function oN({className:e,...t}){return(0,W.jsx)(`div`,{className:G(`animate-pulse rounded-md bg-primary/10`,e),...t})}var mIe=(0,g.createContext)(null),sN={didCatch:!1,error:null},hIe=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=sN}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(sN))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&gIe(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(sN))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,g.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,g.createElement)(mIe.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function gIe(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var cN=({children:e,fallback:t})=>{let n=Lg();return(0,W.jsx)(hIe,{onError:(e,t)=>{let r={componentStack:t.componentStack};(e instanceof Pf||e instanceof Ff)&&(r.errorType=e.type,r.errorStatus=e.status,r.errorDetail=e.detail,r.errorInstance=e.instance,r.traceId=e.traceId),n.captureException(e,r)},fallbackRender:({error:e,resetErrorBoundary:n})=>t({error:e,resetError:n}),children:e})},lN=({className:e})=>(0,W.jsxs)(`svg`,{className:e,viewBox:`0 0 86 86`,version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,children:[(0,W.jsx)(`title`,{children:`open-api-icon`}),(0,W.jsx)(`g`,{id:`Page-1`,stroke:`none`,strokeWidth:`1`,fill:`none`,fillRule:`evenodd`,children:(0,W.jsxs)(`g`,{id:`open-api-icon`,fill:`currentColor`,children:[(0,W.jsx)(`path`,{d:`M35,16 C39.1263484,16 43.0859173,16.7140679 46.7618776,18.0253747 L36.7225172,28.0635294 C36.1538485,28.0214262 35.5794264,28 35,28 C22.2974508,28 12,38.2974508 12,51 C12,63.7025492 22.2974508,74 35,74 C47.7025492,74 58,63.7025492 58,51 C58,50.4205736 57.9785738,49.8461515 57.9364706,49.2774828 L67.9749824,39.2391236 C69.2860617,42.9148016 70,46.8740262 70,51 C70,70.3299662 54.3299662,86 35,86 C15.6700338,86 0,70.3299662 0,51 C0,31.6700338 15.6700338,16 35,16 Z`,id:`Combined-Shape`}),(0,W.jsx)(`circle`,{id:`Oval`,cx:`35`,cy:`51`,r:`13`}),(0,W.jsx)(`circle`,{id:`Oval-Copy`,cx:`73`,cy:`13`,r:`13`}),(0,W.jsx)(`rect`,{id:`Rectangle`,transform:`translate(54.091883, 31.908117) rotate(-45.000000) translate(-54.091883, -31.908117) `,x:`27.0918831`,y:`26.4081169`,width:`54`,height:`11`})]})})]});function uN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function _Ie(e,t=[]){let n=[];function r(t,r){let i=g.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=g.useMemo(()=>o,Object.values(o));return(0,W.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=g.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>g.createContext(e));return function(n){let r=n?.[e]||t;return g.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,vIe(i,...t)]}function vIe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function dN(e,t=[]){let n=[];function r(t,r){let i=g.createContext(r),a=n.length;n=[...n,r];function o(t){let{scope:n,children:r,...o}=t,s=n?.[e][a]||i,c=g.useMemo(()=>o,Object.values(o));return(0,W.jsx)(s.Provider,{value:c,children:r})}function s(n,o){let s=o?.[e][a]||i,c=g.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return o.displayName=t+`Provider`,[o,s]}let i=()=>{let t=n.map(e=>g.createContext(e));return function(n){let r=n?.[e]||t;return g.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yIe(i,...t)]}function yIe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function bIe(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function fN(...e){return t=>e.forEach(e=>bIe(e,t))}function pN(...e){return g.useCallback(fN(...e),e)}var mN=g.forwardRef((e,t)=>{let{children:n,...r}=e,i=g.Children.toArray(n),a=i.find(SIe);if(a){let e=a.props.children,n=i.map(t=>t===a?g.Children.count(e)>1?g.Children.only(null):g.isValidElement(e)?e.props.children:null:t);return(0,W.jsx)(hN,{...r,ref:t,children:g.isValidElement(e)?g.cloneElement(e,void 0,n):null})}return(0,W.jsx)(hN,{...r,ref:t,children:n})});mN.displayName=`Slot`;var hN=g.forwardRef((e,t)=>{let{children:n,...r}=e;if(g.isValidElement(n)){let e=wIe(n);return g.cloneElement(n,{...CIe(r,n.props),ref:t?fN(t,e):e})}return g.Children.count(n)>1?g.Children.only(null):null});hN.displayName=`SlotClone`;var xIe=({children:e})=>(0,W.jsx)(W.Fragment,{children:e});function SIe(e){return g.isValidElement(e)&&e.type===xIe}function CIe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{a(...e),i(...e)}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function wIe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function TIe(e){let t=e+`CollectionProvider`,[n,r]=dN(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=g.useRef(null),a=g.useRef(new Map).current;return(0,W.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=g.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,W.jsx)(mN,{ref:pN(t,a(s,n).collectionRef),children:r})});c.displayName=s;let l=e+`CollectionItemSlot`,u=`data-radix-collection-item`,d=g.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=g.useRef(null),s=pN(t,o),c=a(l,n);return g.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,W.jsx)(mN,{[u]:``,ref:s,children:r})});d.displayName=l;function f(t){let n=a(e+`CollectionConsumer`,t);return g.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:c,ItemSlot:d},f,r]}var gN=globalThis?.document?g.useLayoutEffect:()=>{},EIe=g.useId||(()=>void 0),DIe=0;function _N(e){let[t,n]=g.useState(EIe());return gN(()=>{e||n(e=>e??String(DIe++))},[e]),e||(t?`radix-${t}`:``)}var vN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=g.forwardRef((e,n)=>{let{asChild:r,...i}=e,a=r?mN:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,W.jsx)(a,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function yN(e){let t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...e)=>t.current?.(...e),[])}function bN({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=OIe({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=yN(n);return[o,g.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function OIe({defaultProp:e,onChange:t}){let n=g.useState(e),[r]=n,i=g.useRef(r),a=yN(t);return g.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}var kIe=g.createContext(void 0);function xN(e){let t=g.useContext(kIe);return e||t||`ltr`}var SN=`rovingFocusGroup.onEntryFocus`,AIe={bubbles:!1,cancelable:!0},CN=`RovingFocusGroup`,[wN,TN,jIe]=TIe(CN),[MIe,EN]=dN(CN,[jIe]),[NIe,PIe]=MIe(CN),DN=g.forwardRef((e,t)=>(0,W.jsx)(wN.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(wN.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(FIe,{...e,ref:t})})}));DN.displayName=CN;var FIe=g.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=g.useRef(null),p=pN(t,f),m=xN(a),[h=null,_]=bN({prop:o,defaultProp:s,onChange:c}),[v,y]=g.useState(!1),b=yN(l),x=TN(n),S=g.useRef(!1),[C,w]=g.useState(0);return g.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(SN,b),()=>e.removeEventListener(SN,b)},[b]),(0,W.jsx)(NIe,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:g.useCallback(e=>_(e),[_]),onItemShiftTab:g.useCallback(()=>y(!0),[]),onFocusableItemAdd:g.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:g.useCallback(()=>w(e=>e-1),[]),children:(0,W.jsx)(vN.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:uN(e.onMouseDown,()=>{S.current=!0}),onFocus:uN(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(SN,AIe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);AN([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:uN(e.onBlur,()=>y(!1))})})}),ON=`RovingFocusGroupItem`,kN=g.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,...o}=e,s=_N(),c=a||s,l=PIe(ON,n),u=l.currentTabStopId===c,d=TN(n),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return g.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),(0,W.jsx)(wN.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:(0,W.jsx)(vN.span,{tabIndex:u?0:-1,"data-orientation":l.orientation,...o,ref:t,onMouseDown:uN(e.onMouseDown,e=>{r?l.onItemFocus(c):e.preventDefault()}),onFocus:uN(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:uN(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){l.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=RIe(e,l.orientation,l.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=d().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=l.loop?zIe(n,r+1):n.slice(r+1)}setTimeout(()=>AN(n))}})})})});kN.displayName=ON;var IIe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function LIe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function RIe(e,t,n){let r=LIe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return IIe[r]}function AN(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zIe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var BIe=DN,VIe=kN;function HIe(e,t){return g.useReducer((e,n)=>t[e][n]??e,e)}var jN=e=>{let{present:t,children:n}=e,r=UIe(t),i=typeof n==`function`?n({present:r.isPresent}):g.Children.only(n),a=pN(r.ref,WIe(i));return typeof n==`function`||r.isPresent?g.cloneElement(i,{ref:a}):null};jN.displayName=`Presence`;function UIe(e){let[t,n]=g.useState(),r=g.useRef({}),i=g.useRef(e),a=g.useRef(`none`),[o,s]=HIe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return g.useEffect(()=>{let e=MN(r.current);a.current=o===`mounted`?e:`none`},[o]),gN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=MN(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),gN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=MN(r.current).includes(a.animationName);if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=MN(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:g.useCallback(e=>{e&&(r.current=getComputedStyle(e)),n(e)},[])}}function MN(e){return e?.animationName||`none`}function WIe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var NN=`Tabs`,[GIe,KIe]=_Ie(NN,[EN]),PN=EN(),[qIe,FN]=GIe(NN),IN=g.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=xN(s),[d,f]=bN({prop:r,onChange:i,defaultProp:a});return(0,W.jsx)(qIe,{scope:n,baseId:_N(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,W.jsx)(vN.div,{dir:u,"data-orientation":o,...l,ref:t})})});IN.displayName=NN;var LN=`TabsList`,RN=g.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=FN(LN,n),o=PN(n);return(0,W.jsx)(BIe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,W.jsx)(vN.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});RN.displayName=LN;var zN=`TabsTrigger`,BN=g.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=FN(zN,n),s=PN(n),c=UN(o.baseId,r),l=WN(o.baseId,r),u=r===o.value;return(0,W.jsx)(VIe,{asChild:!0,...s,focusable:!i,active:u,children:(0,W.jsx)(vN.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:uN(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:uN(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:uN(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});BN.displayName=zN;var VN=`TabsContent`,HN=g.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=FN(VN,n),c=UN(s.baseId,r),l=WN(s.baseId,r),u=r===s.value,d=g.useRef(u);return g.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,W.jsx)(jN,{present:i||u,children:({present:n})=>(0,W.jsx)(vN.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});HN.displayName=VN;function UN(e,t){return`${e}-trigger-${t}`}function WN(e,t){return`${e}-content-${t}`}var GN=IN,KN=RN,qN=BN,JN=HN,YN=GN,JIe=sm(`inline-flex items-center justify-center rounded-md bg-muted text-muted-foreground`,{variants:{variant:{default:``,underline:`w-full justify-start gap-6 rounded-none border-b border-border bg-transparent`},size:{sm:`h-8 px-1 py-1`,default:`h-10 p-1`}},compoundVariants:[{variant:`underline`,className:`h-auto p-0`}],defaultVariants:{variant:`default`,size:`default`}}),YIe=sm(`inline-flex items-center justify-center whitespace-nowrap rounded-xs font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs text-sm`,{variants:{variant:{default:``,underline:`gap-1.5 border-b-2 border-transparent text-muted-foreground hover:text-foreground data-[state=active]:border-brand data-[state=active]:bg-transparent data-[state=active]:text-brand data-[state=active]:shadow-none`},size:{sm:`px-2 py-0.5 rounded-sm`,default:`px-3 py-1.5`}},compoundVariants:[{variant:`underline`,className:`rounded-none px-1 py-2`}],defaultVariants:{variant:`default`,size:`default`}}),XN=g.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,W.jsx)(KN,{ref:i,className:G(JIe({variant:t,size:n}),e),...r}));XN.displayName=KN.displayName;var ZN=g.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,W.jsx)(qN,{ref:i,className:G(YIe({variant:t,size:n}),e),...r}));ZN.displayName=qN.displayName;var QN=g.forwardRef(({className:e,...t},n)=>(0,W.jsx)(JN,{ref:n,className:G(`data-[state=inactive]:hidden`,`mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));QN.displayName=JN.displayName;var XIe=[`@zuplo/runtime`,`@zuplo/graphql`,`@zuplo/otel`],$N=[{name:`@zuplo/test`,version:`0.0.0`,types:`types/@zuplo/test/latest/types.d.ts`},{name:`chai`,version:`0.0.0`,types:`types/@types/chai/latest/index.d.ts`},{name:`openapi-types`,version:`0.0.0`,types:`types/openapi-types/latest/index.d.ts`}],ZIe=[{types:`types/@zuplo/runtime/types/environment.d.ts`,name:`@app/environment`},{types:`types/@zuplo/runtime/types/custom.d.ts`,name:`lib.custom.ts`},{types:`types/@zuplo/runtime/latest/global.d.ts`,name:`global.d.ts`}];async function QIe(){try{return await(await fetch(`https://cdn.zuplo.com/types/remote-modules.d.ts`)).text()}catch(e){wf.captureException(e)}}async function $Ie(e,t){try{let n=await fetch(`${Bf}/types/${e}/${t}/package.json`);if(!n.ok)throw Error(`Error loading package.json for ${e}`);return await n.json()}catch(e){wf.captureException(e)}}async function eLe(){try{let e=await fetch(`${Bf}/types/@zuplo/bundled/bundles.json`);if(!e.ok)throw Error(`Error loading bundles from CDN`);let t=await e.json();return[...$N,...t.bundles]}catch(e){wf.captureException(e)}return[...$N]}async function eP(e){try{let t=await fetch(`${Bf}/${e}`);if(!t.ok)throw Error(`Error loading type definition: ${e}`);return await t.text()}catch(e){wf.captureException(e)}}var tP=async(e,t,n)=>{let r=`https://cdn.jsdelivr.net/npm/${e}@${t}${n}`,i=await fetch(r);return i.ok?i.text():Error(`OK`)};async function tLe(e){await Promise.all(XIe.map(async t=>{let n=await $Ie(t,`latest`);n&&(e.typescript.typescriptDefaults.addExtraLib(JSON.stringify(n),`file:///node_modules/${t}/package.json`),await Promise.all(Object.entries(n.exports).map(async([n,r])=>{let i=await eP(`types/${t}/latest/${r.types.substring(2)}`);if(i){let r=n===`.`?`index.d.ts`:`${n}.d.ts`;e.typescript.typescriptDefaults.addExtraLib(i,`file:///node_modules/${t}/${r}`)}})))}))}async function nP(e){let t=Object.keys(e.typescript.typescriptDefaults.getExtraLibs()),n=await eLe();await Promise.allSettled([...ZIe.map(async({types:t,name:n})=>{let r=await eP(t);r&&e.typescript.typescriptDefaults.addExtraLib(r,n)}),...n.map(async n=>{if(t.includes(n.name))return;let r={name:n.name,version:n.version,types:`./index.d.ts`},i=await eP(n.types);i&&(e.typescript.typescriptDefaults.addExtraLib(JSON.stringify(r),`file:///node_modules/${n.name}/package.json`),e.typescript.typescriptDefaults.addExtraLib(i,`file:///node_modules/${n.name}/index.d.ts`))})])}var rP=null,nLe=`
96
+ `},qNe=0,eA=[];function JNe(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(qNe++)[0],a=g.useState(function(){return yw()})[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=zxe([e.lockRef.current],(e.shards||[]).map($k),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=g.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2)return!o.current.allowPinchZoom;var i=Zk(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=Jk(d,u);if(!f)return!0;if(f?l=d:(l=d===`v`?`h`:`v`,f=Jk(d,u)),!f)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var p=r.current||l;return WNe(p,t,e,p===`h`?s:c,!0)},[]),c=g.useCallback(function(e){var n=e;if(!(!eA.length||eA[eA.length-1]!==a)){var r=`deltaY`in n?Qk(n):Zk(n),i=t.current.filter(function(e){return e.name===n.type&&e.target===n.target&&GNe(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map($k).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=g.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=g.useCallback(function(e){n.current=Zk(e),r.current=void 0},[]),d=g.useCallback(function(t){l(t.type,Qk(t),t.target,s(t,e.lockRef.current))},[]),f=g.useCallback(function(t){l(t.type,Zk(t),t.target,s(t,e.lockRef.current))},[]);g.useEffect(function(){return eA.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Kk),document.addEventListener(`touchmove`,c,Kk),document.addEventListener(`touchstart`,u,Kk),function(){eA=eA.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Kk),document.removeEventListener(`touchmove`,c,Kk),document.removeEventListener(`touchstart`,u,Kk)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(a,{styles:KNe(i)}):null,p?g.createElement(fSe,{gapMode:`margin`}):null)}var YNe=Xxe(Vk,JNe),tA=g.forwardRef(function(e,t){return g.createElement(Uk,fw({},e,{ref:t,sideCar:YNe}))});tA.classNames=Uk.classNames;var nA=`Dialog`,[rA,XNe]=TNe(nA),[ZNe,iA]=rA(nA),QNe=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=(0,g.useRef)(null),c=(0,g.useRef)(null),[l=!1,u]=kNe({prop:r,defaultProp:i,onChange:a});return(0,g.createElement)(ZNe,{scope:t,triggerRef:s,contentRef:c,contentId:jk(),titleId:jk(),descriptionId:jk(),open:l,onOpenChange:u,onOpenToggle:(0,g.useCallback)(()=>u(e=>!e),[u]),modal:o},n)},$Ne=`DialogTrigger`,ePe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA($Ne,n),a=kk(t,i.triggerRef);return(0,g.createElement)(Ik.button,Ek({type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":dA(i.open)},r,{ref:a,onClick:Dk(e.onClick,i.onOpenToggle)}))}),aA=`DialogPortal`,[tPe,oA]=rA(aA,{forceMount:void 0}),nPe=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=iA(aA,t);return(0,g.createElement)(tPe,{scope:t,forceMount:n},g.Children.map(r,e=>(0,g.createElement)(Lk,{present:n||a.open},(0,g.createElement)(PNe,{asChild:!0,container:i},e))))},sA=`DialogOverlay`,rPe=(0,g.forwardRef)((e,t)=>{let n=oA(sA,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=iA(sA,e.__scopeDialog);return a.modal?(0,g.createElement)(Lk,{present:r||a.open},(0,g.createElement)(iPe,Ek({},i,{ref:t}))):null}),iPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(sA,n);return(0,g.createElement)(tA,{as:Pk,allowPinchZoom:!0,shards:[i.contentRef]},(0,g.createElement)(Ik.div,Ek({"data-state":dA(i.open)},r,{ref:t,style:{pointerEvents:`auto`,...r.style}})))}),cA=`DialogContent`,aPe=(0,g.forwardRef)((e,t)=>{let n=oA(cA,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=iA(cA,e.__scopeDialog);return(0,g.createElement)(Lk,{present:r||a.open},a.modal?(0,g.createElement)(oPe,Ek({},i,{ref:t})):(0,g.createElement)(sPe,Ek({},i,{ref:t})))}),oPe=(0,g.forwardRef)((e,t)=>{let n=iA(cA,e.__scopeDialog),r=(0,g.useRef)(null),i=kk(t,n.contentRef,r);return(0,g.useEffect)(()=>{let e=r.current;if(e)return dw(e)},[]),(0,g.createElement)(lA,Ek({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Dk(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),(t=n.triggerRef.current)==null||t.focus()}),onPointerDownOutside:Dk(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Dk(e.onFocusOutside,e=>e.preventDefault())}))}),sPe=(0,g.forwardRef)((e,t)=>{let n=iA(cA,e.__scopeDialog),r=(0,g.useRef)(!1),i=(0,g.useRef)(!1);return(0,g.createElement)(lA,Ek({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a;if((a=e.onCloseAutoFocus)==null||a.call(e,t),!t.defaultPrevented){var o;r.current||(o=n.triggerRef.current)==null||o.focus(),t.preventDefault()}r.current=!1,i.current=!1},onInteractOutside:t=>{var a;(a=e.onInteractOutside)==null||a.call(e,t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let o=t.target;n.triggerRef.current?.contains(o)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}}))}),lA=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=iA(cA,n),c=kk(t,(0,g.useRef)(null));return LNe(),(0,g.createElement)(g.Fragment,null,(0,g.createElement)(iC,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a},(0,g.createElement)(wp,Ek({role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":dA(s.open)},o,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),uA=`DialogTitle`,cPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(uA,n);return(0,g.createElement)(Ik.h2,Ek({id:i.titleId},r,{ref:t}))}),lPe=`DialogDescription`,uPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(lPe,n);return(0,g.createElement)(Ik.p,Ek({id:i.descriptionId},r,{ref:t}))}),dPe=`DialogClose`,fPe=(0,g.forwardRef)((e,t)=>{let{__scopeDialog:n,...r}=e,i=iA(dPe,n);return(0,g.createElement)(Ik.button,Ek({type:`button`},r,{ref:t,onClick:Dk(e.onClick,()=>i.onOpenChange(!1))}))});function dA(e){return e?`open`:`closed`}var[pPe,mPe]=wNe(`DialogTitleWarning`,{contentName:cA,titleName:uA,docsSlug:`dialog`}),fA=QNe,pA=ePe,mA=nPe,hA=rPe,gA=aPe,_A=cPe,vA=uPe,yA=fPe;function bA({...e}){return(0,W.jsx)(fA,{"data-slot":`dialog`,...e})}function xA({...e}){return(0,W.jsx)(pA,{"data-slot":`dialog-trigger`,...e})}function hPe({...e}){return(0,W.jsx)(mA,{"data-slot":`dialog-portal`,...e})}function SA({...e}){return(0,W.jsx)(yA,{"data-slot":`dialog-close`,...e})}function gPe({className:e,...t}){return(0,W.jsx)(hA,{"data-slot":`dialog-overlay`,className:G(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function CA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,W.jsxs)(hPe,{"data-slot":`dialog-portal`,children:[(0,W.jsx)(gPe,{}),(0,W.jsxs)(gA,{"data-slot":`dialog-content`,className:G(`bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...r,children:[t,n&&(0,W.jsxs)(yA,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,W.jsx)($m,{}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function wA({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`dialog-header`,className:G(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function TA({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`dialog-footer`,className:G(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function EA({className:e,...t}){return(0,W.jsx)(_A,{"data-slot":`dialog-title`,className:G(`text-lg leading-none font-semibold`,e),...t})}function DA({className:e,...t}){return(0,W.jsx)(vA,{"data-slot":`dialog-description`,className:G(`text-muted-foreground text-sm`,e),...t})}function _Pe({open:e,editors:t,onSelect:n,onCancel:r}){let[i,a]=(0,g.useState)(null);return(0,W.jsx)(bA,{open:e,onOpenChange:e=>!e&&r(),children:(0,W.jsxs)(CA,{className:`sm:max-w-md`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Choose Your Editor`}),(0,W.jsx)(DA,{children:`Select which editor you'd like to use for opening files. This preference will be saved for future use.`})]}),(0,W.jsx)(`div`,{className:`space-y-2 py-4`,children:t.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`w-full text-left px-4 py-3 rounded-md border transition-colors ${i===e.id?`border-blue-500 bg-blue-50 dark:bg-blue-950/40`:`border-gray-200 dark:border-neutral-700 hover:border-gray-300 dark:hover:border-neutral-600 hover:bg-gray-50 dark:hover:bg-neutral-800/60`}`,onClick:()=>a(e.id),children:(0,W.jsx)(`div`,{className:`font-medium`,children:e.name})},e.id))}),(0,W.jsxs)(TA,{children:[(0,W.jsx)(Y,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,W.jsx)(Y,{variant:`default`,onClick:()=>{i&&n(i)},disabled:!i,children:`Save Preference`})]})]})})}var OA=`/api/v1/editor`;function vPe(){let[e]=Vr(),[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(!0);(0,g.useEffect)(()=>{(async()=>{try{let e=await fetch(`${OA}/list`);if(!e.ok)throw Error(`Failed to fetch editors: ${e.status}`);o((await e.json()).editors);let t=await fetch(`${OA}/detect`);if(!t.ok)throw Error(`Failed to detect editor: ${t.status}`);let r=await t.json();r.editor&&r.name&&(n(r.editor),i(r.name))}catch(e){kf.error(`Failed to load editor preference`,{error:e})}finally{u(!1)}})()},[]);let d=(0,g.useCallback)(async e=>{try{if((await fetch(`${OA}/preference`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({editor:e})})).ok){let t=a.find(t=>t.id===e);t&&(n(e),i(t.name)),c(!1)}}catch(e){kf.error(`Failed to save editor preference`,{error:e})}},[a]),f=(0,g.useCallback)(async()=>{let n=e.get(`path`);if(!n){kf.warn(`No file path in URL`);return}if(!t){c(!0);return}try{let e=await fetch(`${OA}/open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({file:n})});if(!e.ok){let t=await e.json();kf.error(`Failed to open file in editor`,{error:t.message});return}let t=await e.json();t.url&&window.open(t.url,`_blank`)}catch(e){kf.error(`Failed to open file in editor`,{error:e})}},[e,t]);return{hasEditor:!!t,editorName:r,isLoading:l,showPreferenceDialog:s,setShowPreferenceDialog:c,availableEditors:a,savePreference:d,openInEditor:f}}var kA=`$import(@zuplo/runtime)`,yPe=e=>new Promise(t=>setTimeout(t,e)),AA=e=>{let t=(0,g.useRef)(e);return t.current=e,(0,g.useEffect)(()=>{t.current=e},[e]),t},jA=e=>{let[t,n]=(0,g.useState)(`idle`),[r,i]=(0,g.useState)(),[a,o]=(0,g.useState)(null);return{state:t,error:r,execute:(0,g.useCallback)(async(...t)=>{n(`loading`),o(null),i(void 0);try{let r=await e(...t);return n(`hasValue`),o(r),r}catch(e){throw i(e instanceof Error?e:Error(e)),n(`hasError`),e}},[e]),value:a}},MA=function(e){return e.PRODUCTION=`PRODUCTION`,e.PREVIEW=`PREVIEW`,e.WORKING_COPY=`WORKING_COPY`,e}({});function bPe(e,...t){return e==null?!1:t.includes(e)}var NA=()=>({isReadOnly:oh().environment.environmentType!==MA.WORKING_COPY});function PA(){return new URLSearchParams(Sn().search)}function FA(e,t){let[n,r]=Vr(),i=Object.fromEntries(n);return[n.get(e)??t,t=>r(t===void 0?Object.fromEntries(Object.entries(i).filter(([t])=>t!==e)):{...i,[e]:t})]}function xPe(e,t){let[n,r]=Vr();return[n.get(e)?n.getAll(e):t,t=>r({...Object.fromEntries(n),[e]:t})]}var SPe=i(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),CPe=e(i(((e,t)=>{var n=SPe();t.exports=f;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`;function c(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function l(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function u(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function d(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=d(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function f(e){return e?(e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),_(l(e),!0).map(u)):[]}function p(e){return`{`+e+`}`}function m(e){return/^-?0\d/.test(e)}function h(e,t){return e<=t}function g(e,t){return e>=t}function _(e,t){var r=[],i=n(`{`,`}`,e);if(!i)return[e];var o=i.pre,s=i.post.length?_(i.post,!1):[``];if(/\$$/.test(i.pre))for(var l=0;l<s.length;l++){var u=o+`{`+i.body+`}`+s[l];r.push(u)}else{var f=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),v=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),y=f||v,b=i.body.indexOf(`,`)>=0;if(!y&&!b)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+a+i.post,_(e)):[e];var x;if(y)x=i.body.split(/\.\./);else if(x=d(i.body),x.length===1&&(x=_(x[0],!1).map(p),x.length===1))return s.map(function(e){return i.pre+x[0]+e});var S;if(y){var C=c(x[0]),w=c(x[1]),T=Math.max(x[0].length,x[1].length),E=x.length==3?Math.abs(c(x[2])):1,D=h;w<C&&(E*=-1,D=g);var O=x.some(m);S=[];for(var k=C;D(k,w);k+=E){var A;if(v)A=String.fromCharCode(k),A===`\\`&&(A=``);else if(A=String(k),O){var j=T-A.length;if(j>0){var M=Array(j+1).join(`0`);A=k<0?`-`+M+A.slice(1):M+A}}S.push(A)}}else{S=[];for(var N=0;N<x.length;N++)S.push.apply(S,_(x[N],!1))}for(var N=0;N<S.length;N++)for(var l=0;l<s.length;l++){var u=o+S[N]+s[l];(!t||y||u)&&r.push(u)}}return r}}))()),wPe=1024*64,IA=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>wPe)throw TypeError(`pattern is too long`)},TPe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},LA=e=>e.replace(/[[\]\\-]/g,`\\$&`),EPe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),RA=e=>e.join(``),DPe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(TPe))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(LA(d)+`-`+LA(t)):t===d&&r.push(LA(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(LA(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(LA(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[EPe(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+RA(r)+`]`,p=`[`+(l?``:`^`)+RA(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},zA=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`),OPe=new Set([`!`,`?`,`+`,`*`,`@`]),BA=e=>OPe.has(e),VA=e=>BA(e.type),kPe=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),APe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),jPe=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),HA=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),MPe=`(?!\\.\\.?(?:$|/))`,UA=`(?!\\.)`,NPe=new Set([`[`,`.`]),PPe=new Set([`..`,`.`]),FPe=new Set(`().*{}+?[]^$\\!`),IPe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),WA=`[^/]`,GA=WA+`*?`,KA=WA+`+?`,qA=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...t){for(let n of t)if(n!==``){if(typeof n!=`string`&&!(n instanceof e&&n.#i===this))throw Error(`invalid part: `+n);this.#r.push(n)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;n<this.#a;n++){let r=t.#r[n];if(!(r instanceof e&&r.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(t){let n=new e(this.type,t);for(let e of this.#r)n.copyIn(e);return n}static#f(t,n,r,i,a){let o=i.maxExtglobRecursion??2,s=!1,c=!1,l=-1,u=!1;if(n.type===null){let d=r,f=``;for(;d<t.length;){let r=t.charAt(d++);if(s||r===`\\`){s=!s,f+=r;continue}if(c){d===l+1?(r===`^`||r===`!`)&&(u=!0):r===`]`&&!(d===l+2&&u)&&(c=!1),f+=r;continue}else if(r===`[`){c=!0,l=d,u=!1,f+=r;continue}if(!i.noext&&BA(r)&&t.charAt(d)===`(`&&a<=o){n.push(f),f=``;let o=new e(r,n);d=e.#f(t,o,d,i,a+1),n.push(o);continue}f+=r}return n.push(f),d}let d=r+1,f=new e(null,n),p=[],m=``;for(;d<t.length;){let r=t.charAt(d++);if(s||r===`\\`){s=!s,m+=r;continue}if(c){d===l+1?(r===`^`||r===`!`)&&(u=!0):r===`]`&&!(d===l+2&&u)&&(c=!1),m+=r;continue}else if(r===`[`){c=!0,l=d,u=!1,m+=r;continue}if(BA(r)&&t.charAt(d)===`(`&&(a<=o||n&&n.#h(r))){let o=n&&n.#h(r)?0:1;f.push(m),m=``;let s=new e(r,f);f.push(s),d=e.#f(t,s,d,i,a+o);continue}if(r===`|`){f.push(m),m=``,p.push(f),f=new e(null,n);continue}if(r===`)`)return m===``&&n.#r.length===0&&(n.#u=!0),f.push(m),m=``,n.push(...p,f),d;m+=r}return n.type=null,n.#t=void 0,n.#r=[t.substring(r-1)],d}#p(e){return this.#m(e,APe)}#m(e,t=kPe){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=jPe){return!!t.get(this.type)?.includes(e)}#g(t,n){let r=t.#r[0],i=new e(null,r,this.options);i.#r.push(``),r.push(i),this.#_(t,n)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!HA.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=HA.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}#x(){if(VA(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}static fromGlob(t,n={}){let r=new e(null,void 0,n);return e.#f(t,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(){if(this.#e===this&&(this.#x(),this.#d()),!VA(this)){let t=this.isStart()&&this.isEnd(),n=this.#r.map(n=>{let[r,i,a,o]=typeof n==`string`?e.#S(n,this.#t,t):n.toRegExpSource();return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),r=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&PPe.has(this.#r[0]))){let e=NPe,t=this.#c.dot&&e.has(n.charAt(0))||n.startsWith(`\\.`)&&e.has(n.charAt(2))||n.startsWith(`\\.\\.`)&&e.has(n.charAt(4)),i=!this.#c.dot&&e.has(n.charAt(0));r=t?MPe:i?UA:``}let i=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(i=`(?:$|\\/)`),[r+n+i,zA(n),this.#t=!!this.#t,this.#n]}let t=this.type===`!`?`(?:(?!(?:`:`(?:`,n=this.#r.map(e=>{if(typeof e==`string`)throw Error(`string type in extglob ast??`);let[t,n,r,i]=e.toRegExpSource();return this.#n=this.#n||i,t}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`);if(this.isStart()&&this.isEnd()&&!n&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,zA(this.toString()),!1,!1]}let r=``;if(this.type===`!`&&this.#u)r=(this.isStart()&&!this.#c.dot?UA:``)+KA;else{let e=this.type===`!`?`))`+(this.isStart()&&!this.#c.dot?UA:``)+GA+`)`:this.type===`@`?`)`:`)${this.type}`;r=t+n+e}return[r,zA(n),this.#t=!!this.#t,this.#n]}static#S(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(c!==`*`&&(o=!1),r){r=!1,i+=(FPe.has(c)?`\\`:``)+c;continue}if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=DPe(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?KA:GA,t=!0;continue}if(c===`?`){i+=WA,t=!0;continue}i+=IPe(c)}return[i,zA(e),!!t,a]}},LPe=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),JA=(e,t,n={})=>(IA(t),!n.nocomment&&t.charAt(0)===`#`?!1:new rj(t,n).match(e)),RPe=/^\*+([^+@!?\*\[\(]*)$/,zPe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),BPe=e=>t=>t.endsWith(e),VPe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),HPe=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),UPe=/^\*+\.\*+$/,WPe=e=>!e.startsWith(`.`)&&e.includes(`.`),GPe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),KPe=/^\.\*+$/,qPe=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),JPe=/^\*+$/,YPe=e=>e.length!==0&&!e.startsWith(`.`),XPe=e=>e.length!==0&&e!==`.`&&e!==`..`,ZPe=/^\?+([^+@!?\*\[\(]*)?$/,QPe=([e,t=``])=>{let n=YA([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},$Pe=([e,t=``])=>{let n=XA([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},eFe=([e,t=``])=>{let n=XA([e]);return t?e=>n(e)&&e.endsWith(t):n},tFe=([e,t=``])=>{let n=YA([e]);return t?e=>n(e)&&e.endsWith(t):n},YA=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},XA=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ZA=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,QA={win32:{sep:`\\`},posix:{sep:`/`}};JA.sep=ZA===`win32`?QA.win32.sep:QA.posix.sep;var $A=Symbol(`globstar **`);JA.GLOBSTAR=$A;var nFe=`[^/]*?`,rFe=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,iFe=`(?:(?!(?:\\/|^)\\.).)*?`;JA.filter=(e,t={})=>n=>JA(n,e,t);var ej=(e,t={})=>Object.assign({},e,t);JA.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return JA;let t=JA;return Object.assign((n,r,i={})=>t(n,r,ej(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,ej(e,n))}static defaults(n){return t.defaults(ej(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,ej(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,ej(e,r))}},unescape:(n,r={})=>t.unescape(n,ej(e,r)),escape:(n,r={})=>t.escape(n,ej(e,r)),filter:(n,r={})=>t.filter(n,ej(e,r)),defaults:n=>t.defaults(ej(e,n)),makeRe:(n,r={})=>t.makeRe(n,ej(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,ej(e,r)),match:(n,r,i={})=>t.match(n,r,ej(e,i)),sep:t.sep,GLOBSTAR:$A})};var tj=(e,t={})=>(IA(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:(0,CPe.default)(e));JA.braceExpand=tj,JA.makeRe=(e,t={})=>new rj(e,t).makeRe(),JA.match=(e,t,n={})=>{let r=new rj(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var nj=/[?*]|[+@!]\(.*?\)|\[|\]/,aFe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),rj=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){IA(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ZA,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!nj.test(e[2]))&&!nj.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);r&&(e[t]=r,e[n]=[])}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=e[0]===``&&e[1]===``&&e[2]===`?`&&typeof e[3]==`string`&&/^[a-z]:$/i.test(e[3]),a=t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]);if(n&&a){let n=e[3],a=t[3];n.toLowerCase()===a.toLowerCase()&&(e[3]=a,r=3,i=3)}else if(a&&typeof e[0]==`string`){let n=t[3],r=e[0];n.toLowerCase()===r.toLowerCase()&&(t[3]=r,i=3)}else if(n&&typeof t[0]==`string`){let n=e[3];n.toLowerCase()===t[0].toLowerCase()&&(t[0]=n,r=3)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes($A)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf($A,i),o=t.lastIndexOf($A),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===$A?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===$A)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return tj(this.pattern,this.options)}parse(e){IA(e);let t=this.options;if(e===`**`)return $A;if(e===``)return``;let n,r=null;(n=e.match(JPe))?r=t.dot?XPe:YPe:(n=e.match(RPe))?r=(t.nocase?t.dot?HPe:VPe:t.dot?BPe:zPe)(n[1]):(n=e.match(ZPe))?r=(t.nocase?t.dot?$Pe:QPe:t.dot?eFe:tFe)(n):(n=e.match(UPe))?r=t.dot?GPe:WPe:(n=e.match(KPe))&&(r=qPe);let i=qA.fromGlob(e,this.options).toMMPattern();return r?Object.assign(i,{test:r}):i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?nFe:t.dot?rFe:iFe,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?aFe(e):e===$A?$A:e._src});return t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==$A||a===$A||(a===void 0?i!==void 0&&i!==$A?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|`+n+`)?`:i!==$A&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=$A))}),t.filter(e=>e!==$A).join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return JA.defaults(e).Minimatch}};JA.AST=qA,JA.Minimatch=rj,JA.escape=LPe,JA.unescape=zA;function ij(e){let t=new Date;switch(e){case`7d`:t.setUTCDate(t.getUTCDate()-7);break;case`30d`:t.setUTCDate(t.getUTCDate()-30);break;case`3m`:t.setUTCMonth(t.getUTCMonth()-3);break}return t.toISOString()}async function aj(e,t){let n=t.pageSize??30,{page:r,pageSize:i,order:a=`DESC`,orderBy:o=`periodStart`,...s}=t,{data:c,error:l}=await C_.GET(`/v3/metering/{bucketId}/billing/invoices`,{params:{path:{bucketId:e},query:{page:r,pageSize:n,expand:[`lines`],order:a,orderBy:o,...s}}});if(l||!c)throw l??Error(`Failed to load invoices`);return c}var oFe=15;async function sFe(e,t,n=6){let r=await aj(e,{page:1,pageSize:n,createdAfter:ij(`3m`),order:`DESC`,orderBy:`periodStart`,customers:[t]}),i=r.items??[];if(i.length===0||i.every(e=>e.customer?.id===t))return r;let a=[],o=1;for(;a.length<n&&o<=oFe;){let r=await aj(e,{page:o,pageSize:30,createdAfter:ij(`3m`),order:`DESC`,orderBy:`periodStart`}),i=r.items??[];if(i.length===0)break;for(let e of i)if(e.customer?.id===t&&(a.push(e),a.length>=n))break;let s=r.pageSize??30,c=Math.max(1,Math.ceil((r.totalCount??0)/s));if(o>=c)break;o++}let s=a.slice(0,n);return{...r,items:s,totalCount:s.length,page:1,pageSize:n}}var oj={orderBy:`createdAt`,order:`DESC`},sj=`/v3/metering/{bucketId}/plans`,cFe=`/v3/metering/{bucketId}/customers`;function lFe(e){if(!e)return;let t={};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.status?.length&&(t.status=e.status),Object.keys(t).length>0?t:void 0}function uFe(e,t){let n=lFe(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function dFe(e){if(!e)return;let t={orderBy:e.orderBy??oj.orderBy,order:e.order??oj.order};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.planKey&&(t.planKey=e.planKey),e.name&&(t.name=e.name),e.key&&(t.key=e.key),e.primaryEmail&&(t.primaryEmail=e.primaryEmail),Object.keys(t).length>0?t:void 0}function fFe(e,t){let n=dFe(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function pFe(e){let t={page:e.page??1,pageSize:e.pageSize??30};return e.includeArchived!=null&&(t.includeArchived=e.includeArchived),t}function mFe(e,t,n){return Array.isArray(e)?{items:e,totalCount:e.length,page:t,pageSize:n}:e}var cj={ai:{providerAssignments:{list:(e,t)=>w_.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/ai-provider-assignments`,{params:{path:{accountName:e,projectName:t}}},{select:e=>e.data})}},deployments:{list:(e,t)=>w_.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/deployments`,{params:{path:{accountName:e,projectName:t}}}),versions:{list:e=>w_.queryOptions(`get`,`/v1/deployments/{deploymentName}/versions`,{params:{path:{deploymentName:e}}})}},mcp:{origins:{list:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/{configurationId}/origins`,{params:{path:e}})},teams:{list:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/teams`,{params:{path:e}})},server:{listTeams:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/{configurationId}/servers/{virtualServerId}/teams`,{params:{path:e}})},servers:{list:e=>w_.queryOptions(`get`,`/v1/buckets/{bucketId}/mcp/configurations/{configurationId}/servers`,{params:{path:e}})}},metering:{customers:{list:(e,t)=>w_.queryOptions(`get`,cFe,fFe(e,t),t?.page==null?void 0:{placeholderData:r_}),get:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}`,{params:{path:{bucketId:e,customerIdOrKey:t}}}),subscriptions:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}/subscriptions`,{params:{path:{bucketId:e,customerIdOrKey:t}}})},plans:{list:(e,t)=>w_.queryOptions(`get`,sj,uFe(e,t),t?.page==null?void 0:{placeholderData:r_}),get:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/plans/{planId}`,{params:{path:{bucketId:e,planId:t}}}),listByKey:(e,t)=>w_.queryOptions(`get`,sj,{params:{path:{bucketId:e},query:{key:[t]}}})},meters:{list:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/meters`,{params:{path:{bucketId:e}}})},configuration:{get:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/monetization-configuration`,{params:{path:{bucketId:e}}})},features:{list:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:t?{includeArchived:t}:void 0}},{select:e=>Array.isArray(e)?e:e.items}),listPaginated:(e,t)=>{let n=t.page??1,r=t.pageSize??30;return w_.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:pFe(t)}},{select:e=>mFe(e,n,r),placeholderData:r_})}},planInvites:{list:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/plan-invites`,{params:{path:{bucketId:e}}})},billingReadiness:{get:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/billing-readiness`,{params:{path:{bucketId:e}}})},stripe:{setup:e=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/setup/stripe`,{params:{path:{bucketId:e}}})},subscriptions:{get:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}`,{params:{path:{bucketId:e,subscriptionId:t}}}),access:(e,t)=>w_.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}/access`,{params:{path:{bucketId:e,subscriptionId:t}}})},invoices:{list:(e,t,n,r,i,a)=>({queryKey:[`metering`,e,`invoices`,t,n,r??`all`,a,i],queryFn:()=>aj(e,{page:n,pageSize:30,createdAfter:ij(t),order:i,orderBy:a,...r?.length?{statuses:r}:{}}),placeholderData:r_}),forCustomer:(e,t)=>({queryKey:[`metering`,e,`invoices`,`customer`,t],queryFn:()=>sFe(e,t)})}}},hFe=async e=>lj(e,await a(()=>import(`./editor.main-B2OfgmKo.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),lj=(e,t)=>{let n=e.split(`.`).pop();if(n)return t.languages.getLanguages().find(e=>e.extensions?.includes(`.${n}`))},uj=e=>{let t=Object.entries(e).flatMap(([e,t])=>t?[[e,t]]:[]);return new URLSearchParams(t).toString()},X={user:{preferences:()=>({url:`${U}/v1/users/me/preferences`})},authApiKey:e=>({url:`${U}/v1/auth/api-keys/${e}`}),authAccountApiKeys:e=>({url:`${U}/v1/auth/api-keys?accountName=${e}`}),authCurrentUserAccountRoles:e=>({url:`${U}/v1/auth/users/me?accountName=${e}`}),authUserAccountRoles:(e,t)=>({url:`${U}/v1/auth/users/${t}?accountName=${e}`}),authProjectUsersRoles:(e,t,{includeInheritedRoles:n}={includeInheritedRoles:!1})=>({url:`${U}/v1/auth/users?accountName=${e}&projectName=${t}&includeInheritedRoles=${n}`}),authAccountUsersRoles:e=>({url:`${U}/v1/auth/users?accountName=${e}`}),mfaFactors:()=>({url:`${U}/v1/mfa/factors`}),accountMemberInviteDetails:e=>({url:`${U}/v1/account-member-invites/${e}`}),accountMemberInvites:e=>({url:`${U}/v1/accounts/${e}/account-member-invites`}),accountAuditLogs:(e,t)=>{let n=new URLSearchParams;t?.limit&&n.append(`limit`,t.limit.toString()),t?.offset&&n.append(`offset`,t.offset.toString()),t?.action&&n.append(`action`,t.action),t?.startDate&&n.append(`startDate`,t.startDate),t?.endDate&&n.append(`endDate`,t.endDate),t?.actor&&n.append(`actor`,t.actor),t?.success!==void 0&&n.append(`success`,t.success.toString());let r=n.toString();return{url:`${U}/v1/accounts/${e}/audit-logs${r?`?${r}`:``}`}},account:e=>({url:`${U}/v1/accounts/${e}`}),accounts:()=>({url:`${U}/v1/accounts`}),accountSourceControlRepoList:e=>({url:`${U}/v1/accounts/${e}/$repo-list`}),accountSourceControlAzureProjects:(e,t)=>({url:`${U}/v1/accounts/${e}/source-control/$azure-projects?organization=${t}`}),accountSourceControlNamespaces:e=>({url:`${U}/v1/accounts/${e}/$namespaces`}),accountSourceControlRepos:(e,t,n)=>({url:`${U}/v1/accounts/${e}/$repos?${new URLSearchParams({namespace:t,query:n??``})}`}),accountsSourceControlConfigurations:()=>({url:`${U}/v1/user/me/source-control-configs`}),accountUsageAnalyticsByDate:(e,t,n)=>({url:`${U}/v1/analytics/${e}/usage?from=${t}&to=${n}&version=2`}),billing:e=>({url:`${U}/v1/accounts/${e}/billings`}),buildLogs:(e,t)=>({url:`${U}/v2/deployments/${e}/build-logs/${t}`}),cdnContent:e=>({url:`${Bf}${e}`}),chatIdentity:()=>({url:`${U}/v1/chat-identity`}),knockIdentity:()=>({url:`${U}/v1/knock-identity`}),bucketConfigurations:e=>({url:`${U}/v1/buckets/${e}/configurations`}),bucketConfigurationTeams:e=>({url:`${U}/v1/buckets/${e}/configurations/teams`}),bucketConfigurationApps:e=>({url:`${U}/v1/buckets/${e}/configurations/apps`}),bucketConfiguration:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}`}),bucketConfigurationUsage:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/usage`}),bucketConfigurationMembers:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members`}),bucketConfigurationMember:(e,t,n)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`}),supportedAiProviders:e=>({url:`${U}/v1/buckets/${e}/providers`}),aiProviderAssignments:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`}),hierarchicalQuota:e=>({url:`${U}/v1/hierarchical-quota/${e}`}),bucketConfigurationRequestCount:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/request-count?${uj({startDate:n,endDate:r,granularity:i})}`}),bucketConfigurationCostUsage:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/cost-usage?${uj({startDate:n,endDate:r,granularity:i})}`}),bucketConfigurationTokenUsage:(e,t,n,r,i,a)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/token-usage?${uj({startDate:n,endDate:r,granularity:i,tokenType:a})}`}),bucketConfigurationTtfb:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/ttfb?${uj({startDate:n,endDate:r,granularity:i})}`}),bucketConfigurationBlocksErrorsWarnings:(e,t,n,r,i)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/blocks-errors-warnings?${uj({startDate:n,endDate:r,granularity:i})}`}),consumer:(e,t)=>({url:`${U}/v1/api-keys/${e}/consumers/${t}`}),consumersForBucket:(e,t)=>{let n=uj({limit:t?.limit?.toString(),offset:t?.offset?.toString(),name:t?.name,email:t?.email});return{url:`${U}/v1/api-keys/${e}/consumers${n?`?${n}`:``}`}},customDomains:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/custom-domains`}),accountCustomDomains:e=>({url:`${U}/v1/accounts/${e}/custom-domains`}),deploymentVersions:e=>({url:`${U}/v1/deployments/${e}/versions`}),environments:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/deployments`}),environmentVariables:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/environment-variables`}),file:(e,t)=>({url:`${U}/v1/deployments/${e}/fs/file?path=${t}`}),fsStats:e=>({url:`${U}/v1/deployments/${e}/fs/stats`}),gitBranches:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$branches`}),projectSyncStatus:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/sync-status`}),maxRpsAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/max-rps?filter=${t}&limit=10${r?`&${r}`:``}`}},meteringBucket:(e,t)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/`}),meteringPlans:(e,t)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans`}),meteringSubscriptions:(e,t)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/subscriptions`}),meteringSubscriptionQuotas:(e,t,n)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/subscriptions/${n}/quotas`}),primaryAnalytics:(e,t)=>({url:`${U}/v2/deployments/${e}/analytics/metrics?filter=${t}`}),project:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}`}),projects:e=>({url:`${U}/v1/accounts/${e}/projects`}),permissions:(e,t)=>({url:`${U}/v1/permissions/${e}/${t}`}),permissionsProject:(e,t)=>({url:`${U}/v1/permissions/project/${e}|${t}`}),permissionsAiTeam:e=>({url:`${U}/v1/permissions/ai_team/${e}`}),logViewerRequests:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/deployments/${e}/logs/requests?${n}`}},logViewerRequestDetail:(e,t,n)=>{let r=new URLSearchParams;n&&r.append(`timestamp`,n);let i=r.toString();return{url:`${U}/v2/deployments/${e}/logs/requests/${t}${i?`?${i}`:``}`}},logViewerHistogram:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/deployments/${e}/logs/histogram?${n}`}},logViewerFacets:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/deployments/${e}/logs/facets?${n}`}},logViewerRequestsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/logs/requests?${n}`}},logViewerRequestDetailScoped:(e,t,n)=>{let r=new URLSearchParams;return r.append(`account`,e.accountName),e.projectName&&r.append(`project`,e.projectName),e.deploymentName&&r.append(`deploymentName`,e.deploymentName),n&&r.append(`timestamp`,n),{url:`${U}/v2/logs/requests/${t}?${r}`}},logViewerHistogramScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/logs/histogram?${n}`}},logViewerFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${U}/v2/logs/facets?${n}`}},tracesListScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),t.limit&&n.append(`limit`,String(t.limit)),t.cursor&&n.append(`cursor`,t.cursor),{url:`${U}/v2/traces?${n}`}},traceDetailScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),{url:`${U}/v2/traces/${encodeURIComponent(t)}?${n}`}},traceStatsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),{url:`${U}/v2/trace-stats?${n}`}},traceFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.facets&&n.append(`facets`,t.facets),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),{url:`${U}/v2/trace-facets?${n}`}},topRpsAnalytics:(e,t,n,r)=>{let i=uj(r);return{url:`${U}/v2/deployments/${e}/analytics/top-rps?filter=${t}${n?`&sortBy=${n}`:``}&limit=10${i?`&${i}`:``}`}},topRpsByIpAnalytics:(e,t,n,r)=>{let i=uj(r);return{url:`${U}/v2/deployments/${e}/analytics/top-rps-by-ip?filter=${t}${n?`&sortBy=${n}`:``}&limit=10${i?`&${i}`:``}`}},topTenIpAddressesAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-ip-addresses?filter=${t}&limit=10${r?`&${r}`:``}`}},topTenLocationsAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-locations?filter=${t}&limit=10${r?`&${r}`:``}`}},topTenRoutesAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-routes?filter=${t}&limit=10${r?`&${r}`:``}`}},topTenSubsAnalytics:(e,t,n)=>{let r=uj(n);return{url:`${U}/v2/deployments/${e}/analytics/top-subs?filter=${t}&limit=10${r?`&${r}`:``}`}},usersMe:()=>({url:`${U}/v1/users/me`}),identityConnections:e=>({url:`${U}/v1/accounts/${e}/identity-connections`}),identityConnectionTicket:e=>({url:`${U}/v1/accounts/${e}/identity-connections/ticket`}),mcpBucketConfigurations:e=>({url:`${U}/v1/buckets/${e}/mcp/configurations`}),mcpBucketConfigurationTeam:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams/${t}`}),mcpBucketConfigurationsTeams:e=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams`}),mcpGatewayIdpMetadata:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/${t}/idp-metadata`}),mcpGatewayOrigins:(e,t,n)=>{let r=new URLSearchParams;n?.limit&&r.append(`limit`,n.limit.toString()),n?.offset&&r.append(`offset`,n.offset.toString());let i=r.toString();return{url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/origins${i?`?${i}`:``}`}},mcpGatewayOriginServer:(e,t,n)=>({url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/origins/${n}`}),mcpGatewayVirtualServers:(e,t,n)=>{let r=new URLSearchParams;n?.limit&&r.append(`limit`,n.limit.toString()),n?.offset&&r.append(`offset`,n.offset.toString());let i=r.toString();return{url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/servers${i?`?${i}`:``}`}},mcpGatewayVirtualServer:(e,t,n)=>({url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/servers/${n}`}),mcpGatewayVirtualServerTools:(e,t,n)=>({url:`${U}/v1/buckets/${t}/mcp/configurations/${e}/servers/${n}/tools`}),analyticsRequests:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return e.compare&&t.append(`compare`,`previous`),{url:`${U}/v2/analytics/requests?${t}`}},analyticsRequestsField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/requests/fields/${e}?${n}`}},analyticsConsumers:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/consumers?${t}`}},analyticsAgents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/agents?${t}`}},analyticsAgentsTimeSeries:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/agents/timeseries?${t}`}},analyticsBackend:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/backend?${t}`}},analyticsEdge:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/edge?${t}`}},analyticsAiGateway:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/ai-gateway?${t}`}},analyticsAiGatewayField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/ai-gateway/fields/${e}?${n}`}},analyticsAiGatewayTimeseries:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),t.append(`groupBy`,e.groupBy),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.limitGroups&&t.append(`limitGroups`,e.limitGroups.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/ai-gateway/timeseries?${t}`}},analyticsMcp:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/mcp?${t}`}},analyticsGraphql:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/graphql?${t}`}},analyticsMcpField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/mcp/fields/${e}?${n}`}},analyticsMcpCapabilities:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.view&&t.append(`view`,e.view),e.capabilityType&&t.append(`capabilityType`,e.capabilityType),e.limit&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/mcp/capabilities?${t}`}},analyticsMcpEvents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.limit!=null&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${U}/v2/analytics/mcp/events?${t}`}},analyticsMcpBreakdown:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${U}/v2/analytics/mcp/breakdowns/${e}?${n}`}},analyticsUsage:e=>{let t=new URLSearchParams;return t.append(`account`,e.accountName),t.append(`from`,e.from),t.append(`to`,e.to),{url:`${U}/v2/analytics/usage?${t}`}}},dj={auth:{createApiKey:e=>({url:`${U}/v1/auth/api-keys`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[X.authAccountApiKeys(e.accountName)],acceptableStatuses:[200]}),deleteApiKey:(e,t)=>({url:`${U}/v1/auth/api-keys/${e}`,method:`DELETE`,invalidateKeys:[X.authApiKey(e),X.authAccountApiKeys(t)],acceptableStatuses:[204]}),updateUsersRole:({userId:e,accountName:t,projectName:n,role:r})=>({url:`${U}/v1/auth/users/${e}`,method:`PATCH`,json:!0,body:JSON.stringify({accountName:t,projectName:n,role:r}),parseResponse:!1,invalidateKeys:n?[X.authProjectUsersRoles(t,n,{includeInheritedRoles:!1}),X.authProjectUsersRoles(t,n,{includeInheritedRoles:!0}),X.authAccountUsersRoles(t)]:[X.authAccountUsersRoles(t)],acceptableStatuses:[201,200]})},accounts:{createAccount:e=>({url:`${U}/v1/accounts`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[X.accounts()],acceptableStatuses:[201]}),deleteAccount:e=>({url:`${U}/v1/accounts/${e.name}`,method:`DELETE`,invalidateKeys:[X.accounts()],acceptableStatuses:[200]}),createCustomDomain:({accountName:e,projectName:t,isAlias:n,hostname:r,deploymentName:i,stage:a})=>({url:`${U}/v1/accounts/${e}/custom-domains`,method:`POST`,body:JSON.stringify({hostname:r,isAlias:n,deploymentName:i,stage:a}),invalidateKeys:[X.accounts(),X.projects(e),X.environments(e,t),X.customDomains(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),deleteAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${U}/v1/accounts/${e}/account-member-invites/${t}`,method:`DELETE`,invalidateKeys:[X.accountMemberInvites(e)],acceptableStatuses:[204]}),deleteCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${U}/v1/accounts/${e}/custom-domains?hostname=${n}&deploymentName=${r}`,method:`DELETE`,invalidateKeys:[X.accounts(),X.projects(e),X.environments(e,t),X.customDomains(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[204]}),editCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${U}/v1/accounts/${e}/custom-domains`,method:`PATCH`,body:JSON.stringify({hostname:n,deploymentName:r}),invalidateKeys:[X.accounts(),X.projects(e),X.environments(e,t),X.customDomains(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),resendAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${U}/v1/accounts/${e}/account-member-invites/${t}/$resend`,method:`PATCH`,body:JSON.stringify({}),invalidateKeys:[X.accountMemberInvites(e)],acceptableStatuses:[201]}),billingUpgrade:(e,t,n,r)=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({successUrl:n,cancelUrl:r}),url:`${U}/v1/accounts/${e}/upgrade/${t}`}),updateAccount:({accountName:e,...t})=>({url:`${U}/v1/accounts/${e}`,method:`PATCH`,body:JSON.stringify(t),json:!0,invalidateKeys:[X.accounts()],acceptableStatuses:[200]})},ai:{createBucketConfiguration:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations`,method:`POST`,json:!0,body:JSON.stringify(t),acceptableStatuses:[201,200],invalidateKeys:[X.bucketConfigurations(e),X.bucketConfigurationTeams(e)]}),updateBucketConfiguration:(e,t,n)=>({url:`${U}/v1/buckets/${e}/configurations/${t}`,method:`PATCH`,json:!0,body:JSON.stringify(n),acceptableStatuses:[200,201],invalidateKeys:[X.bucketConfigurationTeams(e),X.bucketConfiguration(e,t),X.bucketConfigurations(e)]}),deleteBucketConfiguration:(e,t)=>({url:`${U}/v1/buckets/${e}/configurations/${t}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[X.bucketConfigurations(e)]}),createBucketConfigurationMember:(e,t,n,r)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members`,method:`POST`,json:!0,body:JSON.stringify({sub:n,role:r}),acceptableStatuses:[201,200],invalidateKeys:[X.bucketConfiguration(e,t),X.bucketConfigurationMembers(e,t)]}),putBucketConfigurationMemberRole:(e,t,n,r)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PUT`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[204,200],invalidateKeys:[X.bucketConfiguration(e,t),X.bucketConfigurationMembers(e,t),X.bucketConfigurationTeams(e)]}),deleteBucketConfigurationMember:(e,t,n)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[X.bucketConfigurationMembers(e,t)]}),updateBucketConfigurationMember:(e,t,n,r)=>({url:`${U}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PATCH`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[200],invalidateKeys:[X.bucketConfigurationMembers(e,t)]}),createBucketAiProvider:(e,{name:t,baseURL:n,label:r,description:i})=>({url:`${U}/v1/buckets/${e}/providers`,method:`POST`,json:!0,body:JSON.stringify({label:r,baseURL:n,name:t,description:i})}),createAiProviderModel:(e,t,{model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,status:o})=>({url:`${U}/v1/buckets/${e}/providers/${t}/models`,method:`POST`,json:!0,body:JSON.stringify({model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,status:o}),invalidateKeys:[X.supportedAiProviders(e)],acceptableStatuses:[200]}),createAiProviderAssignment:(e,t,n)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`,method:`POST`,body:JSON.stringify({...n,metadata:JSON.stringify(n.metadata)}),headers:{"content-type":`application/json`},invalidateKeys:[X.aiProviderAssignments(e,t)],acceptableStatuses:[201]}),updateAiProviderAssignment:(e,t,n,r)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`PATCH`,body:JSON.stringify({...r,...r.metadata?{metadata:JSON.stringify(r.metadata)}:{}}),headers:{"content-type":`application/json`},invalidateKeys:[X.aiProviderAssignments(e,t)],acceptableStatuses:[200]}),deleteAiProviderAssignment:(e,t,n)=>({url:`${U}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`DELETE`,invalidateKeys:[X.aiProviderAssignments(e,t)],acceptableStatuses:[204]})},projects:{createProject:(e,t,{productType:n,...r}={})=>({url:`${U}/v1/accounts/${e}/projects`,method:`POST`,body:JSON.stringify({name:t,productType:n,options:r}),removeKeys:[X.projects(e)],acceptableStatuses:[201]}),createProjectWithRepo:(e,t,n,r,i)=>({url:`${U}/v1/accounts/${e}/projects/$create-with-repo`,method:`POST`,body:JSON.stringify({projectName:t,orgName:n,repositoryName:r,defaultBranch:i}),removeKeys:[X.projects(e)],acceptableStatuses:[201]}),createProjectFromRepo:(e,t,n,r)=>({url:`${U}/v1/accounts/${e}/projects/$create-from-repo`,method:`POST`,body:JSON.stringify({projectName:t,sourceRepoUrl:n,defaultBranch:r}),removeKeys:[X.projects(e)],acceptableStatuses:[201]}),createRepoFromProject:(e,t,n,r,i,a)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$create-repo`,method:`POST`,body:JSON.stringify({orgName:n,repositoryName:r,defaultBranch:i,otherParams:a}),invalidateKeys:[X.projects(e),X.environments(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),connectProjectToRepo:(e,t,n,r,i,a)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$connect`,method:`PATCH`,body:JSON.stringify({orgName:n,repositoryURL:r,defaultBranch:i,forceConnect:a}),invalidateKeys:[X.projects(e),X.environments(e,t),cj.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),disconnectProjectFromRepo:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$disconnect`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[X.projects(e)],acceptableStatuses:[201]}),initProject:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$init`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[X.projects(e)],acceptableStatuses:[201]}),deleteProject:(e,t)=>({url:`${U}/v1/accounts/${e}/projects/${t}`,method:`DELETE`,invalidateKeys:[X.projects(e),cj.deployments.list(e,t).queryKey],removeKeys:[X.environments(e,t)],acceptableStatuses:[204]}),archiveProject:e=>({url:`${U}/v1/deployments/${e}/archive`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200]}),updateDefaultBranch:({accountName:e,projectName:t,defaultBranch:n,sourceRepoUrl:r})=>({url:`${U}/v1/accounts/${e}/projects/${t}/$update-default-branch`,method:`PATCH`,body:JSON.stringify({defaultBranch:n,sourceRepoUrl:r}),headers:{"content-type":`application/json`},invalidateKeys:[X.projects(e),cj.deployments.list(e,t).queryKey],removeKeys:[X.environments(e,t)],acceptableStatuses:[200]})},consumers:{createConsumer:e=>{let t={...e.consumer,accountName:e.accountName,projectName:e.projectName,environmentType:e.environmentType};return{url:`${U}/v1/api-keys/${e.bucketId}/consumers`,method:`POST`,body:JSON.stringify(t),headers:{"content-type":`application/json`},invalidateKeys:[X.consumersForBucket(e.bucketId)],acceptableStatuses:[201]}},updateConsumer:e=>({url:`${U}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`PATCH`,body:JSON.stringify({...e.consumer}),headers:{"content-type":`application/json`},invalidateKeys:[X.consumersForBucket(e.bucketId)],acceptableStatuses:[200]}),removeConsumer:e=>({url:`${U}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`DELETE`,invalidateKeys:[X.consumersForBucket(e.bucketId)]})},environmentVariables:{updateEnvironmentVariable:e=>({url:`${U}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.variableData.id}`,method:`PATCH`,body:JSON.stringify(e.variableData),invalidateKeys:[X.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[200]}),createEnvironmentVariable:e=>({url:`${U}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables`,method:`POST`,body:JSON.stringify(e.variableData),invalidateKeys:[X.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[201]}),deleteEnvironmentVariable:e=>({url:`${U}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.id}`,method:`DELETE`,invalidateKeys:[X.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[204]})},users:{updatePreferences:e=>({url:`${U}/v1/users/me/preferences`,method:`PUT`,invalidateKeys:[X.user.preferences()],body:JSON.stringify({data:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]}),requestVerificationEmail:()=>({url:`${U}/v1/users/me/$send-verification-email`,method:`POST`,invalidateKeys:[],acceptableStatuses:[201]}),enrollMfaFactor:e=>({url:`${U}/v1/mfa/factors/enroll`,method:`POST`,body:JSON.stringify({factor:e}),invalidateKeys:[X.mfaFactors()],acceptableStatuses:[200],json:!0}),deleteMfaEnrollment:e=>({url:`${U}/v1/mfa/factors/enrollments/${e}`,method:`DELETE`,invalidateKeys:[X.mfaFactors()],acceptableStatuses:[200]})},sourceControlCredentials:{tokenExchangeSourceControlCredentials:(e,t,n)=>({url:`${U}/v1/accounts/${e}/source-control-configs/${t}/$token-exchange`,method:`POST`,body:JSON.stringify({code:n}),invalidateKeys:[X.accountsSourceControlConfigurations()],acceptableStatuses:[201]}),revokeSourceControlCredentials:(e,t)=>({url:`${U}/v1/accounts/${e}/source-control-configs/${t}/$revoke-token`,method:`DELETE`,invalidateKeys:[X.accountsSourceControlConfigurations()],acceptableStatuses:[204]})},sourceControlOperations:{commitPush:(e,t,n,r)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$commit-push`,method:`POST`,body:JSON.stringify({branchName:r,commitMessage:n}),acceptableStatuses:[201]}),sync:(e,t,n)=>({url:`${U}/v1/accounts/${e}/projects/${t}/$sync`,method:`POST`,body:JSON.stringify({branchName:n}),acceptableStatuses:[201,200],invalidateKeys:[]})},testDesigner:{makeTestRequest:({environmentName:e,testRequest:t,overrideUrl:n})=>{let r={body:t.body,deployment:e,headers:t.headers,method:t.method,overrideUrl:n,path:t.pathname};return{url:`${Lf}/v1/test`,method:`POST`,body:JSON.stringify(r),acceptableStatuses:[200],headers:{"content-type":`application/json`}}}},featureRequest:{requestFeature:({email:e,featureName:t,information:n})=>{let r={featureName:t,information:{email:e,...n}};return{url:`${U}/v1/feature-access-request`,method:`POST`,body:JSON.stringify(r),acceptableStatuses:[200],headers:{"content-type":`application/json`}}}},fileTransactions:{saveFile:({environmentName:e,file:t})=>{let n={"content-type":`text/plain`};return t.lastModified&&(n[`if-unmodified-since`]=new Date(t.lastModified).toUTCString()),{url:`${U}/v1/deployments/${e}/fs/file?path=${t.path}`,method:`POST`,body:t.content,headers:n,acceptableStatuses:[204,200],invalidateKeys:[X.file(e,t.path),X.deploymentVersions(e),cj.deployments.versions.list(e).queryKey]}},renameFile:({environmentName:e,path:t,newPath:n})=>({url:`${U}/v1/deployments/${e}/fs/file?path=${t}`,method:`PATCH`,body:JSON.stringify({newPath:n}),acceptableStatuses:[204,200],headers:{"content-type":`application/json`},invalidateKeys:[]}),saveMultipleFiles:async({environmentName:e,files:t})=>{let n=new FormData,r={};for(let e of t)if(e.lastModified){let t=`x-if-unmodified-since-${encodeURIComponent(e.path)}`;r[t]=new Date(e.lastModified).toUTCString()}for(let{content:e,path:r}of t){let t=(await hFe(r))?.id;n.append(`files[]`,new File([e??``],r,{type:t===`text/typescript`?`text/javascript`:t}),r)}let i=t.map(({path:t})=>X.file(e,t));return{url:`${U}/v1/deployments/${e}/fs/files`,method:`POST`,body:n,headers:r,acceptableStatuses:[204,200],invalidateKeys:[...i,X.deploymentVersions(e),cj.deployments.versions.list(e).queryKey]}},deleteFile:({environmentName:e,filePath:t})=>({url:`${U}/v1/deployments/${e}/fs/delete?path=${t}`,method:`DELETE`,acceptableStatuses:[204,200]})},directories:{createDirectory:({environmentName:e,path:t})=>({url:`${U}/v1/deployments/${e}/fs/dir?path=${t}`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[201]})},environments:{redeploy:({environmentName:e,isWorkingCopy:t,version:n})=>({url:t?`${U}/v1/deployments/${e}/$redeploy`:`${U}/v1/deployments/${e}/versions/${n}/$redeploy`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200],invalidateKeys:[X.deploymentVersions(e),cj.deployments.versions.list(e).queryKey]}),delete:({environmentName:e})=>({url:`${U}/v1/deployments/${e}`,method:`DELETE`,body:JSON.stringify({}),acceptableStatuses:[200]})},accountInvite:{acceptAccountInvite:e=>({url:`${U}/v1/account-member-invites/${e}`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[X.accounts()],acceptableStatuses:[201]}),createAccountInvite:(e,t,n)=>{let r=n?.project?.name?[X.authProjectUsersRoles(e,n.project.name),n.team?.id?X.bucketConfigurationMembers(n.team?.bucketId,n.team?.id):[],X.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!1}),X.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!0})].flat():[];return{url:`${U}/v1/accounts/${e}/account-member-invites`,method:`POST`,body:JSON.stringify({userEmail:t,metadata:n}),invalidateKeys:[X.accountMemberInvites(e),X.authAccountUsersRoles(e),...r],acceptableStatuses:[201]}}},identity:{chatIdentity:e=>({url:`${U}/v1/chat-identity`,method:`POST`,json:!0,headers:{"content-type":`application/json`},body:JSON.stringify(e),invalidateKeys:[X.chatIdentity()],acceptableStatuses:[200]})},metering:{createMeteringPlan:(e,t,n)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans`,method:`POST`,headers:{"Content-Type":`application/json`},invalidateKeys:[X.meteringPlans(e,t),X.meteringBucket(e,t)],body:JSON.stringify(n)}),deleteMeteringPlan:(e,t,n)=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[X.meteringPlans(e,t),X.meteringBucket(e,t)],method:`DELETE`}),updateMeteringPlan:(e,t,{id:n,...r})=>({url:`${U}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[X.meteringPlans(e,t),X.meteringBucket(e,t)],method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})},mcpGateway:{deleteMcpTeam:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams/${t}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[X.mcpBucketConfigurationsTeams(e)]}),createMcpTeam:(e,t)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams`,method:`POST`,json:!0,body:JSON.stringify(t),acceptableStatuses:[201,200],invalidateKeys:[X.mcpBucketConfigurationsTeams(e)]}),updateMcpTeam:(e,t,n)=>({url:`${U}/v1/buckets/${e}/mcp/configurations/teams/${t}`,method:`PATCH`,json:!0,body:JSON.stringify(n),acceptableStatuses:[201,200],invalidateKeys:[X.mcpBucketConfigurations(e),X.mcpBucketConfigurationsTeams(e),X.mcpBucketConfigurationTeam(e,t)]})},logs:{sourcemap:e=>({url:`${U}/v1/logs/sourcemap`,method:`POST`,json:!0,body:JSON.stringify(e),acceptableStatuses:[200]})},identityConnections:{createTicket:e=>({url:`${U}/v1/accounts/${e}/identity-connections/ticket`,method:`POST`,json:!0,body:JSON.stringify({}),invalidateKeys:[X.identityConnections(e)],acceptableStatuses:[200]})},migration:{migrateDevPortal:e=>({url:`${U}/v1/migrate/dev-portal`,method:`POST`,json:!1,body:JSON.stringify({deploymentName:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]})}},fj=e=>{let t=g_(),n=Vg(),r=Poe();return{fetch:async i=>{let a=Jf(),o;try{o=await Zse(t=>{let n=new Headers(i.headers);return i.json&&i.method!==`DELETE`&&n.set(`content-type`,`application/json`),n.set(`authorization`,`Bearer ${t}`),n.set(`zuplo-request-id`,a),fetch(i.url,{...e,method:i.method,headers:n,body:i.body})},n,r)}catch(e){throw e instanceof Ff&&e.setTraceId(a),e instanceof TypeError?new Pf({type:`https://zup.fail/api-request-failed`,title:`API request failed`,status:500,instance:i.url,traceId:a}):e}if(!(i.acceptableStatuses??[200]).includes(o.status)){let e=new Ff(`Unexpected response: ${o.status} calling ${i.method}: ${i.url}`,{traceId:a});throw await e.tryReadResponse(o),e}return i.invalidateKeys?.forEach(e=>{if(Array.isArray(e))t.invalidateQueries({queryKey:e,exact:!1});else if(`url`in e&&e.url){let n=e.url.split(`?`)[0];t.invalidateQueries({predicate:e=>{let t=e.queryKey[0];return typeof t==`string`&&t.split(`?`)[0]===n}})}}),i.removeKeys?.forEach(e=>{t.removeQueries({queryKey:[e.url]})}),i.parseResponse===!1?o:i.json?await o.json():o}}},gFe=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.directories.createDirectory(t))})},_Fe=`API request failed`;async function pj(e,t,n={}){let{text:r,extractData:i}=n;if(!e||typeof e!=`string`)throw new Pf({type:`https://zup.fail/missing-url`,title:`Missing URL`});let a=Jf(),o;try{o=await Zse(t=>{let n=new Request(e);return n.headers.set(`authorization`,`Bearer ${t}`),n.headers.set(`zuplo-request-id`,a),fetch(n)},t,()=>{Zf().then(({handleLogout:e})=>e())})}catch(t){throw t instanceof TypeError?new Pf({type:`https://zup.fail/api-request-failed`,title:_Fe,instance:e,traceId:a},{cause:t}):(t instanceof Ff&&t.setTraceId(a),t)}if(!o.ok){let e=new Ff(`Error while making request. Please try again or contact support if the problem persists.`,{traceId:a});throw await e.tryReadResponse(o),e}try{let e=r?await o.clone().text():await o.clone().json();return i?e.data:e}catch(t){let n=await o.clone().text();throw wf.captureException(t,{message:`Failed to parse response of ${e} to JSON`,responseText:n,status:o.status,traceId:a,requestUrl:e}),t}}function vFe(e,t={}){let n=Vg();return qse({queries:e.map(e=>({queryKey:[e.url,t.extractData],queryFn:()=>pj(e.url,n,t)}))})}function mj(e,{text:t,extractData:n=!0,...r}={}){let i=Vg();return x_({queryKey:[e.url,n],queryFn:async({queryKey:e})=>{let[r]=e;return pj(r,i,{text:t,extractData:n})},...r})}function hj(e,{enabled:t,text:n,extractData:r,...i}={}){let a=Vg();return b_({enabled:t,queryKey:[e.url,r],queryFn:async({queryKey:e})=>{let[t]=e;return pj(t,a,{text:n,extractData:r})},...i})}var gj={".ts":`typescript`,".tsx":`typescript`,".js":`javascript`,".jsx":`javascript`,".mjs":`javascript`,".cjs":`javascript`,".json":`json`,".html":`html`,".htm":`html`,".xml":`xml`,".svg":`xml`,".yaml":`yaml`,".yml":`yaml`,".md":`markdown`,".mdx":`markdown`,".css":`css`,".scss":`scss`,".sass":`sass`,".less":`less`,".py":`python`,".rs":`rust`,".go":`go`,".java":`java`,".c":`c`,".cpp":`cpp`,".cs":`csharp`,".php":`php`,".rb":`ruby`,".sh":`shell`,".bash":`shell`,".zsh":`shell`,".sql":`sql`,".graphql":`graphql`,".gql":`graphql`,".env":`plaintext`,".toml":`toml`,".ini":`ini`,".properties":`properties`,".dockerfile":`dockerfile`,Dockerfile:`dockerfile`,".makefile":`makefile`,Makefile:`makefile`};function _j(e){let t=e.split(`/`).pop()||``;if(gj[t])return gj[t];let n=t.lastIndexOf(`.`);return n===-1?`plaintext`:gj[t.slice(n)]||`plaintext`}var yFe=(e,t,n)=>hj(X.file(e,t),{...n,text:!0,select:e=>({content:e,contentType:`text/plain`,language:_j(t),path:t})}),vj=()=>{let e=fj();return S_({mutationFn:async t=>{let n=await e.fetch({...dj.fileTransactions.saveFile(t),parseResponse:!1}),r=n.headers.get(`Last-Modified`),i=r?new Date(r).getTime():void 0;return{...await n.json(),lastModified:i}}})},yj=e=>{let t=fj();return S_({mutationFn:async e=>{if(!e.environmentName||!e.files)throw Error(`No environment name or files provided`);return await(await t.fetch(await dj.fileTransactions.saveMultipleFiles(e))).json()},mutationKey:yj.mutationKey,...e})};yj.mutationKey=[`saveStatus`];var bFe=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.fileTransactions.deleteFile(t))})},xFe=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.fileTransactions.renameFile(t))})},bj=null,xj=null;function SFe(){return xj??=a(()=>import(`./editor.main-B2OfgmKo.js`).then(e=>(bj=e,e)),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),xj}function Sj(){let[e,t]=(0,g.useState)(bj);return(0,g.useEffect)(()=>{if(bj){t(bj);return}let e=!0;return SFe().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}function Cj(e,t,n){let r=(0,g.useRef)(!1);(0,g.useEffect)(()=>{if(!e)return;if(!r.current){r.current=!0;return}let i=requestAnimationFrame(()=>{if(n.current)try{e.editor.setTheme(t)}catch{}});return()=>cancelAnimationFrame(i)},[e,t,n])}var wj={display:`flex`,position:`relative`,textAlign:`initial`};function CFe({value:e,defaultValue:t,language:n,defaultLanguage:r,path:i,theme:a=`vs`,line:o,options:s={},overrideServices:c,onChange:l,onMount:u,beforeMount:d,className:f,width:p=`100%`,height:m=`100%`,keepCurrentModel:h=!1,wrapperProps:_}){let v=Sj(),y=(0,g.useRef)(null),b=(0,g.useRef)(null),x=(0,g.useRef)(l);x.current=l;let S=(0,g.useRef)(h);S.current=h;let C=(0,g.useRef)(!1);return(0,g.useEffect)(()=>{if(!v)return;let l=y.current;if(!l)return;d?.(v);let f=i?v.Uri.parse(i):void 0,p=f&&v.editor.getModel(f)||v.editor.createModel(e??t??``,n??r,f),m=v.editor.create(l,{...s,model:p,theme:a},c);b.current=m,o!=null&&m.revealLine(o);let h=m.onDidChangeModelContent(e=>{C.current||x.current?.(m.getValue(),e)});return u?.(m,v),()=>{h.dispose();let e=m.getModel();m.dispose(),S.current||e?.dispose(),b.current=null}},[v]),(0,g.useEffect)(()=>{let t=b.current;if(!t||e===void 0)return;let n=t.getModel();!n||e===n.getValue()||(C.current=!0,t.executeEdits(``,[{range:n.getFullModelRange(),text:e,forceMoveMarkers:!0}]),t.pushUndoStop(),C.current=!1)},[e]),(0,g.useEffect)(()=>{let e=b.current?.getModel();v&&e&&n&&v.editor.setModelLanguage(e,n)},[v,n]),Cj(v,a,b),(0,g.useEffect)(()=>{b.current?.updateOptions(s)},[s]),(0,g.useEffect)(()=>{o!=null&&b.current?.revealLine(o)},[o]),(0,W.jsx)(`section`,{..._,style:{...wj,width:p,height:m},children:(0,W.jsx)(`div`,{ref:y,className:f,style:{width:`100%`}})})}function wFe({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,theme:a=`vs`,options:o={},onMount:s,beforeMount:c,className:l,width:u=`100%`,height:d=`100%`,keepCurrentOriginalModel:f=!1,keepCurrentModifiedModel:p=!1,wrapperProps:m}){let h=Sj(),_=(0,g.useRef)(null),v=(0,g.useRef)(null),y=(0,g.useRef)(f);y.current=f;let b=(0,g.useRef)(p);return b.current=p,(0,g.useEffect)(()=>{if(!h)return;let l=_.current;if(!l)return;c?.(h);let u=h.editor.createDiffEditor(l,{...o,theme:a});return v.current=u,u.setModel({original:h.editor.createModel(e??``,r??n),modified:h.editor.createModel(t??``,i??n)}),s?.(u,h),()=>{let e=u.getModel();u.dispose(),y.current||e?.original.dispose(),b.current||e?.modified.dispose(),v.current=null}},[h]),(0,g.useEffect)(()=>{let t=v.current?.getModel();t&&e!=null&&e!==t.original.getValue()&&t.original.setValue(e)},[e]),(0,g.useEffect)(()=>{let e=v.current?.getModel();e&&t!=null&&t!==e.modified.getValue()&&e.modified.setValue(t)},[t]),Cj(h,a,v),(0,W.jsx)(`section`,{...m,style:{...wj,width:u,height:d},children:(0,W.jsx)(`div`,{ref:_,className:l,style:{width:`100%`}})})}var Tj=(e=[])=>{let t=On(),n=Object.keys(t);if(e.some(e=>!n.includes(e)))throw Error(`${e.join(`, `)} are required`);return t};function Ej(e,t){let n=t.map(e=>e.fileGlob),r=t.flatMap(e=>{let t=[e.folderName];return e.subdirectoryGlob?t.concat(e.subdirectoryGlob):t});return e.filter(e=>e.type===Qr.Directory&&r.some(t=>JA(e.path,t))?!0:n.find(t=>JA(e.path,t))!==void 0)}function TFe(e,t){return(0,g.useCallback)(async()=>Ej(await tp(t,`/`),e),[t,e])}function Dj(){let{logEvent:e}=Rg(),t=Fj(),n=lh(),r=ch(e=>e.showSaveConflict);return yj({onMutate:({files:e})=>{e.forEach(e=>{t({...e,saveState:$r.saving})})},onSuccess:async(e,{files:n})=>{n.forEach(n=>{let r=e.files?.[n.path];kf.debug(`Updated ${n.path} after save - lastModified: ${r}`),t({...n,lastModified:r,saveState:$r.unmodified})})},onError:(i,{files:a})=>{if(i instanceof Error&&`status`in i&&i.status===412){let e=i;if(e.instance)try{let t=JSON.parse(e.instance).conflictedFiles;t&&t.length>0&&r(t[0])}catch(e){kf.error(`Failed to parse conflict error instance data`,{error:e})}return}a.forEach(e=>{t({...e,saveState:$r.modified})}),e(`file-save-failed`,{fileNames:n.map(e=>e.path).join(`, `)})}})}function Oj(){let e=oh(),{logEvent:t,captureException:n}=Rg(),r=Pj(),i=Fj(),a=bFe(),{isReadOnly:o}=NA(),{execute:s}=jA(async s=>{if(o)return{success:!1,error:Error(`Unable to delete file - environment is read-only`)};let c=s.saveState;i({...s,saveState:$r.removing});try{return await a.mutateAsync({environmentName:e.environment.name,filePath:s.path}),r(s.path),t(`file-deleted`,{fileName:s.path,account:e.account.name,project:e.project.name,environment:e.environment.name}),{success:!0}}catch(r){return t(`file-deletion-failed`,{account:e.account.name,project:e.project.name,environment:e.environment.name}),n(r),i({...s,saveState:c}),{success:!1,error:r}}});return s}function kj(){let e=Sj(),{logEvent:t,captureException:n}=Rg(),r=Fj(),i=ch(e=>e.projectTreeNodes),a=vj(),o=oh([`account`,`project`,`environment`]),{execute:s}=jA(async(s,c,l,u,d)=>{if(!e)return;let f=l??u.defaultFileTemplate,p=u.createExtensions[f],m=`${c}/${!p||s.toLowerCase().endsWith(`.${p}`)||s===u.predefinedTemplateFilename?.[f]?s:`${s}.${p}`}`,h=(l&&u.newFileTemplates[l]?.trimStart())??d??``,g=i.find(e=>e.path===m);if(g)return g;if(i.length===0){let e=(await tp(o.environment.name,c).catch(()=>[])).find(e=>e.path===m);if(e)return e}let _={content:h,path:m},v={saveState:$r.new,type:Qr.File,..._};try{r(v),e.editor.createModel(_.content??``,void 0,e.Uri.file(m));let n=await a.mutateAsync({environmentName:o.environment.name,file:_,accountName:o.account.name,projectName:o.project.name});return r({...v,lastModified:n.lastModified,saveState:$r.unmodified}),t(`file-added`,{account:o.account.name,project:o.project.name,environment:o.environment.name,fileName:v.path,strategy:u.name}),_}catch(e){t(`file-creation-failed`,{environment:o.environment.name}),n(e),r({...v,saveState:$r.modified});return}});return s}function EFe(e){let t=Sj(),{logEvent:n,captureException:r}=Rg(),i=Tj([`account`,`project`]),a=Fj(),o=Pj(),s=xFe(),{execute:c}=jA(async(c,l)=>{if(t)try{a({...c,saveState:$r.removing}),await s.mutateAsync({environmentName:e,path:c.path,newPath:l}),a({...c,saveState:$r.new,path:l}),t.editor.createModel(c.content??``,void 0,t.Uri.file(l));let r=t.editor.getModel(t.Uri.file(c.path));a({...c,path:l}),r?.dispose(),o(c.path),n(`file-renamed`,{fileName:c.path,environment:e})}catch(t){n(`file-rename-failed`,{account:i.account,project:i.project,environment:e}),r(t),a({...c,saveState:$r.unmodified});return}});return c}function DFe(e){let t=Sj(),{logEvent:n,captureException:r}=Rg(),i=Fj(),a=gFe(),{execute:o}=jA(async(o,s,c)=>{if(!t)return Error(`Failed to acquire monaco instance. Please refresh the page.`);let l=`${s}/${o}`,u={path:l},d={saveState:$r.new,type:Qr.Directory,...u};try{return i(d),await a.mutateAsync({environmentName:e,path:l}),i({...d,saveState:$r.unmodified}),n(`directory-added`,{fileName:d.path,strategy:c.name,environment:e}),u}catch(t){return n(`directory-creation-failed`,{environment:e}),r(t),i({...d,saveState:$r.modified}),t}});return o}function Aj(){return Mj(PA().get(`path`))}function jj(){let e=Sj(),t=Fj();return(0,g.useCallback)((n,r=!1,i=$r.modified)=>{if(t({...n,saveState:i}),r&&e){let t=e.editor.getModel(e.Uri.file(n.path));t&&t.setValue(n.content??``)}},[e,t])}function Mj(e){return ch(t=>e?t.filesByPath[e]:void 0)}function OFe(e){let t=ch(e=>e.projectTreeNodes),n=[],r=Object.values(e);return t.filter(e=>e.type===Qr.Directory).forEach(e=>{let t=r.find(t=>t.folderName===e.path);if(t)return n.push(t)}),r.sort((e,t)=>e.order-t.order)}function Nj(e){return ch(e=>e.projectTreeNodes).filter(t=>!t.path&&!e.fileGlob?!1:t.type===Qr.Directory&&e.subdirectoryGlob?JA(t.path,e.subdirectoryGlob):JA(t.path,e.fileGlob))}function Pj(){let e=Sj(),t=ch(e=>e.removeFile),n=ch(e=>e.filterProjectTreeNodes);return r=>{e&&e.editor.getModel(e.Uri.file(r))?.dispose(),t(r),n(e=>e.path!==r)}}function Fj(){return ch(e=>e.updateFile)}var kFe=e=>{let t=jj(),n=Mj(e);return e=>{n&&t(n,!0,e)}};function Ij(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Lj(e){return`$import(${e})`}function AFe(e){let t=e.split(`/`).pop();return t?t.replace(`.ts`,``):``}function Rj(e,t){let n=/\$import\((.*?)\)/g.exec(e);if(!n||n.length!==2)return`INVALID IMPORT STATEMENT`;let r=n[1];return t!==void 0&&r.indexOf(t)===0?r.substring(t.length):r}var zj=e=>{let t=``;switch(e){case`GITLAB`:t=`GitLab`;break;case`GITHUB`:t=`GitHub`;break;case`BITBUCKET`:t=`Bitbucket`;break;case`AZURE`:t=`Azure DevOps`;break;default:t=e;break}return t},jFe=(e,t)=>{let n=t.accounts.filter(t=>t.name===e),r;if(n[0].sourceControlConfigurations&&n[0].sourceControlConfigurations.length>0)r=n[0].sourceControlConfigurations[0];else{let e=t.global.filter(e=>e.provider===n[0].sourceControlProvider);r=e.length>0?e[0]:null}return r};function Bj(e){if(!e)return``;if(typeof e==`object`){if(e instanceof Ff)return e.detail??e.title??e.message;if(`message`in e)return e.message}return typeof e==`string`?e:``}var Vj=({error:e,size:t=24})=>{switch(e.status){case 401:return(0,W.jsx)(Um,{size:t});case 403:return(0,W.jsx)(vre,{size:t});case 404:return(0,W.jsx)(kre,{size:t});default:return(0,W.jsx)(ym,{size:t})}},MFe=({error:e})=>(0,W.jsx)(`div`,{className:`flex items-center gap-2 rounded-full border-2 border-neutral-100 bg-neutral-50 text-neutral-300 p-4`,children:(0,W.jsx)(Vj,{error:e})}),NFe=({error:e})=>{switch(e.status){case 401:return(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/accounts/managing-account-members`,children:`Learn more about Managing Account Members`});default:return null}},PFe=({error:e,title:t=`Unable to access`,children:n,className:r,variant:i=`default`})=>(0,W.jsxs)(jS,{variant:i,className:G(`w-full flex items-center gap-8`,r),children:[(0,W.jsx)(MFe,{error:e}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(MS,{children:t}),(0,W.jsxs)(NS,{className:`flex flex-col gap-2`,children:[Bj(e),(0,W.jsx)(NFe,{error:e}),n]})]})]}),Hj=({successMessage:e}={})=>{let t=ah();return{onSuccess:n=>{t.success(n??e,{icon:(0,W.jsx)(mm,{size:18})})},onError:e=>t.error(Bj(e),{icon:e instanceof Ff?(0,W.jsx)(Vj,{error:e,size:18}):(0,W.jsx)(ym,{size:18})})}},Uj=(e,t,n)=>b_({...cj.deployments.list(e,t),...n,select:e=>e.data}),Wj=(e,t={})=>Jse({...cj.deployments.versions.list(e),...t,select:e=>({...e,data:e.data?.map(e=>({...e,stages:[...e.stages].sort((e,t)=>e.stage.localeCompare(t.stage))}))})}),Gj=(e,t={})=>x_(Wj(e,t)),FFe=()=>{let e=oh(),t=Dj(),n=lh();return Gj(e.environment.name),{isPending:t.isPending,isSuccess:t.isSuccess,saveAndDeploy:(0,g.useCallback)(async()=>t.mutateAsync({environmentName:e.environment.name,accountName:e.account.name,projectName:e.project.name,files:n}).catch(e=>{if(!(e instanceof Error&&`status`in e&&e.status===409))throw e}),[t,n,!1,e.environment.name,e.account.name,e.project.name])}},IFe=(e={})=>{let{isReadOnly:t=!1,onSave:n}=e,{saveAndDeploy:r,isPending:i,isSuccess:a}=FFe(),[o,s]=(0,g.useState)(null),c=ch(e=>{let t=0;for(let n of e.projectTreeNodes){let r=n.path?e.filesByPath[n.path]:void 0;r&&r.saveState===$r.modified&&t++}return t}),l=ch(e=>{let t=0;for(let n of e.projectTreeNodes){let r=n.path?e.filesByPath[n.path]:void 0;r&&(r.saveState===$r.modified||r.saveState===$r.saving)&&t++}return t}),u=(0,g.useRef)(null),d=e=>{s(e),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{s(null)},1600)},f=AA(r),p=AA(n),m=ih(e=>e.addToast),h=(0,g.useRef)(!1),_=(0,g.useRef)(!1);return(0,g.useEffect)(()=>{let e=h.current;!e&&i?_.current=l>0:e&&!i&&a&&_.current&&(m({message:`Changes saved`,icon:(0,g.createElement)(mm,{size:18}),duration:2e3}),_.current=!1),h.current=i},[i,a,l,m]),(0,g.useEffect)(()=>{let e=async e=>{try{if(e.code===`KeyS`&&(e.metaKey||e.ctrlKey)){if(e.preventDefault(),t){d(`Read only environment`);return}let n=document.activeElement;if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement){let e=n.selectionEnd;n.blur(),n.focus(),(n instanceof HTMLInputElement&&n.type!==`checkbox`||n instanceof HTMLTextAreaElement)&&n.setSelectionRange(e,e),await yPe(100)}if(c===0){d(`No unsaved changes`);return}p.current?.(),await f.current()}}catch(e){kf.error(`Error saving files`,{error:e}),s(`Error saving files`)}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,c,f,p]),{showTooltip:o,isSaving:i,unsavedChangesCount:c,saveAll:r}},LFe=()=>{let{showTooltip:e,saveAll:t,isSaving:n,unsavedChangesCount:r}=IFe(),{hasEditor:i,editorName:a,isLoading:o,showPreferenceDialog:s,setShowPreferenceDialog:c,availableEditors:l,savePreference:u,openInEditor:d}=vPe();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`sticky bottom-0 h-12 border-t bg-surface-sunken items-center flex px-2 gap-x-2`,children:[(0,W.jsx)(Ck,{open:!!e,content:e??``,children:(0,W.jsx)(Y,{variant:r>0||n?`default`:`ghost`,size:`sm`,className:`text-xs`,"data-test":`save`,disabled:n,onClick:async()=>{await t()},children:(0,W.jsxs)(Tk,{className:`flex items-center gap-1 text-xs relative`,loading:n,children:[`Save`,(0,W.jsx)(`span`,{className:r>0?`text-white`:`text-muted-foreground`,children:`[⌘+S]`})]})})}),!o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`h-6 w-px bg-border`}),(0,W.jsx)(Ck,{content:i?`Open in ${a}`:`Choose editor to open files`,children:(0,W.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:d,className:`text-xs`,children:[(0,W.jsx)(Am,{size:14}),`Open in Editor`]})})]})]}),(0,W.jsx)(_Pe,{open:s,editors:l,onSelect:u,onCancel:()=>c(!1)})]})},Kj=(0,g.createContext)(null);Kj.displayName=`PanelGroupContext`;var qj={group:`data-panel-group`,groupDirection:`data-panel-group-direction`,groupId:`data-panel-group-id`,panel:`data-panel`,panelCollapsible:`data-panel-collapsible`,panelId:`data-panel-id`,panelSize:`data-panel-size`,resizeHandle:`data-resize-handle`,resizeHandleActive:`data-resize-handle-active`,resizeHandleEnabled:`data-panel-resize-handle-enabled`,resizeHandleId:`data-panel-resize-handle-id`,resizeHandleState:`data-resize-handle-state`},Jj=10,Yj=g.useLayoutEffect,Xj=g.useId,RFe=typeof Xj==`function`?Xj:()=>null,zFe=0;function Zj(e=null){let t=RFe(),n=(0,g.useRef)(e||t||null);return n.current===null&&(n.current=``+ zFe++),e??n.current}function Qj({children:e,className:t=``,collapsedSize:n,collapsible:r,defaultSize:i,forwardedRef:a,id:o,maxSize:s,minSize:c,onCollapse:l,onExpand:u,onResize:d,order:f,style:p,tagName:m=`div`,...h}){let _=(0,g.useContext)(Kj);if(_===null)throw Error(`Panel components must be rendered within a PanelGroup container`);let{collapsePanel:v,expandPanel:y,getPanelSize:b,getPanelStyle:x,groupId:S,isPanelCollapsed:C,reevaluatePanelConstraints:w,registerPanel:T,resizePanel:E,unregisterPanel:D}=_,O=Zj(o),k=(0,g.useRef)({callbacks:{onCollapse:l,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:s,minSize:c},id:O,idIsFromProps:o!==void 0,order:f});(0,g.useRef)({didLogMissingDefaultSizeWarning:!1}),Yj(()=>{let{callbacks:e,constraints:t}=k.current,a={...t};k.current.id=O,k.current.idIsFromProps=o!==void 0,k.current.order=f,e.onCollapse=l,e.onExpand=u,e.onResize=d,t.collapsedSize=n,t.collapsible=r,t.defaultSize=i,t.maxSize=s,t.minSize=c,(a.collapsedSize!==t.collapsedSize||a.collapsible!==t.collapsible||a.maxSize!==t.maxSize||a.minSize!==t.minSize)&&w(k.current,a)}),Yj(()=>{let e=k.current;return T(e),()=>{D(e)}},[f,O,T,D]),(0,g.useImperativeHandle)(a,()=>({collapse:()=>{v(k.current)},expand:e=>{y(k.current,e)},getId(){return O},getSize(){return b(k.current)},isCollapsed(){return C(k.current)},isExpanded(){return!C(k.current)},resize:e=>{E(k.current,e)}}),[v,y,b,C,O,E]);let A=x(k.current,i);return(0,g.createElement)(m,{...h,children:e,className:t,id:O,style:{...A,...p},[qj.groupId]:S,[qj.panel]:``,[qj.panelCollapsible]:r||void 0,[qj.panelId]:O,[qj.panelSize]:parseFloat(``+A.flexGrow).toFixed(1)})}var $j=(0,g.forwardRef)((e,t)=>(0,g.createElement)(Qj,{...e,forwardedRef:t}));Qj.displayName=`Panel`,$j.displayName=`forwardRef(Panel)`;var BFe;function VFe(){return BFe}var eM=null,HFe=!0,tM=-1,nM=null;function UFe(e,t){if(t){let e=(t&fM)!==0,n=(t&pM)!==0,r=(t&mM)!==0,i=(t&hM)!==0;if(e)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}switch(e){case`horizontal`:return`ew-resize`;case`intersection`:return`move`;case`vertical`:return`ns-resize`}}function WFe(){nM!==null&&(document.head.removeChild(nM),eM=null,nM=null,tM=-1)}function rM(e,t){if(!HFe)return;let n=UFe(e,t);if(eM!==n){if(eM=n,nM===null){nM=document.createElement(`style`);let e=VFe();e&&nM.setAttribute(`nonce`,e),document.head.appendChild(nM)}if(tM>=0){var r;(r=nM.sheet)==null||r.removeRule(tM)}tM=nM.sheet?.insertRule(`*{cursor: ${n} !important;}`)??-1}}function iM(e){return e.type===`keydown`}function aM(e){return e.type.startsWith(`pointer`)}function oM(e){return e.type.startsWith(`mouse`)}function sM(e){if(aM(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(oM(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function GFe(){if(typeof matchMedia==`function`)return matchMedia(`(pointer:coarse)`).matches?`coarse`:`fine`}function KFe(e,t,n){return n?e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y:e.x<=t.x+t.width&&e.x+e.width>=t.x&&e.y<=t.y+t.height&&e.y+e.height>=t.y}function qFe(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:uM(e),b:uM(t)},r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;AM(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:lM(cM(n.a)),b:lM(cM(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var JFe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function YFe(e){let t=getComputedStyle(dM(e)??e).display;return t===`flex`||t===`inline-flex`}function XFe(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||YFe(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||JFe.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function cM(e){let t=e.length;for(;t--;){let n=e[t];if(AM(n,`Missing node`),XFe(n))return n}return null}function lM(e){return e&&Number(getComputedStyle(e).zIndex)||0}function uM(e){let t=[];for(;e;)t.push(e),e=dM(e);return t}function dM(e){let{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}var fM=1,pM=2,mM=4,hM=8,ZFe=GFe()===`coarse`,gM=[],_M=!1,vM=new Map,yM=new Map,bM=new Set;function QFe(e,t,n,r,i){let{ownerDocument:a}=t,o={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:i},s=vM.get(a)??0;return vM.set(a,s+1),bM.add(o),OM(),function(){yM.delete(e),bM.delete(o);let t=vM.get(a)??1;if(vM.set(a,t-1),OM(),t===1&&vM.delete(a),gM.includes(o)){let e=gM.indexOf(o);e>=0&&gM.splice(e,1),EM(),i(`up`,!0,null)}}}function $Fe(e){let{target:t}=e,{x:n,y:r}=sM(e);_M=!0,wM({target:t,x:n,y:r}),OM(),gM.length>0&&(kM(`down`,e),e.preventDefault(),CM(t)||e.stopImmediatePropagation())}function xM(e){let{x:t,y:n}=sM(e);if(_M&&e.buttons===0&&(_M=!1,kM(`up`,e)),!_M){let{target:r}=e;wM({target:r,x:t,y:n})}kM(`move`,e),EM(),gM.length>0&&e.preventDefault()}function SM(e){let{target:t}=e,{x:n,y:r}=sM(e);yM.clear(),_M=!1,gM.length>0&&(e.preventDefault(),CM(t)||e.stopImmediatePropagation()),kM(`up`,e),wM({target:t,x:n,y:r}),EM(),OM()}function CM(e){let t=e;for(;t;){if(t.hasAttribute(qj.resizeHandle))return!0;t=t.parentElement}return!1}function wM({target:e,x:t,y:n}){gM.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),bM.forEach(e=>{let{element:i,hitAreaMargins:a}=e,o=i.getBoundingClientRect(),{bottom:s,left:c,right:l,top:u}=o,d=ZFe?a.coarse:a.fine;if(t>=c-d&&t<=l+d&&n>=u-d&&n<=s+d){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&qFe(r,i)>0){let e=r,t=!1;for(;e&&!e.contains(i);){if(KFe(e.getBoundingClientRect(),o,!0)){t=!0;break}e=e.parentElement}if(t)return}gM.push(e)}})}function TM(e,t){yM.set(e,t)}function EM(){let e=!1,t=!1;gM.forEach(n=>{let{direction:r}=n;r===`horizontal`?e=!0:t=!0});let n=0;yM.forEach(e=>{n|=e}),e&&t?rM(`intersection`,n):e?rM(`horizontal`,n):t?rM(`vertical`,n):WFe()}var DM=new AbortController;function OM(){DM.abort(),DM=new AbortController;let e={capture:!0,signal:DM.signal};bM.size&&(_M?(gM.length>0&&vM.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`contextmenu`,SM,e),r.addEventListener(`pointerleave`,xM,e),r.addEventListener(`pointermove`,xM,e))}),window.addEventListener(`pointerup`,SM,e),window.addEventListener(`pointercancel`,SM,e)):vM.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`pointerdown`,$Fe,e),r.addEventListener(`pointermove`,xM,e))}))}function kM(e,t){bM.forEach(n=>{let{setResizeHandlerState:r}=n;r(e,gM.includes(n),t)})}function eIe(){let[e,t]=(0,g.useState)(0);return(0,g.useCallback)(()=>t(e=>e+1),[])}function AM(e,t){if(!e)throw console.error(t),Error(t)}function jM(e,t,n=Jj){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function MM(e,t,n=Jj){return jM(e,t,n)===0}function NM(e,t,n){return jM(e,t,n)===0}function tIe(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],a=t[r];if(!NM(i,a,n))return!1}return!0}function PM({panelConstraints:e,panelIndex:t,size:n}){let r=e[t];AM(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,maxSize:o=100,minSize:s=0}=r;if(jM(n,s)<0)if(a){let e=(i+s)/2;n=jM(n,e)<0?i:s}else n=s;return n=Math.min(o,n),n=parseFloat(n.toFixed(Jj)),n}function FM({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(NM(e,0))return t;let o=[...t],[s,c]=r;AM(s!=null,`Invalid first pivot index`),AM(c!=null,`Invalid second pivot index`);let l=0;if(a===`keyboard`){{let r=e<0?c:s,i=n[r];AM(i,`Panel constraints not found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(AM(n!=null,`Previous layout not found for panel index ${r}`),NM(n,a)){let t=l-n;jM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?s:c,i=n[r];AM(i,`No panel constraints found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(AM(n!=null,`Previous layout not found for panel index ${r}`),NM(n,l)){let t=n-a;jM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,i=e<0?c:s,a=0;for(;;){let e=t[i];AM(e!=null,`Previous layout not found for panel index ${i}`);let o=PM({panelConstraints:n,panelIndex:i,size:100})-e;if(a+=o,i+=r,i<0||i>=n.length)break}let o=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-o:o}{let r=e<0?s:c;for(;r>=0&&r<n.length;){let i=Math.abs(e)-Math.abs(l),a=t[r];AM(a!=null,`Previous layout not found for panel index ${r}`);let s=a-i,c=PM({panelConstraints:n,panelIndex:r,size:s});if(!NM(a,c)&&(l+=a-c,o[r]=c,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(tIe(i,o))return i;{let r=e<0?c:s,i=t[r];AM(i!=null,`Previous layout not found for panel index ${r}`);let a=i+l,u=PM({panelConstraints:n,panelIndex:r,size:a});if(o[r]=u,!NM(u,a)){let t=a-u,r=e<0?c:s;for(;r>=0&&r<n.length;){let i=o[r];AM(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=PM({panelConstraints:n,panelIndex:r,size:a});if(NM(i,s)||(t-=s-i,o[r]=s),NM(t,0))break;e>0?r--:r++}}}return NM(o.reduce((e,t)=>t+e,0),100)?o:i}function nIe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,a=0,o=0,s=n[0];return AM(s!=null,`No pivot index found`),t.forEach((e,t)=>{let{constraints:n}=e,{maxSize:c=100,minSize:l=0}=n;t===s?(r=l,i=c):(a+=l,o+=c)}),{valueMax:Math.min(i,100-a),valueMin:Math.max(r,100-o),valueNow:e[s]}}function IM(e,t=document){return Array.from(t.querySelectorAll(`[${qj.resizeHandleId}][data-panel-group-id="${e}"]`))}function LM(e,t,n=document){return IM(e,n).findIndex(e=>e.getAttribute(qj.resizeHandleId)===t)??null}function RM(e,t,n){let r=LM(e,t,n);return r==null?[-1,-1]:[r,r+1]}function zM(e,t=document){return t instanceof HTMLElement&&t?.dataset?.panelGroupId==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function BM(e,t=document){return t.querySelector(`[${qj.resizeHandleId}="${e}"]`)||null}function rIe(e,t,n,r=document){let i=BM(t,r),a=IM(e,r),o=i?a.indexOf(i):-1;return[n[o]?.id??null,n[o+1]?.id??null]}function iIe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:i,panelGroupElement:a,setLayout:o}){(0,g.useRef)({didWarnAboutMissingResizeHandle:!1}),Yj(()=>{if(!a)return;let e=IM(n,a);for(let t=0;t<i.length-1;t++){let{valueMax:n,valueMin:a,valueNow:o}=nIe({layout:r,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(s!=null){let e=i[t];AM(e,`No panel data found for index "${t}"`),s.setAttribute(`aria-controls`,e.id),s.setAttribute(`aria-valuemax`,``+Math.round(n)),s.setAttribute(`aria-valuemin`,``+Math.round(a)),s.setAttribute(`aria-valuenow`,o==null?``:``+Math.round(o))}}return()=>{e.forEach((e,t)=>{e.removeAttribute(`aria-controls`),e.removeAttribute(`aria-valuemax`),e.removeAttribute(`aria-valuemin`),e.removeAttribute(`aria-valuenow`)})}},[n,r,i,a]),(0,g.useEffect)(()=>{if(!a)return;let e=t.current;AM(e,`Eager values not found`);let{panelDataArray:i}=e;AM(zM(n,a)!=null,`No group found for id "${n}"`);let s=IM(n,a);AM(s,`No resize handles found for group id "${n}"`);let c=s.map(e=>{let t=e.getAttribute(qj.resizeHandleId);AM(t,`Resize handle element has no handle id attribute`);let[s,c]=rIe(n,t,i,a);if(s==null||c==null)return()=>{};let l=e=>{if(!e.defaultPrevented)switch(e.key){case`Enter`:{e.preventDefault();let c=i.findIndex(e=>e.id===s);if(c>=0){let e=i[c];AM(e,`No panel data found for index ${c}`);let s=r[c],{collapsedSize:l=0,collapsible:u,minSize:d=0}=e.constraints;if(s!=null&&u){let e=FM({delta:NM(s,l)?d-l:l-s,initialLayout:r,panelConstraints:i.map(e=>e.constraints),pivotIndices:RM(n,t,a),prevLayout:r,trigger:`keyboard`});r!==e&&o(e)}}break}}};return e.addEventListener(`keydown`,l),()=>{e.removeEventListener(`keydown`,l)}});return()=>{c.forEach(e=>e())}},[a,e,t,n,r,i,o])}function VM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function HM(e,t){let n=e===`horizontal`,{x:r,y:i}=sM(t);return n?r:i}function aIe(e,t,n,r,i){let a=n===`horizontal`,o=BM(t,i);AM(o,`No resize handle element found for id "${t}"`);let s=o.getAttribute(qj.groupId);AM(s,`Resize handle element has no group id attribute`);let{initialCursorPosition:c}=r,l=HM(n,e),u=zM(s,i);AM(u,`No group element found for id "${s}"`);let d=u.getBoundingClientRect(),f=a?d.width:d.height;return(l-c)/f*100}function oIe(e,t,n,r,i,a){if(iM(e)){let t=n===`horizontal`,r=0;r=e.shiftKey?100:i??10;let a=0;switch(e.key){case`ArrowDown`:a=t?0:r;break;case`ArrowLeft`:a=t?-r:0;break;case`ArrowRight`:a=t?r:0;break;case`ArrowUp`:a=t?0:-r;break;case`End`:a=100;break;case`Home`:a=-100;break}return a}else return r==null?0:aIe(e,t,n,r,a)}function sIe({panelDataArray:e}){let t=Array(e.length),n=e.map(e=>e.constraints),r=0,i=100;for(let a=0;a<e.length;a++){let e=n[a];AM(e,`Panel constraints not found for index ${a}`);let{defaultSize:o}=e;o!=null&&(r++,t[a]=o,i-=o)}for(let a=0;a<e.length;a++){let o=n[a];AM(o,`Panel constraints not found for index ${a}`);let{defaultSize:s}=o;if(s!=null)continue;let c=e.length-r,l=i/c;r++,t[a]=l,i-=l}return t}function UM(e,t,n){t.forEach((t,r)=>{let i=e[r];AM(i,`Panel data not found for index ${r}`);let{callbacks:a,constraints:o,id:s}=i,{collapsedSize:c=0,collapsible:l}=o,u=n[s];if(u==null||t!==u){n[s]=t;let{onCollapse:e,onExpand:r,onResize:i}=a;i&&i(t,u),l&&(e||r)&&(r&&(u==null||MM(u,c))&&!MM(t,c)&&r(),e&&(u==null||!MM(u,c))&&MM(t,c)&&e())}})}function WM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function cIe({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:a=3}){let o=n[i],s;return s=o==null?e==null?`1`:e.toPrecision(a):r.length===1?`1`:o.toPrecision(a),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:`hidden`,pointerEvents:t===null?void 0:`none`}}function lIe(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function GM(e){try{if(typeof localStorage<`u`)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error(`localStorage not supported in this environment`)}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function KM(e){return`react-resizable-panels:${e}`}function qM(e){return e.map(e=>{let{constraints:t,id:n,idIsFromProps:r,order:i}=e;return r?n:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(`,`)}function JM(e,t){try{let n=KM(e),r=t.getItem(n);if(r){let e=JSON.parse(r);if(typeof e==`object`&&e)return e}}catch{}return null}function uIe(e,t,n){return(JM(e,n)??{})[qM(t)]??null}function dIe(e,t,n,r,i){let a=KM(e),o=qM(t),s=JM(e,i)??{};s[o]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(a,JSON.stringify(s))}catch(e){console.error(e)}}function YM({layout:e,panelConstraints:t}){let n=[...e],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!NM(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];AM(t!=null,`No layout data found for index ${e}`),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];AM(r!=null,`No layout data found for index ${e}`);let a=PM({panelConstraints:t,panelIndex:e,size:r});r!=a&&(i+=r-a,n[e]=a)}if(!NM(i,0))for(let e=0;e<t.length;e++){let r=n[e];AM(r!=null,`No layout data found for index ${e}`);let a=r+i,o=PM({panelConstraints:t,panelIndex:e,size:a});if(r!==o&&(i-=o-r,n[e]=o,NM(i,0)))break}return n}var fIe=100,XM={getItem:e=>(GM(XM),XM.getItem(e)),setItem:(e,t)=>{GM(XM),XM.setItem(e,t)}},ZM={};function QM({autoSaveId:e=null,children:t,className:n=``,direction:r,forwardedRef:i,id:a=null,onLayout:o=null,keyboardResizeBy:s=null,storage:c=XM,style:l,tagName:u=`div`,...d}){let f=Zj(a),p=(0,g.useRef)(null),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)([]),y=eIe(),b=(0,g.useRef)({}),x=(0,g.useRef)(new Map),S=(0,g.useRef)(0),C=(0,g.useRef)({autoSaveId:e,direction:r,dragState:m,id:f,keyboardResizeBy:s,onLayout:o,storage:c}),w=(0,g.useRef)({layout:_,panelDataArray:[],panelDataArrayChanged:!1});(0,g.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,g.useImperativeHandle)(i,()=>({getId:()=>C.current.id,getLayout:()=>{let{layout:e}=w.current;return e},setLayout:e=>{let{onLayout:t}=C.current,{layout:n,panelDataArray:r}=w.current,i=YM({layout:e,panelConstraints:r.map(e=>e.constraints)});VM(n,i)||(v(i),w.current.layout=i,t&&t(i),UM(r,i,b.current))}}),[]),Yj(()=>{C.current.autoSaveId=e,C.current.direction=r,C.current.dragState=m,C.current.id=f,C.current.onLayout=o,C.current.storage=c}),iIe({committedValuesRef:C,eagerValuesRef:w,groupId:f,layout:_,panelDataArray:w.current.panelDataArray,setLayout:v,panelGroupElement:p.current}),(0,g.useEffect)(()=>{let{panelDataArray:t}=w.current;if(e){if(_.length===0||_.length!==t.length)return;let n=ZM[e];n??(n=lIe(dIe,fIe),ZM[e]=n);let r=[...t],i=new Map(x.current);n(e,r,i,_,c)}},[e,_,c]),(0,g.useEffect)(()=>{});let T=(0,g.useCallback)(e=>{let{onLayout:t}=C.current,{layout:n,panelDataArray:r}=w.current;if(e.constraints.collapsible){let i=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:o,pivotIndices:s}=tN(r,e,n);if(AM(o!=null,`Panel size not found for panel "${e.id}"`),!MM(o,a)){x.current.set(e.id,o);let c=FM({delta:eN(r,e)===r.length-1?o-a:a-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:`imperative-api`});WM(n,c)||(v(c),w.current.layout=c,t&&t(c),UM(r,c,b.current))}}},[]),E=(0,g.useCallback)((e,t)=>{let{onLayout:n}=C.current,{layout:r,panelDataArray:i}=w.current;if(e.constraints.collapsible){let a=i.map(e=>e.constraints),{collapsedSize:o=0,panelSize:s=0,minSize:c=0,pivotIndices:l}=tN(i,e,r),u=t??c;if(MM(s,o)){let t=x.current.get(e.id),o=t!=null&&t>=u?t:u,c=FM({delta:eN(i,e)===i.length-1?s-o:o-s,initialLayout:r,panelConstraints:a,pivotIndices:l,prevLayout:r,trigger:`imperative-api`});WM(r,c)||(v(c),w.current.layout=c,n&&n(c),UM(i,c,b.current))}}},[]),D=(0,g.useCallback)(e=>{let{layout:t,panelDataArray:n}=w.current,{panelSize:r}=tN(n,e,t);return AM(r!=null,`Panel size not found for panel "${e.id}"`),r},[]),O=(0,g.useCallback)((e,t)=>{let{panelDataArray:n}=w.current;return cIe({defaultSize:t,dragState:m,layout:_,panelData:n,panelIndex:eN(n,e)})},[m,_]),k=(0,g.useCallback)(e=>{let{layout:t,panelDataArray:n}=w.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=tN(n,e,t);return AM(a!=null,`Panel size not found for panel "${e.id}"`),i===!0&&MM(a,r)},[]),A=(0,g.useCallback)(e=>{let{layout:t,panelDataArray:n}=w.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=tN(n,e,t);return AM(a!=null,`Panel size not found for panel "${e.id}"`),!i||jM(a,r)>0},[]),j=(0,g.useCallback)(e=>{let{panelDataArray:t}=w.current;t.push(e),t.sort((e,t)=>{let n=e.order,r=t.order;return n==null&&r==null?0:n==null?-1:r==null?1:n-r}),w.current.panelDataArrayChanged=!0,y()},[y]);Yj(()=>{if(w.current.panelDataArrayChanged){w.current.panelDataArrayChanged=!1;let{autoSaveId:e,onLayout:t,storage:n}=C.current,{layout:r,panelDataArray:i}=w.current,a=null;if(e){let t=uIe(e,i,n);t&&(x.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}a??=sIe({panelDataArray:i});let o=YM({layout:a,panelConstraints:i.map(e=>e.constraints)});VM(r,o)||(v(o),w.current.layout=o,t&&t(o),UM(i,o,b.current))}}),Yj(()=>{let e=w.current;return()=>{e.layout=[]}},[]);let M=(0,g.useCallback)(e=>{let t=!1,n=p.current;return n&&window.getComputedStyle(n,null).getPropertyValue(`direction`)===`rtl`&&(t=!0),function(n){n.preventDefault();let r=p.current;if(!r)return()=>null;let{direction:i,dragState:a,id:o,keyboardResizeBy:s,onLayout:c}=C.current,{layout:l,panelDataArray:u}=w.current,{initialLayout:d}=a??{},f=RM(o,e,r),m=oIe(n,e,i,a,s,r),h=i===`horizontal`;h&&t&&(m=-m);let g=u.map(e=>e.constraints),_=FM({delta:m,initialLayout:d??l,panelConstraints:g,pivotIndices:f,prevLayout:l,trigger:iM(n)?`keyboard`:`mouse-or-touch`}),y=!WM(l,_);(aM(n)||oM(n))&&S.current!=m&&(S.current=m,!y&&m!==0?h?TM(e,m<0?fM:pM):TM(e,m<0?mM:hM):TM(e,0)),y&&(v(_),w.current.layout=_,c&&c(_),UM(u,_,b.current))}},[]),N=(0,g.useCallback)((e,t)=>{let{onLayout:n}=C.current,{layout:r,panelDataArray:i}=w.current,a=i.map(e=>e.constraints),{panelSize:o,pivotIndices:s}=tN(i,e,r);AM(o!=null,`Panel size not found for panel "${e.id}"`);let c=FM({delta:eN(i,e)===i.length-1?o-t:t-o,initialLayout:r,panelConstraints:a,pivotIndices:s,prevLayout:r,trigger:`imperative-api`});WM(r,c)||(v(c),w.current.layout=c,n&&n(c),UM(i,c,b.current))},[]),P=(0,g.useCallback)((e,t)=>{let{layout:n,panelDataArray:r}=w.current,{collapsedSize:i=0,collapsible:a}=t,{collapsedSize:o=0,collapsible:s,maxSize:c=100,minSize:l=0}=e.constraints,{panelSize:u}=tN(r,e,n);u!=null&&(a&&s&&MM(u,i)?MM(i,o)||N(e,o):u<l?N(e,l):u>c&&N(e,c))},[N]),F=(0,g.useCallback)((e,t)=>{let{direction:n}=C.current,{layout:r}=w.current;if(!p.current)return;let i=BM(e,p.current);AM(i,`Drag handle element not found for id "${e}"`);let a=HM(n,t);h({dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),I=(0,g.useCallback)(()=>{h(null)},[]),L=(0,g.useCallback)(e=>{let{panelDataArray:t}=w.current,n=eN(t,e);n>=0&&(t.splice(n,1),delete b.current[e.id],w.current.panelDataArrayChanged=!0,y())},[y]),R=(0,g.useMemo)(()=>({collapsePanel:T,direction:r,dragState:m,expandPanel:E,getPanelSize:D,getPanelStyle:O,groupId:f,isPanelCollapsed:k,isPanelExpanded:A,reevaluatePanelConstraints:P,registerPanel:j,registerResizeHandle:M,resizePanel:N,startDragging:F,stopDragging:I,unregisterPanel:L,panelGroupElement:p.current}),[T,m,r,E,D,O,f,k,A,P,j,M,N,F,I,L]),z={display:`flex`,flexDirection:r===`horizontal`?`row`:`column`,height:`100%`,overflow:`hidden`,width:`100%`};return(0,g.createElement)(Kj.Provider,{value:R},(0,g.createElement)(u,{...d,children:t,className:n,id:a,ref:p,style:{...z,...l},[qj.group]:``,[qj.groupDirection]:r,[qj.groupId]:f}))}var $M=(0,g.forwardRef)((e,t)=>(0,g.createElement)(QM,{...e,forwardedRef:t}));QM.displayName=`PanelGroup`,$M.displayName=`forwardRef(PanelGroup)`;function eN(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function tN(e,t,n){let r=eN(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],a=n[r];return{...t.constraints,panelSize:a,pivotIndices:i}}function pIe({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){(0,g.useEffect)(()=>{if(e||n==null||r==null)return;let i=BM(t,r);if(i==null)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:case`ArrowUp`:case`End`:case`Home`:e.preventDefault(),n(e);break;case`F6`:{e.preventDefault();let n=i.getAttribute(qj.groupId);AM(n,`No group element found for id "${n}"`);let a=IM(n,r),o=LM(n,t,r);AM(o!==null,`No resize element found for id "${t}"`),a[e.shiftKey?o>0?o-1:a.length-1:o+1<a.length?o+1:0].focus();break}}};return i.addEventListener(`keydown`,a),()=>{i.removeEventListener(`keydown`,a)}},[r,e,t,n])}function nN({children:e=null,className:t=``,disabled:n=!1,hitAreaMargins:r,id:i,onBlur:a,onClick:o,onDragging:s,onFocus:c,onPointerDown:l,onPointerUp:u,style:d={},tabIndex:f=0,tagName:p=`div`,...m}){let h=(0,g.useRef)(null),_=(0,g.useRef)({onClick:o,onDragging:s,onPointerDown:l,onPointerUp:u});(0,g.useEffect)(()=>{_.current.onClick=o,_.current.onDragging=s,_.current.onPointerDown=l,_.current.onPointerUp=u});let v=(0,g.useContext)(Kj);if(v===null)throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);let{direction:y,groupId:b,registerResizeHandle:x,startDragging:S,stopDragging:C,panelGroupElement:w}=v,T=Zj(i),[E,D]=(0,g.useState)(`inactive`),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(null),M=(0,g.useRef)({state:E});Yj(()=>{M.current.state=E}),(0,g.useEffect)(()=>{if(n)j(null);else{let e=x(T);j(()=>e)}},[n,T,x]);let N=r?.coarse??15,P=r?.fine??5;(0,g.useEffect)(()=>{if(n||A==null)return;let e=h.current;AM(e,`Element ref not attached`);let t=!1;return QFe(T,e,y,{coarse:N,fine:P},(e,n,r)=>{if(!n){D(`inactive`);return}switch(e){case`down`:{D(`drag`),t=!1,AM(r,`Expected event to be defined for "down" action`),S(T,r);let{onDragging:e,onPointerDown:n}=_.current;e?.(!0),n?.();break}case`move`:{let{state:e}=M.current;t=!0,e!==`drag`&&D(`hover`),AM(r,`Expected event to be defined for "move" action`),A(r);break}case`up`:{D(`hover`),C();let{onClick:e,onDragging:n,onPointerUp:r}=_.current;n?.(!1),r?.(),t||e?.();break}}})},[N,y,n,P,x,T,A,S,C]),pIe({disabled:n,handleId:T,resizeHandler:A,panelGroupElement:w});let F={touchAction:`none`,userSelect:`none`};return(0,g.createElement)(p,{...m,children:e,className:t,id:i,onBlur:()=>{k(!1),a?.()},onFocus:()=>{k(!0),c?.()},ref:h,role:`separator`,style:{...F,...d},tabIndex:f,[qj.groupDirection]:y,[qj.groupId]:b,[qj.resizeHandle]:``,[qj.resizeHandleActive]:E===`drag`?`pointer`:O?`keyboard`:void 0,[qj.resizeHandleEnabled]:!n,[qj.resizeHandleId]:T,[qj.resizeHandleState]:E})}nN.displayName=`PanelResizeHandle`;var rN=({className:e,...t})=>(0,W.jsx)($M,{className:G(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...t}),iN=$j,aN=({withHandle:e,className:t,...n})=>(0,W.jsx)(nN,{className:G(`relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90`,t),...n,children:e&&(0,W.jsx)(`div`,{className:`z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-border`,children:(0,W.jsx)(Wre,{className:`h-2.5 w-2.5`})})});function oN({className:e,...t}){return(0,W.jsx)(`div`,{className:G(`animate-pulse rounded-md bg-primary/10`,e),...t})}var mIe=(0,g.createContext)(null),sN={didCatch:!1,error:null},hIe=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=sN}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(sN))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&gIe(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(sN))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,g.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,g.createElement)(mIe.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function gIe(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var cN=({children:e,fallback:t})=>{let n=Lg();return(0,W.jsx)(hIe,{onError:(e,t)=>{let r={componentStack:t.componentStack};(e instanceof Pf||e instanceof Ff)&&(r.errorType=e.type,r.errorStatus=e.status,r.errorDetail=e.detail,r.errorInstance=e.instance,r.traceId=e.traceId),n.captureException(e,r)},fallbackRender:({error:e,resetErrorBoundary:n})=>t({error:e,resetError:n}),children:e})},lN=({className:e})=>(0,W.jsxs)(`svg`,{className:e,viewBox:`0 0 86 86`,version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,children:[(0,W.jsx)(`title`,{children:`open-api-icon`}),(0,W.jsx)(`g`,{id:`Page-1`,stroke:`none`,strokeWidth:`1`,fill:`none`,fillRule:`evenodd`,children:(0,W.jsxs)(`g`,{id:`open-api-icon`,fill:`currentColor`,children:[(0,W.jsx)(`path`,{d:`M35,16 C39.1263484,16 43.0859173,16.7140679 46.7618776,18.0253747 L36.7225172,28.0635294 C36.1538485,28.0214262 35.5794264,28 35,28 C22.2974508,28 12,38.2974508 12,51 C12,63.7025492 22.2974508,74 35,74 C47.7025492,74 58,63.7025492 58,51 C58,50.4205736 57.9785738,49.8461515 57.9364706,49.2774828 L67.9749824,39.2391236 C69.2860617,42.9148016 70,46.8740262 70,51 C70,70.3299662 54.3299662,86 35,86 C15.6700338,86 0,70.3299662 0,51 C0,31.6700338 15.6700338,16 35,16 Z`,id:`Combined-Shape`}),(0,W.jsx)(`circle`,{id:`Oval`,cx:`35`,cy:`51`,r:`13`}),(0,W.jsx)(`circle`,{id:`Oval-Copy`,cx:`73`,cy:`13`,r:`13`}),(0,W.jsx)(`rect`,{id:`Rectangle`,transform:`translate(54.091883, 31.908117) rotate(-45.000000) translate(-54.091883, -31.908117) `,x:`27.0918831`,y:`26.4081169`,width:`54`,height:`11`})]})})]});function uN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function _Ie(e,t=[]){let n=[];function r(t,r){let i=g.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=g.useMemo(()=>o,Object.values(o));return(0,W.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=g.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>g.createContext(e));return function(n){let r=n?.[e]||t;return g.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,vIe(i,...t)]}function vIe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function dN(e,t=[]){let n=[];function r(t,r){let i=g.createContext(r),a=n.length;n=[...n,r];function o(t){let{scope:n,children:r,...o}=t,s=n?.[e][a]||i,c=g.useMemo(()=>o,Object.values(o));return(0,W.jsx)(s.Provider,{value:c,children:r})}function s(n,o){let s=o?.[e][a]||i,c=g.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return o.displayName=t+`Provider`,[o,s]}let i=()=>{let t=n.map(e=>g.createContext(e));return function(n){let r=n?.[e]||t;return g.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yIe(i,...t)]}function yIe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function bIe(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function fN(...e){return t=>e.forEach(e=>bIe(e,t))}function pN(...e){return g.useCallback(fN(...e),e)}var mN=g.forwardRef((e,t)=>{let{children:n,...r}=e,i=g.Children.toArray(n),a=i.find(SIe);if(a){let e=a.props.children,n=i.map(t=>t===a?g.Children.count(e)>1?g.Children.only(null):g.isValidElement(e)?e.props.children:null:t);return(0,W.jsx)(hN,{...r,ref:t,children:g.isValidElement(e)?g.cloneElement(e,void 0,n):null})}return(0,W.jsx)(hN,{...r,ref:t,children:n})});mN.displayName=`Slot`;var hN=g.forwardRef((e,t)=>{let{children:n,...r}=e;if(g.isValidElement(n)){let e=wIe(n);return g.cloneElement(n,{...CIe(r,n.props),ref:t?fN(t,e):e})}return g.Children.count(n)>1?g.Children.only(null):null});hN.displayName=`SlotClone`;var xIe=({children:e})=>(0,W.jsx)(W.Fragment,{children:e});function SIe(e){return g.isValidElement(e)&&e.type===xIe}function CIe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{a(...e),i(...e)}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function wIe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function TIe(e){let t=e+`CollectionProvider`,[n,r]=dN(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=g.useRef(null),a=g.useRef(new Map).current;return(0,W.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=g.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,W.jsx)(mN,{ref:pN(t,a(s,n).collectionRef),children:r})});c.displayName=s;let l=e+`CollectionItemSlot`,u=`data-radix-collection-item`,d=g.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=g.useRef(null),s=pN(t,o),c=a(l,n);return g.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,W.jsx)(mN,{[u]:``,ref:s,children:r})});d.displayName=l;function f(t){let n=a(e+`CollectionConsumer`,t);return g.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:c,ItemSlot:d},f,r]}var gN=globalThis?.document?g.useLayoutEffect:()=>{},EIe=g.useId||(()=>void 0),DIe=0;function _N(e){let[t,n]=g.useState(EIe());return gN(()=>{e||n(e=>e??String(DIe++))},[e]),e||(t?`radix-${t}`:``)}var vN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=g.forwardRef((e,n)=>{let{asChild:r,...i}=e,a=r?mN:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,W.jsx)(a,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function yN(e){let t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...e)=>t.current?.(...e),[])}function bN({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=OIe({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=yN(n);return[o,g.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function OIe({defaultProp:e,onChange:t}){let n=g.useState(e),[r]=n,i=g.useRef(r),a=yN(t);return g.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}var kIe=g.createContext(void 0);function xN(e){let t=g.useContext(kIe);return e||t||`ltr`}var SN=`rovingFocusGroup.onEntryFocus`,AIe={bubbles:!1,cancelable:!0},CN=`RovingFocusGroup`,[wN,TN,jIe]=TIe(CN),[MIe,EN]=dN(CN,[jIe]),[NIe,PIe]=MIe(CN),DN=g.forwardRef((e,t)=>(0,W.jsx)(wN.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(wN.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(FIe,{...e,ref:t})})}));DN.displayName=CN;var FIe=g.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=g.useRef(null),p=pN(t,f),m=xN(a),[h=null,_]=bN({prop:o,defaultProp:s,onChange:c}),[v,y]=g.useState(!1),b=yN(l),x=TN(n),S=g.useRef(!1),[C,w]=g.useState(0);return g.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(SN,b),()=>e.removeEventListener(SN,b)},[b]),(0,W.jsx)(NIe,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:g.useCallback(e=>_(e),[_]),onItemShiftTab:g.useCallback(()=>y(!0),[]),onFocusableItemAdd:g.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:g.useCallback(()=>w(e=>e-1),[]),children:(0,W.jsx)(vN.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:uN(e.onMouseDown,()=>{S.current=!0}),onFocus:uN(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(SN,AIe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);AN([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:uN(e.onBlur,()=>y(!1))})})}),ON=`RovingFocusGroupItem`,kN=g.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,...o}=e,s=_N(),c=a||s,l=PIe(ON,n),u=l.currentTabStopId===c,d=TN(n),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return g.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),(0,W.jsx)(wN.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:(0,W.jsx)(vN.span,{tabIndex:u?0:-1,"data-orientation":l.orientation,...o,ref:t,onMouseDown:uN(e.onMouseDown,e=>{r?l.onItemFocus(c):e.preventDefault()}),onFocus:uN(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:uN(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){l.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=RIe(e,l.orientation,l.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=d().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=l.loop?zIe(n,r+1):n.slice(r+1)}setTimeout(()=>AN(n))}})})})});kN.displayName=ON;var IIe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function LIe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function RIe(e,t,n){let r=LIe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return IIe[r]}function AN(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zIe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var BIe=DN,VIe=kN;function HIe(e,t){return g.useReducer((e,n)=>t[e][n]??e,e)}var jN=e=>{let{present:t,children:n}=e,r=UIe(t),i=typeof n==`function`?n({present:r.isPresent}):g.Children.only(n),a=pN(r.ref,WIe(i));return typeof n==`function`||r.isPresent?g.cloneElement(i,{ref:a}):null};jN.displayName=`Presence`;function UIe(e){let[t,n]=g.useState(),r=g.useRef({}),i=g.useRef(e),a=g.useRef(`none`),[o,s]=HIe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return g.useEffect(()=>{let e=MN(r.current);a.current=o===`mounted`?e:`none`},[o]),gN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=MN(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),gN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=MN(r.current).includes(a.animationName);if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=MN(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:g.useCallback(e=>{e&&(r.current=getComputedStyle(e)),n(e)},[])}}function MN(e){return e?.animationName||`none`}function WIe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var NN=`Tabs`,[GIe,KIe]=_Ie(NN,[EN]),PN=EN(),[qIe,FN]=GIe(NN),IN=g.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=xN(s),[d,f]=bN({prop:r,onChange:i,defaultProp:a});return(0,W.jsx)(qIe,{scope:n,baseId:_N(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,W.jsx)(vN.div,{dir:u,"data-orientation":o,...l,ref:t})})});IN.displayName=NN;var LN=`TabsList`,RN=g.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=FN(LN,n),o=PN(n);return(0,W.jsx)(BIe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,W.jsx)(vN.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});RN.displayName=LN;var zN=`TabsTrigger`,BN=g.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=FN(zN,n),s=PN(n),c=UN(o.baseId,r),l=WN(o.baseId,r),u=r===o.value;return(0,W.jsx)(VIe,{asChild:!0,...s,focusable:!i,active:u,children:(0,W.jsx)(vN.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:uN(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:uN(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:uN(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});BN.displayName=zN;var VN=`TabsContent`,HN=g.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=FN(VN,n),c=UN(s.baseId,r),l=WN(s.baseId,r),u=r===s.value,d=g.useRef(u);return g.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,W.jsx)(jN,{present:i||u,children:({present:n})=>(0,W.jsx)(vN.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});HN.displayName=VN;function UN(e,t){return`${e}-trigger-${t}`}function WN(e,t){return`${e}-content-${t}`}var GN=IN,KN=RN,qN=BN,JN=HN,YN=GN,JIe=sm(`inline-flex items-center justify-center rounded-md bg-muted text-muted-foreground`,{variants:{variant:{default:``,underline:`w-full justify-start gap-6 rounded-none border-b border-border bg-transparent`},size:{sm:`h-8 px-1 py-1`,default:`h-10 p-1`}},compoundVariants:[{variant:`underline`,className:`h-auto p-0`}],defaultVariants:{variant:`default`,size:`default`}}),YIe=sm(`inline-flex items-center justify-center whitespace-nowrap rounded-xs font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs text-sm`,{variants:{variant:{default:``,underline:`gap-1.5 border-b-2 border-transparent text-muted-foreground hover:text-foreground data-[state=active]:border-brand data-[state=active]:bg-transparent data-[state=active]:text-brand data-[state=active]:shadow-none`},size:{sm:`px-2 py-0.5 rounded-sm`,default:`px-3 py-1.5`}},compoundVariants:[{variant:`underline`,className:`rounded-none px-1 py-2`}],defaultVariants:{variant:`default`,size:`default`}}),XN=g.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,W.jsx)(KN,{ref:i,className:G(JIe({variant:t,size:n}),e),...r}));XN.displayName=KN.displayName;var ZN=g.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,W.jsx)(qN,{ref:i,className:G(YIe({variant:t,size:n}),e),...r}));ZN.displayName=qN.displayName;var QN=g.forwardRef(({className:e,...t},n)=>(0,W.jsx)(JN,{ref:n,className:G(`data-[state=inactive]:hidden`,`mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));QN.displayName=JN.displayName;var XIe=[`@zuplo/runtime`,`@zuplo/graphql`,`@zuplo/otel`],$N=[{name:`@zuplo/test`,version:`0.0.0`,types:`types/@zuplo/test/latest/types.d.ts`},{name:`chai`,version:`0.0.0`,types:`types/@types/chai/latest/index.d.ts`},{name:`openapi-types`,version:`0.0.0`,types:`types/openapi-types/latest/index.d.ts`}],ZIe=[{types:`types/@zuplo/runtime/types/environment.d.ts`,name:`@app/environment`},{types:`types/@zuplo/runtime/types/custom.d.ts`,name:`lib.custom.ts`},{types:`types/@zuplo/runtime/latest/global.d.ts`,name:`global.d.ts`}];async function QIe(){try{return await(await fetch(`https://cdn.zuplo.com/types/remote-modules.d.ts`)).text()}catch(e){wf.captureException(e)}}async function $Ie(e,t){try{let n=await fetch(`${Bf}/types/${e}/${t}/package.json`);if(!n.ok)throw Error(`Error loading package.json for ${e}`);return await n.json()}catch(e){wf.captureException(e)}}async function eLe(){try{let e=await fetch(`${Bf}/types/@zuplo/bundled/bundles.json`);if(!e.ok)throw Error(`Error loading bundles from CDN`);let t=await e.json();return[...$N,...t.bundles]}catch(e){wf.captureException(e)}return[...$N]}async function eP(e){try{let t=await fetch(`${Bf}/${e}`);if(!t.ok)throw Error(`Error loading type definition: ${e}`);return await t.text()}catch(e){wf.captureException(e)}}var tP=async(e,t,n)=>{let r=`https://cdn.jsdelivr.net/npm/${e}@${t}${n}`,i=await fetch(r);return i.ok?i.text():Error(`OK`)};async function tLe(e){await Promise.all(XIe.map(async t=>{let n=await $Ie(t,`latest`);n&&(e.typescript.typescriptDefaults.addExtraLib(JSON.stringify(n),`file:///node_modules/${t}/package.json`),await Promise.all(Object.entries(n.exports).map(async([n,r])=>{let i=await eP(`types/${t}/latest/${r.types.substring(2)}`);if(i){let r=n===`.`?`index.d.ts`:`${n}.d.ts`;e.typescript.typescriptDefaults.addExtraLib(i,`file:///node_modules/${t}/${r}`)}})))}))}async function nP(e){let t=Object.keys(e.typescript.typescriptDefaults.getExtraLibs()),n=await eLe();await Promise.allSettled([...ZIe.map(async({types:t,name:n})=>{let r=await eP(t);r&&e.typescript.typescriptDefaults.addExtraLib(r,n)}),...n.map(async n=>{if(t.includes(n.name))return;let r={name:n.name,version:n.version,types:`./index.d.ts`},i=await eP(n.types);i&&(e.typescript.typescriptDefaults.addExtraLib(JSON.stringify(r),`file:///node_modules/${n.name}/package.json`),e.typescript.typescriptDefaults.addExtraLib(i,`file:///node_modules/${n.name}/index.d.ts`))})])}var rP=null,nLe=`
97
97
  declare module "@zuplo/zudoku-plugin-monetization" {
98
98
  export interface ZuploMonetizationPluginOptions {
99
99
  pricing?: {
@@ -1648,7 +1648,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1648
1648
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZKt(e,t){if(e){if(typeof e==`string`)return QKt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return QKt(e,t)}}function QKt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $Kt(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function eqt(e){if(Array.isArray(e))return e}function F5(){return F5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F5.apply(this,arguments)}var tqt=function(e,t){return g.isValidElement(e)?g.cloneElement(e,t):(0,X0.default)(e)?e(t):g.createElement(`line`,F5({},t,{className:`recharts-reference-line-line`}))},nqt=function(e,t,n,r,i,a,o,s,c){var l=i.x,u=i.y,d=i.width,f=i.height;if(n){var p=c.y,m=e.y.apply(p,{position:a});if(E5(c,`discard`)&&!e.y.isInRange(m))return null;var h=[{x:l+d,y:m},{x:l,y:m}];return s===`left`?h.reverse():h}if(t){var g=c.x,_=e.x.apply(g,{position:a});if(E5(c,`discard`)&&!e.x.isInRange(_))return null;var v=[{x:_,y:u+f},{x:_,y:u}];return o===`top`?v.reverse():v}if(r){var y=c.segment.map(function(t){return e.apply(t,{position:a})});return E5(c,`discard`)&&(0,IKt.default)(y,function(t){return!e.isInRange(t)})?null:y}return null};function rqt(e){var t=e.x,n=e.y,r=e.segment,i=e.xAxisId,a=e.yAxisId,o=e.shape,s=e.className,c=e.alwaysShow,l=MKt(),u=NKt(i),d=PKt(a),f=FKt();if(!l||!f)return null;c2(c===void 0,`The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.`);var p=nqt(A5({x:u.scale,y:d.scale}),R0(t),R0(n),r&&r.length===2,f,e.position,u.orientation,d.orientation,e);if(!p)return null;var m=YKt(p,2),h=m[0],_=h.x,v=h.y,y=m[1],b=y.x,x=y.y,S=KKt(KKt({clipPath:E5(e,`hidden`)?`url(#${l})`:void 0},n2(e,!0)),{},{x1:_,y1:v,x2:b,y2:x});return g.createElement(s2,{className:Hp(`recharts-reference-line`,s)},tqt(o,S),W6.renderCallByParent(e,_Kt({x1:_,y1:v,x2:b,y2:x})))}var I5=function(e){function t(){return LKt(this,t),BKt(this,t,arguments)}return WKt(t,e),zKt(t,[{key:`render`,value:function(){return g.createElement(rqt,this.props)}}])}(g.Component);P5(I5,`displayName`,`ReferenceLine`),P5(I5,`defaultProps`,{isFront:!1,ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`});function L5(){return L5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L5.apply(this,arguments)}function R5(e){"@babel/helpers - typeof";return R5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},R5(e)}function iqt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aqt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?iqt(Object(n),!0).forEach(function(t){V5(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iqt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oqt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function sqt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,mqt(r.key),r)}}function cqt(e,t,n){return t&&sqt(e.prototype,t),n&&sqt(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function lqt(e,t,n){return t=z5(t),uqt(e,fqt()?Reflect.construct(t,n||[],z5(e).constructor):t.apply(e,n))}function uqt(e,t){if(t&&(R5(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return dqt(e)}function dqt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function fqt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fqt=function(){return!!e})()}function z5(e){return z5=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},z5(e)}function pqt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&B5(e,t)}function B5(e,t){return B5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},B5(e,t)}function V5(e,t,n){return t=mqt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mqt(e){var t=hqt(e,`string`);return R5(t)==`symbol`?t:t+``}function hqt(e,t){if(R5(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(R5(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var gqt=function(e){var t=e.x,n=e.y,r=e.xAxis,i=e.yAxis,a=A5({x:r.scale,y:i.scale}),o=a.apply({x:t,y:n},{bandAware:!0});return E5(e,`discard`)&&!a.isInRange(o)?null:o},H5=function(e){function t(){return oqt(this,t),lqt(this,t,arguments)}return pqt(t,e),cqt(t,[{key:`render`,value:function(){var e=this.props,n=e.x,r=e.y,i=e.r,a=e.alwaysShow,o=e.clipPathId,s=R0(n),c=R0(r);if(c2(a===void 0,`The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.`),!s||!c)return null;var l=gqt(this.props);if(!l)return null;var u=l.x,d=l.y,f=this.props,p=f.shape,m=f.className,h=aqt(aqt({clipPath:E5(this.props,`hidden`)?`url(#${o})`:void 0},n2(this.props,!0)),{},{cx:u,cy:d});return g.createElement(s2,{className:Hp(`recharts-reference-dot`,m)},t.renderDot(p,h),W6.renderCallByParent(this.props,{x:u-i,y:d-i,width:2*i,height:2*i}))}}])}(g.Component);V5(H5,`displayName`,`ReferenceDot`),V5(H5,`defaultProps`,{isFront:!1,ifOverflow:`discard`,xAxisId:0,yAxisId:0,r:10,fill:`#fff`,stroke:`#ccc`,fillOpacity:1,strokeWidth:1}),V5(H5,`renderDot`,function(e,t){return g.isValidElement(e)?g.cloneElement(e,t):(0,X0.default)(e)?e(t):g.createElement(z8,L5({},t,{cx:t.cx,cy:t.cy,className:`recharts-reference-dot-dot`}))});function U5(){return U5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},U5.apply(this,arguments)}function W5(e){"@babel/helpers - typeof";return W5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W5(e)}function _qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vqt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_qt(Object(n),!0).forEach(function(t){q5(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_qt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yqt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function bqt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Dqt(r.key),r)}}function xqt(e,t,n){return t&&bqt(e.prototype,t),n&&bqt(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Sqt(e,t,n){return t=G5(t),Cqt(e,Tqt()?Reflect.construct(t,n||[],G5(e).constructor):t.apply(e,n))}function Cqt(e,t){if(t&&(W5(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return wqt(e)}function wqt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Tqt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Tqt=function(){return!!e})()}function G5(e){return G5=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G5(e)}function Eqt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&K5(e,t)}function K5(e,t){return K5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K5(e,t)}function q5(e,t,n){return t=Dqt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dqt(e){var t=Oqt(e,`string`);return W5(t)==`symbol`?t:t+``}function Oqt(e,t){if(W5(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W5(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var kqt=function(e,t,n,r,i){var a=i.x1,o=i.x2,s=i.y1,c=i.y2,l=i.xAxis,u=i.yAxis;if(!l||!u)return null;var d=A5({x:l.scale,y:u.scale}),f={x:e?d.x.apply(a,{position:`start`}):d.x.rangeMin,y:n?d.y.apply(s,{position:`start`}):d.y.rangeMin},p={x:t?d.x.apply(o,{position:`end`}):d.x.rangeMax,y:r?d.y.apply(c,{position:`end`}):d.y.rangeMax};return E5(i,`discard`)&&(!d.isInRange(f)||!d.isInRange(p))?null:gKt(f,p)},J5=function(e){function t(){return yqt(this,t),Sqt(this,t,arguments)}return Eqt(t,e),xqt(t,[{key:`render`,value:function(){var e=this.props,n=e.x1,r=e.x2,i=e.y1,a=e.y2,o=e.className,s=e.alwaysShow,c=e.clipPathId;c2(s===void 0,`The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.`);var l=R0(n),u=R0(r),d=R0(i),f=R0(a),p=this.props.shape;if(!l&&!u&&!d&&!f&&!p)return null;var m=kqt(l,u,d,f,this.props);if(!m&&!p)return null;var h=E5(this.props,`hidden`)?`url(#${c})`:void 0;return g.createElement(s2,{className:Hp(`recharts-reference-area`,o)},t.renderRect(p,vqt(vqt({clipPath:h},n2(this.props,!0)),m)),W6.renderCallByParent(this.props,m))}}])}(g.Component);q5(J5,`displayName`,`ReferenceArea`),q5(J5,`defaultProps`,{isFront:!1,ifOverflow:`discard`,xAxisId:0,yAxisId:0,r:10,fill:`#ccc`,fillOpacity:.5,stroke:`none`,strokeWidth:1}),q5(J5,`renderRect`,function(e,t){return g.isValidElement(e)?g.cloneElement(e,t):(0,X0.default)(e)?e(t):g.createElement(P8,U5({},t,{className:`recharts-reference-area-rect`}))});function Aqt(e){return Pqt(e)||Nqt(e)||Mqt(e)||jqt()}function jqt(){throw TypeError(`Invalid attempt to spread non-iterable instance.
1649
1649
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mqt(e,t){if(e){if(typeof e==`string`)return Y5(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y5(e,t)}}function Nqt(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Pqt(e){if(Array.isArray(e))return Y5(e)}function Y5(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var X5=function(e,t,n,r,i){var a=e2(e,I5),o=e2(e,H5),s=[].concat(Aqt(a),Aqt(o)),c=e2(e,J5),l=`${r}Id`,u=r[0],d=t;if(s.length&&(d=s.reduce(function(e,t){if(t.props[l]===n&&E5(t.props,`extendDomain`)&&L0(t.props[u])){var r=t.props[u];return[Math.min(e[0],r),Math.max(e[1],r)]}return e},d)),c.length){var f=`${u}1`,p=`${u}2`;d=c.reduce(function(e,t){if(t.props[l]===n&&E5(t.props,`extendDomain`)&&L0(t.props[f])&&L0(t.props[p])){var r=t.props[f],i=t.props[p];return[Math.min(e[0],r,i),Math.max(e[1],r,i)]}return e},d)}return i&&i.length&&(d=i.reduce(function(e,t){return L0(t)?[Math.min(e[0],t),Math.max(e[1],t)]:e},d)),d},Z5=new(e(i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))())).default,Q5=`recharts.syncMouseEvents`;function $5(e){"@babel/helpers - typeof";return $5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$5(e)}function Fqt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Iqt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Rqt(r.key),r)}}function Lqt(e,t,n){return t&&Iqt(e.prototype,t),n&&Iqt(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function e7(e,t,n){return t=Rqt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rqt(e){var t=zqt(e,`string`);return $5(t)==`symbol`?t:t+``}function zqt(e,t){if($5(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if($5(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Bqt=function(){function e(){Fqt(this,e),e7(this,`activeIndex`,0),e7(this,`coordinateList`,[]),e7(this,`layout`,`horizontal`)}return Lqt(e,[{key:`setDetails`,value:function(e){var t=e.coordinateList,n=t===void 0?null:t,r=e.container,i=r===void 0?null:r,a=e.layout,o=a===void 0?null:a,s=e.offset,c=s===void 0?null:s,l=e.mouseHandlerCallback,u=l===void 0?null:l;this.coordinateList=n??this.coordinateList??[],this.container=i??this.container,this.layout=o??this.layout,this.offset=c??this.offset,this.mouseHandlerCallback=u??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:`focus`,value:function(){this.spoofMouse()}},{key:`keyboardEvent`,value:function(e){if(this.coordinateList.length!==0)switch(e.key){case`ArrowRight`:if(this.layout!==`horizontal`)return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break;case`ArrowLeft`:if(this.layout!==`horizontal`)return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break;default:break}}},{key:`setIndex`,value:function(e){this.activeIndex=e}},{key:`spoofMouse`,value:function(){if(this.layout===`horizontal`&&this.coordinateList.length!==0){var e=this.container.getBoundingClientRect(),t=e.x,n=e.y,r=e.height,i=this.coordinateList[this.activeIndex].coordinate,a=window?.scrollX||0,o=window?.scrollY||0,s=t+i+a,c=n+this.offset.top+r/2+o;this.mouseHandlerCallback({pageX:s,pageY:c})}}}])}();function Vqt(e,t,n){if(n===`number`&&t===!0&&Array.isArray(e)){var r=e?.[0],i=e?.[1];if(r&&i&&L0(r)&&L0(i))return!0}return!1}function Hqt(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function Uqt(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[z6(t,n,r,i),z6(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Wqt(e,t,n){var r,i,a,o;if(e===`horizontal`)r=t.x,a=r,i=n.top,o=n.top+n.height;else if(e===`vertical`)i=t.y,o=i,r=n.left,a=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e===`centric`){var s=t.cx,c=t.cy,l=t.innerRadius,u=t.outerRadius,d=t.angle,f=z6(s,c,l,d),p=z6(s,c,u,d);r=f.x,i=f.y,a=p.x,o=p.y}else return Uqt(t);return[{x:r,y:i},{x:a,y:o}]}function t7(e){"@babel/helpers - typeof";return t7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t7(e)}function Gqt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Gqt(Object(n),!0).forEach(function(t){Kqt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gqt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kqt(e,t,n){return t=qqt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qqt(e){var t=Jqt(e,`string`);return t7(t)==`symbol`?t:t+``}function Jqt(e,t){if(t7(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(t7(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Yqt(e){var t=e.element,n=e.tooltipEventType,r=e.isActive,i=e.activeCoordinate,a=e.activePayload,o=e.offset,s=e.activeTooltipIndex,c=e.tooltipAxisBandSize,l=e.layout,u=e.chartName,d=t.props.cursor??t.type.defaultProps?.cursor;if(!t||!d||!r||!i||u!==`ScatterChart`&&n!==`axis`)return null;var f,p=r8;if(u===`ScatterChart`)f=i,p=rWt;else if(u===`BarChart`)f=Hqt(l,i,o,c),p=P8;else if(l===`radial`){var m=Uqt(i),h=m.cx,_=m.cy,v=m.radius;f={cx:h,cy:_,startAngle:m.startAngle,endAngle:m.endAngle,innerRadius:v,outerRadius:v},p=lVt}else f={points:Wqt(l,i,o)},p=r8;var y=n7(n7(n7(n7({stroke:`#ccc`,pointerEvents:`none`},o),f),n2(d,!1)),{},{payload:a,payloadIndex:s,className:Hp(`recharts-tooltip-cursor`,d.className)});return(0,g.isValidElement)(d)?(0,g.cloneElement)(d,y):(0,g.createElement)(p,y)}var Xqt=e(aPt()),Zqt=[`item`],Qqt=[`children`,`className`,`width`,`height`,`style`,`compact`,`title`,`desc`];function r7(e){"@babel/helpers - typeof";return r7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r7(e)}function i7(){return i7=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i7.apply(this,arguments)}function $qt(e,t){return nJt(e)||tJt(e,t)||mJt(e,t)||eJt()}function eJt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1650
1650
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tJt(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function nJt(e){if(Array.isArray(e))return e}function rJt(e,t){if(e==null)return{};var n=iJt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function iJt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function aJt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function oJt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,vJt(r.key),r)}}function sJt(e,t,n){return t&&oJt(e.prototype,t),n&&oJt(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function cJt(e,t,n){return t=a7(t),lJt(e,dJt()?Reflect.construct(t,n||[],a7(e).constructor):t.apply(e,n))}function lJt(e,t){if(t&&(r7(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return uJt(e)}function uJt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function dJt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dJt=function(){return!!e})()}function a7(e){return a7=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a7(e)}function fJt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&o7(e,t)}function o7(e,t){return o7=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o7(e,t)}function s7(e){return gJt(e)||hJt(e)||mJt(e)||pJt()}function pJt(){throw TypeError(`Invalid attempt to spread non-iterable instance.
1651
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mJt(e,t){if(e){if(typeof e==`string`)return c7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c7(e,t)}}function hJt(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function gJt(e){if(Array.isArray(e))return c7(e)}function c7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _Jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_Jt(Object(n),!0).forEach(function(t){l7(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_Jt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l7(e,t,n){return t=vJt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vJt(e){var t=yJt(e,`string`);return r7(t)==`symbol`?t:t+``}function yJt(e,t){if(r7(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(r7(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var bJt={xAxis:[`bottom`,`top`],yAxis:[`left`,`right`]},xJt={width:`100%`,height:`100%`},SJt={x:0,y:0};function u7(e){return e}var CJt=function(e,t){return t===`horizontal`?e.x:t===`vertical`?e.y:t===`centric`?e.angle:e.radius},wJt=function(e,t,n,r){var i=t.find(function(e){return e&&e.index===n});if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.y};if(e===`vertical`)return{x:r.x,y:i.coordinate};if(e===`centric`){var a=i.coordinate,o=r.radius;return Q(Q(Q({},r),z6(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return Q(Q(Q({},r),z6(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return SJt},d7=function(e,t){var n=t.graphicalItems,r=t.dataStartIndex,i=t.dataEndIndex,a=(n??[]).reduce(function(e,t){var n=t.props.data;return n&&n.length?[].concat(s7(e),s7(n)):e},[]);return a.length>0?a:e&&e.length&&L0(r)&&L0(i)?e.slice(r,i+1):[]};function TJt(e){return e===`number`?[0,`auto`]:void 0}var f7=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=d7(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?H0(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(s7(i),[Xzt(s,l)]):i},[])},EJt=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=CJt(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=Ozt(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:f7(e,t,l,u),activeCoordinate:wJt(n,o,l,i)}}return null},DJt=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=Izt(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=d7(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;Vqt(p.domain,g,m)&&(w=P6(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=k6(S,h,`category`)));var D=TJt(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=k6(S,h,m),m===`category`&&f){var k=ckt(w);_&&k?(T=w,w=(0,v5.default)(0,C)):_||(w=Yzt(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(s7(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,Y0.default)(e)}):Yzt(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,Y0.default)(t)?e:[].concat(s7(e),[t])},[]);else if(m===`number`){var A=Pzt(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=k6(S,h,`category`))}else w=f?(0,v5.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:Kzt(o[x].stackGroups,s,c):Fzt(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=X5(u,w,x,i,y),O&&(w=P6(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return Q(Q({},t),{},l7({},x,Q(Q({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},OJt=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=d7(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=Izt(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:Q(Q({},t.type.defaultProps),t.props))[a],g=TJt(`number`);if(!e[h]){m++;var _;return p?_=(0,v5.default)(0,f):o&&o[h]&&o[h].hasStack?(_=Kzt(o[h].stackGroups,s,c),_=X5(u,_,h,i)):(_=P6(g,Fzt(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=X5(u,_,h,i)),Q(Q({},e),{},l7({},h,Q(Q({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,P0.default)(bJt,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},kJt=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=e2(l,i),f={};return d&&d.length?f=DJt(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=OJt(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},AJt=function(e){var t=V0(e),n=j6(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,c4.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:F6(t,n)}},jJt=function(e){var t=e.children,n=e.defaultShowTooltip,r=t2(t,T5),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},MJt=function(e){return!e||!e.length?!1:e.some(function(e){var t=Z0(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},NJt=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},PJt=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=t2(u,T5),p=t2(u,a4),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},l7({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=Q(Q({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},l7({},r,(0,P0.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||T5.defaultProps.height),p&&t&&(h=jzt(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return Q(Q({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},FJt=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},IJt=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=NJt(u),h=m.numericAxisName,g=m.cateAxisName,_=MJt(n),v=[];return n.forEach(function(n,m){var y=d7(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&p6(!1);var a=r[i];return Q(Q({},e),{},l7(l7({},n.axisType,a),`${n.axisType}Ticks`,j6(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&Wzt(n,r[C].stackGroups),k=Z0(n.type).indexOf(`Bar`)>=0,A=F6(E,D),j=[],M=_&&kzt({barSize:l,stackGroups:r,totalSize:FJt(T,g)});if(k){var N=(0,Y0.default)(S)?p:S,P=F6(E,D,!0)??N??0;j=Azt({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return Q(Q({},e),{},{position:Q(Q({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:Q(Q({},F(Q(Q({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},l7(l7(l7({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:kkt(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!Skt({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=NJt(f),_=g.numericAxisName,v=g.cateAxisName,y=e2(u,n),b=Hzt(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return Q(Q({},e),{},l7({},n,kJt(i,Q(Q({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=PJt(Q(Q({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=AJt(C);return Q(Q({formattedGraphicalItems:d(i,Q(Q({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return aJt(this,n),r=cJt(this,n,[e]),l7(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),l7(r,`accessibilityManager`,new Bqt),l7(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState(Q({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},Q(Q({},r.state),{},{legendBBox:e}))))}}),l7(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),l7(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return Q({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),l7(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,X0.default)(i)&&i(n,e)}}),l7(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?Q(Q({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,X0.default)(i)&&i(n,e)}),l7(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),l7(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),l7(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),l7(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,X0.default)(n)&&n(t,e)}),l7(r,`handleOuterEvent`,function(e){var t=Okt(e),n=(0,P0.default)(r.props,`${t}`);t&&(0,X0.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),l7(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,X0.default)(i)&&i(n,e)}}),l7(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),l7(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),l7(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),l7(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&Z5.emit(Q5,r.props.syncId,e,r.eventEmitterSymbol)}),l7(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState(Q({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h<m.length;h++)if(m[h].value===e.activeLabel){u=h;break}}var g=Q(Q({},p),{},{x:p.left,y:p.top}),_=Math.min(c,g.x+g.width),v=Math.min(l,g.y+g.height),y=m[u]&&m[u].value,b=f7(r.state,r.props.data,u),x=m[u]?{x:n===`horizontal`?m[u].coordinate:_,y:n===`horizontal`?v:m[u].coordinate}:SJt;r.setState(Q(Q({},e),{},{activeLabel:y,activeCoordinate:x,activePayload:b,activeTooltipIndex:u}))}else r.setState(e)}),l7(r,`renderCursor`,function(e){var n=r.state,i=n.isTooltipActive,a=n.activeCoordinate,o=n.activePayload,s=n.offset,c=n.activeTooltipIndex,l=n.tooltipAxisBandSize,u=r.getTooltipEventType(),d=e.props.active??i,f=r.props.layout,p=e.key||`_recharts-cursor`;return g.createElement(Yqt,{key:p,activeCoordinate:a,activePayload:o,activeTooltipIndex:c,chartName:t,element:e,isActive:d,layout:f,offset:s,tooltipAxisBandSize:l,tooltipEventType:u})}),l7(r,`renderPolarAxis`,function(e,t,n){var i=(0,P0.default)(e,`type.axisType`),a=(0,P0.default)(r.state,`${i}Map`),o=e.type.defaultProps,s=o===void 0?e.props:Q(Q({},o),e.props),c=a&&a[s[`${i}Id`]];return(0,g.cloneElement)(e,Q(Q({},c),{},{className:Hp(i,c.className),key:e.key||`${t}-${n}`,ticks:j6(c,!0)}))}),l7(r,`renderPolarGrid`,function(e){var t=e.props,n=t.radialLines,i=t.polarAngles,a=t.polarRadius,o=r.state,s=o.radiusAxisMap,c=o.angleAxisMap,l=V0(s),u=V0(c),d=u.cx,f=u.cy,p=u.innerRadius,m=u.outerRadius;return(0,g.cloneElement)(e,{polarAngles:Array.isArray(i)?i:j6(u,!0).map(function(e){return e.coordinate}),polarRadius:Array.isArray(a)?a:j6(l,!0).map(function(e){return e.coordinate}),cx:d,cy:f,innerRadius:p,outerRadius:m,key:e.key||`polar-grid`,radialLines:n})}),l7(r,`renderLegend`,function(){var e=r.state.formattedGraphicalItems,t=r.props,n=t.children,i=t.width,a=t.height,o=r.props.margin||{},s=vzt({children:n,formattedGraphicalItems:e,legendWidth:i-(o.left||0)-(o.right||0),legendContent:c});if(!s)return null;var l=s.item;return(0,g.cloneElement)(l,Q(Q({},rJt(s,Zqt)),{},{chartWidth:i,chartHeight:a,margin:o,onBBoxUpdate:r.handleLegendBBoxUpdate}))}),l7(r,`renderTooltip`,function(){var e=r.props,t=e.children,n=e.accessibilityLayer,i=t2(t,w4);if(!i)return null;var a=r.state,o=a.isTooltipActive,s=a.activeCoordinate,c=a.activePayload,l=a.activeLabel,u=a.offset,d=i.props.active??o;return(0,g.cloneElement)(i,{viewBox:Q(Q({},u),{},{x:u.left,y:u.top}),active:d,label:l,payload:d?c:[],coordinate:s,accessibilityLayer:n})}),l7(r,`renderBrush`,function(e){var t=r.props,n=t.margin,i=t.data,a=r.state,o=a.offset,s=a.dataStartIndex,c=a.dataEndIndex,l=a.updateId;return(0,g.cloneElement)(e,{key:e.key||`_recharts-brush`,onChange:N6(r.handleBrushChange,e.props.onChange),data:i,x:L0(e.props.x)?e.props.x:o.left,y:L0(e.props.y)?e.props.y:o.top+o.height+o.brushBottom-(n.bottom||0),width:L0(e.props.width)?e.props.width:o.width,startIndex:s,endIndex:c,updateId:`brush-${l}`})}),l7(r,`renderReferenceElement`,function(e,t,n){if(!e)return null;var i=r.clipPathId,a=r.state,o=a.xAxisMap,s=a.yAxisMap,c=a.offset,l=e.type.defaultProps||{},u=e.props,d=u.xAxisId,f=d===void 0?l.xAxisId:d,p=u.yAxisId,m=p===void 0?l.yAxisId:p;return(0,g.cloneElement)(e,{key:e.key||`${t}-${n}`,xAxis:o[f],yAxis:s[m],viewBox:{x:c.left,y:c.top,width:c.width,height:c.height},clipPathId:i})}),l7(r,`renderActivePoints`,function(e){var t=e.item,r=e.activePoint,i=e.basePoint,a=e.childIndex,o=e.isRange,s=[],c=t.props.key,l=t.item.type.defaultProps===void 0?t.item.props:Q(Q({},t.item.type.defaultProps),t.item.props),u=l.activeDot,d=l.dataKey,f=Q(Q({index:a,dataKey:d,cx:r.x,cy:r.y,r:4,fill:A6(t.item),strokeWidth:2,stroke:`#fff`,payload:r.payload,value:r.value},n2(u,!1)),q0(u));return s.push(n.renderActiveDot(u,f,`${c}-activePoint-${a}`)),i?s.push(n.renderActiveDot(u,Q(Q({},f),{},{cx:i.x,cy:i.y}),`${c}-basePoint-${a}`)):o&&s.push(null),s}),l7(r,`renderGraphicChild`,function(e,t,n){var i=r.filterFormatItem(e,t,n);if(!i)return null;var a=r.getTooltipEventType(),o=r.state,s=o.isTooltipActive,c=o.tooltipAxis,l=o.activeTooltipIndex,u=o.activeLabel,d=r.props.children,f=t2(d,w4),p=i.props,m=p.points,h=p.isRange,_=p.baseLine,v=i.item.type.defaultProps===void 0?i.item.props:Q(Q({},i.item.type.defaultProps),i.item.props),y=v.activeDot,b=v.hide,x=v.activeBar,S=v.activeShape,C=!!(!b&&s&&f&&(y||x||S)),w={};a!==`axis`&&f&&f.props.trigger===`click`?w={onClick:N6(r.handleItemMouseEnter,e.props.onClick)}:a!==`axis`&&(w={onMouseLeave:N6(r.handleItemMouseLeave,e.props.onMouseLeave),onMouseEnter:N6(r.handleItemMouseEnter,e.props.onMouseEnter)});var T=(0,g.cloneElement)(e,Q(Q({},i.props),w));function E(e){return typeof c.dataKey==`function`?c.dataKey(e.payload):null}if(C)if(l>=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=H0(m,k,u),O=h&&_&&H0(_,k,u)}else D=m?.[l],O=h&&_&&_[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,g.cloneElement)(e,Q(Q(Q({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,Y0.default)(D))return[T].concat(s7(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,g.cloneElement)(N,Q(Q(Q({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),l7(r,`renderCustomized`,function(e,t,n){return(0,g.cloneElement)(e,Q(Q({key:`recharts-customized-${n}`},r.props),r.state))}),l7(r,`renderMap`,{CartesianGrid:{handler:u7,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:u7},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:u7},YAxis:{handler:u7},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??z0(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,Xqt.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return fJt(n,e),sJt(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=t2(t,w4);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=f7(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=Q(Q({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){r2([t2(e.children,w4)],[t2(this.props.children,w4)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=t2(this.props.children,w4);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=gPt(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=EJt(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=V0(c).scale,p=V0(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return Q(Q({},i),{},{xValue:m,yValue:h},d)}return d?Q(Q({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=V0(c);return mBt({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=t2(e,w4),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),Q(Q({},q0(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){Z5.on(Q5,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){Z5.removeListener(Q5,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i<a;i++){var o=r[i];if(o.item===e||o.props.key===e.key||t===Z0(o.item.type)&&n===o.childIndex)return o}return null}},{key:`renderClipPath`,value:function(){var e=this.clipPathId,t=this.state.offset,n=t.left,r=t.top,i=t.height,a=t.width;return g.createElement(`defs`,null,g.createElement(`clipPath`,{id:e},g.createElement(`rect`,{x:n,y:r,height:i,width:a})))}},{key:`getXScales`,value:function(){var e=this.state.xAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=$qt(t,2),r=n[0],i=n[1];return Q(Q({},e),{},l7({},r,i.scale))},{}):null}},{key:`getYScales`,value:function(){var e=this.state.yAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=$qt(t,2),r=n[0],i=n[1];return Q(Q({},e),{},l7({},r,i.scale))},{}):null}},{key:`getXScaleByAxisId`,value:function(e){var t;return(t=this.state.xAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getYScaleByAxisId`,value:function(e){var t;return(t=this.state.yAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getItemByXY`,value:function(e){var t=this.state,n=t.formattedGraphicalItems,r=t.activeItem;if(n&&n.length)for(var i=0,a=n.length;i<a;i++){var o=n[i],s=o.props,c=o.item,l=c.type.defaultProps===void 0?c.props:Q(Q({},c.type.defaultProps),c.props),u=Z0(c.type);if(u===`Bar`){var d=(s.data||[]).find(function(t){return PUt(e,t)});if(d)return{graphicalItem:o,payload:d}}else if(u===`RadialBar`){var f=(s.data||[]).find(function(t){return mBt(e,t)});if(f)return{graphicalItem:o,payload:f}}else if(o5(o,r)||s5(o,r)||c5(o,r)){var p=yGt({graphicalItem:o,activeTooltipItem:r,itemData:l.data}),m=l.activeIndex===void 0?p:l.activeIndex;return{graphicalItem:Q(Q({},o),{},{childIndex:m}),payload:c5(o,r)?l.data[p]:o.props.data[p]}}}return null}},{key:`render`,value:function(){var e=this;if(!Skt(this))return null;var t=this.props,n=t.children,r=t.className,i=t.width,a=t.height,o=t.style,s=t.compact,c=t.title,l=t.desc,u=n2(rJt(t,Qqt),!1);if(s)return g.createElement(jKt,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},g.createElement(a2,i7({},u,{width:i,height:a,title:c,desc:l}),this.renderClipPath(),Dkt(n,this.renderMap)));this.props.accessibilityLayer&&(u.tabIndex=this.props.tabIndex??0,u.role=this.props.role??`application`,u.onKeyDown=function(t){e.accessibilityManager.keyboardEvent(t)},u.onFocus=function(){e.accessibilityManager.focus()});var d=this.parseEventsOfWrapper();return g.createElement(jKt,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},g.createElement(`div`,i7({className:Hp(`recharts-wrapper`,r),style:Q({position:`relative`,cursor:`default`,width:i,height:a},o)},d,{ref:function(t){e.container=t}}),g.createElement(a2,i7({},u,{width:i,height:a,title:c,desc:l,style:xJt}),this.renderClipPath(),Dkt(n,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(g.Component);l7(p,`displayName`,t),l7(p,`defaultProps`,Q({layout:`horizontal`,stackOffset:`none`,barCategoryGap:`10%`,barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:`index`},u)),l7(p,`getDerivedStateFromProps`,function(e,t){var n=e.dataKey,r=e.data,i=e.children,a=e.width,o=e.height,s=e.layout,c=e.stackOffset,l=e.margin,u=t.dataStartIndex,d=t.dataEndIndex;if(t.updateId===void 0){var p=jJt(e);return Q(Q(Q({},p),{},{updateId:0},f(Q(Q({props:e},p),{},{updateId:0}),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(n!==t.prevDataKey||r!==t.prevData||a!==t.prevWidth||o!==t.prevHeight||s!==t.prevLayout||c!==t.prevStackOffset||!U0(l,t.prevMargin)){var m=jJt(e),h={chartX:t.chartX,chartY:t.chartY,isTooltipActive:t.isTooltipActive},g=Q(Q({},EJt(t,r,s)),{},{updateId:t.updateId+1}),_=Q(Q(Q({},m),h),g);return Q(Q(Q({},_),f(Q({props:e},_),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(!r2(i,t.prevChildren)){var v=t2(i,T5),y=v?v.props?.startIndex??u:u,b=v?v.props?.endIndex??d:d,x=y!==u||b!==d,S=!(0,Y0.default)(r)&&!x?t.updateId:t.updateId+1;return Q(Q({updateId:S},f(Q(Q({props:e},t),{},{updateId:S,dataStartIndex:y,dataEndIndex:b}),t)),{},{prevChildren:i,dataStartIndex:y,dataEndIndex:b})}return null}),l7(p,`renderActiveDot`,function(e,t,n){var r=(0,g.isValidElement)(e)?(0,g.cloneElement)(e,t):(0,X0.default)(e)?e(t):g.createElement(z8,t);return g.createElement(s2,{className:`recharts-active-dot`,key:n},r)});var m=(0,g.forwardRef)(function(e,t){return g.createElement(p,i7({},e,{ref:t}))});return m.displayName=p.displayName,m}({chartName:`PieChart`,GraphicalChild:g5,validateTooltipEventTypes:[`item`],defaultTooltipEventType:`item`,legendContent:`children`,axisComponents:[{axisType:`angleAxis`,AxisComp:t5},{axisType:`radiusAxis`,AxisComp:J8}],formatAxisMap:lBt,defaultProps:{layout:`centric`,startAngle:0,endAngle:360,cx:`50%`,cy:`50%`,innerRadius:0,outerRadius:`80%`}}),LJt={success:`fill-green-500`,failed:`fill-red-600`,skipped:`fill-neutral-500`,"in-progress":`fill-blue-500`},RJt=({deployment:e,className:t,size:n=20,innerRadius:r=45})=>(0,W.jsx)(IJt,{width:n,height:n,margin:{top:0,left:0,right:0,bottom:0},className:G(`relative`,t),children:(0,W.jsx)(g5,{className:G(`stroke-white dark:stroke-gray-950 [&_.recharts-pie-sector]:outline-hidden`),data:e.stages.map(e=>({name:e.stage,status:e.status,value:1,className:LJt[e.status]})),cx:`50%`,cy:`50%`,startAngle:90,endAngle:-270,innerRadius:`${r}%`,outerRadius:`100%`,stroke:``,strokeLinejoin:`round`,dataKey:`value`,nameKey:`name`,isAnimationActive:!1,style:{outline:`none`}})}),zJt=({item:e,isSelected:t,onSelect:n})=>{let r=new Date(e.createdOn),i=xOt(r)?`${d0(r,`H:mm:ss`)} Today`:bOt(r)?`${d0(r,`H:mm:ss ccc d, MMM`)}`:`${d0(r,`H:mm:ss ccc d`)} ${d0(r,`MMM yyy`)}`;return(0,W.jsxs)(`div`,{className:(0,_P.default)(`flex items-center gap-2 px-3 cursor-pointer h-10 border-border border-b`,{"bg-gray-100":t,"hover:bg-gray-50 hover:text-gray-900":!t}),onClick:()=>n(),children:[(0,W.jsx)(`div`,{className:`flex justify-center items-center w-5 shrink-0`,children:(0,W.jsx)(RJt,{deployment:e})}),(0,W.jsx)(`span`,{className:`w-full text-sm truncate`,children:i})]})},BJt=()=>XR(`auto-open-feedback`,void 0),VJt=()=>{let[,e]=FA(`build`);return{openBuildFeedback:t=>e(t)}},HJt=()=>{let[e]=BJt(),{environment:t}=oh([`account`,`project`,`environment`]),{data:n}=Gj(t.name),r=n?.data?.at(0),{openBuildFeedback:i}=VJt(),a=(0,g.useRef)(e),o=(0,g.useRef)(i);(0,g.useEffect)(()=>{o.current=i},[i]),(0,g.useEffect)(()=>{a.current=e},[e]),(0,g.useEffect)(()=>{a.current===!0&&r?.id&&r.stages.some(({status:e})=>e===`failed`)&&o.current(r.id)},[r?.id,r?.stages])},UJt=()=>{let[e,t]=BJt();return(0,W.jsxs)(yk,{open:e===void 0,children:[(0,W.jsx)(bk,{asChild:!0,children:(0,W.jsxs)(`label`,{className:`flex gap-2 items-center text-xs font-medium cursor-pointer`,children:[(0,W.jsx)(uV,{checked:e,onCheckedChange:()=>t(e=>!e)}),`Auto-open feedback`]})}),(0,W.jsxs)(xk,{className:`mr-2`,children:[`Try automatically open build feedback next time`,(0,W.jsx)(Sk,{})]})]})},WJt={"in-progress":`Building`,success:`Finished`,failed:`Failed`,skipped:`Skipped`},GJt=({status:e})=>WJt[e],KJt={lint:`Lint`,build:`Build`,deploy:`Deploy`},qJt=({step:e})=>KJt[e]??e,JJt={"dev-portal":`devPortal`,api:`api`},YJt=e=>e.map(([e,t,n])=>({timestamp:e,severity:t,message:n})).sort((e,t)=>e.timestamp.localeCompare(t.timestamp)),XJt=e=>e.filter(e=>e.severity===`warn`).length,ZJt=(e,t)=>{let n=e[JJt[t]];return n?YJt(Object.values(n).flat()):[]},QJt=(e,t,n)=>{let r=e[JJt[t]];if(!r)return[];let i=r[n];return i?YJt(i):[]},$Jt=({text:e})=>e.split(/(https?:\/\/\S+)/g).map((e,t)=>/^https?:\/\//.test(e)?(0,W.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:e},`${e}-${t}`):e),p7=e(i(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function eYt({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}var tYt=eYt();function nYt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(tYt,``)}var rYt=({logs:e,children:t,className:n})=>(0,W.jsx)(`div`,{className:G(`grid grid-cols-[auto_1fr] auto-rows-min gap-x-5 py-4 text-xs h-full overflow-auto`,`bg-neutral-950 font-mono text-white`,n),children:t||(e.length>0?e.map(({timestamp:e,severity:t,message:n},r)=>(0,W.jsxs)(`div`,{className:G(`grid grid-cols-subgrid col-span-full px-4 py-1 hover:bg-neutral-800 text-neutral-200`,{"text-red-400":t===`error`,"text-yellow-400":t===`warn`,"text-green-500":/^\x1b\[32m/.test(n)}),children:[(0,W.jsx)(`div`,{className:`select-none`,children:(0,p7.default)(e).format(`HH:mm:ss.SSS`)}),(0,W.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:(0,W.jsx)($Jt,{text:nYt(n).trim()})})]},`${e}-${r}`)):(0,W.jsx)(`div`,{className:`text-neutral-300 italic px-4`,children:`No logs available`}))}),iYt=({stage:e,buildLogs:t,isLoading:n})=>(0,W.jsx)(`div`,{className:`divide-y divide-neutral-800`,children:[...e.steps??[]].sort((e,t)=>e.ordinal-t.ordinal).map(r=>{let i=QJt(t,e.stage,r.step),a=XJt(i);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-xs font-medium bg-neutral-900 text-neutral-300`,children:[(0,W.jsx)(Dz,{status:r.status}),(0,W.jsx)(qJt,{step:r.step}),a>0&&(0,W.jsxs)(PS,{variant:`warn`,children:[a,` warning`,a>1?`s`:``]})]}),(0,W.jsx)(rYt,{logs:i,children:n&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,W.jsx)(oN,{className:`h-4 w-3/6 bg-white/20`}),(0,W.jsx)(oN,{className:`h-4 w-2/6 bg-white/20`})]})})]},r.id)})}),aYt=(e,t)=>e?t(e):void 0,oYt=({deployment:e,defaultOpen:t})=>{let{environment:n}=oh([`environment`]),r=Qxt(n.name,e.id,{});return r.isPending?(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(oN,{className:`h-10 w-full`}),(0,W.jsx)(oN,{className:`h-10 w-full`})]}):r.isError?(0,W.jsx)(jS,{variant:`warning`,children:(0,W.jsx)(NS,{className:`text-center`,children:(0,W.jsx)(`div`,{className:`text-neutral-600 text-lg`,children:r.error?r.error.status===401||r.error.status===403?`You don't have permission to view build logs for this deployment.`:r.error.status===404?`Deployment not found. The selected deployment may have been deleted or doesn't exist.`:r.error.status===500?`Server error occurred while loading build logs. Please try again or contact support if the problem persists.`:`Unable to load build logs. Please try again or contact support if the problem persists.`:`Could not load logs. Please try again or contact support if the problem persists.`})})}):(0,W.jsx)(UB,{className:`divide-y overflow-hidden`,children:e.stages.map((n,i)=>(0,W.jsx)(sYt,{stage:n,stageIndex:i,stageCount:e.stages.length,buildLogs:r.data,isLoading:r.isLoading,defaultOpen:t},n.id))})},sYt=({stage:e,stageIndex:t,stageCount:n,buildLogs:r,isLoading:i,defaultOpen:a})=>{let o=e.steps&&e.steps.length>0;return(0,W.jsxs)(Cz,{defaultOpen:a,children:[(0,W.jsx)(wz,{asChild:!0,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 p-2 w-full hover:bg-accent cursor-pointer group`,children:[(0,W.jsx)(Dz,{status:e.status}),(0,W.jsxs)(`div`,{className:`font-medium`,children:[(0,W.jsxs)(`span`,{className:`font-mono text-xs me-2`,children:[`(`,t+1,`/`,n,`)`]}),`Building `,(0,W.jsx)(Ez,{stage:e.stage})]}),(0,W.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,W.jsx)(GJt,{status:e.status})}),(0,W.jsx)(`div`,{className:`text-xs text-amber-400`,children:aYt(XJt(ZJt(r,e.stage)),e=>(0,W.jsxs)(PS,{variant:`warn`,children:[e,` warning`,e>1?`s`:``]}))}),(0,W.jsx)(`div`,{className:`ms-2 flex items-center justify-center`,children:(0,W.jsx)(hm,{className:`w-4 h-4 transition-transform group-data-[state=closed]:-rotate-90`})})]})}),(0,W.jsx)(Tz,{children:o?(0,W.jsx)(iYt,{stage:e,buildLogs:r,isLoading:i}):(0,W.jsx)(rYt,{logs:ZJt(r,e.stage),children:i&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,W.jsx)(oN,{className:`h-4 w-3/6 bg-white/20`}),(0,W.jsx)(oN,{className:`h-4 w-2/6 bg-white/20`})]})})})]})},cYt=({build:e})=>(0,W.jsx)(`div`,{className:`p-4 w-full`,children:(0,W.jsx)(oYt,{deployment:e,defaultOpen:!0})}),lYt=()=>{let[e,t]=FA(`build`);HJt();let{environment:n}=oh([`account`,`project`,`environment`]),{data:r}=Gj(n.name),i=r?.data?.find(t=>t.id===e);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(aN,{}),(0,W.jsxs)(iN,{className:`min-h-36 shadow-[rgb(215_215_215/15%)_0px_-4px_3px_0px] dark:shadow-[rgb(0_0_0/40%)_0px_-4px_3px_0px]`,defaultSize:30,children:[(0,W.jsxs)(`div`,{className:`flex gap-2 border-b h-8 items-center justify-between group bg-surface-muted px-3`,children:[(0,W.jsx)(`div`,{className:`divide-neutral-200`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 group rounded-none relative text-xs font-medium`,title:e,children:[(0,W.jsx)(Pre,{size:16}),e?`Build ${e.slice(0,8)}`:`Builds`]})}),(0,W.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[(0,W.jsx)(UJt,{}),(0,W.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(void 0),children:(0,W.jsx)($m,{size:18})})]})]}),(0,W.jsxs)(`div`,{className:`h-[calc(100%-2rem)]`,children:[r?.data?.length===0&&(0,W.jsx)(`div`,{className:`p-3 text-sm`,children:`Start changing your local copy to see build information.`}),(0,W.jsxs)(`div`,{className:`divide-x grid grid-cols-[min-content_1fr] w-full h-full`,children:[(0,W.jsx)(`div`,{className:`overflow-y-auto`,children:r?.data?.map(n=>(0,W.jsx)(zJt,{item:n,isSelected:n.id===e,onSelect:()=>t(n.id)},`${n.id}`))}),(0,W.jsx)(`div`,{className:`overflow-y-auto`,children:e&&i?(0,W.jsx)(cYt,{build:i}):(0,W.jsx)(`div`,{className:`p-3 text-sm`,children:`Select a build to view more information.`})})]})]})]})]})};function m7(e,t){return e.filter(e=>e.isActive?.(t)??!0)}function uYt(e,t){return e.findIndex(e=>e.id===t)}function dYt(e,t){return m7(e,t)[0]?.id??e[0]?.id??``}function fYt(e,t){let n=e.initialAnswers(t);return{answers:n,currentStepId:dYt(e.steps,n),history:[],tasks:{},status:`active`}}function pYt(e,t,n){let r=m7(e,t);if(r.some(e=>e.id===n))return n;let i=e.findIndex(e=>e.id===n),a=new Set(r.map(e=>e.id));for(let t=i;t>=0;t--)if(a.has(e[t].id))return e[t].id;return r[0]?.id??n}function mYt(e,t,n){switch(n.type){case`PATCH_ANSWERS`:{let r={...t.answers,...n.partial};return{...t,answers:r,currentStepId:pYt(e,r,t.currentStepId)}}case`NEXT`:{let n=m7(e,t.answers),r=n[uYt(n,t.currentStepId)+1];return r?{...t,currentStepId:r.id,history:[...t.history,t.currentStepId]}:t}case`BACK`:{let n=t.history[t.history.length-1];return n===void 0?t:{...t,currentStepId:pYt(e,t.answers,n),history:t.history.slice(0,-1)}}case`GOTO`:return!m7(e,t.answers).some(e=>e.id===n.stepId)||n.stepId===t.currentStepId?t:{...t,currentStepId:n.stepId,history:[...t.history,t.currentStepId]};case`SET_TASK`:return{...t,tasks:{...t.tasks,[n.stepId]:n.task}};case`COMPLETE`:return{...t,status:`completed`};case`RESET`:return{answers:n.answers,currentStepId:n.firstStepId,history:[],tasks:{},status:`active`};default:return t}}function hYt({selected:e,onClick:t,title:n,description:r,icon:i,indicator:a=`radio`,role:o,disabled:s,className:c}){return(0,W.jsxs)(`button`,{type:`button`,onClick:t,disabled:s,role:o,"aria-checked":o?e:void 0,"aria-pressed":o?void 0:e,className:G(`flex w-full flex-col items-start gap-1 rounded-md border bg-surface p-4 text-left transition-colors`,s?`cursor-not-allowed opacity-50`:`cursor-pointer hover:border-neutral-300 dark:hover:border-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-800`,e&&!s&&`border-zuplo-500 bg-zuplo-50/30 hover:bg-zuplo-50/30`,c),children:[(0,W.jsxs)(`div`,{className:`flex w-full items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i&&(0,W.jsx)(`div`,{className:G(`rounded-md border p-1.5`,e?`border-zuplo-500 text-zuplo-500`:`text-foreground`),children:i}),(0,W.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:n})]}),a!==`none`&&(0,W.jsx)(gYt,{kind:a,selected:e})]}),r&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})}function gYt({kind:e,selected:t}){return e===`checkbox`?(0,W.jsx)(`span`,{className:G(`flex size-4 shrink-0 items-center justify-center rounded border-2`,t?`border-zuplo-500 bg-zuplo-500 text-white`:`border-neutral-300 dark:border-neutral-600`),children:t&&(0,W.jsx)(mm,{size:12,strokeWidth:3})}):(0,W.jsx)(`span`,{className:G(`size-4 shrink-0 rounded-full border-2`,t?`border-zuplo-500 bg-zuplo-500 ring-2 ring-inset ring-white`:`border-neutral-300 dark:border-neutral-600`)})}var _Yt=e=>G(`grid gap-3`,e===1&&`grid-cols-1`,e===2&&`grid-cols-1 sm:grid-cols-2`,e===3&&`grid-cols-1 sm:grid-cols-3`);function vYt({value:e,onChange:t,options:n,columns:r=1}){return(0,W.jsx)(`div`,{className:_Yt(r),role:`radiogroup`,children:n.map(n=>(0,W.jsx)(hYt,{selected:e===n.value,onClick:()=>t(n.value),title:n.title,description:n.description,icon:n.icon,disabled:n.disabled,indicator:`radio`,role:`radio`},n.value))})}function yYt({values:e,onChange:t,options:n,columns:r=1}){let i=n=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n]);return(0,W.jsx)(`div`,{className:_Yt(r),children:n.map(t=>(0,W.jsx)(hYt,{selected:e.includes(t.value),onClick:()=>i(t.value),title:t.title,description:t.description,icon:t.icon,disabled:t.disabled,indicator:`checkbox`,role:`checkbox`},t.value))})}var bYt=`sm:max-w-2xl p-0 gap-0 flex max-h-[85vh] flex-col overflow-hidden`,xYt=`flex-1 min-h-0 overflow-y-auto px-6 py-5 flex flex-col gap-4`;function SYt({label:e,className:t}){return(0,W.jsxs)(`output`,{className:G(`flex items-center gap-3 rounded-md border bg-neutral-50 px-4 py-3 text-sm text-neutral-700`,t),children:[(0,W.jsx)(Hm,{className:`size-4 shrink-0 animate-spin text-zuplo-500`}),(0,W.jsx)(`span`,{children:e??`Working…`})]})}function CYt({message:e,onRetry:t,retryable:n=!0}){return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm`,role:`alert`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(Qm,{className:`mt-0.5 size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`font-medium`,children:e})]}),n&&(0,W.jsx)(`div`,{children:(0,W.jsx)(Y,{size:`sm`,variant:`outline`,onClick:t,children:`Try again`})})]})}function h7({children:e}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-emerald-700`,children:[(0,W.jsx)(Sm,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{children:e})]})}function wYt({steps:e,currentIndex:t}){return e.length<=1?null:(0,W.jsx)(`ol`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden`,children:e.map((n,r)=>{let i=r<t,a=r===t;return(0,W.jsxs)(`li`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:G(`flex size-5 shrink-0 items-center justify-center rounded-full border text-[11px] font-medium`,i&&`border-zuplo-500 bg-zuplo-500 text-white`,a&&`border-zuplo-500 text-zuplo-600`,!i&&!a&&`border-neutral-300 text-neutral-400`),children:i?(0,W.jsx)(mm,{size:12,strokeWidth:3}):r+1}),a&&(0,W.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-foreground`,children:n.title}),r<e.length-1&&(0,W.jsx)(`span`,{className:`h-px w-3 shrink-0 bg-border`,"aria-hidden":!0})]},n.id)})})}var g7={status:`pending`},TYt={status:`skipped`},EYt=e=>({status:`applied`,result:e}),DYt=1;function _7(e,t){return`zpl_wizard:${e}:${t.account}/${t.project}/${t.environment}`}function v7(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}function OYt(e,t,n){let r=v7();if(!r)return;let i=r.getItem(_7(e,t));if(i)try{let e=JSON.parse(i);if(e.v!==DYt)return;let t=m7(n,e.answers),r=t.some(t=>t.id===e.currentStepId)?e.currentStepId:t[0]?.id??e.currentStepId;return{answers:e.answers,currentStepId:r,history:e.history??[],tasks:e.tasks??{},status:e.status??`active`}}catch{return}}function kYt(e,t,n){let r=v7();if(!r)return;let i={v:DYt,answers:n.answers,currentStepId:n.currentStepId,history:n.history,tasks:Object.fromEntries(Object.entries(n.tasks).filter(([,e])=>e.state!==`running`)),status:n.status};try{r.setItem(_7(e,t),JSON.stringify(i))}catch{}}function AYt(e,t){v7()?.removeItem(_7(e,t))}function jYt(e){return e instanceof Error?e.message:typeof e==`string`?e:`Something went wrong`}function MYt(e,t,n){let{id:r,steps:i}=e,[a,o]=(0,g.useReducer)((0,g.useCallback)((e,t)=>mYt(i,e,t),[i]),void 0,()=>OYt(r,t,i)??fYt(e,t)),s=(0,g.useRef)(a);s.current=a;let c=(0,g.useRef)(n);c.current=n,(0,g.useEffect)(()=>{kYt(r,t,a)},[r,t,a]);let l=(0,g.useMemo)(()=>m7(i,a.answers),[i,a.answers]),u=uYt(l,a.currentStepId),d=l[u],f=(0,g.useCallback)(e=>{o({type:`PATCH_ANSWERS`,partial:e})},[]),p=(0,g.useRef)(null),m=(0,g.useRef)(null),h=(0,g.useRef)(new Set),_=(0,g.useCallback)(async(e,t,n)=>{m.current={stepId:e.id,kind:t},o({type:`SET_TASK`,stepId:e.id,task:{state:`running`}}),p.current?.abort();let r=new AbortController;p.current=r;try{return await n({answers:s.current.answers,patch:f,signal:r.signal,setProgress:t=>o({type:`SET_TASK`,stepId:e.id,task:{state:`running`,progress:t}}),services:c.current}),o({type:`SET_TASK`,stepId:e.id,task:{state:`idle`}}),!0}catch(t){return o({type:`SET_TASK`,stepId:e.id,task:{state:`error`,error:jYt(t),retryable:!0}}),!1}},[f]),v=(0,g.useCallback)(e=>i.find(t=>t.id===e),[i]),y=(0,g.useCallback)(()=>{let e=s.current;return m7(i,e.answers).find(t=>t.id===e.currentStepId)},[i]),b=(0,g.useCallback)(async()=>{let e=y();e&&(e.onExit&&!await _(e,`exit`,e.onExit)||o({type:`NEXT`}))},[y,_]),x=(0,g.useCallback)(()=>o({type:`BACK`}),[]),S=(0,g.useCallback)(()=>{let e=y();e?.onSkip&&o({type:`PATCH_ANSWERS`,partial:e.onSkip(s.current.answers)}),o({type:`NEXT`})},[y]),C=(0,g.useCallback)(e=>o({type:`GOTO`,stepId:e}),[]),w=(0,g.useCallback)(()=>{let e=m.current;if(!e)return;let t=v(e.stepId);t&&(e.kind===`exit`?b():t.onEnter&&_(t,`enter`,t.onEnter))},[b,_,v]),T=(0,g.useCallback)(()=>{AYt(r,t),h.current.clear();let n=fYt(e,t);o({type:`RESET`,answers:n.answers,firstStepId:n.currentStepId})},[e,r,t]),E=(0,g.useCallback)(()=>{AYt(r,t),o({type:`COMPLETE`})},[r,t]);(0,g.useEffect)(()=>{if(!d?.onEnter||h.current.has(d.id))return;let e=a.tasks[d.id];e?.state===`running`||e?.state===`error`||(h.current.add(d.id),_(d,`enter`,d.onEnter))},[d,_,a.tasks]);let D=d?.canAdvance?.(a.answers)??!0;return{answers:a.answers,patch:f,currentStep:d,activeSteps:l,index:u,isFirst:u<=0,isLast:u===l.length-1,progress:{current:u+1,total:l.length},canAdvance:D===!0,advanceBlockedReason:D===!0?void 0:D,task:d?a.tasks[d.id]:void 0,status:a.status,next:b,back:x,skip:S,goTo:C,retry:w,reset:T,complete:E}}var NYt=(0,g.createContext)(null),PYt=NYt.Provider;function y7(){let e=(0,g.useContext)(NYt);if(!e)throw Error(`useWizard must be used within a <WizardShell>`);return e}function FYt({showBack:e,isLast:t,canAdvance:n,blockedReason:r,skippable:i,busy:a,nextLabel:o,skipLabel:s,onBack:c,onSkip:l,onNext:u,onFinish:d}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-6 py-4`,children:[e&&(0,W.jsx)(Y,{variant:`outline`,onClick:c,disabled:a,children:`Back`}),(0,W.jsx)(`div`,{className:`flex-1`}),i&&(0,W.jsx)(Y,{variant:`ghost`,onClick:l,disabled:a,children:s??`Skip`}),(0,W.jsxs)(Y,{variant:`brand`,onClick:t?d:u,disabled:a||!n,title:n?void 0:r,children:[a&&(0,W.jsx)(Hm,{className:`size-4 animate-spin`}),o??(t?`Finish`:`Continue`)]})]})}function IYt({definition:e,launch:t,services:n,onClose:r,onComplete:i}){let a=MYt(e,t,n),{currentStep:o,activeSteps:s,index:c,isFirst:l,task:u,status:d,answers:f}=a,p=u?.state===`running`;if((0,g.useEffect)(()=>{d===`completed`&&i(f)},[d,f,i]),!o||d===`completed`)return null;let m=o.Component;return(0,W.jsx)(PYt,{value:a,children:(0,W.jsx)(bA,{open:!0,onOpenChange:e=>{!e&&!p&&r()},children:(0,W.jsxs)(CA,{className:bYt,showCloseButton:!p,onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,W.jsxs)(wA,{className:`shrink-0 gap-2 border-b px-6 py-4`,children:[(0,W.jsx)(EA,{children:e.title}),o.description&&(0,W.jsx)(DA,{children:o.description}),(0,W.jsx)(`div`,{className:`pt-1`,children:(0,W.jsx)(wYt,{steps:s,currentIndex:c})})]}),(0,W.jsxs)(`div`,{className:xYt,children:[(0,W.jsx)(m,{}),!o.ownsStatus&&u?.state===`running`&&(0,W.jsx)(SYt,{label:u.progress?.label}),!o.ownsStatus&&u?.state===`error`&&(0,W.jsx)(CYt,{message:u.error,retryable:u.retryable,onRetry:a.retry})]}),(0,W.jsx)(FYt,{showBack:!l&&!o.isFinal,isLast:a.isLast,canAdvance:a.canAdvance,blockedReason:a.advanceBlockedReason,skippable:o.skippable,busy:p,nextLabel:o.nextLabel,skipLabel:o.skipLabel,onBack:a.back,onSkip:a.skip,onNext:a.next,onFinish:a.complete})]})})})}var LYt=`api-key-inbound`,RYt=`rate-limit-inbound`,zYt={second:1/60,"10s":1/6,"30s":.5,minute:1},BYt={second:`second`,"10s":`10 seconds`,"30s":`30 seconds`,minute:`minute`};function VYt(){return{name:LYt,policyType:`api-key-inbound`,handler:{export:`ApiKeyInboundPolicy`,module:`$import(@zuplo/runtime)`,options:{allowUnauthenticatedRequests:!1,cacheTtlSeconds:60}}}}function HYt(e){return{name:RYt,policyType:`rate-limit-inbound`,handler:{export:`RateLimitInboundPolicy`,module:`$import(@zuplo/runtime)`,options:{rateLimitBy:e.rateLimitBy,requestsAllowed:e.requests,timeWindowMinutes:zYt[e.period]}}}}var UYt=async({answers:e,patch:t,services:n,setProgress:r})=>{if(e.apiKey.status===`applied`)return;let{keyName:i,managerEmail:a}=e.apiKeyDraft;r({label:`Creating your API key consumer…`});let{created:o}=await n.createConsumer({keyName:i,managerEmail:a});t({apiKey:EYt({keyName:i,managerEmail:a,consumerCreated:o,policyName:LYt})})};function WYt(e,t){if(t.selectedPolicies.includes(`api-key`)&&e.commitPolicyToAllRoutes(VYt()),t.selectedPolicies.includes(`rate-limit`)){let n=t.selectedPolicies.includes(`api-key`)?`user`:`ip`;e.commitPolicyToAllRoutes(HYt({requests:t.rateLimitDraft.requests,period:t.rateLimitDraft.period,rateLimitBy:n}))}}async function GYt(e,t=4){for(let n=1;n<=t;n++)try{return await e.save()}catch(e){if(n===t)throw e;await new Promise(e=>setTimeout(e,2**(n-1)*500))}return{}}var KYt=()=>{let e=oh(),t=tO(e.environment);return{deploymentDevPortalUrl:tO(e.environment,`dev-portal`),deploymentUrl:t?new URL(t).toString().replace(/\/$/,``):void 0}};function qYt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add gateway policies to your endpoints. There are many more you can add manually later.`}),(0,W.jsx)(yYt,{values:e.selectedPolicies,onChange:e=>t({selectedPolicies:e}),options:[{value:`api-key`,title:`API Key Authentication`,description:`Arguably the best authentication method for B2B APIs — used by the greats like Stripe, OpenAI, and more.`},{value:`rate-limit`,title:`Rate Limiting`,description:`Protect your API from accidental misuse — the most common, and unprotected, form of DoS you'll face.`}]})]})}function JYt(){let{answers:e,patch:t}=y7(),{keyName:n,managerEmail:r}=e.apiKeyDraft;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We'll create an API key in your development environment so you can test right away.`}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Key name`}),(0,W.jsx)(dV,{value:n,placeholder:`test-key`,onChange:n=>t({apiKeyDraft:{...e.apiKeyDraft,keyName:n.target.value}})})]}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Manager email`}),(0,W.jsx)(dV,{type:`email`,value:r,onChange:n=>t({apiKeyDraft:{...e.apiKeyDraft,managerEmail:n.target.value}})})]}),e.apiKey.status===`applied`&&(0,W.jsx)(h7,{children:e.apiKey.result.consumerCreated?`API key consumer created.`:`API key policy added — you can create a consumer later from Services.`})]})}var YYt=[`minute`,`30s`,`10s`,`second`];function XYt(){let{answers:e,patch:t}=y7(),{period:n,requests:r}=e.rateLimitDraft;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Period`}),(0,W.jsxs)(iW,{value:n,onValueChange:n=>t({rateLimitDraft:{...e.rateLimitDraft,period:n}}),children:[(0,W.jsx)(oW,{className:`w-48`,children:(0,W.jsx)(aW,{})}),(0,W.jsx)(sW,{children:YYt.map(e=>(0,W.jsx)(cW,{value:e,children:e===`minute`?`Minute`:e===`second`?`Second`:BYt[e]},e))})]})]}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Requests per `,BYt[n],` allowed`]}),(0,W.jsx)(dV,{type:`number`,min:1,hideNumberArrows:!0,className:`w-48`,value:Number.isFinite(r)?r:``,onChange:n=>t({rateLimitDraft:{...e.rateLimitDraft,requests:Number(n.target.value)}})})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It's more fun to test with a low count per minute — you can change this later. (For sub-minute periods we convert to a fractional window.)`})]})}var ZYt=[`api`,`dev-portal`];function QYt(){let e=oh([`environment`]),{answers:t,task:n,retry:r}=y7(),{deploymentDevPortalUrl:i}=KYt(),a=t.saved.status===`applied`,o=n?.state===`error`,s=b_(Wj(e.environment.name,{refetchInterval:4e3})).data?.data?.at(-1)?.stages??[],c=s.find(e=>e.stage===`dev-portal`),l=s.some(e=>e.status===`failed`),u=a&&!l&&c?.status===`success`,d=c?.url??i;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(h7,{children:`Your gateway is configured.`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border bg-neutral-50 px-4 py-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[o||l?(0,W.jsx)(Qm,{className:`size-4 shrink-0 text-destructive`}):u?(0,W.jsx)(Sm,{className:`size-4 shrink-0 text-emerald-600`}):(0,W.jsx)(Hm,{className:`size-4 shrink-0 animate-spin text-zuplo-500`}),o?`Couldn't save your changes`:a?l?`The deploy hit a problem`:u?`Your developer portal is ready`:`Building your developer portal…`:`Saving your changes…`]}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:ZYt.map(e=>(0,W.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,W.jsx)(Dz,{status:s.find(t=>t.stage===e)?.status??`in-progress`}),(0,W.jsx)(Ez,{stage:e})]},e))})]}),u&&d?(0,W.jsx)(Y,{asChild:!0,size:`lg`,variant:`outline`,className:`border-zuplo-500 bg-white font-bold text-blue-600 hover:bg-blue-50 hover:text-blue-700`,children:(0,W.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,children:[`Open developer portal`,(0,W.jsx)(Am,{size:16})]})}):o?(0,W.jsx)(Y,{variant:`outline`,size:`lg`,onClick:r,children:`Retry saving your changes`}):(0,W.jsxs)(Y,{variant:`outline`,size:`lg`,disabled:!0,children:[(0,W.jsx)(Hm,{className:`size-4 animate-spin`}),`Saving your changes…`]})]})}function $Yt(e){return{apiTypes:[],rest:g7,graphqlUrl:`https://api.rickandmorty.zuplo.io/v1/graphql`,graphql:g7,mcpUrl:`https://api.rickandmorty.zuplo.io/v1/mcp`,mcp:g7,selectedPolicies:[],apiKeyDraft:{keyName:`test-key`,managerEmail:e},rateLimitDraft:{period:`minute`,requests:1},apiKey:g7,rateLimit:g7,saved:g7,committed:!1}}var eXt=`/graphql`,tXt=`/mcp`;function b7(e){try{let t=new URL(e.trim());return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function x7(e,t,n){return e.openApiManager.operationArray?.some(e=>e.additionalOperationContext.path===t&&e.additionalOperationContext.method===n)??!1}async function nXt(e,t){let n=e.openApiManager;if(t.restMode===`import`&&t.restImport)n.updateOpenApiData(t.restImport.doc);else if(t.restMode===`todo-template`)for(let t of G5e())x7(e,t.path,t.method)||n.addOperation(t.path,t.method,t.operation,{avoidConflict:!0});t.apiTypes.includes(`GraphQL`)&&t.graphql.status!==`skipped`&&b7(t.graphqlUrl)&&!x7(e,`/graphql`,`post`)&&(yW(e.policyManager),n.addOperation(eXt,`post`,H5e(t.graphqlUrl.trim()),{avoidConflict:!0})),t.apiTypes.includes(`MCP`)&&t.mcp.status!==`skipped`&&b7(t.mcpUrl)&&!x7(e,`/mcp`,`post`)&&(n.addOperation(tXt,`post`,U5e({url:t.mcpUrl.trim()}),{avoidConflict:!0}),await e.ensureMcpRuntime())}var rXt=async({answers:e,patch:t,services:n,setProgress:r})=>{if(e.saved.status===`applied`)return;r({label:`Saving your changes…`}),e.committed||(await nXt(n,e),WYt(n,e),t({committed:!0}));let{buildId:i}=await GYt(n);t({saved:EYt({buildId:i})})};function S7(e){let t=e.restMode===`import`&&!!e.restImport||e.restMode===`todo-template`,n=e.apiTypes.includes(`GraphQL`)&&e.graphql.status!==`skipped`&&b7(e.graphqlUrl),r=e.apiTypes.includes(`MCP`)&&e.mcp.status!==`skipped`&&b7(e.mcpUrl);return t||n||r}var iXt=`50`,aXt=[`JSON`,`YML`,`YAML`];function oXt({onFileParsed:e,disabled:t}){let[n,r]=(0,g.useState)();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(e2e,{handleChange:async t=>{r(void 0);try{let n=await g6e(t);e(t.name,n)}catch(e){r(e instanceof Error?e.message:`Could not parse the file.`)}},name:`file`,types:aXt,maxSize:iXt,disabled:t,children:(0,W.jsxs)(`div`,{className:G(`flex h-40 w-full flex-col items-center justify-center gap-1 rounded-md border border-dashed border-neutral-400 bg-neutral-50 text-sm`,t?`opacity-50`:`cursor-pointer`),children:[(0,W.jsx)(`div`,{children:`Drag your OpenAPI file here, or click to choose.`}),(0,W.jsxs)(`div`,{className:`text-muted-foreground`,children:[`JSON, YML and YAML are supported (max `,iXt,`MB).`]})]})}),n&&(0,W.jsxs)(`div`,{className:`text-sm text-destructive`,children:[`Parsing error: `,n]})]})}function sXt({name:e,doc:t}){let n=nV(e,t.paths);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`text-sm`,children:[`Importing `,(0,W.jsx)(`span`,{className:`font-medium`,children:e}),` —`,` `,n.length,` operation`,n.length===1?``:`s`,`.`]}),(0,W.jsx)(`div`,{className:`flex max-h-72 flex-col gap-2 overflow-y-auto rounded-md bg-neutral-50 p-3 text-sm`,children:n.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`w-14 shrink-0`,children:(0,W.jsx)(oV,{method:e.additionalOperationContext.method,className:`px-0`})}),(0,W.jsx)(`span`,{className:`truncate`,children:e.additionalOperationContext.path})]},`${e.additionalOperationContext.method}-${e.additionalOperationContext.path}`))})]})}var cXt=(e,t)=>`z${e}-${t}`.toLowerCase().replaceAll(`_`,`-`),lXt=(e,t)=>hj(X.projects(e),{throwOnError:!0,extractData:!0,...t}),uXt=e=>vFe(e.map(e=>X.projects(e)),{extractData:!0}),dXt=(e,t)=>hj(X.project(e,t)),fXt=(e,t)=>{let n=fj();return S_({mutationFn:async()=>{await n.fetch(dj.projects.deleteProject(e,t))}})},pXt=e=>{let t=fj();return S_({mutationFn:async n=>{await t.fetch(dj.projects.createRepoFromProject(e,n.projectName,n.orgName,n.repositoryName,n.defaultBranch,n.otherParams))}})},mXt=(e,t)=>{let n=fj();return S_({mutationFn:async r=>await n.fetch(dj.projects.connectProjectToRepo(e,t,r.orgName,r.repositoryURL,r.defaultBranch,r.forceConnect))})},hXt=(e,t)=>{let n=fj();return S_({mutationFn:async()=>{await n.fetch(dj.projects.disconnectProjectFromRepo(e,t))}})},gXt=(e,t)=>{let n=fj();return S_({mutationFn:async r=>{await n.fetch(dj.projects.updateDefaultBranch({accountName:e,projectName:t,defaultBranch:r.defaultBranch,sourceRepoUrl:r.sourceRepoUrl}))}})};function _Xt(e,t){return`https://dev.zuplo.com/v1/accounts/${e}/key-buckets/${t}`}var vXt=()=>{let e=oh([`account`,`project`]),t=dXt(e.account.name,e.project.name),n=e.project.id;return{...t,data:t.data?.defaultConfiguration.flatMap(t=>t.apiKeyBucket?{name:cXt(e.project.id,t.environmentType),id:t.apiKeyBucket,url:_Xt(n,cXt(n,t.environmentType)),env:t.environmentType}:[]).sort((e,t)=>t.env.localeCompare(e.env))}},yXt=()=>{let e=fj(),t=Hj();return S_({mutationFn:t=>e.fetch(dj.consumers.createConsumer(t)),onSuccess:()=>t.onSuccess(`Consumer created`),onError:t.onError})},bXt=`/config/routes.oas.json`,xXt=`/config/policies.json`,SXt=`/modules/zuplo.runtime.ts`;function CXt(){let e=ch.getState(),t=[];for(let n of e.projectTreeNodes){let r=n.path?e.filesByPath[n.path]:void 0;r&&r.saveState===$r.modified&&t.push(r)}return t}var wXt=(0,g.createContext)(null),TXt=wXt.Provider;function EXt(){let e=(0,g.useContext)(wXt);if(!e)throw Error(`useApiGatewayServices must be used within an ApiGatewayServicesProvider`);return e}function DXt(){let e=oh([`account`,`project`,`environment`]),{email:t}=xoe(),n=Mj(bXt),r=Mj(xXt),i=Mj(SXt),a=jj(),o=yXt(),s=Dj(),c=kj(),{editStrategies:l}=kX(),u=vXt(),d=(0,g.useMemo)(()=>n&&n.content!==void 0?new iV(n,a):void 0,[n,a]),f=(0,g.useMemo)(()=>r&&r.content!==void 0&&n&&n.content!==void 0?new xW(r,[n],a):void 0,[r,n,a]),p=e.account.name,m=e.project.name,h=e.environment.name,_=u.data?.find(e=>e.env===MA.WORKING_COPY)?.id;return(0,g.useMemo)(()=>!d||!f?null:{openApiManager:d,policyManager:f,userEmail:t??``,allOperationIdentifiers:()=>f.getAllOperations().map(e=>({filePath:e.additionalOperationContext.oasFilePath,path:e.additionalOperationContext.path,method:e.additionalOperationContext.method})),createConsumer:async({keyName:e,managerEmail:t})=>_?(await o.mutateAsync({bucketId:_,accountName:p,projectName:m,environmentType:MA.WORKING_COPY,consumer:{sub:e,externalUsers:[{email:t}]}}),{created:!0}):{created:!1},ensureMcpRuntime:async()=>{if(i?.content!==void 0)return;let e=l.find(e=>e.folderName===`/modules`&&`createExtensions`in e);e&&await c(`zuplo.runtime`,`/modules`,void 0,e,Q5e)},save:async()=>{let e=CXt();return e.length===0?{}:{buildId:(await s.mutateAsync({environmentName:h,accountName:p,projectName:m,files:e})).buildId}},commitPolicyToAllRoutes:e=>{let t=ch.getState(),n=t.filesByPath[bXt],r=t.filesByPath[xXt];if(!n||!r)return;let i=new xW(r,[n],a),o=i.getAllOperations().map(e=>({filePath:e.additionalOperationContext.oasFilePath,path:e.additionalOperationContext.path,method:e.additionalOperationContext.method}));i.getPolicyListEnforced().some(t=>t.name===e.name)?i.applyPolicy(e.name,o):i.createPolicy(e,o)}},[d,f,t,_,i,a,l,c,o,s,p,m,h])}function OXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`What types of endpoints do you want to manage (add auth, rate-limiting, monetization, etc.)?`}),(0,W.jsx)(yYt,{values:e.apiTypes,onChange:e=>t({apiTypes:e}),options:[{value:`REST`,title:`REST or RESTish`,description:`Traditional endpoints with GET, POST, PUT and basic HTTP semantics.`},{value:`GraphQL`,title:`GraphQL`,description:`A GraphQL POST endpoint.`},{value:`MCP`,title:`MCP Servers`,description:`MCP servers for use by AI.`}]})]})}function kXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`How do you want to set up your endpoints?`}),(0,W.jsx)(vYt,{value:e.restMode,onChange:e=>t({restMode:e}),options:[{value:`import`,title:`Import an OpenAPI / Swagger document`,description:`Bring your existing API definition.`},{value:`todo-template`,title:`Start from a simple TODO template`,description:`A small REST CRUD API to explore.`},{value:`manual`,title:`Nothing, I'll add routes manually`,description:`Start empty and add routes yourself.`}]})]})}function AXt(){let{answers:e,patch:t}=y7(),n=EXt(),r=e.restImport;return r?(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your OpenAPI document is ready to review.`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-neutral-50 px-4 py-3 text-sm`,children:[(0,W.jsxs)(`span`,{children:[`Selected `,(0,W.jsx)(`span`,{className:`font-medium`,children:r.name}),` —`,` `,r.operationCount,` operation`,r.operationCount===1?``:`s`,`.`]}),(0,W.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t({restImport:void 0}),children:`Choose a different file`})]})]}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Upload your OpenAPI / Swagger document — we'll show you what gets imported on the next step.`}),(0,W.jsx)(oXt,{onFileParsed:(e,r)=>{let i=D6e(r,new Set(n.openApiManager.operationArray?.map(e=>e.operationId).filter(e=>!!e))),a=nV(e,i.paths).length;t({restImport:{name:e,doc:i,operationCount:a}})}})]})}function jXt(){let{answers:e}=y7(),t=e.restImport;return t?(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Review the operations that will be added to your gateway, then continue.`}),(0,W.jsx)(sXt,{name:t.name,doc:t.doc})]}):(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No file selected — go back and upload an OpenAPI document.`})}function MXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`What is the URL of your GraphQL endpoint?`}),(0,W.jsx)(dV,{value:e.graphqlUrl,placeholder:`https://example.com/graphql`,onChange:e=>t({graphqlUrl:e.target.value})})]}),e.graphql.status===`applied`&&(0,W.jsxs)(h7,{children:[`GraphQL endpoint added at `,e.graphql.result.path,`.`]})]})}function NXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`What is the URL of your MCP server?`}),(0,W.jsx)(dV,{value:e.mcpUrl,placeholder:`https://example.com/mcp`,onChange:e=>t({mcpUrl:e.target.value})})]}),e.mcp.status===`applied`&&(0,W.jsxs)(h7,{children:[`MCP endpoint added at `,e.mcp.result.path,`.`]})]})}var PXt=/.+@.+\..+/,FXt={id:`api-gateway-basic`,title:`Set up your API gateway`,initialAnswers:e=>$Yt(String(e.params.userEmail??``)),steps:[{id:`api-types`,title:`API types`,Component:OXt,canAdvance:e=>e.apiTypes.length>0||`Pick at least one API type`},{id:`rest-setup`,title:`REST`,isActive:e=>e.apiTypes.includes(`REST`),Component:kXt,canAdvance:e=>e.restMode?!0:`Choose how to set up your endpoints`},{id:`rest-import-upload`,title:`Upload`,isActive:e=>e.apiTypes.includes(`REST`)&&e.restMode===`import`,Component:AXt,canAdvance:e=>e.restImport?!0:`Upload an OpenAPI file to continue`},{id:`rest-import-review`,title:`Review`,isActive:e=>e.apiTypes.includes(`REST`)&&e.restMode===`import`,Component:jXt,canAdvance:e=>e.restImport?!0:`Upload an OpenAPI file first`},{id:`graphql-url`,title:`GraphQL`,isActive:e=>e.apiTypes.includes(`GraphQL`),Component:MXt,skippable:!0,skipLabel:`I'll add it manually`,onSkip:()=>({graphql:TYt}),canAdvance:e=>b7(e.graphqlUrl)||`Enter a valid URL, or skip`},{id:`mcp-url`,title:`MCP`,isActive:e=>e.apiTypes.includes(`MCP`),Component:NXt,skippable:!0,skipLabel:`I'll add it manually`,onSkip:()=>({mcp:TYt}),canAdvance:e=>b7(e.mcpUrl)||`Enter a valid URL, or skip`},{id:`policies`,title:`Policies`,isActive:S7,Component:qYt},{id:`api-key`,title:`API Key`,isActive:e=>S7(e)&&e.selectedPolicies.includes(`api-key`),Component:JYt,canAdvance:e=>e.apiKeyDraft.keyName.trim().length>0&&PXt.test(e.apiKeyDraft.managerEmail)||`Enter a key name and a valid manager email`,onExit:UYt},{id:`rate-limit`,title:`Rate limiting`,isActive:e=>S7(e)&&e.selectedPolicies.includes(`rate-limit`),Component:XYt,canAdvance:e=>e.rateLimitDraft.requests>=1||`Enter at least 1 request`},{id:`success`,title:`Done`,Component:QYt,isFinal:!0,nextLabel:`Go to my project`,onEnter:rXt,ownsStatus:!0,canAdvance:e=>!S7(e)||e.saved.status===`applied`||`Saving your changes…`}]},IXt={[FXt.id]:FXt},LXt=`wizard`;function RXt(){let[e]=FA(LXt);return e?(0,W.jsx)(zXt,{wizardId:e}):null}function zXt({wizardId:e}){let t=oh([`account`,`project`,`environment`]),n=DXt(),[,r]=FA(LXt),i=IXt[e];if(!i||!n)return null;let a={params:{userEmail:n.userEmail},account:t.account.name,project:t.project.name,environment:t.environment.name},o=()=>r(void 0);return(0,W.jsx)(TXt,{value:n,children:(0,W.jsx)(IYt,{definition:i,launch:a,services:n,onClose:o,onComplete:o})})}var BXt=`/modules/zuplo.runtime.ts`,VXt=`editor-file-tree-open`;function HXt(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(VXt);if(e===null)return null;let t=JSON.parse(e);return typeof t==`boolean`?t:null}catch{return null}}function UXt(){let e=oh(),{editStrategies:t}=kX(),[n,r]=FA(`path`),[i]=FA(`build`),{monaco:a,reloadFiles:o}=S1(),s=AA(o.execute),c=e.environment.name,{isReadOnly:l}=NA(),[u,d]=(0,g.useState)(HXt),f=u??!1,p=e=>{d(e);try{window.localStorage.setItem(VXt,JSON.stringify(e))}catch{}},m=ch(e=>e.projectTreeNodes),h=ch(e=>e.setPendingNewFile),_=`${e.account.name}/${e.project.name}/${e.environment.name}`,[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(_);b!==_&&(x(_),y(!1)),(0,g.useEffect)(()=>{if(v)return;if(n){y(!0);return}if(m.length===0)return;let e=m.find(e=>e.path&&Lie.test(e.path));y(!0),e&&r(e.path)},[n,m,r,v]);let S=m.some(e=>e.path===BXt),C=m.length===0,w=!n&&(C||!v),T=(e,t)=>{p(!0),h({strategyFolder:e,template:t})},{isError:E,error:D}=b_({queryKey:[`reloadFiles`,e.account.name,e.project.name,e.environment.name],queryFn:async({signal:t})=>(await s.current({accountName:e.account.name,projectName:e.project.name,environmentName:e.environment.name},t),!0),refetchOnWindowFocus:!1,enabled:!!a&&!!c});if(E&&D instanceof Ff)return(0,W.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,W.jsxs)(jS,{className:`max-w-md`,children:[(0,W.jsx)(MS,{children:D.title}),(0,W.jsxs)(NS,{className:`flex flex-col gap-2`,children:[Bj(D),(0,W.jsx)(CDt,{})]})]})});let O=(0,W.jsxs)(rN,{direction:`vertical`,autoSaveId:`bottom-pane`,className:`relative`,children:[(0,W.jsx)(iN,{minSize:10,children:n?(0,W.jsx)(cN,{fallback:e=>(0,W.jsx)(ZQe,{...e}),children:(0,W.jsx)(WXt,{})}):w?(0,W.jsx)(GXt,{}):null}),l&&(0,W.jsx)(`a`,{href:`https://zuplo.com/docs/articles/environments`,target:`_blank`,rel:`noreferrer`,children:(0,W.jsx)(`div`,{className:`absolute mx-auto border-zuplo-200 left-0 right-0 bottom-12 bg-zuplo-100 text-zuplo-700 h-8 rounded-full shadow-md border w-36 items-center justify-center flex text-sm font-medium`,children:`Read-only`})}),i!==void 0&&(0,W.jsx)(lYt,{})]});return(0,W.jsxs)(`div`,{className:`flex h-full w-full`,children:[!f&&(0,W.jsxs)(`div`,{className:`flex flex-col items-center bg-surface-sunken border-r shrink-0 w-9 py-1.5 gap-0.5`,children:[(0,W.jsx)(C7,{label:`Expand file tree`,onClick:()=>p(!0),testId:`expand-file-tree`,children:(0,W.jsx)(oie,{size:14})}),(0,W.jsx)(`div`,{className:`my-1 h-px w-5 bg-neutral-200 dark:bg-neutral-700`,"aria-hidden":!0}),!l&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C7,{label:`New OpenAPI Spec`,onClick:()=>T(`/config`,`OpenAPI Spec`),testId:`sidebar-new-open-api-spec`,children:(0,W.jsx)(lN,{className:`size-3.5`})}),(0,W.jsx)(C7,{label:`New Module`,onClick:()=>T(`/modules`,`Request Handler`),testId:`sidebar-new-module`,children:(0,W.jsx)(Bre,{size:14})}),!S&&(0,W.jsx)(C7,{label:`New Runtime Extension`,onClick:()=>T(`/modules`,`zuplo.runtime.ts`),testId:`sidebar-new-runtime-extension`,children:(0,W.jsx)(yie,{size:14})}),(0,W.jsx)(C7,{label:`New Schema`,onClick:()=>T(`/schemas`,`Schema`),testId:`sidebar-new-schema`,children:(0,W.jsx)(wre,{size:14})})]}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`span`,{className:`text-[10px] font-medium text-neutral-500 uppercase tracking-wider select-none pb-1`,style:{writingMode:`vertical-rl`},children:`Files`})]}),f?(0,W.jsxs)(rN,{direction:`horizontal`,autoSaveId:`file-tree`,className:`flex-1 min-w-0`,children:[(0,W.jsx)(iN,{minSize:10,defaultSize:20,className:`bg-surface-sunken min-w-[270px]`,children:(0,W.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between h-10 px-2 border-b shrink-0`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium text-neutral-600 dark:text-neutral-400 uppercase tracking-wide pl-1`,children:`Files`}),(0,W.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>p(!1),"aria-label":`Collapse file tree`,title:`Collapse file tree`,children:(0,W.jsx)(aie,{size:14})})]}),(0,W.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,W.jsx)(tXe,{directoryStrategies:t})})]})}),(0,W.jsx)(aN,{}),(0,W.jsx)(iN,{minSize:70,children:O})]}):(0,W.jsx)(`div`,{className:`flex-1 min-w-0`,children:O}),(0,W.jsx)(RXt,{})]})}var WXt=()=>{let[e]=FA(`path`);if(!e)throw Error(`Invalid state - FileViewer should not be displayed if no path`);let t=e.toLowerCase();if(t===`/docs/sidebar.json`)return(0,W.jsx)(KGe,{});if(t.includes(`.oas.json`))return(0,W.jsx)(HCt,{});if(t===`/config/policies.json`)return(0,W.jsx)(QTt,{});if(t.endsWith(`.md`)||t.endsWith(`.mdx`)){let e=t.split(`/`),n=e[e.length-1];return(0,W.jsx)(GGe,{fileName:n})}return t.endsWith(`.ts`)||t.endsWith(`.css`)?(0,W.jsx)(JP,{maxHeightVh:100}):t.startsWith(`/schemas`)&&t.endsWith(`.json`)?(0,W.jsx)(JP,{}):t===`/config/dev-portal.json`?(0,W.jsxs)(`div`,{className:`size-full`,children:[(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(nEt,{})}),(0,W.jsx)(JP,{})]}):(0,W.jsx)(JP,{})},GXt=()=>(0,W.jsxs)(`div`,{className:`p-6 flex flex-col gap-2`,"data-test":`editor-loading`,children:[(0,W.jsx)(oN,{className:`w-40 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`}),(0,W.jsx)(oN,{className:`w-28 h-4`}),(0,W.jsx)(oN,{className:`w-64 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`})]}),C7=({label:e,onClick:t,testId:n,children:r})=>(0,W.jsx)(Ck,{content:e,side:`right`,children:(0,W.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e,"data-test":n,className:`group flex items-center justify-center size-7 rounded-md text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:bg-neutral-200 dark:hover:bg-neutral-800 transition-colors cursor-pointer focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-zuplo-500`,children:r})});function KXt(){return(0,W.jsxs)(eMe,{children:[(0,W.jsx)(UXt,{}),(0,W.jsx)(LFe,{})]})}var qXt=`/static/img/hero-Ct8-h_EN.svg`,JXt=`/static/img/hero-dark-Z9HfvwEQ.svg`,YXt=[{label:`Monetization`,value:`monetization`,badge:`Beta`,items:[{title:`Monetization Overview`,description:`Learn more about our first-party metering and billing solution built directly into the Zuplo platform.`,icon:PR,link:{href:{web:`https://zuplo.com/docs/articles/monetization/index`,local:`https://zuplo.com/docs/articles/monetization/index`},text:`Read the docs`}},{title:`Monetization Quickstart`,description:`Get up and running with API monetization in minutes using Zuplo's built-in billing and metering.`,icon:RR,link:{href:{web:`https://zuplo.com/docs/articles/monetization/quickstart`,local:`https://zuplo.com/docs/articles/monetization/quickstart`},text:`Get Started`}},{title:`Pricing Models`,description:`Explore the different pricing models available for monetizing your APIs with Zuplo.`,icon:FR,link:{href:{web:`https://zuplo.com/docs/articles/monetization/pricing-models`,local:`https://zuplo.com/docs/articles/monetization/pricing-models`},text:`Read the docs`}}]},{label:`MCP`,value:`mcp`,items:[{title:`Installing the MCP Inspector`,description:`Set up the MCP Inspector locally and start testing your MCP server with ease.`,icon:Qqe,link:{href:{web:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`,local:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`},text:`Get Started`}},{title:`MCP Quickstart`,description:`Learn how to start using Model Context Protocol to pass context into any model call.`,icon:RR,link:{href:{web:`https://zuplo.com/docs/articles/mcp-quickstart`,local:`https://zuplo.com/docs/articles/mcp-quickstart`},text:`Get Started`}},{title:`Using OAuth with MCP`,description:`Authenticate users securely by integrating OAuth flows into your Model Context Protocol setup.`,icon:iJe,link:{href:{web:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`,local:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`},text:`Get Started`}}]},{label:`Rate Limiting`,value:`rate-limiting`,items:[{title:`Adding Rate Limiting`,description:`Control traffic and protect your APIs by setting up flexible, customizable rate limits.`,icon:FR,link:{href:{web:`https://zuplo.com/docs/articles/step-2-add-rate-limiting`,local:`https://zuplo.com/docs/articles/step-2-add-rate-limiting-local`},text:`Get Started`}},{title:`Complex Rate Limiting`,description:`Implement advanced rules to rate limit by user, IP, plan, or custom logic.`,icon:Yqe,link:{href:{web:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`,local:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`},text:`Get Started`}},{title:`Dynamic Rate Limits`,description:`Set rate limits that adapt in real-time based on headers, tokens, or user context.`,icon:nJe,link:{href:{web:`https://zuplo.com/examples/dynamic-rate-limits`,local:`https://zuplo.com/examples/dynamic-rate-limits`},text:`Get Started`}}]},{label:`Authentication`,value:`authentication`,items:[{title:`Using API Keys`,description:`Authenticate and manage access to your APIs with simple, secure API key workflows.`,icon:sJe,link:{href:{web:`https://zuplo.com/docs/policies/api-key-inbound`,local:`https://zuplo.com/docs/policies/api-key-inbound`},text:`Get Started`}},{title:`Using Auth0`,description:`Connect your APIs to Auth0 for streamlined authentication and powerful identity management.`,icon:dJe,link:{href:{web:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`},text:`Get Started`}},{title:`Using Okta`,description:`Integrate Okta with your APIs to enable secure, enterprise-grade authentication and authorization.`,icon:tJe,link:{href:{web:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`},text:`Get Started`}}]},{label:`Dev Portal`,value:`dev-portal`,items:[{title:`Setup your API Reference`,description:`Instantly generate an interactive reference by importing your OpenAPI spec—no manual work needed.`,icon:Jqe,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`},text:`Get Started`}},{title:`Adding Authentication`,description:`Guide users through secure API access by adding auth flows to your developer portal.`,icon:oJe,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`},text:`Get Started`}},{title:`Creating API Catalogs`,description:`Organize your APIs into searchable, user-friendly catalogs for easier discovery and onboarding.`,icon:PR,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`,local:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`},text:`Get Started`}}]}],XXt=({mode:e=`web`})=>(0,W.jsxs)(GN,{defaultValue:`monetization`,className:`flex flex-col my-8`,children:[(0,W.jsx)(KN,{className:`flex gap-8 border-b border-gray-200 dark:border-neutral-700 mb-8 ml-1`,children:YXt.map(e=>(0,W.jsxs)(qN,{value:e.value,className:`relative py-2 text-sm font-medium text-gray-600 dark:text-neutral-400 hover:text-gray-900 dark:hover:text-neutral-100 data-[state=active]:text-gray-900 dark:data-[state=active]:text-neutral-100 border-b-2 border-transparent data-[state=active]:border-black dark:data-[state=active]:border-white transition-colors`,children:[e.label,`badge`in e&&e.badge&&(0,W.jsx)(PS,{variant:`invert`,className:`ml-2`,children:e.badge})]},e.value))}),YXt.map(t=>(0,W.jsx)(JN,{value:t.value,className:`grid grid-cols-3 gap-4`,children:t.items.map(t=>(0,W.jsxs)(UB,{className:`flex flex-col gap-2 text-muted-foreground`,children:[(0,W.jsxs)(WB,{className:`flex gap-2`,children:[(0,W.jsx)(t.icon,{size:24,weight:`duotone`,className:`[&_[opacity='0.2']]:fill-pink-500`}),(0,W.jsx)(GB,{className:`gap-x-2 text-lg font-semibold`,children:t.title})]}),(0,W.jsx)(qB,{className:`text-md`,children:t.description}),(0,W.jsx)(JB,{className:`flex-1 items-end! border-0 mb-4`,children:(0,W.jsx)(Y,{variant:`outline`,className:`w-full`,asChild:!0,children:(0,W.jsx)(rT,{href:t.link.href[e],variant:`ghost`,children:t.link.text})})})]},t.title))},t.value))]}),ZXt=({title:e,url:t,className:n})=>{let{copyToClipboard:r,state:i}=eO(t??``);return(0,W.jsxs)(UB,{className:G(`col-span-full md:col-span-5 py-2 px-4 flex items-center text-sm gap-x-2`,n),children:[(0,W.jsx)(`div`,{className:`bg-green-600 rounded-full w-4 h-4 p-0.5`,children:(0,W.jsx)(mm,{className:`text-white`,size:12})}),(0,W.jsx)(`span`,{className:`font-semibold`,children:e}),(0,W.jsx)(`div`,{className:`flex-1`,children:t?(0,W.jsx)(rT,{href:t,className:`ml-2 font-medium line-clamp-1 break-all`,children:t}):(0,W.jsx)(oN,{className:`ml-2 h-4 w-8/12`})}),(0,W.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:r,children:(0,W.jsxs)(Tk,{loading:i===`copied`,alternative:(0,W.jsx)(mm,{size:12,className:`text-green-600`,strokeWidth:3}),className:`flex`,children:[(0,W.jsx)(Om,{size:16,className:`mr-2`,strokeWidth:1.5}),`Copy URL`]})})]})},QXt=({size:e=24,...t})=>(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,fill:`none`,viewBox:`0 0 16 16`,...t,children:(0,W.jsx)(`path`,{fill:`#000`,d:`m7.47 12.412 3.348-.592.031-.007-1.722-2.049a291.474 291.474 0 0 1-1.723-2.058c0-.01 1.779-4.909 1.789-4.926a788.95 788.95 0 0 1 2.934 5.066l2.95 5.115.023.039-10.948-.001 3.317-.587zM.9 11.788c0-.003.811-1.412 1.803-3.131L4.507 5.53l2.102-1.764C7.765 2.797 8.714 2 8.717 2a.37.37 0 0 1-.033.085L6.4 6.981l-2.24 4.808-1.63.002c-.897.001-1.63 0-1.63-.003z`})}),$Xt=({className:e,size:t=24})=>(0,W.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,W.jsx)(`path`,{d:`M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z`})}),eZt=({className:e,size:t=24})=>(0,W.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.606 9.606 0 0112 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48C19.137 20.107 22 16.373 22 11.969 22 6.463 17.522 2 12 2z`})}),tZt=({className:e,size:t=24})=>(0,W.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z`})});function w7({providerName:e,className:t,size:n=24}){switch(e?.toLowerCase()){case`gitlab`:return(0,W.jsx)(tZt,{className:t,size:n});case`bitbucket`:return(0,W.jsx)($Xt,{className:t,size:n});case`azure`:return(0,W.jsx)(QXt,{className:t,size:n});default:return(0,W.jsx)(eZt,{className:t,size:n})}}var nZt=({onSuccess:e}={})=>{let t=fj(),{logEvent:n,captureException:r}=Rg();return S_({mutationFn:async e=>(await t.fetch(dj.accounts.createCustomDomain({accountName:e.accountName,isAlias:e.isAlias,projectName:e.projectName,hostname:e.hostname,deploymentName:e.deploymentName,stage:e.stage}))).json(),onSuccess:(t,r)=>{n(`account-custom-domain-creation-success`,{account:r.accountName}),e?.(t)},onError:e=>{n(`account-custom-domain-creation-failed`),r(e)}})},rZt=()=>{let e=fj();return S_({mutationFn:async t=>{await e.fetch(dj.accounts.editCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},iZt=()=>{let e=fj();return S_({mutationFn:async t=>{await e.fetch(dj.accounts.deleteCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},aZt=(e,t)=>hj(X.customDomains(e,t),{extractData:!0}),oZt=(0,g.forwardRef)(({icon:e,label:t,count:n,expanded:r,onToggle:i,children:a},o)=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-gray-200 dark:border-neutral-700 bg-surface shadow-xs`,children:[(0,W.jsxs)(`button`,{ref:o,type:`button`,onClick:i,"aria-expanded":r,className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-sm transition hover:bg-gray-50 dark:hover:bg-neutral-800`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2 font-medium text-gray-800 dark:text-neutral-200`,children:[(0,W.jsx)(e,{size:14,className:`text-gray-500 dark:text-neutral-400`,strokeWidth:2}),t]}),(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(PS,{variant:`secondary`,size:`sm`,className:`px-1.5 font-mono`,children:n??0}),r?(0,W.jsx)(_m,{size:14,className:`text-gray-500 dark:text-neutral-400`}):(0,W.jsx)(hm,{size:14,className:`text-gray-400 dark:text-neutral-500`})]})]}),r?(0,W.jsx)(`div`,{className:`border-t border-gray-100 dark:border-neutral-800`,children:a}):null]}));oZt.displayName=`ExpandableNode`;var sZt=({selected:e,onChange:t,options:n,listLabel:r,className:i,classNameOptions:a,testId:o,placeholder:s,matchWidth:c=!0,selectorElement:l,disabled:u,labelPrefixElement:d=null,isLoadingData:f=!1})=>(0,W.jsxs)(NB,{value:e,onChange:t,disabled:u,children:[r&&(0,W.jsx)(NB.Label,{className:`block text-sm font-medium text-gray-700`,children:r}),(0,W.jsxs)(`div`,{className:(0,_P.default)({relative:c},i),children:[(0,W.jsxs)(NB.Button,{"data-test":o,className:(0,_P.default)(`w-full relative`,`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-background px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,u?`bg-gray-200`:`bg-white`,i),children:[e?.icon&&(0,W.jsx)(`span`,{className:`absolute pr-10`,children:f?(0,W.jsx)(gL,{className:`w-4 h-4 mr-2`,borderPositionAndSize:`border-l-2`}):e.icon}),(0,W.jsxs)(`span`,{className:(0,_P.default)(`block truncate`,{"ml-7":e?.icon}),children:[d,e?.label??s]}),(0,W.jsx)(`span`,{className:`flex items-center pointer-events-none`,children:l??(0,W.jsx)(vm,{className:`h-5 w-5 text-gray-400`,"aria-hidden":`true`})})]}),(0,W.jsx)(VB,{as:g.Fragment,leave:`transition ease-in duration-100`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,W.jsx)(NB.Options,{className:(0,_P.default)(`absolute z-20 mt-1 bg-white shadow-lg rounded-md py-1 text-base border overflow-auto focus:outline-hidden sm:text-sm`,a),children:n.map((t,n)=>(0,W.jsx)(NB.Option,{"data-test":`${o}-${n}`,className:({active:e})=>(0,_P.default)(e?`bg-gray-50`:``,t.disabled?`cursor-not-allowed`:`cursor-pointer`,`text-gray-900 select-none relative py-2 px-3`),value:t,disabled:t.disabled??!1,children:t.description?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`font-semibold block text-sm leading-7`,children:t.label}),(0,W.jsx)(`span`,{className:`text-xs`,children:t.description})]}):(0,W.jsxs)(`div`,{className:`flex flex-row font-normal items-center`,children:[t.icon&&(0,W.jsx)(`div`,{children:t.icon}),` `,(0,W.jsx)(`div`,{children:t.label}),t.icon&&e&&e.value.toString()===t.value.toString()&&(0,W.jsx)(`div`,{className:`absolute right-0`,children:(0,W.jsx)(mm,{className:`mr-3 h-5 w-5`})})]})},`${n}-${t.value}`))})})]})]});function cZt(e,t=500){let[n,r]=(0,g.useState)(e);return(0,g.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>{clearTimeout(n)}},[e,t]),n}var lZt=({projects:e,isLoadingProjects:t,selectedProject:n,onProjectChange:r})=>(0,W.jsx)(sZt,{testId:`project-selector`,placeholder:`Select Project`,options:(e||[]).map(e=>({label:e.name,value:e.id,icon:(0,W.jsx)(Fm,{className:`mr-1.5`,size:16})})),selected:n,onChange:r,className:`flex-1 items-center w-full h-9`,isLoadingData:t});function T7({title:e,className:t}){return(0,W.jsx)(`div`,{className:G(`text-2xl font-medium`,t),children:e})}var uZt=({showHeader:e})=>(0,W.jsxs)(W.Fragment,{children:[e&&(0,W.jsx)(T7,{title:`Source Control Settings`}),(0,W.jsxs)(`div`,{className:`w-full sm:max-w-md md:max-w-2xl lg:max-w-5xl animate-pulse`,children:[e&&(0,W.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`}),(0,W.jsxs)(`div`,{className:`flex flex-col md:flex-row lg:flex-row sm:gap-4`,children:[(0,W.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,W.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,W.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs right-0 h-10 bg-gray-200 rounded-md dark:bg-gray-700`})]}),(0,W.jsx)(`div`,{className:`h-5 mt-5 mb-3`,children:(0,W.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`})}),(0,W.jsx)(`div`,{className:`mt-5 h-96 relative bg-gray-200 rounded-md dark:bg-gray-700`})]})]}),E7=`GITLAB`,D7=`GITHUB`,O7=`BITBUCKET`,k7=`AZURE`,dZt=({installUrl:e,selectedOrg:t,projectName:n,className:r,provider:i=D7,disabled:a})=>{let{logEvent:o}=Rg(),[s,c]=(0,g.useState)(!1),l=e=>{o(`source-control-create-repo-continue-clicked`,{sourceControlNamespace:e??`none`,sourceControlProvider:i,project:n});let t;switch(i){case k7:t=e?`https://dev.azure.com/${e}/_createproject`:`https://dev.azure.com/`;break;case E7:t=e?`https://gitlab.com/projects/new?namespace_id=${e}`:`https://gitlab.com/projects/new`;break;case O7:t=e?`https://bitbucket.org/repo/create?owner=${e}`:`https://bitbucket.org/repo/create`;break;default:t=e===null?`https://github.com/new?name=${n}&description=Zuplo%20API%20Gateway`:`https://github.com/organizations/${e}/repositories/new?owner=${e}&name=${n}&description=Zuplo%20API%20Gateway`;break}window.open(t),c(!1)};return(0,W.jsxs)(bA,{open:s,onOpenChange:c,children:[(0,W.jsx)(xA,{asChild:!0,children:(0,W.jsx)(Y,{className:r,disabled:a,children:`Create new repository`})}),(0,W.jsxs)(CA,{className:`max-w-xl! w-full`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Create new repository`}),(0,W.jsx)(DA,{})]}),(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`We're about to help you create a new repository in`,` `,zj(i),`.`]}),(0,W.jsxs)(`div`,{className:`rounded-md bg-muted/50 p-3 text-sm space-y-2 border`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`What you'll need to do:`}),i===`AZURE`&&(0,W.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,W.jsx)(`li`,{children:`Create a project and repository in Azure DevOps`}),(0,W.jsx)(`li`,{children:`Return to Zuplo to connect it`})]}),i===`GITHUB`&&(0,W.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,W.jsx)(`li`,{children:`Create your new repository on GitHub`}),(0,W.jsxs)(`li`,{children:[`Ensure the`,` `,(0,W.jsx)(rT,{href:e,children:`Zuplo GitHub App`}),` `,`has access to your new repo`]}),(0,W.jsx)(`li`,{children:`Return to Zuplo to see and connect it`})]}),(i===`GITLAB`||i===`BITBUCKET`)&&(0,W.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,W.jsxs)(`li`,{children:[`Create your repository in `,zj(i)]}),(0,W.jsx)(`li`,{children:`Return to Zuplo to connect it`})]})]}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need help?`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/source-control`,children:`View our troubleshooting guide`})]})]}),(0,W.jsx)(TA,{children:(0,W.jsxs)(Y,{"data-test":`navigate-new-${i.toLowerCase()}-repo`,onClick:()=>l(t),children:[`Continue to `,zj(i)]})})]})]})},fZt=({accountName:e,projectName:t,orgName:n,repositoryUrl:r,provider:i,handleErrors:a})=>{let{logEvent:o,captureException:s}=Rg(),[c,l]=(0,g.useState)(!1),u=mXt(e,t),d=async(n,r,d)=>{try{if(n===null)throw Error(`Invalid ${zj(i)} account/organization selected, please try again.`);if(r===null)throw Error(`Invalid repository selected, please try again.`);let s=await(await u.mutateAsync({orgName:n,repositoryURL:r,defaultBranch:`main`,forceConnect:d},{onError:r=>{let i=Bj(r);a(i),o(`source-control-repo-connection-failed`,{account:e,project:t,sourceControlNamespace:n,errorMessage:i})}})).json();s.connected===!1&&s.emptyRepository===!1?l(!0):c&&l(!1),s.connected&&o(`source-control-repo-connected`,{account:e,project:t,sourceControlNamespace:n})}catch(r){s(r);let i=Bj(r);o(`source-control-repo-connection-failed`,{account:e,project:t,sourceControlNamespace:n,errorMessage:i}),a(i),c&&l(!1)}};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(oX,{open:c,onOpenChange:l,title:`Connecting project to repository`,description:`The repository you picked is not empty. Connecting will just create an association between this project and the repo. No changes will be pushed or pulled — you must do that manually using the ${zj(i)} button. Do you still want to connect?`,actionLabel:`Connect`,isPending:u.isPending,onConfirm:()=>d(n,r,!0)}),(0,W.jsx)(Y,{"data-test":`connect-repo-button`,variant:`outline`,size:`sm`,onClick:()=>d(n,r,!1),children:(0,W.jsx)(Tk,{variant:`primary`,loading:u.isPending,children:`Connect`})})]})},pZt=({repositories:e,account:t,project:n,selectedNamespace:r,provider:i,maxItems:a=5,onConnectError:o})=>{let s=i===`azure`;return(0,W.jsx)(W.Fragment,{children:e.slice(0,a).map((e,a)=>(0,W.jsxs)(`div`,{className:(0,_P.default)(`flex flex-row items-center justify-center h-16 border-gray-300 px-5 lg:gap-5 gap-2`,{"border-t":a!==0}),children:[(0,W.jsxs)(`div`,{className:`flex text-sm flex-1 gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,W.jsx)(`span`,{className:`font-medium line-clamp-1`,children:e.name}),s&&e.metadata?.projectName?(0,W.jsxs)(`span`,{className:`text-gray-400 text-xs`,children:[`Project: `,e.metadata.projectName]}):(0,W.jsxs)(`span`,{className:`text-gray-400 hidden md:inline-block lg:inline-block`,children:[`Updated on`,` `,new Date(e.updatedAt).toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})]})]}),e.private&&(0,W.jsxs)(`div`,{className:`flex justify-center items-center text-gray-400 gap-1`,children:[(0,W.jsx)(Um,{className:`h-4 w-4`,"aria-hidden":`false`,"aria-label":`Private Git repository`}),(0,W.jsx)(`span`,{className:`hidden lg:block`,children:`Private Repository`})]})]}),(0,W.jsx)(fZt,{accountName:t.name,projectName:n.name,orgName:r?.label||``,repositoryUrl:e.url,provider:i,handleErrors:o})]},e.id))})},mZt={[D7]:{name:`GitHub`,icon:(e=20)=>(0,W.jsx)(eZt,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitHub Account`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? We can help you create a new one.`,selectAccount:`Make sure to select a Git account or organization on the top left.`,grantAccess:`Make sure to grant Zuplo access to the Git account & its repositories you'd like to connect to.`}},[k7]:{name:`Azure DevOps`,icon:(e=20)=>(0,W.jsx)(QXt,{className:`mr-1.5`,size:e}),supportsProjects:!0,placeholder:{namespace:`Select Organization`,project:`Select Project`,search:`Search repositories`},messages:{noRepoInProject:`No repository in this project? Create a new one.`,noRepoAtHand:`No project at hand? We can help you create one.`,selectAccount:`Please select a project to view repositories.`,grantAccess:`No repositories in this project yet.`}},[E7]:{name:`GitLab`,icon:(e=20)=>(0,W.jsx)(Im,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitLab Group`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a GitLab group or namespace.`,grantAccess:`Connect your GitLab account to see repositories.`}},[O7]:{name:`Bitbucket`,icon:(e=20)=>(0,W.jsx)(Ere,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select Bitbucket Project`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a Bitbucket project.`,grantAccess:`Connect your Bitbucket account to see repositories.`}}},hZt=e=>mZt[e]||mZt.GITHUB,A7=({account:e,project:t})=>{let{logEvent:n}=Rg(),r=pXt(e.name),[i,a]=(0,g.useState)(t.name),[o,s]=(0,g.useState)(!1);return{newRepoName:i,setNewRepoName:a,showCreateRepoForm:o,setShowCreateRepoForm:s,createRepoMutation:r,isCreating:r.isPending,handleCreateRepo:async({namespace:o,repoName:c,otherParams:l})=>{let u=c||i||t.name;await r.mutateAsync({projectName:t.name,orgName:o,repositoryName:u,defaultBranch:`main`,otherParams:l}),n(`source-control-repo-created`,{sourceControlRepository:u,sourceControlNamespace:o,account:e.name,project:t.name}),a(``),s(!1)},reset:()=>{s(!1),a(t.name)},transformRepoToRepository:(e,t)=>({id:e.url,url:e.url,provider:t,name:e.name,slug:e.name,defaultBranch:e.defaultBranch,namespace:e.organization,owner:{id:0,name:e.organization},private:!0,updatedAt:new Date().toISOString(),ownerType:e.isUserRepo?`user`:`team`,metadata:e.metadata}),logEvent:n}},gZt=e=>{let{account:t,project:n,sourceControlConfig:r,selectedNamespace:i,searchTerm:a}=e,o=A7(e),[s,c]=(0,g.useState)(null),l=r.provider===k7,{data:u,isLoading:d}=LYe(t.name,i?.value||``,{enabled:l&&!!i}),{data:f,isLoading:p}=FYe(t.name),m=o.transformRepoToRepository;return{repositories:(0,g.useMemo)(()=>!f?.data||!i||!s?[]:(f.data[i.label]||[]).filter(e=>e.metadata?.projectName===s.label).filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())).map(e=>m(e,`azure`)),[f,i,s,a,m]),isLoadingRepos:p&&!!s,projects:u?.data,selectedProject:s,isLoadingProjects:d,onProjectChange:e=>{c(e),o.logEvent(`source-control-project-selected`,{account:t.name,project:n.name,sourceControlProvider:r.provider})},reset:()=>{c(null),o.reset()}}},_Zt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=A7(e),o=n.provider===O7,{data:s,isLoading:c,refetch:l}=RYe(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{repositories:s?.repositories||[],isLoadingRepos:c,onCreateRepo:async()=>{if(!r)throw Error(`Please select a project`);await a.handleCreateRepo({namespace:r.value}),l()},reset:a.reset,showCreateRepoForm:a.showCreateRepoForm,setShowCreateRepoForm:a.setShowCreateRepoForm,newRepoName:a.newRepoName,setNewRepoName:a.setNewRepoName,isCreating:a.isCreating}},vZt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=A7(e),o=n.provider===D7,{data:s,isLoading:c}=RYe(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{...a,repositories:s?.repositories||[],isLoadingRepos:c,reset:a.reset}},yZt=e=>{let{account:t,selectedNamespace:n,searchTerm:r}=e,i=A7(e),{data:a}=IYe(t.name),{data:o,isLoading:s,refetch:c}=FYe(t.name),l=i.transformRepoToRepository;return{repositories:(0,g.useMemo)(()=>{if(!o?.data||!n)return[];let e=a?.find(e=>e.installationId===Number(n.value))?.slug||n.label;return(o.data[e]||[]).filter(e=>!r||e.name.toLowerCase().includes(r.toLowerCase())).map(e=>l(e,`gitlab`))},[o,n,r,a,l]),isLoadingRepos:s,onCreateRepo:async()=>{if(!n)throw Error(`Please select a namespace`);await i.handleCreateRepo({namespace:n.value}),c()},reset:i.reset,showCreateRepoForm:i.showCreateRepoForm,setShowCreateRepoForm:i.setShowCreateRepoForm,newRepoName:i.newRepoName,setNewRepoName:i.setNewRepoName,isCreating:i.isCreating}},bZt=250,xZt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=Rg(),i=n.provider,a=hZt(i),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(``),f=cZt(u,bZt),{data:p,isLoading:m,isFetching:h,error:_}=IYe(e.name),v={account:e,project:t,sourceControlConfig:n,selectedNamespace:c,searchTerm:f},y=gZt(v),b=yZt(v),x=_Zt(v),S=vZt(v),C=(()=>{switch(i){case k7:return y;case E7:return b;case O7:return x;default:return S}})();(0,g.useEffect)(()=>{let e=Bj(_);e&&s(e)},[_]),(0,g.useEffect)(()=>{if(p&&p.length>0){let e=p[0];l({label:e.name,value:i===`AZURE`?e.slug:e.installationId.toString(),icon:a.icon(20)})}},[p,i,a]);let w=a=>{if(a.value===`add-github-account`){r(`source-control-add-account-selected`,{sourceControlNamespace:a.value,account:e.name,project:t.name,sourceControlProvider:i}),n.installUrl&&window.open(n.installUrl);return}r(`source-control-namespace-selected`,{sourceControlNamespace:a.value,sourceControlProvider:i,account:e.name,project:t.name}),s(``),l(a),C.reset()},T=[];p?.forEach(e=>{T.push({label:e.name,value:i===`AZURE`?e.slug:e.installationId,icon:a.icon(20)})}),i===`GITHUB`&&T.push({label:`Add GitHub Account`,value:`add-github-account`,icon:(0,W.jsx)(Gm,{className:`mr-1.5`,size:16})});let E=()=>a.supportsProjects&&C.selectedProject?C.repositories.length>0?`Showing ${C.repositories.length} repositories from project: ${C.selectedProject.label}`:a.messages.grantAccess:!a.supportsProjects&&C.repositories.length>0?`Showing ${Math.min(C.repositories.length,5)} repositories`:a.supportsProjects&&!C.selectedProject?a.messages.selectAccount:`Select an account to view repositories`,D=()=>(0,W.jsx)(dZt,{installUrl:n.installUrl??``,selectedOrg:c?.label??``,projectName:t.name,provider:i,className:`w-full md:w-auto`}),O=m||C.isLoadingRepos,k=!a.supportsProjects||C.selectedProject;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(DR,{error:o}),(0,W.jsxs)(`div`,{className:`w-full flex items-center text-sm mt-2 gap-2 justify-center`,children:[(0,W.jsx)(`p`,{className:`flex-1 hidden md:block`,children:a.supportsProjects&&C.selectedProject?a.messages.noRepoInProject:a.messages.noRepoAtHand}),D()]}),O&&c===null&&(0,W.jsx)(uZt,{showHeader:!1}),!m&&(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(sZt,{testId:`namespace-selector`,placeholder:a.placeholder.namespace,options:T,selected:c,onChange:w,className:`flex-1 items-center h-9`,isLoadingData:h}),i===`AZURE`&&c&&(0,W.jsx)(lZt,{projects:C.projects,isLoadingProjects:C.isLoadingProjects||!1,selectedProject:C.selectedProject||null,onProjectChange:C.onProjectChange||(()=>{})}),(0,W.jsxs)(KJ,{className:`flex-2 w-full`,children:[(0,W.jsx)(JJ,{value:u,onChange:e=>d(e.target.value),placeholder:a.placeholder.search}),(0,W.jsx)(qJ,{align:`inline-start`,children:(0,W.jsx)(qm,{className:`opacity-75`})}),u&&(0,W.jsx)(qJ,{align:`inline-end`,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>d(``),children:(0,W.jsx)($m,{})})})]})]}),(0,W.jsx)(UB,{className:`flex flex-col`,children:C.isLoadingRepos&&k?(0,W.jsxs)(`div`,{className:`flex flex-row items-center p-2 justify-center align-middle h-80`,children:[(0,W.jsx)(gL,{className:`w-4 h-4 mr-2`,borderPositionAndSize:`border-l-2`}),(0,W.jsx)(`span`,{children:`Loading repositories...`})]}):k&&C.repositories.length>0?(0,W.jsx)(pZt,{repositories:C.repositories,account:e,project:t,selectedNamespace:c,provider:i,onConnectError:s}):k?(0,W.jsxs)(`div`,{className:`flex flex-col text-sm text-center gap-2 items-center justify-center h-80`,children:[(0,W.jsx)(`h2`,{className:`text-base`,children:`No Results Found`}),(0,W.jsx)(`p`,{children:u?`Your search for "${u}" did not return any results.`:a.messages.grantAccess})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-80`,children:(0,W.jsx)(`p`,{children:a.messages.selectAccount})})}),(0,W.jsxs)(`div`,{className:`flex whitespace-pre-line text-gray-500 text-sm justify-between gap-4`,children:[(0,W.jsx)(`span`,{children:E()}),(i===`GITHUB`||i===`GITLAB`||i===`BITBUCKET`)&&n.installUrl&&(0,W.jsxs)(rT,{href:n.installUrl,className:`whitespace-pre`,children:[`Adjust `,a.name,` Permissions →`]})]})]})},SZt=({provider:e,url:t,org:n,name:r,children:i})=>(0,W.jsx)(UB,{className:`flex gap-2 flex-col`,offset:`md`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(w7,{providerName:e}),(0,W.jsx)(`div`,{className:`flex flex-col flex-1`,children:(0,W.jsxs)(`a`,{className:`text-sm font-semibold hover:text-zuplo-pink-hover underline flex gap-1 items-center`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[n,`/`,r,(0,W.jsx)(Am,{className:`h-4 w-4`})]})}),i]})}),CZt=({account:e,project:t})=>{let{logEvent:n}=Rg(),r=oh([`account`,`project`]);if(!t.sourceRepoUrl)throw Error(`No sourceRepoUrl on project '${r.account.name}'`);let i=t.sourceRepoUrl.replace(`.git`,``),a,o,s=!1;try{s=new URL(t.sourceRepoUrl).hostname===`dev.azure.com`}catch{s=!1}if(s){let e=t.sourceRepoUrl.match(/^https:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)/);if(e){a=e[1];let t=e[2],n=e[3].replace(`.git`,``);a=`${e[1]}/${t}`,o=n}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}let c=hXt(e.name,t.name),l=async()=>{await c.mutateAsync(),n(`source-control-repo-disconnected`,{account:r.account.name,project:r.project.name})};return(0,W.jsx)(SZt,{org:a,name:o,url:i,provider:t.sourceControlProvider.toLowerCase(),children:(0,W.jsx)(Y,{"data-test":`disconnect-repo-button`,onClick:l,variant:`secondary`,className:`self-end`,disabled:c.isPending,children:(0,W.jsx)(Tk,{className:`flex items-center gap-1`,loading:c.isPending,children:`Disconnect`})})})},wZt=({provider:e,onClose:t})=>{if(!e)return null;let n=zj(e);return(0,W.jsx)(bA,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,W.jsxs)(CA,{children:[(0,W.jsxs)(wA,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(w7,{providerName:e.toLowerCase(),size:28}),(0,W.jsxs)(EA,{children:[n,` Integration`]})]}),(0,W.jsxs)(DA,{className:`pt-2`,children:[n,` source control integration is available on Enterprise plans. Contact our sales team or book a demo to learn more about connecting your `,n,` repositories to Zuplo.`]})]}),(0,W.jsxs)(TA,{className:`mt-2`,children:[(0,W.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,W.jsx)(rT,{href:`mailto:${ZS}?subject=${encodeURIComponent(`${n} Source Control Integration`)}`,variant:`ghost`,children:`Contact Sales`})}),(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsx)(rT,{href:XS,variant:`ghost`,children:`Book a Demo`})})]})]})})},TZt=`sourceControlConnect`,EZt=()=>{let{logEvent:e}=Rg(),t=g_(),[n,r]=(0,g.useState)(!1);return{connect:(n,i)=>{let{id:a,provider:o,clientId:s,scopes:c,redirectUri:l,providerUrl:u}=i;e(`source-control-provider-clicked`,{provider:o}),e(`source-control-connect-clicked`,{account:n,sourceControlProvider:o}),localStorage.removeItem(TZt),localStorage.setItem(TZt,`${n}::${a}`),r(!0);let d=i=>{i.key===`sourceControlConnect`&&i.oldValue===`${n}::${a}`&&i.newValue===null&&(e(`source-control-access-granted`,{account:n,sourceControlProvider:o}),r(!1),window.removeEventListener(`storage`,d),t.invalidateQueries({queryKey:[X.accountsSourceControlConfigurations().url],exact:!1}))};if(window.addEventListener(`storage`,d,!1),o===`GITHUB`){let e=c===``?`https://github.com/login/oauth/authorize?client_id=${s}`:`https://github.com/login/oauth/authorize?client_id=${s}&scope=${c}`;window.open(e)}o===`GITLAB`&&window.open(`${u}/oauth/authorize?client_id=${s}&redirect_uri=${l}&response_type=code&scope=${c}`),o===`BITBUCKET`&&window.open(`${u}/site/oauth2/authorize?client_id=${s}&response_type=code`),o===`AZURE`&&window.open(`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${s}&redirect_uri=${encodeURIComponent(l)}&response_type=code&response_mode=query&scope=${encodeURIComponent(c)}`)},isConnecting:n}},DZt=({accountName:e,sourceControlConfig:t})=>{let{connect:n,isConnecting:r}=EZt(),{provider:i}=t;return(0,W.jsx)(`div`,{children:(0,W.jsx)(Y,{variant:`outline`,className:`gap-2`,disabled:r,onClick:()=>n(e,t),children:(0,W.jsx)(Tk,{loading:r,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(w7,{providerName:i}),(0,W.jsx)(`span`,{children:`Connect to ${zj(i)}`})]})})})})},OZt=[{key:E7,label:`GitLab`},{key:O7,label:`Bitbucket`}],kZt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=Rg(),[i,a]=(0,g.useState)(null);if(n?.userHasCredentials&&t.sourceRepoUrl)return(0,W.jsx)(CZt,{account:e,project:t});if(n&&!t.sourceRepoUrl&&n.userHasCredentials)return(0,W.jsx)(xZt,{account:e,project:t,sourceControlConfig:n});let o=n?zj(n.provider):null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(UB,{offset:`md`,className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`div`,{className:`text-sm whitespace-pre-line text-gray-500`,children:[n&&t.sourceRepoUrl&&(0,W.jsxs)(`p`,{className:`mb-3`,children:[`This project is currently associated with a `,o,` `,`repository but you have not connected to your `,o,` `,`account.`]}),(0,W.jsx)(`p`,{children:`Connect to a source control provider to enable source control on your project.`})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,W.jsx)(DZt,{accountName:e.name,sourceControlConfig:n}),OZt.map(({key:e,label:t})=>(0,W.jsxs)(Y,{variant:`outline`,className:`gap-2`,onClick:()=>{r(`source-control-provider-clicked`,{provider:e}),a(e)},children:[(0,W.jsx)(w7,{providerName:e.toLowerCase(),size:20}),(0,W.jsxs)(`span`,{children:[`Connect to `,t]})]},e))]})]}),(0,W.jsx)(wZt,{provider:i,onClose:()=>a(null)})]})},AZt=()=>hj(X.accountsSourceControlConfigurations()),jZt=()=>{let{account:e,project:t}=oh([`account`,`project`]),{logEvent:n}=Rg();return(0,W.jsxs)(`div`,{className:`flex flex-col space-y-4`,children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Support`}),(0,W.jsx)(UB,{offset:`md`,className:`p-6`,children:(0,W.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,W.jsx)(sie,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(GB,{className:`text-base`,children:`Talk to an API expert`}),(0,W.jsx)(KB,{className:`text-md`,children:`Get a free technical consultation with one of our API experts.`})]}),(0,W.jsx)(Y,{onClick:()=>{n(`getting-started-book-a-meeting-clicked`,{account:e.name}),window.open(XS,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,W.jsxs)(rT,{href:XS,variant:`ghost`,children:[(0,W.jsx)(Ore,{}),`Book a Meeting`]})})]})}),(0,W.jsx)(UB,{offset:`md`,className:`p-6`,children:(0,W.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,W.jsx)(Vm,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(GB,{className:`text-base`,children:`Feeling Stuck?`}),(0,W.jsx)(KB,{className:`text-md`,children:`Check out our various support options to get help with your API`})]}),(0,W.jsx)(Y,{className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,W.jsxs)(Nr,{to:Ce(kR.Support,{account:e.name}),children:[(0,W.jsx)(Vm,{}),`Get Help`]})})]})}),(0,W.jsx)(UB,{offset:`md`,className:`p-6`,children:(0,W.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,W.jsx)(sie,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(GB,{className:`text-base`,children:`Join the Zuplo API Community`}),(0,W.jsx)(KB,{className:`text-md`,children:`Come chat with fellow Zuplo users and the Zuplo team in our Discord channel.`})]}),(0,W.jsx)(Y,{onClick:()=>{n(`getting-started-join-discord-clicked`,{account:e.name,project:t.name}),window.open(JS,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,W.jsxs)(rT,{href:JS,variant:`ghost`,children:[(0,W.jsx)(eie,{size:16}),`Join Us`]})})]})})]})},MZt=()=>{let{account:e,project:t,environment:n}=Tj([`account`,`project`,`environment`]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(WB,{children:[(0,W.jsx)(GB,{className:`text-base`,children:`Welcome to your Gateway`}),(0,W.jsx)(KB,{className:`text-base`,children:`You can get started by configuring your routes and setting up policies in our visual Route Designer.`})]}),(0,W.jsxs)(JB,{className:`border-0 gap-2 py-6`,children:[(0,W.jsx)(Y,{asChild:!0,size:`sm`,className:`gap-2 px-8`,variant:`brand-outline`,children:(0,W.jsxs)(Nr,{to:Ce(kR.Code,{account:e,project:t,environment:n}),children:[(0,W.jsx)(Em,{size:16}),`Start Building`]})}),(0,W.jsx)(Y,{className:`px-8`,variant:`secondary`,size:`sm`,asChild:!0,children:(0,W.jsxs)(rT,{variant:`ghost`,href:`https://zuplo.com/docs/articles/step-1-setup-basic-gateway`,children:[(0,W.jsx)(Nm,{size:16}),`Quickstart`]})})]})]})},NZt=()=>{let[e,t]=(0,g.useState)(!1);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(UB,{className:`col-span-full md:col-span-3 py-2 px-4 flex items-center text-sm gap-x-2`,children:[(0,W.jsx)(`div`,{className:`rounded-full w-4 h-4 p-0.5 bg-gray-500`,children:(0,W.jsx)(Tm,{className:`text-white`,size:12})}),(0,W.jsx)(`span`,{className:`font-semibold flex-1 line-clamp-1 break-all`,children:`Developer Portal`}),(0,W.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!0),children:[(0,W.jsx)(Nm,{}),`Open\xA0Portal`]})]}),(0,W.jsx)(bA,{open:e,onOpenChange:t,children:(0,W.jsxs)(CA,{children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Run Developer Portal Locally`}),(0,W.jsx)(DA,{children:`To view and edit your API documentation, you need to run the developer portal locally.`})]}),(0,W.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`p`,{className:`text-sm font-semibold`,children:`Steps to run the portal:`}),(0,W.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 text-sm text-gray-600`,children:[(0,W.jsxs)(`li`,{children:[`Open a terminal in the`,` `,(0,W.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`/docs`}),` `,`folder of your Zuplo project`]}),(0,W.jsxs)(`li`,{children:[`Run`,` `,(0,W.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`npm run dev`})]}),(0,W.jsx)(`li`,{children:`The portal will open in your browser automatically`})]})]}),(0,W.jsx)(`div`,{className:`bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800 rounded-md p-3`,children:(0,W.jsxs)(`p`,{className:`text-xs text-blue-800 dark:text-blue-200`,children:[(0,W.jsx)(`strong`,{children:`Tip:`}),` The developer portal will automatically reload when you make changes to your OpenAPI documentation.`]})})]}),(0,W.jsxs)(TA,{children:[(0,W.jsx)(Y,{variant:`secondary`,onClick:()=>t(!1),children:`Close`}),(0,W.jsx)(Y,{asChild:!0,variant:`outline`,children:(0,W.jsx)(rT,{href:`https://zuplo.com/docs/dev-portal`,children:`View Documentation`})})]})]})})]})},PZt=()=>{let{project:e,environment:t}=oh(),n=tO(t);return(0,W.jsx)(`div`,{className:`bg-neutral-50 dark:bg-neutral-950 h-full overflow-y-auto`,children:(0,W.jsxs)(`div`,{className:`pt-4 max-w-6xl pb-16 m-auto px-5 flex flex-col gap-4`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e.name}),(0,W.jsxs)(`div`,{className:`grid grid-cols-8 gap-3`,children:[(0,W.jsx)(ZXt,{title:`Gateway`,url:n}),(0,W.jsx)(NZt,{})]}),(0,W.jsxs)(UB,{className:`relative grid md:grid-cols-2 overflow-hidden min-h-[220px]`,children:[(0,W.jsx)(MZt,{}),(0,W.jsxs)(`div`,{className:`hidden md:block self-end h-full w-full`,children:[(0,W.jsx)(`img`,{src:qXt,alt:e.name,className:`w-full h-full object-cover object-left dark:hidden`}),(0,W.jsx)(`img`,{src:JXt,alt:``,"aria-hidden":!0,className:`hidden w-full h-full object-cover object-left dark:block`})]})]}),(0,W.jsx)(XXt,{mode:`local`}),(0,W.jsx)(jZt,{})]})})},FZt=()=>sP().brand,IZt=((e,...t)=>(...n)=>e(...t,...n))(hj,X.accounts()),LZt=e=>hj(X.accountMemberInvites(e),{extractData:!0}),RZt=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.accounts.deleteAccountMemberInvite(t))})},zZt=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.accounts.resendAccountMemberInvite(t))})},BZt=({account:e,navigateTo:t})=>{let{data:n,isLoading:r}=lXt(e),i=[...n??[]].sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()));return r?(0,W.jsx)(Y1,{heading:e,forceMount:!0,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,W.jsx)(Hm,{className:`h-4 w-4 animate-spin`}),(0,W.jsx)(`span`,{children:`Loading projects...`})]})}):(0,W.jsx)(Y1,{heading:e,children:i.map(n=>(0,W.jsxs)(X1,{value:`${e}/${n.name}`,keywords:[n.name,e],onSelect:()=>t(Ce(kR.Overview,{account:e,project:n.name})),children:[(0,W.jsx)(fm,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,W.jsx)(`span`,{children:n.name})]},n.id))})},VZt=({accounts:e,navigateTo:t})=>{let n=e?.map(e=>e.name)??[],r=uXt(n),i=(e??[]).map(e=>e.name).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())),a=n.flatMap((e,t)=>(r[t]?.data??[]).map(t=>({account:e,project:t}))).sort((e,t)=>e.project.name.toLowerCase().localeCompare(t.project.name.toLowerCase()));return(0,W.jsxs)(Y1,{children:[i.map(e=>(0,W.jsxs)(X1,{value:e,keywords:[e],onSelect:()=>t(Ce(kR.AccountProjects,{account:e})),children:[(0,W.jsx)(pm,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,W.jsx)(`span`,{className:`truncate`,children:e}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:`Account`})]},`account:${e}`)),a.map(({account:e,project:n})=>(0,W.jsxs)(X1,{value:`${e}/${n.name}`,keywords:[n.name,e],onSelect:()=>t(Ce(kR.Overview,{account:e,project:n.name})),children:[(0,W.jsx)(fm,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,W.jsx)(`span`,{className:`truncate`,children:n.name}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:e})]},n.id))]})},HZt=({accounts:e,navigateTo:t,search:n})=>n.trim()?(0,W.jsx)(VZt,{accounts:e,navigateTo:t}):(0,W.jsxs)(W.Fragment,{children:[e?.map(e=>(0,W.jsx)(BZt,{navigateTo:t,account:e.name},`projects-${e.name}`)),(0,W.jsx)(Y1,{heading:`Accounts`,children:e?.map(e=>(0,W.jsxs)(X1,{onSelect:()=>{t(Ce(kR.AccountProjects,{account:e.name}))},children:[(0,W.jsx)(pm,{className:`mr-2 h-4 w-4`}),(0,W.jsx)(`span`,{children:e.name})]},e.name))})]}),UZt=({account:e,navigateTo:t,project:n,environment:r})=>(0,W.jsx)(Y1,{heading:`Files`,children:ch(e=>e.projectTreeNodes).filter(e=>e.path&&e.type===Qr.File).map(i=>(0,W.jsxs)(X1,{onSelect:()=>t(Ce(`${kR.Code}?path=${i.path}`,{account:e,project:n,environment:r})),children:[(0,W.jsx)(`div`,{className:`mr-3`,children:(0,W.jsx)(Pm,{className:`h-4 w-4 text-neutral-500`})}),(0,W.jsx)(`span`,{className:`line-clamp-1`,children:i.path.substring(1)})]},i.path))}),WZt={zuplo:e=>(0,W.jsx)(`svg`,{viewBox:`0 0 308 308`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,W.jsxs)(`g`,{fillRule:`nonzero`,fill:`none`,children:[(0,W.jsx)(`path`,{d:`M0 0h308v308H0z`}),(0,W.jsx)(`path`,{d:`M214.523 182.007h-74.088l78.939-79.076a5.34 5.34 0 0 0-.807-8.204 5.314 5.314 0 0 0-2.957-.899H90.239V41.364h137.515a53.31 53.31 0 0 1 28.617 7.922 53.444 53.444 0 0 1 19.967 22.011 52.117 52.117 0 0 1 4.221 31.194 52.062 52.062 0 0 1-14.508 27.924l-51.528 51.592Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M90.24 119.097h74.092l-78.781 78.917a5.431 5.431 0 0 0-1.172 5.912 5.423 5.423 0 0 0 5.001 3.351h125.017v52.464H77.016a53.322 53.322 0 0 1-28.616-7.923 53.453 53.453 0 0 1-19.968-22.011 52.109 52.109 0 0 1-4.219-31.194 52.059 52.059 0 0 1 14.51-27.924l51.517-51.592Z`,fill:`currentColor`})]})}),akamai:e=>(0,W.jsxs)(`svg`,{viewBox:`344.42 285.18 451 489.75`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,...e,children:[(0,W.jsx)(`path`,{d:`M592.85,764.11c-100.8-30.77-174.12-123.92-174.12-234.05s74.88-205.29,177.4-235.02c10.48-3.06,7.73-9.86-4.91-9.86-136.28,0-246.8,109.69-246.8,244.89s110.51,244.86,246.8,244.86c12.63,0,13.14-7.3,1.63-10.81Z`}),(0,W.jsx)(`path`,{d:`M465.48,587.42c-.68-6.58-1.01-13.23-1.01-19.94,0-107.36,87.05-194.39,194.43-194.39,101.52,0,132,45.31,135.78,42.35,4.12-3.26-36.84-93.07-156.05-93.07-107.39,0-194.44,87.03-194.44,194.39,0,24.84,4.65,48.52,13.13,70.31,3.58,9.14,9.08,9.22,8.17.35Z`}),(0,W.jsx)(`path`,{d:`M546.92,447.31c50.53-22.03,114.01-22.7,176.42-.89,41.91,14.62,66.2,35.5,68.19,34.64,3.31-1.43-24.38-45.28-74.36-64.24-60.51-22.93-125.69-10.93-173.18,26.32-5.22,4.11-3.25,6.87,2.93,4.17Z`})]})},GZt=({variant:e=`full`,className:t,width:n,height:r})=>{let i=FZt();if(e===`mark`){let e=WZt[i.id];return(0,W.jsx)(e,{className:t,width:n,height:r,role:`img`,"aria-label":i.logoAlt})}return e===`full`&&i.logoDark?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`img`,{src:i.logo,alt:i.logoAlt,className:G(t,`dark:hidden`),width:n,height:r}),(0,W.jsx)(`img`,{src:i.logoDark,alt:i.logoAlt,className:G(t,`hidden dark:inline`),width:n,height:r})]}):(0,W.jsx)(`img`,{src:e===`white`?i.logoWhite:i.logo,alt:i.logoAlt,className:G(t),width:n,height:r})},KZt=({children:e,className:t})=>(0,W.jsxs)(`div`,{className:G(`relative grid grid-cols-1 gap-y-8 p-10`,t),children:[(0,W.jsx)(`div`,{className:`w-full flex items-center justify-center text-red-400`,children:(0,W.jsx)(GZt,{variant:`mark`,className:`self-center text-neutral-100 dark:text-neutral-800 w-72`})}),e]}),qZt=({children:e})=>(0,W.jsx)(`div`,{className:`flex justify-center gap-4`,children:e}),JZt=({children:e})=>(0,W.jsx)(`h2`,{className:`text-2xl font-medium text-center mt-2`,children:e}),YZt=({children:e})=>(0,W.jsx)(`div`,{className:`flex flex-col items-center text-center gap-4 max-w-md mx-auto relative`,children:e});function XZt(e){let{account:t,project:n}=Tj([`account`,`project`]),r=mj(X.project(t,n),{extractData:!1}).data.defaultConfiguration.find(e=>e.environmentType===MA.PRODUCTION)?.apiKeyBucket??void 0;if(!r&&!e?.optional)throw Error(`No production bucket found`);return r}var ZZt=e=>!!e&&e.replace(/[^a-z]/gi,``).toLowerCase()===`xai`,QZt=({className:e})=>(0,W.jsx)(`img`,{src:`/xai-elon.png`,alt:``,"aria-hidden":!0,className:G(`size-12 shrink-0 object-contain`,e)}),$Zt=({provider:e,children:t,iconClassName:n})=>ZZt(e)?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,W.jsx)(QZt,{className:n}),(0,W.jsx)(`span`,{children:t})]}):t,eQt=()=>{let e=XZt();return mj(X.supportedAiProviders(e),{extractData:!1})},j7=`__custom`;function tQt({form:e,mode:t,providerDisabled:n}){let{data:r,providers:i}=eQt().data,a=e.watch(`provider`),o=Object.keys(r).filter(e=>!i[e]?.isCustom);(0,g.useEffect)(()=>{let t=i[a]?.isCustom;e.setValue(`customProviderName`,t?a:void 0)},[a,i,e]);let s=a===j7;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(xG,{control:e.control,name:`provider`,render:({field:t})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`AI Provider`}),(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsxs)(iW,{onValueChange:t.onChange,value:t.value,disabled:n,children:[(0,W.jsx)(TG,{children:(0,W.jsx)(oW,{className:`w-full data-[size=default]:h-auto min-h-9`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(aW,{placeholder:`Choose AI provider…`}),e.watch(`customProviderName`)&&(0,W.jsx)(PS,{variant:`invert`,children:`custom`})]})})}),(0,W.jsxs)(sW,{className:`max-h-[325px] overflow-y-auto`,children:[o.length>0&&(0,W.jsxs)(l5e,{children:[(0,W.jsx)(u5e,{children:`Default Providers`}),o.map(e=>(0,W.jsx)(cW,{value:e,children:(0,W.jsx)($Zt,{provider:i[e]?.label??e,children:i[e]?.label||e})},e))]}),(0,W.jsxs)(l5e,{children:[(0,W.jsx)(u5e,{children:`Custom Providers`}),(0,W.jsx)(cW,{value:j7,children:`Custom`})]})]})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`label`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`Provider Label`}),(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:`e.g, Production OpenAI, Development Claude.`,...e})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`baseUrl`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`API URL`}),(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:s?`https://api.example.com`:`${i[a]?.baseUrl} `,...e,disabled:!s})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`apiKey`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`API Key`}),(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:t===`edit`?`Leave blank to keep existing API key`:`Enter your API Key for this provider`,type:`password`,...e})}),(0,W.jsx)(EG,{})]})}),s?(0,W.jsx)(nQt,{}):(0,W.jsx)(rQt,{modelsData:r,provider:a})]})}var nQt=()=>{let e=zW(),{fields:t,append:n,remove:r}=Q7e({control:e.control,name:`customModels`});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Available Models`}),(0,W.jsx)(Y,{variant:`outline`,onClick:()=>{n({name:``,status:`active`,kind:`completions`,inputCostPerToken:0,outputCostPerToken:0})},children:`Add Model`})]}),(0,W.jsx)(xG,{name:`customModels`,control:e.control,render:()=>(0,W.jsx)(EG,{className:`mb-1`})}),(0,W.jsxs)(`div`,{className:G(`border rounded-md h-52 overflow-y-auto`,e.formState.errors.customModels&&`border-destructive`),children:[t.length===0&&(0,W.jsxs)(Jht,{children:[(0,W.jsx)(Zht,{children:`No models added yet`}),(0,W.jsx)(Qht,{children:`Add a model to get started.`})]}),t.length>0&&(0,W.jsxs)(`div`,{className:`grid grid-cols-[1fr_max-content_110px_110px_auto] gap-2 p-4 items-start`,children:[(0,W.jsx)(pW,{children:`Model Name`}),(0,W.jsx)(pW,{children:`Type`}),(0,W.jsx)(pW,{children:`Input Cost`}),(0,W.jsx)(pW,{children:`Output Cost`}),t.map((t,n)=>(0,W.jsxs)(`div`,{className:`grid grid-cols-subgrid col-span-full items-start gap-2`,children:[(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.name`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:`Model Name`,...e})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.kind`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(TG,{children:(0,W.jsxs)(iW,{defaultValue:`completions`,onValueChange:e.onChange,value:e.value,children:[(0,W.jsx)(oW,{className:`mb-0`,children:(0,W.jsx)(aW,{placeholder:`Select Model Type`})}),(0,W.jsxs)(sW,{children:[(0,W.jsx)(cW,{value:`completions`,children:`Completion`}),(0,W.jsx)(cW,{value:`embeddings`,children:`Embedding`})]})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.inputCostPerToken`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(TG,{children:(0,W.jsxs)(KJ,{children:[(0,W.jsx)(JJ,{type:`number`,step:`any`,min:0,hideNumberArrows:!0,selectOnFocus:!0,...e,onChange:t=>e.onChange(parseFloat(t.target.value)||0)}),(0,W.jsx)(qJ,{align:`inline-start`,children:`$`}),(0,W.jsx)(qJ,{align:`inline-end`,children:(0,W.jsxs)(yk,{children:[(0,W.jsx)(bk,{asChild:!0,children:(0,W.jsx)(zm,{className:`cursor-pointer`})}),(0,W.jsx)(xk,{children:`Cost per token`})]})})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.outputCostPerToken`,render:({field:e})=>(0,W.jsxs)(CG,{className:`item-start`,children:[(0,W.jsx)(TG,{children:(0,W.jsxs)(KJ,{children:[(0,W.jsx)(JJ,{type:`number`,step:`any`,min:0,hideNumberArrows:!0,selectOnFocus:!0,...e,onChange:t=>e.onChange(Number(t.target.value)||0)}),(0,W.jsx)(qJ,{align:`inline-start`,children:`$`}),(0,W.jsx)(qJ,{align:`inline-end`,children:(0,W.jsxs)(yk,{children:[(0,W.jsx)(bk,{asChild:!0,children:(0,W.jsx)(zm,{className:`cursor-pointer`})}),(0,W.jsx)(xk,{children:`Cost per token`})]})})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(`div`,{className:`flex justify-center items-center size-full max-h-9`,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>{r(n)},children:(0,W.jsx)($m,{className:`h-4 w-4`})})})]},t.id))]})]})]})},rQt=({modelsData:e,provider:t})=>{let n=zW(),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`all`),s=mX(r,e[t]?.filter(({kind:e})=>a===`all`?!0:e===a)??[],{getText:({model:e,kind:t})=>[e,t]}),c=n.watch(`models`);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mt-2`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Available Models`}),(0,W.jsx)(Y,{type:`button`,variant:`link`,onClick:()=>{n.setValue(`models`,{completions:e[t]?.filter(({kind:e})=>e===`completions`).map(({model:e})=>e),embeddings:e[t]?.filter(({kind:e})=>e===`embeddings`).map(({model:e})=>e)})},children:`Select All`})]}),(0,W.jsxs)(`div`,{className:`flex justify-stretch gap-2`,children:[(0,W.jsx)(fV,{onClearValue:()=>i(``),className:`w-8/12`,showClearButton:r.length>0,children:(0,W.jsx)(dV,{placeholder:`Search Models`,className:`px-8`,value:r,onChange:e=>i(e.target.value)})}),(0,W.jsxs)(iW,{onValueChange:e=>{o(e)},children:[(0,W.jsx)(oW,{className:`w-4/12`,children:(0,W.jsx)(aW,{placeholder:`All Types`})}),(0,W.jsxs)(sW,{children:[(0,W.jsx)(cW,{value:`all`,children:`All Types`}),(0,W.jsx)(cW,{value:`completions`,children:`Chat`}),(0,W.jsx)(cW,{value:`embeddings`,children:`Embeddings`})]})]})]}),(0,W.jsx)(`div`,{className:`border rounded-md p-4 space-y-2 overflow-y-auto h-40`,children:s?.map(({kind:e,model:t})=>(0,W.jsxs)(`label`,{className:`grid grid-cols-[min-content_1fr_max-content] items-center gap-2`,children:[(0,W.jsx)(uV,{checked:c?.[e]?.includes(t),onCheckedChange:r=>{n.setValue(`models`,{...c,[e]:r?[...c?.[e]??[],t]:(c?.[e]??[]).filter(e=>e!==t)})}}),(0,W.jsx)(`div`,{className:`ml-2`,children:t}),(0,W.jsx)(PS,{variant:`outline`,children:e===`completions`?`Chat`:`Embeddings`})]},t))})]})},iQt=Mv({provider:Ov().min(1,`Provider is required`),customProviderName:Ov().optional(),label:Ov().min(1,`Label is required`),apiKey:Ov().optional(),envVarName:Ov().optional(),baseUrl:Ov().url(`Must be a valid URL`).optional(),customModels:jv(Mv({name:Ov().min(1,`Model name is required`),kind:Pv([`completions`,`embeddings`]),inputCostPerToken:kv().min(0,`Cost must be non-negative`),outputCostPerToken:kv().min(0,`Cost must be non-negative`),status:Pv([`active`,`deprecated`])})).optional(),models:Mv({completions:jv(Ov()).optional(),embeddings:jv(Ov()).optional()}).optional()}).refine(e=>e.provider!==`__custom`||(e.baseUrl?.length??0)>0,{message:`API URL is required for custom providers`,path:[`baseUrl`]}).refine(e=>e.provider!==`__custom`||(e.customModels?.length??0)>0,{message:`Models are required for custom providers`,path:[`customModels`]}),aQt=d6e(`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,6),oQt=({children:e,onOpenChange:t})=>{let[n,r]=(0,g.useState)(!1),i=XZt(),a=fj(),{account:o,project:s}=Tj([`account`,`project`]),{logEvent:c}=Rg(),l=S_({mutationFn:async e=>{let t=e.provider===j7,n=f6e();if(t){let t=await a.fetch(dj.ai.createBucketAiProvider(i,{name:n,baseURL:e.baseUrl??``,label:e.label??``}));for(let n of e.customModels??[])await a.fetch(dj.ai.createAiProviderModel(i,t.id,{model:n.name,kind:n.kind,inputCostPerToken:n.inputCostPerToken,outputCostPerToken:n.outputCostPerToken,status:`active`}))}return await a.fetch(dj.ai.createAiProviderAssignment(o,s,{provider:t?`Custom`:e.provider,customProviderName:t?n:void 0,label:e.label,envVarName:`API_KEY_${SU(e.label.toLocaleUpperCase(),{lowercase:!1,separator:`_`})}_${aQt()}`,value:e.apiKey,metadata:{models:e.customModels?{completions:e.customModels.filter(e=>e.kind===`completions`).map(e=>e.name),embeddings:e.customModels.filter(e=>e.kind===`embeddings`).map(e=>e.name)}:{completions:e.models?.completions??[],embeddings:e.models?.embeddings??[]}}}))},onSuccess:()=>{u.reset(),r(!1)}}),u=vG({defaultValues:{provider:`OpenAI`,customProviderName:void 0,label:``,apiKey:``,models:{completions:[],embeddings:[]}},resolver:yG(iQt)}),{isDirty:d}=HW(u),f=cX(d,(0,g.useCallback)(()=>{l.reset(),u.reset(),t?.(!1),r(!1)},[l,u,t]));return(0,W.jsxs)(bA,{open:n,onOpenChange:e=>{e?(t?.(!0),r(!0)):f.guardedClose()},children:[(0,W.jsx)(xA,{asChild:!0,children:e??(0,W.jsx)(Y,{children:`Add Provider`})}),(0,W.jsxs)(CA,{className:`sm:max-w-2xl max-h-[90vh] flex flex-col`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Add AI Provider`}),(0,W.jsx)(DA,{children:`Configure a new AI provider with your API key and select available models.`}),(0,W.jsx)(DR,{error:l.error,className:`break-all`})]}),(0,W.jsx)(bG,{...u,children:(0,W.jsxs)(`form`,{onSubmit:u.handleSubmit(e=>{c(`ai-gateway-create-ai-provider-submitted`,{provider:e.provider}),l.mutate(e)}),className:`flex flex-col flex-1 overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto space-y-4 px-1`,children:(0,W.jsx)(tQt,{form:u,mode:`create`})}),(0,W.jsxs)(TA,{className:`mt-4`,children:[(0,W.jsx)(Y,{type:`button`,variant:`ghost`,onClick:()=>r(!1),disabled:l.isPending,children:`Cancel`}),(0,W.jsx)(Y,{type:`submit`,children:(0,W.jsxs)(Tk,{loading:l.isPending,children:[`Create`,(0,W.jsx)(DQ,{className:`bg-white/20`,children:(0,W.jsx)(EQ,{onPress:u.handleSubmit(e=>l.mutate(e)),hotkey:`meta+Enter`})})]})})]})]})})]}),(0,W.jsx)(sX,{open:f.showConfirm,onOpenChange:f.setShowConfirm,onDiscard:f.handleDiscard})]})};function sQt({assignment:e,children:t,onOpenChange:n}){let[r,i]=(0,g.useState)(!1),a=fj(),{account:o,project:s}=Tj([`account`,`project`]),c=(0,g.useMemo)(()=>{try{return JSON.parse(e.metadata)}catch{return{}}},[e.metadata]),l=vG({defaultValues:{provider:e.provider===`Custom`?e.customProviderName:e.provider,customProviderName:e.customProviderName,label:e.label,apiKey:``,envVarName:e.envVarName,models:{completions:c.models?.completions??[],embeddings:c.models?.embeddings??[]}}}),{isDirty:u}=HW(l),d=S_({mutationFn:async t=>await a.fetch(dj.ai.updateAiProviderAssignment(o,s,e.id,{label:t.label,envVarName:t.envVarName,...t.apiKey?{value:t.apiKey}:{},metadata:{models:{completions:t.models?.completions??[],embeddings:t.models?.embeddings??[]}}})),onSuccess:()=>{l.reset(l.getValues()),i(!1)}}),f=cX(u,(0,g.useCallback)(()=>{d.reset(),l.reset(),n?.(!1),i(!1)},[l,n,d.reset]));return(0,W.jsxs)(bA,{open:r,onOpenChange:e=>{e?(n?.(!0),i(!0)):f.guardedClose()},children:[(0,W.jsx)(xA,{asChild:!0,children:t}),(0,W.jsxs)(CA,{className:`sm:max-w-xl max-h-[90vh] overflow-y-auto flex flex-col`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Edit AI Provider`}),(0,W.jsx)(DA,{children:`Update label, API key secret name/value, and allowed models.`}),(0,W.jsx)(DR,{error:d.error,className:`break-all`})]}),(0,W.jsx)(bG,{...l,children:(0,W.jsxs)(`form`,{onSubmit:l.handleSubmit(e=>d.mutate(e)),className:`flex flex-col flex-1 overflow-auto`,children:[(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-1 space-y-4`,children:(0,W.jsx)(tQt,{form:l,mode:`edit`,providerDisabled:!0})}),(0,W.jsxs)(TA,{className:`mt-4`,children:[(0,W.jsx)(Y,{type:`button`,variant:`ghost`,onClick:()=>i(!1),disabled:l.formState.isSubmitting,children:`Cancel`}),(0,W.jsx)(Y,{type:`submit`,disabled:!l.formState.isValid,children:(0,W.jsx)(Tk,{loading:d.isPending,children:`Save`})})]})]})})]}),(0,W.jsx)(sX,{open:f.showConfirm,onOpenChange:f.setShowConfirm,onDiscard:f.handleDiscard})]})}var cQt=()=>{let{account:e,project:t}=Tj([`account`,`project`]),n=mj(X.aiProviderAssignments(e,t)),r=fj(),i=S_({mutationFn:async n=>r.fetch(dj.ai.deleteAiProviderAssignment(e,t,n))}),a=(0,g.useMemo)(()=>n.data.map(e=>{let t=JSON.parse(e.metadata);return[...t.models?.completions??[],...t.models?.embeddings??[]]}),[n.data]);return(0,W.jsxs)(`div`,{className:`space-y-8`,children:[n.data.length>0&&(0,W.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-medium`,children:`AI Providers`}),(0,W.jsx)(`div`,{className:`flex gap-2`,children:(0,W.jsx)(oQt,{})})]}),(0,W.jsx)(DR,{error:i.error}),n.data.map((e,t)=>(0,W.jsxs)(UB,{children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 p-5`,children:[(0,W.jsxs)(`div`,{className:`flex gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:e.label}),(0,W.jsx)(PS,{variant:`outline`,size:`lg`,children:e.provider})]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(sQt,{assignment:e,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon`,className:`text-xs`,children:(0,W.jsx)(Wm,{size:16})})}),(0,W.jsx)(qKe,{onConfirm:()=>i.mutate(e.id),description:`Are you sure you want to delete this data model?`,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon`,className:`text-xs`,children:(0,W.jsx)(Zm,{size:16})})})]})]}),(0,W.jsx)(`div`,{className:`border-t`}),(0,W.jsxs)(`div`,{className:`flex items-baseline p-5 gap-4 text-sm`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:`Models`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:a[t].map(e=>(0,W.jsx)(PS,{size:`lg`,children:e},e))})]})]},e.id)),n.data.length===0&&(0,W.jsxs)(KZt,{className:`p-0`,children:[(0,W.jsxs)(YZt,{children:[(0,W.jsx)(JZt,{children:`Let's add some AI providers`}),`Teams allow you to create custom quotas and budgets for different operations. As a admin you can also be part of different teams.`]}),(0,W.jsx)(qZt,{children:(0,W.jsx)(oQt,{})})]})]})},lQt=()=>(0,W.jsx)(g.Suspense,{fallback:(0,W.jsx)(YB,{}),children:(0,W.jsx)(cQt,{})}),uQt=e=>e.plan===`FREE_V1`,dQt=({account:e,className:t,source:n})=>{let r=e.customDomainsInUse,i=e.entitlements.customDomains,a=uQt(e),o=`${Ce(kR.AccountSettings,{account:e.name})}/upgrade-billing?source=${n}`;return(0,W.jsxs)(UB,{variant:`default`,className:t,children:[(0,W.jsx)(WB,{children:a?`Custom domains require a paid plan`:`Custom domain limit reached`}),(0,W.jsx)(qB,{className:`text-sm leading-relaxed`,children:a?(0,W.jsx)(`p`,{children:`Custom domains let you serve your APIs and developer portal from your own domain. Upgrade to the Builder plan to add custom domains to your account.`}):(0,W.jsxs)(`p`,{children:[`Your account is using`,` `,(0,W.jsxs)(`span`,{className:`font-medium`,children:[r,` of `,i]}),` `,`custom domains. Contact our team to increase your limit.`]})}),(0,W.jsxs)(JB,{className:`flex flex-wrap items-center gap-2`,children:[a?(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsx)(bX,{variant:`ghost`,to:o,children:`Upgrade to Builder`})}):(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsx)(rT,{href:XS,variant:`ghost`,children:`Contact Sales`})}),(0,W.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,W.jsx)(rT,{href:`https://zuplo.com/pricing?utm_source=pzc`,variant:`ghost`,children:`View Plans`})})]})]})},fQt=({used:e,max:t,label:n,account:r,navigationSource:i,className:a,hideAtLimit:o=!1})=>{if(t<=0)return null;let s=e>=t,c=r.plan.startsWith(`FREE`),l=`${Ce(kR.AccountSettings,{account:r.name})}/upgrade-billing${i?`?source=${i}`:``}`;return s?o?null:(0,W.jsxs)(jS,{variant:`warning`,className:a,children:[(0,W.jsx)(Qm,{}),(0,W.jsx)(NS,{children:(0,W.jsxs)(`p`,{children:[`You've reached the limit of `,t,` `,n,` on your plan (`,e,` of`,` `,t,` used).`,` `,c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(bX,{to:l,className:`hover:text-zuplo-pink-hover text-zuplo-pink underline`,children:`Upgrade your plan`}),` `,`to add more.`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(rT,{href:`mailto:${ZS}`,className:`text-zuplo-pink hover:text-zuplo-pink-hover underline`,children:`Contact sales`}),` `,`to increase your limit.`]})]})})]}):(0,W.jsxs)(`p`,{className:G(`text-sm text-muted-foreground`,a),children:[`Using `,e,` of `,t,` `,n,`.`]})},pQt=({className:e})=>(0,W.jsxs)(UB,{variant:`info`,className:e,children:[(0,W.jsx)(WB,{children:`Managed Dedicated Project`}),(0,W.jsx)(qB,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,W.jsxs)(`p`,{className:`leading-loose`,children:[`This project uses Akamai managed dedicated hosting. Custom domains for Akamai must be configured through Akamai CDN. See`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`.`]})})]}),mQt={[MA.PRODUCTION]:`bg-amber-50 text-amber-800 ring-amber-200 dark:bg-amber-900/30 dark:text-amber-200 dark:ring-amber-800/60`,[MA.PREVIEW]:`bg-blue-50 text-blue-700 ring-blue-200 dark:bg-blue-900/30 dark:text-blue-200 dark:ring-blue-800/60`,[MA.WORKING_COPY]:`bg-muted text-muted-foreground ring-border`},hQt=({environmentType:e,className:t})=>{if(!e)return null;let n=e,r=mQt[n];return r?(0,W.jsx)(`span`,{className:G(`inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-medium tracking-wide ring-1 ring-inset`,r,t),children:Z1(n)}):null},gQt=[MA.WORKING_COPY,MA.PRODUCTION,MA.PREVIEW],M7=({environments:e,value:t,onValueChange:n,disabled:r,placeholder:i=`Select an environment`,getOptionValue:a=e=>e.name,sentinel:o,className:s,triggerClassName:c,triggerSize:l=`default`,modal:u=!1,showTriggerBadge:d=!0,id:f,...p})=>{let[m,h]=g.useState(!1),_=g.useMemo(()=>{let t=new Map;for(let n of e){if(!n.environmentType)continue;let e=n.environmentType,r=t.get(e)??[];r.push(n),t.set(e,r)}return gQt.flatMap(e=>{let n=t.get(e);return n&&n.length>0?[{type:e,envs:n}]:[]})},[e]),v=g.useMemo(()=>e.find(e=>a(e)===t),[e,t,a]),y=o!=null&&o.value===t,b=()=>y?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(dm,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:`truncate text-sm`,children:o?.label})]}):v?(0,W.jsx)(_Qt,{env:v,showBadge:d}):(0,W.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:i});return(0,W.jsxs)(EX,{open:m,onOpenChange:h,modal:u,children:[(0,W.jsx)(DX,{asChild:!0,children:(0,W.jsxs)(Y,{id:f,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":m,disabled:r,size:l,className:G(`border-input font-normal w-full justify-between`,c),"data-test":p[`data-test`],children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:b()}),(0,W.jsx)(hm,{className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,W.jsx)(OX,{className:G(`min-w-[320px] w-(--radix-popover-trigger-width) max-w-[480px] p-0 rounded-md shadow-md`,s),side:`bottom`,align:`start`,children:(0,W.jsxs)(G1,{filter:(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase().trim();return!r||n.startsWith(`__sentinel__`)||n.includes(r)?1:0},children:[(0,W.jsx)(K1,{placeholder:`Search environments...`,className:`h-10`}),(0,W.jsxs)(q1,{className:`max-h-[360px]`,children:[(0,W.jsx)(J1,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No environments match.`}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Y1,{children:(0,W.jsxs)(X1,{value:`__sentinel__ ${o.label}`,onSelect:()=>{n(o.value),h(!1)},className:`flex items-center gap-2.5 px-2.5 py-2 cursor-pointer data-[selected=true]:bg-accent`,children:[(0,W.jsx)(dm,{className:G(`size-3.5 shrink-0`,t===o.value?`text-foreground`:`text-muted-foreground`)}),(0,W.jsx)(`span`,{className:G(`flex-1 truncate text-sm`,t===o.value&&`font-medium`),children:o.label}),(0,W.jsx)(mm,{className:G(`size-4 shrink-0 text-muted-foreground`,t===o.value?`opacity-100`:`opacity-0`)})]})}),_.length>0&&(0,W.jsx)(hDt,{})]}),_.map(({type:e,envs:r})=>(0,W.jsx)(Y1,{heading:Z1(e),children:r.map(e=>{let r=a(e);return(0,W.jsx)(vQt,{env:e,isSelected:!y&&r===t,onPick:()=>{n(r),h(!1)}},e.name)})},e))]})]})})]})},_Qt=({env:e,showBadge:t})=>{let n=e.environmentType,r=n===MA.WORKING_COPY,i=r?BR:Im,a=r?`working copy`:e.branchName??e.label;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:G(`truncate min-w-0 flex-1 text-sm text-left`,r?``:`font-mono`),children:a}),t&&(0,W.jsx)(hQt,{environmentType:n,className:`ml-1`})]})},vQt=({env:e,isSelected:t,onPick:n})=>{let r=e.environmentType===MA.WORKING_COPY,i=r?BR:Im,a=r?`working copy`:e.branchName??e.label;return(0,W.jsxs)(X1,{value:[e.branchName,e.name,e.label,Z1(e.environmentType)].filter(Boolean).join(` `),onSelect:n,className:`flex items-center gap-2.5 px-2.5 py-2 cursor-pointer data-[selected=true]:bg-accent`,children:[(0,W.jsx)(i,{strokeWidth:1.5,className:G(`size-3.5 shrink-0`,t?`text-foreground`:`text-muted-foreground`)}),(0,W.jsx)(`span`,{className:G(`flex-1 min-w-0 truncate text-sm`,r?``:`font-mono`,t&&`font-medium`),children:a}),(0,W.jsx)(mm,{className:G(`size-4 shrink-0 text-muted-foreground`,t?`opacity-100`:`opacity-0`)})]})},N7=`Switch`,[yQt,bQt]=pp(N7),[xQt,SQt]=yQt(N7),CQt=g.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=g.useState(null),m=fp(t,e=>p(e)),h=g.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=Ap({prop:i,defaultProp:a??!1,onChange:l,caller:N7});return(0,W.jsxs)(xQt,{scope:n,checked:v,disabled:s,children:[(0,W.jsx)(Tp.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":OQt(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:up(e.onClick,e=>{y(e=>!e),_&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),_&&(0,W.jsx)(DQt,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});CQt.displayName=N7;var wQt=`SwitchThumb`,TQt=g.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=SQt(wQt,n);return(0,W.jsx)(Tp.span,{"data-state":OQt(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});TQt.displayName=wQt;var EQt=`SwitchBubbleInput`,DQt=g.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=g.useRef(null),s=fp(o,a),c=sV(n),l=YC(t);return g.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,W.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});DQt.displayName=EQt;function OQt(e){return e?`checked`:`unchecked`}var kQt=CQt,AQt=TQt;function jQt({className:e,...t}){return(0,W.jsx)(kQt,{"data-slot":`switch`,className:G(`peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,W.jsx)(AQt,{"data-slot":`switch-thumb`,className:G(`bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var P7=({customDomain:e,cname:t,documentationUrl:n=`https://www.zuplo.com/docs/guides/custom-domain-setup`})=>(0,W.jsxs)(`div`,{className:`text-left text-sm text-gray-800 whitespace-pre-line w-full mb-2`,children:[(0,W.jsx)(`p`,{children:`We've set things up on our end, now you need to configure your DNS with a new entry.`}),(0,W.jsx)(`br`,{}),(0,W.jsx)(UB,{variant:`muted`,className:`font-mono p-4 text-sm`,children:(0,W.jsxs)(`ol`,{children:[(0,W.jsx)(`li`,{className:`leading-6`,children:`Type: CNAME`}),(0,W.jsxs)(`li`,{className:`leading-6`,children:[`Name: `,e,` `,(0,W.jsx)(_Q,{textToCopy:e??``})]}),(0,W.jsxs)(`li`,{className:`leading-6`,children:[`Value: `,t,` `,(0,W.jsx)(_Q,{textToCopy:t??``})]}),(0,W.jsx)(`li`,{className:`leading-6`,children:`TTL: 60s or auto`})]})}),(0,W.jsx)(`br`,{}),(0,W.jsx)(`p`,{children:`Note that it does sometimes take a few hours for records to propagate and for the SSL certificate to be created.`}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`p`,{children:[`For more information see our`,` `,(0,W.jsx)(rT,{href:n,children:`documentation on custom domains`}),`.`]})]});function MQt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>!!e.managedDedicatedConfiguration)}function NQt({stage:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n,formIsAlias:r}){return e===`dev-portal`?!1:n?!0:t?!1:r??!1}function PQt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>e.managedDedicatedConfiguration?.vendor===`akamai`)}var F7=()=>(0,W.jsxs)(`div`,{className:`text-left text-sm text-gray-800 whitespace-pre-line w-full mb-2`,children:[(0,W.jsx)(`p`,{children:`This custom domain is setup with an advanced configuration. In order to make changes to this domain, please contact support.`}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`p`,{children:[`For more information see our`,` `,(0,W.jsx)(rT,{href:`https://www.zuplo.com/docs/guides/custom-domain-setup`,children:`documentation on custom domains`}),`.`]})]}),FQt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,IQt=`https://zuplo.com/docs/dedicated/custom-domains`,LQt=Mv({hostname:Ov().regex(FQt,`Please enter a valid domain name (e.g. api.example.com)`),environment:Ov().min(1),stage:Pv([`api`,`dev-portal`]),isAlias:Av().optional()}),RQt=({account:e,projectName:t,disabled:n=!1,isManagedDedicatedProject:r=!1,isAkamaiManagedDedicatedProject:i=!1})=>{let a=vG({resolver:yG(LQt),defaultValues:{hostname:``,environment:``,stage:`api`,isAlias:i}}),[o,s]=(0,g.useState)(!1),[c,l]=a.watch([`isAlias`,`stage`]),{data:u}=Uj(e.name,t),{aliasDomains:d}=e.entitlements,{data:f}=lXt(e.name),p=f?.find(e=>e.name===t),m=p?vOt(new Date(Number(p.createdOn)),new Date(`2025-04-01`)):!1,h=u?u.filter(e=>e.environmentType!==MA.WORKING_COPY):[],_=nZt({onSuccess:()=>{c&&s(!1)}}),v=(0,g.useCallback)(()=>{a.reset(),_.isSuccess&&_.reset(),s(!1)},[a,_]),y=cX(a.formState.isDirty&&!_.isSuccess,v);return(0,W.jsxs)(bA,{open:o,onOpenChange:e=>{e?s(!0):y.guardedClose()},children:[(0,W.jsx)(xA,{asChild:!0,children:(0,W.jsx)(Y,{"data-test":`create-custom-domain-modal-btn`,disabled:n,title:n?`You reached the limit of custom domains`:``,children:`Add Custom Domain`})}),(0,W.jsxs)(CA,{children:[(0,W.jsx)(wA,{children:(0,W.jsx)(EA,{children:`Add Custom Domain`})}),(0,W.jsx)(`div`,{className:`space-y-4`,children:_.isSuccess?(0,W.jsxs)(W.Fragment,{children:[r&&!c&&l===`api`?_.data?.cname?(0,W.jsx)(P7,{customDomain:a.getValues(`hostname`),cname:_.data.cname,documentationUrl:IQt}):(0,W.jsx)(F7,{}):!d&&_.data?.cname&&(0,W.jsx)(P7,{customDomain:a.getValues(`hostname`),cname:_.data?.cname}),!r&&!d&&!_.data?.cname&&l===`api`&&(0,W.jsx)(F7,{}),(0,W.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:(0,W.jsx)(SA,{asChild:!0,children:(0,W.jsx)(Y,{"data-test":`ok-create-custom-domain-btn`,children:`Done`})})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(DR,{error:_.error}),(0,W.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[h.length>0&&(0,W.jsxs)(bG,{...a,children:[i&&(0,W.jsx)(jS,{variant:`info`,children:(0,W.jsx)(NS,{children:`Make sure this hostname is already configured in your Akamai CDN. Registering it here records the alias domain with Zuplo so your public URLs match the client-facing domain.`})}),m&&!i&&(0,W.jsxs)(jS,{variant:`warning`,children:[(0,W.jsx)(MS,{children:`Preview Notice`}),(0,W.jsxs)(NS,{children:[`Custom domains for the Dev Portal are currently in preview and only available after the migration to our preview version.`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/custom-domains`,target:`_blank`,children:`Learn more`})]})]}),(0,W.jsxs)(`form`,{onSubmit:a.handleSubmit(async n=>{await _.mutateAsync({accountName:e.name,projectName:t,isAlias:NQt({stage:n.stage,isManagedDedicatedProject:r,isAkamaiManagedDedicatedProject:i,formIsAlias:n.isAlias}),hostname:n.hostname,deploymentName:n.environment,stage:n.stage})}),children:[(0,W.jsx)(xG,{control:a.control,name:`environment`,render:({field:e})=>(0,W.jsxs)(CG,{className:`mt-2`,children:[(0,W.jsx)(pW,{htmlFor:`environment-field`,children:`Which environment do you want to apply your new domain to?`}),(0,W.jsx)(M7,{id:`environment-field`,"data-test":`environment-field`,environments:h,value:e.value,onValueChange:e.onChange,disabled:_.isPending,placeholder:`Select an environment`}),(0,W.jsx)(EG,{})]})}),!i&&(0,W.jsx)(xG,{control:a.control,name:`stage`,render:({field:e})=>(0,W.jsxs)(CG,{className:`mt-2`,children:[(0,W.jsx)(pW,{className:`block`,htmlFor:`stage-field`,children:`What do you want the custom domain to be assigned to?`}),(0,W.jsxs)(iW,{onValueChange:t=>{(t===`api`||t===`dev-portal`)&&e.onChange(t)},disabled:_.isPending,...e,children:[(0,W.jsx)(oW,{id:`stage-field`,children:(0,W.jsx)(aW,{placeholder:`Select a stage`})}),(0,W.jsxs)(sW,{children:[(0,W.jsx)(cW,{value:`api`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Lm,{size:16}),` Gateway`]})}),(0,W.jsx)(cW,{value:`dev-portal`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(mie,{size:16}),` Dev Portal`,(0,W.jsx)(PS,{className:``,variant:`info`,children:`New`})]})})]})]}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:a.control,name:`hostname`,render:({field:e})=>(0,W.jsxs)(CG,{className:`mt-2`,children:[(0,W.jsx)(pW,{htmlFor:`hostname-field`,children:`Your custom domain (e.g. example.com or api.example.com)`}),(0,W.jsx)(dV,{type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,"data-test":`hostname-field`,...e,disabled:_.isPending}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:a.control,name:`isAlias`,render:({field:e})=>(0,W.jsx)(CG,{className:G((!d||l===`dev-portal`||r)&&`hidden`,`mt-2`),children:(0,W.jsxs)(UB,{className:`p-4 flex items-center gap-3`,children:[(0,W.jsxs)(pW,{className:`flex flex-col gap-2`,htmlFor:`isAlias`,children:[`Is this an alias domain?`,(0,W.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`If your API Gateway is behind a CDN or WAF, your clients may use a different domain. Use an`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/custom-domains#alias-domains`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`alias domain`}),` `,`so public URLs like docs and OpenAPI match the client-facing domain.`]})]}),(0,W.jsx)(jQt,{className:`mx-3`,id:`isAlias`,"data-test":`isAlias`,checked:e.value??!1,onCheckedChange:e.onChange,disabled:_.isPending}),(0,W.jsx)(EG,{})]})})}),(0,W.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,W.jsx)(SA,{asChild:!0,children:(0,W.jsx)(Y,{type:`button`,"data-test":`cancel-create-custom-domain-btn`,disabled:_.isPending,variant:`secondary`,children:`Cancel`})}),(0,W.jsx)(Y,{type:`submit`,"data-test":`create-custom-domain-btn`,disabled:_.isPending,children:(0,W.jsx)(Tk,{loading:_.isPending,children:`Create`})})]})]})]}),h.length===0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:`Custom domains can only be configured on edge deployment environments and this project only has a working-copy environment.`}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`p`,{children:[` `,`For more information on this see our`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/environments`,children:`documentation on environments`}),`.`]})]})]})]})})]}),(0,W.jsx)(sX,{open:y.showConfirm,onOpenChange:y.setShowConfirm,onDiscard:y.handleDiscard})]})},zQt=`https://zuplo.com/docs/dedicated/custom-domains`,BQt=({customDomain:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n})=>{let[r,i]=(0,g.useState)(void 0),a=()=>{s(),i(void 0)},[o,s]=MR(()=>{let i=r?.deployments.at(0)?.stage,o=r?.deployments.at(0)?.cname,s=typeof o==`string`&&o.length>0;return(0,W.jsx)(HB,{onClose:a,isOpen:!0,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Configure your custom domain`}),n?(0,W.jsx)(pQt,{}):t&&i===`api`?s?(0,W.jsx)(P7,{customDomain:r?.hostname,cname:o,documentationUrl:zQt}):(0,W.jsx)(F7,{}):e.provider===`custom`?(0,W.jsx)(F7,{}):e.provider===`amazon`?s?(0,W.jsx)(P7,{customDomain:r?.hostname,cname:o,documentationUrl:zQt}):(0,W.jsx)(F7,{}):s?(0,W.jsx)(P7,{customDomain:r?.hostname,cname:o}):(0,W.jsx)(F7,{})]})})},[r]),c=e=>{i(e),o()};return(0,W.jsx)(Y,{onClick:()=>{c(e)},"data-test":`view-domain-configuration-btn`,title:`View Configuration`,variant:`ghost`,size:`icon`,children:(0,W.jsx)(zm,{size:18})})},VQt=/held zone/i;function HQt(e){return!!e?.some(e=>VQt.test(e))}var UQt=new Set([`pending`,`pending_migration`,`pending_provisioned`,`active_redeploying`,`provisioned`]),WQt=new Set([`blocked`,`pending_blocked`,`moved`,`deleted`,`pending_deletion`,`test_blocked`,`test_failed`]),GQt=new Set([`initializing`,`pending_validation`,`pending_issuance`,`pending_deployment`,`pending_cleanup`,`staging_deployment`,`holding_deployment`]),KQt=new Set([`expired`,`deactivating`,`inactive`,`initializing_timed_out`,`validation_timed_out`,`issuance_timed_out`,`deployment_timed_out`,`deletion_timed_out`,`deleted`,`pending_deletion`,`pending_expiration`]);function qQt(e){if(e.provider===`alias`)return null;if(e.provider===`custom`||e.provider===`amazon`)return{level:`unknown`,label:`Externally managed`,description:`This domain's status isn't reported to Zuplo — verification and certificates are handled by your dedicated infrastructure provider.`};let t=e.verificationErrors&&e.verificationErrors.length>0,n=e.status??null,r=e.sslStatus??null;if(!n&&!r&&!t)return{level:`pending`,label:`Initializing`,description:`We're waiting for the domain provider to report a status. This usually takes a few seconds after the domain is created.`};if(HQt(e.verificationErrors))return{level:`error`,label:`Zone hold`,description:`Cloudflare is blocking this hostname because the parent domain has a zone hold on another Cloudflare account. The zone owner needs to release the hold before we can finish provisioning.`,helpUrl:`https://developers.cloudflare.com/fundamentals/account/account-security/zone-holds/`,helpLabel:`How to release a zone hold`};if(t)return{level:`error`,label:`Needs attention`,description:`The domain provider reported verification errors. Review the details to resolve them.`};if(n&&WQt.has(n))return{level:`error`,label:I7(n),description:`The domain is in a state that prevents it from serving traffic. Contact support if this persists.`};if(r&&KQt.has(r))return{level:`error`,label:`SSL error`,description:`The SSL certificate is in the "${I7(r)}" state. The domain may not serve HTTPS traffic until this is resolved.`};let i=n===`active`||n===`test_active`||n===`test_active_apex`;return i&&(r===`active`||r===`staging_active`||r===`backup_issued`)?{level:`active`,label:`Active`,description:`The domain is verified and serving traffic over HTTPS.`}:i&&r&&GQt.has(r)?{level:`pending`,label:`Issuing certificate`,description:`The domain is verified. We're still provisioning the SSL certificate — this usually takes a few minutes.`}:n&&UQt.has(n)?{level:`pending`,label:`Verifying domain`,description:`We're waiting for DNS verification. Double-check the CNAME record at your DNS provider.`}:n||r?{level:`pending`,label:I7(n??r??`pending`),description:`The domain is still being set up. If this state persists, contact support.`}:{level:`unknown`,label:`Unknown`,description:`No status information is available for this domain.`}}function I7(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var JQt={active:{dot:`bg-green-500`,pulse:!1,pill:`bg-green-50 text-green-700 border-green-200 hover:bg-green-100 dark:bg-green-950 dark:text-green-300 dark:border-green-800 dark:hover:bg-green-900`},pending:{dot:`bg-amber-500`,pulse:!0,pill:`bg-amber-50 text-amber-800 border-amber-200 hover:bg-amber-100 dark:bg-amber-950 dark:text-amber-300 dark:border-amber-800 dark:hover:bg-amber-900`},error:{dot:`bg-red-500`,pulse:!1,pill:`bg-red-50 text-red-700 border-red-200 hover:bg-red-100 dark:bg-red-950 dark:text-red-300 dark:border-red-800 dark:hover:bg-red-900`},unknown:{dot:`bg-gray-400`,pulse:!1,pill:`bg-gray-50 text-gray-700 border-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700`}},YQt=({domain:e})=>{let t=qQt(e);if(!t)return null;let n=JQt[t.level],r=e.verificationErrors??[];return(0,W.jsxs)(EX,{children:[(0,W.jsx)(DX,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,className:G(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n.pill),"aria-label":`${e.hostname} status: ${t.label}`,children:[(0,W.jsxs)(`span`,{className:`relative flex size-2 items-center justify-center`,children:[n.pulse&&(0,W.jsx)(`span`,{className:G(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,n.dot)}),(0,W.jsx)(`span`,{className:G(`relative inline-flex size-2 rounded-full`,n.dot)})]}),t.label]})}),(0,W.jsx)(OX,{align:`start`,className:`w-96`,children:(0,W.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:G(`inline-flex size-2 rounded-full`,n.dot)}),(0,W.jsx)(`span`,{className:`font-medium`,children:t.label})]}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:t.description}),t.helpUrl&&(0,W.jsx)(rT,{href:t.helpUrl,className:`text-xs`,children:t.helpLabel??`Learn more`}),r.length>0&&(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Verification errors`}),(0,W.jsx)(`ul`,{className:`list-disc pl-5 space-y-1 text-red-700 dark:text-red-400`,children:r.map(e=>(0,W.jsx)(`li`,{children:e},e))})]})]})})]})},XQt=({account:e,currentDomainConfig:t})=>{let{logEvent:n,captureException:r}=Rg(),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),c=e=>{let t=e.target.value;a(t)},l=iZt(),u=async()=>{try{if(s(``),!t.hostname||t.hostname.trim()===``){s(`The current domain configuration does not have a hostname associated with it`);return}await l.mutateAsync({accountName:e.name,projectName:t.projectName??``,hostname:t.hostname,deploymentName:t.deployments[0]?.deploymentName}),n(`account-custom-domain-delete-success`,{account:e.name}),d()}catch(t){r(t);let i=Bj(t);s(i),n(`account-custom-domain-delete-failed`,{account:e.name,errorMessage:i})}},d=()=>{p(),a(``),s(``)},[f,p]=MR(()=>(0,W.jsx)(HB,{onClose:d,isOpen:!0,maxWidth:`max-w-xl`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Delete custom domain`}),(0,W.jsx)(DR,{error:o,className:`mb-3`}),(0,W.jsxs)(`div`,{className:`text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,W.jsxs)(`div`,{className:`relative bg-yellow-100 dark:bg-yellow-950/40 rounded-sm p-4 text-yellow-900 dark:text-yellow-200 text-sm whitespace-pre-line w-full mb-2`,children:[(0,W.jsxs)(`div`,{className:`flex space-x-2 items-center`,children:[(0,W.jsx)(ym,{className:`h-5 w-5 text-yellow-900 dark:text-yellow-200`}),(0,W.jsx)(`span`,{className:`text-sm font-medium antialiased mt-0.5`,children:`Caution: Your project will no longer be accessible with this domain.`})]}),(0,W.jsxs)(`p`,{className:`px-2 mt-4`,children:[`You are about to delete the custom domain`,` `,(0,W.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`from your project. Requests using it will no longer reach your zup.`]})]}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:[`Please type`,` `,(0,W.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`to confirm.`]}),(0,W.jsx)(`input`,{className:`shadow-xs focus:ring-indigo-500 focus:border-indigo-500 block w-full text-sm border-border rounded-md mb-4 placeholder-gray-400 dark:placeholder-neutral-500 disabled:opacity-50`,type:`text`,autoComplete:`off`,value:i,onChange:c,id:`hostname-field`,"data-test":`hostname-field`}),(0,W.jsx)(`div`,{className:` text-red-500`,children:`I understand the consequences, delete this custom domain`})]}),(0,W.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,W.jsx)(Y,{onClick:d,"data-test":`cancel-delete-custom-domain-btn`,variant:`outline`,disabled:l.isPending,children:`Cancel`}),(0,W.jsx)(Y,{"data-test":`delete-custom-domain-btn`,onClick:u,disabled:l.isPending||i!==t.hostname,children:(0,W.jsx)(Tk,{loading:l.isPending,children:`Delete`})})]})]})}),[l.isPending,o,t,i]);return(0,W.jsx)(Y,{type:`button`,title:`Delete Custom Domain`,onClick:f,"data-test-id":`delete-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,W.jsx)(Tk,{loading:l.isPending,children:(0,W.jsx)(Zm,{size:18})})})},ZQt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,QQt=({account:e,projectName:t,currentDomainConfig:n})=>{let{logEvent:r,captureException:i}=Rg(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(n.deployments[0]?.deploymentName),d=n.hostname,{data:f,error:p}=Uj(e.name,t),m=Bj(p);(0,g.useEffect)(()=>{m&&o(m)},[m]);let h=f?f.filter(e=>e.environmentType!==MA.WORKING_COPY):[],_=rZt(),v=async n=>{if(n.preventDefault(),!l||l.trim()===``){o(`Please select an environment from the options available`);return}if(!d||d.trim()===``){o(`Please provide a value on the custom domain field.`);return}if(d&&!ZQt.test(d)){o(`A custom domain value should only be the domain name. It should not start with 'http(s)' and should end with an alpha character.`);return}try{o(``),await _.mutateAsync({accountName:e.name,projectName:t,hostname:d,deploymentName:l}),c(!0),r(`account-custom-domain-edit-success`,{account:e.name})}catch(t){i(t);let n=Bj(t);r(`account-custom-domain-edit-failed`,{account:e.name,errorMessage:n}),o(n),c(!1)}},y=()=>{x(),u(n.deployments[0]?.deploymentName),o(``),c(!1)},[b,x]=MR(()=>(0,W.jsx)(HB,{onClose:y,isOpen:!0,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Edit your custom domain`}),(0,W.jsx)(DR,{error:a}),(0,W.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[s===!1&&(0,W.jsxs)(`form`,{onSubmit:v,children:[(0,W.jsx)(`label`,{className:`block mb-2`,htmlFor:`environment-field`,children:`Which environment do you want to apply your custom domain to ?`}),(0,W.jsx)(`div`,{className:`mb-9`,children:(0,W.jsx)(M7,{id:`environment-field`,"data-test":`environment-field`,environments:h,value:l??``,onValueChange:e=>u(e),disabled:_.isPending,placeholder:`Select an environment`})}),(0,W.jsx)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:`Your custom domain`}),(0,W.jsx)(`input`,{className:`shadow-xs focus:ring-indigo-500 focus:border-indigo-500 block w-full text-sm border-border rounded-md mb-9 placeholder-gray-400 dark:placeholder-neutral-500 disabled:opacity-50`,type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,value:d,disabled:!0,"data-test":`hostname-field`}),(0,W.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,W.jsx)(Y,{variant:`outline`,type:`button`,onClick:y,"data-test":`cancel-edit-custom-domain-btn`,disabled:_.isPending,children:`Cancel`}),(0,W.jsx)(Y,{"data-test":`save-edit-custom-domain-btn`,type:`submit`,disabled:_.isPending||l===n.deployments[0]?.deploymentName,children:(0,W.jsx)(Tk,{loading:_.isPending,children:`Save`})})]})]}),s===!0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:(0,W.jsxs)(`p`,{children:[`Successfully edited custom domain`,` `,(0,W.jsx)(rT,{href:`https://${d}`,children:d}),` `,`to map to deployment `,l]})}),(0,W.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:(0,W.jsx)(Y,{variant:`outline`,className:`w-24 justify-center`,type:`button`,onClick:y,"data-test":`ok-edit-custom-domain-btn`,disabled:!s,children:`OK`})})]})]})]})}),[h,a]),S=()=>{b()};return(0,W.jsx)(Y,{onClick:()=>S(),title:`Edit Custom Domain`,"data-test-id":`edit-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,W.jsx)(Tk,{loading:_.isPending,children:(0,W.jsx)(Vre,{size:18})})})},$Qt=({classNames:e,projectType:t,feature:n,helpUrl:r})=>(0,W.jsxs)(UB,{variant:`danger`,className:e,children:[(0,W.jsx)(WB,{children:t===`managed-dedicated`?`Managed Dedicated Project`:t===`self-hosted`?`Self Hosted Project`:`Managed Edge Project`}),(0,W.jsx)(qB,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,W.jsxs)(`p`,{className:`leading-loose`,children:[`Your project is running on a `,t===`managed-dedicated`?`managed dedicated`:t===`self-hosted`?`self hosted`:`managed edge hosted`,` environment. For information on how to setup up `,n,`, please refer to`,` `,(0,W.jsx)(rT,{href:r,children:`the documentation`}),`.`]})})]});function e$t(){return(0,W.jsx)(`button`,{type:`button`,disabled:!0,title:`Locked custom domain`,className:`items-center justify-center p-2 hover:bg-gray-100 rounded-sm cursor-pointer`,children:(0,W.jsx)(Um,{className:`h-5 w-5 mx-auto`,"aria-hidden":`true`})})}var t$t=()=>{let e=oh([`account`,`project`]),t=aZt(e.account.name,e.project.name),n=dXt(e.account.name,e.project.name);if(!t.data||!n.data)return(0,W.jsx)(YB,{});let r=t.data?.filter(t=>t.projectName&&t.projectName===e.project.name&&t.deployments[0]).sort((e,t)=>e.deployments[0].deploymentName.localeCompare(t.deployments[0].deploymentName)),i=e.account.customDomainsInUse>=e.account.entitlements.customDomains,a=PQt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration}),o=MQt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration});return(0,W.jsxs)(`div`,{className:`flex gap-4 flex-col`,children:[(0,W.jsx)(T7,{title:`Custom Domains`}),(0,W.jsx)(jS,{variant:`outline`,className:`text-sm`,children:(0,W.jsx)(NS,{children:(0,W.jsxs)(`p`,{children:[(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/custom-domains`,children:`Custom domains`}),` `,`allow you to use your own domain name for your API and developer portal. For complex custom domain configurations, please contact us at`,` `,(0,W.jsx)(rT,{href:`mailto:${YS}`,children:YS}),` `,`or use the chat widget at the bottom right.`]})})}),i&&e.account.entitlements.customDomains>0&&e.project.type!==`self-hosted`&&!a&&(0,W.jsx)(dQt,{account:e.account,source:`custom-domain-limit`}),!i&&e.project.type!==`self-hosted`&&!a&&(0,W.jsx)(fQt,{used:e.account.customDomainsInUse,max:e.account.entitlements.customDomains,label:`custom domains`,account:e.account,hideAtLimit:!0}),r.length>0&&(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(t=>{let n=t.deployments[0],r=o&&n?.stage===`api`,i=t.provider===`custom`&&!r,s=t.provider===`alias`,c=n.stage===`dev-portal`,l=a&&!s||i;return(0,W.jsxs)(UB,{className:`p-4 flex items-center justify-between gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`shrink-0 flex size-9 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:c?(0,W.jsx)(mie,{className:`size-4`}):(0,W.jsx)(Lm,{className:`size-4`})}),(0,W.jsxs)(`div`,{className:`flex flex-col min-w-0 gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,W.jsxs)(`a`,{href:`https://${t.hostname}`,target:`_blank`,rel:`noreferrer`,className:`font-medium text-sm hover:text-zuplo-pink transition-colors inline-flex items-center gap-1 truncate`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:t.hostname}),(0,W.jsx)(Am,{className:`size-3 shrink-0 opacity-60`})]}),(0,W.jsx)(YQt,{domain:t}),n.isDefault&&(0,W.jsx)(PS,{variant:`outline`,className:`text-xs`,children:`Default`}),s&&(0,W.jsx)(PS,{variant:`outline`,className:`text-xs`,children:`Alias`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:c?`Dev Portal`:`API`}),(0,W.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(_Dt,{env:n.environmentType??null}),` `,`(`,n.deploymentName,`)`]}),n.branch&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,W.jsx)(Im,{className:`size-3`}),n.branch]})]})]})]})]}),(0,W.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1`,children:[!s&&(0,W.jsx)(BQt,{customDomain:t,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a}),l?(0,W.jsx)(e$t,{}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(QQt,{account:e.account,projectName:e.project.name,currentDomainConfig:t}),(0,W.jsx)(XQt,{account:e.account,currentDomainConfig:t})]})]})]},t.id)})}),e.project.type===`self-hosted`?(0,W.jsx)($Qt,{classNames:`mt-5`,feature:`custom domains`,helpUrl:`https://zuplo.com/docs/dedicated/custom-domains`,projectType:e.project.type}):a?e.account.entitlements.aliasDomains?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[(0,W.jsx)(jS,{variant:`info`,className:`text-sm`,children:(0,W.jsx)(NS,{children:(0,W.jsxs)(`p`,{children:[`This project uses Akamai managed dedicated hosting. Configure the hostname in your Akamai CDN first — see the`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`. Once it's set up there, add the domain below to register it with Zuplo.`]})})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(RQt,{account:e.account,projectName:e.project.name,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:!0})})]}):(0,W.jsx)(pQt,{className:`mt-5`}):e.account.entitlements.customDomains>0?(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(RQt,{disabled:i,account:e.account,projectName:e.project.name,isManagedDedicatedProject:o})}):(0,W.jsx)(dQt,{account:e.account,source:`custom-domain`,className:`mt-5`})]})},n$t=`__NULL_BRANCH`,r$t=e=>{let t=[];return e.production&&t.push(`production`),e.preview&&t.push(`preview`),e.workingCopy&&t.push(`working-copy`),t},i$t=({previewEnvironments:e,defaultBranch:t})=>{let{register:n,watch:r,setValue:i,getValues:a,control:o}=zW(),s=r(`personalOverride`),c=r(`preview`),l=r(`workingCopy`),u=a(),d=u.production||u.preview||u.workingCopy;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 mt-4`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium`,children:`Environments`}),(0,W.jsx)(L7,{id:`production`,testId:`production-checkbox`,register:n(`production`),title:`Production`,description:t?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(Im,{className:`size-3`}),(0,W.jsx)(`span`,{className:`font-mono`,children:t})]}):`The branch deployed to production`}),(0,W.jsx)(L7,{id:`preview`,testId:`preview-checkbox`,register:n(`preview`),title:`Preview`,description:(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(Im,{className:`size-3`}),`All non-production branches`]}),action:(0,W.jsx)(WW,{control:o,name:`targetBranch`,render:({field:t})=>(0,W.jsx)(M7,{environments:e,value:t.value??`__NULL_BRANCH`,onValueChange:t.onChange,disabled:!c,getOptionValue:e=>e.branchName??``,sentinel:{value:n$t,label:`All other branches`},triggerClassName:`w-72 h-10`,showTriggerBadge:!1,"data-test":`preview-branch-picker`})})}),(0,W.jsx)(L7,{id:`workingCopy`,testId:`working-copy-checkbox`,register:n(`workingCopy`),title:`Development`,description:(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(BR,{className:`size-3`}),`Your Working Copy & Local Dev`]}),action:l&&(0,W.jsx)(`button`,{type:`button`,"data-test":`personal-override-button`,className:`text-xs text-zuplo-pink hover:underline whitespace-nowrap`,onClick:()=>{i(`personalOverride`,!s,{shouldDirty:!0,shouldTouch:!0})},children:s?`Clear personal override`:`Set personal override`})}),l&&s&&(0,W.jsxs)(`div`,{className:`ml-7 rounded-md border border-dashed bg-muted/40 p-3 flex flex-col gap-1.5`,children:[(0,W.jsx)(`label`,{htmlFor:`personal-value`,className:`text-sm font-medium`,children:`Personal override`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Only applied in your own Working Copy & Local Dev. Other developers won’t see this value.`}),(0,W.jsx)(dV,{id:`personal-value`,"data-test":`personal-override-input`,...n(`personalValue`)})]}),!d&&(0,W.jsx)(jS,{children:(0,W.jsx)(NS,{children:`You must select at least one environment`})})]})},L7=({id:e,testId:t,register:n,title:r,description:i,action:a})=>(0,W.jsxs)(`div`,{className:G(`flex min-h-16 items-center gap-3 rounded-md border bg-background px-4 py-3`,`transition-colors hover:border-foreground/20`),children:[(0,W.jsx)(`input`,{id:e,"data-test":t,type:`checkbox`,className:`size-4 rounded-sm border border-gray-300 shadow-sm shrink-0`,...n}),(0,W.jsxs)(`label`,{htmlFor:e,className:`flex-1 min-w-0 cursor-pointer`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium leading-tight`,children:r}),(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:i})]}),a&&(0,W.jsx)(`div`,{className:`shrink-0`,children:a})]}),a$t=({mode:e})=>{let{register:t,formState:n}=zW();return(0,W.jsxs)(`div`,{className:`flex flex-col`,children:[n.errors.name?.message&&(0,W.jsx)(DR,{error:n.errors.name.message,"data-test":`variable-name-input-error-validation-message`}),(0,W.jsx)(`span`,{className:`text-sm`,children:`Name`}),(0,W.jsx)(`div`,{className:`flex flex-col items-top gap-2`,children:(0,W.jsx)(dV,{id:`name`,onInput:e=>{let t=e.target,n=t.selectionStart;t.value=t.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`),t.setSelectionRange(n,n)},...t(`name`,{disabled:e===`edit`,pattern:{value:/^[^0-9a-z\W][A-Z0-9_]*$/,message:`Name must be SCREAMING_SNAKE_CASE and must start with a letter`}}),title:e===`edit`?`Name cannot be changed, create a new variable instead`:``,type:`text`,"data-test":`variable-name-input`})})]})},o$t=({variable:e,previewEnvironments:t,defaultBranch:n,onClose:r,isSaving:i,error:a,mode:o,onSubmit:s})=>{let c=vG({defaultValues:{preview:e.targets.includes(`preview`),production:e.targets.includes(`production`),workingCopy:e.targets.includes(`working-copy`),name:e.name,isSecret:e.type===`secret`,value:o===`edit`&&e.type===`secret`?`*******`:e.value??null,personalOverride:e.personalValue!==void 0,personalValue:e.personalValue??null,targetBranch:e.targetBranch??`__NULL_BRANCH`},mode:`onChange`}),{getValues:l,control:u,register:d,watch:f}=c,{isValid:p,dirtyFields:m,touchedFields:h}=HW({control:u}),_=l(),v=_.production||_.preview||_.workingCopy,y=!i&&v&&p,b=()=>{s(l(),m,h)},x=(0,g.useRef)(null),S=(0,g.useRef)(null);return(0,W.jsx)(g7e,{...c,children:(0,W.jsx)(HB,{isOpen:!0,maxWidth:`max-w-2xl`,onClose:r,children:(0,W.jsx)(`div`,{className:`flex flex-col mt-6`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(DR,{error:a}),(0,W.jsx)(a$t,{mode:o}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`text-sm`,children:`Value`}),(0,W.jsx)(WW,{control:u,name:`value`,render:({fieldState:{isDirty:e},field:{value:t,disabled:n,...r}})=>(0,W.jsxs)(`div`,{className:G(`rounded-sm border border-border w-full relative max-h-48`,n&&`bg-gray-100 dark:bg-neutral-800`),ref:S,children:[(0,W.jsxs)(`pre`,{className:G(`font-mono text-zuplo-pink p-2 overflow-hidden max-h-48 text-sm whitespace-pre`,n&&`invisible`),ref:x,children:[[...t??``].map((e,t)=>{switch(e){case`
1651
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mJt(e,t){if(e){if(typeof e==`string`)return c7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c7(e,t)}}function hJt(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function gJt(e){if(Array.isArray(e))return c7(e)}function c7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _Jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_Jt(Object(n),!0).forEach(function(t){l7(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_Jt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l7(e,t,n){return t=vJt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vJt(e){var t=yJt(e,`string`);return r7(t)==`symbol`?t:t+``}function yJt(e,t){if(r7(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(r7(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var bJt={xAxis:[`bottom`,`top`],yAxis:[`left`,`right`]},xJt={width:`100%`,height:`100%`},SJt={x:0,y:0};function u7(e){return e}var CJt=function(e,t){return t===`horizontal`?e.x:t===`vertical`?e.y:t===`centric`?e.angle:e.radius},wJt=function(e,t,n,r){var i=t.find(function(e){return e&&e.index===n});if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.y};if(e===`vertical`)return{x:r.x,y:i.coordinate};if(e===`centric`){var a=i.coordinate,o=r.radius;return Q(Q(Q({},r),z6(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return Q(Q(Q({},r),z6(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return SJt},d7=function(e,t){var n=t.graphicalItems,r=t.dataStartIndex,i=t.dataEndIndex,a=(n??[]).reduce(function(e,t){var n=t.props.data;return n&&n.length?[].concat(s7(e),s7(n)):e},[]);return a.length>0?a:e&&e.length&&L0(r)&&L0(i)?e.slice(r,i+1):[]};function TJt(e){return e===`number`?[0,`auto`]:void 0}var f7=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=d7(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?H0(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(s7(i),[Xzt(s,l)]):i},[])},EJt=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=CJt(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=Ozt(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:f7(e,t,l,u),activeCoordinate:wJt(n,o,l,i)}}return null},DJt=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=Izt(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=d7(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;Vqt(p.domain,g,m)&&(w=P6(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=k6(S,h,`category`)));var D=TJt(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=k6(S,h,m),m===`category`&&f){var k=ckt(w);_&&k?(T=w,w=(0,v5.default)(0,C)):_||(w=Yzt(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(s7(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,Y0.default)(e)}):Yzt(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,Y0.default)(t)?e:[].concat(s7(e),[t])},[]);else if(m===`number`){var A=Pzt(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=k6(S,h,`category`))}else w=f?(0,v5.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:Kzt(o[x].stackGroups,s,c):Fzt(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=X5(u,w,x,i,y),O&&(w=P6(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return Q(Q({},t),{},l7({},x,Q(Q({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},OJt=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=d7(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=Izt(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:Q(Q({},t.type.defaultProps),t.props))[a],g=TJt(`number`);if(!e[h]){m++;var _;return p?_=(0,v5.default)(0,f):o&&o[h]&&o[h].hasStack?(_=Kzt(o[h].stackGroups,s,c),_=X5(u,_,h,i)):(_=P6(g,Fzt(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=X5(u,_,h,i)),Q(Q({},e),{},l7({},h,Q(Q({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,P0.default)(bJt,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},kJt=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=e2(l,i),f={};return d&&d.length?f=DJt(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=OJt(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},AJt=function(e){var t=V0(e),n=j6(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,c4.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:F6(t,n)}},jJt=function(e){var t=e.children,n=e.defaultShowTooltip,r=t2(t,T5),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},MJt=function(e){return!e||!e.length?!1:e.some(function(e){var t=Z0(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},NJt=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},PJt=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=t2(u,T5),p=t2(u,a4),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},l7({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=Q(Q({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},l7({},r,(0,P0.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||T5.defaultProps.height),p&&t&&(h=jzt(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return Q(Q({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},FJt=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},IJt=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=NJt(u),h=m.numericAxisName,g=m.cateAxisName,_=MJt(n),v=[];return n.forEach(function(n,m){var y=d7(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&p6(!1);var a=r[i];return Q(Q({},e),{},l7(l7({},n.axisType,a),`${n.axisType}Ticks`,j6(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&Wzt(n,r[C].stackGroups),k=Z0(n.type).indexOf(`Bar`)>=0,A=F6(E,D),j=[],M=_&&kzt({barSize:l,stackGroups:r,totalSize:FJt(T,g)});if(k){var N=(0,Y0.default)(S)?p:S,P=F6(E,D,!0)??N??0;j=Azt({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return Q(Q({},e),{},{position:Q(Q({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:Q(Q({},F(Q(Q({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},l7(l7(l7({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:kkt(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!Skt({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=NJt(f),_=g.numericAxisName,v=g.cateAxisName,y=e2(u,n),b=Hzt(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return Q(Q({},e),{},l7({},n,kJt(i,Q(Q({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=PJt(Q(Q({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=AJt(C);return Q(Q({formattedGraphicalItems:d(i,Q(Q({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return aJt(this,n),r=cJt(this,n,[e]),l7(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),l7(r,`accessibilityManager`,new Bqt),l7(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState(Q({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},Q(Q({},r.state),{},{legendBBox:e}))))}}),l7(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),l7(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return Q({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),l7(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,X0.default)(i)&&i(n,e)}}),l7(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?Q(Q({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,X0.default)(i)&&i(n,e)}),l7(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),l7(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),l7(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),l7(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,X0.default)(n)&&n(t,e)}),l7(r,`handleOuterEvent`,function(e){var t=Okt(e),n=(0,P0.default)(r.props,`${t}`);t&&(0,X0.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),l7(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,X0.default)(i)&&i(n,e)}}),l7(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),l7(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),l7(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),l7(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,X0.default)(t)&&t(r.getMouseInfo(e),e)}),l7(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&Z5.emit(Q5,r.props.syncId,e,r.eventEmitterSymbol)}),l7(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState(Q({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h<m.length;h++)if(m[h].value===e.activeLabel){u=h;break}}var g=Q(Q({},p),{},{x:p.left,y:p.top}),_=Math.min(c,g.x+g.width),v=Math.min(l,g.y+g.height),y=m[u]&&m[u].value,b=f7(r.state,r.props.data,u),x=m[u]?{x:n===`horizontal`?m[u].coordinate:_,y:n===`horizontal`?v:m[u].coordinate}:SJt;r.setState(Q(Q({},e),{},{activeLabel:y,activeCoordinate:x,activePayload:b,activeTooltipIndex:u}))}else r.setState(e)}),l7(r,`renderCursor`,function(e){var n=r.state,i=n.isTooltipActive,a=n.activeCoordinate,o=n.activePayload,s=n.offset,c=n.activeTooltipIndex,l=n.tooltipAxisBandSize,u=r.getTooltipEventType(),d=e.props.active??i,f=r.props.layout,p=e.key||`_recharts-cursor`;return g.createElement(Yqt,{key:p,activeCoordinate:a,activePayload:o,activeTooltipIndex:c,chartName:t,element:e,isActive:d,layout:f,offset:s,tooltipAxisBandSize:l,tooltipEventType:u})}),l7(r,`renderPolarAxis`,function(e,t,n){var i=(0,P0.default)(e,`type.axisType`),a=(0,P0.default)(r.state,`${i}Map`),o=e.type.defaultProps,s=o===void 0?e.props:Q(Q({},o),e.props),c=a&&a[s[`${i}Id`]];return(0,g.cloneElement)(e,Q(Q({},c),{},{className:Hp(i,c.className),key:e.key||`${t}-${n}`,ticks:j6(c,!0)}))}),l7(r,`renderPolarGrid`,function(e){var t=e.props,n=t.radialLines,i=t.polarAngles,a=t.polarRadius,o=r.state,s=o.radiusAxisMap,c=o.angleAxisMap,l=V0(s),u=V0(c),d=u.cx,f=u.cy,p=u.innerRadius,m=u.outerRadius;return(0,g.cloneElement)(e,{polarAngles:Array.isArray(i)?i:j6(u,!0).map(function(e){return e.coordinate}),polarRadius:Array.isArray(a)?a:j6(l,!0).map(function(e){return e.coordinate}),cx:d,cy:f,innerRadius:p,outerRadius:m,key:e.key||`polar-grid`,radialLines:n})}),l7(r,`renderLegend`,function(){var e=r.state.formattedGraphicalItems,t=r.props,n=t.children,i=t.width,a=t.height,o=r.props.margin||{},s=vzt({children:n,formattedGraphicalItems:e,legendWidth:i-(o.left||0)-(o.right||0),legendContent:c});if(!s)return null;var l=s.item;return(0,g.cloneElement)(l,Q(Q({},rJt(s,Zqt)),{},{chartWidth:i,chartHeight:a,margin:o,onBBoxUpdate:r.handleLegendBBoxUpdate}))}),l7(r,`renderTooltip`,function(){var e=r.props,t=e.children,n=e.accessibilityLayer,i=t2(t,w4);if(!i)return null;var a=r.state,o=a.isTooltipActive,s=a.activeCoordinate,c=a.activePayload,l=a.activeLabel,u=a.offset,d=i.props.active??o;return(0,g.cloneElement)(i,{viewBox:Q(Q({},u),{},{x:u.left,y:u.top}),active:d,label:l,payload:d?c:[],coordinate:s,accessibilityLayer:n})}),l7(r,`renderBrush`,function(e){var t=r.props,n=t.margin,i=t.data,a=r.state,o=a.offset,s=a.dataStartIndex,c=a.dataEndIndex,l=a.updateId;return(0,g.cloneElement)(e,{key:e.key||`_recharts-brush`,onChange:N6(r.handleBrushChange,e.props.onChange),data:i,x:L0(e.props.x)?e.props.x:o.left,y:L0(e.props.y)?e.props.y:o.top+o.height+o.brushBottom-(n.bottom||0),width:L0(e.props.width)?e.props.width:o.width,startIndex:s,endIndex:c,updateId:`brush-${l}`})}),l7(r,`renderReferenceElement`,function(e,t,n){if(!e)return null;var i=r.clipPathId,a=r.state,o=a.xAxisMap,s=a.yAxisMap,c=a.offset,l=e.type.defaultProps||{},u=e.props,d=u.xAxisId,f=d===void 0?l.xAxisId:d,p=u.yAxisId,m=p===void 0?l.yAxisId:p;return(0,g.cloneElement)(e,{key:e.key||`${t}-${n}`,xAxis:o[f],yAxis:s[m],viewBox:{x:c.left,y:c.top,width:c.width,height:c.height},clipPathId:i})}),l7(r,`renderActivePoints`,function(e){var t=e.item,r=e.activePoint,i=e.basePoint,a=e.childIndex,o=e.isRange,s=[],c=t.props.key,l=t.item.type.defaultProps===void 0?t.item.props:Q(Q({},t.item.type.defaultProps),t.item.props),u=l.activeDot,d=l.dataKey,f=Q(Q({index:a,dataKey:d,cx:r.x,cy:r.y,r:4,fill:A6(t.item),strokeWidth:2,stroke:`#fff`,payload:r.payload,value:r.value},n2(u,!1)),q0(u));return s.push(n.renderActiveDot(u,f,`${c}-activePoint-${a}`)),i?s.push(n.renderActiveDot(u,Q(Q({},f),{},{cx:i.x,cy:i.y}),`${c}-basePoint-${a}`)):o&&s.push(null),s}),l7(r,`renderGraphicChild`,function(e,t,n){var i=r.filterFormatItem(e,t,n);if(!i)return null;var a=r.getTooltipEventType(),o=r.state,s=o.isTooltipActive,c=o.tooltipAxis,l=o.activeTooltipIndex,u=o.activeLabel,d=r.props.children,f=t2(d,w4),p=i.props,m=p.points,h=p.isRange,_=p.baseLine,v=i.item.type.defaultProps===void 0?i.item.props:Q(Q({},i.item.type.defaultProps),i.item.props),y=v.activeDot,b=v.hide,x=v.activeBar,S=v.activeShape,C=!!(!b&&s&&f&&(y||x||S)),w={};a!==`axis`&&f&&f.props.trigger===`click`?w={onClick:N6(r.handleItemMouseEnter,e.props.onClick)}:a!==`axis`&&(w={onMouseLeave:N6(r.handleItemMouseLeave,e.props.onMouseLeave),onMouseEnter:N6(r.handleItemMouseEnter,e.props.onMouseEnter)});var T=(0,g.cloneElement)(e,Q(Q({},i.props),w));function E(e){return typeof c.dataKey==`function`?c.dataKey(e.payload):null}if(C)if(l>=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=H0(m,k,u),O=h&&_&&H0(_,k,u)}else D=m?.[l],O=h&&_&&_[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,g.cloneElement)(e,Q(Q(Q({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,Y0.default)(D))return[T].concat(s7(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,g.cloneElement)(N,Q(Q(Q({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),l7(r,`renderCustomized`,function(e,t,n){return(0,g.cloneElement)(e,Q(Q({key:`recharts-customized-${n}`},r.props),r.state))}),l7(r,`renderMap`,{CartesianGrid:{handler:u7,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:u7},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:u7},YAxis:{handler:u7},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??z0(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,Xqt.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return fJt(n,e),sJt(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=t2(t,w4);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=f7(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=Q(Q({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){r2([t2(e.children,w4)],[t2(this.props.children,w4)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=t2(this.props.children,w4);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=gPt(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=EJt(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=V0(c).scale,p=V0(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return Q(Q({},i),{},{xValue:m,yValue:h},d)}return d?Q(Q({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=V0(c);return mBt({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=t2(e,w4),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),Q(Q({},q0(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){Z5.on(Q5,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){Z5.removeListener(Q5,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i<a;i++){var o=r[i];if(o.item===e||o.props.key===e.key||t===Z0(o.item.type)&&n===o.childIndex)return o}return null}},{key:`renderClipPath`,value:function(){var e=this.clipPathId,t=this.state.offset,n=t.left,r=t.top,i=t.height,a=t.width;return g.createElement(`defs`,null,g.createElement(`clipPath`,{id:e},g.createElement(`rect`,{x:n,y:r,height:i,width:a})))}},{key:`getXScales`,value:function(){var e=this.state.xAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=$qt(t,2),r=n[0],i=n[1];return Q(Q({},e),{},l7({},r,i.scale))},{}):null}},{key:`getYScales`,value:function(){var e=this.state.yAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=$qt(t,2),r=n[0],i=n[1];return Q(Q({},e),{},l7({},r,i.scale))},{}):null}},{key:`getXScaleByAxisId`,value:function(e){var t;return(t=this.state.xAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getYScaleByAxisId`,value:function(e){var t;return(t=this.state.yAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getItemByXY`,value:function(e){var t=this.state,n=t.formattedGraphicalItems,r=t.activeItem;if(n&&n.length)for(var i=0,a=n.length;i<a;i++){var o=n[i],s=o.props,c=o.item,l=c.type.defaultProps===void 0?c.props:Q(Q({},c.type.defaultProps),c.props),u=Z0(c.type);if(u===`Bar`){var d=(s.data||[]).find(function(t){return PUt(e,t)});if(d)return{graphicalItem:o,payload:d}}else if(u===`RadialBar`){var f=(s.data||[]).find(function(t){return mBt(e,t)});if(f)return{graphicalItem:o,payload:f}}else if(o5(o,r)||s5(o,r)||c5(o,r)){var p=yGt({graphicalItem:o,activeTooltipItem:r,itemData:l.data}),m=l.activeIndex===void 0?p:l.activeIndex;return{graphicalItem:Q(Q({},o),{},{childIndex:m}),payload:c5(o,r)?l.data[p]:o.props.data[p]}}}return null}},{key:`render`,value:function(){var e=this;if(!Skt(this))return null;var t=this.props,n=t.children,r=t.className,i=t.width,a=t.height,o=t.style,s=t.compact,c=t.title,l=t.desc,u=n2(rJt(t,Qqt),!1);if(s)return g.createElement(jKt,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},g.createElement(a2,i7({},u,{width:i,height:a,title:c,desc:l}),this.renderClipPath(),Dkt(n,this.renderMap)));this.props.accessibilityLayer&&(u.tabIndex=this.props.tabIndex??0,u.role=this.props.role??`application`,u.onKeyDown=function(t){e.accessibilityManager.keyboardEvent(t)},u.onFocus=function(){e.accessibilityManager.focus()});var d=this.parseEventsOfWrapper();return g.createElement(jKt,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},g.createElement(`div`,i7({className:Hp(`recharts-wrapper`,r),style:Q({position:`relative`,cursor:`default`,width:i,height:a},o)},d,{ref:function(t){e.container=t}}),g.createElement(a2,i7({},u,{width:i,height:a,title:c,desc:l,style:xJt}),this.renderClipPath(),Dkt(n,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(g.Component);l7(p,`displayName`,t),l7(p,`defaultProps`,Q({layout:`horizontal`,stackOffset:`none`,barCategoryGap:`10%`,barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:`index`},u)),l7(p,`getDerivedStateFromProps`,function(e,t){var n=e.dataKey,r=e.data,i=e.children,a=e.width,o=e.height,s=e.layout,c=e.stackOffset,l=e.margin,u=t.dataStartIndex,d=t.dataEndIndex;if(t.updateId===void 0){var p=jJt(e);return Q(Q(Q({},p),{},{updateId:0},f(Q(Q({props:e},p),{},{updateId:0}),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(n!==t.prevDataKey||r!==t.prevData||a!==t.prevWidth||o!==t.prevHeight||s!==t.prevLayout||c!==t.prevStackOffset||!U0(l,t.prevMargin)){var m=jJt(e),h={chartX:t.chartX,chartY:t.chartY,isTooltipActive:t.isTooltipActive},g=Q(Q({},EJt(t,r,s)),{},{updateId:t.updateId+1}),_=Q(Q(Q({},m),h),g);return Q(Q(Q({},_),f(Q({props:e},_),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(!r2(i,t.prevChildren)){var v=t2(i,T5),y=v?v.props?.startIndex??u:u,b=v?v.props?.endIndex??d:d,x=y!==u||b!==d,S=!(0,Y0.default)(r)&&!x?t.updateId:t.updateId+1;return Q(Q({updateId:S},f(Q(Q({props:e},t),{},{updateId:S,dataStartIndex:y,dataEndIndex:b}),t)),{},{prevChildren:i,dataStartIndex:y,dataEndIndex:b})}return null}),l7(p,`renderActiveDot`,function(e,t,n){var r=(0,g.isValidElement)(e)?(0,g.cloneElement)(e,t):(0,X0.default)(e)?e(t):g.createElement(z8,t);return g.createElement(s2,{className:`recharts-active-dot`,key:n},r)});var m=(0,g.forwardRef)(function(e,t){return g.createElement(p,i7({},e,{ref:t}))});return m.displayName=p.displayName,m}({chartName:`PieChart`,GraphicalChild:g5,validateTooltipEventTypes:[`item`],defaultTooltipEventType:`item`,legendContent:`children`,axisComponents:[{axisType:`angleAxis`,AxisComp:t5},{axisType:`radiusAxis`,AxisComp:J8}],formatAxisMap:lBt,defaultProps:{layout:`centric`,startAngle:0,endAngle:360,cx:`50%`,cy:`50%`,innerRadius:0,outerRadius:`80%`}}),LJt={success:`fill-green-500`,failed:`fill-red-600`,skipped:`fill-neutral-500`,"in-progress":`fill-blue-500`},RJt=({deployment:e,className:t,size:n=20,innerRadius:r=45})=>(0,W.jsx)(IJt,{width:n,height:n,margin:{top:0,left:0,right:0,bottom:0},className:G(`relative`,t),children:(0,W.jsx)(g5,{className:G(`stroke-white dark:stroke-gray-950 [&_.recharts-pie-sector]:outline-hidden`),data:e.stages.map(e=>({name:e.stage,status:e.status,value:1,className:LJt[e.status]})),cx:`50%`,cy:`50%`,startAngle:90,endAngle:-270,innerRadius:`${r}%`,outerRadius:`100%`,stroke:``,strokeLinejoin:`round`,dataKey:`value`,nameKey:`name`,isAnimationActive:!1,style:{outline:`none`}})}),zJt=({item:e,isSelected:t,onSelect:n})=>{let r=new Date(e.createdOn),i=xOt(r)?`${d0(r,`H:mm:ss`)} Today`:bOt(r)?`${d0(r,`H:mm:ss ccc d, MMM`)}`:`${d0(r,`H:mm:ss ccc d`)} ${d0(r,`MMM yyy`)}`;return(0,W.jsxs)(`div`,{className:(0,_P.default)(`flex items-center gap-2 px-3 cursor-pointer h-10 border-border border-b`,{"bg-gray-100":t,"hover:bg-gray-50 hover:text-gray-900":!t}),onClick:()=>n(),children:[(0,W.jsx)(`div`,{className:`flex justify-center items-center w-5 shrink-0`,children:(0,W.jsx)(RJt,{deployment:e})}),(0,W.jsx)(`span`,{className:`w-full text-sm truncate`,children:i})]})},BJt=()=>XR(`auto-open-feedback`,void 0),VJt=()=>{let[,e]=FA(`build`);return{openBuildFeedback:t=>e(t)}},HJt=()=>{let[e]=BJt(),{environment:t}=oh([`account`,`project`,`environment`]),{data:n}=Gj(t.name),r=n?.data?.at(0),{openBuildFeedback:i}=VJt(),a=(0,g.useRef)(e),o=(0,g.useRef)(i);(0,g.useEffect)(()=>{o.current=i},[i]),(0,g.useEffect)(()=>{a.current=e},[e]),(0,g.useEffect)(()=>{a.current===!0&&r?.id&&r.stages.some(({status:e})=>e===`failed`)&&o.current(r.id)},[r?.id,r?.stages])},UJt=()=>{let[e,t]=BJt();return(0,W.jsxs)(yk,{open:e===void 0,children:[(0,W.jsx)(bk,{asChild:!0,children:(0,W.jsxs)(`label`,{className:`flex gap-2 items-center text-xs font-medium cursor-pointer`,children:[(0,W.jsx)(uV,{checked:e,onCheckedChange:()=>t(e=>!e)}),`Auto-open feedback`]})}),(0,W.jsxs)(xk,{className:`mr-2`,children:[`Try automatically open build feedback next time`,(0,W.jsx)(Sk,{})]})]})},WJt={"in-progress":`Building`,success:`Finished`,failed:`Failed`,skipped:`Skipped`},GJt=({status:e})=>WJt[e],KJt={lint:`Lint`,build:`Build`,deploy:`Deploy`},qJt=({step:e})=>KJt[e]??e,JJt={"dev-portal":`devPortal`,api:`api`},YJt=e=>e.map(([e,t,n])=>({timestamp:e,severity:t,message:n})).sort((e,t)=>e.timestamp.localeCompare(t.timestamp)),XJt=e=>e.filter(e=>e.severity===`warn`).length,ZJt=(e,t)=>{let n=e[JJt[t]];return n?YJt(Object.values(n).flat()):[]},QJt=(e,t,n)=>{let r=e[JJt[t]];if(!r)return[];let i=r[n];return i?YJt(i):[]},$Jt=({text:e})=>e.split(/(https?:\/\/\S+)/g).map((e,t)=>/^https?:\/\//.test(e)?(0,W.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:e},`${e}-${t}`):e),p7=e(i(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function eYt({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}var tYt=eYt();function nYt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(tYt,``)}var rYt=({logs:e,children:t,className:n})=>(0,W.jsx)(`div`,{className:G(`grid grid-cols-[auto_1fr] auto-rows-min gap-x-5 py-4 text-xs h-full overflow-auto`,`bg-neutral-950 font-mono text-white`,n),children:t||(e.length>0?e.map(({timestamp:e,severity:t,message:n},r)=>(0,W.jsxs)(`div`,{className:G(`grid grid-cols-subgrid col-span-full px-4 py-1 hover:bg-neutral-800 text-neutral-200`,{"text-red-400":t===`error`,"text-yellow-400":t===`warn`,"text-green-500":/^\x1b\[32m/.test(n)}),children:[(0,W.jsx)(`div`,{className:`select-none`,children:(0,p7.default)(e).format(`HH:mm:ss.SSS`)}),(0,W.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:(0,W.jsx)($Jt,{text:nYt(n).trim()})})]},`${e}-${r}`)):(0,W.jsx)(`div`,{className:`text-neutral-300 italic px-4`,children:`No logs available`}))}),iYt=({stage:e,buildLogs:t,isLoading:n})=>(0,W.jsx)(`div`,{className:`divide-y divide-neutral-800`,children:[...e.steps??[]].sort((e,t)=>e.ordinal-t.ordinal).map(r=>{let i=QJt(t,e.stage,r.step),a=XJt(i);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-xs font-medium bg-neutral-900 text-neutral-300`,children:[(0,W.jsx)(Dz,{status:r.status}),(0,W.jsx)(qJt,{step:r.step}),a>0&&(0,W.jsxs)(PS,{variant:`warn`,children:[a,` warning`,a>1?`s`:``]})]}),(0,W.jsx)(rYt,{logs:i,children:n&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,W.jsx)(oN,{className:`h-4 w-3/6 bg-white/20`}),(0,W.jsx)(oN,{className:`h-4 w-2/6 bg-white/20`})]})})]},r.id)})}),aYt=(e,t)=>e?t(e):void 0,oYt=({deployment:e,defaultOpen:t})=>{let{environment:n}=oh([`environment`]),r=Qxt(n.name,e.id,{});return r.isPending?(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(oN,{className:`h-10 w-full`}),(0,W.jsx)(oN,{className:`h-10 w-full`})]}):r.isError?(0,W.jsx)(jS,{variant:`warning`,children:(0,W.jsx)(NS,{className:`text-center`,children:(0,W.jsx)(`div`,{className:`text-neutral-600 text-lg`,children:r.error?r.error.status===401||r.error.status===403?`You don't have permission to view build logs for this deployment.`:r.error.status===404?`Deployment not found. The selected deployment may have been deleted or doesn't exist.`:r.error.status===500?`Server error occurred while loading build logs. Please try again or contact support if the problem persists.`:`Unable to load build logs. Please try again or contact support if the problem persists.`:`Could not load logs. Please try again or contact support if the problem persists.`})})}):(0,W.jsx)(UB,{className:`divide-y overflow-hidden`,children:e.stages.map((n,i)=>(0,W.jsx)(sYt,{stage:n,stageIndex:i,stageCount:e.stages.length,buildLogs:r.data,isLoading:r.isLoading,defaultOpen:t},n.id))})},sYt=({stage:e,stageIndex:t,stageCount:n,buildLogs:r,isLoading:i,defaultOpen:a})=>{let o=e.steps&&e.steps.length>0;return(0,W.jsxs)(Cz,{defaultOpen:a,children:[(0,W.jsx)(wz,{asChild:!0,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 p-2 w-full hover:bg-accent cursor-pointer group`,children:[(0,W.jsx)(Dz,{status:e.status}),(0,W.jsxs)(`div`,{className:`font-medium`,children:[(0,W.jsxs)(`span`,{className:`font-mono text-xs me-2`,children:[`(`,t+1,`/`,n,`)`]}),`Building `,(0,W.jsx)(Ez,{stage:e.stage})]}),(0,W.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,W.jsx)(GJt,{status:e.status})}),(0,W.jsx)(`div`,{className:`text-xs text-amber-400`,children:aYt(XJt(ZJt(r,e.stage)),e=>(0,W.jsxs)(PS,{variant:`warn`,children:[e,` warning`,e>1?`s`:``]}))}),(0,W.jsx)(`div`,{className:`ms-2 flex items-center justify-center`,children:(0,W.jsx)(hm,{className:`w-4 h-4 transition-transform group-data-[state=closed]:-rotate-90`})})]})}),(0,W.jsx)(Tz,{children:o?(0,W.jsx)(iYt,{stage:e,buildLogs:r,isLoading:i}):(0,W.jsx)(rYt,{logs:ZJt(r,e.stage),children:i&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,W.jsx)(oN,{className:`h-4 w-3/6 bg-white/20`}),(0,W.jsx)(oN,{className:`h-4 w-2/6 bg-white/20`})]})})})]})},cYt=({build:e})=>(0,W.jsx)(`div`,{className:`p-4 w-full`,children:(0,W.jsx)(oYt,{deployment:e,defaultOpen:!0})}),lYt=()=>{let[e,t]=FA(`build`);HJt();let{environment:n}=oh([`account`,`project`,`environment`]),{data:r}=Gj(n.name),i=r?.data?.find(t=>t.id===e);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(aN,{}),(0,W.jsxs)(iN,{className:`min-h-36 shadow-[rgb(215_215_215/15%)_0px_-4px_3px_0px] dark:shadow-[rgb(0_0_0/40%)_0px_-4px_3px_0px]`,defaultSize:30,children:[(0,W.jsxs)(`div`,{className:`flex gap-2 border-b h-8 items-center justify-between group bg-surface-muted px-3`,children:[(0,W.jsx)(`div`,{className:`divide-neutral-200`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 group rounded-none relative text-xs font-medium`,title:e,children:[(0,W.jsx)(Pre,{size:16}),e?`Build ${e.slice(0,8)}`:`Builds`]})}),(0,W.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[(0,W.jsx)(UJt,{}),(0,W.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(void 0),children:(0,W.jsx)($m,{size:18})})]})]}),(0,W.jsxs)(`div`,{className:`h-[calc(100%-2rem)]`,children:[r?.data?.length===0&&(0,W.jsx)(`div`,{className:`p-3 text-sm`,children:`Start changing your local copy to see build information.`}),(0,W.jsxs)(`div`,{className:`divide-x grid grid-cols-[min-content_1fr] w-full h-full`,children:[(0,W.jsx)(`div`,{className:`overflow-y-auto`,children:r?.data?.map(n=>(0,W.jsx)(zJt,{item:n,isSelected:n.id===e,onSelect:()=>t(n.id)},`${n.id}`))}),(0,W.jsx)(`div`,{className:`overflow-y-auto`,children:e&&i?(0,W.jsx)(cYt,{build:i}):(0,W.jsx)(`div`,{className:`p-3 text-sm`,children:`Select a build to view more information.`})})]})]})]})]})};function m7(e,t){return e.filter(e=>e.isActive?.(t)??!0)}function uYt(e,t){return e.findIndex(e=>e.id===t)}function dYt(e,t){return m7(e,t)[0]?.id??e[0]?.id??``}function fYt(e,t){let n=e.initialAnswers(t);return{answers:n,currentStepId:dYt(e.steps,n),history:[],tasks:{},status:`active`}}function pYt(e,t,n){let r=m7(e,t);if(r.some(e=>e.id===n))return n;let i=e.findIndex(e=>e.id===n),a=new Set(r.map(e=>e.id));for(let t=i;t>=0;t--)if(a.has(e[t].id))return e[t].id;return r[0]?.id??n}function mYt(e,t,n){switch(n.type){case`PATCH_ANSWERS`:{let r={...t.answers,...n.partial};return{...t,answers:r,currentStepId:pYt(e,r,t.currentStepId)}}case`NEXT`:{let n=m7(e,t.answers),r=n[uYt(n,t.currentStepId)+1];return r?{...t,currentStepId:r.id,history:[...t.history,t.currentStepId]}:t}case`BACK`:{let n=t.history[t.history.length-1];return n===void 0?t:{...t,currentStepId:pYt(e,t.answers,n),history:t.history.slice(0,-1)}}case`GOTO`:return!m7(e,t.answers).some(e=>e.id===n.stepId)||n.stepId===t.currentStepId?t:{...t,currentStepId:n.stepId,history:[...t.history,t.currentStepId]};case`SET_TASK`:return{...t,tasks:{...t.tasks,[n.stepId]:n.task}};case`COMPLETE`:return{...t,status:`completed`};case`RESET`:return{answers:n.answers,currentStepId:n.firstStepId,history:[],tasks:{},status:`active`};default:return t}}function hYt({selected:e,onClick:t,title:n,description:r,icon:i,indicator:a=`radio`,role:o,disabled:s,className:c}){return(0,W.jsxs)(`button`,{type:`button`,onClick:t,disabled:s,role:o,"aria-checked":o?e:void 0,"aria-pressed":o?void 0:e,className:G(`flex w-full flex-col items-start gap-1 rounded-md border bg-surface p-4 text-left transition-colors`,s?`cursor-not-allowed opacity-50`:`cursor-pointer hover:border-neutral-300 dark:hover:border-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-800`,e&&!s&&`border-zuplo-500 bg-zuplo-50/30 hover:bg-zuplo-50/30`,c),children:[(0,W.jsxs)(`div`,{className:`flex w-full items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i&&(0,W.jsx)(`div`,{className:G(`rounded-md border p-1.5`,e?`border-zuplo-500 text-zuplo-500`:`text-foreground`),children:i}),(0,W.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:n})]}),a!==`none`&&(0,W.jsx)(gYt,{kind:a,selected:e})]}),r&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})}function gYt({kind:e,selected:t}){return e===`checkbox`?(0,W.jsx)(`span`,{className:G(`flex size-4 shrink-0 items-center justify-center rounded border-2`,t?`border-zuplo-500 bg-zuplo-500 text-white`:`border-neutral-300 dark:border-neutral-600`),children:t&&(0,W.jsx)(mm,{size:12,strokeWidth:3})}):(0,W.jsx)(`span`,{className:G(`size-4 shrink-0 rounded-full border-2`,t?`border-zuplo-500 bg-zuplo-500 ring-2 ring-inset ring-white`:`border-neutral-300 dark:border-neutral-600`)})}var _Yt=e=>G(`grid gap-3`,e===1&&`grid-cols-1`,e===2&&`grid-cols-1 sm:grid-cols-2`,e===3&&`grid-cols-1 sm:grid-cols-3`);function vYt({value:e,onChange:t,options:n,columns:r=1}){return(0,W.jsx)(`div`,{className:_Yt(r),role:`radiogroup`,children:n.map(n=>(0,W.jsx)(hYt,{selected:e===n.value,onClick:()=>t(n.value),title:n.title,description:n.description,icon:n.icon,disabled:n.disabled,indicator:`radio`,role:`radio`},n.value))})}function yYt({values:e,onChange:t,options:n,columns:r=1}){let i=n=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n]);return(0,W.jsx)(`div`,{className:_Yt(r),children:n.map(t=>(0,W.jsx)(hYt,{selected:e.includes(t.value),onClick:()=>i(t.value),title:t.title,description:t.description,icon:t.icon,disabled:t.disabled,indicator:`checkbox`,role:`checkbox`},t.value))})}var bYt=`sm:max-w-2xl p-0 gap-0 flex max-h-[85vh] flex-col overflow-hidden`,xYt=`flex-1 min-h-0 overflow-y-auto px-6 py-5 flex flex-col gap-4`;function SYt({label:e,className:t}){return(0,W.jsxs)(`output`,{className:G(`flex items-center gap-3 rounded-md border bg-neutral-50 px-4 py-3 text-sm text-neutral-700`,t),children:[(0,W.jsx)(Hm,{className:`size-4 shrink-0 animate-spin text-zuplo-500`}),(0,W.jsx)(`span`,{children:e??`Working…`})]})}function CYt({message:e,onRetry:t,retryable:n=!0}){return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm`,role:`alert`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(Qm,{className:`mt-0.5 size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`font-medium`,children:e})]}),n&&(0,W.jsx)(`div`,{children:(0,W.jsx)(Y,{size:`sm`,variant:`outline`,onClick:t,children:`Try again`})})]})}function h7({children:e}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-emerald-700`,children:[(0,W.jsx)(Sm,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{children:e})]})}function wYt({steps:e,currentIndex:t}){return e.length<=1?null:(0,W.jsx)(`ol`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden`,children:e.map((n,r)=>{let i=r<t,a=r===t;return(0,W.jsxs)(`li`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:G(`flex size-5 shrink-0 items-center justify-center rounded-full border text-[11px] font-medium`,i&&`border-zuplo-500 bg-zuplo-500 text-white`,a&&`border-zuplo-500 text-zuplo-600`,!i&&!a&&`border-neutral-300 text-neutral-400`),children:i?(0,W.jsx)(mm,{size:12,strokeWidth:3}):r+1}),a&&(0,W.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-foreground`,children:n.title}),r<e.length-1&&(0,W.jsx)(`span`,{className:`h-px w-3 shrink-0 bg-border`,"aria-hidden":!0})]},n.id)})})}var g7={status:`pending`},TYt={status:`skipped`},EYt=e=>({status:`applied`,result:e}),DYt=1;function _7(e,t){return`zpl_wizard:${e}:${t.account}/${t.project}/${t.environment}`}function v7(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}function OYt(e,t,n){let r=v7();if(!r)return;let i=r.getItem(_7(e,t));if(i)try{let e=JSON.parse(i);if(e.v!==DYt)return;let t=m7(n,e.answers),r=t.some(t=>t.id===e.currentStepId)?e.currentStepId:t[0]?.id??e.currentStepId;return{answers:e.answers,currentStepId:r,history:e.history??[],tasks:e.tasks??{},status:e.status??`active`}}catch{return}}function kYt(e,t,n){let r=v7();if(!r)return;let i={v:DYt,answers:n.answers,currentStepId:n.currentStepId,history:n.history,tasks:Object.fromEntries(Object.entries(n.tasks).filter(([,e])=>e.state!==`running`)),status:n.status};try{r.setItem(_7(e,t),JSON.stringify(i))}catch{}}function AYt(e,t){v7()?.removeItem(_7(e,t))}function jYt(e){return e instanceof Error?e.message:typeof e==`string`?e:`Something went wrong`}function MYt(e,t,n){let{id:r,steps:i}=e,[a,o]=(0,g.useReducer)((0,g.useCallback)((e,t)=>mYt(i,e,t),[i]),void 0,()=>OYt(r,t,i)??fYt(e,t)),s=(0,g.useRef)(a);s.current=a;let c=(0,g.useRef)(n);c.current=n,(0,g.useEffect)(()=>{kYt(r,t,a)},[r,t,a]);let l=(0,g.useMemo)(()=>m7(i,a.answers),[i,a.answers]),u=uYt(l,a.currentStepId),d=l[u],f=(0,g.useCallback)(e=>{o({type:`PATCH_ANSWERS`,partial:e})},[]),p=(0,g.useRef)(null),m=(0,g.useRef)(null),h=(0,g.useRef)(new Set),_=(0,g.useCallback)(async(e,t,n)=>{m.current={stepId:e.id,kind:t},o({type:`SET_TASK`,stepId:e.id,task:{state:`running`}}),p.current?.abort();let r=new AbortController;p.current=r;try{return await n({answers:s.current.answers,patch:f,signal:r.signal,setProgress:t=>o({type:`SET_TASK`,stepId:e.id,task:{state:`running`,progress:t}}),services:c.current}),o({type:`SET_TASK`,stepId:e.id,task:{state:`idle`}}),!0}catch(t){return o({type:`SET_TASK`,stepId:e.id,task:{state:`error`,error:jYt(t),retryable:!0}}),!1}},[f]),v=(0,g.useCallback)(e=>i.find(t=>t.id===e),[i]),y=(0,g.useCallback)(()=>{let e=s.current;return m7(i,e.answers).find(t=>t.id===e.currentStepId)},[i]),b=(0,g.useCallback)(async()=>{let e=y();e&&(e.onExit&&!await _(e,`exit`,e.onExit)||o({type:`NEXT`}))},[y,_]),x=(0,g.useCallback)(()=>o({type:`BACK`}),[]),S=(0,g.useCallback)(()=>{let e=y();e?.onSkip&&o({type:`PATCH_ANSWERS`,partial:e.onSkip(s.current.answers)}),o({type:`NEXT`})},[y]),C=(0,g.useCallback)(e=>o({type:`GOTO`,stepId:e}),[]),w=(0,g.useCallback)(()=>{let e=m.current;if(!e)return;let t=v(e.stepId);t&&(e.kind===`exit`?b():t.onEnter&&_(t,`enter`,t.onEnter))},[b,_,v]),T=(0,g.useCallback)(()=>{AYt(r,t),h.current.clear();let n=fYt(e,t);o({type:`RESET`,answers:n.answers,firstStepId:n.currentStepId})},[e,r,t]),E=(0,g.useCallback)(()=>{AYt(r,t),o({type:`COMPLETE`})},[r,t]);(0,g.useEffect)(()=>{if(!d?.onEnter||h.current.has(d.id))return;let e=a.tasks[d.id];e?.state===`running`||e?.state===`error`||(h.current.add(d.id),_(d,`enter`,d.onEnter))},[d,_,a.tasks]);let D=d?.canAdvance?.(a.answers)??!0;return{answers:a.answers,patch:f,currentStep:d,activeSteps:l,index:u,isFirst:u<=0,isLast:u===l.length-1,progress:{current:u+1,total:l.length},canAdvance:D===!0,advanceBlockedReason:D===!0?void 0:D,task:d?a.tasks[d.id]:void 0,status:a.status,next:b,back:x,skip:S,goTo:C,retry:w,reset:T,complete:E}}var NYt=(0,g.createContext)(null),PYt=NYt.Provider;function y7(){let e=(0,g.useContext)(NYt);if(!e)throw Error(`useWizard must be used within a <WizardShell>`);return e}function FYt({showBack:e,isLast:t,canAdvance:n,blockedReason:r,skippable:i,busy:a,nextLabel:o,skipLabel:s,onBack:c,onSkip:l,onNext:u,onFinish:d}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-6 py-4`,children:[e&&(0,W.jsx)(Y,{variant:`outline`,onClick:c,disabled:a,children:`Back`}),(0,W.jsx)(`div`,{className:`flex-1`}),i&&(0,W.jsx)(Y,{variant:`ghost`,onClick:l,disabled:a,children:s??`Skip`}),(0,W.jsxs)(Y,{variant:`brand`,onClick:t?d:u,disabled:a||!n,title:n?void 0:r,children:[a&&(0,W.jsx)(Hm,{className:`size-4 animate-spin`}),o??(t?`Finish`:`Continue`)]})]})}function IYt({definition:e,launch:t,services:n,onClose:r,onComplete:i}){let a=MYt(e,t,n),{currentStep:o,activeSteps:s,index:c,isFirst:l,task:u,status:d,answers:f}=a,p=u?.state===`running`;if((0,g.useEffect)(()=>{d===`completed`&&i(f)},[d,f,i]),!o||d===`completed`)return null;let m=o.Component;return(0,W.jsx)(PYt,{value:a,children:(0,W.jsx)(bA,{open:!0,onOpenChange:e=>{!e&&!p&&r()},children:(0,W.jsxs)(CA,{className:bYt,showCloseButton:!p,onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,W.jsxs)(wA,{className:`shrink-0 gap-2 border-b px-6 py-4`,children:[(0,W.jsx)(EA,{children:e.title}),o.description&&(0,W.jsx)(DA,{children:o.description}),(0,W.jsx)(`div`,{className:`pt-1`,children:(0,W.jsx)(wYt,{steps:s,currentIndex:c})})]}),(0,W.jsxs)(`div`,{className:xYt,children:[(0,W.jsx)(m,{}),!o.ownsStatus&&u?.state===`running`&&(0,W.jsx)(SYt,{label:u.progress?.label}),!o.ownsStatus&&u?.state===`error`&&(0,W.jsx)(CYt,{message:u.error,retryable:u.retryable,onRetry:a.retry})]}),(0,W.jsx)(FYt,{showBack:!l&&!o.isFinal,isLast:a.isLast,canAdvance:a.canAdvance,blockedReason:a.advanceBlockedReason,skippable:o.skippable,busy:p,nextLabel:o.nextLabel,skipLabel:o.skipLabel,onBack:a.back,onSkip:a.skip,onNext:a.next,onFinish:a.complete})]})})})}var LYt=`api-key-inbound`,RYt=`rate-limit-inbound`,zYt={second:1/60,"10s":1/6,"30s":.5,minute:1},BYt={second:`second`,"10s":`10 seconds`,"30s":`30 seconds`,minute:`minute`};function VYt(){return{name:LYt,policyType:`api-key-inbound`,handler:{export:`ApiKeyInboundPolicy`,module:`$import(@zuplo/runtime)`,options:{allowUnauthenticatedRequests:!1,cacheTtlSeconds:60}}}}function HYt(e){return{name:RYt,policyType:`rate-limit-inbound`,handler:{export:`RateLimitInboundPolicy`,module:`$import(@zuplo/runtime)`,options:{rateLimitBy:e.rateLimitBy,requestsAllowed:e.requests,timeWindowMinutes:zYt[e.period]}}}}var UYt=async({answers:e,patch:t,services:n,setProgress:r})=>{if(e.apiKey.status===`applied`)return;let{keyName:i,managerEmail:a}=e.apiKeyDraft;r({label:`Creating your API key consumer…`});let{created:o}=await n.createConsumer({keyName:i,managerEmail:a});t({apiKey:EYt({keyName:i,managerEmail:a,consumerCreated:o,policyName:LYt})})};function WYt(e,t){if(t.selectedPolicies.includes(`api-key`)&&e.commitPolicyToAllRoutes(VYt()),t.selectedPolicies.includes(`rate-limit`)){let n=t.selectedPolicies.includes(`api-key`)?`user`:`ip`;e.commitPolicyToAllRoutes(HYt({requests:t.rateLimitDraft.requests,period:t.rateLimitDraft.period,rateLimitBy:n}))}}async function GYt(e,t=4){for(let n=1;n<=t;n++)try{return await e.save()}catch(e){if(n===t)throw e;await new Promise(e=>setTimeout(e,2**(n-1)*500))}return{}}var KYt=()=>{let e=oh(),t=tO(e.environment);return{deploymentDevPortalUrl:tO(e.environment,`dev-portal`),deploymentUrl:t?new URL(t).toString().replace(/\/$/,``):void 0}};function qYt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add gateway policies to your endpoints. There are many more you can add manually later.`}),(0,W.jsx)(yYt,{values:e.selectedPolicies,onChange:e=>t({selectedPolicies:e}),options:[{value:`api-key`,title:`API Key Authentication`,description:`Arguably the best authentication method for B2B APIs — used by the greats like Stripe, OpenAI, and more.`},{value:`rate-limit`,title:`Rate Limiting`,description:`Protect your API from accidental misuse — the most common, and unprotected, form of DoS you'll face.`}]})]})}function JYt(){let{answers:e,patch:t}=y7(),{keyName:n,managerEmail:r}=e.apiKeyDraft;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We'll create an API key in your development environment so you can test right away.`}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Key name`}),(0,W.jsx)(dV,{value:n,placeholder:`test-key`,onChange:n=>t({apiKeyDraft:{...e.apiKeyDraft,keyName:n.target.value}})})]}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Manager email`}),(0,W.jsx)(dV,{type:`email`,value:r,onChange:n=>t({apiKeyDraft:{...e.apiKeyDraft,managerEmail:n.target.value}})})]}),e.apiKey.status===`applied`&&(0,W.jsx)(h7,{children:e.apiKey.result.consumerCreated?`API key consumer created.`:`API key policy added — you can create a consumer later from Services.`})]})}var YYt=[`minute`,`30s`,`10s`,`second`];function XYt(){let{answers:e,patch:t}=y7(),{period:n,requests:r}=e.rateLimitDraft;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Period`}),(0,W.jsxs)(iW,{value:n,onValueChange:n=>t({rateLimitDraft:{...e.rateLimitDraft,period:n}}),children:[(0,W.jsx)(oW,{className:`w-48`,children:(0,W.jsx)(aW,{})}),(0,W.jsx)(sW,{children:YYt.map(e=>(0,W.jsx)(cW,{value:e,children:e===`minute`?`Minute`:e===`second`?`Second`:BYt[e]},e))})]})]}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Requests per `,BYt[n],` allowed`]}),(0,W.jsx)(dV,{type:`number`,min:1,hideNumberArrows:!0,className:`w-48`,value:Number.isFinite(r)?r:``,onChange:n=>t({rateLimitDraft:{...e.rateLimitDraft,requests:Number(n.target.value)}})})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It's more fun to test with a low count per minute — you can change this later. (For sub-minute periods we convert to a fractional window.)`})]})}var ZYt=[`api`,`dev-portal`];function QYt(){let e=oh([`environment`]),{answers:t,task:n,retry:r}=y7(),{deploymentDevPortalUrl:i}=KYt(),a=t.saved.status===`applied`,o=n?.state===`error`,s=b_(Wj(e.environment.name,{refetchInterval:4e3})).data?.data?.at(-1)?.stages??[],c=s.find(e=>e.stage===`dev-portal`),l=s.some(e=>e.status===`failed`),u=a&&!l&&c?.status===`success`,d=c?.url??i;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(h7,{children:`Your gateway is configured.`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border bg-neutral-50 px-4 py-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[o||l?(0,W.jsx)(Qm,{className:`size-4 shrink-0 text-destructive`}):u?(0,W.jsx)(Sm,{className:`size-4 shrink-0 text-emerald-600`}):(0,W.jsx)(Hm,{className:`size-4 shrink-0 animate-spin text-zuplo-500`}),o?`Couldn't save your changes`:a?l?`The deploy hit a problem`:u?`Your developer portal is ready`:`Building your developer portal…`:`Saving your changes…`]}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:ZYt.map(e=>(0,W.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,W.jsx)(Dz,{status:s.find(t=>t.stage===e)?.status??`in-progress`}),(0,W.jsx)(Ez,{stage:e})]},e))})]}),u&&d?(0,W.jsx)(Y,{asChild:!0,size:`lg`,variant:`outline`,className:`border-zuplo-500 bg-white font-bold text-blue-600 hover:bg-blue-50 hover:text-blue-700`,children:(0,W.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,children:[`Open developer portal`,(0,W.jsx)(Am,{size:16})]})}):o?(0,W.jsx)(Y,{variant:`outline`,size:`lg`,onClick:r,children:`Retry saving your changes`}):(0,W.jsxs)(Y,{variant:`outline`,size:`lg`,disabled:!0,children:[(0,W.jsx)(Hm,{className:`size-4 animate-spin`}),`Saving your changes…`]})]})}function $Yt(e){return{apiTypes:[],rest:g7,graphqlUrl:`https://api.rickandmorty.zuplo.io/v1/graphql`,graphql:g7,mcpUrl:`https://api.rickandmorty.zuplo.io/v1/mcp`,mcp:g7,selectedPolicies:[],apiKeyDraft:{keyName:`test-key`,managerEmail:e},rateLimitDraft:{period:`minute`,requests:1},apiKey:g7,rateLimit:g7,saved:g7,committed:!1}}var eXt=`/graphql`,tXt=`/mcp`;function b7(e){try{let t=new URL(e.trim());return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function x7(e,t,n){return e.openApiManager.operationArray?.some(e=>e.additionalOperationContext.path===t&&e.additionalOperationContext.method===n)??!1}async function nXt(e,t){let n=e.openApiManager;if(t.restMode===`import`&&t.restImport)n.updateOpenApiData(t.restImport.doc);else if(t.restMode===`todo-template`)for(let t of G5e())x7(e,t.path,t.method)||n.addOperation(t.path,t.method,t.operation,{avoidConflict:!0});t.apiTypes.includes(`GraphQL`)&&t.graphql.status!==`skipped`&&b7(t.graphqlUrl)&&!x7(e,`/graphql`,`post`)&&(yW(e.policyManager),n.addOperation(eXt,`post`,H5e(t.graphqlUrl.trim()),{avoidConflict:!0})),t.apiTypes.includes(`MCP`)&&t.mcp.status!==`skipped`&&b7(t.mcpUrl)&&!x7(e,`/mcp`,`post`)&&(n.addOperation(tXt,`post`,U5e({url:t.mcpUrl.trim()}),{avoidConflict:!0}),await e.ensureMcpRuntime())}var rXt=async({answers:e,patch:t,services:n,setProgress:r})=>{if(e.saved.status===`applied`)return;r({label:`Saving your changes…`}),e.committed||(await nXt(n,e),WYt(n,e),t({committed:!0}));let{buildId:i}=await GYt(n);t({saved:EYt({buildId:i})})};function S7(e){let t=e.restMode===`import`&&!!e.restImport||e.restMode===`todo-template`,n=e.apiTypes.includes(`GraphQL`)&&e.graphql.status!==`skipped`&&b7(e.graphqlUrl),r=e.apiTypes.includes(`MCP`)&&e.mcp.status!==`skipped`&&b7(e.mcpUrl);return t||n||r}var iXt=`50`,aXt=[`JSON`,`YML`,`YAML`];function oXt({onFileParsed:e,disabled:t}){let[n,r]=(0,g.useState)();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(e2e,{handleChange:async t=>{r(void 0);try{let n=await g6e(t);e(t.name,n)}catch(e){r(e instanceof Error?e.message:`Could not parse the file.`)}},name:`file`,types:aXt,maxSize:iXt,disabled:t,children:(0,W.jsxs)(`div`,{className:G(`flex h-40 w-full flex-col items-center justify-center gap-1 rounded-md border border-dashed border-neutral-400 bg-neutral-50 text-sm`,t?`opacity-50`:`cursor-pointer`),children:[(0,W.jsx)(`div`,{children:`Drag your OpenAPI file here, or click to choose.`}),(0,W.jsxs)(`div`,{className:`text-muted-foreground`,children:[`JSON, YML and YAML are supported (max `,iXt,`MB).`]})]})}),n&&(0,W.jsxs)(`div`,{className:`text-sm text-destructive`,children:[`Parsing error: `,n]})]})}function sXt({name:e,doc:t}){let n=nV(e,t.paths);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`text-sm`,children:[`Importing `,(0,W.jsx)(`span`,{className:`font-medium`,children:e}),` —`,` `,n.length,` operation`,n.length===1?``:`s`,`.`]}),(0,W.jsx)(`div`,{className:`flex max-h-72 flex-col gap-2 overflow-y-auto rounded-md bg-neutral-50 p-3 text-sm`,children:n.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`w-14 shrink-0`,children:(0,W.jsx)(oV,{method:e.additionalOperationContext.method,className:`px-0`})}),(0,W.jsx)(`span`,{className:`truncate`,children:e.additionalOperationContext.path})]},`${e.additionalOperationContext.method}-${e.additionalOperationContext.path}`))})]})}var cXt=(e,t)=>`z${e}-${t}`.toLowerCase().replaceAll(`_`,`-`),lXt=(e,t)=>hj(X.projects(e),{throwOnError:!0,extractData:!0,...t}),uXt=e=>vFe(e.map(e=>X.projects(e)),{extractData:!0}),dXt=(e,t)=>hj(X.project(e,t)),fXt=(e,t)=>{let n=fj();return S_({mutationFn:async()=>{await n.fetch(dj.projects.deleteProject(e,t))}})},pXt=e=>{let t=fj();return S_({mutationFn:async n=>{await t.fetch(dj.projects.createRepoFromProject(e,n.projectName,n.orgName,n.repositoryName,n.defaultBranch,n.otherParams))}})},mXt=(e,t)=>{let n=fj();return S_({mutationFn:async r=>await n.fetch(dj.projects.connectProjectToRepo(e,t,r.orgName,r.repositoryURL,r.defaultBranch,r.forceConnect))})},hXt=(e,t)=>{let n=fj();return S_({mutationFn:async()=>{await n.fetch(dj.projects.disconnectProjectFromRepo(e,t))}})},gXt=(e,t)=>{let n=fj();return S_({mutationFn:async r=>{await n.fetch(dj.projects.updateDefaultBranch({accountName:e,projectName:t,defaultBranch:r.defaultBranch,sourceRepoUrl:r.sourceRepoUrl}))}})};function _Xt(e,t){return`https://dev.zuplo.com/v1/accounts/${e}/key-buckets/${t}`}var vXt=()=>{let e=oh([`account`,`project`]),t=dXt(e.account.name,e.project.name),n=e.project.id;return{...t,data:t.data?.defaultConfiguration.flatMap(t=>t.apiKeyBucket?{name:cXt(e.project.id,t.environmentType),id:t.apiKeyBucket,url:_Xt(n,cXt(n,t.environmentType)),env:t.environmentType}:[]).sort((e,t)=>t.env.localeCompare(e.env))}},yXt=()=>{let e=fj(),t=Hj();return S_({mutationFn:t=>e.fetch(dj.consumers.createConsumer(t)),onSuccess:()=>t.onSuccess(`Consumer created`),onError:t.onError})},bXt=`/config/routes.oas.json`,xXt=`/config/policies.json`,SXt=`/modules/zuplo.runtime.ts`;function CXt(){let e=ch.getState(),t=[];for(let n of e.projectTreeNodes){let r=n.path?e.filesByPath[n.path]:void 0;r&&r.saveState===$r.modified&&t.push(r)}return t}var wXt=(0,g.createContext)(null),TXt=wXt.Provider;function EXt(){let e=(0,g.useContext)(wXt);if(!e)throw Error(`useApiGatewayServices must be used within an ApiGatewayServicesProvider`);return e}function DXt(){let e=oh([`account`,`project`,`environment`]),{email:t}=xoe(),n=Mj(bXt),r=Mj(xXt),i=Mj(SXt),a=jj(),o=yXt(),s=Dj(),c=kj(),{editStrategies:l}=kX(),u=vXt(),d=(0,g.useMemo)(()=>n&&n.content!==void 0?new iV(n,a):void 0,[n,a]),f=(0,g.useMemo)(()=>r&&r.content!==void 0&&n&&n.content!==void 0?new xW(r,[n],a):void 0,[r,n,a]),p=e.account.name,m=e.project.name,h=e.environment.name,_=u.data?.find(e=>e.env===MA.WORKING_COPY)?.id;return(0,g.useMemo)(()=>!d||!f?null:{openApiManager:d,policyManager:f,userEmail:t??``,allOperationIdentifiers:()=>f.getAllOperations().map(e=>({filePath:e.additionalOperationContext.oasFilePath,path:e.additionalOperationContext.path,method:e.additionalOperationContext.method})),createConsumer:async({keyName:e,managerEmail:t})=>_?(await o.mutateAsync({bucketId:_,accountName:p,projectName:m,environmentType:MA.WORKING_COPY,consumer:{sub:e,externalUsers:[{email:t}]}}),{created:!0}):{created:!1},ensureMcpRuntime:async()=>{if(i?.content!==void 0)return;let e=l.find(e=>e.folderName===`/modules`&&`createExtensions`in e);e&&await c(`zuplo.runtime`,`/modules`,void 0,e,Q5e)},save:async()=>{let e=CXt();return e.length===0?{}:{buildId:(await s.mutateAsync({environmentName:h,accountName:p,projectName:m,files:e})).buildId}},commitPolicyToAllRoutes:e=>{let t=ch.getState(),n=t.filesByPath[bXt],r=t.filesByPath[xXt];if(!n||!r)return;let i=new xW(r,[n],a),o=i.getAllOperations().map(e=>({filePath:e.additionalOperationContext.oasFilePath,path:e.additionalOperationContext.path,method:e.additionalOperationContext.method}));i.getPolicyListEnforced().some(t=>t.name===e.name)?i.applyPolicy(e.name,o):i.createPolicy(e,o)}},[d,f,t,_,i,a,l,c,o,s,p,m,h])}function OXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`What types of endpoints do you want to manage (add auth, rate-limiting, monetization, etc.)?`}),(0,W.jsx)(yYt,{values:e.apiTypes,onChange:e=>t({apiTypes:e}),options:[{value:`REST`,title:`REST or RESTish`,description:`Traditional endpoints with GET, POST, PUT and basic HTTP semantics.`},{value:`GraphQL`,title:`GraphQL`,description:`A GraphQL POST endpoint.`},{value:`MCP`,title:`MCP Servers`,description:`MCP servers for use by AI.`}]})]})}function kXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`How do you want to set up your endpoints?`}),(0,W.jsx)(vYt,{value:e.restMode,onChange:e=>t({restMode:e}),options:[{value:`import`,title:`Import an OpenAPI / Swagger document`,description:`Bring your existing API definition.`},{value:`todo-template`,title:`Start from a simple TODO template`,description:`A small REST CRUD API to explore.`},{value:`manual`,title:`Nothing, I'll add routes manually`,description:`Start empty and add routes yourself.`}]})]})}function AXt(){let{answers:e,patch:t}=y7(),n=EXt(),r=e.restImport;return r?(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your OpenAPI document is ready to review.`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-neutral-50 px-4 py-3 text-sm`,children:[(0,W.jsxs)(`span`,{children:[`Selected `,(0,W.jsx)(`span`,{className:`font-medium`,children:r.name}),` —`,` `,r.operationCount,` operation`,r.operationCount===1?``:`s`,`.`]}),(0,W.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t({restImport:void 0}),children:`Choose a different file`})]})]}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Upload your OpenAPI / Swagger document — we'll show you what gets imported on the next step.`}),(0,W.jsx)(oXt,{onFileParsed:(e,r)=>{let i=D6e(r,new Set(n.openApiManager.operationArray?.map(e=>e.operationId).filter(e=>!!e))),a=nV(e,i.paths).length;t({restImport:{name:e,doc:i,operationCount:a}})}})]})}function jXt(){let{answers:e}=y7(),t=e.restImport;return t?(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Review the operations that will be added to your gateway, then continue.`}),(0,W.jsx)(sXt,{name:t.name,doc:t.doc})]}):(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No file selected — go back and upload an OpenAPI document.`})}function MXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`What is the URL of your GraphQL endpoint?`}),(0,W.jsx)(dV,{value:e.graphqlUrl,placeholder:`https://example.com/graphql`,onChange:e=>t({graphqlUrl:e.target.value})})]}),e.graphql.status===`applied`&&(0,W.jsxs)(h7,{children:[`GraphQL endpoint added at `,e.graphql.result.path,`.`]})]})}function NXt(){let{answers:e,patch:t}=y7();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`What is the URL of your MCP server?`}),(0,W.jsx)(dV,{value:e.mcpUrl,placeholder:`https://example.com/mcp`,onChange:e=>t({mcpUrl:e.target.value})})]}),e.mcp.status===`applied`&&(0,W.jsxs)(h7,{children:[`MCP endpoint added at `,e.mcp.result.path,`.`]})]})}var PXt=/.+@.+\..+/,FXt={id:`api-gateway-basic`,title:`Set up your API gateway`,initialAnswers:e=>$Yt(String(e.params.userEmail??``)),steps:[{id:`api-types`,title:`API types`,Component:OXt,canAdvance:e=>e.apiTypes.length>0||`Pick at least one API type`},{id:`rest-setup`,title:`REST`,isActive:e=>e.apiTypes.includes(`REST`),Component:kXt,canAdvance:e=>e.restMode?!0:`Choose how to set up your endpoints`},{id:`rest-import-upload`,title:`Upload`,isActive:e=>e.apiTypes.includes(`REST`)&&e.restMode===`import`,Component:AXt,canAdvance:e=>e.restImport?!0:`Upload an OpenAPI file to continue`},{id:`rest-import-review`,title:`Review`,isActive:e=>e.apiTypes.includes(`REST`)&&e.restMode===`import`,Component:jXt,canAdvance:e=>e.restImport?!0:`Upload an OpenAPI file first`},{id:`graphql-url`,title:`GraphQL`,isActive:e=>e.apiTypes.includes(`GraphQL`),Component:MXt,skippable:!0,skipLabel:`I'll add it manually`,onSkip:()=>({graphql:TYt}),canAdvance:e=>b7(e.graphqlUrl)||`Enter a valid URL, or skip`},{id:`mcp-url`,title:`MCP`,isActive:e=>e.apiTypes.includes(`MCP`),Component:NXt,skippable:!0,skipLabel:`I'll add it manually`,onSkip:()=>({mcp:TYt}),canAdvance:e=>b7(e.mcpUrl)||`Enter a valid URL, or skip`},{id:`policies`,title:`Policies`,isActive:S7,Component:qYt},{id:`api-key`,title:`API Key`,isActive:e=>S7(e)&&e.selectedPolicies.includes(`api-key`),Component:JYt,canAdvance:e=>e.apiKeyDraft.keyName.trim().length>0&&PXt.test(e.apiKeyDraft.managerEmail)||`Enter a key name and a valid manager email`,onExit:UYt},{id:`rate-limit`,title:`Rate limiting`,isActive:e=>S7(e)&&e.selectedPolicies.includes(`rate-limit`),Component:XYt,canAdvance:e=>e.rateLimitDraft.requests>=1||`Enter at least 1 request`},{id:`success`,title:`Done`,Component:QYt,isFinal:!0,nextLabel:`Go to my project`,onEnter:rXt,ownsStatus:!0,canAdvance:e=>!S7(e)||e.saved.status===`applied`||`Saving your changes…`}]},IXt={[FXt.id]:FXt},LXt=`wizard`;function RXt(){let[e]=FA(LXt);return e?(0,W.jsx)(zXt,{wizardId:e}):null}function zXt({wizardId:e}){let t=oh([`account`,`project`,`environment`]),n=DXt(),[,r]=FA(LXt),i=IXt[e];if(!i||!n)return null;let a={params:{userEmail:n.userEmail},account:t.account.name,project:t.project.name,environment:t.environment.name},o=()=>r(void 0);return(0,W.jsx)(TXt,{value:n,children:(0,W.jsx)(IYt,{definition:i,launch:a,services:n,onClose:o,onComplete:o})})}var BXt=`/modules/zuplo.runtime.ts`,VXt=`editor-file-tree-open`;function HXt(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(VXt);if(e===null)return null;let t=JSON.parse(e);return typeof t==`boolean`?t:null}catch{return null}}function UXt(){let e=oh(),{editStrategies:t}=kX(),[n,r]=FA(`path`),[i]=FA(`build`),{monaco:a,reloadFiles:o}=S1(),s=AA(o.execute),c=e.environment.name,{isReadOnly:l}=NA(),[u,d]=(0,g.useState)(HXt),f=u??!1,p=e=>{d(e);try{window.localStorage.setItem(VXt,JSON.stringify(e))}catch{}},m=ch(e=>e.projectTreeNodes),h=ch(e=>e.setPendingNewFile),_=`${e.account.name}/${e.project.name}/${e.environment.name}`,[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(_);b!==_&&(x(_),y(!1)),(0,g.useEffect)(()=>{if(v)return;if(n){y(!0);return}if(m.length===0)return;let e=m.find(e=>e.path&&Lie.test(e.path));y(!0),e&&r(e.path)},[n,m,r,v]);let S=m.some(e=>e.path===BXt),C=m.length===0,w=!n&&(C||!v),T=(e,t)=>{p(!0),h({strategyFolder:e,template:t})},{isError:E,error:D}=b_({queryKey:[`reloadFiles`,e.account.name,e.project.name,e.environment.name],queryFn:async({signal:t})=>(await s.current({accountName:e.account.name,projectName:e.project.name,environmentName:e.environment.name},t),!0),refetchOnWindowFocus:!1,enabled:!!a&&!!c});if(E&&D instanceof Ff)return(0,W.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,W.jsxs)(jS,{className:`max-w-md`,children:[(0,W.jsx)(MS,{children:D.title}),(0,W.jsxs)(NS,{className:`flex flex-col gap-2`,children:[Bj(D),(0,W.jsx)(CDt,{})]})]})});let O=(0,W.jsxs)(rN,{direction:`vertical`,autoSaveId:`bottom-pane`,className:`relative`,children:[(0,W.jsx)(iN,{minSize:10,children:n?(0,W.jsx)(cN,{fallback:e=>(0,W.jsx)(ZQe,{...e}),children:(0,W.jsx)(WXt,{})}):w?(0,W.jsx)(GXt,{}):null}),l&&(0,W.jsx)(`a`,{href:`https://zuplo.com/docs/articles/environments`,target:`_blank`,rel:`noreferrer`,children:(0,W.jsx)(`div`,{className:`absolute mx-auto border-zuplo-200 left-0 right-0 bottom-12 bg-zuplo-100 text-zuplo-700 h-8 rounded-full shadow-md border w-36 items-center justify-center flex text-sm font-medium`,children:`Read-only`})}),i!==void 0&&(0,W.jsx)(lYt,{})]});return(0,W.jsxs)(`div`,{className:`flex h-full w-full`,children:[!f&&(0,W.jsxs)(`div`,{className:`flex flex-col items-center bg-surface-sunken border-r shrink-0 w-9 py-1.5 gap-0.5`,children:[(0,W.jsx)(C7,{label:`Expand file tree`,onClick:()=>p(!0),testId:`expand-file-tree`,children:(0,W.jsx)(oie,{size:14})}),(0,W.jsx)(`div`,{className:`my-1 h-px w-5 bg-neutral-200 dark:bg-neutral-700`,"aria-hidden":!0}),!l&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C7,{label:`New OpenAPI Spec`,onClick:()=>T(`/config`,`OpenAPI Spec`),testId:`sidebar-new-open-api-spec`,children:(0,W.jsx)(lN,{className:`size-3.5`})}),(0,W.jsx)(C7,{label:`New Module`,onClick:()=>T(`/modules`,`Request Handler`),testId:`sidebar-new-module`,children:(0,W.jsx)(Bre,{size:14})}),!S&&(0,W.jsx)(C7,{label:`New Runtime Extension`,onClick:()=>T(`/modules`,`zuplo.runtime.ts`),testId:`sidebar-new-runtime-extension`,children:(0,W.jsx)(yie,{size:14})}),(0,W.jsx)(C7,{label:`New Schema`,onClick:()=>T(`/schemas`,`Schema`),testId:`sidebar-new-schema`,children:(0,W.jsx)(wre,{size:14})})]}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`span`,{className:`text-[10px] font-medium text-neutral-500 uppercase tracking-wider select-none pb-1`,style:{writingMode:`vertical-rl`},children:`Files`})]}),f?(0,W.jsxs)(rN,{direction:`horizontal`,autoSaveId:`file-tree`,className:`flex-1 min-w-0`,children:[(0,W.jsx)(iN,{minSize:10,defaultSize:20,className:`bg-surface-sunken min-w-[270px]`,children:(0,W.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between h-10 px-2 border-b shrink-0`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium text-neutral-600 dark:text-neutral-400 uppercase tracking-wide pl-1`,children:`Files`}),(0,W.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>p(!1),"aria-label":`Collapse file tree`,title:`Collapse file tree`,children:(0,W.jsx)(aie,{size:14})})]}),(0,W.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,W.jsx)(tXe,{directoryStrategies:t})})]})}),(0,W.jsx)(aN,{}),(0,W.jsx)(iN,{minSize:70,children:O})]}):(0,W.jsx)(`div`,{className:`flex-1 min-w-0`,children:O}),(0,W.jsx)(RXt,{})]})}var WXt=()=>{let[e]=FA(`path`);if(!e)throw Error(`Invalid state - FileViewer should not be displayed if no path`);let t=e.toLowerCase();if(t===`/docs/sidebar.json`)return(0,W.jsx)(KGe,{});if(t.includes(`.oas.json`))return(0,W.jsx)(HCt,{});if(t===`/config/policies.json`)return(0,W.jsx)(QTt,{});if(t.endsWith(`.md`)||t.endsWith(`.mdx`)){let e=t.split(`/`),n=e[e.length-1];return(0,W.jsx)(GGe,{fileName:n})}return t.endsWith(`.ts`)||t.endsWith(`.css`)?(0,W.jsx)(JP,{maxHeightVh:100}):t.startsWith(`/schemas`)&&t.endsWith(`.json`)?(0,W.jsx)(JP,{}):t===`/config/dev-portal.json`?(0,W.jsxs)(`div`,{className:`size-full`,children:[(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(nEt,{})}),(0,W.jsx)(JP,{})]}):(0,W.jsx)(JP,{})},GXt=()=>(0,W.jsxs)(`div`,{className:`p-6 flex flex-col gap-2`,"data-test":`editor-loading`,children:[(0,W.jsx)(oN,{className:`w-40 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`}),(0,W.jsx)(oN,{className:`w-28 h-4`}),(0,W.jsx)(oN,{className:`w-64 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`}),(0,W.jsx)(oN,{className:`w-56 h-4`})]}),C7=({label:e,onClick:t,testId:n,children:r})=>(0,W.jsx)(Ck,{content:e,side:`right`,children:(0,W.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e,"data-test":n,className:`group flex items-center justify-center size-7 rounded-md text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:bg-neutral-200 dark:hover:bg-neutral-800 transition-colors cursor-pointer focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-zuplo-500`,children:r})});function KXt(){return(0,W.jsxs)(eMe,{children:[(0,W.jsx)(UXt,{}),(0,W.jsx)(LFe,{})]})}var qXt=`/static/img/hero-Ct8-h_EN.svg`,JXt=`/static/img/hero-dark-Z9HfvwEQ.svg`,YXt=[{label:`Monetization`,value:`monetization`,badge:`Beta`,items:[{title:`Monetization Overview`,description:`Learn more about our first-party metering and billing solution built directly into the Zuplo platform.`,icon:PR,link:{href:{web:`https://zuplo.com/docs/articles/monetization/index`,local:`https://zuplo.com/docs/articles/monetization/index`},text:`Read the docs`}},{title:`Monetization Quickstart`,description:`Get up and running with API monetization in minutes using Zuplo's built-in billing and metering.`,icon:RR,link:{href:{web:`https://zuplo.com/docs/articles/monetization/quickstart`,local:`https://zuplo.com/docs/articles/monetization/quickstart`},text:`Get Started`}},{title:`Pricing Models`,description:`Explore the different pricing models available for monetizing your APIs with Zuplo.`,icon:FR,link:{href:{web:`https://zuplo.com/docs/articles/monetization/pricing-models`,local:`https://zuplo.com/docs/articles/monetization/pricing-models`},text:`Read the docs`}}]},{label:`MCP`,value:`mcp`,items:[{title:`Installing the MCP Inspector`,description:`Set up the MCP Inspector locally and start testing your MCP server with ease.`,icon:Qqe,link:{href:{web:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`,local:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`},text:`Get Started`}},{title:`MCP Quickstart`,description:`Learn how to start using Model Context Protocol to pass context into any model call.`,icon:RR,link:{href:{web:`https://zuplo.com/docs/articles/mcp-quickstart`,local:`https://zuplo.com/docs/articles/mcp-quickstart`},text:`Get Started`}},{title:`Using OAuth with MCP`,description:`Authenticate users securely by integrating OAuth flows into your Model Context Protocol setup.`,icon:iJe,link:{href:{web:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`,local:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`},text:`Get Started`}}]},{label:`Rate Limiting`,value:`rate-limiting`,items:[{title:`Adding Rate Limiting`,description:`Control traffic and protect your APIs by setting up flexible, customizable rate limits.`,icon:FR,link:{href:{web:`https://zuplo.com/docs/articles/step-2-add-rate-limiting`,local:`https://zuplo.com/docs/articles/step-2-add-rate-limiting-local`},text:`Get Started`}},{title:`Complex Rate Limiting`,description:`Implement advanced rules to rate limit by user, IP, plan, or custom logic.`,icon:Yqe,link:{href:{web:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`,local:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`},text:`Get Started`}},{title:`Dynamic Rate Limits`,description:`Set rate limits that adapt in real-time based on headers, tokens, or user context.`,icon:nJe,link:{href:{web:`https://zuplo.com/examples/dynamic-rate-limits`,local:`https://zuplo.com/examples/dynamic-rate-limits`},text:`Get Started`}}]},{label:`Authentication`,value:`authentication`,items:[{title:`Using API Keys`,description:`Authenticate and manage access to your APIs with simple, secure API key workflows.`,icon:sJe,link:{href:{web:`https://zuplo.com/docs/policies/api-key-inbound`,local:`https://zuplo.com/docs/policies/api-key-inbound`},text:`Get Started`}},{title:`Using Auth0`,description:`Connect your APIs to Auth0 for streamlined authentication and powerful identity management.`,icon:dJe,link:{href:{web:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`},text:`Get Started`}},{title:`Using Okta`,description:`Integrate Okta with your APIs to enable secure, enterprise-grade authentication and authorization.`,icon:tJe,link:{href:{web:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`},text:`Get Started`}}]},{label:`Dev Portal`,value:`dev-portal`,items:[{title:`Setup your API Reference`,description:`Instantly generate an interactive reference by importing your OpenAPI spec—no manual work needed.`,icon:Jqe,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`},text:`Get Started`}},{title:`Adding Authentication`,description:`Guide users through secure API access by adding auth flows to your developer portal.`,icon:oJe,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`},text:`Get Started`}},{title:`Creating API Catalogs`,description:`Organize your APIs into searchable, user-friendly catalogs for easier discovery and onboarding.`,icon:PR,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`,local:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`},text:`Get Started`}}]}],XXt=({mode:e=`web`})=>(0,W.jsxs)(GN,{defaultValue:`monetization`,className:`flex flex-col my-8`,children:[(0,W.jsx)(KN,{className:`flex gap-8 border-b border-gray-200 dark:border-neutral-700 mb-8 ml-1`,children:YXt.map(e=>(0,W.jsxs)(qN,{value:e.value,className:`relative py-2 text-sm font-medium text-gray-600 dark:text-neutral-400 hover:text-gray-900 dark:hover:text-neutral-100 data-[state=active]:text-gray-900 dark:data-[state=active]:text-neutral-100 border-b-2 border-transparent data-[state=active]:border-black dark:data-[state=active]:border-white transition-colors`,children:[e.label,`badge`in e&&e.badge&&(0,W.jsx)(PS,{variant:`invert`,className:`ml-2`,children:e.badge})]},e.value))}),YXt.map(t=>(0,W.jsx)(JN,{value:t.value,className:`grid grid-cols-3 gap-4`,children:t.items.map(t=>(0,W.jsxs)(UB,{className:`flex flex-col gap-2 text-muted-foreground`,children:[(0,W.jsxs)(WB,{className:`flex gap-2`,children:[(0,W.jsx)(t.icon,{size:24,weight:`duotone`,className:`[&_[opacity='0.2']]:fill-pink-500`}),(0,W.jsx)(GB,{className:`gap-x-2 text-lg font-semibold`,children:t.title})]}),(0,W.jsx)(qB,{className:`text-md`,children:t.description}),(0,W.jsx)(JB,{className:`flex-1 items-end! border-0 mb-4`,children:(0,W.jsx)(Y,{variant:`outline`,className:`w-full`,asChild:!0,children:(0,W.jsx)(rT,{href:t.link.href[e],variant:`ghost`,children:t.link.text})})})]},t.title))},t.value))]}),ZXt=({title:e,url:t,className:n})=>{let{copyToClipboard:r,state:i}=eO(t??``);return(0,W.jsxs)(UB,{className:G(`col-span-full md:col-span-5 py-2 px-4 flex items-center text-sm gap-x-2`,n),children:[(0,W.jsx)(`div`,{className:`bg-green-600 rounded-full w-4 h-4 p-0.5`,children:(0,W.jsx)(mm,{className:`text-white`,size:12})}),(0,W.jsx)(`span`,{className:`font-semibold`,children:e}),(0,W.jsx)(`div`,{className:`flex-1`,children:t?(0,W.jsx)(rT,{href:t,className:`ml-2 font-medium line-clamp-1 break-all`,children:t}):(0,W.jsx)(oN,{className:`ml-2 h-4 w-8/12`})}),(0,W.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:r,children:(0,W.jsxs)(Tk,{loading:i===`copied`,alternative:(0,W.jsx)(mm,{size:12,className:`text-green-600`,strokeWidth:3}),className:`flex`,children:[(0,W.jsx)(Om,{size:16,className:`mr-2`,strokeWidth:1.5}),`Copy URL`]})})]})},QXt=({size:e=24,...t})=>(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,fill:`none`,viewBox:`0 0 16 16`,...t,children:(0,W.jsx)(`path`,{fill:`#000`,d:`m7.47 12.412 3.348-.592.031-.007-1.722-2.049a291.474 291.474 0 0 1-1.723-2.058c0-.01 1.779-4.909 1.789-4.926a788.95 788.95 0 0 1 2.934 5.066l2.95 5.115.023.039-10.948-.001 3.317-.587zM.9 11.788c0-.003.811-1.412 1.803-3.131L4.507 5.53l2.102-1.764C7.765 2.797 8.714 2 8.717 2a.37.37 0 0 1-.033.085L6.4 6.981l-2.24 4.808-1.63.002c-.897.001-1.63 0-1.63-.003z`})}),$Xt=({className:e,size:t=24})=>(0,W.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,W.jsx)(`path`,{d:`M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z`})}),eZt=({className:e,size:t=24})=>(0,W.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.606 9.606 0 0112 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48C19.137 20.107 22 16.373 22 11.969 22 6.463 17.522 2 12 2z`})}),tZt=({className:e,size:t=24})=>(0,W.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z`})});function w7({providerName:e,className:t,size:n=24}){switch(e?.toLowerCase()){case`gitlab`:return(0,W.jsx)(tZt,{className:t,size:n});case`bitbucket`:return(0,W.jsx)($Xt,{className:t,size:n});case`azure`:return(0,W.jsx)(QXt,{className:t,size:n});default:return(0,W.jsx)(eZt,{className:t,size:n})}}var nZt=({onSuccess:e}={})=>{let t=fj(),{logEvent:n,captureException:r}=Rg();return S_({mutationFn:async e=>(await t.fetch(dj.accounts.createCustomDomain({accountName:e.accountName,isAlias:e.isAlias,projectName:e.projectName,hostname:e.hostname,deploymentName:e.deploymentName,stage:e.stage}))).json(),onSuccess:(t,r)=>{n(`account-custom-domain-creation-success`,{account:r.accountName}),e?.(t)},onError:e=>{n(`account-custom-domain-creation-failed`),r(e)}})},rZt=()=>{let e=fj();return S_({mutationFn:async t=>{await e.fetch(dj.accounts.editCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},iZt=()=>{let e=fj();return S_({mutationFn:async t=>{await e.fetch(dj.accounts.deleteCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},aZt=(e,t)=>hj(X.customDomains(e,t),{extractData:!0}),oZt=(0,g.forwardRef)(({icon:e,label:t,count:n,expanded:r,onToggle:i,children:a},o)=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-gray-200 dark:border-neutral-700 bg-surface shadow-xs`,children:[(0,W.jsxs)(`button`,{ref:o,type:`button`,onClick:i,"aria-expanded":r,className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-sm transition hover:bg-gray-50 dark:hover:bg-neutral-800`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2 font-medium text-gray-800 dark:text-neutral-200`,children:[(0,W.jsx)(e,{size:14,className:`text-gray-500 dark:text-neutral-400`,strokeWidth:2}),t]}),(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(PS,{variant:`secondary`,size:`sm`,className:`px-1.5 font-mono`,children:n??0}),r?(0,W.jsx)(_m,{size:14,className:`text-gray-500 dark:text-neutral-400`}):(0,W.jsx)(hm,{size:14,className:`text-gray-400 dark:text-neutral-500`})]})]}),r?(0,W.jsx)(`div`,{className:`border-t border-gray-100 dark:border-neutral-800`,children:a}):null]}));oZt.displayName=`ExpandableNode`;var sZt=({selected:e,onChange:t,options:n,listLabel:r,className:i,classNameOptions:a,testId:o,placeholder:s,matchWidth:c=!0,selectorElement:l,disabled:u,labelPrefixElement:d=null,isLoadingData:f=!1})=>(0,W.jsxs)(NB,{value:e,onChange:t,disabled:u,children:[r&&(0,W.jsx)(NB.Label,{className:`block text-sm font-medium text-gray-700`,children:r}),(0,W.jsxs)(`div`,{className:(0,_P.default)({relative:c},i),children:[(0,W.jsxs)(NB.Button,{"data-test":o,className:(0,_P.default)(`w-full relative`,`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-background px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,u?`bg-gray-200`:`bg-white`,i),children:[e?.icon&&(0,W.jsx)(`span`,{className:`absolute pr-10`,children:f?(0,W.jsx)(gL,{className:`w-4 h-4 mr-2`,borderPositionAndSize:`border-l-2`}):e.icon}),(0,W.jsxs)(`span`,{className:(0,_P.default)(`block truncate`,{"ml-7":e?.icon}),children:[d,e?.label??s]}),(0,W.jsx)(`span`,{className:`flex items-center pointer-events-none`,children:l??(0,W.jsx)(vm,{className:`h-5 w-5 text-gray-400`,"aria-hidden":`true`})})]}),(0,W.jsx)(VB,{as:g.Fragment,leave:`transition ease-in duration-100`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,W.jsx)(NB.Options,{className:(0,_P.default)(`absolute z-20 mt-1 bg-white shadow-lg rounded-md py-1 text-base border overflow-auto focus:outline-hidden sm:text-sm`,a),children:n.map((t,n)=>(0,W.jsx)(NB.Option,{"data-test":`${o}-${n}`,className:({active:e})=>(0,_P.default)(e?`bg-gray-50`:``,t.disabled?`cursor-not-allowed`:`cursor-pointer`,`text-gray-900 select-none relative py-2 px-3`),value:t,disabled:t.disabled??!1,children:t.description?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`font-semibold block text-sm leading-7`,children:t.label}),(0,W.jsx)(`span`,{className:`text-xs`,children:t.description})]}):(0,W.jsxs)(`div`,{className:`flex flex-row font-normal items-center`,children:[t.icon&&(0,W.jsx)(`div`,{children:t.icon}),` `,(0,W.jsx)(`div`,{children:t.label}),t.icon&&e&&e.value.toString()===t.value.toString()&&(0,W.jsx)(`div`,{className:`absolute right-0`,children:(0,W.jsx)(mm,{className:`mr-3 h-5 w-5`})})]})},`${n}-${t.value}`))})})]})]});function cZt(e,t=500){let[n,r]=(0,g.useState)(e);return(0,g.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>{clearTimeout(n)}},[e,t]),n}var lZt=({projects:e,isLoadingProjects:t,selectedProject:n,onProjectChange:r})=>(0,W.jsx)(sZt,{testId:`project-selector`,placeholder:`Select Project`,options:(e||[]).map(e=>({label:e.name,value:e.id,icon:(0,W.jsx)(Fm,{className:`mr-1.5`,size:16})})),selected:n,onChange:r,className:`flex-1 items-center w-full h-9`,isLoadingData:t});function T7({title:e,className:t}){return(0,W.jsx)(`div`,{className:G(`text-2xl font-medium`,t),children:e})}var uZt=({showHeader:e})=>(0,W.jsxs)(W.Fragment,{children:[e&&(0,W.jsx)(T7,{title:`Source Control Settings`}),(0,W.jsxs)(`div`,{className:`w-full sm:max-w-md md:max-w-2xl lg:max-w-5xl animate-pulse`,children:[e&&(0,W.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`}),(0,W.jsxs)(`div`,{className:`flex flex-col md:flex-row lg:flex-row sm:gap-4`,children:[(0,W.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,W.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,W.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs right-0 h-10 bg-gray-200 rounded-md dark:bg-gray-700`})]}),(0,W.jsx)(`div`,{className:`h-5 mt-5 mb-3`,children:(0,W.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`})}),(0,W.jsx)(`div`,{className:`mt-5 h-96 relative bg-gray-200 rounded-md dark:bg-gray-700`})]})]}),E7=`GITLAB`,D7=`GITHUB`,O7=`BITBUCKET`,k7=`AZURE`,dZt=({installUrl:e,selectedOrg:t,projectName:n,className:r,provider:i=D7,disabled:a})=>{let{logEvent:o}=Rg(),[s,c]=(0,g.useState)(!1),l=e=>{o(`source-control-create-repo-continue-clicked`,{sourceControlNamespace:e??`none`,sourceControlProvider:i,project:n});let t;switch(i){case k7:t=e?`https://dev.azure.com/${e}/_createproject`:`https://dev.azure.com/`;break;case E7:t=e?`https://gitlab.com/projects/new?namespace_id=${e}`:`https://gitlab.com/projects/new`;break;case O7:t=e?`https://bitbucket.org/repo/create?owner=${e}`:`https://bitbucket.org/repo/create`;break;default:t=e===null?`https://github.com/new?name=${n}&description=Zuplo%20API%20Gateway`:`https://github.com/organizations/${e}/repositories/new?owner=${e}&name=${n}&description=Zuplo%20API%20Gateway`;break}window.open(t),c(!1)};return(0,W.jsxs)(bA,{open:s,onOpenChange:c,children:[(0,W.jsx)(xA,{asChild:!0,children:(0,W.jsx)(Y,{className:r,disabled:a,children:`Create new repository`})}),(0,W.jsxs)(CA,{className:`max-w-xl! w-full`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Create new repository`}),(0,W.jsx)(DA,{})]}),(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`We're about to help you create a new repository in`,` `,zj(i),`.`]}),(0,W.jsxs)(`div`,{className:`rounded-md bg-muted/50 p-3 text-sm space-y-2 border`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`What you'll need to do:`}),i===`AZURE`&&(0,W.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,W.jsx)(`li`,{children:`Create a project and repository in Azure DevOps`}),(0,W.jsx)(`li`,{children:`Return to Zuplo to connect it`})]}),i===`GITHUB`&&(0,W.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,W.jsx)(`li`,{children:`Create your new repository on GitHub`}),(0,W.jsxs)(`li`,{children:[`Ensure the`,` `,(0,W.jsx)(rT,{href:e,children:`Zuplo GitHub App`}),` `,`has access to your new repo`]}),(0,W.jsx)(`li`,{children:`Return to Zuplo to see and connect it`})]}),(i===`GITLAB`||i===`BITBUCKET`)&&(0,W.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,W.jsxs)(`li`,{children:[`Create your repository in `,zj(i)]}),(0,W.jsx)(`li`,{children:`Return to Zuplo to connect it`})]})]}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need help?`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/source-control`,children:`View our troubleshooting guide`})]})]}),(0,W.jsx)(TA,{children:(0,W.jsxs)(Y,{"data-test":`navigate-new-${i.toLowerCase()}-repo`,onClick:()=>l(t),children:[`Continue to `,zj(i)]})})]})]})},fZt=({accountName:e,projectName:t,orgName:n,repositoryUrl:r,provider:i,handleErrors:a})=>{let{logEvent:o,captureException:s}=Rg(),[c,l]=(0,g.useState)(!1),u=mXt(e,t),d=async(n,r,d)=>{try{if(n===null)throw Error(`Invalid ${zj(i)} account/organization selected, please try again.`);if(r===null)throw Error(`Invalid repository selected, please try again.`);let s=await(await u.mutateAsync({orgName:n,repositoryURL:r,defaultBranch:`main`,forceConnect:d},{onError:r=>{let i=Bj(r);a(i),o(`source-control-repo-connection-failed`,{account:e,project:t,sourceControlNamespace:n,errorMessage:i})}})).json();s.connected===!1&&s.emptyRepository===!1?l(!0):c&&l(!1),s.connected&&o(`source-control-repo-connected`,{account:e,project:t,sourceControlNamespace:n})}catch(r){s(r);let i=Bj(r);o(`source-control-repo-connection-failed`,{account:e,project:t,sourceControlNamespace:n,errorMessage:i}),a(i),c&&l(!1)}};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(oX,{open:c,onOpenChange:l,title:`Connecting project to repository`,description:`The repository you picked is not empty. Connecting will just create an association between this project and the repo. No changes will be pushed or pulled — you must do that manually using the ${zj(i)} button. Do you still want to connect?`,actionLabel:`Connect`,isPending:u.isPending,onConfirm:()=>d(n,r,!0)}),(0,W.jsx)(Y,{"data-test":`connect-repo-button`,variant:`outline`,size:`sm`,onClick:()=>d(n,r,!1),children:(0,W.jsx)(Tk,{loading:u.isPending,children:`Connect`})})]})},pZt=({repositories:e,account:t,project:n,selectedNamespace:r,provider:i,maxItems:a=5,onConnectError:o})=>{let s=i===`azure`;return(0,W.jsx)(W.Fragment,{children:e.slice(0,a).map((e,a)=>(0,W.jsxs)(`div`,{className:(0,_P.default)(`flex flex-row items-center justify-center h-16 border-gray-300 px-5 lg:gap-5 gap-2`,{"border-t":a!==0}),children:[(0,W.jsxs)(`div`,{className:`flex text-sm flex-1 gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,W.jsx)(`span`,{className:`font-medium line-clamp-1`,children:e.name}),s&&e.metadata?.projectName?(0,W.jsxs)(`span`,{className:`text-gray-400 text-xs`,children:[`Project: `,e.metadata.projectName]}):(0,W.jsxs)(`span`,{className:`text-gray-400 hidden md:inline-block lg:inline-block`,children:[`Updated on`,` `,new Date(e.updatedAt).toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})]})]}),e.private&&(0,W.jsxs)(`div`,{className:`flex justify-center items-center text-gray-400 gap-1`,children:[(0,W.jsx)(Um,{className:`h-4 w-4`,"aria-hidden":`false`,"aria-label":`Private Git repository`}),(0,W.jsx)(`span`,{className:`hidden lg:block`,children:`Private Repository`})]})]}),(0,W.jsx)(fZt,{accountName:t.name,projectName:n.name,orgName:r?.label||``,repositoryUrl:e.url,provider:i,handleErrors:o})]},e.id))})},mZt={[D7]:{name:`GitHub`,icon:(e=20)=>(0,W.jsx)(eZt,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitHub Account`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? We can help you create a new one.`,selectAccount:`Make sure to select a Git account or organization on the top left.`,grantAccess:`Make sure to grant Zuplo access to the Git account & its repositories you'd like to connect to.`}},[k7]:{name:`Azure DevOps`,icon:(e=20)=>(0,W.jsx)(QXt,{className:`mr-1.5`,size:e}),supportsProjects:!0,placeholder:{namespace:`Select Organization`,project:`Select Project`,search:`Search repositories`},messages:{noRepoInProject:`No repository in this project? Create a new one.`,noRepoAtHand:`No project at hand? We can help you create one.`,selectAccount:`Please select a project to view repositories.`,grantAccess:`No repositories in this project yet.`}},[E7]:{name:`GitLab`,icon:(e=20)=>(0,W.jsx)(Im,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitLab Group`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a GitLab group or namespace.`,grantAccess:`Connect your GitLab account to see repositories.`}},[O7]:{name:`Bitbucket`,icon:(e=20)=>(0,W.jsx)(Ere,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select Bitbucket Project`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a Bitbucket project.`,grantAccess:`Connect your Bitbucket account to see repositories.`}}},hZt=e=>mZt[e]||mZt.GITHUB,A7=({account:e,project:t})=>{let{logEvent:n}=Rg(),r=pXt(e.name),[i,a]=(0,g.useState)(t.name),[o,s]=(0,g.useState)(!1);return{newRepoName:i,setNewRepoName:a,showCreateRepoForm:o,setShowCreateRepoForm:s,createRepoMutation:r,isCreating:r.isPending,handleCreateRepo:async({namespace:o,repoName:c,otherParams:l})=>{let u=c||i||t.name;await r.mutateAsync({projectName:t.name,orgName:o,repositoryName:u,defaultBranch:`main`,otherParams:l}),n(`source-control-repo-created`,{sourceControlRepository:u,sourceControlNamespace:o,account:e.name,project:t.name}),a(``),s(!1)},reset:()=>{s(!1),a(t.name)},transformRepoToRepository:(e,t)=>({id:e.url,url:e.url,provider:t,name:e.name,slug:e.name,defaultBranch:e.defaultBranch,namespace:e.organization,owner:{id:0,name:e.organization},private:!0,updatedAt:new Date().toISOString(),ownerType:e.isUserRepo?`user`:`team`,metadata:e.metadata}),logEvent:n}},gZt=e=>{let{account:t,project:n,sourceControlConfig:r,selectedNamespace:i,searchTerm:a}=e,o=A7(e),[s,c]=(0,g.useState)(null),l=r.provider===k7,{data:u,isLoading:d}=LYe(t.name,i?.value||``,{enabled:l&&!!i}),{data:f,isLoading:p}=FYe(t.name),m=o.transformRepoToRepository;return{repositories:(0,g.useMemo)(()=>!f?.data||!i||!s?[]:(f.data[i.label]||[]).filter(e=>e.metadata?.projectName===s.label).filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())).map(e=>m(e,`azure`)),[f,i,s,a,m]),isLoadingRepos:p&&!!s,projects:u?.data,selectedProject:s,isLoadingProjects:d,onProjectChange:e=>{c(e),o.logEvent(`source-control-project-selected`,{account:t.name,project:n.name,sourceControlProvider:r.provider})},reset:()=>{c(null),o.reset()}}},_Zt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=A7(e),o=n.provider===O7,{data:s,isLoading:c,refetch:l}=RYe(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{repositories:s?.repositories||[],isLoadingRepos:c,onCreateRepo:async()=>{if(!r)throw Error(`Please select a project`);await a.handleCreateRepo({namespace:r.value}),l()},reset:a.reset,showCreateRepoForm:a.showCreateRepoForm,setShowCreateRepoForm:a.setShowCreateRepoForm,newRepoName:a.newRepoName,setNewRepoName:a.setNewRepoName,isCreating:a.isCreating}},vZt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=A7(e),o=n.provider===D7,{data:s,isLoading:c}=RYe(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{...a,repositories:s?.repositories||[],isLoadingRepos:c,reset:a.reset}},yZt=e=>{let{account:t,selectedNamespace:n,searchTerm:r}=e,i=A7(e),{data:a}=IYe(t.name),{data:o,isLoading:s,refetch:c}=FYe(t.name),l=i.transformRepoToRepository;return{repositories:(0,g.useMemo)(()=>{if(!o?.data||!n)return[];let e=a?.find(e=>e.installationId===Number(n.value))?.slug||n.label;return(o.data[e]||[]).filter(e=>!r||e.name.toLowerCase().includes(r.toLowerCase())).map(e=>l(e,`gitlab`))},[o,n,r,a,l]),isLoadingRepos:s,onCreateRepo:async()=>{if(!n)throw Error(`Please select a namespace`);await i.handleCreateRepo({namespace:n.value}),c()},reset:i.reset,showCreateRepoForm:i.showCreateRepoForm,setShowCreateRepoForm:i.setShowCreateRepoForm,newRepoName:i.newRepoName,setNewRepoName:i.setNewRepoName,isCreating:i.isCreating}},bZt=250,xZt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=Rg(),i=n.provider,a=hZt(i),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(``),f=cZt(u,bZt),{data:p,isLoading:m,isFetching:h,error:_}=IYe(e.name),v={account:e,project:t,sourceControlConfig:n,selectedNamespace:c,searchTerm:f},y=gZt(v),b=yZt(v),x=_Zt(v),S=vZt(v),C=(()=>{switch(i){case k7:return y;case E7:return b;case O7:return x;default:return S}})();(0,g.useEffect)(()=>{let e=Bj(_);e&&s(e)},[_]),(0,g.useEffect)(()=>{if(p&&p.length>0){let e=p[0];l({label:e.name,value:i===`AZURE`?e.slug:e.installationId.toString(),icon:a.icon(20)})}},[p,i,a]);let w=a=>{if(a.value===`add-github-account`){r(`source-control-add-account-selected`,{sourceControlNamespace:a.value,account:e.name,project:t.name,sourceControlProvider:i}),n.installUrl&&window.open(n.installUrl);return}r(`source-control-namespace-selected`,{sourceControlNamespace:a.value,sourceControlProvider:i,account:e.name,project:t.name}),s(``),l(a),C.reset()},T=[];p?.forEach(e=>{T.push({label:e.name,value:i===`AZURE`?e.slug:e.installationId,icon:a.icon(20)})}),i===`GITHUB`&&T.push({label:`Add GitHub Account`,value:`add-github-account`,icon:(0,W.jsx)(Gm,{className:`mr-1.5`,size:16})});let E=()=>a.supportsProjects&&C.selectedProject?C.repositories.length>0?`Showing ${C.repositories.length} repositories from project: ${C.selectedProject.label}`:a.messages.grantAccess:!a.supportsProjects&&C.repositories.length>0?`Showing ${Math.min(C.repositories.length,5)} repositories`:a.supportsProjects&&!C.selectedProject?a.messages.selectAccount:`Select an account to view repositories`,D=()=>(0,W.jsx)(dZt,{installUrl:n.installUrl??``,selectedOrg:c?.label??``,projectName:t.name,provider:i,className:`w-full md:w-auto`}),O=m||C.isLoadingRepos,k=!a.supportsProjects||C.selectedProject;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(DR,{error:o}),(0,W.jsxs)(`div`,{className:`w-full flex items-center text-sm mt-2 gap-2 justify-center`,children:[(0,W.jsx)(`p`,{className:`flex-1 hidden md:block`,children:a.supportsProjects&&C.selectedProject?a.messages.noRepoInProject:a.messages.noRepoAtHand}),D()]}),O&&c===null&&(0,W.jsx)(uZt,{showHeader:!1}),!m&&(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(sZt,{testId:`namespace-selector`,placeholder:a.placeholder.namespace,options:T,selected:c,onChange:w,className:`flex-1 items-center h-9`,isLoadingData:h}),i===`AZURE`&&c&&(0,W.jsx)(lZt,{projects:C.projects,isLoadingProjects:C.isLoadingProjects||!1,selectedProject:C.selectedProject||null,onProjectChange:C.onProjectChange||(()=>{})}),(0,W.jsxs)(KJ,{className:`flex-2 w-full`,children:[(0,W.jsx)(JJ,{value:u,onChange:e=>d(e.target.value),placeholder:a.placeholder.search}),(0,W.jsx)(qJ,{align:`inline-start`,children:(0,W.jsx)(qm,{className:`opacity-75`})}),u&&(0,W.jsx)(qJ,{align:`inline-end`,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>d(``),children:(0,W.jsx)($m,{})})})]})]}),(0,W.jsx)(UB,{className:`flex flex-col`,children:C.isLoadingRepos&&k?(0,W.jsxs)(`div`,{className:`flex flex-row items-center p-2 justify-center align-middle h-80`,children:[(0,W.jsx)(gL,{className:`w-4 h-4 mr-2`,borderPositionAndSize:`border-l-2`}),(0,W.jsx)(`span`,{children:`Loading repositories...`})]}):k&&C.repositories.length>0?(0,W.jsx)(pZt,{repositories:C.repositories,account:e,project:t,selectedNamespace:c,provider:i,onConnectError:s}):k?(0,W.jsxs)(`div`,{className:`flex flex-col text-sm text-center gap-2 items-center justify-center h-80`,children:[(0,W.jsx)(`h2`,{className:`text-base`,children:`No Results Found`}),(0,W.jsx)(`p`,{children:u?`Your search for "${u}" did not return any results.`:a.messages.grantAccess})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-80`,children:(0,W.jsx)(`p`,{children:a.messages.selectAccount})})}),(0,W.jsxs)(`div`,{className:`flex whitespace-pre-line text-gray-500 text-sm justify-between gap-4`,children:[(0,W.jsx)(`span`,{children:E()}),(i===`GITHUB`||i===`GITLAB`||i===`BITBUCKET`)&&n.installUrl&&(0,W.jsxs)(rT,{href:n.installUrl,className:`whitespace-pre`,children:[`Adjust `,a.name,` Permissions →`]})]})]})},SZt=({provider:e,url:t,org:n,name:r,children:i})=>(0,W.jsx)(UB,{className:`flex gap-2 flex-col`,offset:`md`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(w7,{providerName:e}),(0,W.jsx)(`div`,{className:`flex flex-col flex-1`,children:(0,W.jsxs)(`a`,{className:`text-sm font-semibold hover:text-zuplo-pink-hover underline flex gap-1 items-center`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[n,`/`,r,(0,W.jsx)(Am,{className:`h-4 w-4`})]})}),i]})}),CZt=({account:e,project:t})=>{let{logEvent:n}=Rg(),r=oh([`account`,`project`]);if(!t.sourceRepoUrl)throw Error(`No sourceRepoUrl on project '${r.account.name}'`);let i=t.sourceRepoUrl.replace(`.git`,``),a,o,s=!1;try{s=new URL(t.sourceRepoUrl).hostname===`dev.azure.com`}catch{s=!1}if(s){let e=t.sourceRepoUrl.match(/^https:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)/);if(e){a=e[1];let t=e[2],n=e[3].replace(`.git`,``);a=`${e[1]}/${t}`,o=n}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}let c=hXt(e.name,t.name),l=async()=>{await c.mutateAsync(),n(`source-control-repo-disconnected`,{account:r.account.name,project:r.project.name})};return(0,W.jsx)(SZt,{org:a,name:o,url:i,provider:t.sourceControlProvider.toLowerCase(),children:(0,W.jsx)(Y,{"data-test":`disconnect-repo-button`,onClick:l,variant:`secondary`,className:`self-end`,disabled:c.isPending,children:(0,W.jsx)(Tk,{className:`flex items-center gap-1`,loading:c.isPending,children:`Disconnect`})})})},wZt=({provider:e,onClose:t})=>{if(!e)return null;let n=zj(e);return(0,W.jsx)(bA,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,W.jsxs)(CA,{children:[(0,W.jsxs)(wA,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(w7,{providerName:e.toLowerCase(),size:28}),(0,W.jsxs)(EA,{children:[n,` Integration`]})]}),(0,W.jsxs)(DA,{className:`pt-2`,children:[n,` source control integration is available on Enterprise plans. Contact our sales team or book a demo to learn more about connecting your `,n,` repositories to Zuplo.`]})]}),(0,W.jsxs)(TA,{className:`mt-2`,children:[(0,W.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,W.jsx)(rT,{href:`mailto:${ZS}?subject=${encodeURIComponent(`${n} Source Control Integration`)}`,variant:`ghost`,children:`Contact Sales`})}),(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsx)(rT,{href:XS,variant:`ghost`,children:`Book a Demo`})})]})]})})},TZt=`sourceControlConnect`,EZt=()=>{let{logEvent:e}=Rg(),t=g_(),[n,r]=(0,g.useState)(!1);return{connect:(n,i)=>{let{id:a,provider:o,clientId:s,scopes:c,redirectUri:l,providerUrl:u}=i;e(`source-control-provider-clicked`,{provider:o}),e(`source-control-connect-clicked`,{account:n,sourceControlProvider:o}),localStorage.removeItem(TZt),localStorage.setItem(TZt,`${n}::${a}`),r(!0);let d=i=>{i.key===`sourceControlConnect`&&i.oldValue===`${n}::${a}`&&i.newValue===null&&(e(`source-control-access-granted`,{account:n,sourceControlProvider:o}),r(!1),window.removeEventListener(`storage`,d),t.invalidateQueries({queryKey:[X.accountsSourceControlConfigurations().url],exact:!1}))};if(window.addEventListener(`storage`,d,!1),o===`GITHUB`){let e=c===``?`https://github.com/login/oauth/authorize?client_id=${s}`:`https://github.com/login/oauth/authorize?client_id=${s}&scope=${c}`;window.open(e)}o===`GITLAB`&&window.open(`${u}/oauth/authorize?client_id=${s}&redirect_uri=${l}&response_type=code&scope=${c}`),o===`BITBUCKET`&&window.open(`${u}/site/oauth2/authorize?client_id=${s}&response_type=code`),o===`AZURE`&&window.open(`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${s}&redirect_uri=${encodeURIComponent(l)}&response_type=code&response_mode=query&scope=${encodeURIComponent(c)}`)},isConnecting:n}},DZt=({accountName:e,sourceControlConfig:t})=>{let{connect:n,isConnecting:r}=EZt(),{provider:i}=t;return(0,W.jsx)(`div`,{children:(0,W.jsx)(Y,{variant:`outline`,className:`gap-2`,disabled:r,onClick:()=>n(e,t),children:(0,W.jsx)(Tk,{loading:r,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(w7,{providerName:i}),(0,W.jsx)(`span`,{children:`Connect to ${zj(i)}`})]})})})})},OZt=[{key:E7,label:`GitLab`},{key:O7,label:`Bitbucket`}],kZt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=Rg(),[i,a]=(0,g.useState)(null);if(n?.userHasCredentials&&t.sourceRepoUrl)return(0,W.jsx)(CZt,{account:e,project:t});if(n&&!t.sourceRepoUrl&&n.userHasCredentials)return(0,W.jsx)(xZt,{account:e,project:t,sourceControlConfig:n});let o=n?zj(n.provider):null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(UB,{offset:`md`,className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`div`,{className:`text-sm whitespace-pre-line text-gray-500`,children:[n&&t.sourceRepoUrl&&(0,W.jsxs)(`p`,{className:`mb-3`,children:[`This project is currently associated with a `,o,` `,`repository but you have not connected to your `,o,` `,`account.`]}),(0,W.jsx)(`p`,{children:`Connect to a source control provider to enable source control on your project.`})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,W.jsx)(DZt,{accountName:e.name,sourceControlConfig:n}),OZt.map(({key:e,label:t})=>(0,W.jsxs)(Y,{variant:`outline`,className:`gap-2`,onClick:()=>{r(`source-control-provider-clicked`,{provider:e}),a(e)},children:[(0,W.jsx)(w7,{providerName:e.toLowerCase(),size:20}),(0,W.jsxs)(`span`,{children:[`Connect to `,t]})]},e))]})]}),(0,W.jsx)(wZt,{provider:i,onClose:()=>a(null)})]})},AZt=()=>hj(X.accountsSourceControlConfigurations()),jZt=()=>{let{account:e,project:t}=oh([`account`,`project`]),{logEvent:n}=Rg();return(0,W.jsxs)(`div`,{className:`flex flex-col space-y-4`,children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Support`}),(0,W.jsx)(UB,{offset:`md`,className:`p-6`,children:(0,W.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,W.jsx)(sie,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(GB,{className:`text-base`,children:`Talk to an API expert`}),(0,W.jsx)(KB,{className:`text-md`,children:`Get a free technical consultation with one of our API experts.`})]}),(0,W.jsx)(Y,{onClick:()=>{n(`getting-started-book-a-meeting-clicked`,{account:e.name}),window.open(XS,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,W.jsxs)(rT,{href:XS,variant:`ghost`,children:[(0,W.jsx)(Ore,{}),`Book a Meeting`]})})]})}),(0,W.jsx)(UB,{offset:`md`,className:`p-6`,children:(0,W.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,W.jsx)(Vm,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(GB,{className:`text-base`,children:`Feeling Stuck?`}),(0,W.jsx)(KB,{className:`text-md`,children:`Check out our various support options to get help with your API`})]}),(0,W.jsx)(Y,{className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,W.jsxs)(Nr,{to:Ce(kR.Support,{account:e.name}),children:[(0,W.jsx)(Vm,{}),`Get Help`]})})]})}),(0,W.jsx)(UB,{offset:`md`,className:`p-6`,children:(0,W.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,W.jsx)(sie,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(GB,{className:`text-base`,children:`Join the Zuplo API Community`}),(0,W.jsx)(KB,{className:`text-md`,children:`Come chat with fellow Zuplo users and the Zuplo team in our Discord channel.`})]}),(0,W.jsx)(Y,{onClick:()=>{n(`getting-started-join-discord-clicked`,{account:e.name,project:t.name}),window.open(JS,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,W.jsxs)(rT,{href:JS,variant:`ghost`,children:[(0,W.jsx)(eie,{size:16}),`Join Us`]})})]})})]})},MZt=()=>{let{account:e,project:t,environment:n}=Tj([`account`,`project`,`environment`]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(WB,{children:[(0,W.jsx)(GB,{className:`text-base`,children:`Welcome to your Gateway`}),(0,W.jsx)(KB,{className:`text-base`,children:`You can get started by configuring your routes and setting up policies in our visual Route Designer.`})]}),(0,W.jsxs)(JB,{className:`border-0 gap-2 py-6`,children:[(0,W.jsx)(Y,{asChild:!0,size:`sm`,className:`gap-2 px-8`,variant:`brand-outline`,children:(0,W.jsxs)(Nr,{to:Ce(kR.Code,{account:e,project:t,environment:n}),children:[(0,W.jsx)(Em,{size:16}),`Start Building`]})}),(0,W.jsx)(Y,{className:`px-8`,variant:`secondary`,size:`sm`,asChild:!0,children:(0,W.jsxs)(rT,{variant:`ghost`,href:`https://zuplo.com/docs/articles/step-1-setup-basic-gateway`,children:[(0,W.jsx)(Nm,{size:16}),`Quickstart`]})})]})]})},NZt=()=>{let[e,t]=(0,g.useState)(!1);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(UB,{className:`col-span-full md:col-span-3 py-2 px-4 flex items-center text-sm gap-x-2`,children:[(0,W.jsx)(`div`,{className:`rounded-full w-4 h-4 p-0.5 bg-gray-500`,children:(0,W.jsx)(Tm,{className:`text-white`,size:12})}),(0,W.jsx)(`span`,{className:`font-semibold flex-1 line-clamp-1 break-all`,children:`Developer Portal`}),(0,W.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!0),children:[(0,W.jsx)(Nm,{}),`Open\xA0Portal`]})]}),(0,W.jsx)(bA,{open:e,onOpenChange:t,children:(0,W.jsxs)(CA,{children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Run Developer Portal Locally`}),(0,W.jsx)(DA,{children:`To view and edit your API documentation, you need to run the developer portal locally.`})]}),(0,W.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`p`,{className:`text-sm font-semibold`,children:`Steps to run the portal:`}),(0,W.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 text-sm text-gray-600`,children:[(0,W.jsxs)(`li`,{children:[`Open a terminal in the`,` `,(0,W.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`/docs`}),` `,`folder of your Zuplo project`]}),(0,W.jsxs)(`li`,{children:[`Run`,` `,(0,W.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`npm run dev`})]}),(0,W.jsx)(`li`,{children:`The portal will open in your browser automatically`})]})]}),(0,W.jsx)(`div`,{className:`bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800 rounded-md p-3`,children:(0,W.jsxs)(`p`,{className:`text-xs text-blue-800 dark:text-blue-200`,children:[(0,W.jsx)(`strong`,{children:`Tip:`}),` The developer portal will automatically reload when you make changes to your OpenAPI documentation.`]})})]}),(0,W.jsxs)(TA,{children:[(0,W.jsx)(Y,{variant:`secondary`,onClick:()=>t(!1),children:`Close`}),(0,W.jsx)(Y,{asChild:!0,variant:`outline`,children:(0,W.jsx)(rT,{href:`https://zuplo.com/docs/dev-portal`,children:`View Documentation`})})]})]})})]})},PZt=()=>{let{project:e,environment:t}=oh(),n=tO(t);return(0,W.jsx)(`div`,{className:`bg-neutral-50 dark:bg-neutral-950 h-full overflow-y-auto`,children:(0,W.jsxs)(`div`,{className:`pt-4 max-w-6xl pb-16 m-auto px-5 flex flex-col gap-4`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e.name}),(0,W.jsxs)(`div`,{className:`grid grid-cols-8 gap-3`,children:[(0,W.jsx)(ZXt,{title:`Gateway`,url:n}),(0,W.jsx)(NZt,{})]}),(0,W.jsxs)(UB,{className:`relative grid md:grid-cols-2 overflow-hidden min-h-[220px]`,children:[(0,W.jsx)(MZt,{}),(0,W.jsxs)(`div`,{className:`hidden md:block self-end h-full w-full`,children:[(0,W.jsx)(`img`,{src:qXt,alt:e.name,className:`w-full h-full object-cover object-left dark:hidden`}),(0,W.jsx)(`img`,{src:JXt,alt:``,"aria-hidden":!0,className:`hidden w-full h-full object-cover object-left dark:block`})]})]}),(0,W.jsx)(XXt,{mode:`local`}),(0,W.jsx)(jZt,{})]})})},FZt=()=>sP().brand,IZt=((e,...t)=>(...n)=>e(...t,...n))(hj,X.accounts()),LZt=e=>hj(X.accountMemberInvites(e),{extractData:!0}),RZt=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.accounts.deleteAccountMemberInvite(t))})},zZt=()=>{let e=fj();return S_({mutationFn:async t=>await e.fetch(dj.accounts.resendAccountMemberInvite(t))})},BZt=({account:e,navigateTo:t})=>{let{data:n,isLoading:r}=lXt(e),i=[...n??[]].sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()));return r?(0,W.jsx)(Y1,{heading:e,forceMount:!0,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,W.jsx)(Hm,{className:`h-4 w-4 animate-spin`}),(0,W.jsx)(`span`,{children:`Loading projects...`})]})}):(0,W.jsx)(Y1,{heading:e,children:i.map(n=>(0,W.jsxs)(X1,{value:`${e}/${n.name}`,keywords:[n.name,e],onSelect:()=>t(Ce(kR.Overview,{account:e,project:n.name})),children:[(0,W.jsx)(fm,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,W.jsx)(`span`,{children:n.name})]},n.id))})},VZt=({accounts:e,navigateTo:t})=>{let n=e?.map(e=>e.name)??[],r=uXt(n),i=(e??[]).map(e=>e.name).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())),a=n.flatMap((e,t)=>(r[t]?.data??[]).map(t=>({account:e,project:t}))).sort((e,t)=>e.project.name.toLowerCase().localeCompare(t.project.name.toLowerCase()));return(0,W.jsxs)(Y1,{children:[i.map(e=>(0,W.jsxs)(X1,{value:e,keywords:[e],onSelect:()=>t(Ce(kR.AccountProjects,{account:e})),children:[(0,W.jsx)(pm,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,W.jsx)(`span`,{className:`truncate`,children:e}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:`Account`})]},`account:${e}`)),a.map(({account:e,project:n})=>(0,W.jsxs)(X1,{value:`${e}/${n.name}`,keywords:[n.name,e],onSelect:()=>t(Ce(kR.Overview,{account:e,project:n.name})),children:[(0,W.jsx)(fm,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,W.jsx)(`span`,{className:`truncate`,children:n.name}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:e})]},n.id))]})},HZt=({accounts:e,navigateTo:t,search:n})=>n.trim()?(0,W.jsx)(VZt,{accounts:e,navigateTo:t}):(0,W.jsxs)(W.Fragment,{children:[e?.map(e=>(0,W.jsx)(BZt,{navigateTo:t,account:e.name},`projects-${e.name}`)),(0,W.jsx)(Y1,{heading:`Accounts`,children:e?.map(e=>(0,W.jsxs)(X1,{onSelect:()=>{t(Ce(kR.AccountProjects,{account:e.name}))},children:[(0,W.jsx)(pm,{className:`mr-2 h-4 w-4`}),(0,W.jsx)(`span`,{children:e.name})]},e.name))})]}),UZt=({account:e,navigateTo:t,project:n,environment:r})=>(0,W.jsx)(Y1,{heading:`Files`,children:ch(e=>e.projectTreeNodes).filter(e=>e.path&&e.type===Qr.File).map(i=>(0,W.jsxs)(X1,{onSelect:()=>t(Ce(`${kR.Code}?path=${i.path}`,{account:e,project:n,environment:r})),children:[(0,W.jsx)(`div`,{className:`mr-3`,children:(0,W.jsx)(Pm,{className:`h-4 w-4 text-neutral-500`})}),(0,W.jsx)(`span`,{className:`line-clamp-1`,children:i.path.substring(1)})]},i.path))}),WZt={zuplo:e=>(0,W.jsx)(`svg`,{viewBox:`0 0 308 308`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,W.jsxs)(`g`,{fillRule:`nonzero`,fill:`none`,children:[(0,W.jsx)(`path`,{d:`M0 0h308v308H0z`}),(0,W.jsx)(`path`,{d:`M214.523 182.007h-74.088l78.939-79.076a5.34 5.34 0 0 0-.807-8.204 5.314 5.314 0 0 0-2.957-.899H90.239V41.364h137.515a53.31 53.31 0 0 1 28.617 7.922 53.444 53.444 0 0 1 19.967 22.011 52.117 52.117 0 0 1 4.221 31.194 52.062 52.062 0 0 1-14.508 27.924l-51.528 51.592Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M90.24 119.097h74.092l-78.781 78.917a5.431 5.431 0 0 0-1.172 5.912 5.423 5.423 0 0 0 5.001 3.351h125.017v52.464H77.016a53.322 53.322 0 0 1-28.616-7.923 53.453 53.453 0 0 1-19.968-22.011 52.109 52.109 0 0 1-4.219-31.194 52.059 52.059 0 0 1 14.51-27.924l51.517-51.592Z`,fill:`currentColor`})]})}),akamai:e=>(0,W.jsxs)(`svg`,{viewBox:`344.42 285.18 451 489.75`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,...e,children:[(0,W.jsx)(`path`,{d:`M592.85,764.11c-100.8-30.77-174.12-123.92-174.12-234.05s74.88-205.29,177.4-235.02c10.48-3.06,7.73-9.86-4.91-9.86-136.28,0-246.8,109.69-246.8,244.89s110.51,244.86,246.8,244.86c12.63,0,13.14-7.3,1.63-10.81Z`}),(0,W.jsx)(`path`,{d:`M465.48,587.42c-.68-6.58-1.01-13.23-1.01-19.94,0-107.36,87.05-194.39,194.43-194.39,101.52,0,132,45.31,135.78,42.35,4.12-3.26-36.84-93.07-156.05-93.07-107.39,0-194.44,87.03-194.44,194.39,0,24.84,4.65,48.52,13.13,70.31,3.58,9.14,9.08,9.22,8.17.35Z`}),(0,W.jsx)(`path`,{d:`M546.92,447.31c50.53-22.03,114.01-22.7,176.42-.89,41.91,14.62,66.2,35.5,68.19,34.64,3.31-1.43-24.38-45.28-74.36-64.24-60.51-22.93-125.69-10.93-173.18,26.32-5.22,4.11-3.25,6.87,2.93,4.17Z`})]})},GZt=({variant:e=`full`,className:t,width:n,height:r})=>{let i=FZt();if(e===`mark`){let e=WZt[i.id];return(0,W.jsx)(e,{className:t,width:n,height:r,role:`img`,"aria-label":i.logoAlt})}return e===`full`&&i.logoDark?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`img`,{src:i.logo,alt:i.logoAlt,className:G(t,`dark:hidden`),width:n,height:r}),(0,W.jsx)(`img`,{src:i.logoDark,alt:i.logoAlt,className:G(t,`hidden dark:inline`),width:n,height:r})]}):(0,W.jsx)(`img`,{src:e===`white`?i.logoWhite:i.logo,alt:i.logoAlt,className:G(t),width:n,height:r})},KZt=({children:e,className:t})=>(0,W.jsxs)(`div`,{className:G(`relative grid grid-cols-1 gap-y-8 p-10`,t),children:[(0,W.jsx)(`div`,{className:`w-full flex items-center justify-center text-red-400`,children:(0,W.jsx)(GZt,{variant:`mark`,className:`self-center text-neutral-100 dark:text-neutral-800 w-72`})}),e]}),qZt=({children:e})=>(0,W.jsx)(`div`,{className:`flex justify-center gap-4`,children:e}),JZt=({children:e})=>(0,W.jsx)(`h2`,{className:`text-2xl font-medium text-center mt-2`,children:e}),YZt=({children:e})=>(0,W.jsx)(`div`,{className:`flex flex-col items-center text-center gap-4 max-w-md mx-auto relative`,children:e});function XZt(e){let{account:t,project:n}=Tj([`account`,`project`]),r=mj(X.project(t,n),{extractData:!1}).data.defaultConfiguration.find(e=>e.environmentType===MA.PRODUCTION)?.apiKeyBucket??void 0;if(!r&&!e?.optional)throw Error(`No production bucket found`);return r}var ZZt=e=>!!e&&e.replace(/[^a-z]/gi,``).toLowerCase()===`xai`,QZt=({className:e})=>(0,W.jsx)(`img`,{src:`/xai-elon.png`,alt:``,"aria-hidden":!0,className:G(`size-12 shrink-0 object-contain`,e)}),$Zt=({provider:e,children:t,iconClassName:n})=>ZZt(e)?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,W.jsx)(QZt,{className:n}),(0,W.jsx)(`span`,{children:t})]}):t,eQt=()=>{let e=XZt();return mj(X.supportedAiProviders(e),{extractData:!1})},j7=`__custom`;function tQt({form:e,mode:t,providerDisabled:n}){let{data:r,providers:i}=eQt().data,a=e.watch(`provider`),o=Object.keys(r).filter(e=>!i[e]?.isCustom);(0,g.useEffect)(()=>{let t=i[a]?.isCustom;e.setValue(`customProviderName`,t?a:void 0)},[a,i,e]);let s=a===j7;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(xG,{control:e.control,name:`provider`,render:({field:t})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`AI Provider`}),(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsxs)(iW,{onValueChange:t.onChange,value:t.value,disabled:n,children:[(0,W.jsx)(TG,{children:(0,W.jsx)(oW,{className:`w-full data-[size=default]:h-auto min-h-9`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(aW,{placeholder:`Choose AI provider…`}),e.watch(`customProviderName`)&&(0,W.jsx)(PS,{variant:`invert`,children:`custom`})]})})}),(0,W.jsxs)(sW,{className:`max-h-[325px] overflow-y-auto`,children:[o.length>0&&(0,W.jsxs)(l5e,{children:[(0,W.jsx)(u5e,{children:`Default Providers`}),o.map(e=>(0,W.jsx)(cW,{value:e,children:(0,W.jsx)($Zt,{provider:i[e]?.label??e,children:i[e]?.label||e})},e))]}),(0,W.jsxs)(l5e,{children:[(0,W.jsx)(u5e,{children:`Custom Providers`}),(0,W.jsx)(cW,{value:j7,children:`Custom`})]})]})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`label`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`Provider Label`}),(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:`e.g, Production OpenAI, Development Claude.`,...e})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`baseUrl`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`API URL`}),(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:s?`https://api.example.com`:`${i[a]?.baseUrl} `,...e,disabled:!s})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`apiKey`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(wG,{children:`API Key`}),(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:t===`edit`?`Leave blank to keep existing API key`:`Enter your API Key for this provider`,type:`password`,...e})}),(0,W.jsx)(EG,{})]})}),s?(0,W.jsx)(nQt,{}):(0,W.jsx)(rQt,{modelsData:r,provider:a})]})}var nQt=()=>{let e=zW(),{fields:t,append:n,remove:r}=Q7e({control:e.control,name:`customModels`});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Available Models`}),(0,W.jsx)(Y,{variant:`outline`,onClick:()=>{n({name:``,status:`active`,kind:`completions`,inputCostPerToken:0,outputCostPerToken:0})},children:`Add Model`})]}),(0,W.jsx)(xG,{name:`customModels`,control:e.control,render:()=>(0,W.jsx)(EG,{className:`mb-1`})}),(0,W.jsxs)(`div`,{className:G(`border rounded-md h-52 overflow-y-auto`,e.formState.errors.customModels&&`border-destructive`),children:[t.length===0&&(0,W.jsxs)(Jht,{children:[(0,W.jsx)(Zht,{children:`No models added yet`}),(0,W.jsx)(Qht,{children:`Add a model to get started.`})]}),t.length>0&&(0,W.jsxs)(`div`,{className:`grid grid-cols-[1fr_max-content_110px_110px_auto] gap-2 p-4 items-start`,children:[(0,W.jsx)(pW,{children:`Model Name`}),(0,W.jsx)(pW,{children:`Type`}),(0,W.jsx)(pW,{children:`Input Cost`}),(0,W.jsx)(pW,{children:`Output Cost`}),t.map((t,n)=>(0,W.jsxs)(`div`,{className:`grid grid-cols-subgrid col-span-full items-start gap-2`,children:[(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.name`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(TG,{children:(0,W.jsx)(dV,{placeholder:`Model Name`,...e})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.kind`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(TG,{children:(0,W.jsxs)(iW,{defaultValue:`completions`,onValueChange:e.onChange,value:e.value,children:[(0,W.jsx)(oW,{className:`mb-0`,children:(0,W.jsx)(aW,{placeholder:`Select Model Type`})}),(0,W.jsxs)(sW,{children:[(0,W.jsx)(cW,{value:`completions`,children:`Completion`}),(0,W.jsx)(cW,{value:`embeddings`,children:`Embedding`})]})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.inputCostPerToken`,render:({field:e})=>(0,W.jsxs)(CG,{children:[(0,W.jsx)(TG,{children:(0,W.jsxs)(KJ,{children:[(0,W.jsx)(JJ,{type:`number`,step:`any`,min:0,hideNumberArrows:!0,selectOnFocus:!0,...e,onChange:t=>e.onChange(parseFloat(t.target.value)||0)}),(0,W.jsx)(qJ,{align:`inline-start`,children:`$`}),(0,W.jsx)(qJ,{align:`inline-end`,children:(0,W.jsxs)(yk,{children:[(0,W.jsx)(bk,{asChild:!0,children:(0,W.jsx)(zm,{className:`cursor-pointer`})}),(0,W.jsx)(xk,{children:`Cost per token`})]})})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:e.control,name:`customModels.${n}.outputCostPerToken`,render:({field:e})=>(0,W.jsxs)(CG,{className:`item-start`,children:[(0,W.jsx)(TG,{children:(0,W.jsxs)(KJ,{children:[(0,W.jsx)(JJ,{type:`number`,step:`any`,min:0,hideNumberArrows:!0,selectOnFocus:!0,...e,onChange:t=>e.onChange(Number(t.target.value)||0)}),(0,W.jsx)(qJ,{align:`inline-start`,children:`$`}),(0,W.jsx)(qJ,{align:`inline-end`,children:(0,W.jsxs)(yk,{children:[(0,W.jsx)(bk,{asChild:!0,children:(0,W.jsx)(zm,{className:`cursor-pointer`})}),(0,W.jsx)(xk,{children:`Cost per token`})]})})]})}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(`div`,{className:`flex justify-center items-center size-full max-h-9`,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>{r(n)},children:(0,W.jsx)($m,{className:`h-4 w-4`})})})]},t.id))]})]})]})},rQt=({modelsData:e,provider:t})=>{let n=zW(),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`all`),s=mX(r,e[t]?.filter(({kind:e})=>a===`all`?!0:e===a)??[],{getText:({model:e,kind:t})=>[e,t]}),c=n.watch(`models`);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mt-2`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Available Models`}),(0,W.jsx)(Y,{type:`button`,variant:`link`,onClick:()=>{n.setValue(`models`,{completions:e[t]?.filter(({kind:e})=>e===`completions`).map(({model:e})=>e),embeddings:e[t]?.filter(({kind:e})=>e===`embeddings`).map(({model:e})=>e)})},children:`Select All`})]}),(0,W.jsxs)(`div`,{className:`flex justify-stretch gap-2`,children:[(0,W.jsx)(fV,{onClearValue:()=>i(``),className:`w-8/12`,showClearButton:r.length>0,children:(0,W.jsx)(dV,{placeholder:`Search Models`,className:`px-8`,value:r,onChange:e=>i(e.target.value)})}),(0,W.jsxs)(iW,{onValueChange:e=>{o(e)},children:[(0,W.jsx)(oW,{className:`w-4/12`,children:(0,W.jsx)(aW,{placeholder:`All Types`})}),(0,W.jsxs)(sW,{children:[(0,W.jsx)(cW,{value:`all`,children:`All Types`}),(0,W.jsx)(cW,{value:`completions`,children:`Chat`}),(0,W.jsx)(cW,{value:`embeddings`,children:`Embeddings`})]})]})]}),(0,W.jsx)(`div`,{className:`border rounded-md p-4 space-y-2 overflow-y-auto h-40`,children:s?.map(({kind:e,model:t})=>(0,W.jsxs)(`label`,{className:`grid grid-cols-[min-content_1fr_max-content] items-center gap-2`,children:[(0,W.jsx)(uV,{checked:c?.[e]?.includes(t),onCheckedChange:r=>{n.setValue(`models`,{...c,[e]:r?[...c?.[e]??[],t]:(c?.[e]??[]).filter(e=>e!==t)})}}),(0,W.jsx)(`div`,{className:`ml-2`,children:t}),(0,W.jsx)(PS,{variant:`outline`,children:e===`completions`?`Chat`:`Embeddings`})]},t))})]})},iQt=Mv({provider:Ov().min(1,`Provider is required`),customProviderName:Ov().optional(),label:Ov().min(1,`Label is required`),apiKey:Ov().optional(),envVarName:Ov().optional(),baseUrl:Ov().url(`Must be a valid URL`).optional(),customModels:jv(Mv({name:Ov().min(1,`Model name is required`),kind:Pv([`completions`,`embeddings`]),inputCostPerToken:kv().min(0,`Cost must be non-negative`),outputCostPerToken:kv().min(0,`Cost must be non-negative`),status:Pv([`active`,`deprecated`])})).optional(),models:Mv({completions:jv(Ov()).optional(),embeddings:jv(Ov()).optional()}).optional()}).refine(e=>e.provider!==`__custom`||(e.baseUrl?.length??0)>0,{message:`API URL is required for custom providers`,path:[`baseUrl`]}).refine(e=>e.provider!==`__custom`||(e.customModels?.length??0)>0,{message:`Models are required for custom providers`,path:[`customModels`]}),aQt=d6e(`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,6),oQt=({children:e,onOpenChange:t})=>{let[n,r]=(0,g.useState)(!1),i=XZt(),a=fj(),{account:o,project:s}=Tj([`account`,`project`]),{logEvent:c}=Rg(),l=S_({mutationFn:async e=>{let t=e.provider===j7,n=f6e();if(t){let t=await a.fetch(dj.ai.createBucketAiProvider(i,{name:n,baseURL:e.baseUrl??``,label:e.label??``}));for(let n of e.customModels??[])await a.fetch(dj.ai.createAiProviderModel(i,t.id,{model:n.name,kind:n.kind,inputCostPerToken:n.inputCostPerToken,outputCostPerToken:n.outputCostPerToken,status:`active`}))}return await a.fetch(dj.ai.createAiProviderAssignment(o,s,{provider:t?`Custom`:e.provider,customProviderName:t?n:void 0,label:e.label,envVarName:`API_KEY_${SU(e.label.toLocaleUpperCase(),{lowercase:!1,separator:`_`})}_${aQt()}`,value:e.apiKey,metadata:{models:e.customModels?{completions:e.customModels.filter(e=>e.kind===`completions`).map(e=>e.name),embeddings:e.customModels.filter(e=>e.kind===`embeddings`).map(e=>e.name)}:{completions:e.models?.completions??[],embeddings:e.models?.embeddings??[]}}}))},onSuccess:()=>{u.reset(),r(!1)}}),u=vG({defaultValues:{provider:`OpenAI`,customProviderName:void 0,label:``,apiKey:``,models:{completions:[],embeddings:[]}},resolver:yG(iQt)}),{isDirty:d}=HW(u),f=cX(d,(0,g.useCallback)(()=>{l.reset(),u.reset(),t?.(!1),r(!1)},[l,u,t]));return(0,W.jsxs)(bA,{open:n,onOpenChange:e=>{e?(t?.(!0),r(!0)):f.guardedClose()},children:[(0,W.jsx)(xA,{asChild:!0,children:e??(0,W.jsx)(Y,{children:`Add Provider`})}),(0,W.jsxs)(CA,{className:`sm:max-w-2xl max-h-[90vh] flex flex-col`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Add AI Provider`}),(0,W.jsx)(DA,{children:`Configure a new AI provider with your API key and select available models.`}),(0,W.jsx)(DR,{error:l.error,className:`break-all`})]}),(0,W.jsx)(bG,{...u,children:(0,W.jsxs)(`form`,{onSubmit:u.handleSubmit(e=>{c(`ai-gateway-create-ai-provider-submitted`,{provider:e.provider}),l.mutate(e)}),className:`flex flex-col flex-1 overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto space-y-4 px-1`,children:(0,W.jsx)(tQt,{form:u,mode:`create`})}),(0,W.jsxs)(TA,{className:`mt-4`,children:[(0,W.jsx)(Y,{type:`button`,variant:`ghost`,onClick:()=>r(!1),disabled:l.isPending,children:`Cancel`}),(0,W.jsx)(Y,{type:`submit`,children:(0,W.jsxs)(Tk,{loading:l.isPending,children:[`Create`,(0,W.jsx)(DQ,{className:`bg-white/20`,children:(0,W.jsx)(EQ,{onPress:u.handleSubmit(e=>l.mutate(e)),hotkey:`meta+Enter`})})]})})]})]})})]}),(0,W.jsx)(sX,{open:f.showConfirm,onOpenChange:f.setShowConfirm,onDiscard:f.handleDiscard})]})};function sQt({assignment:e,children:t,onOpenChange:n}){let[r,i]=(0,g.useState)(!1),a=fj(),{account:o,project:s}=Tj([`account`,`project`]),c=(0,g.useMemo)(()=>{try{return JSON.parse(e.metadata)}catch{return{}}},[e.metadata]),l=vG({defaultValues:{provider:e.provider===`Custom`?e.customProviderName:e.provider,customProviderName:e.customProviderName,label:e.label,apiKey:``,envVarName:e.envVarName,models:{completions:c.models?.completions??[],embeddings:c.models?.embeddings??[]}}}),{isDirty:u}=HW(l),d=S_({mutationFn:async t=>await a.fetch(dj.ai.updateAiProviderAssignment(o,s,e.id,{label:t.label,envVarName:t.envVarName,...t.apiKey?{value:t.apiKey}:{},metadata:{models:{completions:t.models?.completions??[],embeddings:t.models?.embeddings??[]}}})),onSuccess:()=>{l.reset(l.getValues()),i(!1)}}),f=cX(u,(0,g.useCallback)(()=>{d.reset(),l.reset(),n?.(!1),i(!1)},[l,n,d.reset]));return(0,W.jsxs)(bA,{open:r,onOpenChange:e=>{e?(n?.(!0),i(!0)):f.guardedClose()},children:[(0,W.jsx)(xA,{asChild:!0,children:t}),(0,W.jsxs)(CA,{className:`sm:max-w-xl max-h-[90vh] overflow-y-auto flex flex-col`,children:[(0,W.jsxs)(wA,{children:[(0,W.jsx)(EA,{children:`Edit AI Provider`}),(0,W.jsx)(DA,{children:`Update label, API key secret name/value, and allowed models.`}),(0,W.jsx)(DR,{error:d.error,className:`break-all`})]}),(0,W.jsx)(bG,{...l,children:(0,W.jsxs)(`form`,{onSubmit:l.handleSubmit(e=>d.mutate(e)),className:`flex flex-col flex-1 overflow-auto`,children:[(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-1 space-y-4`,children:(0,W.jsx)(tQt,{form:l,mode:`edit`,providerDisabled:!0})}),(0,W.jsxs)(TA,{className:`mt-4`,children:[(0,W.jsx)(Y,{type:`button`,variant:`ghost`,onClick:()=>i(!1),disabled:l.formState.isSubmitting,children:`Cancel`}),(0,W.jsx)(Y,{type:`submit`,disabled:!l.formState.isValid,children:(0,W.jsx)(Tk,{loading:d.isPending,children:`Save`})})]})]})})]}),(0,W.jsx)(sX,{open:f.showConfirm,onOpenChange:f.setShowConfirm,onDiscard:f.handleDiscard})]})}var cQt=()=>{let{account:e,project:t}=Tj([`account`,`project`]),n=mj(X.aiProviderAssignments(e,t)),r=fj(),i=S_({mutationFn:async n=>r.fetch(dj.ai.deleteAiProviderAssignment(e,t,n))}),a=(0,g.useMemo)(()=>n.data.map(e=>{let t=JSON.parse(e.metadata);return[...t.models?.completions??[],...t.models?.embeddings??[]]}),[n.data]);return(0,W.jsxs)(`div`,{className:`space-y-8`,children:[n.data.length>0&&(0,W.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-medium`,children:`AI Providers`}),(0,W.jsx)(`div`,{className:`flex gap-2`,children:(0,W.jsx)(oQt,{})})]}),(0,W.jsx)(DR,{error:i.error}),n.data.map((e,t)=>(0,W.jsxs)(UB,{children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 p-5`,children:[(0,W.jsxs)(`div`,{className:`flex gap-4 items-center`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:e.label}),(0,W.jsx)(PS,{variant:`outline`,size:`lg`,children:e.provider})]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(sQt,{assignment:e,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon`,className:`text-xs`,children:(0,W.jsx)(Wm,{size:16})})}),(0,W.jsx)(qKe,{onConfirm:()=>i.mutate(e.id),description:`Are you sure you want to delete this data model?`,children:(0,W.jsx)(Y,{variant:`ghost`,size:`icon`,className:`text-xs`,children:(0,W.jsx)(Zm,{size:16})})})]})]}),(0,W.jsx)(`div`,{className:`border-t`}),(0,W.jsxs)(`div`,{className:`flex items-baseline p-5 gap-4 text-sm`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:`Models`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:a[t].map(e=>(0,W.jsx)(PS,{size:`lg`,children:e},e))})]})]},e.id)),n.data.length===0&&(0,W.jsxs)(KZt,{className:`p-0`,children:[(0,W.jsxs)(YZt,{children:[(0,W.jsx)(JZt,{children:`Let's add some AI providers`}),`Teams allow you to create custom quotas and budgets for different operations. As a admin you can also be part of different teams.`]}),(0,W.jsx)(qZt,{children:(0,W.jsx)(oQt,{})})]})]})},lQt=()=>(0,W.jsx)(g.Suspense,{fallback:(0,W.jsx)(YB,{}),children:(0,W.jsx)(cQt,{})}),uQt=e=>e.plan===`FREE_V1`,dQt=({account:e,className:t,source:n})=>{let r=e.customDomainsInUse,i=e.entitlements.customDomains,a=uQt(e),o=`${Ce(kR.AccountSettings,{account:e.name})}/upgrade-billing?source=${n}`;return(0,W.jsxs)(UB,{variant:`default`,className:t,children:[(0,W.jsx)(WB,{children:a?`Custom domains require a paid plan`:`Custom domain limit reached`}),(0,W.jsx)(qB,{className:`text-sm leading-relaxed`,children:a?(0,W.jsx)(`p`,{children:`Custom domains let you serve your APIs and developer portal from your own domain. Upgrade to the Builder plan to add custom domains to your account.`}):(0,W.jsxs)(`p`,{children:[`Your account is using`,` `,(0,W.jsxs)(`span`,{className:`font-medium`,children:[r,` of `,i]}),` `,`custom domains. Contact our team to increase your limit.`]})}),(0,W.jsxs)(JB,{className:`flex flex-wrap items-center gap-2`,children:[a?(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsx)(bX,{variant:`ghost`,to:o,children:`Upgrade to Builder`})}):(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsx)(rT,{href:XS,variant:`ghost`,children:`Contact Sales`})}),(0,W.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,W.jsx)(rT,{href:`https://zuplo.com/pricing?utm_source=pzc`,variant:`ghost`,children:`View Plans`})})]})]})},fQt=({used:e,max:t,label:n,account:r,navigationSource:i,className:a,hideAtLimit:o=!1})=>{if(t<=0)return null;let s=e>=t,c=r.plan.startsWith(`FREE`),l=`${Ce(kR.AccountSettings,{account:r.name})}/upgrade-billing${i?`?source=${i}`:``}`;return s?o?null:(0,W.jsxs)(jS,{variant:`warning`,className:a,children:[(0,W.jsx)(Qm,{}),(0,W.jsx)(NS,{children:(0,W.jsxs)(`p`,{children:[`You've reached the limit of `,t,` `,n,` on your plan (`,e,` of`,` `,t,` used).`,` `,c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(bX,{to:l,className:`hover:text-zuplo-pink-hover text-zuplo-pink underline`,children:`Upgrade your plan`}),` `,`to add more.`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(rT,{href:`mailto:${ZS}`,className:`text-zuplo-pink hover:text-zuplo-pink-hover underline`,children:`Contact sales`}),` `,`to increase your limit.`]})]})})]}):(0,W.jsxs)(`p`,{className:G(`text-sm text-muted-foreground`,a),children:[`Using `,e,` of `,t,` `,n,`.`]})},pQt=({className:e})=>(0,W.jsxs)(UB,{variant:`info`,className:e,children:[(0,W.jsx)(WB,{children:`Managed Dedicated Project`}),(0,W.jsx)(qB,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,W.jsxs)(`p`,{className:`leading-loose`,children:[`This project uses Akamai managed dedicated hosting. Custom domains for Akamai must be configured through Akamai CDN. See`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`.`]})})]}),mQt={[MA.PRODUCTION]:`bg-amber-50 text-amber-800 ring-amber-200 dark:bg-amber-900/30 dark:text-amber-200 dark:ring-amber-800/60`,[MA.PREVIEW]:`bg-blue-50 text-blue-700 ring-blue-200 dark:bg-blue-900/30 dark:text-blue-200 dark:ring-blue-800/60`,[MA.WORKING_COPY]:`bg-muted text-muted-foreground ring-border`},hQt=({environmentType:e,className:t})=>{if(!e)return null;let n=e,r=mQt[n];return r?(0,W.jsx)(`span`,{className:G(`inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-medium tracking-wide ring-1 ring-inset`,r,t),children:Z1(n)}):null},gQt=[MA.WORKING_COPY,MA.PRODUCTION,MA.PREVIEW],M7=({environments:e,value:t,onValueChange:n,disabled:r,placeholder:i=`Select an environment`,getOptionValue:a=e=>e.name,sentinel:o,className:s,triggerClassName:c,triggerSize:l=`default`,modal:u=!1,showTriggerBadge:d=!0,id:f,...p})=>{let[m,h]=g.useState(!1),_=g.useMemo(()=>{let t=new Map;for(let n of e){if(!n.environmentType)continue;let e=n.environmentType,r=t.get(e)??[];r.push(n),t.set(e,r)}return gQt.flatMap(e=>{let n=t.get(e);return n&&n.length>0?[{type:e,envs:n}]:[]})},[e]),v=g.useMemo(()=>e.find(e=>a(e)===t),[e,t,a]),y=o!=null&&o.value===t,b=()=>y?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(dm,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:`truncate text-sm`,children:o?.label})]}):v?(0,W.jsx)(_Qt,{env:v,showBadge:d}):(0,W.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:i});return(0,W.jsxs)(EX,{open:m,onOpenChange:h,modal:u,children:[(0,W.jsx)(DX,{asChild:!0,children:(0,W.jsxs)(Y,{id:f,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":m,disabled:r,size:l,className:G(`border-input font-normal w-full justify-between`,c),"data-test":p[`data-test`],children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:b()}),(0,W.jsx)(hm,{className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,W.jsx)(OX,{className:G(`min-w-[320px] w-(--radix-popover-trigger-width) max-w-[480px] p-0 rounded-md shadow-md`,s),side:`bottom`,align:`start`,children:(0,W.jsxs)(G1,{filter:(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase().trim();return!r||n.startsWith(`__sentinel__`)||n.includes(r)?1:0},children:[(0,W.jsx)(K1,{placeholder:`Search environments...`,className:`h-10`}),(0,W.jsxs)(q1,{className:`max-h-[360px]`,children:[(0,W.jsx)(J1,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No environments match.`}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Y1,{children:(0,W.jsxs)(X1,{value:`__sentinel__ ${o.label}`,onSelect:()=>{n(o.value),h(!1)},className:`flex items-center gap-2.5 px-2.5 py-2 cursor-pointer data-[selected=true]:bg-accent`,children:[(0,W.jsx)(dm,{className:G(`size-3.5 shrink-0`,t===o.value?`text-foreground`:`text-muted-foreground`)}),(0,W.jsx)(`span`,{className:G(`flex-1 truncate text-sm`,t===o.value&&`font-medium`),children:o.label}),(0,W.jsx)(mm,{className:G(`size-4 shrink-0 text-muted-foreground`,t===o.value?`opacity-100`:`opacity-0`)})]})}),_.length>0&&(0,W.jsx)(hDt,{})]}),_.map(({type:e,envs:r})=>(0,W.jsx)(Y1,{heading:Z1(e),children:r.map(e=>{let r=a(e);return(0,W.jsx)(vQt,{env:e,isSelected:!y&&r===t,onPick:()=>{n(r),h(!1)}},e.name)})},e))]})]})})]})},_Qt=({env:e,showBadge:t})=>{let n=e.environmentType,r=n===MA.WORKING_COPY,i=r?BR:Im,a=r?`working copy`:e.branchName??e.label;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:G(`truncate min-w-0 flex-1 text-sm text-left`,r?``:`font-mono`),children:a}),t&&(0,W.jsx)(hQt,{environmentType:n,className:`ml-1`})]})},vQt=({env:e,isSelected:t,onPick:n})=>{let r=e.environmentType===MA.WORKING_COPY,i=r?BR:Im,a=r?`working copy`:e.branchName??e.label;return(0,W.jsxs)(X1,{value:[e.branchName,e.name,e.label,Z1(e.environmentType)].filter(Boolean).join(` `),onSelect:n,className:`flex items-center gap-2.5 px-2.5 py-2 cursor-pointer data-[selected=true]:bg-accent`,children:[(0,W.jsx)(i,{strokeWidth:1.5,className:G(`size-3.5 shrink-0`,t?`text-foreground`:`text-muted-foreground`)}),(0,W.jsx)(`span`,{className:G(`flex-1 min-w-0 truncate text-sm`,r?``:`font-mono`,t&&`font-medium`),children:a}),(0,W.jsx)(mm,{className:G(`size-4 shrink-0 text-muted-foreground`,t?`opacity-100`:`opacity-0`)})]})},N7=`Switch`,[yQt,bQt]=pp(N7),[xQt,SQt]=yQt(N7),CQt=g.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=g.useState(null),m=fp(t,e=>p(e)),h=g.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=Ap({prop:i,defaultProp:a??!1,onChange:l,caller:N7});return(0,W.jsxs)(xQt,{scope:n,checked:v,disabled:s,children:[(0,W.jsx)(Tp.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":OQt(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:up(e.onClick,e=>{y(e=>!e),_&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),_&&(0,W.jsx)(DQt,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});CQt.displayName=N7;var wQt=`SwitchThumb`,TQt=g.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=SQt(wQt,n);return(0,W.jsx)(Tp.span,{"data-state":OQt(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});TQt.displayName=wQt;var EQt=`SwitchBubbleInput`,DQt=g.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=g.useRef(null),s=fp(o,a),c=sV(n),l=YC(t);return g.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,W.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});DQt.displayName=EQt;function OQt(e){return e?`checked`:`unchecked`}var kQt=CQt,AQt=TQt;function jQt({className:e,...t}){return(0,W.jsx)(kQt,{"data-slot":`switch`,className:G(`peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,W.jsx)(AQt,{"data-slot":`switch-thumb`,className:G(`bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var P7=({customDomain:e,cname:t,documentationUrl:n=`https://www.zuplo.com/docs/guides/custom-domain-setup`})=>(0,W.jsxs)(`div`,{className:`text-left text-sm text-gray-800 whitespace-pre-line w-full mb-2`,children:[(0,W.jsx)(`p`,{children:`We've set things up on our end, now you need to configure your DNS with a new entry.`}),(0,W.jsx)(`br`,{}),(0,W.jsx)(UB,{variant:`muted`,className:`font-mono p-4 text-sm`,children:(0,W.jsxs)(`ol`,{children:[(0,W.jsx)(`li`,{className:`leading-6`,children:`Type: CNAME`}),(0,W.jsxs)(`li`,{className:`leading-6`,children:[`Name: `,e,` `,(0,W.jsx)(_Q,{textToCopy:e??``})]}),(0,W.jsxs)(`li`,{className:`leading-6`,children:[`Value: `,t,` `,(0,W.jsx)(_Q,{textToCopy:t??``})]}),(0,W.jsx)(`li`,{className:`leading-6`,children:`TTL: 60s or auto`})]})}),(0,W.jsx)(`br`,{}),(0,W.jsx)(`p`,{children:`Note that it does sometimes take a few hours for records to propagate and for the SSL certificate to be created.`}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`p`,{children:[`For more information see our`,` `,(0,W.jsx)(rT,{href:n,children:`documentation on custom domains`}),`.`]})]});function MQt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>!!e.managedDedicatedConfiguration)}function NQt({stage:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n,formIsAlias:r}){return e===`dev-portal`?!1:n?!0:t?!1:r??!1}function PQt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>e.managedDedicatedConfiguration?.vendor===`akamai`)}var F7=()=>(0,W.jsxs)(`div`,{className:`text-left text-sm text-gray-800 whitespace-pre-line w-full mb-2`,children:[(0,W.jsx)(`p`,{children:`This custom domain is setup with an advanced configuration. In order to make changes to this domain, please contact support.`}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`p`,{children:[`For more information see our`,` `,(0,W.jsx)(rT,{href:`https://www.zuplo.com/docs/guides/custom-domain-setup`,children:`documentation on custom domains`}),`.`]})]}),FQt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,IQt=`https://zuplo.com/docs/dedicated/custom-domains`,LQt=Mv({hostname:Ov().regex(FQt,`Please enter a valid domain name (e.g. api.example.com)`),environment:Ov().min(1),stage:Pv([`api`,`dev-portal`]),isAlias:Av().optional()}),RQt=({account:e,projectName:t,disabled:n=!1,isManagedDedicatedProject:r=!1,isAkamaiManagedDedicatedProject:i=!1})=>{let a=vG({resolver:yG(LQt),defaultValues:{hostname:``,environment:``,stage:`api`,isAlias:i}}),[o,s]=(0,g.useState)(!1),[c,l]=a.watch([`isAlias`,`stage`]),{data:u}=Uj(e.name,t),{aliasDomains:d}=e.entitlements,{data:f}=lXt(e.name),p=f?.find(e=>e.name===t),m=p?vOt(new Date(Number(p.createdOn)),new Date(`2025-04-01`)):!1,h=u?u.filter(e=>e.environmentType!==MA.WORKING_COPY):[],_=nZt({onSuccess:()=>{c&&s(!1)}}),v=(0,g.useCallback)(()=>{a.reset(),_.isSuccess&&_.reset(),s(!1)},[a,_]),y=cX(a.formState.isDirty&&!_.isSuccess,v);return(0,W.jsxs)(bA,{open:o,onOpenChange:e=>{e?s(!0):y.guardedClose()},children:[(0,W.jsx)(xA,{asChild:!0,children:(0,W.jsx)(Y,{"data-test":`create-custom-domain-modal-btn`,disabled:n,title:n?`You reached the limit of custom domains`:``,children:`Add Custom Domain`})}),(0,W.jsxs)(CA,{children:[(0,W.jsx)(wA,{children:(0,W.jsx)(EA,{children:`Add Custom Domain`})}),(0,W.jsx)(`div`,{className:`space-y-4`,children:_.isSuccess?(0,W.jsxs)(W.Fragment,{children:[r&&!c&&l===`api`?_.data?.cname?(0,W.jsx)(P7,{customDomain:a.getValues(`hostname`),cname:_.data.cname,documentationUrl:IQt}):(0,W.jsx)(F7,{}):!d&&_.data?.cname&&(0,W.jsx)(P7,{customDomain:a.getValues(`hostname`),cname:_.data?.cname}),!r&&!d&&!_.data?.cname&&l===`api`&&(0,W.jsx)(F7,{}),(0,W.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:(0,W.jsx)(SA,{asChild:!0,children:(0,W.jsx)(Y,{"data-test":`ok-create-custom-domain-btn`,children:`Done`})})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(DR,{error:_.error}),(0,W.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[h.length>0&&(0,W.jsxs)(bG,{...a,children:[i&&(0,W.jsx)(jS,{variant:`info`,children:(0,W.jsx)(NS,{children:`Make sure this hostname is already configured in your Akamai CDN. Registering it here records the alias domain with Zuplo so your public URLs match the client-facing domain.`})}),m&&!i&&(0,W.jsxs)(jS,{variant:`warning`,children:[(0,W.jsx)(MS,{children:`Preview Notice`}),(0,W.jsxs)(NS,{children:[`Custom domains for the Dev Portal are currently in preview and only available after the migration to our preview version.`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/custom-domains`,target:`_blank`,children:`Learn more`})]})]}),(0,W.jsxs)(`form`,{onSubmit:a.handleSubmit(async n=>{await _.mutateAsync({accountName:e.name,projectName:t,isAlias:NQt({stage:n.stage,isManagedDedicatedProject:r,isAkamaiManagedDedicatedProject:i,formIsAlias:n.isAlias}),hostname:n.hostname,deploymentName:n.environment,stage:n.stage})}),children:[(0,W.jsx)(xG,{control:a.control,name:`environment`,render:({field:e})=>(0,W.jsxs)(CG,{className:`mt-2`,children:[(0,W.jsx)(pW,{htmlFor:`environment-field`,children:`Which environment do you want to apply your new domain to?`}),(0,W.jsx)(M7,{id:`environment-field`,"data-test":`environment-field`,environments:h,value:e.value,onValueChange:e.onChange,disabled:_.isPending,placeholder:`Select an environment`}),(0,W.jsx)(EG,{})]})}),!i&&(0,W.jsx)(xG,{control:a.control,name:`stage`,render:({field:e})=>(0,W.jsxs)(CG,{className:`mt-2`,children:[(0,W.jsx)(pW,{className:`block`,htmlFor:`stage-field`,children:`What do you want the custom domain to be assigned to?`}),(0,W.jsxs)(iW,{onValueChange:t=>{(t===`api`||t===`dev-portal`)&&e.onChange(t)},disabled:_.isPending,...e,children:[(0,W.jsx)(oW,{id:`stage-field`,children:(0,W.jsx)(aW,{placeholder:`Select a stage`})}),(0,W.jsxs)(sW,{children:[(0,W.jsx)(cW,{value:`api`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Lm,{size:16}),` Gateway`]})}),(0,W.jsx)(cW,{value:`dev-portal`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(mie,{size:16}),` Dev Portal`,(0,W.jsx)(PS,{className:``,variant:`info`,children:`New`})]})})]})]}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:a.control,name:`hostname`,render:({field:e})=>(0,W.jsxs)(CG,{className:`mt-2`,children:[(0,W.jsx)(pW,{htmlFor:`hostname-field`,children:`Your custom domain (e.g. example.com or api.example.com)`}),(0,W.jsx)(dV,{type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,"data-test":`hostname-field`,...e,disabled:_.isPending}),(0,W.jsx)(EG,{})]})}),(0,W.jsx)(xG,{control:a.control,name:`isAlias`,render:({field:e})=>(0,W.jsx)(CG,{className:G((!d||l===`dev-portal`||r)&&`hidden`,`mt-2`),children:(0,W.jsxs)(UB,{className:`p-4 flex items-center gap-3`,children:[(0,W.jsxs)(pW,{className:`flex flex-col gap-2`,htmlFor:`isAlias`,children:[`Is this an alias domain?`,(0,W.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`If your API Gateway is behind a CDN or WAF, your clients may use a different domain. Use an`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/custom-domains#alias-domains`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`alias domain`}),` `,`so public URLs like docs and OpenAPI match the client-facing domain.`]})]}),(0,W.jsx)(jQt,{className:`mx-3`,id:`isAlias`,"data-test":`isAlias`,checked:e.value??!1,onCheckedChange:e.onChange,disabled:_.isPending}),(0,W.jsx)(EG,{})]})})}),(0,W.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,W.jsx)(SA,{asChild:!0,children:(0,W.jsx)(Y,{type:`button`,"data-test":`cancel-create-custom-domain-btn`,disabled:_.isPending,variant:`secondary`,children:`Cancel`})}),(0,W.jsx)(Y,{type:`submit`,"data-test":`create-custom-domain-btn`,disabled:_.isPending,children:(0,W.jsx)(Tk,{loading:_.isPending,children:`Create`})})]})]})]}),h.length===0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:`Custom domains can only be configured on edge deployment environments and this project only has a working-copy environment.`}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`p`,{children:[` `,`For more information on this see our`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/environments`,children:`documentation on environments`}),`.`]})]})]})]})})]}),(0,W.jsx)(sX,{open:y.showConfirm,onOpenChange:y.setShowConfirm,onDiscard:y.handleDiscard})]})},zQt=`https://zuplo.com/docs/dedicated/custom-domains`,BQt=({customDomain:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n})=>{let[r,i]=(0,g.useState)(void 0),a=()=>{s(),i(void 0)},[o,s]=MR(()=>{let i=r?.deployments.at(0)?.stage,o=r?.deployments.at(0)?.cname,s=typeof o==`string`&&o.length>0;return(0,W.jsx)(HB,{onClose:a,isOpen:!0,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Configure your custom domain`}),n?(0,W.jsx)(pQt,{}):t&&i===`api`?s?(0,W.jsx)(P7,{customDomain:r?.hostname,cname:o,documentationUrl:zQt}):(0,W.jsx)(F7,{}):e.provider===`custom`?(0,W.jsx)(F7,{}):e.provider===`amazon`?s?(0,W.jsx)(P7,{customDomain:r?.hostname,cname:o,documentationUrl:zQt}):(0,W.jsx)(F7,{}):s?(0,W.jsx)(P7,{customDomain:r?.hostname,cname:o}):(0,W.jsx)(F7,{})]})})},[r]),c=e=>{i(e),o()};return(0,W.jsx)(Y,{onClick:()=>{c(e)},"data-test":`view-domain-configuration-btn`,title:`View Configuration`,variant:`ghost`,size:`icon`,children:(0,W.jsx)(zm,{size:18})})},VQt=/held zone/i;function HQt(e){return!!e?.some(e=>VQt.test(e))}var UQt=new Set([`pending`,`pending_migration`,`pending_provisioned`,`active_redeploying`,`provisioned`]),WQt=new Set([`blocked`,`pending_blocked`,`moved`,`deleted`,`pending_deletion`,`test_blocked`,`test_failed`]),GQt=new Set([`initializing`,`pending_validation`,`pending_issuance`,`pending_deployment`,`pending_cleanup`,`staging_deployment`,`holding_deployment`]),KQt=new Set([`expired`,`deactivating`,`inactive`,`initializing_timed_out`,`validation_timed_out`,`issuance_timed_out`,`deployment_timed_out`,`deletion_timed_out`,`deleted`,`pending_deletion`,`pending_expiration`]);function qQt(e){if(e.provider===`alias`)return null;if(e.provider===`custom`||e.provider===`amazon`)return{level:`unknown`,label:`Externally managed`,description:`This domain's status isn't reported to Zuplo — verification and certificates are handled by your dedicated infrastructure provider.`};let t=e.verificationErrors&&e.verificationErrors.length>0,n=e.status??null,r=e.sslStatus??null;if(!n&&!r&&!t)return{level:`pending`,label:`Initializing`,description:`We're waiting for the domain provider to report a status. This usually takes a few seconds after the domain is created.`};if(HQt(e.verificationErrors))return{level:`error`,label:`Zone hold`,description:`Cloudflare is blocking this hostname because the parent domain has a zone hold on another Cloudflare account. The zone owner needs to release the hold before we can finish provisioning.`,helpUrl:`https://developers.cloudflare.com/fundamentals/account/account-security/zone-holds/`,helpLabel:`How to release a zone hold`};if(t)return{level:`error`,label:`Needs attention`,description:`The domain provider reported verification errors. Review the details to resolve them.`};if(n&&WQt.has(n))return{level:`error`,label:I7(n),description:`The domain is in a state that prevents it from serving traffic. Contact support if this persists.`};if(r&&KQt.has(r))return{level:`error`,label:`SSL error`,description:`The SSL certificate is in the "${I7(r)}" state. The domain may not serve HTTPS traffic until this is resolved.`};let i=n===`active`||n===`test_active`||n===`test_active_apex`;return i&&(r===`active`||r===`staging_active`||r===`backup_issued`)?{level:`active`,label:`Active`,description:`The domain is verified and serving traffic over HTTPS.`}:i&&r&&GQt.has(r)?{level:`pending`,label:`Issuing certificate`,description:`The domain is verified. We're still provisioning the SSL certificate — this usually takes a few minutes.`}:n&&UQt.has(n)?{level:`pending`,label:`Verifying domain`,description:`We're waiting for DNS verification. Double-check the CNAME record at your DNS provider.`}:n||r?{level:`pending`,label:I7(n??r??`pending`),description:`The domain is still being set up. If this state persists, contact support.`}:{level:`unknown`,label:`Unknown`,description:`No status information is available for this domain.`}}function I7(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var JQt={active:{dot:`bg-green-500`,pulse:!1,pill:`bg-green-50 text-green-700 border-green-200 hover:bg-green-100 dark:bg-green-950 dark:text-green-300 dark:border-green-800 dark:hover:bg-green-900`},pending:{dot:`bg-amber-500`,pulse:!0,pill:`bg-amber-50 text-amber-800 border-amber-200 hover:bg-amber-100 dark:bg-amber-950 dark:text-amber-300 dark:border-amber-800 dark:hover:bg-amber-900`},error:{dot:`bg-red-500`,pulse:!1,pill:`bg-red-50 text-red-700 border-red-200 hover:bg-red-100 dark:bg-red-950 dark:text-red-300 dark:border-red-800 dark:hover:bg-red-900`},unknown:{dot:`bg-gray-400`,pulse:!1,pill:`bg-gray-50 text-gray-700 border-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700`}},YQt=({domain:e})=>{let t=qQt(e);if(!t)return null;let n=JQt[t.level],r=e.verificationErrors??[];return(0,W.jsxs)(EX,{children:[(0,W.jsx)(DX,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,className:G(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n.pill),"aria-label":`${e.hostname} status: ${t.label}`,children:[(0,W.jsxs)(`span`,{className:`relative flex size-2 items-center justify-center`,children:[n.pulse&&(0,W.jsx)(`span`,{className:G(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,n.dot)}),(0,W.jsx)(`span`,{className:G(`relative inline-flex size-2 rounded-full`,n.dot)})]}),t.label]})}),(0,W.jsx)(OX,{align:`start`,className:`w-96`,children:(0,W.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:G(`inline-flex size-2 rounded-full`,n.dot)}),(0,W.jsx)(`span`,{className:`font-medium`,children:t.label})]}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:t.description}),t.helpUrl&&(0,W.jsx)(rT,{href:t.helpUrl,className:`text-xs`,children:t.helpLabel??`Learn more`}),r.length>0&&(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Verification errors`}),(0,W.jsx)(`ul`,{className:`list-disc pl-5 space-y-1 text-red-700 dark:text-red-400`,children:r.map(e=>(0,W.jsx)(`li`,{children:e},e))})]})]})})]})},XQt=({account:e,currentDomainConfig:t})=>{let{logEvent:n,captureException:r}=Rg(),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),c=e=>{let t=e.target.value;a(t)},l=iZt(),u=async()=>{try{if(s(``),!t.hostname||t.hostname.trim()===``){s(`The current domain configuration does not have a hostname associated with it`);return}await l.mutateAsync({accountName:e.name,projectName:t.projectName??``,hostname:t.hostname,deploymentName:t.deployments[0]?.deploymentName}),n(`account-custom-domain-delete-success`,{account:e.name}),d()}catch(t){r(t);let i=Bj(t);s(i),n(`account-custom-domain-delete-failed`,{account:e.name,errorMessage:i})}},d=()=>{p(),a(``),s(``)},[f,p]=MR(()=>(0,W.jsx)(HB,{onClose:d,isOpen:!0,maxWidth:`max-w-xl`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Delete custom domain`}),(0,W.jsx)(DR,{error:o,className:`mb-3`}),(0,W.jsxs)(`div`,{className:`text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,W.jsxs)(`div`,{className:`relative bg-yellow-100 dark:bg-yellow-950/40 rounded-sm p-4 text-yellow-900 dark:text-yellow-200 text-sm whitespace-pre-line w-full mb-2`,children:[(0,W.jsxs)(`div`,{className:`flex space-x-2 items-center`,children:[(0,W.jsx)(ym,{className:`h-5 w-5 text-yellow-900 dark:text-yellow-200`}),(0,W.jsx)(`span`,{className:`text-sm font-medium antialiased mt-0.5`,children:`Caution: Your project will no longer be accessible with this domain.`})]}),(0,W.jsxs)(`p`,{className:`px-2 mt-4`,children:[`You are about to delete the custom domain`,` `,(0,W.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`from your project. Requests using it will no longer reach your zup.`]})]}),(0,W.jsx)(`br`,{}),(0,W.jsxs)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:[`Please type`,` `,(0,W.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`to confirm.`]}),(0,W.jsx)(`input`,{className:`shadow-xs focus:ring-indigo-500 focus:border-indigo-500 block w-full text-sm border-border rounded-md mb-4 placeholder-gray-400 dark:placeholder-neutral-500 disabled:opacity-50`,type:`text`,autoComplete:`off`,value:i,onChange:c,id:`hostname-field`,"data-test":`hostname-field`}),(0,W.jsx)(`div`,{className:` text-red-500`,children:`I understand the consequences, delete this custom domain`})]}),(0,W.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,W.jsx)(Y,{onClick:d,"data-test":`cancel-delete-custom-domain-btn`,variant:`outline`,disabled:l.isPending,children:`Cancel`}),(0,W.jsx)(Y,{"data-test":`delete-custom-domain-btn`,onClick:u,disabled:l.isPending||i!==t.hostname,children:(0,W.jsx)(Tk,{loading:l.isPending,children:`Delete`})})]})]})}),[l.isPending,o,t,i]);return(0,W.jsx)(Y,{type:`button`,title:`Delete Custom Domain`,onClick:f,"data-test-id":`delete-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,W.jsx)(Tk,{loading:l.isPending,children:(0,W.jsx)(Zm,{size:18})})})},ZQt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,QQt=({account:e,projectName:t,currentDomainConfig:n})=>{let{logEvent:r,captureException:i}=Rg(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(n.deployments[0]?.deploymentName),d=n.hostname,{data:f,error:p}=Uj(e.name,t),m=Bj(p);(0,g.useEffect)(()=>{m&&o(m)},[m]);let h=f?f.filter(e=>e.environmentType!==MA.WORKING_COPY):[],_=rZt(),v=async n=>{if(n.preventDefault(),!l||l.trim()===``){o(`Please select an environment from the options available`);return}if(!d||d.trim()===``){o(`Please provide a value on the custom domain field.`);return}if(d&&!ZQt.test(d)){o(`A custom domain value should only be the domain name. It should not start with 'http(s)' and should end with an alpha character.`);return}try{o(``),await _.mutateAsync({accountName:e.name,projectName:t,hostname:d,deploymentName:l}),c(!0),r(`account-custom-domain-edit-success`,{account:e.name})}catch(t){i(t);let n=Bj(t);r(`account-custom-domain-edit-failed`,{account:e.name,errorMessage:n}),o(n),c(!1)}},y=()=>{x(),u(n.deployments[0]?.deploymentName),o(``),c(!1)},[b,x]=MR(()=>(0,W.jsx)(HB,{onClose:y,isOpen:!0,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`text-xl font-medium`,children:`Edit your custom domain`}),(0,W.jsx)(DR,{error:a}),(0,W.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[s===!1&&(0,W.jsxs)(`form`,{onSubmit:v,children:[(0,W.jsx)(`label`,{className:`block mb-2`,htmlFor:`environment-field`,children:`Which environment do you want to apply your custom domain to ?`}),(0,W.jsx)(`div`,{className:`mb-9`,children:(0,W.jsx)(M7,{id:`environment-field`,"data-test":`environment-field`,environments:h,value:l??``,onValueChange:e=>u(e),disabled:_.isPending,placeholder:`Select an environment`})}),(0,W.jsx)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:`Your custom domain`}),(0,W.jsx)(`input`,{className:`shadow-xs focus:ring-indigo-500 focus:border-indigo-500 block w-full text-sm border-border rounded-md mb-9 placeholder-gray-400 dark:placeholder-neutral-500 disabled:opacity-50`,type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,value:d,disabled:!0,"data-test":`hostname-field`}),(0,W.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,W.jsx)(Y,{variant:`outline`,type:`button`,onClick:y,"data-test":`cancel-edit-custom-domain-btn`,disabled:_.isPending,children:`Cancel`}),(0,W.jsx)(Y,{"data-test":`save-edit-custom-domain-btn`,type:`submit`,disabled:_.isPending||l===n.deployments[0]?.deploymentName,children:(0,W.jsx)(Tk,{loading:_.isPending,children:`Save`})})]})]}),s===!0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:(0,W.jsxs)(`p`,{children:[`Successfully edited custom domain`,` `,(0,W.jsx)(rT,{href:`https://${d}`,children:d}),` `,`to map to deployment `,l]})}),(0,W.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:(0,W.jsx)(Y,{variant:`outline`,className:`w-24 justify-center`,type:`button`,onClick:y,"data-test":`ok-edit-custom-domain-btn`,disabled:!s,children:`OK`})})]})]})]})}),[h,a]),S=()=>{b()};return(0,W.jsx)(Y,{onClick:()=>S(),title:`Edit Custom Domain`,"data-test-id":`edit-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,W.jsx)(Tk,{loading:_.isPending,children:(0,W.jsx)(Vre,{size:18})})})},$Qt=({classNames:e,projectType:t,feature:n,helpUrl:r})=>(0,W.jsxs)(UB,{variant:`danger`,className:e,children:[(0,W.jsx)(WB,{children:t===`managed-dedicated`?`Managed Dedicated Project`:t===`self-hosted`?`Self Hosted Project`:`Managed Edge Project`}),(0,W.jsx)(qB,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,W.jsxs)(`p`,{className:`leading-loose`,children:[`Your project is running on a `,t===`managed-dedicated`?`managed dedicated`:t===`self-hosted`?`self hosted`:`managed edge hosted`,` environment. For information on how to setup up `,n,`, please refer to`,` `,(0,W.jsx)(rT,{href:r,children:`the documentation`}),`.`]})})]});function e$t(){return(0,W.jsx)(`button`,{type:`button`,disabled:!0,title:`Locked custom domain`,className:`items-center justify-center p-2 hover:bg-gray-100 rounded-sm cursor-pointer`,children:(0,W.jsx)(Um,{className:`h-5 w-5 mx-auto`,"aria-hidden":`true`})})}var t$t=()=>{let e=oh([`account`,`project`]),t=aZt(e.account.name,e.project.name),n=dXt(e.account.name,e.project.name);if(!t.data||!n.data)return(0,W.jsx)(YB,{});let r=t.data?.filter(t=>t.projectName&&t.projectName===e.project.name&&t.deployments[0]).sort((e,t)=>e.deployments[0].deploymentName.localeCompare(t.deployments[0].deploymentName)),i=e.account.customDomainsInUse>=e.account.entitlements.customDomains,a=PQt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration}),o=MQt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration});return(0,W.jsxs)(`div`,{className:`flex gap-4 flex-col`,children:[(0,W.jsx)(T7,{title:`Custom Domains`}),(0,W.jsx)(jS,{variant:`outline`,className:`text-sm`,children:(0,W.jsx)(NS,{children:(0,W.jsxs)(`p`,{children:[(0,W.jsx)(rT,{href:`https://zuplo.com/docs/articles/custom-domains`,children:`Custom domains`}),` `,`allow you to use your own domain name for your API and developer portal. For complex custom domain configurations, please contact us at`,` `,(0,W.jsx)(rT,{href:`mailto:${YS}`,children:YS}),` `,`or use the chat widget at the bottom right.`]})})}),i&&e.account.entitlements.customDomains>0&&e.project.type!==`self-hosted`&&!a&&(0,W.jsx)(dQt,{account:e.account,source:`custom-domain-limit`}),!i&&e.project.type!==`self-hosted`&&!a&&(0,W.jsx)(fQt,{used:e.account.customDomainsInUse,max:e.account.entitlements.customDomains,label:`custom domains`,account:e.account,hideAtLimit:!0}),r.length>0&&(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(t=>{let n=t.deployments[0],r=o&&n?.stage===`api`,i=t.provider===`custom`&&!r,s=t.provider===`alias`,c=n.stage===`dev-portal`,l=a&&!s||i;return(0,W.jsxs)(UB,{className:`p-4 flex items-center justify-between gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`shrink-0 flex size-9 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:c?(0,W.jsx)(mie,{className:`size-4`}):(0,W.jsx)(Lm,{className:`size-4`})}),(0,W.jsxs)(`div`,{className:`flex flex-col min-w-0 gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,W.jsxs)(`a`,{href:`https://${t.hostname}`,target:`_blank`,rel:`noreferrer`,className:`font-medium text-sm hover:text-zuplo-pink transition-colors inline-flex items-center gap-1 truncate`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:t.hostname}),(0,W.jsx)(Am,{className:`size-3 shrink-0 opacity-60`})]}),(0,W.jsx)(YQt,{domain:t}),n.isDefault&&(0,W.jsx)(PS,{variant:`outline`,className:`text-xs`,children:`Default`}),s&&(0,W.jsx)(PS,{variant:`outline`,className:`text-xs`,children:`Alias`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:c?`Dev Portal`:`API`}),(0,W.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(_Dt,{env:n.environmentType??null}),` `,`(`,n.deploymentName,`)`]}),n.branch&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,W.jsx)(Im,{className:`size-3`}),n.branch]})]})]})]})]}),(0,W.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1`,children:[!s&&(0,W.jsx)(BQt,{customDomain:t,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a}),l?(0,W.jsx)(e$t,{}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(QQt,{account:e.account,projectName:e.project.name,currentDomainConfig:t}),(0,W.jsx)(XQt,{account:e.account,currentDomainConfig:t})]})]})]},t.id)})}),e.project.type===`self-hosted`?(0,W.jsx)($Qt,{classNames:`mt-5`,feature:`custom domains`,helpUrl:`https://zuplo.com/docs/dedicated/custom-domains`,projectType:e.project.type}):a?e.account.entitlements.aliasDomains?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[(0,W.jsx)(jS,{variant:`info`,className:`text-sm`,children:(0,W.jsx)(NS,{children:(0,W.jsxs)(`p`,{children:[`This project uses Akamai managed dedicated hosting. Configure the hostname in your Akamai CDN first — see the`,` `,(0,W.jsx)(rT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`. Once it's set up there, add the domain below to register it with Zuplo.`]})})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(RQt,{account:e.account,projectName:e.project.name,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:!0})})]}):(0,W.jsx)(pQt,{className:`mt-5`}):e.account.entitlements.customDomains>0?(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(RQt,{disabled:i,account:e.account,projectName:e.project.name,isManagedDedicatedProject:o})}):(0,W.jsx)(dQt,{account:e.account,source:`custom-domain`,className:`mt-5`})]})},n$t=`__NULL_BRANCH`,r$t=e=>{let t=[];return e.production&&t.push(`production`),e.preview&&t.push(`preview`),e.workingCopy&&t.push(`working-copy`),t},i$t=({previewEnvironments:e,defaultBranch:t})=>{let{register:n,watch:r,setValue:i,getValues:a,control:o}=zW(),s=r(`personalOverride`),c=r(`preview`),l=r(`workingCopy`),u=a(),d=u.production||u.preview||u.workingCopy;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 mt-4`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium`,children:`Environments`}),(0,W.jsx)(L7,{id:`production`,testId:`production-checkbox`,register:n(`production`),title:`Production`,description:t?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(Im,{className:`size-3`}),(0,W.jsx)(`span`,{className:`font-mono`,children:t})]}):`The branch deployed to production`}),(0,W.jsx)(L7,{id:`preview`,testId:`preview-checkbox`,register:n(`preview`),title:`Preview`,description:(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(Im,{className:`size-3`}),`All non-production branches`]}),action:(0,W.jsx)(WW,{control:o,name:`targetBranch`,render:({field:t})=>(0,W.jsx)(M7,{environments:e,value:t.value??`__NULL_BRANCH`,onValueChange:t.onChange,disabled:!c,getOptionValue:e=>e.branchName??``,sentinel:{value:n$t,label:`All other branches`},triggerClassName:`w-72 h-10`,showTriggerBadge:!1,"data-test":`preview-branch-picker`})})}),(0,W.jsx)(L7,{id:`workingCopy`,testId:`working-copy-checkbox`,register:n(`workingCopy`),title:`Development`,description:(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(BR,{className:`size-3`}),`Your Working Copy & Local Dev`]}),action:l&&(0,W.jsx)(`button`,{type:`button`,"data-test":`personal-override-button`,className:`text-xs text-zuplo-pink hover:underline whitespace-nowrap`,onClick:()=>{i(`personalOverride`,!s,{shouldDirty:!0,shouldTouch:!0})},children:s?`Clear personal override`:`Set personal override`})}),l&&s&&(0,W.jsxs)(`div`,{className:`ml-7 rounded-md border border-dashed bg-muted/40 p-3 flex flex-col gap-1.5`,children:[(0,W.jsx)(`label`,{htmlFor:`personal-value`,className:`text-sm font-medium`,children:`Personal override`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Only applied in your own Working Copy & Local Dev. Other developers won’t see this value.`}),(0,W.jsx)(dV,{id:`personal-value`,"data-test":`personal-override-input`,...n(`personalValue`)})]}),!d&&(0,W.jsx)(jS,{children:(0,W.jsx)(NS,{children:`You must select at least one environment`})})]})},L7=({id:e,testId:t,register:n,title:r,description:i,action:a})=>(0,W.jsxs)(`div`,{className:G(`flex min-h-16 items-center gap-3 rounded-md border bg-background px-4 py-3`,`transition-colors hover:border-foreground/20`),children:[(0,W.jsx)(`input`,{id:e,"data-test":t,type:`checkbox`,className:`size-4 rounded-sm border border-gray-300 shadow-sm shrink-0`,...n}),(0,W.jsxs)(`label`,{htmlFor:e,className:`flex-1 min-w-0 cursor-pointer`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium leading-tight`,children:r}),(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:i})]}),a&&(0,W.jsx)(`div`,{className:`shrink-0`,children:a})]}),a$t=({mode:e})=>{let{register:t,formState:n}=zW();return(0,W.jsxs)(`div`,{className:`flex flex-col`,children:[n.errors.name?.message&&(0,W.jsx)(DR,{error:n.errors.name.message,"data-test":`variable-name-input-error-validation-message`}),(0,W.jsx)(`span`,{className:`text-sm`,children:`Name`}),(0,W.jsx)(`div`,{className:`flex flex-col items-top gap-2`,children:(0,W.jsx)(dV,{id:`name`,onInput:e=>{let t=e.target,n=t.selectionStart;t.value=t.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`),t.setSelectionRange(n,n)},...t(`name`,{disabled:e===`edit`,pattern:{value:/^[^0-9a-z\W][A-Z0-9_]*$/,message:`Name must be SCREAMING_SNAKE_CASE and must start with a letter`}}),title:e===`edit`?`Name cannot be changed, create a new variable instead`:``,type:`text`,"data-test":`variable-name-input`})})]})},o$t=({variable:e,previewEnvironments:t,defaultBranch:n,onClose:r,isSaving:i,error:a,mode:o,onSubmit:s})=>{let c=vG({defaultValues:{preview:e.targets.includes(`preview`),production:e.targets.includes(`production`),workingCopy:e.targets.includes(`working-copy`),name:e.name,isSecret:e.type===`secret`,value:o===`edit`&&e.type===`secret`?`*******`:e.value??null,personalOverride:e.personalValue!==void 0,personalValue:e.personalValue??null,targetBranch:e.targetBranch??`__NULL_BRANCH`},mode:`onChange`}),{getValues:l,control:u,register:d,watch:f}=c,{isValid:p,dirtyFields:m,touchedFields:h}=HW({control:u}),_=l(),v=_.production||_.preview||_.workingCopy,y=!i&&v&&p,b=()=>{s(l(),m,h)},x=(0,g.useRef)(null),S=(0,g.useRef)(null);return(0,W.jsx)(g7e,{...c,children:(0,W.jsx)(HB,{isOpen:!0,maxWidth:`max-w-2xl`,onClose:r,children:(0,W.jsx)(`div`,{className:`flex flex-col mt-6`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(DR,{error:a}),(0,W.jsx)(a$t,{mode:o}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`text-sm`,children:`Value`}),(0,W.jsx)(WW,{control:u,name:`value`,render:({fieldState:{isDirty:e},field:{value:t,disabled:n,...r}})=>(0,W.jsxs)(`div`,{className:G(`rounded-sm border border-border w-full relative max-h-48`,n&&`bg-gray-100 dark:bg-neutral-800`),ref:S,children:[(0,W.jsxs)(`pre`,{className:G(`font-mono text-zuplo-pink p-2 overflow-hidden max-h-48 text-sm whitespace-pre`,n&&`invisible`),ref:x,children:[[...t??``].map((e,t)=>{switch(e){case`
1652
1652
  `:return(0,W.jsxs)(`span`,{className:`text-zuplo-pink pl-[0.5px]`,children:[`↵`,`
1653
1653
  `]},t);case` `:return(0,W.jsx)(`span`,{className:`text-gray-300 dark:text-neutral-600`,children:`␣`},t)}return(0,W.jsx)(`span`,{className:`invisible`,children:e},t)}),`
1654
1654
  `]}),(0,W.jsx)(`textarea`,{onScroll:e=>{e.target instanceof HTMLTextAreaElement&&x.current?.scrollTo({top:e.target.scrollTop,left:e.target.scrollLeft,behavior:`instant`})},onFocus:()=>{!e&&f(`isSecret`)&&r.onChange(``)},spellCheck:!1,disabled:n,...r,className:G(`absolute top-0 left-0 h-full flex-1 border min-w-0 block p-2 rounded-sm`,`bg-transparent border-0 w-full font-mono text-sm overflow-auto resize-none outline-hidden whitespace-pre`,`disabled:opacity-50 disabled:hover:cursor-not-allowed disabled:cursor-not-allowed`),"data-test":`variable-value-input`,value:t??``})]},`value`)})]}),(0,W.jsxs)(`label`,{className:G(`flex flex-row border rounded-sm bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/60 p-4 gap-4`,o===`edit`&&`bg-gray-100 dark:bg-neutral-800 border-border opacity-30`),children:[(0,W.jsx)(`input`,{...d(`isSecret`),id:`is-secret`,disabled:o===`edit`,className:`rounded-sm border border-border shadow-sm mt-0.5`,type:`checkbox`,"data-test":`is-secret-checkbox`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`is-secret`,className:`whitespace-nowrap`,children:`Secret`}),(0,W.jsx)(`div`,{className:`text-sm`,children:`Secrets are environment variables that are encrypted and not visible after they are set. Secrets are used for storing sensitive information like API keys and auth token.`})]})]}),(0,W.jsx)(i$t,{previewEnvironments:t,defaultBranch:n,variable:e}),(0,W.jsxs)(`div`,{className:`flex flex-row space-x-2 mt-3 justify-between`,children:[(0,W.jsx)(Y,{onClick:()=>r(),variant:`secondary`,children:`Cancel`}),(0,W.jsxs)(Y,{disabled:!y,type:`button`,"data-test":`save-variable`,onClick:b,children:[i&&(0,W.jsx)(gL,{borderPositionAndSize:`w-4 h-4 border-2 border-white mr-2`}),`Save`]})]})]})})})})};function s$t({variable:e,previewEnvironments:t,onClose:n,account:r,project:i}){let a=ah(),{logEvent:o,captureException:s}=Rg(),c=Sgt(),l=(e,t,s)=>{o(`env-var-edited`,{type:e,targets:t.join(`,`),personalOverride:`${s}`,account:r,project:i.name});let c=t.filter(e=>e!==`working-copy`);i.sourceRepoUrl!=null&&c.length>0&&a.success(`Redeploy your project to apply changes.`,{title:`Redeploy required`,icon:(0,W.jsx)(Km,{className:`h-6 w-6`})}),n()};return(0,W.jsx)(o$t,{variable:e,previewEnvironments:t,defaultBranch:i.defaultBranch,mode:`edit`,onSubmit:(t,n,a)=>{let u=r$t(t),d={id:e.id,name:e.name,value:a.value?t.value??void 0:void 0,targets:a.production||a.preview||a.workingCopy?u:void 0};if(n.targetBranch){let e=t.targetBranch;d.targetBranch=e===`__NULL_BRANCH`?null:e}a.preview&&t.preview===!1&&(d.targetBranch=null),n.personalOverride&&t.personalOverride&&(d.personalValue=``),n.personalValue&&(d.personalValue=t.personalValue),(n.workingCopy&&t.workingCopy===!1||n.personalOverride&&t.personalOverride===!1)&&(d.personalValue=null),c.mutate({accountName:r,projectName:i.name,variableData:d},{onSuccess:()=>l(d.type??`config`,d.targets??e.targets,t.personalOverride),onError:e=>{o(`env-var-edit-failed`,{account:r,project:i.name}),s(e)}})},onClose:n,isSaving:c.isPending,error:c.error})}var c$t=e=>{let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect().width>e.getBoundingClientRect().width},l$t=()=>{let[e,t]=(0,g.useState)(!1);return{tooltipProps:(0,g.useMemo)(()=>{if(!e)return{open:!1}},[e]),triggerProps:(0,g.useMemo)(()=>({ref:e=>{e&&t(c$t(e))}}),[])}};function u$t({isSecret:e}){return e?(0,W.jsx)(Um,{className:`h-4 w-auto`}):(0,W.jsx)(Em,{className:`h-4 w-auto`})}var d$t=({variable:e,asIcon:t=!1})=>(0,W.jsxs)(Egt,{children:[(0,W.jsx)(Dgt,{asChild:!0,children:t?(0,W.jsx)(Y,{variant:`ghost`,size:`icon`,className:`flex items-center`,children:(0,W.jsx)(Em,{className:`w-4 h-4`})}):(0,W.jsxs)(Y,{variant:`secondary`,size:`default`,className:`flex items-center gap-2`,children:[(0,W.jsx)(Em,{className:`w-4 h-4`}),`Get Code Snippet`]})}),(0,W.jsxs)(vX,{side:`right`,className:`sm:max-w-none w-1/3 min-w-[500px]`,children:[(0,W.jsx)(`div`,{className:`text-lg font-semibold border-b`,children:`Code Snippets`}),(0,W.jsx)(`p`,{className:`my-2 text-sm`,children:`Use this Code Snippet anywhere in your modules to access your environment variable.`}),(0,W.jsx)(UB,{offset:`md`,className:`bg-gray-200 text-xs `,children:(0,W.jsxs)(`pre`,{id:`codePre`,"data-lang":`typescript`,className:`pre font-mono text-gray-900 overflow-x-auto`,children:[`import `,`{`,` environment `,`}`,` from "@zuplo/runtime";`,`\r
@@ -1665,4 +1665,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1665
1665
  `+n):e.stack=n}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=D9(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&M9.assertOptions(n,{silentJSONParsing:N9.transitional(N9.boolean),forcedJSONParsing:N9.transitional(N9.boolean),clarifyTimeoutError:N9.transitional(N9.boolean),legacyInterceptorReqResOrdering:N9.transitional(N9.boolean)},!1),r!=null&&($.isFunction(r)?t.paramsSerializer={serialize:r}:M9.assertOptions(r,{encode:N9.function,serialize:N9.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),M9.assertOptions(t,{baseUrl:N9.spelling(`baseURL`),withXsrfToken:N9.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&$.merge(i.common,i[t.method]);i&&$.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=C9.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||h9;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[x2t.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=x2t.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=D9(this.defaults,e),w0t(e2t(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};$.forEach([`delete`,`get`,`head`,`options`],function(e){P9.prototype[e]=function(t,n){return this.request(D9(n||{},{method:e,url:t,data:(n||{}).data}))}}),$.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(D9(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}P9.prototype[e]=t(),P9.prototype[e+`Form`]=t(!0)});var T2t=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new T9(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function E2t(e){return function(t){return e.apply(null,t)}}function D2t(e){return $.isObject(e)&&e.isAxiosError===!0}var F9={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(F9).forEach(([e,t])=>{F9[t]=e});function O2t(e){let t=new P9(e),n=T1t(P9.prototype.request,t);return $.extend(n,P9.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return O2t(D9(e,t))},n}var I9=O2t(y9);I9.Axios=P9,I9.CanceledError=T9,I9.CancelToken=T2t,I9.isCancel=U0t,I9.VERSION=S2t,I9.toFormData=p9,I9.AxiosError=d9,I9.Cancel=I9.CanceledError,I9.all=function(e){return Promise.all(e)},I9.spread=E2t,I9.isAxiosError=D2t,I9.mergeConfig=D9,I9.AxiosHeaders=C9,I9.formToJSON=e=>P0t($.isHTMLForm(e)?new FormData(e):e),I9.getAdapter=b2t.getAdapter,I9.HttpStatusCode=F9,I9.default=I9;var k2t=e(i(((e,t)=>{var n=new Set(`ENOTFOUND.ENETUNREACH.UNABLE_TO_GET_ISSUER_CERT.UNABLE_TO_GET_CRL.UNABLE_TO_DECRYPT_CERT_SIGNATURE.UNABLE_TO_DECRYPT_CRL_SIGNATURE.UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY.CERT_SIGNATURE_FAILURE.CRL_SIGNATURE_FAILURE.CERT_NOT_YET_VALID.CERT_HAS_EXPIRED.CRL_NOT_YET_VALID.CRL_HAS_EXPIRED.ERROR_IN_CERT_NOT_BEFORE_FIELD.ERROR_IN_CERT_NOT_AFTER_FIELD.ERROR_IN_CRL_LAST_UPDATE_FIELD.ERROR_IN_CRL_NEXT_UPDATE_FIELD.OUT_OF_MEM.DEPTH_ZERO_SELF_SIGNED_CERT.SELF_SIGNED_CERT_IN_CHAIN.UNABLE_TO_GET_ISSUER_CERT_LOCALLY.UNABLE_TO_VERIFY_LEAF_SIGNATURE.CERT_CHAIN_TOO_LONG.CERT_REVOKED.INVALID_CA.PATH_LENGTH_EXCEEDED.INVALID_PURPOSE.CERT_UNTRUSTED.CERT_REJECTED.HOSTNAME_MISMATCH`.split(`.`));t.exports=e=>!n.has(e&&e.code)}))()),A2t=`axios-retry`;function j2t(e){return e.response||!e.code||[`ERR_CANCELED`,`ECONNABORTED`].includes(e.code)?!1:(0,k2t.default)(e)}var M2t=[`get`,`head`,`options`],N2t=M2t.concat([`put`,`delete`]);function L9(e){return e.code!==`ECONNABORTED`&&(!e.response||e.response.status===429||e.response.status>=500&&e.response.status<=599)}function P2t(e){return e.config?.method?L9(e)&&M2t.indexOf(e.config.method)!==-1:!1}function F2t(e){return e.config?.method?L9(e)&&N2t.indexOf(e.config.method)!==-1:!1}function I2t(e){return j2t(e)||F2t(e)}function R9(e=void 0){let t=e?.response?.headers[`retry-after`];if(!t)return 0;let n=(Number(t)||0)*1e3;return n===0&&(n=(new Date(t).valueOf()||0)-Date.now()),Math.max(0,n)}function L2t(e=0,t=void 0){return Math.max(0,R9(t))}function R2t(e=0,t=void 0,n=100){let r=2**e*n,i=Math.max(r,R9(t));return i+i*.2*Math.random()}function z2t(e=100){return(t=0,n=void 0)=>{let r=t*e;return Math.max(r,R9(n))}}var B2t={retries:3,retryCondition:I2t,retryDelay:L2t,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function V2t(e,t){return{...B2t,...t,...e[A2t]}}function H2t(e,t,n=!1){let r=V2t(e,t||{});return r.retryCount=r.retryCount||0,(!r.lastRequestTime||n)&&(r.lastRequestTime=Date.now()),e[A2t]=r,r}function U2t(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}async function W2t(e,t){let{retries:n,retryCondition:r}=e,i=(e.retryCount||0)<n&&r(t);if(typeof i==`object`)try{return await i!==!1}catch{return!1}return i}async function G2t(e,t,n,r){t.retryCount+=1;let{retryDelay:i,shouldResetTimeout:a,onRetry:o}=t,s=i(t.retryCount,n);if(U2t(e,r),!a&&r.timeout&&t.lastRequestTime){let e=Date.now()-t.lastRequestTime,i=r.timeout-e-s;if(i<=0)return Promise.reject(n);r.timeout=i}return r.transformRequest=[e=>e],await o(t.retryCount,n,r),r.signal?.aborted?Promise.resolve(e(r)):new Promise(t=>{let n=()=>{clearTimeout(i),t(e(r))},i=setTimeout(()=>{t(e(r)),r.signal?.removeEventListener&&r.signal.removeEventListener(`abort`,n)},s);r.signal?.addEventListener&&r.signal.addEventListener(`abort`,n,{once:!0})})}async function K2t(e,t){e.retryCount>=e.retries&&await e.onMaxRetryTimesExceeded(t,e.retryCount)}var z9=(e,t)=>({requestInterceptorId:e.interceptors.request.use(e=>(H2t(e,t,!0),e[`axios-retry`]?.validateResponse&&(e.validateStatus=()=>!1),e)),responseInterceptorId:e.interceptors.response.use(null,async n=>{let{config:r}=n;if(!r)return Promise.reject(n);let i=H2t(r,t);return n.response&&i.validateResponse?.(n.response)?n.response:await W2t(i,n)?G2t(e,i,n,r):(await K2t(i,n),Promise.reject(n))})});z9.isNetworkError=j2t,z9.isSafeRequestError=P2t,z9.isIdempotentRequestError=F2t,z9.isNetworkOrIdempotentRequestError=I2t,z9.exponentialDelay=R2t,z9.linearDelay=z2t,z9.isRetryableError=L9;var q2t=(typeof self<`u`?self:null)||(typeof window<`u`?window:null)||q2t,B9=class{type=3;name=``;prefix=``;value=``;suffix=``;modifier=3;constructor(e,t,n,r,i,a){this.type=e,this.name=t,this.prefix=n,this.value=r,this.suffix=i,this.modifier=a}hasCustomName(){return this.name!==``&&typeof this.name!=`number`}},J2t=/[$_\p{ID_Start}]/u,Y2t=/[$_\u200C\u200D\p{ID_Continue}]/u,V9=`.*`;function X2t(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}function Z2t(e,t=!1){let n=[],r=0;for(;r<e.length;){let i=e[r],a=function(i){if(!t)throw TypeError(i);n.push({type:`INVALID_CHAR`,index:r,value:e[r++]})};if(i===`*`){n.push({type:`ASTERISK`,index:r,value:e[r++]});continue}if(i===`+`||i===`?`){n.push({type:`OTHER_MODIFIER`,index:r,value:e[r++]});continue}if(i===`\\`){n.push({type:`ESCAPED_CHAR`,index:r++,value:e[r++]});continue}if(i===`{`){n.push({type:`OPEN`,index:r,value:e[r++]});continue}if(i===`}`){n.push({type:`CLOSE`,index:r,value:e[r++]});continue}if(i===`:`){let t=``,i=r+1;for(;i<e.length;){let n=e.substr(i,1);if(i===r+1&&J2t.test(n)||i!==r+1&&Y2t.test(n)){t+=e[i++];continue}break}if(!t){a(`Missing parameter name at ${r}`);continue}n.push({type:`NAME`,index:r,value:t}),r=i;continue}if(i===`(`){let t=1,i=``,o=r+1,s=!1;if(e[o]===`?`){a(`Pattern cannot start with "?" at ${o}`);continue}for(;o<e.length;){if(!X2t(e[o],!1)){a(`Invalid character '${e[o]}' at ${o}.`),s=!0;break}if(e[o]===`\\`){i+=e[o++]+e[o++];continue}if(e[o]===`)`){if(t--,t===0){o++;break}}else if(e[o]===`(`&&(t++,e[o+1]!==`?`)){a(`Capturing groups are not allowed at ${o}`),s=!0;break}i+=e[o++]}if(s)continue;if(t){a(`Unbalanced pattern at ${r}`);continue}if(!i){a(`Missing pattern at ${r}`);continue}n.push({type:`REGEX`,index:r,value:i}),r=o;continue}n.push({type:`CHAR`,index:r,value:e[r++]})}return n.push({type:`END`,index:r,value:``}),n}function Q2t(e,t={}){let n=Z2t(e);t.delimiter??=`/#?`,t.prefixes??=`./`;let r=`[^${H9(t.delimiter)}]+?`,i=[],a=0,o=0,s=new Set,c=e=>{if(o<n.length&&n[o].type===e)return n[o++].value},l=()=>c(`OTHER_MODIFIER`)??c(`ASTERISK`),u=e=>{let t=c(e);if(t!==void 0)return t;let{type:r,index:i}=n[o];throw TypeError(`Unexpected ${r} at ${i}, expected ${e}`)},d=()=>{let e=``,t;for(;t=c(`CHAR`)??c(`ESCAPED_CHAR`);)e+=t;return e},f=t.encodePart||(e=>e),p=``,m=e=>{p+=e},h=()=>{p.length&&(i.push(new B9(3,``,``,f(p),``,3)),p=``)},g=(e,t,n,o,c)=>{let l=3;switch(c){case`?`:l=1;break;case`*`:l=0;break;case`+`:l=2;break}if(!t&&!n&&l===3){m(e);return}if(h(),!t&&!n){if(!e)return;i.push(new B9(3,``,``,f(e),``,l));return}let u;u=n?n===`*`?V9:n:r;let d=2;u===r?(d=1,u=``):u===V9&&(d=0,u=``);let p;if(t?p=t:n&&(p=a++),s.has(p))throw TypeError(`Duplicate name '${p}'.`);s.add(p),i.push(new B9(d,p,f(e),u,f(o),l))};for(;o<n.length;){let e=c(`CHAR`),n=c(`NAME`),r=c(`REGEX`);if(!n&&!r&&(r=c(`ASTERISK`)),n||r){let i=e??``;t.prefixes.indexOf(i)===-1&&(m(i),i=``),h();let a=l();g(i,n,r,``,a);continue}let i=e??c(`ESCAPED_CHAR`);if(i){m(i);continue}if(c(`OPEN`)){let e=d(),t=c(`NAME`),n=c(`REGEX`);!t&&!n&&(n=c(`ASTERISK`));let r=d();u(`CLOSE`);let i=l();g(e,t,n,r,i);continue}h(),u(`END`)}return i}function H9(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,`\\$1`)}function $2t(e){return e&&e.ignoreCase?`ui`:`u`}function e4t(e,t,n){return t4t(Q2t(e,n),t,n)}function U9(e){switch(e){case 0:return`*`;case 1:return`?`;case 2:return`+`;case 3:return``}}function t4t(e,t,n={}){n.delimiter??=`/#?`,n.prefixes??=`./`,n.sensitive??=!1,n.strict??=!1,n.end??=!0,n.start??=!0,n.endsWith=``;let r=n.start?`^`:``;for(let i of e){if(i.type===3){i.modifier===3?r+=H9(i.value):r+=`(?:${H9(i.value)})${U9(i.modifier)}`;continue}t&&t.push(i.name);let e=`[^${H9(n.delimiter)}]+?`,a=i.value;if(i.type===1?a=e:i.type===0&&(a=V9),!i.prefix.length&&!i.suffix.length){i.modifier===3||i.modifier===1?r+=`(${a})${U9(i.modifier)}`:r+=`((?:${a})${U9(i.modifier)})`;continue}if(i.modifier===3||i.modifier===1){r+=`(?:${H9(i.prefix)}(${a})${H9(i.suffix)})`,r+=U9(i.modifier);continue}r+=`(?:${H9(i.prefix)}`,r+=`((?:${a})(?:`,r+=H9(i.suffix),r+=H9(i.prefix),r+=`(?:${a}))*)${H9(i.suffix)})`,i.modifier===0&&(r+=`?`)}let i=`[${H9(n.endsWith)}]|$`,a=`[${H9(n.delimiter)}]`;if(n.end)return n.strict||(r+=`${a}?`),n.endsWith.length?r+=`(?=${i})`:r+=`$`,new RegExp(r,$2t(n));n.strict||(r+=`(?:${a}(?=${i}))?`);let o=!1;if(e.length){let t=e[e.length-1];t.type===3&&t.modifier===3&&(o=n.delimiter.indexOf(t)>-1)}return o||(r+=`(?=${a}|${i})`),new RegExp(r,$2t(n))}var W9={delimiter:``,prefixes:``,sensitive:!0,strict:!0},n4t={delimiter:`.`,prefixes:``,sensitive:!0,strict:!0},r4t={delimiter:`/`,prefixes:`/`,sensitive:!0,strict:!0};function i4t(e,t){return e.length?e[0]===`/`?!0:!t||e.length<2?!1:(e[0]==`\\`||e[0]==`{`)&&e[1]==`/`:!1}function a4t(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}function o4t(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}function s4t(e){return!e||e.length<2?!1:e[0]===`[`||(e[0]===`\\`||e[0]===`{`)&&e[1]===`[`}var c4t=[`ftp`,`file`,`http`,`https`,`ws`,`wss`];function l4t(e){if(!e)return!0;for(let t of c4t)if(e.test(t))return!0;return!1}function u4t(e,t){if(e=a4t(e,`#`),t||e===``)return e;let n=new URL(`https://example.com`);return n.hash=e,n.hash?n.hash.substring(1,n.hash.length):``}function d4t(e,t){if(e=a4t(e,`?`),t||e===``)return e;let n=new URL(`https://example.com`);return n.search=e,n.search?n.search.substring(1,n.search.length):``}function f4t(e,t){return t||e===``?e:s4t(e)?S4t(e):x4t(e)}function p4t(e,t){if(t||e===``)return e;let n=new URL(`https://example.com`);return n.password=e,n.password}function m4t(e,t){if(t||e===``)return e;let n=new URL(`https://example.com`);return n.username=e,n.username}function h4t(e,t,n){if(n||e===``)return e;if(t&&!c4t.includes(t))return new URL(`${t}:${e}`).pathname;let r=e[0]==`/`;return e=new URL(r?e:`/-`+e,`https://example.com`).pathname,r||(e=e.substring(2,e.length)),e}function g4t(e,t,n){return v4t(t)===e&&(e=``),n||e===``?e:C4t(e)}function _4t(e,t){return e=o4t(e,`:`),t||e===``?e:G9(e)}function v4t(e){switch(e){case`ws`:case`http`:return`80`;case`wws`:case`https`:return`443`;case`ftp`:return`21`;default:return``}}function G9(e){if(e===``)return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw TypeError(`Invalid protocol '${e}'.`)}function y4t(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.username=e,t.username}function b4t(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.password=e,t.password}function x4t(e){if(e===``)return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw TypeError(`Invalid hostname '${e}'`);let t=new URL(`https://example.com`);return t.hostname=e,t.hostname}function S4t(e){if(e===``)return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}function C4t(e){if(e===``||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw TypeError(`Invalid port '${e}'.`)}function w4t(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.pathname=e[0]===`/`?e:`/-`+e,e[0]===`/`?t.pathname:t.pathname.substring(2,t.pathname.length)}function T4t(e){return e===``?e:new URL(`data:${e}`).pathname}function E4t(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.search=e,t.search.substring(1,t.search.length)}function D4t(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.hash=e,t.hash.substring(1,t.hash.length)}var O4t=class{#e;#t=[];#n={};#r=0;#i=1;#a=0;#o=0;#s=0;#c=0;#l=!1;constructor(e){this.#e=e}get result(){return this.#n}parse(){for(this.#t=Z2t(this.#e,!0);this.#r<this.#t.length;this.#r+=this.#i){if(this.#i=1,this.#t[this.#r].type===`END`){if(this.#o===0){this.#f(),this.#C()?this.#u(9,1):this.#S()?this.#u(8,1):this.#u(7,0);continue}else if(this.#o===2){this.#p(5);continue}this.#u(10,0);break}if(this.#s>0)if(this.#T())--this.#s;else continue;if(this.#w()){this.#s+=1;continue}switch(this.#o){case 0:this.#g()&&this.#p(1);break;case 1:if(this.#g()){this.#k();let e=7,t=1;this.#_()?(e=2,t=3):this.#l&&(e=2),this.#u(e,t)}break;case 2:this.#v()?this.#p(3):(this.#x()||this.#S()||this.#C())&&this.#p(5);break;case 3:this.#y()?this.#u(4,1):this.#v()&&this.#u(5,1);break;case 4:this.#v()&&this.#u(5,1);break;case 5:this.#E()?this.#c+=1:this.#D()&&--this.#c,this.#b()&&!this.#c?this.#u(6,1):this.#x()?this.#u(7,0):this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 6:this.#x()?this.#u(7,0):this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 7:this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 8:this.#C()&&this.#u(9,1);break;case 9:break;case 10:break}}this.#n.hostname!==void 0&&this.#n.port===void 0&&(this.#n.port=``)}#u(e,t){switch(this.#o){case 0:break;case 1:this.#n.protocol=this.#O();break;case 2:break;case 3:this.#n.username=this.#O();break;case 4:this.#n.password=this.#O();break;case 5:this.#n.hostname=this.#O();break;case 6:this.#n.port=this.#O();break;case 7:this.#n.pathname=this.#O();break;case 8:this.#n.search=this.#O();break;case 9:this.#n.hash=this.#O();break;case 10:break}this.#o!==0&&e!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(e)&&(this.#n.hostname??=``),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(e)&&(this.#n.pathname??=this.#l?`/`:``),[1,2,3,4,5,6,7].includes(this.#o)&&e===9&&(this.#n.search??=``)),this.#d(e,t)}#d(e,t){this.#o=e,this.#a=this.#r+t,this.#r+=t,this.#i=0}#f(){this.#r=this.#a,this.#i=0}#p(e){this.#f(),this.#o=e}#m(e){return e<0&&(e=this.#t.length-e),e<this.#t.length?this.#t[e]:this.#t[this.#t.length-1]}#h(e,t){let n=this.#m(e);return n.value===t&&(n.type===`CHAR`||n.type===`ESCAPED_CHAR`||n.type===`INVALID_CHAR`)}#g(){return this.#h(this.#r,`:`)}#_(){return this.#h(this.#r+1,`/`)&&this.#h(this.#r+2,`/`)}#v(){return this.#h(this.#r,`@`)}#y(){return this.#h(this.#r,`:`)}#b(){return this.#h(this.#r,`:`)}#x(){return this.#h(this.#r,`/`)}#S(){if(this.#h(this.#r,`?`))return!0;if(this.#t[this.#r].value!==`?`)return!1;let e=this.#m(this.#r-1);return e.type!==`NAME`&&e.type!==`REGEX`&&e.type!==`CLOSE`&&e.type!==`ASTERISK`}#C(){return this.#h(this.#r,`#`)}#w(){return this.#t[this.#r].type==`OPEN`}#T(){return this.#t[this.#r].type==`CLOSE`}#E(){return this.#h(this.#r,`[`)}#D(){return this.#h(this.#r,`]`)}#O(){let e=this.#t[this.#r],t=this.#m(this.#a).index;return this.#e.substring(t,e.index)}#k(){let e={};Object.assign(e,W9),e.encodePart=G9,this.#l=l4t(e4t(this.#O(),void 0,e))}},K9=[`protocol`,`username`,`password`,`hostname`,`port`,`pathname`,`search`,`hash`],q9=`*`;function k4t(e,t){if(typeof e!=`string`)throw TypeError(`parameter 1 is not of type 'string'.`);let n=new URL(e,t);return{protocol:n.protocol.substring(0,n.protocol.length-1),username:n.username,password:n.password,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search===``?void 0:n.search.substring(1,n.search.length),hash:n.hash===``?void 0:n.hash.substring(1,n.hash.length)}}function J9(e,t){return t?X9(e):e}function Y9(e,t,n){let r;if(typeof t.baseURL==`string`)try{r=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=J9(r.protocol.substring(0,r.protocol.length-1),n)),!n&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=J9(r.username,n)),!n&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=J9(r.password,n)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=J9(r.hostname,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=J9(r.port,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=J9(r.pathname,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=J9(r.search.substring(1,r.search.length),n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=J9(r.hash.substring(1,r.hash.length),n))}catch{throw TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==`string`&&(e.protocol=_4t(t.protocol,n)),typeof t.username==`string`&&(e.username=m4t(t.username,n)),typeof t.password==`string`&&(e.password=p4t(t.password,n)),typeof t.hostname==`string`&&(e.hostname=f4t(t.hostname,n)),typeof t.port==`string`&&(e.port=g4t(t.port,e.protocol,n)),typeof t.pathname==`string`){if(e.pathname=t.pathname,r&&!i4t(e.pathname,n)){let t=r.pathname.lastIndexOf(`/`);t>=0&&(e.pathname=J9(r.pathname.substring(0,t+1),n)+e.pathname)}e.pathname=h4t(e.pathname,e.protocol,n)}return typeof t.search==`string`&&(e.search=d4t(t.search,n)),typeof t.hash==`string`&&(e.hash=u4t(t.hash,n)),e}function X9(e){return e.replace(/([+*?:{}()\\])/g,`\\$1`)}function A4t(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,`\\$1`)}function j4t(e,t){t.delimiter??=`/#?`,t.prefixes??=`./`,t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=``;let n=`[^${A4t(t.delimiter)}]+?`,r=/[$_\u200C\u200D\p{ID_Continue}]/u,i=``;for(let a=0;a<e.length;++a){let o=e[a];if(o.type===3){if(o.modifier===3){i+=X9(o.value);continue}i+=`{${X9(o.value)}}${U9(o.modifier)}`;continue}let s=o.hasCustomName(),c=!!o.suffix.length||!!o.prefix.length&&(o.prefix.length!==1||!t.prefixes.includes(o.prefix)),l=a>0?e[a-1]:null,u=a<e.length-1?e[a+1]:null;if(!c&&s&&o.type===1&&o.modifier===3&&u&&!u.prefix.length&&!u.suffix.length)if(u.type===3){let e=u.value.length>0?u.value[0]:``;c=r.test(e)}else c=!u.hasCustomName();if(!c&&!o.prefix.length&&l&&l.type===3){let e=l.value[l.value.length-1];c=t.prefixes.includes(e)}c&&(i+=`{`),i+=X9(o.prefix),s&&(i+=`:${o.name}`),o.type===2?i+=`(${o.value})`:o.type===1?s||(i+=`(${n})`):o.type===0&&(!s&&(!l||l.type===3||l.modifier!==3||c||o.prefix!==``)?i+=`*`:i+=`(.*)`),o.type===1&&s&&o.suffix.length&&r.test(o.suffix[0])&&(i+=`\\`),i+=X9(o.suffix),c&&(i+=`}`),o.modifier!==3&&(i+=U9(o.modifier))}return i}var M4t=class{#e;#t={};#n={};#r={};#i={};#a=!1;constructor(e={},t,n){try{let r;if(typeof t==`string`?r=t:n=t,typeof e==`string`){let t=new O4t(e);if(t.parse(),e=t.result,r===void 0&&typeof e.protocol!=`string`)throw TypeError(`A base URL must be provided for a relative constructor string.`);e.baseURL=r}else{if(!e||typeof e!=`object`)throw TypeError(`parameter 1 is not of type 'string' and cannot convert to dictionary.`);if(r)throw TypeError(`parameter 1 is not of type 'string'.`)}typeof n>`u`&&(n={ignoreCase:!1});let i={ignoreCase:n.ignoreCase===!0};this.#e=Y9({pathname:q9,protocol:q9,username:q9,password:q9,hostname:q9,port:q9,search:q9,hash:q9},e,!0),v4t(this.#e.protocol)===this.#e.port&&(this.#e.port=``);let a;for(a of K9){if(!(a in this.#e))continue;let e={},t=this.#e[a];switch(this.#n[a]=[],a){case`protocol`:Object.assign(e,W9),e.encodePart=G9;break;case`username`:Object.assign(e,W9),e.encodePart=y4t;break;case`password`:Object.assign(e,W9),e.encodePart=b4t;break;case`hostname`:Object.assign(e,n4t),s4t(t)?e.encodePart=S4t:e.encodePart=x4t;break;case`port`:Object.assign(e,W9),e.encodePart=C4t;break;case`pathname`:l4t(this.#t.protocol)?(Object.assign(e,r4t,i),e.encodePart=w4t):(Object.assign(e,W9,i),e.encodePart=T4t);break;case`search`:Object.assign(e,W9,i),e.encodePart=E4t;break;case`hash`:Object.assign(e,W9,i),e.encodePart=D4t;break}try{this.#i[a]=Q2t(t,e),this.#t[a]=t4t(this.#i[a],this.#n[a],e),this.#r[a]=j4t(this.#i[a],e),this.#a=this.#a||this.#i[a].some(e=>e.type===2)}catch{throw TypeError(`invalid ${a} pattern '${this.#e[a]}'.`)}}}catch(e){throw TypeError(`Failed to construct 'URLPattern': ${e.message}`)}}test(e={},t){let n={pathname:``,protocol:``,username:``,password:``,hostname:``,port:``,search:``,hash:``};if(typeof e!=`string`&&t)throw TypeError(`parameter 1 is not of type 'string'.`);if(typeof e>`u`)return!1;try{n=typeof e==`object`?Y9(n,e,!1):Y9(n,k4t(e,t),!1)}catch{return!1}let r;for(r of K9)if(!this.#t[r].exec(n[r]))return!1;return!0}exec(e={},t){let n={pathname:``,protocol:``,username:``,password:``,hostname:``,port:``,search:``,hash:``};if(typeof e!=`string`&&t)throw TypeError(`parameter 1 is not of type 'string'.`);if(typeof e>`u`)return;try{n=typeof e==`object`?Y9(n,e,!1):Y9(n,k4t(e,t),!1)}catch{return null}let r={};t?r.inputs=[e,t]:r.inputs=[e];let i;for(i of K9){let e=this.#t[i].exec(n[i]);if(!e)return null;let t={};for(let[n,r]of this.#n[i].entries())(typeof r==`string`||typeof r==`number`)&&(t[r]=e[n+1]);r[i]={input:n[i]??``,groups:t}}return r}static compareComponent(e,t,n){let r=(e,t)=>{for(let n of[`type`,`modifier`,`prefix`,`value`,`suffix`]){if(e[n]<t[n])return-1;if(e[n]!==t[n])return 1}return 0},i=new B9(3,``,``,``,``,3),a=new B9(0,``,``,``,``,3),o=(e,t)=>{let n=0;for(;n<Math.min(e.length,t.length);++n){let i=r(e[n],t[n]);if(i)return i}return e.length===t.length?0:r(e[n]??i,t[n]??i)};return!t.#r[e]&&!n.#r[e]?0:t.#r[e]&&!n.#r[e]?o(t.#i[e],[a]):!t.#r[e]&&n.#r[e]?o([a],n.#i[e]):o(t.#i[e],n.#i[e])}get protocol(){return this.#r.protocol}get username(){return this.#r.username}get password(){return this.#r.password}get hostname(){return this.#r.hostname}get port(){return this.#r.port}get pathname(){return this.#r.pathname}get search(){return this.#r.search}get hash(){return this.#r.hash}get hasRegExpGroups(){return this.#a}};globalThis.URLPattern||(globalThis.URLPattern=M4t),fx(),g.createContext(null),g.createContext(void 0),g.createContext(void 0),g.createContext(null),g.createContext(null);var N4t=(0,g.memo)(()=>null);function P4t(){let[e,t]=(0,g.useState)(0);return(0,g.useEffect)(()=>{let e=()=>{let e=document.getElementById(`_sidebar`);e&&t(e.getBoundingClientRect().height+(parseFloat(getComputedStyle(document.documentElement).getPropertyValue(`--banner-height`))||0))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var F4t=Or(Xn((0,W.jsxs)(qn,{path:`/`,element:(0,W.jsx)(c1t,{enableUpdateNotifications:!1}),errorElement:(0,W.jsx)(dye,{id:`root`}),children:[(0,W.jsx)(qn,{index:!0,element:(0,W.jsx)(Gn,{replace:!0,to:window.localEditorConfig.defaultPath})}),(0,W.jsx)(qn,{path:`mcp-oauth-callback`,element:(0,W.jsx)(b_e,{})}),(0,W.jsx)(qn,{path:`/:account/:project/:environment`,element:(0,W.jsx)(m1t,{}),children:(0,W.jsxs)(qn,{element:(0,W.jsx)(({navigation:e})=>{let[t,n]=(0,g.useState)(0);(0,g.useEffect)(()=>{let e=()=>{n(document.querySelector(`[data-banner="true"]`)?.offsetHeight||0)};e();let t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`,`style`]}),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let r=P4t();return(0,W.jsxs)(`div`,{className:`min-h-screen flex flex-col`,style:{"--banner-height":`${t}px`},children:[(0,W.jsx)(N4t,{}),(0,W.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 grid-rows-[min-content_auto]`,children:[e,(0,W.jsx)(Qje,{height:r,children:(0,W.jsx)(g.Suspense,{fallback:null,children:(0,W.jsx)(Kn,{})})})]})]})},{navigation:(0,W.jsx)(Zje,{})}),children:[(0,W.jsx)(qn,{index:!0,element:(0,W.jsx)(PZt,{})}),(0,W.jsx)(qn,{path:`edit`,element:(0,W.jsx)(KXt,{})})]})}),(0,W.jsx)(qn,{path:`*`,element:(0,W.jsx)(()=>(0,W.jsx)(`div`,{className:`flex items-center justify-center min-h-screen`,children:(0,W.jsx)(l1t,{})}),{})})]}))),I4t=({error:e})=>{let t,n,r=`N/A`,i=e.message,a,o;(e instanceof Pf||e instanceof Ff)&&(t=e.type,n=e.message,r=e.status??r,i=e.detail,a=e.instance,o=e.traceId),n||=`Oh zup! Something went wrong.`;let s=t??`https://zuplo.com/docs/search?q=${n.replaceAll(` `,`+`)}`,c=t&&Af.includes(t);i||=r===403?`It looks like you might not have permission to access this resources.`:r===404?`We can't find this. If you believe this is a mistake let us know.`:`An error has occurred. If the problem persists let us know.`;let l=e?.stack?.split(`
1666
1666
  `).splice(0,5).join(`
1667
1667
  `);return(0,W.jsxs)(`div`,{className:`flex flex-col w-full mx-auto max-w-[800px] justify-center gap-4 items-center bg-white p-8`,children:[(0,W.jsxs)(`main`,{className:`flex flex-col gap-10`,children:[(0,W.jsx)(ym,{className:`self-center shrink-0 w-14 h-14 text-pink-600`}),(0,W.jsxs)(`div`,{className:`text-center`,children:[(0,W.jsxs)(`p`,{className:`text-base font-semibold text-pink-600`,children:[`Status: `,r]}),(0,W.jsx)(`h1`,{className:`mt-2 text-2xl font-medium text-pink-600`,children:n}),(0,W.jsx)(`p`,{className:`mt-2 text-base`,children:i}),(0,W.jsxs)(`div`,{className:`mt-6 flex items-center justify-center gap-x-2`,children:[(0,W.jsx)(rT,{href:s,children:`Search docs for error`}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:` ·`}),(0,W.jsx)(rT,{href:`https://status.zuplo.com/`,children:`Check the status page`})]})]}),!c&&(0,W.jsxs)(Cz,{className:`flex flex-col`,children:[(0,W.jsx)(wz,{className:`mb-2`,asChild:!0,children:(0,W.jsxs)(Y,{variant:`ghost`,children:[`Technical Details `,(0,W.jsx)(hm,{size:18})]})}),(0,W.jsx)(Tz,{children:(0,W.jsxs)(`div`,{className:`border rounded-sm border-solid grid grid-cols-[min-content_1fr] gap-x-3 gap-y-1.5 p-4 text-sm`,children:[(0,W.jsx)(`div`,{children:`Timestamp:`}),(0,W.jsx)(`div`,{children:new Date().toISOString()}),void 0,o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{children:`Trace ID:`}),(0,W.jsx)(`div`,{children:o})]}),t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{children:`Type:`}),(0,W.jsx)(`a`,{className:`underline`,href:t,target:`_blank`,children:t})]}),a&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{children:`Instance:`}),(0,W.jsx)(`div`,{children:a})]}),(0,W.jsx)(`div`,{children:`URL:`}),(0,W.jsx)(`div`,{className:`break-all`,children:window.location.pathname+window.location.search}),(0,W.jsx)(`div`,{children:`Stacktrace:`}),(0,W.jsx)(`pre`,{className:`bg-gray-100 rounded-sm overflow-scroll p-2`,children:l})]})})]})]}),(0,W.jsx)(`div`,{className:`self-center`,children:(0,W.jsxs)(`div`,{className:`flex justify-center space-x-4`,children:[(0,W.jsx)(Y,{asChild:!0,children:(0,W.jsxs)(`a`,{href:`/`,children:[(0,W.jsx)(Rm,{className:`w-4 h-4 text-base`}),`Go Home`]})}),(0,W.jsx)(Y,{className:`px-4 py-2 text-base`,variant:`outline`,asChild:!0,children:(0,W.jsxs)(`a`,{target:`_blank`,href:`mailto:${YS}`,rel:`noreferrer`,children:[(0,W.jsx)($re,{className:`w-4 h-4`}),` Email Support`]})}),(0,W.jsx)(QS,{text:`Chat on Discord`})]})})]})},L4t=2,Z9=new Nse({defaultOptions:{queries:{retry:(e,t)=>Nf(t)?e<=L4t:!1},mutations:{onSettled:async(e,t,n,r,i)=>{let{meta:a}=i;if(a?.invalidates&&Array.isArray(a.invalidates))for(let{queryKey:e}of a.invalidates)await Z9.invalidateQueries({queryKey:e})}}}}),R4t=3e3,z4t=8e3;async function B4t(){let e=new AbortController,t=setTimeout(()=>e.abort(),z4t);try{return await fetch(`/favicon.ico?_probe=${Date.now()}`,{method:`GET`,cache:`no-store`,signal:e.signal}),!0}catch{return!1}finally{clearTimeout(t)}}var V4t=()=>{let[e,t]=(0,g.useState)(()=>!c_.isOnline()),[n,r]=(0,g.useState)(!1),i=(0,g.useRef)(!1),a=(0,g.useCallback)(()=>{t(!1),r(!1),Z9.invalidateQueries()},[]),o=(0,g.useCallback)(async()=>{if(i.current)return;i.current=!0,r(!0);let e=await B4t();i.current=!1,e?a():r(!1)},[a]);return(0,g.useEffect)(()=>c_.subscribe(e=>{e?o():t(!0)}),[o]),(0,g.useEffect)(()=>Z9.getQueryCache().subscribe(e=>{e.type===`updated`&&e.action.type===`error`&&Nf(e.action.error)&&t(!0)}),[]),(0,g.useEffect)(()=>{if(!e)return;o();let t=window.setInterval(()=>{o()},R4t);return()=>{window.clearInterval(t)}},[e,o]),e?(0,W.jsx)(lye,{isReconnecting:n,onRetry:()=>{o()}}):null},H4t=`zuplo-app-loader`;function U4t(e){typeof document>`u`||document.getElementById(H4t)?.setAttribute(`data-active`,e?`true`:`false`)}var W4t=250,G4t=(0,g.createContext)(null);function K4t(e,t){let n=new Set(e.requirements),r={...e.timestamps};switch(t.type){case`add`:return n.add(t.id),r[t.id]=Date.now(),{requirements:[...n],timestamps:r};case`remove`:return n.delete(t.id),delete r[t.id],{requirements:[...n],timestamps:r};default:throw Error()}}var q4t=({children:e})=>{let[t,n]=(0,g.useReducer)(K4t,{requirements:[],timestamps:{}}),r=(0,g.useRef)(null),i=(0,g.useRef)(new Set),a=t.requirements.length>0,[o,s]=(0,g.useState)(!0),c=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(a){c.current&&=(clearTimeout(c.current),null),s(!0);return}return c.current=setTimeout(()=>{s(!1),c.current=null},W4t),()=>{c.current&&=(clearTimeout(c.current),null)}},[a]),(0,g.useEffect)(()=>{U4t(o)},[o]);let l=(0,g.useCallback)(e=>n({type:`add`,id:e}),[]),u=(0,g.useCallback)(e=>n({type:`remove`,id:e}),[]);return(0,g.useEffect)(()=>(t.requirements.length>0?r.current=setInterval(()=>{let e=Date.now();t.requirements.forEach(n=>{let r=t.timestamps[n];r&&e-r>2e3&&(i.current.has(n)||(console.warn(`🐌 Slow loading detected: "${n}" has been loading for ${Math.round((e-r)/1e3)} seconds`),i.current.add(n)))})},2e3):(r.current&&=(clearInterval(r.current),null),i.current.clear()),()=>{r.current&&clearInterval(r.current)}),[t.requirements,t.timestamps]),(0,W.jsx)(G4t.Provider,{value:{add:l,remove:u},children:e})},J4t={zuplo:{id:`zuplo`,productName:`Zuplo Portal`,shortName:`Zuplo`,logo:`/zuplo.svg`,logoWhite:`/zuplo_white.svg`,favicon:`/favicon.ico`,docsUrl:`https://zuplo.com/docs`,logoAlt:`Zuplo`},akamai:{id:`akamai`,productName:`Akamai AI and API Manager`,shortName:`Akamai`,logo:`/brand/akamai/logo.svg`,logoDark:`/brand/akamai/logo-dark.svg`,logoWhite:`/brand/akamai/logo-white.svg`,favicon:`/brand/akamai/favicon.svg`,docsUrl:`https://techdocs.akamai.com`,logoAlt:`Akamai AI and API Manager`}},Y4t=e=>e===`zuplo`||e===`akamai`,X4t=e=>J4t[e]??J4t.zuplo,Q9=`zuplo-color-scheme`,$9=`zuplo-brand`;`${Q9}${$9}`;var Z4t=e=>e===`light`||e===`dark`||e===`system`,Q4t=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,$4t=(e,t)=>e===`system`?t?`dark`:`light`:e,e3t=()=>{try{let e=localStorage.getItem(Q9);return Z4t(e)?e:`light`}catch{return`light`}},t3t=e=>{try{localStorage.setItem(Q9,e)}catch{}},n3t=()=>{try{let e=localStorage.getItem($9);return Y4t(e)?e:null}catch{return null}},r3t=e=>{try{localStorage.setItem($9,e)}catch{}},i3t=e=>{if(typeof document>`u`)return;let t=document.documentElement;t.classList.toggle(`dark`,e===`dark`),t.style.colorScheme=e},a3t=e=>{if(typeof document>`u`)return;let t=document.documentElement;e===`zuplo`?t.removeAttribute(`data-brand`):t.setAttribute(`data-brand`,e)},o3t=()=>n3t()??`zuplo`,s3t=e=>{let t=document.querySelector(`link[rel~="icon"]`);t&&(t.href=e)},c3t=({children:e})=>{let[t,n]=(0,g.useState)(e3t),[r,i]=(0,g.useState)(Q4t),[a,o]=(0,g.useState)(o3t),s=$4t(t,r),c=X4t(a);(0,g.useEffect)(()=>{if(t!==`system`||typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);i(e.matches);let n=e=>i(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[t]),(0,g.useEffect)(()=>{i3t(s)},[s]);let l=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(a3t(a),l.current===null){let e=document.querySelector(`link[rel~="icon"]`);l.current={title:document.title,favicon:e?.getAttribute(`href`)??null}}a===`zuplo`?(document.title=l.current.title,l.current.favicon&&s3t(l.current.favicon)):(document.title=c.productName,s3t(c.favicon))},[a,c]);let u=(0,g.useCallback)(e=>{t3t(e),n(e)},[]),d=(0,g.useCallback)(()=>{u(s===`dark`?`light`:`dark`)},[s,u]),f=(0,g.useCallback)((e,t)=>{t?.persist!==!1&&r3t(e),o(e)},[]),p=(0,g.useMemo)(()=>({brand:c,brandId:a,setBrand:f,colorScheme:s,colorSchemePreference:t,setColorSchemePreference:u,toggleColorScheme:d}),[c,a,f,s,t,u,d]);return(0,W.jsx)(oP.Provider,{value:p,children:e})},l3t=({children:e})=>(0,W.jsx)(g.Suspense,{fallback:null,children:(0,W.jsx)(c3t,{children:(0,W.jsxs)(Fse,{client:Z9,children:[(0,W.jsx)(cN,{fallback:I4t,children:(0,W.jsx)(q4t,{children:(0,W.jsx)(vk,{children:(0,W.jsx)(Jpt,{children:e})})})}),(0,W.jsx)(V4t,{})]})})});w(),v(),(0,h.createRoot)(document.getElementById(`zuplo-portal`)).render((0,W.jsx)(g.StrictMode,{children:(0,W.jsx)(()=>{let[e,t]=(0,g.useState)(!0);if(typeof window.localEditorConfig!=`object`)return(0,W.jsx)(`p`,{children:`Local editor config is missing. This is an invalid state.`});let{apeContext:n}=window.localEditorConfig;return(0,W.jsx)(jie.Provider,{value:n,children:(0,W.jsx)(tce,{children:(0,W.jsx)($se,{children:(0,W.jsxs)(l3t,{children:[(0,W.jsx)(Rie,{onDisconnect:()=>t(!1),onConnect:()=>t(!0)}),!e&&(0,W.jsx)(zie,{}),(0,W.jsx)(uee,{router:F4t})]})})})})},{})}));
1668
- //# sourceMappingURL=main.local-DqAcMSyN.js.map
1668
+ //# sourceMappingURL=main.local-CZG9KqIF.js.map