dev-process-kit 0.0.7 → 0.0.8

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.
@@ -1,4 +1,4 @@
1
- import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,ac as $,a9 as ke,R as z,_ as ve,V as xe,a2 as s,a3 as F,a1 as d,au as O,a0 as me,T as P,aD as we,aE as ye}from"./shared-Bfq73Ivq.js";import{c as N}from"./shared-ml5h7U5L.js";const $e=(t,e,r)=>r.top<e.top?t+r.top-e.top:r.bottom<=e.bottom?t:t+Math.min(r.bottom-e.bottom,r.top-e.top),Te=(t,e)=>{const i=t.getBoundingClientRect().top+t.clientTop;t.scrollTop=$e(t.scrollTop,{top:i,bottom:i+t.clientHeight},e.getBoundingClientRect())},Se=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()}),g({kind:v("clear")})]),T={ANSWER_QUESTION:be("ANSWER_QUESTION","question",Se)},G=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Re=g({id:h(p(),b(1)),label:h(p(),b(1))}),B=g({id:h(p(),b(1)),ref:u(h(p(),b(1))),title:h(p(),b(1)),description:u(p()),note:u(p()),options:u($(Re),[]),freeText:u(fe(),!0)}),Ce=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()})]),Ae=g({...B.entries,answer:u(Ce)}),qe=g({label:u(h(p(),b(1))),questions:$(Ae)}),_=g({title:u(p(),""),questions:$(B),history:u($(qe),[])}),M=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},U=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Ee=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...U(t),answer:e}},H=t=>{const e=ke(_,t);return{title:e.title,questions:M(e.questions).map(U),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:M(r.questions).map(Ee)}))}},W=()=>({title:"",questions:[],answers:{},pastRounds:[]}),f=(t,e)=>t.questions.find(r=>r.id===e),Qe=(t,e)=>f(t,e)?.ref??e,q=(t,e)=>{const r=f(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},x=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",S=(t,e)=>x(t,e)!=="",D=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},j=t=>({total:t.questions.length,answered:t.questions.filter(e=>S(e,t.answers[e.id])).length}),R=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},Y=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=f(t,e.target.id);if(!r)return null;const i=z(T.ANSWER_QUESTION,e);return i.kind==="clear"?R(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?R(t,r.id,{kind:"option",optionId:i.optionId}):null:R(t,r.id,{kind:"free",text:i.text})},m=ve({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),V=t=>t.title===""?"Visually Grill":t.title,K=(t,e,r)=>{switch(r.type){case"question":return q(e,r.id);case"page":return t.wholePage;default:return r.id}},Ie=(t,e,r)=>{const i=z(T.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=f(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},J=(t,e,r,i)=>{let n;try{n=Ie(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:K(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},X=t=>`${t.type} ${xe(t.target)} ${JSON.stringify(t.payload)}`,Z=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:q(e,r.id),group:t.questionGroup})),ee=(t,e)=>{const r=e.question;if(r!==void 0&&f(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},te=(t,e)=>{const r=e.question;return r!==void 0&&f(t,r)?r:t.questions[0]?.id??null},Le=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!S(a,t.answers[a.id]))?.id??null},re=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:D(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),ze=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:x(t,i)!=="",summary:x(t,i),choices:re(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},ie=(t,e)=>{const r=te(t,e);return{questions:t.questions.map(i=>ze(i,t,r))}},ne=(t,e)=>{const r=j(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},ae=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=ae(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Oe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=x(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:re(n,a),freeText:a?.kind==="free"?a.text:null}})}},oe=(t,e)=>{switch(e.type){case"question":return f(t,e.id)!==void 0;case"page":return!0;default:return!1}},se=t=>{const e=m(t);return{name:"grill",label:"Visually Grill",parseBase:H,emptyBase:W,actions:T,apply:Y,hasTarget:oe,describe:(r,i,n)=>J(e,r,i,n),serialize:X,resolveNavigation:ee,commentTargets:r=>Z(e,r),title:V}},w="data-grill-questions",Pe=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},le=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of Pe(t))for(const l of o.querySelectorAll(`[${w}]`)){const k=l.getAttribute(w)??"";for(const C of k.split(/\s+/)){if(C==="")continue;const c=n.get(C);c&&a.push({index:a.length,target:l,questionId:c.id,ref:c.ref,title:c.title,answered:S(c,e.answers[c.id]),open:c.id===i})}}return a},de=(t,e)=>{const r=t.getBoundingClientRect(),i=new Map;e.forEach((a,o)=>{const l=t.querySelector(`[data-label="${o}"]`);if(!l)return;const k=i.get(a.target)??[];k.push(l),i.set(a.target,k)});const n=new Map;for(const[a,o]of i){const l=a.getBoundingClientRect(),k=l.width>0||l.height>0,c=n.get(a)??Ne(a,t);n.set(a,c);const E=l.bottom>r.top&&l.top<r.bottom&&l.right>r.left&&l.left<r.right,Q=l.bottom>c.top&&l.top<c.bottom;o.forEach((y,ge)=>{if(y.dataset.visible=String(k&&E&&Q),!k||!E||!Q)return;const A=y.offsetWidth,I=y.offsetHeight,ue=l.right-r.left-A+8-(o.length-1-ge)*(A+5),he=l.top-r.top-I/2;y.style.transform=`translate(${N(ue,0,Math.max(0,t.clientWidth-A))}px, ${N(he,0,Math.max(0,t.clientHeight-I))}px)`})}},Ne=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},Ge=(t,e,r)=>s`
1
+ import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,ac as $,a9 as ke,R as z,_ as ve,V as xe,a2 as s,a3 as F,a1 as d,au as O,a0 as me,T as P,aD as we,aE as ye}from"./shared-BYZoeQ97.js";import{c as N}from"./shared-ml5h7U5L.js";const $e=(t,e,r)=>r.top<e.top?t+r.top-e.top:r.bottom<=e.bottom?t:t+Math.min(r.bottom-e.bottom,r.top-e.top),Te=(t,e)=>{const i=t.getBoundingClientRect().top+t.clientTop;t.scrollTop=$e(t.scrollTop,{top:i,bottom:i+t.clientHeight},e.getBoundingClientRect())},Se=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()}),g({kind:v("clear")})]),T={ANSWER_QUESTION:be("ANSWER_QUESTION","question",Se)},G=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Re=g({id:h(p(),b(1)),label:h(p(),b(1))}),B=g({id:h(p(),b(1)),ref:u(h(p(),b(1))),title:h(p(),b(1)),description:u(p()),note:u(p()),options:u($(Re),[]),freeText:u(fe(),!0)}),Ce=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()})]),Ae=g({...B.entries,answer:u(Ce)}),qe=g({label:u(h(p(),b(1))),questions:$(Ae)}),_=g({title:u(p(),""),questions:$(B),history:u($(qe),[])}),M=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},U=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Ee=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...U(t),answer:e}},H=t=>{const e=ke(_,t);return{title:e.title,questions:M(e.questions).map(U),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:M(r.questions).map(Ee)}))}},W=()=>({title:"",questions:[],answers:{},pastRounds:[]}),f=(t,e)=>t.questions.find(r=>r.id===e),Qe=(t,e)=>f(t,e)?.ref??e,q=(t,e)=>{const r=f(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},x=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",S=(t,e)=>x(t,e)!=="",D=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},j=t=>({total:t.questions.length,answered:t.questions.filter(e=>S(e,t.answers[e.id])).length}),R=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},Y=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=f(t,e.target.id);if(!r)return null;const i=z(T.ANSWER_QUESTION,e);return i.kind==="clear"?R(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?R(t,r.id,{kind:"option",optionId:i.optionId}):null:R(t,r.id,{kind:"free",text:i.text})},m=ve({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),V=t=>t.title===""?"Visually Grill":t.title,K=(t,e,r)=>{switch(r.type){case"question":return q(e,r.id);case"page":return t.wholePage;default:return r.id}},Ie=(t,e,r)=>{const i=z(T.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=f(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},J=(t,e,r,i)=>{let n;try{n=Ie(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:K(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},X=t=>`${t.type} ${xe(t.target)} ${JSON.stringify(t.payload)}`,Z=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:q(e,r.id),group:t.questionGroup})),ee=(t,e)=>{const r=e.question;if(r!==void 0&&f(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},te=(t,e)=>{const r=e.question;return r!==void 0&&f(t,r)?r:t.questions[0]?.id??null},Le=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!S(a,t.answers[a.id]))?.id??null},re=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:D(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),ze=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:x(t,i)!=="",summary:x(t,i),choices:re(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},ie=(t,e)=>{const r=te(t,e);return{questions:t.questions.map(i=>ze(i,t,r))}},ne=(t,e)=>{const r=j(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},ae=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=ae(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Oe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=x(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:re(n,a),freeText:a?.kind==="free"?a.text:null}})}},oe=(t,e)=>{switch(e.type){case"question":return f(t,e.id)!==void 0;case"page":return!0;default:return!1}},se=t=>{const e=m(t);return{name:"grill",label:"Visually Grill",parseBase:H,emptyBase:W,actions:T,apply:Y,hasTarget:oe,describe:(r,i,n)=>J(e,r,i,n),serialize:X,resolveNavigation:ee,commentTargets:r=>Z(e,r),title:V}},w="data-grill-questions",Pe=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},le=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of Pe(t))for(const l of o.querySelectorAll(`[${w}]`)){const k=l.getAttribute(w)??"";for(const C of k.split(/\s+/)){if(C==="")continue;const c=n.get(C);c&&a.push({index:a.length,target:l,questionId:c.id,ref:c.ref,title:c.title,answered:S(c,e.answers[c.id]),open:c.id===i})}}return a},de=(t,e)=>{const r=t.getBoundingClientRect(),i=new Map;e.forEach((a,o)=>{const l=t.querySelector(`[data-label="${o}"]`);if(!l)return;const k=i.get(a.target)??[];k.push(l),i.set(a.target,k)});const n=new Map;for(const[a,o]of i){const l=a.getBoundingClientRect(),k=l.width>0||l.height>0,c=n.get(a)??Ne(a,t);n.set(a,c);const E=l.bottom>r.top&&l.top<r.bottom&&l.right>r.left&&l.left<r.right,Q=l.bottom>c.top&&l.top<c.bottom;o.forEach((y,ge)=>{if(y.dataset.visible=String(k&&E&&Q),!k||!E||!Q)return;const A=y.offsetWidth,I=y.offsetHeight,ue=l.right-r.left-A+8-(o.length-1-ge)*(A+5),he=l.top-r.top-I/2;y.style.transform=`translate(${N(ue,0,Math.max(0,t.clientWidth-A))}px, ${N(he,0,Math.max(0,t.clientHeight-I))}px)`})}},Ne=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},Ge=(t,e,r)=>s`
2
2
  <div class="grill-list">
3
3
  ${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:F(e.questions,i=>i.id,i=>Be(t,i,r))}
4
4
  </div>
@@ -515,7 +515,7 @@ ${t}
515
515
  ${dr(c).replace(/\n/g,`
516
516
  `)}
517
517
  \`\`\``)}l.push("")}if(a.length===0&&d.length===0&&(l.push("_No pending draft actions._"),l.push("")),t.stale.length>0){l.push(`## Not applicable to the current base (${t.stale.length})`),l.push(""),l.push("These actions were made against an earlier base and no longer fit it. Do not apply them; mention them if they still matter. The reader can remove them from the review rail."),l.push("");for(const[p,{action:c,reason:h}]of t.stale.entries()){const u=e.describe(c,r,t.base),b=c.type===E?$e(c):u.title;l.push(`${p+1}. \`${c.type}\` on \`${_(c.target)}\` (${h}) \u2014 ${b}`)}l.push("")}return l.push("## Canonical draft (JSON)"),l.push(""),l.push(ar(Ke(n))),l.push(""),l.join(`
518
- `)},Z="0.0.7",Xe=async t=>{try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}const e=document.activeElement,s=document.createElement("textarea");try{return s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.append(s),s.select(),document.execCommand("copy")}catch{return!1}finally{s.remove(),e instanceof HTMLElement&&e.focus()}},os=ge({en:{heading:"Review notes",rejected:"Action rejected.",commentLabel:"Review comment",commentPlaceholder:"What should change, or what you noticed (passed to the agent as an instruction)",detach:"Detach",attachTo:t=>`Attach to this ${t}`,addNote:"Add note",empty:"No draft actions yet.",emptyHint:"Comments and structural patches both land here, and survive reload via LocalStorage.",sendToClaude:"Send to Claude",copy:"Copy changes & comments",copyTitle:"Copy the review to paste it to the agent",clear:"Clear",deleteAction:"Delete this draft action",wholePage:"Whole page",comment:"Comment",sent:"Sent to Claude \u2713",copied:"Copied \u2713",copyFailed:"Could not copy"},ja:{heading:"\u30EC\u30D3\u30E5\u30FC\u30CE\u30FC\u30C8",rejected:"action \u3092\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",commentLabel:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u5909\u66F4\u3057\u305F\u3044\u3053\u3068 / \u6C17\u3065\u304D\u3092\u66F8\u304F\uFF08Agent \u3078\u306E\u6307\u793A\u3068\u3057\u3066\u6E21\u308B\uFF09",detach:"\u7D10\u3065\u3051\u3092\u89E3\u9664",attachTo:t=>`\u3053\u306E ${t} \u306B\u7D10\u3065\u3051\u308B`,addNote:"\u30CE\u30FC\u30C8\u3092\u8FFD\u52A0",empty:"draft action \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",emptyHint:"\u30B3\u30E1\u30F3\u30C8\u3082\u69CB\u9020\u306E\u5909\u66F4\u3082\u3053\u3053\u306B\u96C6\u307E\u308A\u3001LocalStorage \u306B\u6B8B\u308B\u306E\u3067\u30EA\u30ED\u30FC\u30C9\u3057\u3066\u3082\u6D88\u3048\u307E\u305B\u3093\u3002",sendToClaude:"Claude \u306B\u9001\u308B",copy:"\u5909\u66F4\u30FB\u30B3\u30E1\u30F3\u30C8\u3092\u30B3\u30D4\u30FC",copyTitle:"Review \u3092\u30B3\u30D4\u30FC\u3057\u3066 Agent \u306B\u8CBC\u308A\u4ED8\u3051\u308B",clear:"\u30AF\u30EA\u30A2",deleteAction:"\u3053\u306E draft action \u3092\u524A\u9664",wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",comment:"\u30B3\u30E1\u30F3\u30C8",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F \u2713",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F \u2713",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"}}),lr=()=>({body:"",attachment:{kind:"page"},copy:{kind:"idle"},copyRequest:0,send:{kind:"idle"},sendRequest:0}),as=t=>t.kind==="explicit"?{kind:t.resume}:t,ds=(t,e)=>{switch(e.kind){case"input":return{...t,body:e.body};case"attach":return{...t,attachment:{kind:e.current?"current":"page"}};case"clear-target":return{...t,attachment:as(t.attachment)};case"target-requested":return{...t,attachment:{kind:"explicit",ref:e.ref,resume:t.attachment.kind==="explicit"?t.attachment.resume:t.attachment.kind}};case"submitted":return{...t,body:"",attachment:as(t.attachment),copy:{kind:"idle"},copyRequest:t.copyRequest+1,send:{kind:"idle"},sendRequest:t.sendRequest+1};case"copy-started":return{...t,copy:{kind:"pending"},copyRequest:t.copyRequest+1,send:{kind:"idle"},sendRequest:t.sendRequest+1};case"copy-finished":return e.request!==t.copyRequest||t.copy.kind!=="pending"?t:{...t,copy:{kind:e.ok?"copied":"failed"}};case"send-started":return{...t,send:{kind:"pending"},sendRequest:t.sendRequest+1,copy:{kind:"idle"},copyRequest:t.copyRequest+1};case"send-finished":return e.request!==t.sendRequest||t.send.kind!=="pending"?t:{...t,send:e.outcome.ok?{kind:"sent"}:{kind:"failed",reason:e.outcome.reason}}}},cr=(t,e)=>{const s=t.body.trim();return s===""?null:{target:e,body:s}},pr={en:"English",ja:"\u65E5\u672C\u8A9E"},B=ge({en:{review:"Review",reviewToggle:"Review / comments",useLightTheme:"Switch to light theme",useDarkTheme:"Switch to dark theme",language:"Language",resizeSidebar:"Resize sidebar",resizeSidebarHint:"Drag to resize. Double-click to reset",baseDataError:"Could not read the base data (showing an empty page)",handoffTooLarge:"The review is too long to send. Copy it and paste it instead",handoffConsent:"Commenting needs your permission. Allow it, then send again",handoffForbidden:"This page cannot send to Claude. Copy the review and paste it instead",handoffClaudeUnavailable:"Could not reach the Claude session. Copy the review and paste it instead",handoffRateLimited:"Too many sends in a row. Wait a moment, then send again",handoffStorage:"Could not save the review. Copy it and paste it instead",handoffError:"Could not send. Copy the review and paste it instead",handoffLabel:"Hand the review to the agent",handoffSend:"Send to Claude",handoffSending:"Sending\u2026",handoffSent:"Sent to Claude \u2713",handoffCopy:"Copy changes & comments",handoffCopyTitle:"Copy the review to paste it to the agent",handoffCopied:"Copied \u2713",handoffCopyFailed:"Could not copy"},ja:{review:"\u30EC\u30D3\u30E5\u30FC",reviewToggle:"\u30EC\u30D3\u30E5\u30FC / \u30B3\u30E1\u30F3\u30C8",useLightTheme:"\u30E9\u30A4\u30C8\u30C6\u30FC\u30DE\u306B\u3059\u308B",useDarkTheme:"\u30C0\u30FC\u30AF\u30C6\u30FC\u30DE\u306B\u3059\u308B",language:"\u8A00\u8A9E",resizeSidebar:"\u30B5\u30A4\u30C9\u30D0\u30FC\u306E\u5E45\u3092\u5909\u66F4",resizeSidebarHint:"\u30C9\u30E9\u30C3\u30B0\u3067\u5E45\u3092\u5909\u66F4\u3002\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u5143\u306B\u623B\u3059",baseDataError:"base data \u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u7A7A\u306E\u30DA\u30FC\u30B8\u3068\u3057\u3066\u8868\u793A\u4E2D\uFF09",handoffTooLarge:"Review \u304C\u9577\u3059\u304E\u3066\u9001\u308C\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffConsent:"\u30B3\u30E1\u30F3\u30C8\u306E\u8A31\u53EF\u304C\u5FC5\u8981\u3067\u3059\u3002\u8A31\u53EF\u3057\u3066\u304B\u3089\u3082\u3046\u4E00\u5EA6\u9001\u3063\u3066\u304F\u3060\u3055\u3044",handoffForbidden:"\u3053\u306E\u30DA\u30FC\u30B8\u304B\u3089\u306F\u9001\u308C\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffClaudeUnavailable:"Claude \u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306B\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffRateLimited:"\u9001\u4FE1\u304C\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u5C11\u3057\u5F85\u3063\u3066\u304B\u3089\u9001\u3063\u3066\u304F\u3060\u3055\u3044",handoffStorage:"Review \u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffError:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffLabel:"Review \u3092 Agent \u306B\u6E21\u3059",handoffSend:"Claude \u306B\u9001\u308B",handoffSending:"\u9001\u4FE1\u4E2D\u2026",handoffSent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F \u2713",handoffCopy:"\u5909\u66F4\u30FB\u30B3\u30E1\u30F3\u30C8\u3092\u30B3\u30D4\u30FC",handoffCopyTitle:"Review \u3092\u30B3\u30D4\u30FC\u3057\u3066 Agent \u306B\u8CBC\u308A\u4ED8\u3051\u308B",handoffCopied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F \u2713",handoffCopyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"}}),hr=4096,ur="reviews",ls="Review from the page (dev-process-kit). Apply it to the base data and republish this artifact. Then answer with ArtifactComments `reply` in this thread: the reader sees only this thread, and the page never shows anything written to the database.",fr=t=>new TextEncoder().encode(t).length,gr=t=>t.replace(/[\u0000-\u0008\u000B-\u001F\u007F]/g,""),mr=t=>{const e=`${ls}
518
+ `)},Z="0.0.8",Xe=async t=>{try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}const e=document.activeElement,s=document.createElement("textarea");try{return s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.append(s),s.select(),document.execCommand("copy")}catch{return!1}finally{s.remove(),e instanceof HTMLElement&&e.focus()}},os=ge({en:{heading:"Review notes",rejected:"Action rejected.",commentLabel:"Review comment",commentPlaceholder:"What should change, or what you noticed (passed to the agent as an instruction)",detach:"Detach",attachTo:t=>`Attach to this ${t}`,addNote:"Add note",empty:"No draft actions yet.",emptyHint:"Comments and structural patches both land here, and survive reload via LocalStorage.",sendToClaude:"Send to Claude",copy:"Copy changes & comments",copyTitle:"Copy the review to paste it to the agent",clear:"Clear",deleteAction:"Delete this draft action",wholePage:"Whole page",comment:"Comment",sent:"Sent to Claude \u2713",copied:"Copied \u2713",copyFailed:"Could not copy"},ja:{heading:"\u30EC\u30D3\u30E5\u30FC\u30CE\u30FC\u30C8",rejected:"action \u3092\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",commentLabel:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u5909\u66F4\u3057\u305F\u3044\u3053\u3068 / \u6C17\u3065\u304D\u3092\u66F8\u304F\uFF08Agent \u3078\u306E\u6307\u793A\u3068\u3057\u3066\u6E21\u308B\uFF09",detach:"\u7D10\u3065\u3051\u3092\u89E3\u9664",attachTo:t=>`\u3053\u306E ${t} \u306B\u7D10\u3065\u3051\u308B`,addNote:"\u30CE\u30FC\u30C8\u3092\u8FFD\u52A0",empty:"draft action \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",emptyHint:"\u30B3\u30E1\u30F3\u30C8\u3082\u69CB\u9020\u306E\u5909\u66F4\u3082\u3053\u3053\u306B\u96C6\u307E\u308A\u3001LocalStorage \u306B\u6B8B\u308B\u306E\u3067\u30EA\u30ED\u30FC\u30C9\u3057\u3066\u3082\u6D88\u3048\u307E\u305B\u3093\u3002",sendToClaude:"Claude \u306B\u9001\u308B",copy:"\u5909\u66F4\u30FB\u30B3\u30E1\u30F3\u30C8\u3092\u30B3\u30D4\u30FC",copyTitle:"Review \u3092\u30B3\u30D4\u30FC\u3057\u3066 Agent \u306B\u8CBC\u308A\u4ED8\u3051\u308B",clear:"\u30AF\u30EA\u30A2",deleteAction:"\u3053\u306E draft action \u3092\u524A\u9664",wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",comment:"\u30B3\u30E1\u30F3\u30C8",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F \u2713",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F \u2713",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"}}),lr=()=>({body:"",attachment:{kind:"page"},copy:{kind:"idle"},copyRequest:0,send:{kind:"idle"},sendRequest:0}),as=t=>t.kind==="explicit"?{kind:t.resume}:t,ds=(t,e)=>{switch(e.kind){case"input":return{...t,body:e.body};case"attach":return{...t,attachment:{kind:e.current?"current":"page"}};case"clear-target":return{...t,attachment:as(t.attachment)};case"target-requested":return{...t,attachment:{kind:"explicit",ref:e.ref,resume:t.attachment.kind==="explicit"?t.attachment.resume:t.attachment.kind}};case"submitted":return{...t,body:"",attachment:as(t.attachment),copy:{kind:"idle"},copyRequest:t.copyRequest+1,send:{kind:"idle"},sendRequest:t.sendRequest+1};case"copy-started":return{...t,copy:{kind:"pending"},copyRequest:t.copyRequest+1,send:{kind:"idle"},sendRequest:t.sendRequest+1};case"copy-finished":return e.request!==t.copyRequest||t.copy.kind!=="pending"?t:{...t,copy:{kind:e.ok?"copied":"failed"}};case"send-started":return{...t,send:{kind:"pending"},sendRequest:t.sendRequest+1,copy:{kind:"idle"},copyRequest:t.copyRequest+1};case"send-finished":return e.request!==t.sendRequest||t.send.kind!=="pending"?t:{...t,send:e.outcome.ok?{kind:"sent"}:{kind:"failed",reason:e.outcome.reason}}}},cr=(t,e)=>{const s=t.body.trim();return s===""?null:{target:e,body:s}},pr={en:"English",ja:"\u65E5\u672C\u8A9E"},B=ge({en:{review:"Review",reviewToggle:"Review / comments",useLightTheme:"Switch to light theme",useDarkTheme:"Switch to dark theme",language:"Language",resizeSidebar:"Resize sidebar",resizeSidebarHint:"Drag to resize. Double-click to reset",baseDataError:"Could not read the base data (showing an empty page)",handoffTooLarge:"The review is too long to send. Copy it and paste it instead",handoffConsent:"Commenting needs your permission. Allow it, then send again",handoffForbidden:"This page cannot send to Claude. Copy the review and paste it instead",handoffClaudeUnavailable:"Could not reach the Claude session. Copy the review and paste it instead",handoffRateLimited:"Too many sends in a row. Wait a moment, then send again",handoffStorage:"Could not save the review. Copy it and paste it instead",handoffError:"Could not send. Copy the review and paste it instead",handoffLabel:"Hand the review to the agent",handoffSend:"Send to Claude",handoffSending:"Sending\u2026",handoffSent:"Sent to Claude \u2713",handoffCopy:"Copy changes & comments",handoffCopyTitle:"Copy the review to paste it to the agent",handoffCopied:"Copied \u2713",handoffCopyFailed:"Could not copy"},ja:{review:"\u30EC\u30D3\u30E5\u30FC",reviewToggle:"\u30EC\u30D3\u30E5\u30FC / \u30B3\u30E1\u30F3\u30C8",useLightTheme:"\u30E9\u30A4\u30C8\u30C6\u30FC\u30DE\u306B\u3059\u308B",useDarkTheme:"\u30C0\u30FC\u30AF\u30C6\u30FC\u30DE\u306B\u3059\u308B",language:"\u8A00\u8A9E",resizeSidebar:"\u30B5\u30A4\u30C9\u30D0\u30FC\u306E\u5E45\u3092\u5909\u66F4",resizeSidebarHint:"\u30C9\u30E9\u30C3\u30B0\u3067\u5E45\u3092\u5909\u66F4\u3002\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u5143\u306B\u623B\u3059",baseDataError:"base data \u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u7A7A\u306E\u30DA\u30FC\u30B8\u3068\u3057\u3066\u8868\u793A\u4E2D\uFF09",handoffTooLarge:"Review \u304C\u9577\u3059\u304E\u3066\u9001\u308C\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffConsent:"\u30B3\u30E1\u30F3\u30C8\u306E\u8A31\u53EF\u304C\u5FC5\u8981\u3067\u3059\u3002\u8A31\u53EF\u3057\u3066\u304B\u3089\u3082\u3046\u4E00\u5EA6\u9001\u3063\u3066\u304F\u3060\u3055\u3044",handoffForbidden:"\u3053\u306E\u30DA\u30FC\u30B8\u304B\u3089\u306F\u9001\u308C\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffClaudeUnavailable:"Claude \u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306B\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffRateLimited:"\u9001\u4FE1\u304C\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u5C11\u3057\u5F85\u3063\u3066\u304B\u3089\u9001\u3063\u3066\u304F\u3060\u3055\u3044",handoffStorage:"Review \u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffError:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffLabel:"Review \u3092 Agent \u306B\u6E21\u3059",handoffSend:"Claude \u306B\u9001\u308B",handoffSending:"\u9001\u4FE1\u4E2D\u2026",handoffSent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F \u2713",handoffCopy:"\u5909\u66F4\u30FB\u30B3\u30E1\u30F3\u30C8\u3092\u30B3\u30D4\u30FC",handoffCopyTitle:"Review \u3092\u30B3\u30D4\u30FC\u3057\u3066 Agent \u306B\u8CBC\u308A\u4ED8\u3051\u308B",handoffCopied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F \u2713",handoffCopyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"}}),hr=4096,ur="reviews",ls="Review from the page (dev-process-kit). Apply it to the base data and republish this artifact. Then answer with ArtifactComments `reply` in this thread: the reader sees only this thread, and the page never shows anything written to the database.",fr=t=>new TextEncoder().encode(t).length,gr=t=>t.replace(/[\u0000-\u0008\u000B-\u001F\u007F]/g,""),mr=t=>{const e=`${ls}
519
519
 
520
520
  ${gr(t)}`;return fr(e)<=hr?e:null},br=t=>`${ls}
521
521
 
@@ -1 +1 @@
1
- import{_ as w,a9 as v,aa as s,ab as o,ac as _,ad as l,at as B,af as E,ag as $,V as j,T as x}from"./shared-Bfq73Ivq.js";const r=w({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),O=s({id:B,title:E(l(),$(1))}),c=s({title:o(l(),""),sections:o(_(O),[])}),p=t=>{const e=v(c,t),a=new Set;for(const n of e.sections){if(a.has(n.id))throw new Error(`duplicate section id: ${n.id}`);a.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),i=(t,e)=>t.sections.find(a=>a.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,a)=>{switch(a.type){case"section":return i(e,a.id)?.title??a.id;case"page":return t.wholePage;default:return a.id}},g=(t,e,a)=>({title:e.type,targetLabel:u(t,a,e.target),tone:"meta"}),f=t=>`${t.type} ${j(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(a=>({value:`section:${a.id}`,label:a.title,group:t.sectionGroup})),y=(t,e)=>e,P=(t,e)=>{switch(e.type){case"section":return i(t,e.id)!==void 0;case"page":return!0;default:return!1}},b=t=>{const e=r(t);return{name:"plain",label:"Plain",parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:P,describe:(a,n)=>g(e,a,n),serialize:f,resolveNavigation:y,commentTargets:a=>h(e,a),title:m}};class T extends x{definitionFor(e){return b(e)}renderRegions(e){return{}}}const S=()=>{customElements.get("dpk-template-plain")||customElements.define("dpk-template-plain",T)},k=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePlain:T,definePlainElement:S,describePlainAction:g,emptyPlainBase:d,findSection:i,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:b,plainHasTarget:P,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{S as d,k as i};
1
+ import{_ as w,a9 as v,aa as s,ab as o,ac as _,ad as l,at as B,af as E,ag as $,V as j,T as x}from"./shared-BYZoeQ97.js";const r=w({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),O=s({id:B,title:E(l(),$(1))}),c=s({title:o(l(),""),sections:o(_(O),[])}),p=t=>{const e=v(c,t),a=new Set;for(const n of e.sections){if(a.has(n.id))throw new Error(`duplicate section id: ${n.id}`);a.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),i=(t,e)=>t.sections.find(a=>a.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,a)=>{switch(a.type){case"section":return i(e,a.id)?.title??a.id;case"page":return t.wholePage;default:return a.id}},g=(t,e,a)=>({title:e.type,targetLabel:u(t,a,e.target),tone:"meta"}),f=t=>`${t.type} ${j(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(a=>({value:`section:${a.id}`,label:a.title,group:t.sectionGroup})),y=(t,e)=>e,P=(t,e)=>{switch(e.type){case"section":return i(t,e.id)!==void 0;case"page":return!0;default:return!1}},b=t=>{const e=r(t);return{name:"plain",label:"Plain",parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:P,describe:(a,n)=>g(e,a,n),serialize:f,resolveNavigation:y,commentTargets:a=>h(e,a),title:m}};class T extends x{definitionFor(e){return b(e)}renderRegions(e){return{}}}const S=()=>{customElements.get("dpk-template-plain")||customElements.define("dpk-template-plain",T)},k=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePlain:T,definePlainElement:S,describePlainAction:g,emptyPlainBase:d,findSection:i,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:b,plainHasTarget:P,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{S as d,k as i};
@@ -1,4 +1,4 @@
1
- import{a9 as se,ae as le,aa as v,ab as E,ac as D,at as w,av as l,ad as p,af as A,ag as L,q as y,an as f,v as ce,P as pe,f as R,_ as ue,V as B,R as $,aw as ge,ax as me,a1 as c,A as ve,a2 as s,a3 as ye,ay as be,K as ke,az as he,aA as fe,a0 as $e,T as z,m as xe}from"./shared-Bfq73Ivq.js";const b=[1,2,3,4,5,6,7],k=le(b,"a delegation level is an integer from 1 to 7"),h=A(p(),L(1)),Ee=v({player:h,level:k,reason:l(p())}),K=v({title:l(p()),parties:l(v({delegator:l(h),delegate:l(h)})),players:E(D(v({id:w,name:h})),[]),decisions:E(D(v({id:w,name:h,description:l(p()),cards:E(D(Ee),[]),agreed:l(k)})),[])}),F=e=>{const a=se(K,e),r=new Set;for(const o of a.players){if(r.has(o.id))throw new Error(`duplicate id "${o.id}" in players`);r.add(o.id)}const t=new Set;for(const o of a.decisions){if(t.has(o.id))throw new Error(`duplicate id "${o.id}" in decisions`);t.add(o.id);const i=new Set;for(const n of o.cards){if(!r.has(n.player))throw new Error(`decision "${o.id}" has a card from unknown player "${n.player}"`);if(i.has(n.player))throw new Error(`player "${n.player}" played more than one card on decision "${o.id}"`);i.add(n.player)}}return a},M=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},V=(e,a)=>e.players.find(r=>r.id===a),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:y("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:y("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:y("ADD_DECISION","page",f({id:w,name:A(p(),L(1)),description:l(p())}),{dedupeKey:ce}),SET_DECISION_NAME:y("SET_DECISION_NAME","decision",f({name:A(p(),L(1))})),DELETE_DECISION:y("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},j=(e,a)=>{const r=pe(g,a);if(r===null)return null;const t=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,t,o=>({...o,yours:r.payload.level}));case"AGREE_LEVEL":return T(e,t,o=>({...o,agreed:r.payload.level}));case"ADD_DECISION":{const o=r.payload;return e.decisions.some(i=>i.id===o.id)?e:C(e).includes(o.id)?null:{...e,decisions:[...e.decisions,{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},cards:[]}]}}case"SET_DECISION_NAME":return T(e,t,o=>({...o,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(o=>o.id===t)?{...e,decisions:e.decisions.filter(o=>o.id!==t)}:null;default:return R(r)}},T=(e,a,r)=>e.decisions.some(t=>t.id===a)?{...e,decisions:e.decisions.map(t=>t.id===a?r(t):t)}:null,q={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},Y={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},De={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},we={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ae={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Le={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},S=ue({en:{levelName:e=>q[e],levelPhrase:(e,a,r)=>De[e](a,r),levelLabel:e=>`${e} ${q[e]}`,statusLabel:e=>Ae[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>we[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Le[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),_=e=>e==="strict"?"strict":"lax",P=(e,a)=>e==="strict"&&a.yours!==void 0,G=(e,a,r)=>e==="lax"?{kind:"play"}:P(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},N=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),H=e=>e.yours!==void 0||e.agreed!==void 0,Ce=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(o=>({label:V(a,o.player)?.name??o.player,kind:"player",level:o.level,...o.reason===void 0?{}:{reason:o.reason}}))],Te=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Se=(e,a,r,t)=>{const o=Ce(e,a,t),i=H(t)?o:[];return{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},status:Te(t,o),hidden:H(t)?0:t.cards.length,...t.agreed===void 0?{}:{agreed:t.agreed},locked:P(r,t),cells:b.map(n=>({level:n,chips:i.filter(d=>d.level===n).map(({level:d,...de})=>de),yours:t.yours===n,agreed:t.agreed===n}))}},I=(e,a,r)=>{const{delegator:t,delegate:o}=N(e,a);return{levels:b.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,t,o)})),rows:a.decisions.map(i=>Se(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},J=(e,a,r)=>{const t=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(t):e.arrowFrom(e.levelLabel(a),t)},_e=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),U={PLAY_CARD:(e,a,r)=>{const t=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:J(e,u(r,a.target.id)?.yours,t.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:J(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:_e(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},W=(e,a,r,t)=>{let o;try{const i=Object.hasOwn(U,a.type)?U[a.type]:void 0;o=i?i(e,a,t??r):{title:a.type,tone:"meta"}}catch{o={title:a.type,tone:"meta"}}return{title:o.title,targetLabel:X(e,r,a.target),tone:o.tone,...o.body===void 0?{}:{summary:o.body}}},Q=e=>`${e.type} ${B(e.target)} ${JSON.stringify(e.payload)}`,X=(e,a,r)=>{switch(r.type){case"decision":{const t=u(a,r.id);return t?`${e.decisionKind} \xB7 ${t.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${O(a)}`;default:return`${r.type} \xB7 ${r.id}`}},Z=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(t=>({value:B({type:"decision",id:t.id}),label:t.name,group:e.decisionKind}))],O=e=>e.title??"Delegation Poker",ee=(e,a)=>a,ae=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},re=e=>{const a=S(e);return{name:"delegation-poker",label:"Delegation Poker",parseBase:F,emptyBase:M,actions:g,apply:j,hasTarget:ae,describe:(r,t,o)=>W(a,r,t,o),serialize:Q,resolveNavigation:ee,commentTargets:(r,t)=>Z(a,r),title:O}},te="dev-process-kit:delegation-poker:skip-strict-confirm",oe=e=>e===!0?!0:null,Pe=e=>{const a=e?ge(oe):me(oe);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Ne=(e,a,r,t)=>s`
1
+ import{a9 as se,ae as le,aa as v,ab as E,ac as D,at as w,av as l,ad as p,af as A,ag as L,q as y,an as f,v as ce,P as pe,f as R,_ as ue,V as B,R as $,aw as ge,ax as me,a1 as c,A as ve,a2 as s,a3 as ye,ay as be,K as ke,az as he,aA as fe,a0 as $e,T as z,m as xe}from"./shared-BYZoeQ97.js";const b=[1,2,3,4,5,6,7],k=le(b,"a delegation level is an integer from 1 to 7"),h=A(p(),L(1)),Ee=v({player:h,level:k,reason:l(p())}),K=v({title:l(p()),parties:l(v({delegator:l(h),delegate:l(h)})),players:E(D(v({id:w,name:h})),[]),decisions:E(D(v({id:w,name:h,description:l(p()),cards:E(D(Ee),[]),agreed:l(k)})),[])}),F=e=>{const a=se(K,e),r=new Set;for(const o of a.players){if(r.has(o.id))throw new Error(`duplicate id "${o.id}" in players`);r.add(o.id)}const t=new Set;for(const o of a.decisions){if(t.has(o.id))throw new Error(`duplicate id "${o.id}" in decisions`);t.add(o.id);const i=new Set;for(const n of o.cards){if(!r.has(n.player))throw new Error(`decision "${o.id}" has a card from unknown player "${n.player}"`);if(i.has(n.player))throw new Error(`player "${n.player}" played more than one card on decision "${o.id}"`);i.add(n.player)}}return a},M=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},V=(e,a)=>e.players.find(r=>r.id===a),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:y("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:y("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:y("ADD_DECISION","page",f({id:w,name:A(p(),L(1)),description:l(p())}),{dedupeKey:ce}),SET_DECISION_NAME:y("SET_DECISION_NAME","decision",f({name:A(p(),L(1))})),DELETE_DECISION:y("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},j=(e,a)=>{const r=pe(g,a);if(r===null)return null;const t=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,t,o=>({...o,yours:r.payload.level}));case"AGREE_LEVEL":return T(e,t,o=>({...o,agreed:r.payload.level}));case"ADD_DECISION":{const o=r.payload;return e.decisions.some(i=>i.id===o.id)?e:C(e).includes(o.id)?null:{...e,decisions:[...e.decisions,{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},cards:[]}]}}case"SET_DECISION_NAME":return T(e,t,o=>({...o,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(o=>o.id===t)?{...e,decisions:e.decisions.filter(o=>o.id!==t)}:null;default:return R(r)}},T=(e,a,r)=>e.decisions.some(t=>t.id===a)?{...e,decisions:e.decisions.map(t=>t.id===a?r(t):t)}:null,q={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},Y={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},De={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},we={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ae={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Le={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},S=ue({en:{levelName:e=>q[e],levelPhrase:(e,a,r)=>De[e](a,r),levelLabel:e=>`${e} ${q[e]}`,statusLabel:e=>Ae[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>we[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Le[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),_=e=>e==="strict"?"strict":"lax",P=(e,a)=>e==="strict"&&a.yours!==void 0,G=(e,a,r)=>e==="lax"?{kind:"play"}:P(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},N=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),H=e=>e.yours!==void 0||e.agreed!==void 0,Ce=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(o=>({label:V(a,o.player)?.name??o.player,kind:"player",level:o.level,...o.reason===void 0?{}:{reason:o.reason}}))],Te=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Se=(e,a,r,t)=>{const o=Ce(e,a,t),i=H(t)?o:[];return{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},status:Te(t,o),hidden:H(t)?0:t.cards.length,...t.agreed===void 0?{}:{agreed:t.agreed},locked:P(r,t),cells:b.map(n=>({level:n,chips:i.filter(d=>d.level===n).map(({level:d,...de})=>de),yours:t.yours===n,agreed:t.agreed===n}))}},I=(e,a,r)=>{const{delegator:t,delegate:o}=N(e,a);return{levels:b.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,t,o)})),rows:a.decisions.map(i=>Se(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},J=(e,a,r)=>{const t=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(t):e.arrowFrom(e.levelLabel(a),t)},_e=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),U={PLAY_CARD:(e,a,r)=>{const t=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:J(e,u(r,a.target.id)?.yours,t.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:J(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:_e(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},W=(e,a,r,t)=>{let o;try{const i=Object.hasOwn(U,a.type)?U[a.type]:void 0;o=i?i(e,a,t??r):{title:a.type,tone:"meta"}}catch{o={title:a.type,tone:"meta"}}return{title:o.title,targetLabel:X(e,r,a.target),tone:o.tone,...o.body===void 0?{}:{summary:o.body}}},Q=e=>`${e.type} ${B(e.target)} ${JSON.stringify(e.payload)}`,X=(e,a,r)=>{switch(r.type){case"decision":{const t=u(a,r.id);return t?`${e.decisionKind} \xB7 ${t.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${O(a)}`;default:return`${r.type} \xB7 ${r.id}`}},Z=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(t=>({value:B({type:"decision",id:t.id}),label:t.name,group:e.decisionKind}))],O=e=>e.title??"Delegation Poker",ee=(e,a)=>a,ae=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},re=e=>{const a=S(e);return{name:"delegation-poker",label:"Delegation Poker",parseBase:F,emptyBase:M,actions:g,apply:j,hasTarget:ae,describe:(r,t,o)=>W(a,r,t,o),serialize:Q,resolveNavigation:ee,commentTargets:(r,t)=>Z(a,r),title:O}},te="dev-process-kit:delegation-poker:skip-strict-confirm",oe=e=>e===!0?!0:null,Pe=e=>{const a=e?ge(oe):me(oe);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Ne=(e,a,r,t)=>s`
2
2
  <button
3
3
  class="dpk-icon-btn"
4
4
  type="button"
@@ -1,4 +1,4 @@
1
- import{a9 as Ae,aF as X,aa as V,ab as _,ac as N,av as w,ad as c,at as R,af as T,ag as b,ae as A,q as h,an as f,v as U,as as Y,P as $e,f as De,_ as Oe,V as C,U as Ve,R as E,a2 as y,a1 as k,az as se,a3 as Ne,z as Ye,ay as oe,m as Ce,a7 as Me,a8 as Le,a0 as We,T as ne}from"./shared-Bfq73Ivq.js";import{i as Ge}from"./shared-neoJW11Z.js";const z=["browser","native"],K=["mobile","tablet","desktop","fluid"],Be=V({id:R,kind:_(A(z),"browser"),viewport:_(A(K),"fluid"),label:w(c()),url:w(c())}),Fe=V({id:R,name:T(c(),b(1)),description:w(c()),title:w(T(c(),b(1))),actor:w(T(c(),b(1))),previews:_(N(Be),[])}),Ue=V({id:R,name:T(c(),b(1)),description:w(c()),actor:w(T(c(),b(1))),steps:_(N(Fe),[])}),ze=V({id:R,name:T(c(),b(1)),description:w(c()),actor:w(T(c(),b(1))),stories:_(N(Ue),[])}),de=V({title:w(c()),baseUrl:w(c()),activities:_(N(ze),[])}),Ke=e=>{const t=new Set,i=new Set;for(const a of e.activities){if(i.has(a.id))return`duplicate activity id "${a.id}"`;i.add(a.id);const r=new Set;for(const s of a.stories){if(r.has(s.id))return`duplicate story id "${s.id}" in activity "${a.id}"`;r.add(s.id);const o=new Set;for(const n of s.steps){if(o.has(n.id))return`duplicate step id "${n.id}" in story "${s.id}"`;o.add(n.id);for(const d of n.previews){if(t.has(d.id))return`duplicate preview id "${d.id}": preview ids are global, they name a light DOM slot`;t.add(d.id)}}}}return null},pe=e=>{const t=Ae(de,e),i=Ke(t);if(i!==null)throw new Error(i);return t},le=()=>({activities:[]}),P=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},I=(e,t)=>`${e}.${t}`,S=(e,t)=>{if(t===void 0)return;const i=X(t,2);if(i){const[r,s]=i;if(r===void 0||s===void 0)return;const o=e.activities.find(d=>d.id===r),n=o?.stories.find(d=>d.id===s);return o&&n?{activity:o,story:n}:void 0}if(t.includes("."))return;const a=e.activities.flatMap(r=>r.stories.filter(s=>s.id===t).map(s=>({activity:r,story:s})));return a.length===1?a[0]:void 0},ce=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},M=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,q=(e,t,i)=>`${e.id}.${t.id}.${i.id}`,m=(e,t)=>{if(t===void 0)return;const i=X(t,3);if(i){const[r,s,o]=i;if(r===void 0||s===void 0||o===void 0)return;const n=e.activities.find(l=>l.id===r),d=n?.stories.find(l=>l.id===s),u=d?d.steps.findIndex(l=>l.id===o):-1,p=d&&u>=0?d.steps[u]:void 0;return n&&d&&p?{activity:n,story:d,step:p,stepIndex:u}:void 0}if(t.includes("."))return;const a=H(e).filter(r=>r.step.id===t);return a.length===1?a[0]:void 0},x=(e,t)=>{if(t===void 0)return;const i=X(t,4);if(i){const[a,r,s,o]=i;if(a===void 0||r===void 0||s===void 0||o===void 0)return;const n=m(e,`${a}.${r}.${s}`),d=n?.step.previews.find(u=>u.id===o);return n&&d?{location:n,preview:d}:void 0}if(!t.includes("."))for(const a of e.activities)for(const r of a.stories)for(const[s,o]of r.steps.entries()){const n=o.previews.find(d=>d.id===t);if(n)return{location:{activity:a,story:r,step:o,stepIndex:s},preview:n}}},H=e=>e.activities.flatMap(t=>t.stories.flatMap(i=>i.steps.map((a,r)=>({activity:t,story:i,step:a,stepIndex:r})))),ue=e=>H(e).map(t=>t.step.id),g={SET_ACTIVITY_NAME:h("SET_ACTIVITY_NAME","activity",f({name:T(c(),b(1))})),SET_ACTIVITY_DESCRIPTION:h("SET_ACTIVITY_DESCRIPTION","activity",f({description:c()})),SET_STORY_NAME:h("SET_STORY_NAME","story",f({name:T(c(),b(1))})),SET_STORY_DESCRIPTION:h("SET_STORY_DESCRIPTION","story",f({description:c()})),SET_STEP_NAME:h("SET_STEP_NAME","step",f({name:T(c(),b(1))})),SET_STEP_DESCRIPTION:h("SET_STEP_DESCRIPTION","step",f({description:c()})),SET_PREVIEW_KIND:h("SET_PREVIEW_KIND","preview",f({kind:A(z)})),SET_PREVIEW_VIEWPORT:h("SET_PREVIEW_VIEWPORT","preview",f({viewport:A(K)})),SET_PREVIEW_LABEL:h("SET_PREVIEW_LABEL","preview",f({label:c()})),REORDER_ACTIVITY:h("REORDER_ACTIVITY","activity",f({after:Y(c())}),{mode:"sequence"}),REORDER_STORY:h("REORDER_STORY","story",f({after:Y(c())}),{mode:"sequence"}),REORDER_STEP:h("REORDER_STEP","step",f({after:Y(c())}),{mode:"sequence"}),MOVE_STORY:h("MOVE_STORY","story",f({toActivity:T(c(),b(1)),after:Y(c())}),{mode:"sequence"}),MOVE_STEP:h("MOVE_STEP","step",f({toStory:T(c(),b(1)),after:Y(c())}),{mode:"sequence"}),ADD_ACTIVITY:h("ADD_ACTIVITY","page",f({id:R,name:T(c(),b(1)),description:w(c())}),{dedupeKey:U}),ADD_STORY:h("ADD_STORY","activity",f({id:R,name:T(c(),b(1)),description:w(c())}),{dedupeKey:U}),ADD_STEP:h("ADD_STEP","story",f({id:R,name:T(c(),b(1)),description:w(c()),previews:w(N(f({id:R,kind:_(A(z),"browser"),viewport:_(A(K),"fluid"),label:w(c()),url:w(c())})))}),{dedupeKey:U}),ADD_PREVIEW:h("ADD_PREVIEW","step",f({id:R,kind:_(A(z),"browser"),viewport:_(A(K),"fluid"),label:w(c()),url:w(c())}),{dedupeKey:U}),DELETE_ACTIVITY:h("DELETE_ACTIVITY","activity",f({})),DELETE_STORY:h("DELETE_STORY","story",f({})),DELETE_STEP:h("DELETE_STEP","step",f({})),DELETE_PREVIEW:h("DELETE_PREVIEW","preview",f({}))},L={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setActivityDescription:(e,t)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:e},payload:{description:t}}),setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}}),setStepDescription:(e,t)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:e},payload:{description:t}}),setPreviewViewport:(e,t)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:e},payload:{viewport:t}}),setPreviewKind:(e,t)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:e},payload:{kind:t}}),setPreviewLabel:(e,t)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:e},payload:{label:t}}),reorderActivity:(e,t)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:e},payload:{after:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),reorderStep:(e,t)=>({type:"REORDER_STEP",target:{type:"step",id:e},payload:{after:t}}),moveStep:(e,t,i)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:i}}),moveStory:(e,t,i)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:i}}),addActivity:(e,t,i)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...i===void 0?{}:{description:i}}}),addStory:(e,t,i,a)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:i,...a===void 0?{}:{description:a}}}),addStep:(e,t,i,a)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:i,...a===void 0?{}:{previews:a}}}),addPreview:(e,t)=>({type:"ADD_PREVIEW",target:{type:"step",id:e},payload:{...t}}),deleteActivity:e=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:e},payload:{}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),deleteStep:e=>({type:"DELETE_STEP",target:{type:"step",id:e},payload:{}}),deletePreview:e=>({type:"DELETE_PREVIEW",target:{type:"preview",id:e},payload:{}})},ve=(e,t)=>{const i=$e(g,t);if(i===null)return null;const a=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":return D(e,a,r=>({...r,name:i.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return D(e,a,r=>({...r,description:i.payload.description}));case"SET_STORY_NAME":return O(e,a,r=>({...r,name:i.payload.name}));case"SET_STORY_DESCRIPTION":return O(e,a,r=>({...r,description:i.payload.description}));case"SET_STEP_NAME":return W(e,a,r=>({...r,name:i.payload.name}));case"SET_STEP_DESCRIPTION":return W(e,a,r=>({...r,description:i.payload.description}));case"SET_PREVIEW_KIND":return Q(e,a,r=>({...r,kind:i.payload.kind}));case"SET_PREVIEW_VIEWPORT":return Q(e,a,r=>({...r,viewport:i.payload.viewport}));case"SET_PREVIEW_LABEL":return Q(e,a,r=>({...r,label:i.payload.label}));case"REORDER_ACTIVITY":{const{after:r}=i.payload,s=G(e.activities,a,r);return s===null?null:{...e,activities:s}}case"REORDER_STORY":{const{after:r}=i.payload,s=S(e,a);if(!s)return null;const o=r===null?null:S(e,r);if(r!==null&&(!o||o.activity!==s.activity))return null;const n=G(s.activity.stories,s.story.id,o?.story.id??null);return n===null?null:D(e,s.activity.id,d=>({...d,stories:n}))}case"REORDER_STEP":{const{after:r}=i.payload,s=m(e,a);if(!s)return null;const o=r===null?null:m(e,r);if(r!==null&&(!o||o.story!==s.story))return null;const n=G(s.story.steps,s.step.id,o?.step.id??null);return n===null?null:O(e,I(s.activity.id,s.story.id),d=>({...d,steps:n}))}case"MOVE_STORY":{const{toActivity:r,after:s}=i.payload,o=S(e,a);if(!o)return null;const n=e.activities.find(l=>l.id===r);if(!n)return null;const d=s===null?null:S(e,s);if(s!==null&&(!d||d.activity!==n))return null;const u=d?.story.id??null;if(o.activity.id===r){const l=G(o.activity.stories,o.story.id,u);return l===null?null:D(e,r,v=>({...v,stories:l}))}if(n.stories.some(l=>l.id===o.story.id))return null;const p=ee(n.stories,o.story,u);return Z(e,l=>l.id===o.activity.id?{...l,stories:l.stories.filter(v=>v.id!==ce(a))}:l.id===r?{...l,stories:p}:l)}case"MOVE_STEP":{const{toStory:r,after:s}=i.payload,o=m(e,a);if(!o)return null;const n=S(e,r);if(!n)return null;const d=s===null?null:m(e,s);if(s!==null&&(!d||d.story!==n.story))return null;const u=d?.step.id??null;if(o.story===n.story){const l=G(o.story.steps,o.step.id,u);return l===null?null:O(e,r,v=>({...v,steps:l}))}if(n.story.steps.some(l=>l.id===o.step.id))return null;const p=ee(n.story.steps,o.step,u);return Z(e,l=>({...l,stories:l.stories.map(v=>v===o.story?{...v,steps:v.steps.filter($=>$.id!==ce(a))}:v===n.story?{...v,steps:p}:v)}))}case"ADD_ACTIVITY":{const r=i.payload;if(e.activities.some(o=>o.id===r.id))return e;const s={id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description},stories:[]};return{...e,activities:[...e.activities,s]}}case"ADD_STORY":{const r=i.payload,s=e.activities.find(n=>n.id===a);if(!s)return null;if(s.stories.some(n=>n.id===r.id))return e;const o={id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description},steps:[]};return D(e,a,n=>({...n,stories:[...n.stories,o]}))}case"ADD_STEP":{const r=i.payload,s=S(e,a)?.story;if(!s)return null;if(s.steps.some(d=>d.id===r.id))return e;const o=(r.previews??[]).map(d=>d.id);if(new Set(o).size!==o.length||o.some(d=>x(e,d)))return null;const n={id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description},previews:r.previews??[]};return O(e,a,d=>({...d,steps:[...d.steps,n]}))}case"ADD_PREVIEW":{const r=i.payload,s=m(e,a)?.step;return s?s.previews.some(o=>o.id===r.id)?e:x(e,r.id)?null:W(e,a,o=>({...o,previews:[...o.previews,r]})):null}case"DELETE_ACTIVITY":{const r=a;return e.activities.some(s=>s.id===r)?{...e,activities:e.activities.filter(s=>s.id!==r)}:null}case"DELETE_STORY":{const r=S(e,a);return r?D(e,r.activity.id,s=>({...s,stories:s.stories.filter(o=>o.id!==r.story.id)})):null}case"DELETE_STEP":{const r=m(e,a);return r?O(e,I(r.activity.id,r.story.id),s=>({...s,steps:s.steps.filter(o=>o.id!==r.step.id)})):null}case"DELETE_PREVIEW":{const r=x(e,a);return r?W(e,M(r.location),s=>({...s,previews:s.previews.filter(o=>o.id!==r.preview.id)})):null}default:return De(i)}},Z=(e,t)=>({...e,activities:e.activities.map(t)}),D=(e,t,i)=>{const a=t;return e.activities.some(r=>r.id===a)?Z(e,r=>r.id===a?i(r):r):null},O=(e,t,i)=>{const a=S(e,t);if(!a)return null;const r=a.story.id;return D(e,a.activity.id,s=>({...s,stories:s.stories.map(o=>o.id===r?i(o):o)}))},W=(e,t,i)=>{const a=m(e,t);if(!a)return null;const r=a.step.id;return O(e,I(a.activity.id,a.story.id),s=>({...s,steps:s.steps.map(o=>o.id===r?i(o):o)}))},Q=(e,t,i)=>{const a=x(e,t);if(!a)return null;const r=a.preview.id;return W(e,M(a.location),s=>({...s,previews:s.previews.map(o=>o.id===r?i(o):o)}))},G=(e,t,i)=>{const a=e.findIndex(o=>o.id===t);if(a<0||i!==null&&!e.some(o=>o.id===i))return null;if(t===i)return[...e];const r=e[a];if(r===void 0)return null;const s=e.filter(o=>o.id!==t);return ee(s,r,i)},ee=(e,t,i)=>{const a=[...e],r=i===null?-1:a.findIndex(s=>s.id===i);return a.splice(r+1,0,t),a},te=Oe({en:{renameActivity:"Rename Activity",updateActivityDescription:"Update Activity description",renameStory:"Rename UserStory",updateStoryDescription:"Update UserStory description",renameStep:"Rename Step",updateStepDescription:"Update Step description",changePreviewKind:"Change Preview kind",changePreviewViewport:"Change Preview viewport",changePreviewLabel:"Change Preview label",moveStory:"Move UserStory",moveStep:"Move Step",deleteTitle:"Delete",reorderTitle:e=>`Reorder ${e}`,addTitle:e=>`Add ${e}`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after "${e}"`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",previewGroup:"Preview",pageGroup:"Page",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"There are no Activities yet. Add ",noActivityAfter:" to the base JSON, or ask the agent.",deleteStepAria:"Delete step",addStepButton:"+ Step",stepNameLabel:"Step name",descriptionLabel:"Description",descriptionPlaceholder:"What happens in this Step (click to edit)",newStepName:"New step",noStepBefore:"There are no Steps yet. A Prototype has the meaning structure ",noStepAfter:" \u2014 one Step is one screen / one experience state. Add a Step to the base JSON, and a Preview will appear here.",noPreviewMetadata:"No preview metadata \u2014 ask the agent to add it.",storyWithoutSteps:"This UserStory has no Steps yet, so there is no screen to show. Add one with + Step, or ask the agent to prototype it.",pageActor:e=>`Used by ${e}`,fullscreen:"Full screen",exitFullscreen:"Exit full screen",fullscreenHint:"Show the preview alone \xB7 Esc to leave"},ja:{renameActivity:"Activity \u540D\u3092\u5909\u66F4",updateActivityDescription:"Activity \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStory:"UserStory \u540D\u3092\u5909\u66F4",updateStoryDescription:"UserStory \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStep:"Step \u540D\u3092\u5909\u66F4",updateStepDescription:"Step \u306E\u8AAC\u660E\u3092\u66F4\u65B0",changePreviewKind:"Preview \u306E\u7A2E\u5225\u3092\u5909\u66F4",changePreviewViewport:"Preview \u306E\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8\u3092\u5909\u66F4",changePreviewLabel:"Preview \u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",moveStory:"UserStory \u3092\u79FB\u52D5",moveStep:"Step \u3092\u79FB\u52D5",deleteTitle:"\u524A\u9664",reorderTitle:e=>`${e} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:e=>`${e} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 "${e}" \u306E\u76F4\u5F8C\u3078`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",previewGroup:"Preview",pageGroup:"Page",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"Activity \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E ",noActivityAfter:" \u3092\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",deleteStepAria:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",addStepButton:"+ Step",stepNameLabel:"Step \u540D",descriptionLabel:"\u8AAC\u660E",descriptionPlaceholder:"\u3053\u306E Step \u3067\u4F55\u304C\u8D77\u304D\u308B\u304B\uFF08\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\uFF09",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",noStepBefore:"Step \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002Prototype \u306F ",noStepAfter:" \u306E\u610F\u5473\u69CB\u9020\u3092\u6301\u3061\u30011 Step = 1 \u753B\u9762 / 1 \u4F53\u9A13\u72B6\u614B\u3067\u3059\u3002base JSON \u306B Step \u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B Preview \u304C\u73FE\u308C\u307E\u3059\u3002",noPreviewMetadata:"preview metadata \u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u8FFD\u52A0\u306F Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044",storyWithoutSteps:"\u3053\u306E UserStory \u306B\u306F\u307E\u3060 Step \u304C\u306A\u304F\u3001\u898B\u305B\u308B\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002+ Step \u3067\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",pageActor:e=>`\u5229\u7528\u8005: ${e}`,fullscreen:"\u5168\u753B\u9762\u8868\u793A",exitFullscreen:"\u5168\u753B\u9762\u3092\u7D42\u4E86",fullscreenHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3060\u3051\u3092\u8868\u793A \xB7 Esc \u3067\u623B\u308B"}}),B=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,qe=e=>({SET_ACTIVITY_NAME:(t,i)=>({title:e.renameActivity,tone:"update",body:B(P(i,t.target.id)?.name,E(g.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,i)=>({title:e.updateActivityDescription,tone:"update",body:ie(P(i,t.target.id)?.description,E(g.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,i)=>({title:e.renameStory,tone:"update",body:B(S(i,t.target.id)?.story.name,E(g.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,i)=>({title:e.updateStoryDescription,tone:"update",body:ie(S(i,t.target.id)?.story.description,E(g.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,i)=>({title:e.renameStep,tone:"update",body:B(m(i,t.target.id)?.step.name,E(g.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,i)=>({title:e.updateStepDescription,tone:"update",body:ie(m(i,t.target.id)?.step.description,E(g.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,i)=>({title:e.changePreviewKind,tone:"update",body:B(x(i,t.target.id)?.preview.kind,E(g.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,i)=>({title:e.changePreviewViewport,tone:"update",body:B(x(i,t.target.id)?.preview.viewport,E(g.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${E(g.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>re(e,e.activityGroup,E(g.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>re(e,e.storyGroup,E(g.REORDER_STORY,t).after),REORDER_STEP:t=>re(e,e.stepGroup,E(g.REORDER_STEP,t).after),MOVE_STORY:(t,i)=>({title:e.moveStory,tone:"move",body:`\u2192 ${P(i,E(g.MOVE_STORY,t).toActivity)?.name??E(g.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,i)=>({title:e.moveStep,tone:"move",body:`\u2192 ${S(i,E(g.MOVE_STEP,t).toStory)?.story.name??E(g.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>j(e,e.activityGroup,E(g.ADD_ACTIVITY,t).name),ADD_STORY:t=>j(e,e.storyGroup,E(g.ADD_STORY,t).name),ADD_STEP:t=>j(e,e.stepGroup,E(g.ADD_STEP,t).name),ADD_PREVIEW:t=>j(e,e.previewGroup,E(g.ADD_PREVIEW,t).label??E(g.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,i)=>J(e,P(i,t.target.id)?.name),DELETE_STORY:(t,i)=>J(e,S(i,t.target.id)?.story.name),DELETE_STEP:(t,i)=>J(e,m(i,t.target.id)?.step.name),DELETE_PREVIEW:(t,i)=>J(e,x(i,t.target.id)?.preview.label)}),ie=(e,t)=>{const i=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${i}"`:`"${He(e)}" \u2192 "${i}"`},He=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,re=(e,t,i)=>({title:e.reorderTitle(t),tone:"move",body:i===null?e.toFront:e.afterName(i)}),j=(e,t,i)=>({title:e.addTitle(t),tone:"create",body:`+ "${i}"`}),J=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),ye=(e,t,i,a)=>{const r=qe(e),s=Object.hasOwn(r,t.type)?r[t.type]:void 0,o=s?s(t,a??i):{title:t.type,tone:"meta"};return{title:o.title,targetLabel:fe(e,i,t.target),tone:o.tone,...o.body===void 0?{}:{summary:o.body}}},ge=e=>`${e.type} ${C(e.target)} ${JSON.stringify(e.payload)}`,fe=(e,t,i)=>{switch(i.type){case"activity":{const a=P(t,i.id);return a?e.targetLabel(e.activityGroup,a.name):e.targetMissing(e.activityGroup,i.id)}case"story":{const a=S(t,i.id)?.story;return a?e.targetLabel(e.storyGroup,a.name):e.targetMissing(e.storyGroup,i.id)}case"step":{const a=m(t,i.id)?.step;return a?e.targetLabel(e.stepGroup,a.name):e.targetMissing(e.stepGroup,i.id)}case"preview":{const a=x(t,i.id)?.preview;return a?e.targetLabel(e.previewGroup,a.label??a.id):e.targetMissing(e.previewGroup,i.id)}case"page":return e.targetLabel(e.pageGroup,ae(t));default:return e.targetLabel(i.type,i.id)}},je=(e,t)=>{if(t.url)return t.url;const i=e.baseUrl?.trim(),a=Ve(e.title??"");return`${(i?i.startsWith("http")?i:`https://${i}`:`https://${a==="item"?"page":a}.example.com`).replace(/\/+$/,"")}/${t.id}`},he=(e,t)=>{const i=[];for(const a of t.activities){i.push({value:C({type:"activity",id:a.id}),label:a.name,group:e.activityGroup});for(const r of a.stories){i.push({value:C({type:"story",id:I(a.id,r.id)}),label:`${a.name} \u203A ${r.name}`,group:e.storyGroup});for(const s of r.steps)i.push({value:C({type:"step",id:q(a,r,s)}),label:`${r.name} \u203A ${s.name}`,group:e.stepGroup})}}return i},Je=(e,t,i)=>{const a=m(t,i.step);return a?{value:C({type:"step",id:M(a)}),label:a.step.name,group:e.stepGroup}:null},Ee=(e,t)=>{const i=m(e,t.step);if(i)return{kind:"step",...i};const a=P(e,t.activity),r=a?.stories.find(s=>s.id===t.story||I(a.id,s.id)===t.story);return a&&r?{kind:"story",activity:a,story:r}:void 0},me=e=>{const{activity:t,story:i,step:a}=e,r=a.actor??i.actor??t.actor,s=a.title??a.name;return r===void 0?{title:s}:{actor:r,title:s}},Xe=(e,t)=>{const i=t.actor??e.actor;return i===void 0?{title:t.name}:{actor:i,title:t.name}},ae=e=>e.title??"UX Prototype",we=(e,t)=>{const i=P(e,t.activity),a=t.story,r=i?.stories.find(F=>F.id===a||I(i.id,F.id)===a),s=r&&i?{activity:i,story:r}:S(e,a),o=t.step,d=(s&&o?m(e,`${I(s.activity.id,s.story.id)}.${o}`):void 0)??m(e,o),u=d?.activity??s?.activity??i??e.activities[0],p=d?.story??(s&&s.activity===u?s.story:void 0)??u?.stories[0],l=d?.step??p?.steps[0],v={...t};u?v.activity=u.id:delete v.activity,p&&u?v.story=S(e,p.id)?p.id:I(u.id,p.id):delete v.story,l&&p&&u?v.step=m(e,l.id)?l.id:q(u,p,l):delete v.step;const $=l&&t.preview&&l.previews.some(F=>F.id===t.preview)?t.preview:l?.previews[0]?.id;return $?v.preview=$:delete v.preview,v},Ze=(e,t)=>{switch(t.type){case"activity":return P(e,t.id)!==void 0;case"story":return S(e,t.id)!==void 0;case"step":return m(e,t.id)!==void 0;case"preview":return x(e,t.id)!==void 0;case"page":return!0;default:return!1}},Se=e=>{const t=te(e);return{name:"prototype",label:"UX Prototype",parseBase:pe,emptyBase:le,actions:g,apply:ve,hasTarget:Ze,canonicalTarget:(i,a)=>{if(a.type==="step"){const r=m(i,a.id);return r?{...a,id:M(r)}:a}if(a.type==="story"){const r=S(i,a.id);return r?{...a,id:I(r.activity.id,r.story.id)}:a}if(a.type==="preview"){const r=x(i,a.id);return r?{...a,id:r.preview.id}:a}return a},describe:(i,a,r)=>ye(t,i,a,r),serialize:ge,resolveNavigation:we,navigationHierarchy:["activity","story","step","preview"],commentTargets:(i,a)=>he(t,i),currentTarget:(i,a)=>Je(t,i,a),title:ae}},Te=(e,t)=>{const{state:i,navigation:a}=e,r=Ee(i,a);if(!r)return y`<p class="nav-empty">${t.noActivityBefore}<code>activities</code>${t.noActivityAfter}</p>`;const{activity:s,story:o}=r,n=o.steps,d=r.kind==="step"?r.step:void 0,u=r.kind==="step"?M(r):void 0;return y`
1
+ import{a9 as Ae,aF as X,aa as V,ab as _,ac as N,av as w,ad as c,at as R,af as T,ag as b,ae as A,q as h,an as f,v as U,as as Y,P as $e,f as De,_ as Oe,V as C,U as Ve,R as E,a2 as y,a1 as k,az as se,a3 as Ne,z as Ye,ay as oe,m as Ce,a7 as Me,a8 as Le,a0 as We,T as ne}from"./shared-BYZoeQ97.js";import{i as Ge}from"./shared-DNk3phV5.js";const z=["browser","native"],K=["mobile","tablet","desktop","fluid"],Be=V({id:R,kind:_(A(z),"browser"),viewport:_(A(K),"fluid"),label:w(c()),url:w(c())}),Fe=V({id:R,name:T(c(),b(1)),description:w(c()),title:w(T(c(),b(1))),actor:w(T(c(),b(1))),previews:_(N(Be),[])}),Ue=V({id:R,name:T(c(),b(1)),description:w(c()),actor:w(T(c(),b(1))),steps:_(N(Fe),[])}),ze=V({id:R,name:T(c(),b(1)),description:w(c()),actor:w(T(c(),b(1))),stories:_(N(Ue),[])}),de=V({title:w(c()),baseUrl:w(c()),activities:_(N(ze),[])}),Ke=e=>{const t=new Set,i=new Set;for(const a of e.activities){if(i.has(a.id))return`duplicate activity id "${a.id}"`;i.add(a.id);const r=new Set;for(const s of a.stories){if(r.has(s.id))return`duplicate story id "${s.id}" in activity "${a.id}"`;r.add(s.id);const o=new Set;for(const n of s.steps){if(o.has(n.id))return`duplicate step id "${n.id}" in story "${s.id}"`;o.add(n.id);for(const d of n.previews){if(t.has(d.id))return`duplicate preview id "${d.id}": preview ids are global, they name a light DOM slot`;t.add(d.id)}}}}return null},pe=e=>{const t=Ae(de,e),i=Ke(t);if(i!==null)throw new Error(i);return t},le=()=>({activities:[]}),P=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},I=(e,t)=>`${e}.${t}`,S=(e,t)=>{if(t===void 0)return;const i=X(t,2);if(i){const[r,s]=i;if(r===void 0||s===void 0)return;const o=e.activities.find(d=>d.id===r),n=o?.stories.find(d=>d.id===s);return o&&n?{activity:o,story:n}:void 0}if(t.includes("."))return;const a=e.activities.flatMap(r=>r.stories.filter(s=>s.id===t).map(s=>({activity:r,story:s})));return a.length===1?a[0]:void 0},ce=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},M=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,q=(e,t,i)=>`${e.id}.${t.id}.${i.id}`,m=(e,t)=>{if(t===void 0)return;const i=X(t,3);if(i){const[r,s,o]=i;if(r===void 0||s===void 0||o===void 0)return;const n=e.activities.find(l=>l.id===r),d=n?.stories.find(l=>l.id===s),u=d?d.steps.findIndex(l=>l.id===o):-1,p=d&&u>=0?d.steps[u]:void 0;return n&&d&&p?{activity:n,story:d,step:p,stepIndex:u}:void 0}if(t.includes("."))return;const a=H(e).filter(r=>r.step.id===t);return a.length===1?a[0]:void 0},x=(e,t)=>{if(t===void 0)return;const i=X(t,4);if(i){const[a,r,s,o]=i;if(a===void 0||r===void 0||s===void 0||o===void 0)return;const n=m(e,`${a}.${r}.${s}`),d=n?.step.previews.find(u=>u.id===o);return n&&d?{location:n,preview:d}:void 0}if(!t.includes("."))for(const a of e.activities)for(const r of a.stories)for(const[s,o]of r.steps.entries()){const n=o.previews.find(d=>d.id===t);if(n)return{location:{activity:a,story:r,step:o,stepIndex:s},preview:n}}},H=e=>e.activities.flatMap(t=>t.stories.flatMap(i=>i.steps.map((a,r)=>({activity:t,story:i,step:a,stepIndex:r})))),ue=e=>H(e).map(t=>t.step.id),g={SET_ACTIVITY_NAME:h("SET_ACTIVITY_NAME","activity",f({name:T(c(),b(1))})),SET_ACTIVITY_DESCRIPTION:h("SET_ACTIVITY_DESCRIPTION","activity",f({description:c()})),SET_STORY_NAME:h("SET_STORY_NAME","story",f({name:T(c(),b(1))})),SET_STORY_DESCRIPTION:h("SET_STORY_DESCRIPTION","story",f({description:c()})),SET_STEP_NAME:h("SET_STEP_NAME","step",f({name:T(c(),b(1))})),SET_STEP_DESCRIPTION:h("SET_STEP_DESCRIPTION","step",f({description:c()})),SET_PREVIEW_KIND:h("SET_PREVIEW_KIND","preview",f({kind:A(z)})),SET_PREVIEW_VIEWPORT:h("SET_PREVIEW_VIEWPORT","preview",f({viewport:A(K)})),SET_PREVIEW_LABEL:h("SET_PREVIEW_LABEL","preview",f({label:c()})),REORDER_ACTIVITY:h("REORDER_ACTIVITY","activity",f({after:Y(c())}),{mode:"sequence"}),REORDER_STORY:h("REORDER_STORY","story",f({after:Y(c())}),{mode:"sequence"}),REORDER_STEP:h("REORDER_STEP","step",f({after:Y(c())}),{mode:"sequence"}),MOVE_STORY:h("MOVE_STORY","story",f({toActivity:T(c(),b(1)),after:Y(c())}),{mode:"sequence"}),MOVE_STEP:h("MOVE_STEP","step",f({toStory:T(c(),b(1)),after:Y(c())}),{mode:"sequence"}),ADD_ACTIVITY:h("ADD_ACTIVITY","page",f({id:R,name:T(c(),b(1)),description:w(c())}),{dedupeKey:U}),ADD_STORY:h("ADD_STORY","activity",f({id:R,name:T(c(),b(1)),description:w(c())}),{dedupeKey:U}),ADD_STEP:h("ADD_STEP","story",f({id:R,name:T(c(),b(1)),description:w(c()),previews:w(N(f({id:R,kind:_(A(z),"browser"),viewport:_(A(K),"fluid"),label:w(c()),url:w(c())})))}),{dedupeKey:U}),ADD_PREVIEW:h("ADD_PREVIEW","step",f({id:R,kind:_(A(z),"browser"),viewport:_(A(K),"fluid"),label:w(c()),url:w(c())}),{dedupeKey:U}),DELETE_ACTIVITY:h("DELETE_ACTIVITY","activity",f({})),DELETE_STORY:h("DELETE_STORY","story",f({})),DELETE_STEP:h("DELETE_STEP","step",f({})),DELETE_PREVIEW:h("DELETE_PREVIEW","preview",f({}))},L={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setActivityDescription:(e,t)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:e},payload:{description:t}}),setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}}),setStepDescription:(e,t)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:e},payload:{description:t}}),setPreviewViewport:(e,t)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:e},payload:{viewport:t}}),setPreviewKind:(e,t)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:e},payload:{kind:t}}),setPreviewLabel:(e,t)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:e},payload:{label:t}}),reorderActivity:(e,t)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:e},payload:{after:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),reorderStep:(e,t)=>({type:"REORDER_STEP",target:{type:"step",id:e},payload:{after:t}}),moveStep:(e,t,i)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:i}}),moveStory:(e,t,i)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:i}}),addActivity:(e,t,i)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...i===void 0?{}:{description:i}}}),addStory:(e,t,i,a)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:i,...a===void 0?{}:{description:a}}}),addStep:(e,t,i,a)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:i,...a===void 0?{}:{previews:a}}}),addPreview:(e,t)=>({type:"ADD_PREVIEW",target:{type:"step",id:e},payload:{...t}}),deleteActivity:e=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:e},payload:{}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),deleteStep:e=>({type:"DELETE_STEP",target:{type:"step",id:e},payload:{}}),deletePreview:e=>({type:"DELETE_PREVIEW",target:{type:"preview",id:e},payload:{}})},ve=(e,t)=>{const i=$e(g,t);if(i===null)return null;const a=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":return D(e,a,r=>({...r,name:i.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return D(e,a,r=>({...r,description:i.payload.description}));case"SET_STORY_NAME":return O(e,a,r=>({...r,name:i.payload.name}));case"SET_STORY_DESCRIPTION":return O(e,a,r=>({...r,description:i.payload.description}));case"SET_STEP_NAME":return W(e,a,r=>({...r,name:i.payload.name}));case"SET_STEP_DESCRIPTION":return W(e,a,r=>({...r,description:i.payload.description}));case"SET_PREVIEW_KIND":return Q(e,a,r=>({...r,kind:i.payload.kind}));case"SET_PREVIEW_VIEWPORT":return Q(e,a,r=>({...r,viewport:i.payload.viewport}));case"SET_PREVIEW_LABEL":return Q(e,a,r=>({...r,label:i.payload.label}));case"REORDER_ACTIVITY":{const{after:r}=i.payload,s=G(e.activities,a,r);return s===null?null:{...e,activities:s}}case"REORDER_STORY":{const{after:r}=i.payload,s=S(e,a);if(!s)return null;const o=r===null?null:S(e,r);if(r!==null&&(!o||o.activity!==s.activity))return null;const n=G(s.activity.stories,s.story.id,o?.story.id??null);return n===null?null:D(e,s.activity.id,d=>({...d,stories:n}))}case"REORDER_STEP":{const{after:r}=i.payload,s=m(e,a);if(!s)return null;const o=r===null?null:m(e,r);if(r!==null&&(!o||o.story!==s.story))return null;const n=G(s.story.steps,s.step.id,o?.step.id??null);return n===null?null:O(e,I(s.activity.id,s.story.id),d=>({...d,steps:n}))}case"MOVE_STORY":{const{toActivity:r,after:s}=i.payload,o=S(e,a);if(!o)return null;const n=e.activities.find(l=>l.id===r);if(!n)return null;const d=s===null?null:S(e,s);if(s!==null&&(!d||d.activity!==n))return null;const u=d?.story.id??null;if(o.activity.id===r){const l=G(o.activity.stories,o.story.id,u);return l===null?null:D(e,r,v=>({...v,stories:l}))}if(n.stories.some(l=>l.id===o.story.id))return null;const p=ee(n.stories,o.story,u);return Z(e,l=>l.id===o.activity.id?{...l,stories:l.stories.filter(v=>v.id!==ce(a))}:l.id===r?{...l,stories:p}:l)}case"MOVE_STEP":{const{toStory:r,after:s}=i.payload,o=m(e,a);if(!o)return null;const n=S(e,r);if(!n)return null;const d=s===null?null:m(e,s);if(s!==null&&(!d||d.story!==n.story))return null;const u=d?.step.id??null;if(o.story===n.story){const l=G(o.story.steps,o.step.id,u);return l===null?null:O(e,r,v=>({...v,steps:l}))}if(n.story.steps.some(l=>l.id===o.step.id))return null;const p=ee(n.story.steps,o.step,u);return Z(e,l=>({...l,stories:l.stories.map(v=>v===o.story?{...v,steps:v.steps.filter($=>$.id!==ce(a))}:v===n.story?{...v,steps:p}:v)}))}case"ADD_ACTIVITY":{const r=i.payload;if(e.activities.some(o=>o.id===r.id))return e;const s={id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description},stories:[]};return{...e,activities:[...e.activities,s]}}case"ADD_STORY":{const r=i.payload,s=e.activities.find(n=>n.id===a);if(!s)return null;if(s.stories.some(n=>n.id===r.id))return e;const o={id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description},steps:[]};return D(e,a,n=>({...n,stories:[...n.stories,o]}))}case"ADD_STEP":{const r=i.payload,s=S(e,a)?.story;if(!s)return null;if(s.steps.some(d=>d.id===r.id))return e;const o=(r.previews??[]).map(d=>d.id);if(new Set(o).size!==o.length||o.some(d=>x(e,d)))return null;const n={id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description},previews:r.previews??[]};return O(e,a,d=>({...d,steps:[...d.steps,n]}))}case"ADD_PREVIEW":{const r=i.payload,s=m(e,a)?.step;return s?s.previews.some(o=>o.id===r.id)?e:x(e,r.id)?null:W(e,a,o=>({...o,previews:[...o.previews,r]})):null}case"DELETE_ACTIVITY":{const r=a;return e.activities.some(s=>s.id===r)?{...e,activities:e.activities.filter(s=>s.id!==r)}:null}case"DELETE_STORY":{const r=S(e,a);return r?D(e,r.activity.id,s=>({...s,stories:s.stories.filter(o=>o.id!==r.story.id)})):null}case"DELETE_STEP":{const r=m(e,a);return r?O(e,I(r.activity.id,r.story.id),s=>({...s,steps:s.steps.filter(o=>o.id!==r.step.id)})):null}case"DELETE_PREVIEW":{const r=x(e,a);return r?W(e,M(r.location),s=>({...s,previews:s.previews.filter(o=>o.id!==r.preview.id)})):null}default:return De(i)}},Z=(e,t)=>({...e,activities:e.activities.map(t)}),D=(e,t,i)=>{const a=t;return e.activities.some(r=>r.id===a)?Z(e,r=>r.id===a?i(r):r):null},O=(e,t,i)=>{const a=S(e,t);if(!a)return null;const r=a.story.id;return D(e,a.activity.id,s=>({...s,stories:s.stories.map(o=>o.id===r?i(o):o)}))},W=(e,t,i)=>{const a=m(e,t);if(!a)return null;const r=a.step.id;return O(e,I(a.activity.id,a.story.id),s=>({...s,steps:s.steps.map(o=>o.id===r?i(o):o)}))},Q=(e,t,i)=>{const a=x(e,t);if(!a)return null;const r=a.preview.id;return W(e,M(a.location),s=>({...s,previews:s.previews.map(o=>o.id===r?i(o):o)}))},G=(e,t,i)=>{const a=e.findIndex(o=>o.id===t);if(a<0||i!==null&&!e.some(o=>o.id===i))return null;if(t===i)return[...e];const r=e[a];if(r===void 0)return null;const s=e.filter(o=>o.id!==t);return ee(s,r,i)},ee=(e,t,i)=>{const a=[...e],r=i===null?-1:a.findIndex(s=>s.id===i);return a.splice(r+1,0,t),a},te=Oe({en:{renameActivity:"Rename Activity",updateActivityDescription:"Update Activity description",renameStory:"Rename UserStory",updateStoryDescription:"Update UserStory description",renameStep:"Rename Step",updateStepDescription:"Update Step description",changePreviewKind:"Change Preview kind",changePreviewViewport:"Change Preview viewport",changePreviewLabel:"Change Preview label",moveStory:"Move UserStory",moveStep:"Move Step",deleteTitle:"Delete",reorderTitle:e=>`Reorder ${e}`,addTitle:e=>`Add ${e}`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after "${e}"`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",previewGroup:"Preview",pageGroup:"Page",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"There are no Activities yet. Add ",noActivityAfter:" to the base JSON, or ask the agent.",deleteStepAria:"Delete step",addStepButton:"+ Step",stepNameLabel:"Step name",descriptionLabel:"Description",descriptionPlaceholder:"What happens in this Step (click to edit)",newStepName:"New step",noStepBefore:"There are no Steps yet. A Prototype has the meaning structure ",noStepAfter:" \u2014 one Step is one screen / one experience state. Add a Step to the base JSON, and a Preview will appear here.",noPreviewMetadata:"No preview metadata \u2014 ask the agent to add it.",storyWithoutSteps:"This UserStory has no Steps yet, so there is no screen to show. Add one with + Step, or ask the agent to prototype it.",pageActor:e=>`Used by ${e}`,fullscreen:"Full screen",exitFullscreen:"Exit full screen",fullscreenHint:"Show the preview alone \xB7 Esc to leave"},ja:{renameActivity:"Activity \u540D\u3092\u5909\u66F4",updateActivityDescription:"Activity \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStory:"UserStory \u540D\u3092\u5909\u66F4",updateStoryDescription:"UserStory \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStep:"Step \u540D\u3092\u5909\u66F4",updateStepDescription:"Step \u306E\u8AAC\u660E\u3092\u66F4\u65B0",changePreviewKind:"Preview \u306E\u7A2E\u5225\u3092\u5909\u66F4",changePreviewViewport:"Preview \u306E\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8\u3092\u5909\u66F4",changePreviewLabel:"Preview \u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",moveStory:"UserStory \u3092\u79FB\u52D5",moveStep:"Step \u3092\u79FB\u52D5",deleteTitle:"\u524A\u9664",reorderTitle:e=>`${e} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:e=>`${e} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 "${e}" \u306E\u76F4\u5F8C\u3078`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",previewGroup:"Preview",pageGroup:"Page",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"Activity \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E ",noActivityAfter:" \u3092\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",deleteStepAria:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",addStepButton:"+ Step",stepNameLabel:"Step \u540D",descriptionLabel:"\u8AAC\u660E",descriptionPlaceholder:"\u3053\u306E Step \u3067\u4F55\u304C\u8D77\u304D\u308B\u304B\uFF08\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\uFF09",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",noStepBefore:"Step \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002Prototype \u306F ",noStepAfter:" \u306E\u610F\u5473\u69CB\u9020\u3092\u6301\u3061\u30011 Step = 1 \u753B\u9762 / 1 \u4F53\u9A13\u72B6\u614B\u3067\u3059\u3002base JSON \u306B Step \u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B Preview \u304C\u73FE\u308C\u307E\u3059\u3002",noPreviewMetadata:"preview metadata \u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u8FFD\u52A0\u306F Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044",storyWithoutSteps:"\u3053\u306E UserStory \u306B\u306F\u307E\u3060 Step \u304C\u306A\u304F\u3001\u898B\u305B\u308B\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002+ Step \u3067\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",pageActor:e=>`\u5229\u7528\u8005: ${e}`,fullscreen:"\u5168\u753B\u9762\u8868\u793A",exitFullscreen:"\u5168\u753B\u9762\u3092\u7D42\u4E86",fullscreenHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3060\u3051\u3092\u8868\u793A \xB7 Esc \u3067\u623B\u308B"}}),B=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,qe=e=>({SET_ACTIVITY_NAME:(t,i)=>({title:e.renameActivity,tone:"update",body:B(P(i,t.target.id)?.name,E(g.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,i)=>({title:e.updateActivityDescription,tone:"update",body:ie(P(i,t.target.id)?.description,E(g.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,i)=>({title:e.renameStory,tone:"update",body:B(S(i,t.target.id)?.story.name,E(g.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,i)=>({title:e.updateStoryDescription,tone:"update",body:ie(S(i,t.target.id)?.story.description,E(g.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,i)=>({title:e.renameStep,tone:"update",body:B(m(i,t.target.id)?.step.name,E(g.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,i)=>({title:e.updateStepDescription,tone:"update",body:ie(m(i,t.target.id)?.step.description,E(g.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,i)=>({title:e.changePreviewKind,tone:"update",body:B(x(i,t.target.id)?.preview.kind,E(g.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,i)=>({title:e.changePreviewViewport,tone:"update",body:B(x(i,t.target.id)?.preview.viewport,E(g.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${E(g.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>re(e,e.activityGroup,E(g.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>re(e,e.storyGroup,E(g.REORDER_STORY,t).after),REORDER_STEP:t=>re(e,e.stepGroup,E(g.REORDER_STEP,t).after),MOVE_STORY:(t,i)=>({title:e.moveStory,tone:"move",body:`\u2192 ${P(i,E(g.MOVE_STORY,t).toActivity)?.name??E(g.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,i)=>({title:e.moveStep,tone:"move",body:`\u2192 ${S(i,E(g.MOVE_STEP,t).toStory)?.story.name??E(g.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>j(e,e.activityGroup,E(g.ADD_ACTIVITY,t).name),ADD_STORY:t=>j(e,e.storyGroup,E(g.ADD_STORY,t).name),ADD_STEP:t=>j(e,e.stepGroup,E(g.ADD_STEP,t).name),ADD_PREVIEW:t=>j(e,e.previewGroup,E(g.ADD_PREVIEW,t).label??E(g.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,i)=>J(e,P(i,t.target.id)?.name),DELETE_STORY:(t,i)=>J(e,S(i,t.target.id)?.story.name),DELETE_STEP:(t,i)=>J(e,m(i,t.target.id)?.step.name),DELETE_PREVIEW:(t,i)=>J(e,x(i,t.target.id)?.preview.label)}),ie=(e,t)=>{const i=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${i}"`:`"${He(e)}" \u2192 "${i}"`},He=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,re=(e,t,i)=>({title:e.reorderTitle(t),tone:"move",body:i===null?e.toFront:e.afterName(i)}),j=(e,t,i)=>({title:e.addTitle(t),tone:"create",body:`+ "${i}"`}),J=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),ye=(e,t,i,a)=>{const r=qe(e),s=Object.hasOwn(r,t.type)?r[t.type]:void 0,o=s?s(t,a??i):{title:t.type,tone:"meta"};return{title:o.title,targetLabel:fe(e,i,t.target),tone:o.tone,...o.body===void 0?{}:{summary:o.body}}},ge=e=>`${e.type} ${C(e.target)} ${JSON.stringify(e.payload)}`,fe=(e,t,i)=>{switch(i.type){case"activity":{const a=P(t,i.id);return a?e.targetLabel(e.activityGroup,a.name):e.targetMissing(e.activityGroup,i.id)}case"story":{const a=S(t,i.id)?.story;return a?e.targetLabel(e.storyGroup,a.name):e.targetMissing(e.storyGroup,i.id)}case"step":{const a=m(t,i.id)?.step;return a?e.targetLabel(e.stepGroup,a.name):e.targetMissing(e.stepGroup,i.id)}case"preview":{const a=x(t,i.id)?.preview;return a?e.targetLabel(e.previewGroup,a.label??a.id):e.targetMissing(e.previewGroup,i.id)}case"page":return e.targetLabel(e.pageGroup,ae(t));default:return e.targetLabel(i.type,i.id)}},je=(e,t)=>{if(t.url)return t.url;const i=e.baseUrl?.trim(),a=Ve(e.title??"");return`${(i?i.startsWith("http")?i:`https://${i}`:`https://${a==="item"?"page":a}.example.com`).replace(/\/+$/,"")}/${t.id}`},he=(e,t)=>{const i=[];for(const a of t.activities){i.push({value:C({type:"activity",id:a.id}),label:a.name,group:e.activityGroup});for(const r of a.stories){i.push({value:C({type:"story",id:I(a.id,r.id)}),label:`${a.name} \u203A ${r.name}`,group:e.storyGroup});for(const s of r.steps)i.push({value:C({type:"step",id:q(a,r,s)}),label:`${r.name} \u203A ${s.name}`,group:e.stepGroup})}}return i},Je=(e,t,i)=>{const a=m(t,i.step);return a?{value:C({type:"step",id:M(a)}),label:a.step.name,group:e.stepGroup}:null},Ee=(e,t)=>{const i=m(e,t.step);if(i)return{kind:"step",...i};const a=P(e,t.activity),r=a?.stories.find(s=>s.id===t.story||I(a.id,s.id)===t.story);return a&&r?{kind:"story",activity:a,story:r}:void 0},me=e=>{const{activity:t,story:i,step:a}=e,r=a.actor??i.actor??t.actor,s=a.title??a.name;return r===void 0?{title:s}:{actor:r,title:s}},Xe=(e,t)=>{const i=t.actor??e.actor;return i===void 0?{title:t.name}:{actor:i,title:t.name}},ae=e=>e.title??"UX Prototype",we=(e,t)=>{const i=P(e,t.activity),a=t.story,r=i?.stories.find(F=>F.id===a||I(i.id,F.id)===a),s=r&&i?{activity:i,story:r}:S(e,a),o=t.step,d=(s&&o?m(e,`${I(s.activity.id,s.story.id)}.${o}`):void 0)??m(e,o),u=d?.activity??s?.activity??i??e.activities[0],p=d?.story??(s&&s.activity===u?s.story:void 0)??u?.stories[0],l=d?.step??p?.steps[0],v={...t};u?v.activity=u.id:delete v.activity,p&&u?v.story=S(e,p.id)?p.id:I(u.id,p.id):delete v.story,l&&p&&u?v.step=m(e,l.id)?l.id:q(u,p,l):delete v.step;const $=l&&t.preview&&l.previews.some(F=>F.id===t.preview)?t.preview:l?.previews[0]?.id;return $?v.preview=$:delete v.preview,v},Ze=(e,t)=>{switch(t.type){case"activity":return P(e,t.id)!==void 0;case"story":return S(e,t.id)!==void 0;case"step":return m(e,t.id)!==void 0;case"preview":return x(e,t.id)!==void 0;case"page":return!0;default:return!1}},Se=e=>{const t=te(e);return{name:"prototype",label:"UX Prototype",parseBase:pe,emptyBase:le,actions:g,apply:ve,hasTarget:Ze,canonicalTarget:(i,a)=>{if(a.type==="step"){const r=m(i,a.id);return r?{...a,id:M(r)}:a}if(a.type==="story"){const r=S(i,a.id);return r?{...a,id:I(r.activity.id,r.story.id)}:a}if(a.type==="preview"){const r=x(i,a.id);return r?{...a,id:r.preview.id}:a}return a},describe:(i,a,r)=>ye(t,i,a,r),serialize:ge,resolveNavigation:we,navigationHierarchy:["activity","story","step","preview"],commentTargets:(i,a)=>he(t,i),currentTarget:(i,a)=>Je(t,i,a),title:ae}},Te=(e,t)=>{const{state:i,navigation:a}=e,r=Ee(i,a);if(!r)return y`<p class="nav-empty">${t.noActivityBefore}<code>activities</code>${t.noActivityAfter}</p>`;const{activity:s,story:o}=r,n=o.steps,d=r.kind==="step"?r.step:void 0,u=r.kind==="step"?M(r):void 0;return y`
2
2
  <div class="nav">
3
3
  <div class="field">
4
4
  <span class="dpk-label">Activity</span>
@@ -1,4 +1,4 @@
1
- import{a9 as ht,aa as q,ab as ne,ac as oe,av as N,ad as v,at as X,ae as F,af as L,ag as M,q as T,an as S,v as ie,as as xe,P as mt,f as ut,_ as ft,V,R as $,a0 as ve,a5 as gt,k as bt,$ as ke,a6 as xt,a1 as I,ay as vt,a2 as k,A as kt,K as Et,i as yt,aB as wt,a4 as Y,a3 as Ee,aC as $t,T as ye,m as A}from"./shared-Bfq73Ivq.js";import{P as we,c as Tt,r as St,p as It,a as Lt}from"./shared-Dmq2K4Cr.js";import{c as $e}from"./shared-ml5h7U5L.js";function Mt(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}const j=["actor","command","aggregate","event","policy","readmodel","external","hotspot"],Nt=q({id:X,name:L(v(),M(1)),description:N(v())}),_t=q({id:X,type:F(j),name:L(v(),M(1)),description:N(v()),contextId:N(v())}),Ct=q({id:X,from:L(v(),M(1)),to:L(v(),M(1)),label:N(v()),kind:N(F(["member","flow"]))}),Te=q({title:N(v()),contexts:ne(oe(Nt),[]),elements:ne(oe(_t),[]),links:ne(oe(Ct),[])}),Se=t=>{const e=ht(Te,t),n=new Set(e.elements.map(i=>i.id)),o=new Set(e.contexts.map(i=>i.id));for(const i of e.elements)if(i.contextId!==void 0&&!o.has(i.contextId))throw new Error(`unknown context "${i.contextId}" for note "${i.id}"`);for(const i of e.links){if(!n.has(i.from))throw new Error(`unknown note "${i.from}" in link "${i.id}"`);if(!n.has(i.to))throw new Error(`unknown note "${i.to}" in link "${i.id}"`)}return e},Ie=()=>({contexts:[],elements:[],links:[]}),P=(t,e)=>{if(e!==void 0)return t.elements.find(n=>n.id===e)},H=(t,e)=>{if(e!==void 0)return t.contexts.find(n=>n.id===e)},se=(t,e)=>{if(e!==void 0)return t.links.find(n=>n.id===e)},W=t=>t.elements.map(e=>e.id),w={SET_ELEMENT_NAME:T("SET_ELEMENT_NAME","element",S({name:L(v(),M(1))})),SET_ELEMENT_DESCRIPTION:T("SET_ELEMENT_DESCRIPTION","element",S({description:v()})),SET_ELEMENT_TYPE:T("SET_ELEMENT_TYPE","element",S({type:F(j)})),SET_ELEMENT_CONTEXT:T("SET_ELEMENT_CONTEXT","element",S({contextId:xe(v())})),MOVE_ELEMENT:T("MOVE_ELEMENT","element",S({after:xe(v())}),{mode:"sequence"}),ADD_ELEMENT:T("ADD_ELEMENT","page",S({id:X,type:F(j),name:L(v(),M(1)),description:N(v()),contextId:N(v())}),{dedupeKey:ie}),DELETE_ELEMENT:T("DELETE_ELEMENT","element",S({})),LINK_ELEMENTS:T("LINK_ELEMENTS","page",S({id:X,from:L(v(),M(1)),to:L(v(),M(1)),label:N(v()),kind:N(F(["member","flow"]))}),{dedupeKey:ie}),SET_LINK_LABEL:T("SET_LINK_LABEL","link",S({label:v()})),UNLINK_ELEMENTS:T("UNLINK_ELEMENTS","page",S({from:L(v(),M(1)),to:L(v(),M(1))}),{mode:"sequence"}),ADD_CONTEXT:T("ADD_CONTEXT","page",S({id:X,name:L(v(),M(1)),description:N(v())}),{dedupeKey:ie}),SET_CONTEXT_NAME:T("SET_CONTEXT_NAME","context",S({name:L(v(),M(1))})),DELETE_CONTEXT:T("DELETE_CONTEXT","context",S({}))},y={setElementName:(t,e)=>({type:"SET_ELEMENT_NAME",target:{type:"element",id:t},payload:{name:e}}),setElementDescription:(t,e)=>({type:"SET_ELEMENT_DESCRIPTION",target:{type:"element",id:t},payload:{description:e}}),setElementType:(t,e)=>({type:"SET_ELEMENT_TYPE",target:{type:"element",id:t},payload:{type:e}}),setElementContext:(t,e)=>({type:"SET_ELEMENT_CONTEXT",target:{type:"element",id:t},payload:{contextId:e}}),moveElement:(t,e)=>({type:"MOVE_ELEMENT",target:{type:"element",id:t},payload:{after:e}}),addElement:(t,e,n)=>({type:"ADD_ELEMENT",target:{type:"page",id:"event-storming"},payload:{id:t,type:e,name:n}}),deleteElement:t=>({type:"DELETE_ELEMENT",target:{type:"element",id:t},payload:{}}),linkElements:(t,e,n,o)=>({type:"LINK_ELEMENTS",target:{type:"page",id:"event-storming"},payload:{id:t,from:e,to:n,...o?.label===void 0?{}:{label:o.label},...o?.kind===void 0?{}:{kind:o.kind}}}),setLinkLabel:(t,e)=>({type:"SET_LINK_LABEL",target:{type:"link",id:t},payload:{label:e}}),unlinkElements:(t,e)=>({type:"UNLINK_ELEMENTS",target:{type:"page",id:"event-storming"},payload:{from:t,to:e}}),addContext:(t,e)=>({type:"ADD_CONTEXT",target:{type:"page",id:"event-storming"},payload:{id:t,name:e}}),setContextName:(t,e)=>({type:"SET_CONTEXT_NAME",target:{type:"context",id:t},payload:{name:e}}),deleteContext:t=>({type:"DELETE_CONTEXT",target:{type:"context",id:t},payload:{}})},Le=(t,e)=>{const n=mt(w,e);if(n===null)return null;const o=n.target.id;switch(n.type){case"SET_ELEMENT_NAME":return Z(t,o,i=>({...i,name:n.payload.name}));case"SET_ELEMENT_DESCRIPTION":return Z(t,o,i=>({...i,description:n.payload.description}));case"SET_ELEMENT_TYPE":return Z(t,o,i=>({...i,type:n.payload.type}));case"SET_ELEMENT_CONTEXT":{const{contextId:i}=n.payload;return i!==null&&!t.contexts.some(s=>s.id===i)?null:Z(t,o,s=>i===null?Me(s):{...s,contextId:i})}case"MOVE_ELEMENT":{const{after:i}=n.payload,s=Ot(t.elements,o,i);return s===null?null:{...t,elements:s}}case"ADD_ELEMENT":{const i=n.payload;if(t.elements.some(r=>r.id===i.id))return t;if(i.contextId!==void 0&&!t.contexts.some(r=>r.id===i.contextId))return null;const s={id:i.id,type:i.type,name:i.name,...i.description===void 0?{}:{description:i.description},...i.contextId===void 0?{}:{contextId:i.contextId}};return{...t,elements:[...t.elements,s]}}case"DELETE_ELEMENT":return t.elements.some(i=>i.id===o)?{...t,elements:t.elements.filter(i=>i.id!==o),links:t.links.filter(i=>i.from!==o&&i.to!==o)}:null;case"LINK_ELEMENTS":{const i=n.payload;return t.links.some(s=>s.id===i.id)?t:!t.elements.some(s=>s.id===i.from)||!t.elements.some(s=>s.id===i.to)?null:{...t,links:[...t.links,{id:i.id,from:i.from,to:i.to,...i.label===void 0?{}:{label:i.label},...i.kind===void 0?{}:{kind:i.kind}}]}}case"SET_LINK_LABEL":return t.links.some(i=>i.id===o)?{...t,links:t.links.map(i=>i.id===o?{...i,label:n.payload.label}:i)}:null;case"UNLINK_ELEMENTS":{const i=n.payload;return t.links.some(s=>s.from===i.from&&s.to===i.to)?{...t,links:t.links.filter(s=>!(s.from===i.from&&s.to===i.to))}:null}case"ADD_CONTEXT":{const i=n.payload;if(t.contexts.some(r=>r.id===i.id))return t;const s={id:i.id,name:i.name,...i.description===void 0?{}:{description:i.description}};return{...t,contexts:[...t.contexts,s]}}case"SET_CONTEXT_NAME":return t.contexts.some(i=>i.id===o)?{...t,contexts:t.contexts.map(i=>i.id===o?{...i,name:n.payload.name}:i)}:null;case"DELETE_CONTEXT":return t.contexts.some(i=>i.id===o)?{...t,contexts:t.contexts.filter(i=>i.id!==o),elements:t.elements.map(i=>i.contextId===o?Me(i):i)}:null;default:return ut(n)}},Me=t=>{const e={...t};return delete e.contextId,e},Z=(t,e,n)=>t.elements.some(o=>o.id===e)?{...t,elements:t.elements.map(o=>o.id===e?n(o):o)}:null,Ot=(t,e,n)=>{const o=t.findIndex(a=>a.id===e);if(o<0||n!==null&&!t.some(a=>a.id===n))return null;const i=t[o];if(i===void 0)return null;const r=[...t.filter(a=>a.id!==e)];return r.splice(n===null?0:r.findIndex(a=>a.id===n)+1,0,i),r},At=new Set(["actor>command","command>aggregate","aggregate>event","command>event","policy>command","external>event"]),J=(t,e)=>At.has(`${t}>${e}`),zt=(t,e,n)=>t.kind!==void 0?t.kind==="member":J(e,n),Dt=["readmodel","actor","policy","command","aggregate","external","event","hotspot"],Pt=(t,e)=>{const n=new Map;for(const o of t.links){const i=e.get(o.from),s=e.get(o.to);if(i===void 0||s===void 0||i==="hotspot"==(s==="hotspot")||o.kind!==void 0&&o.kind!=="member")continue;const r=i==="hotspot"?o.from:o.to;n.has(r)||n.set(r,i==="hotspot"?o.to:o.from)}return n},Rt=(t,e,n)=>{const o=new Map(t.map(a=>[a.id,a.id])),i=a=>{let d=a;for(;o.get(d)!==d;)d=o.get(d)??d;let l=a;for(;l!==d;){const p=o.get(l)??d;o.set(l,d),l=p}return d};for(const a of e){if(!o.has(a.from)||!o.has(a.to))continue;const d=n.get(a.from),l=n.get(a.to);d===void 0||l===void 0||zt(a,d,l)&&o.set(i(a.from),i(a.to))}const s=new Map,r=new Map;for(const a of t){const d=i(a.id);r.set(a.id,d);const l=s.get(d);l?l.push(a):s.set(d,[a])}return{groups:s,rootOf:r}},R=t=>{const e=new Map(t.elements.map(l=>[l.id,l.type])),n=Pt(t,e),o=t.elements.filter(l=>!n.has(l.id)),{groups:i,rootOf:s}=Rt(o,t.links,e),r=new Map;for(const[l,p]of n){const m=P(t,l),f=s.get(p);if(m===void 0||f===void 0)continue;const g=r.get(f);g?g.push({note:m,targetId:p}):r.set(f,[{note:m,targetId:p}])}const a=new Map(Dt.map((l,p)=>[l,p])),d=new Map(t.elements.map((l,p)=>[l.id,p]));return[...i].map(([l,p])=>{const m=[...p].sort((f,g)=>(a.get(f.type)??0)-(a.get(g.type)??0)||(d.get(f.id)??0)-(d.get(g.id)??0));return{id:p[0]?.id??"",notes:m,pins:r.get(l)??[],contextId:p.find(f=>f.contextId!==void 0)?.contextId}})},Bt=t=>{const e=R(t).flatMap(o=>[...o.notes,...o.pins.map(i=>i.note)]),n=new Set(e.map(o=>o.id));return{...t,elements:[...e,...t.elements.filter(o=>!n.has(o.id))]}},Ne=(t,e)=>{const n=[...t.notes,...t.pins.map(r=>r.note)],o=n.find(r=>J(e,r.type));if(o!==void 0)return{anchorId:o.id,incoming:!0};const i=n.find(r=>J(r.type,e));if(i!==void 0)return{anchorId:i.id,incoming:!1};const s=n[0];return s===void 0?void 0:{anchorId:s.id,incoming:!0}},_e=(t,e)=>{const n=new Map(e.flatMap(o=>o.notes.map(i=>[i.id,o.id])));return t.links.flatMap(o=>{const i=n.get(o.from),s=n.get(o.to);return i===void 0||s===void 0||i===s?[]:[{id:o.id,from:i,to:s,...o.label!==void 0?{label:o.label}:{}}]})},re=(t,e)=>`${t}\0${e}`,Ce=(t,e,n)=>{const{widthOf:o,gapX:i,padX:s,maxWidth:r}=n,a=new Map;for(const c of e)a.set(re(c.from,c.to),c),a.set(re(c.to,c.from),c);const d=(c,h)=>c===void 0||h===void 0?void 0:a.get(re(c,h)),l=c=>Mt(c,h=>o(h))+i*Math.max(0,c.length-1)+s*2<=r,p=[];let m=[],f;const g=()=>{m.length!==0&&(p.push({sliceIds:m,...f===void 0?{}:{cutFrom:f}}),m=[],f=void 0)};for(const c of t.map(h=>h.id)){if(m.length>0&&!l([...m,c])){let h=m.length;for(;d(m[h-1],h===m.length?c:m[h])!==void 0&&(h-=1,h!==0););const b=h===0?[]:m.splice(h),x=h===0?d(m.at(-1),c):d(m.at(-1),b[0]);g(),m=b,f=x}m.push(c)}return g(),p},G=t=>[...t.notes].reverse().find(e=>e.type==="event")??t.notes.at(-1),Oe=(t,e)=>{const n=G(t),o=e.notes[0];if(!(n===void 0||o===void 0))return{from:n.id,to:o.id}},Ae={actor:"Actor",command:"Command",aggregate:"Aggregate",event:"Domain Event",policy:"Policy",readmodel:"Read Model",external:"External System",hotspot:"Hotspot"},ze={actor:"\u30A2\u30AF\u30BF\u30FC",command:"\u30B3\u30DE\u30F3\u30C9",aggregate:"\u96C6\u7D04",event:"\u30A4\u30D9\u30F3\u30C8",policy:"\u30DD\u30EA\u30B7\u30FC",readmodel:"\u30EA\u30FC\u30C9\u30E2\u30C7\u30EB",external:"\u5916\u90E8\u30B7\u30B9\u30C6\u30E0",hotspot:"\u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8"},O=ft({en:{renameElementTitle:"Rename element",updateDescriptionTitle:"Update element description",changeTypeTitle:"Change element type",changeContextTitle:"Change the element\u2019s context",moveTitle:"Change timeline position",addElementTitle:"Add element",deleteElementTitle:"Delete element",linkTitle:"Link elements",renameLinkTitle:"Change link label",unlinkTitle:"Remove link",addContextTitle:"Add bounded context",renameContextTitle:"Rename bounded context",deleteContextTitle:"Delete bounded context",renamed:(t,e)=>`"${t}" \u2192 "${e}"`,noContext:"No context",moveToFront:"\u2192 To the front",moveAfter:t=>`\u2192 Right after "${t}"`,elementLabel:t=>`Element \xB7 ${t}`,contextLabel:t=>`Bounded context \xB7 ${t}`,linkLabel:(t,e)=>`Link \xB7 ${t}\u2192${e}`,linkGroup:"Link",pageLabel:t=>`Page \xB7 ${t}`,elementGroup:"Element",contextGroup:"Bounded context",noteTypeLabel:t=>Ae[t],addTypeLabel:t=>`+ ${Ae[t]}`,addHotspot:"+ Hotspot",pinHotspotTitle:"Pin a hotspot on this note",deleteNote:"Delete",noteNameLabel:"Note name",newContextTitle:"New bounded context",contextNamePlaceholder:"Context name",cancel:"Cancel",create:"Create",save:"Save",appendMenuNext:"Note to add next",appendMenuAfter:t=>`Continue after \u201C${t}\u201D`,emptyTitle:"No notes yet",emptyBody:"Start Event Storming by placing domain events on the timeline.",addFirstEvent:"+ First event",portAriaLabel:"Add what comes next (pick a type, or drag to connect to another slice)",portTitle:"Click: pick a note to continue / Drag: connect to another slice",renameContextHint:"Click to rename",dissolveContextAria:t=>`Dissolve bounded context "${t}"`,dissolveContextTitle:"Dissolve the bounded context (notes stay)",noteCount:t=>`${t} notes`,sliceCount:t=>`${t} slices`,contextCount:t=>`${t} bounded contexts`,hudHint:"Wheel: pan \xB7 Pinch: zoom \xB7 Drag background: select area",zoomOut:"Zoom out",zoomReset:"Reset to 100%",zoomIn:"Zoom in",zoomFit:"Fit to view",selectedLinks:t=>`${t} links selected`,deleteLinks:"Delete links",deleteHint:"Delete works too",clearSelection:"Clear selection",selectedSlices:t=>`${t} slices selected`,groupIntoContext:"Group into a bounded context",addToExistingAria:"Add to an existing bounded context",addToExistingOption:"Add to existing\u2026",removeFromContext:"Remove from context",deleteButton:"Delete"},ja:{renameElementTitle:"\u8981\u7D20\u540D\u3092\u5909\u66F4",updateDescriptionTitle:"\u8981\u7D20\u306E\u8AAC\u660E\u3092\u66F4\u65B0",changeTypeTitle:"\u8981\u7D20\u306E\u7A2E\u5225\u3092\u5909\u66F4",changeContextTitle:"\u6240\u5C5E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u5909\u66F4",moveTitle:"\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u4F4D\u7F6E\u3092\u5909\u66F4",addElementTitle:"\u8981\u7D20\u3092\u8FFD\u52A0",deleteElementTitle:"\u8981\u7D20\u3092\u524A\u9664",linkTitle:"\u8981\u7D20\u3092\u9023\u7D50",renameLinkTitle:"\u30EA\u30F3\u30AF\u540D\u3092\u5909\u66F4",unlinkTitle:"\u30EA\u30F3\u30AF\u3092\u524A\u9664",addContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u8FFD\u52A0",renameContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u540D\u3092\u5909\u66F4",deleteContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u524A\u9664",renamed:(t,e)=>`"${t}" \u2192 "${e}"`,noContext:"\u672A\u6240\u5C5E",moveToFront:"\u2192 \u5148\u982D\u3078",moveAfter:t=>`\u2192 "${t}" \u306E\u76F4\u5F8C\u3078`,elementLabel:t=>`\u8981\u7D20 \xB7 ${t}`,contextLabel:t=>`\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8 \xB7 ${t}`,linkLabel:(t,e)=>`\u30EA\u30F3\u30AF \xB7 ${t}\u2192${e}`,linkGroup:"\u30EA\u30F3\u30AF",pageLabel:t=>`\u30DA\u30FC\u30B8 \xB7 ${t}`,elementGroup:"\u8981\u7D20",contextGroup:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",noteTypeLabel:t=>ze[t],addTypeLabel:t=>`+ ${ze[t]}`,addHotspot:"+ \u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8",pinHotspotTitle:"\u3053\u306E\u4ED8\u7B8B\u306B\u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8\u3092\u7ACB\u3066\u308B",deleteNote:"\u524A\u9664",noteNameLabel:"\u4ED8\u7B8B\u540D",newContextTitle:"\u65B0\u3057\u3044\u5883\u754C\u3065\u3051\u3089\u308C\u305F\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",contextNamePlaceholder:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u540D",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",create:"\u4F5C\u6210",save:"\u4FDD\u5B58",appendMenuNext:"\u7D9A\u304D\u306B\u8FFD\u52A0\u3059\u308B\u4ED8\u7B8B",appendMenuAfter:t=>`\u300C${t}\u300D\u306E\u7D9A\u304D\u306B\u8FFD\u52A0`,emptyTitle:"\u4ED8\u7B8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",emptyBody:"\u30A4\u30D9\u30F3\u30C8\u30B9\u30C8\u30FC\u30DF\u30F3\u30B0\u3092\u958B\u59CB\u3057\u307E\u3057\u3087\u3046\u3002\u30C9\u30E1\u30A4\u30F3\u30A4\u30D9\u30F3\u30C8\u3092\u6642\u7CFB\u5217\u306B\u8CBC\u308B\u3068\u3053\u308D\u304B\u3089\u59CB\u3081\u307E\u3059\u3002",addFirstEvent:"+ \u6700\u521D\u306E\u30A4\u30D9\u30F3\u30C8",portAriaLabel:"\u7D9A\u304D\u3092\u8FFD\u52A0\uFF08\u7A2E\u985E\u3092\u9078\u3093\u3067\u8FFD\u52A0 / \u30C9\u30E9\u30C3\u30B0\u3067\u4ED6\u306E\u30B9\u30E9\u30A4\u30B9\u3078\u63A5\u7D9A\uFF09",portTitle:"\u30AF\u30EA\u30C3\u30AF: \u7D9A\u304D\u306E\u4ED8\u7B8B\u3092\u9078\u3093\u3067\u8FFD\u52A0 / \u30C9\u30E9\u30C3\u30B0: \u4ED6\u306E\u30B9\u30E9\u30A4\u30B9\u3078\u63A5\u7D9A",renameContextHint:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u540D\u524D\u3092\u5909\u66F4",dissolveContextAria:t=>`\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u300C${t}\u300D\u3092\u89E3\u4F53`,dissolveContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u89E3\u4F53\uFF08\u4ED8\u7B8B\u306F\u6B8B\u308A\u307E\u3059\uFF09",noteCount:t=>`${t} \u4ED8\u7B8B`,sliceCount:t=>`${t} \u30B9\u30E9\u30A4\u30B9`,contextCount:t=>`${t} \u30B3\u30F3\u30C6\u30AD\u30B9\u30C8`,hudHint:"\u30DB\u30A4\u30FC\u30EB: \u79FB\u52D5 \xB7 \u30D4\u30F3\u30C1: \u30BA\u30FC\u30E0 \xB7 \u80CC\u666F\u30C9\u30E9\u30C3\u30B0: \u7BC4\u56F2\u9078\u629E",zoomOut:"\u7E2E\u5C0F",zoomReset:"100% \u306B\u623B\u3059",zoomIn:"\u62E1\u5927",zoomFit:"\u5168\u4F53\u3092\u8868\u793A",selectedLinks:t=>`${t} \u672C\u306E\u30EA\u30F3\u30AF\u3092\u9078\u629E\u4E2D`,deleteLinks:"\u30EA\u30F3\u30AF\u3092\u524A\u9664",deleteHint:"Delete \u3067\u3082\u524A\u9664\u3067\u304D\u307E\u3059",clearSelection:"\u9078\u629E\u89E3\u9664",selectedSlices:t=>`${t} \u30B9\u30E9\u30A4\u30B9\u3092\u9078\u629E\u4E2D`,groupIntoContext:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u306B\u307E\u3068\u3081\u308B",addToExistingAria:"\u65E2\u5B58\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3078\u8FFD\u52A0",addToExistingOption:"\u65E2\u5B58\u3078\u8FFD\u52A0\u2026",removeFromContext:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u89E3\u9664",deleteButton:"\u524A\u9664"}}),Xt={SET_ELEMENT_NAME:(t,e,n)=>({title:t.renameElementTitle,tone:"update",body:t.renamed(P(n,e.target.id)?.name??"?",$(w.SET_ELEMENT_NAME,e).name)}),SET_ELEMENT_DESCRIPTION:(t,e)=>({title:t.updateDescriptionTitle,tone:"update",body:`\u2192 "${$(w.SET_ELEMENT_DESCRIPTION,e).description.slice(0,60)}"`}),SET_ELEMENT_TYPE:(t,e)=>({title:t.changeTypeTitle,tone:"update",body:`\u2192 ${$(w.SET_ELEMENT_TYPE,e).type}`}),SET_ELEMENT_CONTEXT:(t,e)=>({title:t.changeContextTitle,tone:"move",body:`\u2192 ${$(w.SET_ELEMENT_CONTEXT,e).contextId??t.noContext}`}),MOVE_ELEMENT:(t,e)=>({title:t.moveTitle,tone:"move",body:$(w.MOVE_ELEMENT,e).after===null?t.moveToFront:t.moveAfter($(w.MOVE_ELEMENT,e).after??"")}),ADD_ELEMENT:(t,e)=>({title:t.addElementTitle,tone:"create",body:`+ "${$(w.ADD_ELEMENT,e).name}"`}),DELETE_ELEMENT:(t,e,n)=>({title:t.deleteElementTitle,tone:"delete",body:`\u2212 "${P(n,e.target.id)?.name??e.target.id}"`}),LINK_ELEMENTS:(t,e)=>({title:t.linkTitle,tone:"create",body:`${$(w.LINK_ELEMENTS,e).from} \u2192 ${$(w.LINK_ELEMENTS,e).to}`}),SET_LINK_LABEL:(t,e)=>({title:t.renameLinkTitle,tone:"update",body:`\u2192 "${$(w.SET_LINK_LABEL,e).label}"`}),UNLINK_ELEMENTS:(t,e)=>({title:t.unlinkTitle,tone:"delete",body:`${$(w.UNLINK_ELEMENTS,e).from} \u2192 ${$(w.UNLINK_ELEMENTS,e).to}`}),ADD_CONTEXT:(t,e)=>({title:t.addContextTitle,tone:"create",body:`+ "${$(w.ADD_CONTEXT,e).name}"`}),SET_CONTEXT_NAME:(t,e)=>({title:t.renameContextTitle,tone:"update",body:`\u2192 "${$(w.SET_CONTEXT_NAME,e).name}"`}),DELETE_CONTEXT:(t,e,n)=>({title:t.deleteContextTitle,tone:"delete",body:`\u2212 "${H(n,e.target.id)?.name??e.target.id}"`})},De=(t,e,n,o)=>{const i=Xt[e.type],r=i?i(t,e,o??n):{title:e.type,tone:"meta"};return{title:r.title,targetLabel:Re(t,n,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},Pe=t=>`${t.type} ${V(t.target)} ${JSON.stringify(t.payload)}`,Re=(t,e,n)=>{switch(n.type){case"element":{const o=P(e,n.id);return o?t.elementLabel(o.name):`${t.elementLabel(n.id)} (missing)`}case"context":{const o=H(e,n.id);return o?t.contextLabel(o.name):`${t.contextLabel(n.id)} (missing)`}case"link":{const o=se(e,n.id);return o?t.linkLabel(o.from,o.to):`${t.linkGroup} \xB7 ${n.id} (missing)`}case"page":return t.pageLabel(ae(e));default:return`${n.type} \xB7 ${n.id}`}},Be=(t,e)=>[...e.elements.map(n=>({value:V({type:"element",id:n.id}),label:n.name,group:t.elementGroup})),...e.contexts.map(n=>({value:V({type:"context",id:n.id}),label:n.name,group:t.contextGroup}))],Yt=(t,e,n)=>{const o=e.elements.find(i=>i.id===n.note);return o?{value:V({type:"element",id:o.id}),label:o.name,group:t.elementGroup}:null},ae=t=>t.title??"Event Storming",Xe=(t,e)=>{const n={...e},o=P(t,e.note);e.note!==void 0&&!o&&delete n.note;const i=H(t,e.context);return e.context!==void 0&&!i&&delete n.context,n},Ye=(t,e)=>{switch(e.type){case"element":return P(t,e.id)!==void 0;case"context":return H(t,e.id)!==void 0;case"link":return se(t,e.id)!==void 0;case"page":return!0;default:return!1}},He=t=>{const e=O(t);return{name:"event-storming",label:"Event Storming",parseBase:Se,emptyBase:Ie,actions:w,apply:Le,canonicalState:Bt,hasTarget:Ye,describe:(n,o,i)=>De(e,n,o,i),serialize:Pe,resolveNavigation:Xe,commentTargets:(n,o)=>Be(e,n),currentTarget:(n,o)=>Yt(e,n,o),title:ae}},Ht={width:300,height:260},Kt={event:{bg:"linear-gradient(178deg, #ffbc55, #f8a52e)",ink:"#402703"},command:{bg:"linear-gradient(178deg, #93c9f2, #74b4e8)",ink:"#0e2c4b"},aggregate:{bg:"linear-gradient(178deg, #fff3a6, #fdea7e)",ink:"#4a3a06"},actor:{bg:"linear-gradient(178deg, #ffdf63, #fdd23e)",ink:"#423204"},policy:{bg:"linear-gradient(178deg, #dcc2f7, #c9a6f0)",ink:"#32195c"},readmodel:{bg:"linear-gradient(178deg, #c0e788, #a8dc63)",ink:"#22380a"},external:{bg:"linear-gradient(178deg, #f9bcd3, #f4a0c0)",ink:"#4b1029"},hotspot:{bg:"linear-gradient(178deg, #d63550, #b81c33)",ink:"#ffffff"}},de=t=>{const{bg:e,ink:n}=Kt[t];return`--es-note-bg:${e};--es-note-ink:${n}`},Ft=ve`
1
+ import{a9 as ht,aa as q,ab as ne,ac as oe,av as N,ad as v,at as X,ae as F,af as L,ag as M,q as T,an as S,v as ie,as as xe,P as mt,f as ut,_ as ft,V,R as $,a0 as ve,a5 as gt,k as bt,$ as ke,a6 as xt,a1 as I,ay as vt,a2 as k,A as kt,K as Et,i as yt,aB as wt,a4 as Y,a3 as Ee,aC as $t,T as ye,m as A}from"./shared-BYZoeQ97.js";import{P as we,c as Tt,r as St,p as It,a as Lt}from"./shared-1AA-0t4O.js";import{c as $e}from"./shared-ml5h7U5L.js";function Mt(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}const j=["actor","command","aggregate","event","policy","readmodel","external","hotspot"],Nt=q({id:X,name:L(v(),M(1)),description:N(v())}),_t=q({id:X,type:F(j),name:L(v(),M(1)),description:N(v()),contextId:N(v())}),Ct=q({id:X,from:L(v(),M(1)),to:L(v(),M(1)),label:N(v()),kind:N(F(["member","flow"]))}),Te=q({title:N(v()),contexts:ne(oe(Nt),[]),elements:ne(oe(_t),[]),links:ne(oe(Ct),[])}),Se=t=>{const e=ht(Te,t),n=new Set(e.elements.map(i=>i.id)),o=new Set(e.contexts.map(i=>i.id));for(const i of e.elements)if(i.contextId!==void 0&&!o.has(i.contextId))throw new Error(`unknown context "${i.contextId}" for note "${i.id}"`);for(const i of e.links){if(!n.has(i.from))throw new Error(`unknown note "${i.from}" in link "${i.id}"`);if(!n.has(i.to))throw new Error(`unknown note "${i.to}" in link "${i.id}"`)}return e},Ie=()=>({contexts:[],elements:[],links:[]}),P=(t,e)=>{if(e!==void 0)return t.elements.find(n=>n.id===e)},H=(t,e)=>{if(e!==void 0)return t.contexts.find(n=>n.id===e)},se=(t,e)=>{if(e!==void 0)return t.links.find(n=>n.id===e)},W=t=>t.elements.map(e=>e.id),w={SET_ELEMENT_NAME:T("SET_ELEMENT_NAME","element",S({name:L(v(),M(1))})),SET_ELEMENT_DESCRIPTION:T("SET_ELEMENT_DESCRIPTION","element",S({description:v()})),SET_ELEMENT_TYPE:T("SET_ELEMENT_TYPE","element",S({type:F(j)})),SET_ELEMENT_CONTEXT:T("SET_ELEMENT_CONTEXT","element",S({contextId:xe(v())})),MOVE_ELEMENT:T("MOVE_ELEMENT","element",S({after:xe(v())}),{mode:"sequence"}),ADD_ELEMENT:T("ADD_ELEMENT","page",S({id:X,type:F(j),name:L(v(),M(1)),description:N(v()),contextId:N(v())}),{dedupeKey:ie}),DELETE_ELEMENT:T("DELETE_ELEMENT","element",S({})),LINK_ELEMENTS:T("LINK_ELEMENTS","page",S({id:X,from:L(v(),M(1)),to:L(v(),M(1)),label:N(v()),kind:N(F(["member","flow"]))}),{dedupeKey:ie}),SET_LINK_LABEL:T("SET_LINK_LABEL","link",S({label:v()})),UNLINK_ELEMENTS:T("UNLINK_ELEMENTS","page",S({from:L(v(),M(1)),to:L(v(),M(1))}),{mode:"sequence"}),ADD_CONTEXT:T("ADD_CONTEXT","page",S({id:X,name:L(v(),M(1)),description:N(v())}),{dedupeKey:ie}),SET_CONTEXT_NAME:T("SET_CONTEXT_NAME","context",S({name:L(v(),M(1))})),DELETE_CONTEXT:T("DELETE_CONTEXT","context",S({}))},y={setElementName:(t,e)=>({type:"SET_ELEMENT_NAME",target:{type:"element",id:t},payload:{name:e}}),setElementDescription:(t,e)=>({type:"SET_ELEMENT_DESCRIPTION",target:{type:"element",id:t},payload:{description:e}}),setElementType:(t,e)=>({type:"SET_ELEMENT_TYPE",target:{type:"element",id:t},payload:{type:e}}),setElementContext:(t,e)=>({type:"SET_ELEMENT_CONTEXT",target:{type:"element",id:t},payload:{contextId:e}}),moveElement:(t,e)=>({type:"MOVE_ELEMENT",target:{type:"element",id:t},payload:{after:e}}),addElement:(t,e,n)=>({type:"ADD_ELEMENT",target:{type:"page",id:"event-storming"},payload:{id:t,type:e,name:n}}),deleteElement:t=>({type:"DELETE_ELEMENT",target:{type:"element",id:t},payload:{}}),linkElements:(t,e,n,o)=>({type:"LINK_ELEMENTS",target:{type:"page",id:"event-storming"},payload:{id:t,from:e,to:n,...o?.label===void 0?{}:{label:o.label},...o?.kind===void 0?{}:{kind:o.kind}}}),setLinkLabel:(t,e)=>({type:"SET_LINK_LABEL",target:{type:"link",id:t},payload:{label:e}}),unlinkElements:(t,e)=>({type:"UNLINK_ELEMENTS",target:{type:"page",id:"event-storming"},payload:{from:t,to:e}}),addContext:(t,e)=>({type:"ADD_CONTEXT",target:{type:"page",id:"event-storming"},payload:{id:t,name:e}}),setContextName:(t,e)=>({type:"SET_CONTEXT_NAME",target:{type:"context",id:t},payload:{name:e}}),deleteContext:t=>({type:"DELETE_CONTEXT",target:{type:"context",id:t},payload:{}})},Le=(t,e)=>{const n=mt(w,e);if(n===null)return null;const o=n.target.id;switch(n.type){case"SET_ELEMENT_NAME":return Z(t,o,i=>({...i,name:n.payload.name}));case"SET_ELEMENT_DESCRIPTION":return Z(t,o,i=>({...i,description:n.payload.description}));case"SET_ELEMENT_TYPE":return Z(t,o,i=>({...i,type:n.payload.type}));case"SET_ELEMENT_CONTEXT":{const{contextId:i}=n.payload;return i!==null&&!t.contexts.some(s=>s.id===i)?null:Z(t,o,s=>i===null?Me(s):{...s,contextId:i})}case"MOVE_ELEMENT":{const{after:i}=n.payload,s=Ot(t.elements,o,i);return s===null?null:{...t,elements:s}}case"ADD_ELEMENT":{const i=n.payload;if(t.elements.some(r=>r.id===i.id))return t;if(i.contextId!==void 0&&!t.contexts.some(r=>r.id===i.contextId))return null;const s={id:i.id,type:i.type,name:i.name,...i.description===void 0?{}:{description:i.description},...i.contextId===void 0?{}:{contextId:i.contextId}};return{...t,elements:[...t.elements,s]}}case"DELETE_ELEMENT":return t.elements.some(i=>i.id===o)?{...t,elements:t.elements.filter(i=>i.id!==o),links:t.links.filter(i=>i.from!==o&&i.to!==o)}:null;case"LINK_ELEMENTS":{const i=n.payload;return t.links.some(s=>s.id===i.id)?t:!t.elements.some(s=>s.id===i.from)||!t.elements.some(s=>s.id===i.to)?null:{...t,links:[...t.links,{id:i.id,from:i.from,to:i.to,...i.label===void 0?{}:{label:i.label},...i.kind===void 0?{}:{kind:i.kind}}]}}case"SET_LINK_LABEL":return t.links.some(i=>i.id===o)?{...t,links:t.links.map(i=>i.id===o?{...i,label:n.payload.label}:i)}:null;case"UNLINK_ELEMENTS":{const i=n.payload;return t.links.some(s=>s.from===i.from&&s.to===i.to)?{...t,links:t.links.filter(s=>!(s.from===i.from&&s.to===i.to))}:null}case"ADD_CONTEXT":{const i=n.payload;if(t.contexts.some(r=>r.id===i.id))return t;const s={id:i.id,name:i.name,...i.description===void 0?{}:{description:i.description}};return{...t,contexts:[...t.contexts,s]}}case"SET_CONTEXT_NAME":return t.contexts.some(i=>i.id===o)?{...t,contexts:t.contexts.map(i=>i.id===o?{...i,name:n.payload.name}:i)}:null;case"DELETE_CONTEXT":return t.contexts.some(i=>i.id===o)?{...t,contexts:t.contexts.filter(i=>i.id!==o),elements:t.elements.map(i=>i.contextId===o?Me(i):i)}:null;default:return ut(n)}},Me=t=>{const e={...t};return delete e.contextId,e},Z=(t,e,n)=>t.elements.some(o=>o.id===e)?{...t,elements:t.elements.map(o=>o.id===e?n(o):o)}:null,Ot=(t,e,n)=>{const o=t.findIndex(a=>a.id===e);if(o<0||n!==null&&!t.some(a=>a.id===n))return null;const i=t[o];if(i===void 0)return null;const r=[...t.filter(a=>a.id!==e)];return r.splice(n===null?0:r.findIndex(a=>a.id===n)+1,0,i),r},At=new Set(["actor>command","command>aggregate","aggregate>event","command>event","policy>command","external>event"]),J=(t,e)=>At.has(`${t}>${e}`),zt=(t,e,n)=>t.kind!==void 0?t.kind==="member":J(e,n),Dt=["readmodel","actor","policy","command","aggregate","external","event","hotspot"],Pt=(t,e)=>{const n=new Map;for(const o of t.links){const i=e.get(o.from),s=e.get(o.to);if(i===void 0||s===void 0||i==="hotspot"==(s==="hotspot")||o.kind!==void 0&&o.kind!=="member")continue;const r=i==="hotspot"?o.from:o.to;n.has(r)||n.set(r,i==="hotspot"?o.to:o.from)}return n},Rt=(t,e,n)=>{const o=new Map(t.map(a=>[a.id,a.id])),i=a=>{let d=a;for(;o.get(d)!==d;)d=o.get(d)??d;let l=a;for(;l!==d;){const p=o.get(l)??d;o.set(l,d),l=p}return d};for(const a of e){if(!o.has(a.from)||!o.has(a.to))continue;const d=n.get(a.from),l=n.get(a.to);d===void 0||l===void 0||zt(a,d,l)&&o.set(i(a.from),i(a.to))}const s=new Map,r=new Map;for(const a of t){const d=i(a.id);r.set(a.id,d);const l=s.get(d);l?l.push(a):s.set(d,[a])}return{groups:s,rootOf:r}},R=t=>{const e=new Map(t.elements.map(l=>[l.id,l.type])),n=Pt(t,e),o=t.elements.filter(l=>!n.has(l.id)),{groups:i,rootOf:s}=Rt(o,t.links,e),r=new Map;for(const[l,p]of n){const m=P(t,l),f=s.get(p);if(m===void 0||f===void 0)continue;const g=r.get(f);g?g.push({note:m,targetId:p}):r.set(f,[{note:m,targetId:p}])}const a=new Map(Dt.map((l,p)=>[l,p])),d=new Map(t.elements.map((l,p)=>[l.id,p]));return[...i].map(([l,p])=>{const m=[...p].sort((f,g)=>(a.get(f.type)??0)-(a.get(g.type)??0)||(d.get(f.id)??0)-(d.get(g.id)??0));return{id:p[0]?.id??"",notes:m,pins:r.get(l)??[],contextId:p.find(f=>f.contextId!==void 0)?.contextId}})},Bt=t=>{const e=R(t).flatMap(o=>[...o.notes,...o.pins.map(i=>i.note)]),n=new Set(e.map(o=>o.id));return{...t,elements:[...e,...t.elements.filter(o=>!n.has(o.id))]}},Ne=(t,e)=>{const n=[...t.notes,...t.pins.map(r=>r.note)],o=n.find(r=>J(e,r.type));if(o!==void 0)return{anchorId:o.id,incoming:!0};const i=n.find(r=>J(r.type,e));if(i!==void 0)return{anchorId:i.id,incoming:!1};const s=n[0];return s===void 0?void 0:{anchorId:s.id,incoming:!0}},_e=(t,e)=>{const n=new Map(e.flatMap(o=>o.notes.map(i=>[i.id,o.id])));return t.links.flatMap(o=>{const i=n.get(o.from),s=n.get(o.to);return i===void 0||s===void 0||i===s?[]:[{id:o.id,from:i,to:s,...o.label!==void 0?{label:o.label}:{}}]})},re=(t,e)=>`${t}\0${e}`,Ce=(t,e,n)=>{const{widthOf:o,gapX:i,padX:s,maxWidth:r}=n,a=new Map;for(const c of e)a.set(re(c.from,c.to),c),a.set(re(c.to,c.from),c);const d=(c,h)=>c===void 0||h===void 0?void 0:a.get(re(c,h)),l=c=>Mt(c,h=>o(h))+i*Math.max(0,c.length-1)+s*2<=r,p=[];let m=[],f;const g=()=>{m.length!==0&&(p.push({sliceIds:m,...f===void 0?{}:{cutFrom:f}}),m=[],f=void 0)};for(const c of t.map(h=>h.id)){if(m.length>0&&!l([...m,c])){let h=m.length;for(;d(m[h-1],h===m.length?c:m[h])!==void 0&&(h-=1,h!==0););const b=h===0?[]:m.splice(h),x=h===0?d(m.at(-1),c):d(m.at(-1),b[0]);g(),m=b,f=x}m.push(c)}return g(),p},G=t=>[...t.notes].reverse().find(e=>e.type==="event")??t.notes.at(-1),Oe=(t,e)=>{const n=G(t),o=e.notes[0];if(!(n===void 0||o===void 0))return{from:n.id,to:o.id}},Ae={actor:"Actor",command:"Command",aggregate:"Aggregate",event:"Domain Event",policy:"Policy",readmodel:"Read Model",external:"External System",hotspot:"Hotspot"},ze={actor:"\u30A2\u30AF\u30BF\u30FC",command:"\u30B3\u30DE\u30F3\u30C9",aggregate:"\u96C6\u7D04",event:"\u30A4\u30D9\u30F3\u30C8",policy:"\u30DD\u30EA\u30B7\u30FC",readmodel:"\u30EA\u30FC\u30C9\u30E2\u30C7\u30EB",external:"\u5916\u90E8\u30B7\u30B9\u30C6\u30E0",hotspot:"\u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8"},O=ft({en:{renameElementTitle:"Rename element",updateDescriptionTitle:"Update element description",changeTypeTitle:"Change element type",changeContextTitle:"Change the element\u2019s context",moveTitle:"Change timeline position",addElementTitle:"Add element",deleteElementTitle:"Delete element",linkTitle:"Link elements",renameLinkTitle:"Change link label",unlinkTitle:"Remove link",addContextTitle:"Add bounded context",renameContextTitle:"Rename bounded context",deleteContextTitle:"Delete bounded context",renamed:(t,e)=>`"${t}" \u2192 "${e}"`,noContext:"No context",moveToFront:"\u2192 To the front",moveAfter:t=>`\u2192 Right after "${t}"`,elementLabel:t=>`Element \xB7 ${t}`,contextLabel:t=>`Bounded context \xB7 ${t}`,linkLabel:(t,e)=>`Link \xB7 ${t}\u2192${e}`,linkGroup:"Link",pageLabel:t=>`Page \xB7 ${t}`,elementGroup:"Element",contextGroup:"Bounded context",noteTypeLabel:t=>Ae[t],addTypeLabel:t=>`+ ${Ae[t]}`,addHotspot:"+ Hotspot",pinHotspotTitle:"Pin a hotspot on this note",deleteNote:"Delete",noteNameLabel:"Note name",newContextTitle:"New bounded context",contextNamePlaceholder:"Context name",cancel:"Cancel",create:"Create",save:"Save",appendMenuNext:"Note to add next",appendMenuAfter:t=>`Continue after \u201C${t}\u201D`,emptyTitle:"No notes yet",emptyBody:"Start Event Storming by placing domain events on the timeline.",addFirstEvent:"+ First event",portAriaLabel:"Add what comes next (pick a type, or drag to connect to another slice)",portTitle:"Click: pick a note to continue / Drag: connect to another slice",renameContextHint:"Click to rename",dissolveContextAria:t=>`Dissolve bounded context "${t}"`,dissolveContextTitle:"Dissolve the bounded context (notes stay)",noteCount:t=>`${t} notes`,sliceCount:t=>`${t} slices`,contextCount:t=>`${t} bounded contexts`,hudHint:"Wheel: pan \xB7 Pinch: zoom \xB7 Drag background: select area",zoomOut:"Zoom out",zoomReset:"Reset to 100%",zoomIn:"Zoom in",zoomFit:"Fit to view",selectedLinks:t=>`${t} links selected`,deleteLinks:"Delete links",deleteHint:"Delete works too",clearSelection:"Clear selection",selectedSlices:t=>`${t} slices selected`,groupIntoContext:"Group into a bounded context",addToExistingAria:"Add to an existing bounded context",addToExistingOption:"Add to existing\u2026",removeFromContext:"Remove from context",deleteButton:"Delete"},ja:{renameElementTitle:"\u8981\u7D20\u540D\u3092\u5909\u66F4",updateDescriptionTitle:"\u8981\u7D20\u306E\u8AAC\u660E\u3092\u66F4\u65B0",changeTypeTitle:"\u8981\u7D20\u306E\u7A2E\u5225\u3092\u5909\u66F4",changeContextTitle:"\u6240\u5C5E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u5909\u66F4",moveTitle:"\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u4F4D\u7F6E\u3092\u5909\u66F4",addElementTitle:"\u8981\u7D20\u3092\u8FFD\u52A0",deleteElementTitle:"\u8981\u7D20\u3092\u524A\u9664",linkTitle:"\u8981\u7D20\u3092\u9023\u7D50",renameLinkTitle:"\u30EA\u30F3\u30AF\u540D\u3092\u5909\u66F4",unlinkTitle:"\u30EA\u30F3\u30AF\u3092\u524A\u9664",addContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u8FFD\u52A0",renameContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u540D\u3092\u5909\u66F4",deleteContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u524A\u9664",renamed:(t,e)=>`"${t}" \u2192 "${e}"`,noContext:"\u672A\u6240\u5C5E",moveToFront:"\u2192 \u5148\u982D\u3078",moveAfter:t=>`\u2192 "${t}" \u306E\u76F4\u5F8C\u3078`,elementLabel:t=>`\u8981\u7D20 \xB7 ${t}`,contextLabel:t=>`\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8 \xB7 ${t}`,linkLabel:(t,e)=>`\u30EA\u30F3\u30AF \xB7 ${t}\u2192${e}`,linkGroup:"\u30EA\u30F3\u30AF",pageLabel:t=>`\u30DA\u30FC\u30B8 \xB7 ${t}`,elementGroup:"\u8981\u7D20",contextGroup:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",noteTypeLabel:t=>ze[t],addTypeLabel:t=>`+ ${ze[t]}`,addHotspot:"+ \u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8",pinHotspotTitle:"\u3053\u306E\u4ED8\u7B8B\u306B\u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8\u3092\u7ACB\u3066\u308B",deleteNote:"\u524A\u9664",noteNameLabel:"\u4ED8\u7B8B\u540D",newContextTitle:"\u65B0\u3057\u3044\u5883\u754C\u3065\u3051\u3089\u308C\u305F\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",contextNamePlaceholder:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u540D",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",create:"\u4F5C\u6210",save:"\u4FDD\u5B58",appendMenuNext:"\u7D9A\u304D\u306B\u8FFD\u52A0\u3059\u308B\u4ED8\u7B8B",appendMenuAfter:t=>`\u300C${t}\u300D\u306E\u7D9A\u304D\u306B\u8FFD\u52A0`,emptyTitle:"\u4ED8\u7B8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",emptyBody:"\u30A4\u30D9\u30F3\u30C8\u30B9\u30C8\u30FC\u30DF\u30F3\u30B0\u3092\u958B\u59CB\u3057\u307E\u3057\u3087\u3046\u3002\u30C9\u30E1\u30A4\u30F3\u30A4\u30D9\u30F3\u30C8\u3092\u6642\u7CFB\u5217\u306B\u8CBC\u308B\u3068\u3053\u308D\u304B\u3089\u59CB\u3081\u307E\u3059\u3002",addFirstEvent:"+ \u6700\u521D\u306E\u30A4\u30D9\u30F3\u30C8",portAriaLabel:"\u7D9A\u304D\u3092\u8FFD\u52A0\uFF08\u7A2E\u985E\u3092\u9078\u3093\u3067\u8FFD\u52A0 / \u30C9\u30E9\u30C3\u30B0\u3067\u4ED6\u306E\u30B9\u30E9\u30A4\u30B9\u3078\u63A5\u7D9A\uFF09",portTitle:"\u30AF\u30EA\u30C3\u30AF: \u7D9A\u304D\u306E\u4ED8\u7B8B\u3092\u9078\u3093\u3067\u8FFD\u52A0 / \u30C9\u30E9\u30C3\u30B0: \u4ED6\u306E\u30B9\u30E9\u30A4\u30B9\u3078\u63A5\u7D9A",renameContextHint:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u540D\u524D\u3092\u5909\u66F4",dissolveContextAria:t=>`\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u300C${t}\u300D\u3092\u89E3\u4F53`,dissolveContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u89E3\u4F53\uFF08\u4ED8\u7B8B\u306F\u6B8B\u308A\u307E\u3059\uFF09",noteCount:t=>`${t} \u4ED8\u7B8B`,sliceCount:t=>`${t} \u30B9\u30E9\u30A4\u30B9`,contextCount:t=>`${t} \u30B3\u30F3\u30C6\u30AD\u30B9\u30C8`,hudHint:"\u30DB\u30A4\u30FC\u30EB: \u79FB\u52D5 \xB7 \u30D4\u30F3\u30C1: \u30BA\u30FC\u30E0 \xB7 \u80CC\u666F\u30C9\u30E9\u30C3\u30B0: \u7BC4\u56F2\u9078\u629E",zoomOut:"\u7E2E\u5C0F",zoomReset:"100% \u306B\u623B\u3059",zoomIn:"\u62E1\u5927",zoomFit:"\u5168\u4F53\u3092\u8868\u793A",selectedLinks:t=>`${t} \u672C\u306E\u30EA\u30F3\u30AF\u3092\u9078\u629E\u4E2D`,deleteLinks:"\u30EA\u30F3\u30AF\u3092\u524A\u9664",deleteHint:"Delete \u3067\u3082\u524A\u9664\u3067\u304D\u307E\u3059",clearSelection:"\u9078\u629E\u89E3\u9664",selectedSlices:t=>`${t} \u30B9\u30E9\u30A4\u30B9\u3092\u9078\u629E\u4E2D`,groupIntoContext:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u306B\u307E\u3068\u3081\u308B",addToExistingAria:"\u65E2\u5B58\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3078\u8FFD\u52A0",addToExistingOption:"\u65E2\u5B58\u3078\u8FFD\u52A0\u2026",removeFromContext:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u89E3\u9664",deleteButton:"\u524A\u9664"}}),Xt={SET_ELEMENT_NAME:(t,e,n)=>({title:t.renameElementTitle,tone:"update",body:t.renamed(P(n,e.target.id)?.name??"?",$(w.SET_ELEMENT_NAME,e).name)}),SET_ELEMENT_DESCRIPTION:(t,e)=>({title:t.updateDescriptionTitle,tone:"update",body:`\u2192 "${$(w.SET_ELEMENT_DESCRIPTION,e).description.slice(0,60)}"`}),SET_ELEMENT_TYPE:(t,e)=>({title:t.changeTypeTitle,tone:"update",body:`\u2192 ${$(w.SET_ELEMENT_TYPE,e).type}`}),SET_ELEMENT_CONTEXT:(t,e)=>({title:t.changeContextTitle,tone:"move",body:`\u2192 ${$(w.SET_ELEMENT_CONTEXT,e).contextId??t.noContext}`}),MOVE_ELEMENT:(t,e)=>({title:t.moveTitle,tone:"move",body:$(w.MOVE_ELEMENT,e).after===null?t.moveToFront:t.moveAfter($(w.MOVE_ELEMENT,e).after??"")}),ADD_ELEMENT:(t,e)=>({title:t.addElementTitle,tone:"create",body:`+ "${$(w.ADD_ELEMENT,e).name}"`}),DELETE_ELEMENT:(t,e,n)=>({title:t.deleteElementTitle,tone:"delete",body:`\u2212 "${P(n,e.target.id)?.name??e.target.id}"`}),LINK_ELEMENTS:(t,e)=>({title:t.linkTitle,tone:"create",body:`${$(w.LINK_ELEMENTS,e).from} \u2192 ${$(w.LINK_ELEMENTS,e).to}`}),SET_LINK_LABEL:(t,e)=>({title:t.renameLinkTitle,tone:"update",body:`\u2192 "${$(w.SET_LINK_LABEL,e).label}"`}),UNLINK_ELEMENTS:(t,e)=>({title:t.unlinkTitle,tone:"delete",body:`${$(w.UNLINK_ELEMENTS,e).from} \u2192 ${$(w.UNLINK_ELEMENTS,e).to}`}),ADD_CONTEXT:(t,e)=>({title:t.addContextTitle,tone:"create",body:`+ "${$(w.ADD_CONTEXT,e).name}"`}),SET_CONTEXT_NAME:(t,e)=>({title:t.renameContextTitle,tone:"update",body:`\u2192 "${$(w.SET_CONTEXT_NAME,e).name}"`}),DELETE_CONTEXT:(t,e,n)=>({title:t.deleteContextTitle,tone:"delete",body:`\u2212 "${H(n,e.target.id)?.name??e.target.id}"`})},De=(t,e,n,o)=>{const i=Xt[e.type],r=i?i(t,e,o??n):{title:e.type,tone:"meta"};return{title:r.title,targetLabel:Re(t,n,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},Pe=t=>`${t.type} ${V(t.target)} ${JSON.stringify(t.payload)}`,Re=(t,e,n)=>{switch(n.type){case"element":{const o=P(e,n.id);return o?t.elementLabel(o.name):`${t.elementLabel(n.id)} (missing)`}case"context":{const o=H(e,n.id);return o?t.contextLabel(o.name):`${t.contextLabel(n.id)} (missing)`}case"link":{const o=se(e,n.id);return o?t.linkLabel(o.from,o.to):`${t.linkGroup} \xB7 ${n.id} (missing)`}case"page":return t.pageLabel(ae(e));default:return`${n.type} \xB7 ${n.id}`}},Be=(t,e)=>[...e.elements.map(n=>({value:V({type:"element",id:n.id}),label:n.name,group:t.elementGroup})),...e.contexts.map(n=>({value:V({type:"context",id:n.id}),label:n.name,group:t.contextGroup}))],Yt=(t,e,n)=>{const o=e.elements.find(i=>i.id===n.note);return o?{value:V({type:"element",id:o.id}),label:o.name,group:t.elementGroup}:null},ae=t=>t.title??"Event Storming",Xe=(t,e)=>{const n={...e},o=P(t,e.note);e.note!==void 0&&!o&&delete n.note;const i=H(t,e.context);return e.context!==void 0&&!i&&delete n.context,n},Ye=(t,e)=>{switch(e.type){case"element":return P(t,e.id)!==void 0;case"context":return H(t,e.id)!==void 0;case"link":return se(t,e.id)!==void 0;case"page":return!0;default:return!1}},He=t=>{const e=O(t);return{name:"event-storming",label:"Event Storming",parseBase:Se,emptyBase:Ie,actions:w,apply:Le,canonicalState:Bt,hasTarget:Ye,describe:(n,o,i)=>De(e,n,o,i),serialize:Pe,resolveNavigation:Xe,commentTargets:(n,o)=>Be(e,n),currentTarget:(n,o)=>Yt(e,n,o),title:ae}},Ht={width:300,height:260},Kt={event:{bg:"linear-gradient(178deg, #ffbc55, #f8a52e)",ink:"#402703"},command:{bg:"linear-gradient(178deg, #93c9f2, #74b4e8)",ink:"#0e2c4b"},aggregate:{bg:"linear-gradient(178deg, #fff3a6, #fdea7e)",ink:"#4a3a06"},actor:{bg:"linear-gradient(178deg, #ffdf63, #fdd23e)",ink:"#423204"},policy:{bg:"linear-gradient(178deg, #dcc2f7, #c9a6f0)",ink:"#32195c"},readmodel:{bg:"linear-gradient(178deg, #c0e788, #a8dc63)",ink:"#22380a"},external:{bg:"linear-gradient(178deg, #f9bcd3, #f4a0c0)",ink:"#4b1029"},hotspot:{bg:"linear-gradient(178deg, #d63550, #b81c33)",ink:"#ffffff"}},de=t=>{const{bg:e,ink:n}=Kt[t];return`--es-note-bg:${e};--es-note-ink:${n}`},Ft=ve`
2
2
  :host {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{_ as H,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5 as Ne,a6 as He,A as Be,a7 as fs,a8 as bs,a9 as _,aa as q,ab as f,ac as z,ad as m,ae as Y,af as $,ag as M,ah as se,ai as _e,aj as Ye,ak as J,al as ye,am as we,an as $e,ao as ks,ap as Se,m as Ve,aq as vs,ar as xs,as as ys,at as ae,au as ws,r as $s,s as Ss}from"./shared-Bfq73Ivq.js";import{i as We}from"./shared-neoJW11Z.js";import{P as Ge,p as Ke,r as Xe,c as Je}from"./shared-Dmq2K4Cr.js";import{c as me}from"./shared-ml5h7U5L.js";const Ms='script[type="application/json"]',Ze=(a,e)=>{const t=a.querySelector(Ms);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}},Qe=(a,e,t)=>{const s=Ze(a,e);if(s)return t(s),()=>{};const r=new MutationObserver(()=>{const n=Ze(a,e);n&&(r.disconnect(),t(n))});return r.observe(a,{childList:!0,subtree:!0}),()=>r.disconnect()},et={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,r)=>s-r);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},Cs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,r=new Set,n=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?r.add(o.id):d==="new"&&n(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&n(i.id);return{reversed:r,forward:e.filter(i=>!r.has(i.id))}},qs=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const r=new Map(a.map(o=>[o.id,0])),n=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(n.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=r.get(d.to)??0;r.set(d.to,Math.max(l,(r.get(o)??0)+1));const c=(n.get(d.to)??0)-1;n.set(d.to,c),c===0&&i.push(d.to)}return r},Es=(a,e,t,s)=>{const r=[...a.keys()].sort((n,i)=>n-i);for(let n=0;n<s;n++){const i=n%2===0;for(const o of i?r:[...r].reverse()){const d=a.get(o)??[],l=new Map(d.map((h,u)=>[h,u])),c=h=>{const u=l.get(h);return u===void 0?null:u},b=d.map(h=>{const u=(e.get(h)??[]).filter(S=>(t.get(S)??o)===o+(i?-1:1)).map(c).filter(S=>S!==null);return{id:h,want:u.length>0?ge(u):l.get(h)??0}});b.sort((h,u)=>h.want-u.want||(l.get(h.id)??0)-(l.get(u.id)??0)),a.set(o,b.map(h=>h.id))}}},tt=(a,e,t,s)=>{const r=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));r.sort((i,o)=>i.want-o.want||i.index-o.index);let n=0;for(const i of r){const o=e.get(i.id);o&&(o.y=n,n+=o.spec.height+s)}return{height:Math.max(0,n-s)}},zs=(a,e,t,s,r)=>{const n=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of n)i.set(l,tt(a.get(l)??[],e,new Map,r.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of n){const c=(o-(i.get(l)??0))/2;for(const b of a.get(l)??[]){const h=e.get(b);h&&(h.y+=c)}}const d=(l,c)=>{const b=(t.get(l)??[]).filter(h=>s.get(h)===c).flatMap(h=>{const u=e.get(h);return u?[u.y+u.spec.height/2]:[]});return b.length>0?ge(b):null};for(let l=0;l<r.coordinatePasses;l++){const c=l%2===0;for(const b of c?n:[...n].reverse()){const h=a.get(b)??[],u=new Map;for(const C of h){const D=d(C,b+(c?-1:1)),T=e.get(C);T!==void 0&&u.set(C,D===null?T.y+T.spec.height/2:D)}const S=h.map(C=>e.get(C)?.y??0);tt(h,e,u,r.nodeSpacing);const x=h.map(C=>e.get(C)?.y??0),v=ge(S)-ge(x);for(const C of h){const D=e.get(C);D&&(D.y+=v)}}}},st=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},at=(a,e,t)=>{let s=0;const r=[];for(const n of a){const i=t.byId.get(n.from),o=t.byId.get(n.to);if(!i||!o)continue;const d=st(i,n.fromPort,"out"),l=st(o,n.toPort,"in");if(n.from===n.to){const S=i.x+i.spec.width,x=i.y+i.spec.height,v=Math.max(t.padding/2,x+18);r.push({id:n.id,points:[d,{x:S+20,y:d.y},{x:S+20,y:v},{x:i.x-20,y:v},{x:i.x-20,y:l.y},l]});continue}if(!e.has(n.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){r.push({id:n.id,points:[d,l]});continue}const x=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;r.push({id:n.id,points:[d,{x,y:d.y},{x,y:l.y},l]});continue}const c=n.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,b=n.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,h=Math.max(c.y,b.y)+18+s*14;s+=1;const u=[d,c,{x:c.x,y:h},{x:b.x,y:h},b,l].filter((S,x,v)=>x===0||S.x!==v[x-1]?.x||S.y!==v[x-1]?.y);r.push({id:n.id,points:u})}return r},rt=(a,e,t)=>{const s=e.flatMap(h=>[...h.points]),r=[...a.map(h=>h.x),...a.map(h=>h.x+h.spec.width),...s.map(h=>h.x)],n=[...a.map(h=>h.y),...a.map(h=>h.y+h.spec.height),...s.map(h=>h.y)],i=Math.min(0,...r),o=Math.min(0,...n),d=Math.max(0,...r),l=Math.max(0,...n),c=t-i,b=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(h=>({id:h.spec.id,x:h.x+c,y:h.y+b,width:h.spec.width,height:h.spec.height,layer:h.layer,order:h.order})),routes:e.map(h=>({id:h.id,points:h.points.map(u=>({x:u.x+c,y:u.y+b}))}))}},nt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},it=(a,e,t,s)=>a.map(r=>({spec:r,layer:e.get(r.id)??0,order:t.get(r.id)??0,...s(r)})),Ds=(a,e)=>{const t=new Map;for(const s of a){const r=e.get(s.id)??0,n=t.get(r);n?n.push(s.id):t.set(r,[s.id])}return t},Ts=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const r=new Set(a.map(x=>x.id)),n=e.filter(x=>r.has(x.from)&&r.has(x.to)),{forward:i,reversed:o}=Cs(a,n),d=qs(a,i),l=Ds(a,d);Es(l,nt(a,n),d,s.sweeps);const c=new Map;for(const x of l.values())x.forEach((v,C)=>c.set(v,C));const b=it(a,d,c,()=>({x:0,y:0})),h=new Map(b.map(x=>[x.spec.id,x]));zs(l,h,nt(a,n),d,s);const u=[...l.keys()].sort((x,v)=>x-v);let S=0;for(const x of u){const v=Math.max(...(l.get(x)??[]).map(C=>h.get(C)?.spec.width??0));for(const C of l.get(x)??[]){const D=h.get(C);D&&(D.x=S)}S+=v+s.layerSpacing}return rt(b,at(n,o,{byId:h,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},As=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const r=new Set(a.map(d=>d.id)),n=e.filter(d=>r.has(d.from)&&r.has(d.to)),i=it(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return rt(i,at(n,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ls=H({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Rs={active:[],match:"single"},Z=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Os=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Is=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Ps=a=>({...a,active:[]}),js=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},V={nodes:new Map,edges:new Set},U=(a,e,t,s)=>{const r=new Map,n=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,b=t==="outgoing"?l.to:l.from;c===d.id&&(n.add(l.id),!o.has(b)&&(o.add(b),r.set(b,d.depth+1),i.push({id:b,depth:d.depth+1})))}return{nodes:r,edges:n}},Fs=(a,e)=>{const t=new Map(a.map(n=>[n,U(e,n,"outgoing",!0).nodes])),s=new Set,r=[];for(const n of a){if(s.has(n))continue;const i=a.filter(o=>o===n||t.get(n)?.has(o)===!0&&t.get(o)?.has(n)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===n&&o.to===n))&&r.push(i)}return r},Me=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ot=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),dt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},lt=(a,e,t,s)=>{const r=e!==null&&e.kind===t&&e.id===a,n=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:r,related:n&&!r,dimmed:e!==null&&!r&&!n,depth:i}},Q=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),Us=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const n=a[1]??e,i=a[2]??t;return{x:n.x,y:(n.y+i.y)/2}}const s=a[2]??e,r=a[3]??t;return{x:(s.x+r.x)/2,y:s.y}},Ns=(a,e)=>js(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),Hs=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[je,Fe,Ue,B`
1
+ import{_ as H,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5 as Ne,a6 as He,A as Be,a7 as fs,a8 as bs,a9 as _,aa as q,ab as f,ac as z,ad as m,ae as Y,af as $,ag as M,ah as se,ai as _e,aj as Ye,ak as J,al as ye,am as we,an as $e,ao as ks,ap as Se,m as Ve,aq as vs,ar as xs,as as ys,at as ae,au as ws,r as $s,s as Ss}from"./shared-BYZoeQ97.js";import{i as We}from"./shared-DNk3phV5.js";import{P as Ge,p as Ke,r as Xe,c as Je}from"./shared-1AA-0t4O.js";import{c as me}from"./shared-ml5h7U5L.js";const Ms='script[type="application/json"]',Ze=(a,e)=>{const t=a.querySelector(Ms);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}},Qe=(a,e,t)=>{const s=Ze(a,e);if(s)return t(s),()=>{};const r=new MutationObserver(()=>{const n=Ze(a,e);n&&(r.disconnect(),t(n))});return r.observe(a,{childList:!0,subtree:!0}),()=>r.disconnect()},et={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,r)=>s-r);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},Cs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,r=new Set,n=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?r.add(o.id):d==="new"&&n(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&n(i.id);return{reversed:r,forward:e.filter(i=>!r.has(i.id))}},qs=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const r=new Map(a.map(o=>[o.id,0])),n=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(n.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=r.get(d.to)??0;r.set(d.to,Math.max(l,(r.get(o)??0)+1));const c=(n.get(d.to)??0)-1;n.set(d.to,c),c===0&&i.push(d.to)}return r},Es=(a,e,t,s)=>{const r=[...a.keys()].sort((n,i)=>n-i);for(let n=0;n<s;n++){const i=n%2===0;for(const o of i?r:[...r].reverse()){const d=a.get(o)??[],l=new Map(d.map((h,u)=>[h,u])),c=h=>{const u=l.get(h);return u===void 0?null:u},b=d.map(h=>{const u=(e.get(h)??[]).filter(S=>(t.get(S)??o)===o+(i?-1:1)).map(c).filter(S=>S!==null);return{id:h,want:u.length>0?ge(u):l.get(h)??0}});b.sort((h,u)=>h.want-u.want||(l.get(h.id)??0)-(l.get(u.id)??0)),a.set(o,b.map(h=>h.id))}}},tt=(a,e,t,s)=>{const r=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));r.sort((i,o)=>i.want-o.want||i.index-o.index);let n=0;for(const i of r){const o=e.get(i.id);o&&(o.y=n,n+=o.spec.height+s)}return{height:Math.max(0,n-s)}},zs=(a,e,t,s,r)=>{const n=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of n)i.set(l,tt(a.get(l)??[],e,new Map,r.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of n){const c=(o-(i.get(l)??0))/2;for(const b of a.get(l)??[]){const h=e.get(b);h&&(h.y+=c)}}const d=(l,c)=>{const b=(t.get(l)??[]).filter(h=>s.get(h)===c).flatMap(h=>{const u=e.get(h);return u?[u.y+u.spec.height/2]:[]});return b.length>0?ge(b):null};for(let l=0;l<r.coordinatePasses;l++){const c=l%2===0;for(const b of c?n:[...n].reverse()){const h=a.get(b)??[],u=new Map;for(const C of h){const D=d(C,b+(c?-1:1)),T=e.get(C);T!==void 0&&u.set(C,D===null?T.y+T.spec.height/2:D)}const S=h.map(C=>e.get(C)?.y??0);tt(h,e,u,r.nodeSpacing);const x=h.map(C=>e.get(C)?.y??0),v=ge(S)-ge(x);for(const C of h){const D=e.get(C);D&&(D.y+=v)}}}},st=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},at=(a,e,t)=>{let s=0;const r=[];for(const n of a){const i=t.byId.get(n.from),o=t.byId.get(n.to);if(!i||!o)continue;const d=st(i,n.fromPort,"out"),l=st(o,n.toPort,"in");if(n.from===n.to){const S=i.x+i.spec.width,x=i.y+i.spec.height,v=Math.max(t.padding/2,x+18);r.push({id:n.id,points:[d,{x:S+20,y:d.y},{x:S+20,y:v},{x:i.x-20,y:v},{x:i.x-20,y:l.y},l]});continue}if(!e.has(n.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){r.push({id:n.id,points:[d,l]});continue}const x=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;r.push({id:n.id,points:[d,{x,y:d.y},{x,y:l.y},l]});continue}const c=n.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,b=n.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,h=Math.max(c.y,b.y)+18+s*14;s+=1;const u=[d,c,{x:c.x,y:h},{x:b.x,y:h},b,l].filter((S,x,v)=>x===0||S.x!==v[x-1]?.x||S.y!==v[x-1]?.y);r.push({id:n.id,points:u})}return r},rt=(a,e,t)=>{const s=e.flatMap(h=>[...h.points]),r=[...a.map(h=>h.x),...a.map(h=>h.x+h.spec.width),...s.map(h=>h.x)],n=[...a.map(h=>h.y),...a.map(h=>h.y+h.spec.height),...s.map(h=>h.y)],i=Math.min(0,...r),o=Math.min(0,...n),d=Math.max(0,...r),l=Math.max(0,...n),c=t-i,b=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(h=>({id:h.spec.id,x:h.x+c,y:h.y+b,width:h.spec.width,height:h.spec.height,layer:h.layer,order:h.order})),routes:e.map(h=>({id:h.id,points:h.points.map(u=>({x:u.x+c,y:u.y+b}))}))}},nt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},it=(a,e,t,s)=>a.map(r=>({spec:r,layer:e.get(r.id)??0,order:t.get(r.id)??0,...s(r)})),Ds=(a,e)=>{const t=new Map;for(const s of a){const r=e.get(s.id)??0,n=t.get(r);n?n.push(s.id):t.set(r,[s.id])}return t},Ts=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const r=new Set(a.map(x=>x.id)),n=e.filter(x=>r.has(x.from)&&r.has(x.to)),{forward:i,reversed:o}=Cs(a,n),d=qs(a,i),l=Ds(a,d);Es(l,nt(a,n),d,s.sweeps);const c=new Map;for(const x of l.values())x.forEach((v,C)=>c.set(v,C));const b=it(a,d,c,()=>({x:0,y:0})),h=new Map(b.map(x=>[x.spec.id,x]));zs(l,h,nt(a,n),d,s);const u=[...l.keys()].sort((x,v)=>x-v);let S=0;for(const x of u){const v=Math.max(...(l.get(x)??[]).map(C=>h.get(C)?.spec.width??0));for(const C of l.get(x)??[]){const D=h.get(C);D&&(D.x=S)}S+=v+s.layerSpacing}return rt(b,at(n,o,{byId:h,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},As=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const r=new Set(a.map(d=>d.id)),n=e.filter(d=>r.has(d.from)&&r.has(d.to)),i=it(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return rt(i,at(n,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ls=H({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Rs={active:[],match:"single"},Z=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Os=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Is=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Ps=a=>({...a,active:[]}),js=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},V={nodes:new Map,edges:new Set},U=(a,e,t,s)=>{const r=new Map,n=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,b=t==="outgoing"?l.to:l.from;c===d.id&&(n.add(l.id),!o.has(b)&&(o.add(b),r.set(b,d.depth+1),i.push({id:b,depth:d.depth+1})))}return{nodes:r,edges:n}},Fs=(a,e)=>{const t=new Map(a.map(n=>[n,U(e,n,"outgoing",!0).nodes])),s=new Set,r=[];for(const n of a){if(s.has(n))continue;const i=a.filter(o=>o===n||t.get(n)?.has(o)===!0&&t.get(o)?.has(n)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===n&&o.to===n))&&r.push(i)}return r},Me=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ot=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),dt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},lt=(a,e,t,s)=>{const r=e!==null&&e.kind===t&&e.id===a,n=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:r,related:n&&!r,dimmed:e!==null&&!r&&!n,depth:i}},Q=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),Us=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const n=a[1]??e,i=a[2]??t;return{x:n.x,y:(n.y+i.y)/2}}const s=a[2]??e,r=a[3]??t;return{x:(s.x+r.x)/2,y:s.y}},Ns=(a,e)=>js(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),Hs=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[je,Fe,Ue,B`
2
2
  :host {
3
3
  display: block;
4
4
  container-type: inline-size;
@@ -1,4 +1,4 @@
1
- import{_,a9 as N,aa as f,ab as c,ac as k,ad as p,at as R,af as G,ag as Y,ae as I,V as u,C as v,i as U,a3 as x,a1 as l,a2 as d,aJ as J,au as V,a7 as W,z as Q,a0 as X,T as w}from"./shared-Bfq73Ivq.js";const m=_({en:{wholeDeck:"Whole deck",slideGroup:"Slide",outline:"Slides",previous:"Previous slide",next:"Next slide",position:(t,e)=>`Slide ${t} of ${e}`,commentOnSlide:"Comment on this slide",commentPlaceholder:"A question, or what should change (passed to the agent)",addComment:"Add comment",deleteComment:"Delete this comment",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"Full screen",fullscreenHint:"\u2190 \u2192 to move \xB7 Esc to leave",noSlidesBefore:"There are no slides yet. Add them to ",noSlidesAfter:" in the base data."},ja:{wholeDeck:"\u30C7\u30C3\u30AD\u5168\u4F53",slideGroup:"\u30B9\u30E9\u30A4\u30C9",outline:"\u30B9\u30E9\u30A4\u30C9",previous:"\u524D\u306E\u30B9\u30E9\u30A4\u30C9",next:"\u6B21\u306E\u30B9\u30E9\u30A4\u30C9",position:(t,e)=>`${e} \u679A\u4E2D ${t} \u679A\u76EE`,commentOnSlide:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u306B\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u8CEA\u554F\u3084\u3001\u5909\u3048\u3066\u307B\u3057\u3044\u3053\u3068\uFF08Agent \u306B\u6E21\u308B\uFF09",addComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",deleteComment:"\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"\u5168\u753B\u9762\u8868\u793A",fullscreenHint:"\u2190 \u2192 \u3067\u79FB\u52D5 \xB7 Esc \u3067\u623B\u308B",noSlidesBefore:"\u30B9\u30E9\u30A4\u30C9\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base data \u306E ",noSlidesAfter:" \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),y=["title","section","content"],Z=f({id:R,layout:c(I(y),"content"),title:G(p(),Y(1)),subtitle:c(p(),""),points:c(k(p()),[])}),$=f({title:c(p(),""),slides:c(k(Z),[])}),S=t=>{const e=N($,t),i=new Set;for(const n of e.slides){if(i.has(n.id))throw new Error(`duplicate slide id: ${n.id}`);i.add(n.id)}return{title:e.title,slides:e.slides}},C=()=>({title:"",slides:[]}),r=(t,e)=>e===void 0?-1:t.slides.findIndex(i=>i.id===e),T=(t,e)=>t.slides[r(t,e)],q=t=>t.title===""?"Slides":t.title,h=(t,e)=>`${e+1}. ${t.title}`,E=(t,e,i)=>{switch(i.type){case"slide":{const n=r(e,i.id),s=e.slides[n];return s===void 0?i.id:h(s,n)}case"page":return t.wholeDeck;default:return i.id}},A=(t,e,i)=>({title:e.type,targetLabel:E(t,i,e.target),tone:"meta"}),z=t=>`${t.type} ${u(t.target)} ${JSON.stringify(t.payload)}`,D=(t,e)=>e.slides.map((i,n)=>({value:u({type:"slide",id:i.id}),label:h(i,n),group:t.slideGroup})),M=(t,e,i)=>{const n=r(e,i.slide),s=e.slides[n];return s===void 0?null:{value:u({type:"slide",id:s.id}),label:h(s,n),group:t.slideGroup}},H=(t,e)=>{const i=t.slides[r(t,e.slide)]??t.slides[0],n={...e};return i?n.slide=i.id:delete n.slide,n},L=(t,e)=>{const i=r(t,e.slide),n=i===-1?0:i,s=t.slides[n];return s===void 0?null:{slide:s,index:n,total:t.slides.length,previous:t.slides[n-1],next:t.slides[n+1]}},ee=(t,e)=>t.filter(i=>i.type===v&&i.target.type==="slide"&&i.target.id===e).map(i=>({id:i.id,body:U(i)})).filter(i=>i.body!==""),P=(t,e)=>{switch(e.type){case"slide":return T(t,e.id)!==void 0;case"page":return!0;default:return!1}},F=t=>{const e=m(t);return{name:"slides",label:"Slides",parseBase:S,emptyBase:C,actions:{},apply:()=>null,hasTarget:P,describe:(i,n)=>A(e,i,n),serialize:z,resolveNavigation:H,commentTargets:i=>D(e,i),currentTarget:(i,n)=>M(e,i,n),title:q}},te={ArrowRight:"next",PageDown:"next",ArrowLeft:"previous",PageUp:"previous",Home:"first",End:"last"},O=t=>t.altKey===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0?null:te[t.key]??null,j=(t,e,i)=>{const n=t.slides.length-1;if(n<0)return;const s=Math.max(r(t,e),0),o={next:Math.min(s+1,n),previous:Math.max(s-1,0),first:0,last:n}[i];return t.slides[o]?.id},ie=(t,e)=>{const{state:i,navigation:n}=t,s=n.slide;return d`
1
+ import{_,a9 as N,aa as f,ab as c,ac as k,ad as p,at as R,af as G,ag as Y,ae as I,V as u,C as v,i as U,a3 as x,a1 as l,a2 as d,aJ as J,au as V,a7 as W,z as Q,a0 as X,T as w}from"./shared-BYZoeQ97.js";const m=_({en:{wholeDeck:"Whole deck",slideGroup:"Slide",outline:"Slides",previous:"Previous slide",next:"Next slide",position:(t,e)=>`Slide ${t} of ${e}`,commentOnSlide:"Comment on this slide",commentPlaceholder:"A question, or what should change (passed to the agent)",addComment:"Add comment",deleteComment:"Delete this comment",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"Full screen",fullscreenHint:"\u2190 \u2192 to move \xB7 Esc to leave",noSlidesBefore:"There are no slides yet. Add them to ",noSlidesAfter:" in the base data."},ja:{wholeDeck:"\u30C7\u30C3\u30AD\u5168\u4F53",slideGroup:"\u30B9\u30E9\u30A4\u30C9",outline:"\u30B9\u30E9\u30A4\u30C9",previous:"\u524D\u306E\u30B9\u30E9\u30A4\u30C9",next:"\u6B21\u306E\u30B9\u30E9\u30A4\u30C9",position:(t,e)=>`${e} \u679A\u4E2D ${t} \u679A\u76EE`,commentOnSlide:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u306B\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u8CEA\u554F\u3084\u3001\u5909\u3048\u3066\u307B\u3057\u3044\u3053\u3068\uFF08Agent \u306B\u6E21\u308B\uFF09",addComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",deleteComment:"\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"\u5168\u753B\u9762\u8868\u793A",fullscreenHint:"\u2190 \u2192 \u3067\u79FB\u52D5 \xB7 Esc \u3067\u623B\u308B",noSlidesBefore:"\u30B9\u30E9\u30A4\u30C9\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base data \u306E ",noSlidesAfter:" \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),y=["title","section","content"],Z=f({id:R,layout:c(I(y),"content"),title:G(p(),Y(1)),subtitle:c(p(),""),points:c(k(p()),[])}),$=f({title:c(p(),""),slides:c(k(Z),[])}),S=t=>{const e=N($,t),i=new Set;for(const n of e.slides){if(i.has(n.id))throw new Error(`duplicate slide id: ${n.id}`);i.add(n.id)}return{title:e.title,slides:e.slides}},C=()=>({title:"",slides:[]}),r=(t,e)=>e===void 0?-1:t.slides.findIndex(i=>i.id===e),T=(t,e)=>t.slides[r(t,e)],q=t=>t.title===""?"Slides":t.title,h=(t,e)=>`${e+1}. ${t.title}`,E=(t,e,i)=>{switch(i.type){case"slide":{const n=r(e,i.id),s=e.slides[n];return s===void 0?i.id:h(s,n)}case"page":return t.wholeDeck;default:return i.id}},A=(t,e,i)=>({title:e.type,targetLabel:E(t,i,e.target),tone:"meta"}),z=t=>`${t.type} ${u(t.target)} ${JSON.stringify(t.payload)}`,D=(t,e)=>e.slides.map((i,n)=>({value:u({type:"slide",id:i.id}),label:h(i,n),group:t.slideGroup})),M=(t,e,i)=>{const n=r(e,i.slide),s=e.slides[n];return s===void 0?null:{value:u({type:"slide",id:s.id}),label:h(s,n),group:t.slideGroup}},H=(t,e)=>{const i=t.slides[r(t,e.slide)]??t.slides[0],n={...e};return i?n.slide=i.id:delete n.slide,n},L=(t,e)=>{const i=r(t,e.slide),n=i===-1?0:i,s=t.slides[n];return s===void 0?null:{slide:s,index:n,total:t.slides.length,previous:t.slides[n-1],next:t.slides[n+1]}},ee=(t,e)=>t.filter(i=>i.type===v&&i.target.type==="slide"&&i.target.id===e).map(i=>({id:i.id,body:U(i)})).filter(i=>i.body!==""),P=(t,e)=>{switch(e.type){case"slide":return T(t,e.id)!==void 0;case"page":return!0;default:return!1}},F=t=>{const e=m(t);return{name:"slides",label:"Slides",parseBase:S,emptyBase:C,actions:{},apply:()=>null,hasTarget:P,describe:(i,n)=>A(e,i,n),serialize:z,resolveNavigation:H,commentTargets:i=>D(e,i),currentTarget:(i,n)=>M(e,i,n),title:q}},te={ArrowRight:"next",PageDown:"next",ArrowLeft:"previous",PageUp:"previous",Home:"first",End:"last"},O=t=>t.altKey===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0?null:te[t.key]??null,j=(t,e,i)=>{const n=t.slides.length-1;if(n<0)return;const s=Math.max(r(t,e),0),o={next:Math.min(s+1,n),previous:Math.max(s-1,0),first:0,last:n}[i];return t.slides[o]?.id},ie=(t,e)=>{const{state:i,navigation:n}=t,s=n.slide;return d`
2
2
  <nav class="outline" aria-label=${e.outline}>
3
3
  <div class="outline-head">
4
4
  <span class="dpk-label">${e.outline}</span>
@@ -1 +1 @@
1
- import{aG as t,aH as a,a1 as i,aI as n}from"./shared-Bfq73Ivq.js";const o=t(class extends a{constructor(){super(...arguments),this.key=i}render(s,e){return this.key=s,e}update(s,[e,r]){return e!==this.key&&(n(s),this.key=e),r}});export{o as i};
1
+ import{aG as t,aH as a,a1 as i,aI as n}from"./shared-BYZoeQ97.js";const o=t(class extends a{constructor(){super(...arguments),this.key=i}render(s,e){return this.key=s,e}update(s,[e,r]){return e!==this.key&&(n(s),this.key=e),r}});export{o as i};