dev-process-kit 0.0.12 → 0.0.13

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.
Files changed (33) hide show
  1. package/dist/chunks/{shared-DBJaP5gF.js → shared-0MFKKPnB.js} +144 -92
  2. package/dist/chunks/{shared-DUq2-pM9.js → shared-B2YRwZ0P.js} +99 -60
  3. package/dist/chunks/{shared-y3FwoRgh.js → shared-B4Mwapvi.js} +88 -62
  4. package/dist/chunks/shared-BDUe3aT-.js +1 -0
  5. package/dist/chunks/{shared-BwaDMwUS.js → shared-C1KQ5iU8.js} +55 -32
  6. package/dist/chunks/{shared-BvuW5NtY.js → shared-CQG0dnvb.js} +15 -5
  7. package/dist/chunks/{shared-BC5MlWBY.js → shared-CSC14I4g.js} +248 -87
  8. package/dist/chunks/{shared-D7CMQLaX.js → shared-Cd8A5TjZ.js} +140 -35
  9. package/dist/chunks/{shared-CcrRNZCH.js → shared-CirHYajF.js} +1 -1
  10. package/dist/chunks/shared-D4K7KsfJ.js +1 -0
  11. package/dist/chunks/{shared-DYe0OZr-.js → shared-D7poXZ0z.js} +15 -7
  12. package/dist/chunks/shared-DO0pUSjw.js +571 -0
  13. package/dist/chunks/shared-DdefS1nG.js +1 -0
  14. package/dist/chunks/{shared-C__W71Hw.js → shared-DjmQsa0n.js} +1 -1
  15. package/dist/chunks/{shared-CLnfjHCQ.js → shared-DklLt1Sc.js} +1 -1
  16. package/dist/chunks/{shared-DkkBQzIf.js → shared-DrMSORn-.js} +31 -8
  17. package/dist/chunks/shared-DxAiavwJ.js +1102 -0
  18. package/dist/components.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/templates/delegation-poker.js +1 -1
  21. package/dist/templates/event-storming.js +1 -1
  22. package/dist/templates/example-mapping.js +1 -1
  23. package/dist/templates/grill.js +1 -1
  24. package/dist/templates/plain.js +1 -1
  25. package/dist/templates/prototype.js +1 -1
  26. package/dist/templates/slides.js +1 -1
  27. package/dist/templates/task-board.js +1 -1
  28. package/dist/templates/usm.js +1 -1
  29. package/dist/templates/whiteboard.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunks/shared-CoDXb-Yj.js +0 -556
  32. package/dist/chunks/shared-DhwK_dh_.js +0 -1093
  33. package/dist/chunks/shared-xrCdgpNS.js +0 -1
@@ -0,0 +1,1102 @@
1
+ import{al as Wt,ad as F,az as xe,ae as f,ag as x,an as te,ah as T,ai as z,aj as B,a$ as oe,ak as ne,aw as Pe,ac as Kt,af as Fe,aA as q,p as g,at as $,v as Be,ay as qt,P as He,e as Ut,a0 as Zt,V as I,l as We,aP as _,b0 as Xt,b1 as Gt,a3 as b,a5 as Vt,a4 as h,a7 as ye,a6 as Yt,J as jt,A as Jt,K as Qt,aD as eo,aq as to,a2 as oo,T as Ke,a1 as no,h as io}from"./shared-CSC14I4g.js";import{r as ro,p as so,c as ao}from"./shared-CirHYajF.js";import{P as co}from"./shared-aDPp8Vry.js";import{c as ke}from"./shared-ml5h7U5L.js";const lo=[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2"}]],ho=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]],po=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"}]],uo=[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1"}]],bo=[["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M5 17A12 12 0 0 1 17 5"}]];function qe(t){if(t.length===0)return NaN;const e=t.slice().sort((n,i)=>n-i),o=Math.floor(e.length/2);return e.length%2===0?(e[o-1]+e[o])/2:e[o]}const ie=["yellow","orange","pink","purple","blue","green","gray"],Ue=["rect","ellipse"],fo=["sticky","text","shape","frame"],re=["small","medium","large","xlarge"],se="medium",Ze=["arrow","line"],U=["straight","elbow","curve"],Z=24,C={sticky:{w:160,h:160},text:{w:240,h:48},shape:{w:180,h:110},frame:{w:640,h:420}},H={sticky:"yellow",shape:"blue",frame:"gray"},Xe=z(ne(),oe()),R=z(ne(),oe(),Pe(Z)),ge=T(ie),ve=f(T(re),se),ae={id:xe,x:Xe,y:Xe},mo=F({...ae,kind:te("sticky"),w:f(R,C.sticky.w),h:f(R,C.sticky.h),text:f(x(),""),color:f(ge,H.sticky),fontSize:ve}),wo=F({...ae,kind:te("text"),w:f(R,C.text.w),h:f(R,C.text.h),text:f(x(),""),fontSize:ve}),xo=F({...ae,kind:te("shape"),shape:f(T(Ue),"rect"),w:f(R,C.shape.w),h:f(R,C.shape.h),text:f(x(),""),color:f(ge,H.shape),fontSize:ve}),yo=F({...ae,kind:te("frame"),w:R,h:R,title:z(x(),B(1)),color:f(ge,H.frame)}),Ge=Wt("kind",[mo,wo,xo,yo]),ko=F({id:xe,from:z(x(),B(1)),to:z(x(),B(1)),label:q(x()),style:f(T(Ze),"arrow"),route:f(T(U),"straight")}),Ve=F({title:q(x()),items:f(Fe(Ge),[]),connectors:f(Fe(ko),[])}),Ye=t=>{const e=Kt(Ve,t),o=new Set;for(const{id:i}of[...e.items,...e.connectors]){if(o.has(i))throw new Error(`duplicate id "${i}" (items and connectors share one id space)`);o.add(i)}const n=new Set(e.items.map(i=>i.id));for(const i of e.connectors){if(!n.has(i.from))throw new Error(`unknown item "${i.from}" in connector "${i.id}"`);if(!n.has(i.to))throw new Error(`unknown item "${i.to}" in connector "${i.id}"`);if(i.from===i.to)throw new Error(`connector "${i.id}" connects an item to itself`)}return e},je=()=>({items:[],connectors:[]}),p=(t,e)=>{if(e!==void 0)return t.items.find(o=>o.id===e)},k=(t,e)=>{if(e!==void 0)return t.connectors.find(o=>o.id===e)},Je=t=>[...t.items.map(e=>e.id),...t.connectors.map(e=>e.id)],L=t=>t.kind==="frame"?t.title:t.text,$e=t=>t.kind!=="text",X=t=>t.kind!=="frame",de=t=>t.w*t.h,go=(t,e,o)=>e>=t.x&&e<=t.x+t.w&&o>=t.y&&o<=t.y+t.h,D=(t,e)=>{const o=e.x+e.w/2,n=e.y+e.h/2;let i;for(const r of t.items)r.kind!=="frame"||r.id===e.id||e.kind==="frame"&&de(r)<=de(e)||go(r,o,n)&&(i===void 0||de(r)<de(i))&&(i=r);return i},Ee=(t,e)=>{const o=[],n=i=>{let r=D(t,i);for(;r!==void 0;){if(r.id===e.id)return!0;r=D(t,r)}return!1};for(const i of t.items)i.id!==e.id&&n(i)&&o.push(i);return o},Qe=z(ne(),oe()),et=z(ne(),oe(),Pe(Z)),Te={type:"page",id:"whiteboard"},ce={ADD_ITEM:g("ADD_ITEM","page",Ge,{dedupeKey:Be}),SET_ITEM_TEXT:g("SET_ITEM_TEXT","item",$({text:x()})),MOVE_ITEM:g("MOVE_ITEM","item",$({x:Qe,y:Qe})),RESIZE_ITEM:g("RESIZE_ITEM","item",$({w:et,h:et})),SET_ITEM_COLOR:g("SET_ITEM_COLOR","item",$({color:T(ie)})),SET_ITEM_FONT_SIZE:g("SET_ITEM_FONT_SIZE","item",$({fontSize:T(re)})),REORDER_ITEM:g("REORDER_ITEM","item",$({after:qt(z(x(),B(1)))})),DELETE_ITEM:g("DELETE_ITEM","item",$({})),CONNECT_ITEMS:g("CONNECT_ITEMS","page",$({id:xe,from:z(x(),B(1)),to:z(x(),B(1)),label:q(x()),style:q(T(Ze)),route:q(T(U))}),{dedupeKey:Be}),SET_CONNECTOR_LABEL:g("SET_CONNECTOR_LABEL","connector",$({label:x()})),SET_CONNECTOR_ROUTE:g("SET_CONNECTOR_ROUTE","connector",$({route:T(U)})),DELETE_CONNECTOR:g("DELETE_CONNECTOR","connector",$({}))},P=t=>({type:"item",id:t}),y={addItem:t=>({type:"ADD_ITEM",target:Te,payload:t}),setText:(t,e)=>({type:"SET_ITEM_TEXT",target:P(t),payload:{text:e}}),move:(t,e,o)=>({type:"MOVE_ITEM",target:P(t),payload:{x:e,y:o}}),resize:(t,e,o)=>({type:"RESIZE_ITEM",target:P(t),payload:{w:e,h:o}}),setColor:(t,e)=>({type:"SET_ITEM_COLOR",target:P(t),payload:{color:e}}),setFontSize:(t,e)=>({type:"SET_ITEM_FONT_SIZE",target:P(t),payload:{fontSize:e}}),reorder:(t,e)=>({type:"REORDER_ITEM",target:P(t),payload:{after:e}}),deleteItem:t=>({type:"DELETE_ITEM",target:P(t),payload:{}}),connect:(t,e,o,n)=>({type:"CONNECT_ITEMS",target:Te,payload:{id:t,from:e,to:o,...n===void 0?{}:{label:n}}}),setConnectorLabel:(t,e)=>({type:"SET_CONNECTOR_LABEL",target:{type:"connector",id:t},payload:{label:e}}),setConnectorRoute:(t,e)=>({type:"SET_CONNECTOR_ROUTE",target:{type:"connector",id:t},payload:{route:e}}),deleteConnector:t=>({type:"DELETE_CONNECTOR",target:{type:"connector",id:t},payload:{}})},tt=(t,e)=>{const o=He(ce,e);if(o===null)return null;const n=o.target.id;switch(o.type){case"ADD_ITEM":{const i=o.payload,r=t.items.find(s=>s.id===i.id);return r!==void 0?r.kind===i.kind?t:null:t.connectors.some(s=>s.id===i.id)?null:{...t,items:[...t.items,i]}}case"SET_ITEM_TEXT":return G(t,n,i=>i.kind==="frame"?o.payload.text.trim()===""?null:{...i,title:o.payload.text}:{...i,text:o.payload.text});case"MOVE_ITEM":return G(t,n,i=>({...i,x:o.payload.x,y:o.payload.y}));case"RESIZE_ITEM":return G(t,n,i=>({...i,w:o.payload.w,h:o.payload.h}));case"SET_ITEM_COLOR":return G(t,n,i=>i.kind==="text"?null:{...i,color:o.payload.color});case"SET_ITEM_FONT_SIZE":return G(t,n,i=>i.kind==="frame"?null:{...i,fontSize:o.payload.fontSize});case"REORDER_ITEM":return vo(t,n,o.payload.after);case"DELETE_ITEM":return t.items.some(i=>i.id===n)?{...t,items:t.items.filter(i=>i.id!==n),connectors:t.connectors.filter(i=>i.from!==n&&i.to!==n)}:null;case"CONNECT_ITEMS":{const i=o.payload;if(t.connectors.some(s=>s.id===i.id))return t;if(t.items.some(s=>s.id===i.id)||i.from===i.to||!t.items.some(s=>s.id===i.from)||!t.items.some(s=>s.id===i.to))return null;const r={id:i.id,from:i.from,to:i.to,style:i.style??"arrow",route:i.route??"straight",...i.label===void 0||i.label===""?{}:{label:i.label}};return{...t,connectors:[...t.connectors,r]}}case"SET_CONNECTOR_LABEL":return ot(t,n,i=>{const{label:r,...s}=i;return o.payload.label===""?s:{...s,label:o.payload.label}});case"SET_CONNECTOR_ROUTE":return ot(t,n,i=>({...i,route:o.payload.route}));case"DELETE_CONNECTOR":return t.connectors.some(i=>i.id===n)?{...t,connectors:t.connectors.filter(i=>i.id!==n)}:null;default:return Ut(o)}},G=(t,e,o)=>{const n=t.items.find(r=>r.id===e);if(n===void 0)return null;const i=o(n);return i===null?null:{...t,items:t.items.map(r=>r.id===e?i:r)}},vo=(t,e,o)=>{const n=t.items.find(s=>s.id===e);if(n===void 0||o===e)return null;const i=t.items.filter(s=>s.id!==e),r=o===null?0:i.findIndex(s=>s.id===o)+1;return r===0&&o!==null?null:{...t,items:[...i.slice(0,r),n,...i.slice(r)]}},ot=(t,e,o)=>{const n=t.connectors.find(r=>r.id===e);if(n===void 0)return null;const i=o(n);return{...t,connectors:t.connectors.map(r=>r.id===e?i:r)}},V=t=>{if(t.length===0)return null;const e=Math.min(...t.map(r=>r.x)),o=Math.min(...t.map(r=>r.y)),n=Math.max(...t.map(r=>r.x+r.w)),i=Math.max(...t.map(r=>r.y+r.h));return{x:e,y:o,w:n-e,h:i-o}},ze=t=>[...t.items.filter(e=>e.kind==="frame"),...t.items.filter(e=>e.kind!=="frame")],$o=t=>t.kind==="shape"&&t.shape==="ellipse",Y=(t,e)=>{const o=t.x+t.w/2,n=t.y+t.h/2,i=e.x-o,r=e.y-n;if(i===0&&r===0)return{x:o,y:n};const s=t.w/2,d=t.h/2,a=$o(t)?1/Math.sqrt((i/s)**2+(r/d)**2):Math.min(i===0?1/0:s/Math.abs(i),r===0?1/0:d/Math.abs(r));return{x:o+i*a,y:n+r*a}},W=t=>({x:t.x+t.w/2,y:t.y+t.h/2}),nt=(t,e)=>{const o=Y(t,W(e)),n=Y(e,W(t));return{start:o,end:n,mid:{x:(o.x+n.x)/2,y:(o.y+n.y)/2}}},S=t=>`${t.x} ${t.y}`,le=(t,e,o)=>{if(o==="straight"){const{start:M,end:Q,mid:ee}=nt(t,e);return{d:`M ${S(M)} L ${S(Q)}`,mid:ee}}const n=W(t),i=W(e),r=Math.abs(i.x-n.x)>=Math.abs(i.y-n.y),s=r?i.x>=n.x:i.y>=n.y,d=(M,Q)=>{const ee=W(M);return r?{x:Q?M.x+M.w:M.x,y:ee.y}:{x:ee.x,y:Q?M.y+M.h:M.y}},a=d(t,s),c=d(e,!s),l={x:(a.x+c.x)/2,y:(a.y+c.y)/2},m=r?{x:l.x,y:a.y}:{x:a.x,y:l.y},u=r?{x:l.x,y:c.y}:{x:c.x,y:l.y};return{d:o==="elbow"?`M ${S(a)} L ${S(m)} L ${S(u)} L ${S(c)}`:`M ${S(a)} C ${S(m)} ${S(u)} ${S(c)}`,mid:l}},Se=(t,e)=>e.x>=t.x&&e.x<=t.x+t.w&&e.y>=t.y&&e.y<=t.y+t.h,Eo=(t,e)=>e>.5?{w:t.w,h:Math.ceil(t.h+e)}:void 0,To=(t,e)=>t.items.filter(o=>o.kind==="frame"&&Se(o,e)).sort((o,n)=>o.w*o.h-n.w*n.h),Me=(t,e,o)=>{const n=ze(t);for(let r=n.length-1;r>=0;r-=1){const s=n[r];if(!(s===void 0||s.id===o||s.kind==="frame")&&Se(s,e))return s}let i;for(const r of n)r.kind!=="frame"||r.id===o||!Se(r,e)||(i===void 0||r.w*r.h<i.w*i.h)&&(i=r);return i},zo=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),w:Math.abs(t.x-e.x),h:Math.abs(t.y-e.y)}),So=(t,e)=>e.x>=t.x&&e.y>=t.y&&e.x+e.w<=t.x+t.w&&e.y+e.h<=t.y+t.h,Mo=(t,e)=>t.items.filter(o=>o.kind==="frame"?So(e,o):he(e,o,0)),he=(t,e,o)=>t.x<e.x+e.w+o&&e.x<t.x+t.w+o&&t.y<e.y+e.h+o&&e.y<t.y+t.h+o,_o=(t,e,o=!1,n=16,i=6)=>{const r=o?t.items:t.items.filter(c=>c.kind!=="frame"),s=c=>!r.some(l=>he(c,l,n));if(s(e))return{x:e.x,y:e.y};const d=e.w+n,a=e.h+n;for(let c=1;c<=i;c+=1){const l=[];for(let u=-c;u<=c;u+=1)for(let w=-c;w<=c;w+=1)Math.max(Math.abs(w),Math.abs(u))===c&&l.push({x:e.x+w*d,y:e.y+u*a});l.sort((u,w)=>Math.hypot(u.x-e.x,u.y-e.y)-Math.hypot(w.x-e.x,w.y-e.y));const m=l.find(u=>s({...e,...u}));if(m!==void 0)return m}return{x:e.x,y:e.y}},Lo={sticky:"Sticky note",text:"Text",shape:"Shape",frame:"Frame"},O={sticky:"\u4ED8\u7B8B",text:"\u30C6\u30AD\u30B9\u30C8",shape:"\u56F3\u5F62",frame:"\u30D5\u30EC\u30FC\u30E0"},N={sticky:"sticky note",text:"text box",shape:"shape",frame:"frame"},Oo={rect:"Rectangle",ellipse:"Ellipse"},Io={rect:"\u56DB\u89D2\u5F62",ellipse:"\u6955\u5186"},Co={yellow:"Yellow",orange:"Orange",pink:"Pink",purple:"Purple",blue:"Blue",green:"Green",gray:"Gray"},Ro={yellow:"\u9EC4",orange:"\u30AA\u30EC\u30F3\u30B8",pink:"\u30D4\u30F3\u30AF",purple:"\u7D2B",blue:"\u9752",green:"\u7DD1",gray:"\u30B0\u30EC\u30FC"},No={small:"Small",medium:"Medium",large:"Large",xlarge:"Extra large"},Ao={small:"\u5C0F",medium:"\u4E2D",large:"\u5927",xlarge:"\u7279\u5927"},Do={straight:"Straight",elbow:"Elbow",curve:"Curved"},Po={straight:"\u76F4\u7DDA",elbow:"\u30AB\u30AE\u7DDA",curve:"\u66F2\u7DDA"},it={small:"S",medium:"M",large:"L",xlarge:"XL"},pe=Zt({en:{kindLabel:t=>Lo[t],shapeLabel:t=>Oo[t],colorLabel:t=>Co[t],fontSizeLabel:t=>No[t],fontSizeShort:t=>it[t],routeLabel:t=>Do[t],connector:"Connector",board:"Board",wholeBoard:"Whole board",canvasLabel:"Whiteboard canvas",emptyHint:"Double-click anywhere to add a sticky note, or pick something from the toolbar.",toolsLabel:"Add to the board",addSticky:"Sticky note",addText:"Text",addRect:"Rectangle",addEllipse:"Ellipse",addFrame:"Frame",newFrameTitle:"New frame",textPlaceholder:"Type something",selectionLabel:"Selected item",selectionCount:t=>`${t} items selected`,editText:"Edit text",renameFrame:"Rename frame",comment:"Comment",delete:"Delete",colorLabelPrefix:"Color",fontSizeLabelPrefix:"Text size",arrangeLabel:"Stacking order",bringToFront:"Bring to front",bringForward:"Bring forward",sendBackward:"Send backward",sendToBack:"Send to back",routeLabelPrefix:"Line",labelField:"Connector label",labelPlaceholder:"Add a label",resizeHandle:"Resize",connectHandle:"Drag to connect",commentCount:t=>`${t} comment${t===1?"":"s"}`,zoomIn:"Zoom in",zoomOut:"Zoom out",zoomFit:"Fit the board",zoomReset:"Reset to 100%",framesHeading:"Frames",framesHint:"Pick a frame to bring it into view.",memberCount:t=>`${t} item${t===1?"":"s"}`,addedTitle:t=>`Added a ${N[t]}`,textEditedTitle:t=>t==="frame"?"Renamed the frame":`Edited the ${N[t]}`,movedTitle:t=>`Moved the ${N[t]}`,resizedTitle:t=>`Resized the ${N[t]}`,recoloredTitle:t=>`Changed the color of the ${N[t]}`,resizedTextTitle:t=>`Changed the text size of the ${N[t]}`,restackedTitle:t=>`Changed the stacking order of the ${N[t]}`,deletedTitle:t=>`Deleted the ${N[t]}`,connectedTitle:"Connected two items",relabeledTitle:"Relabeled the connector",reroutedTitle:"Changed the connector line",disconnectedTitle:"Removed the connector",arrowTo:t=>`\u2192 \u201C${t}\u201D`,arrowFrom:(t,e)=>`\u201C${t}\u201D \u2192 \u201C${e}\u201D`,plain:(t,e)=>`${t} \u2192 ${e}`,added:t=>`+ \u201C${t}\u201D`,deleted:t=>`\u2212 \u201C${t}\u201D`,inFrame:t=>`in frame \u201C${t}\u201D`,intoFrame:t=>`into frame \u201C${t}\u201D`,outOfFrame:t=>`out of frame \u201C${t}\u201D`,betweenFrames:(t,e)=>`frame \u201C${t}\u201D \u2192 frame \u201C${e}\u201D`,position:(t,e)=>`(${t}, ${e})`,size:(t,e)=>`${t}\xD7${e}`,connection:(t,e)=>`\u201C${t}\u201D \u2192 \u201C${e}\u201D`,labeled:t=>`labeled \u201C${t}\u201D`,inFrontOf:t=>`in front of \u201C${t}\u201D`,toBack:"to the very back",empty:"(empty)",noLabel:"(no label)"},ja:{kindLabel:t=>O[t],shapeLabel:t=>Io[t],colorLabel:t=>Ro[t],fontSizeLabel:t=>Ao[t],fontSizeShort:t=>it[t],routeLabel:t=>Po[t],connector:"\u30B3\u30CD\u30AF\u30BF",board:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53",canvasLabel:"\u30DB\u30EF\u30A4\u30C8\u30DC\u30FC\u30C9",emptyHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u4ED8\u7B8B\u3092\u7F6E\u304F\u304B\u3001\u30C4\u30FC\u30EB\u30D0\u30FC\u304B\u3089\u8FFD\u52A0\u3057\u307E\u3059\u3002",toolsLabel:"\u30DC\u30FC\u30C9\u306B\u8FFD\u52A0",addSticky:"\u4ED8\u7B8B",addText:"\u30C6\u30AD\u30B9\u30C8",addRect:"\u56DB\u89D2\u5F62",addEllipse:"\u6955\u5186",addFrame:"\u30D5\u30EC\u30FC\u30E0",newFrameTitle:"\u65B0\u3057\u3044\u30D5\u30EC\u30FC\u30E0",textPlaceholder:"\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",selectionLabel:"\u9078\u629E\u4E2D\u306E\u8981\u7D20",selectionCount:t=>`${t} \u4EF6\u3092\u9078\u629E\u4E2D`,editText:"\u30C6\u30AD\u30B9\u30C8\u3092\u7DE8\u96C6",renameFrame:"\u30D5\u30EC\u30FC\u30E0\u540D\u3092\u5909\u66F4",comment:"\u30B3\u30E1\u30F3\u30C8",delete:"\u524A\u9664",colorLabelPrefix:"\u8272",fontSizeLabelPrefix:"\u6587\u5B57\u30B5\u30A4\u30BA",arrangeLabel:"\u91CD\u306A\u308A\u9806",bringToFront:"\u6700\u524D\u9762\u3078",bringForward:"\u524D\u9762\u3078",sendBackward:"\u80CC\u9762\u3078",sendToBack:"\u6700\u80CC\u9762\u3078",routeLabelPrefix:"\u7DDA\u306E\u5F62",labelField:"\u30B3\u30CD\u30AF\u30BF\u306E\u30E9\u30D9\u30EB",labelPlaceholder:"\u30E9\u30D9\u30EB\u3092\u8FFD\u52A0",resizeHandle:"\u30B5\u30A4\u30BA\u3092\u5909\u66F4",connectHandle:"\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u3064\u306A\u3050",commentCount:t=>`\u30B3\u30E1\u30F3\u30C8 ${t} \u4EF6`,zoomIn:"\u62E1\u5927",zoomOut:"\u7E2E\u5C0F",zoomFit:"\u30DC\u30FC\u30C9\u5168\u4F53\u3092\u8868\u793A",zoomReset:"100% \u306B\u623B\u3059",framesHeading:"\u30D5\u30EC\u30FC\u30E0",framesHint:"\u30D5\u30EC\u30FC\u30E0\u3092\u9078\u3076\u3068\u305D\u3053\u3078\u79FB\u52D5\u3057\u307E\u3059\u3002",memberCount:t=>`${t} \u4EF6`,addedTitle:t=>`${O[t]}\u3092\u8FFD\u52A0`,textEditedTitle:t=>t==="frame"?"\u30D5\u30EC\u30FC\u30E0\u540D\u3092\u5909\u66F4":`${O[t]}\u306E\u30C6\u30AD\u30B9\u30C8\u3092\u5909\u66F4`,movedTitle:t=>`${O[t]}\u3092\u79FB\u52D5`,resizedTitle:t=>`${O[t]}\u306E\u30B5\u30A4\u30BA\u3092\u5909\u66F4`,recoloredTitle:t=>`${O[t]}\u306E\u8272\u3092\u5909\u66F4`,resizedTextTitle:t=>`${O[t]}\u306E\u6587\u5B57\u30B5\u30A4\u30BA\u3092\u5909\u66F4`,restackedTitle:t=>`${O[t]}\u306E\u91CD\u306A\u308A\u9806\u3092\u5909\u66F4`,deletedTitle:t=>`${O[t]}\u3092\u524A\u9664`,connectedTitle:"\u8981\u7D20\u3092\u3064\u306A\u3044\u3060",relabeledTitle:"\u30B3\u30CD\u30AF\u30BF\u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",reroutedTitle:"\u30B3\u30CD\u30AF\u30BF\u306E\u7DDA\u306E\u5F62\u3092\u5909\u66F4",disconnectedTitle:"\u30B3\u30CD\u30AF\u30BF\u3092\u524A\u9664",arrowTo:t=>`\u2192 \u300C${t}\u300D`,arrowFrom:(t,e)=>`\u300C${t}\u300D\u2192\u300C${e}\u300D`,plain:(t,e)=>`${t} \u2192 ${e}`,added:t=>`+ \u300C${t}\u300D`,deleted:t=>`\u2212 \u300C${t}\u300D`,inFrame:t=>`\u30D5\u30EC\u30FC\u30E0\u300C${t}\u300D\u5185`,intoFrame:t=>`\u30D5\u30EC\u30FC\u30E0\u300C${t}\u300D\u3078`,outOfFrame:t=>`\u30D5\u30EC\u30FC\u30E0\u300C${t}\u300D\u306E\u5916\u3078`,betweenFrames:(t,e)=>`\u30D5\u30EC\u30FC\u30E0\u300C${t}\u300D\u2192\u300C${e}\u300D`,position:(t,e)=>`(${t}, ${e})`,size:(t,e)=>`${t}\xD7${e}`,connection:(t,e)=>`\u300C${t}\u300D\u2192\u300C${e}\u300D`,labeled:t=>`\u30E9\u30D9\u30EB\u300C${t}\u300D`,inFrontOf:t=>`\u300C${t}\u300D\u306E\u524D\u9762\u3078`,toBack:"\u6700\u80CC\u9762\u3078",empty:"\uFF08\u7A7A\uFF09",noLabel:"\uFF08\u30E9\u30D9\u30EB\u306A\u3057\uFF09"}}),ue=t=>t===void 0?[]:[...new Set(t.split(",").filter(e=>e!==""))],rt=t=>t.length===0?void 0:t.join(","),st=(t,e)=>t.includes(e)?t.filter(o=>o!==e):[...t,e],at=40,A=(t,e)=>{const o=e.replace(/\s+/g," ").trim();return o===""?t.empty:o.length>at?`${o.slice(0,at-1)}\u2026`:o},Fo=(t,e)=>`${e.kind==="shape"?t.shapeLabel(e.shape):t.kindLabel(e.kind)} \xB7 ${A(t,L(e))}`,E=(t,e,o,n)=>{const i=p(e,n)??p(o,n);return i===void 0?n:A(t,L(i))},Bo=(t,e,o,n=e)=>`${t.connector} \xB7 ${t.connection(E(t,e,n,o.from),E(t,e,n,o.to))}`,Ho=(t,e,o,n,i)=>{const r=o===void 0?void 0:D(i,o),s=D(e,n),d=t.position(Math.round(n.x),Math.round(n.y));if(r?.id!==s?.id){if(r!==void 0&&s!==void 0)return`${t.betweenFrames(r.title,s.title)} ${d}`;if(s!==void 0)return`${t.intoFrame(s.title)} ${d}`;if(r!==void 0)return`${t.outOfFrame(r.title)} ${d}`}return o===void 0?`\u2192 ${d}`:t.plain(t.position(Math.round(o.x),Math.round(o.y)),d)},Wo=(t,e,o,n)=>{const i=e.target.id,r=p(n,i),s=p(o,i)??r,d=s?.kind??"sticky";switch(e.type){case"ADD_ITEM":{const a=p(o,e.payload.id)??e.payload,c=D(o,a),l=t.added(A(t,L(a)));return{title:t.addedTitle(a.kind),tone:"create",body:c===void 0?l:`${l} ${t.inFrame(c.title)}`}}case"SET_ITEM_TEXT":{const a=A(t,e.payload.text);return{title:t.textEditedTitle(d),tone:"update",body:r===void 0?t.arrowTo(a):t.arrowFrom(A(t,L(r)),a)}}case"MOVE_ITEM":{if(s===void 0)return{title:t.movedTitle(d),tone:"move"};const a={...s,x:e.payload.x,y:e.payload.y};return{title:t.movedTitle(d),tone:"move",body:Ho(t,o,r,a,n)}}case"RESIZE_ITEM":{const a=t.size(Math.round(e.payload.w),Math.round(e.payload.h));return{title:t.resizedTitle(d),tone:"update",body:r===void 0?`\u2192 ${a}`:t.plain(t.size(Math.round(r.w),Math.round(r.h)),a)}}case"SET_ITEM_COLOR":{const a=t.colorLabel(e.payload.color);return{title:t.recoloredTitle(d),tone:"update",body:r!==void 0&&$e(r)?t.plain(t.colorLabel(r.color),a):`\u2192 ${a}`}}case"SET_ITEM_FONT_SIZE":{const a=t.fontSizeLabel(e.payload.fontSize);return{title:t.resizedTextTitle(d),tone:"update",body:r!==void 0&&X(r)?t.plain(t.fontSizeLabel(r.fontSize),a):`\u2192 ${a}`}}case"REORDER_ITEM":{const a=e.payload.after;return{title:t.restackedTitle(d),tone:"move",body:a===null?t.toBack:t.inFrontOf(E(t,o,n,a))}}case"DELETE_ITEM":return{title:t.deletedTitle(d),tone:"delete",body:t.deleted(s===void 0?i:A(t,L(s)))};case"CONNECT_ITEMS":{const a=e.payload,c=t.connection(E(t,o,n,a.from),E(t,o,n,a.to));return{title:t.connectedTitle,tone:"create",body:a.label===void 0||a.label===""?c:`${c} \xB7 ${t.labeled(a.label)}`}}case"SET_CONNECTOR_LABEL":{const a=k(n,i)?.label,c=e.payload.label===""?t.noLabel:e.payload.label;return{title:t.relabeledTitle,tone:"update",body:a===void 0?t.arrowTo(c):t.arrowFrom(a,c)}}case"SET_CONNECTOR_ROUTE":{const a=k(n,i)?.route,c=t.routeLabel(e.payload.route);return{title:t.reroutedTitle,tone:"update",body:a===void 0?`\u2192 ${c}`:t.plain(t.routeLabel(a),c)}}case"DELETE_CONNECTOR":{const a=k(n,i)??k(o,i);return{title:t.disconnectedTitle,tone:"delete",...a===void 0?{}:{body:t.connection(E(t,o,n,a.from),E(t,o,n,a.to))}}}}},dt=(t,e,o,n=o)=>{let i;try{const r=He(ce,e);i=r===null?{title:e.type,tone:"meta"}:Wo(t,r,o,n)}catch{i={title:e.type,tone:"meta"}}return{title:i.title,targetLabel:lt(t,o,e.target,n),tone:i.tone,...i.body===void 0?{}:{summary:i.body}}},ct=t=>`${t.type} ${I(t.target)} ${JSON.stringify(t.payload)}`,lt=(t,e,o,n=e)=>{switch(o.type){case"item":{const i=p(e,o.id)??p(n,o.id);return i===void 0?`${o.type} \xB7 ${o.id} (missing)`:Fo(t,i)}case"connector":{const i=k(e,o.id)??k(n,o.id);return i===void 0?`${t.connector} \xB7 ${o.id} (missing)`:Bo(t,e,i,n)}case"page":return`${t.board} \xB7 ${_e(e)}`;default:return`${o.type} \xB7 ${o.id}`}},ht=(t,e)=>{const o=[{value:"page:whiteboard",label:t.wholeBoard,group:t.board}],n=e.items.filter(r=>r.kind==="frame"),i=e.items.filter(r=>r.kind!=="frame");for(const r of[...n,...i]){const s=D(e,r),d=A(t,L(r));o.push({value:I({type:"item",id:r.id}),label:s===void 0?d:`${s.title} \u203A ${d}`,group:t.kindLabel(r.kind)})}for(const r of e.connectors)o.push({value:I({type:"connector",id:r.id}),label:t.connection(E(t,e,e,r.from),E(t,e,e,r.to)),group:t.connector});return o},pt=(t,e,o)=>{const n=ue(o.item),i=n.length===1?n[0]:void 0,r=p(e,i)??p(e,o.frame);if(r!==void 0)return{value:I({type:"item",id:r.id}),label:A(t,L(r)),group:t.kindLabel(r.kind)};const s=k(e,i);return s===void 0?null:{value:I({type:"connector",id:s.id}),label:t.connection(E(t,e,e,s.from),E(t,e,e,s.to)),group:t.connector}},_e=t=>t.title??"Whiteboard",ut=(t,e)=>{const o={...e};p(t,e.frame)?.kind!=="frame"&&delete o.frame;const n=ue(e.item),i=n.filter(d=>p(t,d)!==void 0),r=n.length===1?k(t,n[0]):void 0,s=rt(r===void 0?i:[r.id]);return s===void 0?delete o.item:o.item=s,o},bt=(t,e)=>{switch(e.type){case"item":return p(t,e.id)!==void 0;case"connector":return k(t,e.id)!==void 0;case"page":return!0;default:return!1}},ft=t=>{const e=pe(t);return{name:"whiteboard",label:"Whiteboard",parseBase:Ye,emptyBase:je,actions:ce,apply:tt,canonicalState:o=>({...o,items:ze(o)}),hasTarget:bt,describe:(o,n,i)=>dt(e,o,n,i),serialize:ct,resolveNavigation:ut,navigationHierarchy:["frame","item"],commentTargets:o=>ht(e,o),currentTarget:(o,n)=>pt(e,o,n),title:_e}},mt=["front","forward","backward","back"],wt=t=>t.items.filter(e=>e.kind!=="frame"),xt=(t,e,o,n)=>{const i=t.indexOf(e),r=(n?t.slice(i+1):t.slice(0,i).reverse()).filter(c=>!o.has(c.id)),s=r.find(c=>he(e,c,0))??r[0];if(s===void 0)return t;const d=t.filter(c=>c!==e),a=d.indexOf(s)+(n?1:0);return[...d.slice(0,a),e,...d.slice(a)]},yt=(t,e,o)=>{const n=t.filter(r=>e.has(r.id)),i=t.filter(r=>!e.has(r.id));switch(o){case"front":return[...i,...n];case"back":return[...n,...i];case"forward":return[...n].reverse().reduce((r,s)=>xt(r,s,e,!0),[...t]);case"backward":return n.reduce((r,s)=>xt(r,s,e,!1),[...t])}},Ko=(t,e,o)=>{let n=t.map(r=>r.id);const i=[];return e.forEach((r,s)=>{if(!o.has(r.id))return;const d=e[s-1]?.id??null,a=n.indexOf(r.id);(n[a-1]??null)!==d&&(n=n.filter(c=>c!==r.id),n.splice(d===null?0:n.indexOf(d)+1,0,r.id),i.push(y.reorder(r.id,d)))}),i},qo=(t,e,o)=>{const n=wt(t),i=new Set(e.filter(r=>n.some(s=>s.id===r)));return i.size===0?[]:Ko(n,yt(n,i,o),i)},Uo=(t,e)=>{const o=wt(t),n=new Set(e.filter(s=>o.some(d=>d.id===s))),i=o.flatMap(s=>n.has(s.id)?o.filter(d=>!n.has(d.id)&&he(s,d,0)).map(d=>[s,d]):[]),r=(s,[d,a])=>s.indexOf(d)>s.indexOf(a);return new Set(mt.filter(s=>{const d=yt(o,n,s);return i.some(a=>r(o,a)!==r(d,a))}))},kt=(t,e,o)=>{if(!t.contains(e)||e.nodeType!==Node.TEXT_NODE)return;let n=0;const i=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let r=i.nextNode();r!==null;r=i.nextNode()){if(r===e)return n+o;n+=r.textContent?.length??0}},Zo=(t,e,o)=>{const n=t.getRootNode(),i=t.ownerDocument;if(typeof i.caretPositionFromPoint=="function"){const r=n instanceof ShadowRoot?[n]:[],s=i.caretPositionFromPoint(e,o,{shadowRoots:r});if(s!==null)return kt(t,s.offsetNode,s.offset)}if(typeof i.caretRangeFromPoint=="function"){const r=i.caretRangeFromPoint(e,o);if(r!==null)return kt(t,r.startContainer,r.startOffset)}},Xo=["sticky","text","rect","ellipse","frame"],Go=t=>t==="rect"||t==="ellipse"?C.shape:C[t],Vo=(t,e,o,n)=>{const{w:i,h:r}=Go(o),s={x:Math.round(n.x-i/2),y:Math.round(n.y-r/2)},d=_o(t,{...s,w:i,h:r},o==="frame"),l={id:We(`new-${o==="rect"||o==="ellipse"?"shape":o}`,Je(t)),x:d.x,y:d.y,w:i,h:r};switch(o){case"sticky":return{...l,kind:"sticky",text:"",color:H.sticky,fontSize:se};case"text":return{...l,kind:"text",text:"",fontSize:se};case"rect":case"ellipse":return{...l,kind:"shape",shape:o,text:"",color:H.shape,fontSize:se};case"frame":return{...l,kind:"frame",title:e.newFrameTitle,color:H.frame}}},Yo=(t,e,o)=>We(`${e}-to-${o}`,Je(t)),jo=(t,e)=>{const o=(t.kind==="frame"?e.replace(/\r?\n/g," "):e).trim();if(!(t.kind==="frame"&&o===""))return o===L(t)?void 0:o},be=4,Le=(t,e,o,n,i=[e])=>{if(p(t,e)===void 0)return;const r=new Map;for(const s of i.includes(e)?i:[e,...i]){const d=p(t,s);if(d!==void 0)for(const a of d.kind==="frame"?[d,...Ee(t,d)]:[d])r.set(a.id,a)}return{kind:"move",pointerId:o,itemId:e,origins:[...r.values()].map(({id:s,x:d,y:a})=>({id:s,x:d,y:a})),start:n,current:n,moved:!1}},Jo=(t,e,o,n)=>{const i=p(t,e);if(i!==void 0)return{kind:"resize",pointerId:o,itemId:e,origin:{w:i.w,h:i.h},start:n,current:n,moved:!1,keepRatio:!1}},Qo=(t,e)=>({kind:"pan",pointerId:t,start:e,last:e,moved:!1}),en=(t,e)=>({gesture:{...t,last:e,moved:t.moved||Math.hypot(e.x-t.start.x,e.y-t.start.y)>be},dx:e.x-t.last.x,dy:e.y-t.last.y}),gt=(t,e,o)=>({kind:"marquee",pointerId:t,base:o,start:e,current:e,moved:!1}),tn=(t,e,o,n,i)=>{const r=To(t,n).find(d=>e.includes(d.id));return(r===void 0?void 0:Le(t,r.id,o,n,e))??gt(o,n,i)},vt=t=>t?.kind==="marquee"&&t.moved?zo(t.start,t.current):void 0,$t=(t,e)=>{const o=vt(e);if(e.kind!=="marquee"||o===void 0)return[];const n=Mo(t,o).map(i=>i.id);return[...new Set([...e.base,...n])]},on=(t,e,o)=>({kind:"connect",pointerId:e,fromId:t,start:o,current:o,moved:!1}),Oe=(t,e,o,n,i,r=!1)=>{if(e.pointerId!==o)return e;switch(e.kind){case"pan":return e;case"marquee":case"move":{const s=e.moved||Math.hypot(n.x-e.start.x,n.y-e.start.y)*i>be;return{...e,current:n,moved:s}}case"resize":{const s=e.moved||Math.hypot(n.x-e.start.x,n.y-e.start.y)*i>be;return{...e,current:n,moved:s,keepRatio:r}}case"connect":{const s=e.moved||Math.hypot(n.x-e.start.x,n.y-e.start.y)*i>be,d=Me(t,n,e.fromId),{targetId:a,...c}=e;return d===void 0?{...c,current:n,moved:s}:{...c,current:n,moved:s,targetId:d.id}}}},K=t=>Math.round(t),Et=(t,e)=>{if(e===void 0||!e.moved)return t;if(e.kind==="move"){const o=e.current.x-e.start.x,n=e.current.y-e.start.y,i=new Map(e.origins.map(r=>[r.id,r]));return{...t,items:t.items.map(r=>{const s=i.get(r.id);return s===void 0?r:{...r,x:K(s.x+o),y:K(s.y+n)}})}}if(e.kind==="resize"){const o=Tt(e);return{...t,items:t.items.map(n=>n.id===e.itemId?{...n,...o}:n)}}return t},Tt=t=>{const{origin:e}=t,o=e.w+t.current.x-t.start.x,n=e.h+t.current.y-t.start.y;if(!t.keepRatio)return{w:Math.max(Z,K(o)),h:Math.max(Z,K(n))};const i=Math.max(o/e.w,n/e.h,Z/Math.min(e.w,e.h));return{w:K(e.w*i),h:K(e.h*i)}},nn=(t,e,o,n)=>{const[i]=e;if(i===void 0)return[];const r=Le(t,i,0,{x:0,y:0},e);if(r?.kind!=="move")return[];const s=zt(t,{...r,current:{x:o,y:n},moved:!0});return s.kind==="dispatch"?s.inputs:[]},zt=(t,e)=>{switch(e.kind){case"pan":return e.moved?{kind:"none"}:{kind:"click"};case"marquee":{if(e.moved)return{kind:"select",ids:$t(t,e)};const o=Me(t,e.start);return o===void 0?{kind:"click"}:{kind:"click",itemId:o.id}}case"move":{if(!e.moved)return{kind:"click",itemId:e.itemId};const o=Et(t,e),n=e.origins.flatMap(i=>{const r=p(o,i.id);return r===void 0||r.x===i.x&&r.y===i.y?[]:[y.move(i.id,r.x,r.y)]});return n.length===0?{kind:"none"}:{kind:"dispatch",inputs:n}}case"resize":{if(!e.moved)return{kind:"click",itemId:e.itemId};const o=Tt(e);return o.w===e.origin.w&&o.h===e.origin.h?{kind:"none"}:{kind:"dispatch",inputs:[y.resize(e.itemId,o.w,o.h)]}}case"connect":return e.moved?e.targetId===void 0?{kind:"none"}:{kind:"connect",from:e.fromId,to:e.targetId}:{kind:"click",itemId:e.fromId}}},j=.1,St=2.5,rn={x:0,y:0,zoom:1},sn=96,Ie=(t,e)=>({x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}),Ce=(t,e)=>({x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}),fe=(t,e,o)=>({...t,x:t.x+e,y:t.y+o}),Re=(t,e,o)=>{const n=ke(t.zoom*o,j,St),i=Ie(t,e);return{zoom:n,x:e.x-i.x*n,y:e.y-i.y*n}},Mt=(t,e,o=48,n=1)=>{const i=Math.max(1,e.width-o*2),r=Math.max(1,e.height-o*2),s=ke(Math.min(i/Math.max(1,t.w),r/Math.max(1,t.h)),j,n);return{zoom:s,x:e.width/2-(t.x+t.w/2)*s,y:e.height/2-(t.y+t.h/2)*s}},an=(t,e,o=48)=>{const n=V(t);if(n===null)return null;const i=Math.max(1,e.width-o*2)/j,r=Math.max(1,e.height-o*2)/j;if(n.w<=i&&n.h<=r)return n;const s=qe(t.map(c=>c.x+c.w/2)),d=qe(t.map(c=>c.y+c.h/2)),a=t.filter(c=>c.x<s+i/2&&c.x+c.w>s-i/2&&c.y<d+r/2&&c.y+c.h>d-r/2);return V(a)??n},_t=(t,e,o)=>{if(e===null||o.width<=0||o.height<=0)return t;const n=(i,r,s,d)=>{const a=Math.min(sn,d/2),c=a-(r+s)*t.zoom,l=d-a-r*t.zoom;return ke(i,Math.min(c,l),Math.max(c,l))};return{zoom:t.zoom,x:n(t.x,e.x,e.w,o.width),y:n(t.y,e.y,e.h,o.height)}},dn=(t,e,o,n=24)=>{const i=e.x*t.zoom+t.x,r=e.y*t.zoom+t.y,s=i+e.w*t.zoom,d=r+e.h*t.zoom;return i>=n&&r>=n&&s<=o.width-n&&d<=o.height-n?t:{zoom:t.zoom,x:o.width/2-(e.x+e.w/2)*t.zoom,y:o.height/2-(e.y+e.h/2)*t.zoom}},Lt=(t,e,o,n,i=0)=>{const r=t+e-(o-n),s=r>0?-r:0;return t+s<i+n?i+n-t:s},cn=(t,e)=>t.x===e.x&&t.y===e.y&&t.zoom===e.zoom,v={kind:"idle"},J=(t,e)=>t.kind==="editing"&&t.itemId===e,ln={front:_(lo),forward:_(Gt),backward:_(Xt),back:_(uo)},Ot=[["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}]],hn={straight:_([...Ot,["path",{d:"M6.5 17.5 17.5 6.5"}]]),elbow:_([...Ot,["path",{d:"M7 19h5V5h5"}]]),curve:_(bo)},pn=t=>ln[t](),un=t=>hn[t](),bn=_(ho),fn=_(po),mn={yellow:{paper:"#fff0a3",ink:"#4a3a06",stroke:"#d9a900"},orange:{paper:"#ffd1a0",ink:"#4a2503",stroke:"#ec7f1d"},pink:{paper:"#ffc9dd",ink:"#4b1029",stroke:"#de4479"},purple:{paper:"#ddcbf8",ink:"#32195c",stroke:"#8a5bd6"},blue:{paper:"#c0ddf7",ink:"#0e2c4b",stroke:"#3a80d4"},green:{paper:"#cdeba5",ink:"#22380a",stroke:"#55a42c"},gray:{paper:"#e3e6eb",ink:"#2a2f38",stroke:"#868d99"}},Ne=t=>{const{paper:e,ink:o,stroke:n}=mn[t];return`--wb-paper:${e};--wb-ink:${o};--wb-stroke:${n}`},It={sticky:"addSticky",text:"addText",rect:"addRect",ellipse:"addEllipse",frame:"addFrame"},Ct={small:.8,medium:1,large:1.4,xlarge:2},wn=t=>{const e=24*t.zoom;return`background-size:${e}px ${e}px;background-position:${t.x}px ${t.y}px`},xn=t=>{const{m:e,state:o,viewport:n,gesture:i,handlers:r}=t,s=["wb-canvas"];i?.moved===!0&&s.push("wb-canvas--gesturing"),i?.kind==="pan"&&i.moved&&s.push("wb-canvas--panning"),i?.kind==="connect"&&s.push("wb-canvas--connecting"),(t.panReady||i?.kind==="pan")&&s.push("wb-canvas--pan-ready");const d=ze(o);return h`<div
2
+ class=${s.join(" ")}
3
+ data-testid="wb-canvas"
4
+ tabindex="0"
5
+ role="application"
6
+ aria-label=${e.canvasLabel}
7
+ style=${wn(n)}
8
+ @pointerdown=${r.canvasPointerDown}
9
+ @pointermove=${r.canvasPointerMove}
10
+ @pointerup=${r.canvasPointerUp}
11
+ @pointercancel=${r.canvasPointerCancel}
12
+ @wheel=${r.canvasWheel}
13
+ @dblclick=${r.canvasDblClick}
14
+ @keydown=${r.canvasKeyDown}
15
+ @keyup=${r.canvasKeyUp}
16
+ @blur=${r.canvasBlur}
17
+ >
18
+ <div
19
+ class="wb-world"
20
+ style=${`transform:translate(${n.x}px, ${n.y}px) scale(${n.zoom});--wb-zoom:${n.zoom}`}
21
+ >
22
+ ${Vt(d,a=>a.id,a=>gn(t,a))}
23
+ ${En(t)} ${Tn(t)}
24
+ </div>
25
+ ${o.items.length===0?h`<p class="wb-hint wb-hint--empty">${e.emptyHint}</p>`:b}
26
+ ${yn(t)} ${i?.moved===!0?b:t.overlay} ${zn(e,r)}
27
+ ${Sn(e,n,r)}
28
+ </div>`},yn=({marquee:t,viewport:e})=>{if(t===void 0)return b;const o=Ce(e,t),n=`width:${t.w*e.zoom}px;height:${t.h*e.zoom}px`;return h`<div
29
+ class="wb-marquee"
30
+ aria-hidden="true"
31
+ style=${`left:${o.x}px;top:${o.y}px;${n}`}
32
+ ></div>`},kn=(t,e)=>{const o=["wb-item",`wb-item--${e.kind}`];e.kind==="shape"&&o.push(`wb-item--${e.shape}`),t.selectedIds.has(e.id)&&o.push("is-selected"),J(t.mode,e.id)&&o.push("is-editing");const n=t.gesture;return n?.kind==="move"&&n.moved&&n.origins.some(i=>i.id===e.id)&&o.push("is-lifted"),n?.kind==="connect"&&n.targetId===e.id&&o.push("is-target"),o.join(" ")},gn=(t,e)=>{const{m:o,context:n,handlers:i}=t,r=`left:${e.x}px;top:${e.y}px;width:${e.w}px;height:${e.h}px`,s=e.kind==="text"?"":`;${Ne(e.color)}`,d=X(e)?`;--wb-font-scale:${Ct[e.fontSize]}`:"",a=n.commentCount({type:"item",id:e.id}),c=t.selectedIds.size===1&&t.selectedIds.has(e.id)&&t.gesture?.moved!==!0,l=m=>i.itemPointerDown(e.id,m);return h`<div
33
+ class=${kn(t,e)}
34
+ style=${`${r}${s}${d}`}
35
+ data-item-id=${e.id}
36
+ data-kind=${e.kind}
37
+ @pointerdown=${e.kind==="frame"?b:l}
38
+ >
39
+ ${e.kind==="frame"?h`<div class="wb-frame-title" @pointerdown=${l}>${Rt(t,e)}</div>`:h`<div class="wb-item-body">${Rt(t,e)}</div>`}
40
+ ${a>0?h`<span class="wb-flag" title=${o.commentCount(a)}>${a}</span>`:b}
41
+ ${c?h`<span
42
+ class="wb-handle wb-handle--resize"
43
+ role="presentation"
44
+ title=${o.resizeHandle}
45
+ @pointerdown=${m=>i.resizePointerDown(e.id,m)}
46
+ ></span>
47
+ <span
48
+ class="wb-handle wb-handle--connect"
49
+ role="presentation"
50
+ title=${o.connectHandle}
51
+ @pointerdown=${m=>i.connectPointerDown(e.id,m)}
52
+ ></span>`:b}
53
+ </div>`},vn=t=>t.stopPropagation(),Rt=(t,e)=>{const{m:o,handlers:n}=t,i=L(e);if(!J(t.mode,e.id))return h`<span class="wb-text">${i}</span>`;const r=a=>{const c=a.currentTarget;(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement)&&n.editBlur(e.id,c.value)},s=a=>n.editKeyDown(e.id,a),d=a=>{const c=a.currentTarget;c instanceof HTMLInputElement&&c.previousElementSibling?.setAttribute("data-copy",c.value||o.textPlaceholder)};return e.kind==="frame"?h`<span class="wb-title-edit"
54
+ ><span class="wb-text" aria-hidden="true" data-copy=${i||o.textPlaceholder}></span
55
+ ><input
56
+ class="wb-editor"
57
+ type="text"
58
+ .value=${i}
59
+ placeholder=${o.textPlaceholder}
60
+ aria-label=${o.renameFrame}
61
+ @input=${d}
62
+ @blur=${r}
63
+ @keydown=${s}
64
+ /></span>`:h`<textarea
65
+ class="wb-editor"
66
+ .value=${i}
67
+ placeholder=${o.textPlaceholder}
68
+ aria-label=${o.editText}
69
+ spellcheck="false"
70
+ @blur=${r}
71
+ @keydown=${s}
72
+ @wheel=${vn}
73
+ ></textarea>`},$n=()=>ye`<marker id="wb-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
74
+ <path d="M0,0 L10,5 L0,10 z"></path>
75
+ </marker>`,Nt=(t,e)=>{const o=p(t,e.from),n=p(t,e.to);return o===void 0||n===void 0?void 0:[o,n]},En=t=>{const{state:e,handlers:o,gesture:n}=t,i=e.connectors.map(s=>{const d=Nt(e,s);if(d===void 0)return b;const{d:a}=le(...d,s.route),c=t.selectedIds.has(s.id)?" is-selected":"";return ye`<g data-connector-id=${s.id}>
76
+ <path class="wb-link-hit" d=${a} @pointerdown=${l=>o.connectorPointerDown(s.id,l)}></path>
77
+ <path class=${`wb-link${c}`} d=${a} marker-end=${s.style==="arrow"?"url(#wb-arrow)":b}></path>
78
+ </g>`});let r=b;if(n?.kind==="connect"&&n.moved){const s=p(e,n.fromId),d=n.targetId===void 0?void 0:p(e,n.targetId);if(s!==void 0){const a=d===void 0?n.current:Y(d,W(s)),c=Y(s,a);r=ye`<path class="wb-link wb-link--draft" d=${`M ${c.x} ${c.y} L ${a.x} ${a.y}`} marker-end="url(#wb-arrow)"></path>`}}return h`<svg class="wb-links" width="1" height="1" aria-hidden="true">
79
+ <defs>${$n()}</defs>
80
+ ${i} ${r}
81
+ </svg>`},Tn=t=>{const{state:e,context:o,handlers:n}=t;return e.connectors.flatMap(i=>{const r=Nt(e,i),s=o.commentCount({type:"connector",id:i.id});if(r===void 0||i.label===void 0&&s===0)return[];const{mid:d}=le(...r,i.route),a=t.selectedIds.has(i.id)?" is-selected":"";return[h`<div
82
+ class=${`wb-link-label${a}`}
83
+ data-connector-label=${i.id}
84
+ style=${`left:${d.x}px;top:${d.y}px`}
85
+ @pointerdown=${c=>n.connectorPointerDown(i.id,c)}
86
+ >
87
+ ${i.label??b}
88
+ ${s>0?h`<span class="wb-flag wb-flag--inline">${s}</span>`:b}
89
+ </div>`]})},me=t=>t.stopPropagation(),zn=(t,e)=>h`<div class="wb-tools" role="toolbar" aria-label=${t.toolsLabel} @pointerdown=${me} @dblclick=${me}>
90
+ ${Xo.map(o=>h`<button
91
+ type="button"
92
+ class="wb-tool"
93
+ data-add=${o}
94
+ title=${t[It[o]]}
95
+ aria-label=${t[It[o]]}
96
+ @click=${()=>e.addItem(o)}
97
+ >
98
+ <span class=${`wb-tool-icon wb-tool-icon--${o}`} aria-hidden="true"></span>
99
+ </button>`)}
100
+ </div>`,Sn=(t,e,o)=>h`<div class="wb-zoom" @pointerdown=${me} @dblclick=${me}>
101
+ <button type="button" aria-label=${t.zoomOut} @click=${()=>o.zoomStep(-1)}>${Yt()}</button>
102
+ <button type="button" class="wb-zoom-pct" title=${t.zoomReset} @click=${()=>o.zoomReset()}>
103
+ ${Math.round(e.zoom*100)}%
104
+ </button>
105
+ <button type="button" aria-label=${t.zoomIn} @click=${()=>o.zoomStep(1)}>${jt()}</button>
106
+ <button type="button" aria-label=${t.zoomFit} title=${t.zoomFit} @click=${()=>o.zoomFit()}>
107
+ ${fn()}
108
+ </button>
109
+ </div>`,Mn=t=>{const{m:e,state:o,focused:n}=t,i=o.items.filter(r=>r.kind==="frame");return h`<nav class="wb-frames" aria-label=${e.framesHeading}>
110
+ <p class="dpk-label">${e.framesHeading}</p>
111
+ <p class="wb-frames-hint">${e.framesHint}</p>
112
+ <ul>
113
+ <li>
114
+ <button
115
+ type="button"
116
+ class="wb-frame-link"
117
+ aria-current=${String(n===void 0)}
118
+ @click=${t.showBoard}
119
+ >
120
+ <span class="wb-frame-dot wb-frame-dot--board" aria-hidden="true"></span>
121
+ <span class="wb-frame-name">${e.wholeBoard}</span>
122
+ <span class="wb-frame-count">${e.memberCount(o.items.length)}</span>
123
+ </button>
124
+ </li>
125
+ ${i.map(r=>h`<li>
126
+ <button
127
+ type="button"
128
+ class="wb-frame-link"
129
+ data-frame=${r.id}
130
+ aria-current=${String(n===r.id)}
131
+ @click=${()=>t.focusFrame(r.id)}
132
+ >
133
+ <span class="wb-frame-dot" style=${Ne(r.color)} aria-hidden="true"></span>
134
+ <span class="wb-frame-name">${r.title}</span>
135
+ <span class="wb-frame-count">${e.memberCount(Ee(o,r).length)}</span>
136
+ </button>
137
+ </li>`)}
138
+ </ul>
139
+ </nav>`},Ae={item:14,frame:40,connector:18},_n=t=>{const{selection:e,viewport:o,state:n}=t;if(e.kind==="items"){const d=V(e.items);if(d===null)return;const a=e.items.some(l=>l.kind==="frame"&&l.y===d.y),c=Ce(o,{x:d.x+d.w/2,y:d.y});return{x:c.x,y:c.y-(a?Ae.frame:Ae.item)}}const i=p(n,e.connector.from),r=p(n,e.connector.to);if(i===void 0||r===void 0)return;const s=Ce(o,le(i,r,e.connector.route).mid);return{x:s.x,y:s.y-Ae.connector}},De=t=>t.stopPropagation(),we=h`<span class="wb-toolbar-sep" aria-hidden="true"></span>`,At=t=>t.length>0&&t.every(e=>e===t[0])?t[0]:void 0,Ln=t=>{const e=_n(t);if(e===void 0)return b;const{m:o,selection:n,handlers:i}=t,r=n.kind==="connector"?n.connector:n.items.length===1?n.items[0]:void 0,s=r===void 0?void 0:n.kind==="connector"?`connector:${r.id}`:`item:${r.id}`,d=n.kind==="items"&&n.items.length>1?o.selectionCount(n.items.length):o.selectionLabel;return h`<div
140
+ class="wb-toolbar"
141
+ role="toolbar"
142
+ aria-label=${d}
143
+ style=${`left:${e.x}px;top:${e.y}px`}
144
+ @pointerdown=${De}
145
+ @dblclick=${De}
146
+ @keydown=${De}
147
+ >
148
+ ${n.kind==="items"?In(t,n.items):Rn(t,n.connector)}
149
+ ${s===void 0?b:h`<button
150
+ type="button"
151
+ class="dpk-icon-btn wb-toolbar-btn"
152
+ data-role="comment"
153
+ aria-label=${o.comment}
154
+ title=${o.comment}
155
+ data-active=${String(t.commenting)}
156
+ @click=${()=>i.toggleComment(s)}
157
+ >
158
+ ${Jt()}
159
+ ${t.comments>0?h`<span class="wb-toolbar-count">${t.comments}</span>`:b}
160
+ </button>`}
161
+ <button
162
+ type="button"
163
+ class="dpk-icon-btn wb-toolbar-btn"
164
+ data-role="delete"
165
+ aria-label=${o.delete}
166
+ title=${o.delete}
167
+ @click=${()=>i.deleteSelection()}
168
+ >
169
+ ${Qt()}
170
+ </button>
171
+ </div>`},On={front:"\u2318/Ctrl ]",forward:"]",backward:"[",back:"\u2318/Ctrl ["},In=(t,e)=>{const{m:o,handlers:n}=t,i=e.filter($e).map(a=>a.color),r=e.flatMap(a=>X(a)?[a.fontSize]:[]),s=At(i),d=At(r);return h`
172
+ ${i.length>0?h`<div class="wb-swatches" role="radiogroup" aria-label=${o.colorLabelPrefix}>
173
+ ${ie.map(a=>h`<button
174
+ type="button"
175
+ class="wb-swatch"
176
+ role="radio"
177
+ data-color=${a}
178
+ style=${Ne(a)}
179
+ aria-checked=${String(s===a)}
180
+ aria-label=${`${o.colorLabelPrefix}: ${o.colorLabel(a)}`}
181
+ title=${o.colorLabel(a)}
182
+ @click=${()=>n.setColor(a)}
183
+ ></button>`)}
184
+ </div>
185
+ ${we}`:b}
186
+ ${r.length>0?h`<div class="wb-choice" role="radiogroup" aria-label=${o.fontSizeLabelPrefix}>
187
+ ${re.map(a=>h`<button
188
+ type="button"
189
+ class="wb-choice-btn"
190
+ role="radio"
191
+ data-font-size=${a}
192
+ aria-checked=${String(d===a)}
193
+ aria-label=${`${o.fontSizeLabelPrefix}: ${o.fontSizeLabel(a)}`}
194
+ title=${`${o.fontSizeLabelPrefix}: ${o.fontSizeLabel(a)}`}
195
+ @click=${()=>n.setFontSize(a)}
196
+ >
197
+ ${o.fontSizeShort(a)}
198
+ </button>`)}
199
+ </div>
200
+ ${we}`:b}
201
+ ${t.arrange.size>0?h`${Cn(t)} ${we}`:b}
202
+ `},Cn=t=>{const{m:e,handlers:o}=t,n={front:e.bringToFront,forward:e.bringForward,backward:e.sendBackward,back:e.sendToBack};return h`<div class="wb-menu-anchor" @keydown=${r=>{r.key==="Escape"&&o.toggleArrangeMenu()}}>
203
+ <button
204
+ type="button"
205
+ class="wb-menu-btn"
206
+ data-role="arrange"
207
+ aria-haspopup="menu"
208
+ aria-expanded=${String(t.arrangeMenuOpen)}
209
+ aria-label=${e.arrangeLabel}
210
+ title=${e.arrangeLabel}
211
+ @click=${()=>o.toggleArrangeMenu()}
212
+ >
213
+ ${bn()} ${to()}
214
+ </button>
215
+ ${t.arrangeMenuOpen?h`<div class="wb-menu" role="menu" aria-label=${e.arrangeLabel}>
216
+ ${mt.map(r=>h`<button
217
+ type="button"
218
+ class="wb-menu-item"
219
+ role="menuitem"
220
+ data-arrange=${r}
221
+ ?disabled=${!t.arrange.has(r)}
222
+ @click=${()=>o.arrange(r)}
223
+ >
224
+ ${pn(r)}
225
+ <span class="wb-menu-label">${n[r]}</span>
226
+ <kbd class="wb-menu-key">${On[r]}</kbd>
227
+ </button>`)}
228
+ </div>`:b}
229
+ </div>`},Rn=(t,e)=>{const{m:o,handlers:n}=t;return h`<div class="wb-choice" role="radiogroup" aria-label=${o.routeLabelPrefix}>
230
+ ${U.map(i=>h`<button
231
+ type="button"
232
+ class="wb-choice-btn wb-choice-btn--icon"
233
+ role="radio"
234
+ data-route=${i}
235
+ aria-checked=${String(e.route===i)}
236
+ aria-label=${`${o.routeLabelPrefix}: ${o.routeLabel(i)}`}
237
+ title=${o.routeLabel(i)}
238
+ @click=${()=>n.setRoute(e.id,i)}
239
+ >
240
+ ${un(i)}
241
+ </button>`)}
242
+ </div>
243
+ ${we}
244
+ <dpk-component-inline-edit
245
+ class="wb-toolbar-label"
246
+ .value=${e.label??""}
247
+ .placeholder=${o.labelPlaceholder}
248
+ .label=${o.labelField}
249
+ @dpk-commit=${eo(i=>n.setLabel(e.id,i))}
250
+ ></dpk-component-inline-edit>`},Nn=oo`
251
+ /* The board owns the whole main area; the canvas clips, never the shell. */
252
+ .dpk-main {
253
+ overflow: hidden;
254
+ }
255
+
256
+ .dpk-main-body {
257
+ flex: 1 1 auto;
258
+ min-height: 0;
259
+ display: flex;
260
+ flex-direction: column;
261
+ padding: 0;
262
+ gap: 0;
263
+ }
264
+
265
+ /* ---------------------------------------------------------------- canvas */
266
+
267
+ .wb-canvas {
268
+ position: relative;
269
+ /* The board's own floating controls stack inside it, under the page's overlays (the review rail). */
270
+ isolation: isolate;
271
+ flex: 1 1 auto;
272
+ min-height: 0;
273
+ overflow: hidden;
274
+ touch-action: none;
275
+ background: var(--dpk-dots), var(--dpk-paper-sunken);
276
+ cursor: default;
277
+ outline: none;
278
+ }
279
+
280
+ .wb-canvas:focus-visible {
281
+ box-shadow: inset var(--dpk-focus);
282
+ }
283
+
284
+ /* Space held (or a pan under way): the whole board, items included, is a handle. */
285
+ .wb-canvas--pan-ready,
286
+ .wb-canvas--pan-ready .wb-item,
287
+ .wb-canvas--pan-ready .wb-frame-title {
288
+ cursor: grab;
289
+ }
290
+
291
+ .wb-canvas--panning,
292
+ .wb-canvas--panning .wb-item {
293
+ cursor: grabbing;
294
+ }
295
+
296
+ .wb-canvas--gesturing,
297
+ .wb-canvas--gesturing * {
298
+ user-select: none;
299
+ }
300
+
301
+ .wb-canvas--connecting .wb-item {
302
+ cursor: crosshair;
303
+ }
304
+
305
+ /* Items are things to pick up, not text to select: a press on the board
306
+ never starts a text selection. Only the in-place editor takes one. */
307
+ .wb-world {
308
+ -webkit-user-select: none;
309
+ user-select: none;
310
+ position: absolute;
311
+ left: 0;
312
+ top: 0;
313
+ width: 0;
314
+ height: 0;
315
+ transform-origin: 0 0;
316
+ will-change: transform;
317
+ }
318
+
319
+ /* ----------------------------------------------------------------- items */
320
+
321
+ .wb-item {
322
+ position: absolute;
323
+ box-sizing: border-box;
324
+ display: flex;
325
+ cursor: grab;
326
+ }
327
+
328
+ .wb-item-body {
329
+ flex: 1 1 auto;
330
+ min-width: 0;
331
+ min-height: 0;
332
+ display: flex;
333
+ overflow: hidden;
334
+ }
335
+
336
+ .wb-text {
337
+ flex: 1 1 auto;
338
+ min-width: 0;
339
+ white-space: pre-wrap;
340
+ overflow-wrap: anywhere;
341
+ }
342
+
343
+ /* The in-place editor is a bare field over the item's whole body, typeset
344
+ exactly like the text it replaces, so starting an edit moves nothing. */
345
+ .wb-editor {
346
+ flex: 1 1 auto;
347
+ display: block;
348
+ box-sizing: border-box;
349
+ width: 100%;
350
+ min-width: 0;
351
+ align-self: stretch;
352
+ margin: 0;
353
+ padding: 0;
354
+ border: none;
355
+ border-radius: 0;
356
+ outline: none;
357
+ background: transparent;
358
+ color: inherit;
359
+ font: inherit;
360
+ letter-spacing: inherit;
361
+ text-align: inherit;
362
+ white-space: pre-wrap;
363
+ overflow-wrap: anywhere;
364
+ resize: none;
365
+ overflow: auto;
366
+ scrollbar-width: none;
367
+ -webkit-user-select: text;
368
+ user-select: text;
369
+ }
370
+
371
+ .wb-editor::placeholder {
372
+ color: currentColor;
373
+ opacity: 0.45;
374
+ }
375
+
376
+ /* A shape centers its text, so the field grows with the text and stays centered. */
377
+ .wb-item--shape .wb-editor {
378
+ align-self: center;
379
+ max-height: 100%;
380
+ field-sizing: content;
381
+ }
382
+
383
+ .wb-title-edit {
384
+ position: relative;
385
+ display: block;
386
+ }
387
+
388
+ .wb-title-edit > .wb-text {
389
+ display: block;
390
+ visibility: hidden;
391
+ white-space: pre;
392
+ }
393
+
394
+ .wb-title-edit > .wb-text::before {
395
+ content: attr(data-copy);
396
+ }
397
+
398
+ /* A hair wider than the copy, so the caret at the end never scrolls the text. */
399
+ .wb-title-edit > .wb-editor {
400
+ position: absolute;
401
+ inset: 0 -2px 0 0;
402
+ width: auto;
403
+ white-space: nowrap;
404
+ overflow: hidden;
405
+ }
406
+
407
+ .wb-item.is-editing {
408
+ cursor: text;
409
+ }
410
+
411
+ .wb-item.is-lifted {
412
+ cursor: grabbing;
413
+ opacity: 0.88;
414
+ }
415
+
416
+ .wb-item.is-selected::before,
417
+ .wb-item.is-target::before {
418
+ content: '';
419
+ position: absolute;
420
+ inset: calc(-4px / var(--wb-zoom, 1));
421
+ border: calc(2px / var(--wb-zoom, 1)) solid var(--dpk-blue);
422
+ border-radius: 6px;
423
+ pointer-events: none;
424
+ }
425
+
426
+ .wb-item.is-target::before {
427
+ border-style: dashed;
428
+ background: color-mix(in srgb, var(--dpk-blue) 8%, transparent);
429
+ }
430
+
431
+ /* Sticky: colored paper with a soft lift. It keeps its color in both themes. */
432
+ .wb-item--sticky {
433
+ padding: 16px 14px;
434
+ border-radius: 3px;
435
+ background: linear-gradient(170deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 45%), var(--wb-paper);
436
+ color: var(--wb-ink);
437
+ font-size: calc(15px * var(--wb-font-scale, 1));
438
+ font-weight: 560;
439
+ line-height: 1.35;
440
+ box-shadow:
441
+ inset 0 1px 0 rgba(255, 255, 255, 0.35),
442
+ 0 1px 2px rgba(30, 24, 10, 0.14),
443
+ 0 8px 14px -8px rgba(30, 24, 10, 0.32);
444
+ }
445
+
446
+ .wb-item--sticky .wb-item-body {
447
+ align-items: flex-start;
448
+ }
449
+
450
+ /* Text: no box at all, just type on the board. */
451
+ .wb-item--text {
452
+ padding: 4px 6px;
453
+ color: var(--dpk-ink);
454
+ font-size: calc(20px * var(--wb-font-scale, 1));
455
+ font-weight: 650;
456
+ line-height: 1.3;
457
+ letter-spacing: -0.01em;
458
+ }
459
+
460
+ /* Shape: the color's stroke around a tint of it, text centered. */
461
+ .wb-item--shape {
462
+ padding: 10px 14px;
463
+ border: 2px solid var(--wb-stroke);
464
+ border-radius: 8px;
465
+ background: color-mix(in srgb, var(--wb-stroke) 16%, var(--dpk-paper-raised));
466
+ color: var(--dpk-ink);
467
+ font-size: calc(14px * var(--wb-font-scale, 1));
468
+ font-weight: 600;
469
+ line-height: 1.35;
470
+ text-align: center;
471
+ }
472
+
473
+ .wb-item--ellipse {
474
+ border-radius: 50%;
475
+ padding: 14px 22px;
476
+ }
477
+
478
+ .wb-item--shape .wb-item-body {
479
+ align-items: center;
480
+ justify-content: center;
481
+ }
482
+
483
+ /* Frame: a titled area drawn behind everything; its title is a handle.
484
+ A click on its empty inside selects it; a drag there draws a selection
485
+ area, or moves the frame once it is selected. */
486
+ .wb-item--frame {
487
+ border: 1.5px solid color-mix(in srgb, var(--wb-stroke) 55%, transparent);
488
+ border-radius: 10px;
489
+ background: color-mix(in srgb, var(--wb-stroke) 7%, transparent);
490
+ cursor: default;
491
+ }
492
+
493
+ /* Selected, the whole frame is a handle. */
494
+ .wb-item--frame.is-selected {
495
+ cursor: grab;
496
+ }
497
+
498
+ .wb-frame-title {
499
+ position: absolute;
500
+ left: -1px;
501
+ bottom: 100%;
502
+ max-width: 100%;
503
+ margin-bottom: 6px;
504
+ padding: 3px 10px;
505
+ border-radius: 6px;
506
+ background: color-mix(in srgb, var(--wb-stroke) 20%, var(--dpk-paper-raised));
507
+ color: var(--dpk-ink);
508
+ font-size: 13px;
509
+ font-weight: 700;
510
+ line-height: 1.3;
511
+ white-space: nowrap;
512
+ overflow: hidden;
513
+ text-overflow: ellipsis;
514
+ cursor: grab;
515
+ }
516
+
517
+ .wb-item--frame.is-editing .wb-frame-title {
518
+ overflow: visible;
519
+ cursor: text;
520
+ }
521
+
522
+ /* Comments already left: a corner flag, readable at a glance. */
523
+ .wb-flag {
524
+ position: absolute;
525
+ top: -8px;
526
+ right: -8px;
527
+ min-width: 18px;
528
+ height: 18px;
529
+ padding: 0 5px;
530
+ box-sizing: border-box;
531
+ border-radius: 999px;
532
+ background: var(--dpk-accent);
533
+ color: var(--dpk-accent-ink);
534
+ font-family: var(--dpk-mono);
535
+ font-size: 10px;
536
+ font-weight: 650;
537
+ line-height: 18px;
538
+ text-align: center;
539
+ pointer-events: none;
540
+ }
541
+
542
+ .wb-flag--inline {
543
+ position: static;
544
+ margin-left: 6px;
545
+ }
546
+
547
+ /* Selection handles keep their screen size at any zoom. */
548
+ .wb-handle {
549
+ position: absolute;
550
+ z-index: 2;
551
+ box-sizing: border-box;
552
+ width: calc(12px / var(--wb-zoom, 1));
553
+ height: calc(12px / var(--wb-zoom, 1));
554
+ border: calc(2px / var(--wb-zoom, 1)) solid var(--dpk-blue);
555
+ background: var(--dpk-paper-raised);
556
+ }
557
+
558
+ .wb-handle--resize {
559
+ right: calc(-7px / var(--wb-zoom, 1));
560
+ bottom: calc(-7px / var(--wb-zoom, 1));
561
+ border-radius: 3px;
562
+ cursor: nwse-resize;
563
+ }
564
+
565
+ .wb-handle--connect {
566
+ top: 50%;
567
+ right: calc(-22px / var(--wb-zoom, 1));
568
+ width: calc(14px / var(--wb-zoom, 1));
569
+ height: calc(14px / var(--wb-zoom, 1));
570
+ border-radius: 50%;
571
+ transform: translateY(-50%);
572
+ background: var(--dpk-blue);
573
+ cursor: crosshair;
574
+ }
575
+
576
+ /* A selection area being dragged out, in screen space over the board. */
577
+ .wb-marquee {
578
+ position: absolute;
579
+ z-index: 35;
580
+ box-sizing: border-box;
581
+ border: 1px solid var(--dpk-blue);
582
+ border-radius: 2px;
583
+ background: color-mix(in srgb, var(--dpk-blue) 10%, transparent);
584
+ pointer-events: none;
585
+ }
586
+
587
+ /* ------------------------------------------------------------ connectors */
588
+
589
+ .wb-links {
590
+ position: absolute;
591
+ left: 0;
592
+ top: 0;
593
+ overflow: visible;
594
+ pointer-events: none;
595
+ }
596
+
597
+ .wb-links marker path {
598
+ fill: var(--dpk-ink-soft);
599
+ }
600
+
601
+ .wb-link {
602
+ fill: none;
603
+ stroke: var(--dpk-ink-soft);
604
+ stroke-width: 2;
605
+ stroke-linecap: round;
606
+ }
607
+
608
+ .wb-link.is-selected {
609
+ stroke: var(--dpk-blue);
610
+ stroke-width: 3;
611
+ }
612
+
613
+ .wb-link--draft {
614
+ stroke: var(--dpk-blue);
615
+ stroke-dasharray: 6 5;
616
+ }
617
+
618
+ .wb-link-hit {
619
+ fill: none;
620
+ stroke: transparent;
621
+ stroke-width: 14;
622
+ pointer-events: stroke;
623
+ cursor: pointer;
624
+ }
625
+
626
+ .wb-link-label {
627
+ position: absolute;
628
+ transform: translate(-50%, -50%);
629
+ max-width: 180px;
630
+ padding: 2px 8px;
631
+ border: 1px solid var(--dpk-rule);
632
+ border-radius: 999px;
633
+ background: var(--dpk-paper-raised);
634
+ color: var(--dpk-ink-soft);
635
+ font-size: 12px;
636
+ line-height: 1.4;
637
+ white-space: nowrap;
638
+ overflow: hidden;
639
+ text-overflow: ellipsis;
640
+ cursor: pointer;
641
+ }
642
+
643
+ .wb-link-label.is-selected {
644
+ border-color: var(--dpk-blue);
645
+ color: var(--dpk-blue);
646
+ }
647
+
648
+ /* ----------------------------------------------------------------- chrome */
649
+
650
+ .wb-hint {
651
+ position: absolute;
652
+ left: 50%;
653
+ top: 16px;
654
+ z-index: 30;
655
+ transform: translateX(-50%);
656
+ margin: 0;
657
+ padding: 6px 14px;
658
+ border: 1px solid var(--dpk-rule);
659
+ border-radius: 999px;
660
+ background: var(--dpk-glass);
661
+ backdrop-filter: blur(12px);
662
+ color: var(--dpk-ink-soft);
663
+ font-size: 12.5px;
664
+ pointer-events: none;
665
+ }
666
+
667
+ .wb-hint--empty {
668
+ top: 50%;
669
+ transform: translate(-50%, -50%);
670
+ }
671
+
672
+ .wb-tools,
673
+ .wb-zoom,
674
+ .wb-toolbar {
675
+ position: absolute;
676
+ z-index: 40;
677
+ display: flex;
678
+ align-items: center;
679
+ border: 1px solid var(--dpk-rule);
680
+ border-radius: var(--dpk-radius);
681
+ background: var(--dpk-glass);
682
+ backdrop-filter: blur(12px);
683
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
684
+ }
685
+
686
+ .wb-tools {
687
+ left: 12px;
688
+ top: 50%;
689
+ transform: translateY(-50%);
690
+ flex-direction: column;
691
+ gap: 2px;
692
+ padding: 4px;
693
+ }
694
+
695
+ .wb-tool {
696
+ display: grid;
697
+ place-items: center;
698
+ width: 34px;
699
+ height: 34px;
700
+ border: none;
701
+ border-radius: var(--dpk-radius-sm);
702
+ background: transparent;
703
+ cursor: pointer;
704
+ }
705
+
706
+ .wb-tool:hover,
707
+ .wb-tool:focus-visible {
708
+ background: var(--dpk-blue-soft);
709
+ }
710
+
711
+ .wb-tool-icon {
712
+ display: block;
713
+ box-sizing: border-box;
714
+ }
715
+
716
+ .wb-tool-icon--sticky {
717
+ width: 18px;
718
+ height: 18px;
719
+ border-radius: 2px;
720
+ background: #ffe27a;
721
+ box-shadow: 0 1px 2px rgba(30, 24, 10, 0.3);
722
+ }
723
+
724
+ .wb-tool-icon--text::before {
725
+ content: 'T';
726
+ color: var(--dpk-ink);
727
+ font-family: var(--dpk-display);
728
+ font-size: 18px;
729
+ font-weight: 700;
730
+ }
731
+
732
+ .wb-tool-icon--rect,
733
+ .wb-tool-icon--ellipse {
734
+ width: 20px;
735
+ height: 14px;
736
+ border: 2px solid var(--dpk-ink-soft);
737
+ border-radius: 3px;
738
+ }
739
+
740
+ .wb-tool-icon--ellipse {
741
+ border-radius: 50%;
742
+ }
743
+
744
+ .wb-tool-icon--frame {
745
+ width: 20px;
746
+ height: 16px;
747
+ border: 1.5px dashed var(--dpk-ink-soft);
748
+ border-radius: 3px;
749
+ }
750
+
751
+ .wb-zoom {
752
+ right: 12px;
753
+ /* Above the page's hand-off dock while it floats over this corner. */
754
+ bottom: calc(12px + var(--dpk-dock-clearance, 0px));
755
+ overflow: hidden;
756
+ }
757
+
758
+ .wb-zoom button {
759
+ display: inline-flex;
760
+ align-items: center;
761
+ justify-content: center;
762
+ border: none;
763
+ background: transparent;
764
+ padding: 6px 10px;
765
+ font-size: 12px;
766
+ line-height: 1;
767
+ color: var(--dpk-ink-soft);
768
+ cursor: pointer;
769
+ }
770
+
771
+ .wb-zoom button svg {
772
+ width: 13px;
773
+ height: 13px;
774
+ }
775
+
776
+ .wb-zoom button:hover {
777
+ background: var(--dpk-blue-soft);
778
+ color: var(--dpk-blue);
779
+ }
780
+
781
+ .wb-zoom-pct {
782
+ min-width: 48px;
783
+ font-family: var(--dpk-mono);
784
+ }
785
+
786
+ /* The floating toolbar over the selection. */
787
+ /* One row, unless the canvas is narrower than that: then it wraps rather
788
+ than leave its last controls off screen. */
789
+ .wb-toolbar {
790
+ transform: translate(-50%, -100%);
791
+ translate: var(--wb-nudge-x, 0) var(--wb-nudge-y, 0);
792
+ flex-wrap: wrap;
793
+ justify-content: center;
794
+ gap: 2px;
795
+ width: max-content;
796
+ max-width: calc(100% - 16px - var(--wb-toolbar-floor, 0px));
797
+ padding: 4px;
798
+ white-space: nowrap;
799
+ }
800
+
801
+ .wb-toolbar-btn {
802
+ position: relative;
803
+ }
804
+
805
+ .wb-toolbar-count {
806
+ position: absolute;
807
+ top: -4px;
808
+ right: -4px;
809
+ min-width: 14px;
810
+ height: 14px;
811
+ border-radius: 999px;
812
+ background: var(--dpk-accent);
813
+ color: var(--dpk-accent-ink);
814
+ font-family: var(--dpk-mono);
815
+ font-size: 9px;
816
+ line-height: 14px;
817
+ text-align: center;
818
+ }
819
+
820
+ .wb-toolbar-sep {
821
+ width: 1px;
822
+ height: 18px;
823
+ margin: 0 4px;
824
+ background: var(--dpk-rule);
825
+ }
826
+
827
+ .wb-toolbar-label {
828
+ min-width: 120px;
829
+ padding: 0 6px;
830
+ font-size: 12.5px;
831
+ }
832
+
833
+ /* A segmented choice (text size, line shape): a sunken track, the current
834
+ option raised out of it. */
835
+ .wb-choice {
836
+ display: flex;
837
+ align-items: center;
838
+ gap: 2px;
839
+ padding: 2px;
840
+ border-radius: var(--dpk-radius-sm);
841
+ background: var(--dpk-paper-inset);
842
+ }
843
+
844
+ .wb-choice-btn {
845
+ display: grid;
846
+ place-items: center;
847
+ min-width: 28px;
848
+ height: 24px;
849
+ padding: 0 6px;
850
+ border: none;
851
+ border-radius: var(--dpk-radius-xs);
852
+ background: transparent;
853
+ color: var(--dpk-ink-soft);
854
+ font-family: inherit;
855
+ font-size: 11.5px;
856
+ font-weight: 650;
857
+ letter-spacing: 0.02em;
858
+ line-height: 1;
859
+ cursor: pointer;
860
+ transition:
861
+ background 140ms var(--dpk-ease),
862
+ color 140ms var(--dpk-ease),
863
+ box-shadow 140ms var(--dpk-ease);
864
+ }
865
+
866
+ .wb-choice-btn--icon {
867
+ padding: 0;
868
+ }
869
+
870
+ .wb-choice-btn svg {
871
+ display: block;
872
+ width: 16px;
873
+ height: 16px;
874
+ }
875
+
876
+ .wb-choice-btn:hover {
877
+ color: var(--dpk-ink);
878
+ }
879
+
880
+ .wb-choice-btn:focus-visible {
881
+ outline: none;
882
+ box-shadow: var(--dpk-focus);
883
+ }
884
+
885
+ .wb-choice-btn[aria-checked='true'] {
886
+ background: var(--dpk-paper-raised);
887
+ color: var(--dpk-blue-strong);
888
+ box-shadow:
889
+ 0 0 0 0.5px var(--dpk-rule),
890
+ 0 1px 2px rgba(15, 23, 42, 0.12);
891
+ }
892
+
893
+ /* Stacking order: a button that drops a menu of named moves. */
894
+ .wb-menu-anchor {
895
+ position: relative;
896
+ display: flex;
897
+ }
898
+
899
+ .wb-menu-btn {
900
+ display: inline-flex;
901
+ align-items: center;
902
+ gap: 1px;
903
+ height: 26px;
904
+ padding: 0 4px 0 6px;
905
+ border: none;
906
+ border-radius: var(--dpk-radius-xs);
907
+ background: transparent;
908
+ color: var(--dpk-ink-soft);
909
+ cursor: pointer;
910
+ }
911
+
912
+ .wb-menu-btn svg {
913
+ display: block;
914
+ width: 15px;
915
+ height: 15px;
916
+ }
917
+
918
+ .wb-menu-btn svg:last-child {
919
+ width: 11px;
920
+ height: 11px;
921
+ opacity: 0.7;
922
+ }
923
+
924
+ .wb-menu-btn:hover,
925
+ .wb-menu-btn[aria-expanded='true'] {
926
+ background: var(--dpk-paper-inset);
927
+ color: var(--dpk-ink);
928
+ }
929
+
930
+ .wb-menu-btn:focus-visible {
931
+ outline: none;
932
+ box-shadow: var(--dpk-focus);
933
+ }
934
+
935
+ /* Opens toward the toolbar's middle: its button sits near the right end. */
936
+ .wb-menu {
937
+ position: absolute;
938
+ right: 0;
939
+ top: calc(100% + 8px);
940
+ z-index: 1;
941
+ display: flex;
942
+ flex-direction: column;
943
+ min-width: 200px;
944
+ padding: 4px;
945
+ border: 1px solid var(--dpk-rule);
946
+ border-radius: var(--dpk-radius);
947
+ background: var(--dpk-paper-raised);
948
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow);
949
+ }
950
+
951
+ .wb-menu-item {
952
+ display: flex;
953
+ align-items: center;
954
+ gap: 10px;
955
+ padding: 7px 8px;
956
+ border: none;
957
+ border-radius: var(--dpk-radius-xs);
958
+ background: transparent;
959
+ color: var(--dpk-ink);
960
+ font: inherit;
961
+ font-size: 12.5px;
962
+ text-align: left;
963
+ cursor: pointer;
964
+ }
965
+
966
+ .wb-menu-item svg {
967
+ flex: none;
968
+ width: 15px;
969
+ height: 15px;
970
+ color: var(--dpk-ink-soft);
971
+ }
972
+
973
+ .wb-menu-item:hover:not([disabled]),
974
+ .wb-menu-item:focus-visible {
975
+ outline: none;
976
+ background: var(--dpk-blue-soft);
977
+ }
978
+
979
+ .wb-menu-item[disabled] {
980
+ color: var(--dpk-ink-faint);
981
+ cursor: default;
982
+ }
983
+
984
+ .wb-menu-item[disabled] svg {
985
+ opacity: 0.5;
986
+ }
987
+
988
+ .wb-menu-label {
989
+ flex: 1 1 auto;
990
+ }
991
+
992
+ .wb-menu-key {
993
+ color: var(--dpk-ink-faint);
994
+ font-family: var(--dpk-mono);
995
+ font-size: 10.5px;
996
+ }
997
+
998
+ .wb-swatches {
999
+ display: flex;
1000
+ gap: 3px;
1001
+ padding: 0 2px;
1002
+ }
1003
+
1004
+ .wb-swatch {
1005
+ width: 18px;
1006
+ height: 18px;
1007
+ padding: 0;
1008
+ border: 2px solid color-mix(in srgb, var(--wb-stroke) 70%, transparent);
1009
+ border-radius: 50%;
1010
+ background: var(--wb-paper);
1011
+ cursor: pointer;
1012
+ }
1013
+
1014
+ .wb-swatch[aria-checked='true'] {
1015
+ outline: 2px solid var(--dpk-blue);
1016
+ outline-offset: 1px;
1017
+ }
1018
+
1019
+ /* --------------------------------------------------------------- sidebar */
1020
+
1021
+ .wb-frames {
1022
+ display: flex;
1023
+ flex-direction: column;
1024
+ gap: 6px;
1025
+ padding: 14px 12px;
1026
+ }
1027
+
1028
+ .wb-frames p {
1029
+ margin: 0;
1030
+ }
1031
+
1032
+ .wb-frames-hint {
1033
+ color: var(--dpk-ink-faint);
1034
+ font-size: 11.5px;
1035
+ }
1036
+
1037
+ .wb-frames ul {
1038
+ display: flex;
1039
+ flex-direction: column;
1040
+ gap: 2px;
1041
+ margin: 6px 0 0;
1042
+ padding: 0;
1043
+ list-style: none;
1044
+ }
1045
+
1046
+ .wb-frame-link {
1047
+ display: flex;
1048
+ align-items: center;
1049
+ gap: 8px;
1050
+ width: 100%;
1051
+ padding: 6px 8px;
1052
+ border: none;
1053
+ border-radius: var(--dpk-radius-sm);
1054
+ background: transparent;
1055
+ color: var(--dpk-ink);
1056
+ font: inherit;
1057
+ font-size: 13px;
1058
+ text-align: left;
1059
+ cursor: pointer;
1060
+ }
1061
+
1062
+ .wb-frame-link:hover {
1063
+ background: var(--dpk-blue-soft);
1064
+ }
1065
+
1066
+ .wb-frame-link[aria-current='true'] {
1067
+ background: color-mix(in srgb, var(--dpk-blue-soft) 80%, transparent);
1068
+ color: var(--dpk-blue-strong);
1069
+ font-weight: 650;
1070
+ }
1071
+
1072
+ .wb-frame-dot {
1073
+ flex: none;
1074
+ width: 10px;
1075
+ height: 10px;
1076
+ border-radius: 3px;
1077
+ background: var(--wb-stroke);
1078
+ }
1079
+
1080
+ .wb-frame-dot--board {
1081
+ border: 1.5px dashed var(--dpk-ink-faint);
1082
+ background: transparent;
1083
+ }
1084
+
1085
+ .wb-frame-name {
1086
+ flex: 1 1 auto;
1087
+ min-width: 0;
1088
+ overflow: hidden;
1089
+ text-overflow: ellipsis;
1090
+ white-space: nowrap;
1091
+ }
1092
+
1093
+ .wb-frame-count {
1094
+ flex: none;
1095
+ color: var(--dpk-ink-faint);
1096
+ font-family: var(--dpk-mono);
1097
+ font-size: 10.5px;
1098
+ }
1099
+ `,An={width:300,height:260},Dt=t=>t.stopPropagation(),Dn=10,Pt=8,Ft=72,Pn=t=>t!==void 0;class Bt extends Ke{static{this.styles=[Ke.styles,Nn,no]}static{this.properties={mode:{state:!0},viewport:{state:!0},gesture:{state:!0},panReady:{state:!0},arrangeMenu:{state:!0}}}#b="";#f=!1;#r;#E=!1;#l;#h;#m;#w;#s={on:"other"};#x=!1;#p=!1;#M;#P=new co(this);constructor(){super(),this.mode=v,this.viewport=rn,this.gesture=void 0,this.panReady=!1,this.arrangeMenu=!1}definitionFor(e){return ft(e)}renderRegions(e){const o=pe(this.locale),n=e.state.items.some(d=>d.kind==="frame"),i=Et(e.state,this.gesture),r=vt(this.gesture),s=r!==void 0&&this.gesture!==void 0?$t(e.state,this.gesture):ue(e.navigation.item);return{...n?{sidebar:Mn({m:o,state:e.state,focused:e.navigation.frame,focusFrame:d=>this.#se(d),showBoard:()=>this.#S()})}:{sidebarHidden:!0},main:xn({m:o,context:e,state:i,viewport:this.viewport,gesture:this.gesture,mode:this.mode,selectedIds:new Set(s),marquee:r,panReady:this.panReady,overlay:this.#B(e,i,o),handlers:{canvasPointerDown:d=>this.#X(d),canvasPointerMove:d=>this.#Y(d),canvasPointerUp:d=>this.#j(d),canvasPointerCancel:()=>this.gesture=void 0,canvasWheel:d=>this.#J(d),canvasDblClick:d=>this.#Q(d),canvasKeyDown:d=>this.#ee(d),canvasKeyUp:d=>{d.key===" "&&(this.panReady=!1),d.key==="Shift"&&this.#C(!1)},canvasBlur:()=>this.panReady=!1,itemPointerDown:(d,a)=>this.#G(d,a),resizePointerDown:(d,a)=>this.#I(a,Jo(e.state,d,a.pointerId,this.#o(a))),connectPointerDown:(d,a)=>this.#I(a,on(d,a.pointerId,this.#o(a))),connectorPointerDown:(d,a)=>this.#V(d,a),editBlur:(d,a)=>this.#L(d,a),editKeyDown:(d,a)=>this.#U(d,a),addItem:d=>this.#A(d,this.#Z()),zoomStep:d=>this.#v(d===1?1.2:1/1.2),zoomFit:()=>this.#S(),zoomReset:()=>this.#v(1/this.viewport.zoom)}})}}updated(){super.updated();const e=this.#d();e!==null&&(this.#ie(e),this.#D(),this.#F(),this.#K(),this.#W())}#F(){const e=this.#d(),o=this.renderRoot.querySelector(".wb-toolbar");if(e===null||o===null)return;const n=w=>Number.parseFloat(o.style.getPropertyValue(`--wb-nudge-${w}`))||0,i=e.getBoundingClientRect(),r=o.getBoundingClientRect(),s=this.renderRoot.querySelector(".wb-tools")?.getBoundingClientRect(),d=r.top-n("y"),c=s!==void 0&&d<s.bottom&&d+r.height>s.top?s.right-i.left:0;o.style.setProperty("--wb-toolbar-floor",`${c}px`);const l=o.getBoundingClientRect(),m=Lt(l.left-n("x")-i.left,l.width,i.width,Pt,c),u=Lt(l.top-n("y")-i.top,l.height,i.height,Pt);o.style.setProperty("--wb-nudge-x",`${m}px`),o.style.setProperty("--wb-nudge-y",`${u}px`)}#t(){return ue(this.context().navigation.item)}#e(e){const o=this.context(),n=rt(e);o.navigation.item!==n&&(this.arrangeMenu=!1,o.navigate({item:n??null}))}#y(e){return this.#t().map(o=>p(e,o)).filter(Pn)}#B(e,o,n){if(this.mode.kind==="editing")return b;const i=this.#t(),r=this.#y(o),s=i.length===1?k(o,i[0]):void 0,d=s!==void 0?{kind:"connector",connector:s}:r.length>0?{kind:"items",items:r}:void 0;if(d===void 0)return b;const[a]=r,c=s!==void 0?I({type:"connector",id:s.id}):r.length===1&&a!==void 0?I({type:"item",id:a.id}):void 0,l=c!==void 0&&this.mode.kind==="commenting"&&this.mode.target===c,m=Ln({m:n,state:o,viewport:this.viewport,selection:d,arrange:Uo(o,i),arrangeMenuOpen:this.arrangeMenu,commenting:l,comments:c===void 0?0:e.commentCount(c),handlers:{setColor:u=>this.#te(u),setFontSize:u=>this.#oe(u),arrange:u=>{this.arrangeMenu=!1,this.#R(u)},toggleArrangeMenu:()=>this.arrangeMenu=!this.arrangeMenu,toggleComment:u=>{this.#b="",this.mode=l?v:{kind:"commenting",target:u}},deleteSelection:()=>this.#N(),setLabel:(u,w)=>e.dispatch(y.setConnectorLabel(u,w)),setRoute:(u,w)=>{k(e.state,u)?.route!==w&&e.dispatch(y.setConnectorRoute(u,w))}}});return h`${m}
1100
+ <div class="wb-composer" @pointerdown=${Dt} @dblclick=${Dt}>
1101
+ ${l&&c!==void 0?this.#H(e,c):b}
1102
+ </div>`}#H(e,o){const n=e.comments.filter(r=>I(r.target)===o).map(io),i=this.definition.commentTargets(e.state,e.navigation).find(r=>r.value===o)?.label;return ro(ao(this.locale),so(this.#b,n,{key:o,...i===void 0?{}:{label:i}}),r=>{if(r.kind==="input"){this.#b=r.body,this.requestUpdate();return}r.kind==="comment"&&!e.dispatch({type:"comment",target:o,payload:{body:r.body}}).ok||(this.#b="",this.mode=v)})}#W(){if(this.mode.kind!=="commenting")return;const e=this.renderRoot.querySelector(".wb-composer .comment-pop"),o=this.renderRoot.querySelector('.wb-toolbar [data-role="comment"]');!e||!o||e.matches(":popover-open")||(this.#P.open(e,o,An),e.querySelector("textarea")?.focus())}#_(e){return this.renderRoot.querySelector(`.wb-item[data-item-id="${CSS.escape(e)}"] .wb-editor`)}#T(e,o){if(J(this.mode,e))return;this.#a();const n=this.context();if(p(n.state,e)===void 0)return;const i=o===void 0?null:this.renderRoot.querySelector(`.wb-item[data-item-id="${CSS.escape(e)}"] .wb-text`);this.#w=i===null||o===void 0?void 0:Zo(i,o.clientX,o.clientY);const r=this.#t();(r.length!==1||r[0]!==e)&&this.#e([e]),this.mode={kind:"editing",itemId:e}}#K(){if(this.mode.kind!=="editing"){this.#m=void 0;return}const{itemId:e}=this.mode;if(this.#m===e)return;const o=this.#_(e);if(o===null)return;this.#m=e,o.focus({preventScroll:!0});const n=Math.min(this.#w??o.value.length,o.value.length);o.setSelectionRange(n,n),this.#w=void 0}#L(e,o){if(!J(this.mode,e))return;this.mode=v,this.#m=void 0;const n=this.context(),i=p(n.state,e),r=i===void 0?void 0:jo(i,o);i===void 0||r===void 0||this.#u([y.setText(e,r),...this.#O(i)])}#O(e,o){if(!X(e))return[];const n=Eo(e,this.#q(e.id,o));return n===void 0?[]:[y.resize(e.id,n.w,n.h)]}#q(e,o){const n=this.renderRoot.querySelector(`.wb-item[data-item-id="${CSS.escape(e)}"]`),i=n?.querySelector(".wb-item-body");if(n==null||i===null||i===void 0)return 0;const r=n.getAttribute("style")??"";o!==void 0&&n.style.setProperty("--wb-font-scale",String(Ct[o]));const s=i.querySelector(".wb-editor"),a=(s===null?i.querySelector(".wb-text")?.offsetHeight??0:s.scrollHeight)-i.clientHeight;return n.setAttribute("style",r),a}#a(){if(this.mode.kind!=="editing")return;const{itemId:e}=this.mode,o=this.#_(e);if(o===null){this.mode=v;return}this.#L(e,o.value)}#U(e,o){if(o.isComposing)return;if(o.key==="Escape"){o.preventDefault(),this.mode=v,this.#c();return}const n=p(this.context().state,e)?.kind==="frame";o.key==="Enter"&&(n||o.metaKey||o.ctrlKey)&&(o.preventDefault(),this.#c())}#d(){return this.renderRoot.querySelector(".wb-canvas")}#n(){const e=this.#d();return{width:e?.clientWidth??0,height:e?.clientHeight??0}}#k(e){const o=this.#d()?.getBoundingClientRect();return o===void 0?{x:e.clientX,y:e.clientY}:{x:e.clientX-o.left,y:e.clientY-o.top}}#o(e){return Ie(this.viewport,this.#k(e))}#Z(){const{width:e,height:o}=this.#n();return Ie(this.viewport,{x:e/2,y:o/2})}#g(e,o){if(o===void 0)return;const n=this.#d();if(n!==null&&typeof n.setPointerCapture=="function")try{n.setPointerCapture(e.pointerId)}catch{}this.gesture=o}#c(){this.#d()?.focus({preventScroll:!0})}#X(e){if(this.gesture!==void 0)return;const o=e.button===1||e.button===0&&(this.panReady||e.pointerType==="touch");if(!o&&e.button!==0)return;if(this.#a(),this.mode.kind==="commenting"&&(this.mode=v),this.arrangeMenu=!1,this.#c(),o){e.preventDefault(),this.#s={on:"other"},this.#g(e,Qo(e.pointerId,this.#k(e)));return}this.#s={on:"ground"};const n=this.context(),i=this.#t().filter(s=>p(n.state,s)!==void 0),r=e.shiftKey?gt(e.pointerId,this.#o(e),i):tn(n.state,i,e.pointerId,this.#o(e),[]);this.#x=!1,this.#p=r.kind==="move"&&i.length>1,this.#g(e,r)}#G(e,o){if(o.button!==0||this.panReady||this.gesture!==void 0)return;if(o.stopPropagation(),this.#s={on:"item",itemId:e},J(this.mode,e)){o.target instanceof Element&&o.target.closest(".wb-editor")!==null||o.preventDefault();return}this.#a(),o.preventDefault(),this.#c(),this.arrangeMenu=!1,this.mode.kind!=="idle"&&(this.mode=v);const n=this.context(),i=this.#t();if(o.shiftKey){this.#x=!1,this.#p=!1,this.#e(st(i,e));return}this.#x=i.length===1&&i[0]===e,this.#p=i.length>1&&i.includes(e),this.#M={clientX:o.clientX,clientY:o.clientY},i.includes(e)||this.#e([e]);const r=this.#p?i:[e];this.#g(o,Le(n.state,e,o.pointerId,this.#o(o),r))}#I(e,o){e.button===0&&(e.stopPropagation(),e.preventDefault(),this.#s={on:"other"},this.#a(),this.#c(),this.#g(e,o))}#V(e,o){o.button!==0||this.panReady||(o.stopPropagation(),o.preventDefault(),this.#s={on:"other"},this.#a(),this.#c(),this.mode=v,this.#e([e]))}#Y(e){const o=this.gesture;if(!(o===void 0||o.pointerId!==e.pointerId)){if(o.kind==="pan"){const n=en(o,this.#k(e));this.gesture=n.gesture,this.#i(fe(this.viewport,n.dx,n.dy));return}this.gesture=Oe(this.context().state,o,e.pointerId,this.#o(e),this.viewport.zoom,e.shiftKey)}}#C(e){const o=this.gesture;o?.kind!=="resize"||o.keepRatio===e||(this.gesture=Oe(this.context().state,o,o.pointerId,o.current,this.viewport.zoom,e))}#j(e){const o=this.gesture;if(o===void 0||o.pointerId!==e.pointerId)return;const n=this.context(),i=o.kind==="pan"?o:Oe(n.state,o,e.pointerId,this.#o(e),this.viewport.zoom,e.shiftKey);this.gesture=void 0;const r=zt(n.state,i);switch(r.kind){case"none":return;case"dispatch":n.dispatchBatch(r.inputs);return;case"connect":this.#ne(n,r.from,r.to);return;case"select":this.#e(r.ids);return;case"click":if(i.kind==="pan"||i.kind==="marquee"){this.mode=v;const s=i.kind==="marquee"?i.base:[];r.itemId!==void 0?this.#e(s.length>0?st(s,r.itemId):[r.itemId]):s.length===0&&this.#e([]);return}if(i.kind!=="move"||r.itemId===void 0)return;this.#x?this.#T(r.itemId,this.#M):this.#p&&this.#e([r.itemId]);return}}#J(e){e.preventDefault(),e.ctrlKey||e.metaKey?this.#i(Re(this.viewport,this.#k(e),Math.exp(-e.deltaY*.01))):this.#i(fe(this.viewport,-e.deltaX,-e.deltaY))}#Q(e){const o=this.#s;o.on==="item"?this.#T(o.itemId,e):o.on==="ground"&&this.#A("sticky",this.#o(e))}#ee(e){if(e.key==="Shift"&&this.#C(!0),e.target!==e.currentTarget)return;const o=this.context(),n=this.#t(),i=this.#y(o.state),[r]=i,s=e.metaKey||e.ctrlKey,a={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(e.key===" ")this.panReady=!0;else if(e.key==="Escape")this.mode.kind!=="idle"?this.mode=v:n.length>0&&this.#e([]);else if((e.key==="Delete"||e.key==="Backspace")&&n.length>0)this.#N();else if(e.key==="Enter"&&i.length===1&&r!==void 0)this.#T(r.id);else if(s&&e.key.toLowerCase()==="a")this.#e(o.state.items.map(c=>c.id));else if((e.key==="]"||e.key==="[")&&n.length>0){const c=e.key==="]";this.#R(s?c?"front":"back":c?"forward":"backward")}else if(a!==void 0){const c=e.shiftKey?1:Dn;i.length>0?o.dispatchBatch(nn(o.state,i.map(l=>l.id),a[0]*c,a[1]*c)):this.#i(fe(this.viewport,-a[0]*40,-a[1]*40))}else if(e.key==="+"||e.key==="=")this.#v(1.2);else if(e.key==="-")this.#v(1/1.2);else if(e.key==="0")this.#S();else return;e.preventDefault()}#u(e){e.length>0&&this.context().dispatchBatch(e)}#te(e){const o=this.#y(this.context().state);this.#u(o.filter($e).flatMap(n=>n.color===e?[]:[y.setColor(n.id,e)]))}#oe(e){const o=this.#y(this.context().state);this.#u(o.filter(X).flatMap(n=>n.fontSize===e?[]:[y.setFontSize(n.id,e),...this.#O(n,e)]))}#R(e){this.#u(qo(this.context().state,this.#t(),e))}#N(){const{state:e}=this.context(),o=this.#t();this.#u([...o.filter(n=>k(e,n)!==void 0).map(n=>y.deleteConnector(n)),...o.filter(n=>p(e,n)!==void 0).map(n=>y.deleteItem(n))]),this.mode=v}#A(e,o){this.#a();const n=this.context(),i=Vo(n.state,pe(this.locale),e,o);if(!n.dispatch(y.addItem(i)).ok)return;const r=this.#n();r.width>0&&r.height>0&&this.#i(dn(this.viewport,i,r)),this.#e([i.id]),this.#w=void 0,this.mode={kind:"editing",itemId:i.id}}#ne(e,o,n){if(o===n)return;const i=e.state.connectors.find(s=>s.from===o&&s.to===n);if(i!==void 0){this.#e([i.id]);return}const r=Yo(e.state,o,n);e.dispatch(y.connect(r,o,n)).ok&&this.#e([r])}#i(e){this.#E=!1;const o=_t(e,V(this.context().state.items),this.#n());cn(o,this.viewport)||(this.viewport=o)}#v(e){const{width:o,height:n}=this.#n();this.#i(Re(this.viewport,{x:o/2,y:n/2},e))}#$(e){const o=this.#n();return e===null||o.width<=0||o.height<=0?!1:(this.#i(Mt(e,o,Ft)),this.#E=!0,!0)}#z(){return an(this.context().state.items,this.#n(),Ft)}#ie(e){this.#h===e||typeof ResizeObserver>"u"||(this.#l??=new ResizeObserver(()=>this.#re()),this.#h&&this.#l.unobserve(this.#h),this.#l.observe(e),this.#h=e)}#re(){if(!this.#f){this.#D();return}if(!this.#E)return;const e=this.#r;this.#$(e===void 0?this.#z():p(this.context().state,e)??null)}disconnectedCallback(){super.disconnectedCallback(),this.#l?.disconnect(),this.#l=void 0,this.#h=void 0}#se(e){const o=this.context();o.navigate({frame:e}),this.#r=e,this.#$(p(o.state,e)??null)}#S(){const e=this.context();e.navigation.frame!==void 0&&e.navigate({frame:null}),this.#r=void 0,this.#$(this.#z())}#D(){const e=this.context(),o=e.navigation.frame;if(this.#f&&o===this.#r)return;if(o===void 0&&this.#f){this.#r=void 0;return}const n=o===void 0?this.#z():p(e.state,o)??null,i=this.#n();i.width<=0||i.height<=0||(n===null?this.viewport={x:i.width/2,y:i.height/2,zoom:1}:this.#$(n),this.#f=!0,this.#r=o)}}const Ht=()=>{customElements.get("dpk-template-whiteboard")||customElements.define("dpk-template-whiteboard",Bt)},Fn=Object.freeze(Object.defineProperty({__proto__:null,BOARD_TARGET:Te,DpkTemplateWhiteboard:Bt,WB_COLORS:ie,WB_CONNECTOR_ROUTES:U,WB_FONT_SIZES:re,WB_ITEM_KINDS:fo,WB_SHAPES:Ue,ZOOM_MAX:St,ZOOM_MIN:j,applyWhiteboardAction:tt,boardBounds:V,connectorGeometry:nt,connectorPath:le,constrainViewport:_t,defineWhiteboardElement:Ht,describeWhiteboardAction:dt,emptyWhiteboardBase:je,findConnector:k,findItem:p,fitRect:Mt,frameMembers:Ee,frameOf:D,itemAt:Me,outlinePoint:Y,panBy:fe,parseWhiteboardBase:Ye,resolveWhiteboardNavigation:ut,serializeWhiteboardAction:ct,whiteboardAction:y,whiteboardActions:ce,whiteboardBaseSchema:Ve,whiteboardCommentTargets:ht,whiteboardCurrentTarget:pt,whiteboardDefinitionFor:ft,whiteboardHasTarget:bt,whiteboardMessages:pe,whiteboardTargetLabel:lt,whiteboardTitle:_e,zoomAt:Re},Symbol.toStringTag,{value:"Module"}));export{Ht as d,Fn as i};