dev-process-kit 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{shared-B0kk4Png.js → shared-8NAMqG0U.js} +1 -1
- package/dist/chunks/{shared-DLpKWOi6.js → shared-B00JP4in.js} +1 -1
- package/dist/chunks/shared-B5lBiq5s.js +1 -0
- package/dist/chunks/{shared-56aw61Mt.js → shared-BtN-8ibq.js} +1 -1
- package/dist/chunks/{shared-CYcKSitA.js → shared-C6QYWD8M.js} +3 -3
- package/dist/chunks/{shared-CHPc3-vO.js → shared-CUPe-wfx.js} +1 -1
- package/dist/chunks/{shared-BMyu-cIr.js → shared-CWKqlSx3.js} +1 -1
- package/dist/chunks/shared-CpTDkEui.js +3751 -0
- package/dist/chunks/shared-CtHWU02m.js +1 -0
- package/dist/chunks/{shared-6yS1zZwk.js → shared-DEjjuQMh.js} +1 -1
- package/dist/chunks/{shared-DlMlDHZ3.js → shared-DRvgJdY6.js} +1 -1
- package/dist/chunks/{shared-DFT6VIi_.js → shared-DWY93NpU.js} +1 -1
- package/dist/chunks/{shared-C1OgX-P6.js → shared-DXaIVZ_z.js} +56 -56
- package/dist/chunks/{shared-BqyO8tFt.js → shared-DzxR5Yzc.js} +1 -1
- package/dist/chunks/{shared-wOFcYu2a.js → shared-Ezic-gbC.js} +1 -1
- package/dist/chunks/{shared-BYBLt-RG.js → shared-IQ2sflGo.js} +1 -1
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-DdefS1nG.js +0 -1
- package/dist/chunks/shared-DewUyNUX.js +0 -2245
- package/dist/chunks/shared-sTu0Wlge.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,ai as I,V as u,C as v,h as U,a5 as x,a3 as l,a4 as d,b2 as J,aq as V,ab as W,z as Q,a2 as X,T as w}from"./shared-
|
|
1
|
+
import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,ai as I,V as u,C as v,h as U,a5 as x,a3 as l,a4 as d,b2 as J,aq as V,ab as W,z as Q,a2 as X,T as w}from"./shared-DXaIVZ_z.js";const m=_({en:{wholeDeck:"Whole deck",slideGroup:"Slide",outline:"Slides",previous:"Previous slide",next:"Next slide",position:(t,e)=>`Slide ${t} of ${e}`,commentOnSlide:"Comment on this slide",commentPlaceholder:"A question, or what should change (passed to the agent)",addComment:"Add comment",deleteComment:"Delete this comment",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"Full screen",fullscreenHint:"\u2190 \u2192 to move \xB7 Esc to leave",noSlidesBefore:"There are no slides yet. Add them to ",noSlidesAfter:" in the base data."},ja:{wholeDeck:"\u30C7\u30C3\u30AD\u5168\u4F53",slideGroup:"\u30B9\u30E9\u30A4\u30C9",outline:"\u30B9\u30E9\u30A4\u30C9",previous:"\u524D\u306E\u30B9\u30E9\u30A4\u30C9",next:"\u6B21\u306E\u30B9\u30E9\u30A4\u30C9",position:(t,e)=>`${e} \u679A\u4E2D ${t} \u679A\u76EE`,commentOnSlide:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u306B\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u8CEA\u554F\u3084\u3001\u5909\u3048\u3066\u307B\u3057\u3044\u3053\u3068\uFF08Agent \u306B\u6E21\u308B\uFF09",addComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",deleteComment:"\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"\u5168\u753B\u9762\u8868\u793A",fullscreenHint:"\u2190 \u2192 \u3067\u79FB\u52D5 \xB7 Esc \u3067\u623B\u308B",noSlidesBefore:"\u30B9\u30E9\u30A4\u30C9\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base data \u306E ",noSlidesAfter:" \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),y=["title","section","content"],Z=f({id:R,layout:c(I(y),"content"),title:G(p(),Y(1)),subtitle:c(p(),""),points:c(k(p()),[])}),$=f({title:c(p(),""),slides:c(k(Z),[])}),S=t=>{const e=N($,t),i=new Set;for(const n of e.slides){if(i.has(n.id))throw new Error(`duplicate slide id: ${n.id}`);i.add(n.id)}return{title:e.title,slides:e.slides}},C=()=>({title:"",slides:[]}),r=(t,e)=>e===void 0?-1:t.slides.findIndex(i=>i.id===e),q=(t,e)=>t.slides[r(t,e)],T=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}},F=(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},H=(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!==""),L=(t,e)=>{switch(e.type){case"slide":return q(t,e.id)!==void 0;case"page":return!0;default:return!1}},O=t=>{const e=m(t);return{name:"slides",label:"Slides",parseBase:S,emptyBase:C,actions:{},apply:()=>null,hasTarget:L,describe:(i,n)=>A(e,i,n),serialize:z,resolveNavigation:F,navigationFor:(i,n)=>n.type==="slide"?{slide:n.id}:null,commentTargets:i=>D(e,i),currentTarget:(i,n)=>M(e,i,n),title:T}},te={ArrowRight:"next",PageDown:"next",ArrowLeft:"previous",PageUp:"previous",Home:"first",End:"last"},P=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,4 +1,4 @@
|
|
|
1
|
-
import{p as m,au as E,v as A,aA as k,aB as S,ah as s,aj as x,ak as h,az as D,ad as Ue,ae as M,af as q,ag as N,P as Pe,e as Qe,a0 as Ce,V as I,R as g,l as Xe,a2 as H,a8 as Ye,j as Be,a1 as Ve,a9 as ze,aa as Ke,a3 as $,aE as Fe,a4 as f,A as je,K as Je,h as We,a5 as z,T as Z}from"./shared-C1OgX-P6.js";import{s as K}from"./shared-D4K7KsfJ.js";import{r as U,D as He}from"./shared-DdefS1nG.js";import{r as Ze,p as Ge,c as et}from"./shared-56aw61Mt.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),h(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(),h(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(),h(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),h(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(),h(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(),h(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),h(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(),h(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(),h(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),h(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(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},w={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=M({id:k,name:x(s(),h(1)),description:S(s())}),rt=M({id:k,storyId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),G=M({id:k,ruleId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),ee=M({title:S(s()),stories:q(N(tt),[]),rules:q(N(rt),[]),examples:q(N(G),[]),questions:q(N(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)},L=(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}`}},he=(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},fe=(e,t,r)=>{const a=L(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=L(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 L(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,navigationFor:(r,a)=>L(r,a.id)?.kind===a.type?{card:a.id}:null,commentTargets:(r,a)=>he(t,r),currentTarget:(r,a)=>fe(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=>w.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>w.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>w.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>w.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{p as m,au as E,v as A,aA as k,aB as S,ah as s,aj as x,ak as h,az as D,ad as Ue,ae as M,af as q,ag as N,P as Pe,e as Qe,a0 as Ce,V as I,R as g,l as Xe,a2 as H,a8 as Ye,j as Be,a1 as Ve,a9 as ze,aa as Ke,a3 as $,aE as Fe,a4 as f,A as je,K as Je,h as We,a5 as z,T as Z}from"./shared-DXaIVZ_z.js";import{s as K}from"./shared-D4K7KsfJ.js";import{r as U,D as He}from"./shared-B5lBiq5s.js";import{r as Ze,p as Ge,c as et}from"./shared-BtN-8ibq.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),h(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(),h(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(),h(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),h(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(),h(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(),h(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),h(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(),h(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(),h(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),h(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(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},w={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=M({id:k,name:x(s(),h(1)),description:S(s())}),rt=M({id:k,storyId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),G=M({id:k,ruleId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),ee=M({title:S(s()),stories:q(N(tt),[]),rules:q(N(rt),[]),examples:q(N(G),[]),questions:q(N(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)},L=(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}`}},he=(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},fe=(e,t,r)=>{const a=L(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=L(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 L(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,navigationFor:(r,a)=>L(r,a.id)?.kind===a.type?{card:a.id}:null,commentTargets:(r,a)=>he(t,r),currentTarget:(r,a)=>fe(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=>w.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>w.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>w.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>w.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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c={kind:"idle"},d="text/plain",h=s=>`${s.type}:${s.id}`,f=(s,t)=>{const e=(s??"").trim();if(e.length===0)return null;const r=e.indexOf(":");if(r<0)return{type:t,id:e};const n=e.slice(0,r),i=e.slice(r+1);return n.length===0||i.length===0?null:{type:n,id:i}},g=(s,t)=>t<=s.top+s.height/2?"before":"after";class p{#i;#t=c;#r;constructor(t){this.#i=t,t.addController(this)}hostDisconnected(){this.reset()}get state(){return this.#t}get item(){return this.#t.kind==="dragging"?this.#t.item:null}isDragging(t,e){const r=this.item;return r!==null&&r.type===t&&r.id===e}isOver(t){return this.#t.kind!=="idle"&&this.#t.over===t}reset(){clearTimeout(this.#r),this.#r=void 0,this.#e(c)}source(t){return{dragstart:e=>{e.dataTransfer&&(e.dataTransfer.setData(d,h(t)),e.dataTransfer.effectAllowed="move"),clearTimeout(this.#r),this.#r=setTimeout(()=>{this.#r=void 0,this.#e({kind:"dragging",item:t,over:null})},0)},dragend:()=>this.reset()}}target(t){return{dragenter:r=>{this.#s(t.accepts)&&(r.preventDefault(),this.#n(t.key))},dragover:r=>{this.#s(t.accepts)&&(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),this.#n(t.key))},dragleave:()=>{this.isOver(t.key)&&this.#n(null)},drop:r=>{r.preventDefault();const n=f(r.dataTransfer?.getData(d),t.accepts)??this.item;if(this.#e(c),!n||n.type!==t.accepts)return;const i=t.hovered?.(r)??null;t.onDrop({item:{type:t.accepts,id:n.id},hoveredId:i?.id??null,place:i?g(i.element.getBoundingClientRect(),r.clientY):"end",event:r})}}}combine(t,e){const r=()=>{const n=this.item!==null;return e.flatMap(([i,a])=>n||i===t?[a]:[])};return{dragenter:n=>r().forEach(i=>i.dragenter(n)),dragover:n=>r().forEach(i=>i.dragover(n)),dragleave:()=>e.forEach(([,n])=>n.dragleave()),drop:n=>{const i=f(n.dataTransfer?.getData(d),t)?.type??this.item?.type,a=e.find(([l])=>l===i)?.[1];if(a){a.drop(n);return}n.preventDefault(),this.#e(c)}}}#s(t){const e=this.item;return e===null||e.type===t}#n(t){const e=this.#t;if(e.kind==="dragging"){e.over!==t&&this.#e({...e,over:t});return}if(t===null){e.kind==="receiving"&&this.#e(c);return}(e.kind==="idle"||e.over!==t)&&this.#e({kind:"receiving",over:t})}#e(t){this.#t!==t&&(this.#t=t,this.#i.requestUpdate())}}const m=(s,t,e,r)=>{const i=s.filter(o=>o!==t).at(-1)??null;if(e===null||r==="end")return i;const a=s.indexOf(t),l=s.indexOf(e);if(l<0)return i;const u=o=>o<=0?null:s.at(o-1)??null;return a>=0?a<l?e:u(l):r==="after"?e:u(l)};export{p as D,m as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a0 as r,a3 as a,a4 as o}from"./shared-
|
|
1
|
+
import{a0 as r,a3 as a,a4 as o}from"./shared-DXaIVZ_z.js";const i=r({en:{comment:"Comment",commentOn:s=>`Comment on ${s}`,submit:"Send",cancel:"Cancel"},ja:{comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:s=>`${s}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`,submit:"\u9001\u4FE1",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"}}),c=(s,t,n={})=>({body:s,notes:t,submission:s.trim()||null,label:n.label??null,error:n.error??null,key:n.key??null}),p=(s,t,n)=>{const l=()=>{t.submission!==null&&n({kind:"comment",body:t.submission})};return o`<div
|
|
2
2
|
class="comment-pop"
|
|
3
3
|
popover="manual"
|
|
4
4
|
role="dialog"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aj as m,aO as Or,ae as O,aA as P,aB as g,ah as u,af as M,ai as le,ad as Cr,aP as Qe,aQ as Mr,ag as L,ak as x,aR as Lr,as as et,ap as Nr,p as w,au as y,v as ue,az as te,P as zr,e as Vr,a0 as Ur,h as tt,N as Ae,V as Y,U as Yr,R as k,a4 as p,a3 as l,aS as Ie,aT as Pe,aF as _e,a5 as Wr,z as Re,aE as rt,l as Hr,aU as D,aV as Br,A as it,aW as Gr,aX as qr,J as nt,aY as jr,ac as Fr,ab as Kr,a2 as Xr,T as ot,a1 as Zr,aZ as Jr,a9 as Qr,C as ei,a_ as ti}from"./shared-C1OgX-P6.js";import{p as ri,r as ii,c as ni}from"./shared-56aw61Mt.js";import{D as oi}from"./shared-sTu0Wlge.js";import{i as st}from"./shared-BMyu-cIr.js";const si=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]],ai=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]],di=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]],pi=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]],ci=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]],li=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]],ui=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18"}]],hi=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]],vi=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"}],["path",{d:"m14 7 3 3"}],["path",{d:"M5 6v4"}],["path",{d:"M19 14v4"}],["path",{d:"M10 2v2"}],["path",{d:"M7 8H3"}],["path",{d:"M21 16h-4"}],["path",{d:"M11 3H9"}]],at=["browser","native","mail","plain"],dt=["mobile","tablet","desktop","fluid"],K=e=>"screen"in e,gi=O({from:g(u()),to:g(u()),cc:g(u()),subject:g(u()),date:g(u())}),fi={id:P,kind:M(le(at),"browser"),viewport:M(le(dt),"fluid"),label:g(u()),url:g(u()),mail:g(gi)},De=m(O(fi),Or(e=>e.mail===void 0||e.kind==="mail",'a preview `mail` envelope needs `"kind": "mail"`')),pt=et([O({screen:P,preview:g(P)}),O({material:De})]),bi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),situation:g(m(u(),x(1))),panes:M(L(pt),[])}),wi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),steps:M(L(bi),[])}),mi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),stories:M(L(wi),[])}),ct=m(u(),x(1)),yi=O({id:P,label:m(u(),x(1)),description:g(u()),fill:g(Lr(ct,et([u(),Nr()]))),click:g(L(ct))}),ki=O({id:P,title:m(u(),x(1)),description:g(u()),previews:M(L(De),[]),actions:M(L(yi),[])}),xi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),screens:M(L(ki),[])}),lt=O({title:g(u()),baseUrl:g(u()),apps:M(L(xi),[]),activities:M(L(mi),[])}),ut=e=>e.flatMap(t=>K(t)?[]:[t.material]),$i=e=>{const t=new Set,r=s=>{for(const a of s){if(t.has(a.id))return`duplicate preview id "${a.id}": preview ids are global, they name a light DOM slot`;t.add(a.id)}return null},i=new Set,n=new Set;for(const s of e.apps){if(i.has(s.id))return`duplicate app id "${s.id}"`;i.add(s.id);for(const a of s.screens){if(n.has(a.id))return`duplicate screen id "${a.id}": screen ids are global`;n.add(a.id);const d=r(a.previews);if(d!==null)return d;const c=new Set;for(const f of a.actions){if(c.has(f.id))return`duplicate action id "${f.id}" on screen "${a.id}"`;c.add(f.id)}}}const o=new Set;for(const s of e.activities){if(o.has(s.id))return`duplicate activity id "${s.id}"`;o.add(s.id);const a=new Set;for(const d of s.stories){if(a.has(d.id))return`duplicate story id "${d.id}" in activity "${s.id}"`;a.add(d.id);const c=new Set;for(const f of d.steps){if(c.has(f.id))return`duplicate step id "${f.id}" in story "${d.id}"`;c.add(f.id);const h=r(ut(f.panes));if(h!==null)return h}}}return null},ht=(e,t)=>{const r=new Map;for(const i of t.panes){if(!K(i))continue;const n=e(i.screen);if(n===void 0)return`unknown screen "${i.screen}" on step "${t.id}": declare it under \`apps[].screens\``;if(i.preview!==void 0&&!n.includes(i.preview))return`preview "${i.preview}" on step "${t.id}" is not a rendition of screen "${i.screen}"`;const o=r.get(i.screen)??[];if(o.length>0&&(i.preview===void 0||o.includes(i.preview)||o.includes(void 0)))return`screen "${i.screen}" is shown twice on step "${t.id}": give each pane a different \`preview\``;r.set(i.screen,[...o,i.preview])}return null},Ei=e=>{const t=new Map(e.apps.flatMap(r=>r.screens.map(i=>[i.id,i.previews.map(n=>n.id)])));for(const r of e.activities.flatMap(i=>i.stories.flatMap(n=>n.steps))){const i=ht(n=>t.get(n),r);if(i!==null)return i}return null},Si=(e,t)=>ht(r=>N(e,r)?.screen.previews.map(i=>i.id),t),re="ui",vt=e=>{const t=e.text?.replaceAll('"',"'");return`${e.previewId}/${e.selector}${t===void 0?"":` "${t}"`}`},Oe=e=>{const t=e.indexOf("/");if(t<=0)return;const r=e.slice(0,t);if(!Mr(P,r))return;const i=e.slice(t+1),n=/ "([^"]*)"$/.exec(i),o=(n?i.slice(0,n.index):i).trim();if(o!=="")return n?.[1]===void 0?{previewId:r,selector:o}:{previewId:r,selector:o,text:n[1]}},gt=e=>{const t=Cr(lt,e),r=$i(t)??Ei(t);if(r!==null)throw new Error(r);return t},ft=()=>({apps:[],activities:[]}),W=e=>e.apps.flatMap(t=>t.screens.map(r=>({app:t,screen:r}))),N=(e,t)=>{if(t!==void 0)return W(e).find(r=>r.screen.id===t)},he=(e,t)=>t.panes.flatMap(r=>{const i=K(r)?N(e,r.screen):void 0;return i?[i]:[]}),X=e=>ut(e.panes),Ti=(e,t)=>e.panes.some(r=>K(r)&&r.screen===t),z=(e,t)=>{if(t!==void 0)return e.activities.find(r=>r.id===t)},C=(e,t)=>`${e}.${t}`,E=(e,t)=>{if(t===void 0)return;const r=Qe(t,2);if(r){const[n,o]=r;if(n===void 0||o===void 0)return;const s=e.activities.find(d=>d.id===n),a=s?.stories.find(d=>d.id===o);return s&&a?{activity:s,story:a}:void 0}if(t.includes("."))return;const i=e.activities.flatMap(n=>n.stories.filter(o=>o.id===t).map(o=>({activity:n,story:o})));return i.length===1?i[0]:void 0},bt=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},ie=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,ve=(e,t,r)=>`${e.id}.${t.id}.${r.id}`,$=(e,t)=>{if(t===void 0)return;const r=Qe(t,3);if(r){const[n,o,s]=r;if(n===void 0||o===void 0||s===void 0)return;const a=e.activities.find(h=>h.id===n),d=a?.stories.find(h=>h.id===o),c=d?d.steps.findIndex(h=>h.id===s):-1,f=d&&c>=0?d.steps[c]:void 0;return a&&d&&f?{activity:a,story:d,step:f,stepIndex:c}:void 0}if(t.includes("."))return;const i=H(e).filter(n=>n.step.id===t);return i.length===1?i[0]:void 0},T=(e,t)=>{if(t!==void 0){for(const r of W(e)){const i=r.screen.previews.find(n=>n.id===t);if(i)return{owner:{kind:"screen",...r},preview:i}}for(const r of H(e)){const i=X(r.step).find(n=>n.id===t);if(i)return{owner:{kind:"step",...r},preview:i}}}},H=e=>e.activities.flatMap(t=>t.stories.flatMap(r=>r.steps.map((i,n)=>({activity:t,story:r,step:i,stepIndex:n})))),wt=e=>H(e).map(t=>t.step.id),b={SET_ACTIVITY_NAME:w("SET_ACTIVITY_NAME","activity",y({name:m(u(),x(1))})),SET_ACTIVITY_DESCRIPTION:w("SET_ACTIVITY_DESCRIPTION","activity",y({description:u()})),SET_STORY_NAME:w("SET_STORY_NAME","story",y({name:m(u(),x(1))})),SET_STORY_DESCRIPTION:w("SET_STORY_DESCRIPTION","story",y({description:u()})),SET_STEP_NAME:w("SET_STEP_NAME","step",y({name:m(u(),x(1))})),SET_STEP_DESCRIPTION:w("SET_STEP_DESCRIPTION","step",y({description:u()})),SET_PREVIEW_KIND:w("SET_PREVIEW_KIND","preview",y({kind:le(at)})),SET_PREVIEW_VIEWPORT:w("SET_PREVIEW_VIEWPORT","preview",y({viewport:le(dt)})),SET_PREVIEW_LABEL:w("SET_PREVIEW_LABEL","preview",y({label:u()})),REORDER_ACTIVITY:w("REORDER_ACTIVITY","activity",y({after:te(u())}),{mode:"sequence"}),REORDER_STORY:w("REORDER_STORY","story",y({after:te(u())}),{mode:"sequence"}),REORDER_STEP:w("REORDER_STEP","step",y({after:te(u())}),{mode:"sequence"}),MOVE_STORY:w("MOVE_STORY","story",y({toActivity:m(u(),x(1)),after:te(u())}),{mode:"sequence"}),MOVE_STEP:w("MOVE_STEP","step",y({toStory:m(u(),x(1)),after:te(u())}),{mode:"sequence"}),ADD_ACTIVITY:w("ADD_ACTIVITY","page",y({id:P,name:m(u(),x(1)),description:g(u())}),{dedupeKey:ue}),ADD_STORY:w("ADD_STORY","activity",y({id:P,name:m(u(),x(1)),description:g(u())}),{dedupeKey:ue}),ADD_STEP:w("ADD_STEP","story",y({id:P,name:m(u(),x(1)),description:g(u()),panes:g(L(pt))}),{dedupeKey:ue}),ADD_PREVIEW:w("ADD_PREVIEW","step",De,{dedupeKey:ue}),DELETE_ACTIVITY:w("DELETE_ACTIVITY","activity",y({})),DELETE_STORY:w("DELETE_STORY","story",y({})),DELETE_STEP:w("DELETE_STEP","step",y({})),DELETE_PREVIEW:w("DELETE_PREVIEW","preview",y({}))},ne={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setActivityDescription:(e,t)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:e},payload:{description:t}}),setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}}),setStepDescription:(e,t)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:e},payload:{description:t}}),setPreviewViewport:(e,t)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:e},payload:{viewport:t}}),setPreviewKind:(e,t)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:e},payload:{kind:t}}),setPreviewLabel:(e,t)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:e},payload:{label:t}}),reorderActivity:(e,t)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:e},payload:{after:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),reorderStep:(e,t)=>({type:"REORDER_STEP",target:{type:"step",id:e},payload:{after:t}}),moveStep:(e,t,r)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:r}}),moveStory:(e,t,r)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:r}}),addActivity:(e,t,r)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...r===void 0?{}:{description:r}}}),addStory:(e,t,r,i)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:r,...i===void 0?{}:{description:i}}}),addStep:(e,t,r,i)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:r,...i===void 0?{}:{panes:i}}}),addPreview:(e,t)=>({type:"ADD_PREVIEW",target:{type:"step",id:e},payload:{...t}}),deleteActivity:e=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:e},payload:{}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),deleteStep:e=>({type:"DELETE_STEP",target:{type:"step",id:e},payload:{}}),deletePreview:e=>({type:"DELETE_PREVIEW",target:{type:"preview",id:e},payload:{}})},mt=(e,t)=>{const r=zr(b,t);if(r===null)return null;const i=r.target.id;switch(r.type){case"SET_ACTIVITY_NAME":return B(e,i,n=>({...n,name:r.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return B(e,i,n=>({...n,description:r.payload.description}));case"SET_STORY_NAME":return G(e,i,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return G(e,i,n=>({...n,description:r.payload.description}));case"SET_STEP_NAME":return ge(e,i,n=>({...n,name:r.payload.name}));case"SET_STEP_DESCRIPTION":return ge(e,i,n=>({...n,description:r.payload.description}));case"SET_PREVIEW_KIND":return Me(e,i,n=>({...n,kind:r.payload.kind}));case"SET_PREVIEW_VIEWPORT":return Me(e,i,n=>({...n,viewport:r.payload.viewport}));case"SET_PREVIEW_LABEL":return Me(e,i,n=>({...n,label:r.payload.label}));case"REORDER_ACTIVITY":{const{after:n}=r.payload,o=oe(e.activities,i,n);return o===null?null:{...e,activities:o}}case"REORDER_STORY":{const{after:n}=r.payload,o=E(e,i);if(!o)return null;const s=n===null?null:E(e,n);if(n!==null&&(!s||s.activity!==o.activity))return null;const a=oe(o.activity.stories,o.story.id,s?.story.id??null);return a===null?null:B(e,o.activity.id,d=>({...d,stories:a}))}case"REORDER_STEP":{const{after:n}=r.payload,o=$(e,i);if(!o)return null;const s=n===null?null:$(e,n);if(n!==null&&(!s||s.story!==o.story))return null;const a=oe(o.story.steps,o.step.id,s?.step.id??null);return a===null?null:G(e,C(o.activity.id,o.story.id),d=>({...d,steps:a}))}case"MOVE_STORY":{const{toActivity:n,after:o}=r.payload,s=E(e,i);if(!s)return null;const a=e.activities.find(h=>h.id===n);if(!a)return null;const d=o===null?null:E(e,o);if(o!==null&&(!d||d.activity!==a))return null;const c=d?.story.id??null;if(s.activity.id===n){const h=oe(s.activity.stories,s.story.id,c);return h===null?null:B(e,n,v=>({...v,stories:h}))}if(a.stories.some(h=>h.id===s.story.id))return null;const f=Le(a.stories,s.story,c);return Ce(e,h=>h.id===s.activity.id?{...h,stories:h.stories.filter(v=>v.id!==bt(i))}:h.id===n?{...h,stories:f}:h)}case"MOVE_STEP":{const{toStory:n,after:o}=r.payload,s=$(e,i);if(!s)return null;const a=E(e,n);if(!a)return null;const d=o===null?null:$(e,o);if(o!==null&&(!d||d.story!==a.story))return null;const c=d?.step.id??null;if(s.story===a.story){const h=oe(s.story.steps,s.step.id,c);return h===null?null:G(e,n,v=>({...v,steps:h}))}if(a.story.steps.some(h=>h.id===s.step.id))return null;const f=Le(a.story.steps,s.step,c);return Ce(e,h=>({...h,stories:h.stories.map(v=>v===s.story?{...v,steps:v.steps.filter(I=>I.id!==bt(i))}:v===a.story?{...v,steps:f}:v)}))}case"ADD_ACTIVITY":{const n=r.payload;if(e.activities.some(s=>s.id===n.id))return e;const o={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},stories:[]};return{...e,activities:[...e.activities,o]}}case"ADD_STORY":{const n=r.payload,o=e.activities.find(a=>a.id===i);if(!o)return null;if(o.stories.some(a=>a.id===n.id))return e;const s={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},steps:[]};return B(e,i,a=>({...a,stories:[...a.stories,s]}))}case"ADD_STEP":{const n=r.payload,o=E(e,i)?.story;if(!o)return null;if(o.steps.some(d=>d.id===n.id))return e;const s=n.panes??[],a={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},panes:s};return Ai(e,a)?G(e,i,d=>({...d,steps:[...d.steps,a]})):null}case"ADD_PREVIEW":{const n=r.payload,o=$(e,i)?.step;return o?X(o).some(s=>s.id===n.id)?e:T(e,n.id)?null:ge(e,i,s=>({...s,panes:[...s.panes,{material:n}]})):null}case"DELETE_ACTIVITY":{const n=i;return e.activities.some(o=>o.id===n)?{...e,activities:e.activities.filter(o=>o.id!==n)}:null}case"DELETE_STORY":{const n=E(e,i);return n?B(e,n.activity.id,o=>({...o,stories:o.stories.filter(s=>s.id!==n.story.id)})):null}case"DELETE_STEP":{const n=$(e,i);return n?G(e,C(n.activity.id,n.story.id),o=>({...o,steps:o.steps.filter(s=>s.id!==n.step.id)})):null}case"DELETE_PREVIEW":{const n=T(e,i);return n?yt(e,n.owner,o=>o.filter(s=>s.id!==n.preview.id)):null}default:return Vr(r)}},Ce=(e,t)=>({...e,activities:e.activities.map(t)}),B=(e,t,r)=>{const i=t;return e.activities.some(n=>n.id===i)?Ce(e,n=>n.id===i?r(n):n):null},G=(e,t,r)=>{const i=E(e,t);if(!i)return null;const n=i.story.id;return B(e,i.activity.id,o=>({...o,stories:o.stories.map(s=>s.id===n?r(s):s)}))},ge=(e,t,r)=>{const i=$(e,t);if(!i)return null;const n=i.step.id;return G(e,C(i.activity.id,i.story.id),o=>({...o,steps:o.steps.map(s=>s.id===n?r(s):s)}))},Me=(e,t,r)=>{const i=T(e,t);if(!i)return null;const n=i.preview.id;return yt(e,i.owner,o=>o.map(s=>s.id===n?r(s):s))},Ai=(e,t)=>{const r=X(t).map(i=>i.id);return Si(e,t)===null&&new Set(r).size===r.length&&!r.some(i=>T(e,i))},yt=(e,t,r)=>{if(t.kind==="step")return ge(e,ie(t),n=>{const o=new Map(r([...X(n)]).map(s=>[s.id,s]));return{...n,panes:n.panes.flatMap(s=>{if(K(s))return[s];const a=o.get(s.material.id);return a?[{material:a}]:[]})}});const i=t.screen.id;return{...e,apps:e.apps.map(n=>n.id===t.app.id?{...n,screens:n.screens.map(o=>o.id===i?{...o,previews:r(o.previews)}:o)}:n)}},oe=(e,t,r)=>{const i=e.findIndex(s=>s.id===t);if(i<0||r!==null&&!e.some(s=>s.id===r))return null;if(t===r)return[...e];const n=e[i];if(n===void 0)return null;const o=e.filter(s=>s.id!==t);return Le(o,n,r)},Le=(e,t,r)=>{const i=[...e],n=r===null?-1:i.findIndex(o=>o.id===r);return i.splice(n+1,0,t),i},kt={"iphone-se":"iPhone SE","iphone-16":"iPhone 16","iphone-16-pro-max":"iPhone 16 Pro Max","pixel-7":"Pixel 7","galaxy-s24":"Galaxy S24","ipad-mini":"iPad mini","ipad-air-11":'iPad Air 11"',"ipad-pro-11":'iPad Pro 11"',"ipad-pro-13":'iPad Pro 13"'},Ii={"laptop-13":'13" laptop',"laptop-15":'15" laptop',"full-hd":"Full HD","monitor-27":'27" monitor',ultrawide:"Ultrawide"},Pi={"laptop-13":"13 \u30A4\u30F3\u30C1 \u30CE\u30FC\u30C8","laptop-15":"15 \u30A4\u30F3\u30C1 \u30CE\u30FC\u30C8","full-hd":"\u30D5\u30EB HD","monitor-27":"27 \u30A4\u30F3\u30C1 \u30E2\u30CB\u30BF\u30FC",ultrawide:"\u30A6\u30EB\u30C8\u30E9\u30EF\u30A4\u30C9"},fe=Ur({en:{renameActivity:"Rename Activity",updateActivityDescription:"Update Activity description",renameStory:"Rename UserStory",updateStoryDescription:"Update UserStory description",renameStep:"Rename Step",updateStepDescription:"Update Step description",changePreviewKind:"Change Preview kind",changePreviewViewport:"Change Preview viewport",changePreviewLabel:"Change Preview label",moveStory:"Move UserStory",moveStep:"Move Step",deleteTitle:"Delete",reorderTitle:e=>`Reorder ${e}`,addTitle:e=>`Add ${e}`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after "${e}"`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",screenGroup:"Screen",openInApp:"Open this screen in the app view",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"There are no Activities yet. Add ",noActivityAfter:" to the base JSON, or ask the agent.",deleteStepAria:"Delete step",addStepButton:"+ Step",stepNameLabel:"Step name",descriptionLabel:"Description",descriptionPlaceholder:"What happens in this Step (click to edit)",newStepName:"New step",viewLabel:"View",viewScenario:"Scenario",viewApp:"App",viewScenarioHint:"Follow one user story step by step",viewAppHint:"Use the UI as one app, whatever the scenario",appScreens:"Screens",appScreensHint:"Pick a screen to start from, then move around through the UI itself.",appSelectLabel:"App",appOutsideBrowser:"Outside the browser",noStepBefore:"There are no Steps yet. A Prototype has the meaning structure ",noStepAfter:" \u2014 one Step is one moment of the story: the screen the user is on and what they have at hand. Add a Step to the base JSON, and its screen will appear here.",noScreens:"This product has no screens yet. Declare its apps and their screens under apps[].screens in the base JSON, and they will appear here.",noPreviewMetadata:"No preview metadata \u2014 ask the agent to add it.",storyWithoutSteps:"This UserStory has no Steps yet, so there is no screen to show. Add one with + Step, or ask the agent to prototype it.",pageActor:e=>`Used by ${e}`,maximize:"Maximize",restore:"Restore size",maximizeHint:"Show the preview alone across the tab \xB7 Esc to restore",situation:"Situation",uiComment:"Comment on UI",uiCommentHint:"Click any part of the preview to comment on it \xB7 Esc to finish",uiCommentPin:(e,t)=>`Comment ${e}: ${t}`,mailFrom:"From",mailTo:"To",mailCc:"Cc",mailDate:"Date",demo:"Demo",demoHint:"Use the app in a browser across the tab, with nothing else on screen \xB7 Esc to finish",exitDemo:"Exit demo",browserBack:"Back",browserForward:"Forward",browserReload:"Reload",browserAddress:"Address",browserTabs:"Tabs",newTab:"New tab",closeTab:"Close tab",browserProfile:e=>`Profile: ${e}`,browserGuest:"Guest",newTabShortcuts:"Pages of this app",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page of the prototype has this address.",device:"Device",deviceHint:"The window the app runs in: a page taller than it scrolls inside, as on the device",deviceName:e=>kt[e]??Ii[e]??e,deviceZoom:e=>`Shown at ${e}% to fit`,actions:"Actions",actionsHint:"Make the screen do something in one go, e.g. fill its form with sample data"},ja:{renameActivity:"Activity \u540D\u3092\u5909\u66F4",updateActivityDescription:"Activity \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStory:"UserStory \u540D\u3092\u5909\u66F4",updateStoryDescription:"UserStory \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStep:"Step \u540D\u3092\u5909\u66F4",updateStepDescription:"Step \u306E\u8AAC\u660E\u3092\u66F4\u65B0",changePreviewKind:"Preview \u306E\u7A2E\u5225\u3092\u5909\u66F4",changePreviewViewport:"Preview \u306E\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8\u3092\u5909\u66F4",changePreviewLabel:"Preview \u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",moveStory:"UserStory \u3092\u79FB\u52D5",moveStep:"Step \u3092\u79FB\u52D5",deleteTitle:"\u524A\u9664",reorderTitle:e=>`${e} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:e=>`${e} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 "${e}" \u306E\u76F4\u5F8C\u3078`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",screenGroup:"\u753B\u9762",openInApp:"\u3053\u306E\u753B\u9762\u3092\u30A2\u30D7\u30EA\u30D3\u30E5\u30FC\u3067\u958B\u304F",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"Activity \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E ",noActivityAfter:" \u3092\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",deleteStepAria:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",addStepButton:"+ Step",stepNameLabel:"Step \u540D",descriptionLabel:"\u8AAC\u660E",descriptionPlaceholder:"\u3053\u306E Step \u3067\u4F55\u304C\u8D77\u304D\u308B\u304B\uFF08\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\uFF09",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",viewLabel:"\u8868\u793A",viewScenario:"\u30B7\u30CA\u30EA\u30AA",viewApp:"\u30A2\u30D7\u30EA",viewScenarioHint:"\u30E6\u30FC\u30B6\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC\u306B\u6CBF\u3063\u3066 Step \u3092\u9806\u306B\u305F\u3069\u308B",viewAppHint:"\u30B7\u30CA\u30EA\u30AA\u306B\u95A2\u4FC2\u306A\u304F\u3001UI \u3092 1 \u3064\u306E\u30A2\u30D7\u30EA\u3068\u3057\u3066\u89E6\u308B",appScreens:"\u753B\u9762",appScreensHint:"\u8D77\u70B9\u306B\u3059\u308B\u753B\u9762\u3092\u9078\u3073\u3001\u3042\u3068\u306F UI \u306E\u30EA\u30F3\u30AF\u3067\u79FB\u52D5\u3057\u307E\u3059\u3002",appSelectLabel:"\u30A2\u30D7\u30EA",appOutsideBrowser:"\u30D6\u30E9\u30A6\u30B6\u4EE5\u5916",noStepBefore:"Step \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002Prototype \u306F ",noStepAfter:" \u306E\u610F\u5473\u69CB\u9020\u3092\u6301\u3061\u30011 Step = \u30B7\u30CA\u30EA\u30AA\u306E 1 \u5834\u9762\uFF08\u30E6\u30FC\u30B6\u30FC\u304C\u3044\u308B\u753B\u9762\u3068\u3001\u624B\u5143\u306B\u3042\u308B\u3082\u306E\uFF09\u3067\u3059\u3002base JSON \u306B Step \u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u305D\u306E\u753B\u9762\u304C\u73FE\u308C\u307E\u3059\u3002",noScreens:"\u3053\u306E\u30D7\u30ED\u30C0\u30AF\u30C8\u306B\u306F\u307E\u3060\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E apps[].screens \u306B\u30A2\u30D7\u30EA\u3068\u753B\u9762\u3092\u5BA3\u8A00\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u73FE\u308C\u307E\u3059\u3002",noPreviewMetadata:"preview metadata \u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u8FFD\u52A0\u306F Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044",storyWithoutSteps:"\u3053\u306E UserStory \u306B\u306F\u307E\u3060 Step \u304C\u306A\u304F\u3001\u898B\u305B\u308B\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002+ Step \u3067\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",pageActor:e=>`\u5229\u7528\u8005: ${e}`,maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",maximizeHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3060\u3051\u3092\u30BF\u30D6\u3044\u3063\u3071\u3044\u306B\u8868\u793A \xB7 Esc \u3067\u623B\u308B",situation:"\u72B6\u6CC1",uiComment:"UI \u306B\u30B3\u30E1\u30F3\u30C8",uiCommentHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30B3\u30E1\u30F3\u30C8 \xB7 Esc \u3067\u7D42\u4E86",uiCommentPin:(e,t)=>`\u30B3\u30E1\u30F3\u30C8 ${e}: ${t}`,mailFrom:"\u5DEE\u51FA\u4EBA",mailTo:"\u5B9B\u5148",mailCc:"Cc",mailDate:"\u65E5\u6642",demo:"\u30C7\u30E2",demoHint:"\u307B\u304B\u306B\u4F55\u3082\u51FA\u3055\u305A\u3001\u30BF\u30D6\u3044\u3063\u3071\u3044\u306E\u30D6\u30E9\u30A6\u30B6\u3067\u30A2\u30D7\u30EA\u3092\u89E6\u308B \xB7 Esc \u3067\u7D42\u4E86",exitDemo:"\u30C7\u30E2\u3092\u7D42\u4E86",browserBack:"\u623B\u308B",browserForward:"\u9032\u3080",browserReload:"\u518D\u8AAD\u307F\u8FBC\u307F",browserAddress:"\u30A2\u30C9\u30EC\u30B9",browserTabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",browserProfile:e=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${e}`,browserGuest:"\u30B2\u30B9\u30C8",newTabShortcuts:"\u3053\u306E\u30A2\u30D7\u30EA\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306B\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",device:"\u30C7\u30D0\u30A4\u30B9",deviceHint:"\u30A2\u30D7\u30EA\u3092\u52D5\u304B\u3059\u753B\u9762\u306E\u5927\u304D\u3055\u3002\u53CE\u307E\u3089\u306A\u3044\u30DA\u30FC\u30B8\u306F\u5B9F\u6A5F\u3068\u540C\u3058\u304F\u753B\u9762\u306E\u4E2D\u3067\u30B9\u30AF\u30ED\u30FC\u30EB\u3059\u308B",deviceName:e=>kt[e]??Pi[e]??e,deviceZoom:e=>`\u53CE\u307E\u308B\u3088\u3046 ${e}% \u3067\u8868\u793A`,actions:"\u30A2\u30AF\u30B7\u30E7\u30F3",actionsHint:"\u30D5\u30A9\u30FC\u30E0\u306B\u30B5\u30F3\u30D7\u30EB\u30C7\u30FC\u30BF\u3092\u5165\u308C\u308B\u306A\u3069\u3001\u753B\u9762\u306B\u7528\u610F\u3055\u308C\u305F\u64CD\u4F5C\u3092\u4E00\u5EA6\u306B\u884C\u3046"}}),_i=["scenario","app"],V="view",se=e=>e[V]==="app"?"app":"scenario",xt=e=>({[V]:e==="app"?"app":null}),ae=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,Ri=e=>({SET_ACTIVITY_NAME:(t,r)=>({title:e.renameActivity,tone:"update",body:ae(z(r,t.target.id)?.name,k(b.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,r)=>({title:e.updateActivityDescription,tone:"update",body:Ne(z(r,t.target.id)?.description,k(b.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,r)=>({title:e.renameStory,tone:"update",body:ae(E(r,t.target.id)?.story.name,k(b.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,r)=>({title:e.updateStoryDescription,tone:"update",body:Ne(E(r,t.target.id)?.story.description,k(b.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,r)=>({title:e.renameStep,tone:"update",body:ae($(r,t.target.id)?.step.name,k(b.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,r)=>({title:e.updateStepDescription,tone:"update",body:Ne($(r,t.target.id)?.step.description,k(b.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,r)=>({title:e.changePreviewKind,tone:"update",body:ae(T(r,t.target.id)?.preview.kind,k(b.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,r)=>({title:e.changePreviewViewport,tone:"update",body:ae(T(r,t.target.id)?.preview.viewport,k(b.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${k(b.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>ze(e,e.activityGroup,k(b.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>ze(e,e.storyGroup,k(b.REORDER_STORY,t).after),REORDER_STEP:t=>ze(e,e.stepGroup,k(b.REORDER_STEP,t).after),MOVE_STORY:(t,r)=>({title:e.moveStory,tone:"move",body:`\u2192 ${z(r,k(b.MOVE_STORY,t).toActivity)?.name??k(b.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,r)=>({title:e.moveStep,tone:"move",body:`\u2192 ${E(r,k(b.MOVE_STEP,t).toStory)?.story.name??k(b.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>be(e,e.activityGroup,k(b.ADD_ACTIVITY,t).name),ADD_STORY:t=>be(e,e.storyGroup,k(b.ADD_STORY,t).name),ADD_STEP:t=>be(e,e.stepGroup,k(b.ADD_STEP,t).name),ADD_PREVIEW:t=>be(e,e.previewGroup,k(b.ADD_PREVIEW,t).label??k(b.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,r)=>we(e,z(r,t.target.id)?.name),DELETE_STORY:(t,r)=>we(e,E(r,t.target.id)?.story.name),DELETE_STEP:(t,r)=>we(e,$(r,t.target.id)?.step.name),DELETE_PREVIEW:(t,r)=>we(e,T(r,t.target.id)?.preview.label)}),Ne=(e,t)=>{const r=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${r}"`:`"${Di(e)}" \u2192 "${r}"`},Di=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,ze=(e,t,r)=>({title:e.reorderTitle(t),tone:"move",body:r===null?e.toFront:e.afterName(r)}),be=(e,t,r)=>({title:e.addTitle(t),tone:"create",body:`+ "${r}"`}),we=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),$t=(e,t,r,i)=>{const n=Ri(e),o=Object.hasOwn(n,t.type)?n[t.type]:void 0,s=o?o(t,i??r):{title:t.type,tone:"meta"};return{title:s.title,targetLabel:St(e,r,t.target),tone:s.tone,...s.body===void 0?{}:{summary:s.body}}},Et=e=>`${e.type} ${Y(e.target)} ${JSON.stringify(e.payload)}`,St=(e,t,r)=>{switch(r.type){case"activity":{const i=z(t,r.id);return i?e.targetLabel(e.activityGroup,i.name):e.targetMissing(e.activityGroup,r.id)}case"story":{const i=E(t,r.id)?.story;return i?e.targetLabel(e.storyGroup,i.name):e.targetMissing(e.storyGroup,r.id)}case"step":{const i=$(t,r.id)?.step;return i?e.targetLabel(e.stepGroup,i.name):e.targetMissing(e.stepGroup,r.id)}case"screen":{const i=N(t,r.id)?.screen;return i?e.targetLabel(e.screenGroup,i.title):e.targetMissing(e.screenGroup,r.id)}case"preview":{const i=T(t,r.id)?.preview;return i?e.targetLabel(e.previewGroup,i.label??i.id):e.targetMissing(e.previewGroup,r.id)}case"page":return e.targetLabel(e.pageGroup,Ye(t));case re:{const i=Oe(r.id),n=i?T(t,i.previewId)?.preview:void 0;return i&&n?e.targetLabel(e.uiGroup,Tt(n,i)):e.targetMissing(e.uiGroup,r.id)}default:return e.targetLabel(r.type,r.id)}},Tt=(e,t)=>{const r=t.text===void 0?t.selector:`"${t.text}"`;return`${e.label??e.id} \u203A ${r}`},At=(e,t)=>{const r=[];for(const i of e){if(i.target.type!==re)continue;const n=Oe(i.target.id);!n||!t.includes(n.previewId)||r.push({id:i.id,previewId:n.previewId,selector:n.selector,number:r.length+1,body:tt(i)})}return r},It=(e,t)=>At(e,t).length,Oi=/^[a-z][a-z0-9+.-]*:/i,Ci=e=>{const t=e.baseUrl?.trim(),r=Yr(e.title??"");return`${(t?t.startsWith("http")?t:`https://${t}`:`https://${r==="item"?"page":r}.example.com`).replace(/\/+$/,"")}/`},me=(e,t)=>{const r=Ci(e);if(!t.url)return`${r}${t.id}`;if(Oi.test(t.url))return t.url;try{return decodeURI(new URL(t.url,r).href)}catch{return t.url}},Mi=e=>{switch(e.type){case"activity":return{[V]:null,activity:e.id};case"story":return{[V]:null,activity:null,story:e.id};case"step":return{[V]:null,activity:null,story:null,step:e.id};case"screen":return{screen:e.id};default:return null}},Pt=(e,t)=>{const r=e.kind==="screen"?[{type:"screen",id:e.screen.id}]:[{type:"activity",id:e.activity.id},{type:"story",id:C(e.activity.id,e.story.id)},...e.kind==="step"?[{type:"step",id:ie(e)}]:[]];for(const i of t?.panes??[])i.kind==="screen"&&r.push({type:"screen",id:i.screen.screen.id});return[...new Set(r.map(Y))].join(" ")},Ve=",",_t=e=>e.preview?.split(Ve)??[],Li=(e,t)=>e.kind===t.kind&&e.viewport===t.viewport,Rt=(e,t,r)=>{const i=t.find(o=>r.includes(o.id));if(i)return i;const n=r.flatMap(o=>T(e,o)?.preview??[]);return t.find(o=>n.some(s=>Li(o,s)))??t[0]},Dt=(e,t,r,i)=>{const n=t.screen.previews,o=r===void 0?Rt(e,n,_t(i)):n.find(a=>a.id===r);if(!o)return;const s=r===void 0&&n.length>1;return{kind:"screen",screen:t,preview:o,pinned:r!==void 0,tabs:s?n:[]}},Ot=e=>({layout:e.length>1?"side-by-side":"single",panes:e,shown:e.map(t=>t.preview)}),Ct=(e,t,r)=>t.panes.flatMap(i=>{if(!K(i))return[{kind:"material",preview:i.material}];const n=N(e,i.screen),o=n&&Dt(e,n,i.preview,r);return o?[o]:[]}),Ue=(e,t,r)=>{if(t.kind==="screen"){const i=Dt(e,t,void 0,r);return Ot(i?[i]:[])}return Ot(Ct(e,t.step,r))},Ni=(e,t)=>e.panes.flatMap(r=>r.kind!=="screen"||r.tabs.length===0?[]:[r.tabs.some(i=>i.id===t)?t:r.preview.id]).join(Ve),Mt=(e,t)=>{const r=new Map;for(const i of t){const n=T(e,i)?.owner;if(n?.kind!=="screen"||n.screen.actions.length===0)continue;const o=r.get(n.screen.id)??{screen:n.screen,previewIds:[]};o.previewIds.push(i),r.set(n.screen.id,o)}return[...r.values()].map(({screen:i,previewIds:n})=>({screen:i,previewIds:n,actions:i.actions}))},zi=(e,t)=>[...X(t),...he(e,t).flatMap(r=>r.screen.previews)],Vi=["activity","story","step","screen","preview"],Ui=(e,t,r)=>{switch(t){case"activity":return z(e,r)!==void 0;case"story":return E(e,r)!==void 0||e.activities.some(i=>i.stories.some(n=>n.id===r));case"step":return $(e,r)!==void 0||H(e).some(i=>i.step.id===r);case"screen":return N(e,r)!==void 0;case"preview":return T(e,r)!==void 0;default:return!1}},Yi=(e,t)=>{let r;if(t.navigate!==null)r=t.navigate.includes("=")?t.navigate:`step=${t.navigate}`;else{const o=t.href?.trim()??"";if(o===""||o==="#"||o.toLowerCase().startsWith("javascript:"))return"no-destination";if(!o.startsWith("#"))return null;r=o}const i=Ae(r),n=Vi.filter(o=>i[o]!==void 0);return n.length===0?t.navigate===null?null:"unknown-target":n.every(o=>Ui(e,o,i[o]??""))?null:"unknown-target"},Wi=(e,t)=>{const r=t.mail??{},i=[{label:e.mailFrom,value:r.from},{label:e.mailTo,value:r.to},{label:e.mailCc,value:r.cc},{label:e.mailDate,value:r.date}].flatMap(s=>s.value===void 0||s.value.trim()===""?[]:[{label:s.label,value:s.value}]),n=r.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||r.from?.trim(),o=n?Array.from(n)[0]?.toUpperCase():void 0;return{...r.subject===void 0||r.subject.trim()===""?{}:{subject:r.subject},...n?{sender:n}:{},...o===void 0?{}:{initial:o},rows:i}},Lt=(e,t)=>{const r=[];for(const i of t.activities){r.push({value:Y({type:"activity",id:i.id}),label:i.name,group:e.activityGroup});for(const n of i.stories){r.push({value:Y({type:"story",id:C(i.id,n.id)}),label:`${i.name} \u203A ${n.name}`,group:e.storyGroup});for(const o of n.steps)r.push({value:Y({type:"step",id:ve(i,n,o)}),label:`${n.name} \u203A ${o.name}`,group:e.stepGroup})}}for(const{app:i,screen:n}of W(t))r.push({value:Y({type:"screen",id:n.id}),label:`${i.name} \u203A ${n.title}`,group:e.screenGroup});return r},Hi=(e,t,r)=>{const i=Z(t,r);if(i?.kind==="screen"){const{screen:n}=i;return{value:Y({type:"screen",id:n.id}),label:n.title,group:e.screenGroup}}return i?.kind!=="step"?null:{value:Y({type:"step",id:ie(i)}),label:i.step.name,group:e.stepGroup}},Z=(e,t)=>{if(se(t)==="app"){const o=N(e,t.screen);return o?{kind:"screen",...o}:void 0}const r=$(e,t.step);if(r)return{kind:"step",...r};const i=z(e,t.activity),n=i?.stories.find(o=>o.id===t.story||C(i.id,o.id)===t.story);return i&&n?{kind:"story",activity:i,story:n}:void 0},Nt=(e,t)=>{const r=(d,c)=>c===void 0?{title:d}:{actor:c,title:d};if(t.kind==="screen")return r(t.screen.title,t.app.actor);const{activity:i,story:n,step:o}=t,s=he(e,o),a=s.length===1?s[0]:void 0;return r(a?.screen.title??o.name,o.actor??n.actor??i.actor??a?.app.actor)},Bi=(e,t)=>{const r=t.actor??e.actor;return r===void 0?{title:t.name}:{actor:r,title:t.name}},Ye=e=>e.title??"UX Prototype",zt=(e,t)=>(t?e.preview=t:delete e.preview,e),Gi=(e,t,r)=>{if(!t)return;const i=Ct(e,t,r).flatMap(n=>n.kind==="screen"&&!n.pinned?[n.preview.id]:[]);return i.length===0?void 0:i.join(Ve)},Vt=(e,t)=>{const r=()=>{if(t.step===void 0&&t.story===void 0)return;const o=Ut(e,{...t,[V]:""}),s=$(e,o.step);return s&&he(e,s.step)[0]},i=N(e,t.screen)??r()??W(e)[0],n={...t,[V]:"app"};for(const o of["activity","story","step"])delete n[o];return i?n.screen=i.screen.id:delete n.screen,zt(n,i&&Rt(e,i.screen.previews,_t(t))?.id)},qi=(e,t,r)=>{const i=s=>Ti(s.step,t);if(r&&i(r))return r;const n=r?.story.steps??[],o=s=>{const a=n[s];return r&&a?{...r,step:a,stepIndex:s}:void 0};for(let s=(r?.stepIndex??0)+1;s<n.length;s+=1){const a=o(s);if(a&&i(a))return a}for(let s=(r?.stepIndex??0)-1;s>=0;s-=1){const a=o(s);if(a&&i(a))return a}return H(e).find(i)},Ut=(e,t)=>{const r=z(e,t.activity),i=t.story,n=r?.stories.find(U=>U.id===i||C(r.id,U.id)===i),o=n&&r?{activity:r,story:n}:E(e,i),s=t.step,d=(o&&s?$(e,`${C(o.activity.id,o.story.id)}.${s}`):void 0)??$(e,s),c=t.screen,f=c===void 0?void 0:qi(e,c,d);if(c!==void 0&&!f&&N(e,c))return Vt(e,{...t,[V]:"app"});const h=f??d,v=h?.activity??o?.activity??r??e.activities[0],I=h?.story??(o&&o.activity===v?o.story:void 0)??v?.stories[0],_=h?.step??I?.steps[0],S={...t};return delete S.screen,v?S.activity=v.id:delete S.activity,I&&v?S.story=E(e,I.id)?I.id:C(v.id,I.id):delete S.story,_&&I&&v?S.step=$(e,_.id)?_.id:ve(v,I,_):delete S.step,delete S[V],zt(S,Gi(e,_,t))},ji=["activity","story","step","screen"],ye=(e,t)=>se(t)==="app"?Vt(e,t):Ut(e,t),Fi=(e,t)=>{const r=t.screen.previews.find(o=>o.kind==="browser");if(!r)return;let i;try{i=new URL(me(e,r),"https://page.example.com")}catch{return}const n=i.pathname.split("/").filter(o=>o!=="").map(o=>{try{return decodeURIComponent(o)}catch{return o}});return{origin:i.origin,segments:n}},Yt=()=>({screens:[],children:new Map}),We=(e,t,r)=>{const[i,...n]=e.children.entries();if(e.screens.length===0&&i&&n.length===0&&r!=="/"){const[o,s]=i;return We(s,`${t}/${o}`,`${r}/${o}`)}return{segment:t,path:r,screens:e.screens,children:[...e.children.entries()].map(([o,s])=>We(s,`/${o}`,`${r==="/"?"":r}/${o}`))}},Ki=e=>{const t=new Map;for(const[r,i]of e){const n=t.get(i.origin)??Yt();t.set(i.origin,n);let o=n;for(const s of i.segments){const a=o.children.get(s)??Yt();o.children.set(s,a),o=a}o.screens.push(r)}return[...t.entries()].map(([r,i])=>({origin:r,root:We(i,"/","/")}))},Xi=(e,t)=>{const r=t.screens.map(o=>({app:t,screen:o})),i=[],n=[];for(const o of r){const s=Fi(e,o);s?i.push([o,s]):n.push(o)}return{app:t,screens:r,trees:Ki(i),others:n}},Wt=e=>e.apps.map(t=>Xi(e,t)).filter(t=>t.screens.length>0),Ht=(e,t)=>t?.kind!=="screen"?e[0]:e.find(r=>r.app.id===t.app.id)??e[0],Zi=(e,t)=>{switch(t.type){case"activity":return z(e,t.id)!==void 0;case"story":return E(e,t.id)!==void 0;case"step":return $(e,t.id)!==void 0;case"screen":return N(e,t.id)!==void 0;case"preview":return T(e,t.id)!==void 0;case"page":return!0;case re:{const r=Oe(t.id);return r!==void 0&&T(e,r.previewId)!==void 0}default:return!1}},Bt=e=>{const t=fe(e);return{name:"prototype",label:"UX Prototype",parseBase:gt,emptyBase:ft,actions:b,apply:mt,hasTarget:Zi,canonicalTarget:(r,i)=>{if(i.type==="step"){const n=$(r,i.id);return n?{...i,id:ie(n)}:i}if(i.type==="story"){const n=E(r,i.id);return n?{...i,id:C(n.activity.id,n.story.id)}:i}if(i.type==="preview"){const n=T(r,i.id);return n?{...i,id:n.preview.id}:i}return i},describe:(r,i,n)=>$t(t,r,i,n),serialize:Et,resolveNavigation:ye,navigationHierarchy:ji,navigationFor:(r,i)=>Mi(i),commentTargets:(r,i)=>Lt(t,r),currentTarget:(r,i)=>Hi(t,r,i),title:Ye}},Ji=(e,t)=>{const r=t.flatMap(i=>{const n=Math.max(i.left,e.left)-e.left,o=Math.max(i.top,e.top)-e.top,s=Math.min(i.right,e.right)-e.left-n,a=Math.min(i.bottom,e.bottom)-e.top-o;return s>0&&a>0?[`M${n} ${o}h${s}v${a}h-${s}Z`]:[]});return r.length===0?"none":`path(evenodd, 'M0 0H${e.width}V${e.height}H0Z ${r.join(" ")}')`},ke="data-dpk-modal",Qi=e=>{try{return e.matches(":modal")}catch{return!1}},Gt=e=>{e.setAttribute(ke,""),e.open||e.show()},qt=e=>{Object.hasOwn(e,"showModal")||Object.defineProperty(e,"showModal",{configurable:!0,value:()=>Gt(e)})},jt=(e,t)=>{if(!Qi(t))return;const r=i=>{i.target===t&&(i.stopImmediatePropagation(),e.removeEventListener("close",r,!0))};e.addEventListener("close",r,!0),t.close(),Gt(t)},Ft=(e,t)=>{try{return Array.from(e.querySelectorAll(t))}catch{return[]}},en=(e,t)=>{const r=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value");r?.set?r.set.call(e,t):e.value=t},tn=e=>e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"),rn=(e,t)=>{if(tn(e)){const i=typeof t=="boolean"?t:e.value===t;return typeof t=="string"&&!i?!1:(e.checked=i,!0)}const r=String(t);return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?(en(e,r),!0):(e.textContent=r,!1)},nn=(e,t)=>{const r=[];for(const[i,n]of Object.entries(t)){const o=Ft(e,i);o.length===0&&r.push(i);for(const s of o)rn(s,n)&&(s.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),s.dispatchEvent(new Event("change",{bubbles:!0})))}return r},on=(e,t)=>{const r=[];for(const i of t){const[n]=Ft(e,i);n instanceof HTMLElement?n.click():r.push(i)}return r},sn='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',Kt=/^-?[A-Za-z_][\w-]*$/,Xt=40,an=(e,t)=>{const r=e.closest(sn);return r!==null&&r!==t&&t.contains(r)?r:e},xe=e=>{const t=e.replace(/\s+/g," ").trim();if(t==="")return;const r=Array.from(t);return r.length>Xt?`${r.slice(0,Xt).join("")}\u2026`:t},dn=e=>{const t=e.getAttribute("aria-label")??e.getAttribute("title");if(t)return xe(t);const r=e.tagName.toLowerCase();return xe(r==="input"||r==="textarea"||r==="select"?e.getAttribute("placeholder")??e.getAttribute("name")??"":r==="img"?e.getAttribute("alt")??"":e.textContent??"")},pn=e=>{const t=e.getAttribute("id");if(t&&Kt.test(t))return`#${t}`;const r=e.tagName.toLowerCase(),i=Array.from(e.classList).filter(a=>Kt.test(a)).slice(0,2).map(a=>`.${a}`).join(""),n=e.parentElement,o=n?Array.from(n.children).filter(a=>a.tagName===e.tagName):[],s=o.length>1?`:nth-of-type(${o.indexOf(e)+1})`:"";return`${r}${i}${s}`},cn=(e,t,r)=>{try{const i=e.querySelectorAll(t);return i.length===1&&i[0]===r}catch{return!1}},ln=(e,t)=>{const r=[];let i=e;for(;i!==null&&i!==t;){const o=pn(i);if(r.unshift(o),o.startsWith("#")||cn(t,r.join(" > "),e))break;i=i.parentElement}const n=dn(e);return{selector:r.length===0?":scope":r.join(" > "),tag:e.tagName.toLowerCase(),...n===void 0?{}:{text:n}}},un=(e,t)=>{if(t===":scope")return e;try{return e.querySelector(t)}catch{return null}},hn=["screen","preview"],de=e=>JSON.stringify(hn.map(t=>e[t]??null)),Zt=(e,t)=>e?.kind==="page"&&de(e.page)===t,$e=e=>`tab-${e}`,vn=e=>({tabs:[{id:$e(1),history:[{kind:"page",page:e}],index:0}],activeId:$e(1),seen:de(e),nextId:2}),gn={id:"",history:[],index:0},J=e=>e.tabs.find(t=>t.id===e.activeId)??e.tabs[0]??gn,pe=e=>{const t=J(e);return t.history[t.index]},fn=e=>J(e).index>0,bn=e=>{const t=J(e);return t.index<t.history.length-1},Jt=(e,t)=>({...e,tabs:e.tabs.map(r=>r.id===e.activeId?t(r):r)}),He=(e,t)=>Jt(e,r=>({...r,history:[...r.history.slice(0,r.index+1),t],index:r.index+1})),Ee=e=>{const t=pe(e);return t?.kind==="page"?{...e,seen:de(t.page)}:e},Qt=(e,t)=>{const r=J(e),i=r.index+t;return i<0||i>=r.history.length?e:Ee(Jt(e,n=>({...n,index:i})))},er=(e,t,r)=>{const i=$e(e.nextId),n=e.tabs.findIndex(o=>o.id===e.activeId)+1;return Ee({...e,tabs:[...e.tabs.slice(0,n),{id:i,history:[t],index:0},...e.tabs.slice(n)],activeId:r?e.activeId:i,nextId:e.nextId+1})},wn=(e,t)=>{const r=e.tabs.findIndex(o=>o.id===t);if(r<0)return e;if(e.tabs.length===1){const o=$e(e.nextId);return{...e,tabs:[{id:o,history:[{kind:"new-tab"}],index:0}],activeId:o,nextId:e.nextId+1}}const i=e.tabs.filter(o=>o.id!==t);if(t!==e.activeId)return{...e,tabs:i};const n=i[r]??i[r-1];return Ee({...e,tabs:i,activeId:n?.id??e.activeId})},mn=(e,t)=>{const r=t===null?null:de(t);if(r===e.seen)return e;const i={...e,seen:r};return t===null||r===null||Zt(pe(e),r)?i:He(i,{kind:"page",page:t})},yn=(e,t)=>{const r=de(t);return Zt(pe(e),r)?e.seen===r?e:{...e,seen:r}:He({...e,seen:r},{kind:"page",page:t})},tr=(e,t)=>{switch(t.kind){case"observe":return mn(e,t.page);case"visit":return yn(e,t.page);case"back":return Qt(e,-1);case"forward":return Qt(e,1);case"open-tab":return er(e,t.entry,t.background);case"new-tab":return er(e,{kind:"new-tab"},!1);case"unreachable":return He(e,{kind:"unreachable",url:t.url});case"activate":return e.tabs.some(r=>r.id===t.id)&&t.id!==e.activeId?Ee({...e,activeId:t.id}):e;case"close-tab":return wn(e,t.id);default:return e}},rr=(e,t)=>{const r=ye(e,t),i=Z(e,r);if(i?.kind!=="screen")return null;const[n]=Ue(e,i,r).shown;return n?.kind!=="browser"?null:{screen:i.screen.id,preview:n.id}},Se=(e,t)=>{const r=Z(e,ye(e,{[V]:"app",...t}));return r?.kind==="screen"?r:void 0},ir=(e,t)=>{const r=e.trim();if(r==="")return null;try{return r.startsWith("/")?new URL(r,t):new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(r)?r:`https://${r}`)}catch{return null}},nr=e=>`${e.origin}${e.pathname.replace(/\/+$/,"")}`,kn=(e,t,r)=>{const i=ir(t,r);if(i===null)return null;const n=nr(i);for(const{screen:o}of W(e))for(const s of o.previews){if(s.kind!=="browser")continue;const a=ir(me(e,s),r);if(a!==null&&nr(a)===n)return{screen:o.id,preview:s.id}}return null},or=e=>{try{return new URL(e).host||e}catch{return e}},xn=(e,t,r)=>t===void 0||t.kind==="new-tab"?r.newTab:t.kind==="unreachable"?or(t.url):Se(e,t.page)?.screen.title??r.newTab,sr=(e,t)=>{if(t===void 0||t.kind==="new-tab")return"";if(t.kind==="unreachable")return t.url;const r=Se(e,t.page)?.screen.previews.find(i=>i.id===t.page.preview);return r===void 0?"":me(e,r)},ar=e=>{const t=J(e);for(let r=t.index;r>=0;r-=1){const i=t.history[r];if(i?.kind==="page")return i.page}for(const r of e.tabs){const i=r.history[r.index];if(i?.kind==="page")return i.page}},$n=(e,t)=>t===void 0?void 0:Se(e,t)?.app.actor,dr=(e,t,r,i=null)=>{const n=J(t),o=n.history[n.index],s=$n(e,ar(t)??i??void 0);return{tabs:t.tabs.map(a=>({id:a.id,title:xn(e,a.history[a.index],r),url:sr(e,a.history[a.index]),active:a.id===n.id})),entry:o,url:sr(e,o),canBack:fn(t),canForward:bn(t),...s===void 0?{}:{profile:s}}},En=e=>ar(e)??null,Sn=(e,t)=>{const r=t===null?void 0:Se(e,t),i=Ht(Wt(e),r),n=[],o=(s,a)=>{for(const{screen:d}of a.screens){const c=d.previews.find(f=>f.kind==="browser");c!==void 0&&n.push({title:d.title,url:`${s}${a.path==="/"?"":a.path}`,page:{screen:d.id,preview:c.id}})}for(const d of a.children)o(s,d)};for(const s of i?.trees??[])o(or(s.origin),s.root);return n},A=(e,t,r,i)=>({id:t,deviceClass:e,width:r,height:i}),pr=[A("phone","iphone-se",375,667),A("phone","iphone-16",393,852),A("phone","iphone-16-pro-max",440,956),A("phone","pixel-7",412,915),A("phone","galaxy-s24",360,780),A("tablet","ipad-mini",744,1133),A("tablet","ipad-air-11",820,1180),A("tablet","ipad-pro-11",834,1194),A("tablet","ipad-pro-13",1024,1366),A("desktop","laptop-13",1280,800),A("desktop","laptop-15",1440,900),A("desktop","full-hd",1920,1080),A("desktop","monitor-27",2560,1440),A("desktop","ultrawide",3440,1440)],Tn={phone:A("phone","iphone-16",393,852),tablet:A("tablet","ipad-pro-11",834,1194),desktop:A("desktop","laptop-13",1280,800)},cr=e=>e==="mobile"?"phone":e==="tablet"?"tablet":"desktop",An=e=>e!=="plain",lr=e=>pr.filter(t=>t.deviceClass===e),In=(e,t)=>{const r=cr(e),i=t[r];return lr(r).find(n=>n.id===i)??Tn[r]},Pn=(e,t)=>{const r=pr.find(i=>i.id===t);return r===void 0||e[r.deviceClass]===t?e:{...e,[r.deviceClass]:t}},_n=(e,t)=>`${e.deviceName(t.id)} \xB7 ${t.width}\xD7${t.height}`,Rn=(e,t)=>{const r=[1,t.width/e.width];t.height!==void 0&&r.push(t.height/e.height);const i=Math.min(...r);return!Number.isFinite(i)||i<=0?1:Math.max(.1,Math.floor(i*100)/100)},ur=(e,t)=>{const{state:r,navigation:i}=e,n=Z(r,i),o=se(i);return p`
|
|
1
|
+
import{aj as m,aO as Or,ae as O,aA as P,aB as g,ah as u,af as M,ai as le,ad as Cr,aP as Qe,aQ as Mr,ag as L,ak as x,aR as Lr,as as et,ap as Nr,p as w,au as y,v as ue,az as te,P as zr,e as Vr,a0 as Ur,h as tt,N as Ae,V as Y,U as Yr,R as k,a4 as p,a3 as l,aS as Ie,aT as Pe,aF as _e,a5 as Wr,z as Re,aE as rt,l as Hr,aU as D,aV as Br,A as it,aW as Gr,aX as qr,J as nt,aY as jr,ac as Fr,ab as Kr,a2 as Xr,T as ot,a1 as Zr,aZ as Jr,a9 as Qr,C as ei,a_ as ti}from"./shared-DXaIVZ_z.js";import{p as ri,r as ii,c as ni}from"./shared-BtN-8ibq.js";import{L as oi,D as si}from"./shared-CtHWU02m.js";import{i as st}from"./shared-CWKqlSx3.js";const ai=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]],di=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]],pi=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]],ci=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]],li=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]],ui=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18"}]],hi=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]],vi=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"}],["path",{d:"m14 7 3 3"}],["path",{d:"M5 6v4"}],["path",{d:"M19 14v4"}],["path",{d:"M10 2v2"}],["path",{d:"M7 8H3"}],["path",{d:"M21 16h-4"}],["path",{d:"M11 3H9"}]],at=["browser","native","mail","plain"],dt=["mobile","tablet","desktop","fluid"],K=e=>"screen"in e,gi=O({from:g(u()),to:g(u()),cc:g(u()),subject:g(u()),date:g(u())}),fi={id:P,kind:M(le(at),"browser"),viewport:M(le(dt),"fluid"),label:g(u()),url:g(u()),mail:g(gi)},De=m(O(fi),Or(e=>e.mail===void 0||e.kind==="mail",'a preview `mail` envelope needs `"kind": "mail"`')),pt=et([O({screen:P,preview:g(P)}),O({material:De})]),bi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),situation:g(m(u(),x(1))),panes:M(L(pt),[])}),wi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),steps:M(L(bi),[])}),mi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),stories:M(L(wi),[])}),ct=m(u(),x(1)),yi=O({id:P,label:m(u(),x(1)),description:g(u()),fill:g(Lr(ct,et([u(),Nr()]))),click:g(L(ct))}),ki=O({id:P,title:m(u(),x(1)),description:g(u()),previews:M(L(De),[]),actions:M(L(yi),[])}),xi=O({id:P,name:m(u(),x(1)),description:g(u()),actor:g(m(u(),x(1))),screens:M(L(ki),[])}),lt=O({title:g(u()),baseUrl:g(u()),apps:M(L(xi),[]),activities:M(L(mi),[])}),ut=e=>e.flatMap(t=>K(t)?[]:[t.material]),$i=e=>{const t=new Set,r=s=>{for(const a of s){if(t.has(a.id))return`duplicate preview id "${a.id}": preview ids are global, they name a light DOM slot`;t.add(a.id)}return null},i=new Set,n=new Set;for(const s of e.apps){if(i.has(s.id))return`duplicate app id "${s.id}"`;i.add(s.id);for(const a of s.screens){if(n.has(a.id))return`duplicate screen id "${a.id}": screen ids are global`;n.add(a.id);const d=r(a.previews);if(d!==null)return d;const c=new Set;for(const f of a.actions){if(c.has(f.id))return`duplicate action id "${f.id}" on screen "${a.id}"`;c.add(f.id)}}}const o=new Set;for(const s of e.activities){if(o.has(s.id))return`duplicate activity id "${s.id}"`;o.add(s.id);const a=new Set;for(const d of s.stories){if(a.has(d.id))return`duplicate story id "${d.id}" in activity "${s.id}"`;a.add(d.id);const c=new Set;for(const f of d.steps){if(c.has(f.id))return`duplicate step id "${f.id}" in story "${d.id}"`;c.add(f.id);const h=r(ut(f.panes));if(h!==null)return h}}}return null},ht=(e,t)=>{const r=new Map;for(const i of t.panes){if(!K(i))continue;const n=e(i.screen);if(n===void 0)return`unknown screen "${i.screen}" on step "${t.id}": declare it under \`apps[].screens\``;if(i.preview!==void 0&&!n.includes(i.preview))return`preview "${i.preview}" on step "${t.id}" is not a rendition of screen "${i.screen}"`;const o=r.get(i.screen)??[];if(o.length>0&&(i.preview===void 0||o.includes(i.preview)||o.includes(void 0)))return`screen "${i.screen}" is shown twice on step "${t.id}": give each pane a different \`preview\``;r.set(i.screen,[...o,i.preview])}return null},Ei=e=>{const t=new Map(e.apps.flatMap(r=>r.screens.map(i=>[i.id,i.previews.map(n=>n.id)])));for(const r of e.activities.flatMap(i=>i.stories.flatMap(n=>n.steps))){const i=ht(n=>t.get(n),r);if(i!==null)return i}return null},Si=(e,t)=>ht(r=>N(e,r)?.screen.previews.map(i=>i.id),t),re="ui",vt=e=>{const t=e.text?.replaceAll('"',"'");return`${e.previewId}/${e.selector}${t===void 0?"":` "${t}"`}`},Oe=e=>{const t=e.indexOf("/");if(t<=0)return;const r=e.slice(0,t);if(!Mr(P,r))return;const i=e.slice(t+1),n=/ "([^"]*)"$/.exec(i),o=(n?i.slice(0,n.index):i).trim();if(o!=="")return n?.[1]===void 0?{previewId:r,selector:o}:{previewId:r,selector:o,text:n[1]}},gt=e=>{const t=Cr(lt,e),r=$i(t)??Ei(t);if(r!==null)throw new Error(r);return t},ft=()=>({apps:[],activities:[]}),W=e=>e.apps.flatMap(t=>t.screens.map(r=>({app:t,screen:r}))),N=(e,t)=>{if(t!==void 0)return W(e).find(r=>r.screen.id===t)},he=(e,t)=>t.panes.flatMap(r=>{const i=K(r)?N(e,r.screen):void 0;return i?[i]:[]}),X=e=>ut(e.panes),Ti=(e,t)=>e.panes.some(r=>K(r)&&r.screen===t),z=(e,t)=>{if(t!==void 0)return e.activities.find(r=>r.id===t)},C=(e,t)=>`${e}.${t}`,E=(e,t)=>{if(t===void 0)return;const r=Qe(t,2);if(r){const[n,o]=r;if(n===void 0||o===void 0)return;const s=e.activities.find(d=>d.id===n),a=s?.stories.find(d=>d.id===o);return s&&a?{activity:s,story:a}:void 0}if(t.includes("."))return;const i=e.activities.flatMap(n=>n.stories.filter(o=>o.id===t).map(o=>({activity:n,story:o})));return i.length===1?i[0]:void 0},bt=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},ie=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,ve=(e,t,r)=>`${e.id}.${t.id}.${r.id}`,$=(e,t)=>{if(t===void 0)return;const r=Qe(t,3);if(r){const[n,o,s]=r;if(n===void 0||o===void 0||s===void 0)return;const a=e.activities.find(h=>h.id===n),d=a?.stories.find(h=>h.id===o),c=d?d.steps.findIndex(h=>h.id===s):-1,f=d&&c>=0?d.steps[c]:void 0;return a&&d&&f?{activity:a,story:d,step:f,stepIndex:c}:void 0}if(t.includes("."))return;const i=H(e).filter(n=>n.step.id===t);return i.length===1?i[0]:void 0},T=(e,t)=>{if(t!==void 0){for(const r of W(e)){const i=r.screen.previews.find(n=>n.id===t);if(i)return{owner:{kind:"screen",...r},preview:i}}for(const r of H(e)){const i=X(r.step).find(n=>n.id===t);if(i)return{owner:{kind:"step",...r},preview:i}}}},H=e=>e.activities.flatMap(t=>t.stories.flatMap(r=>r.steps.map((i,n)=>({activity:t,story:r,step:i,stepIndex:n})))),wt=e=>H(e).map(t=>t.step.id),b={SET_ACTIVITY_NAME:w("SET_ACTIVITY_NAME","activity",y({name:m(u(),x(1))})),SET_ACTIVITY_DESCRIPTION:w("SET_ACTIVITY_DESCRIPTION","activity",y({description:u()})),SET_STORY_NAME:w("SET_STORY_NAME","story",y({name:m(u(),x(1))})),SET_STORY_DESCRIPTION:w("SET_STORY_DESCRIPTION","story",y({description:u()})),SET_STEP_NAME:w("SET_STEP_NAME","step",y({name:m(u(),x(1))})),SET_STEP_DESCRIPTION:w("SET_STEP_DESCRIPTION","step",y({description:u()})),SET_PREVIEW_KIND:w("SET_PREVIEW_KIND","preview",y({kind:le(at)})),SET_PREVIEW_VIEWPORT:w("SET_PREVIEW_VIEWPORT","preview",y({viewport:le(dt)})),SET_PREVIEW_LABEL:w("SET_PREVIEW_LABEL","preview",y({label:u()})),REORDER_ACTIVITY:w("REORDER_ACTIVITY","activity",y({after:te(u())}),{mode:"sequence"}),REORDER_STORY:w("REORDER_STORY","story",y({after:te(u())}),{mode:"sequence"}),REORDER_STEP:w("REORDER_STEP","step",y({after:te(u())}),{mode:"sequence"}),MOVE_STORY:w("MOVE_STORY","story",y({toActivity:m(u(),x(1)),after:te(u())}),{mode:"sequence"}),MOVE_STEP:w("MOVE_STEP","step",y({toStory:m(u(),x(1)),after:te(u())}),{mode:"sequence"}),ADD_ACTIVITY:w("ADD_ACTIVITY","page",y({id:P,name:m(u(),x(1)),description:g(u())}),{dedupeKey:ue}),ADD_STORY:w("ADD_STORY","activity",y({id:P,name:m(u(),x(1)),description:g(u())}),{dedupeKey:ue}),ADD_STEP:w("ADD_STEP","story",y({id:P,name:m(u(),x(1)),description:g(u()),panes:g(L(pt))}),{dedupeKey:ue}),ADD_PREVIEW:w("ADD_PREVIEW","step",De,{dedupeKey:ue}),DELETE_ACTIVITY:w("DELETE_ACTIVITY","activity",y({})),DELETE_STORY:w("DELETE_STORY","story",y({})),DELETE_STEP:w("DELETE_STEP","step",y({})),DELETE_PREVIEW:w("DELETE_PREVIEW","preview",y({}))},ne={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setActivityDescription:(e,t)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:e},payload:{description:t}}),setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}}),setStepDescription:(e,t)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:e},payload:{description:t}}),setPreviewViewport:(e,t)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:e},payload:{viewport:t}}),setPreviewKind:(e,t)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:e},payload:{kind:t}}),setPreviewLabel:(e,t)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:e},payload:{label:t}}),reorderActivity:(e,t)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:e},payload:{after:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),reorderStep:(e,t)=>({type:"REORDER_STEP",target:{type:"step",id:e},payload:{after:t}}),moveStep:(e,t,r)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:r}}),moveStory:(e,t,r)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:r}}),addActivity:(e,t,r)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...r===void 0?{}:{description:r}}}),addStory:(e,t,r,i)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:r,...i===void 0?{}:{description:i}}}),addStep:(e,t,r,i)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:r,...i===void 0?{}:{panes:i}}}),addPreview:(e,t)=>({type:"ADD_PREVIEW",target:{type:"step",id:e},payload:{...t}}),deleteActivity:e=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:e},payload:{}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),deleteStep:e=>({type:"DELETE_STEP",target:{type:"step",id:e},payload:{}}),deletePreview:e=>({type:"DELETE_PREVIEW",target:{type:"preview",id:e},payload:{}})},mt=(e,t)=>{const r=zr(b,t);if(r===null)return null;const i=r.target.id;switch(r.type){case"SET_ACTIVITY_NAME":return B(e,i,n=>({...n,name:r.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return B(e,i,n=>({...n,description:r.payload.description}));case"SET_STORY_NAME":return G(e,i,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return G(e,i,n=>({...n,description:r.payload.description}));case"SET_STEP_NAME":return ge(e,i,n=>({...n,name:r.payload.name}));case"SET_STEP_DESCRIPTION":return ge(e,i,n=>({...n,description:r.payload.description}));case"SET_PREVIEW_KIND":return Me(e,i,n=>({...n,kind:r.payload.kind}));case"SET_PREVIEW_VIEWPORT":return Me(e,i,n=>({...n,viewport:r.payload.viewport}));case"SET_PREVIEW_LABEL":return Me(e,i,n=>({...n,label:r.payload.label}));case"REORDER_ACTIVITY":{const{after:n}=r.payload,o=oe(e.activities,i,n);return o===null?null:{...e,activities:o}}case"REORDER_STORY":{const{after:n}=r.payload,o=E(e,i);if(!o)return null;const s=n===null?null:E(e,n);if(n!==null&&(!s||s.activity!==o.activity))return null;const a=oe(o.activity.stories,o.story.id,s?.story.id??null);return a===null?null:B(e,o.activity.id,d=>({...d,stories:a}))}case"REORDER_STEP":{const{after:n}=r.payload,o=$(e,i);if(!o)return null;const s=n===null?null:$(e,n);if(n!==null&&(!s||s.story!==o.story))return null;const a=oe(o.story.steps,o.step.id,s?.step.id??null);return a===null?null:G(e,C(o.activity.id,o.story.id),d=>({...d,steps:a}))}case"MOVE_STORY":{const{toActivity:n,after:o}=r.payload,s=E(e,i);if(!s)return null;const a=e.activities.find(h=>h.id===n);if(!a)return null;const d=o===null?null:E(e,o);if(o!==null&&(!d||d.activity!==a))return null;const c=d?.story.id??null;if(s.activity.id===n){const h=oe(s.activity.stories,s.story.id,c);return h===null?null:B(e,n,v=>({...v,stories:h}))}if(a.stories.some(h=>h.id===s.story.id))return null;const f=Le(a.stories,s.story,c);return Ce(e,h=>h.id===s.activity.id?{...h,stories:h.stories.filter(v=>v.id!==bt(i))}:h.id===n?{...h,stories:f}:h)}case"MOVE_STEP":{const{toStory:n,after:o}=r.payload,s=$(e,i);if(!s)return null;const a=E(e,n);if(!a)return null;const d=o===null?null:$(e,o);if(o!==null&&(!d||d.story!==a.story))return null;const c=d?.step.id??null;if(s.story===a.story){const h=oe(s.story.steps,s.step.id,c);return h===null?null:G(e,n,v=>({...v,steps:h}))}if(a.story.steps.some(h=>h.id===s.step.id))return null;const f=Le(a.story.steps,s.step,c);return Ce(e,h=>({...h,stories:h.stories.map(v=>v===s.story?{...v,steps:v.steps.filter(I=>I.id!==bt(i))}:v===a.story?{...v,steps:f}:v)}))}case"ADD_ACTIVITY":{const n=r.payload;if(e.activities.some(s=>s.id===n.id))return e;const o={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},stories:[]};return{...e,activities:[...e.activities,o]}}case"ADD_STORY":{const n=r.payload,o=e.activities.find(a=>a.id===i);if(!o)return null;if(o.stories.some(a=>a.id===n.id))return e;const s={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},steps:[]};return B(e,i,a=>({...a,stories:[...a.stories,s]}))}case"ADD_STEP":{const n=r.payload,o=E(e,i)?.story;if(!o)return null;if(o.steps.some(d=>d.id===n.id))return e;const s=n.panes??[],a={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},panes:s};return Ai(e,a)?G(e,i,d=>({...d,steps:[...d.steps,a]})):null}case"ADD_PREVIEW":{const n=r.payload,o=$(e,i)?.step;return o?X(o).some(s=>s.id===n.id)?e:T(e,n.id)?null:ge(e,i,s=>({...s,panes:[...s.panes,{material:n}]})):null}case"DELETE_ACTIVITY":{const n=i;return e.activities.some(o=>o.id===n)?{...e,activities:e.activities.filter(o=>o.id!==n)}:null}case"DELETE_STORY":{const n=E(e,i);return n?B(e,n.activity.id,o=>({...o,stories:o.stories.filter(s=>s.id!==n.story.id)})):null}case"DELETE_STEP":{const n=$(e,i);return n?G(e,C(n.activity.id,n.story.id),o=>({...o,steps:o.steps.filter(s=>s.id!==n.step.id)})):null}case"DELETE_PREVIEW":{const n=T(e,i);return n?yt(e,n.owner,o=>o.filter(s=>s.id!==n.preview.id)):null}default:return Vr(r)}},Ce=(e,t)=>({...e,activities:e.activities.map(t)}),B=(e,t,r)=>{const i=t;return e.activities.some(n=>n.id===i)?Ce(e,n=>n.id===i?r(n):n):null},G=(e,t,r)=>{const i=E(e,t);if(!i)return null;const n=i.story.id;return B(e,i.activity.id,o=>({...o,stories:o.stories.map(s=>s.id===n?r(s):s)}))},ge=(e,t,r)=>{const i=$(e,t);if(!i)return null;const n=i.step.id;return G(e,C(i.activity.id,i.story.id),o=>({...o,steps:o.steps.map(s=>s.id===n?r(s):s)}))},Me=(e,t,r)=>{const i=T(e,t);if(!i)return null;const n=i.preview.id;return yt(e,i.owner,o=>o.map(s=>s.id===n?r(s):s))},Ai=(e,t)=>{const r=X(t).map(i=>i.id);return Si(e,t)===null&&new Set(r).size===r.length&&!r.some(i=>T(e,i))},yt=(e,t,r)=>{if(t.kind==="step")return ge(e,ie(t),n=>{const o=new Map(r([...X(n)]).map(s=>[s.id,s]));return{...n,panes:n.panes.flatMap(s=>{if(K(s))return[s];const a=o.get(s.material.id);return a?[{material:a}]:[]})}});const i=t.screen.id;return{...e,apps:e.apps.map(n=>n.id===t.app.id?{...n,screens:n.screens.map(o=>o.id===i?{...o,previews:r(o.previews)}:o)}:n)}},oe=(e,t,r)=>{const i=e.findIndex(s=>s.id===t);if(i<0||r!==null&&!e.some(s=>s.id===r))return null;if(t===r)return[...e];const n=e[i];if(n===void 0)return null;const o=e.filter(s=>s.id!==t);return Le(o,n,r)},Le=(e,t,r)=>{const i=[...e],n=r===null?-1:i.findIndex(o=>o.id===r);return i.splice(n+1,0,t),i},kt={"iphone-se":"iPhone SE","iphone-16":"iPhone 16","iphone-16-pro-max":"iPhone 16 Pro Max","pixel-7":"Pixel 7","galaxy-s24":"Galaxy S24","ipad-mini":"iPad mini","ipad-air-11":'iPad Air 11"',"ipad-pro-11":'iPad Pro 11"',"ipad-pro-13":'iPad Pro 13"'},Ii={"laptop-13":'13" laptop',"laptop-15":'15" laptop',"full-hd":"Full HD","monitor-27":'27" monitor',ultrawide:"Ultrawide"},Pi={"laptop-13":"13 \u30A4\u30F3\u30C1 \u30CE\u30FC\u30C8","laptop-15":"15 \u30A4\u30F3\u30C1 \u30CE\u30FC\u30C8","full-hd":"\u30D5\u30EB HD","monitor-27":"27 \u30A4\u30F3\u30C1 \u30E2\u30CB\u30BF\u30FC",ultrawide:"\u30A6\u30EB\u30C8\u30E9\u30EF\u30A4\u30C9"},fe=Ur({en:{renameActivity:"Rename Activity",updateActivityDescription:"Update Activity description",renameStory:"Rename UserStory",updateStoryDescription:"Update UserStory description",renameStep:"Rename Step",updateStepDescription:"Update Step description",changePreviewKind:"Change Preview kind",changePreviewViewport:"Change Preview viewport",changePreviewLabel:"Change Preview label",moveStory:"Move UserStory",moveStep:"Move Step",deleteTitle:"Delete",reorderTitle:e=>`Reorder ${e}`,addTitle:e=>`Add ${e}`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after "${e}"`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",screenGroup:"Screen",openInApp:"Open this screen in the app view",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"There are no Activities yet. Add ",noActivityAfter:" to the base JSON, or ask the agent.",deleteStepAria:"Delete step",addStepButton:"+ Step",stepNameLabel:"Step name",descriptionLabel:"Description",descriptionPlaceholder:"What happens in this Step (click to edit)",newStepName:"New step",viewLabel:"View",viewScenario:"Scenario",viewApp:"App",viewScenarioHint:"Follow one user story step by step",viewAppHint:"Use the UI as one app, whatever the scenario",appScreens:"Screens",appScreensHint:"Pick a screen to start from, then move around through the UI itself.",appSelectLabel:"App",appOutsideBrowser:"Outside the browser",noStepBefore:"There are no Steps yet. A Prototype has the meaning structure ",noStepAfter:" \u2014 one Step is one moment of the story: the screen the user is on and what they have at hand. Add a Step to the base JSON, and its screen will appear here.",noScreens:"This product has no screens yet. Declare its apps and their screens under apps[].screens in the base JSON, and they will appear here.",noPreviewMetadata:"No preview metadata \u2014 ask the agent to add it.",storyWithoutSteps:"This UserStory has no Steps yet, so there is no screen to show. Add one with + Step, or ask the agent to prototype it.",pageActor:e=>`Used by ${e}`,maximize:"Maximize",restore:"Restore size",maximizeHint:"Show the preview alone across the tab \xB7 Esc to restore",situation:"Situation",uiComment:"Comment on UI",uiCommentHint:"Click any part of the preview to comment on it \xB7 Esc to finish",uiCommentPin:(e,t)=>`Comment ${e}: ${t}`,mailFrom:"From",mailTo:"To",mailCc:"Cc",mailDate:"Date",demo:"Demo",demoHint:"Use the app in a browser across the tab, with nothing else on screen \xB7 Esc to finish",exitDemo:"Exit demo",browserBack:"Back",browserForward:"Forward",browserReload:"Reload",browserAddress:"Address",browserTabs:"Tabs",newTab:"New tab",closeTab:"Close tab",browserProfile:e=>`Profile: ${e}`,browserGuest:"Guest",newTabShortcuts:"Pages of this app",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page of the prototype has this address.",device:"Device",deviceHint:"The window the app runs in: a page taller than it scrolls inside, as on the device",deviceName:e=>kt[e]??Ii[e]??e,deviceZoom:e=>`Shown at ${e}% to fit`,actions:"Actions",actionsHint:"Make the screen do something in one go, e.g. fill its form with sample data"},ja:{renameActivity:"Activity \u540D\u3092\u5909\u66F4",updateActivityDescription:"Activity \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStory:"UserStory \u540D\u3092\u5909\u66F4",updateStoryDescription:"UserStory \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStep:"Step \u540D\u3092\u5909\u66F4",updateStepDescription:"Step \u306E\u8AAC\u660E\u3092\u66F4\u65B0",changePreviewKind:"Preview \u306E\u7A2E\u5225\u3092\u5909\u66F4",changePreviewViewport:"Preview \u306E\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8\u3092\u5909\u66F4",changePreviewLabel:"Preview \u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",moveStory:"UserStory \u3092\u79FB\u52D5",moveStep:"Step \u3092\u79FB\u52D5",deleteTitle:"\u524A\u9664",reorderTitle:e=>`${e} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:e=>`${e} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 "${e}" \u306E\u76F4\u5F8C\u3078`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",screenGroup:"\u753B\u9762",openInApp:"\u3053\u306E\u753B\u9762\u3092\u30A2\u30D7\u30EA\u30D3\u30E5\u30FC\u3067\u958B\u304F",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"Activity \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E ",noActivityAfter:" \u3092\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",deleteStepAria:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",addStepButton:"+ Step",stepNameLabel:"Step \u540D",descriptionLabel:"\u8AAC\u660E",descriptionPlaceholder:"\u3053\u306E Step \u3067\u4F55\u304C\u8D77\u304D\u308B\u304B\uFF08\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\uFF09",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",viewLabel:"\u8868\u793A",viewScenario:"\u30B7\u30CA\u30EA\u30AA",viewApp:"\u30A2\u30D7\u30EA",viewScenarioHint:"\u30E6\u30FC\u30B6\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC\u306B\u6CBF\u3063\u3066 Step \u3092\u9806\u306B\u305F\u3069\u308B",viewAppHint:"\u30B7\u30CA\u30EA\u30AA\u306B\u95A2\u4FC2\u306A\u304F\u3001UI \u3092 1 \u3064\u306E\u30A2\u30D7\u30EA\u3068\u3057\u3066\u89E6\u308B",appScreens:"\u753B\u9762",appScreensHint:"\u8D77\u70B9\u306B\u3059\u308B\u753B\u9762\u3092\u9078\u3073\u3001\u3042\u3068\u306F UI \u306E\u30EA\u30F3\u30AF\u3067\u79FB\u52D5\u3057\u307E\u3059\u3002",appSelectLabel:"\u30A2\u30D7\u30EA",appOutsideBrowser:"\u30D6\u30E9\u30A6\u30B6\u4EE5\u5916",noStepBefore:"Step \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002Prototype \u306F ",noStepAfter:" \u306E\u610F\u5473\u69CB\u9020\u3092\u6301\u3061\u30011 Step = \u30B7\u30CA\u30EA\u30AA\u306E 1 \u5834\u9762\uFF08\u30E6\u30FC\u30B6\u30FC\u304C\u3044\u308B\u753B\u9762\u3068\u3001\u624B\u5143\u306B\u3042\u308B\u3082\u306E\uFF09\u3067\u3059\u3002base JSON \u306B Step \u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u305D\u306E\u753B\u9762\u304C\u73FE\u308C\u307E\u3059\u3002",noScreens:"\u3053\u306E\u30D7\u30ED\u30C0\u30AF\u30C8\u306B\u306F\u307E\u3060\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E apps[].screens \u306B\u30A2\u30D7\u30EA\u3068\u753B\u9762\u3092\u5BA3\u8A00\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u73FE\u308C\u307E\u3059\u3002",noPreviewMetadata:"preview metadata \u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u8FFD\u52A0\u306F Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044",storyWithoutSteps:"\u3053\u306E UserStory \u306B\u306F\u307E\u3060 Step \u304C\u306A\u304F\u3001\u898B\u305B\u308B\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002+ Step \u3067\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",pageActor:e=>`\u5229\u7528\u8005: ${e}`,maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",maximizeHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3060\u3051\u3092\u30BF\u30D6\u3044\u3063\u3071\u3044\u306B\u8868\u793A \xB7 Esc \u3067\u623B\u308B",situation:"\u72B6\u6CC1",uiComment:"UI \u306B\u30B3\u30E1\u30F3\u30C8",uiCommentHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30B3\u30E1\u30F3\u30C8 \xB7 Esc \u3067\u7D42\u4E86",uiCommentPin:(e,t)=>`\u30B3\u30E1\u30F3\u30C8 ${e}: ${t}`,mailFrom:"\u5DEE\u51FA\u4EBA",mailTo:"\u5B9B\u5148",mailCc:"Cc",mailDate:"\u65E5\u6642",demo:"\u30C7\u30E2",demoHint:"\u307B\u304B\u306B\u4F55\u3082\u51FA\u3055\u305A\u3001\u30BF\u30D6\u3044\u3063\u3071\u3044\u306E\u30D6\u30E9\u30A6\u30B6\u3067\u30A2\u30D7\u30EA\u3092\u89E6\u308B \xB7 Esc \u3067\u7D42\u4E86",exitDemo:"\u30C7\u30E2\u3092\u7D42\u4E86",browserBack:"\u623B\u308B",browserForward:"\u9032\u3080",browserReload:"\u518D\u8AAD\u307F\u8FBC\u307F",browserAddress:"\u30A2\u30C9\u30EC\u30B9",browserTabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",browserProfile:e=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${e}`,browserGuest:"\u30B2\u30B9\u30C8",newTabShortcuts:"\u3053\u306E\u30A2\u30D7\u30EA\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306B\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",device:"\u30C7\u30D0\u30A4\u30B9",deviceHint:"\u30A2\u30D7\u30EA\u3092\u52D5\u304B\u3059\u753B\u9762\u306E\u5927\u304D\u3055\u3002\u53CE\u307E\u3089\u306A\u3044\u30DA\u30FC\u30B8\u306F\u5B9F\u6A5F\u3068\u540C\u3058\u304F\u753B\u9762\u306E\u4E2D\u3067\u30B9\u30AF\u30ED\u30FC\u30EB\u3059\u308B",deviceName:e=>kt[e]??Pi[e]??e,deviceZoom:e=>`\u53CE\u307E\u308B\u3088\u3046 ${e}% \u3067\u8868\u793A`,actions:"\u30A2\u30AF\u30B7\u30E7\u30F3",actionsHint:"\u30D5\u30A9\u30FC\u30E0\u306B\u30B5\u30F3\u30D7\u30EB\u30C7\u30FC\u30BF\u3092\u5165\u308C\u308B\u306A\u3069\u3001\u753B\u9762\u306B\u7528\u610F\u3055\u308C\u305F\u64CD\u4F5C\u3092\u4E00\u5EA6\u306B\u884C\u3046"}}),_i=["scenario","app"],V="view",se=e=>e[V]==="app"?"app":"scenario",xt=e=>({[V]:e==="app"?"app":null}),ae=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,Ri=e=>({SET_ACTIVITY_NAME:(t,r)=>({title:e.renameActivity,tone:"update",body:ae(z(r,t.target.id)?.name,k(b.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,r)=>({title:e.updateActivityDescription,tone:"update",body:Ne(z(r,t.target.id)?.description,k(b.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,r)=>({title:e.renameStory,tone:"update",body:ae(E(r,t.target.id)?.story.name,k(b.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,r)=>({title:e.updateStoryDescription,tone:"update",body:Ne(E(r,t.target.id)?.story.description,k(b.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,r)=>({title:e.renameStep,tone:"update",body:ae($(r,t.target.id)?.step.name,k(b.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,r)=>({title:e.updateStepDescription,tone:"update",body:Ne($(r,t.target.id)?.step.description,k(b.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,r)=>({title:e.changePreviewKind,tone:"update",body:ae(T(r,t.target.id)?.preview.kind,k(b.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,r)=>({title:e.changePreviewViewport,tone:"update",body:ae(T(r,t.target.id)?.preview.viewport,k(b.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${k(b.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>ze(e,e.activityGroup,k(b.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>ze(e,e.storyGroup,k(b.REORDER_STORY,t).after),REORDER_STEP:t=>ze(e,e.stepGroup,k(b.REORDER_STEP,t).after),MOVE_STORY:(t,r)=>({title:e.moveStory,tone:"move",body:`\u2192 ${z(r,k(b.MOVE_STORY,t).toActivity)?.name??k(b.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,r)=>({title:e.moveStep,tone:"move",body:`\u2192 ${E(r,k(b.MOVE_STEP,t).toStory)?.story.name??k(b.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>be(e,e.activityGroup,k(b.ADD_ACTIVITY,t).name),ADD_STORY:t=>be(e,e.storyGroup,k(b.ADD_STORY,t).name),ADD_STEP:t=>be(e,e.stepGroup,k(b.ADD_STEP,t).name),ADD_PREVIEW:t=>be(e,e.previewGroup,k(b.ADD_PREVIEW,t).label??k(b.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,r)=>we(e,z(r,t.target.id)?.name),DELETE_STORY:(t,r)=>we(e,E(r,t.target.id)?.story.name),DELETE_STEP:(t,r)=>we(e,$(r,t.target.id)?.step.name),DELETE_PREVIEW:(t,r)=>we(e,T(r,t.target.id)?.preview.label)}),Ne=(e,t)=>{const r=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${r}"`:`"${Di(e)}" \u2192 "${r}"`},Di=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,ze=(e,t,r)=>({title:e.reorderTitle(t),tone:"move",body:r===null?e.toFront:e.afterName(r)}),be=(e,t,r)=>({title:e.addTitle(t),tone:"create",body:`+ "${r}"`}),we=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),$t=(e,t,r,i)=>{const n=Ri(e),o=Object.hasOwn(n,t.type)?n[t.type]:void 0,s=o?o(t,i??r):{title:t.type,tone:"meta"};return{title:s.title,targetLabel:St(e,r,t.target),tone:s.tone,...s.body===void 0?{}:{summary:s.body}}},Et=e=>`${e.type} ${Y(e.target)} ${JSON.stringify(e.payload)}`,St=(e,t,r)=>{switch(r.type){case"activity":{const i=z(t,r.id);return i?e.targetLabel(e.activityGroup,i.name):e.targetMissing(e.activityGroup,r.id)}case"story":{const i=E(t,r.id)?.story;return i?e.targetLabel(e.storyGroup,i.name):e.targetMissing(e.storyGroup,r.id)}case"step":{const i=$(t,r.id)?.step;return i?e.targetLabel(e.stepGroup,i.name):e.targetMissing(e.stepGroup,r.id)}case"screen":{const i=N(t,r.id)?.screen;return i?e.targetLabel(e.screenGroup,i.title):e.targetMissing(e.screenGroup,r.id)}case"preview":{const i=T(t,r.id)?.preview;return i?e.targetLabel(e.previewGroup,i.label??i.id):e.targetMissing(e.previewGroup,r.id)}case"page":return e.targetLabel(e.pageGroup,Ye(t));case re:{const i=Oe(r.id),n=i?T(t,i.previewId)?.preview:void 0;return i&&n?e.targetLabel(e.uiGroup,Tt(n,i)):e.targetMissing(e.uiGroup,r.id)}default:return e.targetLabel(r.type,r.id)}},Tt=(e,t)=>{const r=t.text===void 0?t.selector:`"${t.text}"`;return`${e.label??e.id} \u203A ${r}`},At=(e,t)=>{const r=[];for(const i of e){if(i.target.type!==re)continue;const n=Oe(i.target.id);!n||!t.includes(n.previewId)||r.push({id:i.id,previewId:n.previewId,selector:n.selector,number:r.length+1,body:tt(i)})}return r},It=(e,t)=>At(e,t).length,Oi=/^[a-z][a-z0-9+.-]*:/i,Ci=e=>{const t=e.baseUrl?.trim(),r=Yr(e.title??"");return`${(t?t.startsWith("http")?t:`https://${t}`:`https://${r==="item"?"page":r}.example.com`).replace(/\/+$/,"")}/`},me=(e,t)=>{const r=Ci(e);if(!t.url)return`${r}${t.id}`;if(Oi.test(t.url))return t.url;try{return decodeURI(new URL(t.url,r).href)}catch{return t.url}},Mi=e=>{switch(e.type){case"activity":return{[V]:null,activity:e.id};case"story":return{[V]:null,activity:null,story:e.id};case"step":return{[V]:null,activity:null,story:null,step:e.id};case"screen":return{screen:e.id};default:return null}},Pt=(e,t)=>{const r=e.kind==="screen"?[{type:"screen",id:e.screen.id}]:[{type:"activity",id:e.activity.id},{type:"story",id:C(e.activity.id,e.story.id)},...e.kind==="step"?[{type:"step",id:ie(e)}]:[]];for(const i of t?.panes??[])i.kind==="screen"&&r.push({type:"screen",id:i.screen.screen.id});return[...new Set(r.map(Y))].join(" ")},Ve=",",_t=e=>e.preview?.split(Ve)??[],Li=(e,t)=>e.kind===t.kind&&e.viewport===t.viewport,Rt=(e,t,r)=>{const i=t.find(o=>r.includes(o.id));if(i)return i;const n=r.flatMap(o=>T(e,o)?.preview??[]);return t.find(o=>n.some(s=>Li(o,s)))??t[0]},Dt=(e,t,r,i)=>{const n=t.screen.previews,o=r===void 0?Rt(e,n,_t(i)):n.find(a=>a.id===r);if(!o)return;const s=r===void 0&&n.length>1;return{kind:"screen",screen:t,preview:o,pinned:r!==void 0,tabs:s?n:[]}},Ot=e=>({layout:e.length>1?"side-by-side":"single",panes:e,shown:e.map(t=>t.preview)}),Ct=(e,t,r)=>t.panes.flatMap(i=>{if(!K(i))return[{kind:"material",preview:i.material}];const n=N(e,i.screen),o=n&&Dt(e,n,i.preview,r);return o?[o]:[]}),Ue=(e,t,r)=>{if(t.kind==="screen"){const i=Dt(e,t,void 0,r);return Ot(i?[i]:[])}return Ot(Ct(e,t.step,r))},Ni=(e,t)=>e.panes.flatMap(r=>r.kind!=="screen"||r.tabs.length===0?[]:[r.tabs.some(i=>i.id===t)?t:r.preview.id]).join(Ve),Mt=(e,t)=>{const r=new Map;for(const i of t){const n=T(e,i)?.owner;if(n?.kind!=="screen"||n.screen.actions.length===0)continue;const o=r.get(n.screen.id)??{screen:n.screen,previewIds:[]};o.previewIds.push(i),r.set(n.screen.id,o)}return[...r.values()].map(({screen:i,previewIds:n})=>({screen:i,previewIds:n,actions:i.actions}))},zi=(e,t)=>[...X(t),...he(e,t).flatMap(r=>r.screen.previews)],Vi=["activity","story","step","screen","preview"],Ui=(e,t,r)=>{switch(t){case"activity":return z(e,r)!==void 0;case"story":return E(e,r)!==void 0||e.activities.some(i=>i.stories.some(n=>n.id===r));case"step":return $(e,r)!==void 0||H(e).some(i=>i.step.id===r);case"screen":return N(e,r)!==void 0;case"preview":return T(e,r)!==void 0;default:return!1}},Yi=(e,t)=>{let r;if(t.navigate!==null)r=t.navigate.includes("=")?t.navigate:`step=${t.navigate}`;else{const o=t.href?.trim()??"";if(o===""||o==="#"||o.toLowerCase().startsWith("javascript:"))return"no-destination";if(!o.startsWith("#"))return null;r=o}const i=Ae(r),n=Vi.filter(o=>i[o]!==void 0);return n.length===0?t.navigate===null?null:"unknown-target":n.every(o=>Ui(e,o,i[o]??""))?null:"unknown-target"},Wi=(e,t)=>{const r=t.mail??{},i=[{label:e.mailFrom,value:r.from},{label:e.mailTo,value:r.to},{label:e.mailCc,value:r.cc},{label:e.mailDate,value:r.date}].flatMap(s=>s.value===void 0||s.value.trim()===""?[]:[{label:s.label,value:s.value}]),n=r.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||r.from?.trim(),o=n?Array.from(n)[0]?.toUpperCase():void 0;return{...r.subject===void 0||r.subject.trim()===""?{}:{subject:r.subject},...n?{sender:n}:{},...o===void 0?{}:{initial:o},rows:i}},Lt=(e,t)=>{const r=[];for(const i of t.activities){r.push({value:Y({type:"activity",id:i.id}),label:i.name,group:e.activityGroup});for(const n of i.stories){r.push({value:Y({type:"story",id:C(i.id,n.id)}),label:`${i.name} \u203A ${n.name}`,group:e.storyGroup});for(const o of n.steps)r.push({value:Y({type:"step",id:ve(i,n,o)}),label:`${n.name} \u203A ${o.name}`,group:e.stepGroup})}}for(const{app:i,screen:n}of W(t))r.push({value:Y({type:"screen",id:n.id}),label:`${i.name} \u203A ${n.title}`,group:e.screenGroup});return r},Hi=(e,t,r)=>{const i=Z(t,r);if(i?.kind==="screen"){const{screen:n}=i;return{value:Y({type:"screen",id:n.id}),label:n.title,group:e.screenGroup}}return i?.kind!=="step"?null:{value:Y({type:"step",id:ie(i)}),label:i.step.name,group:e.stepGroup}},Z=(e,t)=>{if(se(t)==="app"){const o=N(e,t.screen);return o?{kind:"screen",...o}:void 0}const r=$(e,t.step);if(r)return{kind:"step",...r};const i=z(e,t.activity),n=i?.stories.find(o=>o.id===t.story||C(i.id,o.id)===t.story);return i&&n?{kind:"story",activity:i,story:n}:void 0},Nt=(e,t)=>{const r=(d,c)=>c===void 0?{title:d}:{actor:c,title:d};if(t.kind==="screen")return r(t.screen.title,t.app.actor);const{activity:i,story:n,step:o}=t,s=he(e,o),a=s.length===1?s[0]:void 0;return r(a?.screen.title??o.name,o.actor??n.actor??i.actor??a?.app.actor)},Bi=(e,t)=>{const r=t.actor??e.actor;return r===void 0?{title:t.name}:{actor:r,title:t.name}},Ye=e=>e.title??"UX Prototype",zt=(e,t)=>(t?e.preview=t:delete e.preview,e),Gi=(e,t,r)=>{if(!t)return;const i=Ct(e,t,r).flatMap(n=>n.kind==="screen"&&!n.pinned?[n.preview.id]:[]);return i.length===0?void 0:i.join(Ve)},Vt=(e,t)=>{const r=()=>{if(t.step===void 0&&t.story===void 0)return;const o=Ut(e,{...t,[V]:""}),s=$(e,o.step);return s&&he(e,s.step)[0]},i=N(e,t.screen)??r()??W(e)[0],n={...t,[V]:"app"};for(const o of["activity","story","step"])delete n[o];return i?n.screen=i.screen.id:delete n.screen,zt(n,i&&Rt(e,i.screen.previews,_t(t))?.id)},qi=(e,t,r)=>{const i=s=>Ti(s.step,t);if(r&&i(r))return r;const n=r?.story.steps??[],o=s=>{const a=n[s];return r&&a?{...r,step:a,stepIndex:s}:void 0};for(let s=(r?.stepIndex??0)+1;s<n.length;s+=1){const a=o(s);if(a&&i(a))return a}for(let s=(r?.stepIndex??0)-1;s>=0;s-=1){const a=o(s);if(a&&i(a))return a}return H(e).find(i)},Ut=(e,t)=>{const r=z(e,t.activity),i=t.story,n=r?.stories.find(U=>U.id===i||C(r.id,U.id)===i),o=n&&r?{activity:r,story:n}:E(e,i),s=t.step,d=(o&&s?$(e,`${C(o.activity.id,o.story.id)}.${s}`):void 0)??$(e,s),c=t.screen,f=c===void 0?void 0:qi(e,c,d);if(c!==void 0&&!f&&N(e,c))return Vt(e,{...t,[V]:"app"});const h=f??d,v=h?.activity??o?.activity??r??e.activities[0],I=h?.story??(o&&o.activity===v?o.story:void 0)??v?.stories[0],_=h?.step??I?.steps[0],S={...t};return delete S.screen,v?S.activity=v.id:delete S.activity,I&&v?S.story=E(e,I.id)?I.id:C(v.id,I.id):delete S.story,_&&I&&v?S.step=$(e,_.id)?_.id:ve(v,I,_):delete S.step,delete S[V],zt(S,Gi(e,_,t))},ji=["activity","story","step","screen"],ye=(e,t)=>se(t)==="app"?Vt(e,t):Ut(e,t),Fi=(e,t)=>{const r=t.screen.previews.find(o=>o.kind==="browser");if(!r)return;let i;try{i=new URL(me(e,r),"https://page.example.com")}catch{return}const n=i.pathname.split("/").filter(o=>o!=="").map(o=>{try{return decodeURIComponent(o)}catch{return o}});return{origin:i.origin,segments:n}},Yt=()=>({screens:[],children:new Map}),We=(e,t,r)=>{const[i,...n]=e.children.entries();if(e.screens.length===0&&i&&n.length===0&&r!=="/"){const[o,s]=i;return We(s,`${t}/${o}`,`${r}/${o}`)}return{segment:t,path:r,screens:e.screens,children:[...e.children.entries()].map(([o,s])=>We(s,`/${o}`,`${r==="/"?"":r}/${o}`))}},Ki=e=>{const t=new Map;for(const[r,i]of e){const n=t.get(i.origin)??Yt();t.set(i.origin,n);let o=n;for(const s of i.segments){const a=o.children.get(s)??Yt();o.children.set(s,a),o=a}o.screens.push(r)}return[...t.entries()].map(([r,i])=>({origin:r,root:We(i,"/","/")}))},Xi=(e,t)=>{const r=t.screens.map(o=>({app:t,screen:o})),i=[],n=[];for(const o of r){const s=Fi(e,o);s?i.push([o,s]):n.push(o)}return{app:t,screens:r,trees:Ki(i),others:n}},Wt=e=>e.apps.map(t=>Xi(e,t)).filter(t=>t.screens.length>0),Ht=(e,t)=>t?.kind!=="screen"?e[0]:e.find(r=>r.app.id===t.app.id)??e[0],Zi=(e,t)=>{switch(t.type){case"activity":return z(e,t.id)!==void 0;case"story":return E(e,t.id)!==void 0;case"step":return $(e,t.id)!==void 0;case"screen":return N(e,t.id)!==void 0;case"preview":return T(e,t.id)!==void 0;case"page":return!0;case re:{const r=Oe(t.id);return r!==void 0&&T(e,r.previewId)!==void 0}default:return!1}},Bt=e=>{const t=fe(e);return{name:"prototype",label:"UX Prototype",parseBase:gt,emptyBase:ft,actions:b,apply:mt,hasTarget:Zi,canonicalTarget:(r,i)=>{if(i.type==="step"){const n=$(r,i.id);return n?{...i,id:ie(n)}:i}if(i.type==="story"){const n=E(r,i.id);return n?{...i,id:C(n.activity.id,n.story.id)}:i}if(i.type==="preview"){const n=T(r,i.id);return n?{...i,id:n.preview.id}:i}return i},describe:(r,i,n)=>$t(t,r,i,n),serialize:Et,resolveNavigation:ye,navigationHierarchy:ji,navigationFor:(r,i)=>Mi(i),commentTargets:(r,i)=>Lt(t,r),currentTarget:(r,i)=>Hi(t,r,i),title:Ye}},Ji=(e,t)=>{const r=t.flatMap(i=>{const n=Math.max(i.left,e.left)-e.left,o=Math.max(i.top,e.top)-e.top,s=Math.min(i.right,e.right)-e.left-n,a=Math.min(i.bottom,e.bottom)-e.top-o;return s>0&&a>0?[`M${n} ${o}h${s}v${a}h-${s}Z`]:[]});return r.length===0?"none":`path(evenodd, 'M0 0H${e.width}V${e.height}H0Z ${r.join(" ")}')`},ke="data-dpk-modal",Qi=e=>{try{return e.matches(":modal")}catch{return!1}},Gt=e=>{e.setAttribute(ke,""),e.open||e.show()},qt=e=>{Object.hasOwn(e,"showModal")||Object.defineProperty(e,"showModal",{configurable:!0,value:()=>Gt(e)})},jt=(e,t)=>{if(!Qi(t))return;const r=i=>{i.target===t&&(i.stopImmediatePropagation(),e.removeEventListener("close",r,!0))};e.addEventListener("close",r,!0),t.close(),Gt(t)},Ft=(e,t)=>{try{return Array.from(e.querySelectorAll(t))}catch{return[]}},en=(e,t)=>{const r=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value");r?.set?r.set.call(e,t):e.value=t},tn=e=>e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"),rn=(e,t)=>{if(tn(e)){const i=typeof t=="boolean"?t:e.value===t;return typeof t=="string"&&!i?!1:(e.checked=i,!0)}const r=String(t);return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?(en(e,r),!0):(e.textContent=r,!1)},nn=(e,t)=>{const r=[];for(const[i,n]of Object.entries(t)){const o=Ft(e,i);o.length===0&&r.push(i);for(const s of o)rn(s,n)&&(s.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),s.dispatchEvent(new Event("change",{bubbles:!0})))}return r},on=(e,t)=>{const r=[];for(const i of t){const[n]=Ft(e,i);n instanceof HTMLElement?n.click():r.push(i)}return r},sn='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',Kt=/^-?[A-Za-z_][\w-]*$/,Xt=40,an=(e,t)=>{const r=e.closest(sn);return r!==null&&r!==t&&t.contains(r)?r:e},xe=e=>{const t=e.replace(/\s+/g," ").trim();if(t==="")return;const r=Array.from(t);return r.length>Xt?`${r.slice(0,Xt).join("")}\u2026`:t},dn=e=>{const t=e.getAttribute("aria-label")??e.getAttribute("title");if(t)return xe(t);const r=e.tagName.toLowerCase();return xe(r==="input"||r==="textarea"||r==="select"?e.getAttribute("placeholder")??e.getAttribute("name")??"":r==="img"?e.getAttribute("alt")??"":e.textContent??"")},pn=e=>{const t=e.getAttribute("id");if(t&&Kt.test(t))return`#${t}`;const r=e.tagName.toLowerCase(),i=Array.from(e.classList).filter(a=>Kt.test(a)).slice(0,2).map(a=>`.${a}`).join(""),n=e.parentElement,o=n?Array.from(n.children).filter(a=>a.tagName===e.tagName):[],s=o.length>1?`:nth-of-type(${o.indexOf(e)+1})`:"";return`${r}${i}${s}`},cn=(e,t,r)=>{try{const i=e.querySelectorAll(t);return i.length===1&&i[0]===r}catch{return!1}},ln=(e,t)=>{const r=[];let i=e;for(;i!==null&&i!==t;){const o=pn(i);if(r.unshift(o),o.startsWith("#")||cn(t,r.join(" > "),e))break;i=i.parentElement}const n=dn(e);return{selector:r.length===0?":scope":r.join(" > "),tag:e.tagName.toLowerCase(),...n===void 0?{}:{text:n}}},un=(e,t)=>{if(t===":scope")return e;try{return e.querySelector(t)}catch{return null}},hn=["screen","preview"],de=e=>JSON.stringify(hn.map(t=>e[t]??null)),Zt=(e,t)=>e?.kind==="page"&&de(e.page)===t,$e=e=>`tab-${e}`,vn=e=>({tabs:[{id:$e(1),history:[{kind:"page",page:e}],index:0}],activeId:$e(1),seen:de(e),nextId:2}),gn={id:"",history:[],index:0},J=e=>e.tabs.find(t=>t.id===e.activeId)??e.tabs[0]??gn,pe=e=>{const t=J(e);return t.history[t.index]},fn=e=>J(e).index>0,bn=e=>{const t=J(e);return t.index<t.history.length-1},Jt=(e,t)=>({...e,tabs:e.tabs.map(r=>r.id===e.activeId?t(r):r)}),He=(e,t)=>Jt(e,r=>({...r,history:[...r.history.slice(0,r.index+1),t],index:r.index+1})),Ee=e=>{const t=pe(e);return t?.kind==="page"?{...e,seen:de(t.page)}:e},Qt=(e,t)=>{const r=J(e),i=r.index+t;return i<0||i>=r.history.length?e:Ee(Jt(e,n=>({...n,index:i})))},er=(e,t,r)=>{const i=$e(e.nextId),n=e.tabs.findIndex(o=>o.id===e.activeId)+1;return Ee({...e,tabs:[...e.tabs.slice(0,n),{id:i,history:[t],index:0},...e.tabs.slice(n)],activeId:r?e.activeId:i,nextId:e.nextId+1})},wn=(e,t)=>{const r=e.tabs.findIndex(o=>o.id===t);if(r<0)return e;if(e.tabs.length===1){const o=$e(e.nextId);return{...e,tabs:[{id:o,history:[{kind:"new-tab"}],index:0}],activeId:o,nextId:e.nextId+1}}const i=e.tabs.filter(o=>o.id!==t);if(t!==e.activeId)return{...e,tabs:i};const n=i[r]??i[r-1];return Ee({...e,tabs:i,activeId:n?.id??e.activeId})},mn=(e,t)=>{const r=t===null?null:de(t);if(r===e.seen)return e;const i={...e,seen:r};return t===null||r===null||Zt(pe(e),r)?i:He(i,{kind:"page",page:t})},yn=(e,t)=>{const r=de(t);return Zt(pe(e),r)?e.seen===r?e:{...e,seen:r}:He({...e,seen:r},{kind:"page",page:t})},tr=(e,t)=>{switch(t.kind){case"observe":return mn(e,t.page);case"visit":return yn(e,t.page);case"back":return Qt(e,-1);case"forward":return Qt(e,1);case"open-tab":return er(e,t.entry,t.background);case"new-tab":return er(e,{kind:"new-tab"},!1);case"unreachable":return He(e,{kind:"unreachable",url:t.url});case"activate":return e.tabs.some(r=>r.id===t.id)&&t.id!==e.activeId?Ee({...e,activeId:t.id}):e;case"close-tab":return wn(e,t.id);default:return e}},rr=(e,t)=>{const r=ye(e,t),i=Z(e,r);if(i?.kind!=="screen")return null;const[n]=Ue(e,i,r).shown;return n?.kind!=="browser"?null:{screen:i.screen.id,preview:n.id}},Se=(e,t)=>{const r=Z(e,ye(e,{[V]:"app",...t}));return r?.kind==="screen"?r:void 0},ir=(e,t)=>{const r=e.trim();if(r==="")return null;try{return r.startsWith("/")?new URL(r,t):new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(r)?r:`https://${r}`)}catch{return null}},nr=e=>`${e.origin}${e.pathname.replace(/\/+$/,"")}`,kn=(e,t,r)=>{const i=ir(t,r);if(i===null)return null;const n=nr(i);for(const{screen:o}of W(e))for(const s of o.previews){if(s.kind!=="browser")continue;const a=ir(me(e,s),r);if(a!==null&&nr(a)===n)return{screen:o.id,preview:s.id}}return null},or=e=>{try{return new URL(e).host||e}catch{return e}},xn=(e,t,r)=>t===void 0||t.kind==="new-tab"?r.newTab:t.kind==="unreachable"?or(t.url):Se(e,t.page)?.screen.title??r.newTab,sr=(e,t)=>{if(t===void 0||t.kind==="new-tab")return"";if(t.kind==="unreachable")return t.url;const r=Se(e,t.page)?.screen.previews.find(i=>i.id===t.page.preview);return r===void 0?"":me(e,r)},ar=e=>{const t=J(e);for(let r=t.index;r>=0;r-=1){const i=t.history[r];if(i?.kind==="page")return i.page}for(const r of e.tabs){const i=r.history[r.index];if(i?.kind==="page")return i.page}},$n=(e,t)=>t===void 0?void 0:Se(e,t)?.app.actor,dr=(e,t,r,i=null)=>{const n=J(t),o=n.history[n.index],s=$n(e,ar(t)??i??void 0);return{tabs:t.tabs.map(a=>({id:a.id,title:xn(e,a.history[a.index],r),url:sr(e,a.history[a.index]),active:a.id===n.id})),entry:o,url:sr(e,o),canBack:fn(t),canForward:bn(t),...s===void 0?{}:{profile:s}}},En=e=>ar(e)??null,Sn=(e,t)=>{const r=t===null?void 0:Se(e,t),i=Ht(Wt(e),r),n=[],o=(s,a)=>{for(const{screen:d}of a.screens){const c=d.previews.find(f=>f.kind==="browser");c!==void 0&&n.push({title:d.title,url:`${s}${a.path==="/"?"":a.path}`,page:{screen:d.id,preview:c.id}})}for(const d of a.children)o(s,d)};for(const s of i?.trees??[])o(or(s.origin),s.root);return n},A=(e,t,r,i)=>({id:t,deviceClass:e,width:r,height:i}),pr=[A("phone","iphone-se",375,667),A("phone","iphone-16",393,852),A("phone","iphone-16-pro-max",440,956),A("phone","pixel-7",412,915),A("phone","galaxy-s24",360,780),A("tablet","ipad-mini",744,1133),A("tablet","ipad-air-11",820,1180),A("tablet","ipad-pro-11",834,1194),A("tablet","ipad-pro-13",1024,1366),A("desktop","laptop-13",1280,800),A("desktop","laptop-15",1440,900),A("desktop","full-hd",1920,1080),A("desktop","monitor-27",2560,1440),A("desktop","ultrawide",3440,1440)],Tn={phone:A("phone","iphone-16",393,852),tablet:A("tablet","ipad-pro-11",834,1194),desktop:A("desktop","laptop-13",1280,800)},cr=e=>e==="mobile"?"phone":e==="tablet"?"tablet":"desktop",An=e=>e!=="plain",lr=e=>pr.filter(t=>t.deviceClass===e),In=(e,t)=>{const r=cr(e),i=t[r];return lr(r).find(n=>n.id===i)??Tn[r]},Pn=(e,t)=>{const r=pr.find(i=>i.id===t);return r===void 0||e[r.deviceClass]===t?e:{...e,[r.deviceClass]:t}},_n=(e,t)=>`${e.deviceName(t.id)} \xB7 ${t.width}\xD7${t.height}`,Rn=(e,t)=>{const r=[1,t.width/e.width];t.height!==void 0&&r.push(t.height/e.height);const i=Math.min(...r);return!Number.isFinite(i)||i<=0?1:Math.max(.1,Math.floor(i*100)/100)},ur=(e,t)=>{const{state:r,navigation:i}=e,n=Z(r,i),o=se(i);return p`
|
|
2
2
|
<div class="nav">
|
|
3
3
|
${Cn(e,t,o)}
|
|
4
4
|
${o==="app"?Mn(e,t,n):n!==void 0&&n.kind!=="screen"?zn(e,t,n):p`<p class="nav-empty">${t.noActivityBefore}<code>activities</code>${t.noActivityAfter}</p>`}
|
|
@@ -216,7 +216,7 @@ import{aj as m,aO as Or,ae as O,aA as P,aB as g,ah as u,af as M,ai as le,ad as C
|
|
|
216
216
|
<button class="demo-control demo-exit" type="button" title=${e.exitDemo} @click=${t.onExit}>
|
|
217
217
|
${Re()} ${e.exitDemo} <kbd>Esc</kbd>
|
|
218
218
|
</button>
|
|
219
|
-
</div>`,kr={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},xr={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},Fn={browser:0,native:22,mail:0,plain:0},$r=(e,t,r)=>{const i=`--frame-width:${kr[t]};--frame-min-height:${xr[t]}`;if(r?.kind!=="device")return i;const n=Fn[e];return`${i};--device-width:${r.width+n}px;--device-height:${r.height+n}px;zoom:${r.zoom}`},Kn=D(Gr),Xn=D(qr),Zn=D(ci),Jn=D(
|
|
219
|
+
</div>`,kr={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},xr={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},Fn={browser:0,native:22,mail:0,plain:0},$r=(e,t,r)=>{const i=`--frame-width:${kr[t]};--frame-min-height:${xr[t]}`;if(r?.kind!=="device")return i;const n=Fn[e];return`${i};--device-width:${r.width+n}px;--device-height:${r.height+n}px;zoom:${r.zoom}`},Kn=D(Gr),Xn=D(qr),Zn=D(ci),Jn=D(oi),Be=D(ai),Qn=(e,t,r)=>{const i=t.length-1;if(e==="ArrowRight")return t[r===i?0:r+1];if(e==="ArrowLeft")return t[r===0?i:r-1];if(e==="Home")return t[0];if(e==="End")return t[i]},eo=(e,t)=>{const{view:r,send:i}=t,n=o=>s=>{const a=r.tabs[o],d=s.key==="Enter"||s.key===" "?a:Qn(s.key,r.tabs,o);d!==void 0&&(s.preventDefault(),i({kind:"activate",id:d.id,focus:!0}))};return p`<div class="browser-tabs">
|
|
220
220
|
<div class="browser-tab-list" role="tablist" aria-label=${e.browserTabs}>
|
|
221
221
|
${r.tabs.map((o,s)=>p`<div
|
|
222
222
|
class="browser-tab"
|
|
@@ -2555,6 +2555,6 @@ import{aj as m,aO as Or,ae as O,aA as P,aB as g,ah as u,af as M,ai as le,ad as C
|
|
|
2555
2555
|
max-height: calc(100% - 32px);
|
|
2556
2556
|
margin: auto;
|
|
2557
2557
|
}
|
|
2558
|
-
`,qe={kind:"off"},ko=(e,t)=>{switch(t.kind){case"toggle":return e.kind==="off"?{kind:"picking"}:qe;case"exit":return qe;case"pick":return e.kind==="off"?e:{kind:"composing",target:t.target,body:e.kind==="composing"?e.body:""};case"input":return e.kind==="composing"?{...e,body:t.body}:e;case"dismiss":case"submitted":return e.kind==="off"?e:{kind:"picking"};default:return e}},xo={width:300,height:300},$o=360,Eo={width:280,height:360},Pr="dpk-template-prototype-document-styles",So=24,To=()=>{if(document.getElementById(Pr)!==null)return;const e=Object.assign(document.createElement("style"),{id:Pr,textContent:yo});document.head.append(e)},Ao=(e,t,r)=>{const i=getComputedStyle(e),n=/auto|scroll/.test(i.overflowX)&&e.scrollWidth>e.clientWidth,o=/auto|scroll/.test(i.overflowY)&&e.scrollHeight>e.clientHeight,s=t<0?e.scrollLeft>0:t>0&&e.scrollLeft+e.clientWidth<e.scrollWidth-1,a=r<0?e.scrollTop>0:r>0&&e.scrollTop+e.clientHeight<e.scrollHeight-1;return n&&s||o&&a},Io=e=>{if(e.assignedSlot!==null)return e.assignedSlot;if(e.parentElement!==null)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null};class _r extends ot{static{this.styles=[ot.styles,Zr,Jr,mo]}#e=qe;#v=!1;#s=null;#n=[];#S=new Qr(this);#T=!1;#t=null;#r=null;#A=!1;#c=!1;#g=!1;#i=null;#f=null;#b={};#w=1;#l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.#C());#a=null;#d=null;#u=null;#m=!1;constructor(){super(),new oi(this,{open:()=>this.#u!==null,closesOn:t=>!t.some(r=>r instanceof Element&&this.#U(r)),ownsEscape:()=>!0,dismiss:()=>this.#y(!0)})}definitionFor(t){return Bt(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#R),window.addEventListener("resize",this.#x),this.addEventListener("toggle",this.#M,!0),this.addEventListener("click",this.#h,!0),this.addEventListener("auxclick",this.#h,!0),To()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#R),window.removeEventListener("resize",this.#x),this.removeEventListener("toggle",this.#M,!0),this.removeEventListener("click",this.#h,!0),this.removeEventListener("auxclick",this.#h,!0),this.#l?.disconnect(),this.#a=null,this.#N()}renderRegions(t){const r=fe(this.locale),i=Z(t.state,t.navigation),n=se(t.navigation)==="app";this.#t!==null&&this.#t.mode==="demo"!==n&&this.#L();const o=n?this.#re(t,r):null;return this.#A=o!==null,this.#n=i!==void 0&&i.kind!=="story"&&(o===null||o.view.entry?.kind==="page")?Ue(t.state,i,t.navigation).shown.map(s=>s.id):[],this.#i!==null&&this.#i.page!==this.#n.join(" ")&&this.#N(),{sidebar:ur(t,r),main:Sr(t,r,{hasPreviewContent:s=>this.#de(s),lift:this.#t,onToggleMaximize:()=>this.#E(this.#t===null?"maximized":null),onToggleDemo:()=>this.#E(this.#t===null?"demo":null),onLiftedWheel:this.#te,browser:o===null?null:{...o,loading:this.#i!==null},devices:n?{choice:this.#b,zoom:this.#w,onPick:s=>{this.#b=Pn(this.#b,s),this.requestUpdate()}}:null,uiComment:this.#H(t),actions:this.#z(t),canvasEvents:{click:this.#q,pointermove:this.#j,pointerleave:this.#F,wheel:this.#K,scroll:this.#x}})}}updated(){super.updated(),this.#Q(),this.#Z(),this.#X(),this.#C();const t=this.#e;if(t.kind==="composing"&&!this.#n.includes(t.target.previewId)){this.#p({kind:"dismiss"});return}this.#ee(),this.#Y(),this.#g&&(this.#g=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus()),this.#D();const r=t.kind==="composing"&&!this.#v;if(this.#v=t.kind==="composing",t.kind!=="composing"||this.#s===null)return;const i=this.renderRoot.querySelector(".comment-pop");i&&(this.#S.open(i,this.#s,xo,{placement:"right-start"}),r&&i.querySelector("textarea")?.focus({preventScroll:!0}))}#z(t){const r=Mt(t.state,this.#n),i=r.map(o=>o.screen.id).join(" "),n=r.length>0&&this.#d===i;return{groups:r,open:n,toggle:()=>n?this.#y(!1):this.#V(i),run:(o,s)=>this.#W(o,s)}}#V(t){this.#d=t,this.requestUpdate()}#y(t){this.#d!==null&&(this.#d=null,this.#m=t,this.requestUpdate())}#U(t){return t.classList.contains("actions-menu")||t.getAttribute("data-role")==="actions"}#Y(){const t=this.renderRoot.querySelector(".actions-menu"),r=this.renderRoot.querySelector('[data-role="actions"]');if(t===null){this.#u=null,this.#m&&r?.focus({preventScroll:!0}),this.#m=!1;return}t===this.#u||r===null||(this.#u=t,this.#S.open(t,r,Eo),t.querySelector('[role="menuitem"]')?.focus({preventScroll:!0}))}#W(t,r){this.#y(!0);const i=Mt(this.derivation.state,this.#n).find(d=>d.screen.id===t),n=i?.actions.find(d=>d.id===r);if(i===void 0||n===void 0)return;const s=this.#k().filter(d=>i.previewIds.includes(d.getAttribute("data-preview-id")??"")).map(d=>{const c=[...nn(d,n.fill??{}),...on(d,n.click??[])];return d.dispatchEvent(new CustomEvent("dpk-action",{bubbles:!0,detail:{id:n.id,screen:i.screen.id}})),c}),a=(s[0]??[]).filter(d=>s.every(c=>c.includes(d)));a.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: action "${n.id}" of screen "${i.screen.id}" found nothing on screen for: ${a.join(", ")}`)}#H(t){const r=this.#e,i=r.kind==="composing"?r.target:void 0,n=i?T(t.state,i.previewId)?.preview:void 0,o=i?vt(i):void 0;return{mode:r,pins:r.kind==="off"?[]:At(t.comments,this.#n),...i&&n?{targetLabel:Tt(n,i)}:{},notes:t.comments.filter(s=>s.target.type===re&&s.target.id===o).map(s=>tt(s)),composer:ni(this.locale),send:s=>this.#p(s),submit:s=>this.#B(s)}}#p(t){const r=ko(this.#e,t);r!==this.#e&&(this.#e=r,r.kind!=="composing"&&(this.#s=null),this.requestUpdate())}#B(t){const r=this.#e;if(r.kind!=="composing")return;this.dispatch({type:ei,target:{type:re,id:vt(r.target)},payload:{body:t}}).ok&&this.#p({kind:"submitted"})}#I(t){const r=t.composedPath(),i=r[0];if(i instanceof Element&&i.classList.contains("ui-catcher"))return this.#G(t.clientX,t.clientY);const n=r.find(o=>o instanceof Element&&o.parentElement===this&&o.hasAttribute("data-preview-id"));return!n||!(i instanceof Element)||!n.contains(i)?null:this.#_(i,n)}#G(t,r){const i=this.#P(t,r);return i===null?null:this.#_(i.element,i.wrapper)}#P(t,r){if(typeof document.elementsFromPoint!="function")return null;const i=this.#k();for(const n of document.elementsFromPoint(t,r)){const o=i.find(s=>s.contains(n));if(o!==void 0)return{element:n,wrapper:o}}return null}#_(t,r){const i=r.getAttribute("data-preview-id");if(!i)return null;const n=an(t,r),o=ln(n,r);return{element:n,target:{previewId:i,selector:o.selector,...o.text===void 0?{}:{text:o.text}}}}#k(){return Array.from(this.children).filter(t=>{const r=t.getAttribute("data-preview-id");return r!==null&&this.#n.includes(r)})}#q=t=>{if(this.#e.kind==="off")return;const r=this.#I(t);r&&(t.preventDefault(),t.stopPropagation(),this.#s=r.element,this.#p({kind:"pick",target:r.target}))};#j=t=>{if(this.#e.kind==="off")return;const r=this.#I(t);this.#$(".ui-hover",r?.element??null)};#F=()=>{this.#$(".ui-hover",null)};#K=t=>{const r=t.composedPath()[0];if(!(r instanceof Element)||!r.classList.contains("ui-catcher"))return;const i=this.renderRoot.querySelector(".canvas");let n=this.#P(t.clientX,t.clientY)?.element??null;for(;n!==null&&n!==i;){if(Ao(n,t.deltaX,t.deltaY)){t.preventDefault(),n.scrollBy({left:t.deltaX,top:t.deltaY});return}n=Io(n)}};#R=t=>{t.key!=="Escape"||t.defaultPrevented||(this.#e.kind!=="off"?this.#p({kind:"exit"}):this.#E(null))};#x=()=>{this.#e.kind!=="off"&&this.#D()};#D(){if(this.#e.kind==="off")return;this.#$(".ui-picked",this.#s);const t=this.renderRoot.querySelector(".canvas");if(!t)return;const r=this.renderRoot.querySelector(".ui-catcher");if(r){r.style.width=`${t.scrollWidth}px`,r.style.height=`${t.scrollHeight}px`;const i=[...this.renderRoot.querySelectorAll(".demo-controls")].map(n=>n.getBoundingClientRect());r.style.clipPath=Ji(r.getBoundingClientRect(),i)}for(const i of this.renderRoot.querySelectorAll(".ui-pin")){const n=this.#J(i.dataset.preview??""),s=(n?un(n,i.dataset.selector??""):null)?.getBoundingClientRect();if(!s||s.width===0&&s.height===0){i.hidden=!0;continue}const a=this.#O(t);i.hidden=!1,i.style.left=`${s.right-a.left}px`,i.style.top=`${s.top-a.top}px`}}#$(t,r){const i=this.renderRoot.querySelector(t),n=this.renderRoot.querySelector(".canvas");if(!i||!n)return;const o=r?.getBoundingClientRect();if(!o){i.hidden=!0;return}const s=this.#O(n);i.hidden=!1,i.style.left=`${o.left-s.left}px`,i.style.top=`${o.top-s.top}px`,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`}#O(t){const r=t.getBoundingClientRect();return{left:r.left+t.clientLeft-t.scrollLeft,top:r.top+t.clientTop-t.scrollTop}}#X(){const t=this.renderRoot.querySelector(".canvas");t===this.#a||this.#l===null||(this.#a!==null&&this.#l.unobserve(this.#a),this.#a=t,t!==null&&this.#l.observe(t))}#C(){const t=this.renderRoot.querySelector('.frame[data-window="device"]'),r=t?.closest(".canvas");if(!t||!(r instanceof HTMLElement))return;const i=getComputedStyle(t),n={width:parseFloat(i.getPropertyValue("--device-width")),height:parseFloat(i.getPropertyValue("--device-height"))},o=getComputedStyle(r),s=r.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),a=this.#t?.mode==="demo",d=a?So*2:0,c=Rn(n,{width:s-d,...a?{height:r.clientHeight-d}:{}});c!==this.#w&&(this.#w=c,this.requestUpdate())}#Z(){for(const t of this.querySelectorAll(":scope > [data-preview-id]"))for(const r of t.querySelectorAll("dialog"))qt(r),jt(this,r)}#M=t=>{const r=t.target;!(r instanceof HTMLDialogElement)||!r.open||Array.from(this.children).some(i=>i.hasAttribute("data-preview-id")&&i.contains(r))&&(qt(r),jt(this,r))};#J(t){return Array.from(this.children).find(r=>r.getAttribute("data-preview-id")===t)}#Q(){if(this.#T||this.renderRoot.querySelector(".stage")===null)return;this.#T=!0;const t=this.derivation.state,r=[];for(const i of Array.from(this.children)){const n=i.getAttribute("data-preview-id");if(n!==null)for(const o of i.querySelectorAll("a, [data-dpk-navigate]")){const s=Yi(t,{href:o.getAttribute("href"),navigate:o.getAttribute("data-dpk-navigate")});if(s===null)continue;const a=(o.textContent??"").replace(/\s+/g," ").trim().slice(0,40),d=o.getAttribute("data-dpk-navigate")??o.getAttribute("href")??"(no href)";r.push(` ${n}: <${o.tagName.toLowerCase()}> "${a}" \u2192 ${d} (${s})`)}}r.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: ${r.length} link(s) in the previews lead nowhere. Point each at the screen it opens (data-dpk-navigate="screen=\u2026"); a link that only moves the scenario on can name a step (data-dpk-navigate="step=\u2026") or a user story (data-dpk-navigate="story=\u2026"):
|
|
2558
|
+
`,qe={kind:"off"},ko=(e,t)=>{switch(t.kind){case"toggle":return e.kind==="off"?{kind:"picking"}:qe;case"exit":return qe;case"pick":return e.kind==="off"?e:{kind:"composing",target:t.target,body:e.kind==="composing"?e.body:""};case"input":return e.kind==="composing"?{...e,body:t.body}:e;case"dismiss":case"submitted":return e.kind==="off"?e:{kind:"picking"};default:return e}},xo={width:300,height:300},$o=360,Eo={width:280,height:360},Pr="dpk-template-prototype-document-styles",So=24,To=()=>{if(document.getElementById(Pr)!==null)return;const e=Object.assign(document.createElement("style"),{id:Pr,textContent:yo});document.head.append(e)},Ao=(e,t,r)=>{const i=getComputedStyle(e),n=/auto|scroll/.test(i.overflowX)&&e.scrollWidth>e.clientWidth,o=/auto|scroll/.test(i.overflowY)&&e.scrollHeight>e.clientHeight,s=t<0?e.scrollLeft>0:t>0&&e.scrollLeft+e.clientWidth<e.scrollWidth-1,a=r<0?e.scrollTop>0:r>0&&e.scrollTop+e.clientHeight<e.scrollHeight-1;return n&&s||o&&a},Io=e=>{if(e.assignedSlot!==null)return e.assignedSlot;if(e.parentElement!==null)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null};class _r extends ot{static{this.styles=[ot.styles,Zr,Jr,mo]}#e=qe;#v=!1;#s=null;#n=[];#S=new Qr(this);#T=!1;#t=null;#r=null;#A=!1;#c=!1;#g=!1;#i=null;#f=null;#b={};#w=1;#l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.#C());#a=null;#d=null;#u=null;#m=!1;constructor(){super(),new si(this,{open:()=>this.#u!==null,closesOn:t=>!t.some(r=>r instanceof Element&&this.#U(r)),ownsEscape:()=>!0,dismiss:()=>this.#y(!0)})}definitionFor(t){return Bt(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#R),window.addEventListener("resize",this.#x),this.addEventListener("toggle",this.#M,!0),this.addEventListener("click",this.#h,!0),this.addEventListener("auxclick",this.#h,!0),To()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#R),window.removeEventListener("resize",this.#x),this.removeEventListener("toggle",this.#M,!0),this.removeEventListener("click",this.#h,!0),this.removeEventListener("auxclick",this.#h,!0),this.#l?.disconnect(),this.#a=null,this.#N()}renderRegions(t){const r=fe(this.locale),i=Z(t.state,t.navigation),n=se(t.navigation)==="app";this.#t!==null&&this.#t.mode==="demo"!==n&&this.#L();const o=n?this.#re(t,r):null;return this.#A=o!==null,this.#n=i!==void 0&&i.kind!=="story"&&(o===null||o.view.entry?.kind==="page")?Ue(t.state,i,t.navigation).shown.map(s=>s.id):[],this.#i!==null&&this.#i.page!==this.#n.join(" ")&&this.#N(),{sidebar:ur(t,r),main:Sr(t,r,{hasPreviewContent:s=>this.#de(s),lift:this.#t,onToggleMaximize:()=>this.#E(this.#t===null?"maximized":null),onToggleDemo:()=>this.#E(this.#t===null?"demo":null),onLiftedWheel:this.#te,browser:o===null?null:{...o,loading:this.#i!==null},devices:n?{choice:this.#b,zoom:this.#w,onPick:s=>{this.#b=Pn(this.#b,s),this.requestUpdate()}}:null,uiComment:this.#H(t),actions:this.#z(t),canvasEvents:{click:this.#q,pointermove:this.#j,pointerleave:this.#F,wheel:this.#K,scroll:this.#x}})}}updated(){super.updated(),this.#Q(),this.#Z(),this.#X(),this.#C();const t=this.#e;if(t.kind==="composing"&&!this.#n.includes(t.target.previewId)){this.#p({kind:"dismiss"});return}this.#ee(),this.#Y(),this.#g&&(this.#g=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus()),this.#D();const r=t.kind==="composing"&&!this.#v;if(this.#v=t.kind==="composing",t.kind!=="composing"||this.#s===null)return;const i=this.renderRoot.querySelector(".comment-pop");i&&(this.#S.open(i,this.#s,xo,{placement:"right-start"}),r&&i.querySelector("textarea")?.focus({preventScroll:!0}))}#z(t){const r=Mt(t.state,this.#n),i=r.map(o=>o.screen.id).join(" "),n=r.length>0&&this.#d===i;return{groups:r,open:n,toggle:()=>n?this.#y(!1):this.#V(i),run:(o,s)=>this.#W(o,s)}}#V(t){this.#d=t,this.requestUpdate()}#y(t){this.#d!==null&&(this.#d=null,this.#m=t,this.requestUpdate())}#U(t){return t.classList.contains("actions-menu")||t.getAttribute("data-role")==="actions"}#Y(){const t=this.renderRoot.querySelector(".actions-menu"),r=this.renderRoot.querySelector('[data-role="actions"]');if(t===null){this.#u=null,this.#m&&r?.focus({preventScroll:!0}),this.#m=!1;return}t===this.#u||r===null||(this.#u=t,this.#S.open(t,r,Eo),t.querySelector('[role="menuitem"]')?.focus({preventScroll:!0}))}#W(t,r){this.#y(!0);const i=Mt(this.derivation.state,this.#n).find(d=>d.screen.id===t),n=i?.actions.find(d=>d.id===r);if(i===void 0||n===void 0)return;const s=this.#k().filter(d=>i.previewIds.includes(d.getAttribute("data-preview-id")??"")).map(d=>{const c=[...nn(d,n.fill??{}),...on(d,n.click??[])];return d.dispatchEvent(new CustomEvent("dpk-action",{bubbles:!0,detail:{id:n.id,screen:i.screen.id}})),c}),a=(s[0]??[]).filter(d=>s.every(c=>c.includes(d)));a.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: action "${n.id}" of screen "${i.screen.id}" found nothing on screen for: ${a.join(", ")}`)}#H(t){const r=this.#e,i=r.kind==="composing"?r.target:void 0,n=i?T(t.state,i.previewId)?.preview:void 0,o=i?vt(i):void 0;return{mode:r,pins:r.kind==="off"?[]:At(t.comments,this.#n),...i&&n?{targetLabel:Tt(n,i)}:{},notes:t.comments.filter(s=>s.target.type===re&&s.target.id===o).map(s=>tt(s)),composer:ni(this.locale),send:s=>this.#p(s),submit:s=>this.#B(s)}}#p(t){const r=ko(this.#e,t);r!==this.#e&&(this.#e=r,r.kind!=="composing"&&(this.#s=null),this.requestUpdate())}#B(t){const r=this.#e;if(r.kind!=="composing")return;this.dispatch({type:ei,target:{type:re,id:vt(r.target)},payload:{body:t}}).ok&&this.#p({kind:"submitted"})}#I(t){const r=t.composedPath(),i=r[0];if(i instanceof Element&&i.classList.contains("ui-catcher"))return this.#G(t.clientX,t.clientY);const n=r.find(o=>o instanceof Element&&o.parentElement===this&&o.hasAttribute("data-preview-id"));return!n||!(i instanceof Element)||!n.contains(i)?null:this.#_(i,n)}#G(t,r){const i=this.#P(t,r);return i===null?null:this.#_(i.element,i.wrapper)}#P(t,r){if(typeof document.elementsFromPoint!="function")return null;const i=this.#k();for(const n of document.elementsFromPoint(t,r)){const o=i.find(s=>s.contains(n));if(o!==void 0)return{element:n,wrapper:o}}return null}#_(t,r){const i=r.getAttribute("data-preview-id");if(!i)return null;const n=an(t,r),o=ln(n,r);return{element:n,target:{previewId:i,selector:o.selector,...o.text===void 0?{}:{text:o.text}}}}#k(){return Array.from(this.children).filter(t=>{const r=t.getAttribute("data-preview-id");return r!==null&&this.#n.includes(r)})}#q=t=>{if(this.#e.kind==="off")return;const r=this.#I(t);r&&(t.preventDefault(),t.stopPropagation(),this.#s=r.element,this.#p({kind:"pick",target:r.target}))};#j=t=>{if(this.#e.kind==="off")return;const r=this.#I(t);this.#$(".ui-hover",r?.element??null)};#F=()=>{this.#$(".ui-hover",null)};#K=t=>{const r=t.composedPath()[0];if(!(r instanceof Element)||!r.classList.contains("ui-catcher"))return;const i=this.renderRoot.querySelector(".canvas");let n=this.#P(t.clientX,t.clientY)?.element??null;for(;n!==null&&n!==i;){if(Ao(n,t.deltaX,t.deltaY)){t.preventDefault(),n.scrollBy({left:t.deltaX,top:t.deltaY});return}n=Io(n)}};#R=t=>{t.key!=="Escape"||t.defaultPrevented||(this.#e.kind!=="off"?this.#p({kind:"exit"}):this.#E(null))};#x=()=>{this.#e.kind!=="off"&&this.#D()};#D(){if(this.#e.kind==="off")return;this.#$(".ui-picked",this.#s);const t=this.renderRoot.querySelector(".canvas");if(!t)return;const r=this.renderRoot.querySelector(".ui-catcher");if(r){r.style.width=`${t.scrollWidth}px`,r.style.height=`${t.scrollHeight}px`;const i=[...this.renderRoot.querySelectorAll(".demo-controls")].map(n=>n.getBoundingClientRect());r.style.clipPath=Ji(r.getBoundingClientRect(),i)}for(const i of this.renderRoot.querySelectorAll(".ui-pin")){const n=this.#J(i.dataset.preview??""),s=(n?un(n,i.dataset.selector??""):null)?.getBoundingClientRect();if(!s||s.width===0&&s.height===0){i.hidden=!0;continue}const a=this.#O(t);i.hidden=!1,i.style.left=`${s.right-a.left}px`,i.style.top=`${s.top-a.top}px`}}#$(t,r){const i=this.renderRoot.querySelector(t),n=this.renderRoot.querySelector(".canvas");if(!i||!n)return;const o=r?.getBoundingClientRect();if(!o){i.hidden=!0;return}const s=this.#O(n);i.hidden=!1,i.style.left=`${o.left-s.left}px`,i.style.top=`${o.top-s.top}px`,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`}#O(t){const r=t.getBoundingClientRect();return{left:r.left+t.clientLeft-t.scrollLeft,top:r.top+t.clientTop-t.scrollTop}}#X(){const t=this.renderRoot.querySelector(".canvas");t===this.#a||this.#l===null||(this.#a!==null&&this.#l.unobserve(this.#a),this.#a=t,t!==null&&this.#l.observe(t))}#C(){const t=this.renderRoot.querySelector('.frame[data-window="device"]'),r=t?.closest(".canvas");if(!t||!(r instanceof HTMLElement))return;const i=getComputedStyle(t),n={width:parseFloat(i.getPropertyValue("--device-width")),height:parseFloat(i.getPropertyValue("--device-height"))},o=getComputedStyle(r),s=r.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),a=this.#t?.mode==="demo",d=a?So*2:0,c=Rn(n,{width:s-d,...a?{height:r.clientHeight-d}:{}});c!==this.#w&&(this.#w=c,this.requestUpdate())}#Z(){for(const t of this.querySelectorAll(":scope > [data-preview-id]"))for(const r of t.querySelectorAll("dialog"))qt(r),jt(this,r)}#M=t=>{const r=t.target;!(r instanceof HTMLDialogElement)||!r.open||Array.from(this.children).some(i=>i.hasAttribute("data-preview-id")&&i.contains(r))&&(qt(r),jt(this,r))};#J(t){return Array.from(this.children).find(r=>r.getAttribute("data-preview-id")===t)}#Q(){if(this.#T||this.renderRoot.querySelector(".stage")===null)return;this.#T=!0;const t=this.derivation.state,r=[];for(const i of Array.from(this.children)){const n=i.getAttribute("data-preview-id");if(n!==null)for(const o of i.querySelectorAll("a, [data-dpk-navigate]")){const s=Yi(t,{href:o.getAttribute("href"),navigate:o.getAttribute("data-dpk-navigate")});if(s===null)continue;const a=(o.textContent??"").replace(/\s+/g," ").trim().slice(0,40),d=o.getAttribute("data-dpk-navigate")??o.getAttribute("href")??"(no href)";r.push(` ${n}: <${o.tagName.toLowerCase()}> "${a}" \u2192 ${d} (${s})`)}}r.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: ${r.length} link(s) in the previews lead nowhere. Point each at the screen it opens (data-dpk-navigate="screen=\u2026"); a link that only moves the scenario on can name a step (data-dpk-navigate="step=\u2026") or a user story (data-dpk-navigate="story=\u2026"):
|
|
2559
2559
|
`+r.join(`
|
|
2560
2560
|
`))}#E(t){if(t===(this.#t?.mode??null))return;const r=this.renderRoot.querySelector(".stage"),i=this.#t?.height??r?.offsetHeight??0;this.#L(),t!==null&&(this.#t={mode:t,height:i}),this.#d=null,t!==null&&this.#e.kind==="composing"&&(ti(this.renderRoot.querySelector(".comment-pop")),this.#v=!1),this.requestUpdate()}#L(){this.#t=null,this.#f=null}#ee(){const t=this.renderRoot.querySelector(".stage");if(!(this.#t===null||!t||typeof t.showPopover!="function")&&t!==this.#f){this.#f=t;try{t.showPopover()}catch{}}}#te=t=>{const r=this.renderRoot.querySelector(".canvas");(r===null||!t.composedPath().includes(r))&&t.preventDefault()};#re(t,r){const i=rr(t.state,t.navigation);this.#r=this.#r===null?i===null?null:vn(i):tr(this.#r,{kind:"observe",page:i});const n=this.#r;if(n===null)return null;const o=pe(n),s=o?.kind!=="page"&&n.seen!==null;if(i===null&&!s)return null;const a=En(n)??i;return{view:dr(t.state,n,r,a),shortcuts:o?.kind==="new-tab"?Sn(t.state,a):[],switcher:this.#c,send:d=>this.#ne(d)}}#o(t){if(this.#r===null)return;const r=tr(this.#r,t);if(r===this.#r)return;this.#r=r;const i=pe(r);i?.kind==="page"&&this.#ie(i.page),this.requestUpdate()}#ie(t){this.navigate({screen:t.screen??null,preview:t.preview??null})}#ne(t){switch(t.kind){case"reload":this.#se();return;case"address":this.#oe(t.input);return;case"back":case"forward":case"new-tab":this.#c=!1,this.#o({kind:t.kind});return;case"switcher":this.#c=t.open,this.requestUpdate();return;case"activate":this.#c=!1,this.#g=t.focus===!0,this.#o({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#o({kind:t.kind,id:t.id});return;case"visit":this.#o({kind:"visit",page:t.page});return;default:return}}#oe(t){const r=this.#r;if(r===null)return;const i=this.derivation.state,n=dr(i,r,fe(this.locale)).url||"https://page.example.com/",o=kn(i,t,n);if(o!==null){this.#o({kind:"visit",page:o});return}const s=t.trim(),a=s.startsWith("/")?new URL(s,n).href:/^[a-z][a-z0-9+.-]*:\/\//i.test(s)?s:`https://${s}`;this.#o({kind:"unreachable",url:a})}#se(){if(this.#i!==null)return;const t=setTimeout(()=>{this.#i=null;for(const r of this.#k()){for(const i of r.querySelectorAll("form"))i.reset();for(const i of r.querySelectorAll("dialog"))i.close();r.scrollTop=0,r.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser .viewport")?.scrollTo?.({top:0}),this.requestUpdate()},$o);this.#i={page:this.#n.join(" "),timer:t},this.requestUpdate()}#N(){this.#i!==null&&(clearTimeout(this.#i.timer),this.#i=null)}#h=t=>{if(!this.#A||this.#e.kind!=="off"||this.#r===null||t.type==="auxclick"&&t.button!==1)return;const r=this.#ae(t);if(r===null)return;const i=t.metaKey||t.ctrlKey||t.button===1;if(!r.blank&&!i)return;t.preventDefault(),t.stopPropagation();const n=rr(this.derivation.state,Ae(this.hashFor(r.patch)));if(n===null){i||this.navigate(r.patch);return}this.#o({kind:"open-tab",entry:{kind:"page",page:n},background:i})};#ae(t){const r=t.composedPath();if(!r.some(n=>n instanceof Element&&n.parentElement===this&&n.hasAttribute("data-preview-id")))return null;for(const n of r){if(!(n instanceof Element)||n===this)break;const o=n.getAttribute("data-dpk-navigate"),s=n instanceof HTMLAnchorElement?n.getAttribute("href"):null,a=o??(s?.startsWith("#")?s:null);if(a===null)continue;const d=o!==null&&!o.includes("=")?`step=${o}`:a;return{patch:{...Ae(d)},blank:n.getAttribute("target")==="_blank"}}return null}#de(t){return Array.from(this.querySelectorAll("[data-preview-id]")).some(r=>r.getAttribute("data-preview-id")===t)}}const Rr=()=>{customElements.get("dpk-template-prototype")||customElements.define("dpk-template-prototype",_r)},Po=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePrototype:_r,VIEWPORT_MIN_HEIGHT:xr,VIEWPORT_WIDTH:kr,allScreens:W,allStepIds:wt,applyPrototypeAction:mt,definePrototypeElement:Rr,describePrototypeAction:$t,emptyPrototypeBase:ft,findActivity:z,findPreview:T,findScreen:N,findStep:$,findStory:E,flattenSteps:H,parsePrototypeBase:gt,prototypeAction:ne,prototypeActions:b,prototypeBaseSchema:lt,prototypeCommentTargets:Lt,prototypeDefinitionFor:Bt,prototypeMessages:fe,prototypePageHeading:Nt,prototypeTargetLabel:St,prototypeTitle:Ye,renderFrame:Ge,renderNav:ur,renderStage:Sr,resolvePrototypeNavigation:ye,serializePrototypeAction:Et},Symbol.toStringTag,{value:"Module"}));export{Rr as d,Po as i};
|