@volter/world-console 2.0.8 → 2.0.9
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.tsx
CHANGED
|
@@ -429,7 +429,7 @@ type Diff = { base: { id: string; at: string | null }; changes: Array<{ twin: st
|
|
|
429
429
|
type Branch = { name: string; at?: { instant?: string }; createdAt: string; expiresAt: string | null };
|
|
430
430
|
/** The branches door: the host's snapshots of this World, and the World's own named branches (`volter world branch`),
|
|
431
431
|
* one of which, `checkedOut`, is the one this serve holds. */
|
|
432
|
-
type BranchesDoor = { branches: Branch[]; checkedOut?: string; named?: Array<{ name: string; running: boolean }
|
|
432
|
+
type BranchesDoor = { branches: Branch[]; checkedOut?: string; named?: Array<{ name: string; running: boolean }>; canServe?: boolean };
|
|
433
433
|
/** What the World's session answered: its scope; `unknown` when the host has no session door (a write then says). */
|
|
434
434
|
type Scope = 'pending' | 'read' | 'write' | 'unknown';
|
|
435
435
|
|
|
@@ -1019,7 +1019,7 @@ function BranchList({ name, token, canWrite, branches, opens, note, remove, onCh
|
|
|
1019
1019
|
) : null}
|
|
1020
1020
|
{branches.state === 'ok' && (branches.data.named?.length ?? 0) > 0 ? (
|
|
1021
1021
|
<>
|
|
1022
|
-
<p className="lede">This World's own branches (<code>volter world branch</code>). One runs at a time;
|
|
1022
|
+
<p className="lede">This World's own branches (<code>volter world branch</code>). One runs at a time; {branches.data.canServe ? <>“Serve here” stops this one's twins and serves that one in its place.</> : <>this host serves one of them; another is served by <code>volter world checkout <branch></code> where the World lives, then serving again.</>}</p>
|
|
1023
1023
|
{serveError ? <p role="alert">{serveError}</p> : null}
|
|
1024
1024
|
<div className="block">
|
|
1025
1025
|
<table className="dense" aria-label="World branches">
|
|
@@ -1029,7 +1029,7 @@ function BranchList({ name, token, canWrite, branches, opens, note, remove, onCh
|
|
|
1029
1029
|
<tr key={b.name}>
|
|
1030
1030
|
<td><b>{b.name}</b>{b.name === branches.data.checkedOut ? <> <span className="badge">served here</span></> : null}</td>
|
|
1031
1031
|
<td className="mode">{b.running ? 'running' : 'stopped'}</td>
|
|
1032
|
-
<td className="num row-actions">{canWrite && b.name !== branches.data.checkedOut ? <button type="button" disabled={serving !== null} onClick={() => void serveHere(b.name)}>{serving === b.name ? 'Switching…' : 'Serve here'}</button> : null}</td>
|
|
1032
|
+
<td className="num row-actions">{canWrite && branches.data.canServe && b.name !== branches.data.checkedOut ? <button type="button" disabled={serving !== null} onClick={() => void serveHere(b.name)}>{serving === b.name ? 'Switching…' : 'Serve here'}</button> : null}</td>
|
|
1033
1033
|
</tr>
|
|
1034
1034
|
))}
|
|
1035
1035
|
</tbody>
|
|
@@ -245,4 +245,4 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
245
245
|
+`).split(`
|
|
246
246
|
`)),R=T.reduce((L,M)=>L.concat(...M),[]);return[T,R]}return[[],[]]},[Q]);return K1.useEffect(()=>{let O=U?.target??GT,T=U?.actInsideInputWithModifier??!0;if(Q!==null){let R=(I)=>{if(X.current=I.ctrlKey||I.metaKey||I.shiftKey||I.altKey,(!X.current||X.current&&!T)&&BX(I))return!1;let D=FT(I.code,B);if(W.current.add(I[D]),ZT(z,W.current,!1)){let V=I.composedPath?.()?.[0]||I.target,k=V?.nodeName==="BUTTON"||V?.nodeName==="A";if(U.preventDefault!==!1&&(X.current||!k))I.preventDefault();K(!0)}},L=(I)=>{let f=FT(I.code,B);if(ZT(z,W.current,!0))K(!1),W.current.clear();else W.current.delete(I[f]);if(I.key==="Meta")W.current.clear();X.current=!1},M=()=>{W.current.clear(),K(!1)};return O?.addEventListener("keydown",R),O?.addEventListener("keyup",L),window.addEventListener("blur",M),window.addEventListener("contextmenu",M),()=>{O?.removeEventListener("keydown",R),O?.removeEventListener("keyup",L),window.removeEventListener("blur",M),window.removeEventListener("contextmenu",M)}}},[Q,K]),Z}function ZT(Q,U,Z){return Q.filter((K)=>Z||K.length===U.size).some((K)=>K.every((X)=>U.has(X)))}function FT(Q,U){return U.includes(Q)?"code":"key"}var JS=()=>{let Q=C0();return K1.useMemo(()=>{return{zoomIn:async(U)=>{let{panZoom:Z}=Q.getState();return Z?Z.scaleBy(1.2,U):!1},zoomOut:async(U)=>{let{panZoom:Z}=Q.getState();return Z?Z.scaleBy(0.8333333333333334,U):!1},zoomTo:async(U,Z)=>{let{panZoom:K}=Q.getState();return K?K.scaleTo(U,Z):!1},getZoom:()=>Q.getState().transform[2],setViewport:async(U,Z)=>{let{transform:[K,X,W],panZoom:z}=Q.getState();if(!z)return!1;return await z.setViewport({x:U.x??K,y:U.y??X,zoom:U.zoom??W},Z),!0},getViewport:()=>{let[U,Z,K]=Q.getState().transform;return{x:U,y:Z,zoom:K}},setCenter:async(U,Z,K)=>{return Q.getState().setCenter(U,Z,K)},fitBounds:async(U,Z)=>{let{width:K,height:X,minZoom:W,maxZoom:z,panZoom:B}=Q.getState(),O=MJ(U,K,X,W,z,Z?.padding??0.1);if(!B)return!1;return await B.setViewport(O,{duration:Z?.duration,ease:Z?.ease,interpolate:Z?.interpolate}),!0},screenToFlowPosition:(U,Z={})=>{let{transform:K,snapGrid:X,snapToGrid:W,domNode:z}=Q.getState();if(!z)return U;let{x:B,y:O}=z.getBoundingClientRect(),T={x:U.x-B,y:U.y-O},R=Z.snapGrid??X,L=Z.snapToGrid??W;return n7(T,K,L,R)},flowToScreenPosition:(U)=>{let{transform:Z,domNode:K}=Q.getState();if(!K)return U;let{x:X,y:W}=K.getBoundingClientRect(),z=w8(U,Z);return{x:z.x+X,y:z.y+W}}}},[])};function DT(Q,U){let Z=[],K=new Map,X=[];for(let W of Q)if(W.type==="add"){X.push(W);continue}else if(W.type==="remove"||W.type==="replace")K.set(W.id,[W]);else{let z=K.get(W.id);if(z)z.push(W);else K.set(W.id,[W])}for(let W of U){let z=K.get(W.id);if(!z){Z.push(W);continue}if(z[0].type==="remove")continue;if(z[0].type==="replace"){Z.push({...z[0].item});continue}let B={...W};for(let O of z)$S(O,B);Z.push(B)}if(X.length)X.forEach((W)=>{if(W.index!==void 0)Z.splice(W.index,0,{...W.item});else Z.push({...W.item})});return Z}function $S(Q,U){switch(Q.type){case"select":{U.selected=Q.selected;break}case"position":{if(typeof Q.position<"u")U.position=Q.position;if(typeof Q.dragging<"u")U.dragging=Q.dragging;break}case"dimensions":{if(typeof Q.dimensions<"u"){if(U.measured={...Q.dimensions},Q.setAttributes){if(Q.setAttributes===!0||Q.setAttributes==="width")U.width=Q.dimensions.width;if(Q.setAttributes===!0||Q.setAttributes==="height")U.height=Q.dimensions.height}}if(typeof Q.resizing==="boolean")U.resizing=Q.resizing;break}}}function yT(Q,U){return DT(Q,U)}function QS(Q,U){return DT(Q,U)}function P8(Q,U){return{id:Q,type:"select",selected:U}}function _9(Q,U=new Set,Z=!1){let K=[];for(let[X,W]of Q){let z=U.has(X);if(!(W.selected===void 0&&!z)&&W.selected!==z){if(Z)W.selected=z;K.push(P8(W.id,z))}}return K}function KT({items:Q=[],lookup:U}){let Z=[],K=new Map(Q.map((X)=>[X.id,X]));for(let[X,W]of Q.entries()){let z=U.get(W.id),B=z?.internals?.userNode??z;if(B!==void 0&&B!==W)Z.push({id:W.id,item:W,type:"replace"});if(B===void 0)Z.push({item:W,type:"add",index:X})}for(let[X]of U)if(K.get(X)===void 0)Z.push({id:X,type:"remove"});return Z}function XT(Q){return{id:Q.id,type:"remove"}}var qS=KX("React Flow","https://reactflow.dev/");function US(Q,U,Z={}){return fM(Q,U,{...Z,onError:Z.onError??qS})}var HT=(Q)=>WM(Q),GS=(Q)=>QX(Q);function vT(Q){return K1.forwardRef(Q)}var ET=typeof window<"u"?K1.useLayoutEffect:K1.useEffect;function YT(Q){let[U,Z]=K1.useState(BigInt(0)),[K]=K1.useState(()=>ZS(()=>Z((X)=>X+BigInt(1))));return ET(()=>{let X=K.get();if(X.length)Q(X),K.reset()},[U]),K}function ZS(Q){let U=[];return{get:()=>U,reset:()=>{U=[]},push:(Z)=>{U.push(Z),Q()}}}var bT=K1.createContext(null);function FS({children:Q}){let U=C0(),Z=K1.useCallback((B)=>{let{nodes:O=[],setNodes:T,hasDefaultNodes:R,onNodesChange:L,nodeLookup:M,fitViewQueued:I,onNodesChangeMiddlewareMap:f}=U.getState(),D=O;for(let k of B)D=typeof k==="function"?k(D):k;let V=KT({items:D,lookup:M});for(let k of f.values())V=k(V);if(R)T(D);if(V.length>0)L?.(V);else if(I)window.requestAnimationFrame(()=>{let{fitViewQueued:k,nodes:h,setNodes:P}=U.getState();if(k)P(h)})},[]),K=YT(Z),X=K1.useCallback((B)=>{let{edges:O=[],setEdges:T,hasDefaultEdges:R,onEdgesChange:L,edgeLookup:M}=U.getState(),I=O;for(let f of B)I=typeof f==="function"?f(I):f;if(R)T(I);else if(L)L(KT({items:I,lookup:M}))},[]),W=YT(X),z=K1.useMemo(()=>({nodeQueue:K,edgeQueue:W}),[]);return F1.jsx(bT.Provider,{value:z,children:Q})}function KS(){let Q=K1.useContext(bT);if(!Q)throw Error("useBatchContext must be used within a BatchProvider");return Q}var XS=(Q)=>!!Q.panZoom;function OJ(){let Q=JS(),U=C0(),Z=KS(),K=G0(XS),X=K1.useMemo(()=>{let W=(L)=>U.getState().nodeLookup.get(L),z=(L)=>{Z.nodeQueue.push(L)},B=(L)=>{Z.edgeQueue.push(L)},O=(L)=>{let{nodeLookup:M,nodeOrigin:I}=U.getState(),f=HT(L)?L:M.get(L.id),D=f.parentId?HX(f.position,f.measured,f.parentId,M,I):f.position,V={...f,position:D,width:f.measured?.width??f.width,height:f.measured?.height??f.height};return t7(V)},T=(L,M,I={replace:!1})=>{z((f)=>f.map((D)=>{if(D.id===L){let V=typeof M==="function"?M(D):M;return I.replace&&HT(V)?V:{...D,...V}}return D}))},R=(L,M,I={replace:!1})=>{B((f)=>f.map((D)=>{if(D.id===L){let V=typeof M==="function"?M(D):M;return I.replace&&GS(V)?V:{...D,...V}}return D}))};return{getNodes:()=>U.getState().nodes.map((L)=>({...L})),getNode:(L)=>W(L)?.internals.userNode,getInternalNode:W,getEdges:()=>{let{edges:L=[]}=U.getState();return L.map((M)=>({...M}))},getEdge:(L)=>U.getState().edgeLookup.get(L),setNodes:z,setEdges:B,addNodes:(L)=>{let M=Array.isArray(L)?L:[L];Z.nodeQueue.push((I)=>[...I,...M])},addEdges:(L)=>{let M=Array.isArray(L)?L:[L];Z.edgeQueue.push((I)=>[...I,...M])},toObject:()=>{let{nodes:L=[],edges:M=[],transform:I}=U.getState(),[f,D,V]=I;return{nodes:L.map((k)=>({...k})),edges:M.map((k)=>({...k})),viewport:{x:f,y:D,zoom:V}}},deleteElements:async({nodes:L=[],edges:M=[]})=>{let{nodes:I,edges:f,onNodesDelete:D,onEdgesDelete:V,triggerNodeChanges:k,triggerEdgeChanges:h,onDelete:P,onBeforeDelete:C}=U.getState(),{nodes:v,edges:b}=await AM({nodesToRemove:L,edgesToRemove:M,nodes:I,edges:f,onBeforeDelete:C}),E=b.length>0,p=v.length>0;if(E){let a=b.map(XT);V?.(b),h(a)}if(p){let a=v.map(XT);D?.(v),k(a)}if(p||E)P?.({nodes:v,edges:b});return{deletedNodes:v,deletedEdges:b}},getIntersectingNodes:(L,M=!0,I)=>{let f=FX(L),D=f?L:O(L),V=I!==void 0;if(!D)return[];return(I||U.getState().nodes).filter((k)=>{let h=U.getState().nodeLookup.get(k.id);if(h&&!f&&(k.id===L.id||!h.internals.positionAbsolute))return!1;let P=t7(V?k:h),C=LJ(P,D);return M&&C>0||C>=P.width*P.height||C>=D.width*D.height})},isNodeIntersecting:(L,M,I=!0)=>{let D=FX(L)?L:O(L);if(!D)return!1;let V=LJ(D,M);return I&&V>0||V>=M.width*M.height||V>=D.width*D.height},updateNode:T,updateNodeData:(L,M,I={replace:!1})=>{T(L,(f)=>{let D=typeof M==="function"?M(f):M;return I.replace?{...f,data:D}:{...f,data:{...f.data,...D}}},I)},updateEdge:R,updateEdgeData:(L,M,I={replace:!1})=>{R(L,(f)=>{let D=typeof M==="function"?M(f):M;return I.replace?{...f,data:D}:{...f,data:{...f.data,...D}}},I)},getNodesBounds:(L)=>{let{nodeLookup:M,nodeOrigin:I}=U.getState();return UX(L,{nodeLookup:M,nodeOrigin:I})},getHandleConnections:({type:L,id:M,nodeId:I})=>Array.from(U.getState().connectionLookup.get(`${I}-${L}${M?`-${M}`:""}`)?.values()??[]),getNodeConnections:({type:L,handleId:M,nodeId:I})=>Array.from(U.getState().connectionLookup.get(`${I}${L?M?`-${L}-${M}`:`-${L}`:""}`)?.values()??[]),fitView:async(L)=>{let M=U.getState().fitViewResolver??TM();return U.setState({fitViewQueued:!0,fitViewOptions:L,fitViewResolver:M}),Z.nodeQueue.push((I)=>[...I]),M.promise}}},[]);return K1.useMemo(()=>{return{...X,...Q,viewportInitialized:K}},[K])}var WT=(Q)=>Q.selected,HS=typeof window<"u"?window:void 0;function YS({deleteKeyCode:Q,multiSelectionKeyCode:U}){let Z=C0(),{deleteElements:K}=OJ(),X=RJ(Q,{actInsideInputWithModifier:!1}),W=RJ(U,{target:HS});K1.useEffect(()=>{if(X){let{edges:z,nodes:B}=Z.getState();K({nodes:B.filter(WT),edges:z.filter(WT)}),Z.setState({nodesSelectionActive:!1})}},[X]),K1.useEffect(()=>{Z.setState({multiSelectionActive:W})},[W])}function WS(Q){let U=C0();K1.useEffect(()=>{let Z=()=>{if(!Q.current||!(Q.current.checkVisibility?.()??!0))return!1;let K=jq(Q.current);if(K.height===0||K.width===0)U.getState().onError?.("004",x2.error004());U.setState({width:K.width||500,height:K.height||500})};if(Q.current){Z(),window.addEventListener("resize",Z);let K=new ResizeObserver(()=>Z());return K.observe(Q.current),()=>{if(window.removeEventListener("resize",Z),K&&Q.current)K.unobserve(Q.current)}}},[])}var cq={position:"absolute",width:"100%",height:"100%",top:0,left:0},zS=(Q)=>({userSelectionActive:Q.userSelectionActive,lib:Q.lib,connectionInProgress:Q.connection.inProgress});function BS({onPaneContextMenu:Q,zoomOnScroll:U=!0,zoomOnPinch:Z=!0,panOnScroll:K=!1,panActivationKeyPressed:X,panOnScrollSpeed:W=0.5,panOnScrollMode:z=B3.Free,zoomOnDoubleClick:B=!0,panOnDrag:O=!0,defaultViewport:T,translateExtent:R,minZoom:L,maxZoom:M,zoomActivationKeyCode:I,preventScrolling:f=!0,children:D,noWheelClassName:V,noPanClassName:k,onViewportChange:h,isControlledViewport:P,paneClickDistance:C,selectionOnDrag:v}){let b=C0(),E=K1.useRef(null),{userSelectionActive:p,lib:a,connectionInProgress:m}=G0(zS,N0),_1=RJ(I),$1=K1.useRef();WS(E);let J1=K1.useCallback((y)=>{if(h?.({x:y[0],y:y[1],zoom:y[2]}),!P)b.setState({transform:y})},[h,P]);return K1.useEffect(()=>{if(E.current){$1.current=pM({domNode:E.current,minZoom:L,maxZoom:M,translateExtent:R,viewport:T,onDraggingChange:(d)=>b.setState((g)=>g.paneDragging===d?g:{paneDragging:d}),onPanZoomStart:(d,g)=>{let{onViewportChangeStart:n,onMoveStart:j}=b.getState();j?.(d,g),n?.(g)},onPanZoom:(d,g)=>{let{onViewportChange:n,onMove:j}=b.getState();j?.(d,g),n?.(g)},onPanZoomEnd:(d,g)=>{let{onViewportChangeEnd:n,onMoveEnd:j}=b.getState();j?.(d,g),n?.(g)}});let{x:y,y:u,zoom:x}=$1.current.getViewport();return b.setState({panZoom:$1.current,transform:[y,u,x],domNode:E.current.closest(".react-flow")}),()=>{$1.current?.destroy()}}},[]),K1.useEffect(()=>{$1.current?.update({onPaneContextMenu:Q,zoomOnScroll:U,zoomOnPinch:Z,panOnScroll:K,panActivationKeyPressed:X,panOnScrollSpeed:W,panOnScrollMode:z,zoomOnDoubleClick:B,panOnDrag:O,zoomActivationKeyPressed:_1,preventScrolling:f,noPanClassName:k,userSelectionActive:p,noWheelClassName:V,lib:a,onTransformChange:J1,connectionInProgress:m,selectionOnDrag:v,paneClickDistance:C})},[Q,U,Z,K,X,W,z,B,O,_1,f,k,p,V,a,J1,m,v,C]),F1.jsx("div",{className:"react-flow__renderer",ref:E,style:cq,children:D})}var AS=(Q)=>({userSelectionActive:Q.userSelectionActive,userSelectionRect:Q.userSelectionRect});function LS(){let{userSelectionActive:Q,userSelectionRect:U}=G0(AS,N0);if(!(Q&&U))return null;return F1.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:U.width,height:U.height,transform:`translate(${U.x}px, ${U.y}px)`}})}var NX=(Q,U)=>{return(Z)=>{if(Z.target!==U.current)return;Q?.(Z)}},MS=(Q)=>({userSelectionActive:Q.userSelectionActive,elementsSelectable:Q.elementsSelectable,dragging:Q.paneDragging,panBy:Q.panBy,autoPanSpeed:Q.autoPanSpeed});function TS({isSelecting:Q,selectionKeyPressed:U,selectionMode:Z=R8.Full,panOnDrag:K,autoPanOnSelection:X,paneClickDistance:W,selectionOnDrag:z,onSelectionStart:B,onSelectionEnd:O,onPaneClick:T,onPaneContextMenu:R,onPaneScroll:L,onPaneMouseEnter:M,onPaneMouseMove:I,onPaneMouseLeave:f,children:D}){let V=K1.useRef(0),k=C0(),{userSelectionActive:h,elementsSelectable:P,dragging:C,panBy:v,autoPanSpeed:b}=G0(MS,N0),E=P&&(Q||h),p=K1.useRef(null),a=K1.useRef(),m=K1.useRef(new Set),_1=K1.useRef(new Set),$1=K1.useRef(!1),J1=K1.useRef(!1),y=K1.useRef({x:0,y:0}),u=K1.useRef(!1),x=(X1)=>{if(J1.current||$1.current||k.getState().connection.inProgress){J1.current=!1,$1.current=!1;return}T?.(X1),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},d=(X1)=>{if(Array.isArray(K)&&K?.includes(2)){X1.preventDefault();return}R?.(X1)},g=L?(X1)=>L(X1):void 0,n=(X1)=>{if(J1.current)X1.stopPropagation(),J1.current=!1},j=(X1)=>{if(X1.pointerType==="touch"&&K!==!1&&!U)return;let{domNode:f1,transform:l1}=k.getState();if(a.current=f1?.getBoundingClientRect(),!a.current)return;let W1=X1.target===p.current;if(!W1&&!!X1.target.closest(".nokey")||!Q||!(z&&W1||U)||X1.button!==0||!X1.isPrimary)return;X1.target?.setPointerCapture?.(X1.pointerId),J1.current=!1;let{x:c1,y:E1}=D5(X1.nativeEvent,a.current),j1=n7({x:c1,y:E1},l1);if(k.setState({userSelectionRect:{width:0,height:0,startX:j1.x,startY:j1.y,x:c1,y:E1}}),!W1)X1.stopPropagation(),X1.preventDefault()};function i(X1,f1){let{userSelectionRect:l1}=k.getState();if(!l1)return;let{transform:W1,nodeLookup:S1,edgeLookup:v1,connectionLookup:c1,triggerNodeChanges:E1,triggerEdgeChanges:j1,defaultEdgeOptions:V0}=k.getState(),b1={x:l1.startX,y:l1.startY},{x:Z2,y:_0}=w8(b1,W1),h2={startX:b1.x,startY:b1.y,x:X1<Z2?X1:Z2,y:f1<_0?f1:_0,width:Math.abs(X1-Z2),height:Math.abs(f1-_0)},z2=m.current,I2=_1.current;m.current=new Set(Pq(S1,h2,W1,Z===R8.Partial,!0).map((P2)=>P2.id)),_1.current=new Set;let f2=V0?.selectable??!0;for(let P2 of m.current){let B2=c1.get(P2);if(!B2)continue;for(let{edgeId:A2}of B2.values()){let L2=v1.get(A2);if(L2&&(L2.selectable??f2))_1.current.add(A2)}}if(!YX(z2,m.current)){let P2=_9(S1,m.current,!0);E1(P2)}if(!YX(I2,_1.current)){let P2=_9(v1,_1.current);j1(P2)}k.setState({userSelectionRect:h2,userSelectionActive:!0,nodesSelectionActive:!1})}function q1(){if(!X||!a.current)return;let[X1,f1]=Nq(y.current,a.current,b);v({x:X1,y:f1}).then((l1)=>{if(!J1.current||!l1){V.current=requestAnimationFrame(q1);return}let{x:W1,y:S1}=y.current;i(W1,S1),V.current=requestAnimationFrame(q1)})}let Q1=()=>{cancelAnimationFrame(V.current),V.current=0,u.current=!1};K1.useEffect(()=>{return()=>Q1()},[]);let Y1=(X1)=>{let{userSelectionRect:f1,transform:l1,resetSelectedElements:W1}=k.getState();if(!a.current||!f1)return;let{x:S1,y:v1}=D5(X1.nativeEvent,a.current);y.current={x:S1,y:v1};let c1=w8({x:f1.startX,y:f1.startY},l1);if(!J1.current){let E1=U?0:W;if(Math.hypot(S1-c1.x,v1-c1.y)<=E1)return;W1(),B?.(X1)}if(J1.current=!0,!u.current)q1(),u.current=!0;i(S1,v1)},L1=(X1)=>{if(!E){if(X1.target===p.current&&k.getState().connection.inProgress)$1.current=!0;return}if(X1.button!==0)return;if(X1.target?.releasePointerCapture?.(X1.pointerId),!h&&X1.target===p.current&&k.getState().userSelectionRect)x?.(X1);if(k.setState({userSelectionActive:!1,userSelectionRect:null}),J1.current)O?.(X1),k.setState({nodesSelectionActive:m.current.size>0});Q1()},M1=(X1)=>{X1.target?.releasePointerCapture?.(X1.pointerId),Q1()},I1=K===!0||Array.isArray(K)&&K.includes(0);return F1.jsxs("div",{className:y0(["react-flow__pane",{draggable:I1,dragging:C,selection:Q}]),onClick:E?void 0:NX(x,p),onContextMenu:NX(d,p),onWheel:NX(g,p),onPointerEnter:E?void 0:M,onPointerMove:E?Y1:I,onPointerUp:L1,onPointerCancel:E?M1:void 0,onPointerDownCapture:E?j:void 0,onClickCapture:E?n:void 0,onPointerLeave:f,ref:p,style:cq,children:[D,F1.jsx(LS,{})]})}function SX({id:Q,store:U,unselect:Z=!1,nodeRef:K}){let{addSelectedNodes:X,unselectNodesAndEdges:W,multiSelectionActive:z,nodeLookup:B,onError:O}=U.getState(),T=B.get(Q);if(!T){O?.("012",x2.error012(Q));return}if(U.setState({nodesSelectionActive:!1}),!T.selected)X([Q]);else if(Z||T.selected&&z)W({nodes:[T],edges:[]}),requestAnimationFrame(()=>K?.current?.blur())}function uT({nodeRef:Q,disabled:U=!1,noDragClassName:Z,handleSelector:K,nodeId:X,isSelectable:W,nodeClickDistance:z}){let B=C0(),[O,T]=K1.useState(!1),R=K1.useRef();return K1.useEffect(()=>{if(U)return;return R.current=vM({getStoreItems:()=>B.getState(),onNodeMouseDown:(L)=>{SX({id:L,store:B,nodeRef:Q})},onDragStart:()=>{T(!0)},onDragStop:()=>{T(!1)}}),()=>{R.current?.destroy(),R.current=void 0}},[U,B,Q]),K1.useEffect(()=>{if(U||!Q.current||!R.current)return;R.current.update({noDragClassName:Z,handleSelector:K,domNode:Q.current,isSelectable:W,nodeId:X,nodeClickDistance:z})},[Z,K,U,W,Q,X,z]),O}var RS=(Q)=>(U)=>U.selected&&(U.draggable||Q&&typeof U.draggable>"u");function xT(){let Q=C0();return K1.useCallback((Z)=>{let{nodeExtent:K,snapToGrid:X,snapGrid:W,nodesDraggable:z,onError:B,updateNodePositions:O,nodeLookup:T,nodeOrigin:R}=Q.getState(),L=new Map,M=RS(z),I=X?W[0]:5,f=X?W[1]:5,D=Z.direction.x*I*Z.factor,V=Z.direction.y*f*Z.factor;for(let[,k]of T){if(!M(k))continue;let h={x:k.internals.positionAbsolute.x+D,y:k.internals.positionAbsolute.y+V};if(X)h=o7(h,W);let{position:P,positionAbsolute:C}=GX({nodeId:k.id,nextPosition:h,nodeLookup:T,nodeExtent:K,nodeOrigin:R,onError:B});k.position=P,k.internals.positionAbsolute=C,L.set(k.id,k)}O(L)},[])}var jX=K1.createContext(null),OS=jX.Provider;jX.Consumer;var VX=()=>{return K1.useContext(jX)},wS=(Q)=>({connectOnClick:Q.connectOnClick,noPanClassName:Q.noPanClassName,rfId:Q.rfId}),hT=K1.createContext(null);function IS({children:Q}){let U=G0(wS,N0);return F1.jsx(hT.Provider,{value:U,children:Q})}function fS(){let Q=K1.useContext(hT);if(!Q)throw Error("useHandleConfig must be used within a HandleConfigProvider");return Q}var PS={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},NS=(Q,U,Z)=>(K)=>{let{connectionClickStartHandle:X,connectionMode:W,connection:z}=K,{fromHandle:B,toHandle:O,isValid:T}=z;if(!B&&!X)return PS;let R=O?.nodeId===Q&&O?.id===U&&O?.type===Z;return{connectingFrom:B?.nodeId===Q&&B?.id===U&&B?.type===Z,connectingTo:R,clickConnecting:X?.nodeId===Q&&X?.id===U&&X?.type===Z,isPossibleEndHandle:W===A6.Strict?B?.type!==Z:Q!==B?.nodeId||U!==B?.id,connectionInProcess:!!B,clickConnectionInProcess:!!X,valid:R&&T}};function CS({type:Q="source",position:U=C1.Top,isValidConnection:Z,isConnectable:K=!0,isConnectableStart:X=!0,isConnectableEnd:W=!0,id:z,onConnect:B,children:O,className:T,onMouseDown:R,onTouchStart:L,...M},I){let f=z||null,D=Q==="target",V=C0(),k=VX(),{connectOnClick:h,noPanClassName:P,rfId:C}=fS(),{connectingFrom:v,connectingTo:b,clickConnecting:E,isPossibleEndHandle:p,connectionInProcess:a,clickConnectionInProcess:m,valid:_1}=G0(NS(k,f,Q),N0);if(!k)V.getState().onError?.("010",x2.error010());let $1=(u)=>{let{defaultEdgeOptions:x,onConnect:d,hasDefaultEdges:g}=V.getState(),n={...x,...u};if(g){let{edges:j,setEdges:i,onError:q1}=V.getState();i(US(n,j,{onError:q1}))}d?.(n),B?.(n)},J1=(u)=>{if(!k)return;let x=AX(u.nativeEvent);if(X&&(x&&u.button===0||!x)){let d=V.getState();bq.onPointerDown(u.nativeEvent,{handleDomNode:u.currentTarget,autoPanOnConnect:d.autoPanOnConnect,connectionMode:d.connectionMode,connectionRadius:d.connectionRadius,domNode:d.domNode,nodeLookup:d.nodeLookup,lib:d.lib,isTarget:D,handleId:f,nodeId:k,flowId:d.rfId,panBy:d.panBy,cancelConnection:d.cancelConnection,onConnectStart:d.onConnectStart,onConnectEnd:(...g)=>V.getState().onConnectEnd?.(...g),updateConnection:d.updateConnection,onConnect:$1,isValidConnection:Z||((...g)=>V.getState().isValidConnection?.(...g)??!0),getTransform:()=>V.getState().transform,getFromHandle:()=>V.getState().connection.fromHandle,autoPanSpeed:d.autoPanSpeed,dragThreshold:d.connectionDragThreshold})}if(x)R?.(u);else L?.(u)},y=(u)=>{let{onClickConnectStart:x,onClickConnectEnd:d,connectionClickStartHandle:g,connectionMode:n,isValidConnection:j,lib:i,rfId:q1,nodeLookup:Q1,connection:Y1}=V.getState();if(!k||!g&&!X)return;if(!g){x?.(u.nativeEvent,{nodeId:k,handleId:f,handleType:Q}),V.setState({connectionClickStartHandle:{nodeId:k,type:Q,id:f}});return}let L1=zX(u.target),M1=Z||j,{connection:I1,isValid:X1}=bq.isValid(u.nativeEvent,{handle:{nodeId:k,id:f,type:Q},connectionMode:n,fromNodeId:g.nodeId,fromHandleId:g.id||null,fromType:g.type,isValidConnection:M1,flowId:q1,doc:L1,lib:i,nodeLookup:Q1});if(X1&&I1)$1(I1);let f1=structuredClone(Y1);delete f1.inProgress,f1.toPosition=f1.toHandle?f1.toHandle.position:null,d?.(u,f1),V.setState({connectionClickStartHandle:null})};return F1.jsx("div",{"data-handleid":f,"data-nodeid":k,"data-handlepos":U,"data-id":`${C}-${k}-${f}-${Q}`,className:y0(["react-flow__handle",`react-flow__handle-${U}`,"nodrag",P,T,{source:!D,target:D,connectable:K,connectablestart:X,connectableend:W,clickconnecting:E,connectingfrom:v,connectingto:b,valid:_1,connectionindicator:K&&(!a||p)&&(a||m?W:X)}]),onMouseDown:J1,onTouchStart:J1,onClick:h?y:void 0,ref:I,...M,children:O})}var mq=K1.memo(vT(CS));function SS({data:Q,isConnectable:U,sourcePosition:Z=C1.Bottom}){return F1.jsxs(F1.Fragment,{children:[Q?.label,F1.jsx(mq,{type:"source",position:Z,isConnectable:U})]})}function jS({data:Q,isConnectable:U,targetPosition:Z=C1.Top,sourcePosition:K=C1.Bottom}){return F1.jsxs(F1.Fragment,{children:[F1.jsx(mq,{type:"target",position:Z,isConnectable:U}),Q?.label,F1.jsx(mq,{type:"source",position:K,isConnectable:U})]})}function VS(){return null}function kS({data:Q,isConnectable:U,targetPosition:Z=C1.Top}){return F1.jsxs(F1.Fragment,{children:[F1.jsx(mq,{type:"target",position:Z,isConnectable:U}),Q?.label]})}var gq={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},zT={input:SS,default:jS,output:kS,group:VS};function DS(Q){if(Q.internals.handleBounds===void 0)return{width:Q.width??Q.initialWidth??Q.style?.width,height:Q.height??Q.initialHeight??Q.style?.height};return{width:Q.width??Q.style?.width,height:Q.height??Q.style?.height}}var yS=(Q)=>{let{width:U,height:Z,x:K,y:X}=f8(Q.nodeLookup,{filter:(W)=>!!W.selected});return{width:k5(U)?U:null,height:k5(Z)?Z:null,userSelectionActive:Q.userSelectionActive,transformString:`translate(${Q.transform[0]}px,${Q.transform[1]}px) scale(${Q.transform[2]}) translate(${K}px,${X}px)`}};function vS({onSelectionContextMenu:Q,noPanClassName:U,disableKeyboardA11y:Z}){let K=C0(),{width:X,height:W,transformString:z,userSelectionActive:B}=G0(yS,N0),O=xT(),T=K1.useRef(null);K1.useEffect(()=>{if(!Z)T.current?.focus({preventScroll:!0})},[Z]);let R=!B&&X!==null&&W!==null;if(uT({nodeRef:T,disabled:!R}),!R)return null;let L=Q?(I)=>{let f=K.getState().nodes.filter((D)=>D.selected);Q(I,f)}:void 0,M=(I)=>{if(Object.prototype.hasOwnProperty.call(gq,I.key))I.preventDefault(),O({direction:gq[I.key],factor:I.shiftKey?4:1})};return F1.jsx("div",{className:y0(["react-flow__nodesselection","react-flow__container",U]),style:{transform:z},children:F1.jsx("div",{ref:T,className:"react-flow__nodesselection-rect",onContextMenu:L,tabIndex:Z?void 0:-1,onKeyDown:Z?void 0:M,style:{width:X,height:W}})})}var BT=typeof window<"u"?window:void 0,ES=(Q)=>{return{nodesSelectionActive:Q.nodesSelectionActive,userSelectionActive:Q.userSelectionActive}};function mT({children:Q,onPaneClick:U,onPaneMouseEnter:Z,onPaneMouseMove:K,onPaneMouseLeave:X,onPaneContextMenu:W,onPaneScroll:z,paneClickDistance:B,deleteKeyCode:O,selectionKeyCode:T,selectionOnDrag:R,selectionMode:L,onSelectionStart:M,onSelectionEnd:I,multiSelectionKeyCode:f,panActivationKeyCode:D,zoomActivationKeyCode:V,elementsSelectable:k,zoomOnScroll:h,zoomOnPinch:P,panOnScroll:C,panOnScrollSpeed:v,panOnScrollMode:b,zoomOnDoubleClick:E,panOnDrag:p,autoPanOnSelection:a,defaultViewport:m,translateExtent:_1,minZoom:$1,maxZoom:J1,preventScrolling:y,onSelectionContextMenu:u,noWheelClassName:x,noPanClassName:d,disableKeyboardA11y:g,onViewportChange:n,isControlledViewport:j}){let{nodesSelectionActive:i,userSelectionActive:q1}=G0(ES,N0),Q1=RJ(T,{target:BT}),Y1=RJ(D,{target:BT}),L1=Y1||p,M1=Y1||C,I1=R&&L1!==!0,X1=Q1||q1||I1;return YS({deleteKeyCode:O,multiSelectionKeyCode:f}),F1.jsx(BS,{onPaneContextMenu:W,elementsSelectable:k,zoomOnScroll:h,zoomOnPinch:P,panOnScroll:M1,panActivationKeyPressed:Y1,panOnScrollSpeed:v,panOnScrollMode:b,zoomOnDoubleClick:E,panOnDrag:!Q1&&L1,defaultViewport:m,translateExtent:_1,minZoom:$1,maxZoom:J1,zoomActivationKeyCode:V,preventScrolling:y,noWheelClassName:x,noPanClassName:d,onViewportChange:n,isControlledViewport:j,paneClickDistance:B,selectionOnDrag:I1,children:F1.jsxs(TS,{onSelectionStart:M,onSelectionEnd:I,onPaneClick:U,onPaneMouseEnter:Z,onPaneMouseMove:K,onPaneMouseLeave:X,onPaneContextMenu:W,onPaneScroll:z,panOnDrag:L1,autoPanOnSelection:a,isSelecting:!!X1,selectionMode:L,selectionKeyPressed:Q1,paneClickDistance:B,selectionOnDrag:I1,children:[Q,i&&F1.jsx(vS,{onSelectionContextMenu:u,noPanClassName:d,disableKeyboardA11y:g})]})})}mT.displayName="FlowRenderer";var bS=K1.memo(mT),uS=(Q)=>(U)=>{return Q?Pq(U.nodeLookup,{x:0,y:0,width:U.width,height:U.height},U.transform,!0).map((Z)=>Z.id):Array.from(U.nodeLookup.keys())};function xS(Q){return G0(K1.useCallback(uS(Q),[Q]),N0)}var hS=(Q)=>Q.updateNodeInternals;function mS(){let Q=G0(hS),[U]=K1.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver((Z)=>{let K=new Map;Z.forEach((X)=>{let W=X.target.getAttribute("data-id");K.set(W,{id:W,nodeElement:X.target,force:!0})}),Q(K)})});return K1.useEffect(()=>{return()=>{U?.disconnect()}},[U]),U}function gS({node:Q,nodeType:U,hasDimensions:Z,resizeObserver:K}){let X=C0(),W=K1.useRef(null),z=K1.useRef(null),B=K1.useRef(Q.sourcePosition),O=K1.useRef(Q.targetPosition),T=K1.useRef(U),R=Z&&!!Q.internals.handleBounds;return K1.useEffect(()=>{if(W.current&&!Q.hidden&&(!R||z.current!==W.current)){if(z.current)K?.unobserve(z.current);K?.observe(W.current),z.current=W.current}},[R,Q.hidden]),K1.useEffect(()=>{return()=>{if(z.current)K?.unobserve(z.current),z.current=null}},[]),K1.useEffect(()=>{if(W.current){let L=T.current!==U,M=B.current!==Q.sourcePosition,I=O.current!==Q.targetPosition;if(L||M||I)T.current=U,B.current=Q.sourcePosition,O.current=Q.targetPosition,X.getState().updateNodeInternals(new Map([[Q.id,{id:Q.id,nodeElement:W.current,force:!0}]]))}},[Q.id,U,Q.sourcePosition,Q.targetPosition]),W}function pS({id:Q,onClick:U,onMouseEnter:Z,onMouseMove:K,onMouseLeave:X,onContextMenu:W,onDoubleClick:z,nodesDraggable:B,elementsSelectable:O,nodesConnectable:T,nodesFocusable:R,resizeObserver:L,noDragClassName:M,noPanClassName:I,disableKeyboardA11y:f,rfId:D,nodeTypes:V,nodeClickDistance:k,onError:h}){let{node:P,internals:C,isParent:v}=G0((X1)=>{let f1=X1.nodeLookup.get(Q),l1=X1.parentLookup.has(Q);return{node:f1,internals:f1.internals,isParent:l1}},N0),b=P.type||"default",E=V?.[b]||zT[b];if(E===void 0)h?.("003",x2.error003(b)),b="default",E=V?.default||zT.default;let p=!!(P.draggable||B&&typeof P.draggable>"u"),a=!!(P.selectable||O&&typeof P.selectable>"u"),m=!!(P.connectable||T&&typeof P.connectable>"u"),_1=!!(P.focusable||R&&typeof P.focusable>"u"),$1=C0(),J1=XX(P),y=gS({node:P,nodeType:b,hasDimensions:J1,resizeObserver:L}),u=uT({nodeRef:y,disabled:P.hidden||!p,noDragClassName:M,handleSelector:P.dragHandle,nodeId:Q,isSelectable:a,nodeClickDistance:k}),x=xT();if(P.hidden)return null;let d=y5(P),g=DS(P),n=a||p||U||Z||K||X,j=Z?(X1)=>Z(X1,{...C.userNode}):void 0,i=K?(X1)=>K(X1,{...C.userNode}):void 0,q1=X?(X1)=>X(X1,{...C.userNode}):void 0,Q1=W?(X1)=>W(X1,{...C.userNode}):void 0,Y1=z?(X1)=>z(X1,{...C.userNode}):void 0,L1=(X1)=>{let{selectNodesOnDrag:f1,nodeDragThreshold:l1}=$1.getState();if(a&&(!f1||!p||l1>0))SX({id:Q,store:$1,nodeRef:y});if(U)U(X1,{...C.userNode})},M1=(X1)=>{if(BX(X1.nativeEvent)||f)return;if(_X.includes(X1.key)&&a){let f1=X1.key==="Escape";SX({id:Q,store:$1,unselect:f1,nodeRef:y})}else if(p&&P.selected&&Object.prototype.hasOwnProperty.call(gq,X1.key)){X1.preventDefault();let{ariaLabelConfig:f1}=$1.getState();$1.setState({ariaLiveMessage:f1["node.a11yDescription.ariaLiveMessage"]({direction:X1.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),x({direction:gq[X1.key],factor:X1.shiftKey?4:1})}},I1=()=>{if(f||!y.current?.matches(":focus-visible"))return;let{transform:X1,width:f1,height:l1,autoPanOnNodeFocus:W1,setCenter:S1}=$1.getState();if(!W1)return;if(!(Pq(new Map([[Q,P]]),{x:0,y:0,width:f1,height:l1},X1,!0).length>0))S1(P.position.x+d.width/2,P.position.y+d.height/2,{zoom:X1[2]})};return F1.jsx("div",{className:y0(["react-flow__node",`react-flow__node-${b}`,{[I]:p},P.className,{selected:P.selected,selectable:a,parent:v,draggable:p,dragging:u}]),ref:y,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:n?"all":"none",visibility:J1?"visible":"hidden",...P.style,...g},"data-id":Q,"data-testid":`rf__node-${Q}`,onMouseEnter:j,onMouseMove:i,onMouseLeave:q1,onContextMenu:Q1,onClick:L1,onDoubleClick:Y1,onKeyDown:_1?M1:void 0,tabIndex:_1?0:void 0,onFocus:_1?I1:void 0,role:P.ariaRole??(_1?"group":void 0),"aria-roledescription":"node","aria-describedby":f?void 0:`${jT}-${D}`,"aria-label":P.ariaLabel,...P.domAttributes,children:F1.jsx(OS,{value:Q,children:F1.jsx(E,{id:Q,data:P.data,type:b,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:P.selected??!1,selectable:a,draggable:p,deletable:P.deletable??!0,isConnectable:m,sourcePosition:P.sourcePosition,targetPosition:P.targetPosition,dragging:u,dragHandle:P.dragHandle,zIndex:C.z,parentId:P.parentId,...d})})})}var cS=K1.memo(pS),lS=(Q)=>({nodesConnectable:Q.nodesConnectable,nodesFocusable:Q.nodesFocusable,elementsSelectable:Q.elementsSelectable,onError:Q.onError});function gT(Q){let{nodesConnectable:U,nodesFocusable:Z,elementsSelectable:K,onError:X}=G0(lS,N0),W=xS(Q.onlyRenderVisibleElements),z=mS();return F1.jsx("div",{className:"react-flow__nodes",style:cq,children:W.map((B)=>{return F1.jsx(cS,{id:B,nodeTypes:Q.nodeTypes,nodeExtent:Q.nodeExtent,onClick:Q.onNodeClick,onMouseEnter:Q.onNodeMouseEnter,onMouseMove:Q.onNodeMouseMove,onMouseLeave:Q.onNodeMouseLeave,onContextMenu:Q.onNodeContextMenu,onDoubleClick:Q.onNodeDoubleClick,noDragClassName:Q.noDragClassName,noPanClassName:Q.noPanClassName,rfId:Q.rfId,disableKeyboardA11y:Q.disableKeyboardA11y,resizeObserver:z,nodesDraggable:Q.nodesDraggable??!0,nodesConnectable:U,nodesFocusable:Z,elementsSelectable:K,nodeClickDistance:Q.nodeClickDistance,onError:X},B)})})}gT.displayName="NodeRenderer";var rS=K1.memo(gT);function dS(Q){return G0(K1.useCallback((Z)=>{if(!Q)return Z.edges.map((X)=>X.id);let K=[];if(Z.width&&Z.height)for(let X of Z.edges){let W=Z.nodeLookup.get(X.source),z=Z.nodeLookup.get(X.target);if(W&&z&&IM({sourceNode:W,targetNode:z,width:Z.width,height:Z.height,transform:Z.transform}))K.push(X.id)}return K},[Q]),N0)}var iS=({color:Q="none",strokeWidth:U=1})=>{let Z={strokeWidth:U,...Q&&{stroke:Q}};return F1.jsx("polyline",{className:"arrow",style:Z,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},aS=({color:Q="none",strokeWidth:U=1})=>{let Z={strokeWidth:U,...Q&&{stroke:Q,fill:Q}};return F1.jsx("polyline",{className:"arrowclosed",style:Z,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},AT={[i7.Arrow]:iS,[i7.ArrowClosed]:aS};function sS(Q){let U=C0();return K1.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(AT,Q))return U.getState().onError?.("009",x2.error009(Q)),null;return AT[Q]},[Q])}var tS=({id:Q,type:U,color:Z,width:K=12.5,height:X=12.5,markerUnits:W="strokeWidth",strokeWidth:z,orient:B="auto-start-reverse"})=>{let O=sS(U);if(!O)return null;return F1.jsx("marker",{className:"react-flow__arrowhead",id:Q,markerWidth:`${K}`,markerHeight:`${X}`,viewBox:"-10 -10 20 20",markerUnits:W,orient:B,refX:"0",refY:"0",children:F1.jsx(O,{color:Z,strokeWidth:z})})},pT=({defaultColor:Q,rfId:U})=>{let Z=G0((W)=>W.edges),K=G0((W)=>W.defaultEdgeOptions),X=K1.useMemo(()=>{return NM(Z,{id:U,defaultColor:Q,defaultMarkerStart:K?.markerStart,defaultMarkerEnd:K?.markerEnd})},[Z,K,U,Q]);if(!X.length)return null;return F1.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:F1.jsx("defs",{children:X.map((W)=>F1.jsx(tS,{id:W.id,type:W.type,color:W.color,width:W.width,height:W.height,markerUnits:W.markerUnits,strokeWidth:W.strokeWidth,orient:W.orient},W.id))})})};pT.displayName="MarkerDefinitions";var oS=K1.memo(pT);function cT({x:Q,y:U,label:Z,labelStyle:K,labelShowBg:X=!0,labelBgStyle:W,labelBgPadding:z=[2,4],labelBgBorderRadius:B=2,children:O,className:T,...R}){let[L,M]=K1.useState({x:1,y:0,width:0,height:0}),I=y0(["react-flow__edge-textwrapper",T]),f=K1.useRef(null);if(K1.useEffect(()=>{if(f.current){let D=f.current.getBBox();M({x:D.x,y:D.y,width:D.width,height:D.height})}},[Z]),!Z)return null;return F1.jsxs("g",{transform:`translate(${Q-L.width/2} ${U-L.height/2})`,className:I,visibility:L.width?"visible":"hidden",...R,children:[X&&F1.jsx("rect",{width:L.width+2*z[0],x:-z[0],y:-z[1],height:L.height+2*z[1],className:"react-flow__edge-textbg",style:W,rx:B,ry:B}),F1.jsx("text",{className:"react-flow__edge-text",y:L.height/2,dy:"0.3em",ref:f,style:K,children:Z}),O]})}cT.displayName="EdgeText";var nS=K1.memo(cT);function lq({path:Q,labelX:U,labelY:Z,label:K,labelStyle:X,labelShowBg:W,labelBgStyle:z,labelBgPadding:B,labelBgBorderRadius:O,interactionWidth:T=20,...R}){return F1.jsxs(F1.Fragment,{children:[F1.jsx("path",{...R,d:Q,fill:"none",className:y0(["react-flow__edge-path",R.className])}),T?F1.jsx("path",{d:Q,fill:"none",strokeOpacity:0,strokeWidth:T,className:"react-flow__edge-interaction"}):null,K&&k5(U)&&k5(Z)?F1.jsx(nS,{x:U,y:Z,label:K,labelStyle:X,labelShowBg:W,labelBgStyle:z,labelBgPadding:B,labelBgBorderRadius:O}):null]})}function LT({pos:Q,x1:U,y1:Z,x2:K,y2:X}){if(Q===C1.Left||Q===C1.Right)return[0.5*(U+K),Z];return[U,0.5*(Z+X)]}function lT({sourceX:Q,sourceY:U,sourcePosition:Z=C1.Bottom,targetX:K,targetY:X,targetPosition:W=C1.Top}){let[z,B]=LT({pos:Z,x1:Q,y1:U,x2:K,y2:X}),[O,T]=LT({pos:W,x1:K,y1:X,x2:Q,y2:U}),[R,L,M,I]=Vq({sourceX:Q,sourceY:U,targetX:K,targetY:X,sourceControlX:z,sourceControlY:B,targetControlX:O,targetControlY:T});return[`M${Q},${U} C${z},${B} ${O},${T} ${K},${X}`,R,L,M,I]}function rT(Q){return K1.memo(({id:U,sourceX:Z,sourceY:K,targetX:X,targetY:W,sourcePosition:z,targetPosition:B,label:O,labelStyle:T,labelShowBg:R,labelBgStyle:L,labelBgPadding:M,labelBgBorderRadius:I,style:f,markerEnd:D,markerStart:V,interactionWidth:k})=>{let[h,P,C]=lT({sourceX:Z,sourceY:K,sourcePosition:z,targetX:X,targetY:W,targetPosition:B}),v=Q.isInternal?void 0:U;return F1.jsx(lq,{id:v,path:h,labelX:P,labelY:C,label:O,labelStyle:T,labelShowBg:R,labelBgStyle:L,labelBgPadding:M,labelBgBorderRadius:I,style:f,markerEnd:D,markerStart:V,interactionWidth:k})})}var eS=rT({isInternal:!1}),dT=rT({isInternal:!0});eS.displayName="SimpleBezierEdge";dT.displayName="SimpleBezierEdgeInternal";function iT(Q){return K1.memo(({id:U,sourceX:Z,sourceY:K,targetX:X,targetY:W,label:z,labelStyle:B,labelShowBg:O,labelBgStyle:T,labelBgPadding:R,labelBgBorderRadius:L,style:M,sourcePosition:I=C1.Bottom,targetPosition:f=C1.Top,markerEnd:D,markerStart:V,pathOptions:k,interactionWidth:h})=>{let[P,C,v]=TJ({sourceX:Z,sourceY:K,sourcePosition:I,targetX:X,targetY:W,targetPosition:f,borderRadius:k?.borderRadius,offset:k?.offset,stepPosition:k?.stepPosition}),b=Q.isInternal?void 0:U;return F1.jsx(lq,{id:b,path:P,labelX:C,labelY:v,label:z,labelStyle:B,labelShowBg:O,labelBgStyle:T,labelBgPadding:R,labelBgBorderRadius:L,style:M,markerEnd:D,markerStart:V,interactionWidth:h})})}var aT=iT({isInternal:!1}),sT=iT({isInternal:!0});aT.displayName="SmoothStepEdge";sT.displayName="SmoothStepEdgeInternal";function tT(Q){return K1.memo(({id:U,...Z})=>{let K=Q.isInternal?void 0:U;return F1.jsx(aT,{...Z,id:K,pathOptions:K1.useMemo(()=>({borderRadius:0,offset:Z.pathOptions?.offset}),[Z.pathOptions?.offset])})})}var _j=tT({isInternal:!1}),oT=tT({isInternal:!0});_j.displayName="StepEdge";oT.displayName="StepEdgeInternal";function nT(Q){return K1.memo(({id:U,sourceX:Z,sourceY:K,targetX:X,targetY:W,label:z,labelStyle:B,labelShowBg:O,labelBgStyle:T,labelBgPadding:R,labelBgBorderRadius:L,style:M,markerEnd:I,markerStart:f,interactionWidth:D})=>{let[V,k,h]=Dq({sourceX:Z,sourceY:K,targetX:X,targetY:W}),P=Q.isInternal?void 0:U;return F1.jsx(lq,{id:P,path:V,labelX:k,labelY:h,label:z,labelStyle:B,labelShowBg:O,labelBgStyle:T,labelBgPadding:R,labelBgBorderRadius:L,style:M,markerEnd:I,markerStart:f,interactionWidth:D})})}var Jj=nT({isInternal:!1}),eT=nT({isInternal:!0});Jj.displayName="StraightEdge";eT.displayName="StraightEdgeInternal";function _R(Q){return K1.memo(({id:U,sourceX:Z,sourceY:K,targetX:X,targetY:W,sourcePosition:z=C1.Bottom,targetPosition:B=C1.Top,label:O,labelStyle:T,labelShowBg:R,labelBgStyle:L,labelBgPadding:M,labelBgBorderRadius:I,style:f,markerEnd:D,markerStart:V,pathOptions:k,interactionWidth:h})=>{let[P,C,v]=kq({sourceX:Z,sourceY:K,sourcePosition:z,targetX:X,targetY:W,targetPosition:B,curvature:k?.curvature}),b=Q.isInternal?void 0:U;return F1.jsx(lq,{id:b,path:P,labelX:C,labelY:v,label:O,labelStyle:T,labelShowBg:R,labelBgStyle:L,labelBgPadding:M,labelBgBorderRadius:I,style:f,markerEnd:D,markerStart:V,interactionWidth:h})})}var $j=_R({isInternal:!1}),JR=_R({isInternal:!0});$j.displayName="BezierEdge";JR.displayName="BezierEdgeInternal";var MT={default:JR,straight:eT,step:oT,smoothstep:sT,simplebezier:dT},TT={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Qj=(Q,U,Z)=>{if(Z===C1.Left)return Q-U;if(Z===C1.Right)return Q+U;return Q},qj=(Q,U,Z)=>{if(Z===C1.Top)return Q-U;if(Z===C1.Bottom)return Q+U;return Q},RT="react-flow__edgeupdater";function OT({position:Q,centerX:U,centerY:Z,radius:K=10,onMouseDown:X,onMouseEnter:W,onMouseOut:z,type:B}){return F1.jsx("circle",{onMouseDown:X,onMouseEnter:W,onMouseOut:z,className:y0([RT,`${RT}-${B}`]),cx:Qj(U,K,Q),cy:qj(Z,K,Q),r:K,stroke:"transparent",fill:"transparent"})}function Uj({isReconnectable:Q,reconnectRadius:U,edge:Z,sourceX:K,sourceY:X,targetX:W,targetY:z,sourcePosition:B,targetPosition:O,onReconnect:T,onReconnectStart:R,onReconnectEnd:L,setReconnecting:M,setUpdateHover:I}){let f=C0(),D=(C,v)=>{if(C.button!==0)return;let{autoPanOnConnect:b,domNode:E,connectionMode:p,connectionRadius:a,lib:m,onConnectStart:_1,cancelConnection:$1,nodeLookup:J1,rfId:y,panBy:u,updateConnection:x}=f.getState(),d=v.type==="target",g=(i,q1)=>{M(!1),L?.(i,Z,v.type,q1)},n=(i)=>T?.(Z,i),j=(i,q1)=>{M(!0),R?.(C,Z,v.type),_1?.(i,q1)};bq.onPointerDown(C.nativeEvent,{autoPanOnConnect:b,connectionMode:p,connectionRadius:a,domNode:E,handleId:v.id,nodeId:v.nodeId,nodeLookup:J1,isTarget:d,edgeUpdaterType:v.type,lib:m,flowId:y,cancelConnection:$1,panBy:u,isValidConnection:(...i)=>f.getState().isValidConnection?.(...i)??!0,onConnect:n,onConnectStart:j,onConnectEnd:(...i)=>f.getState().onConnectEnd?.(...i),onReconnectEnd:g,updateConnection:x,getTransform:()=>f.getState().transform,getFromHandle:()=>f.getState().connection.fromHandle,dragThreshold:f.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},V=(C)=>D(C,{nodeId:Z.target,id:Z.targetHandle??null,type:"target"}),k=(C)=>D(C,{nodeId:Z.source,id:Z.sourceHandle??null,type:"source"}),h=()=>I(!0),P=()=>I(!1);return F1.jsxs(F1.Fragment,{children:[(Q===!0||Q==="source")&&F1.jsx(OT,{position:B,centerX:K,centerY:X,radius:U,onMouseDown:V,onMouseEnter:h,onMouseOut:P,type:"source"}),(Q===!0||Q==="target")&&F1.jsx(OT,{position:O,centerX:W,centerY:z,radius:U,onMouseDown:k,onMouseEnter:h,onMouseOut:P,type:"target"})]})}function Gj({id:Q,edgesFocusable:U,edgesReconnectable:Z,elementsSelectable:K,onClick:X,onDoubleClick:W,onContextMenu:z,onMouseEnter:B,onMouseMove:O,onMouseLeave:T,reconnectRadius:R,onReconnect:L,onReconnectStart:M,onReconnectEnd:I,rfId:f,edgeTypes:D,noPanClassName:V,onError:k,disableKeyboardA11y:h}){let P=G0((S1)=>S1.edgeLookup.get(Q)),C=G0((S1)=>S1.defaultEdgeOptions);P=C?{...C,...P}:P;let v=P.type||"default",b=D?.[v]||MT[v];if(b===void 0)k?.("011",x2.error011(v)),v="default",b=D?.default||MT.default;let E=!!(P.focusable||U&&typeof P.focusable>"u"),p=typeof L<"u"&&(P.reconnectable||Z&&typeof P.reconnectable>"u"),a=!!(P.selectable||K&&typeof P.selectable>"u"),m=K1.useRef(null),[_1,$1]=K1.useState(!1),[J1,y]=K1.useState(!1),u=C0(),{zIndex:x=P.zIndex,sourceX:d,sourceY:g,targetX:n,targetY:j,sourcePosition:i,targetPosition:q1}=G0(K1.useCallback((S1)=>{let v1=S1.nodeLookup.get(P.source),c1=S1.nodeLookup.get(P.target);if(!v1||!c1)return TT;let E1=PM({id:Q,sourceNode:v1,targetNode:c1,sourceHandle:P.sourceHandle||null,targetHandle:P.targetHandle||null,connectionMode:S1.connectionMode,onError:k}),j1=wM({selected:P.selected,zIndex:P.zIndex,sourceNode:v1,targetNode:c1,elevateOnSelect:S1.elevateEdgesOnSelect,zIndexMode:S1.zIndexMode});return{...E1||TT,zIndex:j1}},[P.source,P.target,P.sourceHandle,P.targetHandle,P.selected,P.zIndex,k]),N0),Q1=K1.useMemo(()=>P.markerStart?`url('#${yq(P.markerStart,f)}')`:void 0,[P.markerStart,f]),Y1=K1.useMemo(()=>P.markerEnd?`url('#${yq(P.markerEnd,f)}')`:void 0,[P.markerEnd,f]);if(P.hidden||d===null||g===null||n===null||j===null)return null;let L1=(S1)=>{let{addSelectedEdges:v1,unselectNodesAndEdges:c1,multiSelectionActive:E1}=u.getState();if(a)if(u.setState({nodesSelectionActive:!1}),P.selected&&E1)c1({nodes:[],edges:[P]}),m.current?.blur();else v1([Q]);if(X)X(S1,P)},M1=W?(S1)=>{W(S1,{...P})}:void 0,I1=z?(S1)=>{z(S1,{...P})}:void 0,X1=B?(S1)=>{B(S1,{...P})}:void 0,f1=O?(S1)=>{O(S1,{...P})}:void 0,l1=T?(S1)=>{T(S1,{...P})}:void 0,W1=(S1)=>{if(!h&&_X.includes(S1.key)&&a){let{unselectNodesAndEdges:v1,addSelectedEdges:c1}=u.getState();if(S1.key==="Escape")m.current?.blur(),v1({edges:[P]});else c1([Q])}};return F1.jsx("svg",{style:{zIndex:x},children:F1.jsxs("g",{className:y0(["react-flow__edge",`react-flow__edge-${v}`,P.className,V,{selected:P.selected,animated:P.animated,inactive:!a&&!X,updating:_1,selectable:a}]),onClick:L1,onDoubleClick:M1,onContextMenu:I1,onMouseEnter:X1,onMouseMove:f1,onMouseLeave:l1,onKeyDown:E?W1:void 0,tabIndex:E?0:void 0,role:P.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":Q,"data-testid":`rf__edge-${Q}`,"aria-label":P.ariaLabel===null?void 0:P.ariaLabel||`Edge from ${P.source} to ${P.target}`,"aria-describedby":E?`${VT}-${f}`:void 0,ref:m,...P.domAttributes,children:[!J1&&F1.jsx(b,{id:Q,source:P.source,target:P.target,type:P.type,selected:P.selected,animated:P.animated,selectable:a,deletable:P.deletable??!0,label:P.label,labelStyle:P.labelStyle,labelShowBg:P.labelShowBg,labelBgStyle:P.labelBgStyle,labelBgPadding:P.labelBgPadding,labelBgBorderRadius:P.labelBgBorderRadius,sourceX:d,sourceY:g,targetX:n,targetY:j,sourcePosition:i,targetPosition:q1,data:P.data,style:P.style,sourceHandleId:P.sourceHandle,targetHandleId:P.targetHandle,markerStart:Q1,markerEnd:Y1,pathOptions:"pathOptions"in P?P.pathOptions:void 0,interactionWidth:P.interactionWidth}),p&&F1.jsx(Uj,{edge:P,isReconnectable:p,reconnectRadius:R,onReconnect:L,onReconnectStart:M,onReconnectEnd:I,sourceX:d,sourceY:g,targetX:n,targetY:j,sourcePosition:i,targetPosition:q1,setUpdateHover:$1,setReconnecting:y})]})})}var Zj=K1.memo(Gj),Fj=(Q)=>({edgesFocusable:Q.edgesFocusable,edgesReconnectable:Q.edgesReconnectable,elementsSelectable:Q.elementsSelectable,connectionMode:Q.connectionMode,onError:Q.onError});function $R({defaultMarkerColor:Q,onlyRenderVisibleElements:U,rfId:Z,edgeTypes:K,noPanClassName:X,onReconnect:W,onEdgeContextMenu:z,onEdgeMouseEnter:B,onEdgeMouseMove:O,onEdgeMouseLeave:T,onEdgeClick:R,reconnectRadius:L,onEdgeDoubleClick:M,onReconnectStart:I,onReconnectEnd:f,disableKeyboardA11y:D}){let{edgesFocusable:V,edgesReconnectable:k,elementsSelectable:h,onError:P}=G0(Fj,N0),C=dS(U);return F1.jsxs("div",{className:"react-flow__edges",children:[F1.jsx(oS,{defaultColor:Q,rfId:Z}),C.map((v)=>{return F1.jsx(Zj,{id:v,edgesFocusable:V,edgesReconnectable:k,elementsSelectable:h,noPanClassName:X,onReconnect:W,onContextMenu:z,onMouseEnter:B,onMouseMove:O,onMouseLeave:T,onClick:R,reconnectRadius:L,onDoubleClick:M,onReconnectStart:I,onReconnectEnd:f,rfId:Z,onError:P,edgeTypes:K,disableKeyboardA11y:D},v)})]})}$R.displayName="EdgeRenderer";var Kj=K1.memo($R),wT=(Q)=>`translate(${Q[0]}px,${Q[1]}px) scale(${Q[2]})`;function Xj({children:Q}){let U=C0(),Z=K1.useRef(null),[K]=K1.useState(()=>U.getState().transform);return ET(()=>{let X=null,W=()=>{let z=U.getState().transform;if(X&&z[0]===X[0]&&z[1]===X[1]&&z[2]===X[2])return;if(X=z,Z.current)Z.current.style.transform=wT(z)};return W(),U.subscribe(W)},[U]),F1.jsx("div",{ref:Z,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:wT(K)},children:Q})}function Hj(Q){let U=OJ(),Z=K1.useRef(!1);K1.useEffect(()=>{if(!Z.current&&U.viewportInitialized&&Q)setTimeout(()=>Q(U),1),Z.current=!0},[Q,U.viewportInitialized])}var Yj=(Q)=>Q.panZoom?.syncViewport;function Wj(Q){let U=G0(Yj),Z=C0();return K1.useEffect(()=>{if(Q)U?.(Q),Z.setState({transform:[Q.x,Q.y,Q.zoom]})},[Q,U]),null}function IT(Q){return Q.connection.inProgress?{...Q.connection,to:n7(Q.connection.to,Q.transform)}:{...Q.connection}}function zj(Q){if(Q)return(Z)=>{let K=IT(Z);return Q(K)};return IT}function Bj(Q){let U=zj(Q);return G0(U,N0)}var Aj=(Q)=>({nodesConnectable:Q.nodesConnectable,isValid:Q.connection.isValid,inProgress:Q.connection.inProgress,width:Q.width,height:Q.height});function Lj({containerStyle:Q,style:U,type:Z,component:K}){let{nodesConnectable:X,width:W,height:z,isValid:B,inProgress:O}=G0(Aj,N0);if(!(W&&X&&O))return null;return F1.jsx("svg",{style:Q,width:W,height:z,className:"react-flow__connectionline react-flow__container",children:F1.jsx("g",{className:y0(["react-flow__connection",WX(B)]),children:F1.jsx(QR,{style:U,type:Z,CustomComponent:K,isValid:B})})})}var QR=({style:Q,type:U=y4.Bezier,CustomComponent:Z,isValid:K})=>{let{inProgress:X,from:W,fromNode:z,fromHandle:B,fromPosition:O,to:T,toNode:R,toHandle:L,toPosition:M,pointer:I}=Bj();if(!X)return;if(Z)return F1.jsx(Z,{connectionLineType:U,connectionLineStyle:Q,fromNode:z,fromHandle:B,fromX:W.x,fromY:W.y,toX:T.x,toY:T.y,fromPosition:O,toPosition:M,connectionStatus:WX(K),toNode:R,toHandle:L,pointer:I});let f="",D={sourceX:W.x,sourceY:W.y,sourcePosition:O,targetX:T.x,targetY:T.y,targetPosition:M};switch(U){case y4.Bezier:[f]=kq(D);break;case y4.SimpleBezier:[f]=lT(D);break;case y4.Step:[f]=TJ({...D,borderRadius:0});break;case y4.SmoothStep:[f]=TJ(D);break;default:[f]=Dq(D)}return F1.jsx("path",{d:f,fill:"none",className:"react-flow__connection-path",style:Q})};QR.displayName="ConnectionLine";var Mj={};function fT(Q=Mj){let U=K1.useRef(Q),Z=C0();K1.useEffect(()=>{{let K=new Set([...Object.keys(U.current),...Object.keys(Q)]);for(let X of K)if(U.current[X]!==Q[X]){Z.getState().onError?.("002",x2.error002());break}U.current=Q}},[Q])}function Tj(){let Q=C0(),U=K1.useRef(!1);K1.useEffect(()=>{if(!U.current){let Z=document.querySelector(".react-flow__pane");if(Z&&window.getComputedStyle(Z).zIndex!=="1")Q.getState().onError?.("013",x2.error013("react"));U.current=!0}},[])}function qR({nodeTypes:Q,edgeTypes:U,onInit:Z,onNodeClick:K,onEdgeClick:X,onNodeDoubleClick:W,onEdgeDoubleClick:z,onNodeMouseEnter:B,onNodeMouseMove:O,onNodeMouseLeave:T,onNodeContextMenu:R,onSelectionContextMenu:L,onSelectionStart:M,onSelectionEnd:I,connectionLineType:f,connectionLineStyle:D,connectionLineComponent:V,connectionLineContainerStyle:k,selectionKeyCode:h,selectionOnDrag:P,selectionMode:C,multiSelectionKeyCode:v,panActivationKeyCode:b,zoomActivationKeyCode:E,deleteKeyCode:p,onlyRenderVisibleElements:a,elementsSelectable:m,defaultViewport:_1,translateExtent:$1,minZoom:J1,maxZoom:y,preventScrolling:u,defaultMarkerColor:x,zoomOnScroll:d,zoomOnPinch:g,panOnScroll:n,panOnScrollSpeed:j,panOnScrollMode:i,zoomOnDoubleClick:q1,panOnDrag:Q1,autoPanOnSelection:Y1,onPaneClick:L1,onPaneMouseEnter:M1,onPaneMouseMove:I1,onPaneMouseLeave:X1,onPaneScroll:f1,onPaneContextMenu:l1,paneClickDistance:W1,nodeClickDistance:S1,onEdgeContextMenu:v1,onEdgeMouseEnter:c1,onEdgeMouseMove:E1,onEdgeMouseLeave:j1,reconnectRadius:V0,onReconnect:b1,onReconnectStart:Z2,onReconnectEnd:_0,noDragClassName:h2,noWheelClassName:z2,noPanClassName:I2,disableKeyboardA11y:f2,nodeExtent:P2,rfId:B2,viewport:A2,onViewportChange:L2,nodesDraggable:M3}){return fT(Q),fT(U),Tj(),Hj(Z),Wj(A2),F1.jsx(bS,{onPaneClick:L1,onPaneMouseEnter:M1,onPaneMouseMove:I1,onPaneMouseLeave:X1,onPaneContextMenu:l1,onPaneScroll:f1,paneClickDistance:W1,deleteKeyCode:p,selectionKeyCode:h,selectionOnDrag:P,selectionMode:C,onSelectionStart:M,onSelectionEnd:I,multiSelectionKeyCode:v,panActivationKeyCode:b,zoomActivationKeyCode:E,elementsSelectable:m,zoomOnScroll:d,zoomOnPinch:g,zoomOnDoubleClick:q1,panOnScroll:n,panOnScrollSpeed:j,panOnScrollMode:i,panOnDrag:Q1,autoPanOnSelection:Y1,defaultViewport:_1,translateExtent:$1,minZoom:J1,maxZoom:y,onSelectionContextMenu:L,preventScrolling:u,noDragClassName:h2,noWheelClassName:z2,noPanClassName:I2,disableKeyboardA11y:f2,onViewportChange:L2,isControlledViewport:!!A2,children:F1.jsxs(Xj,{children:[F1.jsx(Kj,{edgeTypes:U,onEdgeClick:X,onEdgeDoubleClick:z,onReconnect:b1,onReconnectStart:Z2,onReconnectEnd:_0,onlyRenderVisibleElements:a,onEdgeContextMenu:v1,onEdgeMouseEnter:c1,onEdgeMouseMove:E1,onEdgeMouseLeave:j1,reconnectRadius:V0,defaultMarkerColor:x,noPanClassName:I2,disableKeyboardA11y:f2,rfId:B2}),F1.jsx(Lj,{style:D,type:f,component:V,containerStyle:k}),F1.jsx("div",{className:"react-flow__edgelabel-renderer"}),F1.jsx(rS,{nodeTypes:Q,onNodeClick:K,onNodeDoubleClick:W,onNodeMouseEnter:B,onNodeMouseMove:O,onNodeMouseLeave:T,onNodeContextMenu:R,nodeClickDistance:S1,onlyRenderVisibleElements:a,noPanClassName:I2,noDragClassName:h2,disableKeyboardA11y:f2,nodeExtent:P2,rfId:B2,nodesDraggable:M3}),F1.jsx("div",{className:"react-flow__viewport-portal"})]})})}qR.displayName="GraphView";var Rj=K1.memo(qR),Oj=KX("React Flow","https://reactflow.dev/"),PT=({nodes:Q,edges:U,defaultNodes:Z,defaultEdges:K,width:X,height:W,fitView:z,fitViewOptions:B,minZoom:O=0.5,maxZoom:T=2,nodeOrigin:R,nodeExtent:L,zIndexMode:M="basic"}={})=>{let I=new Map,f=new Map,D=new Map,V=new Map,k=K??U??[],h=Z??Q??[],P=R??[0,0],C=L??s7;wX(D,V,k);let{nodesInitialized:v}=vq(h,I,f,{nodeOrigin:P,nodeExtent:C,zIndexMode:M}),b=[0,0,1];if(z&&X&&W){let E=f8(I,{filter:(_1)=>!!((_1.width||_1.initialWidth)&&(_1.height||_1.initialHeight))}),{x:p,y:a,zoom:m}=MJ(E,X,W,O,T,B?.padding??0.1);b=[p,a,m]}return{rfId:"1",width:X??0,height:W??0,transform:b,nodes:h,nodesInitialized:v,nodeLookup:I,parentLookup:f,edges:k,edgeLookup:V,connectionLookup:D,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:Z!==void 0,hasDefaultEdges:K!==void 0,panZoom:null,minZoom:O,maxZoom:T,translateExtent:s7,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:A6.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:P,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:B,fitViewResolver:null,connection:{...$X},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Oj,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:JX,zIndexMode:M,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}},wj=({nodes:Q,edges:U,defaultNodes:Z,defaultEdges:K,width:X,height:W,fitView:z,fitViewOptions:B,minZoom:O,maxZoom:T,nodeOrigin:R,nodeExtent:L,zIndexMode:M})=>nM((I,f)=>{async function D(){let{nodeLookup:V,panZoom:k,fitViewOptions:h,fitViewResolver:P,width:C,height:v,minZoom:b,maxZoom:E}=f();if(!k)return;await BM({nodes:V,width:C,height:v,panZoom:k,minZoom:b,maxZoom:E},h),P?.resolve(!0),I({fitViewResolver:null})}return{...PT({nodes:Q,edges:U,width:X,height:W,fitView:z,fitViewOptions:B,minZoom:O,maxZoom:T,nodeOrigin:R,nodeExtent:L,defaultNodes:Z,defaultEdges:K,zIndexMode:M}),setNodes:(V)=>{let{nodeLookup:k,parentLookup:h,nodeOrigin:P,nodeExtent:C,elevateNodesOnSelect:v,fitViewQueued:b,zIndexMode:E,nodesSelectionActive:p}=f(),{nodesInitialized:a,hasSelectedNodes:m}=vq(V,k,h,{nodeOrigin:P,nodeExtent:C,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:E}),_1=p&&m;if(b&&a)D(),I({nodes:V,nodesInitialized:a,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:_1});else I({nodes:V,nodesInitialized:a,nodesSelectionActive:_1})},setEdges:(V)=>{let{connectionLookup:k,edgeLookup:h}=f();wX(k,h,V),I({edges:V})},setDefaultNodesAndEdges:(V,k)=>{if(V){let{setNodes:h}=f();h(V),I({hasDefaultNodes:!0})}if(k){let{setEdges:h}=f();h(k),I({hasDefaultEdges:!0})}},updateNodeInternals:(V)=>{let{triggerNodeChanges:k,nodeLookup:h,parentLookup:P,domNode:C,nodeOrigin:v,nodeExtent:b,debug:E,fitViewQueued:p,zIndexMode:a}=f(),{changes:m,updatedInternals:_1}=kM(V,h,P,C,v,b,a);if(!_1)return;if(jM(h,P,{nodeOrigin:v,nodeExtent:b,zIndexMode:a}),p)D(),I({fitViewQueued:!1,fitViewOptions:void 0});else I({});if(m?.length>0){if(E)console.log("React Flow: trigger node changes",m);k?.(m)}},updateNodePositions:(V,k=!1)=>{let h=[],P=[],{nodeLookup:C,triggerNodeChanges:v,connection:b,updateConnection:E,onNodesChangeMiddlewareMap:p}=f();for(let[a,m]of V){let _1=C.get(a),$1=!!(_1?.expandParent&&_1?.parentId&&m?.position),J1={id:a,type:"position",position:$1?{x:Math.max(0,m.position.x),y:Math.max(0,m.position.y)}:m.position,dragging:k};if(_1&&b.inProgress&&b.fromNode.id===_1.id){let y=L6(_1,b.fromHandle,C1.Left,!0);E({...b,from:y})}if($1&&_1.parentId)h.push({id:a,parentId:_1.parentId,rect:{...m.internals.positionAbsolute,width:m.measured.width??0,height:m.measured.height??0}});P.push(J1)}if(h.length>0){let{parentLookup:a,nodeOrigin:m}=f(),_1=Eq(h,C,a,m);P.push(..._1)}for(let a of p.values())P=a(P);v(P)},triggerNodeChanges:(V)=>{let{onNodesChange:k,setNodes:h,nodes:P,hasDefaultNodes:C,debug:v}=f();if(V?.length){if(C){let b=yT(V,P);h(b)}if(v)console.log("React Flow: trigger node changes",V);k?.(V)}},triggerEdgeChanges:(V)=>{let{onEdgesChange:k,setEdges:h,edges:P,hasDefaultEdges:C,debug:v}=f();if(V?.length){if(C){let b=QS(V,P);h(b)}if(v)console.log("React Flow: trigger edge changes",V);k?.(V)}},addSelectedNodes:(V)=>{let{multiSelectionActive:k,edgeLookup:h,nodeLookup:P,triggerNodeChanges:C,triggerEdgeChanges:v}=f();if(k){let b=V.map((E)=>P8(E,!0));C(b);return}C(_9(P,new Set([...V]),!0)),v(_9(h))},addSelectedEdges:(V)=>{let{multiSelectionActive:k,edgeLookup:h,nodeLookup:P,triggerNodeChanges:C,triggerEdgeChanges:v}=f();if(k){let b=V.map((E)=>P8(E,!0));v(b);return}v(_9(h,new Set([...V]))),C(_9(P,new Set,!0))},unselectNodesAndEdges:({nodes:V,edges:k}={})=>{let{edges:h,nodes:P,nodeLookup:C,triggerNodeChanges:v,triggerEdgeChanges:b}=f(),E=V?V:P,p=k?k:h,a=[];for(let _1 of E){if(!_1.selected)continue;let $1=C.get(_1.id);if($1)$1.selected=!1;a.push(P8(_1.id,!1))}let m=[];for(let _1 of p){if(!_1.selected)continue;m.push(P8(_1.id,!1))}v(a),b(m)},setMinZoom:(V)=>{let{panZoom:k,maxZoom:h}=f();k?.setScaleExtent([V,h]),I({minZoom:V})},setMaxZoom:(V)=>{let{panZoom:k,minZoom:h}=f();k?.setScaleExtent([h,V]),I({maxZoom:V})},setTranslateExtent:(V)=>{f().panZoom?.setTranslateExtent(V),I({translateExtent:V})},resetSelectedElements:()=>{let{edges:V,nodes:k,triggerNodeChanges:h,triggerEdgeChanges:P,elementsSelectable:C}=f();if(!C)return;let v=k.reduce((E,p)=>p.selected?[...E,P8(p.id,!1)]:E,[]),b=V.reduce((E,p)=>p.selected?[...E,P8(p.id,!1)]:E,[]);h(v),P(b)},setNodeExtent:(V)=>{let{nodes:k,nodeLookup:h,parentLookup:P,nodeOrigin:C,elevateNodesOnSelect:v,nodeExtent:b,zIndexMode:E}=f();if(V[0][0]===b[0][0]&&V[0][1]===b[0][1]&&V[1][0]===b[1][0]&&V[1][1]===b[1][1])return;vq(k,h,P,{nodeOrigin:C,nodeExtent:V,elevateNodesOnSelect:v,checkEquality:!1,zIndexMode:E}),I({nodeExtent:V})},panBy:(V)=>{let{transform:k,width:h,height:P,panZoom:C,translateExtent:v}=f();return DM({delta:V,panZoom:C,transform:k,translateExtent:v,width:h,height:P})},setCenter:async(V,k,h)=>{let{width:P,height:C,maxZoom:v,panZoom:b}=f();if(!b)return!1;let E=typeof h?.zoom<"u"?h.zoom:v;return await b.setViewport({x:P/2-V*E,y:C/2-k*E,zoom:E},{duration:h?.duration,ease:h?.ease,interpolate:h?.interpolate}),!0},cancelConnection:()=>{I({connection:{...$X}})},updateConnection:(V)=>{I({connection:V})},reset:()=>I({...PT()})}},Object.is);function kX({initialNodes:Q,initialEdges:U,defaultNodes:Z,defaultEdges:K,initialWidth:X,initialHeight:W,initialMinZoom:z,initialMaxZoom:B,initialFitViewOptions:O,fitView:T,nodeOrigin:R,nodeExtent:L,zIndexMode:M,children:I}){let[f]=K1.useState(()=>wj({nodes:Q,edges:U,defaultNodes:Z,defaultEdges:K,width:X,height:W,fitView:T,minZoom:z,maxZoom:B,fitViewOptions:O,nodeOrigin:R,nodeExtent:L,zIndexMode:M}));return F1.jsx(uC,{value:f,children:F1.jsx(FS,{children:F1.jsx(IS,{children:I})})})}function Ij({children:Q,nodes:U,edges:Z,defaultNodes:K,defaultEdges:X,width:W,height:z,fitView:B,fitViewOptions:O,minZoom:T,maxZoom:R,nodeOrigin:L,nodeExtent:M,zIndexMode:I}){if(K1.useContext(pq))return F1.jsx(F1.Fragment,{children:Q});return F1.jsx(kX,{initialNodes:U,initialEdges:Z,defaultNodes:K,defaultEdges:X,initialWidth:W,initialHeight:z,fitView:B,initialFitViewOptions:O,initialMinZoom:T,initialMaxZoom:R,nodeOrigin:L,nodeExtent:M,zIndexMode:I,children:Q})}var fj={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Pj({nodes:Q,edges:U,defaultNodes:Z,defaultEdges:K,className:X,nodeTypes:W,edgeTypes:z,onNodeClick:B,onEdgeClick:O,onInit:T,onMove:R,onMoveStart:L,onMoveEnd:M,onConnect:I,onConnectStart:f,onConnectEnd:D,onClickConnectStart:V,onClickConnectEnd:k,onNodeMouseEnter:h,onNodeMouseMove:P,onNodeMouseLeave:C,onNodeContextMenu:v,onNodeDoubleClick:b,onNodeDragStart:E,onNodeDrag:p,onNodeDragStop:a,onNodesDelete:m,onEdgesDelete:_1,onDelete:$1,onSelectionChange:J1,onSelectionDragStart:y,onSelectionDrag:u,onSelectionDragStop:x,onSelectionContextMenu:d,onSelectionStart:g,onSelectionEnd:n,onBeforeDelete:j,connectionMode:i,connectionLineType:q1=y4.Bezier,connectionLineStyle:Q1,connectionLineComponent:Y1,connectionLineContainerStyle:L1,deleteKeyCode:M1="Backspace",selectionKeyCode:I1="Shift",selectionOnDrag:X1=!1,selectionMode:f1=R8.Full,panActivationKeyCode:l1="Space",multiSelectionKeyCode:W1=e7()?"Meta":"Control",zoomActivationKeyCode:S1=e7()?"Meta":"Control",snapToGrid:v1,snapGrid:c1,onlyRenderVisibleElements:E1=!1,selectNodesOnDrag:j1,nodesDraggable:V0,autoPanOnNodeFocus:b1,nodesConnectable:Z2,nodesFocusable:_0,nodeOrigin:h2=kT,edgesFocusable:z2,edgesReconnectable:I2,elementsSelectable:f2=!0,defaultViewport:P2=tC,minZoom:B2=0.5,maxZoom:A2=2,translateExtent:L2=s7,preventScrolling:M3=!0,nodeExtent:v5,defaultMarkerColor:b4="#b1b1b7",zoomOnScroll:u4=!0,zoomOnPinch:x4=!0,panOnScroll:I6=!1,panOnScrollSpeed:e5=0.5,panOnScrollMode:S=B3.Free,zoomOnDoubleClick:e=!0,panOnDrag:A1=!0,onPaneClick:R1,onPaneMouseEnter:P1,onPaneMouseMove:h1,onPaneMouseLeave:m1,onPaneScroll:U0,onPaneContextMenu:V1,paneClickDistance:J2=1,nodeClickDistance:N2=0,children:_4,onReconnect:f6,onReconnectStart:SJ,onReconnectEnd:v8,onEdgeContextMenu:E8,onEdgeDoubleClick:E5,onEdgeMouseEnter:m2,onEdgeMouseMove:jJ,onEdgeMouseLeave:eq,reconnectRadius:G9=10,onNodesChange:VJ,onEdgesChange:b8,noDragClassName:g2="nodrag",noWheelClassName:kJ="nowheel",noPanClassName:u8="nopan",fitView:Z9,fitViewOptions:x8,connectOnClick:DJ,attributionPosition:yJ,proOptions:T3,defaultEdgeOptions:vJ,elevateNodesOnSelect:EJ=!0,elevateEdgesOnSelect:bJ=!1,disableKeyboardA11y:F9=!1,autoPanOnConnect:uJ,autoPanOnNodeDrag:C2,autoPanOnSelection:R3=!0,autoPanSpeed:h4,connectionRadius:xJ,isValidConnection:P6,onError:h8,style:K9,id:O3,nodeDragThreshold:w3,connectionDragThreshold:X9,viewport:_U,onViewportChange:JU,width:hJ,height:H9,colorMode:Y9="light",debug:mJ,onScroll:W9,ariaLabelConfig:gJ,zIndexMode:pJ="basic",...cJ},z9){let I3=O3||"1",N6=_S(Y9),$U=K1.useCallback((B9)=>{B9.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),W9?.(B9)},[W9]);return F1.jsx("div",{"data-testid":"rf__wrapper",...cJ,onScroll:$U,style:{...K9,...fj},ref:z9,className:y0(["react-flow",X,N6]),id:O3,role:"application",children:F1.jsxs(Ij,{nodes:Q,edges:U,width:hJ,height:H9,fitView:Z9,fitViewOptions:x8,minZoom:B2,maxZoom:A2,nodeOrigin:h2,nodeExtent:v5,zIndexMode:pJ,children:[F1.jsx(eC,{nodes:Q,edges:U,defaultNodes:Z,defaultEdges:K,onConnect:I,onConnectStart:f,onConnectEnd:D,onClickConnectStart:V,onClickConnectEnd:k,nodesDraggable:V0,autoPanOnNodeFocus:b1,nodesConnectable:Z2,nodesFocusable:_0,edgesFocusable:z2,edgesReconnectable:I2,elementsSelectable:f2,elevateNodesOnSelect:EJ,elevateEdgesOnSelect:bJ,minZoom:B2,maxZoom:A2,nodeExtent:v5,onNodesChange:VJ,onEdgesChange:b8,snapToGrid:v1,snapGrid:c1,connectionMode:i,translateExtent:L2,connectOnClick:DJ,defaultEdgeOptions:vJ,fitView:Z9,fitViewOptions:x8,onNodesDelete:m,onEdgesDelete:_1,onDelete:$1,onNodeDragStart:E,onNodeDrag:p,onNodeDragStop:a,onSelectionDrag:u,onSelectionDragStart:y,onSelectionDragStop:x,onMove:R,onMoveStart:L,onMoveEnd:M,noPanClassName:u8,nodeOrigin:h2,rfId:I3,autoPanOnConnect:uJ,autoPanOnNodeDrag:C2,autoPanSpeed:h4,onError:h8,connectionRadius:xJ,isValidConnection:P6,selectNodesOnDrag:j1,nodeDragThreshold:w3,connectionDragThreshold:X9,onBeforeDelete:j,debug:mJ,ariaLabelConfig:gJ,zIndexMode:pJ}),F1.jsx(Rj,{onInit:T,onNodeClick:B,onEdgeClick:O,onNodeMouseEnter:h,onNodeMouseMove:P,onNodeMouseLeave:C,onNodeContextMenu:v,onNodeDoubleClick:b,nodeTypes:W,edgeTypes:z,connectionLineType:q1,connectionLineStyle:Q1,connectionLineComponent:Y1,connectionLineContainerStyle:L1,selectionKeyCode:I1,selectionOnDrag:X1,selectionMode:f1,deleteKeyCode:M1,multiSelectionKeyCode:W1,panActivationKeyCode:l1,zoomActivationKeyCode:S1,onlyRenderVisibleElements:E1,defaultViewport:P2,translateExtent:L2,minZoom:B2,maxZoom:A2,preventScrolling:M3,zoomOnScroll:u4,zoomOnPinch:x4,zoomOnDoubleClick:e,panOnScroll:I6,panOnScrollSpeed:e5,panOnScrollMode:S,panOnDrag:A1,autoPanOnSelection:R3,onPaneClick:R1,onPaneMouseEnter:P1,onPaneMouseMove:h1,onPaneMouseLeave:m1,onPaneScroll:U0,onPaneContextMenu:V1,paneClickDistance:J2,nodeClickDistance:N2,onSelectionContextMenu:d,onSelectionStart:g,onSelectionEnd:n,onReconnect:f6,onReconnectStart:SJ,onReconnectEnd:v8,onEdgeContextMenu:E8,onEdgeDoubleClick:E5,onEdgeMouseEnter:m2,onEdgeMouseMove:jJ,onEdgeMouseLeave:eq,reconnectRadius:G9,defaultMarkerColor:b4,noDragClassName:g2,noWheelClassName:kJ,noPanClassName:u8,rfId:I3,disableKeyboardA11y:F9,nodeExtent:v5,viewport:_U,onViewportChange:JU,nodesDraggable:V0}),F1.jsx(sC,{onSelectionChange:J1}),_4,F1.jsx(lC,{proOptions:T3,position:yJ}),F1.jsx(cC,{rfId:I3,disableKeyboardA11y:F9})]})})}var UR=vT(Pj);function GR(Q){let[U,Z]=K1.useState(Q),K=K1.useCallback((X)=>Z((W)=>yT(X,W)),[]);return[U,Z,K]}var Zm=x2.error014();function Nj({dimensions:Q,lineWidth:U,variant:Z,className:K}){return F1.jsx("path",{strokeWidth:U,d:`M${Q[0]/2} 0 V${Q[1]} M0 ${Q[1]/2} H${Q[0]}`,className:y0(["react-flow__background-pattern",Z,K])})}function Cj({radius:Q,className:U}){return F1.jsx("circle",{cx:Q,cy:Q,r:Q,className:y0(["react-flow__background-pattern","dots",U])})}var v4;(function(Q){Q.Lines="lines",Q.Dots="dots",Q.Cross="cross"})(v4||(v4={}));var Sj={[v4.Dots]:1,[v4.Lines]:1,[v4.Cross]:6},jj=(Q)=>({transform:Q.transform,patternId:`pattern-${Q.rfId}`});function ZR({id:Q,variant:U=v4.Dots,gap:Z=20,size:K,lineWidth:X=1,offset:W=0,color:z,bgColor:B,style:O,className:T,patternClassName:R}){let L=K1.useRef(null),{transform:M,patternId:I}=G0(jj,N0),f=K||Sj[U],D=U===v4.Dots,V=U===v4.Cross,k=Array.isArray(Z)?Z:[Z,Z],h=[k[0]*M[2]||1,k[1]*M[2]||1],P=f*M[2],C=Array.isArray(W)?W:[W,W],v=V?[P,P]:h,b=[C[0]*M[2]+v[0]/2,C[1]*M[2]+v[1]/2],E=`${I}${Q?Q:""}`;return F1.jsxs("svg",{className:y0(["react-flow__background",T]),style:{...O,...cq,"--xy-background-color-props":B,"--xy-background-pattern-color-props":z},ref:L,"data-testid":"rf__background",children:[F1.jsx("pattern",{id:E,x:M[0]%h[0],y:M[1]%h[1],width:h[0],height:h[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${b[0]},-${b[1]})`,children:D?F1.jsx(Cj,{radius:P/2,className:R}):F1.jsx(Nj,{dimensions:v,lineWidth:X,variant:U,className:R})}),F1.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}ZR.displayName="Background";var FR=K1.memo(ZR);function Vj(){return F1.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:F1.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function kj(){return F1.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:F1.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Dj(){return F1.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:F1.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 yj(){return F1.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:F1.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 vj(){return F1.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:F1.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 hq({children:Q,className:U,...Z}){return F1.jsx("button",{type:"button",className:y0(["react-flow__controls-button",U]),...Z,children:Q})}var Ej=(Q)=>({isInteractive:Q.nodesDraggable||Q.nodesConnectable||Q.elementsSelectable,minZoomReached:Q.transform[2]<=Q.minZoom,maxZoomReached:Q.transform[2]>=Q.maxZoom,ariaLabelConfig:Q.ariaLabelConfig});function KR({style:Q,showZoom:U=!0,showFitView:Z=!0,showInteractive:K=!0,fitViewOptions:X,onZoomIn:W,onZoomOut:z,onFitView:B,onInteractiveChange:O,className:T,children:R,position:L="bottom-left",orientation:M="vertical","aria-label":I}){let f=C0(),{isInteractive:D,minZoomReached:V,maxZoomReached:k,ariaLabelConfig:h}=G0(Ej,N0),{zoomIn:P,zoomOut:C,fitView:v}=OJ(),b=()=>{P(),W?.()},E=()=>{C(),z?.()},p=()=>{v(X),B?.()},a=()=>{f.setState({nodesDraggable:!D,nodesConnectable:!D,elementsSelectable:!D}),O?.(!D)};return F1.jsxs(N8,{className:y0(["react-flow__controls",M==="horizontal"?"horizontal":"vertical",T]),position:L,style:Q,"data-testid":"rf__controls","aria-label":I??h["controls.ariaLabel"],children:[U&&F1.jsxs(F1.Fragment,{children:[F1.jsx(hq,{onClick:b,className:"react-flow__controls-zoomin",title:h["controls.zoomIn.ariaLabel"],"aria-label":h["controls.zoomIn.ariaLabel"],disabled:k,children:F1.jsx(Vj,{})}),F1.jsx(hq,{onClick:E,className:"react-flow__controls-zoomout",title:h["controls.zoomOut.ariaLabel"],"aria-label":h["controls.zoomOut.ariaLabel"],disabled:V,children:F1.jsx(kj,{})})]}),Z&&F1.jsx(hq,{className:"react-flow__controls-fitview",onClick:p,title:h["controls.fitView.ariaLabel"],"aria-label":h["controls.fitView.ariaLabel"],children:F1.jsx(Dj,{})}),K&&F1.jsx(hq,{className:"react-flow__controls-interactive",onClick:a,title:h["controls.interactive.ariaLabel"],"aria-label":h["controls.interactive.ariaLabel"],children:D?F1.jsx(vj,{}):F1.jsx(yj,{})}),R]})}KR.displayName="Controls";var XR=K1.memo(KR);function bj({id:Q,x:U,y:Z,width:K,height:X,style:W,color:z,strokeColor:B,strokeWidth:O,className:T,borderRadius:R,shapeRendering:L,selected:M,onClick:I}){let{background:f,backgroundColor:D}=W||{},V=z||f||D;return F1.jsx("rect",{className:y0(["react-flow__minimap-node",{selected:M},T]),x:U,y:Z,rx:R,ry:R,width:K,height:X,style:{fill:V,stroke:B,strokeWidth:O},shapeRendering:L,onClick:I?(k)=>I(k,Q):void 0})}var uj=K1.memo(bj),xj=(Q)=>Q.nodes.map((U)=>U.id),CX=(Q)=>Q instanceof Function?Q:()=>Q;function hj({nodeStrokeColor:Q,nodeColor:U,nodeClassName:Z="",nodeBorderRadius:K=5,nodeStrokeWidth:X,nodeComponent:W=uj,onClick:z}){let B=G0(xj,N0),O=CX(U),T=CX(Q),R=CX(Z),L=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return F1.jsx(F1.Fragment,{children:B.map((M)=>F1.jsx(gj,{id:M,nodeColorFunc:O,nodeStrokeColorFunc:T,nodeClassNameFunc:R,nodeBorderRadius:K,nodeStrokeWidth:X,NodeComponent:W,onClick:z,shapeRendering:L},M))})}function mj({id:Q,nodeColorFunc:U,nodeStrokeColorFunc:Z,nodeClassNameFunc:K,nodeBorderRadius:X,nodeStrokeWidth:W,shapeRendering:z,NodeComponent:B,onClick:O}){let{node:T,x:R,y:L,width:M,height:I}=G0((f)=>{let D=f.nodeLookup.get(Q);if(!D)return{node:void 0,x:0,y:0,width:0,height:0};let V=D.internals.userNode,{x:k,y:h}=D.internals.positionAbsolute,{width:P,height:C}=y5(V);return{node:V,x:k,y:h,width:P,height:C}},N0);if(!T||T.hidden||!XX(T))return null;return F1.jsx(B,{x:R,y:L,width:M,height:I,style:T.style,selected:!!T.selected,className:K(T),color:U(T),borderRadius:X,strokeColor:Z(T),strokeWidth:W,shapeRendering:z,onClick:O,id:T.id})}var gj=K1.memo(mj),pj=K1.memo(hj),cj=200,lj=150,rj=(Q)=>!Q.hidden,dj=(Q)=>{let U={x:-Q.transform[0]/Q.transform[2],y:-Q.transform[1]/Q.transform[2],width:Q.width/Q.transform[2],height:Q.height/Q.transform[2]},Z=!1;for(let K of Q.nodeLookup.values())if(!K.hidden){Z=!0;break}return{viewBB:U,boundingRect:Z?ZX(f8(Q.nodeLookup,{filter:rj}),U):U,rfId:Q.rfId,panZoom:Q.panZoom,translateExtent:Q.translateExtent,flowWidth:Q.width,flowHeight:Q.height,ariaLabelConfig:Q.ariaLabelConfig}},NT=(Q,U)=>Q.x===U.x&&Q.y===U.y&&Q.width===U.width&&Q.height===U.height,ij=(Q,U)=>NT(Q.viewBB,U.viewBB)&&NT(Q.boundingRect,U.boundingRect)&&Q.rfId===U.rfId&&Q.panZoom===U.panZoom&&Q.translateExtent===U.translateExtent&&Q.flowWidth===U.flowWidth&&Q.flowHeight===U.flowHeight&&Q.ariaLabelConfig===U.ariaLabelConfig,aj="react-flow__minimap-desc";function HR({style:Q,className:U,nodeStrokeColor:Z,nodeColor:K,nodeClassName:X="",nodeBorderRadius:W=5,nodeStrokeWidth:z,nodeComponent:B,bgColor:O,maskColor:T,maskStrokeColor:R,maskStrokeWidth:L,position:M="bottom-right",onClick:I,onNodeClick:f,pannable:D=!1,zoomable:V=!1,ariaLabel:k,inversePan:h,zoomStep:P=1,offsetScale:C=5}){let v=C0(),b=K1.useRef(null),{boundingRect:E,panZoom:p,viewBB:a,rfId:m,translateExtent:_1,flowWidth:$1,flowHeight:J1,ariaLabelConfig:y}=G0(dj,ij),u=Q?.width??cj,x=Q?.height??lj,d=E.width/u,g=E.height/x,n=Math.max(d,g),j=n*u,i=n*x,q1=C*n,Q1=E.x-(j-E.width)/2-q1,Y1=E.y-(i-E.height)/2-q1,L1=j+q1*2,M1=i+q1*2,I1=`${aj}-${m}`,X1=K1.useRef(0),f1=K1.useRef();X1.current=n,K1.useEffect(()=>{let c1=v.getState().panZoom;if(b.current&&c1)return f1.current=hM({domNode:b.current,panZoom:c1,getTransform:()=>v.getState().transform,getViewScale:()=>X1.current}),()=>{f1.current?.destroy()}},[p]),K1.useEffect(()=>{f1.current?.update({translateExtent:_1,width:$1,height:J1,inversePan:h,pannable:D,zoomStep:P,zoomable:V})},[D,V,h,P,_1,$1,J1]);let l1=I?(c1)=>{let[E1,j1]=f1.current?.pointer(c1)||[0,0];I(c1,{x:E1,y:j1})}:void 0,W1=K1.useCallback((c1,E1)=>{let j1=v.getState().nodeLookup.get(E1).internals.userNode;f?.(c1,j1)},[f]),S1=f?W1:void 0,v1=k??y["minimap.ariaLabel"];return F1.jsx(N8,{position:M,style:{...Q,"--xy-minimap-background-color-props":typeof O==="string"?O:void 0,"--xy-minimap-mask-background-color-props":typeof T==="string"?T:void 0,"--xy-minimap-mask-stroke-color-props":typeof R==="string"?R:void 0,"--xy-minimap-mask-stroke-width-props":typeof L==="number"?L*n:void 0,"--xy-minimap-node-background-color-props":typeof K==="string"?K:void 0,"--xy-minimap-node-stroke-color-props":typeof Z==="string"?Z:void 0,"--xy-minimap-node-stroke-width-props":typeof z==="number"?z:void 0},className:y0(["react-flow__minimap",U]),"data-testid":"rf__minimap",children:F1.jsxs("svg",{width:u,height:x,viewBox:`${Q1} ${Y1} ${L1} ${M1}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":I1,ref:b,onClick:l1,children:[v1&&F1.jsx("title",{id:I1,children:v1}),F1.jsx(pj,{onClick:S1,nodeColor:K,nodeStrokeColor:Z,nodeBorderRadius:W,nodeClassName:X,nodeStrokeWidth:z,nodeComponent:B}),F1.jsx("path",{className:"react-flow__minimap-mask",d:`M${Q1-q1},${Y1-q1}h${L1+q1*2}v${M1+q1*2}h${-L1-q1*2}z
|
|
247
247
|
M${a.x},${a.y}h${a.width}v${a.height}h${-a.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}HR.displayName="MiniMap";var YR=K1.memo(HR),sj=(Q)=>(U)=>Q?`${Math.max(1/U.transform[2],1)}`:void 0,tj={[M6.Line]:"right",[M6.Handle]:"bottom-right"};function oj({nodeId:Q,position:U,variant:Z=M6.Handle,className:K,style:X=void 0,children:W,color:z,minWidth:B=10,minHeight:O=10,maxWidth:T=Number.MAX_VALUE,maxHeight:R=Number.MAX_VALUE,keepAspectRatio:L=!1,resizeDirection:M,autoScale:I=!0,shouldResize:f,onResizeStart:D,onResize:V,onResizeEnd:k}){let h=VX(),P=typeof Q==="string"?Q:h,C=C0(),v=K1.useRef(null),b=Z===M6.Handle,E=G0(K1.useCallback(sj(b&&I),[b,I]),N0),p=K1.useRef(null),a=U??tj[Z];K1.useEffect(()=>{if(!v.current||!P)return;if(!p.current)p.current=lM({domNode:v.current,nodeId:P,getStoreItems:()=>{let{nodeLookup:_1,transform:$1,snapGrid:J1,snapToGrid:y,nodeOrigin:u,domNode:x}=C.getState();return{nodeLookup:_1,transform:$1,snapGrid:J1,snapToGrid:y,nodeOrigin:u,paneDomNode:x}},onChange:(_1,$1)=>{let{triggerNodeChanges:J1,nodeLookup:y,parentLookup:u,nodeOrigin:x}=C.getState(),d=[],g={x:_1.x,y:_1.y},n=y.get(P);if(n&&n.expandParent&&n.parentId){let j=n.origin??x,i=_1.width??n.measured.width??0,q1=_1.height??n.measured.height??0,Q1={id:n.id,parentId:n.parentId,rect:{width:i,height:q1,...HX({x:_1.x??n.position.x,y:_1.y??n.position.y},{width:i,height:q1},n.parentId,y,j)}},Y1=Eq([Q1],y,u,x);d.push(...Y1),g.x=_1.x?Math.max(j[0]*i,_1.x):void 0,g.y=_1.y?Math.max(j[1]*q1,_1.y):void 0}if(g.x!==void 0&&g.y!==void 0){let j={id:P,type:"position",position:{...g}};d.push(j)}if(_1.width!==void 0&&_1.height!==void 0){let i={id:P,type:"dimensions",resizing:!0,setAttributes:!M?!0:M==="horizontal"?"width":"height",dimensions:{width:_1.width,height:_1.height}};d.push(i)}for(let j of $1){let i={...j,type:"position"};d.push(i)}J1(d)},onEnd:({width:_1,height:$1})=>{let J1={id:P,type:"dimensions",resizing:!1,dimensions:{width:_1,height:$1}};C.getState().triggerNodeChanges([J1])}});return p.current.update({controlPosition:a,boundaries:{minWidth:B,minHeight:O,maxWidth:T,maxHeight:R},keepAspectRatio:L,resizeDirection:M,onResizeStart:D,onResize:V,onResizeEnd:k,shouldResize:f}),()=>{p.current?.destroy()}},[a,B,O,T,R,L,D,V,k,f]);let m=a.split("-");return F1.jsx("div",{className:y0(["react-flow__resize-control","nodrag",...m,Z,K]),ref:v,style:{...X,scale:E,...z&&{[b?"backgroundColor":"borderColor"]:z}},children:W})}var Fm=K1.memo(oj);var nj=(Q)=>Q.domNode?.querySelector(".react-flow__renderer");function ej({children:Q}){let U=G0(nj);if(!U)return null;return CT.createPortal(Q,U)}var _V=(Q,U)=>Q?.internals.positionAbsolute.x!==U?.internals.positionAbsolute.x||Q?.internals.positionAbsolute.y!==U?.internals.positionAbsolute.y||Q?.measured.width!==U?.measured.width||Q?.measured.height!==U?.measured.height||Q?.selected!==U?.selected||Q?.internals.z!==U?.internals.z,JV=(Q,U)=>{if(Q.size!==U.size)return!1;for(let[Z,K]of Q)if(_V(K,U.get(Z)))return!1;return!0},$V=(Q)=>({x:Q.transform[0],y:Q.transform[1],zoom:Q.transform[2],selectedNodesCount:Q.nodes.filter((U)=>U.selected).length});function WR({nodeId:Q,children:U,className:Z,style:K,isVisible:X,position:W=C1.Top,offset:z=10,align:B="center",...O}){let T=VX(),R=K1.useCallback((v)=>{return(Array.isArray(Q)?Q:[Q||T||""]).reduce((p,a)=>{let m=v.nodeLookup.get(a);if(m)p.set(m.id,m);return p},new Map)},[Q,T]),L=G0(R,JV),{x:M,y:I,zoom:f,selectedNodesCount:D}=G0($V,N0);if(!(typeof X==="boolean"?X:L.size===1&&L.values().next().value?.selected&&D===1)||!L.size)return null;let k=f8(L),h=Array.from(L.values()),P=Math.max(...h.map((v)=>v.internals.z+1)),C={position:"absolute",transform:CM(k,{x:M,y:I,zoom:f},W,z,B),zIndex:P,...K};return F1.jsx(ej,{children:F1.jsx("div",{style:C,className:y0(["react-flow__node-toolbar",Z]),...O,"data-id":h.reduce((v,b)=>`${v}${b.id} `,"").trim(),children:U})})}var _2=u0(i5(),1);var zR={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 y1=u0(wJ(),1),qV="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function rq({href:Q,onClick:U}){return y1.jsxDEV("h1",{children:y1.jsxDEV("a",{href:Q,onClick:U,children:[y1.jsxDEV("img",{src:qV,alt:"",width:24,height:24,style:{verticalAlign:"middle"}},void 0,!1,void 0,this),y1.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 z5(Q){return(await Q.json().catch(()=>({}))).error??`answered ${Q.status}`}function AR(Q,U,Z=0,K=""){let[X,W]=_2.useState({state:"loading"});return _2.useEffect(()=>{W({state:"loading"})},[K,U]),_2.useEffect(()=>{if(!U)return;let z=!0;return(async()=>{try{let B=await Q(U),O=B.ok?{state:"ok",data:await B.json()}:{state:"error",status:B.status,error:await z5(B)};if(z)W(O)}catch(B){if(z)W({state:"error",status:0,error:String(B)})}})(),()=>{z=!1}},[K,U,Z]),X}function B5({load:Q,what:U,retry:Z,lines:K=3}){if(Q.state==="loading")return y1.jsxDEV(UV,{lines:K,label:`Loading ${U}…`},void 0,!1,void 0,this);if(Q.state==="error")return y1.jsxDEV("div",{role:"alert",className:"error-state",children:[y1.jsxDEV("span",{children:["Could not read ",U,": ",Q.error]},void 0,!0,void 0,this),Z?y1.jsxDEV("button",{type:"button",onClick:Z,children:"Try again"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return null}function UV({lines:Q=3,label:U="Loading…"}){return y1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":U,children:Array.from({length:Q},(Z,K)=>y1.jsxDEV("span",{style:{width:`${[92,76,84,64,88][K%5]}%`}},K,!1,void 0,this))},void 0,!1,void 0,this)}function h0({iso:Q,time:U}){if(!Q)return y1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let Z=new Date(Q);return y1.jsxDEV("time",{dateTime:Q,title:Q,children:Number.isNaN(Z.getTime())?Q:U?Z.toLocaleTimeString():Z.toLocaleString()},void 0,!1,void 0,this)}var IJ=(Q)=>Q?new Date(Q).toLocaleString():"—";function dq(Q){let U=Q?Date.parse(Q):Number.NaN;if(Number.isNaN(U))return"—";let Z=Math.max(0,Math.round((Date.now()-U)/1000));return Z<60?"just now":Z<3600?`${Math.round(Z/60)}m ago`:Z<86400?`${Math.round(Z/3600)}h ago`:`${Math.round(Z/86400)}d ago`}function J9(Q,U){let Z=U.replace(/[_-]+/g," "),K=Z.endsWith("s")?Z:/[^aeiou]y$/.test(Z)?`${Z.slice(0,-1)}ies`:/(ch|sh|x)$/.test(Z)?`${Z}es`:`${Z}s`;return`${Q} ${Q===1?Z:K}`}var EX=(Q)=>Q.length<=1?Q.join(""):`${Q.slice(0,-1).join(", ")} and ${Q[Q.length-1]}`,GV={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"},F0=(Q)=>GV[Q]??Q.charAt(0).toUpperCase()+Q.slice(1);function A5({vendor:Q}){let U=zR[Q];return y1.jsxDEV("span",{className:U?"mark logo":"mark","aria-hidden":"true",children:U?y1.jsxDEV("svg",{viewBox:"0 0 24 24",children:y1.jsxDEV("path",{d:U.d,fill:U.fill},void 0,!1,void 0,this)},void 0,!1,void 0,this):F0(Q).charAt(0)},void 0,!1,void 0,this)}var BR=(Q)=>{Q.currentTarget.closest("details")?.removeAttribute("open")},DX="volter.theme",LR=()=>{try{let Q=localStorage.getItem(DX);return Q==="light"||Q==="dark"?Q:"system"}catch{return"system"}};function bX(Q=LR()){let U=document.documentElement;if(Q==="system")U.removeAttribute("data-theme");else U.setAttribute("data-theme",Q)}function MR(){let[Q,U]=_2.useState(LR),Z=(K)=>{try{if(K==="system")localStorage.removeItem(DX);else localStorage.setItem(DX,K)}catch{}bX(K),U(K)};return y1.jsxDEV("div",{className:"theme-choice",role:"radiogroup","aria-label":"Theme",children:["system","light","dark"].map((K)=>y1.jsxDEV("button",{type:"button",role:"radio","aria-checked":Q===K,onClick:()=>Z(K),children:K==="system"?"System":K==="light"?"Light":"Dark"},K,!1,void 0,this))},void 0,!1,void 0,this)}function TR(){return _2.useEffect(()=>{let Q=()=>[...document.querySelectorAll("details.menu[open], details.clock-more[open]")],U=(K)=>{if(K.key!=="Escape"||document.querySelector("dialog[open]"))return;let X=Q();if(!X.length)return;for(let W of X)W.removeAttribute("open");X[X.length-1].querySelector("summary")?.focus()},Z=(K)=>{let X=K.target;for(let W of Q())if(!X||!W.contains(X))W.removeAttribute("open")};return document.addEventListener("keydown",U),document.addEventListener("click",Z),()=>{document.removeEventListener("keydown",U),document.removeEventListener("click",Z)}},[]),null}function S8({open:Q,onClose:U,title:Z,children:K,footer:X,wide:W}){let z=_2.useRef(null),B=_2.useId();return _2.useEffect(()=>{let O=z.current;if(!O)return;if(Q&&!O.open){O.showModal();let T=O.querySelector(".dialog-body :is(input:not([type=hidden]):not([disabled]), select, textarea)");if(T?.focus(),T instanceof HTMLInputElement&&T.value&&/^(text|search|email|url)$/.test(T.type))T.select()}if(!Q&&O.open)O.close()},[Q]),y1.jsxDEV("dialog",{ref:z,className:W?"dialog wide":"dialog","aria-labelledby":B,onClose:U,onCancel:(O)=>{O.preventDefault(),U()},onMouseDown:(O)=>{if(O.target===z.current)U()},children:Q?y1.jsxDEV(y1.Fragment,{children:[y1.jsxDEV("div",{className:"dialog-head",children:[y1.jsxDEV("h2",{id:B,children:Z},void 0,!1,void 0,this),y1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Close",onClick:U,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y1.jsxDEV("div",{className:"dialog-body",children:K},void 0,!1,void 0,this),X?y1.jsxDEV("div",{className:"dialog-foot",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)}var yX="volter:confirm";function o5(Q){return new Promise((U)=>{window.dispatchEvent(new CustomEvent(yX,{detail:{ask:Q,resolve:U}}))})}function RR(){let[Q,U]=_2.useState(null),[Z,K]=_2.useState("");_2.useEffect(()=>{let B=(O)=>{K(""),U(O.detail)};return window.addEventListener(yX,B),()=>window.removeEventListener(yX,B)},[]);let X=(B)=>{Q?.resolve(B),U(null)},W=Q?.ask,z=!W?.typed||Z===W.typed;return y1.jsxDEV(S8,{open:Boolean(Q),onClose:()=>X(!1),title:W?.title??"",footer:y1.jsxDEV(y1.Fragment,{children:[y1.jsxDEV("button",{type:"button",onClick:()=>X(!1),children:"Cancel"},void 0,!1,void 0,this),y1.jsxDEV("button",{type:"button",className:W?.danger?"danger-button":"primary",disabled:!z,onClick:()=>X(!0),children:W?.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[W?.body?y1.jsxDEV("div",{className:"confirm-body",children:W.body},void 0,!1,void 0,this):null,W?.typed?y1.jsxDEV("div",{className:"typed-confirm",children:[y1.jsxDEV("p",{children:["Type ",y1.jsxDEV("code",{children:W.typed},void 0,!1,void 0,this)," to confirm."]},void 0,!0,void 0,this),y1.jsxDEV("input",{autoFocus:!0,"aria-label":`Type ${W.typed} to confirm`,value:Z,onChange:(B)=>K(B.target.value),onKeyDown:(B)=>{if(B.key==="Enter"&&z)X(!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 vX="volter:toast";function t2(Q,U="ok"){window.dispatchEvent(new CustomEvent(vX,{detail:{text:Q,kind:U}}))}function OR(){let[Q,U]=_2.useState([]);return _2.useEffect(()=>{let Z=0,K=(X)=>{let{text:W,kind:z}=X.detail,B=++Z;if(U((O)=>[...O.slice(-3),{id:B,text:W,kind:z}]),z!=="error")setTimeout(()=>U((O)=>O.filter((T)=>T.id!==B)),4500)};return window.addEventListener(vX,K),()=>window.removeEventListener(vX,K)},[]),y1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:Q.map((Z)=>y1.jsxDEV("div",{className:`toast ${Z.kind}`,role:Z.kind==="error"?"alert":"status",children:[y1.jsxDEV("span",{children:Z.text},void 0,!1,void 0,this),y1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Dismiss",onClick:()=>U((K)=>K.filter((X)=>X.id!==Z.id)),children:"✕"},void 0,!1,void 0,this)]},Z.id,!0,void 0,this))},void 0,!1,void 0,this)}function uX({value:Q,label:U,secret:Z}){let[K,X]=_2.useState(!1);return y1.jsxDEV("div",{className:"copy-field",children:[U?y1.jsxDEV("span",{className:"copy-label",children:U},void 0,!1,void 0,this):null,y1.jsxDEV("div",{className:"copy-row",children:[y1.jsxDEV("input",{readOnly:!0,value:Q,"aria-label":U??"Value",onFocus:(z)=>z.currentTarget.select(),spellCheck:!1},void 0,!1,void 0,this),y1.jsxDEV("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(Q).then(()=>{X(!0),setTimeout(()=>X(!1),1600),t2(Z?"Copied. Keep it somewhere safe":"Copied")}).catch(()=>t2("Your browser would not copy it: select it and copy","error"))},children:K?"Copied":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function xX({label:Q,items:U}){return y1.jsxDEV("details",{className:"menu row-menu",children:[y1.jsxDEV("summary",{className:"icon-button",role:"button","aria-haspopup":"menu","aria-label":Q,title:Q,children:"⋯"},void 0,!1,void 0,this),y1.jsxDEV("div",{className:"popover menu-list",role:"menu",children:U.filter((Z)=>Boolean(Z)).map((Z)=>Z.href?y1.jsxDEV("a",{role:"menuitem",href:Z.href,className:Z.danger?"danger-item":void 0,onClick:BR,children:Z.label},Z.label,!1,void 0,this):y1.jsxDEV("button",{type:"button",role:"menuitem",disabled:Z.disabled,className:Z.danger?"danger-item":void 0,onClick:(K)=>{BR(K),Z.onSelect?.()},children:Z.label},Z.label,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wR({title:Q,children:U,action:Z}){return y1.jsxDEV("div",{className:"empty-state",children:[y1.jsxDEV("p",{className:"empty-title",children:Q},void 0,!1,void 0,this),U?y1.jsxDEV("div",{className:"empty-body",children:U},void 0,!1,void 0,this):null,Z?y1.jsxDEV("div",{className:"empty-action",children:Z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function IR(){return _2.useEffect(()=>{let Q=(Z)=>{let K=document.querySelector("main.app"),X=Z.target;if(K?.hasAttribute("data-drawer")&&X&&!X.closest(".side")&&!X.closest(".drawer-button"))K.removeAttribute("data-drawer")},U=(Z)=>{if(Z.key==="Escape")ZV()};return document.addEventListener("click",Q),document.addEventListener("keydown",U),()=>{document.removeEventListener("click",Q),document.removeEventListener("keydown",U)}},[]),y1.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 ZV=()=>{document.querySelector("main.app")?.removeAttribute("data-drawer")};var ER=u0(CR(),1);function mX(Q={}){let U=(K,X)=>Q.tools?`${X} (\`${K}\`)`:`\`${K}\``,Z=["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.","",Q.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, ${U("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. ${Q.tools?"Start it with world_up":"Start it: `volter world up`"}, then run the tests inside it: ${U("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 (${U("volter world log","world_log")}), and give me the dashboard link (${Q.tools?"world_view":"`volter world view --no-open`, started in the background: it keeps running"}).`];if(Q.platform){let K=Q.world??"<org>/<world>";Z.push(`5. Share it with my team on ${Q.platform}: ${U(`volter login ${Q.platform}`,"platform_login")} gives a link and a code for me to approve in my browser. Once I have, link it with ${U(`volter remote add origin ${K} --create`,"remote_link with create: true")}${Q.world?"":" (ask me for <org>/<world>)"}, then send what the app did: ${U('volter world changeset -m "<what and why>"',"world_changeset")} and ${U("volter world push","world_push")}.`)}return Z.push("","The guide: https://github.com/volter-ai/twin/blob/main/docs/guides/use-with-a-coding-agent.md"),Z.join(`
|
|
248
|
-
`)}var H=u0(wJ(),1),iq="volter.console.token",NJ=document.getElementById("root"),q0=NJ.dataset.base??"/-/console",B0=window.location.origin,w6=(NJ.dataset.worlds??B0).replace(/\/+$/,""),bR=(NJ.dataset.names??"").split(",").filter((Q)=>Q!==""),R6=NJ.dataset.worldOrigin==="1",k8=window.fetch.bind(window),O6="(session)",uR="(pass)",fJ=(Q)=>{try{if(Q&&!R6)sessionStorage.setItem(iq,Q);else sessionStorage.removeItem(iq);localStorage.removeItem(iq)}catch{}},xR="volter.console.portal",hR=(Q)=>{try{if(typeof Q==="string"&&/^https?:$/.test(new URL(Q).protocol))sessionStorage.setItem(xR,new URL(Q).origin)}catch{}},HV=()=>{return y8.get("token")??""},o2=()=>{try{let Q=sessionStorage.getItem(xR)??"";return Q&&/^https?:$/.test(new URL(Q).protocol)?new URL(Q).origin:""}catch{return""}},YV=()=>{let Q=HV();if(R6){if(fJ(""),y8.get("pass"))return uR;let U=new URLSearchParams(window.location.search).has("signin");if(U)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return Q||(U?"":O6)}if(Q)return fJ(Q),Q;try{return sessionStorage.getItem(iq)??""}catch{return""}};async function X0(Q,U,Z={}){return k8(`${B0}${U}`,{...Z,headers:{...Z.headers??{},...Q===O6?{}:{"x-volter-token":Q},...Z.body&&!Z.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function L5(Q,U,Z=0){return AR((K)=>X0(Q,K),U,Z,Q)}var U9=(Q)=>{let U=new Date(Q),Z=(K)=>String(K).padStart(2,"0");return`${U.getFullYear()}-${Z(U.getMonth()+1)}-${Z(U.getDate())}T${Z(U.getHours())}:${Z(U.getMinutes())}`},SR=(Q)=>new Date(Math.ceil(Date.parse(Q)/60000)*60000).toISOString(),nq=(Q)=>Q.operation==="observed"?`observed${Q.provenance==="placeholder"?" (default data)":" (vendor)"}`:Q.receipt?`${Q.receipt.status??""} ${Q.receipt.externalId??""} ${Q.receipt.reason??""}`.trim():Q.provenance==="placeholder"?"default data":"unpushed",mR=(Q)=>Q.actor?`${Q.actor.kind}${Q.actor.id?` ${Q.actor.id}`:""}`:"—",gR=(Q)=>{let U=/^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(Q??"");return U?{trace:U[1],span:U[2]}:null},lX="volter.console.snapshots",L3=()=>{try{return JSON.parse(sessionStorage.getItem(lX)??"{}")}catch{return{}}},pR=new Map,rX=(Q)=>{if(R6){if(Q.token||Q.readToken)pR.set(Q.name,{token:Q.token,readToken:Q.readToken});Q={...Q,token:"",readToken:""}}try{sessionStorage.setItem(lX,JSON.stringify({...L3(),[Q.name]:Q}))}catch{}},cR=(Q)=>pR.get(Q)?.readToken||L3()[Q]?.readToken||"",PJ=(Q)=>{try{let U=L3();delete U[Q],sessionStorage.setItem(lX,JSON.stringify(U))}catch{}},y8=new URLSearchParams(window.location.hash.slice(1)),Q9=y8.get("close")??"";function CJ(Q){if(typeof Q!=="string")return null;let U;try{U=new URL(Q)}catch{return null}return(U.protocol==="http:"||U.protocol==="https:")&&U.origin===Q.replace(/\/+$/,"")?U:null}function dX(Q){let U=CJ(Q);if(!U)return null;let Z=new URL(B0);if(U.protocol!==Z.protocol||U.port!==Z.port)return null;if(U.hostname===Z.hostname)return U.origin;let K=/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./;if(!K.test(U.hostname))return null;let X=U.hostname.replace(K,"");return X===Z.hostname||K.test(Z.hostname)&&X===Z.hostname.replace(K,"")?U.origin:null}function WV(Q){let U;try{U=JSON.parse(Q)}catch{return null}let Z=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof U.name!=="string"||!Z.test(U.name)||typeof U.parent!=="string"||!Z.test(U.parent)||typeof U.at!=="string")return null;let K=U.parentOrigin===void 0?void 0:dX(U.parentOrigin);return{name:U.name,parent:U.parent,token:typeof U.token==="string"?U.token:"",readToken:typeof U.readToken==="string"?U.readToken:"",at:U.at,expiresAt:typeof U.expiresAt==="string"?U.expiresAt:null,...K?{parentOrigin:K}:{}}}{let Q=y8.get("snapshot");if(Q){let U=WV(Q);if(U&&!L3()[U.name])rX(U)}}var lR="volter.console.home",rR=(Q)=>{let U=CJ(Q);if(!U)return null;let Z=new URL(B0).hostname,K=Z.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return U.hostname===Z||U.hostname===K?U.origin:null};{let Q=rR(y8.get("home"));if(Q)try{sessionStorage.setItem(lR,Q)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((Q)=>y8.has(Q)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var q9=()=>{try{return rR(sessionStorage.getItem(lR))??""}catch{return""}};function iX(Q,U,Z,K){let X=new URLSearchParams({token:U,home:q9()||B0}),W=L3()[Z];if(W)X.set("snapshot",JSON.stringify(W));window.location.replace(`${Q}${K??`${window.location.pathname}${window.location.search}`}#${X.toString()}`)}function V8(){return window.location.pathname.slice(q0.length).split("/").filter(Boolean).map((Q)=>{try{return decodeURIComponent(Q)}catch{return""}})}var jR=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,T6=(Q,U)=>Q&&U&&jR.test(Q)&&jR.test(U)?`${Q}/${U}`:"";function v0(Q){window.history.pushState(null,"",`${q0}/${Q.map(encodeURIComponent).join("/")}`),window.dispatchEvent(new PopStateEvent("popstate"))}function cX(Q,U){let Z=dX(L3()[Q]?.origin);if(Z&&Z!==B0){iX(Z,cR(Q),Q,`${q0}/${U.map(encodeURIComponent).join("/")}`);return}v0(U)}async function VR(){let[Q,U]=V8(),Z=T6(Q,U),K=Z?[Z]:bR;if(K.length===0){let X=await k8(`${B0}/-/ping`).catch(()=>null);K=X?.ok?(await X.json().catch(()=>({}))).worlds??[]:[]}K=K.filter((X)=>{let[W,z,...B]=X.split("/");return B.length===0&&T6(W,z)===X});for(let X of K){let W=await k8(`${B0}/-/${X}/session`,{method:"POST"}).catch(()=>null);if(!W)continue;let z=await W.json().catch(()=>({})),B=CJ(z.origin)?.origin;if(W.status===409&&B&&B!==B0)return window.location.replace(`${B}${q0}/${X}`),"moved";if(W.ok&&z.local)return{token:typeof z.token==="string"&&z.token?z.token:O6}}return null}function zV(){let[Q,U]=B1.useState(YV()),[Z,K]=B1.useState(!1),[X,W]=B1.useState(!1),[z,B]=B1.useState(""),[O,T]=B1.useState(null),[R,L]=B1.useState(null),[M,I]=B1.useState(V8());B1.useEffect(()=>{let x=()=>I(V8());return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]),B1.useEffect(()=>{let[x,d]=V8(),g=T6(x,d),[n,j]=g?g.split("/"):[],i=L3()[Q9];if(!Q9||!Q||!n||!j||!i?.made||i.parent!==`${n}/${j}`||T6(...Q9.split("/"))!==Q9)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}X0(Q,`/-/${n}/${j}/branches/${Q9}`,{method:"DELETE"}).catch(()=>null).then(()=>PJ(Q9))},[Q]);let f=B1.useCallback(async(x)=>{if(L(null),!x){let j=await VR();if(j==="moved")return;if(j){if(K(!0),j.token!==O6)fJ(j.token);U(j.token);return}T(null),W(!0);return}if(R6&&x===O6){let j=await VR();if(j==="moved")return;if(j)K(!0)}if(R6&&x===uR){let[j,i]=V8(),q1=T6(j,i),[Q1,Y1]=q1?q1.split("/"):[],L1=Q1&&Y1?await k8(`${B0}/-/${Q1}/${Y1}/session`,{method:"POST",headers:{"x-volter-pass":y8.get("pass")??""}}).catch(()=>null):null;if(!L1){L(`${B0} did not answer: no session was opened`),T(null);return}if(!L1.ok){L(`${await z5(L1)}. Open it again from the platform.`),T(null);return}hR((await L1.json().catch(()=>({}))).issuer),U(O6);return}if(R6&&x!==O6){let[j,i]=V8(),q1=T6(j,i),[Q1,Y1]=q1?q1.split("/"):[],L1=Q1&&Y1?await k8(`${B0}/-/${Q1}/${Y1}/session`,{method:"POST",headers:{"x-volter-token":x}}).catch(()=>null):null;if(!L1){L(`${B0} did not answer: no session was opened`),T(null);return}if(!L1.ok){let M1=await z5(L1);L(L1.status===401||L1.status===403?`That token does not open ${Q1}/${Y1}.`:L1.status===409?`${Q1}/${Y1}'s session lives at another origin: ${M1}`:`The World could not open a session (${L1.status}): ${M1}`),T(null);return}U(O6);return}let d=R6?new Response(null,{status:404}):await X0(x,"/-/worlds");if(d.ok){let{worlds:j}=await d.json();T({kind:"admin",worlds:j});return}if(d.status===429){L("You are asking faster than the platform allows — wait a moment and reload."),T(null);return}if(d.status>=500){let j=await d.json().catch(()=>({}));L(`The platform could not list your worlds${j.error?`: ${j.error}`:""}. Reload; if it stays, the status page says what is wrong.`),T(null);return}let g=bR;if(g.length===0){let j=await k8(`${B0}/-/ping`);if(!j.ok){L(`${B0} does not answer as a host`),T(null);return}if(g=(await j.json()).worlds??[],g.length===0){L(`${B0} does not list its worlds: open the console with the World's URL (volter world console <url>/<org>/<world>)`),T(null);return}}let n=[];for(let j of g){let i=await X0(x,`/-/${j}/twins`);if(i.ok){let q1=await i.json();n.push({name:j,base:`${w6}/${j}`,twins:(q1.twins??[]).map((Q1)=>({vendor:Q1.twin,protocol:Q1.protocol??null,root:Q1.root??null}))})}}if(n.length===0){L("This link or key opens no World here: it was revoked, or it has ended."),T(null);return}T({kind:"world",worlds:n})},[]);B1.useEffect(()=>{f(Q)},[Q,f]);let D=(x)=>O?.kind==="admin"?O.worlds.find((d)=>d.name===x)?.token??Q:Q,[V,k]=B1.useState("");if(!Q||!O&&!R)return H.jsxDEV("main",{children:[H.jsxDEV(rq,{href:`${q0}/`},void 0,!1,void 0,this),Q&&!O&&!R||!Q&&!X?H.jsxDEV("p",{children:"Opening…"},void 0,!1,void 0,this):H.jsxDEV("form",{onSubmit:(x)=>{x.preventDefault(),fJ(z.trim()),U(z.trim())},children:[H.jsxDEV("p",{children:"A host's admin token opens every world it serves; a world's token opens that world."},void 0,!1,void 0,this),H.jsxDEV("label",{children:["Token ",H.jsxDEV("input",{name:"token",type:"password",value:z,onChange:(x)=>B(x.target.value),autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",children:"Open"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);let h=()=>{if(Z){window.location.reload();return}if(R6){let[x,d]=V8(),g=T6(x,d),[n,j]=g?g.split("/"):[],i=()=>window.location.replace(o2()?`${o2()}/`:`${B0}${q0}/${n&&j?`${n}/${j}`:""}?signin`);if(setTimeout(i,2000),n&&j)k8(`${B0}/-/${n}/${j}/session/end`,{method:"POST"}).catch(()=>null).then(i);else i();return}if(O)for(let x of O.worlds)navigator.sendBeacon(`${x.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${x.name}/session/end`);fJ(""),U(""),B(""),T(null),v0([])};if(R||!O)return H.jsxDEV("main",{children:[H.jsxDEV(rq,{href:`${q0}/`},void 0,!1,void 0,this),H.jsxDEV("p",{role:"alert",children:R??"nothing answered"},void 0,!1,void 0,this),o2()?H.jsxDEV("a",{className:"button",href:`${o2()}/`,children:["Back to ",new URL(o2()).host]},void 0,!0,void 0,this):H.jsxDEV("button",{onClick:h,children:Z?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let[P,C,v,b,E]=M,p=v==="~",a=/^[A-Za-z0-9_-]+$/,m=p||!v||!a.test(v)?void 0:v,_1=E&&a.test(E)?E:void 0,$1=T6(P,C),J1=$1?L3()[$1]??null:null,y=(x)=>cR(x)||D(x),u=async(x)=>{let d=dX(x.parentOrigin);if(d&&d!==B0){PJ(x.name),window.location.assign(`${d}${q0}/${x.parent}#close=${encodeURIComponent(x.name)}`);return}if(x.made)await X0(D(x.parent),`/-/${x.parent}/branches/${x.name}`,{method:"DELETE"}).catch(()=>null),PJ(x.name);v0(x.parent.split("/"))};return H.jsxDEV("main",{className:$1?"app":void 0,children:[H.jsxDEV("header",{children:[$1?H.jsxDEV(IR,{},void 0,!1,void 0,this):null,H.jsxDEV(rq,{href:`${q9()&&q9()!==B0?q9():""}${q0}/`,onClick:(x)=>{if(q9()&&q9()!==B0)return;x.preventDefault(),v0([])}},void 0,!1,void 0,this),H.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[$1?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),H.jsxDEV("span",{children:$1.split("/")[0]},void 0,!1,void 0,this),H.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${$1}`,className:"crumb-world",onClick:(x)=>{x.preventDefault(),v0($1.split("/"))},children:$1.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,m?H.jsxDEV("span",{children:[" / ",m]},void 0,!0,void 0,this):null,p&&b==="trace"?H.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),o2()?H.jsxDEV("a",{href:`${o2()}/${$1?encodeURIComponent($1.split("/")[0]):""}`,title:`Back to the platform at ${new URL(o2()).host}`,className:"back-link",children:["← ",H.jsxDEV("span",{className:"back-text",children:$1?`${$1.split("/")[0]}'s Worlds`:new URL(o2()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV("span",{className:"mode",children:Z?"on this machine":J1?"a snapshot, read only":V?`signed in as ${V}`:O.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),Z?null:H.jsxDEV("button",{onClick:h,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$1?H.jsxDEV(MV,{name:$1,token:y($1),twin:m,tab:p?b??"overview":"overview",arg:p?_1:void 0,admin:J1?null:O.kind==="admin"?Q:null,snapshot:J1,onReturn:u,opens:(x)=>!!L3()[x]||O.kind==="admin"&&O.worlds.some((d)=>d.name===x),onRemoved:()=>{f(Q),v0([])},onWho:k},$1,!1,void 0,this):H.jsxDEV(BV,{mode:O,admin:O.kind==="admin"?Q:null,reload:()=>f(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BV({mode:Q,admin:U,reload:Z}){let[K,X]=B1.useState(""),[W,z]=B1.useState(""),[B,O]=B1.useState(""),[T,R]=B1.useState(null),L=async(V)=>{if(!await o5({title:`Rotate the tokens of ${V}?`,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 k=await X0(U,`/-/worlds/${V}/rotate`,{method:"POST"}),h=await k.json().catch(()=>({}));R(k.ok?`rotated ${V}: the new tokens are shown once — token ${h.token} · read token ${h.readToken}`:h.error??`answered ${k.status}`),await Z()},M=async(V)=>{let k=await X0(U,`/-/worlds/${V}`,{method:"DELETE"}),h=await k.json().catch(()=>({}));R(k.ok?`removed ${V}`:h.error??`answered ${k.status}`),await Z()},[I,f]=B1.useState(!1),D=async(V)=>{V.preventDefault(),R(null),f(!0);try{let k=await X0(U,"/-/worlds",{method:"POST",body:JSON.stringify({org:K,world:W,vendors:B.split(",").map((P)=>P.trim()).filter(Boolean)})}),h=await k.json();if(!k.ok){R(h.error??`the host answered ${k.status}`);return}R(`provisioned ${h.name}`),z(""),O(""),await Z()}finally{f(!1)}};return H.jsxDEV("section",{"aria-labelledby":"worlds",children:[H.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"lede",children:"A World is a copy of the services your app uses (Stripe, Slack, GitHub…), with none of the real consequences: your app talks to it, and you can see everything it did on each vendor's own screens."},void 0,!1,void 0,this),H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"world"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"address"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"stand-ins for"},void 0,!1,void 0,this),U?H.jsxDEV("th",{children:"actions"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:Q.worlds.map((V)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("a",{href:`${q0}/${V.name}`,onClick:(k)=>{k.preventDefault(),v0(V.name.split("/"))},children:V.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("code",{children:V.base},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:V.twins.map((k)=>F0(k.vendor)).join(", ")||"—"},void 0,!1,void 0,this),U?H.jsxDEV("td",{children:[H.jsxDEV("button",{type:"button","aria-label":`Rotate the tokens of ${V.name}`,onClick:()=>void L(V.name),children:"Rotate tokens"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{type:"button","aria-label":`Remove ${V.name}`,onClick:()=>void o5({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)M(V.name)}),children:"Remove world"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},V.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U?H.jsxDEV("form",{onSubmit:D,"aria-labelledby":"provision",children:[H.jsxDEV("h3",{id:"provision",children:"Provision a world"},void 0,!1,void 0,this),H.jsxDEV("label",{children:["Org ",H.jsxDEV("input",{name:"org",value:K,onChange:(V)=>X(V.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{children:["World ",H.jsxDEV("input",{name:"world",value:W,onChange:(V)=>z(V.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{children:["Twins ",H.jsxDEV("input",{name:"vendors",value:B,onChange:(V)=>O(V.target.value),placeholder:"github, slack",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",disabled:I,children:I?"Provisioning… (a host boots the world; ten seconds or so)":"Provision"},void 0,!1,void 0,this),T?H.jsxDEV("p",{role:"status",children:T},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):T?H.jsxDEV("p",{role:"status",children:T},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var gX=[["overview","Dashboard"],["branches","Branches"],["settings","Settings"],["branch","Overview"],["changes","Changes"],["changesets","Changesets"],["activity","Activity"],["vendors","Vendors"],["canvas","All screens"]],AV={dashboard:"overview",mirrors:"vendors",screens:"canvas",timeline:"activity",monitoring:"activity",trace:"activity",operations:"settings"},D8=(Q,U)=>`${w6}/${Q}/${U}/`,kR={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 n5(Q){let U=Q.operation??Q.op,Z=(U.includes(".")?U.slice(U.lastIndexOf(".")+1):U).toLowerCase(),K=Q.subject.type.replace(/[_-]+/g," ").trim(),X=`${K.charAt(0).toUpperCase()}${K.slice(1)}`,W=/(^|\.)twin\./.test(U)||/^seed_/.test(Z),z=U.replace(/[._]+/g," ").trim(),B=W?`${X} seeded`:kR[Z]?`${X} ${kR[Z]}`:`${z.charAt(0).toUpperCase()}${z.slice(1)}`,O=Q.fields??{},T=["title","name","email","text","subject","summary","description"].map((L)=>O[L]).find((L)=>typeof L==="string"&&L.trim()!=="")??null,R=T===null?null:T.replace(/<([@#!])[^|>]*\|([^>]+)>/g,(L,M,I)=>`${M==="!"?"@":M}${I}`).replace(/<(?:https?:[^|>]+)\|([^>]+)>/g,"$1").replace(/<(https?:[^>]+)>/g,"$1");return{what:B,label:R===null?null:R.length>80?`${R.slice(0,79)}…`:R}}var aq=(Q)=>/token|password|secret|key|credential/i.test(Q.subject.type)&&Q.subject.id.length>6?`••••${Q.subject.id.slice(-4)}`:Q.subject.id,oq=(Q,U)=>!Q.actor?"":Q.actor.kind==="system"?`by ${F0(U)}`:Q.actor.id?`by ${Q.actor.id}`:Q.actor.kind==="agent"||Q.actor.kind==="app"?"by your app":`by ${Q.actor.kind}`,LV=(Q)=>Q.operation==="observed"||Q.receipt||Q.provenance==="placeholder"?nq(Q):null;function MV({name:Q,token:U,twin:Z,tab:K,arg:X,admin:W,snapshot:z,onReturn:B,opens:O,onRemoved:T,onWho:R}){let[L,M]=B1.useState("pending"),[I,f]=B1.useState(null),[D,V]=B1.useState(0),[k,h]=B1.useState(null);B1.useEffect(()=>{let Q1=!0;return f(null),X0(U,`/-/${Q}/session`,{method:"POST"}).then(async(Y1)=>{let L1=await Y1.json().catch(()=>({}));if(hR(L1.issuer),L1.who)R?.(L1.who);h(typeof L1.signsAs==="string"?L1.signsAs:null);let M1=CJ(L1.origin)?.origin;if(Y1.status===409&&M1&&M1!==B0){iX(M1,U,Q);return}if(!Q1)return;if(M(!Y1.ok?"unknown":L1.scope==="read"?"read":L1.scope==="write"?"write":"unknown"),!Y1.ok)f(L1.error??`answered ${Y1.status}`)}).catch((Y1)=>{if(Q1)M("unknown"),f(`the World did not answer: ${Y1 instanceof Error?Y1.message:String(Y1)}`)}),()=>{Q1=!1}},[Q,U,D]);let P=I?{state:"error",error:I}:L==="pending"?{state:"pending"}:{state:"ok",scope:L},C=L==="write",v=(Q1)=>{if(Q1.status===403)M("read")},[b,E]=B1.useState(0);B1.useEffect(()=>{let Q1=setInterval(()=>{if(!document.hidden)E((Y1)=>Y1+1)},5000);return()=>clearInterval(Q1)},[]);let[p,a]=B1.useState(0),m=L5(U,`/-/${Q}/clock`,b+p),_1=L5(U,`/-/${Q}/twins`),$1=L5(U,`/-/${Q}/branches`,p),J1=L5(U,`/-/${Q}/map`,Math.floor(b/2)),y=!($1.state==="error"&&($1.status===404||$1.status===405));if(Z)return H.jsxDEV(cV,{name:Q,token:U,twin:Z},void 0,!1,void 0,this);let u=gX.some(([Q1])=>Q1===K)?K:AV[K]??"overview",x=_1.state==="ok"?_1.data.twins.map((Q1)=>Q1.twin):[],d=(Q1)=>J1.state==="ok"?(J1.data.twins.find((Y1)=>Y1.twin===Q1)?.resources??[]).reduce((Y1,L1)=>Y1+L1.count,0):0,g=u==="vendors"&&X?X:void 0,n=()=>{M("pending"),V((Q1)=>Q1+1)};if(u==="canvas"||u==="vendors"&&!g)return H.jsxDEV(bV,{name:Q,twins:_1,session:P,retry:n,snapshot:z,back:()=>v0(Q.split("/"))},void 0,!1,void 0,this);let j=g?F0(g):gX.find(([Q1])=>Q1===u)?.[1]??"",i=(Q1)=>(Y1)=>{Y1.preventDefault(),v0([...Q.split("/"),...Q1])},q1=(Q1,Y1=gX.find(([L1])=>L1===Q1)?.[1]??Q1)=>{let L1=u===Q1&&!g;return H.jsxDEV("a",{href:`${q0}/${Q}/~/${Q1}`,"aria-current":L1?"page":void 0,className:L1?"on":void 0,onClick:i(["~",Q1]),children:Y1},void 0,!1,void 0,this)};return H.jsxDEV("div",{className:"shell",children:[H.jsxDEV("aside",{className:"side",children:[H.jsxDEV("nav",{"aria-label":`${Q} pages`,className:"side-nav",children:[H.jsxDEV(TV,{name:Q},void 0,!1,void 0,this),H.jsxDEV("p",{className:"side-group",children:"World"},void 0,!1,void 0,this),q1("overview"),y?q1("branches"):null,q1("settings"),H.jsxDEV(RV,{name:Q,snapshot:z,branches:y?$1:null,opens:O},void 0,!1,void 0,this),H.jsxDEV("p",{className:"side-group",children:"Branch"},void 0,!1,void 0,this),q1("branch"),q1("changes"),q1("changesets"),q1("activity"),H.jsxDEV("p",{className:"side-group",children:"Vendors"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/canvas`,className:"all-screens",onClick:i(["~","canvas"]),children:[H.jsxDEV("span",{className:"mark","aria-hidden":"true",children:"▦"},void 0,!1,void 0,this),H.jsxDEV("span",{children:"All screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"side-vendors",children:x.map((Q1)=>H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${Q1}`,"aria-current":g===Q1?"page":void 0,className:g===Q1?"on":void 0,onClick:i(["~","vendors",Q1]),children:[H.jsxDEV(A5,{vendor:Q1},void 0,!1,void 0,this),H.jsxDEV("span",{children:F0(Q1)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"count",children:d(Q1)||""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Q1,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"side-foot",children:H.jsxDEV(MR,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"content",children:[z?H.jsxDEV("div",{className:"snapshot",role:"region","aria-label":"Snapshot",children:[H.jsxDEV("span",{children:["You are looking at ",H.jsxDEV("strong",{children:z.parent},void 0,!1,void 0,this)," as it was at ",H.jsxDEV(h0,{iso:z.at},void 0,!1,void 0,this)," · a read-only copy (read-only snapshot) · ",z.expiresAt?Date.parse(z.expiresAt)<=Date.now()?H.jsxDEV(H.Fragment,{children:["gone since ",H.jsxDEV(h0,{iso:z.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:["goes away ",H.jsxDEV(h0,{iso:z.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"kept until you go back"]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"button",onClick:()=>void B(z),children:"Return to live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV("div",{className:"content-head",children:[H.jsxDEV("h2",{id:"world",children:[g?H.jsxDEV("span",{className:"vendor-cell",children:[H.jsxDEV(A5,{vendor:g},void 0,!1,void 0,this),j]},void 0,!0,void 0,this):j,L==="read"?H.jsxDEV(H.Fragment,{children:[" ",H.jsxDEV("span",{className:"badge read-only",title:"This token reads the World; it changes nothing",children:"Read only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"head-actions",children:[H.jsxDEV(IV,{name:Q,token:U,clock:m,canWrite:C&&!z,onChanged:()=>a((Q1)=>Q1+1),refused:v},void 0,!1,void 0,this),!z&&C&&y&&$1.state!=="loading"?H.jsxDEV(fV,{name:Q,token:U,clock:m,refused:v},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{role:"region","aria-labelledby":"world",className:"panel",children:[u==="overview"?H.jsxDEV(wV,{name:Q,token:U,map:J1,vendors:x,twins:_1,session:P,branches:y?$1:null,canWrite:C&&!z,tick:b,...z?{snapshotOf:z.parent}:{}},void 0,!1,void 0,this):null,u==="branch"?H.jsxDEV(OV,{name:Q,token:U,map:J1,vendors:x,tick:b},void 0,!1,void 0,this):null,u==="vendors"?H.jsxDEV(CV,{name:Q,token:U,twins:_1,session:P,retry:n,selected:g},void 0,!1,void 0,this):null,u==="activity"&&K==="trace"?H.jsxDEV(yV,{name:Q,token:U,id:X??""},void 0,!1,void 0,this):null,u==="activity"&&K!=="trace"?H.jsxDEV(DV,{name:Q,token:U,vendors:x},void 0,!1,void 0,this):null,u==="changes"?H.jsxDEV(mV,{name:Q,token:U},void 0,!1,void 0,this):null,u==="changesets"?H.jsxDEV(xV,{name:Q,token:U,signsAs:k,canWrite:C&&!z,rooted:J1.state==="ok"?J1.data.twins.filter((Q1)=>Q1.root).map((Q1)=>Q1.twin):[],...X?{open:X}:{},refused:v},void 0,!1,void 0,this):null,u==="branches"?H.jsxDEV(PV,{name:Q,token:U,canWrite:C,branches:y?$1:null,opens:O,onBranchesChanged:()=>a((Q1)=>Q1+1),refused:v},void 0,!1,void 0,this):null,u==="settings"?H.jsxDEV(pV,{name:Q,token:U,admin:W,canWrite:C,refused:v,onRemoved:T},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function DR({text:Q}){return H.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(Q).then(()=>t2("Copied the prompt: paste it into your coding agent"),()=>t2("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}function TV({name:Q}){return H.jsxDEV("details",{className:"menu connect-side",children:[H.jsxDEV("summary",{className:"button connect-button",children:"Connect"},void 0,!1,void 0,this),o2()?H.jsxDEV("div",{className:"popover",children:[H.jsxDEV("p",{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),H.jsxDEV("pre",{children:[w6,"/",Q,"/<vendor>"]},void 0,!0,void 0,this),H.jsxDEV("a",{className:"button",href:`${o2()}/${encodeURIComponent(Q.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["Or push a World from your machine: ",H.jsxDEV("code",{children:["volter remote add origin ",Q]},void 0,!0,void 0,this),", then ",H.jsxDEV("code",{children:"volter world push"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),H.jsxDEV(DR,{text:mX({platform:o2(),world:Q})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("div",{className:"popover",children:[H.jsxDEV("p",{children:"Run your app in this World; its calls to these vendors land here:"},void 0,!1,void 0,this),H.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["Or point an SDK at ",H.jsxDEV("code",{children:[w6,"/",Q,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",H.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),H.jsxDEV(DR,{text:mX()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RV({name:Q,snapshot:U,branches:Z,opens:K}){let X=(B)=>B.split("/").pop()??B,W=U?.parent??Q,z=Z?.state==="ok"?Z.data.branches.filter((B)=>B.name!==Q):[];return H.jsxDEV("details",{className:"menu branch-picker",children:[H.jsxDEV("summary",{children:[H.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:H.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),H.jsxDEV("span",{className:"branch-name",children:U?X(Q):Z?.state==="ok"&&Z.data.checkedOut||X(W)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"badge",children:U?"snapshot":"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"popover",children:[H.jsxDEV("p",{className:"mode",children:"Branch"},void 0,!1,void 0,this),H.jsxDEV("ul",{className:"branch-list",children:[H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${W}`,"aria-current":!U?"page":void 0,onClick:(B)=>{B.preventDefault(),v0(W.split("/"))},children:[X(W)," ",H.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),U?H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${Q}`,"aria-current":"page",onClick:(B)=>B.preventDefault(),children:[X(Q)," ",H.jsxDEV("span",{className:"mode",children:["as of ",H.jsxDEV(h0,{iso:U.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,z.map((B)=>H.jsxDEV("li",{children:K(B.name)?H.jsxDEV("a",{href:`${q0}/${B.name}`,onClick:(O)=>{O.preventDefault(),cX(B.name,B.name.split("/"))},children:[X(B.name)," ",H.jsxDEV("span",{className:"mode",children:B.at?.instant?H.jsxDEV(H.Fragment,{children:["as of ",H.jsxDEV(h0,{iso:B.at.instant},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("span",{className:"mode",title:"Its token was handed to whoever made it",children:X(B.name)},void 0,!1,void 0,this)},B.name,!1,void 0,this))]},void 0,!0,void 0,this),Z?.state==="ok"&&(Z.data.named?.length??0)>1?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:"This World's branches"},void 0,!1,void 0,this),H.jsxDEV("ul",{className:"branch-list",children:Z.data.named.map((B)=>H.jsxDEV("li",{children:H.jsxDEV("span",{"aria-current":B.name===Z.data.checkedOut?"true":void 0,children:[B.name," ",H.jsxDEV("span",{className:"mode",children:B.name===Z.data.checkedOut?"served here":H.jsxDEV("code",{children:["volter world checkout ",B.name]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},B.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z?.state==="ok"&&z.length===0&&!U&&(Z.data.named?.length??0)<=1?H.jsxDEV("p",{className:"mode",children:"No branches yet. “View an earlier moment…” opens one."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function OV({name:Q,token:U,map:Z,vendors:K,tick:X}){let W=L5(U,`/-/${Q}/timeline?limit=500`,Math.floor(X/3)),z=Z.state==="ok"?Z.data.twins:[],B=(P)=>(C)=>{C.preventDefault(),v0([...Q.split("/"),...P])},O=Date.now(),T=24,R=3600000,L=W.state==="ok"?W.data.entries:[],M=K.map((P)=>{let C=Array(24).fill(0);for(let v of L){if(v.twin!==P)continue;let b=Date.parse(v.entry.occurredAt),E=23-Math.floor((O-b)/3600000);if(E>=0&&E<24)C[E]+=1}return{vendor:P,counts:C}}),I=Array(24).fill(0).map((P,C)=>M.reduce((v,b)=>v+b.counts[C],0)),f=Math.max(1,...I),D=720,V=160,k=30,h=["var(--volter-data-base)","#7c5cff","#e3572b","#1f9d6b","#d9a400","#2b7de3","#c2417e","#6b7280","#0ea5a4"];return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("div",{className:"block",children:H.jsxDEV("table",{className:"dense services","aria-label":"Vendors on this branch",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Details"},void 0,!1,void 0,this),H.jsxDEV("th",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:K.map((P)=>{let C=z.find((b)=>b.twin===P),v=[...C?.resources??[]].filter((b)=>b.count>0).sort((b,E)=>E.count-b.count);return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("span",{className:"vendor-cell",children:[H.jsxDEV(A5,{vendor:P},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${P}`,onClick:B(["~","vendors",P]),children:F0(P)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:C?.root?"badge rooted":"badge",children:C?.root?"connected":"stand-in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:v.length?v.slice(0,4).map((b)=>J9(b.count,b.type)).join(" · "):"nothing yet"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num",children:C?.mirror?H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${P}`,onClick:B(["~","vendors",P]),children:"Screens"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},P,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("div",{className:"block chart-block",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{children:"Activity, last 24 hours"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/activity`,onClick:B(["~","activity"]),children:"All activity"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV(B5,{load:W,what:"the activity"},void 0,!1,void 0,this),W.state==="ok"?H.jsxDEV("div",{className:"pad",children:[H.jsxDEV("svg",{viewBox:"0 0 720 182",className:"chart",role:"img","aria-label":`Writes per hour over the last day: ${I.reduce((P,C)=>P+C,0)} in all`,children:[[0.5,1].map((P)=>H.jsxDEV("line",{x1:0,x2:720,y1:160-P*160,y2:160-P*160,className:"grid"},P,!1,void 0,this)),H.jsxDEV("line",{x1:0,x2:720,y1:160,y2:160,className:"axis"},void 0,!1,void 0,this),I.map((P,C)=>{let v=160;return H.jsxDEV("g",{children:M.map((b,E)=>{let p=b.counts[C]/f*152;if(p===0)return null;return v-=p,H.jsxDEV("rect",{x:C*30+2,y:v,width:26,height:p,fill:h[E%h.length],rx:2,children:H.jsxDEV("title",{children:`${F0(b.vendor)}: ${b.counts[C]} in the hour ${23-C===0?"now":`${23-C}h ago`}`},void 0,!1,void 0,this)},b.vendor,!1,void 0,this)})},C,!1,void 0,this)}),[0,6,12,18,23].map((P)=>H.jsxDEV("text",{x:P*30+15,y:176,className:"tick",children:23-P===0?"now":`-${23-P}h`},P,!1,void 0,this))]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"legend",children:M.filter((P)=>P.counts.some((C)=>C>0)).map((P)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{className:"swatch",style:{background:h[K.indexOf(P.vendor)%h.length]}},void 0,!1,void 0,this),F0(P.vendor)," ",H.jsxDEV("span",{className:"mode",children:P.counts.reduce((C,v)=>C+v,0)},void 0,!1,void 0,this)]},P.vendor,!0,void 0,this))},void 0,!1,void 0,this),I.every((P)=>P===0)?H.jsxDEV("p",{className:"mode",children:"Nothing was written in the last day. Run your app in this World and its calls show up here."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var pX=0.2;function wV({name:Q,token:U,map:Z,vendors:K,twins:X,session:W,branches:z,canWrite:B,tick:O,snapshotOf:T}){let R=L5(U,`/-/${Q}/diff`,Math.floor(O/2)),L=L5(U,`/-/${Q}/timeline?limit=8`,O),M=Z.state==="ok"?Z.data.twins:[],I=L.state==="ok"?L.data.entries:[],f=X.state==="ok"?X.data.twins.filter((P)=>P.mirror).map((P)=>P.twin):[],D=(P)=>(C)=>{C.preventDefault(),v0([...Q.split("/"),...P])},V=(P)=>{let C=[...M.find((v)=>v.twin===P)?.resources??[]].filter((v)=>v.count>0).sort((v,b)=>b.count-v.count);return C.length?C.slice(0,2).map((v)=>J9(v.count,v.type)).join(" · "):"empty"},k=R.state==="ok"?R.data.changes.length:null,h=z?.state==="ok"?z.data.branches:[];return H.jsxDEV("div",{className:"dash",children:[H.jsxDEV("section",{className:"block dash-screens","aria-labelledby":"screens-head",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{id:"screens-head",children:["Screens ",H.jsxDEV("span",{className:"badge live",children:"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"mode",children:[K.length," vendor",K.length===1?"":"s",k!==null?H.jsxDEV(H.Fragment,{children:[" · ",H.jsxDEV("a",{href:`${q0}/${Q}/~/changes`,onClick:D(["~","changes"]),children:[k," change",k===1?"":"s"," since start"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("a",{className:"button",href:`${q0}/${Q}/~/canvas`,onClick:D(["~","canvas"]),children:"Open all screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.state==="ok"?H.jsxDEV("ul",{className:"thumbs",children:K.map((P)=>H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${P}`,onClick:D(["~","vendors",P]),"aria-label":`${F0(P)}'s screens`,children:[H.jsxDEV("span",{className:"thumb",children:[f.includes(P)?H.jsxDEV("iframe",{title:`${F0(P)} preview`,src:D8(Q,P),loading:"lazy",tabIndex:-1,style:{width:`${100/pX}%`,height:`${100/pX}%`,transform:`scale(${pX})`}},void 0,!1,void 0,this):H.jsxDEV("span",{className:"thumb-none",children:"No screens"},void 0,!1,void 0,this),H.jsxDEV("span",{className:M.find((C)=>C.twin===P)?.root?"badge rooted thumb-status":"badge thumb-status",children:M.find((C)=>C.twin===P)?.root?"connected":"stand-in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"thumb-foot",children:[H.jsxDEV(A5,{vendor:P},void 0,!1,void 0,this),H.jsxDEV("b",{children:F0(P)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:V(P)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},P,!1,void 0,this))},void 0,!1,void 0,this):H.jsxDEV("p",{className:"mode pad",children:W.state==="error"?`The World did not open its screens: ${W.error}`:"Opening…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"dash-side",children:z?H.jsxDEV("section",{className:"block","aria-labelledby":"branches-head",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{id:"branches-head",children:"Branches"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/branches`,onClick:D(["~","branches"]),children:"All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"mini-feed",children:[H.jsxDEV("li",{children:[H.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:H.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),H.jsxDEV("span",{className:"mini-what",children:T?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("b",{children:Q.split("/")[1]},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"badge",children:"snapshot"},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:["of ",T.split("/")[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:[H.jsxDEV("b",{children:Q.split("/")[1]},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"badge",children:"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h.slice(0,3).map((P)=>H.jsxDEV("li",{children:[H.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:H.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),H.jsxDEV("span",{className:"mini-what",children:[P.name.split("/").pop()," ",H.jsxDEV("span",{className:"mode",children:P.at?.instant?`as of ${new Date(P.at.instant).toLocaleString()}`:"copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},P.name,!0,void 0,this))]},void 0,!0,void 0,this),B?H.jsxDEV("p",{className:"mode pad",children:"“View an earlier moment…” above opens a branch as the World was then."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),H.jsxDEV("section",{className:"block dash-activity","aria-labelledby":"activity-head",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{id:"activity-head",children:"Recent activity"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/activity`,onClick:D(["~","activity"]),children:"View all"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV(B5,{load:L,what:"the activity"},void 0,!1,void 0,this),L.state==="ok"&&I.length===0?H.jsxDEV("div",{className:"empty-block",children:[H.jsxDEV("strong",{children:"No activity yet"},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:"Run your app in this World and its calls show up here."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("ul",{className:"mini-feed",children:I.map((P)=>{let C=n5(P.entry);return H.jsxDEV("li",{children:[H.jsxDEV(A5,{vendor:P.twin},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mini-what",children:[H.jsxDEV("strong",{children:C.what},void 0,!1,void 0,this),C.label?H.jsxDEV("span",{className:"mode",children:[" ",C.label]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"mode num",title:P.entry.occurredAt,children:dq(P.entry.occurredAt)},void 0,!1,void 0,this)]},E4(P),!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function IV({name:Q,token:U,clock:Z,canWrite:K,onChanged:X,refused:W}){let[z,B]=B1.useState(!1),[O,T]=B1.useState(""),[R,L]=B1.useState(""),[M,I]=B1.useState(null),[f,D]=B1.useState(!1),V=Z.state==="ok"?Z.data:null,k=async(v,b,E)=>{D(!0),I(null);try{let p=await X0(U,`/-/${Q}/${b}`,{method:b==="clock"?"PUT":"POST",body:JSON.stringify(E)});if(!p.ok){W(p),I({ok:!1,text:await z5(p)});return}let a=await p.json();I({ok:!0,text:`${v} — the World is at ${new Date(a.at).toLocaleString()}`}),B(!1),X()}catch(p){I({ok:!1,text:`the World did not answer: ${p instanceof Error?p.message:String(p)}`})}finally{D(!1)}},h=(v)=>{v.preventDefault();let b=new Date(O);if(Number.isNaN(b.getTime())){I({ok:!1,text:"Pick a date and time."});return}if(V&&b.getTime()<Date.parse(V.at)){I({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(V.at).toLocaleString()}.`});return}k("Clock set","clock",{at:b.toISOString()})},P=(v,b)=>{k(`Advanced ${b}`,"clock/advance",{by:v})},C=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return H.jsxDEV("div",{className:`clock${V?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[H.jsxDEV("p",{className:"clock-now",children:Z.state==="loading"?H.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):Z.state==="error"?H.jsxDEV("span",{className:"mode",children:["Clock: ",Z.error]},void 0,!0,void 0,this):V.frozen?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",H.jsxDEV("strong",{children:H.jsxDEV(h0,{iso:V.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:["World time ",H.jsxDEV("strong",{children:H.jsxDEV(h0,{iso:V.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",H.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),K&&V?H.jsxDEV("details",{className:"clock-more",children:[H.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),H.jsxDEV("div",{className:"popover",children:[H.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, use “View an earlier moment…”."},void 0,!1,void 0,this),H.jsxDEV("div",{className:"clock-controls",children:[H.jsxDEV("button",{type:"button","aria-expanded":z,onClick:()=>{B(!z),T(U9(SR(V.at))),I(null)},children:"Set time…"},void 0,!1,void 0,this),H.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[H.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),C.map(([v,b])=>H.jsxDEV("button",{type:"button","aria-label":`Advance ${b}`,disabled:f||!V.frozen,title:V.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>P(v,b),children:b},v,!1,void 0,this)),H.jsxDEV("form",{className:"inline",onSubmit:(v)=>{if(v.preventDefault(),!/^\d+[smhd]$/.test(R.trim())){I({ok:!1,text:"Advance by a number and a unit: 90m, 12h, 3d."});return}P(R.trim(),`by ${R.trim()}`)},children:[H.jsxDEV("label",{className:"sr",children:["Advance by ",H.jsxDEV("input",{name:"advanceBy",value:R,onChange:(v)=>L(v.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!V.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",disabled:f||!V.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!V.frozen?H.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,z?H.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:h,noValidate:!0,children:[H.jsxDEV("label",{children:["World time ",H.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:O,min:U9(SR(V.at)),onChange:(v)=>T(v.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",disabled:f,children:"Set time"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"button",onClick:()=>B(!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,M?H.jsxDEV("p",{role:M.ok?"status":"alert",children:M.text},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function fV({name:Q,token:U,clock:Z,refused:K}){let[X,W]=B1.useState(!1),[z,B]=B1.useState(""),[O,T]=B1.useState(null),[R,L]=B1.useState(!1),M=Z.state==="ok"?Z.data.at:new Date().toISOString(),I=B1.useRef(null);return B1.useEffect(()=>{if(!X)return;let D=(k)=>{if(k.key==="Escape"&&!document.querySelector("dialog[open]"))W(!1),I.current?.querySelector("button")?.focus()},V=(k)=>{if(!I.current?.contains(k.target))W(!1)};return document.addEventListener("keydown",D),document.addEventListener("click",V),()=>{document.removeEventListener("keydown",D),document.removeEventListener("click",V)}},[X]),H.jsxDEV("div",{className:"as-of",ref:I,children:[H.jsxDEV("button",{type:"button","aria-expanded":X,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{W(!X),B(U9(M)),T(null)},children:"View an earlier moment…"},void 0,!1,void 0,this),X?H.jsxDEV("form",{className:"inline","aria-label":"View the World as of a past moment",onSubmit:async(D)=>{D.preventDefault(),T(null);let V=new Date(z);if(Number.isNaN(V.getTime())){T("Pick a date and time.");return}if(V.getTime()>Date.parse(M)){T(`That is after the World's present (${new Date(M).toLocaleString()}); a snapshot looks back.`);return}L(!0);try{let k=await X0(U,`/-/${Q}/branches`,{method:"POST",body:JSON.stringify({at:{instant:V.toISOString()},ttl:3600})});if(!k.ok){K(k),T(await z5(k));return}let h=await k.json();rX({name:h.name,parent:Q,token:h.token,readToken:h.readToken,at:V.toISOString(),expiresAt:h.expiresAt??null,parentOrigin:B0,made:!0});let P=CJ(h.origin)?.origin;if(P&&P!==B0){iX(P,h.readToken,h.name,`${q0}/${h.name}`);return}v0(h.name.split("/"))}catch(k){T(`the World did not answer: ${k instanceof Error?k.message:String(k)}`)}finally{L(!1)}},noValidate:!0,children:[H.jsxDEV("label",{children:["As of ",H.jsxDEV("input",{name:"asOf",type:"datetime-local",value:z,max:U9(M),onChange:(D)=>B(D.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",disabled:R,children:R?"Opening…":"Open snapshot"},void 0,!1,void 0,this),H.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,O?H.jsxDEV("p",{role:"alert",children:O},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function PV({name:Q,token:U,canWrite:Z,branches:K,opens:X,onBranchesChanged:W,refused:z}){let B=L5(U,`/-/${Q}/map`),[O,T]=B1.useState(null),R=async(M)=>{if(!await o5({title:`Delete the branch ${M}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Delete branch",danger:!0}))return;let I=await X0(U,`/-/${Q}/branches/${M}`,{method:"DELETE"}).catch((f)=>f);if(I instanceof Error){T(`delete ${M}: the World did not answer (${I.message})`);return}if(!I.ok){z(I),T(`delete ${M}: ${await z5(I)}`);return}PJ(M),T(`deleted ${M}`),W()},L=B.state==="ok"?B.data.twins.reduce((M,I)=>M+I.resources.reduce((f,D)=>f+D.count,0),0):0;if(K)return H.jsxDEV(NV,{name:Q,token:U,canWrite:Z,branches:K,opens:X,note:O,remove:R,onChanged:W,refused:z},void 0,!1,void 0,this);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("h3",{children:"Map"},void 0,!1,void 0,this),H.jsxDEV(B5,{load:B,what:"the World's map"},void 0,!1,void 0,this),B.state==="ok"?B.data.twins.length===0?H.jsxDEV("p",{children:"This World holds no twins."},void 0,!1,void 0,this):H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:[B.data.twins.length," twin",B.data.twins.length===1?"":"s"," · ",L," resource",L===1?"":"s"]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"map","aria-label":"Twins in this World",children:B.data.twins.map((M)=>{let I=[...M.resources].sort((f,D)=>D.count-f.count);return H.jsxDEV("li",{className:"card","aria-labelledby":`map-${M.twin}`,children:[H.jsxDEV("div",{className:"card-head",children:[H.jsxDEV("h4",{id:`map-${M.twin}`,className:"vendor",children:M.twin},void 0,!1,void 0,this),H.jsxDEV("span",{className:M.root?"badge rooted":"badge",children:M.root?"rooted":"simulated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"mode",children:[M.root?H.jsxDEV(H.Fragment,{children:["rooted at ",H.jsxDEV("code",{children:M.root.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"simulated — no vendor behind it"," · position ",M.position]},void 0,!0,void 0,this),I.length===0?H.jsxDEV("p",{className:"mode",children:"Holds nothing yet."},void 0,!1,void 0,this):H.jsxDEV("ul",{className:"resources",children:[I.slice(0,6).map((f)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{children:f.type},void 0,!1,void 0,this)," ",H.jsxDEV("strong",{children:f.count},void 0,!1,void 0,this)]},f.type,!0,void 0,this)),I.length>6?H.jsxDEV("li",{className:"mode",children:["+",I.length-6," more types"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"card-actions",children:[M.mirror?H.jsxDEV("a",{className:"button",href:D8(Q,M.twin),target:"_blank",rel:"noopener noreferrer",children:["Open ",M.twin]},void 0,!0,void 0,this):H.jsxDEV("span",{className:"mode",children:"no mirror"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/${M.twin}`,"aria-label":`Log and tree of ${M.twin}`,onClick:(f)=>{f.preventDefault(),v0([...Q.split("/"),M.twin])},children:"Log & tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},M.twin,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function NV({name:Q,token:U,canWrite:Z,branches:K,opens:X,note:W,remove:z,onChanged:B,refused:O}){let T=(g)=>g.split("/").pop()??g,R=K.state==="ok"?K.data.branches:[],[L,M]=B1.useState(!1),[I,f]=B1.useState(!1),[D,V]=B1.useState(null),[k,h]=B1.useState(""),[P,C]=B1.useState("now"),[v,b]=B1.useState(""),[E,p]=B1.useState("24"),[a,m]=B1.useState(null),[_1,$1]=B1.useState(null),J1=async(g)=>{m(g),$1(null);let n=await X0(U,`/-/${Q}/branches/${encodeURIComponent(g)}/serve`,{method:"POST"}).catch(()=>null);if(n?.ok){location.reload();return}m(null),$1(n?(await n.json().catch(()=>null))?.error??`${n.status}`:`${B0} did not answer`)},y=async(g,n)=>{let j=await X0(U,`/-/${Q}/branches`,{method:"POST",body:JSON.stringify(g)}).catch(()=>null);if(!j)return`${B0} did not answer`;if(!j.ok)return O(j),await z5(j);let i=await j.json();return rX({name:i.name,parent:Q,token:i.token??"",readToken:i.readToken,at:n,expiresAt:i.expiresAt??null,parentOrigin:B0,...i.origin?{origin:i.origin}:{}}),i},u=async(g)=>{g.preventDefault(),V(null);let n=P==="at"?new Date(v):null;if(n&&Number.isNaN(n.getTime())){V("Pick a date and time, or make it as of now.");return}if(n&&n.getTime()>Date.now()){V("A branch is made as of now or a moment before it.");return}let j=Math.round(Number(E)*3600);f(!0);let i=await y({ttl:j,...n?{at:{instant:n.toISOString()}}:{live:!0},...k.trim()?{label:k.trim()}:{}},(n??new Date).toISOString());if(f(!1),typeof i==="string"){V(i);return}M(!1),h(""),t2(`Made ${T(i.name)}`),B()},x=async(g)=>{if(!await o5({title:`Reset ${T(g.name)} to ${T(Q)}?`,body:`A fresh copy of ${T(Q)} as it is now replaces it, with the same label and the time it had left; what was written to it goes. The copy has a new address and new keys: an app, a CI job or a pull request's preview that holds this branch's must be given the new one.`,action:"Reset branch",danger:!0}))return;let n=g.expiresAt?Math.max(3600,Math.round((Date.parse(g.expiresAt)-Date.now())/1000)):86400,j=T(g.name).startsWith(`${T(Q)}-`)?T(g.name).slice(T(Q).length+1):"",i=/^([a-z0-9][a-z0-9-]*)-[0-9a-f]{4}$/.exec(j)?.[1],q1=await y({ttl:n,live:!0,...i&&!i.startsWith("at-")?{label:i}:{}},new Date().toISOString());if(typeof q1==="string"){t2(`Reset ${T(g.name)}: ${q1}`,"error");return}let Q1=await X0(U,`/-/${Q}/branches/${g.name}`,{method:"DELETE"}).catch(()=>null);if(Q1?.ok)PJ(g.name);t2(Q1?.ok?`Reset: ${T(q1.name)} is ${T(Q)} as it is now`:`Made ${T(q1.name)}; ${T(g.name)} was not removed`),B()},d=(g)=>[...X(g.name)?[{label:"Compare with parent",onSelect:()=>cX(g.name,[...g.name.split("/"),"~","changes"])}]:[],...Z?[{label:"Reset to parent…",onSelect:()=>void x(g)},{label:"Delete…",danger:!0,onSelect:()=>void z(g.name)}]:[]];return H.jsxDEV("div",{"aria-labelledby":"branches",children:[H.jsxDEV("div",{className:"branches-head",children:[H.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",H.jsxDEV("b",{children:T(Q)},void 0,!1,void 0,this),". A branch made here opens read-only in this tab; its parent removes it."]},void 0,!0,void 0,this),Z?H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{V(null),b(U9(new Date().toISOString())),M(!0)},children:"New branch"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),W?H.jsxDEV("p",{role:"status",children:W},void 0,!1,void 0,this):null,H.jsxDEV(B5,{load:K,what:"the branches"},void 0,!1,void 0,this),K.state==="ok"?H.jsxDEV("div",{className:"block",children:[H.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this),H.jsxDEV("th",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:[H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:[H.jsxDEV("b",{children:K.data.checkedOut??T(Q)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"badge",children:K.data.checkedOut?"served here":"default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this),H.jsxDEV("td",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.map((g)=>{let n=d(g);return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("b",{children:T(g.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:T(Q)},void 0,!1,void 0,this),H.jsxDEV("td",{children:g.at?.instant?H.jsxDEV(h0,{iso:g.at.instant},void 0,!1,void 0,this):"when it was made"},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV(h0,{iso:g.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:g.expiresAt?H.jsxDEV(h0,{iso:g.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num row-actions",children:[X(g.name)?H.jsxDEV("button",{type:"button","aria-label":`Open ${g.name}`,onClick:()=>cX(g.name,g.name.split("/")),children:"Open"},void 0,!1,void 0,this):H.jsxDEV("span",{className:"mode",title:"Its token was handed to whoever made it",children:"opened by whoever made it"},void 0,!1,void 0,this),n.length?H.jsxDEV(xX,{label:`More for ${T(g.name)}`,items:n},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},g.name,!0,void 0,this)})]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.length===0?H.jsxDEV("p",{className:"mode pad",children:"No snapshots yet."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,K.state==="ok"&&(K.data.named?.length??0)>0?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"lede",children:["This World's own branches (",H.jsxDEV("code",{children:"volter world branch"},void 0,!1,void 0,this),"). One runs at a time; “Serve here” stops this one's twins and serves that one in its place."]},void 0,!0,void 0,this),_1?H.jsxDEV("p",{role:"alert",children:_1},void 0,!1,void 0,this):null,H.jsxDEV("div",{className:"block",children:H.jsxDEV("table",{className:"dense","aria-label":"World branches",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Branch"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"State"},void 0,!1,void 0,this),H.jsxDEV("th",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:K.data.named.map((g)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:[H.jsxDEV("b",{children:g.name},void 0,!1,void 0,this),g.name===K.data.checkedOut?H.jsxDEV(H.Fragment,{children:[" ",H.jsxDEV("span",{className:"badge",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("td",{className:"mode",children:g.running?"running":"stopped"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num row-actions",children:Z&&g.name!==K.data.checkedOut?H.jsxDEV("button",{type:"button",disabled:a!==null,onClick:()=>void J1(g.name),children:a===g.name?"Switching…":"Serve here"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},g.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV(S8,{open:L,onClose:()=>{if(!I)M(!1)},title:`New branch of ${T(Q)}`,footer:H.jsxDEV(H.Fragment,{children:[H.jsxDEV("button",{type:"button",onClick:()=>M(!1),disabled:I,children:"Cancel"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",form:"new-branch",className:"primary",disabled:I,children:I?"Making…":"Make branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:H.jsxDEV("form",{id:"new-branch",onSubmit:(g)=>void u(g),className:"stack",children:[H.jsxDEV("label",{children:[H.jsxDEV("span",{children:["Name ",H.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("input",{name:"branchLabel",value:k,onChange:(g)=>h(g.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),H.jsxDEV("fieldset",{className:"choice",children:[H.jsxDEV("legend",{children:"As of"},void 0,!1,void 0,this),H.jsxDEV("label",{className:"check",children:[H.jsxDEV("input",{type:"radio",name:"branchWhen",checked:P==="now",onChange:()=>C("now")},void 0,!1,void 0,this)," ",H.jsxDEV("span",{children:"Now: the World as it is, its clock running on"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{className:"check",children:[H.jsxDEV("input",{type:"radio",name:"branchWhen",checked:P==="at",onChange:()=>C("at")},void 0,!1,void 0,this)," ",H.jsxDEV("span",{children:"A moment before now: the World as it was then, its clock stopped there"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P==="at"?H.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:v,max:U9(new Date().toISOString()),onChange:(g)=>b(g.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("label",{children:[H.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),H.jsxDEV("select",{name:"branchLife",value:E,onChange:(g)=>p(g.target.value),children:[H.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),H.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),H.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),H.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),D?H.jsxDEV("p",{role:"alert",children:D},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)}function CV({name:Q,token:U,twins:Z,session:K,retry:X,selected:W}){let z=L5(U,`/-/${Q}/map`),B=Z.state==="ok"?Z.data.twins:[],O=(L)=>{let M=z.state==="ok"?z.data.twins.find((f)=>f.twin===L):void 0;if(!M)return"";let I=[...M.resources].filter((f)=>f.count>0).sort((f,D)=>D.count-f.count);return I.length===0?"nothing yet":I.slice(0,3).map((f)=>J9(f.count,f.type)).join(" · ")+(I.length>3?" · …":"")},T=(L)=>z.state==="ok"?z.data.twins.find((M)=>M.twin===L)?.root?.url??null:null,R=B.find((L)=>L.twin===W);if(!R)return Z.state==="ok"?H.jsxDEV("p",{className:"mode",children:["This World has no vendor named ",W,". ",H.jsxDEV("a",{href:`${q0}/${Q}/~/canvas`,onClick:(L)=>{L.preventDefault(),v0([...Q.split("/"),"~","canvas"])},children:"All screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(B5,{load:Z,what:"the vendors"},void 0,!1,void 0,this);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV(B5,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"&&B.length===0?H.jsxDEV("p",{children:"No vendors in this World yet."},void 0,!1,void 0,this):null,R?H.jsxDEV("div",{className:"vendors",children:H.jsxDEV("div",{className:"stage",children:[H.jsxDEV("div",{className:"stage-bar",children:[H.jsxDEV(A5,{vendor:R.twin},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:[O(R.twin)||"empty",T(R.twin)?` · connected to ${T(R.twin)}`:" · stand-in"]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"stage-actions",children:[B.filter((L)=>L.mirror).length>1?H.jsxDEV("a",{className:"button",href:`${q0}/${Q}/~/vendors`,onClick:(L)=>{L.preventDefault(),v0([...Q.split("/"),"~","vendors"])},children:"All vendors"},void 0,!1,void 0,this):null,R.mirror?H.jsxDEV("a",{className:"button",href:D8(Q,R.twin),target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${F0(R.twin)} in a new tab`,children:"Open in new tab ↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K.state==="ok"&&K.scope==="read"?H.jsxDEV("p",{className:"mode stage-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,K.state==="pending"?H.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,K.state==="error"?H.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",K.error," ",H.jsxDEV("button",{type:"button",onClick:X,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,K.state==="ok"?R.mirror?H.jsxDEV("iframe",{title:`${R.twin} mirror`,src:D8(Q,R.twin)},R.twin,!1,void 0,this):H.jsxDEV("p",{className:"empty",children:[F0(R.twin)," has no screens here yet. What your app did there is in ",H.jsxDEV("a",{href:`${q0}/${Q}/~/activity`,onClick:(L)=>{L.preventDefault(),v0([...Q.split("/"),"~","activity"])},children:"Activity"},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):null]},void 0,!0,void 0,this)}function SV(Q){let U=[];for(let Z of Q){let K=U[U.length-1];if(K&&(K[0].operation??K[0].op)===(Z.operation??Z.op))K.push(Z);else U.push([Z])}return U}function jV(Q){let U=[];for(let Z of Q){let K=U[U.length-1],X=Array.isArray(K)?K[0]:K;if(X&&X.twin===Z.twin&&(X.entry.operation??X.entry.op)===(Z.entry.operation??Z.entry.op))if(Array.isArray(K))K.push(Z);else U[U.length-1]=[X,Z];else U.push(Z)}return U.flatMap((Z)=>Array.isArray(Z)&&Z.length<3?Z:[Z])}var VV=50,E4=(Q)=>`${Q.twin}:${Q.position}`,dR=(Q,U)=>Date.parse(U.entry.occurredAt)-Date.parse(Q.entry.occurredAt)||Q.twin.localeCompare(U.twin)||U.position-Q.position;function kV(Q){let U=[];for(let Z of Q){let K=new Date(Z.entry.occurredAt),X=K.toDateString(),W=U[U.length-1];if(!W||W.day!==X)W={day:X,label:K.toLocaleDateString(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric"}),instants:[]},U.push(W);let z=W.instants[W.instants.length-1];if(z&&Date.parse(z.at)===K.getTime())z.items.push(Z);else W.instants.push({at:Z.entry.occurredAt,items:[Z]})}return U}function yR({name:Q,p:U}){let Z=U.entry,K=gR(Z.traceparent),X=n5(Z),W=LV(Z);return H.jsxDEV("li",{className:"entry",title:`${Z.operation??Z.op} ${Z.subject.type}:${Z.subject.id} · ${mR(Z)} · ${nq(Z)}`,children:[H.jsxDEV("span",{className:"twin-chip",children:[H.jsxDEV(A5,{vendor:U.twin},void 0,!1,void 0,this),F0(U.twin)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"op",children:X.what},void 0,!1,void 0,this),X.label?H.jsxDEV("span",{className:"label",children:["“",X.label,"”"]},void 0,!0,void 0,this):H.jsxDEV("code",{className:"subject",children:aq(Z)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"actor mode",children:oq(Z,U.twin)},void 0,!1,void 0,this),W?H.jsxDEV("span",{className:"standing",children:W},void 0,!1,void 0,this):null,K?H.jsxDEV("a",{className:"trace-link",href:`${q0}/${Q}/~/trace/${K.trace}`,"aria-label":`View trace ${K.trace.slice(0,8)}`,onClick:(z)=>{z.preventDefault(),v0([...Q.split("/"),"~","trace",K.trace])},children:"trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function DV({name:Q,token:U,vendors:Z}){let[K,X]=B1.useState(null),[W,z]=B1.useState(null),[B,O]=B1.useState(null),[T,R]=B1.useState(null),[L,M]=B1.useState(!1),[I,f]=B1.useState(null),[D,V]=B1.useState({items:[],gap:null}),k=B1.useCallback((E)=>`/-/${Q}/timeline?limit=${VV}${K?`&twin=${encodeURIComponent(K)}`:""}${E?`&before=${encodeURIComponent(E)}`:""}`,[Q,K]),h=B1.useRef(null);h.current=W,B1.useEffect(()=>{let E=!0;z(null),R(null),V({items:[],gap:null}),(async()=>{let a=await X0(U,k());if(!E)return;if(!a.ok){R(await z5(a));return}let m=await a.json();if(!E)return;z(m.entries),O(m.next)})().catch((a)=>{if(E)R(`the World did not answer: ${a instanceof Error?a.message:String(a)}`)});let p=setInterval(()=>{let a=h.current;if(a===null||document.hidden)return;X0(U,k()).then(async(m)=>{if(!m.ok||!E)return;let _1=await m.json();if(!E)return;if(a.length===0){if(_1.entries.length)z(_1.entries),O(_1.next);return}let $1=new Set((h.current??a).map(E4)),J1=_1.entries.filter((y)=>!$1.has(E4(y)));V({items:J1,gap:J1.length===_1.entries.length&&_1.next?_1:null})}).catch(()=>null)},3000);return()=>{E=!1,clearInterval(p)}},[U,k]);let P=()=>{if(D.gap)z(D.gap.entries),O(D.gap.next);else z((E)=>[...D.items,...E??[]].sort(dR));V({items:[],gap:null})},C=async()=>{if(!B)return;M(!0),f(null);try{let E=await X0(U,k(B));if(!E.ok){f(await z5(E));return}let p=await E.json();z((a)=>{let m=new Set((a??[]).map(E4));return[...a??[],...p.entries.filter((_1)=>!m.has(E4(_1)))]}),O(p.next)}catch(E){f(`the World did not answer: ${E instanceof Error?E.message:String(E)}`)}finally{M(!1)}},v=B1.useMemo(()=>kV(W??[]),[W]),b=D.items.length;return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("div",{role:"group","aria-label":"Filter by twin",className:"chips",children:[H.jsxDEV("button",{type:"button","aria-pressed":K===null,onClick:()=>X(null),children:"All vendors"},void 0,!1,void 0,this),Z.map((E)=>H.jsxDEV("button",{type:"button","aria-pressed":K===E,"aria-label":E,onClick:()=>X(K===E?null:E),children:F0(E)},E,!1,void 0,this))]},void 0,!0,void 0,this),H.jsxDEV("div",{"aria-live":"polite",className:"pill-slot",children:b>0?H.jsxDEV("button",{type:"button",className:"pill",onClick:P,children:[D.gap?`${b}+`:b," new change",b===1?"":"s"," — show"]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),T?H.jsxDEV("p",{role:"alert",children:["Could not read the timeline: ",T]},void 0,!0,void 0,this):W===null?H.jsxDEV("p",{className:"mode",role:"status",children:"Loading the timeline…"},void 0,!1,void 0,this):W.length===0?K?H.jsxDEV("p",{children:["Nothing has happened in ",K," yet."]},void 0,!0,void 0,this):H.jsxDEV("div",{className:"empty",children:[H.jsxDEV("p",{children:H.jsxDEV("strong",{children:"Nothing has happened in this World yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["An entry arrives each time something changes a twin: an app (or a seed script) calling a twin's API at ",H.jsxDEV("code",{children:[w6,"/",Q,"/<twin>"]},void 0,!0,void 0,this),", a mirror's form, a changeset landing. They show here within a few seconds."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("div",{className:"feed","aria-label":"Timeline",children:[v.map((E)=>H.jsxDEV("div",{role:"group","aria-label":E.label,className:"day",children:[H.jsxDEV("h3",{className:"day-head",children:E.label},void 0,!1,void 0,this),H.jsxDEV("ol",{className:"instants",children:E.instants.map((p)=>H.jsxDEV("li",{className:"instant",children:[H.jsxDEV("div",{className:"instant-time",title:p.items.length>1?"These happened at the same moment of the World's clock: their order across vendors is not known.":void 0,children:H.jsxDEV(h0,{iso:p.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("ul",{className:"entries",children:jV(p.items).map((a)=>Array.isArray(a)?H.jsxDEV("li",{className:"entry run",children:H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[H.jsxDEV("span",{className:"twin-chip",children:[H.jsxDEV(A5,{vendor:a[0].twin},void 0,!1,void 0,this),F0(a[0].twin)]},void 0,!0,void 0,this)," ",H.jsxDEV("span",{className:"op",children:[J9(a.length,a[0].entry.subject.type)," ",n5(a[0].entry).what.split(" ").slice(-1)[0]]},void 0,!0,void 0,this)," ",H.jsxDEV("span",{className:"actor mode",children:oq(a[0].entry,a[0].twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"entries",children:a.map((m)=>H.jsxDEV(yR,{name:Q,p:m},E4(m),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},E4(a[0]),!1,void 0,this):H.jsxDEV(yR,{name:Q,p:a},E4(a),!1,void 0,this))},void 0,!1,void 0,this)]},`${p.at}:${E4(p.items[0])}`,!0,void 0,this))},void 0,!1,void 0,this)]},E.day,!0,void 0,this)),B?H.jsxDEV("button",{type:"button",onClick:()=>void C(),disabled:L,"aria-busy":L,children:"Load older"},void 0,!1,void 0,this):H.jsxDEV("p",{className:"mode",children:["The beginning of this World",K?`'s ${K}`:"","."]},void 0,!0,void 0,this),I?H.jsxDEV("p",{role:"alert",children:["Could not load older changes: ",I]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function yV({name:Q,token:U,id:Z}){let K=/^[0-9a-f]{32}$/.test(Z),X=L5(U,K?`/-/${Q}/timeline?trace=${Z}&limit=500`:null),W=X.state==="ok"?[...X.data.entries].sort((T,R)=>-dR(T,R)):[],z=[...new Set(W.map((T)=>T.twin))],B=W[0]?Date.parse(W[0].entry.occurredAt):0,O=H.jsxDEV("a",{href:`${q0}/${Q}/~/timeline`,onClick:(T)=>{T.preventDefault(),v0([...Q.split("/"),"~","timeline"])},children:"← Timeline"},void 0,!1,void 0,this);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{children:O},void 0,!1,void 0,this),H.jsxDEV("h3",{children:["Trace ",H.jsxDEV("code",{children:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!K?H.jsxDEV("p",{role:"alert",children:[Z?`${Z} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):H.jsxDEV(B5,{load:X,what:"the trace"},void 0,!1,void 0,this),X.state==="ok"&&W.length===0?H.jsxDEV("div",{className:"empty",children:[H.jsxDEV("p",{children:H.jsxDEV("strong",{children:"Nothing in this World carries this trace."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["Causes are followed through the W3C ",H.jsxDEV("code",{children:"traceparent"},void 0,!1,void 0,this)," header: an app instrumented with OpenTelemetry sends it with each call, and every entry that call writes keeps it — so one click in the app can be read across Stripe, Slack and the rest. Without it the World knows the order of what happened, not what caused what."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,W.length>0?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:[W.length," step",W.length===1?"":"s"," across ",z.length," twin",z.length===1?"":"s",X.state==="ok"&&X.data.next?" · the first 500 shown":""]},void 0,!0,void 0,this),H.jsxDEV("div",{role:"table","aria-label":"Trace waterfall",className:"waterfall",style:{gridTemplateColumns:`minmax(130px, auto) repeat(${z.length}, minmax(140px, 1fr))`},children:[H.jsxDEV("div",{role:"row",className:"wf-row wf-head",children:[H.jsxDEV("span",{role:"columnheader",children:"time"},void 0,!1,void 0,this),z.map((T)=>H.jsxDEV("span",{role:"columnheader",children:T},T,!1,void 0,this))]},void 0,!0,void 0,this),W.map((T)=>{let R=Date.parse(T.entry.occurredAt)-B,L=gR(T.entry.traceparent)?.span;return H.jsxDEV("div",{role:"row",className:"wf-row",children:[H.jsxDEV("span",{role:"cell",className:"wf-time",children:[H.jsxDEV(h0,{iso:T.entry.occurredAt,time:!0},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:["+",R," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.map((M)=>H.jsxDEV("span",{role:"cell",className:M===T.twin?"wf-cell on":"wf-cell",children:M===T.twin?H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[T.entry.operation??T.entry.op," ",H.jsxDEV("code",{children:[T.entry.subject.type,":",T.entry.subject.id]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"mode",children:[mR(T.entry)," · ",nq(T.entry)," · position ",T.position,L?H.jsxDEV(H.Fragment,{children:[" · span ",H.jsxDEV("code",{children:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV(iR,{fields:T.entry.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},M,!1,void 0,this))]},E4(T),!0,void 0,this)})]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function iR({fields:Q}){let U=Object.entries(Q??{});if(U.length===0)return H.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return H.jsxDEV("dl",{className:"fields",children:U.map(([Z,K])=>H.jsxDEV(B1.default.Fragment,{children:[H.jsxDEV("dt",{children:Z},void 0,!1,void 0,this),H.jsxDEV("dd",{children:H.jsxDEV("code",{children:typeof K==="string"?K:JSON.stringify(K)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Z,!0,void 0,this))},void 0,!1,void 0,this)}var sq=1280,tq=820,vR=160;function vV({data:Q}){let{world:U,vendor:Z,active:K,open:X}=Q;return H.jsxDEV(H.Fragment,{children:[H.jsxDEV(WR,{isVisible:!0,position:C1.Top,align:"start",className:"frame-label",children:[H.jsxDEV(A5,{vendor:Z},void 0,!1,void 0,this),H.jsxDEV("span",{children:F0(Z)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:K?"frame on":"frame",style:{width:sq,height:tq},children:[H.jsxDEV("div",{className:"frame-bar",title:"Drag to move",children:[H.jsxDEV(A5,{vendor:Z},void 0,!1,void 0,this),H.jsxDEV("strong",{children:F0(Z)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"frame-url",children:D8(U,Z).replace(/^https?:\/\//,"")},void 0,!1,void 0,this),H.jsxDEV("a",{className:"nodrag",href:`${q0}/${U}/~/vendors/${Z}`,onClick:(W)=>{W.preventDefault(),X(Z)},children:"Open"},void 0,!1,void 0,this),H.jsxDEV("a",{className:"nodrag",href:D8(U,Z),target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${F0(Z)} in a new tab`,children:"↗"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:K?"frame-body nodrag nopan nowheel":"frame-body",children:H.jsxDEV("iframe",{title:`${Z} mirror`,src:D8(U,Z),loading:"lazy",style:{pointerEvents:K?"auto":"none"}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var EV={screen:vV};function bV(Q){return H.jsxDEV(kX,{children:H.jsxDEV(uV,{...Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function uV({name:Q,twins:U,session:Z,retry:K,snapshot:X,back:W}){let z=U.state==="ok"?U.data.twins.filter((E)=>E.mirror).map((E)=>E.twin):[],B=`volter.canvas.${Q}`,[O,T]=B1.useState(null),[R,L]=B1.useState(!0),M=OJ(),I=B1.useCallback((E)=>v0([...Q.split("/"),"~","vendors",E]),[Q]),f=Math.max(1,Math.ceil(Math.sqrt(z.length))),D=B1.useCallback(()=>{let E={};try{E=JSON.parse(localStorage.getItem(B)??"{}")}catch{}return z.map((p,a)=>({id:p,type:"screen",dragHandle:".frame-bar",position:E[p]??{x:a%f*(sq+vR),y:Math.floor(a/f)*(tq+vR)},data:{world:Q,vendor:p,active:!1,open:I}}))},[z.join(","),Q,f,I]),[V,k,h]=GR([]);B1.useEffect(()=>{k(D())},[D,k]),B1.useEffect(()=>{k((E)=>E.map((p)=>p.data.active===(p.id===O)?p:{...p,data:{...p.data,active:p.id===O}}))},[O,k]),B1.useEffect(()=>{let E=(p)=>{if(p.key==="Escape")T(null)};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[]);let P=()=>{try{localStorage.setItem(B,JSON.stringify(Object.fromEntries(V.map((E)=>[E.id,E.position]))))}catch{}},C=(E)=>{T(E);let p=M.getNode(E);if(!p)return;let a=Math.min((window.innerWidth-300)/sq,(window.innerHeight-120)/tq,1);M.setCenter(p.position.x+sq/2-130/a,p.position.y+tq/2,{zoom:a,duration:400})},v=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,b=Z.state==="ok"&&U.state==="ok";return H.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"Every vendor's screens",children:H.jsxDEV(UR,{nodes:b?V:[],onNodesChange:h,nodeTypes:EV,onNodeDragStop:P,onNodeClick:(E,p)=>T(p.id),onPaneClick:()=>T(null),fitView:!0,fitViewOptions:{padding:{top:"64px",left:"272px",right:"32px",bottom:"32px"}},minZoom:0.05,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!1,zoomOnDoubleClick:!1,colorMode:v?"dark":"light",proOptions:{hideAttribution:!0},children:[H.jsxDEV(FR,{variant:v4.Dots,gap:28,size:1.4},void 0,!1,void 0,this),H.jsxDEV(N8,{position:"top-left",className:"float layers",children:[H.jsxDEV("div",{className:"float-head",children:[H.jsxDEV("button",{type:"button",className:"back",onClick:W,"aria-label":`Back to ${Q}`,children:"←"},void 0,!1,void 0,this),H.jsxDEV("span",{className:"float-title",children:[H.jsxDEV("strong",{children:Q.split("/")[1]},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:[Q.split("/")[0],X?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"button",className:"ghost","aria-expanded":R,"aria-label":R?"Hide the screens list":"Show the screens list",onClick:()=>L(!R),children:R?"▾":"▸"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?H.jsxDEV("ul",{className:"layer-list","aria-label":"Screens",children:[z.map((E)=>H.jsxDEV("li",{children:H.jsxDEV("button",{type:"button",className:O===E?"on":void 0,onClick:()=>C(E),children:[H.jsxDEV(A5,{vendor:E},void 0,!1,void 0,this),H.jsxDEV("span",{children:F0(E)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},E,!1,void 0,this)),U.state==="ok"&&z.length===0?H.jsxDEV("li",{className:"mode",children:"No vendor in this World has screens."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,H.jsxDEV(B5,{load:U,what:"the vendors"},void 0,!1,void 0,this),Z.state==="pending"?H.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,Z.state==="error"?H.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",Z.error," ",H.jsxDEV("button",{type:"button",onClick:K,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV(N8,{position:"top-center",className:"float hint mode",children:O?`Using ${F0(O)} · Esc to leave`:"Drag to pan · scroll to zoom · click a screen to use it"},void 0,!1,void 0,this),H.jsxDEV(XR,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),H.jsxDEV(YR,{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 aR=(Q)=>{let U=new Map;for(let Z of Q.actions)U.set(Z.service,[...U.get(Z.service)??[],{...Z.action,service:Z.service,op:Z.action.op??Z.action.operation??""}]);return[...U.entries()]};function sR(Q){if(Q.applied)return Q.applied.outcome==="applied"?{label:"Deployed",tone:"done"}:Q.applied.outcome==="partial"?{label:"Partly deployed",tone:"warn"}:{label:"Deploy refused",tone:"bad"};let U=Q.currentHash??Q.contentHash,Z=Q.approvals.filter((X)=>X.contentHash===U).length,K=Q.verification&&Q.verification.contentHash===U?Q.verification:null;if(K&&!K.passed)return{label:"Checks failed",tone:"bad"};if(Z>0)return{label:`Approved by ${Z}`,tone:"good"};if(K)return{label:"Verified",tone:"good"};return{label:"Not verified",tone:"plain"}}function xV({name:Q,token:U,signsAs:Z,canWrite:K,rooted:X,open:W,refused:z}){let[B,O]=B1.useState(0),T=L5(U,`/-/${Q}/changesets`,B),R=(M)=>(I)=>{I.preventDefault(),v0([...Q.split("/"),"~","changesets",M])};if(W){let M=T.state==="ok"?T.data.changesets.find((I)=>I.name===W):void 0;return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"crumbs-line",children:H.jsxDEV("a",{href:`${q0}/${Q}/~/changesets`,onClick:(I)=>{I.preventDefault(),v0([...Q.split("/"),"~","changesets"])},children:"← Changesets"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV(B5,{load:T,what:"the changesets"},void 0,!1,void 0,this),T.state==="ok"&&!M?H.jsxDEV("p",{className:"mode",children:["This World has no changeset named ",W,"."]},void 0,!0,void 0,this):null,M?H.jsxDEV(hV,{name:Q,token:U,signsAs:Z,c:M,canWrite:K,rooted:X,refused:z,onChanged:()=>O((I)=>I+1)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}let L=T.state==="ok"?[...T.data.changesets].sort((M,I)=>I.createdAt.localeCompare(M.createdAt)):[];return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"lede",children:"A changeset is what this World changed, cut into a piece a person reviews: what it does at each vendor, the World's checks over it, and who approved it. Where the World has a real account behind a vendor, an approved changeset deploys there, with a receipt for each change."},void 0,!1,void 0,this),H.jsxDEV(B5,{load:T,what:"the changesets"},void 0,!1,void 0,this),T.state==="ok"&&L.length===0?H.jsxDEV(wR,{title:"No changesets yet",children:H.jsxDEV("p",{children:["Cut one from what your app did in this World: ",H.jsxDEV("code",{children:'volter world changeset -m "What it does and why"'},void 0,!1,void 0,this),". Pushed to a shared World, it shows up here for review."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,L.length>0?H.jsxDEV("div",{className:"block",children:H.jsxDEV("table",{className:"dense","aria-label":"Changesets",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Changeset"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Changes"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Status"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:L.map((M)=>{let I=sR(M),f=aR(M).map(([D,V])=>`${V.length} at ${F0(D)}`).join(" · ");return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:[H.jsxDEV("a",{href:`${q0}/${Q}/~/changesets/${M.name}`,onClick:R(M.name),children:H.jsxDEV("b",{children:M.message??M.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),M.message?H.jsxDEV("span",{className:"mode mono",children:[" ",M.name]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("td",{className:"mode",children:f||"nothing"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:H.jsxDEV(h0,{iso:M.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("span",{className:`badge cs-${I.tone}`,children:I.label},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},M.name,!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)}function hV({name:Q,token:U,signsAs:Z,c:K,canWrite:X,rooted:W,refused:z,onChanged:B}){let[O,T]=B1.useState(null),[R,L]=B1.useState(!1),[M,I]=B1.useState(""),[f,D]=B1.useState(""),V=sR(K),k=aR(K),h=k.map(([m])=>m),P=h.some((m)=>W.includes(m)),C=(m)=>m===(K.currentHash??K.contentHash),v=async(m,_1,$1,J1)=>{T(m);try{let y=await X0(U,_1,{method:"POST",...$1===void 0?{}:{body:JSON.stringify($1)}});if(!y.ok)return z(y),t2(`${m}: ${await z5(y)}`,"error"),!1;if(J1)t2(J1);return B(),!0}catch(y){return t2(`${m}: the World did not answer (${y instanceof Error?y.message:String(y)})`,"error"),!1}finally{T(null)}},b=()=>{v("Verify",`/-/${Q}/changesets/${K.name}/verify`,void 0,"Verified: the checks ran over it")},E=async(m)=>{if(m.preventDefault(),await v("Approve",`/-/${Q}/changesets/${K.name}/approve`,{...M.trim()?{note:M.trim()}:{},...Z===null&&f.trim()?{as:f.trim()}:{}},"Approved"))L(!1),I("")},p=async()=>{if(!await o5({title:`Deploy ${K.name} to the real vendors?`,body:H.jsxDEV(H.Fragment,{children:["It performs its ",K.actions.length," change",K.actions.length===1?"":"s"," against the real account",h.filter((m)=>W.includes(m)).length===1?"":"s"," behind ",EX(h.filter((m)=>W.includes(m)).map(F0)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:K.name}))return;v("Deploy",`/-/${Q}/deploy/${K.name}`,{confirm:K.name},"Deployed: the receipts are below")},a=!X?"This session reads the World; it changes nothing":K.applied?"Already deployed":null;return H.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[H.jsxDEV("div",{className:"changeset-head",children:[H.jsxDEV("div",{children:[H.jsxDEV("h3",{id:"changeset-title",children:[K.message??K.name," ",H.jsxDEV("span",{className:`badge cs-${V.tone}`,children:V.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"mode",children:[H.jsxDEV("code",{children:K.name},void 0,!1,void 0,this)," · made ",H.jsxDEV(h0,{iso:K.createdAt},void 0,!1,void 0,this)," · ",K.actions.length," change",K.actions.length===1?"":"s"," at ",EX(h.map(F0))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"changeset-actions",children:[H.jsxDEV("button",{type:"button",onClick:b,disabled:Boolean(a)||O!==null,title:a??"Replay it in a throwaway World and run the World's checks",children:O==="Verify"?"Verifying…":"Verify"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"button",onClick:()=>L(!0),disabled:Boolean(a)||O!==null,title:a??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),P?H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void p(),disabled:Boolean(a)||O!==null,title:a??"Perform it against the real accounts behind this World",children:O==="Deploy"?"Deploying…":"Deploy…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a&&!K.applied?H.jsxDEV("p",{className:"mode",children:[a,"."]},void 0,!0,void 0,this):null,!P&&!K.applied?H.jsxDEV("p",{className:"mode",children:"It stays in this World: no vendor it changes has a real account behind it here (a shared World with a root deploys; see Settings › Real services)."},void 0,!1,void 0,this):null,K.narration?H.jsxDEV("p",{className:"narration",children:K.narration},void 0,!1,void 0,this):null,H.jsxDEV("h4",{children:"Changes"},void 0,!1,void 0,this),k.length===0?H.jsxDEV("p",{className:"mode",children:"It changes nothing."},void 0,!1,void 0,this):H.jsxDEV(tR,{groups:k,idPrefix:`cs-${K.name}`},void 0,!1,void 0,this),H.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!K.verification?H.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):H.jsxDEV("div",{className:C(K.verification.contentHash)?"":"stale",children:[H.jsxDEV("p",{children:[K.verification.passed?"✓ Passed":"✗ Failed"," · ",H.jsxDEV(h0,{iso:K.verification.at},void 0,!1,void 0,this),C(K.verification.contentHash)?null:H.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),K.verification.results.length?H.jsxDEV("ul",{className:"checks",children:K.verification.results.map((m)=>H.jsxDEV("li",{children:[m.passed?"✓":"✗"," ",H.jsxDEV("code",{children:m.id},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:F0(m.service)},void 0,!1,void 0,this)]},m.id,!0,void 0,this))},void 0,!1,void 0,this):null,K.verification.refusals?.length?H.jsxDEV("ul",{className:"checks",children:K.verification.refusals.map((m,_1)=>H.jsxDEV("li",{children:["✗ ",H.jsxDEV("code",{children:m.check},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[F0(m.service),": ",m.reason]},void 0,!0,void 0,this)]},_1,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),K.approvals.length===0?H.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):H.jsxDEV("ul",{className:"approvals",children:K.approvals.map((m,_1)=>H.jsxDEV("li",{children:[H.jsxDEV("b",{children:m.principal},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[H.jsxDEV(h0,{iso:m.at},void 0,!1,void 0,this),C(m.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),m.note?H.jsxDEV("div",{className:"mode",children:["“",m.note,"”"]},void 0,!0,void 0,this):null]},_1,!0,void 0,this))},void 0,!1,void 0,this),K.applied?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("h4",{children:"Deployed"},void 0,!1,void 0,this),H.jsxDEV("p",{children:[K.applied.outcome==="applied"?"Every change reached the real vendors":K.applied.outcome==="partial"?"Some changes reached the real vendors":"The deploy was refused"," · ",H.jsxDEV(h0,{iso:K.applied.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K.applied.refusal?.length?H.jsxDEV("ul",{className:"checks",children:K.applied.refusal.map((m,_1)=>H.jsxDEV("li",{className:"mode",children:m},_1,!1,void 0,this))},void 0,!1,void 0,this):null,K.applied.receipts.length?H.jsxDEV("ul",{className:"receipts",children:K.applied.receipts.map((m)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{className:m.status==="failed"?"badge cs-bad":"badge cs-done",children:m.status},void 0,!1,void 0,this)," ",F0(m.service)," ",m.url?H.jsxDEV("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",children:m.externalId??m.url},void 0,!1,void 0,this):m.externalId?H.jsxDEV("code",{children:m.externalId},void 0,!1,void 0,this):null,m.error?H.jsxDEV("span",{className:"mode",children:[" · ",m.error]},void 0,!0,void 0,this):null]},m.actionId,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,H.jsxDEV(S8,{open:R,onClose:()=>{if(!O)L(!1)},title:`Approve ${K.name}`,footer:H.jsxDEV(H.Fragment,{children:[H.jsxDEV("button",{type:"button",onClick:()=>L(!1),disabled:O!==null,children:"Cancel"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",form:"approve-changeset",className:"primary",disabled:O!==null,children:O==="Approve"?"Approving…":"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:H.jsxDEV("form",{id:"approve-changeset",onSubmit:(m)=>void E(m),className:"stack",children:[H.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",Z?H.jsxDEV(H.Fragment,{children:[", recorded as ",H.jsxDEV("b",{children:Z},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),Z===null?H.jsxDEV("label",{children:[H.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),H.jsxDEV("input",{name:"approveAs",value:f,onChange:(m)=>D(m.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),H.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,H.jsxDEV("label",{children:[H.jsxDEV("span",{children:["Note ",H.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("textarea",{name:"approveNote",value:M,onChange:(m)=>I(m.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)}function tR({groups:Q,idPrefix:U}){return H.jsxDEV(H.Fragment,{children:Q.map(([Z,K])=>H.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${U}-${Z}`,children:[H.jsxDEV("h3",{id:`${U}-${Z}`,className:"vendor-cell",children:[H.jsxDEV(A5,{vendor:Z},void 0,!1,void 0,this),F0(Z)," ",H.jsxDEV("span",{className:"mode",children:["· ",K.length," change",K.length===1?"":"s"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{children:SV(K).map((X)=>X.length>=3?H.jsxDEV("li",{children:H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[H.jsxDEV("span",{className:"op",children:[J9(X.length,X[0].subject.type)," ",n5(X[0]).what.split(" ").slice(-1)[0]]},void 0,!0,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[X.map((W)=>n5(W).label??aq(W)).slice(0,4).join(", "),X.length>4?", …":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{children:X.map((W)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{className:"op",children:n5(W).what},void 0,!1,void 0,this)," ",n5(W).label?H.jsxDEV("span",{className:"label",children:["“",n5(W).label,"”"]},void 0,!0,void 0,this):H.jsxDEV("code",{children:aq(W)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[H.jsxDEV(h0,{iso:W.occurredAt},void 0,!1,void 0,this)," · ",oq(W,Z)]},void 0,!0,void 0,this)]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},X[0].id,!1,void 0,this):X.map((W)=>H.jsxDEV("li",{children:H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[H.jsxDEV("span",{className:"op",children:n5(W).what},void 0,!1,void 0,this)," ",n5(W).label?H.jsxDEV("span",{className:"label",children:["“",n5(W).label,"”"]},void 0,!0,void 0,this):H.jsxDEV("code",{children:aq(W)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[H.jsxDEV(h0,{iso:W.occurredAt},void 0,!1,void 0,this)," · ",oq(W,Z)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV(iR,{fields:W.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},W.id,!1,void 0,this)))},void 0,!1,void 0,this)]},Z,!0,void 0,this))},void 0,!1,void 0,this)}function mV({name:Q,token:U}){let Z=L5(U,`/-/${Q}/diff`),K=B1.useMemo(()=>{let X=new Map;if(Z.state==="ok")for(let W of Z.data.changes)X.set(W.twin,[...X.get(W.twin)??[],W.entry]);return[...X.entries()]},[Z]);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV(B5,{load:Z,what:"the changes"},void 0,!1,void 0,this),Z.state==="ok"?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:["What this World changed since it started",Z.data.base.at?H.jsxDEV(H.Fragment,{children:[" (",H.jsxDEV(h0,{iso:Z.data.base.at},void 0,!1,void 0,this),", ",H.jsxDEV("code",{children:Z.data.base.id},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:[" (",H.jsxDEV("code",{children:Z.data.base.id},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),": ",Z.data.changes.length," change",Z.data.changes.length===1?"":"s"," at ",K.length," vendor",K.length===1?"":"s",". A changeset takes these to the real services."]},void 0,!0,void 0,this),K.length===0?H.jsxDEV("p",{className:"empty",children:["No changes since ",Z.data.base.id,Z.data.base.at?H.jsxDEV(H.Fragment,{children:[" (",H.jsxDEV(h0,{iso:Z.data.base.at},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this):H.jsxDEV(tR,{groups:K,idPrefix:"changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function gV({name:Q,token:U}){let[Z,K]=B1.useState(0),X=L5(U,`/-/${Q}/keys`,Z),[W,z]=B1.useState(!1),[B,O]=B1.useState(""),[T,R]=B1.useState("write"),[L,M]=B1.useState(!1),[I,f]=B1.useState(null),[D,V]=B1.useState(null),[k,h]=B1.useState(null),P=async()=>{let b=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,E=await X0(U,`/-/${Q}/keys`,{method:"POST",body:JSON.stringify({name:b,scope:"read"})}).catch(()=>null),p=E?await E.json().catch(()=>({})):{error:`${B0} did not answer`};if(!E?.ok||!p.key){t2(p.error??"refused","error");return}h(`${window.location.origin}${q0}/${Q}#${new URLSearchParams({token:p.key}).toString()}`),K((a)=>a+1)},C=async(b)=>{b.preventDefault(),M(!0),f(null);let E=await X0(U,`/-/${Q}/keys`,{method:"POST",body:JSON.stringify({name:B.trim(),scope:T})}).catch(()=>null);M(!1);let p=E?await E.json().catch(()=>({})):{error:`${B0} did not answer`};if(!E?.ok||!p.key){f(p.error??"refused");return}z(!1),V({key:p.key,name:B.trim()}),O(""),K((a)=>a+1)},v=async(b)=>{if(!await o5({title:`Revoke ${b.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let E=await X0(U,`/-/${Q}/keys/${b.id}`,{method:"DELETE"});if(E.ok)t2(`Revoked ${b.name}`);else t2(await z5(E),"error");K((p)=>p+1)};return H.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[H.jsxDEV("div",{className:"keys-head",children:[H.jsxDEV("div",{children:[H.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),H.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),o2()?H.jsxDEV("a",{className:"button primary",href:`${o2()}/${encodeURIComponent(Q.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):H.jsxDEV("div",{className:"head-actions",children:[H.jsxDEV("button",{type:"button",onClick:()=>void P(),children:"Share a read-only link"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{f(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),H.jsxDEV(B5,{load:X,what:"the keys",retry:()=>K((b)=>b+1)},void 0,!1,void 0,this),X.state==="ok"?X.data.keys.length===0?H.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):H.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),H.jsxDEV("th",{className:"num",children:H.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),H.jsxDEV("tbody",{children:X.data.keys.map((b)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:b.name},void 0,!1,void 0,this),H.jsxDEV("td",{children:b.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:H.jsxDEV("span",{title:IJ(b.createdAt),children:dq(b.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:b.lastUsedAt?dq(b.lastUsedAt):"never"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num",children:H.jsxDEV(xX,{label:`More for ${b.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void v(b)}]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},b.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV(S8,{open:W,onClose:()=>{if(!L)z(!1)},title:"Make a key",footer:H.jsxDEV(H.Fragment,{children:[H.jsxDEV("button",{type:"button",onClick:()=>z(!1),disabled:L,children:"Cancel"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",form:"make-key",disabled:L||!B.trim(),children:L?"Making…":"Make key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:H.jsxDEV("form",{id:"make-key",onSubmit:C,"aria-label":"Make a key",children:[H.jsxDEV("label",{children:["Name ",H.jsxDEV("input",{autoFocus:!0,name:"keyName",value:B,onChange:(b)=>O(b.target.value),placeholder:"ci, staging app…",maxLength:80,required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{children:["Access ",H.jsxDEV("select",{value:T,onChange:(b)=>R(b.target.value==="read"?"read":"write"),children:[H.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),H.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),I?H.jsxDEV("p",{role:"alert",children:I},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV(S8,{open:Boolean(D),onClose:()=>V(null),title:`${D?.name??"The key"} is ready`,footer:H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>V(null),children:"Done"},void 0,!1,void 0,this),children:[H.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),D?H.jsxDEV(uX,{label:"Key",value:D.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV(S8,{open:Boolean(k),onClose:()=>h(null),title:"A read-only link",footer:H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>h(null),children:"Done"},void 0,!1,void 0,this),children:[H.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),k?H.jsxDEV(uX,{label:"Link",value:k,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function pV({name:Q,token:U,admin:Z,canWrite:K,refused:X,onRemoved:W}){let[z,B]=B1.useState(null),[O,T]=B1.useState(null),[R,L]=B1.useState(null),[M,I]=B1.useState(null),[f,D]=B1.useState(null),V=B1.useCallback(async()=>{let C=await X0(U,`/-/${Q}/twins`);B(C.ok?(await C.json()).twins:[]);let v=await X0(U,`/-/${Q}/requests?hours=24`);D(v.ok?await v.json():null);let b=await X0(U,`/-/${Q}/changesets`);T(b.ok?(await b.json()).changesets:[])},[Q,U]);B1.useEffect(()=>{V()},[V]);let k=async(C,v,b)=>{L(null);let E=await X0(U,v,b);if(!E.ok)X(E);L(E.ok?`${C}: done`:`${C}: ${await z5(E)}`),await V()},h=async()=>{if(!await o5({title:`Rotate the tokens of ${Q}?`,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 C=await X0(Z,`/-/worlds/${Q}/rotate`,{method:"POST"});if(C.ok)I(await C.json()),L("rotated: the new tokens are shown once");else L(`rotate: answered ${C.status}`)},P=async()=>{if(!await o5({title:`Remove ${Q}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:Q}))return;let C=await X0(Z,`/-/worlds/${Q}`,{method:"DELETE"}).catch((v)=>v);if(C instanceof Error){L(`remove: the host did not answer (${C.message})`);return}if(C.ok)W();else L(`remove: answered ${C.status}`)};return H.jsxDEV(H.Fragment,{children:[R?H.jsxDEV("p",{role:"status",children:R},void 0,!1,void 0,this):null,M?H.jsxDEV("p",{role:"status",children:["token ",H.jsxDEV("code",{children:M.token},void 0,!1,void 0,this)," · read token ",H.jsxDEV("code",{children:M.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,K?H.jsxDEV(gV,{name:Q,token:U},void 0,!1,void 0,this):null,H.jsxDEV("h3",{children:"Real services"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:"Every vendor here is a stand-in. Connect one to its real service to read the real state into this World; give it the real key to send this World's changes there (a changeset's Deploy, below)."},void 0,!1,void 0,this),z===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):H.jsxDEV("table",{"aria-label":"Real services",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"vendor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"real service"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"real key"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"last read from it"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"last sent"},void 0,!1,void 0,this),K?H.jsxDEV("th",{},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:z.map((C)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("a",{href:`${q0}/${Q}/${C.twin}`,title:`Its log and stored state · ${C.position??0} changes held${C.protocol?.major!==void 0?` · protocol ${C.protocol.major}${C.protocol.standing&&C.protocol.standing!=="current"?` (${C.protocol.standing})`:""}`:""}`,onClick:(v)=>{v.preventDefault(),v0([...Q.split("/"),C.twin])},children:F0(C.twin)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.root?.url?H.jsxDEV("code",{children:C.root.url},void 0,!1,void 0,this):H.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.credential?`sealed ${C.credential.fingerprint??""} · ${IJ(C.credential.placedAt)}`:H.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.refresh?.failed?H.jsxDEV("span",{role:"alert",children:["failed ×",C.refresh.failed.count??1,": ",C.refresh.failed.reason??""]},void 0,!0,void 0,this):C.root?IJ(C.refresh?.observedAt??C.refresh?.at):H.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.lastReceipt?`${C.lastReceipt.status??""} ${C.lastReceipt.externalId??""} ${C.lastReceipt.reason??""}`.trim():H.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K?H.jsxDEV("td",{children:[H.jsxDEV("button",{onClick:()=>void o5({title:`Read ${F0(C.twin)} now?`,body:`The real ${F0(C.twin)}'s current state is read into this World. Nothing is written to ${F0(C.twin)}.`,action:"Read from it"}).then((v)=>{if(v)k(`refresh ${C.twin}`,`/-/${Q}/twins/${C.twin}/refresh`,{method:"POST"})}),disabled:!C.root,title:"Read the real service's current state into this World",children:"Read from it"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>{let v=window.prompt(`The real ${F0(C.twin)}'s address (its API's URL); empty disconnects it`,C.root?.url??"");if(v===null)return;k(`root ${C.twin}`,`/-/${Q}/twins/${C.twin}/root`,{method:"PUT",body:JSON.stringify(v?{url:v}:null)})},title:"Connect this vendor to the real service's URL (empty disconnects it)",children:"Connect…"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>{let v=window.prompt(`The real ${F0(C.twin)} key: it is sealed beside this World and never shown again`);if(!v)return;k(`seal ${C.twin}`,`/-/${Q}/twins/${C.twin}/credential`,{method:"PUT",body:v,headers:{"content-type":"text/plain"}})},title:"Give this World the real service's key; it is sealed and never shown again",children:"Real key…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},C.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("h3",{children:"Traffic (last 24 hours)"},void 0,!1,void 0,this),f===null?H.jsxDEV("p",{className:"mode",children:"No request report for this world."},void 0,!1,void 0,this):f.requests===0?H.jsxDEV("p",{className:"mode",children:["No requests recorded in the last 24 hours. Recording is off unless the World runs with ",H.jsxDEV("code",{children:"VOLTER_TWIN_REQUEST_JOURNAL=1"},void 0,!1,void 0,this),"; what the requests changed is always in Activity."]},void 0,!0,void 0,this):H.jsxDEV("table",{"aria-label":"Requests by twin",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"vendor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"requests"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"by status"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"p50"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"p95"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"top routes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:f.twins.map((C)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:C.twin},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.requests},void 0,!1,void 0,this),H.jsxDEV("td",{children:Object.entries(C.byStatus).map(([v,b])=>`${v}: ${b}`).join(" · ")||"—"},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.p50Ms===null?"—":`${C.p50Ms} ms`},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.p95Ms===null?"—":`${C.p95Ms} ms`},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.topRoutes.slice(0,5).map((v)=>H.jsxDEV("div",{children:[H.jsxDEV("code",{children:v.route},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:["×",v.requests]},void 0,!0,void 0,this)]},v.route,!0,void 0,this))},void 0,!1,void 0,this)]},C.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("h3",{children:"Sending changes to the real services"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["A changeset is a set of this World's changes (",H.jsxDEV("code",{children:'volter world changeset -m "…"'},void 0,!1,void 0,this),"), verified and approved, then deployed to each connected real service."]},void 0,!0,void 0,this),O===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):O.length===0?H.jsxDEV("p",{className:"mode",children:"No changesets yet."},void 0,!1,void 0,this):H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"name"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"changes"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"approvals"},void 0,!1,void 0,this),K?H.jsxDEV("th",{children:"actions"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:O.map((C)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),H.jsxDEV("td",{children:Array.isArray(C.actions)?C.actions.length:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{children:Array.isArray(C.approvals)?C.approvals.length:0},void 0,!1,void 0,this),K?H.jsxDEV("td",{children:[H.jsxDEV("button",{onClick:()=>void k(`verify ${C.name}`,`/-/${Q}/changesets/${encodeURIComponent(C.name)}/verify`,{method:"POST"}),children:"Verify"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>{let v=window.prompt(`Approve ${C.name} as`);if(!v)return;k(`approve ${C.name}`,`/-/${Q}/changesets/${encodeURIComponent(C.name)}/approve`,{method:"POST",body:JSON.stringify({as:v})})},children:"Approve"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>void o5({title:`Deploy ${C.name}?`,body:"Its changes are sent to the real services now. That is what the World exists to keep you from doing by accident.",action:"Deploy to the real services",danger:!0,typed:C.name}).then((v)=>{if(v)k(`deploy ${C.name}`,`/-/${Q}/deploy/${encodeURIComponent(C.name)}`,{method:"POST",body:JSON.stringify({confirm:C.name})})}),children:"Deploy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},C.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z?H.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[H.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),H.jsxDEV("p",{children:[H.jsxDEV("button",{onClick:()=>void h(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",H.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),H.jsxDEV("p",{children:[H.jsxDEV("button",{onClick:()=>void P(),children:"Remove world"},void 0,!1,void 0,this)," ",H.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]},void 0,!0,void 0,this)}function cV({name:Q,token:U,twin:Z}){let[K,X]=B1.useState("log"),[W,z]=B1.useState(null),[B,O]=B1.useState(null);B1.useEffect(()=>{(async()=>{let f=await X0(U,`/-/${Q}/log/${Z}?limit=1`);if(!f.ok){z({position:0,entries:[]});return}let{position:D}=await f.json(),V=Math.max(0,D-200),h=await(await X0(U,`/-/${Q}/log/${Z}?after=${V}&limit=200&receipts=1`)).json();z({position:h.position,entries:[...h.entries].reverse()});let P=await X0(U,`/-/${Q}/checkpoint/${Z}`);O(P.ok?(await P.json()).tree:[])})()},[Q,U,Z]);let[T,R]=B1.useState(!1);B1.useEffect(()=>{X0(U,`/-/${Q}/twins/${Z}/status`).then(async(f)=>R(f.ok&&(await f.json()).mirror===!0),()=>R(!1))},[Q,U,Z]);let L=`${w6}/${Q}/${Z}/mirror/`,M=()=>{let f=document.createElement("form");f.method="POST",f.action=`${w6}/-/${Q}/session`;for(let[D,V]of[["token",U],["next",`/${Q}/${Z}/mirror/`]]){let k=document.createElement("input");k.type="hidden",k.name=D,k.value=V,f.append(k)}document.body.append(f),f.submit(),f.remove()},I=(f)=>f.operation==="observed"?`observed${f.provenance==="placeholder"?" (default data)":" (vendor)"}`:f.receipt?`${f.receipt.status??""} ${f.receipt.externalId??""} ${f.receipt.reason??""}`.trim():f.provenance==="placeholder"?"default data":"unpushed";return H.jsxDEV("section",{"aria-labelledby":"twin",children:[H.jsxDEV("h2",{id:"twin",children:[Z," in ",Q]},void 0,!0,void 0,this),H.jsxDEV("p",{children:["position ",W?.position??"…"," · ",H.jsxDEV("code",{children:[w6,"/",Q,"/",Z]},void 0,!0,void 0,this),T?H.jsxDEV(H.Fragment,{children:[" · ",H.jsxDEV("a",{href:L,onClick:(f)=>{f.preventDefault(),M()},children:["Open as ",Z," shows it"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("div",{role:"tablist",children:[H.jsxDEV("button",{role:"tab","aria-selected":K==="log",onClick:()=>X("log"),children:"Log"},void 0,!1,void 0,this),H.jsxDEV("button",{role:"tab","aria-selected":K==="tree",onClick:()=>X("tree"),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K==="log"?W===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):W.entries.length===0?H.jsxDEV("p",{children:"No changes yet."},void 0,!1,void 0,this):H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"when"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"operation"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"subject"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"actor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"standing"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:W.entries.map((f)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:IJ(f.occurredAt)},void 0,!1,void 0,this),H.jsxDEV("td",{children:f.operation??f.op},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("code",{children:[f.subject.type,":",f.subject.id]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:f.actor?`${f.actor.kind}${f.actor.id?` ${f.actor.id}`:""}`:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{children:nq(f)},void 0,!1,void 0,this)]},f.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):B===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):B.length===0?H.jsxDEV("p",{children:"The tree is empty."},void 0,!1,void 0,this):H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"type"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"fields"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:B.filter((f)=>f.deleted!==!0).slice(0,500).map((f)=>{let{type:D,id:V,...k}=f;return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:D},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("code",{children:V},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("pre",{children:JSON.stringify(k,null,1).slice(0,600)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},`${D}:${V}`,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}bX();ER.createRoot(NJ).render(H.jsxDEV(H.Fragment,{children:[H.jsxDEV(zV,{},void 0,!1,void 0,this),H.jsxDEV(OR,{},void 0,!1,void 0,this),H.jsxDEV(RR,{},void 0,!1,void 0,this),H.jsxDEV(TR,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this));
|
|
248
|
+
`)}var H=u0(wJ(),1),iq="volter.console.token",NJ=document.getElementById("root"),q0=NJ.dataset.base??"/-/console",B0=window.location.origin,w6=(NJ.dataset.worlds??B0).replace(/\/+$/,""),bR=(NJ.dataset.names??"").split(",").filter((Q)=>Q!==""),R6=NJ.dataset.worldOrigin==="1",k8=window.fetch.bind(window),O6="(session)",uR="(pass)",fJ=(Q)=>{try{if(Q&&!R6)sessionStorage.setItem(iq,Q);else sessionStorage.removeItem(iq);localStorage.removeItem(iq)}catch{}},xR="volter.console.portal",hR=(Q)=>{try{if(typeof Q==="string"&&/^https?:$/.test(new URL(Q).protocol))sessionStorage.setItem(xR,new URL(Q).origin)}catch{}},HV=()=>{return y8.get("token")??""},o2=()=>{try{let Q=sessionStorage.getItem(xR)??"";return Q&&/^https?:$/.test(new URL(Q).protocol)?new URL(Q).origin:""}catch{return""}},YV=()=>{let Q=HV();if(R6){if(fJ(""),y8.get("pass"))return uR;let U=new URLSearchParams(window.location.search).has("signin");if(U)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return Q||(U?"":O6)}if(Q)return fJ(Q),Q;try{return sessionStorage.getItem(iq)??""}catch{return""}};async function X0(Q,U,Z={}){return k8(`${B0}${U}`,{...Z,headers:{...Z.headers??{},...Q===O6?{}:{"x-volter-token":Q},...Z.body&&!Z.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function L5(Q,U,Z=0){return AR((K)=>X0(Q,K),U,Z,Q)}var U9=(Q)=>{let U=new Date(Q),Z=(K)=>String(K).padStart(2,"0");return`${U.getFullYear()}-${Z(U.getMonth()+1)}-${Z(U.getDate())}T${Z(U.getHours())}:${Z(U.getMinutes())}`},SR=(Q)=>new Date(Math.ceil(Date.parse(Q)/60000)*60000).toISOString(),nq=(Q)=>Q.operation==="observed"?`observed${Q.provenance==="placeholder"?" (default data)":" (vendor)"}`:Q.receipt?`${Q.receipt.status??""} ${Q.receipt.externalId??""} ${Q.receipt.reason??""}`.trim():Q.provenance==="placeholder"?"default data":"unpushed",mR=(Q)=>Q.actor?`${Q.actor.kind}${Q.actor.id?` ${Q.actor.id}`:""}`:"—",gR=(Q)=>{let U=/^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(Q??"");return U?{trace:U[1],span:U[2]}:null},lX="volter.console.snapshots",L3=()=>{try{return JSON.parse(sessionStorage.getItem(lX)??"{}")}catch{return{}}},pR=new Map,rX=(Q)=>{if(R6){if(Q.token||Q.readToken)pR.set(Q.name,{token:Q.token,readToken:Q.readToken});Q={...Q,token:"",readToken:""}}try{sessionStorage.setItem(lX,JSON.stringify({...L3(),[Q.name]:Q}))}catch{}},cR=(Q)=>pR.get(Q)?.readToken||L3()[Q]?.readToken||"",PJ=(Q)=>{try{let U=L3();delete U[Q],sessionStorage.setItem(lX,JSON.stringify(U))}catch{}},y8=new URLSearchParams(window.location.hash.slice(1)),Q9=y8.get("close")??"";function CJ(Q){if(typeof Q!=="string")return null;let U;try{U=new URL(Q)}catch{return null}return(U.protocol==="http:"||U.protocol==="https:")&&U.origin===Q.replace(/\/+$/,"")?U:null}function dX(Q){let U=CJ(Q);if(!U)return null;let Z=new URL(B0);if(U.protocol!==Z.protocol||U.port!==Z.port)return null;if(U.hostname===Z.hostname)return U.origin;let K=/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./;if(!K.test(U.hostname))return null;let X=U.hostname.replace(K,"");return X===Z.hostname||K.test(Z.hostname)&&X===Z.hostname.replace(K,"")?U.origin:null}function WV(Q){let U;try{U=JSON.parse(Q)}catch{return null}let Z=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof U.name!=="string"||!Z.test(U.name)||typeof U.parent!=="string"||!Z.test(U.parent)||typeof U.at!=="string")return null;let K=U.parentOrigin===void 0?void 0:dX(U.parentOrigin);return{name:U.name,parent:U.parent,token:typeof U.token==="string"?U.token:"",readToken:typeof U.readToken==="string"?U.readToken:"",at:U.at,expiresAt:typeof U.expiresAt==="string"?U.expiresAt:null,...K?{parentOrigin:K}:{}}}{let Q=y8.get("snapshot");if(Q){let U=WV(Q);if(U&&!L3()[U.name])rX(U)}}var lR="volter.console.home",rR=(Q)=>{let U=CJ(Q);if(!U)return null;let Z=new URL(B0).hostname,K=Z.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return U.hostname===Z||U.hostname===K?U.origin:null};{let Q=rR(y8.get("home"));if(Q)try{sessionStorage.setItem(lR,Q)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((Q)=>y8.has(Q)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var q9=()=>{try{return rR(sessionStorage.getItem(lR))??""}catch{return""}};function iX(Q,U,Z,K){let X=new URLSearchParams({token:U,home:q9()||B0}),W=L3()[Z];if(W)X.set("snapshot",JSON.stringify(W));window.location.replace(`${Q}${K??`${window.location.pathname}${window.location.search}`}#${X.toString()}`)}function V8(){return window.location.pathname.slice(q0.length).split("/").filter(Boolean).map((Q)=>{try{return decodeURIComponent(Q)}catch{return""}})}var jR=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,T6=(Q,U)=>Q&&U&&jR.test(Q)&&jR.test(U)?`${Q}/${U}`:"";function v0(Q){window.history.pushState(null,"",`${q0}/${Q.map(encodeURIComponent).join("/")}`),window.dispatchEvent(new PopStateEvent("popstate"))}function cX(Q,U){let Z=dX(L3()[Q]?.origin);if(Z&&Z!==B0){iX(Z,cR(Q),Q,`${q0}/${U.map(encodeURIComponent).join("/")}`);return}v0(U)}async function VR(){let[Q,U]=V8(),Z=T6(Q,U),K=Z?[Z]:bR;if(K.length===0){let X=await k8(`${B0}/-/ping`).catch(()=>null);K=X?.ok?(await X.json().catch(()=>({}))).worlds??[]:[]}K=K.filter((X)=>{let[W,z,...B]=X.split("/");return B.length===0&&T6(W,z)===X});for(let X of K){let W=await k8(`${B0}/-/${X}/session`,{method:"POST"}).catch(()=>null);if(!W)continue;let z=await W.json().catch(()=>({})),B=CJ(z.origin)?.origin;if(W.status===409&&B&&B!==B0)return window.location.replace(`${B}${q0}/${X}`),"moved";if(W.ok&&z.local)return{token:typeof z.token==="string"&&z.token?z.token:O6}}return null}function zV(){let[Q,U]=B1.useState(YV()),[Z,K]=B1.useState(!1),[X,W]=B1.useState(!1),[z,B]=B1.useState(""),[O,T]=B1.useState(null),[R,L]=B1.useState(null),[M,I]=B1.useState(V8());B1.useEffect(()=>{let x=()=>I(V8());return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]),B1.useEffect(()=>{let[x,d]=V8(),g=T6(x,d),[n,j]=g?g.split("/"):[],i=L3()[Q9];if(!Q9||!Q||!n||!j||!i?.made||i.parent!==`${n}/${j}`||T6(...Q9.split("/"))!==Q9)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}X0(Q,`/-/${n}/${j}/branches/${Q9}`,{method:"DELETE"}).catch(()=>null).then(()=>PJ(Q9))},[Q]);let f=B1.useCallback(async(x)=>{if(L(null),!x){let j=await VR();if(j==="moved")return;if(j){if(K(!0),j.token!==O6)fJ(j.token);U(j.token);return}T(null),W(!0);return}if(R6&&x===O6){let j=await VR();if(j==="moved")return;if(j)K(!0)}if(R6&&x===uR){let[j,i]=V8(),q1=T6(j,i),[Q1,Y1]=q1?q1.split("/"):[],L1=Q1&&Y1?await k8(`${B0}/-/${Q1}/${Y1}/session`,{method:"POST",headers:{"x-volter-pass":y8.get("pass")??""}}).catch(()=>null):null;if(!L1){L(`${B0} did not answer: no session was opened`),T(null);return}if(!L1.ok){L(`${await z5(L1)}. Open it again from the platform.`),T(null);return}hR((await L1.json().catch(()=>({}))).issuer),U(O6);return}if(R6&&x!==O6){let[j,i]=V8(),q1=T6(j,i),[Q1,Y1]=q1?q1.split("/"):[],L1=Q1&&Y1?await k8(`${B0}/-/${Q1}/${Y1}/session`,{method:"POST",headers:{"x-volter-token":x}}).catch(()=>null):null;if(!L1){L(`${B0} did not answer: no session was opened`),T(null);return}if(!L1.ok){let M1=await z5(L1);L(L1.status===401||L1.status===403?`That token does not open ${Q1}/${Y1}.`:L1.status===409?`${Q1}/${Y1}'s session lives at another origin: ${M1}`:`The World could not open a session (${L1.status}): ${M1}`),T(null);return}U(O6);return}let d=R6?new Response(null,{status:404}):await X0(x,"/-/worlds");if(d.ok){let{worlds:j}=await d.json();T({kind:"admin",worlds:j});return}if(d.status===429){L("You are asking faster than the platform allows — wait a moment and reload."),T(null);return}if(d.status>=500){let j=await d.json().catch(()=>({}));L(`The platform could not list your worlds${j.error?`: ${j.error}`:""}. Reload; if it stays, the status page says what is wrong.`),T(null);return}let g=bR;if(g.length===0){let j=await k8(`${B0}/-/ping`);if(!j.ok){L(`${B0} does not answer as a host`),T(null);return}if(g=(await j.json()).worlds??[],g.length===0){L(`${B0} does not list its worlds: open the console with the World's URL (volter world console <url>/<org>/<world>)`),T(null);return}}let n=[];for(let j of g){let i=await X0(x,`/-/${j}/twins`);if(i.ok){let q1=await i.json();n.push({name:j,base:`${w6}/${j}`,twins:(q1.twins??[]).map((Q1)=>({vendor:Q1.twin,protocol:Q1.protocol??null,root:Q1.root??null}))})}}if(n.length===0){L("This link or key opens no World here: it was revoked, or it has ended."),T(null);return}T({kind:"world",worlds:n})},[]);B1.useEffect(()=>{f(Q)},[Q,f]);let D=(x)=>O?.kind==="admin"?O.worlds.find((d)=>d.name===x)?.token??Q:Q,[V,k]=B1.useState("");if(!Q||!O&&!R)return H.jsxDEV("main",{children:[H.jsxDEV(rq,{href:`${q0}/`},void 0,!1,void 0,this),Q&&!O&&!R||!Q&&!X?H.jsxDEV("p",{children:"Opening…"},void 0,!1,void 0,this):H.jsxDEV("form",{onSubmit:(x)=>{x.preventDefault(),fJ(z.trim()),U(z.trim())},children:[H.jsxDEV("p",{children:"A host's admin token opens every world it serves; a world's token opens that world."},void 0,!1,void 0,this),H.jsxDEV("label",{children:["Token ",H.jsxDEV("input",{name:"token",type:"password",value:z,onChange:(x)=>B(x.target.value),autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",children:"Open"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);let h=()=>{if(Z){window.location.reload();return}if(R6){let[x,d]=V8(),g=T6(x,d),[n,j]=g?g.split("/"):[],i=()=>window.location.replace(o2()?`${o2()}/`:`${B0}${q0}/${n&&j?`${n}/${j}`:""}?signin`);if(setTimeout(i,2000),n&&j)k8(`${B0}/-/${n}/${j}/session/end`,{method:"POST"}).catch(()=>null).then(i);else i();return}if(O)for(let x of O.worlds)navigator.sendBeacon(`${x.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${x.name}/session/end`);fJ(""),U(""),B(""),T(null),v0([])};if(R||!O)return H.jsxDEV("main",{children:[H.jsxDEV(rq,{href:`${q0}/`},void 0,!1,void 0,this),H.jsxDEV("p",{role:"alert",children:R??"nothing answered"},void 0,!1,void 0,this),o2()?H.jsxDEV("a",{className:"button",href:`${o2()}/`,children:["Back to ",new URL(o2()).host]},void 0,!0,void 0,this):H.jsxDEV("button",{onClick:h,children:Z?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let[P,C,v,b,E]=M,p=v==="~",a=/^[A-Za-z0-9_-]+$/,m=p||!v||!a.test(v)?void 0:v,_1=E&&a.test(E)?E:void 0,$1=T6(P,C),J1=$1?L3()[$1]??null:null,y=(x)=>cR(x)||D(x),u=async(x)=>{let d=dX(x.parentOrigin);if(d&&d!==B0){PJ(x.name),window.location.assign(`${d}${q0}/${x.parent}#close=${encodeURIComponent(x.name)}`);return}if(x.made)await X0(D(x.parent),`/-/${x.parent}/branches/${x.name}`,{method:"DELETE"}).catch(()=>null),PJ(x.name);v0(x.parent.split("/"))};return H.jsxDEV("main",{className:$1?"app":void 0,children:[H.jsxDEV("header",{children:[$1?H.jsxDEV(IR,{},void 0,!1,void 0,this):null,H.jsxDEV(rq,{href:`${q9()&&q9()!==B0?q9():""}${q0}/`,onClick:(x)=>{if(q9()&&q9()!==B0)return;x.preventDefault(),v0([])}},void 0,!1,void 0,this),H.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[$1?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),H.jsxDEV("span",{children:$1.split("/")[0]},void 0,!1,void 0,this),H.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${$1}`,className:"crumb-world",onClick:(x)=>{x.preventDefault(),v0($1.split("/"))},children:$1.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,m?H.jsxDEV("span",{children:[" / ",m]},void 0,!0,void 0,this):null,p&&b==="trace"?H.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),o2()?H.jsxDEV("a",{href:`${o2()}/${$1?encodeURIComponent($1.split("/")[0]):""}`,title:`Back to the platform at ${new URL(o2()).host}`,className:"back-link",children:["← ",H.jsxDEV("span",{className:"back-text",children:$1?`${$1.split("/")[0]}'s Worlds`:new URL(o2()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV("span",{className:"mode",children:Z?"on this machine":J1?"a snapshot, read only":V?`signed in as ${V}`:O.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),Z?null:H.jsxDEV("button",{onClick:h,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$1?H.jsxDEV(MV,{name:$1,token:y($1),twin:m,tab:p?b??"overview":"overview",arg:p?_1:void 0,admin:J1?null:O.kind==="admin"?Q:null,snapshot:J1,onReturn:u,opens:(x)=>!!L3()[x]||O.kind==="admin"&&O.worlds.some((d)=>d.name===x),onRemoved:()=>{f(Q),v0([])},onWho:k},$1,!1,void 0,this):H.jsxDEV(BV,{mode:O,admin:O.kind==="admin"?Q:null,reload:()=>f(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BV({mode:Q,admin:U,reload:Z}){let[K,X]=B1.useState(""),[W,z]=B1.useState(""),[B,O]=B1.useState(""),[T,R]=B1.useState(null),L=async(V)=>{if(!await o5({title:`Rotate the tokens of ${V}?`,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 k=await X0(U,`/-/worlds/${V}/rotate`,{method:"POST"}),h=await k.json().catch(()=>({}));R(k.ok?`rotated ${V}: the new tokens are shown once — token ${h.token} · read token ${h.readToken}`:h.error??`answered ${k.status}`),await Z()},M=async(V)=>{let k=await X0(U,`/-/worlds/${V}`,{method:"DELETE"}),h=await k.json().catch(()=>({}));R(k.ok?`removed ${V}`:h.error??`answered ${k.status}`),await Z()},[I,f]=B1.useState(!1),D=async(V)=>{V.preventDefault(),R(null),f(!0);try{let k=await X0(U,"/-/worlds",{method:"POST",body:JSON.stringify({org:K,world:W,vendors:B.split(",").map((P)=>P.trim()).filter(Boolean)})}),h=await k.json();if(!k.ok){R(h.error??`the host answered ${k.status}`);return}R(`provisioned ${h.name}`),z(""),O(""),await Z()}finally{f(!1)}};return H.jsxDEV("section",{"aria-labelledby":"worlds",children:[H.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"lede",children:"A World is a copy of the services your app uses (Stripe, Slack, GitHub…), with none of the real consequences: your app talks to it, and you can see everything it did on each vendor's own screens."},void 0,!1,void 0,this),H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"world"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"address"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"stand-ins for"},void 0,!1,void 0,this),U?H.jsxDEV("th",{children:"actions"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:Q.worlds.map((V)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("a",{href:`${q0}/${V.name}`,onClick:(k)=>{k.preventDefault(),v0(V.name.split("/"))},children:V.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("code",{children:V.base},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:V.twins.map((k)=>F0(k.vendor)).join(", ")||"—"},void 0,!1,void 0,this),U?H.jsxDEV("td",{children:[H.jsxDEV("button",{type:"button","aria-label":`Rotate the tokens of ${V.name}`,onClick:()=>void L(V.name),children:"Rotate tokens"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{type:"button","aria-label":`Remove ${V.name}`,onClick:()=>void o5({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)M(V.name)}),children:"Remove world"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},V.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U?H.jsxDEV("form",{onSubmit:D,"aria-labelledby":"provision",children:[H.jsxDEV("h3",{id:"provision",children:"Provision a world"},void 0,!1,void 0,this),H.jsxDEV("label",{children:["Org ",H.jsxDEV("input",{name:"org",value:K,onChange:(V)=>X(V.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{children:["World ",H.jsxDEV("input",{name:"world",value:W,onChange:(V)=>z(V.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{children:["Twins ",H.jsxDEV("input",{name:"vendors",value:B,onChange:(V)=>O(V.target.value),placeholder:"github, slack",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",disabled:I,children:I?"Provisioning… (a host boots the world; ten seconds or so)":"Provision"},void 0,!1,void 0,this),T?H.jsxDEV("p",{role:"status",children:T},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):T?H.jsxDEV("p",{role:"status",children:T},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var gX=[["overview","Dashboard"],["branches","Branches"],["settings","Settings"],["branch","Overview"],["changes","Changes"],["changesets","Changesets"],["activity","Activity"],["vendors","Vendors"],["canvas","All screens"]],AV={dashboard:"overview",mirrors:"vendors",screens:"canvas",timeline:"activity",monitoring:"activity",trace:"activity",operations:"settings"},D8=(Q,U)=>`${w6}/${Q}/${U}/`,kR={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 n5(Q){let U=Q.operation??Q.op,Z=(U.includes(".")?U.slice(U.lastIndexOf(".")+1):U).toLowerCase(),K=Q.subject.type.replace(/[_-]+/g," ").trim(),X=`${K.charAt(0).toUpperCase()}${K.slice(1)}`,W=/(^|\.)twin\./.test(U)||/^seed_/.test(Z),z=U.replace(/[._]+/g," ").trim(),B=W?`${X} seeded`:kR[Z]?`${X} ${kR[Z]}`:`${z.charAt(0).toUpperCase()}${z.slice(1)}`,O=Q.fields??{},T=["title","name","email","text","subject","summary","description"].map((L)=>O[L]).find((L)=>typeof L==="string"&&L.trim()!=="")??null,R=T===null?null:T.replace(/<([@#!])[^|>]*\|([^>]+)>/g,(L,M,I)=>`${M==="!"?"@":M}${I}`).replace(/<(?:https?:[^|>]+)\|([^>]+)>/g,"$1").replace(/<(https?:[^>]+)>/g,"$1");return{what:B,label:R===null?null:R.length>80?`${R.slice(0,79)}…`:R}}var aq=(Q)=>/token|password|secret|key|credential/i.test(Q.subject.type)&&Q.subject.id.length>6?`••••${Q.subject.id.slice(-4)}`:Q.subject.id,oq=(Q,U)=>!Q.actor?"":Q.actor.kind==="system"?`by ${F0(U)}`:Q.actor.id?`by ${Q.actor.id}`:Q.actor.kind==="agent"||Q.actor.kind==="app"?"by your app":`by ${Q.actor.kind}`,LV=(Q)=>Q.operation==="observed"||Q.receipt||Q.provenance==="placeholder"?nq(Q):null;function MV({name:Q,token:U,twin:Z,tab:K,arg:X,admin:W,snapshot:z,onReturn:B,opens:O,onRemoved:T,onWho:R}){let[L,M]=B1.useState("pending"),[I,f]=B1.useState(null),[D,V]=B1.useState(0),[k,h]=B1.useState(null);B1.useEffect(()=>{let Q1=!0;return f(null),X0(U,`/-/${Q}/session`,{method:"POST"}).then(async(Y1)=>{let L1=await Y1.json().catch(()=>({}));if(hR(L1.issuer),L1.who)R?.(L1.who);h(typeof L1.signsAs==="string"?L1.signsAs:null);let M1=CJ(L1.origin)?.origin;if(Y1.status===409&&M1&&M1!==B0){iX(M1,U,Q);return}if(!Q1)return;if(M(!Y1.ok?"unknown":L1.scope==="read"?"read":L1.scope==="write"?"write":"unknown"),!Y1.ok)f(L1.error??`answered ${Y1.status}`)}).catch((Y1)=>{if(Q1)M("unknown"),f(`the World did not answer: ${Y1 instanceof Error?Y1.message:String(Y1)}`)}),()=>{Q1=!1}},[Q,U,D]);let P=I?{state:"error",error:I}:L==="pending"?{state:"pending"}:{state:"ok",scope:L},C=L==="write",v=(Q1)=>{if(Q1.status===403)M("read")},[b,E]=B1.useState(0);B1.useEffect(()=>{let Q1=setInterval(()=>{if(!document.hidden)E((Y1)=>Y1+1)},5000);return()=>clearInterval(Q1)},[]);let[p,a]=B1.useState(0),m=L5(U,`/-/${Q}/clock`,b+p),_1=L5(U,`/-/${Q}/twins`),$1=L5(U,`/-/${Q}/branches`,p),J1=L5(U,`/-/${Q}/map`,Math.floor(b/2)),y=!($1.state==="error"&&($1.status===404||$1.status===405));if(Z)return H.jsxDEV(cV,{name:Q,token:U,twin:Z},void 0,!1,void 0,this);let u=gX.some(([Q1])=>Q1===K)?K:AV[K]??"overview",x=_1.state==="ok"?_1.data.twins.map((Q1)=>Q1.twin):[],d=(Q1)=>J1.state==="ok"?(J1.data.twins.find((Y1)=>Y1.twin===Q1)?.resources??[]).reduce((Y1,L1)=>Y1+L1.count,0):0,g=u==="vendors"&&X?X:void 0,n=()=>{M("pending"),V((Q1)=>Q1+1)};if(u==="canvas"||u==="vendors"&&!g)return H.jsxDEV(bV,{name:Q,twins:_1,session:P,retry:n,snapshot:z,back:()=>v0(Q.split("/"))},void 0,!1,void 0,this);let j=g?F0(g):gX.find(([Q1])=>Q1===u)?.[1]??"",i=(Q1)=>(Y1)=>{Y1.preventDefault(),v0([...Q.split("/"),...Q1])},q1=(Q1,Y1=gX.find(([L1])=>L1===Q1)?.[1]??Q1)=>{let L1=u===Q1&&!g;return H.jsxDEV("a",{href:`${q0}/${Q}/~/${Q1}`,"aria-current":L1?"page":void 0,className:L1?"on":void 0,onClick:i(["~",Q1]),children:Y1},void 0,!1,void 0,this)};return H.jsxDEV("div",{className:"shell",children:[H.jsxDEV("aside",{className:"side",children:[H.jsxDEV("nav",{"aria-label":`${Q} pages`,className:"side-nav",children:[H.jsxDEV(TV,{name:Q},void 0,!1,void 0,this),H.jsxDEV("p",{className:"side-group",children:"World"},void 0,!1,void 0,this),q1("overview"),y?q1("branches"):null,q1("settings"),H.jsxDEV(RV,{name:Q,snapshot:z,branches:y?$1:null,opens:O},void 0,!1,void 0,this),H.jsxDEV("p",{className:"side-group",children:"Branch"},void 0,!1,void 0,this),q1("branch"),q1("changes"),q1("changesets"),q1("activity"),H.jsxDEV("p",{className:"side-group",children:"Vendors"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/canvas`,className:"all-screens",onClick:i(["~","canvas"]),children:[H.jsxDEV("span",{className:"mark","aria-hidden":"true",children:"▦"},void 0,!1,void 0,this),H.jsxDEV("span",{children:"All screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"side-vendors",children:x.map((Q1)=>H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${Q1}`,"aria-current":g===Q1?"page":void 0,className:g===Q1?"on":void 0,onClick:i(["~","vendors",Q1]),children:[H.jsxDEV(A5,{vendor:Q1},void 0,!1,void 0,this),H.jsxDEV("span",{children:F0(Q1)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"count",children:d(Q1)||""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Q1,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"side-foot",children:H.jsxDEV(MR,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"content",children:[z?H.jsxDEV("div",{className:"snapshot",role:"region","aria-label":"Snapshot",children:[H.jsxDEV("span",{children:["You are looking at ",H.jsxDEV("strong",{children:z.parent},void 0,!1,void 0,this)," as it was at ",H.jsxDEV(h0,{iso:z.at},void 0,!1,void 0,this)," · a read-only copy (read-only snapshot) · ",z.expiresAt?Date.parse(z.expiresAt)<=Date.now()?H.jsxDEV(H.Fragment,{children:["gone since ",H.jsxDEV(h0,{iso:z.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:["goes away ",H.jsxDEV(h0,{iso:z.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"kept until you go back"]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"button",onClick:()=>void B(z),children:"Return to live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV("div",{className:"content-head",children:[H.jsxDEV("h2",{id:"world",children:[g?H.jsxDEV("span",{className:"vendor-cell",children:[H.jsxDEV(A5,{vendor:g},void 0,!1,void 0,this),j]},void 0,!0,void 0,this):j,L==="read"?H.jsxDEV(H.Fragment,{children:[" ",H.jsxDEV("span",{className:"badge read-only",title:"This token reads the World; it changes nothing",children:"Read only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"head-actions",children:[H.jsxDEV(IV,{name:Q,token:U,clock:m,canWrite:C&&!z,onChanged:()=>a((Q1)=>Q1+1),refused:v},void 0,!1,void 0,this),!z&&C&&y&&$1.state!=="loading"?H.jsxDEV(fV,{name:Q,token:U,clock:m,refused:v},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{role:"region","aria-labelledby":"world",className:"panel",children:[u==="overview"?H.jsxDEV(wV,{name:Q,token:U,map:J1,vendors:x,twins:_1,session:P,branches:y?$1:null,canWrite:C&&!z,tick:b,...z?{snapshotOf:z.parent}:{}},void 0,!1,void 0,this):null,u==="branch"?H.jsxDEV(OV,{name:Q,token:U,map:J1,vendors:x,tick:b},void 0,!1,void 0,this):null,u==="vendors"?H.jsxDEV(CV,{name:Q,token:U,twins:_1,session:P,retry:n,selected:g},void 0,!1,void 0,this):null,u==="activity"&&K==="trace"?H.jsxDEV(yV,{name:Q,token:U,id:X??""},void 0,!1,void 0,this):null,u==="activity"&&K!=="trace"?H.jsxDEV(DV,{name:Q,token:U,vendors:x},void 0,!1,void 0,this):null,u==="changes"?H.jsxDEV(mV,{name:Q,token:U},void 0,!1,void 0,this):null,u==="changesets"?H.jsxDEV(xV,{name:Q,token:U,signsAs:k,canWrite:C&&!z,rooted:J1.state==="ok"?J1.data.twins.filter((Q1)=>Q1.root).map((Q1)=>Q1.twin):[],...X?{open:X}:{},refused:v},void 0,!1,void 0,this):null,u==="branches"?H.jsxDEV(PV,{name:Q,token:U,canWrite:C,branches:y?$1:null,opens:O,onBranchesChanged:()=>a((Q1)=>Q1+1),refused:v},void 0,!1,void 0,this):null,u==="settings"?H.jsxDEV(pV,{name:Q,token:U,admin:W,canWrite:C,refused:v,onRemoved:T},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function DR({text:Q}){return H.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(Q).then(()=>t2("Copied the prompt: paste it into your coding agent"),()=>t2("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}function TV({name:Q}){return H.jsxDEV("details",{className:"menu connect-side",children:[H.jsxDEV("summary",{className:"button connect-button",children:"Connect"},void 0,!1,void 0,this),o2()?H.jsxDEV("div",{className:"popover",children:[H.jsxDEV("p",{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),H.jsxDEV("pre",{children:[w6,"/",Q,"/<vendor>"]},void 0,!0,void 0,this),H.jsxDEV("a",{className:"button",href:`${o2()}/${encodeURIComponent(Q.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["Or push a World from your machine: ",H.jsxDEV("code",{children:["volter remote add origin ",Q]},void 0,!0,void 0,this),", then ",H.jsxDEV("code",{children:"volter world push"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),H.jsxDEV(DR,{text:mX({platform:o2(),world:Q})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("div",{className:"popover",children:[H.jsxDEV("p",{children:"Run your app in this World; its calls to these vendors land here:"},void 0,!1,void 0,this),H.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["Or point an SDK at ",H.jsxDEV("code",{children:[w6,"/",Q,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",H.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),H.jsxDEV(DR,{text:mX()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RV({name:Q,snapshot:U,branches:Z,opens:K}){let X=(B)=>B.split("/").pop()??B,W=U?.parent??Q,z=Z?.state==="ok"?Z.data.branches.filter((B)=>B.name!==Q):[];return H.jsxDEV("details",{className:"menu branch-picker",children:[H.jsxDEV("summary",{children:[H.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:H.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),H.jsxDEV("span",{className:"branch-name",children:U?X(Q):Z?.state==="ok"&&Z.data.checkedOut||X(W)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"badge",children:U?"snapshot":"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"popover",children:[H.jsxDEV("p",{className:"mode",children:"Branch"},void 0,!1,void 0,this),H.jsxDEV("ul",{className:"branch-list",children:[H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${W}`,"aria-current":!U?"page":void 0,onClick:(B)=>{B.preventDefault(),v0(W.split("/"))},children:[X(W)," ",H.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),U?H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${Q}`,"aria-current":"page",onClick:(B)=>B.preventDefault(),children:[X(Q)," ",H.jsxDEV("span",{className:"mode",children:["as of ",H.jsxDEV(h0,{iso:U.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,z.map((B)=>H.jsxDEV("li",{children:K(B.name)?H.jsxDEV("a",{href:`${q0}/${B.name}`,onClick:(O)=>{O.preventDefault(),cX(B.name,B.name.split("/"))},children:[X(B.name)," ",H.jsxDEV("span",{className:"mode",children:B.at?.instant?H.jsxDEV(H.Fragment,{children:["as of ",H.jsxDEV(h0,{iso:B.at.instant},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("span",{className:"mode",title:"Its token was handed to whoever made it",children:X(B.name)},void 0,!1,void 0,this)},B.name,!1,void 0,this))]},void 0,!0,void 0,this),Z?.state==="ok"&&(Z.data.named?.length??0)>1?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:"This World's branches"},void 0,!1,void 0,this),H.jsxDEV("ul",{className:"branch-list",children:Z.data.named.map((B)=>H.jsxDEV("li",{children:H.jsxDEV("span",{"aria-current":B.name===Z.data.checkedOut?"true":void 0,children:[B.name," ",H.jsxDEV("span",{className:"mode",children:B.name===Z.data.checkedOut?"served here":H.jsxDEV("code",{children:["volter world checkout ",B.name]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},B.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z?.state==="ok"&&z.length===0&&!U&&(Z.data.named?.length??0)<=1?H.jsxDEV("p",{className:"mode",children:"No branches yet. “View an earlier moment…” opens one."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function OV({name:Q,token:U,map:Z,vendors:K,tick:X}){let W=L5(U,`/-/${Q}/timeline?limit=500`,Math.floor(X/3)),z=Z.state==="ok"?Z.data.twins:[],B=(P)=>(C)=>{C.preventDefault(),v0([...Q.split("/"),...P])},O=Date.now(),T=24,R=3600000,L=W.state==="ok"?W.data.entries:[],M=K.map((P)=>{let C=Array(24).fill(0);for(let v of L){if(v.twin!==P)continue;let b=Date.parse(v.entry.occurredAt),E=23-Math.floor((O-b)/3600000);if(E>=0&&E<24)C[E]+=1}return{vendor:P,counts:C}}),I=Array(24).fill(0).map((P,C)=>M.reduce((v,b)=>v+b.counts[C],0)),f=Math.max(1,...I),D=720,V=160,k=30,h=["var(--volter-data-base)","#7c5cff","#e3572b","#1f9d6b","#d9a400","#2b7de3","#c2417e","#6b7280","#0ea5a4"];return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("div",{className:"block",children:H.jsxDEV("table",{className:"dense services","aria-label":"Vendors on this branch",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Details"},void 0,!1,void 0,this),H.jsxDEV("th",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:K.map((P)=>{let C=z.find((b)=>b.twin===P),v=[...C?.resources??[]].filter((b)=>b.count>0).sort((b,E)=>E.count-b.count);return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("span",{className:"vendor-cell",children:[H.jsxDEV(A5,{vendor:P},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${P}`,onClick:B(["~","vendors",P]),children:F0(P)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:C?.root?"badge rooted":"badge",children:C?.root?"connected":"stand-in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:v.length?v.slice(0,4).map((b)=>J9(b.count,b.type)).join(" · "):"nothing yet"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num",children:C?.mirror?H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${P}`,onClick:B(["~","vendors",P]),children:"Screens"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},P,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("div",{className:"block chart-block",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{children:"Activity, last 24 hours"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/activity`,onClick:B(["~","activity"]),children:"All activity"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV(B5,{load:W,what:"the activity"},void 0,!1,void 0,this),W.state==="ok"?H.jsxDEV("div",{className:"pad",children:[H.jsxDEV("svg",{viewBox:"0 0 720 182",className:"chart",role:"img","aria-label":`Writes per hour over the last day: ${I.reduce((P,C)=>P+C,0)} in all`,children:[[0.5,1].map((P)=>H.jsxDEV("line",{x1:0,x2:720,y1:160-P*160,y2:160-P*160,className:"grid"},P,!1,void 0,this)),H.jsxDEV("line",{x1:0,x2:720,y1:160,y2:160,className:"axis"},void 0,!1,void 0,this),I.map((P,C)=>{let v=160;return H.jsxDEV("g",{children:M.map((b,E)=>{let p=b.counts[C]/f*152;if(p===0)return null;return v-=p,H.jsxDEV("rect",{x:C*30+2,y:v,width:26,height:p,fill:h[E%h.length],rx:2,children:H.jsxDEV("title",{children:`${F0(b.vendor)}: ${b.counts[C]} in the hour ${23-C===0?"now":`${23-C}h ago`}`},void 0,!1,void 0,this)},b.vendor,!1,void 0,this)})},C,!1,void 0,this)}),[0,6,12,18,23].map((P)=>H.jsxDEV("text",{x:P*30+15,y:176,className:"tick",children:23-P===0?"now":`-${23-P}h`},P,!1,void 0,this))]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"legend",children:M.filter((P)=>P.counts.some((C)=>C>0)).map((P)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{className:"swatch",style:{background:h[K.indexOf(P.vendor)%h.length]}},void 0,!1,void 0,this),F0(P.vendor)," ",H.jsxDEV("span",{className:"mode",children:P.counts.reduce((C,v)=>C+v,0)},void 0,!1,void 0,this)]},P.vendor,!0,void 0,this))},void 0,!1,void 0,this),I.every((P)=>P===0)?H.jsxDEV("p",{className:"mode",children:"Nothing was written in the last day. Run your app in this World and its calls show up here."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var pX=0.2;function wV({name:Q,token:U,map:Z,vendors:K,twins:X,session:W,branches:z,canWrite:B,tick:O,snapshotOf:T}){let R=L5(U,`/-/${Q}/diff`,Math.floor(O/2)),L=L5(U,`/-/${Q}/timeline?limit=8`,O),M=Z.state==="ok"?Z.data.twins:[],I=L.state==="ok"?L.data.entries:[],f=X.state==="ok"?X.data.twins.filter((P)=>P.mirror).map((P)=>P.twin):[],D=(P)=>(C)=>{C.preventDefault(),v0([...Q.split("/"),...P])},V=(P)=>{let C=[...M.find((v)=>v.twin===P)?.resources??[]].filter((v)=>v.count>0).sort((v,b)=>b.count-v.count);return C.length?C.slice(0,2).map((v)=>J9(v.count,v.type)).join(" · "):"empty"},k=R.state==="ok"?R.data.changes.length:null,h=z?.state==="ok"?z.data.branches:[];return H.jsxDEV("div",{className:"dash",children:[H.jsxDEV("section",{className:"block dash-screens","aria-labelledby":"screens-head",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{id:"screens-head",children:["Screens ",H.jsxDEV("span",{className:"badge live",children:"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"mode",children:[K.length," vendor",K.length===1?"":"s",k!==null?H.jsxDEV(H.Fragment,{children:[" · ",H.jsxDEV("a",{href:`${q0}/${Q}/~/changes`,onClick:D(["~","changes"]),children:[k," change",k===1?"":"s"," since start"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("a",{className:"button",href:`${q0}/${Q}/~/canvas`,onClick:D(["~","canvas"]),children:"Open all screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.state==="ok"?H.jsxDEV("ul",{className:"thumbs",children:K.map((P)=>H.jsxDEV("li",{children:H.jsxDEV("a",{href:`${q0}/${Q}/~/vendors/${P}`,onClick:D(["~","vendors",P]),"aria-label":`${F0(P)}'s screens`,children:[H.jsxDEV("span",{className:"thumb",children:[f.includes(P)?H.jsxDEV("iframe",{title:`${F0(P)} preview`,src:D8(Q,P),loading:"lazy",tabIndex:-1,style:{width:`${100/pX}%`,height:`${100/pX}%`,transform:`scale(${pX})`}},void 0,!1,void 0,this):H.jsxDEV("span",{className:"thumb-none",children:"No screens"},void 0,!1,void 0,this),H.jsxDEV("span",{className:M.find((C)=>C.twin===P)?.root?"badge rooted thumb-status":"badge thumb-status",children:M.find((C)=>C.twin===P)?.root?"connected":"stand-in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"thumb-foot",children:[H.jsxDEV(A5,{vendor:P},void 0,!1,void 0,this),H.jsxDEV("b",{children:F0(P)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:V(P)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},P,!1,void 0,this))},void 0,!1,void 0,this):H.jsxDEV("p",{className:"mode pad",children:W.state==="error"?`The World did not open its screens: ${W.error}`:"Opening…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"dash-side",children:z?H.jsxDEV("section",{className:"block","aria-labelledby":"branches-head",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{id:"branches-head",children:"Branches"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/branches`,onClick:D(["~","branches"]),children:"All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"mini-feed",children:[H.jsxDEV("li",{children:[H.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:H.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),H.jsxDEV("span",{className:"mini-what",children:T?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("b",{children:Q.split("/")[1]},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"badge",children:"snapshot"},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:["of ",T.split("/")[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:[H.jsxDEV("b",{children:Q.split("/")[1]},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"badge",children:"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h.slice(0,3).map((P)=>H.jsxDEV("li",{children:[H.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:H.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),H.jsxDEV("span",{className:"mini-what",children:[P.name.split("/").pop()," ",H.jsxDEV("span",{className:"mode",children:P.at?.instant?`as of ${new Date(P.at.instant).toLocaleString()}`:"copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},P.name,!0,void 0,this))]},void 0,!0,void 0,this),B?H.jsxDEV("p",{className:"mode pad",children:"“View an earlier moment…” above opens a branch as the World was then."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),H.jsxDEV("section",{className:"block dash-activity","aria-labelledby":"activity-head",children:[H.jsxDEV("div",{className:"block-head",children:[H.jsxDEV("h3",{id:"activity-head",children:"Recent activity"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/~/activity`,onClick:D(["~","activity"]),children:"View all"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV(B5,{load:L,what:"the activity"},void 0,!1,void 0,this),L.state==="ok"&&I.length===0?H.jsxDEV("div",{className:"empty-block",children:[H.jsxDEV("strong",{children:"No activity yet"},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:"Run your app in this World and its calls show up here."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("ul",{className:"mini-feed",children:I.map((P)=>{let C=n5(P.entry);return H.jsxDEV("li",{children:[H.jsxDEV(A5,{vendor:P.twin},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mini-what",children:[H.jsxDEV("strong",{children:C.what},void 0,!1,void 0,this),C.label?H.jsxDEV("span",{className:"mode",children:[" ",C.label]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"mode num",title:P.entry.occurredAt,children:dq(P.entry.occurredAt)},void 0,!1,void 0,this)]},E4(P),!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function IV({name:Q,token:U,clock:Z,canWrite:K,onChanged:X,refused:W}){let[z,B]=B1.useState(!1),[O,T]=B1.useState(""),[R,L]=B1.useState(""),[M,I]=B1.useState(null),[f,D]=B1.useState(!1),V=Z.state==="ok"?Z.data:null,k=async(v,b,E)=>{D(!0),I(null);try{let p=await X0(U,`/-/${Q}/${b}`,{method:b==="clock"?"PUT":"POST",body:JSON.stringify(E)});if(!p.ok){W(p),I({ok:!1,text:await z5(p)});return}let a=await p.json();I({ok:!0,text:`${v} — the World is at ${new Date(a.at).toLocaleString()}`}),B(!1),X()}catch(p){I({ok:!1,text:`the World did not answer: ${p instanceof Error?p.message:String(p)}`})}finally{D(!1)}},h=(v)=>{v.preventDefault();let b=new Date(O);if(Number.isNaN(b.getTime())){I({ok:!1,text:"Pick a date and time."});return}if(V&&b.getTime()<Date.parse(V.at)){I({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(V.at).toLocaleString()}.`});return}k("Clock set","clock",{at:b.toISOString()})},P=(v,b)=>{k(`Advanced ${b}`,"clock/advance",{by:v})},C=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return H.jsxDEV("div",{className:`clock${V?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[H.jsxDEV("p",{className:"clock-now",children:Z.state==="loading"?H.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):Z.state==="error"?H.jsxDEV("span",{className:"mode",children:["Clock: ",Z.error]},void 0,!0,void 0,this):V.frozen?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",H.jsxDEV("strong",{children:H.jsxDEV(h0,{iso:V.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:["World time ",H.jsxDEV("strong",{children:H.jsxDEV(h0,{iso:V.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",H.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),K&&V?H.jsxDEV("details",{className:"clock-more",children:[H.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),H.jsxDEV("div",{className:"popover",children:[H.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, use “View an earlier moment…”."},void 0,!1,void 0,this),H.jsxDEV("div",{className:"clock-controls",children:[H.jsxDEV("button",{type:"button","aria-expanded":z,onClick:()=>{B(!z),T(U9(SR(V.at))),I(null)},children:"Set time…"},void 0,!1,void 0,this),H.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[H.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),C.map(([v,b])=>H.jsxDEV("button",{type:"button","aria-label":`Advance ${b}`,disabled:f||!V.frozen,title:V.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>P(v,b),children:b},v,!1,void 0,this)),H.jsxDEV("form",{className:"inline",onSubmit:(v)=>{if(v.preventDefault(),!/^\d+[smhd]$/.test(R.trim())){I({ok:!1,text:"Advance by a number and a unit: 90m, 12h, 3d."});return}P(R.trim(),`by ${R.trim()}`)},children:[H.jsxDEV("label",{className:"sr",children:["Advance by ",H.jsxDEV("input",{name:"advanceBy",value:R,onChange:(v)=>L(v.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!V.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",disabled:f||!V.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!V.frozen?H.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,z?H.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:h,noValidate:!0,children:[H.jsxDEV("label",{children:["World time ",H.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:O,min:U9(SR(V.at)),onChange:(v)=>T(v.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",disabled:f,children:"Set time"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"button",onClick:()=>B(!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,M?H.jsxDEV("p",{role:M.ok?"status":"alert",children:M.text},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function fV({name:Q,token:U,clock:Z,refused:K}){let[X,W]=B1.useState(!1),[z,B]=B1.useState(""),[O,T]=B1.useState(null),[R,L]=B1.useState(!1),M=Z.state==="ok"?Z.data.at:new Date().toISOString(),I=B1.useRef(null);return B1.useEffect(()=>{if(!X)return;let D=(k)=>{if(k.key==="Escape"&&!document.querySelector("dialog[open]"))W(!1),I.current?.querySelector("button")?.focus()},V=(k)=>{if(!I.current?.contains(k.target))W(!1)};return document.addEventListener("keydown",D),document.addEventListener("click",V),()=>{document.removeEventListener("keydown",D),document.removeEventListener("click",V)}},[X]),H.jsxDEV("div",{className:"as-of",ref:I,children:[H.jsxDEV("button",{type:"button","aria-expanded":X,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{W(!X),B(U9(M)),T(null)},children:"View an earlier moment…"},void 0,!1,void 0,this),X?H.jsxDEV("form",{className:"inline","aria-label":"View the World as of a past moment",onSubmit:async(D)=>{D.preventDefault(),T(null);let V=new Date(z);if(Number.isNaN(V.getTime())){T("Pick a date and time.");return}if(V.getTime()>Date.parse(M)){T(`That is after the World's present (${new Date(M).toLocaleString()}); a snapshot looks back.`);return}L(!0);try{let k=await X0(U,`/-/${Q}/branches`,{method:"POST",body:JSON.stringify({at:{instant:V.toISOString()},ttl:3600})});if(!k.ok){K(k),T(await z5(k));return}let h=await k.json();rX({name:h.name,parent:Q,token:h.token,readToken:h.readToken,at:V.toISOString(),expiresAt:h.expiresAt??null,parentOrigin:B0,made:!0});let P=CJ(h.origin)?.origin;if(P&&P!==B0){iX(P,h.readToken,h.name,`${q0}/${h.name}`);return}v0(h.name.split("/"))}catch(k){T(`the World did not answer: ${k instanceof Error?k.message:String(k)}`)}finally{L(!1)}},noValidate:!0,children:[H.jsxDEV("label",{children:["As of ",H.jsxDEV("input",{name:"asOf",type:"datetime-local",value:z,max:U9(M),onChange:(D)=>B(D.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"submit",disabled:R,children:R?"Opening…":"Open snapshot"},void 0,!1,void 0,this),H.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,O?H.jsxDEV("p",{role:"alert",children:O},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function PV({name:Q,token:U,canWrite:Z,branches:K,opens:X,onBranchesChanged:W,refused:z}){let B=L5(U,`/-/${Q}/map`),[O,T]=B1.useState(null),R=async(M)=>{if(!await o5({title:`Delete the branch ${M}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Delete branch",danger:!0}))return;let I=await X0(U,`/-/${Q}/branches/${M}`,{method:"DELETE"}).catch((f)=>f);if(I instanceof Error){T(`delete ${M}: the World did not answer (${I.message})`);return}if(!I.ok){z(I),T(`delete ${M}: ${await z5(I)}`);return}PJ(M),T(`deleted ${M}`),W()},L=B.state==="ok"?B.data.twins.reduce((M,I)=>M+I.resources.reduce((f,D)=>f+D.count,0),0):0;if(K)return H.jsxDEV(NV,{name:Q,token:U,canWrite:Z,branches:K,opens:X,note:O,remove:R,onChanged:W,refused:z},void 0,!1,void 0,this);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("h3",{children:"Map"},void 0,!1,void 0,this),H.jsxDEV(B5,{load:B,what:"the World's map"},void 0,!1,void 0,this),B.state==="ok"?B.data.twins.length===0?H.jsxDEV("p",{children:"This World holds no twins."},void 0,!1,void 0,this):H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:[B.data.twins.length," twin",B.data.twins.length===1?"":"s"," · ",L," resource",L===1?"":"s"]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"map","aria-label":"Twins in this World",children:B.data.twins.map((M)=>{let I=[...M.resources].sort((f,D)=>D.count-f.count);return H.jsxDEV("li",{className:"card","aria-labelledby":`map-${M.twin}`,children:[H.jsxDEV("div",{className:"card-head",children:[H.jsxDEV("h4",{id:`map-${M.twin}`,className:"vendor",children:M.twin},void 0,!1,void 0,this),H.jsxDEV("span",{className:M.root?"badge rooted":"badge",children:M.root?"rooted":"simulated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"mode",children:[M.root?H.jsxDEV(H.Fragment,{children:["rooted at ",H.jsxDEV("code",{children:M.root.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"simulated — no vendor behind it"," · position ",M.position]},void 0,!0,void 0,this),I.length===0?H.jsxDEV("p",{className:"mode",children:"Holds nothing yet."},void 0,!1,void 0,this):H.jsxDEV("ul",{className:"resources",children:[I.slice(0,6).map((f)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{children:f.type},void 0,!1,void 0,this)," ",H.jsxDEV("strong",{children:f.count},void 0,!1,void 0,this)]},f.type,!0,void 0,this)),I.length>6?H.jsxDEV("li",{className:"mode",children:["+",I.length-6," more types"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"card-actions",children:[M.mirror?H.jsxDEV("a",{className:"button",href:D8(Q,M.twin),target:"_blank",rel:"noopener noreferrer",children:["Open ",M.twin]},void 0,!0,void 0,this):H.jsxDEV("span",{className:"mode",children:"no mirror"},void 0,!1,void 0,this),H.jsxDEV("a",{href:`${q0}/${Q}/${M.twin}`,"aria-label":`Log and tree of ${M.twin}`,onClick:(f)=>{f.preventDefault(),v0([...Q.split("/"),M.twin])},children:"Log & tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},M.twin,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function NV({name:Q,token:U,canWrite:Z,branches:K,opens:X,note:W,remove:z,onChanged:B,refused:O}){let T=(g)=>g.split("/").pop()??g,R=K.state==="ok"?K.data.branches:[],[L,M]=B1.useState(!1),[I,f]=B1.useState(!1),[D,V]=B1.useState(null),[k,h]=B1.useState(""),[P,C]=B1.useState("now"),[v,b]=B1.useState(""),[E,p]=B1.useState("24"),[a,m]=B1.useState(null),[_1,$1]=B1.useState(null),J1=async(g)=>{m(g),$1(null);let n=await X0(U,`/-/${Q}/branches/${encodeURIComponent(g)}/serve`,{method:"POST"}).catch(()=>null);if(n?.ok){location.reload();return}m(null),$1(n?(await n.json().catch(()=>null))?.error??`${n.status}`:`${B0} did not answer`)},y=async(g,n)=>{let j=await X0(U,`/-/${Q}/branches`,{method:"POST",body:JSON.stringify(g)}).catch(()=>null);if(!j)return`${B0} did not answer`;if(!j.ok)return O(j),await z5(j);let i=await j.json();return rX({name:i.name,parent:Q,token:i.token??"",readToken:i.readToken,at:n,expiresAt:i.expiresAt??null,parentOrigin:B0,...i.origin?{origin:i.origin}:{}}),i},u=async(g)=>{g.preventDefault(),V(null);let n=P==="at"?new Date(v):null;if(n&&Number.isNaN(n.getTime())){V("Pick a date and time, or make it as of now.");return}if(n&&n.getTime()>Date.now()){V("A branch is made as of now or a moment before it.");return}let j=Math.round(Number(E)*3600);f(!0);let i=await y({ttl:j,...n?{at:{instant:n.toISOString()}}:{live:!0},...k.trim()?{label:k.trim()}:{}},(n??new Date).toISOString());if(f(!1),typeof i==="string"){V(i);return}M(!1),h(""),t2(`Made ${T(i.name)}`),B()},x=async(g)=>{if(!await o5({title:`Reset ${T(g.name)} to ${T(Q)}?`,body:`A fresh copy of ${T(Q)} as it is now replaces it, with the same label and the time it had left; what was written to it goes. The copy has a new address and new keys: an app, a CI job or a pull request's preview that holds this branch's must be given the new one.`,action:"Reset branch",danger:!0}))return;let n=g.expiresAt?Math.max(3600,Math.round((Date.parse(g.expiresAt)-Date.now())/1000)):86400,j=T(g.name).startsWith(`${T(Q)}-`)?T(g.name).slice(T(Q).length+1):"",i=/^([a-z0-9][a-z0-9-]*)-[0-9a-f]{4}$/.exec(j)?.[1],q1=await y({ttl:n,live:!0,...i&&!i.startsWith("at-")?{label:i}:{}},new Date().toISOString());if(typeof q1==="string"){t2(`Reset ${T(g.name)}: ${q1}`,"error");return}let Q1=await X0(U,`/-/${Q}/branches/${g.name}`,{method:"DELETE"}).catch(()=>null);if(Q1?.ok)PJ(g.name);t2(Q1?.ok?`Reset: ${T(q1.name)} is ${T(Q)} as it is now`:`Made ${T(q1.name)}; ${T(g.name)} was not removed`),B()},d=(g)=>[...X(g.name)?[{label:"Compare with parent",onSelect:()=>cX(g.name,[...g.name.split("/"),"~","changes"])}]:[],...Z?[{label:"Reset to parent…",onSelect:()=>void x(g)},{label:"Delete…",danger:!0,onSelect:()=>void z(g.name)}]:[]];return H.jsxDEV("div",{"aria-labelledby":"branches",children:[H.jsxDEV("div",{className:"branches-head",children:[H.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",H.jsxDEV("b",{children:T(Q)},void 0,!1,void 0,this),". A branch made here opens read-only in this tab; its parent removes it."]},void 0,!0,void 0,this),Z?H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{V(null),b(U9(new Date().toISOString())),M(!0)},children:"New branch"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),W?H.jsxDEV("p",{role:"status",children:W},void 0,!1,void 0,this):null,H.jsxDEV(B5,{load:K,what:"the branches"},void 0,!1,void 0,this),K.state==="ok"?H.jsxDEV("div",{className:"block",children:[H.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this),H.jsxDEV("th",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:[H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:[H.jsxDEV("b",{children:K.data.checkedOut??T(Q)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"badge",children:K.data.checkedOut?"served here":"default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this),H.jsxDEV("td",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.map((g)=>{let n=d(g);return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("b",{children:T(g.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:T(Q)},void 0,!1,void 0,this),H.jsxDEV("td",{children:g.at?.instant?H.jsxDEV(h0,{iso:g.at.instant},void 0,!1,void 0,this):"when it was made"},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV(h0,{iso:g.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:g.expiresAt?H.jsxDEV(h0,{iso:g.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num row-actions",children:[X(g.name)?H.jsxDEV("button",{type:"button","aria-label":`Open ${g.name}`,onClick:()=>cX(g.name,g.name.split("/")),children:"Open"},void 0,!1,void 0,this):H.jsxDEV("span",{className:"mode",title:"Its token was handed to whoever made it",children:"opened by whoever made it"},void 0,!1,void 0,this),n.length?H.jsxDEV(xX,{label:`More for ${T(g.name)}`,items:n},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},g.name,!0,void 0,this)})]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.length===0?H.jsxDEV("p",{className:"mode pad",children:"No snapshots yet."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,K.state==="ok"&&(K.data.named?.length??0)>0?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"lede",children:["This World's own branches (",H.jsxDEV("code",{children:"volter world branch"},void 0,!1,void 0,this),"). One runs at a time; ",K.data.canServe?H.jsxDEV(H.Fragment,{children:"“Serve here” stops this one's twins and serves that one in its place."},void 0,!1,void 0,this):H.jsxDEV(H.Fragment,{children:["this host serves one of them; another is served by ",H.jsxDEV("code",{children:"volter world checkout <branch>"},void 0,!1,void 0,this)," where the World lives, then serving again."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_1?H.jsxDEV("p",{role:"alert",children:_1},void 0,!1,void 0,this):null,H.jsxDEV("div",{className:"block",children:H.jsxDEV("table",{className:"dense","aria-label":"World branches",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Branch"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"State"},void 0,!1,void 0,this),H.jsxDEV("th",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:K.data.named.map((g)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:[H.jsxDEV("b",{children:g.name},void 0,!1,void 0,this),g.name===K.data.checkedOut?H.jsxDEV(H.Fragment,{children:[" ",H.jsxDEV("span",{className:"badge",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("td",{className:"mode",children:g.running?"running":"stopped"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num row-actions",children:Z&&K.data.canServe&&g.name!==K.data.checkedOut?H.jsxDEV("button",{type:"button",disabled:a!==null,onClick:()=>void J1(g.name),children:a===g.name?"Switching…":"Serve here"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},g.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV(S8,{open:L,onClose:()=>{if(!I)M(!1)},title:`New branch of ${T(Q)}`,footer:H.jsxDEV(H.Fragment,{children:[H.jsxDEV("button",{type:"button",onClick:()=>M(!1),disabled:I,children:"Cancel"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",form:"new-branch",className:"primary",disabled:I,children:I?"Making…":"Make branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:H.jsxDEV("form",{id:"new-branch",onSubmit:(g)=>void u(g),className:"stack",children:[H.jsxDEV("label",{children:[H.jsxDEV("span",{children:["Name ",H.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("input",{name:"branchLabel",value:k,onChange:(g)=>h(g.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),H.jsxDEV("fieldset",{className:"choice",children:[H.jsxDEV("legend",{children:"As of"},void 0,!1,void 0,this),H.jsxDEV("label",{className:"check",children:[H.jsxDEV("input",{type:"radio",name:"branchWhen",checked:P==="now",onChange:()=>C("now")},void 0,!1,void 0,this)," ",H.jsxDEV("span",{children:"Now: the World as it is, its clock running on"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{className:"check",children:[H.jsxDEV("input",{type:"radio",name:"branchWhen",checked:P==="at",onChange:()=>C("at")},void 0,!1,void 0,this)," ",H.jsxDEV("span",{children:"A moment before now: the World as it was then, its clock stopped there"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P==="at"?H.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:v,max:U9(new Date().toISOString()),onChange:(g)=>b(g.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("label",{children:[H.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),H.jsxDEV("select",{name:"branchLife",value:E,onChange:(g)=>p(g.target.value),children:[H.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),H.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),H.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),H.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),D?H.jsxDEV("p",{role:"alert",children:D},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)}function CV({name:Q,token:U,twins:Z,session:K,retry:X,selected:W}){let z=L5(U,`/-/${Q}/map`),B=Z.state==="ok"?Z.data.twins:[],O=(L)=>{let M=z.state==="ok"?z.data.twins.find((f)=>f.twin===L):void 0;if(!M)return"";let I=[...M.resources].filter((f)=>f.count>0).sort((f,D)=>D.count-f.count);return I.length===0?"nothing yet":I.slice(0,3).map((f)=>J9(f.count,f.type)).join(" · ")+(I.length>3?" · …":"")},T=(L)=>z.state==="ok"?z.data.twins.find((M)=>M.twin===L)?.root?.url??null:null,R=B.find((L)=>L.twin===W);if(!R)return Z.state==="ok"?H.jsxDEV("p",{className:"mode",children:["This World has no vendor named ",W,". ",H.jsxDEV("a",{href:`${q0}/${Q}/~/canvas`,onClick:(L)=>{L.preventDefault(),v0([...Q.split("/"),"~","canvas"])},children:"All screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV(B5,{load:Z,what:"the vendors"},void 0,!1,void 0,this);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV(B5,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"&&B.length===0?H.jsxDEV("p",{children:"No vendors in this World yet."},void 0,!1,void 0,this):null,R?H.jsxDEV("div",{className:"vendors",children:H.jsxDEV("div",{className:"stage",children:[H.jsxDEV("div",{className:"stage-bar",children:[H.jsxDEV(A5,{vendor:R.twin},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:[O(R.twin)||"empty",T(R.twin)?` · connected to ${T(R.twin)}`:" · stand-in"]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"stage-actions",children:[B.filter((L)=>L.mirror).length>1?H.jsxDEV("a",{className:"button",href:`${q0}/${Q}/~/vendors`,onClick:(L)=>{L.preventDefault(),v0([...Q.split("/"),"~","vendors"])},children:"All vendors"},void 0,!1,void 0,this):null,R.mirror?H.jsxDEV("a",{className:"button",href:D8(Q,R.twin),target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${F0(R.twin)} in a new tab`,children:"Open in new tab ↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K.state==="ok"&&K.scope==="read"?H.jsxDEV("p",{className:"mode stage-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,K.state==="pending"?H.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,K.state==="error"?H.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",K.error," ",H.jsxDEV("button",{type:"button",onClick:X,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,K.state==="ok"?R.mirror?H.jsxDEV("iframe",{title:`${R.twin} mirror`,src:D8(Q,R.twin)},R.twin,!1,void 0,this):H.jsxDEV("p",{className:"empty",children:[F0(R.twin)," has no screens here yet. What your app did there is in ",H.jsxDEV("a",{href:`${q0}/${Q}/~/activity`,onClick:(L)=>{L.preventDefault(),v0([...Q.split("/"),"~","activity"])},children:"Activity"},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):null]},void 0,!0,void 0,this)}function SV(Q){let U=[];for(let Z of Q){let K=U[U.length-1];if(K&&(K[0].operation??K[0].op)===(Z.operation??Z.op))K.push(Z);else U.push([Z])}return U}function jV(Q){let U=[];for(let Z of Q){let K=U[U.length-1],X=Array.isArray(K)?K[0]:K;if(X&&X.twin===Z.twin&&(X.entry.operation??X.entry.op)===(Z.entry.operation??Z.entry.op))if(Array.isArray(K))K.push(Z);else U[U.length-1]=[X,Z];else U.push(Z)}return U.flatMap((Z)=>Array.isArray(Z)&&Z.length<3?Z:[Z])}var VV=50,E4=(Q)=>`${Q.twin}:${Q.position}`,dR=(Q,U)=>Date.parse(U.entry.occurredAt)-Date.parse(Q.entry.occurredAt)||Q.twin.localeCompare(U.twin)||U.position-Q.position;function kV(Q){let U=[];for(let Z of Q){let K=new Date(Z.entry.occurredAt),X=K.toDateString(),W=U[U.length-1];if(!W||W.day!==X)W={day:X,label:K.toLocaleDateString(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric"}),instants:[]},U.push(W);let z=W.instants[W.instants.length-1];if(z&&Date.parse(z.at)===K.getTime())z.items.push(Z);else W.instants.push({at:Z.entry.occurredAt,items:[Z]})}return U}function yR({name:Q,p:U}){let Z=U.entry,K=gR(Z.traceparent),X=n5(Z),W=LV(Z);return H.jsxDEV("li",{className:"entry",title:`${Z.operation??Z.op} ${Z.subject.type}:${Z.subject.id} · ${mR(Z)} · ${nq(Z)}`,children:[H.jsxDEV("span",{className:"twin-chip",children:[H.jsxDEV(A5,{vendor:U.twin},void 0,!1,void 0,this),F0(U.twin)]},void 0,!0,void 0,this),H.jsxDEV("span",{className:"op",children:X.what},void 0,!1,void 0,this),X.label?H.jsxDEV("span",{className:"label",children:["“",X.label,"”"]},void 0,!0,void 0,this):H.jsxDEV("code",{className:"subject",children:aq(Z)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"actor mode",children:oq(Z,U.twin)},void 0,!1,void 0,this),W?H.jsxDEV("span",{className:"standing",children:W},void 0,!1,void 0,this):null,K?H.jsxDEV("a",{className:"trace-link",href:`${q0}/${Q}/~/trace/${K.trace}`,"aria-label":`View trace ${K.trace.slice(0,8)}`,onClick:(z)=>{z.preventDefault(),v0([...Q.split("/"),"~","trace",K.trace])},children:"trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function DV({name:Q,token:U,vendors:Z}){let[K,X]=B1.useState(null),[W,z]=B1.useState(null),[B,O]=B1.useState(null),[T,R]=B1.useState(null),[L,M]=B1.useState(!1),[I,f]=B1.useState(null),[D,V]=B1.useState({items:[],gap:null}),k=B1.useCallback((E)=>`/-/${Q}/timeline?limit=${VV}${K?`&twin=${encodeURIComponent(K)}`:""}${E?`&before=${encodeURIComponent(E)}`:""}`,[Q,K]),h=B1.useRef(null);h.current=W,B1.useEffect(()=>{let E=!0;z(null),R(null),V({items:[],gap:null}),(async()=>{let a=await X0(U,k());if(!E)return;if(!a.ok){R(await z5(a));return}let m=await a.json();if(!E)return;z(m.entries),O(m.next)})().catch((a)=>{if(E)R(`the World did not answer: ${a instanceof Error?a.message:String(a)}`)});let p=setInterval(()=>{let a=h.current;if(a===null||document.hidden)return;X0(U,k()).then(async(m)=>{if(!m.ok||!E)return;let _1=await m.json();if(!E)return;if(a.length===0){if(_1.entries.length)z(_1.entries),O(_1.next);return}let $1=new Set((h.current??a).map(E4)),J1=_1.entries.filter((y)=>!$1.has(E4(y)));V({items:J1,gap:J1.length===_1.entries.length&&_1.next?_1:null})}).catch(()=>null)},3000);return()=>{E=!1,clearInterval(p)}},[U,k]);let P=()=>{if(D.gap)z(D.gap.entries),O(D.gap.next);else z((E)=>[...D.items,...E??[]].sort(dR));V({items:[],gap:null})},C=async()=>{if(!B)return;M(!0),f(null);try{let E=await X0(U,k(B));if(!E.ok){f(await z5(E));return}let p=await E.json();z((a)=>{let m=new Set((a??[]).map(E4));return[...a??[],...p.entries.filter((_1)=>!m.has(E4(_1)))]}),O(p.next)}catch(E){f(`the World did not answer: ${E instanceof Error?E.message:String(E)}`)}finally{M(!1)}},v=B1.useMemo(()=>kV(W??[]),[W]),b=D.items.length;return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("div",{role:"group","aria-label":"Filter by twin",className:"chips",children:[H.jsxDEV("button",{type:"button","aria-pressed":K===null,onClick:()=>X(null),children:"All vendors"},void 0,!1,void 0,this),Z.map((E)=>H.jsxDEV("button",{type:"button","aria-pressed":K===E,"aria-label":E,onClick:()=>X(K===E?null:E),children:F0(E)},E,!1,void 0,this))]},void 0,!0,void 0,this),H.jsxDEV("div",{"aria-live":"polite",className:"pill-slot",children:b>0?H.jsxDEV("button",{type:"button",className:"pill",onClick:P,children:[D.gap?`${b}+`:b," new change",b===1?"":"s"," — show"]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),T?H.jsxDEV("p",{role:"alert",children:["Could not read the timeline: ",T]},void 0,!0,void 0,this):W===null?H.jsxDEV("p",{className:"mode",role:"status",children:"Loading the timeline…"},void 0,!1,void 0,this):W.length===0?K?H.jsxDEV("p",{children:["Nothing has happened in ",K," yet."]},void 0,!0,void 0,this):H.jsxDEV("div",{className:"empty",children:[H.jsxDEV("p",{children:H.jsxDEV("strong",{children:"Nothing has happened in this World yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["An entry arrives each time something changes a twin: an app (or a seed script) calling a twin's API at ",H.jsxDEV("code",{children:[w6,"/",Q,"/<twin>"]},void 0,!0,void 0,this),", a mirror's form, a changeset landing. They show here within a few seconds."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):H.jsxDEV("div",{className:"feed","aria-label":"Timeline",children:[v.map((E)=>H.jsxDEV("div",{role:"group","aria-label":E.label,className:"day",children:[H.jsxDEV("h3",{className:"day-head",children:E.label},void 0,!1,void 0,this),H.jsxDEV("ol",{className:"instants",children:E.instants.map((p)=>H.jsxDEV("li",{className:"instant",children:[H.jsxDEV("div",{className:"instant-time",title:p.items.length>1?"These happened at the same moment of the World's clock: their order across vendors is not known.":void 0,children:H.jsxDEV(h0,{iso:p.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("ul",{className:"entries",children:jV(p.items).map((a)=>Array.isArray(a)?H.jsxDEV("li",{className:"entry run",children:H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[H.jsxDEV("span",{className:"twin-chip",children:[H.jsxDEV(A5,{vendor:a[0].twin},void 0,!1,void 0,this),F0(a[0].twin)]},void 0,!0,void 0,this)," ",H.jsxDEV("span",{className:"op",children:[J9(a.length,a[0].entry.subject.type)," ",n5(a[0].entry).what.split(" ").slice(-1)[0]]},void 0,!0,void 0,this)," ",H.jsxDEV("span",{className:"actor mode",children:oq(a[0].entry,a[0].twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{className:"entries",children:a.map((m)=>H.jsxDEV(yR,{name:Q,p:m},E4(m),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},E4(a[0]),!1,void 0,this):H.jsxDEV(yR,{name:Q,p:a},E4(a),!1,void 0,this))},void 0,!1,void 0,this)]},`${p.at}:${E4(p.items[0])}`,!0,void 0,this))},void 0,!1,void 0,this)]},E.day,!0,void 0,this)),B?H.jsxDEV("button",{type:"button",onClick:()=>void C(),disabled:L,"aria-busy":L,children:"Load older"},void 0,!1,void 0,this):H.jsxDEV("p",{className:"mode",children:["The beginning of this World",K?`'s ${K}`:"","."]},void 0,!0,void 0,this),I?H.jsxDEV("p",{role:"alert",children:["Could not load older changes: ",I]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function yV({name:Q,token:U,id:Z}){let K=/^[0-9a-f]{32}$/.test(Z),X=L5(U,K?`/-/${Q}/timeline?trace=${Z}&limit=500`:null),W=X.state==="ok"?[...X.data.entries].sort((T,R)=>-dR(T,R)):[],z=[...new Set(W.map((T)=>T.twin))],B=W[0]?Date.parse(W[0].entry.occurredAt):0,O=H.jsxDEV("a",{href:`${q0}/${Q}/~/timeline`,onClick:(T)=>{T.preventDefault(),v0([...Q.split("/"),"~","timeline"])},children:"← Timeline"},void 0,!1,void 0,this);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{children:O},void 0,!1,void 0,this),H.jsxDEV("h3",{children:["Trace ",H.jsxDEV("code",{children:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!K?H.jsxDEV("p",{role:"alert",children:[Z?`${Z} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):H.jsxDEV(B5,{load:X,what:"the trace"},void 0,!1,void 0,this),X.state==="ok"&&W.length===0?H.jsxDEV("div",{className:"empty",children:[H.jsxDEV("p",{children:H.jsxDEV("strong",{children:"Nothing in this World carries this trace."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["Causes are followed through the W3C ",H.jsxDEV("code",{children:"traceparent"},void 0,!1,void 0,this)," header: an app instrumented with OpenTelemetry sends it with each call, and every entry that call writes keeps it — so one click in the app can be read across Stripe, Slack and the rest. Without it the World knows the order of what happened, not what caused what."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,W.length>0?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:[W.length," step",W.length===1?"":"s"," across ",z.length," twin",z.length===1?"":"s",X.state==="ok"&&X.data.next?" · the first 500 shown":""]},void 0,!0,void 0,this),H.jsxDEV("div",{role:"table","aria-label":"Trace waterfall",className:"waterfall",style:{gridTemplateColumns:`minmax(130px, auto) repeat(${z.length}, minmax(140px, 1fr))`},children:[H.jsxDEV("div",{role:"row",className:"wf-row wf-head",children:[H.jsxDEV("span",{role:"columnheader",children:"time"},void 0,!1,void 0,this),z.map((T)=>H.jsxDEV("span",{role:"columnheader",children:T},T,!1,void 0,this))]},void 0,!0,void 0,this),W.map((T)=>{let R=Date.parse(T.entry.occurredAt)-B,L=gR(T.entry.traceparent)?.span;return H.jsxDEV("div",{role:"row",className:"wf-row",children:[H.jsxDEV("span",{role:"cell",className:"wf-time",children:[H.jsxDEV(h0,{iso:T.entry.occurredAt,time:!0},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:["+",R," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.map((M)=>H.jsxDEV("span",{role:"cell",className:M===T.twin?"wf-cell on":"wf-cell",children:M===T.twin?H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[T.entry.operation??T.entry.op," ",H.jsxDEV("code",{children:[T.entry.subject.type,":",T.entry.subject.id]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"mode",children:[mR(T.entry)," · ",nq(T.entry)," · position ",T.position,L?H.jsxDEV(H.Fragment,{children:[" · span ",H.jsxDEV("code",{children:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV(iR,{fields:T.entry.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},M,!1,void 0,this))]},E4(T),!0,void 0,this)})]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function iR({fields:Q}){let U=Object.entries(Q??{});if(U.length===0)return H.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return H.jsxDEV("dl",{className:"fields",children:U.map(([Z,K])=>H.jsxDEV(B1.default.Fragment,{children:[H.jsxDEV("dt",{children:Z},void 0,!1,void 0,this),H.jsxDEV("dd",{children:H.jsxDEV("code",{children:typeof K==="string"?K:JSON.stringify(K)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Z,!0,void 0,this))},void 0,!1,void 0,this)}var sq=1280,tq=820,vR=160;function vV({data:Q}){let{world:U,vendor:Z,active:K,open:X}=Q;return H.jsxDEV(H.Fragment,{children:[H.jsxDEV(WR,{isVisible:!0,position:C1.Top,align:"start",className:"frame-label",children:[H.jsxDEV(A5,{vendor:Z},void 0,!1,void 0,this),H.jsxDEV("span",{children:F0(Z)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:K?"frame on":"frame",style:{width:sq,height:tq},children:[H.jsxDEV("div",{className:"frame-bar",title:"Drag to move",children:[H.jsxDEV(A5,{vendor:Z},void 0,!1,void 0,this),H.jsxDEV("strong",{children:F0(Z)},void 0,!1,void 0,this),H.jsxDEV("span",{className:"frame-url",children:D8(U,Z).replace(/^https?:\/\//,"")},void 0,!1,void 0,this),H.jsxDEV("a",{className:"nodrag",href:`${q0}/${U}/~/vendors/${Z}`,onClick:(W)=>{W.preventDefault(),X(Z)},children:"Open"},void 0,!1,void 0,this),H.jsxDEV("a",{className:"nodrag",href:D8(U,Z),target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${F0(Z)} in a new tab`,children:"↗"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:K?"frame-body nodrag nopan nowheel":"frame-body",children:H.jsxDEV("iframe",{title:`${Z} mirror`,src:D8(U,Z),loading:"lazy",style:{pointerEvents:K?"auto":"none"}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var EV={screen:vV};function bV(Q){return H.jsxDEV(kX,{children:H.jsxDEV(uV,{...Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function uV({name:Q,twins:U,session:Z,retry:K,snapshot:X,back:W}){let z=U.state==="ok"?U.data.twins.filter((E)=>E.mirror).map((E)=>E.twin):[],B=`volter.canvas.${Q}`,[O,T]=B1.useState(null),[R,L]=B1.useState(!0),M=OJ(),I=B1.useCallback((E)=>v0([...Q.split("/"),"~","vendors",E]),[Q]),f=Math.max(1,Math.ceil(Math.sqrt(z.length))),D=B1.useCallback(()=>{let E={};try{E=JSON.parse(localStorage.getItem(B)??"{}")}catch{}return z.map((p,a)=>({id:p,type:"screen",dragHandle:".frame-bar",position:E[p]??{x:a%f*(sq+vR),y:Math.floor(a/f)*(tq+vR)},data:{world:Q,vendor:p,active:!1,open:I}}))},[z.join(","),Q,f,I]),[V,k,h]=GR([]);B1.useEffect(()=>{k(D())},[D,k]),B1.useEffect(()=>{k((E)=>E.map((p)=>p.data.active===(p.id===O)?p:{...p,data:{...p.data,active:p.id===O}}))},[O,k]),B1.useEffect(()=>{let E=(p)=>{if(p.key==="Escape")T(null)};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[]);let P=()=>{try{localStorage.setItem(B,JSON.stringify(Object.fromEntries(V.map((E)=>[E.id,E.position]))))}catch{}},C=(E)=>{T(E);let p=M.getNode(E);if(!p)return;let a=Math.min((window.innerWidth-300)/sq,(window.innerHeight-120)/tq,1);M.setCenter(p.position.x+sq/2-130/a,p.position.y+tq/2,{zoom:a,duration:400})},v=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,b=Z.state==="ok"&&U.state==="ok";return H.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"Every vendor's screens",children:H.jsxDEV(UR,{nodes:b?V:[],onNodesChange:h,nodeTypes:EV,onNodeDragStop:P,onNodeClick:(E,p)=>T(p.id),onPaneClick:()=>T(null),fitView:!0,fitViewOptions:{padding:{top:"64px",left:"272px",right:"32px",bottom:"32px"}},minZoom:0.05,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!1,zoomOnDoubleClick:!1,colorMode:v?"dark":"light",proOptions:{hideAttribution:!0},children:[H.jsxDEV(FR,{variant:v4.Dots,gap:28,size:1.4},void 0,!1,void 0,this),H.jsxDEV(N8,{position:"top-left",className:"float layers",children:[H.jsxDEV("div",{className:"float-head",children:[H.jsxDEV("button",{type:"button",className:"back",onClick:W,"aria-label":`Back to ${Q}`,children:"←"},void 0,!1,void 0,this),H.jsxDEV("span",{className:"float-title",children:[H.jsxDEV("strong",{children:Q.split("/")[1]},void 0,!1,void 0,this),H.jsxDEV("span",{className:"mode",children:[Q.split("/")[0],X?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("button",{type:"button",className:"ghost","aria-expanded":R,"aria-label":R?"Hide the screens list":"Show the screens list",onClick:()=>L(!R),children:R?"▾":"▸"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?H.jsxDEV("ul",{className:"layer-list","aria-label":"Screens",children:[z.map((E)=>H.jsxDEV("li",{children:H.jsxDEV("button",{type:"button",className:O===E?"on":void 0,onClick:()=>C(E),children:[H.jsxDEV(A5,{vendor:E},void 0,!1,void 0,this),H.jsxDEV("span",{children:F0(E)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},E,!1,void 0,this)),U.state==="ok"&&z.length===0?H.jsxDEV("li",{className:"mode",children:"No vendor in this World has screens."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,H.jsxDEV(B5,{load:U,what:"the vendors"},void 0,!1,void 0,this),Z.state==="pending"?H.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,Z.state==="error"?H.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",Z.error," ",H.jsxDEV("button",{type:"button",onClick:K,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV(N8,{position:"top-center",className:"float hint mode",children:O?`Using ${F0(O)} · Esc to leave`:"Drag to pan · scroll to zoom · click a screen to use it"},void 0,!1,void 0,this),H.jsxDEV(XR,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),H.jsxDEV(YR,{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 aR=(Q)=>{let U=new Map;for(let Z of Q.actions)U.set(Z.service,[...U.get(Z.service)??[],{...Z.action,service:Z.service,op:Z.action.op??Z.action.operation??""}]);return[...U.entries()]};function sR(Q){if(Q.applied)return Q.applied.outcome==="applied"?{label:"Deployed",tone:"done"}:Q.applied.outcome==="partial"?{label:"Partly deployed",tone:"warn"}:{label:"Deploy refused",tone:"bad"};let U=Q.currentHash??Q.contentHash,Z=Q.approvals.filter((X)=>X.contentHash===U).length,K=Q.verification&&Q.verification.contentHash===U?Q.verification:null;if(K&&!K.passed)return{label:"Checks failed",tone:"bad"};if(Z>0)return{label:`Approved by ${Z}`,tone:"good"};if(K)return{label:"Verified",tone:"good"};return{label:"Not verified",tone:"plain"}}function xV({name:Q,token:U,signsAs:Z,canWrite:K,rooted:X,open:W,refused:z}){let[B,O]=B1.useState(0),T=L5(U,`/-/${Q}/changesets`,B),R=(M)=>(I)=>{I.preventDefault(),v0([...Q.split("/"),"~","changesets",M])};if(W){let M=T.state==="ok"?T.data.changesets.find((I)=>I.name===W):void 0;return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"crumbs-line",children:H.jsxDEV("a",{href:`${q0}/${Q}/~/changesets`,onClick:(I)=>{I.preventDefault(),v0([...Q.split("/"),"~","changesets"])},children:"← Changesets"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV(B5,{load:T,what:"the changesets"},void 0,!1,void 0,this),T.state==="ok"&&!M?H.jsxDEV("p",{className:"mode",children:["This World has no changeset named ",W,"."]},void 0,!0,void 0,this):null,M?H.jsxDEV(hV,{name:Q,token:U,signsAs:Z,c:M,canWrite:K,rooted:X,refused:z,onChanged:()=>O((I)=>I+1)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}let L=T.state==="ok"?[...T.data.changesets].sort((M,I)=>I.createdAt.localeCompare(M.createdAt)):[];return H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"lede",children:"A changeset is what this World changed, cut into a piece a person reviews: what it does at each vendor, the World's checks over it, and who approved it. Where the World has a real account behind a vendor, an approved changeset deploys there, with a receipt for each change."},void 0,!1,void 0,this),H.jsxDEV(B5,{load:T,what:"the changesets"},void 0,!1,void 0,this),T.state==="ok"&&L.length===0?H.jsxDEV(wR,{title:"No changesets yet",children:H.jsxDEV("p",{children:["Cut one from what your app did in this World: ",H.jsxDEV("code",{children:'volter world changeset -m "What it does and why"'},void 0,!1,void 0,this),". Pushed to a shared World, it shows up here for review."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,L.length>0?H.jsxDEV("div",{className:"block",children:H.jsxDEV("table",{className:"dense","aria-label":"Changesets",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Changeset"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Changes"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Status"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:L.map((M)=>{let I=sR(M),f=aR(M).map(([D,V])=>`${V.length} at ${F0(D)}`).join(" · ");return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:[H.jsxDEV("a",{href:`${q0}/${Q}/~/changesets/${M.name}`,onClick:R(M.name),children:H.jsxDEV("b",{children:M.message??M.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),M.message?H.jsxDEV("span",{className:"mode mono",children:[" ",M.name]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("td",{className:"mode",children:f||"nothing"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:H.jsxDEV(h0,{iso:M.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("span",{className:`badge cs-${I.tone}`,children:I.label},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},M.name,!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)}function hV({name:Q,token:U,signsAs:Z,c:K,canWrite:X,rooted:W,refused:z,onChanged:B}){let[O,T]=B1.useState(null),[R,L]=B1.useState(!1),[M,I]=B1.useState(""),[f,D]=B1.useState(""),V=sR(K),k=aR(K),h=k.map(([m])=>m),P=h.some((m)=>W.includes(m)),C=(m)=>m===(K.currentHash??K.contentHash),v=async(m,_1,$1,J1)=>{T(m);try{let y=await X0(U,_1,{method:"POST",...$1===void 0?{}:{body:JSON.stringify($1)}});if(!y.ok)return z(y),t2(`${m}: ${await z5(y)}`,"error"),!1;if(J1)t2(J1);return B(),!0}catch(y){return t2(`${m}: the World did not answer (${y instanceof Error?y.message:String(y)})`,"error"),!1}finally{T(null)}},b=()=>{v("Verify",`/-/${Q}/changesets/${K.name}/verify`,void 0,"Verified: the checks ran over it")},E=async(m)=>{if(m.preventDefault(),await v("Approve",`/-/${Q}/changesets/${K.name}/approve`,{...M.trim()?{note:M.trim()}:{},...Z===null&&f.trim()?{as:f.trim()}:{}},"Approved"))L(!1),I("")},p=async()=>{if(!await o5({title:`Deploy ${K.name} to the real vendors?`,body:H.jsxDEV(H.Fragment,{children:["It performs its ",K.actions.length," change",K.actions.length===1?"":"s"," against the real account",h.filter((m)=>W.includes(m)).length===1?"":"s"," behind ",EX(h.filter((m)=>W.includes(m)).map(F0)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:K.name}))return;v("Deploy",`/-/${Q}/deploy/${K.name}`,{confirm:K.name},"Deployed: the receipts are below")},a=!X?"This session reads the World; it changes nothing":K.applied?"Already deployed":null;return H.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[H.jsxDEV("div",{className:"changeset-head",children:[H.jsxDEV("div",{children:[H.jsxDEV("h3",{id:"changeset-title",children:[K.message??K.name," ",H.jsxDEV("span",{className:`badge cs-${V.tone}`,children:V.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("p",{className:"mode",children:[H.jsxDEV("code",{children:K.name},void 0,!1,void 0,this)," · made ",H.jsxDEV(h0,{iso:K.createdAt},void 0,!1,void 0,this)," · ",K.actions.length," change",K.actions.length===1?"":"s"," at ",EX(h.map(F0))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("div",{className:"changeset-actions",children:[H.jsxDEV("button",{type:"button",onClick:b,disabled:Boolean(a)||O!==null,title:a??"Replay it in a throwaway World and run the World's checks",children:O==="Verify"?"Verifying…":"Verify"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"button",onClick:()=>L(!0),disabled:Boolean(a)||O!==null,title:a??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),P?H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void p(),disabled:Boolean(a)||O!==null,title:a??"Perform it against the real accounts behind this World",children:O==="Deploy"?"Deploying…":"Deploy…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a&&!K.applied?H.jsxDEV("p",{className:"mode",children:[a,"."]},void 0,!0,void 0,this):null,!P&&!K.applied?H.jsxDEV("p",{className:"mode",children:"It stays in this World: no vendor it changes has a real account behind it here (a shared World with a root deploys; see Settings › Real services)."},void 0,!1,void 0,this):null,K.narration?H.jsxDEV("p",{className:"narration",children:K.narration},void 0,!1,void 0,this):null,H.jsxDEV("h4",{children:"Changes"},void 0,!1,void 0,this),k.length===0?H.jsxDEV("p",{className:"mode",children:"It changes nothing."},void 0,!1,void 0,this):H.jsxDEV(tR,{groups:k,idPrefix:`cs-${K.name}`},void 0,!1,void 0,this),H.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!K.verification?H.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):H.jsxDEV("div",{className:C(K.verification.contentHash)?"":"stale",children:[H.jsxDEV("p",{children:[K.verification.passed?"✓ Passed":"✗ Failed"," · ",H.jsxDEV(h0,{iso:K.verification.at},void 0,!1,void 0,this),C(K.verification.contentHash)?null:H.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),K.verification.results.length?H.jsxDEV("ul",{className:"checks",children:K.verification.results.map((m)=>H.jsxDEV("li",{children:[m.passed?"✓":"✗"," ",H.jsxDEV("code",{children:m.id},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:F0(m.service)},void 0,!1,void 0,this)]},m.id,!0,void 0,this))},void 0,!1,void 0,this):null,K.verification.refusals?.length?H.jsxDEV("ul",{className:"checks",children:K.verification.refusals.map((m,_1)=>H.jsxDEV("li",{children:["✗ ",H.jsxDEV("code",{children:m.check},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[F0(m.service),": ",m.reason]},void 0,!0,void 0,this)]},_1,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),K.approvals.length===0?H.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):H.jsxDEV("ul",{className:"approvals",children:K.approvals.map((m,_1)=>H.jsxDEV("li",{children:[H.jsxDEV("b",{children:m.principal},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[H.jsxDEV(h0,{iso:m.at},void 0,!1,void 0,this),C(m.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),m.note?H.jsxDEV("div",{className:"mode",children:["“",m.note,"”"]},void 0,!0,void 0,this):null]},_1,!0,void 0,this))},void 0,!1,void 0,this),K.applied?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("h4",{children:"Deployed"},void 0,!1,void 0,this),H.jsxDEV("p",{children:[K.applied.outcome==="applied"?"Every change reached the real vendors":K.applied.outcome==="partial"?"Some changes reached the real vendors":"The deploy was refused"," · ",H.jsxDEV(h0,{iso:K.applied.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K.applied.refusal?.length?H.jsxDEV("ul",{className:"checks",children:K.applied.refusal.map((m,_1)=>H.jsxDEV("li",{className:"mode",children:m},_1,!1,void 0,this))},void 0,!1,void 0,this):null,K.applied.receipts.length?H.jsxDEV("ul",{className:"receipts",children:K.applied.receipts.map((m)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{className:m.status==="failed"?"badge cs-bad":"badge cs-done",children:m.status},void 0,!1,void 0,this)," ",F0(m.service)," ",m.url?H.jsxDEV("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",children:m.externalId??m.url},void 0,!1,void 0,this):m.externalId?H.jsxDEV("code",{children:m.externalId},void 0,!1,void 0,this):null,m.error?H.jsxDEV("span",{className:"mode",children:[" · ",m.error]},void 0,!0,void 0,this):null]},m.actionId,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,H.jsxDEV(S8,{open:R,onClose:()=>{if(!O)L(!1)},title:`Approve ${K.name}`,footer:H.jsxDEV(H.Fragment,{children:[H.jsxDEV("button",{type:"button",onClick:()=>L(!1),disabled:O!==null,children:"Cancel"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",form:"approve-changeset",className:"primary",disabled:O!==null,children:O==="Approve"?"Approving…":"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:H.jsxDEV("form",{id:"approve-changeset",onSubmit:(m)=>void E(m),className:"stack",children:[H.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",Z?H.jsxDEV(H.Fragment,{children:[", recorded as ",H.jsxDEV("b",{children:Z},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),Z===null?H.jsxDEV("label",{children:[H.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),H.jsxDEV("input",{name:"approveAs",value:f,onChange:(m)=>D(m.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),H.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,H.jsxDEV("label",{children:[H.jsxDEV("span",{children:["Note ",H.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("textarea",{name:"approveNote",value:M,onChange:(m)=>I(m.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)}function tR({groups:Q,idPrefix:U}){return H.jsxDEV(H.Fragment,{children:Q.map(([Z,K])=>H.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${U}-${Z}`,children:[H.jsxDEV("h3",{id:`${U}-${Z}`,className:"vendor-cell",children:[H.jsxDEV(A5,{vendor:Z},void 0,!1,void 0,this),F0(Z)," ",H.jsxDEV("span",{className:"mode",children:["· ",K.length," change",K.length===1?"":"s"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{children:SV(K).map((X)=>X.length>=3?H.jsxDEV("li",{children:H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[H.jsxDEV("span",{className:"op",children:[J9(X.length,X[0].subject.type)," ",n5(X[0]).what.split(" ").slice(-1)[0]]},void 0,!0,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[X.map((W)=>n5(W).label??aq(W)).slice(0,4).join(", "),X.length>4?", …":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("ul",{children:X.map((W)=>H.jsxDEV("li",{children:[H.jsxDEV("span",{className:"op",children:n5(W).what},void 0,!1,void 0,this)," ",n5(W).label?H.jsxDEV("span",{className:"label",children:["“",n5(W).label,"”"]},void 0,!0,void 0,this):H.jsxDEV("code",{children:aq(W)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[H.jsxDEV(h0,{iso:W.occurredAt},void 0,!1,void 0,this)," · ",oq(W,Z)]},void 0,!0,void 0,this)]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},X[0].id,!1,void 0,this):X.map((W)=>H.jsxDEV("li",{children:H.jsxDEV("details",{children:[H.jsxDEV("summary",{children:[H.jsxDEV("span",{className:"op",children:n5(W).what},void 0,!1,void 0,this)," ",n5(W).label?H.jsxDEV("span",{className:"label",children:["“",n5(W).label,"”"]},void 0,!0,void 0,this):H.jsxDEV("code",{children:aq(W)},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:[H.jsxDEV(h0,{iso:W.occurredAt},void 0,!1,void 0,this)," · ",oq(W,Z)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV(iR,{fields:W.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},W.id,!1,void 0,this)))},void 0,!1,void 0,this)]},Z,!0,void 0,this))},void 0,!1,void 0,this)}function mV({name:Q,token:U}){let Z=L5(U,`/-/${Q}/diff`),K=B1.useMemo(()=>{let X=new Map;if(Z.state==="ok")for(let W of Z.data.changes)X.set(W.twin,[...X.get(W.twin)??[],W.entry]);return[...X.entries()]},[Z]);return H.jsxDEV(H.Fragment,{children:[H.jsxDEV(B5,{load:Z,what:"the changes"},void 0,!1,void 0,this),Z.state==="ok"?H.jsxDEV(H.Fragment,{children:[H.jsxDEV("p",{className:"mode",children:["What this World changed since it started",Z.data.base.at?H.jsxDEV(H.Fragment,{children:[" (",H.jsxDEV(h0,{iso:Z.data.base.at},void 0,!1,void 0,this),", ",H.jsxDEV("code",{children:Z.data.base.id},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this):H.jsxDEV(H.Fragment,{children:[" (",H.jsxDEV("code",{children:Z.data.base.id},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),": ",Z.data.changes.length," change",Z.data.changes.length===1?"":"s"," at ",K.length," vendor",K.length===1?"":"s",". A changeset takes these to the real services."]},void 0,!0,void 0,this),K.length===0?H.jsxDEV("p",{className:"empty",children:["No changes since ",Z.data.base.id,Z.data.base.at?H.jsxDEV(H.Fragment,{children:[" (",H.jsxDEV(h0,{iso:Z.data.base.at},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this):H.jsxDEV(tR,{groups:K,idPrefix:"changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function gV({name:Q,token:U}){let[Z,K]=B1.useState(0),X=L5(U,`/-/${Q}/keys`,Z),[W,z]=B1.useState(!1),[B,O]=B1.useState(""),[T,R]=B1.useState("write"),[L,M]=B1.useState(!1),[I,f]=B1.useState(null),[D,V]=B1.useState(null),[k,h]=B1.useState(null),P=async()=>{let b=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,E=await X0(U,`/-/${Q}/keys`,{method:"POST",body:JSON.stringify({name:b,scope:"read"})}).catch(()=>null),p=E?await E.json().catch(()=>({})):{error:`${B0} did not answer`};if(!E?.ok||!p.key){t2(p.error??"refused","error");return}h(`${window.location.origin}${q0}/${Q}#${new URLSearchParams({token:p.key}).toString()}`),K((a)=>a+1)},C=async(b)=>{b.preventDefault(),M(!0),f(null);let E=await X0(U,`/-/${Q}/keys`,{method:"POST",body:JSON.stringify({name:B.trim(),scope:T})}).catch(()=>null);M(!1);let p=E?await E.json().catch(()=>({})):{error:`${B0} did not answer`};if(!E?.ok||!p.key){f(p.error??"refused");return}z(!1),V({key:p.key,name:B.trim()}),O(""),K((a)=>a+1)},v=async(b)=>{if(!await o5({title:`Revoke ${b.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let E=await X0(U,`/-/${Q}/keys/${b.id}`,{method:"DELETE"});if(E.ok)t2(`Revoked ${b.name}`);else t2(await z5(E),"error");K((p)=>p+1)};return H.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[H.jsxDEV("div",{className:"keys-head",children:[H.jsxDEV("div",{children:[H.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),H.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),o2()?H.jsxDEV("a",{className:"button primary",href:`${o2()}/${encodeURIComponent(Q.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):H.jsxDEV("div",{className:"head-actions",children:[H.jsxDEV("button",{type:"button",onClick:()=>void P(),children:"Share a read-only link"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{f(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),H.jsxDEV(B5,{load:X,what:"the keys",retry:()=>K((b)=>b+1)},void 0,!1,void 0,this),X.state==="ok"?X.data.keys.length===0?H.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):H.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),H.jsxDEV("th",{className:"num",children:H.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),H.jsxDEV("tbody",{children:X.data.keys.map((b)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:b.name},void 0,!1,void 0,this),H.jsxDEV("td",{children:b.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:H.jsxDEV("span",{title:IJ(b.createdAt),children:dq(b.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{className:"mode",children:b.lastUsedAt?dq(b.lastUsedAt):"never"},void 0,!1,void 0,this),H.jsxDEV("td",{className:"num",children:H.jsxDEV(xX,{label:`More for ${b.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void v(b)}]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},b.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,H.jsxDEV(S8,{open:W,onClose:()=>{if(!L)z(!1)},title:"Make a key",footer:H.jsxDEV(H.Fragment,{children:[H.jsxDEV("button",{type:"button",onClick:()=>z(!1),disabled:L,children:"Cancel"},void 0,!1,void 0,this),H.jsxDEV("button",{type:"submit",form:"make-key",disabled:L||!B.trim(),children:L?"Making…":"Make key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:H.jsxDEV("form",{id:"make-key",onSubmit:C,"aria-label":"Make a key",children:[H.jsxDEV("label",{children:["Name ",H.jsxDEV("input",{autoFocus:!0,name:"keyName",value:B,onChange:(b)=>O(b.target.value),placeholder:"ci, staging app…",maxLength:80,required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("label",{children:["Access ",H.jsxDEV("select",{value:T,onChange:(b)=>R(b.target.value==="read"?"read":"write"),children:[H.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),H.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),I?H.jsxDEV("p",{role:"alert",children:I},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV(S8,{open:Boolean(D),onClose:()=>V(null),title:`${D?.name??"The key"} is ready`,footer:H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>V(null),children:"Done"},void 0,!1,void 0,this),children:[H.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),D?H.jsxDEV(uX,{label:"Key",value:D.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV(S8,{open:Boolean(k),onClose:()=>h(null),title:"A read-only link",footer:H.jsxDEV("button",{type:"button",className:"primary",onClick:()=>h(null),children:"Done"},void 0,!1,void 0,this),children:[H.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),k?H.jsxDEV(uX,{label:"Link",value:k,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function pV({name:Q,token:U,admin:Z,canWrite:K,refused:X,onRemoved:W}){let[z,B]=B1.useState(null),[O,T]=B1.useState(null),[R,L]=B1.useState(null),[M,I]=B1.useState(null),[f,D]=B1.useState(null),V=B1.useCallback(async()=>{let C=await X0(U,`/-/${Q}/twins`);B(C.ok?(await C.json()).twins:[]);let v=await X0(U,`/-/${Q}/requests?hours=24`);D(v.ok?await v.json():null);let b=await X0(U,`/-/${Q}/changesets`);T(b.ok?(await b.json()).changesets:[])},[Q,U]);B1.useEffect(()=>{V()},[V]);let k=async(C,v,b)=>{L(null);let E=await X0(U,v,b);if(!E.ok)X(E);L(E.ok?`${C}: done`:`${C}: ${await z5(E)}`),await V()},h=async()=>{if(!await o5({title:`Rotate the tokens of ${Q}?`,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 C=await X0(Z,`/-/worlds/${Q}/rotate`,{method:"POST"});if(C.ok)I(await C.json()),L("rotated: the new tokens are shown once");else L(`rotate: answered ${C.status}`)},P=async()=>{if(!await o5({title:`Remove ${Q}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:Q}))return;let C=await X0(Z,`/-/worlds/${Q}`,{method:"DELETE"}).catch((v)=>v);if(C instanceof Error){L(`remove: the host did not answer (${C.message})`);return}if(C.ok)W();else L(`remove: answered ${C.status}`)};return H.jsxDEV(H.Fragment,{children:[R?H.jsxDEV("p",{role:"status",children:R},void 0,!1,void 0,this):null,M?H.jsxDEV("p",{role:"status",children:["token ",H.jsxDEV("code",{children:M.token},void 0,!1,void 0,this)," · read token ",H.jsxDEV("code",{children:M.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,K?H.jsxDEV(gV,{name:Q,token:U},void 0,!1,void 0,this):null,H.jsxDEV("h3",{children:"Real services"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:"Every vendor here is a stand-in. Connect one to its real service to read the real state into this World; give it the real key to send this World's changes there (a changeset's Deploy, below)."},void 0,!1,void 0,this),z===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):H.jsxDEV("table",{"aria-label":"Real services",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"vendor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"real service"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"real key"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"last read from it"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"last sent"},void 0,!1,void 0,this),K?H.jsxDEV("th",{},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:z.map((C)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:H.jsxDEV("a",{href:`${q0}/${Q}/${C.twin}`,title:`Its log and stored state · ${C.position??0} changes held${C.protocol?.major!==void 0?` · protocol ${C.protocol.major}${C.protocol.standing&&C.protocol.standing!=="current"?` (${C.protocol.standing})`:""}`:""}`,onClick:(v)=>{v.preventDefault(),v0([...Q.split("/"),C.twin])},children:F0(C.twin)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.root?.url?H.jsxDEV("code",{children:C.root.url},void 0,!1,void 0,this):H.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.credential?`sealed ${C.credential.fingerprint??""} · ${IJ(C.credential.placedAt)}`:H.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.refresh?.failed?H.jsxDEV("span",{role:"alert",children:["failed ×",C.refresh.failed.count??1,": ",C.refresh.failed.reason??""]},void 0,!0,void 0,this):C.root?IJ(C.refresh?.observedAt??C.refresh?.at):H.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.lastReceipt?`${C.lastReceipt.status??""} ${C.lastReceipt.externalId??""} ${C.lastReceipt.reason??""}`.trim():H.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K?H.jsxDEV("td",{children:[H.jsxDEV("button",{onClick:()=>void o5({title:`Read ${F0(C.twin)} now?`,body:`The real ${F0(C.twin)}'s current state is read into this World. Nothing is written to ${F0(C.twin)}.`,action:"Read from it"}).then((v)=>{if(v)k(`refresh ${C.twin}`,`/-/${Q}/twins/${C.twin}/refresh`,{method:"POST"})}),disabled:!C.root,title:"Read the real service's current state into this World",children:"Read from it"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>{let v=window.prompt(`The real ${F0(C.twin)}'s address (its API's URL); empty disconnects it`,C.root?.url??"");if(v===null)return;k(`root ${C.twin}`,`/-/${Q}/twins/${C.twin}/root`,{method:"PUT",body:JSON.stringify(v?{url:v}:null)})},title:"Connect this vendor to the real service's URL (empty disconnects it)",children:"Connect…"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>{let v=window.prompt(`The real ${F0(C.twin)} key: it is sealed beside this World and never shown again`);if(!v)return;k(`seal ${C.twin}`,`/-/${Q}/twins/${C.twin}/credential`,{method:"PUT",body:v,headers:{"content-type":"text/plain"}})},title:"Give this World the real service's key; it is sealed and never shown again",children:"Real key…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},C.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("h3",{children:"Traffic (last 24 hours)"},void 0,!1,void 0,this),f===null?H.jsxDEV("p",{className:"mode",children:"No request report for this world."},void 0,!1,void 0,this):f.requests===0?H.jsxDEV("p",{className:"mode",children:["No requests recorded in the last 24 hours. Recording is off unless the World runs with ",H.jsxDEV("code",{children:"VOLTER_TWIN_REQUEST_JOURNAL=1"},void 0,!1,void 0,this),"; what the requests changed is always in Activity."]},void 0,!0,void 0,this):H.jsxDEV("table",{"aria-label":"Requests by twin",children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"vendor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"requests"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"by status"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"p50"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"p95"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"top routes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:f.twins.map((C)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:C.twin},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.requests},void 0,!1,void 0,this),H.jsxDEV("td",{children:Object.entries(C.byStatus).map(([v,b])=>`${v}: ${b}`).join(" · ")||"—"},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.p50Ms===null?"—":`${C.p50Ms} ms`},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.p95Ms===null?"—":`${C.p95Ms} ms`},void 0,!1,void 0,this),H.jsxDEV("td",{children:C.topRoutes.slice(0,5).map((v)=>H.jsxDEV("div",{children:[H.jsxDEV("code",{children:v.route},void 0,!1,void 0,this)," ",H.jsxDEV("span",{className:"mode",children:["×",v.requests]},void 0,!0,void 0,this)]},v.route,!0,void 0,this))},void 0,!1,void 0,this)]},C.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.jsxDEV("h3",{children:"Sending changes to the real services"},void 0,!1,void 0,this),H.jsxDEV("p",{className:"mode",children:["A changeset is a set of this World's changes (",H.jsxDEV("code",{children:'volter world changeset -m "…"'},void 0,!1,void 0,this),"), verified and approved, then deployed to each connected real service."]},void 0,!0,void 0,this),O===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):O.length===0?H.jsxDEV("p",{className:"mode",children:"No changesets yet."},void 0,!1,void 0,this):H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"name"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"changes"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"approvals"},void 0,!1,void 0,this),K?H.jsxDEV("th",{children:"actions"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:O.map((C)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),H.jsxDEV("td",{children:Array.isArray(C.actions)?C.actions.length:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{children:Array.isArray(C.approvals)?C.approvals.length:0},void 0,!1,void 0,this),K?H.jsxDEV("td",{children:[H.jsxDEV("button",{onClick:()=>void k(`verify ${C.name}`,`/-/${Q}/changesets/${encodeURIComponent(C.name)}/verify`,{method:"POST"}),children:"Verify"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>{let v=window.prompt(`Approve ${C.name} as`);if(!v)return;k(`approve ${C.name}`,`/-/${Q}/changesets/${encodeURIComponent(C.name)}/approve`,{method:"POST",body:JSON.stringify({as:v})})},children:"Approve"},void 0,!1,void 0,this)," ",H.jsxDEV("button",{onClick:()=>void o5({title:`Deploy ${C.name}?`,body:"Its changes are sent to the real services now. That is what the World exists to keep you from doing by accident.",action:"Deploy to the real services",danger:!0,typed:C.name}).then((v)=>{if(v)k(`deploy ${C.name}`,`/-/${Q}/deploy/${encodeURIComponent(C.name)}`,{method:"POST",body:JSON.stringify({confirm:C.name})})}),children:"Deploy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},C.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z?H.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[H.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),H.jsxDEV("p",{children:[H.jsxDEV("button",{onClick:()=>void h(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",H.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),H.jsxDEV("p",{children:[H.jsxDEV("button",{onClick:()=>void P(),children:"Remove world"},void 0,!1,void 0,this)," ",H.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]},void 0,!0,void 0,this)}function cV({name:Q,token:U,twin:Z}){let[K,X]=B1.useState("log"),[W,z]=B1.useState(null),[B,O]=B1.useState(null);B1.useEffect(()=>{(async()=>{let f=await X0(U,`/-/${Q}/log/${Z}?limit=1`);if(!f.ok){z({position:0,entries:[]});return}let{position:D}=await f.json(),V=Math.max(0,D-200),h=await(await X0(U,`/-/${Q}/log/${Z}?after=${V}&limit=200&receipts=1`)).json();z({position:h.position,entries:[...h.entries].reverse()});let P=await X0(U,`/-/${Q}/checkpoint/${Z}`);O(P.ok?(await P.json()).tree:[])})()},[Q,U,Z]);let[T,R]=B1.useState(!1);B1.useEffect(()=>{X0(U,`/-/${Q}/twins/${Z}/status`).then(async(f)=>R(f.ok&&(await f.json()).mirror===!0),()=>R(!1))},[Q,U,Z]);let L=`${w6}/${Q}/${Z}/mirror/`,M=()=>{let f=document.createElement("form");f.method="POST",f.action=`${w6}/-/${Q}/session`;for(let[D,V]of[["token",U],["next",`/${Q}/${Z}/mirror/`]]){let k=document.createElement("input");k.type="hidden",k.name=D,k.value=V,f.append(k)}document.body.append(f),f.submit(),f.remove()},I=(f)=>f.operation==="observed"?`observed${f.provenance==="placeholder"?" (default data)":" (vendor)"}`:f.receipt?`${f.receipt.status??""} ${f.receipt.externalId??""} ${f.receipt.reason??""}`.trim():f.provenance==="placeholder"?"default data":"unpushed";return H.jsxDEV("section",{"aria-labelledby":"twin",children:[H.jsxDEV("h2",{id:"twin",children:[Z," in ",Q]},void 0,!0,void 0,this),H.jsxDEV("p",{children:["position ",W?.position??"…"," · ",H.jsxDEV("code",{children:[w6,"/",Q,"/",Z]},void 0,!0,void 0,this),T?H.jsxDEV(H.Fragment,{children:[" · ",H.jsxDEV("a",{href:L,onClick:(f)=>{f.preventDefault(),M()},children:["Open as ",Z," shows it"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),H.jsxDEV("div",{role:"tablist",children:[H.jsxDEV("button",{role:"tab","aria-selected":K==="log",onClick:()=>X("log"),children:"Log"},void 0,!1,void 0,this),H.jsxDEV("button",{role:"tab","aria-selected":K==="tree",onClick:()=>X("tree"),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K==="log"?W===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):W.entries.length===0?H.jsxDEV("p",{children:"No changes yet."},void 0,!1,void 0,this):H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"when"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"operation"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"subject"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"actor"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"standing"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:W.entries.map((f)=>H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:IJ(f.occurredAt)},void 0,!1,void 0,this),H.jsxDEV("td",{children:f.operation??f.op},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("code",{children:[f.subject.type,":",f.subject.id]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:f.actor?`${f.actor.kind}${f.actor.id?` ${f.actor.id}`:""}`:"—"},void 0,!1,void 0,this),H.jsxDEV("td",{children:nq(f)},void 0,!1,void 0,this)]},f.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):B===null?H.jsxDEV("p",{children:"Loading…"},void 0,!1,void 0,this):B.length===0?H.jsxDEV("p",{children:"The tree is empty."},void 0,!1,void 0,this):H.jsxDEV("table",{children:[H.jsxDEV("thead",{children:H.jsxDEV("tr",{children:[H.jsxDEV("th",{children:"type"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),H.jsxDEV("th",{children:"fields"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("tbody",{children:B.filter((f)=>f.deleted!==!0).slice(0,500).map((f)=>{let{type:D,id:V,...k}=f;return H.jsxDEV("tr",{children:[H.jsxDEV("td",{children:D},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("code",{children:V},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.jsxDEV("td",{children:H.jsxDEV("pre",{children:JSON.stringify(k,null,1).slice(0,600)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},`${D}:${V}`,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}bX();ER.createRoot(NJ).render(H.jsxDEV(H.Fragment,{children:[H.jsxDEV(zV,{},void 0,!1,void 0,this),H.jsxDEV(OR,{},void 0,!1,void 0,this),H.jsxDEV(RR,{},void 0,!1,void 0,this),H.jsxDEV(TR,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this));
|
package/dist/client/console.tsx
CHANGED
|
@@ -429,7 +429,7 @@ type Diff = { base: { id: string; at: string | null }; changes: Array<{ twin: st
|
|
|
429
429
|
type Branch = { name: string; at?: { instant?: string }; createdAt: string; expiresAt: string | null };
|
|
430
430
|
/** The branches door: the host's snapshots of this World, and the World's own named branches (`volter world branch`),
|
|
431
431
|
* one of which, `checkedOut`, is the one this serve holds. */
|
|
432
|
-
type BranchesDoor = { branches: Branch[]; checkedOut?: string; named?: Array<{ name: string; running: boolean }
|
|
432
|
+
type BranchesDoor = { branches: Branch[]; checkedOut?: string; named?: Array<{ name: string; running: boolean }>; canServe?: boolean };
|
|
433
433
|
/** What the World's session answered: its scope; `unknown` when the host has no session door (a write then says). */
|
|
434
434
|
type Scope = 'pending' | 'read' | 'write' | 'unknown';
|
|
435
435
|
|
|
@@ -1019,7 +1019,7 @@ function BranchList({ name, token, canWrite, branches, opens, note, remove, onCh
|
|
|
1019
1019
|
) : null}
|
|
1020
1020
|
{branches.state === 'ok' && (branches.data.named?.length ?? 0) > 0 ? (
|
|
1021
1021
|
<>
|
|
1022
|
-
<p className="lede">This World's own branches (<code>volter world branch</code>). One runs at a time;
|
|
1022
|
+
<p className="lede">This World's own branches (<code>volter world branch</code>). One runs at a time; {branches.data.canServe ? <>“Serve here” stops this one's twins and serves that one in its place.</> : <>this host serves one of them; another is served by <code>volter world checkout <branch></code> where the World lives, then serving again.</>}</p>
|
|
1023
1023
|
{serveError ? <p role="alert">{serveError}</p> : null}
|
|
1024
1024
|
<div className="block">
|
|
1025
1025
|
<table className="dense" aria-label="World branches">
|
|
@@ -1029,7 +1029,7 @@ function BranchList({ name, token, canWrite, branches, opens, note, remove, onCh
|
|
|
1029
1029
|
<tr key={b.name}>
|
|
1030
1030
|
<td><b>{b.name}</b>{b.name === branches.data.checkedOut ? <> <span className="badge">served here</span></> : null}</td>
|
|
1031
1031
|
<td className="mode">{b.running ? 'running' : 'stopped'}</td>
|
|
1032
|
-
<td className="num row-actions">{canWrite && b.name !== branches.data.checkedOut ? <button type="button" disabled={serving !== null} onClick={() => void serveHere(b.name)}>{serving === b.name ? 'Switching…' : 'Serve here'}</button> : null}</td>
|
|
1032
|
+
<td className="num row-actions">{canWrite && branches.data.canServe && b.name !== branches.data.checkedOut ? <button type="button" disabled={serving !== null} onClick={() => void serveHere(b.name)}>{serving === b.name ? 'Switching…' : 'Serve here'}</button> : null}</td>
|
|
1033
1033
|
</tr>
|
|
1034
1034
|
))}
|
|
1035
1035
|
</tbody>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/world-console",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "The dashboard of Volter World: a World's pages, the same on a laptop, a self-hosted host and the hosted cloud — mounted by the host at /-/console/. A pure frontend over the World's own doors; its kit (./kit) is the pieces the platform's pages share.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"react-dom": "^19.2.7"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@volter/world-host": "2.0.
|
|
27
|
-
"@volter/world-runtime": "2.0.
|
|
26
|
+
"@volter/world-host": "2.0.14",
|
|
27
|
+
"@volter/world-runtime": "2.0.15",
|
|
28
28
|
"@volter/world-tooling": "0.1.0",
|
|
29
29
|
"@types/bun": "^1.2.20",
|
|
30
30
|
"@types/node": "^24.0.0",
|