dev-process-kit 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,544 @@
1
+ import{q as v,al as y,v as Y,aq as R,ab as l,as as D,ad as m,ae as g,ar as L,a7 as Me,aw as Ne,a8 as M,a9 as C,aa as P,P as Ye,f as Le,V as _,R as u,$ as F,a4 as Ce,k as Pe,_ as J,a0 as I,a1 as c,I as Ve,A as Be,K as Ue,i as qe,m as N,a2 as S,J as ze,B as Ge,au as je,T as X}from"./shared-RRxRtPfs.js";import{s as Ke,D as He}from"./shared-BFAVBf4I.js";import{P as Z,r as Fe,p as Je,a as Xe}from"./shared-C8LUysSF.js";import{o as V}from"./shared-BAfKXeYg.js";const p={SET_ACTIVITY_NAME:v("SET_ACTIVITY_NAME","activity",y({name:m(l(),g(1))})),SET_STEP_NAME:v("SET_STEP_NAME","step",y({name:m(l(),g(1))})),REORDER_STEP:v("REORDER_STEP","step",y({after:R(l())}),{mode:"sequence"}),ADD_ACTIVITY:v("ADD_ACTIVITY","page",y({id:D,name:m(l(),g(1))}),{dedupeKey:Y}),ADD_STEP:v("ADD_STEP","activity",y({id:D,name:m(l(),g(1))}),{dedupeKey:Y}),DELETE_ACTIVITY:v("DELETE_ACTIVITY","activity",y({})),DELETE_STEP:v("DELETE_STEP","step",y({})),SET_STORY_NAME:v("SET_STORY_NAME","story",y({name:m(l(),g(1))})),SET_STORY_DESCRIPTION:v("SET_STORY_DESCRIPTION","story",y({description:l()})),SET_STORY_MILESTONE:v("SET_STORY_MILESTONE","story",y({milestoneId:R(l())})),MOVE_STORY:v("MOVE_STORY","story",y({activityId:m(l(),g(1)),stepId:m(l(),g(1)),milestoneId:R(l()),after:R(l())}),{mode:"sequence"}),REORDER_STORY:v("REORDER_STORY","story",y({after:R(l())}),{mode:"sequence"}),ADD_STORY:v("ADD_STORY","step",y({id:D,name:m(l(),g(1)),activityId:m(l(),g(1)),milestoneId:L(l())}),{dedupeKey:Y}),DELETE_STORY:v("DELETE_STORY","story",y({})),SET_MILESTONE_NAME:v("SET_MILESTONE_NAME","milestone",y({name:m(l(),g(1))})),ADD_MILESTONE:v("ADD_MILESTONE","page",y({id:D,name:m(l(),g(1))}),{dedupeKey:Y}),DELETE_MILESTONE:v("DELETE_MILESTONE","milestone",y({})),REORDER_MILESTONE:v("REORDER_MILESTONE","milestone",y({after:R(l())}),{mode:"sequence"})},Ze={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}})},Qe=M({id:m(l(),g(1)),name:m(l(),g(1))}),We=M({id:D,name:m(l(),g(1)),steps:C(P(Qe),[])}),et=M({id:m(l(),g(1)),name:m(l(),g(1))}),tt=M({id:D,name:m(l(),g(1)),description:L(l()),activityId:m(l(),g(1)),stepId:m(l(),g(1)),milestoneId:L(l())}),it=M({title:L(l()),activities:C(P(We),[]),milestones:C(P(et),[]),stories:C(P(tt),[])}),Q=e=>{const t=Me(it,e),i=new Map;for(const o of t.activities)for(const a of o.steps)i.set(a.id,o.id);const n=new Set(t.milestones.map(o=>o.id)),s=new Set,r=(o,a)=>{if(s.has(a))throw new Error(`duplicate id "${a}" in ${o}`);s.add(a)};for(const o of t.activities){r("activities",o.id);for(const a of o.steps)r("steps",a.id)}for(const o of t.milestones)r("milestones",o.id);for(const o of t.stories){r("stories",o.id);const a=i.get(o.stepId);if(a===void 0||a!==o.activityId)throw new Error(`story "${o.id}" references unknown activityId/stepId`);if(o.milestoneId!==void 0&&!n.has(o.milestoneId))throw new Error(`story "${o.id}" references unknown milestoneId "${o.milestoneId}"`)}return t},W=()=>({activities:[],milestones:[],stories:[]}),w=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},z=(e,t)=>`${e}.${t}`,h=(e,t)=>{if(t===void 0)return;const i=Ne(t,2);if(i){const[n,s]=i;if(n===void 0||s===void 0)return;const r=e.activities.find(a=>a.id===n),o=r?.steps.find(a=>a.id===s);return r&&o?{activity:r,step:o}:void 0}if(!t.includes("."))for(const n of e.activities){const s=n.steps.find(r=>r.id===t);if(s)return{activity:n,step:s}}},k=(e,t)=>{if(t!==void 0)return e.milestones.find(i=>i.id===t)},b=(e,t)=>{if(t!==void 0)return e.stories.find(i=>i.id===t)},ee=e=>e.activities.flatMap(t=>t.steps.map(i=>({activity:t,step:i}))),nt=e=>({...e,stories:Ke(e.stories,[t=>`${t.activityId}/${t.stepId}/${t.milestoneId??""}`])}),B=(e,t,i)=>e.stories.filter(n=>n.stepId===t&&(n.milestoneId??void 0)===i),te=(e,t,i)=>e.stories.filter(n=>n.activityId===t&&(n.milestoneId??void 0)===i),x=e=>[...e.activities.map(t=>t.id),...e.activities.flatMap(t=>t.steps.map(i=>i.id)),...e.milestones.map(t=>t.id),...e.stories.map(t=>t.id)],st=(e,t)=>e.stories.filter(i=>i.stepId===t).length,ie=(e,t)=>{const i=Ye(p,t);if(i===null)return null;const n=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":{const{name:s}=i.payload;return e.activities.some(r=>r.id===n)?{...e,activities:e.activities.map(r=>r.id===n?{...r,name:s}:r)}:null}case"SET_STEP_NAME":{const{name:s}=i.payload,r=h(e,n);return r?{...e,activities:e.activities.map(o=>o.id===r.activity.id?{...o,steps:o.steps.map(a=>a.id===r.step.id?{...a,name:s}:a)}:o)}:null}case"REORDER_STEP":{const{after:s}=i.payload,r=h(e,n);if(!r)return null;const o=s===null?null:h(e,s);if(s!==null&&(!o||o.activity.id!==r.activity.id))return null;const a=se(r.activity.steps,r.step.id,o?.step.id??null);return a===null?null:{...e,activities:e.activities.map(d=>d.id===r.activity.id?{...d,steps:a}:d)}}case"ADD_ACTIVITY":{const s=i.payload;return e.activities.some(r=>r.id===s.id)?e:{...e,activities:[...e.activities,{id:s.id,name:s.name,steps:[]}]}}case"ADD_STEP":{const s=i.payload,r=e.activities.find(o=>o.id===n);return r?r.steps.some(o=>o.id===s.id)?e:{...e,activities:e.activities.map(o=>o.id===n?{...o,steps:[...o.steps,{id:s.id,name:s.name}]}:o)}:null}case"DELETE_ACTIVITY":{const s=e.activities.find(o=>o.id===n);if(!s)return null;const r=new Set(s.steps.map(o=>o.id));return{...e,activities:e.activities.filter(o=>o.id!==n),stories:e.stories.filter(o=>o.activityId!==n&&!r.has(o.stepId))}}case"DELETE_STEP":{const s=h(e,n);return s?{...e,activities:e.activities.map(r=>r.id===s.activity.id?{...r,steps:r.steps.filter(o=>o.id!==s.step.id)}:r),stories:e.stories.filter(r=>r.activityId!==s.activity.id||r.stepId!==s.step.id)}:null}case"SET_STORY_NAME":{const{name:s}=i.payload;return G(e,n,r=>({...r,name:s}))}case"SET_STORY_DESCRIPTION":{const{description:s}=i.payload;return G(e,n,r=>({...r,description:s}))}case"SET_STORY_MILESTONE":{const{milestoneId:s}=i.payload;return s!==null&&!k(e,s)?null:G(e,n,r=>s===null?j(r):{...r,milestoneId:s})}case"MOVE_STORY":{const s=i.payload,r=b(e,n);if(!r)return null;const o=h(e,s.stepId);if(!o||o.activity.id!==s.activityId||s.milestoneId!==null&&!k(e,s.milestoneId))return null;const a=s.milestoneId??void 0,d=a===void 0?{...j(r),activityId:o.activity.id,stepId:o.step.id}:{...r,activityId:o.activity.id,stepId:o.step.id,milestoneId:a};return ne(e,d,s.after)}case"REORDER_STORY":{const{after:s}=i.payload,r=b(e,n);return r?ne(e,r,s,!0):null}case"ADD_STORY":{const s=i.payload,r=h(e,t.target.id);if(!r||r.activity.id!==s.activityId||s.milestoneId!==void 0&&!k(e,s.milestoneId))return null;if(e.stories.some(a=>a.id===s.id))return e;const o={id:s.id,name:s.name,activityId:s.activityId,stepId:r.step.id,...s.milestoneId===void 0?{}:{milestoneId:s.milestoneId}};return{...e,stories:[...e.stories,o]}}case"DELETE_STORY":return e.stories.some(s=>s.id===n)?{...e,stories:e.stories.filter(s=>s.id!==n)}:null;case"SET_MILESTONE_NAME":{const{name:s}=i.payload;return e.milestones.some(r=>r.id===n)?{...e,milestones:e.milestones.map(r=>r.id===n?{...r,name:s}:r)}:null}case"ADD_MILESTONE":{const s=i.payload;return e.milestones.some(r=>r.id===s.id)?e:{...e,milestones:[...e.milestones,{id:s.id,name:s.name}]}}case"DELETE_MILESTONE":return e.milestones.some(s=>s.id===n)?{...e,milestones:e.milestones.filter(s=>s.id!==n),stories:e.stories.map(s=>s.milestoneId===n?j(s):s)}:null;case"REORDER_MILESTONE":{const{after:s}=i.payload,r=se(e.milestones,n,s);return r===null?null:{...e,milestones:r}}default:return Le(i)}},G=(e,t,i)=>e.stories.some(n=>n.id===t)?{...e,stories:e.stories.map(n=>n.id===t?i(n):n)}:null,j=e=>{const{milestoneId:t,...i}=e;return i},ne=(e,t,i,n=!1)=>{const s=t.milestoneId??void 0,r=e.stories.filter(f=>f.id!==t.id),o=r.filter(f=>f.stepId===t.stepId&&(f.milestoneId??void 0)===s);if(i!==null){const f=r.find(A=>A.id===i);if(!f||f.stepId!==t.stepId||(f.milestoneId??void 0)!==s)return null;if(n){const A=b(e,t.id);if(!A||f.stepId!==A.stepId||(f.milestoneId??void 0)!==(A.milestoneId??void 0))return null}}const a=i===null?[t,...o]:re(o,t,i),d=r.findIndex(f=>f.stepId===t.stepId&&(f.milestoneId??void 0)===s),$=new Set(o.map(f=>f.id)),E=r.filter(f=>!$.has(f.id)),T=d<0?E.length:Math.min(d,E.length),Ae=[...E.slice(0,T),...a,...E.slice(T)];return{...e,stories:Ae}},se=(e,t,i)=>{if(!e.some(r=>r.id===t)||i!==null&&!e.some(r=>r.id===i))return null;if(i===t)return[...e];const n=e.find(r=>r.id===t);if(n===void 0)return null;const s=e.filter(r=>r.id!==t);return re(s,n,i)},re=(e,t,i)=>{const n=[...e],s=i===null?-1:n.findIndex(r=>r.id===i);return n.splice(s+1,0,t),n},U=(e,t)=>{const i=typeof t=="string"?t:"",n=typeof e=="string"?e:void 0;return n===void 0?`\u2192 \u300C${i}\u300D`:`\u300C${n}\u300D\u2192\u300C${i}\u300D`},rt={SET_ACTIVITY_NAME:(e,t)=>({title:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u540D\u3092\u5909\u66F4",tone:"update",body:U(w(t,e.target.id)?.name,u(p.SET_ACTIVITY_NAME,e).name??"")}),SET_STEP_NAME:(e,t)=>({title:"\u30B9\u30C6\u30C3\u30D7\u540D\u3092\u5909\u66F4",tone:"update",body:U(h(t,e.target.id)?.step.name,u(p.SET_STEP_NAME,e).name??"")}),REORDER_STEP:e=>({title:"\u30B9\u30C6\u30C3\u30D7\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:u(p.REORDER_STEP,e).after===null||u(p.REORDER_STEP,e).after===void 0?"\u2192 \u5148\u982D\u3078":`\u2192 \u300C${String(u(p.REORDER_STEP,e).after)}\u300D\u306E\u76F4\u5F8C\u3078`}),ADD_ACTIVITY:e=>({title:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${u(p.ADD_ACTIVITY,e).name??""}\u300D`}),ADD_STEP:e=>({title:"\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${u(p.ADD_STEP,e).name??""}\u300D`}),DELETE_ACTIVITY:(e,t)=>({title:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${w(t,e.target.id)?.name??e.target.id}\u300D`}),DELETE_STEP:(e,t)=>({title:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${h(t,e.target.id)?.step.name??e.target.id}\u300D`}),SET_STORY_NAME:(e,t)=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",tone:"update",body:U(b(t,e.target.id)?.name,u(p.SET_STORY_NAME,e).name??"")}),SET_STORY_DESCRIPTION:e=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",tone:"update",body:`\u2192 \u300C${String(u(p.SET_STORY_DESCRIPTION,e).description??"").slice(0,90)}\u300D`}),SET_STORY_MILESTONE:(e,t)=>({title:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u5909\u66F4",tone:"move",body:u(p.SET_STORY_MILESTONE,e).milestoneId===null||u(p.SET_STORY_MILESTONE,e).milestoneId===void 0?"\u2192 \u672A\u5272\u5F53\u3078":`\u2192 ${k(t,String(u(p.SET_STORY_MILESTONE,e).milestoneId))?.name??String(u(p.SET_STORY_MILESTONE,e).milestoneId)}`}),MOVE_STORY:(e,t)=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u79FB\u52D5",tone:"move",body:`\u2192 ${h(t,String(u(p.MOVE_STORY,e).stepId))?.step.name??String(u(p.MOVE_STORY,e).stepId??"")}`}),REORDER_STORY:e=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:u(p.REORDER_STORY,e).after===null||u(p.REORDER_STORY,e).after===void 0?"\u2192 \u5148\u982D\u3078":`\u2192 \u300C${String(u(p.REORDER_STORY,e).after)}\u300D\u306E\u76F4\u5F8C\u3078`}),ADD_STORY:e=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${u(p.ADD_STORY,e).name??""}\u300D`}),DELETE_STORY:(e,t)=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${b(t,e.target.id)?.name??e.target.id}\u300D`}),SET_MILESTONE_NAME:(e,t)=>({title:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u540D\u3092\u5909\u66F4",tone:"update",body:U(k(t,e.target.id)?.name,u(p.SET_MILESTONE_NAME,e).name??"")}),ADD_MILESTONE:e=>({title:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${u(p.ADD_MILESTONE,e).name??""}\u300D`}),DELETE_MILESTONE:(e,t)=>({title:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${k(t,e.target.id)?.name??e.target.id}\u300D`}),REORDER_MILESTONE:e=>({title:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:u(p.REORDER_MILESTONE,e).after===null||u(p.REORDER_MILESTONE,e).after===void 0?"\u2192 \u5148\u982D\u3078":`\u2192 \u300C${String(u(p.REORDER_MILESTONE,e).after)}\u300D\u306E\u76F4\u5F8C\u3078`})},oe=(e,t,i)=>{let n;try{const s=rt[e.type];n=s?s(e,i??t):{title:e.type,tone:"meta"}}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:de(t,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ae=e=>`${e.type} ${_(e.target)} ${JSON.stringify(e.payload)}`,de=(e,t)=>{try{switch(t.type){case"activity":{const i=w(e,t.id);return i?`\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3 \xB7 ${i.name}`:`\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3 \xB7 ${t.id} (missing)`}case"step":{const i=h(e,t.id)?.step;return i?`\u30B9\u30C6\u30C3\u30D7 \xB7 ${i.name}`:`\u30B9\u30C6\u30C3\u30D7 \xB7 ${t.id} (missing)`}case"story":{const i=b(e,t.id);return i?`\u30B9\u30C8\u30FC\u30EA\u30FC \xB7 ${i.name}`:`\u30B9\u30C8\u30FC\u30EA\u30FC \xB7 ${t.id} (missing)`}case"milestone":{const i=k(e,t.id);return i?`\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3 \xB7 ${i.name}`:`\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3 \xB7 ${t.id} (missing)`}case"page":return`\u30DE\u30C3\u30D7 \xB7 ${K(e)}`;default:return`${t.type} \xB7 ${t.id}`}}catch{return`${t.type} \xB7 ${t.id}`}},le=(e,t)=>{const i=[{value:"page:usm",label:"\u30DE\u30C3\u30D7\u5168\u4F53",group:"\u30DE\u30C3\u30D7"}];for(const n of e.activities){i.push({value:_({type:"activity",id:n.id}),label:n.name,group:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3"});for(const s of n.steps)i.push({value:_({type:"step",id:z(n.id,s.id)}),label:`${n.name} \u203A ${s.name}`,group:"\u30B9\u30C6\u30C3\u30D7"})}for(const n of e.milestones)i.push({value:_({type:"milestone",id:n.id}),label:n.name,group:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3"});for(const n of e.stories)i.push({value:_({type:"story",id:n.id}),label:n.name,group:"\u30B9\u30C8\u30FC\u30EA\u30FC"});return i},ot=(e,t)=>{const i=e.stories.find(n=>n.id===t.story);if(i)return{value:_({type:"story",id:i.id}),label:i.name,group:"\u30B9\u30C8\u30FC\u30EA\u30FC"};for(const n of e.activities){const s=n.steps.find(r=>r.id===t.step);if(s)return{value:_({type:"step",id:z(n.id,s.id)}),label:s.name,group:"\u30B9\u30C6\u30C3\u30D7"}}return null},K=e=>e.title??"User Story Mapping",ce=(e,t)=>{const i=h(e,t.step),n=i?.activity??w(e,t.activity)??e.activities[0],s=i?.step??n?.steps.find(a=>a.id===t.step)??n?.steps[0],r=b(e,t.story),o={...t};return n?o.activity=n.id:delete o.activity,s?o.step=s.id:delete o.step,r?o.story=r.id:delete o.story,o.view=t.view==="group"?"group":"activity",o},pe=(e,t)=>{switch(t.type){case"activity":return w(e,t.id)!==void 0;case"step":return h(e,t.id)!==void 0;case"story":return b(e,t.id)!==void 0;case"milestone":return k(e,t.id)!==void 0;case"page":return!0;default:return!1}},ue={name:"usm",label:"User Story Mapping",parseBase:Q,emptyBase:W,actions:p,apply:ie,canonicalState:nt,hasTarget:pe,canonicalTarget:(e,t)=>{if(t.type!=="step")return t;const i=h(e,t.id);return i?{...t,id:z(i.activity.id,i.step.id)}:t},describe:oe,serialize:ae,resolveNavigation:ce,commentTargets:(e,t)=>le(e),currentTarget:(e,t)=>ot(e,t),title:K},at={width:300,height:260},dt=F`
2
+ :host {
3
+ display: grid;
4
+ gap: 5px;
5
+ background: var(--dpk-paper-raised);
6
+ border: 1px solid var(--dpk-rule);
7
+ border-radius: var(--dpk-radius);
8
+ box-shadow: var(--dpk-shadow-xs);
9
+ padding: 10px 12px 8px;
10
+ cursor: pointer;
11
+ transition:
12
+ box-shadow 200ms ease,
13
+ transform 200ms ease,
14
+ border-color 200ms ease;
15
+ }
16
+
17
+ :host(:hover) {
18
+ border-color: var(--dpk-rule-strong);
19
+ box-shadow: var(--dpk-shadow-sm);
20
+ transform: translateY(-1px);
21
+ }
22
+
23
+ :host([focused]) {
24
+ border-color: var(--dpk-blue);
25
+ box-shadow:
26
+ var(--dpk-shadow),
27
+ 0 0 0 2px rgba(51, 102, 204, 0.12);
28
+ }
29
+
30
+ :host([dragging]) {
31
+ opacity: 0.45;
32
+ transform: none;
33
+ }
34
+
35
+ .card-name {
36
+ font-size: 13px;
37
+ font-weight: 620;
38
+ letter-spacing: -0.01em;
39
+ line-height: 1.3;
40
+ }
41
+
42
+ .card-text {
43
+ font-size: 11.5px;
44
+ line-height: 1.5;
45
+ color: var(--dpk-ink-soft);
46
+ white-space: pre-wrap;
47
+ }
48
+
49
+ .card-tools {
50
+ display: flex;
51
+ gap: 2px;
52
+ align-items: center;
53
+ justify-content: flex-end;
54
+ margin-top: 2px;
55
+ padding-top: 5px;
56
+ border-top: 1px solid var(--dpk-rule);
57
+ opacity: 0;
58
+ transition: opacity 150ms ease;
59
+ }
60
+
61
+ :host(:hover) .card-tools,
62
+ :host([focused]) .card-tools,
63
+ :host([data-mode='editing']) .card-tools,
64
+ :host([data-mode='commenting']) .card-tools {
65
+ opacity: 1;
66
+ }
67
+ `;class lt extends Ce{static{this.styles=[Pe,dt,J]}static{this.properties={story:{attribute:!1},notes:{attribute:!1},mode:{type:String,reflect:!0,attribute:"data-mode"},focused:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},onIntent:{attribute:!1}}}#e="";#n=new Z(this);constructor(){super(),this.story=null,this.notes=[],this.mode="view",this.focused=!1,this.dragging=!1,this.onIntent=null,this.addEventListener("click",()=>this.#t({kind:"select"}))}updated(t){if(t.has("mode")&&(this.mode!=="commenting"&&(this.#e=""),this.mode==="editing"&&this.renderRoot.querySelector("dpk-component-inline-edit")?.startEditing()),this.mode!=="commenting")return;const i=this.renderRoot.querySelector(".comment-pop"),n=this.renderRoot.querySelector('[data-role="comment"]');i&&n&&this.#n.open(i,n,at)}render(){const t=this.story;if(!t)return I;const i=this.mode==="editing",n=this.mode==="commenting";return c`
68
+ <div class="card-name">
69
+ ${i?c`<dpk-component-inline-edit
70
+ .value=${t.name}
71
+ .label=${"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D"}
72
+ @dpk-commit=${V(s=>this.#t({kind:"rename",name:s}))}
73
+ ></dpk-component-inline-edit>`:c`<span>${t.name}</span>`}
74
+ </div>
75
+ ${t.description?c`<div class="card-text">${t.description}</div>`:I}
76
+ <div class="card-tools">
77
+ <button
78
+ class="dpk-icon-btn"
79
+ type="button"
80
+ data-role="edit"
81
+ aria-label="タイトルを編集"
82
+ data-active=${String(i)}
83
+ @click=${this.#i({kind:"toggle-edit"})}
84
+ >
85
+ ${Ve()}
86
+ </button>
87
+ <button
88
+ class="dpk-icon-btn"
89
+ type="button"
90
+ data-role="comment"
91
+ aria-label="コメント"
92
+ data-active=${String(n)}
93
+ @click=${this.#i({kind:"toggle-comment"})}
94
+ >
95
+ ${Be()}
96
+ ${this.notes.length>0?c`<span class="dpk-icon-badge">${this.notes.length}</span>`:I}
97
+ </button>
98
+ <button
99
+ class="dpk-icon-btn"
100
+ type="button"
101
+ data-role="delete"
102
+ aria-label="削除"
103
+ @click=${this.#i({kind:"delete"})}
104
+ >
105
+ ${Ue()}
106
+ </button>
107
+ </div>
108
+ ${n?this.#s():I}
109
+ `}#s(){return Fe(Je(this.#e,this.notes.map(qe)),t=>{t.kind==="input"?(this.#e=t.body,this.requestUpdate()):this.#t(t)})}#i(t){return i=>{i.stopPropagation(),this.#t(t)}}#t(t){this.onIntent?.(t)}}const ct=()=>{customElements.get("dpk-internal-usm-story-card")||customElements.define("dpk-internal-usm-story-card",lt)},q=(e,t,i)=>{const n=e.at(-1)??null;if(t===null||i==="end")return n;const s=e.indexOf(t);return s<0?n:i==="after"?t:s===0?null:e.at(s-1)??null},me=(e,t,i,n,s)=>{const r=B(e,t.stepId,t.milestoneId).filter(o=>o.id!==i).map(o=>o.id);return{type:"MOVE_STORY",target:{type:"story",id:i},payload:{activityId:t.activityId,stepId:t.stepId,milestoneId:t.milestoneId??null,after:q(r,n,s)}}},ge=(e,t,i,n,s,r)=>{const o=b(e,n);if(!o||o.activityId!==t)return null;const a=te(e,t,i).filter(d=>d.id!==n).map(d=>d.id);return{type:"MOVE_STORY",target:{type:"story",id:n},payload:{activityId:t,stepId:o.stepId,milestoneId:i??null,after:q(a,s,r)}}},ve=(e,t,i,n,s)=>{const r=B(e,n,s).filter(o=>o.id!==t);return{type:"MOVE_STORY",target:{type:"story",id:t},payload:{activityId:i,stepId:n,milestoneId:s??null,after:r.at(-1)?.id??null}}},ye=(e,t,i,n)=>{if(!e.includes(t))return null;const s=e.filter(r=>r!==t);return{type:"REORDER_MILESTONE",target:{type:"milestone",id:t},payload:{after:q(s,i,n)}}},fe=e=>{const t=N("new-activity",x(e.state));if(!e.dispatch({type:"ADD_ACTIVITY",target:{type:"page",id:"usm"},payload:{id:t,name:"\u65B0\u3057\u3044\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3"}}).ok)return;const n=N("new-step",[...x(e.state),t]);e.dispatch({type:"ADD_STEP",target:{type:"activity",id:t},payload:{id:n,name:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7"}}),e.navigate({activity:t,step:null,story:null})},pt=(e,t)=>{const i=N("new-step",x(e.state));e.dispatch({type:"ADD_STEP",target:{type:"activity",id:t},payload:{id:i,name:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7"}})},ut=e=>{const t=N("new-milestone",x(e.state));e.dispatch({type:"ADD_MILESTONE",target:{type:"page",id:"usm"},payload:{id:t,name:"\u65B0\u3057\u3044\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3"}})},Ee=(e,t,i,n)=>{const s=N("new-story",x(e.state));e.dispatch({type:"ADD_STORY",target:{type:"step",id:i},payload:{id:s,name:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC",activityId:t,...n===void 0?{}:{milestoneId:n}}}).ok&&e.navigate({activity:t,step:i,story:s})},O={kind:"idle"},H=(e,t)=>e.kind!=="idle"&&e.storyId===t,he=(e,t)=>H(e,t)&&(e.kind==="editing"||e.kind==="commenting")?e.kind:"view",be=(e,t,i)=>{switch(i.kind){case"toggle-edit":return e.kind==="editing"&&e.storyId===t?O:{kind:"editing",storyId:t};case"toggle-comment":return e.kind==="commenting"&&e.storyId===t?O:{kind:"commenting",storyId:t};case"rename":case"comment":case"dismiss":case"delete":return H(e,t)?O:e;case"select":return e}},Te=e=>[...e.milestones.map(({id:t,name:i})=>({id:t,name:i})),{id:void 0,name:"\u672A\u5272\u5F53"}],mt=e=>c`
110
+ <div class="empty">
111
+ <h2>バックボーンがまだありません</h2>
112
+ <p>アクティビティとステップを追加すると、ここにストーリーマップが現れます。</p>
113
+ <button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>fe(e)}>
114
+ + 最初のアクティビティ
115
+ </button>
116
+ </div>
117
+ `,gt=e=>{const{context:t}=e,i=ee(t.state);if(i.length===0)return mt(t);const n=t.navigation.view==="group"?"group":"activity";return c`
118
+ <div class="view-tabs" role="tablist" aria-label="まとめる単位">
119
+ ${Se(t,"activity",n,"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3")}
120
+ ${Se(t,"group",n,"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u30B0\u30EB\u30FC\u30D7")}
121
+ </div>
122
+ ${n==="activity"?vt(e,i):yt(e)}
123
+ `},Se=(e,t,i,n)=>{const s=t===i;return c`<a
124
+ class="tab"
125
+ role="tab"
126
+ data-current=${String(s)}
127
+ aria-selected=${s?"true":"false"}
128
+ href=${e.hashFor({view:t})}
129
+ >${n}</a
130
+ >`},vt=(e,t)=>{const{context:i}=e,{state:n}=i,s=Te(n);return c`
131
+ <div class="map-scroll">
132
+ <div class="map" style=${`--cols:${t.length+1}`} data-testid="usm-map">
133
+ <div class="map-row">
134
+ <div class="corner">
135
+ <span class="dpk-label">アクティビティグループ →</span>
136
+ </div>
137
+ ${S(n.activities,r=>r.id,r=>Ie(i,r.id,`grid-column: span ${Math.max(r.steps.length,1)}`))}
138
+ ${$e(i)}
139
+ </div>
140
+ <div class="map-row">
141
+ ${ke()}
142
+ ${S(t,({activity:r,step:o})=>`${r.id}.${o.id}`,({step:r})=>c`
143
+ <div class="col-head" data-current=${String(i.navigation.step===r.id)}>
144
+ <h4>
145
+ <dpk-component-inline-edit
146
+ .value=${r.name}
147
+ .label=${"\u30B9\u30C6\u30C3\u30D7\u540D"}
148
+ @dpk-commit=${V(o=>i.dispatch({type:"SET_STEP_NAME",target:{type:"step",id:r.id},payload:{name:o}}))}
149
+ @click=${o=>o.stopPropagation()}
150
+ ></dpk-component-inline-edit>
151
+ </h4>
152
+ </div>
153
+ `)}
154
+ <div class="corner"><span class="dpk-label">—</span></div>
155
+ </div>
156
+ ${S(s,r=>r.id,r=>we(e,r,c`${S(t,({activity:o,step:a})=>`${o.id}.${a.id}`,({activity:o,step:a})=>ft(e,{activityId:o.id,stepId:a.id,milestoneId:r.id}))}`))}
157
+ ${_e(i,t.length)}
158
+ </div>
159
+ </div>
160
+ `},yt=e=>{const{context:t}=e,{state:i}=t,n=Te(i);return c`
161
+ <div class="map-scroll">
162
+ <div class="map" style=${`--cols:${i.activities.length+1}`} data-testid="usm-map-group">
163
+ <div class="map-row">
164
+ ${ke()}
165
+ ${S(i.activities,s=>s.id,s=>Ie(t,s.id))}
166
+ ${$e(t)}
167
+ </div>
168
+ ${S(n,s=>s.id,s=>we(e,s,c`${S(i.activities,r=>r.id,r=>Et(e,r.id,s.id))}`))}
169
+ ${_e(t,i.activities.length)}
170
+ </div>
171
+ </div>
172
+ `},ke=()=>c`<div class="corner">
173
+ <span class="dpk-label">アクティビティ →</span>
174
+ <span class="dpk-label">マイルストーン ↓</span>
175
+ </div>`,Ie=(e,t,i)=>{const n=e.state.activities.find(s=>s.id===t);return n?c`
176
+ <div class="act-head" style=${i??I}>
177
+ <dpk-component-inline-edit
178
+ .value=${n.name}
179
+ .label=${"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u540D"}
180
+ @dpk-commit=${V(s=>e.dispatch({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:n.id},payload:{name:s}}))}
181
+ ></dpk-component-inline-edit>
182
+ <button
183
+ class="dpk-icon-btn"
184
+ type="button"
185
+ aria-label="このアクティビティにステップを追加"
186
+ @click=${()=>pt(e,n.id)}
187
+ >
188
+ ${ze()}
189
+ </button>
190
+ </div>
191
+ `:c`<div class="act-head"></div>`},$e=e=>c`<div class="act-head">
192
+ <button class="dpk-btn dpk-btn--ghost" type="button" @click=${()=>fe(e)}>+ アクティビティ</button>
193
+ </div>`,_e=(e,t)=>c`<div class="map-row">
194
+ <div class="row-head">
195
+ <button class="dpk-btn dpk-btn--ghost" type="button" @click=${()=>ut(e)}>
196
+ + マイルストーン
197
+ </button>
198
+ </div>
199
+ ${Array.from({length:t+1},()=>c`<div class="cell"></div>`)}
200
+ </div>`,we=(e,t,i)=>{const{context:n,drag:s,handlers:r}=e,o=t.id;if(o===void 0)return c`<div class="map-row" data-draggable="false" data-row-dragging="false" data-row-drop="false">
201
+ <div class="row-head" data-milestone="" draggable="false"><span>${t.name}</span></div>
202
+ ${i}
203
+ <div class="cell"></div>
204
+ </div>`;const a=`row:${o}`,d=s.target({key:a,accepts:"milestone",hovered:bt,onDrop:E=>r.dropOnMilestoneRow(o,E)}),$=s.source({type:"milestone",id:o});return c`
205
+ <div
206
+ class="map-row"
207
+ data-draggable="true"
208
+ data-row-dragging=${String(s.isDragging("milestone",o))}
209
+ data-row-drop=${String(s.isOver(a))}
210
+ @dragenter=${d.dragenter}
211
+ @dragover=${d.dragover}
212
+ @dragleave=${d.dragleave}
213
+ @drop=${d.drop}
214
+ >
215
+ <div
216
+ class="row-head"
217
+ data-milestone=${o}
218
+ draggable="true"
219
+ @dragstart=${E=>{ht(E),$.dragstart(E)}}
220
+ @dragend=${$.dragend}
221
+ >
222
+ <span class="row-grip" aria-hidden="true">${Ge()}</span
223
+ ><dpk-component-inline-edit
224
+ draggable="false"
225
+ .value=${t.name}
226
+ .label=${"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u540D"}
227
+ @dpk-commit=${V(E=>n.dispatch({type:"SET_MILESTONE_NAME",target:{type:"milestone",id:o},payload:{name:E}}))}
228
+ ></dpk-component-inline-edit>
229
+ </div>
230
+ ${i}
231
+ <div class="cell"></div>
232
+ </div>
233
+ `},ft=(e,t)=>{const{context:i,drag:n,handlers:s}=e,r=B(i.state,t.stepId,t.milestoneId),o=`cell:${t.stepId}:${t.milestoneId??""}`,a=n.target({key:o,accepts:"story",hovered:Re,onDrop:d=>s.dropOnCell(t,d)});return c`
234
+ <div
235
+ class="cell"
236
+ data-step=${t.stepId}
237
+ data-milestone=${t.milestoneId??""}
238
+ data-drop=${String(n.isOver(o))}
239
+ @dragenter=${a.dragenter}
240
+ @dragover=${a.dragover}
241
+ @dragleave=${a.dragleave}
242
+ @drop=${a.drop}
243
+ >
244
+ <div class="card-list" data-testid=${`cell-${t.stepId}-${t.milestoneId??"unassigned"}`}>
245
+ ${S(r,d=>d.id,d=>Oe(e,d))}
246
+ </div>
247
+ <button
248
+ class="dpk-btn dpk-btn--ghost add-cell"
249
+ type="button"
250
+ title="このマスにストーリーを追加"
251
+ @click=${()=>Ee(i,t.activityId,t.stepId,t.milestoneId)}
252
+ >
253
+ + 追加
254
+ </button>
255
+ </div>
256
+ `},Et=(e,t,i)=>{const{context:n,drag:s,handlers:r}=e,{state:o}=n,a=te(o,t,i),d=o.activities.find(T=>T.id===t)?.steps[0],$=`group:${t}:${i??""}`,E=s.target({key:$,accepts:"story",hovered:Re,onDrop:T=>r.dropOnGroupCell(t,i,T)});return c`
257
+ <div
258
+ class="cell"
259
+ data-activity=${t}
260
+ data-milestone=${i??""}
261
+ data-drop=${String(s.isOver($))}
262
+ @dragenter=${E.dragenter}
263
+ @dragover=${E.dragover}
264
+ @dragleave=${E.dragleave}
265
+ @drop=${E.drop}
266
+ >
267
+ <div class="card-list" data-testid=${`group-cell-${t}-${i??"unassigned"}`}>
268
+ ${S(a,T=>T.id,T=>Oe(e,T))}
269
+ </div>
270
+ ${d?c`<button
271
+ class="dpk-btn dpk-btn--ghost add-cell"
272
+ type="button"
273
+ aria-label="このマスにストーリーを追加"
274
+ @click=${()=>Ee(n,t,d.id,i)}
275
+ >
276
+ + 追加
277
+ </button>`:I}
278
+ </div>
279
+ `},Oe=(e,t)=>{const{context:i,mode:n,drag:s,handlers:r}=e,o=i.comments.filter(d=>d.target.type==="story"&&d.target.id===t.id),a=s.source({type:"story",id:t.id});return c`<dpk-internal-usm-story-card
280
+ data-story=${t.id}
281
+ draggable="true"
282
+ .story=${t}
283
+ .notes=${o}
284
+ .mode=${he(n,t.id)}
285
+ .onIntent=${d=>r.cardIntent(t.id,d)}
286
+ ?focused=${i.navigation.story===t.id}
287
+ ?dragging=${s.isDragging("story",t.id)}
288
+ @dragstart=${a.dragstart}
289
+ @dragend=${a.dragend}
290
+ ></dpk-internal-usm-story-card>`},Re=e=>{const t=e.target instanceof Element?e.target.closest("dpk-internal-usm-story-card"):null;return t?{id:t.getAttribute("data-story"),element:t}:null},ht=e=>{const i=(e.currentTarget instanceof Element?e.currentTarget:null)?.closest(".map-row");if(!i||!e.dataTransfer)return;const n=i.getBoundingClientRect();e.dataTransfer.setDragImage(i,e.clientX-n.left,e.clientY-n.top)},bt=e=>{const t=e.target instanceof Element?e.target.closest(".map-row"):null,i=t?.querySelector(".row-head[data-milestone]");if(!t||!i)return null;const n=i.getAttribute("data-milestone");return{id:n===""?null:n,element:t}},Tt=(e,t,i)=>{if(t.kind!=="picking-step")return I;const n=b(e.state,t.storyId),s=w(e.state,t.activityId);if(!n||!s)return I;const r=s.steps[0]?.id;return c`<div class="comment-pop move-dialog" id="move-dialog" popover="manual">
291
+ <span class="dpk-label">移動先のアクティビティ</span>
292
+ <select class="dpk-select" aria-label="移動先" data-move-dialog>
293
+ ${s.steps.map(o=>c`<option value=${o.id} ?selected=${o.id===r}>${o.name}</option>`)}
294
+ </select>
295
+ <div class="pop-actions">
296
+ <button
297
+ class="dpk-btn dpk-btn--accent"
298
+ type="button"
299
+ @click=${o=>{const d=(je(o.currentTarget,HTMLElement)?.closest("#move-dialog")??null)?.querySelector("select")?.value??r;d?i.confirm(d):i.cancel()}}
300
+ >
301
+ 移動する
302
+ </button>
303
+ <button class="dpk-btn" type="button" @click=${i.cancel}>キャンセル</button>
304
+ </div>
305
+ </div>`},St=F`
306
+ :host {
307
+ --dpk-usm-accent: var(--dpk-blue);
308
+ }
309
+ .map-scroll {
310
+ /* A wide table must scroll inside itself and never widen the template shell. */
311
+ min-width: 0;
312
+ max-width: 100%;
313
+ overflow-x: auto;
314
+ padding-bottom: 12px;
315
+ }
316
+ .map {
317
+ display: grid;
318
+ gap: 0;
319
+ min-width: max-content;
320
+ border: 1px solid var(--dpk-rule);
321
+ border-radius: var(--dpk-radius-lg);
322
+ background: var(--dpk-paper-raised);
323
+ box-shadow: var(--dpk-shadow);
324
+ overflow: hidden;
325
+ }
326
+ .map-row {
327
+ display: grid;
328
+ grid-template-columns: 140px repeat(var(--cols), minmax(180px, 240px));
329
+ }
330
+ .map-row + .map-row {
331
+ border-top: 1px solid var(--dpk-rule-strong);
332
+ }
333
+ .corner,
334
+ .act-head,
335
+ .col-head,
336
+ .row-head,
337
+ .cell {
338
+ padding: 10px;
339
+ }
340
+ .corner {
341
+ background: linear-gradient(135deg, var(--dpk-paper-sunken), var(--dpk-paper-inset));
342
+ display: grid;
343
+ gap: 2px;
344
+ align-content: start;
345
+ }
346
+
347
+ /* Unit toggle above the table (group band vs one column per activity). */
348
+ .view-tabs {
349
+ display: inline-flex;
350
+ justify-self: start;
351
+ gap: 2px;
352
+ padding: 3px;
353
+ margin-bottom: 12px;
354
+ border: 1px solid var(--dpk-rule);
355
+ border-radius: 999px;
356
+ background: var(--dpk-paper-sunken);
357
+ box-shadow: inset 0 1px 2px rgba(20, 28, 44, 0.04);
358
+ }
359
+
360
+ .tab {
361
+ padding: 4px 14px;
362
+ border-radius: 999px;
363
+ font-size: 12px;
364
+ font-weight: 500;
365
+ text-decoration: none;
366
+ color: var(--dpk-ink-soft);
367
+ white-space: nowrap;
368
+ transition:
369
+ background 120ms ease,
370
+ color 120ms ease;
371
+ }
372
+
373
+ .tab:hover {
374
+ color: var(--dpk-ink);
375
+ background: var(--dpk-paper-raised);
376
+ }
377
+
378
+ .tab[data-current='true'] {
379
+ background: var(--dpk-paper-raised);
380
+ color: var(--dpk-ink);
381
+ font-weight: 600;
382
+ box-shadow: var(--dpk-shadow-xs);
383
+ }
384
+ .act-head {
385
+ border-left: 1px solid var(--dpk-rule);
386
+ background: linear-gradient(180deg, var(--dpk-paper-sunken), var(--dpk-paper-inset));
387
+ display: flex;
388
+ align-items: center;
389
+ justify-content: space-between;
390
+ gap: 4px;
391
+ font-size: 13px;
392
+ font-weight: 600;
393
+ }
394
+ .col-head {
395
+ border-left: 1px solid var(--dpk-rule);
396
+ background: var(--dpk-paper-sunken);
397
+ transition: background 150ms ease;
398
+ }
399
+ .col-head[data-current='true'] {
400
+ background: linear-gradient(180deg, rgba(51, 102, 204, 0.06), rgba(51, 102, 204, 0.03));
401
+ box-shadow: inset 0 2px 0 var(--dpk-blue);
402
+ }
403
+ .col-head h4 {
404
+ font-size: 13px;
405
+ margin: 0;
406
+ }
407
+ .row-head {
408
+ display: flex;
409
+ align-items: center;
410
+ gap: 6px;
411
+ background: var(--dpk-paper-sunken);
412
+ font-size: 12px;
413
+ font-weight: 600;
414
+ transition: background 150ms ease;
415
+ }
416
+
417
+ .row-head[draggable='true'] {
418
+ cursor: grab;
419
+ -webkit-user-select: none;
420
+ user-select: none;
421
+ }
422
+
423
+ .row-head[draggable='true'] dpk-component-inline-edit {
424
+ -webkit-user-drag: none;
425
+ }
426
+
427
+ .row-head[draggable='true']:active {
428
+ cursor: grabbing;
429
+ }
430
+
431
+ .row-grip {
432
+ flex: 0 0 auto;
433
+ display: inline-flex;
434
+ color: var(--dpk-ink-faint);
435
+ }
436
+
437
+ .row-grip svg {
438
+ display: block;
439
+ width: 15px;
440
+ height: 15px;
441
+ }
442
+
443
+ /* Row-level drag affordance: hover highlights the entire .map-row. */
444
+ .map-row[data-draggable='true']:hover > .row-head {
445
+ background: linear-gradient(90deg, var(--dpk-blue-soft), var(--dpk-paper-sunken));
446
+ }
447
+ .map-row[data-draggable='true']:hover > .cell {
448
+ background: linear-gradient(90deg, rgba(51, 102, 204, 0.03), var(--dpk-paper-raised));
449
+ }
450
+ .map-row[data-draggable='true']:hover .row-grip {
451
+ color: var(--dpk-blue);
452
+ }
453
+ .map-row[data-draggable='true'] {
454
+ cursor: grab;
455
+ }
456
+ .map-row[data-draggable='true']:active {
457
+ cursor: grabbing;
458
+ }
459
+
460
+ /*
461
+ * Dragging state: entire row fades. Never disable pointer events on the
462
+ * source here: Lit applies this state in the microtask right after
463
+ * \`dragstart\`, and Blink then re-hit-tests the pointer and aborts the drag
464
+ * when the source is no longer under it.
465
+ */
466
+ .map-row[data-row-dragging='true'] {
467
+ opacity: 0.45;
468
+ }
469
+
470
+ /* Drop target: entire row highlights. */
471
+ .map-row[data-row-drop='true'] {
472
+ outline: 2px dashed var(--dpk-blue);
473
+ outline-offset: -2px;
474
+ }
475
+ .map-row[data-row-drop='true'] > .row-head {
476
+ background: var(--dpk-blue-soft);
477
+ }
478
+ .map-row[data-row-drop='true'] > .cell {
479
+ background: linear-gradient(135deg, var(--dpk-blue-soft), rgba(51, 102, 204, 0.04));
480
+ }
481
+ .cell {
482
+ border-left: 1px solid var(--dpk-rule);
483
+ border-top: 1px solid var(--dpk-rule);
484
+ display: flex;
485
+ flex-direction: column;
486
+ gap: 8px;
487
+ min-height: 100px;
488
+ background: var(--dpk-paper-raised);
489
+ transition: background 150ms ease;
490
+ }
491
+ .cell[data-drop='true'] {
492
+ background: linear-gradient(135deg, var(--dpk-blue-soft), rgba(51, 102, 204, 0.04));
493
+ outline: 2px dashed var(--dpk-blue);
494
+ outline-offset: -2px;
495
+ }
496
+ .card-list {
497
+ display: grid;
498
+ gap: 8px;
499
+ align-content: start;
500
+ flex: 1 1 auto;
501
+ }
502
+ .add-cell {
503
+ margin-top: auto;
504
+ opacity: 0;
505
+ transition: opacity 180ms ease;
506
+ border: 1px dashed var(--dpk-rule-strong);
507
+ border-radius: var(--dpk-radius-sm);
508
+ background: transparent;
509
+ color: var(--dpk-ink-faint);
510
+ padding: 4px 8px;
511
+ font-size: 11.5px;
512
+ }
513
+ .add-cell:hover {
514
+ background: var(--dpk-blue-soft);
515
+ border-color: var(--dpk-blue);
516
+ color: var(--dpk-blue);
517
+ }
518
+ .cell:hover .add-cell {
519
+ opacity: 1;
520
+ }
521
+ .empty {
522
+ border: 1px dashed var(--dpk-rule-strong);
523
+ border-radius: var(--dpk-radius-lg);
524
+ padding: 28px 24px;
525
+ background: var(--dpk-paper-raised);
526
+ max-width: 620px;
527
+ display: grid;
528
+ gap: 10px;
529
+ }
530
+ .count {
531
+ font-family: var(--dpk-mono);
532
+ font-variant-numeric: tabular-nums;
533
+ font-size: 10px;
534
+ color: var(--dpk-ink-faint);
535
+ }
536
+
537
+ /* Step picker shown after a cross-activity drop. */
538
+ .move-dialog {
539
+ min-width: 220px;
540
+ }
541
+ `,kt={width:300,height:240};class De extends X{constructor(){super(),this.definition=ue,this.#e=new He(this),this.#n=new Z(this),this.mode=O}static{this.styles=[X.styles,St,J]}static{this.properties={mode:{state:!0}}}#e;#n;renderRegions(t){return{main:this.#s(t)}}updated(){if(super.updated(),this.mode.kind!=="picking-step")return;const t=this.renderRoot.querySelector("#move-dialog");t&&this.#n.open(t,Xe(this.mode.point.x,this.mode.point.y),kt)}#s(t){return c`
542
+ ${gt({context:t,mode:this.mode,drag:this.#e,handlers:{cardIntent:(i,n)=>this.#i(i,n),dropOnCell:(i,n)=>this.#t(i,n),dropOnGroupCell:(i,n,s)=>this.#r(i,n,s),dropOnMilestoneRow:(i,n)=>this.#o(i,n)}})}
543
+ ${Tt(t,this.mode,{confirm:i=>this.#a(i),cancel:()=>this.mode=O})}
544
+ `}#i(t,i){const n=this.context();switch(i.kind){case"select":{const s=b(n.state,t);s&&n.navigate({step:s.stepId,story:s.id});break}case"rename":n.dispatch({type:"SET_STORY_NAME",target:{type:"story",id:t},payload:{name:i.name}});break;case"comment":n.dispatch({type:"comment",target:`story:${t}`,payload:{body:i.body}});break;case"delete":n.dispatch({type:"DELETE_STORY",target:{type:"story",id:t},payload:{}});break}this.mode=be(this.mode,t,i)}#t(t,i){const n=this.context();n.dispatch(me(n.state,t,i.item.id,i.hoveredId,i.place))}#r(t,i,n){const s=this.context(),r=b(s.state,n.item.id);if(!r)return;if(r.activityId!==t){this.mode={kind:"picking-step",storyId:r.id,activityId:t,milestoneId:i,point:{x:n.event.clientX,y:n.event.clientY}};return}const o=ge(s.state,t,i,r.id,n.hoveredId,n.place);o&&s.dispatch(o)}#o(t,i){const n=this.context(),s=n.state.milestones.map(o=>o.id),r=ye(s,i.item.id,i.hoveredId,i.place);r&&n.dispatch(r)}#a(t){const i=this.mode;if(i.kind!=="picking-step")return;const n=this.context();n.dispatch(ve(n.state,i.storyId,i.activityId,t,i.milestoneId)),this.mode=O}}const xe=()=>{ct(),customElements.get("dpk-template-usm")||customElements.define("dpk-template-usm",De)},It=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateUsm:De,IDLE_MODE:O,allUsmIds:x,applyUsmAction:ie,cardModeOf:he,defineUsmElement:xe,describeUsmAction:oe,dropAfter:q,emptyUsmBase:W,findActivity:w,findMilestone:k,findStep:h,findStory:b,flatSteps:ee,modeConcerns:H,parseUsmBase:Q,reduceCardIntent:be,resolveCellDrop:me,resolveGroupDrop:ge,resolveMilestoneDrop:ye,resolvePickedStepMove:ve,resolveUsmNavigation:ce,serializeUsmAction:ae,storiesInCell:B,storyCountForStep:st,usmAction:Ze,usmActions:p,usmCommentTargets:le,usmDefinition:ue,usmHasTarget:pe,usmTargetLabel:de,usmTitle:K},Symbol.toStringTag,{value:"Module"}));export{xe as d,It as i};
@@ -0,0 +1,27 @@
1
+ import{a0 as lt,a1 as K}from"./shared-RRxRtPfs.js";const I=Math.min,S=Math.max,Q=Math.round,Z=Math.floor,$=t=>({x:t,y:t}),Wt={left:"right",right:"left",bottom:"top",top:"bottom"};function Nt(t,e,o){return S(t,I(e,o))}function U(t,e){return typeof t=="function"?t(e):t}function _(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function xt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}function k(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function vt(t){return xt(k(t))}function Vt(t,e,o){o===void 0&&(o=!1);const n=Y(t),i=vt(t),s=bt(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=tt(r)),[r,tt(r)]}function _t(t){const e=tt(t);return[at(t),e,at(e)]}function at(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Rt=["left","right"],Ct=["right","left"],Ht=["top","bottom"],Bt=["bottom","top"];function zt(t,e,o){switch(t){case"top":case"bottom":return o?e?Ct:Rt:e?Rt:Ct;case"left":case"right":return e?Ht:Bt;default:return[]}}function It(t,e,o,n){const i=Y(t);let s=zt(_(t),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(at)))),s}function tt(t){const e=_(t);return Wt[e]+t.slice(e.length)}function Xt(t){var e,o,n,i;return{top:(e=t.top)!=null?e:0,right:(o=t.right)!=null?o:0,bottom:(n=t.bottom)!=null?n:0,left:(i=t.left)!=null?i:0}}function jt(t){return typeof t!="number"?Xt(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function At(t,e,o){let{reference:n,floating:i}=t;const s=k(e),r=vt(e),c=bt(r),l=_(e),a=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,h=n[c]/2-i[c]/2;let d;switch(l){case"top":d={x:f,y:n.y-i.height};break;case"bottom":d={x:f,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:u};break;case"left":d={x:n.x-i.width,y:u};break;default:d={x:n.x,y:n.y}}const p=Y(e);return p&&(d[r]+=h*(p==="end"?1:-1)*(o&&a?-1:1)),d}async function qt(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:d=0}=U(e,t),p=jt(d),w=c[h?u==="floating"?"reference":"floating":u],m=et(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),y=u==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},C=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:x,strategy:l}):y);return{top:(m.top-C.top+p.top)/b.y,bottom:(C.bottom-m.bottom+p.bottom)/b.y,left:(m.left-C.left+p.left)/b.x,right:(C.right-m.right+p.right)/b.x}}const Kt=50,Ut=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,c=r.detectOverflow?r:{...r,detectOverflow:qt},l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=At(a,n,l),h=n,d=0;const p={};for(let g=0;g<s.length;g++){const w=s[g];if(!w)continue;const{name:m,fn:y}=w,{x,y:b,data:C,reset:v}=await y({x:f,y:u,initialPlacement:n,placement:h,strategy:i,middlewareData:p,rects:a,platform:c,elements:{reference:t,floating:e}});f=x??f,u=b??u,p[m]={...p[m],...C},v&&d<Kt&&(d++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(a=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:f,y:u}=At(a,h,l)),g=-1)}return{x:f,y:u,placement:h,strategy:i,middlewareData:p}},Yt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...w}=U(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const m=_(i),y=k(c),x=_(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=h||(x||!g?[tt(c)]:_t(c)),v=p!=="none";!h&&v&&C.push(...It(c,g,p,b));const P=[c,...C],T=await l.detectOverflow(e,w),W=[];let O=((n=s.flip)==null?void 0:n.overflows)||[];if(f&&W.push(T[m]),u){const N=Vt(i,r,b);W.push(T[N[0]],T[N[1]])}if(O=[...O,{placement:i,overflows:W}],!W.every(N=>N<=0)){var gt,wt;const N=(((gt=s.flip)==null?void 0:gt.index)||0)+1,ct=P[N];if(ct&&(!(u==="alignment"?y!==k(ct):!1)||O.every(A=>k(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:N,overflows:O},reset:{placement:ct}};let q=(wt=O.filter(V=>V.overflows[0]<=0).sort((V,A)=>V.overflows[1]-A.overflows[1])[0])==null?void 0:wt.placement;if(!q)switch(d){case"bestFit":{var yt;const V=(yt=O.filter(A=>{if(v){const M=k(A.placement);return M===y||M==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(M=>M>0).reduce((M,Ft)=>M+Ft,0)]).sort((A,M)=>A[1]-M[1])[0])==null?void 0:yt[0];V&&(q=V);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}},Gt=new Set(["left","top"]);async function Jt(t,e){const{placement:o,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=_(o),c=Y(o),l=k(o)==="y",a=Gt.has(r)?-1:1,f=s&&l?-1:1,u=U(e,t);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),l?{x:d*f,y:h*a}:{x:h*a,y:d*f}}const Qt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:s,placement:r,middlewareData:c}=e,l=await Jt(e,t);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},Zt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...a}=U(t,e),f={x:o,y:n},u=await s.detectOverflow(e,a),h=k(i),d=xt(h);let p=f[d],g=f[h];const w=(y,x)=>Nt(x+u[y==="y"?"top":"left"],x,x-u[y==="y"?"bottom":"right"]);r&&(p=w(d,p)),c&&(g=w(h,g));const m=l.fn({...e,[d]:p,[h]:g});return{...m,data:{x:m.x-o,y:m.y-n,enabled:{[d]:r,[h]:c}}}}}},te=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:o,rects:n,platform:i,elements:s}=e,{apply:r=()=>{},...c}=U(t,e),l=await i.detectOverflow(e,c),a=_(o),f=Y(o),u=k(o)==="y",{width:h,height:d}=n.floating;let p,g;a==="top"||a==="bottom"?(p=a,g=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=a,p=f==="end"?"top":"bottom");const w=d-l.top-l.bottom,m=h-l.left-l.right,y=I(d-l[p],w),x=I(h-l[g],m),b=e.middlewareData.shift,C=!b;let v=y,P=x;b!=null&&b.enabled.x&&(P=m),b!=null&&b.enabled.y&&(v=w),C&&!f&&(u?P=h-2*S(l.left,l.right):v=d-2*S(l.top,l.bottom)),await r({...e,availableWidth:P,availableHeight:v});const T=await i.getDimensions(s.floating);return h!==T.width||d!==T.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function X(t){return Ot(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function D(t){var e;return(e=(Ot(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ot(t){return nt()?t instanceof Node||t instanceof R(t).Node:!1}function L(t){return nt()?t instanceof Element||t instanceof R(t).Element:!1}function F(t){return nt()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function Lt(t){return!nt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=E(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&i!=="inline"&&i!=="contents"}function ee(t){return/^(table|td|th)$/.test(X(t))}function it(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const ne=/transform|translate|scale|rotate|perspective|filter/,oe=/paint|layout|strict|content/,H=t=>!!t&&t!=="none";let ft;function ut(t){const e=L(t)?E(t):t;return H(e.transform)||H(e.translate)||H(e.scale)||H(e.rotate)||H(e.perspective)||!dt()&&(H(e.backdropFilter)||H(e.filter))||ne.test(e.willChange||"")||oe.test(e.contain||"")}function ie(t){let e=B(t);for(;F(e)&&!G(e);){if(ut(e))return e;if(it(e))return null;e=B(e)}return null}function dt(){return ft==null&&(ft=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ft}function G(t){return/^(html|body|#document)$/.test(X(t))}function E(t){return R(t).getComputedStyle(t)}function st(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(X(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lt(t)&&t.host||D(t);return Lt(e)?e.host:e}function Et(t){const e=B(t);return G(e)?(t.ownerDocument||t).body:F(e)&&ot(e)?e:Et(e)}function J(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const i=Et(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),r=R(i);if(s){const c=ht(r);return e.concat(r,r.visualViewport||[],ot(i)?i:[],c&&o?J(c):[])}else return e.concat(i,J(i,[],o))}function ht(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Tt(t){const e=E(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=F(t),s=i?t.offsetWidth:o,r=i?t.offsetHeight:n,c=Q(o)!==s||Q(n)!==r;return c&&(o=s,n=r),{width:o,height:n,$:c}}function pt(t){return L(t)?t:t.contextElement}function j(t){const e=pt(t);if(!F(e))return $(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:s}=Tt(e);let r=(s?Q(o.width):o.width)/n,c=(s?Q(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const se=$(0);function St(t){const e=R(t);return!dt()||!e.visualViewport?se:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function re(t,e,o){return e===void 0&&(e=!1),!!o&&e&&o===R(t)}function z(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),s=pt(t);let r=$(1);e&&(n?L(n)&&(r=j(n)):r=j(t));const c=re(s,o,n)?St(s):$(0);let l=(i.left+c.x)/r.x,a=(i.top+c.y)/r.y,f=i.width/r.x,u=i.height/r.y;if(s&&n){const h=R(s),d=L(n)?R(n):n;let p=h,g=ht(p);for(;g&&d!==p;){const w=j(g),m=g.getBoundingClientRect(),y=E(g),x=m.left+(g.clientLeft+parseFloat(y.paddingLeft))*w.x,b=m.top+(g.clientTop+parseFloat(y.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,u*=w.y,l+=x,a+=b,p=R(g),g=ht(p)}}return et({width:f,height:u,x:l,y:a})}function rt(t,e){const o=st(t).scrollLeft;return e?e.left+o:z(D(t)).left+o}function $t(t,e){const o=t.getBoundingClientRect(),n=o.left+e.scrollLeft-rt(t,o),i=o.top+e.scrollTop;return{x:n,y:i}}function ce(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const s=i==="fixed",r=D(n),c=e?it(e.floating):!1;if(n===r||c&&s)return o;let l={scrollLeft:0,scrollTop:0},a=$(1);const f=$(0),u=F(n);if((u||!s)&&((X(n)!=="body"||ot(r))&&(l=st(n)),u)){const d=z(n);a=j(n),f.x=d.x+n.clientLeft,f.y=d.y+n.clientTop}const h=r&&!u&&!s?$t(r,l):$(0);return{width:o.width*a.x,height:o.height*a.y,x:o.x*a.x-l.scrollLeft*a.x+f.x+h.x,y:o.y*a.y-l.scrollTop*a.y+f.y+h.y}}function le(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function ae(t){const e=st(t),o=t.ownerDocument.body,n=S(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=S(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-e.scrollLeft+rt(t);const r=-e.scrollTop;return E(o).direction==="rtl"&&(s+=S(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:s,y:r}}const fe=25;function ue(t,e,o){o===void 0&&(o="viewport");const n=o==="layoutViewport",i=R(t),s=D(t),r=i.visualViewport;let c=s.clientWidth,l=s.clientHeight,a=0,f=0;if(r){const h=!dt()||e==="fixed";n?h||(a=-r.offsetLeft,f=-r.offsetTop):(c=r.width,l=r.height,h&&(a=r.offsetLeft,f=r.offsetTop))}if(rt(s)<=0){const h=s.ownerDocument,d=h.body,p=getComputedStyle(d),g=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,w=Math.abs(s.clientWidth-d.clientWidth-g),m=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;m<=fe&&(c-=m)}return{width:c,height:l,x:a,y:f}}function de(t,e){const o=z(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,s=j(t),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,a=n*s.y;return{width:r,height:c,x:l,y:a}}function kt(t,e,o){let n;if(e==="viewport"||e==="layoutViewport")n=ue(t,o,e);else if(e==="document")n=ae(D(t));else if(L(e))n=de(e,o);else{const i=St(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return et(n)}function he(t,e){const o=e.get(t);if(o)return o;let n=J(t,[],!1).filter(c=>L(c)&&X(c)!=="body"),i=null;const s=E(t).position==="fixed";let r=s?B(t):t;for(;L(r)&&!G(r);){const c=E(r),l=ut(r),a=i?i.position:s?"fixed":"";!l&&(a==="fixed"||a==="absolute"&&c.position==="static")?n=n.filter(u=>u!==r):i=c,r=B(r)}return e.set(t,n),n}function pe(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const r=[...o==="clippingAncestors"?it(e)?[]:he(e,this._c):[].concat(o),n],c=kt(e,r[0],i);let l=c.top,a=c.right,f=c.bottom,u=c.left;for(let h=1;h<r.length;h++){const d=kt(e,r[h],i);l=S(d.top,l),a=I(d.right,a),f=I(d.bottom,f),u=S(d.left,u)}return{width:a-u,height:f-l,x:u,y:l}}function me(t){const{width:e,height:o}=Tt(t);return{width:e,height:o}}function ge(t,e,o){const n=F(e),i=D(e),s=o==="fixed",r=z(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=$(0);if((n||!s)&&((X(e)!=="body"||ot(i))&&(c=st(e)),n)){const h=z(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}!n&&i&&(l.x=rt(i));const a=i&&!n&&!s?$t(i,c):$(0),f=r.left+c.scrollLeft-l.x-a.x,u=r.top+c.scrollTop-l.y-a.y;return{x:f,y:u,width:r.width,height:r.height}}function mt(t){return E(t).position==="static"}function Dt(t,e){if(!F(t)||E(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return D(t)===o&&(o=o.ownerDocument.body),o}function Pt(t,e){const o=R(t);if(it(t))return o;if(!F(t)){let i=B(t);for(;i&&!G(i);){if(L(i)&&!mt(i))return i;i=B(i)}return o}let n=Dt(t,e);for(;n&&ee(n)&&mt(n);)n=Dt(n,e);return n&&G(n)&&mt(n)&&!ut(n)?o:n||ie(t)||o}const we=async function(t){const e=this.getOffsetParent||Pt,o=this.getDimensions,n=await o(t.floating);return{reference:ge(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ye(t){return E(t).direction==="rtl"}const xe={convertOffsetParentRelativeRectToViewportRelativeRect:ce,getDocumentElement:D,getClippingRect:pe,getOffsetParent:Pt,getElementRects:we,getClientRects:le,getDimensions:me,getScale:j,isElement:L,isRTL:ye};function Mt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function be(t,e,o){let n=null,i;const s=D(t);function r(){var f;clearTimeout(i),(f=n)==null||f.disconnect(),n=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),r();const h=t.getBoundingClientRect(),{left:d,top:p,width:g,height:w}=h;if(f||e(),!g||!w)return;const m=Z(p),y=Z(s.clientWidth-(d+g)),x=Z(s.clientHeight-(p+w)),b=Z(d),v={rootMargin:-m+"px "+-y+"px "+-x+"px "+-b+"px",threshold:S(0,I(1,u))||1};let P=!0;function T(W){const O=W[0].intersectionRatio;if(!Mt(h,t.getBoundingClientRect()))return c();if(O!==u){if(!P)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}P=!1}try{n=new IntersectionObserver(T,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(T,v)}n.observe(t)}const l=R(t),a=()=>c(o);return l.addEventListener("resize",a),c(!0),()=>{l.removeEventListener("resize",a),r()}}function ve(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,a=pt(t),f=i||s?[...a?J(a):[],...e?J(e):[]]:[];f.forEach(m=>{i&&m.addEventListener("scroll",o),s&&m.addEventListener("resize",o)});const u=a&&c?be(a,o,s):null;let h=-1,d=null;r&&(d=new ResizeObserver(m=>{let[y]=m;y&&y.target===a&&d&&e&&(d.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),o()}),a&&!l&&d.observe(a),e&&d.observe(e));let p,g=l?z(t):null;l&&w();function w(){const m=z(t);g&&!Mt(g,m)&&o(),g=m,p=requestAnimationFrame(w)}return o(),()=>{var m;f.forEach(y=>{i&&y.removeEventListener("scroll",o),s&&y.removeEventListener("resize",o)}),u?.(),(m=d)==null||m.disconnect(),d=null,l&&cancelAnimationFrame(p)}}const Re=Qt,Ce=Zt,Ae=Yt,Oe=te,Le=(t,e,o)=>{const n=new Map,i=o??{},s={...xe,...i.platform,_c:n};return Ut(t,e,{...i,platform:s})},Ee=(t,e)=>({top:e,bottom:e,right:t}),Te=(t,e,o,n={})=>{if(typeof t.showPopover!="function")return()=>{};try{t.showPopover()}catch{return()=>{}}let i=!0,s=0;const r=e instanceof Element?e:{getBoundingClientRect:()=>({x:e.right,y:e.top,left:e.right,right:e.right,top:e.top,bottom:e.bottom,width:0,height:e.bottom-e.top})};t.style.width=`${o.width}px`,t.style.maxHeight=`${o.height}px`;const l=ve(r,t,()=>{const a=++s;Le(r,t,{strategy:"fixed",placement:n.placement??"bottom-end",middleware:[Re(8),Ae({padding:8,fallbackAxisSideDirection:"end"}),Ce({padding:8}),Oe({padding:8,apply:({availableWidth:f,availableHeight:u})=>{!i||a!==s||(t.style.width=`${Math.max(0,Math.min(o.width,f))}px`,t.style.maxHeight=`${Math.max(0,Math.min(o.height,u))}px`)}})]}).then(({x:f,y:u})=>{!i||a!==s||!t.isConnected||(t.style.left=`${f}px`,t.style.top=`${u}px`)}).catch(()=>{})},{animationFrame:n.trackTransform??!1,elementResize:typeof ResizeObserver<"u",layoutShift:typeof IntersectionObserver<"u"});return()=>{i=!1,l()}};class Se{#e;#t=new Map;constructor(e){this.#e=e,e.addController(this)}hostConnected(){this.#e.requestUpdate()}hostUpdated(){for(const[e,o]of this.#t)e.isConnected||(o(),this.#t.delete(e))}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}open(e,o,n,i){this.#t.get(e)?.(),this.#t.set(e,Te(e,o,n,i))}}const $e=(t,e,o={})=>({body:t,notes:e,submission:t.trim()||null,label:o.label??null,error:o.error??null}),ke=(t,e)=>{const o=()=>{t.submission!==null&&e({kind:"comment",body:t.submission})};return K`<div
2
+ class="comment-pop"
3
+ popover="manual"
4
+ role="dialog"
5
+ aria-label=${t.label?`${t.label}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`:"\u30B3\u30E1\u30F3\u30C8"}
6
+ @click=${n=>n.stopPropagation()}
7
+ @keydown=${n=>{n.isComposing||n.key!=="Escape"||(n.preventDefault(),n.stopPropagation(),e({kind:"dismiss"}))}}
8
+ >
9
+ ${t.label?K`<strong class="comment-target">${t.label}</strong>`:lt}
10
+ ${t.error?K`<p class="comment-error" role="alert">${t.error}</p>`:lt}
11
+ ${t.notes.length?K`<ul class="comment-list">
12
+ ${t.notes.map(n=>K`<li>${n}</li>`)}
13
+ </ul>`:lt}
14
+ <textarea
15
+ class="dpk-textarea"
16
+ aria-label="コメント"
17
+ .value=${t.body}
18
+ @input=${n=>{n.currentTarget instanceof HTMLTextAreaElement&&e({kind:"input",body:n.currentTarget.value})}}
19
+ @keydown=${n=>{n.isComposing||n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),o())}}
20
+ ></textarea>
21
+ <div class="pop-actions">
22
+ <button class="dpk-btn dpk-btn--accent" type="button" ?disabled=${t.submission===null} @click=${o}>
23
+ 送信
24
+ </button>
25
+ <button class="dpk-btn" type="button" @click=${()=>e({kind:"dismiss"})}>キャンセル</button>
26
+ </div>
27
+ </div>`};export{Se as P,Ee as a,$e as p,ke as r};
@@ -0,0 +1 @@
1
+ import{a7 as S,a8 as s,a9 as l,aa as v,ab as o,as as _,ad as w,ae as B,V as E,T as $}from"./shared-RRxRtPfs.js";const x=s({id:_,title:w(o(),B(1))}),r=s({title:l(o(),""),sections:l(v(x),[])}),c=e=>{const t=S(r,e),a=new Set;for(const i of t.sections){if(a.has(i.id))throw new Error(`duplicate section id: ${i.id}`);a.add(i.id)}return{title:t.title,sections:t.sections}},p=()=>({title:"",sections:[]}),n=(e,t)=>e.sections.find(a=>a.id===t),d=e=>e.title===""?"Plain":e.title,m=(e,t)=>{switch(t.type){case"section":return n(e,t.id)?.title??t.id;case"page":return"\u30DA\u30FC\u30B8\u5168\u4F53";default:return t.id}},u=(e,t)=>({title:e.type,targetLabel:m(t,e.target),tone:"meta"}),f=e=>`${e.type} ${E(e.target)} ${JSON.stringify(e.payload)}`,g=e=>e.sections.map(t=>({value:`section:${t.id}`,label:t.title,group:"\u30BB\u30AF\u30B7\u30E7\u30F3"})),y=(e,t)=>t,b=(e,t)=>{switch(t.type){case"section":return n(e,t.id)!==void 0;case"page":return!0;default:return!1}},h={name:"plain",label:"Plain",parseBase:c,emptyBase:p,actions:{},apply:()=>null,hasTarget:b,describe:u,serialize:f,resolveNavigation:y,commentTargets:e=>g(e),title:d};class P extends ${constructor(){super(...arguments),this.definition=h}renderRegions(t){return{}}}const T=()=>{customElements.get("dpk-template-plain")||customElements.define("dpk-template-plain",P)},O=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePlain:P,definePlainElement:T,describePlainAction:u,emptyPlainBase:p,findSection:n,parsePlainBase:c,plainBaseSchema:r,plainCommentTargets:g,plainDefinition:h,plainHasTarget:b,plainTargetLabel:m,plainTitle:d,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{T as d,O as i};