dev-process-kit 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boards.js +1 -1
- package/dist/chunks/{shared-DVAXtJwE.js → shared-4JaCIu01.js} +1 -1
- package/dist/chunks/{shared-DKxWTptq.js → shared-C-ujfGnT.js} +1 -1
- package/dist/chunks/{shared-CpI8ATFw.js → shared-CHQBlCl0.js} +1 -1
- package/dist/chunks/{shared-Dp6JBc2T.js → shared-CMWEqwI3.js} +1 -1
- package/dist/chunks/shared-CsLKVrK7.js +6912 -0
- package/dist/chunks/{shared-tkjGdHLh.js → shared-D0_BoWj3.js} +1 -1
- package/dist/chunks/{shared-zDGLGSqj.js → shared-D1ZujbZA.js} +1 -1
- package/dist/chunks/{shared-CVBp1_S_.js → shared-D2fmf6zb.js} +1 -1
- package/dist/chunks/{shared-DIEHJb_n.js → shared-D80rPPNF.js} +1 -1
- package/dist/chunks/{shared-DFW6nDO8.js → shared-DErYmK9C.js} +9 -2
- package/dist/chunks/{shared-C1y1ymFB.js → shared-DPD_cXES.js} +1 -1
- package/dist/chunks/{shared-DPayIyBW.js → shared-HkbNG84_.js} +1 -1
- package/dist/chunks/{shared-UIN_s3sw.js → shared-JOvfFoxb.js} +1 -1
- package/dist/chunks/{shared-BOQp0U9U.js → shared-KHA87RsJ.js} +114 -115
- package/dist/chunks/{shared-DOAi2-QH.js → shared-SjAP9bK0.js} +1 -1
- package/dist/chunks/{shared-giADQT1w.js → shared-_0Ev6y6i.js} +4 -4
- package/dist/chunks/shared-lVXxL9i3.js +1 -0
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/views/delegation-poker.js +1 -1
- package/dist/views/plain.js +1 -1
- package/dist/views/prototype.js +1 -1
- package/dist/views/slides.js +1 -1
- package/dist/views/task-board.js +1 -1
- package/dist/views/usm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-BTu8ZSVC.js +0 -1
- package/dist/chunks/shared-BjLRqdzA.js +0 -6724
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,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 gn,al as I,aF as ue,a6 as j,a3 as mt,af as Mt,aw as ge,u as Tt,g as mn,z as fn,av as At,aG as bn,aH as ft,aI as me,ak as kn,ax as vn,t as xn,aJ as yn,R as wn,S as $n}from"./shared-giADQT1w.js";import{o as W,r as Cn}from"./shared-D4PPk0Dk.js";import{e as Sn}from"./shared-DKxWTptq.js";import{a as fe,c as En}from"./shared-zDGLGSqj.js";import{c as zn}from"./shared-tkjGdHLh.js";import{m as _,o as Lt,k as m,I as be,D as ke,x as st,h as $,u as Dt,s as Rt,A as ve,j as k,B as Mn,n as bt,q as w,v as C,H as Pt,w as E,C as G,g as nt,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 Dn,c as Rn,a as Ce,b as Se,d as Pn,e as On,f as qn,h as Ee,g as Un,j as Ot,s as In,k as jn,l as Nn,m as Fn,n as Hn,t as Wn}from"./shared-DVAXtJwE.js";import{B as _n,t as Bn,v as ze,i as Gn,k as Kn,j as Vn}from"./shared-DFW6nDO8.js";import{d as Jn}from"./shared-Dp6JBc2T.js";class at{#a;#t;#e=null;#n=null;#s=null;#i=null;#r=new Map;#o=null;constructor(t){this.#a=t,this.#t=new zt(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,Dn(Rn(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,Xn=(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}},qt=16,Yn=.8,xt=(n,t,e,s,a)=>n==="start"?qt-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,g=u*Yn;if(c<=u){const b=xt(a,r,l,n.scale,u);return K(o,b-g,b+g)}return K(o,u-(r+l)*n.scale-g,-r*n.scale+g)};return{...n,x:i(n.x,t.x,t.width,e),y:i(n.y,t.y,t.height,s)}},Zn=(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),De='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)},g=()=>{const{width:p,height:f}=u(),v=r.width/1.2||1,y=r.height/1.2||1,S=K(Math.min((p-24)/v,(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()},b=p=>{const{width:f,height:v}=u(),y=Te([p]),S=y.width/1.2||1,D=y.height/1.2||1;l={...l,scale:K(Math.min((f-24)/S,(v-40)/D),vt,Me)},l={...l,x:(f-y.width*l.scale)/2-y.x*l.scale,y:(v-y.height*l.scale)/2-y.y*l.scale},c()},L=()=>{const{width:p}=u(),f=r.width/1.2||1,v=K((p-24)/f,vt,1);l={scale:v,x:(p-r.width*v)/2-r.x*v,y:16},c()},gt=p=>{const{width:f,height:v}=u(),y=(S,D,le,de)=>de!==void 0?qt-de:D<=le?xt(i,S,D,1,le):qt-Ae(S,D);l={scale:1,x:y(r.x,r.width,f,p?.x),y:y(r.y,r.height,v,p?.y)},c()},H=(p,f=u().width/2,v=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:v-(v-l.y)*S/y},c())},Q=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 D=t.getBoundingClientRect();H(Qn(p.deltaY),p.clientX-D.left,p.clientY-D.top);return}const{width:v,height:y}=u(),S=Zn(l,r,v,y,p.deltaX*f,p.deltaY*f,i);S!==null&&(p.preventDefault(),l=S,c())},q=new Map;let A=null,U=!1;const N=()=>{const p=[...q.values()],f=p[0];if(!f)return null;const v=p[1];return v?{x:(f.x+v.x)/2,y:(f.y+v.y)/2,distance:Math.hypot(v.x-f.x,v.y-f.y)}:{...f,distance:0}},tt=p=>{q.size===0&&(U=!1);const f=Ut(p,t,De);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 v=f.x-A.x,y=f.y-A.y;if((Math.abs(v)+Math.abs(y)>1||Math.abs(f.distance-A.distance)>1)&&(U=!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+v,y:l.y+y},c(),A=f,t.classList.toggle("is-panning",U)},et=p=>{q.delete(p.pointerId),A=N(),!(q.size>0)&&(t.classList.remove("is-panning"),p.type==="pointercancel"&&(U=!1))},ne=p=>{U&&(p.preventDefault(),p.stopPropagation()),et(p)},ae=p=>{if(U){p.preventDefault(),p.stopPropagation(),U=!1;return}!(p.target instanceof Element)||Ut(p,t,De)!==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")g();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 v=f.getBoundingClientRect(),y=t.getBoundingClientRect();let S=0,D=0;v.left<y.left+12?S=y.left+12-v.left:v.right>y.right-12&&(S=y.right-12-v.right),v.top<y.top+12?D=y.top+12-v.top:v.bottom>y.bottom-40&&(D=y.bottom-40-v.bottom),!(S===0&&D===0)&&(l={...l,x:l.x+S,y:l.y+D},c())};t.addEventListener("wheel",Q,{passive:!1}),t.addEventListener("pointerdown",tt),t.addEventListener("pointermove",se),t.addEventListener("pointerup",ne),t.addEventListener("pointercancel",et),t.addEventListener("lostpointercapture",et),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:g,fitTo:b,fitWidth:L,reset:gt,zoom:H,view:()=>({...l}),destroy(){oe?.disconnect(),t.removeEventListener("wheel",Q),t.removeEventListener("pointerdown",tt),t.removeEventListener("pointermove",se),t.removeEventListener("pointerup",ne),t.removeEventListener("pointercancel",et),t.removeEventListener("lostpointercapture",et),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),Re=160,It=(n,t,e=Re)=>Math.max(e,Math.round(n+t)),aa=(n,t,e,s=Re)=>{const a=e?96:24;return t==="ArrowDown"?It(n,a,s):t==="ArrowUp"?It(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(It(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=R({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 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`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
color: var(--dpk-ink);
|
|
@@ -119,8 +119,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.subject {
|
|
122
|
-
font-size:
|
|
123
|
-
color: var(--dpk-ink-
|
|
122
|
+
font-size: 11px;
|
|
123
|
+
color: var(--dpk-ink-soft);
|
|
124
124
|
padding-left: 10px;
|
|
125
125
|
border-left: 1px solid var(--dpk-rule-strong);
|
|
126
126
|
}
|
|
@@ -306,7 +306,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
306
306
|
border-radius: var(--dpk-radius-sm);
|
|
307
307
|
background: transparent;
|
|
308
308
|
color: var(--dpk-ink-soft);
|
|
309
|
-
font-size:
|
|
309
|
+
font-size: 11px;
|
|
310
310
|
cursor: pointer;
|
|
311
311
|
transition:
|
|
312
312
|
background var(--dpk-dur-fast) var(--dpk-ease),
|
|
@@ -394,7 +394,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
394
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}>
|
|
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.#
|
|
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
398
|
<slot name="controls" @slotchange=${this.#h}></slot>
|
|
399
399
|
${s.map((a,i)=>d`${i>0||this.#s?d`<span class="separator"></span>`:h}${a}`)}
|
|
400
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)}>
|
|
@@ -428,7 +428,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
428
428
|
@click=${()=>this.#l(!1)}
|
|
429
429
|
>
|
|
430
430
|
${he()}
|
|
431
|
-
</button>`}#
|
|
431
|
+
</button>`}#m(){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 zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
443
443
|
@keydown=${e.keydown}
|
|
444
444
|
@dblclick=${e.dblclick}
|
|
445
445
|
>
|
|
446
|
-
${
|
|
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},
|
|
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`
|
|
448
448
|
:host {
|
|
449
449
|
display: block;
|
|
450
450
|
flex-shrink: 0;
|
|
@@ -482,8 +482,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
482
482
|
border-radius: var(--dpk-radius-xs);
|
|
483
483
|
padding: 4px 8px;
|
|
484
484
|
background: transparent;
|
|
485
|
-
color: var(--dpk-ink-
|
|
486
|
-
font-size:
|
|
485
|
+
color: var(--dpk-ink-soft);
|
|
486
|
+
font-size: 11px;
|
|
487
487
|
font-weight: 600;
|
|
488
488
|
letter-spacing: 0.01em;
|
|
489
489
|
cursor: pointer;
|
|
@@ -494,7 +494,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
.diagram-match button:hover[aria-pressed='false'] {
|
|
497
|
-
color: var(--dpk-ink
|
|
497
|
+
color: var(--dpk-ink);
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
.diagram-match button[aria-pressed='true'] {
|
|
@@ -514,7 +514,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
514
514
|
border-radius: var(--dpk-radius-xs);
|
|
515
515
|
background: var(--dpk-paper-inset);
|
|
516
516
|
color: var(--dpk-ink-soft);
|
|
517
|
-
font-size:
|
|
517
|
+
font-size: 11px;
|
|
518
518
|
cursor: pointer;
|
|
519
519
|
transition:
|
|
520
520
|
background 140ms var(--dpk-ease),
|
|
@@ -531,7 +531,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
531
531
|
.dpk-tag[aria-pressed='true'] {
|
|
532
532
|
border-color: color-mix(in srgb, var(--dpk-blue) 45%, transparent);
|
|
533
533
|
background: var(--dpk-blue-soft);
|
|
534
|
-
color: var(--dpk-blue);
|
|
534
|
+
color: color-mix(in srgb, var(--dpk-blue) 78%, var(--dpk-ink));
|
|
535
535
|
font-weight: 600;
|
|
536
536
|
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
537
537
|
}
|
|
@@ -546,8 +546,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
546
546
|
.dpk-tag-count {
|
|
547
547
|
flex: none;
|
|
548
548
|
font-family: var(--dpk-mono);
|
|
549
|
-
font-size:
|
|
550
|
-
opacity: 0.7;
|
|
549
|
+
font-size: 11px;
|
|
551
550
|
font-variant-numeric: tabular-nums;
|
|
552
551
|
}
|
|
553
552
|
|
|
@@ -555,8 +554,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
555
554
|
border: 0;
|
|
556
555
|
background: none;
|
|
557
556
|
padding: 4px 6px;
|
|
558
|
-
color: var(--dpk-ink-
|
|
559
|
-
font-size:
|
|
557
|
+
color: var(--dpk-ink-soft);
|
|
558
|
+
font-size: 11px;
|
|
560
559
|
cursor: pointer;
|
|
561
560
|
}
|
|
562
561
|
|
|
@@ -564,7 +563,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
564
563
|
outline: none;
|
|
565
564
|
box-shadow: var(--dpk-focus);
|
|
566
565
|
}
|
|
567
|
-
`]}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=
|
|
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`
|
|
568
567
|
<div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
|
|
569
568
|
<div class="diagram-match" role="group" aria-label=${e.tagMatch}>
|
|
570
569
|
${Ca.map(([s,a])=>d`
|
|
@@ -578,7 +577,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
578
577
|
</button>
|
|
579
578
|
`)}
|
|
580
579
|
</div>
|
|
581
|
-
${
|
|
580
|
+
${U(t,s=>s.tag,s=>d`
|
|
582
581
|
<button
|
|
583
582
|
type="button"
|
|
584
583
|
class="dpk-tag"
|
|
@@ -593,8 +592,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
593
592
|
${e.clearTags}
|
|
594
593
|
</button>`:h}
|
|
595
594
|
</div>
|
|
596
|
-
`}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"),
|
|
597
|
-
${fe.cssText}`,document.head.append(t)},Sa=
|
|
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`
|
|
598
597
|
:host {
|
|
599
598
|
display: block;
|
|
600
599
|
min-width: 0;
|
|
@@ -615,7 +614,7 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
615
614
|
font-family: var(--dpk-mono);
|
|
616
615
|
font-size: 10px;
|
|
617
616
|
}
|
|
618
|
-
`,F=n=>`--tone: var(--dpk-${n})`;class Je extends z{static{this.styles=[En,
|
|
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}>
|
|
619
618
|
${e.title===""&&e.caption===""?h:d`<header class="dpk-chart-head">
|
|
620
619
|
${e.title===""?h:d`<span class="dpk-chart-title">${e.title}</span>`}
|
|
621
620
|
${e.caption===""?h:d`<span class="dpk-chart-value">${e.caption}</span>`}
|
|
@@ -667,7 +666,7 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
667
666
|
>`)}
|
|
668
667
|
${t.guides.map(e=>d`<span class="dpk-chart-key" data-variant="dashed" style=${F(e.tone)}>${e.label}</span>`)}
|
|
669
668
|
${t.marks.map(e=>d`<span class="dpk-chart-key" data-variant="mark" style=${F(e.tone)}>${e.label}</span>`)}
|
|
670
|
-
</div>`}}const
|
|
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`
|
|
671
670
|
:host {
|
|
672
671
|
display: block;
|
|
673
672
|
container-type: inline-size;
|
|
@@ -1145,7 +1144,7 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1145
1144
|
font-size: 11px;
|
|
1146
1145
|
color: var(--dpk-accent);
|
|
1147
1146
|
}
|
|
1148
|
-
`],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
|
|
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`
|
|
1149
1148
|
<section class="spec">
|
|
1150
1149
|
<header class="spec-toolbar">
|
|
1151
1150
|
<span class="spec-title">${this.heading??t.heading}</span>
|
|
@@ -1155,14 +1154,14 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1155
1154
|
${this.#e===null?h:d`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
|
|
1156
1155
|
${this.#e===null&&e.claims.length===0?d`<p class="spec-empty">${t.empty}</p>`:h}
|
|
1157
1156
|
<div class="spec-groups">
|
|
1158
|
-
${
|
|
1157
|
+
${U(ts(e),s=>s.target?.id??"",s=>this.#L(s))}
|
|
1159
1158
|
</div>
|
|
1160
1159
|
</section>
|
|
1161
|
-
${this.#
|
|
1160
|
+
${this.#U()}
|
|
1162
1161
|
${this.#c.render({locale:this.#p.locale,errorMessage:this.#l.sendFailed,submit:(s,a)=>this.#h(s,a)})}
|
|
1163
|
-
`}#A(t){const e=this.#l,s=
|
|
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)}
|
|
1164
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">
|
|
1165
|
-
${
|
|
1164
|
+
${U(t.claims,a=>a.id,a=>this.#P(a))}
|
|
1166
1165
|
</div>`,s=t.target;return s===null?e:d`<section class="target-group" data-target=${s.id}>
|
|
1167
1166
|
<header class="target-head" data-dpk-target=${this.#k({kind:"target",target:s.id})}>
|
|
1168
1167
|
<span class="target-label">${this.#l.target}</span>
|
|
@@ -1184,9 +1183,9 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1184
1183
|
aria-expanded=${a?"true":"false"}
|
|
1185
1184
|
aria-controls=${a?o:h}
|
|
1186
1185
|
aria-label=${a?e.hideDetails:e.showDetails}
|
|
1187
|
-
@click=${()=>this.#
|
|
1186
|
+
@click=${()=>this.#g(t.id)}
|
|
1188
1187
|
>
|
|
1189
|
-
${
|
|
1188
|
+
${me()}
|
|
1190
1189
|
</button>
|
|
1191
1190
|
<h4 class="claim-statement">${this.#$(t.statement)}</h4>
|
|
1192
1191
|
<button
|
|
@@ -1202,9 +1201,9 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1202
1201
|
${s.label}
|
|
1203
1202
|
</button>
|
|
1204
1203
|
</div>
|
|
1205
|
-
${a?this.#
|
|
1204
|
+
${a?this.#I(t,o):h}
|
|
1206
1205
|
</article>
|
|
1207
|
-
`}#
|
|
1206
|
+
`}#I(t,e){const s=this.#l,a=Wt(s,t.assurance);return d`<div class="claim-body" id=${e}>
|
|
1208
1207
|
<dl class="claim-parts">
|
|
1209
1208
|
${t.subjects.length===0?h:this.#C("subjects",s.subjects,t,t.subjects)}
|
|
1210
1209
|
${t.premises.length===0?d`<div class="claim-part" data-part="premises">
|
|
@@ -1227,26 +1226,26 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1227
1226
|
<h5>${s.notClaimed}</h5>
|
|
1228
1227
|
${this.#E(t,t.notClaimed)}
|
|
1229
1228
|
</section>`}
|
|
1230
|
-
${this.#
|
|
1229
|
+
${this.#R(t)}
|
|
1231
1230
|
</div>`}#C(t,e,s,a){return d`<div class="claim-part" data-part=${t}>
|
|
1232
1231
|
<dt>${e}</dt>
|
|
1233
1232
|
<dd>${this.#E(s,a)}</dd>
|
|
1234
1233
|
</div>`}#E(t,e){return d`<ul class="clauses">
|
|
1235
|
-
${
|
|
1234
|
+
${U(e,s=>s.id,s=>d`<li
|
|
1236
1235
|
class="clause"
|
|
1237
1236
|
data-clause=${s.id}
|
|
1238
1237
|
data-dpk-target=${this.#k({kind:"clause",claim:t.id,clause:s.id})}
|
|
1239
1238
|
>
|
|
1240
1239
|
<span class="clause-text">${this.#$(s.text)}</span>
|
|
1241
1240
|
</li>`)}
|
|
1242
|
-
</ul>`}#
|
|
1243
|
-
${s.length===0?h:d`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(a=>this.#
|
|
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))}`}
|
|
1244
1243
|
${t.source===null?h:d`<span class="claim-source"
|
|
1245
1244
|
>${e.source}: ${t.source.tool===null?h:d`${t.source.tool} · `}<code
|
|
1246
1245
|
>${t.source.ref}</code
|
|
1247
1246
|
></span
|
|
1248
1247
|
>`}
|
|
1249
|
-
</footer>`}#$(t){return d`${t.map(e=>e.kind==="text"?e.text:this.#
|
|
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
|
|
1250
1249
|
type="button"
|
|
1251
1250
|
class=${t}
|
|
1252
1251
|
data-term=${e}
|
|
@@ -1257,7 +1256,7 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1257
1256
|
@click=${a.show}
|
|
1258
1257
|
>
|
|
1259
1258
|
${s}
|
|
1260
|
-
</button>`}#
|
|
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
|
|
1261
1260
|
id="spec-tip"
|
|
1262
1261
|
class="spec-tip"
|
|
1263
1262
|
role="tooltip"
|
|
@@ -1266,10 +1265,10 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1266
1265
|
>
|
|
1267
1266
|
<p class="tip-title">${e.title}</p>
|
|
1268
1267
|
<p class="tip-body">${e.body}</p>
|
|
1269
|
-
</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=
|
|
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,`
|
|
1270
1269
|
`).replace(/<\\\/script/gi,"<\/script").split(`
|
|
1271
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:`
|
|
1272
|
-
`,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))},lt=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)},dt=(n,t)=>n.startsWith(t)?n.slice(t.length):n,ls=(n,t)=>{const e=lt(n);return e==="/dev/null"?null:dt(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[dt(os(s),"a/"),dt(lt(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]:[dt(n.slice(0,e),"a/"),dt(lt(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 b=ds();[b.headerOld,b.headerNew]=ii(l.slice(11)),s=b;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 b=s;(b===null||b.hunks.length>0||b.sawOld)&&(i(),s=ds()),s!==null&&(s.oldPath=ls(l.slice(4),"a/"),s.sawOld=!0);continue}const g=s;if(!(g===null||g.skipping)){if(l.startsWith("+++ ")&&g.hunks.length===0&&!g.sawNew){g.newPath=ls(l.slice(4),"b/"),g.sawNew=!0;continue}if(l.startsWith("@@ ")){const b=oi(l,u);g.hunks.push(b),a=b;continue}g.hunks.length>0||di(g,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=lt(c):n.newPath=lt(c);return}}if(t.startsWith("Binary files ")&&t.endsWith(" differ")){n.binary=!0;return}t==="GIT binary patch"&&(n.binary=!0,n.skipping=!0)},x=(n,t,e)=>e===void 0?{kind:n,pattern:t}:{kind:n,pattern:t,next:e},ct=x(null,/\s+/y),_t=x("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),Bt=x("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={js:{start:"code",rules:{code:[ct,x("comment",/\/\/[^\n]*/y),Bt,x("string",/`(?:\\[\s\S]|[^\\`])*`?/y),_t,x("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),x("keyword",new RegExp(`(?:${ci.join("|")})(?![\\w$])`,"y")),x("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),x(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[x("comment",/<!--[\s\S]*?(?:-->|$)/y),x("keyword",/&#?\w+;/y),x("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),x(null,/[^<&]+/y)],tag:[ct,x("tag",/\/?>/y,"text"),x("punct",/=/y),x("string",/"[^"]*"?|'[^']*'?/y),x("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[ct,Bt,_t,x("keyword",/@[\w-]+/y),x("punct",/[{}]/y),x("tag",/[^{};]+(?=\{)/y),x("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),x("number",/#[\da-f]{3,8}(?![\w-])/iy),x(null,/-?[A-Za-z_][\w-]*/y),x("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[ct,x("comment",/\/\/[^\n]*/y),Bt,x("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),x("string",/"(?:\\.|[^\\"\n])*"?/y),x("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),x("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[ct,x("comment",/(?<!\S)#[^\n]*/y),_t,x("keyword",/\$\{[^}\n]*\}?|\$\w+/y),x("attr",/(?<!\S)--?[\w-]+/y),x(null,/[^\s"'$#]+/y)]}}},hi={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"},ui=n=>n===null?null:hi[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=ui(t);if(e===null)return n===""?[]:[{kind:null,text:n}];const{start:s,rules:a}=pi[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)},wt=/[\p{L}\p{N}_$]/u,mi=(n,t)=>{let e=t;for(;e>0&&wt.test(n.charAt(e-1))&&wt.test(n.charAt(e));)e-=1;return e},fi=(n,t)=>{let e=t;for(;e<n.length&&wt.test(n.charAt(e))&&wt.test(n.charAt(e-1));)e+=1;return e},bi=(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=mi(r,s),u=fi(r,r.length-a);return[l,Math.max(l,u)]};return{before:o(n),after:o(t)}},ki=(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),g=e!==null&&l>=e[0]&&u<=e[1]&&e[0]<e[1];c!==""&&s.push({kind:i.kind,text:c,changed:g}),l=u}a=o}return s},gs=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=bi(a.text,i.text);o!==null&&(t.set(a,o.before),t.set(i,o.after))}return t},ms=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:ot(n),segments:ki(n.text,t,e.get(n)??null),target:s}),vi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=gs(ms(e));return[{kind:"hunk",hunk:e},...e.lines.map(a=>({kind:"line",cell:pt(a,t,s)}))]})},xi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=ms(e),a=gs(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,yi=n=>{const t=n.trim().replace(/\s+/g," ");return t.length>fs?`${t.slice(0,fs-1)}\u2026`:t},wi=(n,t)=>t.startsWith("R")?t.slice(1):n.deletedLine(`-${t.slice(1)}`),bs=(n,t,e)=>n.lineLabel(t,wi(n,ot(e)),yi(e.text)),$i=(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:ot(a)},label:bs(n,e.path,a)})))]),Ci=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)}),Si=[T,B,mt,M`
|
|
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`
|
|
1273
1272
|
:host {
|
|
1274
1273
|
display: block;
|
|
1275
1274
|
color: var(--dpk-ink);
|
|
@@ -1868,8 +1867,8 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1868
1867
|
padding: 8px 12px;
|
|
1869
1868
|
border-top: 1px solid var(--dpk-rule);
|
|
1870
1869
|
}
|
|
1871
|
-
`],Kt="SUGGEST_CHANGE",
|
|
1872
|
-
${t}`,
|
|
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`
|
|
1873
1872
|
<section class="diff" data-view=${s}>
|
|
1874
1873
|
<header class="toolbar">
|
|
1875
1874
|
<span class="title">${this.heading??t.heading}</span>
|
|
@@ -1890,10 +1889,10 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1890
1889
|
</header>
|
|
1891
1890
|
${this.#i===null?h:d`<p class="notice" role="alert">${t.dataError}<br />${this.#i}</p>`}
|
|
1892
1891
|
${this.#i===null&&e.files===0?d`<p class="empty">${t.empty}</p>`:h}
|
|
1893
|
-
${
|
|
1892
|
+
${U(this.#s.files,a=>a.path,a=>this.#K(a,s))}
|
|
1894
1893
|
</section>
|
|
1895
1894
|
${this.#t.render({locale:this.#a.locale,errorMessage:t.sendFailed,submit:(a,i)=>this.#A(a,i)})}
|
|
1896
|
-
`}#K(t,e){const s=this.#
|
|
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}>
|
|
1897
1896
|
<header class="file-head" data-dpk-target=${this.id?i:h}>
|
|
1898
1897
|
<button
|
|
1899
1898
|
type="button"
|
|
@@ -1903,7 +1902,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1903
1902
|
aria-label=${a?s.collapse(t.path):s.expand(t.path)}
|
|
1904
1903
|
@click=${()=>this.#q(t.path)}
|
|
1905
1904
|
>
|
|
1906
|
-
${
|
|
1905
|
+
${me()}
|
|
1907
1906
|
</button>
|
|
1908
1907
|
<span class="status" data-status=${t.status}>${s[t.status]}</span>
|
|
1909
1908
|
<span class="path"
|
|
@@ -1912,12 +1911,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1912
1911
|
<span class="file-stat"
|
|
1913
1912
|
><span class="stat-add">+${t.additions}</span> <span class="stat-del">−${t.deletions}</span></span
|
|
1914
1913
|
>
|
|
1915
|
-
${this.id?this.#
|
|
1914
|
+
${this.id?this.#X(i,t.path):h}
|
|
1916
1915
|
</header>
|
|
1917
|
-
${a?this.#
|
|
1918
|
-
</section>`}#V(t,e){const s=this.#
|
|
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">
|
|
1919
1918
|
<table class="lines" data-view=${e}>
|
|
1920
|
-
${e==="split"?this.#
|
|
1919
|
+
${e==="split"?this.#Z(t):this.#J(t)}
|
|
1921
1920
|
</table>
|
|
1922
1921
|
</div>`}#J(t){return d`<colgroup>
|
|
1923
1922
|
<col class="col-num" />
|
|
@@ -1926,7 +1925,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1926
1925
|
<col />
|
|
1927
1926
|
</colgroup>
|
|
1928
1927
|
<tbody>
|
|
1929
|
-
${
|
|
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
|
|
1930
1929
|
class="line"
|
|
1931
1930
|
data-kind=${s.line.kind}
|
|
1932
1931
|
data-line=${s.id}
|
|
@@ -1934,11 +1933,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1934
1933
|
>
|
|
1935
1934
|
<td class="num">${s.line.oldLine??""}</td>
|
|
1936
1935
|
<td class="num">${s.line.newLine??""}</td>
|
|
1937
|
-
<td class="act">${this.#
|
|
1938
|
-
${this.#
|
|
1936
|
+
<td class="act">${this.#W(t,s,a)}</td>
|
|
1937
|
+
${this.#_(s)}
|
|
1939
1938
|
</tr>
|
|
1940
1939
|
${this.#N(t,s,ks)}`})}
|
|
1941
|
-
</tbody>`}#
|
|
1940
|
+
</tbody>`}#Z(t){return d`<colgroup>
|
|
1942
1941
|
<col class="col-num" />
|
|
1943
1942
|
<col class="col-act" />
|
|
1944
1943
|
<col class="col-half" />
|
|
@@ -1947,7 +1946,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1947
1946
|
<col class="col-half" />
|
|
1948
1947
|
</colgroup>
|
|
1949
1948
|
<tbody>
|
|
1950
|
-
${
|
|
1949
|
+
${yi(t).map(e=>e.kind==="hunk"?this.#H(e.hunk,Jt):d`<tr class="pair">
|
|
1951
1950
|
${this.#F(t,e.left,"old")} ${this.#F(t,e.right,"new")}
|
|
1952
1951
|
</tr>
|
|
1953
1952
|
${e.left!==null&&e.left.target?this.#N(t,e.left,Jt):h}
|
|
@@ -1955,51 +1954,51 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1955
1954
|
</tbody>`}#F(t,e,s){if(e===null)return d`<td class="num" data-blank></td>
|
|
1956
1955
|
<td class="act" data-blank></td>
|
|
1957
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>
|
|
1958
|
-
<td class="act" data-kind=${e.line.kind}>${this.#
|
|
1959
|
-
${this.#
|
|
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">
|
|
1960
1959
|
<td colspan=${e}>
|
|
1961
1960
|
<span class="hunk-range">${s}</span
|
|
1962
1961
|
>${t.section===""?h:d` <span class="hunk-section">${t.section}</span>`}
|
|
1963
1962
|
</td>
|
|
1964
|
-
</tr>`}#
|
|
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}>
|
|
1965
1964
|
<span class="sign" aria-hidden="true">${s}</span
|
|
1966
1965
|
><span class="text"
|
|
1967
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
|
|
1968
|
-
>${t.line.noNewline?d`<span class="no-newline" title=${this.#
|
|
1969
|
-
</td>`}#j(t,e){return!this.id||!e.target?null:this.#b({kind:"line",path:t.path,line:e.id})}#
|
|
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}
|
|
1970
1969
|
><button
|
|
1971
1970
|
type="button"
|
|
1972
1971
|
class="line-btn"
|
|
1973
|
-
aria-label=${this.#
|
|
1972
|
+
aria-label=${this.#g.addOn(a)}
|
|
1974
1973
|
aria-expanded=${i?"true":"false"}
|
|
1975
|
-
title=${this.#
|
|
1974
|
+
title=${this.#g.addOn(a)}
|
|
1976
1975
|
@click=${()=>this.#L({ref:s,path:t.path,line:e.line,label:a},"comment")}
|
|
1977
1976
|
>
|
|
1978
1977
|
${pe()}
|
|
1979
1978
|
</button></span
|
|
1980
|
-
>`}#
|
|
1979
|
+
>`}#X(t,e){return d`<button
|
|
1981
1980
|
type="button"
|
|
1982
1981
|
class="dpk-icon-btn"
|
|
1983
1982
|
data-size="sm"
|
|
1984
|
-
aria-label=${this.#
|
|
1985
|
-
title=${this.#
|
|
1983
|
+
aria-label=${this.#g.commentOn(e)}
|
|
1984
|
+
title=${this.#g.commentOn(e)}
|
|
1986
1985
|
@click=${()=>this.#T(t,e)}
|
|
1987
1986
|
>
|
|
1988
|
-
${
|
|
1989
|
-
</button>`}#N(t,e,s){const a=e.line.newLine===null?[]:this.#
|
|
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">
|
|
1990
1989
|
<td colspan=${s}>${this.#B(i,o)}</td>
|
|
1991
1990
|
</tr>`}${a.map(l=>d`<tr class="extra">
|
|
1992
1991
|
<td colspan=${s}>${this.#Q(e.line,l)}</td>
|
|
1993
1992
|
</tr>`)}${r===null?h:d`<tr class="extra">
|
|
1994
1993
|
<td colspan=${s}>${this.#tt(r)}</td>
|
|
1995
|
-
</tr>`}`}#
|
|
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)}>
|
|
1996
1995
|
<ol class="thread-items">
|
|
1997
1996
|
${e.map(l=>{const u=new Date(l.createdAt);return d`<li class="thread-item" data-comment=${l.id}>
|
|
1998
1997
|
<p class="thread-meta">
|
|
1999
|
-
${
|
|
1998
|
+
${At()}
|
|
2000
1999
|
${Number.isNaN(u.getTime())?h:d`<time datetime=${l.createdAt}>${r.format(u)}</time>`}
|
|
2001
2000
|
</p>
|
|
2002
|
-
<p class="thread-body">${
|
|
2001
|
+
<p class="thread-body">${gn(l)}</p>
|
|
2003
2002
|
</li>`})}
|
|
2004
2003
|
</ol>
|
|
2005
2004
|
${this.#v===t?d`<div
|
|
@@ -2033,12 +2032,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2033
2032
|
${s.cancel}
|
|
2034
2033
|
</button>
|
|
2035
2034
|
</div>
|
|
2036
|
-
</div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#
|
|
2035
|
+
</div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#I(t)}>
|
|
2037
2036
|
${s.replyPlaceholder}
|
|
2038
2037
|
</button>`}
|
|
2039
2038
|
</section>`}#Q(t,e){const s=e.text===""?[]:e.text.split(`
|
|
2040
2039
|
`);return d`<div class="suggestion" data-action=${e.action}>
|
|
2041
|
-
<p class="suggestion-head">${fn()} ${this.#
|
|
2040
|
+
<p class="suggestion-head">${fn()} ${this.#g.suggestion}</p>
|
|
2042
2041
|
<div class="suggestion-lines">
|
|
2043
2042
|
<div class="suggestion-line" data-kind="del">
|
|
2044
2043
|
<span class="sign">-</span><span class="text">${t.text}</span>
|
|
@@ -2047,8 +2046,8 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2047
2046
|
<span class="sign">+</span><span class="text">${a}</span>
|
|
2048
2047
|
</div>`)}
|
|
2049
2048
|
</div>
|
|
2050
|
-
</div>`}#tt(t){const e=this.#
|
|
2051
|
-
`).length+1)),i=ht(t.ref,t.tab),o
|
|
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
|
|
2052
2051
|
class="composer-tabs"
|
|
2053
2052
|
role="tablist"
|
|
2054
2053
|
aria-label=${e.composerTabs}
|
|
@@ -2066,7 +2065,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2066
2065
|
</div>`:d`<strong class="composer-title">${e.comment}</strong>`;return d`<div
|
|
2067
2066
|
class="composer"
|
|
2068
2067
|
data-tab=${t.tab}
|
|
2069
|
-
@keydown=${r=>{r.isComposing||(r.key==="Escape"?(r.preventDefault(),r.stopPropagation(),this.#
|
|
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()))}}
|
|
2070
2069
|
>
|
|
2071
2070
|
<div class="composer-head">${o}<span class="composer-target">${t.label}</span></div>
|
|
2072
2071
|
<textarea
|
|
@@ -2084,7 +2083,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2084
2083
|
class="dpk-btn dpk-btn--accent"
|
|
2085
2084
|
type="button"
|
|
2086
2085
|
?disabled=${!this.#O(t)}
|
|
2087
|
-
@click=${()=>this.#
|
|
2086
|
+
@click=${()=>this.#D()}
|
|
2088
2087
|
>
|
|
2089
2088
|
${t.tab==="suggest"?e.suggest:e.addComment}
|
|
2090
2089
|
</button>
|
|
@@ -2092,12 +2091,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2092
2091
|
class="dpk-btn dpk-btn--ghost"
|
|
2093
2092
|
type="button"
|
|
2094
2093
|
data-dpk-text-discard
|
|
2095
|
-
@click=${()=>this.#
|
|
2094
|
+
@click=${()=>this.#R(!0)}
|
|
2096
2095
|
>
|
|
2097
2096
|
${e.cancel}
|
|
2098
2097
|
</button>
|
|
2099
2098
|
</div>
|
|
2100
|
-
</div>`}}const xs=()=>{customElements.get("dpk-diff")||customElements.define("dpk-diff",vs)},
|
|
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`
|
|
2101
2100
|
:host {
|
|
2102
2101
|
position: relative;
|
|
2103
2102
|
display: block;
|
|
@@ -2110,11 +2109,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2110
2109
|
font-size: 11px;
|
|
2111
2110
|
color: var(--dpk-accent);
|
|
2112
2111
|
}
|
|
2113
|
-
`]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new P(this);#t=new
|
|
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`
|
|
2114
2113
|
:host {
|
|
2115
2114
|
display: contents;
|
|
2116
2115
|
}
|
|
2117
|
-
`}static{this.properties={config:{attribute:!1}}}#a=null;#t=null;#e=null;#n=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=
|
|
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`
|
|
2118
2117
|
:host {
|
|
2119
2118
|
position: relative;
|
|
2120
2119
|
display: inline-block;
|
|
@@ -2127,7 +2126,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2127
2126
|
simply being there when the reader looks back. */
|
|
2128
2127
|
animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
|
|
2129
2128
|
}
|
|
2130
|
-
`]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#a=new P(this);#t=new
|
|
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`
|
|
2131
2130
|
:host {
|
|
2132
2131
|
display: block;
|
|
2133
2132
|
font-size: inherit;
|
|
@@ -2220,9 +2219,9 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2220
2219
|
::slotted([data-name]) {
|
|
2221
2220
|
animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
|
|
2222
2221
|
}
|
|
2223
|
-
`]}static{this.properties={selected:{type:String,reflect:!0}}}#a=`dpk-tabs-${++
|
|
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}>
|
|
2224
2223
|
<span class="indicator" aria-hidden="true"></span>
|
|
2225
|
-
${
|
|
2224
|
+
${U(e,(a,i)=>`${i}:${a}`,(a,i)=>d`<button
|
|
2226
2225
|
type="button"
|
|
2227
2226
|
role="tab"
|
|
2228
2227
|
id="${this.#a}-tab-${i}"
|
|
@@ -2236,7 +2235,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2236
2235
|
</div>
|
|
2237
2236
|
<div role="tabpanel" id="${this.#a}-panel" aria-labelledby="${this.#a}-tab-${s}">
|
|
2238
2237
|
<slot></slot>
|
|
2239
|
-
</div>`}updated(t){const e=this.#n,s=e.map(i=>i.dataset.name??""),a=e[
|
|
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`
|
|
2240
2239
|
:host {
|
|
2241
2240
|
display: block;
|
|
2242
2241
|
color: var(--dpk-ink);
|
|
@@ -2435,7 +2434,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2435
2434
|
.error {
|
|
2436
2435
|
color: var(--dpk-danger);
|
|
2437
2436
|
}
|
|
2438
|
-
`]}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=
|
|
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">
|
|
2439
2438
|
<div class="head">
|
|
2440
2439
|
<span class="heading">${this.#c}</span>
|
|
2441
2440
|
<span class="count" aria-label=${a}
|
|
@@ -2453,7 +2452,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2453
2452
|
<div class="fill" style=${`width: ${s*100}%`}></div>
|
|
2454
2453
|
</div>
|
|
2455
2454
|
${this.#s.items.length===0?d`<p class="empty">${t.empty}</p>`:d`<ul>
|
|
2456
|
-
${
|
|
2455
|
+
${U(this.#s.items,i=>i.id,i=>this.#p(t,i))}
|
|
2457
2456
|
</ul>`}
|
|
2458
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}>
|
|
2459
2458
|
<span class="check">
|
|
@@ -2462,7 +2461,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2462
2461
|
class="check-input"
|
|
2463
2462
|
type="checkbox"
|
|
2464
2463
|
.checked=${e.checked}
|
|
2465
|
-
@change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#
|
|
2464
|
+
@change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#m(e,a.currentTarget.checked)}}
|
|
2466
2465
|
/>
|
|
2467
2466
|
<span class="check-mark">${ft()}</span>
|
|
2468
2467
|
</span>
|
|
@@ -2478,9 +2477,9 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2478
2477
|
title=${t.commentOn(e.label)}
|
|
2479
2478
|
@click=${()=>{this.#h(e.id)}}
|
|
2480
2479
|
>
|
|
2481
|
-
${
|
|
2480
|
+
${At()}
|
|
2482
2481
|
</button>`:h}
|
|
2483
|
-
</li>`}#
|
|
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`
|
|
2484
2483
|
:host {
|
|
2485
2484
|
display: block;
|
|
2486
2485
|
overflow: hidden;
|
|
@@ -2597,16 +2596,16 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2597
2596
|
.punct {
|
|
2598
2597
|
color: var(--dpk-code-punct, var(--dpk-ink-soft));
|
|
2599
2598
|
}
|
|
2600
|
-
`,
|
|
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">
|
|
2601
2600
|
<span class="name">${e}</span>
|
|
2602
2601
|
${this.language?d`<span class="language">${this.language}</span>`:h}
|
|
2603
2602
|
<button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
|
|
2604
|
-
${this.#e==="copied"?ft():
|
|
2603
|
+
${this.#e==="copied"?ft():ge()}<span aria-live="polite">${s}</span>
|
|
2605
2604
|
</button>
|
|
2606
2605
|
</div>
|
|
2607
|
-
<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
|
|
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(`
|
|
2608
2607
|
`),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(`
|
|
2609
|
-
`)},
|
|
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`
|
|
2610
2609
|
:host {
|
|
2611
2610
|
min-width: 0;
|
|
2612
2611
|
}
|
|
@@ -2676,7 +2675,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2676
2675
|
display: none;
|
|
2677
2676
|
}
|
|
2678
2677
|
}
|
|
2679
|
-
`;class
|
|
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">
|
|
2680
2679
|
${s.label===""?h:d`<span class="name">${s.label}</span>`}
|
|
2681
2680
|
<div class="tabs" role="tablist" aria-label=${i}>
|
|
2682
2681
|
${s.variants.map((r,l)=>d`<button
|
|
@@ -2696,9 +2695,9 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2696
2695
|
type="button"
|
|
2697
2696
|
data-state=${this.#s}
|
|
2698
2697
|
aria-label=${t.copyLabel(i)}
|
|
2699
|
-
@click=${()=>this.#
|
|
2698
|
+
@click=${()=>this.#m()}
|
|
2700
2699
|
>
|
|
2701
|
-
${this.#s==="copied"?ft():
|
|
2700
|
+
${this.#s==="copied"?ft():ge()}<span aria-live="polite">${o}</span>
|
|
2702
2701
|
</button>
|
|
2703
2702
|
</div>
|
|
2704
2703
|
${s.variants.map((r,l)=>d`<pre
|
|
@@ -2707,7 +2706,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2707
2706
|
aria-labelledby="code-group-tab-${l}"
|
|
2708
2707
|
?hidden=${l!==a}
|
|
2709
2708
|
><code>${this.#p(r)}</code></pre>`)}`}#o(t,e){return d`<div class="bar"><span class="name">${t}</span></div>
|
|
2710
|
-
${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#
|
|
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`
|
|
2711
2710
|
:host {
|
|
2712
2711
|
display: block;
|
|
2713
2712
|
height: var(--dpk-browser-height, 460px);
|
|
@@ -2747,7 +2746,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2747
2746
|
::slotted(*) {
|
|
2748
2747
|
flex: 1 0 auto;
|
|
2749
2748
|
}
|
|
2750
|
-
`]}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
|
|
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
|
|
2751
2750
|
class="browser"
|
|
2752
2751
|
data-viewport=${this.#d?"mobile":"desktop"}
|
|
2753
2752
|
?data-loading=${this.#s!==null}
|
|
@@ -2757,7 +2756,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2757
2756
|
${Nn(i,o===void 0?void 0:d`<slot></slot>`)}
|
|
2758
2757
|
</div>
|
|
2759
2758
|
${Fn(i)}
|
|
2760
|
-
</div>`}updated(){const t=this.#e===null?void 0:
|
|
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`
|
|
2761
2760
|
:host {
|
|
2762
2761
|
display: block;
|
|
2763
2762
|
}
|
|
@@ -3076,11 +3075,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3076
3075
|
color: var(--dpk-danger);
|
|
3077
3076
|
font-size: 12px;
|
|
3078
3077
|
}
|
|
3079
|
-
`]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#a=`dpk-combobox-${++
|
|
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`
|
|
3080
3079
|
<div class="field">
|
|
3081
|
-
${this.label?d`<label class="field-label" id=${this.#
|
|
3080
|
+
${this.label?d`<label class="field-label" id=${this.#m}>${this.label}</label>`:h}
|
|
3082
3081
|
<div class="combo-control">
|
|
3083
|
-
${this.multiple?
|
|
3082
|
+
${this.multiple?U(i,u=>u.value,u=>this.#x(u,t)):h}
|
|
3084
3083
|
<input
|
|
3085
3084
|
class="input"
|
|
3086
3085
|
type="text"
|
|
@@ -3091,14 +3090,14 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3091
3090
|
aria-haspopup="listbox"
|
|
3092
3091
|
aria-autocomplete="list"
|
|
3093
3092
|
aria-controls=${this.#h}
|
|
3094
|
-
aria-labelledby=${this.label?this.#
|
|
3093
|
+
aria-labelledby=${this.label?this.#m:h}
|
|
3095
3094
|
aria-activedescendant=${a>=0?this.#l(s[a]?.value??""):h}
|
|
3096
3095
|
placeholder=${r?this.placeholder??"":""}
|
|
3097
3096
|
.value=${l}
|
|
3098
3097
|
@focus=${this.#k}
|
|
3099
3098
|
@click=${this.#k}
|
|
3100
3099
|
@input=${this.#v}
|
|
3101
|
-
@keydown=${this.#
|
|
3100
|
+
@keydown=${this.#g}
|
|
3102
3101
|
/>
|
|
3103
3102
|
<button
|
|
3104
3103
|
type="button"
|
|
@@ -3114,7 +3113,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3114
3113
|
</div>
|
|
3115
3114
|
</div>
|
|
3116
3115
|
${this.#o?this.#u(s,a,t):h}
|
|
3117
|
-
`}updated(t){super.updated(t),this.#S()}get#p(){return
|
|
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`
|
|
3118
3117
|
<div
|
|
3119
3118
|
class="combo-listbox"
|
|
3120
3119
|
popover="manual"
|
|
@@ -3126,7 +3125,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3126
3125
|
<div class="options">
|
|
3127
3126
|
${t.length===0?d`<p class="empty">${s.empty}</p>`:a.map(i=>d`
|
|
3128
3127
|
${i.group!==null?d`<div class="group-heading">${i.group}</div>`:h}
|
|
3129
|
-
${
|
|
3128
|
+
${U(i.options,o=>o.value,o=>this.#f(o,t.indexOf(o)===e))}
|
|
3130
3129
|
`)}
|
|
3131
3130
|
</div>
|
|
3132
3131
|
<div class="footer">
|
|
@@ -3137,7 +3136,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3137
3136
|
</span>
|
|
3138
3137
|
</div>
|
|
3139
3138
|
</div>
|
|
3140
|
-
`}#f(t,e){const s=
|
|
3139
|
+
`}#f(t,e){const s=yr(this.#i,t.value);return d`
|
|
3141
3140
|
<div
|
|
3142
3141
|
class="option"
|
|
3143
3142
|
id=${this.#l(t.value)}
|
|
@@ -3147,7 +3146,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3147
3146
|
@mousedown=${a=>a.preventDefault()}
|
|
3148
3147
|
@click=${()=>this.#w(t.value)}
|
|
3149
3148
|
>
|
|
3150
|
-
<span class="avatar" data-tone=${tn(t.value)}>${t.avatar??
|
|
3149
|
+
<span class="avatar" data-tone=${tn(t.value)}>${t.avatar??Ys(t.label)}</span>
|
|
3151
3150
|
<span class="option-text">
|
|
3152
3151
|
<span class="option-name">${t.label}</span>
|
|
3153
3152
|
${t.description!==null?d`<span class="option-desc">${t.description}</span>`:h}
|
|
@@ -3156,7 +3155,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3156
3155
|
</div>
|
|
3157
3156
|
`}#x(t,e){return d`
|
|
3158
3157
|
<span class="chip">
|
|
3159
|
-
<span class="avatar" data-tone=${tn(t.value)}>${t.avatar??
|
|
3158
|
+
<span class="avatar" data-tone=${tn(t.value)}>${t.avatar??Ys(t.label)}</span>
|
|
3160
3159
|
<span class="chip-label">${t.label}</span>
|
|
3161
3160
|
<button
|
|
3162
3161
|
type="button"
|
|
@@ -3164,12 +3163,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3164
3163
|
tabindex="-1"
|
|
3165
3164
|
aria-label=${e.removeChip(t.label)}
|
|
3166
3165
|
@mousedown=${s=>s.preventDefault()}
|
|
3167
|
-
@click=${s=>{s.stopPropagation(),this.#y(
|
|
3166
|
+
@click=${s=>{s.stopPropagation(),this.#y(xr(this.#i,t.value))}}
|
|
3168
3167
|
>
|
|
3169
3168
|
${xn()}
|
|
3170
3169
|
</button>
|
|
3171
3170
|
</span>
|
|
3172
|
-
`}#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())};#
|
|
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`
|
|
3173
3172
|
:host {
|
|
3174
3173
|
display: contents;
|
|
3175
3174
|
}
|
|
@@ -3186,7 +3185,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3186
3185
|
transform: translateX(-50%);
|
|
3187
3186
|
z-index: 45;
|
|
3188
3187
|
}
|
|
3189
|
-
`]}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),
|
|
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`
|
|
3190
3189
|
<div
|
|
3191
3190
|
class="dpk-floatbar"
|
|
3192
3191
|
popover="manual"
|
|
@@ -3196,7 +3195,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3196
3195
|
>
|
|
3197
3196
|
<slot></slot>
|
|
3198
3197
|
</div>
|
|
3199
|
-
`}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)},
|
|
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`
|
|
3200
3199
|
:host {
|
|
3201
3200
|
display: block;
|
|
3202
3201
|
color: var(--dpk-ink);
|
|
@@ -3327,12 +3326,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3327
3326
|
color: var(--dpk-ink-faint);
|
|
3328
3327
|
text-align: center;
|
|
3329
3328
|
}
|
|
3330
|
-
`];class dn extends z{static{this.styles=
|
|
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">
|
|
3331
3330
|
${e===""?h:d`<p class="alternatives-label dpk-label">${e}</p>`}
|
|
3332
3331
|
${this.#n===null?h:d`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#n}</p>`}
|
|
3333
3332
|
${this.#n===null&&s.length===0?d`<p class="alternatives-empty">${t.empty}</p>`:h}
|
|
3334
3333
|
${s.length===0?h:d`<ul class="options">
|
|
3335
|
-
${
|
|
3334
|
+
${U(s,a=>a.id,a=>this.#o(a))}
|
|
3336
3335
|
</ul>`}
|
|
3337
3336
|
</section>`}#o(t){const e=t.reason===null&&t.tradeoffs===null?h:d`<dl class="option-facts">
|
|
3338
3337
|
${t.reason===null?h:d`<div class="option-fact">
|
|
@@ -3358,4 +3357,4 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3358
3357
|
</div>
|
|
3359
3358
|
${t.summary===null?h:d`<p class="option-summary">${t.summary}</p>`} ${e}
|
|
3360
3359
|
</article>
|
|
3361
|
-
</li>`}}const cn=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",dn)},Ur=()=>{wn(),$n(),
|
|
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};
|