boxglow 0.4.0 → 0.4.1
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.
|
@@ -12,9 +12,9 @@ Error generating stack: `+e.message+`
|
|
|
12
12
|
`,`
|
|
13
13
|
+`).split(`
|
|
14
14
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,y.useEffect)(()=>{let n=t?.target??Jc,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&wo(e))return!1;let n=Zc(e.code,s);if(a.current.add(e[n]),Xc(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Zc(e.code,s);Xc(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function Xc(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Zc(e,t){return t.includes(e)?`code`:`key`}var Qc=()=>{let e=xc();return(0,y.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=lo(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return io(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ao(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function $c(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)el(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function el(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function tl(e,t){return $c(e,t)}function nl(e,t){return $c(e,t)}function rl(e,t){return{id:e,type:`select`,selected:t}}function il(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(rl(a.id,e)))}return r}function al({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function ol(e){return{id:e.id,type:`remove`}}var sl=no(`React Flow`,`https://reactflow.dev/`);function cl(e,t,n={}){return Lo(e,t,{...n,onError:n.onError??sl})}var ll=e=>Aa(e),ul=e=>ka(e);function dl(e){return(0,y.forwardRef)(e)}var fl=typeof window<`u`?y.useLayoutEffect:y.useEffect;function pl(e){let[t,n]=(0,y.useState)(BigInt(0)),[r]=(0,y.useState)(()=>ml(()=>n(e=>e+BigInt(1))));return fl(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function ml(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var hl=(0,y.createContext)(null);function gl({children:e}){let t=xc(),n=pl((0,y.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=al({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=pl((0,y.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(al({items:s,lookup:o}))},[])),i=(0,y.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,x.jsx)(hl.Provider,{value:i,children:e})}function _l(){let e=(0,y.useContext)(hl);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var vl=e=>!!e.panZoom;function yl(){let e=Qc(),t=xc(),n=_l(),r=W(vl),i=(0,y.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=ll(e)?e:n.get(e.id),a=i.parentId?ho(i.position,i.measured,i.parentId,n,r):i.position;return Ya({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&ll(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&ul(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await Ba({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(ol);o?.(f),c(e)}if(m){let e=d.map(ol);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=eo(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Ya(s?r:a),l=$a(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=eo(e)?e:a(e);if(!r)return!1;let i=$a(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Na(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??_o();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,y.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var bl=e=>e.selected,xl=typeof window<`u`?window:void 0;function Sl({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=xc(),{deleteElements:r}=yl(),i=Yc(e,{actInsideInputWithModifier:!1}),a=Yc(t,{target:xl});(0,y.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(bl),edges:e.filter(bl)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,y.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Cl(e){let t=xc();(0,y.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=xo(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,va.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var wl={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Tl=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function El({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=Ca.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:b,paneClickDistance:S,selectionOnDrag:C}){let w=xc(),T=(0,y.useRef)(null),{userSelectionActive:E,lib:D,connectionInProgress:O}=W(Tl,gc),k=Yc(p),A=(0,y.useRef)();Cl(T);let j=(0,y.useCallback)(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),b||w.setState({transform:e})},[v,b]);return(0,y.useEffect)(()=>{if(T.current){A.current=Gs({domNode:T.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>w.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=w.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=w.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=w.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=A.current.getViewport();return w.setState({panZoom:A.current,transform:[e,t,n],domNode:T.current.closest(`.react-flow`)}),()=>{A.current?.destroy()}}},[]),(0,y.useEffect)(()=>{A.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:k,preventScrolling:m,noPanClassName:_,userSelectionActive:E,noWheelClassName:g,lib:D,onTransformChange:j,connectionInProgress:O,selectionOnDrag:C,paneClickDistance:S})},[e,t,n,r,i,a,o,s,c,k,m,_,E,g,D,j,O,C,S]),(0,x.jsx)(`div`,{className:`react-flow__renderer`,ref:T,style:wl,children:h})}var Dl=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ol(){let{userSelectionActive:e,userSelectionRect:t}=W(Dl,gc);return e&&t?(0,x.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var kl=(e,t)=>n=>{n.target===t.current&&e?.(n)},Al=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function jl({isSelecting:e,selectionKeyPressed:t,selectionMode:n=wa.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,y.useRef)(0),_=xc(),{userSelectionActive:v,elementsSelectable:b,dragging:C,panBy:w,autoPanSpeed:T}=W(Al,gc),E=b&&(e||v),D=(0,y.useRef)(null),O=(0,y.useRef)(),k=(0,y.useRef)(new Set),A=(0,y.useRef)(new Set),j=(0,y.useRef)(!1),M=(0,y.useRef)(!1),N=(0,y.useRef)({x:0,y:0}),P=(0,y.useRef)(!1),F=e=>{if(M.current||j.current||_.getState().connection.inProgress){M.current=!1,j.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},ee=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},I=d?e=>d(e):void 0,te=e=>{M.current&&=(e.stopPropagation(),!1)},ne=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(O.current=i?.getBoundingClientRect(),!O.current)return;let s=n.target===D.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),M.current=!1;let{x:c,y:l}=Eo(n.nativeEvent,O.current),u=io({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=ao(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=k.current,g=A.current;k.current=new Set(Fa(a,m,i,n===wa.Partial,!0).map(e=>e.id)),A.current=new Set;let v=u?.selectable??!0;for(let e of k.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&A.current.add(e)}}go(h,k.current)||c(il(a,k.current,!0)),go(g,A.current)||l(il(o,A.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function re(){if(!i||!O.current)return;let[e,t]=Ga(N.current,O.current,T);w({x:e,y:t}).then(e=>{if(!M.current||!e){g.current=requestAnimationFrame(re);return}let{x:t,y:n}=N.current;L(t,n),g.current=requestAnimationFrame(re)})}let ie=()=>{cancelAnimationFrame(g.current),g.current=0,P.current=!1};(0,y.useEffect)(()=>()=>ie(),[]);let ae=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!O.current||!n)return;let{x:o,y:c}=Eo(e.nativeEvent,O.current);N.current={x:o,y:c};let l=ao({x:n.startX,y:n.startY},r);if(!M.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}M.current=!0,P.current||=(re(),!0),L(o,c)},oe=e=>{if(!E){e.target===D.current&&_.getState().connection.inProgress&&(j.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===D.current&&_.getState().userSelectionRect&&F?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(c?.(e),_.setState({nodesSelectionActive:k.current.size>0})),ie())},se=e=>{e.target?.releasePointerCapture?.(e.pointerId),ie()},ce=r===!0||Array.isArray(r)&&r.includes(0);return(0,x.jsxs)(`div`,{className:S([`react-flow__pane`,{draggable:ce,dragging:C,selection:e}]),onClick:E?void 0:kl(F,D),onContextMenu:kl(ee,D),onWheel:kl(I,D),onPointerEnter:E?void 0:f,onPointerMove:E?ae:p,onPointerUp:oe,onPointerCancel:E?se:void 0,onPointerDownCapture:E?ne:void 0,onClickCapture:E?te:void 0,onPointerLeave:m,ref:D,style:wl,children:[h,(0,x.jsx)(Ol,{})]})}function Ml({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,va.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Nl({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=xc(),[c,l]=(0,y.useState)(!1),u=(0,y.useRef)();return(0,y.useEffect)(()=>{if(!t)return u.current=bs({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Ml({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,y.useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var Pl=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Fl(){let e=xc();return(0,y.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Pl(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=ro(t,i));let{position:a,positionAbsolute:s}=za({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Il=(0,y.createContext)(null),Ll=Il.Provider;Il.Consumer;var Rl=()=>(0,y.useContext)(Il),zl=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Bl=(0,y.createContext)(null);function Vl({children:e}){let t=W(zl,gc);return(0,x.jsx)(Bl.Provider,{value:t,children:e})}function Hl(){let e=(0,y.useContext)(Bl);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var Ul={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Wl=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return Ul;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Sa.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Gl({type:e=`source`,position:t=H.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=xc(),_=Rl(),{connectOnClick:v,noPanClassName:y,rfId:b}=Hl(),{connectingFrom:C,connectingTo:w,clickConnecting:T,isPossibleEndHandle:E,connectionInProcess:D,clickConnectionInProcess:O,valid:k}=W(Wl(_,m,e),gc);_||g.getState().onError?.(`010`,va.error010());let A=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(cl(i,e,{onError:n}))}n?.(i),s?.(i)},j=e=>{if(!_)return;let t=To(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();As.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:A,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,x.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:S([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:T,connectingfrom:C,connectingto:w,valid:k,connectionindicator:r&&(!D||E)&&(D||O?a:i)}]),onMouseDown:j,onTouchStart:j,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=So(t.target),h=n||c,{connection:v,isValid:y}=As.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&A(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Kl=(0,y.memo)(dl(Gl));function ql({data:e,isConnectable:t,sourcePosition:n=H.Bottom}){return(0,x.jsxs)(x.Fragment,{children:[e?.label,(0,x.jsx)(Kl,{type:`source`,position:n,isConnectable:t})]})}function Jl({data:e,isConnectable:t,targetPosition:n=H.Top,sourcePosition:r=H.Bottom}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Kl,{type:`target`,position:n,isConnectable:t}),e?.label,(0,x.jsx)(Kl,{type:`source`,position:r,isConnectable:t})]})}function Yl(){return null}function Xl({data:e,isConnectable:t,targetPosition:n=H.Top}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Kl,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Zl={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ql={input:ql,default:Jl,output:Xl,group:Yl};function $l(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var eu=e=>{let{width:t,height:n,x:r,y:i}=Pa(e.nodeLookup,{filter:e=>!!e.selected});return{width:to(t)?t:null,height:to(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function tu({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=xc(),{width:i,height:a,transformString:o,userSelectionActive:s}=W(eu,gc),c=Fl(),l=(0,y.useRef)(null);(0,y.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Nl({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,x.jsx)(`div`,{className:S([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,x.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Zl,e.key)&&(e.preventDefault(),c({direction:Zl[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var nu=typeof window<`u`?window:void 0,ru=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function iu({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:T,autoPanOnSelection:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:P,disableKeyboardA11y:F,onViewportChange:ee,isControlledViewport:I}){let{nodesSelectionActive:te,userSelectionActive:ne}=W(ru,gc),L=Yc(l,{target:nu}),re=Yc(h,{target:nu}),ie=re||T,ae=re||b,oe=u&&ie!==!0,se=L||ne||oe;return Sl({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,x.jsx)(El,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:ae,panActivationKeyPressed:re,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:!L&&ie,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,zoomActivationKeyCode:g,preventScrolling:j,noWheelClassName:N,noPanClassName:P,onViewportChange:ee,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:oe,children:(0,x.jsxs)(jl,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ie,autoPanOnSelection:E,isSelecting:!!se,selectionMode:d,selectionKeyPressed:L,paneClickDistance:s,selectionOnDrag:oe,children:[e,te&&(0,x.jsx)(tu,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:F})]})})}iu.displayName=`FlowRenderer`;var au=(0,y.memo)(iu),ou=e=>t=>e?Fa(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function su(e){return W((0,y.useCallback)(ou(e),[e]),gc)}var cu=e=>e.updateNodeInternals;function lu(){let e=W(cu),[t]=(0,y.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,y.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function uu({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=xc(),a=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useRef)(e.sourcePosition),c=(0,y.useRef)(e.targetPosition),l=(0,y.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,y.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,y.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,y.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function du({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:C}=W(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},gc),w=y.type||`default`,T=g?.[w]||Ql[w];T===void 0&&(v?.(`003`,va.error003(w)),w=`default`,T=g?.default||Ql.default);let E=!!(y.draggable||s&&y.draggable===void 0),D=!!(y.selectable||c&&y.selectable===void 0),O=!!(y.connectable||l&&y.connectable===void 0),k=!!(y.focusable||u&&y.focusable===void 0),A=xc(),j=mo(y),M=uu({node:y,nodeType:w,hasDimensions:j,resizeObserver:d}),N=Nl({nodeRef:M,disabled:y.hidden||!E,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:_}),P=Fl();if(y.hidden)return null;let F=po(y),ee=$l(y),I=D||E||t||n||r||i,te=n?e=>n(e,{...b.userNode}):void 0,ne=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,re=a?e=>a(e,{...b.userNode}):void 0,ie=o?e=>o(e,{...b.userNode}):void 0,ae=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=A.getState();D&&(!r||!E||i>0)&&Ml({id:e,store:A,nodeRef:M}),t&&t(n,{...b.userNode})},oe=t=>{if(!(wo(t.nativeEvent)||m)){if(ba.includes(t.key)&&D){let n=t.key===`Escape`;Ml({id:e,store:A,unselect:n,nodeRef:M})}else if(E&&y.selected&&Object.prototype.hasOwnProperty.call(Zl,t.key)){t.preventDefault();let{ariaLabelConfig:e}=A.getState();A.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),P({direction:Zl[t.key],factor:t.shiftKey?4:1})}}},se=()=>{if(m||!M.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=A.getState();i&&(Fa(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+F.width/2,y.position.y+F.height/2,{zoom:t[2]}))};return(0,x.jsx)(`div`,{className:S([`react-flow__node`,`react-flow__node-${w}`,{[p]:E},y.className,{selected:y.selected,selectable:D,parent:C,draggable:E,dragging:N}]),ref:M,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:I?`all`:`none`,visibility:j?`visible`:`hidden`,...y.style,...ee},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:te,onMouseMove:ne,onMouseLeave:L,onContextMenu:re,onClick:ae,onDoubleClick:ie,onKeyDown:k?oe:void 0,tabIndex:k?0:void 0,onFocus:k?se:void 0,role:y.ariaRole??(k?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${wc}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,x.jsx)(Ll,{value:e,children:(0,x.jsx)(T,{id:e,data:y.data,type:w,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:D,draggable:E,deletable:y.deletable??!0,isConnectable:O,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:N,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...F})})})}var fu=(0,y.memo)(du),pu=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function mu(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=W(pu,gc),a=su(e.onlyRenderVisibleElements),o=lu();return(0,x.jsx)(`div`,{className:`react-flow__nodes`,style:wl,children:a.map(a=>(0,x.jsx)(fu,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}mu.displayName=`NodeRenderer`;var hu=(0,y.memo)(mu);function gu(e){return W((0,y.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Po({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),gc)}var _u=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,x.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},vu=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,x.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},yu={[Da.Arrow]:_u,[Da.ArrowClosed]:vu};function bu(e){let t=xc();return(0,y.useMemo)(()=>Object.prototype.hasOwnProperty.call(yu,e)?yu[e]:(t.getState().onError?.(`009`,va.error009(e)),null),[e])}var xu=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=bu(t);return c?(0,x.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,x.jsx)(c,{color:n,strokeWidth:o})}):null},Su=({defaultColor:e,rfId:t})=>{let n=W(e=>e.edges),r=W(e=>e.defaultEdgeOptions),i=(0,y.useMemo)(()=>Xo(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,x.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,x.jsx)(`defs`,{children:i.map(e=>(0,x.jsx)(xu,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Su.displayName=`MarkerDefinitions`;var Cu=(0,y.memo)(Su);function wu({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,y.useState)({x:1,y:0,width:0,height:0}),p=S([`react-flow__edge-textwrapper`,l]),m=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,x.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,x.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,x.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}wu.displayName=`EdgeText`;var Tu=(0,y.memo)(wu);function Eu({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`path`,{...u,d:e,fill:`none`,className:S([`react-flow__edge-path`,u.className])}),l?(0,x.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&to(t)&&to(n)?(0,x.jsx)(Tu,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Du({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===H.Left||e===H.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Ou({sourceX:e,sourceY:t,sourcePosition:n=H.Bottom,targetX:r,targetY:i,targetPosition:a=H.Top}){let[o,s]=Du({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Du({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Oo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function ku(e){return(0,y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Ou({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),S=e.isInternal?void 0:t;return(0,x.jsx)(Eu,{id:S,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Au=ku({isInternal:!1}),ju=ku({isInternal:!0});Au.displayName=`SimpleBezierEdge`,ju.displayName=`SimpleBezierEdgeInternal`;function Mu(e){return(0,y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=H.Bottom,targetPosition:m=H.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,S]=Uo({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),C=e.isInternal?void 0:t;return(0,x.jsx)(Eu,{id:C,path:y,labelX:b,labelY:S,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Nu=Mu({isInternal:!1}),Pu=Mu({isInternal:!0});Nu.displayName=`SmoothStepEdge`,Pu.displayName=`SmoothStepEdgeInternal`;function Fu(e){return(0,y.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,x.jsx)(Nu,{...n,id:r,pathOptions:(0,y.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Iu=Fu({isInternal:!1}),Lu=Fu({isInternal:!0});Iu.displayName=`StepEdge`,Lu.displayName=`StepEdgeInternal`;function Ru(e){return(0,y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Ro({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,x.jsx)(Eu,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var zu=Ru({isInternal:!1}),Bu=Ru({isInternal:!0});zu.displayName=`StraightEdge`,Bu.displayName=`StraightEdgeInternal`;function Vu(e){return(0,y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=H.Bottom,targetPosition:s=H.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,S]=jo({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),C=e.isInternal?void 0:t;return(0,x.jsx)(Eu,{id:C,path:y,labelX:b,labelY:S,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Hu=Vu({isInternal:!1}),Uu=Vu({isInternal:!0});Hu.displayName=`BezierEdge`,Uu.displayName=`BezierEdgeInternal`;var Wu={default:Uu,straight:Bu,step:Lu,smoothstep:Pu,simplebezier:ju},Gu={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Ku=(e,t,n)=>n===H.Left?e-t:n===H.Right?e+t:e,qu=(e,t,n)=>n===H.Top?e-t:n===H.Bottom?e+t:e,Ju=`react-flow__edgeupdater`;function Yu({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,x.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:S([Ju,`${Ju}-${s}`]),cx:Ku(t,r,e),cy:qu(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Xu({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=xc(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;As.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,x.jsxs)(x.Fragment,{children:[(e===!0||e===`source`)&&(0,x.jsx)(Yu,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,x.jsx)(Yu,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function Zu({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let b=W(t=>t.edgeLookup.get(e)),C=W(e=>e.defaultEdgeOptions);b=C?{...C,...b}:b;let w=b.type||`default`,T=h?.[w]||Wu[w];T===void 0&&(_?.(`011`,va.error011(w)),w=`default`,T=h?.default||Wu.default);let E=!!(b.focusable||t&&b.focusable===void 0),D=d!==void 0&&(b.reconnectable||n&&b.reconnectable===void 0),O=!!(b.selectable||r&&b.selectable===void 0),k=(0,y.useRef)(null),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(!1),P=xc(),{zIndex:F=b.zIndex,sourceX:ee,sourceY:I,targetX:te,targetY:ne,sourcePosition:L,targetPosition:re}=W((0,y.useCallback)(t=>{let n=t.nodeLookup.get(b.source),r=t.nodeLookup.get(b.target);if(!n||!r)return Gu;let i=Go({id:e,sourceNode:n,targetNode:r,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=No({selected:b.selected,zIndex:b.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Gu,zIndex:a}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex,_]),gc),ie=(0,y.useMemo)(()=>b.markerStart?`url('#${Yo(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ae=(0,y.useMemo)(()=>b.markerEnd?`url('#${Yo(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||ee===null||I===null||te===null||ne===null)return null;let oe=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=P.getState();O&&(P.setState({nodesSelectionActive:!1}),b.selected&&a?(r({nodes:[],edges:[b]}),k.current?.blur()):n([e])),i&&i(t,b)},se=a?e=>{a(e,{...b})}:void 0,ce=o?e=>{o(e,{...b})}:void 0,le=s?e=>{s(e,{...b})}:void 0,ue=c?e=>{c(e,{...b})}:void 0,de=l?e=>{l(e,{...b})}:void 0;return(0,x.jsx)(`svg`,{style:{zIndex:F},children:(0,x.jsxs)(`g`,{className:S([`react-flow__edge`,`react-flow__edge-${w}`,b.className,g,{selected:b.selected,animated:b.animated,inactive:!O&&!i,updating:A,selectable:O}]),onClick:oe,onDoubleClick:se,onContextMenu:ce,onMouseEnter:le,onMouseMove:ue,onMouseLeave:de,onKeyDown:E?t=>{if(!v&&ba.includes(t.key)&&O){let{unselectNodesAndEdges:n,addSelectedEdges:r}=P.getState();t.key===`Escape`?(k.current?.blur(),n({edges:[b]})):r([e])}}:void 0,tabIndex:E?0:void 0,role:b.ariaRole??(E?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":E?`${Tc}-${m}`:void 0,ref:k,...b.domAttributes,children:[!M&&(0,x.jsx)(T,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:O,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:ee,sourceY:I,targetX:te,targetY:ne,sourcePosition:L,targetPosition:re,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:ie,markerEnd:ae,pathOptions:`pathOptions`in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),D&&(0,x.jsx)(Xu,{edge:b,isReconnectable:D,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:ee,sourceY:I,targetX:te,targetY:ne,sourcePosition:L,targetPosition:re,setUpdateHover:j,setReconnecting:N})]})})}var Qu=(0,y.memo)(Zu),$u=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ed({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=W($u,gc),b=gu(t);return(0,x.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,x.jsx)(Cu,{defaultColor:e,rfId:n}),b.map(e=>(0,x.jsx)(Qu,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}ed.displayName=`EdgeRenderer`;var td=(0,y.memo)(ed),nd=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function G({children:e}){let t=xc(),n=(0,y.useRef)(null),[r]=(0,y.useState)(()=>t.getState().transform);return fl(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=nd(r)))};return r(),t.subscribe(r)},[t]),(0,x.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:nd(r)},children:e})}function K(e){let t=yl(),n=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var rd=e=>e.panZoom?.syncViewport;function id(e){let t=W(rd),n=xc();return(0,y.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ad(e){return e.connection.inProgress?{...e.connection,to:io(e.connection.to,e.transform)}:{...e.connection}}function od(e){return e?t=>e(ad(t)):ad}function sd(e){return W(od(e),gc)}var cd=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ld({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=W(cd,gc);return a&&i&&c?(0,x.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,x.jsx)(`g`,{className:S([`react-flow__connection`,yo(s)]),children:(0,x.jsx)(ud,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var ud=({style:e,type:t=Ea.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=sd();if(!i)return;if(n)return(0,x.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:yo(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Ea.Bezier:[m]=jo(h);break;case Ea.SimpleBezier:[m]=Ou(h);break;case Ea.Step:[m]=Uo({...h,borderRadius:0});break;case Ea.SmoothStep:[m]=Uo(h);break;default:[m]=Ro(h)}return(0,x.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};ud.displayName=`ConnectionLine`;var dd={};function fd(e=dd){(0,y.useRef)(e),xc(),(0,y.useEffect)(()=>{},[e])}function pd(){xc(),(0,y.useRef)(!1),(0,y.useEffect)(()=>{},[])}function md({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,deleteKeyCode:T,onlyRenderVisibleElements:E,elementsSelectable:D,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,preventScrolling:M,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:F,panOnScroll:ee,panOnScrollSpeed:I,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:L,autoPanOnSelection:re,onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneScroll:ce,onPaneContextMenu:le,paneClickDistance:ue,nodeClickDistance:de,onEdgeContextMenu:fe,onEdgeMouseEnter:R,onEdgeMouseMove:z,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:we,onViewportChange:Te,nodesDraggable:Ee}){return fd(e),fd(t),pd(),K(n),id(we),(0,x.jsx)(au,{onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneContextMenu:le,onPaneScroll:ce,paneClickDistance:ue,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,elementsSelectable:D,zoomOnScroll:P,zoomOnPinch:F,zoomOnDoubleClick:ne,panOnScroll:ee,panOnScrollSpeed:I,panOnScrollMode:te,panOnDrag:L,autoPanOnSelection:re,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,onSelectionContextMenu:d,preventScrolling:M,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:Te,isControlledViewport:!!we,children:(0,x.jsxs)(G,{children:[(0,x.jsx)(td,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:E,onEdgeContextMenu:fe,onEdgeMouseEnter:R,onEdgeMouseMove:z,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:N,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,x.jsx)(ld,{style:h,type:m,component:g,containerStyle:_}),(0,x.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,x.jsx)(hu,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:de,onlyRenderVisibleElements:E,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Ee}),(0,x.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}md.displayName=`GraphView`;var hd=(0,y.memo)(md),gd=no(`React Flow`,`https://reactflow.dev/`),_d=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??ya;ms(h,g,_);let{nodesInitialized:x}=as(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=lo(Pa(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:ya,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Sa.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Ta},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gd,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:xa,zIndexMode:f,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}},vd=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>hc((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Ra({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{..._d({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=as(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();ms(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=ds(e,n,r,i,a,o,l);d&&(ns(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=qo(e,o.fromHandle,H.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=us(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(tl(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(nl(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>rl(e,!0)));return}i(il(r,new Set([...e]),!0)),a(il(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>rl(e,!0)));return}a(il(n,new Set([...e]))),i(il(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(rl(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(rl(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,rl(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,rl(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(as(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return fs({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Ta}})},updateConnection:e=>{p({connection:e})},reset:()=>p({..._d()})}},Object.is);function yd({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,y.useState)(()=>vd({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,x.jsx)(yc,{value:m,children:(0,x.jsx)(gl,{children:(0,x.jsx)(Vl,{children:p})})})}function bd({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,y.useContext)(vc)?(0,x.jsx)(x.Fragment,{children:e}):(0,x.jsx)(yd,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var xd={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Sd({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:b,onNodeMouseLeave:C,onNodeContextMenu:w,onNodeDoubleClick:T,onNodeDragStart:E,onNodeDrag:D,onNodeDragStop:O,onNodesDelete:k,onEdgesDelete:A,onDelete:j,onSelectionChange:M,onSelectionDragStart:N,onSelectionDrag:P,onSelectionDragStop:F,onSelectionContextMenu:ee,onSelectionStart:I,onSelectionEnd:te,onBeforeDelete:ne,connectionMode:L,connectionLineType:re=Ea.Bezier,connectionLineStyle:ie,connectionLineComponent:ae,connectionLineContainerStyle:oe,deleteKeyCode:se=`Backspace`,selectionKeyCode:ce=`Shift`,selectionOnDrag:le=!1,selectionMode:ue=wa.Full,panActivationKeyCode:de=`Space`,multiSelectionKeyCode:fe=uo()?`Meta`:`Control`,zoomActivationKeyCode:R=uo()?`Meta`:`Control`,snapToGrid:z,snapGrid:pe,onlyRenderVisibleElements:me=!1,selectNodesOnDrag:he,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,nodeOrigin:be=Bc,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce=!0,defaultViewport:we=Vc,minZoom:Te=.5,maxZoom:Ee=2,translateExtent:De=ya,preventScrolling:Oe=!0,nodeExtent:ke,defaultMarkerColor:Ae=`#b1b1b7`,zoomOnScroll:je=!0,zoomOnPinch:Me=!0,panOnScroll:Ne=!1,panOnScrollSpeed:Pe=.5,panOnScrollMode:Fe=Ca.Free,zoomOnDoubleClick:Ie=!0,panOnDrag:Le=!0,onPaneClick:Re,onPaneMouseEnter:ze,onPaneMouseMove:Be,onPaneMouseLeave:Ve,onPaneScroll:He,onPaneContextMenu:Ue,paneClickDistance:We=1,nodeClickDistance:Ge=0,children:Ke,onReconnect:qe,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:tt=10,onNodesChange:nt,onEdgesChange:rt,noDragClassName:it=`nodrag`,noWheelClassName:at=`nowheel`,noPanClassName:ot=`nopan`,fitView:st,fitViewOptions:ct,connectOnClick:lt,attributionPosition:ut,proOptions:dt,defaultEdgeOptions:ft,elevateNodesOnSelect:pt=!0,elevateEdgesOnSelect:mt=!1,disableKeyboardA11y:ht=!1,autoPanOnConnect:gt,autoPanOnNodeDrag:_t,autoPanOnSelection:vt=!0,autoPanSpeed:yt,connectionRadius:bt,isValidConnection:xt,onError:St,style:Ct,id:wt,nodeDragThreshold:Tt,connectionDragThreshold:Et,viewport:Dt,onViewportChange:Ot,width:kt,height:At,colorMode:jt=`light`,debug:Mt,onScroll:Nt,ariaLabelConfig:Pt,zIndexMode:Ft=`basic`,...It},Lt){let Rt=wt||`1`,zt=qc(jt),Bt=(0,y.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Nt?.(e)},[Nt]);return(0,x.jsx)(`div`,{"data-testid":`rf__wrapper`,...It,onScroll:Bt,style:{...Ct,...xd},ref:Lt,className:S([`react-flow`,i,zt]),id:wt,role:`application`,children:(0,x.jsxs)(bd,{nodes:e,edges:t,width:kt,height:At,fitView:st,fitViewOptions:ct,minZoom:Te,maxZoom:Ee,nodeOrigin:be,nodeExtent:ke,zIndexMode:Ft,children:[(0,x.jsx)(Gc,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce,elevateNodesOnSelect:pt,elevateEdgesOnSelect:mt,minZoom:Te,maxZoom:Ee,nodeExtent:ke,onNodesChange:nt,onEdgesChange:rt,snapToGrid:z,snapGrid:pe,connectionMode:L,translateExtent:De,connectOnClick:lt,defaultEdgeOptions:ft,fitView:st,fitViewOptions:ct,onNodesDelete:k,onEdgesDelete:A,onDelete:j,onNodeDragStart:E,onNodeDrag:D,onNodeDragStop:O,onSelectionDrag:P,onSelectionDragStart:N,onSelectionDragStop:F,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:ot,nodeOrigin:be,rfId:Rt,autoPanOnConnect:gt,autoPanOnNodeDrag:_t,autoPanSpeed:yt,onError:St,connectionRadius:bt,isValidConnection:xt,selectNodesOnDrag:he,nodeDragThreshold:Tt,connectionDragThreshold:Et,onBeforeDelete:ne,debug:Mt,ariaLabelConfig:Pt,zIndexMode:Ft}),(0,x.jsx)(hd,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:b,onNodeMouseLeave:C,onNodeContextMenu:w,onNodeDoubleClick:T,nodeTypes:a,edgeTypes:o,connectionLineType:re,connectionLineStyle:ie,connectionLineComponent:ae,connectionLineContainerStyle:oe,selectionKeyCode:ce,selectionOnDrag:le,selectionMode:ue,deleteKeyCode:se,multiSelectionKeyCode:fe,panActivationKeyCode:de,zoomActivationKeyCode:R,onlyRenderVisibleElements:me,defaultViewport:we,translateExtent:De,minZoom:Te,maxZoom:Ee,preventScrolling:Oe,zoomOnScroll:je,zoomOnPinch:Me,zoomOnDoubleClick:Ie,panOnScroll:Ne,panOnScrollSpeed:Pe,panOnScrollMode:Fe,panOnDrag:Le,autoPanOnSelection:vt,onPaneClick:Re,onPaneMouseEnter:ze,onPaneMouseMove:Be,onPaneMouseLeave:Ve,onPaneScroll:He,onPaneContextMenu:Ue,paneClickDistance:We,nodeClickDistance:Ge,onSelectionContextMenu:ee,onSelectionStart:I,onSelectionEnd:te,onReconnect:qe,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:tt,defaultMarkerColor:Ae,noDragClassName:it,noWheelClassName:at,noPanClassName:ot,rfId:Rt,disableKeyboardA11y:ht,nodeExtent:ke,viewport:Dt,onViewportChange:Ot,nodesDraggable:ge}),(0,x.jsx)(zc,{onSelectionChange:M}),Ke,(0,x.jsx)(Nc,{proOptions:dt,position:ut}),(0,x.jsx)(Ac,{rfId:Rt,disableKeyboardA11y:ht})]})})}var Cd=dl(Sd),wd=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Td({children:e}){let t=W(wd);return t?(0,_c.createPortal)(e,t):null}function Ed(e){let[t,n]=(0,y.useState)(e);return[t,n,(0,y.useCallback)(e=>n(t=>tl(e,t)),[])]}va.error014();function Dd({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,x.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:S([`react-flow__background-pattern`,n,r])})}function Od({radius:e,className:t}){return(0,x.jsx)(`circle`,{cx:e,cy:e,r:e,className:S([`react-flow__background-pattern`,`dots`,t])})}var kd;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(kd||={});var Ad={[kd.Dots]:1,[kd.Lines]:1,[kd.Cross]:6},jd=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Md({id:e,variant:t=kd.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,y.useRef)(null),{transform:f,patternId:p}=W(jd,gc),m=r||Ad[t],h=t===kd.Dots,g=t===kd.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],b=m*f[2],C=Array.isArray(a)?a:[a,a],w=g?[b,b]:v,T=[C[0]*f[2]+w[0]/2,C[1]*f[2]+w[1]/2],E=`${p}${e||``}`;return(0,x.jsxs)(`svg`,{className:S([`react-flow__background`,l]),style:{...c,...wl,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,x.jsx)(`pattern`,{id:E,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${T[0]},-${T[1]})`,children:h?(0,x.jsx)(Od,{radius:b/2,className:u}):(0,x.jsx)(Dd,{dimensions:w,lineWidth:i,variant:t,className:u})}),(0,x.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${E})`})]})}Md.displayName=`Background`;var Nd=(0,y.memo)(Md);function Pd(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,x.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Fd(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,x.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Id(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,x.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 Ld(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,x.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 Rd(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,x.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 zd({children:e,className:t,...n}){return(0,x.jsx)(`button`,{type:`button`,className:S([`react-flow__controls-button`,t]),...n,children:e})}var Bd=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Vd({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=xc(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=W(Bd,gc),{zoomIn:y,zoomOut:b,fitView:C}=yl();return(0,x.jsxs)(jc,{className:S([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(zd,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,x.jsx)(Pd,{})}),(0,x.jsx)(zd,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,x.jsx)(Fd,{})})]}),n&&(0,x.jsx)(zd,{className:`react-flow__controls-fitview`,onClick:()=>{C(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,x.jsx)(Id,{})}),r&&(0,x.jsx)(zd,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,x.jsx)(Rd,{}):(0,x.jsx)(Ld,{})}),u]})}Vd.displayName=`Controls`,(0,y.memo)(Vd);function Hd({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,x.jsx)(`rect`,{className:S([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Ud=(0,y.memo)(Hd),Wd=e=>e.nodes.map(e=>e.id),Gd=e=>e instanceof Function?e:()=>e;function Kd({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Ud,onClick:o}){let s=W(Wd,gc),c=Gd(t),l=Gd(e),u=Gd(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,x.jsx)(x.Fragment,{children:s.map(e=>(0,x.jsx)(Jd,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function qd({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=W(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=po(r);return{node:r,x:i,y:a,width:o,height:s}},gc);return!l||l.hidden||!mo(l)?null:(0,x.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Jd=(0,y.memo)(qd),Yd=(0,y.memo)(Kd),Xd=200,Zd=150,Qd=e=>!e.hidden,$d=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?Za(Pa(e.nodeLookup,{filter:Qd}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ef=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,tf=(e,t)=>ef(e.viewBB,t.viewBB)&&ef(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,nf=`react-flow__minimap-desc`;function rf({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:b=1,offsetScale:C=5}){let w=xc(),T=(0,y.useRef)(null),{boundingRect:E,panZoom:D,viewBB:O,rfId:k,translateExtent:A,flowWidth:j,flowHeight:M,ariaLabelConfig:N}=W($d,tf),P=e?.width??Xd,F=e?.height??Zd,ee=E.width/P,I=E.height/F,te=Math.max(ee,I),ne=te*P,L=te*F,re=C*te,ie=E.x-(ne-E.width)/2-re,ae=E.y-(L-E.height)/2-re,oe=ne+re*2,se=L+re*2,ce=`${nf}-${k}`,le=(0,y.useRef)(0),ue=(0,y.useRef)();le.current=te,(0,y.useEffect)(()=>{let e=w.getState().panZoom;if(T.current&&e)return ue.current=js({domNode:T.current,panZoom:e,getTransform:()=>w.getState().transform,getViewScale:()=>le.current}),()=>{ue.current?.destroy()}},[D]),(0,y.useEffect)(()=>{ue.current?.update({translateExtent:A,width:j,height:M,inversePan:v,pannable:h,zoomStep:b,zoomable:g})},[h,g,v,b,A,j,M]);let de=p?e=>{let[t,n]=ue.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,fe=(0,y.useCallback)((e,t)=>{let n=w.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),R=m?fe:void 0,z=_??N[`minimap.ariaLabel`];return(0,x.jsx)(jc,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*te:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:S([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,x.jsxs)(`svg`,{width:P,height:F,viewBox:`${ie} ${ae} ${oe} ${se}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ce,ref:T,onClick:de,children:[z&&(0,x.jsx)(`title`,{id:ce,children:z}),(0,x.jsx)(Yd,{onClick:R,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,x.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${ie-re},${ae-re}h${oe+re*2}v${se+re*2}h${-oe-re*2}z
|
|
15
|
-
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}rf.displayName=`MiniMap`;var af=(0,y.memo)(rf),of=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sf={[Ks.Line]:`right`,[Ks.Handle]:`bottom-right`};function cf({nodeId:e,position:t,variant:n=Ks.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Rl(),b=typeof e==`string`?e:v,C=xc(),w=(0,y.useRef)(null),T=n===Ks.Handle,E=W((0,y.useCallback)(of(T&&p),[T,p]),gc),D=(0,y.useRef)(null),O=t??sf[n];(0,y.useEffect)(()=>{if(w.current&&b)return D.current||=rc({domNode:w.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=C.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=C.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=us([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...ho({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};C.getState().triggerNodeChanges([n])}}),D.current.update({controlPosition:O,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{D.current?.destroy()}},[O,s,c,l,u,d,h,g,_,m]);let k=O.split(`-`);return(0,x.jsx)(`div`,{className:S([`react-flow__resize-control`,`nodrag`,...k,n,r]),ref:w,style:{...i,scale:E,...o&&{[T?`backgroundColor`:`borderColor`]:o}},children:a})}(0,y.memo)(cf);var lf=e=>`${Math.round(e.x*1e3)},${Math.round(e.y*1e3)}`,uf=(e,t)=>lf(e)===lf(t),df=e=>`${e.source}|${lf(e.s)}`;function ff(e,t,n=new Set){let r=new Map,i=new Map;for(let n of t){let t=i.get(df(n))??[];t.push(n),i.set(df(n),t),r.set(n.id,{parts:[e.get(n.id)??[]],junctions:[],corners:[]})}for(let t of i.values()){if(t.length<2)continue;let i=t.flatMap(t=>e.get(t.id)??[]),a=new Map,o=new Map,s=[...t].sort((e,t)=>Number(n.has(t.id))-Number(n.has(e.id))||e.id.localeCompare(t.id));for(let t of s){let n=e.get(t.id)??[],r=[];for(let e=1;e<n.length;e++){let o=n[e-1],s=n[e],c=Math.abs(o.y-s.y)<.01;if(uf(o,s))continue;let l=[o,...i.filter(e=>c?Math.abs(e.y-o.y)<.01&&e.x>Math.min(o.x,s.x)&&e.x<Math.max(o.x,s.x):Math.abs(e.x-o.x)<.01&&e.y>Math.min(o.y,s.y)&&e.y<Math.max(o.y,s.y)),s].sort((e,t)=>c?(e.x-t.x)*Math.sign(s.x-o.x):(e.y-t.y)*Math.sign(s.y-o.y));for(let e=1;e<l.length;e++){let n=l[e-1],i=l[e];if(uf(n,i))continue;let o=[lf(n),lf(i)].sort().join(`|`);a.has(o)||a.set(o,{a:n,b:i,owner:t.id}),r.push({a:n,b:i,atom:o})}}o.set(t.id,r)}let c=new Map,l=new Map;for(let{a:e,b:t}of a.values())for(let[n,r]of[[e,t],[t,e]]){let e=lf(n),t=c.get(e)??new Set;t.add(lf(r)),c.set(e,t),l.set(e,n)}let u=[...c].filter(([,e])=>e.size>=3).map(([e])=>l.get(e));for(let e of t){let t=[],n=[];for(let r of o.get(e.id)??[]){if(a.get(r.atom).owner!==e.id){n.length>1&&t.push(n),n=[];continue}n.length&&uf(n[n.length-1],r.a)?n.push(r.b):(n.length>1&&t.push(n),n=[r.a,r.b])}n.length>1&&t.push(n),r.set(e.id,{parts:t,junctions:[],corners:u})}for(let e of u){let t=s.find(t=>(o.get(t.id)??[]).some(t=>uf(t.a,e)||uf(t.b,e)));t&&r.get(t.id).junctions.push(e)}}return r}var pf=[{key:`study`,label:`検討`,en:`study`,color:`#6b7075`},{key:`research`,label:`調査`,en:`research`,color:`#7a5230`},{key:`design`,label:`設計`,en:`design`,color:`#2f6fb3`},{key:`ui`,label:`デザイン`,en:`ui`,color:`#c0427a`},{key:`build`,label:`実装`,en:`build`,color:`#5a4fcf`},{key:`verify`,label:`検証`,en:`verify`,color:`#26753d`},{key:`evaluate`,label:`評価`,en:`evaluate`,color:`#8a6508`},{key:`improve`,label:`改善`,en:`improve`,color:`#b5581a`},{key:`fix`,label:`課題解決`,en:`fix`,color:`#c0392b`},{key:`docs`,label:`文書`,en:`docs`,color:`#5f6f3a`},{key:`ops`,label:`運用`,en:`ops`,color:`#1f7a8c`},{key:`other`,label:`その他`,en:`other`,color:`#8a8f94`,neutral:!0}];function mf(e){if(e)return pf.find(t=>t.key===e)}var hf={キャンセル:`Cancel`,"この階層を整列しました。Ctrl+Z で元に戻せます。":`Arranged this level. Press Ctrl+Z to undo.`,"接続先の入力をクリック。Esc でキャンセル":`Click the destination input. Esc to cancel.`,配線の凡例:`Connection legend`,未確定:`Pending`,確定済み:`Ready`,選択中の経路:`Selected path`,キャンバスの表示:`Canvas view`,縮小:`Zoom out`,拡大:`Zoom in`,"100% で文字を読む":`Read text at 100%`,"ドラッグしたボックスを 8px のグリッドに揃える":`Snap dragged boxes to an 8px grid`,吸着:`Snap`,"この階層のボックスだけを整列。子の中や別の階層の配置は保持します。":`Arrange this level only. Keep nested and other levels in place.`,この階層を整列:`Arrange this level`,"入力: {name}":`Input: {name}`,"出力: {name} (クリックまたはドラッグで接続)":`Output: {name} (click or drag to connect)`,"右の出力 → 左の入力の順に丸をクリック、またはドラッグで接続。線を選ぶと経路を追えます。":`Click the right output, then the left input, or drag to connect. Select a line to follow its path.`,"線を選ぶと経路を追えます。ボックスの移動・接続は上部の Edit で有効にできます。":`Select a line to follow its path. Enable Edit above to move or connect boxes.`,"ボックスをダブルクリックすると中を開きます。100% は文字を読む倍率、Fit は配置を見渡す倍率です。":`Double-click a box to open it. Use 100% to read text and Fit to see the layout.`,"全体表示: この階層のボックスがすべて収まる倍率にする":`Fit: zoom so every box on this level is visible`,"選んだボックス (線を選んでいれば両端のボックス) へ移動":`Go to the selected box (or both ends of the selected wire)`,"表示と配置 (凡例・吸着・整列・ミニマップ・操作の説明)":`View and layout (legend, snap, arrange, minimap, tips)`,ミニマップ:`Minimap`,"分岐点の丸は同じ出力のつながりです。丸のない交差は接続されていません。":`A dot marks branches of the same output. Crossings without a dot are not connected.`,"AI と進める仕事に、見通しを。":`See the way forward with AI.`,"何ができた? 何を決めれば進める? ボックスと線で、次の一歩が見えてきます。":`What is ready? What needs a decision? Boxes and connections reveal your next step.`,サンプルを試す:`Try the sample`,自分の計画で始める:`Start with your own plan`,"保存した計画はここから再開できます。":`Your saved plans will appear here.`,"AI と同じ boxglow.json を見ながら作業できます。共同編集には、下のコマンドでローカルサーバーを起動してください。":`Work with the same boxglow.json as your AI agent. Start the local server below to edit together.`},gf={題名:`Title`,名前:`Name`,説明:`Description`,引き継ぎメモ:`Handoff note`,判断と回答:`Decisions and answers`,成果物:`Artifacts`,位置:`Position`,ブロックを検索:`Search blocks`,回答が必要です:`Your answer is needed`,AI未確認の回答:`Answers not yet read by AI`,カテゴリなし:`No category`,再開:`Resume`,"引き継ぎ・未確認の回答・次の候補":`Handoffs, unread answers and next actions`,"記録を読み直してから作業を再開します。ここを開くだけでは回答を確認済みにしません。":`Review the saved context before resuming. Opening this view does not acknowledge answers.`,"引き継ぎ(新しい順)":`Handoffs (newest first)`,"引き継ぎメモはまだありません。各タスクの「AI への引き継ぎ」に残せます。":`No handoffs yet. Add a note under AI handoff in a task.`,次の候補:`Next actions`,"作業中・確認待ち":`Working / awaiting review`,"CLI: boxglow resume → boxglow context B番号 で最新の判断を読みます。":`CLI: boxglow resume → boxglow context B-number to read the current decisions.`,"この組み合わせでは参照がつながりません。選択を見直すか、手元を退避して最新のファイルを開いてください。":`These choices leave invalid references. Revise your choices or export your edits and open the latest file.`,削除済み:`Deleted`,空欄:`Empty`,タスク全体:`Entire task`,競合する変更を比較:`Compare conflicting changes`,"別の項目の変更は両方残ります。同じ項目を変更した箇所だけ、残す内容を選んでください。":`Changes to different fields are kept on both sides. Choose which value to keep for each conflicting field.`,"番号の重複は自動で解消します。":`Duplicate task numbers are resolved automatically.`,手元の編集:`Your edits`,最新のファイル:`Latest file`,"未選択: {n}":`Unselected: {n}`,あとで選ぶ:`Decide later`,選択した内容で統合:`Merge selected values`,変更を比較して選ぶ:`Compare and choose`,両方の変更を統合:`Merge both versions`,バージョンと接続先:`Versions and connection`,保存先:`Saved to`,閲覧専用ファイル:`Read-only file`,取得できません:`Unavailable`,接続先のアプリ:`Connected app`,保存方式:`Save protocol`,接続先:`Peer`,"接続先と画面のバージョンが異なるか、確認できません。CLI・拡張を更新し、画面を再読み込みしてください。":`The connected version differs or is unavailable. Update the CLI or extension and reload the view.`,"{file} に自動で保存します (変更後)。Save で今すぐ書きます":`Edits are saved automatically to {file}. Save writes immediately.`},_f={"New: 出力 (何を作るか) は決めたが、まだ手を付けていない (BlackBox)":`New: the output (what to make) is decided, nothing started yet (BlackBox)`,"In Progress: 分解中、または作業中 (GrayBox)":`In Progress: being broken down, or being worked on (GrayBox)`,"Done: 出力に成果物が付いて完了 (WhiteBox)":`Done: the output has its deliverable (WhiteBox)`,作業中:`Working`,詰まり:`Blocked`,判断待ち:`Needs decision`,確認待ち:`In review`,検討:`Study`,調査:`Research`,設計:`Design`,デザイン:`UI`,実装:`Build`,検証:`Verify`,評価:`Evaluate`,改善:`Improve`,課題解決:`Fix`,文書:`Docs`,運用:`Ops`,その他:`Other`,プロジェクト:`Project`,自動:`auto`,"(任意)":`(optional)`,今:`now`,"{n} 分":`{n} min`,"{n} 時間":`{n} h`,"{n} 日":`{n} d`,たった今:`just now`,"{ago}前から":`for {ago}`,人:`human`},vf={"ゴール (何を達成したいか)":`Goal (what to achieve)`,"完了 {white} / {total}":`Done {white} / {total}`,"グループの名前 (例: PCIe 仕様書)":`Group name (e.g. PCIe spec)`,"このグループを JSON に書き出す (他のプロジェクトで読み込める)":`Export this group as JSON (can be imported into another project)`,"グループを消す (入力は Inputs に戻る)":`Delete this group (its inputs go back to Inputs)`,"グループ「{name}」を消しますか? (入力は Inputs に戻ります)":`Delete group "{name}"? (Its inputs go back to Inputs)`,"説明 (任意。例: PCI-SIG の仕様書一式)":`Description (optional, e.g. PCI-SIG spec set)`,"ここには、下の階層で供給元が決まっていない入力が自動で上がります。各入力はグループに移せます。":`Inputs with no source in the levels below are raised here automatically. Each input can be moved into a group.`,他のプロジェクトで書き出したグループを読み込む:`Import a group exported from another project`,"仕様書などを種類ごとに分けるときは、グループを作って入力を入れます (例: PCIe 仕様書、DDR 仕様書)。":`To sort specs and the like by kind, create a group and put inputs in it (e.g. PCIe spec, DDR spec).`,"「{title}」と下の階層のブロックを削除します。よろしいですか?":`Delete "{title}" and all boxes below it?`,"AI に渡すテキストをコピーしました":`Copied the text for the AI`,"部品の札 (例: 画像処理, 認証。カンマ区切り。省略可)":`Tags for the part (e.g. image processing, auth; comma-separated; optional)`,"「{name}」を部品として保存しました (☰ の「部品」から挿入)":`Saved "{name}" as a part (insert it from Parts in ☰)`,"短い ID (押すとコピー。検索や CLI で使えます)":`Short ID (click to copy; works in search and the CLI)`,"ID {key} をコピーしました":`Copied ID {key}`,"Title (何を作るか)":`Title (what to make)`,"状態・進捗・活動・判断":`Status, progress, activity, decisions`,"入力と出力 (成果物)":`Inputs and outputs (deliverables)`,担当:`Owner`,"開始日・期日・時間":`Start, due date, hours`,"AI に渡す・メモ・資料":`AI hand-off, notes, links`,"下の階層が全部完了し、出力に成果物が付いています":`Everything below is done and the output has its deliverable`,"完了にできます → Done":`Ready to mark → Done`,"必須の入力はそろっています (着手できます)":`All required inputs are in (ready to start)`,"必須の入力待ち: {names}":`Waiting for required inputs: {names}`,"パスや URL (例: ../mg-core、github.com/you/repo)":`Path or URL (e.g. ../mg-core, github.com/you/repo)`,"複数のリポジトリをまたぐときは、boxglow.json を上のフォルダに 1 つ置き、各リポジトリの AI には環境変数 BOXGLOW_FILE でその場所を教えます":`For several repositories, keep one boxglow.json in the parent folder and point each repository's AI to it with the BOXGLOW_FILE environment variable`,"進捗 (ドラッグで入力)":`Progress (drag to set)`,"手入力をやめて、下の階層から自動で計算する":`Stop manual entry and compute from the levels below`,下の階層の完了数:`Done count in the levels below`,活動の印を消す:`Clear the activity mark`,"判断の記録 ({n})":`Decision history ({n})`,"{name} (自分)":`{name} (me)`,自分を担当にする:`Assign to me`,"名前を打って Enter で登録":`Type a name and press Enter to add`,"名前で検索して Enter で割り当て":`Search by name and press Enter to assign`,"見つかりません。Enter で「{name}」を登録して割り当て":`No match. Press Enter to add "{name}" and assign`,開始:`Start`,期日:`Due`,見積:`Est.`,実績:`Actual`,"期日を {d} 日過ぎています":`{d} days past due`,期日は今日です:`Due today`,"期日まであと {d} 日":`{d} days until due`,"JIRA / Redmine / GitHub Issue の URL":`JIRA / Redmine / GitHub Issue URL`,"開く: {key}":`Open: {key}`,"このボックスの入出力と位置づけを Markdown にしてコピーして AI に渡す":`Copy this box's inputs, outputs and context as Markdown for an AI`,"手順を提案してもらう (コピー)":`Ask for a plan (copy)`,"分解案を JSON でもらう (コピー)":`Ask for a breakdown as JSON (copy)`,"入出力の抜けを指摘してもらう (コピー)":`Ask for missing inputs/outputs (copy)`,"メモ (入力から出力をどう作るか)":`Notes (how to turn inputs into outputs)`,"{title} のタブでこの線の続きを見る":`Follow this wire in the {title} tab`,"All でこの線を見る":`View this wire in All`,"「{name}」":` "{name}"`,"自動の線。手動でつなぐと置き換わります。":`Automatic wire. Connecting manually replaces it.`},yf={"ファイルの移動を検出し、パスを付け替えました":`File move detected; path updated`,"現在のリポジトリに見つかりません (コミットからは取り出せます)":`Not found in the current repository (still available from the commit)`,"名前 (例: 設計書 v1, PR #12)":`Name (e.g. Design doc v1, PR #12)`,"URL (任意)":`URL (optional)`,入力を追加:`Add input`,出力を追加:`Add output`,新しい入力:`New input`,新しい出力:`New output`,"入力の名前は供給元 ({owner}) の出力名です。変えるなら供給元の出力で":`The input name comes from the source output ({owner}). Rename it on the source output`,"下の階層の未接続の入力 (自動)。元の入力をつなぐと消えます":`Unconnected input from a lower level (auto). Disappears once the original input is connected`,"まだ供給元の無い入力。つなぐと供給元の出力名になります":`Input with no source yet. Once connected it takes the source output's name`,"任意: 無くても着手できます":`Optional: work can start without it`,任意:`Optional`,必須:`Required`,入力グループ:`Input group`,"形式・制約などの設定":`Format, constraints and other settings`,"from {owner}「{name}」":`from {owner} "{name}"`,"入力物 (この入力の実体)":`Input items (what this input actually is)`,"成果物 (この出力の実体)":`Deliverables (what this output actually is)`,入力物を追加:`Add input item`,成果物を追加:`Add deliverable`,"形式・制約は供給元「{name}」の出力で書きます":`Format and constraints are written on the source output "{name}"`,"形式・制約 (任意。例: Markdown、PNG 1920x1080、API は OpenAPI 3)":`Format / constraints (optional, e.g. Markdown, PNG 1920x1080, OpenAPI 3 for APIs)`,"必須: この入力がそろうまで着手できない (ボックスの Ready に効く)":`Required: work cannot start until this input is ready (affects the box's Ready)`,"任意: 無くても着手できる":`Optional: work can start without it`,そろうまで着手できない:`Cannot start until ready`,無くても着手できる:`Can start without it`,ドラッグで幅を変える:`Drag to resize`,カレンダーから選ぶ:`Pick from calendar`,開く:`Expand`,閉じる:`Collapse`,テンプレートをライブラリに追加しました:`Template added to the library`,"ボックスの一覧 (押すと選ぶ)":`List of boxes (click to select)`,状態や担当でボックスを絞る:`Filter boxes by status or assignee`,"担当にする人を登録。自分を決める":`Register people to assign. Choose who you are`,他のプロジェクトでも使い回すボックス:`Boxes reused across projects`,自分の担当だけ:`Only mine`,担当がいないボックスだけ:`Only unassigned boxes`,"{name} の担当だけ":`Only assigned to {name}`,"{label} のボックスだけ":`Only {label} boxes`,"挿入先: {target}":`Insert into: {target}`,"{title} の隣":`next to {title}`,最上位:`top level`,"ボックスを選び、右の「⋯」から「Save as Part」すると、ここに並びます。":`Select a box and choose "Save as Part" from the "..." menu on the right to list it here.`,挿入:`Insert`,"JSON で保存 (他のリポジトリや人と共有)":`Save as JSON (share with other repositories or people)`,ライブラリから消す:`Remove from library`,"テンプレート「{name}」を消しますか?":`Delete template "{name}"?`,"このブラウザでは自分として扱う (自分の担当のボックスに帯が付く)":`Treat as me in this browser (your boxes get a stripe)`,外す:`Remove`,色を変える:`Change color`,"{actor} からの質問 ({ago})":`Question from {actor} ({ago})`,"Ctrl+Enter でも保存":`Ctrl+Enter also saves`,"選んだ:":`Chosen:`,"残した候補:":`Other candidates:`,"以前の答え:":`Previous answers:`,"{answer} ({by}、{note})":`{answer} ({by}, {note})`,"答えの文面を直す (書き間違いや補足。選び直しではない)":`Edit the answer text (typos or notes, not a re-decision)`,"やり直す理由 (任意)":`Reason for redoing (optional)`,"方針転換: 答えを履歴に残して、候補から選び直す":`Change of direction: keep the answer in history and choose again`,やり直す:`Redo`,"または自由に書く (複数行可)":`Or write freely (multi-line)`,"回答を書く (複数行可)":`Write an answer (multi-line)`,"Enter は改行。送るのはボタンか Ctrl+Enter":`Enter adds a line. Send with the button or Ctrl+Enter`,このボックスを画面で選ぶ:`Select this box on the canvas`,"ボックスへ →":`Go to box →`,"閉じる (Esc)":`Close (Esc)`,"出力: {outs}":`Output: {outs}`,"まだありません。CLI や画面の操作で記録されます。":`Nothing yet. Actions from the CLI or the UI are recorded here.`,"AI 確認済み ({by}、{ago})":`Read by the AI ({by}, {ago})`,"AI 未確認 (まだ読まれていません。編集できます)":`Not read by the AI yet (you can still edit)`,回答済み:`Answered`,"判断待ち: あなたの回答で AI が進めます":`Needs decision: the AI continues once you answer`,"回答済み: AI がまだ読んでいない回答 (読まれるまで残り、編集できます)":`Answered: not read by the AI yet (stays until it is, and can be edited)`,"作業中・詰まり・確認待ちのボックス":`Boxes being worked on, blocked or in review`,"未着手で、次に着手できるボックス":`Boxes not started yet that can be picked up next`,"最近の記録 (新しい順)":`Recent records (newest first)`,"あなたの回答で AI が進めます":`The AI continues once you answer`,"判断待ちはありません。答えたものは Answered にあります":`Nothing needs a decision. What you answered is under Answered`,判断待ちはありません:`Nothing needs a decision`,"AI がまだ読んでいない回答。読まれるまでここに残ります":`Answers the AI has not read yet. They stay here until it does`,"AI が未確認の回答はありません":`No answers waiting to be read by the AI`,作業中のボックスはありません:`No boxes are being worked on`,"未着手のボックス (着手できるものから)":`Boxes not started (ready ones first)`,未着手のボックスはありません:`No boxes left to start`},bf={"カテゴリ: {label}":`Category: {label}`,"{title} (部品: {name})":`{title} (part: {name})`,"この大項目のタブを開く (中のボックス {n} 個)":`Open this item's tab ({n} boxes inside)`,下の階層を展開する:`Expand children`,下の階層を畳む:`Collapse children`,状態:`Status`,"下の階層の完了 {done}":`Children done: {done}`,"下の階層の完了 {done} ({percent}%)":`Children done: {done} ({percent}%)`,進捗:`Progress`,"進捗 {percent}%":`Progress {percent}%`,"期日 {date}":`Due {date}`,"期日 {date} ({d} 日超過)":`Due {date} ({d} days overdue)`,"期日 {date} (あと {d} 日)":`Due {date} ({d} days left)`,"必須の入力がそろっています (着手できます)":`All required inputs are ready (you can start)`,"外部の課題: {url}":`External issue: {url}`,"部品: {name}":`Part: {name}`,部品:`Part`,"ID (検索や CLI で使えます)":`ID (usable in search and the CLI)`,"{name} (用意できています)":`{name} (ready)`,"{name} (任意: 無くても着手できます)":`{name} (optional: you can start without it)`,"{name} を中のブロックへ (ここから中のボックスの入力へドラッグ)":`{name} into the inner boxes (drag from here to an inner input)`,"中のブロックの出力を {name} へ":`Inner box output to {name}`,"空のグループ (右のパネルで入力を入れる)":`Empty group (add inputs in the right panel)`,供給元のない入力がここに上がります:`Inputs without a source appear here`,"下の階層の未接続の入力 (自動)":`Unconnected input from a child (auto)`,未担当:`Unassigned`},xf={"最新のファイルを取得できません。接続を確認して保存を再試行してください。":`Could not read the latest file. Check the connection and retry saving.`,"別の保存処理が進行中です。編集は保持しています。少し待って保存を再試行してください。":`Another save is in progress. Your edits are retained. Wait briefly and retry saving.`,"計画の形式や参照に問題があり、保存できません。編集を JSON で退避して確認してください。":`The plan has an invalid structure or reference. Export your edits as JSON for review.`,"計画が保存可能なサイズ(5 MiB)を超えています。編集を JSON で退避してください。":`The plan exceeds the 5 MiB save limit. Export your edits as JSON.`,"接続できません。編集は保持しています。サーバーを確認して保存を再試行してください。":`Connection failed. Your edits are retained. Check the server and retry saving.`,閲覧専用:`Read only`,"保存の応答がありません。編集は画面に残っています。再試行してください。":`No save acknowledgement. Your edits remain here. Retry saving.`,"他の編集と競合しました。両方の変更を保持しているので、統合方法を選んでください。":`Another edit conflicts with yours. Both versions are retained. Choose how to resolve them.`,"共同編集は npx boxglow serve --open または VS Code 拡張で開いてください。":`For shared editing, open with npx boxglow serve --open or the VS Code extension.`,"未保存の編集があります。必要なら JSON を書き出してください。編集を破棄して移動しますか?":`You have unsaved edits. Export JSON if needed. Discard the edits and leave?`,"未保存の編集があります。必要なら先に JSON を書き出してください。編集を破棄して移動しますか?":`You have unsaved edits. Export JSON first if needed. Discard the edits and leave?`,保存に失敗しました:`Saving failed`,"このファイルは閲覧専用です。共同編集は npx boxglow serve --open または VS Code 拡張で開いてください。":`This file is read-only. For shared editing, use npx boxglow serve --open or the VS Code extension.`,"手元の編集を JSON で退避":`Export unsaved edits as JSON`,手元を退避して最新のファイルを開く:`Export mine and open the latest file`,"別の項目の変更です。統合できます。":`Different fields changed. They can be merged.`,保存を再試行:`Retry saving`,"AI への引き継ぎ":`Agent handoff`,"セッションを越えて残す発見・次の手順・未解決事項。AI は context コマンドで判断と合わせて読み直します。":`Keep findings, next steps and open questions across sessions. Agents reread these with decisions using the context command.`,"発見 / 次の手順 / 未解決事項":`Findings / next steps / open questions`,引き継ぎ情報をコピーしました:`Handoff context copied`,"判断・入出力も含めてコピー":`Copy with decisions and input/output contracts`,ファイルを閲覧:`View file`,コピー:`Copy`,ブラウザ内:`Browser`,新しいブロック:`New box`,大項目の一覧へ:`Back to the overview`,"{title} へ戻る":`Back to {title}`,絞り込みを解除:`Clear the filter`,ブロックを置く:`Add a box`,"または「+ Block」(選んだボックスの中に)":`or "+ Box" (inside the selected box)`,"上の切替。Edit のときだけドラッグで移動・結線・階層移動と Del が効く":`Toggle at the top. Drag to move, wire, re-parent and Del work only in Edit`,結線:`Wire`,"丸から相手の丸、または相手のボックスへドラッグ (近くで離せばつながる)":`Drag from a dot to another dot or box (release nearby to connect)`,階層を移す:`Move into a box`,ボックスをドラッグして別のボックスの中に落とす:`Drag a box and drop it inside another`,"下の階層を畳む / 展開":`Collapse / expand`,ブロックをダブルクリック:`Double-click a box`,削除:`Delete`,"元に戻す / やり直す":`Undo / Redo`,選択を解除:`Clear selection`,"ボックスは「入力から出力を作るタスク」。出力を先に決め、大きなボックスは「分解する」で中にボックスを置く。供給元の無い入力は左端の入力まで自動で点線が伸びる。":`A box is a task that turns inputs into an output. Decide the output first; break big boxes down by putting boxes inside. Inputs with no source get a dotted line from the left edge automatically.`,"Boxglow で開く":`Open in Boxglow`,"ビルド日時 (日本時間)。古い場合は再読み込み (Ctrl+F5) してください":`Build time (JST). If it looks old, reload with Ctrl+F5`,"追加するプロジェクトの名前 (リポジトリごとに 1 つなど)":`Name of the project to add (e.g. one per repository)`,"Mermaid をコピーしました":`Mermaid copied`,コピーできませんでした:`Could not copy`,"サンプルは保存されません。Save で自分のプロジェクトとして保存":`The sample is not saved. Press Save to keep it as your own project`,このブラウザに自動で保存します:`Auto-saves in this browser`,"階層 / 絞り込み / メンバー / 部品":`Tree / Filter / Members / Parts`,"Home (プロジェクト一覧へ)":`Home (project list)`,自分のプロジェクトとして保存:`Save as your own project`,"今の状況 (作業中・判断待ち・ログ)":`Current activity (working, decisions, log)`,"Edit モード: ドラッグで移動・結線・階層移動ができます。押すと View (閲覧) に":`Edit mode: drag to move, wire and re-parent. Click to switch to View`,"View モード: ドラッグでの編集は効きません。押すと Edit に":`View mode: dragging does not edit. Click to switch to Edit`,"Search ID / 題名":`Search ID / title`,見つかりません:`No matches`,"ブロックを追加 (N)。ボックスを選んでいればその中に、選んでいなければプロジェクトの中に":`Add a box (N): inside the selected box, or in the project if nothing is selected`,"Auto Layout: 依存関係で並べ直す (大項目は畳んだ前提)":`Auto Layout: arrange by dependencies (top-level boxes assumed collapsed)`,"元に戻す (Ctrl+Z)":`Undo (Ctrl+Z)`,"やり直す (Ctrl+Y)":`Redo (Ctrl+Y)`,同じファイルにプロジェクトのボックスを足す:`Add a project box to the same file`,画面の文言の言語を切り替える:`Switch the UI language`,"タブの一覧 (押して選ぶ)":`List of tabs (click to pick)`,左へ:`Scroll left`,右へ:`Scroll right`,"大項目の一覧を俯瞰する (中はそれぞれのタブで)":`Overview of top-level boxes (open a tab to look inside)`,"{title} (選んだ線の続きがある)":`{title} (the selected wire continues here)`,"{title} の中を見る":`Look inside {title}`,"AI エージェントとチームの作業を、ボックスと線で一目で。":`See what AI agents and your team are doing, at a glance, as boxes and wires.`,前回開いたファイル:`The file you opened last time`,"「{name}」を削除します。よろしいですか?":`Delete "{name}"?`,すきま研究所日誌:`An app from Sukima Lab Diary`,"サーバに書けません ({status})":`Could not write to the server ({status})`,"ファイルへの書き込みが許可されていません (Save を押すともう一度確認します)":`Writing to the file was not allowed (press Save to ask again)`,"保存に失敗しました: {error}":`Save failed: {error}`,ファイルへの書き込みが許可されていません:`Writing to the file was not allowed`,無題のプロジェクト:`Untitled project`,ファイルの読み書きが許可されませんでした:`Access to the file was not allowed`,"ファイルを読めません: {error}":`Could not read the file: {error}`,"サーバから読めません (npx boxglow serve が動いていますか): {error}":`Could not read from the server (is npx boxglow serve running?): {error}`,"「{name}」を読み込みました":`Loaded "{name}"`,"{name} (複製)":`{name} (copy)`,自分のプロジェクトとして保存しました:`Saved as your own project`,"このファイルはブラウザから直接開けませんでした ({error})。npx boxglow serve --open なら、どの場所のファイルでも開けます":`The browser could not open this file directly ({error}). npx boxglow serve --open opens a file in any location`,"AI と一緒に使う":`WORK WITH YOUR AI AGENT`,リポジトリの計画を開く:`Open your repository plan`,"WSL・Firefox・Safari でも使うには、計画のあるフォルダーで実行します。":`For WSL, Firefox or Safari, run this in the folder containing your plan.`,まずブラウザで試す:`Try it in your browser`,"作成・インポートした計画は、このブラウザに保存されます。元のファイルや AI とは自動で同期しません。":`Created and imported plans are saved in this browser. They do not automatically sync with the original file or your AI agent.`,新しい計画の名前:`New project name`,このブラウザに保存した計画:`Saved in this browser`,"使い方・CLI の手順":`Guide and CLI commands`,コマンドをコピーしました:`Command copied`,"「{name}」を削除":`Delete "{name}"`,変更なし:`No changes`,"競合を統合: {path} (採用: {selected} / 手元: {ours} / 相手: {theirs})":`Conflict {path}: selected {selected}; local {ours}; remote {theirs}`},Sf={"boxglow.json が見つかりません (--file で指定するか、`boxglow init` で作ってください)":"boxglow.json not found (pass --file, or create one with `boxglow init`)","知らないコマンドです: {cmd} (boxglow help で一覧)":`Unknown command: {cmd} (run boxglow help for the list)`,"知らないカテゴリです: {text} (使えるもの: {list})":`Unknown category: {text} (available: {list})`,"<{what}> を指定してください (id または題名)":`Specify <{what}> (id or title)`,"ブロック「{ref}」が1 つに決まりません。 候補: {list}":`"{ref}" matches more than one box. Candidates: {list}`,"ブロック「{ref}」が見つかりません。":`Box "{ref}" not found.`,"「{ref}」は <題名>.<ポート名> の形で指定してください":`Write "{ref}" as <title>.<port name>`,"「{ref}」のボックスが見つかりません (<題名>.<ポート名> の形。題名は status に出る題名か B 番号)":`No box found for "{ref}" (use <title>.<port name>; the title is a title shown in status, or a B number)`,"「{ref}」のポートが見つかりません":`Port not found for "{ref}"`,"<名前> を指定してください":`Specify <name>`,"<題名> を指定してください":`Specify <title>`,"<path> を指定してください":`Specify <path>`,"<質問> を指定してください":`Specify <question>`,"<回答> を指定してください":`Specify <answer>`,"<URL またはパス> を指定してください":`Specify <URL or path>`,見つかりません:`No matches`,新しいプロジェクト:`New project`,"{path} は既にあります (--force で上書き)":`{path} already exists (use --force to overwrite)`,"作成: {path}":`Created: {path}`,"書き出し: {target}":`Exported: {target}`,".mcp.json (MCP サーバ boxglow)":`.mcp.json (MCP server boxglow)`,"設定しました: {list}\nAI は作業の始まり・終わり・判断待ちを boxglow.json に記録し、セッションの最初に計画を読みます。人は画面で見て判断してください (編集と回答は npx boxglow serve --open か VS Code 拡張で。boxglow.json を直接開いた画面は閲覧専用です)":`Set up: {list}
|
|
15
|
+
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}rf.displayName=`MiniMap`;var af=(0,y.memo)(rf),of=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sf={[Ks.Line]:`right`,[Ks.Handle]:`bottom-right`};function cf({nodeId:e,position:t,variant:n=Ks.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Rl(),b=typeof e==`string`?e:v,C=xc(),w=(0,y.useRef)(null),T=n===Ks.Handle,E=W((0,y.useCallback)(of(T&&p),[T,p]),gc),D=(0,y.useRef)(null),O=t??sf[n];(0,y.useEffect)(()=>{if(w.current&&b)return D.current||=rc({domNode:w.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=C.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=C.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=us([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...ho({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};C.getState().triggerNodeChanges([n])}}),D.current.update({controlPosition:O,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{D.current?.destroy()}},[O,s,c,l,u,d,h,g,_,m]);let k=O.split(`-`);return(0,x.jsx)(`div`,{className:S([`react-flow__resize-control`,`nodrag`,...k,n,r]),ref:w,style:{...i,scale:E,...o&&{[T?`backgroundColor`:`borderColor`]:o}},children:a})}(0,y.memo)(cf);var lf=e=>`${Math.round(e.x*1e3)},${Math.round(e.y*1e3)}`,uf=(e,t)=>lf(e)===lf(t),df=e=>`${e.source}|${lf(e.s)}`;function ff(e,t,n=new Set){let r=new Map,i=new Map;for(let n of t){let t=i.get(df(n))??[];t.push(n),i.set(df(n),t),r.set(n.id,{parts:[e.get(n.id)??[]],junctions:[],corners:[]})}for(let t of i.values()){if(t.length<2)continue;let i=t.flatMap(t=>e.get(t.id)??[]),a=new Map,o=new Map,s=[...t].sort((e,t)=>Number(n.has(t.id))-Number(n.has(e.id))||e.id.localeCompare(t.id));for(let t of s){let n=e.get(t.id)??[],r=[];for(let e=1;e<n.length;e++){let o=n[e-1],s=n[e],c=Math.abs(o.y-s.y)<.01;if(uf(o,s))continue;let l=[o,...i.filter(e=>c?Math.abs(e.y-o.y)<.01&&e.x>Math.min(o.x,s.x)&&e.x<Math.max(o.x,s.x):Math.abs(e.x-o.x)<.01&&e.y>Math.min(o.y,s.y)&&e.y<Math.max(o.y,s.y)),s].sort((e,t)=>c?(e.x-t.x)*Math.sign(s.x-o.x):(e.y-t.y)*Math.sign(s.y-o.y));for(let e=1;e<l.length;e++){let n=l[e-1],i=l[e];if(uf(n,i))continue;let o=[lf(n),lf(i)].sort().join(`|`);a.has(o)||a.set(o,{a:n,b:i,owner:t.id}),r.push({a:n,b:i,atom:o})}}o.set(t.id,r)}let c=new Map,l=new Map;for(let{a:e,b:t}of a.values())for(let[n,r]of[[e,t],[t,e]]){let e=lf(n),t=c.get(e)??new Set;t.add(lf(r)),c.set(e,t),l.set(e,n)}let u=[...c].filter(([,e])=>e.size>=3).map(([e])=>l.get(e));for(let e of t){let t=[],n=[];for(let r of o.get(e.id)??[]){if(a.get(r.atom).owner!==e.id){n.length>1&&t.push(n),n=[];continue}n.length&&uf(n[n.length-1],r.a)?n.push(r.b):(n.length>1&&t.push(n),n=[r.a,r.b])}n.length>1&&t.push(n),r.set(e.id,{parts:t,junctions:[],corners:u})}for(let e of u){let t=s.find(t=>(o.get(t.id)??[]).some(t=>uf(t.a,e)||uf(t.b,e)));t&&r.get(t.id).junctions.push(e)}}return r}var pf=[{key:`study`,label:`検討`,en:`study`,color:`#6b7075`},{key:`research`,label:`調査`,en:`research`,color:`#7a5230`},{key:`design`,label:`設計`,en:`design`,color:`#2f6fb3`},{key:`ui`,label:`デザイン`,en:`ui`,color:`#c0427a`},{key:`build`,label:`実装`,en:`build`,color:`#5a4fcf`},{key:`verify`,label:`検証`,en:`verify`,color:`#26753d`},{key:`evaluate`,label:`評価`,en:`evaluate`,color:`#8a6508`},{key:`improve`,label:`改善`,en:`improve`,color:`#b5581a`},{key:`fix`,label:`課題解決`,en:`fix`,color:`#c0392b`},{key:`docs`,label:`文書`,en:`docs`,color:`#5f6f3a`},{key:`ops`,label:`運用`,en:`ops`,color:`#1f7a8c`},{key:`other`,label:`その他`,en:`other`,color:`#8a8f94`,neutral:!0}];function mf(e){if(e)return pf.find(t=>t.key===e)}var hf={キャンセル:`Cancel`,"この階層を整列しました。Ctrl+Z で元に戻せます。":`Arranged this level. Press Ctrl+Z to undo.`,"接続先の入力をクリック。Esc でキャンセル":`Click the destination input. Esc to cancel.`,配線の凡例:`Connection legend`,未確定:`Pending`,確定済み:`Ready`,選択中の経路:`Selected path`,キャンバスの表示:`Canvas view`,縮小:`Zoom out`,拡大:`Zoom in`,"100% で文字を読む":`Read text at 100%`,"ドラッグしたボックスを 8px のグリッドに揃える":`Snap dragged boxes to an 8px grid`,吸着:`Snap`,"この階層のボックスだけを整列。子の中や別の階層の配置は保持します。":`Arrange this level only. Keep nested and other levels in place.`,この階層を整列:`Arrange this level`,"入力: {name}":`Input: {name}`,"出力: {name} (クリックまたはドラッグで接続)":`Output: {name} (click or drag to connect)`,"右の出力 → 左の入力の順に丸をクリック、またはドラッグで接続。線を選ぶと経路を追えます。":`Click the right output, then the left input, or drag to connect. Select a line to follow its path.`,"線を選ぶと経路を追えます。ボックスの移動・接続は上部の Edit で有効にできます。":`Select a line to follow its path. Enable Edit above to move or connect boxes.`,"ボックスをダブルクリックすると中を開きます。100% は文字を読む倍率、Fit は配置を見渡す倍率です。":`Double-click a box to open it. Use 100% to read text and Fit to see the layout.`,"全体表示: この階層のボックスがすべて収まる倍率にする":`Fit: zoom so every box on this level is visible`,"選んだボックス (線を選んでいれば両端のボックス) へ移動":`Go to the selected box (or both ends of the selected wire)`,"表示と配置 (凡例・吸着・整列・ミニマップ・操作の説明)":`View and layout (legend, snap, arrange, minimap, tips)`,ミニマップ:`Minimap`,"分岐点の丸は同じ出力のつながりです。丸のない交差は接続されていません。":`A dot marks branches of the same output. Crossings without a dot are not connected.`,"AI と進める仕事に、見通しを。":`See the way forward with AI.`,"何ができた? 何を決めれば進める? ボックスと線で、次の一歩が見えてきます。":`What is ready? What needs a decision? Boxes and connections reveal your next step.`,サンプルを試す:`Try the sample`,自分の計画で始める:`Start with your own plan`,"保存した計画はここから再開できます。":`Your saved plans will appear here.`,"AI と同じ boxglow.json を見ながら作業できます。共同編集には、下のコマンドでローカルサーバーを起動してください。":`Work with the same boxglow.json as your AI agent. Start the local server below to edit together.`},gf={"回答待ち {n}":`Awaiting answers: {n}`,"AI未確認 {n}":`Unacknowledged: {n}`,"Status で確認":`View in Status`,題名:`Title`,名前:`Name`,説明:`Description`,引き継ぎメモ:`Handoff note`,判断と回答:`Decisions and answers`,成果物:`Artifacts`,位置:`Position`,ブロックを検索:`Search blocks`,回答が必要です:`Your answer is needed`,AI未確認の回答:`Answers not yet read by AI`,カテゴリなし:`No category`,再開:`Resume`,"引き継ぎ・未確認の回答・次の候補":`Handoffs, unread answers and next actions`,"記録を読み直してから作業を再開します。ここを開くだけでは回答を確認済みにしません。":`Review the saved context before resuming. Opening this view does not acknowledge answers.`,"引き継ぎ(新しい順)":`Handoffs (newest first)`,"引き継ぎメモはまだありません。各タスクの「AI への引き継ぎ」に残せます。":`No handoffs yet. Add a note under AI handoff in a task.`,次の候補:`Next actions`,"作業中・確認待ち":`Working / awaiting review`,"CLI: boxglow resume → boxglow context B番号 で最新の判断を読みます。":`CLI: boxglow resume → boxglow context B-number to read the current decisions.`,"この組み合わせでは参照がつながりません。選択を見直すか、手元を退避して最新のファイルを開いてください。":`These choices leave invalid references. Revise your choices or export your edits and open the latest file.`,削除済み:`Deleted`,空欄:`Empty`,タスク全体:`Entire task`,競合する変更を比較:`Compare conflicting changes`,"別の項目の変更は両方残ります。同じ項目を変更した箇所だけ、残す内容を選んでください。":`Changes to different fields are kept on both sides. Choose which value to keep for each conflicting field.`,"番号の重複は自動で解消します。":`Duplicate task numbers are resolved automatically.`,手元の編集:`Your edits`,最新のファイル:`Latest file`,"未選択: {n}":`Unselected: {n}`,あとで選ぶ:`Decide later`,選択した内容で統合:`Merge selected values`,変更を比較して選ぶ:`Compare and choose`,両方の変更を統合:`Merge both versions`,バージョンと接続先:`Versions and connection`,保存先:`Saved to`,閲覧専用ファイル:`Read-only file`,取得できません:`Unavailable`,接続先のアプリ:`Connected app`,保存方式:`Save protocol`,接続先:`Peer`,"接続先と画面のバージョンが異なるか、確認できません。CLI・拡張を更新し、画面を再読み込みしてください。":`The connected version differs or is unavailable. Update the CLI or extension and reload the view.`,"{file} に自動で保存します (変更後)。Save で今すぐ書きます":`Edits are saved automatically to {file}. Save writes immediately.`},_f={"New: 出力 (何を作るか) は決めたが、まだ手を付けていない (BlackBox)":`New: the output (what to make) is decided, nothing started yet (BlackBox)`,"In Progress: 分解中、または作業中 (GrayBox)":`In Progress: being broken down, or being worked on (GrayBox)`,"Done: 出力に成果物が付いて完了 (WhiteBox)":`Done: the output has its deliverable (WhiteBox)`,作業中:`Working`,詰まり:`Blocked`,判断待ち:`Needs decision`,確認待ち:`In review`,検討:`Study`,調査:`Research`,設計:`Design`,デザイン:`UI`,実装:`Build`,検証:`Verify`,評価:`Evaluate`,改善:`Improve`,課題解決:`Fix`,文書:`Docs`,運用:`Ops`,その他:`Other`,プロジェクト:`Project`,自動:`auto`,"(任意)":`(optional)`,今:`now`,"{n} 分":`{n} min`,"{n} 時間":`{n} h`,"{n} 日":`{n} d`,たった今:`just now`,"{ago}前から":`for {ago}`,人:`human`},vf={"ゴール (何を達成したいか)":`Goal (what to achieve)`,"完了 {white} / {total}":`Done {white} / {total}`,"グループの名前 (例: PCIe 仕様書)":`Group name (e.g. PCIe spec)`,"このグループを JSON に書き出す (他のプロジェクトで読み込める)":`Export this group as JSON (can be imported into another project)`,"グループを消す (入力は Inputs に戻る)":`Delete this group (its inputs go back to Inputs)`,"グループ「{name}」を消しますか? (入力は Inputs に戻ります)":`Delete group "{name}"? (Its inputs go back to Inputs)`,"説明 (任意。例: PCI-SIG の仕様書一式)":`Description (optional, e.g. PCI-SIG spec set)`,"ここには、下の階層で供給元が決まっていない入力が自動で上がります。各入力はグループに移せます。":`Inputs with no source in the levels below are raised here automatically. Each input can be moved into a group.`,他のプロジェクトで書き出したグループを読み込む:`Import a group exported from another project`,"仕様書などを種類ごとに分けるときは、グループを作って入力を入れます (例: PCIe 仕様書、DDR 仕様書)。":`To sort specs and the like by kind, create a group and put inputs in it (e.g. PCIe spec, DDR spec).`,"「{title}」と下の階層のブロックを削除します。よろしいですか?":`Delete "{title}" and all boxes below it?`,"AI に渡すテキストをコピーしました":`Copied the text for the AI`,"部品の札 (例: 画像処理, 認証。カンマ区切り。省略可)":`Tags for the part (e.g. image processing, auth; comma-separated; optional)`,"「{name}」を部品として保存しました (☰ の「部品」から挿入)":`Saved "{name}" as a part (insert it from Parts in ☰)`,"短い ID (押すとコピー。検索や CLI で使えます)":`Short ID (click to copy; works in search and the CLI)`,"ID {key} をコピーしました":`Copied ID {key}`,"Title (何を作るか)":`Title (what to make)`,"状態・進捗・活動・判断":`Status, progress, activity, decisions`,"入力と出力 (成果物)":`Inputs and outputs (deliverables)`,担当:`Owner`,"開始日・期日・時間":`Start, due date, hours`,"AI に渡す・メモ・資料":`AI hand-off, notes, links`,"下の階層が全部完了し、出力に成果物が付いています":`Everything below is done and the output has its deliverable`,"完了にできます → Done":`Ready to mark → Done`,"必須の入力はそろっています (着手できます)":`All required inputs are in (ready to start)`,"必須の入力待ち: {names}":`Waiting for required inputs: {names}`,"パスや URL (例: ../mg-core、github.com/you/repo)":`Path or URL (e.g. ../mg-core, github.com/you/repo)`,"複数のリポジトリをまたぐときは、boxglow.json を上のフォルダに 1 つ置き、各リポジトリの AI には環境変数 BOXGLOW_FILE でその場所を教えます":`For several repositories, keep one boxglow.json in the parent folder and point each repository's AI to it with the BOXGLOW_FILE environment variable`,"進捗 (ドラッグで入力)":`Progress (drag to set)`,"手入力をやめて、下の階層から自動で計算する":`Stop manual entry and compute from the levels below`,下の階層の完了数:`Done count in the levels below`,活動の印を消す:`Clear the activity mark`,"判断の記録 ({n})":`Decision history ({n})`,"{name} (自分)":`{name} (me)`,自分を担当にする:`Assign to me`,"名前を打って Enter で登録":`Type a name and press Enter to add`,"名前で検索して Enter で割り当て":`Search by name and press Enter to assign`,"見つかりません。Enter で「{name}」を登録して割り当て":`No match. Press Enter to add "{name}" and assign`,開始:`Start`,期日:`Due`,見積:`Est.`,実績:`Actual`,"期日を {d} 日過ぎています":`{d} days past due`,期日は今日です:`Due today`,"期日まであと {d} 日":`{d} days until due`,"JIRA / Redmine / GitHub Issue の URL":`JIRA / Redmine / GitHub Issue URL`,"開く: {key}":`Open: {key}`,"このボックスの入出力と位置づけを Markdown にしてコピーして AI に渡す":`Copy this box's inputs, outputs and context as Markdown for an AI`,"手順を提案してもらう (コピー)":`Ask for a plan (copy)`,"分解案を JSON でもらう (コピー)":`Ask for a breakdown as JSON (copy)`,"入出力の抜けを指摘してもらう (コピー)":`Ask for missing inputs/outputs (copy)`,"メモ (入力から出力をどう作るか)":`Notes (how to turn inputs into outputs)`,"{title} のタブでこの線の続きを見る":`Follow this wire in the {title} tab`,"All でこの線を見る":`View this wire in All`,"「{name}」":` "{name}"`,"自動の線。手動でつなぐと置き換わります。":`Automatic wire. Connecting manually replaces it.`},yf={"ファイルの移動を検出し、パスを付け替えました":`File move detected; path updated`,"現在のリポジトリに見つかりません (コミットからは取り出せます)":`Not found in the current repository (still available from the commit)`,"名前 (例: 設計書 v1, PR #12)":`Name (e.g. Design doc v1, PR #12)`,"URL (任意)":`URL (optional)`,入力を追加:`Add input`,出力を追加:`Add output`,新しい入力:`New input`,新しい出力:`New output`,"入力の名前は供給元 ({owner}) の出力名です。変えるなら供給元の出力で":`The input name comes from the source output ({owner}). Rename it on the source output`,"下の階層の未接続の入力 (自動)。元の入力をつなぐと消えます":`Unconnected input from a lower level (auto). Disappears once the original input is connected`,"まだ供給元の無い入力。つなぐと供給元の出力名になります":`Input with no source yet. Once connected it takes the source output's name`,"任意: 無くても着手できます":`Optional: work can start without it`,任意:`Optional`,必須:`Required`,入力グループ:`Input group`,"形式・制約などの設定":`Format, constraints and other settings`,"from {owner}「{name}」":`from {owner} "{name}"`,"入力物 (この入力の実体)":`Input items (what this input actually is)`,"成果物 (この出力の実体)":`Deliverables (what this output actually is)`,入力物を追加:`Add input item`,成果物を追加:`Add deliverable`,"形式・制約は供給元「{name}」の出力で書きます":`Format and constraints are written on the source output "{name}"`,"形式・制約 (任意。例: Markdown、PNG 1920x1080、API は OpenAPI 3)":`Format / constraints (optional, e.g. Markdown, PNG 1920x1080, OpenAPI 3 for APIs)`,"必須: この入力がそろうまで着手できない (ボックスの Ready に効く)":`Required: work cannot start until this input is ready (affects the box's Ready)`,"任意: 無くても着手できる":`Optional: work can start without it`,そろうまで着手できない:`Cannot start until ready`,無くても着手できる:`Can start without it`,ドラッグで幅を変える:`Drag to resize`,カレンダーから選ぶ:`Pick from calendar`,開く:`Expand`,閉じる:`Collapse`,テンプレートをライブラリに追加しました:`Template added to the library`,"ボックスの一覧 (押すと選ぶ)":`List of boxes (click to select)`,状態や担当でボックスを絞る:`Filter boxes by status or assignee`,"担当にする人を登録。自分を決める":`Register people to assign. Choose who you are`,他のプロジェクトでも使い回すボックス:`Boxes reused across projects`,自分の担当だけ:`Only mine`,担当がいないボックスだけ:`Only unassigned boxes`,"{name} の担当だけ":`Only assigned to {name}`,"{label} のボックスだけ":`Only {label} boxes`,"挿入先: {target}":`Insert into: {target}`,"{title} の隣":`next to {title}`,最上位:`top level`,"ボックスを選び、右の「⋯」から「Save as Part」すると、ここに並びます。":`Select a box and choose "Save as Part" from the "..." menu on the right to list it here.`,挿入:`Insert`,"JSON で保存 (他のリポジトリや人と共有)":`Save as JSON (share with other repositories or people)`,ライブラリから消す:`Remove from library`,"テンプレート「{name}」を消しますか?":`Delete template "{name}"?`,"このブラウザでは自分として扱う (自分の担当のボックスに帯が付く)":`Treat as me in this browser (your boxes get a stripe)`,外す:`Remove`,色を変える:`Change color`,"{actor} からの質問 ({ago})":`Question from {actor} ({ago})`,"Ctrl+Enter でも保存":`Ctrl+Enter also saves`,"選んだ:":`Chosen:`,"残した候補:":`Other candidates:`,"以前の答え:":`Previous answers:`,"{answer} ({by}、{note})":`{answer} ({by}, {note})`,"答えの文面を直す (書き間違いや補足。選び直しではない)":`Edit the answer text (typos or notes, not a re-decision)`,"やり直す理由 (任意)":`Reason for redoing (optional)`,"方針転換: 答えを履歴に残して、候補から選び直す":`Change of direction: keep the answer in history and choose again`,やり直す:`Redo`,"または自由に書く (複数行可)":`Or write freely (multi-line)`,"回答を書く (複数行可)":`Write an answer (multi-line)`,"Enter は改行。送るのはボタンか Ctrl+Enter":`Enter adds a line. Send with the button or Ctrl+Enter`,このボックスを画面で選ぶ:`Select this box on the canvas`,"ボックスへ →":`Go to box →`,"閉じる (Esc)":`Close (Esc)`,"出力: {outs}":`Output: {outs}`,"まだありません。CLI や画面の操作で記録されます。":`Nothing yet. Actions from the CLI or the UI are recorded here.`,"AI 確認済み ({by}、{ago})":`Read by the AI ({by}, {ago})`,"AI 未確認 (まだ読まれていません。編集できます)":`Not read by the AI yet (you can still edit)`,回答済み:`Answered`,"判断待ち: あなたの回答で AI が進めます":`Needs decision: the AI continues once you answer`,"回答済み: AI がまだ読んでいない回答 (読まれるまで残り、編集できます)":`Answered: not read by the AI yet (stays until it is, and can be edited)`,"作業中・詰まり・確認待ちのボックス":`Boxes being worked on, blocked or in review`,"未着手で、次に着手できるボックス":`Boxes not started yet that can be picked up next`,"最近の記録 (新しい順)":`Recent records (newest first)`,"あなたの回答で AI が進めます":`The AI continues once you answer`,"判断待ちはありません。答えたものは Answered にあります":`Nothing needs a decision. What you answered is under Answered`,判断待ちはありません:`Nothing needs a decision`,"AI がまだ読んでいない回答。読まれるまでここに残ります":`Answers the AI has not read yet. They stay here until it does`,"AI が未確認の回答はありません":`No answers waiting to be read by the AI`,作業中のボックスはありません:`No boxes are being worked on`,"未着手のボックス (着手できるものから)":`Boxes not started (ready ones first)`,未着手のボックスはありません:`No boxes left to start`},bf={"カテゴリ: {label}":`Category: {label}`,"{title} (部品: {name})":`{title} (part: {name})`,"この大項目のタブを開く (中のボックス {n} 個)":`Open this item's tab ({n} boxes inside)`,下の階層を展開する:`Expand children`,下の階層を畳む:`Collapse children`,状態:`Status`,"下の階層の完了 {done}":`Children done: {done}`,"下の階層の完了 {done} ({percent}%)":`Children done: {done} ({percent}%)`,進捗:`Progress`,"進捗 {percent}%":`Progress {percent}%`,"期日 {date}":`Due {date}`,"期日 {date} ({d} 日超過)":`Due {date} ({d} days overdue)`,"期日 {date} (あと {d} 日)":`Due {date} ({d} days left)`,"必須の入力がそろっています (着手できます)":`All required inputs are ready (you can start)`,"外部の課題: {url}":`External issue: {url}`,"部品: {name}":`Part: {name}`,部品:`Part`,"ID (検索や CLI で使えます)":`ID (usable in search and the CLI)`,"{name} (用意できています)":`{name} (ready)`,"{name} (任意: 無くても着手できます)":`{name} (optional: you can start without it)`,"{name} を中のブロックへ (ここから中のボックスの入力へドラッグ)":`{name} into the inner boxes (drag from here to an inner input)`,"中のブロックの出力を {name} へ":`Inner box output to {name}`,"空のグループ (右のパネルで入力を入れる)":`Empty group (add inputs in the right panel)`,供給元のない入力がここに上がります:`Inputs without a source appear here`,"下の階層の未接続の入力 (自動)":`Unconnected input from a child (auto)`,未担当:`Unassigned`},xf={"最新のファイルを取得できません。接続を確認して保存を再試行してください。":`Could not read the latest file. Check the connection and retry saving.`,"別の保存処理が進行中です。編集は保持しています。少し待って保存を再試行してください。":`Another save is in progress. Your edits are retained. Wait briefly and retry saving.`,"計画の形式や参照に問題があり、保存できません。編集を JSON で退避して確認してください。":`The plan has an invalid structure or reference. Export your edits as JSON for review.`,"計画が保存可能なサイズ(5 MiB)を超えています。編集を JSON で退避してください。":`The plan exceeds the 5 MiB save limit. Export your edits as JSON.`,"接続できません。編集は保持しています。サーバーを確認して保存を再試行してください。":`Connection failed. Your edits are retained. Check the server and retry saving.`,閲覧専用:`Read only`,"保存の応答がありません。編集は画面に残っています。再試行してください。":`No save acknowledgement. Your edits remain here. Retry saving.`,"他の編集と競合しました。両方の変更を保持しているので、統合方法を選んでください。":`Another edit conflicts with yours. Both versions are retained. Choose how to resolve them.`,"共同編集は npx boxglow serve --open または VS Code 拡張で開いてください。":`For shared editing, open with npx boxglow serve --open or the VS Code extension.`,"未保存の編集があります。必要なら JSON を書き出してください。編集を破棄して移動しますか?":`You have unsaved edits. Export JSON if needed. Discard the edits and leave?`,"未保存の編集があります。必要なら先に JSON を書き出してください。編集を破棄して移動しますか?":`You have unsaved edits. Export JSON first if needed. Discard the edits and leave?`,保存に失敗しました:`Saving failed`,"このファイルは閲覧専用です。共同編集は npx boxglow serve --open または VS Code 拡張で開いてください。":`This file is read-only. For shared editing, use npx boxglow serve --open or the VS Code extension.`,"手元の編集を JSON で退避":`Export unsaved edits as JSON`,手元を退避して最新のファイルを開く:`Export mine and open the latest file`,"別の項目の変更です。統合できます。":`Different fields changed. They can be merged.`,保存を再試行:`Retry saving`,"AI への引き継ぎ":`Agent handoff`,"セッションを越えて残す発見・次の手順・未解決事項。AI は context コマンドで判断と合わせて読み直します。":`Keep findings, next steps and open questions across sessions. Agents reread these with decisions using the context command.`,"発見 / 次の手順 / 未解決事項":`Findings / next steps / open questions`,引き継ぎ情報をコピーしました:`Handoff context copied`,"判断・入出力も含めてコピー":`Copy with decisions and input/output contracts`,ファイルを閲覧:`View file`,コピー:`Copy`,ブラウザ内:`Browser`,新しいブロック:`New box`,大項目の一覧へ:`Back to the overview`,"{title} へ戻る":`Back to {title}`,絞り込みを解除:`Clear the filter`,ブロックを置く:`Add a box`,"または「+ Block」(選んだボックスの中に)":`or "+ Box" (inside the selected box)`,"上の切替。Edit のときだけドラッグで移動・結線・階層移動と Del が効く":`Toggle at the top. Drag to move, wire, re-parent and Del work only in Edit`,結線:`Wire`,"丸から相手の丸、または相手のボックスへドラッグ (近くで離せばつながる)":`Drag from a dot to another dot or box (release nearby to connect)`,階層を移す:`Move into a box`,ボックスをドラッグして別のボックスの中に落とす:`Drag a box and drop it inside another`,"下の階層を畳む / 展開":`Collapse / expand`,ブロックをダブルクリック:`Double-click a box`,削除:`Delete`,"元に戻す / やり直す":`Undo / Redo`,選択を解除:`Clear selection`,"ボックスは「入力から出力を作るタスク」。出力を先に決め、大きなボックスは「分解する」で中にボックスを置く。供給元の無い入力は左端の入力まで自動で点線が伸びる。":`A box is a task that turns inputs into an output. Decide the output first; break big boxes down by putting boxes inside. Inputs with no source get a dotted line from the left edge automatically.`,"Boxglow で開く":`Open in Boxglow`,"ビルド日時 (日本時間)。古い場合は再読み込み (Ctrl+F5) してください":`Build time (JST). If it looks old, reload with Ctrl+F5`,"追加するプロジェクトの名前 (リポジトリごとに 1 つなど)":`Name of the project to add (e.g. one per repository)`,"Mermaid をコピーしました":`Mermaid copied`,コピーできませんでした:`Could not copy`,"サンプルは保存されません。Save で自分のプロジェクトとして保存":`The sample is not saved. Press Save to keep it as your own project`,このブラウザに自動で保存します:`Auto-saves in this browser`,"階層 / 絞り込み / メンバー / 部品":`Tree / Filter / Members / Parts`,"Home (プロジェクト一覧へ)":`Home (project list)`,自分のプロジェクトとして保存:`Save as your own project`,"今の状況 (作業中・判断待ち・ログ)":`Current activity (working, decisions, log)`,"Edit モード: ドラッグで移動・結線・階層移動ができます。押すと View (閲覧) に":`Edit mode: drag to move, wire and re-parent. Click to switch to View`,"View モード: ドラッグでの編集は効きません。押すと Edit に":`View mode: dragging does not edit. Click to switch to Edit`,"Search ID / 題名":`Search ID / title`,見つかりません:`No matches`,"ブロックを追加 (N)。ボックスを選んでいればその中に、選んでいなければプロジェクトの中に":`Add a box (N): inside the selected box, or in the project if nothing is selected`,"Auto Layout: 依存関係で並べ直す (大項目は畳んだ前提)":`Auto Layout: arrange by dependencies (top-level boxes assumed collapsed)`,"元に戻す (Ctrl+Z)":`Undo (Ctrl+Z)`,"やり直す (Ctrl+Y)":`Redo (Ctrl+Y)`,同じファイルにプロジェクトのボックスを足す:`Add a project box to the same file`,画面の文言の言語を切り替える:`Switch the UI language`,"タブの一覧 (押して選ぶ)":`List of tabs (click to pick)`,左へ:`Scroll left`,右へ:`Scroll right`,"大項目の一覧を俯瞰する (中はそれぞれのタブで)":`Overview of top-level boxes (open a tab to look inside)`,"{title} (選んだ線の続きがある)":`{title} (the selected wire continues here)`,"{title} の中を見る":`Look inside {title}`,"AI エージェントとチームの作業を、ボックスと線で一目で。":`See what AI agents and your team are doing, at a glance, as boxes and wires.`,前回開いたファイル:`The file you opened last time`,"「{name}」を削除します。よろしいですか?":`Delete "{name}"?`,すきま研究所日誌:`An app from Sukima Lab Diary`,"サーバに書けません ({status})":`Could not write to the server ({status})`,"ファイルへの書き込みが許可されていません (Save を押すともう一度確認します)":`Writing to the file was not allowed (press Save to ask again)`,"保存に失敗しました: {error}":`Save failed: {error}`,ファイルへの書き込みが許可されていません:`Writing to the file was not allowed`,無題のプロジェクト:`Untitled project`,ファイルの読み書きが許可されませんでした:`Access to the file was not allowed`,"ファイルを読めません: {error}":`Could not read the file: {error}`,"サーバから読めません (npx boxglow serve が動いていますか): {error}":`Could not read from the server (is npx boxglow serve running?): {error}`,"「{name}」を読み込みました":`Loaded "{name}"`,"{name} (複製)":`{name} (copy)`,自分のプロジェクトとして保存しました:`Saved as your own project`,"このファイルはブラウザから直接開けませんでした ({error})。npx boxglow serve --open なら、どの場所のファイルでも開けます":`The browser could not open this file directly ({error}). npx boxglow serve --open opens a file in any location`,"AI と一緒に使う":`WORK WITH YOUR AI AGENT`,リポジトリの計画を開く:`Open your repository plan`,"WSL・Firefox・Safari でも使うには、計画のあるフォルダーで実行します。":`For WSL, Firefox or Safari, run this in the folder containing your plan.`,まずブラウザで試す:`Try it in your browser`,"作成・インポートした計画は、このブラウザに保存されます。元のファイルや AI とは自動で同期しません。":`Created and imported plans are saved in this browser. They do not automatically sync with the original file or your AI agent.`,新しい計画の名前:`New project name`,このブラウザに保存した計画:`Saved in this browser`,"使い方・CLI の手順":`Guide and CLI commands`,コマンドをコピーしました:`Command copied`,"「{name}」を削除":`Delete "{name}"`,変更なし:`No changes`,"競合を統合: {path} (採用: {selected} / 手元: {ours} / 相手: {theirs})":`Conflict {path}: selected {selected}; local {ours}; remote {theirs}`},Sf={"boxglow.json が見つかりません (--file で指定するか、`boxglow init` で作ってください)":"boxglow.json not found (pass --file, or create one with `boxglow init`)","知らないコマンドです: {cmd} (boxglow help で一覧)":`Unknown command: {cmd} (run boxglow help for the list)`,"知らないカテゴリです: {text} (使えるもの: {list})":`Unknown category: {text} (available: {list})`,"<{what}> を指定してください (id または題名)":`Specify <{what}> (id or title)`,"ブロック「{ref}」が1 つに決まりません。 候補: {list}":`"{ref}" matches more than one box. Candidates: {list}`,"ブロック「{ref}」が見つかりません。":`Box "{ref}" not found.`,"「{ref}」は <題名>.<ポート名> の形で指定してください":`Write "{ref}" as <title>.<port name>`,"「{ref}」のボックスが見つかりません (<題名>.<ポート名> の形。題名は status に出る題名か B 番号)":`No box found for "{ref}" (use <title>.<port name>; the title is a title shown in status, or a B number)`,"「{ref}」のポートが見つかりません":`Port not found for "{ref}"`,"<名前> を指定してください":`Specify <name>`,"<題名> を指定してください":`Specify <title>`,"<path> を指定してください":`Specify <path>`,"<質問> を指定してください":`Specify <question>`,"<回答> を指定してください":`Specify <answer>`,"<URL またはパス> を指定してください":`Specify <URL or path>`,見つかりません:`No matches`,新しいプロジェクト:`New project`,"{path} は既にあります (--force で上書き)":`{path} already exists (use --force to overwrite)`,"作成: {path}":`Created: {path}`,"書き出し: {target}":`Exported: {target}`,".mcp.json (MCP サーバ boxglow)":`.mcp.json (MCP server boxglow)`,"設定しました: {list}\nAI は作業の始まり・終わり・判断待ちを boxglow.json に記録し、セッションの最初に計画を読みます。人は画面で見て判断してください (編集と回答は npx boxglow serve --open か VS Code 拡張で。boxglow.json を直接開いた画面は閲覧専用です)":`Set up: {list}
|
|
16
16
|
The AI records when it starts and finishes work and when it needs a decision in boxglow.json, and reads the plan at the start of each session. People review and decide in the app (to edit and answer, use npx boxglow serve --open or the VS Code extension; opening boxglow.json directly in the app is read-only)`,"プロジェクトのボックスを追加: 「{name}」(id: {id})。全部で {count} 件":`Added project box: "{name}" (id: {id}). {count} in total`,"テンプレートを書き出し: {target} ({count} 個の子)":`Exported template: {target} ({count} children)`,"挿入: 「{title}」(id: {id}) テンプレート {name} v{version}":`Inserted: "{title}" (id: {id}) template {name} v{version}`,"入力グループを追加: 「{name}」":`Added input group: "{name}"`,"最上位の入力「{name}」が見つかりません ({list})":`Top-level input "{name}" not found ({list})`,"グループ「{name}」がありません ({list})":`No group named "{name}" ({list})`,"「{port}」を グループ「{group}」 へ":`Moved "{port}" to group "{group}"`,"「{port}」を Inputs へ":`Moved "{port}" to Inputs`,グループが見つかりません:`Group not found`,"読み込み: グループ「{name}」":`Imported: group "{name}"`,"整列: 「{title}」の中":`Layout: inside "{title}"`,"整列: 全体":`Layout: everything`,"merge <base> <ours> <theirs> の 3 つを指定してください":`Specify all three: merge <base> <ours> <theirs>`,"ours / theirs が読めません":`Cannot read ours / theirs`,"マージで両側が変更: {path} (採用: {ours} / 相手: {theirs})":`Changed on both sides in merge: {path} (kept: {ours} / theirs: {theirs})`,"マージ: 相手の変更 {count} 件を取り込み":`Merge: took {count} change(s) from theirs`,"、両側で変更が {count} 件 (自分の値を採用し、相手の値はログに記録)":`; {count} changed on both sides (kept ours, recorded theirs in the log)`,'登録しました: {attrs} に「{line}」、git config merge.boxglow.driver = "npx boxglow merge %O %A %B"\n以後 git merge / pull / rebase で boxglow.json はボックスの単位で自動マージされます (チーム全員がこのコマンドを 1 回実行してください)':`Registered: "{line}" in {attrs}, git config merge.boxglow.driver = "npx boxglow merge %O %A %B"
|
|
17
|
-
From now on git merge / pull / rebase merges boxglow.json box by box automatically (everyone on the team needs to run this command once)`,"「{title}」に出力がありません":`"{title}" has no output`,"線 {id}: {reason}":`Wire {id}: {reason}`,"{key} 「{title}」の入力「{name}」がどこにもつながっていません":`{key} "{title}": input "{name}" is not connected to anything`,"{key} 「{title}」の出力「{name}」がどこにもつながっていません":`{key} "{title}": output "{name}" is not connected to anything`,"{key} 「{title}」の入力「{name}」が中のボックスとつながっていません":`{key} "{title}": input "{name}" is not connected to any box inside`,"{key} 「{title}」の出力「{name}」が中のボックスとつながっていません":`{key} "{title}": output "{name}" is not connected to any box inside`,"{key} 「{title}」は Done ですが成果物がありません (--artifact で付けてください)":`{key} "{title}" is Done but has no artifact (attach one with --artifact)`,問題ありません:`No problems`,"注意 ({count} 件。計画の穴):":`Warnings ({count}; gaps in the plan):`,"追加: 「{title}」(id: {id})":`Added: "{title}" (id: {id})`,"--spec '<JSON>' または --spec-file <path> を指定してください":`Specify --spec '<JSON>' or --spec-file <path>`,"分解: 「{title}」に {count} 個を追加":`Split: added {count} box(es) to "{title}"`,"--parent <block|project> を指定してください":`Specify --parent <block|project>`,"移せません (自分の子孫の中、プロジェクトのボックス、同じ親などは不可)":`Cannot move (not into its own descendants, not a project box, not to the same parent, etc.)`,"移動: 「{title}」を「{parent}」の中へ (線はつなぎ直しました)":`Moved: "{title}" into "{parent}" (wires were reconnected)`,"入力 {name}":`input {name}`,"出力 {name}":`output {name}`,"--rename は <旧名>=<新名> の形で指定してください: {spec}":`Write --rename as <old>=<new>: {spec}`,"ポート「{name}」が見つかりません":`Port "{name}" not found`,"入力「{name}」の名前は供給元の出力名で決まります。供給元の出力の名前を変えてください (port <供給元> --rename)":`The name of input "{name}" follows the output it is fed from. Rename that output instead (port <source> --rename)`,"--in <名前> / --out <名前> / --rename <旧名>=<新名> のいずれかを指定してください":`Specify one of --in <name> / --out <name> / --rename <old>=<new>`,"ポート: {title}: {list}":`Ports: {title}: {list}`,"そろえました: 入力の名前 {count} 件を供給元に合わせました":`Tidied: matched {count} input name(s) to their source`,"プロジェクトのボックスは消せません (中のボックスを全部消すか、ファイルごと作り直してください)":`A project box cannot be removed (remove all the boxes inside it, or recreate the file)`,"「{title}」の中に {count} 個のボックスがあります。まとめて消すなら --force を付けてください":`"{title}" contains {count} box(es). Add --force to remove them all`,"削除: 「{title}」":`Removed: "{title}"`," と中の {count} 個のボックス":` and the {count} box(es) inside`," (つながっていた線も外しました)":` (its wires were removed too)`,"線が見つかりません: {from} -> {to}":`Wire not found: {from} -> {to}`,"線を外しました: {from} -> {to}":`Disconnected: {from} -> {to}`,"結線: {from} -> {to}":`Connected: {from} -> {to}`," (親の出力)":` (the parent's output)`," (出力名と同じ入力を使いました)":` (used the input with the same name as the output)`,"開始: 「{title}」({actor})":`Started: "{title}" ({actor})`,"詰まり: 「{title}」":`Blocked: "{title}"`,"確認待ち: 「{title}」":`In review: "{title}"`,"活動を消しました: 「{title}」":`Cleared activity: "{title}"`,"完了: 「{title}」":`Done: "{title}"`," 成果物: ":` Artifacts: `,'注意: 成果物が付いていません。--artifact "<名前>=<パスまたは URL>" で、人が後から開ける具体的な物を付けてください':`Warning: no artifact attached. Use --artifact "<name>=<path or URL>" to attach something concrete that people can open later`,出力ポートが見つかりません:`Output port not found`,"成果物を付けました: 「{title}」.{port} <- {artifact}":`Attached artifact: "{title}".{port} <- {artifact}`,"- [補完] {owner}.{port} 「{title}」 {path} @ {commit}":`- [filled in] {owner}.{port} "{title}" {path} @ {commit}`,"- [移動] {owner}.{port} 「{title}」 {from} -> {to}":`- [moved] {owner}.{port} "{title}" {from} -> {to}`,"- [見つかりません] {owner}.{port} 「{title}」 {path} (コミット {commit} からは取り出せます: git show {commit}:{path})":`- [missing] {owner}.{port} "{title}" {path} (still available from commit {commit}: git show {commit}:{path})`,"Git の成果物はすべて見つかりました":`All Git artifacts were found`,"{count} 件を更新しました":`Updated {count} item(s)`,"判断待ち: 「{title}」 {question} (decision: {id})":`Needs decision: "{title}" {question} (decision: {id})`,"未回答の判断がありません (--id で指定)":`No unanswered decision (specify one with --id)`,"書き直せません (回答済み、または見つかりません)":`Cannot rewrite (already answered, or not found)`,"判断を書き直しました: 「{title}」 (decision: {id})":`Rewrote decision: "{title}" (decision: {id})`,"「{title}」に未確認の回答はありません":`"{title}" has no unacknowledged answers`,"回答を確認: 「{title}」":`Acknowledged answer: "{title}"`,未回答の判断がありません:`No unanswered decision`,"回答: 「{title}」 {answer}":`Answered: "{title}" {answer}`,"やり直せる判断 (回答済み) がありません":`No answered decision to reopen`,"やり直し: 「{title}」の判断を未回答に戻しました (前の答えは履歴に残ります)":`Reopened: the decision on "{title}" is unanswered again (the previous answer stays in the history)`,"日付は YYYY-MM-DD で指定してください: {value}":`Write dates as YYYY-MM-DD: {value}`,"更新: 「{title}」":`Updated: "{title}"`,"lang <ja|en> を指定してください":`Specify lang <ja|en>`,"言語: {lang}":`Language: {lang}`,"Web アプリが見つかりません: {dist} (npm run build で dist/ を作ってください)":`Web app not found: {dist} (run npm run build to create dist/)`,"[serve] ファイルの監視を始められません: {message}":`[serve] Cannot start watching the file: {message}`,"JSON ではありません":`Not JSON`,"(Ctrl+C で終了)":`(Ctrl+C to stop)`,"計画が他の変更で更新されています。最新の内容を読み直してからやり直してください (今回の変更は書き込んでいません)":`The plan changed. Reload its latest context and retry; your changes were not written.`,"他の Boxglow が計画ファイルに書き込み中です (ロック中)。終わってからやり直してください":`Another Boxglow writer holds the file lock. Retry after it finishes.`,"先に boxglow context {block} を読み、--context-token <contextToken> を付けてやり直してください。指示・回答・引き継ぎが未読か、読んだ後に変更されています":`Read boxglow context {block}, then retry with --context-token <contextToken>. Instructions, answers or handoff notes are unread or changed.`,"guard on|off を指定してください":`Usage: boxglow guard on|off`,"確認トークンの要求 (guard): {state}":`Context guard: {state}`,"--note <分かったこと・次の手順・未解決の点> を指定してください":`checkpoint requires --note with findings, next steps and unresolved questions`,"引き継ぎメモを保存しました: {block}":`Checkpoint saved: {block}`,"新しい確認トークン: {token}":`New context token: {token}`,"AI が確認トークンの要求 (guard) を無効にするには --context-token <context で得た最新の確認トークン> が要ります。人が操作するときは --actor human を付けてください":`An AI needs --context-token <the latest context token from context> to turn the context guard off. If a person is running this, add --actor human`,"マージで片方が削除・片方が変更: {path} (変更された側を残しました。削除した側: {side})":`Merge: deleted on one side, changed on the other: {path} (kept the changed side. Deleted by: {side})`,自分:`ours`,相手:`theirs`,"、削除と変更の競合が {count} 件 (変更された側を残し、ログに記録)":`, {count} delete-versus-change conflict(s) (kept the changed side and recorded it in the log)`,"boxglow {version} (保存の取り決め {protocol})":`boxglow {version} (save protocol {protocol})`,"設定の形が正しくありません: {where}":`Invalid configuration: {where}`,"--agent は codex | claude-code | all のいずれかを指定してください":`--agent: codex | claude-code | all`,"Boxglow の印 (boxglow:begin / boxglow:end) が正しく対になっていません: {path}":`Invalid Boxglow markers (boxglow:begin / boxglow:end): {path}`,"階層の一覧を省く (判断・活動・次の候補は残す)":`Omit the full hierarchy; keep decisions, activity and next actions`,"作業の再開用の概要: 引き継ぎメモ・AI 未確認の回答・作業中・次の候補 (回答は確認済みにならない)":`Resume work: recent handoffs, unread human answers, active tasks and next candidates. Does not acknowledge answers.`,"ボックスのコンテキストを読む: 親と入力元の判断・入出力の条件・引き継ぎメモ。guard 付きの変更に使う contextToken を返す (自分の操作でコンテキストが変わると、その操作の出力に新しい確認トークンが出る)":`Read persistent task context, ancestor and upstream decisions, contracts and handoff notes. Returns contextToken for guarded changes (when your own command changes the context, its output ends with the new context token).`,"中断や引き継ぎの前に、分かったこと・次の手順・未解決の点を計画に残す":`Persist findings, next steps and unresolved questions before interruption or handoff.`,"計画が大きすぎます (上限 5 MiB)":`Project exceeds 5 MiB`,リクエストが中断されました:`Request aborted`,"信頼できない Host です":`Untrusted Host`,他のオリジンからのアクセスは受け付けません:`Cross-origin access denied`,他のサイトからのアクセスは受け付けません:`Cross-site access denied`,このメソッドは使えません:`Method not allowed`,"application/json で送ってください":`application/json required`,"先に計画を読み、その ETag を If-Match で送ってください":`Read the project first and send its ETag in If-Match`,"Boxglow の計画として正しくありません (形式・参照・つなぎ方)":`Invalid Boxglow project (schema, references or connections)`,このパスは配信できません:`Forbidden`,ローカルサーバでエラーが起きました:`Local server error`,"VS Code が編集を適用できませんでした。変更は図に残っています":`VS Code rejected the edit. Your changes remain in the diagram.`,"VS Code がファイルを保存できませんでした。再試行するか、変更を書き出してください":`VS Code could not save the file. Retry or export your changes.`,"保存の処理中です。もう一度やり直してください":`A save is already in progress. Retry.`,"確認トークン (guard) を有効にしました。AI は作業の前に boxglow context <ボックス> を読み、返ってきたトークンを --context-token で渡します。人の操作 (--actor human) には不要です。外すときは boxglow guard off --actor human":`Context guard enabled. Before working, an agent reads boxglow context <box> and passes the returned token with --context-token. People (--actor human) do not need one. To turn it off: boxglow guard off --actor human`},Cf={最終成果物:`Final deliverable`,"{name} の成果物":`{name} deliverable`,出力:`Output`,無題:`Untitled`,ポートが見つかりません:`Port not found`,同じポートどうしはつなげません:`A port cannot be connected to itself`,"線は出力ポート (または親の入力) から引いてください":`Start the edge from an output port (or the parent's input)`,"線は入力ポート (または親の出力) につないでください":`End the edge at an input port (or the parent's output)`,同じ階層のポートどうしだけつなげます:`Only ports on the same level can be connected`,循環する結線はできません:`Connections cannot form a cycle`,つなぐ先が見つかりません:`Connection target not found`,親に出力がありません:`The parent has no output`,"同じ階層のボックス (または親子) にだけつなげます":`Only boxes on the same level (or parent and child) can be connected`,"JSON として読めません":`Not valid JSON`,プロジェクトの形式ではありません:`Not a project file`,"対応していないデータ形式の版です (schemaVersion={version})":`Unsupported data format version (schemaVersion={version})`,"ブロック・ポート・線のデータが足りません":`Box, port, or edge data is missing`,"Boxglow のテンプレート (boxglow-block) ではありません":`Not a Boxglow template (boxglow-box)`,"入力グループの JSON (boxglow-input-group) ではありません":`Not an input group JSON (boxglow-input-group)`,"知らないカテゴリです: {key}":`Unknown category: {key}`,ブロックが見つかりません:`Box not found`,親ブロックが見つかりません:`Parent box not found`,"出力「{name}」がありません ({list})":`No output "{name}" ({list})`,"「{title}」の出力は 1 本にしました (下の階層を持たないボックスの出力は 1 本。{omitted} は省略)":`"{title}" was given a single output (a box with no children has one output; {omitted} omitted)`,ボックスが見つかりません:`Box not found`,"「{title}」に入力「{port}」がありません":`"{title}" has no input "{port}"`,"「{title}」に出力「{port}」がありません":`"{title}" has no output "{port}"`,"結線できません: {from} -> {to} ({why})":`Cannot connect: {from} -> {to} ({why})`,"「{title}」を追加":`Added "{title}"`,"「{title}」の進捗 {value}":`"{title}" progress {value}`,"「{title}」開始":`"{title}" started`,"「{title}」詰まり":`"{title}" blocked`,"「{title}」確認待ち":`"{title}" waiting for review`,"「{title}」判断待ち":`"{title}" needs a decision`,"「{title}」完了":`"{title}" done`,"「{title}」で判断待ち: {question}":`"{title}" needs a decision: {question}`,"「{title}」の判断: {question} → {answer}":`"{title}" decision: {question} → {answer}`,"「{title}」の判断の答えを直した: {question} → {answer}":`"{title}" decision answer revised: {question} → {answer}`,"「{title}」の判断をやり直し: {question} (前の答え: {answer}。理由: {note})":`"{title}" decision reopened: {question} (previous answer: {answer}; reason: {note})`,"「{title}」の判断をやり直し: {question} (前の答え: {answer})":`"{title}" decision reopened: {question} (previous answer: {answer})`,"「{title}」の回答を確認: {questions}":`"{title}" answers acknowledged: {questions}`,"「{title}」を {status} に":`"{title}" set to {status}`,"「{title}」を {count} 個に分解: {list}":`Split "{title}" into {count}: {list}`,"テンプレート「{name}」v{version} を挿入: {title}":`Inserted template "{name}" v{version}: {title}`,"「{title}」を「{parent}」の中へ移動":`Moved "{title}" into "{parent}"`,"入力グループ「{name}」を追加":`Added input group "{name}"`,"「{title}」{detail}":`"{title}" {detail}`,"開始 {date}":`Start {date}`,"実績 {hours}h":`Actual {hours}h`,"見積 {hours}h":`Estimate {hours}h`,なし:`none`,"{key} に振り直し":`renumbered to {key}`,"作業の前に boxglow context <block> を読み、guard 付きの変更にはその contextToken を使ってください。この概要は回答を確認済みにせず、操作を許可するものでもありません。":`Read boxglow context <block> before work; use its contextToken for guarded changes. This overview does not acknowledge answers or authorize actions.`,"使えないキーです: {key}":`Reserved key: {key}`,"最上位のボックス (root) がありません":`Missing root block`,"ボックスの参照が正しくありません: {id}":`Invalid block reference: {id}`,"ボックスの親子が循環しています: {id}":`Parent cycle: {id}`,"階層が深すぎます (256 段まで)":`Hierarchy exceeds 256 levels`,"入出力の参照が正しくありません: {id}":`Invalid port reference: {id}`,"線の参照が正しくありません: {id}":`Invalid edge reference: {id}`,"線のつなぎ方が正しくありません: {id}: {reason}":`Invalid connection: {id}: {reason}`,"線の種類が正しくありません: {id}":`Invalid edge kind: {id}`},wf={"階層は省略しています。全体は `boxglow status`、ボックスの詳細は `boxglow show <block>` で確認できます。":"Hierarchy omitted. Use `boxglow status` for the full tree or `boxglow show <block>` for details.","「{title}」":`"{title}"`,"、":`, `,"テンプレート: {name}":`Template: {name}`,"(未担当)":`(unassigned)`,"(超過)":`(overdue)`,"完了 {white} / {total} ・ 進捗 {percent}% (BlackBox {black}, GrayBox {gray}, WhiteBox {white})":`Done {white} / {total} · progress {percent}% (BlackBox {black}, GrayBox {gray}, WhiteBox {white})`,"最終成果物: {names}":`Final deliverables: {names}`,"(未設定)":`(not set)`,"プロジェクトの入力: {names}":`Project inputs: {names}`,"(なし)":`(none)`,"入力グループ「{name}」: {names}":`Input group "{name}": {names}`,"(空)":`(empty)`,"判断待ち (人間の回答が必要)":`Needs decision (a human must answer)`,"選択肢: {options}":`Options: {options}`,"判断材料: {text}":`Context: {text}`,"回答あり (人が答えた判断。読んだら `boxglow ack <block>` で引き取る。そのボックスの start / done などでも引き取られる)":"Answered (decisions a human has answered. After reading, acknowledge with `boxglow ack <block>`; start / done etc. on that box also acknowledge them)",期日超過:`Overdue`,"詰まり・確認待ち":`Blocked / in review`,"階層 ([ ] New / [~] In Progress / [x] Done。B 番号はボックスの ID。出力名の * は成果物あり)":`Tree ([ ] New / [~] In Progress / [x] Done. B numbers are box IDs. * after an output name = has a deliverable)`,"次の候補 (未着手の New。必須の入力がそろっているものから)":`Next candidates (New boxes not started yet; those with all required inputs ready come first)`,"(必須の入力待ち: {names})":`(waiting for required inputs: {names})`,"(着手できる)":`(ready to start)`,"状態: {status}":`Status: {status}`,"(進捗 {percent}%)":`(progress {percent}%)`,"課題: {key}":`Issue: {key}`,"日程:":`Schedule:`,"時間:":`Hours:`,"活動:":`Activity:`,入力:`Input`,"(未接続)":`(not connected)`,"成果物: {list}":`Deliverables: {list}`,下の階層:`Children`,判断:`Decisions`,"[未回答]":`[open]`,"[回答済]":`[answered]`,"候補: {list}":`Candidates: {list}`,"残した候補: {list}":`Kept candidates: {list}`,"以前の答え: {answer}":`Previous answer: {answer}`,資料:`Links`,"(ログはまだありません)":`(no log entries yet)`,"供給元: {list}":`from: {list}`,"行き先: {list}":`to: {list}`,プロジェクトの入力:`Project input`,プロジェクトの出力:`Project output`,"プロジェクト: {name}":`Project: {name}`,"担当: {names}":`Assignees: {names}`,"進捗: 下の階層 {white}/{total} が完了":`Progress: {white}/{total} children done`,"判断:":`Decisions:`,"(未回答)":`(unanswered)`,"。残した候補: {list}":`. Kept candidates: {list}`,"。以前の答え: {list}":`. Previous answers: {list}`,"{n} 件":`{n}`,関連資料:`Related links`,"全体の進捗: {white}/{total} ブロックが完了 (BlackBox {black} / GrayBox {gray} / WhiteBox {white})":`Overall progress: {white}/{total} boxes done (BlackBox {black} / GrayBox {gray} / WhiteBox {white})`,"ブロックは「入力から出力を作るタスク」。BlackBox は出力だけ決まっていて中身が未定、GrayBox は分解中・着手中、WhiteBox は完了。":`A box is "a task that turns inputs into an output". BlackBox: only the output is decided, the inside is not; GrayBox: being broken down or worked on; WhiteBox: done.`,"New (BlackBox: 出力だけ決めてある)":`New (BlackBox: only the output is decided)`,"In Progress (GrayBox: 分解中・作業中)":`In Progress (GrayBox: being broken down or worked on)`,"Done (WhiteBox: 出力に成果物が付いて完了)":`Done (WhiteBox: the output has its deliverable)`,"依頼: {title}":`Request: {title}`,"このタスクは「{chain}」の中の 1 ブロックです。ブロックは「入力から出力を作る作業」で、出力の成果物が確定したら完了 (WhiteBox) になります。":`This task is one box inside "{chain}". A box is "work that turns inputs into an output"; it is done (WhiteBox) once the output's deliverable is settled.`,同じ階層の他のブロック:`Other boxes on the same level`,現在の下の階層:`Current children`,お願い:`What I need`,"上の入力から出力を得るための手順を提案してください。前提が足りなければ、追加で必要な入力を挙げてください。":`Propose the steps to get from the inputs above to the output. If something is missing, list the additional inputs you need.`,"このブロックを、入力と出力を持つ小さなブロックに分解してください。次の JSON 形式で答えてください。":`Break this box down into smaller boxes, each with inputs and outputs. Answer in the following JSON format.`,ブロック名:`Box name`,やること:`What to do`,入力名:`Input name`,出力名:`Output name`,"入力と出力の定義に抜けや曖昧さがないか指摘してください。出力が「確定した」と言える条件も提案してください。":`Point out any gaps or ambiguity in the input and output definitions. Also propose the conditions under which the output can be called "settled".`,"(出力なし)":`(no output)`,"ボックスの B 番号 (B12) か題名":`The box's B number (B12) or title`,"計画の今の状況: 判断待ち・作業中・次の候補・階層の一覧 (セッションの最初に読む)":`Current state of the plan: pending decisions, work in progress, next candidates and the tree (read this first in every session)`,"ボックスの詳細 (入出力・線・判断・成果物)":`Details of a box (inputs, outputs, wires, decisions, deliverables)`,"ボックスを足す。出力 (成果物の名前) を必ず決める。parent を省くと最初のプロジェクトのボックスの直下 (大項目) に入る":`Add a box. Always decide its output (the name of the deliverable). Without parent, it goes directly under the first project box (as a top-level item)`,"出力の名前 (具体的な成果物: ファイル・URL・PR)":`Output name (a concrete deliverable: file, URL, PR)`,入力の名前:`Input names`,'大きいボックスを中のボックスに分解する。spec は { blocks: [{ title, inputs?: [名前], outputs: [名前] }], connections: [{ from: "A.出力名", to: "B" }] } の形 (to は題名だけでよい: 出力名と同じ入力が作られる。親の入力からは from: "parent.入力名"、親の出力へは to: "parent.出力名")':`Split a large box into inner boxes. spec has the form { boxes: [{ title, inputs?: [name], outputs: [name] }], connections: [{ from: "A.outputName", to: "B" }] } (to can be just a title: an input with the same name as the output is created. From the parent's input use from: "parent.inputName"; to the parent's output use to: "parent.outputName")`,"分解の指定 (JSON)":`Split spec (JSON)`,"線をつなぐ: <題名.出力名> から <題名> へ (受け側は題名だけでよい。出力名と同じ名前の入力が作られる。<題名.入力名> で既存の入力を指定してもよい。親の入力は project.入力名、親の出力へは 題名.出力名 -> project)":`Connect a wire: from <title.outputName> to <title> (the receiving side can be just a title; an input with the same name as the output is created. <title.inputName> selects an existing input. The parent's input is project.inputName; to the parent's output use title.outputName -> project)`,線を外す:`Remove a wire`,"ボックスに入力 / 出力を足す、名前を変える":`Add inputs / outputs to a box, or rename one`,"旧=新":`old=new`,"ボックスを別の親の中へ移す (線はつなぎ直される)":`Move a box into another parent (wires are reconnected)`,"移す先のボックスか project":`Destination box, or project`,"ボックスを消す (中にボックスがあれば force)":`Remove a box (force if it has boxes inside)`,"作業を始める (作業中の札が付く)。同時に作業中にするボックスは 1〜2 個まで":`Start work (the box gets a Working tag). Keep at most 1-2 boxes in progress at a time`,何をするか:`What you will do`,"完了にする。成果物 (名前=パスか URL) を付ける。Git のファイルなら commit+path+blob が記録される":`Mark as done. Attach deliverables (name=path or URL). For files in Git, commit+path+blob is recorded`,"名前=パス または 名前=URL":`name=path or name=URL`,出力の名前を変えるとき:`To rename the output`,"詰まった (困っていることを書いて他のボックスへ移る)":`Boxed (write what is in the way and move on to another box)`,"人の判断が要る質問を残す (選択肢付き)。質問だけで判断できるように、前提・比較・影響を context に書く。AI が自分で選ぶときも ask して answer (by=claude-code) で記録する":`Leave a question that needs a human decision (with options). Put the premises, comparison and impact in context so the question can be decided on its own. When the AI chooses by itself, also ask and then record it with answer (by=claude-code)`,"判断に答える (人がチャットで答えたら by=human で記録)":`Answer a decision (if a human answered in chat, record it with by=human)`,"human / claude-code など":`human / claude-code etc.`,"人の回答を読んで引き取ったと記録する (status の「回答あり」から消える)":`Record that you have read a human's answer (it leaves "Answered" in status)`,"decision id (省略するとそのボックスの未確認の回答すべて)":`decision id (if omitted, all unacknowledged answers on that box)`,"判断をやり直す (前の答えは履歴に残る)":`Reopen a decision (the previous answer stays in the history)`,"ボックスの属性を変える (題名・メモ・カテゴリ・期日・リポジトリ・課題 URL)":`Change a box's attributes (title, note, category, due date, repository, issue URL)`,"計画を Markdown に書き出す (docs/ROADMAP.md など)":`Export the plan as Markdown (e.g. docs/ROADMAP.md)`,"計画の問題 (つながっていない入出力など) を検査する":`Check the plan for problems (e.g. unconnected inputs / outputs)`,'そのほかの CLI コマンドをそのまま実行する (例: ["log", "--n", "20"]、["layout"]、["help"])':`Run any other CLI command as is (e.g. ["log", "--n", "20"], ["layout"], ["help"])`},Tf={..._f,...vf,...yf,...bf,...xf,...Sf,...Cf,...wf,...gf,...hf},Ef=`boxglow:lang`,Df=new Set,Of=kf();function kf(){if(typeof window>`u`)return`ja`;try{let e=new URLSearchParams(window.location.search).get(`lang`);if(e===`en`||e===`ja`)return e;let t=localStorage.getItem(Ef);if(t===`en`||t===`ja`)return t}catch{}return(typeof navigator<`u`?navigator.language:`ja`).toLowerCase().startsWith(`ja`)?`ja`:`en`}var Af=()=>Of;function jf(e){if(e!==Of){Of=e;try{localStorage.setItem(Ef,e)}catch{}typeof document<`u`&&(document.documentElement.lang=e);for(let e of Df)e()}}function Mf(e){return Df.add(e),()=>{Df.delete(e)}}function q(e,t){let n=Of===`en`?Tf[e]??e:e;return t?n.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e):n}typeof document<`u`&&(document.documentElement.lang=Of);var Nf=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Pf=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Nf[n[e]&63];return t},Ff=`root`,If=()=>Pf(10),Lf=()=>new Date().toISOString(),Rf=e=>structuredClone(e);function zf(e){let t=e.nextKey??1;return e.nextKey=t+1,`B${t}`}function Bf(e){let t=new Set;for(let n of Object.values(e.blocks))n.key&&t.add(n.key);let n=e.nextKey??1;for(let r of Object.values(e.blocks))if(!(r.id===`root`||r.key)){for(;t.has(`B${n}`);)n++;r.key=`B${n}`,t.add(r.key),n++}e.nextKey=Math.max(n,e.nextKey??1)}var Vf={left:120,top:76},Hf=60;function Uf(e,t){let n=e.blocks[t];return n?Hf+(Math.min(3,Math.max(1,Math.ceil(n.title.length*14/400)))-1)*18+16:Vf.top}function Wf(e){let t=Lf(),n={id:Ff,parentId:null,title:e,description:``,status:`black`,assigneeIds:[],position:{x:0,y:0},collapsed:!1,artifacts:[],activity:null,decisions:[]},r={id:If(),blockId:Ff,direction:`out`,name:q(`最終成果物`),description:``,required:!0,artifacts:[]};return Gf({schemaVersion:5,id:If(),name:e,description:``,createdAt:t,visibility:`private`,members:[],blocks:{[Ff]:n},ports:{[r.id]:r},edges:{},terminals:{in:{x:0,y:200},out:{x:1100,y:200}},log:[],agents:{},nextKey:1},e).project}function Gf(e,t){let n=Rf(e),r=J(n),i=If(),a=r.length===0?40:Math.max(...r.map(e=>e.position.y))+400;n.blocks[i]={id:i,key:zf(n),kind:`project`,parentId:Ff,title:t,description:``,status:`black`,assigneeIds:[],position:{x:300,y:a},collapsed:!1,artifacts:[],activity:null,decisions:[]};let o={id:If(),blockId:i,direction:`out`,name:q(`最終成果物`),description:``,required:!0,artifacts:[]};n.ports[o.id]=o;let s=Y(n,Ff,`out`).find(e=>sp(n,{portId:e.id,side:`inner`}).length===0);s||(s={id:If(),blockId:Ff,direction:`out`,name:r.length===0?q(`最終成果物`):q(`{name} の成果物`,{name:t}),description:``,required:!0,artifacts:[]},n.ports[s.id]=s);let c=If();return n.edges[c]={id:c,from:{portId:o.id,side:`outer`},to:{portId:s.id,side:`inner`},kind:`up`,auto:!1},{project:n,blockId:i}}function J(e){return rp(e,Ff).filter(e=>e.kind===`project`)}function Kf(e){return J(e)[0]?.id??`root`}function qf(e){let t=J(e),n=t.length>0?t.map(e=>e.id):[Ff],r=[];for(let t of n)r.push(...rp(e,t).filter(e=>$f(e)!==`project`));return r.sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x)}function Jf(e,t){let n=new Set(qf(e).map(e=>e.id)),r=t;for(;r!==null;){if(n.has(r))return r;r=e.blocks[r]?.parentId??null}return null}function Yf(e,t,n){let r=n;for(;r!==null;){if(r===t)return!0;r=e.blocks[r]?.parentId??null}return!1}function Xf(e){let t=qf(e).filter(e=>!e.collapsed).map(e=>e.id);if(t.length===0)return e;let n={...e.blocks};for(let e of t)n[e]={...n[e],collapsed:!0};return{...e,blocks:n}}function Zf(e,t){let n=Jf(e,t);return n&&n!==t?n:null}function Qf(e,t){let n=[],r=t;for(;r!==null&&r!==`root`;){let t=e.blocks[r];if(!t||$f(t)===`project`)break;n.unshift(t),r=t.parentId}return n}var $f=e=>e.kind??`task`;function ep(e,t=``){return{id:If(),title:e,url:t,kind:t?`url`:`note`,note:``}}var tp=null;function np(e,t,n={}){let r=new Map;for(let t of Object.values(e.ports)){let e=r.get(t.blockId)??[];e.push(t),r.set(t.blockId,e)}let i=new Map;if(n.children!==!1)for(let t of Object.values(e.blocks)){if(t.parentId===null)continue;let e=i.get(t.parentId)??[];e.push(t),i.set(t.parentId,e)}let a=tp;tp={ports:e.ports,portsByBlock:r,blocks:n.children===!1?null:e.blocks,kidsByParent:i};try{return t()}finally{tp=a}}function rp(e,t){return tp&&tp.blocks===e.blocks?(tp.kidsByParent.get(t)??[]).slice():Object.values(e.blocks).filter(e=>e.parentId===t)}function ip(e,t){let n=[],r=[t];for(;r.length>0;){let t=r.pop();for(let i of rp(e,t))n.push(i),r.push(i.id)}return n}function ap(e,t){let n=[],r=e.blocks[t]?.parentId??null;for(;r!==null;){let t=e.blocks[r];if(!t)break;n.push(t),r=t.parentId}return n}function Y(e,t,n){if(tp&&tp.ports===e.ports){let e=tp.portsByBlock.get(t)??[];return n===void 0?e.slice():e.filter(e=>e.direction===n)}return Object.values(e.ports).filter(e=>e.blockId===t&&(n===void 0||e.direction===n))}var op=(e,t)=>e.portId===t.portId&&e.side===t.side;function sp(e,t){return Object.values(e.edges).filter(e=>op(e.to,t))}function cp(e,t){return Object.values(e.edges).filter(e=>op(e.from,t))}function lp(e,t){let n=e.ports[t.portId];if(!n)return null;let r=e.blocks[n.blockId];return r?t.side===`inner`?r.id:r.parentId:null}function up(e,t){return ap(e,t).some(e=>e.collapsed)}function dp(e,t,n){let r=e.ports[t.portId],i=e.ports[n.portId];if(!r||!i)return{ok:!1,reason:q(`ポートが見つかりません`)};if(t.portId===n.portId)return{ok:!1,reason:q(`同じポートどうしはつなげません`)};let a=r.direction===`out`&&t.side===`outer`||r.direction===`in`&&t.side===`inner`,o=i.direction===`in`&&n.side===`outer`||i.direction===`out`&&n.side===`inner`;if(!a)return{ok:!1,reason:q(`線は出力ポート (または親の入力) から引いてください`)};if(!o)return{ok:!1,reason:q(`線は入力ポート (または親の出力) につないでください`)};let s=lp(e,t),c=lp(e,n);if(s===null||c===null||s!==c)return{ok:!1,reason:q(`同じ階層のポートどうしだけつなげます`)};let l;return l=r.direction===`out`&&i.direction===`in`?`sibling`:r.direction===`out`&&i.direction===`out`?`up`:r.direction===`in`&&i.direction===`in`?`down`:`through`,l===`sibling`&&fp(e,r.blockId,i.blockId)?{ok:!1,reason:q(`循環する結線はできません`)}:{ok:!0,kind:l}}function fp(e,t,n){if(t===n)return!0;let r=new Set,i=[n];for(;i.length>0;){let n=i.pop();if(n===t)return!0;if(!r.has(n)){r.add(n);for(let t of Y(e,n,`out`))for(let n of cp(e,{portId:t.id,side:`outer`})){if(n.kind!==`sibling`)continue;let t=e.ports[n.to.portId]?.blockId;t&&i.push(t)}}}return!1}function pp(e){return Rf(e)}function mp(e,t){let n=pp(e),r=If(),i=rp(n,t.parentId),a;a=t.parentId===`root`?i.length===0?{x:260,y:80}:{x:Math.max(...i.map(e=>e.position.x))+300,y:80}:i.length===0?{x:Vf.left,y:Uf(e,t.parentId)}:{x:Vf.left,y:Math.max(...i.map(e=>e.position.y))+110},n.blocks[r]={id:r,key:zf(n),parentId:t.parentId,title:t.title,description:``,status:`black`,assigneeIds:[],position:t.position??a,collapsed:!1,artifacts:[],activity:null,decisions:[]};let o={id:If(),blockId:r,direction:`out`,name:t.outputName??q(`出力`),description:``,required:!0,artifacts:[]};n.ports[o.id]=o,t.actor&&Gp(n,{actor:t.actor,kind:`added`,blockId:r,message:q(`「{title}」を追加`,{title:t.title})});let s=n.blocks[t.parentId];return s&&s.id!==`root`&&s.status===`black`&&(s.status=`gray`),{project:Mp(n),blockId:r}}function hp(e,t,n){let r=pp(e),i=r.blocks[t];return i?(Object.assign(i,n),r):e}function gp(e,t,n){let r=Rf(e),i=r.blocks[t];return i?(i.position=i.parentId!==null&&i.parentId!==`root`?{x:Math.max(Vf.left,n.x),y:Math.max(Uf(r,i.parentId),n.y)}:n,r):e}function _p(e,t,n){let r=Rf(e);return r.terminals[t]=n,r}function vp(e,t){if(t===`root`)return e;let n=pp(e),r=new Set([t,...ip(n,t).map(e=>e.id)]),i=new Set(Object.values(n.ports).filter(e=>r.has(e.blockId)).map(e=>e.id));for(let e of Object.values(n.edges))(i.has(e.from.portId)||i.has(e.to.portId))&&delete n.edges[e.id];for(let e of i)delete n.ports[e];for(let e of r)delete n.blocks[e];if(n.handoffs){let e=Object.fromEntries(Object.entries(n.handoffs).filter(([e])=>!r.has(e)));Object.keys(e).length>0?n.handoffs=e:delete n.handoffs}return Mp(n)}function yp(e,t){if(t.direction===`out`&&t.blockId!==`root`&&!Sp(e,t.blockId))return{project:e,portId:Y(e,t.blockId,`out`)[0]?.id??``};let n=pp(e),r=If();return n.ports[r]={id:r,blockId:t.blockId,direction:t.direction,name:t.name,description:``,required:!0,artifacts:[]},t.direction===`out`&&$f(n.blocks[t.blockId])===`project`&&bp(n,r),{project:Mp(n),portId:r}}function bp(e,t){let n=e.ports[t];if(!n||n.direction!==`out`||Object.values(e.edges).some(n=>n.from.portId===t&&n.from.side===`outer`&&e.ports[n.to.portId]?.blockId===`root`))return;let r={id:If(),blockId:Ff,direction:`out`,name:n.name,description:n.description,required:!0,artifacts:[]};e.ports[r.id]=r;let i=If();e.edges[i]={id:i,from:{portId:t,side:`outer`},to:{portId:r.id,side:`inner`},kind:`up`,auto:!0}}function xp(e,t){let n=Object.values(e.edges).find(n=>n.from.portId===t&&n.from.side===`outer`&&e.ports[n.to.portId]?.blockId===`root`);return n?e.ports[n.to.portId]??null:null}function Sp(e,t){return $f(e.blocks[t])===`project`||t===`root`||Y(e,t,`out`).length===0||rp(e,t).length>0}function Cp(e,t,n){let r=pp(e),i=r.ports[t];if(!i)return e;let a=i.name;if(n.name!==void 0&&Tp(r,t)&&(n={...n,name:void 0}),Object.assign(i,Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0))),n.name!==void 0&&i.direction===`out`&&$f(r.blocks[i.blockId])===`project`){let e=xp(r,t);e&&(e.name=n.name)}return n.name!==void 0&&n.name!==a&&Ep(r,t,a,n.name),r}function wp(e){let t=new Map;for(let n of Object.values(e.edges)){if(n.auto)continue;let r=e.ports[n.to.portId];r&&r.direction===`in`&&n.to.side===`outer`&&t.set(r.id,n.from.portId)}let n=new Map,r=(i,a=new Set)=>{if(n.has(i))return n.get(i);let o=e.ports[i];if(!o)return``;let s=t.get(i),c=o.name;if(s&&!a.has(i)){a.add(i);let e=r(s,a);e&&(c=e)}return n.set(i,c),c},i=null,a=0;for(let n of t.keys()){let t=r(n);t&&e.ports[n].name!==t&&(i||=pp(e),i.ports[n].name=t,a++)}return{project:i??e,renamed:a}}function Tp(e,t){let n=e.ports[t];return!n||n.direction!==`in`?!1:sp(e,{portId:t,side:`outer`}).some(e=>!e.auto)}function Ep(e,t,n,r,i=new Set){if(!i.has(t)){i.add(t);for(let a of Object.values(e.edges)){if(a.from.portId!==t)continue;let o=e.ports[a.to.portId];if(o&&o.name===n){if(o.name=r,o.direction===`out`&&$f(e.blocks[o.blockId])===`project`){let t=xp(e,o.id);t&&(t.name=r)}Ep(e,o.id,n,r,i)}}}}function Dp(e,t){let n=e.ports[t];if(!n||n.promotedFrom)return e;let r=pp(e);if(n.direction===`out`&&$f(r.blocks[n.blockId])===`project`){let e=xp(r,t);if(e){for(let t of Object.values(r.edges))(t.from.portId===e.id||t.to.portId===e.id)&&delete r.edges[t.id];delete r.ports[e.id]}}for(let e of Object.values(r.edges))(e.from.portId===t||e.to.portId===t)&&delete r.edges[e.id];return delete r.ports[t],Mp(r)}function Op(e,t,n){let r=dp(e,t,n);if(!r.ok)return{project:e,error:r.reason};let i=pp(e);for(let e of sp(i,n))delete i.edges[e.id];let a=If();i.edges[a]={id:a,from:t,to:n,kind:r.kind,auto:!1};let o=i.ports[t.portId],s=i.ports[n.portId];if(o&&s&&s.direction===`in`&&n.side===`outer`&&s.name!==o.name){let e=s.name;s.name=o.name,Ep(i,s.id,e,o.name)}return{project:Mp(i),edgeId:a}}function kp(e,t){if(!e.edges[t])return e;let n=pp(e);return delete n.edges[t],Mp(n)}function Ap(e,t,n){let r=pp(e),i={id:If(),name:t,color:n};return r.members.push(i),{project:r,memberId:i.id}}function jp(e,t){let n=pp(e);n.members=n.members.filter(e=>e.id!==t);for(let e of Object.values(n.blocks))e.assigneeIds=e.assigneeIds.filter(e=>e!==t);return n}function Mp(e){let t=Rf(e);for(let e=0;e<64;e++){let e=!1;for(let n of Object.values(t.edges))n.auto&&sp(t,n.to).some(e=>!e.auto)&&(delete t.edges[n.id],e=!0);for(let n of Object.values(t.ports))if(n.promotedFrom&&!(cp(t,{portId:n.id,side:`inner`}).length>0)){for(let e of Object.values(t.edges))(e.from.portId===n.id||e.to.portId===n.id)&&delete t.edges[e.id];delete t.ports[n.id],e=!0}for(let n of Object.values(t.ports)){if(!n.promotedFrom||!t.ports[n.id])continue;let r=Object.values(t.ports).find(e=>e.id!==n.id&&e.blockId===n.blockId&&e.direction===`in`&&e.promotedFrom&&e.name===n.name);if(r){for(let e of Object.values(t.edges))e.from.portId===r.id&&(e.from={...e.from,portId:n.id}),e.to.portId===r.id&&(e.to={...e.to,portId:n.id});delete t.ports[r.id],e=!0}}for(let n of Object.values(t.ports)){if(n.direction!==`in`)continue;let r=t.blocks[n.blockId];if(!r||r.parentId===null||sp(t,{portId:n.id,side:`outer`}).length>0)continue;let i=Object.values(t.ports).find(e=>e.blockId===r.parentId&&e.direction===`in`&&e.promotedFrom&&e.name===n.name);i||(i={id:If(),blockId:r.parentId,direction:`in`,name:n.name,description:n.description,required:n.required,artifacts:[],promotedFrom:n.id},t.ports[i.id]=i);let a=If();t.edges[a]={id:a,from:{portId:i.id,side:`inner`},to:{portId:n.id,side:`outer`},kind:`down`,auto:!0},e=!0}if(!e)break}return t}function Np(e,t){let n=e.blocks[t];if(!n)return 0;if(n.status===`white`)return 100;if(typeof n.progress==`number`)return Math.max(0,Math.min(100,n.progress));let r=rp(e,t);return r.length===0?0:Math.round(r.reduce((t,n)=>t+Np(e,n.id),0)/r.length)}function Pp(e,t){let n=ip(e,t).filter(e=>$f(e)!==`project`),r=n.length>0?n:t===`root`?[]:[e.blocks[t]].filter(e=>e&&$f(e)!==`project`),i=e=>r.filter(t=>t.status===e).length,a=i(`white`),o=r.length,s=t===`root`?(()=>{let t=J(e);return t.length===0?0:Math.round(t.reduce((t,n)=>t+Np(e,n.id),0)/t.length)})():Np(e,t);return{total:o,white:a,gray:i(`gray`),black:i(`black`),ratio:o===0?0:a/o,percent:s}}function Fp(e,t,n,r){let i=e.blocks[t];if(!i)return e;let a=pp(e);return n===null?delete a.blocks[t].progress:a.blocks[t].progress=Math.max(0,Math.min(100,Math.round(n))),n!==null&&i.status===`black`&&n>0&&(a.blocks[t].status=`gray`),Gp(a,{actor:r,kind:`note`,blockId:t,message:q(`「{title}」の進捗 {value}`,{title:i.title,value:n===null?q(`自動`):n+`%`})}),a}function Ip(e,t,n=new Set){if(n.has(t))return!1;let r=e.ports[t];if(!r||r.direction!==`in`)return!1;if(r.artifacts.length>0)return!0;let i=new Set(n).add(t);return cp(e,{portId:t,side:`inner`}).some(t=>t.auto&&Ip(e,t.to.portId,i))}function Lp(e,t,n=new Set){let r=`${t.portId}:${t.side}`;if(n.has(r))return!1;let i=e.ports[t.portId];if(!i)return!1;let a=new Set(n).add(r),o=t.side===`outer`?`inner`:`outer`,s=sp(e,{portId:i.id,side:o});return s.length>0?s.every(t=>Lp(e,t.from,a)):i.direction===`in`?Ip(e,i.id):i.artifacts.length>0||i.direction===`out`&&e.blocks[i.blockId]?.status===`white`}function Rp(e,t){return Lp(e,t.from)}function zp(e,t){let n=e.ports[t];return!!n&&n.direction===`in`&&Lp(e,{portId:t,side:`inner`})}function Bp(e,t){return Y(e,t,`in`).filter(t=>t.required&&!zp(e,t.id))}function Vp(e,t){let n=e.blocks[t];if(!n||n.status===`white`||rp(e,t).some(e=>e.status!==`white`))return!1;let r=Y(e,t,`out`);return r.length>0&&r.every(e=>e.artifacts.length>0)}function Hp(e){let{updatedAt:t,version:n,...r}=e;return JSON.stringify(r,null,2)}function Up(e){let t;try{t=JSON.parse(e)}catch{throw Error(q(`JSON として読めません`))}if(typeof t!=`object`||!t)throw Error(q(`プロジェクトの形式ではありません`));let n=t,r=Number(n.schemaVersion);if(![1,2,3,4,5].includes(r))throw Error(q(`対応していないデータ形式の版です (schemaVersion={version})`,{version:String(n.schemaVersion)}));if(!n.blocks||!n.ports||!n.edges||!n.blocks.root)throw Error(q(`ブロック・ポート・線のデータが足りません`));let i={schemaVersion:5,id:typeof n.id==`string`?n.id:If(),name:typeof n.name==`string`?n.name:q(`無題`),description:typeof n.description==`string`?n.description:``,createdAt:typeof n.createdAt==`string`?n.createdAt:Lf(),visibility:n.visibility??`private`,members:Array.isArray(n.members)?n.members:[],blocks:n.blocks,ports:n.ports,edges:n.edges,terminals:n.terminals??{in:{x:0,y:200},out:{x:1100,y:200}},log:Array.isArray(n.log)?n.log:[],agents:n.agents&&typeof n.agents==`object`?n.agents:{},nextKey:typeof n.nextKey==`number`?n.nextKey:1,inputGroups:Array.isArray(n.inputGroups)?n.inputGroups:[]};typeof n.contextGuard==`boolean`&&(i.contextGuard=n.contextGuard),n.handoffs&&typeof n.handoffs==`object`&&(i.handoffs=n.handoffs),(n.lang===`en`||n.lang===`ja`)&&(i.lang=n.lang);for(let e of Object.values(i.ports))e.groupId&&!i.inputGroups.some(t=>t.id===e.groupId)&&delete e.groupId;for(let e of Object.values(i.blocks))e.activity===void 0&&(e.activity=null),Array.isArray(e.decisions)||(e.decisions=[]),Array.isArray(e.artifacts)||(e.artifacts=[]),Array.isArray(e.assigneeIds)||(e.assigneeIds=[]),e.progress!==void 0&&typeof e.progress!=`number`&&delete e.progress;if(r<4)for(let e of Object.values(i.ports))e.direction===`in`&&(e.required=!0);Bf(i);for(let e of Object.values(i.ports))i.blocks[e.blockId]||delete i.ports[e.id];for(let e of Object.values(i.edges))(!i.ports[e.from.portId]||!i.ports[e.to.portId])&&delete i.edges[e.id];return Mp(Wp(i))}function Wp(e){let t=rp(e,Ff).filter(e=>$f(e)!==`project`);if(t.length===0)return e;let n=Rf(e),r=If();n.blocks[r]={id:r,key:zf(n),kind:`project`,parentId:Ff,title:n.name,description:n.description,status:`gray`,assigneeIds:[],position:{x:300,y:40},collapsed:!1,artifacts:[],activity:null,decisions:[]};let i=Math.min(...t.map(e=>e.position.x)),a=Math.min(...t.map(e=>e.position.y));for(let e of t)n.blocks[e.id].parentId=r,n.blocks[e.id].position={x:e.position.x-i+Vf.left,y:e.position.y-a+Uf(n,r)};for(let e of Object.values(n.edges)){let t=n.ports[e.to.portId],i=n.ports[e.from.portId];if(t&&i){if(e.kind===`up`&&t.blockId===`root`&&e.to.side===`inner`){let i=Y(n,r,`out`).find(e=>e.name===t.name);if(!i){i={id:If(),blockId:r,direction:`out`,name:t.name,description:t.description,required:!0,artifacts:[]},n.ports[i.id]=i;let e=If();n.edges[e]={id:e,from:{portId:i.id,side:`outer`},to:{portId:t.id,side:`inner`},kind:`up`,auto:!1}}e.to={portId:i.id,side:`inner`}}if(e.kind===`down`&&i.blockId===`root`&&e.from.side===`inner`){if(e.auto){delete n.edges[e.id];continue}let t=Y(n,r,`in`).find(e=>e.name===i.name);if(!t){t={id:If(),blockId:r,direction:`in`,name:i.name,description:i.description,required:i.required,artifacts:[]},n.ports[t.id]=t;let e=If();n.edges[e]={id:e,from:{portId:i.id,side:`inner`},to:{portId:t.id,side:`outer`},kind:`down`,auto:!1}}e.from={portId:t.id,side:`inner`}}}}for(let e of Y(n,Ff,`in`))e.promotedFrom&&delete n.ports[e.id];for(let e of Object.values(n.edges))(!n.ports[e.from.portId]||!n.ports[e.to.portId])&&delete n.edges[e.id];if(Y(n,r,`out`).length===0){let e={id:If(),blockId:r,direction:`out`,name:q(`最終成果物`),description:``,required:!0,artifacts:[]};n.ports[e.id]=e;let t=Y(n,Ff,`out`)[0];if(t&&sp(n,{portId:t.id,side:`inner`}).length===0){let r=If();n.edges[r]={id:r,from:{portId:e.id,side:`outer`},to:{portId:t.id,side:`inner`},kind:`up`,auto:!1}}}return n}function Gp(e,t){e.log.push({id:If(),at:Lf(),...t}),e.log.length>500&&e.log.splice(0,e.log.length-500),e.agents[t.actor]={lastSeen:Lf()}}function Kp(e,t,n,r,i){let a=pp(e),o=a.blocks[t];return!o||t===`root`?e:(o.activity={actor:n,state:r,note:i,since:Lf()},r===`working`&&o.status===`black`&&(o.status=`gray`),Gp(a,{actor:n,kind:r===`working`?`started`:r===`blocked`?`blocked`:`note`,blockId:t,message:`${q(r===`working`?`「{title}」開始`:r===`blocked`?`「{title}」詰まり`:r===`waiting_review`?`「{title}」確認待ち`:`「{title}」判断待ち`,{title:o.title})}${i?`: `+i:``}`}),a)}function qp(e,t){let n=pp(e),r=n.blocks[t];return r?(r.activity=null,n):e}function Jp(e,t,n,r,i=[],a=``){let o=e.blocks[t];if(!o||t===`root`)return{project:e};let s=pp(e),c={id:If(),question:r,options:i,askedBy:n,askedAt:Lf(),...a?{context:a}:{}};return s.blocks[t].decisions.push(c),s.blocks[t].activity={actor:n,state:`needs_decision`,note:r,since:Lf()},Gp(s,{actor:n,kind:`asked`,blockId:t,message:q(`「{title}」で判断待ち: {question}`,{title:o.title,question:r})}),{project:s,decisionId:c.id}}function Yp(e,t,n,r,i){let a=e.blocks[t],o=a?.decisions.find(e=>e.id===n);if(!a||!o)return e;let s=pp(e),c=s.blocks[t].decisions.find(e=>e.id===n);return c.answer=r,c.answeredBy=i,c.answeredAt=Lf(),em(i)?(delete c.ackedBy,delete c.ackedAt):(c.ackedBy=i,c.ackedAt=c.answeredAt),s.blocks[t].activity?.state===`needs_decision`&&(s.blocks[t].activity=null),Gp(s,{actor:i,kind:`answered`,blockId:t,message:q(`「{title}」の判断: {question} → {answer}`,{title:a.title,question:o.question,answer:r})}),s}function Xp(e,t,n,r,i){let a=e.blocks[t],o=a?.decisions.find(e=>e.id===n);if(!a||!o||o.answer===void 0||!r.trim()||r.trim()===o.answer)return e;let s=pp(e),c=s.blocks[t].decisions.find(e=>e.id===n);return delete c.ackedAt,delete c.ackedBy,c.answer=r.trim(),c.answeredBy=i,c.answeredAt=Lf(),Gp(s,{actor:i,kind:`answered`,blockId:t,message:q(`「{title}」の判断の答えを直した: {question} → {answer}`,{title:a.title,question:o.question,answer:r.trim()})}),s}function Zp(e){return e.answer===void 0?{rejected:[...e.options]}:{chosen:e.answer,rejected:e.options.filter(t=>t!==e.answer)}}function Qp(e,t,n,r,i=``){let a=e.blocks[t],o=a?.decisions.find(e=>e.id===n);if(!a||!o||o.answer===void 0)return e;let s=pp(e),c=s.blocks[t].decisions.find(e=>e.id===n);return c.history=[...c.history??[],{answer:o.answer,by:o.answeredBy??``,at:o.answeredAt??Lf(),note:i||void 0}],delete c.ackedBy,delete c.ackedAt,delete c.answer,delete c.answeredBy,delete c.answeredAt,s.blocks[t].activity={actor:r,state:`needs_decision`,note:o.question,since:Lf()},Gp(s,{actor:r,kind:`asked`,blockId:t,message:i?q(`「{title}」の判断をやり直し: {question} (前の答え: {answer}。理由: {note})`,{title:a.title,question:o.question,answer:o.answer??``,note:i}):q(`「{title}」の判断をやり直し: {question} (前の答え: {answer})`,{title:a.title,question:o.question,answer:o.answer??``})}),s}function $p(e){let t=[];for(let n of Object.values(e.blocks))for(let e of n.decisions)e.answer===void 0&&t.push({block:n,decision:e});return t}var em=e=>e===`human`||e.startsWith(`human:`);function tm(e){let t=[];for(let n of Object.values(e.blocks))for(let r of n.decisions)r.answer!==void 0&&!nm(e,n.id,r)&&t.push({block:n,decision:r});return t.sort((e,t)=>(t.decision.answeredAt??``).localeCompare(e.decision.answeredAt??``))}function nm(e,t,n){return n.answer===void 0?!1:n.ackedAt?!0:!!n.answeredBy&&!em(n.answeredBy)}function rm(e){let t=Object.values(e.blocks).filter(e=>e.id!==`root`&&$f(e)!==`project`),n=t.filter(e=>e.activity?.state===`working`).map(e=>({block:e,actor:e.activity.actor,note:e.activity.note,since:e.activity.since})),r=t.filter(e=>e.activity?.state===`blocked`||e.activity?.state===`waiting_review`).map(e=>({block:e,actor:e.activity.actor,note:e.activity.note})),i=t.filter(t=>t.status===`black`&&!t.activity&&rp(e,t.id).length===0).sort((t,n)=>Number(Bp(e,t.id).length>0)-Number(Bp(e,n.id).length>0));return{total:t.length,white:t.filter(e=>e.status===`white`).length,gray:t.filter(e=>e.status===`gray`).length,black:t.filter(e=>e.status===`black`).length,working:n,blocked:r,decisions:$p(e),answered:tm(e),next:i,overdue:t.filter(e=>dm(e))}}function im(e,t){let n=e.blocks[t],r=rp(e,t),i=n=>n===t?`parent`:e.blocks[n]?.title??`?`,a=[],o=new Set(r.map(e=>e.id));for(let n of Object.values(e.edges)){if(n.auto)continue;let r=e.ports[n.from.portId],s=e.ports[n.to.portId];if(!r||!s)continue;let c=(e,n)=>n===`inner`?e.blockId===t:o.has(e.blockId);c(r,n.from.side)&&c(s,n.to.side)&&a.push({from:`${i(r.blockId)}.${r.name}`,to:`${i(s.blockId)}.${s.name}`})}return{title:n.title,category:n.category,description:n.description,inputs:Y(e,t,`in`).filter(e=>!e.promotedFrom).map(e=>({name:e.name,description:e.description,required:e.required})),outputs:Y(e,t,`out`).map(e=>({name:e.name,description:e.description})),children:r.sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x).map(t=>im(e,t.id)),connections:a}}function am(e,t,n={}){let r=e.blocks[t],i=Lf();return{schema:`boxglow-block`,schemaVersion:1,id:r.template?.id??If(),name:n.name??r.title,version:(r.template?.version??0)+1,description:n.description??r.description,tags:n.tags??[],createdAt:i,updatedAt:i,root:im(e,t)}}function om(e,t,n,r,i){let a=mp(e,{parentId:t,title:n.title,outputName:n.outputs[0]?.name,position:i}),o=a.project,s=a.blockId;o.blocks[s].description=n.description,o.blocks[s].template=r,n.category&&(o.blocks[s].category=n.category),n.outputs[0]&&(o=Cp(o,Y(o,s,`out`)[0].id,{description:n.outputs[0].description}));for(let e of n.outputs.slice(1)){let t=yp(o,{blockId:s,direction:`out`,name:e.name});o=Cp(t.project,t.portId,{description:e.description})}for(let e of n.inputs){let t=yp(o,{blockId:s,direction:`in`,name:e.name});o=Cp(t.project,t.portId,{description:e.description,required:e.required})}if(n.children.length>0){let e={},t=Uf(o,s);for(let i of n.children){let n=om(o,s,i,r,{x:Vf.left,y:t});o=n.project,e[i.title]=n.blockId,t+=120}let i=(t,n)=>{for(let{title:r,portName:i}of ym(t)){let t=r===`parent`,a=t?s:e[r];if(!a)continue;let c=Y(o,a,t?n===`out`?`in`:`out`:n).find(e=>e.name===i);if(c)return{portId:c.id,side:t?`inner`:`outer`}}return null};for(let e of n.connections){let t=i(e.from,`out`),n=i(e.to,`in`);t&&n&&(o=Op(o,t,n).project)}o.blocks[s].status=`gray`}return{project:o,blockId:s}}function sm(e,t,n,r,i){let a={id:n.id,name:n.name,version:n.version},o=om(e,t,n.root,a,i),s=o.project;return Gp(s,{actor:r,kind:`added`,blockId:o.blockId,message:q(`テンプレート「{name}」v{version} を挿入: {title}`,{name:n.name,version:n.version,title:n.root.title})}),{project:Mp(s),blockId:o.blockId}}function cm(e){let t;try{t=JSON.parse(e)}catch{throw Error(q(`JSON として読めません`))}let n=t;if(!n||n.schema!==`boxglow-block`||!n.root||typeof n.root.title!=`string`)throw Error(q(`Boxglow のテンプレート (boxglow-block) ではありません`));let r=e=>({title:e.title??q(`無題`),description:e.description??``,category:typeof e.category==`string`?e.category:void 0,inputs:(e.inputs??[]).map(e=>({name:e.name,description:e.description??``,required:e.required??!0})),outputs:(e.outputs??[]).map(e=>({name:e.name,description:e.description??``})),children:(e.children??[]).map(r),connections:e.connections??[]});return{schema:`boxglow-block`,schemaVersion:1,id:n.id??If(),name:n.name??n.root.title,version:n.version??1,description:n.description??``,tags:n.tags??[],createdAt:n.createdAt??Lf(),updatedAt:n.updatedAt??Lf(),root:r(n.root)}}function lm(e,t,n){if(!e.blocks[t])return e;if(n&&!mf(n))throw Error(q(`知らないカテゴリです: {key}`,{key:n}));let r=pp(e);return n?r.blocks[t].category=n:delete r.blocks[t].category,r}function um(e,t,n,r){let i=e.blocks[t];if(!i)return e;let a=pp(e),o=a.blocks[t],s=(e,t)=>{t!==void 0&&(t===null||t===``||typeof t==`number`&&Number.isNaN(t)?delete o[e]:o[e]=t)};s(`startDate`,n.startDate),s(`dueDate`,n.dueDate),s(`estimateHours`,n.estimateHours),s(`actualHours`,n.actualHours);let c=[];return n.dueDate!==void 0&&c.push(q(`期日 {date}`,{date:n.dueDate??q(`なし`)})),n.startDate!==void 0&&c.push(q(`開始 {date}`,{date:n.startDate??q(`なし`)})),n.actualHours!==void 0&&c.push(q(`実績 {hours}h`,{hours:n.actualHours??0})),n.estimateHours!==void 0&&c.push(q(`見積 {hours}h`,{hours:n.estimateHours??0})),c.length>0&&Gp(a,{actor:r,kind:`note`,blockId:t,message:q(`「{title}」{detail}`,{title:i.title,detail:c.join(`, `)})}),a}function dm(e,t=new Date){return!e.dueDate||e.status===`white`?!1:new Date(e.dueDate+`T23:59:59`).getTime()<t.getTime()}function fm(e,t=new Date){if(!e.dueDate)return null;let n=new Date(e.dueDate+`T00:00:00`),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((n.getTime()-r.getTime())/864e5)}function pm(e,t,n=20){let r=t.trim().toLowerCase();if(!r)return[];let i=Object.values(e.blocks).filter(e=>e.id!==Ff),a=i.filter(e=>e.key?.toLowerCase()===r),o=e=>mf(e.category),s=i.filter(e=>!a.includes(e)&&(e.title.toLowerCase().includes(r)||(e.key??``).toLowerCase().includes(r)||e.description.toLowerCase().includes(r)||o(e)?.label===t.trim()||o(e)?.en===r));return[...a,...s].slice(0,n)}function mm(e,t,n=new Set){if(n.has(t))return null;n.add(t);let r=e.ports[t];if(!r||r.direction!==`in`)return null;let i=sp(e,{portId:t,side:`outer`})[0];if(!i)return null;let a=e.ports[i.from.portId];return a?a.direction===`out`||a.blockId===`root`?a:mm(e,a.id,n)??a:null}function hm(e,t){let n=e.ports[t];if(!n)return``;if(n.direction===`out`)return n.description;let r=mm(e,t);return r?r.description:n.description}function gm(e,t){let n=[],r=t;for(;r!==null;)n.push(r),r=e.blocks[r]?.parentId??null;return n}function _m(e,t,n,r){let i=Y(e,t,n).find(e=>e.name===r&&!e.promotedFrom);if(i)return i;let a=yp(e,{blockId:t,direction:n,name:r});return Object.assign(e,a.project),e.ports[a.portId]??null}function vm(e,t,n){let r=lp(e,t),i=lp(e,n);if(r===null||i===null)return;let a=e.ports[t.portId],o=e.ports[n.portId];if(!a||!o)return;let s=gm(e,r),c=gm(e,i),l=s.find(e=>c.includes(e));if(!l)return;let u=t;for(let t of s.slice(0,s.indexOf(l))){if(t===`root`)return;let n=_m(e,t,`out`,a.name);if(!n)return;let r=Op(e,u,{portId:n.id,side:`inner`});r.error||Object.assign(e,r.project),u={portId:n.id,side:`outer`}}for(let t of c.slice(0,c.indexOf(l)).reverse()){if(t===`root`)return;let n=_m(e,t,`in`,o.name);if(!n)return;let r=Op(e,u,{portId:n.id,side:`outer`});r.error||Object.assign(e,r.project),u={portId:n.id,side:`inner`}}let d=Op(e,u,n);d.error||Object.assign(e,d.project)}function ym(e){let t=[];for(let n=e.indexOf(`.`);n>=0;n=e.indexOf(`.`,n+1)){let r=e.slice(0,n),i=e.slice(n+1);r&&i&&t.push({title:r,portName:i})}return t}function bm(e,t,n,r){let i=e.blocks[t],a=e.blocks[n];if(!i||!a||t===`root`||n===`root`||i.parentId===n||$f(i)===`project`||n===t||ip(e,t).some(e=>e.id===n))return e;let o=pp(e),s=i.parentId,c=new Set(Y(o,t).map(e=>e.id)),l=[];for(let e of Object.values(o.edges)){let t=c.has(e.from.portId)&&e.from.side===`outer`,r=c.has(e.to.portId)&&e.to.side===`outer`;if(!t&&!r||(delete o.edges[e.id],e.auto))continue;let i=t?e.from:e.to,a=t?e.to:e.from,u=o.ports[a.portId];if(u&&(a.side!==`outer`||u.blockId!==n)){if(a.side===`inner`&&u.blockId===s&&s!==null){if(r){let e=sp(o,{portId:u.id,side:`outer`})[0];e&&l.push({from:e.from,to:i})}else for(let e of cp(o,{portId:u.id,side:`outer`}))l.push({from:i,to:e.to});continue}l.push(t?{from:i,to:a}:{from:a,to:i})}}o.blocks[t].parentId=n,o.blocks[t].position={x:Math.max(Vf.left,r.x),y:Math.max(Uf(o,n),r.y)};for(let e of l)vm(o,e.from,e.to);return o.blocks[n].status===`black`&&(o.blocks[n].status=`gray`),o.blocks[n].collapsed=!1,Gp(o,{actor:`human`,kind:`note`,blockId:t,message:q(`「{title}」を「{parent}」の中へ移動`,{title:i.title,parent:a.title})}),Mp(o)}function xm(e,t,n){let r=e.ports[t.portId],i=e.blocks[n];if(!r||!i||n===`root`)return{project:e,error:q(`つなぐ先が見つかりません`)};let a=lp(e,t),o=r.direction===`in`&&t.side===`inner`&&i.parentId===r.blockId,s=a!==null&&i.parentId===a;if(r.direction===`out`&&t.side===`outer`&&e.blocks[r.blockId]?.parentId===n){let r=Y(e,n,`out`),i=r.find(t=>sp(e,{portId:t.id,side:`inner`}).length===0)??r[0];return i?Op(e,t,{portId:i.id,side:`inner`}):{project:e,error:q(`親に出力がありません`)}}if(!s&&!o)return{project:e,error:q(`同じ階層のボックス (または親子) にだけつなげます`)};let c=Y(e,n,`in`).find(t=>sp(e,{portId:t.id,side:`outer`}).every(e=>e.auto)&&!t.promotedFrom),l=e;if(!c){let t=yp(e,{blockId:n,direction:`in`,name:r.name});l=t.project,c=l.ports[t.portId]}return Op(l,t,{portId:c.id,side:`outer`})}var Sm=96;function Cm(e,t,n,r,i){let a=e.blocks[t];if(!a||a.parentId===null)return!1;let o=i??rp(e,a.parentId).map(e=>e.id),s=n(e,t),c=!!r,l=!1;for(let i=0;i<(c?64:8);i++){let i=e.blocks[t],a;for(let c of o){if(c===t||r&&!r.has(c))continue;let o=e.blocks[c],l=n(e,c);if(i.position.x<o.position.x+l.width+Sm&&i.position.x+s.width+Sm>o.position.x&&i.position.y<o.position.y+l.height+Sm&&i.position.y+s.height+Sm>o.position.y){a=o;break}}if(!a)break;let u=n(e,a.id),d=[{x:a.position.x+u.width+Sm,y:i.position.y,d:a.position.x+u.width+Sm-i.position.x},{x:i.position.x,y:a.position.y+u.height+Sm,d:a.position.y+u.height+Sm-i.position.y},{x:a.position.x-s.width-Sm,y:i.position.y,d:i.position.x-(a.position.x-s.width-Sm)},{x:i.position.x,y:a.position.y-s.height-Sm,d:i.position.y-(a.position.y-s.height-Sm)}].filter((e,t)=>e.d>=0&&(!c||t<2)),f=i.parentId!==Ff,p=d.filter(t=>!f||t.x>=Vf.left&&t.y>=Uf(e,i.parentId)),m=(p.length>0?p:d).sort((e,t)=>e.d-t.d)[0];if(!m)break;e.blocks[t]={...i,position:{x:m.x,y:m.y}},l=!0}return l}function wm(e,t,n,r){let i={...e,blocks:{...e.blocks}};return Cm(i,t,n,r)?i:e}function Tm(e,t){let n={...e,blocks:{...e.blocks}},r=new Map;for(let e of Object.values(n.blocks)){if(e.id===`root`||e.parentId===null)continue;let t=r.get(e.parentId)??[];t.push(e.id),r.set(e.parentId,t)}let i=e=>{let t=0,r=n.blocks[e]?.parentId;for(;r;)t++,r=n.blocks[r]?.parentId;return t},a=[...r.keys()].sort((e,t)=>i(t)-i(e)),o=new Map,s=(e,n)=>{let r=o.get(n);return r||(r=t(e,n),o.set(n,r)),r},c=!1;for(let e of a){let t=(r.get(e)??[]).slice().sort((e,t)=>n.blocks[e].position.y-n.blocks[t].position.y||n.blocks[e].position.x-n.blocks[t].position.x),i=new Set(t.slice(0,1));for(let e=1;e<t.length;e++)Cm(n,t[e],s,i,t)&&(c=!0),i.add(t[e])}return c?n:e}var Em=e=>e.inputGroups??[];function Dm(e,t){return Y(e,Ff,`in`).filter(e=>t===null?!e.groupId:e.groupId===t)}function Om(e,t){let n=pp(e),r=n.inputGroups??=[],i=If(),a=r.length===0?n.terminals.in.y+160:Math.max(...r.map(e=>e.position.y))+160;return r.push({id:i,name:t,description:``,position:{x:n.terminals.in.x,y:a}}),Gp(n,{actor:`human`,kind:`added`,message:q(`入力グループ「{name}」を追加`,{name:t})}),{project:n,groupId:i}}function km(e,t,n){let r=pp(e),i=(r.inputGroups??[]).find(e=>e.id===t);return i?(Object.assign(i,n),r):e}function Am(e,t){let n=pp(e);n.inputGroups=(n.inputGroups??[]).filter(e=>e.id!==t);for(let e of Object.values(n.ports))e.groupId===t&&delete e.groupId;return n}function jm(e,t,n){let r=e.ports[t];if(!r||r.blockId!==`root`||r.direction!==`in`)return e;let i=pp(e);return n?i.ports[t].groupId=n:delete i.ports[t].groupId,i}function Mm(e,t,n){let r=Rf(e),i=(r.inputGroups??[]).find(e=>e.id===t);return i?(i.position=n,r):e}function Nm(e,t){let n=(e.inputGroups??[]).find(e=>e.id===t),r=Dm(e,t).map(e=>({name:e.name,description:e.description,artifacts:e.artifacts.map(e=>({title:e.title,url:e.url}))}));return JSON.stringify({schema:`boxglow-input-group`,name:n?.name??``,description:n?.description??``,inputs:r},null,2)}function Pm(e,t){let n;try{n=JSON.parse(t)}catch{throw Error(q(`JSON として読めません`))}if(n.schema!==`boxglow-input-group`||!Array.isArray(n.inputs))throw Error(q(`入力グループの JSON (boxglow-input-group) ではありません`));let r=Om(e,n.name??`Inputs`),i=km(r.project,r.groupId,{description:n.description??``});for(let e of n.inputs){let t=yp(i,{blockId:Ff,direction:`in`,name:e.name});i=Cp(t.project,t.portId,{description:e.description??``,artifacts:(e.artifacts??[]).map(e=>ep(e.title,e.url??``))}),i=jm(i,t.portId,r.groupId)}return{project:i,groupId:r.groupId}}function Fm(e){let t=e.trim(),n=t.match(/\/browse\/([A-Z][A-Z0-9_]+-\d+)/i);if(n)return n[1].toUpperCase();if(n=t.match(/\/issues\/(\d+)/),n)return`#${n[1]}`;if(n=t.match(/\/pull\/(\d+)/),n)return`PR #${n[1]}`;try{return new URL(t).hostname.replace(/^www\./,``)}catch{return t.slice(0,20)}}function Im(e,t){let n=[],r=e=>{n.includes(e)||n.push(e)},i=t=>{let n=e.ports[t.from.portId]?.blockId,r=e.ports[t.to.portId]?.blockId,i=n&&n!==`root`?Jf(e,n):null,a=r&&r!==`root`?Jf(e,r):null,o=(t,n)=>!!t&&t!==`root`&&(Jf(e,t)!==t||n===`inner`);return o(n,t.from.side)?i:o(r,t.to.side)?a:null},a=Rm(e,t),o=[...a].map(t=>e.edges[t]).filter(e=>!!e),s=e.edges[t],c=o.filter(t=>t!==s&&Lm(e,t,s,a)),l=o.filter(e=>e!==s&&!c.includes(e));for(let e of c)r(i(e));s&&r(i(s));for(let e of l)r(i(e));return n}function Lm(e,t,n,r){if(!n)return!1;let i=[n],a=new Set;for(;i.length>0;){let n=i.pop(),o=e.ports[n.from.portId];if(!o)continue;let s=n.from.side===`outer`?`inner`:`outer`;for(let n of r){let r=e.edges[n];if(r&&!a.has(n)&&r.to.portId===o.id&&r.to.side===s){if(r.id===t.id)return!0;a.add(n),i.push(r)}}}return!1}function Rm(e,t){let n=new Set([t]),r=Object.values(e.edges),i=e.edges[t];if(!i)return n;let a=[i];for(;a.length>0;){let t=a.pop(),i=e.ports[t.from.portId];if(!i)continue;let o=t.from.side===`outer`?`inner`:`outer`;for(let e of r)e.to.portId===i.id&&e.to.side===o&&!n.has(e.id)&&(n.add(e.id),a.push(e))}let o=[i];for(;o.length>0;){let t=o.pop(),i=e.ports[t.to.portId];if(!i)continue;let a=t.to.side===`outer`?`inner`:`outer`;for(let e of r)e.from.portId===i.id&&e.from.side===a&&!n.has(e.id)&&(n.add(e.id),o.push(e))}return n}function zm(e,t){let n=0;for(let r of e){let e=r.codePointAt(0)??0;n+=e>11903?t*1.05:t*.6}return n}function Bm(e){let t=e=>zm(e,10)+14+6,n=22;return e.isProject||(n+=t(`In Progress`)),e.assigneeText?n+=t(e.assigneeText):e.unassigned&&(n+=t(q(`未担当`))),e.hasPercent&&(n+=t(`100%`)),e.activityText&&(n+=t(e.activityText)),e.hasReady&&(n+=t(`Ready`)),e.hasDue&&(n+=t(q(`期日 {date}`,{date:`10/15`}))),n+=e.keyLen*7+8,n}function Vm(e,t){let n=e.blocks[t];return!!n&&!n.collapsed&&rp(e,t).length>0}function Hm(e,t){let n=e.blocks[t],r=Y(e,t,`in`),i=Y(e,t,`out`),a=Math.max(r.length,i.length,1),o=rp(e,t),s=mf(n?.category),c=30+(n?.kind===`project`?66:26)+30+(s?zm(q(s.label),11)+20:0),l=zm(n?.title??``,15)+4,u=c+l,d=e=>{let t=e.toLowerCase();return t.startsWith(`claude`)?`Claude Code`:t.startsWith(`codex`)?`Codex`:t.startsWith(`human:`)?e.slice(6):e},f={working:q(`作業中`),blocked:q(`詰まり`),needs_decision:q(`判断待ち`),waiting_review:q(`確認待ち`)},p=Bm({assigneeText:``,unassigned:!1,hasPercent:!!n&&n.status!==`white`&&(o.length>0||typeof n.progress==`number`&&n.progress>0),activityText:n?.activity?`${f[n.activity.state]??``} (${d(n.activity.actor)})`:null,hasDue:!!n?.dueDate&&n.status!==`white`,keyLen:(n?.key??``).length,isProject:n?.kind===`project`,hasReady:!!n&&n.status===`black`&&n.kind!==`project`&&r.length>0&&Bp(e,n.id).length===0}),m=Math.min(460,Math.max(256,u,p)),h=Math.max(0,...r.map(e=>zm(e.name,12)+(e.name?14:0)+(e.required?0:zm(q(`(任意)`),9)+4))),g=Math.max(0,...i.map(e=>zm(e.name,12))),_=12+h+24+g+10,v=Math.max(256,m,Math.min(580,_)),y=36+(Math.max(1,Math.ceil(l/Math.max(80,v-c)))-1)*18+24,b=y+a*26+16;if(!Vm(e,t))return{width:v,height:b,headerH:y};let x=0,S=0;for(let t of o){let n=Hm(e,t.id);x=Math.max(x,t.position.x+n.width),S=Math.max(S,t.position.y+n.height)}return{width:Math.max(320,v,x+96),height:Math.max(b+16,S+104+12+(y-44)),headerH:y}}function Um(e,t){let n=Y(e,Ff,t).length;return 44+Math.max(n,1)*26+16}var Wm=144,Gm=96,Km=3e3;function qm(e,t,n={}){let r=structuredClone(e),i=rp(r,t);if(i.length===0)return r;for(let e of i)n.recursive!==!1&&rp(r,e.id).length>0&&(r=qm(r,e.id));let a=i.map(e=>e.id),o=new Map;for(let e of a){let t=new Set;for(let n of Y(r,e,`out`))for(let e of cp(r,{portId:n.id,side:`outer`})){if(e.kind!==`sibling`)continue;let n=r.ports[e.to.portId]?.blockId;n&&a.includes(n)&&t.add(n)}o.set(e,[...t])}let s=new Map,c=new Set,l=e=>{if(s.has(e))return s.get(e);if(c.has(e))return 0;c.add(e);let t=0;for(let n of a)o.get(n).includes(e)&&(t=Math.max(t,l(n)+1));return c.delete(e),s.set(e,t),t};for(let e of a)l(e);let u=Math.max(...a.map(e=>s.get(e))),d=new Map;[...i].sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x).forEach((e,t)=>d.set(e.id,t));let f=new Map;for(let e of a)f.set(e,a.filter(t=>o.get(t).includes(e)));for(let e=0;e<2;e++){for(let e=1;e<=u;e++){let t=a.filter(t=>s.get(t)===e),n=new Map;for(let e of t){let t=f.get(e);n.set(e,t.length===0?d.get(e):t.reduce((e,t)=>e+d.get(t),0)/t.length)}t.sort((e,t)=>n.get(e)-n.get(t)||d.get(e)-d.get(t)),t.forEach((e,t)=>d.set(e,t))}for(let e=u-1;e>=0;e--){let t=a.filter(t=>s.get(t)===e),n=new Map;for(let e of t){let t=o.get(e);n.set(e,t.length===0?d.get(e):t.reduce((e,t)=>e+d.get(t),0)/t.length)}t.sort((e,t)=>n.get(e)-n.get(t)||d.get(e)-d.get(t)),t.forEach((e,t)=>d.set(e,t))}}let p=Array(Math.max(1,u)).fill(0);for(let e of a)for(let t of o.get(e)){let n=s.get(e),r=s.get(t);for(let e=Math.min(n,r);e<Math.max(n,r);e++)p[e]++}let m=e=>Math.max(Wm,72+16*Math.max(0,(p[e]??0)-1)+16),h=t===`root`?200+Wm:Vf.left,g=t===`root`?40:Uf(r,t),_=h,v=g,y=g,b=g;for(let e=0;e<=u;e++){let t=i.filter(t=>s.get(t.id)===e).sort((e,t)=>d.get(e.id)-d.get(t.id)),n=Math.max(0,...t.map(e=>Hm(r,e.id).width));e>0&&_+n>h+Km&&(_=h,v=b+192);let a=v;for(let e of t){let t=Hm(r,e.id);r.blocks[e.id].position={x:_,y:a},a+=t.height+Gm}b=Math.max(b,a-Gm),y=Math.max(y,b),_+=n+m(e)}if(t===`root`){let e=Math.max(g,(g+y)/2-Um(r,`in`)/2);r.terminals.in={x:0,y:e};let t=e+Um(r,`in`)+Gm;for(let e of r.inputGroups??[])e.position={x:0,y:t},t+=44+Math.max(1,Object.values(r.ports).filter(t=>t.blockId===`root`&&t.groupId===e.id).length)*26+12+Gm;r.terminals.out={x:_,y:Math.max(g,(g+y)/2-Um(r,`out`)/2)}}return r}function Jm(e){return qm(e,Ff)}function Ym(e,t){let n=rp(e,t),r=t===`root`?200+Wm:Vf.left,i=t===`root`?40:Uf(e,t);if(n.length===0)return{x:r,y:i};let a=i,o=1/0;for(let t of n){let n=Hm(e,t.id);a=Math.max(a,t.position.y+n.height),o=Math.min(o,t.position.x)}return{x:Math.max(r,o),y:a+Gm}}function Xm(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Zm(e,t=`|`){return e.map(e=>Sh(e)).join(t)}function Qm(e,t){return typeof t==`bigint`?t.toString():t}var $m=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function eh(e){return new $m(e)}function th(e){return e==null}function nh(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function rh(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ih(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ah(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function oh(e){return ah(e._zod.def)??e._zod.def.shape}function sh(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ih(this,t,e),e},enumerable:!0,configurable:!0})}function ch(e,t,n){t in e?ih(e,t,n):e[t]=n}function lh(e,t,n,r){let i=oh(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?sh(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ch(e,a,r?r(n.value,a):n.value))}}function uh(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?sh(e,n,()=>t[n]):ch(e,n,r.value))}}function dh(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function fh(e){return JSON.stringify(e)}function ph(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var mh=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function hh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gh=eh(()=>{if(dg.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _h(e){if(hh(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return hh(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function vh(e){return _h(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var yh=new Set([`string`,`number`,`symbol`]);function bh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xh(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function X(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sh(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ch(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var wh={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Th={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Eh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return lh(i,e,Dh(e,t)),xh(e,dh(n,{shape:i,checks:[]}))}function Dh(e,t){let n=oh(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Oh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Dh(e,t)),a={};return lh(a,e,Reflect.ownKeys(oh(e)).filter(e=>!i.has(e))),xh(e,dh(n,{shape:a,checks:[]}))}function kh(e,t){if(!_h(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=oh(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xh(e,dh(e._zod.def,{shape:Ah(e,t)}))}function Ah(e,t){let n={};return lh(n,e,Reflect.ownKeys(oh(e))),uh(n,t),n}function jh(e,t){if(!_h(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xh(e,dh(e._zod.def,{shape:Ah(e,t)}))}function Mh(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return lh(n,e,Reflect.ownKeys(oh(e))),lh(n,t,Reflect.ownKeys(oh(t))),xh(e,dh(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Nh(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Dh(t,n)):void 0,o={};return lh(o,t,Reflect.ownKeys(oh(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),xh(t,dh(t._zod.def,{shape:o,checks:[]}))}function Ph(e,t,n){let r=n?new Set(Dh(t,n)):void 0,i={};return lh(i,t,Reflect.ownKeys(oh(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),xh(t,dh(t._zod.def,{shape:i}))}function Fh(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ih(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Lh(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Rh(e){return typeof e==`string`?e:e?.message}function zh(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Bh(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Rh(e.inst?._zod.def?.error?.(e))??Rh(a?.(e))??Rh(t?.error?.(e))??Rh(n.customError?.(e))??Rh(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Vh=/[\uD800-\uDBFF]/;function Hh(e){let t=e.length;if(!Vh.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Uh(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Wh(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Gh(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Kh(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Xh(e,n,r.value)}}function qh(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Jh(e,t,n){return qh(e,t,n,!1)}function Yh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return qh(this,n,r(this))},set(e){qh(this,n,e)}})}return t}function Xh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qh(this,t,n.bind(this))},set(e){qh(this,t,e)}})}function Zh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Qh,$h=!1,eg={configurable:!0,get(){$h=!0}};function tg(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Qh!==e._zod){Qh=void 0;return}Qh=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,eg);let e=$h;$h=!1;try{let r=n(this);return $h?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),$h||=e,r}catch(n){throw delete this[t],$h||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function ng(e,t,n,r){let i=Zh(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var rg=`~constantCatch`;function ig(e){let t=()=>e;return t[rg]=!0,t}var ag,og={value:void 0,enumerable:!1},sg=`captureStackTrace`in Error?Error:null;function cg(e){let t=sg;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return sg=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function Z(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){og.value=new a(r);try{Object.defineProperty(n,"_zod",og)}finally{og.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Kh(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?cg(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var lg=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ug=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ag=globalThis).__zod_globalConfig??(ag.__zod_globalConfig={});var dg=globalThis.__zod_globalConfig;function fg(e){return e&&Object.assign(dg,e),dg}function pg(){let e=this._zod;return e.message??=JSON.stringify(e.def,Qm,2),e.message}function mg(e){this._zod.message=e}var hg={get:pg,set:mg,enumerable:!0,configurable:!0},gg={value:void 0,enumerable:!1},_g=new WeakSet([Object.prototype,Error.prototype]),vg=(e,t)=>{e.name=`$ZodError`,gg.value=t,Object.defineProperty(e,"issues",gg),gg.value=void 0,Object.defineProperty(e,"message",hg);let n=Object.getPrototypeOf(e);_g.has(n)||(_g.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},yg=Z(`$ZodError`,vg);Z(`$ZodError`,vg,void 0,{Parent:Error});function bg(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function xg(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?bg(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Sg(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Cg(e,t){return{callee:t?.callee??e,Err:t?.Err}}var wg=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new lg;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Bh(e,o,fg())));throw mh(n,a?.callee??t),n}return s.value};return t},Tg=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Bh(e,o,fg())));throw mh(n,a?.callee??t),n}return s.value};return t},Eg=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new lg;return a.issues.length?Dg(e,a.issues,i):{success:!0,data:a.value}};function Dg(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Bh(e,n,fg()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Og=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Dg(e,a.issues,i):{success:!0,data:a.value}},kg=Symbol.for(`zod.compile.invalid`),Ag=Symbol.for(`zod.compile.fallback`),jg=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==kg)return!0;if(r.definite===!0&&n===void 0)return!1}return Mg(e,t,n)});function Mg(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Ag]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new lg;return a.issues.length===0}var Ng=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Pg=e=>{let t=wg(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Cg(n,a))};return n},Fg=e=>{let t=wg(e),n=(e,r,i,a)=>t(e,r,i,Cg(n,a));return n},Ig=e=>{let t=Tg(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Cg(n,a))};return n},Lg=e=>{let t=Tg(e),n=async(e,r,i,a)=>await t(e,r,i,Cg(n,a));return n},Rg=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Eg(e)(t,n,i)},zg=e=>(t,n,r)=>Eg(e)(t,n,r),Bg=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Og(e)(t,n,i)},Vg=e=>async(t,n,r)=>Og(e)(t,n,r),Hg=/^[cC][0-9a-z]{6,}$/,Ug=/^[0-9a-z]+$/,Wg=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Gg=/^[0-9a-vA-V]{20}$/,Kg=/^[A-Za-z0-9]{27}$/,qg=/^[a-zA-Z0-9_-]{21}$/;function Jg(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Yg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xg=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zg=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Qg=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$g=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function e_(){return new RegExp($g,`u`)}var t_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,n_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,r_=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,i_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o_=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,s_=/^https?$/,c_=/^\+[1-9]\d{6,14}$/,l_=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function u_(e){return RegExp(`^${e}$`)}var d_=u_(l_);function f_(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function p_(e){return RegExp(`^${f_(e)}$`)}function m_(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${f_({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${f_({precision:e.precision})}`:n;return RegExp(`^${l_}T(?:${r})$`)}var h_=/^[\s\S]{0,}$/,g_=/^-?\d+$/,__=/^-?\d+(?:\.\d+)?$/,v_=/^(?:true|false)$/i,y_=/^[^A-Z]*$/,b_=/^[^a-z]*$/,x_=Z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),S_=e=>{let t=e.value;return!th(t)&&t.length!==void 0},C_={number:`number`,bigint:`bigint`,object:`date`},w_=Z(`$ZodCheckLessThan`,(e,t)=>{x_.init(e,t);let n=C_[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:C_[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),T_=Z(`$ZodCheckGreaterThan`,(e,t)=>{x_.init(e,t);let n=C_[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:C_[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),E_=Z(`$ZodCheckMultipleOf`,(e,t)=>{x_.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):rh(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),D_=Z(`$ZodCheckNumberFormat`,(e,t)=>{x_.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=wh[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),O_=Z(`$ZodCheckMaxLength`,(e,t)=>{var n;x_.init(e,t),(n=e._zod.def).when??(n.when=S_),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Hh(r):i)<=t.maximum)return;let a=Uh(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),k_=Z(`$ZodCheckMinLength`,(e,t)=>{var n;x_.init(e,t),(n=e._zod.def).when??(n.when=S_),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Hh(r):i)>=t.minimum)return;let a=Uh(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),A_=Z(`$ZodCheckLengthEquals`,(e,t)=>{var n;x_.init(e,t),(n=e._zod.def).when??(n.when=S_),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Hh(r):i;if(a===t.length)return;let o=Uh(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),j_=Z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x_.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),M_=Z(`$ZodCheckRegex`,(e,t)=>{j_.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),N_=Z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=y_,j_.init(e,t)}),P_=Z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=b_,j_.init(e,t)}),F_=Z(`$ZodCheckIncludes`,(e,t)=>{x_.init(e,t);let n=bh(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),I_=Z(`$ZodCheckStartsWith`,(e,t)=>{x_.init(e,t);let n=RegExp(`^${bh(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),L_=Z(`$ZodCheckEndsWith`,(e,t)=>{x_.init(e,t);let n=RegExp(`.*${bh(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),R_=Z(`$ZodCheckOverwrite`,(e,t)=>{x_.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),z_=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
17
|
+
From now on git merge / pull / rebase merges boxglow.json box by box automatically (everyone on the team needs to run this command once)`,"「{title}」に出力がありません":`"{title}" has no output`,"線 {id}: {reason}":`Wire {id}: {reason}`,"{key} 「{title}」の入力「{name}」がどこにもつながっていません":`{key} "{title}": input "{name}" is not connected to anything`,"{key} 「{title}」の出力「{name}」がどこにもつながっていません":`{key} "{title}": output "{name}" is not connected to anything`,"{key} 「{title}」の入力「{name}」が中のボックスとつながっていません":`{key} "{title}": input "{name}" is not connected to any box inside`,"{key} 「{title}」の出力「{name}」が中のボックスとつながっていません":`{key} "{title}": output "{name}" is not connected to any box inside`,"{key} 「{title}」は Done ですが成果物がありません (--artifact で付けてください)":`{key} "{title}" is Done but has no artifact (attach one with --artifact)`,問題ありません:`No problems`,"注意 ({count} 件。計画の穴):":`Warnings ({count}; gaps in the plan):`,"追加: 「{title}」(id: {id})":`Added: "{title}" (id: {id})`,"--spec '<JSON>' または --spec-file <path> を指定してください":`Specify --spec '<JSON>' or --spec-file <path>`,"分解: 「{title}」に {count} 個を追加":`Split: added {count} box(es) to "{title}"`,"--parent <block|project> を指定してください":`Specify --parent <block|project>`,"移せません (自分の子孫の中、プロジェクトのボックス、同じ親などは不可)":`Cannot move (not into its own descendants, not a project box, not to the same parent, etc.)`,"移動: 「{title}」を「{parent}」の中へ (線はつなぎ直しました)":`Moved: "{title}" into "{parent}" (wires were reconnected)`,"入力 {name}":`input {name}`,"出力 {name}":`output {name}`,"--rename は <旧名>=<新名> の形で指定してください: {spec}":`Write --rename as <old>=<new>: {spec}`,"ポート「{name}」が見つかりません":`Port "{name}" not found`,"入力「{name}」の名前は供給元の出力名で決まります。供給元の出力の名前を変えてください (port <供給元> --rename)":`The name of input "{name}" follows the output it is fed from. Rename that output instead (port <source> --rename)`,"--in <名前> / --out <名前> / --rename <旧名>=<新名> のいずれかを指定してください":`Specify one of --in <name> / --out <name> / --rename <old>=<new>`,"ポート: {title}: {list}":`Ports: {title}: {list}`,"そろえました: 入力の名前 {count} 件を供給元に合わせました":`Tidied: matched {count} input name(s) to their source`,"プロジェクトのボックスは消せません (中のボックスを全部消すか、ファイルごと作り直してください)":`A project box cannot be removed (remove all the boxes inside it, or recreate the file)`,"「{title}」の中に {count} 個のボックスがあります。まとめて消すなら --force を付けてください":`"{title}" contains {count} box(es). Add --force to remove them all`,"削除: 「{title}」":`Removed: "{title}"`," と中の {count} 個のボックス":` and the {count} box(es) inside`," (つながっていた線も外しました)":` (its wires were removed too)`,"線が見つかりません: {from} -> {to}":`Wire not found: {from} -> {to}`,"線を外しました: {from} -> {to}":`Disconnected: {from} -> {to}`,"結線: {from} -> {to}":`Connected: {from} -> {to}`," (親の出力)":` (the parent's output)`," (出力名と同じ入力を使いました)":` (used the input with the same name as the output)`,"開始: 「{title}」({actor})":`Started: "{title}" ({actor})`,"詰まり: 「{title}」":`Blocked: "{title}"`,"確認待ち: 「{title}」":`In review: "{title}"`,"活動を消しました: 「{title}」":`Cleared activity: "{title}"`,"完了: 「{title}」":`Done: "{title}"`," 成果物: ":` Artifacts: `,'注意: 成果物が付いていません。--artifact "<名前>=<パスまたは URL>" で、人が後から開ける具体的な物を付けてください':`Warning: no artifact attached. Use --artifact "<name>=<path or URL>" to attach something concrete that people can open later`,出力ポートが見つかりません:`Output port not found`,"成果物を付けました: 「{title}」.{port} <- {artifact}":`Attached artifact: "{title}".{port} <- {artifact}`,"- [補完] {owner}.{port} 「{title}」 {path} @ {commit}":`- [filled in] {owner}.{port} "{title}" {path} @ {commit}`,"- [移動] {owner}.{port} 「{title}」 {from} -> {to}":`- [moved] {owner}.{port} "{title}" {from} -> {to}`,"- [見つかりません] {owner}.{port} 「{title}」 {path} (コミット {commit} からは取り出せます: git show {commit}:{path})":`- [missing] {owner}.{port} "{title}" {path} (still available from commit {commit}: git show {commit}:{path})`,"Git の成果物はすべて見つかりました":`All Git artifacts were found`,"{count} 件を更新しました":`Updated {count} item(s)`,"判断待ち: 「{title}」 {question} (decision: {id})":`Needs decision: "{title}" {question} (decision: {id})`,"未回答の判断がありません (--id で指定)":`No unanswered decision (specify one with --id)`,"書き直せません (回答済み、または見つかりません)":`Cannot rewrite (already answered, or not found)`,"判断を書き直しました: 「{title}」 (decision: {id})":`Rewrote decision: "{title}" (decision: {id})`,"「{title}」に未確認の回答はありません":`"{title}" has no unacknowledged answers`,"回答を確認: 「{title}」":`Acknowledged answer: "{title}"`,未回答の判断がありません:`No unanswered decision`,"回答: 「{title}」 {answer}":`Answered: "{title}" {answer}`,"やり直せる判断 (回答済み) がありません":`No answered decision to reopen`,"やり直し: 「{title}」の判断を未回答に戻しました (前の答えは履歴に残ります)":`Reopened: the decision on "{title}" is unanswered again (the previous answer stays in the history)`,"日付は YYYY-MM-DD で指定してください: {value}":`Write dates as YYYY-MM-DD: {value}`,"更新: 「{title}」":`Updated: "{title}"`,"lang <ja|en> を指定してください":`Specify lang <ja|en>`,"言語: {lang}":`Language: {lang}`,"Web アプリが見つかりません: {dist} (npm run build で dist/ を作ってください)":`Web app not found: {dist} (run npm run build to create dist/)`,"[serve] ファイルの監視を始められません: {message}":`[serve] Cannot start watching the file: {message}`,"JSON ではありません":`Not JSON`,"(Ctrl+C で終了)":`(Ctrl+C to stop)`,"計画が他の変更で更新されています。最新の内容を読み直してからやり直してください (今回の変更は書き込んでいません)":`The plan changed. Reload its latest context and retry; your changes were not written.`,"他の Boxglow が計画ファイルに書き込み中です (ロック中)。終わってからやり直してください":`Another Boxglow writer holds the file lock. Retry after it finishes.`,不明:`unknown`,"{n} 秒前":`{n} s ago`,"対象: {file}":`File: {file}`,"ロックの持ち主: pid {pid} / マシン {host} / OS {platform} / 取得 {at} ({age})":`Lock owner: pid {pid} / host {host} / OS {platform} / taken {at} ({age})`,"判定: {reason}":`Verdict: {reason}`,"回収中、または回収の記録が残っています: pid {pid} / マシン {host} / OS {platform} ({reason})":`Recovery in progress, or a recovery marker remains: pid {pid} / host {host} / OS {platform} ({reason})`,"他の書き手が回収・解除の途中の可能性があり、解除の権利を取れませんでした。boxglow unlock で状態をもう一度確かめてください":`Another writer may be recovering or removing this lock; the right to remove it could not be taken. Check the status again with boxglow unlock`,"待っても解けないときは boxglow unlock で状態を確かめ、人に解除を頼んでください (AI は自分でロックを消さない)":`If waiting does not help, check it with boxglow unlock and ask a person to remove it (an agent never removes the lock itself)`,"持ち主の記録が無い、または読めません":`The owner record is missing or unreadable`,"旧版の Boxglow が取ったロックで、持ち主の環境を確かめられません":`Taken by an older Boxglow; the owner's environment cannot be verified`,"別のマシンの書き手のロックです (こちらからは生死を確かめられません)":`Held by a writer on another machine (its liveness cannot be checked from here)`,"マシン名は同じですが OS が違います (Windows と WSL など)。こちらからは持ち主の生死を確かめられません":`Same machine name but a different OS (for example Windows and WSL); the owner's liveness cannot be checked from here`,"プロセス番号の空間が違うか、確かめられません (別のコンテナ・再起動の前後など)":`The process-ID space differs or cannot be verified (another container, before/after a reboot, ...)`,持ち主のプロセスは終了しています:`The owner process has exited`,"持ち主のプロセスは終了しています (同じ番号で別のプロセスが動いています)":`The owner process has exited (another process now runs with the same pid)`,持ち主のプロセスは動いています:`The owner process is running`,"持ち主のプロセスはこのマシンに見つかりませんが、この OS では同じマシンのロックかを確かめられません":`The owner process was not found on this machine, but on this OS it cannot be verified that the lock was taken on this machine`,"ロックはありません: {path}":`No lock: {path}`,"持ち主が動いているので、解除できません。保存が終わるのを待つか、そのプロセスを止めてからもう一度確かめてください":`The owner is running, so the lock cannot be removed. Wait for the save to finish, or stop that process and check again`,"解除するには、この計画を開いている Boxglow (CLI・serve・VS Code。別の OS やマシンのものも含む) を止めてから、人が実行してください: boxglow unlock --remove --lock-token {token} --actor human":`To remove it, stop every Boxglow that has this plan open (CLI, serve, VS Code; including ones on another OS or machine), then a person runs: boxglow unlock --remove --lock-token {token} --actor human`,"ロックの解除は人が行います。AI は boxglow unlock の表示を人に見せて、解除を頼んでください (自分で --actor human を付けたり、ロックを直接消したりしない)":`Removing a lock is done by a person. An agent shows the boxglow unlock output and asks a person (never add --actor human yourself or delete the lock directly)`,"--lock-token <boxglow unlock が表示した印> を付けてください (表示のあとで別のロックに替わっていないかを確かめるため)":`Pass --lock-token <token shown by boxglow unlock> (it confirms the lock has not been replaced since it was shown)`,"ロックを解除しました: {path}":`Lock removed: {path}`,"表示のあとで別のロックに替わっています。boxglow unlock でもう一度確かめてください":`The lock was replaced after it was shown. Check again with boxglow unlock`,"先に boxglow context {block} を読み、--context-token <contextToken> を付けてやり直してください。指示・回答・引き継ぎが未読か、読んだ後に変更されています":`Read boxglow context {block}, then retry with --context-token <contextToken>. Instructions, answers or handoff notes are unread or changed.`,"guard on|off を指定してください":`Usage: boxglow guard on|off`,"確認トークンの要求 (guard): {state}":`Context guard: {state}`,"--note <分かったこと・次の手順・未解決の点> を指定してください":`checkpoint requires --note with findings, next steps and unresolved questions`,"引き継ぎメモを保存しました: {block}":`Checkpoint saved: {block}`,"新しい確認トークン: {token}":`New context token: {token}`,"AI が確認トークンの要求 (guard) を無効にするには --context-token <context で得た最新の確認トークン> が要ります。人が操作するときは --actor human を付けてください":`An AI needs --context-token <the latest context token from context> to turn the context guard off. If a person is running this, add --actor human`,"マージで片方が削除・片方が変更: {path} (変更された側を残しました。削除した側: {side})":`Merge: deleted on one side, changed on the other: {path} (kept the changed side. Deleted by: {side})`,自分:`ours`,相手:`theirs`,"、削除と変更の競合が {count} 件 (変更された側を残し、ログに記録)":`, {count} delete-versus-change conflict(s) (kept the changed side and recorded it in the log)`,"boxglow {version} (保存の取り決め {protocol})":`boxglow {version} (save protocol {protocol})`,"設定の形が正しくありません: {where}":`Invalid configuration: {where}`,"--agent は codex | claude-code | all のいずれかを指定してください":`--agent: codex | claude-code | all`,"Boxglow の印 (boxglow:begin / boxglow:end) が正しく対になっていません: {path}":`Invalid Boxglow markers (boxglow:begin / boxglow:end): {path}`,"階層の一覧を省く (判断・活動・次の候補は残す)":`Omit the full hierarchy; keep decisions, activity and next actions`,"作業の再開用の概要: 引き継ぎメモ・AI 未確認の回答・作業中・次の候補 (回答は確認済みにならない)":`Resume work: recent handoffs, unread human answers, active tasks and next candidates. Does not acknowledge answers.`,"ボックスのコンテキストを読む: 親と入力元の判断・入出力の条件・引き継ぎメモ。guard 付きの変更に使う contextToken を返す (自分の操作でコンテキストが変わると、その操作の出力に新しい確認トークンが出る)":`Read persistent task context, ancestor and upstream decisions, contracts and handoff notes. Returns contextToken for guarded changes (when your own command changes the context, its output ends with the new context token).`,"中断や引き継ぎの前に、分かったこと・次の手順・未解決の点を計画に残す":`Persist findings, next steps and unresolved questions before interruption or handoff.`,"計画が大きすぎます (上限 5 MiB)":`Project exceeds 5 MiB`,リクエストが中断されました:`Request aborted`,"信頼できない Host です":`Untrusted Host`,他のオリジンからのアクセスは受け付けません:`Cross-origin access denied`,他のサイトからのアクセスは受け付けません:`Cross-site access denied`,このメソッドは使えません:`Method not allowed`,"application/json で送ってください":`application/json required`,"先に計画を読み、その ETag を If-Match で送ってください":`Read the project first and send its ETag in If-Match`,"Boxglow の計画として正しくありません (形式・参照・つなぎ方)":`Invalid Boxglow project (schema, references or connections)`,このパスは配信できません:`Forbidden`,ローカルサーバでエラーが起きました:`Local server error`,"VS Code が編集を適用できませんでした。変更は図に残っています":`VS Code rejected the edit. Your changes remain in the diagram.`,"VS Code がファイルを保存できませんでした。再試行するか、変更を書き出してください":`VS Code could not save the file. Retry or export your changes.`,"保存の処理中です。もう一度やり直してください":`A save is already in progress. Retry.`,"確認トークン (guard) を有効にしました。AI は作業の前に boxglow context <ボックス> を読み、返ってきたトークンを --context-token で渡します。人の操作 (--actor human) には不要です。外すときは boxglow guard off --actor human":`Context guard enabled. Before working, an agent reads boxglow context <box> and passes the returned token with --context-token. People (--actor human) do not need one. To turn it off: boxglow guard off --actor human`},Cf={最終成果物:`Final deliverable`,"{name} の成果物":`{name} deliverable`,出力:`Output`,無題:`Untitled`,ポートが見つかりません:`Port not found`,同じポートどうしはつなげません:`A port cannot be connected to itself`,"線は出力ポート (または親の入力) から引いてください":`Start the edge from an output port (or the parent's input)`,"線は入力ポート (または親の出力) につないでください":`End the edge at an input port (or the parent's output)`,同じ階層のポートどうしだけつなげます:`Only ports on the same level can be connected`,循環する結線はできません:`Connections cannot form a cycle`,つなぐ先が見つかりません:`Connection target not found`,親に出力がありません:`The parent has no output`,"同じ階層のボックス (または親子) にだけつなげます":`Only boxes on the same level (or parent and child) can be connected`,"JSON として読めません":`Not valid JSON`,プロジェクトの形式ではありません:`Not a project file`,"対応していないデータ形式の版です (schemaVersion={version})":`Unsupported data format version (schemaVersion={version})`,"ブロック・ポート・線のデータが足りません":`Box, port, or edge data is missing`,"Boxglow のテンプレート (boxglow-block) ではありません":`Not a Boxglow template (boxglow-box)`,"入力グループの JSON (boxglow-input-group) ではありません":`Not an input group JSON (boxglow-input-group)`,"知らないカテゴリです: {key}":`Unknown category: {key}`,ブロックが見つかりません:`Box not found`,親ブロックが見つかりません:`Parent box not found`,"出力「{name}」がありません ({list})":`No output "{name}" ({list})`,"「{title}」の出力は 1 本にしました (下の階層を持たないボックスの出力は 1 本。{omitted} は省略)":`"{title}" was given a single output (a box with no children has one output; {omitted} omitted)`,ボックスが見つかりません:`Box not found`,"「{title}」に入力「{port}」がありません":`"{title}" has no input "{port}"`,"「{title}」に出力「{port}」がありません":`"{title}" has no output "{port}"`,"結線できません: {from} -> {to} ({why})":`Cannot connect: {from} -> {to} ({why})`,"「{title}」を追加":`Added "{title}"`,"「{title}」の進捗 {value}":`"{title}" progress {value}`,"「{title}」開始":`"{title}" started`,"「{title}」詰まり":`"{title}" blocked`,"「{title}」確認待ち":`"{title}" waiting for review`,"「{title}」判断待ち":`"{title}" needs a decision`,"「{title}」完了":`"{title}" done`,"「{title}」で判断待ち: {question}":`"{title}" needs a decision: {question}`,"「{title}」の判断: {question} → {answer}":`"{title}" decision: {question} → {answer}`,"「{title}」の判断の答えを直した: {question} → {answer}":`"{title}" decision answer revised: {question} → {answer}`,"「{title}」の判断をやり直し: {question} (前の答え: {answer}。理由: {note})":`"{title}" decision reopened: {question} (previous answer: {answer}; reason: {note})`,"「{title}」の判断をやり直し: {question} (前の答え: {answer})":`"{title}" decision reopened: {question} (previous answer: {answer})`,"「{title}」の回答を確認: {questions}":`"{title}" answers acknowledged: {questions}`,"「{title}」を {status} に":`"{title}" set to {status}`,"「{title}」を {count} 個に分解: {list}":`Split "{title}" into {count}: {list}`,"テンプレート「{name}」v{version} を挿入: {title}":`Inserted template "{name}" v{version}: {title}`,"「{title}」を「{parent}」の中へ移動":`Moved "{title}" into "{parent}"`,"入力グループ「{name}」を追加":`Added input group "{name}"`,"「{title}」{detail}":`"{title}" {detail}`,"開始 {date}":`Start {date}`,"実績 {hours}h":`Actual {hours}h`,"見積 {hours}h":`Estimate {hours}h`,なし:`none`,"{key} に振り直し":`renumbered to {key}`,"作業の前に boxglow context <block> を読み、guard 付きの変更にはその contextToken を使ってください。この概要は回答を確認済みにせず、操作を許可するものでもありません。":`Read boxglow context <block> before work; use its contextToken for guarded changes. This overview does not acknowledge answers or authorize actions.`,"使えないキーです: {key}":`Reserved key: {key}`,"最上位のボックス (root) がありません":`Missing root block`,"ボックスの参照が正しくありません: {id}":`Invalid block reference: {id}`,"ボックスの親子が循環しています: {id}":`Parent cycle: {id}`,"階層が深すぎます (256 段まで)":`Hierarchy exceeds 256 levels`,"入出力の参照が正しくありません: {id}":`Invalid port reference: {id}`,"線の参照が正しくありません: {id}":`Invalid edge reference: {id}`,"線のつなぎ方が正しくありません: {id}: {reason}":`Invalid connection: {id}: {reason}`,"線の種類が正しくありません: {id}":`Invalid edge kind: {id}`},wf={"階層は省略しています。全体は `boxglow status`、ボックスの詳細は `boxglow show <block>` で確認できます。":"Hierarchy omitted. Use `boxglow status` for the full tree or `boxglow show <block>` for details.","「{title}」":`"{title}"`,"、":`, `,"テンプレート: {name}":`Template: {name}`,"(未担当)":`(unassigned)`,"(超過)":`(overdue)`,"完了 {white} / {total} ・ 進捗 {percent}% (BlackBox {black}, GrayBox {gray}, WhiteBox {white})":`Done {white} / {total} · progress {percent}% (BlackBox {black}, GrayBox {gray}, WhiteBox {white})`,"最終成果物: {names}":`Final deliverables: {names}`,"(未設定)":`(not set)`,"プロジェクトの入力: {names}":`Project inputs: {names}`,"(なし)":`(none)`,"入力グループ「{name}」: {names}":`Input group "{name}": {names}`,"(空)":`(empty)`,"判断待ち (人間の回答が必要)":`Needs decision (a human must answer)`,"選択肢: {options}":`Options: {options}`,"判断材料: {text}":`Context: {text}`,"回答あり (人が答えた判断。読んだら `boxglow ack <block>` で引き取る。そのボックスの start / done などでも引き取られる)":"Answered (decisions a human has answered. After reading, acknowledge with `boxglow ack <block>`; start / done etc. on that box also acknowledge them)",期日超過:`Overdue`,"詰まり・確認待ち":`Blocked / in review`,"階層 ([ ] New / [~] In Progress / [x] Done。B 番号はボックスの ID。出力名の * は成果物あり)":`Tree ([ ] New / [~] In Progress / [x] Done. B numbers are box IDs. * after an output name = has a deliverable)`,"次の候補 (未着手の New。必須の入力がそろっているものから)":`Next candidates (New boxes not started yet; those with all required inputs ready come first)`,"(必須の入力待ち: {names})":`(waiting for required inputs: {names})`,"(着手できる)":`(ready to start)`,"状態: {status}":`Status: {status}`,"(進捗 {percent}%)":`(progress {percent}%)`,"課題: {key}":`Issue: {key}`,"日程:":`Schedule:`,"時間:":`Hours:`,"活動:":`Activity:`,入力:`Input`,"(未接続)":`(not connected)`,"成果物: {list}":`Deliverables: {list}`,下の階層:`Children`,判断:`Decisions`,"[未回答]":`[open]`,"[回答済]":`[answered]`,"候補: {list}":`Candidates: {list}`,"残した候補: {list}":`Kept candidates: {list}`,"以前の答え: {answer}":`Previous answer: {answer}`,資料:`Links`,"(ログはまだありません)":`(no log entries yet)`,"供給元: {list}":`from: {list}`,"行き先: {list}":`to: {list}`,プロジェクトの入力:`Project input`,プロジェクトの出力:`Project output`,"プロジェクト: {name}":`Project: {name}`,"担当: {names}":`Assignees: {names}`,"進捗: 下の階層 {white}/{total} が完了":`Progress: {white}/{total} children done`,"判断:":`Decisions:`,"(未回答)":`(unanswered)`,"。残した候補: {list}":`. Kept candidates: {list}`,"。以前の答え: {list}":`. Previous answers: {list}`,"{n} 件":`{n}`,関連資料:`Related links`,"全体の進捗: {white}/{total} ブロックが完了 (BlackBox {black} / GrayBox {gray} / WhiteBox {white})":`Overall progress: {white}/{total} boxes done (BlackBox {black} / GrayBox {gray} / WhiteBox {white})`,"ブロックは「入力から出力を作るタスク」。BlackBox は出力だけ決まっていて中身が未定、GrayBox は分解中・着手中、WhiteBox は完了。":`A box is "a task that turns inputs into an output". BlackBox: only the output is decided, the inside is not; GrayBox: being broken down or worked on; WhiteBox: done.`,"New (BlackBox: 出力だけ決めてある)":`New (BlackBox: only the output is decided)`,"In Progress (GrayBox: 分解中・作業中)":`In Progress (GrayBox: being broken down or worked on)`,"Done (WhiteBox: 出力に成果物が付いて完了)":`Done (WhiteBox: the output has its deliverable)`,"依頼: {title}":`Request: {title}`,"このタスクは「{chain}」の中の 1 ブロックです。ブロックは「入力から出力を作る作業」で、出力の成果物が確定したら完了 (WhiteBox) になります。":`This task is one box inside "{chain}". A box is "work that turns inputs into an output"; it is done (WhiteBox) once the output's deliverable is settled.`,同じ階層の他のブロック:`Other boxes on the same level`,現在の下の階層:`Current children`,お願い:`What I need`,"上の入力から出力を得るための手順を提案してください。前提が足りなければ、追加で必要な入力を挙げてください。":`Propose the steps to get from the inputs above to the output. If something is missing, list the additional inputs you need.`,"このブロックを、入力と出力を持つ小さなブロックに分解してください。次の JSON 形式で答えてください。":`Break this box down into smaller boxes, each with inputs and outputs. Answer in the following JSON format.`,ブロック名:`Box name`,やること:`What to do`,入力名:`Input name`,出力名:`Output name`,"入力と出力の定義に抜けや曖昧さがないか指摘してください。出力が「確定した」と言える条件も提案してください。":`Point out any gaps or ambiguity in the input and output definitions. Also propose the conditions under which the output can be called "settled".`,"(出力なし)":`(no output)`,"ボックスの B 番号 (B12) か題名":`The box's B number (B12) or title`,"計画の今の状況: 判断待ち・作業中・次の候補・階層の一覧 (セッションの最初に読む)":`Current state of the plan: pending decisions, work in progress, next candidates and the tree (read this first in every session)`,"ボックスの詳細 (入出力・線・判断・成果物)":`Details of a box (inputs, outputs, wires, decisions, deliverables)`,"ボックスを足す。出力 (成果物の名前) を必ず決める。parent を省くと最初のプロジェクトのボックスの直下 (大項目) に入る":`Add a box. Always decide its output (the name of the deliverable). Without parent, it goes directly under the first project box (as a top-level item)`,"出力の名前 (具体的な成果物: ファイル・URL・PR)":`Output name (a concrete deliverable: file, URL, PR)`,入力の名前:`Input names`,'大きいボックスを中のボックスに分解する。spec は { blocks: [{ title, inputs?: [名前], outputs: [名前] }], connections: [{ from: "A.出力名", to: "B" }] } の形 (to は題名だけでよい: 出力名と同じ入力が作られる。親の入力からは from: "parent.入力名"、親の出力へは to: "parent.出力名")':`Split a large box into inner boxes. spec has the form { boxes: [{ title, inputs?: [name], outputs: [name] }], connections: [{ from: "A.outputName", to: "B" }] } (to can be just a title: an input with the same name as the output is created. From the parent's input use from: "parent.inputName"; to the parent's output use to: "parent.outputName")`,"分解の指定 (JSON)":`Split spec (JSON)`,"線をつなぐ: <題名.出力名> から <題名> へ (受け側は題名だけでよい。出力名と同じ名前の入力が作られる。<題名.入力名> で既存の入力を指定してもよい。親の入力は project.入力名、親の出力へは 題名.出力名 -> project)":`Connect a wire: from <title.outputName> to <title> (the receiving side can be just a title; an input with the same name as the output is created. <title.inputName> selects an existing input. The parent's input is project.inputName; to the parent's output use title.outputName -> project)`,線を外す:`Remove a wire`,"ボックスに入力 / 出力を足す、名前を変える":`Add inputs / outputs to a box, or rename one`,"旧=新":`old=new`,"ボックスを別の親の中へ移す (線はつなぎ直される)":`Move a box into another parent (wires are reconnected)`,"移す先のボックスか project":`Destination box, or project`,"ボックスを消す (中にボックスがあれば force)":`Remove a box (force if it has boxes inside)`,"作業を始める (作業中の札が付く)。同時に作業中にするボックスは 1〜2 個まで":`Start work (the box gets a Working tag). Keep at most 1-2 boxes in progress at a time`,何をするか:`What you will do`,"完了にする。成果物 (名前=パスか URL) を付ける。Git のファイルなら commit+path+blob が記録される":`Mark as done. Attach deliverables (name=path or URL). For files in Git, commit+path+blob is recorded`,"名前=パス または 名前=URL":`name=path or name=URL`,出力の名前を変えるとき:`To rename the output`,"詰まった (困っていることを書いて他のボックスへ移る)":`Boxed (write what is in the way and move on to another box)`,"人の判断が要る質問を残す (選択肢付き)。質問だけで判断できるように、前提・比較・影響を context に書く。AI が自分で選ぶときも ask して answer (by=claude-code) で記録する":`Leave a question that needs a human decision (with options). Put the premises, comparison and impact in context so the question can be decided on its own. When the AI chooses by itself, also ask and then record it with answer (by=claude-code)`,"判断に答える (人がチャットで答えたら by=human で記録)":`Answer a decision (if a human answered in chat, record it with by=human)`,"human / claude-code など":`human / claude-code etc.`,"人の回答を読んで引き取ったと記録する (status の「回答あり」から消える)":`Record that you have read a human's answer (it leaves "Answered" in status)`,"decision id (省略するとそのボックスの未確認の回答すべて)":`decision id (if omitted, all unacknowledged answers on that box)`,"判断をやり直す (前の答えは履歴に残る)":`Reopen a decision (the previous answer stays in the history)`,"ボックスの属性を変える (題名・メモ・カテゴリ・期日・リポジトリ・課題 URL)":`Change a box's attributes (title, note, category, due date, repository, issue URL)`,"計画を Markdown に書き出す (docs/ROADMAP.md など)":`Export the plan as Markdown (e.g. docs/ROADMAP.md)`,"計画の問題 (つながっていない入出力など) を検査する":`Check the plan for problems (e.g. unconnected inputs / outputs)`,'そのほかの CLI コマンドをそのまま実行する (例: ["log", "--n", "20"]、["layout"]、["help"])':`Run any other CLI command as is (e.g. ["log", "--n", "20"], ["layout"], ["help"])`},Tf={..._f,...vf,...yf,...bf,...xf,...Sf,...Cf,...wf,...gf,...hf},Ef=`boxglow:lang`,Df=new Set,Of=kf();function kf(){if(typeof window>`u`)return`ja`;try{let e=new URLSearchParams(window.location.search).get(`lang`);if(e===`en`||e===`ja`)return e;let t=localStorage.getItem(Ef);if(t===`en`||t===`ja`)return t}catch{}return(typeof navigator<`u`?navigator.language:`ja`).toLowerCase().startsWith(`ja`)?`ja`:`en`}var Af=()=>Of;function jf(e){if(e!==Of){Of=e;try{localStorage.setItem(Ef,e)}catch{}typeof document<`u`&&(document.documentElement.lang=e);for(let e of Df)e()}}function Mf(e){return Df.add(e),()=>{Df.delete(e)}}function q(e,t){let n=Of===`en`?Tf[e]??e:e;return t?n.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e):n}typeof document<`u`&&(document.documentElement.lang=Of);var Nf=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Pf=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Nf[n[e]&63];return t},Ff=`root`,If=()=>Pf(10),Lf=()=>new Date().toISOString(),Rf=e=>structuredClone(e);function zf(e){let t=e.nextKey??1;return e.nextKey=t+1,`B${t}`}function Bf(e){let t=new Set;for(let n of Object.values(e.blocks))n.key&&t.add(n.key);let n=e.nextKey??1;for(let r of Object.values(e.blocks))if(!(r.id===`root`||r.key)){for(;t.has(`B${n}`);)n++;r.key=`B${n}`,t.add(r.key),n++}e.nextKey=Math.max(n,e.nextKey??1)}var Vf={left:120,top:76},Hf=60;function Uf(e,t){let n=e.blocks[t];return n?Hf+(Math.min(3,Math.max(1,Math.ceil(n.title.length*14/400)))-1)*18+16:Vf.top}function Wf(e){let t=Lf(),n={id:Ff,parentId:null,title:e,description:``,status:`black`,assigneeIds:[],position:{x:0,y:0},collapsed:!1,artifacts:[],activity:null,decisions:[]},r={id:If(),blockId:Ff,direction:`out`,name:q(`最終成果物`),description:``,required:!0,artifacts:[]};return Gf({schemaVersion:5,id:If(),name:e,description:``,createdAt:t,visibility:`private`,members:[],blocks:{[Ff]:n},ports:{[r.id]:r},edges:{},terminals:{in:{x:0,y:200},out:{x:1100,y:200}},log:[],agents:{},nextKey:1},e).project}function Gf(e,t){let n=Rf(e),r=J(n),i=If(),a=r.length===0?40:Math.max(...r.map(e=>e.position.y))+400;n.blocks[i]={id:i,key:zf(n),kind:`project`,parentId:Ff,title:t,description:``,status:`black`,assigneeIds:[],position:{x:300,y:a},collapsed:!1,artifacts:[],activity:null,decisions:[]};let o={id:If(),blockId:i,direction:`out`,name:q(`最終成果物`),description:``,required:!0,artifacts:[]};n.ports[o.id]=o;let s=Y(n,Ff,`out`).find(e=>sp(n,{portId:e.id,side:`inner`}).length===0);s||(s={id:If(),blockId:Ff,direction:`out`,name:r.length===0?q(`最終成果物`):q(`{name} の成果物`,{name:t}),description:``,required:!0,artifacts:[]},n.ports[s.id]=s);let c=If();return n.edges[c]={id:c,from:{portId:o.id,side:`outer`},to:{portId:s.id,side:`inner`},kind:`up`,auto:!1},{project:n,blockId:i}}function J(e){return rp(e,Ff).filter(e=>e.kind===`project`)}function Kf(e){return J(e)[0]?.id??`root`}function qf(e){let t=J(e),n=t.length>0?t.map(e=>e.id):[Ff],r=[];for(let t of n)r.push(...rp(e,t).filter(e=>$f(e)!==`project`));return r.sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x)}function Jf(e,t){let n=new Set(qf(e).map(e=>e.id)),r=t;for(;r!==null;){if(n.has(r))return r;r=e.blocks[r]?.parentId??null}return null}function Yf(e,t,n){let r=n;for(;r!==null;){if(r===t)return!0;r=e.blocks[r]?.parentId??null}return!1}function Xf(e){let t=qf(e).filter(e=>!e.collapsed).map(e=>e.id);if(t.length===0)return e;let n={...e.blocks};for(let e of t)n[e]={...n[e],collapsed:!0};return{...e,blocks:n}}function Zf(e,t){let n=Jf(e,t);return n&&n!==t?n:null}function Qf(e,t){let n=[],r=t;for(;r!==null&&r!==`root`;){let t=e.blocks[r];if(!t||$f(t)===`project`)break;n.unshift(t),r=t.parentId}return n}var $f=e=>e.kind??`task`;function ep(e,t=``){return{id:If(),title:e,url:t,kind:t?`url`:`note`,note:``}}var tp=null;function np(e,t,n={}){let r=new Map;for(let t of Object.values(e.ports)){let e=r.get(t.blockId)??[];e.push(t),r.set(t.blockId,e)}let i=new Map;if(n.children!==!1)for(let t of Object.values(e.blocks)){if(t.parentId===null)continue;let e=i.get(t.parentId)??[];e.push(t),i.set(t.parentId,e)}let a=tp;tp={ports:e.ports,portsByBlock:r,blocks:n.children===!1?null:e.blocks,kidsByParent:i};try{return t()}finally{tp=a}}function rp(e,t){return tp&&tp.blocks===e.blocks?(tp.kidsByParent.get(t)??[]).slice():Object.values(e.blocks).filter(e=>e.parentId===t)}function ip(e,t){let n=[],r=[t];for(;r.length>0;){let t=r.pop();for(let i of rp(e,t))n.push(i),r.push(i.id)}return n}function ap(e,t){let n=[],r=e.blocks[t]?.parentId??null;for(;r!==null;){let t=e.blocks[r];if(!t)break;n.push(t),r=t.parentId}return n}function Y(e,t,n){if(tp&&tp.ports===e.ports){let e=tp.portsByBlock.get(t)??[];return n===void 0?e.slice():e.filter(e=>e.direction===n)}return Object.values(e.ports).filter(e=>e.blockId===t&&(n===void 0||e.direction===n))}var op=(e,t)=>e.portId===t.portId&&e.side===t.side;function sp(e,t){return Object.values(e.edges).filter(e=>op(e.to,t))}function cp(e,t){return Object.values(e.edges).filter(e=>op(e.from,t))}function lp(e,t){let n=e.ports[t.portId];if(!n)return null;let r=e.blocks[n.blockId];return r?t.side===`inner`?r.id:r.parentId:null}function up(e,t){return ap(e,t).some(e=>e.collapsed)}function dp(e,t,n){let r=e.ports[t.portId],i=e.ports[n.portId];if(!r||!i)return{ok:!1,reason:q(`ポートが見つかりません`)};if(t.portId===n.portId)return{ok:!1,reason:q(`同じポートどうしはつなげません`)};let a=r.direction===`out`&&t.side===`outer`||r.direction===`in`&&t.side===`inner`,o=i.direction===`in`&&n.side===`outer`||i.direction===`out`&&n.side===`inner`;if(!a)return{ok:!1,reason:q(`線は出力ポート (または親の入力) から引いてください`)};if(!o)return{ok:!1,reason:q(`線は入力ポート (または親の出力) につないでください`)};let s=lp(e,t),c=lp(e,n);if(s===null||c===null||s!==c)return{ok:!1,reason:q(`同じ階層のポートどうしだけつなげます`)};let l;return l=r.direction===`out`&&i.direction===`in`?`sibling`:r.direction===`out`&&i.direction===`out`?`up`:r.direction===`in`&&i.direction===`in`?`down`:`through`,l===`sibling`&&fp(e,r.blockId,i.blockId)?{ok:!1,reason:q(`循環する結線はできません`)}:{ok:!0,kind:l}}function fp(e,t,n){if(t===n)return!0;let r=new Set,i=[n];for(;i.length>0;){let n=i.pop();if(n===t)return!0;if(!r.has(n)){r.add(n);for(let t of Y(e,n,`out`))for(let n of cp(e,{portId:t.id,side:`outer`})){if(n.kind!==`sibling`)continue;let t=e.ports[n.to.portId]?.blockId;t&&i.push(t)}}}return!1}function pp(e){return Rf(e)}function mp(e,t){let n=pp(e),r=If(),i=rp(n,t.parentId),a;a=t.parentId===`root`?i.length===0?{x:260,y:80}:{x:Math.max(...i.map(e=>e.position.x))+300,y:80}:i.length===0?{x:Vf.left,y:Uf(e,t.parentId)}:{x:Vf.left,y:Math.max(...i.map(e=>e.position.y))+110},n.blocks[r]={id:r,key:zf(n),parentId:t.parentId,title:t.title,description:``,status:`black`,assigneeIds:[],position:t.position??a,collapsed:!1,artifacts:[],activity:null,decisions:[]};let o={id:If(),blockId:r,direction:`out`,name:t.outputName??q(`出力`),description:``,required:!0,artifacts:[]};n.ports[o.id]=o,t.actor&&Gp(n,{actor:t.actor,kind:`added`,blockId:r,message:q(`「{title}」を追加`,{title:t.title})});let s=n.blocks[t.parentId];return s&&s.id!==`root`&&s.status===`black`&&(s.status=`gray`),{project:Mp(n),blockId:r}}function hp(e,t,n){let r=pp(e),i=r.blocks[t];return i?(Object.assign(i,n),r):e}function gp(e,t,n){let r=Rf(e),i=r.blocks[t];return i?(i.position=i.parentId!==null&&i.parentId!==`root`?{x:Math.max(Vf.left,n.x),y:Math.max(Uf(r,i.parentId),n.y)}:n,r):e}function _p(e,t,n){let r=Rf(e);return r.terminals[t]=n,r}function vp(e,t){if(t===`root`)return e;let n=pp(e),r=new Set([t,...ip(n,t).map(e=>e.id)]),i=new Set(Object.values(n.ports).filter(e=>r.has(e.blockId)).map(e=>e.id));for(let e of Object.values(n.edges))(i.has(e.from.portId)||i.has(e.to.portId))&&delete n.edges[e.id];for(let e of i)delete n.ports[e];for(let e of r)delete n.blocks[e];if(n.handoffs){let e=Object.fromEntries(Object.entries(n.handoffs).filter(([e])=>!r.has(e)));Object.keys(e).length>0?n.handoffs=e:delete n.handoffs}return Mp(n)}function yp(e,t){if(t.direction===`out`&&t.blockId!==`root`&&!Sp(e,t.blockId))return{project:e,portId:Y(e,t.blockId,`out`)[0]?.id??``};let n=pp(e),r=If();return n.ports[r]={id:r,blockId:t.blockId,direction:t.direction,name:t.name,description:``,required:!0,artifacts:[]},t.direction===`out`&&$f(n.blocks[t.blockId])===`project`&&bp(n,r),{project:Mp(n),portId:r}}function bp(e,t){let n=e.ports[t];if(!n||n.direction!==`out`||Object.values(e.edges).some(n=>n.from.portId===t&&n.from.side===`outer`&&e.ports[n.to.portId]?.blockId===`root`))return;let r={id:If(),blockId:Ff,direction:`out`,name:n.name,description:n.description,required:!0,artifacts:[]};e.ports[r.id]=r;let i=If();e.edges[i]={id:i,from:{portId:t,side:`outer`},to:{portId:r.id,side:`inner`},kind:`up`,auto:!0}}function xp(e,t){let n=Object.values(e.edges).find(n=>n.from.portId===t&&n.from.side===`outer`&&e.ports[n.to.portId]?.blockId===`root`);return n?e.ports[n.to.portId]??null:null}function Sp(e,t){return $f(e.blocks[t])===`project`||t===`root`||Y(e,t,`out`).length===0||rp(e,t).length>0}function Cp(e,t,n){let r=pp(e),i=r.ports[t];if(!i)return e;let a=i.name;if(n.name!==void 0&&Tp(r,t)&&(n={...n,name:void 0}),Object.assign(i,Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0))),n.name!==void 0&&i.direction===`out`&&$f(r.blocks[i.blockId])===`project`){let e=xp(r,t);e&&(e.name=n.name)}return n.name!==void 0&&n.name!==a&&Ep(r,t,a,n.name),r}function wp(e){let t=new Map;for(let n of Object.values(e.edges)){if(n.auto)continue;let r=e.ports[n.to.portId];r&&r.direction===`in`&&n.to.side===`outer`&&t.set(r.id,n.from.portId)}let n=new Map,r=(i,a=new Set)=>{if(n.has(i))return n.get(i);let o=e.ports[i];if(!o)return``;let s=t.get(i),c=o.name;if(s&&!a.has(i)){a.add(i);let e=r(s,a);e&&(c=e)}return n.set(i,c),c},i=null,a=0;for(let n of t.keys()){let t=r(n);t&&e.ports[n].name!==t&&(i||=pp(e),i.ports[n].name=t,a++)}return{project:i??e,renamed:a}}function Tp(e,t){let n=e.ports[t];return!n||n.direction!==`in`?!1:sp(e,{portId:t,side:`outer`}).some(e=>!e.auto)}function Ep(e,t,n,r,i=new Set){if(!i.has(t)){i.add(t);for(let a of Object.values(e.edges)){if(a.from.portId!==t)continue;let o=e.ports[a.to.portId];if(o&&o.name===n){if(o.name=r,o.direction===`out`&&$f(e.blocks[o.blockId])===`project`){let t=xp(e,o.id);t&&(t.name=r)}Ep(e,o.id,n,r,i)}}}}function Dp(e,t){let n=e.ports[t];if(!n||n.promotedFrom)return e;let r=pp(e);if(n.direction===`out`&&$f(r.blocks[n.blockId])===`project`){let e=xp(r,t);if(e){for(let t of Object.values(r.edges))(t.from.portId===e.id||t.to.portId===e.id)&&delete r.edges[t.id];delete r.ports[e.id]}}for(let e of Object.values(r.edges))(e.from.portId===t||e.to.portId===t)&&delete r.edges[e.id];return delete r.ports[t],Mp(r)}function Op(e,t,n){let r=dp(e,t,n);if(!r.ok)return{project:e,error:r.reason};let i=pp(e);for(let e of sp(i,n))delete i.edges[e.id];let a=If();i.edges[a]={id:a,from:t,to:n,kind:r.kind,auto:!1};let o=i.ports[t.portId],s=i.ports[n.portId];if(o&&s&&s.direction===`in`&&n.side===`outer`&&s.name!==o.name){let e=s.name;s.name=o.name,Ep(i,s.id,e,o.name)}return{project:Mp(i),edgeId:a}}function kp(e,t){if(!e.edges[t])return e;let n=pp(e);return delete n.edges[t],Mp(n)}function Ap(e,t,n){let r=pp(e),i={id:If(),name:t,color:n};return r.members.push(i),{project:r,memberId:i.id}}function jp(e,t){let n=pp(e);n.members=n.members.filter(e=>e.id!==t);for(let e of Object.values(n.blocks))e.assigneeIds=e.assigneeIds.filter(e=>e!==t);return n}function Mp(e){let t=Rf(e);for(let e=0;e<64;e++){let e=!1;for(let n of Object.values(t.edges))n.auto&&sp(t,n.to).some(e=>!e.auto)&&(delete t.edges[n.id],e=!0);for(let n of Object.values(t.ports))if(n.promotedFrom&&!(cp(t,{portId:n.id,side:`inner`}).length>0)){for(let e of Object.values(t.edges))(e.from.portId===n.id||e.to.portId===n.id)&&delete t.edges[e.id];delete t.ports[n.id],e=!0}for(let n of Object.values(t.ports)){if(!n.promotedFrom||!t.ports[n.id])continue;let r=Object.values(t.ports).find(e=>e.id!==n.id&&e.blockId===n.blockId&&e.direction===`in`&&e.promotedFrom&&e.name===n.name);if(r){for(let e of Object.values(t.edges))e.from.portId===r.id&&(e.from={...e.from,portId:n.id}),e.to.portId===r.id&&(e.to={...e.to,portId:n.id});delete t.ports[r.id],e=!0}}for(let n of Object.values(t.ports)){if(n.direction!==`in`)continue;let r=t.blocks[n.blockId];if(!r||r.parentId===null||sp(t,{portId:n.id,side:`outer`}).length>0)continue;let i=Object.values(t.ports).find(e=>e.blockId===r.parentId&&e.direction===`in`&&e.promotedFrom&&e.name===n.name);i||(i={id:If(),blockId:r.parentId,direction:`in`,name:n.name,description:n.description,required:n.required,artifacts:[],promotedFrom:n.id},t.ports[i.id]=i);let a=If();t.edges[a]={id:a,from:{portId:i.id,side:`inner`},to:{portId:n.id,side:`outer`},kind:`down`,auto:!0},e=!0}if(!e)break}return t}function Np(e,t){let n=e.blocks[t];if(!n)return 0;if(n.status===`white`)return 100;if(typeof n.progress==`number`)return Math.max(0,Math.min(100,n.progress));let r=rp(e,t);return r.length===0?0:Math.round(r.reduce((t,n)=>t+Np(e,n.id),0)/r.length)}function Pp(e,t){let n=ip(e,t).filter(e=>$f(e)!==`project`),r=n.length>0?n:t===`root`?[]:[e.blocks[t]].filter(e=>e&&$f(e)!==`project`),i=e=>r.filter(t=>t.status===e).length,a=i(`white`),o=r.length,s=t===`root`?(()=>{let t=J(e);return t.length===0?0:Math.round(t.reduce((t,n)=>t+Np(e,n.id),0)/t.length)})():Np(e,t);return{total:o,white:a,gray:i(`gray`),black:i(`black`),ratio:o===0?0:a/o,percent:s}}function Fp(e,t,n,r){let i=e.blocks[t];if(!i)return e;let a=pp(e);return n===null?delete a.blocks[t].progress:a.blocks[t].progress=Math.max(0,Math.min(100,Math.round(n))),n!==null&&i.status===`black`&&n>0&&(a.blocks[t].status=`gray`),Gp(a,{actor:r,kind:`note`,blockId:t,message:q(`「{title}」の進捗 {value}`,{title:i.title,value:n===null?q(`自動`):n+`%`})}),a}function Ip(e,t,n=new Set){if(n.has(t))return!1;let r=e.ports[t];if(!r||r.direction!==`in`)return!1;if(r.artifacts.length>0)return!0;let i=new Set(n).add(t);return cp(e,{portId:t,side:`inner`}).some(t=>t.auto&&Ip(e,t.to.portId,i))}function Lp(e,t,n=new Set){let r=`${t.portId}:${t.side}`;if(n.has(r))return!1;let i=e.ports[t.portId];if(!i)return!1;let a=new Set(n).add(r),o=t.side===`outer`?`inner`:`outer`,s=sp(e,{portId:i.id,side:o});return s.length>0?s.every(t=>Lp(e,t.from,a)):i.direction===`in`?Ip(e,i.id):i.artifacts.length>0||i.direction===`out`&&e.blocks[i.blockId]?.status===`white`}function Rp(e,t){return Lp(e,t.from)}function zp(e,t){let n=e.ports[t];return!!n&&n.direction===`in`&&Lp(e,{portId:t,side:`inner`})}function Bp(e,t){return Y(e,t,`in`).filter(t=>t.required&&!zp(e,t.id))}function Vp(e,t){let n=e.blocks[t];if(!n||n.status===`white`||rp(e,t).some(e=>e.status!==`white`))return!1;let r=Y(e,t,`out`);return r.length>0&&r.every(e=>e.artifacts.length>0)}function Hp(e){let{updatedAt:t,version:n,...r}=e;return JSON.stringify(r,null,2)}function Up(e){let t;try{t=JSON.parse(e)}catch{throw Error(q(`JSON として読めません`))}if(typeof t!=`object`||!t)throw Error(q(`プロジェクトの形式ではありません`));let n=t,r=Number(n.schemaVersion);if(![1,2,3,4,5].includes(r))throw Error(q(`対応していないデータ形式の版です (schemaVersion={version})`,{version:String(n.schemaVersion)}));if(!n.blocks||!n.ports||!n.edges||!n.blocks.root)throw Error(q(`ブロック・ポート・線のデータが足りません`));let i={schemaVersion:5,id:typeof n.id==`string`?n.id:If(),name:typeof n.name==`string`?n.name:q(`無題`),description:typeof n.description==`string`?n.description:``,createdAt:typeof n.createdAt==`string`?n.createdAt:Lf(),visibility:n.visibility??`private`,members:Array.isArray(n.members)?n.members:[],blocks:n.blocks,ports:n.ports,edges:n.edges,terminals:n.terminals??{in:{x:0,y:200},out:{x:1100,y:200}},log:Array.isArray(n.log)?n.log:[],agents:n.agents&&typeof n.agents==`object`?n.agents:{},nextKey:typeof n.nextKey==`number`?n.nextKey:1,inputGroups:Array.isArray(n.inputGroups)?n.inputGroups:[]};typeof n.contextGuard==`boolean`&&(i.contextGuard=n.contextGuard),n.handoffs&&typeof n.handoffs==`object`&&(i.handoffs=n.handoffs),(n.lang===`en`||n.lang===`ja`)&&(i.lang=n.lang);for(let e of Object.values(i.ports))e.groupId&&!i.inputGroups.some(t=>t.id===e.groupId)&&delete e.groupId;for(let e of Object.values(i.blocks))e.activity===void 0&&(e.activity=null),Array.isArray(e.decisions)||(e.decisions=[]),Array.isArray(e.artifacts)||(e.artifacts=[]),Array.isArray(e.assigneeIds)||(e.assigneeIds=[]),e.progress!==void 0&&typeof e.progress!=`number`&&delete e.progress;if(r<4)for(let e of Object.values(i.ports))e.direction===`in`&&(e.required=!0);Bf(i);for(let e of Object.values(i.ports))i.blocks[e.blockId]||delete i.ports[e.id];for(let e of Object.values(i.edges))(!i.ports[e.from.portId]||!i.ports[e.to.portId])&&delete i.edges[e.id];return Mp(Wp(i))}function Wp(e){let t=rp(e,Ff).filter(e=>$f(e)!==`project`);if(t.length===0)return e;let n=Rf(e),r=If();n.blocks[r]={id:r,key:zf(n),kind:`project`,parentId:Ff,title:n.name,description:n.description,status:`gray`,assigneeIds:[],position:{x:300,y:40},collapsed:!1,artifacts:[],activity:null,decisions:[]};let i=Math.min(...t.map(e=>e.position.x)),a=Math.min(...t.map(e=>e.position.y));for(let e of t)n.blocks[e.id].parentId=r,n.blocks[e.id].position={x:e.position.x-i+Vf.left,y:e.position.y-a+Uf(n,r)};for(let e of Object.values(n.edges)){let t=n.ports[e.to.portId],i=n.ports[e.from.portId];if(t&&i){if(e.kind===`up`&&t.blockId===`root`&&e.to.side===`inner`){let i=Y(n,r,`out`).find(e=>e.name===t.name);if(!i){i={id:If(),blockId:r,direction:`out`,name:t.name,description:t.description,required:!0,artifacts:[]},n.ports[i.id]=i;let e=If();n.edges[e]={id:e,from:{portId:i.id,side:`outer`},to:{portId:t.id,side:`inner`},kind:`up`,auto:!1}}e.to={portId:i.id,side:`inner`}}if(e.kind===`down`&&i.blockId===`root`&&e.from.side===`inner`){if(e.auto){delete n.edges[e.id];continue}let t=Y(n,r,`in`).find(e=>e.name===i.name);if(!t){t={id:If(),blockId:r,direction:`in`,name:i.name,description:i.description,required:i.required,artifacts:[]},n.ports[t.id]=t;let e=If();n.edges[e]={id:e,from:{portId:i.id,side:`inner`},to:{portId:t.id,side:`outer`},kind:`down`,auto:!1}}e.from={portId:t.id,side:`inner`}}}}for(let e of Y(n,Ff,`in`))e.promotedFrom&&delete n.ports[e.id];for(let e of Object.values(n.edges))(!n.ports[e.from.portId]||!n.ports[e.to.portId])&&delete n.edges[e.id];if(Y(n,r,`out`).length===0){let e={id:If(),blockId:r,direction:`out`,name:q(`最終成果物`),description:``,required:!0,artifacts:[]};n.ports[e.id]=e;let t=Y(n,Ff,`out`)[0];if(t&&sp(n,{portId:t.id,side:`inner`}).length===0){let r=If();n.edges[r]={id:r,from:{portId:e.id,side:`outer`},to:{portId:t.id,side:`inner`},kind:`up`,auto:!1}}}return n}function Gp(e,t){e.log.push({id:If(),at:Lf(),...t}),e.log.length>500&&e.log.splice(0,e.log.length-500),e.agents[t.actor]={lastSeen:Lf()}}function Kp(e,t,n,r,i){let a=pp(e),o=a.blocks[t];return!o||t===`root`?e:(o.activity={actor:n,state:r,note:i,since:Lf()},r===`working`&&o.status===`black`&&(o.status=`gray`),Gp(a,{actor:n,kind:r===`working`?`started`:r===`blocked`?`blocked`:`note`,blockId:t,message:`${q(r===`working`?`「{title}」開始`:r===`blocked`?`「{title}」詰まり`:r===`waiting_review`?`「{title}」確認待ち`:`「{title}」判断待ち`,{title:o.title})}${i?`: `+i:``}`}),a)}function qp(e,t){let n=pp(e),r=n.blocks[t];return r?(r.activity=null,n):e}function Jp(e,t,n,r,i=[],a=``){let o=e.blocks[t];if(!o||t===`root`)return{project:e};let s=pp(e),c={id:If(),question:r,options:i,askedBy:n,askedAt:Lf(),...a?{context:a}:{}};return s.blocks[t].decisions.push(c),s.blocks[t].activity={actor:n,state:`needs_decision`,note:r,since:Lf()},Gp(s,{actor:n,kind:`asked`,blockId:t,message:q(`「{title}」で判断待ち: {question}`,{title:o.title,question:r})}),{project:s,decisionId:c.id}}function Yp(e,t,n,r,i){let a=e.blocks[t],o=a?.decisions.find(e=>e.id===n);if(!a||!o)return e;let s=pp(e),c=s.blocks[t].decisions.find(e=>e.id===n);return c.answer=r,c.answeredBy=i,c.answeredAt=Lf(),em(i)?(delete c.ackedBy,delete c.ackedAt):(c.ackedBy=i,c.ackedAt=c.answeredAt),s.blocks[t].activity?.state===`needs_decision`&&(s.blocks[t].activity=null),Gp(s,{actor:i,kind:`answered`,blockId:t,message:q(`「{title}」の判断: {question} → {answer}`,{title:a.title,question:o.question,answer:r})}),s}function Xp(e,t,n,r,i){let a=e.blocks[t],o=a?.decisions.find(e=>e.id===n);if(!a||!o||o.answer===void 0||!r.trim()||r.trim()===o.answer)return e;let s=pp(e),c=s.blocks[t].decisions.find(e=>e.id===n);return delete c.ackedAt,delete c.ackedBy,c.answer=r.trim(),c.answeredBy=i,c.answeredAt=Lf(),Gp(s,{actor:i,kind:`answered`,blockId:t,message:q(`「{title}」の判断の答えを直した: {question} → {answer}`,{title:a.title,question:o.question,answer:r.trim()})}),s}function Zp(e){return e.answer===void 0?{rejected:[...e.options]}:{chosen:e.answer,rejected:e.options.filter(t=>t!==e.answer)}}function Qp(e,t,n,r,i=``){let a=e.blocks[t],o=a?.decisions.find(e=>e.id===n);if(!a||!o||o.answer===void 0)return e;let s=pp(e),c=s.blocks[t].decisions.find(e=>e.id===n);return c.history=[...c.history??[],{answer:o.answer,by:o.answeredBy??``,at:o.answeredAt??Lf(),note:i||void 0}],delete c.ackedBy,delete c.ackedAt,delete c.answer,delete c.answeredBy,delete c.answeredAt,s.blocks[t].activity={actor:r,state:`needs_decision`,note:o.question,since:Lf()},Gp(s,{actor:r,kind:`asked`,blockId:t,message:i?q(`「{title}」の判断をやり直し: {question} (前の答え: {answer}。理由: {note})`,{title:a.title,question:o.question,answer:o.answer??``,note:i}):q(`「{title}」の判断をやり直し: {question} (前の答え: {answer})`,{title:a.title,question:o.question,answer:o.answer??``})}),s}function $p(e){let t=[];for(let n of Object.values(e.blocks))for(let e of n.decisions)e.answer===void 0&&t.push({block:n,decision:e});return t}var em=e=>e===`human`||e.startsWith(`human:`);function tm(e){let t=[];for(let n of Object.values(e.blocks))for(let r of n.decisions)r.answer!==void 0&&!nm(e,n.id,r)&&t.push({block:n,decision:r});return t.sort((e,t)=>(t.decision.answeredAt??``).localeCompare(e.decision.answeredAt??``))}function nm(e,t,n){return n.answer===void 0?!1:n.ackedAt?!0:!!n.answeredBy&&!em(n.answeredBy)}function rm(e){let t=Object.values(e.blocks).filter(e=>e.id!==`root`&&$f(e)!==`project`),n=t.filter(e=>e.activity?.state===`working`).map(e=>({block:e,actor:e.activity.actor,note:e.activity.note,since:e.activity.since})),r=t.filter(e=>e.activity?.state===`blocked`||e.activity?.state===`waiting_review`).map(e=>({block:e,actor:e.activity.actor,note:e.activity.note})),i=t.filter(t=>t.status===`black`&&!t.activity&&rp(e,t.id).length===0).sort((t,n)=>Number(Bp(e,t.id).length>0)-Number(Bp(e,n.id).length>0));return{total:t.length,white:t.filter(e=>e.status===`white`).length,gray:t.filter(e=>e.status===`gray`).length,black:t.filter(e=>e.status===`black`).length,working:n,blocked:r,decisions:$p(e),answered:tm(e),next:i,overdue:t.filter(e=>dm(e))}}function im(e,t){let n=e.blocks[t],r=rp(e,t),i=n=>n===t?`parent`:e.blocks[n]?.title??`?`,a=[],o=new Set(r.map(e=>e.id));for(let n of Object.values(e.edges)){if(n.auto)continue;let r=e.ports[n.from.portId],s=e.ports[n.to.portId];if(!r||!s)continue;let c=(e,n)=>n===`inner`?e.blockId===t:o.has(e.blockId);c(r,n.from.side)&&c(s,n.to.side)&&a.push({from:`${i(r.blockId)}.${r.name}`,to:`${i(s.blockId)}.${s.name}`})}return{title:n.title,category:n.category,description:n.description,inputs:Y(e,t,`in`).filter(e=>!e.promotedFrom).map(e=>({name:e.name,description:e.description,required:e.required})),outputs:Y(e,t,`out`).map(e=>({name:e.name,description:e.description})),children:r.sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x).map(t=>im(e,t.id)),connections:a}}function am(e,t,n={}){let r=e.blocks[t],i=Lf();return{schema:`boxglow-block`,schemaVersion:1,id:r.template?.id??If(),name:n.name??r.title,version:(r.template?.version??0)+1,description:n.description??r.description,tags:n.tags??[],createdAt:i,updatedAt:i,root:im(e,t)}}function om(e,t,n,r,i){let a=mp(e,{parentId:t,title:n.title,outputName:n.outputs[0]?.name,position:i}),o=a.project,s=a.blockId;o.blocks[s].description=n.description,o.blocks[s].template=r,n.category&&(o.blocks[s].category=n.category),n.outputs[0]&&(o=Cp(o,Y(o,s,`out`)[0].id,{description:n.outputs[0].description}));for(let e of n.outputs.slice(1)){let t=yp(o,{blockId:s,direction:`out`,name:e.name});o=Cp(t.project,t.portId,{description:e.description})}for(let e of n.inputs){let t=yp(o,{blockId:s,direction:`in`,name:e.name});o=Cp(t.project,t.portId,{description:e.description,required:e.required})}if(n.children.length>0){let e={},t=Uf(o,s);for(let i of n.children){let n=om(o,s,i,r,{x:Vf.left,y:t});o=n.project,e[i.title]=n.blockId,t+=120}let i=(t,n)=>{for(let{title:r,portName:i}of ym(t)){let t=r===`parent`,a=t?s:e[r];if(!a)continue;let c=Y(o,a,t?n===`out`?`in`:`out`:n).find(e=>e.name===i);if(c)return{portId:c.id,side:t?`inner`:`outer`}}return null};for(let e of n.connections){let t=i(e.from,`out`),n=i(e.to,`in`);t&&n&&(o=Op(o,t,n).project)}o.blocks[s].status=`gray`}return{project:o,blockId:s}}function sm(e,t,n,r,i){let a={id:n.id,name:n.name,version:n.version},o=om(e,t,n.root,a,i),s=o.project;return Gp(s,{actor:r,kind:`added`,blockId:o.blockId,message:q(`テンプレート「{name}」v{version} を挿入: {title}`,{name:n.name,version:n.version,title:n.root.title})}),{project:Mp(s),blockId:o.blockId}}function cm(e){let t;try{t=JSON.parse(e)}catch{throw Error(q(`JSON として読めません`))}let n=t;if(!n||n.schema!==`boxglow-block`||!n.root||typeof n.root.title!=`string`)throw Error(q(`Boxglow のテンプレート (boxglow-block) ではありません`));let r=e=>({title:e.title??q(`無題`),description:e.description??``,category:typeof e.category==`string`?e.category:void 0,inputs:(e.inputs??[]).map(e=>({name:e.name,description:e.description??``,required:e.required??!0})),outputs:(e.outputs??[]).map(e=>({name:e.name,description:e.description??``})),children:(e.children??[]).map(r),connections:e.connections??[]});return{schema:`boxglow-block`,schemaVersion:1,id:n.id??If(),name:n.name??n.root.title,version:n.version??1,description:n.description??``,tags:n.tags??[],createdAt:n.createdAt??Lf(),updatedAt:n.updatedAt??Lf(),root:r(n.root)}}function lm(e,t,n){if(!e.blocks[t])return e;if(n&&!mf(n))throw Error(q(`知らないカテゴリです: {key}`,{key:n}));let r=pp(e);return n?r.blocks[t].category=n:delete r.blocks[t].category,r}function um(e,t,n,r){let i=e.blocks[t];if(!i)return e;let a=pp(e),o=a.blocks[t],s=(e,t)=>{t!==void 0&&(t===null||t===``||typeof t==`number`&&Number.isNaN(t)?delete o[e]:o[e]=t)};s(`startDate`,n.startDate),s(`dueDate`,n.dueDate),s(`estimateHours`,n.estimateHours),s(`actualHours`,n.actualHours);let c=[];return n.dueDate!==void 0&&c.push(q(`期日 {date}`,{date:n.dueDate??q(`なし`)})),n.startDate!==void 0&&c.push(q(`開始 {date}`,{date:n.startDate??q(`なし`)})),n.actualHours!==void 0&&c.push(q(`実績 {hours}h`,{hours:n.actualHours??0})),n.estimateHours!==void 0&&c.push(q(`見積 {hours}h`,{hours:n.estimateHours??0})),c.length>0&&Gp(a,{actor:r,kind:`note`,blockId:t,message:q(`「{title}」{detail}`,{title:i.title,detail:c.join(`, `)})}),a}function dm(e,t=new Date){return!e.dueDate||e.status===`white`?!1:new Date(e.dueDate+`T23:59:59`).getTime()<t.getTime()}function fm(e,t=new Date){if(!e.dueDate)return null;let n=new Date(e.dueDate+`T00:00:00`),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((n.getTime()-r.getTime())/864e5)}function pm(e,t,n=20){let r=t.trim().toLowerCase();if(!r)return[];let i=Object.values(e.blocks).filter(e=>e.id!==Ff),a=i.filter(e=>e.key?.toLowerCase()===r),o=e=>mf(e.category),s=i.filter(e=>!a.includes(e)&&(e.title.toLowerCase().includes(r)||(e.key??``).toLowerCase().includes(r)||e.description.toLowerCase().includes(r)||o(e)?.label===t.trim()||o(e)?.en===r));return[...a,...s].slice(0,n)}function mm(e,t,n=new Set){if(n.has(t))return null;n.add(t);let r=e.ports[t];if(!r||r.direction!==`in`)return null;let i=sp(e,{portId:t,side:`outer`})[0];if(!i)return null;let a=e.ports[i.from.portId];return a?a.direction===`out`||a.blockId===`root`?a:mm(e,a.id,n)??a:null}function hm(e,t){let n=e.ports[t];if(!n)return``;if(n.direction===`out`)return n.description;let r=mm(e,t);return r?r.description:n.description}function gm(e,t){let n=[],r=t;for(;r!==null;)n.push(r),r=e.blocks[r]?.parentId??null;return n}function _m(e,t,n,r){let i=Y(e,t,n).find(e=>e.name===r&&!e.promotedFrom);if(i)return i;let a=yp(e,{blockId:t,direction:n,name:r});return Object.assign(e,a.project),e.ports[a.portId]??null}function vm(e,t,n){let r=lp(e,t),i=lp(e,n);if(r===null||i===null)return;let a=e.ports[t.portId],o=e.ports[n.portId];if(!a||!o)return;let s=gm(e,r),c=gm(e,i),l=s.find(e=>c.includes(e));if(!l)return;let u=t;for(let t of s.slice(0,s.indexOf(l))){if(t===`root`)return;let n=_m(e,t,`out`,a.name);if(!n)return;let r=Op(e,u,{portId:n.id,side:`inner`});r.error||Object.assign(e,r.project),u={portId:n.id,side:`outer`}}for(let t of c.slice(0,c.indexOf(l)).reverse()){if(t===`root`)return;let n=_m(e,t,`in`,o.name);if(!n)return;let r=Op(e,u,{portId:n.id,side:`outer`});r.error||Object.assign(e,r.project),u={portId:n.id,side:`inner`}}let d=Op(e,u,n);d.error||Object.assign(e,d.project)}function ym(e){let t=[];for(let n=e.indexOf(`.`);n>=0;n=e.indexOf(`.`,n+1)){let r=e.slice(0,n),i=e.slice(n+1);r&&i&&t.push({title:r,portName:i})}return t}function bm(e,t,n,r){let i=e.blocks[t],a=e.blocks[n];if(!i||!a||t===`root`||n===`root`||i.parentId===n||$f(i)===`project`||n===t||ip(e,t).some(e=>e.id===n))return e;let o=pp(e),s=i.parentId,c=new Set(Y(o,t).map(e=>e.id)),l=[];for(let e of Object.values(o.edges)){let t=c.has(e.from.portId)&&e.from.side===`outer`,r=c.has(e.to.portId)&&e.to.side===`outer`;if(!t&&!r||(delete o.edges[e.id],e.auto))continue;let i=t?e.from:e.to,a=t?e.to:e.from,u=o.ports[a.portId];if(u&&(a.side!==`outer`||u.blockId!==n)){if(a.side===`inner`&&u.blockId===s&&s!==null){if(r){let e=sp(o,{portId:u.id,side:`outer`})[0];e&&l.push({from:e.from,to:i})}else for(let e of cp(o,{portId:u.id,side:`outer`}))l.push({from:i,to:e.to});continue}l.push(t?{from:i,to:a}:{from:a,to:i})}}o.blocks[t].parentId=n,o.blocks[t].position={x:Math.max(Vf.left,r.x),y:Math.max(Uf(o,n),r.y)};for(let e of l)vm(o,e.from,e.to);return o.blocks[n].status===`black`&&(o.blocks[n].status=`gray`),o.blocks[n].collapsed=!1,Gp(o,{actor:`human`,kind:`note`,blockId:t,message:q(`「{title}」を「{parent}」の中へ移動`,{title:i.title,parent:a.title})}),Mp(o)}function xm(e,t,n){let r=e.ports[t.portId],i=e.blocks[n];if(!r||!i||n===`root`)return{project:e,error:q(`つなぐ先が見つかりません`)};let a=lp(e,t),o=r.direction===`in`&&t.side===`inner`&&i.parentId===r.blockId,s=a!==null&&i.parentId===a;if(r.direction===`out`&&t.side===`outer`&&e.blocks[r.blockId]?.parentId===n){let r=Y(e,n,`out`),i=r.find(t=>sp(e,{portId:t.id,side:`inner`}).length===0)??r[0];return i?Op(e,t,{portId:i.id,side:`inner`}):{project:e,error:q(`親に出力がありません`)}}if(!s&&!o)return{project:e,error:q(`同じ階層のボックス (または親子) にだけつなげます`)};let c=Y(e,n,`in`).find(t=>sp(e,{portId:t.id,side:`outer`}).every(e=>e.auto)&&!t.promotedFrom),l=e;if(!c){let t=yp(e,{blockId:n,direction:`in`,name:r.name});l=t.project,c=l.ports[t.portId]}return Op(l,t,{portId:c.id,side:`outer`})}var Sm=96;function Cm(e,t,n,r,i){let a=e.blocks[t];if(!a||a.parentId===null)return!1;let o=i??rp(e,a.parentId).map(e=>e.id),s=n(e,t),c=!!r,l=!1;for(let i=0;i<(c?64:8);i++){let i=e.blocks[t],a;for(let c of o){if(c===t||r&&!r.has(c))continue;let o=e.blocks[c],l=n(e,c);if(i.position.x<o.position.x+l.width+Sm&&i.position.x+s.width+Sm>o.position.x&&i.position.y<o.position.y+l.height+Sm&&i.position.y+s.height+Sm>o.position.y){a=o;break}}if(!a)break;let u=n(e,a.id),d=[{x:a.position.x+u.width+Sm,y:i.position.y,d:a.position.x+u.width+Sm-i.position.x},{x:i.position.x,y:a.position.y+u.height+Sm,d:a.position.y+u.height+Sm-i.position.y},{x:a.position.x-s.width-Sm,y:i.position.y,d:i.position.x-(a.position.x-s.width-Sm)},{x:i.position.x,y:a.position.y-s.height-Sm,d:i.position.y-(a.position.y-s.height-Sm)}].filter((e,t)=>e.d>=0&&(!c||t<2)),f=i.parentId!==Ff,p=d.filter(t=>!f||t.x>=Vf.left&&t.y>=Uf(e,i.parentId)),m=(p.length>0?p:d).sort((e,t)=>e.d-t.d)[0];if(!m)break;e.blocks[t]={...i,position:{x:m.x,y:m.y}},l=!0}return l}function wm(e,t,n,r){let i={...e,blocks:{...e.blocks}};return Cm(i,t,n,r)?i:e}function Tm(e,t){let n={...e,blocks:{...e.blocks}},r=new Map;for(let e of Object.values(n.blocks)){if(e.id===`root`||e.parentId===null)continue;let t=r.get(e.parentId)??[];t.push(e.id),r.set(e.parentId,t)}let i=e=>{let t=0,r=n.blocks[e]?.parentId;for(;r;)t++,r=n.blocks[r]?.parentId;return t},a=[...r.keys()].sort((e,t)=>i(t)-i(e)),o=new Map,s=(e,n)=>{let r=o.get(n);return r||(r=t(e,n),o.set(n,r)),r},c=!1;for(let e of a){let t=(r.get(e)??[]).slice().sort((e,t)=>n.blocks[e].position.y-n.blocks[t].position.y||n.blocks[e].position.x-n.blocks[t].position.x),i=new Set(t.slice(0,1));for(let e=1;e<t.length;e++)Cm(n,t[e],s,i,t)&&(c=!0),i.add(t[e])}return c?n:e}var Em=e=>e.inputGroups??[];function Dm(e,t){return Y(e,Ff,`in`).filter(e=>t===null?!e.groupId:e.groupId===t)}function Om(e,t){let n=pp(e),r=n.inputGroups??=[],i=If(),a=r.length===0?n.terminals.in.y+160:Math.max(...r.map(e=>e.position.y))+160;return r.push({id:i,name:t,description:``,position:{x:n.terminals.in.x,y:a}}),Gp(n,{actor:`human`,kind:`added`,message:q(`入力グループ「{name}」を追加`,{name:t})}),{project:n,groupId:i}}function km(e,t,n){let r=pp(e),i=(r.inputGroups??[]).find(e=>e.id===t);return i?(Object.assign(i,n),r):e}function Am(e,t){let n=pp(e);n.inputGroups=(n.inputGroups??[]).filter(e=>e.id!==t);for(let e of Object.values(n.ports))e.groupId===t&&delete e.groupId;return n}function jm(e,t,n){let r=e.ports[t];if(!r||r.blockId!==`root`||r.direction!==`in`)return e;let i=pp(e);return n?i.ports[t].groupId=n:delete i.ports[t].groupId,i}function Mm(e,t,n){let r=Rf(e),i=(r.inputGroups??[]).find(e=>e.id===t);return i?(i.position=n,r):e}function Nm(e,t){let n=(e.inputGroups??[]).find(e=>e.id===t),r=Dm(e,t).map(e=>({name:e.name,description:e.description,artifacts:e.artifacts.map(e=>({title:e.title,url:e.url}))}));return JSON.stringify({schema:`boxglow-input-group`,name:n?.name??``,description:n?.description??``,inputs:r},null,2)}function Pm(e,t){let n;try{n=JSON.parse(t)}catch{throw Error(q(`JSON として読めません`))}if(n.schema!==`boxglow-input-group`||!Array.isArray(n.inputs))throw Error(q(`入力グループの JSON (boxglow-input-group) ではありません`));let r=Om(e,n.name??`Inputs`),i=km(r.project,r.groupId,{description:n.description??``});for(let e of n.inputs){let t=yp(i,{blockId:Ff,direction:`in`,name:e.name});i=Cp(t.project,t.portId,{description:e.description??``,artifacts:(e.artifacts??[]).map(e=>ep(e.title,e.url??``))}),i=jm(i,t.portId,r.groupId)}return{project:i,groupId:r.groupId}}function Fm(e){let t=e.trim(),n=t.match(/\/browse\/([A-Z][A-Z0-9_]+-\d+)/i);if(n)return n[1].toUpperCase();if(n=t.match(/\/issues\/(\d+)/),n)return`#${n[1]}`;if(n=t.match(/\/pull\/(\d+)/),n)return`PR #${n[1]}`;try{return new URL(t).hostname.replace(/^www\./,``)}catch{return t.slice(0,20)}}function Im(e,t){let n=[],r=e=>{n.includes(e)||n.push(e)},i=t=>{let n=e.ports[t.from.portId]?.blockId,r=e.ports[t.to.portId]?.blockId,i=n&&n!==`root`?Jf(e,n):null,a=r&&r!==`root`?Jf(e,r):null,o=(t,n)=>!!t&&t!==`root`&&(Jf(e,t)!==t||n===`inner`);return o(n,t.from.side)?i:o(r,t.to.side)?a:null},a=Rm(e,t),o=[...a].map(t=>e.edges[t]).filter(e=>!!e),s=e.edges[t],c=o.filter(t=>t!==s&&Lm(e,t,s,a)),l=o.filter(e=>e!==s&&!c.includes(e));for(let e of c)r(i(e));s&&r(i(s));for(let e of l)r(i(e));return n}function Lm(e,t,n,r){if(!n)return!1;let i=[n],a=new Set;for(;i.length>0;){let n=i.pop(),o=e.ports[n.from.portId];if(!o)continue;let s=n.from.side===`outer`?`inner`:`outer`;for(let n of r){let r=e.edges[n];if(r&&!a.has(n)&&r.to.portId===o.id&&r.to.side===s){if(r.id===t.id)return!0;a.add(n),i.push(r)}}}return!1}function Rm(e,t){let n=new Set([t]),r=Object.values(e.edges),i=e.edges[t];if(!i)return n;let a=[i];for(;a.length>0;){let t=a.pop(),i=e.ports[t.from.portId];if(!i)continue;let o=t.from.side===`outer`?`inner`:`outer`;for(let e of r)e.to.portId===i.id&&e.to.side===o&&!n.has(e.id)&&(n.add(e.id),a.push(e))}let o=[i];for(;o.length>0;){let t=o.pop(),i=e.ports[t.to.portId];if(!i)continue;let a=t.to.side===`outer`?`inner`:`outer`;for(let e of r)e.from.portId===i.id&&e.from.side===a&&!n.has(e.id)&&(n.add(e.id),o.push(e))}return n}function zm(e,t){let n=0;for(let r of e){let e=r.codePointAt(0)??0;n+=e>11903?t*1.05:t*.6}return n}function Bm(e){let t=e=>zm(e,10)+14+6,n=22;return e.isProject||(n+=t(`In Progress`)),e.assigneeText?n+=t(e.assigneeText):e.unassigned&&(n+=t(q(`未担当`))),e.hasPercent&&(n+=t(`100%`)),e.activityText&&(n+=t(e.activityText)),e.hasReady&&(n+=t(`Ready`)),e.hasDue&&(n+=t(q(`期日 {date}`,{date:`10/15`}))),n+=e.keyLen*7+8,n}function Vm(e,t){let n=e.blocks[t];return!!n&&!n.collapsed&&rp(e,t).length>0}function Hm(e,t){let n=e.blocks[t],r=Y(e,t,`in`),i=Y(e,t,`out`),a=Math.max(r.length,i.length,1),o=rp(e,t),s=mf(n?.category),c=30+(n?.kind===`project`?66:26)+30+(s?zm(q(s.label),11)+20:0),l=zm(n?.title??``,15)+4,u=c+l,d=e=>{let t=e.toLowerCase();return t.startsWith(`claude`)?`Claude Code`:t.startsWith(`codex`)?`Codex`:t.startsWith(`human:`)?e.slice(6):e},f={working:q(`作業中`),blocked:q(`詰まり`),needs_decision:q(`判断待ち`),waiting_review:q(`確認待ち`)},p=Bm({assigneeText:``,unassigned:!1,hasPercent:!!n&&n.status!==`white`&&(o.length>0||typeof n.progress==`number`&&n.progress>0),activityText:n?.activity?`${f[n.activity.state]??``} (${d(n.activity.actor)})`:null,hasDue:!!n?.dueDate&&n.status!==`white`,keyLen:(n?.key??``).length,isProject:n?.kind===`project`,hasReady:!!n&&n.status===`black`&&n.kind!==`project`&&r.length>0&&Bp(e,n.id).length===0}),m=Math.min(460,Math.max(256,u,p)),h=Math.max(0,...r.map(e=>zm(e.name,12)+(e.name?14:0)+(e.required?0:zm(q(`(任意)`),9)+4))),g=Math.max(0,...i.map(e=>zm(e.name,12))),_=12+h+24+g+10,v=Math.max(256,m,Math.min(580,_)),y=36+(Math.max(1,Math.ceil(l/Math.max(80,v-c)))-1)*18+24,b=y+a*26+16;if(!Vm(e,t))return{width:v,height:b,headerH:y};let x=0,S=0;for(let t of o){let n=Hm(e,t.id);x=Math.max(x,t.position.x+n.width),S=Math.max(S,t.position.y+n.height)}return{width:Math.max(320,v,x+96),height:Math.max(b+16,S+104+12+(y-44)),headerH:y}}function Um(e,t){let n=Y(e,Ff,t).length;return 44+Math.max(n,1)*26+16}var Wm=144,Gm=96,Km=3e3;function qm(e,t,n={}){let r=structuredClone(e),i=rp(r,t);if(i.length===0)return r;for(let e of i)n.recursive!==!1&&rp(r,e.id).length>0&&(r=qm(r,e.id));let a=i.map(e=>e.id),o=new Map;for(let e of a){let t=new Set;for(let n of Y(r,e,`out`))for(let e of cp(r,{portId:n.id,side:`outer`})){if(e.kind!==`sibling`)continue;let n=r.ports[e.to.portId]?.blockId;n&&a.includes(n)&&t.add(n)}o.set(e,[...t])}let s=new Map,c=new Set,l=e=>{if(s.has(e))return s.get(e);if(c.has(e))return 0;c.add(e);let t=0;for(let n of a)o.get(n).includes(e)&&(t=Math.max(t,l(n)+1));return c.delete(e),s.set(e,t),t};for(let e of a)l(e);let u=Math.max(...a.map(e=>s.get(e))),d=new Map;[...i].sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x).forEach((e,t)=>d.set(e.id,t));let f=new Map;for(let e of a)f.set(e,a.filter(t=>o.get(t).includes(e)));for(let e=0;e<2;e++){for(let e=1;e<=u;e++){let t=a.filter(t=>s.get(t)===e),n=new Map;for(let e of t){let t=f.get(e);n.set(e,t.length===0?d.get(e):t.reduce((e,t)=>e+d.get(t),0)/t.length)}t.sort((e,t)=>n.get(e)-n.get(t)||d.get(e)-d.get(t)),t.forEach((e,t)=>d.set(e,t))}for(let e=u-1;e>=0;e--){let t=a.filter(t=>s.get(t)===e),n=new Map;for(let e of t){let t=o.get(e);n.set(e,t.length===0?d.get(e):t.reduce((e,t)=>e+d.get(t),0)/t.length)}t.sort((e,t)=>n.get(e)-n.get(t)||d.get(e)-d.get(t)),t.forEach((e,t)=>d.set(e,t))}}let p=Array(Math.max(1,u)).fill(0);for(let e of a)for(let t of o.get(e)){let n=s.get(e),r=s.get(t);for(let e=Math.min(n,r);e<Math.max(n,r);e++)p[e]++}let m=e=>Math.max(Wm,72+16*Math.max(0,(p[e]??0)-1)+16),h=t===`root`?200+Wm:Vf.left,g=t===`root`?40:Uf(r,t),_=h,v=g,y=g,b=g;for(let e=0;e<=u;e++){let t=i.filter(t=>s.get(t.id)===e).sort((e,t)=>d.get(e.id)-d.get(t.id)),n=Math.max(0,...t.map(e=>Hm(r,e.id).width));e>0&&_+n>h+Km&&(_=h,v=b+192);let a=v;for(let e of t){let t=Hm(r,e.id);r.blocks[e.id].position={x:_,y:a},a+=t.height+Gm}b=Math.max(b,a-Gm),y=Math.max(y,b),_+=n+m(e)}if(t===`root`){let e=Math.max(g,(g+y)/2-Um(r,`in`)/2);r.terminals.in={x:0,y:e};let t=e+Um(r,`in`)+Gm;for(let e of r.inputGroups??[])e.position={x:0,y:t},t+=44+Math.max(1,Object.values(r.ports).filter(t=>t.blockId===`root`&&t.groupId===e.id).length)*26+12+Gm;r.terminals.out={x:_,y:Math.max(g,(g+y)/2-Um(r,`out`)/2)}}return r}function Jm(e){return qm(e,Ff)}function Ym(e,t){let n=rp(e,t),r=t===`root`?200+Wm:Vf.left,i=t===`root`?40:Uf(e,t);if(n.length===0)return{x:r,y:i};let a=i,o=1/0;for(let t of n){let n=Hm(e,t.id);a=Math.max(a,t.position.y+n.height),o=Math.min(o,t.position.x)}return{x:Math.max(r,o),y:a+Gm}}function Xm(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Zm(e,t=`|`){return e.map(e=>Sh(e)).join(t)}function Qm(e,t){return typeof t==`bigint`?t.toString():t}var $m=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function eh(e){return new $m(e)}function th(e){return e==null}function nh(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function rh(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ih(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ah(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function oh(e){return ah(e._zod.def)??e._zod.def.shape}function sh(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ih(this,t,e),e},enumerable:!0,configurable:!0})}function ch(e,t,n){t in e?ih(e,t,n):e[t]=n}function lh(e,t,n,r){let i=oh(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?sh(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ch(e,a,r?r(n.value,a):n.value))}}function uh(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?sh(e,n,()=>t[n]):ch(e,n,r.value))}}function dh(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function fh(e){return JSON.stringify(e)}function ph(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var mh=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function hh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gh=eh(()=>{if(dg.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _h(e){if(hh(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return hh(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function vh(e){return _h(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var yh=new Set([`string`,`number`,`symbol`]);function bh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xh(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function X(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sh(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ch(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var wh={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Th={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Eh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return lh(i,e,Dh(e,t)),xh(e,dh(n,{shape:i,checks:[]}))}function Dh(e,t){let n=oh(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Oh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Dh(e,t)),a={};return lh(a,e,Reflect.ownKeys(oh(e)).filter(e=>!i.has(e))),xh(e,dh(n,{shape:a,checks:[]}))}function kh(e,t){if(!_h(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=oh(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xh(e,dh(e._zod.def,{shape:Ah(e,t)}))}function Ah(e,t){let n={};return lh(n,e,Reflect.ownKeys(oh(e))),uh(n,t),n}function jh(e,t){if(!_h(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xh(e,dh(e._zod.def,{shape:Ah(e,t)}))}function Mh(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return lh(n,e,Reflect.ownKeys(oh(e))),lh(n,t,Reflect.ownKeys(oh(t))),xh(e,dh(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Nh(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Dh(t,n)):void 0,o={};return lh(o,t,Reflect.ownKeys(oh(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),xh(t,dh(t._zod.def,{shape:o,checks:[]}))}function Ph(e,t,n){let r=n?new Set(Dh(t,n)):void 0,i={};return lh(i,t,Reflect.ownKeys(oh(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),xh(t,dh(t._zod.def,{shape:i}))}function Fh(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ih(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Lh(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Rh(e){return typeof e==`string`?e:e?.message}function zh(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Bh(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Rh(e.inst?._zod.def?.error?.(e))??Rh(a?.(e))??Rh(t?.error?.(e))??Rh(n.customError?.(e))??Rh(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Vh=/[\uD800-\uDBFF]/;function Hh(e){let t=e.length;if(!Vh.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Uh(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Wh(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Gh(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Kh(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Xh(e,n,r.value)}}function qh(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Jh(e,t,n){return qh(e,t,n,!1)}function Yh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return qh(this,n,r(this))},set(e){qh(this,n,e)}})}return t}function Xh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qh(this,t,n.bind(this))},set(e){qh(this,t,e)}})}function Zh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Qh,$h=!1,eg={configurable:!0,get(){$h=!0}};function tg(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Qh!==e._zod){Qh=void 0;return}Qh=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,eg);let e=$h;$h=!1;try{let r=n(this);return $h?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),$h||=e,r}catch(n){throw delete this[t],$h||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function ng(e,t,n,r){let i=Zh(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var rg=`~constantCatch`;function ig(e){let t=()=>e;return t[rg]=!0,t}var ag,og={value:void 0,enumerable:!1},sg=`captureStackTrace`in Error?Error:null;function cg(e){let t=sg;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return sg=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function Z(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){og.value=new a(r);try{Object.defineProperty(n,"_zod",og)}finally{og.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Kh(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?cg(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var lg=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ug=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ag=globalThis).__zod_globalConfig??(ag.__zod_globalConfig={});var dg=globalThis.__zod_globalConfig;function fg(e){return e&&Object.assign(dg,e),dg}function pg(){let e=this._zod;return e.message??=JSON.stringify(e.def,Qm,2),e.message}function mg(e){this._zod.message=e}var hg={get:pg,set:mg,enumerable:!0,configurable:!0},gg={value:void 0,enumerable:!1},_g=new WeakSet([Object.prototype,Error.prototype]),vg=(e,t)=>{e.name=`$ZodError`,gg.value=t,Object.defineProperty(e,"issues",gg),gg.value=void 0,Object.defineProperty(e,"message",hg);let n=Object.getPrototypeOf(e);_g.has(n)||(_g.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},yg=Z(`$ZodError`,vg);Z(`$ZodError`,vg,void 0,{Parent:Error});function bg(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function xg(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?bg(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Sg(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Cg(e,t){return{callee:t?.callee??e,Err:t?.Err}}var wg=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new lg;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Bh(e,o,fg())));throw mh(n,a?.callee??t),n}return s.value};return t},Tg=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Bh(e,o,fg())));throw mh(n,a?.callee??t),n}return s.value};return t},Eg=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new lg;return a.issues.length?Dg(e,a.issues,i):{success:!0,data:a.value}};function Dg(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Bh(e,n,fg()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Og=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Dg(e,a.issues,i):{success:!0,data:a.value}},kg=Symbol.for(`zod.compile.invalid`),Ag=Symbol.for(`zod.compile.fallback`),jg=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==kg)return!0;if(r.definite===!0&&n===void 0)return!1}return Mg(e,t,n)});function Mg(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Ag]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new lg;return a.issues.length===0}var Ng=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Pg=e=>{let t=wg(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Cg(n,a))};return n},Fg=e=>{let t=wg(e),n=(e,r,i,a)=>t(e,r,i,Cg(n,a));return n},Ig=e=>{let t=Tg(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Cg(n,a))};return n},Lg=e=>{let t=Tg(e),n=async(e,r,i,a)=>await t(e,r,i,Cg(n,a));return n},Rg=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Eg(e)(t,n,i)},zg=e=>(t,n,r)=>Eg(e)(t,n,r),Bg=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Og(e)(t,n,i)},Vg=e=>async(t,n,r)=>Og(e)(t,n,r),Hg=/^[cC][0-9a-z]{6,}$/,Ug=/^[0-9a-z]+$/,Wg=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Gg=/^[0-9a-vA-V]{20}$/,Kg=/^[A-Za-z0-9]{27}$/,qg=/^[a-zA-Z0-9_-]{21}$/;function Jg(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Yg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xg=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zg=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Qg=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$g=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function e_(){return new RegExp($g,`u`)}var t_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,n_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,r_=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,i_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o_=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,s_=/^https?$/,c_=/^\+[1-9]\d{6,14}$/,l_=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function u_(e){return RegExp(`^${e}$`)}var d_=u_(l_);function f_(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function p_(e){return RegExp(`^${f_(e)}$`)}function m_(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${f_({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${f_({precision:e.precision})}`:n;return RegExp(`^${l_}T(?:${r})$`)}var h_=/^[\s\S]{0,}$/,g_=/^-?\d+$/,__=/^-?\d+(?:\.\d+)?$/,v_=/^(?:true|false)$/i,y_=/^[^A-Z]*$/,b_=/^[^a-z]*$/,x_=Z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),S_=e=>{let t=e.value;return!th(t)&&t.length!==void 0},C_={number:`number`,bigint:`bigint`,object:`date`},w_=Z(`$ZodCheckLessThan`,(e,t)=>{x_.init(e,t);let n=C_[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:C_[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),T_=Z(`$ZodCheckGreaterThan`,(e,t)=>{x_.init(e,t);let n=C_[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:C_[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),E_=Z(`$ZodCheckMultipleOf`,(e,t)=>{x_.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):rh(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),D_=Z(`$ZodCheckNumberFormat`,(e,t)=>{x_.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=wh[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),O_=Z(`$ZodCheckMaxLength`,(e,t)=>{var n;x_.init(e,t),(n=e._zod.def).when??(n.when=S_),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Hh(r):i)<=t.maximum)return;let a=Uh(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),k_=Z(`$ZodCheckMinLength`,(e,t)=>{var n;x_.init(e,t),(n=e._zod.def).when??(n.when=S_),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Hh(r):i)>=t.minimum)return;let a=Uh(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),A_=Z(`$ZodCheckLengthEquals`,(e,t)=>{var n;x_.init(e,t),(n=e._zod.def).when??(n.when=S_),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Hh(r):i;if(a===t.length)return;let o=Uh(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),j_=Z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x_.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),M_=Z(`$ZodCheckRegex`,(e,t)=>{j_.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),N_=Z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=y_,j_.init(e,t)}),P_=Z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=b_,j_.init(e,t)}),F_=Z(`$ZodCheckIncludes`,(e,t)=>{x_.init(e,t);let n=bh(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),I_=Z(`$ZodCheckStartsWith`,(e,t)=>{x_.init(e,t);let n=RegExp(`^${bh(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),L_=Z(`$ZodCheckEndsWith`,(e,t)=>{x_.init(e,t);let n=RegExp(`.*${bh(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),R_=Z(`$ZodCheckOverwrite`,(e,t)=>{x_.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),z_=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
18
18
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
19
19
|
`)}\n};`)(...Object.values(this.closed))}},B_={major:4,minor:6,patch:5},V_=Z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=B_;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Fh(t),a;for(let o of n){if(o._zod.def.when){if(Ih(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new lg;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(zh(t.issues,n,e),i||=Fh(t,n))});else{if(t.issues.length===n)continue;zh(t.issues,n,e),i||=Fh(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Fh(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new lg;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new lg;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Jh(this,`~standard`,W_(this))},set"~standard"(e){qh(this,`~standard`,e)}}),H_=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Bh(e,t,fg()))}:{value:e.value};async function U_(e,t){let n={async:!0};return H_(await e._zod.run({value:t,issues:[]},n),n)}function W_(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return H_(r,n)}catch{}return U_(e,t)},vendor:`zod`,version:1}}var G_=Z(`$ZodString`,(e,t)=>{V_.init(e,t),e._zod.pattern=t.pattern??h_,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),K_=Z(`$ZodStringFormat`,(e,t)=>{j_.init(e,t),G_.init(e,t)}),q_=Z(`$ZodGUID`,(e,t)=>{t.pattern??=Xg,K_.init(e,t)}),J_=Z(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Zg(e)}else t.pattern??=Zg();K_.init(e,t)}),Y_=Z(`$ZodEmail`,(e,t)=>{t.pattern??=Qg,K_.init(e,t)});function X_(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Z_(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?X_(e)||2:Q_(e,t)}function Q_(e,t){if(!t.normalize&&t.protocol?.source===s_.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var $_=/[\t\n\r]/g;function ev(e){return e.replace($_,``)}function tv(e,t){return t.lastIndex=0,t.test(e.hostname)}function nv(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var rv=Z(`$ZodURL`,(e,t)=>{K_.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Z_(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ev(r);return}t.hostname&&!tv(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!nv(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ev(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),iv=Z(`$ZodEmoji`,(e,t)=>{t.pattern??=e_(),K_.init(e,t)}),av=Z(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?qg:Jg(t.length),K_.init(e,t)}),ov=Z(`$ZodCUID`,(e,t)=>{t.pattern??=Hg,K_.init(e,t)}),sv=Z(`$ZodCUID2`,(e,t)=>{t.pattern??=Ug,K_.init(e,t)}),cv=Z(`$ZodULID`,(e,t)=>{t.pattern??=Wg,K_.init(e,t)}),lv=Z(`$ZodXID`,(e,t)=>{t.pattern??=Gg,K_.init(e,t)}),uv=Z(`$ZodKSUID`,(e,t)=>{t.pattern??=Kg,K_.init(e,t)}),dv=Z(`$ZodISODateTime`,(e,t)=>{t.pattern??=m_(t),K_.init(e,t)}),fv=Z(`$ZodISODate`,(e,t)=>{t.pattern??=d_,K_.init(e,t)}),pv=Z(`$ZodISOTime`,(e,t)=>{t.pattern??=p_(t),K_.init(e,t)}),mv=Z(`$ZodISODuration`,(e,t)=>{t.pattern??=Yg,K_.init(e,t)}),hv=Z(`$ZodIPv4`,(e,t)=>{t.pattern??=t_,K_.init(e,t)}),gv=/^[0-9a-fA-F:.]+$/;function _v(e){return gv.test(e)?X_(`http://[${e}]`):!1}var vv=Z(`$ZodIPv6`,(e,t)=>{t.pattern??=n_,K_.init(e,t),e._zod.check=n=>{_v(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),yv=Z(`$ZodCIDRv4`,(e,t)=>{t.pattern??=r_,K_.init(e,t)});function bv(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:_v(n)}var xv=Z(`$ZodCIDRv6`,(e,t)=>{t.pattern??=i_,K_.init(e,t),e._zod.check=n=>{bv(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Sv(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Cv=/^[0-9a-zA-Z+/]*={0,2}$/,wv=Z(`$ZodBase64`,(e,t)=>{t.pattern??=Cv,K_.init(e,t),e._zod.check=n=>{Sv(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Tv=/^[A-Za-z0-9_-]*$/;function Ev(e){if(!Tv.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Sv(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Dv=Z(`$ZodBase64URL`,(e,t)=>{t.pattern??=Tv,K_.init(e,t),e._zod.check=n=>{Ev(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ov=Z(`$ZodE164`,(e,t)=>{t.pattern??=c_,K_.init(e,t)});function kv(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Av=Z(`$ZodJWT`,(e,t)=>{K_.init(e,t),e._zod.check=n=>{kv(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),jv=Z(`$ZodNumber`,(e,t)=>{V_.init(e,t),e._zod.pattern=__,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Mv=Z(`$ZodNumberFormat`,(e,t)=>{D_.init(e,t),jv.init(e,t)}),Nv=Z(`$ZodBoolean`,(e,t)=>{V_.init(e,t),e._zod.pattern=v_,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Pv=Z(`$ZodUnknown`,(e,t)=>{V_.init(e,t),e._zod.parse=e=>e}),Fv=Z(`$ZodNever`,(e,t)=>{V_.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Iv(e,t,n){e.issues.length&&t.issues.push(...Lh(n,e.issues)),t.value[n]=e.value}var Lv=Z(`$ZodArray`,(e,t)=>{V_.init(e,t);let n=dg.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Iv(t,r,e)));else if(Iv(c,r,e),s&&c.issues.length!==0&&Fh(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Rv(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Lh(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var zv=[];function Bv(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:zv,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ch(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Vv(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Fh(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Rv(e,n,i,t,d,f))):Rv(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Hv=Z(`$ZodObject`,(e,t)=>{V_.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=eh(()=>Bv(t));tg(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||ih(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=hh,o=t.catchall,s,c=dg.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Fh(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Rv(n,t,e,r,a,o))):Rv(s,t,e,r,a,o)}return o?Vv(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Uv=Z(`$ZodObjectJIT`,(e,t)=>{Hv.init(e,t);let n=e._zod.parse,r=eh(()=>Bv(t)),i=dg.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new z_([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
20
20
|
let ${e}_ab = false;
|
|
@@ -68,7 +68,7 @@ From now on git merge / pull / rebase merges boxglow.json box by box automatical
|
|
|
68
68
|
|
|
69
69
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=hh,c=!dg.jitless,l=c&&gh.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Vv([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Wv(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Fh(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Bh(e,r,fg())))}),t)}var Gv=Z(`$ZodUnion`,(e,t)=>{V_.init(e,t),tg(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),tg(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),tg(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),tg(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>nh(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Wv(t,r,e,i)):Wv(o,r,e,i)}}),Kv=Z(`$ZodIntersection`,(e,t)=>{V_.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Jv(e,t,n)):Jv(e,i,a)}});function qv(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_h(e)&&_h(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=qv(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=qv(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Jv(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=qv(t.value,n.value);if(!c.valid){if(Fh(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Yv=Z(`$ZodRecord`,(e,t)=>{V_.init(e,t);let n=dg.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!_h(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Bh(e,i,fg())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Lh(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Lh(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&__.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Bh(e,i,fg())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Lh(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Lh(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Xv=Z(`$ZodEnum`,(e,t)=>{V_.init(e,t);let n=Xm(t.entries),r=new Set(n);e._zod.values=r,tg(e,`pattern`,e=>{let t=Xm(e.def.entries).filter(e=>yh.has(typeof e));return RegExp(t.length?`^(${t.map(e=>bh(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Zv=Z(`$ZodLiteral`,(e,t)=>{V_.init(e,t);let n=new Set(t.values);e._zod.values=n,tg(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?bh(e):e?bh(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Qv=Z(`$ZodTransform`,(e,t)=>{V_.init(e,t),e._zod.optin=`optional`,dg.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ug(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new lg;return n.value=i,n}});function $v(e,t){return e.value=t.issues.length?void 0:t.value,e}var ey=Z(`$ZodOptional`,(e,t)=>{V_.init(e,t),tg(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,tg(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),tg(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${nh(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>$v(e,t)):$v(e,r)}return t.innerType._zod.run(e,n)}}),ty=Z(`$ZodExactOptional`,(e,t)=>{ey.init(e,t),tg(e,`values`,e=>e.def.innerType._zod.values),tg(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ny=Z(`$ZodNullable`,(e,t)=>{V_.init(e,t),tg(e,`optin`,e=>e.def.innerType._zod.optin),tg(e,`optout`,e=>e.def.innerType._zod.optout),tg(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${nh(t.source)}|null)$`):void 0}),tg(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ry=Z(`$ZodDefault`,(e,t)=>{V_.init(e,t),e._zod.optin=`defaulted`,tg(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>iy(e,t)):iy(r,t)}});function iy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ay=Z(`$ZodPrefault`,(e,t)=>{V_.init(e,t),e._zod.optin=`defaulted`,tg(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),oy=Z(`$ZodNonOptional`,(e,t)=>{V_.init(e,t),tg(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>sy(t,e)):sy(i,e)}});function sy(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function cy(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Bh(e,r,fg()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ly=Z(`$ZodCatch`,(e,t)=>{V_.init(e,t),tg(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),tg(e,`optout`,e=>e.def.innerType._zod.optout),tg(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>cy(e,r,t,n)):cy(e,r,t,n)}}),uy=Z(`$ZodPipe`,(e,t)=>{V_.init(e,t),tg(e,`values`,e=>e.def.in._zod.values),tg(e,`optin`,e=>e.def.in._zod.optin),tg(e,`optout`,e=>e.def.out._zod.optout),tg(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>dy(e,t.in,n)):dy(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>dy(e,t.out,n)):dy(r,t.out,n)}});function dy(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var fy=Z(`$ZodReadonly`,(e,t)=>{V_.init(e,t),tg(e,`propValues`,e=>e.def.innerType._zod.propValues),tg(e,`values`,e=>e.def.innerType._zod.values),tg(e,`optin`,e=>e.def.innerType?._zod?.optin),tg(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(py):py(r)}});function py(e){return e.memo||(e.value=Object.freeze(e.value)),e}var my=Z(`$ZodCustom`,(e,t)=>{x_.init(e,t),V_.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>hy(t,n,r,e));hy(i,n,r,e)}});function hy(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Gh(e))}}var gy=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},_y=`~memo`,vy=[];function yy(e){return typeof e==`object`&&!!e}function by(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var xy=new WeakMap,Sy=0,Cy=1,wy=2;function Ty(e,t,n){let r=xy.get(e);if(r!==void 0)return r?wy:Sy;if(t.has(e))return wy;t.add(e);let i=Sy,a=e=>{if(i!==wy&&e?._zod){let r=Ty(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Sy;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Cy:o.value?._zod?Ty(o.value,t,n):Sy;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ah(c);s(e?o(e,!0):Cy),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ty(r,t,!1):Cy);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Ey(e,i)}function Ey(e,t){return t!==Cy&&xy.set(e,t===wy),t}function Dy(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Oy,ky=[],Ay={alloc(e,t,n){let r=Oy;if(!r)return n;Oy=void 0;let i={value:n,issues:null};return r.set(t.value,i),ky.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&My(n,e.value))throw new gy;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ty(e,new Set,!1);if(i===Sy)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===wy||r?n=!0:r=!0}let l=s.value;if(!yy(l))return t(s,c);let u=c[_y];u||(u={buckets:new WeakMap,backEdges:void 0},c[_y]=u);let d;i===c?d=a:(d=Dy(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...by(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Oy=d;let p=ky.length,m=t(s,c);Oy=void 0;let h=ky.length>p?ky.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?by(e.issues):vy),e)):(h&&(h.issues=m.issues.length?by(m.issues):vy),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function jy(){return Ay}function My(e,t){let n=e[_y]?.backEdges;return n!==void 0&&yy(t)&&n.has(t)}var Ny=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Wh(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Sh(e.values[0])}`:`Invalid option: expected one of ${Zm(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Zm(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Py(){return{localeError:Ny()}}var Fy,Iy=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ly(){return new Iy}(Fy=globalThis).__zod_globalRegistry??(Fy.__zod_globalRegistry=Ly());var Ry=globalThis.__zod_globalRegistry;function zy(e){return e.checks&&=[...e.checks],e}function By(e,t){return new e(zy({type:`string`,...X(t)}))}function Vy(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...X(t)})}function Hy(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...X(t)})}function Uy(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...X(t)})}function Wy(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...X(t)})}function Gy(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...X(t)})}function Ky(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...X(t)})}function qy(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...X(t)})}function Jy(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...X(t)})}function Yy(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...X(t)})}function Xy(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...X(t)})}function Zy(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...X(t)})}function Qy(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...X(t)})}function $y(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...X(t)})}function eb(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...X(t)})}function tb(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...X(t)})}function nb(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...X(t)})}function rb(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...X(t)})}function ib(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...X(t)})}function ab(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...X(t)})}function ob(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...X(t)})}function sb(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...X(t)})}function cb(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...X(t)})}function lb(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...X(t)})}function ub(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...X(t)})}function db(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...X(t)})}function fb(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...X(t)})}function pb(e,t){return new e(zy({type:`number`,checks:[],...X(t)}))}function mb(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...X(t)})}function hb(e,t){return new e({type:`boolean`,...X(t)})}function gb(e){return new e({type:`unknown`})}function _b(e,t){return new e({type:`never`,...X(t)})}function vb(e,t){return new w_({check:`less_than`,...X(t),value:e,inclusive:!1})}function yb(e,t){return new w_({check:`less_than`,...X(t),value:e,inclusive:!0})}function bb(e,t){return new T_({check:`greater_than`,...X(t),value:e,inclusive:!1})}function xb(e,t){return new T_({check:`greater_than`,...X(t),value:e,inclusive:!0})}function Sb(e,t){return new E_({check:`multiple_of`,...X(t),value:e})}function Cb(e,t){return new O_({check:`max_length`,...X(t),maximum:e})}function wb(e,t){return new k_({check:`min_length`,...X(t),minimum:e})}function Tb(e,t){return new A_({check:`length_equals`,...X(t),length:e})}function Eb(e,t){return new M_({check:`string_format`,format:`regex`,...X(t),pattern:e})}function Db(e){return new N_({check:`string_format`,format:`lowercase`,...X(e)})}function Ob(e){return new P_({check:`string_format`,format:`uppercase`,...X(e)})}function kb(e,t){return new F_({check:`string_format`,format:`includes`,...X(t),includes:e})}function Ab(e,t){return new I_({check:`string_format`,format:`starts_with`,...X(t),prefix:e})}function jb(e,t){return new L_({check:`string_format`,format:`ends_with`,...X(t),suffix:e})}function Mb(e){return new R_({check:`overwrite`,tx:e})}function Nb(e){return Mb(t=>t.normalize(e))}function Pb(){return Mb(e=>e.trim())}function Fb(){return Mb(e=>e.toLowerCase())}function Ib(){return Mb(e=>e.toUpperCase())}function Lb(){return Mb(e=>ph(e))}function Rb(e,t,n){return new e({type:`array`,element:t,...X(n)})}function zb(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...X(n)})}function Bb(e,t){let n=Vb(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Gh(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Gh(r))}},e(t.value,t)),t);return n}function Vb(e,t){let n=new x_({check:`custom`,...X(t)});return n._zod.check=e,n}function Hb(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ih(e,t,n[t]);return e}function Ub(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ry,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Wb(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Gb(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Gb(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Hb(o.schema,c),t.io===`input`&&tx(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Kb(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function qb(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Kb(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Kb(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
70
70
|
|
|
71
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Jb(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Jb(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Yb=new Set([`type`,`properties`,`required`,`additionalProperties`]),Xb=[`oneOf`,`anyOf`];function Zb(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Qb(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Yb.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Zb(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ih(n,r,e.length===1?e[0]:Qb(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Zb(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function $b(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Yb)if(t in e)return;let n=t.filter(e=>Xb.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Qb(t);else{let e=n[0],i=Xb.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Qb([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Hb(e,r))}function ex(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Hb(i,s),Hb(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Jb(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])$b(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Hb(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ih(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:rx(t,`input`,e.processors),output:rx(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function tx(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return tx(r.element,n);if(r.type===`set`)return tx(r.valueType,n);if(r.type===`lazy`)return tx(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return tx(r.innerType,n);if(r.type===`intersection`)return tx(r.left,n)||tx(r.right,n);if(r.type===`record`||r.type===`map`)return tx(r.keyType,n)||tx(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:tx(r.in,n)||tx(r.out,n);if(r.type===`object`){for(let e in r.shape)if(tx(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(tx(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(tx(e,n))return!0;return!!(r.rest&&tx(r.rest,n))}return!1}var nx=(e,t={})=>n=>{let r=Ub({...n,processors:t});return Gb(e,r),qb(r,e),ex(r,e)},rx=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ub({...i??{},target:a,io:t,processors:n});return Gb(e,o),qb(o,e),ex(o,e)},ix=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ax=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ox=(e,t)=>{ix(e,`minimum`,t),ax(e,`maximum`,t)},sx=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},cx=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},lx=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ux=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},dx=(e,t)=>ix(e,`minimum`,t.minimum),fx=(e,t)=>ax(e,`maximum`,t.maximum),px=e=>(t,n)=>{ux(t,n.format);let[r,i]=e[n.format];ix(t,`minimum`,r),ax(t,`maximum`,i)},mx={greater_than:(e,t)=>ix(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>ax(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>sx(e,t.value),number_format:px(wh),bigint_format:px(Th),min_length:dx,max_length:fx,length_equals:(e,t)=>ox(e,t.length),min_size:dx,max_size:fx,size_equals:(e,t)=>ox(e,t.size),string_format:(e,t)=>{ux(e,t.format),t.pattern&&cx(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>lx(e,t.mime)};function hx(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)mx[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ix(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ix(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&ax(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&ax(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&sx(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&lx(t,i.mime);for(let e of i.patterns??[])cx(t,e);return t}var gx={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_x=new Map([[Cv,a_],[Tv,o_]]),vx=e=>_x.get(e)??e,yx=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=hx(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=gx[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(vx);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},bx=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=hx(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Wb(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},xx=(e,t,n,r)=>{n.type=`boolean`},Sx=(e,t,n,r)=>{n.not={}},Cx=(e,t,n,r)=>{let i=e._zod.def,a=Xm(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},wx=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Wb(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Wb(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Tx=(e,t,n,r)=>{Wb(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ex=(e,t,n,r)=>{Wb(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Dx=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=hx(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Gb(a.element,t,{...r,path:[...r.path,`items`]})};function Ox(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ox(t.out):t.type===`catch`?Ox(t.innerType):e._zod.optin}var kx=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Wb(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ih(i.properties,e,Gb(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ox(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Gb(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ax=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Gb(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},jx=(e,t,n,r)=>{let i=e._zod.def,a=Gb(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Gb(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Mx(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Mx(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Mx(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?__:g_).source),p):p}var Nx=new WeakMap;function Px(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Nx.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Mx(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Fx=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=hx(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Gb(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)ih(i.patternProperties,vx(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Gb(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Nx.get(t);n||(n=[],Nx.set(t,n),t.deferred.push(()=>Px(t))),n.push(e)}i.additionalProperties=Gb(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ox(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ix=(e,t,n,r)=>{let i=e._zod.def,a=Gb(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Lx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rx=Symbol();function zx(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Wb(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Rx):JSON.parse(o)}var Bx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=zx(i.defaultValue,e,t,n,r);o!==Rx&&(n.default=o)},Vx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=zx(i.defaultValue,e,t,n,r);o!==Rx&&(n._prefault=o)},Hx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Wb(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ux=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Gb(o,t,r);let s=t.seen.get(e);s.ref=o},Wx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Gx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kx=new WeakSet([Object.prototype,Error.prototype]);function qx(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Jx=Z(`ZodError`,(e,t)=>{yg.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Kx.has(n)||(Kx.add(n),qx(n,`format`,e=>t=>Sg(e,t)),qx(n,`flatten`,e=>t=>xg(e,t)),qx(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Qm,2)}),qx(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Qm,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Yx=wg(Jx),Xx=Tg(Jx),Zx=Eg(Jx),Qx=Og(Jx),$x=Pg(Jx),eS=Fg(Jx),tS=Ig(Jx),nS=Lg(Jx),rS=Rg(Jx),iS=zg(Jx),aS=Bg(Jx),oS=Vg(Jx);function sS(){dg.localeError||fg(Py())}function cS(){dg.memoizer||fg({memoizer:jy()})}var lS=Z(`ZodType`,(e,t)=>(sS(),V_.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(dh(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return xh(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(DC(e,t))},superRefine(e,t){return this.check(OC(e,t))},overwrite(e){return this.check(Mb(e))},optional(){return lC(this)},exactOptional(){return dC(this)},nullable(){return pC(this)},nullish(){return lC(pC(this))},nonoptional(e){return yC(this,e)},array(){return qS(this)},or(e){return ZS([this,e])},and(e){return $S(this,e)},transform(e){return CC(this,sC(e))},default(e){return hC(this,e)},prefault(e){return _C(this,e)},catch(e){return xC(this,e)},pipe(e){return CC(this,e)},readonly(){return TC(this)},describe(e){let t=this.clone();return Ry.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ry.get(this);let t=this.clone();return Ry.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Jh(this,`~standard`,{...W_(this),jsonSchema:{input:rx(this,`input`),output:rx(this,`output`)}})},set"~standard"(e){qh(this,`~standard`,e)},parse:function e(t,n){return Yx(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Xx(this,t,n,{callee:e})},safeParse(e,t){return Zx(this,e,t)},async safeParseAsync(e,t){return Qx(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){qh(this,`spa`,e)},validate(e,t){return jg(this,e,t)},validateAsync(e,t){return Ng(this,e,t)},encode:function e(t,n){return $x(this,t,n,{callee:e})},decode:function e(t,n){return eS(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await tS(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await nS(this,t,n,{callee:e})},safeEncode(e,t){return rS(this,e,t)},safeDecode(e,t){return iS(this,e,t)},async safeEncodeAsync(e,t){return aS(this,e,t)},async safeDecodeAsync(e,t){return oS(this,e,t)},toJSONSchema(e){return nx(this,{})(e)},get description(){return Ry.get(this)?.description},get _def(){return this._zod.def}}),uS=Z(`_ZodString`,(e,t)=>{G_.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yx(e,t,n,r)},Yh({format:e=>hx(e).format??null,minLength:e=>hx(e).minimum??null,maxLength:e=>hx(e).maximum??null},{regex(...e){return this.check(Eb(...e))},includes(...e){return this.check(kb(...e))},startsWith(...e){return this.check(Ab(...e))},endsWith(...e){return this.check(jb(...e))},min(...e){return this.check(wb(...e))},max(...e){return this.check(Cb(...e))},length(...e){return this.check(Tb(...e))},nonempty(...e){return this.check(wb(1,...e))},lowercase(e){return this.check(Db(e))},uppercase(e){return this.check(Ob(e))},trim(){return this.check(Pb())},normalize(...e){return this.check(Nb(...e))},toLowerCase(){return this.check(Fb())},toUpperCase(){return this.check(Ib())},slugify(){return this.check(Lb())}})),dS=Z(`ZodString`,(e,t)=>{G_.init(e,t),uS.init(e,t)},{email(e){return this.check(Vy(_S,e))},url(e){return this.check(qy(bS,e))},jwt(e){return this.check(cb(FS,e))},emoji(e){return this.check(Jy(xS,e))},guid(e){return this.check(Hy(vS,e))},uuid(e){return this.check(Uy(yS,e))},uuidv4(e){return this.check(Wy(yS,e))},uuidv6(e){return this.check(Gy(yS,e))},uuidv7(e){return this.check(Ky(yS,e))},nanoid(e){return this.check(Yy(SS,e))},cuid(e){return this.check(Xy(CS,e))},cuid2(e){return this.check(Zy(wS,e))},ulid(e){return this.check(Qy(TS,e))},base64(e){return this.check(ab(MS,e))},base64url(e){return this.check(ob(NS,e))},xid(e){return this.check($y(ES,e))},ksuid(e){return this.check(eb(DS,e))},ipv4(e){return this.check(tb(OS,e))},ipv6(e){return this.check(nb(kS,e))},cidrv4(e){return this.check(rb(AS,e))},cidrv6(e){return this.check(ib(jS,e))},e164(e){return this.check(sb(PS,e))},datetime(e){return this.check(lb(pS,e))},date(e){return this.check(ub(mS,e))},time(e){return this.check(db(hS,e))},duration(e){return this.check(fb(gS,e))}});function Q(e){return By(dS,e)}var fS=Z(`ZodStringFormat`,(e,t)=>{K_.init(e,t),uS.init(e,t)}),pS=Z(`ZodISODateTime`,(e,t)=>{dv.init(e,t),fS.init(e,t)}),mS=Z(`ZodISODate`,(e,t)=>{fv.init(e,t),fS.init(e,t)}),hS=Z(`ZodISOTime`,(e,t)=>{pv.init(e,t),fS.init(e,t)}),gS=Z(`ZodISODuration`,(e,t)=>{mv.init(e,t),fS.init(e,t)}),_S=Z(`ZodEmail`,(e,t)=>{Y_.init(e,t),fS.init(e,t)}),vS=Z(`ZodGUID`,(e,t)=>{q_.init(e,t),fS.init(e,t)}),yS=Z(`ZodUUID`,(e,t)=>{J_.init(e,t),fS.init(e,t)}),bS=Z(`ZodURL`,(e,t)=>{rv.init(e,t),fS.init(e,t)}),xS=Z(`ZodEmoji`,(e,t)=>{iv.init(e,t),fS.init(e,t)}),SS=Z(`ZodNanoID`,(e,t)=>{av.init(e,t),fS.init(e,t)}),CS=Z(`ZodCUID`,(e,t)=>{ov.init(e,t),fS.init(e,t)}),wS=Z(`ZodCUID2`,(e,t)=>{sv.init(e,t),fS.init(e,t)}),TS=Z(`ZodULID`,(e,t)=>{cv.init(e,t),fS.init(e,t)}),ES=Z(`ZodXID`,(e,t)=>{lv.init(e,t),fS.init(e,t)}),DS=Z(`ZodKSUID`,(e,t)=>{uv.init(e,t),fS.init(e,t)}),OS=Z(`ZodIPv4`,(e,t)=>{hv.init(e,t),fS.init(e,t)}),kS=Z(`ZodIPv6`,(e,t)=>{vv.init(e,t),fS.init(e,t)}),AS=Z(`ZodCIDRv4`,(e,t)=>{yv.init(e,t),fS.init(e,t)}),jS=Z(`ZodCIDRv6`,(e,t)=>{xv.init(e,t),fS.init(e,t)}),MS=Z(`ZodBase64`,(e,t)=>{wv.init(e,t),fS.init(e,t)}),NS=Z(`ZodBase64URL`,(e,t)=>{Dv.init(e,t),fS.init(e,t)}),PS=Z(`ZodE164`,(e,t)=>{Ov.init(e,t),fS.init(e,t)}),FS=Z(`ZodJWT`,(e,t)=>{Av.init(e,t),fS.init(e,t)}),IS=Z(`ZodNumber`,(e,t)=>{jv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bx(e,t,n,r),e.isFinite=!0},Yh({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=hx(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=hx(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=hx(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>hx(e).format??null},{gt(e,t){return this.check(bb(e,t))},gte(e,t){return this.check(xb(e,t))},min(e,t){return this.check(xb(e,t))},lt(e,t){return this.check(vb(e,t))},lte(e,t){return this.check(yb(e,t))},max(e,t){return this.check(yb(e,t))},int(e){return this.check(zS(e))},safe(e){return this.check(zS(e))},positive(e){return this.check(bb(0,e))},nonnegative(e){return this.check(xb(0,e))},negative(e){return this.check(vb(0,e))},nonpositive(e){return this.check(yb(0,e))},multipleOf(e,t){return this.check(Sb(e,t))},step(e,t){return this.check(Sb(e,t))},finite(){return this}}));function LS(e){return pb(IS,e)}var RS=Z(`ZodNumberFormat`,(e,t)=>{Mv.init(e,t),IS.init(e,t)});function zS(e){return mb(RS,e)}var BS=Z(`ZodBoolean`,(e,t)=>{Nv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xx(e,t,n,r)});function VS(e){return hb(BS,e)}var HS=Z(`ZodUnknown`,(e,t)=>{Pv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function US(){return gb(HS)}var WS=Z(`ZodNever`,(e,t)=>{Fv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sx(e,t,n,r)});function GS(e){return _b(WS,e)}var KS=Z(`ZodArray`,(e,t)=>{cS(),Lv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dx(e,t,n,r),e.element=t.element},{min(e,t){return this.check(wb(e,t))},nonempty(e){return this.check(wb(1,e))},max(e,t){return this.check(Cb(e,t))},length(e,t){return this.check(Tb(e,t))},unwrap(){return this.element}});function qS(e,t){return Rb(KS,e,t)}var JS=Z(`ZodObject`,(e,t)=>{cS(),Uv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kx(e,t,n,r),ng(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return rC(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(dh(this._zod.def,{catchall:e}))},passthrough(){return this.clone(dh(this._zod.def,{catchall:US()}))},loose(){return this.clone(dh(this._zod.def,{catchall:US()}))},strict(){return this.clone(dh(this._zod.def,{catchall:GS()}))},strip(){return this.clone(dh(this._zod.def,{catchall:void 0}))},extend(e){return kh(this,e)},safeExtend(e){return jh(this,e)},merge(e){return Mh(this,e)},pick(e){return Eh(this,e)},omit(e){return Oh(this,e)},partial(...e){return Nh(cC,this,e[0])},exactPartial(...e){return Nh(uC,this,e[0],`exactPartial`)},required(...e){return Ph(vC,this,e[0])}});function YS(e,t){return new JS({type:`object`,shape:e??{},...X(t)})}var XS=Z(`ZodUnion`,(e,t)=>{Gv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ax(e,t,n,r),e.options=t.options});function ZS(e,t){return new XS({type:`union`,options:e,...X(t)})}var QS=Z(`ZodIntersection`,(e,t)=>{Kv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jx(e,t,n,r)});function $S(e,t){return new QS({type:`intersection`,left:e,right:t})}var eC=Z(`ZodRecord`,(e,t)=>{cS(),Yv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fx(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function tC(e,t,n){return!t||!t._zod?new eC({type:`record`,keyType:Q(),valueType:e,...X(t)}):new eC({type:`record`,keyType:e,valueType:t,...X(n)})}var nC=Z(`ZodEnum`,(e,t)=>{Xv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cx(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nC({...t,checks:[],...X(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nC({...t,checks:[],...X(r),entries:i})}});function rC(e,t){return new nC({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...X(t)})}var iC=Z(`ZodLiteral`,(e,t)=>{Zv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wx(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function aC(e,t){return new iC({type:`literal`,values:Array.isArray(e)?e:[e],...X(t)})}var oC=Z(`ZodTransform`,(e,t)=>{cS(),Qv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ex(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ug(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Gh(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Gh(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function sC(e){return new oC({type:`transform`,transform:e})}var cC=Z(`ZodOptional`,(e,t)=>{ey.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lC(e){return new cC({type:`optional`,innerType:e})}var uC=Z(`ZodExactOptional`,(e,t)=>{ty.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dC(e){return new uC({type:`optional`,innerType:e})}var fC=Z(`ZodNullable`,(e,t)=>{ny.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ix(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pC(e){return new fC({type:`nullable`,innerType:e})}var mC=Z(`ZodDefault`,(e,t)=>{ry.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hC(e,t){return new mC({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():vh(t)}})}var gC=Z(`ZodPrefault`,(e,t)=>{ay.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _C(e,t){return new gC({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():vh(t)}})}var vC=Z(`ZodNonOptional`,(e,t)=>{oy.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yC(e,t){return new vC({type:`nonoptional`,innerType:e,...X(t)})}var bC=Z(`ZodCatch`,(e,t)=>{ly.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xC(e,t){return new bC({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ig(t)})}var SC=Z(`ZodPipe`,(e,t)=>{uy.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ux(e,t,n,r),e.in=t.in,e.out=t.out});function CC(e,t){return new SC({type:`pipe`,in:e,out:t})}var wC=Z(`ZodReadonly`,(e,t)=>{fy.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function TC(e){return new wC({type:`readonly`,innerType:e})}var EC=Z(`ZodCustom`,(e,t)=>{my.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tx(e,t,n,r)});function DC(e,t={}){return zb(EC,e,t)}function OC(e,t){return Bb(e,t)}var kC=YS({x:LS().finite(),y:LS().finite()}),AC=YS({id:Q(),title:Q(),url:Q(),kind:rC([`url`,`file`,`note`,`redmine_issue`,`git`]),note:Q(),repo:Q().optional(),path:Q().optional(),commit:Q().optional(),blob:Q().optional(),state:rC([`ok`,`moved`,`missing`]).optional(),checkedAt:Q().optional()}).passthrough(),jC=YS({id:Q(),question:Q(),options:qS(Q()),askedBy:Q(),askedAt:Q(),answer:Q().optional(),context:Q().optional(),answeredBy:Q().optional(),answeredAt:Q().optional(),ackedBy:Q().optional(),ackedAt:Q().optional(),history:qS(YS({answer:Q(),by:Q(),at:Q(),note:Q().optional()})).optional()}).passthrough(),MC=YS({id:Q(),parentId:Q().nullable(),title:Q(),description:Q(),status:rC([`black`,`gray`,`white`]),assigneeIds:qS(Q()),position:kC,collapsed:VS(),key:Q().optional(),kind:rC([`task`,`project`]).optional(),progress:LS().min(0).max(100).optional(),startDate:Q().optional(),dueDate:Q().optional(),estimateHours:LS().nonnegative().optional(),actualHours:LS().nonnegative().optional(),category:Q().optional(),repo:Q().optional(),issue:Q().optional(),template:YS({id:Q(),name:Q(),version:LS()}).optional(),artifacts:qS(AC),decisions:qS(jC),activity:YS({actor:Q(),state:rC([`working`,`blocked`,`needs_decision`,`waiting_review`]),note:Q(),since:Q()}).nullable()}).passthrough(),NC=YS({id:Q(),blockId:Q(),direction:rC([`in`,`out`]),name:Q(),description:Q(),required:VS(),artifacts:qS(AC),promotedFrom:Q().optional(),groupId:Q().optional()}).passthrough(),PC=YS({portId:Q(),side:rC([`inner`,`outer`])}),FC=YS({id:Q(),from:PC,to:PC,kind:rC([`sibling`,`up`,`down`,`through`]),auto:VS()}),IC=YS({schemaVersion:aC(5),id:Q().min(1),name:Q(),description:Q(),createdAt:Q(),visibility:rC([`private`,`link`,`public`]),members:qS(YS({id:Q(),name:Q(),color:Q()})),blocks:tC(Q(),MC),ports:tC(Q(),NC),edges:tC(Q(),FC),terminals:YS({in:kC,out:kC}),log:qS(YS({id:Q(),at:Q(),actor:Q(),kind:Q(),message:Q()}).passthrough()),agents:tC(Q(),YS({lastSeen:Q()})),lang:rC([`ja`,`en`]).optional(),nextKey:LS().int().positive().optional(),inputGroups:qS(YS({id:Q(),name:Q(),description:Q(),position:kC})).optional(),contextGuard:VS().optional(),handoffs:tC(Q(),YS({note:Q(),actor:Q(),at:Q()})).optional()}).passthrough();function LC(e){let t=JSON.parse(e);IC.parse(t);let n=t;for(let e of[n.blocks,n.ports,n.edges,n.agents,n.handoffs??{}])for(let t of Object.keys(e))if([`__proto__`,`constructor`,`prototype`].includes(t))throw Error(q(`使えないキーです: {key}`,{key:t}));if(!n.blocks.root||n.blocks.root.parentId!==null)throw Error(q(`最上位のボックス (root) がありません`));for(let[e,t]of Object.entries(n.blocks)){if(e!==t.id||e!==`root`&&(!t.parentId||!n.blocks[t.parentId]))throw Error(q(`ボックスの参照が正しくありません: {id}`,{id:e}));let r=new Set,i=e;for(;i!==null;){if(r.has(i))throw Error(q(`ボックスの親子が循環しています: {id}`,{id:e}));if(r.size>=256)throw Error(q(`階層が深すぎます (256 段まで)`));if(r.add(i),!n.blocks[i])throw Error(q(`ボックスの参照が正しくありません: {id}`,{id:e}));i=n.blocks[i].parentId}}for(let[e,t]of Object.entries(n.ports))if(e!==t.id||!n.blocks[t.blockId]||t.promotedFrom&&!n.ports[t.promotedFrom])throw Error(q(`入出力の参照が正しくありません: {id}`,{id:e}));for(let[e,t]of Object.entries(n.edges)){if(e!==t.id||!n.ports[t.from.portId]||!n.ports[t.to.portId])throw Error(q(`線の参照が正しくありません: {id}`,{id:e}));let r=dp(n,t.from,t.to);if(!r.ok)throw Error(q(`線のつなぎ方が正しくありません: {id}: {reason}`,{id:e,reason:r.reason??``}));if(r.kind!==t.kind)throw Error(q(`線の種類が正しくありません: {id}`,{id:e}))}return Up(e)}var RC=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},zC=(e=>e?RC(e):RC),BC=e=>e;function VC(e,t=BC){let n=y.useSyncExternalStore(e.subscribe,y.useCallback(()=>t(e.getState()),[e,t]),y.useCallback(()=>t(e.getInitialState()),[e,t]));return y.useDebugValue(n),n}var HC=e=>{let t=zC(e),n=e=>VC(t,e);return Object.assign(n,t),n},UC=(e=>e?HC(e):HC);function WC(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function GC(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=WC(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{n=void 0}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var KC;function qC(){return KC||=GC(`keyval-store`,`keyval`),KC}function JC(e,t=qC()){return t(`readonly`,t=>WC(t.get(e)))}function YC(e,t,n=qC()){return n(`readwrite`,n=>(n.put(t,e),WC(n.transaction)))}function XC(e,t=qC()){return t(`readwrite`,t=>(t.delete(e),WC(t.transaction)))}var ZC=`boxglow:lastFileHandle`,QC=()=>typeof window<`u`&&typeof window.showOpenFilePicker==`function`;async function $C(){if(!window.showOpenFilePicker)return null;let e;try{[e]=await window.showOpenFilePicker({multiple:!1,types:[{description:`Boxglow project`,accept:{"application/json":[`.json`]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return null;throw e}try{await YC(ZC,e)}catch{}return e}async function ew(){try{return await JC(ZC)??null}catch{return null}}async function tw(e,t=`readwrite`){try{return await e.queryPermission({mode:t})===`granted`||await e.requestPermission({mode:t})===`granted`}catch{return!1}}async function nw(e){let t=await e.getFile();return{text:await t.text(),lastModified:t.lastModified}}var rw=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function iw(e,t,n,r,i){if(rw(n,r))return n;if(rw(n,t))return i.merged++,r;if(rw(r,t))return n;let a=JSON.stringify(e),o=i.choices[a]??(n===void 0&&r!==void 0?`theirs`:`ours`);return i.conflicts.push({id:a,path:e.join(`.`),segments:e,ours:n,theirs:r,adopted:o}),o===`theirs`?r:n}function aw(e,t,n,r,i){let a={},o=new Set([...Object.keys(n),...Object.keys(r),...Object.keys(t??{})]);for(let s of o){let o=t?.[s],c=n[s],l=r[s],u=iw([...e,s],o,c,l,i);u!==void 0&&(a[s]=u)}return a}function ow(e,t,n,r,i){let a={},o=new Set([...Object.keys(n),...Object.keys(r),...Object.keys(t??{})]);for(let s of o){let o=t?.[s],c=n[s],l=r[s];if(c&&l&&e[0]!==`handoffs`){a[s]=aw([...e,s],o,c,l,i);continue}let u=iw([...e,s],o,c,l,i);u!==void 0&&(a[s]=u)}return a}function sw(e,t,n,r,i){let a=e=>Object.fromEntries((e??[]).map(e=>[e.id,e])),o=ow(e,t?a(t):void 0,a(n),a(r),i);return[...n.map(e=>e.id),...r.map(e=>e.id).filter(e=>!n.some(t=>t.id===e))].filter(e=>o[e]).map(e=>o[e])}function cw(e,t,n){let r=e.blocks,i=e.ports,a=e.edges,o=e=>!t.blocks[e]&&!!n.blocks[e],s=new Set;for(let e of Object.keys(r))o(e)&&s.add(e);for(let e of Object.values(i)){let n=e.blockId;!r[n]&&o(n)&&!t.ports[e.id]&&s.add(n)}if(s.size===0)return;let c=new Set;for(let e of s){let t=e;for(let e=n.blocks[t]?.parentId;e&&o(e);e=n.blocks[t]?.parentId)t=e;c.add(t)}let l=new Set(c);for(let e=!0;e;){e=!1;for(let t of Object.values(n.blocks))t.parentId&&l.has(t.parentId)&&!l.has(t.id)&&(l.add(t.id),e=!0)}for(let e of l)r[e]||(r[e]=n.blocks[e]);for(let e of Object.values(n.ports))l.has(e.blockId)&&!i[e.id]&&(i[e.id]=e);if(n.handoffs){let t=e.handoffs??{};for(let e of l)n.handoffs[e]&&!t[e]&&(t[e]=n.handoffs[e]);e.handoffs=t}for(let e of Object.values(n.edges)){if(a[e.id]||!i[e.from.portId]||!i[e.to.portId])continue;let t=n.ports[e.from.portId]?.blockId,r=n.ports[e.to.portId]?.blockId;(t&&l.has(t)||r&&l.has(r))&&(a[e.id]=e)}}function lw(e,t,n,r={}){let i={project:t,merged:0,conflicts:[],choices:r},a=e??void 0,o=t,s=n,c={...o};for(let e of[`name`,`description`,`visibility`,`terminals`,`contextGuard`])c[e]=iw([e],a?.[e],o[e],s[e],i);for(let e of[`blocks`,`ports`,`edges`,`agents`,`handoffs`])c[e]=ow([e],a?.[e],o[e]??{},s[e]??{},i);cw(c,t,n),cw(c,n,t);let l=c.blocks,u=c.ports,d=c.edges;for(let[e,t]of Object.entries(u))l[t.blockId]||delete u[e];for(let[e,t]of Object.entries(d)){let n=t;(!u[n.from?.portId]||!u[n.to?.portId])&&delete d[e]}let f=c.handoffs;for(let r of Object.keys(f))!l[r]&&(t.blocks[r]||n.blocks[r]||e?.blocks[r])&&delete f[r];Object.keys(f).length===0&&!t.handoffs&&!n.handoffs&&delete c.handoffs,c.members=sw([`members`],e?.members,t.members??[],n.members??[],i),c.inputGroups=sw([`inputGroups`],e?.inputGroups,t.inputGroups??[],n.inputGroups??[],i);let p=new Map;for(let e of[...t.log??[],...n.log??[]])p.set(e.id,e);c.log=[...p.values()].sort((e,t)=>e.at<t.at?-1:+(e.at>t.at));let m=c.blocks,h=new Map,g=Math.max(t.nextKey??1,n.nextKey??1);for(let e of Object.keys(t.blocks??{})){let t=m[e]?.key;t&&h.set(t,e)}for(let e of Object.keys(m)){let t=m[e].key;if(!t)continue;let n=h.get(t);n&&n!==e?(m[e]={...m[e],key:`B${g}`},i.conflicts.push({id:JSON.stringify([`blocks`,e,`key`]),segments:[`blocks`,e,`key`],automatic:!0,path:`blocks.${e}.key`,ours:t,theirs:q(`{key} に振り直し`,{key:`B${g}`})}),g++):h.set(t,e)}return c.nextKey=g,i.project=c,{project:i.project,merged:i.merged,conflicts:i.conflicts}}function uw(){let e=Wf(`Web アプリを公開する`);e.description=`小さな Web アプリを、要件の整理から公開までボックスに分けて進める例。ボックスが完了するごとに、右端の最終成果物に近づく。`;let t=J(e)[0].id;e.blocks[t].description=e.description,e.blocks[t].status=`gray`;let n=Ap(e,`さとう`,`#0d8080`);e=n.project;let r=Ap(e,`たなか`,`#e8875e`);e=r.project;let i=Y(e,t,`out`)[0];e=Cp(e,i.id,{name:`公開した Web アプリ`,description:`誰でも開ける URL と、使い方の説明`}),e=Cp(e,Y(e,Ff,`out`)[0].id,{name:`公開した Web アプリ`});let a=yp(e,{blockId:t,direction:`in`,name:`企画メモ`});e=Cp(a.project,a.portId,{description:`何を作りたいかの箇条書き`,artifacts:[ep(`企画メモ (Notion)`,`https://example.com/plan`)]});let o=mp(e,{parentId:t,title:`要件を決める`,position:{x:48,y:72}});e=o.project;let s=mp(e,{parentId:t,title:`設計する`,position:{x:400,y:72}});e=s.project;let c=mp(e,{parentId:t,title:`実装する`,position:{x:80,y:320}});e=c.project;let l=mp(e,{parentId:t,title:`公開する`,position:{x:780,y:420}});e=l.project,e=lm(e,o.blockId,`study`),e=lm(e,s.blockId,`design`),e=lm(e,c.blockId,`build`),e=lm(e,l.blockId,`ops`);let u=yp(e,{blockId:o.blockId,direction:`in`,name:`企画メモ`});e=u.project;let d=Y(e,o.blockId,`out`)[0];e=Cp(e,d.id,{name:`要件一覧`,artifacts:[ep(`要件一覧 v1`,`https://example.com/requirements`)]}),e=hp(e,o.blockId,{status:`white`,assigneeIds:[n.memberId],description:`企画メモを読み、機能を箇条書きにする。優先度を付ける。`}),e=Op(e,{portId:a.portId,side:`inner`},{portId:u.portId,side:`outer`}).project;let f=yp(e,{blockId:s.blockId,direction:`in`,name:`要件一覧`});e=f.project;let p=Y(e,s.blockId,`out`)[0];e=Cp(e,p.id,{name:`設計書`,description:`画面設計 (Figma) と API 仕様 (OpenAPI) をまとめたもの`,artifacts:[ep(`画面設計 (Figma)`,`https://example.com/figma`),ep(`OpenAPI 定義`,`https://example.com/openapi.yaml`)]}),e=hp(e,s.blockId,{status:`white`,assigneeIds:[n.memberId]}),e=Op(e,{portId:d.id,side:`outer`},{portId:f.portId,side:`outer`}).project;let m=yp(e,{blockId:c.blockId,direction:`in`,name:`設計書`});e=m.project;let h=Y(e,c.blockId,`out`)[0];e=Cp(e,h.id,{name:`動くアプリ一式`,description:`テストが通ったビルド成果物`}),e=hp(e,c.blockId,{status:`gray`,assigneeIds:[n.memberId,r.memberId],description:`設計をもとに部品を作り、組み合わせて動く状態にする。`}),e=Op(e,{portId:p.id,side:`outer`},{portId:m.portId,side:`outer`}).project;let g=mp(e,{parentId:c.blockId,title:`フロントエンド`,position:{x:48,y:72}});e=g.project;let _=mp(e,{parentId:c.blockId,title:`バックエンド`,position:{x:48,y:232}});e=_.project;let v=mp(e,{parentId:c.blockId,title:`結合テスト`,position:{x:360,y:152}});e=v.project,e=lm(e,v.blockId,`verify`),e=lm(e,g.blockId,`build`),e=lm(e,_.blockId,`build`);let y=yp(e,{blockId:g.blockId,direction:`in`,name:`設計書`});e=y.project;let b=Y(e,g.blockId,`out`)[0];e=Cp(e,b.id,{name:`画面の実装`,artifacts:[ep(`PR #12`,`https://example.com/pr/12`)]}),e=hp(e,g.blockId,{status:`white`,assigneeIds:[r.memberId]}),e=Op(e,{portId:m.portId,side:`inner`},{portId:y.portId,side:`outer`}).project;let x=yp(e,{blockId:_.blockId,direction:`in`,name:`設計書`});e=x.project;let S=Y(e,_.blockId,`out`)[0];e=Cp(e,S.id,{name:`API の実装`}),e=hp(e,_.blockId,{status:`gray`,assigneeIds:[n.memberId],description:`OpenAPI 定義どおりに API を作る。認証はまだ未定。`}),e=Op(e,{portId:m.portId,side:`inner`},{portId:x.portId,side:`outer`}).project;let C=yp(e,{blockId:v.blockId,direction:`in`,name:`画面の実装`});e=C.project;let w=yp(e,{blockId:v.blockId,direction:`in`,name:`API の実装`});e=w.project,e=yp(e,{blockId:v.blockId,direction:`in`,name:`テストデータ`}).project;let T=Y(e,v.blockId,`out`)[0];e=Cp(e,T.id,{name:`テスト済みビルド`}),e=Op(e,{portId:b.id,side:`outer`},{portId:C.portId,side:`outer`}).project,e=Op(e,{portId:S.id,side:`outer`},{portId:w.portId,side:`outer`}).project,e=Op(e,{portId:T.id,side:`outer`},{portId:h.id,side:`inner`}).project;let E=yp(e,{blockId:l.blockId,direction:`in`,name:`動くアプリ一式`});e=E.project;let D=Y(e,l.blockId,`out`)[0];return e=Cp(e,D.id,{name:`公開 URL`}),e=hp(e,l.blockId,{description:`どこに置くかは未定。候補: 静的ホスティング。`}),e=Op(e,{portId:h.id,side:`outer`},{portId:E.portId,side:`outer`}).project,e=Op(e,{portId:D.id,side:`outer`},{portId:i.id,side:`inner`}).project,e=Kp(e,_.blockId,`claude-code`,`working`,`OpenAPI 定義から API のひな形を生成中`),e=Fp(e,_.blockId,40,`claude-code`),e=Jp(e,l.blockId,`codex`,`公開先はどれにしますか?`,[`静的ホスティング`,`自前のサーバー`],`最初に公開するのは静的な紹介ページです。フォーム送信などのサーバー処理は、別の API を使う想定です。
|
|
71
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Jb(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Jb(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Yb=new Set([`type`,`properties`,`required`,`additionalProperties`]),Xb=[`oneOf`,`anyOf`];function Zb(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Qb(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Yb.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Zb(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ih(n,r,e.length===1?e[0]:Qb(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Zb(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function $b(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Yb)if(t in e)return;let n=t.filter(e=>Xb.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Qb(t);else{let e=n[0],i=Xb.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Qb([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Hb(e,r))}function ex(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Hb(i,s),Hb(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Jb(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])$b(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Hb(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ih(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:rx(t,`input`,e.processors),output:rx(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function tx(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return tx(r.element,n);if(r.type===`set`)return tx(r.valueType,n);if(r.type===`lazy`)return tx(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return tx(r.innerType,n);if(r.type===`intersection`)return tx(r.left,n)||tx(r.right,n);if(r.type===`record`||r.type===`map`)return tx(r.keyType,n)||tx(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:tx(r.in,n)||tx(r.out,n);if(r.type===`object`){for(let e in r.shape)if(tx(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(tx(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(tx(e,n))return!0;return!!(r.rest&&tx(r.rest,n))}return!1}var nx=(e,t={})=>n=>{let r=Ub({...n,processors:t});return Gb(e,r),qb(r,e),ex(r,e)},rx=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ub({...i??{},target:a,io:t,processors:n});return Gb(e,o),qb(o,e),ex(o,e)},ix=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ax=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ox=(e,t)=>{ix(e,`minimum`,t),ax(e,`maximum`,t)},sx=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},cx=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},lx=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ux=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},dx=(e,t)=>ix(e,`minimum`,t.minimum),fx=(e,t)=>ax(e,`maximum`,t.maximum),px=e=>(t,n)=>{ux(t,n.format);let[r,i]=e[n.format];ix(t,`minimum`,r),ax(t,`maximum`,i)},mx={greater_than:(e,t)=>ix(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>ax(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>sx(e,t.value),number_format:px(wh),bigint_format:px(Th),min_length:dx,max_length:fx,length_equals:(e,t)=>ox(e,t.length),min_size:dx,max_size:fx,size_equals:(e,t)=>ox(e,t.size),string_format:(e,t)=>{ux(e,t.format),t.pattern&&cx(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>lx(e,t.mime)};function hx(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)mx[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ix(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ix(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&ax(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&ax(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&sx(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&lx(t,i.mime);for(let e of i.patterns??[])cx(t,e);return t}var gx={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_x=new Map([[Cv,a_],[Tv,o_]]),vx=e=>_x.get(e)??e,yx=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=hx(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=gx[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(vx);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},bx=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=hx(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Wb(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},xx=(e,t,n,r)=>{n.type=`boolean`},Sx=(e,t,n,r)=>{n.not={}},Cx=(e,t,n,r)=>{let i=e._zod.def,a=Xm(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},wx=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Wb(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Wb(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Tx=(e,t,n,r)=>{Wb(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ex=(e,t,n,r)=>{Wb(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Dx=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=hx(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Gb(a.element,t,{...r,path:[...r.path,`items`]})};function Ox(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ox(t.out):t.type===`catch`?Ox(t.innerType):e._zod.optin}var kx=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Wb(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ih(i.properties,e,Gb(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ox(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Gb(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ax=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Gb(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},jx=(e,t,n,r)=>{let i=e._zod.def,a=Gb(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Gb(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Mx(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Mx(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Mx(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?__:g_).source),p):p}var Nx=new WeakMap;function Px(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Nx.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Mx(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Fx=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=hx(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Gb(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)ih(i.patternProperties,vx(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Gb(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Nx.get(t);n||(n=[],Nx.set(t,n),t.deferred.push(()=>Px(t))),n.push(e)}i.additionalProperties=Gb(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ox(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ix=(e,t,n,r)=>{let i=e._zod.def,a=Gb(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Lx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rx=Symbol();function zx(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Wb(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Rx):JSON.parse(o)}var Bx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=zx(i.defaultValue,e,t,n,r);o!==Rx&&(n.default=o)},Vx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=zx(i.defaultValue,e,t,n,r);o!==Rx&&(n._prefault=o)},Hx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Wb(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ux=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Gb(o,t,r);let s=t.seen.get(e);s.ref=o},Wx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Gx=(e,t,n,r)=>{let i=e._zod.def;Gb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kx=new WeakSet([Object.prototype,Error.prototype]);function qx(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Jx=Z(`ZodError`,(e,t)=>{yg.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Kx.has(n)||(Kx.add(n),qx(n,`format`,e=>t=>Sg(e,t)),qx(n,`flatten`,e=>t=>xg(e,t)),qx(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Qm,2)}),qx(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Qm,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Yx=wg(Jx),Xx=Tg(Jx),Zx=Eg(Jx),Qx=Og(Jx),$x=Pg(Jx),eS=Fg(Jx),tS=Ig(Jx),nS=Lg(Jx),rS=Rg(Jx),iS=zg(Jx),aS=Bg(Jx),oS=Vg(Jx);function sS(){dg.localeError||fg(Py())}function cS(){dg.memoizer||fg({memoizer:jy()})}var lS=Z(`ZodType`,(e,t)=>(sS(),V_.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(dh(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return xh(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(DC(e,t))},superRefine(e,t){return this.check(OC(e,t))},overwrite(e){return this.check(Mb(e))},optional(){return lC(this)},exactOptional(){return dC(this)},nullable(){return pC(this)},nullish(){return lC(pC(this))},nonoptional(e){return yC(this,e)},array(){return qS(this)},or(e){return ZS([this,e])},and(e){return $S(this,e)},transform(e){return CC(this,sC(e))},default(e){return hC(this,e)},prefault(e){return _C(this,e)},catch(e){return xC(this,e)},pipe(e){return CC(this,e)},readonly(){return TC(this)},describe(e){let t=this.clone();return Ry.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ry.get(this);let t=this.clone();return Ry.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Jh(this,`~standard`,{...W_(this),jsonSchema:{input:rx(this,`input`),output:rx(this,`output`)}})},set"~standard"(e){qh(this,`~standard`,e)},parse:function e(t,n){return Yx(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Xx(this,t,n,{callee:e})},safeParse(e,t){return Zx(this,e,t)},async safeParseAsync(e,t){return Qx(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){qh(this,`spa`,e)},validate(e,t){return jg(this,e,t)},validateAsync(e,t){return Ng(this,e,t)},encode:function e(t,n){return $x(this,t,n,{callee:e})},decode:function e(t,n){return eS(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await tS(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await nS(this,t,n,{callee:e})},safeEncode(e,t){return rS(this,e,t)},safeDecode(e,t){return iS(this,e,t)},async safeEncodeAsync(e,t){return aS(this,e,t)},async safeDecodeAsync(e,t){return oS(this,e,t)},toJSONSchema(e){return nx(this,{})(e)},get description(){return Ry.get(this)?.description},get _def(){return this._zod.def}}),uS=Z(`_ZodString`,(e,t)=>{G_.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yx(e,t,n,r)},Yh({format:e=>hx(e).format??null,minLength:e=>hx(e).minimum??null,maxLength:e=>hx(e).maximum??null},{regex(...e){return this.check(Eb(...e))},includes(...e){return this.check(kb(...e))},startsWith(...e){return this.check(Ab(...e))},endsWith(...e){return this.check(jb(...e))},min(...e){return this.check(wb(...e))},max(...e){return this.check(Cb(...e))},length(...e){return this.check(Tb(...e))},nonempty(...e){return this.check(wb(1,...e))},lowercase(e){return this.check(Db(e))},uppercase(e){return this.check(Ob(e))},trim(){return this.check(Pb())},normalize(...e){return this.check(Nb(...e))},toLowerCase(){return this.check(Fb())},toUpperCase(){return this.check(Ib())},slugify(){return this.check(Lb())}})),dS=Z(`ZodString`,(e,t)=>{G_.init(e,t),uS.init(e,t)},{email(e){return this.check(Vy(_S,e))},url(e){return this.check(qy(bS,e))},jwt(e){return this.check(cb(FS,e))},emoji(e){return this.check(Jy(xS,e))},guid(e){return this.check(Hy(vS,e))},uuid(e){return this.check(Uy(yS,e))},uuidv4(e){return this.check(Wy(yS,e))},uuidv6(e){return this.check(Gy(yS,e))},uuidv7(e){return this.check(Ky(yS,e))},nanoid(e){return this.check(Yy(SS,e))},cuid(e){return this.check(Xy(CS,e))},cuid2(e){return this.check(Zy(wS,e))},ulid(e){return this.check(Qy(TS,e))},base64(e){return this.check(ab(MS,e))},base64url(e){return this.check(ob(NS,e))},xid(e){return this.check($y(ES,e))},ksuid(e){return this.check(eb(DS,e))},ipv4(e){return this.check(tb(OS,e))},ipv6(e){return this.check(nb(kS,e))},cidrv4(e){return this.check(rb(AS,e))},cidrv6(e){return this.check(ib(jS,e))},e164(e){return this.check(sb(PS,e))},datetime(e){return this.check(lb(pS,e))},date(e){return this.check(ub(mS,e))},time(e){return this.check(db(hS,e))},duration(e){return this.check(fb(gS,e))}});function Q(e){return By(dS,e)}var fS=Z(`ZodStringFormat`,(e,t)=>{K_.init(e,t),uS.init(e,t)}),pS=Z(`ZodISODateTime`,(e,t)=>{dv.init(e,t),fS.init(e,t)}),mS=Z(`ZodISODate`,(e,t)=>{fv.init(e,t),fS.init(e,t)}),hS=Z(`ZodISOTime`,(e,t)=>{pv.init(e,t),fS.init(e,t)}),gS=Z(`ZodISODuration`,(e,t)=>{mv.init(e,t),fS.init(e,t)}),_S=Z(`ZodEmail`,(e,t)=>{Y_.init(e,t),fS.init(e,t)}),vS=Z(`ZodGUID`,(e,t)=>{q_.init(e,t),fS.init(e,t)}),yS=Z(`ZodUUID`,(e,t)=>{J_.init(e,t),fS.init(e,t)}),bS=Z(`ZodURL`,(e,t)=>{rv.init(e,t),fS.init(e,t)}),xS=Z(`ZodEmoji`,(e,t)=>{iv.init(e,t),fS.init(e,t)}),SS=Z(`ZodNanoID`,(e,t)=>{av.init(e,t),fS.init(e,t)}),CS=Z(`ZodCUID`,(e,t)=>{ov.init(e,t),fS.init(e,t)}),wS=Z(`ZodCUID2`,(e,t)=>{sv.init(e,t),fS.init(e,t)}),TS=Z(`ZodULID`,(e,t)=>{cv.init(e,t),fS.init(e,t)}),ES=Z(`ZodXID`,(e,t)=>{lv.init(e,t),fS.init(e,t)}),DS=Z(`ZodKSUID`,(e,t)=>{uv.init(e,t),fS.init(e,t)}),OS=Z(`ZodIPv4`,(e,t)=>{hv.init(e,t),fS.init(e,t)}),kS=Z(`ZodIPv6`,(e,t)=>{vv.init(e,t),fS.init(e,t)}),AS=Z(`ZodCIDRv4`,(e,t)=>{yv.init(e,t),fS.init(e,t)}),jS=Z(`ZodCIDRv6`,(e,t)=>{xv.init(e,t),fS.init(e,t)}),MS=Z(`ZodBase64`,(e,t)=>{wv.init(e,t),fS.init(e,t)}),NS=Z(`ZodBase64URL`,(e,t)=>{Dv.init(e,t),fS.init(e,t)}),PS=Z(`ZodE164`,(e,t)=>{Ov.init(e,t),fS.init(e,t)}),FS=Z(`ZodJWT`,(e,t)=>{Av.init(e,t),fS.init(e,t)}),IS=Z(`ZodNumber`,(e,t)=>{jv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bx(e,t,n,r),e.isFinite=!0},Yh({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=hx(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=hx(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=hx(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>hx(e).format??null},{gt(e,t){return this.check(bb(e,t))},gte(e,t){return this.check(xb(e,t))},min(e,t){return this.check(xb(e,t))},lt(e,t){return this.check(vb(e,t))},lte(e,t){return this.check(yb(e,t))},max(e,t){return this.check(yb(e,t))},int(e){return this.check(zS(e))},safe(e){return this.check(zS(e))},positive(e){return this.check(bb(0,e))},nonnegative(e){return this.check(xb(0,e))},negative(e){return this.check(vb(0,e))},nonpositive(e){return this.check(yb(0,e))},multipleOf(e,t){return this.check(Sb(e,t))},step(e,t){return this.check(Sb(e,t))},finite(){return this}}));function LS(e){return pb(IS,e)}var RS=Z(`ZodNumberFormat`,(e,t)=>{Mv.init(e,t),IS.init(e,t)});function zS(e){return mb(RS,e)}var BS=Z(`ZodBoolean`,(e,t)=>{Nv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xx(e,t,n,r)});function VS(e){return hb(BS,e)}var HS=Z(`ZodUnknown`,(e,t)=>{Pv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function US(){return gb(HS)}var WS=Z(`ZodNever`,(e,t)=>{Fv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sx(e,t,n,r)});function GS(e){return _b(WS,e)}var KS=Z(`ZodArray`,(e,t)=>{cS(),Lv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dx(e,t,n,r),e.element=t.element},{min(e,t){return this.check(wb(e,t))},nonempty(e){return this.check(wb(1,e))},max(e,t){return this.check(Cb(e,t))},length(e,t){return this.check(Tb(e,t))},unwrap(){return this.element}});function qS(e,t){return Rb(KS,e,t)}var JS=Z(`ZodObject`,(e,t)=>{cS(),Uv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kx(e,t,n,r),ng(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return rC(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(dh(this._zod.def,{catchall:e}))},passthrough(){return this.clone(dh(this._zod.def,{catchall:US()}))},loose(){return this.clone(dh(this._zod.def,{catchall:US()}))},strict(){return this.clone(dh(this._zod.def,{catchall:GS()}))},strip(){return this.clone(dh(this._zod.def,{catchall:void 0}))},extend(e){return kh(this,e)},safeExtend(e){return jh(this,e)},merge(e){return Mh(this,e)},pick(e){return Eh(this,e)},omit(e){return Oh(this,e)},partial(...e){return Nh(cC,this,e[0])},exactPartial(...e){return Nh(uC,this,e[0],`exactPartial`)},required(...e){return Ph(vC,this,e[0])}});function YS(e,t){return new JS({type:`object`,shape:e??{},...X(t)})}var XS=Z(`ZodUnion`,(e,t)=>{Gv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ax(e,t,n,r),e.options=t.options});function ZS(e,t){return new XS({type:`union`,options:e,...X(t)})}var QS=Z(`ZodIntersection`,(e,t)=>{Kv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jx(e,t,n,r)});function $S(e,t){return new QS({type:`intersection`,left:e,right:t})}var eC=Z(`ZodRecord`,(e,t)=>{cS(),Yv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fx(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function tC(e,t,n){return!t||!t._zod?new eC({type:`record`,keyType:Q(),valueType:e,...X(t)}):new eC({type:`record`,keyType:e,valueType:t,...X(n)})}var nC=Z(`ZodEnum`,(e,t)=>{Xv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cx(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nC({...t,checks:[],...X(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nC({...t,checks:[],...X(r),entries:i})}});function rC(e,t){return new nC({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...X(t)})}var iC=Z(`ZodLiteral`,(e,t)=>{Zv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wx(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function aC(e,t){return new iC({type:`literal`,values:Array.isArray(e)?e:[e],...X(t)})}var oC=Z(`ZodTransform`,(e,t)=>{cS(),Qv.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ex(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ug(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Gh(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Gh(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function sC(e){return new oC({type:`transform`,transform:e})}var cC=Z(`ZodOptional`,(e,t)=>{ey.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lC(e){return new cC({type:`optional`,innerType:e})}var uC=Z(`ZodExactOptional`,(e,t)=>{ty.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dC(e){return new uC({type:`optional`,innerType:e})}var fC=Z(`ZodNullable`,(e,t)=>{ny.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ix(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pC(e){return new fC({type:`nullable`,innerType:e})}var mC=Z(`ZodDefault`,(e,t)=>{ry.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hC(e,t){return new mC({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():vh(t)}})}var gC=Z(`ZodPrefault`,(e,t)=>{ay.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _C(e,t){return new gC({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():vh(t)}})}var vC=Z(`ZodNonOptional`,(e,t)=>{oy.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yC(e,t){return new vC({type:`nonoptional`,innerType:e,...X(t)})}var bC=Z(`ZodCatch`,(e,t)=>{ly.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xC(e,t){return new bC({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ig(t)})}var SC=Z(`ZodPipe`,(e,t)=>{uy.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ux(e,t,n,r),e.in=t.in,e.out=t.out});function CC(e,t){return new SC({type:`pipe`,in:e,out:t})}var wC=Z(`ZodReadonly`,(e,t)=>{fy.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function TC(e){return new wC({type:`readonly`,innerType:e})}var EC=Z(`ZodCustom`,(e,t)=>{my.init(e,t),lS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tx(e,t,n,r)});function DC(e,t={}){return zb(EC,e,t)}function OC(e,t){return Bb(e,t)}var kC=YS({x:LS().finite(),y:LS().finite()}),AC=YS({id:Q(),title:Q(),url:Q(),kind:rC([`url`,`file`,`note`,`redmine_issue`,`git`]),note:Q(),repo:Q().optional(),path:Q().optional(),commit:Q().optional(),blob:Q().optional(),state:rC([`ok`,`moved`,`missing`]).optional(),checkedAt:Q().optional()}).passthrough(),jC=YS({id:Q(),question:Q(),options:qS(Q()),askedBy:Q(),askedAt:Q(),answer:Q().optional(),context:Q().optional(),answeredBy:Q().optional(),answeredAt:Q().optional(),ackedBy:Q().optional(),ackedAt:Q().optional(),history:qS(YS({answer:Q(),by:Q(),at:Q(),note:Q().optional()})).optional()}).passthrough(),MC=YS({id:Q(),parentId:Q().nullable(),title:Q(),description:Q(),status:rC([`black`,`gray`,`white`]),assigneeIds:qS(Q()),position:kC,collapsed:VS(),key:Q().optional(),kind:rC([`task`,`project`]).optional(),progress:LS().min(0).max(100).optional(),startDate:Q().optional(),dueDate:Q().optional(),estimateHours:LS().nonnegative().optional(),actualHours:LS().nonnegative().optional(),category:Q().optional(),repo:Q().optional(),issue:Q().optional(),template:YS({id:Q(),name:Q(),version:LS()}).optional(),artifacts:qS(AC),decisions:qS(jC),activity:YS({actor:Q(),state:rC([`working`,`blocked`,`needs_decision`,`waiting_review`]),note:Q(),since:Q()}).nullable()}).passthrough(),NC=YS({id:Q(),blockId:Q(),direction:rC([`in`,`out`]),name:Q(),description:Q(),required:VS(),artifacts:qS(AC),promotedFrom:Q().optional(),groupId:Q().optional()}).passthrough(),PC=YS({portId:Q(),side:rC([`inner`,`outer`])}),FC=YS({id:Q(),from:PC,to:PC,kind:rC([`sibling`,`up`,`down`,`through`]),auto:VS()}),IC=YS({schemaVersion:aC(5),id:Q().min(1),name:Q(),description:Q(),createdAt:Q(),visibility:rC([`private`,`link`,`public`]),members:qS(YS({id:Q(),name:Q(),color:Q()})),blocks:tC(Q(),MC),ports:tC(Q(),NC),edges:tC(Q(),FC),terminals:YS({in:kC,out:kC}),log:qS(YS({id:Q(),at:Q(),actor:Q(),kind:Q(),message:Q()}).passthrough()),agents:tC(Q(),YS({lastSeen:Q()})),lang:rC([`ja`,`en`]).optional(),nextKey:LS().int().positive().optional(),inputGroups:qS(YS({id:Q(),name:Q(),description:Q(),position:kC})).optional(),contextGuard:VS().optional(),handoffs:tC(Q(),YS({note:Q(),actor:Q(),at:Q()})).optional()}).passthrough();function LC(e){let t=JSON.parse(e);IC.parse(t);let n=t;for(let e of[n.blocks,n.ports,n.edges,n.agents,n.handoffs??{}])for(let t of Object.keys(e))if([`__proto__`,`constructor`,`prototype`].includes(t))throw Error(q(`使えないキーです: {key}`,{key:t}));if(!n.blocks.root||n.blocks.root.parentId!==null)throw Error(q(`最上位のボックス (root) がありません`));for(let[e,t]of Object.entries(n.blocks)){if(e!==t.id||e!==`root`&&(!t.parentId||!n.blocks[t.parentId]))throw Error(q(`ボックスの参照が正しくありません: {id}`,{id:e}));let r=new Set,i=e;for(;i!==null;){if(r.has(i))throw Error(q(`ボックスの親子が循環しています: {id}`,{id:e}));if(r.size>=256)throw Error(q(`階層が深すぎます (256 段まで)`));if(r.add(i),!n.blocks[i])throw Error(q(`ボックスの参照が正しくありません: {id}`,{id:e}));i=n.blocks[i].parentId}}for(let[e,t]of Object.entries(n.ports))if(e!==t.id||!n.blocks[t.blockId]||t.promotedFrom&&!n.ports[t.promotedFrom])throw Error(q(`入出力の参照が正しくありません: {id}`,{id:e}));for(let[e,t]of Object.entries(n.edges)){if(e!==t.id||!n.ports[t.from.portId]||!n.ports[t.to.portId])throw Error(q(`線の参照が正しくありません: {id}`,{id:e}));let r=dp(n,t.from,t.to);if(!r.ok)throw Error(q(`線のつなぎ方が正しくありません: {id}: {reason}`,{id:e,reason:r.reason??``}));if(r.kind!==t.kind)throw Error(q(`線の種類が正しくありません: {id}`,{id:e}))}return Up(e)}var RC=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},zC=(e=>e?RC(e):RC),BC=e=>e;function VC(e,t=BC){let n=y.useSyncExternalStore(e.subscribe,y.useCallback(()=>t(e.getState()),[e,t]),y.useCallback(()=>t(e.getInitialState()),[e,t]));return y.useDebugValue(n),n}var HC=e=>{let t=zC(e),n=e=>VC(t,e);return Object.assign(n,t),n},UC=(e=>e?HC(e):HC);function WC(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function GC(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=WC(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{n=void 0}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var KC;function qC(){return KC||=GC(`keyval-store`,`keyval`),KC}function JC(e,t=qC()){return t(`readonly`,t=>WC(t.get(e)))}function YC(e,t,n=qC()){return n(`readwrite`,n=>(n.put(t,e),WC(n.transaction)))}function XC(e,t=qC()){return t(`readwrite`,t=>(t.delete(e),WC(t.transaction)))}var ZC=`boxglow:lastFileHandle`,QC=()=>typeof window<`u`&&typeof window.showOpenFilePicker==`function`;async function $C(){if(!window.showOpenFilePicker)return null;let e;try{[e]=await window.showOpenFilePicker({multiple:!1,types:[{description:`Boxglow project`,accept:{"application/json":[`.json`]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return null;throw e}try{await YC(ZC,e)}catch{}return e}async function ew(){try{return await JC(ZC)??null}catch{return null}}async function tw(e,t=`readwrite`){try{return await e.queryPermission({mode:t})===`granted`||await e.requestPermission({mode:t})===`granted`}catch{return!1}}async function nw(e){let t=await e.getFile();return{text:await t.text(),lastModified:t.lastModified}}var rw=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function iw(e,t,n,r,i){if(rw(n,r))return n;if(rw(n,t))return i.merged++,r;if(rw(r,t))return n;let a=JSON.stringify(e),o=i.choices[a]??(n===void 0&&r!==void 0?`theirs`:`ours`);return i.conflicts.push({id:a,path:e.join(`.`),segments:e,ours:n,theirs:r,adopted:o}),o===`theirs`?r:n}function aw(e,t,n,r,i){let a={},o=new Set([...Object.keys(n),...Object.keys(r),...Object.keys(t??{})]);for(let s of o){let o=t?.[s],c=n[s],l=r[s],u=iw([...e,s],o,c,l,i);u!==void 0&&(a[s]=u)}return a}function ow(e,t,n,r,i){let a={},o=new Set([...Object.keys(n),...Object.keys(r),...Object.keys(t??{})]);for(let s of o){let o=t?.[s],c=n[s],l=r[s];if(c&&l&&e[0]!==`handoffs`){a[s]=aw([...e,s],o,c,l,i);continue}let u=iw([...e,s],o,c,l,i);u!==void 0&&(a[s]=u)}return a}function sw(e,t,n,r,i){let a=e=>Object.fromEntries((e??[]).map(e=>[e.id,e])),o=ow(e,t?a(t):void 0,a(n),a(r),i);return[...n.map(e=>e.id),...r.map(e=>e.id).filter(e=>!n.some(t=>t.id===e))].filter(e=>o[e]).map(e=>o[e])}function cw(e,t,n,r){let i=e.blocks,a=e.ports,o=e.edges,s=e=>!t.blocks[e]&&!!n.blocks[e]&&!r(`blocks`,e),c=new Set;for(let e of Object.keys(i))s(e)&&c.add(e);for(let e of Object.values(a)){let n=e.blockId;!i[n]&&s(n)&&!t.ports[e.id]&&c.add(n)}if(c.size===0)return;let l=new Set;for(let e of c){let t=e;for(let e=n.blocks[t]?.parentId;e&&s(e);e=n.blocks[t]?.parentId)t=e;l.add(t)}let u=new Set(l);for(let e=!0;e;){e=!1;for(let t of Object.values(n.blocks))t.parentId&&u.has(t.parentId)&&!u.has(t.id)&&!r(`blocks`,t.id)&&(u.add(t.id),e=!0)}for(let e of u)i[e]||(i[e]=n.blocks[e]);for(let e of Object.values(n.ports))u.has(e.blockId)&&!a[e.id]&&!r(`ports`,e.id)&&(a[e.id]=e);if(n.handoffs){let t=e.handoffs??{};for(let e of u)n.handoffs[e]&&!t[e]&&!r(`handoffs`,e)&&(t[e]=n.handoffs[e]);e.handoffs=t}for(let e of Object.values(n.edges)){if(o[e.id]||!a[e.from.portId]||!a[e.to.portId]||r(`edges`,e.id))continue;let t=n.ports[e.from.portId]?.blockId,i=n.ports[e.to.portId]?.blockId;(t&&u.has(t)||i&&u.has(i))&&(o[e.id]=e)}}function lw(e,t,n,r={}){let i={project:t,merged:0,conflicts:[],choices:r},a=e??void 0,o=t,s=n,c={...o};for(let e of[`name`,`description`,`visibility`,`terminals`,`contextGuard`])c[e]=iw([e],a?.[e],o[e],s[e],i);for(let e of[`blocks`,`ports`,`edges`,`agents`,`handoffs`])c[e]=ow([e],a?.[e],o[e]??{},s[e]??{},i);let l=(e,t)=>{let n=r[JSON.stringify([e,t])];return n?(n===`ours`?o:s)[e]?.[t]===void 0:!1};cw(c,t,n,l),cw(c,n,t,l);let u=c.blocks,d=c.ports,f=c.edges;for(let[e,t]of Object.entries(d))u[t.blockId]||delete d[e];for(let[e,t]of Object.entries(f)){let n=t;(!d[n.from?.portId]||!d[n.to?.portId])&&delete f[e]}let p=c.handoffs;for(let r of Object.keys(p))!u[r]&&(t.blocks[r]||n.blocks[r]||e?.blocks[r])&&delete p[r];Object.keys(p).length===0&&!t.handoffs&&!n.handoffs&&delete c.handoffs,c.members=sw([`members`],e?.members,t.members??[],n.members??[],i),c.inputGroups=sw([`inputGroups`],e?.inputGroups,t.inputGroups??[],n.inputGroups??[],i);let m=new Map;for(let e of[...t.log??[],...n.log??[]])m.set(e.id,e);c.log=[...m.values()].sort((e,t)=>e.at<t.at?-1:+(e.at>t.at));let h=c.blocks,g=new Map,_=Math.max(t.nextKey??1,n.nextKey??1);for(let e of Object.keys(t.blocks??{})){let t=h[e]?.key;t&&g.set(t,e)}for(let e of Object.keys(h)){let t=h[e].key;if(!t)continue;let n=g.get(t);n&&n!==e?(h[e]={...h[e],key:`B${_}`},i.conflicts.push({id:JSON.stringify([`blocks`,e,`key`]),segments:[`blocks`,e,`key`],automatic:!0,path:`blocks.${e}.key`,ours:t,theirs:q(`{key} に振り直し`,{key:`B${_}`})}),_++):g.set(t,e)}return c.nextKey=_,i.project=c,{project:i.project,merged:i.merged,conflicts:i.conflicts}}function uw(){let e=Wf(`Web アプリを公開する`);e.description=`小さな Web アプリを、要件の整理から公開までボックスに分けて進める例。ボックスが完了するごとに、右端の最終成果物に近づく。`;let t=J(e)[0].id;e.blocks[t].description=e.description,e.blocks[t].status=`gray`;let n=Ap(e,`さとう`,`#0d8080`);e=n.project;let r=Ap(e,`たなか`,`#e8875e`);e=r.project;let i=Y(e,t,`out`)[0];e=Cp(e,i.id,{name:`公開した Web アプリ`,description:`誰でも開ける URL と、使い方の説明`}),e=Cp(e,Y(e,Ff,`out`)[0].id,{name:`公開した Web アプリ`});let a=yp(e,{blockId:t,direction:`in`,name:`企画メモ`});e=Cp(a.project,a.portId,{description:`何を作りたいかの箇条書き`,artifacts:[ep(`企画メモ (Notion)`,`https://example.com/plan`)]});let o=mp(e,{parentId:t,title:`要件を決める`,position:{x:48,y:72}});e=o.project;let s=mp(e,{parentId:t,title:`設計する`,position:{x:400,y:72}});e=s.project;let c=mp(e,{parentId:t,title:`実装する`,position:{x:80,y:320}});e=c.project;let l=mp(e,{parentId:t,title:`公開する`,position:{x:780,y:420}});e=l.project,e=lm(e,o.blockId,`study`),e=lm(e,s.blockId,`design`),e=lm(e,c.blockId,`build`),e=lm(e,l.blockId,`ops`);let u=yp(e,{blockId:o.blockId,direction:`in`,name:`企画メモ`});e=u.project;let d=Y(e,o.blockId,`out`)[0];e=Cp(e,d.id,{name:`要件一覧`,artifacts:[ep(`要件一覧 v1`,`https://example.com/requirements`)]}),e=hp(e,o.blockId,{status:`white`,assigneeIds:[n.memberId],description:`企画メモを読み、機能を箇条書きにする。優先度を付ける。`}),e=Op(e,{portId:a.portId,side:`inner`},{portId:u.portId,side:`outer`}).project;let f=yp(e,{blockId:s.blockId,direction:`in`,name:`要件一覧`});e=f.project;let p=Y(e,s.blockId,`out`)[0];e=Cp(e,p.id,{name:`設計書`,description:`画面設計 (Figma) と API 仕様 (OpenAPI) をまとめたもの`,artifacts:[ep(`画面設計 (Figma)`,`https://example.com/figma`),ep(`OpenAPI 定義`,`https://example.com/openapi.yaml`)]}),e=hp(e,s.blockId,{status:`white`,assigneeIds:[n.memberId]}),e=Op(e,{portId:d.id,side:`outer`},{portId:f.portId,side:`outer`}).project;let m=yp(e,{blockId:c.blockId,direction:`in`,name:`設計書`});e=m.project;let h=Y(e,c.blockId,`out`)[0];e=Cp(e,h.id,{name:`動くアプリ一式`,description:`テストが通ったビルド成果物`}),e=hp(e,c.blockId,{status:`gray`,assigneeIds:[n.memberId,r.memberId],description:`設計をもとに部品を作り、組み合わせて動く状態にする。`}),e=Op(e,{portId:p.id,side:`outer`},{portId:m.portId,side:`outer`}).project;let g=mp(e,{parentId:c.blockId,title:`フロントエンド`,position:{x:48,y:72}});e=g.project;let _=mp(e,{parentId:c.blockId,title:`バックエンド`,position:{x:48,y:232}});e=_.project;let v=mp(e,{parentId:c.blockId,title:`結合テスト`,position:{x:360,y:152}});e=v.project,e=lm(e,v.blockId,`verify`),e=lm(e,g.blockId,`build`),e=lm(e,_.blockId,`build`);let y=yp(e,{blockId:g.blockId,direction:`in`,name:`設計書`});e=y.project;let b=Y(e,g.blockId,`out`)[0];e=Cp(e,b.id,{name:`画面の実装`,artifacts:[ep(`PR #12`,`https://example.com/pr/12`)]}),e=hp(e,g.blockId,{status:`white`,assigneeIds:[r.memberId]}),e=Op(e,{portId:m.portId,side:`inner`},{portId:y.portId,side:`outer`}).project;let x=yp(e,{blockId:_.blockId,direction:`in`,name:`設計書`});e=x.project;let S=Y(e,_.blockId,`out`)[0];e=Cp(e,S.id,{name:`API の実装`}),e=hp(e,_.blockId,{status:`gray`,assigneeIds:[n.memberId],description:`OpenAPI 定義どおりに API を作る。認証はまだ未定。`}),e=Op(e,{portId:m.portId,side:`inner`},{portId:x.portId,side:`outer`}).project;let C=yp(e,{blockId:v.blockId,direction:`in`,name:`画面の実装`});e=C.project;let w=yp(e,{blockId:v.blockId,direction:`in`,name:`API の実装`});e=w.project,e=yp(e,{blockId:v.blockId,direction:`in`,name:`テストデータ`}).project;let T=Y(e,v.blockId,`out`)[0];e=Cp(e,T.id,{name:`テスト済みビルド`}),e=Op(e,{portId:b.id,side:`outer`},{portId:C.portId,side:`outer`}).project,e=Op(e,{portId:S.id,side:`outer`},{portId:w.portId,side:`outer`}).project,e=Op(e,{portId:T.id,side:`outer`},{portId:h.id,side:`inner`}).project;let E=yp(e,{blockId:l.blockId,direction:`in`,name:`動くアプリ一式`});e=E.project;let D=Y(e,l.blockId,`out`)[0];return e=Cp(e,D.id,{name:`公開 URL`}),e=hp(e,l.blockId,{description:`どこに置くかは未定。候補: 静的ホスティング。`}),e=Op(e,{portId:h.id,side:`outer`},{portId:E.portId,side:`outer`}).project,e=Op(e,{portId:D.id,side:`outer`},{portId:i.id,side:`inner`}).project,e=Kp(e,_.blockId,`claude-code`,`working`,`OpenAPI 定義から API のひな形を生成中`),e=Fp(e,_.blockId,40,`claude-code`),e=Jp(e,l.blockId,`codex`,`公開先はどれにしますか?`,[`静的ホスティング`,`自前のサーバー`],`最初に公開するのは静的な紹介ページです。フォーム送信などのサーバー処理は、別の API を使う想定です。
|
|
72
72
|
静的ホスティング: 運用の手間を抑えやすく、今回の範囲に合います。
|
|
73
73
|
自前のサーバー: 自由度は高い一方、更新・監視も自分たちで行います。
|
|
74
74
|
この判断を記録してから公開作業へ進みます。`).project,Jm(Xf(e))}var dw=`{
|
|
@@ -3461,4 +3461,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3461
3461
|
`)}function LE(e){let t=Pp(e,Ff);return[`# ${e.name}`,``,e.description,``,q(`全体の進捗: {white}/{total} ブロックが完了 (BlackBox {black} / GrayBox {gray} / WhiteBox {white})`,{white:t.white,total:t.total,black:t.black,gray:t.gray}),``,q(`ブロックは「入力から出力を作るタスク」。BlackBox は出力だけ決まっていて中身が未定、GrayBox は分解中・着手中、WhiteBox は完了。`),``].join(`
|
|
3462
3462
|
`)+IE(e,Ff,2,!0)}function RE(e,t,n){let r=e.blocks[t];if(!r)return``;let i=[...ap(e,t)].reverse().map(t=>t.id===`root`?e.name:t.title),a=[];a.push(`# ${q(`依頼: {title}`,{title:r.title})}`),a.push(``),a.push(q(`このタスクは「{chain}」の中の 1 ブロックです。ブロックは「入力から出力を作る作業」で、出力の成果物が確定したら完了 (WhiteBox) になります。`,{chain:i.join(` > `)})),a.push(``),a.push(IE(e,t,2,!1));let o=rp(e,r.parentId??`root`).filter(e=>e.id!==t);if(o.length>0){a.push(`## `+q(`同じ階層の他のブロック`)),a.push(``);for(let e of o)a.push(`- ${e.title} (${q(ME[e.status])})`);a.push(``)}let s=rp(e,t);if(s.length>0){a.push(`## `+q(`現在の下の階層`)),a.push(``);for(let e of s)a.push(`- ${e.title} (${q(ME[e.status])})`);a.push(``)}if(a.push(`## `+q(`お願い`)),a.push(``),n===`plan`)a.push(q(`上の入力から出力を得るための手順を提案してください。前提が足りなければ、追加で必要な入力を挙げてください。`));else if(n===`decompose`){a.push(q(`このブロックを、入力と出力を持つ小さなブロックに分解してください。次の JSON 形式で答えてください。`)),a.push(``),a.push("```json");let e=q(`ブロック名`);a.push(JSON.stringify({blocks:[{title:e,description:q(`やること`),inputs:[q(`入力名`)],outputs:[q(`出力名`)]}],connections:[{from:`${e}.${q(`出力名`)}`,to:`${e}.${q(`入力名`)}`}]},null,2)),a.push("```")}else a.push(q(`入力と出力の定義に抜けや曖昧さがないか指摘してください。出力が「確定した」と言える条件も提案してください。`));return a.push(``),a.join(`
|
|
3463
3463
|
`)}function zE(e,t){let n=rp(e,t),r=[`flowchart LR`],i=e=>e.replace(/"/g,`'`);r.push(` IN(["${q(`入力`)}"])`),r.push(` OUT(["${q(`出力`)}"])`);for(let e of n){let t=e.status===`white`?`["${i(e.title)}"]`:e.status===`gray`?`[["${i(e.title)}"]]`:`{{"${i(e.title)}"}}`;r.push(` ${e.id}${t}`)}for(let a of Object.values(e.edges)){let o=e.ports[a.from.portId],s=e.ports[a.to.portId];if(!o||!s)continue;let c=o.blockId===t?`IN`:n.some(e=>e.id===o.blockId)?o.blockId:null,l=s.blockId===t?`OUT`:n.some(e=>e.id===s.blockId)?s.blockId:null;if(!c||!l)continue;let u=o.direction===`out`?o.name:s.name;r.push(` ${c} ${a.auto?`-.->`:`-->`}|${i(u)}| ${l}`)}r.push(` classDef white fill:#fbfbfb,stroke:#3a3f46,color:#2f343a`),r.push(` classDef gray fill:#d9dde1,stroke:#3a3f46,color:#2f343a`),r.push(` classDef black fill:#3a3f46,stroke:#3a3f46,color:#e8eaed`);for(let e of n)r.push(` class ${e.id} ${e.status}`);return r.join(`
|
|
3464
|
-
`)}var BE=[`#0d8080`,`#e8875e`,`#3aa85a`,`#6b7075`,`#2f6fb3`,`#a0522d`],VE={black:`?`,gray:`~`,white:`✓`},HE={statuses:new Set([`black`,`gray`,`white`]),memberId:null,unassigned:!1,category:null};function UE(e,t,n){let r=e.blocks[t];return!(!r||!n.statuses.has(r.status)||n.memberId&&!r.assigneeIds.includes(n.memberId)||n.unassigned&&(r.assigneeIds.length>0||$f(r)===`project`)||n.category&&r.category!==n.category)}var WE=e=>e.statuses.size===3&&e.memberId===null&&!e.unassigned&&e.category===null;function GE({project:e,parentId:t,depth:n,selectedId:r,onSelect:i,closed:a,onToggle:o}){vw();let s=rp(e,t).sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x);return(0,x.jsx)(x.Fragment,{children:s.map(t=>{let s=rp(e,t.id).length>0,c=a.has(t.id);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`tree-row`,"data-selected":r===t.id,style:{paddingLeft:8+n*14},onClick:()=>i(t.id),title:t.title,children:[s?(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{padding:`0 4px`},onClick:e=>{e.stopPropagation(),o(t.id)},title:q(c?`開く`:`閉じる`),children:c?`▸`:`▾`}):(0,x.jsx)(`span`,{style:{width:20,display:`inline-block`}}),(0,x.jsx)(`span`,{className:`tree-glyph ${t.status}`,children:VE[t.status]}),(0,x.jsx)(`span`,{className:`truncate`,children:t.title})]}),s&&!c&&(0,x.jsx)(GE,{project:e,parentId:t.id,depth:n+1,selectedId:r,onSelect:i,closed:a,onToggle:o})]},t.id)})})}function KE({project:e,filter:t,onFilter:n,onClose:r,width:i}){vw();let a=$(e=>e.readonly),o=$(e=>e.selection),s=$(e=>e.select),c=$(e=>e.apply),[l,u]=(0,y.useState)(()=>new Set),d=e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[f,p]=(0,y.useState)(``),[m,h]=(0,y.useState)(BE[0]),g=$(e=>e.focusBlock),_=$(e=>e.setToast),v=$(e=>e.meId),b=$(e=>e.setMe),[S,C]=(0,y.useState)([]);(0,y.useEffect)(()=>{wE().then(C)},[]);let w=()=>void wE().then(C),T=t=>{let n=Hw(e,o,$.getState().viewScope);c(e=>{let r=sm(e,n,t,`human`);return setTimeout(()=>{s({blockId:r.blockId}),g(r.blockId)},0),r.project})},E=async()=>{let e=await bE(`.json,application/json`);if(e)try{await TE(cm(e)),w(),_(q(`テンプレートをライブラリに追加しました`))}catch(e){_(e instanceof Error?e.message:String(e))}},D=e=>{let r=new Set(t.statuses);r.has(e)?r.delete(e):r.add(e),r.size!==0&&n({...t,statuses:r})},O=()=>{f.trim()&&(c(e=>Ap(e,f.trim(),m).project),p(``),h(BE[(BE.indexOf(m)+1)%BE.length]))},[k,A]=(0,y.useState)(`tree`),j=[{id:`tree`,label:`Tree`,hint:q(`ボックスの一覧 (押すと選ぶ)`)},{id:`filter`,label:`Filter`,hint:q(`状態や担当でボックスを絞る`)},{id:`members`,label:`Members`,hint:q(`担当にする人を登録。自分を決める`)},{id:`parts`,label:`Parts`,hint:q(`他のプロジェクトでも使い回すボックス`)}];return(0,x.jsxs)(`div`,{className:`drawer card`,style:{width:i},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mb-2`,children:[(0,x.jsx)(`div`,{className:`seg flex-1`,style:{gridTemplateColumns:`repeat(4, 1fr)`},children:j.map(e=>(0,x.jsx)(`button`,{className:`seg__btn`,"data-on":k===e.id,onClick:()=>A(e.id),title:e.hint,style:{padding:`6px 2px`,fontSize:12},children:e.label},e.id))}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:r,title:`Close`,children:`×`})]}),(0,x.jsx)(`div`,{className:`text-[11px] mb-2`,style:{color:`var(--text-muted)`},children:j.find(e=>e.id===k)?.hint}),k===`tree`&&(rp(e,`root`).length===0?(0,x.jsx)(`div`,{className:`text-[12px] px-2`,style:{color:`var(--text-muted)`},children:`No blocks yet`}):(0,x.jsx)(GE,{project:e,parentId:`root`,depth:0,selectedId:o.blockId,onSelect:e=>{s({blockId:e}),g(e)},closed:l,onToggle:d})),k===`filter`&&(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[[`black`,`gray`,`white`].map(e=>(0,x.jsxs)(`button`,{className:`chip`,"data-on":t.statuses.has(e),onClick:()=>D(e),children:[(0,x.jsx)(`span`,{className:`tree-glyph ${e}`,style:{width:12,height:12,fontSize:8,lineHeight:`8px`},children:VE[e]}),mT[e]]},e)),v&&(0,x.jsx)(`button`,{className:`chip`,"data-on":t.memberId===v,onClick:()=>n({...t,memberId:t.memberId===v?null:v,unassigned:!1}),title:q(`自分の担当だけ`),children:`Mine`}),(0,x.jsx)(`button`,{className:`chip`,"data-on":t.unassigned,onClick:()=>n({...t,unassigned:!t.unassigned,memberId:null}),title:q(`担当がいないボックスだけ`),children:q(`未担当`)}),e.members.filter(e=>e.id!==v).map(e=>(0,x.jsxs)(`button`,{className:`chip`,"data-on":t.memberId===e.id,onClick:()=>n({...t,memberId:t.memberId===e.id?null:e.id,unassigned:!1}),title:q(`{name} の担当だけ`,{name:e.name}),children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:e.color,width:16,height:16,fontSize:9},children:e.name.slice(0,1)}),e.name]},e.id)),(0,x.jsx)(`div`,{className:`label mt-3`,children:`Category`}),(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:pf.map(e=>(0,x.jsxs)(`button`,{className:`chip cat-chip${e.neutral?` neutral`:``}`,"data-on":t.category===e.key,style:{"--cat":e.color},onClick:()=>n({...t,category:t.category===e.key?null:e.key}),title:q(`{label} のボックスだけ`,{label:q(e.label)}),children:[(0,x.jsx)(`span`,{className:`cat-chip__dot`}),q(e.label)]},e.key))}),!WE(t)&&(0,x.jsx)(`button`,{className:`chip mt-3`,onClick:()=>n({...HE,statuses:new Set(HE.statuses)}),children:`Clear`})]}),k===`parts`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`text-[11px] mb-1`,style:{color:`var(--text-muted)`},children:q(`挿入先: {target}`,{target:(()=>{let t=Hw(e,o,$.getState().viewScope),n=e.blocks[t];return n?$f(n)===`project`?n.title:q(`{title} の隣`,{title:n.title}):q(`最上位`)})()})}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[S.length===0&&(0,x.jsx)(`div`,{className:`text-[12px] px-1`,style:{color:`var(--text-muted)`},children:q(`ボックスを選び、右の「⋯」から「Save as Part」すると、ここに並びます。`)}),S.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-1 text-[13px] px-1`,children:[(0,x.jsx)(`span`,{className:`truncate`,title:`${e.description||e.name} (v${e.version}${e.tags.length?`, `+e.tags.join(`, `):``})`,children:e.name}),(0,x.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--text-muted)`},children:[`v`,e.version]}),(0,x.jsxs)(`span`,{className:`ml-auto flex gap-0.5`,children:[!a&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`挿入`),onClick:()=>T(e),children:`Insert`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`JSON で保存 (他のリポジトリや人と共有)`),onClick:()=>vE(`${xE(e.name)}.boxglow-block.json`,JSON.stringify(e,null,2),`application/json`),children:`↓`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`ライブラリから消す`),onClick:()=>{confirm(q(`テンプレート「{name}」を消しますか?`,{name:e.name}))&&EE(e.id).then(w)},children:`×`})]})]},e.id)),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm self-start`,onClick:E,children:`Import`})]})]}),k===`members`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] px-1`,children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:e.color},children:e.name.slice(0,1)}),(0,x.jsx)(`span`,{className:`truncate`,children:e.name}),(0,x.jsx)(`button`,{className:`chip ml-auto`,"data-on":v===e.id,onClick:()=>b(v===e.id?null:e.id),title:q(`このブラウザでは自分として扱う (自分の担当のボックスに帯が付く)`),children:v===e.id?`Me`:`Set as me`}),!a&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`外す`),onClick:()=>c(t=>jp(t,e.id)),children:`×`})]},e.id))}),!a&&(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[(0,x.jsx)(`span`,{className:`avatar flex-none`,style:{background:m,cursor:`pointer`},title:q(`色を変える`),onClick:()=>h(BE[(BE.indexOf(m)+1)%BE.length]),children:f.slice(0,1)||`+`}),(0,x.jsx)(`input`,{className:`input`,placeholder:`Name`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&O()}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:O,disabled:!f.trim(),children:`Add`})]})]})]})}function qE({title:e,children:t}){vw();let n=$(e=>e.select);return(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mb-2`,children:[(0,x.jsx)(`span`,{className:`label truncate flex-1`,title:e,children:e}),t,(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>n({}),title:q(`閉じる (Esc)`),children:`×`})]})}function JE({project:e,onOpenDrawer:t}){let n=$(e=>e.selection);return n.edgeId&&e.edges[n.edgeId]?(0,x.jsx)($E,{project:e,edgeId:n.edgeId}):n.blockId&&e.blocks[n.blockId]?(0,x.jsx)(ZE,{project:e,blockId:n.blockId,onOpenDrawer:t}):n.terminal?(0,x.jsx)(XE,{project:e,which:n.terminal,groupId:n.terminalGroup}):n.project?(0,x.jsx)(YE,{project:e}):n.timeline?(0,x.jsx)(AE,{project:e}):null}function YE({project:e}){vw();let t=$(e=>e.readonly),n=$(e=>e.apply),r=Pp(e,Ff);return(0,x.jsxs)(`div`,{className:`flex flex-col gap-4 p-3`,children:[(0,x.jsx)(qE,{title:`Project`}),(0,x.jsx)(`input`,{className:`input font-head text-[16px]`,value:e.name,disabled:t,onChange:e=>n(t=>({...structuredClone(t),name:e.target.value}))}),(0,x.jsx)(fE,{multiline:!0,className:`input`,placeholder:q(`ゴール (何を達成したいか)`),value:e.description,disabled:t,onCommit:e=>n(t=>({...structuredClone(t),description:e}))}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`progress-bar`,children:(0,x.jsx)(`span`,{style:{width:`${Math.round(r.ratio*100)}%`}})}),(0,x.jsx)(`div`,{className:`text-[12px] mt-1`,style:{color:`var(--text-muted)`},children:q(`完了 {white} / {total}`,{white:r.white,total:r.total})})]})]})}function XE({project:e,which:t,groupId:n}){vw();let r=$(e=>e.readonly),i=$(e=>e.apply),a=$(e=>e.select),o=$(e=>e.setToast),s=n?Em(e).find(e=>e.id===n)??null:null,c=Em(e),l=t===`out`?`Project Outputs`:s?`Input Group`:`Project Inputs`;return(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,x.jsx)(qE,{title:l}),s&&(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsx)(`span`,{className:`label`,children:`Group`}),(0,x.jsxs)(`span`,{className:`flex gap-1`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`このグループを JSON に書き出す (他のプロジェクトで読み込める)`),onClick:()=>vE(`${xE(s.name)}.boxglow-inputs.json`,Nm(e,s.id),`application/json`),children:`Export`}),!r&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-danger`,title:q(`グループを消す (入力は Inputs に戻る)`),onClick:()=>{confirm(q(`グループ「{name}」を消しますか? (入力は Inputs に戻ります)`,{name:s.name}))&&(a({terminal:`in`}),i(e=>Am(e,s.id)))},children:`Delete`})]})]}),(0,x.jsx)(`input`,{className:`input font-head text-[15px]`,value:s.name,disabled:r,placeholder:`Group name`,onChange:e=>i(t=>km(t,s.id,{name:e.target.value}))}),(0,x.jsx)(`input`,{className:`input`,value:s.description,disabled:r,placeholder:q(`説明 (任意。例: PCI-SIG の仕様書一式)`),onChange:e=>i(t=>km(t,s.id,{description:e.target.value}))})]}),(0,x.jsx)(uE,{project:e,blockId:Ff,direction:t,readonly:r,title:t===`in`?`Inputs`:`Outputs`,allowAdd:t===`out`||!!s,groupId:t===`in`?s?s.id:null:void 0}),t===`in`&&!s&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`ここには、下の階層で供給元が決まっていない入力が自動で上がります。各入力はグループに移せます。`)}),(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsx)(`span`,{className:`label`,children:`Groups`}),!r&&(0,x.jsxs)(`span`,{className:`flex gap-1`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>{let e=prompt(q(`グループの名前 (例: PCIe 仕様書)`));e?.trim()&&i(t=>{let n=Om(t,e.trim());return setTimeout(()=>a({terminal:`in`,terminalGroup:n.groupId}),0),n.project})},children:`+ Group`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:async()=>{let e=await bE(`.json,application/json`);if(e)try{i(t=>{let n=Pm(t,e);return setTimeout(()=>a({terminal:`in`,terminalGroup:n.groupId}),0),n.project})}catch(e){o(e instanceof Error?e.message:String(e))}},title:q(`他のプロジェクトで書き出したグループを読み込む`),children:`Import`})]})]}),c.length===0&&(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`仕様書などを種類ごとに分けるときは、グループを作って入力を入れます (例: PCIe 仕様書、DDR 仕様書)。`)}),c.map(t=>(0,x.jsxs)(`button`,{className:`tree-row text-left`,onClick:()=>a({terminal:`in`,terminalGroup:t.id}),children:[(0,x.jsx)(`span`,{className:`truncate`,children:t.name}),(0,x.jsx)(`span`,{className:`ml-auto text-[11px]`,style:{color:`var(--text-muted)`},children:Dm(e,t.id).length})]},t.id))]})]})]})}function ZE({project:e,blockId:t}){vw();let n=$(e=>e.readonly),r=$(e=>e.apply),i=$(e=>e.select),a=$(e=>e.setToast),o=$(e=>e.meId),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(null),[d,f]=(0,y.useState)(!0),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(`status`),b=e.blocks[t],S=h.trim()?e.members.filter(e=>e.name.toLowerCase().includes(h.trim().toLowerCase())&&!b.assigneeIds.includes(e.id)).slice(0,8):[],C=rp(e,t),w=[...ap(e,t)].reverse(),T=Vp(e,t),E=Pp(e,t),D=b.decisions.filter(e=>e.answer===void 0),O=b.decisions.filter(n=>n.answer!==void 0&&!nm(e,t,n)),k=Np(e,t),A=$f(b)===`project`;(0,y.useEffect)(()=>{c(!1),u(null),f(!0),m(!1),g(``)},[t]);let j=e=>r(n=>hp(n,t,{status:e})),M=e=>r(n=>{let r=n.blocks[t].assigneeIds;return hp(n,t,{assigneeIds:r.includes(e)?r.filter(t=>t!==e):[...r,e]})}),N=()=>{C.length>0&&!confirm(q(`「{title}」と下の階層のブロックを削除します。よろしいですか?`,{title:b.title}))||(i({}),r(e=>vp(e,t)))},P=async n=>{c(!1),await yE(RE(e,t,n))?a(q(`AI に渡すテキストをコピーしました`)):u(n)},F=async()=>{m(!1);let n=am(e,t,{tags:(prompt(q(`部品の札 (例: 画像処理, 認証。カンマ区切り。省略可)`))??``).split(/[,、]/).map(e=>e.trim()).filter(Boolean)});await TE(n),a(q(`「{name}」を部品として保存しました (☰ の「部品」から挿入)`,{name:n.name}))},ee={status:q(`状態・進捗・活動・判断`),io:q(`入力と出力 (成果物)`),owner:q(`担当`),dates:q(`開始日・期日・時間`),more:q(`AI に渡す・メモ・資料`)};return(0,x.jsxs)(`div`,{className:`flex flex-col gap-4 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`label truncate flex-1`,title:w.map(e=>e.id===`root`?``:e.title).filter(Boolean).join(` › `),children:A?`Project`:w.map(e=>e.id===`root`?``:e.title).filter(Boolean).join(` › `)||`Top`}),(0,x.jsx)(`button`,{className:`chip`,style:{fontFamily:`ui-monospace, monospace`},title:q(`短い ID (押すとコピー。検索や CLI で使えます)`),onClick:async()=>{await yE(b.key??``)&&a(q(`ID {key} をコピーしました`,{key:b.key??``}))},children:b.key}),!n&&(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>m(!p),title:`More`,children:`⋯`}),p&&(0,x.jsxs)(`div`,{className:`card absolute right-0 mt-1 p-1 flex flex-col z-30`,style:{minWidth:200},children:[!A&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:F,children:`Save as Part`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>{m(!1),u(`plan`),v(`more`)},children:`Show AI text`}),(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start btn-danger`,onClick:N,children:`Delete`})]})]}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>i({}),title:q(`閉じる (Esc)`),children:`×`})]}),(0,x.jsx)(fE,{className:`input font-head text-[16px]`,value:b.title,disabled:n,placeholder:q(`Title (何を作るか)`),onCommit:e=>r(n=>hp(n,t,{title:e}))}),(0,x.jsx)(`div`,{className:`seg`,style:{gridTemplateColumns:`repeat(5, 1fr)`},children:[[`status`,`Status`],[`io`,`I/O`],[`owner`,`Owner`],[`dates`,`Dates`],[`more`,`More`]].map(([n,r])=>(0,x.jsxs)(`button`,{className:`seg__btn`,"data-on":_===n,onClick:()=>v(n),style:{padding:`6px 2px`,fontSize:12},title:ee[n],children:[r,n===`status`&&D.length>0&&(0,x.jsx)(`span`,{className:`dot decision`,style:{marginLeft:4,display:`inline-block`,width:6,height:6,borderRadius:999,background:`var(--accent)`}}),n===`io`&&(0,x.jsxs)(`span`,{style:{marginLeft:4,fontSize:10,opacity:.7},children:[Y(e,t,`in`).length,`/`,Y(e,t,`out`).length]})]},n))}),_===`status`&&(0,x.jsxs)(`section`,{className:`sec`,children:[D.length>0&&(0,x.jsxs)(`div`,{className:`attention-section`,children:[(0,x.jsx)(`h3`,{className:`label`,children:q(`回答が必要です`)}),D.map(n=>(0,x.jsx)(OE,{project:e,blockId:t,decisionId:n.id},n.id))]}),O.length>0&&(0,x.jsxs)(`div`,{className:`attention-section`,children:[(0,x.jsx)(`h3`,{className:`label`,children:q(`AI未確認の回答`)}),O.map(n=>(0,x.jsx)(OE,{project:e,blockId:t,decisionId:n.id},n.id))]}),(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Status`})}),(0,x.jsx)(`div`,{className:`seg`,children:[`black`,`gray`,`white`].map(e=>(0,x.jsxs)(`button`,{className:`seg__btn`,"data-on":b.status===e,disabled:n,onClick:()=>j(e),title:q(hT[e]),children:[(0,x.jsx)(`span`,{className:`tree-glyph ${e}`,children:VE[e]}),(0,x.jsx)(`span`,{children:mT[e]})]},e))}),T&&!n&&(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm w-full`,onClick:()=>j(`white`),title:q(`下の階層が全部完了し、出力に成果物が付いています`),children:q(`完了にできます → Done`)}),b.status!==`white`&&$f(b)!==`project`&&Y(e,t,`in`).length>0&&(()=>{let n=Bp(e,t);return n.length===0?(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--primary-strong)`},children:q(`必須の入力はそろっています (着手できます)`)}):(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`必須の入力待ち: {names}`,{names:n.map(e=>e.name).join(`, `)})})})(),A&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`sec__head mt-2`,children:(0,x.jsx)(`span`,{className:`label`,children:`Repository`})}),(0,x.jsx)(`input`,{className:`input`,placeholder:q(`パスや URL (例: ../mg-core、github.com/you/repo)`),value:b.repo??``,disabled:n,onChange:e=>r(n=>hp(n,t,{repo:e.target.value}),{history:!1}),onBlur:e=>r(n=>hp(n,t,{repo:e.target.value.trim()||void 0}))}),(0,x.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--text-muted)`},children:q(`複数のリポジトリをまたぐときは、boxglow.json を上のフォルダに 1 つ置き、各リポジトリの AI には環境変数 BOXGLOW_FILE でその場所を教えます`)})]}),(0,x.jsxs)(`label`,{className:`category-field`,children:[(0,x.jsx)(`span`,{className:`label`,children:`Category`}),(0,x.jsxs)(`select`,{className:`input`,"aria-label":`Category`,value:b.category??``,disabled:n,onChange:e=>r(n=>lm(n,t,e.target.value||null)),children:[(0,x.jsx)(`option`,{value:``,children:q(`カテゴリなし`)}),pf.map(e=>(0,x.jsx)(`option`,{value:e.key,children:q(e.label)},e.key))]})]}),b.status!==`white`&&(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,style:{color:`var(--text-muted)`},children:[(0,x.jsx)(`input`,{type:`range`,min:0,max:100,step:5,value:k,disabled:n,className:`flex-1`,title:q(`進捗 (ドラッグで入力)`),onChange:e=>r(n=>Fp(n,t,Number(e.target.value),`human`),{history:!1}),onMouseUp:e=>r(n=>Fp(n,t,Number(e.target.value),`human`))}),(0,x.jsxs)(`span`,{style:{minWidth:36,textAlign:`right`},children:[k,`%`]}),typeof b.progress==`number`?(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`手入力をやめて、下の階層から自動で計算する`),onClick:()=>r(e=>Fp(e,t,null,`human`)),children:`Auto`}):C.length>0?(0,x.jsxs)(`span`,{title:q(`下の階層の完了数`),children:[E.white,`/`,E.total]}):null]}),b.activity&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-1 pl-2`,style:{borderLeft:`3px solid ${b.activity.state===`needs_decision`?`var(--accent)`:`var(--primary)`}`},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,x.jsx)(`span`,{className:`tl-actor`,children:cT(b.activity.actor)}),(0,x.jsx)(`b`,{children:q(uT[b.activity.state])}),(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:fT(b.activity.since)}),!n&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm ml-auto`,title:q(`活動の印を消す`),onClick:()=>r(e=>qp(e,t)),children:`×`})]}),b.activity.note&&b.activity.state!==`needs_decision`&&(0,x.jsx)(`div`,{className:`text-[13px]`,children:b.activity.note})]}),(0,x.jsxs)(`details`,{className:`text-[12px]`,open:!!e.handoffs?.[t],children:[(0,x.jsx)(`summary`,{children:q(`AI への引き継ぎ`)}),(0,x.jsx)(`p`,{className:`my-2`,children:q(`セッションを越えて残す発見・次の手順・未解決事項。AI は context コマンドで判断と合わせて読み直します。`)}),(0,x.jsx)(fE,{multiline:!0,className:`input`,value:e.handoffs?.[t]?.note??``,disabled:n,placeholder:q(`発見 / 次の手順 / 未解決事項`),onCommit:e=>r(n=>({...n,handoffs:{...n.handoffs,[t]:{note:e,actor:`human`,at:new Date().toISOString()}}}))}),(0,x.jsx)(`button`,{className:`btn btn-sm mt-2`,onClick:async()=>{let n=await yE(JSON.stringify(jE(e,t),null,2));a(q(n?`引き継ぎ情報をコピーしました`:`コピーできませんでした`))},children:q(`判断・入出力も含めてコピー`)})]}),b.decisions.filter(n=>n.answer!==void 0&&nm(e,t,n)).length>0&&(0,x.jsxs)(`details`,{className:`text-[12px]`,children:[(0,x.jsx)(`summary`,{style:{cursor:`pointer`,color:`var(--text-muted)`},children:q(`判断の記録 ({n})`,{n:b.decisions.filter(n=>n.answer!==void 0&&nm(e,t,n)).length})}),(0,x.jsx)(`div`,{className:`flex flex-col gap-3 mt-2`,children:b.decisions.filter(n=>n.answer!==void 0&&nm(e,t,n)).map(n=>(0,x.jsx)(OE,{project:e,blockId:t,decisionId:n.id},n.id))})]})]}),_===`owner`&&(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Owner`})}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1 flex-wrap`,children:[b.assigneeIds.map(t=>{let r=e.members.find(e=>e.id===t);return r?(0,x.jsxs)(`span`,{className:`chip`,"data-on":r.id===o,style:{cursor:`default`},title:r.id===o?q(`{name} (自分)`,{name:r.name}):r.name,children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:r.color,width:16,height:16,fontSize:9},children:r.name.slice(0,1)}),r.name,!n&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{padding:`0 2px`},title:q(`外す`),onClick:()=>M(r.id),children:`×`})]},t):null}),b.assigneeIds.length===0&&(0,x.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`未担当`)}),!n&&o&&!b.assigneeIds.includes(o)&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>M(o),title:q(`自分を担当にする`),children:`Me`})]}),!n&&(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`input`,{className:`input`,placeholder:e.members.length===0?q(`名前を打って Enter で登録`):q(`名前で検索して Enter で割り当て`),value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){g(``);return}if(e.key!==`Enter`)return;let n=S[0];if(n){b.assigneeIds.includes(n.id)||M(n.id),g(``);return}let i=h.trim();i&&(r(e=>{let n=Ap(e,i,BE[e.members.length%BE.length]);return hp(n.project,t,{assigneeIds:[...n.project.blocks[t].assigneeIds,n.memberId]})}),g(``))}}),h.trim()&&(0,x.jsxs)(`div`,{className:`card absolute left-0 right-0 mt-1 p-1 flex flex-col z-30`,style:{maxHeight:220,overflow:`auto`},children:[S.map(e=>(0,x.jsxs)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onMouseDown:e=>e.preventDefault(),onClick:()=>{b.assigneeIds.includes(e.id)||M(e.id),g(``)},children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:e.color,width:16,height:16,fontSize:9,marginRight:6},children:e.name.slice(0,1)}),e.name]},e.id)),S.length===0&&(0,x.jsx)(`div`,{className:`text-[12px] p-1`,style:{color:`var(--text-muted)`},children:q(`見つかりません。Enter で「{name}」を登録して割り当て`,{name:h.trim()})})]})]})]}),_===`dates`&&(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Schedule`})}),(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[12px]`,children:[(0,x.jsxs)(`label`,{className:`flex items-center gap-2 col-span-2`,children:[(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`,minWidth:32},children:q(`開始`)}),(0,x.jsx)(pE,{value:b.startDate??``,disabled:n,onChange:e=>r(n=>um(n,t,{startDate:e||null},`human`))})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-2 col-span-2`,children:[(0,x.jsx)(`span`,{style:{color:dm(b)?`var(--danger)`:`var(--text-muted)`,minWidth:32},children:q(`期日`)}),(0,x.jsx)(pE,{value:b.dueDate??``,disabled:n,danger:dm(b),onChange:e=>r(n=>um(n,t,{dueDate:e||null},`human`))})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`,minWidth:32},children:q(`見積`)}),(0,x.jsx)(`input`,{type:`number`,min:0,step:.5,className:`input input-plain`,placeholder:`h`,value:b.estimateHours??``,disabled:n,onChange:e=>r(n=>um(n,t,{estimateHours:e.target.value===``?null:Number(e.target.value)},`human`))}),(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`h`})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`,minWidth:32},children:q(`実績`)}),(0,x.jsx)(`input`,{type:`number`,min:0,step:.5,className:`input input-plain`,placeholder:`h`,value:b.actualHours??``,disabled:n,onChange:e=>r(n=>um(n,t,{actualHours:e.target.value===``?null:Number(e.target.value)},`human`))}),(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`h`})]})]}),b.dueDate&&b.status!==`white`&&(()=>{let e=fm(b);return e===null?null:(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:e<0?`var(--danger)`:`var(--text-muted)`},children:e<0?q(`期日を {d} 日過ぎています`,{d:-e}):e===0?q(`期日は今日です`):q(`期日まであと {d} 日`,{d:e})})})()]}),_===`io`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(uE,{project:e,blockId:t,direction:`in`,readonly:n,title:`Inputs`}),(0,x.jsx)(uE,{project:e,blockId:t,direction:`out`,readonly:n,title:`Outputs`,allowAdd:Sp(e,t)})]}),_===`more`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Issue`})}),(0,x.jsx)(`input`,{className:`input`,placeholder:q(`JIRA / Redmine / GitHub Issue の URL`),value:b.issue??``,disabled:n,onChange:e=>r(n=>hp(n,t,{issue:e.target.value}),{history:!1}),onBlur:e=>r(n=>hp(n,t,{issue:e.target.value.trim()||void 0}))}),b.issue&&(0,x.jsx)(`a`,{className:`text-[12px] underline`,href:b.issue,target:`_blank`,rel:`noreferrer`,style:{color:`var(--primary-strong)`},children:q(`開く: {key}`,{key:Fm(b.issue)})})]}),(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsx)(`span`,{className:`label`,children:`AI`}),(0,x.jsxs)(`button`,{className:`btn btn-sm`,"data-on":s,onClick:()=>c(!s),title:q(`このボックスの入出力と位置づけを Markdown にしてコピーして AI に渡す`),children:[`Copy for AI `,s?`▴`:`▾`]})]}),s&&(0,x.jsxs)(`div`,{className:`flex flex-col pl-2`,style:{borderLeft:`3px solid var(--line-soft)`},children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>P(`plan`),children:q(`手順を提案してもらう (コピー)`)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>P(`decompose`),children:q(`分解案を JSON でもらう (コピー)`)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>P(`review`),children:q(`入出力の抜けを指摘してもらう (コピー)`)})]}),l&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`textarea`,{className:`input`,style:{minHeight:180,fontSize:12},readOnly:!0,value:RE(e,t,l)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>u(null),children:`Close`})]})]}),(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsxs)(`span`,{className:`label`,children:[`Notes`,b.description||b.artifacts.length>0?` *`:``]}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>f(!d),children:d?`▴`:`▾`})]}),d&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,x.jsx)(fE,{multiline:!0,className:`input`,placeholder:q(`メモ (入力から出力をどう作るか)`),value:b.description,disabled:n,onCommit:e=>r(n=>hp(n,t,{description:e}))}),(0,x.jsx)(lE,{artifacts:b.artifacts,readonly:n,addLabel:`Link`,onChange:e=>r(n=>hp(n,t,{artifacts:e}))})]})]})]})]})}function QE({project:e,edgeId:t}){vw();let n=$(e=>e.viewScope),r=$(e=>e.setViewScope),i=(0,y.useMemo)(()=>Im(e,t),[e,t]);return i.length<2?null:(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--text-muted)`},children:`Tabs`}),(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(t=>(0,x.jsx)(`button`,{className:`chip`,"data-on":n===t,onClick:()=>r(t),title:t?q(`{title} のタブでこの線の続きを見る`,{title:e.blocks[t]?.title??``}):q(`All でこの線を見る`),children:t?e.blocks[t]?.title??`?`:`All`},t??`all`))})]})}function $E({project:e,edgeId:t}){vw();let n=$(e=>e.readonly),r=$(e=>e.apply),i=$(e=>e.select),a=e.edges[t],o=e.ports[a.from.portId],s=e.ports[a.to.portId],c=t=>t===`root`?q(`プロジェクト`):e.blocks[t]?.title??`?`;return(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,x.jsx)(qE,{title:`Wire`}),(0,x.jsxs)(`div`,{className:`text-[13px]`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`b`,{children:c(o.blockId)}),q(`「{name}」`,{name:o.name})]}),(0,x.jsx)(`div`,{className:`my-1`,style:{color:`var(--text-muted)`},children:`↓`}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`b`,{children:c(s.blockId)}),q(`「{name}」`,{name:s.name})]})]}),(0,x.jsx)(QE,{project:e,edgeId:t}),a.auto?(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`自動の線。手動でつなぐと置き換わります。`)}):!n&&(0,x.jsx)(`button`,{className:`btn btn-sm self-start`,onClick:()=>{i({}),r(e=>kp(e,t))},children:`Disconnect`})]})}var eD=e=>e===void 0?q(`削除済み`):typeof e==`string`?e||q(`空欄`):e&&typeof e==`object`&&`note`in e&&`actor`in e&&`at`in e?`${e.note}\n\n${e.actor} · ${e.at}`:JSON.stringify(e,null,2);function tD({onClose:e}){let{project:t,conflict:n,previewConflict:r,resolveConflict:i,saveError:a}=$(),[o,s]=(0,y.useState)({}),c=(0,y.useRef)(null),l=r();(0,y.useEffect)(()=>{let e=c.current,t=document.activeElement;return e.showModal(),()=>{e.close(),t?.focus()}},[]),(0,y.useEffect)(()=>{s({})},[n?.revision,n?.text]);let u=l?.conflicts??[],d=u.filter(e=>!e.automatic&&!o[e.id]).length,f=e=>{let[n,r,i]=e.segments,a=n===`blocks`||n===`handoffs`?t?.blocks[r]:void 0,o={title:q(`題名`),name:q(`名前`),description:q(`説明`),note:q(`引き継ぎメモ`),decisions:q(`判断と回答`),status:`Status`,artifacts:q(`成果物`),position:q(`位置`),category:`Category`,progress:q(`進捗`)};return a?`${a.key} ${a.title} · ${n===`handoffs`?q(`引き継ぎメモ`):i?o[i]??i:q(`タスク全体`)}`:o[e.path]??e.path};return(0,x.jsxs)(`dialog`,{ref:c,className:`conflict-dialog`,"aria-labelledby":`conflict-title`,onCancel:e,children:[(0,x.jsxs)(`div`,{className:`conflict-dialog__head`,children:[(0,x.jsx)(`h2`,{id:`conflict-title`,className:`font-head`,children:q(`競合する変更を比較`)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:e,"aria-label":q(`閉じる (Esc)`),children:`×`})]}),(0,x.jsxs)(`div`,{className:`conflict-dialog__body`,children:[(0,x.jsx)(`p`,{children:q(`別の項目の変更は両方残ります。同じ項目を変更した箇所だけ、残す内容を選んでください。`)}),u.length===0&&(0,x.jsx)(`p`,{children:q(`別の項目の変更です。統合できます。`)}),u.map(e=>(0,x.jsxs)(`fieldset`,{className:`conflict-item`,children:[(0,x.jsx)(`legend`,{children:f(e)}),e.automatic?(0,x.jsxs)(`p`,{children:[q(`番号の重複は自動で解消します。`),`: `,eD(e.theirs)]}):(0,x.jsx)(`div`,{className:`conflict-columns`,children:[`ours`,`theirs`].map(t=>(0,x.jsxs)(`label`,{className:`conflict-choice`,"data-selected":o[e.id]===t,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`input`,{type:`radio`,name:e.id,checked:o[e.id]===t,onChange:()=>s(n=>({...n,[e.id]:t}))}),` `,q(t===`ours`?`手元の編集`:`最新のファイル`)]}),(0,x.jsx)(`pre`,{children:eD(e[t])})]},t))})]},e.id)),a&&(0,x.jsx)(`p`,{className:`text-[12px]`,role:`status`,children:a})]}),(0,x.jsxs)(`div`,{className:`conflict-dialog__foot`,children:[(0,x.jsx)(`span`,{"aria-live":`polite`,children:q(`未選択: {n}`,{n:d})}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:e,children:q(`あとで選ぶ`)}),(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:d>0||!n,onClick:()=>{i(`merge`,o,n?.revision)&&e()},children:q(`選択した内容で統合`)})]})]})}function nD(){let{project:e,source:t,saveError:n,conflict:r,resolveConflict:i,previewConflict:a,saveNow:o}=$(),[s,c]=(0,y.useState)(!1);if(!e||!n&&t!==`file`)return null;let l=a()?.conflicts.filter(e=>!e.automatic).length??0;return(0,x.jsxs)(`div`,{className:`save-notice`,role:n?`alert`:`status`,children:[(0,x.jsx)(`span`,{children:n??q(`このファイルは閲覧専用です。共同編集は npx boxglow serve --open または VS Code 拡張で開いてください。`)}),n&&(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-2`,children:[(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>vE(`boxglow-unsaved.json`,Hp(e),`application/json`),children:q(`手元の編集を JSON で退避`)}),r?(0,x.jsxs)(x.Fragment,{children:[l>0?(0,x.jsxs)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>c(!0),children:[q(`変更を比較して選ぶ`),` (`,l,`)`]}):(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>i(`merge`),children:q(`両方の変更を統合`)}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{vE(`boxglow-unsaved.json`,Hp(e),`application/json`),i(`remote`)},children:q(`手元を退避して最新のファイルを開く`)})]}):(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:o,children:q(`保存を再試行`)})]}),s&&r&&(0,x.jsx)(tD,{onClose:()=>c(!1)})]})}var rD=`0.4.0`;function iD(){let e=$(e=>e.peerVersion),t=$(e=>e.source);return(0,x.jsxs)(`details`,{className:`version-info`,children:[(0,x.jsxs)(`summary`,{title:q(`バージョンと接続先`),children:[`v`,rD]}),(0,x.jsxs)(`div`,{className:`card version-info__content`,children:[(0,x.jsx)(`b`,{children:q(`バージョンと接続先`)}),(0,x.jsxs)(`dl`,{children:[(0,x.jsx)(`dt`,{children:`GUI`}),(0,x.jsx)(`dd`,{children:rD}),(0,x.jsx)(`dt`,{children:q(`保存先`)}),(0,x.jsx)(`dd`,{children:t===`serve`?`CLI server`:t===`vscode`?`VS Code`:q(t===`file`?`閲覧専用ファイル`:`ブラウザ内`)}),e&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`dt`,{children:t===`vscode`?`Extension`:`CLI`}),(0,x.jsx)(`dd`,{children:e.extension??e.app??q(`取得できません`)}),(0,x.jsx)(`dt`,{children:q(`接続先のアプリ`)}),(0,x.jsx)(`dd`,{children:e.app??q(`取得できません`)}),(0,x.jsx)(`dt`,{children:q(`保存方式`)}),(0,x.jsxs)(`dd`,{children:[`GUI `,1,` / `,q(`接続先`),` `,e.protocol??`?`]})]}),(0,x.jsx)(`dt`,{children:`Build (JST)`}),(0,x.jsx)(`dd`,{children:`2026-10-04 14:02`})]}),e&&(e.protocol!==1||e.app!==rD)&&(0,x.jsx)(`p`,{role:`status`,children:q(`接続先と画面のバージョンが異なるか、確認できません。CLI・拡張を更新し、画面を再読み込みしてください。`)})]})]})}function aD({project:e,onToggleDrawer:t,onHelp:n}){let r=vw(),i=$(e=>e.readonly),a=$(e=>e.ephemeral),o=$(e=>e.saveState),s=$(e=>e.apply),c=$(e=>e.undo),l=$(e=>e.redo),u=$(e=>e.past.length),d=$(e=>e.future.length),f=$(e=>e.select),p=$(e=>e.focusBlock),m=$(e=>e.selection),h=$(e=>e.closeProject),g=$(e=>e.importJSON),_=$(e=>e.copyToMine),v=$(e=>e.setToast),[b,S]=(0,y.useState)(()=>document.documentElement.dataset.theme||hE());(0,y.useEffect)(()=>{let e=new MutationObserver(()=>S(document.documentElement.dataset.theme||hE()));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>e.disconnect()},[]);let[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),[D,O]=(0,y.useState)(!1),k=(0,y.useRef)(null),A=T.trim()?pm(e,T,12):[],j=e=>{f({blockId:e}),p(e),E(``),O(!1)};(0,y.useEffect)(()=>{let e=e=>{if(document.querySelector(`dialog[open]`))return;let t=e.target;(!t||t.tagName!==`INPUT`&&t.tagName!==`TEXTAREA`)&&e.key===`/`&&!e.isComposing&&!t?.isContentEditable&&t?.tagName!==`SELECT`&&(e.preventDefault(),O(!0),setTimeout(()=>k.current?.focus(),0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,y.useEffect)(()=>{let e=()=>w(!1);return C&&window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[C]);let M=()=>{let e=b===`dark`?`light`:`dark`;gE(e),S(e)},N=()=>{let e=prompt(q(`追加するプロジェクトの名前 (リポジトリごとに 1 つなど)`));e?.trim()&&s(t=>{let n=Gf(t,e.trim());return setTimeout(()=>{f({blockId:n.blockId}),p(n.blockId)},0),n.project})},P=()=>s(e=>Jm(Xf(e))),F=()=>{let t=Hw(e,m,$.getState().viewScope);s(e=>{let n=mp(e,{parentId:t,title:q(`新しいブロック`)}),r=structuredClone(n.project);return r.blocks[t]&&(r.blocks[t].collapsed=!1),setTimeout(()=>{f({blockId:n.blockId}),p(n.blockId)},0),r})},ee=()=>vE(`${xE(e.name)}.boxglow.json`,Hp(e),`application/json`),I=()=>vE(`${xE(e.name)}.md`,LE(e),`text/markdown`),te=async()=>{v(await yE(zE(e,m.blockId??`root`))?q(`Mermaid をコピーしました`):q(`コピーできませんでした`))},ne=async()=>{let e=await bE(`.json,application/json`);if(e)try{await g(e)}catch(e){v(e instanceof Error?e.message:String(e))}},L=$(e=>e.fileName),re=$(e=>e.editMode),ie=$(e=>e.setEditMode),ae=$(e=>e.saveNow),oe=i?`Read only`:a?`Sample (not saved)`:o===`saving`?`Saving…`:o===`unsaved`?`Unsaved`:`Saved`,se=i?q(`閲覧専用`):a?q(`サンプルは保存されません。Save で自分のプロジェクトとして保存`):L?q(`{file} に自動で保存します (変更後)。Save で今すぐ書きます`,{file:L}):q(`このブラウザに自動で保存します`),ce=rm(e),le=ce.working.length;return(0,x.jsxs)(`header`,{className:`topbar`,children:[(0,x.jsxs)(`div`,{className:`topbar-identity`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,title:q(`階層 / 絞り込み / メンバー / 部品`),children:`☰`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:h,title:q(`Home (プロジェクト一覧へ)`),"aria-label":`Home`,children:(0,x.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{d:`M3 11.5 12 4l9 7.5`}),(0,x.jsx)(`path`,{d:`M5.5 10.5V20h13v-9.5`}),(0,x.jsx)(`path`,{d:`M10 20v-5h4v5`})]})}),(0,x.jsx)(`button`,{className:`project-name`,onClick:()=>f({project:!0}),title:e.name,children:e.name}),(0,x.jsxs)(`span`,{className:`save-chip ${o===`unsaved`?`unsaved`:``}`,title:se,children:[!a&&(0,x.jsx)(`span`,{className:`save-chip__file`,children:L??q(`ブラウザ内`)}),(0,x.jsx)(`span`,{children:oe})]}),a&&!i&&(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:_,title:q(`自分のプロジェクトとして保存`),children:`Save`}),!a&&!i&&(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:ae,disabled:o===`saved`||o===`saving`,title:se,children:`Save`})]}),(0,x.jsxs)(`div`,{className:`topbar-tools`,children:[(0,x.jsxs)(`button`,{className:`summary-chip`,"data-on":m.timeline,onClick:()=>f({timeline:!m.timeline}),title:q(`今の状況 (作業中・判断待ち・ログ)`),children:[le>0&&(0,x.jsx)(`span`,{className:`dot`}),le>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`作業中`),` `]}),le]}),ce.blocked.length>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`詰まり・確認待ち`),` `]}),ce.blocked.length]}),ce.decisions.length>0&&(0,x.jsx)(`span`,{className:`dot decision`}),ce.decisions.length>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`判断待ち`),` `]}),ce.decisions.length]}),ce.answered.length>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`回答済み`),` `]}),ce.answered.length]}),le===0&&ce.blocked.length===0&&ce.decisions.length===0&&ce.answered.length===0&&(0,x.jsx)(`span`,{children:`Activity`})]}),!i&&(0,x.jsxs)(`button`,{className:`mode-toggle`,"data-on":re,onClick:()=>ie(!re),title:q(re?`Edit モード: ドラッグで移動・結線・階層移動ができます。押すと View (閲覧) に`:`View モード: ドラッグでの編集は効きません。押すと Edit に`),children:[(0,x.jsx)(`span`,{className:`mode-toggle__knob`}),(0,x.jsx)(`span`,{children:re?`Edit`:`View`})]}),(0,x.jsxs)(`div`,{className:`relative topbar-search`,children:[(0,x.jsx)(`input`,{"aria-label":q(`ブロックを検索`),ref:k,className:`input search-box`,placeholder:q(`Search ID / 題名`),value:T,onChange:e=>{E(e.target.value),O(!0)},onFocus:()=>O(!0),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&A[0]&&j(A[0].id),e.key===`Escape`&&(O(!1),E(``),e.target.blur())},onBlur:()=>setTimeout(()=>O(!1),150)}),D&&T.trim()&&A.length>0&&(0,x.jsx)(`div`,{className:`card absolute right-0 mt-1 p-1 flex flex-col z-30`,style:{width:`min(320px, calc(100vw - 32px))`,maxHeight:320,overflow:`auto`},children:A.map(e=>(0,x.jsxs)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onMouseDown:e=>e.preventDefault(),onClick:()=>j(e.id),children:[(0,x.jsx)(`span`,{className:`chip`,style:{fontFamily:`ui-monospace, monospace`,marginRight:6},children:e.key}),(0,x.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))}),D&&T.trim()&&A.length===0&&(0,x.jsx)(`div`,{className:`card absolute right-0 mt-1 p-2 text-[12px] z-30`,style:{minWidth:200,color:`var(--text-muted)`},children:q(`見つかりません`)})]}),!i&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm desktop-action`,onClick:F,title:q(`ブロックを追加 (N)。ボックスを選んでいればその中に、選んでいなければプロジェクトの中に`),children:`+ Block`}),(0,x.jsx)(`button`,{className:`btn btn-sm desktop-action`,onClick:P,title:q(`Auto Layout: 依存関係で並べ直す (大項目は畳んだ前提)`),children:`Auto Layout`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm desktop-action`,onClick:c,disabled:u===0,title:q(`元に戻す (Ctrl+Z)`),"aria-label":`Undo`,children:`↶`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm desktop-action`,onClick:l,disabled:d===0,title:q(`やり直す (Ctrl+Y)`),"aria-label":`Redo`,children:`↷`})]}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:e=>{e.stopPropagation(),w(!C)},title:`Menu`,"aria-expanded":C,onKeyDown:e=>{e.key===`Escape`&&w(!1)},children:`⋯`}),C&&(0,x.jsxs)(`div`,{className:`card absolute right-0 mt-1 p-1 flex flex-col z-30`,style:{minWidth:220,maxHeight:`min(480px, 65dvh)`,overflowY:`auto`},children:[!i&&(0,x.jsxs)(`div`,{className:`menu-actions`,children:[(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:F,children:`+ Block`}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:P,children:`Auto Layout`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:c,disabled:u===0,children:`Undo`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:l,disabled:d===0,children:`Redo`})]}),!i&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:N,title:q(`同じファイルにプロジェクトのボックスを足す`),children:`New Project`}),!i&&(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:ee,children:`Export JSON`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:I,children:`Export Markdown`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:te,children:`Copy Mermaid`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:ne,children:`Import JSON`}),(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:n,children:`Help`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:h,children:`Home`}),(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>jf(r===`en`?`ja`:`en`),title:q(`画面の文言の言語を切り替える`),children:r===`en`?`日本語`:`English`})]})]}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:M,title:b===`dark`?`Light mode`:`Dark mode`,children:b===`dark`?`☀`:`☾`})]})]})}var oD=240;function sD({project:e,majors:t,scope:n,onSelect:r,marked:i}){vw();let a=(0,y.useRef)(null),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),f=()=>{let e=a.current;e&&(s(e.scrollLeft>1),l(e.scrollLeft+e.clientWidth<e.scrollWidth-1))};(0,y.useEffect)(()=>{f();let e=a.current;if(!e)return;let t=new ResizeObserver(f);return t.observe(e),()=>t.disconnect()},[t.length]),(0,y.useEffect)(()=>{(a.current?.querySelector(`.canvas-tab[data-on="true"]`))?.scrollIntoView({inline:`nearest`,block:`nearest`}),setTimeout(f,0)},[n]),(0,y.useEffect)(()=>{if(!u)return;let e=e=>{e.target.closest?.(`.tab-list, .tab-list-btn`)||d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[u]);let p=e=>a.current?.scrollBy({left:e,behavior:`smooth`}),m=e=>{r(e),d(!1)};return(0,x.jsxs)(`div`,{className:`canvas-tabs`,role:`tablist`,children:[(0,x.jsxs)(`div`,{className:`tab-nav`,children:[(0,x.jsx)(`button`,{className:`tab-nav-btn tab-list-btn`,"data-on":u,onClick:()=>d(e=>!e),title:q(`タブの一覧 (押して選ぶ)`),children:`≡`}),(0,x.jsx)(`button`,{className:`tab-nav-btn`,disabled:!o,onClick:()=>p(-240),title:q(`左へ`),children:`◀`}),(0,x.jsx)(`button`,{className:`tab-nav-btn`,disabled:!c,onClick:()=>p(oD),title:q(`右へ`),children:`▶`})]}),(0,x.jsxs)(`div`,{className:`tab-strip`,ref:a,onScroll:f,children:[(0,x.jsx)(`button`,{className:`canvas-tab`,role:`tab`,"data-on":n===null,"data-marked":i?.has(null)||void 0,onClick:()=>m(null),title:q(`大項目の一覧を俯瞰する (中はそれぞれのタブで)`),children:`All`}),t.map(e=>(0,x.jsxs)(`button`,{className:`canvas-tab`,role:`tab`,"data-on":n===e.id,"data-marked":i?.has(e.id)||void 0,onClick:()=>m(e.id),title:i?.has(e.id)?q(`{title} (選んだ線の続きがある)`,{title:e.title}):q(`{title} の中を見る`,{title:e.title}),children:[(0,x.jsx)(gT,{status:e.status}),(0,x.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))]}),u&&(0,x.jsxs)(`div`,{className:`tab-list card`,role:`menu`,children:[(0,x.jsxs)(`button`,{className:`tab-list-row`,"data-on":n===null,onClick:()=>m(null),children:[(0,x.jsx)(`span`,{className:`tab-list-icon`,children:`⊞`}),(0,x.jsx)(`span`,{className:`truncate`,children:`All`})]}),t.map(t=>{let r=Pp(e,t.id);return(0,x.jsxs)(`button`,{className:`tab-list-row`,"data-on":n===t.id,onClick:()=>m(t.id),title:t.title,children:[(0,x.jsx)(gT,{status:t.status}),(0,x.jsx)(`span`,{className:`truncate`,children:t.title}),(0,x.jsx)(`span`,{className:`tab-list-prog`,children:r.total>0?`${r.percent}%`:``})]},t.id)})]})]})}function cD(e,t,n,r){try{let i=Number(localStorage.getItem(e));return Number.isFinite(i)&&i>=n&&i<=r?i:t}catch{return t}}function lD(e,t){try{localStorage.setItem(e,String(t))}catch{}}var uD={min:260,max:760,def:320},dD={min:220,max:640,def:280};function fD(){vw();let e=$(e=>e.project),t=Ww(),n=$(e=>e.embed),r=$(e=>e.readonly),i=$(e=>e.toast),a=$(e=>e.setToast),o=$(e=>e.selection),s=$(e=>e.select),c=$(e=>e.focusBlock),l=$(e=>e.apply),u=$(e=>e.undo),d=$(e=>e.redo),f=$(e=>e.setMode),p=$(e=>e.openSample),m=$(e=>e.openExample),h=$(e=>e.openProject),g=$(e=>e.openFromServer),_=$(e=>e.openFromVsCode),v=$(e=>e.viewScope),b=$(e=>e.setViewScope),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(()=>cD(`boxglow:rightW`,uD.def,uD.min,uD.max)),[E,D]=(0,y.useState)(()=>cD(`boxglow:drawerW`,dD.def,dD.min,dD.max)),O=(0,y.useCallback)(e=>{T(e),lD(`boxglow:rightW`,e)},[]),k=(0,y.useCallback)(e=>{D(e),lD(`boxglow:drawerW`,e)},[]),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)({...HE,statuses:new Set(HE.statuses)});(0,y.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`view`)===`article`,n=t||e.get(`embed`)===`1`;f({embed:n,readonly:t||e.get(`readonly`)===`1`});let r=e.get(`theme`);(r===`dark`||r===`light`)&&gE(r,!1);let i=null;if(n&&window.parent!==window)try{let e=window.parent.document.documentElement,t=()=>{let t=e.dataset.theme;(t===`dark`||t===`light`)&&gE(t,!1)};t(),i=new MutationObserver(t),i.observe(e,{attributes:!0,attributeFilter:[`data-theme`]})}catch{}if(window.acquireVsCodeApi){let e=()=>gE(document.body.classList.contains(`vscode-dark`)||document.body.classList.contains(`vscode-high-contrast`)?`dark`:`light`,!1);e(),i=new MutationObserver(e),i.observe(document.body,{attributes:!0,attributeFilter:[`class`]}),_()}else if(e.get(`demo`)===`daw`)m();else if(t||e.get(`demo`)===`1`){if(p(),t){let e=$.getState(),t=Object.values(e.project?.blocks??{}),n=t.find(e=>e.kind===`task`&&t.some(t=>t.parentId===e.id));n&&e.setViewScope(n.id)}}else if(e.get(`serve`)===`1`)g();else{let e=window.location.hash.match(/p=([\w-]+)/);e&&h(e[1])}return()=>i?.disconnect()},[f,p,m,h,g,_]),(0,y.useEffect)(()=>{let e=e=>{let t=$.getState();!t.ephemeral&&[`saving`,`unsaved`].includes(t.saveState)&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]),(0,y.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(null),3200);return()=>clearTimeout(e)},[i,a]),(0,y.useEffect)(()=>{let e=e=>{if(document.querySelector(`dialog[open]`)||e.isComposing)return;let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n=$.getState().project;if(!n)return;let i=$.getState().selection;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`z`)e.preventDefault(),e.shiftKey?d():u();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`y`)e.preventDefault(),d();else if(e.key===`Delete`||e.key===`Backspace`){if(r||!$.getState().editMode)return;if(i.edgeId){let e=n.edges[i.edgeId];e&&!e.auto&&(s({}),l(e=>kp(e,i.edgeId)))}else if(i.blockId){let e=n.blocks[i.blockId],t=Object.values(n.blocks).filter(e=>e.parentId===i.blockId).length;e&&(t===0||confirm(q(`「{title}」と下の階層のブロックを削除します。よろしいですか?`,{title:e.title})))&&(s({}),l(e=>vp(e,i.blockId)))}}else if(e.key.toLowerCase()===`n`&&!e.ctrlKey&&!e.metaKey){if(r)return;let e=Hw(n,i,$.getState().viewScope);l(t=>{let n=mp(t,{parentId:e,title:q(`新しいブロック`)}),r=structuredClone(n.project);return r.blocks[e]&&(r.blocks[e].collapsed=!1),setTimeout(()=>{s({blockId:n.blockId}),c(n.blockId)},0),r})}else e.key===`Escape`&&(s({}),j(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,u,d,s,r,c]);let P=(0,y.useMemo)(()=>!e||WE(M)?null:t=>UE(e,t,M),[e,M]),F=(0,y.useCallback)(()=>C(e=>!e),[]),ee=(0,y.useCallback)(()=>C(!0),[]),I=e?Pp(e,Ff):null,te=(0,y.useMemo)(()=>{let e=new URL(window.location.href);return e.searchParams.delete(`embed`),e.searchParams.delete(`readonly`),e.searchParams.delete(`view`),e.searchParams.set(`demo`,e.searchParams.get(`demo`)===`daw`?`daw`:`1`),e.toString()},[]),ne=!!e&&!n&&(o.blockId!==null||o.edgeId!==null||o.terminal!==null||o.project||o.timeline),L=[`app-grid`,n?`embed`:``,ne?``:`no-right`].filter(Boolean).join(` `),re=(0,y.useMemo)(()=>e?qf(e):[],[e]),ie=(0,y.useMemo)(()=>e&&o.edgeId&&e.edges[o.edgeId]?new Set(Im(e,o.edgeId)):void 0,[e,o.edgeId]),ae=!!e&&re.length>0,oe=v&&e?.blocks[v]?v:null,se=(0,y.useMemo)(()=>e&&oe?Qf(e,oe):[],[e,oe]),ce=se[0]?.id??null;return(0,x.jsxs)(`div`,{className:L,style:{"--right-w":`${w}px`},children:[(0,x.jsxs)(`div`,{className:`app-top`,children:[e&&!n&&(0,x.jsx)(aD,{project:e,onToggleDrawer:F,onHelp:()=>j(!0)}),e&&!n&&(0,x.jsx)(nD,{})]}),(0,x.jsxs)(`main`,{className:`app-main relative min-w-0 min-h-0`,children:[(0,x.jsxs)(`div`,{className:`canvas-wrap`,children:[e&&(0,x.jsx)(yd,{children:(0,x.jsx)(cE,{project:t??e,matcher:P})}),e&&S&&!n&&(0,x.jsx)(KE,{project:t??e,filter:M,onFilter:N,onClose:()=>C(!1),width:E}),e&&S&&!n&&(0,x.jsx)(dE,{side:`right`,width:E,min:dD.min,max:dD.max,onWidth:k,style:{left:8+E-5,top:8,bottom:8}}),e&&(se.length>0||!n&&!WE(M))&&(0,x.jsxs)(`div`,{className:`scope-path`,style:{left:S&&!n?8+E+8:8},children:[se.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{className:`scope-crumb`,onClick:()=>b(null),title:q(`大項目の一覧へ`),children:`All`}),se.map((e,t)=>(0,x.jsxs)(`span`,{className:`contents`,children:[(0,x.jsx)(`span`,{className:`scope-sep`,children:`›`}),t===se.length-1?(0,x.jsx)(`span`,{className:`scope-crumb current`,title:e.title,children:e.title}):(0,x.jsx)(`button`,{className:`scope-crumb`,onClick:()=>b(e.id),title:q(`{title} へ戻る`,{title:e.title}),children:e.title})]},e.id))]}),!n&&!WE(M)&&(0,x.jsx)(`button`,{className:`chip`,"data-on":`true`,onClick:()=>N({...HE,statuses:new Set(HE.statuses)}),title:q(`絞り込みを解除`),children:`Filtered ×`})]}),n&&(0,x.jsx)(`a`,{className:`btn btn-accent absolute top-2 right-2 z-10`,href:te,target:`_blank`,rel:`noopener noreferrer`,children:`Open full ↗`}),n&&se.length===0&&(0,x.jsx)(`span`,{className:`absolute top-2 left-2 z-10 font-head text-[14px] px-2 py-1 rounded-lg`,style:{background:`var(--bg-card)`,border:`2px solid var(--line)`},children:`Boxglow`})]}),ae&&(0,x.jsx)(sD,{project:e,majors:re,scope:ce,onSelect:b,marked:ie}),!e&&!n&&(0,x.jsx)(SE,{}),A&&(0,x.jsx)(`div`,{className:`modal-backdrop`,onClick:()=>j(!1),children:(0,x.jsxs)(`div`,{className:`card modal p-5 flex flex-col gap-2`,style:{width:420},onClick:e=>e.stopPropagation(),children:[(0,x.jsx)(`div`,{className:`font-head text-[16px]`,children:`Help`}),(0,x.jsx)(`table`,{className:`help-table`,children:(0,x.jsxs)(`tbody`,{children:[(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`ブロックを置く`)}),(0,x.jsxs)(`td`,{children:[(0,x.jsx)(`span`,{className:`kbd`,children:`N`}),` `,q(`または「+ Block」(選んだボックスの中に)`)]})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:`Edit / View`}),(0,x.jsx)(`td`,{children:q(`上の切替。Edit のときだけドラッグで移動・結線・階層移動と Del が効く`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`結線`)}),(0,x.jsx)(`td`,{children:q(`丸から相手の丸、または相手のボックスへドラッグ (近くで離せばつながる)`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`階層を移す`)}),(0,x.jsx)(`td`,{children:q(`ボックスをドラッグして別のボックスの中に落とす`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`下の階層を畳む / 展開`)}),(0,x.jsx)(`td`,{children:q(`ブロックをダブルクリック`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`削除`)}),(0,x.jsx)(`td`,{children:(0,x.jsx)(`span`,{className:`kbd`,children:`Del`})})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`元に戻す / やり直す`)}),(0,x.jsxs)(`td`,{children:[(0,x.jsx)(`span`,{className:`kbd`,children:`Ctrl+Z`}),` / `,(0,x.jsx)(`span`,{className:`kbd`,children:`Ctrl+Y`})]})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`選択を解除`)}),(0,x.jsx)(`td`,{children:(0,x.jsx)(`span`,{className:`kbd`,children:`Esc`})})]})]})}),(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`ボックスは「入力から出力を作るタスク」。出力を先に決め、大きなボックスは「分解する」で中にボックスを置く。供給元の無い入力は左端の入力まで自動で点線が伸びる。`)}),(0,x.jsx)(`button`,{className:`btn btn-sm self-end`,onClick:()=>j(!1),children:`Close`})]})})]}),(0,x.jsxs)(`aside`,{className:`panel right ${ne?``:`hidden-panel`}`,children:[e&&ne&&(0,x.jsx)(dE,{side:`left`,width:w,min:uD.min,max:uD.max,onWidth:O}),e&&ne&&(0,x.jsx)(JE,{project:e,onOpenDrawer:ee})]}),(0,x.jsxs)(`footer`,{className:`app-footer flex items-center gap-3 px-3 text-[12px]`,style:{borderTop:`2px solid var(--line)`,background:`var(--bg-card)`},children:[e&&I&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`font-head`,children:[`Done `,I.white,` / `,I.total,` · `,I.percent,`%`]}),(0,x.jsx)(`div`,{className:`progress-bar`,style:{width:160},children:(0,x.jsx)(`span`,{style:{width:`${I.percent}%`}})}),n&&(0,x.jsx)(`a`,{className:`underline`,href:te,target:`_blank`,rel:`noopener noreferrer`,style:{color:`var(--primary-strong)`},children:q(`Boxglow で開く`)})]}),!e&&(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`Boxglow`}),(0,x.jsx)(iD,{}),(0,x.jsxs)(`span`,{className:`build-stamp text-[10px]`,style:{color:`var(--text-muted)`},title:q(`ビルド日時 (日本時間)。古い場合は再読み込み (Ctrl+F5) してください`),children:[`build `,`2026-10-04 14:02`]})]}),i&&(0,x.jsx)(`div`,{className:`toast`,role:`status`,children:i})]})}_E(),window.boxglow={store:$},b.createRoot(document.getElementById(`root`)).render((0,x.jsx)(y.StrictMode,{children:(0,x.jsx)(fD,{})}));
|
|
3464
|
+
`)}var BE=[`#0d8080`,`#e8875e`,`#3aa85a`,`#6b7075`,`#2f6fb3`,`#a0522d`],VE={black:`?`,gray:`~`,white:`✓`},HE={statuses:new Set([`black`,`gray`,`white`]),memberId:null,unassigned:!1,category:null};function UE(e,t,n){let r=e.blocks[t];return!(!r||!n.statuses.has(r.status)||n.memberId&&!r.assigneeIds.includes(n.memberId)||n.unassigned&&(r.assigneeIds.length>0||$f(r)===`project`)||n.category&&r.category!==n.category)}var WE=e=>e.statuses.size===3&&e.memberId===null&&!e.unassigned&&e.category===null;function GE({project:e,parentId:t,depth:n,selectedId:r,onSelect:i,closed:a,onToggle:o}){vw();let s=rp(e,t).sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x);return(0,x.jsx)(x.Fragment,{children:s.map(t=>{let s=rp(e,t.id).length>0,c=a.has(t.id);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`tree-row`,"data-selected":r===t.id,style:{paddingLeft:8+n*14},onClick:()=>i(t.id),title:t.title,children:[s?(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{padding:`0 4px`},onClick:e=>{e.stopPropagation(),o(t.id)},title:q(c?`開く`:`閉じる`),children:c?`▸`:`▾`}):(0,x.jsx)(`span`,{style:{width:20,display:`inline-block`}}),(0,x.jsx)(`span`,{className:`tree-glyph ${t.status}`,children:VE[t.status]}),(0,x.jsx)(`span`,{className:`truncate`,children:t.title})]}),s&&!c&&(0,x.jsx)(GE,{project:e,parentId:t.id,depth:n+1,selectedId:r,onSelect:i,closed:a,onToggle:o})]},t.id)})})}function KE({project:e,filter:t,onFilter:n,onClose:r,width:i}){vw();let a=$(e=>e.readonly),o=$(e=>e.selection),s=$(e=>e.select),c=$(e=>e.apply),[l,u]=(0,y.useState)(()=>new Set),d=e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[f,p]=(0,y.useState)(``),[m,h]=(0,y.useState)(BE[0]),g=$(e=>e.focusBlock),_=$(e=>e.setToast),v=$(e=>e.meId),b=$(e=>e.setMe),[S,C]=(0,y.useState)([]);(0,y.useEffect)(()=>{wE().then(C)},[]);let w=()=>void wE().then(C),T=t=>{let n=Hw(e,o,$.getState().viewScope);c(e=>{let r=sm(e,n,t,`human`);return setTimeout(()=>{s({blockId:r.blockId}),g(r.blockId)},0),r.project})},E=async()=>{let e=await bE(`.json,application/json`);if(e)try{await TE(cm(e)),w(),_(q(`テンプレートをライブラリに追加しました`))}catch(e){_(e instanceof Error?e.message:String(e))}},D=e=>{let r=new Set(t.statuses);r.has(e)?r.delete(e):r.add(e),r.size!==0&&n({...t,statuses:r})},O=()=>{f.trim()&&(c(e=>Ap(e,f.trim(),m).project),p(``),h(BE[(BE.indexOf(m)+1)%BE.length]))},[k,A]=(0,y.useState)(`tree`),j=[{id:`tree`,label:`Tree`,hint:q(`ボックスの一覧 (押すと選ぶ)`)},{id:`filter`,label:`Filter`,hint:q(`状態や担当でボックスを絞る`)},{id:`members`,label:`Members`,hint:q(`担当にする人を登録。自分を決める`)},{id:`parts`,label:`Parts`,hint:q(`他のプロジェクトでも使い回すボックス`)}];return(0,x.jsxs)(`div`,{className:`drawer card`,style:{width:i},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mb-2`,children:[(0,x.jsx)(`div`,{className:`seg flex-1`,style:{gridTemplateColumns:`repeat(4, 1fr)`},children:j.map(e=>(0,x.jsx)(`button`,{className:`seg__btn`,"data-on":k===e.id,onClick:()=>A(e.id),title:e.hint,style:{padding:`6px 2px`,fontSize:12},children:e.label},e.id))}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:r,title:`Close`,children:`×`})]}),(0,x.jsx)(`div`,{className:`text-[11px] mb-2`,style:{color:`var(--text-muted)`},children:j.find(e=>e.id===k)?.hint}),k===`tree`&&(rp(e,`root`).length===0?(0,x.jsx)(`div`,{className:`text-[12px] px-2`,style:{color:`var(--text-muted)`},children:`No blocks yet`}):(0,x.jsx)(GE,{project:e,parentId:`root`,depth:0,selectedId:o.blockId,onSelect:e=>{s({blockId:e}),g(e)},closed:l,onToggle:d})),k===`filter`&&(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[[`black`,`gray`,`white`].map(e=>(0,x.jsxs)(`button`,{className:`chip`,"data-on":t.statuses.has(e),onClick:()=>D(e),children:[(0,x.jsx)(`span`,{className:`tree-glyph ${e}`,style:{width:12,height:12,fontSize:8,lineHeight:`8px`},children:VE[e]}),mT[e]]},e)),v&&(0,x.jsx)(`button`,{className:`chip`,"data-on":t.memberId===v,onClick:()=>n({...t,memberId:t.memberId===v?null:v,unassigned:!1}),title:q(`自分の担当だけ`),children:`Mine`}),(0,x.jsx)(`button`,{className:`chip`,"data-on":t.unassigned,onClick:()=>n({...t,unassigned:!t.unassigned,memberId:null}),title:q(`担当がいないボックスだけ`),children:q(`未担当`)}),e.members.filter(e=>e.id!==v).map(e=>(0,x.jsxs)(`button`,{className:`chip`,"data-on":t.memberId===e.id,onClick:()=>n({...t,memberId:t.memberId===e.id?null:e.id,unassigned:!1}),title:q(`{name} の担当だけ`,{name:e.name}),children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:e.color,width:16,height:16,fontSize:9},children:e.name.slice(0,1)}),e.name]},e.id)),(0,x.jsx)(`div`,{className:`label mt-3`,children:`Category`}),(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:pf.map(e=>(0,x.jsxs)(`button`,{className:`chip cat-chip${e.neutral?` neutral`:``}`,"data-on":t.category===e.key,style:{"--cat":e.color},onClick:()=>n({...t,category:t.category===e.key?null:e.key}),title:q(`{label} のボックスだけ`,{label:q(e.label)}),children:[(0,x.jsx)(`span`,{className:`cat-chip__dot`}),q(e.label)]},e.key))}),!WE(t)&&(0,x.jsx)(`button`,{className:`chip mt-3`,onClick:()=>n({...HE,statuses:new Set(HE.statuses)}),children:`Clear`})]}),k===`parts`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`text-[11px] mb-1`,style:{color:`var(--text-muted)`},children:q(`挿入先: {target}`,{target:(()=>{let t=Hw(e,o,$.getState().viewScope),n=e.blocks[t];return n?$f(n)===`project`?n.title:q(`{title} の隣`,{title:n.title}):q(`最上位`)})()})}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[S.length===0&&(0,x.jsx)(`div`,{className:`text-[12px] px-1`,style:{color:`var(--text-muted)`},children:q(`ボックスを選び、右の「⋯」から「Save as Part」すると、ここに並びます。`)}),S.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-1 text-[13px] px-1`,children:[(0,x.jsx)(`span`,{className:`truncate`,title:`${e.description||e.name} (v${e.version}${e.tags.length?`, `+e.tags.join(`, `):``})`,children:e.name}),(0,x.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--text-muted)`},children:[`v`,e.version]}),(0,x.jsxs)(`span`,{className:`ml-auto flex gap-0.5`,children:[!a&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`挿入`),onClick:()=>T(e),children:`Insert`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`JSON で保存 (他のリポジトリや人と共有)`),onClick:()=>vE(`${xE(e.name)}.boxglow-block.json`,JSON.stringify(e,null,2),`application/json`),children:`↓`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`ライブラリから消す`),onClick:()=>{confirm(q(`テンプレート「{name}」を消しますか?`,{name:e.name}))&&EE(e.id).then(w)},children:`×`})]})]},e.id)),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm self-start`,onClick:E,children:`Import`})]})]}),k===`members`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] px-1`,children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:e.color},children:e.name.slice(0,1)}),(0,x.jsx)(`span`,{className:`truncate`,children:e.name}),(0,x.jsx)(`button`,{className:`chip ml-auto`,"data-on":v===e.id,onClick:()=>b(v===e.id?null:e.id),title:q(`このブラウザでは自分として扱う (自分の担当のボックスに帯が付く)`),children:v===e.id?`Me`:`Set as me`}),!a&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`外す`),onClick:()=>c(t=>jp(t,e.id)),children:`×`})]},e.id))}),!a&&(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[(0,x.jsx)(`span`,{className:`avatar flex-none`,style:{background:m,cursor:`pointer`},title:q(`色を変える`),onClick:()=>h(BE[(BE.indexOf(m)+1)%BE.length]),children:f.slice(0,1)||`+`}),(0,x.jsx)(`input`,{className:`input`,placeholder:`Name`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&O()}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:O,disabled:!f.trim(),children:`Add`})]})]})]})}function qE({title:e,children:t}){vw();let n=$(e=>e.select);return(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mb-2`,children:[(0,x.jsx)(`span`,{className:`label truncate flex-1`,title:e,children:e}),t,(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>n({}),title:q(`閉じる (Esc)`),children:`×`})]})}function JE({project:e,onOpenDrawer:t}){let n=$(e=>e.selection);return n.edgeId&&e.edges[n.edgeId]?(0,x.jsx)($E,{project:e,edgeId:n.edgeId}):n.blockId&&e.blocks[n.blockId]?(0,x.jsx)(ZE,{project:e,blockId:n.blockId,onOpenDrawer:t}):n.terminal?(0,x.jsx)(XE,{project:e,which:n.terminal,groupId:n.terminalGroup}):n.project?(0,x.jsx)(YE,{project:e}):n.timeline?(0,x.jsx)(AE,{project:e}):null}function YE({project:e}){vw();let t=$(e=>e.readonly),n=$(e=>e.apply),r=Pp(e,Ff);return(0,x.jsxs)(`div`,{className:`flex flex-col gap-4 p-3`,children:[(0,x.jsx)(qE,{title:`Project`}),(0,x.jsx)(`input`,{className:`input font-head text-[16px]`,value:e.name,disabled:t,onChange:e=>n(t=>({...structuredClone(t),name:e.target.value}))}),(0,x.jsx)(fE,{multiline:!0,className:`input`,placeholder:q(`ゴール (何を達成したいか)`),value:e.description,disabled:t,onCommit:e=>n(t=>({...structuredClone(t),description:e}))}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`progress-bar`,children:(0,x.jsx)(`span`,{style:{width:`${Math.round(r.ratio*100)}%`}})}),(0,x.jsx)(`div`,{className:`text-[12px] mt-1`,style:{color:`var(--text-muted)`},children:q(`完了 {white} / {total}`,{white:r.white,total:r.total})})]})]})}function XE({project:e,which:t,groupId:n}){vw();let r=$(e=>e.readonly),i=$(e=>e.apply),a=$(e=>e.select),o=$(e=>e.setToast),s=n?Em(e).find(e=>e.id===n)??null:null,c=Em(e),l=t===`out`?`Project Outputs`:s?`Input Group`:`Project Inputs`;return(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,x.jsx)(qE,{title:l}),s&&(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsx)(`span`,{className:`label`,children:`Group`}),(0,x.jsxs)(`span`,{className:`flex gap-1`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`このグループを JSON に書き出す (他のプロジェクトで読み込める)`),onClick:()=>vE(`${xE(s.name)}.boxglow-inputs.json`,Nm(e,s.id),`application/json`),children:`Export`}),!r&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-danger`,title:q(`グループを消す (入力は Inputs に戻る)`),onClick:()=>{confirm(q(`グループ「{name}」を消しますか? (入力は Inputs に戻ります)`,{name:s.name}))&&(a({terminal:`in`}),i(e=>Am(e,s.id)))},children:`Delete`})]})]}),(0,x.jsx)(`input`,{className:`input font-head text-[15px]`,value:s.name,disabled:r,placeholder:`Group name`,onChange:e=>i(t=>km(t,s.id,{name:e.target.value}))}),(0,x.jsx)(`input`,{className:`input`,value:s.description,disabled:r,placeholder:q(`説明 (任意。例: PCI-SIG の仕様書一式)`),onChange:e=>i(t=>km(t,s.id,{description:e.target.value}))})]}),(0,x.jsx)(uE,{project:e,blockId:Ff,direction:t,readonly:r,title:t===`in`?`Inputs`:`Outputs`,allowAdd:t===`out`||!!s,groupId:t===`in`?s?s.id:null:void 0}),t===`in`&&!s&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`ここには、下の階層で供給元が決まっていない入力が自動で上がります。各入力はグループに移せます。`)}),(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsx)(`span`,{className:`label`,children:`Groups`}),!r&&(0,x.jsxs)(`span`,{className:`flex gap-1`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>{let e=prompt(q(`グループの名前 (例: PCIe 仕様書)`));e?.trim()&&i(t=>{let n=Om(t,e.trim());return setTimeout(()=>a({terminal:`in`,terminalGroup:n.groupId}),0),n.project})},children:`+ Group`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:async()=>{let e=await bE(`.json,application/json`);if(e)try{i(t=>{let n=Pm(t,e);return setTimeout(()=>a({terminal:`in`,terminalGroup:n.groupId}),0),n.project})}catch(e){o(e instanceof Error?e.message:String(e))}},title:q(`他のプロジェクトで書き出したグループを読み込む`),children:`Import`})]})]}),c.length===0&&(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`仕様書などを種類ごとに分けるときは、グループを作って入力を入れます (例: PCIe 仕様書、DDR 仕様書)。`)}),c.map(t=>(0,x.jsxs)(`button`,{className:`tree-row text-left`,onClick:()=>a({terminal:`in`,terminalGroup:t.id}),children:[(0,x.jsx)(`span`,{className:`truncate`,children:t.name}),(0,x.jsx)(`span`,{className:`ml-auto text-[11px]`,style:{color:`var(--text-muted)`},children:Dm(e,t.id).length})]},t.id))]})]})]})}function ZE({project:e,blockId:t}){vw();let n=$(e=>e.readonly),r=$(e=>e.apply),i=$(e=>e.select),a=$(e=>e.setToast),o=$(e=>e.meId),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(null),[d,f]=(0,y.useState)(!0),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(`status`),b=e.blocks[t],S=h.trim()?e.members.filter(e=>e.name.toLowerCase().includes(h.trim().toLowerCase())&&!b.assigneeIds.includes(e.id)).slice(0,8):[],C=rp(e,t),w=[...ap(e,t)].reverse(),T=Vp(e,t),E=Pp(e,t),D=b.decisions.filter(e=>e.answer===void 0),O=b.decisions.filter(n=>n.answer!==void 0&&!nm(e,t,n)),k=Np(e,t),A=$f(b)===`project`;(0,y.useEffect)(()=>{c(!1),u(null),f(!0),m(!1),g(``)},[t]);let j=e=>r(n=>hp(n,t,{status:e})),M=e=>r(n=>{let r=n.blocks[t].assigneeIds;return hp(n,t,{assigneeIds:r.includes(e)?r.filter(t=>t!==e):[...r,e]})}),N=()=>{C.length>0&&!confirm(q(`「{title}」と下の階層のブロックを削除します。よろしいですか?`,{title:b.title}))||(i({}),r(e=>vp(e,t)))},P=async n=>{c(!1),await yE(RE(e,t,n))?a(q(`AI に渡すテキストをコピーしました`)):u(n)},F=async()=>{m(!1);let n=am(e,t,{tags:(prompt(q(`部品の札 (例: 画像処理, 認証。カンマ区切り。省略可)`))??``).split(/[,、]/).map(e=>e.trim()).filter(Boolean)});await TE(n),a(q(`「{name}」を部品として保存しました (☰ の「部品」から挿入)`,{name:n.name}))},ee={status:q(`状態・進捗・活動・判断`),io:q(`入力と出力 (成果物)`),owner:q(`担当`),dates:q(`開始日・期日・時間`),more:q(`AI に渡す・メモ・資料`)};return(0,x.jsxs)(`div`,{className:`flex flex-col gap-4 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`label truncate flex-1`,title:w.map(e=>e.id===`root`?``:e.title).filter(Boolean).join(` › `),children:A?`Project`:w.map(e=>e.id===`root`?``:e.title).filter(Boolean).join(` › `)||`Top`}),(0,x.jsx)(`button`,{className:`chip`,style:{fontFamily:`ui-monospace, monospace`},title:q(`短い ID (押すとコピー。検索や CLI で使えます)`),onClick:async()=>{await yE(b.key??``)&&a(q(`ID {key} をコピーしました`,{key:b.key??``}))},children:b.key}),!n&&(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>m(!p),title:`More`,children:`⋯`}),p&&(0,x.jsxs)(`div`,{className:`card absolute right-0 mt-1 p-1 flex flex-col z-30`,style:{minWidth:200},children:[!A&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:F,children:`Save as Part`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>{m(!1),u(`plan`),v(`more`)},children:`Show AI text`}),(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start btn-danger`,onClick:N,children:`Delete`})]})]}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>i({}),title:q(`閉じる (Esc)`),children:`×`})]}),(0,x.jsx)(fE,{className:`input font-head text-[16px]`,value:b.title,disabled:n,placeholder:q(`Title (何を作るか)`),onCommit:e=>r(n=>hp(n,t,{title:e}))}),(0,x.jsx)(`div`,{className:`seg`,style:{gridTemplateColumns:`repeat(5, 1fr)`},children:[[`status`,`Status`],[`io`,`I/O`],[`owner`,`Owner`],[`dates`,`Dates`],[`more`,`More`]].map(([n,r])=>(0,x.jsxs)(`button`,{className:`seg__btn`,"data-on":_===n,onClick:()=>v(n),style:{padding:`6px 2px`,fontSize:12},title:ee[n],children:[r,n===`status`&&(D.length>0||O.length>0)&&(0,x.jsx)(`span`,{className:`dot decision`,style:{marginLeft:4,display:`inline-block`,width:6,height:6,borderRadius:999,background:`var(--accent)`}}),n===`io`&&(0,x.jsxs)(`span`,{style:{marginLeft:4,fontSize:10,opacity:.7},children:[Y(e,t,`in`).length,`/`,Y(e,t,`out`).length]})]},n))}),_!==`status`&&(D.length>0||O.length>0)&&(0,x.jsxs)(`button`,{className:`btn btn-sm inspector-attention`,onClick:()=>v(`status`),title:q(`Status で確認`),"aria-label":[D.length>0?q(`回答待ち {n}`,{n:D.length}):``,O.length>0?q(`AI未確認 {n}`,{n:O.length}):``,q(`Status で確認`)].filter(Boolean).join(` `),children:[[D.length>0?q(`回答待ち {n}`,{n:D.length}):``,O.length>0?q(`AI未確認 {n}`,{n:O.length}):``].filter(Boolean).join(`・`),(0,x.jsx)(`span`,{"aria-hidden":`true`,style:{marginLeft:8},children:`→`})]}),_===`status`&&(0,x.jsxs)(`section`,{className:`sec`,children:[D.length>0&&(0,x.jsxs)(`div`,{className:`attention-section`,children:[(0,x.jsx)(`h3`,{className:`label`,children:q(`回答が必要です`)}),D.map(n=>(0,x.jsx)(OE,{project:e,blockId:t,decisionId:n.id},n.id))]}),O.length>0&&(0,x.jsxs)(`div`,{className:`attention-section`,children:[(0,x.jsx)(`h3`,{className:`label`,children:q(`AI未確認の回答`)}),O.map(n=>(0,x.jsx)(OE,{project:e,blockId:t,decisionId:n.id},n.id))]}),(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Status`})}),(0,x.jsx)(`div`,{className:`seg`,children:[`black`,`gray`,`white`].map(e=>(0,x.jsxs)(`button`,{className:`seg__btn`,"data-on":b.status===e,disabled:n,onClick:()=>j(e),title:q(hT[e]),children:[(0,x.jsx)(`span`,{className:`tree-glyph ${e}`,children:VE[e]}),(0,x.jsx)(`span`,{children:mT[e]})]},e))}),T&&!n&&(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm w-full`,onClick:()=>j(`white`),title:q(`下の階層が全部完了し、出力に成果物が付いています`),children:q(`完了にできます → Done`)}),b.status!==`white`&&$f(b)!==`project`&&Y(e,t,`in`).length>0&&(()=>{let n=Bp(e,t);return n.length===0?(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--primary-strong)`},children:q(`必須の入力はそろっています (着手できます)`)}):(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`必須の入力待ち: {names}`,{names:n.map(e=>e.name).join(`, `)})})})(),A&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`sec__head mt-2`,children:(0,x.jsx)(`span`,{className:`label`,children:`Repository`})}),(0,x.jsx)(`input`,{className:`input`,placeholder:q(`パスや URL (例: ../mg-core、github.com/you/repo)`),value:b.repo??``,disabled:n,onChange:e=>r(n=>hp(n,t,{repo:e.target.value}),{history:!1}),onBlur:e=>r(n=>hp(n,t,{repo:e.target.value.trim()||void 0}))}),(0,x.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--text-muted)`},children:q(`複数のリポジトリをまたぐときは、boxglow.json を上のフォルダに 1 つ置き、各リポジトリの AI には環境変数 BOXGLOW_FILE でその場所を教えます`)})]}),(0,x.jsxs)(`label`,{className:`category-field`,children:[(0,x.jsx)(`span`,{className:`label`,children:`Category`}),(0,x.jsxs)(`select`,{className:`input`,"aria-label":`Category`,value:b.category??``,disabled:n,onChange:e=>r(n=>lm(n,t,e.target.value||null)),children:[(0,x.jsx)(`option`,{value:``,children:q(`カテゴリなし`)}),pf.map(e=>(0,x.jsx)(`option`,{value:e.key,children:q(e.label)},e.key))]})]}),b.status!==`white`&&(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,style:{color:`var(--text-muted)`},children:[(0,x.jsx)(`input`,{type:`range`,min:0,max:100,step:5,value:k,disabled:n,className:`flex-1`,title:q(`進捗 (ドラッグで入力)`),onChange:e=>r(n=>Fp(n,t,Number(e.target.value),`human`),{history:!1}),onMouseUp:e=>r(n=>Fp(n,t,Number(e.target.value),`human`))}),(0,x.jsxs)(`span`,{style:{minWidth:36,textAlign:`right`},children:[k,`%`]}),typeof b.progress==`number`?(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,title:q(`手入力をやめて、下の階層から自動で計算する`),onClick:()=>r(e=>Fp(e,t,null,`human`)),children:`Auto`}):C.length>0?(0,x.jsxs)(`span`,{title:q(`下の階層の完了数`),children:[E.white,`/`,E.total]}):null]}),b.activity&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-1 pl-2`,style:{borderLeft:`3px solid ${b.activity.state===`needs_decision`?`var(--accent)`:`var(--primary)`}`},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,x.jsx)(`span`,{className:`tl-actor`,children:cT(b.activity.actor)}),(0,x.jsx)(`b`,{children:q(uT[b.activity.state])}),(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:fT(b.activity.since)}),!n&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm ml-auto`,title:q(`活動の印を消す`),onClick:()=>r(e=>qp(e,t)),children:`×`})]}),b.activity.note&&b.activity.state!==`needs_decision`&&(0,x.jsx)(`div`,{className:`text-[13px]`,children:b.activity.note})]}),(0,x.jsxs)(`details`,{className:`text-[12px]`,open:!!e.handoffs?.[t],children:[(0,x.jsx)(`summary`,{children:q(`AI への引き継ぎ`)}),(0,x.jsx)(`p`,{className:`my-2`,children:q(`セッションを越えて残す発見・次の手順・未解決事項。AI は context コマンドで判断と合わせて読み直します。`)}),(0,x.jsx)(fE,{multiline:!0,className:`input`,value:e.handoffs?.[t]?.note??``,disabled:n,placeholder:q(`発見 / 次の手順 / 未解決事項`),onCommit:e=>r(n=>({...n,handoffs:{...n.handoffs,[t]:{note:e,actor:`human`,at:new Date().toISOString()}}}))}),(0,x.jsx)(`button`,{className:`btn btn-sm mt-2`,onClick:async()=>{let n=await yE(JSON.stringify(jE(e,t),null,2));a(q(n?`引き継ぎ情報をコピーしました`:`コピーできませんでした`))},children:q(`判断・入出力も含めてコピー`)})]}),b.decisions.filter(n=>n.answer!==void 0&&nm(e,t,n)).length>0&&(0,x.jsxs)(`details`,{className:`text-[12px]`,children:[(0,x.jsx)(`summary`,{style:{cursor:`pointer`,color:`var(--text-muted)`},children:q(`判断の記録 ({n})`,{n:b.decisions.filter(n=>n.answer!==void 0&&nm(e,t,n)).length})}),(0,x.jsx)(`div`,{className:`flex flex-col gap-3 mt-2`,children:b.decisions.filter(n=>n.answer!==void 0&&nm(e,t,n)).map(n=>(0,x.jsx)(OE,{project:e,blockId:t,decisionId:n.id},n.id))})]})]}),_===`owner`&&(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Owner`})}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1 flex-wrap`,children:[b.assigneeIds.map(t=>{let r=e.members.find(e=>e.id===t);return r?(0,x.jsxs)(`span`,{className:`chip`,"data-on":r.id===o,style:{cursor:`default`},title:r.id===o?q(`{name} (自分)`,{name:r.name}):r.name,children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:r.color,width:16,height:16,fontSize:9},children:r.name.slice(0,1)}),r.name,!n&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{padding:`0 2px`},title:q(`外す`),onClick:()=>M(r.id),children:`×`})]},t):null}),b.assigneeIds.length===0&&(0,x.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`未担当`)}),!n&&o&&!b.assigneeIds.includes(o)&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>M(o),title:q(`自分を担当にする`),children:`Me`})]}),!n&&(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`input`,{className:`input`,placeholder:e.members.length===0?q(`名前を打って Enter で登録`):q(`名前で検索して Enter で割り当て`),value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){g(``);return}if(e.key!==`Enter`)return;let n=S[0];if(n){b.assigneeIds.includes(n.id)||M(n.id),g(``);return}let i=h.trim();i&&(r(e=>{let n=Ap(e,i,BE[e.members.length%BE.length]);return hp(n.project,t,{assigneeIds:[...n.project.blocks[t].assigneeIds,n.memberId]})}),g(``))}}),h.trim()&&(0,x.jsxs)(`div`,{className:`card absolute left-0 right-0 mt-1 p-1 flex flex-col z-30`,style:{maxHeight:220,overflow:`auto`},children:[S.map(e=>(0,x.jsxs)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onMouseDown:e=>e.preventDefault(),onClick:()=>{b.assigneeIds.includes(e.id)||M(e.id),g(``)},children:[(0,x.jsx)(`span`,{className:`avatar`,style:{background:e.color,width:16,height:16,fontSize:9,marginRight:6},children:e.name.slice(0,1)}),e.name]},e.id)),S.length===0&&(0,x.jsx)(`div`,{className:`text-[12px] p-1`,style:{color:`var(--text-muted)`},children:q(`見つかりません。Enter で「{name}」を登録して割り当て`,{name:h.trim()})})]})]})]}),_===`dates`&&(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Schedule`})}),(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[12px]`,children:[(0,x.jsxs)(`label`,{className:`flex items-center gap-2 col-span-2`,children:[(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`,minWidth:32},children:q(`開始`)}),(0,x.jsx)(pE,{value:b.startDate??``,disabled:n,onChange:e=>r(n=>um(n,t,{startDate:e||null},`human`))})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-2 col-span-2`,children:[(0,x.jsx)(`span`,{style:{color:dm(b)?`var(--danger)`:`var(--text-muted)`,minWidth:32},children:q(`期日`)}),(0,x.jsx)(pE,{value:b.dueDate??``,disabled:n,danger:dm(b),onChange:e=>r(n=>um(n,t,{dueDate:e||null},`human`))})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`,minWidth:32},children:q(`見積`)}),(0,x.jsx)(`input`,{type:`number`,min:0,step:.5,className:`input input-plain`,placeholder:`h`,value:b.estimateHours??``,disabled:n,onChange:e=>r(n=>um(n,t,{estimateHours:e.target.value===``?null:Number(e.target.value)},`human`))}),(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`h`})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`,minWidth:32},children:q(`実績`)}),(0,x.jsx)(`input`,{type:`number`,min:0,step:.5,className:`input input-plain`,placeholder:`h`,value:b.actualHours??``,disabled:n,onChange:e=>r(n=>um(n,t,{actualHours:e.target.value===``?null:Number(e.target.value)},`human`))}),(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`h`})]})]}),b.dueDate&&b.status!==`white`&&(()=>{let e=fm(b);return e===null?null:(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:e<0?`var(--danger)`:`var(--text-muted)`},children:e<0?q(`期日を {d} 日過ぎています`,{d:-e}):e===0?q(`期日は今日です`):q(`期日まであと {d} 日`,{d:e})})})()]}),_===`io`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(uE,{project:e,blockId:t,direction:`in`,readonly:n,title:`Inputs`}),(0,x.jsx)(uE,{project:e,blockId:t,direction:`out`,readonly:n,title:`Outputs`,allowAdd:Sp(e,t)})]}),_===`more`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsx)(`div`,{className:`sec__head`,children:(0,x.jsx)(`span`,{className:`label`,children:`Issue`})}),(0,x.jsx)(`input`,{className:`input`,placeholder:q(`JIRA / Redmine / GitHub Issue の URL`),value:b.issue??``,disabled:n,onChange:e=>r(n=>hp(n,t,{issue:e.target.value}),{history:!1}),onBlur:e=>r(n=>hp(n,t,{issue:e.target.value.trim()||void 0}))}),b.issue&&(0,x.jsx)(`a`,{className:`text-[12px] underline`,href:b.issue,target:`_blank`,rel:`noreferrer`,style:{color:`var(--primary-strong)`},children:q(`開く: {key}`,{key:Fm(b.issue)})})]}),(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsx)(`span`,{className:`label`,children:`AI`}),(0,x.jsxs)(`button`,{className:`btn btn-sm`,"data-on":s,onClick:()=>c(!s),title:q(`このボックスの入出力と位置づけを Markdown にしてコピーして AI に渡す`),children:[`Copy for AI `,s?`▴`:`▾`]})]}),s&&(0,x.jsxs)(`div`,{className:`flex flex-col pl-2`,style:{borderLeft:`3px solid var(--line-soft)`},children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>P(`plan`),children:q(`手順を提案してもらう (コピー)`)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>P(`decompose`),children:q(`分解案を JSON でもらう (コピー)`)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>P(`review`),children:q(`入出力の抜けを指摘してもらう (コピー)`)})]}),l&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`textarea`,{className:`input`,style:{minHeight:180,fontSize:12},readOnly:!0,value:RE(e,t,l)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>u(null),children:`Close`})]})]}),(0,x.jsxs)(`section`,{className:`sec`,children:[(0,x.jsxs)(`div`,{className:`sec__head`,children:[(0,x.jsxs)(`span`,{className:`label`,children:[`Notes`,b.description||b.artifacts.length>0?` *`:``]}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>f(!d),children:d?`▴`:`▾`})]}),d&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,x.jsx)(fE,{multiline:!0,className:`input`,placeholder:q(`メモ (入力から出力をどう作るか)`),value:b.description,disabled:n,onCommit:e=>r(n=>hp(n,t,{description:e}))}),(0,x.jsx)(lE,{artifacts:b.artifacts,readonly:n,addLabel:`Link`,onChange:e=>r(n=>hp(n,t,{artifacts:e}))})]})]})]})]})}function QE({project:e,edgeId:t}){vw();let n=$(e=>e.viewScope),r=$(e=>e.setViewScope),i=(0,y.useMemo)(()=>Im(e,t),[e,t]);return i.length<2?null:(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--text-muted)`},children:`Tabs`}),(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(t=>(0,x.jsx)(`button`,{className:`chip`,"data-on":n===t,onClick:()=>r(t),title:t?q(`{title} のタブでこの線の続きを見る`,{title:e.blocks[t]?.title??``}):q(`All でこの線を見る`),children:t?e.blocks[t]?.title??`?`:`All`},t??`all`))})]})}function $E({project:e,edgeId:t}){vw();let n=$(e=>e.readonly),r=$(e=>e.apply),i=$(e=>e.select),a=e.edges[t],o=e.ports[a.from.portId],s=e.ports[a.to.portId],c=t=>t===`root`?q(`プロジェクト`):e.blocks[t]?.title??`?`;return(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,x.jsx)(qE,{title:`Wire`}),(0,x.jsxs)(`div`,{className:`text-[13px]`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`b`,{children:c(o.blockId)}),q(`「{name}」`,{name:o.name})]}),(0,x.jsx)(`div`,{className:`my-1`,style:{color:`var(--text-muted)`},children:`↓`}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`b`,{children:c(s.blockId)}),q(`「{name}」`,{name:s.name})]})]}),(0,x.jsx)(QE,{project:e,edgeId:t}),a.auto?(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`自動の線。手動でつなぐと置き換わります。`)}):!n&&(0,x.jsx)(`button`,{className:`btn btn-sm self-start`,onClick:()=>{i({}),r(e=>kp(e,t))},children:`Disconnect`})]})}var eD=e=>e===void 0?q(`削除済み`):typeof e==`string`?e||q(`空欄`):e&&typeof e==`object`&&`note`in e&&`actor`in e&&`at`in e?`${e.note}\n\n${e.actor} · ${e.at}`:JSON.stringify(e,null,2);function tD({onClose:e}){let{project:t,conflict:n,previewConflict:r,resolveConflict:i,saveError:a}=$(),[o,s]=(0,y.useState)({}),c=(0,y.useRef)(null),l=r();(0,y.useEffect)(()=>{let e=c.current,t=document.activeElement;return e.showModal(),()=>{e.close(),t?.focus()}},[]),(0,y.useEffect)(()=>{s({})},[n?.revision,n?.text]);let u=l?.conflicts??[],d=u.filter(e=>!e.automatic&&!o[e.id]).length,f=e=>{let[n,r,i]=e.segments,a=n===`blocks`||n===`handoffs`?t?.blocks[r]:void 0,o={title:q(`題名`),name:q(`名前`),description:q(`説明`),note:q(`引き継ぎメモ`),decisions:q(`判断と回答`),status:`Status`,artifacts:q(`成果物`),position:q(`位置`),category:`Category`,progress:q(`進捗`)};return a?`${a.key} ${a.title} · ${n===`handoffs`?q(`引き継ぎメモ`):i?o[i]??i:q(`タスク全体`)}`:o[e.path]??e.path};return(0,x.jsxs)(`dialog`,{ref:c,className:`conflict-dialog`,"aria-labelledby":`conflict-title`,onCancel:e,children:[(0,x.jsxs)(`div`,{className:`conflict-dialog__head`,children:[(0,x.jsx)(`h2`,{id:`conflict-title`,className:`font-head`,children:q(`競合する変更を比較`)}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:e,"aria-label":q(`閉じる (Esc)`),children:`×`})]}),(0,x.jsxs)(`div`,{className:`conflict-dialog__body`,children:[(0,x.jsx)(`p`,{children:q(`別の項目の変更は両方残ります。同じ項目を変更した箇所だけ、残す内容を選んでください。`)}),u.length===0&&(0,x.jsx)(`p`,{children:q(`別の項目の変更です。統合できます。`)}),u.map(e=>(0,x.jsxs)(`fieldset`,{className:`conflict-item`,children:[(0,x.jsx)(`legend`,{children:f(e)}),e.automatic?(0,x.jsxs)(`p`,{children:[q(`番号の重複は自動で解消します。`),`: `,eD(e.theirs)]}):(0,x.jsx)(`div`,{className:`conflict-columns`,children:[`ours`,`theirs`].map(t=>(0,x.jsxs)(`label`,{className:`conflict-choice`,"data-selected":o[e.id]===t,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`input`,{type:`radio`,name:e.id,checked:o[e.id]===t,onChange:()=>s(n=>({...n,[e.id]:t}))}),` `,q(t===`ours`?`手元の編集`:`最新のファイル`)]}),(0,x.jsx)(`pre`,{children:eD(e[t])})]},t))})]},e.id)),a&&(0,x.jsx)(`p`,{className:`text-[12px]`,role:`status`,children:a})]}),(0,x.jsxs)(`div`,{className:`conflict-dialog__foot`,children:[(0,x.jsx)(`span`,{"aria-live":`polite`,children:q(`未選択: {n}`,{n:d})}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:e,children:q(`あとで選ぶ`)}),(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:d>0||!n,onClick:()=>{i(`merge`,o,n?.revision)&&e()},children:q(`選択した内容で統合`)})]})]})}function nD(){let{project:e,source:t,saveError:n,conflict:r,resolveConflict:i,previewConflict:a,saveNow:o}=$(),[s,c]=(0,y.useState)(!1);if(!e||!n&&t!==`file`)return null;let l=a()?.conflicts.filter(e=>!e.automatic).length??0;return(0,x.jsxs)(`div`,{className:`save-notice`,role:n?`alert`:`status`,children:[(0,x.jsx)(`span`,{children:n??q(`このファイルは閲覧専用です。共同編集は npx boxglow serve --open または VS Code 拡張で開いてください。`)}),n&&(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-2`,children:[(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>vE(`boxglow-unsaved.json`,Hp(e),`application/json`),children:q(`手元の編集を JSON で退避`)}),r?(0,x.jsxs)(x.Fragment,{children:[l>0?(0,x.jsxs)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>c(!0),children:[q(`変更を比較して選ぶ`),` (`,l,`)`]}):(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>i(`merge`),children:q(`両方の変更を統合`)}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{vE(`boxglow-unsaved.json`,Hp(e),`application/json`),i(`remote`)},children:q(`手元を退避して最新のファイルを開く`)})]}):(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:o,children:q(`保存を再試行`)})]}),s&&r&&(0,x.jsx)(tD,{onClose:()=>c(!1)})]})}var rD=`0.4.1`;function iD(){let e=$(e=>e.peerVersion),t=$(e=>e.source);return(0,x.jsxs)(`details`,{className:`version-info`,children:[(0,x.jsxs)(`summary`,{title:q(`バージョンと接続先`),children:[`v`,rD]}),(0,x.jsxs)(`div`,{className:`card version-info__content`,children:[(0,x.jsx)(`b`,{children:q(`バージョンと接続先`)}),(0,x.jsxs)(`dl`,{children:[(0,x.jsx)(`dt`,{children:`GUI`}),(0,x.jsx)(`dd`,{children:rD}),(0,x.jsx)(`dt`,{children:q(`保存先`)}),(0,x.jsx)(`dd`,{children:t===`serve`?`CLI server`:t===`vscode`?`VS Code`:q(t===`file`?`閲覧専用ファイル`:`ブラウザ内`)}),e&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`dt`,{children:t===`vscode`?`Extension`:`CLI`}),(0,x.jsx)(`dd`,{children:e.extension??e.app??q(`取得できません`)}),(0,x.jsx)(`dt`,{children:q(`接続先のアプリ`)}),(0,x.jsx)(`dd`,{children:e.app??q(`取得できません`)}),(0,x.jsx)(`dt`,{children:q(`保存方式`)}),(0,x.jsxs)(`dd`,{children:[`GUI `,1,` / `,q(`接続先`),` `,e.protocol??`?`]})]}),(0,x.jsx)(`dt`,{children:`Build (JST)`}),(0,x.jsx)(`dd`,{children:`2026-10-04 16:03`})]}),e&&(e.protocol!==1||e.app!==rD)&&(0,x.jsx)(`p`,{role:`status`,children:q(`接続先と画面のバージョンが異なるか、確認できません。CLI・拡張を更新し、画面を再読み込みしてください。`)})]})]})}function aD({project:e,onToggleDrawer:t,onHelp:n}){let r=vw(),i=$(e=>e.readonly),a=$(e=>e.ephemeral),o=$(e=>e.saveState),s=$(e=>e.apply),c=$(e=>e.undo),l=$(e=>e.redo),u=$(e=>e.past.length),d=$(e=>e.future.length),f=$(e=>e.select),p=$(e=>e.focusBlock),m=$(e=>e.selection),h=$(e=>e.closeProject),g=$(e=>e.importJSON),_=$(e=>e.copyToMine),v=$(e=>e.setToast),[b,S]=(0,y.useState)(()=>document.documentElement.dataset.theme||hE());(0,y.useEffect)(()=>{let e=new MutationObserver(()=>S(document.documentElement.dataset.theme||hE()));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>e.disconnect()},[]);let[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),[D,O]=(0,y.useState)(!1),k=(0,y.useRef)(null),A=T.trim()?pm(e,T,12):[],j=e=>{f({blockId:e}),p(e),E(``),O(!1)};(0,y.useEffect)(()=>{let e=e=>{if(document.querySelector(`dialog[open]`))return;let t=e.target;(!t||t.tagName!==`INPUT`&&t.tagName!==`TEXTAREA`)&&e.key===`/`&&!e.isComposing&&!t?.isContentEditable&&t?.tagName!==`SELECT`&&(e.preventDefault(),O(!0),setTimeout(()=>k.current?.focus(),0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,y.useEffect)(()=>{let e=()=>w(!1);return C&&window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[C]);let M=()=>{let e=b===`dark`?`light`:`dark`;gE(e),S(e)},N=()=>{let e=prompt(q(`追加するプロジェクトの名前 (リポジトリごとに 1 つなど)`));e?.trim()&&s(t=>{let n=Gf(t,e.trim());return setTimeout(()=>{f({blockId:n.blockId}),p(n.blockId)},0),n.project})},P=()=>s(e=>Jm(Xf(e))),F=()=>{let t=Hw(e,m,$.getState().viewScope);s(e=>{let n=mp(e,{parentId:t,title:q(`新しいブロック`)}),r=structuredClone(n.project);return r.blocks[t]&&(r.blocks[t].collapsed=!1),setTimeout(()=>{f({blockId:n.blockId}),p(n.blockId)},0),r})},ee=()=>vE(`${xE(e.name)}.boxglow.json`,Hp(e),`application/json`),I=()=>vE(`${xE(e.name)}.md`,LE(e),`text/markdown`),te=async()=>{v(await yE(zE(e,m.blockId??`root`))?q(`Mermaid をコピーしました`):q(`コピーできませんでした`))},ne=async()=>{let e=await bE(`.json,application/json`);if(e)try{await g(e)}catch(e){v(e instanceof Error?e.message:String(e))}},L=$(e=>e.fileName),re=$(e=>e.editMode),ie=$(e=>e.setEditMode),ae=$(e=>e.saveNow),oe=i?`Read only`:a?`Sample (not saved)`:o===`saving`?`Saving…`:o===`unsaved`?`Unsaved`:`Saved`,se=i?q(`閲覧専用`):a?q(`サンプルは保存されません。Save で自分のプロジェクトとして保存`):L?q(`{file} に自動で保存します (変更後)。Save で今すぐ書きます`,{file:L}):q(`このブラウザに自動で保存します`),ce=rm(e),le=ce.working.length;return(0,x.jsxs)(`header`,{className:`topbar`,children:[(0,x.jsxs)(`div`,{className:`topbar-identity`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,title:q(`階層 / 絞り込み / メンバー / 部品`),children:`☰`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:h,title:q(`Home (プロジェクト一覧へ)`),"aria-label":`Home`,children:(0,x.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{d:`M3 11.5 12 4l9 7.5`}),(0,x.jsx)(`path`,{d:`M5.5 10.5V20h13v-9.5`}),(0,x.jsx)(`path`,{d:`M10 20v-5h4v5`})]})}),(0,x.jsx)(`button`,{className:`project-name`,onClick:()=>f({project:!0}),title:e.name,children:e.name}),(0,x.jsxs)(`span`,{className:`save-chip ${o===`unsaved`?`unsaved`:``}`,title:se,children:[!a&&(0,x.jsx)(`span`,{className:`save-chip__file`,children:L??q(`ブラウザ内`)}),(0,x.jsx)(`span`,{children:oe})]}),a&&!i&&(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:_,title:q(`自分のプロジェクトとして保存`),children:`Save`}),!a&&!i&&(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:ae,disabled:o===`saved`||o===`saving`,title:se,children:`Save`})]}),(0,x.jsxs)(`div`,{className:`topbar-tools`,children:[(0,x.jsxs)(`button`,{className:`summary-chip`,"data-on":m.timeline,onClick:()=>f({timeline:!m.timeline}),title:q(`今の状況 (作業中・判断待ち・ログ)`),children:[le>0&&(0,x.jsx)(`span`,{className:`dot`}),le>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`作業中`),` `]}),le]}),ce.blocked.length>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`詰まり・確認待ち`),` `]}),ce.blocked.length]}),ce.decisions.length>0&&(0,x.jsx)(`span`,{className:`dot decision`}),ce.decisions.length>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`判断待ち`),` `]}),ce.decisions.length]}),ce.answered.length>0&&(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`summary-chip__txt`,children:[q(`回答済み`),` `]}),ce.answered.length]}),le===0&&ce.blocked.length===0&&ce.decisions.length===0&&ce.answered.length===0&&(0,x.jsx)(`span`,{children:`Activity`})]}),!i&&(0,x.jsxs)(`button`,{className:`mode-toggle`,"data-on":re,onClick:()=>ie(!re),title:q(re?`Edit モード: ドラッグで移動・結線・階層移動ができます。押すと View (閲覧) に`:`View モード: ドラッグでの編集は効きません。押すと Edit に`),children:[(0,x.jsx)(`span`,{className:`mode-toggle__knob`}),(0,x.jsx)(`span`,{children:re?`Edit`:`View`})]}),(0,x.jsxs)(`div`,{className:`relative topbar-search`,children:[(0,x.jsx)(`input`,{"aria-label":q(`ブロックを検索`),ref:k,className:`input search-box`,placeholder:q(`Search ID / 題名`),value:T,onChange:e=>{E(e.target.value),O(!0)},onFocus:()=>O(!0),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&A[0]&&j(A[0].id),e.key===`Escape`&&(O(!1),E(``),e.target.blur())},onBlur:()=>setTimeout(()=>O(!1),150)}),D&&T.trim()&&A.length>0&&(0,x.jsx)(`div`,{className:`card absolute right-0 mt-1 p-1 flex flex-col z-30`,style:{width:`min(320px, calc(100vw - 32px))`,maxHeight:320,overflow:`auto`},children:A.map(e=>(0,x.jsxs)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onMouseDown:e=>e.preventDefault(),onClick:()=>j(e.id),children:[(0,x.jsx)(`span`,{className:`chip`,style:{fontFamily:`ui-monospace, monospace`,marginRight:6},children:e.key}),(0,x.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))}),D&&T.trim()&&A.length===0&&(0,x.jsx)(`div`,{className:`card absolute right-0 mt-1 p-2 text-[12px] z-30`,style:{minWidth:200,color:`var(--text-muted)`},children:q(`見つかりません`)})]}),!i&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm desktop-action`,onClick:F,title:q(`ブロックを追加 (N)。ボックスを選んでいればその中に、選んでいなければプロジェクトの中に`),children:`+ Block`}),(0,x.jsx)(`button`,{className:`btn btn-sm desktop-action`,onClick:P,title:q(`Auto Layout: 依存関係で並べ直す (大項目は畳んだ前提)`),children:`Auto Layout`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm desktop-action`,onClick:c,disabled:u===0,title:q(`元に戻す (Ctrl+Z)`),"aria-label":`Undo`,children:`↶`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm desktop-action`,onClick:l,disabled:d===0,title:q(`やり直す (Ctrl+Y)`),"aria-label":`Redo`,children:`↷`})]}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:e=>{e.stopPropagation(),w(!C)},title:`Menu`,"aria-expanded":C,onKeyDown:e=>{e.key===`Escape`&&w(!1)},children:`⋯`}),C&&(0,x.jsxs)(`div`,{className:`card absolute right-0 mt-1 p-1 flex flex-col z-30`,style:{minWidth:220,maxHeight:`min(480px, 65dvh)`,overflowY:`auto`},children:[!i&&(0,x.jsxs)(`div`,{className:`menu-actions`,children:[(0,x.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:F,children:`+ Block`}),(0,x.jsx)(`button`,{className:`btn btn-sm`,onClick:P,children:`Auto Layout`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:c,disabled:u===0,children:`Undo`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:l,disabled:d===0,children:`Redo`})]}),!i&&(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:N,title:q(`同じファイルにプロジェクトのボックスを足す`),children:`New Project`}),!i&&(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:ee,children:`Export JSON`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:I,children:`Export Markdown`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:te,children:`Copy Mermaid`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:ne,children:`Import JSON`}),(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:n,children:`Help`}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:h,children:`Home`}),(0,x.jsx)(`div`,{style:{borderTop:`1px solid var(--line-soft)`,margin:`4px 0`}}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm justify-start`,onClick:()=>jf(r===`en`?`ja`:`en`),title:q(`画面の文言の言語を切り替える`),children:r===`en`?`日本語`:`English`})]})]}),(0,x.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:M,title:b===`dark`?`Light mode`:`Dark mode`,children:b===`dark`?`☀`:`☾`})]})]})}var oD=240;function sD({project:e,majors:t,scope:n,onSelect:r,marked:i}){vw();let a=(0,y.useRef)(null),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),f=()=>{let e=a.current;e&&(s(e.scrollLeft>1),l(e.scrollLeft+e.clientWidth<e.scrollWidth-1))};(0,y.useEffect)(()=>{f();let e=a.current;if(!e)return;let t=new ResizeObserver(f);return t.observe(e),()=>t.disconnect()},[t.length]),(0,y.useEffect)(()=>{(a.current?.querySelector(`.canvas-tab[data-on="true"]`))?.scrollIntoView({inline:`nearest`,block:`nearest`}),setTimeout(f,0)},[n]),(0,y.useEffect)(()=>{if(!u)return;let e=e=>{e.target.closest?.(`.tab-list, .tab-list-btn`)||d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[u]);let p=e=>a.current?.scrollBy({left:e,behavior:`smooth`}),m=e=>{r(e),d(!1)};return(0,x.jsxs)(`div`,{className:`canvas-tabs`,role:`tablist`,children:[(0,x.jsxs)(`div`,{className:`tab-nav`,children:[(0,x.jsx)(`button`,{className:`tab-nav-btn tab-list-btn`,"data-on":u,onClick:()=>d(e=>!e),title:q(`タブの一覧 (押して選ぶ)`),children:`≡`}),(0,x.jsx)(`button`,{className:`tab-nav-btn`,disabled:!o,onClick:()=>p(-240),title:q(`左へ`),children:`◀`}),(0,x.jsx)(`button`,{className:`tab-nav-btn`,disabled:!c,onClick:()=>p(oD),title:q(`右へ`),children:`▶`})]}),(0,x.jsxs)(`div`,{className:`tab-strip`,ref:a,onScroll:f,children:[(0,x.jsx)(`button`,{className:`canvas-tab`,role:`tab`,"data-on":n===null,"data-marked":i?.has(null)||void 0,onClick:()=>m(null),title:q(`大項目の一覧を俯瞰する (中はそれぞれのタブで)`),children:`All`}),t.map(e=>(0,x.jsxs)(`button`,{className:`canvas-tab`,role:`tab`,"data-on":n===e.id,"data-marked":i?.has(e.id)||void 0,onClick:()=>m(e.id),title:i?.has(e.id)?q(`{title} (選んだ線の続きがある)`,{title:e.title}):q(`{title} の中を見る`,{title:e.title}),children:[(0,x.jsx)(gT,{status:e.status}),(0,x.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))]}),u&&(0,x.jsxs)(`div`,{className:`tab-list card`,role:`menu`,children:[(0,x.jsxs)(`button`,{className:`tab-list-row`,"data-on":n===null,onClick:()=>m(null),children:[(0,x.jsx)(`span`,{className:`tab-list-icon`,children:`⊞`}),(0,x.jsx)(`span`,{className:`truncate`,children:`All`})]}),t.map(t=>{let r=Pp(e,t.id);return(0,x.jsxs)(`button`,{className:`tab-list-row`,"data-on":n===t.id,onClick:()=>m(t.id),title:t.title,children:[(0,x.jsx)(gT,{status:t.status}),(0,x.jsx)(`span`,{className:`truncate`,children:t.title}),(0,x.jsx)(`span`,{className:`tab-list-prog`,children:r.total>0?`${r.percent}%`:``})]},t.id)})]})]})}function cD(e,t,n,r){try{let i=Number(localStorage.getItem(e));return Number.isFinite(i)&&i>=n&&i<=r?i:t}catch{return t}}function lD(e,t){try{localStorage.setItem(e,String(t))}catch{}}var uD={min:260,max:760,def:320},dD={min:220,max:640,def:280};function fD(){vw();let e=$(e=>e.project),t=Ww(),n=$(e=>e.embed),r=$(e=>e.readonly),i=$(e=>e.toast),a=$(e=>e.setToast),o=$(e=>e.selection),s=$(e=>e.select),c=$(e=>e.focusBlock),l=$(e=>e.apply),u=$(e=>e.undo),d=$(e=>e.redo),f=$(e=>e.setMode),p=$(e=>e.openSample),m=$(e=>e.openExample),h=$(e=>e.openProject),g=$(e=>e.openFromServer),_=$(e=>e.openFromVsCode),v=$(e=>e.viewScope),b=$(e=>e.setViewScope),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(()=>cD(`boxglow:rightW`,uD.def,uD.min,uD.max)),[E,D]=(0,y.useState)(()=>cD(`boxglow:drawerW`,dD.def,dD.min,dD.max)),O=(0,y.useCallback)(e=>{T(e),lD(`boxglow:rightW`,e)},[]),k=(0,y.useCallback)(e=>{D(e),lD(`boxglow:drawerW`,e)},[]),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)({...HE,statuses:new Set(HE.statuses)});(0,y.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`view`)===`article`,n=t||e.get(`embed`)===`1`;f({embed:n,readonly:t||e.get(`readonly`)===`1`});let r=e.get(`theme`);(r===`dark`||r===`light`)&&gE(r,!1);let i=null;if(n&&window.parent!==window)try{let e=window.parent.document.documentElement,t=()=>{let t=e.dataset.theme;(t===`dark`||t===`light`)&&gE(t,!1)};t(),i=new MutationObserver(t),i.observe(e,{attributes:!0,attributeFilter:[`data-theme`]})}catch{}if(window.acquireVsCodeApi){let e=()=>gE(document.body.classList.contains(`vscode-dark`)||document.body.classList.contains(`vscode-high-contrast`)?`dark`:`light`,!1);e(),i=new MutationObserver(e),i.observe(document.body,{attributes:!0,attributeFilter:[`class`]}),_()}else if(e.get(`demo`)===`daw`)m();else if(t||e.get(`demo`)===`1`){if(p(),t){let e=$.getState(),t=Object.values(e.project?.blocks??{}),n=t.find(e=>e.kind===`task`&&t.some(t=>t.parentId===e.id));n&&e.setViewScope(n.id)}}else if(e.get(`serve`)===`1`)g();else{let e=window.location.hash.match(/p=([\w-]+)/);e&&h(e[1])}return()=>i?.disconnect()},[f,p,m,h,g,_]),(0,y.useEffect)(()=>{let e=e=>{let t=$.getState();!t.ephemeral&&[`saving`,`unsaved`].includes(t.saveState)&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]),(0,y.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(null),3200);return()=>clearTimeout(e)},[i,a]),(0,y.useEffect)(()=>{let e=e=>{if(document.querySelector(`dialog[open]`)||e.isComposing)return;let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n=$.getState().project;if(!n)return;let i=$.getState().selection;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`z`)e.preventDefault(),e.shiftKey?d():u();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`y`)e.preventDefault(),d();else if(e.key===`Delete`||e.key===`Backspace`){if(r||!$.getState().editMode)return;if(i.edgeId){let e=n.edges[i.edgeId];e&&!e.auto&&(s({}),l(e=>kp(e,i.edgeId)))}else if(i.blockId){let e=n.blocks[i.blockId],t=Object.values(n.blocks).filter(e=>e.parentId===i.blockId).length;e&&(t===0||confirm(q(`「{title}」と下の階層のブロックを削除します。よろしいですか?`,{title:e.title})))&&(s({}),l(e=>vp(e,i.blockId)))}}else if(e.key.toLowerCase()===`n`&&!e.ctrlKey&&!e.metaKey){if(r)return;let e=Hw(n,i,$.getState().viewScope);l(t=>{let n=mp(t,{parentId:e,title:q(`新しいブロック`)}),r=structuredClone(n.project);return r.blocks[e]&&(r.blocks[e].collapsed=!1),setTimeout(()=>{s({blockId:n.blockId}),c(n.blockId)},0),r})}else e.key===`Escape`&&(s({}),j(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,u,d,s,r,c]);let P=(0,y.useMemo)(()=>!e||WE(M)?null:t=>UE(e,t,M),[e,M]),F=(0,y.useCallback)(()=>C(e=>!e),[]),ee=(0,y.useCallback)(()=>C(!0),[]),I=e?Pp(e,Ff):null,te=(0,y.useMemo)(()=>{let e=new URL(window.location.href);return e.searchParams.delete(`embed`),e.searchParams.delete(`readonly`),e.searchParams.delete(`view`),e.searchParams.set(`demo`,e.searchParams.get(`demo`)===`daw`?`daw`:`1`),e.toString()},[]),ne=!!e&&!n&&(o.blockId!==null||o.edgeId!==null||o.terminal!==null||o.project||o.timeline),L=[`app-grid`,n?`embed`:``,ne?``:`no-right`].filter(Boolean).join(` `),re=(0,y.useMemo)(()=>e?qf(e):[],[e]),ie=(0,y.useMemo)(()=>e&&o.edgeId&&e.edges[o.edgeId]?new Set(Im(e,o.edgeId)):void 0,[e,o.edgeId]),ae=!!e&&re.length>0,oe=v&&e?.blocks[v]?v:null,se=(0,y.useMemo)(()=>e&&oe?Qf(e,oe):[],[e,oe]),ce=se[0]?.id??null;return(0,x.jsxs)(`div`,{className:L,style:{"--right-w":`${w}px`},children:[(0,x.jsxs)(`div`,{className:`app-top`,children:[e&&!n&&(0,x.jsx)(aD,{project:e,onToggleDrawer:F,onHelp:()=>j(!0)}),e&&!n&&(0,x.jsx)(nD,{})]}),(0,x.jsxs)(`main`,{className:`app-main relative min-w-0 min-h-0`,children:[(0,x.jsxs)(`div`,{className:`canvas-wrap`,children:[e&&(0,x.jsx)(yd,{children:(0,x.jsx)(cE,{project:t??e,matcher:P})}),e&&S&&!n&&(0,x.jsx)(KE,{project:t??e,filter:M,onFilter:N,onClose:()=>C(!1),width:E}),e&&S&&!n&&(0,x.jsx)(dE,{side:`right`,width:E,min:dD.min,max:dD.max,onWidth:k,style:{left:8+E-5,top:8,bottom:8}}),e&&(se.length>0||!n&&!WE(M))&&(0,x.jsxs)(`div`,{className:`scope-path`,style:{left:S&&!n?8+E+8:8},children:[se.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{className:`scope-crumb`,onClick:()=>b(null),title:q(`大項目の一覧へ`),children:`All`}),se.map((e,t)=>(0,x.jsxs)(`span`,{className:`contents`,children:[(0,x.jsx)(`span`,{className:`scope-sep`,children:`›`}),t===se.length-1?(0,x.jsx)(`span`,{className:`scope-crumb current`,title:e.title,children:e.title}):(0,x.jsx)(`button`,{className:`scope-crumb`,onClick:()=>b(e.id),title:q(`{title} へ戻る`,{title:e.title}),children:e.title})]},e.id))]}),!n&&!WE(M)&&(0,x.jsx)(`button`,{className:`chip`,"data-on":`true`,onClick:()=>N({...HE,statuses:new Set(HE.statuses)}),title:q(`絞り込みを解除`),children:`Filtered ×`})]}),n&&(0,x.jsx)(`a`,{className:`btn btn-accent absolute top-2 right-2 z-10`,href:te,target:`_blank`,rel:`noopener noreferrer`,children:`Open full ↗`}),n&&se.length===0&&(0,x.jsx)(`span`,{className:`absolute top-2 left-2 z-10 font-head text-[14px] px-2 py-1 rounded-lg`,style:{background:`var(--bg-card)`,border:`2px solid var(--line)`},children:`Boxglow`})]}),ae&&(0,x.jsx)(sD,{project:e,majors:re,scope:ce,onSelect:b,marked:ie}),!e&&!n&&(0,x.jsx)(SE,{}),A&&(0,x.jsx)(`div`,{className:`modal-backdrop`,onClick:()=>j(!1),children:(0,x.jsxs)(`div`,{className:`card modal p-5 flex flex-col gap-2`,style:{width:420},onClick:e=>e.stopPropagation(),children:[(0,x.jsx)(`div`,{className:`font-head text-[16px]`,children:`Help`}),(0,x.jsx)(`table`,{className:`help-table`,children:(0,x.jsxs)(`tbody`,{children:[(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`ブロックを置く`)}),(0,x.jsxs)(`td`,{children:[(0,x.jsx)(`span`,{className:`kbd`,children:`N`}),` `,q(`または「+ Block」(選んだボックスの中に)`)]})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:`Edit / View`}),(0,x.jsx)(`td`,{children:q(`上の切替。Edit のときだけドラッグで移動・結線・階層移動と Del が効く`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`結線`)}),(0,x.jsx)(`td`,{children:q(`丸から相手の丸、または相手のボックスへドラッグ (近くで離せばつながる)`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`階層を移す`)}),(0,x.jsx)(`td`,{children:q(`ボックスをドラッグして別のボックスの中に落とす`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`下の階層を畳む / 展開`)}),(0,x.jsx)(`td`,{children:q(`ブロックをダブルクリック`)})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`削除`)}),(0,x.jsx)(`td`,{children:(0,x.jsx)(`span`,{className:`kbd`,children:`Del`})})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`元に戻す / やり直す`)}),(0,x.jsxs)(`td`,{children:[(0,x.jsx)(`span`,{className:`kbd`,children:`Ctrl+Z`}),` / `,(0,x.jsx)(`span`,{className:`kbd`,children:`Ctrl+Y`})]})]}),(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:q(`選択を解除`)}),(0,x.jsx)(`td`,{children:(0,x.jsx)(`span`,{className:`kbd`,children:`Esc`})})]})]})}),(0,x.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--text-muted)`},children:q(`ボックスは「入力から出力を作るタスク」。出力を先に決め、大きなボックスは「分解する」で中にボックスを置く。供給元の無い入力は左端の入力まで自動で点線が伸びる。`)}),(0,x.jsx)(`button`,{className:`btn btn-sm self-end`,onClick:()=>j(!1),children:`Close`})]})})]}),(0,x.jsxs)(`aside`,{className:`panel right ${ne?``:`hidden-panel`}`,children:[e&&ne&&(0,x.jsx)(dE,{side:`left`,width:w,min:uD.min,max:uD.max,onWidth:O}),e&&ne&&(0,x.jsx)(JE,{project:e,onOpenDrawer:ee})]}),(0,x.jsxs)(`footer`,{className:`app-footer flex items-center gap-3 px-3 text-[12px]`,style:{borderTop:`2px solid var(--line)`,background:`var(--bg-card)`},children:[e&&I&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`font-head`,children:[`Done `,I.white,` / `,I.total,` · `,I.percent,`%`]}),(0,x.jsx)(`div`,{className:`progress-bar`,style:{width:160},children:(0,x.jsx)(`span`,{style:{width:`${I.percent}%`}})}),n&&(0,x.jsx)(`a`,{className:`underline`,href:te,target:`_blank`,rel:`noopener noreferrer`,style:{color:`var(--primary-strong)`},children:q(`Boxglow で開く`)})]}),!e&&(0,x.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`Boxglow`}),(0,x.jsx)(iD,{}),(0,x.jsxs)(`span`,{className:`build-stamp text-[10px]`,style:{color:`var(--text-muted)`},title:q(`ビルド日時 (日本時間)。古い場合は再読み込み (Ctrl+F5) してください`),children:[`build `,`2026-10-04 16:03`]})]}),i&&(0,x.jsx)(`div`,{className:`toast`,role:`status`,children:i})]})}_E(),window.boxglow={store:$},b.createRoot(document.getElementById(`root`)).render((0,x.jsx)(y.StrictMode,{children:(0,x.jsx)(fD,{})}));
|