dev-process-kit 0.3.0-beta.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/boards.js +1 -1
- package/dist/chunks/{shared-naTB_LaU.js → shared-BFraiskj.js} +1 -1
- package/dist/chunks/{shared-BhUEVKpO.js → shared-BYbcHniE.js} +1 -1
- package/dist/chunks/{shared-BzKZc8e7.js → shared-B_Tiv_T3.js} +1 -1
- package/dist/chunks/{shared-D9js0mlL.js → shared-BfByEotW.js} +1 -1
- package/dist/chunks/{shared-D6X_HEJN.js → shared-Bs2YYFvO.js} +1 -1
- package/dist/chunks/shared-DMksNmni.js +1 -0
- package/dist/chunks/{shared-CO-HhC8m.js → shared-DNsl9DK1.js} +1 -1
- package/dist/chunks/{shared-CXefnQqJ.js → shared-DYDJzB79.js} +1 -1
- package/dist/chunks/{shared-DXPlz1s4.js → shared-DegJ_tfw.js} +1 -1
- package/dist/chunks/{shared-BLzPmv14.js → shared-DqlTHpRQ.js} +1 -1
- package/dist/chunks/{shared-CJnwvCXE.js → shared-FMBoDqPg.js} +1 -1
- package/dist/chunks/{shared-BYr9ZouD.js → shared-Ln6ei2B2.js} +1 -1
- package/dist/chunks/shared-RvLH2Fqp.js +1598 -0
- package/dist/chunks/{shared-NkccEMPc.js → shared-TtB-p2Zh.js} +1 -1
- package/dist/chunks/{shared-BYcLqnFV.js → shared-WtWbdwp_.js} +1 -1
- package/dist/chunks/{shared-DEco37gW.js → shared-epAjO2d1.js} +1 -1
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/views/delegation-poker.js +1 -1
- package/dist/views/plain.js +1 -1
- package/dist/views/prototype.js +1 -1
- package/dist/views/slides.js +1 -1
- package/dist/views/task-board.js +1 -1
- package/dist/views/usm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-Bt5HGgX9.js +0 -1636
- package/dist/chunks/shared-DIHtcDps.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a4 as wd,S as qn,a5 as ce,a6 as $d,a7 as Ed,a8 as Oe,a9 as O,aa as F,ab as pe,ac as y,ad as le,ae as Td,af as Sd,X as Md,j as ri,ag as ai,ah as ae,ai as M,aj as Y,ak as di,al as li,am as Id,an as Cd,D as Ld,ao as _d,U as Rd,ap as Fn,aq as Ad,ar as ci,as as v,C as Od,at as Nd,au as he,av as P,aw as C,ax as I,ay as _,az as X,aA as Ge,aB as ft,aC as Bn,aD as Dd,aE as pi,aF as hi,aG as zd,aH as Te,aI as ui,B as mi,aJ as Pd,G as gi,H as Un,I as Ft,aK as qd,aL as W,aM as oe,aN as Ze,p as z,t as Se,aO as ue,aP as Hn,z as Yn,aQ as bt,aR as Fd,N as Bt,e as Xn,P as B,aS as Ut,aT as Bd,l as xe,aU as Ht,aV as fi,aW as bi,aX as Ud,aY as xi,aZ as Hd,a_ as yi,a$ as Yt,b0 as Me,b1 as Yd,b2 as Xd,b3 as Gd}from"./shared-CXefnQqJ.js";import{Q as Kd,A as jd,H as Wd,R as Vd,S as Qd,T as ye,U as Ie,V as vi,W as Zd,X as ve,Y as Jd,Z as Gn,_ as ki,$ as el}from"./shared-BhUEVKpO.js";import{o as tl}from"./shared-D4PPk0Dk.js";import{E as nl,t as Ce,u as ol,v as Ne,B as Xt,w as Gt,x as il}from"./shared-DEco37gW.js";import{a as sl,c as rl}from"./shared-NkccEMPc.js";import{o as Kt}from"./shared-DIHtcDps.js";const al=[["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"}]],dl=[["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"}]],ll=[["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"}]],cl=[["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"}]],pl=[["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 hl(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}function wi(t){if(t.length===0)return NaN;const e=t.slice().sort((o,i)=>o-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}const $i={},Ei=t=>{const e={kind:"board",name:t.name,label:t.label,addable:t.addable??!1,parseBase:()=>$i,emptyBase:()=>$i,actions:{},apply:()=>null,hasTarget:()=>!1,describe:i=>({title:i.type,targetLabel:qn(i.target),tone:"meta"}),serialize:i=>`${i.type} ${qn(i.target)} ${JSON.stringify(i.payload)}`,resolveNavigation:()=>({}),commentTargets:()=>[],title:()=>t.label},n=t.commentTargets?.()??[],o=new Map((t.elementActionResults?.()??[]).map(i=>[i.id,i]));return wd(e,n,o)},xt={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6,groupSpacing:34,superGroupSpacing:34,superGroupRowGap:0,superGroupColumnGap:0,superGroupRowCount:0},yt=t=>{const e=[...t].sort((o,i)=>o-i);if(e.length===0)return 0;const n=Math.floor(e.length/2);return e.length%2===1?e[n]??0:((e[n-1]??0)+(e[n]??0))/2},Kn=(t,e)=>{const n=new Map;for(const r of t)n.set(r.id,[]);for(const r of e)n.get(r.from)?.push(r);const o=new Map,i=new Set,s=r=>{o.set(r,"open");for(const a of n.get(r)??[]){const d=o.get(a.to)??"new";d==="open"?i.add(a.id):d==="new"&&s(a.to)}o.set(r,"done")};for(const r of t)(o.get(r.id)??"new")==="new"&&s(r.id);return{reversed:i,forward:e.filter(r=>!i.has(r.id))}},Ti=(t,e)=>{const n=new Map,o=new Map;for(const a of t)n.set(a.id,[]),o.set(a.id,[]);for(const a of e)o.get(a.from)?.push(a),n.get(a.to)?.push(a);const i=new Map(t.map(a=>[a.id,0])),s=new Map(t.map(a=>[a.id,(n.get(a.id)??[]).length])),r=t.filter(a=>(s.get(a.id)??0)===0).map(a=>a.id);for(const a of r)for(const d of o.get(a)??[]){const l=i.get(d.to)??0;i.set(d.to,Math.max(l,(i.get(a)??0)+1));const c=(s.get(d.to)??0)-1;s.set(d.to,c),c===0&&r.push(d.to)}return i},Si=(t,e,n,o)=>{const i=[...t.keys()].sort((s,r)=>s-r);for(let s=0;s<o;s++){const r=s%2===0;for(const a of r?i:[...i].reverse()){const d=t.get(a)??[],l=new Map(d.map((p,u)=>[p,u])),c=p=>{const u=l.get(p);return u===void 0?null:u},h=d.map(p=>{const u=(e.get(p)??[]).filter(g=>(n.get(g)??a)===a+(r?-1:1)).map(c).filter(g=>g!==null);return{id:p,want:u.length>0?yt(u):l.get(p)??0}});h.sort((p,u)=>p.want-u.want||(l.get(p.id)??0)-(l.get(u.id)??0)),t.set(a,h.map(p=>p.id))}}},Mi=(t,e,n,o)=>{const i=t.map((r,a)=>({id:r,want:n.get(r)??a*100,index:a}));i.sort((r,a)=>r.want-a.want||r.index-a.index);let s=0;for(const r of i){const a=e.get(r.id);a&&(a.y=s,s+=a.spec.height+o)}return{height:Math.max(0,s-o)}},ul=(t,e,n,o,i)=>{const s=[...t.keys()].sort((l,c)=>l-c),r=new Map;for(const l of s)r.set(l,Mi(t.get(l)??[],e,new Map,i.nodeSpacing).height);const a=Math.max(0,...r.values());for(const l of s){const c=(a-(r.get(l)??0))/2;for(const h of t.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const d=(l,c)=>{const h=(n.get(l)??[]).filter(p=>o.get(p)===c).flatMap(p=>{const u=e.get(p);return u?[u.y+u.spec.height/2]:[]});return h.length>0?yt(h):null};for(let l=0;l<i.coordinatePasses;l++){const c=l%2===0;for(const h of c?s:[...s].reverse()){const p=t.get(h)??[],u=new Map;for(const m of p){const x=d(m,h+(c?-1:1)),k=e.get(m);k!==void 0&&u.set(m,x===null?k.y+k.spec.height/2:x)}const g=p.map(m=>e.get(m)?.y??0);Mi(p,e,u,i.nodeSpacing);const b=p.map(m=>e.get(m)?.y??0),f=yt(g)-yt(b);for(const m of p){const x=e.get(m);x&&(x.y+=f)}}}},Ii=(t,e,n,o,i,s,r)=>{for(const a of i){const d=t.filter(h=>o.get(h)===a);if(d.length===0)continue;const l=d.map((h,p)=>({id:h,want:n.get(h)??p,index:p})).sort((h,p)=>h.want-p.want||h.index-p.index);let c=s.get(a)??0;for(const h of l){const p=e.get(h.id);p&&(p.y=c,c+=p.spec.height+r)}}},ml=(t,e,n,o,i)=>{let s=0;for(const r of t.values()){const a=r.filter(l=>n.get(l)===o);if(a.length===0)continue;const d=a.reduce((l,c)=>l+(e.get(c)?.spec.height??0),0)+i*(a.length-1);d>s&&(s=d)}return s},gl=(t,e,n,o,i,s,r)=>{const a=new Map(t.map(T=>[T.id,T.group??T.id])),d=new Set(t.flatMap(T=>T.group===void 0?[]:[T.group])),l=t.some(T=>T.superGroup!==void 0),c=new Map;for(const T of t){const E=a.get(T.id)??T.id;T.superGroup!==void 0&&!c.has(E)&&c.set(E,T.superGroup)}const h=T=>c.get(T)??T,p=[...e.keys()].sort((T,E)=>T-E),u=T=>{const E=i.get(T)??0,R=(e.get(E)??[]).length,A=s.get(T)??0;return R<=1?0:A/(R-1)},g=[...new Set(a.values())],b=T=>{const E=t.filter(R=>(a.get(R.id)??R.id)===T).map(R=>R.id);return E.length===0?0:E.reduce((R,A)=>R+u(A),0)/E.length},f=[...new Set(g.map(h))],m=T=>{const E=t.filter(R=>h(a.get(R.id)??R.id)===T).map(R=>R.id);return E.length===0?0:E.reduce((R,A)=>R+u(A),0)/E.length},k=f.sort((T,E)=>m(T)-m(E)).flatMap(T=>g.filter(E=>h(E)===T).sort((E,R)=>b(E)-b(R))),w=new Map(k.map(T=>[T,ml(e,n,a,T,r.nodeSpacing)])),$=new Map;let L=0;for(const[T,E]of k.entries()){$.set(E,L),L+=w.get(E)??0;const R=k[T+1];if(R!==void 0){const A=l&&h(E)!==h(R);L+=A?r.superGroupSpacing:d.has(E)||d.has(R)?r.groupSpacing:r.nodeSpacing}}for(const T of p){const E=e.get(T)??[];Ii(E,n,new Map(E.map(R=>[R,s.get(R)??0])),a,k,$,r.nodeSpacing)}const S=(T,E)=>{const R=(o.get(T)??[]).filter(A=>i.get(A)===E).flatMap(A=>{const N=n.get(A);return N?[N.y+N.spec.height/2]:[]});return R.length>0?yt(R):null};for(let T=0;T<r.coordinatePasses;T++){const E=T%2===0;for(const R of E?p:[...p].reverse()){const A=e.get(R)??[],N=new Map;for(const U of A){const H=S(U,R+(E?-1:1)),q=n.get(U);q!==void 0&&N.set(U,H===null?q.y+q.spec.height/2:H)}Ii(A,n,N,a,k,$,r.nodeSpacing)}}},Ci=(t,e,n)=>{const o=e===void 0?void 0:t.spec.ports?.[e];return o?{x:t.x+o.x,y:t.y+o.y}:n==="out"?{x:t.x+t.spec.width,y:t.y+t.spec.height/2}:{x:t.x,y:t.y+t.spec.height/2}},jt=(t,e,n)=>{let o=0;const i=[];for(const s of t){const r=n.byId.get(s.from),a=n.byId.get(s.to);if(!r||!a)continue;const d=Ci(r,s.fromPort,"out"),l=Ci(a,s.toPort,"in");if(s.from===s.to){const g=r.x+r.spec.width,b=r.y+r.spec.height,f=Math.max(n.padding/2,b+18);i.push({id:s.id,points:[d,{x:g+20,y:d.y},{x:g+20,y:f},{x:r.x-20,y:f},{x:r.x-20,y:l.y},l]});continue}if(!e.has(s.id)&&(r.layer<a.layer||r.layer===a.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){i.push({id:s.id,points:[d,l]});continue}const b=r.layer<a.layer?Math.max(d.x+14,a.x-Math.max(12,n.layerSpacing/2)):(d.x+l.x)/2;i.push({id:s.id,points:[d,{x:b,y:d.y},{x:b,y:l.y},l]});continue}const c=s.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:d,h=s.toPort===void 0?{x:a.x+a.spec.width/2,y:a.y+a.spec.height}:l,p=Math.max(c.y,h.y)+18+o*14;o+=1;const u=[d,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((g,b,f)=>b===0||g.x!==f[b-1]?.x||g.y!==f[b-1]?.y);i.push({id:s.id,points:u})}return i},jn=(t,e,n)=>{const o=e.flatMap(p=>[...p.points]),i=[...t.map(p=>p.x),...t.map(p=>p.x+p.spec.width),...o.map(p=>p.x)],s=[...t.map(p=>p.y),...t.map(p=>p.y+p.spec.height),...o.map(p=>p.y)],r=Math.min(0,...i),a=Math.min(0,...s),d=Math.max(0,...i),l=Math.max(0,...s),c=n-r,h=n-a;return{width:d-r+n*2,height:l-a+n*2,nodes:t.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+h,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(u=>({x:u.x+c,y:u.y+h}))}))}},Wt=(t,e)=>{const n=new Map(t.map(o=>[o.id,[]]));for(const o of e)o.from!==o.to&&(n.get(o.from)?.push(o.to),n.get(o.to)?.push(o.from));return n},Li=(t,e,n,o)=>t.map(i=>({spec:i,layer:e.get(i.id)??0,order:n.get(i.id)??0,...o(i)})),_i=(t,e)=>{const n=new Map;for(const o of t){const i=e.get(o.id)??0,s=n.get(i);s?s.push(o.id):n.set(i,[o.id])}return n},Ri=(t,e,n={})=>{if(t.some(b=>b.superGroup!==void 0))return Il(t,e,n);const o={...xt,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const i=new Set(t.map(b=>b.id)),s=e.filter(b=>i.has(b.from)&&i.has(b.to)),{forward:r,reversed:a}=Kn(t,s),d=Ti(t,r),l=_i(t,d);Si(l,Wt(t,s),d,o.sweeps);const c=new Map;for(const b of l.values())b.forEach((f,m)=>c.set(f,m));const h=Li(t,d,c,()=>({x:0,y:0})),p=new Map(h.map(b=>[b.spec.id,b]));t.some(b=>b.group!==void 0||b.superGroup!==void 0)?gl(t,l,p,Wt(t,s),d,c,o):ul(l,p,Wt(t,s),d,o);const u=[...l.keys()].sort((b,f)=>b-f);let g=0;for(const b of u){const f=Math.max(...(l.get(b)??[]).map(m=>p.get(m)?.spec.width??0));for(const m of l.get(b)??[]){const x=p.get(m);x&&(x.x=g)}g+=f+o.layerSpacing}return jn(h,jt(s,a,{byId:p,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},Je=12,Ai=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),Oi=(t,e)=>{const n=Ai(t),o=Ai(e),i=o.x-n.x,s=o.y-n.y;return Math.abs(i)>=Math.abs(s)?i>=0?"right":"left":s>=0?"bottom":"top"},Ni=(t,e,n)=>Math.min(n,Math.max(e,t)),Di=(t,e,n)=>{const o=Ni(n.y-t.y,Je,Math.max(Je,t.height-Je)),i=t.height<=0?.5:o/t.height,s=t.x+Ni(i*t.width,Je,Math.max(Je,t.width-Je));switch(e){case"left":return{x:t.x,y:t.y+o};case"right":return{x:t.x+t.width,y:t.y+o};case"top":return{x:s,y:t.y};case"bottom":return{x:s,y:t.y+t.height};default:return{x:t.x+t.width,y:t.y+o}}},fl=(t,e,n)=>{if(t.length<=1)return t.map(c=>c.id);const o=t.map(c=>({id:c.id,width:c.width,height:c.height})),i=new Set(o.map(c=>c.id)),s=e.filter(c=>i.has(c.from)&&i.has(c.to)&&c.from!==c.to),{forward:r}=Kn(o,s),a=Ti(o,r),d=_i(o,a);return Si(d,Wt(o,s),a,n),[...d.keys()].sort((c,h)=>c-h).flatMap(c=>d.get(c)??[])},bl=(t,e,n,o)=>{let i=0;for(let s=e;s<n;s++)i+=t[s].width;return i+o*Math.max(0,n-e-1)},Wn=(t,e,n)=>{const o=t.length,i=Math.max(1,Math.min(n,o)),s=Number.POSITIVE_INFINITY,r=Array.from({length:o+1},()=>Array.from({length:i+1},()=>s)),a=Array.from({length:o+1},()=>Array.from({length:i+1},()=>0));r[0][0]=0;for(let u=1;u<=i;u++)for(let g=u;g<=o;g++)for(let b=u-1;b<g;b++){const f=r[b][u-1];if(f===s)continue;const m=Math.max(f,bl(t,b,g,e));m<r[g][u]&&(r[g][u]=m,a[g][u]=b)}const d=[];let l=o;for(let u=i;u>0;u--){const g=a[l][u];d.unshift(t.slice(g,l)),l=g}const c=new Map;let h=0,p=0;for(const u of d){let g=0;const b=Math.max(...u.map(f=>f.height));for(const f of u)c.set(f.id,{x:g,y:h}),g+=f.width+e;p=Math.max(p,g-e),h+=b+e}return{positions:c,width:p,height:Math.max(0,h-e)}},Ke=1e-6,Vt=(t,e)=>Math.abs(t.x-e.x)<Ke&&Math.abs(t.y-e.y)<Ke,Qt=(t,e,n)=>{const o=(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);return Math.abs(o)<Ke?0:o>0?1:-1},Zt=(t,e,n)=>Math.min(t.x,n.x)-Ke<=e.x&&e.x<=Math.max(t.x,n.x)+Ke&&Math.min(t.y,n.y)-Ke<=e.y&&e.y<=Math.max(t.y,n.y)+Ke,zi=(t,e)=>{const[n,o]=t,[i,s]=e;if(Vt(n,i)||Vt(n,s)||Vt(o,i)||Vt(o,s))return!1;const r=Qt(n,o,i),a=Qt(n,o,s),d=Qt(i,s,n),l=Qt(i,s,o);return r!==a&&d!==l||r===0&&Zt(n,i,o)||a===0&&Zt(n,s,o)||d===0&&Zt(i,n,s)?!0:l===0&&Zt(i,o,s)},Pi=(t,e)=>{const n=t.x+t.width/2,o=t.y+t.height/2,i=e.x+e.width/2,s=e.y+e.height/2,r=i-n,a=s-o;return Math.abs(r)>=Math.abs(a)?{x:r>=0?t.x+t.width:t.x,y:o}:{x:n,y:a>=0?t.y+t.height:t.y}},xl=(t,e,n)=>{const o=r=>{const a=t.positions.get(r),d=e.get(r);return!a||!d?null:{id:r,x:a.x,y:a.y,width:d.width,height:d.height}},i=[];let s=0;for(const r of n){if(r.from===r.to)continue;const a=o(r.from),d=o(r.to);if(!a||!d)continue;const l=Pi(a,d),c=Pi(d,a);if(l.x===c.x||l.y===c.y){const g=[l,c];s+=i.filter(b=>zi(g,b)).length,i.push(g);continue}const h=[[[l,{x:c.x,y:l.y}],[{x:c.x,y:l.y},c]],[[l,{x:l.x,y:c.y}],[{x:l.x,y:c.y},c]]];let p=h[0],u=Number.POSITIVE_INFINITY;for(const g of h){const b=g.reduce((f,m)=>f+i.filter(x=>zi(m,x)).length,0);b<u&&(u=b,p=g)}s+=u,i.push(...p)}return s},yl=(t,e,n)=>{const o=s=>{const r=t.positions.get(s),a=e.get(s);return!r||!a?null:{x:r.x+a.width/2,y:r.y+a.height/2}};let i=0;for(const s of n){if(s.from===s.to)continue;const r=o(s.from),a=o(s.to);r&&a&&(i+=Math.hypot(r.x-a.x,r.y-a.y))}return i},qi=(t,e)=>{const n=t[0].x===t[1].x,o=e[0].x===e[1].x;if(n===o)return!1;const[i,s,r,a]=n?[t[0],t[1],e[0],e[1]]:[e[0],e[1],t[0],t[1]],d=i.x,l=r.y;return d>Math.min(r.x,a.x)&&d<Math.max(r.x,a.x)&&l>Math.min(i.y,s.y)&&l<Math.max(i.y,s.y)},Fi=(t,e,n,o)=>{const i=n===void 0?void 0:t.ports?.[n];return i!==void 0?{x:e.x+i.x,y:e.y+i.y}:o==="out"?{x:e.x+t.width,y:e.y+t.height/2}:{x:e.x,y:e.y+t.height/2}},vl=(t,e,n)=>{const o=new Map(t.map(r=>[r.id,r])),i=[];let s=0;for(const r of e){if(r.from===r.to)continue;const a=o.get(r.from),d=o.get(r.to),l=n.get(r.from),c=n.get(r.to);if(a===void 0||d===void 0||l===void 0||c===void 0)continue;const h={x:l.x,y:l.y,width:a.width,height:a.height},p={x:c.x,y:c.y,width:d.width,height:d.height},u=Di(h,Oi(h,p),Fi(a,l,r.fromPort,"out")),g=Di(p,Oi(p,h),Fi(d,c,r.toPort,"in")),b=k=>k.slice(1).map((w,$)=>[k[$],w]);if(u.x===g.x||u.y===g.y){const k=[u,g];s+=i.filter(w=>qi(k,w)).length,i.push(k);continue}const f=[[u,{x:g.x,y:u.y},g],[u,{x:u.x,y:g.y},g]];let m=f[0],x=Number.POSITIVE_INFINITY;for(const k of f){const w=b(k).reduce(($,L)=>$+i.filter(S=>qi(L,S)).length,0);w<x&&(m=k,x=w)}s+=x,i.push(...b(m))}return s},Jt={crossings:1e4,edgeLength:1,aspectDeviation:50},Bi=50,kl=Jt.aspectDeviation,Vn=(t,e,n,o,i)=>{const s=t.width<=0||t.height<=0?0:Math.abs(Math.log(t.width/t.height/o));return xl(t,e,n)*Jt.crossings+yl(t,e,n)*Jt.edgeLength+s*i},wl=function*(t){const e=[...t],n=e.length;if(yield[...e],n<=1)return;const o=Array.from({length:n}).fill(0);let i=0;for(;i<n;)if(o[i]<i){const s=i%2===0?0:o[i],r=e[s];e[s]=e[i],e[i]=r,yield[...e],o[i]=o[i]+1,i=0}else o[i]=0,i++},$l=7,El=400,Tl=1e-6,Qn=(t,e,n,o,i=xt.sweeps,s=0,r=Jt.aspectDeviation,a=El)=>{if(t.length===0)return{positions:new Map,width:0,height:0};if(t.length===1){const $=t[0];return{positions:new Map([[$.id,{x:0,y:0}]]),width:$.width,height:$.height}}const d=new Map(t.map($=>[$.id,{width:$.width,height:$.height}])),l=e.filter($=>d.has($.from)&&d.has($.to)&&$.from!==$.to),c=$=>{const L=$.map(N=>({id:N,...d.get(N)}));let S=Wn(L,n,1),T=Number.POSITIVE_INFINITY,E=1;const R=s>0?Math.min(s,L.length):1,A=s>0?R:L.length;for(let N=R;N<=A;N++){const U=Wn(L,n,N);if(U.width<=0||U.height<=0)continue;const H=Vn(U,d,l,o,r);H<T&&(T=H,S=U,E=N)}return{packed:S,cost:T,rowCount:E}},h=($,L)=>Wn($.map(S=>({id:S,...d.get(S)})),n,L),p=t.map($=>$.id);if(p.length<=$l){let $=c(p);for(const L of wl(p)){const S=c(L);S.cost<$.cost&&($=S)}return $.packed}const u=s>0?Math.min(a,50):a;let g=fl(t,l,i);const b=c(g),f=s>0?Math.min(s,g.length):b.rowCount;let m=s>0?h(g,f):b.packed,x=s>0?Vn(m,d,l,o,r):b.cost,k=0,w=!0;for(;w&&k<u;){w=!1;for(let $=0;$<g.length-1&&k<u;$++){k++;const L=[...g],S=L[$];L[$]=L[$+1],L[$+1]=S;const T=h(L,f);if(T.width<=0||T.height<=0)continue;const E=Vn(T,d,l,o,r);E<x-Tl&&(x=E,m=T,g=L,w=!0)}}return m},Sl=(t,e,n,o,i)=>{if(n<=0&&o<=0||t.positions.size<=1)return t;const s=new Map;for(const[p,u]of t.positions){const g=s.get(u.y);g?g.push(p):s.set(u.y,[p])}const a=[...s.keys()].sort((p,u)=>p-u).map(p=>[...s.get(p)??[]].sort((u,g)=>(t.positions.get(u)?.x??0)-(t.positions.get(g)?.x??0))),d=new Map;let l=0,c=0,h=0;return a.forEach((p,u)=>{const g=a[u-1];if(g!==void 0){const f=p.some(i)||g.some(i);h+=f?n:0}let b=0;p.forEach((f,m)=>{const x=p[m-1];x!==void 0&&(b+=i(x)||i(f)?o:0);const k=t.positions.get(f),w=e.get(f);if(!k||!w)return;const $={x:k.x+b,y:k.y+h};d.set(f,$),l=Math.max(l,$.x+w.width),c=Math.max(c,$.y+w.height)})}),{positions:d,width:l,height:c}},Ui=1.3,Ml=1.45,Il=(t,e,n={})=>{const o={...xt,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const i=new Set(t.map(E=>E.id)),s=e.filter(E=>i.has(E.from)&&i.has(E.to)),r=E=>E.group??`__loose:${E.id}`,a=E=>E.superGroup??`__top:${E.id}`,d=new Map(t.map(E=>[E.id,r(E)])),l=new Map(t.map(E=>[E.id,a(E)])),c=new Map;for(const E of t){const R=r(E),A=c.get(R);A?A.push(E):c.set(R,[E])}const h=new Map;for(const[E,R]of c){const A=R[0];if(R.length===1&&A!==void 0){h.set(E,{size:{width:A.width,height:A.height},relative:new Map([[A.id,{x:0,y:0}]])});continue}const N=new Set(R.map(q=>q.id)),U=s.filter(q=>N.has(q.from)&&N.has(q.to)),H=Qn(R.map(q=>({id:q.id,width:q.width,height:q.height})),U,o.nodeSpacing,Ui,o.sweeps,0,Bi);h.set(E,{size:{width:H.width,height:H.height},relative:H.positions})}const p=new Map;for(const[E,R]of c){const A=R[0];A!==void 0&&p.set(E,a(A))}const u=new Map;for(const[E,R]of p){const A=u.get(R);A?A.push(E):u.set(R,[E])}const g=new Map;for(const[E,R]of u){const A=R[0];if(R.length===1&&A!==void 0){const q=h.get(A);q&&g.set(E,{size:q.size,relative:new Map([[A,{x:0,y:0}]])});continue}const N=new Map(R.flatMap(q=>h.has(q)?[[q,h.get(q).size]]:[])),U=s.flatMap(q=>{const ee=d.get(q.from),Q=d.get(q.to);return ee===void 0||Q===void 0||ee===Q?[]:!R.includes(ee)||!R.includes(Q)?[]:[{id:q.id,from:ee,to:Q}]}),H=Qn(R.flatMap(q=>N.has(q)?[{id:q,...N.get(q)}]:[]),U,o.groupSpacing,Ui,o.sweeps,0,Bi);g.set(E,{size:{width:H.width,height:H.height},relative:H.positions})}const b=new Map([...g].map(([E,R])=>[E,R.size])),f=[...g.keys()],m=new Set(t.flatMap(E=>E.superGroup===void 0?[]:[E.superGroup])),x=E=>{const R=new Map;for(const[A,N]of u){const U=E.get(A)??{x:0,y:0},H=g.get(A);for(const q of N){const ee=H?.relative.get(q)??{x:0,y:0},Q=h.get(q);if(Q)for(const[G,Z]of Q.relative)R.set(G,{x:U.x+ee.x+Z.x,y:U.y+ee.y+Z.y})}}return R};let k=new Map;if(f.length<=1)for(const E of f)k.set(E,{x:0,y:0});else{const E=s.flatMap(G=>{const Z=l.get(G.from),ne=l.get(G.to);return Z===void 0||ne===void 0||Z===ne?[]:[{id:G.id,from:Z,to:ne}]}),R=G=>Qn(f.map(Z=>({id:Z,...b.get(Z)})),E,o.superGroupSpacing,Ml,o.sweeps,G,kl),A=R(o.superGroupRowCount),N=o.superGroupRowCount>0?[]:[1,2,3,4].filter(G=>G<=f.length),U=[A,...N.map(G=>R(G))],H=G=>{const Z=Sl(G,b,o.superGroupRowGap,o.superGroupColumnGap,K=>m.has(K)),ne=vl(t,s,x(Z.positions)),D=Math.min(1180/Math.max(1,Z.width),900/Math.max(1,Z.height),1);return{offsets:Z.positions,crossings:ne,fit:D}},q=U.map(H),ee=q[0];let Q=ee;for(const G of q.slice(1))G.crossings>ee.crossings*.8||G.fit<ee.fit*.9||(G.crossings<Q.crossings||G.crossings===Q.crossings&&G.fit>Q.fit)&&(Q=G);k=new Map(Q.offsets)}const w=x(k),$=Kn(t,s).reversed,L=t.map((E,R)=>{const A=w.get(E.id)??{x:0,y:0};return{spec:E,layer:0,order:R,x:A.x,y:A.y}}),S=new Map(L.map(E=>[E.spec.id,E])),T=jt(s,$,{byId:S,layerSpacing:o.layerSpacing,padding:o.padding});return jn(L,T,o.padding)},Cl=(t,e,n,o,i={})=>{if(e.size===0)return t;const s={...xt,...i},r=new Map(n.map(f=>[f.id,f])),a=t.nodes.map(f=>{const m=e.get(f.id);return m===void 0?f:{...f,x:m.x,y:m.y}}),d=new Map(a.map(f=>[f.id,{spec:r.get(f.id)??{id:f.id,width:f.width,height:f.height},layer:f.layer,order:f.order,x:f.x,y:f.y}])),l=new Set(a.map(f=>f.id)),c=o.filter(f=>l.has(f.from)&&l.has(f.to)),h=jt(c,new Set,{byId:d,layerSpacing:s.layerSpacing,padding:s.padding}),p=[...a.map(f=>f.x+f.width),...h.flatMap(f=>f.points.map(m=>m.x))],u=[...a.map(f=>f.y+f.height),...h.flatMap(f=>f.points.map(m=>m.y))],g=Math.max(t.width,Math.max(0,...p)+s.padding),b=Math.max(t.height,Math.max(0,...u)+s.padding);return{width:g,height:b,nodes:a,routes:h}},Hi=(t,e,n={})=>{const o={...xt,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const i=new Set(t.map(d=>d.id)),s=e.filter(d=>i.has(d.from)&&i.has(d.to)),r=Li(t,new Map,new Map,d=>d.position??{x:0,y:0}),a=new Map(r.map(d=>[d.spec.id,d]));return jn(r,jt(s,new Set,{byId:a,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},Yi={kind:"idle"},Ll=t=>({kind:"node",...t,moved:!1,preview:null}),_l=t=>({kind:"group",...t,moved:!1,preview:null}),Rl=(t,e,n,o)=>{if(t.kind==="idle")return t;const i=e.screenX-t.origin.screenX,s=e.screenY-t.origin.screenY;if(!t.moved&&Math.hypot(i,s)<=o)return t;const r=i/n,a=s/n;if(t.kind==="node"){const l={x:Math.max(0,t.start.x+r),y:Math.max(0,t.start.y+a)};return{...t,moved:!0,preview:l}}const d=new Map;for(const[l,c]of t.starts)d.set(l,{x:Math.max(0,c.x+r),y:Math.max(0,c.y+a)});return{...t,moved:!0,preview:d}},Xi=ce({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:t=>`Comment on ${t}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the data.",nodes:"elements",edges:"relations",change:(t,e)=>`\u201C${t}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:t=>`${t}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(t,e)=>`\u300C${t}\u300D\u2192\u300C${e}\u300D`}}),Gi={v:1,overrides:[]},Zn="dpk-layout-change",Al=(t,e)=>t.board===e.board&&t.diagram===e.diagram&&t.node===e.node,Ki=(t,e,n)=>({...t,overrides:[...t.overrides.filter(o=>!Al(o,e)),{...e,position:n}]}),Ol=(t,e)=>e.reduce((n,o)=>Ki(n,o,o.position),t),Nl=(t,e,n)=>new Map(t.overrides.filter(o=>o.board===e&&o.diagram===n).map(o=>[o.node,o.position])),Dl=(t,e,n)=>t.overrides.some(o=>o.board===e&&o.diagram===n),zl=(t,e,n)=>{const o=t.overrides.filter(i=>!(i.board===e&&i.diagram===n));return o.length===t.overrides.length?t:{...t,overrides:o}},Pl=(t,e,n,o)=>{const i=t.overrides.filter(s=>!(s.board===e&&s.diagram===n)||o.has(s.node));return i.length===t.overrides.length?t:{...t,overrides:i}},ql=O({x:le(),y:le()}),Fl=O({board:y(),diagram:y(),node:y(),position:ql}),Bl=O({v:pe(1),overrides:F(Fl)}),ji=t=>{const e=Oe(Bl,t);return e.success?e.output:null},Ul=t=>`dev-process-kit:layout-positions:${t}`,Hl=()=>{const t=typeof location>"u"?"local":`${location.pathname}${location.search}`;return Ul(t)},Yl=()=>Ed(ji),Xl=()=>$d(ji),Gl=t=>t.closest(Td)?.getAttribute(Sd)??"";class Kl{#o;#i;#e=null;#n="";#t=Gi;#a=()=>this.#c();constructor(e,n){this.#o=e,this.#i=n,e.addController(this)}hostConnected(){this.#e=this.#i.persist===!1?Xl():Yl(),this.#n=Hl(),this.#t=this.#e.read(this.#n)??Gi,window.addEventListener(Zn,this.#a)}hostDisconnected(){window.removeEventListener(Zn,this.#a)}get#r(){return Gl(this.#i.host())}get#s(){return this.#i.diagram()}overrides(){return Nl(this.#t,this.#r,this.#s)}hasOverrides(){return Dl(this.#t,this.#r,this.#s)}commit(e,n){this.#t=Ki(this.#t,{board:this.#r,diagram:this.#s,node:e},n),this.#d()}commitMany(e){if(e.size===0)return;const n=[...e].map(([o,i])=>({board:this.#r,diagram:this.#s,node:o,position:i}));this.#t=Ol(this.#t,n),this.#d()}prune(e){const n=Pl(this.#t,this.#r,this.#s,e);n!==this.#t&&(this.#t=n,this.#d())}reset(){const e=zl(this.#t,this.#r,this.#s);e!==this.#t&&(this.#t=e,this.#d())}#d(){this.#e?.write(this.#n,this.#t),this.#o.requestUpdate(),window.dispatchEvent(new CustomEvent(Zn))}#c(){this.#t=this.#e?.read(this.#n)??this.#t,this.#o.requestUpdate()}}const jl=(t,e,n)=>`${t} ${n.node} \xB7 ${e} ${n.edge}`,et=[Md,ri,ai,ae`
|
|
1
|
+
import{a4 as wd,S as qn,a5 as ce,a6 as $d,a7 as Ed,a8 as Oe,a9 as O,aa as F,ab as pe,ac as y,ad as le,ae as Td,af as Sd,X as Md,j as ri,ag as ai,ah as ae,ai as M,aj as Y,ak as di,al as li,am as Id,an as Cd,D as Ld,ao as _d,U as Rd,ap as Fn,aq as Ad,ar as ci,as as v,C as Od,at as Nd,au as he,av as P,aw as C,ax as I,ay as _,az as X,aA as Ge,aB as ft,aC as Bn,aD as Dd,aE as pi,aF as hi,aG as zd,aH as Te,aI as ui,B as mi,aJ as Pd,G as gi,H as Un,I as Ft,aK as qd,aL as W,aM as oe,aN as Ze,p as z,t as Se,aO as ue,aP as Hn,z as Yn,aQ as bt,aR as Fd,N as Bt,e as Xn,P as B,aS as Ut,aT as Bd,l as xe,aU as Ht,aV as fi,aW as bi,aX as Ud,aY as xi,aZ as Hd,a_ as yi,a$ as Yt,b0 as Me,b1 as Yd,b2 as Xd,b3 as Gd}from"./shared-DYDJzB79.js";import{Q as Kd,A as jd,H as Wd,R as Vd,S as Qd,T as ye,U as Ie,V as vi,W as Zd,X as ve,Y as Jd,Z as Gn,_ as ki,$ as el}from"./shared-BYbcHniE.js";import{o as tl}from"./shared-D4PPk0Dk.js";import{E as nl,t as Ce,u as ol,v as Ne,B as Xt,w as Gt,x as il}from"./shared-epAjO2d1.js";import{a as sl,c as rl}from"./shared-TtB-p2Zh.js";import{o as Kt}from"./shared-DMksNmni.js";const al=[["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"}]],dl=[["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"}]],ll=[["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"}]],cl=[["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"}]],pl=[["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 hl(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}function wi(t){if(t.length===0)return NaN;const e=t.slice().sort((o,i)=>o-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}const $i={},Ei=t=>{const e={kind:"board",name:t.name,label:t.label,addable:t.addable??!1,parseBase:()=>$i,emptyBase:()=>$i,actions:{},apply:()=>null,hasTarget:()=>!1,describe:i=>({title:i.type,targetLabel:qn(i.target),tone:"meta"}),serialize:i=>`${i.type} ${qn(i.target)} ${JSON.stringify(i.payload)}`,resolveNavigation:()=>({}),commentTargets:()=>[],title:()=>t.label},n=t.commentTargets?.()??[],o=new Map((t.elementActionResults?.()??[]).map(i=>[i.id,i]));return wd(e,n,o)},xt={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6,groupSpacing:34,superGroupSpacing:34,superGroupRowGap:0,superGroupColumnGap:0,superGroupRowCount:0},yt=t=>{const e=[...t].sort((o,i)=>o-i);if(e.length===0)return 0;const n=Math.floor(e.length/2);return e.length%2===1?e[n]??0:((e[n-1]??0)+(e[n]??0))/2},Kn=(t,e)=>{const n=new Map;for(const r of t)n.set(r.id,[]);for(const r of e)n.get(r.from)?.push(r);const o=new Map,i=new Set,s=r=>{o.set(r,"open");for(const a of n.get(r)??[]){const d=o.get(a.to)??"new";d==="open"?i.add(a.id):d==="new"&&s(a.to)}o.set(r,"done")};for(const r of t)(o.get(r.id)??"new")==="new"&&s(r.id);return{reversed:i,forward:e.filter(r=>!i.has(r.id))}},Ti=(t,e)=>{const n=new Map,o=new Map;for(const a of t)n.set(a.id,[]),o.set(a.id,[]);for(const a of e)o.get(a.from)?.push(a),n.get(a.to)?.push(a);const i=new Map(t.map(a=>[a.id,0])),s=new Map(t.map(a=>[a.id,(n.get(a.id)??[]).length])),r=t.filter(a=>(s.get(a.id)??0)===0).map(a=>a.id);for(const a of r)for(const d of o.get(a)??[]){const l=i.get(d.to)??0;i.set(d.to,Math.max(l,(i.get(a)??0)+1));const c=(s.get(d.to)??0)-1;s.set(d.to,c),c===0&&r.push(d.to)}return i},Si=(t,e,n,o)=>{const i=[...t.keys()].sort((s,r)=>s-r);for(let s=0;s<o;s++){const r=s%2===0;for(const a of r?i:[...i].reverse()){const d=t.get(a)??[],l=new Map(d.map((p,u)=>[p,u])),c=p=>{const u=l.get(p);return u===void 0?null:u},h=d.map(p=>{const u=(e.get(p)??[]).filter(g=>(n.get(g)??a)===a+(r?-1:1)).map(c).filter(g=>g!==null);return{id:p,want:u.length>0?yt(u):l.get(p)??0}});h.sort((p,u)=>p.want-u.want||(l.get(p.id)??0)-(l.get(u.id)??0)),t.set(a,h.map(p=>p.id))}}},Mi=(t,e,n,o)=>{const i=t.map((r,a)=>({id:r,want:n.get(r)??a*100,index:a}));i.sort((r,a)=>r.want-a.want||r.index-a.index);let s=0;for(const r of i){const a=e.get(r.id);a&&(a.y=s,s+=a.spec.height+o)}return{height:Math.max(0,s-o)}},ul=(t,e,n,o,i)=>{const s=[...t.keys()].sort((l,c)=>l-c),r=new Map;for(const l of s)r.set(l,Mi(t.get(l)??[],e,new Map,i.nodeSpacing).height);const a=Math.max(0,...r.values());for(const l of s){const c=(a-(r.get(l)??0))/2;for(const h of t.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const d=(l,c)=>{const h=(n.get(l)??[]).filter(p=>o.get(p)===c).flatMap(p=>{const u=e.get(p);return u?[u.y+u.spec.height/2]:[]});return h.length>0?yt(h):null};for(let l=0;l<i.coordinatePasses;l++){const c=l%2===0;for(const h of c?s:[...s].reverse()){const p=t.get(h)??[],u=new Map;for(const m of p){const x=d(m,h+(c?-1:1)),k=e.get(m);k!==void 0&&u.set(m,x===null?k.y+k.spec.height/2:x)}const g=p.map(m=>e.get(m)?.y??0);Mi(p,e,u,i.nodeSpacing);const b=p.map(m=>e.get(m)?.y??0),f=yt(g)-yt(b);for(const m of p){const x=e.get(m);x&&(x.y+=f)}}}},Ii=(t,e,n,o,i,s,r)=>{for(const a of i){const d=t.filter(h=>o.get(h)===a);if(d.length===0)continue;const l=d.map((h,p)=>({id:h,want:n.get(h)??p,index:p})).sort((h,p)=>h.want-p.want||h.index-p.index);let c=s.get(a)??0;for(const h of l){const p=e.get(h.id);p&&(p.y=c,c+=p.spec.height+r)}}},ml=(t,e,n,o,i)=>{let s=0;for(const r of t.values()){const a=r.filter(l=>n.get(l)===o);if(a.length===0)continue;const d=a.reduce((l,c)=>l+(e.get(c)?.spec.height??0),0)+i*(a.length-1);d>s&&(s=d)}return s},gl=(t,e,n,o,i,s,r)=>{const a=new Map(t.map(T=>[T.id,T.group??T.id])),d=new Set(t.flatMap(T=>T.group===void 0?[]:[T.group])),l=t.some(T=>T.superGroup!==void 0),c=new Map;for(const T of t){const E=a.get(T.id)??T.id;T.superGroup!==void 0&&!c.has(E)&&c.set(E,T.superGroup)}const h=T=>c.get(T)??T,p=[...e.keys()].sort((T,E)=>T-E),u=T=>{const E=i.get(T)??0,R=(e.get(E)??[]).length,A=s.get(T)??0;return R<=1?0:A/(R-1)},g=[...new Set(a.values())],b=T=>{const E=t.filter(R=>(a.get(R.id)??R.id)===T).map(R=>R.id);return E.length===0?0:E.reduce((R,A)=>R+u(A),0)/E.length},f=[...new Set(g.map(h))],m=T=>{const E=t.filter(R=>h(a.get(R.id)??R.id)===T).map(R=>R.id);return E.length===0?0:E.reduce((R,A)=>R+u(A),0)/E.length},k=f.sort((T,E)=>m(T)-m(E)).flatMap(T=>g.filter(E=>h(E)===T).sort((E,R)=>b(E)-b(R))),w=new Map(k.map(T=>[T,ml(e,n,a,T,r.nodeSpacing)])),$=new Map;let L=0;for(const[T,E]of k.entries()){$.set(E,L),L+=w.get(E)??0;const R=k[T+1];if(R!==void 0){const A=l&&h(E)!==h(R);L+=A?r.superGroupSpacing:d.has(E)||d.has(R)?r.groupSpacing:r.nodeSpacing}}for(const T of p){const E=e.get(T)??[];Ii(E,n,new Map(E.map(R=>[R,s.get(R)??0])),a,k,$,r.nodeSpacing)}const S=(T,E)=>{const R=(o.get(T)??[]).filter(A=>i.get(A)===E).flatMap(A=>{const N=n.get(A);return N?[N.y+N.spec.height/2]:[]});return R.length>0?yt(R):null};for(let T=0;T<r.coordinatePasses;T++){const E=T%2===0;for(const R of E?p:[...p].reverse()){const A=e.get(R)??[],N=new Map;for(const U of A){const H=S(U,R+(E?-1:1)),q=n.get(U);q!==void 0&&N.set(U,H===null?q.y+q.spec.height/2:H)}Ii(A,n,N,a,k,$,r.nodeSpacing)}}},Ci=(t,e,n)=>{const o=e===void 0?void 0:t.spec.ports?.[e];return o?{x:t.x+o.x,y:t.y+o.y}:n==="out"?{x:t.x+t.spec.width,y:t.y+t.spec.height/2}:{x:t.x,y:t.y+t.spec.height/2}},jt=(t,e,n)=>{let o=0;const i=[];for(const s of t){const r=n.byId.get(s.from),a=n.byId.get(s.to);if(!r||!a)continue;const d=Ci(r,s.fromPort,"out"),l=Ci(a,s.toPort,"in");if(s.from===s.to){const g=r.x+r.spec.width,b=r.y+r.spec.height,f=Math.max(n.padding/2,b+18);i.push({id:s.id,points:[d,{x:g+20,y:d.y},{x:g+20,y:f},{x:r.x-20,y:f},{x:r.x-20,y:l.y},l]});continue}if(!e.has(s.id)&&(r.layer<a.layer||r.layer===a.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){i.push({id:s.id,points:[d,l]});continue}const b=r.layer<a.layer?Math.max(d.x+14,a.x-Math.max(12,n.layerSpacing/2)):(d.x+l.x)/2;i.push({id:s.id,points:[d,{x:b,y:d.y},{x:b,y:l.y},l]});continue}const c=s.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:d,h=s.toPort===void 0?{x:a.x+a.spec.width/2,y:a.y+a.spec.height}:l,p=Math.max(c.y,h.y)+18+o*14;o+=1;const u=[d,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((g,b,f)=>b===0||g.x!==f[b-1]?.x||g.y!==f[b-1]?.y);i.push({id:s.id,points:u})}return i},jn=(t,e,n)=>{const o=e.flatMap(p=>[...p.points]),i=[...t.map(p=>p.x),...t.map(p=>p.x+p.spec.width),...o.map(p=>p.x)],s=[...t.map(p=>p.y),...t.map(p=>p.y+p.spec.height),...o.map(p=>p.y)],r=Math.min(0,...i),a=Math.min(0,...s),d=Math.max(0,...i),l=Math.max(0,...s),c=n-r,h=n-a;return{width:d-r+n*2,height:l-a+n*2,nodes:t.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+h,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(u=>({x:u.x+c,y:u.y+h}))}))}},Wt=(t,e)=>{const n=new Map(t.map(o=>[o.id,[]]));for(const o of e)o.from!==o.to&&(n.get(o.from)?.push(o.to),n.get(o.to)?.push(o.from));return n},Li=(t,e,n,o)=>t.map(i=>({spec:i,layer:e.get(i.id)??0,order:n.get(i.id)??0,...o(i)})),_i=(t,e)=>{const n=new Map;for(const o of t){const i=e.get(o.id)??0,s=n.get(i);s?s.push(o.id):n.set(i,[o.id])}return n},Ri=(t,e,n={})=>{if(t.some(b=>b.superGroup!==void 0))return Il(t,e,n);const o={...xt,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const i=new Set(t.map(b=>b.id)),s=e.filter(b=>i.has(b.from)&&i.has(b.to)),{forward:r,reversed:a}=Kn(t,s),d=Ti(t,r),l=_i(t,d);Si(l,Wt(t,s),d,o.sweeps);const c=new Map;for(const b of l.values())b.forEach((f,m)=>c.set(f,m));const h=Li(t,d,c,()=>({x:0,y:0})),p=new Map(h.map(b=>[b.spec.id,b]));t.some(b=>b.group!==void 0||b.superGroup!==void 0)?gl(t,l,p,Wt(t,s),d,c,o):ul(l,p,Wt(t,s),d,o);const u=[...l.keys()].sort((b,f)=>b-f);let g=0;for(const b of u){const f=Math.max(...(l.get(b)??[]).map(m=>p.get(m)?.spec.width??0));for(const m of l.get(b)??[]){const x=p.get(m);x&&(x.x=g)}g+=f+o.layerSpacing}return jn(h,jt(s,a,{byId:p,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},Je=12,Ai=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),Oi=(t,e)=>{const n=Ai(t),o=Ai(e),i=o.x-n.x,s=o.y-n.y;return Math.abs(i)>=Math.abs(s)?i>=0?"right":"left":s>=0?"bottom":"top"},Ni=(t,e,n)=>Math.min(n,Math.max(e,t)),Di=(t,e,n)=>{const o=Ni(n.y-t.y,Je,Math.max(Je,t.height-Je)),i=t.height<=0?.5:o/t.height,s=t.x+Ni(i*t.width,Je,Math.max(Je,t.width-Je));switch(e){case"left":return{x:t.x,y:t.y+o};case"right":return{x:t.x+t.width,y:t.y+o};case"top":return{x:s,y:t.y};case"bottom":return{x:s,y:t.y+t.height};default:return{x:t.x+t.width,y:t.y+o}}},fl=(t,e,n)=>{if(t.length<=1)return t.map(c=>c.id);const o=t.map(c=>({id:c.id,width:c.width,height:c.height})),i=new Set(o.map(c=>c.id)),s=e.filter(c=>i.has(c.from)&&i.has(c.to)&&c.from!==c.to),{forward:r}=Kn(o,s),a=Ti(o,r),d=_i(o,a);return Si(d,Wt(o,s),a,n),[...d.keys()].sort((c,h)=>c-h).flatMap(c=>d.get(c)??[])},bl=(t,e,n,o)=>{let i=0;for(let s=e;s<n;s++)i+=t[s].width;return i+o*Math.max(0,n-e-1)},Wn=(t,e,n)=>{const o=t.length,i=Math.max(1,Math.min(n,o)),s=Number.POSITIVE_INFINITY,r=Array.from({length:o+1},()=>Array.from({length:i+1},()=>s)),a=Array.from({length:o+1},()=>Array.from({length:i+1},()=>0));r[0][0]=0;for(let u=1;u<=i;u++)for(let g=u;g<=o;g++)for(let b=u-1;b<g;b++){const f=r[b][u-1];if(f===s)continue;const m=Math.max(f,bl(t,b,g,e));m<r[g][u]&&(r[g][u]=m,a[g][u]=b)}const d=[];let l=o;for(let u=i;u>0;u--){const g=a[l][u];d.unshift(t.slice(g,l)),l=g}const c=new Map;let h=0,p=0;for(const u of d){let g=0;const b=Math.max(...u.map(f=>f.height));for(const f of u)c.set(f.id,{x:g,y:h}),g+=f.width+e;p=Math.max(p,g-e),h+=b+e}return{positions:c,width:p,height:Math.max(0,h-e)}},Ke=1e-6,Vt=(t,e)=>Math.abs(t.x-e.x)<Ke&&Math.abs(t.y-e.y)<Ke,Qt=(t,e,n)=>{const o=(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);return Math.abs(o)<Ke?0:o>0?1:-1},Zt=(t,e,n)=>Math.min(t.x,n.x)-Ke<=e.x&&e.x<=Math.max(t.x,n.x)+Ke&&Math.min(t.y,n.y)-Ke<=e.y&&e.y<=Math.max(t.y,n.y)+Ke,zi=(t,e)=>{const[n,o]=t,[i,s]=e;if(Vt(n,i)||Vt(n,s)||Vt(o,i)||Vt(o,s))return!1;const r=Qt(n,o,i),a=Qt(n,o,s),d=Qt(i,s,n),l=Qt(i,s,o);return r!==a&&d!==l||r===0&&Zt(n,i,o)||a===0&&Zt(n,s,o)||d===0&&Zt(i,n,s)?!0:l===0&&Zt(i,o,s)},Pi=(t,e)=>{const n=t.x+t.width/2,o=t.y+t.height/2,i=e.x+e.width/2,s=e.y+e.height/2,r=i-n,a=s-o;return Math.abs(r)>=Math.abs(a)?{x:r>=0?t.x+t.width:t.x,y:o}:{x:n,y:a>=0?t.y+t.height:t.y}},xl=(t,e,n)=>{const o=r=>{const a=t.positions.get(r),d=e.get(r);return!a||!d?null:{id:r,x:a.x,y:a.y,width:d.width,height:d.height}},i=[];let s=0;for(const r of n){if(r.from===r.to)continue;const a=o(r.from),d=o(r.to);if(!a||!d)continue;const l=Pi(a,d),c=Pi(d,a);if(l.x===c.x||l.y===c.y){const g=[l,c];s+=i.filter(b=>zi(g,b)).length,i.push(g);continue}const h=[[[l,{x:c.x,y:l.y}],[{x:c.x,y:l.y},c]],[[l,{x:l.x,y:c.y}],[{x:l.x,y:c.y},c]]];let p=h[0],u=Number.POSITIVE_INFINITY;for(const g of h){const b=g.reduce((f,m)=>f+i.filter(x=>zi(m,x)).length,0);b<u&&(u=b,p=g)}s+=u,i.push(...p)}return s},yl=(t,e,n)=>{const o=s=>{const r=t.positions.get(s),a=e.get(s);return!r||!a?null:{x:r.x+a.width/2,y:r.y+a.height/2}};let i=0;for(const s of n){if(s.from===s.to)continue;const r=o(s.from),a=o(s.to);r&&a&&(i+=Math.hypot(r.x-a.x,r.y-a.y))}return i},qi=(t,e)=>{const n=t[0].x===t[1].x,o=e[0].x===e[1].x;if(n===o)return!1;const[i,s,r,a]=n?[t[0],t[1],e[0],e[1]]:[e[0],e[1],t[0],t[1]],d=i.x,l=r.y;return d>Math.min(r.x,a.x)&&d<Math.max(r.x,a.x)&&l>Math.min(i.y,s.y)&&l<Math.max(i.y,s.y)},Fi=(t,e,n,o)=>{const i=n===void 0?void 0:t.ports?.[n];return i!==void 0?{x:e.x+i.x,y:e.y+i.y}:o==="out"?{x:e.x+t.width,y:e.y+t.height/2}:{x:e.x,y:e.y+t.height/2}},vl=(t,e,n)=>{const o=new Map(t.map(r=>[r.id,r])),i=[];let s=0;for(const r of e){if(r.from===r.to)continue;const a=o.get(r.from),d=o.get(r.to),l=n.get(r.from),c=n.get(r.to);if(a===void 0||d===void 0||l===void 0||c===void 0)continue;const h={x:l.x,y:l.y,width:a.width,height:a.height},p={x:c.x,y:c.y,width:d.width,height:d.height},u=Di(h,Oi(h,p),Fi(a,l,r.fromPort,"out")),g=Di(p,Oi(p,h),Fi(d,c,r.toPort,"in")),b=k=>k.slice(1).map((w,$)=>[k[$],w]);if(u.x===g.x||u.y===g.y){const k=[u,g];s+=i.filter(w=>qi(k,w)).length,i.push(k);continue}const f=[[u,{x:g.x,y:u.y},g],[u,{x:u.x,y:g.y},g]];let m=f[0],x=Number.POSITIVE_INFINITY;for(const k of f){const w=b(k).reduce(($,L)=>$+i.filter(S=>qi(L,S)).length,0);w<x&&(m=k,x=w)}s+=x,i.push(...b(m))}return s},Jt={crossings:1e4,edgeLength:1,aspectDeviation:50},Bi=50,kl=Jt.aspectDeviation,Vn=(t,e,n,o,i)=>{const s=t.width<=0||t.height<=0?0:Math.abs(Math.log(t.width/t.height/o));return xl(t,e,n)*Jt.crossings+yl(t,e,n)*Jt.edgeLength+s*i},wl=function*(t){const e=[...t],n=e.length;if(yield[...e],n<=1)return;const o=Array.from({length:n}).fill(0);let i=0;for(;i<n;)if(o[i]<i){const s=i%2===0?0:o[i],r=e[s];e[s]=e[i],e[i]=r,yield[...e],o[i]=o[i]+1,i=0}else o[i]=0,i++},$l=7,El=400,Tl=1e-6,Qn=(t,e,n,o,i=xt.sweeps,s=0,r=Jt.aspectDeviation,a=El)=>{if(t.length===0)return{positions:new Map,width:0,height:0};if(t.length===1){const $=t[0];return{positions:new Map([[$.id,{x:0,y:0}]]),width:$.width,height:$.height}}const d=new Map(t.map($=>[$.id,{width:$.width,height:$.height}])),l=e.filter($=>d.has($.from)&&d.has($.to)&&$.from!==$.to),c=$=>{const L=$.map(N=>({id:N,...d.get(N)}));let S=Wn(L,n,1),T=Number.POSITIVE_INFINITY,E=1;const R=s>0?Math.min(s,L.length):1,A=s>0?R:L.length;for(let N=R;N<=A;N++){const U=Wn(L,n,N);if(U.width<=0||U.height<=0)continue;const H=Vn(U,d,l,o,r);H<T&&(T=H,S=U,E=N)}return{packed:S,cost:T,rowCount:E}},h=($,L)=>Wn($.map(S=>({id:S,...d.get(S)})),n,L),p=t.map($=>$.id);if(p.length<=$l){let $=c(p);for(const L of wl(p)){const S=c(L);S.cost<$.cost&&($=S)}return $.packed}const u=s>0?Math.min(a,50):a;let g=fl(t,l,i);const b=c(g),f=s>0?Math.min(s,g.length):b.rowCount;let m=s>0?h(g,f):b.packed,x=s>0?Vn(m,d,l,o,r):b.cost,k=0,w=!0;for(;w&&k<u;){w=!1;for(let $=0;$<g.length-1&&k<u;$++){k++;const L=[...g],S=L[$];L[$]=L[$+1],L[$+1]=S;const T=h(L,f);if(T.width<=0||T.height<=0)continue;const E=Vn(T,d,l,o,r);E<x-Tl&&(x=E,m=T,g=L,w=!0)}}return m},Sl=(t,e,n,o,i)=>{if(n<=0&&o<=0||t.positions.size<=1)return t;const s=new Map;for(const[p,u]of t.positions){const g=s.get(u.y);g?g.push(p):s.set(u.y,[p])}const a=[...s.keys()].sort((p,u)=>p-u).map(p=>[...s.get(p)??[]].sort((u,g)=>(t.positions.get(u)?.x??0)-(t.positions.get(g)?.x??0))),d=new Map;let l=0,c=0,h=0;return a.forEach((p,u)=>{const g=a[u-1];if(g!==void 0){const f=p.some(i)||g.some(i);h+=f?n:0}let b=0;p.forEach((f,m)=>{const x=p[m-1];x!==void 0&&(b+=i(x)||i(f)?o:0);const k=t.positions.get(f),w=e.get(f);if(!k||!w)return;const $={x:k.x+b,y:k.y+h};d.set(f,$),l=Math.max(l,$.x+w.width),c=Math.max(c,$.y+w.height)})}),{positions:d,width:l,height:c}},Ui=1.3,Ml=1.45,Il=(t,e,n={})=>{const o={...xt,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const i=new Set(t.map(E=>E.id)),s=e.filter(E=>i.has(E.from)&&i.has(E.to)),r=E=>E.group??`__loose:${E.id}`,a=E=>E.superGroup??`__top:${E.id}`,d=new Map(t.map(E=>[E.id,r(E)])),l=new Map(t.map(E=>[E.id,a(E)])),c=new Map;for(const E of t){const R=r(E),A=c.get(R);A?A.push(E):c.set(R,[E])}const h=new Map;for(const[E,R]of c){const A=R[0];if(R.length===1&&A!==void 0){h.set(E,{size:{width:A.width,height:A.height},relative:new Map([[A.id,{x:0,y:0}]])});continue}const N=new Set(R.map(q=>q.id)),U=s.filter(q=>N.has(q.from)&&N.has(q.to)),H=Qn(R.map(q=>({id:q.id,width:q.width,height:q.height})),U,o.nodeSpacing,Ui,o.sweeps,0,Bi);h.set(E,{size:{width:H.width,height:H.height},relative:H.positions})}const p=new Map;for(const[E,R]of c){const A=R[0];A!==void 0&&p.set(E,a(A))}const u=new Map;for(const[E,R]of p){const A=u.get(R);A?A.push(E):u.set(R,[E])}const g=new Map;for(const[E,R]of u){const A=R[0];if(R.length===1&&A!==void 0){const q=h.get(A);q&&g.set(E,{size:q.size,relative:new Map([[A,{x:0,y:0}]])});continue}const N=new Map(R.flatMap(q=>h.has(q)?[[q,h.get(q).size]]:[])),U=s.flatMap(q=>{const ee=d.get(q.from),Q=d.get(q.to);return ee===void 0||Q===void 0||ee===Q?[]:!R.includes(ee)||!R.includes(Q)?[]:[{id:q.id,from:ee,to:Q}]}),H=Qn(R.flatMap(q=>N.has(q)?[{id:q,...N.get(q)}]:[]),U,o.groupSpacing,Ui,o.sweeps,0,Bi);g.set(E,{size:{width:H.width,height:H.height},relative:H.positions})}const b=new Map([...g].map(([E,R])=>[E,R.size])),f=[...g.keys()],m=new Set(t.flatMap(E=>E.superGroup===void 0?[]:[E.superGroup])),x=E=>{const R=new Map;for(const[A,N]of u){const U=E.get(A)??{x:0,y:0},H=g.get(A);for(const q of N){const ee=H?.relative.get(q)??{x:0,y:0},Q=h.get(q);if(Q)for(const[G,Z]of Q.relative)R.set(G,{x:U.x+ee.x+Z.x,y:U.y+ee.y+Z.y})}}return R};let k=new Map;if(f.length<=1)for(const E of f)k.set(E,{x:0,y:0});else{const E=s.flatMap(G=>{const Z=l.get(G.from),ne=l.get(G.to);return Z===void 0||ne===void 0||Z===ne?[]:[{id:G.id,from:Z,to:ne}]}),R=G=>Qn(f.map(Z=>({id:Z,...b.get(Z)})),E,o.superGroupSpacing,Ml,o.sweeps,G,kl),A=R(o.superGroupRowCount),N=o.superGroupRowCount>0?[]:[1,2,3,4].filter(G=>G<=f.length),U=[A,...N.map(G=>R(G))],H=G=>{const Z=Sl(G,b,o.superGroupRowGap,o.superGroupColumnGap,K=>m.has(K)),ne=vl(t,s,x(Z.positions)),D=Math.min(1180/Math.max(1,Z.width),900/Math.max(1,Z.height),1);return{offsets:Z.positions,crossings:ne,fit:D}},q=U.map(H),ee=q[0];let Q=ee;for(const G of q.slice(1))G.crossings>ee.crossings*.8||G.fit<ee.fit*.9||(G.crossings<Q.crossings||G.crossings===Q.crossings&&G.fit>Q.fit)&&(Q=G);k=new Map(Q.offsets)}const w=x(k),$=Kn(t,s).reversed,L=t.map((E,R)=>{const A=w.get(E.id)??{x:0,y:0};return{spec:E,layer:0,order:R,x:A.x,y:A.y}}),S=new Map(L.map(E=>[E.spec.id,E])),T=jt(s,$,{byId:S,layerSpacing:o.layerSpacing,padding:o.padding});return jn(L,T,o.padding)},Cl=(t,e,n,o,i={})=>{if(e.size===0)return t;const s={...xt,...i},r=new Map(n.map(f=>[f.id,f])),a=t.nodes.map(f=>{const m=e.get(f.id);return m===void 0?f:{...f,x:m.x,y:m.y}}),d=new Map(a.map(f=>[f.id,{spec:r.get(f.id)??{id:f.id,width:f.width,height:f.height},layer:f.layer,order:f.order,x:f.x,y:f.y}])),l=new Set(a.map(f=>f.id)),c=o.filter(f=>l.has(f.from)&&l.has(f.to)),h=jt(c,new Set,{byId:d,layerSpacing:s.layerSpacing,padding:s.padding}),p=[...a.map(f=>f.x+f.width),...h.flatMap(f=>f.points.map(m=>m.x))],u=[...a.map(f=>f.y+f.height),...h.flatMap(f=>f.points.map(m=>m.y))],g=Math.max(t.width,Math.max(0,...p)+s.padding),b=Math.max(t.height,Math.max(0,...u)+s.padding);return{width:g,height:b,nodes:a,routes:h}},Hi=(t,e,n={})=>{const o={...xt,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const i=new Set(t.map(d=>d.id)),s=e.filter(d=>i.has(d.from)&&i.has(d.to)),r=Li(t,new Map,new Map,d=>d.position??{x:0,y:0}),a=new Map(r.map(d=>[d.spec.id,d]));return jn(r,jt(s,new Set,{byId:a,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},Yi={kind:"idle"},Ll=t=>({kind:"node",...t,moved:!1,preview:null}),_l=t=>({kind:"group",...t,moved:!1,preview:null}),Rl=(t,e,n,o)=>{if(t.kind==="idle")return t;const i=e.screenX-t.origin.screenX,s=e.screenY-t.origin.screenY;if(!t.moved&&Math.hypot(i,s)<=o)return t;const r=i/n,a=s/n;if(t.kind==="node"){const l={x:Math.max(0,t.start.x+r),y:Math.max(0,t.start.y+a)};return{...t,moved:!0,preview:l}}const d=new Map;for(const[l,c]of t.starts)d.set(l,{x:Math.max(0,c.x+r),y:Math.max(0,c.y+a)});return{...t,moved:!0,preview:d}},Xi=ce({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:t=>`Comment on ${t}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the data.",nodes:"elements",edges:"relations",change:(t,e)=>`\u201C${t}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:t=>`${t}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(t,e)=>`\u300C${t}\u300D\u2192\u300C${e}\u300D`}}),Gi={v:1,overrides:[]},Zn="dpk-layout-change",Al=(t,e)=>t.board===e.board&&t.diagram===e.diagram&&t.node===e.node,Ki=(t,e,n)=>({...t,overrides:[...t.overrides.filter(o=>!Al(o,e)),{...e,position:n}]}),Ol=(t,e)=>e.reduce((n,o)=>Ki(n,o,o.position),t),Nl=(t,e,n)=>new Map(t.overrides.filter(o=>o.board===e&&o.diagram===n).map(o=>[o.node,o.position])),Dl=(t,e,n)=>t.overrides.some(o=>o.board===e&&o.diagram===n),zl=(t,e,n)=>{const o=t.overrides.filter(i=>!(i.board===e&&i.diagram===n));return o.length===t.overrides.length?t:{...t,overrides:o}},Pl=(t,e,n,o)=>{const i=t.overrides.filter(s=>!(s.board===e&&s.diagram===n)||o.has(s.node));return i.length===t.overrides.length?t:{...t,overrides:i}},ql=O({x:le(),y:le()}),Fl=O({board:y(),diagram:y(),node:y(),position:ql}),Bl=O({v:pe(1),overrides:F(Fl)}),ji=t=>{const e=Oe(Bl,t);return e.success?e.output:null},Ul=t=>`dev-process-kit:layout-positions:${t}`,Hl=()=>{const t=typeof location>"u"?"local":`${location.pathname}${location.search}`;return Ul(t)},Yl=()=>Ed(ji),Xl=()=>$d(ji),Gl=t=>t.closest(Td)?.getAttribute(Sd)??"";class Kl{#o;#i;#e=null;#n="";#t=Gi;#a=()=>this.#c();constructor(e,n){this.#o=e,this.#i=n,e.addController(this)}hostConnected(){this.#e=this.#i.persist===!1?Xl():Yl(),this.#n=Hl(),this.#t=this.#e.read(this.#n)??Gi,window.addEventListener(Zn,this.#a)}hostDisconnected(){window.removeEventListener(Zn,this.#a)}get#r(){return Gl(this.#i.host())}get#s(){return this.#i.diagram()}overrides(){return Nl(this.#t,this.#r,this.#s)}hasOverrides(){return Dl(this.#t,this.#r,this.#s)}commit(e,n){this.#t=Ki(this.#t,{board:this.#r,diagram:this.#s,node:e},n),this.#d()}commitMany(e){if(e.size===0)return;const n=[...e].map(([o,i])=>({board:this.#r,diagram:this.#s,node:o,position:i}));this.#t=Ol(this.#t,n),this.#d()}prune(e){const n=Pl(this.#t,this.#r,this.#s,e);n!==this.#t&&(this.#t=n,this.#d())}reset(){const e=zl(this.#t,this.#r,this.#s);e!==this.#t&&(this.#t=e,this.#d())}#d(){this.#e?.write(this.#n,this.#t),this.#o.requestUpdate(),window.dispatchEvent(new CustomEvent(Zn))}#c(){this.#t=this.#e?.read(this.#n)??this.#t,this.#o.requestUpdate()}}const jl=(t,e,n)=>`${t} ${n.node} \xB7 ${e} ${n.edge}`,et=[Md,ri,ai,ae`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
container-type: inline-size;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{az as se,au as le,av as v,aw as E,aa as D,aN as ce,aM as A,aL as l,ac as c,ax as L,ay as S,p as b,a9 as f,t as pe,N as ue,e as B,a5 as ge,S as z,P as $,bf as me,a7 as ve,a6 as be,ai as p,z as he,as as s,aH as ye,aP as ke,I as fe,bg as $e,ah as xe,V as M,bh as we,l as Ee}from"./shared-CXefnQqJ.js";import{o as De}from"./shared-DIHtcDps.js";const h=[1,2,3,4,5,6,7],y=se(h,"a delegation level is an integer from 1 to 7"),k=L(c(),S(1)),Ae=v({player:k,level:y,reason:l(c())}),q=v({title:l(c()),parties:l(v({delegator:l(k),delegate:l(k)})),players:E(D(v({id:A,name:k})),[]),decisions:E(D(v({id:A,name:k,description:l(c()),cards:E(D(Ae),[]),agreed:l(y),questions:ce})),[])}),V=e=>{const a=le(q,e),r=new Set;for(const t of a.players){if(r.has(t.id))throw new Error(`duplicate id "${t.id}" in players`);r.add(t.id)}const o=new Set;for(const t of a.decisions){if(o.has(t.id))throw new Error(`duplicate id "${t.id}" in decisions`);o.add(t.id);const i=new Set;for(const d of t.cards){if(!r.has(d.player))throw new Error(`decision "${t.id}" has a card from unknown player "${d.player}"`);if(i.has(d.player))throw new Error(`player "${d.player}" played more than one card on decision "${t.id}"`);i.add(d.player)}}return a},K=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},F=(e,a)=>e.players.find(r=>r.id===a),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:b("PLAY_CARD","decision",v({level:y})),AGREE_LEVEL:b("AGREE_LEVEL","decision",f({level:y})),ADD_DECISION:b("ADD_DECISION","page",f({id:A,name:L(c(),S(1)),description:l(c())}),{dedupeKey:pe}),SET_DECISION_NAME:b("SET_DECISION_NAME","decision",f({name:L(c(),S(1))})),DELETE_DECISION:b("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},j=(e,a)=>{const r=ue(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return T(e,o,t=>({...t,agreed:r.payload.level}));case"ADD_DECISION":{const t=r.payload;return e.decisions.some(i=>i.id===t.id)?e:C(e).includes(t.id)?null:{...e,decisions:[...e.decisions,{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},cards:[]}]}}case"SET_DECISION_NAME":return T(e,o,t=>({...t,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(t=>t.id===o)?{...e,decisions:e.decisions.filter(t=>t.id!==o)}:null;default:return B(r)}},T=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,H={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},Y={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},Le={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},Se={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ce={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Te={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},_=ge({en:{levelName:e=>H[e],levelPhrase:(e,a,r)=>Le[e](a,r),levelLabel:e=>`${e} ${H[e]}`,statusLabel:e=>Ce[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>Se[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Te[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),P=e=>e==="strict"?"strict":"lax",N=(e,a)=>e==="strict"&&a.yours!==void 0,G=(e,a,r)=>e==="lax"?{kind:"play"}:N(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),J=e=>e.yours!==void 0||e.agreed!==void 0,_e=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(t=>({label:F(a,t.player)?.name??t.player,kind:"player",level:t.level,...t.reason===void 0?{}:{reason:t.reason}}))],Pe=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Ne=(e,a,r,o)=>{const t=_e(e,a,o),i=J(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Pe(o,t),hidden:J(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:N(r,o),...me(o.questions),cells:h.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...w})=>w),yours:o.yours===d,agreed:o.agreed===d}))}},O=(e,a,r)=>{const{delegator:o,delegate:t}=I(e,a);return{levels:h.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Ne(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},U=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},Ie=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),W={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:U(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:U(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:Ie(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},Q=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(W,a.type)?W[a.type]:void 0;t=i?i(e,a,o??r):{title:a.type,tone:"meta"}}catch{t={title:a.type,tone:"meta"}}return{title:t.title,targetLabel:Z(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},X=e=>`${e.type} ${z(e.target)} ${JSON.stringify(e.payload)}`,Z=(e,a,r)=>{switch(r.type){case"decision":{const o=u(a,r.id);return o?`${e.decisionKind} \xB7 ${o.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${R(a)}`;default:return`${r.type} \xB7 ${r.id}`}},ee=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:z({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],R=e=>e.title??"Delegation Poker",ae=(e,a)=>a,re=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},oe=e=>{const a=_(e);return{kind:"view",name:"delegation-poker",label:"Delegation Poker",addable:!1,parseBase:V,emptyBase:K,actions:g,apply:j,hasTarget:re,describe:(r,o,t)=>Q(a,r,o,t),serialize:X,resolveNavigation:ae,commentTargets:(r,o)=>ee(a,r),title:R}},te="dev-process-kit:delegation-poker:skip-strict-confirm",ie=e=>e===!0?!0:null,Oe=e=>{const a=e?ve(ie):be(ie);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Re=(e,a,r,o)=>s`
|
|
1
|
+
import{az as se,au as le,av as v,aw as E,aa as D,aN as ce,aM as A,aL as l,ac as c,ax as L,ay as S,p as b,a9 as f,t as pe,N as ue,e as B,a5 as ge,S as z,P as $,bf as me,a7 as ve,a6 as be,ai as p,z as he,as as s,aH as ye,aP as ke,I as fe,bg as $e,ah as xe,V as M,bh as we,l as Ee}from"./shared-DYDJzB79.js";import{o as De}from"./shared-DMksNmni.js";const h=[1,2,3,4,5,6,7],y=se(h,"a delegation level is an integer from 1 to 7"),k=L(c(),S(1)),Ae=v({player:k,level:y,reason:l(c())}),q=v({title:l(c()),parties:l(v({delegator:l(k),delegate:l(k)})),players:E(D(v({id:A,name:k})),[]),decisions:E(D(v({id:A,name:k,description:l(c()),cards:E(D(Ae),[]),agreed:l(y),questions:ce})),[])}),V=e=>{const a=le(q,e),r=new Set;for(const t of a.players){if(r.has(t.id))throw new Error(`duplicate id "${t.id}" in players`);r.add(t.id)}const o=new Set;for(const t of a.decisions){if(o.has(t.id))throw new Error(`duplicate id "${t.id}" in decisions`);o.add(t.id);const i=new Set;for(const d of t.cards){if(!r.has(d.player))throw new Error(`decision "${t.id}" has a card from unknown player "${d.player}"`);if(i.has(d.player))throw new Error(`player "${d.player}" played more than one card on decision "${t.id}"`);i.add(d.player)}}return a},K=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},F=(e,a)=>e.players.find(r=>r.id===a),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:b("PLAY_CARD","decision",v({level:y})),AGREE_LEVEL:b("AGREE_LEVEL","decision",f({level:y})),ADD_DECISION:b("ADD_DECISION","page",f({id:A,name:L(c(),S(1)),description:l(c())}),{dedupeKey:pe}),SET_DECISION_NAME:b("SET_DECISION_NAME","decision",f({name:L(c(),S(1))})),DELETE_DECISION:b("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},j=(e,a)=>{const r=ue(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return T(e,o,t=>({...t,agreed:r.payload.level}));case"ADD_DECISION":{const t=r.payload;return e.decisions.some(i=>i.id===t.id)?e:C(e).includes(t.id)?null:{...e,decisions:[...e.decisions,{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},cards:[]}]}}case"SET_DECISION_NAME":return T(e,o,t=>({...t,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(t=>t.id===o)?{...e,decisions:e.decisions.filter(t=>t.id!==o)}:null;default:return B(r)}},T=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,H={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},Y={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},Le={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},Se={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ce={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Te={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},_=ge({en:{levelName:e=>H[e],levelPhrase:(e,a,r)=>Le[e](a,r),levelLabel:e=>`${e} ${H[e]}`,statusLabel:e=>Ce[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>Se[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Te[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),P=e=>e==="strict"?"strict":"lax",N=(e,a)=>e==="strict"&&a.yours!==void 0,G=(e,a,r)=>e==="lax"?{kind:"play"}:N(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),J=e=>e.yours!==void 0||e.agreed!==void 0,_e=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(t=>({label:F(a,t.player)?.name??t.player,kind:"player",level:t.level,...t.reason===void 0?{}:{reason:t.reason}}))],Pe=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Ne=(e,a,r,o)=>{const t=_e(e,a,o),i=J(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Pe(o,t),hidden:J(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:N(r,o),...me(o.questions),cells:h.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...w})=>w),yours:o.yours===d,agreed:o.agreed===d}))}},O=(e,a,r)=>{const{delegator:o,delegate:t}=I(e,a);return{levels:h.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Ne(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},U=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},Ie=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),W={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:U(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:U(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:Ie(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},Q=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(W,a.type)?W[a.type]:void 0;t=i?i(e,a,o??r):{title:a.type,tone:"meta"}}catch{t={title:a.type,tone:"meta"}}return{title:t.title,targetLabel:Z(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},X=e=>`${e.type} ${z(e.target)} ${JSON.stringify(e.payload)}`,Z=(e,a,r)=>{switch(r.type){case"decision":{const o=u(a,r.id);return o?`${e.decisionKind} \xB7 ${o.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${R(a)}`;default:return`${r.type} \xB7 ${r.id}`}},ee=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:z({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],R=e=>e.title??"Delegation Poker",ae=(e,a)=>a,re=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},oe=e=>{const a=_(e);return{kind:"view",name:"delegation-poker",label:"Delegation Poker",addable:!1,parseBase:V,emptyBase:K,actions:g,apply:j,hasTarget:re,describe:(r,o,t)=>Q(a,r,o,t),serialize:X,resolveNavigation:ae,commentTargets:(r,o)=>ee(a,r),title:R}},te="dev-process-kit:delegation-poker:skip-strict-confirm",ie=e=>e===!0?!0:null,Oe=e=>{const a=e?ve(ie):be(ie);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Re=(e,a,r,o)=>s`
|
|
2
2
|
<button
|
|
3
3
|
class="dpk-icon-btn"
|
|
4
4
|
type="button"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ai as r}from"./shared-DYDJzB79.js";const t=o=>o??r;export{t as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a5 as S,au as T,av as s,aw as o,aa as _,ac as l,aM as x,ax as B,ay as E,S as $,V as j}from"./shared-
|
|
1
|
+
import{a5 as S,au as T,av as s,aw as o,aa as _,ac as l,aM as x,ax as B,ay as E,S as $,V as j}from"./shared-DYDJzB79.js";const r=S({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),k=s({id:x,title:B(l(),E(1))}),c=s({title:o(l(),""),sections:o(_(k),[])}),p=t=>{const e=T(c,t),i=new Set;for(const a of e.sections){if(i.has(a.id))throw new Error(`duplicate section id: ${a.id}`);i.add(a.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),n=(t,e)=>t.sections.find(i=>i.id===e),u=t=>t.title===""?"Plain":t.title,g=(t,e,i)=>{switch(i.type){case"section":return n(e,i.id)?.title??i.id;case"page":return t.wholePage;default:return i.id}},m=(t,e,i)=>({title:e.type,targetLabel:g(t,i,e.target),tone:"meta"}),f=t=>`${t.type} ${$(t.target)} ${JSON.stringify(t.payload)}`,w=(t,e)=>e.sections.map(i=>({value:`section:${i.id}`,label:i.title,group:t.sectionGroup})),y=(t,e)=>e,h=(t,e)=>{switch(e.type){case"section":return n(t,e.id)!==void 0;case"page":return!0;default:return!1}},P=t=>{const e=r(t);return{kind:"view",name:"plain",label:"Plain",addable:!1,parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:h,describe:(i,a)=>m(e,i,a),serialize:f,resolveNavigation:y,commentTargets:i=>w(e,i),title:u}};class b extends j{definitionFor(e){return P(e)}renderRegions(e){return{}}}const v=()=>{customElements.get("dpk-view-plain")||customElements.define("dpk-view-plain",b)},M=Object.freeze(Object.defineProperty({__proto__:null,DpkViewPlain:b,definePlainElement:v,describePlainAction:m,emptyPlainBase:d,findSection:n,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:w,plainDefinitionFor:P,plainHasTarget:h,plainMessages:r,plainTargetLabel:g,plainTitle:u,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{v as d,M as i};
|
|
@@ -1703,7 +1703,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1703
1703
|
</div>
|
|
1704
1704
|
`)}
|
|
1705
1705
|
</div>
|
|
1706
|
-
`}#p(e,n){if(n.disabled)return;if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const r=e.key==="ArrowDown"?1:-1;if(this.#n)this.#i=Uf(this.#i,r,n.options.length);else{this.#n=!0;const o=Zn(n.options,n.value);this.#i=o>=0?o:fi(r>0?0:n.options.length-1,n.options.length)}this.#e.requestUpdate();return}if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),!this.#n){this.#n=!0,this.#i=Zn(n.options,n.value),this.#e.requestUpdate();return}const r=n.options[fi(this.#i,n.options.length)];r&&this.#k(r.value,n);return}if(e.key==="Tab"||e.ctrlKey||e.metaKey||e.altKey||e.key.length!==1)return;e.preventDefault(),this.#r+=e.key,clearTimeout(this.#o),this.#o=setTimeout(()=>{this.#r=""},Bf);const s=this.#n?this.#i:Zn(n.options,n.value),i=Hf(n.options,this.#r,s);if(i!==null){if(this.#i=i,!this.#n){const r=n.options[i]?.value;r!==void 0&&this.#k(r,n);return}this.#e.requestUpdate()}}#h=()=>{if(this.#a?.disabled)return;if(this.#n){this.#m();return}const e=this.#a;this.#n=!0,this.#i=e?Zn(e.options,e.value):-1,this.#e.requestUpdate()};#k(e,n){this.#m(),e!==n.value&&n.onChange(e)}#m(){this.#n&&(this.#n=!1,this.#i=-1,this.#e.requestUpdate())}#y(){const e=`[data-dpk-select="${this.#s}"]`,n=this.#e.renderRoot.querySelector(`button.dpk-rich-select${e}`),s=this.#e.renderRoot.querySelector(`.dpk-rich-select-listbox${e}`);!n||!s||this.#t.open(s,n,{width:Math.max(n.offsetWidth,160),height:280},{placement:"bottom-start"})}}class Ff{#e;#s=new Map;constructor(e){this.#e=e}get(e){const n=this.#s.get(e);if(n)return n;const s=new Kt(this.#e);return this.#s.set(e,s),s}}const fe="0.3.0
|
|
1706
|
+
`}#p(e,n){if(n.disabled)return;if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const r=e.key==="ArrowDown"?1:-1;if(this.#n)this.#i=Uf(this.#i,r,n.options.length);else{this.#n=!0;const o=Zn(n.options,n.value);this.#i=o>=0?o:fi(r>0?0:n.options.length-1,n.options.length)}this.#e.requestUpdate();return}if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),!this.#n){this.#n=!0,this.#i=Zn(n.options,n.value),this.#e.requestUpdate();return}const r=n.options[fi(this.#i,n.options.length)];r&&this.#k(r.value,n);return}if(e.key==="Tab"||e.ctrlKey||e.metaKey||e.altKey||e.key.length!==1)return;e.preventDefault(),this.#r+=e.key,clearTimeout(this.#o),this.#o=setTimeout(()=>{this.#r=""},Bf);const s=this.#n?this.#i:Zn(n.options,n.value),i=Hf(n.options,this.#r,s);if(i!==null){if(this.#i=i,!this.#n){const r=n.options[i]?.value;r!==void 0&&this.#k(r,n);return}this.#e.requestUpdate()}}#h=()=>{if(this.#a?.disabled)return;if(this.#n){this.#m();return}const e=this.#a;this.#n=!0,this.#i=e?Zn(e.options,e.value):-1,this.#e.requestUpdate()};#k(e,n){this.#m(),e!==n.value&&n.onChange(e)}#m(){this.#n&&(this.#n=!1,this.#i=-1,this.#e.requestUpdate())}#y(){const e=`[data-dpk-select="${this.#s}"]`,n=this.#e.renderRoot.querySelector(`button.dpk-rich-select${e}`),s=this.#e.renderRoot.querySelector(`.dpk-rich-select-listbox${e}`);!n||!s||this.#t.open(s,n,{width:Math.max(n.offsetWidth,160),height:280},{placement:"bottom-start"})}}class Ff{#e;#s=new Map;constructor(e){this.#e=e}get(e){const n=this.#s.get(e);if(n)return n;const s=new Kt(this.#e);return this.#s.set(e,s),s}}const fe="0.3.0",mi=t=>{const e=t.derivation();return{base:e.base,state:e.state,navigation:t.navigation(),actions:t.controller().actions,comments:e.comments,stale:e.stale,issues:t.issues(),grill:e.grill,answers:e.answers}},Gf=t=>{const e=t.derivation();return{state:e.state,base:e.base,navigation:t.navigation(),actions:t.controller().actions,comments:e.comments,stale:e.stale,commentCount:n=>{const s=typeof n=="string"?n:P(n);return e.commentsByTarget.get(s)?.length??0},dispatch:n=>t.dispatch(n),dispatchBatch:n=>t.dispatchBatch(n),navigate:(n,s)=>t.navigate(n,s),hashFor:n=>t.hashFor(n),requestComment:n=>t.requestComment(n)}},el=(t,e)=>{const n=()=>mi(t);return{version:fe,template:t.definition.name,host:e,ready:t.ready,get base(){return t.controller().base},get state(){return t.derivation().state},get navigation(){return t.navigation()},get actions(){return t.controller().actions},get comments(){return t.derivation().comments},get stale(){return t.derivation().stale},get issues(){return t.issues()},dispatch:s=>t.dispatch(s),dispatchBatch:s=>t.dispatchBatch(s),comment:(s,i)=>t.dispatch({type:H,target:s,payload:{body:i}}),editComment:(s,i)=>t.editComment(s,i),removeAction:s=>t.removeAction(s),clearActions:()=>t.clearActions(),importDraft:s=>t.controller().replaceActions(s),navigate:(s,i)=>t.navigate(s,i),hashFor:s=>t.hashFor(s),snapshot:n,exportDraft:()=>t.controller().exportDraft(fe),exportBrief:()=>t.brief?.(n())??Un(n(),t.controller().definition,fe),subscribe:s=>t.subscribe(s)}},Wf='the <script type="application/json"> child is empty',Kf='no <script type="application/json"> child found';class Vf{#e;#s;#t=null;#n;constructor(e){this.#e=e}get error(){return this.#t}read(){return this.#o(this.#r()).state}observe(){this.#n===void 0&&(this.#n=new MutationObserver(()=>this.#i()),this.#n.observe(this.#e.host,{childList:!0,subtree:!0,characterData:!0}))}disconnect(){this.#n?.disconnect(),this.#n=void 0}#i(){const e=this.#r();e!==this.#s&&this.#e.onChange(this.#o(e))}#r(){const e=this.#e.script();return e===null?null:e.textContent??""}#o(e){if(this.#s=e,e===null||e.trim().length===0)return this.#e.optional()?this.#t=null:(this.#t=e===null?Kf:Wf,console.warn(`[dev-process-kit] ${this.#e.name()} has ${e===null?"no":"an empty"} base JSON; starting from an empty state.`)),{state:this.#e.empty(),error:this.#t};try{const n=this.#e.parse(JSON.parse(e));return this.#t=null,{state:n,error:null}}catch(n){return console.error("[dev-process-kit] invalid base data:",n),this.#t=n instanceof Error?n.message:String(n),{state:this.#e.empty(),error:this.#t}}}}const Yf=8e3,Zf=t=>t.localName==="script"&&t.getAttribute("type")==="application/json"&&t.hasAttribute(Qr);class Qf{#e;#s;#t=null;#n=null;#i=null;#r=null;#o="";#a=null;#l=new Map;#d=new Set;constructor(e,n){this.#e=e,this.#s=n,e.addController(this)}get view(){return this.#t&&this.#i?jp(this.#t,this.#i):null}get log(){return this.#t}get error(){return this.#n}hostConnected(){!this.#p()&&!this.#h()&&this.#y(),document.addEventListener("pointerdown",this.#f,!0),document.addEventListener("keydown",this.#w)}hostUpdate(){!this.#p()&&this.#h()&&this.#b()}hostDisconnected(){this.#b(),document.removeEventListener("pointerdown",this.#f,!0),document.removeEventListener("keydown",this.#w);for(const e of this.#l.values())e.handle!==null&&clearTimeout(e.handle);this.#l.clear()}send(e){!this.#t||!this.#i||(this.#i=Ip(this.#t,this.#i,e),this.#k(),this.#v(),this.#e.requestUpdate())}toggleList(){this.send({kind:this.#i?.list.open?"close-list":"open-list"})}show(e){const n=this.#t?st(this.#t).flatMap(s=>s.entries).find(s=>s.key===e):void 0;n&&(this.send({kind:"jump",key:e}),this.#s.show(n))}pause(e){const n=this.#d.size>0;if(this.#d.add(e),n)return;const s=Date.now();for(const i of this.#l.values())i.handle!==null&&clearTimeout(i.handle),i.handle=null,i.remaining=Math.max(0,i.deadline-s)}resume(e){if(!(!this.#d.delete(e)||this.#d.size>0))for(const[n,s]of this.#l)this.#u(n,s)}#c(){return`${this.#s.storageKey()}:seen-changes`}#p(){return this.#t!==null||this.#n!==null}#h(){const e=[...this.#e.children].find(Zf);if(!e)return!1;let n;try{n=JSON.parse(e.textContent??"")}catch(i){return this.#m(i instanceof Error?i.message:String(i))}const s=Pp(n);return s.ok?(this.#t=s.log,this.#r=this.#s.persist()?ge(Jr):Q(Jr),this.#i=Dp(s.log,this.#r.read(this.#c())),this.#k(),this.#v(),this.#e.requestUpdate(),!0):this.#m(s.error)}#k(){if(!this.#t||!this.#i)return;const e=qp(this.#t,this.#i),n=JSON.stringify(e);n!==this.#o&&(this.#o=n,this.#r?.write(this.#c(),e))}#m(e){return console.error("[dev-process-kit] invalid change log:",e),this.#n=e,this.#e.requestUpdate(),!0}#y(){this.#a=new MutationObserver(()=>{(this.#p()||this.#h())&&this.#b()}),this.#a.observe(this.#e,{childList:!0})}#b(){this.#a?.disconnect(),this.#a=null}#v(){const e=new Set(this.view?.toasts.map(n=>n.key)??[]);for(const[n,s]of this.#l)e.has(n)||(s.handle!==null&&clearTimeout(s.handle),this.#l.delete(n));for(const n of e){if(this.#l.has(n))continue;const s={handle:null,deadline:0,remaining:Yf};this.#l.set(n,s),this.#d.size===0&&this.#u(n,s)}}#u(e,n){n.deadline=Date.now()+n.remaining,n.handle=setTimeout(()=>{n.handle=null,this.send({kind:"close-toast",key:e})},n.remaining)}#f=e=>{!this.#i?.list.open||this.#s.inside(e.composedPath())||this.send({kind:"close-list"})};#w=e=>{e.key!=="Escape"||!this.#i?.list.open||this.send({kind:"close-list"})}}const{I:Xf}=Yc,tl=t=>t,Jf=t=>t.strings===void 0,nl=()=>document.createComment(""),Vt=(t,e,n)=>{const s=t._$AA.parentNode,i=e===void 0?t._$AB:e._$AA;if(n===void 0){const r=s.insertBefore(nl(),i),o=s.insertBefore(nl(),i);n=new Xf(r,o,t,t.options)}else{const r=n._$AB.nextSibling,o=n._$AM,a=o!==t;if(a){let l;n._$AQ?.(t),n._$AM=t,n._$AP!==void 0&&(l=t._$AU)!==o._$AU&&n._$AP(l)}if(r!==i||a){let l=n._$AA;for(;l!==r;){const c=tl(l).nextSibling;tl(s).insertBefore(l,i),l=c}}}return n},We=(t,e,n=t)=>(t._$AI(e,n),t),em={},ki=(t,e=em)=>t._$AH=e,tm=t=>t._$AH,bi=t=>{t._$AR(),t._$AA.remove()},sl=(t,e,n)=>{const s=new Map;for(let i=e;i<=n;i++)s.set(t[i],i);return s},Ke=Ft(class extends Hn{constructor(t){if(super(t),t.type!==we.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let s;n===void 0?n=e:e!==void 0&&(s=e);const i=[],r=[];let o=0;for(const a of t)i[o]=s?s(a,o):o,r[o]=n(a,o),o++;return{values:r,keys:i}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,s]){const i=tm(t),{values:r,keys:o}=this.dt(e,n,s);if(!Array.isArray(i))return this.ut=o,r;const a=this.ut??=[],l=[];let c,d,h=0,f=i.length-1,p=0,g=r.length-1;for(;h<=f&&p<=g;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===o[p])l[p]=We(i[h],r[p]),h++,p++;else if(a[f]===o[g])l[g]=We(i[f],r[g]),f--,g--;else if(a[h]===o[g])l[g]=We(i[h],r[g]),Vt(t,l[g+1],i[h]),h++,g--;else if(a[f]===o[p])l[p]=We(i[f],r[p]),Vt(t,i[h],i[f]),f--,p++;else if(c===void 0&&(c=sl(o,p,g),d=sl(a,h,f)),c.has(a[h]))if(c.has(a[f])){const u=d.get(o[p]),m=u!==void 0?i[u]:null;if(m===null){const x=Vt(t,i[h]);We(x,r[p]),l[p]=x}else l[p]=We(m,r[p]),Vt(t,i[h],m),i[u]=null;p++}else bi(i[f]),f--;else bi(i[h]),h++;for(;p<=g;){const u=Vt(t,l[g+1]);We(u,r[p]),l[p++]=u}for(;h<=f;){const u=i[h++];u!==null&&bi(u)}return this.ut=o,ki(t,l),Y}}),Qn="dpk-changes",nm=(t,e,n)=>{const s=t.unread>0?e.changesUnread(t.unread):e.changes;return k`<button
|
|
1707
1707
|
class="dpk-chrome-action dpk-bell"
|
|
1708
1708
|
type="button"
|
|
1709
1709
|
aria-controls=${Qn}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{au as X,av as $,aw as p,aa as S,ac as u,aM as ee,ax as te,ay as ie,az as se,p as ne,a9 as ae,a5 as oe,S as g,C as E,h as re,aH as T,ai as d,as as r,by as de,aZ as le,b5 as ce,y as N,ah as pe,V as C}from"./shared-
|
|
1
|
+
import{au as X,av as $,aw as p,aa as S,ac as u,aM as ee,ax as te,ay as ie,az as se,p as ne,a9 as ae,a5 as oe,S as g,C as E,h as re,aH as T,ai as d,as as r,by as de,aZ as le,b5 as ce,y as N,ah as pe,V as C}from"./shared-DYDJzB79.js";import{a as ue}from"./shared-FMBoDqPg.js";const P=["title","section","content"],he=$({id:ee,layout:p(se(P),"content"),title:te(u(),ie(1)),subtitle:p(u(),""),points:p(S(u()),[]),notes:p(u(),"")}),q=$({title:p(u(),""),slides:p(S(he),[])}),A=t=>{const e=X(q,t),i=new Set;for(const s of e.slides){if(i.has(s.id))throw new Error(`duplicate slide id: ${s.id}`);i.add(s.id)}return{title:e.title,slides:e.slides}},z=()=>({title:"",slides:[]}),l=(t,e)=>e===void 0?-1:t.slides.findIndex(i=>i.id===e),D=(t,e)=>t.slides[l(t,e)],c="SET_SLIDE_NOTES",me=ae({notes:u()}),b={[c]:ne(c,"slide",me)},H={setNotes:(t,e)=>({type:c,target:{type:"slide",id:t},payload:{notes:e}})},M=(t,e)=>{switch(e.type){case c:{if(e.target.type!=="slide")return null;const i=l(t,e.target.id);if(i===-1)return null;const s=b[c].parse(e);if(s===null)return null;const{notes:a}=s.payload;return{...t,slides:t.slides.map((n,o)=>o===i?{...n,notes:a}:n)}}default:return null}},v=oe({en:{wholeDeck:"Whole deck",slideGroup:"Slide",outline:"Slides",previous:"Previous slide",next:"Next slide",position:(t,e)=>`Slide ${t} of ${e}`,present:"Present",presentation:"Presentation",exitPresentation:"Exit presentation",speakerNotes:"Speaker notes",speakerNotesHint:"Only the presenter sees these. They are never projected.",speakerNotesPlaceholder:"What to say on this slide",saveNotes:"Save notes",commentOnSlide:"Comment on this slide",commentPlaceholder:"A question, or what should change (passed to the agent)",addComment:"Add comment",deleteComment:"Delete this comment",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"Full screen",fullscreenHint:"\u2190 \u2192 to move \xB7 Esc to leave",noSlidesBefore:"There are no slides yet. Add them to ",noSlidesAfter:" in the base data."},ja:{wholeDeck:"\u30C7\u30C3\u30AD\u5168\u4F53",slideGroup:"\u30B9\u30E9\u30A4\u30C9",outline:"\u30B9\u30E9\u30A4\u30C9",previous:"\u524D\u306E\u30B9\u30E9\u30A4\u30C9",next:"\u6B21\u306E\u30B9\u30E9\u30A4\u30C9",position:(t,e)=>`${e} \u679A\u4E2D ${t} \u679A\u76EE`,present:"\u30D7\u30EC\u30BC\u30F3",presentation:"\u30D7\u30EC\u30BC\u30F3\u8868\u793A",exitPresentation:"\u30D7\u30EC\u30BC\u30F3\u3092\u7D42\u4E86",speakerNotes:"\u30B9\u30D4\u30FC\u30AB\u30FC\u30CE\u30FC\u30C8",speakerNotesHint:"\u767A\u8868\u8005\u3060\u3051\u306B\u898B\u3048\u307E\u3059\u3002\u30B9\u30E9\u30A4\u30C9\u306B\u306F\u6295\u5F71\u3055\u308C\u307E\u305B\u3093\u3002",speakerNotesPlaceholder:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u3067\u8A71\u3059\u3053\u3068",saveNotes:"\u30CE\u30FC\u30C8\u3092\u4FDD\u5B58",commentOnSlide:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u306B\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u8CEA\u554F\u3084\u3001\u5909\u3048\u3066\u307B\u3057\u3044\u3053\u3068\uFF08Agent \u306B\u6E21\u308B\uFF09",addComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",deleteComment:"\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"\u5168\u753B\u9762\u8868\u793A",fullscreenHint:"\u2190 \u2192 \u3067\u79FB\u52D5 \xB7 Esc \u3067\u623B\u308B",noSlidesBefore:"\u30B9\u30E9\u30A4\u30C9\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base data \u306E ",noSlidesAfter:" \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),f="present",k="1",m=t=>t[f]===k,O=t=>({[f]:t?k:null}),j=t=>t.title===""?"Slides":t.title,x=(t,e)=>`${e+1}. ${t.title}`,F=(t,e,i)=>{switch(i.type){case"slide":{const s=l(e,i.id),a=e.slides[s];return a===void 0?i.id:x(a,s)}case"page":return t.wholeDeck;default:return i.id}},L=(t,e,i)=>{const s=F(t,i,e.target);return e.type===c?{title:t.speakerNotes,targetLabel:s,tone:"update"}:{title:e.type,targetLabel:s,tone:"meta"}},_=t=>`${t.type} ${g(t.target)} ${JSON.stringify(t.payload)}`,K=(t,e)=>e.slides.map((i,s)=>({value:g({type:"slide",id:i.id}),label:x(i,s),group:t.slideGroup})),R=(t,e,i)=>{const s=l(e,i.slide),a=e.slides[s];return a===void 0?null:{value:g({type:"slide",id:a.id}),label:x(a,s),group:t.slideGroup}},B=(t,e)=>{const i=t.slides[l(t,e.slide)]??t.slides[0],s={...e};return i?s.slide=i.id:delete s.slide,(i===void 0||!m(e))&&delete s[f],s},w=(t,e)=>{const i=l(t,e.slide),s=i===-1?0:i,a=t.slides[s];return a===void 0?null:{slide:a,index:s,total:t.slides.length,previous:t.slides[s-1],next:t.slides[s+1]}},ge=(t,e)=>t.filter(i=>i.type===E&&i.target.type==="slide"&&i.target.id===e).map(i=>({id:i.id,body:re(i)})).filter(i=>i.body!==""),G=(t,e)=>{switch(e.type){case"slide":return D(t,e.id)!==void 0;case"page":return!0;default:return!1}},I=t=>{const e=v(t);return{kind:"view",name:"slides",label:"Slides",addable:!1,parseBase:A,emptyBase:z,actions:b,apply:M,hasTarget:G,describe:(i,s)=>L(e,i,s),serialize:_,resolveNavigation:B,navigationFor:(i,s)=>s.type==="slide"?{slide:s.id}:null,commentTargets:i=>K(e,i),currentTarget:(i,s)=>R(e,i,s),title:j}},fe={ArrowRight:"next",PageDown:"next",ArrowLeft:"previous",PageUp:"previous",Home:"first",End:"last"},U=t=>t.altKey===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0?null:fe[t.key]??null,Y=(t,e,i)=>{const s=t.slides.length-1;if(s<0)return;const a=Math.max(l(t,e),0),n={next:Math.min(a+1,s),previous:Math.max(a-1,0),first:0,last:s}[i];return t.slides[n]?.id},be=(t,e)=>{const{state:i,navigation:s}=t,a=s.slide;return r`
|
|
2
2
|
<nav class="outline" aria-label=${e.outline}>
|
|
3
3
|
<div class="outline-head">
|
|
4
4
|
<span class="dpk-label">${e.outline}</span>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a5 as d,au as p,av as a,aw as f,ac as l,aa as b,ax as o,ay as n,ak as v,X as k,j as m,ah as g,al as y,aF as q,as as r}from"./shared-
|
|
1
|
+
import{a5 as d,au as p,av as a,aw as f,ac as l,aa as b,ax as o,ay as n,ak as v,X as k,j as m,ah as g,al as y,aF as q,as as r}from"./shared-DYDJzB79.js";import{o as C}from"./shared-D4PPk0Dk.js";const h=d({en:{fallbackLabel:"Select",required:"Choose one."},ja:{fallbackLabel:"\u9078\u629E",required:"\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),S=a({value:o(l(),n(1)),label:o(l(),n(1))}),w=a({options:b(S),value:f(l())}),c=i=>{const e=p(w,i),t=new Set;for(const s of e.options){if(t.has(s.value))throw new Error(`duplicate option value: ${s.value}`);t.add(s.value)}return{options:e.options,value:e.value??null}};class u extends v{static{this.formAssociated=!0}static{this.styles=[k,m,g`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ah as e,bA as t,bB as o,bC as n}from"./shared-
|
|
1
|
+
import{ah as e,bA as t,bB as o,bC as n}from"./shared-DYDJzB79.js";import{a as d,c as i}from"./shared-TtB-p2Zh.js";import{m as p}from"./shared-B_Tiv_T3.js";const r=e`
|
|
2
2
|
/*
|
|
3
3
|
* A chart: a framed plot with its head above it. CSS only — the author draws
|
|
4
4
|
* the SVG and this styles it, so a line chart reads as the kit's own: rules
|