dev-process-kit 0.0.3 → 0.0.4

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 m,an as E,v as A,au as k,at as S,ad as s,af as x,ag as f,as as D,a9 as Ue,aa as w,ab as M,ac as q,P as Pe,f as Qe,_ as Ce,V as I,R as g,m as Xe,a0 as H,a5 as Ye,k as Be,$ as Ve,a6 as ze,a1 as $,av as Ke,a2 as h,A as Fe,K as je,i as Je,a3 as z,T as Z}from"./shared-CwbzACTe.js";import{s as K,r as N,D as We}from"./shared-xrCdgpNS.js";import{P as He,r as Ze,p as Ge,c as et}from"./shared-CPAT0Cgk.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),f(1))})),SET_STORY_DESCRIPTION:m("SET_STORY_DESCRIPTION","story",E({description:s()})),REORDER_STORY:m("REORDER_STORY","story",E({after:D(s())}),{mode:"sequence"}),ADD_STORY:m("ADD_STORY","page",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:A}),DELETE_STORY:m("DELETE_STORY","story",E({})),SET_RULE_NAME:m("SET_RULE_NAME","rule",E({name:x(s(),f(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),f(1)),after:D(s())}),{mode:"sequence"}),REORDER_RULE:m("REORDER_RULE","rule",E({after:D(s())}),{mode:"sequence"}),ADD_RULE:m("ADD_RULE","story",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:A}),DELETE_RULE:m("DELETE_RULE","rule",E({})),SET_EXAMPLE_NAME:m("SET_EXAMPLE_NAME","example",E({name:x(s(),f(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),f(1)),after:D(s())}),{mode:"sequence"}),REORDER_EXAMPLE:m("REORDER_EXAMPLE","example",E({after:D(s())}),{mode:"sequence"}),ADD_EXAMPLE:m("ADD_EXAMPLE","rule",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:A}),DELETE_EXAMPLE:m("DELETE_EXAMPLE","example",E({})),SET_QUESTION_NAME:m("SET_QUESTION_NAME","question",E({name:x(s(),f(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),f(1)),after:D(s())}),{mode:"sequence"}),REORDER_QUESTION:m("REORDER_QUESTION","question",E({after:D(s())}),{mode:"sequence"}),ADD_QUESTION:m("ADD_QUESTION","rule",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:A}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},L={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}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),addStory:(e,t)=>({type:"ADD_STORY",target:{type:"page",id:"example-mapping"},payload:{id:e,name:t}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),setRuleName:(e,t)=>({type:"SET_RULE_NAME",target:{type:"rule",id:e},payload:{name:t}}),setRuleDescription:(e,t)=>({type:"SET_RULE_DESCRIPTION",target:{type:"rule",id:e},payload:{description:t}}),moveRule:(e,t,r)=>({type:"MOVE_RULE",target:{type:"rule",id:e},payload:{storyId:t,after:r}}),reorderRule:(e,t)=>({type:"REORDER_RULE",target:{type:"rule",id:e},payload:{after:t}}),addRule:(e,t,r)=>({type:"ADD_RULE",target:{type:"story",id:e},payload:{id:t,name:r}}),deleteRule:e=>({type:"DELETE_RULE",target:{type:"rule",id:e},payload:{}}),setExampleName:(e,t)=>({type:"SET_EXAMPLE_NAME",target:{type:"example",id:e},payload:{name:t}}),setExampleDescription:(e,t)=>({type:"SET_EXAMPLE_DESCRIPTION",target:{type:"example",id:e},payload:{description:t}}),moveExample:(e,t,r)=>({type:"MOVE_EXAMPLE",target:{type:"example",id:e},payload:{ruleId:t,after:r}}),reorderExample:(e,t)=>({type:"REORDER_EXAMPLE",target:{type:"example",id:e},payload:{after:t}}),addExample:(e,t,r)=>({type:"ADD_EXAMPLE",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteExample:e=>({type:"DELETE_EXAMPLE",target:{type:"example",id:e},payload:{}}),setQuestionName:(e,t)=>({type:"SET_QUESTION_NAME",target:{type:"question",id:e},payload:{name:t}}),setQuestionDescription:(e,t)=>({type:"SET_QUESTION_DESCRIPTION",target:{type:"question",id:e},payload:{description:t}}),moveQuestion:(e,t,r)=>({type:"MOVE_QUESTION",target:{type:"question",id:e},payload:{ruleId:t,after:r}}),reorderQuestion:(e,t)=>({type:"REORDER_QUESTION",target:{type:"question",id:e},payload:{after:t}}),addQuestion:(e,t,r)=>({type:"ADD_QUESTION",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteQuestion:e=>({type:"DELETE_QUESTION",target:{type:"question",id:e},payload:{}})},tt=w({id:k,name:x(s(),f(1)),description:S(s())}),rt=w({id:k,storyId:x(s(),f(1)),name:x(s(),f(1)),description:S(s())}),G=w({id:k,ruleId:x(s(),f(1)),name:x(s(),f(1)),description:S(s())}),ee=w({title:S(s()),stories:M(q(tt),[]),rules:M(q(rt),[]),examples:M(q(G),[]),questions:M(q(G),[])}),te=e=>{const t=Ue(ee,e),r=new Set,a=(i,d)=>{if(r.has(d))throw new Error(`duplicate id "${d}" in ${i}`);r.add(d)},n=new Set(t.stories.map(i=>i.id));for(const i of t.stories)a("stories",i.id);for(const i of t.rules)if(a("rules",i.id),!n.has(i.storyId))throw new Error(`rule "${i.id}" references unknown storyId "${i.storyId}"`);const o=new Map(t.rules.map(i=>[i.id,i]));for(const i of t.examples)if(a("examples",i.id),!o.has(i.ruleId))throw new Error(`example "${i.id}" references unknown ruleId "${i.ruleId}"`);for(const i of t.questions)if(a("questions",i.id),!o.has(i.ruleId))throw new Error(`question "${i.id}" references unknown ruleId "${i.ruleId}"`);return t},re=()=>({stories:[],rules:[],examples:[],questions:[]}),at=e=>({...e,rules:K(e.rules,["storyId"]),examples:K(e.examples,["ruleId"]),questions:K(e.questions,["ruleId"])}),T=(e,t)=>{if(t!==void 0)return e.stories.find(r=>r.id===t)},y=(e,t)=>{if(t!==void 0)return e.rules.find(r=>r.id===t)},b=(e,t)=>{if(t!==void 0)return e.examples.find(r=>r.id===t)},R=(e,t)=>{if(t!==void 0)return e.questions.find(r=>r.id===t)},U=(e,t)=>{if(t===void 0)return;const r=T(e,t);if(r)return{kind:"story",id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}};const a=y(e,t);if(a)return{kind:"rule",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const n=b(e,t);if(n)return{kind:"example",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const o=R(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},ae=(e,t)=>e.rules.filter(r=>r.storyId===t),ne=(e,t)=>e.examples.filter(r=>r.ruleId===t),oe=(e,t)=>e.questions.filter(r=>r.ruleId===t),nt=(e,t)=>{if(T(e,t))return t;const r=y(e,t);if(r)return r.storyId;const a=b(e,t)?.ruleId??R(e,t)?.ruleId;return a===void 0?void 0:y(e,a)?.storyId},ie=e=>[...e.stories.map(t=>t.id),...e.rules.map(t=>t.id),...e.examples.map(t=>t.id),...e.questions.map(t=>t.id)],de=(e,t)=>y(e,t)?.storyId,ot=(e,t)=>{const r=b(e,t);return r?de(e,r.ruleId):void 0},se=(e,t)=>{const r=Pe(u,t);if(r===null)return null;const a=r.target.id;switch(r.type){case"SET_STORY_NAME":return le(e,a,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return le(e,a,n=>({...n,description:r.payload.description}));case"REORDER_STORY":{const n=Ee(e.stories,a,r.payload.after);return n===null?null:{...e,stories:n}}case"ADD_STORY":{const n=r.payload;return e.stories.some(o=>o.id===n.id)?e:P(e,n.id)?null:{...e,stories:[...e.stories,{id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===a))return null;const n=new Set(e.rules.filter(o=>o.storyId===a).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==a),rules:e.rules.filter(o=>o.storyId!==a),examples:e.examples.filter(o=>!n.has(o.ruleId)),questions:e.questions.filter(o=>!n.has(o.ruleId))}}case"SET_RULE_NAME":return pe(e,a,n=>({...n,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return pe(e,a,n=>({...n,description:r.payload.description}));case"MOVE_RULE":{const n=r.payload,o=y(e,a);if(!o||!e.stories.some(d=>d.id===n.storyId))return null;const i=e.rules.filter(d=>d.storyId===n.storyId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,rules:me(e.rules,{...o,storyId:n.storyId},n.after)}}case"REORDER_RULE":{const n=y(e,a);if(!n)return null;const o=e.rules.filter(i=>i.storyId===n.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:me(e.rules,n,r.payload.after)}}case"ADD_RULE":{const n=r.payload,o=T(e,a);return o?e.rules.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,rules:[...e.rules,{id:n.id,storyId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_RULE":return y(e,a)?{...e,rules:e.rules.filter(n=>n.id!==a),examples:e.examples.filter(n=>n.ruleId!==a),questions:e.questions.filter(n=>n.ruleId!==a)}:null;case"SET_EXAMPLE_NAME":return ue(e,a,n=>({...n,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ue(e,a,n=>({...n,description:r.payload.description}));case"MOVE_EXAMPLE":{const n=r.payload,o=b(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.examples.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,examples:Q(e.examples,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_EXAMPLE":{const n=b(e,a);if(!n)return null;const o=e.examples.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:Q(e.examples,n,r.payload.after)}}case"ADD_EXAMPLE":{const n=r.payload,o=y(e,a);return o?e.examples.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,examples:[...e.examples,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_EXAMPLE":return b(e,a)?{...e,examples:e.examples.filter(n=>n.id!==a)}:null;case"SET_QUESTION_NAME":return ce(e,a,n=>({...n,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,a,n=>({...n,description:r.payload.description}));case"MOVE_QUESTION":{const n=r.payload,o=R(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.questions.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,questions:Q(e.questions,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_QUESTION":{const n=R(e,a);if(!n)return null;const o=e.questions.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:Q(e.questions,n,r.payload.after)}}case"ADD_QUESTION":{const n=r.payload,o=y(e,a);return o?e.questions.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,questions:[...e.questions,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_QUESTION":return R(e,a)?{...e,questions:e.questions.filter(n=>n.id!==a)}:null;default:return Qe(r)}},P=(e,t)=>e.stories.some(r=>r.id===t)||e.rules.some(r=>r.id===t)||e.examples.some(r=>r.id===t)||e.questions.some(r=>r.id===t),le=(e,t,r)=>e.stories.some(a=>a.id===t)?{...e,stories:e.stories.map(a=>a.id===t?r(a):a)}:null,pe=(e,t,r)=>e.rules.some(a=>a.id===t)?{...e,rules:e.rules.map(a=>a.id===t?r(a):a)}:null,ue=(e,t,r)=>e.examples.some(a=>a.id===t)?{...e,examples:e.examples.map(a=>a.id===t?r(a):a)}:null,ce=(e,t,r)=>e.questions.some(a=>a.id===t)?{...e,questions:e.questions.map(a=>a.id===t?r(a):a)}:null,me=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.storyId===t.storyId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.storyId===t.storyId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Q=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.ruleId===t.ruleId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.ruleId===t.ruleId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Ee=(e,t,r)=>{if(!e.some(o=>o.id===t)||r!==null&&!e.some(o=>o.id===r))return null;if(r===t)return[...e];const a=e.find(o=>o.id===t);if(a===void 0)return null;const n=e.filter(o=>o.id!==t);return F(n,a,r)},F=(e,t,r)=>{const a=[...e],n=r===null?-1:a.findIndex(o=>o.id===r);return a.splice(n+1,0,t),a},it={story:"Story",rule:"Rule",example:"Example",question:"Question"},dt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},st={empty:"No rules yet","open-questions":"Open questions","too-big":"Consider splitting",thin:"A rule has no example",ready:"Looks ready"},lt={empty:"\u30EB\u30FC\u30EB\u672A\u6574\u7406","open-questions":"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u3042\u308A","too-big":"\u5206\u5272\u3092\u691C\u8A0E",thin:"\u5177\u4F53\u4F8B\u306E\u7121\u3044\u30EB\u30FC\u30EB\u3042\u308A",ready:"\u5408\u610F\u3067\u304D\u305D\u3046"},C=Ce({en:{kindLabel:e=>it[e],readinessLabel:e=>st[e],map:"Map",cardKinds:"Card kinds",noStoriesTitle:"No stories yet",noStoriesBody:"Place one story (yellow), then line up the rules (blue) that accept it beneath it. For each rule, stack examples (green) in the top area and open questions (red) in the bottom area.",firstStory:"+ First story",addStoryButton:"+ Story",noExamples:"No examples yet",noQuestions:"No open questions",commentButton:"Comment",deleteButton:"Delete",nameField:e=>`${e} name`,newStory:"New story",newRule:"New rule",newExample:"New example",newQuestion:"New question",storyRenamedTitle:"Renamed the story",storyDescriptionUpdatedTitle:"Updated the story\u2019s description",storyReorderedTitle:"Reordered the story",storyAddedTitle:"Added a story",storyDeletedTitle:"Deleted the story",ruleRenamedTitle:"Renamed the rule",ruleDescriptionUpdatedTitle:"Updated the rule\u2019s description",ruleMovedTitle:"Moved the rule",ruleReorderedTitle:"Reordered the rule",ruleAddedTitle:"Added a rule",ruleDeletedTitle:"Deleted the rule",exampleRenamedTitle:"Renamed the example",exampleDescriptionUpdatedTitle:"Updated the example\u2019s description",exampleMovedTitle:"Moved the example",exampleReorderedTitle:"Reordered the example",exampleAddedTitle:"Added an example",exampleDeletedTitle:"Deleted the example",questionRenamedTitle:"Renamed the question",questionDescriptionUpdatedTitle:"Updated the question\u2019s description",questionMovedTitle:"Moved the question",questionReorderedTitle:"Reordered the question",questionAddedTitle:"Added a question",questionDeletedTitle:"Deleted the question",arrowTo:e=>`\u2192 \u201C${e}\u201D`,arrowFrom:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,toTop:"\u2192 To the top",afterPlacement:e=>`\u2192 After \u201C${e}\u201D`,wholeMap:"Whole map"},ja:{kindLabel:e=>dt[e],readinessLabel:e=>lt[e],map:"\u30DE\u30C3\u30D7",cardKinds:"\u30AB\u30FC\u30C9\u306E\u7A2E\u985E",noStoriesTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noStoriesBody:"\u30B9\u30C8\u30FC\u30EA\u30FC\uFF08\u9EC4\uFF09\u30921\u679A\u7F6E\u304D\u3001\u305D\u306E\u4E0B\u306B\u53D7\u3051\u5165\u308C\u6761\u4EF6\u3068\u306A\u308B\u30EB\u30FC\u30EB\uFF08\u9752\uFF09\u3092\u4E26\u3079\u307E\u3059\u3002\u30EB\u30FC\u30EB\u3054\u3068\u306B\u3001\u4E0A\u306E\u6B04\u3078\u5177\u4F53\u4F8B\uFF08\u7DD1\uFF09\u3092\u3001\u4E0B\u306E\u6B04\u3078\u7B54\u3048\u306E\u51FA\u306A\u3044\u8AD6\u70B9\u3092\u8CEA\u554F\uFF08\u8D64\uFF09\u3068\u3057\u3066\u7A4D\u307F\u307E\u3059\u3002",firstStory:"+ \u6700\u521D\u306E\u30B9\u30C8\u30FC\u30EA\u30FC",addStoryButton:"+ \u30B9\u30C8\u30FC\u30EA\u30FC",noExamples:"\u5177\u4F53\u4F8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noQuestions:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",nameField:e=>`${e}\u540D`,newStory:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC",newRule:"\u65B0\u3057\u3044\u30EB\u30FC\u30EB",newExample:"\u65B0\u3057\u3044\u5177\u4F53\u4F8B",newQuestion:"\u65B0\u3057\u3044\u8CEA\u554F",storyRenamedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",storyDescriptionUpdatedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",storyReorderedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",storyAddedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",storyDeletedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",ruleRenamedTitle:"\u30EB\u30FC\u30EB\u540D\u3092\u5909\u66F4",ruleDescriptionUpdatedTitle:"\u30EB\u30FC\u30EB\u306E\u8AAC\u660E\u3092\u66F4\u65B0",ruleMovedTitle:"\u30EB\u30FC\u30EB\u3092\u79FB\u52D5",ruleReorderedTitle:"\u30EB\u30FC\u30EB\u306E\u9806\u5E8F\u3092\u5909\u66F4",ruleAddedTitle:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",ruleDeletedTitle:"\u30EB\u30FC\u30EB\u3092\u524A\u9664",exampleRenamedTitle:"\u5177\u4F53\u4F8B\u540D\u3092\u5909\u66F4",exampleDescriptionUpdatedTitle:"\u5177\u4F53\u4F8B\u306E\u8AAC\u660E\u3092\u66F4\u65B0",exampleMovedTitle:"\u5177\u4F53\u4F8B\u3092\u79FB\u52D5",exampleReorderedTitle:"\u5177\u4F53\u4F8B\u306E\u9806\u5E8F\u3092\u5909\u66F4",exampleAddedTitle:"\u5177\u4F53\u4F8B\u3092\u8FFD\u52A0",exampleDeletedTitle:"\u5177\u4F53\u4F8B\u3092\u524A\u9664",questionRenamedTitle:"\u8CEA\u554F\u540D\u3092\u5909\u66F4",questionDescriptionUpdatedTitle:"\u8CEA\u554F\u306E\u8AAC\u660E\u3092\u66F4\u65B0",questionMovedTitle:"\u8CEA\u554F\u3092\u79FB\u52D5",questionReorderedTitle:"\u8CEA\u554F\u306E\u9806\u5E8F\u3092\u5909\u66F4",questionAddedTitle:"\u8CEA\u554F\u3092\u8FFD\u52A0",questionDeletedTitle:"\u8CEA\u554F\u3092\u524A\u9664",arrowTo:e=>`\u2192 \u300C${e}\u300D`,arrowFrom:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,toTop:"\u2192 \u5148\u982D\u3078",afterPlacement:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53"}}),X=(e,t,r)=>{const a=typeof r=="string"?r:"",n=typeof t=="string"?t:void 0;return n===void 0?e.arrowTo(a):e.arrowFrom(n,a)},pt={SET_STORY_NAME:(e,t,r)=>({title:e.storyRenamedTitle,tone:"update",body:X(e,T(r,t.target.id)?.name,g(u.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.storyDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),REORDER_STORY:(e,t)=>({title:e.storyReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.storyAddedTitle,tone:"create",body:e.added(String(g(u.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,r)=>({title:e.storyDeletedTitle,tone:"delete",body:e.deleted(T(r,t.target.id)?.name??t.target.id)}),SET_RULE_NAME:(e,t,r)=>({title:e.ruleRenamedTitle,tone:"update",body:X(e,y(r,t.target.id)?.name,g(u.SET_RULE_NAME,t).name??"")}),SET_RULE_DESCRIPTION:(e,t)=>({title:e.ruleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_RULE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_RULE:(e,t,r)=>({title:e.ruleMovedTitle,tone:"move",body:e.arrowTo(T(r,String(g(u.MOVE_RULE,t).storyId))?.name??String(g(u.MOVE_RULE,t).storyId??""))}),REORDER_RULE:(e,t)=>({title:e.ruleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_RULE,t).after)}),ADD_RULE:(e,t)=>({title:e.ruleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_RULE,t).name??""))}),DELETE_RULE:(e,t,r)=>({title:e.ruleDeletedTitle,tone:"delete",body:e.deleted(y(r,t.target.id)?.name??t.target.id)}),SET_EXAMPLE_NAME:(e,t,r)=>({title:e.exampleRenamedTitle,tone:"update",body:X(e,b(r,t.target.id)?.name,g(u.SET_EXAMPLE_NAME,t).name??"")}),SET_EXAMPLE_DESCRIPTION:(e,t)=>({title:e.exampleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_EXAMPLE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_EXAMPLE:(e,t,r)=>({title:e.exampleMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_EXAMPLE,t).ruleId))?.name??String(g(u.MOVE_EXAMPLE,t).ruleId??""))}),REORDER_EXAMPLE:(e,t)=>({title:e.exampleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_EXAMPLE,t).after)}),ADD_EXAMPLE:(e,t)=>({title:e.exampleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_EXAMPLE,t).name??""))}),DELETE_EXAMPLE:(e,t,r)=>({title:e.exampleDeletedTitle,tone:"delete",body:e.deleted(b(r,t.target.id)?.name??t.target.id)}),SET_QUESTION_NAME:(e,t,r)=>({title:e.questionRenamedTitle,tone:"update",body:X(e,R(r,t.target.id)?.name,g(u.SET_QUESTION_NAME,t).name??"")}),SET_QUESTION_DESCRIPTION:(e,t)=>({title:e.questionDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_QUESTION_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_QUESTION:(e,t,r)=>({title:e.questionMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_QUESTION,t).ruleId))?.name??String(g(u.MOVE_QUESTION,t).ruleId??""))}),REORDER_QUESTION:(e,t)=>({title:e.questionReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_QUESTION,t).after)}),ADD_QUESTION:(e,t)=>({title:e.questionAddedTitle,tone:"create",body:e.added(String(g(u.ADD_QUESTION,t).name??""))}),DELETE_QUESTION:(e,t,r)=>({title:e.questionDeletedTitle,tone:"delete",body:e.deleted(R(r,t.target.id)?.name??t.target.id)})},Y=(e,t)=>t==null?e.toTop:e.afterPlacement(t),ge=(e,t,r,a)=>{let n;try{const o=pt[t.type];n=o?o(e,t,a??r):{title:t.type,tone:"meta"}}catch{n={title:t.type,tone:"meta"}}return{title:n.title,targetLabel:xe(e,r,t.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ye=e=>`${e.type} ${I(e.target)} ${JSON.stringify(e.payload)}`,xe=(e,t,r)=>{try{switch(r.type){case"story":{const a=T(t,r.id);return a?`${e.kindLabel("story")} \xB7 ${a.name}`:`${e.kindLabel("story")} \xB7 ${r.id} (missing)`}case"rule":{const a=y(t,r.id);return a?`${e.kindLabel("rule")} \xB7 ${a.name}`:`${e.kindLabel("rule")} \xB7 ${r.id} (missing)`}case"example":{const a=b(t,r.id);return a?`${e.kindLabel("example")} \xB7 ${a.name}`:`${e.kindLabel("example")} \xB7 ${r.id} (missing)`}case"question":{const a=R(t,r.id);return a?`${e.kindLabel("question")} \xB7 ${a.name}`:`${e.kindLabel("question")} \xB7 ${r.id} (missing)`}case"page":return`${e.map} \xB7 ${j(t)}`;default:return`${r.type} \xB7 ${r.id}`}}catch{return`${r.type} \xB7 ${r.id}`}},fe=(e,t,r)=>{const a=[{value:"page:example-mapping",label:e.wholeMap,group:e.map}];for(const n of t.stories)a.push({value:I({type:"story",id:n.id}),label:n.name,group:e.kindLabel("story")});for(const n of t.rules){const o=T(t,n.storyId);a.push({value:I({type:"rule",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("rule")})}for(const n of t.examples){const o=y(t,n.ruleId);a.push({value:I({type:"example",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("example")})}for(const n of t.questions){const o=y(t,n.ruleId);a.push({value:I({type:"question",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("question")})}return a},he=(e,t,r)=>{const a=U(t,r.card);return a?{value:I({type:a.kind,id:a.id}),label:a.name,group:e.kindLabel(a.kind)}:null},ut=4,Te=(e,t,r)=>{const a=t.rules.filter(p=>p.storyId===r),n=new Set(a.map(p=>p.id)),o=t.examples.filter(p=>n.has(p.ruleId)),i=t.questions.filter(p=>n.has(p.ruleId)).length,d=a.some(p=>!o.some(l=>l.ruleId===p.id)),c=a.length===0?"empty":i>0?"open-questions":a.length>ut?"too-big":d?"thin":"ready";return{rules:a.length,examples:o.length,questions:i,readiness:c,label:e.readinessLabel(c)}},j=e=>e.title??"Example Mapping",be=(e,t)=>{const r=U(e,t.card),a={...t};return r?a.card=r.id:delete a.card,a},Re=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return U(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},Se=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:te,emptyBase:re,actions:u,apply:se,canonicalState:at,hasTarget:Re,describe:(r,a,n)=>ge(t,r,a,n),serialize:ye,resolveNavigation:be,commentTargets:(r,a)=>fe(t,r),currentTarget:(r,a)=>he(t,r,a),title:j}},B=(e,t,r)=>{const a=Xe(t,ie(e.state));return e.dispatch(r(a)).ok?(e.navigate({card:a}),a):null},ct=(e,t)=>B(e,"new-story",r=>L.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>L.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>L.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>L.addQuestion(r,a,t.newQuestion)),yt={width:300,height:260},ve=["story","rule","example","question"],_e={story:{bg:"linear-gradient(178deg, #fff3a6, #fde77a)",ink:"#4a3a06"},rule:{bg:"linear-gradient(178deg, #a3d1f5, #7cb8ea)",ink:"#0e2c4b"},example:{bg:"linear-gradient(178deg, #c9eb95, #a8dc63)",ink:"#22380a"},question:{bg:"linear-gradient(178deg, #fbc6d9, #f4a0c0)",ink:"#4b1029"}},O=e=>{const{bg:t,ink:r}=_e[e];return`--em-card-bg:${t};--em-card-ink:${r}`},xt=H`
1
+ import{q as m,an as E,v as w,at as k,av as S,ad as s,af as x,ag as f,as as D,a9 as Ue,aa as A,ab as M,ac as q,P as Pe,f as Qe,_ as Ce,V as I,R as g,m as Xe,a0 as H,a5 as Ye,k as Be,$ as Ve,a6 as ze,a1 as $,aw as Ke,a2 as h,A as Fe,K as je,i as Je,a3 as z,T as Z}from"./shared-CU-s47EI.js";import{s as K,r as N,D as We}from"./shared-xrCdgpNS.js";import{P as He,r as Ze,p as Ge,c as et}from"./shared-CvU8S9Oz.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),f(1))})),SET_STORY_DESCRIPTION:m("SET_STORY_DESCRIPTION","story",E({description:s()})),REORDER_STORY:m("REORDER_STORY","story",E({after:D(s())}),{mode:"sequence"}),ADD_STORY:m("ADD_STORY","page",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:w}),DELETE_STORY:m("DELETE_STORY","story",E({})),SET_RULE_NAME:m("SET_RULE_NAME","rule",E({name:x(s(),f(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),f(1)),after:D(s())}),{mode:"sequence"}),REORDER_RULE:m("REORDER_RULE","rule",E({after:D(s())}),{mode:"sequence"}),ADD_RULE:m("ADD_RULE","story",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:w}),DELETE_RULE:m("DELETE_RULE","rule",E({})),SET_EXAMPLE_NAME:m("SET_EXAMPLE_NAME","example",E({name:x(s(),f(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),f(1)),after:D(s())}),{mode:"sequence"}),REORDER_EXAMPLE:m("REORDER_EXAMPLE","example",E({after:D(s())}),{mode:"sequence"}),ADD_EXAMPLE:m("ADD_EXAMPLE","rule",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:w}),DELETE_EXAMPLE:m("DELETE_EXAMPLE","example",E({})),SET_QUESTION_NAME:m("SET_QUESTION_NAME","question",E({name:x(s(),f(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),f(1)),after:D(s())}),{mode:"sequence"}),REORDER_QUESTION:m("REORDER_QUESTION","question",E({after:D(s())}),{mode:"sequence"}),ADD_QUESTION:m("ADD_QUESTION","rule",E({id:k,name:x(s(),f(1)),description:S(s())}),{dedupeKey:w}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},L={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}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),addStory:(e,t)=>({type:"ADD_STORY",target:{type:"page",id:"example-mapping"},payload:{id:e,name:t}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),setRuleName:(e,t)=>({type:"SET_RULE_NAME",target:{type:"rule",id:e},payload:{name:t}}),setRuleDescription:(e,t)=>({type:"SET_RULE_DESCRIPTION",target:{type:"rule",id:e},payload:{description:t}}),moveRule:(e,t,r)=>({type:"MOVE_RULE",target:{type:"rule",id:e},payload:{storyId:t,after:r}}),reorderRule:(e,t)=>({type:"REORDER_RULE",target:{type:"rule",id:e},payload:{after:t}}),addRule:(e,t,r)=>({type:"ADD_RULE",target:{type:"story",id:e},payload:{id:t,name:r}}),deleteRule:e=>({type:"DELETE_RULE",target:{type:"rule",id:e},payload:{}}),setExampleName:(e,t)=>({type:"SET_EXAMPLE_NAME",target:{type:"example",id:e},payload:{name:t}}),setExampleDescription:(e,t)=>({type:"SET_EXAMPLE_DESCRIPTION",target:{type:"example",id:e},payload:{description:t}}),moveExample:(e,t,r)=>({type:"MOVE_EXAMPLE",target:{type:"example",id:e},payload:{ruleId:t,after:r}}),reorderExample:(e,t)=>({type:"REORDER_EXAMPLE",target:{type:"example",id:e},payload:{after:t}}),addExample:(e,t,r)=>({type:"ADD_EXAMPLE",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteExample:e=>({type:"DELETE_EXAMPLE",target:{type:"example",id:e},payload:{}}),setQuestionName:(e,t)=>({type:"SET_QUESTION_NAME",target:{type:"question",id:e},payload:{name:t}}),setQuestionDescription:(e,t)=>({type:"SET_QUESTION_DESCRIPTION",target:{type:"question",id:e},payload:{description:t}}),moveQuestion:(e,t,r)=>({type:"MOVE_QUESTION",target:{type:"question",id:e},payload:{ruleId:t,after:r}}),reorderQuestion:(e,t)=>({type:"REORDER_QUESTION",target:{type:"question",id:e},payload:{after:t}}),addQuestion:(e,t,r)=>({type:"ADD_QUESTION",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteQuestion:e=>({type:"DELETE_QUESTION",target:{type:"question",id:e},payload:{}})},tt=A({id:k,name:x(s(),f(1)),description:S(s())}),rt=A({id:k,storyId:x(s(),f(1)),name:x(s(),f(1)),description:S(s())}),G=A({id:k,ruleId:x(s(),f(1)),name:x(s(),f(1)),description:S(s())}),ee=A({title:S(s()),stories:M(q(tt),[]),rules:M(q(rt),[]),examples:M(q(G),[]),questions:M(q(G),[])}),te=e=>{const t=Ue(ee,e),r=new Set,a=(i,d)=>{if(r.has(d))throw new Error(`duplicate id "${d}" in ${i}`);r.add(d)},n=new Set(t.stories.map(i=>i.id));for(const i of t.stories)a("stories",i.id);for(const i of t.rules)if(a("rules",i.id),!n.has(i.storyId))throw new Error(`rule "${i.id}" references unknown storyId "${i.storyId}"`);const o=new Map(t.rules.map(i=>[i.id,i]));for(const i of t.examples)if(a("examples",i.id),!o.has(i.ruleId))throw new Error(`example "${i.id}" references unknown ruleId "${i.ruleId}"`);for(const i of t.questions)if(a("questions",i.id),!o.has(i.ruleId))throw new Error(`question "${i.id}" references unknown ruleId "${i.ruleId}"`);return t},re=()=>({stories:[],rules:[],examples:[],questions:[]}),at=e=>({...e,rules:K(e.rules,["storyId"]),examples:K(e.examples,["ruleId"]),questions:K(e.questions,["ruleId"])}),T=(e,t)=>{if(t!==void 0)return e.stories.find(r=>r.id===t)},y=(e,t)=>{if(t!==void 0)return e.rules.find(r=>r.id===t)},b=(e,t)=>{if(t!==void 0)return e.examples.find(r=>r.id===t)},R=(e,t)=>{if(t!==void 0)return e.questions.find(r=>r.id===t)},U=(e,t)=>{if(t===void 0)return;const r=T(e,t);if(r)return{kind:"story",id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}};const a=y(e,t);if(a)return{kind:"rule",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const n=b(e,t);if(n)return{kind:"example",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const o=R(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},ae=(e,t)=>e.rules.filter(r=>r.storyId===t),ne=(e,t)=>e.examples.filter(r=>r.ruleId===t),oe=(e,t)=>e.questions.filter(r=>r.ruleId===t),nt=(e,t)=>{if(T(e,t))return t;const r=y(e,t);if(r)return r.storyId;const a=b(e,t)?.ruleId??R(e,t)?.ruleId;return a===void 0?void 0:y(e,a)?.storyId},ie=e=>[...e.stories.map(t=>t.id),...e.rules.map(t=>t.id),...e.examples.map(t=>t.id),...e.questions.map(t=>t.id)],de=(e,t)=>y(e,t)?.storyId,ot=(e,t)=>{const r=b(e,t);return r?de(e,r.ruleId):void 0},se=(e,t)=>{const r=Pe(u,t);if(r===null)return null;const a=r.target.id;switch(r.type){case"SET_STORY_NAME":return le(e,a,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return le(e,a,n=>({...n,description:r.payload.description}));case"REORDER_STORY":{const n=Ee(e.stories,a,r.payload.after);return n===null?null:{...e,stories:n}}case"ADD_STORY":{const n=r.payload;return e.stories.some(o=>o.id===n.id)?e:P(e,n.id)?null:{...e,stories:[...e.stories,{id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===a))return null;const n=new Set(e.rules.filter(o=>o.storyId===a).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==a),rules:e.rules.filter(o=>o.storyId!==a),examples:e.examples.filter(o=>!n.has(o.ruleId)),questions:e.questions.filter(o=>!n.has(o.ruleId))}}case"SET_RULE_NAME":return pe(e,a,n=>({...n,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return pe(e,a,n=>({...n,description:r.payload.description}));case"MOVE_RULE":{const n=r.payload,o=y(e,a);if(!o||!e.stories.some(d=>d.id===n.storyId))return null;const i=e.rules.filter(d=>d.storyId===n.storyId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,rules:me(e.rules,{...o,storyId:n.storyId},n.after)}}case"REORDER_RULE":{const n=y(e,a);if(!n)return null;const o=e.rules.filter(i=>i.storyId===n.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:me(e.rules,n,r.payload.after)}}case"ADD_RULE":{const n=r.payload,o=T(e,a);return o?e.rules.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,rules:[...e.rules,{id:n.id,storyId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_RULE":return y(e,a)?{...e,rules:e.rules.filter(n=>n.id!==a),examples:e.examples.filter(n=>n.ruleId!==a),questions:e.questions.filter(n=>n.ruleId!==a)}:null;case"SET_EXAMPLE_NAME":return ue(e,a,n=>({...n,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ue(e,a,n=>({...n,description:r.payload.description}));case"MOVE_EXAMPLE":{const n=r.payload,o=b(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.examples.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,examples:Q(e.examples,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_EXAMPLE":{const n=b(e,a);if(!n)return null;const o=e.examples.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:Q(e.examples,n,r.payload.after)}}case"ADD_EXAMPLE":{const n=r.payload,o=y(e,a);return o?e.examples.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,examples:[...e.examples,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_EXAMPLE":return b(e,a)?{...e,examples:e.examples.filter(n=>n.id!==a)}:null;case"SET_QUESTION_NAME":return ce(e,a,n=>({...n,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,a,n=>({...n,description:r.payload.description}));case"MOVE_QUESTION":{const n=r.payload,o=R(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.questions.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,questions:Q(e.questions,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_QUESTION":{const n=R(e,a);if(!n)return null;const o=e.questions.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:Q(e.questions,n,r.payload.after)}}case"ADD_QUESTION":{const n=r.payload,o=y(e,a);return o?e.questions.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,questions:[...e.questions,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_QUESTION":return R(e,a)?{...e,questions:e.questions.filter(n=>n.id!==a)}:null;default:return Qe(r)}},P=(e,t)=>e.stories.some(r=>r.id===t)||e.rules.some(r=>r.id===t)||e.examples.some(r=>r.id===t)||e.questions.some(r=>r.id===t),le=(e,t,r)=>e.stories.some(a=>a.id===t)?{...e,stories:e.stories.map(a=>a.id===t?r(a):a)}:null,pe=(e,t,r)=>e.rules.some(a=>a.id===t)?{...e,rules:e.rules.map(a=>a.id===t?r(a):a)}:null,ue=(e,t,r)=>e.examples.some(a=>a.id===t)?{...e,examples:e.examples.map(a=>a.id===t?r(a):a)}:null,ce=(e,t,r)=>e.questions.some(a=>a.id===t)?{...e,questions:e.questions.map(a=>a.id===t?r(a):a)}:null,me=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.storyId===t.storyId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.storyId===t.storyId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Q=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.ruleId===t.ruleId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.ruleId===t.ruleId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Ee=(e,t,r)=>{if(!e.some(o=>o.id===t)||r!==null&&!e.some(o=>o.id===r))return null;if(r===t)return[...e];const a=e.find(o=>o.id===t);if(a===void 0)return null;const n=e.filter(o=>o.id!==t);return F(n,a,r)},F=(e,t,r)=>{const a=[...e],n=r===null?-1:a.findIndex(o=>o.id===r);return a.splice(n+1,0,t),a},it={story:"Story",rule:"Rule",example:"Example",question:"Question"},dt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},st={empty:"No rules yet","open-questions":"Open questions","too-big":"Consider splitting",thin:"A rule has no example",ready:"Looks ready"},lt={empty:"\u30EB\u30FC\u30EB\u672A\u6574\u7406","open-questions":"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u3042\u308A","too-big":"\u5206\u5272\u3092\u691C\u8A0E",thin:"\u5177\u4F53\u4F8B\u306E\u7121\u3044\u30EB\u30FC\u30EB\u3042\u308A",ready:"\u5408\u610F\u3067\u304D\u305D\u3046"},C=Ce({en:{kindLabel:e=>it[e],readinessLabel:e=>st[e],map:"Map",cardKinds:"Card kinds",noStoriesTitle:"No stories yet",noStoriesBody:"Place one story (yellow), then line up the rules (blue) that accept it beneath it. For each rule, stack examples (green) in the top area and open questions (red) in the bottom area.",firstStory:"+ First story",addStoryButton:"+ Story",noExamples:"No examples yet",noQuestions:"No open questions",commentButton:"Comment",deleteButton:"Delete",nameField:e=>`${e} name`,newStory:"New story",newRule:"New rule",newExample:"New example",newQuestion:"New question",storyRenamedTitle:"Renamed the story",storyDescriptionUpdatedTitle:"Updated the story\u2019s description",storyReorderedTitle:"Reordered the story",storyAddedTitle:"Added a story",storyDeletedTitle:"Deleted the story",ruleRenamedTitle:"Renamed the rule",ruleDescriptionUpdatedTitle:"Updated the rule\u2019s description",ruleMovedTitle:"Moved the rule",ruleReorderedTitle:"Reordered the rule",ruleAddedTitle:"Added a rule",ruleDeletedTitle:"Deleted the rule",exampleRenamedTitle:"Renamed the example",exampleDescriptionUpdatedTitle:"Updated the example\u2019s description",exampleMovedTitle:"Moved the example",exampleReorderedTitle:"Reordered the example",exampleAddedTitle:"Added an example",exampleDeletedTitle:"Deleted the example",questionRenamedTitle:"Renamed the question",questionDescriptionUpdatedTitle:"Updated the question\u2019s description",questionMovedTitle:"Moved the question",questionReorderedTitle:"Reordered the question",questionAddedTitle:"Added a question",questionDeletedTitle:"Deleted the question",arrowTo:e=>`\u2192 \u201C${e}\u201D`,arrowFrom:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,toTop:"\u2192 To the top",afterPlacement:e=>`\u2192 After \u201C${e}\u201D`,wholeMap:"Whole map"},ja:{kindLabel:e=>dt[e],readinessLabel:e=>lt[e],map:"\u30DE\u30C3\u30D7",cardKinds:"\u30AB\u30FC\u30C9\u306E\u7A2E\u985E",noStoriesTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noStoriesBody:"\u30B9\u30C8\u30FC\u30EA\u30FC\uFF08\u9EC4\uFF09\u30921\u679A\u7F6E\u304D\u3001\u305D\u306E\u4E0B\u306B\u53D7\u3051\u5165\u308C\u6761\u4EF6\u3068\u306A\u308B\u30EB\u30FC\u30EB\uFF08\u9752\uFF09\u3092\u4E26\u3079\u307E\u3059\u3002\u30EB\u30FC\u30EB\u3054\u3068\u306B\u3001\u4E0A\u306E\u6B04\u3078\u5177\u4F53\u4F8B\uFF08\u7DD1\uFF09\u3092\u3001\u4E0B\u306E\u6B04\u3078\u7B54\u3048\u306E\u51FA\u306A\u3044\u8AD6\u70B9\u3092\u8CEA\u554F\uFF08\u8D64\uFF09\u3068\u3057\u3066\u7A4D\u307F\u307E\u3059\u3002",firstStory:"+ \u6700\u521D\u306E\u30B9\u30C8\u30FC\u30EA\u30FC",addStoryButton:"+ \u30B9\u30C8\u30FC\u30EA\u30FC",noExamples:"\u5177\u4F53\u4F8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noQuestions:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",nameField:e=>`${e}\u540D`,newStory:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC",newRule:"\u65B0\u3057\u3044\u30EB\u30FC\u30EB",newExample:"\u65B0\u3057\u3044\u5177\u4F53\u4F8B",newQuestion:"\u65B0\u3057\u3044\u8CEA\u554F",storyRenamedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",storyDescriptionUpdatedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",storyReorderedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",storyAddedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",storyDeletedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",ruleRenamedTitle:"\u30EB\u30FC\u30EB\u540D\u3092\u5909\u66F4",ruleDescriptionUpdatedTitle:"\u30EB\u30FC\u30EB\u306E\u8AAC\u660E\u3092\u66F4\u65B0",ruleMovedTitle:"\u30EB\u30FC\u30EB\u3092\u79FB\u52D5",ruleReorderedTitle:"\u30EB\u30FC\u30EB\u306E\u9806\u5E8F\u3092\u5909\u66F4",ruleAddedTitle:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",ruleDeletedTitle:"\u30EB\u30FC\u30EB\u3092\u524A\u9664",exampleRenamedTitle:"\u5177\u4F53\u4F8B\u540D\u3092\u5909\u66F4",exampleDescriptionUpdatedTitle:"\u5177\u4F53\u4F8B\u306E\u8AAC\u660E\u3092\u66F4\u65B0",exampleMovedTitle:"\u5177\u4F53\u4F8B\u3092\u79FB\u52D5",exampleReorderedTitle:"\u5177\u4F53\u4F8B\u306E\u9806\u5E8F\u3092\u5909\u66F4",exampleAddedTitle:"\u5177\u4F53\u4F8B\u3092\u8FFD\u52A0",exampleDeletedTitle:"\u5177\u4F53\u4F8B\u3092\u524A\u9664",questionRenamedTitle:"\u8CEA\u554F\u540D\u3092\u5909\u66F4",questionDescriptionUpdatedTitle:"\u8CEA\u554F\u306E\u8AAC\u660E\u3092\u66F4\u65B0",questionMovedTitle:"\u8CEA\u554F\u3092\u79FB\u52D5",questionReorderedTitle:"\u8CEA\u554F\u306E\u9806\u5E8F\u3092\u5909\u66F4",questionAddedTitle:"\u8CEA\u554F\u3092\u8FFD\u52A0",questionDeletedTitle:"\u8CEA\u554F\u3092\u524A\u9664",arrowTo:e=>`\u2192 \u300C${e}\u300D`,arrowFrom:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,toTop:"\u2192 \u5148\u982D\u3078",afterPlacement:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53"}}),X=(e,t,r)=>{const a=typeof r=="string"?r:"",n=typeof t=="string"?t:void 0;return n===void 0?e.arrowTo(a):e.arrowFrom(n,a)},pt={SET_STORY_NAME:(e,t,r)=>({title:e.storyRenamedTitle,tone:"update",body:X(e,T(r,t.target.id)?.name,g(u.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.storyDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),REORDER_STORY:(e,t)=>({title:e.storyReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.storyAddedTitle,tone:"create",body:e.added(String(g(u.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,r)=>({title:e.storyDeletedTitle,tone:"delete",body:e.deleted(T(r,t.target.id)?.name??t.target.id)}),SET_RULE_NAME:(e,t,r)=>({title:e.ruleRenamedTitle,tone:"update",body:X(e,y(r,t.target.id)?.name,g(u.SET_RULE_NAME,t).name??"")}),SET_RULE_DESCRIPTION:(e,t)=>({title:e.ruleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_RULE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_RULE:(e,t,r)=>({title:e.ruleMovedTitle,tone:"move",body:e.arrowTo(T(r,String(g(u.MOVE_RULE,t).storyId))?.name??String(g(u.MOVE_RULE,t).storyId??""))}),REORDER_RULE:(e,t)=>({title:e.ruleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_RULE,t).after)}),ADD_RULE:(e,t)=>({title:e.ruleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_RULE,t).name??""))}),DELETE_RULE:(e,t,r)=>({title:e.ruleDeletedTitle,tone:"delete",body:e.deleted(y(r,t.target.id)?.name??t.target.id)}),SET_EXAMPLE_NAME:(e,t,r)=>({title:e.exampleRenamedTitle,tone:"update",body:X(e,b(r,t.target.id)?.name,g(u.SET_EXAMPLE_NAME,t).name??"")}),SET_EXAMPLE_DESCRIPTION:(e,t)=>({title:e.exampleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_EXAMPLE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_EXAMPLE:(e,t,r)=>({title:e.exampleMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_EXAMPLE,t).ruleId))?.name??String(g(u.MOVE_EXAMPLE,t).ruleId??""))}),REORDER_EXAMPLE:(e,t)=>({title:e.exampleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_EXAMPLE,t).after)}),ADD_EXAMPLE:(e,t)=>({title:e.exampleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_EXAMPLE,t).name??""))}),DELETE_EXAMPLE:(e,t,r)=>({title:e.exampleDeletedTitle,tone:"delete",body:e.deleted(b(r,t.target.id)?.name??t.target.id)}),SET_QUESTION_NAME:(e,t,r)=>({title:e.questionRenamedTitle,tone:"update",body:X(e,R(r,t.target.id)?.name,g(u.SET_QUESTION_NAME,t).name??"")}),SET_QUESTION_DESCRIPTION:(e,t)=>({title:e.questionDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_QUESTION_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_QUESTION:(e,t,r)=>({title:e.questionMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_QUESTION,t).ruleId))?.name??String(g(u.MOVE_QUESTION,t).ruleId??""))}),REORDER_QUESTION:(e,t)=>({title:e.questionReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_QUESTION,t).after)}),ADD_QUESTION:(e,t)=>({title:e.questionAddedTitle,tone:"create",body:e.added(String(g(u.ADD_QUESTION,t).name??""))}),DELETE_QUESTION:(e,t,r)=>({title:e.questionDeletedTitle,tone:"delete",body:e.deleted(R(r,t.target.id)?.name??t.target.id)})},Y=(e,t)=>t==null?e.toTop:e.afterPlacement(t),ge=(e,t,r,a)=>{let n;try{const o=pt[t.type];n=o?o(e,t,a??r):{title:t.type,tone:"meta"}}catch{n={title:t.type,tone:"meta"}}return{title:n.title,targetLabel:xe(e,r,t.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ye=e=>`${e.type} ${I(e.target)} ${JSON.stringify(e.payload)}`,xe=(e,t,r)=>{try{switch(r.type){case"story":{const a=T(t,r.id);return a?`${e.kindLabel("story")} \xB7 ${a.name}`:`${e.kindLabel("story")} \xB7 ${r.id} (missing)`}case"rule":{const a=y(t,r.id);return a?`${e.kindLabel("rule")} \xB7 ${a.name}`:`${e.kindLabel("rule")} \xB7 ${r.id} (missing)`}case"example":{const a=b(t,r.id);return a?`${e.kindLabel("example")} \xB7 ${a.name}`:`${e.kindLabel("example")} \xB7 ${r.id} (missing)`}case"question":{const a=R(t,r.id);return a?`${e.kindLabel("question")} \xB7 ${a.name}`:`${e.kindLabel("question")} \xB7 ${r.id} (missing)`}case"page":return`${e.map} \xB7 ${j(t)}`;default:return`${r.type} \xB7 ${r.id}`}}catch{return`${r.type} \xB7 ${r.id}`}},fe=(e,t,r)=>{const a=[{value:"page:example-mapping",label:e.wholeMap,group:e.map}];for(const n of t.stories)a.push({value:I({type:"story",id:n.id}),label:n.name,group:e.kindLabel("story")});for(const n of t.rules){const o=T(t,n.storyId);a.push({value:I({type:"rule",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("rule")})}for(const n of t.examples){const o=y(t,n.ruleId);a.push({value:I({type:"example",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("example")})}for(const n of t.questions){const o=y(t,n.ruleId);a.push({value:I({type:"question",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("question")})}return a},he=(e,t,r)=>{const a=U(t,r.card);return a?{value:I({type:a.kind,id:a.id}),label:a.name,group:e.kindLabel(a.kind)}:null},ut=4,Te=(e,t,r)=>{const a=t.rules.filter(p=>p.storyId===r),n=new Set(a.map(p=>p.id)),o=t.examples.filter(p=>n.has(p.ruleId)),i=t.questions.filter(p=>n.has(p.ruleId)).length,d=a.some(p=>!o.some(l=>l.ruleId===p.id)),c=a.length===0?"empty":i>0?"open-questions":a.length>ut?"too-big":d?"thin":"ready";return{rules:a.length,examples:o.length,questions:i,readiness:c,label:e.readinessLabel(c)}},j=e=>e.title??"Example Mapping",be=(e,t)=>{const r=U(e,t.card),a={...t};return r?a.card=r.id:delete a.card,a},Re=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return U(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},Se=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:te,emptyBase:re,actions:u,apply:se,canonicalState:at,hasTarget:Re,describe:(r,a,n)=>ge(t,r,a,n),serialize:ye,resolveNavigation:be,commentTargets:(r,a)=>fe(t,r),currentTarget:(r,a)=>he(t,r,a),title:j}},B=(e,t,r)=>{const a=Xe(t,ie(e.state));return e.dispatch(r(a)).ok?(e.navigate({card:a}),a):null},ct=(e,t)=>B(e,"new-story",r=>L.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>L.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>L.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>L.addQuestion(r,a,t.newQuestion)),yt={width:300,height:260},ve=["story","rule","example","question"],_e={story:{bg:"linear-gradient(178deg, #fff3a6, #fde77a)",ink:"#4a3a06"},rule:{bg:"linear-gradient(178deg, #a3d1f5, #7cb8ea)",ink:"#0e2c4b"},example:{bg:"linear-gradient(178deg, #c9eb95, #a8dc63)",ink:"#22380a"},question:{bg:"linear-gradient(178deg, #fbc6d9, #f4a0c0)",ink:"#4b1029"}},O=e=>{const{bg:t,ink:r}=_e[e];return`--em-card-bg:${t};--em-card-ink:${r}`},xt=H`
2
2
  :host {
3
3
  position: relative;
4
4
  display: flex;
@@ -237,10 +237,10 @@ import{q as m,an as E,v as A,au as k,at as S,ad as s,af as x,ag as f,as as D,a9
237
237
  </section>
238
238
  `},_t=(e,t)=>{const{drag:r}=e;return h`
239
239
  <div class="rule-col" data-rule=${t.id} ?data-dragging=${r.isDragging("rule",t.id)}>
240
- ${W(e,"rule",t)} ${Ae(e,t.id,"example")}
241
- ${Ae(e,t.id,"question")}
240
+ ${W(e,"rule",t)} ${we(e,t.id,"example")}
241
+ ${we(e,t.id,"question")}
242
242
  </div>
243
- `},kt={example:"examples",question:"questions"},Dt=(e,t)=>({testid:kt[t],label:e.kindLabel(t),empty:t==="example"?e.noExamples:e.noQuestions,add:`+ ${e.kindLabel(t)}`}),Ae=(e,t,r)=>{const{context:a,drag:n,handlers:o,m:i}=e,d=Dt(i,r),c=`${d.testid}:${t}`,p=r==="example"?n.target({key:c,accepts:"example",hovered:we("example"),onDrop:_=>o.dropExample(t,_)}):n.target({key:c,accepts:"question",hovered:we("question"),onDrop:_=>o.dropQuestion(t,_)}),l=r==="example"?ne(a.state,t):oe(a.state,t),v=r==="example"?o.addExample:o.addQuestion;return h`<div
243
+ `},kt={example:"examples",question:"questions"},Dt=(e,t)=>({testid:kt[t],label:e.kindLabel(t),empty:t==="example"?e.noExamples:e.noQuestions,add:`+ ${e.kindLabel(t)}`}),we=(e,t,r)=>{const{context:a,drag:n,handlers:o,m:i}=e,d=Dt(i,r),c=`${d.testid}:${t}`,p=r==="example"?n.target({key:c,accepts:"example",hovered:Ae("example"),onDrop:_=>o.dropExample(t,_)}):n.target({key:c,accepts:"question",hovered:Ae("question"),onDrop:_=>o.dropQuestion(t,_)}),l=r==="example"?ne(a.state,t):oe(a.state,t),v=r==="example"?o.addExample:o.addQuestion;return h`<div
244
244
  class="card-area card-area--${r}"
245
245
  data-testid=${`${d.testid}-${t}`}
246
246
  data-drop=${String(n.isOver(c))}
@@ -253,7 +253,7 @@ import{q as m,an as E,v as A,au as k,at as S,ad as s,af as x,ag as f,as as D,a9
253
253
  ${z(l,_=>_.id,_=>W(e,r,_))}
254
254
  ${l.length===0?h`<p class="stack-hint">${d.empty}</p>`:$}
255
255
  <button class="add-card add-${r}" type="button" @click=${()=>v(t)}>${d.add}</button>
256
- </div>`},we=e=>t=>{const r=t.target instanceof Element?t.target.closest("dpk-internal-example-mapping-card"):null;return!r||r.getAttribute("data-card-kind")!==e?null:{id:r.getAttribute("data-card"),element:r}},Me=(e,t)=>r=>{const a=r.target instanceof Element?r.target.closest(e):null;return a?{id:a.getAttribute(`data-${t}`),element:a}:null},It=H`
256
+ </div>`},Ae=e=>t=>{const r=t.target instanceof Element?t.target.closest("dpk-internal-example-mapping-card"):null;return!r||r.getAttribute("data-card-kind")!==e?null:{id:r.getAttribute("data-card"),element:r}},Me=(e,t)=>r=>{const a=r.target instanceof Element?r.target.closest(e):null;return a?{id:a.getAttribute(`data-${t}`),element:a}:null},It=H`
257
257
  /* ------------------------------------------------------------ legend */
258
258
 
259
259
  .legend {
@@ -1,4 +1,4 @@
1
- import{_,a9 as N,aa as f,ab as c,ac as k,ad as p,au as G,af as R,ag as Y,ae as I,V as u,C as v,i as U,a3 as x,a1 as l,a2 as d,aG as J,ay as V,a7 as W,z as Q,a0 as X,T as w}from"./shared-CwbzACTe.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:G,layout:c(I(y),"content"),title:R(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 G,af as R,ag as Y,ae as I,V as u,C as v,i as U,a3 as x,a1 as l,a2 as d,aG as J,au as V,a7 as W,z as Q,a0 as X,T as w}from"./shared-CU-s47EI.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:G,layout:c(I(y),"content"),title:R(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{_ as w,a9 as v,aa as s,ab as o,ac as _,ad as l,au as B,af as E,ag as $,V as j,T as x}from"./shared-CwbzACTe.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-CU-s47EI.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{q as v,an as g,v as C,as as M,ad as l,au as D,af as p,ag as u,at as Y,a9 as Ce,aB as Ye,aa as N,ab as P,ac as V,P as Pe,f as Ve,_ as Ge,V as A,R as b,a0 as Z,a5 as Be,k as Ue,$ as W,a6 as qe,a1 as I,av as G,a2 as c,I as ze,A as je,K as Fe,i as He,m as L,a3 as $,J as Ke,B as Je,ax as Xe,T as Q}from"./shared-CwbzACTe.js";import{s as Ze,r as z,D as We}from"./shared-xrCdgpNS.js";import{P as ee,r as Qe,p as et,c as tt,a as it}from"./shared-CPAT0Cgk.js";const y={SET_ACTIVITY_NAME:v("SET_ACTIVITY_NAME","activity",g({name:p(l(),u(1))})),SET_STEP_NAME:v("SET_STEP_NAME","step",g({name:p(l(),u(1))})),REORDER_STEP:v("REORDER_STEP","step",g({after:M(l())}),{mode:"sequence"}),ADD_ACTIVITY:v("ADD_ACTIVITY","page",g({id:D,name:p(l(),u(1))}),{dedupeKey:C}),ADD_STEP:v("ADD_STEP","activity",g({id:D,name:p(l(),u(1))}),{dedupeKey:C}),DELETE_ACTIVITY:v("DELETE_ACTIVITY","activity",g({})),DELETE_STEP:v("DELETE_STEP","step",g({})),SET_STORY_NAME:v("SET_STORY_NAME","story",g({name:p(l(),u(1))})),SET_STORY_DESCRIPTION:v("SET_STORY_DESCRIPTION","story",g({description:l()})),SET_STORY_MILESTONE:v("SET_STORY_MILESTONE","story",g({milestoneId:M(l())})),MOVE_STORY:v("MOVE_STORY","story",g({activityId:p(l(),u(1)),stepId:p(l(),u(1)),milestoneId:M(l()),after:M(l())}),{mode:"sequence"}),REORDER_STORY:v("REORDER_STORY","story",g({after:M(l())}),{mode:"sequence"}),ADD_STORY:v("ADD_STORY","step",g({id:D,name:p(l(),u(1)),activityId:p(l(),u(1)),milestoneId:Y(l())}),{dedupeKey:C}),DELETE_STORY:v("DELETE_STORY","story",g({})),SET_MILESTONE_NAME:v("SET_MILESTONE_NAME","milestone",g({name:p(l(),u(1))})),ADD_MILESTONE:v("ADD_MILESTONE","page",g({id:D,name:p(l(),u(1))}),{dedupeKey:C}),DELETE_MILESTONE:v("DELETE_MILESTONE","milestone",g({})),REORDER_MILESTONE:v("REORDER_MILESTONE","milestone",g({after:M(l())}),{mode:"sequence"})},ot={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}})},rt=N({id:p(l(),u(1)),name:p(l(),u(1))}),at=N({id:D,name:p(l(),u(1)),steps:P(V(rt),[])}),nt=N({id:p(l(),u(1)),name:p(l(),u(1))}),st=N({id:D,name:p(l(),u(1)),description:Y(l()),activityId:p(l(),u(1)),stepId:p(l(),u(1)),milestoneId:Y(l())}),dt=N({title:Y(l()),activities:P(V(at),[]),milestones:P(V(nt),[]),stories:P(V(st),[])}),te=e=>{const t=Ce(dt,e),i=new Map;for(const n of t.activities)for(const s of n.steps)i.set(s.id,n.id);const o=new Set(t.milestones.map(n=>n.id)),r=new Set,a=(n,s)=>{if(r.has(s))throw new Error(`duplicate id "${s}" in ${n}`);r.add(s)};for(const n of t.activities){a("activities",n.id);for(const s of n.steps)a("steps",s.id)}for(const n of t.milestones)a("milestones",n.id);for(const n of t.stories){a("stories",n.id);const s=i.get(n.stepId);if(s===void 0||s!==n.activityId)throw new Error(`story "${n.id}" references unknown activityId/stepId`);if(n.milestoneId!==void 0&&!o.has(n.milestoneId))throw new Error(`story "${n.id}" references unknown milestoneId "${n.milestoneId}"`)}return t},ie=()=>({activities:[],milestones:[],stories:[]}),x=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},j=(e,t)=>`${e}.${t}`,E=(e,t)=>{if(t===void 0)return;const i=Ye(t,2);if(i){const[o,r]=i;if(o===void 0||r===void 0)return;const a=e.activities.find(s=>s.id===o),n=a?.steps.find(s=>s.id===r);return a&&n?{activity:a,step:n}:void 0}if(!t.includes("."))for(const o of e.activities){const r=o.steps.find(a=>a.id===t);if(r)return{activity:o,step:r}}},w=(e,t)=>{if(t!==void 0)return e.milestones.find(i=>i.id===t)},k=(e,t)=>{if(t!==void 0)return e.stories.find(i=>i.id===t)},oe=e=>e.activities.flatMap(t=>t.steps.map(i=>({activity:t,step:i}))),lt=e=>({...e,stories:Ze(e.stories,[t=>`${t.activityId}/${t.stepId}/${t.milestoneId??""}`])}),B=(e,t,i)=>e.stories.filter(o=>o.stepId===t&&(o.milestoneId??void 0)===i),re=(e,t,i)=>e.stories.filter(o=>o.activityId===t&&(o.milestoneId??void 0)===i),R=e=>[...e.activities.map(t=>t.id),...e.activities.flatMap(t=>t.steps.map(i=>i.id)),...e.milestones.map(t=>t.id),...e.stories.map(t=>t.id)],ct=(e,t)=>e.stories.filter(i=>i.stepId===t).length,ae=(e,t)=>{const i=Pe(y,t);if(i===null)return null;const o=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":{const{name:r}=i.payload;return e.activities.some(a=>a.id===o)?{...e,activities:e.activities.map(a=>a.id===o?{...a,name:r}:a)}:null}case"SET_STEP_NAME":{const{name:r}=i.payload,a=E(e,o);return a?{...e,activities:e.activities.map(n=>n.id===a.activity.id?{...n,steps:n.steps.map(s=>s.id===a.step.id?{...s,name:r}:s)}:n)}:null}case"REORDER_STEP":{const{after:r}=i.payload,a=E(e,o);if(!a)return null;const n=r===null?null:E(e,r);if(r!==null&&(!n||n.activity.id!==a.activity.id))return null;const s=se(a.activity.steps,a.step.id,n?.step.id??null);return s===null?null:{...e,activities:e.activities.map(d=>d.id===a.activity.id?{...d,steps:s}:d)}}case"ADD_ACTIVITY":{const r=i.payload;return e.activities.some(a=>a.id===r.id)?e:{...e,activities:[...e.activities,{id:r.id,name:r.name,steps:[]}]}}case"ADD_STEP":{const r=i.payload,a=e.activities.find(n=>n.id===o);return a?a.steps.some(n=>n.id===r.id)?e:{...e,activities:e.activities.map(n=>n.id===o?{...n,steps:[...n.steps,{id:r.id,name:r.name}]}:n)}:null}case"DELETE_ACTIVITY":{const r=e.activities.find(n=>n.id===o);if(!r)return null;const a=new Set(r.steps.map(n=>n.id));return{...e,activities:e.activities.filter(n=>n.id!==o),stories:e.stories.filter(n=>n.activityId!==o&&!a.has(n.stepId))}}case"DELETE_STEP":{const r=E(e,o);return r?{...e,activities:e.activities.map(a=>a.id===r.activity.id?{...a,steps:a.steps.filter(n=>n.id!==r.step.id)}:a),stories:e.stories.filter(a=>a.activityId!==r.activity.id||a.stepId!==r.step.id)}:null}case"SET_STORY_NAME":{const{name:r}=i.payload;return F(e,o,a=>({...a,name:r}))}case"SET_STORY_DESCRIPTION":{const{description:r}=i.payload;return F(e,o,a=>({...a,description:r}))}case"SET_STORY_MILESTONE":{const{milestoneId:r}=i.payload;return r!==null&&!w(e,r)?null:F(e,o,a=>r===null?H(a):{...a,milestoneId:r})}case"MOVE_STORY":{const r=i.payload,a=k(e,o);if(!a)return null;const n=E(e,r.stepId);if(!n||n.activity.id!==r.activityId||r.milestoneId!==null&&!w(e,r.milestoneId))return null;const s=r.milestoneId??void 0,d=s===void 0?{...H(a),activityId:n.activity.id,stepId:n.step.id}:{...a,activityId:n.activity.id,stepId:n.step.id,milestoneId:s};return ne(e,d,r.after)}case"REORDER_STORY":{const{after:r}=i.payload,a=k(e,o);return a?ne(e,a,r,!0):null}case"ADD_STORY":{const r=i.payload,a=E(e,t.target.id);if(!a||a.activity.id!==r.activityId||r.milestoneId!==void 0&&!w(e,r.milestoneId))return null;if(e.stories.some(s=>s.id===r.id))return e;const n={id:r.id,name:r.name,activityId:r.activityId,stepId:a.step.id,...r.milestoneId===void 0?{}:{milestoneId:r.milestoneId}};return{...e,stories:[...e.stories,n]}}case"DELETE_STORY":return e.stories.some(r=>r.id===o)?{...e,stories:e.stories.filter(r=>r.id!==o)}:null;case"SET_MILESTONE_NAME":{const{name:r}=i.payload;return e.milestones.some(a=>a.id===o)?{...e,milestones:e.milestones.map(a=>a.id===o?{...a,name:r}:a)}:null}case"ADD_MILESTONE":{const r=i.payload;return e.milestones.some(a=>a.id===r.id)?e:{...e,milestones:[...e.milestones,{id:r.id,name:r.name}]}}case"DELETE_MILESTONE":return e.milestones.some(r=>r.id===o)?{...e,milestones:e.milestones.filter(r=>r.id!==o),stories:e.stories.map(r=>r.milestoneId===o?H(r):r)}:null;case"REORDER_MILESTONE":{const{after:r}=i.payload,a=se(e.milestones,o,r);return a===null?null:{...e,milestones:a}}default:return Ve(i)}},F=(e,t,i)=>e.stories.some(o=>o.id===t)?{...e,stories:e.stories.map(o=>o.id===t?i(o):o)}:null,H=e=>{const{milestoneId:t,...i}=e;return i},ne=(e,t,i,o=!1)=>{const r=t.milestoneId??void 0,a=e.stories.filter(h=>h.id!==t.id),n=a.filter(h=>h.stepId===t.stepId&&(h.milestoneId??void 0)===r);if(i!==null){const h=a.find(O=>O.id===i);if(!h||h.stepId!==t.stepId||(h.milestoneId??void 0)!==r)return null;if(o){const O=k(e,t.id);if(!O||h.stepId!==O.stepId||(h.milestoneId??void 0)!==(O.milestoneId??void 0))return null}}const s=i===null?[t,...n]:de(n,t,i),d=a.findIndex(h=>h.stepId===t.stepId&&(h.milestoneId??void 0)===r),m=new Set(n.map(h=>h.id)),S=a.filter(h=>!m.has(h.id)),f=d<0?S.length:Math.min(d,S.length),T=[...S.slice(0,f),...s,...S.slice(f)];return{...e,stories:T}},se=(e,t,i)=>{if(!e.some(a=>a.id===t)||i!==null&&!e.some(a=>a.id===i))return null;if(i===t)return[...e];const o=e.find(a=>a.id===t);if(o===void 0)return null;const r=e.filter(a=>a.id!==t);return de(r,o,i)},de=(e,t,i)=>{const o=[...e],r=i===null?-1:o.findIndex(a=>a.id===i);return o.splice(r+1,0,t),o},U=Ge({en:{renameActivity:"Rename activity",renameStep:"Rename step",reorderStep:"Reorder step",addActivity:"Add activity",addStep:"Add step",deleteActivity:"Delete activity",deleteStep:"Delete step",renameStory:"Rename story",updateStoryDescription:"Update story description",changeMilestone:"Change milestone",moveStory:"Move story",reorderStory:"Reorder story",addStory:"Add story",deleteStory:"Delete story",renameMilestone:"Rename milestone",addMilestone:"Add milestone",deleteMilestone:"Delete milestone",reorderMilestone:"Reorder milestone",toValue:e=>`\u2192 \u201C${e}\u201D`,fromTo:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,removed:e=>`\u2212 \u201C${e}\u201D`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after \u201C${e}\u201D`,toUnassigned:"\u2192 Unassigned",toName:e=>`\u2192 ${e}`,activityGroup:"Activity",stepGroup:"Step",storyGroup:"Story",milestoneGroup:"Milestone",mapGroup:"Map",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,wholeMap:"Whole map",unassigned:"Unassigned",emptyTitle:"No backbone yet",emptyBody:"Add activities and steps, and the story map appears here.",firstActivityButton:"+ First activity",groupingLabel:"Group by",groupViewTab:"Activity group",groupAxisHeader:"Activity group \u2192",activityAxis:"Activity \u2192",milestoneAxis:"Milestone \u2193",stepNameLabel:"Step name",activityNameLabel:"Activity name",milestoneNameLabel:"Milestone name",addStepAria:"Add a step to this activity",newActivityButton:"+ Activity",newMilestoneButton:"+ Milestone",addCellButton:"+ Add",addStoryCellAria:"Add a story to this cell",moveDialogLabel:"Step to move to",moveDialogSelectLabel:"Destination",moveConfirm:"Move",moveCancel:"Cancel",storyNameLabel:"Story name",editTitleAria:"Edit title",commentAria:"Comment",deleteAria:"Delete",newActivityName:"New activity",newStepName:"New step",newMilestoneName:"New milestone",newStoryName:"New story"},ja:{renameActivity:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u540D\u3092\u5909\u66F4",renameStep:"\u30B9\u30C6\u30C3\u30D7\u540D\u3092\u5909\u66F4",reorderStep:"\u30B9\u30C6\u30C3\u30D7\u306E\u9806\u5E8F\u3092\u5909\u66F4",addActivity:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u8FFD\u52A0",addStep:"\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0",deleteActivity:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u524A\u9664",deleteStep:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",renameStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",updateStoryDescription:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",changeMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u5909\u66F4",moveStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u79FB\u52D5",reorderStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",addStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",deleteStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",renameMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u540D\u3092\u5909\u66F4",addMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u8FFD\u52A0",deleteMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u524A\u9664",reorderMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u306E\u9806\u5E8F\u3092\u5909\u66F4",toValue:e=>`\u2192 \u300C${e}\u300D`,fromTo:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,removed:e=>`\u2212 \u300C${e}\u300D`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,toUnassigned:"\u2192 \u672A\u5272\u5F53\u3078",toName:e=>`\u2192 ${e}`,activityGroup:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",stepGroup:"\u30B9\u30C6\u30C3\u30D7",storyGroup:"\u30B9\u30C8\u30FC\u30EA\u30FC",milestoneGroup:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3",mapGroup:"\u30DE\u30C3\u30D7",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53",unassigned:"\u672A\u5272\u5F53",emptyTitle:"\u30D0\u30C3\u30AF\u30DC\u30FC\u30F3\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",emptyBody:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3068\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u30B9\u30C8\u30FC\u30EA\u30FC\u30DE\u30C3\u30D7\u304C\u73FE\u308C\u307E\u3059\u3002",firstActivityButton:"+ \u6700\u521D\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",groupingLabel:"\u307E\u3068\u3081\u308B\u5358\u4F4D",groupViewTab:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u30B0\u30EB\u30FC\u30D7",groupAxisHeader:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u30B0\u30EB\u30FC\u30D7 \u2192",activityAxis:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3 \u2192",milestoneAxis:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3 \u2193",stepNameLabel:"\u30B9\u30C6\u30C3\u30D7\u540D",activityNameLabel:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u540D",milestoneNameLabel:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u540D",addStepAria:"\u3053\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u306B\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0",newActivityButton:"+ \u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",newMilestoneButton:"+ \u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3",addCellButton:"+ \u8FFD\u52A0",addStoryCellAria:"\u3053\u306E\u30DE\u30B9\u306B\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",moveDialogLabel:"\u79FB\u52D5\u5148\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",moveDialogSelectLabel:"\u79FB\u52D5\u5148",moveConfirm:"\u79FB\u52D5\u3059\u308B",moveCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",storyNameLabel:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D",editTitleAria:"\u30BF\u30A4\u30C8\u30EB\u3092\u7DE8\u96C6",commentAria:"\u30B3\u30E1\u30F3\u30C8",deleteAria:"\u524A\u9664",newActivityName:"\u65B0\u3057\u3044\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",newMilestoneName:"\u65B0\u3057\u3044\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3",newStoryName:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC"}}),q=(e,t,i)=>{const o=typeof i=="string"?i:"",r=typeof t=="string"?t:void 0;return r===void 0?e.toValue(o):e.fromTo(r,o)},K=(e,t)=>typeof t=="string"?e.afterName(t):e.toFront,pt={SET_ACTIVITY_NAME:(e,t,i)=>({title:e.renameActivity,tone:"update",body:q(e,x(i,t.target.id)?.name,b(y.SET_ACTIVITY_NAME,t).name??"")}),SET_STEP_NAME:(e,t,i)=>({title:e.renameStep,tone:"update",body:q(e,E(i,t.target.id)?.step.name,b(y.SET_STEP_NAME,t).name??"")}),REORDER_STEP:(e,t)=>({title:e.reorderStep,tone:"move",body:K(e,b(y.REORDER_STEP,t).after)}),ADD_ACTIVITY:(e,t)=>({title:e.addActivity,tone:"create",body:e.added(String(b(y.ADD_ACTIVITY,t).name??""))}),ADD_STEP:(e,t)=>({title:e.addStep,tone:"create",body:e.added(String(b(y.ADD_STEP,t).name??""))}),DELETE_ACTIVITY:(e,t,i)=>({title:e.deleteActivity,tone:"delete",body:e.removed(x(i,t.target.id)?.name??t.target.id)}),DELETE_STEP:(e,t,i)=>({title:e.deleteStep,tone:"delete",body:e.removed(E(i,t.target.id)?.step.name??t.target.id)}),SET_STORY_NAME:(e,t,i)=>({title:e.renameStory,tone:"update",body:q(e,k(i,t.target.id)?.name,b(y.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.updateStoryDescription,tone:"update",body:e.toValue(String(b(y.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),SET_STORY_MILESTONE:(e,t,i)=>{const o=b(y.SET_STORY_MILESTONE,t).milestoneId;return{title:e.changeMilestone,tone:"move",body:o==null?e.toUnassigned:e.toName(w(i,String(o))?.name??String(o))}},MOVE_STORY:(e,t,i)=>({title:e.moveStory,tone:"move",body:e.toName(E(i,String(b(y.MOVE_STORY,t).stepId))?.step.name??String(b(y.MOVE_STORY,t).stepId??""))}),REORDER_STORY:(e,t)=>({title:e.reorderStory,tone:"move",body:K(e,b(y.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.addStory,tone:"create",body:e.added(String(b(y.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,i)=>({title:e.deleteStory,tone:"delete",body:e.removed(k(i,t.target.id)?.name??t.target.id)}),SET_MILESTONE_NAME:(e,t,i)=>({title:e.renameMilestone,tone:"update",body:q(e,w(i,t.target.id)?.name,b(y.SET_MILESTONE_NAME,t).name??"")}),ADD_MILESTONE:(e,t)=>({title:e.addMilestone,tone:"create",body:e.added(String(b(y.ADD_MILESTONE,t).name??""))}),DELETE_MILESTONE:(e,t,i)=>({title:e.deleteMilestone,tone:"delete",body:e.removed(w(i,t.target.id)?.name??t.target.id)}),REORDER_MILESTONE:(e,t)=>({title:e.reorderMilestone,tone:"move",body:K(e,b(y.REORDER_MILESTONE,t).after)})},le=(e,t,i,o)=>{let r;try{const a=pt[t.type];r=a?a(e,t,o??i):{title:t.type,tone:"meta"}}catch{r={title:t.type,tone:"meta"}}return{title:r.title,targetLabel:pe(e,i,t.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},ce=e=>`${e.type} ${A(e.target)} ${JSON.stringify(e.payload)}`,pe=(e,t,i)=>{try{switch(i.type){case"activity":{const o=x(t,i.id);return o?e.targetLabel(e.activityGroup,o.name):e.targetMissing(e.activityGroup,i.id)}case"step":{const o=E(t,i.id)?.step;return o?e.targetLabel(e.stepGroup,o.name):e.targetMissing(e.stepGroup,i.id)}case"story":{const o=k(t,i.id);return o?e.targetLabel(e.storyGroup,o.name):e.targetMissing(e.storyGroup,i.id)}case"milestone":{const o=w(t,i.id);return o?e.targetLabel(e.milestoneGroup,o.name):e.targetMissing(e.milestoneGroup,i.id)}case"page":return e.targetLabel(e.mapGroup,J(t));default:return`${i.type} \xB7 ${i.id}`}}catch{return`${i.type} \xB7 ${i.id}`}},ue=(e,t,i)=>{const o=[{value:"page:usm",label:e.wholeMap,group:e.mapGroup}];for(const r of t.activities){o.push({value:A({type:"activity",id:r.id}),label:r.name,group:e.activityGroup});for(const a of r.steps)o.push({value:A({type:"step",id:j(r.id,a.id)}),label:`${r.name} \u203A ${a.name}`,group:e.stepGroup})}for(const r of t.milestones)o.push({value:A({type:"milestone",id:r.id}),label:r.name,group:e.milestoneGroup});for(const r of t.stories)o.push({value:A({type:"story",id:r.id}),label:r.name,group:e.storyGroup});return o},me=(e,t,i)=>{const o=t.stories.find(r=>r.id===i.story);if(o)return{value:A({type:"story",id:o.id}),label:o.name,group:e.storyGroup};for(const r of t.activities){const a=r.steps.find(n=>n.id===i.step);if(a)return{value:A({type:"step",id:j(r.id,a.id)}),label:a.name,group:e.stepGroup}}return null},J=e=>e.title??"User Story Mapping",ve=(e,t)=>{const i=E(e,t.step),o=i?.activity??x(e,t.activity)??e.activities[0],r=i?.step??o?.steps.find(s=>s.id===t.step)??o?.steps[0],a=k(e,t.story),n={...t};return o?n.activity=o.id:delete n.activity,r?n.step=r.id:delete n.step,a?n.story=a.id:delete n.story,n.view=t.view==="group"?"group":"activity",n},ge=(e,t)=>{switch(t.type){case"activity":return x(e,t.id)!==void 0;case"step":return E(e,t.id)!==void 0;case"story":return k(e,t.id)!==void 0;case"milestone":return w(e,t.id)!==void 0;case"page":return!0;default:return!1}},ye=e=>{const t=U(e);return{name:"usm",label:"User Story Mapping",parseBase:te,emptyBase:ie,actions:y,apply:ae,canonicalState:lt,hasTarget:ge,canonicalTarget:(i,o)=>{if(o.type!=="step")return o;const r=E(i,o.id);return r?{...o,id:j(r.activity.id,r.step.id)}:o},describe:(i,o,r)=>le(t,i,o,r),serialize:ce,resolveNavigation:ve,commentTargets:(i,o)=>ue(t,i),currentTarget:(i,o)=>me(t,i,o),title:J}},ut={width:300,height:260},mt=Z`
1
+ import{q as v,an as g,v as C,as as M,ad as l,at as D,af as p,ag as u,av as Y,a9 as Ce,aB as Ye,aa as N,ab as P,ac as V,P as Pe,f as Ve,_ as Ge,V as A,R as b,a0 as Z,a5 as Be,k as Ue,$ as W,a6 as qe,a1 as I,aw as G,a2 as c,I as ze,A as je,K as Fe,i as He,m as L,a3 as $,J as Ke,B as Je,ay as Xe,T as Q}from"./shared-CU-s47EI.js";import{s as Ze,r as z,D as We}from"./shared-xrCdgpNS.js";import{P as ee,r as Qe,p as et,c as tt,a as it}from"./shared-CvU8S9Oz.js";const y={SET_ACTIVITY_NAME:v("SET_ACTIVITY_NAME","activity",g({name:p(l(),u(1))})),SET_STEP_NAME:v("SET_STEP_NAME","step",g({name:p(l(),u(1))})),REORDER_STEP:v("REORDER_STEP","step",g({after:M(l())}),{mode:"sequence"}),ADD_ACTIVITY:v("ADD_ACTIVITY","page",g({id:D,name:p(l(),u(1))}),{dedupeKey:C}),ADD_STEP:v("ADD_STEP","activity",g({id:D,name:p(l(),u(1))}),{dedupeKey:C}),DELETE_ACTIVITY:v("DELETE_ACTIVITY","activity",g({})),DELETE_STEP:v("DELETE_STEP","step",g({})),SET_STORY_NAME:v("SET_STORY_NAME","story",g({name:p(l(),u(1))})),SET_STORY_DESCRIPTION:v("SET_STORY_DESCRIPTION","story",g({description:l()})),SET_STORY_MILESTONE:v("SET_STORY_MILESTONE","story",g({milestoneId:M(l())})),MOVE_STORY:v("MOVE_STORY","story",g({activityId:p(l(),u(1)),stepId:p(l(),u(1)),milestoneId:M(l()),after:M(l())}),{mode:"sequence"}),REORDER_STORY:v("REORDER_STORY","story",g({after:M(l())}),{mode:"sequence"}),ADD_STORY:v("ADD_STORY","step",g({id:D,name:p(l(),u(1)),activityId:p(l(),u(1)),milestoneId:Y(l())}),{dedupeKey:C}),DELETE_STORY:v("DELETE_STORY","story",g({})),SET_MILESTONE_NAME:v("SET_MILESTONE_NAME","milestone",g({name:p(l(),u(1))})),ADD_MILESTONE:v("ADD_MILESTONE","page",g({id:D,name:p(l(),u(1))}),{dedupeKey:C}),DELETE_MILESTONE:v("DELETE_MILESTONE","milestone",g({})),REORDER_MILESTONE:v("REORDER_MILESTONE","milestone",g({after:M(l())}),{mode:"sequence"})},ot={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}})},rt=N({id:p(l(),u(1)),name:p(l(),u(1))}),at=N({id:D,name:p(l(),u(1)),steps:P(V(rt),[])}),nt=N({id:p(l(),u(1)),name:p(l(),u(1))}),st=N({id:D,name:p(l(),u(1)),description:Y(l()),activityId:p(l(),u(1)),stepId:p(l(),u(1)),milestoneId:Y(l())}),dt=N({title:Y(l()),activities:P(V(at),[]),milestones:P(V(nt),[]),stories:P(V(st),[])}),te=e=>{const t=Ce(dt,e),i=new Map;for(const n of t.activities)for(const s of n.steps)i.set(s.id,n.id);const o=new Set(t.milestones.map(n=>n.id)),r=new Set,a=(n,s)=>{if(r.has(s))throw new Error(`duplicate id "${s}" in ${n}`);r.add(s)};for(const n of t.activities){a("activities",n.id);for(const s of n.steps)a("steps",s.id)}for(const n of t.milestones)a("milestones",n.id);for(const n of t.stories){a("stories",n.id);const s=i.get(n.stepId);if(s===void 0||s!==n.activityId)throw new Error(`story "${n.id}" references unknown activityId/stepId`);if(n.milestoneId!==void 0&&!o.has(n.milestoneId))throw new Error(`story "${n.id}" references unknown milestoneId "${n.milestoneId}"`)}return t},ie=()=>({activities:[],milestones:[],stories:[]}),x=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},j=(e,t)=>`${e}.${t}`,E=(e,t)=>{if(t===void 0)return;const i=Ye(t,2);if(i){const[o,r]=i;if(o===void 0||r===void 0)return;const a=e.activities.find(s=>s.id===o),n=a?.steps.find(s=>s.id===r);return a&&n?{activity:a,step:n}:void 0}if(!t.includes("."))for(const o of e.activities){const r=o.steps.find(a=>a.id===t);if(r)return{activity:o,step:r}}},w=(e,t)=>{if(t!==void 0)return e.milestones.find(i=>i.id===t)},k=(e,t)=>{if(t!==void 0)return e.stories.find(i=>i.id===t)},oe=e=>e.activities.flatMap(t=>t.steps.map(i=>({activity:t,step:i}))),lt=e=>({...e,stories:Ze(e.stories,[t=>`${t.activityId}/${t.stepId}/${t.milestoneId??""}`])}),B=(e,t,i)=>e.stories.filter(o=>o.stepId===t&&(o.milestoneId??void 0)===i),re=(e,t,i)=>e.stories.filter(o=>o.activityId===t&&(o.milestoneId??void 0)===i),R=e=>[...e.activities.map(t=>t.id),...e.activities.flatMap(t=>t.steps.map(i=>i.id)),...e.milestones.map(t=>t.id),...e.stories.map(t=>t.id)],ct=(e,t)=>e.stories.filter(i=>i.stepId===t).length,ae=(e,t)=>{const i=Pe(y,t);if(i===null)return null;const o=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":{const{name:r}=i.payload;return e.activities.some(a=>a.id===o)?{...e,activities:e.activities.map(a=>a.id===o?{...a,name:r}:a)}:null}case"SET_STEP_NAME":{const{name:r}=i.payload,a=E(e,o);return a?{...e,activities:e.activities.map(n=>n.id===a.activity.id?{...n,steps:n.steps.map(s=>s.id===a.step.id?{...s,name:r}:s)}:n)}:null}case"REORDER_STEP":{const{after:r}=i.payload,a=E(e,o);if(!a)return null;const n=r===null?null:E(e,r);if(r!==null&&(!n||n.activity.id!==a.activity.id))return null;const s=se(a.activity.steps,a.step.id,n?.step.id??null);return s===null?null:{...e,activities:e.activities.map(d=>d.id===a.activity.id?{...d,steps:s}:d)}}case"ADD_ACTIVITY":{const r=i.payload;return e.activities.some(a=>a.id===r.id)?e:{...e,activities:[...e.activities,{id:r.id,name:r.name,steps:[]}]}}case"ADD_STEP":{const r=i.payload,a=e.activities.find(n=>n.id===o);return a?a.steps.some(n=>n.id===r.id)?e:{...e,activities:e.activities.map(n=>n.id===o?{...n,steps:[...n.steps,{id:r.id,name:r.name}]}:n)}:null}case"DELETE_ACTIVITY":{const r=e.activities.find(n=>n.id===o);if(!r)return null;const a=new Set(r.steps.map(n=>n.id));return{...e,activities:e.activities.filter(n=>n.id!==o),stories:e.stories.filter(n=>n.activityId!==o&&!a.has(n.stepId))}}case"DELETE_STEP":{const r=E(e,o);return r?{...e,activities:e.activities.map(a=>a.id===r.activity.id?{...a,steps:a.steps.filter(n=>n.id!==r.step.id)}:a),stories:e.stories.filter(a=>a.activityId!==r.activity.id||a.stepId!==r.step.id)}:null}case"SET_STORY_NAME":{const{name:r}=i.payload;return F(e,o,a=>({...a,name:r}))}case"SET_STORY_DESCRIPTION":{const{description:r}=i.payload;return F(e,o,a=>({...a,description:r}))}case"SET_STORY_MILESTONE":{const{milestoneId:r}=i.payload;return r!==null&&!w(e,r)?null:F(e,o,a=>r===null?H(a):{...a,milestoneId:r})}case"MOVE_STORY":{const r=i.payload,a=k(e,o);if(!a)return null;const n=E(e,r.stepId);if(!n||n.activity.id!==r.activityId||r.milestoneId!==null&&!w(e,r.milestoneId))return null;const s=r.milestoneId??void 0,d=s===void 0?{...H(a),activityId:n.activity.id,stepId:n.step.id}:{...a,activityId:n.activity.id,stepId:n.step.id,milestoneId:s};return ne(e,d,r.after)}case"REORDER_STORY":{const{after:r}=i.payload,a=k(e,o);return a?ne(e,a,r,!0):null}case"ADD_STORY":{const r=i.payload,a=E(e,t.target.id);if(!a||a.activity.id!==r.activityId||r.milestoneId!==void 0&&!w(e,r.milestoneId))return null;if(e.stories.some(s=>s.id===r.id))return e;const n={id:r.id,name:r.name,activityId:r.activityId,stepId:a.step.id,...r.milestoneId===void 0?{}:{milestoneId:r.milestoneId}};return{...e,stories:[...e.stories,n]}}case"DELETE_STORY":return e.stories.some(r=>r.id===o)?{...e,stories:e.stories.filter(r=>r.id!==o)}:null;case"SET_MILESTONE_NAME":{const{name:r}=i.payload;return e.milestones.some(a=>a.id===o)?{...e,milestones:e.milestones.map(a=>a.id===o?{...a,name:r}:a)}:null}case"ADD_MILESTONE":{const r=i.payload;return e.milestones.some(a=>a.id===r.id)?e:{...e,milestones:[...e.milestones,{id:r.id,name:r.name}]}}case"DELETE_MILESTONE":return e.milestones.some(r=>r.id===o)?{...e,milestones:e.milestones.filter(r=>r.id!==o),stories:e.stories.map(r=>r.milestoneId===o?H(r):r)}:null;case"REORDER_MILESTONE":{const{after:r}=i.payload,a=se(e.milestones,o,r);return a===null?null:{...e,milestones:a}}default:return Ve(i)}},F=(e,t,i)=>e.stories.some(o=>o.id===t)?{...e,stories:e.stories.map(o=>o.id===t?i(o):o)}:null,H=e=>{const{milestoneId:t,...i}=e;return i},ne=(e,t,i,o=!1)=>{const r=t.milestoneId??void 0,a=e.stories.filter(h=>h.id!==t.id),n=a.filter(h=>h.stepId===t.stepId&&(h.milestoneId??void 0)===r);if(i!==null){const h=a.find(O=>O.id===i);if(!h||h.stepId!==t.stepId||(h.milestoneId??void 0)!==r)return null;if(o){const O=k(e,t.id);if(!O||h.stepId!==O.stepId||(h.milestoneId??void 0)!==(O.milestoneId??void 0))return null}}const s=i===null?[t,...n]:de(n,t,i),d=a.findIndex(h=>h.stepId===t.stepId&&(h.milestoneId??void 0)===r),m=new Set(n.map(h=>h.id)),S=a.filter(h=>!m.has(h.id)),f=d<0?S.length:Math.min(d,S.length),T=[...S.slice(0,f),...s,...S.slice(f)];return{...e,stories:T}},se=(e,t,i)=>{if(!e.some(a=>a.id===t)||i!==null&&!e.some(a=>a.id===i))return null;if(i===t)return[...e];const o=e.find(a=>a.id===t);if(o===void 0)return null;const r=e.filter(a=>a.id!==t);return de(r,o,i)},de=(e,t,i)=>{const o=[...e],r=i===null?-1:o.findIndex(a=>a.id===i);return o.splice(r+1,0,t),o},U=Ge({en:{renameActivity:"Rename activity",renameStep:"Rename step",reorderStep:"Reorder step",addActivity:"Add activity",addStep:"Add step",deleteActivity:"Delete activity",deleteStep:"Delete step",renameStory:"Rename story",updateStoryDescription:"Update story description",changeMilestone:"Change milestone",moveStory:"Move story",reorderStory:"Reorder story",addStory:"Add story",deleteStory:"Delete story",renameMilestone:"Rename milestone",addMilestone:"Add milestone",deleteMilestone:"Delete milestone",reorderMilestone:"Reorder milestone",toValue:e=>`\u2192 \u201C${e}\u201D`,fromTo:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,removed:e=>`\u2212 \u201C${e}\u201D`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after \u201C${e}\u201D`,toUnassigned:"\u2192 Unassigned",toName:e=>`\u2192 ${e}`,activityGroup:"Activity",stepGroup:"Step",storyGroup:"Story",milestoneGroup:"Milestone",mapGroup:"Map",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,wholeMap:"Whole map",unassigned:"Unassigned",emptyTitle:"No backbone yet",emptyBody:"Add activities and steps, and the story map appears here.",firstActivityButton:"+ First activity",groupingLabel:"Group by",groupViewTab:"Activity group",groupAxisHeader:"Activity group \u2192",activityAxis:"Activity \u2192",milestoneAxis:"Milestone \u2193",stepNameLabel:"Step name",activityNameLabel:"Activity name",milestoneNameLabel:"Milestone name",addStepAria:"Add a step to this activity",newActivityButton:"+ Activity",newMilestoneButton:"+ Milestone",addCellButton:"+ Add",addStoryCellAria:"Add a story to this cell",moveDialogLabel:"Step to move to",moveDialogSelectLabel:"Destination",moveConfirm:"Move",moveCancel:"Cancel",storyNameLabel:"Story name",editTitleAria:"Edit title",commentAria:"Comment",deleteAria:"Delete",newActivityName:"New activity",newStepName:"New step",newMilestoneName:"New milestone",newStoryName:"New story"},ja:{renameActivity:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u540D\u3092\u5909\u66F4",renameStep:"\u30B9\u30C6\u30C3\u30D7\u540D\u3092\u5909\u66F4",reorderStep:"\u30B9\u30C6\u30C3\u30D7\u306E\u9806\u5E8F\u3092\u5909\u66F4",addActivity:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u8FFD\u52A0",addStep:"\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0",deleteActivity:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u524A\u9664",deleteStep:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",renameStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",updateStoryDescription:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",changeMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u5909\u66F4",moveStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u79FB\u52D5",reorderStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",addStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",deleteStory:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",renameMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u540D\u3092\u5909\u66F4",addMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u8FFD\u52A0",deleteMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u3092\u524A\u9664",reorderMilestone:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u306E\u9806\u5E8F\u3092\u5909\u66F4",toValue:e=>`\u2192 \u300C${e}\u300D`,fromTo:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,removed:e=>`\u2212 \u300C${e}\u300D`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,toUnassigned:"\u2192 \u672A\u5272\u5F53\u3078",toName:e=>`\u2192 ${e}`,activityGroup:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",stepGroup:"\u30B9\u30C6\u30C3\u30D7",storyGroup:"\u30B9\u30C8\u30FC\u30EA\u30FC",milestoneGroup:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3",mapGroup:"\u30DE\u30C3\u30D7",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53",unassigned:"\u672A\u5272\u5F53",emptyTitle:"\u30D0\u30C3\u30AF\u30DC\u30FC\u30F3\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",emptyBody:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3068\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u30B9\u30C8\u30FC\u30EA\u30FC\u30DE\u30C3\u30D7\u304C\u73FE\u308C\u307E\u3059\u3002",firstActivityButton:"+ \u6700\u521D\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",groupingLabel:"\u307E\u3068\u3081\u308B\u5358\u4F4D",groupViewTab:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u30B0\u30EB\u30FC\u30D7",groupAxisHeader:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u30B0\u30EB\u30FC\u30D7 \u2192",activityAxis:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3 \u2192",milestoneAxis:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3 \u2193",stepNameLabel:"\u30B9\u30C6\u30C3\u30D7\u540D",activityNameLabel:"\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u540D",milestoneNameLabel:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3\u540D",addStepAria:"\u3053\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u306B\u30B9\u30C6\u30C3\u30D7\u3092\u8FFD\u52A0",newActivityButton:"+ \u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",newMilestoneButton:"+ \u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3",addCellButton:"+ \u8FFD\u52A0",addStoryCellAria:"\u3053\u306E\u30DE\u30B9\u306B\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",moveDialogLabel:"\u79FB\u52D5\u5148\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",moveDialogSelectLabel:"\u79FB\u52D5\u5148",moveConfirm:"\u79FB\u52D5\u3059\u308B",moveCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",storyNameLabel:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D",editTitleAria:"\u30BF\u30A4\u30C8\u30EB\u3092\u7DE8\u96C6",commentAria:"\u30B3\u30E1\u30F3\u30C8",deleteAria:"\u524A\u9664",newActivityName:"\u65B0\u3057\u3044\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",newMilestoneName:"\u65B0\u3057\u3044\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3",newStoryName:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC"}}),q=(e,t,i)=>{const o=typeof i=="string"?i:"",r=typeof t=="string"?t:void 0;return r===void 0?e.toValue(o):e.fromTo(r,o)},K=(e,t)=>typeof t=="string"?e.afterName(t):e.toFront,pt={SET_ACTIVITY_NAME:(e,t,i)=>({title:e.renameActivity,tone:"update",body:q(e,x(i,t.target.id)?.name,b(y.SET_ACTIVITY_NAME,t).name??"")}),SET_STEP_NAME:(e,t,i)=>({title:e.renameStep,tone:"update",body:q(e,E(i,t.target.id)?.step.name,b(y.SET_STEP_NAME,t).name??"")}),REORDER_STEP:(e,t)=>({title:e.reorderStep,tone:"move",body:K(e,b(y.REORDER_STEP,t).after)}),ADD_ACTIVITY:(e,t)=>({title:e.addActivity,tone:"create",body:e.added(String(b(y.ADD_ACTIVITY,t).name??""))}),ADD_STEP:(e,t)=>({title:e.addStep,tone:"create",body:e.added(String(b(y.ADD_STEP,t).name??""))}),DELETE_ACTIVITY:(e,t,i)=>({title:e.deleteActivity,tone:"delete",body:e.removed(x(i,t.target.id)?.name??t.target.id)}),DELETE_STEP:(e,t,i)=>({title:e.deleteStep,tone:"delete",body:e.removed(E(i,t.target.id)?.step.name??t.target.id)}),SET_STORY_NAME:(e,t,i)=>({title:e.renameStory,tone:"update",body:q(e,k(i,t.target.id)?.name,b(y.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.updateStoryDescription,tone:"update",body:e.toValue(String(b(y.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),SET_STORY_MILESTONE:(e,t,i)=>{const o=b(y.SET_STORY_MILESTONE,t).milestoneId;return{title:e.changeMilestone,tone:"move",body:o==null?e.toUnassigned:e.toName(w(i,String(o))?.name??String(o))}},MOVE_STORY:(e,t,i)=>({title:e.moveStory,tone:"move",body:e.toName(E(i,String(b(y.MOVE_STORY,t).stepId))?.step.name??String(b(y.MOVE_STORY,t).stepId??""))}),REORDER_STORY:(e,t)=>({title:e.reorderStory,tone:"move",body:K(e,b(y.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.addStory,tone:"create",body:e.added(String(b(y.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,i)=>({title:e.deleteStory,tone:"delete",body:e.removed(k(i,t.target.id)?.name??t.target.id)}),SET_MILESTONE_NAME:(e,t,i)=>({title:e.renameMilestone,tone:"update",body:q(e,w(i,t.target.id)?.name,b(y.SET_MILESTONE_NAME,t).name??"")}),ADD_MILESTONE:(e,t)=>({title:e.addMilestone,tone:"create",body:e.added(String(b(y.ADD_MILESTONE,t).name??""))}),DELETE_MILESTONE:(e,t,i)=>({title:e.deleteMilestone,tone:"delete",body:e.removed(w(i,t.target.id)?.name??t.target.id)}),REORDER_MILESTONE:(e,t)=>({title:e.reorderMilestone,tone:"move",body:K(e,b(y.REORDER_MILESTONE,t).after)})},le=(e,t,i,o)=>{let r;try{const a=pt[t.type];r=a?a(e,t,o??i):{title:t.type,tone:"meta"}}catch{r={title:t.type,tone:"meta"}}return{title:r.title,targetLabel:pe(e,i,t.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},ce=e=>`${e.type} ${A(e.target)} ${JSON.stringify(e.payload)}`,pe=(e,t,i)=>{try{switch(i.type){case"activity":{const o=x(t,i.id);return o?e.targetLabel(e.activityGroup,o.name):e.targetMissing(e.activityGroup,i.id)}case"step":{const o=E(t,i.id)?.step;return o?e.targetLabel(e.stepGroup,o.name):e.targetMissing(e.stepGroup,i.id)}case"story":{const o=k(t,i.id);return o?e.targetLabel(e.storyGroup,o.name):e.targetMissing(e.storyGroup,i.id)}case"milestone":{const o=w(t,i.id);return o?e.targetLabel(e.milestoneGroup,o.name):e.targetMissing(e.milestoneGroup,i.id)}case"page":return e.targetLabel(e.mapGroup,J(t));default:return`${i.type} \xB7 ${i.id}`}}catch{return`${i.type} \xB7 ${i.id}`}},ue=(e,t,i)=>{const o=[{value:"page:usm",label:e.wholeMap,group:e.mapGroup}];for(const r of t.activities){o.push({value:A({type:"activity",id:r.id}),label:r.name,group:e.activityGroup});for(const a of r.steps)o.push({value:A({type:"step",id:j(r.id,a.id)}),label:`${r.name} \u203A ${a.name}`,group:e.stepGroup})}for(const r of t.milestones)o.push({value:A({type:"milestone",id:r.id}),label:r.name,group:e.milestoneGroup});for(const r of t.stories)o.push({value:A({type:"story",id:r.id}),label:r.name,group:e.storyGroup});return o},me=(e,t,i)=>{const o=t.stories.find(r=>r.id===i.story);if(o)return{value:A({type:"story",id:o.id}),label:o.name,group:e.storyGroup};for(const r of t.activities){const a=r.steps.find(n=>n.id===i.step);if(a)return{value:A({type:"step",id:j(r.id,a.id)}),label:a.name,group:e.stepGroup}}return null},J=e=>e.title??"User Story Mapping",ve=(e,t)=>{const i=E(e,t.step),o=i?.activity??x(e,t.activity)??e.activities[0],r=i?.step??o?.steps.find(s=>s.id===t.step)??o?.steps[0],a=k(e,t.story),n={...t};return o?n.activity=o.id:delete n.activity,r?n.step=r.id:delete n.step,a?n.story=a.id:delete n.story,n.view=t.view==="group"?"group":"activity",n},ge=(e,t)=>{switch(t.type){case"activity":return x(e,t.id)!==void 0;case"step":return E(e,t.id)!==void 0;case"story":return k(e,t.id)!==void 0;case"milestone":return w(e,t.id)!==void 0;case"page":return!0;default:return!1}},ye=e=>{const t=U(e);return{name:"usm",label:"User Story Mapping",parseBase:te,emptyBase:ie,actions:y,apply:ae,canonicalState:lt,hasTarget:ge,canonicalTarget:(i,o)=>{if(o.type!=="step")return o;const r=E(i,o.id);return r?{...o,id:j(r.activity.id,r.step.id)}:o},describe:(i,o,r)=>le(t,i,o,r),serialize:ce,resolveNavigation:ve,commentTargets:(i,o)=>ue(t,i),currentTarget:(i,o)=>me(t,i,o),title:J}},ut={width:300,height:260},mt=Z`
2
2
  :host {
3
3
  position: relative;
4
4
  display: grid;
@@ -515,7 +515,7 @@ ${t}
515
515
  ${sr(c).replace(/\n/g,`
516
516
  `)}
517
517
  \`\`\``)}d.push("")}if(a.length===0&&l.length===0&&(d.push("_No pending draft actions._"),d.push("")),t.stale.length>0){d.push(`## Not applicable to the current base (${t.stale.length})`),d.push(""),d.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."),d.push("");for(const[p,{action:c,reason:h}]of t.stale.entries()){const u=e.describe(c,r,t.base),v=c.type===E?xe(c):u.title;d.push(`${p+1}. \`${c.type}\` on \`${_(c.target)}\` (${h}) \u2014 ${v}`)}d.push("")}return d.push("## Canonical draft (JSON)"),d.push(""),d.push(nr(ze(s))),d.push(""),d.join(`
518
- `)},W="0.0.3",We=async t=>{try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}const e=document.activeElement,n=document.createElement("textarea");try{return n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.opacity="0",document.body.append(n),n.select(),document.execCommand("copy")}catch{return!1}finally{n.remove(),e instanceof HTMLElement&&e.focus()}},tn=ue({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"}}),rr=()=>({body:"",attachment:{kind:"page"},copy:{kind:"idle"},copyRequest:0,send:{kind:"idle"},sendRequest:0}),nn=t=>t.kind==="explicit"?{kind:t.resume}:t,sn=(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:nn(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:nn(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}}}},ir=(t,e)=>{const n=t.body.trim();return n===""?null:{target:e,body:n}},or={en:"English",ja:"\u65E5\u672C\u8A9E"},Y=ue({en:{review:"Review",reviewToggle:"Review / comments",useLightTheme:"Switch to light theme",useDarkTheme:"Switch to dark theme",language:"Language",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",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"}}),ar=4096,dr="reviews",rn="Review from the page (dev-process-kit). Apply it to the base data and republish this artifact.",lr=t=>new TextEncoder().encode(t).length,cr=t=>t.replace(/[\u0000-\u0008\u000B-\u001F\u007F]/g,""),pr=t=>{const e=`${rn}
518
+ `)},W="0.0.4",We=async t=>{try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}const e=document.activeElement,n=document.createElement("textarea");try{return n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.opacity="0",document.body.append(n),n.select(),document.execCommand("copy")}catch{return!1}finally{n.remove(),e instanceof HTMLElement&&e.focus()}},tn=ue({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"}}),rr=()=>({body:"",attachment:{kind:"page"},copy:{kind:"idle"},copyRequest:0,send:{kind:"idle"},sendRequest:0}),nn=t=>t.kind==="explicit"?{kind:t.resume}:t,sn=(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:nn(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:nn(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}}}},ir=(t,e)=>{const n=t.body.trim();return n===""?null:{target:e,body:n}},or={en:"English",ja:"\u65E5\u672C\u8A9E"},Y=ue({en:{review:"Review",reviewToggle:"Review / comments",useLightTheme:"Switch to light theme",useDarkTheme:"Switch to dark theme",language:"Language",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",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"}}),ar=4096,dr="reviews",rn="Review from the page (dev-process-kit). Apply it to the base data and republish this artifact.",lr=t=>new TextEncoder().encode(t).length,cr=t=>t.replace(/[\u0000-\u0008\u000B-\u001F\u007F]/g,""),pr=t=>{const e=`${rn}
519
519
 
520
520
  ${cr(t)}`;return lr(e)<=ar?e:null},hr=t=>`${rn}
521
521
 
@@ -1871,4 +1871,4 @@ The brief is too long for a comment, so it is stored in this artifact's database
1871
1871
  @click=${()=>this.#s.toggle(ie(this.theme))}
1872
1872
  >
1873
1873
  ${e?Mr():Or()}
1874
- </button>`}render(){if(!this.#a)return m;const e=this.#_();return this.renderChrome(e,this.renderRegions(e))}hasSidebarContent(){return this.querySelector('[slot="sidebar"]')!==null}hasMemoContent(){return this.querySelector('[slot="memo"]')!==null}hasFooterContent(){return this.querySelector('[slot="footer"]')!==null}context(){return this.#_()}#A(){return{definition:this.definition,controller:()=>this.controller,derivation:()=>this.derivation,ready:this.#w,navigation:()=>this.#x(),issues:()=>this.controller.lastIssues,dispatch:e=>this.dispatch(e),dispatchBatch:e=>this.dispatchBatch(e),subscribe:e=>(this.#m.add(e),()=>{this.#m.delete(e)}),removeAction:e=>this.removeAction(e),clearActions:()=>this.clearActions(),navigate:(e,n)=>this.navigate(e,n),hashFor:e=>this.hashFor(e),requestComment:e=>this.requestComment(e)}}#P(){return Ci(this.#A(),this)}#S(){return Hn(this.#A())}#_(){return Ai(this.#A())}#x(){return this.definition.resolveNavigation(this.derivation.state,this.#d)}#D(){const e=this.#q();this.#d=Qn();const n=this.storageKey;this.#a=new In({definition:this.definition,base:e,storage:this.#U(),...typeof n=="string"?{storageKey:n}:{}}),this.#C(),this.#u(),this.#$(!0),this.#h?.(),this.#I(),this.requestUpdate()}#U(){return this.storage==="off"?null:this.storage==="memory"?new nt:st()}#q(){const e=this.querySelector('script[type="application/json"]');if(!e?.textContent||e.textContent.trim().length===0)return console.warn(`[dev-process-kit] <${this.tagName.toLowerCase()}> has no base JSON; starting from an empty state.`),this.#f='no <script type="application/json"> child found',this.definition.emptyBase();try{return this.definition.parseBase(JSON.parse(e.textContent))}catch(n){return console.error("[dev-process-kit] invalid base data:",n),this.#f=n instanceof Error?n.message:String(n),this.definition.emptyBase()}}#I(){this.querySelector('script[type="application/json"]')||(this.#l=new MutationObserver(()=>{const e=this.querySelector('script[type="application/json"]');if(e){this.#l?.disconnect(),this.#l=void 0;try{this.controller.setBase(this.definition.parseBase(JSON.parse(e.textContent??"null")))}catch(n){console.error("[dev-process-kit] invalid base data:",n)}}}),this.#l.observe(this,{childList:!0,subtree:!0}))}#b(){const e=this.#S();for(const n of this.#m)n(e)}#z(){if(!this.isConnected){this.requestUpdate(),this.#b();return}this.#$(!0),Zn(this.#c,this.controller.actions),queueMicrotask(this.#u),this.requestUpdate(),this.#b(),this.dispatchEvent(new CustomEvent("dpk-change",{detail:this.#S(),bubbles:!0,composed:!0}))}#$(e){const n=this.#x();this.#d=n,zi(n,e)}#E=()=>{this.#d=Qn(),this.#$(!0),this.requestUpdate(),this.#b(),this.dispatchEvent(new CustomEvent("dpk-navigate",{detail:{navigation:this.#d},bubbles:!0,composed:!0}))};#u=()=>{this.#v?.disconnect(),this.#c=Ni(this,e=>{this.isConnected&&this.#v?.observe(e,{childList:!0,subtree:!0})}),this.#a&&(Zn(this.#c,this.#a.actions),this.#a.setComponentSnapshot(Di(this.#c)))};#T=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!this.#a)return;const n=e.detail;typeof n!="object"||n===null||!("target"in n)||typeof n.target!="string"||(this.#u(),!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(r=>r.value===n.target))||this.requestComment(n.target)};#M=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#a)return;const n=y(Ir,e.detail);if(!n.success)return;this.#u();const{target:s,body:r}=n.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(l=>l.value===s))return;this.dispatch({type:E,target:s,payload:{body:r}}).ok&&e.preventDefault()};#O=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#a)return;const n=y(er,e.detail);if(!n.success)return;this.#u();const{type:s,target:r,payload:i}=n.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(a=>a.value===r))return;this.dispatch({type:s,target:r,payload:i}).ok&&e.preventDefault()};#j=e=>{for(const n of e.composedPath()){if(!(n instanceof Element))continue;if(n===this||n.hasAttribute("data-template"))break;const s=n.getAttribute("data-dpk-navigate");if(s!==null){e.preventDefault(),this.navigate(Ke(s.includes("=")?s:`step=${s}`));return}const r=n.getAttribute("data-dpk-comment");if(r!==null){e.preventDefault(),this.requestComment(r);return}}};#B(){const e=this.renderRoot.querySelector(".dpk-shell"),n=this.renderRoot.querySelector(".dpk-dock-actions");e&&(n?e.style.setProperty("--dpk-dock-space",`${n.offsetWidth+8}px`):e.style.removeProperty("--dpk-dock-space"))}#H(){this.#r.route()}}const Ki=(t,e)=>{typeof window>"u"||Object.assign(window,{devProcessKit:{version:t,templates:e}})};export{As as $,Qe as A,$r as B,E as C,yn as D,Fe as E,W as F,vn as G,kn as H,mn as I,bn as J,gn as K,Nn as L,nt as M,Ke as N,Kt as O,zs as P,Je as Q,Bs as R,ze as S,Fi as T,Jt as U,_ as V,tt as W,ke as X,Ue as Y,fe as Z,ue as _,Ki as a,R as a0,m as a1,f as a2,fn as a3,cs as a4,O as a5,Le as a6,Er as a7,Tr as a8,Ft as a9,We as aA,qs as aB,xn as aC,dn as aD,ln as aE,hn as aF,Sr as aG,wr as aH,xr as aI,K as aa,ve as ab,q as ac,g as ad,be as ae,b as af,k as ag,qt as ah,Ht as ai,I as aj,F as ak,Pt as al,y as am,$ as an,Dt as ao,De as ap,Lt as aq,Rt as ar,Ut as as,S as at,Us as au,Dr as av,we as aw,te as ax,_r as ay,Ye as az,Gt as b,jt as c,In as d,Ie as e,Hs as f,Ve as g,Yt as h,xe as i,Rn as j,ge as k,Vt as l,Vs as m,qe as n,st as o,qn as p,Is as q,Nr as r,Ss as s,Ln as t,J as u,Ks as v,V as w,Cr as x,Ar as y,Ze as z};
1874
+ </button>`}render(){if(!this.#a)return m;const e=this.#_();return this.renderChrome(e,this.renderRegions(e))}hasSidebarContent(){return this.querySelector('[slot="sidebar"]')!==null}hasMemoContent(){return this.querySelector('[slot="memo"]')!==null}hasFooterContent(){return this.querySelector('[slot="footer"]')!==null}context(){return this.#_()}#A(){return{definition:this.definition,controller:()=>this.controller,derivation:()=>this.derivation,ready:this.#w,navigation:()=>this.#x(),issues:()=>this.controller.lastIssues,dispatch:e=>this.dispatch(e),dispatchBatch:e=>this.dispatchBatch(e),subscribe:e=>(this.#m.add(e),()=>{this.#m.delete(e)}),removeAction:e=>this.removeAction(e),clearActions:()=>this.clearActions(),navigate:(e,n)=>this.navigate(e,n),hashFor:e=>this.hashFor(e),requestComment:e=>this.requestComment(e)}}#P(){return Ci(this.#A(),this)}#S(){return Hn(this.#A())}#_(){return Ai(this.#A())}#x(){return this.definition.resolveNavigation(this.derivation.state,this.#d)}#D(){const e=this.#q();this.#d=Qn();const n=this.storageKey;this.#a=new In({definition:this.definition,base:e,storage:this.#U(),...typeof n=="string"?{storageKey:n}:{}}),this.#C(),this.#u(),this.#$(!0),this.#h?.(),this.#I(),this.requestUpdate()}#U(){return this.storage==="off"?null:this.storage==="memory"?new nt:st()}#q(){const e=this.querySelector('script[type="application/json"]');if(!e?.textContent||e.textContent.trim().length===0)return console.warn(`[dev-process-kit] <${this.tagName.toLowerCase()}> has no base JSON; starting from an empty state.`),this.#f='no <script type="application/json"> child found',this.definition.emptyBase();try{return this.definition.parseBase(JSON.parse(e.textContent))}catch(n){return console.error("[dev-process-kit] invalid base data:",n),this.#f=n instanceof Error?n.message:String(n),this.definition.emptyBase()}}#I(){this.querySelector('script[type="application/json"]')||(this.#l=new MutationObserver(()=>{const e=this.querySelector('script[type="application/json"]');if(e){this.#l?.disconnect(),this.#l=void 0;try{this.controller.setBase(this.definition.parseBase(JSON.parse(e.textContent??"null")))}catch(n){console.error("[dev-process-kit] invalid base data:",n)}}}),this.#l.observe(this,{childList:!0,subtree:!0}))}#b(){const e=this.#S();for(const n of this.#m)n(e)}#z(){if(!this.isConnected){this.requestUpdate(),this.#b();return}this.#$(!0),Zn(this.#c,this.controller.actions),queueMicrotask(this.#u),this.requestUpdate(),this.#b(),this.dispatchEvent(new CustomEvent("dpk-change",{detail:this.#S(),bubbles:!0,composed:!0}))}#$(e){const n=this.#x();this.#d=n,zi(n,e)}#E=()=>{this.#d=Qn(),this.#$(!0),this.requestUpdate(),this.#b(),this.dispatchEvent(new CustomEvent("dpk-navigate",{detail:{navigation:this.#d},bubbles:!0,composed:!0}))};#u=()=>{this.#v?.disconnect(),this.#c=Ni(this,e=>{this.isConnected&&this.#v?.observe(e,{childList:!0,subtree:!0})}),this.#a&&(Zn(this.#c,this.#a.actions),this.#a.setComponentSnapshot(Di(this.#c)))};#T=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!this.#a)return;const n=e.detail;typeof n!="object"||n===null||!("target"in n)||typeof n.target!="string"||(this.#u(),!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(r=>r.value===n.target))||this.requestComment(n.target)};#M=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#a)return;const n=y(Ir,e.detail);if(!n.success)return;this.#u();const{target:s,body:r}=n.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(l=>l.value===s))return;this.dispatch({type:E,target:s,payload:{body:r}}).ok&&e.preventDefault()};#O=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#a)return;const n=y(er,e.detail);if(!n.success)return;this.#u();const{type:s,target:r,payload:i}=n.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(a=>a.value===r))return;this.dispatch({type:s,target:r,payload:i}).ok&&e.preventDefault()};#j=e=>{for(const n of e.composedPath()){if(!(n instanceof Element))continue;if(n===this||n.hasAttribute("data-template"))break;const s=n.getAttribute("data-dpk-navigate");if(s!==null){e.preventDefault(),this.navigate(Ke(s.includes("=")?s:`step=${s}`));return}const r=n.getAttribute("data-dpk-comment");if(r!==null){e.preventDefault(),this.requestComment(r);return}}};#B(){const e=this.renderRoot.querySelector(".dpk-shell"),n=this.renderRoot.querySelector(".dpk-dock-actions");e&&(n?e.style.setProperty("--dpk-dock-space",`${n.offsetWidth+8}px`):e.style.removeProperty("--dpk-dock-space"))}#H(){this.#r.route()}}const Ki=(t,e)=>{typeof window>"u"||Object.assign(window,{devProcessKit:{version:t,templates:e}})};export{As as $,Qe as A,$r as B,E as C,yn as D,Fe as E,W as F,vn as G,kn as H,mn as I,bn as J,gn as K,Nn as L,nt as M,Ke as N,Kt as O,zs as P,Je as Q,Bs as R,ze as S,Fi as T,Jt as U,_ as V,tt as W,ke as X,Ue as Y,fe as Z,ue as _,Ki as a,R as a0,m as a1,f as a2,fn as a3,cs as a4,O as a5,Le as a6,Er as a7,Tr as a8,Ft as a9,We as aA,qs as aB,xn as aC,dn as aD,ln as aE,hn as aF,Sr as aG,wr as aH,xr as aI,K as aa,ve as ab,q as ac,g as ad,be as ae,b as af,k as ag,qt as ah,Ht as ai,I as aj,F as ak,Pt as al,y as am,$ as an,Dt as ao,De as ap,Lt as aq,Rt as ar,Ut as as,Us as at,_r as au,S as av,Dr as aw,we as ax,te as ay,Ye as az,Gt as b,jt as c,In as d,Ie as e,Hs as f,Ve as g,Yt as h,xe as i,Rn as j,ge as k,Vt as l,Vs as m,qe as n,st as o,qn as p,Is as q,Nr as r,Ss as s,Ln as t,J as u,Ks as v,V as w,Cr as x,Ar as y,Ze as z};
@@ -1,4 +1,4 @@
1
- import{q as be,ai as I,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 L,_ as ve,V as xe,a2 as s,a3 as F,a1 as d,ay as O,a0 as me,T as P,az as we,aA as ye}from"./shared-CwbzACTe.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=I("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=I("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)!=="",j=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},D=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=L(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}},ze=(t,e,r)=>{const i=L(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=ze(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},Ie=(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:j(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),Le=(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=>Le(i,t,r))}},ne=(t,e)=>{const r=D(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,z=y.offsetHeight,ue=l.right-r.left-A+8-(o.length-1-ge)*(A+5),he=l.top-r.top-z/2;y.style.transform=`translate(${N(ue,0,Math.max(0,t.clientWidth-A))}px, ${N(he,0,Math.max(0,t.clientHeight-z))}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 I,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 L,_ as ve,V as xe,a2 as s,a3 as F,a1 as d,au as O,a0 as me,T as P,az as we,aA as ye}from"./shared-CU-s47EI.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=I("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=I("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)!=="",j=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},D=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=L(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}},ze=(t,e,r)=>{const i=L(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=ze(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},Ie=(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:j(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),Le=(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=>Le(i,t,r))}},ne=(t,e)=>{const r=D(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,z=y.offsetHeight,ue=l.right-r.left-A+8-(o.length-1-ge)*(A+5),he=l.top-r.top-z/2;y.style.transform=`translate(${N(ue,0,Math.max(0,t.clientWidth-A))}px, ${N(he,0,Math.max(0,t.clientHeight-z))}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>
@@ -1,4 +1,4 @@
1
- import{_ as Wt,a1 as lt,a2 as K}from"./shared-CwbzACTe.js";const I=Math.min,S=Math.max,Q=Math.round,Z=Math.floor,$=t=>({x:t,y:t}),Nt={left:"right",right:"left",bottom:"top",top:"bottom"};function Vt(t,e,n){return S(t,I(e,n))}function U(t,e){return typeof t=="function"?t(e):t}function _(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function xt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}function k(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function vt(t){return xt(k(t))}function _t(t,e,n){n===void 0&&(n=!1);const o=Y(t),i=vt(t),s=bt(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=tt(r)),[r,tt(r)]}function Ht(t){const e=tt(t);return[at(t),e,at(e)]}function at(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Rt=["left","right"],Ct=["right","left"],Bt=["top","bottom"],zt=["bottom","top"];function It(t,e,n){switch(t){case"top":case"bottom":return n?e?Ct:Rt:e?Rt:Ct;case"left":case"right":return e?Bt:zt;default:return[]}}function Xt(t,e,n,o){const i=Y(t);let s=It(_(t),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(at)))),s}function tt(t){const e=_(t);return Nt[e]+t.slice(e.length)}function jt(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function qt(t){return typeof t!="number"?jt(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function At(t,e,n){let{reference:o,floating:i}=t;const s=k(e),r=vt(e),c=bt(r),l=_(e),a=s==="y",f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let d;switch(l){case"top":d={x:f,y:o.y-i.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-i.width,y:u};break;default:d={x:o.x,y:o.y}}const h=Y(e);return h&&(d[r]+=m*(h==="end"?1:-1)*(n&&a?-1:1)),d}async function Kt(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:m=!1,padding:d=0}=U(e,t),h=qt(d),w=c[m?u==="floating"?"reference":"floating":u],p=et(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),y=u==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},C=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:x,strategy:l}):y);return{top:(p.top-C.top+h.top)/b.y,bottom:(C.bottom-p.bottom+h.bottom)/b.y,left:(p.left-C.left+h.left)/b.x,right:(C.right-p.right+h.right)/b.x}}const Ut=50,Yt=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,c=r.detectOverflow?r:{...r,detectOverflow:Kt},l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=At(a,o,l),m=o,d=0;const h={};for(let g=0;g<s.length;g++){const w=s[g];if(!w)continue;const{name:p,fn:y}=w,{x,y:b,data:C,reset:v}=await y({x:f,y:u,initialPlacement:o,placement:m,strategy:i,middlewareData:h,rects:a,platform:c,elements:{reference:t,floating:e}});f=x??f,u=b??u,h[p]={...h[p],...C},v&&d<Ut&&(d++,typeof v=="object"&&(v.placement&&(m=v.placement),v.rects&&(a=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:f,y:u}=At(a,m,l)),g=-1)}return{x:f,y:u,placement:m,strategy:i,middlewareData:h}},Gt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...w}=U(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const p=_(i),y=k(c),x=_(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=m||(x||!g?[tt(c)]:Ht(c)),v=h!=="none";!m&&v&&C.push(...Xt(c,g,h,b));const P=[c,...C],T=await l.detectOverflow(e,w),W=[];let O=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&W.push(T[p]),u){const N=_t(i,r,b);W.push(T[N[0]],T[N[1]])}if(O=[...O,{placement:i,overflows:W}],!W.every(N=>N<=0)){var gt,wt;const N=(((gt=s.flip)==null?void 0:gt.index)||0)+1,ct=P[N];if(ct&&(!(u==="alignment"?y!==k(ct):!1)||O.every(A=>k(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:N,overflows:O},reset:{placement:ct}};let q=(wt=O.filter(V=>V.overflows[0]<=0).sort((V,A)=>V.overflows[1]-A.overflows[1])[0])==null?void 0:wt.placement;if(!q)switch(d){case"bestFit":{var yt;const V=(yt=O.filter(A=>{if(v){const M=k(A.placement);return M===y||M==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(M=>M>0).reduce((M,Ft)=>M+Ft,0)]).sort((A,M)=>A[1]-M[1])[0])==null?void 0:yt[0];V&&(q=V);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}},Jt=new Set(["left","top"]);async function Qt(t,e){const{placement:n,platform:o,elements:i}=t,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=_(n),c=Y(n),l=k(n)==="y",a=Jt.has(r)?-1:1,f=s&&l?-1:1,u=U(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),l?{x:d*f,y:m*a}:{x:m*a,y:d*f}}const Zt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:s,placement:r,middlewareData:c}=e,l=await Qt(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},te=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...a}=U(t,e),f={x:n,y:o},u=await s.detectOverflow(e,a),m=k(i),d=xt(m);let h=f[d],g=f[m];const w=(y,x)=>Vt(x+u[y==="y"?"top":"left"],x,x-u[y==="y"?"bottom":"right"]);r&&(h=w(d,h)),c&&(g=w(m,g));const p=l.fn({...e,[d]:h,[m]:g});return{...p,data:{x:p.x-n,y:p.y-o,enabled:{[d]:r,[m]:c}}}}}},ee=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:s}=e,{apply:r=()=>{},...c}=U(t,e),l=await i.detectOverflow(e,c),a=_(n),f=Y(n),u=k(n)==="y",{width:m,height:d}=o.floating;let h,g;a==="top"||a==="bottom"?(h=a,g=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=a,h=f==="end"?"top":"bottom");const w=d-l.top-l.bottom,p=m-l.left-l.right,y=I(d-l[h],w),x=I(m-l[g],p),b=e.middlewareData.shift,C=!b;let v=y,P=x;b!=null&&b.enabled.x&&(P=p),b!=null&&b.enabled.y&&(v=w),C&&!f&&(u?P=m-2*S(l.left,l.right):v=d-2*S(l.top,l.bottom)),await r({...e,availableWidth:P,availableHeight:v});const T=await i.getDimensions(s.floating);return m!==T.width||d!==T.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function X(t){return Ot(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function D(t){var e;return(e=(Ot(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ot(t){return nt()?t instanceof Node||t instanceof R(t).Node:!1}function L(t){return nt()?t instanceof Element||t instanceof R(t).Element:!1}function F(t){return nt()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function Lt(t){return!nt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=E(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function ne(t){return/^(table|td|th)$/.test(X(t))}function it(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const oe=/transform|translate|scale|rotate|perspective|filter/,ie=/paint|layout|strict|content/,H=t=>!!t&&t!=="none";let ft;function ut(t){const e=L(t)?E(t):t;return H(e.transform)||H(e.translate)||H(e.scale)||H(e.rotate)||H(e.perspective)||!dt()&&(H(e.backdropFilter)||H(e.filter))||oe.test(e.willChange||"")||ie.test(e.contain||"")}function se(t){let e=B(t);for(;F(e)&&!G(e);){if(ut(e))return e;if(it(e))return null;e=B(e)}return null}function dt(){return ft==null&&(ft=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ft}function G(t){return/^(html|body|#document)$/.test(X(t))}function E(t){return R(t).getComputedStyle(t)}function st(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(X(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lt(t)&&t.host||D(t);return Lt(e)?e.host:e}function Et(t){const e=B(t);return G(e)?(t.ownerDocument||t).body:F(e)&&ot(e)?e:Et(e)}function J(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Et(t),s=i===((o=t.ownerDocument)==null?void 0:o.body),r=R(i);if(s){const c=mt(r);return e.concat(r,r.visualViewport||[],ot(i)?i:[],c&&n?J(c):[])}else return e.concat(i,J(i,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Tt(t){const e=E(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=F(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,c=Q(n)!==s||Q(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function ht(t){return L(t)?t:t.contextElement}function j(t){const e=ht(t);if(!F(e))return $(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:s}=Tt(e);let r=(s?Q(n.width):n.width)/o,c=(s?Q(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const re=$(0);function St(t){const e=R(t);return!dt()||!e.visualViewport?re:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ce(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===R(t)}function z(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=ht(t);let r=$(1);e&&(o?L(o)&&(r=j(o)):r=j(t));const c=ce(s,n,o)?St(s):$(0);let l=(i.left+c.x)/r.x,a=(i.top+c.y)/r.y,f=i.width/r.x,u=i.height/r.y;if(s&&o){const m=R(s),d=L(o)?R(o):o;let h=m,g=mt(h);for(;g&&d!==h;){const w=j(g),p=g.getBoundingClientRect(),y=E(g),x=p.left+(g.clientLeft+parseFloat(y.paddingLeft))*w.x,b=p.top+(g.clientTop+parseFloat(y.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,u*=w.y,l+=x,a+=b,h=R(g),g=mt(h)}}return et({width:f,height:u,x:l,y:a})}function rt(t,e){const n=st(t).scrollLeft;return e?e.left+n:z(D(t)).left+n}function $t(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-rt(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function le(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const s=i==="fixed",r=D(o),c=e?it(e.floating):!1;if(o===r||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=$(1);const f=$(0),u=F(o);if((u||!s)&&((X(o)!=="body"||ot(r))&&(l=st(o)),u)){const d=z(o);a=j(o),f.x=d.x+o.clientLeft,f.y=d.y+o.clientTop}const m=r&&!u&&!s?$t(r,l):$(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+f.x+m.x,y:n.y*a.y-l.scrollTop*a.y+f.y+m.y}}function ae(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function fe(t){const e=st(t),n=t.ownerDocument.body,o=S(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=S(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+rt(t);const r=-e.scrollTop;return E(n).direction==="rtl"&&(s+=S(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:s,y:r}}const ue=25;function de(t,e,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=R(t),s=D(t),r=i.visualViewport;let c=s.clientWidth,l=s.clientHeight,a=0,f=0;if(r){const m=!dt()||e==="fixed";o?m||(a=-r.offsetLeft,f=-r.offsetTop):(c=r.width,l=r.height,m&&(a=r.offsetLeft,f=r.offsetTop))}if(rt(s)<=0){const m=s.ownerDocument,d=m.body,h=getComputedStyle(d),g=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,w=Math.abs(s.clientWidth-d.clientWidth-g),p=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;p<=ue&&(c-=p)}return{width:c,height:l,x:a,y:f}}function me(t,e){const n=z(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=j(t),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,a=o*s.y;return{width:r,height:c,x:l,y:a}}function kt(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=de(t,n,e);else if(e==="document")o=fe(D(t));else if(L(e))o=me(e,n);else{const i=St(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return et(o)}function he(t,e){const n=e.get(t);if(n)return n;let o=J(t,[],!1).filter(c=>L(c)&&X(c)!=="body"),i=null;const s=E(t).position==="fixed";let r=s?B(t):t;for(;L(r)&&!G(r);){const c=E(r),l=ut(r),a=i?i.position:s?"fixed":"";!l&&(a==="fixed"||a==="absolute"&&c.position==="static")?o=o.filter(u=>u!==r):i=c,r=B(r)}return e.set(t,o),o}function pe(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[...n==="clippingAncestors"?it(e)?[]:he(e,this._c):[].concat(n),o],c=kt(e,r[0],i);let l=c.top,a=c.right,f=c.bottom,u=c.left;for(let m=1;m<r.length;m++){const d=kt(e,r[m],i);l=S(d.top,l),a=I(d.right,a),f=I(d.bottom,f),u=S(d.left,u)}return{width:a-u,height:f-l,x:u,y:l}}function ge(t){const{width:e,height:n}=Tt(t);return{width:e,height:n}}function we(t,e,n){const o=F(e),i=D(e),s=n==="fixed",r=z(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=$(0);if((o||!s)&&((X(e)!=="body"||ot(i))&&(c=st(e)),o)){const m=z(e,!0,s,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}!o&&i&&(l.x=rt(i));const a=i&&!o&&!s?$t(i,c):$(0),f=r.left+c.scrollLeft-l.x-a.x,u=r.top+c.scrollTop-l.y-a.y;return{x:f,y:u,width:r.width,height:r.height}}function pt(t){return E(t).position==="static"}function Dt(t,e){if(!F(t)||E(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return D(t)===n&&(n=n.ownerDocument.body),n}function Pt(t,e){const n=R(t);if(it(t))return n;if(!F(t)){let i=B(t);for(;i&&!G(i);){if(L(i)&&!pt(i))return i;i=B(i)}return n}let o=Dt(t,e);for(;o&&ne(o)&&pt(o);)o=Dt(o,e);return o&&G(o)&&pt(o)&&!ut(o)?n:o||se(t)||n}const ye=async function(t){const e=this.getOffsetParent||Pt,n=this.getDimensions,o=await n(t.floating);return{reference:we(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function xe(t){return E(t).direction==="rtl"}const be={convertOffsetParentRelativeRectToViewportRelativeRect:le,getDocumentElement:D,getClippingRect:pe,getOffsetParent:Pt,getElementRects:ye,getClientRects:ae,getDimensions:ge,getScale:j,isElement:L,isRTL:xe};function Mt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ve(t,e,n){let o=null,i;const s=D(t);function r(){var f;clearTimeout(i),(f=o)==null||f.disconnect(),o=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),r();const m=t.getBoundingClientRect(),{left:d,top:h,width:g,height:w}=m;if(f||e(),!g||!w)return;const p=Z(h),y=Z(s.clientWidth-(d+g)),x=Z(s.clientHeight-(h+w)),b=Z(d),v={rootMargin:-p+"px "+-y+"px "+-x+"px "+-b+"px",threshold:S(0,I(1,u))||1};let P=!0;function T(W){const O=W[0].intersectionRatio;if(!Mt(m,t.getBoundingClientRect()))return c();if(O!==u){if(!P)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(T,{...v,root:s.ownerDocument})}catch{o=new IntersectionObserver(T,v)}o.observe(t)}const l=R(t),a=()=>c(n);return l.addEventListener("resize",a),c(!0),()=>{l.removeEventListener("resize",a),r()}}function Re(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=ht(t),f=i||s?[...a?J(a):[],...e?J(e):[]]:[];f.forEach(p=>{i&&p.addEventListener("scroll",n),s&&p.addEventListener("resize",n)});const u=a&&c?ve(a,n,s):null;let m=-1,d=null;r&&(d=new ResizeObserver(p=>{let[y]=p;y&&y.target===a&&d&&e&&(d.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),n()}),a&&!l&&d.observe(a),e&&d.observe(e));let h,g=l?z(t):null;l&&w();function w(){const p=z(t);g&&!Mt(g,p)&&n(),g=p,h=requestAnimationFrame(w)}return n(),()=>{var p;f.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),u?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(h)}}const Ce=Zt,Ae=te,Oe=Gt,Le=ee,Ee=(t,e,n)=>{const o=new Map,i=n??{},s={...be,...i.platform,_c:o};return Yt(t,e,{...i,platform:s})},Te=(t,e)=>({top:e,bottom:e,right:t}),Se=(t,e,n,o={})=>{if(typeof t.showPopover!="function")return()=>{};try{t.showPopover()}catch{return()=>{}}let i=!0,s=0;const r=e instanceof Element?e:{getBoundingClientRect:()=>({x:e.right,y:e.top,left:e.right,right:e.right,top:e.top,bottom:e.bottom,width:0,height:e.bottom-e.top})};t.style.width=`${n.width}px`,t.style.maxHeight=`${n.height}px`;const l=Re(r,t,()=>{const a=++s;Ee(r,t,{strategy:"fixed",placement:o.placement??"bottom-end",middleware:[Ce(8),Oe({padding:8,fallbackAxisSideDirection:"end"}),Ae({padding:8}),Le({padding:8,apply:({availableWidth:f,availableHeight:u})=>{!i||a!==s||(t.style.width=`${Math.max(0,Math.min(n.width,f))}px`,t.style.maxHeight=`${Math.max(0,Math.min(n.height,u))}px`)}})]}).then(({x:f,y:u})=>{!i||a!==s||!t.isConnected||(t.style.left=`${f}px`,t.style.top=`${u}px`)}).catch(()=>{})},{animationFrame:o.trackTransform??!1,elementResize:typeof ResizeObserver<"u",layoutShift:typeof IntersectionObserver<"u"});return()=>{i=!1,l()}};class $e{#e;#t=new Map;constructor(e){this.#e=e,e.addController(this)}hostConnected(){this.#e.requestUpdate()}hostUpdated(){for(const[e,n]of this.#t)e.isConnected||(n(),this.#t.delete(e))}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}open(e,n,o,i){this.#t.get(e)?.(),this.#t.set(e,Se(e,n,o,i))}}const ke=Wt({en:{comment:"Comment",commentOn:t=>`Comment on ${t}`,submit:"Send",cancel:"Cancel"},ja:{comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:t=>`${t}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`,submit:"\u9001\u4FE1",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"}}),De=(t,e,n={})=>({body:t,notes:e,submission:t.trim()||null,label:n.label??null,error:n.error??null}),Pe=(t,e,n)=>{const o=()=>{e.submission!==null&&n({kind:"comment",body:e.submission})};return K`<div
1
+ import{_ as Wt,a1 as lt,a2 as K}from"./shared-CU-s47EI.js";const I=Math.min,S=Math.max,Q=Math.round,Z=Math.floor,$=t=>({x:t,y:t}),Nt={left:"right",right:"left",bottom:"top",top:"bottom"};function Vt(t,e,n){return S(t,I(e,n))}function U(t,e){return typeof t=="function"?t(e):t}function _(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function xt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}function k(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function vt(t){return xt(k(t))}function _t(t,e,n){n===void 0&&(n=!1);const o=Y(t),i=vt(t),s=bt(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=tt(r)),[r,tt(r)]}function Ht(t){const e=tt(t);return[at(t),e,at(e)]}function at(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Rt=["left","right"],Ct=["right","left"],Bt=["top","bottom"],zt=["bottom","top"];function It(t,e,n){switch(t){case"top":case"bottom":return n?e?Ct:Rt:e?Rt:Ct;case"left":case"right":return e?Bt:zt;default:return[]}}function Xt(t,e,n,o){const i=Y(t);let s=It(_(t),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(at)))),s}function tt(t){const e=_(t);return Nt[e]+t.slice(e.length)}function jt(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function qt(t){return typeof t!="number"?jt(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function At(t,e,n){let{reference:o,floating:i}=t;const s=k(e),r=vt(e),c=bt(r),l=_(e),a=s==="y",f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let d;switch(l){case"top":d={x:f,y:o.y-i.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-i.width,y:u};break;default:d={x:o.x,y:o.y}}const h=Y(e);return h&&(d[r]+=m*(h==="end"?1:-1)*(n&&a?-1:1)),d}async function Kt(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:m=!1,padding:d=0}=U(e,t),h=qt(d),w=c[m?u==="floating"?"reference":"floating":u],p=et(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),y=u==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},C=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:x,strategy:l}):y);return{top:(p.top-C.top+h.top)/b.y,bottom:(C.bottom-p.bottom+h.bottom)/b.y,left:(p.left-C.left+h.left)/b.x,right:(C.right-p.right+h.right)/b.x}}const Ut=50,Yt=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,c=r.detectOverflow?r:{...r,detectOverflow:Kt},l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=At(a,o,l),m=o,d=0;const h={};for(let g=0;g<s.length;g++){const w=s[g];if(!w)continue;const{name:p,fn:y}=w,{x,y:b,data:C,reset:v}=await y({x:f,y:u,initialPlacement:o,placement:m,strategy:i,middlewareData:h,rects:a,platform:c,elements:{reference:t,floating:e}});f=x??f,u=b??u,h[p]={...h[p],...C},v&&d<Ut&&(d++,typeof v=="object"&&(v.placement&&(m=v.placement),v.rects&&(a=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:f,y:u}=At(a,m,l)),g=-1)}return{x:f,y:u,placement:m,strategy:i,middlewareData:h}},Gt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...w}=U(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const p=_(i),y=k(c),x=_(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=m||(x||!g?[tt(c)]:Ht(c)),v=h!=="none";!m&&v&&C.push(...Xt(c,g,h,b));const P=[c,...C],T=await l.detectOverflow(e,w),W=[];let O=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&W.push(T[p]),u){const N=_t(i,r,b);W.push(T[N[0]],T[N[1]])}if(O=[...O,{placement:i,overflows:W}],!W.every(N=>N<=0)){var gt,wt;const N=(((gt=s.flip)==null?void 0:gt.index)||0)+1,ct=P[N];if(ct&&(!(u==="alignment"?y!==k(ct):!1)||O.every(A=>k(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:N,overflows:O},reset:{placement:ct}};let q=(wt=O.filter(V=>V.overflows[0]<=0).sort((V,A)=>V.overflows[1]-A.overflows[1])[0])==null?void 0:wt.placement;if(!q)switch(d){case"bestFit":{var yt;const V=(yt=O.filter(A=>{if(v){const M=k(A.placement);return M===y||M==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(M=>M>0).reduce((M,Ft)=>M+Ft,0)]).sort((A,M)=>A[1]-M[1])[0])==null?void 0:yt[0];V&&(q=V);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}},Jt=new Set(["left","top"]);async function Qt(t,e){const{placement:n,platform:o,elements:i}=t,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=_(n),c=Y(n),l=k(n)==="y",a=Jt.has(r)?-1:1,f=s&&l?-1:1,u=U(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),l?{x:d*f,y:m*a}:{x:m*a,y:d*f}}const Zt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:s,placement:r,middlewareData:c}=e,l=await Qt(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},te=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...a}=U(t,e),f={x:n,y:o},u=await s.detectOverflow(e,a),m=k(i),d=xt(m);let h=f[d],g=f[m];const w=(y,x)=>Vt(x+u[y==="y"?"top":"left"],x,x-u[y==="y"?"bottom":"right"]);r&&(h=w(d,h)),c&&(g=w(m,g));const p=l.fn({...e,[d]:h,[m]:g});return{...p,data:{x:p.x-n,y:p.y-o,enabled:{[d]:r,[m]:c}}}}}},ee=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:s}=e,{apply:r=()=>{},...c}=U(t,e),l=await i.detectOverflow(e,c),a=_(n),f=Y(n),u=k(n)==="y",{width:m,height:d}=o.floating;let h,g;a==="top"||a==="bottom"?(h=a,g=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=a,h=f==="end"?"top":"bottom");const w=d-l.top-l.bottom,p=m-l.left-l.right,y=I(d-l[h],w),x=I(m-l[g],p),b=e.middlewareData.shift,C=!b;let v=y,P=x;b!=null&&b.enabled.x&&(P=p),b!=null&&b.enabled.y&&(v=w),C&&!f&&(u?P=m-2*S(l.left,l.right):v=d-2*S(l.top,l.bottom)),await r({...e,availableWidth:P,availableHeight:v});const T=await i.getDimensions(s.floating);return m!==T.width||d!==T.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function X(t){return Ot(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function D(t){var e;return(e=(Ot(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ot(t){return nt()?t instanceof Node||t instanceof R(t).Node:!1}function L(t){return nt()?t instanceof Element||t instanceof R(t).Element:!1}function F(t){return nt()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function Lt(t){return!nt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=E(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function ne(t){return/^(table|td|th)$/.test(X(t))}function it(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const oe=/transform|translate|scale|rotate|perspective|filter/,ie=/paint|layout|strict|content/,H=t=>!!t&&t!=="none";let ft;function ut(t){const e=L(t)?E(t):t;return H(e.transform)||H(e.translate)||H(e.scale)||H(e.rotate)||H(e.perspective)||!dt()&&(H(e.backdropFilter)||H(e.filter))||oe.test(e.willChange||"")||ie.test(e.contain||"")}function se(t){let e=B(t);for(;F(e)&&!G(e);){if(ut(e))return e;if(it(e))return null;e=B(e)}return null}function dt(){return ft==null&&(ft=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ft}function G(t){return/^(html|body|#document)$/.test(X(t))}function E(t){return R(t).getComputedStyle(t)}function st(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(X(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lt(t)&&t.host||D(t);return Lt(e)?e.host:e}function Et(t){const e=B(t);return G(e)?(t.ownerDocument||t).body:F(e)&&ot(e)?e:Et(e)}function J(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Et(t),s=i===((o=t.ownerDocument)==null?void 0:o.body),r=R(i);if(s){const c=mt(r);return e.concat(r,r.visualViewport||[],ot(i)?i:[],c&&n?J(c):[])}else return e.concat(i,J(i,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Tt(t){const e=E(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=F(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,c=Q(n)!==s||Q(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function ht(t){return L(t)?t:t.contextElement}function j(t){const e=ht(t);if(!F(e))return $(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:s}=Tt(e);let r=(s?Q(n.width):n.width)/o,c=(s?Q(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const re=$(0);function St(t){const e=R(t);return!dt()||!e.visualViewport?re:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ce(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===R(t)}function z(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=ht(t);let r=$(1);e&&(o?L(o)&&(r=j(o)):r=j(t));const c=ce(s,n,o)?St(s):$(0);let l=(i.left+c.x)/r.x,a=(i.top+c.y)/r.y,f=i.width/r.x,u=i.height/r.y;if(s&&o){const m=R(s),d=L(o)?R(o):o;let h=m,g=mt(h);for(;g&&d!==h;){const w=j(g),p=g.getBoundingClientRect(),y=E(g),x=p.left+(g.clientLeft+parseFloat(y.paddingLeft))*w.x,b=p.top+(g.clientTop+parseFloat(y.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,u*=w.y,l+=x,a+=b,h=R(g),g=mt(h)}}return et({width:f,height:u,x:l,y:a})}function rt(t,e){const n=st(t).scrollLeft;return e?e.left+n:z(D(t)).left+n}function $t(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-rt(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function le(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const s=i==="fixed",r=D(o),c=e?it(e.floating):!1;if(o===r||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=$(1);const f=$(0),u=F(o);if((u||!s)&&((X(o)!=="body"||ot(r))&&(l=st(o)),u)){const d=z(o);a=j(o),f.x=d.x+o.clientLeft,f.y=d.y+o.clientTop}const m=r&&!u&&!s?$t(r,l):$(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+f.x+m.x,y:n.y*a.y-l.scrollTop*a.y+f.y+m.y}}function ae(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function fe(t){const e=st(t),n=t.ownerDocument.body,o=S(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=S(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+rt(t);const r=-e.scrollTop;return E(n).direction==="rtl"&&(s+=S(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:s,y:r}}const ue=25;function de(t,e,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=R(t),s=D(t),r=i.visualViewport;let c=s.clientWidth,l=s.clientHeight,a=0,f=0;if(r){const m=!dt()||e==="fixed";o?m||(a=-r.offsetLeft,f=-r.offsetTop):(c=r.width,l=r.height,m&&(a=r.offsetLeft,f=r.offsetTop))}if(rt(s)<=0){const m=s.ownerDocument,d=m.body,h=getComputedStyle(d),g=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,w=Math.abs(s.clientWidth-d.clientWidth-g),p=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;p<=ue&&(c-=p)}return{width:c,height:l,x:a,y:f}}function me(t,e){const n=z(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=j(t),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,a=o*s.y;return{width:r,height:c,x:l,y:a}}function kt(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=de(t,n,e);else if(e==="document")o=fe(D(t));else if(L(e))o=me(e,n);else{const i=St(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return et(o)}function he(t,e){const n=e.get(t);if(n)return n;let o=J(t,[],!1).filter(c=>L(c)&&X(c)!=="body"),i=null;const s=E(t).position==="fixed";let r=s?B(t):t;for(;L(r)&&!G(r);){const c=E(r),l=ut(r),a=i?i.position:s?"fixed":"";!l&&(a==="fixed"||a==="absolute"&&c.position==="static")?o=o.filter(u=>u!==r):i=c,r=B(r)}return e.set(t,o),o}function pe(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[...n==="clippingAncestors"?it(e)?[]:he(e,this._c):[].concat(n),o],c=kt(e,r[0],i);let l=c.top,a=c.right,f=c.bottom,u=c.left;for(let m=1;m<r.length;m++){const d=kt(e,r[m],i);l=S(d.top,l),a=I(d.right,a),f=I(d.bottom,f),u=S(d.left,u)}return{width:a-u,height:f-l,x:u,y:l}}function ge(t){const{width:e,height:n}=Tt(t);return{width:e,height:n}}function we(t,e,n){const o=F(e),i=D(e),s=n==="fixed",r=z(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=$(0);if((o||!s)&&((X(e)!=="body"||ot(i))&&(c=st(e)),o)){const m=z(e,!0,s,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}!o&&i&&(l.x=rt(i));const a=i&&!o&&!s?$t(i,c):$(0),f=r.left+c.scrollLeft-l.x-a.x,u=r.top+c.scrollTop-l.y-a.y;return{x:f,y:u,width:r.width,height:r.height}}function pt(t){return E(t).position==="static"}function Dt(t,e){if(!F(t)||E(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return D(t)===n&&(n=n.ownerDocument.body),n}function Pt(t,e){const n=R(t);if(it(t))return n;if(!F(t)){let i=B(t);for(;i&&!G(i);){if(L(i)&&!pt(i))return i;i=B(i)}return n}let o=Dt(t,e);for(;o&&ne(o)&&pt(o);)o=Dt(o,e);return o&&G(o)&&pt(o)&&!ut(o)?n:o||se(t)||n}const ye=async function(t){const e=this.getOffsetParent||Pt,n=this.getDimensions,o=await n(t.floating);return{reference:we(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function xe(t){return E(t).direction==="rtl"}const be={convertOffsetParentRelativeRectToViewportRelativeRect:le,getDocumentElement:D,getClippingRect:pe,getOffsetParent:Pt,getElementRects:ye,getClientRects:ae,getDimensions:ge,getScale:j,isElement:L,isRTL:xe};function Mt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ve(t,e,n){let o=null,i;const s=D(t);function r(){var f;clearTimeout(i),(f=o)==null||f.disconnect(),o=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),r();const m=t.getBoundingClientRect(),{left:d,top:h,width:g,height:w}=m;if(f||e(),!g||!w)return;const p=Z(h),y=Z(s.clientWidth-(d+g)),x=Z(s.clientHeight-(h+w)),b=Z(d),v={rootMargin:-p+"px "+-y+"px "+-x+"px "+-b+"px",threshold:S(0,I(1,u))||1};let P=!0;function T(W){const O=W[0].intersectionRatio;if(!Mt(m,t.getBoundingClientRect()))return c();if(O!==u){if(!P)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(T,{...v,root:s.ownerDocument})}catch{o=new IntersectionObserver(T,v)}o.observe(t)}const l=R(t),a=()=>c(n);return l.addEventListener("resize",a),c(!0),()=>{l.removeEventListener("resize",a),r()}}function Re(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=ht(t),f=i||s?[...a?J(a):[],...e?J(e):[]]:[];f.forEach(p=>{i&&p.addEventListener("scroll",n),s&&p.addEventListener("resize",n)});const u=a&&c?ve(a,n,s):null;let m=-1,d=null;r&&(d=new ResizeObserver(p=>{let[y]=p;y&&y.target===a&&d&&e&&(d.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),n()}),a&&!l&&d.observe(a),e&&d.observe(e));let h,g=l?z(t):null;l&&w();function w(){const p=z(t);g&&!Mt(g,p)&&n(),g=p,h=requestAnimationFrame(w)}return n(),()=>{var p;f.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),u?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(h)}}const Ce=Zt,Ae=te,Oe=Gt,Le=ee,Ee=(t,e,n)=>{const o=new Map,i=n??{},s={...be,...i.platform,_c:o};return Yt(t,e,{...i,platform:s})},Te=(t,e)=>({top:e,bottom:e,right:t}),Se=(t,e,n,o={})=>{if(typeof t.showPopover!="function")return()=>{};try{t.showPopover()}catch{return()=>{}}let i=!0,s=0;const r=e instanceof Element?e:{getBoundingClientRect:()=>({x:e.right,y:e.top,left:e.right,right:e.right,top:e.top,bottom:e.bottom,width:0,height:e.bottom-e.top})};t.style.width=`${n.width}px`,t.style.maxHeight=`${n.height}px`;const l=Re(r,t,()=>{const a=++s;Ee(r,t,{strategy:"fixed",placement:o.placement??"bottom-end",middleware:[Ce(8),Oe({padding:8,fallbackAxisSideDirection:"end"}),Ae({padding:8}),Le({padding:8,apply:({availableWidth:f,availableHeight:u})=>{!i||a!==s||(t.style.width=`${Math.max(0,Math.min(n.width,f))}px`,t.style.maxHeight=`${Math.max(0,Math.min(n.height,u))}px`)}})]}).then(({x:f,y:u})=>{!i||a!==s||!t.isConnected||(t.style.left=`${f}px`,t.style.top=`${u}px`)}).catch(()=>{})},{animationFrame:o.trackTransform??!1,elementResize:typeof ResizeObserver<"u",layoutShift:typeof IntersectionObserver<"u"});return()=>{i=!1,l()}};class $e{#e;#t=new Map;constructor(e){this.#e=e,e.addController(this)}hostConnected(){this.#e.requestUpdate()}hostUpdated(){for(const[e,n]of this.#t)e.isConnected||(n(),this.#t.delete(e))}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}open(e,n,o,i){this.#t.get(e)?.(),this.#t.set(e,Se(e,n,o,i))}}const ke=Wt({en:{comment:"Comment",commentOn:t=>`Comment on ${t}`,submit:"Send",cancel:"Cancel"},ja:{comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:t=>`${t}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`,submit:"\u9001\u4FE1",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"}}),De=(t,e,n={})=>({body:t,notes:e,submission:t.trim()||null,label:n.label??null,error:n.error??null}),Pe=(t,e,n)=>{const o=()=>{e.submission!==null&&n({kind:"comment",body:e.submission})};return K`<div
2
2
  class="comment-pop"
3
3
  popover="manual"
4
4
  role="dialog"