dev-process-kit 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/boards.js +1 -1
  2. package/dist/chunks/{shared-Dd8JfvQe.js → shared-8-7i0SJv.js} +16 -16
  3. package/dist/chunks/shared-B3gYWxeF.js +1 -0
  4. package/dist/chunks/{shared-ubG0-RQ-.js → shared-BAlmAjut.js} +2 -2
  5. package/dist/chunks/{shared-CF2_VP2x.js → shared-C9Mo56gs.js} +13 -13
  6. package/dist/chunks/{shared-2OsWmhrI.js → shared-CLrs15X7.js} +1 -1
  7. package/dist/chunks/{shared-Dn92ukYW.js → shared-CMe6_Sdn.js} +1 -1
  8. package/dist/chunks/shared-CVEzSR4J.js +3 -0
  9. package/dist/chunks/{shared-Dql0ZVdC.js → shared-CkaifYF3.js} +9 -9
  10. package/dist/chunks/{shared-Be43xweD.js → shared-ComyWGLL.js} +2 -2
  11. package/dist/chunks/{shared-CeCpFPDQ.js → shared-D-lFQPYy.js} +37 -37
  12. package/dist/chunks/{shared-B8ZhyjWv.js → shared-D7lvvzdN.js} +444 -316
  13. package/dist/chunks/shared-DIYD6Tuj.js +1 -0
  14. package/dist/chunks/{shared-DJtGS7Ct.js → shared-DTIEx3lM.js} +22 -22
  15. package/dist/chunks/{shared-DIEJ9E2G.js → shared-DpOLnWXG.js} +62 -62
  16. package/dist/chunks/{shared-C0M3Ib7z.js → shared-DstEY0ER.js} +1 -1
  17. package/dist/chunks/{shared-egtdNQhY.js → shared-DvpWdbzP.js} +20 -20
  18. package/dist/chunks/shared-MI4Xe0aq.js +1868 -0
  19. package/dist/chunks/{shared-BXywwm1a.js → shared-ZjHQZcxc.js} +397 -373
  20. package/dist/components.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/sync.js +1 -0
  23. package/dist/views/delegation-poker.js +1 -1
  24. package/dist/views/plain.js +1 -1
  25. package/dist/views/prototype.js +1 -1
  26. package/dist/views/slides.js +1 -1
  27. package/dist/views/task-board.js +1 -1
  28. package/dist/views/usm.js +1 -1
  29. package/package.json +2 -1
  30. package/dist/chunks/shared-B57TT0rn.js +0 -1
  31. package/dist/chunks/shared-C89fKgKG.js +0 -1868
  32. package/dist/chunks/shared-LHG2FbnK.js +0 -1
@@ -1,4 +1,4 @@
1
- import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah as T,al as R,b3 as Ps,H as Is,b4 as Xt,b5 as Os,b6 as Us,au as B,a9 as kt,aw as u,b7 as Yt,aa as w,aY as vt,a8 as Zt,aD as Jt,ac as b,aL as Fs,ad as dt,aO as Qt,az as st,aH as F,b8 as te,av as y,ax as $,a$ as xt,ay as E,aM as W,aB as at,aj as I,aC as ee,ab as V,aA as se,ag as yt,ar as ae,aZ as Hs,aX as ne,b9 as _s,aW as wt,ba as Bs,bb as ie,bc as ct,z as Ns,bd as re,aG as Ws,a_ as Gs,y as Ks,be as Vs,_ as Xs,$ as Ys}from"./shared-B8ZhyjWv.js";import{o as N,r as Zs}from"./shared-D4PPk0Dk.js";import{e as Js}from"./shared-2OsWmhrI.js";import{a as oe,c as Qs}from"./shared-C0M3Ib7z.js";import{c as ta}from"./shared-Dn92ukYW.js";import{p as ea,i as sa,r as aa,c as na,a as le,b as de,d as ia,e as ra,f as oa,h as ce,g as la,j as $t,s as da,k as ca,l as pa,m as ha,n as ua,t as ma}from"./shared-Dql0ZVdC.js";import{B as ga,t as fa,v as ba,i as ka,k as va,j as xa}from"./shared-Dd8JfvQe.js";import{d as ya}from"./shared-ubG0-RQ-.js";class pt{#n;#t;#e=null;#s=null;#a=null;#i=null;#r=new Map;#o=null;constructor(t){this.#n=t,this.#t=new bt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#a=e,this.#i=s??null,this.#o=null,this.#n.requestUpdate()}close(){this.#e=null,this.#a=null,this.#i=null,this.#n.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#s!==this.#e;this.#s=this.#e,!(t===null||this.#a===null||this.#e===null)&&(this.#t.open(t,this.#a,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}render(t){const e=this.#e;if(e===null)return h;const s=ea(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return r`${sa(e,aa(na(t.locale),s,n=>this.#l(e,t.submit,n)))}`}#l(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#n.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#n.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const Ct=(a,t,e,s)=>{if(a===null)return null;const n=qs(a),i=t.find(d=>d.value===n);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(n,i.label)}]}},ht=.08,pe=1.8,he=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...a.map(i=>i.x)),e=Math.min(...a.map(i=>i.y)),s=Math.max(...a.map(i=>i.x+i.width))-t,n=Math.max(...a.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-n*.1,width:s*1.2,height:n*1.2}},ue=(a,t)=>a+t/12,wa=(a,t)=>{if(a.length===0)return null;const e=Math.min(...a.map(n=>n.y)),s=a.filter(n=>n.y<e+t);return{x:Math.min(...s.map(n=>n.x)),y:e}},St=16,$a=.8,ut=(a,t,e,s,n)=>a==="start"?St-ue(t,e)*s:(n-e*s)/2-t*s,me=(a,t,e,s,n="center")=>{if(t.width===0||t.height===0)return{...a,x:0,y:0};const i=(d,l,o,m)=>{const p=o*a.scale,f=m*$a;if(p<=m){const S=ut(n,l,o,a.scale,m);return G(d,S-f,S+f)}return G(d,m-(l+o)*a.scale-f,-l*a.scale+f)};return{...a,x:i(a.x,t.x,t.width,e),y:i(a.y,t.y,t.height,s)}},Ca=(a,t,e,s,n,i,d="center")=>{const l=Math.abs(i)>Math.abs(n);if(l&&t.height*a.scale<=s)return null;const o=me({...a,x:a.x-n,y:a.y-i},t,e,s,d);return l&&o.y===a.y?null:o},Sa=a=>Math.exp(-a*.01),ge='button,[role="button"],a,input,textarea,select',Et=(a,t,e)=>{for(const s of a.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},Ea=a=>{const{canvas:t,world:e,onClearSelection:s,onView:n,align:i="center",sizeWorld:d=!0}=a;let l={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const m=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),p=()=>{const{width:c,height:g}=m();o=me(o,l,c,g,i),e.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/o.scale)),e.style.setProperty("--dpk-zoom-scale",String(o.scale)),n?.(o)},f=()=>{const{width:c,height:g}=m(),k=l.width/1.2||1,x=l.height/1.2||1,C=G(Math.min((c-24)/k,(g-40)/x),ht,1);o={scale:C,x:ut(i,l.x,l.width,C,c),y:ut(i,l.y,l.height,C,g)},p()},S=c=>{const{width:g,height:k}=m(),x=he([c]),C=x.width/1.2||1,L=x.height/1.2||1;o={...o,scale:G(Math.min((g-24)/C,(k-40)/L),ht,pe)},o={...o,x:(g-x.width*o.scale)/2-x.x*o.scale,y:(k-x.height*o.scale)/2-x.y*o.scale},p()},O=()=>{const{width:c}=m(),g=l.width/1.2||1,k=G((c-24)/g,ht,1);o={scale:k,x:(c-l.width*k)/2-l.x*k,y:16},p()},lt=c=>{const{width:g,height:k}=m(),x=(C,L,Kt,Vt)=>Vt!==void 0?St-Vt:L<=Kt?ut(i,C,L,1,Kt):St-ue(C,L);o={scale:1,x:x(l.x,l.width,g,c?.x),y:x(l.y,l.height,k,c?.y)},p()},_=(c,g=m().width/2,k=m().height/2)=>{const x=o.scale,C=G(x*c,ht,pe);C!==x&&(o={scale:C,x:g-(g-o.x)*C/x,y:k-(k-o.y)*C/x},p())},Q=c=>{if(Et(c,t,".diagram-zoom")!==null)return;const g=c.deltaMode===1?16:c.deltaMode===2?m().height:1;if(c.ctrlKey||c.metaKey){c.preventDefault();const L=t.getBoundingClientRect();_(Sa(c.deltaY),c.clientX-L.left,c.clientY-L.top);return}const{width:k,height:x}=m(),C=Ca(o,l,k,x,c.deltaX*g,c.deltaY*g,i);C!==null&&(c.preventDefault(),o=C,p())},q=new Map;let A=null,P=!1;const U=()=>{const c=[...q.values()],g=c[0];if(!g)return null;const k=c[1];return k?{x:(g.x+k.x)/2,y:(g.y+k.y)/2,distance:Math.hypot(k.x-g.x,k.y-g.y)}:{...g,distance:0}},tt=c=>{q.size===0&&(P=!1);const g=Et(c,t,ge);c.button!==0||c.pointerType!=="touch"&&g!==null||(q.set(c.pointerId,{x:c.clientX,y:c.clientY}),A=U(),g===null&&t.setPointerCapture(c.pointerId),c.pointerType!=="touch"&&g===null&&(c.preventDefault(),t.focus({preventScroll:!0})))},Ht=c=>{if(!q.has(c.pointerId)||A===null)return;q.set(c.pointerId,{x:c.clientX,y:c.clientY});const g=U();if(g===null)return;const k=g.x-A.x,x=g.y-A.y;if((Math.abs(k)+Math.abs(x)>1||Math.abs(g.distance-A.distance)>1)&&(P=!0),g.distance>0&&A.distance>0){const C=t.getBoundingClientRect();_(Math.pow(g.distance/A.distance,.45),A.x-C.left,A.y-C.top)}o={...o,x:o.x+k,y:o.y+x},p(),A=g,t.classList.toggle("is-panning",P)},et=c=>{q.delete(c.pointerId),A=U(),!(q.size>0)&&(t.classList.remove("is-panning"),c.type==="pointercancel"&&(P=!1))},_t=c=>{P&&(c.preventDefault(),c.stopPropagation()),et(c)},Bt=c=>{if(P){c.preventDefault(),c.stopPropagation(),P=!1;return}!(c.target instanceof Element)||Et(c,t,ge)!==null||s()},Nt=c=>{if(c.target!==t)return;const g=30;if(c.key==="+"||c.key==="=")_(1.1);else if(c.key==="-")_(1/1.1);else if(c.key==="0")f();else if(c.key==="Escape"){if(s()===!1)return}else if(c.key==="ArrowLeft"||c.key==="ArrowRight"||c.key==="ArrowUp"||c.key==="ArrowDown")o={...o,x:o.x+(c.key==="ArrowLeft"?g:c.key==="ArrowRight"?-g:0),y:o.y+(c.key==="ArrowUp"?g:c.key==="ArrowDown"?-g:0)},p();else return;c.preventDefault()},Wt=c=>{const g=c.target instanceof HTMLElement?c.target:null;if(g===null||!c.composedPath().includes(e))return;const k=g.getBoundingClientRect(),x=t.getBoundingClientRect();let C=0,L=0;k.left<x.left+12?C=x.left+12-k.left:k.right>x.right-12&&(C=x.right-12-k.right),k.top<x.top+12?L=x.top+12-k.top:k.bottom>x.bottom-40&&(L=x.bottom-40-k.bottom),!(C===0&&L===0)&&(o={...o,x:o.x+C,y:o.y+L},p())};t.addEventListener("wheel",Q,{passive:!1}),t.addEventListener("pointerdown",tt),t.addEventListener("pointermove",Ht),t.addEventListener("pointerup",_t),t.addEventListener("pointercancel",et),t.addEventListener("lostpointercapture",et),t.addEventListener("click",Bt,!0),t.addEventListener("keydown",Nt),t.addEventListener("focusin",Wt);const Gt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>p());return Gt?.observe(t),{setContent(c){l=he(c.width===0&&c.height===0?[]:[c]),d&&(e.style.width=`${c.width}px`,e.style.height=`${c.height}px`),p()},apply:p,fit:f,fitTo:S,fitWidth:O,reset:lt,zoom:_,view:()=>({...o}),destroy(){Gt?.disconnect(),t.removeEventListener("wheel",Q),t.removeEventListener("pointerdown",tt),t.removeEventListener("pointermove",Ht),t.removeEventListener("pointerup",_t),t.removeEventListener("pointercancel",et),t.removeEventListener("lostpointercapture",et),t.removeEventListener("click",Bt,!0),t.removeEventListener("keydown",Nt),t.removeEventListener("focusin",Wt)}}},za=["fit","fit-width","actual","none"];class Ta{#n;#t=null;#e=null;#s=!1;constructor(t,e){this.#n=e,t.addController(this)}hostDisconnected(){this.detach()}get attached(){return this.#t!==null}get view(){return this.#t?.view()??{x:0,y:0,scale:1}}attach(){this.detach();const t=this.#n.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=Ea({canvas:e,world:s,align:this.#n.align(),sizeWorld:!1,onClearSelection:()=>this.#n.onDismiss(),onView:n=>this.#n.onView(n)}),this.#e=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.sync()),this.#e?.observe(s),this.sync()}detach(){this.#t?.destroy(),this.#t=null,this.#e?.disconnect(),this.#e=null}sync(){const t=this.#t,e=this.#n.elements()?.world;if(t===null||e===void 0)return;const s=this.#n.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const n=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:n,height:i}),!this.#s&&n>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#s=!0;const e=this.#n.initial(),s=za.includes(e)?e:"fit";s==="fit"?t.fit():s==="fit-width"?t.fitWidth():s==="actual"&&t.reset()}fit(){this.#t?.fit()}fitWidth(){this.#t?.fitWidth()}fitTo(t){this.#t?.fitTo(t)}reset(t){this.#t?.reset(t)}zoom(t){this.#t?.zoom(t)}apply(){this.#t?.apply()}}const Aa=(a,t,e)=>a.some(s=>Math.abs(t)>Math.abs(e)?s.overflowX!=="auto"&&s.overflowX!=="scroll"||s.scrollWidth<=s.clientWidth?!1:t>0?s.scrollLeft+s.clientWidth<s.scrollWidth-1:t<0&&s.scrollLeft>0:s.overflowY!=="auto"&&s.overflowY!=="scroll"||s.scrollHeight<=s.clientHeight?!1:e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:e<0&&s.scrollTop>0),fe=160,zt=(a,t,e=fe)=>Math.max(e,Math.round(a+t)),Ma=(a,t,e,s=fe)=>{const n=e?96:24;return t==="ArrowDown"?zt(a,n,s):t==="ArrowUp"?zt(a,-n,s):null},be={kind:"idle"};class La{constructor(t,e){this.#e=null,this.#s=be,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const n=s.currentTarget;n instanceof Element&&n.setPointerCapture(s.pointerId),this.#s={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#n.requestUpdate()},pointermove:s=>{const n=this.#s;n.kind!=="dragging"||n.pointerId!==s.pointerId||this.#a(zt(n.startHeight,s.clientY-n.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const n=Ma(this.#e??this.#t(),s.key,s.shiftKey);n!==null&&(s.preventDefault(),this.#a(n))},dblclick:()=>this.#a(null)},this.#n=t,this.#t=e,t.addController(this)}#n;#t;#e;#s;hostConnected(){}get height(){return this.#e}get dragging(){return this.#s.kind==="dragging"}#a(t){t!==this.#e&&(this.#e=t,this.#n.requestUpdate())}#i(t){const e=this.#s;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#s=be,this.#n.requestUpdate())}}const Da=D({en:{maximize:"Maximize",restore:"Restore size",controls:"View controls",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",canvas:"Canvas. Arrow keys pan, plus and minus zoom, 0 fits the view.",resize:"Resize the panel",resizeHint:"Drag or use the up and down arrows to resize. Double-click restores the height."},ja:{maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",controls:"\u8868\u793A\u306E\u64CD\u4F5C",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",canvas:"\u30AD\u30E3\u30F3\u30D0\u30B9\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",resize:"\u30D1\u30CD\u30EB\u306E\u9AD8\u3055\u3092\u5909\u3048\u308B",resizeHint:"\u30C9\u30E9\u30C3\u30B0\u3001\u307E\u305F\u306F\u4E0A\u4E0B\u306E\u77E2\u5370\u30AD\u30FC\u3067\u9AD8\u3055\u3092\u5909\u3048\u308B\u3002\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u5143\u306E\u9AD8\u3055\u306B\u623B\u3059\u3002"}});class ke extends z{static{this.styles=[M,K,T`
1
+ import{ai as bt,a5 as h,ag as r,L as js,ar as G,_ as D,a7 as z,O as M,i as K,a4 as A,a8 as R,aB as Is,A as Ps,aC as Jt,aD as Os,aE as Us,al as F,aF as Xt,a6 as P,a3 as kt,af as Yt,aw as Fs,av as vt,aG as Hs,aH as dt,u as Bs,aI as Zt,ak as _s,ax as Ns,t as Ws,aJ as Gs,R as Ks,S as Vs}from"./shared-D7lvvzdN.js";import{o as _,r as Js}from"./shared-D4PPk0Dk.js";import{e as Xs}from"./shared-CLrs15X7.js";import{a as Qt,c as Ys}from"./shared-DstEY0ER.js";import{c as Zs}from"./shared-CMe6_Sdn.js";import{m as N,o as xt,k as u,I as te,D as ee,x as st,h as w,u as yt,s as se,A as ae,j as b,B as Qs,n as ct,q as y,v as $,H as wt,w as E,C as W,g as at,z as ne,l as V,y as ie,G as re,J as ta,K as oe}from"./shared-CVEzSR4J.js";import{p as ea,i as sa,r as aa,c as na,a as le,b as de,d as ia,e as ra,f as oa,h as ce,g as la,j as $t,s as da,k as ca,l as pa,m as ha,n as ua,t as ma}from"./shared-CkaifYF3.js";import{B as ga,t as fa,v as ba,i as ka,k as va,j as xa}from"./shared-8-7i0SJv.js";import{d as ya}from"./shared-BAlmAjut.js";class pt{#n;#t;#e=null;#s=null;#a=null;#i=null;#r=new Map;#o=null;constructor(t){this.#n=t,this.#t=new bt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#a=e,this.#i=s??null,this.#o=null,this.#n.requestUpdate()}close(){this.#e=null,this.#a=null,this.#i=null,this.#n.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#s!==this.#e;this.#s=this.#e,!(t===null||this.#a===null||this.#e===null)&&(this.#t.open(t,this.#a,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}render(t){const e=this.#e;if(e===null)return h;const s=ea(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return r`${sa(e,aa(na(t.locale),s,n=>this.#l(e,t.submit,n)))}`}#l(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#n.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#n.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const Ct=(a,t,e,s)=>{if(a===null)return null;const n=js(a),i=t.find(d=>d.value===n);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(n,i.label)}]}},ht=.08,pe=1.8,he=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...a.map(i=>i.x)),e=Math.min(...a.map(i=>i.y)),s=Math.max(...a.map(i=>i.x+i.width))-t,n=Math.max(...a.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-n*.1,width:s*1.2,height:n*1.2}},ue=(a,t)=>a+t/12,wa=(a,t)=>{if(a.length===0)return null;const e=Math.min(...a.map(n=>n.y)),s=a.filter(n=>n.y<e+t);return{x:Math.min(...s.map(n=>n.x)),y:e}},St=16,$a=.8,ut=(a,t,e,s,n)=>a==="start"?St-ue(t,e)*s:(n-e*s)/2-t*s,me=(a,t,e,s,n="center")=>{if(t.width===0||t.height===0)return{...a,x:0,y:0};const i=(d,l,o,m)=>{const p=o*a.scale,f=m*$a;if(p<=m){const S=ut(n,l,o,a.scale,m);return G(d,S-f,S+f)}return G(d,m-(l+o)*a.scale-f,-l*a.scale+f)};return{...a,x:i(a.x,t.x,t.width,e),y:i(a.y,t.y,t.height,s)}},Ca=(a,t,e,s,n,i,d="center")=>{const l=Math.abs(i)>Math.abs(n);if(l&&t.height*a.scale<=s)return null;const o=me({...a,x:a.x-n,y:a.y-i},t,e,s,d);return l&&o.y===a.y?null:o},Sa=a=>Math.exp(-a*.01),ge='button,[role="button"],a,input,textarea,select',Et=(a,t,e)=>{for(const s of a.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},Ea=a=>{const{canvas:t,world:e,onClearSelection:s,onView:n,align:i="center",sizeWorld:d=!0}=a;let l={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const m=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),p=()=>{const{width:c,height:g}=m();o=me(o,l,c,g,i),e.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/o.scale)),e.style.setProperty("--dpk-zoom-scale",String(o.scale)),n?.(o)},f=()=>{const{width:c,height:g}=m(),k=l.width/1.2||1,x=l.height/1.2||1,C=G(Math.min((c-24)/k,(g-40)/x),ht,1);o={scale:C,x:ut(i,l.x,l.width,C,c),y:ut(i,l.y,l.height,C,g)},p()},S=c=>{const{width:g,height:k}=m(),x=he([c]),C=x.width/1.2||1,L=x.height/1.2||1;o={...o,scale:G(Math.min((g-24)/C,(k-40)/L),ht,pe)},o={...o,x:(g-x.width*o.scale)/2-x.x*o.scale,y:(k-x.height*o.scale)/2-x.y*o.scale},p()},O=()=>{const{width:c}=m(),g=l.width/1.2||1,k=G((c-24)/g,ht,1);o={scale:k,x:(c-l.width*k)/2-l.x*k,y:16},p()},lt=c=>{const{width:g,height:k}=m(),x=(C,L,Kt,Vt)=>Vt!==void 0?St-Vt:L<=Kt?ut(i,C,L,1,Kt):St-ue(C,L);o={scale:1,x:x(l.x,l.width,g,c?.x),y:x(l.y,l.height,k,c?.y)},p()},B=(c,g=m().width/2,k=m().height/2)=>{const x=o.scale,C=G(x*c,ht,pe);C!==x&&(o={scale:C,x:g-(g-o.x)*C/x,y:k-(k-o.y)*C/x},p())},Q=c=>{if(Et(c,t,".diagram-zoom")!==null)return;const g=c.deltaMode===1?16:c.deltaMode===2?m().height:1;if(c.ctrlKey||c.metaKey){c.preventDefault();const L=t.getBoundingClientRect();B(Sa(c.deltaY),c.clientX-L.left,c.clientY-L.top);return}const{width:k,height:x}=m(),C=Ca(o,l,k,x,c.deltaX*g,c.deltaY*g,i);C!==null&&(c.preventDefault(),o=C,p())},j=new Map;let T=null,I=!1;const U=()=>{const c=[...j.values()],g=c[0];if(!g)return null;const k=c[1];return k?{x:(g.x+k.x)/2,y:(g.y+k.y)/2,distance:Math.hypot(k.x-g.x,k.y-g.y)}:{...g,distance:0}},tt=c=>{j.size===0&&(I=!1);const g=Et(c,t,ge);c.button!==0||c.pointerType!=="touch"&&g!==null||(j.set(c.pointerId,{x:c.clientX,y:c.clientY}),T=U(),g===null&&t.setPointerCapture(c.pointerId),c.pointerType!=="touch"&&g===null&&(c.preventDefault(),t.focus({preventScroll:!0})))},Ht=c=>{if(!j.has(c.pointerId)||T===null)return;j.set(c.pointerId,{x:c.clientX,y:c.clientY});const g=U();if(g===null)return;const k=g.x-T.x,x=g.y-T.y;if((Math.abs(k)+Math.abs(x)>1||Math.abs(g.distance-T.distance)>1)&&(I=!0),g.distance>0&&T.distance>0){const C=t.getBoundingClientRect();B(Math.pow(g.distance/T.distance,.45),T.x-C.left,T.y-C.top)}o={...o,x:o.x+k,y:o.y+x},p(),T=g,t.classList.toggle("is-panning",I)},et=c=>{j.delete(c.pointerId),T=U(),!(j.size>0)&&(t.classList.remove("is-panning"),c.type==="pointercancel"&&(I=!1))},Bt=c=>{I&&(c.preventDefault(),c.stopPropagation()),et(c)},_t=c=>{if(I){c.preventDefault(),c.stopPropagation(),I=!1;return}!(c.target instanceof Element)||Et(c,t,ge)!==null||s()},Nt=c=>{if(c.target!==t)return;const g=30;if(c.key==="+"||c.key==="=")B(1.1);else if(c.key==="-")B(1/1.1);else if(c.key==="0")f();else if(c.key==="Escape"){if(s()===!1)return}else if(c.key==="ArrowLeft"||c.key==="ArrowRight"||c.key==="ArrowUp"||c.key==="ArrowDown")o={...o,x:o.x+(c.key==="ArrowLeft"?g:c.key==="ArrowRight"?-g:0),y:o.y+(c.key==="ArrowUp"?g:c.key==="ArrowDown"?-g:0)},p();else return;c.preventDefault()},Wt=c=>{const g=c.target instanceof HTMLElement?c.target:null;if(g===null||!c.composedPath().includes(e))return;const k=g.getBoundingClientRect(),x=t.getBoundingClientRect();let C=0,L=0;k.left<x.left+12?C=x.left+12-k.left:k.right>x.right-12&&(C=x.right-12-k.right),k.top<x.top+12?L=x.top+12-k.top:k.bottom>x.bottom-40&&(L=x.bottom-40-k.bottom),!(C===0&&L===0)&&(o={...o,x:o.x+C,y:o.y+L},p())};t.addEventListener("wheel",Q,{passive:!1}),t.addEventListener("pointerdown",tt),t.addEventListener("pointermove",Ht),t.addEventListener("pointerup",Bt),t.addEventListener("pointercancel",et),t.addEventListener("lostpointercapture",et),t.addEventListener("click",_t,!0),t.addEventListener("keydown",Nt),t.addEventListener("focusin",Wt);const Gt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>p());return Gt?.observe(t),{setContent(c){l=he(c.width===0&&c.height===0?[]:[c]),d&&(e.style.width=`${c.width}px`,e.style.height=`${c.height}px`),p()},apply:p,fit:f,fitTo:S,fitWidth:O,reset:lt,zoom:B,view:()=>({...o}),destroy(){Gt?.disconnect(),t.removeEventListener("wheel",Q),t.removeEventListener("pointerdown",tt),t.removeEventListener("pointermove",Ht),t.removeEventListener("pointerup",Bt),t.removeEventListener("pointercancel",et),t.removeEventListener("lostpointercapture",et),t.removeEventListener("click",_t,!0),t.removeEventListener("keydown",Nt),t.removeEventListener("focusin",Wt)}}},za=["fit","fit-width","actual","none"];class Aa{#n;#t=null;#e=null;#s=!1;constructor(t,e){this.#n=e,t.addController(this)}hostDisconnected(){this.detach()}get attached(){return this.#t!==null}get view(){return this.#t?.view()??{x:0,y:0,scale:1}}attach(){this.detach();const t=this.#n.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=Ea({canvas:e,world:s,align:this.#n.align(),sizeWorld:!1,onClearSelection:()=>this.#n.onDismiss(),onView:n=>this.#n.onView(n)}),this.#e=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.sync()),this.#e?.observe(s),this.sync()}detach(){this.#t?.destroy(),this.#t=null,this.#e?.disconnect(),this.#e=null}sync(){const t=this.#t,e=this.#n.elements()?.world;if(t===null||e===void 0)return;const s=this.#n.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const n=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:n,height:i}),!this.#s&&n>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#s=!0;const e=this.#n.initial(),s=za.includes(e)?e:"fit";s==="fit"?t.fit():s==="fit-width"?t.fitWidth():s==="actual"&&t.reset()}fit(){this.#t?.fit()}fitWidth(){this.#t?.fitWidth()}fitTo(t){this.#t?.fitTo(t)}reset(t){this.#t?.reset(t)}zoom(t){this.#t?.zoom(t)}apply(){this.#t?.apply()}}const Ta=(a,t,e)=>a.some(s=>Math.abs(t)>Math.abs(e)?s.overflowX!=="auto"&&s.overflowX!=="scroll"||s.scrollWidth<=s.clientWidth?!1:t>0?s.scrollLeft+s.clientWidth<s.scrollWidth-1:t<0&&s.scrollLeft>0:s.overflowY!=="auto"&&s.overflowY!=="scroll"||s.scrollHeight<=s.clientHeight?!1:e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:e<0&&s.scrollTop>0),fe=160,zt=(a,t,e=fe)=>Math.max(e,Math.round(a+t)),Ma=(a,t,e,s=fe)=>{const n=e?96:24;return t==="ArrowDown"?zt(a,n,s):t==="ArrowUp"?zt(a,-n,s):null},be={kind:"idle"};class La{constructor(t,e){this.#e=null,this.#s=be,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const n=s.currentTarget;n instanceof Element&&n.setPointerCapture(s.pointerId),this.#s={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#n.requestUpdate()},pointermove:s=>{const n=this.#s;n.kind!=="dragging"||n.pointerId!==s.pointerId||this.#a(zt(n.startHeight,s.clientY-n.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const n=Ma(this.#e??this.#t(),s.key,s.shiftKey);n!==null&&(s.preventDefault(),this.#a(n))},dblclick:()=>this.#a(null)},this.#n=t,this.#t=e,t.addController(this)}#n;#t;#e;#s;hostConnected(){}get height(){return this.#e}get dragging(){return this.#s.kind==="dragging"}#a(t){t!==this.#e&&(this.#e=t,this.#n.requestUpdate())}#i(t){const e=this.#s;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#s=be,this.#n.requestUpdate())}}const Da=D({en:{maximize:"Maximize",restore:"Restore size",controls:"View controls",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",canvas:"Canvas. Arrow keys pan, plus and minus zoom, 0 fits the view.",resize:"Resize the panel",resizeHint:"Drag or use the up and down arrows to resize. Double-click restores the height."},ja:{maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",controls:"\u8868\u793A\u306E\u64CD\u4F5C",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",canvas:"\u30AD\u30E3\u30F3\u30D0\u30B9\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",resize:"\u30D1\u30CD\u30EB\u306E\u9AD8\u3055\u3092\u5909\u3048\u308B",resizeHint:"\u30C9\u30E9\u30C3\u30B0\u3001\u307E\u305F\u306F\u4E0A\u4E0B\u306E\u77E2\u5370\u30AD\u30FC\u3067\u9AD8\u3055\u3092\u5909\u3048\u308B\u3002\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u5143\u306E\u9AD8\u3055\u306B\u623B\u3059\u3002"}});class ke extends z{static{this.styles=[M,K,A`
2
2
  :host {
3
3
  display: block;
4
4
  color: var(--dpk-ink);
@@ -367,7 +367,7 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
367
367
  display: none;
368
368
  }
369
369
  }
370
- `]}static{this.properties={heading:{type:String},subject:{type:String},maximizable:{type:Boolean,reflect:!0},maximized:{type:Boolean,reflect:!0},resizable:{type:Boolean,reflect:!0},canvas:{type:Boolean,reflect:!0},contentWidth:{type:Number,attribute:"content-width"},contentHeight:{type:Number,attribute:"content-height"},initial:{type:String},align:{type:String},fitMode:{type:String,attribute:"fit-mode"},label:{type:String}}}#n=new R(this);#t=new Ta(this,{elements:()=>{const t=this.renderRoot.querySelector(".canvas"),e=this.renderRoot.querySelector(".world");return this.canvas&&t&&e?{canvas:t,world:e}:null},align:()=>this.align,initial:()=>this.initial,contentSize:()=>this.contentWidth!==null&&this.contentHeight!==null?{width:this.contentWidth,height:this.contentHeight}:null,onDismiss:()=>!this.dispatchEvent(new CustomEvent("dpk-canvas-dismiss",{bubbles:!0,composed:!0,cancelable:!0})),onView:t=>{const e=this.renderRoot.querySelector(".zoom-value");e&&(e.textContent=Ra(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new La(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#s=0;#a=!1;constructor(){super(),this.heading=null,this.subject=null,this.maximizable=!1,this.maximized=!1,this.resizable=!1,this.canvas=!1,this.contentWidth=null,this.contentHeight=null,this.initial="fit",this.align="center",this.fitMode="all",this.label=null,this.addEventListener("keydown",this.#v),this.addEventListener("wheel",this.#g,{passive:!1})}get view(){return this.#t.view}fit(){this.#t.fit()}fitWidth(){this.#t.fitWidth()}fitTo(t){this.#t.fitTo(t)}reset(t){this.#t.reset(t)}zoom(t){this.#t.zoom(t)}apply(){this.#t.apply()}resetView(){this.#t.open()}willUpdate(t){t.has("maximized")&&this.maximized&&(this.#s=this.renderRoot.querySelector(".panel")?.offsetHeight??0)}updated(t){t.has("maximized")&&this.#m(),t.has("canvas")&&this.canvas!==this.#t.attached||t.has("align")&&t.get("align")!==void 0&&this.canvas?this.canvas?this.#t.attach():this.#t.detach():(t.has("contentWidth")||t.has("contentHeight"))&&this.#t.sync()}render(){this.#a=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#a,e=this.#e.height;return r`
370
+ `]}static{this.properties={heading:{type:String},subject:{type:String},maximizable:{type:Boolean,reflect:!0},maximized:{type:Boolean,reflect:!0},resizable:{type:Boolean,reflect:!0},canvas:{type:Boolean,reflect:!0},contentWidth:{type:Number,attribute:"content-width"},contentHeight:{type:Number,attribute:"content-height"},initial:{type:String},align:{type:String},fitMode:{type:String,attribute:"fit-mode"},label:{type:String}}}#n=new R(this);#t=new Aa(this,{elements:()=>{const t=this.renderRoot.querySelector(".canvas"),e=this.renderRoot.querySelector(".world");return this.canvas&&t&&e?{canvas:t,world:e}:null},align:()=>this.align,initial:()=>this.initial,contentSize:()=>this.contentWidth!==null&&this.contentHeight!==null?{width:this.contentWidth,height:this.contentHeight}:null,onDismiss:()=>!this.dispatchEvent(new CustomEvent("dpk-canvas-dismiss",{bubbles:!0,composed:!0,cancelable:!0})),onView:t=>{const e=this.renderRoot.querySelector(".zoom-value");e&&(e.textContent=Ra(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new La(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#s=0;#a=!1;constructor(){super(),this.heading=null,this.subject=null,this.maximizable=!1,this.maximized=!1,this.resizable=!1,this.canvas=!1,this.contentWidth=null,this.contentHeight=null,this.initial="fit",this.align="center",this.fitMode="all",this.label=null,this.addEventListener("keydown",this.#v),this.addEventListener("wheel",this.#g,{passive:!1})}get view(){return this.#t.view}fit(){this.#t.fit()}fitWidth(){this.#t.fitWidth()}fitTo(t){this.#t.fitTo(t)}reset(t){this.#t.reset(t)}zoom(t){this.#t.zoom(t)}apply(){this.#t.apply()}resetView(){this.#t.open()}willUpdate(t){t.has("maximized")&&this.maximized&&(this.#s=this.renderRoot.querySelector(".panel")?.offsetHeight??0)}updated(t){t.has("maximized")&&this.#m(),t.has("canvas")&&this.canvas!==this.#t.attached||t.has("align")&&t.get("align")!==void 0&&this.canvas?this.canvas?this.#t.attach():this.#t.detach():(t.has("contentWidth")||t.has("contentHeight"))&&this.#t.sync()}render(){this.#a=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#a,e=this.#e.height;return r`
371
371
  ${this.maximized?r`<div class="placeholder" style="height:${this.#s}px"></div>`:h}
372
372
  <section
373
373
  class=${this.maximized?"panel is-maximized":"panel"}
@@ -398,7 +398,7 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
398
398
  <slot name="controls" @slotchange=${this.#u}></slot>
399
399
  ${s.map((n,i)=>r`${i>0||this.#a?r`<span class="separator"></span>`:h}${n}`)}
400
400
  </div>`}#l(){const t=this.#i;return r`<button type="button" aria-label=${t.zoomOut} title=${t.zoomOut} @click=${()=>this.zoom(1/1.1)}>
401
- ${Ps()}
401
+ ${Is()}
402
402
  </button>
403
403
  <button
404
404
  type="button"
@@ -410,7 +410,7 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
410
410
  100%
411
411
  </button>
412
412
  <button type="button" aria-label=${t.zoomIn} title=${t.zoomIn} @click=${()=>this.zoom(1.1)}>
413
- ${Is()}
413
+ ${Ps()}
414
414
  </button>`}#d(){const t=this.maximized?this.#i.restore:this.#i.maximize;return r`<button
415
415
  type="button"
416
416
  class="maximize"
@@ -419,7 +419,7 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
419
419
  aria-pressed=${this.maximized?"true":"false"}
420
420
  @click=${()=>this.#c(!this.maximized)}
421
421
  >
422
- ${this.maximized?Xt():Os()}
422
+ ${this.maximized?Jt():Os()}
423
423
  </button>`}#p(){const t=this.#i.restore;return r`<button
424
424
  type="button"
425
425
  class="exit-fullscreen"
@@ -427,7 +427,7 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
427
427
  title=${t}
428
428
  @click=${()=>this.#c(!1)}
429
429
  >
430
- ${Xt()}
430
+ ${Jt()}
431
431
  </button>`}#h(){const t=this.#i,e=this.#e.handlers;return r`<div
432
432
  class="grip"
433
433
  part="grip"
@@ -444,7 +444,7 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
444
444
  @dblclick=${e.dblclick}
445
445
  >
446
446
  ${Us()}
447
- </div>`}#u=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#a&&this.requestUpdate()};#c(t){t!==this.maximized&&(this.maximized=t,this.dispatchEvent(new CustomEvent("dpk-maximize-change",{detail:{maximized:t},bubbles:!0,composed:!0})))}#m(){const t=this.renderRoot.querySelector(".panel");if(!(!this.maximized||!t||typeof t.showPopover!="function")&&!t.matches(":popover-open"))try{t.showPopover()}catch{}}#g=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(n=>{if(!(n instanceof Element))return[];const{overflowX:i,overflowY:d}=getComputedStyle(n);return[{overflowX:i,scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,overflowY:d,scrollTop:n.scrollTop,scrollHeight:n.scrollHeight,clientHeight:n.clientHeight}]});Aa(s,t.deltaX,t.deltaY)||t.preventDefault()};#v=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#c(!1))}}const Ra=a=>`${Math.round(a.scale*100)}%`,ve=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",ke)},ja=(a,t)=>a.active.includes(t)?{...a,active:a.active.filter(e=>e!==t)}:a.match==="single"?{...a,active:[t]}:{...a,active:[...a.active,t]},qa=(a,t)=>({match:t,active:t==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Pa=a=>({...a,active:[]}),Ia=a=>{const t=new Map;for(const e of a)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},Oa={nodes:new Map,edges:new Set},xe=(a,t,e,s)=>{const n=new Map,i=new Set,d=[{id:t,depth:0}],l=new Set([t]);for(const o of d)if(!(!s&&o.depth>=1))for(const m of a){const p=e==="outgoing"?m.from:m.to,f=e==="outgoing"?m.to:m.from;p===o.id&&(i.add(m.id),!l.has(f)&&(l.add(f),n.set(f,o.depth+1),d.push({id:f,depth:o.depth+1})))}return{nodes:n,edges:i}},Ua=(a,t)=>{const e=new Map(a.map(i=>[i,xe(t,i,"outgoing",!0).nodes])),s=new Set,n=[];for(const i of a){if(s.has(i))continue;const d=a.filter(l=>l===i||e.get(i)?.has(l)===!0&&e.get(l)?.has(i)===!0);for(const l of d)s.add(l);(d.length>1||t.some(l=>l.from===i&&l.to===i))&&n.push(d)}return n},Fa=a=>new Map(a.flatMap((t,e)=>t.map(s=>[s,e]))),Ha=(a,t)=>t.get(a.from)===t.get(a.to)&&t.has(a.from),_a=(a,t,e,s)=>{const n=t!==null&&t.kind===e&&t.id===a,i=e==="node"?s.nodes.has(a):s.edges.has(a),d=e==="node"?s.nodes.get(a)??null:null;return{selected:n,related:i&&!n,dimmed:t!==null&&!n&&!i,depth:d}},Ba=(...a)=>a.filter(t=>typeof t=="string"&&t!=="").join(" "),Na=a=>{const t=a[0]??{x:0,y:0},e=a.at(-1)??t;if(a.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(a.length===4){const l=a[1]??t,o=a[2]??e;return{x:(l.x+o.x)/2,y:(l.y+o.y)/2}}let s=0,n=-1;for(let l=0;l+1<a.length;l++){const o=a[l],m=a[l+1],p=Math.abs(m.x-o.x)+Math.abs(m.y-o.y);p>n&&(n=p,s=l)}const i=a[s]??t,d=a[s+1]??e;return{x:(i.x+d.x)/2,y:(i.y+d.y)/2}},Wa=D({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear"},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664"}}),Ga=["single","all","any"],ye=a=>a.startsWith(ga),Ka=a=>{const t=new Set,e=a.flatMap(s=>{const n=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return n.tag===""||t.has(n.tag)?[]:(t.add(n.tag),[n])});return[...e.filter(s=>ye(s.tag)),...e.filter(s=>!ye(s.tag))]},Va=Jt([b(),kt({tag:b(),count:Fs(dt())})]),Xa=kt({tags:w(vt()),active:u(Yt(Qt(w(vt())),null)),match:u(Yt(Qt(st(Ga)),null))}),we=a=>{const t=B(Xa,Array.isArray(a)?{tags:a}:a),e=t.tags.flatMap(n=>{const i=Zt(Va,n);return i.success?[i.output]:[]}),s=t.active?.filter(n=>typeof n=="string")??null;return{tags:e,active:s,match:t.match??null}},Ya=[["single","Single"],["all","AND"],["any","OR"]];class $e extends z{static{this.styles=[M,T`
447
+ </div>`}#u=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#a&&this.requestUpdate()};#c(t){t!==this.maximized&&(this.maximized=t,this.dispatchEvent(new CustomEvent("dpk-maximize-change",{detail:{maximized:t},bubbles:!0,composed:!0})))}#m(){const t=this.renderRoot.querySelector(".panel");if(!(!this.maximized||!t||typeof t.showPopover!="function")&&!t.matches(":popover-open"))try{t.showPopover()}catch{}}#g=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(n=>{if(!(n instanceof Element))return[];const{overflowX:i,overflowY:d}=getComputedStyle(n);return[{overflowX:i,scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,overflowY:d,scrollTop:n.scrollTop,scrollHeight:n.scrollHeight,clientHeight:n.clientHeight}]});Ta(s,t.deltaX,t.deltaY)||t.preventDefault()};#v=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#c(!1))}}const Ra=a=>`${Math.round(a.scale*100)}%`,ve=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",ke)},qa=(a,t)=>a.active.includes(t)?{...a,active:a.active.filter(e=>e!==t)}:a.match==="single"?{...a,active:[t]}:{...a,active:[...a.active,t]},ja=(a,t)=>({match:t,active:t==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Ia=a=>({...a,active:[]}),Pa=a=>{const t=new Map;for(const e of a)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},Oa={nodes:new Map,edges:new Set},xe=(a,t,e,s)=>{const n=new Map,i=new Set,d=[{id:t,depth:0}],l=new Set([t]);for(const o of d)if(!(!s&&o.depth>=1))for(const m of a){const p=e==="outgoing"?m.from:m.to,f=e==="outgoing"?m.to:m.from;p===o.id&&(i.add(m.id),!l.has(f)&&(l.add(f),n.set(f,o.depth+1),d.push({id:f,depth:o.depth+1})))}return{nodes:n,edges:i}},Ua=(a,t)=>{const e=new Map(a.map(i=>[i,xe(t,i,"outgoing",!0).nodes])),s=new Set,n=[];for(const i of a){if(s.has(i))continue;const d=a.filter(l=>l===i||e.get(i)?.has(l)===!0&&e.get(l)?.has(i)===!0);for(const l of d)s.add(l);(d.length>1||t.some(l=>l.from===i&&l.to===i))&&n.push(d)}return n},Fa=a=>new Map(a.flatMap((t,e)=>t.map(s=>[s,e]))),Ha=(a,t)=>t.get(a.from)===t.get(a.to)&&t.has(a.from),Ba=(a,t,e,s)=>{const n=t!==null&&t.kind===e&&t.id===a,i=e==="node"?s.nodes.has(a):s.edges.has(a),d=e==="node"?s.nodes.get(a)??null:null;return{selected:n,related:i&&!n,dimmed:t!==null&&!n&&!i,depth:d}},_a=(...a)=>a.filter(t=>typeof t=="string"&&t!=="").join(" "),Na=a=>{const t=a[0]??{x:0,y:0},e=a.at(-1)??t;if(a.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(a.length===4){const l=a[1]??t,o=a[2]??e;return{x:(l.x+o.x)/2,y:(l.y+o.y)/2}}let s=0,n=-1;for(let l=0;l+1<a.length;l++){const o=a[l],m=a[l+1],p=Math.abs(m.x-o.x)+Math.abs(m.y-o.y);p>n&&(n=p,s=l)}const i=a[s]??t,d=a[s+1]??e;return{x:(i.x+d.x)/2,y:(i.y+d.y)/2}},Wa=D({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear"},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664"}}),Ga=["single","all","any"],ye=a=>a.startsWith(ga),Ka=a=>{const t=new Set,e=a.flatMap(s=>{const n=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return n.tag===""||t.has(n.tag)?[]:(t.add(n.tag),[n])});return[...e.filter(s=>ye(s.tag)),...e.filter(s=>!ye(s.tag))]},Va=ae([b(),xt({tag:b(),count:Qs(ct())})]),Ja=xt({tags:w(yt()),active:u(te(ee(w(yt())),null)),match:u(te(ee(st(Ga)),null))}),we=a=>{const t=N(Ja,Array.isArray(a)?{tags:a}:a),e=t.tags.flatMap(n=>{const i=se(Va,n);return i.success?[i.output]:[]}),s=t.active?.filter(n=>typeof n=="string")??null;return{tags:e,active:s,match:t.match??null}},Xa=[["single","Single"],["all","AND"],["any","OR"]];class $e extends z{static{this.styles=[M,A`
448
448
  :host {
449
449
  display: block;
450
450
  flex-shrink: 0;
@@ -564,15 +564,15 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
564
564
  outline: none;
565
565
  box-shadow: var(--dpk-focus);
566
566
  }
567
- `]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#n=new R(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=N(this,we,t=>{if(!t.ok){console.warn(`[dev-process-kit] ${this.localName}: ${t.error}`);return}this.tags=t.value.tags,t.value.active!==null&&(this.active=t.value.active),t.value.match!==null&&(this.match=t.value.match)})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}passes(t){return fa(t,this.#s)}render(){const t=Ka(this.tags);if(t.length===0)return h;const e=this.#e;return r`
567
+ `]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#n=new R(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=_(this,we,t=>{if(!t.ok){console.warn(`[dev-process-kit] ${this.localName}: ${t.error}`);return}this.tags=t.value.tags,t.value.active!==null&&(this.active=t.value.active),t.value.match!==null&&(this.match=t.value.match)})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}passes(t){return fa(t,this.#s)}render(){const t=Ka(this.tags);if(t.length===0)return h;const e=this.#e;return r`
568
568
  <div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
569
569
  <div class="diagram-match" role="group" aria-label=${e.tagMatch}>
570
- ${Ya.map(([s,n])=>r`
570
+ ${Xa.map(([s,n])=>r`
571
571
  <button
572
572
  type="button"
573
573
  data-match=${s}
574
574
  aria-pressed=${this.match===s?"true":"false"}
575
- @click=${()=>this.#a(qa(this.#s,s))}
575
+ @click=${()=>this.#a(ja(this.#s,s))}
576
576
  >
577
577
  ${n}
578
578
  </button>
@@ -584,17 +584,17 @@ import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah
584
584
  class="dpk-tag"
585
585
  data-tag=${s.tag}
586
586
  aria-pressed=${this.active.includes(s.tag)?"true":"false"}
587
- @click=${()=>this.#a(ja(this.#s,s.tag))}
587
+ @click=${()=>this.#a(qa(this.#s,s.tag))}
588
588
  >
589
589
  <span class="dpk-tag-name" title=${s.tag}>${s.tag}</span>${s.count===null?h:r`<span class="dpk-tag-count">${s.count}</span>`}
590
590
  </button>
591
591
  `)}
592
- ${this.active.length>0?r`<button type="button" class="dpk-tag-clear" @click=${()=>this.#a(Pa(this.#s))}>
592
+ ${this.active.length>0?r`<button type="button" class="dpk-tag-clear" @click=${()=>this.#a(Ia(this.#s))}>
593
593
  ${e.clearTags}
594
594
  </button>`:h}
595
595
  </div>
596
- `}get#e(){return Wa(this.#n.locale)}get#s(){return{active:this.active,match:this.match}}#a(t){this.active=t.active,this.match=t.match,this.dispatchEvent(new CustomEvent("dpk-tag-filter-change",{detail:{active:t.active,match:t.match},bubbles:!0,composed:!0}))}}const Ce=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",$e)},Se=Symbol.for("dev-process-kit:atom-styles"),Ee=()=>{if(typeof document>"u"||Reflect.get(document,Se)===!0)return;Reflect.set(document,Se,!0),Js();const a=[te,oe].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(a.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...a];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${te.cssText}
597
- ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No data to plot",invalid:a=>`Invalid chart data: ${a}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:a=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${a}`}}),Tt=["blue","green","amber","violet","accent","ink-faint"],ze=y({x:$(b(),E(1)),y:$(dt(),xt())}),Ja=y({id:W,label:$(b(),E(1)),points:w(ze),tone:u(st(Tt),"blue"),area:u(at(),!1)}),Qa=y({id:W,label:$(b(),E(1)),points:w(ze),tone:u(st(Tt),"ink-faint"),dashed:u(at(),!0)}),tn=y({x:$(b(),E(1)),label:$(b(),E(1)),tone:u(st(Tt),"accent")}),Te=y({label:u(b()),min:u($(dt(),xt())),max:u($(dt(),xt()))}),en=y({title:u(b(),""),caption:u(b(),""),series:u(w(Ja),[]),guides:u(w(Qa),[]),marks:u(w(tn),[]),xAxis:u(Te,{}),yAxis:u(Te,{})}),At=(a,t)=>{const e=new Set;for(const s of a){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},Ae=(a,t)=>{At(a.map(e=>e.x),`x in "${t}"`)},Me=a=>{const t=B(en,a);At(t.series.map(e=>e.id),"series id"),At(t.guides.map(e=>e.id),"guide id");for(const e of t.series)Ae(e.points,e.label);for(const e of t.guides)Ae(e.points,e.label);if(t.yAxis.min!==void 0&&t.yAxis.max!==void 0&&t.yAxis.min>=t.yAxis.max)throw new Error("yAxis.min must be less than yAxis.max");return t},X={top:22,right:18,bottom:38,left:52},Mt=6,sn=a=>{const t=[],e=new Set;for(const s of[...a.series,...a.guides])for(const n of s.points)e.has(n.x)||(e.add(n.x),t.push(n.x));return t},an=a=>{const t=[...a.series,...a.guides].flatMap(d=>d.points.map(l=>l.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),n=a.yAxis.min??Math.min(0,e);let i=a.yAxis.max??s;if(i<=n&&(i=n+1),a.yAxis.max===void 0){const d=i-n;i+=d*.08}return{min:n,max:i}},Lt=a=>a.length===0?"":a.map((t,e)=>`${e===0?"M":"L"}${Y(t.x)} ${Y(t.y)}`).join(" "),nn=(a,t)=>a.length===0?null:`${Lt(a)} L${Y(a.at(-1)?.x??0)} ${Y(t)} L${Y(a[0]?.x??0)} ${Y(t)} Z`,Y=a=>Math.round(a*100)/100,Le=a=>Number.isInteger(a)?String(a):String(Math.round(a*10)/10),rn=(a,t)=>{const e=a/Math.max(1,t),s=10**Math.floor(Math.log10(e)),n=e/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s},on=(a,t,e)=>{const s=rn(t-a,4),n=Math.ceil(a/s)*s,i=[];for(let l=n;l<=t+s/1e3;l+=s)i.push({y:e(l),label:Le(l)});const d=e(a);return i.some(l=>Math.abs(l.y-d)<.01)||i.push({y:d,label:Le(a)}),i},ln=(a,t)=>{if(a.length===0)return[];if(a.length<=Mt)return a.map((s,n)=>({x:t(n),label:s}));const e=Array.from({length:Mt},(s,n)=>Math.round(n*(a.length-1)/(Mt-1)));return[...new Set(e)].map(s=>({x:t(s),label:a[s]??""}))},dn=(a,t=720,e=280)=>{const s=sn(a),n=an(a);if(s.length===0||n===null)return null;const i={left:X.left,top:X.top,width:t-X.left-X.right,height:e-X.top-X.bottom},d=new Map(s.map((f,S)=>[f,S])),l=f=>s.length===1?i.left+i.width/2:i.left+f/(s.length-1)*i.width,o=f=>i.top+(1-(f-n.min)/(n.max-n.min))*i.height,m=f=>f.flatMap(S=>{const O=d.get(S.x);return O===void 0?[]:[{x:l(O),y:o(S.y)}]}).sort((S,O)=>S.x-O.x),p=i.top+i.height;return{width:t,height:e,plot:i,series:a.series.map(f=>{const S=m(f.points);return{...f,nodes:S,path:Lt(S),areaPath:f.area?nn(S,p):null}}),guides:a.guides.map(f=>({...f,path:Lt(m(f.points))})),marks:a.marks.flatMap(f=>{const S=d.get(f.x);return S===void 0?[]:[{...f,x:l(S)}]}),xTicks:ln(s,l),yTicks:on(n.min,n.max,o)}},cn=T`
596
+ `}get#e(){return Wa(this.#n.locale)}get#s(){return{active:this.active,match:this.match}}#a(t){this.active=t.active,this.match=t.match,this.dispatchEvent(new CustomEvent("dpk-tag-filter-change",{detail:{active:t.active,match:t.match},bubbles:!0,composed:!0}))}}const Ce=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",$e)},Se=Symbol.for("dev-process-kit:atom-styles"),Ee=()=>{if(typeof document>"u"||Reflect.get(document,Se)===!0)return;Reflect.set(document,Se,!0),Xs();const a=[Xt,Qt].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(a.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...a];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${Xt.cssText}
597
+ ${Qt.cssText}`,document.head.append(t)},Ya=D({en:{aria:"Line chart",empty:"No data to plot",invalid:a=>`Invalid chart data: ${a}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:a=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${a}`}}),At=["blue","green","amber","violet","accent","ink-faint"],ze=y({x:$(b(),E(1)),y:$(ct(),wt())}),Za=y({id:W,label:$(b(),E(1)),points:w(ze),tone:u(st(At),"blue"),area:u(at(),!1)}),Qa=y({id:W,label:$(b(),E(1)),points:w(ze),tone:u(st(At),"ink-faint"),dashed:u(at(),!0)}),tn=y({x:$(b(),E(1)),label:$(b(),E(1)),tone:u(st(At),"accent")}),Ae=y({label:u(b()),min:u($(ct(),wt())),max:u($(ct(),wt()))}),en=y({title:u(b(),""),caption:u(b(),""),series:u(w(Za),[]),guides:u(w(Qa),[]),marks:u(w(tn),[]),xAxis:u(Ae,{}),yAxis:u(Ae,{})}),Tt=(a,t)=>{const e=new Set;for(const s of a){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},Te=(a,t)=>{Tt(a.map(e=>e.x),`x in "${t}"`)},Me=a=>{const t=N(en,a);Tt(t.series.map(e=>e.id),"series id"),Tt(t.guides.map(e=>e.id),"guide id");for(const e of t.series)Te(e.points,e.label);for(const e of t.guides)Te(e.points,e.label);if(t.yAxis.min!==void 0&&t.yAxis.max!==void 0&&t.yAxis.min>=t.yAxis.max)throw new Error("yAxis.min must be less than yAxis.max");return t},J={top:22,right:18,bottom:38,left:52},Mt=6,sn=a=>{const t=[],e=new Set;for(const s of[...a.series,...a.guides])for(const n of s.points)e.has(n.x)||(e.add(n.x),t.push(n.x));return t},an=a=>{const t=[...a.series,...a.guides].flatMap(d=>d.points.map(l=>l.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),n=a.yAxis.min??Math.min(0,e);let i=a.yAxis.max??s;if(i<=n&&(i=n+1),a.yAxis.max===void 0){const d=i-n;i+=d*.08}return{min:n,max:i}},Lt=a=>a.length===0?"":a.map((t,e)=>`${e===0?"M":"L"}${X(t.x)} ${X(t.y)}`).join(" "),nn=(a,t)=>a.length===0?null:`${Lt(a)} L${X(a.at(-1)?.x??0)} ${X(t)} L${X(a[0]?.x??0)} ${X(t)} Z`,X=a=>Math.round(a*100)/100,Le=a=>Number.isInteger(a)?String(a):String(Math.round(a*10)/10),rn=(a,t)=>{const e=a/Math.max(1,t),s=10**Math.floor(Math.log10(e)),n=e/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s},on=(a,t,e)=>{const s=rn(t-a,4),n=Math.ceil(a/s)*s,i=[];for(let l=n;l<=t+s/1e3;l+=s)i.push({y:e(l),label:Le(l)});const d=e(a);return i.some(l=>Math.abs(l.y-d)<.01)||i.push({y:d,label:Le(a)}),i},ln=(a,t)=>{if(a.length===0)return[];if(a.length<=Mt)return a.map((s,n)=>({x:t(n),label:s}));const e=Array.from({length:Mt},(s,n)=>Math.round(n*(a.length-1)/(Mt-1)));return[...new Set(e)].map(s=>({x:t(s),label:a[s]??""}))},dn=(a,t=720,e=280)=>{const s=sn(a),n=an(a);if(s.length===0||n===null)return null;const i={left:J.left,top:J.top,width:t-J.left-J.right,height:e-J.top-J.bottom},d=new Map(s.map((f,S)=>[f,S])),l=f=>s.length===1?i.left+i.width/2:i.left+f/(s.length-1)*i.width,o=f=>i.top+(1-(f-n.min)/(n.max-n.min))*i.height,m=f=>f.flatMap(S=>{const O=d.get(S.x);return O===void 0?[]:[{x:l(O),y:o(S.y)}]}).sort((S,O)=>S.x-O.x),p=i.top+i.height;return{width:t,height:e,plot:i,series:a.series.map(f=>{const S=m(f.points);return{...f,nodes:S,path:Lt(S),areaPath:f.area?nn(S,p):null}}),guides:a.guides.map(f=>({...f,path:Lt(m(f.points))})),marks:a.marks.flatMap(f=>{const S=d.get(f.x);return S===void 0?[]:[{...f,x:l(S)}]}),xTicks:ln(s,l),yTicks:on(n.min,n.max,o)}},cn=A`
598
598
  :host {
599
599
  display: block;
600
600
  min-width: 0;
@@ -615,7 +615,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
615
615
  font-family: var(--dpk-mono);
616
616
  font-size: 10px;
617
617
  }
618
- `,H=a=>`--tone: var(--dpk-${a})`;class De extends z{static{this.styles=[Qs,cn]}static{this.properties={data:{attribute:!1}}}#n=new R(this);#t=null;#e=null;#s=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#s=N(this,Me,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Me(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Za(this.#n.locale),e=this.#t,s=e===null?null:dn(e);if(this.#e!==null)return this.#a(r`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#a(r`<p class="dpk-chart-empty">${t.empty}</p>`);const n=e.title===""?t.aria:e.title;return r`<section class="dpk-chart" aria-label=${n}>
618
+ `,H=a=>`--tone: var(--dpk-${a})`;class De extends z{static{this.styles=[Ys,cn]}static{this.properties={data:{attribute:!1}}}#n=new R(this);#t=null;#e=null;#s=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#s=_(this,Me,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Me(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Ya(this.#n.locale),e=this.#t,s=e===null?null:dn(e);if(this.#e!==null)return this.#a(r`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#a(r`<p class="dpk-chart-empty">${t.empty}</p>`);const n=e.title===""?t.aria:e.title;return r`<section class="dpk-chart" aria-label=${n}>
619
619
  ${e.title===""&&e.caption===""?h:r`<header class="dpk-chart-head">
620
620
  ${e.title===""?h:r`<span class="dpk-chart-title">${e.title}</span>`}
621
621
  ${e.caption===""?h:r`<span class="dpk-chart-value">${e.caption}</span>`}
@@ -625,33 +625,33 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
625
625
  </section>`}#a(t){return r`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:n,width:i,height:d}=e,l=n.top+n.height;return r`<svg viewBox="0 0 ${i} ${d}" role="img" aria-label=${s}>
626
626
  <title>${s}</title>
627
627
  <g class="dpk-chart-grid">
628
- ${e.yTicks.map(o=>I`<line x1=${n.left} x2=${n.left+n.width} y1=${o.y} y2=${o.y}></line>`)}
628
+ ${e.yTicks.map(o=>P`<line x1=${n.left} x2=${n.left+n.width} y1=${o.y} y2=${o.y}></line>`)}
629
629
  </g>
630
630
  <g class="dpk-chart-axis">
631
631
  <line x1=${n.left} x2=${n.left} y1=${n.top} y2=${l}></line>
632
632
  <line x1=${n.left} x2=${n.left+n.width} y1=${l} y2=${l}></line>
633
633
  </g>
634
- ${e.yTicks.map(o=>I`<text class="dpk-chart-tick" x=${n.left-8} y=${o.y+3} text-anchor="end">${o.label}</text>`)}
635
- ${e.xTicks.map(o=>I`<text class="dpk-chart-tick" x=${o.x} y=${l+16} text-anchor="middle">${o.label}</text>`)}
636
- ${t.xAxis.label===void 0?h:I`<text class="axis-label" x=${n.left+n.width/2} y=${d-3} text-anchor="middle">${t.xAxis.label}</text>`}
637
- ${t.yAxis.label===void 0?h:I`<text class="axis-label" x=${12} y=${n.top+n.height/2} text-anchor="middle" transform="rotate(-90 12 ${n.top+n.height/2})">${t.yAxis.label}</text>`}
634
+ ${e.yTicks.map(o=>P`<text class="dpk-chart-tick" x=${n.left-8} y=${o.y+3} text-anchor="end">${o.label}</text>`)}
635
+ ${e.xTicks.map(o=>P`<text class="dpk-chart-tick" x=${o.x} y=${l+16} text-anchor="middle">${o.label}</text>`)}
636
+ ${t.xAxis.label===void 0?h:P`<text class="axis-label" x=${n.left+n.width/2} y=${d-3} text-anchor="middle">${t.xAxis.label}</text>`}
637
+ ${t.yAxis.label===void 0?h:P`<text class="axis-label" x=${12} y=${n.top+n.height/2} text-anchor="middle" transform="rotate(-90 12 ${n.top+n.height/2})">${t.yAxis.label}</text>`}
638
638
  ${e.guides.map(o=>this.#o(o))}
639
639
  ${e.series.map(o=>this.#r(o))}
640
640
  ${e.marks.map(o=>this.#l(o,n.top,l))}
641
- </svg>`}#r(t){return t.path===""?h:I`${t.areaPath===null?h:I`<path class="dpk-chart-area" d=${t.areaPath} style=${H(t.tone)}></path>`}
641
+ </svg>`}#r(t){return t.path===""?h:P`${t.areaPath===null?h:P`<path class="dpk-chart-area" d=${t.areaPath} style=${H(t.tone)}></path>`}
642
642
  <path class="dpk-chart-line" d=${t.path} style=${H(t.tone)}></path>
643
- ${t.nodes.map(e=>I`<circle
643
+ ${t.nodes.map(e=>P`<circle
644
644
  class="dpk-chart-point"
645
645
  cx=${e.x}
646
646
  cy=${e.y}
647
647
  r="2.5"
648
648
  style=${H(t.tone)}
649
- ></circle>`)}`}#o(t){return t.path===""?h:I`<path
649
+ ></circle>`)}`}#o(t){return t.path===""?h:P`<path
650
650
  class="guide"
651
651
  d=${t.path}
652
652
  style=${H(t.tone)}
653
653
  ?data-dashed=${t.dashed}
654
- ></path>`}#l(t,e,s){return I`<line
654
+ ></path>`}#l(t,e,s){return P`<line
655
655
  class="dpk-chart-mark"
656
656
  x1=${t.x}
657
657
  x2=${t.x}
@@ -667,7 +667,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
667
667
  >`)}
668
668
  ${t.guides.map(e=>r`<span class="dpk-chart-key" data-variant="dashed" style=${H(e.tone)}>${e.label}</span>`)}
669
669
  ${t.marks.map(e=>r`<span class="dpk-chart-key" data-variant="mark" style=${H(e.tone)}>${e.label}</span>`)}
670
- </div>`}}const Re=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",De)},pn=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),j=$(b(),se(),E(1)),nt=y({id:W,text:j}),hn=ee("kind",[y({kind:V("proved"),assumptions:u(w(j))}),y({kind:V("bounded"),bound:j}),y({kind:V("incomplete"),gaps:u(w(j))}),y({kind:V("planned")})]),un=y({id:W,target:u(W),statement:j,subjects:u(w(nt)),premises:u(w(nt)),conclusions:$(w(nt),E(1,"a claim needs at least one conclusion")),examples:u(w(nt)),notClaimed:u(w(nt)),assurance:hn,source:u(y({tool:u(j),ref:j}))}),mn=y({id:W,name:j,meaning:j}),gn=y({id:W,name:j,code:u(j),summary:u(j)}),fn=y({targets:u(w(gn)),terms:u(w(mn)),claims:w(un)}),bn=()=>({targets:[],terms:[],claims:[]}),kn=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,vn=(a,t)=>{const e=[];let s=0;for(const n of a.matchAll(kn)){const i=(n[1]??"").trim(),d=t.get(i);if(d===void 0)throw new Error(`unknown term reference: [[${i}]]`);n.index>s&&e.push({kind:"text",text:a.slice(s,n.index)}),e.push({kind:"term",id:i,label:n[2]?.trim()||d}),s=n.index+n[0].length}return s<a.length&&e.push({kind:"text",text:a.slice(s)}),e},je=a=>a.map(t=>t.kind==="text"?t.text:t.label).join(""),xn=a=>[...new Set(a.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],mt=(a,t)=>{const e=new Set;for(const s of a){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},qe=a=>{const t=B(fn,a),e=t.targets??[],s=t.terms??[];mt(e.map(p=>p.id),"target"),mt(s.map(p=>p.id),"term"),mt(t.claims.map(p=>p.id),"claim");const n=new Map(s.map(p=>[p.id,p.name])),i=p=>vn(p,n),d=s.map(p=>({id:p.id,name:p.name,meaning:i(p.meaning)})),l=e.map(p=>({id:p.id,name:p.name,code:p.code??null,summary:p.summary===void 0?null:i(p.summary)})),o=new Set(l.map(p=>p.id)),m=t.claims.map(p=>{if(p.target!==void 0&&!o.has(p.target))throw new Error(`unknown target (in claim ${p.id}): ${p.target}`);const f=U=>(U??[]).map(tt=>({id:tt.id,text:i(tt.text)})),S=f(p.subjects),O=f(p.premises),lt=f(p.conclusions),_=f(p.examples),Q=f(p.notClaimed),q=[...S,...O,...lt,..._,...Q];mt(q.map(U=>U.id),`clause (in claim ${p.id})`);const A=yn(p.assurance,i),P=i(p.statement);return{id:p.id,target:p.target??null,statement:P,subjects:S,premises:O,conclusions:lt,examples:_,notClaimed:Q,assurance:A,source:p.source===void 0?null:{tool:p.source.tool??null,ref:p.source.ref},terms:xn([P,...q.map(U=>U.text),...wn(A)])}});return{targets:l,terms:d,claims:m}},yn=(a,t)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},wn=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},$n=a=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of a.claims)t[Pe(e.assurance)?"conditional":e.assurance.kind]+=1;return t},Pe=a=>a.kind==="proved"&&a.assumptions.length>0,Ie=a=>{const t=new Map(a.targets.map(s=>[s.id,s])),e=new Map;for(const s of a.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of a.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,n])=>({target:s===null?null:t.get(s)??null,claims:n}))},it=(a,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:a,items:t},Dt=(a,t)=>{switch(t.kind){case"proved":return Pe(t)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...it(a.assumptions,t.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...it("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...it(a.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...it(a.gaps,t.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...it("",[])}}},Cn=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},Sn=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Oe=32,Ue=a=>{const t=je(a.statement);return t.length<=Oe?t:`${t.slice(0,Oe).trimEnd()}\u2026`},En=a=>[{target:{kind:"claim",claim:a.id},label:Ue(a)},...Sn(a).map(t=>({target:{kind:"clause",claim:a.id,clause:t.id},label:`${Ue(a)} \u203A ${je(t.text)}`}))],zn=a=>Ie(a).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(En)]),Tn=[M,K,yt,T`
670
+ </div>`}}const Re=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",De)},pn=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),q=$(b(),ie(),E(1)),nt=y({id:W,text:q}),hn=ne("kind",[y({kind:V("proved"),assumptions:u(w(q))}),y({kind:V("bounded"),bound:q}),y({kind:V("incomplete"),gaps:u(w(q))}),y({kind:V("planned")})]),un=y({id:W,target:u(W),statement:q,subjects:u(w(nt)),premises:u(w(nt)),conclusions:$(w(nt),E(1,"a claim needs at least one conclusion")),examples:u(w(nt)),notClaimed:u(w(nt)),assurance:hn,source:u(y({tool:u(q),ref:q}))}),mn=y({id:W,name:q,meaning:q}),gn=y({id:W,name:q,code:u(q),summary:u(q)}),fn=y({targets:u(w(gn)),terms:u(w(mn)),claims:w(un)}),bn=()=>({targets:[],terms:[],claims:[]}),kn=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,vn=(a,t)=>{const e=[];let s=0;for(const n of a.matchAll(kn)){const i=(n[1]??"").trim(),d=t.get(i);if(d===void 0)throw new Error(`unknown term reference: [[${i}]]`);n.index>s&&e.push({kind:"text",text:a.slice(s,n.index)}),e.push({kind:"term",id:i,label:n[2]?.trim()||d}),s=n.index+n[0].length}return s<a.length&&e.push({kind:"text",text:a.slice(s)}),e},qe=a=>a.map(t=>t.kind==="text"?t.text:t.label).join(""),xn=a=>[...new Set(a.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],mt=(a,t)=>{const e=new Set;for(const s of a){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},je=a=>{const t=N(fn,a),e=t.targets??[],s=t.terms??[];mt(e.map(p=>p.id),"target"),mt(s.map(p=>p.id),"term"),mt(t.claims.map(p=>p.id),"claim");const n=new Map(s.map(p=>[p.id,p.name])),i=p=>vn(p,n),d=s.map(p=>({id:p.id,name:p.name,meaning:i(p.meaning)})),l=e.map(p=>({id:p.id,name:p.name,code:p.code??null,summary:p.summary===void 0?null:i(p.summary)})),o=new Set(l.map(p=>p.id)),m=t.claims.map(p=>{if(p.target!==void 0&&!o.has(p.target))throw new Error(`unknown target (in claim ${p.id}): ${p.target}`);const f=U=>(U??[]).map(tt=>({id:tt.id,text:i(tt.text)})),S=f(p.subjects),O=f(p.premises),lt=f(p.conclusions),B=f(p.examples),Q=f(p.notClaimed),j=[...S,...O,...lt,...B,...Q];mt(j.map(U=>U.id),`clause (in claim ${p.id})`);const T=yn(p.assurance,i),I=i(p.statement);return{id:p.id,target:p.target??null,statement:I,subjects:S,premises:O,conclusions:lt,examples:B,notClaimed:Q,assurance:T,source:p.source===void 0?null:{tool:p.source.tool??null,ref:p.source.ref},terms:xn([I,...j.map(U=>U.text),...wn(T)])}});return{targets:l,terms:d,claims:m}},yn=(a,t)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},wn=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},$n=a=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of a.claims)t[Ie(e.assurance)?"conditional":e.assurance.kind]+=1;return t},Ie=a=>a.kind==="proved"&&a.assumptions.length>0,Pe=a=>{const t=new Map(a.targets.map(s=>[s.id,s])),e=new Map;for(const s of a.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of a.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,n])=>({target:s===null?null:t.get(s)??null,claims:n}))},it=(a,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:a,items:t},Dt=(a,t)=>{switch(t.kind){case"proved":return Ie(t)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...it(a.assumptions,t.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...it("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...it(a.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...it(a.gaps,t.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...it("",[])}}},Cn=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},Sn=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Oe=32,Ue=a=>{const t=qe(a.statement);return t.length<=Oe?t:`${t.slice(0,Oe).trimEnd()}\u2026`},En=a=>[{target:{kind:"claim",claim:a.id},label:Ue(a)},...Sn(a).map(t=>({target:{kind:"clause",claim:a.id,clause:t.id},label:`${Ue(a)} \u203A ${qe(t.text)}`}))],zn=a=>Pe(a).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(En)]),An=[M,K,kt,A`
671
671
  :host {
672
672
  display: block;
673
673
  container-type: inline-size;
@@ -1145,7 +1145,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1145
1145
  font-size: 11px;
1146
1146
  color: var(--dpk-accent);
1147
1147
  }
1148
- `],Fe=a=>`claim-body-${a}`;class He extends z{static{this.styles=Tn}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#n=null;#t=new Map;#e=null;#s=null;#a="";#i=new Set;#r=null;#o=null;#l=new bt(this);#d=new pt(this);#p=new R(this,()=>{this.#a=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#a="",document.addEventListener("keydown",this.#$),document.addEventListener("pointerdown",this.#T),this.#s=N(this,qe,t=>{t.ok?this.#g(t.value):this.#v(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#$),document.removeEventListener("pointerdown",this.#T),this.#s?.(),this.#s=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#k(),this.#d.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=Ct(t.target,this.commentTargets,ae(this.#p.locale),(s,n)=>this.#h(s,n));return e===null?null:[e]}#h(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#d.open(t,s,e)}#u(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}get commentTargets(){if(!this.id||this.#n===null)return[];const t=`${this.subject??this.heading??this.#c.heading} \xB7 ${this.id}`;return zn(this.#n).map(({target:e,label:s})=>({value:this.#f(e),label:s,group:t}))}get dataError(){return this.#e}get#c(){return pn(this.#p.locale)}#m(){return this.#n??bn()}#g(t){this.#n=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#v(t){this.#n=null,this.#t=new Map,this.#e=t,console.error("[dev-process-kit] invalid formal spec data:",t),this.requestUpdate()}#f(t){return`element:${[this.id,...Cn(t)].map(e=>encodeURIComponent(e)).join("/")}`}#k(){const t=JSON.stringify(this.commentTargets);t!==this.#a&&(this.#a=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#y(t){const e=new Set(this.#i);if(e.delete(t)||e.add(t),this.#i=e,!e.has(t)){const s=this.#r?.anchor;s?.closest(".claim-body")?.id===Fe(t)&&this.#b(s)}this.requestUpdate()}#S(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#y(e)}#w(){const t=this.#r?.anchor??null,e=this.#o!==t;e&&(this.#o?.removeAttribute("aria-describedby"),t?.setAttribute("aria-describedby","spec-tip")),this.#o=t;const s=this.renderRoot.querySelector(".spec-tip");!s||!t||!e||this.#l.open(s,t,{width:300,height:240},{placement:"top-start"})}#x(t,e){this.#r?.anchor!==e&&(this.#r={tip:t,anchor:e},this.requestUpdate())}#b(t){this.#r===null||t!==void 0&&this.#r.anchor!==t||(this.#r=null,this.requestUpdate())}#$=t=>{t.key==="Escape"&&this.#b()};#T=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#b()};#A(t){const e=(n,i)=>{n.currentTarget instanceof HTMLElement&&i(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&e(n,i=>this.#x(t,i)),leave:n=>s(n)&&e(n,i=>this.#b(i)),show:n=>e(n,i=>this.#x(t,i)),hide:n=>e(n,i=>this.#b(i))}}render(){const t=this.#c,e=this.#m();return r`
1148
+ `],Fe=a=>`claim-body-${a}`;class He extends z{static{this.styles=An}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#n=null;#t=new Map;#e=null;#s=null;#a="";#i=new Set;#r=null;#o=null;#l=new bt(this);#d=new pt(this);#p=new R(this,()=>{this.#a=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#a="",document.addEventListener("keydown",this.#$),document.addEventListener("pointerdown",this.#A),this.#s=_(this,je,t=>{t.ok?this.#g(t.value):this.#v(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#$),document.removeEventListener("pointerdown",this.#A),this.#s?.(),this.#s=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#k(),this.#d.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=Ct(t.target,this.commentTargets,Yt(this.#p.locale),(s,n)=>this.#h(s,n));return e===null?null:[e]}#h(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#d.open(t,s,e)}#u(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}get commentTargets(){if(!this.id||this.#n===null)return[];const t=`${this.subject??this.heading??this.#c.heading} \xB7 ${this.id}`;return zn(this.#n).map(({target:e,label:s})=>({value:this.#f(e),label:s,group:t}))}get dataError(){return this.#e}get#c(){return pn(this.#p.locale)}#m(){return this.#n??bn()}#g(t){this.#n=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#v(t){this.#n=null,this.#t=new Map,this.#e=t,console.error("[dev-process-kit] invalid formal spec data:",t),this.requestUpdate()}#f(t){return`element:${[this.id,...Cn(t)].map(e=>encodeURIComponent(e)).join("/")}`}#k(){const t=JSON.stringify(this.commentTargets);t!==this.#a&&(this.#a=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#y(t){const e=new Set(this.#i);if(e.delete(t)||e.add(t),this.#i=e,!e.has(t)){const s=this.#r?.anchor;s?.closest(".claim-body")?.id===Fe(t)&&this.#b(s)}this.requestUpdate()}#S(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#y(e)}#w(){const t=this.#r?.anchor??null,e=this.#o!==t;e&&(this.#o?.removeAttribute("aria-describedby"),t?.setAttribute("aria-describedby","spec-tip")),this.#o=t;const s=this.renderRoot.querySelector(".spec-tip");!s||!t||!e||this.#l.open(s,t,{width:300,height:240},{placement:"top-start"})}#x(t,e){this.#r?.anchor!==e&&(this.#r={tip:t,anchor:e},this.requestUpdate())}#b(t){this.#r===null||t!==void 0&&this.#r.anchor!==t||(this.#r=null,this.requestUpdate())}#$=t=>{t.key==="Escape"&&this.#b()};#A=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#b()};#T(t){const e=(n,i)=>{n.currentTarget instanceof HTMLElement&&i(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&e(n,i=>this.#x(t,i)),leave:n=>s(n)&&e(n,i=>this.#b(i)),show:n=>e(n,i=>this.#x(t,i)),hide:n=>e(n,i=>this.#b(i))}}render(){const t=this.#c,e=this.#m();return r`
1149
1149
  <section class="spec">
1150
1150
  <header class="spec-toolbar">
1151
1151
  <span class="spec-title">${this.heading??t.heading}</span>
@@ -1155,10 +1155,10 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1155
1155
  ${this.#e===null?h:r`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
1156
1156
  ${this.#e===null&&e.claims.length===0?r`<p class="spec-empty">${t.empty}</p>`:h}
1157
1157
  <div class="spec-groups">
1158
- ${F(Ie(e),s=>s.target?.id??"",s=>this.#D(s))}
1158
+ ${F(Pe(e),s=>s.target?.id??"",s=>this.#D(s))}
1159
1159
  </div>
1160
1160
  </section>
1161
- ${this.#I()}
1161
+ ${this.#P()}
1162
1162
  ${this.#d.render({locale:this.#p.locale,errorMessage:this.#c.sendFailed,submit:(s,n)=>this.#u(s,n)})}
1163
1163
  `}#L(t){const e=this.#c,s=$n(t),n=[{tone:"unsound",label:e.incomplete,count:s.incomplete},{tone:"caveat",label:e.bounded,count:s.bounded},{tone:"caveat",label:e.conditional,count:s.conditional},{tone:"planned",label:e.planned,count:s.planned}].filter(i=>i.count>0);return r`${e.claims(t.claims.length)}
1164
1164
  ${n.map(i=>r`<span class="spec-chip" data-tone=${i.tone}>${i.label} ${i.count}</span>`)}`}#D(t){const e=r`<div class="spec-claims">
@@ -1171,7 +1171,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1171
1171
  </header>
1172
1172
  ${s.summary===null?h:r`<p class="target-summary">${this.#C(s.summary)}</p>`}
1173
1173
  ${t.claims.length===0?r`<p class="spec-empty">${this.#c.noClaims}</p>`:e}
1174
- </section>`}#R(t){const e=this.#c,s=Dt(e,t.assurance),n=this.#i.has(t.id),i=this.#A({kind:"assurance",claim:t.id}),d=Fe(t.id);return r`
1174
+ </section>`}#R(t){const e=this.#c,s=Dt(e,t.assurance),n=this.#i.has(t.id),i=this.#T({kind:"assurance",claim:t.id}),d=Fe(t.id);return r`
1175
1175
  <article class="claim" data-claim=${t.id} data-tone=${s.tone}>
1176
1176
  <div
1177
1177
  class="claim-head"
@@ -1186,7 +1186,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1186
1186
  aria-label=${n?e.hideDetails:e.showDetails}
1187
1187
  @click=${()=>this.#y(t.id)}
1188
1188
  >
1189
- ${Hs()}
1189
+ ${Fs()}
1190
1190
  </button>
1191
1191
  <h4 class="claim-statement">${this.#C(t.statement)}</h4>
1192
1192
  <button
@@ -1202,9 +1202,9 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1202
1202
  ${s.label}
1203
1203
  </button>
1204
1204
  </div>
1205
- ${n?this.#j(t,d):h}
1205
+ ${n?this.#q(t,d):h}
1206
1206
  </article>
1207
- `}#j(t,e){const s=this.#c,n=Dt(s,t.assurance);return r`<div class="claim-body" id=${e}>
1207
+ `}#q(t,e){const s=this.#c,n=Dt(s,t.assurance);return r`<div class="claim-body" id=${e}>
1208
1208
  <dl class="claim-parts">
1209
1209
  ${t.subjects.length===0?h:this.#E("subjects",s.subjects,t,t.subjects)}
1210
1210
  ${t.premises.length===0?r`<div class="claim-part" data-part="premises">
@@ -1227,7 +1227,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1227
1227
  <h5>${s.notClaimed}</h5>
1228
1228
  ${this.#z(t,t.notClaimed)}
1229
1229
  </section>`}
1230
- ${this.#q(t)}
1230
+ ${this.#j(t)}
1231
1231
  </div>`}#E(t,e,s,n){return r`<div class="claim-part" data-part=${t}>
1232
1232
  <dt>${e}</dt>
1233
1233
  <dd>${this.#z(s,n)}</dd>
@@ -1239,14 +1239,14 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1239
1239
  >
1240
1240
  <span class="clause-text">${this.#C(s.text)}</span>
1241
1241
  </li>`)}
1242
- </ul>`}#q(t){const e=this.#c,s=t.terms.flatMap(n=>this.#t.get(n)??[]);return s.length===0&&t.source===null?h:r`<footer class="claim-foot">
1242
+ </ul>`}#j(t){const e=this.#c,s=t.terms.flatMap(n=>this.#t.get(n)??[]);return s.length===0&&t.source===null?h:r`<footer class="claim-foot">
1243
1243
  ${s.length===0?h:r`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(n=>this.#M("term-chip",n.id,n.name))}`}
1244
1244
  ${t.source===null?h:r`<span class="claim-source"
1245
1245
  >${e.source}: ${t.source.tool===null?h:r`${t.source.tool} · `}<code
1246
1246
  >${t.source.ref}</code
1247
1247
  ></span
1248
1248
  >`}
1249
- </footer>`}#C(t){return r`${t.map(e=>e.kind==="text"?e.text:this.#M("term",e.id,e.label))}`}#P(t){return r`${t.map(e=>e.kind==="text"?e.text:r`<span class="term-static">${e.label}</span>`)}`}#M(t,e,s){const n=this.#A({kind:"term",term:e});return r`<button
1249
+ </footer>`}#C(t){return r`${t.map(e=>e.kind==="text"?e.text:this.#M("term",e.id,e.label))}`}#I(t){return r`${t.map(e=>e.kind==="text"?e.text:r`<span class="term-static">${e.label}</span>`)}`}#M(t,e,s){const n=this.#T({kind:"term",term:e});return r`<button
1250
1250
  type="button"
1251
1251
  class=${t}
1252
1252
  data-term=${e}
@@ -1257,7 +1257,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1257
1257
  @click=${n.show}
1258
1258
  >
1259
1259
  ${s}
1260
- </button>`}#I(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#O(t);return e===null?h:r`<div
1260
+ </button>`}#P(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#O(t);return e===null?h:r`<div
1261
1261
  id="spec-tip"
1262
1262
  class="spec-tip"
1263
1263
  role="tooltip"
@@ -1266,7 +1266,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1266
1266
  >
1267
1267
  <p class="tip-title">${e.title}</p>
1268
1268
  <p class="tip-body">${e.body}</p>
1269
- </div>`}#O(t){if(t.kind==="term"){const n=this.#t.get(t.term);return n===void 0?null:{title:n.name,body:this.#P(n.meaning)}}const e=this.#n?.claims.find(n=>n.id===t.claim);if(e===void 0)return null;const s=Dt(this.#c,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const _e=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",He)},An=D({en:{heading:"Content",untitled:"Untitled",sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u672C\u6587",untitled:"\u7121\u984C",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),Mn=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,Ln=a=>{const t=Mn.exec(a?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},Be=60,Dn=(a,t,e,s)=>{const n=[a,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return n===void 0?s:n.length>Be?`${n.slice(0,Be-1)}\u2026`:n},rt=a=>`${a.kind}:${a.id}`,Rn=a=>{const t=new Map;for(const e of a)t.set(rt(e),(t.get(rt(e))??0)+1);return a.filter(e=>t.get(rt(e))===1)},Ne=(a,t)=>`element:${[a,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,jn="[data-dpk-item]",qn="h1, h2, h3, h4, h5, h6, summary, caption, legend";class We extends z{static{this.styles=[M,K,yt,T`
1269
+ </div>`}#O(t){if(t.kind==="term"){const n=this.#t.get(t.term);return n===void 0?null:{title:n.name,body:this.#I(n.meaning)}}const e=this.#n?.claims.find(n=>n.id===t.claim);if(e===void 0)return null;const s=Dt(this.#c,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const Be=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",He)},Tn=D({en:{heading:"Content",untitled:"Untitled",sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u672C\u6587",untitled:"\u7121\u984C",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),Mn=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,Ln=a=>{const t=Mn.exec(a?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},_e=60,Dn=(a,t,e,s)=>{const n=[a,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return n===void 0?s:n.length>_e?`${n.slice(0,_e-1)}\u2026`:n},rt=a=>`${a.kind}:${a.id}`,Rn=a=>{const t=new Map;for(const e of a)t.set(rt(e),(t.get(rt(e))??0)+1);return a.filter(e=>t.get(rt(e))===1)},Ne=(a,t)=>`element:${[a,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,qn="[data-dpk-item]",jn="h1, h2, h3, h4, h5, h6, summary, caption, legend";class We extends z{static{this.styles=[M,K,kt,A`
1270
1270
  :host {
1271
1271
  position: relative;
1272
1272
  display: block;
@@ -1279,11 +1279,11 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1279
1279
  font-size: 11px;
1280
1280
  color: var(--dpk-accent);
1281
1281
  }
1282
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#n=new R(this);#t=new pt(this);#e=new MutationObserver(()=>{this.#d()});#s=[];#a=new Set;#i="";constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#e.observe(this,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["data-dpk-item","data-dpk-label"]}),this.#d()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#l.heading} \xB7 ${this.id}`;return this.#s.map(e=>({value:Ne(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#h()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=Ct(t.target,this.commentTargets,ae(this.#n.locale),(s,n)=>this.#r(s,n));return e===null?null:[e]}#r(t,e){const s=this.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#t.open(t,s,e)}#o(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}render(){return r`<slot></slot>${this.#t.render({locale:this.#n.locale,errorMessage:this.#l.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#l(){return An(this.#n.locale)}#d(){const t=[...this.querySelectorAll(jn)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const n=Ln(s.getAttribute("data-dpk-item"));if(n===null)return[];const i=s.querySelector(qn)?.textContent??null,d=Dn(s.getAttribute("data-dpk-label"),i,s.textContent,this.#l.untitled);return[{...n,label:d,element:s}]}),e=Rn(t);if(e.length<t.length){const s=new Set(e.map(rt)),n=[...new Set(t.map(rt).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,n)}this.#s=e,this.#p(),this.#h()}#p(){const t=new Set(this.#s.map(e=>e.element));for(const e of this.#a)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#s)e.element.setAttribute("data-dpk-target",Ne(this.id,e));this.#a=t}#h(){const t=JSON.stringify(this.commentTargets);t!==this.#i&&(this.#i=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}}const Ge=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",We)},Pn="dpk-extend-right-click-run",Rt=$(b(),E(1)),Z=$(b(),E(1)),In=y({kind:V("item"),id:Rt,label:Z,danger:u(at()),event:u(Z),detail:u(_s(b(),vt())),copy:u(Z)}),On=y({kind:V("submenu"),id:Rt,label:Z,entries:w(ne(()=>Ke))}),Ke=ne(()=>ee("kind",[In,On])),Un=y({id:Rt,heading:u(Z),entries:w(Ke)}),Fn=y({selector:$(b(),se(),E(1)),label:u(Z),groups:w(Un)}),Hn=y({targets:w(Fn)}),Ve=(a,t)=>{for(const e of a){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&Ve(e.entries,t)}},jt=a=>{const t=B(Hn,a),e=new Set;for(const s of t.targets)for(const n of s.groups){if(e.has(n.id))throw new Error(`duplicate id: ${n.id}`);e.add(n.id),Ve(n.entries,e)}return t},Xe="dpk-extend-right-click",qt=`[dev-process-kit] ${Xe}: `,_n="text",Bn=(a,t)=>{const e=Bs(a,a),s=e.indexOf(t);return s===-1?null:[a,...e.slice(0,s)]},Nn=(a,t)=>{const s=(t===_n?a.textContent:a.getAttribute(t))?.trim()??"";return s===""?null:s},Wn=(a,t,e)=>{try{return a.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${qt}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class Ye extends z{static{this.styles=T`
1282
+ `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#n=new R(this);#t=new pt(this);#e=new MutationObserver(()=>{this.#d()});#s=[];#a=new Set;#i="";constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#e.observe(this,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["data-dpk-item","data-dpk-label"]}),this.#d()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#l.heading} \xB7 ${this.id}`;return this.#s.map(e=>({value:Ne(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#h()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=Ct(t.target,this.commentTargets,Yt(this.#n.locale),(s,n)=>this.#r(s,n));return e===null?null:[e]}#r(t,e){const s=this.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#t.open(t,s,e)}#o(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}render(){return r`<slot></slot>${this.#t.render({locale:this.#n.locale,errorMessage:this.#l.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#l(){return Tn(this.#n.locale)}#d(){const t=[...this.querySelectorAll(qn)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const n=Ln(s.getAttribute("data-dpk-item"));if(n===null)return[];const i=s.querySelector(jn)?.textContent??null,d=Dn(s.getAttribute("data-dpk-label"),i,s.textContent,this.#l.untitled);return[{...n,label:d,element:s}]}),e=Rn(t);if(e.length<t.length){const s=new Set(e.map(rt)),n=[...new Set(t.map(rt).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,n)}this.#s=e,this.#p(),this.#h()}#p(){const t=new Set(this.#s.map(e=>e.element));for(const e of this.#a)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#s)e.element.setAttribute("data-dpk-target",Ne(this.id,e));this.#a=t}#h(){const t=JSON.stringify(this.commentTargets);t!==this.#i&&(this.#i=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}}const Ge=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",We)},In="dpk-extend-right-click-run",Rt=$(b(),E(1)),Y=$(b(),E(1)),Pn=y({kind:V("item"),id:Rt,label:Y,danger:u(at()),event:u(Y),detail:u(ta(b(),yt())),copy:u(Y)}),On=y({kind:V("submenu"),id:Rt,label:Y,entries:w(re(()=>Ke))}),Ke=re(()=>ne("kind",[Pn,On])),Un=y({id:Rt,heading:u(Y),entries:w(Ke)}),Fn=y({selector:$(b(),ie(),E(1)),label:u(Y),groups:w(Un)}),Hn=y({targets:w(Fn)}),Ve=(a,t)=>{for(const e of a){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&Ve(e.entries,t)}},qt=a=>{const t=N(Hn,a),e=new Set;for(const s of t.targets)for(const n of s.groups){if(e.has(n.id))throw new Error(`duplicate id: ${n.id}`);e.add(n.id),Ve(n.entries,e)}return t},Je="dpk-extend-right-click",jt=`[dev-process-kit] ${Je}: `,Bn="text",_n=(a,t)=>{const e=Hs(a,a),s=e.indexOf(t);return s===-1?null:[a,...e.slice(0,s)]},Nn=(a,t)=>{const s=(t===Bn?a.textContent:a.getAttribute(t))?.trim()??"";return s===""?null:s},Wn=(a,t,e)=>{try{return a.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${jt}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class Xe extends z{static{this.styles=A`
1283
1283
  :host {
1284
1284
  display: contents;
1285
1285
  }
1286
- `}static{this.properties={config:{attribute:!1}}}#n=null;#t=null;#e=null;#s=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=N(this,jt,t=>{if(t.ok){this.#n=t.value,this.#t=null;return}this.#n=null,this.#t=t.error,console.warn(`${qt}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#a();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const n=Bn(s,this);if(n===null||n.some(l=>l.localName===Xe))return null;const i=this.#r(n,e);if(i===null)return null;const d=this.#o(i.target,i.element);return d.length===0?null:d}render(){return r`<slot></slot>`}#a(){return this.config===null?this.#n:(this.#s?.raw!==this.config&&(this.#s={raw:this.config,parsed:this.#i(this.config)}),this.#s.parsed)}#i(t){try{return jt(t)}catch(e){return console.warn(`${qt}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const n of t)for(const i of e.targets)if(Wn(n,i.selector,s))return{target:i,element:n};return null}#o(t,e){return t.groups.flatMap(s=>{const n=this.#l(s.entries,s,t,e);return n.length===0?[]:[s.heading===void 0?{id:s.id,entries:n}:{id:s.id,heading:s.heading,entries:n}]})}#l(t,e,s,n){return t.flatMap(i=>i.kind==="submenu"?this.#d(i,e,s,n):this.#p(i,e,s,n))}#d(t,e,s,n){const i=this.#l(t.entries,e,s,n);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,n){const i=t.copy===void 0?null:Nn(n,t.copy);if(t.copy!==void 0&&i===null)return[];const d=()=>{i!==null&&wt(i),!(i!==null&&t.event===void 0)&&this.#h(t,e,s,n)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:d,danger:!0}:{kind:"item",id:t.id,label:t.label,run:d}]}#h(t,e,s,n){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:n,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??Pn,{detail:i,bubbles:!0,composed:!0}))}}const Ze=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",Ye)},Gn=D({en:{sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}});class Je extends z{static{this.styles=[M,K,yt,T`
1286
+ `}static{this.properties={config:{attribute:!1}}}#n=null;#t=null;#e=null;#s=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=_(this,qt,t=>{if(t.ok){this.#n=t.value,this.#t=null;return}this.#n=null,this.#t=t.error,console.warn(`${jt}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#a();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const n=_n(s,this);if(n===null||n.some(l=>l.localName===Je))return null;const i=this.#r(n,e);if(i===null)return null;const d=this.#o(i.target,i.element);return d.length===0?null:d}render(){return r`<slot></slot>`}#a(){return this.config===null?this.#n:(this.#s?.raw!==this.config&&(this.#s={raw:this.config,parsed:this.#i(this.config)}),this.#s.parsed)}#i(t){try{return qt(t)}catch(e){return console.warn(`${jt}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const n of t)for(const i of e.targets)if(Wn(n,i.selector,s))return{target:i,element:n};return null}#o(t,e){return t.groups.flatMap(s=>{const n=this.#l(s.entries,s,t,e);return n.length===0?[]:[s.heading===void 0?{id:s.id,entries:n}:{id:s.id,heading:s.heading,entries:n}]})}#l(t,e,s,n){return t.flatMap(i=>i.kind==="submenu"?this.#d(i,e,s,n):this.#p(i,e,s,n))}#d(t,e,s,n){const i=this.#l(t.entries,e,s,n);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,n){const i=t.copy===void 0?null:Nn(n,t.copy);if(t.copy!==void 0&&i===null)return[];const d=()=>{i!==null&&vt(i),!(i!==null&&t.event===void 0)&&this.#h(t,e,s,n)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:d,danger:!0}:{kind:"item",id:t.id,label:t.label,run:d}]}#h(t,e,s,n){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:n,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??In,{detail:i,bubbles:!0,composed:!0}))}}const Ye=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",Xe)},Gn=D({en:{sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}});class Ze extends z{static{this.styles=[M,K,kt,A`
1287
1287
  :host {
1288
1288
  position: relative;
1289
1289
  display: inline-block;
@@ -1296,7 +1296,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1296
1296
  simply being there when the reader looks back. */
1297
1297
  animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
1298
1298
  }
1299
- `]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#n=new R(this);#t=new pt(this);constructor(){super(),this.target="",this.label=null,this.open=!1,this.addEventListener("click",this.#e)}#e=()=>{this.open=!0};get commentTargets(){return this.target.length===0?[]:[{value:this.target,label:this.label??this.target}]}willUpdate(t){t.has("target")&&(this.target.length===0?this.removeAttribute("data-dpk-target"):this.setAttribute("data-dpk-target",this.target)),t.has("open")&&(this.open&&!this.#t.isOpen?this.#t.open(this.target,this,this.label??void 0):!this.open&&this.#t.isOpen&&this.#t.close())}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop")),this.open!==this.#t.isOpen&&(this.open=this.#t.isOpen)}render(){return r`<slot></slot>${this.#t.render({locale:this.#n.locale,errorMessage:Gn(this.#n.locale).sendFailed,submit:(t,e)=>this.#s(t,e)})}`}#s(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const Qe=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",Je)},ts=(a,t)=>{const e=t===null?-1:a.indexOf(t);return e===-1?0:e},Kn=(a,t,e)=>{if(e===0)return null;switch(a){case"ArrowRight":case"ArrowDown":return(t+1)%e;case"ArrowLeft":case"ArrowUp":return(t-1+e)%e;case"Home":return 0;case"End":return e-1;default:return null}},Vn=":scope > [data-name]";let Xn=0;class es extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[M,T`
1299
+ `]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#n=new R(this);#t=new pt(this);constructor(){super(),this.target="",this.label=null,this.open=!1,this.addEventListener("click",this.#e)}#e=()=>{this.open=!0};get commentTargets(){return this.target.length===0?[]:[{value:this.target,label:this.label??this.target}]}willUpdate(t){t.has("target")&&(this.target.length===0?this.removeAttribute("data-dpk-target"):this.setAttribute("data-dpk-target",this.target)),t.has("open")&&(this.open&&!this.#t.isOpen?this.#t.open(this.target,this,this.label??void 0):!this.open&&this.#t.isOpen&&this.#t.close())}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop")),this.open!==this.#t.isOpen&&(this.open=this.#t.isOpen)}render(){return r`<slot></slot>${this.#t.render({locale:this.#n.locale,errorMessage:Gn(this.#n.locale).sendFailed,submit:(t,e)=>this.#s(t,e)})}`}#s(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const Qe=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",Ze)},ts=(a,t)=>{const e=t===null?-1:a.indexOf(t);return e===-1?0:e},Kn=(a,t,e)=>{if(e===0)return null;switch(a){case"ArrowRight":case"ArrowDown":return(t+1)%e;case"ArrowLeft":case"ArrowUp":return(t-1+e)%e;case"Home":return 0;case"End":return e-1;default:return null}},Vn=":scope > [data-name]";let Jn=0;class es extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[M,A`
1300
1300
  :host {
1301
1301
  display: block;
1302
1302
  font-size: inherit;
@@ -1389,7 +1389,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1389
1389
  ::slotted([data-name]) {
1390
1390
  animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
1391
1391
  }
1392
- `]}static{this.properties={selected:{type:String,reflect:!0}}}#n=`dpk-tabs-${++Xn}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#a()):null;constructor(){super(),this.selected=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-name"]}),this.#e?.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.#e?.disconnect()}get#s(){return[...this.querySelectorAll(Vn)]}render(){const t=this.#s,e=t.map(n=>n.dataset.name??""),s=ts(e,this.selected);return r`<div role="tablist" @keydown=${this.#r}>
1392
+ `]}static{this.properties={selected:{type:String,reflect:!0}}}#n=`dpk-tabs-${++Jn}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#a()):null;constructor(){super(),this.selected=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-name"]}),this.#e?.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.#e?.disconnect()}get#s(){return[...this.querySelectorAll(Vn)]}render(){const t=this.#s,e=t.map(n=>n.dataset.name??""),s=ts(e,this.selected);return r`<div role="tablist" @keydown=${this.#r}>
1393
1393
  <span class="indicator" aria-hidden="true"></span>
1394
1394
  ${F(e,(n,i)=>`${i}:${n}`,(n,i)=>r`<button
1395
1395
  type="button"
@@ -1405,7 +1405,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1405
1405
  </div>
1406
1406
  <div role="tabpanel" id="${this.#n}-panel" aria-labelledby="${this.#n}-tab-${s}">
1407
1407
  <slot></slot>
1408
- </div>`}updated(t){const e=this.#s,s=e.map(i=>i.dataset.name??""),n=e[ts(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...n===void 0?[]:[n]),this.#a()}#a(){const t=this.renderRoot.querySelector('[role="tablist"]'),e=this.renderRoot.querySelector('[role="tab"][aria-selected="true"]');t===null||e===null||(t.style.setProperty("--dpk-tabs-indicator-x",`${e.offsetLeft}px`),t.style.setProperty("--dpk-tabs-indicator-w",`${e.offsetWidth}px`),!(t.hasAttribute("data-ready")||typeof requestAnimationFrame!="function")&&requestAnimationFrame(()=>{t.setAttribute("data-ready","")}))}#i(t){t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("dpk-tab-change",{detail:{name:t},bubbles:!0,composed:!0})))}#r=t=>{const e=[...this.renderRoot.querySelectorAll('[role="tab"]')],s=e.findIndex(d=>d.getAttribute("aria-selected")==="true"),n=Kn(t.key,s,e.length);if(n===null)return;t.preventDefault();const i=this.#s[n]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[n]?.focus()})}}const ss=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",es)},Yn=D({en:{heading:"Checklist",empty:"No items.",progress:(a,t)=>`${a} / ${t} done`,actionTitle:(a,t)=>`${t?"Checked":"Unchecked"}: ${a}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:a=>`Comment on ${a}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(a,t)=>`${a} / ${t} \u5B8C\u4E86`,actionTitle:(a,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${a}`,unrecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:a=>`${a} \u306B\u30B3\u30E1\u30F3\u30C8`}}),as="SET_CHECKED",Zn=y({id:$(b(),ie(/^[A-Za-z0-9_-]+$/)),label:$(b(),E(1)),checked:u(at()),note:u(b())}),Jn=y({items:w(Zn)}),ns=()=>({items:[]}),is=a=>{const t=B(Jn,a),e=new Set;return{items:t.items.map(s=>{if(e.has(s.id))throw new Error(`duplicate item id: ${s.id}`);return e.add(s.id),{id:s.id,label:s.label,checked:s.checked??!1,note:s.note??null,changed:!1}})}},Qn=kt({checked:at()}),ti=(a,t,e)=>{const s=new Map(t.items.map(d=>[d.id,d.checked])),n=new Map(s),i=e.map(d=>{if(d.type!==as)return{id:d.id,title:d.type,stale:"unsupported-action-type"};const l=ba(d.target.id),o=l?.[1]==="item"?l[2]:void 0,m=Zt(Qn,d.payload);if(o===void 0||!n.has(o)||!m.success)return{id:d.id,title:a.actionTitle(o??d.target.id,!0),stale:"target-missing"};n.set(o,m.output.checked);const p=t.items.find(f=>f.id===o)?.label??o;return{id:d.id,title:a.actionTitle(p,m.output.checked),tone:"update"}});return{data:{items:t.items.map(d=>{const l=n.get(d.id)??d.checked;return{...d,checked:l,changed:l!==s.get(d.id)}})},results:i}},ei=a=>({done:a.items.filter(t=>t.checked).length,total:a.items.length});class rs extends z{static{this.styles=[M,T`
1408
+ </div>`}updated(t){const e=this.#s,s=e.map(i=>i.dataset.name??""),n=e[ts(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...n===void 0?[]:[n]),this.#a()}#a(){const t=this.renderRoot.querySelector('[role="tablist"]'),e=this.renderRoot.querySelector('[role="tab"][aria-selected="true"]');t===null||e===null||(t.style.setProperty("--dpk-tabs-indicator-x",`${e.offsetLeft}px`),t.style.setProperty("--dpk-tabs-indicator-w",`${e.offsetWidth}px`),!(t.hasAttribute("data-ready")||typeof requestAnimationFrame!="function")&&requestAnimationFrame(()=>{t.setAttribute("data-ready","")}))}#i(t){t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("dpk-tab-change",{detail:{name:t},bubbles:!0,composed:!0})))}#r=t=>{const e=[...this.renderRoot.querySelectorAll('[role="tab"]')],s=e.findIndex(d=>d.getAttribute("aria-selected")==="true"),n=Kn(t.key,s,e.length);if(n===null)return;t.preventDefault();const i=this.#s[n]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[n]?.focus()})}}const ss=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",es)},Xn=D({en:{heading:"Checklist",empty:"No items.",progress:(a,t)=>`${a} / ${t} done`,actionTitle:(a,t)=>`${t?"Checked":"Unchecked"}: ${a}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:a=>`Comment on ${a}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(a,t)=>`${a} / ${t} \u5B8C\u4E86`,actionTitle:(a,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${a}`,unrecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:a=>`${a} \u306B\u30B3\u30E1\u30F3\u30C8`}}),as="SET_CHECKED",Yn=y({id:$(b(),oe(/^[A-Za-z0-9_-]+$/)),label:$(b(),E(1)),checked:u(at()),note:u(b())}),Zn=y({items:w(Yn)}),ns=()=>({items:[]}),is=a=>{const t=N(Zn,a),e=new Set;return{items:t.items.map(s=>{if(e.has(s.id))throw new Error(`duplicate item id: ${s.id}`);return e.add(s.id),{id:s.id,label:s.label,checked:s.checked??!1,note:s.note??null,changed:!1}})}},Qn=xt({checked:at()}),ti=(a,t,e)=>{const s=new Map(t.items.map(d=>[d.id,d.checked])),n=new Map(s),i=e.map(d=>{if(d.type!==as)return{id:d.id,title:d.type,stale:"unsupported-action-type"};const l=ba(d.target.id),o=l?.[1]==="item"?l[2]:void 0,m=se(Qn,d.payload);if(o===void 0||!n.has(o)||!m.success)return{id:d.id,title:a.actionTitle(o??d.target.id,!0),stale:"target-missing"};n.set(o,m.output.checked);const p=t.items.find(f=>f.id===o)?.label??o;return{id:d.id,title:a.actionTitle(p,m.output.checked),tone:"update"}});return{data:{items:t.items.map(d=>{const l=n.get(d.id)??d.checked;return{...d,checked:l,changed:l!==s.get(d.id)}})},results:i}},ei=a=>({done:a.items.filter(t=>t.checked).length,total:a.items.length});class rs extends z{static{this.styles=[M,A`
1409
1409
  :host {
1410
1410
  display: block;
1411
1411
  color: var(--dpk-ink);
@@ -1604,7 +1604,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1604
1604
  .error {
1605
1605
  color: var(--dpk-danger);
1606
1606
  }
1607
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#n=new R(this);#t=null;#e=null;#s=null;#a=ns();#i=[];#r=[];#o=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=N(this,is,t=>{t.ok?(this.#e=t.value,this.#s=null):(this.#e=null,this.#s=t.error),this.#m(),this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0}))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}get commentTargets(){if(!this.id)return[];const t=`${this.#d} \xB7 ${this.id}`;return this.#a.items.map(e=>({value:this.#c(e.id),label:e.label,group:t}))}get elementActions(){return this.#i}set elementActions(t){this.#i=t,this.#m()}get elementActionResults(){return this.#r}render(){const t=this.#l;if(this.#s!==null)return r`<p class="error">${this.#s}</p>`;const e=ei(this.#a),s=e.total===0?0:e.done/e.total,n=t.progress(e.done,e.total);return r`<div class="card">
1607
+ `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#n=new R(this);#t=null;#e=null;#s=null;#a=ns();#i=[];#r=[];#o=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=_(this,is,t=>{t.ok?(this.#e=t.value,this.#s=null):(this.#e=null,this.#s=t.error),this.#m(),this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0}))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}get commentTargets(){if(!this.id)return[];const t=`${this.#d} \xB7 ${this.id}`;return this.#a.items.map(e=>({value:this.#c(e.id),label:e.label,group:t}))}get elementActions(){return this.#i}set elementActions(t){this.#i=t,this.#m()}get elementActionResults(){return this.#r}render(){const t=this.#l;if(this.#s!==null)return r`<p class="error">${this.#s}</p>`;const e=ei(this.#a),s=e.total===0?0:e.done/e.total,n=t.progress(e.done,e.total);return r`<div class="card">
1608
1608
  <div class="head">
1609
1609
  <span class="heading">${this.#d}</span>
1610
1610
  <span class="count" aria-label=${n}
@@ -1624,7 +1624,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1624
1624
  ${this.#a.items.length===0?r`<p class="empty">${t.empty}</p>`:r`<ul>
1625
1625
  ${F(this.#a.items,i=>i.id,i=>this.#p(t,i))}
1626
1626
  </ul>`}
1627
- </div>`}get#l(){return Yn(this.#n.locale)}get#d(){return this.heading??this.#l.heading}#p(t,e){const s=`item-${e.id}`;return r`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
1627
+ </div>`}get#l(){return Xn(this.#n.locale)}get#d(){return this.heading??this.#l.heading}#p(t,e){const s=`item-${e.id}`;return r`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
1628
1628
  <span class="check">
1629
1629
  <input
1630
1630
  id=${s}
@@ -1633,7 +1633,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1633
1633
  .checked=${e.checked}
1634
1634
  @change=${n=>{n.currentTarget instanceof HTMLInputElement&&this.#h(e,n.currentTarget.checked)}}
1635
1635
  />
1636
- <span class="check-mark">${ct()}</span>
1636
+ <span class="check-mark">${dt()}</span>
1637
1637
  </span>
1638
1638
  <label for=${s}>
1639
1639
  <span class="label">${e.label}</span>
@@ -1647,9 +1647,9 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1647
1647
  title=${t.commentOn(e.label)}
1648
1648
  @click=${()=>{this.#u(e.id)}}
1649
1649
  >
1650
- ${Ns()}
1650
+ ${Bs()}
1651
1651
  </button>`:h}
1652
- </li>`}#h(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:as,target:this.#c(t.id),payload:{checked:e}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),this.#o=s.defaultPrevented?null:t.id,this.requestUpdate()}#u(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:this.#c(t)},bubbles:!0,composed:!0}))}#c(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#m(){if(this.#e===null)this.#a=ns(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=ti(this.#l,this.#e,this.#i);this.#a=t.data,this.#r=t.results}this.requestUpdate()}}const os=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",rs)},v=(a,t,e)=>e===void 0?{kind:a,pattern:t}:{kind:a,pattern:t,next:e},ot=v(null,/\s+/y),Pt=v("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),It=v("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),si=["abstract","as","async","await","break","case","catch","class","const","continue","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","keyof","let","new","null","of","private","protected","public","readonly","return","satisfies","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","yield"],ai={js:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),It,v("string",/`(?:\\[\s\S]|[^\\`])*`?/y),Pt,v("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),v("keyword",new RegExp(`(?:${si.join("|")})(?![\\w$])`,"y")),v("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),v(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[v("comment",/<!--[\s\S]*?(?:-->|$)/y),v("keyword",/&#?\w+;/y),v("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),v(null,/[^<&]+/y)],tag:[ot,v("tag",/\/?>/y,"text"),v("punct",/=/y),v("string",/"[^"]*"?|'[^']*'?/y),v("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[ot,It,Pt,v("keyword",/@[\w-]+/y),v("punct",/[{}]/y),v("tag",/[^{};]+(?=\{)/y),v("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),v("number",/#[\da-f]{3,8}(?![\w-])/iy),v(null,/-?[A-Za-z_][\w-]*/y),v("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[ot,v("comment",/\/\/[^\n]*/y),It,v("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),v("string",/"(?:\\.|[^\\"\n])*"?/y),v("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),v("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[ot,v("comment",/(?<!\S)#[^\n]*/y),Pt,v("keyword",/\$\{[^}\n]*\}?|\$\w+/y),v("attr",/(?<!\S)--?[\w-]+/y),v(null,/[^\s"'$#]+/y)]}}},ni={js:"js",javascript:"js",jsx:"js",mjs:"js",cjs:"js",ts:"js",typescript:"js",tsx:"js",mts:"js",html:"html",xml:"html",svg:"html",vue:"html",css:"css",json:"json",jsonc:"json",json5:"json",sh:"sh",bash:"sh",zsh:"sh",shell:"sh",console:"sh"},ii=a=>a===null?null:ni[a.trim().toLowerCase()]??null,ls=(a,t,e)=>{const s=a.at(-1);t===null&&s!==void 0&&s.kind===null?a[a.length-1]={kind:t,text:s.text+e}:a.push({kind:t,text:e})},ds=(a,t)=>{const e=ii(t);if(e===null)return a===""?[]:[{kind:null,text:a}];const{start:s,rules:n}=ai[e],i=[];let d=s,l=0;for(;l<a.length;){const o=(n[d]??[]).find(m=>(m.pattern.lastIndex=l,m.pattern.test(a)&&m.pattern.lastIndex>l));if(o===void 0){ls(i,null,a.charAt(l)),l+=1;continue}ls(i,o.kind,a.slice(l,o.pattern.lastIndex)),l=o.pattern.lastIndex,d=o.next??d}return i},cs=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:a=>`Copy ${a}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:a=>`${a} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),ps=T`
1652
+ </li>`}#h(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:as,target:this.#c(t.id),payload:{checked:e}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),this.#o=s.defaultPrevented?null:t.id,this.requestUpdate()}#u(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:this.#c(t)},bubbles:!0,composed:!0}))}#c(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#m(){if(this.#e===null)this.#a=ns(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=ti(this.#l,this.#e,this.#i);this.#a=t.data,this.#r=t.results}this.requestUpdate()}}const os=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",rs)},v=(a,t,e)=>e===void 0?{kind:a,pattern:t}:{kind:a,pattern:t,next:e},ot=v(null,/\s+/y),It=v("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),Pt=v("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),si=["abstract","as","async","await","break","case","catch","class","const","continue","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","keyof","let","new","null","of","private","protected","public","readonly","return","satisfies","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","yield"],ai={js:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),Pt,v("string",/`(?:\\[\s\S]|[^\\`])*`?/y),It,v("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),v("keyword",new RegExp(`(?:${si.join("|")})(?![\\w$])`,"y")),v("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),v(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[v("comment",/<!--[\s\S]*?(?:-->|$)/y),v("keyword",/&#?\w+;/y),v("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),v(null,/[^<&]+/y)],tag:[ot,v("tag",/\/?>/y,"text"),v("punct",/=/y),v("string",/"[^"]*"?|'[^']*'?/y),v("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[ot,Pt,It,v("keyword",/@[\w-]+/y),v("punct",/[{}]/y),v("tag",/[^{};]+(?=\{)/y),v("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),v("number",/#[\da-f]{3,8}(?![\w-])/iy),v(null,/-?[A-Za-z_][\w-]*/y),v("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[ot,v("comment",/\/\/[^\n]*/y),Pt,v("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),v("string",/"(?:\\.|[^\\"\n])*"?/y),v("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),v("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[ot,v("comment",/(?<!\S)#[^\n]*/y),It,v("keyword",/\$\{[^}\n]*\}?|\$\w+/y),v("attr",/(?<!\S)--?[\w-]+/y),v(null,/[^\s"'$#]+/y)]}}},ni={js:"js",javascript:"js",jsx:"js",mjs:"js",cjs:"js",ts:"js",typescript:"js",tsx:"js",mts:"js",html:"html",xml:"html",svg:"html",vue:"html",css:"css",json:"json",jsonc:"json",json5:"json",sh:"sh",bash:"sh",zsh:"sh",shell:"sh",console:"sh"},ii=a=>a===null?null:ni[a.trim().toLowerCase()]??null,ls=(a,t,e)=>{const s=a.at(-1);t===null&&s!==void 0&&s.kind===null?a[a.length-1]={kind:t,text:s.text+e}:a.push({kind:t,text:e})},ds=(a,t)=>{const e=ii(t);if(e===null)return a===""?[]:[{kind:null,text:a}];const{start:s,rules:n}=ai[e],i=[];let d=s,l=0;for(;l<a.length;){const o=(n[d]??[]).find(m=>(m.pattern.lastIndex=l,m.pattern.test(a)&&m.pattern.lastIndex>l));if(o===void 0){ls(i,null,a.charAt(l)),l+=1;continue}ls(i,o.kind,a.slice(l,o.pattern.lastIndex)),l=o.pattern.lastIndex,d=o.next??d}return i},cs=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:a=>`Copy ${a}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:a=>`${a} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),ps=A`
1653
1653
  :host {
1654
1654
  display: block;
1655
1655
  overflow: hidden;
@@ -1770,12 +1770,12 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1770
1770
  <span class="name">${e}</span>
1771
1771
  ${this.language?r`<span class="language">${this.language}</span>`:h}
1772
1772
  <button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
1773
- ${this.#e==="copied"?ct():re()}<span aria-live="polite">${s}</span>
1773
+ ${this.#e==="copied"?dt():Zt()}<span aria-live="polite">${s}</span>
1774
1774
  </button>
1775
1775
  </div>
1776
- <pre><code>${this.#a()}</code></pre>`}#a(){return ds(this.text,this.language).map(t=>t.kind===null?t.text:r`<span class=${t.kind}>${t.text}</span>`)}get#i(){return cs(this.#n.locale)}#r=async()=>{const t=await wt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const Ot=a=>{const t=a.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
1776
+ <pre><code>${this.#a()}</code></pre>`}#a(){return ds(this.text,this.language).map(t=>t.kind===null?t.text:r`<span class=${t.kind}>${t.text}</span>`)}get#i(){return cs(this.#n.locale)}#r=async()=>{const t=await vt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const Ot=a=>{const t=a.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
1777
1777
  `),e=t.filter(n=>n.trim()!=="").map(n=>/^[ \t]*/.exec(n)?.[0].length??0),s=e.length===0?0:Math.min(...e);return t.map(n=>n.slice(s)).join(`
1778
- `)},us=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",hs)},oi=D({en:{empty:"No code variants",invalid:a=>`Invalid code group: ${a}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:a=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${a}`}}),li=y({label:$(b(),E(1)),language:u(b(),""),code:$(b(),E(1))}),di=y({label:u(b(),""),variants:$(w(li),E(1))}),gt=a=>{const t=B(di,a),e=new Set;for(const s of t.variants){if(e.has(s.label))throw new Error(`duplicate variant label: ${s.label}`);e.add(s.label)}return t},ci=T`
1778
+ `)},us=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",hs)},oi=D({en:{empty:"No code variants",invalid:a=>`Invalid code group: ${a}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:a=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${a}`}}),li=y({label:$(b(),E(1)),language:u(b(),""),code:$(b(),E(1))}),di=y({label:u(b(),""),variants:$(w(li),E(1))}),gt=a=>{const t=N(di,a),e=new Set;for(const s of t.variants){if(e.has(s.label))throw new Error(`duplicate variant label: ${s.label}`);e.add(s.label)}return t},ci=A`
1779
1779
  :host {
1780
1780
  min-width: 0;
1781
1781
  }
@@ -1845,7 +1845,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1845
1845
  display: none;
1846
1846
  }
1847
1847
  }
1848
- `;class ms extends z{static{this.styles=[M,ps,ci]}static{this.properties={data:{attribute:!1}}}#n=new R(this);#t=null;#e=null;#s=0;#a="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=N(this,gt,t=>{this.#s=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate())}),queueMicrotask(()=>{if(this.#t!==null||this.#e!==null)return;const t=Zs(this,gt);t!==null&&(this.#r?.(),this.#r=null,this.#s=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate()))})}disconnectedCallback(){super.disconnectedCallback(),this.#r?.(),this.#r=null,clearTimeout(this.#i)}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=gt(this.data),this.#e=null,this.#s=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=cs(this.#n.locale),e=oi(this.#n.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,r`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,r`<p class="empty">${e.empty}</p>`);const n=Math.min(this.#s,s.variants.length-1),i=s.label===""?t.code:s.label,d=this.#a==="copied"?t.copied:this.#a==="failed"?t.copyFailed:t.copy;return r`<div class="bar">
1848
+ `;class ms extends z{static{this.styles=[M,ps,ci]}static{this.properties={data:{attribute:!1}}}#n=new R(this);#t=null;#e=null;#s=0;#a="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=_(this,gt,t=>{this.#s=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate())}),queueMicrotask(()=>{if(this.#t!==null||this.#e!==null)return;const t=Js(this,gt);t!==null&&(this.#r?.(),this.#r=null,this.#s=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate()))})}disconnectedCallback(){super.disconnectedCallback(),this.#r?.(),this.#r=null,clearTimeout(this.#i)}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=gt(this.data),this.#e=null,this.#s=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=cs(this.#n.locale),e=oi(this.#n.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,r`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,r`<p class="empty">${e.empty}</p>`);const n=Math.min(this.#s,s.variants.length-1),i=s.label===""?t.code:s.label,d=this.#a==="copied"?t.copied:this.#a==="failed"?t.copyFailed:t.copy;return r`<div class="bar">
1849
1849
  ${s.label===""?h:r`<span class="name">${s.label}</span>`}
1850
1850
  <div class="tabs" role="tablist" aria-label=${i}>
1851
1851
  ${s.variants.map((l,o)=>r`<button
@@ -1867,7 +1867,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1867
1867
  aria-label=${t.copyLabel(i)}
1868
1868
  @click=${()=>this.#h()}
1869
1869
  >
1870
- ${this.#a==="copied"?ct():re()}<span aria-live="polite">${d}</span>
1870
+ ${this.#a==="copied"?dt():Zt()}<span aria-live="polite">${d}</span>
1871
1871
  </button>
1872
1872
  </div>
1873
1873
  ${s.variants.map((l,o)=>r`<pre
@@ -1876,7 +1876,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1876
1876
  aria-labelledby="code-group-tab-${o}"
1877
1877
  ?hidden=${o!==n}
1878
1878
  ><code>${this.#p(l)}</code></pre>`)}`}#o(t,e){return r`<div class="bar"><span class="name">${t}</span></div>
1879
- ${e}`}#l(t){this.#t!==null&&(this.#s=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#a="idle",this.requestUpdate())}#d(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const n=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#l(n),this.renderRoot.querySelectorAll('[role="tab"]')[n]?.focus()}#p(t){const e=t.language===""?null:t.language;return ds(Ot(t.code),e).map(s=>s.kind===null?s.text:r`<span class=${s.kind}>${s.text}</span>`)}async#h(){const t=this.#t;if(t===null)return;const e=Math.min(this.#s,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const n=await wt(Ot(s.code));this.#a=n?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#a="idle",this.requestUpdate()},1600)}}const gs=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",ms)},pi=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:a=>`Profile: ${a}`,guest:"Guest",shortcuts:"Pages of this site",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page here has this address."},ja:{back:"\u623B\u308B",forward:"\u9032\u3080",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",address:"\u30A2\u30C9\u30EC\u30B9",tabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",profile:a=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${a}`,guest:"\u30B2\u30B9\u30C8",shortcuts:"\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}}),ft=(a,t,e)=>{const s=le(t,e);if(s===null)return;const n=de(s);return a.find(i=>{const d=le(i.url,e);return d!==null&&de(d)===n})},hi=(a,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?ce(t.url):ft(a,t.page.url,t.page.url)?.title??ce(t.page.url),fs=a=>a===void 0||a.kind==="new-tab"?"":a.kind==="unreachable"?a.url:a.page.url,ui=(a,t,e,s)=>{const n=ia(t),i=n.history[n.index];return{tabs:t.tabs.map(d=>{const l=d.history[d.index];return{id:d.id,title:hi(a,l,e),url:fs(l),active:d.id===n.id}}),entry:i,url:fs(i),canBack:oa(t),canForward:ra(t),...s===null||s===""?{}:{profile:s}}},mi=a=>a.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),gi=":scope > [data-url]",fi=360,bs="https://page.example.com/";class ks extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[M,la,T`
1879
+ ${e}`}#l(t){this.#t!==null&&(this.#s=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#a="idle",this.requestUpdate())}#d(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const n=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#l(n),this.renderRoot.querySelectorAll('[role="tab"]')[n]?.focus()}#p(t){const e=t.language===""?null:t.language;return ds(Ot(t.code),e).map(s=>s.kind===null?s.text:r`<span class=${s.kind}>${s.text}</span>`)}async#h(){const t=this.#t;if(t===null)return;const e=Math.min(this.#s,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const n=await vt(Ot(s.code));this.#a=n?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#a="idle",this.requestUpdate()},1600)}}const gs=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",ms)},pi=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:a=>`Profile: ${a}`,guest:"Guest",shortcuts:"Pages of this site",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page here has this address."},ja:{back:"\u623B\u308B",forward:"\u9032\u3080",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",address:"\u30A2\u30C9\u30EC\u30B9",tabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",profile:a=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${a}`,guest:"\u30B2\u30B9\u30C8",shortcuts:"\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}}),ft=(a,t,e)=>{const s=le(t,e);if(s===null)return;const n=de(s);return a.find(i=>{const d=le(i.url,e);return d!==null&&de(d)===n})},hi=(a,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?ce(t.url):ft(a,t.page.url,t.page.url)?.title??ce(t.page.url),fs=a=>a===void 0||a.kind==="new-tab"?"":a.kind==="unreachable"?a.url:a.page.url,ui=(a,t,e,s)=>{const n=ia(t),i=n.history[n.index];return{tabs:t.tabs.map(d=>{const l=d.history[d.index];return{id:d.id,title:hi(a,l,e),url:fs(l),active:d.id===n.id}}),entry:i,url:fs(i),canBack:oa(t),canForward:ra(t),...s===null||s===""?{}:{profile:s}}},mi=a=>a.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),gi=":scope > [data-url]",fi=360,bs="https://page.example.com/";class ks extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[M,la,A`
1880
1880
  :host {
1881
1881
  display: block;
1882
1882
  height: var(--dpk-browser-height, 460px);
@@ -1926,7 +1926,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
1926
1926
  ${pa(i,d===void 0?void 0:r`<slot></slot>`)}
1927
1927
  </div>
1928
1928
  ${ha(i)}
1929
- </div>`}updated(){const t=this.#e===null?void 0:$t(this.#e),e=this.#u(t);this.renderRoot.querySelector("slot")?.assign(...e===void 0?[]:[e]),this.#i&&(this.#i=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus());const s=t===void 0||t.kind==="new-tab"?"":t.kind==="page"?t.page.url:t.url;if(s===this.#r)return;const n=this.#r===null;this.#r=s,n||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#c(t){if(this.#e===null)return;const e=ua(this.#e,t);e!==this.#e&&(this.#e=e,this.#f(),this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate())}#m(t){switch(t.kind){case"reload":this.#v();return;case"address":this.#g(t.input,!1);return;case"back":case"forward":case"new-tab":this.#s=!1,this.#c({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#s=t.open,this.requestUpdate();return;case"activate":this.#s=!1,this.#i=t.focus===!0,this.#c({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#c({kind:"close-tab",id:t.id});return;case"visit":this.#c({kind:"visit",page:t.page});return;default:return}}#g(t,e){const s=this.#h,n=ft(this.#p,t,s),i=n===void 0?{kind:"unreachable",url:ma(t,s)}:{kind:"page",page:{url:n.url}};e!==!1?this.#c({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#c({kind:"visit",page:i.page}):this.#c({kind:"unreachable",url:i.url})}#v(){if(this.#a!==null||this.#e===null)return;const t=this.#u($t(this.#e));this.#a=setTimeout(()=>{if(this.#a=null,t!==void 0){for(const e of t.querySelectorAll("form"))e.reset();for(const e of t.querySelectorAll("dialog"))e.close();t.scrollTop=0,t.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate()},fi),this.requestUpdate()}#f(){this.#a!==null&&(clearTimeout(this.#a),this.#a=null)}#k=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(l=>l instanceof HTMLAnchorElement&&this.contains(l)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const n=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",d=new URL(s,this.#h).href;this.#g(d,i||n?{background:n}:!1)}}const vs=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",ks)},bi=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:a=>`${a} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:a=>`Remove ${a}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:a=>`${a} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:a=>`${a} \u3092\u524A\u9664`}}),ki=y({value:$(b(),E(1)),label:$(b(),E(1)),description:u(b()),group:u(b()),avatar:u(b())}),vi=y({options:w(ki),value:u(Jt([b(),w(b())]))}),xs=a=>typeof a=="string"?a===""?[]:[a]:Array.isArray(a)?a.filter(t=>typeof t=="string"&&t!==""):[],ys=a=>{const t=B(vi,a),e=new Set;return{options:t.options.map(n=>{if(e.has(n.value))throw new Error(`duplicate option value: ${n.value}`);return e.add(n.value),{value:n.value,label:n.label,description:n.description??null,group:n.group??null,avatar:n.avatar??null}}),value:t.value===void 0?null:xs(t.value)}},Ut=(a,t)=>{const e=t.trim().toLowerCase();return e===""?a:a.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},xi=a=>{const t=[],e=new Map;for(const s of a){let n=e.get(s.group);n===void 0&&(n=[],e.set(s.group,n),t.push(s.group)),n.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},Ft=(a,t)=>t===0?-1:Math.min(Math.max(a,0),t-1),yi=(a,t,e)=>e===0?-1:a<0?t>0?0:e-1:(a+t+e)%e,wi=(a,t,e)=>e?a.includes(t)?a.filter(s=>s!==t):[...a,t]:[t],$i=(a,t)=>a.filter(e=>e!==t),Ci=(a,t)=>a.includes(t),Si=(a,t)=>a.length===t.length&&a.every((e,s)=>e===t[s]),Ei=(a,t)=>t.flatMap(e=>{const s=a.find(n=>n.value===e);return s?[s]:[]}),zi=(a,t)=>{const e=t[0];return e===void 0?null:a.find(s=>s.value===e)?.label??null},ws=a=>{const t=a.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},$s=["blue","green","amber","violet","accent","danger"],Cs=a=>{let t=0;for(let e=0;e<a.length;e+=1)t=t*31+a.charCodeAt(e)|0;return $s[Math.abs(t)%$s.length]??"blue"};let Ti=0;const Ai=".combo-control, .combo-listbox";class Ss extends z{static{this.styles=[M,T`
1929
+ </div>`}updated(){const t=this.#e===null?void 0:$t(this.#e),e=this.#u(t);this.renderRoot.querySelector("slot")?.assign(...e===void 0?[]:[e]),this.#i&&(this.#i=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus());const s=t===void 0||t.kind==="new-tab"?"":t.kind==="page"?t.page.url:t.url;if(s===this.#r)return;const n=this.#r===null;this.#r=s,n||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#c(t){if(this.#e===null)return;const e=ua(this.#e,t);e!==this.#e&&(this.#e=e,this.#f(),this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate())}#m(t){switch(t.kind){case"reload":this.#v();return;case"address":this.#g(t.input,!1);return;case"back":case"forward":case"new-tab":this.#s=!1,this.#c({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#s=t.open,this.requestUpdate();return;case"activate":this.#s=!1,this.#i=t.focus===!0,this.#c({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#c({kind:"close-tab",id:t.id});return;case"visit":this.#c({kind:"visit",page:t.page});return;default:return}}#g(t,e){const s=this.#h,n=ft(this.#p,t,s),i=n===void 0?{kind:"unreachable",url:ma(t,s)}:{kind:"page",page:{url:n.url}};e!==!1?this.#c({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#c({kind:"visit",page:i.page}):this.#c({kind:"unreachable",url:i.url})}#v(){if(this.#a!==null||this.#e===null)return;const t=this.#u($t(this.#e));this.#a=setTimeout(()=>{if(this.#a=null,t!==void 0){for(const e of t.querySelectorAll("form"))e.reset();for(const e of t.querySelectorAll("dialog"))e.close();t.scrollTop=0,t.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate()},fi),this.requestUpdate()}#f(){this.#a!==null&&(clearTimeout(this.#a),this.#a=null)}#k=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(l=>l instanceof HTMLAnchorElement&&this.contains(l)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const n=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",d=new URL(s,this.#h).href;this.#g(d,i||n?{background:n}:!1)}}const vs=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",ks)},bi=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:a=>`${a} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:a=>`Remove ${a}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:a=>`${a} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:a=>`${a} \u3092\u524A\u9664`}}),ki=y({value:$(b(),E(1)),label:$(b(),E(1)),description:u(b()),group:u(b()),avatar:u(b())}),vi=y({options:w(ki),value:u(ae([b(),w(b())]))}),xs=a=>typeof a=="string"?a===""?[]:[a]:Array.isArray(a)?a.filter(t=>typeof t=="string"&&t!==""):[],ys=a=>{const t=N(vi,a),e=new Set;return{options:t.options.map(n=>{if(e.has(n.value))throw new Error(`duplicate option value: ${n.value}`);return e.add(n.value),{value:n.value,label:n.label,description:n.description??null,group:n.group??null,avatar:n.avatar??null}}),value:t.value===void 0?null:xs(t.value)}},Ut=(a,t)=>{const e=t.trim().toLowerCase();return e===""?a:a.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},xi=a=>{const t=[],e=new Map;for(const s of a){let n=e.get(s.group);n===void 0&&(n=[],e.set(s.group,n),t.push(s.group)),n.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},Ft=(a,t)=>t===0?-1:Math.min(Math.max(a,0),t-1),yi=(a,t,e)=>e===0?-1:a<0?t>0?0:e-1:(a+t+e)%e,wi=(a,t,e)=>e?a.includes(t)?a.filter(s=>s!==t):[...a,t]:[t],$i=(a,t)=>a.filter(e=>e!==t),Ci=(a,t)=>a.includes(t),Si=(a,t)=>a.length===t.length&&a.every((e,s)=>e===t[s]),Ei=(a,t)=>t.flatMap(e=>{const s=a.find(n=>n.value===e);return s?[s]:[]}),zi=(a,t)=>{const e=t[0];return e===void 0?null:a.find(s=>s.value===e)?.label??null},ws=a=>{const t=a.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},$s=["blue","green","amber","violet","accent","danger"],Cs=a=>{let t=0;for(let e=0;e<a.length;e+=1)t=t*31+a.charCodeAt(e)|0;return $s[Math.abs(t)%$s.length]??"blue"};let Ai=0;const Ti=".combo-control, .combo-listbox";class Ss extends z{static{this.styles=[M,A`
1930
1930
  :host {
1931
1931
  display: block;
1932
1932
  }
@@ -2245,7 +2245,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2245
2245
  color: var(--dpk-danger);
2246
2246
  font-size: 12px;
2247
2247
  }
2248
- `]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#n=`dpk-combobox-${++Ti}`;#t=new R(this);#e=new bt(this);#s=null;#a=[];#i=[];#r=null;#o=!1;#l=null;#d=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new Ws(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Ai)),ownsEscape:()=>this.#o,dismiss:()=>this.#b()})}connectedCallback(){super.connectedCallback(),this.#s=N(this,ys,t=>{t.ok?(this.#a=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#a=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=xs(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return r`<p class="error">${this.#r}</p>`;const e=this.#l??"",s=Ut(this.#a,e),n=Ft(this.#d,s.length),i=this.multiple?Ei(this.#a,this.#i):[],d=this.multiple?null:zi(this.#a,this.#i),l=this.multiple?this.#i.length===0:d===null,o=this.#l??(this.multiple?"":d??"");return r`
2248
+ `]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#n=`dpk-combobox-${++Ai}`;#t=new R(this);#e=new bt(this);#s=null;#a=[];#i=[];#r=null;#o=!1;#l=null;#d=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new _s(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Ti)),ownsEscape:()=>this.#o,dismiss:()=>this.#b()})}connectedCallback(){super.connectedCallback(),this.#s=_(this,ys,t=>{t.ok?(this.#a=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#a=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=xs(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return r`<p class="error">${this.#r}</p>`;const e=this.#l??"",s=Ut(this.#a,e),n=Ft(this.#d,s.length),i=this.multiple?Ei(this.#a,this.#i):[],d=this.multiple?null:zi(this.#a,this.#i),l=this.multiple?this.#i.length===0:d===null,o=this.#l??(this.multiple?"":d??"");return r`
2249
2249
  <div class="field">
2250
2250
  ${this.label?r`<label class="field-label" id=${this.#h}>${this.label}</label>`:h}
2251
2251
  <div class="combo-control">
@@ -2278,7 +2278,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2278
2278
  @mousedown=${m=>m.preventDefault()}
2279
2279
  @click=${this.#S}
2280
2280
  >
2281
- ${Gs()}
2281
+ ${Ns()}
2282
2282
  </button>
2283
2283
  </div>
2284
2284
  </div>
@@ -2321,7 +2321,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2321
2321
  <span class="option-name">${t.label}</span>
2322
2322
  ${t.description!==null?r`<span class="option-desc">${t.description}</span>`:h}
2323
2323
  </span>
2324
- ${s?r`<span class="option-check" aria-hidden="true">${ct()}</span>`:h}
2324
+ ${s?r`<span class="option-check" aria-hidden="true">${dt()}</span>`:h}
2325
2325
  </div>
2326
2326
  `}#v(t,e){return r`
2327
2327
  <span class="chip">
@@ -2335,10 +2335,10 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2335
2335
  @mousedown=${s=>s.preventDefault()}
2336
2336
  @click=${s=>{s.stopPropagation(),this.#x($i(this.#i,t.value))}}
2337
2337
  >
2338
- ${Ks()}
2338
+ ${Ws()}
2339
2339
  </button>
2340
2340
  </span>
2341
- `}#f=()=>{this.#o=!0,this.#d=-1,this.requestUpdate()};#k=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#l=t.currentTarget.value,this.#o=!0,this.#d=-1,this.requestUpdate())};#y=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=Ut(this.#a,this.#l??""),s=this.#o;this.#o=!0;const n=t.key==="ArrowDown"?1:-1;this.#d=s?yi(this.#d,n,e.length):-1,s||(this.#d=Ft(n>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=Ut(this.#a,this.#l??""),s=e[Ft(this.#d,e.length)];s&&this.#w(s.value);return}if(t.key==="Backspace"){if((this.#l??"")!==""||!this.multiple||this.#i.length===0)return;t.preventDefault(),this.#x(this.#i.slice(0,-1))}};#S=()=>{this.#o?this.#b():(this.#o=!0,this.#d=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#x(wi(this.#i,t,this.multiple)),this.multiple?(this.#l="",this.#d=-1,this.requestUpdate()):this.#b()}#x(t){Si(this.#i,t)||(this.#i=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-combobox-change",{detail:{value:this.multiple?t:t[0]??""},bubbles:!0,composed:!0})))}#b(){this.#o=!1,this.#l=null,this.#d=-1,this.requestUpdate()}#$(){const t=this.renderRoot.querySelector(".combo-listbox"),e=this.renderRoot.querySelector(".combo-control");!t||!e||this.#e.open(t,e,{width:e.offsetWidth,height:320},{placement:"bottom-start"})}}const Es=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",Ss)};let J=null;const Mi=a=>{J!==null&&J!==a&&J.hide(),J=a},Li=a=>{J===a&&(J=null)};class zs extends z{static{this.styles=[M,K,T`
2341
+ `}#f=()=>{this.#o=!0,this.#d=-1,this.requestUpdate()};#k=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#l=t.currentTarget.value,this.#o=!0,this.#d=-1,this.requestUpdate())};#y=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=Ut(this.#a,this.#l??""),s=this.#o;this.#o=!0;const n=t.key==="ArrowDown"?1:-1;this.#d=s?yi(this.#d,n,e.length):-1,s||(this.#d=Ft(n>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=Ut(this.#a,this.#l??""),s=e[Ft(this.#d,e.length)];s&&this.#w(s.value);return}if(t.key==="Backspace"){if((this.#l??"")!==""||!this.multiple||this.#i.length===0)return;t.preventDefault(),this.#x(this.#i.slice(0,-1))}};#S=()=>{this.#o?this.#b():(this.#o=!0,this.#d=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#x(wi(this.#i,t,this.multiple)),this.multiple?(this.#l="",this.#d=-1,this.requestUpdate()):this.#b()}#x(t){Si(this.#i,t)||(this.#i=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-combobox-change",{detail:{value:this.multiple?t:t[0]??""},bubbles:!0,composed:!0})))}#b(){this.#o=!1,this.#l=null,this.#d=-1,this.requestUpdate()}#$(){const t=this.renderRoot.querySelector(".combo-listbox"),e=this.renderRoot.querySelector(".combo-control");!t||!e||this.#e.open(t,e,{width:e.offsetWidth,height:320},{placement:"bottom-start"})}}const Es=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",Ss)};let Z=null;const Mi=a=>{Z!==null&&Z!==a&&Z.hide(),Z=a},Li=a=>{Z===a&&(Z=null)};class zs extends z{static{this.styles=[M,K,A`
2342
2342
  :host {
2343
2343
  display: contents;
2344
2344
  }
@@ -2365,7 +2365,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2365
2365
  >
2366
2366
  <slot></slot>
2367
2367
  </div>
2368
- `}updated(t){super.updated(t),this.#s()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#s(){const t=this.renderRoot.querySelector(".dpk-floatbar");if(!t||typeof t.showPopover!="function")return;const e=t.matches(":popover-open");if(this.#t&&!e)try{t.showPopover()}catch{}else if(!this.#t&&e)try{t.hidePopover()}catch{}}#a=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const Ts=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",zs)};class As extends z{static{this.styles=[M,K]}#n=new Vs(this);ask(t){return this.#n.ask(t)}render(){return this.#n.render()}}const Ms=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",As)},Di=D({en:{heading:"Alternatives",empty:"No alternatives to compare.",dataError:"The alternatives could not be read.",reason:"Reason",tradeoffs:"Tradeoffs",adopted:"Adopted",rejected:"Rejected",considered:"Considered"},ja:{heading:"\u4EE3\u66FF\u6848",empty:"\u6BD4\u8F03\u3059\u308B\u4EE3\u66FF\u6848\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4EE3\u66FF\u6848\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",reason:"\u7406\u7531",tradeoffs:"\u30C8\u30EC\u30FC\u30C9\u30AA\u30D5",adopted:"\u63A1\u7528",rejected:"\u5374\u4E0B",considered:"\u691C\u8A0E"}}),Ri=["adopted","rejected","considered"],ji=y({id:$(b(),ie(/^[A-Za-z0-9_-]+$/)),status:st(Ri),label:u($(b(),E(1))),summary:u($(b(),E(1))),reason:u($(b(),E(1))),tradeoffs:u(w($(b(),E(1))))}),qi=y({options:w(ji)}),Pi=()=>({options:[]}),Ls=a=>{const t=B(qi,a),e=new Set;return{options:t.options.map(s=>{if(e.has(s.id))throw new Error(`duplicate option id: ${s.id}`);return e.add(s.id),{id:s.id,status:s.status,label:s.label??s.id,summary:s.summary??null,reason:s.reason??null,tradeoffs:s.tradeoffs??[]}})}},Ii=(a,t)=>{switch(t){case"adopted":return a.adopted;case"rejected":return a.rejected;case"considered":return a.considered}},Oi=(a,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:Ii(a,t.status),summary:t.summary,reason:t.reason===null?null:{label:a.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:a.tradeoffs,items:t.tradeoffs}}),Ui=(a,t)=>t.options.map(e=>Oi(a,e)),Fi=[M,ta,T`
2368
+ `}updated(t){super.updated(t),this.#s()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#s(){const t=this.renderRoot.querySelector(".dpk-floatbar");if(!t||typeof t.showPopover!="function")return;const e=t.matches(":popover-open");if(this.#t&&!e)try{t.showPopover()}catch{}else if(!this.#t&&e)try{t.hidePopover()}catch{}}#a=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const As=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",zs)};class Ts extends z{static{this.styles=[M,K]}#n=new Gs(this);ask(t){return this.#n.ask(t)}render(){return this.#n.render()}}const Ms=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",Ts)},Di=D({en:{heading:"Alternatives",empty:"No alternatives to compare.",dataError:"The alternatives could not be read.",reason:"Reason",tradeoffs:"Tradeoffs",adopted:"Adopted",rejected:"Rejected",considered:"Considered"},ja:{heading:"\u4EE3\u66FF\u6848",empty:"\u6BD4\u8F03\u3059\u308B\u4EE3\u66FF\u6848\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4EE3\u66FF\u6848\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",reason:"\u7406\u7531",tradeoffs:"\u30C8\u30EC\u30FC\u30C9\u30AA\u30D5",adopted:"\u63A1\u7528",rejected:"\u5374\u4E0B",considered:"\u691C\u8A0E"}}),Ri=["adopted","rejected","considered"],qi=y({id:$(b(),oe(/^[A-Za-z0-9_-]+$/)),status:st(Ri),label:u($(b(),E(1))),summary:u($(b(),E(1))),reason:u($(b(),E(1))),tradeoffs:u(w($(b(),E(1))))}),ji=y({options:w(qi)}),Ii=()=>({options:[]}),Ls=a=>{const t=N(ji,a),e=new Set;return{options:t.options.map(s=>{if(e.has(s.id))throw new Error(`duplicate option id: ${s.id}`);return e.add(s.id),{id:s.id,status:s.status,label:s.label??s.id,summary:s.summary??null,reason:s.reason??null,tradeoffs:s.tradeoffs??[]}})}},Pi=(a,t)=>{switch(t){case"adopted":return a.adopted;case"rejected":return a.rejected;case"considered":return a.considered}},Oi=(a,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:Pi(a,t.status),summary:t.summary,reason:t.reason===null?null:{label:a.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:a.tradeoffs,items:t.tradeoffs}}),Ui=(a,t)=>t.options.map(e=>Oi(a,e)),Fi=[M,Zs,A`
2369
2369
  :host {
2370
2370
  display: block;
2371
2371
  color: var(--dpk-ink);
@@ -2496,7 +2496,7 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2496
2496
  color: var(--dpk-ink-faint);
2497
2497
  text-align: center;
2498
2498
  }
2499
- `];class Ds extends z{static{this.styles=Fi}static{this.properties={data:{attribute:!1},heading:{type:String}}}#n=new R(this);#t=null;#e=null;#s=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=N(this,Ls,t=>{this.data===null&&(t.ok?this.#i(t.value):this.#r(t.error))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#i(this.data)}get dataError(){return this.#s}get#a(){return Di(this.#n.locale)}#i(t){this.#e=t,this.#s=null,this.requestUpdate()}#r(t){this.#e=null,this.#s=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#a,e=this.heading??t.heading,s=Ui(t,this.#e??Pi());return r`<section class="alternatives">
2499
+ `];class Ds extends z{static{this.styles=Fi}static{this.properties={data:{attribute:!1},heading:{type:String}}}#n=new R(this);#t=null;#e=null;#s=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=_(this,Ls,t=>{this.data===null&&(t.ok?this.#i(t.value):this.#r(t.error))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#i(this.data)}get dataError(){return this.#s}get#a(){return Di(this.#n.locale)}#i(t){this.#e=t,this.#s=null,this.requestUpdate()}#r(t){this.#e=null,this.#s=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#a,e=this.heading??t.heading,s=Ui(t,this.#e??Ii());return r`<section class="alternatives">
2500
2500
  ${e===""?h:r`<p class="alternatives-label dpk-label">${e}</p>`}
2501
2501
  ${this.#s===null?h:r`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#s}</p>`}
2502
2502
  ${this.#s===null&&s.length===0?r`<p class="alternatives-empty">${t.empty}</p>`:h}
@@ -2527,4 +2527,4 @@ ${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No da
2527
2527
  </div>
2528
2528
  ${t.summary===null?h:r`<p class="option-summary">${t.summary}</p>`} ${e}
2529
2529
  </article>
2530
- </li>`}}const Rs=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",Ds)},Hi=()=>{Xs(),Ys(),Re(),_e(),js()},js=()=>{Ee(),Ge(),Qe(),ka(),ss(),os(),va(),xa(),us(),gs(),Es(),ya(),ve(),Ce(),vs(),Ts(),Ms(),Ze(),Rs()};export{Na as $,ve as A,Ze as B,_e as C,Ds as D,Re as E,Ts as F,ss as G,Ce as H,Ls as I,is as J,gt as K,ys as L,jt as M,qe as N,we as O,js as P,pt as Q,Ct as R,Ia as S,Ba as T,Oa as U,_a as V,wa as W,xe as X,Ua as Y,Fa as Z,Ha as _,ks as a,rs as b,hs as c,ms as d,Ss as e,Je as f,We as g,As as h,ke as i,Ye as j,He as k,De as l,zs as m,es as n,$e as o,Rs as p,Ee as q,Hi as r,vs as s,os as t,us as u,gs as v,Es as w,Qe as x,Ge as y,Ms as z};
2530
+ </li>`}}const Rs=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",Ds)},Hi=()=>{Ks(),Vs(),Re(),Be(),qs()},qs=()=>{Ee(),Ge(),Qe(),ka(),ss(),os(),va(),xa(),us(),gs(),Es(),ya(),ve(),Ce(),vs(),As(),Ms(),Ye(),Rs()};export{Na as $,ve as A,Ye as B,Be as C,Ds as D,Re as E,As as F,ss as G,Ce as H,Ls as I,is as J,gt as K,ys as L,qt as M,je as N,we as O,qs as P,pt as Q,Ct as R,Pa as S,_a as T,Oa as U,Ba as V,wa as W,xe as X,Ua as Y,Fa as Z,Ha as _,ks as a,rs as b,hs as c,ms as d,Ss as e,Ze as f,We as g,Ts as h,ke as i,Xe as j,He as k,De as l,zs as m,es as n,$e as o,Rs as p,Ee as q,Hi as r,vs as s,os as t,us as u,gs as v,Es as w,Qe as x,Ge as y,Ms as z};