dev-process-kit 0.4.2 → 0.4.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 (31) hide show
  1. package/dist/boards.js +1 -1
  2. package/dist/chunks/{shared-D1ZujbZA.js → shared-0HXwrPVn.js} +54 -54
  3. package/dist/chunks/{shared-DPD_cXES.js → shared-B2F5LY6f.js} +13 -13
  4. package/dist/chunks/{shared-CsLKVrK7.js → shared-B7MDu9J_.js} +1 -1
  5. package/dist/chunks/{shared-DErYmK9C.js → shared-BSEt0fN6.js} +1 -1
  6. package/dist/chunks/{shared-CHQBlCl0.js → shared-BugVP_yn.js} +2 -2
  7. package/dist/chunks/shared-C1sWnXGY.js +1 -0
  8. package/dist/chunks/{shared-HkbNG84_.js → shared-C2_qMOyi.js} +1 -1
  9. package/dist/chunks/{shared-4JaCIu01.js → shared-CeNV36-9.js} +134 -28
  10. package/dist/chunks/{shared-JOvfFoxb.js → shared-CjWMknuE.js} +1 -1
  11. package/dist/chunks/{shared-D0_BoWj3.js → shared-CxTKp5CX.js} +18 -18
  12. package/dist/chunks/{shared-C-ujfGnT.js → shared-CyOyXHQO.js} +1 -1
  13. package/dist/chunks/{shared-D80rPPNF.js → shared-D3Xm9wF8.js} +3 -3
  14. package/dist/chunks/shared-DCnxYUIB.js +3 -0
  15. package/dist/chunks/{shared-_0Ev6y6i.js → shared-DE09J93T.js} +494 -226
  16. package/dist/chunks/{shared-CMWEqwI3.js → shared-DJCdfkg-.js} +1 -1
  17. package/dist/chunks/{shared-KHA87RsJ.js → shared-Dxf3BUk6.js} +1049 -217
  18. package/dist/chunks/{shared-SjAP9bK0.js → shared-qLSu7C5m.js} +10 -10
  19. package/dist/chunks/{shared-D2fmf6zb.js → shared-tq8QsPTt.js} +2 -2
  20. package/dist/components.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/sync.js +1 -1
  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 +1 -1
  30. package/dist/chunks/shared-CJZKj_HI.js +0 -3
  31. package/dist/chunks/shared-lVXxL9i3.js +0 -1
@@ -1,4 +1,4 @@
1
- import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4 as M,a8 as P,aB as hn,A as pe,aC as he,aD as un,aE as mn,al as U,aF as ue,a6 as j,a3 as gt,af as Tt,aw as me,u as At,g as gn,z as fn,av as Lt,aG as bn,aH as ft,aI as ge,ak as kn,ax as vn,t as xn,aJ as yn,R as wn,S as $n}from"./shared-_0Ev6y6i.js";import{o as _,r as Cn}from"./shared-D4PPk0Dk.js";import{e as Sn}from"./shared-C-ujfGnT.js";import{a as fe,c as En}from"./shared-D1ZujbZA.js";import{c as zn}from"./shared-D0_BoWj3.js";import{m as W,o as Rt,k as g,I as be,D as ke,x as nt,h as $,u as Dt,s as Pt,A as ve,j as v,B as Mn,n as bt,q as w,v as C,H as Ot,w as E,C as G,g as at,z as xe,l as V,y as ye,G as we,J as Tn,K as $e}from"./shared-CJZKj_HI.js";import{p as An,i as Ln,r as Rn,c as Dn,a as Ce,b as Se,d as Pn,e as On,f as qn,h as Ee,g as In,j as qt,s as Un,k as jn,l as Nn,m as Fn,n as Hn,t as _n}from"./shared-4JaCIu01.js";import{B as Wn,t as Bn,v as ze,i as Gn,k as Kn,j as Vn}from"./shared-DErYmK9C.js";import{d as Jn}from"./shared-CMWEqwI3.js";class it{#a;#t;#e=null;#n=null;#s=null;#i=null;#r=new Map;#o=null;constructor(t){this.#a=t,this.#t=new Mt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#s=e,this.#i=s??null,this.#o=null,this.#a.requestUpdate()}close(){this.#e=null,this.#s=null,this.#i=null,this.#a.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#n!==this.#e;this.#n=this.#e,!(t===null||this.#s===null||this.#e===null)&&(this.#t.open(t,this.#s,{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=An(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return d`${Ln(e,Rn(Dn(t.locale),s,a=>this.#d(e,t.submit,a)))}`}#d(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#a.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#a.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const kt=(n,t,e,s)=>{if(n===null)return null;const a=ce(n),i=t.find(o=>o.value===a);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(a,i.label)}]}},vt=.08,Me=1.8,Te=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...n.map(i=>i.x)),e=Math.min(...n.map(i=>i.y)),s=Math.max(...n.map(i=>i.x+i.width))-t,a=Math.max(...n.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-a*.1,width:s*1.2,height:a*1.2}},Ae=(n,t)=>n+t/12,Zn=(n,t)=>{if(n.length===0)return null;const e=Math.min(...n.map(a=>a.y)),s=n.filter(a=>a.y<e+t);return{x:Math.min(...s.map(a=>a.x)),y:e}},It=16,Xn=.8,xt=(n,t,e,s,a)=>n==="start"?It-Ae(t,e)*s:(a-e*s)/2-t*s,Le=(n,t,e,s,a="center")=>{if(t.width===0||t.height===0)return{...n,x:0,y:0};const i=(o,r,l,u)=>{const c=l*n.scale,m=u*Xn;if(c<=u){const k=xt(a,r,l,n.scale,u);return K(o,k-m,k+m)}return K(o,u-(r+l)*n.scale-m,-r*n.scale+m)};return{...n,x:i(n.x,t.x,t.width,e),y:i(n.y,t.y,t.height,s)}},Yn=(n,t,e,s,a,i,o="center")=>{const r=Math.abs(i)>Math.abs(a);if(r&&t.height*n.scale<=s)return null;const l=Le({...n,x:n.x-a,y:n.y-i},t,e,s,o);return r&&l.y===n.y?null:l},Qn=n=>Math.exp(-n*.01),Re='button,[role="button"],a,input,textarea,select',Ut=(n,t,e)=>{for(const s of n.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},ta=n=>{const{canvas:t,world:e,onClearSelection:s,onView:a,align:i="center",sizeWorld:o=!0}=n;let r={x:0,y:0,width:0,height:0},l={x:0,y:0,scale:1};const u=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),c=()=>{const{width:p,height:f}=u();l=Le(l,r,p,f,i),e.style.transform=`translate(${l.x}px, ${l.y}px) scale(${l.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/l.scale)),e.style.setProperty("--dpk-zoom-scale",String(l.scale)),a?.(l)},m=()=>{const{width:p,height:f}=u(),x=r.width/1.2||1,y=r.height/1.2||1,S=K(Math.min((p-24)/x,(f-40)/y),vt,1);l={scale:S,x:xt(i,r.x,r.width,S,p),y:xt(i,r.y,r.height,S,f)},c()},k=p=>{const{width:f,height:x}=u(),y=Te([p]),S=y.width/1.2||1,R=y.height/1.2||1;l={...l,scale:K(Math.min((f-24)/S,(x-40)/R),vt,Me)},l={...l,x:(f-y.width*l.scale)/2-y.x*l.scale,y:(x-y.height*l.scale)/2-y.y*l.scale},c()},L=()=>{const{width:p}=u(),f=r.width/1.2||1,x=K((p-24)/f,vt,1);l={scale:x,x:(p-r.width*x)/2-r.x*x,y:16},c()},mt=p=>{const{width:f,height:x}=u(),y=(S,R,le,de)=>de!==void 0?It-de:R<=le?xt(i,S,R,1,le):It-Ae(S,R);l={scale:1,x:y(r.x,r.width,f,p?.x),y:y(r.y,r.height,x,p?.y)},c()},H=(p,f=u().width/2,x=u().height/2)=>{const y=l.scale,S=K(y*p,vt,Me);S!==y&&(l={scale:S,x:f-(f-l.x)*S/y,y:x-(x-l.y)*S/y},c())},tt=p=>{if(Ut(p,t,".diagram-zoom")!==null)return;const f=p.deltaMode===1?16:p.deltaMode===2?u().height:1;if(p.ctrlKey||p.metaKey){p.preventDefault();const R=t.getBoundingClientRect();H(Qn(p.deltaY),p.clientX-R.left,p.clientY-R.top);return}const{width:x,height:y}=u(),S=Yn(l,r,x,y,p.deltaX*f,p.deltaY*f,i);S!==null&&(p.preventDefault(),l=S,c())},q=new Map;let A=null,I=!1;const N=()=>{const p=[...q.values()],f=p[0];if(!f)return null;const x=p[1];return x?{x:(f.x+x.x)/2,y:(f.y+x.y)/2,distance:Math.hypot(x.x-f.x,x.y-f.y)}:{...f,distance:0}},et=p=>{q.size===0&&(I=!1);const f=Ut(p,t,Re);p.button!==0||p.pointerType!=="touch"&&f!==null||(q.set(p.pointerId,{x:p.clientX,y:p.clientY}),A=N(),f===null&&t.setPointerCapture(p.pointerId),p.pointerType!=="touch"&&f===null&&(p.preventDefault(),t.focus({preventScroll:!0})))},se=p=>{if(!q.has(p.pointerId)||A===null)return;q.set(p.pointerId,{x:p.clientX,y:p.clientY});const f=N();if(f===null)return;const x=f.x-A.x,y=f.y-A.y;if((Math.abs(x)+Math.abs(y)>1||Math.abs(f.distance-A.distance)>1)&&(I=!0),f.distance>0&&A.distance>0){const S=t.getBoundingClientRect();H(Math.pow(f.distance/A.distance,.45),A.x-S.left,A.y-S.top)}l={...l,x:l.x+x,y:l.y+y},c(),A=f,t.classList.toggle("is-panning",I)},st=p=>{q.delete(p.pointerId),A=N(),!(q.size>0)&&(t.classList.remove("is-panning"),p.type==="pointercancel"&&(I=!1))},ne=p=>{I&&(p.preventDefault(),p.stopPropagation()),st(p)},ae=p=>{if(I){p.preventDefault(),p.stopPropagation(),I=!1;return}!(p.target instanceof Element)||Ut(p,t,Re)!==null||s()},ie=p=>{if(p.target!==t)return;const f=30;if(p.key==="+"||p.key==="=")H(1.1);else if(p.key==="-")H(1/1.1);else if(p.key==="0")m();else if(p.key==="Escape"){if(s()===!1)return}else if(p.key==="ArrowLeft"||p.key==="ArrowRight"||p.key==="ArrowUp"||p.key==="ArrowDown")l={...l,x:l.x+(p.key==="ArrowLeft"?f:p.key==="ArrowRight"?-f:0),y:l.y+(p.key==="ArrowUp"?f:p.key==="ArrowDown"?-f:0)},c();else return;p.preventDefault()},re=p=>{const f=p.target instanceof HTMLElement?p.target:null;if(f===null||!p.composedPath().includes(e))return;const x=f.getBoundingClientRect(),y=t.getBoundingClientRect();let S=0,R=0;x.left<y.left+12?S=y.left+12-x.left:x.right>y.right-12&&(S=y.right-12-x.right),x.top<y.top+12?R=y.top+12-x.top:x.bottom>y.bottom-40&&(R=y.bottom-40-x.bottom),!(S===0&&R===0)&&(l={...l,x:l.x+S,y:l.y+R},c())};t.addEventListener("wheel",tt,{passive:!1}),t.addEventListener("pointerdown",et),t.addEventListener("pointermove",se),t.addEventListener("pointerup",ne),t.addEventListener("pointercancel",st),t.addEventListener("lostpointercapture",st),t.addEventListener("click",ae,!0),t.addEventListener("keydown",ie),t.addEventListener("focusin",re);const oe=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>c());return oe?.observe(t),{setContent(p){r=Te(p.width===0&&p.height===0?[]:[p]),o&&(e.style.width=`${p.width}px`,e.style.height=`${p.height}px`),c()},apply:c,fit:m,fitTo:k,fitWidth:L,reset:mt,zoom:H,view:()=>({...l}),destroy(){oe?.disconnect(),t.removeEventListener("wheel",tt),t.removeEventListener("pointerdown",et),t.removeEventListener("pointermove",se),t.removeEventListener("pointerup",ne),t.removeEventListener("pointercancel",st),t.removeEventListener("lostpointercapture",st),t.removeEventListener("click",ae,!0),t.removeEventListener("keydown",ie),t.removeEventListener("focusin",re)}}},ea=["fit","fit-width","actual","none"];class sa{#a;#t=null;#e=null;#n=!1;constructor(t,e){this.#a=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.#a.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=ta({canvas:e,world:s,align:this.#a.align(),sizeWorld:!1,onClearSelection:()=>this.#a.onDismiss(),onView:a=>this.#a.onView(a)}),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.#a.elements()?.world;if(t===null||e===void 0)return;const s=this.#a.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const a=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:a,height:i}),!this.#n&&a>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#n=!0;const e=this.#a.initial(),s=ea.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 na=(n,t,e)=>n.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),De=160,jt=(n,t,e=De)=>Math.max(e,Math.round(n+t)),aa=(n,t,e,s=De)=>{const a=e?96:24;return t==="ArrowDown"?jt(n,a,s):t==="ArrowUp"?jt(n,-a,s):null},Pe={kind:"idle"};class ia{constructor(t,e){this.#e=null,this.#n=Pe,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const a=s.currentTarget;a instanceof Element&&a.setPointerCapture(s.pointerId),this.#n={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#a.requestUpdate()},pointermove:s=>{const a=this.#n;a.kind!=="dragging"||a.pointerId!==s.pointerId||this.#s(jt(a.startHeight,s.clientY-a.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const a=aa(this.#e??this.#t(),s.key,s.shiftKey);a!==null&&(s.preventDefault(),this.#s(a))},dblclick:()=>this.#s(null)},this.#a=t,this.#t=e,t.addController(this)}#a;#t;#e;#n;hostConnected(){}get height(){return this.#e}get dragging(){return this.#n.kind==="dragging"}#s(t){t!==this.#e&&(this.#e=t,this.#a.requestUpdate())}#i(t){const e=this.#n;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#n=Pe,this.#a.requestUpdate())}}const ra=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 Oe extends z{static{this.styles=[T,B,M`
1
+ import{ai as qt,a5 as h,ag as d,L as ye,ar as et,_ as D,a7 as A,O as L,i as J,a4 as _,a8 as O,aB as jn,A as we,aC as $e,aD as Fn,aE as Hn,al as U,aF as Ce,a6 as H,a3 as ht,af as Ut,aw as Se,u as $t,g as Wn,z as Bn,aG as Kn,aH as Ee,aI as Vn,aJ as Gn,aK as Jn,aL as Xn,aM as Yn,aN as Zn,t as Te,aO as Qn,aP as ta,aQ as ea,aR as sa,av as Nt,aS as na,aT as Ct,aU as Me,ak as aa,ax as ia,aV as ra,R as oa,S as la}from"./shared-DE09J93T.js";import{o as X,r as da}from"./shared-D4PPk0Dk.js";import{e as ca}from"./shared-CyOyXHQO.js";import{a as Ae,c as pa}from"./shared-0HXwrPVn.js";import{c as ha}from"./shared-CxTKp5CX.js";import{m as B,o as jt,k as g,I as ze,D as _e,x as Z,h as $,u as Ft,s as St,A as Le,j as b,B as P,n as st,q as x,v as y,H as Ht,w as S,C as Q,g as nt,z as Pe,l as at,y as Re,E as De,J as Oe,K as Wt,L as ua,G as Ie}from"./shared-DCnxYUIB.js";import{p as qe,i as ma,r as ga,c as Ue,a as fa,b as ba,d as Ne,e as je,f as ka,g as va,h as xa,j as Fe,k as ya,l as Bt,s as wa,m as $a,n as Ca,o as Sa,q as Ea,t as Ta}from"./shared-CeNV36-9.js";import{B as Ma,t as Aa,v as Kt,i as za,k as _a,j as La}from"./shared-BSEt0fN6.js";import{d as Pa}from"./shared-DJCdfkg-.js";class ut{#a;#t;#e=null;#n=null;#s=null;#i=null;#r=new Map;#o=null;constructor(t){this.#a=t,this.#t=new qt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#s=e,this.#i=s??null,this.#o=null,this.#a.requestUpdate()}close(){this.#e=null,this.#s=null,this.#i=null,this.#a.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#n!==this.#e;this.#n=this.#e,!(t===null||this.#s===null||this.#e===null)&&(this.#t.open(t,this.#s,{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=qe(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return d`${ma(e,ga(Ue(t.locale),s,a=>this.#l(e,t.submit,a)))}`}#l(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#a.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#a.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const Et=(n,t,e,s)=>{if(n===null)return null;const a=ye(n),i=t.find(r=>r.value===a);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(a,i.label)}]}},Tt=.08,He=1.8,We=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...n.map(i=>i.x)),e=Math.min(...n.map(i=>i.y)),s=Math.max(...n.map(i=>i.x+i.width))-t,a=Math.max(...n.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-a*.1,width:s*1.2,height:a*1.2}},Be=(n,t)=>n+t/12,Ra=(n,t)=>{if(n.length===0)return null;const e=Math.min(...n.map(a=>a.y)),s=n.filter(a=>a.y<e+t);return{x:Math.min(...s.map(a=>a.x)),y:e}},Vt=16,Da=.8,Mt=(n,t,e,s,a)=>n==="start"?Vt-Be(t,e)*s:(a-e*s)/2-t*s,Ke=(n,t,e,s,a="center")=>{if(t.width===0||t.height===0)return{...n,x:0,y:0};const i=(r,o,l,c)=>{const p=l*n.scale,m=c*Da;if(p<=c){const f=Mt(a,o,l,n.scale,c);return et(r,f-m,f+m)}return et(r,c-(o+l)*n.scale-m,-o*n.scale+m)};return{...n,x:i(n.x,t.x,t.width,e),y:i(n.y,t.y,t.height,s)}},Oa=(n,t,e,s,a,i,r="center")=>{const o=Math.abs(i)>Math.abs(a);if(o&&t.height*n.scale<=s)return null;const l=Ke({...n,x:n.x-a,y:n.y-i},t,e,s,r);return o&&l.y===n.y?null:l},Ia=n=>Math.exp(-n*.01),Ve='button,[role="button"],a,input,textarea,select',Gt=(n,t,e)=>{for(const s of n.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},qa=n=>{const{canvas:t,world:e,onClearSelection:s,onView:a,align:i="center",sizeWorld:r=!0}=n;let o={x:0,y:0,width:0,height:0},l={x:0,y:0,scale:1};const c=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),p=()=>{const{width:u,height:k}=c();l=Ke(l,o,u,k,i),e.style.transform=`translate(${l.x}px, ${l.y}px) scale(${l.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/l.scale)),e.style.setProperty("--dpk-zoom-scale",String(l.scale)),a?.(l)},m=()=>{const{width:u,height:k}=c(),w=o.width/1.2||1,C=o.height/1.2||1,T=et(Math.min((u-24)/w,(k-40)/C),Tt,1);l={scale:T,x:Mt(i,o.x,o.width,T,u),y:Mt(i,o.y,o.height,T,k)},p()},f=u=>{const{width:k,height:w}=c(),C=We([u]),T=C.width/1.2||1,q=C.height/1.2||1;l={...l,scale:et(Math.min((k-24)/T,(w-40)/q),Tt,He)},l={...l,x:(k-C.width*l.scale)/2-C.x*l.scale,y:(w-C.height*l.scale)/2-C.y*l.scale},p()},E=()=>{const{width:u}=c(),k=o.width/1.2||1,w=et((u-24)/k,Tt,1);l={scale:w,x:(u-o.width*w)/2-o.x*w,y:16},p()},R=u=>{const{width:k,height:w}=c(),C=(T,q,ve,xe)=>xe!==void 0?Vt-xe:q<=ve?Mt(i,T,q,1,ve):Vt-Be(T,q);l={scale:1,x:C(o.x,o.width,k,u?.x),y:C(o.y,o.height,w,u?.y)},p()},M=(u,k=c().width/2,w=c().height/2)=>{const C=l.scale,T=et(C*u,Tt,He);T!==C&&(l={scale:T,x:k-(k-l.x)*T/C,y:w-(w-l.y)*T/C},p())},Y=u=>{if(Gt(u,t,".diagram-zoom")!==null)return;const k=u.deltaMode===1?16:u.deltaMode===2?c().height:1;if(u.ctrlKey||u.metaKey){u.preventDefault();const q=t.getBoundingClientRect();M(Ia(u.deltaY),u.clientX-q.left,u.clientY-q.top);return}const{width:w,height:C}=c(),T=Oa(l,o,w,C,u.deltaX*k,u.deltaY*k,i);T!==null&&(u.preventDefault(),l=T,p())},I=new Map;let z=null,F=!1;const W=()=>{const u=[...I.values()],k=u[0];if(!k)return null;const w=u[1];return w?{x:(k.x+w.x)/2,y:(k.y+w.y)/2,distance:Math.hypot(w.x-k.x,w.y-k.y)}:{...k,distance:0}},ct=u=>{I.size===0&&(F=!1);const k=Gt(u,t,Ve);u.button!==0||u.pointerType!=="touch"&&k!==null||(I.set(u.pointerId,{x:u.clientX,y:u.clientY}),z=W(),k===null&&t.setPointerCapture(u.pointerId),u.pointerType!=="touch"&&k===null&&(u.preventDefault(),t.focus({preventScroll:!0})))},ue=u=>{if(!I.has(u.pointerId)||z===null)return;I.set(u.pointerId,{x:u.clientX,y:u.clientY});const k=W();if(k===null)return;const w=k.x-z.x,C=k.y-z.y;if((Math.abs(w)+Math.abs(C)>1||Math.abs(k.distance-z.distance)>1)&&(F=!0),k.distance>0&&z.distance>0){const T=t.getBoundingClientRect();M(Math.pow(k.distance/z.distance,.45),z.x-T.left,z.y-T.top)}l={...l,x:l.x+w,y:l.y+C},p(),z=k,t.classList.toggle("is-panning",F)},pt=u=>{I.delete(u.pointerId),z=W(),!(I.size>0)&&(t.classList.remove("is-panning"),u.type==="pointercancel"&&(F=!1))},me=u=>{F&&(u.preventDefault(),u.stopPropagation()),pt(u)},ge=u=>{if(F){u.preventDefault(),u.stopPropagation(),F=!1;return}!(u.target instanceof Element)||Gt(u,t,Ve)!==null||s()},fe=u=>{if(u.target!==t)return;const k=30;if(u.key==="+"||u.key==="=")M(1.1);else if(u.key==="-")M(1/1.1);else if(u.key==="0")m();else if(u.key==="Escape"){if(s()===!1)return}else if(u.key==="ArrowLeft"||u.key==="ArrowRight"||u.key==="ArrowUp"||u.key==="ArrowDown")l={...l,x:l.x+(u.key==="ArrowLeft"?k:u.key==="ArrowRight"?-k:0),y:l.y+(u.key==="ArrowUp"?k:u.key==="ArrowDown"?-k:0)},p();else return;u.preventDefault()},be=u=>{const k=u.target instanceof HTMLElement?u.target:null;if(k===null||!u.composedPath().includes(e))return;const w=k.getBoundingClientRect(),C=t.getBoundingClientRect();let T=0,q=0;w.left<C.left+12?T=C.left+12-w.left:w.right>C.right-12&&(T=C.right-12-w.right),w.top<C.top+12?q=C.top+12-w.top:w.bottom>C.bottom-40&&(q=C.bottom-40-w.bottom),!(T===0&&q===0)&&(l={...l,x:l.x+T,y:l.y+q},p())};t.addEventListener("wheel",Y,{passive:!1}),t.addEventListener("pointerdown",ct),t.addEventListener("pointermove",ue),t.addEventListener("pointerup",me),t.addEventListener("pointercancel",pt),t.addEventListener("lostpointercapture",pt),t.addEventListener("click",ge,!0),t.addEventListener("keydown",fe),t.addEventListener("focusin",be);const ke=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>p());return ke?.observe(t),{setContent(u){o=We(u.width===0&&u.height===0?[]:[u]),r&&(e.style.width=`${u.width}px`,e.style.height=`${u.height}px`),p()},apply:p,fit:m,fitTo:f,fitWidth:E,reset:R,zoom:M,view:()=>({...l}),destroy(){ke?.disconnect(),t.removeEventListener("wheel",Y),t.removeEventListener("pointerdown",ct),t.removeEventListener("pointermove",ue),t.removeEventListener("pointerup",me),t.removeEventListener("pointercancel",pt),t.removeEventListener("lostpointercapture",pt),t.removeEventListener("click",ge,!0),t.removeEventListener("keydown",fe),t.removeEventListener("focusin",be)}}},Ua=["fit","fit-width","actual","none"];class Na{#a;#t=null;#e=null;#n=!1;constructor(t,e){this.#a=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.#a.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=qa({canvas:e,world:s,align:this.#a.align(),sizeWorld:!1,onClearSelection:()=>this.#a.onDismiss(),onView:a=>this.#a.onView(a)}),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.#a.elements()?.world;if(t===null||e===void 0)return;const s=this.#a.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const a=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:a,height:i}),!this.#n&&a>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#n=!0;const e=this.#a.initial(),s=Ua.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 ja=(n,t,e)=>n.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),Ge=160,Jt=(n,t,e=Ge)=>Math.max(e,Math.round(n+t)),Fa=(n,t,e,s=Ge)=>{const a=e?96:24;return t==="ArrowDown"?Jt(n,a,s):t==="ArrowUp"?Jt(n,-a,s):null},Je={kind:"idle"};class Ha{constructor(t,e){this.#e=null,this.#n=Je,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const a=s.currentTarget;a instanceof Element&&a.setPointerCapture(s.pointerId),this.#n={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#a.requestUpdate()},pointermove:s=>{const a=this.#n;a.kind!=="dragging"||a.pointerId!==s.pointerId||this.#s(Jt(a.startHeight,s.clientY-a.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const a=Fa(this.#e??this.#t(),s.key,s.shiftKey);a!==null&&(s.preventDefault(),this.#s(a))},dblclick:()=>this.#s(null)},this.#a=t,this.#t=e,t.addController(this)}#a;#t;#e;#n;hostConnected(){}get height(){return this.#e}get dragging(){return this.#n.kind==="dragging"}#s(t){t!==this.#e&&(this.#e=t,this.#a.requestUpdate())}#i(t){const e=this.#n;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#n=Je,this.#a.requestUpdate())}}const Wa=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 Xe extends A{static{this.styles=[L,J,_`
2
2
  :host {
3
3
  display: block;
4
4
  color: var(--dpk-ink);
@@ -367,7 +367,7 @@ import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4
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}}}#a=new P(this);#t=new sa(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=oa(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new ia(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#n=0;#s=!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.#x),this.addEventListener("wheel",this.#f,{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.#n=this.renderRoot.querySelector(".panel")?.offsetHeight??0)}updated(t){t.has("maximized")&&this.#u(),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.#s=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#s,e=this.#e.height;return d`
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}}}#a=new O(this);#t=new Na(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=Ba(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new Ha(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#n=0;#s=!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.#x),this.addEventListener("wheel",this.#b,{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.#n=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.#s=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#s,e=this.#e.height;return d`
371
371
  ${this.maximized?d`<div class="placeholder" style="height:${this.#n}px"></div>`:h}
372
372
  <section
373
373
  class=${this.maximized?"panel is-maximized":"panel"}
@@ -391,14 +391,14 @@ import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4
391
391
  </div>
392
392
  <slot name="footer"></slot>
393
393
  </section>
394
- `}get#i(){return ra(this.#a.locale)}#r(){return d`<div class="body canvas" part="body canvas" tabindex="0" aria-label=${this.label??this.#i.canvas}>
394
+ `}get#i(){return Wa(this.#a.locale)}#r(){return d`<div class="body canvas" part="body canvas" tabindex="0" aria-label=${this.label??this.#i.canvas}>
395
395
  <div class="world" part="world"><slot></slot></div>
396
396
  <slot name="overlay"></slot>
397
- </div>`}#o(t){const e=this.#i,s=[this.canvas?this.#d():null,this.maximizable?this.#c():null,this.resizable&&!this.maximized?this.#m():null].filter(a=>a!==null);return d`<div class="controls" part="controls" role="toolbar" aria-label=${e.controls} ?hidden=${!t}>
398
- <slot name="controls" @slotchange=${this.#h}></slot>
397
+ </div>`}#o(t){const e=this.#i,s=[this.canvas?this.#l():null,this.maximizable?this.#c():null,this.resizable&&!this.maximized?this.#g():null].filter(a=>a!==null);return d`<div class="controls" part="controls" role="toolbar" aria-label=${e.controls} ?hidden=${!t}>
398
+ <slot name="controls" @slotchange=${this.#u}></slot>
399
399
  ${s.map((a,i)=>d`${i>0||this.#s?d`<span class="separator"></span>`:h}${a}`)}
400
- </div>`}#d(){const t=this.#i;return d`<button type="button" aria-label=${t.zoomOut} title=${t.zoomOut} @click=${()=>this.zoom(1/1.1)}>
401
- ${hn()}
400
+ </div>`}#l(){const t=this.#i;return d`<button type="button" aria-label=${t.zoomOut} title=${t.zoomOut} @click=${()=>this.zoom(1/1.1)}>
401
+ ${jn()}
402
402
  </button>
403
403
  <button
404
404
  type="button"
@@ -410,25 +410,25 @@ import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4
410
410
  100%
411
411
  </button>
412
412
  <button type="button" aria-label=${t.zoomIn} title=${t.zoomIn} @click=${()=>this.zoom(1.1)}>
413
- ${pe()}
413
+ ${we()}
414
414
  </button>`}#c(){const t=this.maximized?this.#i.restore:this.#i.maximize;return d`<button
415
415
  type="button"
416
416
  class="maximize"
417
417
  aria-label=${t}
418
418
  title=${t}
419
419
  aria-pressed=${this.maximized?"true":"false"}
420
- @click=${()=>this.#l(!this.maximized)}
420
+ @click=${()=>this.#d(!this.maximized)}
421
421
  >
422
- ${this.maximized?he():un()}
422
+ ${this.maximized?$e():Fn()}
423
423
  </button>`}#p(){const t=this.#i.restore;return d`<button
424
424
  type="button"
425
425
  class="exit-fullscreen"
426
426
  aria-label=${t}
427
427
  title=${t}
428
- @click=${()=>this.#l(!1)}
428
+ @click=${()=>this.#d(!1)}
429
429
  >
430
- ${he()}
431
- </button>`}#m(){const t=this.#i,e=this.#e.handlers;return d`<div
430
+ ${$e()}
431
+ </button>`}#g(){const t=this.#i,e=this.#e.handlers;return d`<div
432
432
  class="grip"
433
433
  part="grip"
434
434
  role="separator"
@@ -443,8 +443,8 @@ import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4
443
443
  @keydown=${e.keydown}
444
444
  @dblclick=${e.dblclick}
445
445
  >
446
- ${mn()}
447
- </div>`}#h=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#s&&this.requestUpdate()};#l(t){t!==this.maximized&&(this.maximized=t,this.dispatchEvent(new CustomEvent("dpk-maximize-change",{detail:{maximized:t},bubbles:!0,composed:!0})))}#u(){const t=this.renderRoot.querySelector(".panel");if(!(!this.maximized||!t||typeof t.showPopover!="function")&&!t.matches(":popover-open"))try{t.showPopover()}catch{}}#f=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(a=>{if(!(a instanceof Element))return[];const{overflowX:i,overflowY:o}=getComputedStyle(a);return[{overflowX:i,scrollLeft:a.scrollLeft,scrollWidth:a.scrollWidth,clientWidth:a.clientWidth,overflowY:o,scrollTop:a.scrollTop,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}]});na(s,t.deltaX,t.deltaY)||t.preventDefault()};#x=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#l(!1))}}const oa=n=>`${Math.round(n.scale*100)}%`,qe=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",Oe)},la=(n,t)=>n.active.includes(t)?{...n,active:n.active.filter(e=>e!==t)}:n.match==="single"?{...n,active:[t]}:{...n,active:[...n.active,t]},da=(n,t)=>({match:t,active:t==="single"&&n.active.length>1?n.active.slice(-1):n.active}),ca=n=>({...n,active:[]}),pa=n=>{const t=new Map;for(const e of n)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},ha={nodes:new Map,edges:new Set},Ie=(n,t,e,s)=>{const a=new Map,i=new Set,o=[{id:t,depth:0}],r=new Set([t]);for(const l of o)if(!(!s&&l.depth>=1))for(const u of n){const c=e==="outgoing"?u.from:u.to,m=e==="outgoing"?u.to:u.from;c===l.id&&(i.add(u.id),!r.has(m)&&(r.add(m),a.set(m,l.depth+1),o.push({id:m,depth:l.depth+1})))}return{nodes:a,edges:i}},ua=(n,t)=>{const e=new Map(n.map(i=>[i,Ie(t,i,"outgoing",!0).nodes])),s=new Set,a=[];for(const i of n){if(s.has(i))continue;const o=n.filter(r=>r===i||e.get(i)?.has(r)===!0&&e.get(r)?.has(i)===!0);for(const r of o)s.add(r);(o.length>1||t.some(r=>r.from===i&&r.to===i))&&a.push(o)}return a},ma=n=>new Map(n.flatMap((t,e)=>t.map(s=>[s,e]))),ga=(n,t)=>t.get(n.from)===t.get(n.to)&&t.has(n.from),fa=(n,t,e,s)=>{const a=t!==null&&t.kind===e&&t.id===n,i=e==="node"?s.nodes.has(n):s.edges.has(n),o=e==="node"?s.nodes.get(n)??null:null;return{selected:a,related:i&&!a,dimmed:t!==null&&!a&&!i,depth:o}},ba=(...n)=>n.filter(t=>typeof t=="string"&&t!=="").join(" "),ka=n=>{const t=n[0]??{x:0,y:0},e=n.at(-1)??t;if(n.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(n.length===4){const r=n[1]??t,l=n[2]??e;return{x:(r.x+l.x)/2,y:(r.y+l.y)/2}}let s=0,a=-1;for(let r=0;r+1<n.length;r++){const l=n[r],u=n[r+1],c=Math.abs(u.x-l.x)+Math.abs(u.y-l.y);c>a&&(a=c,s=r)}const i=n[s]??t,o=n[s+1]??e;return{x:(i.x+o.x)/2,y:(i.y+o.y)/2}},va=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"}}),xa=["single","all","any"],Ue=n=>n.startsWith(Wn),ya=n=>{const t=new Set,e=n.flatMap(s=>{const a=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return a.tag===""||t.has(a.tag)?[]:(t.add(a.tag),[a])});return[...e.filter(s=>Ue(s.tag)),...e.filter(s=>!Ue(s.tag))]},wa=ve([v(),Rt({tag:v(),count:Mn(bt())})]),$a=Rt({tags:$(Dt()),active:g(be(ke($(Dt())),null)),match:g(be(ke(nt(xa)),null))}),je=n=>{const t=W($a,Array.isArray(n)?{tags:n}:n),e=t.tags.flatMap(a=>{const i=Pt(wa,a);return i.success?[i.output]:[]}),s=t.active?.filter(a=>typeof a=="string")??null;return{tags:e,active:s,match:t.match??null}},Ca=[["single","Single"],["all","AND"],["any","OR"]];class Ne extends z{static{this.styles=[T,M`
446
+ ${Hn()}
447
+ </div>`}#u=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#s&&this.requestUpdate()};#d(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{}}#b=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(a=>{if(!(a instanceof Element))return[];const{overflowX:i,overflowY:r}=getComputedStyle(a);return[{overflowX:i,scrollLeft:a.scrollLeft,scrollWidth:a.scrollWidth,clientWidth:a.clientWidth,overflowY:r,scrollTop:a.scrollTop,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}]});ja(s,t.deltaX,t.deltaY)||t.preventDefault()};#x=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#d(!1))}}const Ba=n=>`${Math.round(n.scale*100)}%`,Ye=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",Xe)},Ka=(n,t)=>n.active.includes(t)?{...n,active:n.active.filter(e=>e!==t)}:n.match==="single"?{...n,active:[t]}:{...n,active:[...n.active,t]},Va=(n,t)=>({match:t,active:t==="single"&&n.active.length>1?n.active.slice(-1):n.active}),Ga=n=>({...n,active:[]}),Ja=n=>{const t=new Map;for(const e of n)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},Xa={nodes:new Map,edges:new Set},Ze=(n,t,e,s)=>{const a=new Map,i=new Set,r=[{id:t,depth:0}],o=new Set([t]);for(const l of r)if(!(!s&&l.depth>=1))for(const c of n){const p=e==="outgoing"?c.from:c.to,m=e==="outgoing"?c.to:c.from;p===l.id&&(i.add(c.id),!o.has(m)&&(o.add(m),a.set(m,l.depth+1),r.push({id:m,depth:l.depth+1})))}return{nodes:a,edges:i}},Ya=(n,t)=>{const e=new Map(n.map(i=>[i,Ze(t,i,"outgoing",!0).nodes])),s=new Set,a=[];for(const i of n){if(s.has(i))continue;const r=n.filter(o=>o===i||e.get(i)?.has(o)===!0&&e.get(o)?.has(i)===!0);for(const o of r)s.add(o);(r.length>1||t.some(o=>o.from===i&&o.to===i))&&a.push(r)}return a},Za=n=>new Map(n.flatMap((t,e)=>t.map(s=>[s,e]))),Qa=(n,t)=>t.get(n.from)===t.get(n.to)&&t.has(n.from),ti=(n,t,e,s)=>{const a=t!==null&&t.kind===e&&t.id===n,i=e==="node"?s.nodes.has(n):s.edges.has(n),r=e==="node"?s.nodes.get(n)??null:null;return{selected:a,related:i&&!a,dimmed:t!==null&&!a&&!i,depth:r}},ei=(...n)=>n.filter(t=>typeof t=="string"&&t!=="").join(" "),si=n=>{const t=n[0]??{x:0,y:0},e=n.at(-1)??t;if(n.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(n.length===4){const o=n[1]??t,l=n[2]??e;return{x:(o.x+l.x)/2,y:(o.y+l.y)/2}}let s=0,a=-1;for(let o=0;o+1<n.length;o++){const l=n[o],c=n[o+1],p=Math.abs(c.x-l.x)+Math.abs(c.y-l.y);p>a&&(a=p,s=o)}const i=n[s]??t,r=n[s+1]??e;return{x:(i.x+r.x)/2,y:(i.y+r.y)/2}},ni=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"}}),ai=["single","all","any"],Qe=n=>n.startsWith(Ma),ii=n=>{const t=new Set,e=n.flatMap(s=>{const a=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return a.tag===""||t.has(a.tag)?[]:(t.add(a.tag),[a])});return[...e.filter(s=>Qe(s.tag)),...e.filter(s=>!Qe(s.tag))]},ri=Le([b(),jt({tag:b(),count:P(st())})]),oi=jt({tags:$(Ft()),active:g(ze(_e($(Ft())),null)),match:g(ze(_e(Z(ai)),null))}),ts=n=>{const t=B(oi,Array.isArray(n)?{tags:n}:n),e=t.tags.flatMap(a=>{const i=St(ri,a);return i.success?[i.output]:[]}),s=t.active?.filter(a=>typeof a=="string")??null;return{tags:e,active:s,match:t.match??null}},li=[["single","Single"],["all","AND"],["any","OR"]];class es extends A{static{this.styles=[L,_`
448
448
  :host {
449
449
  display: block;
450
450
  flex-shrink: 0;
@@ -563,15 +563,15 @@ import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4
563
563
  outline: none;
564
564
  box-shadow: var(--dpk-focus);
565
565
  }
566
- `]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#a=new P(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=_(this,je,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 Bn(t,this.#n)}render(){const t=ya(this.tags);if(t.length===0)return h;const e=this.#e;return d`
566
+ `]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#a=new O(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=X(this,ts,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 Aa(t,this.#n)}render(){const t=ii(this.tags);if(t.length===0)return h;const e=this.#e;return d`
567
567
  <div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
568
568
  <div class="diagram-match" role="group" aria-label=${e.tagMatch}>
569
- ${Ca.map(([s,a])=>d`
569
+ ${li.map(([s,a])=>d`
570
570
  <button
571
571
  type="button"
572
572
  data-match=${s}
573
573
  aria-pressed=${this.match===s?"true":"false"}
574
- @click=${()=>this.#s(da(this.#n,s))}
574
+ @click=${()=>this.#s(Va(this.#n,s))}
575
575
  >
576
576
  ${a}
577
577
  </button>
@@ -583,17 +583,17 @@ import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4
583
583
  class="dpk-tag"
584
584
  data-tag=${s.tag}
585
585
  aria-pressed=${this.active.includes(s.tag)?"true":"false"}
586
- @click=${()=>this.#s(la(this.#n,s.tag))}
586
+ @click=${()=>this.#s(Ka(this.#n,s.tag))}
587
587
  >
588
588
  <span class="dpk-tag-name" title=${s.tag}>${s.tag}</span>${s.count===null?h:d`<span class="dpk-tag-count">${s.count}</span>`}
589
589
  </button>
590
590
  `)}
591
- ${this.active.length>0?d`<button type="button" class="dpk-tag-clear" @click=${()=>this.#s(ca(this.#n))}>
591
+ ${this.active.length>0?d`<button type="button" class="dpk-tag-clear" @click=${()=>this.#s(Ga(this.#n))}>
592
592
  ${e.clearTags}
593
593
  </button>`:h}
594
594
  </div>
595
- `}get#e(){return va(this.#a.locale)}get#n(){return{active:this.active,match:this.match}}#s(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 Fe=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",Ne)},He=Symbol.for("dev-process-kit:atom-styles"),_e=()=>{if(typeof document>"u"||Reflect.get(document,He)===!0)return;Reflect.set(document,He,!0),Sn();const n=[ue,fe].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(n.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${ue.cssText}
596
- ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No data to plot",invalid:n=>`Invalid chart data: ${n}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${n}`}}),Nt=["blue","green","amber","violet","accent","ink-faint"],We=w({x:C(v(),E(1)),y:C(bt(),Ot())}),Ea=w({id:G,label:C(v(),E(1)),points:$(We),tone:g(nt(Nt),"blue"),area:g(at(),!1)}),za=w({id:G,label:C(v(),E(1)),points:$(We),tone:g(nt(Nt),"ink-faint"),dashed:g(at(),!0)}),Ma=w({x:C(v(),E(1)),label:C(v(),E(1)),tone:g(nt(Nt),"accent")}),Be=w({label:g(v()),min:g(C(bt(),Ot())),max:g(C(bt(),Ot()))}),Ta=w({title:g(v(),""),caption:g(v(),""),series:g($(Ea),[]),guides:g($(za),[]),marks:g($(Ma),[]),xAxis:g(Be,{}),yAxis:g(Be,{})}),Ft=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},Ge=(n,t)=>{Ft(n.map(e=>e.x),`x in "${t}"`)},Ke=n=>{const t=W(Ta,n);Ft(t.series.map(e=>e.id),"series id"),Ft(t.guides.map(e=>e.id),"guide id");for(const e of t.series)Ge(e.points,e.label);for(const e of t.guides)Ge(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},Ht=6,Aa=n=>{const t=[],e=new Set;for(const s of[...n.series,...n.guides])for(const a of s.points)e.has(a.x)||(e.add(a.x),t.push(a.x));return t},La=n=>{const t=[...n.series,...n.guides].flatMap(o=>o.points.map(r=>r.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),a=n.yAxis.min??Math.min(0,e);let i=n.yAxis.max??s;if(i<=a&&(i=a+1),n.yAxis.max===void 0){const o=i-a;i+=o*.08}return{min:a,max:i}},_t=n=>n.length===0?"":n.map((t,e)=>`${e===0?"M":"L"}${Z(t.x)} ${Z(t.y)}`).join(" "),Ra=(n,t)=>n.length===0?null:`${_t(n)} L${Z(n.at(-1)?.x??0)} ${Z(t)} L${Z(n[0]?.x??0)} ${Z(t)} Z`,Z=n=>Math.round(n*100)/100,Ve=n=>Number.isInteger(n)?String(n):String(Math.round(n*10)/10),Da=(n,t)=>{const e=n/Math.max(1,t),s=10**Math.floor(Math.log10(e)),a=e/s;return(a<=1?1:a<=2?2:a<=5?5:10)*s},Pa=(n,t,e)=>{const s=Da(t-n,4),a=Math.ceil(n/s)*s,i=[];for(let r=a;r<=t+s/1e3;r+=s)i.push({y:e(r),label:Ve(r)});const o=e(n);return i.some(r=>Math.abs(r.y-o)<.01)||i.push({y:o,label:Ve(n)}),i},Oa=(n,t)=>{if(n.length===0)return[];if(n.length<=Ht)return n.map((s,a)=>({x:t(a),label:s}));const e=Array.from({length:Ht},(s,a)=>Math.round(a*(n.length-1)/(Ht-1)));return[...new Set(e)].map(s=>({x:t(s),label:n[s]??""}))},qa=(n,t=720,e=280)=>{const s=Aa(n),a=La(n);if(s.length===0||a===null)return null;const i={left:J.left,top:J.top,width:t-J.left-J.right,height:e-J.top-J.bottom},o=new Map(s.map((m,k)=>[m,k])),r=m=>s.length===1?i.left+i.width/2:i.left+m/(s.length-1)*i.width,l=m=>i.top+(1-(m-a.min)/(a.max-a.min))*i.height,u=m=>m.flatMap(k=>{const L=o.get(k.x);return L===void 0?[]:[{x:r(L),y:l(k.y)}]}).sort((k,L)=>k.x-L.x),c=i.top+i.height;return{width:t,height:e,plot:i,series:n.series.map(m=>{const k=u(m.points);return{...m,nodes:k,path:_t(k),areaPath:m.area?Ra(k,c):null}}),guides:n.guides.map(m=>({...m,path:_t(u(m.points))})),marks:n.marks.flatMap(m=>{const k=o.get(m.x);return k===void 0?[]:[{...m,x:r(k)}]}),xTicks:Oa(s,r),yTicks:Pa(a.min,a.max,l)}},Ia=M`
595
+ `}get#e(){return ni(this.#a.locale)}get#n(){return{active:this.active,match:this.match}}#s(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 ss=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",es)},ns=Symbol.for("dev-process-kit:atom-styles"),as=()=>{if(typeof document>"u"||Reflect.get(document,ns)===!0)return;Reflect.set(document,ns,!0),ca();const n=[Ce,Ae].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(n.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${Ce.cssText}
596
+ ${Ae.cssText}`,document.head.append(t)},di=D({en:{aria:"Line chart",empty:"No data to plot",invalid:n=>`Invalid chart data: ${n}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${n}`}}),Xt=["blue","green","amber","violet","accent","ink-faint"],is=x({x:y(b(),S(1)),y:y(st(),Ht())}),ci=x({id:Q,label:y(b(),S(1)),points:$(is),tone:g(Z(Xt),"blue"),area:g(nt(),!1)}),pi=x({id:Q,label:y(b(),S(1)),points:$(is),tone:g(Z(Xt),"ink-faint"),dashed:g(nt(),!0)}),hi=x({x:y(b(),S(1)),label:y(b(),S(1)),tone:g(Z(Xt),"accent")}),rs=x({label:g(b()),min:g(y(st(),Ht())),max:g(y(st(),Ht()))}),ui=x({title:g(b(),""),caption:g(b(),""),series:g($(ci),[]),guides:g($(pi),[]),marks:g($(hi),[]),xAxis:g(rs,{}),yAxis:g(rs,{})}),Yt=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},os=(n,t)=>{Yt(n.map(e=>e.x),`x in "${t}"`)},ls=n=>{const t=B(ui,n);Yt(t.series.map(e=>e.id),"series id"),Yt(t.guides.map(e=>e.id),"guide id");for(const e of t.series)os(e.points,e.label);for(const e of t.guides)os(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},it={top:22,right:18,bottom:38,left:52},Zt=6,mi=n=>{const t=[],e=new Set;for(const s of[...n.series,...n.guides])for(const a of s.points)e.has(a.x)||(e.add(a.x),t.push(a.x));return t},gi=n=>{const t=[...n.series,...n.guides].flatMap(r=>r.points.map(o=>o.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),a=n.yAxis.min??Math.min(0,e);let i=n.yAxis.max??s;if(i<=a&&(i=a+1),n.yAxis.max===void 0){const r=i-a;i+=r*.08}return{min:a,max:i}},Qt=n=>n.length===0?"":n.map((t,e)=>`${e===0?"M":"L"}${rt(t.x)} ${rt(t.y)}`).join(" "),fi=(n,t)=>n.length===0?null:`${Qt(n)} L${rt(n.at(-1)?.x??0)} ${rt(t)} L${rt(n[0]?.x??0)} ${rt(t)} Z`,rt=n=>Math.round(n*100)/100,ds=n=>Number.isInteger(n)?String(n):String(Math.round(n*10)/10),bi=(n,t)=>{const e=n/Math.max(1,t),s=10**Math.floor(Math.log10(e)),a=e/s;return(a<=1?1:a<=2?2:a<=5?5:10)*s},ki=(n,t,e)=>{const s=bi(t-n,4),a=Math.ceil(n/s)*s,i=[];for(let o=a;o<=t+s/1e3;o+=s)i.push({y:e(o),label:ds(o)});const r=e(n);return i.some(o=>Math.abs(o.y-r)<.01)||i.push({y:r,label:ds(n)}),i},vi=(n,t)=>{if(n.length===0)return[];if(n.length<=Zt)return n.map((s,a)=>({x:t(a),label:s}));const e=Array.from({length:Zt},(s,a)=>Math.round(a*(n.length-1)/(Zt-1)));return[...new Set(e)].map(s=>({x:t(s),label:n[s]??""}))},xi=(n,t=720,e=280)=>{const s=mi(n),a=gi(n);if(s.length===0||a===null)return null;const i={left:it.left,top:it.top,width:t-it.left-it.right,height:e-it.top-it.bottom},r=new Map(s.map((m,f)=>[m,f])),o=m=>s.length===1?i.left+i.width/2:i.left+m/(s.length-1)*i.width,l=m=>i.top+(1-(m-a.min)/(a.max-a.min))*i.height,c=m=>m.flatMap(f=>{const E=r.get(f.x);return E===void 0?[]:[{x:o(E),y:l(f.y)}]}).sort((f,E)=>f.x-E.x),p=i.top+i.height;return{width:t,height:e,plot:i,series:n.series.map(m=>{const f=c(m.points);return{...m,nodes:f,path:Qt(f),areaPath:m.area?fi(f,p):null}}),guides:n.guides.map(m=>({...m,path:Qt(c(m.points))})),marks:n.marks.flatMap(m=>{const f=r.get(m.x);return f===void 0?[]:[{...m,x:o(f)}]}),xTicks:vi(s,o),yTicks:ki(a.min,a.max,l)}},yi=_`
597
597
  :host {
598
598
  display: block;
599
599
  min-width: 0;
@@ -614,59 +614,59 @@ ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No da
614
614
  font-family: var(--dpk-mono);
615
615
  font-size: 10px;
616
616
  }
617
- `,F=n=>`--tone: var(--dpk-${n})`;class Je extends z{static{this.styles=[En,Ia]}static{this.properties={data:{attribute:!1}}}#a=new P(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#n=_(this,Ke,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Ke(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Sa(this.#a.locale),e=this.#t,s=e===null?null:qa(e);if(this.#e!==null)return this.#s(d`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#s(d`<p class="dpk-chart-empty">${t.empty}</p>`);const a=e.title===""?t.aria:e.title;return d`<section class="dpk-chart" aria-label=${a}>
617
+ `,K=n=>`--tone: var(--dpk-${n})`;class cs extends A{static{this.styles=[pa,yi]}static{this.properties={data:{attribute:!1}}}#a=new O(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#n=X(this,ls,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=ls(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=di(this.#a.locale),e=this.#t,s=e===null?null:xi(e);if(this.#e!==null)return this.#s(d`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#s(d`<p class="dpk-chart-empty">${t.empty}</p>`);const a=e.title===""?t.aria:e.title;return d`<section class="dpk-chart" aria-label=${a}>
618
618
  ${e.title===""&&e.caption===""?h:d`<header class="dpk-chart-head">
619
619
  ${e.title===""?h:d`<span class="dpk-chart-title">${e.title}</span>`}
620
620
  ${e.caption===""?h:d`<span class="dpk-chart-value">${e.caption}</span>`}
621
621
  </header>`}
622
622
  <div class="dpk-chart-plot">${this.#i(e,s,a)}</div>
623
623
  ${this.#c(e)}
624
- </section>`}#s(t){return d`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:a,width:i,height:o}=e,r=a.top+a.height;return d`<svg viewBox="0 0 ${i} ${o}" role="img" aria-label=${s}>
624
+ </section>`}#s(t){return d`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:a,width:i,height:r}=e,o=a.top+a.height;return d`<svg viewBox="0 0 ${i} ${r}" role="img" aria-label=${s}>
625
625
  <title>${s}</title>
626
626
  <g class="dpk-chart-grid">
627
- ${e.yTicks.map(l=>j`<line x1=${a.left} x2=${a.left+a.width} y1=${l.y} y2=${l.y}></line>`)}
627
+ ${e.yTicks.map(l=>H`<line x1=${a.left} x2=${a.left+a.width} y1=${l.y} y2=${l.y}></line>`)}
628
628
  </g>
629
629
  <g class="dpk-chart-axis">
630
- <line x1=${a.left} x2=${a.left} y1=${a.top} y2=${r}></line>
631
- <line x1=${a.left} x2=${a.left+a.width} y1=${r} y2=${r}></line>
630
+ <line x1=${a.left} x2=${a.left} y1=${a.top} y2=${o}></line>
631
+ <line x1=${a.left} x2=${a.left+a.width} y1=${o} y2=${o}></line>
632
632
  </g>
633
- ${e.yTicks.map(l=>j`<text class="dpk-chart-tick" x=${a.left-8} y=${l.y+3} text-anchor="end">${l.label}</text>`)}
634
- ${e.xTicks.map(l=>j`<text class="dpk-chart-tick" x=${l.x} y=${r+16} text-anchor="middle">${l.label}</text>`)}
635
- ${t.xAxis.label===void 0?h:j`<text class="axis-label" x=${a.left+a.width/2} y=${o-3} text-anchor="middle">${t.xAxis.label}</text>`}
636
- ${t.yAxis.label===void 0?h:j`<text class="axis-label" x=${12} y=${a.top+a.height/2} text-anchor="middle" transform="rotate(-90 12 ${a.top+a.height/2})">${t.yAxis.label}</text>`}
633
+ ${e.yTicks.map(l=>H`<text class="dpk-chart-tick" x=${a.left-8} y=${l.y+3} text-anchor="end">${l.label}</text>`)}
634
+ ${e.xTicks.map(l=>H`<text class="dpk-chart-tick" x=${l.x} y=${o+16} text-anchor="middle">${l.label}</text>`)}
635
+ ${t.xAxis.label===void 0?h:H`<text class="axis-label" x=${a.left+a.width/2} y=${r-3} text-anchor="middle">${t.xAxis.label}</text>`}
636
+ ${t.yAxis.label===void 0?h:H`<text class="axis-label" x=${12} y=${a.top+a.height/2} text-anchor="middle" transform="rotate(-90 12 ${a.top+a.height/2})">${t.yAxis.label}</text>`}
637
637
  ${e.guides.map(l=>this.#o(l))}
638
638
  ${e.series.map(l=>this.#r(l))}
639
- ${e.marks.map(l=>this.#d(l,a.top,r))}
640
- </svg>`}#r(t){return t.path===""?h:j`${t.areaPath===null?h:j`<path class="dpk-chart-area" d=${t.areaPath} style=${F(t.tone)}></path>`}
641
- <path class="dpk-chart-line" d=${t.path} style=${F(t.tone)}></path>
642
- ${t.nodes.map(e=>j`<circle
639
+ ${e.marks.map(l=>this.#l(l,a.top,o))}
640
+ </svg>`}#r(t){return t.path===""?h:H`${t.areaPath===null?h:H`<path class="dpk-chart-area" d=${t.areaPath} style=${K(t.tone)}></path>`}
641
+ <path class="dpk-chart-line" d=${t.path} style=${K(t.tone)}></path>
642
+ ${t.nodes.map(e=>H`<circle
643
643
  class="dpk-chart-point"
644
644
  cx=${e.x}
645
645
  cy=${e.y}
646
646
  r="2.5"
647
- style=${F(t.tone)}
648
- ></circle>`)}`}#o(t){return t.path===""?h:j`<path
647
+ style=${K(t.tone)}
648
+ ></circle>`)}`}#o(t){return t.path===""?h:H`<path
649
649
  class="guide"
650
650
  d=${t.path}
651
- style=${F(t.tone)}
651
+ style=${K(t.tone)}
652
652
  ?data-dashed=${t.dashed}
653
- ></path>`}#d(t,e,s){return j`<line
653
+ ></path>`}#l(t,e,s){return H`<line
654
654
  class="dpk-chart-mark"
655
655
  x1=${t.x}
656
656
  x2=${t.x}
657
657
  y1=${e}
658
658
  y2=${s}
659
- style=${F(t.tone)}
659
+ style=${K(t.tone)}
660
660
  ></line>
661
- <text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${F(t.tone)}
661
+ <text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${K(t.tone)}
662
662
  >${t.label}</text
663
663
  >`}#c(t){return t.series.length===0&&t.guides.length===0&&t.marks.length===0?h:d`<div class="dpk-chart-legend">
664
- ${t.series.map(e=>d`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${F(e.tone)}
664
+ ${t.series.map(e=>d`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${K(e.tone)}
665
665
  >${e.label}</span
666
666
  >`)}
667
- ${t.guides.map(e=>d`<span class="dpk-chart-key" data-variant="dashed" style=${F(e.tone)}>${e.label}</span>`)}
668
- ${t.marks.map(e=>d`<span class="dpk-chart-key" data-variant="mark" style=${F(e.tone)}>${e.label}</span>`)}
669
- </div>`}}const Ze=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",Je)},Ua=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:n=>`${n} ${n===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:n=>`Comment on ${n}`,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:n=>`${n} \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:n=>`${n}\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"}}),O=C(v(),ye(),E(1)),rt=w({id:G,text:O}),ja=xe("kind",[w({kind:V("proved"),assumptions:g($(O))}),w({kind:V("bounded"),bound:O}),w({kind:V("incomplete"),gaps:g($(O))}),w({kind:V("planned")})]),Na=w({id:G,target:g(G),statement:O,subjects:g($(rt)),premises:g($(rt)),conclusions:C($(rt),E(1,"a claim needs at least one conclusion")),examples:g($(rt)),notClaimed:g($(rt)),assurance:ja,source:g(w({tool:g(O),ref:O}))}),Fa=w({id:G,name:O,meaning:O}),Ha=w({id:G,name:O,code:g(O),summary:g(O)}),_a=w({targets:g($(Ha)),terms:g($(Fa)),claims:$(Na)}),Wa=()=>({targets:[],terms:[],claims:[]}),Ba=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,Ga=(n,t)=>{const e=[];let s=0;for(const a of n.matchAll(Ba)){const i=(a[1]??"").trim(),o=t.get(i);if(o===void 0)throw new Error(`unknown term reference: [[${i}]]`);a.index>s&&e.push({kind:"text",text:n.slice(s,a.index)}),e.push({kind:"term",id:i,label:a[2]?.trim()||o}),s=a.index+a[0].length}return s<n.length&&e.push({kind:"text",text:n.slice(s)}),e},Xe=n=>n.map(t=>t.kind==="text"?t.text:t.label).join(""),Ka=n=>[...new Set(n.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],yt=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},Ye=n=>{const t=W(_a,n),e=t.targets??[],s=t.terms??[];yt(e.map(c=>c.id),"target"),yt(s.map(c=>c.id),"term"),yt(t.claims.map(c=>c.id),"claim");const a=new Map(s.map(c=>[c.id,c.name])),i=c=>Ga(c,a),o=s.map(c=>({id:c.id,name:c.name,meaning:i(c.meaning)})),r=e.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:i(c.summary)})),l=new Set(r.map(c=>c.id)),u=t.claims.map(c=>{if(c.target!==void 0&&!l.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const m=N=>(N??[]).map(et=>({id:et.id,text:i(et.text)})),k=m(c.subjects),L=m(c.premises),mt=m(c.conclusions),H=m(c.examples),tt=m(c.notClaimed),q=[...k,...L,...mt,...H,...tt];yt(q.map(N=>N.id),`clause (in claim ${c.id})`);const A=Va(c.assurance,i),I=i(c.statement);return{id:c.id,target:c.target??null,statement:I,subjects:k,premises:L,conclusions:mt,examples:H,notClaimed:tt,assurance:A,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:Ka([I,...q.map(N=>N.text),...Ja(A)])}});return{targets:r,terms:o,claims:u}},Va=(n,t)=>{switch(n.kind){case"proved":return{kind:"proved",assumptions:(n.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(n.bound)};case"incomplete":return{kind:"incomplete",gaps:(n.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},Ja=n=>{switch(n.kind){case"proved":return n.assumptions;case"bounded":return[n.bound];case"incomplete":return n.gaps;case"planned":return[]}},Za=n=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of n.claims)t[Qe(e.assurance)?"conditional":e.assurance.kind]+=1;return t},Qe=n=>n.kind==="proved"&&n.assumptions.length>0,ts=n=>{const t=new Map(n.targets.map(s=>[s.id,s])),e=new Map;for(const s of n.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of n.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,a])=>({target:s===null?null:t.get(s)??null,claims:a}))},ot=(n,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:n,items:t},Wt=(n,t)=>{switch(t.kind){case"proved":return Qe(t)?{tone:"caveat",label:n.conditional,detail:n.conditionalDetail,...ot(n.assumptions,t.assumptions)}:{tone:"sound",label:n.proved,detail:n.provedDetail,...ot("",[])};case"bounded":return{tone:"caveat",label:n.bounded,detail:n.boundedDetail,...ot(n.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:n.incomplete,detail:n.incompleteDetail,...ot(n.gaps,t.gaps)};case"planned":return{tone:"planned",label:n.planned,detail:n.plannedDetail,...ot("",[])}}},Xa=n=>{switch(n.kind){case"target":return["target",n.target];case"claim":return["claim",n.claim];case"clause":return["clause",n.claim,n.clause]}},Ya=n=>[...n.subjects,...n.premises,...n.conclusions,...n.examples,...n.notClaimed],es=32,ss=n=>{const t=Xe(n.statement);return t.length<=es?t:`${t.slice(0,es).trimEnd()}\u2026`},Qa=n=>[{target:{kind:"claim",claim:n.id},label:ss(n)},...Ya(n).map(t=>({target:{kind:"clause",claim:n.id,clause:t.id},label:`${ss(n)} \u203A ${Xe(t.text)}`}))],ti=n=>ts(n).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(Qa)]),ei=[T,B,gt,M`
667
+ ${t.guides.map(e=>d`<span class="dpk-chart-key" data-variant="dashed" style=${K(e.tone)}>${e.label}</span>`)}
668
+ ${t.marks.map(e=>d`<span class="dpk-chart-key" data-variant="mark" style=${K(e.tone)}>${e.label}</span>`)}
669
+ </div>`}}const ps=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",cs)},wi=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:n=>`${n} ${n===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:n=>`Comment on ${n}`,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:n=>`${n} \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:n=>`${n}\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"}}),N=y(b(),Re(),S(1)),mt=x({id:Q,text:N}),$i=Pe("kind",[x({kind:at("proved"),assumptions:g($(N))}),x({kind:at("bounded"),bound:N}),x({kind:at("incomplete"),gaps:g($(N))}),x({kind:at("planned")})]),Ci=x({id:Q,target:g(Q),statement:N,subjects:g($(mt)),premises:g($(mt)),conclusions:y($(mt),S(1,"a claim needs at least one conclusion")),examples:g($(mt)),notClaimed:g($(mt)),assurance:$i,source:g(x({tool:g(N),ref:N}))}),Si=x({id:Q,name:N,meaning:N}),Ei=x({id:Q,name:N,code:g(N),summary:g(N)}),Ti=x({targets:g($(Ei)),terms:g($(Si)),claims:$(Ci)}),Mi=()=>({targets:[],terms:[],claims:[]}),Ai=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,zi=(n,t)=>{const e=[];let s=0;for(const a of n.matchAll(Ai)){const i=(a[1]??"").trim(),r=t.get(i);if(r===void 0)throw new Error(`unknown term reference: [[${i}]]`);a.index>s&&e.push({kind:"text",text:n.slice(s,a.index)}),e.push({kind:"term",id:i,label:a[2]?.trim()||r}),s=a.index+a[0].length}return s<n.length&&e.push({kind:"text",text:n.slice(s)}),e},hs=n=>n.map(t=>t.kind==="text"?t.text:t.label).join(""),_i=n=>[...new Set(n.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],At=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},us=n=>{const t=B(Ti,n),e=t.targets??[],s=t.terms??[];At(e.map(p=>p.id),"target"),At(s.map(p=>p.id),"term"),At(t.claims.map(p=>p.id),"claim");const a=new Map(s.map(p=>[p.id,p.name])),i=p=>zi(p,a),r=s.map(p=>({id:p.id,name:p.name,meaning:i(p.meaning)})),o=e.map(p=>({id:p.id,name:p.name,code:p.code??null,summary:p.summary===void 0?null:i(p.summary)})),l=new Set(o.map(p=>p.id)),c=t.claims.map(p=>{if(p.target!==void 0&&!l.has(p.target))throw new Error(`unknown target (in claim ${p.id}): ${p.target}`);const m=W=>(W??[]).map(ct=>({id:ct.id,text:i(ct.text)})),f=m(p.subjects),E=m(p.premises),R=m(p.conclusions),M=m(p.examples),Y=m(p.notClaimed),I=[...f,...E,...R,...M,...Y];At(I.map(W=>W.id),`clause (in claim ${p.id})`);const z=Li(p.assurance,i),F=i(p.statement);return{id:p.id,target:p.target??null,statement:F,subjects:f,premises:E,conclusions:R,examples:M,notClaimed:Y,assurance:z,source:p.source===void 0?null:{tool:p.source.tool??null,ref:p.source.ref},terms:_i([F,...I.map(W=>W.text),...Pi(z)])}});return{targets:o,terms:r,claims:c}},Li=(n,t)=>{switch(n.kind){case"proved":return{kind:"proved",assumptions:(n.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(n.bound)};case"incomplete":return{kind:"incomplete",gaps:(n.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},Pi=n=>{switch(n.kind){case"proved":return n.assumptions;case"bounded":return[n.bound];case"incomplete":return n.gaps;case"planned":return[]}},Ri=n=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of n.claims)t[ms(e.assurance)?"conditional":e.assurance.kind]+=1;return t},ms=n=>n.kind==="proved"&&n.assumptions.length>0,gs=n=>{const t=new Map(n.targets.map(s=>[s.id,s])),e=new Map;for(const s of n.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of n.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,a])=>({target:s===null?null:t.get(s)??null,claims:a}))},gt=(n,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:n,items:t},te=(n,t)=>{switch(t.kind){case"proved":return ms(t)?{tone:"caveat",label:n.conditional,detail:n.conditionalDetail,...gt(n.assumptions,t.assumptions)}:{tone:"sound",label:n.proved,detail:n.provedDetail,...gt("",[])};case"bounded":return{tone:"caveat",label:n.bounded,detail:n.boundedDetail,...gt(n.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:n.incomplete,detail:n.incompleteDetail,...gt(n.gaps,t.gaps)};case"planned":return{tone:"planned",label:n.planned,detail:n.plannedDetail,...gt("",[])}}},Di=n=>{switch(n.kind){case"target":return["target",n.target];case"claim":return["claim",n.claim];case"clause":return["clause",n.claim,n.clause]}},Oi=n=>[...n.subjects,...n.premises,...n.conclusions,...n.examples,...n.notClaimed],fs=32,bs=n=>{const t=hs(n.statement);return t.length<=fs?t:`${t.slice(0,fs).trimEnd()}\u2026`},Ii=n=>[{target:{kind:"claim",claim:n.id},label:bs(n)},...Oi(n).map(t=>({target:{kind:"clause",claim:n.id,clause:t.id},label:`${bs(n)} \u203A ${hs(t.text)}`}))],qi=n=>gs(n).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(Ii)]),Ui=[L,J,ht,_`
670
670
  :host {
671
671
  display: block;
672
672
  container-type: inline-size;
@@ -1144,50 +1144,50 @@ ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No da
1144
1144
  font-size: 11px;
1145
1145
  color: var(--dpk-accent);
1146
1146
  }
1147
- `],ns=n=>`claim-body-${n}`;class as extends z{static{this.styles=ei}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#a=null;#t=new Map;#e=null;#n=null;#s="";#i=new Set;#r=null;#o=null;#d=new Mt(this);#c=new it(this);#p=new P(this,()=>{this.#s=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#s="",document.addEventListener("keydown",this.#S),document.addEventListener("pointerdown",this.#M),this.#n=_(this,Ye,t=>{t.ok?this.#f(t.value):this.#x(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#S),document.removeEventListener("pointerdown",this.#M),this.#n?.(),this.#n=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#f(this.data)}updated(){this.#v(),this.#c.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=kt(t.target,this.commentTargets,Tt(this.#p.locale),(s,a)=>this.#m(s,a));return e===null?null:[e]}#m(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#c.open(t,s,e)}#h(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.#a===null)return[];const t=`${this.subject??this.heading??this.#l.heading} \xB7 ${this.id}`;return ti(this.#a).map(({target:e,label:s})=>({value:this.#k(e),label:s,group:t}))}get dataError(){return this.#e}get#l(){return Ua(this.#p.locale)}#u(){return this.#a??Wa()}#f(t){this.#a=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#x(t){this.#a=null,this.#t=new Map,this.#e=t,console.error("[dev-process-kit] invalid formal spec data:",t),this.requestUpdate()}#k(t){return`element:${[this.id,...Xa(t)].map(e=>encodeURIComponent(e)).join("/")}`}#v(){const t=JSON.stringify(this.commentTargets);t!==this.#s&&(this.#s=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#g(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===ns(t)&&this.#b(s)}this.requestUpdate()}#z(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#g(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.#d.open(s,t,{width:300,height:240},{placement:"top-start"})}#y(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())}#S=t=>{t.key==="Escape"&&this.#b()};#M=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#b()};#T(t){const e=(a,i)=>{a.currentTarget instanceof HTMLElement&&i(a.currentTarget)},s=a=>a.pointerType!=="touch";return{enter:a=>s(a)&&e(a,i=>this.#y(t,i)),leave:a=>s(a)&&e(a,i=>this.#b(i)),show:a=>e(a,i=>this.#y(t,i)),hide:a=>e(a,i=>this.#b(i))}}render(){const t=this.#l,e=this.#u();return d`
1147
+ `],ks=n=>`claim-body-${n}`;class vs extends A{static{this.styles=Ui}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#a=null;#t=new Map;#e=null;#n=null;#s="";#i=new Set;#r=null;#o=null;#l=new qt(this);#c=new ut(this);#p=new O(this,()=>{this.#s=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#s="",document.addEventListener("keydown",this.#z),document.addEventListener("pointerdown",this.#S),this.#n=X(this,us,t=>{t.ok?this.#b(t.value):this.#x(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#z),document.removeEventListener("pointerdown",this.#S),this.#n?.(),this.#n=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#b(this.data)}updated(){this.#k(),this.#c.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=Et(t.target,this.commentTargets,Ut(this.#p.locale),(s,a)=>this.#g(s,a));return e===null?null:[e]}#g(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#c.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.#a===null)return[];const t=`${this.subject??this.heading??this.#d.heading} \xB7 ${this.id}`;return qi(this.#a).map(({target:e,label:s})=>({value:this.#f(e),label:s,group:t}))}get dataError(){return this.#e}get#d(){return wi(this.#p.locale)}#m(){return this.#a??Mi()}#b(t){this.#a=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#x(t){this.#a=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,...Di(t)].map(e=>encodeURIComponent(e)).join("/")}`}#k(){const t=JSON.stringify(this.commentTargets);t!==this.#s&&(this.#s=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#h(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===ks(t)&&this.#v(s)}this.requestUpdate()}#C(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#h(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"})}#y(t,e){this.#r?.anchor!==e&&(this.#r={tip:t,anchor:e},this.requestUpdate())}#v(t){this.#r===null||t!==void 0&&this.#r.anchor!==t||(this.#r=null,this.requestUpdate())}#z=t=>{t.key==="Escape"&&this.#v()};#S=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#v()};#E(t){const e=(a,i)=>{a.currentTarget instanceof HTMLElement&&i(a.currentTarget)},s=a=>a.pointerType!=="touch";return{enter:a=>s(a)&&e(a,i=>this.#y(t,i)),leave:a=>s(a)&&e(a,i=>this.#v(i)),show:a=>e(a,i=>this.#y(t,i)),hide:a=>e(a,i=>this.#v(i))}}render(){const t=this.#d,e=this.#m();return d`
1148
1148
  <section class="spec">
1149
1149
  <header class="spec-toolbar">
1150
1150
  <span class="spec-title">${this.heading??t.heading}</span>
1151
1151
  ${this.subject?d`<span class="spec-subject">${this.subject}</span>`:h}
1152
- <span class="spec-stats">${this.#A(e)}</span>
1152
+ <span class="spec-stats">${this.#_(e)}</span>
1153
1153
  </header>
1154
1154
  ${this.#e===null?h:d`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
1155
1155
  ${this.#e===null&&e.claims.length===0?d`<p class="spec-empty">${t.empty}</p>`:h}
1156
1156
  <div class="spec-groups">
1157
- ${U(ts(e),s=>s.target?.id??"",s=>this.#L(s))}
1157
+ ${U(gs(e),s=>s.target?.id??"",s=>this.#L(s))}
1158
1158
  </div>
1159
1159
  </section>
1160
- ${this.#U()}
1161
- ${this.#c.render({locale:this.#p.locale,errorMessage:this.#l.sendFailed,submit:(s,a)=>this.#h(s,a)})}
1162
- `}#A(t){const e=this.#l,s=Za(t),a=[{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 d`${e.claims(t.claims.length)}
1160
+ ${this.#q()}
1161
+ ${this.#c.render({locale:this.#p.locale,errorMessage:this.#d.sendFailed,submit:(s,a)=>this.#u(s,a)})}
1162
+ `}#_(t){const e=this.#d,s=Ri(t),a=[{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 d`${e.claims(t.claims.length)}
1163
1163
  ${a.map(i=>d`<span class="spec-chip" data-tone=${i.tone}>${i.label} ${i.count}</span>`)}`}#L(t){const e=d`<div class="spec-claims">
1164
- ${U(t.claims,a=>a.id,a=>this.#P(a))}
1164
+ ${U(t.claims,a=>a.id,a=>this.#T(a))}
1165
1165
  </div>`,s=t.target;return s===null?e:d`<section class="target-group" data-target=${s.id}>
1166
- <header class="target-head" data-dpk-target=${this.#k({kind:"target",target:s.id})}>
1167
- <span class="target-label">${this.#l.target}</span>
1166
+ <header class="target-head" data-dpk-target=${this.#f({kind:"target",target:s.id})}>
1167
+ <span class="target-label">${this.#d.target}</span>
1168
1168
  <h3 class="target-name">${s.name}</h3>
1169
1169
  ${s.code===null?h:d`<code class="target-code">${s.code}</code>`}
1170
1170
  </header>
1171
- ${s.summary===null?h:d`<p class="target-summary">${this.#$(s.summary)}</p>`}
1172
- ${t.claims.length===0?d`<p class="spec-empty">${this.#l.noClaims}</p>`:e}
1173
- </section>`}#P(t){const e=this.#l,s=Wt(e,t.assurance),a=this.#i.has(t.id),i=this.#T({kind:"assurance",claim:t.id}),o=ns(t.id);return d`
1171
+ ${s.summary===null?h:d`<p class="target-summary">${this.#M(s.summary)}</p>`}
1172
+ ${t.claims.length===0?d`<p class="spec-empty">${this.#d.noClaims}</p>`:e}
1173
+ </section>`}#T(t){const e=this.#d,s=te(e,t.assurance),a=this.#i.has(t.id),i=this.#E({kind:"assurance",claim:t.id}),r=ks(t.id);return d`
1174
1174
  <article class="claim" data-claim=${t.id} data-tone=${s.tone}>
1175
1175
  <div
1176
1176
  class="claim-head"
1177
- data-dpk-target=${this.#k({kind:"claim",claim:t.id})}
1178
- @click=${r=>this.#z(r,t.id)}
1177
+ data-dpk-target=${this.#f({kind:"claim",claim:t.id})}
1178
+ @click=${o=>this.#C(o,t.id)}
1179
1179
  >
1180
1180
  <button
1181
1181
  type="button"
1182
1182
  class="dpk-icon-btn claim-toggle"
1183
1183
  aria-expanded=${a?"true":"false"}
1184
- aria-controls=${a?o:h}
1184
+ aria-controls=${a?r:h}
1185
1185
  aria-label=${a?e.hideDetails:e.showDetails}
1186
- @click=${()=>this.#g(t.id)}
1186
+ @click=${()=>this.#h(t.id)}
1187
1187
  >
1188
- ${me()}
1188
+ ${Se()}
1189
1189
  </button>
1190
- <h4 class="claim-statement">${this.#$(t.statement)}</h4>
1190
+ <h4 class="claim-statement">${this.#M(t.statement)}</h4>
1191
1191
  <button
1192
1192
  type="button"
1193
1193
  class="assurance-badge"
@@ -1201,51 +1201,51 @@ ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No da
1201
1201
  ${s.label}
1202
1202
  </button>
1203
1203
  </div>
1204
- ${a?this.#I(t,o):h}
1204
+ ${a?this.#D(t,r):h}
1205
1205
  </article>
1206
- `}#I(t,e){const s=this.#l,a=Wt(s,t.assurance);return d`<div class="claim-body" id=${e}>
1206
+ `}#D(t,e){const s=this.#d,a=te(s,t.assurance);return d`<div class="claim-body" id=${e}>
1207
1207
  <dl class="claim-parts">
1208
- ${t.subjects.length===0?h:this.#C("subjects",s.subjects,t,t.subjects)}
1208
+ ${t.subjects.length===0?h:this.#A("subjects",s.subjects,t,t.subjects)}
1209
1209
  ${t.premises.length===0?d`<div class="claim-part" data-part="premises">
1210
1210
  <dt>${s.premises}</dt>
1211
1211
  <dd><p class="claim-none">${s.noPremises}</p></dd>
1212
- </div>`:this.#C("premises",s.premises,t,t.premises)}
1213
- ${this.#C("conclusions",s.conclusions,t,t.conclusions)}
1212
+ </div>`:this.#A("premises",s.premises,t,t.premises)}
1213
+ ${this.#A("conclusions",s.conclusions,t,t.conclusions)}
1214
1214
  </dl>
1215
1215
  ${a.itemsLabel===null?h:d`<div class="assurance" data-tone=${a.tone}>
1216
1216
  <p class="assurance-label">${a.itemsLabel}</p>
1217
1217
  <ul>
1218
- ${a.items.map(i=>d`<li>${this.#$(i)}</li>`)}
1218
+ ${a.items.map(i=>d`<li>${this.#M(i)}</li>`)}
1219
1219
  </ul>
1220
1220
  </div>`}
1221
1221
  ${t.examples.length===0?h:d`<section class="claim-aside" data-part="examples">
1222
1222
  <h5>${s.examples}</h5>
1223
- ${this.#E(t,t.examples)}
1223
+ ${this.#P(t,t.examples)}
1224
1224
  </section>`}
1225
1225
  ${t.notClaimed.length===0?h:d`<section class="claim-aside" data-part="not-claimed">
1226
1226
  <h5>${s.notClaimed}</h5>
1227
- ${this.#E(t,t.notClaimed)}
1227
+ ${this.#P(t,t.notClaimed)}
1228
1228
  </section>`}
1229
- ${this.#R(t)}
1230
- </div>`}#C(t,e,s,a){return d`<div class="claim-part" data-part=${t}>
1229
+ ${this.#O(t)}
1230
+ </div>`}#A(t,e,s,a){return d`<div class="claim-part" data-part=${t}>
1231
1231
  <dt>${e}</dt>
1232
- <dd>${this.#E(s,a)}</dd>
1233
- </div>`}#E(t,e){return d`<ul class="clauses">
1232
+ <dd>${this.#P(s,a)}</dd>
1233
+ </div>`}#P(t,e){return d`<ul class="clauses">
1234
1234
  ${U(e,s=>s.id,s=>d`<li
1235
1235
  class="clause"
1236
1236
  data-clause=${s.id}
1237
- data-dpk-target=${this.#k({kind:"clause",claim:t.id,clause:s.id})}
1237
+ data-dpk-target=${this.#f({kind:"clause",claim:t.id,clause:s.id})}
1238
1238
  >
1239
- <span class="clause-text">${this.#$(s.text)}</span>
1239
+ <span class="clause-text">${this.#M(s.text)}</span>
1240
1240
  </li>`)}
1241
- </ul>`}#R(t){const e=this.#l,s=t.terms.flatMap(a=>this.#t.get(a)??[]);return s.length===0&&t.source===null?h:d`<footer class="claim-foot">
1242
- ${s.length===0?h:d`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(a=>this.#D("term-chip",a.id,a.name))}`}
1241
+ </ul>`}#O(t){const e=this.#d,s=t.terms.flatMap(a=>this.#t.get(a)??[]);return s.length===0&&t.source===null?h:d`<footer class="claim-foot">
1242
+ ${s.length===0?h:d`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(a=>this.#$("term-chip",a.id,a.name))}`}
1243
1243
  ${t.source===null?h:d`<span class="claim-source"
1244
1244
  >${e.source}: ${t.source.tool===null?h:d`${t.source.tool} · `}<code
1245
1245
  >${t.source.ref}</code
1246
1246
  ></span
1247
1247
  >`}
1248
- </footer>`}#$(t){return d`${t.map(e=>e.kind==="text"?e.text:this.#D("term",e.id,e.label))}`}#O(t){return d`${t.map(e=>e.kind==="text"?e.text:d`<span class="term-static">${e.label}</span>`)}`}#D(t,e,s){const a=this.#T({kind:"term",term:e});return d`<button
1248
+ </footer>`}#M(t){return d`${t.map(e=>e.kind==="text"?e.text:this.#$("term",e.id,e.label))}`}#R(t){return d`${t.map(e=>e.kind==="text"?e.text:d`<span class="term-static">${e.label}</span>`)}`}#$(t,e,s){const a=this.#E({kind:"term",term:e});return d`<button
1249
1249
  type="button"
1250
1250
  class=${t}
1251
1251
  data-term=${e}
@@ -1256,7 +1256,7 @@ ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No da
1256
1256
  @click=${a.show}
1257
1257
  >
1258
1258
  ${s}
1259
- </button>`}#U(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#q(t);return e===null?h:d`<div
1259
+ </button>`}#q(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#I(t);return e===null?h:d`<div
1260
1260
  id="spec-tip"
1261
1261
  class="spec-tip"
1262
1262
  role="tooltip"
@@ -1265,10 +1265,10 @@ ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No da
1265
1265
  >
1266
1266
  <p class="tip-title">${e.title}</p>
1267
1267
  <p class="tip-body">${e.body}</p>
1268
- </div>`}#q(t){if(t.kind==="term"){const a=this.#t.get(t.term);return a===void 0?null:{title:a.name,body:this.#O(a.meaning)}}const e=this.#a?.claims.find(a=>a.id===t.claim);if(e===void 0)return null;const s=Wt(this.#l,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const is=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",as)},si=D({en:{heading:"Diff",empty:"No changes.",dataError:"The diff could not be read:",summary:n=>`${n} ${n===1?"file":"files"} changed`,unified:"Unified",split:"Split",viewLabel:"Layout",added:"Added",deleted:"Deleted",renamed:"Renamed",copied:"Copied",modified:"Modified",binary:"Binary file not shown.",noContentChange:"No content changes.",modeChanged:(n,t)=>`File mode changed from ${n} to ${t}.`,noNewline:"No newline at end of file",collapse:n=>`Collapse ${n}`,expand:n=>`Expand ${n}`,commentOn:n=>`Comment on ${n}`,addOn:n=>`Comment on or suggest a change to ${n}`,composerTabs:"Comment or suggestion",comment:"Comment",addComment:"Add",threadOn:n=>`Comments on ${n}`,reply:"Reply",replyPlaceholder:"Reply\u2026",suggestChange:"Suggest change",suggestion:"Suggested change",suggest:"Suggest",cancel:"Cancel",suggestionLabel:"Suggested text",deleteLine:"Delete this line",unrecorded:"Could not record it. Place this inside a dpk-view-* element.",sendFailed:"Could not send. Place this inside a dpk-view-* element.",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`Suggested change: ${n}:${t}`,deletedLine:n=>`${n} (deleted)`},ja:{heading:"\u5DEE\u5206",empty:"\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u5DEE\u5206\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F:",summary:n=>`${n} \u30D5\u30A1\u30A4\u30EB\u3092\u5909\u66F4`,unified:"\u7D71\u5408",split:"\u5DE6\u53F3",viewLabel:"\u30EC\u30A4\u30A2\u30A6\u30C8",added:"\u8FFD\u52A0",deleted:"\u524A\u9664",renamed:"\u540D\u524D\u5909\u66F4",copied:"\u30B3\u30D4\u30FC",modified:"\u5909\u66F4",binary:"\u30D0\u30A4\u30CA\u30EA\u30D5\u30A1\u30A4\u30EB\u306F\u8868\u793A\u3057\u307E\u305B\u3093\u3002",noContentChange:"\u5185\u5BB9\u306E\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",modeChanged:(n,t)=>`\u30D5\u30A1\u30A4\u30EB\u30E2\u30FC\u30C9\u3092 ${n} \u304B\u3089 ${t} \u306B\u5909\u66F4\u3002`,noNewline:"\u30D5\u30A1\u30A4\u30EB\u672B\u5C3E\u306B\u6539\u884C\u304C\u3042\u308A\u307E\u305B\u3093",collapse:n=>`${n} \u3092\u6298\u308A\u305F\u305F\u3080`,expand:n=>`${n} \u3092\u5C55\u958B`,commentOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`,addOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8\u30FB\u5909\u66F4\u3092\u63D0\u6848`,composerTabs:"\u30B3\u30E1\u30F3\u30C8\u304B\u5909\u66F4\u306E\u63D0\u6848",comment:"\u30B3\u30E1\u30F3\u30C8",addComment:"\u8FFD\u52A0",threadOn:n=>`${n} \u3078\u306E\u30B3\u30E1\u30F3\u30C8`,reply:"\u8FD4\u4FE1",replyPlaceholder:"\u8FD4\u4FE1\u3059\u308B\u2026",suggestChange:"\u5909\u66F4\u3092\u63D0\u6848",suggestion:"\u5909\u66F4\u306E\u63D0\u6848",suggest:"\u63D0\u6848",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",suggestionLabel:"\u63D0\u6848\u3059\u308B\u30C6\u30AD\u30B9\u30C8",deleteLine:"\u3053\u306E\u884C\u3092\u524A\u9664",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",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",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`\u5909\u66F4\u306E\u63D0\u6848: ${n}:${t}`,deletedLine:n=>`${n}\uFF08\u524A\u9664\u884C\uFF09`}}),rs=()=>({files:[]}),lt=n=>n.newLine===null?`L${n.oldLine??0}`:`R${n.newLine}`,ni=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/,ai=n=>{const t=n.replace(/\r\n?/g,`
1268
+ </div>`}#I(t){if(t.kind==="term"){const a=this.#t.get(t.term);return a===void 0?null:{title:a.name,body:this.#R(a.meaning)}}const e=this.#a?.claims.find(a=>a.id===t.claim);if(e===void 0)return null;const s=te(this.#d,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const xs=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",vs)},Ni=D({en:{heading:"Diff",empty:"No changes.",dataError:"The diff could not be read:",summary:n=>`${n} ${n===1?"file":"files"} changed`,unified:"Unified",split:"Split",viewLabel:"Layout",added:"Added",deleted:"Deleted",renamed:"Renamed",copied:"Copied",modified:"Modified",binary:"Binary file not shown.",noContentChange:"No content changes.",modeChanged:(n,t)=>`File mode changed from ${n} to ${t}.`,noNewline:"No newline at end of file",collapse:n=>`Collapse ${n}`,expand:n=>`Expand ${n}`,commentOn:n=>`Comment on ${n}`,addOn:n=>`Comment on or suggest a change to ${n}`,composerTabs:"Comment or suggestion",comment:"Comment",addComment:"Add",threadOn:n=>`Comments on ${n}`,reply:"Reply",replyPlaceholder:"Reply\u2026",suggestChange:"Suggest change",suggestion:"Suggested change",suggest:"Suggest",cancel:"Cancel",suggestionLabel:"Suggested text",deleteLine:"Delete this line",unrecorded:"Could not record it. Place this inside a dpk-view-* element.",sendFailed:"Could not send. Place this inside a dpk-view-* element.",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`Suggested change: ${n}:${t}`,deletedLine:n=>`${n} (deleted)`},ja:{heading:"\u5DEE\u5206",empty:"\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u5DEE\u5206\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F:",summary:n=>`${n} \u30D5\u30A1\u30A4\u30EB\u3092\u5909\u66F4`,unified:"\u7D71\u5408",split:"\u5DE6\u53F3",viewLabel:"\u30EC\u30A4\u30A2\u30A6\u30C8",added:"\u8FFD\u52A0",deleted:"\u524A\u9664",renamed:"\u540D\u524D\u5909\u66F4",copied:"\u30B3\u30D4\u30FC",modified:"\u5909\u66F4",binary:"\u30D0\u30A4\u30CA\u30EA\u30D5\u30A1\u30A4\u30EB\u306F\u8868\u793A\u3057\u307E\u305B\u3093\u3002",noContentChange:"\u5185\u5BB9\u306E\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",modeChanged:(n,t)=>`\u30D5\u30A1\u30A4\u30EB\u30E2\u30FC\u30C9\u3092 ${n} \u304B\u3089 ${t} \u306B\u5909\u66F4\u3002`,noNewline:"\u30D5\u30A1\u30A4\u30EB\u672B\u5C3E\u306B\u6539\u884C\u304C\u3042\u308A\u307E\u305B\u3093",collapse:n=>`${n} \u3092\u6298\u308A\u305F\u305F\u3080`,expand:n=>`${n} \u3092\u5C55\u958B`,commentOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`,addOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8\u30FB\u5909\u66F4\u3092\u63D0\u6848`,composerTabs:"\u30B3\u30E1\u30F3\u30C8\u304B\u5909\u66F4\u306E\u63D0\u6848",comment:"\u30B3\u30E1\u30F3\u30C8",addComment:"\u8FFD\u52A0",threadOn:n=>`${n} \u3078\u306E\u30B3\u30E1\u30F3\u30C8`,reply:"\u8FD4\u4FE1",replyPlaceholder:"\u8FD4\u4FE1\u3059\u308B\u2026",suggestChange:"\u5909\u66F4\u3092\u63D0\u6848",suggestion:"\u5909\u66F4\u306E\u63D0\u6848",suggest:"\u63D0\u6848",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",suggestionLabel:"\u63D0\u6848\u3059\u308B\u30C6\u30AD\u30B9\u30C8",deleteLine:"\u3053\u306E\u884C\u3092\u524A\u9664",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",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",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`\u5909\u66F4\u306E\u63D0\u6848: ${n}:${t}`,deletedLine:n=>`${n}\uFF08\u524A\u9664\u884C\uFF09`}}),ys=()=>({files:[]}),ft=n=>n.newLine===null?`L${n.oldLine??0}`:`R${n.newLine}`,ji=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/,Fi=n=>{const t=n.replace(/\r\n?/g,`
1269
1269
  `).replace(/<\\\/script/gi,"<\/script").split(`
1270
- `),e=t.findIndex(o=>o.trim()!=="");if(e===-1)return[];let s=t.length-1;for(;s>e&&(t[s]??"").trim()==="";)s-=1;const a=t.slice(e,s+1),i=/^[ \t]*/.exec(a[0]??"")?.[0]??"";return i===""?a:a.map(o=>o.startsWith(i)?o.slice(i.length):o)},os=n=>{const t=[],e=new TextEncoder,s={n:`
1271
- `,t:" ",'"':'"',"\\":"\\",a:"\x07",b:"\b"};for(let a=1;a<n.length-1;a+=1){const i=n.charAt(a);if(i!=="\\"){t.push(...e.encode(i));continue}const o=/^[0-7]{3}/.exec(n.slice(a+1))?.[0];if(o!==void 0){t.push(Number.parseInt(o,8)),a+=3;continue}const r=n.charAt(a+1);t.push(...e.encode(s[r]??r)),a+=1}return new TextDecoder().decode(new Uint8Array(t))},dt=n=>{const t=n.trimEnd();if(t.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(t)?.[0];if(s!==void 0)return os(s)}const e=t.indexOf(" ");return e===-1?t:t.slice(0,e)},ct=(n,t)=>n.startsWith(t)?n.slice(t.length):n,ls=(n,t)=>{const e=dt(n);return e==="/dev/null"?null:ct(e,t)},ii=n=>{if(n.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(n)?.[0];if(s===void 0)return[null,null];const a=n.slice(s.length).trimStart();return[ct(os(s),"a/"),ct(dt(a),"b/")]}const t=(n.length-1)/2;if(Number.isInteger(t)&&n.charAt(t)===" "){const s=n.slice(0,t),a=n.slice(t+1);if(s.startsWith("a/")&&a.startsWith("b/")&&s.slice(2)===a.slice(2))return[s.slice(2),a.slice(2)]}const e=n.indexOf(" b/");return e===-1?[null,null]:[ct(n.slice(0,e),"a/"),ct(dt(n.slice(e+1)),"b/")]},ds=()=>({headerOld:null,headerNew:null,oldPath:void 0,newPath:void 0,status:null,binary:!1,oldMode:null,newMode:null,hunks:[],sawOld:!1,sawNew:!1,skipping:!1}),ri=n=>{const t=n.oldPath===void 0?n.headerOld:n.oldPath,e=n.newPath===void 0?n.headerNew:n.newPath,s=n.status??(t===null&&e!==null?"added":e===null?"deleted":"modified"),a=(s==="deleted"?t:e)??t??e;if(a===null)throw new Error("a file in the diff has no path");const i=n.hunks.map(r=>({oldStart:r.oldStart,oldCount:r.oldCount,newStart:r.newStart,newCount:r.newCount,section:r.section,lines:r.lines})),o=i.flatMap(r=>r.lines);return{path:a,oldPath:s==="added"?null:t,newPath:s==="deleted"?null:e,status:s,binary:n.binary,oldMode:n.oldMode,newMode:n.newMode,hunks:i,additions:o.filter(r=>r.kind==="add").length,deletions:o.filter(r=>r.kind==="del").length}},oi=(n,t)=>{const e=ni.exec(n);if(e===null)throw new Error(`line ${t}: unreadable hunk header "${n}"`);const[,s="0",a="1",i="0",o="1",r=""]=e,l={oldCount:Number(a),newCount:Number(o)};return{oldStart:Number(s),newStart:Number(i),...l,section:r.trim(),lines:[],oldLeft:l.oldCount,newLeft:l.newCount}},li=(n,t)=>{const e=t.charAt(0),s=e===" "||t===""?"context":e==="+"?"add":e==="-"?"del":null;if(s===null)return!1;const a=s==="add"?null:n.oldStart+(n.oldCount-n.oldLeft),i=s==="del"?null:n.newStart+(n.newCount-n.newLeft);return s!=="add"&&(n.oldLeft-=1),s!=="del"&&(n.newLeft-=1),n.lines.push({kind:s,text:t.slice(1),oldLine:a,newLine:i,noNewline:!1}),!0},cs=n=>{const t=n?.lines.at(-1);n!==void 0&&t!==void 0&&(n.lines[n.lines.length-1]={...t,noNewline:!0})},ps=n=>{const t=ai(n),e=[];let s=null,a=null;const i=()=>{s!==null&&e.push(ri(s)),s=null,a=null};for(const[r,l]of t.entries()){const u=r+1,c=a;if(c!==null){if(c.oldLeft>0||c.newLeft>0){if(l.startsWith("\\")){cs(c);continue}if(li(c,l))continue}else if(l.startsWith("\\")){cs(c);continue}a=null}if(l.startsWith("diff --git ")){i();const k=ds();[k.headerOld,k.headerNew]=ii(l.slice(11)),s=k;continue}if(l.startsWith("diff --cc ")||l.startsWith("diff --combined "))throw new Error(`line ${u}: combined (merge) diffs are not supported`);if(l.startsWith("--- ")&&(t[r+1]??"").startsWith("+++ ")){const k=s;(k===null||k.hunks.length>0||k.sawOld)&&(i(),s=ds()),s!==null&&(s.oldPath=ls(l.slice(4),"a/"),s.sawOld=!0);continue}const m=s;if(!(m===null||m.skipping)){if(l.startsWith("+++ ")&&m.hunks.length===0&&!m.sawNew){m.newPath=ls(l.slice(4),"b/"),m.sawNew=!0;continue}if(l.startsWith("@@ ")){const k=oi(l,u);m.hunks.push(k),a=k;continue}m.hunks.length>0||di(m,l)}}if(i(),e.length===0&&t.length>0)throw new Error("no file diff found (expected the output of git diff)");const o=new Set;for(const r of e){if(o.has(r.path))throw new Error(`the diff has ${r.path} twice`);o.add(r.path)}return{files:e}},di=(n,t)=>{const e=r=>t.startsWith(r)?t.slice(r.length):null,s=e("new file mode ");if(s!==null){n.status="added",n.newMode=s.trim();return}const a=e("deleted file mode ");if(a!==null){n.status="deleted",n.oldMode=a.trim();return}const i=e("old mode ");if(i!==null){n.oldMode=i.trim();return}const o=e("new mode ");if(o!==null){n.newMode=o.trim();return}for(const[r,l,u]of[["rename from ","old","renamed"],["rename to ","new","renamed"],["copy from ","old","copied"],["copy to ","new","copied"]]){const c=e(r);if(c!==null){n.status=u,l==="old"?n.oldPath=dt(c):n.newPath=dt(c);return}}if(t.startsWith("Binary files ")&&t.endsWith(" differ")){n.binary=!0;return}t==="GIT binary patch"&&(n.binary=!0,n.skipping=!0)},b=(n,t,e)=>e===void 0?{kind:n,pattern:t}:{kind:n,pattern:t,next:e},X=b(null,/\s+/y),Bt=b("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),wt=b("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),ci=["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"],pi=["action","all","and","any","as","assume","bool","Bool","const","def","else","export","false","from","if","iff","implies","import","int","Int","match","module","Nat","nondet","not","or","pure","run","str","temporal","true","type","val","var"],hi={js:{start:"code",rules:{code:[X,b("comment",/\/\/[^\n]*/y),wt,b("string",/`(?:\\[\s\S]|[^\\`])*`?/y),Bt,b("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),b("keyword",new RegExp(`(?:${ci.join("|")})(?![\\w$])`,"y")),b("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),b(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[b("comment",/<!--[\s\S]*?(?:-->|$)/y),b("keyword",/&#?\w+;/y),b("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),b(null,/[^<&]+/y)],tag:[X,b("tag",/\/?>/y,"text"),b("punct",/=/y),b("string",/"[^"]*"?|'[^']*'?/y),b("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[X,wt,Bt,b("keyword",/@[\w-]+/y),b("punct",/[{}]/y),b("tag",/[^{};]+(?=\{)/y),b("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),b("number",/#[\da-f]{3,8}(?![\w-])/iy),b(null,/-?[A-Za-z_][\w-]*/y),b("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[X,b("comment",/\/\/[^\n]*/y),wt,b("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),b("string",/"(?:\\.|[^\\"\n])*"?/y),b("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),b("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[X,b("comment",/(?<!\S)#[^\n]*/y),Bt,b("keyword",/\$\{[^}\n]*\}?|\$\w+/y),b("attr",/(?<!\S)--?[\w-]+/y),b(null,/[^\s"'$#]+/y)]}},quint:{start:"code",rules:{code:[X,b("comment",/\/\/[^\n]*/y),wt,b("string",/"(?:\\.|[^\\"\n])*"?/y),b("number",/0x[\da-f_]+|\d[\d_]*/iy),b("keyword",new RegExp(`(?:${pi.join("|")})(?!\\w)`,"y")),b("function",/[A-Za-z_]\w*(?=\s*\()/y),b(null,/[A-Za-z_]\w*/y)]}}},ui={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",quint:"quint",qnt:"quint"},mi=n=>n===null?null:ui[n.trim().toLowerCase()]??null,hs=(n,t,e)=>{const s=n.at(-1);t===null&&s!==void 0&&s.kind===null?n[n.length-1]={kind:t,text:s.text+e}:n.push({kind:t,text:e})},Gt=(n,t)=>{const e=mi(t);if(e===null)return n===""?[]:[{kind:null,text:n}];const{start:s,rules:a}=hi[e],i=[];let o=s,r=0;for(;r<n.length;){const l=(a[o]??[]).find(u=>(u.pattern.lastIndex=r,u.pattern.test(n)&&u.pattern.lastIndex>r));if(l===void 0){hs(i,null,n.charAt(r)),r+=1;continue}hs(i,l.kind,n.slice(r,l.pattern.lastIndex)),r=l.pattern.lastIndex,o=l.next??o}return i},gi=n=>n.kind==="file"?["file",n.path]:["line",n.path,n.line],us=n=>{const t=n.slice(n.lastIndexOf("/")+1),e=t.lastIndexOf(".");return e<=0?null:t.slice(e+1)},$t=/[\p{L}\p{N}_$]/u,fi=(n,t)=>{let e=t;for(;e>0&&$t.test(n.charAt(e-1))&&$t.test(n.charAt(e));)e-=1;return e},bi=(n,t)=>{let e=t;for(;e<n.length&&$t.test(n.charAt(e))&&$t.test(n.charAt(e-1));)e+=1;return e},ki=(n,t)=>{if(n===t)return null;const e=Math.min(n.length,t.length);let s=0;for(;s<e&&n.charAt(s)===t.charAt(s);)s+=1;let a=0;for(;a<e-s&&n.charAt(n.length-1-a)===t.charAt(t.length-1-a);)a+=1;if((n.slice(0,s).trim().length+n.slice(n.length-a).trim().length)*4<Math.max(n.trim().length,t.trim().length))return null;const o=r=>{const l=fi(r,s),u=bi(r,r.length-a);return[l,Math.max(l,u)]};return{before:o(n),after:o(t)}},vi=(n,t,e)=>{const s=[];let a=0;for(const i of Gt(n,t)){const o=a+i.text.length,r=e===null?[]:e.filter(u=>u>a&&u<o);let l=a;for(const u of[...r,o]){const c=i.text.slice(l-a,u-a),m=e!==null&&l>=e[0]&&u<=e[1]&&e[0]<e[1];c!==""&&s.push({kind:i.kind,text:c,changed:m}),l=u}a=o}return s},ms=n=>{const t=new Map;for(const e of n)if(e.kind!=="context")for(const[s,a]of e.dels.entries()){const i=e.adds[s];if(i===void 0)break;const o=ki(a.text,i.text);o!==null&&(t.set(a,o.before),t.set(i,o.after))}return t},gs=n=>{const t=[];let e=null;for(const s of n.lines){if(s.kind==="context"){e=null,t.push({kind:"context",line:s});continue}(e===null||s.kind==="del"&&e.adds.length>0)&&(e={kind:"change",dels:[],adds:[]},t.push(e)),(s.kind==="del"?e.dels:e.adds).push(s)}return t},pt=(n,t,e,s=!0)=>({line:n,id:lt(n),segments:vi(n.text,t,e.get(n)??null),target:s}),xi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=ms(gs(e));return[{kind:"hunk",hunk:e},...e.lines.map(a=>({kind:"line",cell:pt(a,t,s)}))]})},yi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=gs(e),a=ms(s),i=[{kind:"hunk",hunk:e}];for(const o of s){if(o.kind==="context"){i.push({kind:"pair",left:pt(o.line,t,a,!1),right:pt(o.line,t,a)});continue}for(let r=0;r<Math.max(o.dels.length,o.adds.length);r+=1){const l=o.dels[r],u=o.adds[r];i.push({kind:"pair",left:l===void 0?null:pt(l,t,a),right:u===void 0?null:pt(u,t,a)})}}return i})},fs=40,wi=n=>{const t=n.trim().replace(/\s+/g," ");return t.length>fs?`${t.slice(0,fs-1)}\u2026`:t},$i=(n,t)=>t.startsWith("R")?t.slice(1):n.deletedLine(`-${t.slice(1)}`),bs=(n,t,e)=>n.lineLabel(t,$i(n,lt(e)),wi(e.text)),Ci=(n,t)=>t.files.flatMap(e=>[{target:{kind:"file",path:e.path},label:e.path},...e.hunks.flatMap(s=>s.lines.map(a=>({target:{kind:"line",path:e.path,line:lt(a)},label:bs(n,e.path,a)})))]),Si=n=>({files:n.files.length,additions:n.files.reduce((t,e)=>t+e.additions,0),deletions:n.files.reduce((t,e)=>t+e.deletions,0)}),Ei=[T,B,gt,M`
1270
+ `),e=t.findIndex(r=>r.trim()!=="");if(e===-1)return[];let s=t.length-1;for(;s>e&&(t[s]??"").trim()==="";)s-=1;const a=t.slice(e,s+1),i=/^[ \t]*/.exec(a[0]??"")?.[0]??"";return i===""?a:a.map(r=>r.startsWith(i)?r.slice(i.length):r)},ws=n=>{const t=[],e=new TextEncoder,s={n:`
1271
+ `,t:" ",'"':'"',"\\":"\\",a:"\x07",b:"\b"};for(let a=1;a<n.length-1;a+=1){const i=n.charAt(a);if(i!=="\\"){t.push(...e.encode(i));continue}const r=/^[0-7]{3}/.exec(n.slice(a+1))?.[0];if(r!==void 0){t.push(Number.parseInt(r,8)),a+=3;continue}const o=n.charAt(a+1);t.push(...e.encode(s[o]??o)),a+=1}return new TextDecoder().decode(new Uint8Array(t))},bt=n=>{const t=n.trimEnd();if(t.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(t)?.[0];if(s!==void 0)return ws(s)}const e=t.indexOf(" ");return e===-1?t:t.slice(0,e)},kt=(n,t)=>n.startsWith(t)?n.slice(t.length):n,$s=(n,t)=>{const e=bt(n);return e==="/dev/null"?null:kt(e,t)},Hi=n=>{if(n.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(n)?.[0];if(s===void 0)return[null,null];const a=n.slice(s.length).trimStart();return[kt(ws(s),"a/"),kt(bt(a),"b/")]}const t=(n.length-1)/2;if(Number.isInteger(t)&&n.charAt(t)===" "){const s=n.slice(0,t),a=n.slice(t+1);if(s.startsWith("a/")&&a.startsWith("b/")&&s.slice(2)===a.slice(2))return[s.slice(2),a.slice(2)]}const e=n.indexOf(" b/");return e===-1?[null,null]:[kt(n.slice(0,e),"a/"),kt(bt(n.slice(e+1)),"b/")]},Cs=()=>({headerOld:null,headerNew:null,oldPath:void 0,newPath:void 0,status:null,binary:!1,oldMode:null,newMode:null,hunks:[],sawOld:!1,sawNew:!1,skipping:!1}),Wi=n=>{const t=n.oldPath===void 0?n.headerOld:n.oldPath,e=n.newPath===void 0?n.headerNew:n.newPath,s=n.status??(t===null&&e!==null?"added":e===null?"deleted":"modified"),a=(s==="deleted"?t:e)??t??e;if(a===null)throw new Error("a file in the diff has no path");const i=n.hunks.map(o=>({oldStart:o.oldStart,oldCount:o.oldCount,newStart:o.newStart,newCount:o.newCount,section:o.section,lines:o.lines})),r=i.flatMap(o=>o.lines);return{path:a,oldPath:s==="added"?null:t,newPath:s==="deleted"?null:e,status:s,binary:n.binary,oldMode:n.oldMode,newMode:n.newMode,hunks:i,additions:r.filter(o=>o.kind==="add").length,deletions:r.filter(o=>o.kind==="del").length}},Bi=(n,t)=>{const e=ji.exec(n);if(e===null)throw new Error(`line ${t}: unreadable hunk header "${n}"`);const[,s="0",a="1",i="0",r="1",o=""]=e,l={oldCount:Number(a),newCount:Number(r)};return{oldStart:Number(s),newStart:Number(i),...l,section:o.trim(),lines:[],oldLeft:l.oldCount,newLeft:l.newCount}},Ki=(n,t)=>{const e=t.charAt(0),s=e===" "||t===""?"context":e==="+"?"add":e==="-"?"del":null;if(s===null)return!1;const a=s==="add"?null:n.oldStart+(n.oldCount-n.oldLeft),i=s==="del"?null:n.newStart+(n.newCount-n.newLeft);return s!=="add"&&(n.oldLeft-=1),s!=="del"&&(n.newLeft-=1),n.lines.push({kind:s,text:t.slice(1),oldLine:a,newLine:i,noNewline:!1}),!0},Ss=n=>{const t=n?.lines.at(-1);n!==void 0&&t!==void 0&&(n.lines[n.lines.length-1]={...t,noNewline:!0})},Es=n=>{const t=Fi(n),e=[];let s=null,a=null;const i=()=>{s!==null&&e.push(Wi(s)),s=null,a=null};for(const[o,l]of t.entries()){const c=o+1,p=a;if(p!==null){if(p.oldLeft>0||p.newLeft>0){if(l.startsWith("\\")){Ss(p);continue}if(Ki(p,l))continue}else if(l.startsWith("\\")){Ss(p);continue}a=null}if(l.startsWith("diff --git ")){i();const f=Cs();[f.headerOld,f.headerNew]=Hi(l.slice(11)),s=f;continue}if(l.startsWith("diff --cc ")||l.startsWith("diff --combined "))throw new Error(`line ${c}: combined (merge) diffs are not supported`);if(l.startsWith("--- ")&&(t[o+1]??"").startsWith("+++ ")){const f=s;(f===null||f.hunks.length>0||f.sawOld)&&(i(),s=Cs()),s!==null&&(s.oldPath=$s(l.slice(4),"a/"),s.sawOld=!0);continue}const m=s;if(!(m===null||m.skipping)){if(l.startsWith("+++ ")&&m.hunks.length===0&&!m.sawNew){m.newPath=$s(l.slice(4),"b/"),m.sawNew=!0;continue}if(l.startsWith("@@ ")){const f=Bi(l,c);m.hunks.push(f),a=f;continue}m.hunks.length>0||Vi(m,l)}}if(i(),e.length===0&&t.length>0)throw new Error("no file diff found (expected the output of git diff)");const r=new Set;for(const o of e){if(r.has(o.path))throw new Error(`the diff has ${o.path} twice`);r.add(o.path)}return{files:e}},Vi=(n,t)=>{const e=o=>t.startsWith(o)?t.slice(o.length):null,s=e("new file mode ");if(s!==null){n.status="added",n.newMode=s.trim();return}const a=e("deleted file mode ");if(a!==null){n.status="deleted",n.oldMode=a.trim();return}const i=e("old mode ");if(i!==null){n.oldMode=i.trim();return}const r=e("new mode ");if(r!==null){n.newMode=r.trim();return}for(const[o,l,c]of[["rename from ","old","renamed"],["rename to ","new","renamed"],["copy from ","old","copied"],["copy to ","new","copied"]]){const p=e(o);if(p!==null){n.status=c,l==="old"?n.oldPath=bt(p):n.newPath=bt(p);return}}if(t.startsWith("Binary files ")&&t.endsWith(" differ")){n.binary=!0;return}t==="GIT binary patch"&&(n.binary=!0,n.skipping=!0)},v=(n,t,e)=>e===void 0?{kind:n,pattern:t}:{kind:n,pattern:t,next:e},ot=v(null,/\s+/y),ee=v("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),zt=v("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),Gi=["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"],Ji=["action","all","and","any","as","assume","bool","Bool","const","def","else","export","false","from","if","iff","implies","import","int","Int","match","module","Nat","nondet","not","or","pure","run","str","temporal","true","type","val","var"],Xi={js:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),zt,v("string",/`(?:\\[\s\S]|[^\\`])*`?/y),ee,v("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),v("keyword",new RegExp(`(?:${Gi.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,zt,ee,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),zt,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),ee,v("keyword",/\$\{[^}\n]*\}?|\$\w+/y),v("attr",/(?<!\S)--?[\w-]+/y),v(null,/[^\s"'$#]+/y)]}},quint:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),zt,v("string",/"(?:\\.|[^\\"\n])*"?/y),v("number",/0x[\da-f_]+|\d[\d_]*/iy),v("keyword",new RegExp(`(?:${Ji.join("|")})(?!\\w)`,"y")),v("function",/[A-Za-z_]\w*(?=\s*\()/y),v(null,/[A-Za-z_]\w*/y)]}}},Yi={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",quint:"quint",qnt:"quint"},Zi=n=>n===null?null:Yi[n.trim().toLowerCase()]??null,Ts=(n,t,e)=>{const s=n.at(-1);t===null&&s!==void 0&&s.kind===null?n[n.length-1]={kind:t,text:s.text+e}:n.push({kind:t,text:e})},se=(n,t)=>{const e=Zi(t);if(e===null)return n===""?[]:[{kind:null,text:n}];const{start:s,rules:a}=Xi[e],i=[];let r=s,o=0;for(;o<n.length;){const l=(a[r]??[]).find(c=>(c.pattern.lastIndex=o,c.pattern.test(n)&&c.pattern.lastIndex>o));if(l===void 0){Ts(i,null,n.charAt(o)),o+=1;continue}Ts(i,l.kind,n.slice(o,l.pattern.lastIndex)),o=l.pattern.lastIndex,r=l.next??r}return i},Qi=n=>n.kind==="file"?["file",n.path]:["line",n.path,n.line],Ms=n=>{const t=n.slice(n.lastIndexOf("/")+1),e=t.lastIndexOf(".");return e<=0?null:t.slice(e+1)},_t=/[\p{L}\p{N}_$]/u,tr=(n,t)=>{let e=t;for(;e>0&&_t.test(n.charAt(e-1))&&_t.test(n.charAt(e));)e-=1;return e},er=(n,t)=>{let e=t;for(;e<n.length&&_t.test(n.charAt(e))&&_t.test(n.charAt(e-1));)e+=1;return e},sr=(n,t)=>{if(n===t)return null;const e=Math.min(n.length,t.length);let s=0;for(;s<e&&n.charAt(s)===t.charAt(s);)s+=1;let a=0;for(;a<e-s&&n.charAt(n.length-1-a)===t.charAt(t.length-1-a);)a+=1;if((n.slice(0,s).trim().length+n.slice(n.length-a).trim().length)*4<Math.max(n.trim().length,t.trim().length))return null;const r=o=>{const l=tr(o,s),c=er(o,o.length-a);return[l,Math.max(l,c)]};return{before:r(n),after:r(t)}},nr=(n,t,e)=>{const s=[];let a=0;for(const i of se(n,t)){const r=a+i.text.length,o=e===null?[]:e.filter(c=>c>a&&c<r);let l=a;for(const c of[...o,r]){const p=i.text.slice(l-a,c-a),m=e!==null&&l>=e[0]&&c<=e[1]&&e[0]<e[1];p!==""&&s.push({kind:i.kind,text:p,changed:m}),l=c}a=r}return s},As=n=>{const t=new Map;for(const e of n)if(e.kind!=="context")for(const[s,a]of e.dels.entries()){const i=e.adds[s];if(i===void 0)break;const r=sr(a.text,i.text);r!==null&&(t.set(a,r.before),t.set(i,r.after))}return t},zs=n=>{const t=[];let e=null;for(const s of n.lines){if(s.kind==="context"){e=null,t.push({kind:"context",line:s});continue}(e===null||s.kind==="del"&&e.adds.length>0)&&(e={kind:"change",dels:[],adds:[]},t.push(e)),(s.kind==="del"?e.dels:e.adds).push(s)}return t},vt=(n,t,e,s=!0)=>({line:n,id:ft(n),segments:nr(n.text,t,e.get(n)??null),target:s}),ar=n=>{const t=Ms(n.path);return n.hunks.flatMap(e=>{const s=As(zs(e));return[{kind:"hunk",hunk:e},...e.lines.map(a=>({kind:"line",cell:vt(a,t,s)}))]})},ir=n=>{const t=Ms(n.path);return n.hunks.flatMap(e=>{const s=zs(e),a=As(s),i=[{kind:"hunk",hunk:e}];for(const r of s){if(r.kind==="context"){i.push({kind:"pair",left:vt(r.line,t,a,!1),right:vt(r.line,t,a)});continue}for(let o=0;o<Math.max(r.dels.length,r.adds.length);o+=1){const l=r.dels[o],c=r.adds[o];i.push({kind:"pair",left:l===void 0?null:vt(l,t,a),right:c===void 0?null:vt(c,t,a)})}}return i})},_s=40,rr=n=>{const t=n.trim().replace(/\s+/g," ");return t.length>_s?`${t.slice(0,_s-1)}\u2026`:t},or=(n,t)=>t.startsWith("R")?t.slice(1):n.deletedLine(`-${t.slice(1)}`),Ls=(n,t,e)=>n.lineLabel(t,or(n,ft(e)),rr(e.text)),lr=(n,t)=>t.files.flatMap(e=>[{target:{kind:"file",path:e.path},label:e.path},...e.hunks.flatMap(s=>s.lines.map(a=>({target:{kind:"line",path:e.path,line:ft(a)},label:Ls(n,e.path,a)})))]),dr=n=>({files:n.files.length,additions:n.files.reduce((t,e)=>t+e.additions,0),deletions:n.files.reduce((t,e)=>t+e.deletions,0)}),cr=[L,J,ht,_`
1272
1272
  :host {
1273
1273
  display: block;
1274
1274
  color: var(--dpk-ink);
@@ -1867,8 +1867,8 @@ ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No da
1867
1867
  padding: 8px 12px;
1868
1868
  border-top: 1px solid var(--dpk-rule);
1869
1869
  }
1870
- `],Kt="SUGGEST_CHANGE",zi=w({text:v()}),Vt=(n,t)=>`${n}
1871
- ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines.map(l=>[Vt(o.path,lt(l)),l])))),a=new Map,i=e.map(o=>{if(o.type!==Kt)return{id:o.id,title:o.type,stale:"unsupported-action-type"};const r=ze(o.target.id),[,l,u,c]=r??[],m=n.suggestTitle(u??o.target.id,c?.startsWith("R")?c.slice(1):c??""),k=Pt(zi,o.payload);if(l!=="line"||u===void 0||c===void 0||!c.startsWith("R"))return{id:o.id,title:m,stale:"target-missing"};if(!k.success)return{id:o.id,title:m,stale:"constraint-violated"};const L=Vt(u,c);return s.has(L)?(a.set(L,[...a.get(L)??[],{action:o.id,text:k.output.text}]),{id:o.id,title:m,summary:k.output.text,tone:"update"}):{id:o.id,title:m,stale:"target-missing"}});return{byLine:a,results:i}},Ti='script[type="text/x-diff"], script[type="text/plain"]',Ct=n=>n.newLine!==null,ht=(n,t)=>`${n}#${t}`,St=n=>`${n}#reply`,ks=4,Jt=6;class vs extends z{static{this.styles=Ei}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},view:{type:String,reflect:!0},diff:{type:String,attribute:!1}}}#a=new P(this,()=>{this.#o="",this.#y()});#t=new it(this);#e=new MutationObserver(()=>{this.#w()});#n=null;#s=rs();#i=null;#r=new Map;#o="";#d=new Set;#c=[];#p=[];#m=new Map;#h=null;#l=new Map;#u=null;#f=null;#x=[];#k=new Map;#v=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.view="split",this.diff=""}connectedCallback(){super.connectedCallback(),this.#o="",this.#e.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.#w()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}willUpdate(t){t.has("diff")&&this.#w()}updated(){this.#S(),this.#t.sync(this.renderRoot.querySelector(".comment-pop"));const t=this.#f;this.#f=null;const e=t==="text"?".composer textarea":t==="tab"?'.composer [aria-selected="true"]':t==="reply"?".thread textarea":null;e!==null&&this.renderRoot.querySelector(e)?.focus({preventScroll:!0})}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#g.heading} \xB7 ${this.id}`;return[...this.#r].map(([e,s])=>({value:e,label:s,group:t}))}get elementActions(){return this.#c}set elementActions(t){this.#c=t,this.#y()}get elementComments(){return this.#x}set elementComments(t){this.#x=t;const e=new Map;for(const s of t){const a=`element:${s.target.id}`;e.set(a,[...e.get(a)??[],s])}this.#k=e,this.requestUpdate()}get elementActionResults(){return this.#p}get files(){return this.#s.files}get dataError(){return this.#i}getContextMenuItems(t){const e=[],s=kt(t.target,this.commentTargets,Tt(this.#a.locale),(o,r)=>this.#T(o,r));s!==null&&e.push(s);const a=t.target===null?null:ce(t.target),i=a===null?null:this.#M(a);return i!==null&&Ct(i.line)&&e.push({id:"suggest-change",entries:[{kind:"item",id:"suggest-change",label:this.#g.suggestChange,run:()=>this.#L(i,"suggest")}]}),e.length===0?null:e}get#g(){return si(this.#a.locale)}get#z(){const t=this.querySelector(Ti);return t===null?this.diff:t.textContent??""}#w(){const t=this.#z;if(t!==this.#n){this.#n=t;try{this.#s=ps(t),this.#i=null}catch(e){this.#s=rs(),this.#i=e instanceof Error?e.message:String(e),console.error("[dev-process-kit] invalid diff:",this.#i)}this.#y()}}#y(){const t=this.#g;this.#r=new Map(Ci(t,this.#s).map(({target:s,label:a})=>[this.#b(s),a]));const e=Mi(t,this.#s,this.#c);this.#m=e.byLine,this.#p=e.results,this.requestUpdate()}#b(t){return`element:${[this.id,...gi(t)].map(e=>encodeURIComponent(e)).join("/")}`}#S(){const t=JSON.stringify(this.commentTargets);t!==this.#o&&(this.#o=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#M(t){if(!this.id)return null;for(const e of this.#s.files)for(const s of e.hunks)for(const a of s.lines)if(this.#b({kind:"line",path:e.path,line:lt(a)})===t)return{ref:t,path:e.path,line:a,label:bs(this.#g,e.path,a)};return null}#T(t,e){const s=this.#M(t);if(s!==null){this.#L(s,"comment");return}const a=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);a!==null&&this.#t.open(t,a,e)}#A(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}#L(t,e){this.#d.has(t.path)&&this.#q(t.path),this.#h={...t,tab:e==="suggest"&&!Ct(t.line)?"comment":e},this.#u=null,this.#f="text",this.requestUpdate()}#P(t,e){const s=this.#h;s===null||s.tab===t||!Ct(s.line)||(this.#h={...s,tab:t},this.#u=null,this.#f=e,this.requestUpdate())}#I(t){this.#v=t,this.#u=null,this.#f="reply",this.requestUpdate()}#C(t){const e=this.#v;if(e!==null){if(t){const s=new Map(this.#l);s.delete(St(e)),this.#l=s}this.#v=null,this.#u=null,this.requestUpdate()}}#E(t){const e=(this.#l.get(St(t))??"").trim();if(e!==""){if(!this.#A(t,e)){this.#u=St(t),this.requestUpdate();return}this.#C(!0)}}#R(t){const e=this.#h;if(e!==null){if(t){const s=new Map(this.#l);s.delete(ht(e.ref,"comment")),s.delete(ht(e.ref,"suggest")),this.#l=s}this.#h=null,this.#u=null,this.requestUpdate()}}#$(t){return this.#l.get(ht(t.ref,t.tab))??(t.tab==="suggest"?t.line.text:"")}#O(t){const e=this.#$(t);return t.tab==="suggest"?e!==t.line.text:e.trim()!==""}#D(){const t=this.#h;if(t===null||!this.#O(t))return;const e=this.#$(t);if(!(t.tab==="comment"?this.#A(t.ref,e.trim()):this.#U(t,e))){this.#u=ht(t.ref,t.tab),this.requestUpdate();return}this.#R(!0)}#U(t,e){return!this.dispatchEvent(new CustomEvent("dpk-element-action",{detail:{type:Kt,target:t.ref,payload:{text:e}},bubbles:!0,composed:!0,cancelable:!0}))}#q(t){const e=new Set(this.#d);e.delete(t)||e.add(t),this.#d=e,this.requestUpdate()}#G(t){this.view=t}render(){const t=this.#g,e=Si(this.#s),s=this.view==="split"?"split":"unified";return d`
1870
+ `],ne="SUGGEST_CHANGE",pr=x({text:b()}),ae=(n,t)=>`${n}
1871
+ ${t}`,hr=(n,t,e)=>{const s=new Map(t.files.flatMap(r=>r.hunks.flatMap(o=>o.lines.map(l=>[ae(r.path,ft(l)),l])))),a=new Map,i=e.map(r=>{if(r.type!==ne)return{id:r.id,title:r.type,stale:"unsupported-action-type"};const o=Kt(r.target.id),[,l,c,p]=o??[],m=n.suggestTitle(c??r.target.id,p?.startsWith("R")?p.slice(1):p??""),f=St(pr,r.payload);if(l!=="line"||c===void 0||p===void 0||!p.startsWith("R"))return{id:r.id,title:m,stale:"target-missing"};if(!f.success)return{id:r.id,title:m,stale:"constraint-violated"};const E=ae(c,p);return s.has(E)?(a.set(E,[...a.get(E)??[],{action:r.id,text:f.output.text}]),{id:r.id,title:m,summary:f.output.text,tone:"update"}):{id:r.id,title:m,stale:"target-missing"}});return{byLine:a,results:i}},ur='script[type="text/x-diff"], script[type="text/plain"]',Lt=n=>n.newLine!==null,xt=(n,t)=>`${n}#${t}`,Pt=n=>`${n}#reply`,Ps=4,ie=6;class Rs extends A{static{this.styles=cr}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},view:{type:String,reflect:!0},diff:{type:String,attribute:!1}}}#a=new O(this,()=>{this.#o="",this.#y()});#t=new ut(this);#e=new MutationObserver(()=>{this.#w()});#n=null;#s=ys();#i=null;#r=new Map;#o="";#l=new Set;#c=[];#p=[];#g=new Map;#u=null;#d=new Map;#m=null;#b=null;#x=[];#f=new Map;#k=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.view="split",this.diff=""}connectedCallback(){super.connectedCallback(),this.#o="",this.#e.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.#w()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}willUpdate(t){t.has("diff")&&this.#w()}updated(){this.#z(),this.#t.sync(this.renderRoot.querySelector(".comment-pop"));const t=this.#b;this.#b=null;const e=t==="text"?".composer textarea":t==="tab"?'.composer [aria-selected="true"]':t==="reply"?".thread textarea":null;e!==null&&this.renderRoot.querySelector(e)?.focus({preventScroll:!0})}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#h.heading} \xB7 ${this.id}`;return[...this.#r].map(([e,s])=>({value:e,label:s,group:t}))}get elementActions(){return this.#c}set elementActions(t){this.#c=t,this.#y()}get elementComments(){return this.#x}set elementComments(t){this.#x=t;const e=new Map;for(const s of t){const a=`element:${s.target.id}`;e.set(a,[...e.get(a)??[],s])}this.#f=e,this.requestUpdate()}get elementActionResults(){return this.#p}get files(){return this.#s.files}get dataError(){return this.#i}getContextMenuItems(t){const e=[],s=Et(t.target,this.commentTargets,Ut(this.#a.locale),(r,o)=>this.#E(r,o));s!==null&&e.push(s);const a=t.target===null?null:ye(t.target),i=a===null?null:this.#S(a);return i!==null&&Lt(i.line)&&e.push({id:"suggest-change",entries:[{kind:"item",id:"suggest-change",label:this.#h.suggestChange,run:()=>this.#L(i,"suggest")}]}),e.length===0?null:e}get#h(){return Ni(this.#a.locale)}get#C(){const t=this.querySelector(ur);return t===null?this.diff:t.textContent??""}#w(){const t=this.#C;if(t!==this.#n){this.#n=t;try{this.#s=Es(t),this.#i=null}catch(e){this.#s=ys(),this.#i=e instanceof Error?e.message:String(e),console.error("[dev-process-kit] invalid diff:",this.#i)}this.#y()}}#y(){const t=this.#h;this.#r=new Map(lr(t,this.#s).map(({target:s,label:a})=>[this.#v(s),a]));const e=hr(t,this.#s,this.#c);this.#g=e.byLine,this.#p=e.results,this.requestUpdate()}#v(t){return`element:${[this.id,...Qi(t)].map(e=>encodeURIComponent(e)).join("/")}`}#z(){const t=JSON.stringify(this.commentTargets);t!==this.#o&&(this.#o=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#S(t){if(!this.id)return null;for(const e of this.#s.files)for(const s of e.hunks)for(const a of s.lines)if(this.#v({kind:"line",path:e.path,line:ft(a)})===t)return{ref:t,path:e.path,line:a,label:Ls(this.#h,e.path,a)};return null}#E(t,e){const s=this.#S(t);if(s!==null){this.#L(s,"comment");return}const a=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);a!==null&&this.#t.open(t,a,e)}#_(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}#L(t,e){this.#l.has(t.path)&&this.#I(t.path),this.#u={...t,tab:e==="suggest"&&!Lt(t.line)?"comment":e},this.#m=null,this.#b="text",this.requestUpdate()}#T(t,e){const s=this.#u;s===null||s.tab===t||!Lt(s.line)||(this.#u={...s,tab:t},this.#m=null,this.#b=e,this.requestUpdate())}#D(t){this.#k=t,this.#m=null,this.#b="reply",this.requestUpdate()}#A(t){const e=this.#k;if(e!==null){if(t){const s=new Map(this.#d);s.delete(Pt(e)),this.#d=s}this.#k=null,this.#m=null,this.requestUpdate()}}#P(t){const e=(this.#d.get(Pt(t))??"").trim();if(e!==""){if(!this.#_(t,e)){this.#m=Pt(t),this.requestUpdate();return}this.#A(!0)}}#O(t){const e=this.#u;if(e!==null){if(t){const s=new Map(this.#d);s.delete(xt(e.ref,"comment")),s.delete(xt(e.ref,"suggest")),this.#d=s}this.#u=null,this.#m=null,this.requestUpdate()}}#M(t){return this.#d.get(xt(t.ref,t.tab))??(t.tab==="suggest"?t.line.text:"")}#R(t){const e=this.#M(t);return t.tab==="suggest"?e!==t.line.text:e.trim()!==""}#$(){const t=this.#u;if(t===null||!this.#R(t))return;const e=this.#M(t);if(!(t.tab==="comment"?this.#_(t.ref,e.trim()):this.#q(t,e))){this.#m=xt(t.ref,t.tab),this.requestUpdate();return}this.#O(!0)}#q(t,e){return!this.dispatchEvent(new CustomEvent("dpk-element-action",{detail:{type:ne,target:t.ref,payload:{text:e}},bubbles:!0,composed:!0,cancelable:!0}))}#I(t){const e=new Set(this.#l);e.delete(t)||e.add(t),this.#l=e,this.requestUpdate()}#B(t){this.view=t}render(){const t=this.#h,e=dr(this.#s),s=this.view==="split"?"split":"unified";return d`
1872
1872
  <section class="diff" data-view=${s}>
1873
1873
  <header class="toolbar">
1874
1874
  <span class="title">${this.heading??t.heading}</span>
@@ -1881,7 +1881,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
1881
1881
  ${["unified","split"].map(a=>d`<button
1882
1882
  type="button"
1883
1883
  aria-pressed=${s===a?"true":"false"}
1884
- @click=${()=>this.#G(a)}
1884
+ @click=${()=>this.#B(a)}
1885
1885
  >
1886
1886
  ${t[a]}
1887
1887
  </button>`)}
@@ -1889,10 +1889,10 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
1889
1889
  </header>
1890
1890
  ${this.#i===null?h:d`<p class="notice" role="alert">${t.dataError}<br />${this.#i}</p>`}
1891
1891
  ${this.#i===null&&e.files===0?d`<p class="empty">${t.empty}</p>`:h}
1892
- ${U(this.#s.files,a=>a.path,a=>this.#K(a,s))}
1892
+ ${U(this.#s.files,a=>a.path,a=>this.#N(a,s))}
1893
1893
  </section>
1894
- ${this.#t.render({locale:this.#a.locale,errorMessage:t.sendFailed,submit:(a,i)=>this.#A(a,i)})}
1895
- `}#K(t,e){const s=this.#g,a=!this.#d.has(t.path),i=this.#b({kind:"file",path:t.path}),o=(t.status==="renamed"||t.status==="copied")&&t.oldPath!==null;return d`<section class="file" data-path=${t.path} data-status=${t.status}>
1894
+ ${this.#t.render({locale:this.#a.locale,errorMessage:t.sendFailed,submit:(a,i)=>this.#_(a,i)})}
1895
+ `}#N(t,e){const s=this.#h,a=!this.#l.has(t.path),i=this.#v({kind:"file",path:t.path}),r=(t.status==="renamed"||t.status==="copied")&&t.oldPath!==null;return d`<section class="file" data-path=${t.path} data-status=${t.status}>
1896
1896
  <header class="file-head" data-dpk-target=${this.id?i:h}>
1897
1897
  <button
1898
1898
  type="button"
@@ -1900,32 +1900,32 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
1900
1900
  data-size="sm"
1901
1901
  aria-expanded=${a?"true":"false"}
1902
1902
  aria-label=${a?s.collapse(t.path):s.expand(t.path)}
1903
- @click=${()=>this.#q(t.path)}
1903
+ @click=${()=>this.#I(t.path)}
1904
1904
  >
1905
- ${me()}
1905
+ ${Se()}
1906
1906
  </button>
1907
1907
  <span class="status" data-status=${t.status}>${s[t.status]}</span>
1908
1908
  <span class="path"
1909
- >${o?d`<span class="old-path">${t.oldPath}</span> → `:h}${t.path}</span
1909
+ >${r?d`<span class="old-path">${t.oldPath}</span> → `:h}${t.path}</span
1910
1910
  >
1911
1911
  <span class="file-stat"
1912
1912
  ><span class="stat-add">+${t.additions}</span> <span class="stat-del">−${t.deletions}</span></span
1913
1913
  >
1914
- ${this.id?this.#X(i,t.path):h}
1914
+ ${this.id?this.#Y(i,t.path):h}
1915
1915
  </header>
1916
- ${a?this.#Y(i):h} ${a?this.#V(t,e):h}
1917
- </section>`}#V(t,e){const s=this.#g;if(t.binary)return d`<p class="file-note">${s.binary}</p>`;if(t.hunks.length===0){const a=t.oldMode!==null&&t.newMode!==null&&t.oldMode!==t.newMode?s.modeChanged(t.oldMode,t.newMode):s.noContentChange;return d`<p class="file-note">${a}</p>`}return d`<div class="scroll" data-dpk-check="off">
1916
+ ${a?this.#Z(i):h} ${a?this.#K(t,e):h}
1917
+ </section>`}#K(t,e){const s=this.#h;if(t.binary)return d`<p class="file-note">${s.binary}</p>`;if(t.hunks.length===0){const a=t.oldMode!==null&&t.newMode!==null&&t.oldMode!==t.newMode?s.modeChanged(t.oldMode,t.newMode):s.noContentChange;return d`<p class="file-note">${a}</p>`}return d`<div class="scroll" data-dpk-check="off">
1918
1918
  <table class="lines" data-view=${e}>
1919
- ${e==="split"?this.#Z(t):this.#J(t)}
1919
+ ${e==="split"?this.#j(t):this.#V(t)}
1920
1920
  </table>
1921
- </div>`}#J(t){return d`<colgroup>
1921
+ </div>`}#V(t){return d`<colgroup>
1922
1922
  <col class="col-num" />
1923
1923
  <col class="col-num" />
1924
1924
  <col class="col-act" />
1925
1925
  <col />
1926
1926
  </colgroup>
1927
1927
  <tbody>
1928
- ${xi(t).map(e=>{if(e.kind==="hunk")return this.#H(e.hunk,ks);const{cell:s}=e,a=this.#j(t,s);return d`<tr
1928
+ ${ar(t).map(e=>{if(e.kind==="hunk")return this.#H(e.hunk,Ps);const{cell:s}=e,a=this.#U(t,s);return d`<tr
1929
1929
  class="line"
1930
1930
  data-kind=${s.line.kind}
1931
1931
  data-line=${s.id}
@@ -1933,11 +1933,11 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
1933
1933
  >
1934
1934
  <td class="num">${s.line.oldLine??""}</td>
1935
1935
  <td class="num">${s.line.newLine??""}</td>
1936
- <td class="act">${this.#W(t,s,a)}</td>
1937
- ${this.#_(s)}
1936
+ <td class="act">${this.#J(t,s,a)}</td>
1937
+ ${this.#W(s)}
1938
1938
  </tr>
1939
- ${this.#N(t,s,ks)}`})}
1940
- </tbody>`}#Z(t){return d`<colgroup>
1939
+ ${this.#G(t,s,Ps)}`})}
1940
+ </tbody>`}#j(t){return d`<colgroup>
1941
1941
  <col class="col-num" />
1942
1942
  <col class="col-act" />
1943
1943
  <col class="col-half" />
@@ -1946,80 +1946,80 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
1946
1946
  <col class="col-half" />
1947
1947
  </colgroup>
1948
1948
  <tbody>
1949
- ${yi(t).map(e=>e.kind==="hunk"?this.#H(e.hunk,Jt):d`<tr class="pair">
1949
+ ${ir(t).map(e=>e.kind==="hunk"?this.#H(e.hunk,ie):d`<tr class="pair">
1950
1950
  ${this.#F(t,e.left,"old")} ${this.#F(t,e.right,"new")}
1951
1951
  </tr>
1952
- ${e.left!==null&&e.left.target?this.#N(t,e.left,Jt):h}
1953
- ${e.right===null?h:this.#N(t,e.right,Jt)}`)}
1952
+ ${e.left!==null&&e.left.target?this.#G(t,e.left,ie):h}
1953
+ ${e.right===null?h:this.#G(t,e.right,ie)}`)}
1954
1954
  </tbody>`}#F(t,e,s){if(e===null)return d`<td class="num" data-blank></td>
1955
1955
  <td class="act" data-blank></td>
1956
- <td class="code" data-blank></td>`;const a=this.#j(t,e),i=s==="old"?e.line.oldLine:e.line.newLine;return d`<td class="num" data-kind=${e.line.kind}>${i??""}</td>
1957
- <td class="act" data-kind=${e.line.kind}>${this.#W(t,e,a)}</td>
1958
- ${this.#_(e,a)}`}#H(t,e){const s=`@@ -${t.oldStart},${t.oldCount} +${t.newStart},${t.newCount} @@`;return d`<tr class="hunk">
1956
+ <td class="code" data-blank></td>`;const a=this.#U(t,e),i=s==="old"?e.line.oldLine:e.line.newLine;return d`<td class="num" data-kind=${e.line.kind}>${i??""}</td>
1957
+ <td class="act" data-kind=${e.line.kind}>${this.#J(t,e,a)}</td>
1958
+ ${this.#W(e,a)}`}#H(t,e){const s=`@@ -${t.oldStart},${t.oldCount} +${t.newStart},${t.newCount} @@`;return d`<tr class="hunk">
1959
1959
  <td colspan=${e}>
1960
1960
  <span class="hunk-range">${s}</span
1961
1961
  >${t.section===""?h:d` <span class="hunk-section">${t.section}</span>`}
1962
1962
  </td>
1963
- </tr>`}#_(t,e){const s=t.line.kind==="add"?"+":t.line.kind==="del"?"-":" ";return d`<td class="code" data-kind=${t.line.kind} data-dpk-target=${e??h}>
1963
+ </tr>`}#W(t,e){const s=t.line.kind==="add"?"+":t.line.kind==="del"?"-":" ";return d`<td class="code" data-kind=${t.line.kind} data-dpk-target=${e??h}>
1964
1964
  <span class="sign" aria-hidden="true">${s}</span
1965
1965
  ><span class="text"
1966
1966
  >${t.segments.map(a=>a.kind===null&&!a.changed?a.text:d`<span class=${a.kind??h} ?data-changed=${a.changed}>${a.text}</span>`)}</span
1967
- >${t.line.noNewline?d`<span class="no-newline" title=${this.#g.noNewline} aria-label=${this.#g.noNewline}>⊘</span>`:h}
1968
- </td>`}#j(t,e){return!this.id||!e.target?null:this.#b({kind:"line",path:t.path,line:e.id})}#W(t,e,s){if(s===null)return h;const a=this.#r.get(s)??t.path,i=this.#h?.ref===s;return d`<span class="line-actions" ?data-open=${i}
1967
+ >${t.line.noNewline?d`<span class="no-newline" title=${this.#h.noNewline} aria-label=${this.#h.noNewline}>⊘</span>`:h}
1968
+ </td>`}#U(t,e){return!this.id||!e.target?null:this.#v({kind:"line",path:t.path,line:e.id})}#J(t,e,s){if(s===null)return h;const a=this.#r.get(s)??t.path,i=this.#u?.ref===s;return d`<span class="line-actions" ?data-open=${i}
1969
1969
  ><button
1970
1970
  type="button"
1971
1971
  class="line-btn"
1972
- aria-label=${this.#g.addOn(a)}
1972
+ aria-label=${this.#h.addOn(a)}
1973
1973
  aria-expanded=${i?"true":"false"}
1974
- title=${this.#g.addOn(a)}
1974
+ title=${this.#h.addOn(a)}
1975
1975
  @click=${()=>this.#L({ref:s,path:t.path,line:e.line,label:a},"comment")}
1976
1976
  >
1977
- ${pe()}
1977
+ ${we()}
1978
1978
  </button></span
1979
- >`}#X(t,e){return d`<button
1979
+ >`}#Y(t,e){return d`<button
1980
1980
  type="button"
1981
1981
  class="dpk-icon-btn"
1982
1982
  data-size="sm"
1983
- aria-label=${this.#g.commentOn(e)}
1984
- title=${this.#g.commentOn(e)}
1985
- @click=${()=>this.#T(t,e)}
1983
+ aria-label=${this.#h.commentOn(e)}
1984
+ title=${this.#h.commentOn(e)}
1985
+ @click=${()=>this.#E(t,e)}
1986
1986
  >
1987
- ${At()}
1988
- </button>`}#N(t,e,s){const a=e.line.newLine===null?[]:this.#m.get(Vt(t.path,e.id))??[],i=this.#j(t,e),o=i===null?[]:this.#k.get(i)??[],r=i!==null&&this.#h?.ref===i?this.#h:null;return o.length===0&&a.length===0&&r===null?h:d`${i===null||o.length===0?h:d`<tr class="extra">
1989
- <td colspan=${s}>${this.#B(i,o)}</td>
1987
+ ${$t()}
1988
+ </button>`}#G(t,e,s){const a=e.line.newLine===null?[]:this.#g.get(ae(t.path,e.id))??[],i=this.#U(t,e),r=i===null?[]:this.#f.get(i)??[],o=i!==null&&this.#u?.ref===i?this.#u:null;return r.length===0&&a.length===0&&o===null?h:d`${i===null||r.length===0?h:d`<tr class="extra">
1989
+ <td colspan=${s}>${this.#X(i,r)}</td>
1990
1990
  </tr>`}${a.map(l=>d`<tr class="extra">
1991
1991
  <td colspan=${s}>${this.#Q(e.line,l)}</td>
1992
- </tr>`)}${r===null?h:d`<tr class="extra">
1993
- <td colspan=${s}>${this.#tt(r)}</td>
1994
- </tr>`}`}#Y(t){const e=this.#k.get(t)??[];return!this.id||e.length===0?h:d`<div class="file-thread">${this.#B(t,e)}</div>`}#B(t,e){const s=this.#g,a=this.#r.get(t)??"",i=St(t),o=this.#l.get(i)??"",r=new Intl.DateTimeFormat(this.#a.locale,{dateStyle:"short",timeStyle:"short"});return d`<section class="thread" data-thread=${t} aria-label=${s.threadOn(a)}>
1992
+ </tr>`)}${o===null?h:d`<tr class="extra">
1993
+ <td colspan=${s}>${this.#tt(o)}</td>
1994
+ </tr>`}`}#Z(t){const e=this.#f.get(t)??[];return!this.id||e.length===0?h:d`<div class="file-thread">${this.#X(t,e)}</div>`}#X(t,e){const s=this.#h,a=this.#r.get(t)??"",i=Pt(t),r=this.#d.get(i)??"",o=new Intl.DateTimeFormat(this.#a.locale,{dateStyle:"short",timeStyle:"short"});return d`<section class="thread" data-thread=${t} aria-label=${s.threadOn(a)}>
1995
1995
  <ol class="thread-items">
1996
- ${e.map(l=>{const u=new Date(l.createdAt);return d`<li class="thread-item" data-comment=${l.id}>
1996
+ ${e.map(l=>{const c=new Date(l.createdAt);return d`<li class="thread-item" data-comment=${l.id}>
1997
1997
  <p class="thread-meta">
1998
- ${At()}
1999
- ${Number.isNaN(u.getTime())?h:d`<time datetime=${l.createdAt}>${r.format(u)}</time>`}
1998
+ ${$t()}
1999
+ ${Number.isNaN(c.getTime())?h:d`<time datetime=${l.createdAt}>${o.format(c)}</time>`}
2000
2000
  </p>
2001
- <p class="thread-body">${gn(l)}</p>
2001
+ <p class="thread-body">${Wn(l)}</p>
2002
2002
  </li>`})}
2003
2003
  </ol>
2004
- ${this.#v===t?d`<div
2004
+ ${this.#k===t?d`<div
2005
2005
  class="thread-compose"
2006
- @keydown=${l=>{l.isComposing||(l.key==="Escape"?(l.preventDefault(),l.stopPropagation(),this.#C(!1)):l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),this.#E(t)))}}
2006
+ @keydown=${l=>{l.isComposing||(l.key==="Escape"?(l.preventDefault(),l.stopPropagation(),this.#A(!1)):l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),this.#P(t)))}}
2007
2007
  >
2008
2008
  <textarea
2009
2009
  class="dpk-textarea"
2010
2010
  rows="3"
2011
2011
  aria-label=${s.reply}
2012
2012
  data-dpk-text-key=${i}
2013
- .value=${o}
2014
- @input=${l=>{l.currentTarget instanceof HTMLTextAreaElement&&(this.#l=new Map(this.#l).set(i,l.currentTarget.value),this.#u=null,this.requestUpdate())}}
2013
+ .value=${r}
2014
+ @input=${l=>{l.currentTarget instanceof HTMLTextAreaElement&&(this.#d=new Map(this.#d).set(i,l.currentTarget.value),this.#m=null,this.requestUpdate())}}
2015
2015
  ></textarea>
2016
- ${this.#u===i?d`<p class="composer-error" role="alert">${s.sendFailed}</p>`:h}
2016
+ ${this.#m===i?d`<p class="composer-error" role="alert">${s.sendFailed}</p>`:h}
2017
2017
  <div class="composer-actions">
2018
2018
  <button
2019
2019
  class="dpk-btn dpk-btn--accent"
2020
2020
  type="button"
2021
- ?disabled=${o.trim()===""}
2022
- @click=${()=>this.#E(t)}
2021
+ ?disabled=${r.trim()===""}
2022
+ @click=${()=>this.#P(t)}
2023
2023
  >
2024
2024
  ${s.reply}
2025
2025
  </button>
@@ -2027,17 +2027,17 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2027
2027
  class="dpk-btn dpk-btn--ghost"
2028
2028
  type="button"
2029
2029
  data-dpk-text-discard
2030
- @click=${()=>this.#C(!0)}
2030
+ @click=${()=>this.#A(!0)}
2031
2031
  >
2032
2032
  ${s.cancel}
2033
2033
  </button>
2034
2034
  </div>
2035
- </div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#I(t)}>
2035
+ </div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#D(t)}>
2036
2036
  ${s.replyPlaceholder}
2037
2037
  </button>`}
2038
2038
  </section>`}#Q(t,e){const s=e.text===""?[]:e.text.split(`
2039
2039
  `);return d`<div class="suggestion" data-action=${e.action}>
2040
- <p class="suggestion-head">${fn()} ${this.#g.suggestion}</p>
2040
+ <p class="suggestion-head">${Bn()} ${this.#h.suggestion}</p>
2041
2041
  <div class="suggestion-lines">
2042
2042
  <div class="suggestion-line" data-kind="del">
2043
2043
  <span class="sign">-</span><span class="text">${t.text}</span>
@@ -2046,28 +2046,28 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2046
2046
  <span class="sign">+</span><span class="text">${a}</span>
2047
2047
  </div>`)}
2048
2048
  </div>
2049
- </div>`}#tt(t){const e=this.#g,s=this.#$(t),a=Math.min(12,Math.max(3,s.split(`
2050
- `).length+1)),i=ht(t.ref,t.tab),o=Ct(t.line)?d`<div
2049
+ </div>`}#tt(t){const e=this.#h,s=this.#M(t),a=Math.min(12,Math.max(3,s.split(`
2050
+ `).length+1)),i=xt(t.ref,t.tab),r=Lt(t.line)?d`<div
2051
2051
  class="composer-tabs"
2052
2052
  role="tablist"
2053
2053
  aria-label=${e.composerTabs}
2054
- @keydown=${r=>{r.key!=="ArrowLeft"&&r.key!=="ArrowRight"||(r.preventDefault(),this.#P(t.tab==="comment"?"suggest":"comment","tab"))}}
2054
+ @keydown=${o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),this.#T(t.tab==="comment"?"suggest":"comment","tab"))}}
2055
2055
  >
2056
- ${["comment","suggest"].map(r=>d`<button
2056
+ ${["comment","suggest"].map(o=>d`<button
2057
2057
  type="button"
2058
2058
  role="tab"
2059
- aria-selected=${t.tab===r?"true":"false"}
2060
- tabindex=${t.tab===r?0:-1}
2061
- @click=${()=>this.#P(r,"text")}
2059
+ aria-selected=${t.tab===o?"true":"false"}
2060
+ tabindex=${t.tab===o?0:-1}
2061
+ @click=${()=>this.#T(o,"text")}
2062
2062
  >
2063
- ${r==="comment"?e.comment:e.suggestChange}
2063
+ ${o==="comment"?e.comment:e.suggestChange}
2064
2064
  </button>`)}
2065
2065
  </div>`:d`<strong class="composer-title">${e.comment}</strong>`;return d`<div
2066
2066
  class="composer"
2067
2067
  data-tab=${t.tab}
2068
- @keydown=${r=>{r.isComposing||(r.key==="Escape"?(r.preventDefault(),r.stopPropagation(),this.#R(!1)):r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),this.#D()))}}
2068
+ @keydown=${o=>{o.isComposing||(o.key==="Escape"?(o.preventDefault(),o.stopPropagation(),this.#O(!1)):o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&(o.preventDefault(),this.#$()))}}
2069
2069
  >
2070
- <div class="composer-head">${o}<span class="composer-target">${t.label}</span></div>
2070
+ <div class="composer-head">${r}<span class="composer-target">${t.label}</span></div>
2071
2071
  <textarea
2072
2072
  class="dpk-textarea"
2073
2073
  rows=${a}
@@ -2075,15 +2075,15 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2075
2075
  aria-label=${t.tab==="suggest"?e.suggestionLabel:e.comment}
2076
2076
  data-dpk-text-key=${i}
2077
2077
  .value=${s}
2078
- @input=${r=>{r.currentTarget instanceof HTMLTextAreaElement&&(this.#l=new Map(this.#l).set(i,r.currentTarget.value),this.#u=null,this.requestUpdate())}}
2078
+ @input=${o=>{o.currentTarget instanceof HTMLTextAreaElement&&(this.#d=new Map(this.#d).set(i,o.currentTarget.value),this.#m=null,this.requestUpdate())}}
2079
2079
  ></textarea>
2080
- ${this.#u===i?d`<p class="composer-error" role="alert">${e.unrecorded}</p>`:h}
2080
+ ${this.#m===i?d`<p class="composer-error" role="alert">${e.unrecorded}</p>`:h}
2081
2081
  <div class="composer-actions">
2082
2082
  <button
2083
2083
  class="dpk-btn dpk-btn--accent"
2084
2084
  type="button"
2085
- ?disabled=${!this.#O(t)}
2086
- @click=${()=>this.#D()}
2085
+ ?disabled=${!this.#R(t)}
2086
+ @click=${()=>this.#$()}
2087
2087
  >
2088
2088
  ${t.tab==="suggest"?e.suggest:e.addComment}
2089
2089
  </button>
@@ -2091,12 +2091,844 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2091
2091
  class="dpk-btn dpk-btn--ghost"
2092
2092
  type="button"
2093
2093
  data-dpk-text-discard
2094
- @click=${()=>this.#R(!0)}
2094
+ @click=${()=>this.#O(!0)}
2095
2095
  >
2096
2096
  ${e.cancel}
2097
2097
  </button>
2098
2098
  </div>
2099
- </div>`}}const xs=()=>{customElements.get("dpk-diff")||customElements.define("dpk-diff",vs)},Ai=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"}}),Li=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,Ri=n=>{const t=Li.exec(n?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},ys=60,Di=(n,t,e,s)=>{const a=[n,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return a===void 0?s:a.length>ys?`${a.slice(0,ys-1)}\u2026`:a},ut=n=>`${n.kind}:${n.id}`,Pi=n=>{const t=new Map;for(const e of n)t.set(ut(e),(t.get(ut(e))??0)+1);return n.filter(e=>t.get(ut(e))===1)},ws=(n,t)=>`element:${[n,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,Oi="[data-dpk-item]",qi="h1, h2, h3, h4, h5, h6, summary, caption, legend";class $s extends z{static{this.styles=[T,B,gt,M`
2099
+ </div>`}}const Ds=()=>{customElements.get("dpk-diff")||customElements.define("dpk-diff",Rs)},mr=D({en:{heading:"Video",play:"Play (k)",pause:"Pause (k)",mute:"Mute (m)",unmute:"Unmute (m)",volume:"Volume",seek:"Seek",fullscreen:"Full screen (f)",exitFullscreen:"Exit full screen (f)",captions:"Captions (c)",openPanel:"Chapters and comments",closePanel:"Close",chapters:"Chapters",comments:"Comments",noComments:"No comments yet.",commentAt:n=>`Comment at ${n}`,noteAt:n=>`Note at ${n}`,kind:"Kind",reviewComment:"Review comment",note:"Note",commentPlaceholder:"Post a comment",notePlaceholder:"Leave a note",noteTitle:n=>`Note: ${n}`,keepNote:"Keep",submit:"Send",notSaved:"Could not be recorded (place it inside a dpk-view-* element)."},ja:{heading:"\u52D5\u753B",play:"\u518D\u751F (k)",pause:"\u4E00\u6642\u505C\u6B62 (k)",mute:"\u30DF\u30E5\u30FC\u30C8 (m)",unmute:"\u30DF\u30E5\u30FC\u30C8\u89E3\u9664 (m)",volume:"\u97F3\u91CF",seek:"\u518D\u751F\u4F4D\u7F6E",fullscreen:"\u5168\u753B\u9762 (f)",exitFullscreen:"\u5168\u753B\u9762\u3092\u7D42\u4E86 (f)",captions:"\u5B57\u5E55 (c)",openPanel:"\u30C1\u30E3\u30D7\u30BF\u30FC\u3068\u30B3\u30E1\u30F3\u30C8",closePanel:"\u9589\u3058\u308B",chapters:"\u30C1\u30E3\u30D7\u30BF\u30FC",comments:"\u30B3\u30E1\u30F3\u30C8",noComments:"\u30B3\u30E1\u30F3\u30C8\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",commentAt:n=>`${n} \u3078\u306E\u30B3\u30E1\u30F3\u30C8`,noteAt:n=>`${n} \u3078\u306E\u30E1\u30E2`,kind:"\u7A2E\u985E",reviewComment:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",note:"\u30E1\u30E2",commentPlaceholder:"\u30B3\u30E1\u30F3\u30C8\u3092\u6295\u7A3F",notePlaceholder:"\u30E1\u30E2\u3092\u6B8B\u3059",noteTitle:n=>`\u30E1\u30E2: ${n}`,keepNote:"\u6B8B\u3059",submit:"\u9001\u4FE1",notSaved:"\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"}}),Os=["white","yellow","green","pink","blue","orange"],yt={lead:0,gap:0,tail:0},Is=.45,gr=.12,fr=1.5,br=new Intl.Segmenter,kr=/^[A-Za-z0-9_-]+$/,Rt=n=>y(b(),Wt(kr,`${n} may only contain letters, digits, "_" and "-"`)),j=y(st(),De(0)),qs=y(st(),De(0),ua(1)),vr=x({id:P(Rt("a cue id")),text:P(y(b(),S(1))),voice:P(y(b(),S(1))),tone:P(Z(Os)),audio:P(y(b(),S(1))),duration:P(j),at:P(j)}),xr=x({id:Rt("a note id"),at:P(j),body:y(b(),S(1))}),yr=x({id:Rt("a scene id"),title:y(b(),S(1)),cues:g($(vr),[]),notes:g($(xr),[]),duration:P(j)}),wr=x({audio:y(b(),S(1)),volume:g(qs,1),duck:P(qs),loop:g(nt(),!1),from:P(b()),to:P(b()),offset:g(j,0),fade:g(j,0)}),$r=x({scenes:y($(yr),S(1)),tracks:g($(wr),[]),pacing:g(x({lead:g(j,yt.lead),gap:g(j,yt.gap),tail:g(j,yt.tail)}),yt),voices:g(Oe(y(b(),S(1)),x({tone:P(Z(Os))})),{}),fade:g(j,Is)}),re=()=>({scenes:[],tracks:[],pacing:yt,voices:{},fade:Is}),Us=n=>{const t=B($r,n),e=new Map,s=new Set;for(const[a,i]of t.scenes.entries()){if(e.has(i.id))throw new Error(`duplicate scene id: ${i.id}`);for(const o of i.notes){if(s.has(o.id))throw new Error(`duplicate note id: ${o.id}`);s.add(o.id)}if(e.set(i.id,a),i.cues.length===0&&i.duration===void 0)throw new Error(`scene ${i.id}: a scene without cues needs a duration`);const r=new Set;for(const[o,l]of i.cues.entries()){const c=l.id??String(o);if(r.has(c))throw new Error(`scene ${i.id}: duplicate cue id "${c}"`);r.add(c)}}for(const a of t.tracks){for(const i of[a.from,a.to])if(i!==void 0&&!e.has(i))throw new Error(`track ${a.audio}: unknown scene "${i}"`);if((e.get(a.from??"")??0)>(e.get(a.to??"")??1/0))throw new Error(`track ${a.audio}: "from" comes after "to"`)}return t},Cr=n=>[...new Set([...n.scenes.flatMap(t=>t.cues.flatMap(e=>e.audio===void 0?[]:[e.audio])),...n.tracks.map(t=>t.audio)])],Sr=(n,t)=>n.duration??(n.audio===void 0?null:t(n.audio))??(n.text===void 0?0:Math.max(fr,[...br.segment(n.text)].length*gr)),Er=(n,t)=>{const{lead:e,gap:s,tail:a}=n.pacing;let i=0;const r=n.scenes.map(p=>{const m=i;let f=null,E=m+(p.duration??0);const R=p.cues.map((M,Y)=>{const I=M.at!==void 0?m+M.at:f===null?m+e:f+s,z={...M,key:M.id??String(Y),captionTone:M.tone??(M.voice===void 0?void 0:n.voices[M.voice]?.tone)??null,start:I,end:I+Sr(M,t)};return f=z.end,E=Math.max(E,z.end+(M.at===void 0?a:0)),z});return i=E,{id:p.id,title:p.title,start:m,end:E,cues:R}}),o=i,l=new Map(r.map(p=>[p.id,p])),c=n.tracks.map(p=>{const m=t(p.audio),f=(p.from===void 0?0:l.get(p.from)?.start??0)+p.offset,E=p.to===void 0?o:l.get(p.to)?.end??o,R=p.loop||m===null?E:Math.min(E,f+m);return{...p,start:f,end:R,length:m}});return{duration:o,scenes:r,tracks:c}},tt=(n,t)=>{let e=0;for(const[s,a]of n.scenes.entries())t>=a.start&&(e=s);return e},Ns=(n,t,e=0)=>{const s=n.scenes[tt(n,t)]?.cues??[];let a=null;for(const i of s)t>=i.start&&t<i.end+e&&(a===null||i.start>=a.start)&&(a=i);return a},Tr=(n,t)=>n.scenes.some(e=>e.cues.some(s=>s.audio!==void 0&&t>=s.start&&t<s.end)),Mr=(n,t)=>{if(t<n.start||t>=n.end)return null;const e=t-n.start;return n.loop===!0&&n.length!==null&&n.length>0?e%n.length:e},Ar=(n,t)=>{const e=n.fade??0;return e<=0?1:Math.min(1,Math.max(0,Math.min(t-n.start,n.end-t)/e))},V=n=>{const t=Math.max(0,Math.floor(n)),e=Math.floor(t/3600),s=Math.floor(t%3600/60),a=String(t%60).padStart(2,"0");return e>0?`${e}:${String(s).padStart(2,"0")}:${a}`:`${s}:${a}`},Dt=n=>`element:${n.map(t=>encodeURIComponent(t)).join("/")}`,js=(n,t)=>Dt([n,"scene",t]),zr=(n,t,e)=>{const s=t.scenes[tt(t,e)];return Dt(s===void 0?[n,"at","0"]:[n,"scene",s.id,"at",String(Math.max(0,Math.round((e-s.start)*1e3)))])},Fs=(n,t,e,{scenes:s=!1}={})=>{const a=`${Dt([n,"scene"])}/`;if(!e.startsWith(a))return null;const i=/^([^/]+)(?:\/at\/(\d+))?$/.exec(e.slice(a.length));if(i===null||i[2]===void 0&&!s)return null;const r=t.scenes.find(o=>o.id===decodeURIComponent(i[1]??""));return r===void 0?null:{scene:r,time:Math.min(r.end,r.start+Number(i[2]??0)/1e3)}},Hs="ADD_NOTE",_r=x({id:Rt("a note id"),at:P(j),body:y(b(),S(1))}),Lr=(n,t,e)=>{const s=new Map(t.scenes.map(r=>[r.id,[...r.notes]])),a=new Set(t.scenes.flatMap(r=>r.notes.map(o=>o.id))),i=e.map(r=>{if(r.type!==Hs)return{id:r.id,title:r.type,stale:"unsupported-action-type"};const o=Kt(r.target.id),l=o?.length===3&&o[1]==="scene"?o[2]:void 0,c=t.scenes.find(E=>E.id===l),p=c===void 0?void 0:s.get(c.id);if(c===void 0||p===void 0)return{id:r.id,title:n.noteTitle(l??r.target.id),stale:"target-missing"};const m=St(_r,r.payload),f=n.noteTitle(c.title);return!m.success||a.has(m.output.id)?{id:r.id,title:f,stale:"constraint-violated"}:(a.add(m.output.id),p.push(m.output),{id:r.id,title:f,summary:m.output.body,tone:"create"})});return{data:{...t,scenes:t.scenes.map(r=>({...r,notes:s.get(r.id)??r.notes}))},results:i}},Pr=.3,Rr=600,Dr=.2,Or=8e3,Ir=1,qr=3,Ur=(n,t,e)=>{const s=Math.abs(t-e);return n.loop&&n.length!==null?Math.min(s,n.length-s):s},Nr=n=>new Promise(t=>{const e=()=>{clearTimeout(s),n.removeEventListener("loadedmetadata",e),n.removeEventListener("error",e),t(Number.isFinite(n.duration)?n.duration:null)};n.addEventListener("loadedmetadata",e),n.addEventListener("error",e);const s=setTimeout(e,Or);n.readyState>=Ir&&e()});class jr{#a=new Map;#t=[];#e=new Map;#n=new Map;#s=0;#i=null;#r=1;#o=!1;#l=!1;async measure(t,e){this.#p();const s=await Promise.all(t.map(async a=>{const i=new Audio;return i.preload="metadata",i.src=e(a),this.#a.set(a,i),[a,await Nr(i)]}));return new Map(s)}load(t){this.stop(),this.#i=t,this.#l=!1,this.#e.clear(),this.#n.clear();const e=new Set,s=i=>{const r=this.#a.get(i);if(r===void 0)return null;if(!e.has(i))return e.add(i),r;const o=new Audio;return o.preload=r.preload,o.src=r.src,o},a=[];for(const i of t.scenes.flatMap(r=>r.cues)){const r=i.audio===void 0?null:s(i.audio);r!==null&&a.push({audio:r,start:i.start,end:i.end,loop:!1,length:null,volume:1,duck:null,fade:0})}for(const i of t.tracks){const r=s(i.audio);r!==null&&(a.push({audio:r,start:i.start,end:i.end,loop:i.loop,length:i.length,volume:i.volume,duck:i.duck??null,fade:i.fade}),r.loop=i.loop)}this.#t=a}setVolume(t,e){this.#r=Math.min(1,Math.max(0,t)),this.#o=e}sync(t,e,s){const a=this.#i;if(a===null)return;if(e&&!this.#l){this.#l=!0;for(const{audio:l}of this.#t)l.preload="auto"}const i=performance.now(),r=1-Math.exp(-(i-this.#s)/1e3/Dr);this.#s=i;const o=Tr(a,t);for(const l of this.#t){const{audio:c}=l,p=e?Mr(l,t):null;if(p===null){c.paused||c.pause();continue}const m=s||c.paused;(m||this.#c(l,i)&&Ur(l,c.currentTime,p)>Pr)&&(c.currentTime=p,this.#n.set(l,i));const f=Number(o&&l.duck!==null),E=m?f:(this.#e.get(l)??f)*(1-r)+f*r;this.#e.set(l,E);const R=l.volume+((l.duck??l.volume)-l.volume)*E;c.muted=this.#o,c.volume=Math.min(1,Math.max(0,R*Ar(l,t)*this.#r)),c.paused&&c.play().catch(()=>{})}}#c(t,e){const{audio:s}=t;return!s.seeking&&s.readyState>=qr&&e-(this.#n.get(t)??-1/0)>=Rr}stop(){for(const{audio:t}of this.#t)t.pause()}#p(){this.stop();for(const t of new Set([...this.#a.values(),...this.#t.map(e=>e.audio)]))t.removeAttribute("src"),t.load();this.#a.clear(),this.#t=[]}}const Fr=_`
2100
+ :host {
2101
+ --dpk-video-aspect: 16 / 9;
2102
+ --dpk-video-progress: var(--dpk-accent);
2103
+ --panel-width: 320px;
2104
+ --on-video: #fff;
2105
+ --on-video-soft: rgb(255 255 255 / 0.78);
2106
+ --on-video-faint: rgb(255 255 255 / 0.32);
2107
+ --dpk-video-safe-bottom: 0px;
2108
+ display: block;
2109
+ container-type: inline-size;
2110
+ color: var(--dpk-ink);
2111
+ font-family: var(--dpk-body);
2112
+ }
2113
+
2114
+ .frame {
2115
+ display: grid;
2116
+ grid-template-columns: minmax(0, 1fr);
2117
+ gap: 12px;
2118
+ }
2119
+
2120
+ :host([controls-visible]) {
2121
+ --dpk-video-safe-bottom: 64px;
2122
+ }
2123
+
2124
+ :host([panel-open]) .frame {
2125
+ grid-template-columns: minmax(0, 1fr) var(--panel-width);
2126
+ }
2127
+
2128
+ @container (max-width: 720px) {
2129
+ :host([panel-open]) .frame {
2130
+ grid-template-columns: minmax(0, 1fr);
2131
+ }
2132
+
2133
+ .panel {
2134
+ height: 360px;
2135
+ }
2136
+ }
2137
+
2138
+ .frame[data-fullscreen] {
2139
+ grid-template-rows: minmax(0, 1fr);
2140
+ gap: 0;
2141
+ height: 100%;
2142
+ background: #000;
2143
+ }
2144
+
2145
+ /* ------------------------------------------------------------ player */
2146
+
2147
+ .player {
2148
+ position: relative;
2149
+ overflow: hidden;
2150
+ border-radius: var(--dpk-radius);
2151
+ background: #000;
2152
+ outline: none;
2153
+ box-shadow: var(--dpk-shadow-sm);
2154
+ }
2155
+
2156
+ .player:focus-visible {
2157
+ box-shadow: var(--dpk-focus);
2158
+ }
2159
+
2160
+ .player[data-idle] {
2161
+ cursor: none;
2162
+ }
2163
+
2164
+ /* The open panel takes its width from the player, not its height: the picture shrinks between black bars. */
2165
+ :host([panel-open]) .player,
2166
+ .frame[data-fullscreen] .player {
2167
+ display: grid;
2168
+ place-items: center;
2169
+ container-type: size;
2170
+ }
2171
+
2172
+ :host([panel-open]) .frame:not([data-fullscreen]) .player {
2173
+ height: calc(100cqw / (var(--dpk-video-aspect)));
2174
+ }
2175
+
2176
+ .frame[data-fullscreen] .player {
2177
+ height: 100%;
2178
+ border-radius: 0;
2179
+ box-shadow: none;
2180
+ }
2181
+
2182
+ .stage {
2183
+ position: relative;
2184
+ overflow: hidden;
2185
+ width: 100%;
2186
+ aspect-ratio: var(--dpk-video-aspect);
2187
+ container: dpk-stage / size;
2188
+ cursor: pointer;
2189
+ }
2190
+
2191
+ :host([panel-open]) .stage,
2192
+ .frame[data-fullscreen] .stage {
2193
+ width: min(100cqw, 100cqh * (var(--dpk-video-aspect)));
2194
+ }
2195
+
2196
+ ::slotted(*) {
2197
+ position: absolute;
2198
+ inset: 0;
2199
+ }
2200
+
2201
+ :host(:not([scene])) ::slotted([data-scene]) {
2202
+ visibility: hidden;
2203
+ }
2204
+
2205
+ .subtitle {
2206
+ --fill: #fff;
2207
+ --edge: #111;
2208
+ --rim: #111;
2209
+ --rim-line: var(--dpk-video-caption-rim, var(--rim));
2210
+ position: absolute;
2211
+ left: 50%;
2212
+ bottom: calc(2.5cqh + var(--dpk-video-safe-bottom));
2213
+ z-index: 2;
2214
+ width: max-content;
2215
+ max-width: 84%;
2216
+ margin: 0;
2217
+ color: var(--dpk-video-caption-fill, var(--fill));
2218
+ font-size: clamp(14px, 2.6cqw, 36px);
2219
+ font-weight: 800;
2220
+ letter-spacing: 0.03em;
2221
+ line-height: 1.4;
2222
+ text-align: center;
2223
+ text-wrap: balance;
2224
+ word-break: auto-phrase;
2225
+ -webkit-text-stroke: 0.22em var(--dpk-video-caption-edge, var(--edge));
2226
+ paint-order: stroke fill;
2227
+ filter: drop-shadow(0.05em 0 0 var(--rim-line)) drop-shadow(-0.05em 0 0 var(--rim-line))
2228
+ drop-shadow(0 0.05em 0 var(--rim-line)) drop-shadow(0 -0.05em 0 var(--rim-line))
2229
+ drop-shadow(0 0.08em 0.12em rgb(0 0 0 / 0.5));
2230
+ translate: -50% 0;
2231
+ transition: bottom var(--dpk-dur) var(--dpk-ease);
2232
+ }
2233
+
2234
+ .subtitle[data-tone='yellow'] {
2235
+ --fill: #ffe14a;
2236
+ --edge: #2a1f00;
2237
+ --rim: #2a1f00;
2238
+ }
2239
+
2240
+ .subtitle[data-tone='green'] {
2241
+ --fill: #2fb344;
2242
+ --edge: #fff;
2243
+ --rim: #0f4a1a;
2244
+ }
2245
+
2246
+ .subtitle[data-tone='pink'] {
2247
+ --fill: #f0368c;
2248
+ --edge: #fff;
2249
+ --rim: #5c0d33;
2250
+ }
2251
+
2252
+ .subtitle[data-tone='blue'] {
2253
+ --fill: #1f86f0;
2254
+ --edge: #fff;
2255
+ --rim: #0a2f5c;
2256
+ }
2257
+
2258
+ .subtitle[data-tone='orange'] {
2259
+ --fill: #f2730f;
2260
+ --edge: #fff;
2261
+ --rim: #5c2700;
2262
+ }
2263
+
2264
+ .voice {
2265
+ margin-right: 0.6em;
2266
+ }
2267
+
2268
+ .sr-only {
2269
+ position: absolute;
2270
+ width: 1px;
2271
+ height: 1px;
2272
+ overflow: hidden;
2273
+ clip-path: inset(50%);
2274
+ white-space: nowrap;
2275
+ }
2276
+
2277
+ .big-play {
2278
+ position: absolute;
2279
+ inset: 0;
2280
+ z-index: 2;
2281
+ display: grid;
2282
+ place-items: center;
2283
+ margin: auto;
2284
+ width: clamp(48px, 9cqw, 88px);
2285
+ height: clamp(48px, 9cqw, 88px);
2286
+ border-radius: 50%;
2287
+ background: rgb(0 0 0 / 0.55);
2288
+ color: var(--on-video);
2289
+ pointer-events: none;
2290
+ box-shadow: 0 0 0 1px var(--on-video-faint);
2291
+ }
2292
+
2293
+ .big-play svg {
2294
+ width: 42%;
2295
+ height: 42%;
2296
+ translate: 6% 0;
2297
+ fill: currentColor;
2298
+ }
2299
+
2300
+ .error {
2301
+ margin: 0;
2302
+ padding: 12px 14px;
2303
+ border: 1px solid var(--dpk-danger);
2304
+ border-radius: var(--dpk-radius-sm);
2305
+ color: var(--dpk-danger);
2306
+ font-family: var(--dpk-mono);
2307
+ font-size: var(--dpk-text-xs);
2308
+ }
2309
+
2310
+ /* ------------------------------------------------------------ chrome */
2311
+
2312
+ .chrome {
2313
+ position: absolute;
2314
+ right: 0;
2315
+ bottom: 0;
2316
+ left: 0;
2317
+ z-index: 3;
2318
+ padding: 28px 12px 6px;
2319
+ background: linear-gradient(transparent, rgb(0 0 0 / 0.7));
2320
+ color: var(--on-video);
2321
+ transition: opacity var(--dpk-dur) var(--dpk-ease);
2322
+ }
2323
+
2324
+ .frame[data-fullscreen] .chrome {
2325
+ position: fixed;
2326
+ }
2327
+
2328
+ :host([panel-open]) .frame[data-fullscreen] .chrome {
2329
+ right: var(--panel-width);
2330
+ }
2331
+
2332
+ .player[data-idle] .chrome {
2333
+ opacity: 0;
2334
+ pointer-events: none;
2335
+ }
2336
+
2337
+ .bar {
2338
+ position: relative;
2339
+ display: flex;
2340
+ align-items: center;
2341
+ height: 18px;
2342
+ outline: none;
2343
+ cursor: pointer;
2344
+ touch-action: none;
2345
+ }
2346
+
2347
+ .segments {
2348
+ display: flex;
2349
+ gap: 3px;
2350
+ width: 100%;
2351
+ }
2352
+
2353
+ .segment {
2354
+ position: relative;
2355
+ flex-basis: 0;
2356
+ min-width: 2px;
2357
+ height: 4px;
2358
+ overflow: hidden;
2359
+ border-radius: 2px;
2360
+ background: var(--on-video-faint);
2361
+ transition: transform var(--dpk-dur-fast) var(--dpk-ease);
2362
+ }
2363
+
2364
+ .segment::before,
2365
+ .segment::after {
2366
+ content: '';
2367
+ position: absolute;
2368
+ inset: 0;
2369
+ transform-origin: left;
2370
+ }
2371
+
2372
+ .segment::before {
2373
+ background: rgb(255 255 255 / 0.4);
2374
+ transform: scaleX(var(--hover));
2375
+ }
2376
+
2377
+ .segment::after {
2378
+ background: var(--dpk-video-progress);
2379
+ transform: scaleX(var(--fill));
2380
+ }
2381
+
2382
+ .segment[data-hovered] {
2383
+ transform: scaleY(1.6);
2384
+ }
2385
+
2386
+ .thumb {
2387
+ position: absolute;
2388
+ left: calc(var(--progress) * 100%);
2389
+ width: 13px;
2390
+ height: 13px;
2391
+ border-radius: 50%;
2392
+ background: var(--dpk-video-progress);
2393
+ translate: -50% 0;
2394
+ scale: 0;
2395
+ transition: scale var(--dpk-dur-fast) var(--dpk-ease-spring);
2396
+ pointer-events: none;
2397
+ }
2398
+
2399
+ .bar:hover .thumb,
2400
+ .bar:focus-visible .thumb {
2401
+ scale: 1;
2402
+ }
2403
+
2404
+ .bar:focus-visible .segments {
2405
+ border-radius: 3px;
2406
+ box-shadow: 0 0 0 3px rgb(255 255 255 / 0.5);
2407
+ }
2408
+
2409
+ .tooltip {
2410
+ position: absolute;
2411
+ bottom: 24px;
2412
+ left: clamp(72px, calc(var(--at) * 100%), calc(100% - 72px));
2413
+ display: grid;
2414
+ justify-items: center;
2415
+ gap: 1px;
2416
+ max-width: 240px;
2417
+ padding: 5px 9px;
2418
+ border-radius: var(--dpk-radius-sm);
2419
+ background: rgb(20 20 20 / 0.92);
2420
+ color: var(--on-video);
2421
+ font-size: var(--dpk-text-2xs);
2422
+ line-height: 1.35;
2423
+ white-space: nowrap;
2424
+ translate: -50% 0;
2425
+ pointer-events: none;
2426
+ box-shadow: var(--dpk-shadow-sm);
2427
+ }
2428
+
2429
+ .tooltip b {
2430
+ max-width: 100%;
2431
+ overflow: hidden;
2432
+ font-weight: 650;
2433
+ text-overflow: ellipsis;
2434
+ }
2435
+
2436
+ .tooltip span {
2437
+ color: var(--on-video-soft);
2438
+ }
2439
+
2440
+ .controls {
2441
+ display: flex;
2442
+ align-items: center;
2443
+ gap: 2px;
2444
+ height: 40px;
2445
+ }
2446
+
2447
+ .ctl {
2448
+ display: grid;
2449
+ place-items: center;
2450
+ width: 36px;
2451
+ height: 36px;
2452
+ padding: 0;
2453
+ border: 0;
2454
+ border-radius: var(--dpk-radius-sm);
2455
+ background: transparent;
2456
+ color: var(--on-video);
2457
+ cursor: pointer;
2458
+ transition:
2459
+ background var(--dpk-dur-fast) var(--dpk-ease),
2460
+ transform var(--dpk-dur-fast) var(--dpk-ease);
2461
+ }
2462
+
2463
+ .ctl:hover:not([disabled]) {
2464
+ background: rgb(255 255 255 / 0.14);
2465
+ }
2466
+
2467
+ .ctl:active:not([disabled]) {
2468
+ transform: scale(0.92);
2469
+ }
2470
+
2471
+ .ctl:focus-visible {
2472
+ outline: none;
2473
+ box-shadow: 0 0 0 2px rgb(255 255 255 / 0.7);
2474
+ }
2475
+
2476
+ .ctl[disabled] {
2477
+ opacity: 0.4;
2478
+ cursor: default;
2479
+ }
2480
+
2481
+ .ctl[aria-pressed='true'] {
2482
+ background: rgb(255 255 255 / 0.2);
2483
+ }
2484
+
2485
+ .ctl svg {
2486
+ width: 20px;
2487
+ height: 20px;
2488
+ }
2489
+
2490
+ .volume {
2491
+ display: flex;
2492
+ align-items: center;
2493
+ }
2494
+
2495
+ .volume input {
2496
+ width: 0;
2497
+ height: 4px;
2498
+ margin: 0;
2499
+ border-radius: 2px;
2500
+ background: linear-gradient(
2501
+ to right,
2502
+ var(--on-video) calc(var(--level) * 100%),
2503
+ var(--on-video-faint) calc(var(--level) * 100%)
2504
+ );
2505
+ opacity: 0;
2506
+ appearance: none;
2507
+ cursor: pointer;
2508
+ transition:
2509
+ width var(--dpk-dur) var(--dpk-ease),
2510
+ opacity var(--dpk-dur) var(--dpk-ease),
2511
+ margin var(--dpk-dur) var(--dpk-ease);
2512
+ }
2513
+
2514
+ .volume:hover input,
2515
+ .volume:focus-within input {
2516
+ width: 72px;
2517
+ margin: 0 8px 0 4px;
2518
+ opacity: 1;
2519
+ }
2520
+
2521
+ .volume input::-webkit-slider-thumb {
2522
+ width: 12px;
2523
+ height: 12px;
2524
+ border-radius: 50%;
2525
+ background: var(--on-video);
2526
+ appearance: none;
2527
+ }
2528
+
2529
+ .volume input::-moz-range-thumb {
2530
+ width: 12px;
2531
+ height: 12px;
2532
+ border: 0;
2533
+ border-radius: 50%;
2534
+ background: var(--on-video);
2535
+ }
2536
+
2537
+ .volume input:focus-visible {
2538
+ outline: none;
2539
+ box-shadow: 0 0 0 3px rgb(255 255 255 / 0.4);
2540
+ }
2541
+
2542
+ .time {
2543
+ padding: 0 8px;
2544
+ color: var(--on-video-soft);
2545
+ font-size: var(--dpk-text-xs);
2546
+ white-space: nowrap;
2547
+ }
2548
+
2549
+ .spacer {
2550
+ flex: 1;
2551
+ }
2552
+
2553
+ /* ------------------------------------------------------------- panel */
2554
+
2555
+ .panel {
2556
+ position: relative;
2557
+ min-height: 240px;
2558
+ overflow: hidden;
2559
+ border: 1px solid var(--dpk-rule);
2560
+ border-radius: var(--dpk-radius);
2561
+ background: var(--dpk-paper-raised);
2562
+ box-shadow: var(--dpk-shadow-xs);
2563
+ }
2564
+
2565
+ .frame[data-fullscreen] .panel {
2566
+ border-width: 0 0 0 1px;
2567
+ border-radius: 0;
2568
+ }
2569
+
2570
+ .panel-body {
2571
+ position: absolute;
2572
+ inset: 0;
2573
+ display: flex;
2574
+ flex-direction: column;
2575
+ }
2576
+
2577
+ .panel-head {
2578
+ display: flex;
2579
+ align-items: center;
2580
+ gap: 8px;
2581
+ padding: 10px 10px 10px 12px;
2582
+ border-bottom: 1px solid var(--dpk-rule);
2583
+ }
2584
+
2585
+ .panel-head .comment-kinds {
2586
+ flex: 1;
2587
+ font-size: var(--dpk-text-xs);
2588
+ }
2589
+
2590
+ .panel-title {
2591
+ flex: 1;
2592
+ margin: 0;
2593
+ font-size: var(--dpk-text-sm);
2594
+ font-weight: 650;
2595
+ }
2596
+
2597
+ .count {
2598
+ display: inline-block;
2599
+ min-width: 1.6em;
2600
+ margin-left: 2px;
2601
+ padding: 0 5px;
2602
+ border-radius: 999px;
2603
+ background: var(--dpk-paper-inset);
2604
+ color: var(--dpk-ink-soft);
2605
+ font-size: var(--dpk-text-2xs);
2606
+ text-align: center;
2607
+ }
2608
+
2609
+ .chapters,
2610
+ .moments {
2611
+ flex: 1;
2612
+ display: grid;
2613
+ align-content: start;
2614
+ gap: 2px;
2615
+ margin: 0;
2616
+ padding: 6px;
2617
+ overflow: auto;
2618
+ list-style: none;
2619
+ }
2620
+
2621
+ .chapter {
2622
+ position: relative;
2623
+ display: grid;
2624
+ grid-template-columns: 3.2em minmax(0, 1fr);
2625
+ gap: 10px;
2626
+ width: 100%;
2627
+ padding: 8px 10px;
2628
+ overflow: hidden;
2629
+ border: 0;
2630
+ border-radius: var(--dpk-radius-sm);
2631
+ background: transparent;
2632
+ color: var(--dpk-ink-soft);
2633
+ font: inherit;
2634
+ font-size: var(--dpk-text-sm);
2635
+ text-align: left;
2636
+ cursor: pointer;
2637
+ transition: background var(--dpk-dur-fast) var(--dpk-ease);
2638
+ }
2639
+
2640
+ .chapter:hover {
2641
+ background: var(--dpk-paper-sunken);
2642
+ color: var(--dpk-ink);
2643
+ }
2644
+
2645
+ .chapter:focus-visible {
2646
+ outline: none;
2647
+ box-shadow: var(--dpk-focus);
2648
+ }
2649
+
2650
+ .chapter[aria-current='true'] {
2651
+ background: var(--dpk-blue-soft);
2652
+ color: var(--dpk-ink);
2653
+ font-weight: 600;
2654
+ }
2655
+
2656
+ .chapter[aria-current='true']::after {
2657
+ content: '';
2658
+ position: absolute;
2659
+ bottom: 0;
2660
+ left: 0;
2661
+ width: calc(var(--progress) * 100%);
2662
+ height: 2px;
2663
+ background: var(--dpk-blue);
2664
+ }
2665
+
2666
+ .chapter-time {
2667
+ color: var(--dpk-ink-faint);
2668
+ font-family: var(--dpk-mono);
2669
+ font-size: var(--dpk-text-2xs);
2670
+ line-height: 1.7;
2671
+ }
2672
+
2673
+ .chapter-title {
2674
+ overflow-wrap: anywhere;
2675
+ }
2676
+
2677
+ .empty {
2678
+ flex: 1;
2679
+ margin: 0;
2680
+ padding: 16px 14px;
2681
+ color: var(--dpk-ink-faint);
2682
+ font-size: var(--dpk-text-sm);
2683
+ }
2684
+
2685
+ .moment {
2686
+ display: grid;
2687
+ grid-template-columns: auto minmax(0, 1fr) auto;
2688
+ align-items: center;
2689
+ gap: 6px 8px;
2690
+ padding: 8px 8px 10px;
2691
+ border-radius: var(--dpk-radius-sm);
2692
+ }
2693
+
2694
+ .moment + .moment {
2695
+ border-top: 1px solid var(--dpk-rule);
2696
+ }
2697
+
2698
+ .moment-time {
2699
+ padding: 1px 7px;
2700
+ border: 1px solid var(--dpk-rule-strong);
2701
+ border-radius: var(--dpk-radius-xs);
2702
+ background: var(--dpk-paper-raised);
2703
+ color: var(--dpk-blue-strong);
2704
+ font-family: var(--dpk-mono);
2705
+ font-size: var(--dpk-text-2xs);
2706
+ cursor: pointer;
2707
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
2708
+ }
2709
+
2710
+ .moment-time:hover {
2711
+ background: var(--dpk-blue-soft);
2712
+ }
2713
+
2714
+ .moment-time:focus-visible {
2715
+ outline: none;
2716
+ box-shadow: var(--dpk-focus);
2717
+ }
2718
+
2719
+ .moment-scene {
2720
+ overflow: hidden;
2721
+ color: var(--dpk-ink-faint);
2722
+ font-size: var(--dpk-text-2xs);
2723
+ text-overflow: ellipsis;
2724
+ white-space: nowrap;
2725
+ }
2726
+
2727
+ .moment-kind {
2728
+ display: inline-grid;
2729
+ color: var(--dpk-ink-faint);
2730
+ }
2731
+
2732
+ .moment-kind svg {
2733
+ width: 13px;
2734
+ height: 13px;
2735
+ }
2736
+
2737
+ .moment-body {
2738
+ grid-column: 1 / -1;
2739
+ margin: 0;
2740
+ font-size: var(--dpk-text-sm);
2741
+ line-height: 1.55;
2742
+ white-space: pre-wrap;
2743
+ overflow-wrap: anywhere;
2744
+ }
2745
+
2746
+ .composer {
2747
+ display: grid;
2748
+ gap: 6px;
2749
+ padding: 10px 12px 12px;
2750
+ border-top: 1px solid var(--dpk-rule);
2751
+ background: var(--dpk-paper-sunken);
2752
+ }
2753
+ `,Hr=':scope > script[type="application/json"]',Wr=1280,Ws=":scope > [data-scene]",Br=":scope > :not([data-scene], script)",Bs=.25,Kr=2500,Ks=5,Vr=()=>`note-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,Vs=({scene:n,time:t})=>`${V(t)} \xB7 ${n.title}`,G=(n,t,e)=>Math.min(e,Math.max(t,n)),Gr=n=>{const t=n.payload;return typeof t=="object"&&t!==null&&"body"in t&&typeof t.body=="string"?t.body:""},Jr=new Set([" ","enter","arrowleft","arrowright","arrowup","arrowdown","home","end"]),Xr=n=>n.composedPath().some(t=>t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&t.type!=="range"||t instanceof HTMLElement&&t.isContentEditable),Yr=n=>{const t=n.composedPath()[0];return t instanceof HTMLInputElement||t instanceof HTMLButtonElement},Zr=n=>{const t=[],e=s=>{s instanceof HTMLElement&&s.localName.startsWith("dpk-")&&!s.inert&&(s.inert=!0);const a=s.shadowRoot;if(a!==null){t.push(a);for(const i of a.querySelectorAll("*"))e(i)}};e(n);for(const s of n.querySelectorAll("*"))e(s);return t};class Qr{#a=new WeakMap;drive(t,e,s){const a=this.#a.get(t)??new Set;this.#a.set(t,a);const i=t.getAnimations({subtree:!0});if(s)for(const r of Zr(t))i.push(...r.getAnimations());for(const r of i)"transitionProperty"in r||a.add(r);for(const r of a){const o=r.effect instanceof KeyframeEffect?r.effect.target:null;if(r.playState==="idle"||o===null||!o.isConnected){a.delete(r);continue}r.pause(),r.currentTime=e}}}class Gs extends A{static{this.styles=[L,J,ht,Kn(),fa,Fr]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},panelOpen:{type:Boolean,reflect:!0,attribute:"panel-open"},designWidth:{type:Number,attribute:"design-width"},_time:{state:!0},_playing:{state:!0},_timeline:{state:!0},_dataError:{state:!0},_volume:{state:!0},_muted:{state:!0},_captions:{state:!0},_idle:{state:!0},_fullscreen:{state:!0},_tab:{state:!0},_hover:{state:!0},_draft:{state:!0},_kind:{state:!0},_unrecorded:{state:!0}}}#a=new O(this,()=>{this.#k="",this.#S()});#t=new jr;#e=new Qr;#n=new MutationObserver(()=>{this.#E()});#s=new MutationObserver(()=>{this.#E()});#i=new MutationObserver(()=>{this.#E()});#r=null;#o=re();#l=re();#c=[];#p=[];#g=null;#u={time:0,now:0};#d=0;#m=0;#b=0;#x=[];#f=new Set;#k="";#h=!0;#C=!1;#w=0;#y=new ResizeObserver(([t])=>{t!==void 0&&(this.#w=t.contentRect.width,this.#_())});constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.panelOpen=!1,this.designWidth=Wr,this._time=0,this._playing=!1,this._timeline=null,this._dataError=null,this._volume=1,this._muted=!1,this._captions=!0,this._idle=!1,this._fullscreen=!1,this._tab="chapters",this._hover=null,this._draft="",this._kind="comment",this._unrecorded=!1}connectedCallback(){super.connectedCallback(),this.#k="",this.#h=!0,document.addEventListener("fullscreenchange",this.#I),this.toggleAttribute("playing",this._playing),this.#n.observe(this,{childList:!0}),this.#s.observe(this,{attributes:!0,attributeFilter:["data-scene"],subtree:!0}),this.#E(),this.updateComplete.then(()=>{const t=this.renderRoot.querySelector(".stage");t!==null&&this.isConnected&&this.#y.observe(t)})}disconnectedCallback(){super.disconnectedCallback(),this.#y.disconnect(),this.#n.disconnect(),this.#s.disconnect(),this.#i.disconnect(),this.#r=null,document.removeEventListener("fullscreenchange",this.#I),this.pause(),clearTimeout(this.#m)}updated(t){(this.#h||t.has("_timeline")||t.has("id")||t.has("heading"))&&(this.#h=!1,this.#A()),this.toggleAttribute("controls-visible",!this._playing||!this._idle),t.has("_timeline")&&this.#T(),t.has("designWidth")&&this.#_()}get dataError(){return this._dataError}get duration(){return this._timeline?.duration??0}get currentTime(){return this._time}set currentTime(t){this.seek(t)}get paused(){return!this._playing}play(){const t=this._timeline;if(t===null||this._playing)return;this._time>=t.duration-.05&&(this._time=0),this._playing=!0,this.toggleAttribute("playing",!0),this.#u={time:this._time,now:performance.now()},this.#t.sync(this._time,!0,!0),this.#$();const e=()=>{const s=this._timeline;if(!this._playing||s===null)return;const a=this.#u.time+(performance.now()-this.#u.now)/1e3;if(a>=s.duration){this._time=s.duration,this.pause();return}this._time=a,this.#t.sync(a,!0,!1),this.#T(),this.#d=requestAnimationFrame(e)};this.#d=requestAnimationFrame(e)}pause(){cancelAnimationFrame(this.#d),this._playing=!1,this.toggleAttribute("playing",!1),this.#t.stop(),this.#T()}toggle(){this._playing?this.pause():this.play()}seek(t){this._time=G(t,0,this.duration),this.#u={time:this._time,now:performance.now()},this._playing&&this.#t.sync(this._time,!0,!0),this.#T()}get commentTargets(){const t=this._timeline;if(!this.id||t===null)return[];const e=`${this.heading??this.#v.heading} \xB7 ${this.id}`,a=[...new Set([...this.#x.map(i=>`element:${i.target.id}`),...this.#f])].flatMap(i=>{const r=Fs(this.id,t,i);return r===null?[]:[{value:i,label:Vs(r),group:e}]});return[...t.scenes.map(i=>({value:js(this.id,i.id),label:i.title,group:e})),...a]}get elementComments(){return this.#x}set elementComments(t){this.#x=t,this.#h=!0;const e=new Set(t.map(s=>`element:${s.target.id}`));this.#f=new Set([...this.#f].filter(s=>!e.has(s))),this.requestUpdate()}get elementActions(){return this.#c}set elementActions(t){this.#c=t,this.#S()}get elementActionResults(){return this.#p}get#v(){return mr(this.#a.locale)}get#z(){const t=this._timeline;if(t===null)return[];const e=this.#x.flatMap(a=>{const i=Fs(this.id,t,`element:${a.target.id}`,{scenes:!0});return i===null?[]:[{id:a.id,kind:"comment",time:i.time,scene:i.scene.title,body:Gr(a)}]}),s=this.#l.scenes.flatMap(a=>{const i=t.scenes.find(r=>r.id===a.id);return i===void 0?[]:a.notes.map(r=>({id:r.id,kind:"note",time:i.start+G(r.at??0,0,i.end-i.start),scene:i.title,body:r.body}))});return[...e,...s].sort((a,i)=>a.time-i.time)}#S(){const t=Lr(this.#v,this.#o,this.#c);this.#l=t.data,this.#p=t.results,this.#h=!0,this.requestUpdate()}async#E(){const t=this.querySelector(Hr);t!==this.#r&&(this.#i.disconnect(),t!==null&&this.#i.observe(t,{childList:!0,subtree:!0,characterData:!0}),this.#r=t);const e=t?.textContent??"";if(e===this.#g){this.#L(),this.#T();return}this.#g=e;const s=++this.#b;try{this.#o=Us(JSON.parse(e)),this._dataError=null}catch(r){this.pause(),this.#o=re(),this.#S(),this._dataError=r instanceof Error?r.message:String(r),this._timeline=null,console.error("[dev-process-kit] invalid video data:",this._dataError);return}this.#S();const a=await this.#t.measure(Cr(this.#l),r=>new URL(r,document.baseURI).href);if(s!==this.#b)return;const i=Er(this.#l,r=>a.get(r)??null);this.#t.load(i),this.#t.setVolume(this._volume,this._muted),this._time=G(this._time,0,i.duration),this._timeline=i,this.#L()}#_(){this.#w===0||!(this.designWidth>0)||this.style.setProperty("--dpk-video-scale",(this.#w/this.designWidth).toFixed(4))}#L(){const t=this._timeline;if(t!==null){this._dataError=null;for(const e of this.querySelectorAll(Ws)){const s=t.scenes.find(a=>a.id===e.dataset.scene);if(s===void 0){this.pause(),this._dataError=`data-scene="${e.dataset.scene??""}" names no scene of the video`,console.error("[dev-process-kit] invalid video data:",this._dataError);return}for(const a of s.cues)e.style.setProperty(`--dpk-cue-${a.key}`,`${(a.start-s.start).toFixed(3)}s`);e.style.setProperty("--dpk-scene-duration",`${(s.end-s.start).toFixed(3)}s`)}}}#T(){const t=this._timeline;if(t===null)return;const e=this._time,s=t.scenes.length-1,a=tt(t,e),i=t.scenes[a],r=Ns(t,e,Bs);this.#D("scene",i?.id??null),this.#D("cue",r?.key??null),this.#D("voice",r?.voice??null);for(const o of this.querySelectorAll(Ws)){const l=t.scenes.findIndex(M=>M.id===o.dataset.scene),c=t.scenes[l];if(c===void 0)continue;const p=e-c.start,m=this.#l.fade,f=l===0?1:m===0?+(p>=0):p/m+1,E=l===s?1:m===0?+(e<c.end):(c.end-e)/m,R=G(Math.min(f,E),0,1);o.style.opacity=String(R),o.style.visibility=R>0?"visible":"hidden",o.inert=l!==a,this.#e.drive(o,G(p,0,c.end-c.start)*1e3,R>0)}for(const o of this.querySelectorAll(Br))this.#e.drive(o,e*1e3,!0);this.dispatchEvent(new CustomEvent("dpk-video-timeupdate",{detail:{time:e,scene:i?.id??null,sceneTime:e-(i?.start??0),sceneDuration:i===void 0?0:i.end-i.start,cue:r?.key??null,cueTime:r===null?null:e-r.start,playing:this._playing}}))}#D(t,e){e===null?this.removeAttribute(t):this.getAttribute(t)!==e&&this.setAttribute(t,e)}#A(){const t=JSON.stringify([this.commentTargets,this.#p]);t!==this.#k&&(this.#k=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#P(){this._kind==="note"?this.#O():this.#M()}#O(){const t=this._draft.trim(),e=this._timeline,s=e?.scenes[tt(e,this._time)];if(!t||!this.id||s===void 0)return;const a=Math.round((this._time-s.start)*1e3)/1e3,i=!this.dispatchEvent(new CustomEvent("dpk-element-action",{detail:{type:Hs,target:js(this.id,s.id),payload:{id:Vr(),at:a,body:t}},bubbles:!0,composed:!0,cancelable:!0}));this._unrecorded=!i,i&&(this._draft="")}#M(){const t=this._draft.trim();if(!t||!this.id||this._timeline===null)return;const e=zr(this.id,this._timeline,this._time);this.#f=new Set(this.#f).add(e),this.#h=!0;const s=!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t},bubbles:!0,composed:!0,cancelable:!0}));if(!s){const a=new Set(this.#f);a.delete(e),this.#f=a}this._unrecorded=!s,s&&(this._draft="")}#R(t,e){this._volume=t,this._muted=e,this.#t.setVolume(t,e),this._playing&&this.#t.sync(this._time,!0,!1)}#$=()=>{this._idle=!1,clearTimeout(this.#m),this.#m=window.setTimeout(()=>{const t=this.renderRoot.querySelector(".player");this._idle=this._playing&&!this.#C&&!(t?.matches(":focus-within")??!1)},Kr)};#q(){const t=this.renderRoot.querySelector(".frame");document.fullscreenElement!==null?document.exitFullscreen():t instanceof HTMLElement&&t.requestFullscreen()}#I=()=>{this._fullscreen=this.renderRoot instanceof ShadowRoot&&this.renderRoot.fullscreenElement!==null};#B=t=>{if(t.isComposing||t.ctrlKey||t.metaKey||t.altKey||Xr(t))return;const e=t.key.toLowerCase();if(!(Jr.has(e)&&Yr(t))){if(e===" "||e==="k")this.toggle();else if(e==="arrowleft"||e==="j")this.seek(this._time-Ks);else if(e==="arrowright"||e==="l")this.seek(this._time+Ks);else if(e==="home")this.seek(0);else if(e==="end")this.seek(this.duration);else if(e==="m")this.#R(this._volume,!this._muted);else if(e==="f")this.#q();else if(e==="c")this._captions=!this._captions;else return;t.preventDefault(),this.#$()}};#N(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return 0;const s=e.getBoundingClientRect();return G((t.clientX-s.left)/s.width,0,1)}#K=t=>{t.button!==0||!(t.currentTarget instanceof HTMLElement)||(t.currentTarget.setPointerCapture(t.pointerId),this.#C=!0,this.seek(this.#N(t)*this.duration))};#V=t=>{const e=this.#N(t);this._hover={ratio:e,time:e*this.duration},this.#C&&this.seek(e*this.duration)};#j=()=>{this.#C=!1};render(){const t=this.#v;if(this._dataError!==null)return d`<p class="error" role="alert">${this._dataError}</p>`;const e=this._timeline,s=e===null?null:Ns(e,this._time,Bs),a=!this._playing||!this._idle;return d`<div class="frame" ?data-fullscreen=${this._fullscreen}>
2754
+ <div
2755
+ class="player"
2756
+ role="region"
2757
+ aria-label=${this.heading??t.heading}
2758
+ tabindex="0"
2759
+ ?data-idle=${!a}
2760
+ @pointermove=${this.#$}
2761
+ @pointerdown=${this.#$}
2762
+ @keydown=${this.#B}
2763
+ @focusin=${this.#$}
2764
+ >
2765
+ <div
2766
+ class="stage"
2767
+ @click=${i=>{i.defaultPrevented||this.toggle()}}
2768
+ >
2769
+ <slot></slot>
2770
+ ${!this._captions||s?.text===void 0?h:d`<p class="subtitle" part="subtitle" data-tone=${s.captionTone??"white"}>
2771
+ ${s.voice===void 0?h:d`<span class=${s.captionTone===null?"voice":"voice sr-only"} part="voice"
2772
+ >${s.voice}</span
2773
+ >`}
2774
+ <span>${s.text}</span>
2775
+ </p>`}
2776
+ ${!this._playing&&this._time===0&&e!==null?d`<span class="big-play" aria-hidden="true">${Ee()}</span>`:h}
2777
+ </div>
2778
+ ${this.#F(t,e)}
2779
+ </div>
2780
+ ${this.panelOpen?this.#H(t,e):h}
2781
+ </div>`}#F(t,e){const s=e?.duration??0,a=s===0?0:this._time/s,i=this._hover===null||e===null?null:e.scenes[tt(e,this._hover.time)],r=this._muted?0:this._volume,o=r===0?ta:r<.5?ea:sa;return d`<div class="chrome" part="controls">
2782
+ <div
2783
+ class="bar"
2784
+ role="slider"
2785
+ tabindex="0"
2786
+ aria-label=${t.seek}
2787
+ aria-valuemin="0"
2788
+ aria-valuemax=${Math.round(s)}
2789
+ aria-valuenow=${Math.round(this._time)}
2790
+ aria-valuetext=${`${V(this._time)} / ${V(s)}`}
2791
+ style=${`--progress:${a}`}
2792
+ @pointerdown=${this.#K}
2793
+ @pointermove=${this.#V}
2794
+ @pointerup=${this.#j}
2795
+ @pointercancel=${this.#j}
2796
+ @pointerleave=${()=>{this._hover=null}}
2797
+ >
2798
+ <div class="segments">
2799
+ ${(e?.scenes??[]).map(l=>{const c=l.end-l.start,p=c===0?0:G((this._time-l.start)/c,0,1),m=this._hover===null?0:G((this._hover.time-l.start)/(c||1),0,1);return d`<span
2800
+ class="segment"
2801
+ style=${`flex-grow:${c};--fill:${p};--hover:${m}`}
2802
+ ?data-hovered=${i?.id===l.id}
2803
+ ></span>`})}
2804
+ </div>
2805
+ <span class="thumb"></span>
2806
+ ${this._hover===null?h:d`<span class="tooltip" style=${`--at:${this._hover.ratio}`}>
2807
+ ${i==null?h:d`<b>${i.title}</b>`}
2808
+ <span class="dpk-num">${V(this._hover.time)}</span>
2809
+ </span>`}
2810
+ </div>
2811
+ <div class="controls">
2812
+ <button
2813
+ class="ctl"
2814
+ type="button"
2815
+ aria-label=${this._playing?t.pause:t.play}
2816
+ title=${this._playing?t.pause:t.play}
2817
+ ?disabled=${e===null}
2818
+ @click=${()=>this.toggle()}
2819
+ >
2820
+ ${this._playing?Vn():Ee()}
2821
+ </button>
2822
+ <div class="volume">
2823
+ <button
2824
+ class="ctl"
2825
+ type="button"
2826
+ aria-label=${this._muted?t.unmute:t.mute}
2827
+ title=${this._muted?t.unmute:t.mute}
2828
+ @click=${()=>this.#R(this._volume===0?1:this._volume,!this._muted)}
2829
+ >
2830
+ ${o()}
2831
+ </button>
2832
+ <input
2833
+ type="range"
2834
+ min="0"
2835
+ max="1"
2836
+ step="0.05"
2837
+ aria-label=${t.volume}
2838
+ .value=${String(r)}
2839
+ style=${`--level:${r}`}
2840
+ @input=${l=>{if(l.currentTarget instanceof HTMLInputElement){const c=Number(l.currentTarget.value);this.#R(c,c===0)}}}
2841
+ />
2842
+ </div>
2843
+ <span class="time dpk-num">${V(this._time)} / ${V(s)}</span>
2844
+ <span class="spacer"></span>
2845
+ ${e?.scenes.some(l=>l.cues.some(c=>c.text!==void 0))?d`<button
2846
+ class="ctl"
2847
+ type="button"
2848
+ aria-label=${t.captions}
2849
+ title=${t.captions}
2850
+ aria-pressed=${this._captions?"true":"false"}
2851
+ @click=${()=>{this._captions=!this._captions}}
2852
+ >
2853
+ ${this._captions?Gn():Jn()}
2854
+ </button>`:h}
2855
+ <button
2856
+ class="ctl"
2857
+ type="button"
2858
+ aria-label=${this._fullscreen?t.exitFullscreen:t.fullscreen}
2859
+ title=${this._fullscreen?t.exitFullscreen:t.fullscreen}
2860
+ @click=${()=>this.#q()}
2861
+ >
2862
+ ${this._fullscreen?Xn():Yn()}
2863
+ </button>
2864
+ <button
2865
+ class="ctl"
2866
+ type="button"
2867
+ aria-label=${t.openPanel}
2868
+ title=${t.openPanel}
2869
+ aria-pressed=${this.panelOpen?"true":"false"}
2870
+ @click=${()=>{this.panelOpen=!this.panelOpen}}
2871
+ >
2872
+ ${Zn()}
2873
+ </button>
2874
+ </div>
2875
+ </div>`}#H(t,e){const s=!!this.id,a=s?this._tab:"chapters",i=this.#z;return d`<aside class="panel" aria-label=${t.openPanel}>
2876
+ <div class="panel-body">
2877
+ <header class="panel-head">
2878
+ ${s?d`<fieldset class="comment-kinds" @keydown=${r=>r.stopPropagation()}>
2879
+ <legend>${t.openPanel}</legend>
2880
+ ${["chapters","comments"].map(r=>d`<label class="comment-kind">
2881
+ <input
2882
+ type="radio"
2883
+ name="panel-tab"
2884
+ .checked=${a===r}
2885
+ @change=${()=>{this._tab=r}}
2886
+ />
2887
+ <span
2888
+ >${r==="chapters"?t.chapters:t.comments}${r==="comments"&&i.length>0?d` <span class="count dpk-num">${i.length}</span>`:h}</span
2889
+ >
2890
+ </label>`)}
2891
+ </fieldset>`:d`<h2 class="panel-title">${t.chapters}</h2>`}
2892
+ <button
2893
+ class="dpk-icon-btn"
2894
+ type="button"
2895
+ aria-label=${t.closePanel}
2896
+ title=${t.closePanel}
2897
+ @click=${()=>{this.panelOpen=!1}}
2898
+ >
2899
+ ${Te()}
2900
+ </button>
2901
+ </header>
2902
+ ${a==="chapters"?this.#W(e):this.#U(t,i)}
2903
+ </div>
2904
+ </aside>`}#W(t){const e=t===null?-1:tt(t,this._time);return d`<ol class="chapters">
2905
+ ${U(t?.scenes??[],s=>s.id,(s,a)=>{const i=s.end-s.start,r=a===e&&i>0?G((this._time-s.start)/i,0,1):0;return d`<li>
2906
+ <button
2907
+ class="chapter"
2908
+ type="button"
2909
+ aria-current=${a===e?"true":"false"}
2910
+ style=${`--progress:${r}`}
2911
+ @click=${()=>this.seek(s.start)}
2912
+ >
2913
+ <span class="chapter-time dpk-num">${V(s.start)}</span>
2914
+ <span class="chapter-title">${s.title}</span>
2915
+ </button>
2916
+ </li>`})}
2917
+ </ol>`}#U(t,e){const s=this._timeline,a=s?.scenes[tt(s,this._time)],i=a===void 0?V(this._time):Vs({scene:a,time:this._time}),r=this._kind==="note",o=qe(this._draft,[],{label:r?t.noteAt(i):t.commentAt(i),placeholder:r?t.notePlaceholder:t.commentPlaceholder,submitLabel:r?t.keepNote:t.submit,choice:{label:t.kind,value:this._kind,options:[{value:"comment",label:t.reviewComment},{value:"note",label:t.note}]},...this._unrecorded?{error:t.notSaved}:{}}),l=c=>{c.kind==="input"?(this._draft=c.body,this._unrecorded=!1):c.kind==="choose"?(this._kind=c.value==="note"?"note":"comment",this._unrecorded=!1):c.kind==="comment"&&this.#P()};return d`${e.length===0?d`<p class="empty">${t.noComments}</p>`:d`<ol class="moments">
2918
+ ${U(e,c=>`${c.kind}:${c.id}`,c=>d`<li class="moment" data-kind=${c.kind}>
2919
+ <button class="moment-time dpk-num" type="button" @click=${()=>this.seek(c.time)}>
2920
+ ${V(c.time)}
2921
+ </button>
2922
+ <span class="moment-scene">${c.scene}</span>
2923
+ <span class="moment-kind" role="img" aria-label=${c.kind==="note"?t.note:t.reviewComment}
2924
+ >${c.kind==="note"?Qn():$t()}</span
2925
+ >
2926
+ <p class="moment-body">${c.body}</p>
2927
+ </li>`)}
2928
+ </ol>`}
2929
+ <div class="composer" @keydown=${c=>c.stopPropagation()}>
2930
+ ${ba(Ue(this.#a.locale),o,l)}
2931
+ </div>`}}const Js=()=>{customElements.get("dpk-video")||customElements.define("dpk-video",Gs)},to=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"}}),eo=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,so=n=>{const t=eo.exec(n?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},Xs=60,no=(n,t,e,s)=>{const a=[n,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return a===void 0?s:a.length>Xs?`${a.slice(0,Xs-1)}\u2026`:a},wt=n=>`${n.kind}:${n.id}`,ao=n=>{const t=new Map;for(const e of n)t.set(wt(e),(t.get(wt(e))??0)+1);return n.filter(e=>t.get(wt(e))===1)},Ys=(n,t)=>`element:${[n,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,io="[data-dpk-item]",ro="h1, h2, h3, h4, h5, h6, summary, caption, legend";class Zs extends A{static{this.styles=[L,J,ht,_`
2100
2932
  :host {
2101
2933
  position: relative;
2102
2934
  display: block;
@@ -2109,11 +2941,11 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2109
2941
  font-size: 11px;
2110
2942
  color: var(--dpk-accent);
2111
2943
  }
2112
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new P(this);#t=new it(this);#e=new MutationObserver(()=>{this.#c()});#n=[];#s=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.#c()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#d.heading} \xB7 ${this.id}`;return this.#n.map(e=>({value:ws(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#m()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=kt(t.target,this.commentTargets,Tt(this.#a.locale),(s,a)=>this.#r(s,a));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 d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:this.#d.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#d(){return Ai(this.#a.locale)}#c(){const t=[...this.querySelectorAll(Oi)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const a=Ri(s.getAttribute("data-dpk-item"));if(a===null)return[];const i=s.querySelector(qi)?.textContent??null,o=Di(s.getAttribute("data-dpk-label"),i,s.textContent,this.#d.untitled);return[{...a,label:o,element:s}]}),e=Pi(t);if(e.length<t.length){const s=new Set(e.map(ut)),a=[...new Set(t.map(ut).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,a)}this.#n=e,this.#p(),this.#m()}#p(){const t=new Set(this.#n.map(e=>e.element));for(const e of this.#s)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#n)e.element.setAttribute("data-dpk-target",ws(this.id,e));this.#s=t}#m(){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 Cs=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",$s)},Ii="dpk-extend-right-click-run",Zt=C(v(),E(1)),Y=C(v(),E(1)),Ui=w({kind:V("item"),id:Zt,label:Y,danger:g(at()),event:g(Y),detail:g(Tn(v(),Dt())),copy:g(Y)}),ji=w({kind:V("submenu"),id:Zt,label:Y,entries:$(we(()=>Ss))}),Ss=we(()=>xe("kind",[Ui,ji])),Ni=w({id:Zt,heading:g(Y),entries:$(Ss)}),Fi=w({selector:C(v(),ye(),E(1)),label:g(Y),groups:$(Ni)}),Hi=w({targets:$(Fi)}),Es=(n,t)=>{for(const e of n){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&Es(e.entries,t)}},Xt=n=>{const t=W(Hi,n),e=new Set;for(const s of t.targets)for(const a of s.groups){if(e.has(a.id))throw new Error(`duplicate id: ${a.id}`);e.add(a.id),Es(a.entries,e)}return t},zs="dpk-extend-right-click",Yt=`[dev-process-kit] ${zs}: `,_i="text",Wi=(n,t)=>{const e=bn(n,n),s=e.indexOf(t);return s===-1?null:[n,...e.slice(0,s)]},Bi=(n,t)=>{const s=(t===_i?n.textContent:n.getAttribute(t))?.trim()??"";return s===""?null:s},Gi=(n,t,e)=>{try{return n.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${Yt}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class Ms extends z{static{this.styles=M`
2944
+ `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new O(this);#t=new ut(this);#e=new MutationObserver(()=>{this.#c()});#n=[];#s=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.#c()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#l.heading} \xB7 ${this.id}`;return this.#n.map(e=>({value:Ys(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#g()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=Et(t.target,this.commentTargets,Ut(this.#a.locale),(s,a)=>this.#r(s,a));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 d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:this.#l.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#l(){return to(this.#a.locale)}#c(){const t=[...this.querySelectorAll(io)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const a=so(s.getAttribute("data-dpk-item"));if(a===null)return[];const i=s.querySelector(ro)?.textContent??null,r=no(s.getAttribute("data-dpk-label"),i,s.textContent,this.#l.untitled);return[{...a,label:r,element:s}]}),e=ao(t);if(e.length<t.length){const s=new Set(e.map(wt)),a=[...new Set(t.map(wt).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,a)}this.#n=e,this.#p(),this.#g()}#p(){const t=new Set(this.#n.map(e=>e.element));for(const e of this.#s)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#n)e.element.setAttribute("data-dpk-target",Ys(this.id,e));this.#s=t}#g(){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 Qs=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",Zs)},oo="dpk-extend-right-click-run",oe=y(b(),S(1)),lt=y(b(),S(1)),lo=x({kind:at("item"),id:oe,label:lt,danger:g(nt()),event:g(lt),detail:g(Oe(b(),Ft())),copy:g(lt)}),co=x({kind:at("submenu"),id:oe,label:lt,entries:$(Ie(()=>tn))}),tn=Ie(()=>Pe("kind",[lo,co])),po=x({id:oe,heading:g(lt),entries:$(tn)}),ho=x({selector:y(b(),Re(),S(1)),label:g(lt),groups:$(po)}),uo=x({targets:$(ho)}),en=(n,t)=>{for(const e of n){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&en(e.entries,t)}},le=n=>{const t=B(uo,n),e=new Set;for(const s of t.targets)for(const a of s.groups){if(e.has(a.id))throw new Error(`duplicate id: ${a.id}`);e.add(a.id),en(a.entries,e)}return t},sn="dpk-extend-right-click",de=`[dev-process-kit] ${sn}: `,mo="text",go=(n,t)=>{const e=na(n,n),s=e.indexOf(t);return s===-1?null:[n,...e.slice(0,s)]},fo=(n,t)=>{const s=(t===mo?n.textContent:n.getAttribute(t))?.trim()??"";return s===""?null:s},bo=(n,t,e)=>{try{return n.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${de}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class nn extends A{static{this.styles=_`
2113
2945
  :host {
2114
2946
  display: contents;
2115
2947
  }
2116
- `}static{this.properties={config:{attribute:!1}}}#a=null;#t=null;#e=null;#n=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=_(this,Xt,t=>{if(t.ok){this.#a=t.value,this.#t=null;return}this.#a=null,this.#t=t.error,console.warn(`${Yt}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#s();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const a=Wi(s,this);if(a===null||a.some(r=>r.localName===zs))return null;const i=this.#r(a,e);if(i===null)return null;const o=this.#o(i.target,i.element);return o.length===0?null:o}render(){return d`<slot></slot>`}#s(){return this.config===null?this.#a:(this.#n?.raw!==this.config&&(this.#n={raw:this.config,parsed:this.#i(this.config)}),this.#n.parsed)}#i(t){try{return Xt(t)}catch(e){return console.warn(`${Yt}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const a of t)for(const i of e.targets)if(Gi(a,i.selector,s))return{target:i,element:a};return null}#o(t,e){return t.groups.flatMap(s=>{const a=this.#d(s.entries,s,t,e);return a.length===0?[]:[s.heading===void 0?{id:s.id,entries:a}:{id:s.id,heading:s.heading,entries:a}]})}#d(t,e,s,a){return t.flatMap(i=>i.kind==="submenu"?this.#c(i,e,s,a):this.#p(i,e,s,a))}#c(t,e,s,a){const i=this.#d(t.entries,e,s,a);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,a){const i=t.copy===void 0?null:Bi(a,t.copy);if(t.copy!==void 0&&i===null)return[];const o=()=>{i!==null&&Lt(i),!(i!==null&&t.event===void 0)&&this.#m(t,e,s,a)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:o,danger:!0}:{kind:"item",id:t.id,label:t.label,run:o}]}#m(t,e,s,a){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:a,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??Ii,{detail:i,bubbles:!0,composed:!0}))}}const Ts=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",Ms)},Ki=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 As extends z{static{this.styles=[T,B,gt,M`
2948
+ `}static{this.properties={config:{attribute:!1}}}#a=null;#t=null;#e=null;#n=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=X(this,le,t=>{if(t.ok){this.#a=t.value,this.#t=null;return}this.#a=null,this.#t=t.error,console.warn(`${de}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#s();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const a=go(s,this);if(a===null||a.some(o=>o.localName===sn))return null;const i=this.#r(a,e);if(i===null)return null;const r=this.#o(i.target,i.element);return r.length===0?null:r}render(){return d`<slot></slot>`}#s(){return this.config===null?this.#a:(this.#n?.raw!==this.config&&(this.#n={raw:this.config,parsed:this.#i(this.config)}),this.#n.parsed)}#i(t){try{return le(t)}catch(e){return console.warn(`${de}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const a of t)for(const i of e.targets)if(bo(a,i.selector,s))return{target:i,element:a};return null}#o(t,e){return t.groups.flatMap(s=>{const a=this.#l(s.entries,s,t,e);return a.length===0?[]:[s.heading===void 0?{id:s.id,entries:a}:{id:s.id,heading:s.heading,entries:a}]})}#l(t,e,s,a){return t.flatMap(i=>i.kind==="submenu"?this.#c(i,e,s,a):this.#p(i,e,s,a))}#c(t,e,s,a){const i=this.#l(t.entries,e,s,a);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,a){const i=t.copy===void 0?null:fo(a,t.copy);if(t.copy!==void 0&&i===null)return[];const r=()=>{i!==null&&Nt(i),!(i!==null&&t.event===void 0)&&this.#g(t,e,s,a)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:r,danger:!0}:{kind:"item",id:t.id,label:t.label,run:r}]}#g(t,e,s,a){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:a,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??oo,{detail:i,bubbles:!0,composed:!0}))}}const an=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",nn)},ko=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 rn extends A{static{this.styles=[L,J,ht,_`
2117
2949
  :host {
2118
2950
  position: relative;
2119
2951
  display: inline-block;
@@ -2126,7 +2958,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2126
2958
  simply being there when the reader looks back. */
2127
2959
  animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
2128
2960
  }
2129
- `]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#a=new P(this);#t=new it(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 d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:Ki(this.#a.locale).sendFailed,submit:(t,e)=>this.#n(t,e)})}`}#n(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const Ls=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",As)},Rs=(n,t)=>{const e=t===null?-1:n.indexOf(t);return e===-1?0:e},Vi=(n,t,e)=>{if(e===0)return null;switch(n){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}},Ji=":scope > [data-name]";let Zi=0;class Ds extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[T,M`
2961
+ `]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#a=new O(this);#t=new ut(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 d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:ko(this.#a.locale).sendFailed,submit:(t,e)=>this.#n(t,e)})}`}#n(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const on=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",rn)},ln=(n,t)=>{const e=t===null?-1:n.indexOf(t);return e===-1?0:e},vo=(n,t,e)=>{if(e===0)return null;switch(n){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}},xo=":scope > [data-name]";let yo=0;class dn extends A{static{this.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[L,_`
2130
2962
  :host {
2131
2963
  display: block;
2132
2964
  font-size: inherit;
@@ -2219,7 +3051,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2219
3051
  ::slotted([data-name]) {
2220
3052
  animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
2221
3053
  }
2222
- `]}static{this.properties={selected:{type:String,reflect:!0}}}#a=`dpk-tabs-${++Zi}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#s()):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#n(){return[...this.querySelectorAll(Ji)]}render(){const t=this.#n,e=t.map(a=>a.dataset.name??""),s=Rs(e,this.selected);return d`<div role="tablist" @keydown=${this.#r}>
3054
+ `]}static{this.properties={selected:{type:String,reflect:!0}}}#a=`dpk-tabs-${++yo}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#s()):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#n(){return[...this.querySelectorAll(xo)]}render(){const t=this.#n,e=t.map(a=>a.dataset.name??""),s=ln(e,this.selected);return d`<div role="tablist" @keydown=${this.#r}>
2223
3055
  <span class="indicator" aria-hidden="true"></span>
2224
3056
  ${U(e,(a,i)=>`${i}:${a}`,(a,i)=>d`<button
2225
3057
  type="button"
@@ -2235,7 +3067,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2235
3067
  </div>
2236
3068
  <div role="tabpanel" id="${this.#a}-panel" aria-labelledby="${this.#a}-tab-${s}">
2237
3069
  <slot></slot>
2238
- </div>`}updated(t){const e=this.#n,s=e.map(i=>i.dataset.name??""),a=e[Rs(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...a===void 0?[]:[a]),this.#s()}#s(){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(o=>o.getAttribute("aria-selected")==="true"),a=Vi(t.key,s,e.length);if(a===null)return;t.preventDefault();const i=this.#n[a]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[a]?.focus()})}}const Ps=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",Ds)},Xi=D({en:{heading:"Checklist",empty:"No items.",progress:(n,t)=>`${n} / ${t} done`,actionTitle:(n,t)=>`${t?"Checked":"Unchecked"}: ${n}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:n=>`Comment on ${n}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(n,t)=>`${n} / ${t} \u5B8C\u4E86`,actionTitle:(n,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${n}`,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:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`}}),Os="SET_CHECKED",Yi=w({id:C(v(),$e(/^[A-Za-z0-9_-]+$/)),label:C(v(),E(1)),checked:g(at()),note:g(v())}),Qi=w({items:$(Yi)}),qs=()=>({items:[]}),Is=n=>{const t=W(Qi,n),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}})}},tr=Rt({checked:at()}),er=(n,t,e)=>{const s=new Map(t.items.map(o=>[o.id,o.checked])),a=new Map(s),i=e.map(o=>{if(o.type!==Os)return{id:o.id,title:o.type,stale:"unsupported-action-type"};const r=ze(o.target.id),l=r?.[1]==="item"?r[2]:void 0,u=Pt(tr,o.payload);if(l===void 0||!a.has(l)||!u.success)return{id:o.id,title:n.actionTitle(l??o.target.id,!0),stale:"target-missing"};a.set(l,u.output.checked);const c=t.items.find(m=>m.id===l)?.label??l;return{id:o.id,title:n.actionTitle(c,u.output.checked),tone:"update"}});return{data:{items:t.items.map(o=>{const r=a.get(o.id)??o.checked;return{...o,checked:r,changed:r!==s.get(o.id)}})},results:i}},sr=n=>({done:n.items.filter(t=>t.checked).length,total:n.items.length});class Us extends z{static{this.styles=[T,M`
3070
+ </div>`}updated(t){const e=this.#n,s=e.map(i=>i.dataset.name??""),a=e[ln(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...a===void 0?[]:[a]),this.#s()}#s(){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(r=>r.getAttribute("aria-selected")==="true"),a=vo(t.key,s,e.length);if(a===null)return;t.preventDefault();const i=this.#n[a]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[a]?.focus()})}}const cn=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",dn)},wo=D({en:{heading:"Checklist",empty:"No items.",progress:(n,t)=>`${n} / ${t} done`,actionTitle:(n,t)=>`${t?"Checked":"Unchecked"}: ${n}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:n=>`Comment on ${n}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(n,t)=>`${n} / ${t} \u5B8C\u4E86`,actionTitle:(n,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${n}`,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:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`}}),pn="SET_CHECKED",$o=x({id:y(b(),Wt(/^[A-Za-z0-9_-]+$/)),label:y(b(),S(1)),checked:g(nt()),note:g(b())}),Co=x({items:$($o)}),hn=()=>({items:[]}),un=n=>{const t=B(Co,n),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}})}},So=jt({checked:nt()}),Eo=(n,t,e)=>{const s=new Map(t.items.map(r=>[r.id,r.checked])),a=new Map(s),i=e.map(r=>{if(r.type!==pn)return{id:r.id,title:r.type,stale:"unsupported-action-type"};const o=Kt(r.target.id),l=o?.[1]==="item"?o[2]:void 0,c=St(So,r.payload);if(l===void 0||!a.has(l)||!c.success)return{id:r.id,title:n.actionTitle(l??r.target.id,!0),stale:"target-missing"};a.set(l,c.output.checked);const p=t.items.find(m=>m.id===l)?.label??l;return{id:r.id,title:n.actionTitle(p,c.output.checked),tone:"update"}});return{data:{items:t.items.map(r=>{const o=a.get(r.id)??r.checked;return{...r,checked:o,changed:o!==s.get(r.id)}})},results:i}},To=n=>({done:n.items.filter(t=>t.checked).length,total:n.items.length});class mn extends A{static{this.styles=[L,_`
2239
3071
  :host {
2240
3072
  display: block;
2241
3073
  color: var(--dpk-ink);
@@ -2434,7 +3266,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2434
3266
  .error {
2435
3267
  color: var(--dpk-danger);
2436
3268
  }
2437
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new P(this);#t=null;#e=null;#n=null;#s=qs();#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.#n=null):(this.#e=null,this.#n=t.error),this.#u(),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.#c} \xB7 ${this.id}`;return this.#s.items.map(e=>({value:this.#l(e.id),label:e.label,group:t}))}get elementActions(){return this.#i}set elementActions(t){this.#i=t,this.#u()}get elementActionResults(){return this.#r}render(){const t=this.#d;if(this.#n!==null)return d`<p class="error">${this.#n}</p>`;const e=sr(this.#s),s=e.total===0?0:e.done/e.total,a=t.progress(e.done,e.total);return d`<div class="card">
3269
+ `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new O(this);#t=null;#e=null;#n=null;#s=hn();#i=[];#r=[];#o=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=X(this,un,t=>{t.ok?(this.#e=t.value,this.#n=null):(this.#e=null,this.#n=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.#c} \xB7 ${this.id}`;return this.#s.items.map(e=>({value:this.#d(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.#n!==null)return d`<p class="error">${this.#n}</p>`;const e=To(this.#s),s=e.total===0?0:e.done/e.total,a=t.progress(e.done,e.total);return d`<div class="card">
2438
3270
  <div class="head">
2439
3271
  <span class="heading">${this.#c}</span>
2440
3272
  <span class="count" aria-label=${a}
@@ -2454,16 +3286,16 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2454
3286
  ${this.#s.items.length===0?d`<p class="empty">${t.empty}</p>`:d`<ul>
2455
3287
  ${U(this.#s.items,i=>i.id,i=>this.#p(t,i))}
2456
3288
  </ul>`}
2457
- </div>`}get#d(){return Xi(this.#a.locale)}get#c(){return this.heading??this.#d.heading}#p(t,e){const s=`item-${e.id}`;return d`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
3289
+ </div>`}get#l(){return wo(this.#a.locale)}get#c(){return this.heading??this.#l.heading}#p(t,e){const s=`item-${e.id}`;return d`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
2458
3290
  <span class="check">
2459
3291
  <input
2460
3292
  id=${s}
2461
3293
  class="check-input"
2462
3294
  type="checkbox"
2463
3295
  .checked=${e.checked}
2464
- @change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#m(e,a.currentTarget.checked)}}
3296
+ @change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#g(e,a.currentTarget.checked)}}
2465
3297
  />
2466
- <span class="check-mark">${ft()}</span>
3298
+ <span class="check-mark">${Ct()}</span>
2467
3299
  </span>
2468
3300
  <label for=${s}>
2469
3301
  <span class="label">${e.label}</span>
@@ -2475,11 +3307,11 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2475
3307
  type="button"
2476
3308
  aria-label=${t.commentOn(e.label)}
2477
3309
  title=${t.commentOn(e.label)}
2478
- @click=${()=>{this.#h(e.id)}}
3310
+ @click=${()=>{this.#u(e.id)}}
2479
3311
  >
2480
- ${At()}
3312
+ ${$t()}
2481
3313
  </button>`:h}
2482
- </li>`}#m(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:Os,target:this.#l(t.id),payload:{checked:e}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),this.#o=s.defaultPrevented?null:t.id,this.requestUpdate()}#h(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:this.#l(t)},bubbles:!0,composed:!0}))}#l(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#u(){if(this.#e===null)this.#s=qs(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=er(this.#d,this.#e,this.#i);this.#s=t.data,this.#r=t.results}this.requestUpdate()}}const js=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",Us)},Ns=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:n=>`Copy ${n}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:n=>`${n} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),Fs=M`
3314
+ </li>`}#g(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:pn,target:this.#d(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.#d(t)},bubbles:!0,composed:!0}))}#d(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#m(){if(this.#e===null)this.#s=hn(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=Eo(this.#l,this.#e,this.#i);this.#s=t.data,this.#r=t.results}this.requestUpdate()}}const gn=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",mn)},fn=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:n=>`Copy ${n}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:n=>`${n} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),bn=_`
2483
3315
  :host {
2484
3316
  display: block;
2485
3317
  overflow: hidden;
@@ -2596,16 +3428,16 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2596
3428
  .punct {
2597
3429
  color: var(--dpk-code-punct, var(--dpk-ink-soft));
2598
3430
  }
2599
- `,nr='script[type="text/plain"]';class Hs extends z{static{this.styles=[T,Fs]}static{this.properties={filename:{type:String},language:{type:String},code:{type:String}}}#a=new P(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e="idle";#n;constructor(){super(),this.filename=null,this.language=null,this.code=""}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),clearTimeout(this.#n)}get text(){const t=this.querySelector(nr)?.textContent??this.textContent??"";return Qt(t.trim()===""?this.code:t)}render(){const t=this.#i,e=this.filename??t.code,s=this.#e==="copied"?t.copied:this.#e==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
3431
+ `,Mo='script[type="text/plain"]';class kn extends A{static{this.styles=[L,bn]}static{this.properties={filename:{type:String},language:{type:String},code:{type:String}}}#a=new O(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e="idle";#n;constructor(){super(),this.filename=null,this.language=null,this.code=""}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),clearTimeout(this.#n)}get text(){const t=this.querySelector(Mo)?.textContent??this.textContent??"";return ce(t.trim()===""?this.code:t)}render(){const t=this.#i,e=this.filename??t.code,s=this.#e==="copied"?t.copied:this.#e==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
2600
3432
  <span class="name">${e}</span>
2601
3433
  ${this.language?d`<span class="language">${this.language}</span>`:h}
2602
3434
  <button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
2603
- ${this.#e==="copied"?ft():ge()}<span aria-live="polite">${s}</span>
3435
+ ${this.#e==="copied"?Ct():Me()}<span aria-live="polite">${s}</span>
2604
3436
  </button>
2605
3437
  </div>
2606
- <pre><code>${this.#s()}</code></pre>`}#s(){return Gt(this.text,this.language).map(t=>t.kind===null?t.text:d`<span class=${t.kind}>${t.text}</span>`)}get#i(){return Ns(this.#a.locale)}#r=async()=>{const t=await Lt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const Qt=n=>{const t=n.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
3438
+ <pre><code>${this.#s()}</code></pre>`}#s(){return se(this.text,this.language).map(t=>t.kind===null?t.text:d`<span class=${t.kind}>${t.text}</span>`)}get#i(){return fn(this.#a.locale)}#r=async()=>{const t=await Nt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const ce=n=>{const t=n.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
2607
3439
  `),e=t.filter(a=>a.trim()!=="").map(a=>/^[ \t]*/.exec(a)?.[0].length??0),s=e.length===0?0:Math.min(...e);return t.map(a=>a.slice(s)).join(`
2608
- `)},_s=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",Hs)},ar=D({en:{empty:"No code variants",invalid:n=>`Invalid code group: ${n}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${n}`}}),ir=w({label:C(v(),E(1)),language:g(v(),""),code:C(v(),E(1))}),rr=w({label:g(v(),""),variants:C($(ir),E(1))}),Et=n=>{const t=W(rr,n),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},or=M`
3440
+ `)},vn=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",kn)},Ao=D({en:{empty:"No code variants",invalid:n=>`Invalid code group: ${n}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${n}`}}),zo=x({label:y(b(),S(1)),language:g(b(),""),code:y(b(),S(1))}),_o=x({label:g(b(),""),variants:y($(zo),S(1))}),Ot=n=>{const t=B(_o,n),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},Lo=_`
2609
3441
  :host {
2610
3442
  min-width: 0;
2611
3443
  }
@@ -2675,38 +3507,38 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2675
3507
  display: none;
2676
3508
  }
2677
3509
  }
2678
- `;class Ws extends z{static{this.styles=[T,Fs,or]}static{this.properties={data:{attribute:!1}}}#a=new P(this);#t=null;#e=null;#n=0;#s="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=_(this,Et,t=>{this.#n=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=Cn(this,Et);t!==null&&(this.#r?.(),this.#r=null,this.#n=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=Et(this.data),this.#e=null,this.#n=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Ns(this.#a.locale),e=ar(this.#a.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,d`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,d`<p class="empty">${e.empty}</p>`);const a=Math.min(this.#n,s.variants.length-1),i=s.label===""?t.code:s.label,o=this.#s==="copied"?t.copied:this.#s==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
3510
+ `;class xn extends A{static{this.styles=[L,bn,Lo]}static{this.properties={data:{attribute:!1}}}#a=new O(this);#t=null;#e=null;#n=0;#s="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=X(this,Ot,t=>{this.#n=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=da(this,Ot);t!==null&&(this.#r?.(),this.#r=null,this.#n=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=Ot(this.data),this.#e=null,this.#n=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=fn(this.#a.locale),e=Ao(this.#a.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,d`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,d`<p class="empty">${e.empty}</p>`);const a=Math.min(this.#n,s.variants.length-1),i=s.label===""?t.code:s.label,r=this.#s==="copied"?t.copied:this.#s==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
2679
3511
  ${s.label===""?h:d`<span class="name">${s.label}</span>`}
2680
3512
  <div class="tabs" role="tablist" aria-label=${i}>
2681
- ${s.variants.map((r,l)=>d`<button
3513
+ ${s.variants.map((o,l)=>d`<button
2682
3514
  type="button"
2683
3515
  role="tab"
2684
3516
  id="code-group-tab-${l}"
2685
3517
  aria-controls="code-group-panel-${l}"
2686
3518
  aria-selected=${l===a}
2687
3519
  tabindex=${l===a?0:-1}
2688
- @click=${()=>this.#d(l)}
2689
- @keydown=${u=>this.#c(u,l)}
3520
+ @click=${()=>this.#l(l)}
3521
+ @keydown=${c=>this.#c(c,l)}
2690
3522
  >
2691
- ${r.label}
3523
+ ${o.label}
2692
3524
  </button>`)}
2693
3525
  </div>
2694
3526
  <button
2695
3527
  type="button"
2696
3528
  data-state=${this.#s}
2697
3529
  aria-label=${t.copyLabel(i)}
2698
- @click=${()=>this.#m()}
3530
+ @click=${()=>this.#g()}
2699
3531
  >
2700
- ${this.#s==="copied"?ft():ge()}<span aria-live="polite">${o}</span>
3532
+ ${this.#s==="copied"?Ct():Me()}<span aria-live="polite">${r}</span>
2701
3533
  </button>
2702
3534
  </div>
2703
- ${s.variants.map((r,l)=>d`<pre
3535
+ ${s.variants.map((o,l)=>d`<pre
2704
3536
  role="tabpanel"
2705
3537
  id="code-group-panel-${l}"
2706
3538
  aria-labelledby="code-group-tab-${l}"
2707
3539
  ?hidden=${l!==a}
2708
- ><code>${this.#p(r)}</code></pre>`)}`}#o(t,e){return d`<div class="bar"><span class="name">${t}</span></div>
2709
- ${e}`}#d(t){this.#t!==null&&(this.#n=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#s="idle",this.requestUpdate())}#c(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const a=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#d(a),this.renderRoot.querySelectorAll('[role="tab"]')[a]?.focus()}#p(t){const e=t.language===""?null:t.language;return Gt(Qt(t.code),e).map(s=>s.kind===null?s.text:d`<span class=${s.kind}>${s.text}</span>`)}async#m(){const t=this.#t;if(t===null)return;const e=Math.min(this.#n,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const a=await Lt(Qt(s.code));this.#s=a?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#s="idle",this.requestUpdate()},1600)}}const Bs=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",Ws)},lr=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:n=>`Profile: ${n}`,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:n=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${n}`,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"}}),zt=(n,t,e)=>{const s=Ce(t,e);if(s===null)return;const a=Se(s);return n.find(i=>{const o=Ce(i.url,e);return o!==null&&Se(o)===a})},dr=(n,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?Ee(t.url):zt(n,t.page.url,t.page.url)?.title??Ee(t.page.url),Gs=n=>n===void 0||n.kind==="new-tab"?"":n.kind==="unreachable"?n.url:n.page.url,cr=(n,t,e,s)=>{const a=Pn(t),i=a.history[a.index];return{tabs:t.tabs.map(o=>{const r=o.history[o.index];return{id:o.id,title:dr(n,r,e),url:Gs(r),active:o.id===a.id}}),entry:i,url:Gs(i),canBack:qn(t),canForward:On(t),...s===null||s===""?{}:{profile:s}}},pr=n=>n.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),hr=":scope > [data-url]",ur=360,Ks="https://page.example.com/";class Vs extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[T,In,M`
3540
+ ><code>${this.#p(o)}</code></pre>`)}`}#o(t,e){return d`<div class="bar"><span class="name">${t}</span></div>
3541
+ ${e}`}#l(t){this.#t!==null&&(this.#n=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#s="idle",this.requestUpdate())}#c(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const a=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#l(a),this.renderRoot.querySelectorAll('[role="tab"]')[a]?.focus()}#p(t){const e=t.language===""?null:t.language;return se(ce(t.code),e).map(s=>s.kind===null?s.text:d`<span class=${s.kind}>${s.text}</span>`)}async#g(){const t=this.#t;if(t===null)return;const e=Math.min(this.#n,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const a=await Nt(ce(s.code));this.#s=a?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#s="idle",this.requestUpdate()},1600)}}const yn=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",xn)},Po=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:n=>`Profile: ${n}`,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:n=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${n}`,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"}}),It=(n,t,e)=>{const s=Ne(t,e);if(s===null)return;const a=je(s);return n.find(i=>{const r=Ne(i.url,e);return r!==null&&je(r)===a})},Ro=(n,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?Fe(t.url):It(n,t.page.url,t.page.url)?.title??Fe(t.page.url),wn=n=>n===void 0||n.kind==="new-tab"?"":n.kind==="unreachable"?n.url:n.page.url,Do=(n,t,e,s)=>{const a=ka(t),i=a.history[a.index];return{tabs:t.tabs.map(r=>{const o=r.history[r.index];return{id:r.id,title:Ro(n,o,e),url:wn(o),active:r.id===a.id}}),entry:i,url:wn(i),canBack:xa(t),canForward:va(t),...s===null||s===""?{}:{profile:s}}},Oo=n=>n.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),Io=":scope > [data-url]",qo=360,$n="https://page.example.com/";class Cn extends A{static{this.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[L,ya,_`
2710
3542
  :host {
2711
3543
  display: block;
2712
3544
  height: var(--dpk-browser-height, 460px);
@@ -2746,17 +3578,17 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
2746
3578
  ::slotted(*) {
2747
3579
  flex: 1 0 auto;
2748
3580
  }
2749
- `]}static{this.properties={url:{type:String},viewport:{type:String,reflect:!0},profile:{type:String}}}#a=new P(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e=null;#n=!1;#s=null;#i=!1;#r=null;constructor(){super(),this.url=null,this.viewport="desktop",this.profile=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-url","data-title"]}),this.addEventListener("click",this.#v),this.addEventListener("auxclick",this.#v)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.removeEventListener("click",this.#v),this.removeEventListener("auxclick",this.#v),this.#s!==null&&clearTimeout(this.#s),this.#s=null}get#o(){return lr(this.#a.locale)}get#d(){return this.viewport==="mobile"}get#c(){return[...this.querySelectorAll(hr)]}get#p(){return this.#c.map(t=>{const e=t.dataset.url??"",s=t.querySelector("h1, h2, h3")?.textContent?.trim();return{url:e,title:t.dataset.title??(s||e)}})}get#m(){const t=this.#e===null?void 0:qt(this.#e);return t?.kind==="page"?t.page.url:this.#p[0]?.url??Ks}#h(t){if(t?.kind!=="page")return;const e=zt(this.#p,t.page.url,t.page.url);return e===void 0?void 0:this.#c.find(s=>s.dataset.url===e.url)}willUpdate(t){if(this.#e===null){const e=this.#p,s=(this.url===null?void 0:zt(e,this.url,Ks))??e[0];s!==void 0&&(this.#e=Un({url:s.url}));return}t.has("url")&&this.url!==null&&this.#f(this.url,!1)}render(){const t=this.#e;if(t===null)return d`<slot hidden></slot>`;const e=this.#o,s=this.#p,a=cr(s,t,e.newTab,this.profile),i={view:a,phone:this.#d,switcher:this.#n,shortcuts:a.entry?.kind==="new-tab"?pr(s):[],labels:e,send:r=>{this.#u(r)}},o=this.#h(a.entry);return d`<div
3581
+ `]}static{this.properties={url:{type:String},viewport:{type:String,reflect:!0},profile:{type:String}}}#a=new O(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e=null;#n=!1;#s=null;#i=!1;#r=null;constructor(){super(),this.url=null,this.viewport="desktop",this.profile=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-url","data-title"]}),this.addEventListener("click",this.#k),this.addEventListener("auxclick",this.#k)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.removeEventListener("click",this.#k),this.removeEventListener("auxclick",this.#k),this.#s!==null&&clearTimeout(this.#s),this.#s=null}get#o(){return Po(this.#a.locale)}get#l(){return this.viewport==="mobile"}get#c(){return[...this.querySelectorAll(Io)]}get#p(){return this.#c.map(t=>{const e=t.dataset.url??"",s=t.querySelector("h1, h2, h3")?.textContent?.trim();return{url:e,title:t.dataset.title??(s||e)}})}get#g(){const t=this.#e===null?void 0:Bt(this.#e);return t?.kind==="page"?t.page.url:this.#p[0]?.url??$n}#u(t){if(t?.kind!=="page")return;const e=It(this.#p,t.page.url,t.page.url);return e===void 0?void 0:this.#c.find(s=>s.dataset.url===e.url)}willUpdate(t){if(this.#e===null){const e=this.#p,s=(this.url===null?void 0:It(e,this.url,$n))??e[0];s!==void 0&&(this.#e=wa({url:s.url}));return}t.has("url")&&this.url!==null&&this.#b(this.url,!1)}render(){const t=this.#e;if(t===null)return d`<slot hidden></slot>`;const e=this.#o,s=this.#p,a=Do(s,t,e.newTab,this.profile),i={view:a,phone:this.#l,switcher:this.#n,shortcuts:a.entry?.kind==="new-tab"?Oo(s):[],labels:e,send:o=>{this.#m(o)}},r=this.#u(a.entry);return d`<div
2750
3582
  class="browser"
2751
- data-viewport=${this.#d?"mobile":"desktop"}
3583
+ data-viewport=${this.#l?"mobile":"desktop"}
2752
3584
  ?data-loading=${this.#s!==null}
2753
3585
  >
2754
- ${jn(i)}
3586
+ ${$a(i)}
2755
3587
  <div class="browser-page">
2756
- ${Nn(i,o===void 0?void 0:d`<slot></slot>`)}
3588
+ ${Ca(i,r===void 0?void 0:d`<slot></slot>`)}
2757
3589
  </div>
2758
- ${Fn(i)}
2759
- </div>`}updated(){const t=this.#e===null?void 0:qt(this.#e),e=this.#h(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 a=this.#r===null;this.#r=s,a||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#l(t){if(this.#e===null)return;const e=Hn(this.#e,t);e!==this.#e&&(this.#e=e,this.#k(),this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate())}#u(t){switch(t.kind){case"reload":this.#x();return;case"address":this.#f(t.input,!1);return;case"back":case"forward":case"new-tab":this.#n=!1,this.#l({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#n=t.open,this.requestUpdate();return;case"activate":this.#n=!1,this.#i=t.focus===!0,this.#l({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#l({kind:"close-tab",id:t.id});return;case"visit":this.#l({kind:"visit",page:t.page});return;default:return}}#f(t,e){const s=this.#m,a=zt(this.#p,t,s),i=a===void 0?{kind:"unreachable",url:_n(t,s)}:{kind:"page",page:{url:a.url}};e!==!1?this.#l({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#l({kind:"visit",page:i.page}):this.#l({kind:"unreachable",url:i.url})}#x(){if(this.#s!==null||this.#e===null)return;const t=this.#h(qt(this.#e));this.#s=setTimeout(()=>{if(this.#s=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()},ur),this.requestUpdate()}#k(){this.#s!==null&&(clearTimeout(this.#s),this.#s=null)}#v=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(r=>r instanceof HTMLAnchorElement&&this.contains(r)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const a=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",o=new URL(s,this.#m).href;this.#f(o,i||a?{background:a}:!1)}}const Js=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",Vs)},mr=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:n=>`${n} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:n=>`Remove ${n}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:n=>`${n} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:n=>`${n} \u3092\u524A\u9664`}}),gr=w({value:C(v(),E(1)),label:C(v(),E(1)),description:g(v()),group:g(v()),avatar:g(v())}),fr=w({options:$(gr),value:g(ve([v(),$(v())]))}),Zs=n=>typeof n=="string"?n===""?[]:[n]:Array.isArray(n)?n.filter(t=>typeof t=="string"&&t!==""):[],Xs=n=>{const t=W(fr,n),e=new Set;return{options:t.options.map(a=>{if(e.has(a.value))throw new Error(`duplicate option value: ${a.value}`);return e.add(a.value),{value:a.value,label:a.label,description:a.description??null,group:a.group??null,avatar:a.avatar??null}}),value:t.value===void 0?null:Zs(t.value)}},te=(n,t)=>{const e=t.trim().toLowerCase();return e===""?n:n.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},br=n=>{const t=[],e=new Map;for(const s of n){let a=e.get(s.group);a===void 0&&(a=[],e.set(s.group,a),t.push(s.group)),a.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},ee=(n,t)=>t===0?-1:Math.min(Math.max(n,0),t-1),kr=(n,t,e)=>e===0?-1:n<0?t>0?0:e-1:(n+t+e)%e,vr=(n,t,e)=>e?n.includes(t)?n.filter(s=>s!==t):[...n,t]:[t],xr=(n,t)=>n.filter(e=>e!==t),yr=(n,t)=>n.includes(t),wr=(n,t)=>n.length===t.length&&n.every((e,s)=>e===t[s]),$r=(n,t)=>t.flatMap(e=>{const s=n.find(a=>a.value===e);return s?[s]:[]}),Cr=(n,t)=>{const e=t[0];return e===void 0?null:n.find(s=>s.value===e)?.label??null},Ys=n=>{const t=n.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},Qs=["blue","green","amber","violet","accent","danger"],tn=n=>{let t=0;for(let e=0;e<n.length;e+=1)t=t*31+n.charCodeAt(e)|0;return Qs[Math.abs(t)%Qs.length]??"blue"};let Sr=0;const Er=".combo-control, .combo-listbox";class en extends z{static{this.styles=[T,M`
3590
+ ${Sa(i)}
3591
+ </div>`}updated(){const t=this.#e===null?void 0:Bt(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 a=this.#r===null;this.#r=s,a||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#d(t){if(this.#e===null)return;const e=Ea(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.#x();return;case"address":this.#b(t.input,!1);return;case"back":case"forward":case"new-tab":this.#n=!1,this.#d({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#n=t.open,this.requestUpdate();return;case"activate":this.#n=!1,this.#i=t.focus===!0,this.#d({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#d({kind:"close-tab",id:t.id});return;case"visit":this.#d({kind:"visit",page:t.page});return;default:return}}#b(t,e){const s=this.#g,a=It(this.#p,t,s),i=a===void 0?{kind:"unreachable",url:Ta(t,s)}:{kind:"page",page:{url:a.url}};e!==!1?this.#d({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#d({kind:"visit",page:i.page}):this.#d({kind:"unreachable",url:i.url})}#x(){if(this.#s!==null||this.#e===null)return;const t=this.#u(Bt(this.#e));this.#s=setTimeout(()=>{if(this.#s=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()},qo),this.requestUpdate()}#f(){this.#s!==null&&(clearTimeout(this.#s),this.#s=null)}#k=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(o=>o instanceof HTMLAnchorElement&&this.contains(o)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const a=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",r=new URL(s,this.#g).href;this.#b(r,i||a?{background:a}:!1)}}const Sn=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",Cn)},Uo=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:n=>`${n} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:n=>`Remove ${n}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:n=>`${n} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:n=>`${n} \u3092\u524A\u9664`}}),No=x({value:y(b(),S(1)),label:y(b(),S(1)),description:g(b()),group:g(b()),avatar:g(b())}),jo=x({options:$(No),value:g(Le([b(),$(b())]))}),En=n=>typeof n=="string"?n===""?[]:[n]:Array.isArray(n)?n.filter(t=>typeof t=="string"&&t!==""):[],Tn=n=>{const t=B(jo,n),e=new Set;return{options:t.options.map(a=>{if(e.has(a.value))throw new Error(`duplicate option value: ${a.value}`);return e.add(a.value),{value:a.value,label:a.label,description:a.description??null,group:a.group??null,avatar:a.avatar??null}}),value:t.value===void 0?null:En(t.value)}},pe=(n,t)=>{const e=t.trim().toLowerCase();return e===""?n:n.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},Fo=n=>{const t=[],e=new Map;for(const s of n){let a=e.get(s.group);a===void 0&&(a=[],e.set(s.group,a),t.push(s.group)),a.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},he=(n,t)=>t===0?-1:Math.min(Math.max(n,0),t-1),Ho=(n,t,e)=>e===0?-1:n<0?t>0?0:e-1:(n+t+e)%e,Wo=(n,t,e)=>e?n.includes(t)?n.filter(s=>s!==t):[...n,t]:[t],Bo=(n,t)=>n.filter(e=>e!==t),Ko=(n,t)=>n.includes(t),Vo=(n,t)=>n.length===t.length&&n.every((e,s)=>e===t[s]),Go=(n,t)=>t.flatMap(e=>{const s=n.find(a=>a.value===e);return s?[s]:[]}),Jo=(n,t)=>{const e=t[0];return e===void 0?null:n.find(s=>s.value===e)?.label??null},Mn=n=>{const t=n.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},An=["blue","green","amber","violet","accent","danger"],zn=n=>{let t=0;for(let e=0;e<n.length;e+=1)t=t*31+n.charCodeAt(e)|0;return An[Math.abs(t)%An.length]??"blue"};let Xo=0;const Yo=".combo-control, .combo-listbox";class _n extends A{static{this.styles=[L,_`
2760
3592
  :host {
2761
3593
  display: block;
2762
3594
  }
@@ -3075,11 +3907,11 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3075
3907
  color: var(--dpk-danger);
3076
3908
  font-size: 12px;
3077
3909
  }
3078
- `]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#a=`dpk-combobox-${++Sr}`;#t=new P(this);#e=new Mt(this);#n=null;#s=[];#i=[];#r=null;#o=!1;#d=null;#c=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new kn(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Er)),ownsEscape:()=>this.#o,dismiss:()=>this.#b()})}connectedCallback(){super.connectedCallback(),this.#n=_(this,Xs,t=>{t.ok?(this.#s=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#s=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=Zs(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return d`<p class="error">${this.#r}</p>`;const e=this.#d??"",s=te(this.#s,e),a=ee(this.#c,s.length),i=this.multiple?$r(this.#s,this.#i):[],o=this.multiple?null:Cr(this.#s,this.#i),r=this.multiple?this.#i.length===0:o===null,l=this.#d??(this.multiple?"":o??"");return d`
3910
+ `]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#a=`dpk-combobox-${++Xo}`;#t=new O(this);#e=new qt(this);#n=null;#s=[];#i=[];#r=null;#o=!1;#l=null;#c=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new aa(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Yo)),ownsEscape:()=>this.#o,dismiss:()=>this.#v()})}connectedCallback(){super.connectedCallback(),this.#n=X(this,Tn,t=>{t.ok?(this.#s=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#s=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=En(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return d`<p class="error">${this.#r}</p>`;const e=this.#l??"",s=pe(this.#s,e),a=he(this.#c,s.length),i=this.multiple?Go(this.#s,this.#i):[],r=this.multiple?null:Jo(this.#s,this.#i),o=this.multiple?this.#i.length===0:r===null,l=this.#l??(this.multiple?"":r??"");return d`
3079
3911
  <div class="field">
3080
- ${this.label?d`<label class="field-label" id=${this.#m}>${this.label}</label>`:h}
3912
+ ${this.label?d`<label class="field-label" id=${this.#g}>${this.label}</label>`:h}
3081
3913
  <div class="combo-control">
3082
- ${this.multiple?U(i,u=>u.value,u=>this.#x(u,t)):h}
3914
+ ${this.multiple?U(i,c=>c.value,c=>this.#x(c,t)):h}
3083
3915
  <input
3084
3916
  class="input"
3085
3917
  type="text"
@@ -3089,15 +3921,15 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3089
3921
  aria-expanded=${this.#o?"true":"false"}
3090
3922
  aria-haspopup="listbox"
3091
3923
  aria-autocomplete="list"
3092
- aria-controls=${this.#h}
3093
- aria-labelledby=${this.label?this.#m:h}
3094
- aria-activedescendant=${a>=0?this.#l(s[a]?.value??""):h}
3095
- placeholder=${r?this.placeholder??"":""}
3924
+ aria-controls=${this.#u}
3925
+ aria-labelledby=${this.label?this.#g:h}
3926
+ aria-activedescendant=${a>=0?this.#d(s[a]?.value??""):h}
3927
+ placeholder=${o?this.placeholder??"":""}
3096
3928
  .value=${l}
3097
- @focus=${this.#k}
3098
- @click=${this.#k}
3099
- @input=${this.#v}
3100
- @keydown=${this.#g}
3929
+ @focus=${this.#f}
3930
+ @click=${this.#f}
3931
+ @input=${this.#k}
3932
+ @keydown=${this.#h}
3101
3933
  />
3102
3934
  <button
3103
3935
  type="button"
@@ -3105,27 +3937,27 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3105
3937
  tabindex="-1"
3106
3938
  aria-hidden="true"
3107
3939
  data-open=${this.#o?"true":"false"}
3108
- @mousedown=${u=>u.preventDefault()}
3109
- @click=${this.#z}
3940
+ @mousedown=${c=>c.preventDefault()}
3941
+ @click=${this.#C}
3110
3942
  >
3111
- ${vn()}
3943
+ ${ia()}
3112
3944
  </button>
3113
3945
  </div>
3114
3946
  </div>
3115
- ${this.#o?this.#u(s,a,t):h}
3116
- `}updated(t){super.updated(t),this.#S()}get#p(){return mr(this.#t.locale)}get#m(){return`${this.#a}-label`}get#h(){return`${this.#a}-listbox`}#l(t){return`${this.#a}-option-${encodeURIComponent(t)}`}#u(t,e,s){const a=br(t);return d`
3947
+ ${this.#o?this.#m(s,a,t):h}
3948
+ `}updated(t){super.updated(t),this.#z()}get#p(){return Uo(this.#t.locale)}get#g(){return`${this.#a}-label`}get#u(){return`${this.#a}-listbox`}#d(t){return`${this.#a}-option-${encodeURIComponent(t)}`}#m(t,e,s){const a=Fo(t);return d`
3117
3949
  <div
3118
3950
  class="combo-listbox"
3119
3951
  popover="manual"
3120
3952
  role="listbox"
3121
- id=${this.#h}
3953
+ id=${this.#u}
3122
3954
  aria-label=${this.label??s.listLabel}
3123
3955
  aria-multiselectable=${this.multiple?"true":"false"}
3124
3956
  >
3125
3957
  <div class="options">
3126
3958
  ${t.length===0?d`<p class="empty">${s.empty}</p>`:a.map(i=>d`
3127
3959
  ${i.group!==null?d`<div class="group-heading">${i.group}</div>`:h}
3128
- ${U(i.options,o=>o.value,o=>this.#f(o,t.indexOf(o)===e))}
3960
+ ${U(i.options,r=>r.value,r=>this.#b(r,t.indexOf(r)===e))}
3129
3961
  `)}
3130
3962
  </div>
3131
3963
  <div class="footer">
@@ -3136,26 +3968,26 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3136
3968
  </span>
3137
3969
  </div>
3138
3970
  </div>
3139
- `}#f(t,e){const s=yr(this.#i,t.value);return d`
3971
+ `}#b(t,e){const s=Ko(this.#i,t.value);return d`
3140
3972
  <div
3141
3973
  class="option"
3142
- id=${this.#l(t.value)}
3974
+ id=${this.#d(t.value)}
3143
3975
  role="option"
3144
3976
  aria-selected=${s?"true":"false"}
3145
3977
  data-active=${e?"true":"false"}
3146
3978
  @mousedown=${a=>a.preventDefault()}
3147
3979
  @click=${()=>this.#w(t.value)}
3148
3980
  >
3149
- <span class="avatar" data-tone=${tn(t.value)}>${t.avatar??Ys(t.label)}</span>
3981
+ <span class="avatar" data-tone=${zn(t.value)}>${t.avatar??Mn(t.label)}</span>
3150
3982
  <span class="option-text">
3151
3983
  <span class="option-name">${t.label}</span>
3152
3984
  ${t.description!==null?d`<span class="option-desc">${t.description}</span>`:h}
3153
3985
  </span>
3154
- ${s?d`<span class="option-check" aria-hidden="true">${ft()}</span>`:h}
3986
+ ${s?d`<span class="option-check" aria-hidden="true">${Ct()}</span>`:h}
3155
3987
  </div>
3156
3988
  `}#x(t,e){return d`
3157
3989
  <span class="chip">
3158
- <span class="avatar" data-tone=${tn(t.value)}>${t.avatar??Ys(t.label)}</span>
3990
+ <span class="avatar" data-tone=${zn(t.value)}>${t.avatar??Mn(t.label)}</span>
3159
3991
  <span class="chip-label">${t.label}</span>
3160
3992
  <button
3161
3993
  type="button"
@@ -3163,12 +3995,12 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3163
3995
  tabindex="-1"
3164
3996
  aria-label=${e.removeChip(t.label)}
3165
3997
  @mousedown=${s=>s.preventDefault()}
3166
- @click=${s=>{s.stopPropagation(),this.#y(xr(this.#i,t.value))}}
3998
+ @click=${s=>{s.stopPropagation(),this.#y(Bo(this.#i,t.value))}}
3167
3999
  >
3168
- ${xn()}
4000
+ ${Te()}
3169
4001
  </button>
3170
4002
  </span>
3171
- `}#k=()=>{this.#o=!0,this.#c=-1,this.requestUpdate()};#v=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#d=t.currentTarget.value,this.#o=!0,this.#c=-1,this.requestUpdate())};#g=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=te(this.#s,this.#d??""),s=this.#o;this.#o=!0;const a=t.key==="ArrowDown"?1:-1;this.#c=s?kr(this.#c,a,e.length):-1,s||(this.#c=ee(a>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=te(this.#s,this.#d??""),s=e[ee(this.#c,e.length)];s&&this.#w(s.value);return}if(t.key==="Backspace"){if((this.#d??"")!==""||!this.multiple||this.#i.length===0)return;t.preventDefault(),this.#y(this.#i.slice(0,-1))}};#z=()=>{this.#o?this.#b():(this.#o=!0,this.#c=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#y(vr(this.#i,t,this.multiple)),this.multiple?(this.#d="",this.#c=-1,this.requestUpdate()):this.#b()}#y(t){wr(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.#d=null,this.#c=-1,this.requestUpdate()}#S(){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 sn=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",en)};let Q=null;const zr=n=>{Q!==null&&Q!==n&&Q.hide(),Q=n},Mr=n=>{Q===n&&(Q=null)};class nn extends z{static{this.styles=[T,B,M`
4003
+ `}#f=()=>{this.#o=!0,this.#c=-1,this.requestUpdate()};#k=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#l=t.currentTarget.value,this.#o=!0,this.#c=-1,this.requestUpdate())};#h=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=pe(this.#s,this.#l??""),s=this.#o;this.#o=!0;const a=t.key==="ArrowDown"?1:-1;this.#c=s?Ho(this.#c,a,e.length):-1,s||(this.#c=he(a>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=pe(this.#s,this.#l??""),s=e[he(this.#c,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.#y(this.#i.slice(0,-1))}};#C=()=>{this.#o?this.#v():(this.#o=!0,this.#c=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#y(Wo(this.#i,t,this.multiple)),this.multiple?(this.#l="",this.#c=-1,this.requestUpdate()):this.#v()}#y(t){Vo(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})))}#v(){this.#o=!1,this.#l=null,this.#c=-1,this.requestUpdate()}#z(){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 Ln=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",_n)};let dt=null;const Zo=n=>{dt!==null&&dt!==n&&dt.hide(),dt=n},Qo=n=>{dt===n&&(dt=null)};class Pn extends A{static{this.styles=[L,J,_`
3172
4004
  :host {
3173
4005
  display: contents;
3174
4006
  }
@@ -3185,7 +4017,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3185
4017
  transform: translateX(-50%);
3186
4018
  z-index: 45;
3187
4019
  }
3188
- `]}static{this.properties={label:{type:String,reflect:!0}}}#a={hide:()=>this.#e(!1)};#t=!1;constructor(){super(),this.label=null}get open(){return this.#t}connectedCallback(){super.connectedCallback(),this.#e(!0),zr(this.#a)}disconnectedCallback(){super.disconnectedCallback(),Mr(this.#a)}render(){return d`
4020
+ `]}static{this.properties={label:{type:String,reflect:!0}}}#a={hide:()=>this.#e(!1)};#t=!1;constructor(){super(),this.label=null}get open(){return this.#t}connectedCallback(){super.connectedCallback(),this.#e(!0),Zo(this.#a)}disconnectedCallback(){super.disconnectedCallback(),Qo(this.#a)}render(){return d`
3189
4021
  <div
3190
4022
  class="dpk-floatbar"
3191
4023
  popover="manual"
@@ -3195,7 +4027,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3195
4027
  >
3196
4028
  <slot></slot>
3197
4029
  </div>
3198
- `}updated(t){super.updated(t),this.#n()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#n(){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{}}#s=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const an=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",nn)};class rn extends z{static{this.styles=[T,B]}#a=new yn(this);ask(t){return this.#a.ask(t)}render(){return this.#a.render()}}const on=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",rn)},Tr=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"}}),Ar=["adopted","rejected","considered"],Lr=w({id:C(v(),$e(/^[A-Za-z0-9_-]+$/)),status:nt(Ar),label:g(C(v(),E(1))),summary:g(C(v(),E(1))),reason:g(C(v(),E(1))),tradeoffs:g($(C(v(),E(1))))}),Rr=w({options:$(Lr)}),Dr=()=>({options:[]}),ln=n=>{const t=W(Rr,n),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??[]}})}},Pr=(n,t)=>{switch(t){case"adopted":return n.adopted;case"rejected":return n.rejected;case"considered":return n.considered}},Or=(n,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:Pr(n,t.status),summary:t.summary,reason:t.reason===null?null:{label:n.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:n.tradeoffs,items:t.tradeoffs}}),qr=(n,t)=>t.options.map(e=>Or(n,e)),Ir=[T,zn,M`
4030
+ `}updated(t){super.updated(t),this.#n()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#n(){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{}}#s=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const Rn=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",Pn)};class Dn extends A{static{this.styles=[L,J]}#a=new ra(this);ask(t){return this.#a.ask(t)}render(){return this.#a.render()}}const On=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",Dn)},tl=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"}}),el=["adopted","rejected","considered"],sl=x({id:y(b(),Wt(/^[A-Za-z0-9_-]+$/)),status:Z(el),label:g(y(b(),S(1))),summary:g(y(b(),S(1))),reason:g(y(b(),S(1))),tradeoffs:g($(y(b(),S(1))))}),nl=x({options:$(sl)}),al=()=>({options:[]}),In=n=>{const t=B(nl,n),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??[]}})}},il=(n,t)=>{switch(t){case"adopted":return n.adopted;case"rejected":return n.rejected;case"considered":return n.considered}},rl=(n,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:il(n,t.status),summary:t.summary,reason:t.reason===null?null:{label:n.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:n.tradeoffs,items:t.tradeoffs}}),ol=(n,t)=>t.options.map(e=>rl(n,e)),ll=[L,ha,_`
3199
4031
  :host {
3200
4032
  display: block;
3201
4033
  color: var(--dpk-ink);
@@ -3326,7 +4158,7 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3326
4158
  color: var(--dpk-ink-faint);
3327
4159
  text-align: center;
3328
4160
  }
3329
- `];class dn extends z{static{this.styles=Ir}static{this.properties={data:{attribute:!1},heading:{type:String}}}#a=new P(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=_(this,ln,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.#n}get#s(){return Tr(this.#a.locale)}#i(t){this.#e=t,this.#n=null,this.requestUpdate()}#r(t){this.#e=null,this.#n=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#s,e=this.heading??t.heading,s=qr(t,this.#e??Dr());return d`<section class="alternatives">
4161
+ `];class qn extends A{static{this.styles=ll}static{this.properties={data:{attribute:!1},heading:{type:String}}}#a=new O(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=X(this,In,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.#n}get#s(){return tl(this.#a.locale)}#i(t){this.#e=t,this.#n=null,this.requestUpdate()}#r(t){this.#e=null,this.#n=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#s,e=this.heading??t.heading,s=ol(t,this.#e??al());return d`<section class="alternatives">
3330
4162
  ${e===""?h:d`<p class="alternatives-label dpk-label">${e}</p>`}
3331
4163
  ${this.#n===null?h:d`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#n}</p>`}
3332
4164
  ${this.#n===null&&s.length===0?d`<p class="alternatives-empty">${t.empty}</p>`:h}
@@ -3357,4 +4189,4 @@ ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
3357
4189
  </div>
3358
4190
  ${t.summary===null?h:d`<p class="option-summary">${t.summary}</p>`} ${e}
3359
4191
  </article>
3360
- </li>`}}const cn=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",dn)},Ur=()=>{wn(),$n(),Ze(),is(),xs(),pn()},pn=()=>{_e(),Cs(),Ls(),Gn(),Ps(),js(),Kn(),Vn(),_s(),Bs(),sn(),Jn(),qe(),Fe(),Js(),an(),on(),Ts(),cn()};export{Ie as $,on as A,qe as B,xs as C,dn as D,Ts as E,is as F,Ze as G,an as H,Ps as I,Fe as J,ln as K,Is as L,Et as M,Xs as N,Xt as O,Ye as P,je as Q,ps as R,Kt as S,pn as T,it as U,kt as V,pa as W,ba as X,ha as Y,fa as Z,Zn as _,Vs as a,ua as a0,ma as a1,ga as a2,ka as a3,Us as b,Hs as c,Ws as d,en as e,As as f,$s as g,rn as h,Oe as i,vs as j,Ms as k,as as l,Je as m,nn as n,Ds as o,Ne as p,cn as q,Ur as r,_e as s,Js as t,js as u,_s as v,Bs as w,sn as x,Ls as y,Cs as z};
4192
+ </li>`}}const Un=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",qn)},dl=()=>{oa(),la(),ps(),xs(),Ds(),Js(),Nn()},Nn=()=>{as(),Qs(),on(),za(),cn(),gn(),_a(),La(),vn(),yn(),Ln(),Pa(),Ye(),ss(),Sn(),Rn(),On(),an(),Un()};export{Xa as $,Qs as A,On as B,Ye as C,qn as D,Ds as E,an as F,xs as G,ps as H,Rn as I,cn as J,ss as K,Js as L,In as M,un as N,Ot as O,Tn as P,le as Q,us as R,ne as S,ts as T,Es as U,Us as V,Nn as W,ut as X,Et as Y,Ja as Z,ei as _,Cn as a,ti as a0,Ra as a1,Ze as a2,Ya as a3,Za as a4,Qa as a5,si as a6,mn as b,kn as c,xn as d,_n as e,rn as f,Zs as g,Dn as h,Xe as i,Rs as j,nn as k,vs as l,cs as m,Pn as n,dn as o,es as p,Gs as q,dl as r,Un as s,as as t,Sn as u,gn as v,vn as w,yn as x,Ln as y,on as z};