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