@volter/world-console 3.0.16 → 3.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/console.css +15 -2
- package/client/console.tsx +78 -34
- package/dist/client/console.bundle.js +13 -13
- package/dist/client/console.css +15 -2
- package/dist/client/console.tsx +78 -34
- package/dist/client/main.bundle.js +89 -89
- package/package.json +3 -3
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
1
|
+
var dQ=Object.create;var{getPrototypeOf:aQ,defineProperty:P8,getOwnPropertyNames:sQ}=Object;var tQ=Object.prototype.hasOwnProperty;function oQ(_){return this[_]}var nQ,eQ,_0=(_,Q,J)=>{var q=_!=null&&typeof _==="object";if(q){var U=Q?nQ??=new WeakMap:eQ??=new WeakMap,G=U.get(_);if(G)return G}J=_!=null?dQ(aQ(_)):{};let Z=Q||!_||!_.__esModule?P8(J,"default",{value:_,enumerable:!0}):J;for(let F of sQ(_))if(!tQ.call(Z,F))P8(Z,F,{get:oQ.bind(_,F),enumerable:!0});if(q)U.set(_,Z);return Z};var A2=(_,Q)=>()=>(Q||_((Q={exports:{}}).exports,Q),Q.exports);var u0=A2((_J,o5)=>{(function(){function _(T,g){Object.defineProperty(q.prototype,T,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",g[0],g[1])}})}function Q(T){if(T===null||typeof T!=="object")return null;return T=$1&&T[$1]||T["@@iterator"],typeof T==="function"?T:null}function J(T,g){T=(T=T.constructor)&&(T.displayName||T.name)||"ReactClass";var Q1=T+"."+g;U1[Q1]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",g,T),U1[Q1]=!0)}function q(T,g,Q1){this.props=T,this.context=g,this.refs=W1,this.updater=Q1||q1}function U(){}function G(T,g,Q1){this.props=T,this.context=g,this.refs=W1,this.updater=Q1||q1}function Z(){}function F(T){return""+T}function X(T){try{F(T);var g=!1}catch(X1){g=!0}if(g){g=console;var Q1=g.error,J1=typeof Symbol==="function"&&Symbol.toStringTag&&T[Symbol.toStringTag]||T.constructor.name||"Object";return Q1.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",J1),F(T)}}function Y(T){if(T==null)return null;if(typeof T==="function")return T.$$typeof===R1?null:T.displayName||T.name||null;if(typeof T==="string")return T;switch(T){case m:return"Fragment";case V:return"Profiler";case I:return"StrictMode";case _1:return"Suspense";case a:return"SuspenseList";case e:return"Activity"}if(typeof T==="object")switch(typeof T.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),T.$$typeof){case j:return"Portal";case y:return T.displayName||"Context";case D:return(T._context.displayName||"Context")+".Consumer";case t:var g=T.render;return T=T.displayName,T||(T=g.displayName||g.name||"",T=T!==""?"ForwardRef("+T+")":"ForwardRef"),T;case o:return g=T.displayName||null,g!==null?g:Y(T.type)||"Memo";case p:g=T._payload,T=T._init;try{return Y(T(g))}catch(Q1){}}return null}function K(T){if(T===m)return"<>";if(typeof T==="object"&&T!==null&&T.$$typeof===p)return"<...>";try{var g=Y(T);return g?"<"+g+">":"<...>"}catch(Q1){return"<...>"}}function H(){var T=H1.A;return T===null?null:T.getOwner()}function L(){return Error("react-stack-top-frame")}function z(T){if(x1.call(T,"key")){var g=Object.getOwnPropertyDescriptor(T,"key").get;if(g&&g.isReactWarning)return!1}return T.key!==void 0}function W(T,g){function Q1(){i1||(i1=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}Q1.isReactWarning=!0,Object.defineProperty(T,"key",{get:Q1,configurable:!0})}function w(){var T=Y(this.type);return B0[T]||(B0[T]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),T=this.props.ref,T!==void 0?T:null}function R(T,g,Q1,J1,X1,O1){var T1=Q1.ref;return T={$$typeof:E,type:T,key:g,props:Q1,_owner:J1},(T1!==void 0?T1:null)!==null?Object.defineProperty(T,"ref",{enumerable:!1,get:w}):Object.defineProperty(T,"ref",{enumerable:!1,value:null}),T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(T,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(T,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X1}),Object.defineProperty(T,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:O1}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T}function A(T,g){return g=R(T.type,g,T.props,T._owner,T._debugStack,T._debugTask),T._store&&(g._store.validated=T._store.validated),g}function O(T){B(T)?T._store&&(T._store.validated=1):typeof T==="object"&&T!==null&&T.$$typeof===p&&(T._payload.status==="fulfilled"?B(T._payload.value)&&T._payload.value._store&&(T._payload.value._store.validated=1):T._store&&(T._store.validated=1))}function B(T){return typeof T==="object"&&T!==null&&T.$$typeof===E}function M(T){var g={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Q1){return g[Q1]})}function P(T,g){return typeof T==="object"&&T!==null&&T.key!=null?(X(T.key),M(""+T.key)):g.toString(36)}function C(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status==="string"?T.then(Z,Z):(T.status="pending",T.then(function(g){T.status==="pending"&&(T.status="fulfilled",T.value=g)},function(g){T.status==="pending"&&(T.status="rejected",T.reason=g)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function f(T,g,Q1,J1,X1){var O1=typeof T;if(O1==="undefined"||O1==="boolean")T=null;var T1=!1;if(T===null)T1=!0;else switch(O1){case"bigint":case"string":case"number":T1=!0;break;case"object":switch(T.$$typeof){case E:case j:T1=!0;break;case p:return T1=T._init,f(T1(T._payload),g,Q1,J1,X1)}}if(T1){T1=T,X1=X1(T1);var v1=J1===""?"."+P(T1,0):J1;return n(X1)?(Q1="",v1!=null&&(Q1=v1.replace(n1,"$&/")+"/"),f(X1,g,Q1,"",function(A0){return A0})):X1!=null&&(B(X1)&&(X1.key!=null&&(T1&&T1.key===X1.key||X(X1.key)),Q1=A(X1,Q1+(X1.key==null||T1&&T1.key===X1.key?"":(""+X1.key).replace(n1,"$&/")+"/")+v1),J1!==""&&T1!=null&&B(T1)&&T1.key==null&&T1._store&&!T1._store.validated&&(Q1._store.validated=2),X1=Q1),g.push(X1)),1}if(T1=0,v1=J1===""?".":J1+":",n(T))for(var I1=0;I1<T.length;I1++)J1=T[I1],O1=v1+P(J1,I1),T1+=f(J1,g,Q1,O1,X1);else if(I1=Q(T),typeof I1==="function")for(I1===T.entries&&(Z0||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Z0=!0),T=I1.call(T),I1=0;!(J1=T.next()).done;)J1=J1.value,O1=v1+P(J1,I1++),T1+=f(J1,g,Q1,O1,X1);else if(O1==="object"){if(typeof T.then==="function")return f(C(T),g,Q1,J1,X1);throw g=String(T),Error("Objects are not valid as a React child (found: "+(g==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":g)+"). If you meant to render a collection of children, use an array instead.")}return T1}function v(T,g,Q1){if(T==null)return T;var J1=[],X1=0;return f(T,J1,"","",function(O1){return g.call(Q1,O1,X1++)}),J1}function N(T){if(T._status===-1){var g=T._ioInfo;g!=null&&(g.start=g.end=performance.now()),g=T._result;var Q1=g();if(Q1.then(function(X1){if(T._status===0||T._status===-1){T._status=1,T._result=X1;var O1=T._ioInfo;O1!=null&&(O1.end=performance.now()),Q1.status===void 0&&(Q1.status="fulfilled",Q1.value=X1)}},function(X1){if(T._status===0||T._status===-1){T._status=2,T._result=X1;var O1=T._ioInfo;O1!=null&&(O1.end=performance.now()),Q1.status===void 0&&(Q1.status="rejected",Q1.reason=X1)}}),g=T._ioInfo,g!=null){g.value=Q1;var J1=Q1.displayName;typeof J1==="string"&&(g.name=J1)}T._status===-1&&(T._status=0,T._result=Q1)}if(T._status===1)return g=T._result,g===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
2
|
|
|
3
3
|
Your code should look like:
|
|
4
4
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
5
|
|
|
6
|
-
Did you accidentally put curly braces around the import?`,
|
|
6
|
+
Did you accidentally put curly braces around the import?`,g),"default"in g||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
7
|
|
|
8
8
|
Your code should look like:
|
|
9
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,
|
|
9
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,g),g.default;throw T._result}function k(){var T=H1.H;return T===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
10
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
11
|
2. You might be breaking the Rules of Hooks
|
|
12
12
|
3. You might have more than one copy of React in the same app
|
|
13
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),z}function x(){K1.asyncTransitions--}function r(z){if(H0===null)try{var j=("require"+Math.random()).slice(0,7);H0=(m5&&m5[j]).call(m5,"timers").setImmediate}catch(l){H0=function(_1){r0===!1&&(r0=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var n=new MessageChannel;n.port1.onmessage=_1,n.port2.postMessage(void 0)}}return H0(z)}function m(z){return 1<z.length&&typeof AggregateError==="function"?AggregateError(z):z[0]}function v(z,j){j!==y0-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),y0=j}function D(z,j,l){var _1=K1.actQueue;if(_1!==null)if(_1.length!==0)try{V(_1),r(function(){return D(z,j,l)});return}catch(n){K1.thrownErrors.push(n)}else K1.actQueue=null;0<K1.thrownErrors.length?(_1=m(K1.thrownErrors),K1.thrownErrors.length=0,l(_1)):j(z)}function V(z){if(!q2){q2=!0;var j=0;try{for(;j<z.length;j++){var l=z[j];do{K1.didUsePromise=!1;var _1=l(!1);if(_1!==null){if(K1.didUsePromise){z[j]=l,z.splice(0,j);return}l=_1}else break}while(1)}z.length=0}catch(n){z.splice(0,j+1),K1.thrownErrors.push(n)}finally{q2=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var E=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),p=Symbol.for("react.consumer"),h=Symbol.for("react.context"),e=Symbol.for("react.forward_ref"),t=Symbol.for("react.suspense"),o=Symbol.for("react.suspense_list"),s=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),J1=Symbol.for("react.activity"),U1=Symbol.iterator,X1={},G1={isMounted:function(){return!1},enqueueForceUpdate:function(z){J(z,"forceUpdate")},enqueueReplaceState:function(z){J(z,"replaceState")},enqueueSetState:function(z){J(z,"setState")}},F1=Object.assign,A1={};Object.freeze(A1),q.prototype.isReactComponent={},q.prototype.setState=function(z,j){if(typeof z!=="object"&&typeof z!=="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,j,"setState")},q.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};var Y1={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(c in Y1)Y1.hasOwnProperty(c)&&_(c,Y1[c]);U.prototype=q.prototype,Y1=G.prototype=new U,Y1.constructor=G,F1(Y1,q.prototype),Y1.isPureReactComponent=!0;var Q1=Array.isArray,T1=Symbol.for("react.client.reference"),K1={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},k1=Object.prototype.hasOwnProperty,p1=console.createTask?console.createTask:function(){return null};Y1={react_stack_bottom_frame:function(z){return z()}};var l1,z0,Z0={},F0=Y1.react_stack_bottom_frame.bind(Y1,L)(),o1=p1(X(L)),Q0=!1,n1=/\/+/g,J0=typeof reportError==="function"?reportError:function(z){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z==="object"&&z!==null&&typeof z.message==="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(j))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",z);return}console.error(z)},r0=!1,H0=null,y0=0,k0=!1,q2=!1,k2=typeof queueMicrotask==="function"?function(z){queueMicrotask(function(){return queueMicrotask(z)})}:r;Y1=Object.freeze({__proto__:null,c:function(z){return k().useMemoCache(z)}});var c={map:S,forEach:function(z,j,l){S(z,function(){j.apply(this,arguments)},l)},count:function(z){var j=0;return S(z,function(){j++}),j},toArray:function(z){return S(z,function(j){return j})||[]},only:function(z){if(!B(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};oQ.Activity=J1,oQ.Children=c,oQ.Component=q,oQ.Fragment=b,oQ.Profiler=y,oQ.PureComponent=G,oQ.StrictMode=P,oQ.Suspense=t,oQ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K1,oQ.__COMPILER_RUNTIME=Y1,oQ.act=function(z){var j=K1.actQueue,l=y0;y0++;var _1=K1.actQueue=j!==null?j:[],n=!1;try{var $1=z()}catch(L1){K1.thrownErrors.push(L1)}if(0<K1.thrownErrors.length)throw v(j,l),z=m(K1.thrownErrors),K1.thrownErrors.length=0,z;if($1!==null&&typeof $1==="object"&&typeof $1.then==="function"){var q1=$1;return k2(function(){n||k0||(k0=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(L1,M1){n=!0,q1.then(function(E1){if(v(j,l),l===0){try{V(_1),r(function(){return D(E1,L1,M1)})}catch(e2){K1.thrownErrors.push(e2)}if(0<K1.thrownErrors.length){var u1=m(K1.thrownErrors);K1.thrownErrors.length=0,M1(u1)}}else L1(E1)},function(E1){v(j,l),0<K1.thrownErrors.length?(E1=m(K1.thrownErrors),K1.thrownErrors.length=0,M1(E1)):M1(E1)})}}}var H1=$1;if(v(j,l),l===0&&(V(_1),_1.length!==0&&k2(function(){n||k0||(k0=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),K1.actQueue=null),0<K1.thrownErrors.length)throw z=m(K1.thrownErrors),K1.thrownErrors.length=0,z;return{then:function(L1,M1){n=!0,l===0?(K1.actQueue=_1,r(function(){return D(H1,L1,M1)})):L1(H1)}}},oQ.cache=function(z){return function(){return z.apply(null,arguments)}},oQ.cacheSignal=function(){return null},oQ.captureOwnerStack=function(){var z=K1.getCurrentStack;return z===null?null:z()},oQ.cloneElement=function(z,j,l){if(z===null||z===void 0)throw Error("The argument must be a React element, but you passed "+z+".");var _1=F1({},z.props),n=z.key,$1=z._owner;if(j!=null){var q1;_:{if(k1.call(j,"ref")&&(q1=Object.getOwnPropertyDescriptor(j,"ref").get)&&q1.isReactWarning){q1=!1;break _}q1=j.ref!==void 0}q1&&($1=H()),W(j)&&(K(j.key),n=""+j.key);for(H1 in j)!k1.call(j,H1)||H1==="key"||H1==="__self"||H1==="__source"||H1==="ref"&&j.ref===void 0||(_1[H1]=j[H1])}var H1=arguments.length-2;if(H1===1)_1.children=l;else if(1<H1){q1=Array(H1);for(var L1=0;L1<H1;L1++)q1[L1]=arguments[L1+2];_1.children=q1}_1=R(z.type,n,_1,$1,z._debugStack,z._debugTask);for(n=2;n<arguments.length;n++)O(arguments[n]);return _1},oQ.createContext=function(z){return z={$$typeof:h,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:p,_context:z},z._currentRenderer=null,z._currentRenderer2=null,z},oQ.createElement=function(z,j,l){for(var _1=2;_1<arguments.length;_1++)O(arguments[_1]);_1={};var n=null;if(j!=null)for(L1 in z0||!("__self"in j)||"key"in j||(z0=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),W(j)&&(K(j.key),n=""+j.key),j)k1.call(j,L1)&&L1!=="key"&&L1!=="__self"&&L1!=="__source"&&(_1[L1]=j[L1]);var $1=arguments.length-2;if($1===1)_1.children=l;else if(1<$1){for(var q1=Array($1),H1=0;H1<$1;H1++)q1[H1]=arguments[H1+2];Object.freeze&&Object.freeze(q1),_1.children=q1}if(z&&z.defaultProps)for(L1 in $1=z.defaultProps,$1)_1[L1]===void 0&&(_1[L1]=$1[L1]);n&&A(_1,typeof z==="function"?z.displayName||z.name||"Unknown":z);var L1=1e4>K1.recentlyCreatedOwnerStacks++;return R(z,n,_1,H(),L1?Error("react-stack-top-frame"):F0,L1?p1(X(z)):o1)},oQ.createRef=function(){var z={current:null};return Object.seal(z),z},oQ.forwardRef=function(z){z!=null&&z.$$typeof===s?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof z!=="function"?console.error("forwardRef requires a render function but was given %s.",z===null?"null":typeof z):z.length!==0&&z.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",z.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),z!=null&&z.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var j={$$typeof:e,render:z},l;return Object.defineProperty(j,"displayName",{enumerable:!1,configurable:!0,get:function(){return l},set:function(_1){l=_1,z.name||z.displayName||(Object.defineProperty(z,"name",{value:_1}),z.displayName=_1)}}),j},oQ.isValidElement=B,oQ.lazy=function(z){z={_status:-1,_result:z};var j={$$typeof:g,_payload:z,_init:w},l={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return z._ioInfo=l,j._debugInfo=[{awaited:l}],j},oQ.memo=function(z,j){z==null&&console.error("memo: The first argument must be a component. Instead received: %s",z===null?"null":typeof z),j={$$typeof:s,type:z,compare:j===void 0?null:j};var l;return Object.defineProperty(j,"displayName",{enumerable:!1,configurable:!0,get:function(){return l},set:function(_1){l=_1,z.name||z.displayName||(Object.defineProperty(z,"name",{value:_1}),z.displayName=_1)}}),j},oQ.startTransition=function(z){var j=K1.T,l={};l._updatedFibers=new Set,K1.T=l;try{var _1=z(),n=K1.S;n!==null&&n(l,_1),typeof _1==="object"&&_1!==null&&typeof _1.then==="function"&&(K1.asyncTransitions++,_1.then(x,x),_1.then(Z,J0))}catch($1){J0($1)}finally{j===null&&l._updatedFibers&&(z=l._updatedFibers.size,l._updatedFibers.clear(),10<z&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),j!==null&&l.types!==null&&(j.types!==null&&j.types!==l.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),j.types=l.types),K1.T=j}},oQ.unstable_useCacheRefresh=function(){return k().useCacheRefresh()},oQ.use=function(z){return k().use(z)},oQ.useActionState=function(z,j,l){return k().useActionState(z,j,l)},oQ.useCallback=function(z,j){return k().useCallback(z,j)},oQ.useContext=function(z){var j=k();return z.$$typeof===p&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),j.useContext(z)},oQ.useDebugValue=function(z,j){return k().useDebugValue(z,j)},oQ.useDeferredValue=function(z,j){return k().useDeferredValue(z,j)},oQ.useEffect=function(z,j){return z==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useEffect(z,j)},oQ.useEffectEvent=function(z){return k().useEffectEvent(z)},oQ.useId=function(){return k().useId()},oQ.useImperativeHandle=function(z,j,l){return k().useImperativeHandle(z,j,l)},oQ.useInsertionEffect=function(z,j){return z==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useInsertionEffect(z,j)},oQ.useLayoutEffect=function(z,j){return z==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useLayoutEffect(z,j)},oQ.useMemo=function(z,j){return k().useMemo(z,j)},oQ.useOptimistic=function(z,j){return k().useOptimistic(z,j)},oQ.useReducer=function(z,j,l){return k().useReducer(z,j,l)},oQ.useRef=function(z){return k().useRef(z)},oQ.useState=function(z){return k().useState(z)},oQ.useSyncExternalStore=function(z,j,l){return k().useSyncExternalStore(z,j,l)},oQ.useTransition=function(){return k().useTransition()},oQ.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var z8=U2((nQ)=>{var G2=i1(O0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===k?null:P.displayName||P.name||null;if(typeof P==="string")return P;switch(P){case I:return"Fragment";case M:return"Profiler";case R:return"StrictMode";case f:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof P==="object")switch(typeof P.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),P.$$typeof){case A:return"Portal";case B:return P.displayName||"Context";case O:return(P._context.displayName||"Context")+".Consumer";case T:var y=P.render;return P=P.displayName,P||(P=y.displayName||y.name||"",P=P!==""?"ForwardRef("+P+")":"ForwardRef"),P;case N:return y=P.displayName||null,y!==null?y:_(P.type)||"Memo";case S:y=P._payload,P=P._init;try{return _(P(y))}catch(p){}}return null}function Q(P){return""+P}function J(P){try{Q(P);var y=!1}catch(e){y=!0}if(y){y=console;var p=y.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return p.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),Q(P)}}function q(P){if(P===I)return"<>";if(typeof P==="object"&&P!==null&&P.$$typeof===S)return"<...>";try{var y=_(P);return y?"<"+y+">":"<...>"}catch(p){return"<...>"}}function U(){var P=x.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(r.call(P,"key")){var y=Object.getOwnPropertyDescriptor(P,"key").get;if(y&&y.isReactWarning)return!1}return P.key!==void 0}function F(P,y){function p(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",y))}p.isReactWarning=!0,Object.defineProperty(P,"key",{get:p,configurable:!0})}function K(){var P=_(this.type);return V[P]||(V[P]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),P=this.props.ref,P!==void 0?P:null}function Y(P,y,p,h,e,t){var o=p.ref;return P={$$typeof:W,type:P,key:y,props:p,_owner:h},(o!==void 0?o:null)!==null?Object.defineProperty(P,"ref",{enumerable:!1,get:K}):Object.defineProperty(P,"ref",{enumerable:!1,value:null}),P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(P,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(P,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:e}),Object.defineProperty(P,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function X(P,y,p,h,e,t){var o=y.children;if(o!==void 0)if(h)if(m(o)){for(h=0;h<o.length;h++)H(o[h]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(o);if(r.call(y,"key")){o=_(P);var s=Object.keys(y).filter(function(J1){return J1!=="key"});h=0<s.length?"{key: someKey, "+s.join(": ..., ")+": ...}":"{key: someKey}",b[o+h]||(s=0<s.length?"{"+s.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
13
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),T}function u(){H1.asyncTransitions--}function i(T){if(P0===null)try{var g=("require"+Math.random()).slice(0,7);P0=(o5&&o5[g]).call(o5,"timers").setImmediate}catch(Q1){P0=function(J1){U2===!1&&(U2=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var X1=new MessageChannel;X1.port1.onmessage=J1,X1.port2.postMessage(void 0)}}return P0(T)}function l(T){return 1<T.length&&typeof AggregateError==="function"?AggregateError(T):T[0]}function S(T,g){g!==c0-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),c0=g}function b(T,g,Q1){var J1=H1.actQueue;if(J1!==null)if(J1.length!==0)try{h(J1),i(function(){return b(T,g,Q1)});return}catch(X1){H1.thrownErrors.push(X1)}else H1.actQueue=null;0<H1.thrownErrors.length?(J1=l(H1.thrownErrors),H1.thrownErrors.length=0,Q1(J1)):g(T)}function h(T){if(!l0){l0=!0;var g=0;try{for(;g<T.length;g++){var Q1=T[g];do{H1.didUsePromise=!1;var J1=Q1(!1);if(J1!==null){if(H1.didUsePromise){T[g]=Q1,T.splice(0,g);return}Q1=J1}else break}while(1)}T.length=0}catch(X1){T.splice(0,g+1),H1.thrownErrors.push(X1)}finally{l0=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var E=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),y=Symbol.for("react.context"),t=Symbol.for("react.forward_ref"),_1=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),o=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),e=Symbol.for("react.activity"),$1=Symbol.iterator,U1={},q1={isMounted:function(){return!1},enqueueForceUpdate:function(T){J(T,"forceUpdate")},enqueueReplaceState:function(T){J(T,"replaceState")},enqueueSetState:function(T){J(T,"setState")}},K1=Object.assign,W1={};Object.freeze(W1),q.prototype.isReactComponent={},q.prototype.setState=function(T,g){if(typeof T!=="object"&&typeof T!=="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,g,"setState")},q.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};var Y1={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(y0 in Y1)Y1.hasOwnProperty(y0)&&_(y0,Y1[y0]);U.prototype=q.prototype,Y1=G.prototype=new U,Y1.constructor=G,K1(Y1,q.prototype),Y1.isPureReactComponent=!0;var n=Array.isArray,R1=Symbol.for("react.client.reference"),H1={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},x1=Object.prototype.hasOwnProperty,a1=console.createTask?console.createTask:function(){return null};Y1={react_stack_bottom_frame:function(T){return T()}};var i1,k0,B0={},w0=Y1.react_stack_bottom_frame.bind(Y1,L)(),J0=a1(K(L)),Z0=!1,n1=/\/+/g,Y0=typeof reportError==="function"?reportError:function(T){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var g=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T==="object"&&T!==null&&typeof T.message==="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(g))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",T);return}console.error(T)},U2=!1,P0=null,c0=0,G2=!1,l0=!1,c2=typeof queueMicrotask==="function"?function(T){queueMicrotask(function(){return queueMicrotask(T)})}:i;Y1=Object.freeze({__proto__:null,c:function(T){return k().useMemoCache(T)}});var y0={map:v,forEach:function(T,g,Q1){v(T,function(){g.apply(this,arguments)},Q1)},count:function(T){var g=0;return v(T,function(){g++}),g},toArray:function(T){return v(T,function(g){return g})||[]},only:function(T){if(!B(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};_J.Activity=e,_J.Children=y0,_J.Component=q,_J.Fragment=m,_J.Profiler=V,_J.PureComponent=G,_J.StrictMode=I,_J.Suspense=_1,_J.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H1,_J.__COMPILER_RUNTIME=Y1,_J.act=function(T){var g=H1.actQueue,Q1=c0;c0++;var J1=H1.actQueue=g!==null?g:[],X1=!1;try{var O1=T()}catch(I1){H1.thrownErrors.push(I1)}if(0<H1.thrownErrors.length)throw S(g,Q1),T=l(H1.thrownErrors),H1.thrownErrors.length=0,T;if(O1!==null&&typeof O1==="object"&&typeof O1.then==="function"){var T1=O1;return c2(function(){X1||G2||(G2=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(I1,A0){X1=!0,T1.then(function(j0){if(S(g,Q1),Q1===0){try{h(J1),i(function(){return b(j0,I1,A0)})}catch(s){H1.thrownErrors.push(s)}if(0<H1.thrownErrors.length){var x=l(H1.thrownErrors);H1.thrownErrors.length=0,A0(x)}}else I1(j0)},function(j0){S(g,Q1),0<H1.thrownErrors.length?(j0=l(H1.thrownErrors),H1.thrownErrors.length=0,A0(j0)):A0(j0)})}}}var v1=O1;if(S(g,Q1),Q1===0&&(h(J1),J1.length!==0&&c2(function(){X1||G2||(G2=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),H1.actQueue=null),0<H1.thrownErrors.length)throw T=l(H1.thrownErrors),H1.thrownErrors.length=0,T;return{then:function(I1,A0){X1=!0,Q1===0?(H1.actQueue=J1,i(function(){return b(v1,I1,A0)})):I1(v1)}}},_J.cache=function(T){return function(){return T.apply(null,arguments)}},_J.cacheSignal=function(){return null},_J.captureOwnerStack=function(){var T=H1.getCurrentStack;return T===null?null:T()},_J.cloneElement=function(T,g,Q1){if(T===null||T===void 0)throw Error("The argument must be a React element, but you passed "+T+".");var J1=K1({},T.props),X1=T.key,O1=T._owner;if(g!=null){var T1;_:{if(x1.call(g,"ref")&&(T1=Object.getOwnPropertyDescriptor(g,"ref").get)&&T1.isReactWarning){T1=!1;break _}T1=g.ref!==void 0}T1&&(O1=H()),z(g)&&(X(g.key),X1=""+g.key);for(v1 in g)!x1.call(g,v1)||v1==="key"||v1==="__self"||v1==="__source"||v1==="ref"&&g.ref===void 0||(J1[v1]=g[v1])}var v1=arguments.length-2;if(v1===1)J1.children=Q1;else if(1<v1){T1=Array(v1);for(var I1=0;I1<v1;I1++)T1[I1]=arguments[I1+2];J1.children=T1}J1=R(T.type,X1,J1,O1,T._debugStack,T._debugTask);for(X1=2;X1<arguments.length;X1++)O(arguments[X1]);return J1},_J.createContext=function(T){return T={$$typeof:y,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:D,_context:T},T._currentRenderer=null,T._currentRenderer2=null,T},_J.createElement=function(T,g,Q1){for(var J1=2;J1<arguments.length;J1++)O(arguments[J1]);J1={};var X1=null;if(g!=null)for(I1 in k0||!("__self"in g)||"key"in g||(k0=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),z(g)&&(X(g.key),X1=""+g.key),g)x1.call(g,I1)&&I1!=="key"&&I1!=="__self"&&I1!=="__source"&&(J1[I1]=g[I1]);var O1=arguments.length-2;if(O1===1)J1.children=Q1;else if(1<O1){for(var T1=Array(O1),v1=0;v1<O1;v1++)T1[v1]=arguments[v1+2];Object.freeze&&Object.freeze(T1),J1.children=T1}if(T&&T.defaultProps)for(I1 in O1=T.defaultProps,O1)J1[I1]===void 0&&(J1[I1]=O1[I1]);X1&&W(J1,typeof T==="function"?T.displayName||T.name||"Unknown":T);var I1=1e4>H1.recentlyCreatedOwnerStacks++;return R(T,X1,J1,H(),I1?Error("react-stack-top-frame"):w0,I1?a1(K(T)):J0)},_J.createRef=function(){var T={current:null};return Object.seal(T),T},_J.forwardRef=function(T){T!=null&&T.$$typeof===o?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof T!=="function"?console.error("forwardRef requires a render function but was given %s.",T===null?"null":typeof T):T.length!==0&&T.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",T.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),T!=null&&T.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var g={$$typeof:t,render:T},Q1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return Q1},set:function(J1){Q1=J1,T.name||T.displayName||(Object.defineProperty(T,"name",{value:J1}),T.displayName=J1)}}),g},_J.isValidElement=B,_J.lazy=function(T){T={_status:-1,_result:T};var g={$$typeof:p,_payload:T,_init:N},Q1={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return T._ioInfo=Q1,g._debugInfo=[{awaited:Q1}],g},_J.memo=function(T,g){T==null&&console.error("memo: The first argument must be a component. Instead received: %s",T===null?"null":typeof T),g={$$typeof:o,type:T,compare:g===void 0?null:g};var Q1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return Q1},set:function(J1){Q1=J1,T.name||T.displayName||(Object.defineProperty(T,"name",{value:J1}),T.displayName=J1)}}),g},_J.startTransition=function(T){var g=H1.T,Q1={};Q1._updatedFibers=new Set,H1.T=Q1;try{var J1=T(),X1=H1.S;X1!==null&&X1(Q1,J1),typeof J1==="object"&&J1!==null&&typeof J1.then==="function"&&(H1.asyncTransitions++,J1.then(u,u),J1.then(Z,Y0))}catch(O1){Y0(O1)}finally{g===null&&Q1._updatedFibers&&(T=Q1._updatedFibers.size,Q1._updatedFibers.clear(),10<T&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),g!==null&&Q1.types!==null&&(g.types!==null&&g.types!==Q1.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),g.types=Q1.types),H1.T=g}},_J.unstable_useCacheRefresh=function(){return k().useCacheRefresh()},_J.use=function(T){return k().use(T)},_J.useActionState=function(T,g,Q1){return k().useActionState(T,g,Q1)},_J.useCallback=function(T,g){return k().useCallback(T,g)},_J.useContext=function(T){var g=k();return T.$$typeof===D&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),g.useContext(T)},_J.useDebugValue=function(T,g){return k().useDebugValue(T,g)},_J.useDeferredValue=function(T,g){return k().useDeferredValue(T,g)},_J.useEffect=function(T,g){return T==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useEffect(T,g)},_J.useEffectEvent=function(T){return k().useEffectEvent(T)},_J.useId=function(){return k().useId()},_J.useImperativeHandle=function(T,g,Q1){return k().useImperativeHandle(T,g,Q1)},_J.useInsertionEffect=function(T,g){return T==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useInsertionEffect(T,g)},_J.useLayoutEffect=function(T,g){return T==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useLayoutEffect(T,g)},_J.useMemo=function(T,g){return k().useMemo(T,g)},_J.useOptimistic=function(T,g){return k().useOptimistic(T,g)},_J.useReducer=function(T,g,Q1){return k().useReducer(T,g,Q1)},_J.useRef=function(T){return k().useRef(T)},_J.useState=function(T){return k().useState(T)},_J.useSyncExternalStore=function(T,g,Q1){return k().useSyncExternalStore(T,g,Q1)},_J.useTransition=function(){return k().useTransition()},_J.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var N8=A2((QJ)=>{var M2=_0(u0());(function(){function _(I){if(I==null)return null;if(typeof I==="function")return I.$$typeof===k?null:I.displayName||I.name||null;if(typeof I==="string")return I;switch(I){case w:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case P:return"Suspense";case C:return"SuspenseList";case N:return"Activity"}if(typeof I==="object")switch(typeof I.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),I.$$typeof){case W:return"Portal";case B:return I.displayName||"Context";case O:return(I._context.displayName||"Context")+".Consumer";case M:var V=I.render;return I=I.displayName,I||(I=V.displayName||V.name||"",I=I!==""?"ForwardRef("+I+")":"ForwardRef"),I;case f:return V=I.displayName||null,V!==null?V:_(I.type)||"Memo";case v:V=I._payload,I=I._init;try{return _(I(V))}catch(D){}}return null}function Q(I){return""+I}function J(I){try{Q(I);var V=!1}catch(t){V=!0}if(V){V=console;var D=V.error,y=typeof Symbol==="function"&&Symbol.toStringTag&&I[Symbol.toStringTag]||I.constructor.name||"Object";return D.call(V,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",y),Q(I)}}function q(I){if(I===w)return"<>";if(typeof I==="object"&&I!==null&&I.$$typeof===v)return"<...>";try{var V=_(I);return V?"<"+V+">":"<...>"}catch(D){return"<...>"}}function U(){var I=u.A;return I===null?null:I.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(I){if(i.call(I,"key")){var V=Object.getOwnPropertyDescriptor(I,"key").get;if(V&&V.isReactWarning)return!1}return I.key!==void 0}function F(I,V){function D(){b||(b=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",V))}D.isReactWarning=!0,Object.defineProperty(I,"key",{get:D,configurable:!0})}function X(){var I=_(this.type);return h[I]||(h[I]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),I=this.props.ref,I!==void 0?I:null}function Y(I,V,D,y,t,_1){var a=D.ref;return I={$$typeof:z,type:I,key:V,props:D,_owner:y},(a!==void 0?a:null)!==null?Object.defineProperty(I,"ref",{enumerable:!1,get:X}):Object.defineProperty(I,"ref",{enumerable:!1,value:null}),I._store={},Object.defineProperty(I._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(I,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(I,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.defineProperty(I,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_1}),Object.freeze&&(Object.freeze(I.props),Object.freeze(I)),I}function K(I,V,D,y,t,_1){var a=V.children;if(a!==void 0)if(y)if(l(a)){for(y=0;y<a.length;y++)H(a[y]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(a);if(i.call(V,"key")){a=_(I);var o=Object.keys(V).filter(function(e){return e!=="key"});y=0<o.length?"{key: someKey, "+o.join(": ..., ")+": ...}":"{key: someKey}",m[a+y]||(o=0<o.length?"{"+o.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
14
14
|
let props = %s;
|
|
15
15
|
<%s {...props} />
|
|
16
16
|
React keys must be passed directly to JSX without using spread:
|
|
17
17
|
let props = %s;
|
|
18
|
-
<%s key={someKey} {...props} />`,
|
|
18
|
+
<%s key={someKey} {...props} />`,y,a,o,a),m[a+y]=!0)}if(a=null,D!==void 0&&(J(D),a=""+D),Z(V)&&(J(V.key),a=""+V.key),"key"in V){D={};for(var p in V)p!=="key"&&(D[p]=V[p])}else D=V;return a&&F(D,typeof I==="function"?I.displayName||I.name||"Unknown":I),Y(I,a,D,U(),t,_1)}function H(I){L(I)?I._store&&(I._store.validated=1):typeof I==="object"&&I!==null&&I.$$typeof===v&&(I._payload.status==="fulfilled"?L(I._payload.value)&&I._payload.value._store&&(I._payload.value._store.validated=1):I._store&&(I._store.validated=1))}function L(I){return typeof I==="object"&&I!==null&&I.$$typeof===z}var z=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),B=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),u=M2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,i=Object.prototype.hasOwnProperty,l=Array.isArray,S=console.createTask?console.createTask:function(){return null};M2={react_stack_bottom_frame:function(I){return I()}};var b,h={},E=M2.react_stack_bottom_frame.bind(M2,G)(),j=S(q(G)),m={};QJ.Fragment=w,QJ.jsx=function(I,V,D){var y=1e4>u.recentlyCreatedOwnerStacks++;return K(I,V,D,!1,y?Error("react-stack-top-frame"):E,y?S(q(I)):j)},QJ.jsxs=function(I,V,D){var y=1e4>u.recentlyCreatedOwnerStacks++;return K(I,V,D,!0,y?Error("react-stack-top-frame"):E,y?S(q(I)):j)}})()});var q9=A2((tq)=>{var z0=_0(u0());(function(){function _(L,z){return L===z&&(L!==0||1/L===1/z)||L!==L&&z!==z}function Q(L,z){Y||z0.startTransition===void 0||(Y=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var W=z();if(!K){var w=z();U(W,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),K=!0)}w=G({inst:{value:W,getSnapshot:z}});var R=w[0].inst,A=w[1];return F(function(){R.value=W,R.getSnapshot=z,J(R)&&A({inst:R})},[L,W,z]),Z(function(){return J(R)&&A({inst:R}),L(function(){J(R)&&A({inst:R})})},[L]),X(W),W}function J(L){var z=L.getSnapshot;L=L.value;try{var W=z();return!U(L,W)}catch(w){return!0}}function q(L,z){return z()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var U=typeof Object.is==="function"?Object.is:_,G=z0.useState,Z=z0.useEffect,F=z0.useLayoutEffect,X=z0.useDebugValue,Y=!1,K=!1,H=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?q:Q;tq.useSyncExternalStore=z0.useSyncExternalStore!==void 0?z0.useSyncExternalStore:H,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var U9=A2((oq)=>{var o0=_0(u0());(function(){function _(X,Y){return X===Y&&(X!==0||1/X===1/Y)||X!==X&&Y!==Y}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var Q=q9(),J=typeof Object.is==="function"?Object.is:_,q=Q.useSyncExternalStore,U=o0.useRef,G=o0.useEffect,Z=o0.useMemo,F=o0.useDebugValue;oq.useSyncExternalStoreWithSelector=function(X,Y,K,H,L){var z=U(null);if(z.current===null){var W={hasValue:!1,value:null};z.current=W}else W=z.current;z=Z(function(){function R(P){if(!A){if(A=!0,O=P,P=H(P),L!==void 0&&W.hasValue){var C=W.value;if(L(C,P))return B=C}return B=P}if(C=B,J(O,P))return C;var f=H(P);if(L!==void 0&&L(C,f))return O=P,C;return O=P,B=f}var A=!1,O,B,M=K===void 0?null:K;return[function(){return R(Y())},M===null?void 0:function(){return R(M())}]},[Y,K,H,L]);var w=q(X,z[0],z[1]);return G(function(){W.hasValue=!0,W.value=w},[w]),F(w),w},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var Y9=A2((QU)=>{var s6=_0(u0());(function(){function _(){}function Q(K){return""+K}function J(K,H,L){var z=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;try{Q(z);var W=!1}catch(w){W=!0}return W&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",typeof Symbol==="function"&&Symbol.toStringTag&&z[Symbol.toStringTag]||z.constructor.name||"Object"),Q(z)),{$$typeof:X,key:z==null?null:""+z,children:K,containerInfo:H,implementation:L}}function q(K,H){if(K==="font")return"";if(typeof H==="string")return H==="use-credentials"?H:""}function U(K){return K===null?"`null`":K===void 0?"`undefined`":K===""?"an empty string":'something with type "'+typeof K+'"'}function G(K){return K===null?"`null`":K===void 0?"`undefined`":K===""?"an empty string":typeof K==="string"?JSON.stringify(K):typeof K==="number"?"`"+K+"`":'something with type "'+typeof K+'"'}function Z(){var K=Y.H;return K===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
19
19
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
20
20
|
2. You might be breaking the Rules of Hooks
|
|
21
21
|
3. You might have more than one copy of React in the same app
|
|
22
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),X}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var F={d:{f:_,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:_,C:_,L:_,m:_,X:_,S:_,M:_},p:0,findDOMNode:null},K=Symbol.for("react.portal"),Y=b6.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map==="function"&&Map.prototype!=null&&typeof Map.prototype.forEach==="function"&&typeof Set==="function"&&Set.prototype!=null&&typeof Set.prototype.clear==="function"&&typeof Set.prototype.forEach==="function"||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),nq.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,nq.createPortal=function(X,H){var L=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!H||H.nodeType!==1&&H.nodeType!==9&&H.nodeType!==11)throw Error("Target container is not a DOM element.");return J(X,H,null,L)},nq.flushSync=function(X){var H=Y.T,L=F.p;try{if(Y.T=null,F.p=2,X)return X()}finally{Y.T=H,F.p=L,F.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},nq.preconnect=function(X,H){typeof X==="string"&&X?H!=null&&typeof H!=="object"?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",G(H)):H!=null&&typeof H.crossOrigin!=="string"&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",U(H.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(X)),typeof X==="string"&&(H?(H=H.crossOrigin,H=typeof H==="string"?H==="use-credentials"?H:"":void 0):H=null,F.d.C(X,H))},nq.prefetchDNS=function(X){if(typeof X!=="string"||!X)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(X));else if(1<arguments.length){var H=arguments[1];typeof H==="object"&&H.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H))}typeof X==="string"&&F.d.D(X)},nq.preinit=function(X,H){if(typeof X==="string"&&X?H==null||typeof H!=="object"?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",G(H)):H.as!=="style"&&H.as!=="script"&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',G(H.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(X)),typeof X==="string"&&H&&typeof H.as==="string"){var L=H.as,W=q(L,H.crossOrigin),A=typeof H.integrity==="string"?H.integrity:void 0,I=typeof H.fetchPriority==="string"?H.fetchPriority:void 0;L==="style"?F.d.S(X,typeof H.precedence==="string"?H.precedence:void 0,{crossOrigin:W,integrity:A,fetchPriority:I}):L==="script"&&F.d.X(X,{crossOrigin:W,integrity:A,fetchPriority:I,nonce:typeof H.nonce==="string"?H.nonce:void 0})}},nq.preinitModule=function(X,H){var L="";if(typeof X==="string"&&X||(L+=" The `href` argument encountered was "+U(X)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&H.as!=="script"&&(L+=" The `as` option encountered was "+G(H.as)+"."),L)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",L);else switch(L=H&&typeof H.as==="string"?H.as:"script",L){case"script":break;default:L=G(L),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',L,X)}if(typeof X==="string")if(typeof H==="object"&&H!==null){if(H.as==null||H.as==="script")L=q(H.as,H.crossOrigin),F.d.M(X,{crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0,nonce:typeof H.nonce==="string"?H.nonce:void 0})}else H==null&&F.d.M(X)},nq.preload=function(X,H){var L="";if(typeof X==="string"&&X||(L+=" The `href` argument encountered was "+U(X)+"."),H==null||typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":typeof H.as==="string"&&H.as||(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',L),typeof X==="string"&&typeof H==="object"&&H!==null&&typeof H.as==="string"){L=H.as;var W=q(L,H.crossOrigin);F.d.L(X,L,{crossOrigin:W,integrity:typeof H.integrity==="string"?H.integrity:void 0,nonce:typeof H.nonce==="string"?H.nonce:void 0,type:typeof H.type==="string"?H.type:void 0,fetchPriority:typeof H.fetchPriority==="string"?H.fetchPriority:void 0,referrerPolicy:typeof H.referrerPolicy==="string"?H.referrerPolicy:void 0,imageSrcSet:typeof H.imageSrcSet==="string"?H.imageSrcSet:void 0,imageSizes:typeof H.imageSizes==="string"?H.imageSizes:void 0,media:typeof H.media==="string"?H.media:void 0})}},nq.preloadModule=function(X,H){var L="";typeof X==="string"&&X||(L+=" The `href` argument encountered was "+U(X)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&typeof H.as!=="string"&&(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',L),typeof X==="string"&&(H?(L=q(H.as,H.crossOrigin),F.d.m(X,{as:typeof H.as==="string"&&H.as!=="script"?H.as:void 0,crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0})):F.d.m(X))},nq.requestFormReset=function(X){F.d.r(X)},nq.unstable_batchedUpdates=function(X,H){return X(H)},nq.useFormState=function(X,H,L){return Z().useFormState(X,H,L)},nq.useFormStatus=function(){return Z().useHostTransitionStatus()},nq.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var $9=U2((PB,J9)=>{var eq=i1(Q9());J9.exports=eq});var V5=U2((RZ)=>{var I2=i1(O0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===k?null:P.displayName||P.name||null;if(typeof P==="string")return P;switch(P){case I:return"Fragment";case M:return"Profiler";case R:return"StrictMode";case f:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof P==="object")switch(typeof P.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),P.$$typeof){case A:return"Portal";case B:return P.displayName||"Context";case O:return(P._context.displayName||"Context")+".Consumer";case T:var y=P.render;return P=P.displayName,P||(P=y.displayName||y.name||"",P=P!==""?"ForwardRef("+P+")":"ForwardRef"),P;case N:return y=P.displayName||null,y!==null?y:_(P.type)||"Memo";case S:y=P._payload,P=P._init;try{return _(P(y))}catch(p){}}return null}function Q(P){return""+P}function J(P){try{Q(P);var y=!1}catch(e){y=!0}if(y){y=console;var p=y.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return p.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),Q(P)}}function q(P){if(P===I)return"<>";if(typeof P==="object"&&P!==null&&P.$$typeof===S)return"<...>";try{var y=_(P);return y?"<"+y+">":"<...>"}catch(p){return"<...>"}}function U(){var P=x.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(r.call(P,"key")){var y=Object.getOwnPropertyDescriptor(P,"key").get;if(y&&y.isReactWarning)return!1}return P.key!==void 0}function F(P,y){function p(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",y))}p.isReactWarning=!0,Object.defineProperty(P,"key",{get:p,configurable:!0})}function K(){var P=_(this.type);return V[P]||(V[P]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),P=this.props.ref,P!==void 0?P:null}function Y(P,y,p,h,e,t){var o=p.ref;return P={$$typeof:W,type:P,key:y,props:p,_owner:h},(o!==void 0?o:null)!==null?Object.defineProperty(P,"ref",{enumerable:!1,get:K}):Object.defineProperty(P,"ref",{enumerable:!1,value:null}),P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(P,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(P,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:e}),Object.defineProperty(P,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function X(P,y,p,h,e,t){var o=y.children;if(o!==void 0)if(h)if(m(o)){for(h=0;h<o.length;h++)H(o[h]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(o);if(r.call(y,"key")){o=_(P);var s=Object.keys(y).filter(function(J1){return J1!=="key"});h=0<s.length?"{key: someKey, "+s.join(": ..., ")+": ...}":"{key: someKey}",b[o+h]||(s=0<s.length?"{"+s.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
22
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),K}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var F={d:{f:_,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:_,C:_,L:_,m:_,X:_,S:_,M:_},p:0,findDOMNode:null},X=Symbol.for("react.portal"),Y=s6.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map==="function"&&Map.prototype!=null&&typeof Map.prototype.forEach==="function"&&typeof Set==="function"&&Set.prototype!=null&&typeof Set.prototype.clear==="function"&&typeof Set.prototype.forEach==="function"||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),QU.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,QU.createPortal=function(K,H){var L=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!H||H.nodeType!==1&&H.nodeType!==9&&H.nodeType!==11)throw Error("Target container is not a DOM element.");return J(K,H,null,L)},QU.flushSync=function(K){var H=Y.T,L=F.p;try{if(Y.T=null,F.p=2,K)return K()}finally{Y.T=H,F.p=L,F.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},QU.preconnect=function(K,H){typeof K==="string"&&K?H!=null&&typeof H!=="object"?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",G(H)):H!=null&&typeof H.crossOrigin!=="string"&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",U(H.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K)),typeof K==="string"&&(H?(H=H.crossOrigin,H=typeof H==="string"?H==="use-credentials"?H:"":void 0):H=null,F.d.C(K,H))},QU.prefetchDNS=function(K){if(typeof K!=="string"||!K)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K));else if(1<arguments.length){var H=arguments[1];typeof H==="object"&&H.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H))}typeof K==="string"&&F.d.D(K)},QU.preinit=function(K,H){if(typeof K==="string"&&K?H==null||typeof H!=="object"?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",G(H)):H.as!=="style"&&H.as!=="script"&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',G(H.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K)),typeof K==="string"&&H&&typeof H.as==="string"){var L=H.as,z=q(L,H.crossOrigin),W=typeof H.integrity==="string"?H.integrity:void 0,w=typeof H.fetchPriority==="string"?H.fetchPriority:void 0;L==="style"?F.d.S(K,typeof H.precedence==="string"?H.precedence:void 0,{crossOrigin:z,integrity:W,fetchPriority:w}):L==="script"&&F.d.X(K,{crossOrigin:z,integrity:W,fetchPriority:w,nonce:typeof H.nonce==="string"?H.nonce:void 0})}},QU.preinitModule=function(K,H){var L="";if(typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&H.as!=="script"&&(L+=" The `as` option encountered was "+G(H.as)+"."),L)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",L);else switch(L=H&&typeof H.as==="string"?H.as:"script",L){case"script":break;default:L=G(L),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',L,K)}if(typeof K==="string")if(typeof H==="object"&&H!==null){if(H.as==null||H.as==="script")L=q(H.as,H.crossOrigin),F.d.M(K,{crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0,nonce:typeof H.nonce==="string"?H.nonce:void 0})}else H==null&&F.d.M(K)},QU.preload=function(K,H){var L="";if(typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H==null||typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":typeof H.as==="string"&&H.as||(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',L),typeof K==="string"&&typeof H==="object"&&H!==null&&typeof H.as==="string"){L=H.as;var z=q(L,H.crossOrigin);F.d.L(K,L,{crossOrigin:z,integrity:typeof H.integrity==="string"?H.integrity:void 0,nonce:typeof H.nonce==="string"?H.nonce:void 0,type:typeof H.type==="string"?H.type:void 0,fetchPriority:typeof H.fetchPriority==="string"?H.fetchPriority:void 0,referrerPolicy:typeof H.referrerPolicy==="string"?H.referrerPolicy:void 0,imageSrcSet:typeof H.imageSrcSet==="string"?H.imageSrcSet:void 0,imageSizes:typeof H.imageSizes==="string"?H.imageSizes:void 0,media:typeof H.media==="string"?H.media:void 0})}},QU.preloadModule=function(K,H){var L="";typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&typeof H.as!=="string"&&(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',L),typeof K==="string"&&(H?(L=q(H.as,H.crossOrigin),F.d.m(K,{as:typeof H.as==="string"&&H.as!=="script"?H.as:void 0,crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0})):F.d.m(K))},QU.requestFormReset=function(K){F.d.r(K)},QU.unstable_batchedUpdates=function(K,H){return K(H)},QU.useFormState=function(K,H,L){return Z().useFormState(K,H,L)},QU.useFormStatus=function(){return Z().useHostTransitionStatus()},QU.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var z9=A2((NA,L9)=>{var JU=_0(Y9());L9.exports=JU});var l5=A2((wZ)=>{var u2=_0(u0());(function(){function _(I){if(I==null)return null;if(typeof I==="function")return I.$$typeof===k?null:I.displayName||I.name||null;if(typeof I==="string")return I;switch(I){case w:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case P:return"Suspense";case C:return"SuspenseList";case N:return"Activity"}if(typeof I==="object")switch(typeof I.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),I.$$typeof){case W:return"Portal";case B:return I.displayName||"Context";case O:return(I._context.displayName||"Context")+".Consumer";case M:var V=I.render;return I=I.displayName,I||(I=V.displayName||V.name||"",I=I!==""?"ForwardRef("+I+")":"ForwardRef"),I;case f:return V=I.displayName||null,V!==null?V:_(I.type)||"Memo";case v:V=I._payload,I=I._init;try{return _(I(V))}catch(D){}}return null}function Q(I){return""+I}function J(I){try{Q(I);var V=!1}catch(t){V=!0}if(V){V=console;var D=V.error,y=typeof Symbol==="function"&&Symbol.toStringTag&&I[Symbol.toStringTag]||I.constructor.name||"Object";return D.call(V,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",y),Q(I)}}function q(I){if(I===w)return"<>";if(typeof I==="object"&&I!==null&&I.$$typeof===v)return"<...>";try{var V=_(I);return V?"<"+V+">":"<...>"}catch(D){return"<...>"}}function U(){var I=u.A;return I===null?null:I.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(I){if(i.call(I,"key")){var V=Object.getOwnPropertyDescriptor(I,"key").get;if(V&&V.isReactWarning)return!1}return I.key!==void 0}function F(I,V){function D(){b||(b=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",V))}D.isReactWarning=!0,Object.defineProperty(I,"key",{get:D,configurable:!0})}function X(){var I=_(this.type);return h[I]||(h[I]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),I=this.props.ref,I!==void 0?I:null}function Y(I,V,D,y,t,_1){var a=D.ref;return I={$$typeof:z,type:I,key:V,props:D,_owner:y},(a!==void 0?a:null)!==null?Object.defineProperty(I,"ref",{enumerable:!1,get:X}):Object.defineProperty(I,"ref",{enumerable:!1,value:null}),I._store={},Object.defineProperty(I._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(I,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(I,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.defineProperty(I,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_1}),Object.freeze&&(Object.freeze(I.props),Object.freeze(I)),I}function K(I,V,D,y,t,_1){var a=V.children;if(a!==void 0)if(y)if(l(a)){for(y=0;y<a.length;y++)H(a[y]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(a);if(i.call(V,"key")){a=_(I);var o=Object.keys(V).filter(function(e){return e!=="key"});y=0<o.length?"{key: someKey, "+o.join(": ..., ")+": ...}":"{key: someKey}",m[a+y]||(o=0<o.length?"{"+o.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,h,o,s,o),b[o+h]=!0)}if(o=null,p!==void 0&&(J(p),o=""+p),Z(y)&&(J(y.key),o=""+y.key),"key"in y){p={};for(var g in y)g!=="key"&&(p[g]=y[g])}else p=y;return o&&F(p,typeof P==="function"?P.displayName||P.name||"Unknown":P),Y(P,o,p,U(),e,t)}function H(P){L(P)?P._store&&(P._store.validated=1):typeof P==="object"&&P!==null&&P.$$typeof===S&&(P._payload.status==="fulfilled"?L(P._payload.value)&&P._payload.value._store&&(P._payload.value._store.validated=1):P._store&&(P._store.validated=1))}function L(P){return typeof P==="object"&&P!==null&&P.$$typeof===W}var W=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),B=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),x=I2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,r=Object.prototype.hasOwnProperty,m=Array.isArray,v=console.createTask?console.createTask:function(){return null};I2={react_stack_bottom_frame:function(P){return P()}};var D,V={},E=I2.react_stack_bottom_frame.bind(I2,G)(),u=v(q(G)),b={};RZ.Fragment=I,RZ.jsxDEV=function(P,y,p,h){var e=1e4>x.recentlyCreatedOwnerStacks++;return X(P,y,p,h,e?Error("react-stack-top-frame"):E,e?v(q(P)):u)}})()});var i=i1(O0(),1);var d=i1(z8(),1),a=i1(O0(),1);function j1(_){if(typeof _==="string"||typeof _==="number")return""+_;let Q="";if(Array.isArray(_)){for(let J=0,q;J<_.length;J++)if((q=j1(_[J]))!=="")Q+=(Q&&" ")+q}else for(let J in _)if(_[J])Q+=(Q&&" ")+J;return Q}var eQ={value:()=>{}};function A8(){for(var _=0,Q=arguments.length,J={},q;_<Q;++_){if(!(q=arguments[_]+"")||q in J||/[\s.]/.test(q))throw Error("illegal type: "+q);J[q]=[]}return new g5(J)}function g5(_){this._=_}function _J(_,Q){return _.trim().split(/^|\s+/).map(function(J){var q="",U=J.indexOf(".");if(U>=0)q=J.slice(U+1),J=J.slice(0,U);if(J&&!Q.hasOwnProperty(J))throw Error("unknown type: "+J);return{type:J,name:q}})}g5.prototype=A8.prototype={constructor:g5,on:function(_,Q){var J=this._,q=_J(_+"",J),U,G=-1,Z=q.length;if(arguments.length<2){while(++G<Z)if((U=(_=q[G]).type)&&(U=QJ(J[U],_.name)))return U;return}if(Q!=null&&typeof Q!=="function")throw Error("invalid callback: "+Q);while(++G<Z)if(U=(_=q[G]).type)J[U]=W8(J[U],_.name,Q);else if(Q==null)for(U in J)J[U]=W8(J[U],_.name,null);return this},copy:function(){var _={},Q=this._;for(var J in Q)_[J]=Q[J].slice();return new g5(_)},call:function(_,Q){if((U=arguments.length-2)>0)for(var J=Array(U),q=0,U,G;q<U;++q)J[q]=arguments[q+2];if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(G=this._[_],q=0,U=G.length;q<U;++q)G[q].value.apply(Q,J)},apply:function(_,Q,J){if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(var q=this._[_],U=0,G=q.length;U<G;++U)q[U].value.apply(Q,J)}};function QJ(_,Q){for(var J=0,q=_.length,U;J<q;++J)if((U=_[J]).name===Q)return U.value}function W8(_,Q,J){for(var q=0,U=_.length;q<U;++q)if(_[q].name===Q){_[q]=eQ,_=_.slice(0,q).concat(_.slice(q+1));break}if(J!=null)_.push({name:Q,value:J});return _}var Z2=A8;function j2(_){return function(){return this.matches(_)}}function p5(_){return function(Q){return Q.matches(_)}}var c5="http://www.w3.org/1999/xhtml",g4={svg:"http://www.w3.org/2000/svg",xhtml:c5,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function I0(_){var Q=_+="",J=Q.indexOf(":");if(J>=0&&(Q=_.slice(0,J))!=="xmlns")_=_.slice(J+1);return g4.hasOwnProperty(Q)?{space:g4[Q],local:_}:_}function p4(_){let Q;while(Q=_.sourceEvent)_=Q;return _}function d1(_,Q){if(_=p4(_),Q===void 0)Q=_.currentTarget;if(Q){var J=Q.ownerSVGElement||Q;if(J.createSVGPoint){var q=J.createSVGPoint();return q.x=_.clientX,q.y=_.clientY,q=q.matrixTransform(Q.getScreenCTM().inverse()),[q.x,q.y]}if(Q.getBoundingClientRect){var U=Q.getBoundingClientRect();return[_.clientX-U.left-Q.clientLeft,_.clientY-U.top-Q.clientTop]}}return[_.pageX,_.pageY]}function JJ(){}function d0(_){return _==null?JJ:function(){return this.querySelector(_)}}function c4(_){if(typeof _!=="function")_=d0(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=Array(Z),K,Y,X=0;X<Z;++X)if((K=G[X])&&(Y=_.call(K,K.__data__,X,G))){if("__data__"in K)Y.__data__=K.__data__;F[X]=Y}return new h1(q,this._parents)}function l4(_){return _==null?[]:Array.isArray(_)?_:Array.from(_)}function $J(){return[]}function V2(_){return _==null?$J:function(){return this.querySelectorAll(_)}}function qJ(_){return function(){return l4(_.apply(this,arguments))}}function i4(_){if(typeof _==="function")_=qJ(_);else _=V2(_);for(var Q=this._groups,J=Q.length,q=[],U=[],G=0;G<J;++G)for(var Z=Q[G],F=Z.length,K,Y=0;Y<F;++Y)if(K=Z[Y])q.push(_.call(K,K.__data__,Y,Z)),U.push(K);return new h1(q,U)}var UJ=Array.prototype.find;function GJ(_){return function(){return UJ.call(this.children,_)}}function ZJ(){return this.firstElementChild}function r4(_){return this.select(_==null?ZJ:GJ(typeof _==="function"?_:p5(_)))}var FJ=Array.prototype.filter;function HJ(){return Array.from(this.children)}function KJ(_){return function(){return FJ.call(this.children,_)}}function d4(_){return this.selectAll(_==null?HJ:KJ(typeof _==="function"?_:p5(_)))}function a4(_){if(typeof _!=="function")_=j2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],K,Y=0;Y<Z;++Y)if((K=G[Y])&&_.call(K,K.__data__,Y,G))F.push(K);return new h1(q,this._parents)}function _5(_){return Array(_.length)}function s4(){return new h1(this._enter||this._groups.map(_5),this._parents)}function Q5(_,Q){this.ownerDocument=_.ownerDocument,this.namespaceURI=_.namespaceURI,this._next=null,this._parent=_,this.__data__=Q}Q5.prototype={constructor:Q5,appendChild:function(_){return this._parent.insertBefore(_,this._next)},insertBefore:function(_,Q){return this._parent.insertBefore(_,Q)},querySelector:function(_){return this._parent.querySelector(_)},querySelectorAll:function(_){return this._parent.querySelectorAll(_)}};function t4(_){return function(){return _}}function XJ(_,Q,J,q,U,G){var Z=0,F,K=Q.length,Y=G.length;for(;Z<Y;++Z)if(F=Q[Z])F.__data__=G[Z],q[Z]=F;else J[Z]=new Q5(_,G[Z]);for(;Z<K;++Z)if(F=Q[Z])U[Z]=F}function YJ(_,Q,J,q,U,G,Z){var F,K,Y=new Map,X=Q.length,H=G.length,L=Array(X),W;for(F=0;F<X;++F)if(K=Q[F])if(L[F]=W=Z.call(K,K.__data__,F,Q)+"",Y.has(W))U[F]=K;else Y.set(W,K);for(F=0;F<H;++F)if(W=Z.call(_,G[F],F,G)+"",K=Y.get(W))q[F]=K,K.__data__=G[F],Y.delete(W);else J[F]=new Q5(_,G[F]);for(F=0;F<X;++F)if((K=Q[F])&&Y.get(L[F])===K)U[F]=K}function LJ(_){return _.__data__}function o4(_,Q){if(!arguments.length)return Array.from(this,LJ);var J=Q?YJ:XJ,q=this._parents,U=this._groups;if(typeof _!=="function")_=t4(_);for(var G=U.length,Z=Array(G),F=Array(G),K=Array(G),Y=0;Y<G;++Y){var X=q[Y],H=U[Y],L=H.length,W=zJ(_.call(X,X&&X.__data__,Y,q)),A=W.length,I=F[Y]=Array(A),R=Z[Y]=Array(A),M=K[Y]=Array(L);J(X,H,I,R,M,W,Q);for(var O=0,B=0,T,f;O<A;++O)if(T=I[O]){if(O>=B)B=O+1;while(!(f=R[B])&&++B<A);T._next=f||null}}return Z=new h1(Z,q),Z._enter=F,Z._exit=K,Z}function zJ(_){return typeof _==="object"&&"length"in _?_:Array.from(_)}function n4(){return new h1(this._exit||this._groups.map(_5),this._parents)}function e4(_,Q,J){var q=this.enter(),U=this,G=this.exit();if(typeof _==="function"){if(q=_(q),q)q=q.selection()}else q=q.append(_+"");if(Q!=null){if(U=Q(U),U)U=U.selection()}if(J==null)G.remove();else J(G);return q&&U?q.merge(U).order():U}function _3(_){var Q=_.selection?_.selection():_;for(var J=this._groups,q=Q._groups,U=J.length,G=q.length,Z=Math.min(U,G),F=Array(U),K=0;K<Z;++K)for(var Y=J[K],X=q[K],H=Y.length,L=F[K]=Array(H),W,A=0;A<H;++A)if(W=Y[A]||X[A])L[A]=W;for(;K<U;++K)F[K]=J[K];return new h1(F,this._parents)}function Q3(){for(var _=this._groups,Q=-1,J=_.length;++Q<J;)for(var q=_[Q],U=q.length-1,G=q[U],Z;--U>=0;)if(Z=q[U]){if(G&&Z.compareDocumentPosition(G)^4)G.parentNode.insertBefore(Z,G);G=Z}return this}function J3(_){if(!_)_=WJ;function Q(H,L){return H&&L?_(H.__data__,L.__data__):!H-!L}for(var J=this._groups,q=J.length,U=Array(q),G=0;G<q;++G){for(var Z=J[G],F=Z.length,K=U[G]=Array(F),Y,X=0;X<F;++X)if(Y=Z[X])K[X]=Y;K.sort(Q)}return new h1(U,this._parents).order()}function WJ(_,Q){return _<Q?-1:_>Q?1:_>=Q?0:NaN}function $3(){var _=arguments[0];return arguments[0]=this,_.apply(null,arguments),this}function q3(){return Array.from(this)}function U3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length;U<G;++U){var Z=q[U];if(Z)return Z}return null}function G3(){let _=0;for(let Q of this)++_;return _}function Z3(){return!this.node()}function F3(_){for(var Q=this._groups,J=0,q=Q.length;J<q;++J)for(var U=Q[J],G=0,Z=U.length,F;G<Z;++G)if(F=U[G])_.call(F,F.__data__,G,U);return this}function AJ(_){return function(){this.removeAttribute(_)}}function BJ(_){return function(){this.removeAttributeNS(_.space,_.local)}}function MJ(_,Q){return function(){this.setAttribute(_,Q)}}function TJ(_,Q){return function(){this.setAttributeNS(_.space,_.local,Q)}}function RJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttribute(_);else this.setAttribute(_,J)}}function OJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttributeNS(_.space,_.local);else this.setAttributeNS(_.space,_.local,J)}}function H3(_,Q){var J=I0(_);if(arguments.length<2){var q=this.node();return J.local?q.getAttributeNS(J.space,J.local):q.getAttribute(J)}return this.each((Q==null?J.local?BJ:AJ:typeof Q==="function"?J.local?OJ:RJ:J.local?TJ:MJ)(J,Q))}function J5(_){return _.ownerDocument&&_.ownerDocument.defaultView||_.document&&_||_.defaultView}function IJ(_){return function(){this.style.removeProperty(_)}}function PJ(_,Q,J){return function(){this.style.setProperty(_,Q,J)}}function wJ(_,Q,J){return function(){var q=Q.apply(this,arguments);if(q==null)this.style.removeProperty(_);else this.style.setProperty(_,q,J)}}function K3(_,Q,J){return arguments.length>1?this.each((Q==null?IJ:typeof Q==="function"?wJ:PJ)(_,Q,J==null?"":J)):a0(this.node(),_)}function a0(_,Q){return _.style.getPropertyValue(Q)||J5(_).getComputedStyle(_,null).getPropertyValue(Q)}function fJ(_){return function(){delete this[_]}}function NJ(_,Q){return function(){this[_]=Q}}function CJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)delete this[_];else this[_]=J}}function X3(_,Q){return arguments.length>1?this.each((Q==null?fJ:typeof Q==="function"?CJ:NJ)(_,Q)):this.node()[_]}function B8(_){return _.trim().split(/^|\s+/)}function Y3(_){return _.classList||new M8(_)}function M8(_){this._node=_,this._names=B8(_.getAttribute("class")||"")}M8.prototype={add:function(_){var Q=this._names.indexOf(_);if(Q<0)this._names.push(_),this._node.setAttribute("class",this._names.join(" "))},remove:function(_){var Q=this._names.indexOf(_);if(Q>=0)this._names.splice(Q,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(_){return this._names.indexOf(_)>=0}};function T8(_,Q){var J=Y3(_),q=-1,U=Q.length;while(++q<U)J.add(Q[q])}function R8(_,Q){var J=Y3(_),q=-1,U=Q.length;while(++q<U)J.remove(Q[q])}function SJ(_){return function(){T8(this,_)}}function vJ(_){return function(){R8(this,_)}}function yJ(_,Q){return function(){(Q.apply(this,arguments)?T8:R8)(this,_)}}function L3(_,Q){var J=B8(_+"");if(arguments.length<2){var q=Y3(this.node()),U=-1,G=J.length;while(++U<G)if(!q.contains(J[U]))return!1;return!0}return this.each((typeof Q==="function"?yJ:Q?SJ:vJ)(J,Q))}function kJ(){this.textContent=""}function jJ(_){return function(){this.textContent=_}}function VJ(_){return function(){var Q=_.apply(this,arguments);this.textContent=Q==null?"":Q}}function z3(_){return arguments.length?this.each(_==null?kJ:(typeof _==="function"?VJ:jJ)(_)):this.node().textContent}function uJ(){this.innerHTML=""}function hJ(_){return function(){this.innerHTML=_}}function DJ(_){return function(){var Q=_.apply(this,arguments);this.innerHTML=Q==null?"":Q}}function W3(_){return arguments.length?this.each(_==null?uJ:(typeof _==="function"?DJ:hJ)(_)):this.node().innerHTML}function bJ(){if(this.nextSibling)this.parentNode.appendChild(this)}function A3(){return this.each(bJ)}function EJ(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function B3(){return this.each(EJ)}function xJ(_){return function(){var Q=this.ownerDocument,J=this.namespaceURI;return J===c5&&Q.documentElement.namespaceURI===c5?Q.createElement(_):Q.createElementNS(J,_)}}function mJ(_){return function(){return this.ownerDocument.createElementNS(_.space,_.local)}}function $5(_){var Q=I0(_);return(Q.local?mJ:xJ)(Q)}function M3(_){var Q=typeof _==="function"?_:$5(_);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})}function gJ(){return null}function T3(_,Q){var J=typeof _==="function"?_:$5(_),q=Q==null?gJ:typeof Q==="function"?Q:d0(Q);return this.select(function(){return this.insertBefore(J.apply(this,arguments),q.apply(this,arguments)||null)})}function pJ(){var _=this.parentNode;if(_)_.removeChild(this)}function R3(){return this.each(pJ)}function cJ(){var _=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function lJ(){var _=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function O3(_){return this.select(_?lJ:cJ)}function I3(_){return arguments.length?this.property("__data__",_):this.node().__data__}function iJ(_){return function(Q){_.call(this,Q,this.__data__)}}function rJ(_){return _.trim().split(/^|\s+/).map(function(Q){var J="",q=Q.indexOf(".");if(q>=0)J=Q.slice(q+1),Q=Q.slice(0,q);return{type:Q,name:J}})}function dJ(_){return function(){var Q=this.__on;if(!Q)return;for(var J=0,q=-1,U=Q.length,G;J<U;++J)if(G=Q[J],(!_.type||G.type===_.type)&&G.name===_.name)this.removeEventListener(G.type,G.listener,G.options);else Q[++q]=G;if(++q)Q.length=q;else delete this.__on}}function aJ(_,Q,J){return function(){var q=this.__on,U,G=iJ(Q);if(q){for(var Z=0,F=q.length;Z<F;++Z)if((U=q[Z]).type===_.type&&U.name===_.name){this.removeEventListener(U.type,U.listener,U.options),this.addEventListener(U.type,U.listener=G,U.options=J),U.value=Q;return}}if(this.addEventListener(_.type,G,J),U={type:_.type,name:_.name,value:Q,listener:G,options:J},!q)this.__on=[U];else q.push(U)}}function P3(_,Q,J){var q=rJ(_+""),U,G=q.length,Z;if(arguments.length<2){var F=this.node().__on;if(F){for(var K=0,Y=F.length,X;K<Y;++K)for(U=0,X=F[K];U<G;++U)if((Z=q[U]).type===X.type&&Z.name===X.name)return X.value}return}F=Q?aJ:dJ;for(U=0;U<G;++U)this.each(F(q[U],Q,J));return this}function O8(_,Q,J){var q=J5(_),U=q.CustomEvent;if(typeof U==="function")U=new U(Q,J);else if(U=q.document.createEvent("Event"),J)U.initEvent(Q,J.bubbles,J.cancelable),U.detail=J.detail;else U.initEvent(Q,!1,!1);_.dispatchEvent(U)}function sJ(_,Q){return function(){return O8(this,_,Q)}}function tJ(_,Q){return function(){return O8(this,_,Q.apply(this,arguments))}}function w3(_,Q){return this.each((typeof Q==="function"?tJ:sJ)(_,Q))}function*f3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length,Z;U<G;++U)if(Z=q[U])yield Z}var N3=[null];function h1(_,Q){this._groups=_,this._parents=Q}function I8(){return new h1([[document.documentElement]],N3)}function oJ(){return this}h1.prototype=I8.prototype={constructor:h1,select:c4,selectAll:i4,selectChild:r4,selectChildren:d4,filter:a4,data:o4,enter:s4,exit:n4,join:e4,merge:_3,selection:oJ,order:Q3,sort:J3,call:$3,nodes:q3,node:U3,size:G3,empty:Z3,each:F3,attr:H3,style:K3,property:X3,classed:L3,text:z3,html:W3,raise:A3,lower:B3,append:M3,insert:T3,remove:R3,clone:O3,datum:I3,on:P3,dispatch:w3,[Symbol.iterator]:f3};var V0=I8;function m1(_){return typeof _==="string"?new h1([[document.querySelector(_)]],[document.documentElement]):new h1([[_]],N3)}var P8={passive:!1},F2={capture:!0,passive:!1};function l5(_){_.stopImmediatePropagation()}function u0(_){_.preventDefault(),_.stopImmediatePropagation()}function u2(_){var Q=_.document.documentElement,J=m1(_).on("dragstart.drag",u0,F2);if("onselectstart"in Q)J.on("selectstart.drag",u0,F2);else Q.__noselect=Q.style.MozUserSelect,Q.style.MozUserSelect="none"}function q5(_,Q){var J=_.document.documentElement,q=m1(_).on("dragstart.drag",null);if(Q)q.on("click.drag",u0,F2),setTimeout(function(){q.on("click.drag",null)},0);if("onselectstart"in J)q.on("selectstart.drag",null);else J.style.MozUserSelect=J.__noselect,delete J.__noselect}var U5=(_)=>()=>_;function G5(_,{sourceEvent:Q,subject:J,target:q,identifier:U,active:G,x:Z,y:F,dx:K,dy:Y,dispatch:X}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},subject:{value:J,enumerable:!0,configurable:!0},target:{value:q,enumerable:!0,configurable:!0},identifier:{value:U,enumerable:!0,configurable:!0},active:{value:G,enumerable:!0,configurable:!0},x:{value:Z,enumerable:!0,configurable:!0},y:{value:F,enumerable:!0,configurable:!0},dx:{value:K,enumerable:!0,configurable:!0},dy:{value:Y,enumerable:!0,configurable:!0},_:{value:X}})}G5.prototype.on=function(){var _=this._.on.apply(this._,arguments);return _===this._?this:_};function nJ(_){return!_.ctrlKey&&!_.button}function eJ(){return this.parentNode}function _$(_,Q){return Q==null?{x:_.x,y:_.y}:Q}function Q$(){return navigator.maxTouchPoints||"ontouchstart"in this}function Z5(){var _=nJ,Q=eJ,J=_$,q=Q$,U={},G=Z2("start","drag","end"),Z=0,F,K,Y,X,H=0;function L(T){T.on("mousedown.drag",W).filter(q).on("touchstart.drag",R).on("touchmove.drag",M,P8).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(T,f){if(X||!_.call(this,T,f))return;var C=B(this,Q.call(this,T,f),T,f,"mouse");if(!C)return;m1(T.view).on("mousemove.drag",A,F2).on("mouseup.drag",I,F2),u2(T.view),l5(T),Y=!1,F=T.clientX,K=T.clientY,C("start",T)}function A(T){if(u0(T),!Y){var f=T.clientX-F,C=T.clientY-K;Y=f*f+C*C>H}U.mouse("drag",T)}function I(T){m1(T.view).on("mousemove.drag mouseup.drag",null),q5(T.view,Y),u0(T),U.mouse("end",T)}function R(T,f){if(!_.call(this,T,f))return;var C=T.changedTouches,N=Q.call(this,T,f),S=C.length,w,k;for(w=0;w<S;++w)if(k=B(this,N,T,f,C[w].identifier,C[w]))l5(T),k("start",T,C[w])}function M(T){var f=T.changedTouches,C=f.length,N,S;for(N=0;N<C;++N)if(S=U[f[N].identifier])u0(T),S("drag",T,f[N])}function O(T){var f=T.changedTouches,C=f.length,N,S;if(X)clearTimeout(X);X=setTimeout(function(){X=null},500);for(N=0;N<C;++N)if(S=U[f[N].identifier])l5(T),S("end",T,f[N])}function B(T,f,C,N,S,w){var k=G.copy(),x=d1(w||C,f),r,m,v;if((v=J.call(T,new G5("beforestart",{sourceEvent:C,target:L,identifier:S,active:Z,x:x[0],y:x[1],dx:0,dy:0,dispatch:k}),N))==null)return;return r=v.x-x[0]||0,m=v.y-x[1]||0,function D(V,E,u){var b=x,P;switch(V){case"start":U[S]=D,P=Z++;break;case"end":delete U[S],--Z;case"drag":x=d1(u||E,f),P=Z;break}k.call(V,T,new G5(V,{sourceEvent:E,subject:v,target:L,identifier:S,active:P,x:x[0]+r,y:x[1]+m,dx:x[0]-b[0],dy:x[1]-b[1],dispatch:k}),N)}}return L.filter=function(T){return arguments.length?(_=typeof T==="function"?T:U5(!!T),L):_},L.container=function(T){return arguments.length?(Q=typeof T==="function"?T:U5(T),L):Q},L.subject=function(T){return arguments.length?(J=typeof T==="function"?T:U5(T),L):J},L.touchable=function(T){return arguments.length?(q=typeof T==="function"?T:U5(!!T),L):q},L.on=function(){var T=G.on.apply(G,arguments);return T===G?L:T},L.clickDistance=function(T){return arguments.length?(H=(T=+T)*T,L):Math.sqrt(H)},L}function F5(_,Q,J){_.prototype=Q.prototype=J,J.constructor=_}function C3(_,Q){var J=Object.create(_.prototype);for(var q in Q)J[q]=Q[q];return J}function X5(){}var H5=0.7,d5=1/H5,h2="\\s*([+-]?\\d+)\\s*",K5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",P0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",J$=/^#([0-9a-f]{3,8})$/,$$=new RegExp(`^rgb\\(${h2},${h2},${h2}\\)$`),q$=new RegExp(`^rgb\\(${P0},${P0},${P0}\\)$`),U$=new RegExp(`^rgba\\(${h2},${h2},${h2},${K5}\\)$`),G$=new RegExp(`^rgba\\(${P0},${P0},${P0},${K5}\\)$`),Z$=new RegExp(`^hsl\\(${K5},${P0},${P0}\\)$`),F$=new RegExp(`^hsla\\(${K5},${P0},${P0},${K5}\\)$`),w8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};F5(X5,A0,{copy(_){return Object.assign(new this.constructor,this,_)},displayable(){return this.rgb().displayable()},hex:f8,formatHex:f8,formatHex8:H$,formatHsl:K$,formatRgb:N8,toString:N8});function f8(){return this.rgb().formatHex()}function H$(){return this.rgb().formatHex8()}function K$(){return j8(this).formatHsl()}function N8(){return this.rgb().formatRgb()}function A0(_){var Q,J;return _=(_+"").trim().toLowerCase(),(Q=J$.exec(_))?(J=Q[1].length,Q=parseInt(Q[1],16),J===6?C8(Q):J===3?new $0(Q>>8&15|Q>>4&240,Q>>4&15|Q&240,(Q&15)<<4|Q&15,1):J===8?i5(Q>>24&255,Q>>16&255,Q>>8&255,(Q&255)/255):J===4?i5(Q>>12&15|Q>>8&240,Q>>8&15|Q>>4&240,Q>>4&15|Q&240,((Q&15)<<4|Q&15)/255):null):(Q=$$.exec(_))?new $0(Q[1],Q[2],Q[3],1):(Q=q$.exec(_))?new $0(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,1):(Q=U$.exec(_))?i5(Q[1],Q[2],Q[3],Q[4]):(Q=G$.exec(_))?i5(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,Q[4]):(Q=Z$.exec(_))?y8(Q[1],Q[2]/100,Q[3]/100,1):(Q=F$.exec(_))?y8(Q[1],Q[2]/100,Q[3]/100,Q[4]):w8.hasOwnProperty(_)?C8(w8[_]):_==="transparent"?new $0(NaN,NaN,NaN,0):null}function C8(_){return new $0(_>>16&255,_>>8&255,_&255,1)}function i5(_,Q,J,q){if(q<=0)_=Q=J=NaN;return new $0(_,Q,J,q)}function X$(_){if(!(_ instanceof X5))_=A0(_);if(!_)return new $0;return _=_.rgb(),new $0(_.r,_.g,_.b,_.opacity)}function D2(_,Q,J,q){return arguments.length===1?X$(_):new $0(_,Q,J,q==null?1:q)}function $0(_,Q,J,q){this.r=+_,this.g=+Q,this.b=+J,this.opacity=+q}F5($0,D2,C3(X5,{brighter(_){return _=_==null?d5:Math.pow(d5,_),new $0(this.r*_,this.g*_,this.b*_,this.opacity)},darker(_){return _=_==null?H5:Math.pow(H5,_),new $0(this.r*_,this.g*_,this.b*_,this.opacity)},rgb(){return this},clamp(){return new $0(K2(this.r),K2(this.g),K2(this.b),a5(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:S8,formatHex:S8,formatHex8:Y$,formatRgb:v8,toString:v8}));function S8(){return`#${H2(this.r)}${H2(this.g)}${H2(this.b)}`}function Y$(){return`#${H2(this.r)}${H2(this.g)}${H2(this.b)}${H2((isNaN(this.opacity)?1:this.opacity)*255)}`}function v8(){let _=a5(this.opacity);return`${_===1?"rgb(":"rgba("}${K2(this.r)}, ${K2(this.g)}, ${K2(this.b)}${_===1?")":`, ${_})`}`}function a5(_){return isNaN(_)?1:Math.max(0,Math.min(1,_))}function K2(_){return Math.max(0,Math.min(255,Math.round(_)||0))}function H2(_){return _=K2(_),(_<16?"0":"")+_.toString(16)}function y8(_,Q,J,q){if(q<=0)_=Q=J=NaN;else if(J<=0||J>=1)_=Q=NaN;else if(Q<=0)_=NaN;return new W0(_,Q,J,q)}function j8(_){if(_ instanceof W0)return new W0(_.h,_.s,_.l,_.opacity);if(!(_ instanceof X5))_=A0(_);if(!_)return new W0;if(_ instanceof W0)return _;_=_.rgb();var Q=_.r/255,J=_.g/255,q=_.b/255,U=Math.min(Q,J,q),G=Math.max(Q,J,q),Z=NaN,F=G-U,K=(G+U)/2;if(F){if(Q===G)Z=(J-q)/F+(J<q)*6;else if(J===G)Z=(q-Q)/F+2;else Z=(Q-J)/F+4;F/=K<0.5?G+U:2-G-U,Z*=60}else F=K>0&&K<1?0:Z;return new W0(Z,F,K,_.opacity)}function V8(_,Q,J,q){return arguments.length===1?j8(_):new W0(_,Q,J,q==null?1:q)}function W0(_,Q,J,q){this.h=+_,this.s=+Q,this.l=+J,this.opacity=+q}F5(W0,V8,C3(X5,{brighter(_){return _=_==null?d5:Math.pow(d5,_),new W0(this.h,this.s,this.l*_,this.opacity)},darker(_){return _=_==null?H5:Math.pow(H5,_),new W0(this.h,this.s,this.l*_,this.opacity)},rgb(){var _=this.h%360+(this.h<0)*360,Q=isNaN(_)||isNaN(this.s)?0:this.s,J=this.l,q=J+(J<0.5?J:1-J)*Q,U=2*J-q;return new $0(S3(_>=240?_-240:_+120,U,q),S3(_,U,q),S3(_<120?_+240:_-120,U,q),this.opacity)},clamp(){return new W0(k8(this.h),r5(this.s),r5(this.l),a5(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let _=a5(this.opacity);return`${_===1?"hsl(":"hsla("}${k8(this.h)}, ${r5(this.s)*100}%, ${r5(this.l)*100}%${_===1?")":`, ${_})`}`}}));function k8(_){return _=(_||0)%360,_<0?_+360:_}function r5(_){return Math.max(0,Math.min(1,_||0))}function S3(_,Q,J){return(_<60?Q+(J-Q)*_/60:_<180?J:_<240?Q+(J-Q)*(240-_)/60:Q)*255}function v3(_,Q,J,q,U){var G=_*_,Z=G*_;return((1-3*_+3*G-Z)*Q+(4-6*G+3*Z)*J+(1+3*_+3*G-3*Z)*q+Z*U)/6}function y3(_){var Q=_.length-1;return function(J){var q=J<=0?J=0:J>=1?(J=1,Q-1):Math.floor(J*Q),U=_[q],G=_[q+1],Z=q>0?_[q-1]:2*U-G,F=q<Q-1?_[q+2]:2*G-U;return v3((J-q/Q)*Q,Z,U,G,F)}}function k3(_){var Q=_.length;return function(J){var q=Math.floor(((J%=1)<0?++J:J)*Q),U=_[(q+Q-1)%Q],G=_[q%Q],Z=_[(q+1)%Q],F=_[(q+2)%Q];return v3((J-q/Q)*Q,U,G,Z,F)}}var Y5=(_)=>()=>_;function L$(_,Q){return function(J){return _+J*Q}}function z$(_,Q,J){return _=Math.pow(_,J),Q=Math.pow(Q,J)-_,J=1/J,function(q){return Math.pow(_+q*Q,J)}}function u8(_){return(_=+_)===1?s5:function(Q,J){return J-Q?z$(Q,J,_):Y5(isNaN(Q)?J:Q)}}function s5(_,Q){var J=Q-_;return J?L$(_,J):Y5(isNaN(_)?Q:_)}var X2=function _(Q){var J=u8(Q);function q(U,G){var Z=J((U=D2(U)).r,(G=D2(G)).r),F=J(U.g,G.g),K=J(U.b,G.b),Y=s5(U.opacity,G.opacity);return function(X){return U.r=Z(X),U.g=F(X),U.b=K(X),U.opacity=Y(X),U+""}}return q.gamma=_,q}(1);function h8(_){return function(Q){var J=Q.length,q=Array(J),U=Array(J),G=Array(J),Z,F;for(Z=0;Z<J;++Z)F=D2(Q[Z]),q[Z]=F.r||0,U[Z]=F.g||0,G[Z]=F.b||0;return q=_(q),U=_(U),G=_(G),F.opacity=1,function(K){return F.r=q(K),F.g=U(K),F.b=G(K),F+""}}}var W$=h8(y3),A$=h8(k3);function j3(_,Q){if(!Q)Q=[];var J=_?Math.min(Q.length,_.length):0,q=Q.slice(),U;return function(G){for(U=0;U<J;++U)q[U]=_[U]*(1-G)+Q[U]*G;return q}}function D8(_){return ArrayBuffer.isView(_)&&!(_ instanceof DataView)}function b8(_,Q){var J=Q?Q.length:0,q=_?Math.min(J,_.length):0,U=Array(q),G=Array(J),Z;for(Z=0;Z<q;++Z)U[Z]=w0(_[Z],Q[Z]);for(;Z<J;++Z)G[Z]=Q[Z];return function(F){for(Z=0;Z<q;++Z)G[Z]=U[Z](F);return G}}function V3(_,Q){var J=new Date;return _=+_,Q=+Q,function(q){return J.setTime(_*(1-q)+Q*q),J}}function a1(_,Q){return _=+_,Q=+Q,function(J){return _*(1-J)+Q*J}}function u3(_,Q){var J={},q={},U;if(_===null||typeof _!=="object")_={};if(Q===null||typeof Q!=="object")Q={};for(U in Q)if(U in _)J[U]=w0(_[U],Q[U]);else q[U]=Q[U];return function(G){for(U in J)q[U]=J[U](G);return q}}var D3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,h3=new RegExp(D3.source,"g");function B$(_){return function(){return _}}function M$(_){return function(Q){return _(Q)+""}}function b2(_,Q){var J=D3.lastIndex=h3.lastIndex=0,q,U,G,Z=-1,F=[],K=[];_=_+"",Q=Q+"";while((q=D3.exec(_))&&(U=h3.exec(Q))){if((G=U.index)>J)if(G=Q.slice(J,G),F[Z])F[Z]+=G;else F[++Z]=G;if((q=q[0])===(U=U[0]))if(F[Z])F[Z]+=U;else F[++Z]=U;else F[++Z]=null,K.push({i:Z,x:a1(q,U)});J=h3.lastIndex}if(J<Q.length)if(G=Q.slice(J),F[Z])F[Z]+=G;else F[++Z]=G;return F.length<2?K[0]?M$(K[0].x):B$(Q):(Q=K.length,function(Y){for(var X=0,H;X<Q;++X)F[(H=K[X]).i]=H.x(Y);return F.join("")})}function w0(_,Q){var J=typeof Q,q;return Q==null||J==="boolean"?Y5(Q):(J==="number"?a1:J==="string"?(q=A0(Q))?(Q=q,X2):b2:Q instanceof A0?X2:Q instanceof Date?V3:D8(Q)?j3:Array.isArray(Q)?b8:typeof Q.valueOf!=="function"&&typeof Q.toString!=="function"||isNaN(Q)?u3:a1)(_,Q)}var E8=180/Math.PI,t5={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function o5(_,Q,J,q,U,G){var Z,F,K;if(Z=Math.sqrt(_*_+Q*Q))_/=Z,Q/=Z;if(K=_*J+Q*q)J-=_*K,q-=Q*K;if(F=Math.sqrt(J*J+q*q))J/=F,q/=F,K/=F;if(_*q<Q*J)_=-_,Q=-Q,K=-K,Z=-Z;return{translateX:U,translateY:G,rotate:Math.atan2(Q,_)*E8,skewX:Math.atan(K)*E8,scaleX:Z,scaleY:F}}var n5;function x8(_){let Q=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(_+"");return Q.isIdentity?t5:o5(Q.a,Q.b,Q.c,Q.d,Q.e,Q.f)}function m8(_){if(_==null)return t5;if(!n5)n5=document.createElementNS("http://www.w3.org/2000/svg","g");if(n5.setAttribute("transform",_),!(_=n5.transform.baseVal.consolidate()))return t5;return _=_.matrix,o5(_.a,_.b,_.c,_.d,_.e,_.f)}function g8(_,Q,J,q){function U(Y){return Y.length?Y.pop()+" ":""}function G(Y,X,H,L,W,A){if(Y!==H||X!==L){var I=W.push("translate(",null,Q,null,J);A.push({i:I-4,x:a1(Y,H)},{i:I-2,x:a1(X,L)})}else if(H||L)W.push("translate("+H+Q+L+J)}function Z(Y,X,H,L){if(Y!==X){if(Y-X>180)X+=360;else if(X-Y>180)Y+=360;L.push({i:H.push(U(H)+"rotate(",null,q)-2,x:a1(Y,X)})}else if(X)H.push(U(H)+"rotate("+X+q)}function F(Y,X,H,L){if(Y!==X)L.push({i:H.push(U(H)+"skewX(",null,q)-2,x:a1(Y,X)});else if(X)H.push(U(H)+"skewX("+X+q)}function K(Y,X,H,L,W,A){if(Y!==H||X!==L){var I=W.push(U(W)+"scale(",null,",",null,")");A.push({i:I-4,x:a1(Y,H)},{i:I-2,x:a1(X,L)})}else if(H!==1||L!==1)W.push(U(W)+"scale("+H+","+L+")")}return function(Y,X){var H=[],L=[];return Y=_(Y),X=_(X),G(Y.translateX,Y.translateY,X.translateX,X.translateY,H,L),Z(Y.rotate,X.rotate,H,L),F(Y.skewX,X.skewX,H,L),K(Y.scaleX,Y.scaleY,X.scaleX,X.scaleY,H,L),Y=X=null,function(W){var A=-1,I=L.length,R;while(++A<I)H[(R=L[A]).i]=R.x(W);return H.join("")}}}var b3=g8(x8,"px, ","px)","deg)"),E3=g8(m8,", ",")",")");var T$=0.000000000001;function p8(_){return((_=Math.exp(_))+1/_)/2}function R$(_){return((_=Math.exp(_))-1/_)/2}function O$(_){return((_=Math.exp(2*_))-1)/(_+1)}var Y2=function _(Q,J,q){function U(G,Z){var F=G[0],K=G[1],Y=G[2],X=Z[0],H=Z[1],L=Z[2],W=X-F,A=H-K,I=W*W+A*A,R,M;if(I<T$)M=Math.log(L/Y)/Q,R=function(N){return[F+N*W,K+N*A,Y*Math.exp(Q*N*M)]};else{var O=Math.sqrt(I),B=(L*L-Y*Y+q*I)/(2*Y*J*O),T=(L*L-Y*Y-q*I)/(2*L*J*O),f=Math.log(Math.sqrt(B*B+1)-B),C=Math.log(Math.sqrt(T*T+1)-T);M=(C-f)/Q,R=function(N){var S=N*M,w=p8(f),k=Y/(J*O)*(w*O$(Q*S+f)-R$(f));return[F+k*W,K+k*A,Y*w/p8(Q*S+f)]}}return R.duration=M*1000*Q/Math.SQRT2,R}return U.rho=function(G){var Z=Math.max(0.001,+G),F=Z*Z,K=F*F;return _(Z,F,K)},U}(Math.SQRT2,2,4);var E2=0,z5=0,L5=0,l8=1000,e5,W5,_4=0,L2=0,Q4=0,A5=typeof performance==="object"&&performance.now?performance:Date,i8=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(_){setTimeout(_,17)};function M5(){return L2||(i8(I$),L2=A5.now()+Q4)}function I$(){L2=0}function B5(){this._call=this._time=this._next=null}B5.prototype=J4.prototype={constructor:B5,restart:function(_,Q,J){if(typeof _!=="function")throw TypeError("callback is not a function");if(J=(J==null?M5():+J)+(Q==null?0:+Q),!this._next&&W5!==this){if(W5)W5._next=this;else e5=this;W5=this}this._call=_,this._time=J,x3()},stop:function(){if(this._call)this._call=null,this._time=1/0,x3()}};function J4(_,Q,J){var q=new B5;return q.restart(_,Q,J),q}function r8(){M5(),++E2;var _=e5,Q;while(_){if((Q=L2-_._time)>=0)_._call.call(void 0,Q);_=_._next}--E2}function c8(){L2=(_4=A5.now())+Q4,E2=z5=0;try{r8()}finally{E2=0,w$(),L2=0}}function P$(){var _=A5.now(),Q=_-_4;if(Q>l8)Q4-=Q,_4=_}function w$(){var _,Q=e5,J,q=1/0;while(Q)if(Q._call){if(q>Q._time)q=Q._time;_=Q,Q=Q._next}else J=Q._next,Q._next=null,Q=_?_._next=J:e5=J;W5=_,x3(q)}function x3(_){if(E2)return;if(z5)z5=clearTimeout(z5);var Q=_-L2;if(Q>24){if(_<1/0)z5=setTimeout(c8,_-A5.now()-Q4);if(L5)L5=clearInterval(L5)}else{if(!L5)_4=A5.now(),L5=setInterval(P$,l8);E2=1,i8(c8)}}function T5(_,Q,J){var q=new B5;return Q=Q==null?0:+Q,q.restart((U)=>{q.stop(),_(U+Q)},Q,J),q}var f$=Z2("start","end","cancel","interrupt"),N$=[],s8=0,d8=1,q4=2,$4=3,a8=4,U4=5,R5=6;function h0(_,Q,J,q,U,G){var Z=_.__transition;if(!Z)_.__transition={};else if(J in Z)return;C$(_,J,{name:Q,index:q,group:U,on:f$,tween:N$,time:G.time,delay:G.delay,duration:G.duration,ease:G.ease,timer:null,state:s8})}function O5(_,Q){var J=g1(_,Q);if(J.state>s8)throw Error("too late; already scheduled");return J}function r1(_,Q){var J=g1(_,Q);if(J.state>$4)throw Error("too late; already running");return J}function g1(_,Q){var J=_.__transition;if(!J||!(J=J[Q]))throw Error("transition not found");return J}function C$(_,Q,J){var q=_.__transition,U;q[Q]=J,J.timer=J4(G,0,J.time);function G(Y){if(J.state=d8,J.timer.restart(Z,J.delay,J.time),J.delay<=Y)Z(Y-J.delay)}function Z(Y){var X,H,L,W;if(J.state!==d8)return K();for(X in q){if(W=q[X],W.name!==J.name)continue;if(W.state===$4)return T5(Z);if(W.state===a8)W.state=R5,W.timer.stop(),W.on.call("interrupt",_,_.__data__,W.index,W.group),delete q[X];else if(+X<Q)W.state=R5,W.timer.stop(),W.on.call("cancel",_,_.__data__,W.index,W.group),delete q[X]}if(T5(function(){if(J.state===$4)J.state=a8,J.timer.restart(F,J.delay,J.time),F(Y)}),J.state=q4,J.on.call("start",_,_.__data__,J.index,J.group),J.state!==q4)return;J.state=$4,U=Array(L=J.tween.length);for(X=0,H=-1;X<L;++X)if(W=J.tween[X].value.call(_,_.__data__,J.index,J.group))U[++H]=W;U.length=H+1}function F(Y){var X=Y<J.duration?J.ease.call(null,Y/J.duration):(J.timer.restart(K),J.state=U4,1),H=-1,L=U.length;while(++H<L)U[H].call(_,X);if(J.state===U4)J.on.call("end",_,_.__data__,J.index,J.group),K()}function K(){J.state=R5,J.timer.stop(),delete q[Q];for(var Y in q)return;delete _.__transition}}function s0(_,Q){var J=_.__transition,q,U,G=!0,Z;if(!J)return;Q=Q==null?null:Q+"";for(Z in J){if((q=J[Z]).name!==Q){G=!1;continue}U=q.state>q4&&q.state<U4,q.state=R5,q.timer.stop(),q.on.call(U?"interrupt":"cancel",_,_.__data__,q.index,q.group),delete J[Z]}if(G)delete _.__transition}function m3(_){return this.each(function(){s0(this,_)})}function S$(_,Q){var J,q;return function(){var U=r1(this,_),G=U.tween;if(G!==J){q=J=G;for(var Z=0,F=q.length;Z<F;++Z)if(q[Z].name===Q){q=q.slice(),q.splice(Z,1);break}}U.tween=q}}function v$(_,Q,J){var q,U;if(typeof J!=="function")throw Error();return function(){var G=r1(this,_),Z=G.tween;if(Z!==q){U=(q=Z).slice();for(var F={name:Q,value:J},K=0,Y=U.length;K<Y;++K)if(U[K].name===Q){U[K]=F;break}if(K===Y)U.push(F)}G.tween=U}}function g3(_,Q){var J=this._id;if(_+="",arguments.length<2){var q=g1(this.node(),J).tween;for(var U=0,G=q.length,Z;U<G;++U)if((Z=q[U]).name===_)return Z.value;return null}return this.each((Q==null?S$:v$)(J,_,Q))}function x2(_,Q,J){var q=_._id;return _.each(function(){var U=r1(this,q);(U.value||(U.value={}))[Q]=J.apply(this,arguments)}),function(U){return g1(U,q).value[Q]}}function I5(_,Q){var J;return(typeof Q==="number"?a1:Q instanceof A0?X2:(J=A0(Q))?(Q=J,X2):b2)(_,Q)}function y$(_){return function(){this.removeAttribute(_)}}function k$(_){return function(){this.removeAttributeNS(_.space,_.local)}}function j$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttribute(_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function V$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttributeNS(_.space,_.local);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function u$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),K;if(F==null)return void this.removeAttribute(_);return Z=this.getAttribute(_),K=F+"",Z===K?null:Z===q&&K===U?G:(U=K,G=Q(q=Z,F))}}function h$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),K;if(F==null)return void this.removeAttributeNS(_.space,_.local);return Z=this.getAttributeNS(_.space,_.local),K=F+"",Z===K?null:Z===q&&K===U?G:(U=K,G=Q(q=Z,F))}}function p3(_,Q){var J=I0(_),q=J==="transform"?E3:I5;return this.attrTween(_,typeof Q==="function"?(J.local?h$:u$)(J,q,x2(this,"attr."+_,Q)):Q==null?(J.local?k$:y$)(J):(J.local?V$:j$)(J,q,Q))}function D$(_,Q){return function(J){this.setAttribute(_,Q.call(this,J))}}function b$(_,Q){return function(J){this.setAttributeNS(_.space,_.local,Q.call(this,J))}}function E$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&b$(_,G);return J}return U._value=Q,U}function x$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&D$(_,G);return J}return U._value=Q,U}function c3(_,Q){var J="attr."+_;if(arguments.length<2)return(J=this.tween(J))&&J._value;if(Q==null)return this.tween(J,null);if(typeof Q!=="function")throw Error();var q=I0(_);return this.tween(J,(q.local?E$:x$)(q,Q))}function m$(_,Q){return function(){O5(this,_).delay=+Q.apply(this,arguments)}}function g$(_,Q){return Q=+Q,function(){O5(this,_).delay=Q}}function l3(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?m$:g$)(Q,_)):g1(this.node(),Q).delay}function p$(_,Q){return function(){r1(this,_).duration=+Q.apply(this,arguments)}}function c$(_,Q){return Q=+Q,function(){r1(this,_).duration=Q}}function i3(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?p$:c$)(Q,_)):g1(this.node(),Q).duration}function l$(_,Q){if(typeof Q!=="function")throw Error();return function(){r1(this,_).ease=Q}}function r3(_){var Q=this._id;return arguments.length?this.each(l$(Q,_)):g1(this.node(),Q).ease}function i$(_,Q){return function(){var J=Q.apply(this,arguments);if(typeof J!=="function")throw Error();r1(this,_).ease=J}}function d3(_){if(typeof _!=="function")throw Error();return this.each(i$(this._id,_))}function a3(_){if(typeof _!=="function")_=j2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],K,Y=0;Y<Z;++Y)if((K=G[Y])&&_.call(K,K.__data__,Y,G))F.push(K);return new e1(q,this._parents,this._name,this._id)}function s3(_){if(_._id!==this._id)throw Error();for(var Q=this._groups,J=_._groups,q=Q.length,U=J.length,G=Math.min(q,U),Z=Array(q),F=0;F<G;++F)for(var K=Q[F],Y=J[F],X=K.length,H=Z[F]=Array(X),L,W=0;W<X;++W)if(L=K[W]||Y[W])H[W]=L;for(;F<q;++F)Z[F]=Q[F];return new e1(Z,this._parents,this._name,this._id)}function r$(_){return(_+"").trim().split(/^|\s+/).every(function(Q){var J=Q.indexOf(".");if(J>=0)Q=Q.slice(0,J);return!Q||Q==="start"})}function d$(_,Q,J){var q,U,G=r$(Q)?O5:r1;return function(){var Z=G(this,_),F=Z.on;if(F!==q)(U=(q=F).copy()).on(Q,J);Z.on=U}}function t3(_,Q){var J=this._id;return arguments.length<2?g1(this.node(),J).on.on(_):this.each(d$(J,_,Q))}function a$(_){return function(){var Q=this.parentNode;for(var J in this.__transition)if(+J!==_)return;if(Q)Q.removeChild(this)}}function o3(){return this.on("end.remove",a$(this._id))}function n3(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=d0(_);for(var q=this._groups,U=q.length,G=Array(U),Z=0;Z<U;++Z)for(var F=q[Z],K=F.length,Y=G[Z]=Array(K),X,H,L=0;L<K;++L)if((X=F[L])&&(H=_.call(X,X.__data__,L,F))){if("__data__"in X)H.__data__=X.__data__;Y[L]=H,h0(Y[L],Q,J,L,Y,g1(X,J))}return new e1(G,this._parents,Q,J)}function e3(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=V2(_);for(var q=this._groups,U=q.length,G=[],Z=[],F=0;F<U;++F)for(var K=q[F],Y=K.length,X,H=0;H<Y;++H)if(X=K[H]){for(var L=_.call(X,X.__data__,H,K),W,A=g1(X,J),I=0,R=L.length;I<R;++I)if(W=L[I])h0(W,Q,J,I,L,A);G.push(L),Z.push(X)}return new e1(G,Z,Q,J)}var s$=V0.prototype.constructor;function _6(){return new s$(this._groups,this._parents)}function t$(_,Q){var J,q,U;return function(){var G=a0(this,_),Z=(this.style.removeProperty(_),a0(this,_));return G===Z?null:G===J&&Z===q?U:U=Q(J=G,q=Z)}}function t8(_){return function(){this.style.removeProperty(_)}}function o$(_,Q,J){var q,U=J+"",G;return function(){var Z=a0(this,_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function n$(_,Q,J){var q,U,G;return function(){var Z=a0(this,_),F=J(this),K=F+"";if(F==null)K=F=(this.style.removeProperty(_),a0(this,_));return Z===K?null:Z===q&&K===U?G:(U=K,G=Q(q=Z,F))}}function e$(_,Q){var J,q,U,G="style."+Q,Z="end."+G,F;return function(){var K=r1(this,_),Y=K.on,X=K.value[G]==null?F||(F=t8(Q)):void 0;if(Y!==J||U!==X)(q=(J=Y).copy()).on(Z,U=X);K.on=q}}function Q6(_,Q,J){var q=(_+="")==="transform"?b3:I5;return Q==null?this.styleTween(_,t$(_,q)).on("end.style."+_,t8(_)):typeof Q==="function"?this.styleTween(_,n$(_,q,x2(this,"style."+_,Q))).each(e$(this._id,_)):this.styleTween(_,o$(_,q,Q),J).on("end.style."+_,null)}function _q(_,Q,J){return function(q){this.style.setProperty(_,Q.call(this,q),J)}}function Qq(_,Q,J){var q,U;function G(){var Z=Q.apply(this,arguments);if(Z!==U)q=(U=Z)&&_q(_,Z,J);return q}return G._value=Q,G}function J6(_,Q,J){var q="style."+(_+="");if(arguments.length<2)return(q=this.tween(q))&&q._value;if(Q==null)return this.tween(q,null);if(typeof Q!=="function")throw Error();return this.tween(q,Qq(_,Q,J==null?"":J))}function Jq(_){return function(){this.textContent=_}}function $q(_){return function(){var Q=_(this);this.textContent=Q==null?"":Q}}function $6(_){return this.tween("text",typeof _==="function"?$q(x2(this,"text",_)):Jq(_==null?"":_+""))}function qq(_){return function(Q){this.textContent=_.call(this,Q)}}function Uq(_){var Q,J;function q(){var U=_.apply(this,arguments);if(U!==J)Q=(J=U)&&qq(U);return Q}return q._value=_,q}function q6(_){var Q="text";if(arguments.length<1)return(Q=this.tween(Q))&&Q._value;if(_==null)return this.tween(Q,null);if(typeof _!=="function")throw Error();return this.tween(Q,Uq(_))}function U6(){var _=this._name,Q=this._id,J=G4();for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,K,Y=0;Y<F;++Y)if(K=Z[Y]){var X=g1(K,Q);h0(K,_,J,Y,Z,{time:X.time+X.delay+X.duration,delay:0,duration:X.duration,ease:X.ease})}return new e1(q,this._parents,_,J)}function G6(){var _,Q,J=this,q=J._id,U=J.size();return new Promise(function(G,Z){var F={value:Z},K={value:function(){if(--U===0)G()}};if(J.each(function(){var Y=r1(this,q),X=Y.on;if(X!==_)Q=(_=X).copy(),Q._.cancel.push(F),Q._.interrupt.push(F),Q._.end.push(K);Y.on=Q}),U===0)G()})}var Gq=0;function e1(_,Q,J,q){this._groups=_,this._parents=Q,this._name=J,this._id=q}function o8(_){return V0().transition(_)}function G4(){return++Gq}var D0=V0.prototype;e1.prototype=o8.prototype={constructor:e1,select:n3,selectAll:e3,selectChild:D0.selectChild,selectChildren:D0.selectChildren,filter:a3,merge:s3,selection:_6,transition:U6,call:D0.call,nodes:D0.nodes,node:D0.node,size:D0.size,empty:D0.empty,each:D0.each,on:t3,attr:p3,attrTween:c3,style:Q6,styleTween:J6,text:$6,textTween:q6,remove:o3,tween:g3,delay:l3,duration:i3,ease:r3,easeVarying:d3,end:G6,[Symbol.iterator]:D0[Symbol.iterator]};function Z4(_){return((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2}var Zq={time:null,delay:0,duration:250,ease:Z4};function Fq(_,Q){var J;while(!(J=_.__transition)||!(J=J[Q]))if(!(_=_.parentNode))throw Error(`transition ${Q} not found`);return J}function Z6(_){var Q,J;if(_ instanceof e1)Q=_._id,_=_._name;else Q=G4(),(J=Zq).time=M5(),_=_==null?null:_+"";for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,K,Y=0;Y<F;++Y)if(K=Z[Y])h0(K,_,Q,Y,Z,J||Fq(K,Q));return new e1(q,this._parents,_,Q)}V0.prototype.interrupt=m3;V0.prototype.transition=Z6;var P5=(_)=>()=>_;function F6(_,{sourceEvent:Q,target:J,transform:q,dispatch:U}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},target:{value:J,enumerable:!0,configurable:!0},transform:{value:q,enumerable:!0,configurable:!0},_:{value:U}})}function B0(_,Q,J){this.k=_,this.x=Q,this.y=J}B0.prototype={constructor:B0,scale:function(_){return _===1?this:new B0(this.k*_,this.x,this.y)},translate:function(_,Q){return _===0&Q===0?this:new B0(this.k,this.x+this.k*_,this.y+this.k*Q)},apply:function(_){return[_[0]*this.k+this.x,_[1]*this.k+this.y]},applyX:function(_){return _*this.k+this.x},applyY:function(_){return _*this.k+this.y},invert:function(_){return[(_[0]-this.x)/this.k,(_[1]-this.y)/this.k]},invertX:function(_){return(_-this.x)/this.k},invertY:function(_){return(_-this.y)/this.k},rescaleX:function(_){return _.copy().domain(_.range().map(this.invertX,this).map(_.invert,_))},rescaleY:function(_){return _.copy().domain(_.range().map(this.invertY,this).map(_.invert,_))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var z2=new B0(1,0,0);w5.prototype=B0.prototype;function w5(_){while(!_.__zoom)if(!(_=_.parentNode))return z2;return _.__zoom}function F4(_){_.stopImmediatePropagation()}function W2(_){_.preventDefault(),_.stopImmediatePropagation()}function Hq(_){return(!_.ctrlKey||_.type==="wheel")&&!_.button}function Kq(){var _=this;if(_ instanceof SVGElement){if(_=_.ownerSVGElement||_,_.hasAttribute("viewBox"))return _=_.viewBox.baseVal,[[_.x,_.y],[_.x+_.width,_.y+_.height]];return[[0,0],[_.width.baseVal.value,_.height.baseVal.value]]}return[[0,0],[_.clientWidth,_.clientHeight]]}function n8(){return this.__zoom||z2}function Xq(_){return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*(_.ctrlKey?10:1)}function Yq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lq(_,Q,J){var q=_.invertX(Q[0][0])-J[0][0],U=_.invertX(Q[1][0])-J[1][0],G=_.invertY(Q[0][1])-J[0][1],Z=_.invertY(Q[1][1])-J[1][1];return _.translate(U>q?(q+U)/2:Math.min(0,q)||Math.max(0,U),Z>G?(G+Z)/2:Math.min(0,G)||Math.max(0,Z))}function f5(){var _=Hq,Q=Kq,J=Lq,q=Xq,U=Yq,G=[0,1/0],Z=[[-1/0,-1/0],[1/0,1/0]],F=250,K=Y2,Y=Z2("start","zoom","end"),X,H,L,W=500,A=150,I=0,R=10;function M(v){v.property("__zoom",n8).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",k).filter(U).on("touchstart.zoom",x).on("touchmove.zoom",r).on("touchend.zoom touchcancel.zoom",m).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}M.transform=function(v,D,V,E){var u=v.selection?v.selection():v;if(u.property("__zoom",n8),v!==u)f(v,D,V,E);else u.interrupt().each(function(){C(this,arguments).event(E).start().zoom(null,typeof D==="function"?D.apply(this,arguments):D).end()})},M.scaleBy=function(v,D,V,E){M.scaleTo(v,function(){var u=this.__zoom.k,b=typeof D==="function"?D.apply(this,arguments):D;return u*b},V,E)},M.scaleTo=function(v,D,V,E){M.transform(v,function(){var u=Q.apply(this,arguments),b=this.__zoom,P=V==null?T(u):typeof V==="function"?V.apply(this,arguments):V,y=b.invert(P),p=typeof D==="function"?D.apply(this,arguments):D;return J(B(O(b,p),P,y),u,Z)},V,E)},M.translateBy=function(v,D,V,E){M.transform(v,function(){return J(this.__zoom.translate(typeof D==="function"?D.apply(this,arguments):D,typeof V==="function"?V.apply(this,arguments):V),Q.apply(this,arguments),Z)},null,E)},M.translateTo=function(v,D,V,E,u){M.transform(v,function(){var b=Q.apply(this,arguments),P=this.__zoom,y=E==null?T(b):typeof E==="function"?E.apply(this,arguments):E;return J(z2.translate(y[0],y[1]).scale(P.k).translate(typeof D==="function"?-D.apply(this,arguments):-D,typeof V==="function"?-V.apply(this,arguments):-V),b,Z)},E,u)};function O(v,D){return D=Math.max(G[0],Math.min(G[1],D)),D===v.k?v:new B0(D,v.x,v.y)}function B(v,D,V){var E=D[0]-V[0]*v.k,u=D[1]-V[1]*v.k;return E===v.x&&u===v.y?v:new B0(v.k,E,u)}function T(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function f(v,D,V,E){v.on("start.zoom",function(){C(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(E).end()}).tween("zoom",function(){var u=this,b=arguments,P=C(u,b).event(E),y=Q.apply(u,b),p=V==null?T(y):typeof V==="function"?V.apply(u,b):V,h=Math.max(y[1][0]-y[0][0],y[1][1]-y[0][1]),e=u.__zoom,t=typeof D==="function"?D.apply(u,b):D,o=K(e.invert(p).concat(h/e.k),t.invert(p).concat(h/t.k));return function(s){if(s===1)s=t;else{var g=o(s),J1=h/g[2];s=new B0(J1,p[0]-g[0]*J1,p[1]-g[1]*J1)}P.zoom(null,s)}})}function C(v,D,V){return!V&&v.__zooming||new N(v,D)}function N(v,D){this.that=v,this.args=D,this.active=0,this.sourceEvent=null,this.extent=Q.apply(v,D),this.taps=0}N.prototype={event:function(v){if(v)this.sourceEvent=v;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(v,D){if(this.mouse&&v!=="mouse")this.mouse[1]=D.invert(this.mouse[0]);if(this.touch0&&v!=="touch")this.touch0[1]=D.invert(this.touch0[0]);if(this.touch1&&v!=="touch")this.touch1[1]=D.invert(this.touch1[0]);return this.that.__zoom=D,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(v){var D=m1(this.that).datum();Y.call(v,this.that,new F6(v,{sourceEvent:this.sourceEvent,target:M,type:v,transform:this.that.__zoom,dispatch:Y}),D)}};function S(v,...D){if(!_.apply(this,arguments))return;var V=C(this,D).event(v),E=this.__zoom,u=Math.max(G[0],Math.min(G[1],E.k*Math.pow(2,q.apply(this,arguments)))),b=d1(v);if(V.wheel){if(V.mouse[0][0]!==b[0]||V.mouse[0][1]!==b[1])V.mouse[1]=E.invert(V.mouse[0]=b);clearTimeout(V.wheel)}else if(E.k===u)return;else V.mouse=[b,E.invert(b)],s0(this),V.start();W2(v),V.wheel=setTimeout(P,A),V.zoom("mouse",J(B(O(E,u),V.mouse[0],V.mouse[1]),V.extent,Z));function P(){V.wheel=null,V.end()}}function w(v,...D){if(L||!_.apply(this,arguments))return;var V=v.currentTarget,E=C(this,D,!0).event(v),u=m1(v.view).on("mousemove.zoom",p,!0).on("mouseup.zoom",h,!0),b=d1(v,V),P=v.clientX,y=v.clientY;u2(v.view),F4(v),E.mouse=[b,this.__zoom.invert(b)],s0(this),E.start();function p(e){if(W2(e),!E.moved){var t=e.clientX-P,o=e.clientY-y;E.moved=t*t+o*o>I}E.event(e).zoom("mouse",J(B(E.that.__zoom,E.mouse[0]=d1(e,V),E.mouse[1]),E.extent,Z))}function h(e){u.on("mousemove.zoom mouseup.zoom",null),q5(e.view,E.moved),W2(e),E.event(e).end()}}function k(v,...D){if(!_.apply(this,arguments))return;var V=this.__zoom,E=d1(v.changedTouches?v.changedTouches[0]:v,this),u=V.invert(E),b=V.k*(v.shiftKey?0.5:2),P=J(B(O(V,b),E,u),Q.apply(this,D),Z);if(W2(v),F>0)m1(this).transition().duration(F).call(f,P,E,v);else m1(this).call(M.transform,P,E,v)}function x(v,...D){if(!_.apply(this,arguments))return;var V=v.touches,E=V.length,u=C(this,D,v.changedTouches.length===E).event(v),b,P,y,p;F4(v);for(P=0;P<E;++P)if(y=V[P],p=d1(y,this),p=[p,this.__zoom.invert(p),y.identifier],!u.touch0)u.touch0=p,b=!0,u.taps=1+!!X;else if(!u.touch1&&u.touch0[2]!==p[2])u.touch1=p,u.taps=0;if(X)X=clearTimeout(X);if(b){if(u.taps<2)H=p[0],X=setTimeout(function(){X=null},W);s0(this),u.start()}}function r(v,...D){if(!this.__zooming)return;var V=C(this,D).event(v),E=v.changedTouches,u=E.length,b,P,y,p;W2(v);for(b=0;b<u;++b)if(P=E[b],y=d1(P,this),V.touch0&&V.touch0[2]===P.identifier)V.touch0[0]=y;else if(V.touch1&&V.touch1[2]===P.identifier)V.touch1[0]=y;if(P=V.that.__zoom,V.touch1){var h=V.touch0[0],e=V.touch0[1],t=V.touch1[0],o=V.touch1[1],s=(s=t[0]-h[0])*s+(s=t[1]-h[1])*s,g=(g=o[0]-e[0])*g+(g=o[1]-e[1])*g;P=O(P,Math.sqrt(s/g)),y=[(h[0]+t[0])/2,(h[1]+t[1])/2],p=[(e[0]+o[0])/2,(e[1]+o[1])/2]}else if(V.touch0)y=V.touch0[0],p=V.touch0[1];else return;V.zoom("touch",J(B(P,y,p),V.extent,Z))}function m(v,...D){if(!this.__zooming)return;var V=C(this,D).event(v),E=v.changedTouches,u=E.length,b,P;if(F4(v),L)clearTimeout(L);L=setTimeout(function(){L=null},W);for(b=0;b<u;++b)if(P=E[b],V.touch0&&V.touch0[2]===P.identifier)delete V.touch0;else if(V.touch1&&V.touch1[2]===P.identifier)delete V.touch1;if(V.touch1&&!V.touch0)V.touch0=V.touch1,delete V.touch1;if(V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2){if(P=d1(P,this),Math.hypot(H[0]-P[0],H[1]-P[1])<R){var y=m1(this).on("dblclick.zoom");if(y)y.apply(this,arguments)}}}return M.wheelDelta=function(v){return arguments.length?(q=typeof v==="function"?v:P5(+v),M):q},M.filter=function(v){return arguments.length?(_=typeof v==="function"?v:P5(!!v),M):_},M.touchable=function(v){return arguments.length?(U=typeof v==="function"?v:P5(!!v),M):U},M.extent=function(v){return arguments.length?(Q=typeof v==="function"?v:P5([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),M):Q},M.scaleExtent=function(v){return arguments.length?(G[0]=+v[0],G[1]=+v[1],M):[G[0],G[1]]},M.translateExtent=function(v){return arguments.length?(Z[0][0]=+v[0][0],Z[1][0]=+v[1][0],Z[0][1]=+v[0][1],Z[1][1]=+v[1][1],M):[[Z[0][0],Z[0][1]],[Z[1][0],Z[1][1]]]},M.constrain=function(v){return arguments.length?(J=v,M):J},M.duration=function(v){return arguments.length?(F=+v,M):F},M.interpolate=function(v){return arguments.length?(K=v,M):K},M.on=function(){var v=Y.on.apply(Y,arguments);return v===Y?M:v},M.clickDistance=function(v){return arguments.length?(I=(v=+v)*v,M):Math.sqrt(I)},M.tapDistance=function(v){return arguments.length?(R=+v,M):R},M}var _0={error001:(_="react")=>`Seems like you have not used ${_==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${_}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:(_)=>`Node type "${_}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:(_)=>`The old edge with id=${_} does not exist.`,error009:(_)=>`Marker type "${_}" doesn't exist.`,error008:(_,{id:Q,sourceHandle:J,targetHandle:q})=>`Couldn't create edge for ${_} handle id: "${_==="source"?J:q}", edge id: ${Q}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:(_)=>`Edge type "${_}" not found. Using fallback type "default".`,error012:(_)=>`Node with id "${_}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(_="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${_}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:(_)=>`Edge with id "${_}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},c2=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],L6=["Enter"," ","Escape"],z6={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:_,x:Q,y:J})=>`Moved selected node ${_}. New position, x: ${Q}, y: ${J}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},e0;(function(_){_.Strict="strict",_.Loose="loose"})(e0||(e0={}));var b0;(function(_){_.Free="free",_.Vertical="vertical",_.Horizontal="horizontal"})(b0||(b0={}));var A2;(function(_){_.Partial="partial",_.Full="full"})(A2||(A2={}));var W6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},f0;(function(_){_.Bezier="default",_.Straight="straight",_.Step="step",_.SmoothStep="smoothstep",_.SimpleBezier="simplebezier"})(f0||(f0={}));var g2;(function(_){_.Arrow="arrow",_.ArrowClosed="arrowclosed"})(g2||(g2={}));var Z1;(function(_){_.Left="left",_.Top="top",_.Right="right",_.Bottom="bottom"})(Z1||(Z1={}));var e8={[Z1.Left]:Z1.Right,[Z1.Right]:Z1.Left,[Z1.Top]:Z1.Bottom,[Z1.Bottom]:Z1.Top},A6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("source"in _)&&("target"in _),L7=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("position"in _)&&!("source"in _)&&!("target"in _),B6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("internals"in _)&&!("source"in _)&&!("target"in _);var C5=(_,Q=[0,0])=>{let{width:J,height:q}=Y0(_),U=_.origin??Q,G=J*U[0],Z=q*U[1];return{x:_.position.x-G,y:_.position.y-Z}},M6=(_,Q={nodeOrigin:[0,0]})=>{if(!Q.nodeLookup)console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.");if(_.length===0)return{x:0,y:0,width:0,height:0};let J=!1,q=_.reduce((U,G)=>{let Z=typeof G==="string",F=!Q.nodeLookup&&!Z?G:void 0;if(Q.nodeLookup)F=Z?Q.nodeLookup.get(G):!B6(G)?Q.nodeLookup.get(G.id):G;if(!F)return U;return J=!0,z4(U,X4(F,Q.nodeOrigin))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return J?W4(q):{x:0,y:0,width:0,height:0}},R2=(_,Q={})=>{let J={x:1/0,y:1/0,x2:-1/0,y2:-1/0},q=!1;return _.forEach((U)=>{if(Q.filter===void 0||Q.filter(U))J=z4(J,X4(U)),q=!0}),q?W4(J):{x:0,y:0,width:0,height:0}},Y4=(_,Q,[J,q,U]=[0,0,1],G=!1,Z=!1)=>{let F=(Q.x-J)/U,K=(Q.y-q)/U,Y=Q.width/U,X=Q.height/U,H=[];for(let L of _.values()){let{measured:W,selectable:A=!0,hidden:I=!1}=L;if(Z&&!A||I)continue;let R=W.width??L.width??L.initialWidth??0,M=W.height??L.height??L.initialHeight??0,{x:O,y:B}=L.internals.positionAbsolute,T=M7(F,K,Y,X,O,B,R,M),f=R*M,C=G&&T>0;if(!L.internals.handleBounds||C||T>=f||L.dragging)H.push(L)}return H},z7=(_,Q)=>{let J=new Set;return _.forEach((q)=>{J.add(q.id)}),Q.filter((q)=>J.has(q.source)||J.has(q.target))};function zq(_,Q){let J=new Map,q=Q?.nodes?new Set(Q.nodes.map((U)=>U.id)):null;return _.forEach((U)=>{let G;if(Q?.includeHiddenNodes){let{width:Z,height:F}=Y0(U);G=Z>0&&F>0}else G=Boolean(U.measured.width&&U.measured.height&&!U.hidden);if(G&&(!q||q.has(U.id)))J.set(U.id,U)}),J}async function W7({nodes:_,width:Q,height:J,panZoom:q,minZoom:U,maxZoom:G},Z){if(_.size===0)return!0;let F=zq(_,Z),K=R2(F),Y=v5(K,Q,J,Z?.minZoom??U,Z?.maxZoom??G,Z?.padding??0.1);return await q.setViewport(Y,{duration:Z?.duration,ease:Z?.ease,interpolate:Z?.interpolate}),!0}function T6({nodeId:_,nextPosition:Q,nodeLookup:J,nodeOrigin:q=[0,0],nodeExtent:U,onError:G}){let Z=J.get(_),F=Z.parentId?J.get(Z.parentId):void 0,{x:K,y:Y}=F?F.internals.positionAbsolute:{x:0,y:0},X=Z.origin??q,H=Z.extent||U;if(Z.extent==="parent"&&!Z.expandParent)if(!F)G?.("005",_0.error005());else{let{width:W,height:A}=Y0(F);if(W&&A)H=[[K,Y],[K+W,Y+A]]}else if(F&&T2(Z.extent))H=[[Z.extent[0][0]+K,Z.extent[0][1]+Y],[Z.extent[1][0]+K,Z.extent[1][1]+Y]];let L=T2(H)?B2(Q,H,Z.measured):Q;if(Z.measured.width===void 0||Z.measured.height===void 0)G?.("015",_0.error015());return{position:{x:L.x-K+(Z.measured.width??0)*X[0],y:L.y-Y+(Z.measured.height??0)*X[1]},positionAbsolute:L}}async function A7({nodesToRemove:_=[],edgesToRemove:Q=[],nodes:J,edges:q,onBeforeDelete:U}){let G=new Set(_.map((L)=>L.id)),Z=[];for(let L of J){if(L.deletable===!1)continue;let W=G.has(L.id),A=!W&&L.parentId&&Z.find((I)=>I.id===L.parentId);if(W||A)Z.push(L)}let F=new Set(Q.map((L)=>L.id)),K=q.filter((L)=>L.deletable!==!1),X=z7(Z,K);for(let L of K)if(F.has(L.id)&&!X.find((A)=>A.id===L.id))X.push(L);if(!U)return{edges:X,nodes:Z};let H=await U({nodes:Z,edges:X});if(typeof H==="boolean")return H?{edges:X,nodes:Z}:{edges:[],nodes:[]};return H}var p2=(_,Q=0,J=1)=>Math.min(Math.max(_,Q),J),B2=(_={x:0,y:0},Q,J)=>({x:p2(_.x,Q[0][0],Q[1][0]-(J?.width??0)),y:p2(_.y,Q[0][1],Q[1][1]-(J?.height??0))});function B7(_,Q,J){let{width:q,height:U}=Y0(J),{x:G,y:Z}=J.internals.positionAbsolute;return B2(_,[[G,Z],[G+q,Z+U]],Q)}var _7=(_,Q,J)=>{if(_<Q)return p2(Math.abs(_-Q),1,Q)/Q;else if(_>J)return-p2(Math.abs(_-J),1,Q)/Q;return 0},L4=(_,Q,J=15,q=40)=>{let U=_7(_.x,q,Q.width-q)*J,G=_7(_.y,q,Q.height-q)*J;return[U,G]},z4=(_,Q)=>({x:Math.min(_.x,Q.x),y:Math.min(_.y,Q.y),x2:Math.max(_.x2,Q.x2),y2:Math.max(_.y2,Q.y2)}),Y6=({x:_,y:Q,width:J,height:q})=>({x:_,y:Q,x2:_+J,y2:Q+q}),W4=({x:_,y:Q,x2:J,y2:q})=>({x:_,y:Q,width:J-_,height:q-Q}),l2=(_,Q=[0,0])=>{let{x:J,y:q}=B6(_)?_.internals.positionAbsolute:C5(_,Q);return{x:J,y:q,width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}},X4=(_,Q=[0,0])=>{let{x:J,y:q}=B6(_)?_.internals.positionAbsolute:C5(_,Q);return{x:J,y:q,x2:J+(_.measured?.width??_.width??_.initialWidth??0),y2:q+(_.measured?.height??_.height??_.initialHeight??0)}},R6=(_,Q)=>W4(z4(Y6(_),Y6(Q))),M7=(_,Q,J,q,U,G,Z,F)=>{let K=Math.max(0,Math.min(_+J,U+Z)-Math.max(_,U)),Y=Math.max(0,Math.min(Q+q,G+F)-Math.max(Q,G));return Math.ceil(K*Y)},S5=(_,Q)=>M7(_.x,_.y,_.width,_.height,Q.x,Q.y,Q.width,Q.height),O6=(_)=>K0(_.width)&&K0(_.height)&&K0(_.x)&&K0(_.y),K0=(_)=>!isNaN(_)&&isFinite(_),I6=(_,Q)=>(J,q)=>{console.warn(`[${_}]: ${q} Help: ${Q}error#${J}`)},i2=(_,Q=[1,1])=>{return{x:Q[0]*Math.round(_.x/Q[0]),y:Q[1]*Math.round(_.y/Q[1])}},r2=({x:_,y:Q},[J,q,U],G=!1,Z=[1,1])=>{let F={x:(_-J)/U,y:(Q-q)/U};return G?i2(F,Z):F},M2=({x:_,y:Q},[J,q,U])=>{return{x:_*U+J,y:Q*U+q}};function m2(_,Q){if(typeof _==="number")return Math.floor((Q-Q/(1+_))*0.5);if(typeof _==="string"&&_.endsWith("px")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(J)}if(typeof _==="string"&&_.endsWith("%")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(Q*J*0.01)}return console.error(`The padding value "${_}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Wq(_,Q,J){if(typeof _==="string"||typeof _==="number"){let q=m2(_,J),U=m2(_,Q);return{top:q,right:U,bottom:q,left:U,x:U*2,y:q*2}}if(typeof _==="object"){let q=m2(_.top??_.y??0,J),U=m2(_.bottom??_.y??0,J),G=m2(_.left??_.x??0,Q),Z=m2(_.right??_.x??0,Q);return{top:q,right:Z,bottom:U,left:G,x:G+Z,y:q+U}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Aq(_,Q,J,q,U,G){let{x:Z,y:F}=M2(_,[Q,J,q]),{x:K,y:Y}=M2({x:_.x+_.width,y:_.y+_.height},[Q,J,q]),X=U-K,H=G-Y;return{left:Math.floor(Z),top:Math.floor(F),right:Math.floor(X),bottom:Math.floor(H)}}var v5=(_,Q,J,q,U,G)=>{let Z=Wq(G,Q,J),F=(Q-Z.x)/_.width,K=(J-Z.y)/_.height,Y=Math.min(F,K),X=p2(Y,q,U),H=_.x+_.width/2,L=_.y+_.height/2,W=Q/2-H*X,A=J/2-L*X,I=Aq(_,W,A,X,Q,J),R={left:Math.min(I.left-Z.left,0),top:Math.min(I.top-Z.top,0),right:Math.min(I.right-Z.right,0),bottom:Math.min(I.bottom-Z.bottom,0)};return{x:W-R.left+R.right,y:A-R.top+R.bottom,zoom:X}},d2=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function T2(_){return _!==void 0&&_!==null&&_!=="parent"}function Y0(_){return{width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}}function P6(_){return(_.measured?.width??_.width??_.initialWidth)!==void 0&&(_.measured?.height??_.height??_.initialHeight)!==void 0}function w6(_,Q={width:0,height:0},J,q,U){let G={..._},Z=q.get(J);if(Z){let F=Z.origin||U;G.x+=Z.internals.positionAbsolute.x-(Q.width??0)*F[0],G.y+=Z.internals.positionAbsolute.y-(Q.height??0)*F[1]}return G}function f6(_,Q){if(_.size!==Q.size)return!1;for(let J of _)if(!Q.has(J))return!1;return!0}function T7(){let _,Q;return{promise:new Promise((q,U)=>{_=q,Q=U}),resolve:_,reject:Q}}function R7(_){return{...z6,..._||{}}}function Bq(_){if(typeof document>"u")return!0;let Q=document.querySelector(`.${_}-flow__pane`);if(!Q||!Q.isConnected)return!0;let J=getComputedStyle(Q);if(J.display==="none")return!0;if(J.visibility==="hidden"||J.visibility==="collapse")return!0;if(J.opacity==="0")return!0;if(J.width==="0"&&J.height==="0")return!0;let q=Q.getBoundingClientRect();if(q.width===0&&q.height===0)return!0;let U=document.querySelector(`.${_}-flow__attribution`);if(!U||!U.isConnected)return!1;let G=getComputedStyle(U);if(G.display==="none")return!1;if(G.visibility==="hidden"||G.visibility==="collapse")return!1;if(G.opacity==="0")return!1;let Z=U.getBoundingClientRect();if(Z.width===0&&Z.height===0)return!1;return!0}var Q7=!1;function O7(_){if(Q7)return;Q7=!0;let Q=`${_.charAt(0).toUpperCase()+_.slice(1)} Flow`;setTimeout(()=>{if(!Bq(_))console.warn(`${Q}: It seems like you are hiding the attribution. Please only do this when you are subscribed to ${Q} Pro: https://${_}flow.dev/remove-attr
|
|
28
|
-
%cYou can ignore this warning if you are subscribed.`,"font-style: italic;")},1000)}function N6(_){return _===null?null:_?"valid":"invalid"}function N5(_,{snapGrid:Q=[0,0],snapToGrid:J=!1,transform:q,containerBounds:U}){let{x:G,y:Z}=X0(_),F=r2({x:G-(U?.left??0),y:Z-(U?.top??0)},q),{x:K,y:Y}=J?i2(F,Q):F;return{xSnapped:K,ySnapped:Y,...F}}var A4=(_)=>({width:_.offsetWidth,height:_.offsetHeight}),C6=(_)=>_?.getRootNode?.()||window?.document,Mq=["INPUT","SELECT","TEXTAREA"];function S6(_){let Q=_.composedPath?.()?.[0]||_.target;if(Q?.nodeType!==1)return!1;return Mq.includes(Q.nodeName)||Q.hasAttribute("contenteditable")||!!Q.closest(".nokey")}var v6=(_)=>("clientX"in _),X0=(_,Q)=>{let J=v6(_),q=J?_.clientX:_.touches?.[0].clientX,U=J?_.clientY:_.touches?.[0].clientY;return{x:q-(Q?.left??0),y:U-(Q?.top??0)}},J7=(_,Q,J,q,U)=>{let G=Q.querySelectorAll(`.${_}`);if(!G||!G.length)return null;return Array.from(G).map((Z)=>{let F=Z.getBoundingClientRect();return{id:Z.getAttribute("data-handleid"),type:_,nodeId:U,position:Z.getAttribute("data-handlepos"),x:(F.left-J.left)/q,y:(F.top-J.top)/q,...A4(Z)}})};function B4({sourceX:_,sourceY:Q,targetX:J,targetY:q,sourceControlX:U,sourceControlY:G,targetControlX:Z,targetControlY:F}){let K=_*0.125+U*0.375+Z*0.375+J*0.125,Y=Q*0.125+G*0.375+F*0.375+q*0.125,X=Math.abs(K-_),H=Math.abs(Y-Q);return[K,Y,X,H]}function H4(_,Q){if(_>=0)return 0.5*_;return Q*25*Math.sqrt(-_)}function $7({pos:_,x1:Q,y1:J,x2:q,y2:U,c:G}){switch(_){case Z1.Left:return[Q-H4(Q-q,G),J];case Z1.Right:return[Q+H4(q-Q,G),J];case Z1.Top:return[Q,J-H4(J-U,G)];case Z1.Bottom:return[Q,J+H4(U-J,G)]}}function M4({sourceX:_,sourceY:Q,sourcePosition:J=Z1.Bottom,targetX:q,targetY:U,targetPosition:G=Z1.Top,curvature:Z=0.25}){let[F,K]=$7({pos:J,x1:_,y1:Q,x2:q,y2:U,c:Z}),[Y,X]=$7({pos:G,x1:q,y1:U,x2:_,y2:Q,c:Z}),[H,L,W,A]=B4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:F,sourceControlY:K,targetControlX:Y,targetControlY:X});return[`M${_},${Q} C${F},${K} ${Y},${X} ${q},${U}`,H,L,W,A]}function y6({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let U=Math.abs(J-_)/2,G=J<_?J+U:J-U,Z=Math.abs(q-Q)/2,F=q<Q?q+Z:q-Z;return[G,F,U,Z]}function I7({sourceNode:_,targetNode:Q,selected:J=!1,zIndex:q=0,elevateOnSelect:U=!1,zIndexMode:G="basic"}){if(G==="manual")return q;let Z=U&&J?q+1000:q,F=Math.max(_.parentId||U&&_.selected?_.internals.z:0,Q.parentId||U&&Q.selected?Q.internals.z:0);return Z+F}function P7({sourceNode:_,targetNode:Q,width:J,height:q,transform:U}){let G=z4(X4(_),X4(Q));if(G.x===G.x2)G.x2+=1;if(G.y===G.y2)G.y2+=1;let Z={x:-U[0]/U[2],y:-U[1]/U[2],width:J/U[2],height:q/U[2]};return S5(Z,W4(G))>0}var Tq=({source:_,sourceHandle:Q,target:J,targetHandle:q})=>`xy-edge__${_}${Q||""}-${J}${q||""}`,Rq=(_,Q)=>{return Q.some((J)=>J.source===_.source&&J.target===_.target&&(J.sourceHandle===_.sourceHandle||!J.sourceHandle&&!_.sourceHandle)&&(J.targetHandle===_.targetHandle||!J.targetHandle&&!_.targetHandle))},w7=(_,Q,J={})=>{if(!_.source||!_.target)return J.onError?.("006",_0.error006()),Q;let q=J.getEdgeId||Tq,U;if(A6(_))U={..._};else U={..._,id:q(_)};if(Rq(U,Q))return Q;if(U.sourceHandle===null)delete U.sourceHandle;if(U.targetHandle===null)delete U.targetHandle;return Q.concat(U)};function T4({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let[U,G,Z,F]=y6({sourceX:_,sourceY:Q,targetX:J,targetY:q});return[`M ${_},${Q}L ${J},${q}`,U,G,Z,F]}var q7={[Z1.Left]:{x:-1,y:0},[Z1.Right]:{x:1,y:0},[Z1.Top]:{x:0,y:-1},[Z1.Bottom]:{x:0,y:1}},Oq=({source:_,sourcePosition:Q=Z1.Bottom,target:J})=>{if(Q===Z1.Left||Q===Z1.Right)return _.x<J.x?{x:1,y:0}:{x:-1,y:0};return _.y<J.y?{x:0,y:1}:{x:0,y:-1}},U7=(_,Q)=>Math.sqrt(Math.pow(Q.x-_.x,2)+Math.pow(Q.y-_.y,2));function Iq({source:_,sourcePosition:Q=Z1.Bottom,target:J,targetPosition:q=Z1.Top,center:U,offset:G,stepPosition:Z}){let F=q7[Q],K=q7[q],Y={x:_.x+F.x*G,y:_.y+F.y*G},X={x:J.x+K.x*G,y:J.y+K.y*G},H=Oq({source:Y,sourcePosition:Q,target:X}),L=H.x!==0?"x":"y",W=H[L],A=[],I,R,M={x:0,y:0},O={x:0,y:0},[,,B,T]=y6({sourceX:_.x,sourceY:_.y,targetX:J.x,targetY:J.y});if(F[L]*K[L]===-1){if(L==="x")I=U.x??Y.x+(X.x-Y.x)*Z,R=U.y??(Y.y+X.y)/2;else I=U.x??(Y.x+X.x)/2,R=U.y??Y.y+(X.y-Y.y)*Z;let S=[{x:I,y:Y.y},{x:I,y:X.y}],w=[{x:Y.x,y:R},{x:X.x,y:R}];if(F[L]===W)A=L==="x"?S:w;else A=L==="x"?w:S}else{let S=[{x:Y.x,y:X.y}],w=[{x:X.x,y:Y.y}];if(L==="x")A=F.x===W?w:S;else A=F.y===W?S:w;if(Q===q){let v=Math.abs(_[L]-J[L]);if(v<=G){let D=Math.min(G-1,G-v);if(F[L]===W)M[L]=(Y[L]>_[L]?-1:1)*D;else O[L]=(X[L]>J[L]?-1:1)*D}}if(Q!==q){let v=L==="x"?"y":"x",D=F[L]===K[v],V=Y[v]>X[v],E=Y[v]<X[v];if(F[L]===1&&(!D&&V||D&&E)||F[L]!==1&&(!D&&E||D&&V))A=L==="x"?S:w}let k={x:Y.x+M.x,y:Y.y+M.y},x={x:X.x+O.x,y:X.y+O.y},r=Math.max(Math.abs(k.x-A[0].x),Math.abs(x.x-A[0].x)),m=Math.max(Math.abs(k.y-A[0].y),Math.abs(x.y-A[0].y));if(r>=m)I=(k.x+x.x)/2,R=A[0].y;else I=A[0].x,R=(k.y+x.y)/2}let f={x:Y.x+M.x,y:Y.y+M.y},C={x:X.x+O.x,y:X.y+O.y};return[[_,...f.x!==A[0].x||f.y!==A[0].y?[f]:[],...A,...C.x!==A[A.length-1].x||C.y!==A[A.length-1].y?[C]:[],J],I,R,B,T]}function Pq(_,Q,J,q){let U=Math.min(U7(_,Q)/2,U7(Q,J)/2,q),{x:G,y:Z}=Q;if(_.x===G&&G===J.x||_.y===Z&&Z===J.y)return`L${G} ${Z}`;if(_.y===Z){let Y=_.x<J.x?-1:1,X=_.y<J.y?1:-1;return`L ${G+U*Y},${Z}Q ${G},${Z} ${G},${Z+U*X}`}let F=_.x<J.x?1:-1,K=_.y<J.y?-1:1;return`L ${G},${Z+U*K}Q ${G},${Z} ${G+U*F},${Z}`}function y5({sourceX:_,sourceY:Q,sourcePosition:J=Z1.Bottom,targetX:q,targetY:U,targetPosition:G=Z1.Top,borderRadius:Z=5,centerX:F,centerY:K,offset:Y=20,stepPosition:X=0.5}){let[H,L,W,A,I]=Iq({source:{x:_,y:Q},sourcePosition:J,target:{x:q,y:U},targetPosition:G,center:{x:F,y:K},offset:Y,stepPosition:X}),R=`M${H[0].x} ${H[0].y}`;for(let M=1;M<H.length-1;M++)R+=Pq(H[M-1],H[M],H[M+1],Z);return R+=`L${H[H.length-1].x} ${H[H.length-1].y}`,[R,L,W,A,I]}function G7(_){return _&&!!(_.internals.handleBounds||_.handles?.length)&&!!(_.measured.width||_.width||_.initialWidth)}function f7(_){let{sourceNode:Q,targetNode:J}=_;if(!G7(Q)||!G7(J))return null;let q=Q.internals.handleBounds||Z7(Q.handles),U=J.internals.handleBounds||Z7(J.handles),G=F7(q?.source??[],_.sourceHandle),Z=F7(_.connectionMode===e0.Strict?U?.target??[]:(U?.target??[]).concat(U?.source??[]),_.targetHandle);if(!G||!Z)return _.onError?.("008",_0.error008(!G?"source":"target",{id:_.id,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle})),null;let F=G?.position||Z1.Bottom,K=Z?.position||Z1.Top,Y=_2(Q,G,F),X=_2(J,Z,K);return{sourceX:Y.x,sourceY:Y.y,targetX:X.x,targetY:X.y,sourcePosition:F,targetPosition:K}}function Z7(_){if(!_)return null;let Q=[],J=[];for(let q of _)if(q.width=q.width??1,q.height=q.height??1,q.type==="source")Q.push(q);else if(q.type==="target")J.push(q);return{source:Q,target:J}}function _2(_,Q,J=Z1.Left,q=!1){let U=(Q?.x??0)+_.internals.positionAbsolute.x,G=(Q?.y??0)+_.internals.positionAbsolute.y,{width:Z,height:F}=Q??Y0(_);if(q)return{x:U+Z/2,y:G+F/2};switch(Q?.position??J){case Z1.Top:return{x:U+Z/2,y:G};case Z1.Right:return{x:U+Z,y:G+F/2};case Z1.Bottom:return{x:U+Z/2,y:G+F};case Z1.Left:return{x:U,y:G+F/2}}}function F7(_,Q){if(!_)return null;return(!Q?_[0]:_.find((J)=>J.id===Q))||null}function R4(_,Q){if(!_)return"";if(typeof _==="string")return _;return`${Q?`${Q}__`:""}${Object.keys(_).sort().map((q)=>`${q}=${_[q]}`).join("&")}`}function N7(_,{id:Q,defaultColor:J,defaultMarkerStart:q,defaultMarkerEnd:U}){let G=new Set;return _.reduce((Z,F)=>{return[F.markerStart||q,F.markerEnd||U].forEach((K)=>{if(K&&typeof K==="object"){let Y=R4(K,Q);if(!G.has(Y))Z.push({id:Y,color:K.color||J,...K}),G.add(Y)}}),Z},[]).sort((Z,F)=>Z.id.localeCompare(F.id))}function C7(_,Q,J,q,U){let G=0.5;if(U==="start")G=0;else if(U==="end")G=1;let Z=[(_.x+_.width*G)*Q.zoom+Q.x,_.y*Q.zoom+Q.y-q],F=[-100*G,-100];switch(J){case Z1.Right:Z=[(_.x+_.width)*Q.zoom+Q.x+q,(_.y+_.height*G)*Q.zoom+Q.y],F=[0,-100*G];break;case Z1.Bottom:Z[1]=(_.y+_.height)*Q.zoom+Q.y+q,F[1]=0;break;case Z1.Left:Z=[_.x*Q.zoom+Q.x-q,(_.y+_.height*G)*Q.zoom+Q.y],F=[-100,-100*G];break}return`translate(${Z[0]}px, ${Z[1]}px) translate(${F[0]}%, ${F[1]}%)`}var S7=1000,wq=10,k6={nodeOrigin:[0,0],nodeExtent:c2,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},fq={...k6,checkEquality:!0};function j6(_,Q){let J={..._};for(let q in Q)if(Q[q]!==void 0)J[q]=Q[q];return J}function v7(_,Q,J){let q=j6(k6,J);for(let U of _.values())if(U.parentId)u6(U,_,Q,q);else{let G=C5(U,q.nodeOrigin),Z=T2(U.extent)?U.extent:q.nodeExtent,F=B2(G,Z,Y0(U));U.internals.positionAbsolute=F}}function Nq(_,Q){if(!_.handles)return!_.measured?void 0:Q?.internals.handleBounds;let J=[],q=[];for(let U of _.handles){let G={id:U.id,width:U.width??1,height:U.height??1,nodeId:_.id,x:U.x,y:U.y,position:U.position,type:U.type};if(U.type==="source")J.push(G);else if(U.type==="target")q.push(G)}return{source:J,target:q}}function V6(_){return _==="manual"}function O4(_,Q,J,q={}){let U=j6(fq,q),G={i:0},Z=new Map(Q),F=U?.elevateNodesOnSelect&&!V6(U.zIndexMode)?S7:0,K=_.length>0,Y=!1;Q.clear(),J.clear();for(let X of _){let H=Z.get(X.id);if(U.checkEquality&&X===H?.internals.userNode)Q.set(X.id,H);else{let L=C5(X,U.nodeOrigin),W=T2(X.extent)?X.extent:U.nodeExtent,A=B2(L,W,Y0(X));H={...U.defaults,...X,measured:{width:X.measured?.width,height:X.measured?.height},internals:{positionAbsolute:A,handleBounds:Nq(X,H),z:y7(X,F,U.zIndexMode),userNode:X}},Q.set(X.id,H)}if((H.measured===void 0||H.measured.width===void 0||H.measured.height===void 0)&&!H.hidden)K=!1;if(X.parentId)u6(H,Q,J,q,G);Y||=X.selected??!1}return{nodesInitialized:K,hasSelectedNodes:Y}}function Cq(_,Q){if(!_.parentId)return;let J=Q.get(_.parentId);if(J)J.set(_.id,_);else Q.set(_.parentId,new Map([[_.id,_]]))}function u6(_,Q,J,q,U){let{elevateNodesOnSelect:G,nodeOrigin:Z,nodeExtent:F,zIndexMode:K}=j6(k6,q),Y=_.parentId,X=Q.get(Y);if(!X){console.warn(`Parent node ${Y} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}if(Cq(_,J),U&&!X.parentId&&X.internals.rootParentIndex===void 0&&K==="auto")X.internals.rootParentIndex=++U.i,X.internals.z=X.internals.z+U.i*wq;if(U&&X.internals.rootParentIndex!==void 0)U.i=X.internals.rootParentIndex;let H=G&&!V6(K)?S7:0,{x:L,y:W,z:A}=Sq(_,X,Z,F,H,K),{positionAbsolute:I}=_.internals,R=L!==I.x||W!==I.y;if(R||A!==_.internals.z)Q.set(_.id,{..._,internals:{..._.internals,positionAbsolute:R?{x:L,y:W}:I,z:A}})}function y7(_,Q,J){let q=K0(_.zIndex)?_.zIndex:0;if(V6(J))return q;return q+(_.selected?Q:0)}function Sq(_,Q,J,q,U,G){let{x:Z,y:F}=Q.internals.positionAbsolute,K=Y0(_),Y=C5(_,J),X=T2(_.extent)?B2(Y,_.extent,K):Y,H=B2({x:Z+X.x,y:F+X.y},q,K);if(_.extent==="parent")H=B7(H,K,Q);let L=y7(_,U,G),W=Q.internals.z??0;return{x:H.x,y:H.y,z:W>=L?W+1:L}}function I4(_,Q,J,q=[0,0]){let U=[],G=new Map;for(let Z of _){let F=Q.get(Z.parentId);if(!F)continue;let K=G.get(Z.parentId)?.expandedRect??l2(F),Y=R6(K,Z.rect);G.set(Z.parentId,{expandedRect:Y,parent:F})}if(G.size>0)G.forEach(({expandedRect:Z,parent:F},K)=>{let Y=F.internals.positionAbsolute,X=Y0(F),H=F.origin??q,L=Z.x<Y.x?Math.round(Math.abs(Y.x-Z.x)):0,W=Z.y<Y.y?Math.round(Math.abs(Y.y-Z.y)):0,A=Math.max(X.width,Math.round(Z.width)),I=Math.max(X.height,Math.round(Z.height)),R=(A-X.width)*H[0],M=(I-X.height)*H[1];if(L>0||W>0||R||M)U.push({id:K,type:"position",position:{x:F.position.x-L+R,y:F.position.y-W+M}}),J.get(K)?.forEach((O)=>{if(!_.some((B)=>B.id===O.id))U.push({id:O.id,type:"position",position:{x:O.position.x+L,y:O.position.y+W}})});if(X.width<Z.width||X.height<Z.height||L||W)U.push({id:K,type:"dimensions",setAttributes:!0,dimensions:{width:A+(L?H[0]*L-R:0),height:I+(W?H[1]*W-M:0)}})});return U}function k7(_,Q,J,q,U,G,Z){let F=q?.querySelector(".xyflow__viewport"),K=!1;if(!F)return{changes:[],updatedInternals:K};let Y=[],X=window.getComputedStyle(F),{m22:H}=new window.DOMMatrixReadOnly(X.transform),L=[];for(let W of _.values()){let A=Q.get(W.id);if(!A)continue;if(A.hidden){Q.set(A.id,{...A,internals:{...A.internals,handleBounds:void 0}}),K=!0;continue}let I=A4(W.nodeElement),R=A.measured.width!==I.width||A.measured.height!==I.height;if(!!(I.width&&I.height&&(R||!A.internals.handleBounds||W.force))){let O=W.nodeElement.getBoundingClientRect(),B=T2(A.extent)?A.extent:G,{positionAbsolute:T}=A.internals;if(A.parentId&&A.extent==="parent"){let C=Q.get(A.parentId);if(C)T=B7(T,I,C)}else if(B)T=B2(T,B,I);let f={...A,measured:I,internals:{...A.internals,positionAbsolute:T,handleBounds:{source:J7("source",W.nodeElement,O,H,A.id),target:J7("target",W.nodeElement,O,H,A.id)}}};if(Q.set(A.id,f),A.parentId)u6(f,Q,J,{nodeOrigin:U,zIndexMode:Z});if(K=!0,R){if(Y.push({id:A.id,type:"dimensions",dimensions:I}),A.expandParent&&A.parentId)L.push({id:A.id,parentId:A.parentId,rect:l2(f,U)})}}}if(L.length>0){let W=I4(L,Q,J,U);Y.push(...W)}return{changes:Y,updatedInternals:K}}async function j7({delta:_,panZoom:Q,transform:J,translateExtent:q,width:U,height:G}){if(!Q||!_.x&&!_.y)return!1;let Z=await Q.setViewportConstrained({x:J[0]+_.x,y:J[1]+_.y,zoom:J[2]},[[0,0],[U,G]],q);return!!Z&&(Z.x!==J[0]||Z.y!==J[1]||Z.k!==J[2])}function H7(_,Q,J,q,U,G){let Z=U,F=q.get(Z)||new Map;q.set(Z,F.set(J,Q)),Z=`${U}-${_}`;let K=q.get(Z)||new Map;if(q.set(Z,K.set(J,Q)),G){Z=`${U}-${_}-${G}`;let Y=q.get(Z)||new Map;q.set(Z,Y.set(J,Q))}}function h6(_,Q,J){_.clear(),Q.clear();for(let q of J){let{source:U,target:G,sourceHandle:Z=null,targetHandle:F=null}=q,K={edgeId:q.id,source:U,target:G,sourceHandle:Z,targetHandle:F},Y=`${U}-${Z}--${G}-${F}`,X=`${G}-${F}--${U}-${Z}`;H7("source",K,X,_,U,Z),H7("target",K,Y,_,G,F),Q.set(q.id,q)}}function V7(_,Q){if(!_.parentId)return!1;let J=Q.get(_.parentId);if(!J)return!1;if(J.selected)return!0;return V7(J,Q)}function K7(_,Q,J){let q=_;do{if(q?.matches?.(Q))return!0;if(q===J)return!1;q=q?.parentElement}while(q);return!1}function vq(_,Q,J,q){let U=new Map;for(let[G,Z]of _)if((Z.selected||Z.id===q)&&(!Z.parentId||!V7(Z,_))&&(Z.draggable||Q&&typeof Z.draggable>"u")){let F=_.get(G);if(F)U.set(G,{id:G,position:F.position||{x:0,y:0},distance:{x:J.x-F.internals.positionAbsolute.x,y:J.y-F.internals.positionAbsolute.y},extent:F.extent,parentId:F.parentId,origin:F.origin,expandParent:F.expandParent,internals:{positionAbsolute:F.internals.positionAbsolute||{x:0,y:0}},measured:{width:F.measured.width??0,height:F.measured.height??0}})}return U}function H6({nodeId:_,dragItems:Q,nodeLookup:J,dragging:q=!0}){let U=[];for(let[Z,F]of Q){let K=J.get(Z)?.internals.userNode;if(K)U.push({...K,position:F.position,dragging:q})}if(!_)return[U[0],U];let G=J.get(_)?.internals.userNode;return[!G?U[0]:{...G,position:Q.get(_)?.position||G.position,dragging:q},U]}function yq({dragItems:_,snapGrid:Q,x:J,y:q}){let U=_.values().next().value;if(!U)return null;let G={x:J-U.distance.x,y:q-U.distance.y},Z=i2(G,Q);return{x:Z.x-G.x,y:Z.y-G.y}}function u7({onNodeMouseDown:_,getStoreItems:Q,onDragStart:J,onDrag:q,onDragStop:U}){let G={x:null,y:null},Z=0,F=new Map,K=!1,Y={x:0,y:0},X=null,H=!1,L=null,W=!1,A=!1,I=null;function R({noDragClassName:O,handleSelector:B,domNode:T,isSelectable:f,nodeId:C,nodeClickDistance:N=0}){L=m1(T);function S({x:r,y:m}){let{nodeLookup:v,nodeExtent:D,snapGrid:V,snapToGrid:E,nodeOrigin:u,onNodeDrag:b,onSelectionDrag:P,onError:y,updateNodePositions:p}=Q();G={x:r,y:m};let h=!1,e=F.size>1,t=e&&D?Y6(R2(F)):null,o=e&&E?yq({dragItems:F,snapGrid:V,x:r,y:m}):null;for(let[s,g]of F){if(!v.has(s))continue;let J1={x:r-g.distance.x,y:m-g.distance.y};if(E)J1=o?{x:Math.round(J1.x+o.x),y:Math.round(J1.y+o.y)}:i2(J1,V);let U1=null;if(e&&D&&!g.extent&&t){let{positionAbsolute:F1}=g.internals,A1=F1.x-t.x+D[0][0],Y1=F1.x+g.measured.width-t.x2+D[1][0],Q1=F1.y-t.y+D[0][1],T1=F1.y+g.measured.height-t.y2+D[1][1];U1=[[A1,Q1],[Y1,T1]]}let{position:X1,positionAbsolute:G1}=T6({nodeId:s,nextPosition:J1,nodeLookup:v,nodeExtent:U1?U1:D,nodeOrigin:u,onError:y});h=h||g.position.x!==X1.x||g.position.y!==X1.y,g.position=X1,g.internals.positionAbsolute=G1}if(A=A||h,!h)return;if(p(F,!0),I&&(q||b||!C&&P)){let[s,g]=H6({nodeId:C,dragItems:F,nodeLookup:v});if(q?.(I,F,s,g),b?.(I,s,g),!C)P?.(I,g)}}async function w(){if(!X)return;let{transform:r,panBy:m,autoPanSpeed:v,autoPanOnNodeDrag:D}=Q();if(!D){K=!1,cancelAnimationFrame(Z);return}let[V,E]=L4(Y,X,v);if(V!==0||E!==0){if(G.x=(G.x??0)-V/r[2],G.y=(G.y??0)-E/r[2],await m({x:V,y:E}))S(G)}Z=requestAnimationFrame(w)}function k(r){let{nodeLookup:m,multiSelectionActive:v,nodesDraggable:D,transform:V,snapGrid:E,snapToGrid:u,selectNodesOnDrag:b,onNodeDragStart:P,onSelectionDragStart:y,unselectNodesAndEdges:p}=Q();if(H=!0,(!b||!f)&&!v&&C){if(!m.get(C)?.selected)p()}if(f&&b&&C)_?.(C);let h=N5(r.sourceEvent,{transform:V,snapGrid:E,snapToGrid:u,containerBounds:X});if(G=h,F=vq(m,D,h,C),F.size>0&&(J||P||!C&&y)){let[e,t]=H6({nodeId:C,dragItems:F,nodeLookup:m});if(J?.(r.sourceEvent,F,e,t),P?.(r.sourceEvent,e,t),!C)y?.(r.sourceEvent,t)}}let x=Z5().clickDistance(N).on("start",(r)=>{let{domNode:m,nodeDragThreshold:v,transform:D,snapGrid:V,snapToGrid:E}=Q();if(X=m?.getBoundingClientRect()||null,W=!1,A=!1,I=r.sourceEvent,v===0)k(r);G=N5(r.sourceEvent,{transform:D,snapGrid:V,snapToGrid:E,containerBounds:X}),Y=X0(r.sourceEvent,X)}).on("drag",(r)=>{let{autoPanOnNodeDrag:m,transform:v,snapGrid:D,snapToGrid:V,nodeDragThreshold:E,nodeLookup:u}=Q(),b=N5(r.sourceEvent,{transform:v,snapGrid:D,snapToGrid:V,containerBounds:X});if(I=r.sourceEvent,r.sourceEvent.type==="touchmove"&&r.sourceEvent.touches.length>1||C&&!u.has(C))W=!0;if(W)return;if(!K&&m&&H)K=!0,w();if(!H){let P=X0(r.sourceEvent,X),y=P.x-Y.x,p=P.y-Y.y;if(Math.sqrt(y*y+p*p)>E)k(r)}if((G.x!==b.xSnapped||G.y!==b.ySnapped)&&F&&H)Y=X0(r.sourceEvent,X),S(b)}).on("end",(r)=>{if(!H||W){if(W&&F.size>0)Q().updateNodePositions(F,!1);return}if(K=!1,H=!1,cancelAnimationFrame(Z),F.size>0){let{nodeLookup:m,updateNodePositions:v,onNodeDragStop:D,onSelectionDragStop:V}=Q();if(A)v(F,!1),A=!1;if(U||D||!C&&V){let[E,u]=H6({nodeId:C,dragItems:F,nodeLookup:m,dragging:!1});if(U?.(r.sourceEvent,F,E,u),D?.(r.sourceEvent,E,u),!C)V?.(r.sourceEvent,u)}}}).filter((r)=>{let m=r.target;return!r.button&&(!O||!K7(m,`.${O}`,T))&&(!B||K7(m,B,T))});L.call(x)}function M(){L?.on(".drag",null)}return{update:R,destroy:M}}function kq(_,Q,J){let q=[],U={x:_.x-J,y:_.y-J,width:J*2,height:J*2};for(let G of Q.values())if(S5(U,l2(G))>0)q.push(G);return q}var jq=250;function Vq(_,Q,J,q){let U=[],G=1/0,Z=kq(_,J,Q+jq);for(let F of Z){let K=[...F.internals.handleBounds?.source??[],...F.internals.handleBounds?.target??[]];for(let Y of K){if(q.nodeId===Y.nodeId&&q.type===Y.type&&q.id===Y.id)continue;let{x:X,y:H}=_2(F,Y,Y.position,!0),L=Math.sqrt(Math.pow(X-_.x,2)+Math.pow(H-_.y,2));if(L>Q)continue;if(L<G)U=[{...Y,x:X,y:H}],G=L;else if(L===G)U.push({...Y,x:X,y:H})}}if(!U.length)return null;if(U.length>1){let F=q.type==="source"?"target":"source";return U.find((K)=>K.type===F)??U[0]}return U[0]}function h7(_,Q,J,q,U,G=!1){let Z=q.get(_);if(!Z)return null;let F=U==="strict"?Z.internals.handleBounds?.[Q]:[...Z.internals.handleBounds?.source??[],...Z.internals.handleBounds?.target??[]],K=(J?F?.find((Y)=>Y.id===J):F?.[0])??null;return K&&G?{...K,..._2(Z,K,K.position,!0)}:K}function D7(_,Q){if(_)return _;else if(Q?.classList.contains("target"))return"target";else if(Q?.classList.contains("source"))return"source";return null}function uq(_,Q){let J=null;if(Q)J=!0;else if(_&&!Q)J=!1;return J}var b7=()=>!0;function hq(_,{connectionMode:Q,connectionRadius:J,handleId:q,nodeId:U,edgeUpdaterType:G,isTarget:Z,domNode:F,nodeLookup:K,lib:Y,autoPanOnConnect:X,flowId:H,panBy:L,cancelConnection:W,onConnectStart:A,onConnect:I,onConnectEnd:R,isValidConnection:M=b7,onReconnectEnd:O,updateConnection:B,getTransform:T,getFromHandle:f,autoPanSpeed:C,dragThreshold:N=1,handleDomNode:S}){let w=C6(_.target),k=0,x,{x:r,y:m}=X0(_),v=D7(G,S),D=F?.getBoundingClientRect(),V=!1;if(!D||!v)return;let E=h7(U,v,q,K,Q);if(!E)return;let u=X0(_,D),b=!1,P=null,y=!1,p=null;function h(){if(!X||!D)return;let[X1,G1]=L4(u,D,C);L({x:X1,y:G1}),k=requestAnimationFrame(h)}let e={...E,nodeId:U,type:v,position:E.position},t=K.get(U),s={inProgress:!0,isValid:null,from:_2(t,e,Z1.Left,!0),fromHandle:e,fromPosition:e.position,fromNode:t,to:u,toHandle:null,toPosition:e8[e.position],toNode:null,pointer:u};function g(){V=!0,B(s),A?.(_,{nodeId:U,handleId:q,handleType:v})}if(N===0)g();function J1(X1){if(!V){let{x:T1,y:K1}=X0(X1),k1=T1-r,p1=K1-m;if(!(k1*k1+p1*p1>N*N))return;g()}if(!f()||!e){U1(X1);return}let G1=T();if(u=X0(X1,D),x=Vq(r2(u,G1,!1,[1,1]),J,K,e),!b)h(),b=!0;let F1=E7(X1,{handle:x,connectionMode:Q,fromNodeId:U,fromHandleId:q,fromType:Z?"target":"source",isValidConnection:M,doc:w,lib:Y,flowId:H,nodeLookup:K});p=F1.handleDomNode,P=F1.connection,y=uq(!!x,F1.isValid);let A1=K.get(U),Y1=A1?_2(A1,e,Z1.Left,!0):s.from,Q1={...s,from:Y1,isValid:y,to:F1.toHandle&&y?M2({x:F1.toHandle.x,y:F1.toHandle.y},G1):u,toHandle:F1.toHandle,toPosition:y&&F1.toHandle?F1.toHandle.position:e8[e.position],toNode:F1.toHandle?K.get(F1.toHandle.nodeId):null,pointer:u};B(Q1),s=Q1}function U1(X1){if("touches"in X1&&X1.touches.length>0)return;if(V){if((x||p)&&P&&y)I?.(P);let{inProgress:G1,...F1}=s,A1={...F1,toPosition:s.toHandle?s.toPosition:null};if(R?.(X1,A1),G)O?.(X1,A1)}W(),cancelAnimationFrame(k),b=!1,y=!1,P=null,p=null,w.removeEventListener("mousemove",J1),w.removeEventListener("mouseup",U1),w.removeEventListener("touchmove",J1),w.removeEventListener("touchend",U1)}w.addEventListener("mousemove",J1),w.addEventListener("mouseup",U1),w.addEventListener("touchmove",J1),w.addEventListener("touchend",U1)}function E7(_,{handle:Q,connectionMode:J,fromNodeId:q,fromHandleId:U,fromType:G,doc:Z,lib:F,flowId:K,isValidConnection:Y=b7,nodeLookup:X}){let H=G==="target",L=Q?Z.querySelector(`.${F}-flow__handle[data-id="${K}-${Q?.nodeId}-${Q?.id}-${Q?.type}"]`):null,{x:W,y:A}=X0(_),I=Z.elementFromPoint(W,A),R=I?.classList.contains(`${F}-flow__handle`)?I:L,M={handleDomNode:R,isValid:!1,connection:null,toHandle:null};if(R){let O=D7(void 0,R),B=R.getAttribute("data-nodeid"),T=R.getAttribute("data-handleid"),f=R.classList.contains("connectable"),C=R.classList.contains("connectableend");if(!B||!O)return M;let N={source:H?B:q,sourceHandle:H?T:U,target:H?q:B,targetHandle:H?U:T};M.connection=N;let w=f&&C&&(J===e0.Strict?H&&O==="source"||!H&&O==="target":B!==q||T!==U);M.isValid=w&&Y(N),M.toHandle=h7(B,O,T,X,J,!0)}return M}var P4={onPointerDown:hq,isValid:E7};function x7({domNode:_,panZoom:Q,getTransform:J,getViewScale:q}){let U=m1(_);function G({translateExtent:F,width:K,height:Y,zoomStep:X=1,pannable:H=!0,zoomable:L=!0,inversePan:W=!1}){let A=(B)=>{if(B.sourceEvent.type!=="wheel"||!Q)return;let T=J(),f=B.sourceEvent.ctrlKey&&d2()?10:1,C=-B.sourceEvent.deltaY*(B.sourceEvent.deltaMode===1?0.05:B.sourceEvent.deltaMode?1:0.002)*X,N=T[2]*Math.pow(2,C*f);Q.scaleTo(N)},I=[0,0],R=(B)=>{if(B.sourceEvent.type==="mousedown"||B.sourceEvent.type==="touchstart")I=[B.sourceEvent.clientX??B.sourceEvent.touches[0].clientX,B.sourceEvent.clientY??B.sourceEvent.touches[0].clientY]},M=(B)=>{let T=J();if(B.sourceEvent.type!=="mousemove"&&B.sourceEvent.type!=="touchmove"||!Q)return;let f=[B.sourceEvent.clientX??B.sourceEvent.touches[0].clientX,B.sourceEvent.clientY??B.sourceEvent.touches[0].clientY],C=[f[0]-I[0],f[1]-I[1]];I=f;let N=q()*Math.max(T[2],Math.log(T[2]))*(W?-1:1),S={x:T[0]-C[0]*N,y:T[1]-C[1]*N},w=[[0,0],[K,Y]];Q.setViewportConstrained({x:S.x,y:S.y,zoom:T[2]},w,F)},O=f5().on("start",R).on("zoom",H?M:null).on("zoom.wheel",L?A:null);U.call(O,{})}function Z(){U.on("zoom",null)}return{update:G,destroy:Z,pointer:d1}}var w4=(_)=>({x:_.x,y:_.y,zoom:_.k}),K6=({x:_,y:Q,zoom:J})=>z2.translate(_,Q).scale(J),n0=(_,Q)=>_.target.closest(`.${Q}`),m7=(_,Q)=>Q===2&&Array.isArray(_)&&_.includes(2),Dq=(_)=>((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2,X6=(_,Q=0,J=Dq,q=()=>{})=>{let U=typeof Q==="number"&&Q>0;if(!U)q();return U?_.transition().duration(Q).ease(J).on("end",q):_},g7=(_)=>{let Q=_.ctrlKey&&d2()?10:1;return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*Q};function bq({zoomPanValues:_,noWheelClassName:Q,d3Selection:J,d3Zoom:q,panOnScrollMode:U,panOnScrollSpeed:G,zoomOnPinch:Z,onPanZoomStart:F,onPanZoom:K,onPanZoomEnd:Y}){return(X)=>{if(n0(X,Q)){if(X.ctrlKey)X.preventDefault();return!1}X.preventDefault(),X.stopImmediatePropagation();let H=J.property("__zoom").k||1;if(X.ctrlKey&&Z){let R=d1(X),M=g7(X),O=H*Math.pow(2,M);q.scaleTo(J,O,R,X);return}let L=X.deltaMode===1?20:1,W=U===b0.Vertical?0:X.deltaX*L,A=U===b0.Horizontal?0:X.deltaY*L;if(!d2()&&X.shiftKey&&U!==b0.Vertical)W=X.deltaY*L,A=0;q.translateBy(J,-(W/H)*G,-(A/H)*G,{internal:!0});let I=w4(J.property("__zoom"));if(clearTimeout(_.panScrollTimeout),!_.isPanScrolling)_.isPanScrolling=!0,F?.(X,I);else K?.(X,I);_.panScrollTimeout=setTimeout(()=>{Y?.(X,I),_.isPanScrolling=!1},150)}}function Eq({noWheelClassName:_,preventScrolling:Q,d3ZoomHandler:J}){return function(q,U){let G=q.type==="wheel",Z=!Q&&G&&!q.ctrlKey,F=n0(q,_);if(q.ctrlKey&&G&&F)q.preventDefault();if(Z||F)return null;q.preventDefault(),J.call(this,q,U)}}function xq({zoomPanValues:_,onDraggingChange:Q,onPanZoomStart:J}){return(q)=>{if(q.sourceEvent?.internal)return;let U=w4(q.transform);if(_.mouseButton=q.sourceEvent?.button||0,_.isZoomingOrPanning=!0,_.prevViewport=U,q.sourceEvent?.type==="mousedown")Q(!0);if(J)J?.(q.sourceEvent,U)}}function mq({zoomPanValues:_,panOnDrag:Q,onPaneContextMenu:J,onTransformChange:q,onPanZoom:U}){return(G)=>{if(_.usedRightMouseButton=!!(J&&m7(Q,_.mouseButton??0)),!G.sourceEvent?.sync)q([G.transform.x,G.transform.y,G.transform.k]);if(U&&!G.sourceEvent?.internal)U?.(G.sourceEvent,w4(G.transform))}}function gq({zoomPanValues:_,panOnDrag:Q,panOnScroll:J,onDraggingChange:q,onPanZoomEnd:U,onPaneContextMenu:G}){return(Z)=>{if(Z.sourceEvent?.internal)return;if(_.isZoomingOrPanning=!1,G&&m7(Q,_.mouseButton??0)&&!_.usedRightMouseButton&&Z.sourceEvent)G(Z.sourceEvent);if(_.usedRightMouseButton=!1,q(!1),U){let F=w4(Z.transform);_.prevViewport=F,clearTimeout(_.timerId),_.timerId=setTimeout(()=>{U?.(Z.sourceEvent,F)},J?150:0)}}}function pq({panActivationKeyPressed:_,zoomActivationKeyPressed:Q,zoomOnScroll:J,zoomOnPinch:q,panOnDrag:U,panOnScroll:G,zoomOnDoubleClick:Z,userSelectionActive:F,noWheelClassName:K,noPanClassName:Y,lib:X,connectionInProgress:H}){return(L)=>{let W=Q||J,A=q&&L.ctrlKey,I=L.type==="wheel";if(L.button===1&&L.type==="mousedown"&&(n0(L,`${X}-flow__node`)||n0(L,`${X}-flow__edge`)||n0(L,`${X}-flow__selection`)||n0(L,`${X}-flow__nodesselection`)))return!0;if(!U&&!W&&!G&&!Z&&!q)return!1;if(F)return!1;if(H&&!I)return!1;if(n0(L,K)&&I)return!1;if(n0(L,Y)&&(!I||G&&I&&!Q))return!1;if(!q&&L.ctrlKey&&I)return!1;if(!q&&L.type==="touchstart"&&L.touches?.length>1)return L.preventDefault(),!1;if(!W&&!G&&!A&&I)return!1;if(!U&&(L.type==="mousedown"||L.type==="touchstart"))return!1;if(Array.isArray(U)&&!U.includes(L.button)&&L.type==="mousedown")return!1;let R=Array.isArray(U)&&U.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||I||_)&&R}}function p7({domNode:_,minZoom:Q,maxZoom:J,translateExtent:q,viewport:U,onPanZoom:G,onPanZoomStart:Z,onPanZoomEnd:F,onDraggingChange:K}){let Y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},X=_.getBoundingClientRect(),H=[[0,0],[X.width,X.height]];(typeof ResizeObserver<"u"?new ResizeObserver((m)=>{let v=m[0];if(v)H=[[0,0],[v.contentRect.width,v.contentRect.height]]}):null)?.observe(_);let W=f5().extent(()=>H).scaleExtent([Q,J]).translateExtent(q),A=m1(_).call(W);T({x:U.x,y:U.y,zoom:p2(U.zoom,Q,J)},[[0,0],[X.width,X.height]],q);let I=A.on("wheel.zoom"),R=A.on("dblclick.zoom");W.wheelDelta(g7);async function M(m,v){if(A)return new Promise((D)=>{W?.interpolate(v?.interpolate==="linear"?w0:Y2).transform(X6(A,v?.duration,v?.ease,()=>D(!0)),m)});return!1}function O({noWheelClassName:m,noPanClassName:v,onPaneContextMenu:D,userSelectionActive:V,panOnScroll:E,panOnDrag:u,panOnScrollMode:b,panOnScrollSpeed:P,preventScrolling:y,zoomOnPinch:p,zoomOnScroll:h,zoomOnDoubleClick:e,panActivationKeyPressed:t=!1,zoomActivationKeyPressed:o,lib:s,onTransformChange:g,connectionInProgress:J1,paneClickDistance:U1,selectionOnDrag:X1}){if(V&&!Y.isZoomingOrPanning)B();let G1=E&&!o&&!V;W.clickDistance(X1?1/0:!K0(U1)||U1<0?0:U1);let F1=G1?bq({zoomPanValues:Y,noWheelClassName:m,d3Selection:A,d3Zoom:W,panOnScrollMode:b,panOnScrollSpeed:P,zoomOnPinch:p,onPanZoomStart:Z,onPanZoom:G,onPanZoomEnd:F}):Eq({noWheelClassName:m,preventScrolling:y,d3ZoomHandler:I});A.on("wheel.zoom",F1,{passive:!1});let A1=xq({zoomPanValues:Y,onDraggingChange:K,onPanZoomStart:Z});W.on("start",A1);let Y1=mq({zoomPanValues:Y,panOnDrag:u,onPaneContextMenu:!!D,onPanZoom:G,onTransformChange:g});W.on("zoom",Y1);let Q1=gq({zoomPanValues:Y,panOnDrag:u,panOnScroll:E,onPaneContextMenu:D,onPanZoomEnd:F,onDraggingChange:K});W.on("end",Q1);let T1=pq({panActivationKeyPressed:t,zoomActivationKeyPressed:o,panOnDrag:u,zoomOnScroll:h,panOnScroll:E,zoomOnDoubleClick:e,zoomOnPinch:p,userSelectionActive:V,noPanClassName:v,noWheelClassName:m,lib:s,connectionInProgress:J1});if(W.filter(T1),e)A.on("dblclick.zoom",R);else A.on("dblclick.zoom",null)}function B(){W.on("zoom",null)}async function T(m,v,D){let V=K6(m),E=W?.constrain()(V,v,D);if(E)await M(E);return E}async function f(m,v){let D=K6(m);return await M(D,v),D}function C(m){if(A){let v=K6(m),D=A.property("__zoom");if(D.k!==m.zoom||D.x!==m.x||D.y!==m.y)W?.transform(A,v,null,{sync:!0})}}function N(){let m=A?w5(A.node()):{x:0,y:0,k:1};return{x:m.x,y:m.y,zoom:m.k}}async function S(m,v){if(A)return new Promise((D)=>{W?.interpolate(v?.interpolate==="linear"?w0:Y2).scaleTo(X6(A,v?.duration,v?.ease,()=>D(!0)),m)});return!1}async function w(m,v){if(A)return new Promise((D)=>{W?.interpolate(v?.interpolate==="linear"?w0:Y2).scaleBy(X6(A,v?.duration,v?.ease,()=>D(!0)),m)});return!1}function k(m){W?.scaleExtent(m)}function x(m){W?.translateExtent(m)}function r(m){let v=!K0(m)||m<0?0:m;W?.clickDistance(v)}return{update:O,destroy:B,setViewport:f,setViewportConstrained:T,getViewport:N,scaleTo:S,scaleBy:w,setScaleExtent:k,setTranslateExtent:x,syncViewport:C,setClickDistance:r}}var E0;(function(_){_.Line="line",_.Handle="handle"})(E0||(E0={}));var c7=["top-left","top-right","bottom-left","bottom-right"],l7=["top","right","bottom","left"];function cq({width:_,prevWidth:Q,height:J,prevHeight:q,affectsX:U,affectsY:G}){let Z=_-Q,F=J-q,K=[Z>0?1:Z<0?-1:0,F>0?1:F<0?-1:0];if(Z&&U)K[0]=K[0]*-1;if(F&&G)K[1]=K[1]*-1;return K}function X7(_){let Q=_.includes("right")||_.includes("left"),J=_.includes("bottom")||_.includes("top"),q=_.includes("left"),U=_.includes("top");return{isHorizontal:Q,isVertical:J,affectsX:q,affectsY:U}}function t0(_,Q){return Math.max(0,Q-_)}function o0(_,Q){return Math.max(0,_-Q)}function K4(_,Q,J){return Math.max(0,Q-_,_-J)}function Y7(_,Q){return _?!Q:Q}function lq(_,Q,J,q,U,G,Z,F){let{affectsX:K,affectsY:Y}=Q,{isHorizontal:X,isVertical:H}=Q,L=X&&H,{xSnapped:W,ySnapped:A}=J,{minWidth:I,maxWidth:R,minHeight:M,maxHeight:O}=q,{x:B,y:T,width:f,height:C,aspectRatio:N}=_,S=Math.floor(X?W-_.pointerX:0),w=Math.floor(H?A-_.pointerY:0),k=f+(K?-S:S),x=C+(Y?-w:w),r=-G[0]*f,m=-G[1]*C,v=K4(k,I,R),D=K4(x,M,O);if(Z){let u=0,b=0;if(K&&S<0)u=t0(B+S+r,Z[0][0]);else if(!K&&S>0)u=o0(B+k+r,Z[1][0]);if(Y&&w<0)b=t0(T+w+m,Z[0][1]);else if(!Y&&w>0)b=o0(T+x+m,Z[1][1]);v=Math.max(v,u),D=Math.max(D,b)}if(F){let u=0,b=0;if(K&&S>0)u=o0(B+S,F[0][0]);else if(!K&&S<0)u=t0(B+k,F[1][0]);if(Y&&w>0)b=o0(T+w,F[0][1]);else if(!Y&&w<0)b=t0(T+x,F[1][1]);v=Math.max(v,u),D=Math.max(D,b)}if(U){if(X){let u=K4(k/N,M,O)*N;if(v=Math.max(v,u),Z){let b=0;if(!K&&!Y||K&&!Y&&L)b=o0(T+m+k/N,Z[1][1])*N;else b=t0(T+m+(K?S:-S)/N,Z[0][1])*N;v=Math.max(v,b)}if(F){let b=0;if(!K&&!Y||K&&!Y&&L)b=t0(T+k/N,F[1][1])*N;else b=o0(T+(K?S:-S)/N,F[0][1])*N;v=Math.max(v,b)}}if(H){let u=K4(x*N,I,R)/N;if(D=Math.max(D,u),Z){let b=0;if(!K&&!Y||Y&&!K&&L)b=o0(B+x*N+r,Z[1][0])/N;else b=t0(B+(Y?w:-w)*N+r,Z[0][0])/N;D=Math.max(D,b)}if(F){let b=0;if(!K&&!Y||Y&&!K&&L)b=t0(B+x*N,F[1][0])/N;else b=o0(B+(Y?w:-w)*N,F[0][0])/N;D=Math.max(D,b)}}}if(w=w+(w<0?D:-D),S=S+(S<0?v:-v),U)if(L)if(k>x*N)w=(Y7(K,Y)?-S:S)/N;else S=(Y7(K,Y)?-w:w)*N;else if(X)w=S/N,Y=K;else S=w*N,K=Y;let V=K?B+S:B,E=Y?T+w:T;return{width:f+(K?-S:S),height:C+(Y?-w:w),x:G[0]*S*(!K?1:-1)+V,y:G[1]*w*(!Y?1:-1)+E}}var i7={width:0,height:0,x:0,y:0},iq={...i7,pointerX:0,pointerY:0,aspectRatio:1};function rq(_,Q,J){let q=Q.position.x+_.position.x,U=Q.position.y+_.position.y,G=_.measured.width??0,Z=_.measured.height??0,F=J[0]*G,K=J[1]*Z;return[[q-F,U-K],[q+G-F,U+Z-K]]}function r7({domNode:_,nodeId:Q,getStoreItems:J,onChange:q,onEnd:U}){let G=m1(_),Z={controlDirection:X7("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function F({controlPosition:Y,boundaries:X,keepAspectRatio:H,resizeDirection:L,onResizeStart:W,onResize:A,onResizeEnd:I,shouldResize:R}){let M={...i7},O={...iq};Z={boundaries:X,resizeDirection:L,keepAspectRatio:H,controlDirection:X7(Y)};let B=void 0,T=null,f=[],C=void 0,N=void 0,S=void 0,w=Z5().on("start",(k)=>{let{nodeLookup:x,transform:r,snapGrid:m,snapToGrid:v,nodeOrigin:D,paneDomNode:V}=J();if(B=x.get(Q),!B)return;T=V?.getBoundingClientRect()??null;let{xSnapped:E,ySnapped:u}=N5(k.sourceEvent,{transform:r,snapGrid:m,snapToGrid:v,containerBounds:T});if(M={width:B.measured.width??0,height:B.measured.height??0,x:B.position.x??0,y:B.position.y??0},O={...M,pointerX:E,pointerY:u,aspectRatio:M.width/M.height},C=void 0,N=T2(B.extent)?B.extent:void 0,B.parentId&&(B.extent==="parent"||B.expandParent))C=x.get(B.parentId);if(C&&B.extent==="parent")N=[[0,0],[C.measured.width,C.measured.height]];f=[],S=void 0;for(let[b,P]of x)if(P.parentId===Q){if(f.push({id:b,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent){let y=rq(P,B,P.origin??D);if(S)S=[[Math.min(y[0][0],S[0][0]),Math.min(y[0][1],S[0][1])],[Math.max(y[1][0],S[1][0]),Math.max(y[1][1],S[1][1])]];else S=y}}W?.(k,{...M})}).on("drag",(k)=>{let{transform:x,snapGrid:r,snapToGrid:m,nodeOrigin:v}=J(),D=N5(k.sourceEvent,{transform:x,snapGrid:r,snapToGrid:m,containerBounds:T}),V=[];if(!B)return;let{x:E,y:u,width:b,height:P}=M,y={},p=B.origin??v,{width:h,height:e,x:t,y:o}=lq(O,Z.controlDirection,D,Z.boundaries,Z.keepAspectRatio,p,N,S),s=h!==b,g=e!==P,J1=t!==E&&s,U1=o!==u&&g;if(!J1&&!U1&&!s&&!g)return;let X1={prevValues:{...M},startX:O.x,startY:O.y,childNodes:f.map((Y1)=>({...Y1,position:{...Y1.position}}))};if(J1||U1||p[0]===1||p[1]===1){if(y.x=J1?t:M.x,y.y=U1?o:M.y,M.x=y.x,M.y=y.y,f.length>0){let Y1=t-E,Q1=o-u;for(let T1 of f)T1.position={x:T1.position.x-Y1+p[0]*(h-b),y:T1.position.y-Q1+p[1]*(e-P)},V.push(T1)}}if(s||g)y.width=s&&(!Z.resizeDirection||Z.resizeDirection==="horizontal")?h:M.width,y.height=g&&(!Z.resizeDirection||Z.resizeDirection==="vertical")?e:M.height,M.width=y.width,M.height=y.height;if(C&&B.expandParent){let Y1=p[0]*(y.width??0);if(y.x&&y.x<Y1)M.x=Y1,O.x=O.x-(y.x-Y1);let Q1=p[1]*(y.height??0);if(y.y&&y.y<Q1)M.y=Q1,O.y=O.y-(y.y-Q1)}let G1=cq({width:M.width,prevWidth:b,height:M.height,prevHeight:P,affectsX:Z.controlDirection.affectsX,affectsY:Z.controlDirection.affectsY}),F1={...M,direction:G1};if(R?.(k,F1)===!1){M=X1.prevValues,O.x=X1.startX,O.y=X1.startY,f.forEach((Y1,Q1)=>{Y1.position=X1.childNodes[Q1].position});return}A?.(k,F1),q(y,V)}).on("end",(k)=>{I?.(k,{...M}),U?.({...M})});G.call(w)}function K(){G.on(".drag",null)}return{update:F,destroy:K}}var n7=i1(O0(),1),e7=i1(a7(),1);var s7=(_)=>{let Q,J=new Set,q=(X,H)=>{let L=typeof X==="function"?X(Q):X;if(!Object.is(L,Q)){let W=Q;Q=(H!=null?H:typeof L!=="object"||L===null)?L:Object.assign({},Q,L),J.forEach((A)=>A(Q,W))}},U=()=>Q,K={setState:q,getState:U,getInitialState:()=>Y,subscribe:(X)=>{return J.add(X),()=>J.delete(X)},destroy:()=>{if((import.meta.env?import.meta.env.MODE:void 0)!=="production")console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");J.clear()}},Y=Q=_(q,U,K);return K},t7=(_)=>_?s7(_):s7;var{useDebugValue:sq}=n7.default,{useSyncExternalStoreWithSelector:tq}=e7.default,oq=(_)=>_;function D6(_,Q=oq,J){let q=tq(_.subscribe,_.getState,_.getServerState||_.getInitialState,Q,J);return sq(q),q}var o7=(_,Q)=>{let J=t7(_),q=(U,G=Q)=>D6(J,U,G);return Object.assign(q,J),q},_9=(_,Q)=>_?o7(_,Q):o7;function S1(_,Q){if(Object.is(_,Q))return!0;if(typeof _!=="object"||_===null||typeof Q!=="object"||Q===null)return!1;if(_ instanceof Map&&Q instanceof Map){if(_.size!==Q.size)return!1;for(let[q,U]of _)if(!Object.is(U,Q.get(q)))return!1;return!0}if(_ instanceof Set&&Q instanceof Set){if(_.size!==Q.size)return!1;for(let q of _)if(!Q.has(q))return!1;return!0}let J=Object.keys(_);if(J.length!==Object.keys(Q).length)return!1;for(let q of J)if(!Object.prototype.hasOwnProperty.call(Q,q)||!Object.is(_[q],Q[q]))return!1;return!0}var k9=i1($9(),1),v4=a.createContext(null),_U=v4.Provider,j9=_0.error001("react");function O1(_,Q){let J=a.useContext(v4);if(J===null)throw Error(j9);return D6(J,_,Q)}function v1(){let _=a.useContext(v4);if(_===null)throw Error(j9);return a.useMemo(()=>({getState:_.getState,setState:_.setState,subscribe:_.subscribe}),[_])}var q9={display:"none"},QU={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},V9="react-flow__node-desc",u9="react-flow__edge-desc",JU="react-flow__aria-live",$U=(_)=>_.ariaLiveMessage,qU=(_)=>_.ariaLabelConfig;function UU({rfId:_}){let Q=O1($U);return d.jsx("div",{id:`${JU}-${_}`,"aria-live":"assertive","aria-atomic":"true",style:QU,children:Q})}function GU({rfId:_,disableKeyboardA11y:Q}){let J=O1(qU);return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:`${V9}-${_}`,style:q9,children:Q?J["node.a11yDescription.default"]:J["node.a11yDescription.keyboardDisabled"]}),d.jsx("div",{id:`${u9}-${_}`,style:q9,children:J["edge.a11yDescription.default"]}),!Q&&d.jsx(UU,{rfId:_})]})}var C0=a.forwardRef(({position:_="top-left",children:Q,className:J,style:q,...U},G)=>{let Z=`${_}`.split("-");return d.jsx("div",{className:j1(["react-flow__panel",J,...Z]),style:q,ref:G,...U,children:Q})});C0.displayName="Panel";var U9="https://reactflow.dev/attribution";function ZU({proOptions:_,position:Q="bottom-right"}){if(a.useEffect(()=>{O7("react")},[]),_?.hideAttribution)return null;return d.jsx(C0,{position:Q,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${U9}`,children:d.jsx("a",{href:U9,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var FU=(_)=>{let Q=[],J=[];for(let[,q]of _.nodeLookup)if(q.selected)Q.push(q.internals.userNode);for(let[,q]of _.edgeLookup)if(q.selected)J.push(q);return{selectedNodes:Q,selectedEdges:J}},f4=(_)=>_.id;function HU(_,Q){return S1(_.selectedNodes.map(f4),Q.selectedNodes.map(f4))&&S1(_.selectedEdges.map(f4),Q.selectedEdges.map(f4))}function KU({onSelectionChange:_}){let Q=v1(),{selectedNodes:J,selectedEdges:q}=O1(FU,HU);return a.useEffect(()=>{let U={nodes:J,edges:q};_?.(U),Q.getState().onSelectionChangeHandlers.forEach((G)=>G(U))},[J,q,_]),null}var XU=(_)=>!!_.onSelectionChangeHandlers;function YU({onSelectionChange:_}){let Q=O1(XU);if(_||Q)return d.jsx(KU,{onSelectionChange:_});return null}var h9=[0,0],LU={x:0,y:0,zoom:1},zU=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],G9=[...zU,"rfId"],WU=(_)=>({setNodes:_.setNodes,setEdges:_.setEdges,setMinZoom:_.setMinZoom,setMaxZoom:_.setMaxZoom,setTranslateExtent:_.setTranslateExtent,setNodeExtent:_.setNodeExtent,reset:_.reset,setDefaultNodesAndEdges:_.setDefaultNodesAndEdges}),Z9={translateExtent:c2,nodeOrigin:h9,minZoom:0.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function AU(_){let{setNodes:Q,setEdges:J,setMinZoom:q,setMaxZoom:U,setTranslateExtent:G,setNodeExtent:Z,reset:F,setDefaultNodesAndEdges:K}=O1(WU,S1),Y=v1();a.useEffect(()=>{return K(_.defaultNodes,_.defaultEdges),()=>{X.current=Z9,F()}},[]);let X=a.useRef(Z9);return a.useEffect(()=>{for(let H of G9){let L=_[H],W=X.current[H];if(L===W)continue;if(typeof _[H]>"u")continue;if(H==="nodes")Q(L);else if(H==="edges")J(L);else if(H==="minZoom")q(L);else if(H==="maxZoom")U(L);else if(H==="translateExtent")G(L);else if(H==="nodeExtent")Z(L);else if(H==="ariaLabelConfig")Y.setState({ariaLabelConfig:R7(L)});else if(H==="fitView")Y.setState({fitViewQueued:L});else if(H==="fitViewOptions")Y.setState({fitViewOptions:L});else Y.setState({[H]:L})}X.current=_},G9.map((H)=>_[H])),null}function F9(){if(typeof window>"u"||!window.matchMedia)return null;return window.matchMedia("(prefers-color-scheme: dark)")}function BU(_){let[Q,J]=a.useState(_==="system"?null:_);return a.useEffect(()=>{if(_!=="system"){J(_);return}let q=F9(),U=()=>J(q?.matches?"dark":"light");return U(),q?.addEventListener("change",U),()=>{q?.removeEventListener("change",U)}},[_]),Q!==null?Q:F9()?.matches?"dark":"light"}var H9=typeof document<"u"?document:null;function k5(_=null,Q={target:H9,actInsideInputWithModifier:!0}){let[J,q]=a.useState(!1),U=a.useRef(!1),G=a.useRef(new Set([])),[Z,F]=a.useMemo(()=>{if(_!==null){let Y=(Array.isArray(_)?_:[_]).filter((H)=>typeof H==="string").map((H)=>H.replace(/\+/g,`
|
|
27
|
+
<%s key={someKey} {...props} />`,y,a,o,a),m[a+y]=!0)}if(a=null,D!==void 0&&(J(D),a=""+D),Z(V)&&(J(V.key),a=""+V.key),"key"in V){D={};for(var p in V)p!=="key"&&(D[p]=V[p])}else D=V;return a&&F(D,typeof I==="function"?I.displayName||I.name||"Unknown":I),Y(I,a,D,U(),t,_1)}function H(I){L(I)?I._store&&(I._store.validated=1):typeof I==="object"&&I!==null&&I.$$typeof===v&&(I._payload.status==="fulfilled"?L(I._payload.value)&&I._payload.value._store&&(I._payload.value._store.validated=1):I._store&&(I._store.validated=1))}function L(I){return typeof I==="object"&&I!==null&&I.$$typeof===z}var z=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),B=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),u=u2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,i=Object.prototype.hasOwnProperty,l=Array.isArray,S=console.createTask?console.createTask:function(){return null};u2={react_stack_bottom_frame:function(I){return I()}};var b,h={},E=u2.react_stack_bottom_frame.bind(u2,G)(),j=S(q(G)),m={};wZ.Fragment=w,wZ.jsxDEV=function(I,V,D,y){var t=1e4>u.recentlyCreatedOwnerStacks++;return K(I,V,D,y,t?Error("react-stack-top-frame"):E,t?S(q(I)):j)}})()});var c=_0(u0(),1);var r=_0(N8(),1),d=_0(u0(),1);function m1(_){if(typeof _==="string"||typeof _==="number")return""+_;let Q="";if(Array.isArray(_)){for(let J=0,q;J<_.length;J++)if((q=m1(_[J]))!=="")Q+=(Q&&" ")+q}else for(let J in _)if(_[J])Q+=(Q&&" ")+J;return Q}var JJ={value:()=>{}};function C8(){for(var _=0,Q=arguments.length,J={},q;_<Q;++_){if(!(q=arguments[_]+"")||q in J||/[\s.]/.test(q))throw Error("illegal type: "+q);J[q]=[]}return new n5(J)}function n5(_){this._=_}function $J(_,Q){return _.trim().split(/^|\s+/).map(function(J){var q="",U=J.indexOf(".");if(U>=0)q=J.slice(U+1),J=J.slice(0,U);if(J&&!Q.hasOwnProperty(J))throw Error("unknown type: "+J);return{type:J,name:q}})}n5.prototype=C8.prototype={constructor:n5,on:function(_,Q){var J=this._,q=$J(_+"",J),U,G=-1,Z=q.length;if(arguments.length<2){while(++G<Z)if((U=(_=q[G]).type)&&(U=qJ(J[U],_.name)))return U;return}if(Q!=null&&typeof Q!=="function")throw Error("invalid callback: "+Q);while(++G<Z)if(U=(_=q[G]).type)J[U]=f8(J[U],_.name,Q);else if(Q==null)for(U in J)J[U]=f8(J[U],_.name,null);return this},copy:function(){var _={},Q=this._;for(var J in Q)_[J]=Q[J].slice();return new n5(_)},call:function(_,Q){if((U=arguments.length-2)>0)for(var J=Array(U),q=0,U,G;q<U;++q)J[q]=arguments[q+2];if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(G=this._[_],q=0,U=G.length;q<U;++q)G[q].value.apply(Q,J)},apply:function(_,Q,J){if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(var q=this._[_],U=0,G=q.length;U<G;++U)q[U].value.apply(Q,J)}};function qJ(_,Q){for(var J=0,q=_.length,U;J<q;++J)if((U=_[J]).name===Q)return U.value}function f8(_,Q,J){for(var q=0,U=_.length;q<U;++q)if(_[q].name===Q){_[q]=JJ,_=_.slice(0,q).concat(_.slice(q+1));break}if(J!=null)_.push({name:Q,value:J});return _}var T2=C8;function l2(_){return function(){return this.matches(_)}}function e5(_){return function(Q){return Q.matches(_)}}var _4="http://www.w3.org/1999/xhtml",e4={svg:"http://www.w3.org/2000/svg",xhtml:_4,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function h0(_){var Q=_+="",J=Q.indexOf(":");if(J>=0&&(Q=_.slice(0,J))!=="xmlns")_=_.slice(J+1);return e4.hasOwnProperty(Q)?{space:e4[Q],local:_}:_}function _3(_){let Q;while(Q=_.sourceEvent)_=Q;return _}function $0(_,Q){if(_=_3(_),Q===void 0)Q=_.currentTarget;if(Q){var J=Q.ownerSVGElement||Q;if(J.createSVGPoint){var q=J.createSVGPoint();return q.x=_.clientX,q.y=_.clientY,q=q.matrixTransform(Q.getScreenCTM().inverse()),[q.x,q.y]}if(Q.getBoundingClientRect){var U=Q.getBoundingClientRect();return[_.clientX-U.left-Q.clientLeft,_.clientY-U.top-Q.clientTop]}}return[_.pageX,_.pageY]}function UJ(){}function Z2(_){return _==null?UJ:function(){return this.querySelector(_)}}function Q3(_){if(typeof _!=="function")_=Z2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=Array(Z),X,Y,K=0;K<Z;++K)if((X=G[K])&&(Y=_.call(X,X.__data__,K,G))){if("__data__"in X)Y.__data__=X.__data__;F[K]=Y}return new c1(q,this._parents)}function J3(_){return _==null?[]:Array.isArray(_)?_:Array.from(_)}function GJ(){return[]}function i2(_){return _==null?GJ:function(){return this.querySelectorAll(_)}}function ZJ(_){return function(){return J3(_.apply(this,arguments))}}function $3(_){if(typeof _==="function")_=ZJ(_);else _=i2(_);for(var Q=this._groups,J=Q.length,q=[],U=[],G=0;G<J;++G)for(var Z=Q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y])q.push(_.call(X,X.__data__,Y,Z)),U.push(X);return new c1(q,U)}var FJ=Array.prototype.find;function HJ(_){return function(){return FJ.call(this.children,_)}}function XJ(){return this.firstElementChild}function q3(_){return this.select(_==null?XJ:HJ(typeof _==="function"?_:e5(_)))}var KJ=Array.prototype.filter;function YJ(){return Array.from(this.children)}function LJ(_){return function(){return KJ.call(this.children,_)}}function U3(_){return this.selectAll(_==null?YJ:LJ(typeof _==="function"?_:e5(_)))}function G3(_){if(typeof _!=="function")_=l2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],X,Y=0;Y<Z;++Y)if((X=G[Y])&&_.call(X,X.__data__,Y,G))F.push(X);return new c1(q,this._parents)}function K5(_){return Array(_.length)}function Z3(){return new c1(this._enter||this._groups.map(K5),this._parents)}function Y5(_,Q){this.ownerDocument=_.ownerDocument,this.namespaceURI=_.namespaceURI,this._next=null,this._parent=_,this.__data__=Q}Y5.prototype={constructor:Y5,appendChild:function(_){return this._parent.insertBefore(_,this._next)},insertBefore:function(_,Q){return this._parent.insertBefore(_,Q)},querySelector:function(_){return this._parent.querySelector(_)},querySelectorAll:function(_){return this._parent.querySelectorAll(_)}};function F3(_){return function(){return _}}function zJ(_,Q,J,q,U,G){var Z=0,F,X=Q.length,Y=G.length;for(;Z<Y;++Z)if(F=Q[Z])F.__data__=G[Z],q[Z]=F;else J[Z]=new Y5(_,G[Z]);for(;Z<X;++Z)if(F=Q[Z])U[Z]=F}function WJ(_,Q,J,q,U,G,Z){var F,X,Y=new Map,K=Q.length,H=G.length,L=Array(K),z;for(F=0;F<K;++F)if(X=Q[F])if(L[F]=z=Z.call(X,X.__data__,F,Q)+"",Y.has(z))U[F]=X;else Y.set(z,X);for(F=0;F<H;++F)if(z=Z.call(_,G[F],F,G)+"",X=Y.get(z))q[F]=X,X.__data__=G[F],Y.delete(z);else J[F]=new Y5(_,G[F]);for(F=0;F<K;++F)if((X=Q[F])&&Y.get(L[F])===X)U[F]=X}function BJ(_){return _.__data__}function H3(_,Q){if(!arguments.length)return Array.from(this,BJ);var J=Q?WJ:zJ,q=this._parents,U=this._groups;if(typeof _!=="function")_=F3(_);for(var G=U.length,Z=Array(G),F=Array(G),X=Array(G),Y=0;Y<G;++Y){var K=q[Y],H=U[Y],L=H.length,z=AJ(_.call(K,K&&K.__data__,Y,q)),W=z.length,w=F[Y]=Array(W),R=Z[Y]=Array(W),A=X[Y]=Array(L);J(K,H,w,R,A,z,Q);for(var O=0,B=0,M,P;O<W;++O)if(M=w[O]){if(O>=B)B=O+1;while(!(P=R[B])&&++B<W);M._next=P||null}}return Z=new c1(Z,q),Z._enter=F,Z._exit=X,Z}function AJ(_){return typeof _==="object"&&"length"in _?_:Array.from(_)}function X3(){return new c1(this._exit||this._groups.map(K5),this._parents)}function K3(_,Q,J){var q=this.enter(),U=this,G=this.exit();if(typeof _==="function"){if(q=_(q),q)q=q.selection()}else q=q.append(_+"");if(Q!=null){if(U=Q(U),U)U=U.selection()}if(J==null)G.remove();else J(G);return q&&U?q.merge(U).order():U}function Y3(_){var Q=_.selection?_.selection():_;for(var J=this._groups,q=Q._groups,U=J.length,G=q.length,Z=Math.min(U,G),F=Array(U),X=0;X<Z;++X)for(var Y=J[X],K=q[X],H=Y.length,L=F[X]=Array(H),z,W=0;W<H;++W)if(z=Y[W]||K[W])L[W]=z;for(;X<U;++X)F[X]=J[X];return new c1(F,this._parents)}function L3(){for(var _=this._groups,Q=-1,J=_.length;++Q<J;)for(var q=_[Q],U=q.length-1,G=q[U],Z;--U>=0;)if(Z=q[U]){if(G&&Z.compareDocumentPosition(G)^4)G.parentNode.insertBefore(Z,G);G=Z}return this}function z3(_){if(!_)_=MJ;function Q(H,L){return H&&L?_(H.__data__,L.__data__):!H-!L}for(var J=this._groups,q=J.length,U=Array(q),G=0;G<q;++G){for(var Z=J[G],F=Z.length,X=U[G]=Array(F),Y,K=0;K<F;++K)if(Y=Z[K])X[K]=Y;X.sort(Q)}return new c1(U,this._parents).order()}function MJ(_,Q){return _<Q?-1:_>Q?1:_>=Q?0:NaN}function W3(){var _=arguments[0];return arguments[0]=this,_.apply(null,arguments),this}function B3(){return Array.from(this)}function A3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length;U<G;++U){var Z=q[U];if(Z)return Z}return null}function M3(){let _=0;for(let Q of this)++_;return _}function T3(){return!this.node()}function R3(_){for(var Q=this._groups,J=0,q=Q.length;J<q;++J)for(var U=Q[J],G=0,Z=U.length,F;G<Z;++G)if(F=U[G])_.call(F,F.__data__,G,U);return this}function TJ(_){return function(){this.removeAttribute(_)}}function RJ(_){return function(){this.removeAttributeNS(_.space,_.local)}}function OJ(_,Q){return function(){this.setAttribute(_,Q)}}function IJ(_,Q){return function(){this.setAttributeNS(_.space,_.local,Q)}}function wJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttribute(_);else this.setAttribute(_,J)}}function PJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttributeNS(_.space,_.local);else this.setAttributeNS(_.space,_.local,J)}}function O3(_,Q){var J=h0(_);if(arguments.length<2){var q=this.node();return J.local?q.getAttributeNS(J.space,J.local):q.getAttribute(J)}return this.each((Q==null?J.local?RJ:TJ:typeof Q==="function"?J.local?PJ:wJ:J.local?IJ:OJ)(J,Q))}function L5(_){return _.ownerDocument&&_.ownerDocument.defaultView||_.document&&_||_.defaultView}function NJ(_){return function(){this.style.removeProperty(_)}}function fJ(_,Q,J){return function(){this.style.setProperty(_,Q,J)}}function CJ(_,Q,J){return function(){var q=Q.apply(this,arguments);if(q==null)this.style.removeProperty(_);else this.style.setProperty(_,q,J)}}function I3(_,Q,J){return arguments.length>1?this.each((Q==null?NJ:typeof Q==="function"?CJ:fJ)(_,Q,J==null?"":J)):F2(this.node(),_)}function F2(_,Q){return _.style.getPropertyValue(Q)||L5(_).getComputedStyle(_,null).getPropertyValue(Q)}function SJ(_){return function(){delete this[_]}}function vJ(_,Q){return function(){this[_]=Q}}function kJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)delete this[_];else this[_]=J}}function w3(_,Q){return arguments.length>1?this.each((Q==null?SJ:typeof Q==="function"?kJ:vJ)(_,Q)):this.node()[_]}function S8(_){return _.trim().split(/^|\s+/)}function P3(_){return _.classList||new v8(_)}function v8(_){this._node=_,this._names=S8(_.getAttribute("class")||"")}v8.prototype={add:function(_){var Q=this._names.indexOf(_);if(Q<0)this._names.push(_),this._node.setAttribute("class",this._names.join(" "))},remove:function(_){var Q=this._names.indexOf(_);if(Q>=0)this._names.splice(Q,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(_){return this._names.indexOf(_)>=0}};function k8(_,Q){var J=P3(_),q=-1,U=Q.length;while(++q<U)J.add(Q[q])}function y8(_,Q){var J=P3(_),q=-1,U=Q.length;while(++q<U)J.remove(Q[q])}function yJ(_){return function(){k8(this,_)}}function jJ(_){return function(){y8(this,_)}}function VJ(_,Q){return function(){(Q.apply(this,arguments)?k8:y8)(this,_)}}function N3(_,Q){var J=S8(_+"");if(arguments.length<2){var q=P3(this.node()),U=-1,G=J.length;while(++U<G)if(!q.contains(J[U]))return!1;return!0}return this.each((typeof Q==="function"?VJ:Q?yJ:jJ)(J,Q))}function uJ(){this.textContent=""}function hJ(_){return function(){this.textContent=_}}function DJ(_){return function(){var Q=_.apply(this,arguments);this.textContent=Q==null?"":Q}}function f3(_){return arguments.length?this.each(_==null?uJ:(typeof _==="function"?DJ:hJ)(_)):this.node().textContent}function bJ(){this.innerHTML=""}function EJ(_){return function(){this.innerHTML=_}}function xJ(_){return function(){var Q=_.apply(this,arguments);this.innerHTML=Q==null?"":Q}}function C3(_){return arguments.length?this.each(_==null?bJ:(typeof _==="function"?xJ:EJ)(_)):this.node().innerHTML}function mJ(){if(this.nextSibling)this.parentNode.appendChild(this)}function S3(){return this.each(mJ)}function gJ(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function v3(){return this.each(gJ)}function pJ(_){return function(){var Q=this.ownerDocument,J=this.namespaceURI;return J===_4&&Q.documentElement.namespaceURI===_4?Q.createElement(_):Q.createElementNS(J,_)}}function cJ(_){return function(){return this.ownerDocument.createElementNS(_.space,_.local)}}function z5(_){var Q=h0(_);return(Q.local?cJ:pJ)(Q)}function k3(_){var Q=typeof _==="function"?_:z5(_);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})}function lJ(){return null}function y3(_,Q){var J=typeof _==="function"?_:z5(_),q=Q==null?lJ:typeof Q==="function"?Q:Z2(Q);return this.select(function(){return this.insertBefore(J.apply(this,arguments),q.apply(this,arguments)||null)})}function iJ(){var _=this.parentNode;if(_)_.removeChild(this)}function j3(){return this.each(iJ)}function rJ(){var _=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function dJ(){var _=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function V3(_){return this.select(_?dJ:rJ)}function u3(_){return arguments.length?this.property("__data__",_):this.node().__data__}function aJ(_){return function(Q){_.call(this,Q,this.__data__)}}function sJ(_){return _.trim().split(/^|\s+/).map(function(Q){var J="",q=Q.indexOf(".");if(q>=0)J=Q.slice(q+1),Q=Q.slice(0,q);return{type:Q,name:J}})}function tJ(_){return function(){var Q=this.__on;if(!Q)return;for(var J=0,q=-1,U=Q.length,G;J<U;++J)if(G=Q[J],(!_.type||G.type===_.type)&&G.name===_.name)this.removeEventListener(G.type,G.listener,G.options);else Q[++q]=G;if(++q)Q.length=q;else delete this.__on}}function oJ(_,Q,J){return function(){var q=this.__on,U,G=aJ(Q);if(q){for(var Z=0,F=q.length;Z<F;++Z)if((U=q[Z]).type===_.type&&U.name===_.name){this.removeEventListener(U.type,U.listener,U.options),this.addEventListener(U.type,U.listener=G,U.options=J),U.value=Q;return}}if(this.addEventListener(_.type,G,J),U={type:_.type,name:_.name,value:Q,listener:G,options:J},!q)this.__on=[U];else q.push(U)}}function h3(_,Q,J){var q=sJ(_+""),U,G=q.length,Z;if(arguments.length<2){var F=this.node().__on;if(F){for(var X=0,Y=F.length,K;X<Y;++X)for(U=0,K=F[X];U<G;++U)if((Z=q[U]).type===K.type&&Z.name===K.name)return K.value}return}F=Q?oJ:tJ;for(U=0;U<G;++U)this.each(F(q[U],Q,J));return this}function j8(_,Q,J){var q=L5(_),U=q.CustomEvent;if(typeof U==="function")U=new U(Q,J);else if(U=q.document.createEvent("Event"),J)U.initEvent(Q,J.bubbles,J.cancelable),U.detail=J.detail;else U.initEvent(Q,!1,!1);_.dispatchEvent(U)}function nJ(_,Q){return function(){return j8(this,_,Q)}}function eJ(_,Q){return function(){return j8(this,_,Q.apply(this,arguments))}}function D3(_,Q){return this.each((typeof Q==="function"?eJ:nJ)(_,Q))}function*b3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length,Z;U<G;++U)if(Z=q[U])yield Z}var E3=[null];function c1(_,Q){this._groups=_,this._parents=Q}function V8(){return new c1([[document.documentElement]],E3)}function _$(){return this}c1.prototype=V8.prototype={constructor:c1,select:Q3,selectAll:$3,selectChild:q3,selectChildren:U3,filter:G3,data:H3,enter:Z3,exit:X3,join:K3,merge:Y3,selection:_$,order:L3,sort:z3,call:W3,nodes:B3,node:A3,size:M3,empty:T3,each:R3,attr:O3,style:I3,property:w3,classed:N3,text:f3,html:C3,raise:S3,lower:v3,append:k3,insert:y3,remove:j3,clone:V3,datum:u3,on:h3,dispatch:D3,[Symbol.iterator]:b3};var i0=V8;function s1(_){return typeof _==="string"?new c1([[document.querySelector(_)]],[document.documentElement]):new c1([[_]],E3)}var u8={passive:!1},R2={capture:!0,passive:!1};function Q4(_){_.stopImmediatePropagation()}function r0(_){_.preventDefault(),_.stopImmediatePropagation()}function r2(_){var Q=_.document.documentElement,J=s1(_).on("dragstart.drag",r0,R2);if("onselectstart"in Q)J.on("selectstart.drag",r0,R2);else Q.__noselect=Q.style.MozUserSelect,Q.style.MozUserSelect="none"}function W5(_,Q){var J=_.document.documentElement,q=s1(_).on("dragstart.drag",null);if(Q)q.on("click.drag",r0,R2),setTimeout(function(){q.on("click.drag",null)},0);if("onselectstart"in J)q.on("selectstart.drag",null);else J.style.MozUserSelect=J.__noselect,delete J.__noselect}var B5=(_)=>()=>_;function A5(_,{sourceEvent:Q,subject:J,target:q,identifier:U,active:G,x:Z,y:F,dx:X,dy:Y,dispatch:K}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},subject:{value:J,enumerable:!0,configurable:!0},target:{value:q,enumerable:!0,configurable:!0},identifier:{value:U,enumerable:!0,configurable:!0},active:{value:G,enumerable:!0,configurable:!0},x:{value:Z,enumerable:!0,configurable:!0},y:{value:F,enumerable:!0,configurable:!0},dx:{value:X,enumerable:!0,configurable:!0},dy:{value:Y,enumerable:!0,configurable:!0},_:{value:K}})}A5.prototype.on=function(){var _=this._.on.apply(this._,arguments);return _===this._?this:_};function Q$(_){return!_.ctrlKey&&!_.button}function J$(){return this.parentNode}function $$(_,Q){return Q==null?{x:_.x,y:_.y}:Q}function q$(){return navigator.maxTouchPoints||"ontouchstart"in this}function M5(){var _=Q$,Q=J$,J=$$,q=q$,U={},G=T2("start","drag","end"),Z=0,F,X,Y,K,H=0;function L(M){M.on("mousedown.drag",z).filter(q).on("touchstart.drag",R).on("touchmove.drag",A,u8).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function z(M,P){if(K||!_.call(this,M,P))return;var C=B(this,Q.call(this,M,P),M,P,"mouse");if(!C)return;s1(M.view).on("mousemove.drag",W,R2).on("mouseup.drag",w,R2),r2(M.view),Q4(M),Y=!1,F=M.clientX,X=M.clientY,C("start",M)}function W(M){if(r0(M),!Y){var P=M.clientX-F,C=M.clientY-X;Y=P*P+C*C>H}U.mouse("drag",M)}function w(M){s1(M.view).on("mousemove.drag mouseup.drag",null),W5(M.view,Y),r0(M),U.mouse("end",M)}function R(M,P){if(!_.call(this,M,P))return;var C=M.changedTouches,f=Q.call(this,M,P),v=C.length,N,k;for(N=0;N<v;++N)if(k=B(this,f,M,P,C[N].identifier,C[N]))Q4(M),k("start",M,C[N])}function A(M){var P=M.changedTouches,C=P.length,f,v;for(f=0;f<C;++f)if(v=U[P[f].identifier])r0(M),v("drag",M,P[f])}function O(M){var P=M.changedTouches,C=P.length,f,v;if(K)clearTimeout(K);K=setTimeout(function(){K=null},500);for(f=0;f<C;++f)if(v=U[P[f].identifier])Q4(M),v("end",M,P[f])}function B(M,P,C,f,v,N){var k=G.copy(),u=$0(N||C,P),i,l,S;if((S=J.call(M,new A5("beforestart",{sourceEvent:C,target:L,identifier:v,active:Z,x:u[0],y:u[1],dx:0,dy:0,dispatch:k}),f))==null)return;return i=S.x-u[0]||0,l=S.y-u[1]||0,function b(h,E,j){var m=u,I;switch(h){case"start":U[v]=b,I=Z++;break;case"end":delete U[v],--Z;case"drag":u=$0(j||E,P),I=Z;break}k.call(h,M,new A5(h,{sourceEvent:E,subject:S,target:L,identifier:v,active:I,x:u[0]+i,y:u[1]+l,dx:u[0]-m[0],dy:u[1]-m[1],dispatch:k}),f)}}return L.filter=function(M){return arguments.length?(_=typeof M==="function"?M:B5(!!M),L):_},L.container=function(M){return arguments.length?(Q=typeof M==="function"?M:B5(M),L):Q},L.subject=function(M){return arguments.length?(J=typeof M==="function"?M:B5(M),L):J},L.touchable=function(M){return arguments.length?(q=typeof M==="function"?M:B5(!!M),L):q},L.on=function(){var M=G.on.apply(G,arguments);return M===G?L:M},L.clickDistance=function(M){return arguments.length?(H=(M=+M)*M,L):Math.sqrt(H)},L}function T5(_,Q,J){_.prototype=Q.prototype=J,J.constructor=_}function x3(_,Q){var J=Object.create(_.prototype);for(var q in Q)J[q]=Q[q];return J}function I5(){}var R5=0.7,q4=1/R5,d2="\\s*([+-]?\\d+)\\s*",O5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",D0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",U$=/^#([0-9a-f]{3,8})$/,G$=new RegExp(`^rgb\\(${d2},${d2},${d2}\\)$`),Z$=new RegExp(`^rgb\\(${D0},${D0},${D0}\\)$`),F$=new RegExp(`^rgba\\(${d2},${d2},${d2},${O5}\\)$`),H$=new RegExp(`^rgba\\(${D0},${D0},${D0},${O5}\\)$`),X$=new RegExp(`^hsl\\(${O5},${D0},${D0}\\)$`),K$=new RegExp(`^hsla\\(${O5},${D0},${D0},${O5}\\)$`),h8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};T5(I5,f0,{copy(_){return Object.assign(new this.constructor,this,_)},displayable(){return this.rgb().displayable()},hex:D8,formatHex:D8,formatHex8:Y$,formatHsl:L$,formatRgb:b8,toString:b8});function D8(){return this.rgb().formatHex()}function Y$(){return this.rgb().formatHex8()}function L$(){return c8(this).formatHsl()}function b8(){return this.rgb().formatRgb()}function f0(_){var Q,J;return _=(_+"").trim().toLowerCase(),(Q=U$.exec(_))?(J=Q[1].length,Q=parseInt(Q[1],16),J===6?E8(Q):J===3?new X0(Q>>8&15|Q>>4&240,Q>>4&15|Q&240,(Q&15)<<4|Q&15,1):J===8?J4(Q>>24&255,Q>>16&255,Q>>8&255,(Q&255)/255):J===4?J4(Q>>12&15|Q>>8&240,Q>>8&15|Q>>4&240,Q>>4&15|Q&240,((Q&15)<<4|Q&15)/255):null):(Q=G$.exec(_))?new X0(Q[1],Q[2],Q[3],1):(Q=Z$.exec(_))?new X0(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,1):(Q=F$.exec(_))?J4(Q[1],Q[2],Q[3],Q[4]):(Q=H$.exec(_))?J4(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,Q[4]):(Q=X$.exec(_))?g8(Q[1],Q[2]/100,Q[3]/100,1):(Q=K$.exec(_))?g8(Q[1],Q[2]/100,Q[3]/100,Q[4]):h8.hasOwnProperty(_)?E8(h8[_]):_==="transparent"?new X0(NaN,NaN,NaN,0):null}function E8(_){return new X0(_>>16&255,_>>8&255,_&255,1)}function J4(_,Q,J,q){if(q<=0)_=Q=J=NaN;return new X0(_,Q,J,q)}function z$(_){if(!(_ instanceof I5))_=f0(_);if(!_)return new X0;return _=_.rgb(),new X0(_.r,_.g,_.b,_.opacity)}function a2(_,Q,J,q){return arguments.length===1?z$(_):new X0(_,Q,J,q==null?1:q)}function X0(_,Q,J,q){this.r=+_,this.g=+Q,this.b=+J,this.opacity=+q}T5(X0,a2,x3(I5,{brighter(_){return _=_==null?q4:Math.pow(q4,_),new X0(this.r*_,this.g*_,this.b*_,this.opacity)},darker(_){return _=_==null?R5:Math.pow(R5,_),new X0(this.r*_,this.g*_,this.b*_,this.opacity)},rgb(){return this},clamp(){return new X0(I2(this.r),I2(this.g),I2(this.b),U4(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:x8,formatHex:x8,formatHex8:W$,formatRgb:m8,toString:m8}));function x8(){return`#${O2(this.r)}${O2(this.g)}${O2(this.b)}`}function W$(){return`#${O2(this.r)}${O2(this.g)}${O2(this.b)}${O2((isNaN(this.opacity)?1:this.opacity)*255)}`}function m8(){let _=U4(this.opacity);return`${_===1?"rgb(":"rgba("}${I2(this.r)}, ${I2(this.g)}, ${I2(this.b)}${_===1?")":`, ${_})`}`}function U4(_){return isNaN(_)?1:Math.max(0,Math.min(1,_))}function I2(_){return Math.max(0,Math.min(255,Math.round(_)||0))}function O2(_){return _=I2(_),(_<16?"0":"")+_.toString(16)}function g8(_,Q,J,q){if(q<=0)_=Q=J=NaN;else if(J<=0||J>=1)_=Q=NaN;else if(Q<=0)_=NaN;return new N0(_,Q,J,q)}function c8(_){if(_ instanceof N0)return new N0(_.h,_.s,_.l,_.opacity);if(!(_ instanceof I5))_=f0(_);if(!_)return new N0;if(_ instanceof N0)return _;_=_.rgb();var Q=_.r/255,J=_.g/255,q=_.b/255,U=Math.min(Q,J,q),G=Math.max(Q,J,q),Z=NaN,F=G-U,X=(G+U)/2;if(F){if(Q===G)Z=(J-q)/F+(J<q)*6;else if(J===G)Z=(q-Q)/F+2;else Z=(Q-J)/F+4;F/=X<0.5?G+U:2-G-U,Z*=60}else F=X>0&&X<1?0:Z;return new N0(Z,F,X,_.opacity)}function l8(_,Q,J,q){return arguments.length===1?c8(_):new N0(_,Q,J,q==null?1:q)}function N0(_,Q,J,q){this.h=+_,this.s=+Q,this.l=+J,this.opacity=+q}T5(N0,l8,x3(I5,{brighter(_){return _=_==null?q4:Math.pow(q4,_),new N0(this.h,this.s,this.l*_,this.opacity)},darker(_){return _=_==null?R5:Math.pow(R5,_),new N0(this.h,this.s,this.l*_,this.opacity)},rgb(){var _=this.h%360+(this.h<0)*360,Q=isNaN(_)||isNaN(this.s)?0:this.s,J=this.l,q=J+(J<0.5?J:1-J)*Q,U=2*J-q;return new X0(m3(_>=240?_-240:_+120,U,q),m3(_,U,q),m3(_<120?_+240:_-120,U,q),this.opacity)},clamp(){return new N0(p8(this.h),$4(this.s),$4(this.l),U4(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let _=U4(this.opacity);return`${_===1?"hsl(":"hsla("}${p8(this.h)}, ${$4(this.s)*100}%, ${$4(this.l)*100}%${_===1?")":`, ${_})`}`}}));function p8(_){return _=(_||0)%360,_<0?_+360:_}function $4(_){return Math.max(0,Math.min(1,_||0))}function m3(_,Q,J){return(_<60?Q+(J-Q)*_/60:_<180?J:_<240?Q+(J-Q)*(240-_)/60:Q)*255}function g3(_,Q,J,q,U){var G=_*_,Z=G*_;return((1-3*_+3*G-Z)*Q+(4-6*G+3*Z)*J+(1+3*_+3*G-3*Z)*q+Z*U)/6}function p3(_){var Q=_.length-1;return function(J){var q=J<=0?J=0:J>=1?(J=1,Q-1):Math.floor(J*Q),U=_[q],G=_[q+1],Z=q>0?_[q-1]:2*U-G,F=q<Q-1?_[q+2]:2*G-U;return g3((J-q/Q)*Q,Z,U,G,F)}}function c3(_){var Q=_.length;return function(J){var q=Math.floor(((J%=1)<0?++J:J)*Q),U=_[(q+Q-1)%Q],G=_[q%Q],Z=_[(q+1)%Q],F=_[(q+2)%Q];return g3((J-q/Q)*Q,U,G,Z,F)}}var w5=(_)=>()=>_;function B$(_,Q){return function(J){return _+J*Q}}function A$(_,Q,J){return _=Math.pow(_,J),Q=Math.pow(Q,J)-_,J=1/J,function(q){return Math.pow(_+q*Q,J)}}function i8(_){return(_=+_)===1?G4:function(Q,J){return J-Q?A$(Q,J,_):w5(isNaN(Q)?J:Q)}}function G4(_,Q){var J=Q-_;return J?B$(_,J):w5(isNaN(_)?Q:_)}var w2=function _(Q){var J=i8(Q);function q(U,G){var Z=J((U=a2(U)).r,(G=a2(G)).r),F=J(U.g,G.g),X=J(U.b,G.b),Y=G4(U.opacity,G.opacity);return function(K){return U.r=Z(K),U.g=F(K),U.b=X(K),U.opacity=Y(K),U+""}}return q.gamma=_,q}(1);function r8(_){return function(Q){var J=Q.length,q=Array(J),U=Array(J),G=Array(J),Z,F;for(Z=0;Z<J;++Z)F=a2(Q[Z]),q[Z]=F.r||0,U[Z]=F.g||0,G[Z]=F.b||0;return q=_(q),U=_(U),G=_(G),F.opacity=1,function(X){return F.r=q(X),F.g=U(X),F.b=G(X),F+""}}}var M$=r8(p3),T$=r8(c3);function l3(_,Q){if(!Q)Q=[];var J=_?Math.min(Q.length,_.length):0,q=Q.slice(),U;return function(G){for(U=0;U<J;++U)q[U]=_[U]*(1-G)+Q[U]*G;return q}}function d8(_){return ArrayBuffer.isView(_)&&!(_ instanceof DataView)}function a8(_,Q){var J=Q?Q.length:0,q=_?Math.min(J,_.length):0,U=Array(q),G=Array(J),Z;for(Z=0;Z<q;++Z)U[Z]=b0(_[Z],Q[Z]);for(;Z<J;++Z)G[Z]=Q[Z];return function(F){for(Z=0;Z<q;++Z)G[Z]=U[Z](F);return G}}function i3(_,Q){var J=new Date;return _=+_,Q=+Q,function(q){return J.setTime(_*(1-q)+Q*q),J}}function q0(_,Q){return _=+_,Q=+Q,function(J){return _*(1-J)+Q*J}}function r3(_,Q){var J={},q={},U;if(_===null||typeof _!=="object")_={};if(Q===null||typeof Q!=="object")Q={};for(U in Q)if(U in _)J[U]=b0(_[U],Q[U]);else q[U]=Q[U];return function(G){for(U in J)q[U]=J[U](G);return q}}var a3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,d3=new RegExp(a3.source,"g");function R$(_){return function(){return _}}function O$(_){return function(Q){return _(Q)+""}}function s2(_,Q){var J=a3.lastIndex=d3.lastIndex=0,q,U,G,Z=-1,F=[],X=[];_=_+"",Q=Q+"";while((q=a3.exec(_))&&(U=d3.exec(Q))){if((G=U.index)>J)if(G=Q.slice(J,G),F[Z])F[Z]+=G;else F[++Z]=G;if((q=q[0])===(U=U[0]))if(F[Z])F[Z]+=U;else F[++Z]=U;else F[++Z]=null,X.push({i:Z,x:q0(q,U)});J=d3.lastIndex}if(J<Q.length)if(G=Q.slice(J),F[Z])F[Z]+=G;else F[++Z]=G;return F.length<2?X[0]?O$(X[0].x):R$(Q):(Q=X.length,function(Y){for(var K=0,H;K<Q;++K)F[(H=X[K]).i]=H.x(Y);return F.join("")})}function b0(_,Q){var J=typeof Q,q;return Q==null||J==="boolean"?w5(Q):(J==="number"?q0:J==="string"?(q=f0(Q))?(Q=q,w2):s2:Q instanceof f0?w2:Q instanceof Date?i3:d8(Q)?l3:Array.isArray(Q)?a8:typeof Q.valueOf!=="function"&&typeof Q.toString!=="function"||isNaN(Q)?r3:q0)(_,Q)}var s8=180/Math.PI,Z4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function F4(_,Q,J,q,U,G){var Z,F,X;if(Z=Math.sqrt(_*_+Q*Q))_/=Z,Q/=Z;if(X=_*J+Q*q)J-=_*X,q-=Q*X;if(F=Math.sqrt(J*J+q*q))J/=F,q/=F,X/=F;if(_*q<Q*J)_=-_,Q=-Q,X=-X,Z=-Z;return{translateX:U,translateY:G,rotate:Math.atan2(Q,_)*s8,skewX:Math.atan(X)*s8,scaleX:Z,scaleY:F}}var H4;function t8(_){let Q=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(_+"");return Q.isIdentity?Z4:F4(Q.a,Q.b,Q.c,Q.d,Q.e,Q.f)}function o8(_){if(_==null)return Z4;if(!H4)H4=document.createElementNS("http://www.w3.org/2000/svg","g");if(H4.setAttribute("transform",_),!(_=H4.transform.baseVal.consolidate()))return Z4;return _=_.matrix,F4(_.a,_.b,_.c,_.d,_.e,_.f)}function n8(_,Q,J,q){function U(Y){return Y.length?Y.pop()+" ":""}function G(Y,K,H,L,z,W){if(Y!==H||K!==L){var w=z.push("translate(",null,Q,null,J);W.push({i:w-4,x:q0(Y,H)},{i:w-2,x:q0(K,L)})}else if(H||L)z.push("translate("+H+Q+L+J)}function Z(Y,K,H,L){if(Y!==K){if(Y-K>180)K+=360;else if(K-Y>180)Y+=360;L.push({i:H.push(U(H)+"rotate(",null,q)-2,x:q0(Y,K)})}else if(K)H.push(U(H)+"rotate("+K+q)}function F(Y,K,H,L){if(Y!==K)L.push({i:H.push(U(H)+"skewX(",null,q)-2,x:q0(Y,K)});else if(K)H.push(U(H)+"skewX("+K+q)}function X(Y,K,H,L,z,W){if(Y!==H||K!==L){var w=z.push(U(z)+"scale(",null,",",null,")");W.push({i:w-4,x:q0(Y,H)},{i:w-2,x:q0(K,L)})}else if(H!==1||L!==1)z.push(U(z)+"scale("+H+","+L+")")}return function(Y,K){var H=[],L=[];return Y=_(Y),K=_(K),G(Y.translateX,Y.translateY,K.translateX,K.translateY,H,L),Z(Y.rotate,K.rotate,H,L),F(Y.skewX,K.skewX,H,L),X(Y.scaleX,Y.scaleY,K.scaleX,K.scaleY,H,L),Y=K=null,function(z){var W=-1,w=L.length,R;while(++W<w)H[(R=L[W]).i]=R.x(z);return H.join("")}}}var s3=n8(t8,"px, ","px)","deg)"),t3=n8(o8,", ",")",")");var I$=0.000000000001;function e8(_){return((_=Math.exp(_))+1/_)/2}function w$(_){return((_=Math.exp(_))-1/_)/2}function P$(_){return((_=Math.exp(2*_))-1)/(_+1)}var P2=function _(Q,J,q){function U(G,Z){var F=G[0],X=G[1],Y=G[2],K=Z[0],H=Z[1],L=Z[2],z=K-F,W=H-X,w=z*z+W*W,R,A;if(w<I$)A=Math.log(L/Y)/Q,R=function(f){return[F+f*z,X+f*W,Y*Math.exp(Q*f*A)]};else{var O=Math.sqrt(w),B=(L*L-Y*Y+q*w)/(2*Y*J*O),M=(L*L-Y*Y-q*w)/(2*L*J*O),P=Math.log(Math.sqrt(B*B+1)-B),C=Math.log(Math.sqrt(M*M+1)-M);A=(C-P)/Q,R=function(f){var v=f*A,N=e8(P),k=Y/(J*O)*(N*P$(Q*v+P)-w$(P));return[F+k*z,X+k*W,Y*N/e8(Q*v+P)]}}return R.duration=A*1000*Q/Math.SQRT2,R}return U.rho=function(G){var Z=Math.max(0.001,+G),F=Z*Z,X=F*F;return _(Z,F,X)},U}(Math.SQRT2,2,4);var t2=0,N5=0,P5=0,Q7=1000,X4,f5,K4=0,N2=0,Y4=0,C5=typeof performance==="object"&&performance.now?performance:Date,J7=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(_){setTimeout(_,17)};function v5(){return N2||(J7(N$),N2=C5.now()+Y4)}function N$(){N2=0}function S5(){this._call=this._time=this._next=null}S5.prototype=L4.prototype={constructor:S5,restart:function(_,Q,J){if(typeof _!=="function")throw TypeError("callback is not a function");if(J=(J==null?v5():+J)+(Q==null?0:+Q),!this._next&&f5!==this){if(f5)f5._next=this;else X4=this;f5=this}this._call=_,this._time=J,o3()},stop:function(){if(this._call)this._call=null,this._time=1/0,o3()}};function L4(_,Q,J){var q=new S5;return q.restart(_,Q,J),q}function $7(){v5(),++t2;var _=X4,Q;while(_){if((Q=N2-_._time)>=0)_._call.call(void 0,Q);_=_._next}--t2}function _7(){N2=(K4=C5.now())+Y4,t2=N5=0;try{$7()}finally{t2=0,C$(),N2=0}}function f$(){var _=C5.now(),Q=_-K4;if(Q>Q7)Y4-=Q,K4=_}function C$(){var _,Q=X4,J,q=1/0;while(Q)if(Q._call){if(q>Q._time)q=Q._time;_=Q,Q=Q._next}else J=Q._next,Q._next=null,Q=_?_._next=J:X4=J;f5=_,o3(q)}function o3(_){if(t2)return;if(N5)N5=clearTimeout(N5);var Q=_-N2;if(Q>24){if(_<1/0)N5=setTimeout(_7,_-C5.now()-Y4);if(P5)P5=clearInterval(P5)}else{if(!P5)K4=C5.now(),P5=setInterval(f$,Q7);t2=1,J7(_7)}}function k5(_,Q,J){var q=new S5;return Q=Q==null?0:+Q,q.restart((U)=>{q.stop(),_(U+Q)},Q,J),q}var S$=T2("start","end","cancel","interrupt"),v$=[],G7=0,q7=1,W4=2,z4=3,U7=4,B4=5,y5=6;function d0(_,Q,J,q,U,G){var Z=_.__transition;if(!Z)_.__transition={};else if(J in Z)return;k$(_,J,{name:Q,index:q,group:U,on:S$,tween:v$,time:G.time,delay:G.delay,duration:G.duration,ease:G.ease,timer:null,state:G7})}function j5(_,Q){var J=t1(_,Q);if(J.state>G7)throw Error("too late; already scheduled");return J}function Q0(_,Q){var J=t1(_,Q);if(J.state>z4)throw Error("too late; already running");return J}function t1(_,Q){var J=_.__transition;if(!J||!(J=J[Q]))throw Error("transition not found");return J}function k$(_,Q,J){var q=_.__transition,U;q[Q]=J,J.timer=L4(G,0,J.time);function G(Y){if(J.state=q7,J.timer.restart(Z,J.delay,J.time),J.delay<=Y)Z(Y-J.delay)}function Z(Y){var K,H,L,z;if(J.state!==q7)return X();for(K in q){if(z=q[K],z.name!==J.name)continue;if(z.state===z4)return k5(Z);if(z.state===U7)z.state=y5,z.timer.stop(),z.on.call("interrupt",_,_.__data__,z.index,z.group),delete q[K];else if(+K<Q)z.state=y5,z.timer.stop(),z.on.call("cancel",_,_.__data__,z.index,z.group),delete q[K]}if(k5(function(){if(J.state===z4)J.state=U7,J.timer.restart(F,J.delay,J.time),F(Y)}),J.state=W4,J.on.call("start",_,_.__data__,J.index,J.group),J.state!==W4)return;J.state=z4,U=Array(L=J.tween.length);for(K=0,H=-1;K<L;++K)if(z=J.tween[K].value.call(_,_.__data__,J.index,J.group))U[++H]=z;U.length=H+1}function F(Y){var K=Y<J.duration?J.ease.call(null,Y/J.duration):(J.timer.restart(X),J.state=B4,1),H=-1,L=U.length;while(++H<L)U[H].call(_,K);if(J.state===B4)J.on.call("end",_,_.__data__,J.index,J.group),X()}function X(){J.state=y5,J.timer.stop(),delete q[Q];for(var Y in q)return;delete _.__transition}}function H2(_,Q){var J=_.__transition,q,U,G=!0,Z;if(!J)return;Q=Q==null?null:Q+"";for(Z in J){if((q=J[Z]).name!==Q){G=!1;continue}U=q.state>W4&&q.state<B4,q.state=y5,q.timer.stop(),q.on.call(U?"interrupt":"cancel",_,_.__data__,q.index,q.group),delete J[Z]}if(G)delete _.__transition}function n3(_){return this.each(function(){H2(this,_)})}function y$(_,Q){var J,q;return function(){var U=Q0(this,_),G=U.tween;if(G!==J){q=J=G;for(var Z=0,F=q.length;Z<F;++Z)if(q[Z].name===Q){q=q.slice(),q.splice(Z,1);break}}U.tween=q}}function j$(_,Q,J){var q,U;if(typeof J!=="function")throw Error();return function(){var G=Q0(this,_),Z=G.tween;if(Z!==q){U=(q=Z).slice();for(var F={name:Q,value:J},X=0,Y=U.length;X<Y;++X)if(U[X].name===Q){U[X]=F;break}if(X===Y)U.push(F)}G.tween=U}}function e3(_,Q){var J=this._id;if(_+="",arguments.length<2){var q=t1(this.node(),J).tween;for(var U=0,G=q.length,Z;U<G;++U)if((Z=q[U]).name===_)return Z.value;return null}return this.each((Q==null?y$:j$)(J,_,Q))}function o2(_,Q,J){var q=_._id;return _.each(function(){var U=Q0(this,q);(U.value||(U.value={}))[Q]=J.apply(this,arguments)}),function(U){return t1(U,q).value[Q]}}function V5(_,Q){var J;return(typeof Q==="number"?q0:Q instanceof f0?w2:(J=f0(Q))?(Q=J,w2):s2)(_,Q)}function V$(_){return function(){this.removeAttribute(_)}}function u$(_){return function(){this.removeAttributeNS(_.space,_.local)}}function h$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttribute(_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function D$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttributeNS(_.space,_.local);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function b$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),X;if(F==null)return void this.removeAttribute(_);return Z=this.getAttribute(_),X=F+"",Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function E$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),X;if(F==null)return void this.removeAttributeNS(_.space,_.local);return Z=this.getAttributeNS(_.space,_.local),X=F+"",Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function _6(_,Q){var J=h0(_),q=J==="transform"?t3:V5;return this.attrTween(_,typeof Q==="function"?(J.local?E$:b$)(J,q,o2(this,"attr."+_,Q)):Q==null?(J.local?u$:V$)(J):(J.local?D$:h$)(J,q,Q))}function x$(_,Q){return function(J){this.setAttribute(_,Q.call(this,J))}}function m$(_,Q){return function(J){this.setAttributeNS(_.space,_.local,Q.call(this,J))}}function g$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&m$(_,G);return J}return U._value=Q,U}function p$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&x$(_,G);return J}return U._value=Q,U}function Q6(_,Q){var J="attr."+_;if(arguments.length<2)return(J=this.tween(J))&&J._value;if(Q==null)return this.tween(J,null);if(typeof Q!=="function")throw Error();var q=h0(_);return this.tween(J,(q.local?g$:p$)(q,Q))}function c$(_,Q){return function(){j5(this,_).delay=+Q.apply(this,arguments)}}function l$(_,Q){return Q=+Q,function(){j5(this,_).delay=Q}}function J6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?c$:l$)(Q,_)):t1(this.node(),Q).delay}function i$(_,Q){return function(){Q0(this,_).duration=+Q.apply(this,arguments)}}function r$(_,Q){return Q=+Q,function(){Q0(this,_).duration=Q}}function $6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?i$:r$)(Q,_)):t1(this.node(),Q).duration}function d$(_,Q){if(typeof Q!=="function")throw Error();return function(){Q0(this,_).ease=Q}}function q6(_){var Q=this._id;return arguments.length?this.each(d$(Q,_)):t1(this.node(),Q).ease}function a$(_,Q){return function(){var J=Q.apply(this,arguments);if(typeof J!=="function")throw Error();Q0(this,_).ease=J}}function U6(_){if(typeof _!=="function")throw Error();return this.each(a$(this._id,_))}function G6(_){if(typeof _!=="function")_=l2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],X,Y=0;Y<Z;++Y)if((X=G[Y])&&_.call(X,X.__data__,Y,G))F.push(X);return new F0(q,this._parents,this._name,this._id)}function Z6(_){if(_._id!==this._id)throw Error();for(var Q=this._groups,J=_._groups,q=Q.length,U=J.length,G=Math.min(q,U),Z=Array(q),F=0;F<G;++F)for(var X=Q[F],Y=J[F],K=X.length,H=Z[F]=Array(K),L,z=0;z<K;++z)if(L=X[z]||Y[z])H[z]=L;for(;F<q;++F)Z[F]=Q[F];return new F0(Z,this._parents,this._name,this._id)}function s$(_){return(_+"").trim().split(/^|\s+/).every(function(Q){var J=Q.indexOf(".");if(J>=0)Q=Q.slice(0,J);return!Q||Q==="start"})}function t$(_,Q,J){var q,U,G=s$(Q)?j5:Q0;return function(){var Z=G(this,_),F=Z.on;if(F!==q)(U=(q=F).copy()).on(Q,J);Z.on=U}}function F6(_,Q){var J=this._id;return arguments.length<2?t1(this.node(),J).on.on(_):this.each(t$(J,_,Q))}function o$(_){return function(){var Q=this.parentNode;for(var J in this.__transition)if(+J!==_)return;if(Q)Q.removeChild(this)}}function H6(){return this.on("end.remove",o$(this._id))}function X6(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=Z2(_);for(var q=this._groups,U=q.length,G=Array(U),Z=0;Z<U;++Z)for(var F=q[Z],X=F.length,Y=G[Z]=Array(X),K,H,L=0;L<X;++L)if((K=F[L])&&(H=_.call(K,K.__data__,L,F))){if("__data__"in K)H.__data__=K.__data__;Y[L]=H,d0(Y[L],Q,J,L,Y,t1(K,J))}return new F0(G,this._parents,Q,J)}function K6(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=i2(_);for(var q=this._groups,U=q.length,G=[],Z=[],F=0;F<U;++F)for(var X=q[F],Y=X.length,K,H=0;H<Y;++H)if(K=X[H]){for(var L=_.call(K,K.__data__,H,X),z,W=t1(K,J),w=0,R=L.length;w<R;++w)if(z=L[w])d0(z,Q,J,w,L,W);G.push(L),Z.push(K)}return new F0(G,Z,Q,J)}var n$=i0.prototype.constructor;function Y6(){return new n$(this._groups,this._parents)}function e$(_,Q){var J,q,U;return function(){var G=F2(this,_),Z=(this.style.removeProperty(_),F2(this,_));return G===Z?null:G===J&&Z===q?U:U=Q(J=G,q=Z)}}function Z7(_){return function(){this.style.removeProperty(_)}}function _q(_,Q,J){var q,U=J+"",G;return function(){var Z=F2(this,_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function Qq(_,Q,J){var q,U,G;return function(){var Z=F2(this,_),F=J(this),X=F+"";if(F==null)X=F=(this.style.removeProperty(_),F2(this,_));return Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function Jq(_,Q){var J,q,U,G="style."+Q,Z="end."+G,F;return function(){var X=Q0(this,_),Y=X.on,K=X.value[G]==null?F||(F=Z7(Q)):void 0;if(Y!==J||U!==K)(q=(J=Y).copy()).on(Z,U=K);X.on=q}}function L6(_,Q,J){var q=(_+="")==="transform"?s3:V5;return Q==null?this.styleTween(_,e$(_,q)).on("end.style."+_,Z7(_)):typeof Q==="function"?this.styleTween(_,Qq(_,q,o2(this,"style."+_,Q))).each(Jq(this._id,_)):this.styleTween(_,_q(_,q,Q),J).on("end.style."+_,null)}function $q(_,Q,J){return function(q){this.style.setProperty(_,Q.call(this,q),J)}}function qq(_,Q,J){var q,U;function G(){var Z=Q.apply(this,arguments);if(Z!==U)q=(U=Z)&&$q(_,Z,J);return q}return G._value=Q,G}function z6(_,Q,J){var q="style."+(_+="");if(arguments.length<2)return(q=this.tween(q))&&q._value;if(Q==null)return this.tween(q,null);if(typeof Q!=="function")throw Error();return this.tween(q,qq(_,Q,J==null?"":J))}function Uq(_){return function(){this.textContent=_}}function Gq(_){return function(){var Q=_(this);this.textContent=Q==null?"":Q}}function W6(_){return this.tween("text",typeof _==="function"?Gq(o2(this,"text",_)):Uq(_==null?"":_+""))}function Zq(_){return function(Q){this.textContent=_.call(this,Q)}}function Fq(_){var Q,J;function q(){var U=_.apply(this,arguments);if(U!==J)Q=(J=U)&&Zq(U);return Q}return q._value=_,q}function B6(_){var Q="text";if(arguments.length<1)return(Q=this.tween(Q))&&Q._value;if(_==null)return this.tween(Q,null);if(typeof _!=="function")throw Error();return this.tween(Q,Fq(_))}function A6(){var _=this._name,Q=this._id,J=A4();for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y]){var K=t1(X,Q);d0(X,_,J,Y,Z,{time:K.time+K.delay+K.duration,delay:0,duration:K.duration,ease:K.ease})}return new F0(q,this._parents,_,J)}function M6(){var _,Q,J=this,q=J._id,U=J.size();return new Promise(function(G,Z){var F={value:Z},X={value:function(){if(--U===0)G()}};if(J.each(function(){var Y=Q0(this,q),K=Y.on;if(K!==_)Q=(_=K).copy(),Q._.cancel.push(F),Q._.interrupt.push(F),Q._.end.push(X);Y.on=Q}),U===0)G()})}var Hq=0;function F0(_,Q,J,q){this._groups=_,this._parents=Q,this._name=J,this._id=q}function F7(_){return i0().transition(_)}function A4(){return++Hq}var a0=i0.prototype;F0.prototype=F7.prototype={constructor:F0,select:X6,selectAll:K6,selectChild:a0.selectChild,selectChildren:a0.selectChildren,filter:G6,merge:Z6,selection:Y6,transition:A6,call:a0.call,nodes:a0.nodes,node:a0.node,size:a0.size,empty:a0.empty,each:a0.each,on:F6,attr:_6,attrTween:Q6,style:L6,styleTween:z6,text:W6,textTween:B6,remove:H6,tween:e3,delay:J6,duration:$6,ease:q6,easeVarying:U6,end:M6,[Symbol.iterator]:a0[Symbol.iterator]};function M4(_){return((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2}var Xq={time:null,delay:0,duration:250,ease:M4};function Kq(_,Q){var J;while(!(J=_.__transition)||!(J=J[Q]))if(!(_=_.parentNode))throw Error(`transition ${Q} not found`);return J}function T6(_){var Q,J;if(_ instanceof F0)Q=_._id,_=_._name;else Q=A4(),(J=Xq).time=v5(),_=_==null?null:_+"";for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y])d0(X,_,Q,Y,Z,J||Kq(X,Q));return new F0(q,this._parents,_,Q)}i0.prototype.interrupt=n3;i0.prototype.transition=T6;var u5=(_)=>()=>_;function R6(_,{sourceEvent:Q,target:J,transform:q,dispatch:U}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},target:{value:J,enumerable:!0,configurable:!0},transform:{value:q,enumerable:!0,configurable:!0},_:{value:U}})}function C0(_,Q,J){this.k=_,this.x=Q,this.y=J}C0.prototype={constructor:C0,scale:function(_){return _===1?this:new C0(this.k*_,this.x,this.y)},translate:function(_,Q){return _===0&Q===0?this:new C0(this.k,this.x+this.k*_,this.y+this.k*Q)},apply:function(_){return[_[0]*this.k+this.x,_[1]*this.k+this.y]},applyX:function(_){return _*this.k+this.x},applyY:function(_){return _*this.k+this.y},invert:function(_){return[(_[0]-this.x)/this.k,(_[1]-this.y)/this.k]},invertX:function(_){return(_-this.x)/this.k},invertY:function(_){return(_-this.y)/this.k},rescaleX:function(_){return _.copy().domain(_.range().map(this.invertX,this).map(_.invert,_))},rescaleY:function(_){return _.copy().domain(_.range().map(this.invertY,this).map(_.invert,_))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var f2=new C0(1,0,0);h5.prototype=C0.prototype;function h5(_){while(!_.__zoom)if(!(_=_.parentNode))return f2;return _.__zoom}function T4(_){_.stopImmediatePropagation()}function C2(_){_.preventDefault(),_.stopImmediatePropagation()}function Yq(_){return(!_.ctrlKey||_.type==="wheel")&&!_.button}function Lq(){var _=this;if(_ instanceof SVGElement){if(_=_.ownerSVGElement||_,_.hasAttribute("viewBox"))return _=_.viewBox.baseVal,[[_.x,_.y],[_.x+_.width,_.y+_.height]];return[[0,0],[_.width.baseVal.value,_.height.baseVal.value]]}return[[0,0],[_.clientWidth,_.clientHeight]]}function H7(){return this.__zoom||f2}function zq(_){return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*(_.ctrlKey?10:1)}function Wq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bq(_,Q,J){var q=_.invertX(Q[0][0])-J[0][0],U=_.invertX(Q[1][0])-J[1][0],G=_.invertY(Q[0][1])-J[0][1],Z=_.invertY(Q[1][1])-J[1][1];return _.translate(U>q?(q+U)/2:Math.min(0,q)||Math.max(0,U),Z>G?(G+Z)/2:Math.min(0,G)||Math.max(0,Z))}function D5(){var _=Yq,Q=Lq,J=Bq,q=zq,U=Wq,G=[0,1/0],Z=[[-1/0,-1/0],[1/0,1/0]],F=250,X=P2,Y=T2("start","zoom","end"),K,H,L,z=500,W=150,w=0,R=10;function A(S){S.property("__zoom",H7).on("wheel.zoom",v,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",k).filter(U).on("touchstart.zoom",u).on("touchmove.zoom",i).on("touchend.zoom touchcancel.zoom",l).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}A.transform=function(S,b,h,E){var j=S.selection?S.selection():S;if(j.property("__zoom",H7),S!==j)P(S,b,h,E);else j.interrupt().each(function(){C(this,arguments).event(E).start().zoom(null,typeof b==="function"?b.apply(this,arguments):b).end()})},A.scaleBy=function(S,b,h,E){A.scaleTo(S,function(){var j=this.__zoom.k,m=typeof b==="function"?b.apply(this,arguments):b;return j*m},h,E)},A.scaleTo=function(S,b,h,E){A.transform(S,function(){var j=Q.apply(this,arguments),m=this.__zoom,I=h==null?M(j):typeof h==="function"?h.apply(this,arguments):h,V=m.invert(I),D=typeof b==="function"?b.apply(this,arguments):b;return J(B(O(m,D),I,V),j,Z)},h,E)},A.translateBy=function(S,b,h,E){A.transform(S,function(){return J(this.__zoom.translate(typeof b==="function"?b.apply(this,arguments):b,typeof h==="function"?h.apply(this,arguments):h),Q.apply(this,arguments),Z)},null,E)},A.translateTo=function(S,b,h,E,j){A.transform(S,function(){var m=Q.apply(this,arguments),I=this.__zoom,V=E==null?M(m):typeof E==="function"?E.apply(this,arguments):E;return J(f2.translate(V[0],V[1]).scale(I.k).translate(typeof b==="function"?-b.apply(this,arguments):-b,typeof h==="function"?-h.apply(this,arguments):-h),m,Z)},E,j)};function O(S,b){return b=Math.max(G[0],Math.min(G[1],b)),b===S.k?S:new C0(b,S.x,S.y)}function B(S,b,h){var E=b[0]-h[0]*S.k,j=b[1]-h[1]*S.k;return E===S.x&&j===S.y?S:new C0(S.k,E,j)}function M(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function P(S,b,h,E){S.on("start.zoom",function(){C(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(E).end()}).tween("zoom",function(){var j=this,m=arguments,I=C(j,m).event(E),V=Q.apply(j,m),D=h==null?M(V):typeof h==="function"?h.apply(j,m):h,y=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),t=j.__zoom,_1=typeof b==="function"?b.apply(j,m):b,a=X(t.invert(D).concat(y/t.k),_1.invert(D).concat(y/_1.k));return function(o){if(o===1)o=_1;else{var p=a(o),e=y/p[2];o=new C0(e,D[0]-p[0]*e,D[1]-p[1]*e)}I.zoom(null,o)}})}function C(S,b,h){return!h&&S.__zooming||new f(S,b)}function f(S,b){this.that=S,this.args=b,this.active=0,this.sourceEvent=null,this.extent=Q.apply(S,b),this.taps=0}f.prototype={event:function(S){if(S)this.sourceEvent=S;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(S,b){if(this.mouse&&S!=="mouse")this.mouse[1]=b.invert(this.mouse[0]);if(this.touch0&&S!=="touch")this.touch0[1]=b.invert(this.touch0[0]);if(this.touch1&&S!=="touch")this.touch1[1]=b.invert(this.touch1[0]);return this.that.__zoom=b,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(S){var b=s1(this.that).datum();Y.call(S,this.that,new R6(S,{sourceEvent:this.sourceEvent,target:A,type:S,transform:this.that.__zoom,dispatch:Y}),b)}};function v(S,...b){if(!_.apply(this,arguments))return;var h=C(this,b).event(S),E=this.__zoom,j=Math.max(G[0],Math.min(G[1],E.k*Math.pow(2,q.apply(this,arguments)))),m=$0(S);if(h.wheel){if(h.mouse[0][0]!==m[0]||h.mouse[0][1]!==m[1])h.mouse[1]=E.invert(h.mouse[0]=m);clearTimeout(h.wheel)}else if(E.k===j)return;else h.mouse=[m,E.invert(m)],H2(this),h.start();C2(S),h.wheel=setTimeout(I,W),h.zoom("mouse",J(B(O(E,j),h.mouse[0],h.mouse[1]),h.extent,Z));function I(){h.wheel=null,h.end()}}function N(S,...b){if(L||!_.apply(this,arguments))return;var h=S.currentTarget,E=C(this,b,!0).event(S),j=s1(S.view).on("mousemove.zoom",D,!0).on("mouseup.zoom",y,!0),m=$0(S,h),I=S.clientX,V=S.clientY;r2(S.view),T4(S),E.mouse=[m,this.__zoom.invert(m)],H2(this),E.start();function D(t){if(C2(t),!E.moved){var _1=t.clientX-I,a=t.clientY-V;E.moved=_1*_1+a*a>w}E.event(t).zoom("mouse",J(B(E.that.__zoom,E.mouse[0]=$0(t,h),E.mouse[1]),E.extent,Z))}function y(t){j.on("mousemove.zoom mouseup.zoom",null),W5(t.view,E.moved),C2(t),E.event(t).end()}}function k(S,...b){if(!_.apply(this,arguments))return;var h=this.__zoom,E=$0(S.changedTouches?S.changedTouches[0]:S,this),j=h.invert(E),m=h.k*(S.shiftKey?0.5:2),I=J(B(O(h,m),E,j),Q.apply(this,b),Z);if(C2(S),F>0)s1(this).transition().duration(F).call(P,I,E,S);else s1(this).call(A.transform,I,E,S)}function u(S,...b){if(!_.apply(this,arguments))return;var h=S.touches,E=h.length,j=C(this,b,S.changedTouches.length===E).event(S),m,I,V,D;T4(S);for(I=0;I<E;++I)if(V=h[I],D=$0(V,this),D=[D,this.__zoom.invert(D),V.identifier],!j.touch0)j.touch0=D,m=!0,j.taps=1+!!K;else if(!j.touch1&&j.touch0[2]!==D[2])j.touch1=D,j.taps=0;if(K)K=clearTimeout(K);if(m){if(j.taps<2)H=D[0],K=setTimeout(function(){K=null},z);H2(this),j.start()}}function i(S,...b){if(!this.__zooming)return;var h=C(this,b).event(S),E=S.changedTouches,j=E.length,m,I,V,D;C2(S);for(m=0;m<j;++m)if(I=E[m],V=$0(I,this),h.touch0&&h.touch0[2]===I.identifier)h.touch0[0]=V;else if(h.touch1&&h.touch1[2]===I.identifier)h.touch1[0]=V;if(I=h.that.__zoom,h.touch1){var y=h.touch0[0],t=h.touch0[1],_1=h.touch1[0],a=h.touch1[1],o=(o=_1[0]-y[0])*o+(o=_1[1]-y[1])*o,p=(p=a[0]-t[0])*p+(p=a[1]-t[1])*p;I=O(I,Math.sqrt(o/p)),V=[(y[0]+_1[0])/2,(y[1]+_1[1])/2],D=[(t[0]+a[0])/2,(t[1]+a[1])/2]}else if(h.touch0)V=h.touch0[0],D=h.touch0[1];else return;h.zoom("touch",J(B(I,V,D),h.extent,Z))}function l(S,...b){if(!this.__zooming)return;var h=C(this,b).event(S),E=S.changedTouches,j=E.length,m,I;if(T4(S),L)clearTimeout(L);L=setTimeout(function(){L=null},z);for(m=0;m<j;++m)if(I=E[m],h.touch0&&h.touch0[2]===I.identifier)delete h.touch0;else if(h.touch1&&h.touch1[2]===I.identifier)delete h.touch1;if(h.touch1&&!h.touch0)h.touch0=h.touch1,delete h.touch1;if(h.touch0)h.touch0[1]=this.__zoom.invert(h.touch0[0]);else if(h.end(),h.taps===2){if(I=$0(I,this),Math.hypot(H[0]-I[0],H[1]-I[1])<R){var V=s1(this).on("dblclick.zoom");if(V)V.apply(this,arguments)}}}return A.wheelDelta=function(S){return arguments.length?(q=typeof S==="function"?S:u5(+S),A):q},A.filter=function(S){return arguments.length?(_=typeof S==="function"?S:u5(!!S),A):_},A.touchable=function(S){return arguments.length?(U=typeof S==="function"?S:u5(!!S),A):U},A.extent=function(S){return arguments.length?(Q=typeof S==="function"?S:u5([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),A):Q},A.scaleExtent=function(S){return arguments.length?(G[0]=+S[0],G[1]=+S[1],A):[G[0],G[1]]},A.translateExtent=function(S){return arguments.length?(Z[0][0]=+S[0][0],Z[1][0]=+S[1][0],Z[0][1]=+S[0][1],Z[1][1]=+S[1][1],A):[[Z[0][0],Z[0][1]],[Z[1][0],Z[1][1]]]},A.constrain=function(S){return arguments.length?(J=S,A):J},A.duration=function(S){return arguments.length?(F=+S,A):F},A.interpolate=function(S){return arguments.length?(X=S,A):X},A.on=function(){var S=Y.on.apply(Y,arguments);return S===Y?A:S},A.clickDistance=function(S){return arguments.length?(w=(S=+S)*S,A):Math.sqrt(w)},A.tapDistance=function(S){return arguments.length?(R=+S,A):R},A}var H0={error001:(_="react")=>`Seems like you have not used ${_==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${_}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:(_)=>`Node type "${_}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:(_)=>`The old edge with id=${_} does not exist.`,error009:(_)=>`Marker type "${_}" doesn't exist.`,error008:(_,{id:Q,sourceHandle:J,targetHandle:q})=>`Couldn't create edge for ${_} handle id: "${_==="source"?J:q}", edge id: ${Q}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:(_)=>`Edge type "${_}" not found. Using fallback type "default".`,error012:(_)=>`Node with id "${_}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(_="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${_}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:(_)=>`Edge with id "${_}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Q5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],N6=["Enter"," ","Escape"],f6={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:_,x:Q,y:J})=>`Moved selected node ${_}. New position, x: ${Q}, y: ${J}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},L2;(function(_){_.Strict="strict",_.Loose="loose"})(L2||(L2={}));var s0;(function(_){_.Free="free",_.Vertical="vertical",_.Horizontal="horizontal"})(s0||(s0={}));var S2;(function(_){_.Partial="partial",_.Full="full"})(S2||(S2={}));var C6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},E0;(function(_){_.Bezier="default",_.Straight="straight",_.Step="step",_.SmoothStep="smoothstep",_.SimpleBezier="simplebezier"})(E0||(E0={}));var e2;(function(_){_.Arrow="arrow",_.ArrowClosed="arrowclosed"})(e2||(e2={}));var F1;(function(_){_.Left="left",_.Top="top",_.Right="right",_.Bottom="bottom"})(F1||(F1={}));var X7={[F1.Left]:F1.Right,[F1.Right]:F1.Left,[F1.Top]:F1.Bottom,[F1.Bottom]:F1.Top},S6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("source"in _)&&("target"in _),P7=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("position"in _)&&!("source"in _)&&!("target"in _),v6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("internals"in _)&&!("source"in _)&&!("target"in _);var E5=(_,Q=[0,0])=>{let{width:J,height:q}=R0(_),U=_.origin??Q,G=J*U[0],Z=q*U[1];return{x:_.position.x-G,y:_.position.y-Z}},k6=(_,Q={nodeOrigin:[0,0]})=>{if(!Q.nodeLookup)console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.");if(_.length===0)return{x:0,y:0,width:0,height:0};let J=!1,q=_.reduce((U,G)=>{let Z=typeof G==="string",F=!Q.nodeLookup&&!Z?G:void 0;if(Q.nodeLookup)F=Z?Q.nodeLookup.get(G):!v6(G)?Q.nodeLookup.get(G.id):G;if(!F)return U;return J=!0,N4(U,I4(F,Q.nodeOrigin))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return J?f4(q):{x:0,y:0,width:0,height:0}},j2=(_,Q={})=>{let J={x:1/0,y:1/0,x2:-1/0,y2:-1/0},q=!1;return _.forEach((U)=>{if(Q.filter===void 0||Q.filter(U))J=N4(J,I4(U)),q=!0}),q?f4(J):{x:0,y:0,width:0,height:0}},w4=(_,Q,[J,q,U]=[0,0,1],G=!1,Z=!1)=>{let F=(Q.x-J)/U,X=(Q.y-q)/U,Y=Q.width/U,K=Q.height/U,H=[];for(let L of _.values()){let{measured:z,selectable:W=!0,hidden:w=!1}=L;if(Z&&!W||w)continue;let R=z.width??L.width??L.initialWidth??0,A=z.height??L.height??L.initialHeight??0,{x:O,y:B}=L.internals.positionAbsolute,M=v7(F,X,Y,K,O,B,R,A),P=R*A,C=G&&M>0;if(!L.internals.handleBounds||C||M>=P||L.dragging)H.push(L)}return H},N7=(_,Q)=>{let J=new Set;return _.forEach((q)=>{J.add(q.id)}),Q.filter((q)=>J.has(q.source)||J.has(q.target))};function Aq(_,Q){let J=new Map,q=Q?.nodes?new Set(Q.nodes.map((U)=>U.id)):null;return _.forEach((U)=>{let G;if(Q?.includeHiddenNodes){let{width:Z,height:F}=R0(U);G=Z>0&&F>0}else G=Boolean(U.measured.width&&U.measured.height&&!U.hidden);if(G&&(!q||q.has(U.id)))J.set(U.id,U)}),J}async function f7({nodes:_,width:Q,height:J,panZoom:q,minZoom:U,maxZoom:G},Z){if(_.size===0)return!0;let F=Aq(_,Z),X=j2(F),Y=m5(X,Q,J,Z?.minZoom??U,Z?.maxZoom??G,Z?.padding??0.1);return await q.setViewport(Y,{duration:Z?.duration,ease:Z?.ease,interpolate:Z?.interpolate}),!0}function y6({nodeId:_,nextPosition:Q,nodeLookup:J,nodeOrigin:q=[0,0],nodeExtent:U,onError:G}){let Z=J.get(_),F=Z.parentId?J.get(Z.parentId):void 0,{x:X,y:Y}=F?F.internals.positionAbsolute:{x:0,y:0},K=Z.origin??q,H=Z.extent||U;if(Z.extent==="parent"&&!Z.expandParent)if(!F)G?.("005",H0.error005());else{let{width:z,height:W}=R0(F);if(z&&W)H=[[X,Y],[X+z,Y+W]]}else if(F&&y2(Z.extent))H=[[Z.extent[0][0]+X,Z.extent[0][1]+Y],[Z.extent[1][0]+X,Z.extent[1][1]+Y]];let L=y2(H)?v2(Q,H,Z.measured):Q;if(Z.measured.width===void 0||Z.measured.height===void 0)G?.("015",H0.error015());return{position:{x:L.x-X+(Z.measured.width??0)*K[0],y:L.y-Y+(Z.measured.height??0)*K[1]},positionAbsolute:L}}async function C7({nodesToRemove:_=[],edgesToRemove:Q=[],nodes:J,edges:q,onBeforeDelete:U}){let G=new Set(_.map((L)=>L.id)),Z=[];for(let L of J){if(L.deletable===!1)continue;let z=G.has(L.id),W=!z&&L.parentId&&Z.find((w)=>w.id===L.parentId);if(z||W)Z.push(L)}let F=new Set(Q.map((L)=>L.id)),X=q.filter((L)=>L.deletable!==!1),K=N7(Z,X);for(let L of X)if(F.has(L.id)&&!K.find((W)=>W.id===L.id))K.push(L);if(!U)return{edges:K,nodes:Z};let H=await U({nodes:Z,edges:K});if(typeof H==="boolean")return H?{edges:K,nodes:Z}:{edges:[],nodes:[]};return H}var _5=(_,Q=0,J=1)=>Math.min(Math.max(_,Q),J),v2=(_={x:0,y:0},Q,J)=>({x:_5(_.x,Q[0][0],Q[1][0]-(J?.width??0)),y:_5(_.y,Q[0][1],Q[1][1]-(J?.height??0))});function S7(_,Q,J){let{width:q,height:U}=R0(J),{x:G,y:Z}=J.internals.positionAbsolute;return v2(_,[[G,Z],[G+q,Z+U]],Q)}var K7=(_,Q,J)=>{if(_<Q)return _5(Math.abs(_-Q),1,Q)/Q;else if(_>J)return-_5(Math.abs(_-J),1,Q)/Q;return 0},P4=(_,Q,J=15,q=40)=>{let U=K7(_.x,q,Q.width-q)*J,G=K7(_.y,q,Q.height-q)*J;return[U,G]},N4=(_,Q)=>({x:Math.min(_.x,Q.x),y:Math.min(_.y,Q.y),x2:Math.max(_.x2,Q.x2),y2:Math.max(_.y2,Q.y2)}),P6=({x:_,y:Q,width:J,height:q})=>({x:_,y:Q,x2:_+J,y2:Q+q}),f4=({x:_,y:Q,x2:J,y2:q})=>({x:_,y:Q,width:J-_,height:q-Q}),J5=(_,Q=[0,0])=>{let{x:J,y:q}=v6(_)?_.internals.positionAbsolute:E5(_,Q);return{x:J,y:q,width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}},I4=(_,Q=[0,0])=>{let{x:J,y:q}=v6(_)?_.internals.positionAbsolute:E5(_,Q);return{x:J,y:q,x2:J+(_.measured?.width??_.width??_.initialWidth??0),y2:q+(_.measured?.height??_.height??_.initialHeight??0)}},j6=(_,Q)=>f4(N4(P6(_),P6(Q))),v7=(_,Q,J,q,U,G,Z,F)=>{let X=Math.max(0,Math.min(_+J,U+Z)-Math.max(_,U)),Y=Math.max(0,Math.min(Q+q,G+F)-Math.max(Q,G));return Math.ceil(X*Y)},x5=(_,Q)=>v7(_.x,_.y,_.width,_.height,Q.x,Q.y,Q.width,Q.height),V6=(_)=>M0(_.width)&&M0(_.height)&&M0(_.x)&&M0(_.y),M0=(_)=>!isNaN(_)&&isFinite(_),u6=(_,Q)=>(J,q)=>{console.warn(`[${_}]: ${q} Help: ${Q}error#${J}`)},$5=(_,Q=[1,1])=>{return{x:Q[0]*Math.round(_.x/Q[0]),y:Q[1]*Math.round(_.y/Q[1])}},q5=({x:_,y:Q},[J,q,U],G=!1,Z=[1,1])=>{let F={x:(_-J)/U,y:(Q-q)/U};return G?$5(F,Z):F},k2=({x:_,y:Q},[J,q,U])=>{return{x:_*U+J,y:Q*U+q}};function n2(_,Q){if(typeof _==="number")return Math.floor((Q-Q/(1+_))*0.5);if(typeof _==="string"&&_.endsWith("px")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(J)}if(typeof _==="string"&&_.endsWith("%")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(Q*J*0.01)}return console.error(`The padding value "${_}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Mq(_,Q,J){if(typeof _==="string"||typeof _==="number"){let q=n2(_,J),U=n2(_,Q);return{top:q,right:U,bottom:q,left:U,x:U*2,y:q*2}}if(typeof _==="object"){let q=n2(_.top??_.y??0,J),U=n2(_.bottom??_.y??0,J),G=n2(_.left??_.x??0,Q),Z=n2(_.right??_.x??0,Q);return{top:q,right:Z,bottom:U,left:G,x:G+Z,y:q+U}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Tq(_,Q,J,q,U,G){let{x:Z,y:F}=k2(_,[Q,J,q]),{x:X,y:Y}=k2({x:_.x+_.width,y:_.y+_.height},[Q,J,q]),K=U-X,H=G-Y;return{left:Math.floor(Z),top:Math.floor(F),right:Math.floor(K),bottom:Math.floor(H)}}var m5=(_,Q,J,q,U,G)=>{let Z=Mq(G,Q,J),F=(Q-Z.x)/_.width,X=(J-Z.y)/_.height,Y=Math.min(F,X),K=_5(Y,q,U),H=_.x+_.width/2,L=_.y+_.height/2,z=Q/2-H*K,W=J/2-L*K,w=Tq(_,z,W,K,Q,J),R={left:Math.min(w.left-Z.left,0),top:Math.min(w.top-Z.top,0),right:Math.min(w.right-Z.right,0),bottom:Math.min(w.bottom-Z.bottom,0)};return{x:z-R.left+R.right,y:W-R.top+R.bottom,zoom:K}},U5=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function y2(_){return _!==void 0&&_!==null&&_!=="parent"}function R0(_){return{width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}}function h6(_){return(_.measured?.width??_.width??_.initialWidth)!==void 0&&(_.measured?.height??_.height??_.initialHeight)!==void 0}function D6(_,Q={width:0,height:0},J,q,U){let G={..._},Z=q.get(J);if(Z){let F=Z.origin||U;G.x+=Z.internals.positionAbsolute.x-(Q.width??0)*F[0],G.y+=Z.internals.positionAbsolute.y-(Q.height??0)*F[1]}return G}function b6(_,Q){if(_.size!==Q.size)return!1;for(let J of _)if(!Q.has(J))return!1;return!0}function k7(){let _,Q;return{promise:new Promise((q,U)=>{_=q,Q=U}),resolve:_,reject:Q}}function y7(_){return{...f6,..._||{}}}function Rq(_){if(typeof document>"u")return!0;let Q=document.querySelector(`.${_}-flow__pane`);if(!Q||!Q.isConnected)return!0;let J=getComputedStyle(Q);if(J.display==="none")return!0;if(J.visibility==="hidden"||J.visibility==="collapse")return!0;if(J.opacity==="0")return!0;if(J.width==="0"&&J.height==="0")return!0;let q=Q.getBoundingClientRect();if(q.width===0&&q.height===0)return!0;let U=document.querySelector(`.${_}-flow__attribution`);if(!U||!U.isConnected)return!1;let G=getComputedStyle(U);if(G.display==="none")return!1;if(G.visibility==="hidden"||G.visibility==="collapse")return!1;if(G.opacity==="0")return!1;let Z=U.getBoundingClientRect();if(Z.width===0&&Z.height===0)return!1;return!0}var Y7=!1;function j7(_){if(Y7)return;Y7=!0;let Q=`${_.charAt(0).toUpperCase()+_.slice(1)} Flow`;setTimeout(()=>{if(!Rq(_))console.warn(`${Q}: It seems like you are hiding the attribution. Please only do this when you are subscribed to ${Q} Pro: https://${_}flow.dev/remove-attr
|
|
28
|
+
%cYou can ignore this warning if you are subscribed.`,"font-style: italic;")},1000)}function E6(_){return _===null?null:_?"valid":"invalid"}function b5(_,{snapGrid:Q=[0,0],snapToGrid:J=!1,transform:q,containerBounds:U}){let{x:G,y:Z}=T0(_),F=q5({x:G-(U?.left??0),y:Z-(U?.top??0)},q),{x:X,y:Y}=J?$5(F,Q):F;return{xSnapped:X,ySnapped:Y,...F}}var C4=(_)=>({width:_.offsetWidth,height:_.offsetHeight}),x6=(_)=>_?.getRootNode?.()||window?.document,Oq=["INPUT","SELECT","TEXTAREA"];function m6(_){let Q=_.composedPath?.()?.[0]||_.target;if(Q?.nodeType!==1)return!1;return Oq.includes(Q.nodeName)||Q.hasAttribute("contenteditable")||!!Q.closest(".nokey")}var g6=(_)=>("clientX"in _),T0=(_,Q)=>{let J=g6(_),q=J?_.clientX:_.touches?.[0].clientX,U=J?_.clientY:_.touches?.[0].clientY;return{x:q-(Q?.left??0),y:U-(Q?.top??0)}},L7=(_,Q,J,q,U)=>{let G=Q.querySelectorAll(`.${_}`);if(!G||!G.length)return null;return Array.from(G).map((Z)=>{let F=Z.getBoundingClientRect();return{id:Z.getAttribute("data-handleid"),type:_,nodeId:U,position:Z.getAttribute("data-handlepos"),x:(F.left-J.left)/q,y:(F.top-J.top)/q,...C4(Z)}})};function S4({sourceX:_,sourceY:Q,targetX:J,targetY:q,sourceControlX:U,sourceControlY:G,targetControlX:Z,targetControlY:F}){let X=_*0.125+U*0.375+Z*0.375+J*0.125,Y=Q*0.125+G*0.375+F*0.375+q*0.125,K=Math.abs(X-_),H=Math.abs(Y-Q);return[X,Y,K,H]}function R4(_,Q){if(_>=0)return 0.5*_;return Q*25*Math.sqrt(-_)}function z7({pos:_,x1:Q,y1:J,x2:q,y2:U,c:G}){switch(_){case F1.Left:return[Q-R4(Q-q,G),J];case F1.Right:return[Q+R4(q-Q,G),J];case F1.Top:return[Q,J-R4(J-U,G)];case F1.Bottom:return[Q,J+R4(U-J,G)]}}function v4({sourceX:_,sourceY:Q,sourcePosition:J=F1.Bottom,targetX:q,targetY:U,targetPosition:G=F1.Top,curvature:Z=0.25}){let[F,X]=z7({pos:J,x1:_,y1:Q,x2:q,y2:U,c:Z}),[Y,K]=z7({pos:G,x1:q,y1:U,x2:_,y2:Q,c:Z}),[H,L,z,W]=S4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:F,sourceControlY:X,targetControlX:Y,targetControlY:K});return[`M${_},${Q} C${F},${X} ${Y},${K} ${q},${U}`,H,L,z,W]}function p6({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let U=Math.abs(J-_)/2,G=J<_?J+U:J-U,Z=Math.abs(q-Q)/2,F=q<Q?q+Z:q-Z;return[G,F,U,Z]}function V7({sourceNode:_,targetNode:Q,selected:J=!1,zIndex:q=0,elevateOnSelect:U=!1,zIndexMode:G="basic"}){if(G==="manual")return q;let Z=U&&J?q+1000:q,F=Math.max(_.parentId||U&&_.selected?_.internals.z:0,Q.parentId||U&&Q.selected?Q.internals.z:0);return Z+F}function u7({sourceNode:_,targetNode:Q,width:J,height:q,transform:U}){let G=N4(I4(_),I4(Q));if(G.x===G.x2)G.x2+=1;if(G.y===G.y2)G.y2+=1;let Z={x:-U[0]/U[2],y:-U[1]/U[2],width:J/U[2],height:q/U[2]};return x5(Z,f4(G))>0}var Iq=({source:_,sourceHandle:Q,target:J,targetHandle:q})=>`xy-edge__${_}${Q||""}-${J}${q||""}`,wq=(_,Q)=>{return Q.some((J)=>J.source===_.source&&J.target===_.target&&(J.sourceHandle===_.sourceHandle||!J.sourceHandle&&!_.sourceHandle)&&(J.targetHandle===_.targetHandle||!J.targetHandle&&!_.targetHandle))},h7=(_,Q,J={})=>{if(!_.source||!_.target)return J.onError?.("006",H0.error006()),Q;let q=J.getEdgeId||Iq,U;if(S6(_))U={..._};else U={..._,id:q(_)};if(wq(U,Q))return Q;if(U.sourceHandle===null)delete U.sourceHandle;if(U.targetHandle===null)delete U.targetHandle;return Q.concat(U)};function k4({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let[U,G,Z,F]=p6({sourceX:_,sourceY:Q,targetX:J,targetY:q});return[`M ${_},${Q}L ${J},${q}`,U,G,Z,F]}var W7={[F1.Left]:{x:-1,y:0},[F1.Right]:{x:1,y:0},[F1.Top]:{x:0,y:-1},[F1.Bottom]:{x:0,y:1}},Pq=({source:_,sourcePosition:Q=F1.Bottom,target:J})=>{if(Q===F1.Left||Q===F1.Right)return _.x<J.x?{x:1,y:0}:{x:-1,y:0};return _.y<J.y?{x:0,y:1}:{x:0,y:-1}},B7=(_,Q)=>Math.sqrt(Math.pow(Q.x-_.x,2)+Math.pow(Q.y-_.y,2));function Nq({source:_,sourcePosition:Q=F1.Bottom,target:J,targetPosition:q=F1.Top,center:U,offset:G,stepPosition:Z}){let F=W7[Q],X=W7[q],Y={x:_.x+F.x*G,y:_.y+F.y*G},K={x:J.x+X.x*G,y:J.y+X.y*G},H=Pq({source:Y,sourcePosition:Q,target:K}),L=H.x!==0?"x":"y",z=H[L],W=[],w,R,A={x:0,y:0},O={x:0,y:0},[,,B,M]=p6({sourceX:_.x,sourceY:_.y,targetX:J.x,targetY:J.y});if(F[L]*X[L]===-1){if(L==="x")w=U.x??Y.x+(K.x-Y.x)*Z,R=U.y??(Y.y+K.y)/2;else w=U.x??(Y.x+K.x)/2,R=U.y??Y.y+(K.y-Y.y)*Z;let v=[{x:w,y:Y.y},{x:w,y:K.y}],N=[{x:Y.x,y:R},{x:K.x,y:R}];if(F[L]===z)W=L==="x"?v:N;else W=L==="x"?N:v}else{let v=[{x:Y.x,y:K.y}],N=[{x:K.x,y:Y.y}];if(L==="x")W=F.x===z?N:v;else W=F.y===z?v:N;if(Q===q){let S=Math.abs(_[L]-J[L]);if(S<=G){let b=Math.min(G-1,G-S);if(F[L]===z)A[L]=(Y[L]>_[L]?-1:1)*b;else O[L]=(K[L]>J[L]?-1:1)*b}}if(Q!==q){let S=L==="x"?"y":"x",b=F[L]===X[S],h=Y[S]>K[S],E=Y[S]<K[S];if(F[L]===1&&(!b&&h||b&&E)||F[L]!==1&&(!b&&E||b&&h))W=L==="x"?v:N}let k={x:Y.x+A.x,y:Y.y+A.y},u={x:K.x+O.x,y:K.y+O.y},i=Math.max(Math.abs(k.x-W[0].x),Math.abs(u.x-W[0].x)),l=Math.max(Math.abs(k.y-W[0].y),Math.abs(u.y-W[0].y));if(i>=l)w=(k.x+u.x)/2,R=W[0].y;else w=W[0].x,R=(k.y+u.y)/2}let P={x:Y.x+A.x,y:Y.y+A.y},C={x:K.x+O.x,y:K.y+O.y};return[[_,...P.x!==W[0].x||P.y!==W[0].y?[P]:[],...W,...C.x!==W[W.length-1].x||C.y!==W[W.length-1].y?[C]:[],J],w,R,B,M]}function fq(_,Q,J,q){let U=Math.min(B7(_,Q)/2,B7(Q,J)/2,q),{x:G,y:Z}=Q;if(_.x===G&&G===J.x||_.y===Z&&Z===J.y)return`L${G} ${Z}`;if(_.y===Z){let Y=_.x<J.x?-1:1,K=_.y<J.y?1:-1;return`L ${G+U*Y},${Z}Q ${G},${Z} ${G},${Z+U*K}`}let F=_.x<J.x?1:-1,X=_.y<J.y?-1:1;return`L ${G},${Z+U*X}Q ${G},${Z} ${G+U*F},${Z}`}function g5({sourceX:_,sourceY:Q,sourcePosition:J=F1.Bottom,targetX:q,targetY:U,targetPosition:G=F1.Top,borderRadius:Z=5,centerX:F,centerY:X,offset:Y=20,stepPosition:K=0.5}){let[H,L,z,W,w]=Nq({source:{x:_,y:Q},sourcePosition:J,target:{x:q,y:U},targetPosition:G,center:{x:F,y:X},offset:Y,stepPosition:K}),R=`M${H[0].x} ${H[0].y}`;for(let A=1;A<H.length-1;A++)R+=fq(H[A-1],H[A],H[A+1],Z);return R+=`L${H[H.length-1].x} ${H[H.length-1].y}`,[R,L,z,W,w]}function A7(_){return _&&!!(_.internals.handleBounds||_.handles?.length)&&!!(_.measured.width||_.width||_.initialWidth)}function D7(_){let{sourceNode:Q,targetNode:J}=_;if(!A7(Q)||!A7(J))return null;let q=Q.internals.handleBounds||M7(Q.handles),U=J.internals.handleBounds||M7(J.handles),G=T7(q?.source??[],_.sourceHandle),Z=T7(_.connectionMode===L2.Strict?U?.target??[]:(U?.target??[]).concat(U?.source??[]),_.targetHandle);if(!G||!Z)return _.onError?.("008",H0.error008(!G?"source":"target",{id:_.id,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle})),null;let F=G?.position||F1.Bottom,X=Z?.position||F1.Top,Y=z2(Q,G,F),K=z2(J,Z,X);return{sourceX:Y.x,sourceY:Y.y,targetX:K.x,targetY:K.y,sourcePosition:F,targetPosition:X}}function M7(_){if(!_)return null;let Q=[],J=[];for(let q of _)if(q.width=q.width??1,q.height=q.height??1,q.type==="source")Q.push(q);else if(q.type==="target")J.push(q);return{source:Q,target:J}}function z2(_,Q,J=F1.Left,q=!1){let U=(Q?.x??0)+_.internals.positionAbsolute.x,G=(Q?.y??0)+_.internals.positionAbsolute.y,{width:Z,height:F}=Q??R0(_);if(q)return{x:U+Z/2,y:G+F/2};switch(Q?.position??J){case F1.Top:return{x:U+Z/2,y:G};case F1.Right:return{x:U+Z,y:G+F/2};case F1.Bottom:return{x:U+Z/2,y:G+F};case F1.Left:return{x:U,y:G+F/2}}}function T7(_,Q){if(!_)return null;return(!Q?_[0]:_.find((J)=>J.id===Q))||null}function y4(_,Q){if(!_)return"";if(typeof _==="string")return _;return`${Q?`${Q}__`:""}${Object.keys(_).sort().map((q)=>`${q}=${_[q]}`).join("&")}`}function b7(_,{id:Q,defaultColor:J,defaultMarkerStart:q,defaultMarkerEnd:U}){let G=new Set;return _.reduce((Z,F)=>{return[F.markerStart||q,F.markerEnd||U].forEach((X)=>{if(X&&typeof X==="object"){let Y=y4(X,Q);if(!G.has(Y))Z.push({id:Y,color:X.color||J,...X}),G.add(Y)}}),Z},[]).sort((Z,F)=>Z.id.localeCompare(F.id))}function E7(_,Q,J,q,U){let G=0.5;if(U==="start")G=0;else if(U==="end")G=1;let Z=[(_.x+_.width*G)*Q.zoom+Q.x,_.y*Q.zoom+Q.y-q],F=[-100*G,-100];switch(J){case F1.Right:Z=[(_.x+_.width)*Q.zoom+Q.x+q,(_.y+_.height*G)*Q.zoom+Q.y],F=[0,-100*G];break;case F1.Bottom:Z[1]=(_.y+_.height)*Q.zoom+Q.y+q,F[1]=0;break;case F1.Left:Z=[_.x*Q.zoom+Q.x-q,(_.y+_.height*G)*Q.zoom+Q.y],F=[-100,-100*G];break}return`translate(${Z[0]}px, ${Z[1]}px) translate(${F[0]}%, ${F[1]}%)`}var x7=1000,Cq=10,c6={nodeOrigin:[0,0],nodeExtent:Q5,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Sq={...c6,checkEquality:!0};function l6(_,Q){let J={..._};for(let q in Q)if(Q[q]!==void 0)J[q]=Q[q];return J}function m7(_,Q,J){let q=l6(c6,J);for(let U of _.values())if(U.parentId)r6(U,_,Q,q);else{let G=E5(U,q.nodeOrigin),Z=y2(U.extent)?U.extent:q.nodeExtent,F=v2(G,Z,R0(U));U.internals.positionAbsolute=F}}function vq(_,Q){if(!_.handles)return!_.measured?void 0:Q?.internals.handleBounds;let J=[],q=[];for(let U of _.handles){let G={id:U.id,width:U.width??1,height:U.height??1,nodeId:_.id,x:U.x,y:U.y,position:U.position,type:U.type};if(U.type==="source")J.push(G);else if(U.type==="target")q.push(G)}return{source:J,target:q}}function i6(_){return _==="manual"}function j4(_,Q,J,q={}){let U=l6(Sq,q),G={i:0},Z=new Map(Q),F=U?.elevateNodesOnSelect&&!i6(U.zIndexMode)?x7:0,X=_.length>0,Y=!1;Q.clear(),J.clear();for(let K of _){let H=Z.get(K.id);if(U.checkEquality&&K===H?.internals.userNode)Q.set(K.id,H);else{let L=E5(K,U.nodeOrigin),z=y2(K.extent)?K.extent:U.nodeExtent,W=v2(L,z,R0(K));H={...U.defaults,...K,measured:{width:K.measured?.width,height:K.measured?.height},internals:{positionAbsolute:W,handleBounds:vq(K,H),z:g7(K,F,U.zIndexMode),userNode:K}},Q.set(K.id,H)}if((H.measured===void 0||H.measured.width===void 0||H.measured.height===void 0)&&!H.hidden)X=!1;if(K.parentId)r6(H,Q,J,q,G);Y||=K.selected??!1}return{nodesInitialized:X,hasSelectedNodes:Y}}function kq(_,Q){if(!_.parentId)return;let J=Q.get(_.parentId);if(J)J.set(_.id,_);else Q.set(_.parentId,new Map([[_.id,_]]))}function r6(_,Q,J,q,U){let{elevateNodesOnSelect:G,nodeOrigin:Z,nodeExtent:F,zIndexMode:X}=l6(c6,q),Y=_.parentId,K=Q.get(Y);if(!K){console.warn(`Parent node ${Y} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}if(kq(_,J),U&&!K.parentId&&K.internals.rootParentIndex===void 0&&X==="auto")K.internals.rootParentIndex=++U.i,K.internals.z=K.internals.z+U.i*Cq;if(U&&K.internals.rootParentIndex!==void 0)U.i=K.internals.rootParentIndex;let H=G&&!i6(X)?x7:0,{x:L,y:z,z:W}=yq(_,K,Z,F,H,X),{positionAbsolute:w}=_.internals,R=L!==w.x||z!==w.y;if(R||W!==_.internals.z)Q.set(_.id,{..._,internals:{..._.internals,positionAbsolute:R?{x:L,y:z}:w,z:W}})}function g7(_,Q,J){let q=M0(_.zIndex)?_.zIndex:0;if(i6(J))return q;return q+(_.selected?Q:0)}function yq(_,Q,J,q,U,G){let{x:Z,y:F}=Q.internals.positionAbsolute,X=R0(_),Y=E5(_,J),K=y2(_.extent)?v2(Y,_.extent,X):Y,H=v2({x:Z+K.x,y:F+K.y},q,X);if(_.extent==="parent")H=S7(H,X,Q);let L=g7(_,U,G),z=Q.internals.z??0;return{x:H.x,y:H.y,z:z>=L?z+1:L}}function V4(_,Q,J,q=[0,0]){let U=[],G=new Map;for(let Z of _){let F=Q.get(Z.parentId);if(!F)continue;let X=G.get(Z.parentId)?.expandedRect??J5(F),Y=j6(X,Z.rect);G.set(Z.parentId,{expandedRect:Y,parent:F})}if(G.size>0)G.forEach(({expandedRect:Z,parent:F},X)=>{let Y=F.internals.positionAbsolute,K=R0(F),H=F.origin??q,L=Z.x<Y.x?Math.round(Math.abs(Y.x-Z.x)):0,z=Z.y<Y.y?Math.round(Math.abs(Y.y-Z.y)):0,W=Math.max(K.width,Math.round(Z.width)),w=Math.max(K.height,Math.round(Z.height)),R=(W-K.width)*H[0],A=(w-K.height)*H[1];if(L>0||z>0||R||A)U.push({id:X,type:"position",position:{x:F.position.x-L+R,y:F.position.y-z+A}}),J.get(X)?.forEach((O)=>{if(!_.some((B)=>B.id===O.id))U.push({id:O.id,type:"position",position:{x:O.position.x+L,y:O.position.y+z}})});if(K.width<Z.width||K.height<Z.height||L||z)U.push({id:X,type:"dimensions",setAttributes:!0,dimensions:{width:W+(L?H[0]*L-R:0),height:w+(z?H[1]*z-A:0)}})});return U}function p7(_,Q,J,q,U,G,Z){let F=q?.querySelector(".xyflow__viewport"),X=!1;if(!F)return{changes:[],updatedInternals:X};let Y=[],K=window.getComputedStyle(F),{m22:H}=new window.DOMMatrixReadOnly(K.transform),L=[];for(let z of _.values()){let W=Q.get(z.id);if(!W)continue;if(W.hidden){Q.set(W.id,{...W,internals:{...W.internals,handleBounds:void 0}}),X=!0;continue}let w=C4(z.nodeElement),R=W.measured.width!==w.width||W.measured.height!==w.height;if(!!(w.width&&w.height&&(R||!W.internals.handleBounds||z.force))){let O=z.nodeElement.getBoundingClientRect(),B=y2(W.extent)?W.extent:G,{positionAbsolute:M}=W.internals;if(W.parentId&&W.extent==="parent"){let C=Q.get(W.parentId);if(C)M=S7(M,w,C)}else if(B)M=v2(M,B,w);let P={...W,measured:w,internals:{...W.internals,positionAbsolute:M,handleBounds:{source:L7("source",z.nodeElement,O,H,W.id),target:L7("target",z.nodeElement,O,H,W.id)}}};if(Q.set(W.id,P),W.parentId)r6(P,Q,J,{nodeOrigin:U,zIndexMode:Z});if(X=!0,R){if(Y.push({id:W.id,type:"dimensions",dimensions:w}),W.expandParent&&W.parentId)L.push({id:W.id,parentId:W.parentId,rect:J5(P,U)})}}}if(L.length>0){let z=V4(L,Q,J,U);Y.push(...z)}return{changes:Y,updatedInternals:X}}async function c7({delta:_,panZoom:Q,transform:J,translateExtent:q,width:U,height:G}){if(!Q||!_.x&&!_.y)return!1;let Z=await Q.setViewportConstrained({x:J[0]+_.x,y:J[1]+_.y,zoom:J[2]},[[0,0],[U,G]],q);return!!Z&&(Z.x!==J[0]||Z.y!==J[1]||Z.k!==J[2])}function R7(_,Q,J,q,U,G){let Z=U,F=q.get(Z)||new Map;q.set(Z,F.set(J,Q)),Z=`${U}-${_}`;let X=q.get(Z)||new Map;if(q.set(Z,X.set(J,Q)),G){Z=`${U}-${_}-${G}`;let Y=q.get(Z)||new Map;q.set(Z,Y.set(J,Q))}}function d6(_,Q,J){_.clear(),Q.clear();for(let q of J){let{source:U,target:G,sourceHandle:Z=null,targetHandle:F=null}=q,X={edgeId:q.id,source:U,target:G,sourceHandle:Z,targetHandle:F},Y=`${U}-${Z}--${G}-${F}`,K=`${G}-${F}--${U}-${Z}`;R7("source",X,K,_,U,Z),R7("target",X,Y,_,G,F),Q.set(q.id,q)}}function l7(_,Q){if(!_.parentId)return!1;let J=Q.get(_.parentId);if(!J)return!1;if(J.selected)return!0;return l7(J,Q)}function O7(_,Q,J){let q=_;do{if(q?.matches?.(Q))return!0;if(q===J)return!1;q=q?.parentElement}while(q);return!1}function jq(_,Q,J,q){let U=new Map;for(let[G,Z]of _)if((Z.selected||Z.id===q)&&(!Z.parentId||!l7(Z,_))&&(Z.draggable||Q&&typeof Z.draggable>"u")){let F=_.get(G);if(F)U.set(G,{id:G,position:F.position||{x:0,y:0},distance:{x:J.x-F.internals.positionAbsolute.x,y:J.y-F.internals.positionAbsolute.y},extent:F.extent,parentId:F.parentId,origin:F.origin,expandParent:F.expandParent,internals:{positionAbsolute:F.internals.positionAbsolute||{x:0,y:0}},measured:{width:F.measured.width??0,height:F.measured.height??0}})}return U}function O6({nodeId:_,dragItems:Q,nodeLookup:J,dragging:q=!0}){let U=[];for(let[Z,F]of Q){let X=J.get(Z)?.internals.userNode;if(X)U.push({...X,position:F.position,dragging:q})}if(!_)return[U[0],U];let G=J.get(_)?.internals.userNode;return[!G?U[0]:{...G,position:Q.get(_)?.position||G.position,dragging:q},U]}function Vq({dragItems:_,snapGrid:Q,x:J,y:q}){let U=_.values().next().value;if(!U)return null;let G={x:J-U.distance.x,y:q-U.distance.y},Z=$5(G,Q);return{x:Z.x-G.x,y:Z.y-G.y}}function i7({onNodeMouseDown:_,getStoreItems:Q,onDragStart:J,onDrag:q,onDragStop:U}){let G={x:null,y:null},Z=0,F=new Map,X=!1,Y={x:0,y:0},K=null,H=!1,L=null,z=!1,W=!1,w=null;function R({noDragClassName:O,handleSelector:B,domNode:M,isSelectable:P,nodeId:C,nodeClickDistance:f=0}){L=s1(M);function v({x:i,y:l}){let{nodeLookup:S,nodeExtent:b,snapGrid:h,snapToGrid:E,nodeOrigin:j,onNodeDrag:m,onSelectionDrag:I,onError:V,updateNodePositions:D}=Q();G={x:i,y:l};let y=!1,t=F.size>1,_1=t&&b?P6(j2(F)):null,a=t&&E?Vq({dragItems:F,snapGrid:h,x:i,y:l}):null;for(let[o,p]of F){if(!S.has(o))continue;let e={x:i-p.distance.x,y:l-p.distance.y};if(E)e=a?{x:Math.round(e.x+a.x),y:Math.round(e.y+a.y)}:$5(e,h);let $1=null;if(t&&b&&!p.extent&&_1){let{positionAbsolute:K1}=p.internals,W1=K1.x-_1.x+b[0][0],Y1=K1.x+p.measured.width-_1.x2+b[1][0],n=K1.y-_1.y+b[0][1],R1=K1.y+p.measured.height-_1.y2+b[1][1];$1=[[W1,n],[Y1,R1]]}let{position:U1,positionAbsolute:q1}=y6({nodeId:o,nextPosition:e,nodeLookup:S,nodeExtent:$1?$1:b,nodeOrigin:j,onError:V});y=y||p.position.x!==U1.x||p.position.y!==U1.y,p.position=U1,p.internals.positionAbsolute=q1}if(W=W||y,!y)return;if(D(F,!0),w&&(q||m||!C&&I)){let[o,p]=O6({nodeId:C,dragItems:F,nodeLookup:S});if(q?.(w,F,o,p),m?.(w,o,p),!C)I?.(w,p)}}async function N(){if(!K)return;let{transform:i,panBy:l,autoPanSpeed:S,autoPanOnNodeDrag:b}=Q();if(!b){X=!1,cancelAnimationFrame(Z);return}let[h,E]=P4(Y,K,S);if(h!==0||E!==0){if(G.x=(G.x??0)-h/i[2],G.y=(G.y??0)-E/i[2],await l({x:h,y:E}))v(G)}Z=requestAnimationFrame(N)}function k(i){let{nodeLookup:l,multiSelectionActive:S,nodesDraggable:b,transform:h,snapGrid:E,snapToGrid:j,selectNodesOnDrag:m,onNodeDragStart:I,onSelectionDragStart:V,unselectNodesAndEdges:D}=Q();if(H=!0,(!m||!P)&&!S&&C){if(!l.get(C)?.selected)D()}if(P&&m&&C)_?.(C);let y=b5(i.sourceEvent,{transform:h,snapGrid:E,snapToGrid:j,containerBounds:K});if(G=y,F=jq(l,b,y,C),F.size>0&&(J||I||!C&&V)){let[t,_1]=O6({nodeId:C,dragItems:F,nodeLookup:l});if(J?.(i.sourceEvent,F,t,_1),I?.(i.sourceEvent,t,_1),!C)V?.(i.sourceEvent,_1)}}let u=M5().clickDistance(f).on("start",(i)=>{let{domNode:l,nodeDragThreshold:S,transform:b,snapGrid:h,snapToGrid:E}=Q();if(K=l?.getBoundingClientRect()||null,z=!1,W=!1,w=i.sourceEvent,S===0)k(i);G=b5(i.sourceEvent,{transform:b,snapGrid:h,snapToGrid:E,containerBounds:K}),Y=T0(i.sourceEvent,K)}).on("drag",(i)=>{let{autoPanOnNodeDrag:l,transform:S,snapGrid:b,snapToGrid:h,nodeDragThreshold:E,nodeLookup:j}=Q(),m=b5(i.sourceEvent,{transform:S,snapGrid:b,snapToGrid:h,containerBounds:K});if(w=i.sourceEvent,i.sourceEvent.type==="touchmove"&&i.sourceEvent.touches.length>1||C&&!j.has(C))z=!0;if(z)return;if(!X&&l&&H)X=!0,N();if(!H){let I=T0(i.sourceEvent,K),V=I.x-Y.x,D=I.y-Y.y;if(Math.sqrt(V*V+D*D)>E)k(i)}if((G.x!==m.xSnapped||G.y!==m.ySnapped)&&F&&H)Y=T0(i.sourceEvent,K),v(m)}).on("end",(i)=>{if(!H||z){if(z&&F.size>0)Q().updateNodePositions(F,!1);return}if(X=!1,H=!1,cancelAnimationFrame(Z),F.size>0){let{nodeLookup:l,updateNodePositions:S,onNodeDragStop:b,onSelectionDragStop:h}=Q();if(W)S(F,!1),W=!1;if(U||b||!C&&h){let[E,j]=O6({nodeId:C,dragItems:F,nodeLookup:l,dragging:!1});if(U?.(i.sourceEvent,F,E,j),b?.(i.sourceEvent,E,j),!C)h?.(i.sourceEvent,j)}}}).filter((i)=>{let l=i.target;return!i.button&&(!O||!O7(l,`.${O}`,M))&&(!B||O7(l,B,M))});L.call(u)}function A(){L?.on(".drag",null)}return{update:R,destroy:A}}function uq(_,Q,J){let q=[],U={x:_.x-J,y:_.y-J,width:J*2,height:J*2};for(let G of Q.values())if(x5(U,J5(G))>0)q.push(G);return q}var hq=250;function Dq(_,Q,J,q){let U=[],G=1/0,Z=uq(_,J,Q+hq);for(let F of Z){let X=[...F.internals.handleBounds?.source??[],...F.internals.handleBounds?.target??[]];for(let Y of X){if(q.nodeId===Y.nodeId&&q.type===Y.type&&q.id===Y.id)continue;let{x:K,y:H}=z2(F,Y,Y.position,!0),L=Math.sqrt(Math.pow(K-_.x,2)+Math.pow(H-_.y,2));if(L>Q)continue;if(L<G)U=[{...Y,x:K,y:H}],G=L;else if(L===G)U.push({...Y,x:K,y:H})}}if(!U.length)return null;if(U.length>1){let F=q.type==="source"?"target":"source";return U.find((X)=>X.type===F)??U[0]}return U[0]}function r7(_,Q,J,q,U,G=!1){let Z=q.get(_);if(!Z)return null;let F=U==="strict"?Z.internals.handleBounds?.[Q]:[...Z.internals.handleBounds?.source??[],...Z.internals.handleBounds?.target??[]],X=(J?F?.find((Y)=>Y.id===J):F?.[0])??null;return X&&G?{...X,...z2(Z,X,X.position,!0)}:X}function d7(_,Q){if(_)return _;else if(Q?.classList.contains("target"))return"target";else if(Q?.classList.contains("source"))return"source";return null}function bq(_,Q){let J=null;if(Q)J=!0;else if(_&&!Q)J=!1;return J}var a7=()=>!0;function Eq(_,{connectionMode:Q,connectionRadius:J,handleId:q,nodeId:U,edgeUpdaterType:G,isTarget:Z,domNode:F,nodeLookup:X,lib:Y,autoPanOnConnect:K,flowId:H,panBy:L,cancelConnection:z,onConnectStart:W,onConnect:w,onConnectEnd:R,isValidConnection:A=a7,onReconnectEnd:O,updateConnection:B,getTransform:M,getFromHandle:P,autoPanSpeed:C,dragThreshold:f=1,handleDomNode:v}){let N=x6(_.target),k=0,u,{x:i,y:l}=T0(_),S=d7(G,v),b=F?.getBoundingClientRect(),h=!1;if(!b||!S)return;let E=r7(U,S,q,X,Q);if(!E)return;let j=T0(_,b),m=!1,I=null,V=!1,D=null;function y(){if(!K||!b)return;let[U1,q1]=P4(j,b,C);L({x:U1,y:q1}),k=requestAnimationFrame(y)}let t={...E,nodeId:U,type:S,position:E.position},_1=X.get(U),o={inProgress:!0,isValid:null,from:z2(_1,t,F1.Left,!0),fromHandle:t,fromPosition:t.position,fromNode:_1,to:j,toHandle:null,toPosition:X7[t.position],toNode:null,pointer:j};function p(){h=!0,B(o),W?.(_,{nodeId:U,handleId:q,handleType:S})}if(f===0)p();function e(U1){if(!h){let{x:R1,y:H1}=T0(U1),x1=R1-i,a1=H1-l;if(!(x1*x1+a1*a1>f*f))return;p()}if(!P()||!t){$1(U1);return}let q1=M();if(j=T0(U1,b),u=Dq(q5(j,q1,!1,[1,1]),J,X,t),!m)y(),m=!0;let K1=s7(U1,{handle:u,connectionMode:Q,fromNodeId:U,fromHandleId:q,fromType:Z?"target":"source",isValidConnection:A,doc:N,lib:Y,flowId:H,nodeLookup:X});D=K1.handleDomNode,I=K1.connection,V=bq(!!u,K1.isValid);let W1=X.get(U),Y1=W1?z2(W1,t,F1.Left,!0):o.from,n={...o,from:Y1,isValid:V,to:K1.toHandle&&V?k2({x:K1.toHandle.x,y:K1.toHandle.y},q1):j,toHandle:K1.toHandle,toPosition:V&&K1.toHandle?K1.toHandle.position:X7[t.position],toNode:K1.toHandle?X.get(K1.toHandle.nodeId):null,pointer:j};B(n),o=n}function $1(U1){if("touches"in U1&&U1.touches.length>0)return;if(h){if((u||D)&&I&&V)w?.(I);let{inProgress:q1,...K1}=o,W1={...K1,toPosition:o.toHandle?o.toPosition:null};if(R?.(U1,W1),G)O?.(U1,W1)}z(),cancelAnimationFrame(k),m=!1,V=!1,I=null,D=null,N.removeEventListener("mousemove",e),N.removeEventListener("mouseup",$1),N.removeEventListener("touchmove",e),N.removeEventListener("touchend",$1)}N.addEventListener("mousemove",e),N.addEventListener("mouseup",$1),N.addEventListener("touchmove",e),N.addEventListener("touchend",$1)}function s7(_,{handle:Q,connectionMode:J,fromNodeId:q,fromHandleId:U,fromType:G,doc:Z,lib:F,flowId:X,isValidConnection:Y=a7,nodeLookup:K}){let H=G==="target",L=Q?Z.querySelector(`.${F}-flow__handle[data-id="${X}-${Q?.nodeId}-${Q?.id}-${Q?.type}"]`):null,{x:z,y:W}=T0(_),w=Z.elementFromPoint(z,W),R=w?.classList.contains(`${F}-flow__handle`)?w:L,A={handleDomNode:R,isValid:!1,connection:null,toHandle:null};if(R){let O=d7(void 0,R),B=R.getAttribute("data-nodeid"),M=R.getAttribute("data-handleid"),P=R.classList.contains("connectable"),C=R.classList.contains("connectableend");if(!B||!O)return A;let f={source:H?B:q,sourceHandle:H?M:U,target:H?q:B,targetHandle:H?U:M};A.connection=f;let N=P&&C&&(J===L2.Strict?H&&O==="source"||!H&&O==="target":B!==q||M!==U);A.isValid=N&&Y(f),A.toHandle=r7(B,O,M,K,J,!0)}return A}var u4={onPointerDown:Eq,isValid:s7};function t7({domNode:_,panZoom:Q,getTransform:J,getViewScale:q}){let U=s1(_);function G({translateExtent:F,width:X,height:Y,zoomStep:K=1,pannable:H=!0,zoomable:L=!0,inversePan:z=!1}){let W=(B)=>{if(B.sourceEvent.type!=="wheel"||!Q)return;let M=J(),P=B.sourceEvent.ctrlKey&&U5()?10:1,C=-B.sourceEvent.deltaY*(B.sourceEvent.deltaMode===1?0.05:B.sourceEvent.deltaMode?1:0.002)*K,f=M[2]*Math.pow(2,C*P);Q.scaleTo(f)},w=[0,0],R=(B)=>{if(B.sourceEvent.type==="mousedown"||B.sourceEvent.type==="touchstart")w=[B.sourceEvent.clientX??B.sourceEvent.touches[0].clientX,B.sourceEvent.clientY??B.sourceEvent.touches[0].clientY]},A=(B)=>{let M=J();if(B.sourceEvent.type!=="mousemove"&&B.sourceEvent.type!=="touchmove"||!Q)return;let P=[B.sourceEvent.clientX??B.sourceEvent.touches[0].clientX,B.sourceEvent.clientY??B.sourceEvent.touches[0].clientY],C=[P[0]-w[0],P[1]-w[1]];w=P;let f=q()*Math.max(M[2],Math.log(M[2]))*(z?-1:1),v={x:M[0]-C[0]*f,y:M[1]-C[1]*f},N=[[0,0],[X,Y]];Q.setViewportConstrained({x:v.x,y:v.y,zoom:M[2]},N,F)},O=D5().on("start",R).on("zoom",H?A:null).on("zoom.wheel",L?W:null);U.call(O,{})}function Z(){U.on("zoom",null)}return{update:G,destroy:Z,pointer:$0}}var h4=(_)=>({x:_.x,y:_.y,zoom:_.k}),I6=({x:_,y:Q,zoom:J})=>f2.translate(_,Q).scale(J),Y2=(_,Q)=>_.target.closest(`.${Q}`),o7=(_,Q)=>Q===2&&Array.isArray(_)&&_.includes(2),xq=(_)=>((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2,w6=(_,Q=0,J=xq,q=()=>{})=>{let U=typeof Q==="number"&&Q>0;if(!U)q();return U?_.transition().duration(Q).ease(J).on("end",q):_},n7=(_)=>{let Q=_.ctrlKey&&U5()?10:1;return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*Q};function mq({zoomPanValues:_,noWheelClassName:Q,d3Selection:J,d3Zoom:q,panOnScrollMode:U,panOnScrollSpeed:G,zoomOnPinch:Z,onPanZoomStart:F,onPanZoom:X,onPanZoomEnd:Y}){return(K)=>{if(Y2(K,Q)){if(K.ctrlKey)K.preventDefault();return!1}K.preventDefault(),K.stopImmediatePropagation();let H=J.property("__zoom").k||1;if(K.ctrlKey&&Z){let R=$0(K),A=n7(K),O=H*Math.pow(2,A);q.scaleTo(J,O,R,K);return}let L=K.deltaMode===1?20:1,z=U===s0.Vertical?0:K.deltaX*L,W=U===s0.Horizontal?0:K.deltaY*L;if(!U5()&&K.shiftKey&&U!==s0.Vertical)z=K.deltaY*L,W=0;q.translateBy(J,-(z/H)*G,-(W/H)*G,{internal:!0});let w=h4(J.property("__zoom"));if(clearTimeout(_.panScrollTimeout),!_.isPanScrolling)_.isPanScrolling=!0,F?.(K,w);else X?.(K,w);_.panScrollTimeout=setTimeout(()=>{Y?.(K,w),_.isPanScrolling=!1},150)}}function gq({noWheelClassName:_,preventScrolling:Q,d3ZoomHandler:J}){return function(q,U){let G=q.type==="wheel",Z=!Q&&G&&!q.ctrlKey,F=Y2(q,_);if(q.ctrlKey&&G&&F)q.preventDefault();if(Z||F)return null;q.preventDefault(),J.call(this,q,U)}}function pq({zoomPanValues:_,onDraggingChange:Q,onPanZoomStart:J}){return(q)=>{if(q.sourceEvent?.internal)return;let U=h4(q.transform);if(_.mouseButton=q.sourceEvent?.button||0,_.isZoomingOrPanning=!0,_.prevViewport=U,q.sourceEvent?.type==="mousedown")Q(!0);if(J)J?.(q.sourceEvent,U)}}function cq({zoomPanValues:_,panOnDrag:Q,onPaneContextMenu:J,onTransformChange:q,onPanZoom:U}){return(G)=>{if(_.usedRightMouseButton=!!(J&&o7(Q,_.mouseButton??0)),!G.sourceEvent?.sync)q([G.transform.x,G.transform.y,G.transform.k]);if(U&&!G.sourceEvent?.internal)U?.(G.sourceEvent,h4(G.transform))}}function lq({zoomPanValues:_,panOnDrag:Q,panOnScroll:J,onDraggingChange:q,onPanZoomEnd:U,onPaneContextMenu:G}){return(Z)=>{if(Z.sourceEvent?.internal)return;if(_.isZoomingOrPanning=!1,G&&o7(Q,_.mouseButton??0)&&!_.usedRightMouseButton&&Z.sourceEvent)G(Z.sourceEvent);if(_.usedRightMouseButton=!1,q(!1),U){let F=h4(Z.transform);_.prevViewport=F,clearTimeout(_.timerId),_.timerId=setTimeout(()=>{U?.(Z.sourceEvent,F)},J?150:0)}}}function iq({panActivationKeyPressed:_,zoomActivationKeyPressed:Q,zoomOnScroll:J,zoomOnPinch:q,panOnDrag:U,panOnScroll:G,zoomOnDoubleClick:Z,userSelectionActive:F,noWheelClassName:X,noPanClassName:Y,lib:K,connectionInProgress:H}){return(L)=>{let z=Q||J,W=q&&L.ctrlKey,w=L.type==="wheel";if(L.button===1&&L.type==="mousedown"&&(Y2(L,`${K}-flow__node`)||Y2(L,`${K}-flow__edge`)||Y2(L,`${K}-flow__selection`)||Y2(L,`${K}-flow__nodesselection`)))return!0;if(!U&&!z&&!G&&!Z&&!q)return!1;if(F)return!1;if(H&&!w)return!1;if(Y2(L,X)&&w)return!1;if(Y2(L,Y)&&(!w||G&&w&&!Q))return!1;if(!q&&L.ctrlKey&&w)return!1;if(!q&&L.type==="touchstart"&&L.touches?.length>1)return L.preventDefault(),!1;if(!z&&!G&&!W&&w)return!1;if(!U&&(L.type==="mousedown"||L.type==="touchstart"))return!1;if(Array.isArray(U)&&!U.includes(L.button)&&L.type==="mousedown")return!1;let R=Array.isArray(U)&&U.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||w||_)&&R}}function e7({domNode:_,minZoom:Q,maxZoom:J,translateExtent:q,viewport:U,onPanZoom:G,onPanZoomStart:Z,onPanZoomEnd:F,onDraggingChange:X}){let Y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},K=_.getBoundingClientRect(),H=[[0,0],[K.width,K.height]];(typeof ResizeObserver<"u"?new ResizeObserver((l)=>{let S=l[0];if(S)H=[[0,0],[S.contentRect.width,S.contentRect.height]]}):null)?.observe(_);let z=D5().extent(()=>H).scaleExtent([Q,J]).translateExtent(q),W=s1(_).call(z);M({x:U.x,y:U.y,zoom:_5(U.zoom,Q,J)},[[0,0],[K.width,K.height]],q);let w=W.on("wheel.zoom"),R=W.on("dblclick.zoom");z.wheelDelta(n7);async function A(l,S){if(W)return new Promise((b)=>{z?.interpolate(S?.interpolate==="linear"?b0:P2).transform(w6(W,S?.duration,S?.ease,()=>b(!0)),l)});return!1}function O({noWheelClassName:l,noPanClassName:S,onPaneContextMenu:b,userSelectionActive:h,panOnScroll:E,panOnDrag:j,panOnScrollMode:m,panOnScrollSpeed:I,preventScrolling:V,zoomOnPinch:D,zoomOnScroll:y,zoomOnDoubleClick:t,panActivationKeyPressed:_1=!1,zoomActivationKeyPressed:a,lib:o,onTransformChange:p,connectionInProgress:e,paneClickDistance:$1,selectionOnDrag:U1}){if(h&&!Y.isZoomingOrPanning)B();let q1=E&&!a&&!h;z.clickDistance(U1?1/0:!M0($1)||$1<0?0:$1);let K1=q1?mq({zoomPanValues:Y,noWheelClassName:l,d3Selection:W,d3Zoom:z,panOnScrollMode:m,panOnScrollSpeed:I,zoomOnPinch:D,onPanZoomStart:Z,onPanZoom:G,onPanZoomEnd:F}):gq({noWheelClassName:l,preventScrolling:V,d3ZoomHandler:w});W.on("wheel.zoom",K1,{passive:!1});let W1=pq({zoomPanValues:Y,onDraggingChange:X,onPanZoomStart:Z});z.on("start",W1);let Y1=cq({zoomPanValues:Y,panOnDrag:j,onPaneContextMenu:!!b,onPanZoom:G,onTransformChange:p});z.on("zoom",Y1);let n=lq({zoomPanValues:Y,panOnDrag:j,panOnScroll:E,onPaneContextMenu:b,onPanZoomEnd:F,onDraggingChange:X});z.on("end",n);let R1=iq({panActivationKeyPressed:_1,zoomActivationKeyPressed:a,panOnDrag:j,zoomOnScroll:y,panOnScroll:E,zoomOnDoubleClick:t,zoomOnPinch:D,userSelectionActive:h,noPanClassName:S,noWheelClassName:l,lib:o,connectionInProgress:e});if(z.filter(R1),t)W.on("dblclick.zoom",R);else W.on("dblclick.zoom",null)}function B(){z.on("zoom",null)}async function M(l,S,b){let h=I6(l),E=z?.constrain()(h,S,b);if(E)await A(E);return E}async function P(l,S){let b=I6(l);return await A(b,S),b}function C(l){if(W){let S=I6(l),b=W.property("__zoom");if(b.k!==l.zoom||b.x!==l.x||b.y!==l.y)z?.transform(W,S,null,{sync:!0})}}function f(){let l=W?h5(W.node()):{x:0,y:0,k:1};return{x:l.x,y:l.y,zoom:l.k}}async function v(l,S){if(W)return new Promise((b)=>{z?.interpolate(S?.interpolate==="linear"?b0:P2).scaleTo(w6(W,S?.duration,S?.ease,()=>b(!0)),l)});return!1}async function N(l,S){if(W)return new Promise((b)=>{z?.interpolate(S?.interpolate==="linear"?b0:P2).scaleBy(w6(W,S?.duration,S?.ease,()=>b(!0)),l)});return!1}function k(l){z?.scaleExtent(l)}function u(l){z?.translateExtent(l)}function i(l){let S=!M0(l)||l<0?0:l;z?.clickDistance(S)}return{update:O,destroy:B,setViewport:P,setViewportConstrained:M,getViewport:f,scaleTo:v,scaleBy:N,setScaleExtent:k,setTranslateExtent:u,syncViewport:C,setClickDistance:i}}var t0;(function(_){_.Line="line",_.Handle="handle"})(t0||(t0={}));var _9=["top-left","top-right","bottom-left","bottom-right"],Q9=["top","right","bottom","left"];function rq({width:_,prevWidth:Q,height:J,prevHeight:q,affectsX:U,affectsY:G}){let Z=_-Q,F=J-q,X=[Z>0?1:Z<0?-1:0,F>0?1:F<0?-1:0];if(Z&&U)X[0]=X[0]*-1;if(F&&G)X[1]=X[1]*-1;return X}function I7(_){let Q=_.includes("right")||_.includes("left"),J=_.includes("bottom")||_.includes("top"),q=_.includes("left"),U=_.includes("top");return{isHorizontal:Q,isVertical:J,affectsX:q,affectsY:U}}function X2(_,Q){return Math.max(0,Q-_)}function K2(_,Q){return Math.max(0,_-Q)}function O4(_,Q,J){return Math.max(0,Q-_,_-J)}function w7(_,Q){return _?!Q:Q}function dq(_,Q,J,q,U,G,Z,F){let{affectsX:X,affectsY:Y}=Q,{isHorizontal:K,isVertical:H}=Q,L=K&&H,{xSnapped:z,ySnapped:W}=J,{minWidth:w,maxWidth:R,minHeight:A,maxHeight:O}=q,{x:B,y:M,width:P,height:C,aspectRatio:f}=_,v=Math.floor(K?z-_.pointerX:0),N=Math.floor(H?W-_.pointerY:0),k=P+(X?-v:v),u=C+(Y?-N:N),i=-G[0]*P,l=-G[1]*C,S=O4(k,w,R),b=O4(u,A,O);if(Z){let j=0,m=0;if(X&&v<0)j=X2(B+v+i,Z[0][0]);else if(!X&&v>0)j=K2(B+k+i,Z[1][0]);if(Y&&N<0)m=X2(M+N+l,Z[0][1]);else if(!Y&&N>0)m=K2(M+u+l,Z[1][1]);S=Math.max(S,j),b=Math.max(b,m)}if(F){let j=0,m=0;if(X&&v>0)j=K2(B+v,F[0][0]);else if(!X&&v<0)j=X2(B+k,F[1][0]);if(Y&&N>0)m=K2(M+N,F[0][1]);else if(!Y&&N<0)m=X2(M+u,F[1][1]);S=Math.max(S,j),b=Math.max(b,m)}if(U){if(K){let j=O4(k/f,A,O)*f;if(S=Math.max(S,j),Z){let m=0;if(!X&&!Y||X&&!Y&&L)m=K2(M+l+k/f,Z[1][1])*f;else m=X2(M+l+(X?v:-v)/f,Z[0][1])*f;S=Math.max(S,m)}if(F){let m=0;if(!X&&!Y||X&&!Y&&L)m=X2(M+k/f,F[1][1])*f;else m=K2(M+(X?v:-v)/f,F[0][1])*f;S=Math.max(S,m)}}if(H){let j=O4(u*f,w,R)/f;if(b=Math.max(b,j),Z){let m=0;if(!X&&!Y||Y&&!X&&L)m=K2(B+u*f+i,Z[1][0])/f;else m=X2(B+(Y?N:-N)*f+i,Z[0][0])/f;b=Math.max(b,m)}if(F){let m=0;if(!X&&!Y||Y&&!X&&L)m=X2(B+u*f,F[1][0])/f;else m=K2(B+(Y?N:-N)*f,F[0][0])/f;b=Math.max(b,m)}}}if(N=N+(N<0?b:-b),v=v+(v<0?S:-S),U)if(L)if(k>u*f)N=(w7(X,Y)?-v:v)/f;else v=(w7(X,Y)?-N:N)*f;else if(K)N=v/f,Y=X;else v=N*f,X=Y;let h=X?B+v:B,E=Y?M+N:M;return{width:P+(X?-v:v),height:C+(Y?-N:N),x:G[0]*v*(!X?1:-1)+h,y:G[1]*N*(!Y?1:-1)+E}}var J9={width:0,height:0,x:0,y:0},aq={...J9,pointerX:0,pointerY:0,aspectRatio:1};function sq(_,Q,J){let q=Q.position.x+_.position.x,U=Q.position.y+_.position.y,G=_.measured.width??0,Z=_.measured.height??0,F=J[0]*G,X=J[1]*Z;return[[q-F,U-X],[q+G-F,U+Z-X]]}function $9({domNode:_,nodeId:Q,getStoreItems:J,onChange:q,onEnd:U}){let G=s1(_),Z={controlDirection:I7("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function F({controlPosition:Y,boundaries:K,keepAspectRatio:H,resizeDirection:L,onResizeStart:z,onResize:W,onResizeEnd:w,shouldResize:R}){let A={...J9},O={...aq};Z={boundaries:K,resizeDirection:L,keepAspectRatio:H,controlDirection:I7(Y)};let B=void 0,M=null,P=[],C=void 0,f=void 0,v=void 0,N=M5().on("start",(k)=>{let{nodeLookup:u,transform:i,snapGrid:l,snapToGrid:S,nodeOrigin:b,paneDomNode:h}=J();if(B=u.get(Q),!B)return;M=h?.getBoundingClientRect()??null;let{xSnapped:E,ySnapped:j}=b5(k.sourceEvent,{transform:i,snapGrid:l,snapToGrid:S,containerBounds:M});if(A={width:B.measured.width??0,height:B.measured.height??0,x:B.position.x??0,y:B.position.y??0},O={...A,pointerX:E,pointerY:j,aspectRatio:A.width/A.height},C=void 0,f=y2(B.extent)?B.extent:void 0,B.parentId&&(B.extent==="parent"||B.expandParent))C=u.get(B.parentId);if(C&&B.extent==="parent")f=[[0,0],[C.measured.width,C.measured.height]];P=[],v=void 0;for(let[m,I]of u)if(I.parentId===Q){if(P.push({id:m,position:{...I.position},extent:I.extent}),I.extent==="parent"||I.expandParent){let V=sq(I,B,I.origin??b);if(v)v=[[Math.min(V[0][0],v[0][0]),Math.min(V[0][1],v[0][1])],[Math.max(V[1][0],v[1][0]),Math.max(V[1][1],v[1][1])]];else v=V}}z?.(k,{...A})}).on("drag",(k)=>{let{transform:u,snapGrid:i,snapToGrid:l,nodeOrigin:S}=J(),b=b5(k.sourceEvent,{transform:u,snapGrid:i,snapToGrid:l,containerBounds:M}),h=[];if(!B)return;let{x:E,y:j,width:m,height:I}=A,V={},D=B.origin??S,{width:y,height:t,x:_1,y:a}=dq(O,Z.controlDirection,b,Z.boundaries,Z.keepAspectRatio,D,f,v),o=y!==m,p=t!==I,e=_1!==E&&o,$1=a!==j&&p;if(!e&&!$1&&!o&&!p)return;let U1={prevValues:{...A},startX:O.x,startY:O.y,childNodes:P.map((Y1)=>({...Y1,position:{...Y1.position}}))};if(e||$1||D[0]===1||D[1]===1){if(V.x=e?_1:A.x,V.y=$1?a:A.y,A.x=V.x,A.y=V.y,P.length>0){let Y1=_1-E,n=a-j;for(let R1 of P)R1.position={x:R1.position.x-Y1+D[0]*(y-m),y:R1.position.y-n+D[1]*(t-I)},h.push(R1)}}if(o||p)V.width=o&&(!Z.resizeDirection||Z.resizeDirection==="horizontal")?y:A.width,V.height=p&&(!Z.resizeDirection||Z.resizeDirection==="vertical")?t:A.height,A.width=V.width,A.height=V.height;if(C&&B.expandParent){let Y1=D[0]*(V.width??0);if(V.x&&V.x<Y1)A.x=Y1,O.x=O.x-(V.x-Y1);let n=D[1]*(V.height??0);if(V.y&&V.y<n)A.y=n,O.y=O.y-(V.y-n)}let q1=rq({width:A.width,prevWidth:m,height:A.height,prevHeight:I,affectsX:Z.controlDirection.affectsX,affectsY:Z.controlDirection.affectsY}),K1={...A,direction:q1};if(R?.(k,K1)===!1){A=U1.prevValues,O.x=U1.startX,O.y=U1.startY,P.forEach((Y1,n)=>{Y1.position=U1.childNodes[n].position});return}W?.(k,K1),q(V,h)}).on("end",(k)=>{w?.(k,{...A}),U?.({...A})});G.call(N)}function X(){G.on(".drag",null)}return{update:F,destroy:X}}var H9=_0(u0(),1),X9=_0(U9(),1);var G9=(_)=>{let Q,J=new Set,q=(K,H)=>{let L=typeof K==="function"?K(Q):K;if(!Object.is(L,Q)){let z=Q;Q=(H!=null?H:typeof L!=="object"||L===null)?L:Object.assign({},Q,L),J.forEach((W)=>W(Q,z))}},U=()=>Q,X={setState:q,getState:U,getInitialState:()=>Y,subscribe:(K)=>{return J.add(K),()=>J.delete(K)},destroy:()=>{if((import.meta.env?import.meta.env.MODE:void 0)!=="production")console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");J.clear()}},Y=Q=_(q,U,X);return X},Z9=(_)=>_?G9(_):G9;var{useDebugValue:nq}=H9.default,{useSyncExternalStoreWithSelector:eq}=X9.default,_U=(_)=>_;function a6(_,Q=_U,J){let q=eq(_.subscribe,_.getState,_.getServerState||_.getInitialState,Q,J);return nq(q),q}var F9=(_,Q)=>{let J=Z9(_),q=(U,G=Q)=>a6(J,U,G);return Object.assign(q,J),q},K9=(_,Q)=>_?F9(_,Q):F9;function D1(_,Q){if(Object.is(_,Q))return!0;if(typeof _!=="object"||_===null||typeof Q!=="object"||Q===null)return!1;if(_ instanceof Map&&Q instanceof Map){if(_.size!==Q.size)return!1;for(let[q,U]of _)if(!Object.is(U,Q.get(q)))return!1;return!0}if(_ instanceof Set&&Q instanceof Set){if(_.size!==Q.size)return!1;for(let q of _)if(!Q.has(q))return!1;return!0}let J=Object.keys(_);if(J.length!==Object.keys(Q).length)return!1;for(let q of J)if(!Object.prototype.hasOwnProperty.call(Q,q)||!Object.is(_[q],Q[q]))return!1;return!0}var p9=_0(z9(),1),m4=d.createContext(null),$U=m4.Provider,c9=H0.error001("react");function N1(_,Q){let J=d.useContext(m4);if(J===null)throw Error(c9);return a6(J,_,Q)}function b1(){let _=d.useContext(m4);if(_===null)throw Error(c9);return d.useMemo(()=>({getState:_.getState,setState:_.setState,subscribe:_.subscribe}),[_])}var W9={display:"none"},qU={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},l9="react-flow__node-desc",i9="react-flow__edge-desc",UU="react-flow__aria-live",GU=(_)=>_.ariaLiveMessage,ZU=(_)=>_.ariaLabelConfig;function FU({rfId:_}){let Q=N1(GU);return r.jsx("div",{id:`${UU}-${_}`,"aria-live":"assertive","aria-atomic":"true",style:qU,children:Q})}function HU({rfId:_,disableKeyboardA11y:Q}){let J=N1(ZU);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${l9}-${_}`,style:W9,children:Q?J["node.a11yDescription.default"]:J["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${i9}-${_}`,style:W9,children:J["edge.a11yDescription.default"]}),!Q&&r.jsx(FU,{rfId:_})]})}var m0=d.forwardRef(({position:_="top-left",children:Q,className:J,style:q,...U},G)=>{let Z=`${_}`.split("-");return r.jsx("div",{className:m1(["react-flow__panel",J,...Z]),style:q,ref:G,...U,children:Q})});m0.displayName="Panel";var B9="https://reactflow.dev/attribution";function XU({proOptions:_,position:Q="bottom-right"}){if(d.useEffect(()=>{j7("react")},[]),_?.hideAttribution)return null;return r.jsx(m0,{position:Q,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${B9}`,children:r.jsx("a",{href:B9,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var KU=(_)=>{let Q=[],J=[];for(let[,q]of _.nodeLookup)if(q.selected)Q.push(q.internals.userNode);for(let[,q]of _.edgeLookup)if(q.selected)J.push(q);return{selectedNodes:Q,selectedEdges:J}},D4=(_)=>_.id;function YU(_,Q){return D1(_.selectedNodes.map(D4),Q.selectedNodes.map(D4))&&D1(_.selectedEdges.map(D4),Q.selectedEdges.map(D4))}function LU({onSelectionChange:_}){let Q=b1(),{selectedNodes:J,selectedEdges:q}=N1(KU,YU);return d.useEffect(()=>{let U={nodes:J,edges:q};_?.(U),Q.getState().onSelectionChangeHandlers.forEach((G)=>G(U))},[J,q,_]),null}var zU=(_)=>!!_.onSelectionChangeHandlers;function WU({onSelectionChange:_}){let Q=N1(zU);if(_||Q)return r.jsx(LU,{onSelectionChange:_});return null}var r9=[0,0],BU={x:0,y:0,zoom:1},AU=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],A9=[...AU,"rfId"],MU=(_)=>({setNodes:_.setNodes,setEdges:_.setEdges,setMinZoom:_.setMinZoom,setMaxZoom:_.setMaxZoom,setTranslateExtent:_.setTranslateExtent,setNodeExtent:_.setNodeExtent,reset:_.reset,setDefaultNodesAndEdges:_.setDefaultNodesAndEdges}),M9={translateExtent:Q5,nodeOrigin:r9,minZoom:0.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function TU(_){let{setNodes:Q,setEdges:J,setMinZoom:q,setMaxZoom:U,setTranslateExtent:G,setNodeExtent:Z,reset:F,setDefaultNodesAndEdges:X}=N1(MU,D1),Y=b1();d.useEffect(()=>{return X(_.defaultNodes,_.defaultEdges),()=>{K.current=M9,F()}},[]);let K=d.useRef(M9);return d.useEffect(()=>{for(let H of A9){let L=_[H],z=K.current[H];if(L===z)continue;if(typeof _[H]>"u")continue;if(H==="nodes")Q(L);else if(H==="edges")J(L);else if(H==="minZoom")q(L);else if(H==="maxZoom")U(L);else if(H==="translateExtent")G(L);else if(H==="nodeExtent")Z(L);else if(H==="ariaLabelConfig")Y.setState({ariaLabelConfig:y7(L)});else if(H==="fitView")Y.setState({fitViewQueued:L});else if(H==="fitViewOptions")Y.setState({fitViewOptions:L});else Y.setState({[H]:L})}K.current=_},A9.map((H)=>_[H])),null}function T9(){if(typeof window>"u"||!window.matchMedia)return null;return window.matchMedia("(prefers-color-scheme: dark)")}function RU(_){let[Q,J]=d.useState(_==="system"?null:_);return d.useEffect(()=>{if(_!=="system"){J(_);return}let q=T9(),U=()=>J(q?.matches?"dark":"light");return U(),q?.addEventListener("change",U),()=>{q?.removeEventListener("change",U)}},[_]),Q!==null?Q:T9()?.matches?"dark":"light"}var R9=typeof document<"u"?document:null;function p5(_=null,Q={target:R9,actInsideInputWithModifier:!0}){let[J,q]=d.useState(!1),U=d.useRef(!1),G=d.useRef(new Set([])),[Z,F]=d.useMemo(()=>{if(_!==null){let Y=(Array.isArray(_)?_:[_]).filter((H)=>typeof H==="string").map((H)=>H.replace(/\+/g,`
|
|
29
29
|
`).replace(`
|
|
30
30
|
|
|
31
31
|
`,`
|
|
32
32
|
+`).split(`
|
|
33
|
-
`)),X=Y.reduce((H,L)=>H.concat(...L),[]);return[Y,X]}return[[],[]]},[_]);return a.useEffect(()=>{let K=Q?.target??H9,Y=Q?.actInsideInputWithModifier??!0;if(_!==null){let X=(W)=>{if(U.current=W.ctrlKey||W.metaKey||W.shiftKey||W.altKey,(!U.current||U.current&&!Y)&&S6(W))return!1;let I=X9(W.code,F);if(G.current.add(W[I]),K9(Z,G.current,!1)){let R=W.composedPath?.()?.[0]||W.target,M=R?.nodeName==="BUTTON"||R?.nodeName==="A";if(Q.preventDefault!==!1&&(U.current||!M))W.preventDefault();q(!0)}},H=(W)=>{let A=X9(W.code,F);if(K9(Z,G.current,!0))q(!1),G.current.clear();else G.current.delete(W[A]);if(W.key==="Meta")G.current.clear();U.current=!1},L=()=>{G.current.clear(),q(!1)};return K?.addEventListener("keydown",X),K?.addEventListener("keyup",H),window.addEventListener("blur",L),window.addEventListener("contextmenu",L),()=>{K?.removeEventListener("keydown",X),K?.removeEventListener("keyup",H),window.removeEventListener("blur",L),window.removeEventListener("contextmenu",L)}}},[_,q]),J}function K9(_,Q,J){return _.filter((q)=>J||q.length===Q.size).some((q)=>q.every((U)=>Q.has(U)))}function X9(_,Q){return Q.includes(_)?"code":"key"}var MU=()=>{let _=v1();return a.useMemo(()=>{return{zoomIn:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(1.2,Q):!1},zoomOut:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(0.8333333333333334,Q):!1},zoomTo:async(Q,J)=>{let{panZoom:q}=_.getState();return q?q.scaleTo(Q,J):!1},getZoom:()=>_.getState().transform[2],setViewport:async(Q,J)=>{let{transform:[q,U,G],panZoom:Z}=_.getState();if(!Z)return!1;return await Z.setViewport({x:Q.x??q,y:Q.y??U,zoom:Q.zoom??G},J),!0},getViewport:()=>{let[Q,J,q]=_.getState().transform;return{x:Q,y:J,zoom:q}},setCenter:async(Q,J,q)=>{return _.getState().setCenter(Q,J,q)},fitBounds:async(Q,J)=>{let{width:q,height:U,minZoom:G,maxZoom:Z,panZoom:F}=_.getState(),K=v5(Q,q,U,G,Z,J?.padding??0.1);if(!F)return!1;return await F.setViewport(K,{duration:J?.duration,ease:J?.ease,interpolate:J?.interpolate}),!0},screenToFlowPosition:(Q,J={})=>{let{transform:q,snapGrid:U,snapToGrid:G,domNode:Z}=_.getState();if(!Z)return Q;let{x:F,y:K}=Z.getBoundingClientRect(),Y={x:Q.x-F,y:Q.y-K},X=J.snapGrid??U,H=J.snapToGrid??G;return r2(Y,q,H,X)},flowToScreenPosition:(Q)=>{let{transform:J,domNode:q}=_.getState();if(!q)return Q;let{x:U,y:G}=q.getBoundingClientRect(),Z=M2(Q,J);return{x:Z.x+U,y:Z.y+G}}}},[])};function D9(_,Q){let J=[],q=new Map,U=[];for(let G of _)if(G.type==="add"){U.push(G);continue}else if(G.type==="remove"||G.type==="replace")q.set(G.id,[G]);else{let Z=q.get(G.id);if(Z)Z.push(G);else q.set(G.id,[G])}for(let G of Q){let Z=q.get(G.id);if(!Z){J.push(G);continue}if(Z[0].type==="remove")continue;if(Z[0].type==="replace"){J.push({...Z[0].item});continue}let F={...G};for(let K of Z)TU(K,F);J.push(F)}if(U.length)U.forEach((G)=>{if(G.index!==void 0)J.splice(G.index,0,{...G.item});else J.push({...G.item})});return J}function TU(_,Q){switch(_.type){case"select":{Q.selected=_.selected;break}case"position":{if(typeof _.position<"u")Q.position=_.position;if(typeof _.dragging<"u")Q.dragging=_.dragging;break}case"dimensions":{if(typeof _.dimensions<"u"){if(Q.measured={..._.dimensions},_.setAttributes){if(_.setAttributes===!0||_.setAttributes==="width")Q.width=_.dimensions.width;if(_.setAttributes===!0||_.setAttributes==="height")Q.height=_.dimensions.height}}if(typeof _.resizing==="boolean")Q.resizing=_.resizing;break}}}function b9(_,Q){return D9(_,Q)}function RU(_,Q){return D9(_,Q)}function O2(_,Q){return{id:_,type:"select",selected:Q}}function a2(_,Q=new Set,J=!1){let q=[];for(let[U,G]of _){let Z=Q.has(U);if(!(G.selected===void 0&&!Z)&&G.selected!==Z){if(J)G.selected=Z;q.push(O2(G.id,Z))}}return q}function Y9({items:_=[],lookup:Q}){let J=[],q=new Map(_.map((U)=>[U.id,U]));for(let[U,G]of _.entries()){let Z=Q.get(G.id),F=Z?.internals?.userNode??Z;if(F!==void 0&&F!==G)J.push({id:G.id,item:G,type:"replace"});if(F===void 0)J.push({item:G,type:"add",index:U})}for(let[U]of Q)if(q.get(U)===void 0)J.push({id:U,type:"remove"});return J}function L9(_){return{id:_.id,type:"remove"}}var OU=I6("React Flow","https://reactflow.dev/");function IU(_,Q,J={}){return w7(_,Q,{...J,onError:J.onError??OU})}var z9=(_)=>L7(_),PU=(_)=>A6(_);function E9(_){return a.forwardRef(_)}var x9=typeof window<"u"?a.useLayoutEffect:a.useEffect;function W9(_){let[Q,J]=a.useState(BigInt(0)),[q]=a.useState(()=>wU(()=>J((U)=>U+BigInt(1))));return x9(()=>{let U=q.get();if(U.length)_(U),q.reset()},[Q]),q}function wU(_){let Q=[];return{get:()=>Q,reset:()=>{Q=[]},push:(J)=>{Q.push(J),_()}}}var m9=a.createContext(null);function fU({children:_}){let Q=v1(),J=a.useCallback((F)=>{let{nodes:K=[],setNodes:Y,hasDefaultNodes:X,onNodesChange:H,nodeLookup:L,fitViewQueued:W,onNodesChangeMiddlewareMap:A}=Q.getState(),I=K;for(let M of F)I=typeof M==="function"?M(I):M;let R=Y9({items:I,lookup:L});for(let M of A.values())R=M(R);if(X)Y(I);if(R.length>0)H?.(R);else if(W)window.requestAnimationFrame(()=>{let{fitViewQueued:M,nodes:O,setNodes:B}=Q.getState();if(M)B(O)})},[]),q=W9(J),U=a.useCallback((F)=>{let{edges:K=[],setEdges:Y,hasDefaultEdges:X,onEdgesChange:H,edgeLookup:L}=Q.getState(),W=K;for(let A of F)W=typeof A==="function"?A(W):A;if(X)Y(W);else if(H)H(Y9({items:W,lookup:L}))},[]),G=W9(U),Z=a.useMemo(()=>({nodeQueue:q,edgeQueue:G}),[]);return d.jsx(m9.Provider,{value:Z,children:_})}function NU(){let _=a.useContext(m9);if(!_)throw Error("useBatchContext must be used within a BatchProvider");return _}var CU=(_)=>!!_.panZoom;function j5(){let _=MU(),Q=v1(),J=NU(),q=O1(CU),U=a.useMemo(()=>{let G=(H)=>Q.getState().nodeLookup.get(H),Z=(H)=>{J.nodeQueue.push(H)},F=(H)=>{J.edgeQueue.push(H)},K=(H)=>{let{nodeLookup:L,nodeOrigin:W}=Q.getState(),A=z9(H)?H:L.get(H.id),I=A.parentId?w6(A.position,A.measured,A.parentId,L,W):A.position,R={...A,position:I,width:A.measured?.width??A.width,height:A.measured?.height??A.height};return l2(R)},Y=(H,L,W={replace:!1})=>{Z((A)=>A.map((I)=>{if(I.id===H){let R=typeof L==="function"?L(I):L;return W.replace&&z9(R)?R:{...I,...R}}return I}))},X=(H,L,W={replace:!1})=>{F((A)=>A.map((I)=>{if(I.id===H){let R=typeof L==="function"?L(I):L;return W.replace&&PU(R)?R:{...I,...R}}return I}))};return{getNodes:()=>Q.getState().nodes.map((H)=>({...H})),getNode:(H)=>G(H)?.internals.userNode,getInternalNode:G,getEdges:()=>{let{edges:H=[]}=Q.getState();return H.map((L)=>({...L}))},getEdge:(H)=>Q.getState().edgeLookup.get(H),setNodes:Z,setEdges:F,addNodes:(H)=>{let L=Array.isArray(H)?H:[H];J.nodeQueue.push((W)=>[...W,...L])},addEdges:(H)=>{let L=Array.isArray(H)?H:[H];J.edgeQueue.push((W)=>[...W,...L])},toObject:()=>{let{nodes:H=[],edges:L=[],transform:W}=Q.getState(),[A,I,R]=W;return{nodes:H.map((M)=>({...M})),edges:L.map((M)=>({...M})),viewport:{x:A,y:I,zoom:R}}},deleteElements:async({nodes:H=[],edges:L=[]})=>{let{nodes:W,edges:A,onNodesDelete:I,onEdgesDelete:R,triggerNodeChanges:M,triggerEdgeChanges:O,onDelete:B,onBeforeDelete:T}=Q.getState(),{nodes:f,edges:C}=await A7({nodesToRemove:H,edgesToRemove:L,nodes:W,edges:A,onBeforeDelete:T}),N=C.length>0,S=f.length>0;if(N){let w=C.map(L9);R?.(C),O(w)}if(S){let w=f.map(L9);I?.(f),M(w)}if(S||N)B?.({nodes:f,edges:C});return{deletedNodes:f,deletedEdges:C}},getIntersectingNodes:(H,L=!0,W)=>{let A=O6(H),I=A?H:K(H),R=W!==void 0;if(!I)return[];return(W||Q.getState().nodes).filter((M)=>{let O=Q.getState().nodeLookup.get(M.id);if(O&&!A&&(M.id===H.id||!O.internals.positionAbsolute))return!1;let B=l2(R?M:O),T=S5(B,I);return L&&T>0||T>=B.width*B.height||T>=I.width*I.height})},isNodeIntersecting:(H,L,W=!0)=>{let I=O6(H)?H:K(H);if(!I)return!1;let R=S5(I,L);return W&&R>0||R>=L.width*L.height||R>=I.width*I.height},updateNode:Y,updateNodeData:(H,L,W={replace:!1})=>{Y(H,(A)=>{let I=typeof L==="function"?L(A):L;return W.replace?{...A,data:I}:{...A,data:{...A.data,...I}}},W)},updateEdge:X,updateEdgeData:(H,L,W={replace:!1})=>{X(H,(A)=>{let I=typeof L==="function"?L(A):L;return W.replace?{...A,data:I}:{...A,data:{...A.data,...I}}},W)},getNodesBounds:(H)=>{let{nodeLookup:L,nodeOrigin:W}=Q.getState();return M6(H,{nodeLookup:L,nodeOrigin:W})},getHandleConnections:({type:H,id:L,nodeId:W})=>Array.from(Q.getState().connectionLookup.get(`${W}-${H}${L?`-${L}`:""}`)?.values()??[]),getNodeConnections:({type:H,handleId:L,nodeId:W})=>Array.from(Q.getState().connectionLookup.get(`${W}${H?L?`-${H}-${L}`:`-${H}`:""}`)?.values()??[]),fitView:async(H)=>{let L=Q.getState().fitViewResolver??T7();return Q.setState({fitViewQueued:!0,fitViewOptions:H,fitViewResolver:L}),J.nodeQueue.push((W)=>[...W]),L.promise}}},[]);return a.useMemo(()=>{return{...U,..._,viewportInitialized:q}},[q])}var A9=(_)=>_.selected,SU=typeof window<"u"?window:void 0;function vU({deleteKeyCode:_,multiSelectionKeyCode:Q}){let J=v1(),{deleteElements:q}=j5(),U=k5(_,{actInsideInputWithModifier:!1}),G=k5(Q,{target:SU});a.useEffect(()=>{if(U){let{edges:Z,nodes:F}=J.getState();q({nodes:F.filter(A9),edges:Z.filter(A9)}),J.setState({nodesSelectionActive:!1})}},[U]),a.useEffect(()=>{J.setState({multiSelectionActive:G})},[G])}function yU(_){let Q=v1();a.useEffect(()=>{let J=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let q=A4(_.current);if(q.height===0||q.width===0)Q.getState().onError?.("004",_0.error004());Q.setState({width:q.width||500,height:q.height||500})};if(_.current){J(),window.addEventListener("resize",J);let q=new ResizeObserver(()=>J());return q.observe(_.current),()=>{if(window.removeEventListener("resize",J),q&&_.current)q.unobserve(_.current)}}},[])}var y4={position:"absolute",width:"100%",height:"100%",top:0,left:0},kU=(_)=>({userSelectionActive:_.userSelectionActive,lib:_.lib,connectionInProgress:_.connection.inProgress});function jU({onPaneContextMenu:_,zoomOnScroll:Q=!0,zoomOnPinch:J=!0,panOnScroll:q=!1,panActivationKeyPressed:U,panOnScrollSpeed:G=0.5,panOnScrollMode:Z=b0.Free,zoomOnDoubleClick:F=!0,panOnDrag:K=!0,defaultViewport:Y,translateExtent:X,minZoom:H,maxZoom:L,zoomActivationKeyCode:W,preventScrolling:A=!0,children:I,noWheelClassName:R,noPanClassName:M,onViewportChange:O,isControlledViewport:B,paneClickDistance:T,selectionOnDrag:f}){let C=v1(),N=a.useRef(null),{userSelectionActive:S,lib:w,connectionInProgress:k}=O1(kU,S1),x=k5(W),r=a.useRef();yU(N);let m=a.useCallback((v)=>{if(O?.({x:v[0],y:v[1],zoom:v[2]}),!B)C.setState({transform:v})},[O,B]);return a.useEffect(()=>{if(N.current){r.current=p7({domNode:N.current,minZoom:H,maxZoom:L,translateExtent:X,viewport:Y,onDraggingChange:(E)=>C.setState((u)=>u.paneDragging===E?u:{paneDragging:E}),onPanZoomStart:(E,u)=>{let{onViewportChangeStart:b,onMoveStart:P}=C.getState();P?.(E,u),b?.(u)},onPanZoom:(E,u)=>{let{onViewportChange:b,onMove:P}=C.getState();P?.(E,u),b?.(u)},onPanZoomEnd:(E,u)=>{let{onViewportChangeEnd:b,onMoveEnd:P}=C.getState();P?.(E,u),b?.(u)}});let{x:v,y:D,zoom:V}=r.current.getViewport();return C.setState({panZoom:r.current,transform:[v,D,V],domNode:N.current.closest(".react-flow")}),()=>{r.current?.destroy()}}},[]),a.useEffect(()=>{r.current?.update({onPaneContextMenu:_,zoomOnScroll:Q,zoomOnPinch:J,panOnScroll:q,panActivationKeyPressed:U,panOnScrollSpeed:G,panOnScrollMode:Z,zoomOnDoubleClick:F,panOnDrag:K,zoomActivationKeyPressed:x,preventScrolling:A,noPanClassName:M,userSelectionActive:S,noWheelClassName:R,lib:w,onTransformChange:m,connectionInProgress:k,selectionOnDrag:f,paneClickDistance:T})},[_,Q,J,q,U,G,Z,F,K,x,A,M,S,R,w,m,k,f,T]),d.jsx("div",{className:"react-flow__renderer",ref:N,style:y4,children:I})}var VU=(_)=>({userSelectionActive:_.userSelectionActive,userSelectionRect:_.userSelectionRect});function uU(){let{userSelectionActive:_,userSelectionRect:Q}=O1(VU,S1);if(!(_&&Q))return null;return d.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:Q.width,height:Q.height,transform:`translate(${Q.x}px, ${Q.y}px)`}})}var E6=(_,Q)=>{return(J)=>{if(J.target!==Q.current)return;_?.(J)}},hU=(_)=>({userSelectionActive:_.userSelectionActive,elementsSelectable:_.elementsSelectable,dragging:_.paneDragging,panBy:_.panBy,autoPanSpeed:_.autoPanSpeed});function DU({isSelecting:_,selectionKeyPressed:Q,selectionMode:J=A2.Full,panOnDrag:q,autoPanOnSelection:U,paneClickDistance:G,selectionOnDrag:Z,onSelectionStart:F,onSelectionEnd:K,onPaneClick:Y,onPaneContextMenu:X,onPaneScroll:H,onPaneMouseEnter:L,onPaneMouseMove:W,onPaneMouseLeave:A,children:I}){let R=a.useRef(0),M=v1(),{userSelectionActive:O,elementsSelectable:B,dragging:T,panBy:f,autoPanSpeed:C}=O1(hU,S1),N=B&&(_||O),S=a.useRef(null),w=a.useRef(),k=a.useRef(new Set),x=a.useRef(new Set),r=a.useRef(!1),m=a.useRef(!1),v=a.useRef({x:0,y:0}),D=a.useRef(!1),V=(g)=>{if(m.current||r.current||M.getState().connection.inProgress){m.current=!1,r.current=!1;return}Y?.(g),M.getState().resetSelectedElements(),M.setState({nodesSelectionActive:!1})},E=(g)=>{if(Array.isArray(q)&&q?.includes(2)){g.preventDefault();return}X?.(g)},u=H?(g)=>H(g):void 0,b=(g)=>{if(m.current)g.stopPropagation(),m.current=!1},P=(g)=>{if(g.pointerType==="touch"&&q!==!1&&!Q)return;let{domNode:J1,transform:U1}=M.getState();if(w.current=J1?.getBoundingClientRect(),!w.current)return;let X1=g.target===S.current;if(!X1&&!!g.target.closest(".nokey")||!_||!(Z&&X1||Q)||g.button!==0||!g.isPrimary)return;g.target?.setPointerCapture?.(g.pointerId),m.current=!1;let{x:A1,y:Y1}=X0(g.nativeEvent,w.current),Q1=r2({x:A1,y:Y1},U1);if(M.setState({userSelectionRect:{width:0,height:0,startX:Q1.x,startY:Q1.y,x:A1,y:Y1}}),!X1)g.stopPropagation(),g.preventDefault()};function y(g,J1){let{userSelectionRect:U1}=M.getState();if(!U1)return;let{transform:X1,nodeLookup:G1,edgeLookup:F1,connectionLookup:A1,triggerNodeChanges:Y1,triggerEdgeChanges:Q1,defaultEdgeOptions:T1}=M.getState(),K1={x:U1.startX,y:U1.startY},{x:k1,y:p1}=M2(K1,X1),l1={startX:K1.x,startY:K1.y,x:g<k1?g:k1,y:J1<p1?J1:p1,width:Math.abs(g-k1),height:Math.abs(J1-p1)},z0=k.current,Z0=x.current;k.current=new Set(Y4(G1,l1,X1,J===A2.Partial,!0).map((o1)=>o1.id)),x.current=new Set;let F0=T1?.selectable??!0;for(let o1 of k.current){let Q0=A1.get(o1);if(!Q0)continue;for(let{edgeId:n1}of Q0.values()){let J0=F1.get(n1);if(J0&&(J0.selectable??F0))x.current.add(n1)}}if(!f6(z0,k.current)){let o1=a2(G1,k.current,!0);Y1(o1)}if(!f6(Z0,x.current)){let o1=a2(F1,x.current);Q1(o1)}M.setState({userSelectionRect:l1,userSelectionActive:!0,nodesSelectionActive:!1})}function p(){if(!U||!w.current)return;let[g,J1]=L4(v.current,w.current,C);f({x:g,y:J1}).then((U1)=>{if(!m.current||!U1){R.current=requestAnimationFrame(p);return}let{x:X1,y:G1}=v.current;y(X1,G1),R.current=requestAnimationFrame(p)})}let h=()=>{cancelAnimationFrame(R.current),R.current=0,D.current=!1};a.useEffect(()=>{return()=>h()},[]);let e=(g)=>{let{userSelectionRect:J1,transform:U1,resetSelectedElements:X1}=M.getState();if(!w.current||!J1)return;let{x:G1,y:F1}=X0(g.nativeEvent,w.current);v.current={x:G1,y:F1};let A1=M2({x:J1.startX,y:J1.startY},U1);if(!m.current){let Y1=Q?0:G;if(Math.hypot(G1-A1.x,F1-A1.y)<=Y1)return;X1(),F?.(g)}if(m.current=!0,!D.current)p(),D.current=!0;y(G1,F1)},t=(g)=>{if(!N){if(g.target===S.current&&M.getState().connection.inProgress)r.current=!0;return}if(g.button!==0)return;if(g.target?.releasePointerCapture?.(g.pointerId),!O&&g.target===S.current&&M.getState().userSelectionRect)V?.(g);if(M.setState({userSelectionActive:!1,userSelectionRect:null}),m.current)K?.(g),M.setState({nodesSelectionActive:k.current.size>0});h()},o=(g)=>{g.target?.releasePointerCapture?.(g.pointerId),h()},s=q===!0||Array.isArray(q)&&q.includes(0);return d.jsxs("div",{className:j1(["react-flow__pane",{draggable:s,dragging:T,selection:_}]),onClick:N?void 0:E6(V,S),onContextMenu:E6(E,S),onWheel:E6(u,S),onPointerEnter:N?void 0:L,onPointerMove:N?e:W,onPointerUp:t,onPointerCancel:N?o:void 0,onPointerDownCapture:N?P:void 0,onClickCapture:N?b:void 0,onPointerLeave:A,ref:S,style:y4,children:[I,d.jsx(uU,{})]})}function m6({id:_,store:Q,unselect:J=!1,nodeRef:q}){let{addSelectedNodes:U,unselectNodesAndEdges:G,multiSelectionActive:Z,nodeLookup:F,onError:K}=Q.getState(),Y=F.get(_);if(!Y){K?.("012",_0.error012(_));return}if(Q.setState({nodesSelectionActive:!1}),!Y.selected)U([_]);else if(J||Y.selected&&Z)G({nodes:[Y],edges:[]}),requestAnimationFrame(()=>q?.current?.blur())}function g9({nodeRef:_,disabled:Q=!1,noDragClassName:J,handleSelector:q,nodeId:U,isSelectable:G,nodeClickDistance:Z}){let F=v1(),[K,Y]=a.useState(!1),X=a.useRef();return a.useEffect(()=>{if(Q)return;return X.current=u7({getStoreItems:()=>F.getState(),onNodeMouseDown:(H)=>{m6({id:H,store:F,nodeRef:_})},onDragStart:()=>{Y(!0)},onDragStop:()=>{Y(!1)}}),()=>{X.current?.destroy(),X.current=void 0}},[Q,F,_]),a.useEffect(()=>{if(Q||!_.current||!X.current)return;X.current.update({noDragClassName:J,handleSelector:q,domNode:_.current,isSelectable:G,nodeId:U,nodeClickDistance:Z})},[J,q,Q,G,_,U,Z]),K}var bU=(_)=>(Q)=>Q.selected&&(Q.draggable||_&&typeof Q.draggable>"u");function p9(){let _=v1();return a.useCallback((J)=>{let{nodeExtent:q,snapToGrid:U,snapGrid:G,nodesDraggable:Z,onError:F,updateNodePositions:K,nodeLookup:Y,nodeOrigin:X}=_.getState(),H=new Map,L=bU(Z),W=U?G[0]:5,A=U?G[1]:5,I=J.direction.x*W*J.factor,R=J.direction.y*A*J.factor;for(let[,M]of Y){if(!L(M))continue;let O={x:M.internals.positionAbsolute.x+I,y:M.internals.positionAbsolute.y+R};if(U)O=i2(O,G);let{position:B,positionAbsolute:T}=T6({nodeId:M.id,nextPosition:O,nodeLookup:Y,nodeExtent:q,nodeOrigin:X,onError:F});M.position=B,M.internals.positionAbsolute=T,H.set(M.id,M)}K(H)},[])}var g6=a.createContext(null),EU=g6.Provider;g6.Consumer;var p6=()=>{return a.useContext(g6)},xU=(_)=>({connectOnClick:_.connectOnClick,noPanClassName:_.noPanClassName,rfId:_.rfId}),c9=a.createContext(null);function mU({children:_}){let Q=O1(xU,S1);return d.jsx(c9.Provider,{value:Q,children:_})}function gU(){let _=a.useContext(c9);if(!_)throw Error("useHandleConfig must be used within a HandleConfigProvider");return _}var pU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},cU=(_,Q,J)=>(q)=>{let{connectionClickStartHandle:U,connectionMode:G,connection:Z}=q,{fromHandle:F,toHandle:K,isValid:Y}=Z;if(!F&&!U)return pU;let X=K?.nodeId===_&&K?.id===Q&&K?.type===J;return{connectingFrom:F?.nodeId===_&&F?.id===Q&&F?.type===J,connectingTo:X,clickConnecting:U?.nodeId===_&&U?.id===Q&&U?.type===J,isPossibleEndHandle:G===e0.Strict?F?.type!==J:_!==F?.nodeId||Q!==F?.id,connectionInProcess:!!F,clickConnectionInProcess:!!U,valid:X&&Y}};function lU({type:_="source",position:Q=Z1.Top,isValidConnection:J,isConnectable:q=!0,isConnectableStart:U=!0,isConnectableEnd:G=!0,id:Z,onConnect:F,children:K,className:Y,onMouseDown:X,onTouchStart:H,...L},W){let A=Z||null,I=_==="target",R=v1(),M=p6(),{connectOnClick:O,noPanClassName:B,rfId:T}=gU(),{connectingFrom:f,connectingTo:C,clickConnecting:N,isPossibleEndHandle:S,connectionInProcess:w,clickConnectionInProcess:k,valid:x}=O1(cU(M,A,_),S1);if(!M)R.getState().onError?.("010",_0.error010());let r=(D)=>{let{defaultEdgeOptions:V,onConnect:E,hasDefaultEdges:u}=R.getState(),b={...V,...D};if(u){let{edges:P,setEdges:y,onError:p}=R.getState();y(IU(b,P,{onError:p}))}E?.(b),F?.(b)},m=(D)=>{if(!M)return;let V=v6(D.nativeEvent);if(U&&(V&&D.button===0||!V)){let E=R.getState();P4.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:E.autoPanOnConnect,connectionMode:E.connectionMode,connectionRadius:E.connectionRadius,domNode:E.domNode,nodeLookup:E.nodeLookup,lib:E.lib,isTarget:I,handleId:A,nodeId:M,flowId:E.rfId,panBy:E.panBy,cancelConnection:E.cancelConnection,onConnectStart:E.onConnectStart,onConnectEnd:(...u)=>R.getState().onConnectEnd?.(...u),updateConnection:E.updateConnection,onConnect:r,isValidConnection:J||((...u)=>R.getState().isValidConnection?.(...u)??!0),getTransform:()=>R.getState().transform,getFromHandle:()=>R.getState().connection.fromHandle,autoPanSpeed:E.autoPanSpeed,dragThreshold:E.connectionDragThreshold})}if(V)X?.(D);else H?.(D)},v=(D)=>{let{onClickConnectStart:V,onClickConnectEnd:E,connectionClickStartHandle:u,connectionMode:b,isValidConnection:P,lib:y,rfId:p,nodeLookup:h,connection:e}=R.getState();if(!M||!u&&!U)return;if(!u){V?.(D.nativeEvent,{nodeId:M,handleId:A,handleType:_}),R.setState({connectionClickStartHandle:{nodeId:M,type:_,id:A}});return}let t=C6(D.target),o=J||P,{connection:s,isValid:g}=P4.isValid(D.nativeEvent,{handle:{nodeId:M,id:A,type:_},connectionMode:b,fromNodeId:u.nodeId,fromHandleId:u.id||null,fromType:u.type,isValidConnection:o,flowId:p,doc:t,lib:y,nodeLookup:h});if(g&&s)r(s);let J1=structuredClone(e);delete J1.inProgress,J1.toPosition=J1.toHandle?J1.toHandle.position:null,E?.(D,J1),R.setState({connectionClickStartHandle:null})};return d.jsx("div",{"data-handleid":A,"data-nodeid":M,"data-handlepos":Q,"data-id":`${T}-${M}-${A}-${_}`,className:j1(["react-flow__handle",`react-flow__handle-${Q}`,"nodrag",B,Y,{source:!I,target:I,connectable:q,connectablestart:U,connectableend:G,clickconnecting:N,connectingfrom:f,connectingto:C,valid:x,connectionindicator:q&&(!w||S)&&(w||k?G:U)}]),onMouseDown:m,onTouchStart:m,onClick:O?v:void 0,ref:W,...L,children:K})}var C4=a.memo(E9(lU));function iU({data:_,isConnectable:Q,sourcePosition:J=Z1.Bottom}){return d.jsxs(d.Fragment,{children:[_?.label,d.jsx(C4,{type:"source",position:J,isConnectable:Q})]})}function rU({data:_,isConnectable:Q,targetPosition:J=Z1.Top,sourcePosition:q=Z1.Bottom}){return d.jsxs(d.Fragment,{children:[d.jsx(C4,{type:"target",position:J,isConnectable:Q}),_?.label,d.jsx(C4,{type:"source",position:q,isConnectable:Q})]})}function dU(){return null}function aU({data:_,isConnectable:Q,targetPosition:J=Z1.Top}){return d.jsxs(d.Fragment,{children:[d.jsx(C4,{type:"target",position:J,isConnectable:Q}),_?.label]})}var S4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},B9={input:iU,default:rU,output:aU,group:dU};function sU(_){if(_.internals.handleBounds===void 0)return{width:_.width??_.initialWidth??_.style?.width,height:_.height??_.initialHeight??_.style?.height};return{width:_.width??_.style?.width,height:_.height??_.style?.height}}var tU=(_)=>{let{width:Q,height:J,x:q,y:U}=R2(_.nodeLookup,{filter:(G)=>!!G.selected});return{width:K0(Q)?Q:null,height:K0(J)?J:null,userSelectionActive:_.userSelectionActive,transformString:`translate(${_.transform[0]}px,${_.transform[1]}px) scale(${_.transform[2]}) translate(${q}px,${U}px)`}};function oU({onSelectionContextMenu:_,noPanClassName:Q,disableKeyboardA11y:J}){let q=v1(),{width:U,height:G,transformString:Z,userSelectionActive:F}=O1(tU,S1),K=p9(),Y=a.useRef(null);a.useEffect(()=>{if(!J)Y.current?.focus({preventScroll:!0})},[J]);let X=!F&&U!==null&&G!==null;if(g9({nodeRef:Y,disabled:!X}),!X)return null;let H=_?(W)=>{let A=q.getState().nodes.filter((I)=>I.selected);_(W,A)}:void 0,L=(W)=>{if(Object.prototype.hasOwnProperty.call(S4,W.key))W.preventDefault(),K({direction:S4[W.key],factor:W.shiftKey?4:1})};return d.jsx("div",{className:j1(["react-flow__nodesselection","react-flow__container",Q]),style:{transform:Z},children:d.jsx("div",{ref:Y,className:"react-flow__nodesselection-rect",onContextMenu:H,tabIndex:J?void 0:-1,onKeyDown:J?void 0:L,style:{width:U,height:G}})})}var M9=typeof window<"u"?window:void 0,nU=(_)=>{return{nodesSelectionActive:_.nodesSelectionActive,userSelectionActive:_.userSelectionActive}};function l9({children:_,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,paneClickDistance:F,deleteKeyCode:K,selectionKeyCode:Y,selectionOnDrag:X,selectionMode:H,onSelectionStart:L,onSelectionEnd:W,multiSelectionKeyCode:A,panActivationKeyCode:I,zoomActivationKeyCode:R,elementsSelectable:M,zoomOnScroll:O,zoomOnPinch:B,panOnScroll:T,panOnScrollSpeed:f,panOnScrollMode:C,zoomOnDoubleClick:N,panOnDrag:S,autoPanOnSelection:w,defaultViewport:k,translateExtent:x,minZoom:r,maxZoom:m,preventScrolling:v,onSelectionContextMenu:D,noWheelClassName:V,noPanClassName:E,disableKeyboardA11y:u,onViewportChange:b,isControlledViewport:P}){let{nodesSelectionActive:y,userSelectionActive:p}=O1(nU,S1),h=k5(Y,{target:M9}),e=k5(I,{target:M9}),t=e||S,o=e||T,s=X&&t!==!0,g=h||p||s;return vU({deleteKeyCode:K,multiSelectionKeyCode:A}),d.jsx(jU,{onPaneContextMenu:G,elementsSelectable:M,zoomOnScroll:O,zoomOnPinch:B,panOnScroll:o,panActivationKeyPressed:e,panOnScrollSpeed:f,panOnScrollMode:C,zoomOnDoubleClick:N,panOnDrag:!h&&t,defaultViewport:k,translateExtent:x,minZoom:r,maxZoom:m,zoomActivationKeyCode:R,preventScrolling:v,noWheelClassName:V,noPanClassName:E,onViewportChange:b,isControlledViewport:P,paneClickDistance:F,selectionOnDrag:s,children:d.jsxs(DU,{onSelectionStart:L,onSelectionEnd:W,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,panOnDrag:t,autoPanOnSelection:w,isSelecting:!!g,selectionMode:H,selectionKeyPressed:h,paneClickDistance:F,selectionOnDrag:s,children:[_,y&&d.jsx(oU,{onSelectionContextMenu:D,noPanClassName:E,disableKeyboardA11y:u})]})})}l9.displayName="FlowRenderer";var eU=a.memo(l9),_G=(_)=>(Q)=>{return _?Y4(Q.nodeLookup,{x:0,y:0,width:Q.width,height:Q.height},Q.transform,!0).map((J)=>J.id):Array.from(Q.nodeLookup.keys())};function QG(_){return O1(a.useCallback(_G(_),[_]),S1)}var JG=(_)=>_.updateNodeInternals;function $G(){let _=O1(JG),[Q]=a.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver((J)=>{let q=new Map;J.forEach((U)=>{let G=U.target.getAttribute("data-id");q.set(G,{id:G,nodeElement:U.target,force:!0})}),_(q)})});return a.useEffect(()=>{return()=>{Q?.disconnect()}},[Q]),Q}function qG({node:_,nodeType:Q,hasDimensions:J,resizeObserver:q}){let U=v1(),G=a.useRef(null),Z=a.useRef(null),F=a.useRef(_.sourcePosition),K=a.useRef(_.targetPosition),Y=a.useRef(Q),X=J&&!!_.internals.handleBounds;return a.useEffect(()=>{if(G.current&&!_.hidden&&(!X||Z.current!==G.current)){if(Z.current)q?.unobserve(Z.current);q?.observe(G.current),Z.current=G.current}},[X,_.hidden]),a.useEffect(()=>{return()=>{if(Z.current)q?.unobserve(Z.current),Z.current=null}},[]),a.useEffect(()=>{if(G.current){let H=Y.current!==Q,L=F.current!==_.sourcePosition,W=K.current!==_.targetPosition;if(H||L||W)Y.current=Q,F.current=_.sourcePosition,K.current=_.targetPosition,U.getState().updateNodeInternals(new Map([[_.id,{id:_.id,nodeElement:G.current,force:!0}]]))}},[_.id,Q,_.sourcePosition,_.targetPosition]),G}function UG({id:_,onClick:Q,onMouseEnter:J,onMouseMove:q,onMouseLeave:U,onContextMenu:G,onDoubleClick:Z,nodesDraggable:F,elementsSelectable:K,nodesConnectable:Y,nodesFocusable:X,resizeObserver:H,noDragClassName:L,noPanClassName:W,disableKeyboardA11y:A,rfId:I,nodeTypes:R,nodeClickDistance:M,onError:O}){let{node:B,internals:T,isParent:f}=O1((g)=>{let J1=g.nodeLookup.get(_),U1=g.parentLookup.has(_);return{node:J1,internals:J1.internals,isParent:U1}},S1),C=B.type||"default",N=R?.[C]||B9[C];if(N===void 0)O?.("003",_0.error003(C)),C="default",N=R?.default||B9.default;let S=!!(B.draggable||F&&typeof B.draggable>"u"),w=!!(B.selectable||K&&typeof B.selectable>"u"),k=!!(B.connectable||Y&&typeof B.connectable>"u"),x=!!(B.focusable||X&&typeof B.focusable>"u"),r=v1(),m=P6(B),v=qG({node:B,nodeType:C,hasDimensions:m,resizeObserver:H}),D=g9({nodeRef:v,disabled:B.hidden||!S,noDragClassName:L,handleSelector:B.dragHandle,nodeId:_,isSelectable:w,nodeClickDistance:M}),V=p9();if(B.hidden)return null;let E=Y0(B),u=sU(B),b=w||S||Q||J||q||U,P=J?(g)=>J(g,{...T.userNode}):void 0,y=q?(g)=>q(g,{...T.userNode}):void 0,p=U?(g)=>U(g,{...T.userNode}):void 0,h=G?(g)=>G(g,{...T.userNode}):void 0,e=Z?(g)=>Z(g,{...T.userNode}):void 0,t=(g)=>{let{selectNodesOnDrag:J1,nodeDragThreshold:U1}=r.getState();if(w&&(!J1||!S||U1>0))m6({id:_,store:r,nodeRef:v});if(Q)Q(g,{...T.userNode})},o=(g)=>{if(S6(g.nativeEvent)||A)return;if(L6.includes(g.key)&&w){let J1=g.key==="Escape";m6({id:_,store:r,unselect:J1,nodeRef:v})}else if(S&&B.selected&&Object.prototype.hasOwnProperty.call(S4,g.key)){g.preventDefault();let{ariaLabelConfig:J1}=r.getState();r.setState({ariaLiveMessage:J1["node.a11yDescription.ariaLiveMessage"]({direction:g.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),V({direction:S4[g.key],factor:g.shiftKey?4:1})}},s=()=>{if(A||!v.current?.matches(":focus-visible"))return;let{transform:g,width:J1,height:U1,autoPanOnNodeFocus:X1,setCenter:G1}=r.getState();if(!X1)return;if(!(Y4(new Map([[_,B]]),{x:0,y:0,width:J1,height:U1},g,!0).length>0))G1(B.position.x+E.width/2,B.position.y+E.height/2,{zoom:g[2]})};return d.jsx("div",{className:j1(["react-flow__node",`react-flow__node-${C}`,{[W]:S},B.className,{selected:B.selected,selectable:w,parent:f,draggable:S,dragging:D}]),ref:v,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:b?"all":"none",visibility:m?"visible":"hidden",...B.style,...u},"data-id":_,"data-testid":`rf__node-${_}`,onMouseEnter:P,onMouseMove:y,onMouseLeave:p,onContextMenu:h,onClick:t,onDoubleClick:e,onKeyDown:x?o:void 0,tabIndex:x?0:void 0,onFocus:x?s:void 0,role:B.ariaRole??(x?"group":void 0),"aria-roledescription":"node","aria-describedby":A?void 0:`${V9}-${I}`,"aria-label":B.ariaLabel,...B.domAttributes,children:d.jsx(EU,{value:_,children:d.jsx(N,{id:_,data:B.data,type:C,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:B.selected??!1,selectable:w,draggable:S,deletable:B.deletable??!0,isConnectable:k,sourcePosition:B.sourcePosition,targetPosition:B.targetPosition,dragging:D,dragHandle:B.dragHandle,zIndex:T.z,parentId:B.parentId,...E})})})}var GG=a.memo(UG),ZG=(_)=>({nodesConnectable:_.nodesConnectable,nodesFocusable:_.nodesFocusable,elementsSelectable:_.elementsSelectable,onError:_.onError});function i9(_){let{nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,onError:U}=O1(ZG,S1),G=QG(_.onlyRenderVisibleElements),Z=$G();return d.jsx("div",{className:"react-flow__nodes",style:y4,children:G.map((F)=>{return d.jsx(GG,{id:F,nodeTypes:_.nodeTypes,nodeExtent:_.nodeExtent,onClick:_.onNodeClick,onMouseEnter:_.onNodeMouseEnter,onMouseMove:_.onNodeMouseMove,onMouseLeave:_.onNodeMouseLeave,onContextMenu:_.onNodeContextMenu,onDoubleClick:_.onNodeDoubleClick,noDragClassName:_.noDragClassName,noPanClassName:_.noPanClassName,rfId:_.rfId,disableKeyboardA11y:_.disableKeyboardA11y,resizeObserver:Z,nodesDraggable:_.nodesDraggable??!0,nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,nodeClickDistance:_.nodeClickDistance,onError:U},F)})})}i9.displayName="NodeRenderer";var FG=a.memo(i9);function HG(_){return O1(a.useCallback((J)=>{if(!_)return J.edges.map((U)=>U.id);let q=[];if(J.width&&J.height)for(let U of J.edges){let G=J.nodeLookup.get(U.source),Z=J.nodeLookup.get(U.target);if(G&&Z&&P7({sourceNode:G,targetNode:Z,width:J.width,height:J.height,transform:J.transform}))q.push(U.id)}return q},[_]),S1)}var KG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_}};return d.jsx("polyline",{className:"arrow",style:J,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},XG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_,fill:_}};return d.jsx("polyline",{className:"arrowclosed",style:J,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},T9={[g2.Arrow]:KG,[g2.ArrowClosed]:XG};function YG(_){let Q=v1();return a.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(T9,_))return Q.getState().onError?.("009",_0.error009(_)),null;return T9[_]},[_])}var LG=({id:_,type:Q,color:J,width:q=12.5,height:U=12.5,markerUnits:G="strokeWidth",strokeWidth:Z,orient:F="auto-start-reverse"})=>{let K=YG(Q);if(!K)return null;return d.jsx("marker",{className:"react-flow__arrowhead",id:_,markerWidth:`${q}`,markerHeight:`${U}`,viewBox:"-10 -10 20 20",markerUnits:G,orient:F,refX:"0",refY:"0",children:d.jsx(K,{color:J,strokeWidth:Z})})},r9=({defaultColor:_,rfId:Q})=>{let J=O1((G)=>G.edges),q=O1((G)=>G.defaultEdgeOptions),U=a.useMemo(()=>{return N7(J,{id:Q,defaultColor:_,defaultMarkerStart:q?.markerStart,defaultMarkerEnd:q?.markerEnd})},[J,q,Q,_]);if(!U.length)return null;return d.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:d.jsx("defs",{children:U.map((G)=>d.jsx(LG,{id:G.id,type:G.type,color:G.color,width:G.width,height:G.height,markerUnits:G.markerUnits,strokeWidth:G.strokeWidth,orient:G.orient},G.id))})})};r9.displayName="MarkerDefinitions";var zG=a.memo(r9);function d9({x:_,y:Q,label:J,labelStyle:q,labelShowBg:U=!0,labelBgStyle:G,labelBgPadding:Z=[2,4],labelBgBorderRadius:F=2,children:K,className:Y,...X}){let[H,L]=a.useState({x:1,y:0,width:0,height:0}),W=j1(["react-flow__edge-textwrapper",Y]),A=a.useRef(null);if(a.useEffect(()=>{if(A.current){let I=A.current.getBBox();L({x:I.x,y:I.y,width:I.width,height:I.height})}},[J]),!J)return null;return d.jsxs("g",{transform:`translate(${_-H.width/2} ${Q-H.height/2})`,className:W,visibility:H.width?"visible":"hidden",...X,children:[U&&d.jsx("rect",{width:H.width+2*Z[0],x:-Z[0],y:-Z[1],height:H.height+2*Z[1],className:"react-flow__edge-textbg",style:G,rx:F,ry:F}),d.jsx("text",{className:"react-flow__edge-text",y:H.height/2,dy:"0.3em",ref:A,style:q,children:J}),K]})}d9.displayName="EdgeText";var WG=a.memo(d9);function k4({path:_,labelX:Q,labelY:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:K,interactionWidth:Y=20,...X}){return d.jsxs(d.Fragment,{children:[d.jsx("path",{...X,d:_,fill:"none",className:j1(["react-flow__edge-path",X.className])}),Y?d.jsx("path",{d:_,fill:"none",strokeOpacity:0,strokeWidth:Y,className:"react-flow__edge-interaction"}):null,q&&K0(Q)&&K0(J)?d.jsx(WG,{x:Q,y:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:K}):null]})}function R9({pos:_,x1:Q,y1:J,x2:q,y2:U}){if(_===Z1.Left||_===Z1.Right)return[0.5*(Q+q),J];return[Q,0.5*(J+U)]}function a9({sourceX:_,sourceY:Q,sourcePosition:J=Z1.Bottom,targetX:q,targetY:U,targetPosition:G=Z1.Top}){let[Z,F]=R9({pos:J,x1:_,y1:Q,x2:q,y2:U}),[K,Y]=R9({pos:G,x1:q,y1:U,x2:_,y2:Q}),[X,H,L,W]=B4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:Z,sourceControlY:F,targetControlX:K,targetControlY:Y});return[`M${_},${Q} C${Z},${F} ${K},${Y} ${q},${U}`,X,H,L,W]}function s9(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z,targetPosition:F,label:K,labelStyle:Y,labelShowBg:X,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:W,style:A,markerEnd:I,markerStart:R,interactionWidth:M})=>{let[O,B,T]=a9({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F}),f=_.isInternal?void 0:Q;return d.jsx(k4,{id:f,path:O,labelX:B,labelY:T,label:K,labelStyle:Y,labelShowBg:X,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:W,style:A,markerEnd:I,markerStart:R,interactionWidth:M})})}var AG=s9({isInternal:!1}),t9=s9({isInternal:!0});AG.displayName="SimpleBezierEdge";t9.displayName="SimpleBezierEdgeInternal";function o9(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:K,labelBgStyle:Y,labelBgPadding:X,labelBgBorderRadius:H,style:L,sourcePosition:W=Z1.Bottom,targetPosition:A=Z1.Top,markerEnd:I,markerStart:R,pathOptions:M,interactionWidth:O})=>{let[B,T,f]=y5({sourceX:J,sourceY:q,sourcePosition:W,targetX:U,targetY:G,targetPosition:A,borderRadius:M?.borderRadius,offset:M?.offset,stepPosition:M?.stepPosition}),C=_.isInternal?void 0:Q;return d.jsx(k4,{id:C,path:B,labelX:T,labelY:f,label:Z,labelStyle:F,labelShowBg:K,labelBgStyle:Y,labelBgPadding:X,labelBgBorderRadius:H,style:L,markerEnd:I,markerStart:R,interactionWidth:O})})}var n9=o9({isInternal:!1}),e9=o9({isInternal:!0});n9.displayName="SmoothStepEdge";e9.displayName="SmoothStepEdgeInternal";function __(_){return a.memo(({id:Q,...J})=>{let q=_.isInternal?void 0:Q;return d.jsx(n9,{...J,id:q,pathOptions:a.useMemo(()=>({borderRadius:0,offset:J.pathOptions?.offset}),[J.pathOptions?.offset])})})}var BG=__({isInternal:!1}),Q_=__({isInternal:!0});BG.displayName="StepEdge";Q_.displayName="StepEdgeInternal";function J_(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:K,labelBgStyle:Y,labelBgPadding:X,labelBgBorderRadius:H,style:L,markerEnd:W,markerStart:A,interactionWidth:I})=>{let[R,M,O]=T4({sourceX:J,sourceY:q,targetX:U,targetY:G}),B=_.isInternal?void 0:Q;return d.jsx(k4,{id:B,path:R,labelX:M,labelY:O,label:Z,labelStyle:F,labelShowBg:K,labelBgStyle:Y,labelBgPadding:X,labelBgBorderRadius:H,style:L,markerEnd:W,markerStart:A,interactionWidth:I})})}var MG=J_({isInternal:!1}),$_=J_({isInternal:!0});MG.displayName="StraightEdge";$_.displayName="StraightEdgeInternal";function q_(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z=Z1.Bottom,targetPosition:F=Z1.Top,label:K,labelStyle:Y,labelShowBg:X,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:W,style:A,markerEnd:I,markerStart:R,pathOptions:M,interactionWidth:O})=>{let[B,T,f]=M4({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F,curvature:M?.curvature}),C=_.isInternal?void 0:Q;return d.jsx(k4,{id:C,path:B,labelX:T,labelY:f,label:K,labelStyle:Y,labelShowBg:X,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:W,style:A,markerEnd:I,markerStart:R,interactionWidth:O})})}var TG=q_({isInternal:!1}),U_=q_({isInternal:!0});TG.displayName="BezierEdge";U_.displayName="BezierEdgeInternal";var O9={default:U_,straight:$_,step:Q_,smoothstep:e9,simplebezier:t9},I9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},RG=(_,Q,J)=>{if(J===Z1.Left)return _-Q;if(J===Z1.Right)return _+Q;return _},OG=(_,Q,J)=>{if(J===Z1.Top)return _-Q;if(J===Z1.Bottom)return _+Q;return _},P9="react-flow__edgeupdater";function w9({position:_,centerX:Q,centerY:J,radius:q=10,onMouseDown:U,onMouseEnter:G,onMouseOut:Z,type:F}){return d.jsx("circle",{onMouseDown:U,onMouseEnter:G,onMouseOut:Z,className:j1([P9,`${P9}-${F}`]),cx:RG(Q,q,_),cy:OG(J,q,_),r:q,stroke:"transparent",fill:"transparent"})}function IG({isReconnectable:_,reconnectRadius:Q,edge:J,sourceX:q,sourceY:U,targetX:G,targetY:Z,sourcePosition:F,targetPosition:K,onReconnect:Y,onReconnectStart:X,onReconnectEnd:H,setReconnecting:L,setUpdateHover:W}){let A=v1(),I=(T,f)=>{if(T.button!==0)return;let{autoPanOnConnect:C,domNode:N,connectionMode:S,connectionRadius:w,lib:k,onConnectStart:x,cancelConnection:r,nodeLookup:m,rfId:v,panBy:D,updateConnection:V}=A.getState(),E=f.type==="target",u=(y,p)=>{L(!1),H?.(y,J,f.type,p)},b=(y)=>Y?.(J,y),P=(y,p)=>{L(!0),X?.(T,J,f.type),x?.(y,p)};P4.onPointerDown(T.nativeEvent,{autoPanOnConnect:C,connectionMode:S,connectionRadius:w,domNode:N,handleId:f.id,nodeId:f.nodeId,nodeLookup:m,isTarget:E,edgeUpdaterType:f.type,lib:k,flowId:v,cancelConnection:r,panBy:D,isValidConnection:(...y)=>A.getState().isValidConnection?.(...y)??!0,onConnect:b,onConnectStart:P,onConnectEnd:(...y)=>A.getState().onConnectEnd?.(...y),onReconnectEnd:u,updateConnection:V,getTransform:()=>A.getState().transform,getFromHandle:()=>A.getState().connection.fromHandle,dragThreshold:A.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},R=(T)=>I(T,{nodeId:J.target,id:J.targetHandle??null,type:"target"}),M=(T)=>I(T,{nodeId:J.source,id:J.sourceHandle??null,type:"source"}),O=()=>W(!0),B=()=>W(!1);return d.jsxs(d.Fragment,{children:[(_===!0||_==="source")&&d.jsx(w9,{position:F,centerX:q,centerY:U,radius:Q,onMouseDown:R,onMouseEnter:O,onMouseOut:B,type:"source"}),(_===!0||_==="target")&&d.jsx(w9,{position:K,centerX:G,centerY:Z,radius:Q,onMouseDown:M,onMouseEnter:O,onMouseOut:B,type:"target"})]})}function PG({id:_,edgesFocusable:Q,edgesReconnectable:J,elementsSelectable:q,onClick:U,onDoubleClick:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:K,onMouseLeave:Y,reconnectRadius:X,onReconnect:H,onReconnectStart:L,onReconnectEnd:W,rfId:A,edgeTypes:I,noPanClassName:R,onError:M,disableKeyboardA11y:O}){let B=O1((G1)=>G1.edgeLookup.get(_)),T=O1((G1)=>G1.defaultEdgeOptions);B=T?{...T,...B}:B;let f=B.type||"default",C=I?.[f]||O9[f];if(C===void 0)M?.("011",_0.error011(f)),f="default",C=I?.default||O9.default;let N=!!(B.focusable||Q&&typeof B.focusable>"u"),S=typeof H<"u"&&(B.reconnectable||J&&typeof B.reconnectable>"u"),w=!!(B.selectable||q&&typeof B.selectable>"u"),k=a.useRef(null),[x,r]=a.useState(!1),[m,v]=a.useState(!1),D=v1(),{zIndex:V=B.zIndex,sourceX:E,sourceY:u,targetX:b,targetY:P,sourcePosition:y,targetPosition:p}=O1(a.useCallback((G1)=>{let F1=G1.nodeLookup.get(B.source),A1=G1.nodeLookup.get(B.target);if(!F1||!A1)return I9;let Y1=f7({id:_,sourceNode:F1,targetNode:A1,sourceHandle:B.sourceHandle||null,targetHandle:B.targetHandle||null,connectionMode:G1.connectionMode,onError:M}),Q1=I7({selected:B.selected,zIndex:B.zIndex,sourceNode:F1,targetNode:A1,elevateOnSelect:G1.elevateEdgesOnSelect,zIndexMode:G1.zIndexMode});return{...Y1||I9,zIndex:Q1}},[B.source,B.target,B.sourceHandle,B.targetHandle,B.selected,B.zIndex,M]),S1),h=a.useMemo(()=>B.markerStart?`url('#${R4(B.markerStart,A)}')`:void 0,[B.markerStart,A]),e=a.useMemo(()=>B.markerEnd?`url('#${R4(B.markerEnd,A)}')`:void 0,[B.markerEnd,A]);if(B.hidden||E===null||u===null||b===null||P===null)return null;let t=(G1)=>{let{addSelectedEdges:F1,unselectNodesAndEdges:A1,multiSelectionActive:Y1}=D.getState();if(w)if(D.setState({nodesSelectionActive:!1}),B.selected&&Y1)A1({nodes:[],edges:[B]}),k.current?.blur();else F1([_]);if(U)U(G1,B)},o=G?(G1)=>{G(G1,{...B})}:void 0,s=Z?(G1)=>{Z(G1,{...B})}:void 0,g=F?(G1)=>{F(G1,{...B})}:void 0,J1=K?(G1)=>{K(G1,{...B})}:void 0,U1=Y?(G1)=>{Y(G1,{...B})}:void 0,X1=(G1)=>{if(!O&&L6.includes(G1.key)&&w){let{unselectNodesAndEdges:F1,addSelectedEdges:A1}=D.getState();if(G1.key==="Escape")k.current?.blur(),F1({edges:[B]});else A1([_])}};return d.jsx("svg",{style:{zIndex:V},children:d.jsxs("g",{className:j1(["react-flow__edge",`react-flow__edge-${f}`,B.className,R,{selected:B.selected,animated:B.animated,inactive:!w&&!U,updating:x,selectable:w}]),onClick:t,onDoubleClick:o,onContextMenu:s,onMouseEnter:g,onMouseMove:J1,onMouseLeave:U1,onKeyDown:N?X1:void 0,tabIndex:N?0:void 0,role:B.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":_,"data-testid":`rf__edge-${_}`,"aria-label":B.ariaLabel===null?void 0:B.ariaLabel||`Edge from ${B.source} to ${B.target}`,"aria-describedby":N?`${u9}-${A}`:void 0,ref:k,...B.domAttributes,children:[!m&&d.jsx(C,{id:_,source:B.source,target:B.target,type:B.type,selected:B.selected,animated:B.animated,selectable:w,deletable:B.deletable??!0,label:B.label,labelStyle:B.labelStyle,labelShowBg:B.labelShowBg,labelBgStyle:B.labelBgStyle,labelBgPadding:B.labelBgPadding,labelBgBorderRadius:B.labelBgBorderRadius,sourceX:E,sourceY:u,targetX:b,targetY:P,sourcePosition:y,targetPosition:p,data:B.data,style:B.style,sourceHandleId:B.sourceHandle,targetHandleId:B.targetHandle,markerStart:h,markerEnd:e,pathOptions:"pathOptions"in B?B.pathOptions:void 0,interactionWidth:B.interactionWidth}),S&&d.jsx(IG,{edge:B,isReconnectable:S,reconnectRadius:X,onReconnect:H,onReconnectStart:L,onReconnectEnd:W,sourceX:E,sourceY:u,targetX:b,targetY:P,sourcePosition:y,targetPosition:p,setUpdateHover:r,setReconnecting:v})]})})}var wG=a.memo(PG),fG=(_)=>({edgesFocusable:_.edgesFocusable,edgesReconnectable:_.edgesReconnectable,elementsSelectable:_.elementsSelectable,connectionMode:_.connectionMode,onError:_.onError});function G_({defaultMarkerColor:_,onlyRenderVisibleElements:Q,rfId:J,edgeTypes:q,noPanClassName:U,onReconnect:G,onEdgeContextMenu:Z,onEdgeMouseEnter:F,onEdgeMouseMove:K,onEdgeMouseLeave:Y,onEdgeClick:X,reconnectRadius:H,onEdgeDoubleClick:L,onReconnectStart:W,onReconnectEnd:A,disableKeyboardA11y:I}){let{edgesFocusable:R,edgesReconnectable:M,elementsSelectable:O,onError:B}=O1(fG,S1),T=HG(Q);return d.jsxs("div",{className:"react-flow__edges",children:[d.jsx(zG,{defaultColor:_,rfId:J}),T.map((f)=>{return d.jsx(wG,{id:f,edgesFocusable:R,edgesReconnectable:M,elementsSelectable:O,noPanClassName:U,onReconnect:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:K,onMouseLeave:Y,onClick:X,reconnectRadius:H,onDoubleClick:L,onReconnectStart:W,onReconnectEnd:A,rfId:J,onError:B,edgeTypes:q,disableKeyboardA11y:I},f)})]})}G_.displayName="EdgeRenderer";var NG=a.memo(G_),f9=(_)=>`translate(${_[0]}px,${_[1]}px) scale(${_[2]})`;function CG({children:_}){let Q=v1(),J=a.useRef(null),[q]=a.useState(()=>Q.getState().transform);return x9(()=>{let U=null,G=()=>{let Z=Q.getState().transform;if(U&&Z[0]===U[0]&&Z[1]===U[1]&&Z[2]===U[2])return;if(U=Z,J.current)J.current.style.transform=f9(Z)};return G(),Q.subscribe(G)},[Q]),d.jsx("div",{ref:J,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:f9(q)},children:_})}function SG(_){let Q=j5(),J=a.useRef(!1);a.useEffect(()=>{if(!J.current&&Q.viewportInitialized&&_)setTimeout(()=>_(Q),1),J.current=!0},[_,Q.viewportInitialized])}var vG=(_)=>_.panZoom?.syncViewport;function yG(_){let Q=O1(vG),J=v1();return a.useEffect(()=>{if(_)Q?.(_),J.setState({transform:[_.x,_.y,_.zoom]})},[_,Q]),null}function N9(_){return _.connection.inProgress?{..._.connection,to:r2(_.connection.to,_.transform)}:{..._.connection}}function kG(_){if(_)return(J)=>{let q=N9(J);return _(q)};return N9}function jG(_){let Q=kG(_);return O1(Q,S1)}var VG=(_)=>({nodesConnectable:_.nodesConnectable,isValid:_.connection.isValid,inProgress:_.connection.inProgress,width:_.width,height:_.height});function uG({containerStyle:_,style:Q,type:J,component:q}){let{nodesConnectable:U,width:G,height:Z,isValid:F,inProgress:K}=O1(VG,S1);if(!(G&&U&&K))return null;return d.jsx("svg",{style:_,width:G,height:Z,className:"react-flow__connectionline react-flow__container",children:d.jsx("g",{className:j1(["react-flow__connection",N6(F)]),children:d.jsx(Z_,{style:Q,type:J,CustomComponent:q,isValid:F})})})}var Z_=({style:_,type:Q=f0.Bezier,CustomComponent:J,isValid:q})=>{let{inProgress:U,from:G,fromNode:Z,fromHandle:F,fromPosition:K,to:Y,toNode:X,toHandle:H,toPosition:L,pointer:W}=jG();if(!U)return;if(J)return d.jsx(J,{connectionLineType:Q,connectionLineStyle:_,fromNode:Z,fromHandle:F,fromX:G.x,fromY:G.y,toX:Y.x,toY:Y.y,fromPosition:K,toPosition:L,connectionStatus:N6(q),toNode:X,toHandle:H,pointer:W});let A="",I={sourceX:G.x,sourceY:G.y,sourcePosition:K,targetX:Y.x,targetY:Y.y,targetPosition:L};switch(Q){case f0.Bezier:[A]=M4(I);break;case f0.SimpleBezier:[A]=a9(I);break;case f0.Step:[A]=y5({...I,borderRadius:0});break;case f0.SmoothStep:[A]=y5(I);break;default:[A]=T4(I)}return d.jsx("path",{d:A,fill:"none",className:"react-flow__connection-path",style:_})};Z_.displayName="ConnectionLine";var hG={};function C9(_=hG){let Q=a.useRef(_),J=v1();a.useEffect(()=>{{let q=new Set([...Object.keys(Q.current),...Object.keys(_)]);for(let U of q)if(Q.current[U]!==_[U]){J.getState().onError?.("002",_0.error002());break}Q.current=_}},[_])}function DG(){let _=v1(),Q=a.useRef(!1);a.useEffect(()=>{if(!Q.current){let J=document.querySelector(".react-flow__pane");if(J&&window.getComputedStyle(J).zIndex!=="1")_.getState().onError?.("013",_0.error013("react"));Q.current=!0}},[])}function F_({nodeTypes:_,edgeTypes:Q,onInit:J,onNodeClick:q,onEdgeClick:U,onNodeDoubleClick:G,onEdgeDoubleClick:Z,onNodeMouseEnter:F,onNodeMouseMove:K,onNodeMouseLeave:Y,onNodeContextMenu:X,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:W,connectionLineType:A,connectionLineStyle:I,connectionLineComponent:R,connectionLineContainerStyle:M,selectionKeyCode:O,selectionOnDrag:B,selectionMode:T,multiSelectionKeyCode:f,panActivationKeyCode:C,zoomActivationKeyCode:N,deleteKeyCode:S,onlyRenderVisibleElements:w,elementsSelectable:k,defaultViewport:x,translateExtent:r,minZoom:m,maxZoom:v,preventScrolling:D,defaultMarkerColor:V,zoomOnScroll:E,zoomOnPinch:u,panOnScroll:b,panOnScrollSpeed:P,panOnScrollMode:y,zoomOnDoubleClick:p,panOnDrag:h,autoPanOnSelection:e,onPaneClick:t,onPaneMouseEnter:o,onPaneMouseMove:s,onPaneMouseLeave:g,onPaneScroll:J1,onPaneContextMenu:U1,paneClickDistance:X1,nodeClickDistance:G1,onEdgeContextMenu:F1,onEdgeMouseEnter:A1,onEdgeMouseMove:Y1,onEdgeMouseLeave:Q1,reconnectRadius:T1,onReconnect:K1,onReconnectStart:k1,onReconnectEnd:p1,noDragClassName:l1,noWheelClassName:z0,noPanClassName:Z0,disableKeyboardA11y:F0,nodeExtent:o1,rfId:Q0,viewport:n1,onViewportChange:J0,nodesDraggable:r0}){return C9(_),C9(Q),DG(),SG(J),yG(n1),d.jsx(eU,{onPaneClick:t,onPaneMouseEnter:o,onPaneMouseMove:s,onPaneMouseLeave:g,onPaneContextMenu:U1,onPaneScroll:J1,paneClickDistance:X1,deleteKeyCode:S,selectionKeyCode:O,selectionOnDrag:B,selectionMode:T,onSelectionStart:L,onSelectionEnd:W,multiSelectionKeyCode:f,panActivationKeyCode:C,zoomActivationKeyCode:N,elementsSelectable:k,zoomOnScroll:E,zoomOnPinch:u,zoomOnDoubleClick:p,panOnScroll:b,panOnScrollSpeed:P,panOnScrollMode:y,panOnDrag:h,autoPanOnSelection:e,defaultViewport:x,translateExtent:r,minZoom:m,maxZoom:v,onSelectionContextMenu:H,preventScrolling:D,noDragClassName:l1,noWheelClassName:z0,noPanClassName:Z0,disableKeyboardA11y:F0,onViewportChange:J0,isControlledViewport:!!n1,children:d.jsxs(CG,{children:[d.jsx(NG,{edgeTypes:Q,onEdgeClick:U,onEdgeDoubleClick:Z,onReconnect:K1,onReconnectStart:k1,onReconnectEnd:p1,onlyRenderVisibleElements:w,onEdgeContextMenu:F1,onEdgeMouseEnter:A1,onEdgeMouseMove:Y1,onEdgeMouseLeave:Q1,reconnectRadius:T1,defaultMarkerColor:V,noPanClassName:Z0,disableKeyboardA11y:F0,rfId:Q0}),d.jsx(uG,{style:I,type:A,component:R,containerStyle:M}),d.jsx("div",{className:"react-flow__edgelabel-renderer"}),d.jsx(FG,{nodeTypes:_,onNodeClick:q,onNodeDoubleClick:G,onNodeMouseEnter:F,onNodeMouseMove:K,onNodeMouseLeave:Y,onNodeContextMenu:X,nodeClickDistance:G1,onlyRenderVisibleElements:w,noPanClassName:Z0,noDragClassName:l1,disableKeyboardA11y:F0,nodeExtent:o1,rfId:Q0,nodesDraggable:r0}),d.jsx("div",{className:"react-flow__viewport-portal"})]})})}F_.displayName="GraphView";var bG=a.memo(F_),EG=I6("React Flow","https://reactflow.dev/"),S9=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:K=0.5,maxZoom:Y=2,nodeOrigin:X,nodeExtent:H,zIndexMode:L="basic"}={})=>{let W=new Map,A=new Map,I=new Map,R=new Map,M=q??Q??[],O=J??_??[],B=X??[0,0],T=H??c2;h6(I,R,M);let{nodesInitialized:f}=O4(O,W,A,{nodeOrigin:B,nodeExtent:T,zIndexMode:L}),C=[0,0,1];if(Z&&U&&G){let N=R2(W,{filter:(x)=>!!((x.width||x.initialWidth)&&(x.height||x.initialHeight))}),{x:S,y:w,zoom:k}=v5(N,U,G,K,Y,F?.padding??0.1);C=[S,w,k]}return{rfId:"1",width:U??0,height:G??0,transform:C,nodes:O,nodesInitialized:f,nodeLookup:W,parentLookup:A,edges:M,edgeLookup:R,connectionLookup:I,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:J!==void 0,hasDefaultEdges:q!==void 0,panZoom:null,minZoom:K,maxZoom:Y,translateExtent:c2,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:e0.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:B,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:Z??!1,fitViewOptions:F,fitViewResolver:null,connection:{...W6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:EG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:z6,zIndexMode:L,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},xG=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:K,maxZoom:Y,nodeOrigin:X,nodeExtent:H,zIndexMode:L})=>_9((W,A)=>{async function I(){let{nodeLookup:R,panZoom:M,fitViewOptions:O,fitViewResolver:B,width:T,height:f,minZoom:C,maxZoom:N}=A();if(!M)return;await W7({nodes:R,width:T,height:f,panZoom:M,minZoom:C,maxZoom:N},O),B?.resolve(!0),W({fitViewResolver:null})}return{...S9({nodes:_,edges:Q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:K,maxZoom:Y,nodeOrigin:X,nodeExtent:H,defaultNodes:J,defaultEdges:q,zIndexMode:L}),setNodes:(R)=>{let{nodeLookup:M,parentLookup:O,nodeOrigin:B,nodeExtent:T,elevateNodesOnSelect:f,fitViewQueued:C,zIndexMode:N,nodesSelectionActive:S}=A(),{nodesInitialized:w,hasSelectedNodes:k}=O4(R,M,O,{nodeOrigin:B,nodeExtent:T,elevateNodesOnSelect:f,checkEquality:!0,zIndexMode:N}),x=S&&k;if(C&&w)I(),W({nodes:R,nodesInitialized:w,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:x});else W({nodes:R,nodesInitialized:w,nodesSelectionActive:x})},setEdges:(R)=>{let{connectionLookup:M,edgeLookup:O}=A();h6(M,O,R),W({edges:R})},setDefaultNodesAndEdges:(R,M)=>{if(R){let{setNodes:O}=A();O(R),W({hasDefaultNodes:!0})}if(M){let{setEdges:O}=A();O(M),W({hasDefaultEdges:!0})}},updateNodeInternals:(R)=>{let{triggerNodeChanges:M,nodeLookup:O,parentLookup:B,domNode:T,nodeOrigin:f,nodeExtent:C,debug:N,fitViewQueued:S,zIndexMode:w}=A(),{changes:k,updatedInternals:x}=k7(R,O,B,T,f,C,w);if(!x)return;if(v7(O,B,{nodeOrigin:f,nodeExtent:C,zIndexMode:w}),S)I(),W({fitViewQueued:!1,fitViewOptions:void 0});else W({});if(k?.length>0){if(N)console.log("React Flow: trigger node changes",k);M?.(k)}},updateNodePositions:(R,M=!1)=>{let O=[],B=[],{nodeLookup:T,triggerNodeChanges:f,connection:C,updateConnection:N,onNodesChangeMiddlewareMap:S}=A();for(let[w,k]of R){let x=T.get(w),r=!!(x?.expandParent&&x?.parentId&&k?.position),m={id:w,type:"position",position:r?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:M};if(x&&C.inProgress&&C.fromNode.id===x.id){let v=_2(x,C.fromHandle,Z1.Left,!0);N({...C,from:v})}if(r&&x.parentId)O.push({id:w,parentId:x.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}});B.push(m)}if(O.length>0){let{parentLookup:w,nodeOrigin:k}=A(),x=I4(O,T,w,k);B.push(...x)}for(let w of S.values())B=w(B);f(B)},triggerNodeChanges:(R)=>{let{onNodesChange:M,setNodes:O,nodes:B,hasDefaultNodes:T,debug:f}=A();if(R?.length){if(T){let C=b9(R,B);O(C)}if(f)console.log("React Flow: trigger node changes",R);M?.(R)}},triggerEdgeChanges:(R)=>{let{onEdgesChange:M,setEdges:O,edges:B,hasDefaultEdges:T,debug:f}=A();if(R?.length){if(T){let C=RU(R,B);O(C)}if(f)console.log("React Flow: trigger edge changes",R);M?.(R)}},addSelectedNodes:(R)=>{let{multiSelectionActive:M,edgeLookup:O,nodeLookup:B,triggerNodeChanges:T,triggerEdgeChanges:f}=A();if(M){let C=R.map((N)=>O2(N,!0));T(C);return}T(a2(B,new Set([...R]),!0)),f(a2(O))},addSelectedEdges:(R)=>{let{multiSelectionActive:M,edgeLookup:O,nodeLookup:B,triggerNodeChanges:T,triggerEdgeChanges:f}=A();if(M){let C=R.map((N)=>O2(N,!0));f(C);return}f(a2(O,new Set([...R]))),T(a2(B,new Set,!0))},unselectNodesAndEdges:({nodes:R,edges:M}={})=>{let{edges:O,nodes:B,nodeLookup:T,triggerNodeChanges:f,triggerEdgeChanges:C}=A(),N=R?R:B,S=M?M:O,w=[];for(let x of N){if(!x.selected)continue;let r=T.get(x.id);if(r)r.selected=!1;w.push(O2(x.id,!1))}let k=[];for(let x of S){if(!x.selected)continue;k.push(O2(x.id,!1))}f(w),C(k)},setMinZoom:(R)=>{let{panZoom:M,maxZoom:O}=A();M?.setScaleExtent([R,O]),W({minZoom:R})},setMaxZoom:(R)=>{let{panZoom:M,minZoom:O}=A();M?.setScaleExtent([O,R]),W({maxZoom:R})},setTranslateExtent:(R)=>{A().panZoom?.setTranslateExtent(R),W({translateExtent:R})},resetSelectedElements:()=>{let{edges:R,nodes:M,triggerNodeChanges:O,triggerEdgeChanges:B,elementsSelectable:T}=A();if(!T)return;let f=M.reduce((N,S)=>S.selected?[...N,O2(S.id,!1)]:N,[]),C=R.reduce((N,S)=>S.selected?[...N,O2(S.id,!1)]:N,[]);O(f),B(C)},setNodeExtent:(R)=>{let{nodes:M,nodeLookup:O,parentLookup:B,nodeOrigin:T,elevateNodesOnSelect:f,nodeExtent:C,zIndexMode:N}=A();if(R[0][0]===C[0][0]&&R[0][1]===C[0][1]&&R[1][0]===C[1][0]&&R[1][1]===C[1][1])return;O4(M,O,B,{nodeOrigin:T,nodeExtent:R,elevateNodesOnSelect:f,checkEquality:!1,zIndexMode:N}),W({nodeExtent:R})},panBy:(R)=>{let{transform:M,width:O,height:B,panZoom:T,translateExtent:f}=A();return j7({delta:R,panZoom:T,transform:M,translateExtent:f,width:O,height:B})},setCenter:async(R,M,O)=>{let{width:B,height:T,maxZoom:f,panZoom:C}=A();if(!C)return!1;let N=typeof O?.zoom<"u"?O.zoom:f;return await C.setViewport({x:B/2-R*N,y:T/2-M*N,zoom:N},{duration:O?.duration,ease:O?.ease,interpolate:O?.interpolate}),!0},cancelConnection:()=>{W({connection:{...W6}})},updateConnection:(R)=>{W({connection:R})},reset:()=>W({...S9()})}},Object.is);function c6({initialNodes:_,initialEdges:Q,defaultNodes:J,defaultEdges:q,initialWidth:U,initialHeight:G,initialMinZoom:Z,initialMaxZoom:F,initialFitViewOptions:K,fitView:Y,nodeOrigin:X,nodeExtent:H,zIndexMode:L,children:W}){let[A]=a.useState(()=>xG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Y,minZoom:Z,maxZoom:F,fitViewOptions:K,nodeOrigin:X,nodeExtent:H,zIndexMode:L}));return d.jsx(_U,{value:A,children:d.jsx(fU,{children:d.jsx(mU,{children:W})})})}function mG({children:_,nodes:Q,edges:J,defaultNodes:q,defaultEdges:U,width:G,height:Z,fitView:F,fitViewOptions:K,minZoom:Y,maxZoom:X,nodeOrigin:H,nodeExtent:L,zIndexMode:W}){if(a.useContext(v4))return d.jsx(d.Fragment,{children:_});return d.jsx(c6,{initialNodes:Q,initialEdges:J,defaultNodes:q,defaultEdges:U,initialWidth:G,initialHeight:Z,fitView:F,initialFitViewOptions:K,initialMinZoom:Y,initialMaxZoom:X,nodeOrigin:H,nodeExtent:L,zIndexMode:W,children:_})}var gG={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function pG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,className:U,nodeTypes:G,edgeTypes:Z,onNodeClick:F,onEdgeClick:K,onInit:Y,onMove:X,onMoveStart:H,onMoveEnd:L,onConnect:W,onConnectStart:A,onConnectEnd:I,onClickConnectStart:R,onClickConnectEnd:M,onNodeMouseEnter:O,onNodeMouseMove:B,onNodeMouseLeave:T,onNodeContextMenu:f,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:S,onNodeDragStop:w,onNodesDelete:k,onEdgesDelete:x,onDelete:r,onSelectionChange:m,onSelectionDragStart:v,onSelectionDrag:D,onSelectionDragStop:V,onSelectionContextMenu:E,onSelectionStart:u,onSelectionEnd:b,onBeforeDelete:P,connectionMode:y,connectionLineType:p=f0.Bezier,connectionLineStyle:h,connectionLineComponent:e,connectionLineContainerStyle:t,deleteKeyCode:o="Backspace",selectionKeyCode:s="Shift",selectionOnDrag:g=!1,selectionMode:J1=A2.Full,panActivationKeyCode:U1="Space",multiSelectionKeyCode:X1=d2()?"Meta":"Control",zoomActivationKeyCode:G1=d2()?"Meta":"Control",snapToGrid:F1,snapGrid:A1,onlyRenderVisibleElements:Y1=!1,selectNodesOnDrag:Q1,nodesDraggable:T1,autoPanOnNodeFocus:K1,nodesConnectable:k1,nodesFocusable:p1,nodeOrigin:l1=h9,edgesFocusable:z0,edgesReconnectable:Z0,elementsSelectable:F0=!0,defaultViewport:o1=LU,minZoom:Q0=0.5,maxZoom:n1=2,translateExtent:J0=c2,preventScrolling:r0=!0,nodeExtent:H0,defaultMarkerColor:y0="#b1b1b7",zoomOnScroll:k0=!0,zoomOnPinch:q2=!0,panOnScroll:k2=!1,panOnScrollSpeed:c=0.5,panOnScrollMode:z=b0.Free,zoomOnDoubleClick:j=!0,panOnDrag:l=!0,onPaneClick:_1,onPaneMouseEnter:n,onPaneMouseMove:$1,onPaneMouseLeave:q1,onPaneScroll:H1,onPaneContextMenu:L1,paneClickDistance:M1=1,nodeClickDistance:E1=0,children:u1,onReconnect:e2,onReconnectStart:j0,onReconnectEnd:C1,onEdgeContextMenu:ZQ,onEdgeDoubleClick:FQ,onEdgeMouseEnter:HQ,onEdgeMouseMove:KQ,onEdgeMouseLeave:XQ,reconnectRadius:YQ=10,onNodesChange:LQ,onEdgesChange:zQ,noDragClassName:WQ="nodrag",noWheelClassName:AQ="nowheel",noPanClassName:U8="nopan",fitView:G8,fitViewOptions:Z8,connectOnClick:BQ,attributionPosition:MQ,proOptions:TQ,defaultEdgeOptions:RQ,elevateNodesOnSelect:OQ=!0,elevateEdgesOnSelect:IQ=!1,disableKeyboardA11y:F8=!1,autoPanOnConnect:PQ,autoPanOnNodeDrag:wQ,autoPanOnSelection:fQ=!0,autoPanSpeed:NQ,connectionRadius:CQ,isValidConnection:SQ,onError:vQ,style:yQ,id:H8,nodeDragThreshold:kQ,connectionDragThreshold:jQ,viewport:VQ,onViewportChange:uQ,width:hQ,height:DQ,colorMode:bQ="light",debug:EQ,onScroll:K8,ariaLabelConfig:xQ,zIndexMode:X8="basic",...mQ},gQ){let m4=H8||"1",pQ=BU(bQ),cQ=a.useCallback((Y8)=>{Y8.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),K8?.(Y8)},[K8]);return d.jsx("div",{"data-testid":"rf__wrapper",...mQ,onScroll:cQ,style:{...yQ,...gG},ref:gQ,className:j1(["react-flow",U,pQ]),id:H8,role:"application",children:d.jsxs(mG,{nodes:_,edges:Q,width:hQ,height:DQ,fitView:G8,fitViewOptions:Z8,minZoom:Q0,maxZoom:n1,nodeOrigin:l1,nodeExtent:H0,zIndexMode:X8,children:[d.jsx(AU,{nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,onConnect:W,onConnectStart:A,onConnectEnd:I,onClickConnectStart:R,onClickConnectEnd:M,nodesDraggable:T1,autoPanOnNodeFocus:K1,nodesConnectable:k1,nodesFocusable:p1,edgesFocusable:z0,edgesReconnectable:Z0,elementsSelectable:F0,elevateNodesOnSelect:OQ,elevateEdgesOnSelect:IQ,minZoom:Q0,maxZoom:n1,nodeExtent:H0,onNodesChange:LQ,onEdgesChange:zQ,snapToGrid:F1,snapGrid:A1,connectionMode:y,translateExtent:J0,connectOnClick:BQ,defaultEdgeOptions:RQ,fitView:G8,fitViewOptions:Z8,onNodesDelete:k,onEdgesDelete:x,onDelete:r,onNodeDragStart:N,onNodeDrag:S,onNodeDragStop:w,onSelectionDrag:D,onSelectionDragStart:v,onSelectionDragStop:V,onMove:X,onMoveStart:H,onMoveEnd:L,noPanClassName:U8,nodeOrigin:l1,rfId:m4,autoPanOnConnect:PQ,autoPanOnNodeDrag:wQ,autoPanSpeed:NQ,onError:vQ,connectionRadius:CQ,isValidConnection:SQ,selectNodesOnDrag:Q1,nodeDragThreshold:kQ,connectionDragThreshold:jQ,onBeforeDelete:P,debug:EQ,ariaLabelConfig:xQ,zIndexMode:X8}),d.jsx(bG,{onInit:Y,onNodeClick:F,onEdgeClick:K,onNodeMouseEnter:O,onNodeMouseMove:B,onNodeMouseLeave:T,onNodeContextMenu:f,onNodeDoubleClick:C,nodeTypes:G,edgeTypes:Z,connectionLineType:p,connectionLineStyle:h,connectionLineComponent:e,connectionLineContainerStyle:t,selectionKeyCode:s,selectionOnDrag:g,selectionMode:J1,deleteKeyCode:o,multiSelectionKeyCode:X1,panActivationKeyCode:U1,zoomActivationKeyCode:G1,onlyRenderVisibleElements:Y1,defaultViewport:o1,translateExtent:J0,minZoom:Q0,maxZoom:n1,preventScrolling:r0,zoomOnScroll:k0,zoomOnPinch:q2,zoomOnDoubleClick:j,panOnScroll:k2,panOnScrollSpeed:c,panOnScrollMode:z,panOnDrag:l,autoPanOnSelection:fQ,onPaneClick:_1,onPaneMouseEnter:n,onPaneMouseMove:$1,onPaneMouseLeave:q1,onPaneScroll:H1,onPaneContextMenu:L1,paneClickDistance:M1,nodeClickDistance:E1,onSelectionContextMenu:E,onSelectionStart:u,onSelectionEnd:b,onReconnect:e2,onReconnectStart:j0,onReconnectEnd:C1,onEdgeContextMenu:ZQ,onEdgeDoubleClick:FQ,onEdgeMouseEnter:HQ,onEdgeMouseMove:KQ,onEdgeMouseLeave:XQ,reconnectRadius:YQ,defaultMarkerColor:y0,noDragClassName:WQ,noWheelClassName:AQ,noPanClassName:U8,rfId:m4,disableKeyboardA11y:F8,nodeExtent:H0,viewport:VQ,onViewportChange:uQ,nodesDraggable:T1}),d.jsx(YU,{onSelectionChange:m}),u1,d.jsx(ZU,{proOptions:TQ,position:MQ}),d.jsx(GU,{rfId:m4,disableKeyboardA11y:F8})]})})}var H_=E9(pG);function K_(_){let[Q,J]=a.useState(_),q=a.useCallback((U)=>J((G)=>b9(U,G)),[]);return[Q,J,q]}var hB=_0.error014();function cG({dimensions:_,lineWidth:Q,variant:J,className:q}){return d.jsx("path",{strokeWidth:Q,d:`M${_[0]/2} 0 V${_[1]} M0 ${_[1]/2} H${_[0]}`,className:j1(["react-flow__background-pattern",J,q])})}function lG({radius:_,className:Q}){return d.jsx("circle",{cx:_,cy:_,r:_,className:j1(["react-flow__background-pattern","dots",Q])})}var N0;(function(_){_.Lines="lines",_.Dots="dots",_.Cross="cross"})(N0||(N0={}));var iG={[N0.Dots]:1,[N0.Lines]:1,[N0.Cross]:6},rG=(_)=>({transform:_.transform,patternId:`pattern-${_.rfId}`});function X_({id:_,variant:Q=N0.Dots,gap:J=20,size:q,lineWidth:U=1,offset:G=0,color:Z,bgColor:F,style:K,className:Y,patternClassName:X}){let H=a.useRef(null),{transform:L,patternId:W}=O1(rG,S1),A=q||iG[Q],I=Q===N0.Dots,R=Q===N0.Cross,M=Array.isArray(J)?J:[J,J],O=[M[0]*L[2]||1,M[1]*L[2]||1],B=A*L[2],T=Array.isArray(G)?G:[G,G],f=R?[B,B]:O,C=[T[0]*L[2]+f[0]/2,T[1]*L[2]+f[1]/2],N=`${W}${_?_:""}`;return d.jsxs("svg",{className:j1(["react-flow__background",Y]),style:{...K,...y4,"--xy-background-color-props":F,"--xy-background-pattern-color-props":Z},ref:H,"data-testid":"rf__background",children:[d.jsx("pattern",{id:N,x:L[0]%O[0],y:L[1]%O[1],width:O[0],height:O[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:I?d.jsx(lG,{radius:B/2,className:X}):d.jsx(cG,{dimensions:f,lineWidth:U,variant:Q,className:X})}),d.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}X_.displayName="Background";var Y_=a.memo(X_);function dG(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:d.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function aG(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:d.jsx("path",{d:"M0 0h32v4.2H0z"})})}function sG(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:d.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function tG(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function oG(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function N4({children:_,className:Q,...J}){return d.jsx("button",{type:"button",className:j1(["react-flow__controls-button",Q]),...J,children:_})}var nG=(_)=>({isInteractive:_.nodesDraggable||_.nodesConnectable||_.elementsSelectable,minZoomReached:_.transform[2]<=_.minZoom,maxZoomReached:_.transform[2]>=_.maxZoom,ariaLabelConfig:_.ariaLabelConfig});function L_({style:_,showZoom:Q=!0,showFitView:J=!0,showInteractive:q=!0,fitViewOptions:U,onZoomIn:G,onZoomOut:Z,onFitView:F,onInteractiveChange:K,className:Y,children:X,position:H="bottom-left",orientation:L="vertical","aria-label":W}){let A=v1(),{isInteractive:I,minZoomReached:R,maxZoomReached:M,ariaLabelConfig:O}=O1(nG,S1),{zoomIn:B,zoomOut:T,fitView:f}=j5(),C=()=>{B(),G?.()},N=()=>{T(),Z?.()},S=()=>{f(U),F?.()},w=()=>{A.setState({nodesDraggable:!I,nodesConnectable:!I,elementsSelectable:!I}),K?.(!I)};return d.jsxs(C0,{className:j1(["react-flow__controls",L==="horizontal"?"horizontal":"vertical",Y]),position:H,style:_,"data-testid":"rf__controls","aria-label":W??O["controls.ariaLabel"],children:[Q&&d.jsxs(d.Fragment,{children:[d.jsx(N4,{onClick:C,className:"react-flow__controls-zoomin",title:O["controls.zoomIn.ariaLabel"],"aria-label":O["controls.zoomIn.ariaLabel"],disabled:M,children:d.jsx(dG,{})}),d.jsx(N4,{onClick:N,className:"react-flow__controls-zoomout",title:O["controls.zoomOut.ariaLabel"],"aria-label":O["controls.zoomOut.ariaLabel"],disabled:R,children:d.jsx(aG,{})})]}),J&&d.jsx(N4,{className:"react-flow__controls-fitview",onClick:S,title:O["controls.fitView.ariaLabel"],"aria-label":O["controls.fitView.ariaLabel"],children:d.jsx(sG,{})}),q&&d.jsx(N4,{className:"react-flow__controls-interactive",onClick:w,title:O["controls.interactive.ariaLabel"],"aria-label":O["controls.interactive.ariaLabel"],children:I?d.jsx(oG,{}):d.jsx(tG,{})}),X]})}L_.displayName="Controls";var z_=a.memo(L_);function eG({id:_,x:Q,y:J,width:q,height:U,style:G,color:Z,strokeColor:F,strokeWidth:K,className:Y,borderRadius:X,shapeRendering:H,selected:L,onClick:W}){let{background:A,backgroundColor:I}=G||{},R=Z||A||I;return d.jsx("rect",{className:j1(["react-flow__minimap-node",{selected:L},Y]),x:Q,y:J,rx:X,ry:X,width:q,height:U,style:{fill:R,stroke:F,strokeWidth:K},shapeRendering:H,onClick:W?(M)=>W(M,_):void 0})}var _Z=a.memo(eG),QZ=(_)=>_.nodes.map((Q)=>Q.id),x6=(_)=>_ instanceof Function?_:()=>_;function JZ({nodeStrokeColor:_,nodeColor:Q,nodeClassName:J="",nodeBorderRadius:q=5,nodeStrokeWidth:U,nodeComponent:G=_Z,onClick:Z}){let F=O1(QZ,S1),K=x6(Q),Y=x6(_),X=x6(J),H=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return d.jsx(d.Fragment,{children:F.map((L)=>d.jsx(qZ,{id:L,nodeColorFunc:K,nodeStrokeColorFunc:Y,nodeClassNameFunc:X,nodeBorderRadius:q,nodeStrokeWidth:U,NodeComponent:G,onClick:Z,shapeRendering:H},L))})}function $Z({id:_,nodeColorFunc:Q,nodeStrokeColorFunc:J,nodeClassNameFunc:q,nodeBorderRadius:U,nodeStrokeWidth:G,shapeRendering:Z,NodeComponent:F,onClick:K}){let{node:Y,x:X,y:H,width:L,height:W}=O1((A)=>{let I=A.nodeLookup.get(_);if(!I)return{node:void 0,x:0,y:0,width:0,height:0};let R=I.internals.userNode,{x:M,y:O}=I.internals.positionAbsolute,{width:B,height:T}=Y0(R);return{node:R,x:M,y:O,width:B,height:T}},S1);if(!Y||Y.hidden||!P6(Y))return null;return d.jsx(F,{x:X,y:H,width:L,height:W,style:Y.style,selected:!!Y.selected,className:q(Y),color:Q(Y),borderRadius:U,strokeColor:J(Y),strokeWidth:G,shapeRendering:Z,onClick:K,id:Y.id})}var qZ=a.memo($Z),UZ=a.memo(JZ),GZ=200,ZZ=150,FZ=(_)=>!_.hidden,HZ=(_)=>{let Q={x:-_.transform[0]/_.transform[2],y:-_.transform[1]/_.transform[2],width:_.width/_.transform[2],height:_.height/_.transform[2]},J=!1;for(let q of _.nodeLookup.values())if(!q.hidden){J=!0;break}return{viewBB:Q,boundingRect:J?R6(R2(_.nodeLookup,{filter:FZ}),Q):Q,rfId:_.rfId,panZoom:_.panZoom,translateExtent:_.translateExtent,flowWidth:_.width,flowHeight:_.height,ariaLabelConfig:_.ariaLabelConfig}},v9=(_,Q)=>_.x===Q.x&&_.y===Q.y&&_.width===Q.width&&_.height===Q.height,KZ=(_,Q)=>v9(_.viewBB,Q.viewBB)&&v9(_.boundingRect,Q.boundingRect)&&_.rfId===Q.rfId&&_.panZoom===Q.panZoom&&_.translateExtent===Q.translateExtent&&_.flowWidth===Q.flowWidth&&_.flowHeight===Q.flowHeight&&_.ariaLabelConfig===Q.ariaLabelConfig,XZ="react-flow__minimap-desc";function W_({style:_,className:Q,nodeStrokeColor:J,nodeColor:q,nodeClassName:U="",nodeBorderRadius:G=5,nodeStrokeWidth:Z,nodeComponent:F,bgColor:K,maskColor:Y,maskStrokeColor:X,maskStrokeWidth:H,position:L="bottom-right",onClick:W,onNodeClick:A,pannable:I=!1,zoomable:R=!1,ariaLabel:M,inversePan:O,zoomStep:B=1,offsetScale:T=5}){let f=v1(),C=a.useRef(null),{boundingRect:N,panZoom:S,viewBB:w,rfId:k,translateExtent:x,flowWidth:r,flowHeight:m,ariaLabelConfig:v}=O1(HZ,KZ),D=_?.width??GZ,V=_?.height??ZZ,E=N.width/D,u=N.height/V,b=Math.max(E,u),P=b*D,y=b*V,p=T*b,h=N.x-(P-N.width)/2-p,e=N.y-(y-N.height)/2-p,t=P+p*2,o=y+p*2,s=`${XZ}-${k}`,g=a.useRef(0),J1=a.useRef();g.current=b,a.useEffect(()=>{let A1=f.getState().panZoom;if(C.current&&A1)return J1.current=x7({domNode:C.current,panZoom:A1,getTransform:()=>f.getState().transform,getViewScale:()=>g.current}),()=>{J1.current?.destroy()}},[S]),a.useEffect(()=>{J1.current?.update({translateExtent:x,width:r,height:m,inversePan:O,pannable:I,zoomStep:B,zoomable:R})},[I,R,O,B,x,r,m]);let U1=W?(A1)=>{let[Y1,Q1]=J1.current?.pointer(A1)||[0,0];W(A1,{x:Y1,y:Q1})}:void 0,X1=a.useCallback((A1,Y1)=>{let Q1=f.getState().nodeLookup.get(Y1).internals.userNode;A?.(A1,Q1)},[A]),G1=A?X1:void 0,F1=M??v["minimap.ariaLabel"];return d.jsx(C0,{position:L,style:{..._,"--xy-minimap-background-color-props":typeof K==="string"?K:void 0,"--xy-minimap-mask-background-color-props":typeof Y==="string"?Y:void 0,"--xy-minimap-mask-stroke-color-props":typeof X==="string"?X:void 0,"--xy-minimap-mask-stroke-width-props":typeof H==="number"?H*b:void 0,"--xy-minimap-node-background-color-props":typeof q==="string"?q:void 0,"--xy-minimap-node-stroke-color-props":typeof J==="string"?J:void 0,"--xy-minimap-node-stroke-width-props":typeof Z==="number"?Z:void 0},className:j1(["react-flow__minimap",Q]),"data-testid":"rf__minimap",children:d.jsxs("svg",{width:D,height:V,viewBox:`${h} ${e} ${t} ${o}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":s,ref:C,onClick:U1,children:[F1&&d.jsx("title",{id:s,children:F1}),d.jsx(UZ,{onClick:G1,nodeColor:q,nodeStrokeColor:J,nodeBorderRadius:G,nodeClassName:U,nodeStrokeWidth:Z,nodeComponent:F}),d.jsx("path",{className:"react-flow__minimap-mask",d:`M${h-p},${e-p}h${t+p*2}v${o+p*2}h${-t-p*2}z
|
|
34
|
-
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}W_.displayName="MiniMap";var A_=a.memo(W_),YZ=(_)=>(Q)=>_?`${Math.max(1/Q.transform[2],1)}`:void 0,LZ={[E0.Line]:"right",[E0.Handle]:"bottom-right"};function zZ({nodeId:_,position:Q,variant:J=E0.Handle,className:q,style:U=void 0,children:G,color:Z,minWidth:F=10,minHeight:K=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:X=Number.MAX_VALUE,keepAspectRatio:H=!1,resizeDirection:L,autoScale:W=!0,shouldResize:A,onResizeStart:I,onResize:R,onResizeEnd:M}){let O=p6(),B=typeof _==="string"?_:O,T=v1(),f=a.useRef(null),C=J===E0.Handle,N=O1(a.useCallback(YZ(C&&W),[C,W]),S1),S=a.useRef(null),w=Q??LZ[J];a.useEffect(()=>{if(!f.current||!B)return;if(!S.current)S.current=r7({domNode:f.current,nodeId:B,getStoreItems:()=>{let{nodeLookup:x,transform:r,snapGrid:m,snapToGrid:v,nodeOrigin:D,domNode:V}=T.getState();return{nodeLookup:x,transform:r,snapGrid:m,snapToGrid:v,nodeOrigin:D,paneDomNode:V}},onChange:(x,r)=>{let{triggerNodeChanges:m,nodeLookup:v,parentLookup:D,nodeOrigin:V}=T.getState(),E=[],u={x:x.x,y:x.y},b=v.get(B);if(b&&b.expandParent&&b.parentId){let P=b.origin??V,y=x.width??b.measured.width??0,p=x.height??b.measured.height??0,h={id:b.id,parentId:b.parentId,rect:{width:y,height:p,...w6({x:x.x??b.position.x,y:x.y??b.position.y},{width:y,height:p},b.parentId,v,P)}},e=I4([h],v,D,V);E.push(...e),u.x=x.x?Math.max(P[0]*y,x.x):void 0,u.y=x.y?Math.max(P[1]*p,x.y):void 0}if(u.x!==void 0&&u.y!==void 0){let P={id:B,type:"position",position:{...u}};E.push(P)}if(x.width!==void 0&&x.height!==void 0){let y={id:B,type:"dimensions",resizing:!0,setAttributes:!L?!0:L==="horizontal"?"width":"height",dimensions:{width:x.width,height:x.height}};E.push(y)}for(let P of r){let y={...P,type:"position"};E.push(y)}m(E)},onEnd:({width:x,height:r})=>{let m={id:B,type:"dimensions",resizing:!1,dimensions:{width:x,height:r}};T.getState().triggerNodeChanges([m])}});return S.current.update({controlPosition:w,boundaries:{minWidth:F,minHeight:K,maxWidth:Y,maxHeight:X},keepAspectRatio:H,resizeDirection:L,onResizeStart:I,onResize:R,onResizeEnd:M,shouldResize:A}),()=>{S.current?.destroy()}},[w,F,K,Y,X,H,I,R,M,A]);let k=w.split("-");return d.jsx("div",{className:j1(["react-flow__resize-control","nodrag",...k,J,q]),ref:f,style:{...U,scale:N,...Z&&{[C?"backgroundColor":"borderColor"]:Z}},children:G})}var y9=a.memo(zZ);function B_({nodeId:_,isVisible:Q=!0,handleClassName:J,handleStyle:q,lineClassName:U,lineStyle:G,color:Z,minWidth:F=10,minHeight:K=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:X=Number.MAX_VALUE,keepAspectRatio:H=!1,autoScale:L=!0,shouldResize:W,onResizeStart:A,onResize:I,onResizeEnd:R}){if(!Q)return null;return d.jsxs(d.Fragment,{children:[l7.map((M)=>d.jsx(y9,{className:U,style:G,nodeId:_,position:M,variant:E0.Line,color:Z,minWidth:F,minHeight:K,maxWidth:Y,maxHeight:X,onResizeStart:A,keepAspectRatio:H,autoScale:L,shouldResize:W,onResize:I,onResizeEnd:R},M)),c7.map((M)=>d.jsx(y9,{className:J,style:q,nodeId:_,position:M,color:Z,minWidth:F,minHeight:K,maxWidth:Y,maxHeight:X,onResizeStart:A,keepAspectRatio:H,autoScale:L,shouldResize:W,onResize:I,onResizeEnd:R},M))]})}var WZ=(_)=>_.domNode?.querySelector(".react-flow__renderer");function AZ({children:_}){let Q=O1(WZ);if(!Q)return null;return k9.createPortal(_,Q)}var BZ=(_,Q)=>_?.internals.positionAbsolute.x!==Q?.internals.positionAbsolute.x||_?.internals.positionAbsolute.y!==Q?.internals.positionAbsolute.y||_?.measured.width!==Q?.measured.width||_?.measured.height!==Q?.measured.height||_?.selected!==Q?.selected||_?.internals.z!==Q?.internals.z,MZ=(_,Q)=>{if(_.size!==Q.size)return!1;for(let[J,q]of _)if(BZ(q,Q.get(J)))return!1;return!0},TZ=(_)=>({x:_.transform[0],y:_.transform[1],zoom:_.transform[2],selectedNodesCount:_.nodes.filter((Q)=>Q.selected).length});function l6({nodeId:_,children:Q,className:J,style:q,isVisible:U,position:G=Z1.Top,offset:Z=10,align:F="center",...K}){let Y=p6(),X=a.useCallback((f)=>{return(Array.isArray(_)?_:[_||Y||""]).reduce((S,w)=>{let k=f.nodeLookup.get(w);if(k)S.set(k.id,k);return S},new Map)},[_,Y]),H=O1(X,MZ),{x:L,y:W,zoom:A,selectedNodesCount:I}=O1(TZ,S1);if(!(typeof U==="boolean"?U:H.size===1&&H.values().next().value?.selected&&I===1)||!H.size)return null;let M=R2(H),O=Array.from(H.values()),B=Math.max(...O.map((f)=>f.internals.z+1)),T={position:"absolute",transform:C7(M,{x:L,y:W,zoom:A},G,Z,F),zIndex:B,...q};return d.jsx(AZ,{children:d.jsx("div",{style:T,className:j1(["react-flow__node-toolbar",J]),...K,"data-id":O.reduce((f,C)=>`${f}${C.id} `,"").trim(),children:Q})})}var c1=i1(O0(),1);var M_={x:{title:"X",fill:"currentColor",d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"},youtube:{title:"YouTube",fill:"#FF0000",d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"},tiktok:{title:"TikTok",fill:"currentColor",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"},discord:{title:"Discord",fill:"#5865F2",d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},resend:{title:"Resend",fill:"currentColor",d:"M2.023 0v24h5.553v-8.434h2.998L15.326 24h6.65l-5.372-9.258a7.652 7.652 0 0 0 3.316-3.016c.709-1.21 1.062-2.57 1.062-4.08 0-1.462-.353-2.767-1.062-3.91-.709-1.165-1.692-2.079-2.95-2.742C15.737.331 14.355 0 12.823 0Zm5.553 4.87h4.219c.731 0 1.349.125 1.851.376.526.252.925.618 1.2 1.098.274.457.412.994.412 1.611S15.132 9.12 14.88 9.6c-.229.48-.572.856-1.03 1.13-.434.252-.948.38-1.542.38H7.576Z"},linkedin:{title:"LinkedIn",fill:"#0A66C2",d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"},reddit:{title:"Reddit",fill:"#FF4500",d:"M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z"},bluesky:{title:"Bluesky",fill:"#0285FF",d:"M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479.815 2.736 3.713 3.66 6.383 3.364.136-.02.275-.039.415-.056-.138.022-.276.04-.415.056-3.912.58-7.387 2.005-2.83 7.078 5.013 5.19 6.87-1.113 7.823-4.308.953 3.195 2.05 9.271 7.733 4.308 4.267-4.308 1.172-6.498-2.74-7.078a8.741 8.741 0 0 1-.415-.056c.14.017.279.036.415.056 2.67.297 5.568-.628 6.383-3.364.246-.828.624-5.79.624-6.478 0-.69-.139-1.861-.902-2.206-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8Z"},instagram:{title:"Instagram",fill:"#FF0069",d:"M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"},github:{title:"GitHub",fill:"currentColor",d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"},stripe:{title:"Stripe",fill:"#635BFF",d:"M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"},slack:{title:"Slack",fill:"#4A154B",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},openai:{title:"OpenAI",fill:"#412991",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},anthropic:{title:"Anthropic",fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"},twilio:{title:"Twilio",fill:"#F22F46",d:"M12 0C5.381-.008.008 5.352 0 11.971V12c0 6.64 5.359 12 12 12 6.64 0 12-5.36 12-12 0-6.641-5.36-12-12-12zm0 20.801c-4.846.015-8.786-3.904-8.801-8.75V12c-.014-4.846 3.904-8.786 8.75-8.801H12c4.847-.014 8.786 3.904 8.801 8.75V12c.015 4.847-3.904 8.786-8.75 8.801H12zm5.44-11.76c0 1.359-1.12 2.479-2.481 2.479-1.366-.007-2.472-1.113-2.479-2.479 0-1.361 1.12-2.481 2.479-2.481 1.361 0 2.481 1.12 2.481 2.481zm0 5.919c0 1.36-1.12 2.48-2.481 2.48-1.367-.008-2.473-1.114-2.479-2.48 0-1.359 1.12-2.479 2.479-2.479 1.361-.001 2.481 1.12 2.481 2.479zm-5.919 0c0 1.36-1.12 2.48-2.479 2.48-1.368-.007-2.475-1.113-2.481-2.48 0-1.359 1.12-2.479 2.481-2.479 1.358-.001 2.479 1.12 2.479 2.479zm0-5.919c0 1.359-1.12 2.479-2.479 2.479-1.367-.007-2.475-1.112-2.481-2.479 0-1.361 1.12-2.481 2.481-2.481 1.358 0 2.479 1.12 2.479 2.481z"},sendgrid:{title:"SendGrid",fill:"#51A9E3",d:"M.8 24h13.6c.88 0 1.6-.72 1.6-1.6v-4.8c0-.88-.72-1.6-1.6-1.6H9.6c-.88 0-1.6-.72-1.6-1.6V9.6C8 8.72 7.28 8 6.4 8H1.6C.72 8 0 8.72 0 9.6v13.6c0 .44.36.8.8.8zM23.2 0H9.6C8.72 0 8 .72 8 1.6v4.8C8 7.28 8.72 8 9.6 8h4.8c.88 0 1.6.72 1.6 1.6v4.8c0 .88.72 1.6 1.6 1.6h4.8c.88 0 1.6-.72 1.6-1.6V.8c0-.44-.36-.8-.8-.8Z"},mailgun:{title:"Mailgun",fill:"#F06B66",d:"M11.837 0c6.602 0 11.984 5.381 11.984 11.994-.017 2.99-3.264 4.84-5.844 3.331a3.805 3.805 0 0 1-.06-.035l-.055-.033-.022.055c-2.554 4.63-9.162 4.758-11.894.232-2.732-4.527.46-10.313 5.746-10.416a6.868 6.868 0 0 1 7.002 6.866 1.265 1.265 0 0 0 2.52 0c0-5.18-4.197-9.38-9.377-9.387C4.611 2.594.081 10.41 3.683 16.673c3.238 5.632 11.08 6.351 15.289 1.402l1.997 1.686A11.95 11.95 0 0 1 11.837 24C2.6 23.72-2.87 13.543 1.992 5.684A12.006 12.006 0 0 1 11.837 0Zm0 7.745c-3.276-.163-5.5 3.281-4.003 6.2a4.26 4.26 0 0 0 4.014 2.31c3.276-.171 5.137-3.824 3.35-6.575a4.26 4.26 0 0 0-3.36-1.935Zm0 2.53c1.324 0 2.152 1.433 1.49 2.58a1.72 1.72 0 0 1-1.49.86 1.72 1.72 0 1 1 0-3.44Z"},notion:{title:"Notion",fill:"currentColor",d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"},linear:{title:"Linear",fill:"#5E6AD2",d:"M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"},jira:{title:"Jira",fill:"#0052CC",d:"M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.758a1.001 1.001 0 0 0-1.001-1.001zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.001 1.001 0 0 0 23.013 0Z"},hubspot:{title:"HubSpot",fill:"#FF7A59",d:"M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z"},paypal:{title:"PayPal",fill:"#003087",d:"M7.016 19.198h-4.2a.562.562 0 0 1-.555-.65L5.093.584A.692.692 0 0 1 5.776 0h7.222c3.417 0 5.904 2.488 5.846 5.5-.006.25-.027.5-.066.747A6.794 6.794 0 0 1 12.071 12H8.743a.69.69 0 0 0-.682.583l-.325 2.056-.013.083-.692 4.39-.015.087zM19.79 6.142c-.01.087-.01.175-.023.261a7.76 7.76 0 0 1-7.695 6.598H9.007l-.283 1.795-.013.083-.692 4.39-.134.843-.014.088H6.86l-.497 3.15a.562.562 0 0 0 .555.65h3.612c.34 0 .63-.249.683-.585l.952-6.031a.692.692 0 0 1 .683-.584h2.126a6.793 6.793 0 0 0 6.707-5.752c.306-1.95-.466-3.744-1.89-4.906z"},shopify:{title:"Shopify",fill:"#7AB55C",d:"M15.337 23.979l7.216-1.561s-2.604-17.613-2.625-17.73c-.018-.116-.114-.192-.211-.192s-1.929-.136-1.929-.136-1.275-1.274-1.439-1.411c-.045-.037-.075-.057-.121-.074l-.914 21.104h.023zM11.71 11.305s-.81-.424-1.774-.424c-1.447 0-1.504.906-1.504 1.141 0 1.232 3.24 1.715 3.24 4.629 0 2.295-1.44 3.76-3.406 3.76-2.354 0-3.54-1.465-3.54-1.465l.646-2.086s1.245 1.066 2.28 1.066c.675 0 .975-.545.975-.932 0-1.619-2.654-1.694-2.654-4.359-.034-2.237 1.571-4.416 4.827-4.416 1.257 0 1.875.361 1.875.361l-.945 2.715-.02.01zM11.17.83c.136 0 .271.038.405.135-.984.465-2.064 1.639-2.508 3.992-.656.213-1.293.405-1.889.578C7.697 3.75 8.951.84 11.17.84V.83zm1.235 2.949v.135c-.754.232-1.583.484-2.394.736.466-1.777 1.333-2.645 2.085-2.971.193.501.309 1.176.309 2.1zm.539-2.234c.694.074 1.141.867 1.429 1.755-.349.114-.735.231-1.158.366v-.252c0-.752-.096-1.371-.271-1.871v.002zm2.992 1.289c-.02 0-.06.021-.078.021s-.289.075-.714.21c-.423-1.233-1.176-2.37-2.508-2.37h-.115C12.135.209 11.669 0 11.265 0 8.159 0 6.675 3.877 6.21 5.846c-1.194.365-2.063.636-2.16.674-.675.213-.694.232-.772.87-.075.462-1.83 14.063-1.83 14.063L15.009 24l.927-21.166z"},sentry:{title:"Sentry",fill:"#362D59",d:"M13.91 2.505c-.873-1.448-2.972-1.448-3.844 0L6.904 7.92a15.478 15.478 0 0 1 8.53 12.811h-2.221A13.301 13.301 0 0 0 5.784 9.814l-2.926 5.06a7.65 7.65 0 0 1 4.435 5.848H2.194a.365.365 0 0 1-.298-.534l1.413-2.402a5.16 5.16 0 0 0-1.614-.913L.296 19.275a2.182 2.182 0 0 0 .812 2.999 2.24 2.24 0 0 0 1.086.288h6.983a9.322 9.322 0 0 0-3.845-8.318l1.11-1.922a11.47 11.47 0 0 1 4.95 10.24h5.915a17.242 17.242 0 0 0-7.885-15.28l2.244-3.845a.37.37 0 0 1 .504-.13c.255.14 9.75 16.708 9.928 16.9a.365.365 0 0 1-.327.543h-2.287c.029.612.029 1.223 0 1.831h2.297a2.206 2.206 0 0 0 1.922-3.31z"},vercel:{title:"Vercel",fill:"currentColor",d:"M24 22.525H0l12-21.05 12 21.05z"},supabase:{title:"Supabase",fill:"#3FCF8E",d:"M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"},clerk:{title:"Clerk",fill:"#6C47FF",d:"m21.47 20.829-2.881-2.881a.572.572 0 0 0-.7-.084 6.854 6.854 0 0 1-7.081 0 .576.576 0 0 0-.7.084l-2.881 2.881a.576.576 0 0 0-.103.69.57.57 0 0 0 .166.186 12 12 0 0 0 14.113 0 .58.58 0 0 0 .239-.423.576.576 0 0 0-.172-.453Zm.002-17.668-2.88 2.88a.569.569 0 0 1-.701.084A6.857 6.857 0 0 0 8.724 8.08a6.862 6.862 0 0 0-1.222 3.692 6.86 6.86 0 0 0 .978 3.764.573.573 0 0 1-.083.699l-2.881 2.88a.567.567 0 0 1-.864-.063A11.993 11.993 0 0 1 6.771 2.7a11.99 11.99 0 0 1 14.637-.405.566.566 0 0 1 .232.418.57.57 0 0 1-.168.448Zm-7.118 12.261a3.427 3.427 0 1 0 0-6.854 3.427 3.427 0 0 0 0 6.854Z"},aws:{title:"Amazon Web Services",fill:"#232F3E",d:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167zM21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zM22.792 14.961c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z"},figma:{title:"Figma",fill:"#F24E1E",d:"M15.852 8.981h-4.588V0h4.588c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.491-4.49 4.491zM12.735 7.51h3.117c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-3.117V7.51zm0 1.471H8.148c-2.476 0-4.49-2.014-4.49-4.49S5.672 0 8.148 0h4.588v8.981zm-4.587-7.51c-1.665 0-3.019 1.355-3.019 3.019s1.354 3.02 3.019 3.02h3.117V1.471H8.148zm4.587 15.019H8.148c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h4.588v8.98zM8.148 8.981c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h3.117V8.981H8.148zM8.172 24c-2.489 0-4.515-2.014-4.515-4.49s2.014-4.49 4.49-4.49h4.588v4.441c0 2.503-2.047 4.539-4.563 4.539zm-.024-7.51a3.023 3.023 0 0 0-3.019 3.019c0 1.665 1.365 3.019 3.044 3.019 1.705 0 3.093-1.376 3.093-3.068v-2.97H8.148zm7.704 0h-.098c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h.098c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.49-4.49 4.49zm-.097-7.509c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h.098c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-.098z"},airtable:{title:"Airtable",fill:"#18BFFF",d:"M11.992 1.966c-.434 0-.87.086-1.28.257L1.779 5.917c-.503.208-.49.908.012 1.116l8.982 3.558a3.266 3.266 0 0 0 2.454 0l8.982-3.558c.503-.196.503-.908.012-1.116l-8.957-3.694a3.255 3.255 0 0 0-1.272-.257zM23.4 8.056a.589.589 0 0 0-.222.045l-10.012 3.877a.612.612 0 0 0-.38.564v8.896a.6.6 0 0 0 .821.552L23.62 18.1a.583.583 0 0 0 .38-.551V8.653a.6.6 0 0 0-.6-.596zM.676 8.095a.644.644 0 0 0-.48.19C.086 8.396 0 8.53 0 8.69v8.355c0 .442.515.737.908.54l6.27-3.006.307-.147 2.969-1.436c.466-.22.43-.908-.061-1.092L.883 8.138a.57.57 0 0 0-.207-.044z"},intercom:{title:"Intercom",fill:"#6AFDEF",d:"M21 0H3C1.343 0 0 1.343 0 3v18c0 1.658 1.343 3 3 3h18c1.658 0 3-1.342 3-3V3c0-1.657-1.342-3-3-3zm-5.801 4.399c0-.44.36-.8.802-.8.44 0 .8.36.8.8v10.688c0 .442-.36.801-.8.801-.443 0-.802-.359-.802-.801V4.399zM11.2 3.994c0-.44.357-.799.8-.799s.8.359.8.799v11.602c0 .44-.357.8-.8.8s-.8-.36-.8-.8V3.994zm-4 .405c0-.44.359-.8.799-.8.443 0 .802.36.802.8v10.688c0 .442-.36.801-.802.801-.44 0-.799-.359-.799-.801V4.399zM3.199 6c0-.442.36-.8.802-.8.44 0 .799.358.799.8v7.195c0 .441-.359.8-.799.8-.443 0-.802-.36-.802-.8V6zM20.52 18.202c-.123.105-3.086 2.593-8.52 2.593-5.433 0-8.397-2.486-8.521-2.593-.335-.288-.375-.792-.086-1.128.285-.334.79-.375 1.125-.09.047.041 2.693 2.211 7.481 2.211 4.848 0 7.456-2.186 7.479-2.207.334-.289.839-.25 1.128.086.289.336.25.84-.086 1.128zm.281-5.007c0 .441-.36.8-.801.8-.441 0-.801-.36-.801-.8V6c0-.442.361-.8.801-.8.441 0 .801.357.801.8v7.195z"},posthog:{title:"PostHog",fill:"currentColor",d:"M9.854 14.5 5 9.647.854 5.5A.5.5 0 0 0 0 5.854V8.44a.5.5 0 0 0 .146.353L5 13.647l.147.146L9.854 18.5l.146.147v-.049c.065.03.134.049.207.049h2.586a.5.5 0 0 0 .353-.854L9.854 14.5zm0-5-4-4a.487.487 0 0 0-.409-.144.515.515 0 0 0-.356.21.493.493 0 0 0-.089.288V8.44a.5.5 0 0 0 .147.353l9 9a.5.5 0 0 0 .853-.354v-2.585a.5.5 0 0 0-.146-.354l-5-5zm1-4a.5.5 0 0 0-.854.354V8.44a.5.5 0 0 0 .147.353l4 4a.5.5 0 0 0 .853-.354V9.854a.5.5 0 0 0-.146-.354l-4-4zm12.647 11.515a3.863 3.863 0 0 1-2.232-1.1l-4.708-4.707a.5.5 0 0 0-.854.354v6.585a.5.5 0 0 0 .5.5H23.5a.5.5 0 0 0 .5-.5v-.6c0-.276-.225-.497-.499-.532zm-5.394.032a.8.8 0 1 1 0-1.6.8.8 0 0 1 0 1.6zM.854 15.5a.5.5 0 0 0-.854.354v2.293a.5.5 0 0 0 .5.5h2.293c.222 0 .39-.135.462-.309a.493.493 0 0 0-.109-.545L.854 15.501zM5 14.647.854 10.5a.5.5 0 0 0-.854.353v2.586a.5.5 0 0 0 .146.353L4.854 18.5l.146.147h2.793a.5.5 0 0 0 .353-.854L5 14.647z"},datadog:{title:"Datadog",fill:"#632CA6",d:"M19.57 17.04l-1.997-1.316-1.665 2.782-1.937-.567-1.706 2.604.087.82 9.274-1.71-.538-5.794zm-8.649-2.498l1.488-.204c.241.108.409.15.697.223.45.117.97.23 1.741-.16.18-.088.553-.43.704-.625l6.096-1.106.622 7.527-10.444 1.882zm11.325-2.712l-.602.115L20.488 0 .789 2.285l2.427 19.693 2.306-.334c-.184-.263-.471-.581-.96-.989-.68-.564-.44-1.522-.039-2.127.53-1.022 3.26-2.322 3.106-3.956-.056-.594-.15-1.368-.702-1.898-.02.22.017.432.017.432s-.227-.289-.34-.683c-.112-.15-.2-.199-.319-.4-.085.233-.073.503-.073.503s-.186-.437-.216-.807c-.11.166-.137.48-.137.48s-.241-.69-.186-1.062c-.11-.323-.436-.965-.343-2.424.6.421 1.924.321 2.44-.439.171-.251.288-.939-.086-2.293-.24-.868-.835-2.16-1.066-2.651l-.028.02c.122.395.374 1.223.47 1.625.293 1.218.372 1.642.234 2.204-.116.488-.397.808-1.107 1.165-.71.358-1.653-.514-1.713-.562-.69-.55-1.224-1.447-1.284-1.883-.062-.477.275-.763.445-1.153-.243.07-.514.192-.514.192s.323-.334.722-.624c.165-.109.262-.178.436-.323a9.762 9.762 0 0 0-.456.003s.42-.227.855-.392c-.318-.014-.623-.003-.623-.003s.937-.419 1.678-.727c.509-.208 1.006-.147 1.286.257.367.53.752.817 1.569.996.501-.223.653-.337 1.284-.509.554-.61.99-.688.99-.688s-.216.198-.274.51c.314-.249.66-.455.66-.455s-.134.164-.259.426l.03.043c.366-.22.797-.394.797-.394s-.123.156-.268.358c.277-.002.838.012 1.056.037 1.285.028 1.552-1.374 2.045-1.55.618-.22.894-.353 1.947.68.903.888 1.609 2.477 1.259 2.833-.294.295-.874-.115-1.516-.916a3.466 3.466 0 0 1-.716-1.562 1.533 1.533 0 0 0-.497-.85s.23.51.23.96c0 .246.03 1.165.424 1.68-.039.076-.057.374-.1.43-.458-.554-1.443-.95-1.604-1.067.544.445 1.793 1.468 2.273 2.449.453.927.186 1.777.416 1.997.065.063.976 1.197 1.15 1.767.306.994.019 2.038-.381 2.685l-1.117.174c-.163-.045-.273-.068-.42-.153.08-.143.241-.5.243-.572l-.063-.111c-.348.492-.93.97-1.414 1.245-.633.359-1.363.304-1.838.156-1.348-.415-2.623-1.327-2.93-1.566 0 0-.01.191.048.234.34.383 1.119 1.077 1.872 1.56l-1.605.177.759 5.908c-.337.048-.39.071-.757.124-.325-1.147-.946-1.895-1.624-2.332-.599-.384-1.424-.47-2.214-.314l-.05.059a2.851 2.851 0 0 1 1.863.444c.654.413 1.181 1.481 1.375 2.124.248.822.42 1.7-.248 2.632-.476.662-1.864 1.028-2.986.237.3.481.705.876 1.25.95.809.11 1.577-.03 2.106-.574.452-.464.69-1.434.628-2.456l.714-.104.258 1.834 11.827-1.424zM15.05 6.848c-.034.075-.085.125-.007.37l.004.014.013.032.032.073c.14.287.295.558.552.696.067-.011.136-.019.207-.023.242-.01.395.028.492.08.009-.048.01-.119.005-.222-.018-.364.072-.982-.626-1.308-.264-.122-.634-.084-.757.068a.302.302 0 0 1 .058.013c.186.066.06.13.027.207m1.958 3.392c-.092-.05-.52-.03-.821.005-.574.068-1.193.267-1.328.372-.247.191-.135.523.047.66.511.382.96.638 1.432.575.29-.038.546-.497.728-.914.124-.288.124-.598-.058-.698m-5.077-2.942c.162-.154-.805-.355-1.556.156-.554.378-.571 1.187-.041 1.646.053.046.096.078.137.104a4.77 4.77 0 0 1 1.396-.412c.113-.125.243-.345.21-.745-.044-.542-.455-.456-.146-.749"},algolia:{title:"Algolia",fill:"#003DFF",d:"M12 0C5.445 0 .103 5.285.01 11.817c-.097 6.634 5.285 12.131 11.92 12.17a11.91 11.91 0 0 0 5.775-1.443.281.281 0 0 0 .052-.457l-1.122-.994a.79.79 0 0 0-.833-.14 9.693 9.693 0 0 1-3.923.77c-5.36-.067-9.692-4.527-9.607-9.888.084-5.293 4.417-9.573 9.73-9.573h9.73v17.296l-5.522-4.907a.407.407 0 0 0-.596.063 4.52 4.52 0 0 1-3.934 1.793 4.538 4.538 0 0 1-4.192-4.168 4.53 4.53 0 0 1 4.512-4.872 4.532 4.532 0 0 1 4.509 4.126c.018.205.11.397.265.533l1.438 1.275a.28.28 0 0 0 .462-.158 6.82 6.82 0 0 0 .099-1.725c-.232-3.376-2.966-6.092-6.345-6.3-3.873-.24-7.11 2.79-7.214 6.588-.1 3.7 2.933 6.892 6.634 6.974a6.75 6.75 0 0 0 4.136-1.294l7.212 6.394a.48.48 0 0 0 .797-.36V.456A.456.456 0 0 0 23.54 0Z"},cloudflare:{title:"Cloudflare",fill:"#F38020",d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"},upstash:{title:"Upstash",fill:"#00E9A3",d:"M13.8027 0C11.193 0 8.583.9952 6.5918 2.9863c-3.9823 3.9823-3.9823 10.4396 0 14.4219 1.9911 1.9911 5.2198 1.9911 7.211 0 1.991-1.9911 1.991-5.2198 0-7.211L12 12c.9956.9956.9956 2.6098 0 3.6055-.9956.9955-2.6099.9955-3.6055 0-2.9866-2.9868-2.9866-7.8297 0-10.8164 2.9868-2.9868 7.8297-2.9868 10.8164 0l1.8028-1.8028C19.0225.9952 16.4125 0 13.8027 0zM12 12c-.9956-.9956-.9956-2.6098 0-3.6055.9956-.9955 2.6098-.9955 3.6055 0 2.9867 2.9868 2.9867 7.8297 0 10.8164-2.9867 2.9868-7.8297 2.9868-10.8164 0l-1.8028 1.8028c3.9823 3.9822 10.4396 3.9822 14.4219 0 3.9823-3.9824 3.9823-10.4396 0-14.4219-.9956-.9956-2.3006-1.4922-3.6055-1.4922-1.3048 0-2.6099.4966-3.6054 1.4922-1.9912 1.9912-1.9912 5.2198 0 7.211z"},mixpanel:{title:"Mixpanel",fill:"#7856FF",d:"M6.967 9.996h3.053c-.763-.477-1.048-1.145-1.431-2.384L7.443 3.366C6.919 1.458 6.49.551 4.39.551H.004v1.145h.621c1.286 0 1.431.477 1.814 1.908L3.44 7.326c.524 1.814 1.337 2.67 3.53 2.67h-.003Zm7.06 0h3.053c2.194 0 2.956-.86 3.484-2.67l1.001-3.722c.382-1.431.57-1.908 1.814-1.908H24V.551h-4.34c-2.146 0-2.576.86-3.053 2.815l-1.145 4.246c-.384 1.286-.673 1.907-1.435 2.384Zm-4.007 4.008h4.007V9.996H10.02v4.008ZM0 23.449h4.39c2.1 0 2.529-.907 3.053-2.815l1.146-4.246c.383-1.239.668-1.907 1.431-2.384H6.967c-2.194 0-3.007.86-3.531 2.67l-1.001 3.722c-.383 1.431-.524 1.907-1.814 1.907H0v1.146Zm19.65 0h4.343v-1.146h-.622c-1.239 0-1.431-.476-1.814-1.907l-1.001-3.722c-.524-1.814-1.286-2.67-3.483-2.67h-3.046c.762.477 1.041 1.098 1.424 2.384l1.145 4.246c.477 1.955.907 2.815 3.054 2.815Z"},gemini:{title:"Google Gemini",fill:"#8E75B2",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"}};var z1=i1(V5(),1),OZ="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function u5({href:_,onClick:Q}){return z1.jsxDEV("h1",{children:z1.jsxDEV("a",{href:_,onClick:Q,children:[z1.jsxDEV("img",{src:OZ,alt:"",width:24,height:24,style:{verticalAlign:"middle"}},void 0,!1,void 0,this),z1.jsxDEV("span",{className:"brand-name",children:" Volter World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}async function m0(_){return(await _.json().catch(()=>({}))).error??`answered ${_.status}`}function R_(_,Q,J=0,q=""){let[U,G]=c1.useState({state:"loading"});return c1.useEffect(()=>{G({state:"loading"})},[q,Q]),c1.useEffect(()=>{if(!Q)return;let Z=!0;return(async()=>{try{let F=await _(Q),K=F.ok?{state:"ok",data:await F.json()}:{state:"error",status:F.status,error:await m0(F)};if(Z)G(K)}catch(F){if(Z)G({state:"error",status:0,error:String(F)})}})(),()=>{Z=!1}},[q,Q,J]),U}function s1({load:_,what:Q,retry:J,lines:q=3}){if(_.state==="loading")return z1.jsxDEV(IZ,{lines:q,label:`Loading ${Q}…`},void 0,!1,void 0,this);if(_.state==="error")return z1.jsxDEV("div",{role:"alert",className:"error-state",children:[z1.jsxDEV("span",{children:["Could not read ",Q,": ",_.error]},void 0,!0,void 0,this),J?z1.jsxDEV("button",{type:"button",onClick:J,children:"Try again"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return null}function IZ({lines:_=3,label:Q="Loading…"}){return z1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":Q,children:Array.from({length:_},(J,q)=>z1.jsxDEV("span",{style:{width:`${[92,76,84,64,88][q%5]}%`}},q,!1,void 0,this))},void 0,!1,void 0,this)}function f1({iso:_,time:Q}){if(!_)return z1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let J=new Date(_);return z1.jsxDEV("time",{dateTime:_,title:_,children:Number.isNaN(J.getTime())?_:Q?J.toLocaleTimeString():J.toLocaleString()},void 0,!1,void 0,this)}var P2=(_)=>_?new Date(_).toLocaleString():"—";function d6(_){let Q=_?Date.parse(_):Number.NaN;if(Number.isNaN(Q))return"—";let J=Math.max(0,Math.round((Date.now()-Q)/1000));return J<60?"just now":J<3600?`${Math.round(J/60)}m ago`:J<86400?`${Math.round(J/3600)}h ago`:`${Math.round(J/86400)}d ago`}function y1(_,Q){let J=Q.replace(/[_-]+/g," "),q=J.endsWith("s")?J:/[^aeiou]y$/.test(J)?`${J.slice(0,-1)}ies`:/(ch|sh|x)$/.test(J)?`${J}es`:`${J}s`;return`${_} ${_===1?J:q}`}var w2=(_)=>_.length<=1?_.join(""):`${_.slice(0,-1).join(", ")} and ${_[_.length-1]}`,PZ={github:"GitHub",openai:"OpenAI",aws:"AWS",hubspot:"HubSpot",paypal:"PayPal",youtube:"YouTube",tiktok:"TikTok",linkedin:"LinkedIn",xai:"xAI",sendgrid:"SendGrid",elevenlabs:"ElevenLabs",assemblyai:"AssemblyAI",planetscale:"PlanetScale",googleoauth:"Google sign-in",npm:"npm","npm-registry":"npm registry",posthog:"PostHog",mongodb:"MongoDB",pagerduty:"PagerDuty",mailgun:"Mailgun",turbopuffer:"turbopuffer"},W1=(_)=>PZ[_]??_.charAt(0).toUpperCase()+_.slice(1);function D1({vendor:_}){let Q=M_[_];return z1.jsxDEV("span",{className:Q?"mark logo":"mark","aria-hidden":"true",children:Q?z1.jsxDEV("svg",{viewBox:"0 0 24 24",children:z1.jsxDEV("path",{d:Q.d,fill:Q.fill},void 0,!1,void 0,this)},void 0,!1,void 0,this):W1(_).charAt(0)},void 0,!1,void 0,this)}var T_=(_)=>{_.currentTarget.closest("details")?.removeAttribute("open")},wZ="volter.theme",a6=()=>{try{let _=localStorage.getItem(wZ);return _==="light"||_==="dark"?_:"system"}catch{return"system"}};function O_(_=a6()){let Q=document.documentElement;if(_==="system")Q.removeAttribute("data-theme");else Q.setAttribute("data-theme",_)}function I_(){return c1.useEffect(()=>{let _=()=>[...document.querySelectorAll("details.menu[open], details.clock-more[open]")],Q=(q)=>{if(q.key!=="Escape"||document.querySelector("dialog[open]"))return;let U=_();if(!U.length)return;for(let G of U)G.removeAttribute("open");U[U.length-1].querySelector("summary")?.focus()},J=(q)=>{let U=q.target;for(let G of _())if(!U||!G.contains(U))G.removeAttribute("open")};return document.addEventListener("keydown",Q),document.addEventListener("click",J),()=>{document.removeEventListener("keydown",Q),document.removeEventListener("click",J)}},[]),null}function G0({open:_,onClose:Q,title:J,children:q,footer:U,wide:G}){let Z=c1.useRef(null),F=c1.useId();return c1.useEffect(()=>{let K=Z.current;if(!K)return;if(_&&!K.open){K.showModal();let Y=K.querySelector(".dialog-body :is(input:not([type=hidden]):not([disabled]), select, textarea)");if(Y?.focus(),Y instanceof HTMLInputElement&&Y.value&&/^(text|search|email|url)$/.test(Y.type))Y.select()}if(!_&&K.open)K.close()},[_]),z1.jsxDEV("dialog",{ref:Z,className:G==="window"?"dialog window":G?"dialog wide":"dialog","aria-labelledby":F,onClose:Q,onCancel:(K)=>{K.preventDefault(),Q()},onMouseDown:(K)=>{if(K.target===Z.current)Q()},children:_?z1.jsxDEV(z1.Fragment,{children:[z1.jsxDEV("div",{className:"dialog-head",children:[z1.jsxDEV("h2",{id:F,children:J},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Close",onClick:Q,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z1.jsxDEV("div",{className:"dialog-body",children:q},void 0,!1,void 0,this),U?z1.jsxDEV("div",{className:"dialog-foot",children:U},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)}var i6="volter:confirm";function S0(_){return new Promise((Q)=>{window.dispatchEvent(new CustomEvent(i6,{detail:{ask:_,resolve:Q}}))})}function P_(){let[_,Q]=c1.useState(null),[J,q]=c1.useState("");c1.useEffect(()=>{let F=(K)=>{q(""),Q(K.detail)};return window.addEventListener(i6,F),()=>window.removeEventListener(i6,F)},[]);let U=(F)=>{_?.resolve(F),Q(null)},G=_?.ask,Z=!G?.typed||J===G.typed;return z1.jsxDEV(G0,{open:Boolean(_),onClose:()=>U(!1),title:G?.title??"",footer:z1.jsxDEV(z1.Fragment,{children:[z1.jsxDEV("button",{type:"button",onClick:()=>U(!1),children:"Cancel"},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",className:G?.danger?"danger-button":"primary",disabled:!Z,onClick:()=>U(!0),children:G?.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[G?.body?z1.jsxDEV("div",{className:"confirm-body",children:G.body},void 0,!1,void 0,this):null,G?.typed?z1.jsxDEV("div",{className:"typed-confirm",children:[z1.jsxDEV("p",{children:["Type ",z1.jsxDEV("code",{children:G.typed},void 0,!1,void 0,this)," to confirm."]},void 0,!0,void 0,this),z1.jsxDEV("input",{autoFocus:!0,"aria-label":`Type ${G.typed} to confirm`,value:J,onChange:(F)=>q(F.target.value),onKeyDown:(F)=>{if(F.key==="Enter"&&Z)U(!0)},autoComplete:"off",spellCheck:!1},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}var r6="volter:toast";function V1(_,Q="ok"){window.dispatchEvent(new CustomEvent(r6,{detail:{text:_,kind:Q}}))}function w_(){let[_,Q]=c1.useState([]);return c1.useEffect(()=>{let J=0,q=(U)=>{let{text:G,kind:Z}=U.detail,F=++J;if(Q((K)=>[...K.slice(-3),{id:F,text:G,kind:Z}]),Z!=="error")setTimeout(()=>Q((K)=>K.filter((Y)=>Y.id!==F)),4500)};return window.addEventListener(r6,q),()=>window.removeEventListener(r6,q)},[]),z1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:_.map((J)=>z1.jsxDEV("div",{className:`toast ${J.kind}`,role:J.kind==="error"?"alert":"status",children:[z1.jsxDEV("span",{children:J.text},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Dismiss",onClick:()=>Q((q)=>q.filter((U)=>U.id!==J.id)),children:"✕"},void 0,!1,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)}function s6({value:_,label:Q,secret:J}){let[q,U]=c1.useState(!1);return z1.jsxDEV("div",{className:"copy-field",children:[Q?z1.jsxDEV("span",{className:"copy-label",children:Q},void 0,!1,void 0,this):null,z1.jsxDEV("div",{className:"copy-row",children:[z1.jsxDEV("input",{readOnly:!0,value:_,"aria-label":Q??"Value",onFocus:(Z)=>Z.currentTarget.select(),spellCheck:!1},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>{U(!0),setTimeout(()=>U(!1),1600),V1(J?"Copied. Keep it somewhere safe":"Copied")}).catch(()=>V1("Your browser would not copy it: select it and copy","error"))},children:q?"Copied":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function f_({label:_,items:Q}){return z1.jsxDEV("details",{className:"menu row-menu",children:[z1.jsxDEV("summary",{className:"icon-button",role:"button","aria-haspopup":"menu","aria-label":_,title:_,children:"⋯"},void 0,!1,void 0,this),z1.jsxDEV("div",{className:"popover menu-list",role:"menu",children:Q.filter((J)=>Boolean(J)).map((J)=>J.href?z1.jsxDEV("a",{role:"menuitem",href:J.href,className:J.danger?"danger-item":void 0,onClick:T_,children:J.label},J.label,!1,void 0,this):z1.jsxDEV("button",{type:"button",role:"menuitem",disabled:J.disabled,className:J.danger?"danger-item":void 0,onClick:(q)=>{T_(q),J.onSelect?.()},children:J.label},J.label,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function s2({title:_,children:Q,action:J}){return z1.jsxDEV("div",{className:"empty-state",children:[z1.jsxDEV("p",{className:"empty-title",children:_},void 0,!1,void 0,this),Q?z1.jsxDEV("div",{className:"empty-body",children:Q},void 0,!1,void 0,this):null,J?z1.jsxDEV("div",{className:"empty-action",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function N_(){return c1.useEffect(()=>{let _=(J)=>{let q=document.querySelector("main.app"),U=J.target;if(q?.hasAttribute("data-drawer")&&U&&!U.closest(".side")&&!U.closest(".drawer-button"))q.removeAttribute("data-drawer")},Q=(J)=>{if(J.key==="Escape")fZ()};return document.addEventListener("click",_),document.addEventListener("keydown",Q),()=>{document.removeEventListener("click",_),document.removeEventListener("keydown",Q)}},[]),z1.jsxDEV("button",{type:"button",className:"icon-button drawer-button","aria-label":"Menu",onClick:()=>{document.querySelector("main.app")?.toggleAttribute("data-drawer")},children:"☰"},void 0,!1,void 0,this)}var fZ=()=>{document.querySelector("main.app")?.removeAttribute("data-drawer")};function j4(_={}){let Q=(q,U)=>_.tools?`${U} (\`${q}\`)`:`\`${q}\``,J=["Set up Volter World for this app, so its calls to Stripe, Slack, GitHub, OpenAI and the other services it uses go to local twins instead of the real APIs. The app keeps its real SDKs and code.","",_.tools?"1. You have the Volter World tools (volter mcp). If the `volter` command is missing, install it: `npm install -g @volter/world`.":"1. Install the command and your agent tooling: `npm install -g @volter/world`, then `volter agents install --yes`.",`2. In the app's folder, ${Q("volter world init --install","world_init")}: it detects the vendors the app calls and installs their twins. Show me the vendors it detected and why, before keeping them.`,`3. ${_.tools?"Start it with world_up":"Start it: `volter world up`"}, then run the tests inside it: ${Q("volter world run -- <the test command>","world_run")}. Fix anything that fails because a call went to the real service.`,`4. Tell me what the app did at each vendor (${Q("volter world log","world_log")}), and give me the dashboard link (${_.tools?"world_view":"`volter world view --no-open`, started in the background: it keeps running"}).`];if(_.platform){let q=_.world??"<org>/<world>";J.push(`5. Share it with my team on ${_.platform}: ${Q(`volter login ${_.platform}`,"platform_login")} gives a link and a code for me to approve in my browser. Once I have, link it with ${Q(`volter remote add origin ${q} --create`,"remote_link with create: true")}${_.world?"":" (ask me for <org>/<world>)"}, then send what the app did: ${Q('volter world changeset -m "<what and why>"',"world_changeset")} and ${Q("volter world push","world_push")}.`)}return J.push("","The guide: https://world.volter.ai/docs/guides/use-with-a-coding-agent.md"),J.join(`
|
|
35
|
-
`)}var C_={"git-commit-horizontal":[["rect",{x:"9",y:"9",width:"6",height:"6"}],["path",{d:"M3 12h6M15 12h6"}]],"arrow-down-to-line":[["path",{d:"M12 17V3"}],["path",{d:"m6 11 6 6 6-6"}],["path",{d:"M19 21H5"}]],"arrow-up-from-line":[["path",{d:"m18 9-6-6-6 6"}],["path",{d:"M12 3v14"}],["path",{d:"M5 21h14"}]],"git-branch":[["rect",{x:"4",y:"3",width:"4",height:"4"}],["rect",{x:"4",y:"17",width:"4",height:"4"}],["rect",{x:"16",y:"5",width:"4",height:"4"}],["path",{d:"M6 7v10M18 9v2a4 4 0 0 1-4 4H6"}]],monitor:[["rect",{x:"3",y:"4",width:"18",height:"13"}],["path",{d:"M8 21h8M12 17v4"}]],vault:[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"6.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 7.9 2.7 2.7"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 10.6 2.7-2.7"}],["rect",{x:"6.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 16.1 2.7-2.7"}],["rect",{x:"15.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 13.4 2.7 2.7"}],["circle",{cx:"12",cy:"12",r:"2"}]],settings:[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"12",cy:"12",r:"7"}],["path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9L7 7M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1"}]],history:[["path",{d:"M3 12a9 9 0 1 0 3-6.7"}],["path",{d:"M3 4v5h5"}],["path",{d:"M12 7v5l3 3"}]],activity:[["path",{d:"M2 12h4l3-8 6 16 3-8h4"}]],"file-diff":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M9 10h6"}],["path",{d:"M12 13V7"}],["path",{d:"M9 17h6"}]],"square-plus":[["rect",{x:"4",y:"4",width:"16",height:"16"}],["path",{d:"M12 8v8M8 12h8"}]],"square-minus":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["path",{d:"M8 12h8"}]],"square-dot":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"10.8",y:"10.8",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],cloud:[["path",{d:"M7 19a5 5 0 0 1-.5-10A6 6 0 0 1 18 8a4.5 4.5 0 0 1 .5 11z"}]],"refresh-cw":[["path",{d:"M20 12a8 8 0 0 1-14.3 4.9M4 12a8 8 0 0 1 14.3-4.9"}],["path",{d:"M19 3v5h-5M5 21v-5h5"}]],clock:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M12 7v5l3 3"}]],"key-round":[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],plug:[["path",{d:"M9 3v5M15 3v5M6 8h12v4a6 6 0 0 1-12 0zM12 18v3"}]],"list-checks":[["path",{d:"M11 6h9M11 12h9M11 18h9"}],["path",{d:"M3 6l1.5 1.5L7 5M3 12l1.5 1.5L7 11M3 18l1.5 1.5L7 17"}]],palette:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}],["rect",{x:"12.3",y:"5.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"16.3",y:"9.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"5.3",y:"11.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"7.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],check:[["path",{d:"M4 12l5 5L20 6"}]],plus:[["path",{d:"M12 4v16M4 12h16"}]],"chevron-down":[["path",{d:"M5 9l7 7 7-7"}]],"external-link":[["path",{d:"M14 4h6v6M20 4l-9 9"}],["path",{d:"M18 14v6H4V6h6"}]],"table-2":[["path",{d:"M3 9h18"}],["path",{d:"M9 3v18"}],["rect",{x:"3",y:"3",width:"18",height:"18"}]],"scroll-text":[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"}]],"layout-grid":[["rect",{x:"4",y:"4",width:"7",height:"7"}],["rect",{x:"13",y:"4",width:"7",height:"7"}],["rect",{x:"4",y:"13",width:"7",height:"7"}],["rect",{x:"13",y:"13",width:"7",height:"7"}]],globe:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"}]],"arrow-left":[["path",{d:"M20 12H5M11 6l-6 6 6 6"}]],link:[["path",{d:"M9 15l6-6"}],["path",{d:"M11 6l2-2a4.2 4.2 0 0 1 6 6l-2 2M13 18l-2 2a4.2 4.2 0 0 1-6-6l2-2"}]],user:[["circle",{cx:"12",cy:"8",r:"4"}],["path",{d:"M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1"}]],"log-out":[["path",{d:"M10 4H4v16h6M9 12h11M16 8l4 4-4 4"}]]};var $=i1(V5(),1),u4="volter.console.token",b5=document.getElementById("root"),B1=b5.dataset.base??"/-/console",P1=window.location.origin,p0=(b5.dataset.worlds??P1).replace(/\/+$/,""),D_=(b5.dataset.names??"").split(",").filter((_)=>_!==""),Q2=b5.dataset.worldOrigin==="1",v2=window.fetch.bind(window),J2="(session)",b_="(pass)",h5=(_)=>{try{if(_&&!Q2)sessionStorage.setItem(u4,_);else sessionStorage.removeItem(u4);localStorage.removeItem(u4)}catch{}},E_="volter.console.portal",x_=(_)=>{try{if(typeof _==="string"&&/^https?:$/.test(new URL(_).protocol))sessionStorage.setItem(E_,new URL(_).origin)}catch{}},NZ=()=>{return y2.get("token")??""},t1=()=>{try{let _=sessionStorage.getItem(E_)??"";return _&&/^https?:$/.test(new URL(_).protocol)?new URL(_).origin:""}catch{return""}},CZ=()=>{let _=NZ();if(Q2){if(h5(""),y2.get("pass"))return b_;let Q=new URLSearchParams(window.location.search).has("signin");if(Q)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return _||(Q?"":J2)}if(_)return h5(_),_;try{return sessionStorage.getItem(u4)??""}catch{return""}};function x1(_){let Q=_.trim();if(/not ready/i.test(Q)&&/(never verified|not verified|no approvals)/i.test(Q)){let G=[],Z=[];if(/(never verified|not verified)/i.test(Q))G.push("it is not verified yet"),Z.push("verify");if(/no approvals/i.test(Q))G.push("no one has approved it"),Z.push("approve");return{text:`Not ready to deploy: ${w2(G)}.`,acts:Z}}let J=/no credential (?:is )?sealed for ([a-z0-9_-]+)/i.exec(Q);if(J)return{text:`No credential is sealed for ${W1(J[1])}: seal one in Settings › Vault.`,acts:["vault"]};if(/has no origin/i.test(Q))return{text:"This World has no remote: name one in Settings › Remote.",acts:["remote"]};let q=/the ([a-z0-9_-]+) twin has no root/i.exec(Q)??/:\s*([a-z0-9_, -]+?) (?:has|have) no root/i.exec(Q);if(q){let G=q[1].split(/,\s*/).filter(Boolean).map(W1);return{text:`${w2(G)} ${G.length===1?"is":"are"} not connected to ${G.length===1?"its":"their"} real service: Settings › Real services.`,acts:["settings"]}}if(/opening a seal is/i.test(Q))return{text:"A key cannot seal a credential: open the World as yourself.",acts:[]};if(/a key manages no keys/i.test(Q))return{text:"A key cannot manage keys: open the World as yourself.",acts:[]};if(/^PUT origin:/i.test(Q))return{text:"That is not a World's address: https://<host>/<org>/<world>",acts:[]};if(/^clock: \{/i.test(Q))return{text:"Pick a date and time.",acts:[]};if(/^advance: \{/i.test(Q))return{text:"Advance by a number and a unit: 90m, 12h, 3d.",acts:[]};if(/^branches: \{/i.test(Q))return{text:"That branch could not be made: pick now, or an instant before it.",acts:[]};if(/^approve: \{/i.test(Q))return{text:"Name who approves.",acts:[]};if(/a browser deploys only what it names/i.test(Q))return{text:"A deploy is confirmed by its name: use Deploy again.",acts:[]};if(/^no such door/i.test(Q))return{text:"This World does not answer that here.",acts:[]};return{text:Q.replace(/\s*[—–-]+\s*(?:run\s+)?`[^`]*`/g,"").replace(/\s*[—–-]+\s*(?:PUT|POST|GET|DELETE)\s+\/-\/\S+(?:\s*\{[^}]*\})?/g,"").replace(/\s*\(\s*`[^`]*`\s*\)/g,"").replace(/`(?:volter|printf|curl|npm|bun)[^`]*`/g,"").replace(/:\s*\{[^}]*\}/g,"").replace(/\(\s*\)/g,"").replace(/\s*;\s*(?=[;.]|$)/g,"").replace(/\s+([,.;:])/g,"$1").trim()||_,acts:[]}}var q0=async(_)=>x1(await m0(_)).text,SZ={vault:["vault","Open Vault"],remote:["remote","Open Remote"],settings:["settings/services","Open Real services"]};function m_({name:_,acts:Q}){let J=Q.map((q)=>SZ[q]).filter((q)=>Boolean(q));if(J.length===0)return null;return $.jsxDEV($.Fragment,{children:J.map(([q,U])=>$.jsxDEV(i.default.Fragment,{children:[" ",$.jsxDEV("a",{href:`${B1}/${_}/~/${q}`,onClick:(G)=>{G.preventDefault(),w1([..._.split("/"),"~",...q.split("/")])},children:U},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)}async function I1(_,Q,J={}){return v2(`${P1}${Q}`,{...J,headers:{...J.headers??{},..._===J2?{}:{"x-volter-token":_},...J.body&&!J.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function N1(_,Q,J=0){let q=R_((U)=>I1(_,U),Q,J,_);return q.state==="error"?{...q,error:x1(q.error).text}:q}var n2=(_)=>{let Q=new Date(_),J=(q)=>String(q).padStart(2,"0");return`${Q.getFullYear()}-${J(Q.getMonth()+1)}-${J(Q.getDate())}T${J(Q.getHours())}:${J(Q.getMinutes())}`},S_=(_)=>new Date(Math.ceil(Date.parse(_)/60000)*60000).toISOString(),g_=(_)=>_.operation==="observed"?`observed${_.provenance==="placeholder"?" (default data)":" (vendor)"}`:_.receipt?`${_.receipt.status??""} ${_.receipt.externalId??""} ${_.receipt.reason??""}`.trim():_.provenance==="placeholder"?"default data":"unpushed",vZ=(_)=>{let Q=/^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(_??"");return Q?{trace:Q[1],span:Q[2]}:null},e6="volter.console.snapshots",c0=()=>{try{return JSON.parse(sessionStorage.getItem(e6)??"{}")}catch{return{}}},p_=new Map,_8=(_)=>{if(Q2){if(_.token||_.readToken)p_.set(_.name,{token:_.token,readToken:_.readToken});_={..._,token:"",readToken:""}}try{sessionStorage.setItem(e6,JSON.stringify({...c0(),[_.name]:_}))}catch{}},Q8=(_)=>p_.get(_)?.readToken||c0()[_]?.readToken||"",h4=(_)=>{try{let Q=c0();delete Q[_],sessionStorage.setItem(e6,JSON.stringify(Q))}catch{}},y2=new URLSearchParams(window.location.hash.slice(1)),t2=y2.get("close")??"";function E5(_){if(typeof _!=="string")return null;let Q;try{Q=new URL(_)}catch{return null}return(Q.protocol==="http:"||Q.protocol==="https:")&&Q.origin===_.replace(/\/+$/,"")?Q:null}function J8(_){let Q=E5(_);if(!Q)return null;let J=new URL(P1);if(Q.protocol!==J.protocol||Q.port!==J.port)return null;if(Q.hostname===J.hostname)return Q.origin;let q=/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./;if(!q.test(Q.hostname))return null;let U=Q.hostname.replace(q,"");return U===J.hostname||q.test(J.hostname)&&U===J.hostname.replace(q,"")?Q.origin:null}function yZ(_){let Q;try{Q=JSON.parse(_)}catch{return null}let J=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof Q.name!=="string"||!J.test(Q.name)||typeof Q.parent!=="string"||!J.test(Q.parent)||typeof Q.at!=="string")return null;let q=Q.parentOrigin===void 0?void 0:J8(Q.parentOrigin);return{name:Q.name,parent:Q.parent,token:typeof Q.token==="string"?Q.token:"",readToken:typeof Q.readToken==="string"?Q.readToken:"",at:Q.at,expiresAt:typeof Q.expiresAt==="string"?Q.expiresAt:null,...q?{parentOrigin:q}:{}}}{let _=y2.get("snapshot");if(_){let Q=yZ(_);if(Q&&!c0()[Q.name])_8(Q)}}var c_="volter.console.home",l_=(_)=>{let Q=E5(_);if(!Q)return null;let J=new URL(P1).hostname,q=J.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return Q.hostname===J||Q.hostname===q?Q.origin:null};{let _=l_(y2.get("home"));if(_)try{sessionStorage.setItem(c_,_)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((_)=>y2.has(_)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var R0=()=>{try{return l_(sessionStorage.getItem(c_))??""}catch{return""}};function $8(_,Q,J,q){let U=new URLSearchParams({token:Q,home:R0()||P1}),G=c0()[J];if(G)U.set("snapshot",JSON.stringify(G));window.location.replace(`${_}${q??`${window.location.pathname}${window.location.search}`}#${U.toString()}`)}var b4=b5.dataset.route==="memory"?"":null;function eB(_){b4=_,window.dispatchEvent(new PopStateEvent("popstate"))}function N2(){return(b4??window.location.pathname.slice(B1.length)).split("/").filter(Boolean).map((_)=>{try{return decodeURIComponent(_)}catch{return""}})}var v_=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,g0=(_,Q)=>_&&Q&&v_.test(_)&&v_.test(Q)?`${_}/${Q}`:"";function w1(_){let Q=`/${_.map(encodeURIComponent).join("/")}`;if(b4!==null)b4=Q;else window.history.pushState(null,"",`${B1}${Q}`);window.dispatchEvent(new PopStateEvent("popstate"))}function i_(_,Q){let J=J8(c0()[_]?.origin);if(J&&J!==P1){$8(J,Q8(_),_,`${B1}/${Q.map(encodeURIComponent).join("/")}`);return}w1(Q)}async function y_(){let[_,Q]=N2(),J=g0(_,Q),q=J?[J]:D_;if(q.length===0){let U=await v2(`${P1}/-/ping`).catch(()=>null);q=U?.ok?(await U.json().catch(()=>({}))).worlds??[]:[]}q=q.filter((U)=>{let[G,Z,...F]=U.split("/");return F.length===0&&g0(G,Z)===U});for(let U of q){let G=await v2(`${P1}/-/${U}/session`,{method:"POST"}).catch(()=>null);if(!G)continue;let Z=await G.json().catch(()=>({})),F=E5(Z.origin)?.origin;if(G.status===409&&F&&F!==P1)return window.location.replace(`${F}${B1}/${U}`),"moved";if(G.ok&&Z.local)return{token:typeof Z.token==="string"&&Z.token?Z.token:J2}}return null}function kZ(){let[_,Q]=i.useState(a6),J=(q)=>()=>{try{if(q==="system")localStorage.removeItem("volter.theme");else localStorage.setItem("volter.theme",q)}catch{}O_(q),Q(q)};return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"theme-choice",role:"radiogroup","aria-label":"Appearance",children:["system","light","dark"].map((q)=>$.jsxDEV("button",{type:"button",role:"radio","aria-checked":_===q,onClick:J(q),children:q==="system"?"System":q==="light"?"Light":"Dark"},q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function jZ(){let[_,Q]=i.useState(CZ()),[J,q]=i.useState(!1),[U,G]=i.useState(!1),[Z,F]=i.useState(""),[K,Y]=i.useState(null),[X,H]=i.useState(null),[L,W]=i.useState(N2());i.useEffect(()=>{let y=()=>W(N2());return window.addEventListener("popstate",y),()=>window.removeEventListener("popstate",y)},[]),i.useEffect(()=>{let[y,p]=N2(),h=g0(y,p),[e,t]=h?h.split("/"):[],o=c0()[t2];if(!t2||!_||!e||!t||!o?.made||o.parent!==`${e}/${t}`||g0(...t2.split("/"))!==t2)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}I1(_,`/-/${e}/${t}/branches/${t2}`,{method:"DELETE"}).catch(()=>null).then(()=>h4(t2))},[_]);let A=i.useCallback(async(y)=>{if(H(null),!y){let t=await y_();if(t==="moved")return;if(t){if(q(!0),t.token!==J2)h5(t.token);Q(t.token);return}Y(null),G(!0);return}if(Q2&&y===J2){let t=await y_();if(t==="moved")return;if(t)q(!0)}if(Q2&&y===b_){let[t,o]=N2(),s=g0(t,o),[g,J1]=s?s.split("/"):[],U1=g&&J1?await v2(`${P1}/-/${g}/${J1}/session`,{method:"POST",headers:{"x-volter-pass":y2.get("pass")??""}}).catch(()=>null):null;if(!U1){H(`${P1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){H(`${await q0(U1)}. Open it again from the platform.`),Y(null);return}x_((await U1.json().catch(()=>({}))).issuer),Q(J2);return}if(Q2&&y!==J2){let[t,o]=N2(),s=g0(t,o),[g,J1]=s?s.split("/"):[],U1=g&&J1?await v2(`${P1}/-/${g}/${J1}/session`,{method:"POST",headers:{"x-volter-token":y}}).catch(()=>null):null;if(!U1){H(`${P1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){let X1=await q0(U1);H(U1.status===401||U1.status===403?`That token does not open ${g}/${J1}.`:U1.status===409?`${g}/${J1}'s session lives at another origin: ${X1}`:`The World could not open a session (${U1.status}): ${X1}`),Y(null);return}Q(J2);return}let p=Q2?new Response(null,{status:404}):await I1(y,"/-/worlds");if(p.ok){let{worlds:t}=await p.json();Y({kind:"admin",worlds:t});return}if(p.status===429){H("You are asking faster than the platform allows — wait a moment and reload."),Y(null);return}if(p.status>=500){let t=await p.json().catch(()=>({}));H(`The platform could not list your worlds${t.error?`: ${t.error}`:""}. Reload; if it stays, the status page says what is wrong.`),Y(null);return}let h=D_;if(h.length===0){let t=await v2(`${P1}/-/ping`);if(!t.ok){H(`${P1} does not answer as a host`),Y(null);return}if(h=(await t.json()).worlds??[],h.length===0){H(`${P1} does not list its Worlds: open a World at its own address, ${P1}${B1}/<org>/<world>`),Y(null);return}}let e=[];for(let t of h){let o=await I1(y,`/-/${t}/twins`);if(o.ok){let s=await o.json();e.push({name:t,base:`${p0}/${t}`,twins:(s.twins??[]).map((g)=>({vendor:g.twin,protocol:g.protocol??null,root:g.root??null}))})}}if(e.length===0){H("This link or key opens no World here: it was revoked, or it has ended."),Y(null);return}Y({kind:"world",worlds:e})},[]);i.useEffect(()=>{A(_)},[_,A]);let I=(y)=>K?.kind==="admin"?K.worlds.find((p)=>p.name===y)?.token??_:_,[R,M]=i.useState("");if(!_||!K&&!X)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(u5,{href:`${B1}/`},void 0,!1,void 0,this),_&&!K&&!X||!_&&!U?$.jsxDEV("p",{className:"mode",children:"Opening…"},void 0,!1,void 0,this):$.jsxDEV("form",{onSubmit:(y)=>{y.preventDefault(),h5(Z.trim()),Q(Z.trim())},className:"stack",children:[$.jsxDEV("h2",{children:"Open a World"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"A World's token opens that World. A host's admin token opens every World it serves."},void 0,!1,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Token"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"token",type:"password",value:Z,onChange:(y)=>F(y.target.value),autoFocus:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",children:"Open"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let O=()=>{if(J){window.location.reload();return}if(Q2){let[y,p]=N2(),h=g0(y,p),[e,t]=h?h.split("/"):[],o=()=>window.location.replace(t1()?`${t1()}/`:`${P1}${B1}/${e&&t?`${e}/${t}`:""}?signin`);if(setTimeout(o,2000),e&&t)v2(`${P1}/-/${e}/${t}/session/end`,{method:"POST"}).catch(()=>null).then(o);else o();return}if(K)for(let y of K.worlds)navigator.sendBeacon(`${y.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${y.name}/session/end`);h5(""),Q(""),F(""),Y(null),w1([])};if(X||!K)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(u5,{href:`${B1}/`},void 0,!1,void 0,this),$.jsxDEV("h2",{children:"Could not open it"},void 0,!1,void 0,this),$.jsxDEV("p",{role:"alert",children:X??"nothing answered"},void 0,!1,void 0,this),t1()?$.jsxDEV("a",{className:"button primary",href:`${t1()}/`,children:["Back to ",new URL(t1()).host]},void 0,!0,void 0,this):$.jsxDEV("button",{type:"button",className:"primary",onClick:O,children:J?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let[B,T,f,C,N,S,w]=L,k=f==="~",x=/^[A-Za-z0-9_-]+$/,r=/^[^\u0000-\u001f\u007f]{1,200}$/,m=k||!f||!x.test(f)?void 0:f,v=N&&x.test(N)?S!==void 0&&C!=="changes"&&C!=="screens"?g0(N,S)||void 0:N:void 0,D=C==="changes"&&N==="changesets"&&S&&x.test(S)?S:C==="screens"&&S&&w&&/^[A-Za-z0-9_.-]+$/.test(S)&&r.test(w)?`${S}:${w}`:void 0,V=g0(B,T),E=V?c0()[V]??null:null,u=(y)=>Q8(y)||I(y),b=E?K.kind==="admin"?K.worlds.find((y)=>y.name===E.parent)?.token??null:K.worlds.some((y)=>y.name===E.parent)?_:null:null,P=async(y)=>{let p=J8(y.parentOrigin);if(p&&p!==P1){h4(y.name),window.location.assign(`${p}${B1}/${y.parent}#close=${encodeURIComponent(y.name)}`);return}if(y.made)await I1(I(y.parent),`/-/${y.parent}/branches/${y.name}`,{method:"DELETE"}).catch(()=>null),h4(y.name);w1(y.parent.split("/"))};return $.jsxDEV("main",{className:V?"app workspace":"app home",children:[V?null:$.jsxDEV("header",{children:[V?$.jsxDEV(N_,{},void 0,!1,void 0,this):null,$.jsxDEV(u5,{href:`${R0()&&R0()!==P1?R0():""}${B1}/`,onClick:(y)=>{if(R0()&&R0()!==P1)return;y.preventDefault(),w1([])}},void 0,!1,void 0,this),$.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[V?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("span",{children:V.split("/")[0]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${B1}/${V}`,className:"crumb-world",onClick:(y)=>{y.preventDefault(),w1(V.split("/"))},children:V.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,m?$.jsxDEV("span",{children:[" / ",m]},void 0,!0,void 0,this):null,k&&C==="trace"?$.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),t1()?$.jsxDEV("a",{href:`${t1()}/${V?encodeURIComponent(V.split("/")[0]):""}`,title:`Back to the platform at ${new URL(t1()).host}`,className:"back-link",children:["← ",$.jsxDEV("span",{className:"back-text",children:V?`${V.split("/")[0]}'s Worlds`:new URL(t1()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,V?null:$.jsxDEV("span",{className:"mode",children:J?"on this machine":R?`signed in as ${R}`:K.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),V||J?null:$.jsxDEV("button",{onClick:O,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),V?$.jsxDEV(DZ,{name:V,token:u(V),twin:m,tab:k?C??"overview":"overview",arg:k?v:void 0,...k&&D?{sub:D}:{},admin:E?null:K.kind==="admin"?_:null,snapshot:E,parentToken:b,who:{local:J,person:R||null,admin:K.kind==="admin"},onSignOut:O,onReturn:P,opens:(y)=>!!c0()[y]||K.kind==="admin"&&K.worlds.some((p)=>p.name===y),onRemoved:()=>{A(_),w1([])},onWho:M,worlds:K.worlds.map((y)=>y.name)},V,!1,void 0,this):$.jsxDEV(VZ,{mode:K,admin:K.kind==="admin"?_:null,reload:()=>A(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function VZ({mode:_,admin:Q,reload:J}){let[q,U]=i.useState(""),[G,Z]=i.useState(""),[F,K]=i.useState(""),[Y,X]=i.useState(null),H=async(N)=>{if(!await S0({title:`Rotate the tokens of ${N}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let S=await I1(Q,`/-/worlds/${N}/rotate`,{method:"POST"}),w=await S.json().catch(()=>({}));X(S.ok?`rotated ${N}: the new tokens are shown once — token ${w.token} · read token ${w.readToken}`:w.error?x1(w.error).text:`answered ${S.status}`),await J()},L=async(N)=>{let S=await I1(Q,`/-/worlds/${N}`,{method:"DELETE"}),w=await S.json().catch(()=>({}));X(S.ok?`removed ${N}`:w.error?x1(w.error).text:`answered ${S.status}`),await J()},[W,A]=i.useState(!1),[I,R]=i.useState(!1),[M,O]=i.useState(""),B=async(N)=>{N.preventDefault(),X(null),A(!0);try{let S=await I1(Q,"/-/worlds",{method:"POST",body:JSON.stringify({org:q,world:G,vendors:F.split(",").map((k)=>k.trim()).filter(Boolean)})}),w=await S.json();if(!S.ok){X(w.error?x1(w.error).text:`the host answered ${S.status}`);return}X(`provisioned ${w.name}`),Z(""),K(""),R(!1),await J()}finally{A(!1)}},T=M.trim().toLowerCase(),f=_.worlds.filter((N)=>!T||N.name.toLowerCase().includes(T)||N.twins.some((S)=>S.vendor.includes(T))),C=[...new Set(f.map((N)=>N.name.split("/")[0]))];return $.jsxDEV("section",{className:"home-window","aria-labelledby":"worlds",children:[$.jsxDEV("div",{className:"home-head",children:[$.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[y1(_.worlds.length,"World")," ",Q?"this host serves":"this key opens"]},void 0,!0,void 0,this),Q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{X(null),R(!0)},children:[$.jsxDEV(R1,{name:"plus",size:16},void 0,!1,void 0,this),"New World"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"home-find",children:$.jsxDEV("input",{type:"search",placeholder:"Filter by World or vendor","aria-label":"Filter Worlds",value:M,onChange:(N)=>O(N.target.value)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y&&!I?$.jsxDEV("p",{role:"status",className:"home-note",children:Y},void 0,!1,void 0,this):null,C.map((N)=>$.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("p",{className:"menu-label home-org",children:N},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"home-list",children:f.filter((S)=>S.name.split("/")[0]===N).map((S)=>$.jsxDEV("li",{children:[$.jsxDEV("a",{href:`${B1}/${S.name}`,onClick:(w)=>{w.preventDefault(),w1(S.name.split("/"))},children:[$.jsxDEV(R1,{name:"globe",size:20},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:S.name.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("small",{children:$.jsxDEV("code",{children:S.base},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"home-vendors",children:S.twins.map((w)=>$.jsxDEV("span",{title:W1(w.vendor),children:$.jsxDEV(D1,{vendor:w.vendor},void 0,!1,void 0,this)},w.vendor,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q?$.jsxDEV("details",{className:"menu home-more",children:[$.jsxDEV("summary",{"aria-label":`More for ${S.name}`,children:"⋯"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"popover menu-list",children:[$.jsxDEV("button",{type:"button",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),H(S.name)},children:"Rotate tokens…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"danger-item",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),S0({title:`Remove ${S.name}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:S.name}).then((k)=>{if(k)L(S.name)})},children:"Remove World…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},S.name,!0,void 0,this))},void 0,!1,void 0,this)]},N,!0,void 0,this)),f.length===0?$.jsxDEV("p",{className:"mode home-note",children:T?`No World matches ${M}.`:"No Worlds here yet."},void 0,!1,void 0,this):null,$.jsxDEV(G0,{open:I,onClose:()=>{if(!W)R(!1)},title:"New World",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>R(!1),disabled:W,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"provision",className:"primary",disabled:W,children:W?"Making… (ten seconds or so)":"Make World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"provision",onSubmit:B,className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Org"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"org",value:q,onChange:(N)=>U(N.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"world",value:G,onChange:(N)=>Z(N.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Vendors"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"vendors",value:F,onChange:(N)=>K(N.target.value),placeholder:"stripe, slack",required:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"A twin of each, with its default data."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"status",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var uZ=["changes","events","trace","vendors","screens","canvas","branches","settings","remote","vault"],hZ=(_,Q)=>{let J=Q?.screens?.find((q)=>q.path.replace(/\/+$/,"")==="")??Q?.screens?.find((q)=>!/[{<]/.test(q.path));return Q&&J?`${p0}/${_}/${Q.twin}${J.path.startsWith("/")?J.path:`/${J.path}`}`:null},k_={verify:"verified",use:"used",issue:"issued",revoke:"revoked",rotate:"rotated",seed:"seeded",upsert:"saved",set:"set",start:"started",finish:"finished",fail:"failed",schedule:"scheduled",deliver:"delivered",like:"liked",follow:"followed",reply:"replied",create:"created",update:"updated",delete:"deleted",record:"recorded",remove:"removed",add:"added",send:"sent",post:"posted",postmessage:"posted",cancel:"canceled",close:"closed",open:"opened",publish:"published",upload:"uploaded",invite:"invited",archive:"archived",merge:"merged",refund:"refunded",capture:"captured",confirm:"confirmed",pay:"paid"};function L0(_){let Q=_.operation??_.op,J=(Q.includes(".")?Q.slice(Q.lastIndexOf(".")+1):Q).toLowerCase(),q=_.subject.type.replace(/[_-]+/g," ").trim(),U=`${q.charAt(0).toUpperCase()}${q.slice(1)}`,G=/(^|\.)twin\./.test(Q)||/^seed_/.test(J),Z=Q.replace(/[._]+/g," ").trim(),F=G?`${U} seeded`:k_[J]?`${U} ${k_[J]}`:`${Z.charAt(0).toUpperCase()}${Z.slice(1)}`,K=_.fields??{},Y=["title","name","email","text","subject","summary","description"].map((H)=>K[H]).find((H)=>typeof H==="string"&&H.trim()!=="")??null,X=Y===null?null:Y.replace(/<([@#!])[^|>]*\|([^>]+)>/g,(H,L,W)=>`${L==="!"?"@":L}${W}`).replace(/<(?:https?:[^|>]+)\|([^>]+)>/g,"$1").replace(/<(https?:[^>]+)>/g,"$1");return{what:F,label:X===null?null:X.length>80?`${X.slice(0,79)}…`:X}}var l0=(_)=>/token|password|secret|key|credential/i.test(_.subject.type)&&_.subject.id.length>6?`••••${_.subject.id.slice(-4)}`:_.subject.id;function DZ({name:_,token:Q,twin:J,tab:q,arg:U,sub:G,admin:Z,snapshot:F,parentToken:K,who:Y,onSignOut:X,onReturn:H,opens:L,onRemoved:W,onWho:A,worlds:I=[]}){let[R,M]=i.useState("pending"),[O,B]=i.useState(null),[T,f]=i.useState(0),[C,N]=i.useState(null);i.useEffect(()=>{let s=!0;return B(null),I1(Q,`/-/${_}/session`,{method:"POST"}).then(async(g)=>{let J1=await g.json().catch(()=>({}));if(x_(J1.issuer),J1.who)A?.(J1.who);N(typeof J1.signsAs==="string"?J1.signsAs:null);let U1=E5(J1.origin)?.origin;if(g.status===409&&U1&&U1!==P1){$8(U1,Q,_);return}if(!s)return;if(M(!g.ok?"unknown":J1.scope==="read"?"read":J1.scope==="write"?"write":"unknown"),!g.ok)B(J1.error?x1(J1.error).text:`answered ${g.status}`)}).catch((g)=>{if(s)M("unknown"),B(`the World did not answer: ${g instanceof Error?g.message:String(g)}`)}),()=>{s=!1}},[_,Q,T]);let S=O?{state:"error",error:O}:R==="pending"?{state:"pending"}:{state:"ok",scope:R},w=R==="write",k=(s)=>{if(s.status!==403)return;s.clone().json().then((g)=>{if(/read token|opens only reads|write access|reads only/i.test(g?.error??""))M("read")},()=>null)},[x,r]=i.useState(0);i.useEffect(()=>{let s=setInterval(()=>{if(!document.hidden)r((g)=>g+1)},5000);return()=>clearInterval(s)},[]);let[m,v]=i.useState(0),D=N1(Q,`/-/${_}/clock`,x+m),V=N1(Q,`/-/${_}/twins`),E=N1(Q,`/-/${_}/branches`,m),u=N1(Q,`/-/${_}/map`,Math.floor(x/2)),b=!(E.state==="error"&&(E.status===404||E.status===405)),P=uZ.includes(q)?q:"overview",y=V.state==="ok"?V.data.twins.map((s)=>s.twin):[];if(J&&V.state==="ok"&&!y.includes(J))return $.jsxDEV("main",{className:"center",children:$.jsxDEV(s2,{title:`${_} has no ${J}`,action:$.jsxDEV("a",{href:`${B1}/${_}`,onClick:(s)=>{s.preventDefault(),w1(_.split("/"))},children:["Open ",_]},void 0,!0,void 0,this),children:$.jsxDEV("p",{children:["No vendor of this World is called ",J,". Its changesets are under Changes › History."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);let p=P==="vendors"&&U?U:void 0,h=()=>{M("pending"),f((s)=>s+1)};if(P==="canvas"||P==="vendors"&&!p||q==="screens"&&!U)return $.jsxDEV(XF,{name:_,token:Q,twins:V,session:S,retry:h,snapshot:F,back:()=>w1(_.split("/")),canWrite:w&&!F},void 0,!1,void 0,this);let t=q==="settings"?{kind:"settings",tab:((s)=>r_.find(([g])=>g===s)?.[0]??"account")(U)}:q==="remote"?{kind:"settings",tab:"remote"}:q==="vault"?{kind:"settings",tab:"vault"}:q==="branches"?{kind:"branches",...U?{open:U}:{}}:null,o=J?"vendor":q==="screens"&&U?"screen":P==="vendors"&&p?"vendor":q==="trace"?"trace":q==="events"?"events":q==="changes"&&U==="changesets"?"history":"changes";return $.jsxDEV(rZ,{name:_,token:Q,view:o,win:t,who:Y,snapshot:F,onReturn:H,onSignOut:X,worlds:I,session:S,retry:h,...o==="vendor"?{arg:J??p}:o==="events"||o==="trace"||o==="screen"?U?{arg:U}:{}:{},...G?{sub:G}:{},twins:V,map:u,branches:b?E:null,clock:D,canWrite:w&&!F,refused:k,signsAs:C,opens:L,tick:x,admin:Z,onRemoved:W,onClock:()=>v((s)=>s+1),scope:F?"read":R},void 0,!1,void 0,this)}function R1({name:_,size:Q=20}){return $.jsxDEV("svg",{className:"icon",viewBox:"0 0 24 24",width:Q,height:Q,fill:"none",stroke:"currentColor",strokeWidth:Q<=16?1.75:1.5,strokeLinecap:"square",strokeLinejoin:"miter","aria-hidden":"true",children:(C_[_]??[]).map(([J,q],U)=>i.default.createElement(J,{key:U,...q}))},void 0,!1,void 0,this)}function E4(_){let Q=(J)=>{let q=(J.operation??J.op).toLowerCase();return q.includes(".")?q.slice(q.lastIndexOf(".")+1):q};if(_.some((J)=>/^(delete|remove|archive|revoke)/.test(Q(J))||J.fields?.deleted===!0))return{icon:"square-minus",word:"removed",tone:"removed"};if(/^(create|add|insert|issue|send|post|upload|invite|record|seed)/.test(Q(_[0])))return{icon:"square-plus",word:"made",tone:"added"};return{icon:"square-dot",word:"changed",tone:"changed"}}var r_=[["account","Account","user"],["changesets","Changesets","git-commit-horizontal"],["remote","Remote","cloud"],["access","Access","key-round"],["services","Real services","plug"],["vault","Vault","vault"],["checks","Checks","list-checks"],["clock","Clock","clock"],["appearance","Appearance","palette"]],bZ=(_,Q)=>{let J=Q.split("/").pop()??Q,q=_.split("/").pop()??"";return J.startsWith(`${q}-`)?J.slice(q.length+1):J},C2=(_)=>_.replace(/^_+/,"").replace(/[_-]+/g," ");function d_({record:_,history:Q}){let J=_.writes[_.writes.length-1],q=L0(J),U=E4(_.writes),G=new Set(_.writes.map((H)=>H.id)),Z=_.writes[0].occurredAt,F={};if(Q){for(let H of Q)if(!G.has(H.id)&&!H.landsId&&!H.aliasOf&&H.subject.type===J.subject.type&&H.subject.id===J.subject.id&&H.occurredAt<=Z)Object.assign(F,H.fields??{})}let K={...F};for(let H of _.writes)Object.assign(K,H.fields??{});let Y=U.tone==="added"&&Object.keys(F).length===0,X=[...new Set([...Object.keys(F),...Object.keys(K)])].filter((H)=>!UQ(F[H],K[H]));return $.jsxDEV("div",{className:"ws-diff","aria-label":`${q.label??l0(J)}: its changes`,children:[$.jsxDEV("div",{className:"ws-diff-head",children:[$.jsxDEV("span",{className:`ws-kind ${U.tone}`,title:U.word,children:$.jsxDEV(R1,{name:U.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(D1,{vendor:_.twin},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:q.label??l0(J)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[W1(_.twin)," · ",J.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")," ",$.jsxDEV("code",{children:l0(J)},void 0,!1,void 0,this)," · ",U.word," here"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ol",{className:"ws-writes",children:_.writes.map((H)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:L0(H).what},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(f1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",D5(H)]},void 0,!0,void 0,this)]},H.id,!0,void 0,this))},void 0,!1,void 0,this),Q===null?$.jsxDEV("p",{className:"mode pad",children:"Reading its history…"},void 0,!1,void 0,this):X.length===0?$.jsxDEV("p",{className:"mode pad",children:"No field holds a new value."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"ws-fields","aria-label":"Fields before and after",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Field"},void 0,!1,void 0,this),Y?null:$.jsxDEV("th",{children:"Before"},void 0,!1,void 0,this),$.jsxDEV("th",{children:U.tone==="removed"?"After":"Now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:X.map((H)=>$.jsxDEV("tr",{children:[$.jsxDEV("th",{scope:"row",children:$.jsxDEV("code",{children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?null:$.jsxDEV("td",{className:H in F?"was":"none",children:H in F?$.jsxDEV(i0,{v:F[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:H in K?"now":"none",children:H in K?$.jsxDEV(i0,{v:K[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function a_({records:_,selected:Q,onPick:J,label:q}){let[U,G]=i.useState(()=>{try{return localStorage.getItem("volter.console.records")==="tree"}catch{return!1}}),Z=(Y)=>{G(Y);try{localStorage.setItem("volter.console.records",Y?"tree":"path")}catch{}},F=(Y,X)=>{let H=Y.writes[Y.writes.length-1],L=L0(H),W=E4(Y.writes);return $.jsxDEV("li",{children:$.jsxDEV("button",{type:"button",className:[Q===Y.key?"on":"",X?"nested":""].join(" ").trim()||void 0,"aria-pressed":Q===Y.key,onClick:()=>J(Y.key),children:[X?null:$.jsxDEV(D1,{vendor:Y.twin},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:L.label??l0(H)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[C2(H.subject.type)," · ",L.what.split(" ").slice(-1)[0],Y.writes.length>1?` · ${y1(Y.writes.length,"write")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:`ws-kind ${W.tone}`,title:W.word,"aria-label":W.word,children:$.jsxDEV(R1,{name:W.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.key,!1,void 0,this)},K=[...new Set(_.map((Y)=>Y.twin))];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-view-switch",role:"group","aria-label":"List the records by",children:[$.jsxDEV("button",{type:"button","aria-pressed":!U,className:U?void 0:"on",onClick:()=>Z(!1),children:"Path"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button","aria-pressed":U,className:U?"on":void 0,onClick:()=>Z(!0),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"ws-list","aria-label":q,children:U?K.map((Y)=>{let X=_.filter((H)=>H.twin===Y);return $.jsxDEV("li",{className:"ws-group",children:[$.jsxDEV("p",{className:"ws-group-head",children:[$.jsxDEV(D1,{vendor:Y},void 0,!1,void 0,this),$.jsxDEV("b",{children:W1(Y)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:X.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:X.map((H)=>F(H,!0))},void 0,!1,void 0,this)]},Y,!0,void 0,this)}):_.map((Y)=>F(Y,!1))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EZ({name:_,token:Q,branches:J,opens:q,refused:U,onChanged:G}){let[Z,F]=i.useState(""),[K,Y]=i.useState(!1),X=J?.state==="ok"&&J.data.checkedOut||_.split("/")[1],H=J?.state==="ok"&&J.data.named?.length?J.data.named:[{name:X,running:!0}],L=J?.state==="ok"?J.data.branches:[],W=Z.trim().toLowerCase(),A=(R)=>!W||R.toLowerCase().includes(W),I=(R)=>{R.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"The branch served here",children:[$.jsxDEV(R1,{name:"git-branch",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("b",{children:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(R1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover ws-branch-menu",children:[$.jsxDEV("div",{className:"ws-branch-find",children:[$.jsxDEV("input",{type:"search",placeholder:"Filter","aria-label":"Filter branches",value:Z,onChange:(R)=>F(R.target.value)},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:(R)=>{I(R),Y(!0)},disabled:!J,children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"This World"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-branch-list",children:H.filter((R)=>A(R.name)).map((R)=>$.jsxDEV("li",{className:R.name===X?"current":void 0,children:[$.jsxDEV("span",{className:"tick",children:R.name===X?$.jsxDEV(R1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(R1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:R.name},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.name===X?"served here":R.running?"running":"stopped"},void 0,!1,void 0,this)]},R.name,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Branches of it"},void 0,!1,void 0,this),L.length===0?$.jsxDEV("p",{className:"mode ws-branch-none",children:"None yet. New branch makes one, from now or as the World was."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"ws-branch-list",children:L.filter((R)=>A(R.name)).map((R)=>{let M=$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"tick",children:$.jsxDEV(R1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:bZ(_,R.name)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.at?.instant?$.jsxDEV($.Fragment,{children:["as of ",$.jsxDEV(f1,{iso:R.at.instant,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O=R.expiresAt?`Goes away ${new Date(R.expiresAt).toLocaleString()}`:"Kept";return $.jsxDEV("li",{children:q(R.name)?$.jsxDEV("a",{href:`${B1}/${R.name}`,title:O,onClick:(B)=>{B.preventDefault(),I(B),i_(R.name,R.name.split("/"))},children:M},void 0,!1,void 0,this):$.jsxDEV("span",{title:`${O}. Its tokens went to whoever made it; it opens from their page.`,children:M},void 0,!1,void 0,this)},R.name,!1,void 0,this)})},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-branch-foot",children:$.jsxDEV("a",{href:`${B1}/${_}/~/branches`,onClick:(R)=>{R.preventDefault(),I(R),w1([..._.split("/"),"~","branches"])},children:"Manage branches…"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(o_,{name:_,token:Q,open:K,onClose:()=>Y(!1),onMade:G,refused:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function s_({name:_,view:Q,changes:J,changesets:q}){let U=(G)=>(Z)=>{Z.preventDefault(),w1([..._.split("/"),"~",...G])};return $.jsxDEV("nav",{className:"tabs ws-pane-tabs","aria-label":"Changes and history",children:[$.jsxDEV("a",{href:`${B1}/${_}/~/changes`,className:Q==="changes"?"on":void 0,"aria-current":Q==="changes"?"page":void 0,onClick:U(["changes"]),children:["Changes",J?$.jsxDEV("span",{className:"count",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("a",{href:`${B1}/${_}/~/changes/changesets`,className:Q==="history"?"on":void 0,"aria-current":Q==="history"?"page":void 0,onClick:U(["changes","changesets"]),children:["History",q?$.jsxDEV("span",{className:"count",children:q},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function xZ({name:_,token:Q,sets:J,sub:q,signsAs:U,canWrite:G,rooted:Z,refused:F,onChanged:K,changes:Y,withScreens:X,required:H}){let[L,W]=i.useState(null),[A,I]=i.useState(!1),R=J.state==="ok"?[...J.data.changesets].sort((S,w)=>w.createdAt.localeCompare(S.createdAt)):[],M=R.find((S)=>S.name===q)??R[0],O=i.useMemo(()=>{let S=new Map;for(let w of M?$Q(M):[]){let k=`${w.twin}:${w.entry.subject.type}:${w.entry.subject.id}`,x=S.get(k)??{key:k,twin:w.twin,writes:[]};x.writes.push(w.entry),S.set(k,x)}return[...S.values()]},[M]),B=O.find((S)=>S.key===L)??O[0],T=N1(Q,B?`/-/${_}/log/${B.twin}`:null),f={added:0,removed:0,changed:0};for(let S of O)f[E4(S.writes).tone]=(f[E4(S.writes).tone]??0)+1;let C=M?x4(M):null,N=M?qQ(M,H):null;return $.jsxDEV("div",{className:"ws-two",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(s_,{name:_,view:"history",changes:Y,changesets:R.length},void 0,!1,void 0,this),$.jsxDEV(s1,{load:J,what:"the changesets",lines:4},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-list ws-commits","aria-label":"Changesets",children:R.map((S)=>{let w=M?.name===S.name,k=x4(S).label==="Not sent";return $.jsxDEV("li",{children:$.jsxDEV("a",{href:`${B1}/${_}/~/changes/changesets/${S.name}`,className:w?"on":void 0,"aria-current":w?"true":void 0,onClick:(x)=>{x.preventDefault(),W(null),w1([..._.split("/"),"~","changes","changesets",S.name])},children:[$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:n6(S)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[S.owner??(S.cutBy?D4(S.cutBy):"unrecorded")," • ",$.jsxDEV(f1,{iso:S.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k?$.jsxDEV("span",{className:"ws-unpushed",title:"Not pushed to the remote yet",children:$.jsxDEV(R1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},S.name,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-pane-right",children:[J.state==="ok"&&!M?$.jsxDEV(s2,{title:"No changesets yet",children:$.jsxDEV("p",{children:"Cut one from Changes: the cut box is at its foot."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,M&&C&&N?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-commit-head",children:[$.jsxDEV("div",{className:"ws-commit-title",children:[$.jsxDEV("h3",{children:n6(M)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-commit-stat",children:[$.jsxDEV(R1,{name:"file-diff",size:16},void 0,!1,void 0,this)," ",y1(O.length,"changed record"),f.added?$.jsxDEV("span",{className:"plus",children:[" +",f.added]},void 0,!0,void 0,this):null,f.removed?$.jsxDEV("span",{className:"minus",children:[" −",f.removed]},void 0,!0,void 0,this):null,f.changed?$.jsxDEV("span",{className:"dot",children:[" •",f.changed]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode ws-commit-meta",children:[$.jsxDEV("code",{children:M.name},void 0,!1,void 0,this)," · ",$.jsxDEV(f1,{iso:M.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"ws-commit-who",children:[["Owner",M.owner??(M.cutBy&&/^(token|token:read)$|^key:(?!.* for:)/.test(M.cutBy)?"no person: a service’s":"unrecorded")],["Cut by",M.cutBy?M.pushedBy&&M.applied===null&&M.cutBy==="machine"?"the machine it was cut on":D4(M.cutBy):"unrecorded"],...M.pushedBy?[["Pushed by",D4(M.pushedBy)]]:[]].map(([S,w])=>$.jsxDEV("span",{children:[$.jsxDEV("span",{className:"mode",children:S},void 0,!1,void 0,this)," ",w]},S,!0,void 0,this))},void 0,!1,void 0,this),M.pushedBy?$.jsxDEV("p",{className:"mode ws-commit-meta",children:M.applied===null?"Owner and cut by are as the World it was cut in recorded them; pushed by is this World's own record.":"Owner and cut by are this World’s record; pushed by is as the remote recorded it."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>I(!0),title:"Where it went, the checks, the approvals; Verify, Approve and Deploy",children:[$.jsxDEV("span",{className:`badge cs-${C.tone}`,children:C.label},void 0,!1,void 0,this),$.jsxDEV("span",{className:`badge cs-${N.tone}`,children:N.label},void 0,!1,void 0,this),"Review…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-two inner",children:[$.jsxDEV("div",{className:"ws-files",children:$.jsxDEV(a_,{records:O,...B?{selected:B.key}:{},onPick:W,label:"Records it changed"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:B?$.jsxDEV(d_,{record:B,history:T.state==="ok"?T.data.entries:T.state==="error"?[]:null},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"It changes nothing."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(G0,{open:A,onClose:()=>I(!1),title:`Review: ${n6(M)}`,wide:!0,children:[$.jsxDEV(h_,{name:_,token:Q,signsAs:U,c:M,canWrite:G,rooted:Z,refused:F,onChanged:K,part:"head",required:H},`h:${M.name}`,!1,void 0,this),$.jsxDEV(h_,{name:_,token:Q,signsAs:U,c:M,canWrite:G,rooted:Z,refused:F,onChanged:K,part:"review",required:H},`r:${M.name}`,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function mZ({name:_,token:Q,vendors:J,vendor:q,tick:U}){let[G,Z]=i.useState(j_*4),[F,K]=i.useState(""),[Y,X]=i.useState(null),H=N1(Q,`/-/${_}/timeline?limit=${G}${q?`&twin=${encodeURIComponent(q)}`:""}`,Math.floor(U/2)),L=H.state==="ok"?qF(H.data.entries):[],W=[...new Set(L.map((f)=>L0(f.entry).what))].sort(),A=L.filter((f)=>!F||L0(f.entry).what===F),I=A.find((f)=>o2(f)===Y)??A[0],R=(f)=>(C)=>{C.preventDefault(),X(null),w1([..._.split("/"),"~","events",...f?[f]:[]])},M=I?.entry.input&&typeof I.entry.input==="object"?I.entry.input.body:void 0,O=I?vZ(I.entry.traceparent):null,B=I?V_(I):null,T=I?_F(I.entry):[];return $.jsxDEV("div",{className:"ws-events",children:[$.jsxDEV("div",{className:"ws-filterbar",children:[$.jsxDEV("nav",{className:"ws-seg","aria-label":"Vendor",children:[$.jsxDEV("a",{href:`${B1}/${_}/~/events`,className:!q?"on":void 0,"aria-current":!q?"page":void 0,onClick:R(),children:"All"},void 0,!1,void 0,this),J.map((f)=>$.jsxDEV("a",{href:`${B1}/${_}/~/events/${f}`,className:q===f?"on":void 0,"aria-current":q===f?"page":void 0,onClick:R(f),children:[$.jsxDEV(D1,{vendor:f},void 0,!1,void 0,this),W1(f)]},f,!0,void 0,this))]},void 0,!0,void 0,this),$.jsxDEV("select",{"aria-label":"Operation",value:F,onChange:(f)=>{K(f.target.value),X(null)},children:[$.jsxDEV("option",{value:"",children:"Every operation"},void 0,!1,void 0,this),W.map((f)=>$.jsxDEV("option",{value:f,children:f},f,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[$.jsxDEV(s1,{load:H,what:"the events",lines:6},void 0,!1,void 0,this),$.jsxDEV("table",{className:"ws-grid","aria-label":"Events",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Time"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"What"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Record"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"By"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Receipt"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:A.map((f)=>{let C=L0(f.entry),N=V_(f),S=I&&o2(f)===o2(I);return $.jsxDEV("tr",{className:S?"on":void 0,"aria-selected":S,onClick:()=>X(o2(f)),children:[$.jsxDEV("td",{className:"mono",children:$.jsxDEV(f1,{iso:f.entry.occurredAt,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(D1,{vendor:f.twin},void 0,!1,void 0,this),W1(f.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("b",{children:C.what},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"ws-cell-clip",children:C.label?`“${C.label}”`:$.jsxDEV("code",{children:l0(f.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:D5(f.entry,f.caller)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N?$.jsxDEV("span",{className:N.bad?"badge cs-bad":N.status==="deployed"?"badge cs-done":"badge",children:N.status},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:g_(f.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},o2(f),!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-detail",children:I?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-event-line",children:[$.jsxDEV("span",{className:"badge",children:e_(I.entry)},void 0,!1,void 0,this),B?$.jsxDEV("span",{className:B.bad?"badge cs-bad":"badge cs-good",children:B.status},void 0,!1,void 0,this):null,$.jsxDEV("code",{children:[I.entry.subject.type,":",l0(I.entry)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(f1,{iso:I.entry.occurredAt},void 0,!1,void 0,this)," · ",D5(I.entry,I.caller)]},void 0,!0,void 0,this),O?$.jsxDEV("a",{href:`${B1}/${_}/~/trace/${O.trace}`,onClick:(f)=>{f.preventDefault(),w1([..._.split("/"),"~","trace",O.trace])},children:"Its trace →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-panes",children:[$.jsxDEV("div",{role:"region","aria-label":"The request",children:[$.jsxDEV("h4",{children:"Request"},void 0,!1,void 0,this),M!==void 0?$.jsxDEV(JF,{body:M},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"No request body: the World or the vendor wrote it."},void 0,!1,void 0,this),T.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Usage"},void 0,!1,void 0,this),$.jsxDEV("dl",{className:"fields",children:T.map(([f,C])=>$.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("dt",{children:f},void 0,!1,void 0,this),$.jsxDEV("dd",{children:C},void 0,!1,void 0,this)]},f,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{role:"region","aria-label":"What it wrote",children:[$.jsxDEV("h4",{children:"Written"},void 0,!1,void 0,this),$.jsxDEV(QQ,{fields:I.entry.fields},void 0,!1,void 0,this),$.jsxDEV("h4",{children:I.copies.length?"Receipts":"Receipt"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:I.copies.length?I.copies.map((f)=>f.entry.receipt?.status??"landed copy").join(" · "):$F(I.entry)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"Nothing written here yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:[$.jsxDEV("span",{children:[I?`${A.indexOf(I)+1} of ${A.length}`:A.length," events",q?` at ${W1(q)}`:""]},void 0,!0,void 0,this),H.state==="ok"&&H.data.next?$.jsxDEV("button",{type:"button",onClick:()=>Z((f)=>f+j_*4),children:"Load older"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function gZ({name:_,token:Q,id:J}){let q=/^[0-9a-f]{32}$/.test(J),U=N1(Q,q?`/-/${_}/timeline?trace=${J}&limit=500`:null),G=U.state==="ok"?[...U.data.entries].sort((H,L)=>-n_(H,L)):[],[Z,F]=i.useState(null),K=G[0]?Date.parse(G[0].entry.occurredAt):0,Y=G.length?Math.max(1,Date.parse(G[G.length-1].entry.occurredAt)-K):1,X=[...new Set(G.map((H)=>H.twin))];return $.jsxDEV("div",{className:"ws-sheet ws-trace",children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${B1}/${_}/~/events`,onClick:(H)=>{H.preventDefault(),w1([..._.split("/"),"~","events"])},children:[$.jsxDEV(R1,{name:"arrow-left",size:16},void 0,!1,void 0,this)," Events"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("h2",{children:[G[0]?`${L0(G[0].entry).what} …`:"Trace"," ",$.jsxDEV("code",{className:"mode",children:J.slice(0,12)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!q?$.jsxDEV("p",{role:"alert",children:[J?`${J} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):$.jsxDEV(s1,{load:U,what:"the trace"},void 0,!1,void 0,this),G.length?$.jsxDEV("p",{className:"ws-trace-meta",children:["Started ",$.jsxDEV("b",{children:$.jsxDEV(f1,{iso:G[0].entry.occurredAt},void 0,!1,void 0,this)},void 0,!1,void 0,this)," · Took ",$.jsxDEV("b",{children:[Y," ms"]},void 0,!0,void 0,this)," · Vendors ",$.jsxDEV("b",{children:X.map(W1).join(", ")},void 0,!1,void 0,this)," · Writes ",$.jsxDEV("b",{children:G.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,U.state==="ok"&&G.length===0?$.jsxDEV(s2,{title:"Nothing in this World carries this trace",children:$.jsxDEV("p",{children:["An app instrumented with OpenTelemetry sends a ",$.jsxDEV("code",{children:"traceparent"},void 0,!1,void 0,this)," with each call, and every write that call makes keeps it, so one click reads across every vendor."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,G.length?$.jsxDEV("div",{className:"ws-spans",role:"table","aria-label":"The trace's writes",children:[$.jsxDEV("div",{className:"ws-span head",role:"row",children:[$.jsxDEV("span",{role:"columnheader",children:"Vendor and what"},void 0,!1,void 0,this),$.jsxDEV("span",{role:"columnheader",className:"ws-ticks",children:[$.jsxDEV("span",{children:"0 ms"},void 0,!1,void 0,this),$.jsxDEV("span",{children:[Math.round(Y/2)," ms"]},void 0,!0,void 0,this),$.jsxDEV("span",{children:[Y," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.map((H)=>{let L=Date.parse(H.entry.occurredAt)-K,W=o2(H),A=L0(H.entry);return $.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("div",{className:Z===W?"ws-span on":"ws-span",role:"row",onClick:()=>F(Z===W?null:W),children:[$.jsxDEV("span",{role:"cell",className:"ws-span-name",children:[$.jsxDEV(D1,{vendor:H.twin},void 0,!1,void 0,this),$.jsxDEV("b",{children:W1(H.twin)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[A.what,A.label?` “${A.label}”`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{role:"cell",className:"ws-span-track",children:[$.jsxDEV("span",{className:"ws-span-dot",style:{left:`${L/Y*100}%`}},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-span-at mode",style:{left:`${L/Y*100}%`},children:["+",L," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z===W?$.jsxDEV("div",{className:"ws-span-detail",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:e_(H.entry)},void 0,!1,void 0,this)," on ",$.jsxDEV("code",{children:[H.entry.subject.type,":",l0(H.entry)]},void 0,!0,void 0,this)," · ",D5(H.entry,H.caller)," · ",g_(H.entry)]},void 0,!0,void 0,this),$.jsxDEV(QQ,{fields:H.entry.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},W,!0,void 0,this)})]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function pZ({name:_,token:Q,vendor:J,withScreens:q,tick:U}){let G=N1(Q,`/-/${_}/checkpoint/${J}`,Math.floor(U/6)),Z=G.state==="ok"?G.data.tree.filter((T)=>T.deleted!==!0):[],F=[...new Set(Z.map((T)=>T.type))].map((T)=>({type:T,count:Z.filter((f)=>f.type===T).length})).sort((T,f)=>Number(T.type.startsWith("_"))-Number(f.type.startsWith("_"))||C2(T.type).localeCompare(C2(f.type))),[K,Y]=i.useState(null),[X,H]=i.useState(null),L=F.some((T)=>T.type===K)?K:F[0]?.type,W=Z.filter((T)=>T.type===L),A=W.find((T)=>T.id===X)??W[0],I=["name","email","title","text","description","subject","amount","percent_off","unit_amount","currency","status","channel","customer","product"],R=new Set(["id","type","object","livemode","created","updated","updatedAt","deleted"]),M=(T)=>!R.has(T)&&W.some((f)=>f[T]!==void 0&&f[T]!==null&&typeof f[T]!=="object"),O=[...new Set(W.flatMap((T)=>Object.keys(T)))],B=[...I.filter(M),...O.filter((T)=>!I.includes(T)&&M(T))].slice(0,4);return $.jsxDEV("div",{className:"ws-table-app",children:[$.jsxDEV("nav",{className:"ws-tables","aria-label":`${W1(J)}'s records`,children:[$.jsxDEV("div",{className:"ws-list-head",children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(D1,{vendor:J},void 0,!1,void 0,this),W1(J)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(s1,{load:G,what:"what it stores",lines:4},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Stores"},void 0,!1,void 0,this),F.map((T)=>$.jsxDEV("a",{href:`#${T.type}`,className:L===T.type?"on":void 0,"aria-current":L===T.type?"true":void 0,onClick:(f)=>{f.preventDefault(),Y(T.type),H(null)},children:[$.jsxDEV(R1,{name:"table-2",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:C2(T.type)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"count",children:T.count},void 0,!1,void 0,this)]},T.type,!0,void 0,this)),$.jsxDEV("p",{className:"menu-label",children:"Also"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${B1}/${_}/~/events/${J}`,onClick:(T)=>{T.preventDefault(),w1([..._.split("/"),"~","events",J])},children:[$.jsxDEV(R1,{name:"activity",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its events"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q?$.jsxDEV("a",{href:`${B1}/${_}/~/screens/${J}`,onClick:(T)=>{T.preventDefault(),w1([..._.split("/"),"~","screens",J])},children:[$.jsxDEV(R1,{name:"monitor",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[G.state==="ok"&&F.length===0?$.jsxDEV(s2,{title:`${W1(J)} stores nothing yet`,children:$.jsxDEV("p",{children:"What your app makes there shows here, by type."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,W.length?$.jsxDEV("table",{className:"ws-grid","aria-label":`${C2(L??"")} records`,children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),B.map((T)=>$.jsxDEV("th",{children:T},T,!1,void 0,this)),$.jsxDEV("th",{children:"updated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:W.map((T)=>$.jsxDEV("tr",{className:A?.id===T.id?"on":void 0,"aria-selected":A?.id===T.id,onClick:()=>H(T.id),children:[$.jsxDEV("td",{children:$.jsxDEV("code",{children:T.id},void 0,!1,void 0,this)},void 0,!1,void 0,this),B.map((f)=>$.jsxDEV("td",{className:"ws-cell-clip",children:T[f]===void 0||T[f]===null?$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this):String(T[f])},f,!1,void 0,this)),$.jsxDEV("td",{className:"mode",children:typeof T.updatedAt==="string"?$.jsxDEV(f1,{iso:T.updatedAt},void 0,!1,void 0,this):"—"},void 0,!1,void 0,this)]},T.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("aside",{className:"ws-record","aria-label":"The selected record",children:A?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:C2(A.type)},void 0,!1,void 0,this),$.jsxDEV("code",{children:A.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("dl",{className:"ws-record-fields",children:Object.entries(A).filter(([T])=>T!=="type"&&T!=="id").map(([T,f])=>$.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("dt",{children:T},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(i0,{v:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},T,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:A?`${W.indexOf(A)+1} of ${y1(W.length,C2(L??"record"))}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cZ({name:_,vendor:Q,url:J,mapError:q,holding:U,session:G,retry:Z}){return $.jsxDEV("div",{className:"ws-screen",children:[$.jsxDEV("div",{className:"ws-screen-bar",children:[$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(D1,{vendor:Q},void 0,!1,void 0,this),$.jsxDEV("b",{children:W1(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:U},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${B1}/${_}/~/vendors/${Q}`,onClick:(F)=>{F.preventDefault(),w1([..._.split("/"),"~","vendors",Q])},children:[$.jsxDEV(R1,{name:"table-2",size:16},void 0,!1,void 0,this),"Its records"]},void 0,!0,void 0,this),J?$.jsxDEV("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:[$.jsxDEV(R1,{name:"external-link",size:16},void 0,!1,void 0,this),"New tab"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),G.state==="ok"&&G.scope==="read"?$.jsxDEV("p",{className:"mode ws-screens-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,q?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not say where its screens are: ",q]},void 0,!0,void 0,this):G.state==="pending"||J===void 0?$.jsxDEV("p",{className:"mode ws-screens-note",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,G.state==="error"?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not open its screens: ",G.error," ",$.jsxDEV("button",{type:"button",onClick:Z,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,G.state==="ok"&&J===null?$.jsxDEV("p",{className:"mode ws-screens-note",children:[W1(Q),"'s pack lists no screens."]},void 0,!0,void 0,this):null,G.state==="ok"&&J?$.jsxDEV("iframe",{title:`${W1(Q)}, as this World shows it`,src:J},Q,!1,void 0,this):null]},void 0,!0,void 0,this)}function lZ({name:_,token:Q,who:J,scope:q}){let[U,G]=i.useState(0),Z=N1(Q,`/-/${_}/twins`),F=N1(Q,`/-/${_}/rules`,U),K=F.state==="ok"?F.data.changesets:null,[Y,X]=i.useState(null),[H,L]=i.useState(null),[W,A]=i.useState(!1),[I,R]=i.useState([]),M=Y??K?.approvals??1,O=H??K?.summary??"required",B=K!==null&&(M!==(K.approvals??1)||O!==(K.summary??"required")),T=(k,x)=>{if(R((r)=>[{ok:k,text:x,at:new Date().toISOString(),n:++x5},...r].slice(0,3)),!k)V1(x,"error")},f=async(k)=>{k.preventDefault(),A(!0);try{let x=await I1(Q,`/-/${_}/rules`,{method:"PUT",body:JSON.stringify({changesets:{approvals:M,summary:O}})});if(!x.ok){T(!1,`Save: ${await q0(x)}`);return}T(!0,`Saved: ${M===0?"no approval":y1(M,"approval")} before a deploy; a summary ${O==="required"?"required":"generated when none is given"}.`),X(null),L(null),G((r)=>r+1)}finally{A(!1)}},C={gated:"a person deploys an approved changeset",auto:"a push deploys at once",hold:"nothing deploys"},N=J.person?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:J.person},void 0,!1,void 0,this),J.local?", signed in on this machine":""]},void 0,!0,void 0,this):J.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this machine"},void 0,!1,void 0,this),": no one is signed in here, so no person owns them until they are pushed by one"]},void 0,!0,void 0,this):J.admin?$.jsxDEV($.Fragment,{children:$.jsxDEV("b",{children:"the host's admin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this token"},void 0,!1,void 0,this),", a service"]},void 0,!0,void 0,this),S=Z.state==="ok"?Z.data.twins.filter((k)=>k.root?.url):[],w=q!=="write"?"This session reads the World; it changes no rules":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Changesets"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"This World's rules, kept with it and shared by everyone who works in it. A person or the World's token changes them; a key never does, so an agent cannot relax the review its own changes go through."},void 0,!1,void 0,this),$.jsxDEV(s1,{load:F,what:"the rules",lines:2},void 0,!1,void 0,this),$.jsxDEV("form",{className:"ws-rules",onSubmit:(k)=>void f(k),"aria-label":"Changeset rules",children:[$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Recorded as"},void 0,!1,void 0,this),$.jsxDEV("p",{children:["What you cut here is recorded as ",N,". An agent's or an app's key cuts as itself, for the person it was made for; a World's token cuts as a service."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"A cut's summary"},void 0,!1,void 0,this),$.jsxDEV("fieldset",{className:"choice",disabled:Boolean(w)||K===null,children:[$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:O==="required",onChange:()=>L("required")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Required: whoever cuts says what it does and why"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:O==="generated",onChange:()=>L("generated")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Generated from its changes when none is given"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Either way a cut takes every change not yet in a changeset: there is no staging."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Ready to deploy"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-rule-list",children:$.jsxDEV("li",{children:[$.jsxDEV(R1,{name:"check",size:16},void 0,!1,void 0,this),"Verified: replayed in a throwaway World, the World's checks passing"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("label",{className:"ws-rule-row",children:[$.jsxDEV("span",{children:"Approved by"},void 0,!1,void 0,this),$.jsxDEV("select",{value:M,onChange:(k)=>X(Number(k.target.value)),disabled:Boolean(w)||K===null,"aria-label":"Approvals required",children:[0,1,2,3,4,5].map((k)=>$.jsxDEV("option",{value:k,children:k===0?"no one: verified is enough":k===1?"1 person":`${k} different people`},k,!1,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"for its contents as they stand"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Deploys to"},void 0,!1,void 0,this),Z.state==="ok"&&S.length===0?$.jsxDEV("p",{className:"mode",children:"No vendor here is connected to its real service, so nothing deploys from this World."},void 0,!1,void 0,this):null,S.length?$.jsxDEV("ul",{className:"ws-rule-list",children:S.map((k)=>$.jsxDEV("li",{children:[$.jsxDEV(D1,{vendor:k.twin},void 0,!1,void 0,this),W1(k.twin),": ",C[k.root.deploy??"gated"]??"gated"]},k.twin,!0,void 0,this))},void 0,!1,void 0,this):null,$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("a",{href:`${B1}/${_}/~/settings/services`,onClick:(k)=>{k.preventDefault(),w1([..._.split("/"),"~","settings","services"])},children:"Real services"},void 0,!1,void 0,this)," sets each vendor's deploy policy."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV($2,{log:I,name:_},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(w)||W||!B,title:w??void 0,children:W?"Saving…":"Save"},void 0,!1,void 0,this),B?$.jsxDEV("button",{type:"button",onClick:()=>{X(null),L(null)},children:"Cancel"},void 0,!1,void 0,this):null,w?$.jsxDEV("span",{className:"mode",children:[w,"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function iZ({who:_,scope:Q,snapshot:J,portal:q,onSignOut:U}){let G=Q==="write"?"Reads and changes this World":Q==="read"?"Reads this World; changes nothing":"…",[Z,F]=J?["A snapshot",`of ${J.parent}, read only`]:_.local&&_.person?[_.person,"Signed in on this machine: this World is served here, and acts as you"]:_.local?["This machine","Served here, with no one signed in: what you do is recorded as this machine"]:_.person?[_.person,q?`Signed in through ${new URL(q).host}`:"Signed in"]:_.admin?["The host's admin","Opened with the host admin token: every World it serves"]:["A link or key","Opened with a token for this World"];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Account"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-account",children:[$.jsxDEV("span",{className:"ws-account-face","aria-hidden":"true",children:$.jsxDEV(R1,{name:_.person?"user":_.local?"monitor":J?"clock":"key-round",size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:Z},void 0,!1,void 0,this),$.jsxDEV("small",{children:F},void 0,!1,void 0,this),$.jsxDEV("small",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_.local||J?null:$.jsxDEV("p",{children:$.jsxDEV("button",{type:"button",onClick:U,children:[$.jsxDEV(R1,{name:"log-out",size:16},void 0,!1,void 0,this),_.person?"Sign out":_.admin?"Sign out of the host":"Use another token"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&_.person?$.jsxDEV("p",{className:"mode",children:["Your profile, orgs and keys are on ",$.jsxDEV("a",{href:`${q}/`,children:new URL(q).host},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function rZ({name:_,token:Q,view:J,sub:q,arg:U,win:G,who:Z,snapshot:F,onReturn:K,onSignOut:Y,worlds:X,session:H,retry:L,twins:W,map:A,branches:I,clock:R,canWrite:M,refused:O,signsAs:B,opens:T,tick:f,admin:C,onRemoved:N,onClock:S,scope:w}){let k=GQ(_,Q,f,O),[x,r]=i.useState(0),m=x*1e5+Math.floor(f/2),v=N1(Q,`/-/${_}/diff`,m),D=N1(Q,`/-/${_}/changesets`,m),V=N1(Q,`/-/${_}/rules`,m),[E,u]=i.useState(null),b=(Q1)=>(T1)=>{T1?.preventDefault(),w1([..._.split("/"),"~",...Q1])},P=W.state==="ok"?W.data.twins.map((Q1)=>Q1.twin):[],y=new Map((A.state==="ok"?A.data.twins:[]).flatMap((Q1)=>{let T1=hZ(_,Q1);return T1?[[Q1.twin,T1]]:[]})),p=[...y.keys()],h=A.state==="ok"?A.data.twins.filter((Q1)=>Q1.root).map((Q1)=>Q1.twin):[],e=(Q1)=>A.state==="ok"?(A.data.twins.find((T1)=>T1.twin===Q1)?.resources??[]).reduce((T1,K1)=>T1+K1.count,0):0,t=I?.state==="ok"&&I.data.checkedOut||_.split("/")[1],o=i.useMemo(()=>{if(v.state!=="ok")return[];let Q1=new Map;for(let T1 of v.data.changes){let K1=`${T1.twin}:${T1.entry.subject.type}:${T1.entry.subject.id}`,k1=Q1.get(K1)??{key:K1,twin:T1.twin,writes:[]};k1.writes.push(T1.entry),Q1.set(K1,k1)}return[...Q1.values()]},[v]),s=o.find((Q1)=>Q1.key===E)??o[0],g=N1(Q,J==="changes"&&s?`/-/${_}/log/${s.twin}`:null,m),J1=v.state==="ok"?v.data.changes.length:0,U1=k.waiting.length,X1=k.there,G1=k.origin.state==="ok"?k.origin.data.origin:null,F1=!M?"This session reads the World; it changes nothing":!X1?"No remote: name one in Settings › Remote":null,A1=(Q1,T1,K1,k1,p1,l1)=>$.jsxDEV("a",{href:`${B1}/${_}/~/${k1}`,className:Q1?"on":void 0,"aria-current":Q1?"page":void 0,onClick:p1,children:[T1,$.jsxDEV("span",{children:K1},void 0,!1,void 0,this),l1?$.jsxDEV("span",{className:"count",children:l1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Y1=(Q1)=>{Q1.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("div",{className:"ws",children:[$.jsxDEV("div",{className:"ws-bar",role:"toolbar","aria-label":`${_} toolbar`,children:[$.jsxDEV("div",{className:"ws-left",children:[$.jsxDEV(u5,{href:`${B1}/${_}`,onClick:(Q1)=>{Q1.preventDefault(),b(["changes"])()}},void 0,!1,void 0,this),$.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"This World",children:[$.jsxDEV(R1,{name:"globe",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("b",{children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(R1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover menu-list ws-world-menu",children:[Z.local?null:$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Worlds"},void 0,!1,void 0,this),X.map((Q1)=>$.jsxDEV("a",{href:`${B1}/${Q1}`,className:Q1===_?"on":void 0,onClick:(T1)=>{T1.preventDefault(),Y1(T1),w1(Q1.split("/"))},children:[Q1===_?$.jsxDEV(R1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(R1,{name:"globe",size:16},void 0,!1,void 0,this),Q1]},Q1,!0,void 0,this)),$.jsxDEV("a",{href:`${R0()&&R0()!==P1?R0():""}${B1}/`,onClick:(Q1)=>{if(R0()&&R0()!==P1)return;Q1.preventDefault(),Y1(Q1),w1([])},children:[$.jsxDEV(R1,{name:"layout-grid",size:16},void 0,!1,void 0,this),"All Worlds",t1()?` on ${new URL(t1()).host}`:""]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Connect an app"},void 0,!1,void 0,this),t1()?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key made on the platform; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[p0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(t6,{text:j4({platform:t1(),world:_})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!Z.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key from Settings › Access; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[p0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(t6,{text:j4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Run it in this World; its calls to these vendors land here:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-menu-text mode",children:["Or point an SDK at ",$.jsxDEV("code",{children:[p0,"/",_,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",$.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),$.jsxDEV(t6,{text:j4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${B1}/${_}/~/settings`,onClick:(Q1)=>{Y1(Q1),b(["settings"])(Q1)},children:[$.jsxDEV(R1,{name:"settings",size:16},void 0,!1,void 0,this),"Settings…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(EZ,{name:_,token:Q,branches:I,opens:T,refused:O,onChanged:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-where",title:"Where this is",children:[$.jsxDEV("span",{children:_},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("span",{children:t},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),G1?$.jsxDEV("a",{href:`${B1}/${_}/~/remote`,onClick:b(["remote"]),children:["origin ",G1.namespace,U1?$.jsxDEV("b",{children:[" ↑",U1]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("a",{href:`${B1}/${_}/~/remote`,onClick:b(["remote"]),children:"no remote"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${B1}/${_}/~/settings/clock`,onClick:b(["settings","clock"]),children:R.state==="ok"?$.jsxDEV($.Fragment,{children:[R.data.frozen?"stopped at ":"",$.jsxDEV(f1,{iso:R.data.at,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-right",children:[$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.pull(),disabled:Boolean(F1)||k.busy!==null,title:F1??`Fetch what ${X1} has and move this branch onto it`,children:[$.jsxDEV(R1,{name:"arrow-down-to-line",size:16},void 0,!1,void 0,this),k.busy==="Pull"?"Pulling…":"Pull"]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.push(),disabled:Boolean(F1)||k.busy!==null||U1===0,title:F1??(U1?`Push ${y1(U1,"changeset")} to ${X1}`:`Every changeset is at ${X1}`),children:[$.jsxDEV(R1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this),k.busy==="Push"?"Pushing…":"Push",U1?$.jsxDEV("span",{className:"ws-btn-count",children:U1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn icon-only","aria-label":"Settings",title:"Settings",onClick:()=>b(["settings"])(),children:$.jsxDEV(R1,{name:"settings",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F?$.jsxDEV("div",{className:"ws-banner",role:"region","aria-label":"Snapshot",children:[$.jsxDEV(R1,{name:"clock",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:["You are looking at ",$.jsxDEV("b",{children:F.parent},void 0,!1,void 0,this)," as it was at ",$.jsxDEV(f1,{iso:F.at},void 0,!1,void 0,this),": a read-only snapshot",F.expiresAt?$.jsxDEV($.Fragment,{children:[", gone ",$.jsxDEV(f1,{iso:F.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void K(F),children:"Return to live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,k.log.length?$.jsxDEV("div",{className:"ws-said",children:$.jsxDEV($2,{log:k.log.slice(0,1),name:_},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV("div",{className:"ws-body",children:[$.jsxDEV("nav",{className:"ws-side","aria-label":`${_} places`,children:[P.length?$.jsxDEV("a",{href:`${B1}/${_}/~/screens`,className:J==="screen"?"ws-screens-entry on":"ws-screens-entry",onClick:b(["screens"]),title:`The board: ${w2(P.map(W1))}`,children:[$.jsxDEV(R1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Board"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-screens-marks",children:[P.slice(0,3).map((Q1)=>$.jsxDEV(D1,{vendor:Q1},Q1,!1,void 0,this)),P.length>3?$.jsxDEV("span",{className:"more",children:["+",P.length-3]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{className:"side-group",children:"Workspace"},void 0,!1,void 0,this),A1(J==="changes"||J==="history",$.jsxDEV(R1,{name:"file-diff",size:16},void 0,!1,void 0,this),"Changes","changes",b(["changes"]),o.length?String(o.length):void 0),A1(J==="events"&&!U||J==="trace",$.jsxDEV(R1,{name:"activity",size:16},void 0,!1,void 0,this),"Events","events",b(["events"])),$.jsxDEV("p",{className:"side-group",children:"Records"},void 0,!1,void 0,this),P.map((Q1)=>$.jsxDEV(i.default.Fragment,{children:A1(J==="vendor"&&U===Q1,$.jsxDEV(D1,{vendor:Q1},void 0,!1,void 0,this),W1(Q1),`vendors/${Q1}`,b(["vendors",Q1]),e(Q1)?String(e(Q1)):void 0)},Q1,!1,void 0,this)),$.jsxDEV("p",{className:"side-group",children:"Remote"},void 0,!1,void 0,this),A1(!1,$.jsxDEV(R1,{name:"cloud",size:16},void 0,!1,void 0,this),X1?"origin":"Name a remote…","remote",b(["remote"]),U1?`↑${U1}`:void 0)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-main",role:"main",children:[J==="changes"?$.jsxDEV("div",{className:"ws-status",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(s_,{name:_,view:"changes",changes:o.length,changesets:D.state==="ok"?D.data.changesets.length:0},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:"Not in a changeset"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:v.state==="ok"?`${y1(o.length,"record")} · ${y1(J1,"write")}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(s1,{load:v,what:"the changes",lines:4},void 0,!1,void 0,this),$.jsxDEV(a_,{records:o,...s?{selected:s.key}:{},onPick:u,label:"Changed records"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:[v.state==="ok"&&!s?$.jsxDEV(s2,{title:"No changes on this branch",action:U1>0&&X1?$.jsxDEV("button",{type:"button",className:"primary",disabled:Boolean(F1)||k.busy!==null,onClick:()=>void k.push(),children:["Push ",y1(U1,"changeset")," to origin"]},void 0,!0,void 0,this):void 0,children:$.jsxDEV("p",{children:["What your app writes to this World lands here, record by record, to cut into a changeset. Everything since ",v.data.base.at?$.jsxDEV(f1,{iso:v.data.base.at},void 0,!1,void 0,this):$.jsxDEV("code",{children:v.data.base.id},void 0,!1,void 0,this)," is in one already."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,s?$.jsxDEV(d_,{record:s,history:g.state==="ok"?g.data.entries:g.state==="error"?[]:null},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(WF,{pinned:!0,generated:V.state==="ok"&&V.data.changesets.summary==="generated",author:{face:$.jsxDEV(R1,{name:Z.person?"user":Z.local?"monitor":"key-round",size:18},void 0,!1,void 0,this),who:Z.person??(Z.local?"This machine":Z.admin?"The host's admin":"A token"),account:`${B1}/${_}/~/settings/account`,branch:t},name:_,token:Q,changes:J1,canWrite:M,refused:O,onCut:()=>{r((Q1)=>Q1+1),u(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J==="history"?$.jsxDEV(xZ,{name:_,token:Q,sets:D,changes:o.length,withScreens:p,required:V.state==="ok"?V.data.changesets.approvals??1:1,...q?{sub:q}:{},signsAs:B,canWrite:M,rooted:h,refused:O,onChanged:()=>r((Q1)=>Q1+1)},void 0,!1,void 0,this):null,J==="events"?$.jsxDEV(mZ,{name:_,token:Q,vendors:P,...U&&P.includes(U)?{vendor:U}:{},tick:f},U??"",!1,void 0,this):null,J==="trace"?$.jsxDEV(gZ,{name:_,token:Q,id:U??""},void 0,!1,void 0,this):null,J==="vendor"&&U?$.jsxDEV(pZ,{name:_,token:Q,vendor:U,withScreens:p.includes(U),tick:f},U,!1,void 0,this):null,J==="screen"&&U?$.jsxDEV(cZ,{name:_,vendor:U,url:A.state==="ok"?y.get(U)??null:void 0,...A.state==="error"?{mapError:A.error}:{},holding:aZ(A.state==="ok"?A.data.twins.find((Q1)=>Q1.twin===U)?.resources??[]:[]),session:H,retry:L},U,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(G0,{open:G?.kind==="settings",onClose:()=>b(["changes"])(),title:"Settings",wide:"window",children:G?.kind==="settings"?$.jsxDEV("div",{className:"ws-settings",children:[$.jsxDEV("nav",{"aria-label":"Settings",children:r_.map(([Q1,T1,K1])=>$.jsxDEV("a",{href:`${B1}/${_}/~/settings/${Q1}`,className:G.tab===Q1?"on":void 0,"aria-current":G.tab===Q1?"page":void 0,onClick:b(["settings",Q1]),children:[$.jsxDEV(R1,{name:K1,size:16},void 0,!1,void 0,this),T1]},Q1,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-settings-pane",children:[w==="read"?$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"badge read-only",children:"Read only"},void 0,!1,void 0,this)," This session reads the World; it changes nothing."]},void 0,!0,void 0,this):null,G.tab==="account"?$.jsxDEV(iZ,{who:Z,scope:w,snapshot:F,portal:t1(),onSignOut:Y},void 0,!1,void 0,this):null,G.tab==="changesets"?$.jsxDEV(lZ,{name:_,token:Q,who:Z,scope:w},void 0,!1,void 0,this):null,G.tab==="remote"?$.jsxDEV(BF,{name:_,token:Q,canWrite:M,tick:f,refused:O},void 0,!1,void 0,this):null,G.tab==="access"||G.tab==="services"||G.tab==="checks"||G.tab==="clock"?$.jsxDEV(TF,{name:_,token:Q,admin:C,canWrite:M,refused:O,onRemoved:N,only:G.tab},void 0,!1,void 0,this):null,G.tab==="vault"?$.jsxDEV(MF,{name:_,token:Q,canWrite:M,refused:O},void 0,!1,void 0,this):null,G.tab==="appearance"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV(kZ,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV(G0,{open:G?.kind==="branches",onClose:()=>b(["changes"])(),title:"Branches",wide:!0,children:G?.kind==="branches"?$.jsxDEV(oZ,{name:_,token:Q,canWrite:M,branches:I,opens:T,...G.open?{open:G.open}:{},onChanged:S,refused:O},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function t6({text:_}){return $.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>V1("Copied the prompt: paste it into your coding agent"),()=>V1("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}var q8=(_)=>`${_.url.replace(/\/+$/,"")}/${_.namespace}`,dZ=(_)=>_.filter((Q)=>Q.applied===null||Q.applied.outcome==="refused"),aZ=(_,Q=4)=>{let J=[..._].filter((q)=>q.count>0).sort((q,U)=>U.count-q.count);return J.length?J.slice(0,Q).map((q)=>y1(q.count,q.type.replace(/^_+/,""))).join(" · ")+(J.length>Q?` · +${J.length-Q} more`:""):"nothing yet"},t_=$.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:$.jsxDEV("path",{fill:"currentColor",d:"M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v5.256a2.25 2.25 0 1 0 1.5 0V9.5h4.25A2.25 2.25 0 0 0 11.5 7.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75H5V5.372ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm6.5-9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function sZ({name:_,token:Q,clock:J,canWrite:q,onChanged:U,refused:G,open:Z}){let[F,K]=i.useState(!1),[Y,X]=i.useState(""),[H,L]=i.useState(""),[W,A]=i.useState(null),[I,R]=i.useState(!1),M=J.state==="ok"?J.data:null,O=async(C,N,S)=>{R(!0),A(null);try{let w=await I1(Q,`/-/${_}/${N}`,{method:N==="clock"?"PUT":"POST",body:JSON.stringify(S)});if(!w.ok){G(w),A({ok:!1,text:await q0(w)});return}let k=await w.json();A({ok:!0,text:`${C} — the World is at ${new Date(k.at).toLocaleString()}`}),K(!1),U()}catch(w){A({ok:!1,text:`the World did not answer: ${w instanceof Error?w.message:String(w)}`})}finally{R(!1)}},B=(C)=>{C.preventDefault();let N=new Date(Y);if(Number.isNaN(N.getTime())){A({ok:!1,text:"Pick a date and time."});return}if(M&&N.getTime()<Date.parse(M.at)){A({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(M.at).toLocaleString()}.`});return}O("Clock set","clock",{at:N.toISOString()})},T=(C,N)=>{O(`Advanced ${N}`,"clock/advance",{by:C})},f=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return $.jsxDEV("div",{className:`clock${M?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[$.jsxDEV("p",{className:"clock-now",children:J.state==="loading"?$.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):J.state==="error"?$.jsxDEV("span",{className:"mode",children:["Clock: ",J.error]},void 0,!0,void 0,this):M.frozen?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",$.jsxDEV("strong",{children:$.jsxDEV(f1,{iso:M.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:["World time ",$.jsxDEV("strong",{children:$.jsxDEV(f1,{iso:M.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"· real time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&M?$.jsxDEV("details",{className:Z?"clock-more inline":"clock-more",open:Z||void 0,children:[$.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),$.jsxDEV("div",{className:Z?void 0:"popover",children:[$.jsxDEV("p",{className:"mode",children:"Move this World's clock forward to see what happens later: renewals, expiries, scheduled sends. Like a test clock, it only moves forward; to look back, the branch picker’s Manage branches… views an earlier moment."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"clock-controls",children:[$.jsxDEV("button",{type:"button","aria-expanded":F,onClick:()=>{K(!F),X(n2(S_(M.at))),A(null)},children:"Set time…"},void 0,!1,void 0,this),$.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[$.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),f.map(([C,N])=>$.jsxDEV("button",{type:"button","aria-label":`Advance ${N}`,disabled:I||!M.frozen,title:M.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>T(C,N),children:N},C,!1,void 0,this)),$.jsxDEV("form",{className:"inline",onSubmit:(C)=>{if(C.preventDefault(),!/^\d+[smhd]$/.test(H.trim())){A({ok:!1,text:"Advance by a number and a unit: 90m, 12h, 3d."});return}T(H.trim(),`by ${H.trim()}`)},children:[$.jsxDEV("label",{className:"sr",children:["Advance by ",$.jsxDEV("input",{name:"advanceBy",value:H,onChange:(C)=>L(C.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!M.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:I||!M.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!M.frozen?$.jsxDEV("p",{className:"mode",children:"The World runs on real time. Set a time to start simulating; then advance it."},void 0,!1,void 0,this):null,F?$.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:B,noValidate:!0,children:[$.jsxDEV("label",{children:["World time ",$.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:Y,min:n2(S_(M.at)),onChange:(C)=>X(C.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",disabled:I,children:"Set time"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>K(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,W?$.jsxDEV("p",{role:W.ok?"status":"alert",children:W.text},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function tZ({name:_,token:Q,clock:J,refused:q}){let[U,G]=i.useState(!1),[Z,F]=i.useState(""),[K,Y]=i.useState(null),[X,H]=i.useState(!1),L=J.state==="ok"?J.data.at:new Date().toISOString(),W=i.useRef(null);return i.useEffect(()=>{if(!U)return;let I=(M)=>{if(M.key==="Escape"&&!document.querySelector("dialog[open]"))G(!1),W.current?.querySelector("button")?.focus()},R=(M)=>{if(!W.current?.contains(M.target))G(!1)};return document.addEventListener("keydown",I),document.addEventListener("click",R),()=>{document.removeEventListener("keydown",I),document.removeEventListener("click",R)}},[U]),$.jsxDEV("div",{className:"as-of",ref:W,children:[$.jsxDEV("button",{type:"button","aria-expanded":U,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{G(!U),F(n2(L)),Y(null)},children:"View an earlier moment…"},void 0,!1,void 0,this),U?$.jsxDEV("form",{className:"inline","aria-label":"View the World as of a past moment",onSubmit:async(I)=>{I.preventDefault(),Y(null);let R=new Date(Z);if(Number.isNaN(R.getTime())){Y("Pick a date and time.");return}if(R.getTime()>Date.parse(L)){Y(`That is after the World's present (${new Date(L).toLocaleString()}); a snapshot looks back.`);return}H(!0);try{let M=await I1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:R.toISOString()},ttl:3600})});if(!M.ok){q(M),Y(await q0(M));return}let O=await M.json();_8({name:O.name,parent:_,token:O.token,readToken:O.readToken,at:R.toISOString(),expiresAt:O.expiresAt??null,parentOrigin:P1,made:!0});let B=E5(O.origin)?.origin;if(B&&B!==P1){$8(B,O.readToken,O.name,`${B1}/${O.name}`);return}w1(O.name.split("/"))}catch(M){Y(`the World did not answer: ${M instanceof Error?M.message:String(M)}`)}finally{H(!1)}},noValidate:!0,children:[$.jsxDEV("label",{children:["As of ",$.jsxDEV("input",{name:"asOf",type:"datetime-local",value:Z,max:n2(L),onChange:(I)=>F(I.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:X,children:X?"Opening…":"Open snapshot"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Opens a read-only copy of this World as it was then; the copy goes away within the hour."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,K?$.jsxDEV("p",{role:"alert",children:K},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function o_({name:_,token:Q,open:J,onClose:q,onMade:U,refused:G}){let Z=(N)=>N.split("/").pop()??N,[F,K]=i.useState(!1),[Y,X]=i.useState(null),[H,L]=i.useState(""),[W,A]=i.useState("now"),[I,R]=i.useState(""),[M,O]=i.useState("24"),[B,T]=i.useState(!0);i.useEffect(()=>{if(J)X(null),R(n2(new Date().toISOString()))},[J]);let f=async(N)=>{N.preventDefault(),X(null);let S=W==="at"?new Date(I):null;if(S&&Number.isNaN(S.getTime())){X("Pick a date and time, or make it as of now.");return}if(S&&S.getTime()>Date.now()){X("A branch is made as of now or a moment before it.");return}K(!0);let w=await I1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({ttl:Math.round(Number(M)*3600),...S?{at:{instant:S.toISOString()}}:B?{live:!0}:{},...H.trim()?{label:H.trim()}:{}})}).catch(()=>null);if(K(!1),!w){X(`${P1} did not answer`);return}if(!w.ok){G(w),X(await q0(w));return}let k=await w.json();_8({name:k.name,parent:_,token:k.token??"",readToken:k.readToken,at:(S??new Date).toISOString(),expiresAt:k.expiresAt??null,parentOrigin:P1,...k.origin?{origin:k.origin}:{}}),q(),L(""),V1(`Made ${Z(k.name)}`),U()};return $.jsxDEV(G0,{open:J,onClose:()=>{if(!F)q()},title:`New branch of ${Z(_)}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>q(),disabled:F,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"new-branch",className:"primary",disabled:F,children:F?"Making…":"Make branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"new-branch",onSubmit:(N)=>void f(N),className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Label ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"branchLabel",value:H,onChange:(N)=>L(N.target.value.toLowerCase()),placeholder:"checkout-flow",pattern:"[a-z0-9][a-z0-9\\-]{0,23}",maxLength:24},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("fieldset",{className:"choice",children:[$.jsxDEV("legend",{children:"From"},void 0,!1,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:W==="now",onChange:()=>A("now")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Now: the World as it is"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W==="now"?$.jsxDEV("label",{className:"check sub",children:[$.jsxDEV("input",{type:"checkbox",name:"branchLive",checked:B,onChange:(N)=>T(N.target.checked)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Live: its clock keeps this World's time, as a pull request's preview does (else it stops now)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:W==="at",onChange:()=>A("at")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"An instant before now: the World as it was then, its clock stopped there"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W==="at"?$.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:I,max:n2(new Date().toISOString()),onChange:(N)=>R(N.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"branchLife",value:M,onChange:(N)=>O(N.target.value),children:[$.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"168",children:"7 days"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"alert",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function oZ({name:_,token:Q,canWrite:J,branches:q,opens:U,open:G,onChanged:Z,refused:F,snapshotOf:K}){let Y=N1(Q,`/-/${_}/clock`),X=(O)=>O.split("/").pop()??O,[H,L]=i.useState(!1),W=(O)=>(B)=>{B.preventDefault(),w1([..._.split("/"),"~","branches",...O?O.split("/"):[]])};if(!q)return $.jsxDEV("p",{className:"mode",children:"This host makes no branches of a World."},void 0,!1,void 0,this);let A=q.state==="ok"?q.data.branches:[],I=q.state==="ok"&&(q.data.named?.length??0)>0?q.data.named:[{name:X(_),running:!0}],R=q.state==="ok"?q.data.checkedOut??X(_):X(_),M=async(O)=>{if(!await S0({title:`Remove the branch ${X(O)}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Remove branch",danger:!0}))return;let B=await I1(Q,`/-/${_}/branches/${O}`,{method:"DELETE"}).catch((T)=>T);if(B instanceof Error){V1(`Remove ${X(O)}: the World did not answer (${B.message})`,"error");return}if(!B.ok){F(B),V1(`Remove ${X(O)}: ${await q0(B)}`,"error");return}h4(O),V1(`Removed ${X(O)}`),Z(),w1([..._.split("/"),"~","branches"])};if(G){let O=G.includes("/")?A.find((T)=>T.name===G):void 0,B=G.includes("/")?void 0:I.find((T)=>T.name===G);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${B1}/${_}/~/branches`,onClick:W(),children:"← Branches"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(s1,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"&&!O&&!B?$.jsxDEV("p",{className:"mode",children:["This World has no branch named ",G,"."]},void 0,!0,void 0,this):null,O?$.jsxDEV(nZ,{name:_,b:O,canWrite:J,opens:U(O.name),remove:()=>void M(O.name)},void 0,!1,void 0,this):null,B&&!O?$.jsxDEV(eZ,{name:_,token:Q,b:B,served:B.name===R,canWrite:J,canServe:q.state==="ok"&&Boolean(q.data.canServe)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}return $.jsxDEV("div",{"aria-labelledby":"branches",children:[$.jsxDEV("div",{className:"branches-head",children:[$.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",$.jsxDEV("b",{children:R},void 0,!1,void 0,this),". Each branch's name opens its page."]},void 0,!0,void 0,this),J?$.jsxDEV("div",{className:"head-actions",children:[K?null:$.jsxDEV(tZ,{name:_,token:Q,clock:Y,refused:F},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>L(!0),children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(s1,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:[I.map((O)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:[$.jsxDEV("a",{href:`${B1}/${_}/~/branches/${O.name}`,onClick:W(O.name),children:$.jsxDEV("b",{children:O.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),O.name===R?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):O.running?null:$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge",children:"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this)]},`own:${O.name}`,!0,void 0,this)),A.map((O)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("a",{href:`${B1}/${_}/~/branches/${O.name}`,onClick:W(O.name),children:$.jsxDEV("b",{children:X(O.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:X(O.from??_)},void 0,!1,void 0,this),$.jsxDEV("td",{children:O.at?.instant?$.jsxDEV(f1,{iso:O.at.instant},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV(f1,{iso:O.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:O.expiresAt?$.jsxDEV(f1,{iso:O.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},O.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(o_,{name:_,token:Q,open:H,onClose:()=>L(!1),onMade:Z,refused:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function nZ({name:_,b:Q,canWrite:J,opens:q,remove:U}){let G=(K)=>K.split("/").pop()??K,Z=Q8(Q.name),F=N1(Z,Z?`/-/${Q.name}/diff`:null);return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[t_," ",G(Q.name)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>i_(Q.name,Q.name.split("/")),children:"Open"},void 0,!1,void 0,this):null,J?$.jsxDEV("button",{type:"button",className:"danger-button",onClick:U,children:"Remove…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:Q.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:G(Q.from??_)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.at?.instant?$.jsxDEV(f1,{iso:Q.at.instant},void 0,!1,void 0,this):"live: it keeps its parent's time"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(f1,{iso:Q.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Goes away"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.expiresAt?$.jsxDEV(f1,{iso:Q.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),!q?$.jsxDEV("p",{className:"mode",children:"Its tokens were handed to whoever made it: it opens, and shows its own changes, in their tab."},void 0,!1,void 0,this):null,F.state==="ok"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Its changes"},void 0,!1,void 0,this),F.data.changes.length===0?$.jsxDEV("p",{className:"mode",children:"Nothing written on it since it branched."},void 0,!1,void 0,this):$.jsxDEV(zF,{changes:F.data.changes,idPrefix:`branch-${G(Q.name)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function eZ({name:_,token:Q,b:J,served:q,canWrite:U,canServe:G}){let[Z,F]=i.useState(!1),[K,Y]=i.useState(null),X=async()=>{F(!0),Y(null);let H=await I1(Q,`/-/${_}/branches/${encodeURIComponent(J.name)}/serve`,{method:"POST"}).catch(()=>null);if(H?.ok){location.reload();return}F(!1),Y(H?await q0(H):`${P1} did not answer`)};return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[t_," ",J.name," ",q?$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:U&&G&&!q?$.jsxDEV("button",{type:"button",className:"primary",disabled:Z,onClick:()=>void X(),children:Z?"Switching…":"Serve here"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:J.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Kind"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:"one of this World's own branches"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"State"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:J.running?"running":"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("p",{className:"mode",children:["This is the branch these pages show: its changes are on ",$.jsxDEV("a",{href:`${B1}/${_}/~/changes`,onClick:(H)=>{H.preventDefault(),w1([..._.split("/"),"~","changes"])},children:"Changes"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):G?$.jsxDEV("p",{className:"mode",children:["“Serve here” stops this one's twins and serves ",J.name," in its place."]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode",children:"This host serves one of the World's own branches at a time, and does not switch them from this page."},void 0,!1,void 0,this),K?$.jsxDEV("p",{role:"alert",children:K},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var j_=50,o2=(_)=>`${_.twin}:${_.position}`,n_=(_,Q)=>Date.parse(Q.entry.occurredAt)-Date.parse(_.entry.occurredAt)||_.twin.localeCompare(Q.twin)||Q.position-_.position,D4=(_)=>{if(!_)return"someone";if(_.startsWith("key:")){let[Q,J]=_.slice(4).split(" for:");return J?`${Q}, for ${J}`:Q||"a key"}if(_.startsWith("person:"))return _.slice(7);return _==="machine"?"this machine":_==="person"?"a session with no name":_==="token:read"?"the read-only token":_==="token"?"the World's token":_},D5=(_,Q)=>{let J=typeof Q==="string"?Q:typeof _.caller==="string"?_.caller:"";if(J.startsWith("key:")&&J.length>4)return`by ${D4(J)}`;if(J.startsWith("person:")&&J.length>7)return`by ${J.slice(7)}`;if(J==="machine")return"by this machine";if(J==="person")return"by a session with no name";if(J==="key")return"by a key";if(J==="token:read")return"by the read-only token";if(J==="token")return"by the World's token";return _.actor?.kind==="system"?"by the vendor":_.actor?.id?`by ${_.actor.id}`:"by an app"},e_=(_)=>_.operation??_.op;function _F(_){let Q=_.fields??{},J=Q.usage!==null&&typeof Q.usage==="object"?Q.usage:Q,q=(...Y)=>Y.map((X)=>J[X]??Q[X]).find((X)=>typeof X==="number"),U=[],G=q("prompt_tokens","input_tokens"),Z=q("completion_tokens","output_tokens"),F=q("total_tokens");if(G!==void 0)U.push(["tokens in",G.toLocaleString()]);if(Z!==void 0)U.push(["tokens out",Z.toLocaleString()]);if(F!==void 0)U.push(["tokens in all",F.toLocaleString()]);let K=q("cost_usd","cost");if(K!==void 0)U.push(["cost",`$${K<0.01?K.toPrecision(2):K.toFixed(2)}`]);return U}function _Q({text:_,at:Q=280}){if(_.length<=Q)return $.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this);return $.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:[$.jsxDEV("span",{className:"text",children:[_.slice(0,Q),"…"]},void 0,!0,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:["show all ",_.length.toLocaleString()," characters"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function i0({v:_}){if(typeof _==="string")return $.jsxDEV(_Q,{text:_},void 0,!1,void 0,this);if(_===null||typeof _!=="object")return $.jsxDEV("code",{children:String(_)},void 0,!1,void 0,this);let Q=JSON.stringify(_,null,2);return Q.length<=160?$.jsxDEV("code",{children:JSON.stringify(_)},void 0,!1,void 0,this):$.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:$.jsxDEV("code",{children:[JSON.stringify(_).slice(0,120),"…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("pre",{children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var QF=(_)=>typeof _==="string"?_:Array.isArray(_)?_.map((Q)=>Q&&typeof Q==="object"&&typeof Q.text==="string"?Q.text:"").filter(Boolean).join(`
|
|
36
|
-
`):JSON.stringify(_??"");function JF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return $.jsxDEV(i0,{v:_},void 0,!1,void 0,this);let Q=_,J=Array.isArray(Q.messages)?Q.messages:null,q=Object.entries(Q).filter(([U])=>!(J&&U==="messages"));return $.jsxDEV($.Fragment,{children:[q.length?$.jsxDEV("dl",{className:"fields",children:q.map(([U,G])=>$.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("dt",{children:U},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(i0,{v:G},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},U,!0,void 0,this))},void 0,!1,void 0,this):null,J?$.jsxDEV("ol",{className:"messages",children:J.map((U,G)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:"role",children:typeof U.role==="string"?U.role:"message"},void 0,!1,void 0,this),$.jsxDEV(_Q,{text:QF(U.content)},void 0,!1,void 0,this)]},G,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function QQ({fields:_}){let Q=Object.entries(_??{});if(Q.length===0)return $.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return $.jsxDEV("dl",{className:"fields",children:Q.map(([J,q])=>$.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("dt",{children:J},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(i0,{v:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this))},void 0,!1,void 0,this)}var $F=(_)=>_.receipt?`${_.receipt.status??""}${_.receipt.externalId?` · ${_.receipt.externalId}`:""}${_.receipt.reason?` · ${_.receipt.reason}`:""}`:_.operation==="observed"?"observed from the vendor":_.provenance==="placeholder"?"default data":"none: it has not left this World";function qF(_){let Q=new Map,J=[],q=[],U=new Map;for(let G of _){if(G.entry.landsId||G.entry.aliasOf){q.push(G);continue}let Z={...G,copies:[]};if(J.push(Z),!Q.has(`${G.twin}:${G.entry.id}`))Q.set(`${G.twin}:${G.entry.id}`,Z);if(!U.has(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`))U.set(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`,Z)}for(let G of q){let Z=G.entry.landsId?Q.get(`${G.twin}:${G.entry.landsId}`):G.entry.aliasOf?U.get(`${G.twin}:${G.entry.subject.type}:${G.entry.aliasOf}`):void 0;if(Z)Z.copies.push(G);else J.push({...G,copies:[]})}return J.sort(n_)}var o6={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function V_(_){let Q=[_.entry.receipt,..._.copies.map((U)=>U.entry.receipt)].filter((U)=>Boolean(U?.status));if(Q.length===0)return null;let J=Q.find((U)=>U.status==="failed"||U.status==="refused"),q=[...Q].sort((U,G)=>(o6[G.status]??0)-(o6[U.status]??0))[0];return J&&!(o6[q.status]>=5)?{status:J.status,bad:!0}:{status:q.status,bad:!1}}var T0=1280,v0=820,V4=160,M0=72,UF=72,b1=(_)=>`${_.vendor}:${_.id}`,f2=(_)=>`${_.vendor}:section:${_.section.id}`,S2=(_)=>[_.section.id,..._.section.aka??[]].map((Q)=>`${_.vendor}:section:${Q}`),JQ=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${p0}/${_}/${Q.vendor}${Q.at.screen}`:null,GF=(_,Q)=>_.include?Q.filter((J)=>_.include.includes(b1(J))||S2(J).some((q)=>_.include.includes(q))):Q.filter((J)=>!(_.hidden??[]).includes(b1(J)));function ZF({data:_}){let{frame:Q,url:J,active:q,picked:U,boards:G,addTo:Z,remove:F,compare:K}=_,Y=b1(Q),X=G.filter((H)=>H.include&&!H.include.includes(Y)&&!S2(Q).some((L)=>H.include.includes(L)));return $.jsxDEV($.Fragment,{children:[$.jsxDEV(l6,{isVisible:!0,position:Z1.Top,align:"start",className:"frame-label",children:[$.jsxDEV(D1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q.title},void 0,!1,void 0,this),Q.changes?$.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>K(Y),title:`${y1(Q.changes,"change")} here, not in a changeset: compare before and now`,children:[$.jsxDEV(R1,{name:"square-dot",size:14},void 0,!1,void 0,this),Q.changes]},void 0,!0,void 0,this):U?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>K(Y),title:"Compare with a branch of this World","aria-label":`Compare ${Q.title} with a branch`,children:$.jsxDEV(R1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,U&&X.length?$.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${Q.title} to a board`,onChange:(H)=>{if(H.target.value)Z(H.target.value,Y)},children:[$.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),X.map((H)=>$.jsxDEV("option",{value:H.id,children:H.name},H.id,!1,void 0,this))]},void 0,!0,void 0,this):null,U&&F?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>F.act(Y),title:F.label,"aria-label":F.label,children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame on":U?"frame picked":"frame",style:{width:T0,height:v0},children:[$.jsxDEV("div",{className:"frame-bar",title:"Drag to move · double-click to use",children:[$.jsxDEV(D1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:[W1(Q.vendor)," · ",Q.kind]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"frame-url",children:Q.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),J?$.jsxDEV("a",{className:"nodrag",href:J,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${Q.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame-body nodrag nopan nowheel":"frame-body",children:J?$.jsxDEV("iframe",{title:Q.title,src:J,loading:"lazy",style:{pointerEvents:q?"auto":"none"}},void 0,!1,void 0,this):$.jsxDEV("div",{className:"frame-none",children:[$.jsxDEV("p",{children:$.jsxDEV("strong",{children:Q.unseen==="sites-not-routed"?`This World shows ${Q.title} only at its own local address.`:`${W1(Q.vendor)}'s twin draws no page for this ${Q.kind} yet.`},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:Q.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function FF({data:_}){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(B_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),$.jsxDEV(l6,{isVisible:!0,position:Z1.Top,align:"start",offset:6,className:"section-tag",children:[$.jsxDEV("button",{type:"button",className:_.picked?"nodrag on":"nodrag",onClick:()=>_.pick(_.key),onDoubleClick:()=>{if(_.editable)_.rename(_.key)},title:_.editable?"Double-click to rename":void 0,children:[_.vendor?$.jsxDEV(D1,{vendor:_.vendor},void 0,!1,void 0,this):null,$.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.picked&&_.editable?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>_.remove(_.key),"aria-label":`Remove the section ${_.name}`,title:"Remove the section (its frames stay)",children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function u_({url:_,title:Q}){return $.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*v0/T0},children:$.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:T0,height:v0,transform:`scale(${420/T0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function HF({name:_,token:Q,frame:J,onClose:q,reads:U}){let[G,Z]=i.useState(J.since?"before":""),[F,K]=i.useState({state:"opening"}),[Y,X]=i.useState(null),H=i.useRef(new Set),L=N1(Q,`/-/${_}/branches`,U),W=L.state==="ok"?L.data.branches.filter((O)=>O.name!==Y&&!H.current.has(O.name)):[],A=N1(Q,`/-/${_}/board/changes?frame=${encodeURIComponent(b1(J))}`,U),I=async(O,B,T)=>{let f=J.at;if("site"in f){let S=new URL(J.url),w=B&&/^https?:\/\/\{host\}\./.test(B)?B.replace("{host}",S.hostname.toLowerCase()):null;return w?{url:`${w}${S.pathname}${S.search}`}:{why:"This World shows its branches' sites only on this machine."}}let C=`${p0}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${J.vendor}${f.screen}`}).toString()}`,N=await fetch(C,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(T())return{why:""};return N?.type==="opaqueredirect"?{url:C}:{why:`This World does not show its branches' pages${N?`: ${await q0(N)}`:""}.`}};i.useEffect(()=>{if(!J.at){K({state:"none",why:`${W1(J.vendor)}'s twin draws no page for this ${J.kind} yet; its changes are listed below.`});return}if(G===""){K({state:"none",why:"Choose a branch of this World to set beside it."});return}let O=!1;if(G!=="before"){K({state:"opening"});let S=L.state==="ok"?L.data.branches.find((k)=>k.name===G):void 0,w=setTimeout(()=>void I(G,S?.sites??null,()=>O).then((k)=>{if(!O)K("url"in k?{state:"ok",url:k.url}:{state:"none",why:k.why})}),300);return()=>{O=!0,clearTimeout(w)}}if(!J.since){K({state:"none",why:"Nothing here has changed since the World was last cut."});return}K({state:"opening"});let B=new Date(Date.parse(J.since)-1).toISOString(),T=null,f=setTimeout(()=>void(async()=>{let S=await I1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:B},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!S?.ok){K({state:"none",why:`The World made no copy of itself as it was then${S?`: ${await q0(S)}`:""}.`});return}let w=await S.json();if(T=w.name,X(w.name),H.current.add(w.name),O){I1(Q,`/-/${_}/branches/${w.name}`,{method:"DELETE"}).catch(()=>null);return}let k=await I(w.name,w.sites??null,()=>O);if(!O)K("url"in k?{state:"ok",url:k.url,at:B}:{state:"none",why:k.why})})(),500),C=()=>{if(T)I1(Q,`/-/${_}/branches/${T}`,{method:"DELETE",keepalive:!0}).catch(()=>null);T=null},N=(S)=>{if(!S.persisted)C()};return window.addEventListener("pagehide",N),()=>{O=!0,clearTimeout(f),window.removeEventListener("pagehide",N),C(),X(null)}},[_,Q,J.vendor,J.id,J.since,G]);let R=JQ(_,J),M=!J.at||G!==""?null:L.state==="ok"&&W.length===0?"This World has no branches to set beside it: make one under Branches.":L.state==="error"?`The World's branches could not be read: ${L.error}`:null;return $.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${J.title}`,children:[$.jsxDEV("div",{className:"compare-head",children:[$.jsxDEV(D1,{vendor:J.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:J.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:J.changes?`${y1(J.changes,"change")} not yet cut${J.since?`, since ${P2(J.since)}`:""}`:"No changes here not yet cut"},void 0,!1,void 0,this),J.at?$.jsxDEV("label",{className:"compare-base",children:["Compare with"," ",$.jsxDEV("select",{value:G,onChange:(O)=>Z(O.target.value),children:[G===""?$.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,J.since||G==="before"?$.jsxDEV("option",{value:"before",children:"Before these changes"},void 0,!1,void 0,this):null,G&&G!=="before"&&!W.some((O)=>O.name===G)?$.jsxDEV("option",{value:G,children:G.split("/")[1]},void 0,!1,void 0,this):null,W.map((O)=>$.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${P2(O.at.instant)})`:O.at?.live?" (live)":""]},O.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("button",{type:"button",className:"ghost",onClick:q,"aria-label":"Close the comparison",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"compare-sides",children:[$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:G==="before"?`Before${F.state==="ok"&&F.at?` · as of ${P2(F.at)}`:""}`:G?G.split("/")[1]:"A branch"},void 0,!1,void 0,this),M?$.jsxDEV("p",{className:"mode compare-note",children:M},void 0,!1,void 0,this):F.state==="ok"?$.jsxDEV(u_,{url:F.url,title:`${J.title} before`},void 0,!1,void 0,this):F.state==="opening"?$.jsxDEV("p",{className:"mode compare-note",role:"status",children:"Opening the World as it was…"},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:F.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:"Now"},void 0,!1,void 0,this),R?$.jsxDEV(u_,{url:R,title:`${J.title} now`},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:[W1(J.vendor),"'s twin draws no page for this ",J.kind," yet."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A.state==="error"?$.jsxDEV("p",{role:"alert",className:"mode",children:["Its changes could not be read: ",A.error]},void 0,!0,void 0,this):null,G!=="before"&&G&&A.state==="ok"&&A.data.acts.length?$.jsxDEV("p",{className:"mode compare-acts-head",children:"This World's own changes here, not yet cut:"},void 0,!1,void 0,this):null,$.jsxDEV("ol",{className:"compare-acts",children:(A.state==="ok"?A.data.acts:[]).map((O)=>{let B=O.entries[0],T=L0({...B,service:J.vendor,id:"",occurredAt:O.at});return $.jsxDEV("li",{children:[$.jsxDEV("span",{className:"mode",children:P2(O.at)},void 0,!1,void 0,this),$.jsxDEV("details",{children:[$.jsxDEV("summary",{children:[$.jsxDEV("strong",{children:T.what},void 0,!1,void 0,this),T.label?` · ${T.label}`:"",O.writes>1?$.jsxDEV("span",{className:"mode",children:[" and ",y1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:[O.entries.map((f,C)=>$.jsxDEV("li",{children:[$.jsxDEV("code",{children:f.operation??f.op},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[f.subject.type," ",l0(f)]},void 0,!0,void 0,this)]},C,!0,void 0,this)),O.writes>O.entries.length?$.jsxDEV("li",{className:"mode",children:["and ",y1(O.writes-O.entries.length,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${O.at}:${B.subject.type}:${B.subject.id}`,!0,void 0,this)})},void 0,!1,void 0,this),A.state==="ok"&&A.data.total>A.data.acts.length?$.jsxDEV("p",{className:"mode",children:["and ",y1(A.data.total-A.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,$.jsxDEV("a",{className:"compare-all",href:`${B1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),w1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var KF={screen:ZF,section:FF};function XF(_){return $.jsxDEV(c6,{children:$.jsxDEV(YF,{..._},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function YF({name:_,token:Q,session:J,retry:q,snapshot:U,back:G,canWrite:Z}){let F=i.useRef(null),K=i.useRef(0),Y=i.useRef(Promise.resolve()),X=i.useRef(0),[,H]=i.useState(0),[L,W]=i.useState({state:"loading"}),[A,I]=i.useState(null),[R,M]=i.useState(0),O=i.useRef(0),B=i.useRef(0),T=i.useCallback(async()=>{let c=X.current,z=++O.current,j=await I1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),l=j?.ok?await j.json().catch(()=>null):null;if(z<B.current)return;if(B.current=z,!l?.frames||!l.boards||!l.version){let _1=j?`the World answered ${j.status}`:"the World did not answer";W((n)=>n.state==="ok"?n:{state:"error",status:j?.status??0,error:_1}),I(_1);return}if(I(null),M((_1)=>_1+1),c===X.current&&K.current===0)F.current={boards:l.boards,version:l.version};W({state:"ok",data:l})},[Q,_]);i.useEffect(()=>{T();let c=setInterval(()=>{if(!document.hidden)T()},1e4);return()=>clearInterval(c)},[T]);let f=L.state==="ok"?L.data.frames:[],C=F.current?.boards??[{id:"everything",name:"Everything"}],[N,S]=i.useState("everything"),w=C.find((c)=>c.id===N)??C[0],k=Z&&!U,x=i.useCallback((c)=>{if(!F.current)return V1("The board is being read again: make that change once it shows","error"),Promise.resolve();F.current={...F.current,boards:c(F.current.boards)},K.current+=1,X.current+=1,H((j)=>j+1);let z=Y.current.then(async()=>{let j=F.current;if(!j)return;try{let l=await I1(Q,`/-/${_}/board`,{method:"PUT",body:JSON.stringify({boards:j.boards,version:j.version}),signal:AbortSignal.timeout(15000)}),_1=await l.json().catch(()=>null);if(l.ok&&_1?.boards&&_1.version)F.current={boards:K.current>1&&F.current?F.current.boards:_1.boards,version:_1.version};else if(l.status===409&&_1?.boards&&_1.version)F.current={boards:_1.boards,version:_1.version},V1("Someone else changed the board first: it is shown as they left it","error");else throw Error(_1?.error??`the World answered ${l.status}`)}catch(l){V1(`The board was not kept: ${l instanceof Error?l.message:String(l)}`,"error"),F.current=null;let _1=await I1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),n=_1?.ok?await _1.json().catch(()=>null):null;if(n?.boards&&n.version)F.current={boards:n.boards,version:n.version}}}).finally(()=>{if(K.current-=1,X.current+=1,H((j)=>j+1),K.current===0&&!F.current)T()});return Y.current=z,z},[Q,_,T]),r=(c,z)=>{x((j)=>j.map((l)=>l.id===c?z(l):l))},m=GF(w,f),v=f.filter((c)=>c.changes&&!m.includes(c)).reduce((c,z)=>c+z.changes,0),[D,V]=i.useState(null),[E,u]=i.useState(null),[b,P]=i.useState(null),y=j5(),p=C.filter((c)=>c.include),h=(c,z)=>r(c,(j)=>({...j,include:[...j.include??[],z]})),e={label:w.include?"Take it off this board":"Hide it",act:(c)=>{u(null),r(w.id,(z)=>z.include?{...z,include:z.include.filter((j)=>j!==c)}:{...z,hidden:[...z.hidden??[],c]})}},t=(c)=>({x:c.position.x,y:c.position.y,w:c.width??c.measured?.width??T0,h:c.height??c.measured?.height??v0}),o=(c,z)=>{let j=t(c),l=j.x+j.w/2,_1=j.y+j.h/2;return z.filter((n)=>n.type==="section").map((n,$1)=>({s:n,i:$1})).filter(({s:n})=>{let $1=t(n);return l>=$1.x&&l<=$1.x+$1.w&&_1>=$1.y&&_1<=$1.y+$1.h}).sort((n,$1)=>t(n.s).w*t(n.s).h-t($1.s).w*t($1.s).h||$1.i-n.i)[0]?.s},s=i.useCallback(()=>{let c=new Map;for(let q1 of m){let H1=w.placed?.[b1(q1)];if(H1)c.set(b1(q1),H1)}let z=Math.max(-V4,...[...c.values()].map((q1)=>q1.y+v0)),j=[...new Set(m.map(f2))];for(let q1 of j){let H1=m.filter((u1)=>f2(u1)===q1),L1=H1.filter((u1)=>c.has(b1(u1))).map((u1)=>c.get(b1(u1))),M1=L1.length?Math.max(...L1.map((u1)=>u1.x))+T0+V4:0,E1=L1.length?Math.min(...L1.map((u1)=>u1.y)):z+V4+M0*2+UF;for(let u1 of H1)if(!c.has(b1(u1)))c.set(b1(u1),{x:M1,y:E1}),M1+=T0+V4;z=Math.max(z,E1+v0)}let l=w.sections??{},_1=(q1,H1,L1,M1,E1)=>({id:`sec:${q1}`,type:"section",position:{x:H1.x,y:H1.y},width:H1.w,height:H1.h,zIndex:0,draggable:k,data:{key:q1,name:L1,vendor:M1,named:E1}}),n=[];for(let q1 of j){let H1=m.find((C1)=>f2(C1)===q1),L1=S2(H1).find((C1)=>l[C1])??q1,M1=l[L1];if(M1?.gone)continue;let E1=m.filter((C1)=>f2(C1)===q1).map((C1)=>c.get(b1(C1))),u1={x:Math.min(...E1.map((C1)=>C1.x))-M0,y:Math.min(...E1.map((C1)=>C1.y))-M0,w:0,h:0};u1.w=Math.max(...E1.map((C1)=>C1.x))+T0+M0-u1.x,u1.h=Math.max(...E1.map((C1)=>C1.y))+v0+M0-u1.y;let e2=m.filter((C1)=>f2(C1)===q1&&!w.placed?.[b1(C1)]).map((C1)=>c.get(b1(C1))),j0=M1?{...M1}:u1;if(M1)for(let C1 of e2)j0.w=Math.max(j0.w,C1.x+T0+M0-j0.x),j0.h=Math.max(j0.h,C1.y+v0+M0-j0.y);n.push(_1(L1,j0,M1?.name??`${W1(H1.vendor)} · ${H1.section.title}`,H1.vendor,Boolean(M1?.name)))}for(let[q1,H1]of Object.entries(l))if(q1.startsWith("user:")&&!H1.gone)n.push(_1(q1,H1,H1.name??"Section",null,!0));let $1=m.map((q1)=>({id:b1(q1),type:"screen",zIndex:1,width:T0,height:v0,dragHandle:".frame-bar",draggable:k,position:c.get(b1(q1)),data:{world:_,frame:q1,url:JQ(_,q1)}}));return[...n,...$1]},[JSON.stringify(m),JSON.stringify(w),_,k]),[g,J1,U1]=K_([]),X1=i.useRef("");i.useEffect(()=>{let c=s();if(J1(c),c.length&&X1.current!==w.id)X1.current=w.id,requestAnimationFrame(()=>{y.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[s,J1]);let G1=(c,z=[],j={})=>{let l=Object.fromEntries(z.map((n)=>{let $1=y.getNode(`sec:${n}`);if(!$1)return[n,void 0];let q1=t($1),H1=$1.data,L1=j[n]??(H1.named?H1.name:void 0);return[n,{x:Math.round(q1.x),y:Math.round(q1.y),w:Math.round(q1.w),h:Math.round(q1.h),...L1?{name:L1.slice(0,80)}:{}}]}).filter(([,n])=>n!==void 0)),_1=Object.fromEntries(Object.entries(c).map(([n,$1])=>[n,{x:Math.round($1.x),y:Math.round($1.y)}]));r(w.id,(n)=>({...n,placed:{...n.placed??{},..._1},sections:{...n.sections??{},...l}}))},F1=i.useRef(null),A1=(c,z)=>{if(z.type!=="section"){F1.current=null;return}let j=y.getNodes(),l=t(z),_1=(n)=>{let $1=t(n);if(n.type==="screen"){let q1=$1.x+$1.w/2,H1=$1.y+$1.h/2;return q1>=l.x&&q1<=l.x+l.w&&H1>=l.y&&H1<=l.y+l.h}return n.id!==z.id&&$1.x>=l.x&&$1.y>=l.y&&$1.x+$1.w<=l.x+l.w&&$1.y+$1.h<=l.y+l.h};F1.current={id:z.id,from:{...z.position},members:j.filter(_1).map((n)=>({id:n.id,x:n.position.x,y:n.position.y}))}},Y1=(c,z)=>{let j=F1.current;if(!j||j.id!==z.id)return;let l=z.position.x-j.from.x,_1=z.position.y-j.from.y,n=new Map(j.members.map(($1)=>[$1.id,$1]));J1(($1)=>$1.map((q1)=>{let H1=n.get(q1.id);return H1?{...q1,position:{x:H1.x+l,y:H1.y+_1}}:q1}))},Q1=(c,z)=>{let j=F1.current;F1.current=null;let l=z.position.x-(j?.from.x??z.position.x),_1=z.position.y-(j?.from.y??z.position.y),n=z.type==="screen"?[{id:z.id,x:z.position.x,y:z.position.y}]:(j?.members??[]).map(($1)=>({...$1,x:$1.x+l,y:$1.y+_1}));requestAnimationFrame(()=>{let $1=y.getNodes(),q1=new Map(n.filter((M1)=>!M1.id.startsWith("sec:")).map((M1)=>[M1.id,{x:M1.x,y:M1.y}])),H1=new Set([...z.type==="section"?[z.data.key]:[],...n.filter((M1)=>M1.id.startsWith("sec:")).map((M1)=>M1.id.slice(4))]),L1=new Set($1.filter((M1)=>q1.has(M1.id)).flatMap((M1)=>S2(M1.data.frame)));for(let M1 of $1){if(M1.type==="screen"&&S2(M1.data.frame).some((E1)=>L1.has(E1))&&!q1.has(M1.id))q1.set(M1.id,{x:M1.position.x,y:M1.position.y});if(M1.type==="section"&&L1.has(M1.data.key))H1.add(M1.data.key)}G1(Object.fromEntries(q1),[...H1])})},T1=(c)=>Object.fromEntries(y.getNodes().filter((z)=>z.type==="screen"&&S2(z.data.frame).includes(c)).map((z)=>[z.id,{x:z.position.x,y:z.position.y}])),K1=(c)=>{let j=y.getNode(`sec:${c}`)?.data?.name??"Section",l=window.prompt("Name this section",j)?.trim();if(!l)return;J1((_1)=>_1.map((n)=>n.id===`sec:${c}`?{...n,data:{...n.data,name:l.slice(0,80),named:!0}}:n)),requestAnimationFrame(()=>G1(T1(c),[c],{[c]:l}))},k1=(c)=>{u(null);let z=y.getNode(`sec:${c}`);r(w.id,(j)=>{let l=Object.fromEntries(Object.entries(j.sections??{}).filter(([_1])=>_1!==c));return{...j,sections:c.startsWith("user:")?l:{...l,[c]:{...z?{x:Math.round(z.position.x),y:Math.round(z.position.y),w:Math.round(t(z).w),h:Math.round(t(z).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},p1=()=>{let c=E?y.getNode(E):void 0,z=y.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),j=c?.type==="screen"?{x:c.position.x-M0,y:c.position.y-M0,w:T0+M0*2,h:v0+M0*2}:{x:z.x-900,y:z.y-600,w:1800,h:1200},l=`user:${Date.now().toString(36)}`,_1=Object.keys(w.sections??{}).filter((n)=>n.startsWith("user:")).length+1;u(`sec:${l}`),r(w.id,(n)=>({...n,sections:{...n.sections??{},[l]:{x:Math.round(j.x),y:Math.round(j.y),w:Math.round(j.w),h:Math.round(j.h),name:`Section ${_1}`}}}))},l1=g.map((c)=>c.type==="section"?{...c,data:{...c.data,picked:E===c.id,editable:k,pick:(z)=>u(`sec:${z}`),rename:K1,remove:k1,resized:()=>requestAnimationFrame(()=>{let z=c.data.key;G1(T1(z),[z])})}}:{...c,data:{...c.data,active:D===c.id,picked:E===c.id,boards:k?p:[],addTo:h,remove:!k||w.include&&!w.include.includes(c.id)?null:e,compare:(z)=>{u(z),P(z)}}});i.useEffect(()=>{let c=(z)=>{if(z.target?.closest("input, textarea, select, [contenteditable]"))return;if(z.key==="Escape"){if(D)V(null);else u(null);return}if(!k||D)return;if((z.key==="Delete"||z.key==="Backspace")&&E){if(z.preventDefault(),E.startsWith("sec:"))k1(E.slice(4));else if(!w.include||w.include.includes(E))e.act(E);else V1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(z.key==="S"&&z.shiftKey&&!z.metaKey&&!z.ctrlKey)z.preventDefault(),p1()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)});let z0=(c)=>{u(c);let z=y.getNode(c);if(!z)return;let j=t(z);y.fitBounds({x:j.x,y:j.y,width:j.w,height:j.h},{padding:0.15,duration:400})},Z0=()=>{let c=`board-${Date.now().toString(36)}`;S(c),x((z)=>[...z,{id:c,name:`Board ${z.length}`,include:[]}])},F0=()=>{let c=window.prompt("Name this board",w.name)?.trim();if(c)r(w.id,(z)=>({...z,name:c.slice(0,80)}))},o1=()=>{let c=w.id;S("everything"),x((z)=>z.filter((j)=>j.id!==c))},Q0=[...new Map(f.map((c)=>[f2(c),c])).values()],n1=w.include?[...Q0.filter((c)=>!S2(c).some((z)=>w.include.includes(z))).map((c)=>({key:f2(c),label:`${W1(c.vendor)} · ${c.section.title} (all)`})),...f.filter((c)=>!m.includes(c)).map((c)=>({key:b1(c),label:c.title}))]:[],J0=w.include?[]:f.filter((c)=>!m.includes(c)),r0=g.filter((c)=>c.type==="section"),H0=g.filter((c)=>c.type==="screen"),y0=new Map(H0.map((c)=>[c.id,o(c,g)?.id??null])),k0=(c)=>{let z=c.data.frame;return $.jsxDEV("li",{children:$.jsxDEV("button",{type:"button",className:E===c.id?"on":void 0,onClick:()=>z0(c.id),onDoubleClick:()=>V(c.id),children:[$.jsxDEV(D1,{vendor:z.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:z.title},void 0,!1,void 0,this),z.changes?$.jsxDEV("span",{className:"layer-changed",title:`${y1(z.changes,"change")}, not in a changeset: its mark on the board compares before and now`,children:[$.jsxDEV(R1,{name:"square-dot",size:14},void 0,!1,void 0,this),z.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},c.id,!1,void 0,this)},q2=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,k2=J.state==="ok"&&L.state==="ok";return $.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",children:$.jsxDEV(H_,{nodes:k2?l1:[],onNodesChange:U1,nodeTypes:KF,onNodeDragStart:A1,onNodeDrag:Y1,onNodeDragStop:Q1,onNodeClick:(c,z)=>{if(z.id!==D)u(z.id)},onNodeDoubleClick:(c,z)=>{if(z.type==="screen")u(z.id),V(z.id)},onPaneClick:()=>{V(null),u(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:q2?"dark":"light",proOptions:{hideAttribution:!0},children:[$.jsxDEV(Y_,{variant:N0.Dots,gap:28,size:1.4},void 0,!1,void 0,this),$.jsxDEV(C0,{position:"top-left",className:"float layers",children:[$.jsxDEV("div",{className:"float-head",children:[$.jsxDEV("button",{type:"button",className:"back",onClick:G,"aria-label":`Back to ${_}`,children:"←"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"float-title",children:[$.jsxDEV("strong",{children:_.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[_.split("/")[0],U?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[C.map((c)=>$.jsxDEV("button",{type:"button",role:"tab","aria-selected":c.id===w.id,className:c.id===w.id?"on":void 0,onClick:()=>{u(null),V(null),S(c.id)},onDoubleClick:k&&c.id===w.id&&c.include?F0:void 0,children:c.name},c.id,!1,void 0,this)),k?$.jsxDEV("button",{type:"button",className:"ghost",onClick:Z0,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),w.include&&k?$.jsxDEV("div",{className:"board-acts",children:[$.jsxDEV("button",{type:"button",className:"ghost",onClick:F0,children:"Rename"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"ghost",onClick:o1,children:"Delete board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("ul",{className:"layer-list","aria-label":"Layers",children:[r0.map((c)=>{let z=c.data;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:E===c.id?"layer-section on":"layer-section",onClick:()=>z0(c.id),onDoubleClick:()=>{if(k)K1(z.key)},children:[z.vendor?$.jsxDEV(D1,{vendor:z.vendor},void 0,!1,void 0,this):$.jsxDEV(R1,{name:"layout-grid",size:14},void 0,!1,void 0,this),$.jsxDEV("span",{children:z.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list inner",children:H0.filter((j)=>y0.get(j.id)===c.id).map(k0)},void 0,!1,void 0,this)]},c.id,!0,void 0,this)}),H0.filter((c)=>!y0.get(c.id)).map(k0)]},void 0,!0,void 0,this),w.include&&!m.length?$.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,n1.length&&k?$.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(c)=>{let z=c.target.value;if(z)r(w.id,(j)=>({...j,include:[...j.include??[],z]}))},children:[$.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),n1.map((c)=>$.jsxDEV("option",{value:c.key,children:c.label},c.key,!1,void 0,this))]},void 0,!0,void 0,this):null,J0.length?$.jsxDEV("details",{className:"board-hidden",children:[$.jsxDEV("summary",{children:["Hidden (",J0.length,")"]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list",children:J0.map((c)=>$.jsxDEV("li",{children:k?$.jsxDEV("button",{type:"button",onClick:()=>r(w.id,(z)=>({...z,hidden:(z.hidden??[]).filter((j)=>j!==b1(c))})),children:[$.jsxDEV("span",{children:c.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"pad-s",children:c.title},void 0,!1,void 0,this)},b1(c),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,v?$.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>S("everything"),children:[$.jsxDEV(R1,{name:"square-dot",size:14},void 0,!1,void 0,this),y1(v,"change")," not on this board"]},void 0,!0,void 0,this):null,$.jsxDEV(s1,{load:L,what:"the board"},void 0,!1,void 0,this),A&&L.state==="ok"?$.jsxDEV("p",{role:"alert",className:"pad-s",children:["The board could not be read again (",A,"): it shows what was last read."]},void 0,!0,void 0,this):null,J.state==="pending"?$.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,J.state==="error"?$.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",J.error," ",$.jsxDEV("button",{type:"button",onClick:q,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),D?$.jsxDEV(C0,{position:"top-center",className:"float hint using",children:[$.jsxDEV("span",{className:"mode",children:["Using ",m.find((c)=>b1(c)===D)?.title??D]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>V(null),children:["Done ",$.jsxDEV("kbd",{children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(C0,{position:"top-center",className:"float hint mode",children:"Scroll to pan · pinch or ⌘ scroll to zoom · double-click a frame to use it"},void 0,!1,void 0,this),k?$.jsxDEV(C0,{position:"bottom-center",className:"float board-tools",children:$.jsxDEV("button",{type:"button",className:"ghost",onClick:p1,title:"Section (⇧S): around the selected frame, else in the middle",children:[$.jsxDEV(R1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),$.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,b&&m.some((c)=>b1(c)===b)?$.jsxDEV(C0,{position:"top-right",className:"float compare-panel",children:$.jsxDEV(HF,{name:_,token:Q,frame:m.find((c)=>b1(c)===b),onClose:()=>P(null),reads:R},b,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(z_,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),$.jsxDEV(A_,{pannable:!0,zoomable:!0,nodeBorderRadius:8,position:"bottom-right"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var $Q=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),LF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function x4(_){let Q=_.actions.filter(LF).length,J=_.actions.length-Q,q=_.applied?.receipts??[],U=_.deployed??[],G=new Set([...U.filter((K)=>K.status==="deployed"),...q.filter((K)=>K.status==="confirmed")].map((K)=>K.actionId)).size,Z=new Set([...U.filter((K)=>K.status==="refused"||K.status==="failed"),...q.filter((K)=>K.status==="failed")].map((K)=>K.actionId)).size,F={performed:G,failed:Z,total:J,own:Q};if(J>0&&G>=J)return{label:"Deployed",tone:"done",...F};if(G>0)return{label:`Partly deployed: ${G} of ${J}`,tone:"warn",...F};if(Z>0)return{label:`${Z} refused or failed`,tone:"bad",...F};if(q.some((K)=>K.status==="replayed")&&q.every((K)=>K.status==="replayed"||K.status==="skipped"))return{label:"Pushed",tone:"good",...F};return{label:"Not sent",tone:"plain",...F}}var n6=(_)=>_.message??_.narration?.split(`
|
|
37
|
-
`)[0]?.replace(/ setting .*$/,"")??_.name;function qQ(_,Q=1){let J=_.currentHash??_.contentHash,q=_.readiness?.approvers??new Set(_.approvals.filter((G)=>G.contentHash===J).map((G)=>G.principal)).size,U=_.verification&&_.verification.contentHash===J?_.verification:null;if(U&&!U.passed)return{label:"Checks failed",tone:"bad"};if(q>0&&q<Q)return{label:`Approved by ${q} of ${Q}`,tone:"plain"};if(q>0)return{label:`Approved by ${q}`,tone:"good"};if(U)return{label:"Verified",tone:"good"};return{label:"Not verified",tone:"plain"}}function h_({name:_,token:Q,signsAs:J,c:q,canWrite:U,rooted:G,refused:Z,onChanged:F,part:K,required:Y}){let X=K==="head",H=K==="review",[L,W]=i.useState(null),[A,I]=i.useState(!1),[R,M]=i.useState(""),[O,B]=i.useState(""),[T,f]=i.useState(null),C=N1(Q,`/-/${_}/origin`),N=x4(q),S=qQ(q,Y),w=$Q(q),k=[...new Set(w.map((h)=>h.twin))],x=k.some((h)=>G.includes(h)),r=(h)=>h===(q.currentHash??q.contentHash),m=q.applied?.receipts??[],v=(q.deployed??[]).filter((h)=>h.status!=="landed"),D=m.filter((h)=>h.status==="confirmed").length,V=v.filter((h)=>h.status==="deployed"),E=async(h,e,t,o)=>{W(h),f(null);try{let s=await I1(Q,e,{method:"POST",...t===void 0?{}:{body:JSON.stringify(t)}});if(!s.ok)return Z(s),f({what:h,...x1(await m0(s))}),!1;if(o)V1(o);return F(),!0}catch(s){return f({what:h,text:`the World did not answer (${s instanceof Error?s.message:String(s)})`,acts:[]}),!1}finally{W(null)}},u=()=>{E("Verify",`/-/${_}/changesets/${q.name}/verify`,void 0,"Verified: the checks ran over it")},b=async(h)=>{if(h.preventDefault(),await E("Approve",`/-/${_}/changesets/${q.name}/approve`,{...R.trim()?{note:R.trim()}:{},...J===null&&O.trim()?{as:O.trim()}:{}},"Approved"))I(!1),M("")},P=async()=>{let h=k.filter((e)=>G.includes(e));if(!await S0({title:`Deploy ${q.name} to the real vendors?`,body:$.jsxDEV($.Fragment,{children:["It performs its ",q.actions.length," change",q.actions.length===1?"":"s"," against the real account",h.length===1?"":"s"," behind ",w2(h.map(W1)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:q.name}))return;W("Deploy"),f(null);try{let e=await I1(Q,`/-/${_}/deploy/${q.name}`,{method:"POST",body:JSON.stringify({confirm:q.name})});if(!e.ok){Z(e),f({what:"Deploy",...x1(await m0(e))});return}let t=await I1(Q,`/-/${_}/changesets/${q.name}`),o=t.ok?await t.json():null;if(!o){V1("Deploy: sent; reading its receipts failed","info"),F();return}let s=x4(o);V1(`Deploy: ${s.performed} of ${s.total} change${s.total===1?"":"s"} performed at the vendor${s.failed?`; ${s.failed} refused or failed`:""}`,s.failed?"error":s.performed?"ok":"info"),F()}catch(e){f({what:"Deploy",text:`the World did not answer (${e instanceof Error?e.message:String(e)})`,acts:[]})}finally{W(null)}},y=!U?"This session reads the World; it changes nothing":N.label==="Deployed"?"Already deployed: every change was performed at the vendor":null,p=C.state==="ok"&&C.data.origin?q8(C.data.origin):null;return $.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[X?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"changeset-title",children:[q.message??q.name," ",$.jsxDEV("span",{className:`badge cs-${N.tone}`,children:N.label},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:`badge cs-${S.tone}`,children:S.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:q.name},void 0,!1,void 0,this)," · made ",$.jsxDEV(f1,{iso:q.createdAt},void 0,!1,void 0,this)," · ",q.actions.length," change",q.actions.length===1?"":"s"," at ",w2(k.map(W1))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[$.jsxDEV("button",{type:"button",onClick:u,disabled:Boolean(y)||L!==null,title:y??"Replay it in a throwaway World and run the World's checks",children:L==="Verify"?"Verifying…":"Verify"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:Boolean(y)||L!==null,title:y??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),x?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void P(),disabled:Boolean(y)||L!==null,title:y??"Perform it against the real accounts behind this World",children:L==="Deploy"?"Deploying…":"Deploy…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y&&N.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:[y,"."]},void 0,!0,void 0,this):null,T?$.jsxDEV("div",{role:"alert",className:"refusal",children:[$.jsxDEV("span",{children:[$.jsxDEV("b",{children:T.what},void 0,!1,void 0,this),": ",T.text]},void 0,!0,void 0,this),T.acts.includes("verify")&&U?$.jsxDEV("button",{type:"button",onClick:u,disabled:L!==null,children:"Verify"},void 0,!1,void 0,this):null,T.acts.includes("approve")&&U?$.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:L!==null,children:"Approve…"},void 0,!1,void 0,this):null,$.jsxDEV(m_,{name:_,acts:T.acts},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null,H?$.jsxDEV($.Fragment,{children:[q.narration?$.jsxDEV("p",{className:"narration",children:q.narration},void 0,!1,void 0,this):null,$.jsxDEV("h4",{children:"Where it went"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"block where",children:[N.performed>0?$.jsxDEV("p",{className:"pad",children:[N.performed>=N.total?"Deployed":"Partly deployed",": ",N.performed," of ",N.total," change",N.total===1?"":"s",N.own?` (and ${N.own} of the World's own, which stay in it)`:""," performed at ",w2([...new Set([...V.map((h)=>h.service),...m.filter((h)=>h.status==="confirmed").map((h)=>h.service)].map(W1))]),V.length?` (${V.length} from here`:" (",V.length&&D?", ":"",D?`${D} by the remote`:"",")."]},void 0,!0,void 0,this):N.label==="Pushed"?$.jsxDEV("p",{className:"pad",children:["Pushed to the remote",p?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:p},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,q.applied?$.jsxDEV($.Fragment,{children:[" · ",$.jsxDEV(f1,{iso:q.applied.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,": every change was replayed there. No vendor has performed any of it."]},void 0,!0,void 0,this):N.failed===0?$.jsxDEV("p",{className:"pad",children:["Not sent: it is only in this World.",q.applied?.outcome==="refused"?" A push was refused (below); Push sends it again.":$.jsxDEV($.Fragment,{children:[" Push sends it to the remote World",x?"; Deploy, to the real vendors behind it":"","."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,N.failed>0?$.jsxDEV("p",{className:"pad failed",role:"alert",children:[N.failed," change",N.failed===1?" was":"s were"," refused or failed at the vendor",[...v.filter((h)=>h.reason&&(h.status==="refused"||h.status==="failed")).map((h)=>h.reason),...m.filter((h)=>h.status==="failed"&&h.error).map((h)=>h.error)].slice(0,3).map((h)=>`: ${x1(h).text}`).join(""),"."]},void 0,!0,void 0,this):null,q.applied?.refusal?.length?$.jsxDEV("ul",{className:"checks pad",children:q.applied.refusal.map((h,e)=>$.jsxDEV("li",{className:"mode",children:x1(h).text},e,!1,void 0,this))},void 0,!1,void 0,this):null,v.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the vendor"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:v.map((h)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:h.status==="refused"||h.status==="failed"?"badge cs-bad":h.status==="deployed"?"badge cs-done":"badge",children:h.status},void 0,!1,void 0,this)," ",W1(h.service)," ",h.status==="deployed"?h.url?$.jsxDEV("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",children:h.externalId??h.url},void 0,!1,void 0,this):h.externalId?$.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this):null:null,h.reason?$.jsxDEV("span",{className:"mode",children:[" · ",x1(h.reason).text]},void 0,!0,void 0,this):null," ",$.jsxDEV("span",{className:"mode",children:["· ",$.jsxDEV(f1,{iso:h.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},`v:${h.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,m.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the remote"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:m.map((h)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:h.status==="failed"?"badge cs-bad":h.status==="confirmed"?"badge cs-done":"badge",children:h.status},void 0,!1,void 0,this)," ",W1(h.service)," ",$.jsxDEV("span",{className:"mode",children:h.status==="replayed"?"replayed at the remote World":h.status==="confirmed"?"performed at the vendor by the remote":""},void 0,!1,void 0,this),h.status==="confirmed"&&h.externalId?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,h.error?$.jsxDEV("span",{className:"mode",children:[" · ",x1(h.error).text]},void 0,!0,void 0,this):null]},`r:${h.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),!x&&N.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:["No vendor it changes is connected to its real service here, so it does not deploy from this World. ",$.jsxDEV("a",{href:`${B1}/${_}/~/settings/services`,onClick:(h)=>{h.preventDefault(),w1([..._.split("/"),"~","settings","services"])},children:"Connect a vendor in Settings › Real services"},void 0,!1,void 0,this)," to deploy."]},void 0,!0,void 0,this):null,$.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!q.verification?$.jsxDEV("p",{className:"mode",children:"Not verified yet. Verify replays it in a throwaway World and runs this World's checks over the result."},void 0,!1,void 0,this):$.jsxDEV("div",{className:r(q.verification.contentHash)?"":"stale",children:[$.jsxDEV("p",{children:[q.verification.passed?"✓ Passed":"✗ Failed"," · ",$.jsxDEV(f1,{iso:q.verification.at},void 0,!1,void 0,this),r(q.verification.contentHash)?null:$.jsxDEV("span",{className:"mode",children:" · on an earlier version of it: verify again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.verification.results.length?$.jsxDEV("ul",{className:"checks",children:q.verification.results.map((h)=>$.jsxDEV("li",{children:[h.passed?"✓":"✗"," ",$.jsxDEV("code",{children:h.id},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:W1(h.service)},void 0,!1,void 0,this)]},h.id,!0,void 0,this))},void 0,!1,void 0,this):null,q.verification.refusals?.length?$.jsxDEV("ul",{className:"checks",children:q.verification.refusals.map((h,e)=>$.jsxDEV("li",{children:["✗ ",$.jsxDEV("code",{children:h.check},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[W1(h.service),": ",h.reason]},void 0,!0,void 0,this)]},e,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),q.approvals.length===0?$.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"approvals",children:q.approvals.map((h,e)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:h.principal},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(f1,{iso:h.at},void 0,!1,void 0,this),r(h.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),h.note?$.jsxDEV("div",{className:"mode",children:["“",h.note,"”"]},void 0,!0,void 0,this):null]},e,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(G0,{open:A,onClose:()=>{if(!L)I(!1)},title:`Approve ${q.name}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>I(!1),disabled:L!==null,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"approve-changeset",className:"primary",disabled:L!==null,children:L==="Approve"?"Approving…":"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"approve-changeset",onSubmit:(h)=>void b(h),className:"stack",children:[$.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",J?$.jsxDEV($.Fragment,{children:[", recorded as ",$.jsxDEV("b",{children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,". A later change to it shows your approval as for an earlier version."]},void 0,!0,void 0,this),J===null?$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"approveAs",value:O,onChange:(h)=>B(h.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"This World was opened with its token, which names no person: the approval records the name you give."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Note ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("textarea",{name:"approveNote",value:R,onChange:(h)=>M(h.target.value),rows:3,maxLength:500},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var UQ=(_,Q)=>JSON.stringify(_)===JSON.stringify(Q);function zF({changes:_,idPrefix:Q}){let J=[...new Set(_.map((q)=>q.twin))];return $.jsxDEV($.Fragment,{children:J.map((q)=>{let U=_.filter((Z)=>Z.twin===q).map((Z)=>Z.entry),G=[...new Set(U.map((Z)=>`${Z.subject.type}:${Z.subject.id}`))];return $.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${Q}-${q}`,children:[$.jsxDEV("h3",{id:`${Q}-${q}`,className:"vendor-cell",children:[$.jsxDEV(D1,{vendor:q},void 0,!1,void 0,this),W1(q)," ",$.jsxDEV("span",{className:"mode",children:["· ",y1(G.length,"record"),", ",y1(U.length,"write")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:G.map((Z)=>{let F=U.filter((H)=>`${H.subject.type}:${H.subject.id}`===Z),K=F[F.length-1],Y=L0(K),X={};return $.jsxDEV("li",{className:"record",children:[$.jsxDEV("p",{className:"record-head",children:[$.jsxDEV("span",{className:"kind",children:K.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")},void 0,!1,void 0,this)," ",Y.label?$.jsxDEV("span",{className:"label",children:["“",Y.label,"”"]},void 0,!0,void 0,this):null," ",$.jsxDEV("code",{children:l0(K)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F.map((H)=>{let L=H.fields??{},W=Object.entries(L).filter(([I,R])=>!(I in X)||!UQ(X[I],R)),A=X;return X={...X,...L},$.jsxDEV("div",{className:"write",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"op",children:L0(H).what},void 0,!1,void 0,this)," · ",$.jsxDEV(f1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",D5(H)]},void 0,!0,void 0,this),W.length===0?$.jsxDEV("p",{className:"mode",children:"It set no field to a new value."},void 0,!1,void 0,this):$.jsxDEV("dl",{className:"fields field-diff","aria-label":`Fields ${L0(H).what} set`,children:W.map(([I,R])=>$.jsxDEV(i.default.Fragment,{children:[$.jsxDEV("dt",{children:I},void 0,!1,void 0,this),$.jsxDEV("dd",{children:I in A?$.jsxDEV("span",{className:"changed",children:[$.jsxDEV("del",{children:$.jsxDEV(i0,{v:A[I]},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"arrow","aria-label":"becomes",children:"→"},void 0,!1,void 0,this),$.jsxDEV("ins",{children:$.jsxDEV(i0,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(i0,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},I,!0,void 0,this))},void 0,!1,void 0,this)]},H.id,!0,void 0,this)})]},Z,!0,void 0,this)})},void 0,!1,void 0,this)]},q,!0,void 0,this)})},void 0,!1,void 0,this)}function WF({name:_,token:Q,changes:J,canWrite:q,refused:U,onCut:G,pinned:Z,generated:F,inputRef:K,author:Y}){let[X,H]=i.useState(""),[L,W]=i.useState(!1),[A,I]=i.useState([]),R=(O,B,T)=>{I((f)=>[{ok:O,text:B,at:new Date().toISOString(),n:++x5,...T?.length?{acts:T}:{}},...f].slice(0,4))},M=async(O)=>{O.preventDefault(),W(!0);try{let B=await I1(Q,`/-/${_}/changesets`,{method:"POST",body:JSON.stringify(X.trim()?{message:X.trim()}:{})});if(!B.ok){U(B);let f=x1(await m0(B));R(!1,`Cut a changeset: ${f.text}`,f.acts);return}let T=await B.json();R(!0,`Cut ${T.name??"a changeset"}: ${y1(T.actions?.length??0,"change")}, ready to review in History and push.`),H(""),G()}catch(B){R(!1,`Cut a changeset: the World did not answer (${B instanceof Error?B.message:String(B)})`)}finally{W(!1)}};if(Z){let O=!q?"This session reads the World; it changes nothing":J===0?"Nothing to cut: no change is outside a changeset":null;return $.jsxDEV("div",{className:"ws-cut",children:[$.jsxDEV($2,{log:A,name:_},void 0,!1,void 0,this),$.jsxDEV("form",{onSubmit:(B)=>void M(B),"aria-label":"Cut a changeset",children:[Y?$.jsxDEV("a",{className:"ws-author",href:Y.account,title:`${Y.who}: your account`,onClick:(B)=>{B.preventDefault(),w1(Y.account.slice(B1.length+1).split("/"))},children:Y.face},void 0,!1,void 0,this):null,$.jsxDEV("input",{ref:K,name:"changesetMessage","aria-label":"Summary",value:X,onChange:(B)=>H(B.target.value),placeholder:J===0?"Nothing to cut":F?"Summary (optional)":"Summary (required)",required:!F,maxLength:200,disabled:Boolean(O),title:O??void 0},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(O)||L,title:O??void 0,children:L?"Cutting…":J===0?"Cut a changeset":$.jsxDEV($.Fragment,{children:["Cut ",y1(J,"change"),Y?$.jsxDEV($.Fragment,{children:[" on ",$.jsxDEV("b",{children:Y.branch},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(!q||J===0)return $.jsxDEV($2,{log:A,name:_},void 0,!1,void 0,this);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("form",{className:"block cut pad",onSubmit:(O)=>void M(O),"aria-label":"Cut a changeset",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Cut ",J===1?"this change":`these ${J} changes`," into a changeset: what it does and why"]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"changesetMessage",value:X,onChange:(O)=>H(O.target.value),placeholder:"Welcome email for new sign-ups",required:!0,maxLength:200,disabled:J===0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:L||J===0,children:L?"Cutting…":"Cut a changeset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV($2,{log:A,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AF({name:_,token:Q}){let[J,q]=i.useState(0),U=N1(Q,`/-/${_}/keys`,J),[G,Z]=i.useState(!1),[F,K]=i.useState(""),[Y,X]=i.useState("write"),[H,L]=i.useState(!1),[W,A]=i.useState(null),[I,R]=i.useState(null),[M,O]=i.useState(null),B=async()=>{let C=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,N=await I1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:C,scope:"read"})}).catch(()=>null),S=N?await N.json().catch(()=>({})):{error:`${P1} did not answer`};if(!N?.ok||!S.key){V1(S.error?x1(S.error).text:"refused","error");return}O(`${window.location.origin}${B1}/${_}#${new URLSearchParams({token:S.key}).toString()}`),q((w)=>w+1)},T=async(C)=>{C.preventDefault(),L(!0),A(null);let N=await I1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:F.trim(),scope:Y})}).catch(()=>null);L(!1);let S=N?await N.json().catch(()=>({})):{error:`${P1} did not answer`};if(!N?.ok||!S.key){A(S.error?x1(S.error).text:"refused");return}Z(!1),R({key:S.key,name:F.trim()}),K(""),q((w)=>w+1)},f=async(C)=>{if(!await S0({title:`Revoke ${C.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let N=await I1(Q,`/-/${_}/keys/${C.id}`,{method:"DELETE"});if(N.ok)V1(`Revoked ${C.name}`);else V1(await q0(N),"error");q((S)=>S+1)};return $.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[$.jsxDEV("div",{className:"keys-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"What an app, a script or a CI job holds to reach this World: each named for what holds it and revoked alone. People open the World as themselves; keys are for software."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t1()?$.jsxDEV("a",{className:"button primary",href:`${t1()}/${encodeURIComponent(_.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):$.jsxDEV("div",{className:"head-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>void B(),children:"Share a read-only link"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{A(null),Z(!0)},children:"Make a key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(s1,{load:U,what:"the keys",retry:()=>q((C)=>C+1)},void 0,!1,void 0,this),U.state==="ok"?U.data.keys.length===0?$.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"For"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:U.data.keys.map((C)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.person??$.jsxDEV("span",{className:"mode",title:"It acts as itself: a service",children:"no one: a service"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:$.jsxDEV("span",{title:P2(C.createdAt),children:d6(C.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:C.lastUsedAt?d6(C.lastUsedAt):"never"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:$.jsxDEV(f_,{label:`More for ${C.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void f(C)}]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},C.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(G0,{open:G,onClose:()=>{if(!H)Z(!1)},title:"Make a key",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>Z(!1),disabled:H,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"make-key",disabled:H||!F.trim(),children:H?"Making…":"Make key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"make-key",onSubmit:T,"aria-label":"Make a key",children:[$.jsxDEV("label",{children:["Name ",$.jsxDEV("input",{autoFocus:!0,name:"keyName",value:F,onChange:(C)=>K(C.target.value),placeholder:"ci, staging app…",maxLength:80,required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:["Access ",$.jsxDEV("select",{value:Y,onChange:(C)=>X(C.target.value==="read"?"read":"write"),children:[$.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"read",children:"Read only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W?$.jsxDEV("p",{role:"alert",children:W},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(G0,{open:Boolean(I),onClose:()=>R(null),title:`${I?.name??"The key"} is ready`,footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>R(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Copy it now: it is shown this once. Put it where the app reads its secrets."},void 0,!1,void 0,this),I?$.jsxDEV(s6,{label:"Key",value:I.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(G0,{open:Boolean(M),onClose:()=>O(null),title:"A read-only link",footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>O(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Whoever opens it sees this World's pages and changes nothing. Copy it now: it is shown this once. It is listed under Keys, where revoking it closes the link at once."},void 0,!1,void 0,this),M?$.jsxDEV(s6,{label:"Link",value:M,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var x5=0;function $2({log:_,name:Q}){if(_.length===0)return null;return $.jsxDEV("ul",{className:"narration-log",role:"status","aria-live":"polite",children:_.map((J)=>$.jsxDEV("li",{className:J.ok?"ok":"bad",children:[$.jsxDEV("span",{className:"mode",children:$.jsxDEV(f1,{iso:J.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",J.text,J.acts?$.jsxDEV(m_,{name:Q,acts:J.acts},void 0,!1,void 0,this):null]},J.n,!0,void 0,this))},void 0,!1,void 0,this)}function GQ(_,Q,J,q){let[U,G]=i.useState(0),Z=U*1e5+Math.floor(J/2),F=N1(Q,`/-/${_}/origin`,Z),K=N1(Q,`/-/${_}/diff`,Z),Y=N1(Q,`/-/${_}/changesets`,Z),[X,H]=i.useState([]),[L,W]=i.useState(null),A=(f,C,N)=>{if(H((S)=>[{ok:f,text:C,at:new Date().toISOString(),n:++x5,...N?.length?{acts:N}:{}},...S].slice(0,8)),!f)V1(C,"error")},I=async(f,C,N)=>{W(f);try{let S=await I1(Q,`/-/${_}/${C}`,N);if(!S.ok){q(S);let w=x1(await m0(S));return A(!1,`${f}: ${w.text}`,w.acts),null}return await S.json()}catch(S){return A(!1,`${f}: the World did not answer (${S instanceof Error?S.message:String(S)})`),null}finally{W(null),G((S)=>S+1)}},R=F.state==="ok"&&F.data.origin?q8(F.data.origin):null,M=K.state==="ok"?K.data.changes.length:null,O=Y.state==="ok"&&R?dZ(Y.data.changesets.filter((f)=>!f.pushedBy)).sort((f,C)=>f.createdAt.localeCompare(C.createdAt)):[];return{origin:F,diff:K,sets:Y,there:R,changes:M,waiting:O,log:X,busy:L,say:A,send:I,push:async()=>{let f=await I("Push","origin/push",{method:"POST"});if(!f)return;if(f.pushed.length===0){A(!0,"Nothing to push: every changeset is already at the remote.");return}for(let C of f.pushed){let N=C.receipts??[],S=N.filter((m)=>m.status==="replayed").length,w=N.filter((m)=>m.status==="confirmed").length,k=N.filter((m)=>m.status==="failed").length,x=C.outcome==="applied"&&k===0;if(C.outcome==="refused"){A(!1,`Push of ${C.changeset} was refused${C.refusal?.length?`: ${C.refusal.map((m)=>x1(m).text).join("; ")}`:""}.`);continue}let r=[`${S} of ${y1(N.length,"change")} replayed there`,...w?[`${w} performed at the vendor by the remote`]:[],...k?[`${k} failed`]:[]];A(x,`${C.outcome==="partial"?"Partly pushed":"Pushed"} ${C.changeset} to ${R??"the remote"}: ${r.join("; ")}${C.refusal?.length?` (${C.refusal.map((m)=>x1(m).text).join("; ")})`:""}.`)}},pull:async()=>{let f=await I("Pull","origin/pull",{method:"POST"});if(!f)return;let C=Object.entries(f.appended).filter(([,S])=>S>0),N=f.rebased.flatMap((S)=>S.conflicts.map((w)=>`${W1(S.twin)} ${w.subject.type}:${w.subject.id} ${w.field}`));A(N.length===0,`Pulled from ${R??"the remote"}: ${C.length?C.map(([S,w])=>`${y1(w,"entry")} at ${W1(S)}`).join(", "):"nothing new"}${N.length?`; conflicts at ${N.join(", ")}`:""}.`)}}}function BF({name:_,token:Q,canWrite:J,tick:q,refused:U}){let{origin:G,there:Z,changes:F,log:K,busy:Y,say:X,send:H,push:L,pull:W}=GQ(_,Q,q,U),[A,I]=i.useState(""),[R,M]=i.useState(""),[O,B]=i.useState(!1),T=async(C)=>{C.preventDefault();let N=await H("Name the remote","origin",{method:"PUT",body:JSON.stringify({url:A.trim(),token:R.trim()})});if(N){let S=Object.values(N.appended??{}).reduce((w,k)=>w+k,0);X(!0,`The remote is ${q8(N.origin)}: its history came in (${y1(S,"entry")}).`),M(""),B(!1)}},f=!J?"This session reads the World; it changes nothing":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"block remote",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{children:"Origin"},void 0,!1,void 0,this),J?$.jsxDEV("button",{type:"button",onClick:()=>{I(Z??""),B(!O)},"aria-expanded":O,children:Z?"Change the remote…":"Name a remote…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"pad",children:[G.state==="ok"?Z?$.jsxDEV("p",{children:[$.jsxDEV("code",{className:"big",children:Z},void 0,!1,void 0,this),G.data.origin?.fetchedAt?$.jsxDEV("span",{className:"mode",children:[" · last fetched ",$.jsxDEV(f1,{iso:G.data.origin.fetchedAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("p",{children:"No remote — this World keeps its default data. Name one to push its changesets to a shared World and pull what others pushed there."},void 0,!1,void 0,this):$.jsxDEV(s1,{load:G,what:"the remote",lines:1},void 0,!1,void 0,this),O?$.jsxDEV("form",{className:"stack origin-form",onSubmit:(C)=>void T(C),"aria-label":"Name the remote",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The World's address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originUrl",value:A,onChange:(C)=>I(C.target.value),placeholder:"https://worlds.example.com/acme/team",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"A key or token that opens it"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originToken",type:"password",value:R,onChange:(C)=>M(C.target.value),required:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Naming it brings its history in. Your pushes are recorded there as whoever this key was made for, or as the key itself."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Y!==null,children:Y==="Name the remote"?"Bringing its history in…":"Save the remote"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>B(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV($2,{log:K,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MF({name:_,token:Q,canWrite:J,refused:q}){let[U,G]=i.useState(0),Z=N1(Q,`/-/${_}/twins`,U),F=N1(Q,`/-/${_}/links`,U),K=N1(Q,`/-/${_}/requests?hours=24`,U),[Y,X]=i.useState({}),[H,L]=i.useState(null),[W,A]=i.useState(""),[I,R]=i.useState(!1),[M,O]=i.useState([]),B=(w,k,x)=>{if(O((r)=>[{ok:w,text:k,at:new Date().toISOString(),n:++x5,...x?.length?{acts:x}:{}},...r].slice(0,6)),!w)V1(k,"error")},T=F.state==="ok"?Object.keys(F.data.links).sort():[];i.useEffect(()=>{let w=!0;return Promise.all(T.map(async(k)=>{let x=await I1(Q,`/-/${_}/twins/${k}/credential`).catch(()=>null),r=x?.ok?await x.json():null;return[k,r?.credential??null]})).then((k)=>{if(w)X(Object.fromEntries(k))}),()=>{w=!1}},[_,Q,T.join(","),U]);let f=async(w)=>{if(w.preventDefault(),!H||!W)return;R(!0);let k=await I1(Q,`/-/${_}/twins/${H.vendor}/credential`,{method:"PUT",body:W,headers:{"content-type":"text/plain"}}).catch(()=>null);if(R(!1),!k){B(!1,`Seal ${H.vendor}: ${P1} did not answer`);return}if(!k.ok){q(k);let r=x1(await m0(k));B(!1,`Seal ${W1(H.vendor)}: ${r.text}`,r.acts);return}let x=await k.json().catch(()=>({}));B(!0,`Sealed a credential for ${W1(H.vendor)}${x.fingerprint?` (${x.fingerprint})`:""}: it opens for ${x.boundTo??H.to} only, and is never shown again.`),A(""),L(null),G((r)=>r+1)},C=async(w)=>{if(!await S0({title:`Remove the link ${w}?`,body:`Requests to ${p0}/${_}/${w}/… stop being forwarded to ${F.state==="ok"?F.data.links[w]?.origin:"its origin"}.`,action:"Remove link",danger:!0}))return;let k=await I1(Q,`/-/${_}/links/${w}`,{method:"DELETE"}).catch(()=>null);if(!k?.ok){if(k)q(k);B(!1,`Remove ${w}: ${k?await q0(k):"the World did not answer"}`);return}B(!0,`Removed the link ${w}.`),G((x)=>x+1)},N=(w)=>w?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge rooted",children:"sealed"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[w.fingerprint?$.jsxDEV("code",{children:w.fingerprint},void 0,!1,void 0,this):null," · ",$.jsxDEV(f1,{iso:w.placedAt},void 0,!1,void 0,this),w.sealedBy?` · by ${w.sealedBy==="vault"?"the vault":"the host's key"}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this),S=Z.state==="ok"?Z.data.twins:[];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"lede",children:"A real vendor's credential lives in one place, sealed: beside this World, bound to where it goes. It is never readable back; this page says only that one is sealed, when, by what, and for where."},void 0,!1,void 0,this),$.jsxDEV($2,{log:M,name:_},void 0,!1,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"creds-head",children:[$.jsxDEV("div",{className:"block-head",children:$.jsxDEV("h3",{id:"creds-head",children:"Vendors"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(s1,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"?$.jsxDEV("table",{className:"dense","aria-label":"Credentials by vendor",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Bound to"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:S.map((w)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(D1,{vendor:w.twin},void 0,!1,void 0,this),W1(w.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N(w.credential)},void 0,!1,void 0,this),$.jsxDEV("td",{children:w.credential?.boundTo?$.jsxDEV("code",{children:w.credential.boundTo},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:w.root?.url?$.jsxDEV("code",{children:w.root.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"none: a stand-in"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?$.jsxDEV("td",{className:"num",children:$.jsxDEV("button",{type:"button",disabled:!w.root?.url,title:w.root?.url?`Seal ${W1(w.twin)}'s real credential for ${w.root.url}`:"Connect it to its real service first (Settings › Real services): a credential is sealed for where it goes",onClick:()=>{A(""),L({vendor:w.twin,to:w.root.url})},children:w.credential?"Replace…":"Seal a credential…"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},w.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z.state==="ok"&&S.every((w)=>!w.root?.url)?$.jsxDEV("p",{className:"mode pad",children:"No vendor here has a real service behind it, so none holds a credential. Connect one in Settings › Real services; its credential is sealed here."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"links-head",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{id:"links-head",children:"Links"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"a vendor with no twin, forwarded with its sealed credential"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(s1,{load:F,what:"the links"},void 0,!1,void 0,this),K.state==="ok"&&(K.data.journalFailures??0)>0?$.jsxDEV("p",{className:"mode pad",role:"alert",children:[K.data.journalFailures," request ",K.data.journalFailures===1?"line was":"lines were"," not kept by this World's server since it started (its links, and the twins it runs in its own process): those requests are missing from what this page counts."]},void 0,!0,void 0,this):null,F.state==="ok"&&T.length===0?$.jsxDEV("p",{className:"mode pad",children:["No links. A link forwards requests for a vendor with no twin here, at ",$.jsxDEV("code",{children:[p0,"/",_,"/<link>/…"]},void 0,!0,void 0,this),", to that vendor's real API with the credential sealed for it."]},void 0,!0,void 0,this):null,T.length?$.jsxDEV("table",{className:"dense","aria-label":"Links",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Link"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Origin"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:"Requests, 24h"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:T.map((w)=>{let k=F.state==="ok"?F.data.links[w].origin:"",x=K.state==="ok"?K.data.twins.find((r)=>r.twin===w):void 0;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("b",{children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("code",{children:k},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:x?$.jsxDEV("span",{title:Object.entries(x.byStatus).map(([r,m])=>`${r}: ${m}`).join(" · "),children:x.requests},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:[N(Y[w]??null),Y[w]?.boundTo?$.jsxDEV("div",{className:"mode",children:["bound to ",$.jsxDEV("code",{children:Y[w].boundTo},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{A(""),L({vendor:w,to:k})},children:Y[w]?"Replace…":"Seal a credential…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void C(w),children:"Remove…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},w,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(G0,{open:Boolean(H),onClose:()=>{if(!I)L(null)},title:`Seal ${H?W1(H.vendor):""}'s credential`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>L(null),disabled:I,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"seal-credential",className:"primary",disabled:I||!W,children:I?"Sealing…":"Seal it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"seal-credential",className:"stack",onSubmit:(w)=>void f(w),children:[$.jsxDEV("p",{className:"mode",children:["It is sealed for ",$.jsxDEV("code",{children:H?.to},void 0,!1,void 0,this)," and opens there only. It is never shown again, here or anywhere."]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real key"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"credential",type:"password",value:W,onChange:(w)=>A(w.target.value),autoComplete:"off",required:!0,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TF({name:_,token:Q,admin:J,canWrite:q,refused:U,onRemoved:G,only:Z}){let F=(u)=>!Z||Z===u,[K,Y]=i.useState(0),X=N1(Q,`/-/${_}/twins`,K),H=N1(Q,`/-/${_}/checks`,K),[L,W]=i.useState(0),A=N1(Q,`/-/${_}/clock`,L),[I,R]=i.useState([]),[M,O]=i.useState(null),[B,T]=i.useState(null),[f,C]=i.useState(""),[N,S]=i.useState("gated"),[w,k]=i.useState(!1),x=(u,b,P)=>{if(R((y)=>[{ok:u,text:b,at:new Date().toISOString(),n:++x5,...P?.length?{acts:P}:{}},...y].slice(0,6)),!u)V1(b,"error")},r=async(u,b,P)=>{let y=await I1(Q,b,P).catch(()=>null);if(!y)return x(!1,`${u}: the World did not answer`),!1;if(!y.ok){U(y);let p=x1(await m0(y));return x(!1,`${u}: ${p.text}`,p.acts),!1}return x(!0,`${u}: done.`),Y((p)=>p+1),!0},m=async(u)=>{if(u.preventDefault(),!B)return;k(!0);let b=B.root??{},P=await r(f.trim()?`Connect ${W1(B.twin)} to ${f.trim()}`:`Disconnect ${W1(B.twin)}`,`/-/${_}/twins/${B.twin}/root`,{method:"PUT",body:JSON.stringify(f.trim()?{...b,url:f.trim(),deploy:N}:null)});if(k(!1),P)T(null)},v=async()=>{if(!await S0({title:`Rotate the tokens of ${_}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let u=await I1(J,`/-/worlds/${_}/rotate`,{method:"POST"});if(u.ok)O(await u.json()),x(!0,"Rotated: the new tokens are shown once, below.");else x(!1,`Rotate: ${await q0(u)}`)},D=async()=>{if(!await S0({title:`Remove ${_}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:_}))return;let u=await I1(J,`/-/worlds/${_}`,{method:"DELETE"}).catch((b)=>b);if(u instanceof Error){x(!1,`Remove: the host did not answer (${u.message})`);return}if(u.ok)G();else x(!1,`Remove: ${await q0(u)}`)},V=X.state==="ok"?X.data.twins:[],E={gated:"gated: a person deploys an approved changeset",auto:"auto: a push deploys at once",hold:"hold: nothing deploys"};return $.jsxDEV($.Fragment,{children:[$.jsxDEV($2,{log:I,name:_},void 0,!1,void 0,this),F("access")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Access"},void 0,!1,void 0,this),q?$.jsxDEV(AF,{name:_,token:Q},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"This session reads the World: its keys are managed by whoever holds its token."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("services")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Real services"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:[V.some((u)=>u.root?.url)?null:"Every vendor here is a stand-in. ","Connect a vendor to its real service to read the real state into this World; its real credential is sealed in the Vault, and an approved changeset deploys there by its policy."]},void 0,!0,void 0,this),$.jsxDEV(s1,{load:X,what:"the vendors"},void 0,!1,void 0,this),X.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Real services",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last read from it"},void 0,!1,void 0,this),q?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:V.map((u)=>{let b=u.root;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(D1,{vendor:u.twin},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${B1}/${_}/${u.twin}`,title:`Its log and stored state · ${u.position??0} entries`,onClick:(P)=>{P.preventDefault(),w1([..._.split("/"),u.twin])},children:W1(u.twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:b?.url?$.jsxDEV("code",{children:b.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:b?.url?E[b.deploy??""]??b.deploy??"—":"—"},void 0,!1,void 0,this),$.jsxDEV("td",{children:u.refresh?.failed?$.jsxDEV("span",{role:"alert",children:["failed ×",u.refresh.failed.count??1,": ",u.refresh.failed.reason??""]},void 0,!0,void 0,this):b?.url?P2(u.refresh?.observedAt??u.refresh?.at):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{C(b?.url??""),S(b?.deploy==="auto"||b?.deploy==="hold"?b.deploy:"gated"),T(u)},children:b?.url?"Change…":"Connect…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",disabled:!b?.url,title:b?.url?"Read the real service's current state into this World":"Connect it first",onClick:()=>void S0({title:`Read ${W1(u.twin)} now?`,body:`The real ${W1(u.twin)}'s current state is read into this World. Nothing is written to ${W1(u.twin)}.`,action:"Read from it"}).then((P)=>{if(P)r(`Read from ${W1(u.twin)}`,`/-/${_}/twins/${u.twin}/refresh`,{method:"POST"})}),children:"Read from it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},u.twin,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,F("clock")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Clock"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"The instant every vendor here stamps from. Set it and move it forward to see what happens later: renewals, expiries, scheduled sends."},void 0,!1,void 0,this),$.jsxDEV(sZ,{name:_,token:Q,clock:A,canWrite:q,onChanged:()=>W((u)=>u+1),refused:U,open:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("checks")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Checks"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"JavaScript the World runs over every change before it is performed (a changeset's Verify runs them too)."},void 0,!1,void 0,this),$.jsxDEV(s1,{load:H,what:"the checks"},void 0,!1,void 0,this),H.state==="ok"?H.data.checks.length===0?$.jsxDEV("p",{className:"mode",children:"No checks: every change is performed as it comes."},void 0,!1,void 0,this):$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Checks",children:$.jsxDEV("tbody",{children:H.data.checks.map((u)=>$.jsxDEV("tr",{children:$.jsxDEV("td",{children:$.jsxDEV("code",{children:u},void 0,!1,void 0,this)},void 0,!1,void 0,this)},u,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,J&&!Z?$.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[$.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),M?$.jsxDEV("p",{role:"status",children:["token ",$.jsxDEV("code",{children:M.token},void 0,!1,void 0,this)," · read token ",$.jsxDEV("code",{children:M.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void v(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"New tokens for this World; every app, script and browser using the old ones is signed out."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void D(),children:"Remove world"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"Deletes this World and everything in it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(G0,{open:Boolean(B),onClose:()=>{if(!w)T(null)},title:`Connect ${B?W1(B.twin):""} to its real service`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>T(null),disabled:w,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"connect-root",className:"primary",disabled:w,children:w?"Saving…":f.trim()?"Connect":"Disconnect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"connect-root",className:"stack",onSubmit:(u)=>void m(u),children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real service's API address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"rootUrl",value:f,onChange:(u)=>C(u.target.value),placeholder:"https://api.openai.com",autoFocus:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Empty disconnects it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"rootDeploy",value:N,onChange:(u)=>S(u.target.value==="auto"?"auto":u.target.value==="hold"?"hold":"gated"),children:["gated","auto","hold"].map((u)=>$.jsxDEV("option",{value:u,children:E[u]},u,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _M(){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(jZ,{},void 0,!1,void 0,this),$.jsxDEV(w_,{},void 0,!1,void 0,this),$.jsxDEV(P_,{},void 0,!1,void 0,this),$.jsxDEV(I_,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{eB as openAt,b5 as ROOT,_M as ConsolePage};
|
|
33
|
+
`)),K=Y.reduce((H,L)=>H.concat(...L),[]);return[Y,K]}return[[],[]]},[_]);return d.useEffect(()=>{let X=Q?.target??R9,Y=Q?.actInsideInputWithModifier??!0;if(_!==null){let K=(z)=>{if(U.current=z.ctrlKey||z.metaKey||z.shiftKey||z.altKey,(!U.current||U.current&&!Y)&&m6(z))return!1;let w=I9(z.code,F);if(G.current.add(z[w]),O9(Z,G.current,!1)){let R=z.composedPath?.()?.[0]||z.target,A=R?.nodeName==="BUTTON"||R?.nodeName==="A";if(Q.preventDefault!==!1&&(U.current||!A))z.preventDefault();q(!0)}},H=(z)=>{let W=I9(z.code,F);if(O9(Z,G.current,!0))q(!1),G.current.clear();else G.current.delete(z[W]);if(z.key==="Meta")G.current.clear();U.current=!1},L=()=>{G.current.clear(),q(!1)};return X?.addEventListener("keydown",K),X?.addEventListener("keyup",H),window.addEventListener("blur",L),window.addEventListener("contextmenu",L),()=>{X?.removeEventListener("keydown",K),X?.removeEventListener("keyup",H),window.removeEventListener("blur",L),window.removeEventListener("contextmenu",L)}}},[_,q]),J}function O9(_,Q,J){return _.filter((q)=>J||q.length===Q.size).some((q)=>q.every((U)=>Q.has(U)))}function I9(_,Q){return Q.includes(_)?"code":"key"}var OU=()=>{let _=b1();return d.useMemo(()=>{return{zoomIn:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(1.2,Q):!1},zoomOut:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(0.8333333333333334,Q):!1},zoomTo:async(Q,J)=>{let{panZoom:q}=_.getState();return q?q.scaleTo(Q,J):!1},getZoom:()=>_.getState().transform[2],setViewport:async(Q,J)=>{let{transform:[q,U,G],panZoom:Z}=_.getState();if(!Z)return!1;return await Z.setViewport({x:Q.x??q,y:Q.y??U,zoom:Q.zoom??G},J),!0},getViewport:()=>{let[Q,J,q]=_.getState().transform;return{x:Q,y:J,zoom:q}},setCenter:async(Q,J,q)=>{return _.getState().setCenter(Q,J,q)},fitBounds:async(Q,J)=>{let{width:q,height:U,minZoom:G,maxZoom:Z,panZoom:F}=_.getState(),X=m5(Q,q,U,G,Z,J?.padding??0.1);if(!F)return!1;return await F.setViewport(X,{duration:J?.duration,ease:J?.ease,interpolate:J?.interpolate}),!0},screenToFlowPosition:(Q,J={})=>{let{transform:q,snapGrid:U,snapToGrid:G,domNode:Z}=_.getState();if(!Z)return Q;let{x:F,y:X}=Z.getBoundingClientRect(),Y={x:Q.x-F,y:Q.y-X},K=J.snapGrid??U,H=J.snapToGrid??G;return q5(Y,q,H,K)},flowToScreenPosition:(Q)=>{let{transform:J,domNode:q}=_.getState();if(!q)return Q;let{x:U,y:G}=q.getBoundingClientRect(),Z=k2(Q,J);return{x:Z.x+U,y:Z.y+G}}}},[])};function d9(_,Q){let J=[],q=new Map,U=[];for(let G of _)if(G.type==="add"){U.push(G);continue}else if(G.type==="remove"||G.type==="replace")q.set(G.id,[G]);else{let Z=q.get(G.id);if(Z)Z.push(G);else q.set(G.id,[G])}for(let G of Q){let Z=q.get(G.id);if(!Z){J.push(G);continue}if(Z[0].type==="remove")continue;if(Z[0].type==="replace"){J.push({...Z[0].item});continue}let F={...G};for(let X of Z)IU(X,F);J.push(F)}if(U.length)U.forEach((G)=>{if(G.index!==void 0)J.splice(G.index,0,{...G.item});else J.push({...G.item})});return J}function IU(_,Q){switch(_.type){case"select":{Q.selected=_.selected;break}case"position":{if(typeof _.position<"u")Q.position=_.position;if(typeof _.dragging<"u")Q.dragging=_.dragging;break}case"dimensions":{if(typeof _.dimensions<"u"){if(Q.measured={..._.dimensions},_.setAttributes){if(_.setAttributes===!0||_.setAttributes==="width")Q.width=_.dimensions.width;if(_.setAttributes===!0||_.setAttributes==="height")Q.height=_.dimensions.height}}if(typeof _.resizing==="boolean")Q.resizing=_.resizing;break}}}function a9(_,Q){return d9(_,Q)}function wU(_,Q){return d9(_,Q)}function V2(_,Q){return{id:_,type:"select",selected:Q}}function G5(_,Q=new Set,J=!1){let q=[];for(let[U,G]of _){let Z=Q.has(U);if(!(G.selected===void 0&&!Z)&&G.selected!==Z){if(J)G.selected=Z;q.push(V2(G.id,Z))}}return q}function w9({items:_=[],lookup:Q}){let J=[],q=new Map(_.map((U)=>[U.id,U]));for(let[U,G]of _.entries()){let Z=Q.get(G.id),F=Z?.internals?.userNode??Z;if(F!==void 0&&F!==G)J.push({id:G.id,item:G,type:"replace"});if(F===void 0)J.push({item:G,type:"add",index:U})}for(let[U]of Q)if(q.get(U)===void 0)J.push({id:U,type:"remove"});return J}function P9(_){return{id:_.id,type:"remove"}}var PU=u6("React Flow","https://reactflow.dev/");function NU(_,Q,J={}){return h7(_,Q,{...J,onError:J.onError??PU})}var N9=(_)=>P7(_),fU=(_)=>S6(_);function s9(_){return d.forwardRef(_)}var t9=typeof window<"u"?d.useLayoutEffect:d.useEffect;function f9(_){let[Q,J]=d.useState(BigInt(0)),[q]=d.useState(()=>CU(()=>J((U)=>U+BigInt(1))));return t9(()=>{let U=q.get();if(U.length)_(U),q.reset()},[Q]),q}function CU(_){let Q=[];return{get:()=>Q,reset:()=>{Q=[]},push:(J)=>{Q.push(J),_()}}}var o9=d.createContext(null);function SU({children:_}){let Q=b1(),J=d.useCallback((F)=>{let{nodes:X=[],setNodes:Y,hasDefaultNodes:K,onNodesChange:H,nodeLookup:L,fitViewQueued:z,onNodesChangeMiddlewareMap:W}=Q.getState(),w=X;for(let A of F)w=typeof A==="function"?A(w):A;let R=w9({items:w,lookup:L});for(let A of W.values())R=A(R);if(K)Y(w);if(R.length>0)H?.(R);else if(z)window.requestAnimationFrame(()=>{let{fitViewQueued:A,nodes:O,setNodes:B}=Q.getState();if(A)B(O)})},[]),q=f9(J),U=d.useCallback((F)=>{let{edges:X=[],setEdges:Y,hasDefaultEdges:K,onEdgesChange:H,edgeLookup:L}=Q.getState(),z=X;for(let W of F)z=typeof W==="function"?W(z):W;if(K)Y(z);else if(H)H(w9({items:z,lookup:L}))},[]),G=f9(U),Z=d.useMemo(()=>({nodeQueue:q,edgeQueue:G}),[]);return r.jsx(o9.Provider,{value:Z,children:_})}function vU(){let _=d.useContext(o9);if(!_)throw Error("useBatchContext must be used within a BatchProvider");return _}var kU=(_)=>!!_.panZoom;function c5(){let _=OU(),Q=b1(),J=vU(),q=N1(kU),U=d.useMemo(()=>{let G=(H)=>Q.getState().nodeLookup.get(H),Z=(H)=>{J.nodeQueue.push(H)},F=(H)=>{J.edgeQueue.push(H)},X=(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState(),W=N9(H)?H:L.get(H.id),w=W.parentId?D6(W.position,W.measured,W.parentId,L,z):W.position,R={...W,position:w,width:W.measured?.width??W.width,height:W.measured?.height??W.height};return J5(R)},Y=(H,L,z={replace:!1})=>{Z((W)=>W.map((w)=>{if(w.id===H){let R=typeof L==="function"?L(w):L;return z.replace&&N9(R)?R:{...w,...R}}return w}))},K=(H,L,z={replace:!1})=>{F((W)=>W.map((w)=>{if(w.id===H){let R=typeof L==="function"?L(w):L;return z.replace&&fU(R)?R:{...w,...R}}return w}))};return{getNodes:()=>Q.getState().nodes.map((H)=>({...H})),getNode:(H)=>G(H)?.internals.userNode,getInternalNode:G,getEdges:()=>{let{edges:H=[]}=Q.getState();return H.map((L)=>({...L}))},getEdge:(H)=>Q.getState().edgeLookup.get(H),setNodes:Z,setEdges:F,addNodes:(H)=>{let L=Array.isArray(H)?H:[H];J.nodeQueue.push((z)=>[...z,...L])},addEdges:(H)=>{let L=Array.isArray(H)?H:[H];J.edgeQueue.push((z)=>[...z,...L])},toObject:()=>{let{nodes:H=[],edges:L=[],transform:z}=Q.getState(),[W,w,R]=z;return{nodes:H.map((A)=>({...A})),edges:L.map((A)=>({...A})),viewport:{x:W,y:w,zoom:R}}},deleteElements:async({nodes:H=[],edges:L=[]})=>{let{nodes:z,edges:W,onNodesDelete:w,onEdgesDelete:R,triggerNodeChanges:A,triggerEdgeChanges:O,onDelete:B,onBeforeDelete:M}=Q.getState(),{nodes:P,edges:C}=await C7({nodesToRemove:H,edgesToRemove:L,nodes:z,edges:W,onBeforeDelete:M}),f=C.length>0,v=P.length>0;if(f){let N=C.map(P9);R?.(C),O(N)}if(v){let N=P.map(P9);w?.(P),A(N)}if(v||f)B?.({nodes:P,edges:C});return{deletedNodes:P,deletedEdges:C}},getIntersectingNodes:(H,L=!0,z)=>{let W=V6(H),w=W?H:X(H),R=z!==void 0;if(!w)return[];return(z||Q.getState().nodes).filter((A)=>{let O=Q.getState().nodeLookup.get(A.id);if(O&&!W&&(A.id===H.id||!O.internals.positionAbsolute))return!1;let B=J5(R?A:O),M=x5(B,w);return L&&M>0||M>=B.width*B.height||M>=w.width*w.height})},isNodeIntersecting:(H,L,z=!0)=>{let w=V6(H)?H:X(H);if(!w)return!1;let R=x5(w,L);return z&&R>0||R>=L.width*L.height||R>=w.width*w.height},updateNode:Y,updateNodeData:(H,L,z={replace:!1})=>{Y(H,(W)=>{let w=typeof L==="function"?L(W):L;return z.replace?{...W,data:w}:{...W,data:{...W.data,...w}}},z)},updateEdge:K,updateEdgeData:(H,L,z={replace:!1})=>{K(H,(W)=>{let w=typeof L==="function"?L(W):L;return z.replace?{...W,data:w}:{...W,data:{...W.data,...w}}},z)},getNodesBounds:(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState();return k6(H,{nodeLookup:L,nodeOrigin:z})},getHandleConnections:({type:H,id:L,nodeId:z})=>Array.from(Q.getState().connectionLookup.get(`${z}-${H}${L?`-${L}`:""}`)?.values()??[]),getNodeConnections:({type:H,handleId:L,nodeId:z})=>Array.from(Q.getState().connectionLookup.get(`${z}${H?L?`-${H}-${L}`:`-${H}`:""}`)?.values()??[]),fitView:async(H)=>{let L=Q.getState().fitViewResolver??k7();return Q.setState({fitViewQueued:!0,fitViewOptions:H,fitViewResolver:L}),J.nodeQueue.push((z)=>[...z]),L.promise}}},[]);return d.useMemo(()=>{return{...U,..._,viewportInitialized:q}},[q])}var C9=(_)=>_.selected,yU=typeof window<"u"?window:void 0;function jU({deleteKeyCode:_,multiSelectionKeyCode:Q}){let J=b1(),{deleteElements:q}=c5(),U=p5(_,{actInsideInputWithModifier:!1}),G=p5(Q,{target:yU});d.useEffect(()=>{if(U){let{edges:Z,nodes:F}=J.getState();q({nodes:F.filter(C9),edges:Z.filter(C9)}),J.setState({nodesSelectionActive:!1})}},[U]),d.useEffect(()=>{J.setState({multiSelectionActive:G})},[G])}function VU(_){let Q=b1();d.useEffect(()=>{let J=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let q=C4(_.current);if(q.height===0||q.width===0)Q.getState().onError?.("004",H0.error004());Q.setState({width:q.width||500,height:q.height||500})};if(_.current){J(),window.addEventListener("resize",J);let q=new ResizeObserver(()=>J());return q.observe(_.current),()=>{if(window.removeEventListener("resize",J),q&&_.current)q.unobserve(_.current)}}},[])}var g4={position:"absolute",width:"100%",height:"100%",top:0,left:0},uU=(_)=>({userSelectionActive:_.userSelectionActive,lib:_.lib,connectionInProgress:_.connection.inProgress});function hU({onPaneContextMenu:_,zoomOnScroll:Q=!0,zoomOnPinch:J=!0,panOnScroll:q=!1,panActivationKeyPressed:U,panOnScrollSpeed:G=0.5,panOnScrollMode:Z=s0.Free,zoomOnDoubleClick:F=!0,panOnDrag:X=!0,defaultViewport:Y,translateExtent:K,minZoom:H,maxZoom:L,zoomActivationKeyCode:z,preventScrolling:W=!0,children:w,noWheelClassName:R,noPanClassName:A,onViewportChange:O,isControlledViewport:B,paneClickDistance:M,selectionOnDrag:P}){let C=b1(),f=d.useRef(null),{userSelectionActive:v,lib:N,connectionInProgress:k}=N1(uU,D1),u=p5(z),i=d.useRef();VU(f);let l=d.useCallback((S)=>{if(O?.({x:S[0],y:S[1],zoom:S[2]}),!B)C.setState({transform:S})},[O,B]);return d.useEffect(()=>{if(f.current){i.current=e7({domNode:f.current,minZoom:H,maxZoom:L,translateExtent:K,viewport:Y,onDraggingChange:(E)=>C.setState((j)=>j.paneDragging===E?j:{paneDragging:E}),onPanZoomStart:(E,j)=>{let{onViewportChangeStart:m,onMoveStart:I}=C.getState();I?.(E,j),m?.(j)},onPanZoom:(E,j)=>{let{onViewportChange:m,onMove:I}=C.getState();I?.(E,j),m?.(j)},onPanZoomEnd:(E,j)=>{let{onViewportChangeEnd:m,onMoveEnd:I}=C.getState();I?.(E,j),m?.(j)}});let{x:S,y:b,zoom:h}=i.current.getViewport();return C.setState({panZoom:i.current,transform:[S,b,h],domNode:f.current.closest(".react-flow")}),()=>{i.current?.destroy()}}},[]),d.useEffect(()=>{i.current?.update({onPaneContextMenu:_,zoomOnScroll:Q,zoomOnPinch:J,panOnScroll:q,panActivationKeyPressed:U,panOnScrollSpeed:G,panOnScrollMode:Z,zoomOnDoubleClick:F,panOnDrag:X,zoomActivationKeyPressed:u,preventScrolling:W,noPanClassName:A,userSelectionActive:v,noWheelClassName:R,lib:N,onTransformChange:l,connectionInProgress:k,selectionOnDrag:P,paneClickDistance:M})},[_,Q,J,q,U,G,Z,F,X,u,W,A,v,R,N,l,k,P,M]),r.jsx("div",{className:"react-flow__renderer",ref:f,style:g4,children:w})}var DU=(_)=>({userSelectionActive:_.userSelectionActive,userSelectionRect:_.userSelectionRect});function bU(){let{userSelectionActive:_,userSelectionRect:Q}=N1(DU,D1);if(!(_&&Q))return null;return r.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:Q.width,height:Q.height,transform:`translate(${Q.x}px, ${Q.y}px)`}})}var t6=(_,Q)=>{return(J)=>{if(J.target!==Q.current)return;_?.(J)}},EU=(_)=>({userSelectionActive:_.userSelectionActive,elementsSelectable:_.elementsSelectable,dragging:_.paneDragging,panBy:_.panBy,autoPanSpeed:_.autoPanSpeed});function xU({isSelecting:_,selectionKeyPressed:Q,selectionMode:J=S2.Full,panOnDrag:q,autoPanOnSelection:U,paneClickDistance:G,selectionOnDrag:Z,onSelectionStart:F,onSelectionEnd:X,onPaneClick:Y,onPaneContextMenu:K,onPaneScroll:H,onPaneMouseEnter:L,onPaneMouseMove:z,onPaneMouseLeave:W,children:w}){let R=d.useRef(0),A=b1(),{userSelectionActive:O,elementsSelectable:B,dragging:M,panBy:P,autoPanSpeed:C}=N1(EU,D1),f=B&&(_||O),v=d.useRef(null),N=d.useRef(),k=d.useRef(new Set),u=d.useRef(new Set),i=d.useRef(!1),l=d.useRef(!1),S=d.useRef({x:0,y:0}),b=d.useRef(!1),h=(p)=>{if(l.current||i.current||A.getState().connection.inProgress){l.current=!1,i.current=!1;return}Y?.(p),A.getState().resetSelectedElements(),A.setState({nodesSelectionActive:!1})},E=(p)=>{if(Array.isArray(q)&&q?.includes(2)){p.preventDefault();return}K?.(p)},j=H?(p)=>H(p):void 0,m=(p)=>{if(l.current)p.stopPropagation(),l.current=!1},I=(p)=>{if(p.pointerType==="touch"&&q!==!1&&!Q)return;let{domNode:e,transform:$1}=A.getState();if(N.current=e?.getBoundingClientRect(),!N.current)return;let U1=p.target===v.current;if(!U1&&!!p.target.closest(".nokey")||!_||!(Z&&U1||Q)||p.button!==0||!p.isPrimary)return;p.target?.setPointerCapture?.(p.pointerId),l.current=!1;let{x:W1,y:Y1}=T0(p.nativeEvent,N.current),n=q5({x:W1,y:Y1},$1);if(A.setState({userSelectionRect:{width:0,height:0,startX:n.x,startY:n.y,x:W1,y:Y1}}),!U1)p.stopPropagation(),p.preventDefault()};function V(p,e){let{userSelectionRect:$1}=A.getState();if(!$1)return;let{transform:U1,nodeLookup:q1,edgeLookup:K1,connectionLookup:W1,triggerNodeChanges:Y1,triggerEdgeChanges:n,defaultEdgeOptions:R1}=A.getState(),H1={x:$1.startX,y:$1.startY},{x:x1,y:a1}=k2(H1,U1),i1={startX:H1.x,startY:H1.y,x:p<x1?p:x1,y:e<a1?e:a1,width:Math.abs(p-x1),height:Math.abs(e-a1)},k0=k.current,B0=u.current;k.current=new Set(w4(q1,i1,U1,J===S2.Partial,!0).map((J0)=>J0.id)),u.current=new Set;let w0=R1?.selectable??!0;for(let J0 of k.current){let Z0=W1.get(J0);if(!Z0)continue;for(let{edgeId:n1}of Z0.values()){let Y0=K1.get(n1);if(Y0&&(Y0.selectable??w0))u.current.add(n1)}}if(!b6(k0,k.current)){let J0=G5(q1,k.current,!0);Y1(J0)}if(!b6(B0,u.current)){let J0=G5(K1,u.current);n(J0)}A.setState({userSelectionRect:i1,userSelectionActive:!0,nodesSelectionActive:!1})}function D(){if(!U||!N.current)return;let[p,e]=P4(S.current,N.current,C);P({x:p,y:e}).then(($1)=>{if(!l.current||!$1){R.current=requestAnimationFrame(D);return}let{x:U1,y:q1}=S.current;V(U1,q1),R.current=requestAnimationFrame(D)})}let y=()=>{cancelAnimationFrame(R.current),R.current=0,b.current=!1};d.useEffect(()=>{return()=>y()},[]);let t=(p)=>{let{userSelectionRect:e,transform:$1,resetSelectedElements:U1}=A.getState();if(!N.current||!e)return;let{x:q1,y:K1}=T0(p.nativeEvent,N.current);S.current={x:q1,y:K1};let W1=k2({x:e.startX,y:e.startY},$1);if(!l.current){let Y1=Q?0:G;if(Math.hypot(q1-W1.x,K1-W1.y)<=Y1)return;U1(),F?.(p)}if(l.current=!0,!b.current)D(),b.current=!0;V(q1,K1)},_1=(p)=>{if(!f){if(p.target===v.current&&A.getState().connection.inProgress)i.current=!0;return}if(p.button!==0)return;if(p.target?.releasePointerCapture?.(p.pointerId),!O&&p.target===v.current&&A.getState().userSelectionRect)h?.(p);if(A.setState({userSelectionActive:!1,userSelectionRect:null}),l.current)X?.(p),A.setState({nodesSelectionActive:k.current.size>0});y()},a=(p)=>{p.target?.releasePointerCapture?.(p.pointerId),y()},o=q===!0||Array.isArray(q)&&q.includes(0);return r.jsxs("div",{className:m1(["react-flow__pane",{draggable:o,dragging:M,selection:_}]),onClick:f?void 0:t6(h,v),onContextMenu:t6(E,v),onWheel:t6(j,v),onPointerEnter:f?void 0:L,onPointerMove:f?t:z,onPointerUp:_1,onPointerCancel:f?a:void 0,onPointerDownCapture:f?I:void 0,onClickCapture:f?m:void 0,onPointerLeave:W,ref:v,style:g4,children:[w,r.jsx(bU,{})]})}function n6({id:_,store:Q,unselect:J=!1,nodeRef:q}){let{addSelectedNodes:U,unselectNodesAndEdges:G,multiSelectionActive:Z,nodeLookup:F,onError:X}=Q.getState(),Y=F.get(_);if(!Y){X?.("012",H0.error012(_));return}if(Q.setState({nodesSelectionActive:!1}),!Y.selected)U([_]);else if(J||Y.selected&&Z)G({nodes:[Y],edges:[]}),requestAnimationFrame(()=>q?.current?.blur())}function n9({nodeRef:_,disabled:Q=!1,noDragClassName:J,handleSelector:q,nodeId:U,isSelectable:G,nodeClickDistance:Z}){let F=b1(),[X,Y]=d.useState(!1),K=d.useRef();return d.useEffect(()=>{if(Q)return;return K.current=i7({getStoreItems:()=>F.getState(),onNodeMouseDown:(H)=>{n6({id:H,store:F,nodeRef:_})},onDragStart:()=>{Y(!0)},onDragStop:()=>{Y(!1)}}),()=>{K.current?.destroy(),K.current=void 0}},[Q,F,_]),d.useEffect(()=>{if(Q||!_.current||!K.current)return;K.current.update({noDragClassName:J,handleSelector:q,domNode:_.current,isSelectable:G,nodeId:U,nodeClickDistance:Z})},[J,q,Q,G,_,U,Z]),X}var mU=(_)=>(Q)=>Q.selected&&(Q.draggable||_&&typeof Q.draggable>"u");function e9(){let _=b1();return d.useCallback((J)=>{let{nodeExtent:q,snapToGrid:U,snapGrid:G,nodesDraggable:Z,onError:F,updateNodePositions:X,nodeLookup:Y,nodeOrigin:K}=_.getState(),H=new Map,L=mU(Z),z=U?G[0]:5,W=U?G[1]:5,w=J.direction.x*z*J.factor,R=J.direction.y*W*J.factor;for(let[,A]of Y){if(!L(A))continue;let O={x:A.internals.positionAbsolute.x+w,y:A.internals.positionAbsolute.y+R};if(U)O=$5(O,G);let{position:B,positionAbsolute:M}=y6({nodeId:A.id,nextPosition:O,nodeLookup:Y,nodeExtent:q,nodeOrigin:K,onError:F});A.position=B,A.internals.positionAbsolute=M,H.set(A.id,A)}X(H)},[])}var e6=d.createContext(null),gU=e6.Provider;e6.Consumer;var _8=()=>{return d.useContext(e6)},pU=(_)=>({connectOnClick:_.connectOnClick,noPanClassName:_.noPanClassName,rfId:_.rfId}),__=d.createContext(null);function cU({children:_}){let Q=N1(pU,D1);return r.jsx(__.Provider,{value:Q,children:_})}function lU(){let _=d.useContext(__);if(!_)throw Error("useHandleConfig must be used within a HandleConfigProvider");return _}var iU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},rU=(_,Q,J)=>(q)=>{let{connectionClickStartHandle:U,connectionMode:G,connection:Z}=q,{fromHandle:F,toHandle:X,isValid:Y}=Z;if(!F&&!U)return iU;let K=X?.nodeId===_&&X?.id===Q&&X?.type===J;return{connectingFrom:F?.nodeId===_&&F?.id===Q&&F?.type===J,connectingTo:K,clickConnecting:U?.nodeId===_&&U?.id===Q&&U?.type===J,isPossibleEndHandle:G===L2.Strict?F?.type!==J:_!==F?.nodeId||Q!==F?.id,connectionInProcess:!!F,clickConnectionInProcess:!!U,valid:K&&Y}};function dU({type:_="source",position:Q=F1.Top,isValidConnection:J,isConnectable:q=!0,isConnectableStart:U=!0,isConnectableEnd:G=!0,id:Z,onConnect:F,children:X,className:Y,onMouseDown:K,onTouchStart:H,...L},z){let W=Z||null,w=_==="target",R=b1(),A=_8(),{connectOnClick:O,noPanClassName:B,rfId:M}=lU(),{connectingFrom:P,connectingTo:C,clickConnecting:f,isPossibleEndHandle:v,connectionInProcess:N,clickConnectionInProcess:k,valid:u}=N1(rU(A,W,_),D1);if(!A)R.getState().onError?.("010",H0.error010());let i=(b)=>{let{defaultEdgeOptions:h,onConnect:E,hasDefaultEdges:j}=R.getState(),m={...h,...b};if(j){let{edges:I,setEdges:V,onError:D}=R.getState();V(NU(m,I,{onError:D}))}E?.(m),F?.(m)},l=(b)=>{if(!A)return;let h=g6(b.nativeEvent);if(U&&(h&&b.button===0||!h)){let E=R.getState();u4.onPointerDown(b.nativeEvent,{handleDomNode:b.currentTarget,autoPanOnConnect:E.autoPanOnConnect,connectionMode:E.connectionMode,connectionRadius:E.connectionRadius,domNode:E.domNode,nodeLookup:E.nodeLookup,lib:E.lib,isTarget:w,handleId:W,nodeId:A,flowId:E.rfId,panBy:E.panBy,cancelConnection:E.cancelConnection,onConnectStart:E.onConnectStart,onConnectEnd:(...j)=>R.getState().onConnectEnd?.(...j),updateConnection:E.updateConnection,onConnect:i,isValidConnection:J||((...j)=>R.getState().isValidConnection?.(...j)??!0),getTransform:()=>R.getState().transform,getFromHandle:()=>R.getState().connection.fromHandle,autoPanSpeed:E.autoPanSpeed,dragThreshold:E.connectionDragThreshold})}if(h)K?.(b);else H?.(b)},S=(b)=>{let{onClickConnectStart:h,onClickConnectEnd:E,connectionClickStartHandle:j,connectionMode:m,isValidConnection:I,lib:V,rfId:D,nodeLookup:y,connection:t}=R.getState();if(!A||!j&&!U)return;if(!j){h?.(b.nativeEvent,{nodeId:A,handleId:W,handleType:_}),R.setState({connectionClickStartHandle:{nodeId:A,type:_,id:W}});return}let _1=x6(b.target),a=J||I,{connection:o,isValid:p}=u4.isValid(b.nativeEvent,{handle:{nodeId:A,id:W,type:_},connectionMode:m,fromNodeId:j.nodeId,fromHandleId:j.id||null,fromType:j.type,isValidConnection:a,flowId:D,doc:_1,lib:V,nodeLookup:y});if(p&&o)i(o);let e=structuredClone(t);delete e.inProgress,e.toPosition=e.toHandle?e.toHandle.position:null,E?.(b,e),R.setState({connectionClickStartHandle:null})};return r.jsx("div",{"data-handleid":W,"data-nodeid":A,"data-handlepos":Q,"data-id":`${M}-${A}-${W}-${_}`,className:m1(["react-flow__handle",`react-flow__handle-${Q}`,"nodrag",B,Y,{source:!w,target:w,connectable:q,connectablestart:U,connectableend:G,clickconnecting:f,connectingfrom:P,connectingto:C,valid:u,connectionindicator:q&&(!N||v)&&(N||k?G:U)}]),onMouseDown:l,onTouchStart:l,onClick:O?S:void 0,ref:z,...L,children:X})}var E4=d.memo(s9(dU));function aU({data:_,isConnectable:Q,sourcePosition:J=F1.Bottom}){return r.jsxs(r.Fragment,{children:[_?.label,r.jsx(E4,{type:"source",position:J,isConnectable:Q})]})}function sU({data:_,isConnectable:Q,targetPosition:J=F1.Top,sourcePosition:q=F1.Bottom}){return r.jsxs(r.Fragment,{children:[r.jsx(E4,{type:"target",position:J,isConnectable:Q}),_?.label,r.jsx(E4,{type:"source",position:q,isConnectable:Q})]})}function tU(){return null}function oU({data:_,isConnectable:Q,targetPosition:J=F1.Top}){return r.jsxs(r.Fragment,{children:[r.jsx(E4,{type:"target",position:J,isConnectable:Q}),_?.label]})}var x4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},S9={input:aU,default:sU,output:oU,group:tU};function nU(_){if(_.internals.handleBounds===void 0)return{width:_.width??_.initialWidth??_.style?.width,height:_.height??_.initialHeight??_.style?.height};return{width:_.width??_.style?.width,height:_.height??_.style?.height}}var eU=(_)=>{let{width:Q,height:J,x:q,y:U}=j2(_.nodeLookup,{filter:(G)=>!!G.selected});return{width:M0(Q)?Q:null,height:M0(J)?J:null,userSelectionActive:_.userSelectionActive,transformString:`translate(${_.transform[0]}px,${_.transform[1]}px) scale(${_.transform[2]}) translate(${q}px,${U}px)`}};function _G({onSelectionContextMenu:_,noPanClassName:Q,disableKeyboardA11y:J}){let q=b1(),{width:U,height:G,transformString:Z,userSelectionActive:F}=N1(eU,D1),X=e9(),Y=d.useRef(null);d.useEffect(()=>{if(!J)Y.current?.focus({preventScroll:!0})},[J]);let K=!F&&U!==null&&G!==null;if(n9({nodeRef:Y,disabled:!K}),!K)return null;let H=_?(z)=>{let W=q.getState().nodes.filter((w)=>w.selected);_(z,W)}:void 0,L=(z)=>{if(Object.prototype.hasOwnProperty.call(x4,z.key))z.preventDefault(),X({direction:x4[z.key],factor:z.shiftKey?4:1})};return r.jsx("div",{className:m1(["react-flow__nodesselection","react-flow__container",Q]),style:{transform:Z},children:r.jsx("div",{ref:Y,className:"react-flow__nodesselection-rect",onContextMenu:H,tabIndex:J?void 0:-1,onKeyDown:J?void 0:L,style:{width:U,height:G}})})}var v9=typeof window<"u"?window:void 0,QG=(_)=>{return{nodesSelectionActive:_.nodesSelectionActive,userSelectionActive:_.userSelectionActive}};function Q_({children:_,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,paneClickDistance:F,deleteKeyCode:X,selectionKeyCode:Y,selectionOnDrag:K,selectionMode:H,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:W,panActivationKeyCode:w,zoomActivationKeyCode:R,elementsSelectable:A,zoomOnScroll:O,zoomOnPinch:B,panOnScroll:M,panOnScrollSpeed:P,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:v,autoPanOnSelection:N,defaultViewport:k,translateExtent:u,minZoom:i,maxZoom:l,preventScrolling:S,onSelectionContextMenu:b,noWheelClassName:h,noPanClassName:E,disableKeyboardA11y:j,onViewportChange:m,isControlledViewport:I}){let{nodesSelectionActive:V,userSelectionActive:D}=N1(QG,D1),y=p5(Y,{target:v9}),t=p5(w,{target:v9}),_1=t||v,a=t||M,o=K&&_1!==!0,p=y||D||o;return jU({deleteKeyCode:X,multiSelectionKeyCode:W}),r.jsx(hU,{onPaneContextMenu:G,elementsSelectable:A,zoomOnScroll:O,zoomOnPinch:B,panOnScroll:a,panActivationKeyPressed:t,panOnScrollSpeed:P,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:!y&&_1,defaultViewport:k,translateExtent:u,minZoom:i,maxZoom:l,zoomActivationKeyCode:R,preventScrolling:S,noWheelClassName:h,noPanClassName:E,onViewportChange:m,isControlledViewport:I,paneClickDistance:F,selectionOnDrag:o,children:r.jsxs(xU,{onSelectionStart:L,onSelectionEnd:z,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,panOnDrag:_1,autoPanOnSelection:N,isSelecting:!!p,selectionMode:H,selectionKeyPressed:y,paneClickDistance:F,selectionOnDrag:o,children:[_,V&&r.jsx(_G,{onSelectionContextMenu:b,noPanClassName:E,disableKeyboardA11y:j})]})})}Q_.displayName="FlowRenderer";var JG=d.memo(Q_),$G=(_)=>(Q)=>{return _?w4(Q.nodeLookup,{x:0,y:0,width:Q.width,height:Q.height},Q.transform,!0).map((J)=>J.id):Array.from(Q.nodeLookup.keys())};function qG(_){return N1(d.useCallback($G(_),[_]),D1)}var UG=(_)=>_.updateNodeInternals;function GG(){let _=N1(UG),[Q]=d.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver((J)=>{let q=new Map;J.forEach((U)=>{let G=U.target.getAttribute("data-id");q.set(G,{id:G,nodeElement:U.target,force:!0})}),_(q)})});return d.useEffect(()=>{return()=>{Q?.disconnect()}},[Q]),Q}function ZG({node:_,nodeType:Q,hasDimensions:J,resizeObserver:q}){let U=b1(),G=d.useRef(null),Z=d.useRef(null),F=d.useRef(_.sourcePosition),X=d.useRef(_.targetPosition),Y=d.useRef(Q),K=J&&!!_.internals.handleBounds;return d.useEffect(()=>{if(G.current&&!_.hidden&&(!K||Z.current!==G.current)){if(Z.current)q?.unobserve(Z.current);q?.observe(G.current),Z.current=G.current}},[K,_.hidden]),d.useEffect(()=>{return()=>{if(Z.current)q?.unobserve(Z.current),Z.current=null}},[]),d.useEffect(()=>{if(G.current){let H=Y.current!==Q,L=F.current!==_.sourcePosition,z=X.current!==_.targetPosition;if(H||L||z)Y.current=Q,F.current=_.sourcePosition,X.current=_.targetPosition,U.getState().updateNodeInternals(new Map([[_.id,{id:_.id,nodeElement:G.current,force:!0}]]))}},[_.id,Q,_.sourcePosition,_.targetPosition]),G}function FG({id:_,onClick:Q,onMouseEnter:J,onMouseMove:q,onMouseLeave:U,onContextMenu:G,onDoubleClick:Z,nodesDraggable:F,elementsSelectable:X,nodesConnectable:Y,nodesFocusable:K,resizeObserver:H,noDragClassName:L,noPanClassName:z,disableKeyboardA11y:W,rfId:w,nodeTypes:R,nodeClickDistance:A,onError:O}){let{node:B,internals:M,isParent:P}=N1((p)=>{let e=p.nodeLookup.get(_),$1=p.parentLookup.has(_);return{node:e,internals:e.internals,isParent:$1}},D1),C=B.type||"default",f=R?.[C]||S9[C];if(f===void 0)O?.("003",H0.error003(C)),C="default",f=R?.default||S9.default;let v=!!(B.draggable||F&&typeof B.draggable>"u"),N=!!(B.selectable||X&&typeof B.selectable>"u"),k=!!(B.connectable||Y&&typeof B.connectable>"u"),u=!!(B.focusable||K&&typeof B.focusable>"u"),i=b1(),l=h6(B),S=ZG({node:B,nodeType:C,hasDimensions:l,resizeObserver:H}),b=n9({nodeRef:S,disabled:B.hidden||!v,noDragClassName:L,handleSelector:B.dragHandle,nodeId:_,isSelectable:N,nodeClickDistance:A}),h=e9();if(B.hidden)return null;let E=R0(B),j=nU(B),m=N||v||Q||J||q||U,I=J?(p)=>J(p,{...M.userNode}):void 0,V=q?(p)=>q(p,{...M.userNode}):void 0,D=U?(p)=>U(p,{...M.userNode}):void 0,y=G?(p)=>G(p,{...M.userNode}):void 0,t=Z?(p)=>Z(p,{...M.userNode}):void 0,_1=(p)=>{let{selectNodesOnDrag:e,nodeDragThreshold:$1}=i.getState();if(N&&(!e||!v||$1>0))n6({id:_,store:i,nodeRef:S});if(Q)Q(p,{...M.userNode})},a=(p)=>{if(m6(p.nativeEvent)||W)return;if(N6.includes(p.key)&&N){let e=p.key==="Escape";n6({id:_,store:i,unselect:e,nodeRef:S})}else if(v&&B.selected&&Object.prototype.hasOwnProperty.call(x4,p.key)){p.preventDefault();let{ariaLabelConfig:e}=i.getState();i.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:p.key.replace("Arrow","").toLowerCase(),x:~~M.positionAbsolute.x,y:~~M.positionAbsolute.y})}),h({direction:x4[p.key],factor:p.shiftKey?4:1})}},o=()=>{if(W||!S.current?.matches(":focus-visible"))return;let{transform:p,width:e,height:$1,autoPanOnNodeFocus:U1,setCenter:q1}=i.getState();if(!U1)return;if(!(w4(new Map([[_,B]]),{x:0,y:0,width:e,height:$1},p,!0).length>0))q1(B.position.x+E.width/2,B.position.y+E.height/2,{zoom:p[2]})};return r.jsx("div",{className:m1(["react-flow__node",`react-flow__node-${C}`,{[z]:v},B.className,{selected:B.selected,selectable:N,parent:P,draggable:v,dragging:b}]),ref:S,style:{zIndex:M.z,transform:`translate(${M.positionAbsolute.x}px,${M.positionAbsolute.y}px)`,pointerEvents:m?"all":"none",visibility:l?"visible":"hidden",...B.style,...j},"data-id":_,"data-testid":`rf__node-${_}`,onMouseEnter:I,onMouseMove:V,onMouseLeave:D,onContextMenu:y,onClick:_1,onDoubleClick:t,onKeyDown:u?a:void 0,tabIndex:u?0:void 0,onFocus:u?o:void 0,role:B.ariaRole??(u?"group":void 0),"aria-roledescription":"node","aria-describedby":W?void 0:`${l9}-${w}`,"aria-label":B.ariaLabel,...B.domAttributes,children:r.jsx(gU,{value:_,children:r.jsx(f,{id:_,data:B.data,type:C,positionAbsoluteX:M.positionAbsolute.x,positionAbsoluteY:M.positionAbsolute.y,selected:B.selected??!1,selectable:N,draggable:v,deletable:B.deletable??!0,isConnectable:k,sourcePosition:B.sourcePosition,targetPosition:B.targetPosition,dragging:b,dragHandle:B.dragHandle,zIndex:M.z,parentId:B.parentId,...E})})})}var HG=d.memo(FG),XG=(_)=>({nodesConnectable:_.nodesConnectable,nodesFocusable:_.nodesFocusable,elementsSelectable:_.elementsSelectable,onError:_.onError});function J_(_){let{nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,onError:U}=N1(XG,D1),G=qG(_.onlyRenderVisibleElements),Z=GG();return r.jsx("div",{className:"react-flow__nodes",style:g4,children:G.map((F)=>{return r.jsx(HG,{id:F,nodeTypes:_.nodeTypes,nodeExtent:_.nodeExtent,onClick:_.onNodeClick,onMouseEnter:_.onNodeMouseEnter,onMouseMove:_.onNodeMouseMove,onMouseLeave:_.onNodeMouseLeave,onContextMenu:_.onNodeContextMenu,onDoubleClick:_.onNodeDoubleClick,noDragClassName:_.noDragClassName,noPanClassName:_.noPanClassName,rfId:_.rfId,disableKeyboardA11y:_.disableKeyboardA11y,resizeObserver:Z,nodesDraggable:_.nodesDraggable??!0,nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,nodeClickDistance:_.nodeClickDistance,onError:U},F)})})}J_.displayName="NodeRenderer";var KG=d.memo(J_);function YG(_){return N1(d.useCallback((J)=>{if(!_)return J.edges.map((U)=>U.id);let q=[];if(J.width&&J.height)for(let U of J.edges){let G=J.nodeLookup.get(U.source),Z=J.nodeLookup.get(U.target);if(G&&Z&&u7({sourceNode:G,targetNode:Z,width:J.width,height:J.height,transform:J.transform}))q.push(U.id)}return q},[_]),D1)}var LG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_}};return r.jsx("polyline",{className:"arrow",style:J,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},zG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_,fill:_}};return r.jsx("polyline",{className:"arrowclosed",style:J,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},k9={[e2.Arrow]:LG,[e2.ArrowClosed]:zG};function WG(_){let Q=b1();return d.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(k9,_))return Q.getState().onError?.("009",H0.error009(_)),null;return k9[_]},[_])}var BG=({id:_,type:Q,color:J,width:q=12.5,height:U=12.5,markerUnits:G="strokeWidth",strokeWidth:Z,orient:F="auto-start-reverse"})=>{let X=WG(Q);if(!X)return null;return r.jsx("marker",{className:"react-flow__arrowhead",id:_,markerWidth:`${q}`,markerHeight:`${U}`,viewBox:"-10 -10 20 20",markerUnits:G,orient:F,refX:"0",refY:"0",children:r.jsx(X,{color:J,strokeWidth:Z})})},$_=({defaultColor:_,rfId:Q})=>{let J=N1((G)=>G.edges),q=N1((G)=>G.defaultEdgeOptions),U=d.useMemo(()=>{return b7(J,{id:Q,defaultColor:_,defaultMarkerStart:q?.markerStart,defaultMarkerEnd:q?.markerEnd})},[J,q,Q,_]);if(!U.length)return null;return r.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:r.jsx("defs",{children:U.map((G)=>r.jsx(BG,{id:G.id,type:G.type,color:G.color,width:G.width,height:G.height,markerUnits:G.markerUnits,strokeWidth:G.strokeWidth,orient:G.orient},G.id))})})};$_.displayName="MarkerDefinitions";var AG=d.memo($_);function q_({x:_,y:Q,label:J,labelStyle:q,labelShowBg:U=!0,labelBgStyle:G,labelBgPadding:Z=[2,4],labelBgBorderRadius:F=2,children:X,className:Y,...K}){let[H,L]=d.useState({x:1,y:0,width:0,height:0}),z=m1(["react-flow__edge-textwrapper",Y]),W=d.useRef(null);if(d.useEffect(()=>{if(W.current){let w=W.current.getBBox();L({x:w.x,y:w.y,width:w.width,height:w.height})}},[J]),!J)return null;return r.jsxs("g",{transform:`translate(${_-H.width/2} ${Q-H.height/2})`,className:z,visibility:H.width?"visible":"hidden",...K,children:[U&&r.jsx("rect",{width:H.width+2*Z[0],x:-Z[0],y:-Z[1],height:H.height+2*Z[1],className:"react-flow__edge-textbg",style:G,rx:F,ry:F}),r.jsx("text",{className:"react-flow__edge-text",y:H.height/2,dy:"0.3em",ref:W,style:q,children:J}),X]})}q_.displayName="EdgeText";var MG=d.memo(q_);function p4({path:_,labelX:Q,labelY:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X,interactionWidth:Y=20,...K}){return r.jsxs(r.Fragment,{children:[r.jsx("path",{...K,d:_,fill:"none",className:m1(["react-flow__edge-path",K.className])}),Y?r.jsx("path",{d:_,fill:"none",strokeOpacity:0,strokeWidth:Y,className:"react-flow__edge-interaction"}):null,q&&M0(Q)&&M0(J)?r.jsx(MG,{x:Q,y:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X}):null]})}function y9({pos:_,x1:Q,y1:J,x2:q,y2:U}){if(_===F1.Left||_===F1.Right)return[0.5*(Q+q),J];return[Q,0.5*(J+U)]}function U_({sourceX:_,sourceY:Q,sourcePosition:J=F1.Bottom,targetX:q,targetY:U,targetPosition:G=F1.Top}){let[Z,F]=y9({pos:J,x1:_,y1:Q,x2:q,y2:U}),[X,Y]=y9({pos:G,x1:q,y1:U,x2:_,y2:Q}),[K,H,L,z]=S4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:Z,sourceControlY:F,targetControlX:X,targetControlY:Y});return[`M${_},${Q} C${Z},${F} ${X},${Y} ${q},${U}`,K,H,L,z]}function G_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z,targetPosition:F,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,interactionWidth:A})=>{let[O,B,M]=U_({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F}),P=_.isInternal?void 0:Q;return r.jsx(p4,{id:P,path:O,labelX:B,labelY:M,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,interactionWidth:A})})}var TG=G_({isInternal:!1}),Z_=G_({isInternal:!0});TG.displayName="SimpleBezierEdge";Z_.displayName="SimpleBezierEdgeInternal";function F_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,sourcePosition:z=F1.Bottom,targetPosition:W=F1.Top,markerEnd:w,markerStart:R,pathOptions:A,interactionWidth:O})=>{let[B,M,P]=g5({sourceX:J,sourceY:q,sourcePosition:z,targetX:U,targetY:G,targetPosition:W,borderRadius:A?.borderRadius,offset:A?.offset,stepPosition:A?.stepPosition}),C=_.isInternal?void 0:Q;return r.jsx(p4,{id:C,path:B,labelX:M,labelY:P,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:w,markerStart:R,interactionWidth:O})})}var H_=F_({isInternal:!1}),X_=F_({isInternal:!0});H_.displayName="SmoothStepEdge";X_.displayName="SmoothStepEdgeInternal";function K_(_){return d.memo(({id:Q,...J})=>{let q=_.isInternal?void 0:Q;return r.jsx(H_,{...J,id:q,pathOptions:d.useMemo(()=>({borderRadius:0,offset:J.pathOptions?.offset}),[J.pathOptions?.offset])})})}var RG=K_({isInternal:!1}),Y_=K_({isInternal:!0});RG.displayName="StepEdge";Y_.displayName="StepEdgeInternal";function L_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:w})=>{let[R,A,O]=k4({sourceX:J,sourceY:q,targetX:U,targetY:G}),B=_.isInternal?void 0:Q;return r.jsx(p4,{id:B,path:R,labelX:A,labelY:O,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:w})})}var OG=L_({isInternal:!1}),z_=L_({isInternal:!0});OG.displayName="StraightEdge";z_.displayName="StraightEdgeInternal";function W_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z=F1.Bottom,targetPosition:F=F1.Top,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,pathOptions:A,interactionWidth:O})=>{let[B,M,P]=v4({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F,curvature:A?.curvature}),C=_.isInternal?void 0:Q;return r.jsx(p4,{id:C,path:B,labelX:M,labelY:P,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,interactionWidth:O})})}var IG=W_({isInternal:!1}),B_=W_({isInternal:!0});IG.displayName="BezierEdge";B_.displayName="BezierEdgeInternal";var j9={default:B_,straight:z_,step:Y_,smoothstep:X_,simplebezier:Z_},V9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},wG=(_,Q,J)=>{if(J===F1.Left)return _-Q;if(J===F1.Right)return _+Q;return _},PG=(_,Q,J)=>{if(J===F1.Top)return _-Q;if(J===F1.Bottom)return _+Q;return _},u9="react-flow__edgeupdater";function h9({position:_,centerX:Q,centerY:J,radius:q=10,onMouseDown:U,onMouseEnter:G,onMouseOut:Z,type:F}){return r.jsx("circle",{onMouseDown:U,onMouseEnter:G,onMouseOut:Z,className:m1([u9,`${u9}-${F}`]),cx:wG(Q,q,_),cy:PG(J,q,_),r:q,stroke:"transparent",fill:"transparent"})}function NG({isReconnectable:_,reconnectRadius:Q,edge:J,sourceX:q,sourceY:U,targetX:G,targetY:Z,sourcePosition:F,targetPosition:X,onReconnect:Y,onReconnectStart:K,onReconnectEnd:H,setReconnecting:L,setUpdateHover:z}){let W=b1(),w=(M,P)=>{if(M.button!==0)return;let{autoPanOnConnect:C,domNode:f,connectionMode:v,connectionRadius:N,lib:k,onConnectStart:u,cancelConnection:i,nodeLookup:l,rfId:S,panBy:b,updateConnection:h}=W.getState(),E=P.type==="target",j=(V,D)=>{L(!1),H?.(V,J,P.type,D)},m=(V)=>Y?.(J,V),I=(V,D)=>{L(!0),K?.(M,J,P.type),u?.(V,D)};u4.onPointerDown(M.nativeEvent,{autoPanOnConnect:C,connectionMode:v,connectionRadius:N,domNode:f,handleId:P.id,nodeId:P.nodeId,nodeLookup:l,isTarget:E,edgeUpdaterType:P.type,lib:k,flowId:S,cancelConnection:i,panBy:b,isValidConnection:(...V)=>W.getState().isValidConnection?.(...V)??!0,onConnect:m,onConnectStart:I,onConnectEnd:(...V)=>W.getState().onConnectEnd?.(...V),onReconnectEnd:j,updateConnection:h,getTransform:()=>W.getState().transform,getFromHandle:()=>W.getState().connection.fromHandle,dragThreshold:W.getState().connectionDragThreshold,handleDomNode:M.currentTarget})},R=(M)=>w(M,{nodeId:J.target,id:J.targetHandle??null,type:"target"}),A=(M)=>w(M,{nodeId:J.source,id:J.sourceHandle??null,type:"source"}),O=()=>z(!0),B=()=>z(!1);return r.jsxs(r.Fragment,{children:[(_===!0||_==="source")&&r.jsx(h9,{position:F,centerX:q,centerY:U,radius:Q,onMouseDown:R,onMouseEnter:O,onMouseOut:B,type:"source"}),(_===!0||_==="target")&&r.jsx(h9,{position:X,centerX:G,centerY:Z,radius:Q,onMouseDown:A,onMouseEnter:O,onMouseOut:B,type:"target"})]})}function fG({id:_,edgesFocusable:Q,edgesReconnectable:J,elementsSelectable:q,onClick:U,onDoubleClick:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,rfId:W,edgeTypes:w,noPanClassName:R,onError:A,disableKeyboardA11y:O}){let B=N1((q1)=>q1.edgeLookup.get(_)),M=N1((q1)=>q1.defaultEdgeOptions);B=M?{...M,...B}:B;let P=B.type||"default",C=w?.[P]||j9[P];if(C===void 0)A?.("011",H0.error011(P)),P="default",C=w?.default||j9.default;let f=!!(B.focusable||Q&&typeof B.focusable>"u"),v=typeof H<"u"&&(B.reconnectable||J&&typeof B.reconnectable>"u"),N=!!(B.selectable||q&&typeof B.selectable>"u"),k=d.useRef(null),[u,i]=d.useState(!1),[l,S]=d.useState(!1),b=b1(),{zIndex:h=B.zIndex,sourceX:E,sourceY:j,targetX:m,targetY:I,sourcePosition:V,targetPosition:D}=N1(d.useCallback((q1)=>{let K1=q1.nodeLookup.get(B.source),W1=q1.nodeLookup.get(B.target);if(!K1||!W1)return V9;let Y1=D7({id:_,sourceNode:K1,targetNode:W1,sourceHandle:B.sourceHandle||null,targetHandle:B.targetHandle||null,connectionMode:q1.connectionMode,onError:A}),n=V7({selected:B.selected,zIndex:B.zIndex,sourceNode:K1,targetNode:W1,elevateOnSelect:q1.elevateEdgesOnSelect,zIndexMode:q1.zIndexMode});return{...Y1||V9,zIndex:n}},[B.source,B.target,B.sourceHandle,B.targetHandle,B.selected,B.zIndex,A]),D1),y=d.useMemo(()=>B.markerStart?`url('#${y4(B.markerStart,W)}')`:void 0,[B.markerStart,W]),t=d.useMemo(()=>B.markerEnd?`url('#${y4(B.markerEnd,W)}')`:void 0,[B.markerEnd,W]);if(B.hidden||E===null||j===null||m===null||I===null)return null;let _1=(q1)=>{let{addSelectedEdges:K1,unselectNodesAndEdges:W1,multiSelectionActive:Y1}=b.getState();if(N)if(b.setState({nodesSelectionActive:!1}),B.selected&&Y1)W1({nodes:[],edges:[B]}),k.current?.blur();else K1([_]);if(U)U(q1,B)},a=G?(q1)=>{G(q1,{...B})}:void 0,o=Z?(q1)=>{Z(q1,{...B})}:void 0,p=F?(q1)=>{F(q1,{...B})}:void 0,e=X?(q1)=>{X(q1,{...B})}:void 0,$1=Y?(q1)=>{Y(q1,{...B})}:void 0,U1=(q1)=>{if(!O&&N6.includes(q1.key)&&N){let{unselectNodesAndEdges:K1,addSelectedEdges:W1}=b.getState();if(q1.key==="Escape")k.current?.blur(),K1({edges:[B]});else W1([_])}};return r.jsx("svg",{style:{zIndex:h},children:r.jsxs("g",{className:m1(["react-flow__edge",`react-flow__edge-${P}`,B.className,R,{selected:B.selected,animated:B.animated,inactive:!N&&!U,updating:u,selectable:N}]),onClick:_1,onDoubleClick:a,onContextMenu:o,onMouseEnter:p,onMouseMove:e,onMouseLeave:$1,onKeyDown:f?U1:void 0,tabIndex:f?0:void 0,role:B.ariaRole??(f?"group":"img"),"aria-roledescription":"edge","data-id":_,"data-testid":`rf__edge-${_}`,"aria-label":B.ariaLabel===null?void 0:B.ariaLabel||`Edge from ${B.source} to ${B.target}`,"aria-describedby":f?`${i9}-${W}`:void 0,ref:k,...B.domAttributes,children:[!l&&r.jsx(C,{id:_,source:B.source,target:B.target,type:B.type,selected:B.selected,animated:B.animated,selectable:N,deletable:B.deletable??!0,label:B.label,labelStyle:B.labelStyle,labelShowBg:B.labelShowBg,labelBgStyle:B.labelBgStyle,labelBgPadding:B.labelBgPadding,labelBgBorderRadius:B.labelBgBorderRadius,sourceX:E,sourceY:j,targetX:m,targetY:I,sourcePosition:V,targetPosition:D,data:B.data,style:B.style,sourceHandleId:B.sourceHandle,targetHandleId:B.targetHandle,markerStart:y,markerEnd:t,pathOptions:"pathOptions"in B?B.pathOptions:void 0,interactionWidth:B.interactionWidth}),v&&r.jsx(NG,{edge:B,isReconnectable:v,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,sourceX:E,sourceY:j,targetX:m,targetY:I,sourcePosition:V,targetPosition:D,setUpdateHover:i,setReconnecting:S})]})})}var CG=d.memo(fG),SG=(_)=>({edgesFocusable:_.edgesFocusable,edgesReconnectable:_.edgesReconnectable,elementsSelectable:_.elementsSelectable,connectionMode:_.connectionMode,onError:_.onError});function A_({defaultMarkerColor:_,onlyRenderVisibleElements:Q,rfId:J,edgeTypes:q,noPanClassName:U,onReconnect:G,onEdgeContextMenu:Z,onEdgeMouseEnter:F,onEdgeMouseMove:X,onEdgeMouseLeave:Y,onEdgeClick:K,reconnectRadius:H,onEdgeDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,disableKeyboardA11y:w}){let{edgesFocusable:R,edgesReconnectable:A,elementsSelectable:O,onError:B}=N1(SG,D1),M=YG(Q);return r.jsxs("div",{className:"react-flow__edges",children:[r.jsx(AG,{defaultColor:_,rfId:J}),M.map((P)=>{return r.jsx(CG,{id:P,edgesFocusable:R,edgesReconnectable:A,elementsSelectable:O,noPanClassName:U,onReconnect:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,onClick:K,reconnectRadius:H,onDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,rfId:J,onError:B,edgeTypes:q,disableKeyboardA11y:w},P)})]})}A_.displayName="EdgeRenderer";var vG=d.memo(A_),D9=(_)=>`translate(${_[0]}px,${_[1]}px) scale(${_[2]})`;function kG({children:_}){let Q=b1(),J=d.useRef(null),[q]=d.useState(()=>Q.getState().transform);return t9(()=>{let U=null,G=()=>{let Z=Q.getState().transform;if(U&&Z[0]===U[0]&&Z[1]===U[1]&&Z[2]===U[2])return;if(U=Z,J.current)J.current.style.transform=D9(Z)};return G(),Q.subscribe(G)},[Q]),r.jsx("div",{ref:J,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:D9(q)},children:_})}function yG(_){let Q=c5(),J=d.useRef(!1);d.useEffect(()=>{if(!J.current&&Q.viewportInitialized&&_)setTimeout(()=>_(Q),1),J.current=!0},[_,Q.viewportInitialized])}var jG=(_)=>_.panZoom?.syncViewport;function VG(_){let Q=N1(jG),J=b1();return d.useEffect(()=>{if(_)Q?.(_),J.setState({transform:[_.x,_.y,_.zoom]})},[_,Q]),null}function b9(_){return _.connection.inProgress?{..._.connection,to:q5(_.connection.to,_.transform)}:{..._.connection}}function uG(_){if(_)return(J)=>{let q=b9(J);return _(q)};return b9}function hG(_){let Q=uG(_);return N1(Q,D1)}var DG=(_)=>({nodesConnectable:_.nodesConnectable,isValid:_.connection.isValid,inProgress:_.connection.inProgress,width:_.width,height:_.height});function bG({containerStyle:_,style:Q,type:J,component:q}){let{nodesConnectable:U,width:G,height:Z,isValid:F,inProgress:X}=N1(DG,D1);if(!(G&&U&&X))return null;return r.jsx("svg",{style:_,width:G,height:Z,className:"react-flow__connectionline react-flow__container",children:r.jsx("g",{className:m1(["react-flow__connection",E6(F)]),children:r.jsx(M_,{style:Q,type:J,CustomComponent:q,isValid:F})})})}var M_=({style:_,type:Q=E0.Bezier,CustomComponent:J,isValid:q})=>{let{inProgress:U,from:G,fromNode:Z,fromHandle:F,fromPosition:X,to:Y,toNode:K,toHandle:H,toPosition:L,pointer:z}=hG();if(!U)return;if(J)return r.jsx(J,{connectionLineType:Q,connectionLineStyle:_,fromNode:Z,fromHandle:F,fromX:G.x,fromY:G.y,toX:Y.x,toY:Y.y,fromPosition:X,toPosition:L,connectionStatus:E6(q),toNode:K,toHandle:H,pointer:z});let W="",w={sourceX:G.x,sourceY:G.y,sourcePosition:X,targetX:Y.x,targetY:Y.y,targetPosition:L};switch(Q){case E0.Bezier:[W]=v4(w);break;case E0.SimpleBezier:[W]=U_(w);break;case E0.Step:[W]=g5({...w,borderRadius:0});break;case E0.SmoothStep:[W]=g5(w);break;default:[W]=k4(w)}return r.jsx("path",{d:W,fill:"none",className:"react-flow__connection-path",style:_})};M_.displayName="ConnectionLine";var EG={};function E9(_=EG){let Q=d.useRef(_),J=b1();d.useEffect(()=>{{let q=new Set([...Object.keys(Q.current),...Object.keys(_)]);for(let U of q)if(Q.current[U]!==_[U]){J.getState().onError?.("002",H0.error002());break}Q.current=_}},[_])}function xG(){let _=b1(),Q=d.useRef(!1);d.useEffect(()=>{if(!Q.current){let J=document.querySelector(".react-flow__pane");if(J&&window.getComputedStyle(J).zIndex!=="1")_.getState().onError?.("013",H0.error013("react"));Q.current=!0}},[])}function T_({nodeTypes:_,edgeTypes:Q,onInit:J,onNodeClick:q,onEdgeClick:U,onNodeDoubleClick:G,onEdgeDoubleClick:Z,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:z,connectionLineType:W,connectionLineStyle:w,connectionLineComponent:R,connectionLineContainerStyle:A,selectionKeyCode:O,selectionOnDrag:B,selectionMode:M,multiSelectionKeyCode:P,panActivationKeyCode:C,zoomActivationKeyCode:f,deleteKeyCode:v,onlyRenderVisibleElements:N,elementsSelectable:k,defaultViewport:u,translateExtent:i,minZoom:l,maxZoom:S,preventScrolling:b,defaultMarkerColor:h,zoomOnScroll:E,zoomOnPinch:j,panOnScroll:m,panOnScrollSpeed:I,panOnScrollMode:V,zoomOnDoubleClick:D,panOnDrag:y,autoPanOnSelection:t,onPaneClick:_1,onPaneMouseEnter:a,onPaneMouseMove:o,onPaneMouseLeave:p,onPaneScroll:e,onPaneContextMenu:$1,paneClickDistance:U1,nodeClickDistance:q1,onEdgeContextMenu:K1,onEdgeMouseEnter:W1,onEdgeMouseMove:Y1,onEdgeMouseLeave:n,reconnectRadius:R1,onReconnect:H1,onReconnectStart:x1,onReconnectEnd:a1,noDragClassName:i1,noWheelClassName:k0,noPanClassName:B0,disableKeyboardA11y:w0,nodeExtent:J0,rfId:Z0,viewport:n1,onViewportChange:Y0,nodesDraggable:U2}){return E9(_),E9(Q),xG(),yG(J),VG(n1),r.jsx(JG,{onPaneClick:_1,onPaneMouseEnter:a,onPaneMouseMove:o,onPaneMouseLeave:p,onPaneContextMenu:$1,onPaneScroll:e,paneClickDistance:U1,deleteKeyCode:v,selectionKeyCode:O,selectionOnDrag:B,selectionMode:M,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:P,panActivationKeyCode:C,zoomActivationKeyCode:f,elementsSelectable:k,zoomOnScroll:E,zoomOnPinch:j,zoomOnDoubleClick:D,panOnScroll:m,panOnScrollSpeed:I,panOnScrollMode:V,panOnDrag:y,autoPanOnSelection:t,defaultViewport:u,translateExtent:i,minZoom:l,maxZoom:S,onSelectionContextMenu:H,preventScrolling:b,noDragClassName:i1,noWheelClassName:k0,noPanClassName:B0,disableKeyboardA11y:w0,onViewportChange:Y0,isControlledViewport:!!n1,children:r.jsxs(kG,{children:[r.jsx(vG,{edgeTypes:Q,onEdgeClick:U,onEdgeDoubleClick:Z,onReconnect:H1,onReconnectStart:x1,onReconnectEnd:a1,onlyRenderVisibleElements:N,onEdgeContextMenu:K1,onEdgeMouseEnter:W1,onEdgeMouseMove:Y1,onEdgeMouseLeave:n,reconnectRadius:R1,defaultMarkerColor:h,noPanClassName:B0,disableKeyboardA11y:w0,rfId:Z0}),r.jsx(bG,{style:w,type:W,component:R,containerStyle:A}),r.jsx("div",{className:"react-flow__edgelabel-renderer"}),r.jsx(KG,{nodeTypes:_,onNodeClick:q,onNodeDoubleClick:G,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,nodeClickDistance:q1,onlyRenderVisibleElements:N,noPanClassName:B0,noDragClassName:i1,disableKeyboardA11y:w0,nodeExtent:J0,rfId:Z0,nodesDraggable:U2}),r.jsx("div",{className:"react-flow__viewport-portal"})]})})}T_.displayName="GraphView";var mG=d.memo(T_),gG=u6("React Flow","https://reactflow.dev/"),x9=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X=0.5,maxZoom:Y=2,nodeOrigin:K,nodeExtent:H,zIndexMode:L="basic"}={})=>{let z=new Map,W=new Map,w=new Map,R=new Map,A=q??Q??[],O=J??_??[],B=K??[0,0],M=H??Q5;d6(w,R,A);let{nodesInitialized:P}=j4(O,z,W,{nodeOrigin:B,nodeExtent:M,zIndexMode:L}),C=[0,0,1];if(Z&&U&&G){let f=j2(z,{filter:(u)=>!!((u.width||u.initialWidth)&&(u.height||u.initialHeight))}),{x:v,y:N,zoom:k}=m5(f,U,G,X,Y,F?.padding??0.1);C=[v,N,k]}return{rfId:"1",width:U??0,height:G??0,transform:C,nodes:O,nodesInitialized:P,nodeLookup:z,parentLookup:W,edges:A,edgeLookup:R,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:J!==void 0,hasDefaultEdges:q!==void 0,panZoom:null,minZoom:X,maxZoom:Y,translateExtent:Q5,nodeExtent:M,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:L2.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:B,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:Z??!1,fitViewOptions:F,fitViewResolver:null,connection:{...C6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:f6,zIndexMode:L,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},pG=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L})=>K9((z,W)=>{async function w(){let{nodeLookup:R,panZoom:A,fitViewOptions:O,fitViewResolver:B,width:M,height:P,minZoom:C,maxZoom:f}=W();if(!A)return;await f7({nodes:R,width:M,height:P,panZoom:A,minZoom:C,maxZoom:f},O),B?.resolve(!0),z({fitViewResolver:null})}return{...x9({nodes:_,edges:Q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,defaultNodes:J,defaultEdges:q,zIndexMode:L}),setNodes:(R)=>{let{nodeLookup:A,parentLookup:O,nodeOrigin:B,nodeExtent:M,elevateNodesOnSelect:P,fitViewQueued:C,zIndexMode:f,nodesSelectionActive:v}=W(),{nodesInitialized:N,hasSelectedNodes:k}=j4(R,A,O,{nodeOrigin:B,nodeExtent:M,elevateNodesOnSelect:P,checkEquality:!0,zIndexMode:f}),u=v&&k;if(C&&N)w(),z({nodes:R,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u});else z({nodes:R,nodesInitialized:N,nodesSelectionActive:u})},setEdges:(R)=>{let{connectionLookup:A,edgeLookup:O}=W();d6(A,O,R),z({edges:R})},setDefaultNodesAndEdges:(R,A)=>{if(R){let{setNodes:O}=W();O(R),z({hasDefaultNodes:!0})}if(A){let{setEdges:O}=W();O(A),z({hasDefaultEdges:!0})}},updateNodeInternals:(R)=>{let{triggerNodeChanges:A,nodeLookup:O,parentLookup:B,domNode:M,nodeOrigin:P,nodeExtent:C,debug:f,fitViewQueued:v,zIndexMode:N}=W(),{changes:k,updatedInternals:u}=p7(R,O,B,M,P,C,N);if(!u)return;if(m7(O,B,{nodeOrigin:P,nodeExtent:C,zIndexMode:N}),v)w(),z({fitViewQueued:!1,fitViewOptions:void 0});else z({});if(k?.length>0){if(f)console.log("React Flow: trigger node changes",k);A?.(k)}},updateNodePositions:(R,A=!1)=>{let O=[],B=[],{nodeLookup:M,triggerNodeChanges:P,connection:C,updateConnection:f,onNodesChangeMiddlewareMap:v}=W();for(let[N,k]of R){let u=M.get(N),i=!!(u?.expandParent&&u?.parentId&&k?.position),l={id:N,type:"position",position:i?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:A};if(u&&C.inProgress&&C.fromNode.id===u.id){let S=z2(u,C.fromHandle,F1.Left,!0);f({...C,from:S})}if(i&&u.parentId)O.push({id:N,parentId:u.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}});B.push(l)}if(O.length>0){let{parentLookup:N,nodeOrigin:k}=W(),u=V4(O,M,N,k);B.push(...u)}for(let N of v.values())B=N(B);P(B)},triggerNodeChanges:(R)=>{let{onNodesChange:A,setNodes:O,nodes:B,hasDefaultNodes:M,debug:P}=W();if(R?.length){if(M){let C=a9(R,B);O(C)}if(P)console.log("React Flow: trigger node changes",R);A?.(R)}},triggerEdgeChanges:(R)=>{let{onEdgesChange:A,setEdges:O,edges:B,hasDefaultEdges:M,debug:P}=W();if(R?.length){if(M){let C=wU(R,B);O(C)}if(P)console.log("React Flow: trigger edge changes",R);A?.(R)}},addSelectedNodes:(R)=>{let{multiSelectionActive:A,edgeLookup:O,nodeLookup:B,triggerNodeChanges:M,triggerEdgeChanges:P}=W();if(A){let C=R.map((f)=>V2(f,!0));M(C);return}M(G5(B,new Set([...R]),!0)),P(G5(O))},addSelectedEdges:(R)=>{let{multiSelectionActive:A,edgeLookup:O,nodeLookup:B,triggerNodeChanges:M,triggerEdgeChanges:P}=W();if(A){let C=R.map((f)=>V2(f,!0));P(C);return}P(G5(O,new Set([...R]))),M(G5(B,new Set,!0))},unselectNodesAndEdges:({nodes:R,edges:A}={})=>{let{edges:O,nodes:B,nodeLookup:M,triggerNodeChanges:P,triggerEdgeChanges:C}=W(),f=R?R:B,v=A?A:O,N=[];for(let u of f){if(!u.selected)continue;let i=M.get(u.id);if(i)i.selected=!1;N.push(V2(u.id,!1))}let k=[];for(let u of v){if(!u.selected)continue;k.push(V2(u.id,!1))}P(N),C(k)},setMinZoom:(R)=>{let{panZoom:A,maxZoom:O}=W();A?.setScaleExtent([R,O]),z({minZoom:R})},setMaxZoom:(R)=>{let{panZoom:A,minZoom:O}=W();A?.setScaleExtent([O,R]),z({maxZoom:R})},setTranslateExtent:(R)=>{W().panZoom?.setTranslateExtent(R),z({translateExtent:R})},resetSelectedElements:()=>{let{edges:R,nodes:A,triggerNodeChanges:O,triggerEdgeChanges:B,elementsSelectable:M}=W();if(!M)return;let P=A.reduce((f,v)=>v.selected?[...f,V2(v.id,!1)]:f,[]),C=R.reduce((f,v)=>v.selected?[...f,V2(v.id,!1)]:f,[]);O(P),B(C)},setNodeExtent:(R)=>{let{nodes:A,nodeLookup:O,parentLookup:B,nodeOrigin:M,elevateNodesOnSelect:P,nodeExtent:C,zIndexMode:f}=W();if(R[0][0]===C[0][0]&&R[0][1]===C[0][1]&&R[1][0]===C[1][0]&&R[1][1]===C[1][1])return;j4(A,O,B,{nodeOrigin:M,nodeExtent:R,elevateNodesOnSelect:P,checkEquality:!1,zIndexMode:f}),z({nodeExtent:R})},panBy:(R)=>{let{transform:A,width:O,height:B,panZoom:M,translateExtent:P}=W();return c7({delta:R,panZoom:M,transform:A,translateExtent:P,width:O,height:B})},setCenter:async(R,A,O)=>{let{width:B,height:M,maxZoom:P,panZoom:C}=W();if(!C)return!1;let f=typeof O?.zoom<"u"?O.zoom:P;return await C.setViewport({x:B/2-R*f,y:M/2-A*f,zoom:f},{duration:O?.duration,ease:O?.ease,interpolate:O?.interpolate}),!0},cancelConnection:()=>{z({connection:{...C6}})},updateConnection:(R)=>{z({connection:R})},reset:()=>z({...x9()})}},Object.is);function Q8({initialNodes:_,initialEdges:Q,defaultNodes:J,defaultEdges:q,initialWidth:U,initialHeight:G,initialMinZoom:Z,initialMaxZoom:F,initialFitViewOptions:X,fitView:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L,children:z}){let[W]=d.useState(()=>pG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Y,minZoom:Z,maxZoom:F,fitViewOptions:X,nodeOrigin:K,nodeExtent:H,zIndexMode:L}));return r.jsx($U,{value:W,children:r.jsx(SU,{children:r.jsx(cU,{children:z})})})}function cG({children:_,nodes:Q,edges:J,defaultNodes:q,defaultEdges:U,width:G,height:Z,fitView:F,fitViewOptions:X,minZoom:Y,maxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z}){if(d.useContext(m4))return r.jsx(r.Fragment,{children:_});return r.jsx(Q8,{initialNodes:Q,initialEdges:J,defaultNodes:q,defaultEdges:U,initialWidth:G,initialHeight:Z,fitView:F,initialFitViewOptions:X,initialMinZoom:Y,initialMaxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z,children:_})}var lG={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function iG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,className:U,nodeTypes:G,edgeTypes:Z,onNodeClick:F,onEdgeClick:X,onInit:Y,onMove:K,onMoveStart:H,onMoveEnd:L,onConnect:z,onConnectStart:W,onConnectEnd:w,onClickConnectStart:R,onClickConnectEnd:A,onNodeMouseEnter:O,onNodeMouseMove:B,onNodeMouseLeave:M,onNodeContextMenu:P,onNodeDoubleClick:C,onNodeDragStart:f,onNodeDrag:v,onNodeDragStop:N,onNodesDelete:k,onEdgesDelete:u,onDelete:i,onSelectionChange:l,onSelectionDragStart:S,onSelectionDrag:b,onSelectionDragStop:h,onSelectionContextMenu:E,onSelectionStart:j,onSelectionEnd:m,onBeforeDelete:I,connectionMode:V,connectionLineType:D=E0.Bezier,connectionLineStyle:y,connectionLineComponent:t,connectionLineContainerStyle:_1,deleteKeyCode:a="Backspace",selectionKeyCode:o="Shift",selectionOnDrag:p=!1,selectionMode:e=S2.Full,panActivationKeyCode:$1="Space",multiSelectionKeyCode:U1=U5()?"Meta":"Control",zoomActivationKeyCode:q1=U5()?"Meta":"Control",snapToGrid:K1,snapGrid:W1,onlyRenderVisibleElements:Y1=!1,selectNodesOnDrag:n,nodesDraggable:R1,autoPanOnNodeFocus:H1,nodesConnectable:x1,nodesFocusable:a1,nodeOrigin:i1=r9,edgesFocusable:k0,edgesReconnectable:B0,elementsSelectable:w0=!0,defaultViewport:J0=BU,minZoom:Z0=0.5,maxZoom:n1=2,translateExtent:Y0=Q5,preventScrolling:U2=!0,nodeExtent:P0,defaultMarkerColor:c0="#b1b1b7",zoomOnScroll:G2=!0,zoomOnPinch:l0=!0,panOnScroll:c2=!1,panOnScrollSpeed:y0=0.5,panOnScrollMode:T=s0.Free,zoomOnDoubleClick:g=!0,panOnDrag:Q1=!0,onPaneClick:J1,onPaneMouseEnter:X1,onPaneMouseMove:O1,onPaneMouseLeave:T1,onPaneScroll:v1,onPaneContextMenu:I1,paneClickDistance:A0=1,nodeClickDistance:j0=0,children:x,onReconnect:s,onReconnectStart:G1,onReconnectEnd:Z1,onEdgeContextMenu:f1,onEdgeDoubleClick:L1,onEdgeMouseEnter:M1,onEdgeMouseMove:P1,onEdgeMouseLeave:k1,reconnectRadius:e1=10,onNodesChange:C1,onEdgesChange:L0,noDragClassName:r1="nodrag",noWheelClassName:o4="nowheel",noPanClassName:V0="nopan",fitView:h1,fitViewOptions:M8,connectOnClick:RQ,attributionPosition:OQ,proOptions:IQ,defaultEdgeOptions:wQ,elevateNodesOnSelect:PQ=!0,elevateEdgesOnSelect:NQ=!1,disableKeyboardA11y:T8=!1,autoPanOnConnect:fQ,autoPanOnNodeDrag:CQ,autoPanOnSelection:SQ=!0,autoPanSpeed:vQ,connectionRadius:kQ,isValidConnection:yQ,onError:jQ,style:VQ,id:R8,nodeDragThreshold:uQ,connectionDragThreshold:hQ,viewport:DQ,onViewportChange:bQ,width:EQ,height:xQ,colorMode:mQ="light",debug:gQ,onScroll:O8,ariaLabelConfig:pQ,zIndexMode:I8="basic",...cQ},lQ){let n4=R8||"1",iQ=RU(mQ),rQ=d.useCallback((w8)=>{w8.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),O8?.(w8)},[O8]);return r.jsx("div",{"data-testid":"rf__wrapper",...cQ,onScroll:rQ,style:{...VQ,...lG},ref:lQ,className:m1(["react-flow",U,iQ]),id:R8,role:"application",children:r.jsxs(cG,{nodes:_,edges:Q,width:EQ,height:xQ,fitView:h1,fitViewOptions:M8,minZoom:Z0,maxZoom:n1,nodeOrigin:i1,nodeExtent:P0,zIndexMode:I8,children:[r.jsx(TU,{nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,onConnect:z,onConnectStart:W,onConnectEnd:w,onClickConnectStart:R,onClickConnectEnd:A,nodesDraggable:R1,autoPanOnNodeFocus:H1,nodesConnectable:x1,nodesFocusable:a1,edgesFocusable:k0,edgesReconnectable:B0,elementsSelectable:w0,elevateNodesOnSelect:PQ,elevateEdgesOnSelect:NQ,minZoom:Z0,maxZoom:n1,nodeExtent:P0,onNodesChange:C1,onEdgesChange:L0,snapToGrid:K1,snapGrid:W1,connectionMode:V,translateExtent:Y0,connectOnClick:RQ,defaultEdgeOptions:wQ,fitView:h1,fitViewOptions:M8,onNodesDelete:k,onEdgesDelete:u,onDelete:i,onNodeDragStart:f,onNodeDrag:v,onNodeDragStop:N,onSelectionDrag:b,onSelectionDragStart:S,onSelectionDragStop:h,onMove:K,onMoveStart:H,onMoveEnd:L,noPanClassName:V0,nodeOrigin:i1,rfId:n4,autoPanOnConnect:fQ,autoPanOnNodeDrag:CQ,autoPanSpeed:vQ,onError:jQ,connectionRadius:kQ,isValidConnection:yQ,selectNodesOnDrag:n,nodeDragThreshold:uQ,connectionDragThreshold:hQ,onBeforeDelete:I,debug:gQ,ariaLabelConfig:pQ,zIndexMode:I8}),r.jsx(mG,{onInit:Y,onNodeClick:F,onEdgeClick:X,onNodeMouseEnter:O,onNodeMouseMove:B,onNodeMouseLeave:M,onNodeContextMenu:P,onNodeDoubleClick:C,nodeTypes:G,edgeTypes:Z,connectionLineType:D,connectionLineStyle:y,connectionLineComponent:t,connectionLineContainerStyle:_1,selectionKeyCode:o,selectionOnDrag:p,selectionMode:e,deleteKeyCode:a,multiSelectionKeyCode:U1,panActivationKeyCode:$1,zoomActivationKeyCode:q1,onlyRenderVisibleElements:Y1,defaultViewport:J0,translateExtent:Y0,minZoom:Z0,maxZoom:n1,preventScrolling:U2,zoomOnScroll:G2,zoomOnPinch:l0,zoomOnDoubleClick:g,panOnScroll:c2,panOnScrollSpeed:y0,panOnScrollMode:T,panOnDrag:Q1,autoPanOnSelection:SQ,onPaneClick:J1,onPaneMouseEnter:X1,onPaneMouseMove:O1,onPaneMouseLeave:T1,onPaneScroll:v1,onPaneContextMenu:I1,paneClickDistance:A0,nodeClickDistance:j0,onSelectionContextMenu:E,onSelectionStart:j,onSelectionEnd:m,onReconnect:s,onReconnectStart:G1,onReconnectEnd:Z1,onEdgeContextMenu:f1,onEdgeDoubleClick:L1,onEdgeMouseEnter:M1,onEdgeMouseMove:P1,onEdgeMouseLeave:k1,reconnectRadius:e1,defaultMarkerColor:c0,noDragClassName:r1,noWheelClassName:o4,noPanClassName:V0,rfId:n4,disableKeyboardA11y:T8,nodeExtent:P0,viewport:DQ,onViewportChange:bQ,nodesDraggable:R1}),r.jsx(WU,{onSelectionChange:l}),x,r.jsx(XU,{proOptions:IQ,position:OQ}),r.jsx(HU,{rfId:n4,disableKeyboardA11y:T8})]})})}var R_=s9(iG);function O_(_){let[Q,J]=d.useState(_),q=d.useCallback((U)=>J((G)=>a9(U,G)),[]);return[Q,J,q]}var bA=H0.error014();function rG({dimensions:_,lineWidth:Q,variant:J,className:q}){return r.jsx("path",{strokeWidth:Q,d:`M${_[0]/2} 0 V${_[1]} M0 ${_[1]/2} H${_[0]}`,className:m1(["react-flow__background-pattern",J,q])})}function dG({radius:_,className:Q}){return r.jsx("circle",{cx:_,cy:_,r:_,className:m1(["react-flow__background-pattern","dots",Q])})}var x0;(function(_){_.Lines="lines",_.Dots="dots",_.Cross="cross"})(x0||(x0={}));var aG={[x0.Dots]:1,[x0.Lines]:1,[x0.Cross]:6},sG=(_)=>({transform:_.transform,patternId:`pattern-${_.rfId}`});function I_({id:_,variant:Q=x0.Dots,gap:J=20,size:q,lineWidth:U=1,offset:G=0,color:Z,bgColor:F,style:X,className:Y,patternClassName:K}){let H=d.useRef(null),{transform:L,patternId:z}=N1(sG,D1),W=q||aG[Q],w=Q===x0.Dots,R=Q===x0.Cross,A=Array.isArray(J)?J:[J,J],O=[A[0]*L[2]||1,A[1]*L[2]||1],B=W*L[2],M=Array.isArray(G)?G:[G,G],P=R?[B,B]:O,C=[M[0]*L[2]+P[0]/2,M[1]*L[2]+P[1]/2],f=`${z}${_?_:""}`;return r.jsxs("svg",{className:m1(["react-flow__background",Y]),style:{...X,...g4,"--xy-background-color-props":F,"--xy-background-pattern-color-props":Z},ref:H,"data-testid":"rf__background",children:[r.jsx("pattern",{id:f,x:L[0]%O[0],y:L[1]%O[1],width:O[0],height:O[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:w?r.jsx(dG,{radius:B/2,className:K}):r.jsx(rG,{dimensions:P,lineWidth:U,variant:Q,className:K})}),r.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f})`})]})}I_.displayName="Background";var w_=d.memo(I_);function tG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:r.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function oG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:r.jsx("path",{d:"M0 0h32v4.2H0z"})})}function nG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:r.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function eG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:r.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function _Z(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:r.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function b4({children:_,className:Q,...J}){return r.jsx("button",{type:"button",className:m1(["react-flow__controls-button",Q]),...J,children:_})}var QZ=(_)=>({isInteractive:_.nodesDraggable||_.nodesConnectable||_.elementsSelectable,minZoomReached:_.transform[2]<=_.minZoom,maxZoomReached:_.transform[2]>=_.maxZoom,ariaLabelConfig:_.ariaLabelConfig});function P_({style:_,showZoom:Q=!0,showFitView:J=!0,showInteractive:q=!0,fitViewOptions:U,onZoomIn:G,onZoomOut:Z,onFitView:F,onInteractiveChange:X,className:Y,children:K,position:H="bottom-left",orientation:L="vertical","aria-label":z}){let W=b1(),{isInteractive:w,minZoomReached:R,maxZoomReached:A,ariaLabelConfig:O}=N1(QZ,D1),{zoomIn:B,zoomOut:M,fitView:P}=c5(),C=()=>{B(),G?.()},f=()=>{M(),Z?.()},v=()=>{P(U),F?.()},N=()=>{W.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),X?.(!w)};return r.jsxs(m0,{className:m1(["react-flow__controls",L==="horizontal"?"horizontal":"vertical",Y]),position:H,style:_,"data-testid":"rf__controls","aria-label":z??O["controls.ariaLabel"],children:[Q&&r.jsxs(r.Fragment,{children:[r.jsx(b4,{onClick:C,className:"react-flow__controls-zoomin",title:O["controls.zoomIn.ariaLabel"],"aria-label":O["controls.zoomIn.ariaLabel"],disabled:A,children:r.jsx(tG,{})}),r.jsx(b4,{onClick:f,className:"react-flow__controls-zoomout",title:O["controls.zoomOut.ariaLabel"],"aria-label":O["controls.zoomOut.ariaLabel"],disabled:R,children:r.jsx(oG,{})})]}),J&&r.jsx(b4,{className:"react-flow__controls-fitview",onClick:v,title:O["controls.fitView.ariaLabel"],"aria-label":O["controls.fitView.ariaLabel"],children:r.jsx(nG,{})}),q&&r.jsx(b4,{className:"react-flow__controls-interactive",onClick:N,title:O["controls.interactive.ariaLabel"],"aria-label":O["controls.interactive.ariaLabel"],children:w?r.jsx(_Z,{}):r.jsx(eG,{})}),K]})}P_.displayName="Controls";var N_=d.memo(P_);function JZ({id:_,x:Q,y:J,width:q,height:U,style:G,color:Z,strokeColor:F,strokeWidth:X,className:Y,borderRadius:K,shapeRendering:H,selected:L,onClick:z}){let{background:W,backgroundColor:w}=G||{},R=Z||W||w;return r.jsx("rect",{className:m1(["react-flow__minimap-node",{selected:L},Y]),x:Q,y:J,rx:K,ry:K,width:q,height:U,style:{fill:R,stroke:F,strokeWidth:X},shapeRendering:H,onClick:z?(A)=>z(A,_):void 0})}var $Z=d.memo(JZ),qZ=(_)=>_.nodes.map((Q)=>Q.id),o6=(_)=>_ instanceof Function?_:()=>_;function UZ({nodeStrokeColor:_,nodeColor:Q,nodeClassName:J="",nodeBorderRadius:q=5,nodeStrokeWidth:U,nodeComponent:G=$Z,onClick:Z}){let F=N1(qZ,D1),X=o6(Q),Y=o6(_),K=o6(J),H=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return r.jsx(r.Fragment,{children:F.map((L)=>r.jsx(ZZ,{id:L,nodeColorFunc:X,nodeStrokeColorFunc:Y,nodeClassNameFunc:K,nodeBorderRadius:q,nodeStrokeWidth:U,NodeComponent:G,onClick:Z,shapeRendering:H},L))})}function GZ({id:_,nodeColorFunc:Q,nodeStrokeColorFunc:J,nodeClassNameFunc:q,nodeBorderRadius:U,nodeStrokeWidth:G,shapeRendering:Z,NodeComponent:F,onClick:X}){let{node:Y,x:K,y:H,width:L,height:z}=N1((W)=>{let w=W.nodeLookup.get(_);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};let R=w.internals.userNode,{x:A,y:O}=w.internals.positionAbsolute,{width:B,height:M}=R0(R);return{node:R,x:A,y:O,width:B,height:M}},D1);if(!Y||Y.hidden||!h6(Y))return null;return r.jsx(F,{x:K,y:H,width:L,height:z,style:Y.style,selected:!!Y.selected,className:q(Y),color:Q(Y),borderRadius:U,strokeColor:J(Y),strokeWidth:G,shapeRendering:Z,onClick:X,id:Y.id})}var ZZ=d.memo(GZ),FZ=d.memo(UZ),HZ=200,XZ=150,KZ=(_)=>!_.hidden,YZ=(_)=>{let Q={x:-_.transform[0]/_.transform[2],y:-_.transform[1]/_.transform[2],width:_.width/_.transform[2],height:_.height/_.transform[2]},J=!1;for(let q of _.nodeLookup.values())if(!q.hidden){J=!0;break}return{viewBB:Q,boundingRect:J?j6(j2(_.nodeLookup,{filter:KZ}),Q):Q,rfId:_.rfId,panZoom:_.panZoom,translateExtent:_.translateExtent,flowWidth:_.width,flowHeight:_.height,ariaLabelConfig:_.ariaLabelConfig}},m9=(_,Q)=>_.x===Q.x&&_.y===Q.y&&_.width===Q.width&&_.height===Q.height,LZ=(_,Q)=>m9(_.viewBB,Q.viewBB)&&m9(_.boundingRect,Q.boundingRect)&&_.rfId===Q.rfId&&_.panZoom===Q.panZoom&&_.translateExtent===Q.translateExtent&&_.flowWidth===Q.flowWidth&&_.flowHeight===Q.flowHeight&&_.ariaLabelConfig===Q.ariaLabelConfig,zZ="react-flow__minimap-desc";function f_({style:_,className:Q,nodeStrokeColor:J,nodeColor:q,nodeClassName:U="",nodeBorderRadius:G=5,nodeStrokeWidth:Z,nodeComponent:F,bgColor:X,maskColor:Y,maskStrokeColor:K,maskStrokeWidth:H,position:L="bottom-right",onClick:z,onNodeClick:W,pannable:w=!1,zoomable:R=!1,ariaLabel:A,inversePan:O,zoomStep:B=1,offsetScale:M=5}){let P=b1(),C=d.useRef(null),{boundingRect:f,panZoom:v,viewBB:N,rfId:k,translateExtent:u,flowWidth:i,flowHeight:l,ariaLabelConfig:S}=N1(YZ,LZ),b=_?.width??HZ,h=_?.height??XZ,E=f.width/b,j=f.height/h,m=Math.max(E,j),I=m*b,V=m*h,D=M*m,y=f.x-(I-f.width)/2-D,t=f.y-(V-f.height)/2-D,_1=I+D*2,a=V+D*2,o=`${zZ}-${k}`,p=d.useRef(0),e=d.useRef();p.current=m,d.useEffect(()=>{let W1=P.getState().panZoom;if(C.current&&W1)return e.current=t7({domNode:C.current,panZoom:W1,getTransform:()=>P.getState().transform,getViewScale:()=>p.current}),()=>{e.current?.destroy()}},[v]),d.useEffect(()=>{e.current?.update({translateExtent:u,width:i,height:l,inversePan:O,pannable:w,zoomStep:B,zoomable:R})},[w,R,O,B,u,i,l]);let $1=z?(W1)=>{let[Y1,n]=e.current?.pointer(W1)||[0,0];z(W1,{x:Y1,y:n})}:void 0,U1=d.useCallback((W1,Y1)=>{let n=P.getState().nodeLookup.get(Y1).internals.userNode;W?.(W1,n)},[W]),q1=W?U1:void 0,K1=A??S["minimap.ariaLabel"];return r.jsx(m0,{position:L,style:{..._,"--xy-minimap-background-color-props":typeof X==="string"?X:void 0,"--xy-minimap-mask-background-color-props":typeof Y==="string"?Y:void 0,"--xy-minimap-mask-stroke-color-props":typeof K==="string"?K:void 0,"--xy-minimap-mask-stroke-width-props":typeof H==="number"?H*m:void 0,"--xy-minimap-node-background-color-props":typeof q==="string"?q:void 0,"--xy-minimap-node-stroke-color-props":typeof J==="string"?J:void 0,"--xy-minimap-node-stroke-width-props":typeof Z==="number"?Z:void 0},className:m1(["react-flow__minimap",Q]),"data-testid":"rf__minimap",children:r.jsxs("svg",{width:b,height:h,viewBox:`${y} ${t} ${_1} ${a}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":o,ref:C,onClick:$1,children:[K1&&r.jsx("title",{id:o,children:K1}),r.jsx(FZ,{onClick:q1,nodeColor:q,nodeStrokeColor:J,nodeBorderRadius:G,nodeClassName:U,nodeStrokeWidth:Z,nodeComponent:F}),r.jsx("path",{className:"react-flow__minimap-mask",d:`M${y-D},${t-D}h${_1+D*2}v${a+D*2}h${-_1-D*2}z
|
|
34
|
+
M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}f_.displayName="MiniMap";var C_=d.memo(f_),WZ=(_)=>(Q)=>_?`${Math.max(1/Q.transform[2],1)}`:void 0,BZ={[t0.Line]:"right",[t0.Handle]:"bottom-right"};function AZ({nodeId:_,position:Q,variant:J=t0.Handle,className:q,style:U=void 0,children:G,color:Z,minWidth:F=10,minHeight:X=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:K=Number.MAX_VALUE,keepAspectRatio:H=!1,resizeDirection:L,autoScale:z=!0,shouldResize:W,onResizeStart:w,onResize:R,onResizeEnd:A}){let O=_8(),B=typeof _==="string"?_:O,M=b1(),P=d.useRef(null),C=J===t0.Handle,f=N1(d.useCallback(WZ(C&&z),[C,z]),D1),v=d.useRef(null),N=Q??BZ[J];d.useEffect(()=>{if(!P.current||!B)return;if(!v.current)v.current=$9({domNode:P.current,nodeId:B,getStoreItems:()=>{let{nodeLookup:u,transform:i,snapGrid:l,snapToGrid:S,nodeOrigin:b,domNode:h}=M.getState();return{nodeLookup:u,transform:i,snapGrid:l,snapToGrid:S,nodeOrigin:b,paneDomNode:h}},onChange:(u,i)=>{let{triggerNodeChanges:l,nodeLookup:S,parentLookup:b,nodeOrigin:h}=M.getState(),E=[],j={x:u.x,y:u.y},m=S.get(B);if(m&&m.expandParent&&m.parentId){let I=m.origin??h,V=u.width??m.measured.width??0,D=u.height??m.measured.height??0,y={id:m.id,parentId:m.parentId,rect:{width:V,height:D,...D6({x:u.x??m.position.x,y:u.y??m.position.y},{width:V,height:D},m.parentId,S,I)}},t=V4([y],S,b,h);E.push(...t),j.x=u.x?Math.max(I[0]*V,u.x):void 0,j.y=u.y?Math.max(I[1]*D,u.y):void 0}if(j.x!==void 0&&j.y!==void 0){let I={id:B,type:"position",position:{...j}};E.push(I)}if(u.width!==void 0&&u.height!==void 0){let V={id:B,type:"dimensions",resizing:!0,setAttributes:!L?!0:L==="horizontal"?"width":"height",dimensions:{width:u.width,height:u.height}};E.push(V)}for(let I of i){let V={...I,type:"position"};E.push(V)}l(E)},onEnd:({width:u,height:i})=>{let l={id:B,type:"dimensions",resizing:!1,dimensions:{width:u,height:i}};M.getState().triggerNodeChanges([l])}});return v.current.update({controlPosition:N,boundaries:{minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K},keepAspectRatio:H,resizeDirection:L,onResizeStart:w,onResize:R,onResizeEnd:A,shouldResize:W}),()=>{v.current?.destroy()}},[N,F,X,Y,K,H,w,R,A,W]);let k=N.split("-");return r.jsx("div",{className:m1(["react-flow__resize-control","nodrag",...k,J,q]),ref:P,style:{...U,scale:f,...Z&&{[C?"backgroundColor":"borderColor"]:Z}},children:G})}var g9=d.memo(AZ);function S_({nodeId:_,isVisible:Q=!0,handleClassName:J,handleStyle:q,lineClassName:U,lineStyle:G,color:Z,minWidth:F=10,minHeight:X=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:K=Number.MAX_VALUE,keepAspectRatio:H=!1,autoScale:L=!0,shouldResize:z,onResizeStart:W,onResize:w,onResizeEnd:R}){if(!Q)return null;return r.jsxs(r.Fragment,{children:[Q9.map((A)=>r.jsx(g9,{className:U,style:G,nodeId:_,position:A,variant:t0.Line,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:w,onResizeEnd:R},A)),_9.map((A)=>r.jsx(g9,{className:J,style:q,nodeId:_,position:A,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:w,onResizeEnd:R},A))]})}var MZ=(_)=>_.domNode?.querySelector(".react-flow__renderer");function TZ({children:_}){let Q=N1(MZ);if(!Q)return null;return p9.createPortal(_,Q)}var RZ=(_,Q)=>_?.internals.positionAbsolute.x!==Q?.internals.positionAbsolute.x||_?.internals.positionAbsolute.y!==Q?.internals.positionAbsolute.y||_?.measured.width!==Q?.measured.width||_?.measured.height!==Q?.measured.height||_?.selected!==Q?.selected||_?.internals.z!==Q?.internals.z,OZ=(_,Q)=>{if(_.size!==Q.size)return!1;for(let[J,q]of _)if(RZ(q,Q.get(J)))return!1;return!0},IZ=(_)=>({x:_.transform[0],y:_.transform[1],zoom:_.transform[2],selectedNodesCount:_.nodes.filter((Q)=>Q.selected).length});function J8({nodeId:_,children:Q,className:J,style:q,isVisible:U,position:G=F1.Top,offset:Z=10,align:F="center",...X}){let Y=_8(),K=d.useCallback((P)=>{return(Array.isArray(_)?_:[_||Y||""]).reduce((v,N)=>{let k=P.nodeLookup.get(N);if(k)v.set(k.id,k);return v},new Map)},[_,Y]),H=N1(K,OZ),{x:L,y:z,zoom:W,selectedNodesCount:w}=N1(IZ,D1);if(!(typeof U==="boolean"?U:H.size===1&&H.values().next().value?.selected&&w===1)||!H.size)return null;let A=j2(H),O=Array.from(H.values()),B=Math.max(...O.map((P)=>P.internals.z+1)),M={position:"absolute",transform:E7(A,{x:L,y:z,zoom:W},G,Z,F),zIndex:B,...q};return r.jsx(TZ,{children:r.jsx("div",{style:M,className:m1(["react-flow__node-toolbar",J]),...X,"data-id":O.reduce((P,C)=>`${P}${C.id} `,"").trim(),children:Q})})}var o1=_0(u0(),1);var v_={x:{title:"X",fill:"currentColor",d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"},youtube:{title:"YouTube",fill:"#FF0000",d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"},tiktok:{title:"TikTok",fill:"currentColor",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"},discord:{title:"Discord",fill:"#5865F2",d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},resend:{title:"Resend",fill:"currentColor",d:"M2.023 0v24h5.553v-8.434h2.998L15.326 24h6.65l-5.372-9.258a7.652 7.652 0 0 0 3.316-3.016c.709-1.21 1.062-2.57 1.062-4.08 0-1.462-.353-2.767-1.062-3.91-.709-1.165-1.692-2.079-2.95-2.742C15.737.331 14.355 0 12.823 0Zm5.553 4.87h4.219c.731 0 1.349.125 1.851.376.526.252.925.618 1.2 1.098.274.457.412.994.412 1.611S15.132 9.12 14.88 9.6c-.229.48-.572.856-1.03 1.13-.434.252-.948.38-1.542.38H7.576Z"},linkedin:{title:"LinkedIn",fill:"#0A66C2",d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"},reddit:{title:"Reddit",fill:"#FF4500",d:"M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z"},bluesky:{title:"Bluesky",fill:"#0285FF",d:"M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479.815 2.736 3.713 3.66 6.383 3.364.136-.02.275-.039.415-.056-.138.022-.276.04-.415.056-3.912.58-7.387 2.005-2.83 7.078 5.013 5.19 6.87-1.113 7.823-4.308.953 3.195 2.05 9.271 7.733 4.308 4.267-4.308 1.172-6.498-2.74-7.078a8.741 8.741 0 0 1-.415-.056c.14.017.279.036.415.056 2.67.297 5.568-.628 6.383-3.364.246-.828.624-5.79.624-6.478 0-.69-.139-1.861-.902-2.206-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8Z"},instagram:{title:"Instagram",fill:"#FF0069",d:"M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"},github:{title:"GitHub",fill:"currentColor",d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"},stripe:{title:"Stripe",fill:"#635BFF",d:"M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"},slack:{title:"Slack",fill:"#4A154B",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},openai:{title:"OpenAI",fill:"#412991",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},anthropic:{title:"Anthropic",fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"},twilio:{title:"Twilio",fill:"#F22F46",d:"M12 0C5.381-.008.008 5.352 0 11.971V12c0 6.64 5.359 12 12 12 6.64 0 12-5.36 12-12 0-6.641-5.36-12-12-12zm0 20.801c-4.846.015-8.786-3.904-8.801-8.75V12c-.014-4.846 3.904-8.786 8.75-8.801H12c4.847-.014 8.786 3.904 8.801 8.75V12c.015 4.847-3.904 8.786-8.75 8.801H12zm5.44-11.76c0 1.359-1.12 2.479-2.481 2.479-1.366-.007-2.472-1.113-2.479-2.479 0-1.361 1.12-2.481 2.479-2.481 1.361 0 2.481 1.12 2.481 2.481zm0 5.919c0 1.36-1.12 2.48-2.481 2.48-1.367-.008-2.473-1.114-2.479-2.48 0-1.359 1.12-2.479 2.479-2.479 1.361-.001 2.481 1.12 2.481 2.479zm-5.919 0c0 1.36-1.12 2.48-2.479 2.48-1.368-.007-2.475-1.113-2.481-2.48 0-1.359 1.12-2.479 2.481-2.479 1.358-.001 2.479 1.12 2.479 2.479zm0-5.919c0 1.359-1.12 2.479-2.479 2.479-1.367-.007-2.475-1.112-2.481-2.479 0-1.361 1.12-2.481 2.481-2.481 1.358 0 2.479 1.12 2.479 2.481z"},sendgrid:{title:"SendGrid",fill:"#51A9E3",d:"M.8 24h13.6c.88 0 1.6-.72 1.6-1.6v-4.8c0-.88-.72-1.6-1.6-1.6H9.6c-.88 0-1.6-.72-1.6-1.6V9.6C8 8.72 7.28 8 6.4 8H1.6C.72 8 0 8.72 0 9.6v13.6c0 .44.36.8.8.8zM23.2 0H9.6C8.72 0 8 .72 8 1.6v4.8C8 7.28 8.72 8 9.6 8h4.8c.88 0 1.6.72 1.6 1.6v4.8c0 .88.72 1.6 1.6 1.6h4.8c.88 0 1.6-.72 1.6-1.6V.8c0-.44-.36-.8-.8-.8Z"},mailgun:{title:"Mailgun",fill:"#F06B66",d:"M11.837 0c6.602 0 11.984 5.381 11.984 11.994-.017 2.99-3.264 4.84-5.844 3.331a3.805 3.805 0 0 1-.06-.035l-.055-.033-.022.055c-2.554 4.63-9.162 4.758-11.894.232-2.732-4.527.46-10.313 5.746-10.416a6.868 6.868 0 0 1 7.002 6.866 1.265 1.265 0 0 0 2.52 0c0-5.18-4.197-9.38-9.377-9.387C4.611 2.594.081 10.41 3.683 16.673c3.238 5.632 11.08 6.351 15.289 1.402l1.997 1.686A11.95 11.95 0 0 1 11.837 24C2.6 23.72-2.87 13.543 1.992 5.684A12.006 12.006 0 0 1 11.837 0Zm0 7.745c-3.276-.163-5.5 3.281-4.003 6.2a4.26 4.26 0 0 0 4.014 2.31c3.276-.171 5.137-3.824 3.35-6.575a4.26 4.26 0 0 0-3.36-1.935Zm0 2.53c1.324 0 2.152 1.433 1.49 2.58a1.72 1.72 0 0 1-1.49.86 1.72 1.72 0 1 1 0-3.44Z"},notion:{title:"Notion",fill:"currentColor",d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"},linear:{title:"Linear",fill:"#5E6AD2",d:"M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"},jira:{title:"Jira",fill:"#0052CC",d:"M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.758a1.001 1.001 0 0 0-1.001-1.001zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.001 1.001 0 0 0 23.013 0Z"},hubspot:{title:"HubSpot",fill:"#FF7A59",d:"M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z"},paypal:{title:"PayPal",fill:"#003087",d:"M7.016 19.198h-4.2a.562.562 0 0 1-.555-.65L5.093.584A.692.692 0 0 1 5.776 0h7.222c3.417 0 5.904 2.488 5.846 5.5-.006.25-.027.5-.066.747A6.794 6.794 0 0 1 12.071 12H8.743a.69.69 0 0 0-.682.583l-.325 2.056-.013.083-.692 4.39-.015.087zM19.79 6.142c-.01.087-.01.175-.023.261a7.76 7.76 0 0 1-7.695 6.598H9.007l-.283 1.795-.013.083-.692 4.39-.134.843-.014.088H6.86l-.497 3.15a.562.562 0 0 0 .555.65h3.612c.34 0 .63-.249.683-.585l.952-6.031a.692.692 0 0 1 .683-.584h2.126a6.793 6.793 0 0 0 6.707-5.752c.306-1.95-.466-3.744-1.89-4.906z"},shopify:{title:"Shopify",fill:"#7AB55C",d:"M15.337 23.979l7.216-1.561s-2.604-17.613-2.625-17.73c-.018-.116-.114-.192-.211-.192s-1.929-.136-1.929-.136-1.275-1.274-1.439-1.411c-.045-.037-.075-.057-.121-.074l-.914 21.104h.023zM11.71 11.305s-.81-.424-1.774-.424c-1.447 0-1.504.906-1.504 1.141 0 1.232 3.24 1.715 3.24 4.629 0 2.295-1.44 3.76-3.406 3.76-2.354 0-3.54-1.465-3.54-1.465l.646-2.086s1.245 1.066 2.28 1.066c.675 0 .975-.545.975-.932 0-1.619-2.654-1.694-2.654-4.359-.034-2.237 1.571-4.416 4.827-4.416 1.257 0 1.875.361 1.875.361l-.945 2.715-.02.01zM11.17.83c.136 0 .271.038.405.135-.984.465-2.064 1.639-2.508 3.992-.656.213-1.293.405-1.889.578C7.697 3.75 8.951.84 11.17.84V.83zm1.235 2.949v.135c-.754.232-1.583.484-2.394.736.466-1.777 1.333-2.645 2.085-2.971.193.501.309 1.176.309 2.1zm.539-2.234c.694.074 1.141.867 1.429 1.755-.349.114-.735.231-1.158.366v-.252c0-.752-.096-1.371-.271-1.871v.002zm2.992 1.289c-.02 0-.06.021-.078.021s-.289.075-.714.21c-.423-1.233-1.176-2.37-2.508-2.37h-.115C12.135.209 11.669 0 11.265 0 8.159 0 6.675 3.877 6.21 5.846c-1.194.365-2.063.636-2.16.674-.675.213-.694.232-.772.87-.075.462-1.83 14.063-1.83 14.063L15.009 24l.927-21.166z"},sentry:{title:"Sentry",fill:"#362D59",d:"M13.91 2.505c-.873-1.448-2.972-1.448-3.844 0L6.904 7.92a15.478 15.478 0 0 1 8.53 12.811h-2.221A13.301 13.301 0 0 0 5.784 9.814l-2.926 5.06a7.65 7.65 0 0 1 4.435 5.848H2.194a.365.365 0 0 1-.298-.534l1.413-2.402a5.16 5.16 0 0 0-1.614-.913L.296 19.275a2.182 2.182 0 0 0 .812 2.999 2.24 2.24 0 0 0 1.086.288h6.983a9.322 9.322 0 0 0-3.845-8.318l1.11-1.922a11.47 11.47 0 0 1 4.95 10.24h5.915a17.242 17.242 0 0 0-7.885-15.28l2.244-3.845a.37.37 0 0 1 .504-.13c.255.14 9.75 16.708 9.928 16.9a.365.365 0 0 1-.327.543h-2.287c.029.612.029 1.223 0 1.831h2.297a2.206 2.206 0 0 0 1.922-3.31z"},vercel:{title:"Vercel",fill:"currentColor",d:"M24 22.525H0l12-21.05 12 21.05z"},supabase:{title:"Supabase",fill:"#3FCF8E",d:"M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"},clerk:{title:"Clerk",fill:"#6C47FF",d:"m21.47 20.829-2.881-2.881a.572.572 0 0 0-.7-.084 6.854 6.854 0 0 1-7.081 0 .576.576 0 0 0-.7.084l-2.881 2.881a.576.576 0 0 0-.103.69.57.57 0 0 0 .166.186 12 12 0 0 0 14.113 0 .58.58 0 0 0 .239-.423.576.576 0 0 0-.172-.453Zm.002-17.668-2.88 2.88a.569.569 0 0 1-.701.084A6.857 6.857 0 0 0 8.724 8.08a6.862 6.862 0 0 0-1.222 3.692 6.86 6.86 0 0 0 .978 3.764.573.573 0 0 1-.083.699l-2.881 2.88a.567.567 0 0 1-.864-.063A11.993 11.993 0 0 1 6.771 2.7a11.99 11.99 0 0 1 14.637-.405.566.566 0 0 1 .232.418.57.57 0 0 1-.168.448Zm-7.118 12.261a3.427 3.427 0 1 0 0-6.854 3.427 3.427 0 0 0 0 6.854Z"},aws:{title:"Amazon Web Services",fill:"#232F3E",d:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167zM21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zM22.792 14.961c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z"},figma:{title:"Figma",fill:"#F24E1E",d:"M15.852 8.981h-4.588V0h4.588c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.491-4.49 4.491zM12.735 7.51h3.117c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-3.117V7.51zm0 1.471H8.148c-2.476 0-4.49-2.014-4.49-4.49S5.672 0 8.148 0h4.588v8.981zm-4.587-7.51c-1.665 0-3.019 1.355-3.019 3.019s1.354 3.02 3.019 3.02h3.117V1.471H8.148zm4.587 15.019H8.148c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h4.588v8.98zM8.148 8.981c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h3.117V8.981H8.148zM8.172 24c-2.489 0-4.515-2.014-4.515-4.49s2.014-4.49 4.49-4.49h4.588v4.441c0 2.503-2.047 4.539-4.563 4.539zm-.024-7.51a3.023 3.023 0 0 0-3.019 3.019c0 1.665 1.365 3.019 3.044 3.019 1.705 0 3.093-1.376 3.093-3.068v-2.97H8.148zm7.704 0h-.098c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h.098c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.49-4.49 4.49zm-.097-7.509c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h.098c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-.098z"},airtable:{title:"Airtable",fill:"#18BFFF",d:"M11.992 1.966c-.434 0-.87.086-1.28.257L1.779 5.917c-.503.208-.49.908.012 1.116l8.982 3.558a3.266 3.266 0 0 0 2.454 0l8.982-3.558c.503-.196.503-.908.012-1.116l-8.957-3.694a3.255 3.255 0 0 0-1.272-.257zM23.4 8.056a.589.589 0 0 0-.222.045l-10.012 3.877a.612.612 0 0 0-.38.564v8.896a.6.6 0 0 0 .821.552L23.62 18.1a.583.583 0 0 0 .38-.551V8.653a.6.6 0 0 0-.6-.596zM.676 8.095a.644.644 0 0 0-.48.19C.086 8.396 0 8.53 0 8.69v8.355c0 .442.515.737.908.54l6.27-3.006.307-.147 2.969-1.436c.466-.22.43-.908-.061-1.092L.883 8.138a.57.57 0 0 0-.207-.044z"},intercom:{title:"Intercom",fill:"#6AFDEF",d:"M21 0H3C1.343 0 0 1.343 0 3v18c0 1.658 1.343 3 3 3h18c1.658 0 3-1.342 3-3V3c0-1.657-1.342-3-3-3zm-5.801 4.399c0-.44.36-.8.802-.8.44 0 .8.36.8.8v10.688c0 .442-.36.801-.8.801-.443 0-.802-.359-.802-.801V4.399zM11.2 3.994c0-.44.357-.799.8-.799s.8.359.8.799v11.602c0 .44-.357.8-.8.8s-.8-.36-.8-.8V3.994zm-4 .405c0-.44.359-.8.799-.8.443 0 .802.36.802.8v10.688c0 .442-.36.801-.802.801-.44 0-.799-.359-.799-.801V4.399zM3.199 6c0-.442.36-.8.802-.8.44 0 .799.358.799.8v7.195c0 .441-.359.8-.799.8-.443 0-.802-.36-.802-.8V6zM20.52 18.202c-.123.105-3.086 2.593-8.52 2.593-5.433 0-8.397-2.486-8.521-2.593-.335-.288-.375-.792-.086-1.128.285-.334.79-.375 1.125-.09.047.041 2.693 2.211 7.481 2.211 4.848 0 7.456-2.186 7.479-2.207.334-.289.839-.25 1.128.086.289.336.25.84-.086 1.128zm.281-5.007c0 .441-.36.8-.801.8-.441 0-.801-.36-.801-.8V6c0-.442.361-.8.801-.8.441 0 .801.357.801.8v7.195z"},posthog:{title:"PostHog",fill:"currentColor",d:"M9.854 14.5 5 9.647.854 5.5A.5.5 0 0 0 0 5.854V8.44a.5.5 0 0 0 .146.353L5 13.647l.147.146L9.854 18.5l.146.147v-.049c.065.03.134.049.207.049h2.586a.5.5 0 0 0 .353-.854L9.854 14.5zm0-5-4-4a.487.487 0 0 0-.409-.144.515.515 0 0 0-.356.21.493.493 0 0 0-.089.288V8.44a.5.5 0 0 0 .147.353l9 9a.5.5 0 0 0 .853-.354v-2.585a.5.5 0 0 0-.146-.354l-5-5zm1-4a.5.5 0 0 0-.854.354V8.44a.5.5 0 0 0 .147.353l4 4a.5.5 0 0 0 .853-.354V9.854a.5.5 0 0 0-.146-.354l-4-4zm12.647 11.515a3.863 3.863 0 0 1-2.232-1.1l-4.708-4.707a.5.5 0 0 0-.854.354v6.585a.5.5 0 0 0 .5.5H23.5a.5.5 0 0 0 .5-.5v-.6c0-.276-.225-.497-.499-.532zm-5.394.032a.8.8 0 1 1 0-1.6.8.8 0 0 1 0 1.6zM.854 15.5a.5.5 0 0 0-.854.354v2.293a.5.5 0 0 0 .5.5h2.293c.222 0 .39-.135.462-.309a.493.493 0 0 0-.109-.545L.854 15.501zM5 14.647.854 10.5a.5.5 0 0 0-.854.353v2.586a.5.5 0 0 0 .146.353L4.854 18.5l.146.147h2.793a.5.5 0 0 0 .353-.854L5 14.647z"},datadog:{title:"Datadog",fill:"#632CA6",d:"M19.57 17.04l-1.997-1.316-1.665 2.782-1.937-.567-1.706 2.604.087.82 9.274-1.71-.538-5.794zm-8.649-2.498l1.488-.204c.241.108.409.15.697.223.45.117.97.23 1.741-.16.18-.088.553-.43.704-.625l6.096-1.106.622 7.527-10.444 1.882zm11.325-2.712l-.602.115L20.488 0 .789 2.285l2.427 19.693 2.306-.334c-.184-.263-.471-.581-.96-.989-.68-.564-.44-1.522-.039-2.127.53-1.022 3.26-2.322 3.106-3.956-.056-.594-.15-1.368-.702-1.898-.02.22.017.432.017.432s-.227-.289-.34-.683c-.112-.15-.2-.199-.319-.4-.085.233-.073.503-.073.503s-.186-.437-.216-.807c-.11.166-.137.48-.137.48s-.241-.69-.186-1.062c-.11-.323-.436-.965-.343-2.424.6.421 1.924.321 2.44-.439.171-.251.288-.939-.086-2.293-.24-.868-.835-2.16-1.066-2.651l-.028.02c.122.395.374 1.223.47 1.625.293 1.218.372 1.642.234 2.204-.116.488-.397.808-1.107 1.165-.71.358-1.653-.514-1.713-.562-.69-.55-1.224-1.447-1.284-1.883-.062-.477.275-.763.445-1.153-.243.07-.514.192-.514.192s.323-.334.722-.624c.165-.109.262-.178.436-.323a9.762 9.762 0 0 0-.456.003s.42-.227.855-.392c-.318-.014-.623-.003-.623-.003s.937-.419 1.678-.727c.509-.208 1.006-.147 1.286.257.367.53.752.817 1.569.996.501-.223.653-.337 1.284-.509.554-.61.99-.688.99-.688s-.216.198-.274.51c.314-.249.66-.455.66-.455s-.134.164-.259.426l.03.043c.366-.22.797-.394.797-.394s-.123.156-.268.358c.277-.002.838.012 1.056.037 1.285.028 1.552-1.374 2.045-1.55.618-.22.894-.353 1.947.68.903.888 1.609 2.477 1.259 2.833-.294.295-.874-.115-1.516-.916a3.466 3.466 0 0 1-.716-1.562 1.533 1.533 0 0 0-.497-.85s.23.51.23.96c0 .246.03 1.165.424 1.68-.039.076-.057.374-.1.43-.458-.554-1.443-.95-1.604-1.067.544.445 1.793 1.468 2.273 2.449.453.927.186 1.777.416 1.997.065.063.976 1.197 1.15 1.767.306.994.019 2.038-.381 2.685l-1.117.174c-.163-.045-.273-.068-.42-.153.08-.143.241-.5.243-.572l-.063-.111c-.348.492-.93.97-1.414 1.245-.633.359-1.363.304-1.838.156-1.348-.415-2.623-1.327-2.93-1.566 0 0-.01.191.048.234.34.383 1.119 1.077 1.872 1.56l-1.605.177.759 5.908c-.337.048-.39.071-.757.124-.325-1.147-.946-1.895-1.624-2.332-.599-.384-1.424-.47-2.214-.314l-.05.059a2.851 2.851 0 0 1 1.863.444c.654.413 1.181 1.481 1.375 2.124.248.822.42 1.7-.248 2.632-.476.662-1.864 1.028-2.986.237.3.481.705.876 1.25.95.809.11 1.577-.03 2.106-.574.452-.464.69-1.434.628-2.456l.714-.104.258 1.834 11.827-1.424zM15.05 6.848c-.034.075-.085.125-.007.37l.004.014.013.032.032.073c.14.287.295.558.552.696.067-.011.136-.019.207-.023.242-.01.395.028.492.08.009-.048.01-.119.005-.222-.018-.364.072-.982-.626-1.308-.264-.122-.634-.084-.757.068a.302.302 0 0 1 .058.013c.186.066.06.13.027.207m1.958 3.392c-.092-.05-.52-.03-.821.005-.574.068-1.193.267-1.328.372-.247.191-.135.523.047.66.511.382.96.638 1.432.575.29-.038.546-.497.728-.914.124-.288.124-.598-.058-.698m-5.077-2.942c.162-.154-.805-.355-1.556.156-.554.378-.571 1.187-.041 1.646.053.046.096.078.137.104a4.77 4.77 0 0 1 1.396-.412c.113-.125.243-.345.21-.745-.044-.542-.455-.456-.146-.749"},algolia:{title:"Algolia",fill:"#003DFF",d:"M12 0C5.445 0 .103 5.285.01 11.817c-.097 6.634 5.285 12.131 11.92 12.17a11.91 11.91 0 0 0 5.775-1.443.281.281 0 0 0 .052-.457l-1.122-.994a.79.79 0 0 0-.833-.14 9.693 9.693 0 0 1-3.923.77c-5.36-.067-9.692-4.527-9.607-9.888.084-5.293 4.417-9.573 9.73-9.573h9.73v17.296l-5.522-4.907a.407.407 0 0 0-.596.063 4.52 4.52 0 0 1-3.934 1.793 4.538 4.538 0 0 1-4.192-4.168 4.53 4.53 0 0 1 4.512-4.872 4.532 4.532 0 0 1 4.509 4.126c.018.205.11.397.265.533l1.438 1.275a.28.28 0 0 0 .462-.158 6.82 6.82 0 0 0 .099-1.725c-.232-3.376-2.966-6.092-6.345-6.3-3.873-.24-7.11 2.79-7.214 6.588-.1 3.7 2.933 6.892 6.634 6.974a6.75 6.75 0 0 0 4.136-1.294l7.212 6.394a.48.48 0 0 0 .797-.36V.456A.456.456 0 0 0 23.54 0Z"},cloudflare:{title:"Cloudflare",fill:"#F38020",d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"},upstash:{title:"Upstash",fill:"#00E9A3",d:"M13.8027 0C11.193 0 8.583.9952 6.5918 2.9863c-3.9823 3.9823-3.9823 10.4396 0 14.4219 1.9911 1.9911 5.2198 1.9911 7.211 0 1.991-1.9911 1.991-5.2198 0-7.211L12 12c.9956.9956.9956 2.6098 0 3.6055-.9956.9955-2.6099.9955-3.6055 0-2.9866-2.9868-2.9866-7.8297 0-10.8164 2.9868-2.9868 7.8297-2.9868 10.8164 0l1.8028-1.8028C19.0225.9952 16.4125 0 13.8027 0zM12 12c-.9956-.9956-.9956-2.6098 0-3.6055.9956-.9955 2.6098-.9955 3.6055 0 2.9867 2.9868 2.9867 7.8297 0 10.8164-2.9867 2.9868-7.8297 2.9868-10.8164 0l-1.8028 1.8028c3.9823 3.9822 10.4396 3.9822 14.4219 0 3.9823-3.9824 3.9823-10.4396 0-14.4219-.9956-.9956-2.3006-1.4922-3.6055-1.4922-1.3048 0-2.6099.4966-3.6054 1.4922-1.9912 1.9912-1.9912 5.2198 0 7.211z"},mixpanel:{title:"Mixpanel",fill:"#7856FF",d:"M6.967 9.996h3.053c-.763-.477-1.048-1.145-1.431-2.384L7.443 3.366C6.919 1.458 6.49.551 4.39.551H.004v1.145h.621c1.286 0 1.431.477 1.814 1.908L3.44 7.326c.524 1.814 1.337 2.67 3.53 2.67h-.003Zm7.06 0h3.053c2.194 0 2.956-.86 3.484-2.67l1.001-3.722c.382-1.431.57-1.908 1.814-1.908H24V.551h-4.34c-2.146 0-2.576.86-3.053 2.815l-1.145 4.246c-.384 1.286-.673 1.907-1.435 2.384Zm-4.007 4.008h4.007V9.996H10.02v4.008ZM0 23.449h4.39c2.1 0 2.529-.907 3.053-2.815l1.146-4.246c.383-1.239.668-1.907 1.431-2.384H6.967c-2.194 0-3.007.86-3.531 2.67l-1.001 3.722c-.383 1.431-.524 1.907-1.814 1.907H0v1.146Zm19.65 0h4.343v-1.146h-.622c-1.239 0-1.431-.476-1.814-1.907l-1.001-3.722c-.524-1.814-1.286-2.67-3.483-2.67h-3.046c.762.477 1.041 1.098 1.424 2.384l1.145 4.246c.477 1.955.907 2.815 3.054 2.815Z"},gemini:{title:"Google Gemini",fill:"#8E75B2",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"}};var z1=_0(l5(),1),PZ="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function i5({href:_,onClick:Q}){return z1.jsxDEV("h1",{children:z1.jsxDEV("a",{href:_,onClick:Q,children:[z1.jsxDEV("img",{src:PZ,alt:"",width:24,height:24,style:{verticalAlign:"middle"}},void 0,!1,void 0,this),z1.jsxDEV("span",{className:"brand-name",children:" Volter World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}async function n0(_){return(await _.json().catch(()=>({}))).error??`answered ${_.status}`}function y_(_,Q,J=0,q=""){let[U,G]=o1.useState({state:"loading"});return o1.useEffect(()=>{G({state:"loading"})},[q,Q]),o1.useEffect(()=>{if(!Q)return;let Z=!0;return(async()=>{try{let F=await _(Q),X=F.ok?{state:"ok",data:await F.json()}:{state:"error",status:F.status,error:await n0(F)};if(Z)G(X)}catch(F){if(Z)G({state:"error",status:0,error:String(F)})}})(),()=>{Z=!1}},[q,Q,J]),U}function U0({load:_,what:Q,retry:J,lines:q=3}){if(_.state==="loading")return z1.jsxDEV(NZ,{lines:q,label:`Loading ${Q}…`},void 0,!1,void 0,this);if(_.state==="error")return z1.jsxDEV("div",{role:"alert",className:"error-state",children:[z1.jsxDEV("span",{children:["Could not read ",Q,": ",_.error]},void 0,!0,void 0,this),J?z1.jsxDEV("button",{type:"button",onClick:J,children:"Try again"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return null}function NZ({lines:_=3,label:Q="Loading…"}){return z1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":Q,children:Array.from({length:_},(J,q)=>z1.jsxDEV("span",{style:{width:`${[92,76,84,64,88][q%5]}%`}},q,!1,void 0,this))},void 0,!1,void 0,this)}function V1({iso:_,time:Q}){if(!_)return z1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let J=new Date(_);return z1.jsxDEV("time",{dateTime:_,title:_,children:Number.isNaN(J.getTime())?_:Q?J.toLocaleTimeString():J.toLocaleString()},void 0,!1,void 0,this)}var h2=(_)=>_?new Date(_).toLocaleString():"—";function U8(_){let Q=_?Date.parse(_):Number.NaN;if(Number.isNaN(Q))return"—";let J=Math.max(0,Math.round((Date.now()-Q)/1000));return J<60?"just now":J<3600?`${Math.round(J/60)}m ago`:J<86400?`${Math.round(J/3600)}h ago`:`${Math.round(J/86400)}d ago`}function E1(_,Q){let J=Q.replace(/[_-]+/g," "),q=J.endsWith("s")?J:/[^aeiou]y$/.test(J)?`${J.slice(0,-1)}ies`:/(ch|sh|x)$/.test(J)?`${J}es`:`${J}s`;return`${_} ${_===1?J:q}`}var D2=(_)=>_.length<=1?_.join(""):`${_.slice(0,-1).join(", ")} and ${_[_.length-1]}`,fZ={github:"GitHub",openai:"OpenAI",aws:"AWS",hubspot:"HubSpot",paypal:"PayPal",youtube:"YouTube",tiktok:"TikTok",linkedin:"LinkedIn",xai:"xAI",sendgrid:"SendGrid",elevenlabs:"ElevenLabs",assemblyai:"AssemblyAI",planetscale:"PlanetScale",googleoauth:"Google sign-in",npm:"npm","npm-registry":"npm registry",posthog:"PostHog",mongodb:"MongoDB",pagerduty:"PagerDuty",mailgun:"Mailgun",turbopuffer:"turbopuffer"},B1=(_)=>fZ[_]??_.charAt(0).toUpperCase()+_.slice(1);function l1({vendor:_}){let Q=v_[_];return z1.jsxDEV("span",{className:Q?"mark logo":"mark","aria-hidden":"true",children:Q?z1.jsxDEV("svg",{viewBox:"0 0 24 24",children:z1.jsxDEV("path",{d:Q.d,fill:Q.fill},void 0,!1,void 0,this)},void 0,!1,void 0,this):B1(_).charAt(0)},void 0,!1,void 0,this)}var k_=(_)=>{_.currentTarget.closest("details")?.removeAttribute("open")},CZ="volter.theme",G8=()=>{try{let _=localStorage.getItem(CZ);return _==="light"||_==="dark"?_:"system"}catch{return"system"}};function j_(_=G8()){let Q=document.documentElement;if(_==="system")Q.removeAttribute("data-theme");else Q.setAttribute("data-theme",_)}function V_(){return o1.useEffect(()=>{let _=()=>[...document.querySelectorAll("details.menu[open], details.clock-more[open]")],Q=(q)=>{if(q.key!=="Escape"||document.querySelector("dialog[open]"))return;let U=_();if(!U.length)return;for(let G of U)G.removeAttribute("open");U[U.length-1].querySelector("summary")?.focus()},J=(q)=>{let U=q.target;for(let G of _())if(!U||!G.contains(U))G.removeAttribute("open")};return document.addEventListener("keydown",Q),document.addEventListener("click",J),()=>{document.removeEventListener("keydown",Q),document.removeEventListener("click",J)}},[]),null}function W0({open:_,onClose:Q,title:J,children:q,footer:U,wide:G}){let Z=o1.useRef(null),F=o1.useId();return o1.useEffect(()=>{let X=Z.current;if(!X)return;if(_&&!X.open){X.showModal();let Y=X.querySelector(".dialog-body :is(input:not([type=hidden]):not([disabled]), select, textarea)");if(Y?.focus(),Y instanceof HTMLInputElement&&Y.value&&/^(text|search|email|url)$/.test(Y.type))Y.select()}if(!_&&X.open)X.close()},[_]),z1.jsxDEV("dialog",{ref:Z,className:G==="window"?"dialog window":G?"dialog wide":"dialog","aria-labelledby":F,onClose:Q,onCancel:(X)=>{X.preventDefault(),Q()},onMouseDown:(X)=>{if(X.target===Z.current)Q()},children:_?z1.jsxDEV(z1.Fragment,{children:[z1.jsxDEV("div",{className:"dialog-head",children:[z1.jsxDEV("h2",{id:F,children:J},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Close",onClick:Q,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z1.jsxDEV("div",{className:"dialog-body",children:q},void 0,!1,void 0,this),U?z1.jsxDEV("div",{className:"dialog-foot",children:U},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)}var $8="volter:confirm";function g0(_){return new Promise((Q)=>{window.dispatchEvent(new CustomEvent($8,{detail:{ask:_,resolve:Q}}))})}function u_(){let[_,Q]=o1.useState(null),[J,q]=o1.useState("");o1.useEffect(()=>{let F=(X)=>{q(""),Q(X.detail)};return window.addEventListener($8,F),()=>window.removeEventListener($8,F)},[]);let U=(F)=>{_?.resolve(F),Q(null)},G=_?.ask,Z=!G?.typed||J===G.typed;return z1.jsxDEV(W0,{open:Boolean(_),onClose:()=>U(!1),title:G?.title??"",footer:z1.jsxDEV(z1.Fragment,{children:[z1.jsxDEV("button",{type:"button",onClick:()=>U(!1),children:"Cancel"},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",className:G?.danger?"danger-button":"primary",disabled:!Z,onClick:()=>U(!0),children:G?.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[G?.body?z1.jsxDEV("div",{className:"confirm-body",children:G.body},void 0,!1,void 0,this):null,G?.typed?z1.jsxDEV("div",{className:"typed-confirm",children:[z1.jsxDEV("p",{children:["Type ",z1.jsxDEV("code",{children:G.typed},void 0,!1,void 0,this)," to confirm."]},void 0,!0,void 0,this),z1.jsxDEV("input",{autoFocus:!0,"aria-label":`Type ${G.typed} to confirm`,value:J,onChange:(F)=>q(F.target.value),onKeyDown:(F)=>{if(F.key==="Enter"&&Z)U(!0)},autoComplete:"off",spellCheck:!1},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}var q8="volter:toast";function g1(_,Q="ok"){window.dispatchEvent(new CustomEvent(q8,{detail:{text:_,kind:Q}}))}function h_(){let[_,Q]=o1.useState([]);return o1.useEffect(()=>{let J=0,q=(U)=>{let{text:G,kind:Z}=U.detail,F=++J;if(Q((X)=>[...X.slice(-3),{id:F,text:G,kind:Z}]),Z!=="error")setTimeout(()=>Q((X)=>X.filter((Y)=>Y.id!==F)),4500)};return window.addEventListener(q8,q),()=>window.removeEventListener(q8,q)},[]),z1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:_.map((J)=>z1.jsxDEV("div",{className:`toast ${J.kind}`,role:J.kind==="error"?"alert":"status",children:[z1.jsxDEV("span",{children:J.text},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Dismiss",onClick:()=>Q((q)=>q.filter((U)=>U.id!==J.id)),children:"✕"},void 0,!1,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)}function Z8({value:_,label:Q,secret:J}){let[q,U]=o1.useState(!1);return z1.jsxDEV("div",{className:"copy-field",children:[Q?z1.jsxDEV("span",{className:"copy-label",children:Q},void 0,!1,void 0,this):null,z1.jsxDEV("div",{className:"copy-row",children:[z1.jsxDEV("input",{readOnly:!0,value:_,"aria-label":Q??"Value",onFocus:(Z)=>Z.currentTarget.select(),spellCheck:!1},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>{U(!0),setTimeout(()=>U(!1),1600),g1(J?"Copied. Keep it somewhere safe":"Copied")}).catch(()=>g1("Your browser would not copy it: select it and copy","error"))},children:q?"Copied":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function D_({label:_,items:Q}){return z1.jsxDEV("details",{className:"menu row-menu",children:[z1.jsxDEV("summary",{className:"icon-button",role:"button","aria-haspopup":"menu","aria-label":_,title:_,children:"⋯"},void 0,!1,void 0,this),z1.jsxDEV("div",{className:"popover menu-list",role:"menu",children:Q.filter((J)=>Boolean(J)).map((J)=>J.href?z1.jsxDEV("a",{role:"menuitem",href:J.href,className:J.danger?"danger-item":void 0,onClick:k_,children:J.label},J.label,!1,void 0,this):z1.jsxDEV("button",{type:"button",role:"menuitem",disabled:J.disabled,className:J.danger?"danger-item":void 0,onClick:(q)=>{k_(q),J.onSelect?.()},children:J.label},J.label,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Z5({title:_,children:Q,action:J}){return z1.jsxDEV("div",{className:"empty-state",children:[z1.jsxDEV("p",{className:"empty-title",children:_},void 0,!1,void 0,this),Q?z1.jsxDEV("div",{className:"empty-body",children:Q},void 0,!1,void 0,this):null,J?z1.jsxDEV("div",{className:"empty-action",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function b_(){return o1.useEffect(()=>{let _=(J)=>{let q=document.querySelector("main.app"),U=J.target;if(q?.hasAttribute("data-drawer")&&U&&!U.closest(".side")&&!U.closest(".drawer-button"))q.removeAttribute("data-drawer")},Q=(J)=>{if(J.key==="Escape")SZ()};return document.addEventListener("click",_),document.addEventListener("keydown",Q),()=>{document.removeEventListener("click",_),document.removeEventListener("keydown",Q)}},[]),z1.jsxDEV("button",{type:"button",className:"icon-button drawer-button","aria-label":"Menu",onClick:()=>{document.querySelector("main.app")?.toggleAttribute("data-drawer")},children:"☰"},void 0,!1,void 0,this)}var SZ=()=>{document.querySelector("main.app")?.removeAttribute("data-drawer")};function c4(_={}){let Q=(q,U)=>_.tools?`${U} (\`${q}\`)`:`\`${q}\``,J=["Set up Volter World for this app, so its calls to Stripe, Slack, GitHub, OpenAI and the other services it uses go to local twins instead of the real APIs. The app keeps its real SDKs and code.","",_.tools?"1. You have the Volter World tools (volter mcp). If the `volter` command is missing, install it: `npm install -g @volter/world`.":"1. Install the command and your agent tooling: `npm install -g @volter/world`, then `volter agents install --yes`.",`2. In the app's folder, ${Q("volter world init --install","world_init")}: it detects the vendors the app calls and installs their twins. Show me the vendors it detected and why, before keeping them.`,`3. ${_.tools?"Start it with world_up":"Start it: `volter world up`"}, then run the tests inside it: ${Q("volter world run -- <the test command>","world_run")}. Fix anything that fails because a call went to the real service.`,`4. Tell me what the app did at each vendor (${Q("volter world log","world_log")}), and give me the dashboard link (${_.tools?"world_view":"`volter world view --no-open`, started in the background: it keeps running"}).`];if(_.platform){let q=_.world??"<org>/<world>";J.push(`5. Share it with my team on ${_.platform}: ${Q(`volter login ${_.platform}`,"platform_login")} gives a link and a code for me to approve in my browser. Once I have, link it with ${Q(`volter remote add origin ${q} --create`,"remote_link with create: true")}${_.world?"":" (ask me for <org>/<world>)"}, then send what the app did: ${Q('volter world changeset -m "<what and why>"',"world_changeset")} and ${Q("volter world push","world_push")}.`)}return J.push("","The guide: https://world.volter.ai/docs/guides/use-with-a-coding-agent.md"),J.join(`
|
|
35
|
+
`)}var E_={"git-commit-horizontal":[["rect",{x:"9",y:"9",width:"6",height:"6"}],["path",{d:"M3 12h6M15 12h6"}]],"arrow-down-to-line":[["path",{d:"M12 17V3"}],["path",{d:"m6 11 6 6 6-6"}],["path",{d:"M19 21H5"}]],"arrow-up-from-line":[["path",{d:"m18 9-6-6-6 6"}],["path",{d:"M12 3v14"}],["path",{d:"M5 21h14"}]],"git-branch":[["rect",{x:"4",y:"3",width:"4",height:"4"}],["rect",{x:"4",y:"17",width:"4",height:"4"}],["rect",{x:"16",y:"5",width:"4",height:"4"}],["path",{d:"M6 7v10M18 9v2a4 4 0 0 1-4 4H6"}]],monitor:[["rect",{x:"3",y:"4",width:"18",height:"13"}],["path",{d:"M8 21h8M12 17v4"}]],vault:[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"6.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 7.9 2.7 2.7"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 10.6 2.7-2.7"}],["rect",{x:"6.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 16.1 2.7-2.7"}],["rect",{x:"15.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 13.4 2.7 2.7"}],["circle",{cx:"12",cy:"12",r:"2"}]],settings:[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"12",cy:"12",r:"7"}],["path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9L7 7M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1"}]],history:[["path",{d:"M3 12a9 9 0 1 0 3-6.7"}],["path",{d:"M3 4v5h5"}],["path",{d:"M12 7v5l3 3"}]],activity:[["path",{d:"M2 12h4l3-8 6 16 3-8h4"}]],"file-diff":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M9 10h6"}],["path",{d:"M12 13V7"}],["path",{d:"M9 17h6"}]],"square-plus":[["rect",{x:"4",y:"4",width:"16",height:"16"}],["path",{d:"M12 8v8M8 12h8"}]],"square-minus":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["path",{d:"M8 12h8"}]],"square-dot":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"10.8",y:"10.8",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],cloud:[["path",{d:"M7 19a5 5 0 0 1-.5-10A6 6 0 0 1 18 8a4.5 4.5 0 0 1 .5 11z"}]],"refresh-cw":[["path",{d:"M20 12a8 8 0 0 1-14.3 4.9M4 12a8 8 0 0 1 14.3-4.9"}],["path",{d:"M19 3v5h-5M5 21v-5h5"}]],clock:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M12 7v5l3 3"}]],"key-round":[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],plug:[["path",{d:"M9 3v5M15 3v5M6 8h12v4a6 6 0 0 1-12 0zM12 18v3"}]],"list-checks":[["path",{d:"M11 6h9M11 12h9M11 18h9"}],["path",{d:"M3 6l1.5 1.5L7 5M3 12l1.5 1.5L7 11M3 18l1.5 1.5L7 17"}]],palette:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}],["rect",{x:"12.3",y:"5.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"16.3",y:"9.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"5.3",y:"11.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"7.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],check:[["path",{d:"M4 12l5 5L20 6"}]],plus:[["path",{d:"M12 4v16M4 12h16"}]],"chevron-down":[["path",{d:"M5 9l7 7 7-7"}]],"external-link":[["path",{d:"M14 4h6v6M20 4l-9 9"}],["path",{d:"M18 14v6H4V6h6"}]],"table-2":[["path",{d:"M3 9h18"}],["path",{d:"M9 3v18"}],["rect",{x:"3",y:"3",width:"18",height:"18"}]],"scroll-text":[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"}]],"layout-grid":[["rect",{x:"4",y:"4",width:"7",height:"7"}],["rect",{x:"13",y:"4",width:"7",height:"7"}],["rect",{x:"4",y:"13",width:"7",height:"7"}],["rect",{x:"13",y:"13",width:"7",height:"7"}]],globe:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"}]],"arrow-left":[["path",{d:"M20 12H5M11 6l-6 6 6 6"}]],link:[["path",{d:"M9 15l6-6"}],["path",{d:"M11 6l2-2a4.2 4.2 0 0 1 6 6l-2 2M13 18l-2 2a4.2 4.2 0 0 1-6-6l2-2"}]],user:[["circle",{cx:"12",cy:"8",r:"4"}],["path",{d:"M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1"}]],"log-out":[["path",{d:"M10 4H4v16h6M9 12h11M16 8l4 4-4 4"}]]};var $=_0(l5(),1),i4="volter.console.token",a5=document.getElementById("root"),A1=a5.dataset.base??"/-/console",y1=window.location.origin,Q2=(a5.dataset.worlds??y1).replace(/\/+$/,""),a_=(a5.dataset.names??"").split(",").filter((_)=>_!==""),_2=a5.dataset.worldOrigin==="1",g2=window.fetch.bind(window),W2="(session)",s_="(pass)",r5=(_)=>{try{if(_&&!_2)sessionStorage.setItem(i4,_);else sessionStorage.removeItem(i4);localStorage.removeItem(i4)}catch{}},t_="volter.console.portal",o_=(_)=>{try{if(typeof _==="string"&&/^https?:$/.test(new URL(_).protocol))sessionStorage.setItem(t_,new URL(_).origin)}catch{}},vZ=()=>{return p2.get("token")??""},G0=()=>{try{let _=sessionStorage.getItem(t_)??"";return _&&/^https?:$/.test(new URL(_).protocol)?new URL(_).origin:""}catch{return""}},kZ=()=>{let _=vZ();if(_2){if(r5(""),p2.get("pass"))return s_;let Q=new URLSearchParams(window.location.search).has("signin");if(Q)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return _||(Q?"":W2)}if(_)return r5(_),_;try{return sessionStorage.getItem(i4)??""}catch{return""}};function d1(_){let Q=_.trim();if(/not ready/i.test(Q)&&/(never verified|not verified|no approvals)/i.test(Q)){let G=[],Z=[];if(/(never verified|not verified)/i.test(Q))G.push("it is not verified yet"),Z.push("verify");if(/no approvals/i.test(Q))G.push("no one has approved it"),Z.push("approve");return{text:`Not ready to deploy: ${D2(G)}.`,acts:Z}}let J=/no credential (?:is )?sealed for ([a-z0-9_-]+)/i.exec(Q);if(J)return{text:`No credential is sealed for ${B1(J[1])}: seal one in Settings › Vault.`,acts:["vault"]};if(/has no origin/i.test(Q))return{text:"This World has no remote: name one in Settings › Remote.",acts:["remote"]};let q=/the ([a-z0-9_-]+) twin has no root/i.exec(Q)??/:\s*([a-z0-9_, -]+?) (?:has|have) no root/i.exec(Q);if(q){let G=q[1].split(/,\s*/).filter(Boolean).map(B1);return{text:`${D2(G)} ${G.length===1?"is":"are"} not connected to ${G.length===1?"its":"their"} real service: Settings › Real services.`,acts:["settings"]}}if(/opening a seal is/i.test(Q))return{text:"A key cannot seal a credential: open the World as yourself.",acts:[]};if(/a key manages no keys/i.test(Q))return{text:"A key cannot manage keys: open the World as yourself.",acts:[]};if(/^PUT origin:/i.test(Q))return{text:"That is not a World's address: https://<host>/<org>/<world>",acts:[]};if(/^clock: \{/i.test(Q))return{text:"Pick a date and time.",acts:[]};if(/^advance: \{/i.test(Q))return{text:"Advance by a number and a unit: 90m, 12h, 3d.",acts:[]};if(/^branches: \{/i.test(Q))return{text:"That branch could not be made: pick now, or an instant before it.",acts:[]};if(/^approve: \{/i.test(Q))return{text:"Name who approves.",acts:[]};if(/a browser deploys only what it names/i.test(Q))return{text:"A deploy is confirmed by its name: use Deploy again.",acts:[]};if(/^no such door/i.test(Q))return{text:"This World does not answer that here.",acts:[]};return{text:Q.replace(/\s*[—–-]+\s*(?:run\s+)?`[^`]*`/g,"").replace(/\s*[—–-]+\s*(?:PUT|POST|GET|DELETE)\s+\/-\/\S+(?:\s*\{[^}]*\})?/g,"").replace(/\s*\(\s*`[^`]*`\s*\)/g,"").replace(/`(?:volter|printf|curl|npm|bun)[^`]*`/g,"").replace(/:\s*\{[^}]*\}/g,"").replace(/\(\s*\)/g,"").replace(/\s*;\s*(?=[;.]|$)/g,"").replace(/\s+([,.;:])/g,"$1").trim()||_,acts:[]}}var K0=async(_)=>d1(await n0(_)).text,yZ={vault:["vault","Open Vault"],remote:["remote","Open Remote"],settings:["settings/services","Open Real services"]};function n_({name:_,acts:Q}){let J=Q.map((q)=>yZ[q]).filter((q)=>Boolean(q));if(J.length===0)return null;return $.jsxDEV($.Fragment,{children:J.map(([q,U])=>$.jsxDEV(c.default.Fragment,{children:[" ",$.jsxDEV("a",{href:`${A1}/${_}/~/${q}`,onClick:(G)=>{G.preventDefault(),j1([..._.split("/"),"~",...q.split("/")])},children:U},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)}async function S1(_,Q,J={}){return g2(`${y1}${Q}`,{...J,headers:{...J.headers??{},..._===W2?{}:{"x-volter-token":_},...J.body&&!J.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function u1(_,Q,J=0){let q=y_((U)=>S1(_,U),Q,J,_);return q.state==="error"?{...q,error:d1(q.error).text}:q}var X5=(_)=>{let Q=new Date(_),J=(q)=>String(q).padStart(2,"0");return`${Q.getFullYear()}-${J(Q.getMonth()+1)}-${J(Q.getDate())}T${J(Q.getHours())}:${J(Q.getMinutes())}`},x_=(_)=>new Date(Math.ceil(Date.parse(_)/60000)*60000).toISOString(),e_=(_)=>_.operation==="observed"?`observed${_.provenance==="placeholder"?" (default data)":" (vendor)"}`:_.receipt?`${_.receipt.status??""} ${_.receipt.externalId??""} ${_.receipt.reason??""}`.trim():_.provenance==="placeholder"?"default data":"unpushed",jZ=(_)=>{let Q=/^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(_??"");return Q?{trace:Q[1],span:Q[2]}:null},Y8="volter.console.snapshots",J2=()=>{try{return JSON.parse(sessionStorage.getItem(Y8)??"{}")}catch{return{}}},_Q=new Map,L8=(_)=>{if(_2){if(_.token||_.readToken)_Q.set(_.name,{token:_.token,readToken:_.readToken});_={..._,token:"",readToken:""}}try{sessionStorage.setItem(Y8,JSON.stringify({...J2(),[_.name]:_}))}catch{}},z8=(_)=>_Q.get(_)?.readToken||J2()[_]?.readToken||"",r4=(_)=>{try{let Q=J2();delete Q[_],sessionStorage.setItem(Y8,JSON.stringify(Q))}catch{}},p2=new URLSearchParams(window.location.hash.slice(1)),F5=p2.get("close")??"";function s5(_){if(typeof _!=="string")return null;let Q;try{Q=new URL(_)}catch{return null}return(Q.protocol==="http:"||Q.protocol==="https:")&&Q.origin===_.replace(/\/+$/,"")?Q:null}function W8(_){let Q=s5(_);if(!Q)return null;let J=new URL(y1);if(Q.protocol!==J.protocol||Q.port!==J.port)return null;if(Q.hostname===J.hostname)return Q.origin;let q=/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./;if(!q.test(Q.hostname))return null;let U=Q.hostname.replace(q,"");return U===J.hostname||q.test(J.hostname)&&U===J.hostname.replace(q,"")?Q.origin:null}function VZ(_){let Q;try{Q=JSON.parse(_)}catch{return null}let J=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof Q.name!=="string"||!J.test(Q.name)||typeof Q.parent!=="string"||!J.test(Q.parent)||typeof Q.at!=="string")return null;let q=Q.parentOrigin===void 0?void 0:W8(Q.parentOrigin);return{name:Q.name,parent:Q.parent,token:typeof Q.token==="string"?Q.token:"",readToken:typeof Q.readToken==="string"?Q.readToken:"",at:Q.at,expiresAt:typeof Q.expiresAt==="string"?Q.expiresAt:null,...q?{parentOrigin:q}:{}}}{let _=p2.get("snapshot");if(_){let Q=VZ(_);if(Q&&!J2()[Q.name])L8(Q)}}var QQ="volter.console.home",JQ=(_)=>{let Q=s5(_);if(!Q)return null;let J=new URL(y1).hostname,q=J.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return Q.hostname===J||Q.hostname===q?Q.origin:null};{let _=JQ(p2.get("home"));if(_)try{sessionStorage.setItem(QQ,_)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((_)=>p2.has(_)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var v0=()=>{try{return JQ(sessionStorage.getItem(QQ))??""}catch{return""}};function B8(_,Q,J,q){let U=new URLSearchParams({token:Q,home:v0()||y1}),G=J2()[J];if(G)U.set("snapshot",JSON.stringify(G));window.location.replace(`${_}${q??`${window.location.pathname}${window.location.search}`}#${U.toString()}`)}var a4=a5.dataset.route==="memory"?"":null;function QM(_){a4=_,window.dispatchEvent(new PopStateEvent("popstate"))}function E2(){return(a4??window.location.pathname.slice(A1.length)).split("/").filter(Boolean).map((_)=>{try{return decodeURIComponent(_)}catch{return""}})}var m_=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,e0=(_,Q)=>_&&Q&&m_.test(_)&&m_.test(Q)?`${_}/${Q}`:"";function j1(_){let Q=`/${_.map(encodeURIComponent).join("/")}`;if(a4!==null)a4=Q;else window.history.pushState(null,"",`${A1}${Q}`);window.dispatchEvent(new PopStateEvent("popstate"))}function $Q(_,Q){let J=W8(J2()[_]?.origin);if(J&&J!==y1){B8(J,z8(_),_,`${A1}/${Q.map(encodeURIComponent).join("/")}`);return}j1(Q)}async function g_(){let[_,Q]=E2(),J=e0(_,Q),q=J?[J]:a_;if(q.length===0){let U=await g2(`${y1}/-/ping`).catch(()=>null);q=U?.ok?(await U.json().catch(()=>({}))).worlds??[]:[]}q=q.filter((U)=>{let[G,Z,...F]=U.split("/");return F.length===0&&e0(G,Z)===U});for(let U of q){let G=await g2(`${y1}/-/${U}/session`,{method:"POST"}).catch(()=>null);if(!G)continue;let Z=await G.json().catch(()=>({})),F=s5(Z.origin)?.origin;if(G.status===409&&F&&F!==y1)return window.location.replace(`${F}${A1}/${U}`),"moved";if(G.ok&&Z.local)return{token:typeof Z.token==="string"&&Z.token?Z.token:W2}}return null}function uZ(){let[_,Q]=c.useState(G8),J=(q)=>()=>{try{if(q==="system")localStorage.removeItem("volter.theme");else localStorage.setItem("volter.theme",q)}catch{}j_(q),Q(q)};return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"theme-choice",role:"radiogroup","aria-label":"Appearance",children:["system","light","dark"].map((q)=>$.jsxDEV("button",{type:"button",role:"radio","aria-checked":_===q,onClick:J(q),children:q==="system"?"System":q==="light"?"Light":"Dark"},q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hZ(){let[_,Q]=c.useState(kZ()),[J,q]=c.useState(!1),[U,G]=c.useState(!1),[Z,F]=c.useState(""),[X,Y]=c.useState(null),[K,H]=c.useState(null),[L,z]=c.useState(E2());c.useEffect(()=>{let D=()=>z(E2());return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]),c.useEffect(()=>{let[D,y]=E2(),t=e0(D,y),[_1,a]=t?t.split("/"):[],o=J2()[F5];if(!F5||!_||!_1||!a||!o?.made||o.parent!==`${_1}/${a}`||e0(...F5.split("/"))!==F5)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}S1(_,`/-/${_1}/${a}/branches/${F5}`,{method:"DELETE"}).catch(()=>null).then(()=>r4(F5))},[_]);let W=c.useCallback(async(D)=>{if(H(null),!D){let a=await g_();if(a==="moved")return;if(a){if(q(!0),a.token!==W2)r5(a.token);Q(a.token);return}Y(null),G(!0);return}if(_2&&D===W2){let a=await g_();if(a==="moved")return;if(a)q(!0)}if(_2&&D===s_){let[a,o]=E2(),p=e0(a,o),[e,$1]=p?p.split("/"):[],U1=e&&$1?await g2(`${y1}/-/${e}/${$1}/session`,{method:"POST",headers:{"x-volter-pass":p2.get("pass")??""}}).catch(()=>null):null;if(!U1){H(`${y1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){H(`${await K0(U1)}. Open it again from the platform.`),Y(null);return}o_((await U1.json().catch(()=>({}))).issuer),Q(W2);return}if(_2&&D!==W2){let[a,o]=E2(),p=e0(a,o),[e,$1]=p?p.split("/"):[],U1=e&&$1?await g2(`${y1}/-/${e}/${$1}/session`,{method:"POST",headers:{"x-volter-token":D}}).catch(()=>null):null;if(!U1){H(`${y1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){let q1=await K0(U1);H(U1.status===401||U1.status===403?`That token does not open ${e}/${$1}.`:U1.status===409?`${e}/${$1}'s session lives at another origin: ${q1}`:`The World could not open a session (${U1.status}): ${q1}`),Y(null);return}Q(W2);return}let y=_2?new Response(null,{status:404}):await S1(D,"/-/worlds");if(y.ok){let{worlds:a}=await y.json();Y({kind:"admin",worlds:a});return}if(y.status===429){H("You are asking faster than the platform allows — wait a moment and reload."),Y(null);return}if(y.status>=500){let a=await y.json().catch(()=>({}));H(`The platform could not list your worlds${a.error?`: ${a.error}`:""}. Reload; if it stays, the status page says what is wrong.`),Y(null);return}let t=a_;if(t.length===0){let a=await g2(`${y1}/-/ping`);if(!a.ok){H(`${y1} does not answer as a host`),Y(null);return}if(t=(await a.json()).worlds??[],t.length===0){H(`${y1} does not list its Worlds: open a World at its own address, ${y1}${A1}/<org>/<world>`),Y(null);return}}let _1=[];for(let a of t){let o=await S1(D,`/-/${a}/twins`);if(o.ok){let p=await o.json();_1.push({name:a,base:`${Q2}/${a}`,twins:(p.twins??[]).map((e)=>({vendor:e.twin,protocol:e.protocol??null,root:e.root??null}))})}}if(_1.length===0){H("This link or key opens no World here: it was revoked, or it has ended."),Y(null);return}Y({kind:"world",worlds:_1})},[]);c.useEffect(()=>{W(_)},[_,W]);let w=(D)=>X?.kind==="admin"?X.worlds.find((y)=>y.name===D)?.token??_:_,[R,A]=c.useState("");if(!_||!X&&!K)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(i5,{href:`${A1}/`},void 0,!1,void 0,this),_&&!X&&!K||!_&&!U?$.jsxDEV("p",{className:"mode",children:"Opening…"},void 0,!1,void 0,this):$.jsxDEV("form",{onSubmit:(D)=>{D.preventDefault(),r5(Z.trim()),Q(Z.trim())},className:"stack",children:[$.jsxDEV("h2",{children:"Open a World"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"A World's token opens that World. A host's admin token opens every World it serves."},void 0,!1,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Token"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"token",type:"password",value:Z,onChange:(D)=>F(D.target.value),autoFocus:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",children:"Open"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let O=()=>H("This link or key opens no World here: it was revoked, or it has ended."),B=()=>{if(J){window.location.reload();return}if(_2){let[D,y]=E2(),t=e0(D,y),[_1,a]=t?t.split("/"):[],o=()=>window.location.replace(G0()?`${G0()}/`:`${y1}${A1}/${_1&&a?`${_1}/${a}`:""}?signin`);if(setTimeout(o,2000),_1&&a)g2(`${y1}/-/${_1}/${a}/session/end`,{method:"POST"}).catch(()=>null).then(o);else o();return}if(X)for(let D of X.worlds)navigator.sendBeacon(`${D.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${D.name}/session/end`);r5(""),Q(""),F(""),Y(null),j1([])};if(K||!X)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(i5,{href:`${A1}/`},void 0,!1,void 0,this),$.jsxDEV("h2",{children:"Could not open it"},void 0,!1,void 0,this),$.jsxDEV("p",{role:"alert",children:K??"nothing answered"},void 0,!1,void 0,this),G0()?$.jsxDEV("a",{className:"button primary",href:`${G0()}/`,children:["Back to ",new URL(G0()).host]},void 0,!0,void 0,this):$.jsxDEV("button",{type:"button",className:"primary",onClick:B,children:J?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let[M,P,C,f,v,N,k]=L,u=C==="~",i=/^[A-Za-z0-9_-]+$/,l=/^[^\u0000-\u001f\u007f]{1,200}$/,S=u||!C||!i.test(C)?void 0:C,b=v&&i.test(v)?N!==void 0&&f!=="changes"&&f!=="screens"?e0(v,N)||void 0:v:void 0,h=f==="changes"&&v==="changesets"&&N&&i.test(N)?N:f==="screens"&&N&&k&&/^[A-Za-z0-9_.-]+$/.test(N)&&l.test(k)?`${N}:${k}`:void 0,E=e0(M,P),j=E?J2()[E]??null:null,m=(D)=>z8(D)||w(D),I=j?X.kind==="admin"?X.worlds.find((D)=>D.name===j.parent)?.token??null:X.worlds.some((D)=>D.name===j.parent)?_:null:null,V=async(D)=>{let y=W8(D.parentOrigin);if(y&&y!==y1){r4(D.name),window.location.assign(`${y}${A1}/${D.parent}#close=${encodeURIComponent(D.name)}`);return}if(D.made)await S1(w(D.parent),`/-/${D.parent}/branches/${D.name}`,{method:"DELETE"}).catch(()=>null),r4(D.name);j1(D.parent.split("/"))};return $.jsxDEV("main",{className:E?"app workspace":"app home",children:[E?null:$.jsxDEV("header",{children:[E?$.jsxDEV(b_,{},void 0,!1,void 0,this):null,$.jsxDEV(i5,{href:`${v0()&&v0()!==y1?v0():""}${A1}/`,onClick:(D)=>{if(v0()&&v0()!==y1)return;D.preventDefault(),j1([])}},void 0,!1,void 0,this),$.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[E?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("span",{children:E.split("/")[0]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${E}`,className:"crumb-world",onClick:(D)=>{D.preventDefault(),j1(E.split("/"))},children:E.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,S?$.jsxDEV("span",{children:[" / ",S]},void 0,!0,void 0,this):null,u&&f==="trace"?$.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),G0()?$.jsxDEV("a",{href:`${G0()}/${E?encodeURIComponent(E.split("/")[0]):""}`,title:`Back to the platform at ${new URL(G0()).host}`,className:"back-link",children:["← ",$.jsxDEV("span",{className:"back-text",children:E?`${E.split("/")[0]}'s Worlds`:new URL(G0()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,E?null:$.jsxDEV("span",{className:"mode",children:J?"on this machine":R?`signed in as ${R}`:X.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),E||J?null:$.jsxDEV("button",{onClick:B,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),E?$.jsxDEV(xZ,{name:E,token:m(E),twin:S,tab:u?f??"overview":"overview",arg:u?b:void 0,...u&&h?{sub:h}:{},admin:j?null:X.kind==="admin"?_:null,snapshot:j,parentToken:I,who:{local:J,person:R||null,admin:X.kind==="admin"},onSignOut:B,onReturn:V,opens:(D)=>!!J2()[D]||X.kind==="admin"&&X.worlds.some((y)=>y.name===D),onRemoved:()=>{W(_),j1([])},onWho:A,onEnded:O,worlds:X.worlds.map((D)=>D.name)},E,!1,void 0,this):$.jsxDEV(DZ,{mode:X,admin:X.kind==="admin"?_:null,reload:()=>W(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function DZ({mode:_,admin:Q,reload:J}){let[q,U]=c.useState(""),[G,Z]=c.useState(""),[F,X]=c.useState(""),[Y,K]=c.useState(null),H=async(f)=>{if(!await g0({title:`Rotate the tokens of ${f}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let v=await S1(Q,`/-/worlds/${f}/rotate`,{method:"POST"}),N=await v.json().catch(()=>({}));K(v.ok?`rotated ${f}: the new tokens are shown once — token ${N.token} · read token ${N.readToken}`:N.error?d1(N.error).text:`answered ${v.status}`),await J()},L=async(f)=>{let v=await S1(Q,`/-/worlds/${f}`,{method:"DELETE"}),N=await v.json().catch(()=>({}));K(v.ok?`removed ${f}`:N.error?d1(N.error).text:`answered ${v.status}`),await J()},[z,W]=c.useState(!1),[w,R]=c.useState(!1),[A,O]=c.useState(""),B=async(f)=>{f.preventDefault(),K(null),W(!0);try{let v=await S1(Q,"/-/worlds",{method:"POST",body:JSON.stringify({org:q,world:G,vendors:F.split(",").map((k)=>k.trim()).filter(Boolean)})}),N=await v.json();if(!v.ok){K(N.error?d1(N.error).text:`the host answered ${v.status}`);return}K(`provisioned ${N.name}`),Z(""),X(""),R(!1),await J()}finally{W(!1)}},M=A.trim().toLowerCase(),P=_.worlds.filter((f)=>!M||f.name.toLowerCase().includes(M)||f.twins.some((v)=>v.vendor.includes(M))),C=[...new Set(P.map((f)=>f.name.split("/")[0]))];return $.jsxDEV("section",{className:"home-window","aria-labelledby":"worlds",children:[$.jsxDEV("div",{className:"home-head",children:[$.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[E1(_.worlds.length,"World")," ",Q?"this host serves":"this key opens"]},void 0,!0,void 0,this),Q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{K(null),R(!0)},children:[$.jsxDEV(w1,{name:"plus",size:16},void 0,!1,void 0,this),"New World"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"home-find",children:$.jsxDEV("input",{type:"search",placeholder:"Filter by World or vendor","aria-label":"Filter Worlds",value:A,onChange:(f)=>O(f.target.value)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y&&!w?$.jsxDEV("p",{role:"status",className:"home-note",children:Y},void 0,!1,void 0,this):null,C.map((f)=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("p",{className:"menu-label home-org",children:f},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"home-list",children:P.filter((v)=>v.name.split("/")[0]===f).map((v)=>$.jsxDEV("li",{children:[$.jsxDEV("a",{href:`${A1}/${v.name}`,onClick:(N)=>{N.preventDefault(),j1(v.name.split("/"))},children:[$.jsxDEV(w1,{name:"globe",size:20},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:v.name.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("small",{children:$.jsxDEV("code",{children:v.base},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"home-vendors",children:v.twins.map((N)=>$.jsxDEV("span",{title:B1(N.vendor),children:$.jsxDEV(l1,{vendor:N.vendor},void 0,!1,void 0,this)},N.vendor,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q?$.jsxDEV("details",{className:"menu home-more",children:[$.jsxDEV("summary",{"aria-label":`More for ${v.name}`,children:"⋯"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"popover menu-list",children:[$.jsxDEV("button",{type:"button",onClick:(N)=>{N.currentTarget.closest("details")?.removeAttribute("open"),H(v.name)},children:"Rotate tokens…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"danger-item",onClick:(N)=>{N.currentTarget.closest("details")?.removeAttribute("open"),g0({title:`Remove ${v.name}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:v.name}).then((k)=>{if(k)L(v.name)})},children:"Remove World…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},v.name,!0,void 0,this))},void 0,!1,void 0,this)]},f,!0,void 0,this)),P.length===0?$.jsxDEV("p",{className:"mode home-note",children:M?`No World matches ${A}.`:"No Worlds here yet."},void 0,!1,void 0,this):null,$.jsxDEV(W0,{open:w,onClose:()=>{if(!z)R(!1)},title:"New World",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>R(!1),disabled:z,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"provision",className:"primary",disabled:z,children:z?"Making… (ten seconds or so)":"Make World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"provision",onSubmit:B,className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Org"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"org",value:q,onChange:(f)=>U(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"world",value:G,onChange:(f)=>Z(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Vendors"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"vendors",value:F,onChange:(f)=>X(f.target.value),placeholder:"stripe, slack",required:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"A twin of each, with its default data."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"status",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var bZ=["changes","events","trace","vendors","screens","canvas","branches","settings","remote","vault"],EZ=(_,Q)=>{let J=Q?.screens?.find((q)=>q.path.replace(/\/+$/,"")==="")??Q?.screens?.find((q)=>!/[{<]/.test(q.path));return Q&&J?`${Q2}/${_}/${Q.twin}${J.path.startsWith("/")?J.path:`/${J.path}`}`:null},p_={verify:"verified",use:"used",issue:"issued",revoke:"revoked",rotate:"rotated",seed:"seeded",upsert:"saved",set:"set",start:"started",finish:"finished",fail:"failed",schedule:"scheduled",deliver:"delivered",like:"liked",follow:"followed",reply:"replied",create:"created",update:"updated",delete:"deleted",record:"recorded",remove:"removed",add:"added",send:"sent",post:"posted",postmessage:"posted",cancel:"canceled",close:"closed",open:"opened",publish:"published",upload:"uploaded",invite:"invited",archive:"archived",merge:"merged",refund:"refunded",capture:"captured",confirm:"confirmed",pay:"paid"};function I0(_){let Q=_.operation??_.op,J=(Q.includes(".")?Q.slice(Q.lastIndexOf(".")+1):Q).toLowerCase(),q=_.subject.type.replace(/[_-]+/g," ").trim(),U=`${q.charAt(0).toUpperCase()}${q.slice(1)}`,G=/(^|\.)twin\./.test(Q)||/^seed_/.test(J),Z=Q.replace(/[._]+/g," ").trim(),F=G?`${U} seeded`:p_[J]?`${U} ${p_[J]}`:`${Z.charAt(0).toUpperCase()}${Z.slice(1)}`,X=_.fields??{},Y=["title","name","email","text","subject","summary","description"].map((H)=>X[H]).find((H)=>typeof H==="string"&&H.trim()!=="")??null,K=Y===null?null:Y.replace(/<([@#!])[^|>]*\|([^>]+)>/g,(H,L,z)=>`${L==="!"?"@":L}${z}`).replace(/<(?:https?:[^|>]+)\|([^>]+)>/g,"$1").replace(/<(https?:[^>]+)>/g,"$1");return{what:F,label:K===null?null:K.length>80?`${K.slice(0,79)}…`:K}}var $2=(_)=>/token|password|secret|key|credential/i.test(_.subject.type)&&_.subject.id.length>6?`••••${_.subject.id.slice(-4)}`:_.subject.id;function xZ({name:_,token:Q,twin:J,tab:q,arg:U,sub:G,admin:Z,snapshot:F,parentToken:X,who:Y,onSignOut:K,onReturn:H,opens:L,onRemoved:z,onWho:W,onEnded:w,worlds:R=[]}){let[A,O]=c.useState("pending"),[B,M]=c.useState(null),[P,C]=c.useState(0),[f,v]=c.useState(null);c.useEffect(()=>{let p=!0;return M(null),S1(Q,`/-/${_}/session`,{method:"POST"}).then(async(e)=>{let $1=await e.json().catch(()=>({}));if(o_($1.issuer),$1.who)W?.($1.who);v(typeof $1.signsAs==="string"?$1.signsAs:null);let U1=s5($1.origin)?.origin;if(e.status===409&&U1&&U1!==y1){B8(U1,Q,_);return}if(!p)return;if(O(!e.ok?"unknown":$1.scope==="read"?"read":$1.scope==="write"?"write":"unknown"),!e.ok)M($1.error?d1($1.error).text:`answered ${e.status}`)}).catch((e)=>{if(p)O("unknown"),M(`the World did not answer: ${e instanceof Error?e.message:String(e)}`)}),()=>{p=!1}},[_,Q,P]);let N=B?{state:"error",error:B}:A==="pending"?{state:"pending"}:{state:"ok",scope:A},k=A==="write",u=(p)=>{if(p.status!==403)return;p.clone().json().then((e)=>{if(/read token|opens only reads|write access|reads only/i.test(e?.error??""))O("read")},()=>null)},[i,l]=c.useState(0);c.useEffect(()=>{let p=setInterval(()=>{if(!document.hidden)l((e)=>e+1)},5000);return()=>clearInterval(p)},[]);let[S,b]=c.useState(0),h=u1(Q,`/-/${_}/clock`,i+S);c.useEffect(()=>{if(_2&&!F&&h.state==="error"&&h.status===401)w?.()},[h,F,w]);let E=u1(Q,`/-/${_}/twins`),j=u1(Q,`/-/${_}/branches`,S),m=u1(Q,`/-/${_}/map`,Math.floor(i/2)),I=!(j.state==="error"&&(j.status===404||j.status===405)),V=bZ.includes(q)?q:"overview",D=E.state==="ok"?E.data.twins.map((p)=>p.twin):[];if(J&&E.state==="ok"&&!D.includes(J))return $.jsxDEV("main",{className:"center",children:$.jsxDEV(Z5,{title:`${_} has no ${J}`,action:$.jsxDEV("a",{href:`${A1}/${_}`,onClick:(p)=>{p.preventDefault(),j1(_.split("/"))},children:["Open ",_]},void 0,!0,void 0,this),children:$.jsxDEV("p",{children:["No vendor of this World is called ",J,". Its changesets are under Changes › History."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);let y=V==="vendors"&&U?U:void 0,t=()=>{O("pending"),C((p)=>p+1)};if(V==="canvas"||V==="vendors"&&!y||q==="screens"&&!U)return $.jsxDEV(LF,{name:_,token:Q,twins:E,session:N,retry:t,snapshot:F,back:()=>j1(_.split("/")),canWrite:k&&!F},void 0,!1,void 0,this);let a=q==="settings"?{kind:"settings",tab:((p)=>qQ.find(([e])=>e===p)?.[0]??"account")(U)}:q==="remote"?{kind:"settings",tab:"remote"}:q==="vault"?{kind:"settings",tab:"vault"}:q==="branches"?{kind:"branches",...U?{open:U}:{}}:null,o=J?"vendor":q==="screens"&&U?"screen":V==="vendors"&&y?"vendor":q==="trace"?"trace":q==="events"?"events":q==="changes"&&U==="changesets"?"history":"changes";return $.jsxDEV(sZ,{name:_,token:Q,view:o,win:a,who:Y,snapshot:F,onReturn:H,onSignOut:K,worlds:R,session:N,retry:t,...o==="vendor"?{arg:J??y}:o==="events"||o==="trace"||o==="screen"?U?{arg:U}:{}:{},...G?{sub:G}:{},twins:E,map:m,branches:I?j:null,clock:h,canWrite:k&&!F,refused:u,signsAs:f,opens:L,tick:i,admin:Z,onRemoved:z,onClock:()=>b((p)=>p+1),scope:F?"read":A},void 0,!1,void 0,this)}function w1({name:_,size:Q=20}){return $.jsxDEV("svg",{className:"icon",viewBox:"0 0 24 24",width:Q,height:Q,fill:"none",stroke:"currentColor",strokeWidth:Q<=16?1.75:1.5,strokeLinecap:"square",strokeLinejoin:"miter","aria-hidden":"true",children:(E_[_]??[]).map(([J,q],U)=>c.default.createElement(J,{key:U,...q}))},void 0,!1,void 0,this)}function s4(_){let Q=(J)=>{let q=(J.operation??J.op).toLowerCase();return q.includes(".")?q.slice(q.lastIndexOf(".")+1):q};if(_.some((J)=>/^(delete|remove|archive|revoke)/.test(Q(J))||J.fields?.deleted===!0))return{icon:"square-minus",word:"removed",tone:"removed"};if(/^(create|add|insert|issue|send|post|upload|invite|record|seed)/.test(Q(_[0])))return{icon:"square-plus",word:"made",tone:"added"};return{icon:"square-dot",word:"changed",tone:"changed"}}var qQ=[["account","Account","user"],["changesets","Changesets","git-commit-horizontal"],["remote","Remote","cloud"],["access","Access","key-round"],["services","Real services","plug"],["vault","Vault","vault"],["checks","Checks","list-checks"],["clock","Clock","clock"],["appearance","Appearance","palette"]],mZ=(_,Q)=>{let J=Q.split("/").pop()??Q,q=_.split("/").pop()??"";return J.startsWith(`${q}-`)?J.slice(q.length+1):J},x2=(_)=>_.replace(/^_+/,"").replace(/[_-]+/g," ");function UQ({record:_,history:Q}){let J=_.writes[_.writes.length-1],q=I0(J),U=s4(_.writes),G=new Set(_.writes.map((H)=>H.id)),Z=_.writes[0].occurredAt,F={};if(Q){for(let H of Q)if(!G.has(H.id)&&!H.landsId&&!H.aliasOf&&H.subject.type===J.subject.type&&H.subject.id===J.subject.id&&H.occurredAt<=Z)Object.assign(F,H.fields??{})}let X={...F};for(let H of _.writes)Object.assign(X,H.fields??{});let Y=U.tone==="added"&&Object.keys(F).length===0,K=[...new Set([...Object.keys(F),...Object.keys(X)])].filter((H)=>!MQ(F[H],X[H]));return $.jsxDEV("div",{className:"ws-diff","aria-label":`${q.label??$2(J)}: its changes`,children:[$.jsxDEV("div",{className:"ws-diff-head",children:[$.jsxDEV("span",{className:`ws-kind ${U.tone}`,title:U.word,children:$.jsxDEV(w1,{name:U.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(l1,{vendor:_.twin},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:q.label??$2(J)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[B1(_.twin)," · ",J.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")," ",$.jsxDEV("code",{children:$2(J)},void 0,!1,void 0,this)," · ",U.word," here"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ol",{className:"ws-writes",children:_.writes.map((H)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:I0(H).what},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(V1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",d5(H)]},void 0,!0,void 0,this)]},H.id,!0,void 0,this))},void 0,!1,void 0,this),Q===null?$.jsxDEV("p",{className:"mode pad",children:"Reading its history…"},void 0,!1,void 0,this):K.length===0?$.jsxDEV("p",{className:"mode pad",children:"No field holds a new value."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"ws-fields","aria-label":"Fields before and after",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Field"},void 0,!1,void 0,this),Y?null:$.jsxDEV("th",{children:"Before"},void 0,!1,void 0,this),$.jsxDEV("th",{children:U.tone==="removed"?"After":"Now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:K.map((H)=>$.jsxDEV("tr",{children:[$.jsxDEV("th",{scope:"row",children:$.jsxDEV("code",{children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?null:$.jsxDEV("td",{className:H in F?"was":"none",children:H in F?$.jsxDEV(q2,{v:F[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:H in X?"now":"none",children:H in X?$.jsxDEV(q2,{v:X[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GQ({records:_,selected:Q,onPick:J,label:q}){let[U,G]=c.useState(()=>{try{return localStorage.getItem("volter.console.records")==="tree"}catch{return!1}}),Z=(Y)=>{G(Y);try{localStorage.setItem("volter.console.records",Y?"tree":"path")}catch{}},F=(Y,K)=>{let H=Y.writes[Y.writes.length-1],L=I0(H),z=s4(Y.writes);return $.jsxDEV("li",{children:$.jsxDEV("button",{type:"button",className:[Q===Y.key?"on":"",K?"nested":""].join(" ").trim()||void 0,"aria-pressed":Q===Y.key,onClick:()=>J(Y.key),children:[K?null:$.jsxDEV(l1,{vendor:Y.twin},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:L.label??$2(H)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[x2(H.subject.type)," · ",L.what.split(" ").slice(-1)[0],Y.writes.length>1?` · ${E1(Y.writes.length,"write")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:`ws-kind ${z.tone}`,title:z.word,"aria-label":z.word,children:$.jsxDEV(w1,{name:z.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.key,!1,void 0,this)},X=[...new Set(_.map((Y)=>Y.twin))];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-view-switch",role:"group","aria-label":"List the records by",children:[$.jsxDEV("button",{type:"button","aria-pressed":!U,className:U?void 0:"on",onClick:()=>Z(!1),children:"Path"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button","aria-pressed":U,className:U?"on":void 0,onClick:()=>Z(!0),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"ws-list","aria-label":q,children:U?X.map((Y)=>{let K=_.filter((H)=>H.twin===Y);return $.jsxDEV("li",{className:"ws-group",children:[$.jsxDEV("p",{className:"ws-group-head",children:[$.jsxDEV(l1,{vendor:Y},void 0,!1,void 0,this),$.jsxDEV("b",{children:B1(Y)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:K.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:K.map((H)=>F(H,!0))},void 0,!1,void 0,this)]},Y,!0,void 0,this)}):_.map((Y)=>F(Y,!1))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gZ({name:_,token:Q,branches:J,opens:q,refused:U,onChanged:G}){let[Z,F]=c.useState(""),[X,Y]=c.useState(!1),K=J?.state==="ok"&&J.data.checkedOut||_.split("/")[1],H=J?.state==="ok"&&J.data.named?.length?J.data.named:[{name:K,running:!0}],L=J?.state==="ok"?J.data.branches:[],z=Z.trim().toLowerCase(),W=(R)=>!z||R.toLowerCase().includes(z),w=(R)=>{R.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"The branch served here",children:[$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("b",{children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover ws-branch-menu",children:[$.jsxDEV("div",{className:"ws-branch-find",children:[$.jsxDEV("input",{type:"search",placeholder:"Filter","aria-label":"Filter branches",value:Z,onChange:(R)=>F(R.target.value)},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:(R)=>{w(R),Y(!0)},disabled:!J,children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"This World"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-branch-list",children:H.filter((R)=>W(R.name)).map((R)=>$.jsxDEV("li",{className:R.name===K?"current":void 0,children:[$.jsxDEV("span",{className:"tick",children:R.name===K?$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:R.name},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.name===K?"served here":R.running?"running":"stopped"},void 0,!1,void 0,this)]},R.name,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Branches of it"},void 0,!1,void 0,this),L.length===0?$.jsxDEV("p",{className:"mode ws-branch-none",children:"None yet. New branch makes one, from now or as the World was."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"ws-branch-list",children:L.filter((R)=>W(R.name)).map((R)=>{let A=$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"tick",children:$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:mZ(_,R.name)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.at?.instant?$.jsxDEV($.Fragment,{children:["as of ",$.jsxDEV(V1,{iso:R.at.instant,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O=R.expiresAt?`Goes away ${new Date(R.expiresAt).toLocaleString()}`:"Kept";return $.jsxDEV("li",{children:q(R.name)?$.jsxDEV("a",{href:`${A1}/${R.name}`,title:O,onClick:(B)=>{B.preventDefault(),w(B),$Q(R.name,R.name.split("/"))},children:A},void 0,!1,void 0,this):$.jsxDEV("span",{title:`${O}. Its tokens went to whoever made it; it opens from their page.`,children:A},void 0,!1,void 0,this)},R.name,!1,void 0,this)})},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-branch-foot",children:$.jsxDEV("a",{href:`${A1}/${_}/~/branches`,onClick:(R)=>{R.preventDefault(),w(R),j1([..._.split("/"),"~","branches"])},children:"Manage branches…"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(HQ,{name:_,token:Q,open:X,onClose:()=>Y(!1),onMade:G,refused:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZQ({name:_,view:Q,changes:J,changesets:q}){let U=(G)=>(Z)=>{Z.preventDefault(),j1([..._.split("/"),"~",...G])};return $.jsxDEV("nav",{className:"tabs ws-pane-tabs","aria-label":"Changes and history",children:[$.jsxDEV("a",{href:`${A1}/${_}/~/changes`,className:Q==="changes"?"on":void 0,"aria-current":Q==="changes"?"page":void 0,onClick:U(["changes"]),children:["Changes",J?$.jsxDEV("span",{className:"count",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/changes/changesets`,className:Q==="history"?"on":void 0,"aria-current":Q==="history"?"page":void 0,onClick:U(["changes","changesets"]),children:["History",q?$.jsxDEV("span",{className:"count",children:q},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function pZ({name:_,token:Q,sets:J,sub:q,signsAs:U,canWrite:G,rooted:Z,refused:F,onChanged:X,changes:Y,withScreens:K,required:H}){let[L,z]=c.useState(null),[W,w]=c.useState(!1),R=J.state==="ok"?[...J.data.changesets].sort((v,N)=>N.createdAt.localeCompare(v.createdAt)):[],A=R.find((v)=>v.name===q)??R[0],O=c.useMemo(()=>{let v=new Map;for(let N of A?BQ(A):[]){let k=`${N.twin}:${N.entry.subject.type}:${N.entry.subject.id}`,u=v.get(k)??{key:k,twin:N.twin,writes:[]};u.writes.push(N.entry),v.set(k,u)}return[...v.values()]},[A]),B=O.find((v)=>v.key===L)??O[0],M=u1(Q,B?`/-/${_}/log/${B.twin}`:null),P={added:0,removed:0,changed:0};for(let v of O)P[s4(v.writes).tone]=(P[s4(v.writes).tone]??0)+1;let C=A?t4(A):null,f=A?AQ(A,H):null;return $.jsxDEV("div",{className:"ws-two",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(ZQ,{name:_,view:"history",changes:Y,changesets:R.length},void 0,!1,void 0,this),$.jsxDEV(U0,{load:J,what:"the changesets",lines:4},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-list ws-commits","aria-label":"Changesets",children:R.map((v)=>{let N=A?.name===v.name,k=t4(v).label==="Not sent";return $.jsxDEV("li",{children:$.jsxDEV("a",{href:`${A1}/${_}/~/changes/changesets/${v.name}`,className:N?"on":void 0,"aria-current":N?"true":void 0,onClick:(u)=>{u.preventDefault(),z(null),j1([..._.split("/"),"~","changes","changesets",v.name])},children:[$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:X8(v)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[v.owner??(v.cutBy?d4(v.cutBy):"unrecorded")," • ",$.jsxDEV(V1,{iso:v.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k?$.jsxDEV("span",{className:"ws-unpushed",title:"Not pushed to the remote yet",children:$.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},v.name,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-pane-right",children:[J.state==="ok"&&!A?$.jsxDEV(Z5,{title:"No changesets yet",children:$.jsxDEV("p",{children:"Cut one from Changes: the cut box is at its foot."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,A&&C&&f?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-commit-head",children:[$.jsxDEV("div",{className:"ws-commit-title",children:[$.jsxDEV("h3",{children:X8(A)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-commit-stat",children:[$.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this)," ",E1(O.length,"changed record"),P.added?$.jsxDEV("span",{className:"plus",children:[" +",P.added]},void 0,!0,void 0,this):null,P.removed?$.jsxDEV("span",{className:"minus",children:[" −",P.removed]},void 0,!0,void 0,this):null,P.changed?$.jsxDEV("span",{className:"dot",children:[" •",P.changed]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode ws-commit-meta",children:[$.jsxDEV("code",{children:A.name},void 0,!1,void 0,this)," · ",$.jsxDEV(V1,{iso:A.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"ws-commit-who",children:[["Owner",A.owner??(A.cutBy&&/^(token|token:read)$|^key:(?!.* for:)/.test(A.cutBy)?"no person: a service’s":"unrecorded")],["Cut by",A.cutBy?A.pushedBy&&A.applied===null&&A.cutBy==="machine"?"the machine it was cut on":d4(A.cutBy):"unrecorded"],...A.pushedBy?[["Pushed by",d4(A.pushedBy)]]:[]].map(([v,N])=>$.jsxDEV("span",{children:[$.jsxDEV("span",{className:"mode",children:v},void 0,!1,void 0,this)," ",N]},v,!0,void 0,this))},void 0,!1,void 0,this),A.pushedBy?$.jsxDEV("p",{className:"mode ws-commit-meta",children:A.applied===null?"Owner and cut by are as the World it was cut in recorded them; pushed by is this World's own record.":"Owner and cut by are this World’s record; pushed by is as the remote recorded it."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>w(!0),title:"Where it went, the checks, the approvals; Verify, Approve and Deploy",children:[$.jsxDEV("span",{className:`badge cs-${C.tone}`,children:C.label},void 0,!1,void 0,this),$.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this),"Review…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-two inner",children:[$.jsxDEV("div",{className:"ws-files",children:$.jsxDEV(GQ,{records:O,...B?{selected:B.key}:{},onPick:z,label:"Records it changed"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:B?$.jsxDEV(UQ,{record:B,history:M.state==="ok"?M.data.entries:M.state==="error"?[]:null},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"It changes nothing."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(W0,{open:W,onClose:()=>w(!1),title:`Review: ${X8(A)}`,wide:!0,children:[$.jsxDEV(d_,{name:_,token:Q,signsAs:U,c:A,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"head",required:H},`h:${A.name}`,!1,void 0,this),$.jsxDEV(d_,{name:_,token:Q,signsAs:U,c:A,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"review",required:H},`r:${A.name}`,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function cZ({name:_,token:Q,vendors:J,vendor:q,tick:U}){let[G,Z]=c.useState(c_*4),[F,X]=c.useState(""),[Y,K]=c.useState(null),H=u1(Q,`/-/${_}/timeline?limit=${G}${q?`&twin=${encodeURIComponent(q)}`:""}`,Math.floor(U/2)),L=H.state==="ok"?ZF(H.data.entries):[],z=[...new Set(L.map((P)=>I0(P.entry).what))].sort(),W=L.filter((P)=>!F||I0(P.entry).what===F),w=W.find((P)=>H5(P)===Y)??W[0],R=(P)=>(C)=>{C.preventDefault(),K(null),j1([..._.split("/"),"~","events",...P?[P]:[]])},A=w?.entry.input&&typeof w.entry.input==="object"?w.entry.input.body:void 0,O=w?jZ(w.entry.traceparent):null,B=w?l_(w):null,M=w?$F(w.entry):[];return $.jsxDEV("div",{className:"ws-events",children:[$.jsxDEV("div",{className:"ws-filterbar",children:[$.jsxDEV("nav",{className:"ws-seg","aria-label":"Vendor",children:[$.jsxDEV("a",{href:`${A1}/${_}/~/events`,className:!q?"on":void 0,"aria-current":!q?"page":void 0,onClick:R(),children:"All"},void 0,!1,void 0,this),J.map((P)=>$.jsxDEV("a",{href:`${A1}/${_}/~/events/${P}`,className:q===P?"on":void 0,"aria-current":q===P?"page":void 0,onClick:R(P),children:[$.jsxDEV(l1,{vendor:P},void 0,!1,void 0,this),B1(P)]},P,!0,void 0,this))]},void 0,!0,void 0,this),$.jsxDEV("select",{"aria-label":"Operation",value:F,onChange:(P)=>{X(P.target.value),K(null)},children:[$.jsxDEV("option",{value:"",children:"Every operation"},void 0,!1,void 0,this),z.map((P)=>$.jsxDEV("option",{value:P,children:P},P,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[$.jsxDEV(U0,{load:H,what:"the events",lines:6},void 0,!1,void 0,this),$.jsxDEV("table",{className:"ws-grid","aria-label":"Events",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Time"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"What"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Record"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"By"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Receipt"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:W.map((P)=>{let C=I0(P.entry),f=l_(P),v=w&&H5(P)===H5(w);return $.jsxDEV("tr",{className:v?"on":void 0,"aria-selected":v,onClick:()=>K(H5(P)),children:[$.jsxDEV("td",{className:"mono",children:$.jsxDEV(V1,{iso:P.entry.occurredAt,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:P.twin},void 0,!1,void 0,this),B1(P.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("b",{children:C.what},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"ws-cell-clip",children:C.label?`“${C.label}”`:$.jsxDEV("code",{children:$2(P.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:d5(P.entry,P.caller)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f?$.jsxDEV("span",{className:f.bad?"badge cs-bad":f.status==="deployed"?"badge cs-done":"badge",children:f.status},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:e_(P.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H5(P),!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-detail",children:w?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-event-line",children:[$.jsxDEV("span",{className:"badge",children:KQ(w.entry)},void 0,!1,void 0,this),B?$.jsxDEV("span",{className:B.bad?"badge cs-bad":"badge cs-good",children:B.status},void 0,!1,void 0,this):null,$.jsxDEV("code",{children:[w.entry.subject.type,":",$2(w.entry)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(V1,{iso:w.entry.occurredAt},void 0,!1,void 0,this)," · ",d5(w.entry,w.caller)]},void 0,!0,void 0,this),O?$.jsxDEV("a",{href:`${A1}/${_}/~/trace/${O.trace}`,onClick:(P)=>{P.preventDefault(),j1([..._.split("/"),"~","trace",O.trace])},children:"Its trace →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-panes",children:[$.jsxDEV("div",{role:"region","aria-label":"The request",children:[$.jsxDEV("h4",{children:"Request"},void 0,!1,void 0,this),A!==void 0?$.jsxDEV(UF,{body:A},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"No request body: the World or the vendor wrote it."},void 0,!1,void 0,this),M.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Usage"},void 0,!1,void 0,this),$.jsxDEV("dl",{className:"fields",children:M.map(([P,C])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:P},void 0,!1,void 0,this),$.jsxDEV("dd",{children:C},void 0,!1,void 0,this)]},P,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{role:"region","aria-label":"What it wrote",children:[$.jsxDEV("h4",{children:"Written"},void 0,!1,void 0,this),$.jsxDEV(LQ,{fields:w.entry.fields},void 0,!1,void 0,this),$.jsxDEV("h4",{children:w.copies.length?"Receipts":"Receipt"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:w.copies.length?w.copies.map((P)=>P.entry.receipt?.status??"landed copy").join(" · "):GF(w.entry)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"Nothing written here yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:[$.jsxDEV("span",{children:[w?`${W.indexOf(w)+1} of ${W.length}`:W.length," events",q?` at ${B1(q)}`:""]},void 0,!0,void 0,this),H.state==="ok"&&H.data.next?$.jsxDEV("button",{type:"button",onClick:()=>Z((P)=>P+c_*4),children:"Load older"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function lZ({name:_,token:Q,id:J}){let q=/^[0-9a-f]{32}$/.test(J),U=u1(Q,q?`/-/${_}/timeline?trace=${J}&limit=500`:null),G=U.state==="ok"?[...U.data.entries].sort((H,L)=>-XQ(H,L)):[],[Z,F]=c.useState(null),X=G[0]?Date.parse(G[0].entry.occurredAt):0,Y=G.length?Math.max(1,Date.parse(G[G.length-1].entry.occurredAt)-X):1,K=[...new Set(G.map((H)=>H.twin))];return $.jsxDEV("div",{className:"ws-sheet ws-trace",children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${A1}/${_}/~/events`,onClick:(H)=>{H.preventDefault(),j1([..._.split("/"),"~","events"])},children:[$.jsxDEV(w1,{name:"arrow-left",size:16},void 0,!1,void 0,this)," Events"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("h2",{children:[G[0]?`${I0(G[0].entry).what} …`:"Trace"," ",$.jsxDEV("code",{className:"mode",children:J.slice(0,12)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!q?$.jsxDEV("p",{role:"alert",children:[J?`${J} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):$.jsxDEV(U0,{load:U,what:"the trace"},void 0,!1,void 0,this),G.length?$.jsxDEV("p",{className:"ws-trace-meta",children:["Started ",$.jsxDEV("b",{children:$.jsxDEV(V1,{iso:G[0].entry.occurredAt},void 0,!1,void 0,this)},void 0,!1,void 0,this)," · Took ",$.jsxDEV("b",{children:[Y," ms"]},void 0,!0,void 0,this)," · Vendors ",$.jsxDEV("b",{children:K.map(B1).join(", ")},void 0,!1,void 0,this)," · Writes ",$.jsxDEV("b",{children:G.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,U.state==="ok"&&G.length===0?$.jsxDEV(Z5,{title:"Nothing in this World carries this trace",children:$.jsxDEV("p",{children:["An app instrumented with OpenTelemetry sends a ",$.jsxDEV("code",{children:"traceparent"},void 0,!1,void 0,this)," with each call, and every write that call makes keeps it, so one click reads across every vendor."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,G.length?$.jsxDEV("div",{className:"ws-spans",role:"table","aria-label":"The trace's writes",children:[$.jsxDEV("div",{className:"ws-span head",role:"row",children:[$.jsxDEV("span",{role:"columnheader",children:"Vendor and what"},void 0,!1,void 0,this),$.jsxDEV("span",{role:"columnheader",className:"ws-ticks",children:[$.jsxDEV("span",{children:"0 ms"},void 0,!1,void 0,this),$.jsxDEV("span",{children:[Math.round(Y/2)," ms"]},void 0,!0,void 0,this),$.jsxDEV("span",{children:[Y," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.map((H)=>{let L=Date.parse(H.entry.occurredAt)-X,z=H5(H),W=I0(H.entry);return $.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("div",{className:Z===z?"ws-span on":"ws-span",role:"row",onClick:()=>F(Z===z?null:z),children:[$.jsxDEV("span",{role:"cell",className:"ws-span-name",children:[$.jsxDEV(l1,{vendor:H.twin},void 0,!1,void 0,this),$.jsxDEV("b",{children:B1(H.twin)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[W.what,W.label?` “${W.label}”`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{role:"cell",className:"ws-span-track",children:[$.jsxDEV("span",{className:"ws-span-dot",style:{left:`${L/Y*100}%`}},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-span-at mode",style:{left:`${L/Y*100}%`},children:["+",L," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z===z?$.jsxDEV("div",{className:"ws-span-detail",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:KQ(H.entry)},void 0,!1,void 0,this)," on ",$.jsxDEV("code",{children:[H.entry.subject.type,":",$2(H.entry)]},void 0,!0,void 0,this)," · ",d5(H.entry,H.caller)," · ",e_(H.entry)]},void 0,!0,void 0,this),$.jsxDEV(LQ,{fields:H.entry.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},z,!0,void 0,this)})]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function iZ({name:_,token:Q,vendor:J,withScreens:q,tick:U}){let G=u1(Q,`/-/${_}/checkpoint/${J}`,Math.floor(U/6)),Z=G.state==="ok"?G.data.tree.filter((M)=>M.deleted!==!0):[],F=[...new Set(Z.map((M)=>M.type))].map((M)=>({type:M,count:Z.filter((P)=>P.type===M).length})).sort((M,P)=>Number(M.type.startsWith("_"))-Number(P.type.startsWith("_"))||x2(M.type).localeCompare(x2(P.type))),[X,Y]=c.useState(null),[K,H]=c.useState(null),L=F.some((M)=>M.type===X)?X:F[0]?.type,z=Z.filter((M)=>M.type===L),W=z.find((M)=>M.id===K)??z[0],w=["name","email","title","text","description","subject","amount","percent_off","unit_amount","currency","status","channel","customer","product"],R=new Set(["id","type","object","livemode","created","updated","updatedAt","deleted"]),A=(M)=>!R.has(M)&&z.some((P)=>P[M]!==void 0&&P[M]!==null&&typeof P[M]!=="object"),O=[...new Set(z.flatMap((M)=>Object.keys(M)))],B=[...w.filter(A),...O.filter((M)=>!w.includes(M)&&A(M))].slice(0,4);return $.jsxDEV("div",{className:"ws-table-app",children:[$.jsxDEV("nav",{className:"ws-tables","aria-label":`${B1(J)}'s records`,children:[$.jsxDEV("div",{className:"ws-list-head",children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:J},void 0,!1,void 0,this),B1(J)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(U0,{load:G,what:"what it stores",lines:4},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Stores"},void 0,!1,void 0,this),F.map((M)=>$.jsxDEV("a",{href:`#${M.type}`,className:L===M.type?"on":void 0,"aria-current":L===M.type?"true":void 0,onClick:(P)=>{P.preventDefault(),Y(M.type),H(null)},children:[$.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:x2(M.type)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"count",children:M.count},void 0,!1,void 0,this)]},M.type,!0,void 0,this)),$.jsxDEV("p",{className:"menu-label",children:"Also"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/events/${J}`,onClick:(M)=>{M.preventDefault(),j1([..._.split("/"),"~","events",J])},children:[$.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its events"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q?$.jsxDEV("a",{href:`${A1}/${_}/~/screens/${J}`,onClick:(M)=>{M.preventDefault(),j1([..._.split("/"),"~","screens",J])},children:[$.jsxDEV(w1,{name:"monitor",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[G.state==="ok"&&F.length===0?$.jsxDEV(Z5,{title:`${B1(J)} stores nothing yet`,children:$.jsxDEV("p",{children:"What your app makes there shows here, by type."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,z.length?$.jsxDEV("table",{className:"ws-grid","aria-label":`${x2(L??"")} records`,children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),B.map((M)=>$.jsxDEV("th",{children:M},M,!1,void 0,this)),$.jsxDEV("th",{children:"updated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:z.map((M)=>$.jsxDEV("tr",{className:W?.id===M.id?"on":void 0,"aria-selected":W?.id===M.id,onClick:()=>H(M.id),children:[$.jsxDEV("td",{children:$.jsxDEV("code",{children:M.id},void 0,!1,void 0,this)},void 0,!1,void 0,this),B.map((P)=>$.jsxDEV("td",{className:"ws-cell-clip",children:M[P]===void 0||M[P]===null?$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this):String(M[P])},P,!1,void 0,this)),$.jsxDEV("td",{className:"mode",children:typeof M.updatedAt==="string"?$.jsxDEV(V1,{iso:M.updatedAt},void 0,!1,void 0,this):"—"},void 0,!1,void 0,this)]},M.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("aside",{className:"ws-record","aria-label":"The selected record",children:W?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:x2(W.type)},void 0,!1,void 0,this),$.jsxDEV("code",{children:W.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("dl",{className:"ws-record-fields",children:Object.entries(W).filter(([M])=>M!=="type"&&M!=="id").map(([M,P])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:M},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{v:P},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},M,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:W?`${z.indexOf(W)+1} of ${E1(z.length,x2(L??"record"))}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rZ({name:_,vendor:Q,url:J,mapError:q,holding:U,session:G,retry:Z}){return $.jsxDEV("div",{className:"ws-screen",children:[$.jsxDEV("div",{className:"ws-screen-bar",children:[$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:Q},void 0,!1,void 0,this),$.jsxDEV("b",{children:B1(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:U},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/vendors/${Q}`,onClick:(F)=>{F.preventDefault(),j1([..._.split("/"),"~","vendors",Q])},children:[$.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),"Its records"]},void 0,!0,void 0,this),J?$.jsxDEV("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:[$.jsxDEV(w1,{name:"external-link",size:16},void 0,!1,void 0,this),"New tab"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),G.state==="ok"&&G.scope==="read"?$.jsxDEV("p",{className:"mode ws-screens-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,q?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not say where its screens are: ",q]},void 0,!0,void 0,this):G.state==="pending"||J===void 0?$.jsxDEV("p",{className:"mode ws-screens-note",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,G.state==="error"?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not open its screens: ",G.error," ",$.jsxDEV("button",{type:"button",onClick:Z,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,G.state==="ok"&&J===null?$.jsxDEV("p",{className:"mode ws-screens-note",children:[B1(Q),"'s pack lists no screens."]},void 0,!0,void 0,this):null,G.state==="ok"&&J?$.jsxDEV("iframe",{title:`${B1(Q)}, as this World shows it`,src:J},Q,!1,void 0,this):null]},void 0,!0,void 0,this)}function dZ({name:_,token:Q,who:J,scope:q}){let[U,G]=c.useState(0),Z=u1(Q,`/-/${_}/twins`),F=u1(Q,`/-/${_}/rules`,U),X=F.state==="ok"?F.data.changesets:null,[Y,K]=c.useState(null),[H,L]=c.useState(null),[z,W]=c.useState(!1),[w,R]=c.useState([]),A=Y??X?.approvals??1,O=H??X?.summary??"required",B=X!==null&&(A!==(X.approvals??1)||O!==(X.summary??"required")),M=(k,u)=>{if(R((i)=>[{ok:k,text:u,at:new Date().toISOString(),n:++t5},...i].slice(0,3)),!k)g1(u,"error")},P=async(k)=>{k.preventDefault(),W(!0);try{let u=await S1(Q,`/-/${_}/rules`,{method:"PUT",body:JSON.stringify({changesets:{approvals:A,summary:O}})});if(!u.ok){M(!1,`Save: ${await K0(u)}`);return}M(!0,`Saved: ${A===0?"no approval":E1(A,"approval")} before a deploy; a summary ${O==="required"?"required":"generated when none is given"}.`),K(null),L(null),G((i)=>i+1)}finally{W(!1)}},C={gated:"a person deploys an approved changeset",auto:"a push deploys at once",hold:"nothing deploys"},f=J.person?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:J.person},void 0,!1,void 0,this),J.local?", signed in on this machine":""]},void 0,!0,void 0,this):J.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this machine"},void 0,!1,void 0,this),": no one is signed in here, so no person owns them until they are pushed by one"]},void 0,!0,void 0,this):J.admin?$.jsxDEV($.Fragment,{children:$.jsxDEV("b",{children:"the host's admin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this token"},void 0,!1,void 0,this),", a service"]},void 0,!0,void 0,this),v=Z.state==="ok"?Z.data.twins.filter((k)=>k.root?.url):[],N=q!=="write"?"This session reads the World; it changes no rules":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Changesets"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"This World's rules, kept with it and shared by everyone who works in it. A person or the World's token changes them; a key never does, so an agent cannot relax the review its own changes go through."},void 0,!1,void 0,this),$.jsxDEV(U0,{load:F,what:"the rules",lines:2},void 0,!1,void 0,this),$.jsxDEV("form",{className:"ws-rules",onSubmit:(k)=>void P(k),"aria-label":"Changeset rules",children:[$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Recorded as"},void 0,!1,void 0,this),$.jsxDEV("p",{children:["What you cut here is recorded as ",f,". An agent's or an app's key cuts as itself, for the person it was made for; a World's token cuts as a service."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"A cut's summary"},void 0,!1,void 0,this),$.jsxDEV("fieldset",{className:"choice",disabled:Boolean(N)||X===null,children:[$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:O==="required",onChange:()=>L("required")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Required: whoever cuts says what it does and why"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:O==="generated",onChange:()=>L("generated")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Generated from its changes when none is given"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Either way a cut takes every change not yet in a changeset: there is no staging."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Ready to deploy"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-rule-list",children:$.jsxDEV("li",{children:[$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this),"Verified: replayed in a throwaway World, the World's checks passing"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("label",{className:"ws-rule-row",children:[$.jsxDEV("span",{children:"Approved by"},void 0,!1,void 0,this),$.jsxDEV("select",{value:A,onChange:(k)=>K(Number(k.target.value)),disabled:Boolean(N)||X===null,"aria-label":"Approvals required",children:[0,1,2,3,4,5].map((k)=>$.jsxDEV("option",{value:k,children:k===0?"no one: verified is enough":k===1?"1 person":`${k} different people`},k,!1,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"for its contents as they stand"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Deploys to"},void 0,!1,void 0,this),Z.state==="ok"&&v.length===0?$.jsxDEV("p",{className:"mode",children:"No vendor here is connected to its real service, so nothing deploys from this World."},void 0,!1,void 0,this):null,v.length?$.jsxDEV("ul",{className:"ws-rule-list",children:v.map((k)=>$.jsxDEV("li",{children:[$.jsxDEV(l1,{vendor:k.twin},void 0,!1,void 0,this),B1(k.twin),": ",C[k.root.deploy??"gated"]??"gated"]},k.twin,!0,void 0,this))},void 0,!1,void 0,this):null,$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("a",{href:`${A1}/${_}/~/settings/services`,onClick:(k)=>{k.preventDefault(),j1([..._.split("/"),"~","settings","services"])},children:"Real services"},void 0,!1,void 0,this)," sets each vendor's deploy policy."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(B2,{log:w,name:_},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(N)||z||!B,title:N??void 0,children:z?"Saving…":"Save"},void 0,!1,void 0,this),B?$.jsxDEV("button",{type:"button",onClick:()=>{K(null),L(null)},children:"Cancel"},void 0,!1,void 0,this):null,N?$.jsxDEV("span",{className:"mode",children:[N,"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function aZ({who:_,scope:Q,snapshot:J,portal:q,onSignOut:U}){let G=Q==="write"?"Reads and changes this World":Q==="read"?"Reads this World; changes nothing":"…",[Z,F]=J?["A snapshot",`of ${J.parent}, read only`]:_.local&&_.person?[_.person,"Signed in on this machine: this World is served here, and acts as you"]:_.local?["This machine","Served here, with no one signed in: what you do is recorded as this machine"]:_.person?[_.person,q?`Signed in through ${new URL(q).host}`:"Signed in"]:_.admin?["The host's admin","Opened with the host admin token: every World it serves"]:["A link or key","Opened with a token for this World"];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Account"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-account",children:[$.jsxDEV("span",{className:"ws-account-face","aria-hidden":"true",children:$.jsxDEV(w1,{name:_.person?"user":_.local?"monitor":J?"clock":"key-round",size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:Z},void 0,!1,void 0,this),$.jsxDEV("small",{children:F},void 0,!1,void 0,this),$.jsxDEV("small",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_.local||J?null:$.jsxDEV("p",{children:$.jsxDEV("button",{type:"button",onClick:U,children:[$.jsxDEV(w1,{name:"log-out",size:16},void 0,!1,void 0,this),_.person?"Sign out":_.admin?"Sign out of the host":"Use another token"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&_.person?$.jsxDEV("p",{className:"mode",children:["Your profile, orgs and keys are on ",$.jsxDEV("a",{href:`${q}/`,children:new URL(q).host},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function sZ({name:_,token:Q,view:J,sub:q,arg:U,win:G,who:Z,snapshot:F,onReturn:X,onSignOut:Y,worlds:K,session:H,retry:L,twins:z,map:W,branches:w,clock:R,canWrite:A,refused:O,signsAs:B,opens:M,tick:P,admin:C,onRemoved:f,onClock:v,scope:N}){let k=TQ(_,Q,P,O),[u,i]=c.useState(0),l=u*1e5+Math.floor(P/2),S=u1(Q,`/-/${_}/diff`,l),b=u1(Q,`/-/${_}/changesets`,l),h=u1(Q,`/-/${_}/rules`,l),[E,j]=c.useState(null),m=(n)=>(R1)=>{R1?.preventDefault(),j1([..._.split("/"),"~",...n])},I=z.state==="ok"?z.data.twins.map((n)=>n.twin):[],V=new Map((W.state==="ok"?W.data.twins:[]).flatMap((n)=>{let R1=EZ(_,n);return R1?[[n.twin,R1]]:[]})),D=[...V.keys()],y=W.state==="ok"?W.data.twins.filter((n)=>n.root).map((n)=>n.twin):[],t=(n)=>W.state==="ok"?(W.data.twins.find((R1)=>R1.twin===n)?.resources??[]).reduce((R1,H1)=>R1+H1.count,0):0,_1=w?.state==="ok"&&w.data.checkedOut||_.split("/")[1],a=c.useMemo(()=>{if(S.state!=="ok")return[];let n=new Map;for(let R1 of S.data.changes){let H1=`${R1.twin}:${R1.entry.subject.type}:${R1.entry.subject.id}`,x1=n.get(H1)??{key:H1,twin:R1.twin,writes:[]};x1.writes.push(R1.entry),n.set(H1,x1)}return[...n.values()]},[S]),o=a.find((n)=>n.key===E)??a[0],p=u1(Q,J==="changes"&&o?`/-/${_}/log/${o.twin}`:null,l),e=S.state==="ok"?S.data.changes.length:0,$1=k.waiting.length,U1=k.there,q1=k.origin.state==="ok"?k.origin.data.origin:null,K1=!A?"This session reads the World; it changes nothing":!U1?"No remote: name one in Settings › Remote":null,W1=(n,R1,H1,x1,a1,i1)=>$.jsxDEV("a",{href:`${A1}/${_}/~/${x1}`,className:n?"on":void 0,"aria-current":n?"page":void 0,onClick:a1,children:[R1,$.jsxDEV("span",{children:H1},void 0,!1,void 0,this),i1?$.jsxDEV("span",{className:"count",children:i1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Y1=(n)=>{n.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("div",{className:"ws",children:[$.jsxDEV("div",{className:"ws-bar",role:"toolbar","aria-label":`${_} toolbar`,children:[$.jsxDEV("div",{className:"ws-left",children:[$.jsxDEV(i5,{href:`${A1}/${_}`,onClick:(n)=>{n.preventDefault(),m(["changes"])()}},void 0,!1,void 0,this),$.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"This World",children:[$.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("b",{children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover menu-list ws-world-menu",children:[Z.local?null:$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Worlds"},void 0,!1,void 0,this),K.map((n)=>$.jsxDEV("a",{href:`${A1}/${n}`,className:n===_?"on":void 0,onClick:(R1)=>{R1.preventDefault(),Y1(R1),j1(n.split("/"))},children:[n===_?$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),n]},n,!0,void 0,this)),$.jsxDEV("a",{href:`${v0()&&v0()!==y1?v0():""}${A1}/`,onClick:(n)=>{if(v0()&&v0()!==y1)return;n.preventDefault(),Y1(n),j1([])},children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),"All Worlds",G0()?` on ${new URL(G0()).host}`:""]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Connect an app"},void 0,!1,void 0,this),G0()?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key made on the platform; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[Q2,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(F8,{text:c4({platform:G0(),world:_})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!Z.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key from Settings › Access; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[Q2,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(F8,{text:c4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Run it in this World; its calls to these vendors land here:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-menu-text mode",children:["Or point an SDK at ",$.jsxDEV("code",{children:[Q2,"/",_,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",$.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),$.jsxDEV(F8,{text:c4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/settings`,onClick:(n)=>{Y1(n),m(["settings"])(n)},children:[$.jsxDEV(w1,{name:"settings",size:16},void 0,!1,void 0,this),"Settings…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(gZ,{name:_,token:Q,branches:w,opens:M,refused:O,onChanged:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-where",title:"Where this is",children:[$.jsxDEV("span",{children:_},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("span",{children:_1},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),q1?$.jsxDEV("a",{href:`${A1}/${_}/~/remote`,onClick:m(["remote"]),children:["origin ",q1.namespace,$1?$.jsxDEV("b",{children:[" ↑",$1]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("a",{href:`${A1}/${_}/~/remote`,onClick:m(["remote"]),children:"no remote"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/settings/clock`,onClick:m(["settings","clock"]),children:R.state==="ok"?$.jsxDEV($.Fragment,{children:[R.data.frozen?"stopped at ":"",$.jsxDEV(V1,{iso:R.data.at,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-right",children:[$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.pull(),disabled:Boolean(K1)||k.busy!==null,title:K1??`Fetch what ${U1} has and move this branch onto it`,children:[$.jsxDEV(w1,{name:"arrow-down-to-line",size:16},void 0,!1,void 0,this),k.busy==="Pull"?"Pulling…":"Pull"]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.push(),disabled:Boolean(K1)||k.busy!==null||$1===0,title:K1??($1?`Push ${E1($1,"changeset")} to ${U1}`:`Every changeset is at ${U1}`),children:[$.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this),k.busy==="Push"?"Pushing…":"Push",$1?$.jsxDEV("span",{className:"ws-btn-count",children:$1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn icon-only","aria-label":"Settings",title:"Settings",onClick:()=>m(["settings"])(),children:$.jsxDEV(w1,{name:"settings",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F?$.jsxDEV("div",{className:"ws-banner",role:"region","aria-label":"Snapshot",children:[$.jsxDEV(w1,{name:"clock",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:["You are looking at ",$.jsxDEV("b",{children:F.parent},void 0,!1,void 0,this)," as it was at ",$.jsxDEV(V1,{iso:F.at},void 0,!1,void 0,this),": a read-only snapshot",F.expiresAt?$.jsxDEV($.Fragment,{children:[", gone ",$.jsxDEV(V1,{iso:F.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void X(F),children:"Return to live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,k.log.length?$.jsxDEV("div",{className:"ws-said",children:$.jsxDEV(B2,{log:k.log.slice(0,1),name:_},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV("div",{className:"ws-body",children:[$.jsxDEV("nav",{className:"ws-side","aria-label":`${_} places`,children:[I.length?$.jsxDEV("a",{href:`${A1}/${_}/~/screens`,className:J==="screen"?"ws-screens-entry on":"ws-screens-entry",onClick:m(["screens"]),title:`The board: ${D2(I.map(B1))}`,children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Board"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-screens-marks",children:[I.slice(0,3).map((n)=>$.jsxDEV(l1,{vendor:n},n,!1,void 0,this)),I.length>3?$.jsxDEV("span",{className:"more",children:["+",I.length-3]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{className:"side-group",children:"Workspace"},void 0,!1,void 0,this),W1(J==="changes"||J==="history",$.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this),"Changes","changes",m(["changes"]),a.length?String(a.length):void 0),W1(J==="events"&&!U||J==="trace",$.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),"Events","events",m(["events"])),$.jsxDEV("p",{className:"side-group",children:"Records"},void 0,!1,void 0,this),I.map((n)=>$.jsxDEV(c.default.Fragment,{children:W1(J==="vendor"&&U===n,$.jsxDEV(l1,{vendor:n},void 0,!1,void 0,this),B1(n),`vendors/${n}`,m(["vendors",n]),t(n)?String(t(n)):void 0)},n,!1,void 0,this)),$.jsxDEV("p",{className:"side-group",children:"Remote"},void 0,!1,void 0,this),W1(!1,$.jsxDEV(w1,{name:"cloud",size:16},void 0,!1,void 0,this),U1?"origin":"Name a remote…","remote",m(["remote"]),$1?`↑${$1}`:void 0)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-main",role:"main",children:[J==="changes"?$.jsxDEV("div",{className:"ws-status",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(ZQ,{name:_,view:"changes",changes:a.length,changesets:b.state==="ok"?b.data.changesets.length:0},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:"Not in a changeset"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:S.state==="ok"?`${E1(a.length,"record")} · ${E1(e,"write")}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(U0,{load:S,what:"the changes",lines:4},void 0,!1,void 0,this),$.jsxDEV(GQ,{records:a,...o?{selected:o.key}:{},onPick:j,label:"Changed records"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:[S.state==="ok"&&!o?$.jsxDEV(Z5,{title:"No changes on this branch",action:$1>0&&U1?$.jsxDEV("button",{type:"button",className:"primary",disabled:Boolean(K1)||k.busy!==null,onClick:()=>void k.push(),children:["Push ",E1($1,"changeset")," to origin"]},void 0,!0,void 0,this):void 0,children:$.jsxDEV("p",{children:["What your app writes to this World lands here, record by record, to cut into a changeset. Everything since ",S.data.base.at?$.jsxDEV(V1,{iso:S.data.base.at},void 0,!1,void 0,this):$.jsxDEV("code",{children:S.data.base.id},void 0,!1,void 0,this)," is in one already."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,o?$.jsxDEV(UQ,{record:o,history:p.state==="ok"?p.data.entries:p.state==="error"?[]:null},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(AF,{pinned:!0,generated:h.state==="ok"&&h.data.changesets.summary==="generated",author:{face:$.jsxDEV(w1,{name:Z.person?"user":Z.local?"monitor":"key-round",size:18},void 0,!1,void 0,this),who:Z.person??(Z.local?"This machine":Z.admin?"The host's admin":"A token"),account:`${A1}/${_}/~/settings/account`,branch:_1},name:_,token:Q,changes:e,canWrite:A,refused:O,onCut:()=>{i((n)=>n+1),j(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J==="history"?$.jsxDEV(pZ,{name:_,token:Q,sets:b,changes:a.length,withScreens:D,required:h.state==="ok"?h.data.changesets.approvals??1:1,...q?{sub:q}:{},signsAs:B,canWrite:A,rooted:y,refused:O,onChanged:()=>i((n)=>n+1)},void 0,!1,void 0,this):null,J==="events"?$.jsxDEV(cZ,{name:_,token:Q,vendors:I,...U&&I.includes(U)?{vendor:U}:{},tick:P},U??"",!1,void 0,this):null,J==="trace"?$.jsxDEV(lZ,{name:_,token:Q,id:U??""},void 0,!1,void 0,this):null,J==="vendor"&&U?$.jsxDEV(iZ,{name:_,token:Q,vendor:U,withScreens:D.includes(U),tick:P},U,!1,void 0,this):null,J==="screen"&&U?$.jsxDEV(rZ,{name:_,vendor:U,url:W.state==="ok"?V.get(U)??null:void 0,...W.state==="error"?{mapError:W.error}:{},holding:oZ(W.state==="ok"?W.data.twins.find((n)=>n.twin===U)?.resources??[]:[]),session:H,retry:L},U,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(W0,{open:G?.kind==="settings",onClose:()=>m(["changes"])(),title:"Settings",wide:"window",children:G?.kind==="settings"?$.jsxDEV("div",{className:"ws-settings",children:[$.jsxDEV("nav",{"aria-label":"Settings",children:qQ.map(([n,R1,H1])=>$.jsxDEV("a",{href:`${A1}/${_}/~/settings/${n}`,className:G.tab===n?"on":void 0,"aria-current":G.tab===n?"page":void 0,onClick:m(["settings",n]),children:[$.jsxDEV(w1,{name:H1,size:16},void 0,!1,void 0,this),R1]},n,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-settings-pane",children:[N==="read"?$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"badge read-only",children:"Read only"},void 0,!1,void 0,this)," This session reads the World; it changes nothing."]},void 0,!0,void 0,this):null,G.tab==="account"?$.jsxDEV(aZ,{who:Z,scope:N,snapshot:F,portal:G0(),onSignOut:Y},void 0,!1,void 0,this):null,G.tab==="changesets"?$.jsxDEV(dZ,{name:_,token:Q,who:Z,scope:N},void 0,!1,void 0,this):null,G.tab==="remote"?$.jsxDEV(TF,{name:_,token:Q,canWrite:A,tick:P,refused:O},void 0,!1,void 0,this):null,G.tab==="access"||G.tab==="services"||G.tab==="checks"||G.tab==="clock"?$.jsxDEV(OF,{name:_,token:Q,admin:C,canWrite:A,refused:O,onRemoved:f,only:G.tab},void 0,!1,void 0,this):null,G.tab==="vault"?$.jsxDEV(RF,{name:_,token:Q,canWrite:A,refused:O},void 0,!1,void 0,this):null,G.tab==="appearance"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV(uZ,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV(W0,{open:G?.kind==="branches",onClose:()=>m(["changes"])(),title:"Branches",wide:!0,children:G?.kind==="branches"?$.jsxDEV(_F,{name:_,token:Q,canWrite:A,branches:w,opens:M,...G.open?{open:G.open}:{},onChanged:v,refused:O},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function F8({text:_}){return $.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>g1("Copied the prompt: paste it into your coding agent"),()=>g1("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}var A8=(_)=>`${_.url.replace(/\/+$/,"")}/${_.namespace}`,tZ=(_)=>_.filter((Q)=>Q.applied===null||Q.applied.outcome==="refused"),oZ=(_,Q=4)=>{let J=[..._].filter((q)=>q.count>0).sort((q,U)=>U.count-q.count);return J.length?J.slice(0,Q).map((q)=>E1(q.count,q.type.replace(/^_+/,""))).join(" · ")+(J.length>Q?` · +${J.length-Q} more`:""):"nothing yet"},FQ=$.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:$.jsxDEV("path",{fill:"currentColor",d:"M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v5.256a2.25 2.25 0 1 0 1.5 0V9.5h4.25A2.25 2.25 0 0 0 11.5 7.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75H5V5.372ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm6.5-9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function nZ({name:_,token:Q,clock:J,canWrite:q,onChanged:U,refused:G,open:Z}){let[F,X]=c.useState(!1),[Y,K]=c.useState(""),[H,L]=c.useState(""),[z,W]=c.useState(null),[w,R]=c.useState(!1),A=J.state==="ok"?J.data:null,O=async(C,f,v)=>{R(!0),W(null);try{let N=await S1(Q,`/-/${_}/${f}`,{method:f==="clock"?"PUT":"POST",body:JSON.stringify(v)});if(!N.ok){G(N),W({ok:!1,text:await K0(N)});return}let k=await N.json();W({ok:!0,text:`${C} — the World is at ${new Date(k.at).toLocaleString()}`}),X(!1),U()}catch(N){W({ok:!1,text:`the World did not answer: ${N instanceof Error?N.message:String(N)}`})}finally{R(!1)}},B=(C)=>{C.preventDefault();let f=new Date(Y);if(Number.isNaN(f.getTime())){W({ok:!1,text:"Pick a date and time."});return}if(A&&f.getTime()<Date.parse(A.at)){W({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(A.at).toLocaleString()}.`});return}O("Clock set","clock",{at:f.toISOString()})},M=(C,f)=>{O(`Advanced ${f}`,"clock/advance",{by:C})},P=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return $.jsxDEV("div",{className:`clock${A?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[$.jsxDEV("p",{className:"clock-now",children:J.state==="loading"?$.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):J.state==="error"?$.jsxDEV("span",{className:"mode",children:["Clock: ",J.error]},void 0,!0,void 0,this):A.frozen?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",$.jsxDEV("strong",{children:$.jsxDEV(V1,{iso:A.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:["World time ",$.jsxDEV("strong",{children:$.jsxDEV(V1,{iso:A.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"· real time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&A?$.jsxDEV("details",{className:Z?"clock-more inline":"clock-more",open:Z||void 0,children:[$.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),$.jsxDEV("div",{className:Z?void 0:"popover",children:[$.jsxDEV("p",{className:"mode",children:"Move this World's clock forward to see what happens later: renewals, expiries, scheduled sends. Like a test clock, it only moves forward; to look back, the branch picker’s Manage branches… views an earlier moment."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"clock-controls",children:[$.jsxDEV("button",{type:"button","aria-expanded":F,onClick:()=>{X(!F),K(X5(x_(A.at))),W(null)},children:"Set time…"},void 0,!1,void 0,this),$.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[$.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),P.map(([C,f])=>$.jsxDEV("button",{type:"button","aria-label":`Advance ${f}`,disabled:w||!A.frozen,title:A.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>M(C,f),children:f},C,!1,void 0,this)),$.jsxDEV("form",{className:"inline",onSubmit:(C)=>{if(C.preventDefault(),!/^\d+[smhd]$/.test(H.trim())){W({ok:!1,text:"Advance by a number and a unit: 90m, 12h, 3d."});return}M(H.trim(),`by ${H.trim()}`)},children:[$.jsxDEV("label",{className:"sr",children:["Advance by ",$.jsxDEV("input",{name:"advanceBy",value:H,onChange:(C)=>L(C.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!A.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:w||!A.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!A.frozen?$.jsxDEV("p",{className:"mode",children:"The World runs on real time. Set a time to start simulating; then advance it."},void 0,!1,void 0,this):null,F?$.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:B,noValidate:!0,children:[$.jsxDEV("label",{children:["World time ",$.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:Y,min:X5(x_(A.at)),onChange:(C)=>K(C.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",disabled:w,children:"Set time"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>X(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,z?$.jsxDEV("p",{role:z.ok?"status":"alert",children:z.text},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function eZ({name:_,token:Q,clock:J,refused:q}){let[U,G]=c.useState(!1),[Z,F]=c.useState(""),[X,Y]=c.useState(null),[K,H]=c.useState(!1),L=J.state==="ok"?J.data.at:new Date().toISOString(),z=c.useRef(null);return c.useEffect(()=>{if(!U)return;let w=(A)=>{if(A.key==="Escape"&&!document.querySelector("dialog[open]"))G(!1),z.current?.querySelector("button")?.focus()},R=(A)=>{if(!z.current?.contains(A.target))G(!1)};return document.addEventListener("keydown",w),document.addEventListener("click",R),()=>{document.removeEventListener("keydown",w),document.removeEventListener("click",R)}},[U]),$.jsxDEV("div",{className:"as-of",ref:z,children:[$.jsxDEV("button",{type:"button","aria-expanded":U,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{G(!U),F(X5(L)),Y(null)},children:"View an earlier moment…"},void 0,!1,void 0,this),U?$.jsxDEV("form",{className:"inline","aria-label":"View the World as of a past moment",onSubmit:async(w)=>{w.preventDefault(),Y(null);let R=new Date(Z);if(Number.isNaN(R.getTime())){Y("Pick a date and time.");return}if(R.getTime()>Date.parse(L)){Y(`That is after the World's present (${new Date(L).toLocaleString()}); a snapshot looks back.`);return}H(!0);try{let A=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:R.toISOString()},ttl:3600})});if(!A.ok){q(A),Y(await K0(A));return}let O=await A.json();L8({name:O.name,parent:_,token:O.token,readToken:O.readToken,at:R.toISOString(),expiresAt:O.expiresAt??null,parentOrigin:y1,made:!0});let B=s5(O.origin)?.origin;if(B&&B!==y1){B8(B,O.readToken,O.name,`${A1}/${O.name}`);return}j1(O.name.split("/"))}catch(A){Y(`the World did not answer: ${A instanceof Error?A.message:String(A)}`)}finally{H(!1)}},noValidate:!0,children:[$.jsxDEV("label",{children:["As of ",$.jsxDEV("input",{name:"asOf",type:"datetime-local",value:Z,max:X5(L),onChange:(w)=>F(w.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:K,children:K?"Opening…":"Open snapshot"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Opens a read-only copy of this World as it was then; the copy goes away within the hour."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function HQ({name:_,token:Q,open:J,onClose:q,onMade:U,refused:G}){let Z=(f)=>f.split("/").pop()??f,[F,X]=c.useState(!1),[Y,K]=c.useState(null),[H,L]=c.useState(""),[z,W]=c.useState("now"),[w,R]=c.useState(""),[A,O]=c.useState("24"),[B,M]=c.useState(!0);c.useEffect(()=>{if(J)K(null),R(X5(new Date().toISOString()))},[J]);let P=async(f)=>{f.preventDefault(),K(null);let v=z==="at"?new Date(w):null;if(v&&Number.isNaN(v.getTime())){K("Pick a date and time, or make it as of now.");return}if(v&&v.getTime()>Date.now()){K("A branch is made as of now or a moment before it.");return}X(!0);let N=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({ttl:Math.round(Number(A)*3600),...v?{at:{instant:v.toISOString()}}:B?{live:!0}:{},...H.trim()?{label:H.trim()}:{}})}).catch(()=>null);if(X(!1),!N){K(`${y1} did not answer`);return}if(!N.ok){G(N),K(await K0(N));return}let k=await N.json();L8({name:k.name,parent:_,token:k.token??"",readToken:k.readToken,at:(v??new Date).toISOString(),expiresAt:k.expiresAt??null,parentOrigin:y1,...k.origin?{origin:k.origin}:{}}),q(),L(""),g1(`Made ${Z(k.name)}`),U()};return $.jsxDEV(W0,{open:J,onClose:()=>{if(!F)q()},title:`New branch of ${Z(_)}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>q(),disabled:F,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"new-branch",className:"primary",disabled:F,children:F?"Making…":"Make branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"new-branch",onSubmit:(f)=>void P(f),className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Label ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"branchLabel",value:H,onChange:(f)=>L(f.target.value.toLowerCase()),placeholder:"checkout-flow",pattern:"[a-z0-9][a-z0-9\\-]{0,23}",maxLength:24},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("fieldset",{className:"choice",children:[$.jsxDEV("legend",{children:"From"},void 0,!1,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="now",onChange:()=>W("now")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Now: the World as it is"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="now"?$.jsxDEV("label",{className:"check sub",children:[$.jsxDEV("input",{type:"checkbox",name:"branchLive",checked:B,onChange:(f)=>M(f.target.checked)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Live: its clock keeps this World's time, as a pull request's preview does (else it stops now)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="at",onChange:()=>W("at")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"An instant before now: the World as it was then, its clock stopped there"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="at"?$.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:w,max:X5(new Date().toISOString()),onChange:(f)=>R(f.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"branchLife",value:A,onChange:(f)=>O(f.target.value),children:[$.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"168",children:"7 days"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"alert",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function _F({name:_,token:Q,canWrite:J,branches:q,opens:U,open:G,onChanged:Z,refused:F,snapshotOf:X}){let Y=u1(Q,`/-/${_}/clock`),K=(O)=>O.split("/").pop()??O,[H,L]=c.useState(!1),z=(O)=>(B)=>{B.preventDefault(),j1([..._.split("/"),"~","branches",...O?O.split("/"):[]])};if(!q)return $.jsxDEV("p",{className:"mode",children:"This host makes no branches of a World."},void 0,!1,void 0,this);let W=q.state==="ok"?q.data.branches:[],w=q.state==="ok"&&(q.data.named?.length??0)>0?q.data.named:[{name:K(_),running:!0}],R=q.state==="ok"?q.data.checkedOut??K(_):K(_),A=async(O)=>{if(!await g0({title:`Remove the branch ${K(O)}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Remove branch",danger:!0}))return;let B=await S1(Q,`/-/${_}/branches/${O}`,{method:"DELETE"}).catch((M)=>M);if(B instanceof Error){g1(`Remove ${K(O)}: the World did not answer (${B.message})`,"error");return}if(!B.ok){F(B),g1(`Remove ${K(O)}: ${await K0(B)}`,"error");return}r4(O),g1(`Removed ${K(O)}`),Z(),j1([..._.split("/"),"~","branches"])};if(G){let O=G.includes("/")?W.find((M)=>M.name===G):void 0,B=G.includes("/")?void 0:w.find((M)=>M.name===G);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${A1}/${_}/~/branches`,onClick:z(),children:"← Branches"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(U0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"&&!O&&!B?$.jsxDEV("p",{className:"mode",children:["This World has no branch named ",G,"."]},void 0,!0,void 0,this):null,O?$.jsxDEV(QF,{name:_,b:O,canWrite:J,opens:U(O.name),remove:()=>void A(O.name)},void 0,!1,void 0,this):null,B&&!O?$.jsxDEV(JF,{name:_,token:Q,b:B,served:B.name===R,canWrite:J,canServe:q.state==="ok"&&Boolean(q.data.canServe)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}return $.jsxDEV("div",{"aria-labelledby":"branches",children:[$.jsxDEV("div",{className:"branches-head",children:[$.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",$.jsxDEV("b",{children:R},void 0,!1,void 0,this),". Each branch's name opens its page."]},void 0,!0,void 0,this),J?$.jsxDEV("div",{className:"head-actions",children:[X?null:$.jsxDEV(eZ,{name:_,token:Q,clock:Y,refused:F},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>L(!0),children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(U0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:[w.map((O)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:[$.jsxDEV("a",{href:`${A1}/${_}/~/branches/${O.name}`,onClick:z(O.name),children:$.jsxDEV("b",{children:O.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),O.name===R?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):O.running?null:$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge",children:"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this)]},`own:${O.name}`,!0,void 0,this)),W.map((O)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("a",{href:`${A1}/${_}/~/branches/${O.name}`,onClick:z(O.name),children:$.jsxDEV("b",{children:K(O.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:K(O.from??_)},void 0,!1,void 0,this),$.jsxDEV("td",{children:O.at?.instant?$.jsxDEV(V1,{iso:O.at.instant},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV(V1,{iso:O.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:O.expiresAt?$.jsxDEV(V1,{iso:O.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},O.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(HQ,{name:_,token:Q,open:H,onClose:()=>L(!1),onMade:Z,refused:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QF({name:_,b:Q,canWrite:J,opens:q,remove:U}){let G=(X)=>X.split("/").pop()??X,Z=z8(Q.name),F=u1(Z,Z?`/-/${Q.name}/diff`:null);return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[FQ," ",G(Q.name)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>$Q(Q.name,Q.name.split("/")),children:"Open"},void 0,!1,void 0,this):null,J?$.jsxDEV("button",{type:"button",className:"danger-button",onClick:U,children:"Remove…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:Q.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:G(Q.from??_)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.at?.instant?$.jsxDEV(V1,{iso:Q.at.instant},void 0,!1,void 0,this):"live: it keeps its parent's time"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(V1,{iso:Q.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Goes away"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.expiresAt?$.jsxDEV(V1,{iso:Q.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),!q?$.jsxDEV("p",{className:"mode",children:"Its tokens were handed to whoever made it: it opens, and shows its own changes, in their tab."},void 0,!1,void 0,this):null,F.state==="ok"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Its changes"},void 0,!1,void 0,this),F.data.changes.length===0?$.jsxDEV("p",{className:"mode",children:"Nothing written on it since it branched."},void 0,!1,void 0,this):$.jsxDEV(BF,{changes:F.data.changes,idPrefix:`branch-${G(Q.name)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function JF({name:_,token:Q,b:J,served:q,canWrite:U,canServe:G}){let[Z,F]=c.useState(!1),[X,Y]=c.useState(null),K=async()=>{F(!0),Y(null);let H=await S1(Q,`/-/${_}/branches/${encodeURIComponent(J.name)}/serve`,{method:"POST"}).catch(()=>null);if(H?.ok){location.reload();return}F(!1),Y(H?await K0(H):`${y1} did not answer`)};return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[FQ," ",J.name," ",q?$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:U&&G&&!q?$.jsxDEV("button",{type:"button",className:"primary",disabled:Z,onClick:()=>void K(),children:Z?"Switching…":"Serve here"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:J.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Kind"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:"one of this World's own branches"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"State"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:J.running?"running":"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("p",{className:"mode",children:["This is the branch these pages show: its changes are on ",$.jsxDEV("a",{href:`${A1}/${_}/~/changes`,onClick:(H)=>{H.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Changes"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):G?$.jsxDEV("p",{className:"mode",children:["“Serve here” stops this one's twins and serves ",J.name," in its place."]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode",children:"This host serves one of the World's own branches at a time, and does not switch them from this page."},void 0,!1,void 0,this),X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var c_=50,H5=(_)=>`${_.twin}:${_.position}`,XQ=(_,Q)=>Date.parse(Q.entry.occurredAt)-Date.parse(_.entry.occurredAt)||_.twin.localeCompare(Q.twin)||Q.position-_.position,d4=(_)=>{if(!_)return"someone";if(_.startsWith("key:")){let[Q,J]=_.slice(4).split(" for:");return J?`${Q}, for ${J}`:Q||"a key"}if(_.startsWith("person:"))return _.slice(7);return _==="machine"?"this machine":_==="person"?"a session with no name":_==="token:read"?"the read-only token":_==="token"?"the World's token":_},d5=(_,Q)=>{let J=typeof Q==="string"?Q:typeof _.caller==="string"?_.caller:"";if(J.startsWith("key:")&&J.length>4)return`by ${d4(J)}`;if(J.startsWith("person:")&&J.length>7)return`by ${J.slice(7)}`;if(J==="machine")return"by this machine";if(J==="person")return"by a session with no name";if(J==="key")return"by a key";if(J==="token:read")return"by the read-only token";if(J==="token")return"by the World's token";return _.actor?.kind==="system"?"by the vendor":_.actor?.id?`by ${_.actor.id}`:"by an app"},KQ=(_)=>_.operation??_.op;function $F(_){let Q=_.fields??{},J=Q.usage!==null&&typeof Q.usage==="object"?Q.usage:Q,q=(...Y)=>Y.map((K)=>J[K]??Q[K]).find((K)=>typeof K==="number"),U=[],G=q("prompt_tokens","input_tokens"),Z=q("completion_tokens","output_tokens"),F=q("total_tokens");if(G!==void 0)U.push(["tokens in",G.toLocaleString()]);if(Z!==void 0)U.push(["tokens out",Z.toLocaleString()]);if(F!==void 0)U.push(["tokens in all",F.toLocaleString()]);let X=q("cost_usd","cost");if(X!==void 0)U.push(["cost",`$${X<0.01?X.toPrecision(2):X.toFixed(2)}`]);return U}function YQ({text:_,at:Q=280}){if(_.length<=Q)return $.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this);return $.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:[$.jsxDEV("span",{className:"text",children:[_.slice(0,Q),"…"]},void 0,!0,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:["show all ",_.length.toLocaleString()," characters"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function q2({v:_}){if(typeof _==="string")return $.jsxDEV(YQ,{text:_},void 0,!1,void 0,this);if(_===null||typeof _!=="object")return $.jsxDEV("code",{children:String(_)},void 0,!1,void 0,this);let Q=JSON.stringify(_,null,2);return Q.length<=160?$.jsxDEV("code",{children:JSON.stringify(_)},void 0,!1,void 0,this):$.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:$.jsxDEV("code",{children:[JSON.stringify(_).slice(0,120),"…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("pre",{children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var qF=(_)=>typeof _==="string"?_:Array.isArray(_)?_.map((Q)=>Q&&typeof Q==="object"&&typeof Q.text==="string"?Q.text:"").filter(Boolean).join(`
|
|
36
|
+
`):JSON.stringify(_??"");function UF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return $.jsxDEV(q2,{v:_},void 0,!1,void 0,this);let Q=_,J=Array.isArray(Q.messages)?Q.messages:null,q=Object.entries(Q).filter(([U])=>!(J&&U==="messages"));return $.jsxDEV($.Fragment,{children:[q.length?$.jsxDEV("dl",{className:"fields",children:q.map(([U,G])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:U},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{v:G},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},U,!0,void 0,this))},void 0,!1,void 0,this):null,J?$.jsxDEV("ol",{className:"messages",children:J.map((U,G)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:"role",children:typeof U.role==="string"?U.role:"message"},void 0,!1,void 0,this),$.jsxDEV(YQ,{text:qF(U.content)},void 0,!1,void 0,this)]},G,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function LQ({fields:_}){let Q=Object.entries(_??{});if(Q.length===0)return $.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return $.jsxDEV("dl",{className:"fields",children:Q.map(([J,q])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:J},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{v:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this))},void 0,!1,void 0,this)}var GF=(_)=>_.receipt?`${_.receipt.status??""}${_.receipt.externalId?` · ${_.receipt.externalId}`:""}${_.receipt.reason?` · ${_.receipt.reason}`:""}`:_.operation==="observed"?"observed from the vendor":_.provenance==="placeholder"?"default data":"none: it has not left this World";function ZF(_){let Q=new Map,J=[],q=[],U=new Map;for(let G of _){if(G.entry.landsId||G.entry.aliasOf){q.push(G);continue}let Z={...G,copies:[]};if(J.push(Z),!Q.has(`${G.twin}:${G.entry.id}`))Q.set(`${G.twin}:${G.entry.id}`,Z);if(!U.has(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`))U.set(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`,Z)}for(let G of q){let Z=G.entry.landsId?Q.get(`${G.twin}:${G.entry.landsId}`):G.entry.aliasOf?U.get(`${G.twin}:${G.entry.subject.type}:${G.entry.aliasOf}`):void 0;if(Z)Z.copies.push(G);else J.push({...G,copies:[]})}return J.sort(XQ)}var H8={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function l_(_){let Q=[_.entry.receipt,..._.copies.map((U)=>U.entry.receipt)].filter((U)=>Boolean(U?.status));if(Q.length===0)return null;let J=Q.find((U)=>U.status==="failed"||U.status==="refused"),q=[...Q].sort((U,G)=>(H8[G.status]??0)-(H8[U.status]??0))[0];return J&&!(H8[q.status]>=5)?{status:J.status,bad:!0}:{status:q.status,bad:!1}}var S0=1280,p0=820,l4=160,O0=72,K8=120,FF=72,p1=(_)=>`${_.vendor}:${_.id}`,b2=(_)=>`${_.vendor}:section:${_.section.id}`,m2=(_)=>[_.section.id,..._.section.aka??[]].map((Q)=>`${_.vendor}:section:${Q}`),zQ=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${Q2}/${_}/${Q.vendor}${Q.at.screen}`:null,i_=(_,Q)=>_.include?Q.filter((J)=>_.include.includes(p1(J))||m2(J).some((q)=>_.include.includes(q))):Q.filter((J)=>!(_.hidden??[]).includes(p1(J)));function HF({data:_}){let{frame:Q,url:J,active:q,picked:U,boards:G,addTo:Z,remove:F,compare:X}=_,Y=p1(Q),K=G.filter((L)=>L.include&&!L.include.includes(Y)&&!m2(Q).some((z)=>L.include.includes(z))),H=N1((L)=>L.transform[2]*(O0+K8)>=FF);return $.jsxDEV($.Fragment,{children:[$.jsxDEV(J8,{isVisible:H||U||q,position:F1.Top,align:"start",className:"frame-label",children:[$.jsxDEV(l1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q.title},void 0,!1,void 0,this),Q.changes?$.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>X(Y),title:`${E1(Q.changes,"change")} here, not in a changeset: compare before and now`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),Q.changes]},void 0,!0,void 0,this):U?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>X(Y),title:"Compare with a branch of this World","aria-label":`Compare ${Q.title} with a branch`,children:$.jsxDEV(w1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,U&&K.length?$.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${Q.title} to a board`,onChange:(L)=>{if(L.target.value)Z(L.target.value,Y)},children:[$.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),K.map((L)=>$.jsxDEV("option",{value:L.id,children:L.name},L.id,!1,void 0,this))]},void 0,!0,void 0,this):null,U&&F?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>F.act(Y),title:F.label,"aria-label":F.label,children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame on":U?"frame picked":"frame",style:{width:S0,height:p0},children:[$.jsxDEV("div",{className:"frame-bar",children:[$.jsxDEV(l1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:[B1(Q.vendor)," · ",Q.kind]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"frame-url",children:Q.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),J?$.jsxDEV("a",{className:"nodrag",href:J,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${Q.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame-body nodrag nopan nowheel":"frame-body",children:J?$.jsxDEV("iframe",{title:Q.title,src:J,loading:"lazy",style:{pointerEvents:q?"auto":"none"}},void 0,!1,void 0,this):$.jsxDEV("div",{className:"frame-none",children:[$.jsxDEV("p",{children:$.jsxDEV("strong",{children:Q.unseen==="sites-not-routed"?`This World shows ${Q.title} only at its own local address.`:`${B1(Q.vendor)}'s twin draws no page for this ${Q.kind} yet.`},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:Q.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function WQ({name:_,label:Q,done:J}){let q=c.useRef(!1),U=(G)=>{if(q.current)return;q.current=!0,J(G?.trim()&&G.trim()!==_?G.trim().slice(0,80):null)};return $.jsxDEV("input",{className:"nodrag nopan name-field","aria-label":Q,defaultValue:_,size:Math.max(8,_.length+2),autoFocus:!0,onFocus:(G)=>G.currentTarget.select(),onKeyDown:(G)=>{if(G.key==="Enter")U(G.currentTarget.value);else if(G.key==="Escape")U(null)},onBlur:(G)=>U(G.currentTarget.value)},void 0,!1,void 0,this)}function XF({data:_}){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(S_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),$.jsxDEV(J8,{isVisible:!0,position:F1.Top,align:"start",offset:-30,className:"section-tag",children:[_.renaming?$.jsxDEV(WQ,{name:_.name,label:"Name this section",done:(Q)=>_.renamed(_.key,Q)},void 0,!1,void 0,this):$.jsxDEV("button",{type:"button",className:_.picked?"nodrag on":"nodrag",onClick:()=>_.pick(_.key),onDoubleClick:()=>{if(_.editable)_.rename(_.key)},title:_.editable?"Double-click to rename":void 0,children:[_.vendor?$.jsxDEV(l1,{vendor:_.vendor},void 0,!1,void 0,this):null,$.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.picked&&_.editable&&!_.renaming?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>_.remove(_.key),"aria-label":`Remove the section ${_.name}`,title:"Remove the section (its frames stay)",children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r_({url:_,title:Q}){return $.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*p0/S0},children:$.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:S0,height:p0,transform:`scale(${420/S0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function KF({name:_,token:Q,frame:J,onClose:q,reads:U}){let[G,Z]=c.useState(J.since?"before":""),[F,X]=c.useState({state:"opening"}),[Y,K]=c.useState(null),H=c.useRef(new Set),L=u1(Q,`/-/${_}/branches`,U),z=L.state==="ok"?L.data.branches.filter((O)=>O.name!==Y&&!H.current.has(O.name)):[],W=u1(Q,`/-/${_}/board/changes?frame=${encodeURIComponent(p1(J))}`,U),w=async(O,B,M)=>{let P=J.at;if("site"in P){let v=new URL(J.url),N=B&&/^https?:\/\/\{host\}\./.test(B)?B.replace("{host}",v.hostname.toLowerCase()):null;return N?{url:`${N}${v.pathname}${v.search}`}:{why:"This World shows its branches' sites only on this machine."}}let C=`${Q2}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${J.vendor}${P.screen}`}).toString()}`,f=await fetch(C,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(M())return{why:""};return f?.type==="opaqueredirect"?{url:C}:{why:`This World does not show its branches' pages${f?`: ${await K0(f)}`:""}.`}};c.useEffect(()=>{if(!J.at){X({state:"none",why:`${B1(J.vendor)}'s twin draws no page for this ${J.kind} yet; its changes are listed below.`});return}if(G===""){X({state:"none",why:"Choose a branch of this World to set beside it."});return}let O=!1;if(G!=="before"){X({state:"opening"});let v=L.state==="ok"?L.data.branches.find((k)=>k.name===G):void 0,N=setTimeout(()=>void w(G,v?.sites??null,()=>O).then((k)=>{if(!O)X("url"in k?{state:"ok",url:k.url}:{state:"none",why:k.why})}),300);return()=>{O=!0,clearTimeout(N)}}if(!J.since){X({state:"none",why:"Nothing here has changed since the World was last cut."});return}X({state:"opening"});let B=new Date(Date.parse(J.since)-1).toISOString(),M=null,P=setTimeout(()=>void(async()=>{let v=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:B},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!v?.ok){X({state:"none",why:`The World made no copy of itself as it was then${v?`: ${await K0(v)}`:""}.`});return}let N=await v.json();if(M=N.name,K(N.name),H.current.add(N.name),O){S1(Q,`/-/${_}/branches/${N.name}`,{method:"DELETE"}).catch(()=>null);return}let k=await w(N.name,N.sites??null,()=>O);if(!O)X("url"in k?{state:"ok",url:k.url,at:B}:{state:"none",why:k.why})})(),500),C=()=>{if(M)S1(Q,`/-/${_}/branches/${M}`,{method:"DELETE",keepalive:!0}).catch(()=>null);M=null},f=(v)=>{if(!v.persisted)C()};return window.addEventListener("pagehide",f),()=>{O=!0,clearTimeout(P),window.removeEventListener("pagehide",f),C(),K(null)}},[_,Q,J.vendor,J.id,J.since,G]);let R=zQ(_,J),A=!J.at||G!==""?null:L.state==="ok"&&z.length===0?"This World has no branches to set beside it: make one under Branches.":L.state==="error"?`The World's branches could not be read: ${L.error}`:null;return $.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${J.title}`,children:[$.jsxDEV("div",{className:"compare-head",children:[$.jsxDEV(l1,{vendor:J.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:J.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:J.changes?`${E1(J.changes,"change")} not yet cut${J.since?`, since ${h2(J.since)}`:""}`:"No changes here not yet cut"},void 0,!1,void 0,this),J.at?$.jsxDEV("label",{className:"compare-base",children:["Compare with"," ",$.jsxDEV("select",{value:G,onChange:(O)=>Z(O.target.value),children:[G===""?$.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,J.since||G==="before"?$.jsxDEV("option",{value:"before",children:"Before these changes"},void 0,!1,void 0,this):null,G&&G!=="before"&&!z.some((O)=>O.name===G)?$.jsxDEV("option",{value:G,children:G.split("/")[1]},void 0,!1,void 0,this):null,z.map((O)=>$.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${h2(O.at.instant)})`:O.at?.live?" (live)":""]},O.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("button",{type:"button",className:"ghost",onClick:q,"aria-label":"Close the comparison",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"compare-sides",children:[$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:G==="before"?`Before${F.state==="ok"&&F.at?` · as of ${h2(F.at)}`:""}`:G?G.split("/")[1]:"A branch"},void 0,!1,void 0,this),A?$.jsxDEV("p",{className:"mode compare-note",children:A},void 0,!1,void 0,this):F.state==="ok"?$.jsxDEV(r_,{url:F.url,title:`${J.title} before`},void 0,!1,void 0,this):F.state==="opening"?$.jsxDEV("p",{className:"mode compare-note",role:"status",children:"Opening the World as it was…"},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:F.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:"Now"},void 0,!1,void 0,this),R?$.jsxDEV(r_,{url:R,title:`${J.title} now`},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:[B1(J.vendor),"'s twin draws no page for this ",J.kind," yet."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.state==="error"?$.jsxDEV("p",{role:"alert",className:"mode",children:["Its changes could not be read: ",W.error]},void 0,!0,void 0,this):null,G!=="before"&&G&&W.state==="ok"&&W.data.acts.length?$.jsxDEV("p",{className:"mode compare-acts-head",children:"This World's own changes here, not yet cut:"},void 0,!1,void 0,this):null,$.jsxDEV("ol",{className:"compare-acts",children:(W.state==="ok"?W.data.acts:[]).map((O)=>{let B=O.entries[0],M=I0({...B,service:J.vendor,id:"",occurredAt:O.at});return $.jsxDEV("li",{children:[$.jsxDEV("span",{className:"mode",children:h2(O.at)},void 0,!1,void 0,this),$.jsxDEV("details",{children:[$.jsxDEV("summary",{children:[$.jsxDEV("strong",{children:M.what},void 0,!1,void 0,this),M.label?` · ${M.label}`:"",O.writes>1?$.jsxDEV("span",{className:"mode",children:[" and ",E1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:[O.entries.map((P,C)=>$.jsxDEV("li",{children:[$.jsxDEV("code",{children:P.operation??P.op},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[P.subject.type," ",$2(P)]},void 0,!0,void 0,this)]},C,!0,void 0,this)),O.writes>O.entries.length?$.jsxDEV("li",{className:"mode",children:["and ",E1(O.writes-O.entries.length,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${O.at}:${B.subject.type}:${B.subject.id}`,!0,void 0,this)})},void 0,!1,void 0,this),W.state==="ok"&&W.data.total>W.data.acts.length?$.jsxDEV("p",{className:"mode",children:["and ",E1(W.data.total-W.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,$.jsxDEV("a",{className:"compare-all",href:`${A1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var YF={screen:HF,section:XF};function LF(_){return $.jsxDEV(Q8,{children:$.jsxDEV(zF,{..._},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function zF({name:_,token:Q,session:J,retry:q,snapshot:U,back:G,canWrite:Z}){let F=c.useRef(null),X=c.useRef(0),Y=c.useRef(Promise.resolve()),K=c.useRef(0),[,H]=c.useState(0),[L,z]=c.useState({state:"loading"}),[W,w]=c.useState(null),[R,A]=c.useState(0),O=c.useRef(0),B=c.useRef(0),M=c.useCallback(async()=>{let x=K.current,s=++O.current,G1=await S1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),Z1=G1?.ok?await G1.json().catch(()=>null):null;if(s<B.current)return;if(B.current=s,!Z1?.frames||!Z1.boards||!Z1.version){let f1=G1?`the World answered ${G1.status}`:"the World did not answer";z((L1)=>L1.state==="ok"?L1:{state:"error",status:G1?.status??0,error:f1}),w(f1);return}if(w(null),A((f1)=>f1+1),x===K.current&&X.current===0)F.current={boards:Z1.boards,version:Z1.version};z({state:"ok",data:Z1})},[Q,_]);c.useEffect(()=>{M();let x=setInterval(()=>{if(!document.hidden)M()},1e4);return()=>clearInterval(x)},[M]);let P=L.state==="ok"?L.data.frames:[],C=F.current?.boards??[{id:"everything",name:"Everything"}],[f,v]=c.useState(null),N=P.some((x)=>x.changes),k=f??(N?"changes":"everything"),u=(k==="changes"?C[0]:C.find((x)=>x.id===k))??C[0],[i,l]=c.useState(new Set),S=Z&&!U,b=c.useCallback((x)=>{if(!F.current)return g1("The board is being read again: make that change once it shows","error"),Promise.resolve();F.current={...F.current,boards:x(F.current.boards)},X.current+=1,K.current+=1,H((G1)=>G1+1);let s=Y.current.then(async()=>{let G1=F.current;if(!G1)return;try{let Z1=await S1(Q,`/-/${_}/board`,{method:"PUT",body:JSON.stringify({boards:G1.boards,version:G1.version}),signal:AbortSignal.timeout(15000)}),f1=await Z1.json().catch(()=>null);if(Z1.ok&&f1?.boards&&f1.version)F.current={boards:X.current>1&&F.current?F.current.boards:f1.boards,version:f1.version};else if(Z1.status===409&&f1?.boards&&f1.version)F.current={boards:f1.boards,version:f1.version},g1("Someone else changed the board first: it is shown as they left it","error");else throw Error(f1?.error??`the World answered ${Z1.status}`)}catch(Z1){g1(`The board was not kept: ${Z1 instanceof Error?Z1.message:String(Z1)}`,"error"),F.current=null;let f1=await S1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),L1=f1?.ok?await f1.json().catch(()=>null):null;if(L1?.boards&&L1.version)F.current={boards:L1.boards,version:L1.version}}}).finally(()=>{if(X.current-=1,K.current+=1,H((G1)=>G1+1),X.current===0&&!F.current)M()});return Y.current=s,s},[Q,_,M]),h=(x,s)=>{b((G1)=>G1.map((Z1)=>Z1.id===x?s(Z1):Z1))},E=(x)=>x.parent?`${x.vendor}:${x.parent}`:null,j=new Set(P.map(p1)),m=(x)=>{let s=E(x);return!s||!j.has(s)},I=k==="changes"?P.filter((x)=>x.changes):u.include?i_(u,P):i_(u,P).filter((x)=>m(x)||i.has(E(x))),V=P.filter((x)=>x.changes&&!I.includes(x)).reduce((x,s)=>x+s.changes,0),[D,y]=c.useState(null),[t,_1]=c.useState(null),[a,o]=c.useState(null),p=c5(),e=C.filter((x)=>x.include),$1=(x,s)=>h(x,(G1)=>({...G1,include:[...G1.include??[],s]})),U1={label:u.include?"Take it off this board":"Hide it",act:(x)=>{_1(null),h(u.id,(s)=>s.include?{...s,include:s.include.filter((G1)=>G1!==x)}:{...s,hidden:[...s.hidden??[],x]})}},q1=(x)=>({x:x.position.x,y:x.position.y,w:x.width??x.measured?.width??S0,h:x.height??x.measured?.height??p0}),K1=(x,s)=>{let G1=q1(x),Z1=G1.x+G1.w/2,f1=G1.y+G1.h/2;return s.filter((L1)=>L1.type==="section").map((L1,M1)=>({s:L1,i:M1})).filter(({s:L1})=>{let M1=q1(L1);return Z1>=M1.x&&Z1<=M1.x+M1.w&&f1>=M1.y&&f1<=M1.y+M1.h}).sort((L1,M1)=>q1(L1.s).w*q1(L1.s).h-q1(M1.s).w*q1(M1.s).h||M1.i-L1.i)[0]?.s},W1=c.useCallback(()=>{let x=new Map;for(let P1 of I){let k1=u.placed?.[p1(P1)];if(k1)x.set(p1(P1),k1)}let s=Math.max(-l4,...[...x.values()].map((P1)=>P1.y+p0)),G1=[...new Set(I.map(b2))];for(let P1 of G1){let k1=I.filter((r1)=>b2(r1)===P1),e1=k1.filter((r1)=>x.has(p1(r1))).map((r1)=>x.get(p1(r1))),C1=e1.length?Math.max(...e1.map((r1)=>r1.x))+S0+l4:0,L0=e1.length?Math.min(...e1.map((r1)=>r1.y)):s+l4+O0*2+K8;for(let r1 of k1)if(!x.has(p1(r1)))x.set(p1(r1),{x:C1,y:L0}),C1+=S0+l4;s=Math.max(s,L0+p0)}let Z1=u.sections??{},f1=(P1,k1,e1,C1,L0)=>({id:`sec:${P1}`,type:"section",position:{x:k1.x,y:k1.y},width:k1.w,height:k1.h,zIndex:0,draggable:S,data:{key:P1,name:e1,vendor:C1,named:L0}}),L1=[];for(let P1 of G1){let k1=I.find((h1)=>b2(h1)===P1),e1=m2(k1).find((h1)=>Z1[h1])??P1,C1=Z1[e1];if(C1?.gone)continue;let L0=I.filter((h1)=>b2(h1)===P1).map((h1)=>x.get(p1(h1))),r1={x:Math.min(...L0.map((h1)=>h1.x))-O0,y:Math.min(...L0.map((h1)=>h1.y))-O0-K8,w:0,h:0};r1.w=Math.max(...L0.map((h1)=>h1.x))+S0+O0-r1.x,r1.h=Math.max(...L0.map((h1)=>h1.y))+p0+O0-r1.y;let o4=I.filter((h1)=>b2(h1)===P1&&!u.placed?.[p1(h1)]).map((h1)=>x.get(p1(h1))),V0=C1?{...C1}:r1;if(C1)for(let h1 of o4)V0.w=Math.max(V0.w,h1.x+S0+O0-V0.x),V0.h=Math.max(V0.h,h1.y+p0+O0-V0.y);L1.push(f1(e1,V0,C1?.name??`${B1(k1.vendor)} · ${k1.section.title}`,k1.vendor,Boolean(C1?.name)))}for(let[P1,k1]of Object.entries(Z1))if(P1.startsWith("user:")&&!k1.gone)L1.push(f1(P1,k1,k1.name??"Section",null,!0));let M1=I.map((P1)=>({id:p1(P1),type:"screen",zIndex:1,width:S0,height:p0,draggable:S,position:x.get(p1(P1)),data:{world:_,frame:P1,url:zQ(_,P1)}}));return[...L1,...M1]},[JSON.stringify(I),JSON.stringify(u),_,S]),[Y1,n,R1]=O_([]),H1=N1((x)=>x.transform[2]),x1=c.useRef("");c.useEffect(()=>{let x=W1();if(n(x),x.length&&x1.current!==k)x1.current=k,requestAnimationFrame(()=>{p.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[W1,n]);let a1=(x,s=[],G1={})=>{let Z1=Object.fromEntries(s.map((L1)=>{let M1=p.getNode(`sec:${L1}`);if(!M1)return[L1,void 0];let P1=q1(M1),k1=M1.data,e1=G1[L1]??(k1.named?k1.name:void 0);return[L1,{x:Math.round(P1.x),y:Math.round(P1.y),w:Math.round(P1.w),h:Math.round(P1.h),...e1?{name:e1.slice(0,80)}:{}}]}).filter(([,L1])=>L1!==void 0)),f1=Object.fromEntries(Object.entries(x).map(([L1,M1])=>[L1,{x:Math.round(M1.x),y:Math.round(M1.y)}]));h(u.id,(L1)=>({...L1,placed:{...L1.placed??{},...f1},sections:{...L1.sections??{},...Z1}}))},i1=c.useRef(null),k0=(x,s)=>{if(s.type!=="section"){i1.current=null;return}let G1=p.getNodes(),Z1=q1(s),f1=(L1)=>{let M1=q1(L1);if(L1.type==="screen"){let P1=M1.x+M1.w/2,k1=M1.y+M1.h/2;return P1>=Z1.x&&P1<=Z1.x+Z1.w&&k1>=Z1.y&&k1<=Z1.y+Z1.h}return L1.id!==s.id&&M1.x>=Z1.x&&M1.y>=Z1.y&&M1.x+M1.w<=Z1.x+Z1.w&&M1.y+M1.h<=Z1.y+Z1.h};i1.current={id:s.id,from:{...s.position},members:G1.filter(f1).map((L1)=>({id:L1.id,x:L1.position.x,y:L1.position.y}))}},B0=(x,s)=>{let G1=i1.current;if(!G1||G1.id!==s.id)return;let Z1=s.position.x-G1.from.x,f1=s.position.y-G1.from.y,L1=new Map(G1.members.map((M1)=>[M1.id,M1]));n((M1)=>M1.map((P1)=>{let k1=L1.get(P1.id);return k1?{...P1,position:{x:k1.x+Z1,y:k1.y+f1}}:P1}))},w0=(x,s)=>{let G1=i1.current;i1.current=null;let Z1=s.position.x-(G1?.from.x??s.position.x),f1=s.position.y-(G1?.from.y??s.position.y),L1=s.type==="screen"?[{id:s.id,x:s.position.x,y:s.position.y}]:(G1?.members??[]).map((M1)=>({...M1,x:M1.x+Z1,y:M1.y+f1}));requestAnimationFrame(()=>{let M1=p.getNodes(),P1=new Map(L1.filter((C1)=>!C1.id.startsWith("sec:")).map((C1)=>[C1.id,{x:C1.x,y:C1.y}])),k1=new Set([...s.type==="section"?[s.data.key]:[],...L1.filter((C1)=>C1.id.startsWith("sec:")).map((C1)=>C1.id.slice(4))]),e1=new Set(M1.filter((C1)=>P1.has(C1.id)).flatMap((C1)=>m2(C1.data.frame)));for(let C1 of M1){if(C1.type==="screen"&&m2(C1.data.frame).some((L0)=>e1.has(L0))&&!P1.has(C1.id))P1.set(C1.id,{x:C1.position.x,y:C1.position.y});if(C1.type==="section"&&e1.has(C1.data.key))k1.add(C1.data.key)}a1(Object.fromEntries(P1),[...k1])})},J0=(x)=>Object.fromEntries(p.getNodes().filter((s)=>s.type==="screen"&&m2(s.data.frame).includes(x)).map((s)=>[s.id,{x:s.position.x,y:s.position.y}])),[Z0,n1]=c.useState(null),Y0=(x)=>{_1(`sec:${x}`),n1(x)},U2=(x,s)=>{if(n1(null),!s)return;n((G1)=>G1.map((Z1)=>Z1.id===`sec:${x}`?{...Z1,data:{...Z1.data,name:s,named:!0}}:Z1)),requestAnimationFrame(()=>a1(J0(x),[x],{[x]:s}))},P0=(x)=>{_1(null);let s=p.getNode(`sec:${x}`);h(u.id,(G1)=>{let Z1=Object.fromEntries(Object.entries(G1.sections??{}).filter(([f1])=>f1!==x));return{...G1,sections:x.startsWith("user:")?Z1:{...Z1,[x]:{...s?{x:Math.round(s.position.x),y:Math.round(s.position.y),w:Math.round(q1(s).w),h:Math.round(q1(s).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},c0=()=>{let x=t?p.getNode(t):void 0,s=p.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),G1=x?.type==="screen"?{x:x.position.x-O0,y:x.position.y-O0,w:S0+O0*2,h:p0+O0*2}:{x:s.x-900,y:s.y-600,w:1800,h:1200},Z1=`user:${Date.now().toString(36)}`,f1=Object.keys(u.sections??{}).filter((L1)=>L1.startsWith("user:")).length+1;_1(`sec:${Z1}`),h(u.id,(L1)=>({...L1,sections:{...L1.sections??{},[Z1]:{x:Math.round(G1.x),y:Math.round(G1.y),w:Math.round(G1.w),h:Math.round(G1.h),name:`Section ${f1}`}}}))},G2=Y1.map((x)=>x.type==="section"?{...x,data:{...x.data,picked:t===x.id,editable:S,renaming:S&&Z0===x.data.key,pick:(s)=>_1(`sec:${s}`),rename:Y0,renamed:U2,remove:P0,resized:()=>requestAnimationFrame(()=>{let s=x.data.key;a1(J0(s),[s])})}}:{...x,data:{...x.data,active:D===x.id,picked:t===x.id,boards:S?e:[],addTo:$1,remove:!S||u.include&&!u.include.includes(x.id)?null:U1,compare:(s)=>{_1(s),o(s)}}});c.useEffect(()=>{let x=(s)=>{if(s.target?.closest("input, textarea, select, [contenteditable]"))return;if(s.key==="Escape"){if(D)y(null);else _1(null);return}if(!S||D)return;if((s.key==="Delete"||s.key==="Backspace")&&t){if(s.preventDefault(),t.startsWith("sec:"))P0(t.slice(4));else if(!u.include||u.include.includes(t))U1.act(t);else g1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(s.key==="S"&&s.shiftKey&&!s.metaKey&&!s.ctrlKey)s.preventDefault(),c0()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)});let l0=(x)=>{_1(x);let s=p.getNode(x);if(!s)return;let G1=q1(s);p.fitBounds({x:G1.x,y:G1.y,width:G1.w,height:G1.h},{padding:0.15,duration:400})},c2=()=>{let x=`board-${Date.now().toString(36)}`;v(x),b((s)=>[...s,{id:x,name:`Board ${s.length}`,include:[]}])},y0=()=>n1(`board:${u.id}`),T=()=>{let x=u.id;v(null),b((s)=>s.filter((G1)=>G1.id!==x))},g=[...new Map(P.map((x)=>[b2(x),x])).values()],Q1=u.include?[...g.filter((x)=>!m2(x).some((s)=>u.include.includes(s))).map((x)=>({key:b2(x),label:`${B1(x.vendor)} · ${x.section.title} (all)`})),...P.filter((x)=>!I.includes(x)).map((x)=>({key:p1(x),label:x.title}))]:[],J1=u.include?[]:P.filter((x)=>(u.hidden??[]).includes(p1(x))),X1=Y1.filter((x)=>x.type==="section"),O1=Y1.filter((x)=>x.type==="screen"),T1=new Map(O1.map((x)=>[x.id,K1(x,Y1)?.id??null])),v1=new Map;for(let x of P){let s=E(x);if(s&&j.has(s))v1.set(s,(v1.get(s)??0)+1)}let I1=(x)=>{let s=x.data.frame;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:t===x.id?"on":void 0,onClick:()=>l0(x.id),onDoubleClick:()=>y(x.id),children:[$.jsxDEV(l1,{vendor:s.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:s.title},void 0,!1,void 0,this),s.changes?$.jsxDEV("span",{className:"layer-changed",title:`${E1(s.changes,"change")}, not in a changeset: its mark on the board compares before and now`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),s.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),v1.get(x.id)&&k!=="changes"&&!u.include?$.jsxDEV("button",{type:"button",className:"ghost layer-open","aria-expanded":i.has(x.id),onClick:()=>l((G1)=>{let Z1=new Set(G1);if(Z1.has(x.id))Z1.delete(x.id);else Z1.add(x.id);return Z1}),title:i.has(x.id)?"Close the pages under it":"Open the pages under it",children:[i.has(x.id)?"−":"+",v1.get(x.id)]},void 0,!0,void 0,this):null]},x.id,!0,void 0,this)},A0=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,j0=J.state==="ok"&&L.state==="ok";return $.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",style:{"--zoom":H1},children:$.jsxDEV(R_,{nodes:j0?G2:[],onNodesChange:R1,nodeTypes:YF,onNodeDragStart:k0,onNodeDrag:B0,onNodeDragStop:w0,onNodeClick:(x,s)=>{if(s.id!==D)_1(s.id)},onNodeDoubleClick:(x,s)=>{if(s.type==="screen")_1(s.id),y(s.id)},onPaneClick:()=>{y(null),_1(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:A0?"dark":"light",proOptions:{hideAttribution:!0},children:[$.jsxDEV(w_,{variant:x0.Dots,gap:28,size:1.4},void 0,!1,void 0,this),$.jsxDEV(m0,{position:"top-left",className:"float layers",children:[$.jsxDEV("div",{className:"float-head",children:[$.jsxDEV("button",{type:"button",className:"back",onClick:G,"aria-label":`Back to ${_}`,children:"←"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"float-title",children:[$.jsxDEV("strong",{children:_.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[_.split("/")[0],U?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[$.jsxDEV("button",{type:"button",role:"tab","aria-selected":k==="changes",className:k==="changes"?"on":void 0,onClick:()=>{_1(null),y(null),v("changes")},title:"The pages whose records changed and are not yet in a changeset",children:["Changes",N?` (${P.filter((x)=>x.changes).length})`:""]},void 0,!0,void 0,this),C.map((x)=>Z0===`board:${x.id}`?$.jsxDEV(WQ,{name:x.name,label:"Name this board",done:(s)=>{if(n1(null),s)h(x.id,(G1)=>({...G1,name:s}))}},x.id,!1,void 0,this):$.jsxDEV("button",{type:"button",role:"tab","aria-selected":k!=="changes"&&x.id===u.id,className:k!=="changes"&&x.id===u.id?"on":void 0,onClick:()=>{_1(null),y(null),v(x.id)},onDoubleClick:S&&x.id===u.id&&x.include?y0:void 0,children:x.name},x.id,!1,void 0,this)),S?$.jsxDEV("button",{type:"button",className:"ghost",onClick:c2,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),u.include&&S?$.jsxDEV("div",{className:"board-acts",children:[$.jsxDEV("button",{type:"button",className:"ghost",onClick:y0,children:"Rename"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"ghost",onClick:T,children:"Delete board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("ul",{className:"layer-list","aria-label":"Layers",children:[X1.map((x)=>{let s=x.data;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:t===x.id?"layer-section on":"layer-section",onClick:()=>l0(x.id),onDoubleClick:()=>{if(S)l0(x.id),Y0(s.key)},children:[s.vendor?$.jsxDEV(l1,{vendor:s.vendor},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"layout-grid",size:14},void 0,!1,void 0,this),$.jsxDEV("span",{children:s.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list inner",children:O1.filter((G1)=>T1.get(G1.id)===x.id).map(I1)},void 0,!1,void 0,this)]},x.id,!0,void 0,this)}),O1.filter((x)=>!T1.get(x.id)).map(I1)]},void 0,!0,void 0,this),u.include&&!I.length?$.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,Q1.length&&S?$.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(x)=>{let s=x.target.value;if(s)h(u.id,(G1)=>({...G1,include:[...G1.include??[],s]}))},children:[$.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),Q1.map((x)=>$.jsxDEV("option",{value:x.key,children:x.label},x.key,!1,void 0,this))]},void 0,!0,void 0,this):null,J1.length?$.jsxDEV("details",{className:"board-hidden",children:[$.jsxDEV("summary",{children:["Hidden (",J1.length,")"]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list",children:J1.map((x)=>$.jsxDEV("li",{children:S?$.jsxDEV("button",{type:"button",onClick:()=>h(u.id,(s)=>({...s,hidden:(s.hidden??[]).filter((G1)=>G1!==p1(x))})),children:[$.jsxDEV("span",{children:x.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"pad-s",children:x.title},void 0,!1,void 0,this)},p1(x),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,V?$.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>v("changes"),children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),E1(V,"change")," not on this board"]},void 0,!0,void 0,this):null,$.jsxDEV(U0,{load:L,what:"the board"},void 0,!1,void 0,this),W&&L.state==="ok"?$.jsxDEV("p",{role:"alert",className:"pad-s",children:["The board could not be read again (",W,"): it shows what was last read."]},void 0,!0,void 0,this):null,J.state==="pending"?$.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,J.state==="error"?$.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",J.error," ",$.jsxDEV("button",{type:"button",onClick:q,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),D?$.jsxDEV(m0,{position:"top-center",className:"float hint using",children:[$.jsxDEV("span",{className:"mode",children:["Using ",I.find((x)=>p1(x)===D)?.title??D]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>y(null),children:["Done ",$.jsxDEV("kbd",{children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(m0,{position:"top-center",className:"float hint mode",children:"Scroll to pan · pinch or ⌘ scroll to zoom · double-click a frame to use it"},void 0,!1,void 0,this),S?$.jsxDEV(m0,{position:"bottom-center",className:"float board-tools",children:$.jsxDEV("button",{type:"button",className:"ghost",onClick:c0,title:"Section (⇧S): around the selected frame, else in the middle",children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),$.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,a&&I.some((x)=>p1(x)===a)?$.jsxDEV(m0,{position:"top-right",className:"float compare-panel",children:$.jsxDEV(KF,{name:_,token:Q,frame:I.find((x)=>p1(x)===a),onClose:()=>o(null),reads:R},a,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(N_,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),$.jsxDEV(C_,{pannable:!0,zoomable:!0,nodeBorderRadius:8,position:"bottom-right"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var BQ=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),WF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function t4(_){let Q=_.actions.filter(WF).length,J=_.actions.length-Q,q=_.applied?.receipts??[],U=_.deployed??[],G=new Set([...U.filter((X)=>X.status==="deployed"),...q.filter((X)=>X.status==="confirmed")].map((X)=>X.actionId)).size,Z=new Set([...U.filter((X)=>X.status==="refused"||X.status==="failed"),...q.filter((X)=>X.status==="failed")].map((X)=>X.actionId)).size,F={performed:G,failed:Z,total:J,own:Q};if(J>0&&G>=J)return{label:"Deployed",tone:"done",...F};if(G>0)return{label:`Partly deployed: ${G} of ${J}`,tone:"warn",...F};if(Z>0)return{label:`${Z} refused or failed`,tone:"bad",...F};if(q.some((X)=>X.status==="replayed")&&q.every((X)=>X.status==="replayed"||X.status==="skipped"))return{label:"Pushed",tone:"good",...F};return{label:"Not sent",tone:"plain",...F}}var X8=(_)=>_.message??_.narration?.split(`
|
|
37
|
+
`)[0]?.replace(/ setting .*$/,"")??_.name;function AQ(_,Q=1){let J=_.currentHash??_.contentHash,q=_.readiness?.approvers??new Set(_.approvals.filter((G)=>G.contentHash===J).map((G)=>G.principal)).size,U=_.verification&&_.verification.contentHash===J?_.verification:null;if(U&&!U.passed)return{label:"Checks failed",tone:"bad"};if(q>0&&q<Q)return{label:`Approved by ${q} of ${Q}`,tone:"plain"};if(q>0)return{label:`Approved by ${q}`,tone:"good"};if(U)return{label:"Verified",tone:"good"};return{label:"Not verified",tone:"plain"}}function d_({name:_,token:Q,signsAs:J,c:q,canWrite:U,rooted:G,refused:Z,onChanged:F,part:X,required:Y}){let K=X==="head",H=X==="review",[L,z]=c.useState(null),[W,w]=c.useState(!1),[R,A]=c.useState(""),[O,B]=c.useState(""),[M,P]=c.useState(null),C=u1(Q,`/-/${_}/origin`),f=t4(q),v=AQ(q,Y),N=BQ(q),k=[...new Set(N.map((y)=>y.twin))],u=k.some((y)=>G.includes(y)),i=(y)=>y===(q.currentHash??q.contentHash),l=q.applied?.receipts??[],S=(q.deployed??[]).filter((y)=>y.status!=="landed"),b=l.filter((y)=>y.status==="confirmed").length,h=S.filter((y)=>y.status==="deployed"),E=async(y,t,_1,a)=>{z(y),P(null);try{let o=await S1(Q,t,{method:"POST",..._1===void 0?{}:{body:JSON.stringify(_1)}});if(!o.ok)return Z(o),P({what:y,...d1(await n0(o))}),!1;if(a)g1(a);return F(),!0}catch(o){return P({what:y,text:`the World did not answer (${o instanceof Error?o.message:String(o)})`,acts:[]}),!1}finally{z(null)}},j=()=>{E("Verify",`/-/${_}/changesets/${q.name}/verify`,void 0,"Verified: the checks ran over it")},m=async(y)=>{if(y.preventDefault(),await E("Approve",`/-/${_}/changesets/${q.name}/approve`,{...R.trim()?{note:R.trim()}:{},...J===null&&O.trim()?{as:O.trim()}:{}},"Approved"))w(!1),A("")},I=async()=>{let y=k.filter((t)=>G.includes(t));if(!await g0({title:`Deploy ${q.name} to the real vendors?`,body:$.jsxDEV($.Fragment,{children:["It performs its ",q.actions.length," change",q.actions.length===1?"":"s"," against the real account",y.length===1?"":"s"," behind ",D2(y.map(B1)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:q.name}))return;z("Deploy"),P(null);try{let t=await S1(Q,`/-/${_}/deploy/${q.name}`,{method:"POST",body:JSON.stringify({confirm:q.name})});if(!t.ok){Z(t),P({what:"Deploy",...d1(await n0(t))});return}let _1=await S1(Q,`/-/${_}/changesets/${q.name}`),a=_1.ok?await _1.json():null;if(!a){g1("Deploy: sent; reading its receipts failed","info"),F();return}let o=t4(a);g1(`Deploy: ${o.performed} of ${o.total} change${o.total===1?"":"s"} performed at the vendor${o.failed?`; ${o.failed} refused or failed`:""}`,o.failed?"error":o.performed?"ok":"info"),F()}catch(t){P({what:"Deploy",text:`the World did not answer (${t instanceof Error?t.message:String(t)})`,acts:[]})}finally{z(null)}},V=!U?"This session reads the World; it changes nothing":f.label==="Deployed"?"Already deployed: every change was performed at the vendor":null,D=C.state==="ok"&&C.data.origin?A8(C.data.origin):null;return $.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[K?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"changeset-title",children:[q.message??q.name," ",$.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:`badge cs-${v.tone}`,children:v.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:q.name},void 0,!1,void 0,this)," · made ",$.jsxDEV(V1,{iso:q.createdAt},void 0,!1,void 0,this)," · ",q.actions.length," change",q.actions.length===1?"":"s"," at ",D2(k.map(B1))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[$.jsxDEV("button",{type:"button",onClick:j,disabled:Boolean(V)||L!==null,title:V??"Replay it in a throwaway World and run the World's checks",children:L==="Verify"?"Verifying…":"Verify"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>w(!0),disabled:Boolean(V)||L!==null,title:V??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),u?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void I(),disabled:Boolean(V)||L!==null,title:V??"Perform it against the real accounts behind this World",children:L==="Deploy"?"Deploying…":"Deploy…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),V&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:[V,"."]},void 0,!0,void 0,this):null,M?$.jsxDEV("div",{role:"alert",className:"refusal",children:[$.jsxDEV("span",{children:[$.jsxDEV("b",{children:M.what},void 0,!1,void 0,this),": ",M.text]},void 0,!0,void 0,this),M.acts.includes("verify")&&U?$.jsxDEV("button",{type:"button",onClick:j,disabled:L!==null,children:"Verify"},void 0,!1,void 0,this):null,M.acts.includes("approve")&&U?$.jsxDEV("button",{type:"button",onClick:()=>w(!0),disabled:L!==null,children:"Approve…"},void 0,!1,void 0,this):null,$.jsxDEV(n_,{name:_,acts:M.acts},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null,H?$.jsxDEV($.Fragment,{children:[q.narration?$.jsxDEV("p",{className:"narration",children:q.narration},void 0,!1,void 0,this):null,$.jsxDEV("h4",{children:"Where it went"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"block where",children:[f.performed>0?$.jsxDEV("p",{className:"pad",children:[f.performed>=f.total?"Deployed":"Partly deployed",": ",f.performed," of ",f.total," change",f.total===1?"":"s",f.own?` (and ${f.own} of the World's own, which stay in it)`:""," performed at ",D2([...new Set([...h.map((y)=>y.service),...l.filter((y)=>y.status==="confirmed").map((y)=>y.service)].map(B1))]),h.length?` (${h.length} from here`:" (",h.length&&b?", ":"",b?`${b} by the remote`:"",")."]},void 0,!0,void 0,this):f.label==="Pushed"?$.jsxDEV("p",{className:"pad",children:["Pushed to the remote",D?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:D},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,q.applied?$.jsxDEV($.Fragment,{children:[" · ",$.jsxDEV(V1,{iso:q.applied.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,": every change was replayed there. No vendor has performed any of it."]},void 0,!0,void 0,this):f.failed===0?$.jsxDEV("p",{className:"pad",children:["Not sent: it is only in this World.",q.applied?.outcome==="refused"?" A push was refused (below); Push sends it again.":$.jsxDEV($.Fragment,{children:[" Push sends it to the remote World",u?"; Deploy, to the real vendors behind it":"","."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,f.failed>0?$.jsxDEV("p",{className:"pad failed",role:"alert",children:[f.failed," change",f.failed===1?" was":"s were"," refused or failed at the vendor",[...S.filter((y)=>y.reason&&(y.status==="refused"||y.status==="failed")).map((y)=>y.reason),...l.filter((y)=>y.status==="failed"&&y.error).map((y)=>y.error)].slice(0,3).map((y)=>`: ${d1(y).text}`).join(""),"."]},void 0,!0,void 0,this):null,q.applied?.refusal?.length?$.jsxDEV("ul",{className:"checks pad",children:q.applied.refusal.map((y,t)=>$.jsxDEV("li",{className:"mode",children:d1(y).text},t,!1,void 0,this))},void 0,!1,void 0,this):null,S.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the vendor"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:S.map((y)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:y.status==="refused"||y.status==="failed"?"badge cs-bad":y.status==="deployed"?"badge cs-done":"badge",children:y.status},void 0,!1,void 0,this)," ",B1(y.service)," ",y.status==="deployed"?y.url?$.jsxDEV("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",children:y.externalId??y.url},void 0,!1,void 0,this):y.externalId?$.jsxDEV("code",{children:y.externalId},void 0,!1,void 0,this):null:null,y.reason?$.jsxDEV("span",{className:"mode",children:[" · ",d1(y.reason).text]},void 0,!0,void 0,this):null," ",$.jsxDEV("span",{className:"mode",children:["· ",$.jsxDEV(V1,{iso:y.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},`v:${y.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,l.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the remote"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:l.map((y)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:y.status==="failed"?"badge cs-bad":y.status==="confirmed"?"badge cs-done":"badge",children:y.status},void 0,!1,void 0,this)," ",B1(y.service)," ",$.jsxDEV("span",{className:"mode",children:y.status==="replayed"?"replayed at the remote World":y.status==="confirmed"?"performed at the vendor by the remote":""},void 0,!1,void 0,this),y.status==="confirmed"&&y.externalId?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:y.externalId},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,y.error?$.jsxDEV("span",{className:"mode",children:[" · ",d1(y.error).text]},void 0,!0,void 0,this):null]},`r:${y.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),!u&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:["No vendor it changes is connected to its real service here, so it does not deploy from this World. ",$.jsxDEV("a",{href:`${A1}/${_}/~/settings/services`,onClick:(y)=>{y.preventDefault(),j1([..._.split("/"),"~","settings","services"])},children:"Connect a vendor in Settings › Real services"},void 0,!1,void 0,this)," to deploy."]},void 0,!0,void 0,this):null,$.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!q.verification?$.jsxDEV("p",{className:"mode",children:"Not verified yet. Verify replays it in a throwaway World and runs this World's checks over the result."},void 0,!1,void 0,this):$.jsxDEV("div",{className:i(q.verification.contentHash)?"":"stale",children:[$.jsxDEV("p",{children:[q.verification.passed?"✓ Passed":"✗ Failed"," · ",$.jsxDEV(V1,{iso:q.verification.at},void 0,!1,void 0,this),i(q.verification.contentHash)?null:$.jsxDEV("span",{className:"mode",children:" · on an earlier version of it: verify again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.verification.results.length?$.jsxDEV("ul",{className:"checks",children:q.verification.results.map((y)=>$.jsxDEV("li",{children:[y.passed?"✓":"✗"," ",$.jsxDEV("code",{children:y.id},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:B1(y.service)},void 0,!1,void 0,this)]},y.id,!0,void 0,this))},void 0,!1,void 0,this):null,q.verification.refusals?.length?$.jsxDEV("ul",{className:"checks",children:q.verification.refusals.map((y,t)=>$.jsxDEV("li",{children:["✗ ",$.jsxDEV("code",{children:y.check},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[B1(y.service),": ",y.reason]},void 0,!0,void 0,this)]},t,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),q.approvals.length===0?$.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"approvals",children:q.approvals.map((y,t)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:y.principal},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(V1,{iso:y.at},void 0,!1,void 0,this),i(y.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),y.note?$.jsxDEV("div",{className:"mode",children:["“",y.note,"”"]},void 0,!0,void 0,this):null]},t,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(W0,{open:W,onClose:()=>{if(!L)w(!1)},title:`Approve ${q.name}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>w(!1),disabled:L!==null,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"approve-changeset",className:"primary",disabled:L!==null,children:L==="Approve"?"Approving…":"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"approve-changeset",onSubmit:(y)=>void m(y),className:"stack",children:[$.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",J?$.jsxDEV($.Fragment,{children:[", recorded as ",$.jsxDEV("b",{children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,". A later change to it shows your approval as for an earlier version."]},void 0,!0,void 0,this),J===null?$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"approveAs",value:O,onChange:(y)=>B(y.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"This World was opened with its token, which names no person: the approval records the name you give."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Note ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("textarea",{name:"approveNote",value:R,onChange:(y)=>A(y.target.value),rows:3,maxLength:500},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var MQ=(_,Q)=>JSON.stringify(_)===JSON.stringify(Q);function BF({changes:_,idPrefix:Q}){let J=[...new Set(_.map((q)=>q.twin))];return $.jsxDEV($.Fragment,{children:J.map((q)=>{let U=_.filter((Z)=>Z.twin===q).map((Z)=>Z.entry),G=[...new Set(U.map((Z)=>`${Z.subject.type}:${Z.subject.id}`))];return $.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${Q}-${q}`,children:[$.jsxDEV("h3",{id:`${Q}-${q}`,className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:q},void 0,!1,void 0,this),B1(q)," ",$.jsxDEV("span",{className:"mode",children:["· ",E1(G.length,"record"),", ",E1(U.length,"write")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:G.map((Z)=>{let F=U.filter((H)=>`${H.subject.type}:${H.subject.id}`===Z),X=F[F.length-1],Y=I0(X),K={};return $.jsxDEV("li",{className:"record",children:[$.jsxDEV("p",{className:"record-head",children:[$.jsxDEV("span",{className:"kind",children:X.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")},void 0,!1,void 0,this)," ",Y.label?$.jsxDEV("span",{className:"label",children:["“",Y.label,"”"]},void 0,!0,void 0,this):null," ",$.jsxDEV("code",{children:$2(X)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F.map((H)=>{let L=H.fields??{},z=Object.entries(L).filter(([w,R])=>!(w in K)||!MQ(K[w],R)),W=K;return K={...K,...L},$.jsxDEV("div",{className:"write",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"op",children:I0(H).what},void 0,!1,void 0,this)," · ",$.jsxDEV(V1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",d5(H)]},void 0,!0,void 0,this),z.length===0?$.jsxDEV("p",{className:"mode",children:"It set no field to a new value."},void 0,!1,void 0,this):$.jsxDEV("dl",{className:"fields field-diff","aria-label":`Fields ${I0(H).what} set`,children:z.map(([w,R])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:w},void 0,!1,void 0,this),$.jsxDEV("dd",{children:w in W?$.jsxDEV("span",{className:"changed",children:[$.jsxDEV("del",{children:$.jsxDEV(q2,{v:W[w]},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"arrow","aria-label":"becomes",children:"→"},void 0,!1,void 0,this),$.jsxDEV("ins",{children:$.jsxDEV(q2,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(q2,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},w,!0,void 0,this))},void 0,!1,void 0,this)]},H.id,!0,void 0,this)})]},Z,!0,void 0,this)})},void 0,!1,void 0,this)]},q,!0,void 0,this)})},void 0,!1,void 0,this)}function AF({name:_,token:Q,changes:J,canWrite:q,refused:U,onCut:G,pinned:Z,generated:F,inputRef:X,author:Y}){let[K,H]=c.useState(""),[L,z]=c.useState(!1),[W,w]=c.useState([]),R=(O,B,M)=>{w((P)=>[{ok:O,text:B,at:new Date().toISOString(),n:++t5,...M?.length?{acts:M}:{}},...P].slice(0,4))},A=async(O)=>{O.preventDefault(),z(!0);try{let B=await S1(Q,`/-/${_}/changesets`,{method:"POST",body:JSON.stringify(K.trim()?{message:K.trim()}:{})});if(!B.ok){U(B);let P=d1(await n0(B));R(!1,`Cut a changeset: ${P.text}`,P.acts);return}let M=await B.json();R(!0,`Cut ${M.name??"a changeset"}: ${E1(M.actions?.length??0,"change")}, ready to review in History and push.`),H(""),G()}catch(B){R(!1,`Cut a changeset: the World did not answer (${B instanceof Error?B.message:String(B)})`)}finally{z(!1)}};if(Z){let O=!q?"This session reads the World; it changes nothing":J===0?"Nothing to cut: no change is outside a changeset":null;return $.jsxDEV("div",{className:"ws-cut",children:[$.jsxDEV(B2,{log:W,name:_},void 0,!1,void 0,this),$.jsxDEV("form",{onSubmit:(B)=>void A(B),"aria-label":"Cut a changeset",children:[Y?$.jsxDEV("a",{className:"ws-author",href:Y.account,title:`${Y.who}: your account`,onClick:(B)=>{B.preventDefault(),j1(Y.account.slice(A1.length+1).split("/"))},children:Y.face},void 0,!1,void 0,this):null,$.jsxDEV("input",{ref:X,name:"changesetMessage","aria-label":"Summary",value:K,onChange:(B)=>H(B.target.value),placeholder:J===0?"Nothing to cut":F?"Summary (optional)":"Summary (required)",required:!F,maxLength:200,disabled:Boolean(O),title:O??void 0},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(O)||L,title:O??void 0,children:L?"Cutting…":J===0?"Cut a changeset":$.jsxDEV($.Fragment,{children:["Cut ",E1(J,"change"),Y?$.jsxDEV($.Fragment,{children:[" on ",$.jsxDEV("b",{children:Y.branch},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(!q||J===0)return $.jsxDEV(B2,{log:W,name:_},void 0,!1,void 0,this);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("form",{className:"block cut pad",onSubmit:(O)=>void A(O),"aria-label":"Cut a changeset",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Cut ",J===1?"this change":`these ${J} changes`," into a changeset: what it does and why"]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"changesetMessage",value:K,onChange:(O)=>H(O.target.value),placeholder:"Welcome email for new sign-ups",required:!0,maxLength:200,disabled:J===0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:L||J===0,children:L?"Cutting…":"Cut a changeset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(B2,{log:W,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MF({name:_,token:Q}){let[J,q]=c.useState(0),U=u1(Q,`/-/${_}/keys`,J),[G,Z]=c.useState(!1),[F,X]=c.useState(""),[Y,K]=c.useState("write"),[H,L]=c.useState(!1),[z,W]=c.useState(null),[w,R]=c.useState(null),[A,O]=c.useState(null),B=async()=>{let C=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,f=await S1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:C,scope:"read"})}).catch(()=>null),v=f?await f.json().catch(()=>({})):{error:`${y1} did not answer`};if(!f?.ok||!v.key){g1(v.error?d1(v.error).text:"refused","error");return}O(`${window.location.origin}${A1}/${_}#${new URLSearchParams({token:v.key}).toString()}`),q((N)=>N+1)},M=async(C)=>{C.preventDefault(),L(!0),W(null);let f=await S1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:F.trim(),scope:Y})}).catch(()=>null);L(!1);let v=f?await f.json().catch(()=>({})):{error:`${y1} did not answer`};if(!f?.ok||!v.key){W(v.error?d1(v.error).text:"refused");return}Z(!1),R({key:v.key,name:F.trim()}),X(""),q((N)=>N+1)},P=async(C)=>{if(!await g0({title:`Revoke ${C.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let f=await S1(Q,`/-/${_}/keys/${C.id}`,{method:"DELETE"});if(f.ok)g1(`Revoked ${C.name}`);else g1(await K0(f),"error");q((v)=>v+1)};return $.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[$.jsxDEV("div",{className:"keys-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"What an app, a script or a CI job holds to reach this World: each named for what holds it and revoked alone. People open the World as themselves; keys are for software."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G0()?$.jsxDEV("a",{className:"button primary",href:`${G0()}/${encodeURIComponent(_.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):$.jsxDEV("div",{className:"head-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>void B(),children:"Share a read-only link"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{W(null),Z(!0)},children:"Make a key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(U0,{load:U,what:"the keys",retry:()=>q((C)=>C+1)},void 0,!1,void 0,this),U.state==="ok"?U.data.keys.length===0?$.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"For"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:U.data.keys.map((C)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.person??$.jsxDEV("span",{className:"mode",title:"It acts as itself: a service",children:"no one: a service"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:$.jsxDEV("span",{title:h2(C.createdAt),children:U8(C.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:C.lastUsedAt?U8(C.lastUsedAt):"never"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:$.jsxDEV(D_,{label:`More for ${C.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void P(C)}]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},C.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(W0,{open:G,onClose:()=>{if(!H)Z(!1)},title:"Make a key",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>Z(!1),disabled:H,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"make-key",disabled:H||!F.trim(),children:H?"Making…":"Make key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"make-key",onSubmit:M,"aria-label":"Make a key",children:[$.jsxDEV("label",{children:["Name ",$.jsxDEV("input",{autoFocus:!0,name:"keyName",value:F,onChange:(C)=>X(C.target.value),placeholder:"ci, staging app…",maxLength:80,required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:["Access ",$.jsxDEV("select",{value:Y,onChange:(C)=>K(C.target.value==="read"?"read":"write"),children:[$.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"read",children:"Read only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z?$.jsxDEV("p",{role:"alert",children:z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(W0,{open:Boolean(w),onClose:()=>R(null),title:`${w?.name??"The key"} is ready`,footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>R(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Copy it now: it is shown this once. Put it where the app reads its secrets."},void 0,!1,void 0,this),w?$.jsxDEV(Z8,{label:"Key",value:w.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(W0,{open:Boolean(A),onClose:()=>O(null),title:"A read-only link",footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>O(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Whoever opens it sees this World's pages and changes nothing. Copy it now: it is shown this once. It is listed under Keys, where revoking it closes the link at once."},void 0,!1,void 0,this),A?$.jsxDEV(Z8,{label:"Link",value:A,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var t5=0;function B2({log:_,name:Q}){if(_.length===0)return null;return $.jsxDEV("ul",{className:"narration-log",role:"status","aria-live":"polite",children:_.map((J)=>$.jsxDEV("li",{className:J.ok?"ok":"bad",children:[$.jsxDEV("span",{className:"mode",children:$.jsxDEV(V1,{iso:J.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",J.text,J.acts?$.jsxDEV(n_,{name:Q,acts:J.acts},void 0,!1,void 0,this):null]},J.n,!0,void 0,this))},void 0,!1,void 0,this)}function TQ(_,Q,J,q){let[U,G]=c.useState(0),Z=U*1e5+Math.floor(J/2),F=u1(Q,`/-/${_}/origin`,Z),X=u1(Q,`/-/${_}/diff`,Z),Y=u1(Q,`/-/${_}/changesets`,Z),[K,H]=c.useState([]),[L,z]=c.useState(null),W=(P,C,f)=>{if(H((v)=>[{ok:P,text:C,at:new Date().toISOString(),n:++t5,...f?.length?{acts:f}:{}},...v].slice(0,8)),!P)g1(C,"error")},w=async(P,C,f)=>{z(P);try{let v=await S1(Q,`/-/${_}/${C}`,f);if(!v.ok){q(v);let N=d1(await n0(v));return W(!1,`${P}: ${N.text}`,N.acts),null}return await v.json()}catch(v){return W(!1,`${P}: the World did not answer (${v instanceof Error?v.message:String(v)})`),null}finally{z(null),G((v)=>v+1)}},R=F.state==="ok"&&F.data.origin?A8(F.data.origin):null,A=X.state==="ok"?X.data.changes.length:null,O=Y.state==="ok"&&R?tZ(Y.data.changesets.filter((P)=>!P.pushedBy)).sort((P,C)=>P.createdAt.localeCompare(C.createdAt)):[];return{origin:F,diff:X,sets:Y,there:R,changes:A,waiting:O,log:K,busy:L,say:W,send:w,push:async()=>{let P=await w("Push","origin/push",{method:"POST"});if(!P)return;if(P.pushed.length===0){W(!0,"Nothing to push: every changeset is already at the remote.");return}for(let C of P.pushed){let f=C.receipts??[],v=f.filter((l)=>l.status==="replayed").length,N=f.filter((l)=>l.status==="confirmed").length,k=f.filter((l)=>l.status==="failed").length,u=C.outcome==="applied"&&k===0;if(C.outcome==="refused"){W(!1,`Push of ${C.changeset} was refused${C.refusal?.length?`: ${C.refusal.map((l)=>d1(l).text).join("; ")}`:""}.`);continue}let i=[`${v} of ${E1(f.length,"change")} replayed there`,...N?[`${N} performed at the vendor by the remote`]:[],...k?[`${k} failed`]:[]];W(u,`${C.outcome==="partial"?"Partly pushed":"Pushed"} ${C.changeset} to ${R??"the remote"}: ${i.join("; ")}${C.refusal?.length?` (${C.refusal.map((l)=>d1(l).text).join("; ")})`:""}.`)}},pull:async()=>{let P=await w("Pull","origin/pull",{method:"POST"});if(!P)return;let C=Object.entries(P.appended).filter(([,v])=>v>0),f=P.rebased.flatMap((v)=>v.conflicts.map((N)=>`${B1(v.twin)} ${N.subject.type}:${N.subject.id} ${N.field}`));W(f.length===0,`Pulled from ${R??"the remote"}: ${C.length?C.map(([v,N])=>`${E1(N,"entry")} at ${B1(v)}`).join(", "):"nothing new"}${f.length?`; conflicts at ${f.join(", ")}`:""}.`)}}}function TF({name:_,token:Q,canWrite:J,tick:q,refused:U}){let{origin:G,there:Z,changes:F,log:X,busy:Y,say:K,send:H,push:L,pull:z}=TQ(_,Q,q,U),[W,w]=c.useState(""),[R,A]=c.useState(""),[O,B]=c.useState(!1),M=async(C)=>{C.preventDefault();let f=await H("Name the remote","origin",{method:"PUT",body:JSON.stringify({url:W.trim(),token:R.trim()})});if(f){let v=Object.values(f.appended??{}).reduce((N,k)=>N+k,0);K(!0,`The remote is ${A8(f.origin)}: its history came in (${E1(v,"entry")}).`),A(""),B(!1)}},P=!J?"This session reads the World; it changes nothing":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"block remote",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{children:"Origin"},void 0,!1,void 0,this),J?$.jsxDEV("button",{type:"button",onClick:()=>{w(Z??""),B(!O)},"aria-expanded":O,children:Z?"Change the remote…":"Name a remote…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"pad",children:[G.state==="ok"?Z?$.jsxDEV("p",{children:[$.jsxDEV("code",{className:"big",children:Z},void 0,!1,void 0,this),G.data.origin?.fetchedAt?$.jsxDEV("span",{className:"mode",children:[" · last fetched ",$.jsxDEV(V1,{iso:G.data.origin.fetchedAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("p",{children:"No remote — this World keeps its default data. Name one to push its changesets to a shared World and pull what others pushed there."},void 0,!1,void 0,this):$.jsxDEV(U0,{load:G,what:"the remote",lines:1},void 0,!1,void 0,this),O?$.jsxDEV("form",{className:"stack origin-form",onSubmit:(C)=>void M(C),"aria-label":"Name the remote",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The World's address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originUrl",value:W,onChange:(C)=>w(C.target.value),placeholder:"https://worlds.example.com/acme/team",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"A key or token that opens it"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originToken",type:"password",value:R,onChange:(C)=>A(C.target.value),required:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Naming it brings its history in. Your pushes are recorded there as whoever this key was made for, or as the key itself."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Y!==null,children:Y==="Name the remote"?"Bringing its history in…":"Save the remote"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>B(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(B2,{log:X,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function RF({name:_,token:Q,canWrite:J,refused:q}){let[U,G]=c.useState(0),Z=u1(Q,`/-/${_}/twins`,U),F=u1(Q,`/-/${_}/links`,U),X=u1(Q,`/-/${_}/requests?hours=24`,U),[Y,K]=c.useState({}),[H,L]=c.useState(null),[z,W]=c.useState(""),[w,R]=c.useState(!1),[A,O]=c.useState([]),B=(N,k,u)=>{if(O((i)=>[{ok:N,text:k,at:new Date().toISOString(),n:++t5,...u?.length?{acts:u}:{}},...i].slice(0,6)),!N)g1(k,"error")},M=F.state==="ok"?Object.keys(F.data.links).sort():[];c.useEffect(()=>{let N=!0;return Promise.all(M.map(async(k)=>{let u=await S1(Q,`/-/${_}/twins/${k}/credential`).catch(()=>null),i=u?.ok?await u.json():null;return[k,i?.credential??null]})).then((k)=>{if(N)K(Object.fromEntries(k))}),()=>{N=!1}},[_,Q,M.join(","),U]);let P=async(N)=>{if(N.preventDefault(),!H||!z)return;R(!0);let k=await S1(Q,`/-/${_}/twins/${H.vendor}/credential`,{method:"PUT",body:z,headers:{"content-type":"text/plain"}}).catch(()=>null);if(R(!1),!k){B(!1,`Seal ${H.vendor}: ${y1} did not answer`);return}if(!k.ok){q(k);let i=d1(await n0(k));B(!1,`Seal ${B1(H.vendor)}: ${i.text}`,i.acts);return}let u=await k.json().catch(()=>({}));B(!0,`Sealed a credential for ${B1(H.vendor)}${u.fingerprint?` (${u.fingerprint})`:""}: it opens for ${u.boundTo??H.to} only, and is never shown again.`),W(""),L(null),G((i)=>i+1)},C=async(N)=>{if(!await g0({title:`Remove the link ${N}?`,body:`Requests to ${Q2}/${_}/${N}/… stop being forwarded to ${F.state==="ok"?F.data.links[N]?.origin:"its origin"}.`,action:"Remove link",danger:!0}))return;let k=await S1(Q,`/-/${_}/links/${N}`,{method:"DELETE"}).catch(()=>null);if(!k?.ok){if(k)q(k);B(!1,`Remove ${N}: ${k?await K0(k):"the World did not answer"}`);return}B(!0,`Removed the link ${N}.`),G((u)=>u+1)},f=(N)=>N?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge rooted",children:"sealed"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[N.fingerprint?$.jsxDEV("code",{children:N.fingerprint},void 0,!1,void 0,this):null," · ",$.jsxDEV(V1,{iso:N.placedAt},void 0,!1,void 0,this),N.sealedBy?` · by ${N.sealedBy==="vault"?"the vault":"the host's key"}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this),v=Z.state==="ok"?Z.data.twins:[];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"lede",children:"A real vendor's credential lives in one place, sealed: beside this World, bound to where it goes. It is never readable back; this page says only that one is sealed, when, by what, and for where."},void 0,!1,void 0,this),$.jsxDEV(B2,{log:A,name:_},void 0,!1,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"creds-head",children:[$.jsxDEV("div",{className:"block-head",children:$.jsxDEV("h3",{id:"creds-head",children:"Vendors"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(U0,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"?$.jsxDEV("table",{className:"dense","aria-label":"Credentials by vendor",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Bound to"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:v.map((N)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:N.twin},void 0,!1,void 0,this),B1(N.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f(N.credential)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.credential?.boundTo?$.jsxDEV("code",{children:N.credential.boundTo},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.root?.url?$.jsxDEV("code",{children:N.root.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"none: a stand-in"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?$.jsxDEV("td",{className:"num",children:$.jsxDEV("button",{type:"button",disabled:!N.root?.url,title:N.root?.url?`Seal ${B1(N.twin)}'s real credential for ${N.root.url}`:"Connect it to its real service first (Settings › Real services): a credential is sealed for where it goes",onClick:()=>{W(""),L({vendor:N.twin,to:N.root.url})},children:N.credential?"Replace…":"Seal a credential…"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},N.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z.state==="ok"&&v.every((N)=>!N.root?.url)?$.jsxDEV("p",{className:"mode pad",children:"No vendor here has a real service behind it, so none holds a credential. Connect one in Settings › Real services; its credential is sealed here."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"links-head",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{id:"links-head",children:"Links"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"a vendor with no twin, forwarded with its sealed credential"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(U0,{load:F,what:"the links"},void 0,!1,void 0,this),X.state==="ok"&&(X.data.journalFailures??0)>0?$.jsxDEV("p",{className:"mode pad",role:"alert",children:[X.data.journalFailures," request ",X.data.journalFailures===1?"line was":"lines were"," not kept by this World's server since it started (its links, and the twins it runs in its own process): those requests are missing from what this page counts."]},void 0,!0,void 0,this):null,F.state==="ok"&&M.length===0?$.jsxDEV("p",{className:"mode pad",children:["No links. A link forwards requests for a vendor with no twin here, at ",$.jsxDEV("code",{children:[Q2,"/",_,"/<link>/…"]},void 0,!0,void 0,this),", to that vendor's real API with the credential sealed for it."]},void 0,!0,void 0,this):null,M.length?$.jsxDEV("table",{className:"dense","aria-label":"Links",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Link"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Origin"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:"Requests, 24h"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:M.map((N)=>{let k=F.state==="ok"?F.data.links[N].origin:"",u=X.state==="ok"?X.data.twins.find((i)=>i.twin===N):void 0;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("b",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("code",{children:k},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:u?$.jsxDEV("span",{title:Object.entries(u.byStatus).map(([i,l])=>`${i}: ${l}`).join(" · "),children:u.requests},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:[f(Y[N]??null),Y[N]?.boundTo?$.jsxDEV("div",{className:"mode",children:["bound to ",$.jsxDEV("code",{children:Y[N].boundTo},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{W(""),L({vendor:N,to:k})},children:Y[N]?"Replace…":"Seal a credential…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void C(N),children:"Remove…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(W0,{open:Boolean(H),onClose:()=>{if(!w)L(null)},title:`Seal ${H?B1(H.vendor):""}'s credential`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>L(null),disabled:w,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"seal-credential",className:"primary",disabled:w||!z,children:w?"Sealing…":"Seal it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"seal-credential",className:"stack",onSubmit:(N)=>void P(N),children:[$.jsxDEV("p",{className:"mode",children:["It is sealed for ",$.jsxDEV("code",{children:H?.to},void 0,!1,void 0,this)," and opens there only. It is never shown again, here or anywhere."]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real key"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"credential",type:"password",value:z,onChange:(N)=>W(N.target.value),autoComplete:"off",required:!0,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OF({name:_,token:Q,admin:J,canWrite:q,refused:U,onRemoved:G,only:Z}){let F=(j)=>!Z||Z===j,[X,Y]=c.useState(0),K=u1(Q,`/-/${_}/twins`,X),H=u1(Q,`/-/${_}/checks`,X),[L,z]=c.useState(0),W=u1(Q,`/-/${_}/clock`,L),[w,R]=c.useState([]),[A,O]=c.useState(null),[B,M]=c.useState(null),[P,C]=c.useState(""),[f,v]=c.useState("gated"),[N,k]=c.useState(!1),u=(j,m,I)=>{if(R((V)=>[{ok:j,text:m,at:new Date().toISOString(),n:++t5,...I?.length?{acts:I}:{}},...V].slice(0,6)),!j)g1(m,"error")},i=async(j,m,I)=>{let V=await S1(Q,m,I).catch(()=>null);if(!V)return u(!1,`${j}: the World did not answer`),!1;if(!V.ok){U(V);let D=d1(await n0(V));return u(!1,`${j}: ${D.text}`,D.acts),!1}return u(!0,`${j}: done.`),Y((D)=>D+1),!0},l=async(j)=>{if(j.preventDefault(),!B)return;k(!0);let m=B.root??{},I=await i(P.trim()?`Connect ${B1(B.twin)} to ${P.trim()}`:`Disconnect ${B1(B.twin)}`,`/-/${_}/twins/${B.twin}/root`,{method:"PUT",body:JSON.stringify(P.trim()?{...m,url:P.trim(),deploy:f}:null)});if(k(!1),I)M(null)},S=async()=>{if(!await g0({title:`Rotate the tokens of ${_}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let j=await S1(J,`/-/worlds/${_}/rotate`,{method:"POST"});if(j.ok)O(await j.json()),u(!0,"Rotated: the new tokens are shown once, below.");else u(!1,`Rotate: ${await K0(j)}`)},b=async()=>{if(!await g0({title:`Remove ${_}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:_}))return;let j=await S1(J,`/-/worlds/${_}`,{method:"DELETE"}).catch((m)=>m);if(j instanceof Error){u(!1,`Remove: the host did not answer (${j.message})`);return}if(j.ok)G();else u(!1,`Remove: ${await K0(j)}`)},h=K.state==="ok"?K.data.twins:[],E={gated:"gated: a person deploys an approved changeset",auto:"auto: a push deploys at once",hold:"hold: nothing deploys"};return $.jsxDEV($.Fragment,{children:[$.jsxDEV(B2,{log:w,name:_},void 0,!1,void 0,this),F("access")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Access"},void 0,!1,void 0,this),q?$.jsxDEV(MF,{name:_,token:Q},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"This session reads the World: its keys are managed by whoever holds its token."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("services")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Real services"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:[h.some((j)=>j.root?.url)?null:"Every vendor here is a stand-in. ","Connect a vendor to its real service to read the real state into this World; its real credential is sealed in the Vault, and an approved changeset deploys there by its policy."]},void 0,!0,void 0,this),$.jsxDEV(U0,{load:K,what:"the vendors"},void 0,!1,void 0,this),K.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Real services",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last read from it"},void 0,!1,void 0,this),q?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:h.map((j)=>{let m=j.root;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:j.twin},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/${j.twin}`,title:`Its log and stored state · ${j.position??0} entries`,onClick:(I)=>{I.preventDefault(),j1([..._.split("/"),j.twin])},children:B1(j.twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:m?.url?$.jsxDEV("code",{children:m.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:m?.url?E[m.deploy??""]??m.deploy??"—":"—"},void 0,!1,void 0,this),$.jsxDEV("td",{children:j.refresh?.failed?$.jsxDEV("span",{role:"alert",children:["failed ×",j.refresh.failed.count??1,": ",j.refresh.failed.reason??""]},void 0,!0,void 0,this):m?.url?h2(j.refresh?.observedAt??j.refresh?.at):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{C(m?.url??""),v(m?.deploy==="auto"||m?.deploy==="hold"?m.deploy:"gated"),M(j)},children:m?.url?"Change…":"Connect…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",disabled:!m?.url,title:m?.url?"Read the real service's current state into this World":"Connect it first",onClick:()=>void g0({title:`Read ${B1(j.twin)} now?`,body:`The real ${B1(j.twin)}'s current state is read into this World. Nothing is written to ${B1(j.twin)}.`,action:"Read from it"}).then((I)=>{if(I)i(`Read from ${B1(j.twin)}`,`/-/${_}/twins/${j.twin}/refresh`,{method:"POST"})}),children:"Read from it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},j.twin,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,F("clock")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Clock"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"The instant every vendor here stamps from. Set it and move it forward to see what happens later: renewals, expiries, scheduled sends."},void 0,!1,void 0,this),$.jsxDEV(nZ,{name:_,token:Q,clock:W,canWrite:q,onChanged:()=>z((j)=>j+1),refused:U,open:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("checks")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Checks"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"JavaScript the World runs over every change before it is performed (a changeset's Verify runs them too)."},void 0,!1,void 0,this),$.jsxDEV(U0,{load:H,what:"the checks"},void 0,!1,void 0,this),H.state==="ok"?H.data.checks.length===0?$.jsxDEV("p",{className:"mode",children:"No checks: every change is performed as it comes."},void 0,!1,void 0,this):$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Checks",children:$.jsxDEV("tbody",{children:H.data.checks.map((j)=>$.jsxDEV("tr",{children:$.jsxDEV("td",{children:$.jsxDEV("code",{children:j},void 0,!1,void 0,this)},void 0,!1,void 0,this)},j,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,J&&!Z?$.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[$.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),A?$.jsxDEV("p",{role:"status",children:["token ",$.jsxDEV("code",{children:A.token},void 0,!1,void 0,this)," · read token ",$.jsxDEV("code",{children:A.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void S(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"New tokens for this World; every app, script and browser using the old ones is signed out."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void b(),children:"Remove world"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"Deletes this World and everything in it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(W0,{open:Boolean(B),onClose:()=>{if(!N)M(null)},title:`Connect ${B?B1(B.twin):""} to its real service`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>M(null),disabled:N,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"connect-root",className:"primary",disabled:N,children:N?"Saving…":P.trim()?"Connect":"Disconnect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"connect-root",className:"stack",onSubmit:(j)=>void l(j),children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real service's API address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"rootUrl",value:P,onChange:(j)=>C(j.target.value),placeholder:"https://api.openai.com",autoFocus:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Empty disconnects it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"rootDeploy",value:f,onChange:(j)=>v(j.target.value==="auto"?"auto":j.target.value==="hold"?"hold":"gated"),children:["gated","auto","hold"].map((j)=>$.jsxDEV("option",{value:j,children:E[j]},j,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function JM(){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(hZ,{},void 0,!1,void 0,this),$.jsxDEV(h_,{},void 0,!1,void 0,this),$.jsxDEV(u_,{},void 0,!1,void 0,this),$.jsxDEV(V_,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{QM as openAt,a5 as ROOT,JM as ConsolePage};
|