dev-process-kit 0.3.3 → 0.4.0

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.
Files changed (32) hide show
  1. package/dist/boards.js +1 -1
  2. package/dist/chunks/{shared-DvpWdbzP.js → shared-B2S6Vsb5.js} +1 -1
  3. package/dist/chunks/{shared-DstEY0ER.js → shared-BBKduY__.js} +1 -1
  4. package/dist/chunks/{shared-CLrs15X7.js → shared-BDAaq_FM.js} +1 -1
  5. package/dist/chunks/{shared-D7lvvzdN.js → shared-BWIla41c.js} +243 -239
  6. package/dist/chunks/{shared-DpOLnWXG.js → shared-Bj6Oqtla.js} +1 -1
  7. package/dist/chunks/shared-CBzul9Ae.js +1 -0
  8. package/dist/chunks/shared-CJZKj_HI.js +3 -0
  9. package/dist/chunks/{shared-CkaifYF3.js → shared-CKIn5p8J.js} +5 -5
  10. package/dist/chunks/{shared-B3gYWxeF.js → shared-CTxoriaS.js} +1 -1
  11. package/dist/chunks/shared-Cd0_rxlc.js +1883 -0
  12. package/dist/chunks/{shared-C9Mo56gs.js → shared-CkOyWfwZ.js} +1 -1
  13. package/dist/chunks/{shared-BAlmAjut.js → shared-DF9b2Hdv.js} +1 -1
  14. package/dist/chunks/{shared-CMe6_Sdn.js → shared-DRCtnrZO.js} +1 -1
  15. package/dist/chunks/{shared-DTIEx3lM.js → shared-DZNeJT2R.js} +1 -1
  16. package/dist/chunks/{shared-D-lFQPYy.js → shared-DnSwEx91.js} +1 -1
  17. package/dist/chunks/{shared-8-7i0SJv.js → shared-O0o2ls6e.js} +1 -1
  18. package/dist/chunks/{shared-ComyWGLL.js → shared-lPeFJij5.js} +1 -1
  19. package/dist/chunks/{shared-ZjHQZcxc.js → shared-zNs0yAfd.js} +5 -1
  20. package/dist/components.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/sync.js +1 -1
  23. package/dist/views/delegation-poker.js +1 -1
  24. package/dist/views/plain.js +1 -1
  25. package/dist/views/prototype.js +1 -1
  26. package/dist/views/slides.js +1 -1
  27. package/dist/views/task-board.js +1 -1
  28. package/dist/views/usm.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunks/shared-CVEzSR4J.js +0 -3
  31. package/dist/chunks/shared-DIYD6Tuj.js +0 -1
  32. package/dist/chunks/shared-MI4Xe0aq.js +0 -1868
@@ -0,0 +1,1883 @@
1
+ import{v as g,L as Pe,q as D,C as _,B as m,j as u,k as M,x as ve,M as on,A as De,m as sn,N as ot,O as rn,h as N,w as x,J as an,g as dn,d as y,o as b,e as oe,D as se,s as ln,p as cn,b as pn,f as k}from"./shared-CJZKj_HI.js";import{_ as un,g as st,G as Re,L as Y,K as hn,ag as c,a5 as h,aN as Ne,aO as Oe,al as vn,t as Ce,aq as rt,k as at,ay as q,aP as fn,u as dt,aQ as lt,z as mn,B as gn,aC as wn,aD as yn,a4 as bn,V as ct,a3 as kn,aR as xn,ai as En,aj as fe,ak as pt,C as Sn,aS as $n}from"./shared-BWIla41c.js";import{c as Tn,a as An}from"./shared-DRCtnrZO.js";import{m as In}from"./shared-BDAaq_FM.js";import{h as ut,d as ht,e as _n,f as Pn,a as vt,b as ft,i as mt,p as Dn,r as Rn,k as Nn,l as On,m as Cn,g as Mn,c as Ln,s as Un,n as gt,j as wt,t as Vn}from"./shared-CKIn5p8J.js";const zn=[["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"}]],Yn=[["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"}]],Bn=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]],Wn=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18"}]],Hn=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]],qn=[["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"}]],yt=["browser","native","mail","plain"],bt=["mobile","tablet","desktop","fluid"],Z=t=>"screen"in t,Fn=D({from:m(u()),to:m(u()),cc:m(u()),subject:m(u()),date:m(u())}),kt={id:_,kind:M(ve(yt),"browser"),viewport:M(ve(bt),"fluid"),label:m(u()),url:m(u()),mail:m(Fn)},Me=g(u(),Pe(t=>t.trim()!=="","a note needs some text")),xt=g(u(),on()),Gn=D({id:_,selector:g(u(),x(1)),text:m(u()),url:m(g(u(),x(1))),body:Me,createdAt:m(xt)}),Et='a preview `mail` envelope needs `"kind": "mail"`',St=g(D(kt),Pe(t=>t.mail===void 0||t.kind==="mail",Et)),$t=g(D({...kt,notes:m(N(Gn))}),Pe(t=>t.mail===void 0||t.kind==="mail",Et)),Tt=D({screen:_,preview:m(_)}),jn=De([Tt,D({material:St})]),Kn=De([Tt,D({material:$t})]),Xn=D({id:_,name:g(u(),x(1)),description:m(u()),actor:m(g(u(),x(1))),situation:m(g(u(),x(1))),panes:M(N(Kn),[])}),Jn=D({id:_,name:g(u(),x(1)),description:m(u()),actor:m(g(u(),x(1))),steps:M(N(Xn),[])}),Zn=D({id:_,name:g(u(),x(1)),description:m(u()),actor:m(g(u(),x(1))),stories:M(N(Jn),[])}),At=g(u(),x(1)),Qn=D({id:_,label:g(u(),x(1)),description:m(u()),fill:m(an(At,De([u(),dn()]))),click:m(N(At))}),eo=D({id:_,title:g(u(),x(1)),description:m(u()),previews:M(N($t),[]),actions:M(N(Qn),[])}),to=D({id:_,name:g(u(),x(1)),description:m(u()),actor:m(g(u(),x(1))),screens:M(N(eo),[])}),It=D({title:m(u()),baseUrl:m(u()),apps:M(N(to),[]),activities:M(N(Zn),[])}),_t=t=>t.flatMap(e=>Z(e)?[]:[e.material]),io=t=>{const e=new Set,i=new Set,n=a=>{for(const d of a){if(e.has(d.id))return`duplicate preview id "${d.id}": preview ids are global, they name a light DOM slot`;e.add(d.id);for(const l of d.notes??[]){if(i.has(l.id))return`duplicate note id "${l.id}": note ids are global`;i.add(l.id)}}return null},o=new Set,s=new Set;for(const a of t.apps){if(o.has(a.id))return`duplicate app id "${a.id}"`;o.add(a.id);for(const d of a.screens){if(s.has(d.id))return`duplicate screen id "${d.id}": screen ids are global`;s.add(d.id);const l=n(d.previews);if(l!==null)return l;const p=new Set;for(const v of d.actions){if(p.has(v.id))return`duplicate action id "${v.id}" on screen "${d.id}"`;p.add(v.id)}}}const r=new Set;for(const a of t.activities){if(r.has(a.id))return`duplicate activity id "${a.id}"`;r.add(a.id);const d=new Set;for(const l of a.stories){if(d.has(l.id))return`duplicate story id "${l.id}" in activity "${a.id}"`;d.add(l.id);const p=new Set;for(const v of l.steps){if(p.has(v.id))return`duplicate step id "${v.id}" in story "${l.id}"`;p.add(v.id);const f=n(_t(v.panes));if(f!==null)return f}}}return null},Pt=(t,e)=>{const i=new Map;for(const n of e.panes){if(!Z(n))continue;const o=t(n.screen);if(o===void 0)return`unknown screen "${n.screen}" on step "${e.id}": declare it under \`apps[].screens\``;if(n.preview!==void 0&&!o.includes(n.preview))return`preview "${n.preview}" on step "${e.id}" is not a rendition of screen "${n.screen}"`;const s=i.get(n.screen)??[];if(s.length>0&&(n.preview===void 0||s.includes(n.preview)||s.includes(void 0)))return`screen "${n.screen}" is shown twice on step "${e.id}": give each pane a different \`preview\``;i.set(n.screen,[...s,n.preview])}return null},no=t=>{const e=new Map(t.apps.flatMap(i=>i.screens.map(n=>[n.id,n.previews.map(o=>o.id)])));for(const i of t.activities.flatMap(n=>n.stories.flatMap(o=>o.steps))){const n=Pt(o=>e.get(o),i);if(n!==null)return n}return null},oo=(t,e)=>Pt(i=>L(t,i)?.screen.previews.map(n=>n.id),e),O="ui",Dt=t=>t.replaceAll(/[\s@]/g,encodeURIComponent),re=t=>{const e=t.text?.replaceAll('"',"'"),i=t.url===void 0?void 0:Dt(t.url);return`${t.previewId}/${t.selector}${e===void 0?"":` "${e}"`}${i===void 0?"":` @ ${i}`}`},Q=t=>{const e=t.indexOf("/");if(e<=0)return;const i=t.slice(0,e);if(!rn(_,i))return;const n=t.slice(e+1),o=/ @ ([^\s"]+)$/.exec(n),s=o?n.slice(0,o.index):n,r=/ "([^"]*)"$/.exec(s),a=(r?s.slice(0,r.index):s).trim();if(a!=="")return{previewId:i,selector:a,...r?.[1]===void 0?{}:{text:r[1]},...o?.[1]===void 0?{}:{url:o[1]}}},Rt=t=>{const e=sn(It,t),i=io(e)??no(e);if(i!==null)throw new Error(i);return e},Nt=()=>({apps:[],activities:[]}),B=t=>t.apps.flatMap(e=>e.screens.map(i=>({app:e,screen:i}))),L=(t,e)=>{if(e!==void 0)return B(t).find(i=>i.screen.id===e)},me=(t,e)=>e.panes.flatMap(i=>{const n=Z(i)?L(t,i.screen):void 0;return n?[n]:[]}),F=t=>_t(t.panes),so=(t,e)=>t.panes.some(i=>Z(i)&&i.screen===e),U=(t,e)=>{if(e!==void 0)return t.activities.find(i=>i.id===e)},C=(t,e)=>`${t}.${e}`,$=(t,e)=>{if(e===void 0)return;const i=ot(e,2);if(i){const[o,s]=i;if(o===void 0||s===void 0)return;const r=t.activities.find(d=>d.id===o),a=r?.stories.find(d=>d.id===s);return r&&a?{activity:r,story:a}:void 0}if(e.includes("."))return;const n=t.activities.flatMap(o=>o.stories.filter(s=>s.id===e).map(s=>({activity:o,story:s})));return n.length===1?n[0]:void 0},Ot=t=>{const e=t.lastIndexOf(".");return e>=0?t.slice(e+1):t},ae=t=>`${t.activity.id}.${t.story.id}.${t.step.id}`,ge=(t,e,i)=>`${t.id}.${e.id}.${i.id}`,S=(t,e)=>{if(e===void 0)return;const i=ot(e,3);if(i){const[o,s,r]=i;if(o===void 0||s===void 0||r===void 0)return;const a=t.activities.find(v=>v.id===o),d=a?.stories.find(v=>v.id===s),l=d?d.steps.findIndex(v=>v.id===r):-1,p=d&&l>=0?d.steps[l]:void 0;return a&&d&&p?{activity:a,story:d,step:p,stepIndex:l}:void 0}if(e.includes("."))return;const n=W(t).filter(o=>o.step.id===e);return n.length===1?n[0]:void 0},E=(t,e)=>{if(e!==void 0){for(const i of B(t)){const n=i.screen.previews.find(o=>o.id===e);if(n)return{owner:{kind:"screen",...i},preview:n}}for(const i of W(t)){const n=F(i.step).find(o=>o.id===e);if(n)return{owner:{kind:"step",...i},preview:n}}}},Ct=t=>[...B(t).flatMap(e=>e.screen.previews),...W(t).flatMap(e=>F(e.step))],Mt=t=>Ct(t).flatMap(e=>(e.notes??[]).map(i=>i.id)),W=t=>t.activities.flatMap(e=>e.stories.flatMap(i=>i.steps.map((n,o)=>({activity:e,story:i,step:n,stepIndex:o})))),Lt=t=>W(t).map(e=>e.step.id),Le=g(u(),x(1)),Ut=t=>{const e=ln(b({noteId:Le}),t.payload);return`${t.type}|${e.success?e.output.noteId:JSON.stringify(t.payload)}`},w={SET_ACTIVITY_NAME:y("SET_ACTIVITY_NAME","activity",b({name:g(u(),x(1))})),SET_ACTIVITY_DESCRIPTION:y("SET_ACTIVITY_DESCRIPTION","activity",b({description:u()})),SET_STORY_NAME:y("SET_STORY_NAME","story",b({name:g(u(),x(1))})),SET_STORY_DESCRIPTION:y("SET_STORY_DESCRIPTION","story",b({description:u()})),SET_STEP_NAME:y("SET_STEP_NAME","step",b({name:g(u(),x(1))})),SET_STEP_DESCRIPTION:y("SET_STEP_DESCRIPTION","step",b({description:u()})),SET_PREVIEW_KIND:y("SET_PREVIEW_KIND","preview",b({kind:ve(yt)})),SET_PREVIEW_VIEWPORT:y("SET_PREVIEW_VIEWPORT","preview",b({viewport:ve(bt)})),SET_PREVIEW_LABEL:y("SET_PREVIEW_LABEL","preview",b({label:u()})),REORDER_ACTIVITY:y("REORDER_ACTIVITY","activity",b({after:se(u())}),{mode:"sequence"}),REORDER_STORY:y("REORDER_STORY","story",b({after:se(u())}),{mode:"sequence"}),REORDER_STEP:y("REORDER_STEP","step",b({after:se(u())}),{mode:"sequence"}),MOVE_STORY:y("MOVE_STORY","story",b({toActivity:g(u(),x(1)),after:se(u())}),{mode:"sequence"}),MOVE_STEP:y("MOVE_STEP","step",b({toStory:g(u(),x(1)),after:se(u())}),{mode:"sequence"}),ADD_ACTIVITY:y("ADD_ACTIVITY","page",b({id:_,name:g(u(),x(1)),description:m(u())}),{dedupeKey:oe}),ADD_STORY:y("ADD_STORY","activity",b({id:_,name:g(u(),x(1)),description:m(u())}),{dedupeKey:oe}),ADD_STEP:y("ADD_STEP","story",b({id:_,name:g(u(),x(1)),description:m(u()),panes:m(N(jn))}),{dedupeKey:oe}),ADD_PREVIEW:y("ADD_PREVIEW","step",St,{dedupeKey:oe}),DELETE_ACTIVITY:y("DELETE_ACTIVITY","activity",b({})),DELETE_STORY:y("DELETE_STORY","story",b({})),DELETE_STEP:y("DELETE_STEP","step",b({})),DELETE_PREVIEW:y("DELETE_PREVIEW","preview",b({})),ADD_UI_NOTE:y("ADD_UI_NOTE",O,b({id:_,body:Me,createdAt:m(xt)}),{dedupeKey:oe}),SET_UI_NOTE_BODY:y("SET_UI_NOTE_BODY",O,b({noteId:Le,body:Me}),{dedupeKey:Ut}),DELETE_UI_NOTE:y("DELETE_UI_NOTE",O,b({noteId:Le}),{dedupeKey:Ut})},H={setActivityName:(t,e)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:t},payload:{name:e}}),setActivityDescription:(t,e)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:t},payload:{description:e}}),setStoryName:(t,e)=>({type:"SET_STORY_NAME",target:{type:"story",id:t},payload:{name:e}}),setStoryDescription:(t,e)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:t},payload:{description:e}}),setStepName:(t,e)=>({type:"SET_STEP_NAME",target:{type:"step",id:t},payload:{name:e}}),setStepDescription:(t,e)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:t},payload:{description:e}}),setPreviewViewport:(t,e)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:t},payload:{viewport:e}}),setPreviewKind:(t,e)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:t},payload:{kind:e}}),setPreviewLabel:(t,e)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:t},payload:{label:e}}),reorderActivity:(t,e)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:t},payload:{after:e}}),reorderStory:(t,e)=>({type:"REORDER_STORY",target:{type:"story",id:t},payload:{after:e}}),reorderStep:(t,e)=>({type:"REORDER_STEP",target:{type:"step",id:t},payload:{after:e}}),moveStep:(t,e,i)=>({type:"MOVE_STEP",target:{type:"step",id:t},payload:{toStory:e,after:i}}),moveStory:(t,e,i)=>({type:"MOVE_STORY",target:{type:"story",id:t},payload:{toActivity:e,after:i}}),addActivity:(t,e,i)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:t,name:e,...i===void 0?{}:{description:i}}}),addStory:(t,e,i,n)=>({type:"ADD_STORY",target:{type:"activity",id:t},payload:{id:e,name:i,...n===void 0?{}:{description:n}}}),addStep:(t,e,i,n)=>({type:"ADD_STEP",target:{type:"story",id:t},payload:{id:e,name:i,...n===void 0?{}:{panes:n}}}),addPreview:(t,e)=>({type:"ADD_PREVIEW",target:{type:"step",id:t},payload:{...e}}),deleteActivity:t=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:t},payload:{}}),deleteStory:t=>({type:"DELETE_STORY",target:{type:"story",id:t},payload:{}}),deleteStep:t=>({type:"DELETE_STEP",target:{type:"step",id:t},payload:{}}),deletePreview:t=>({type:"DELETE_PREVIEW",target:{type:"preview",id:t},payload:{}}),addUiNote:(t,e,i,n)=>({type:"ADD_UI_NOTE",target:{type:O,id:re(t)},payload:{id:e,body:i,...n===void 0?{}:{createdAt:n}}}),setUiNoteBody:(t,e,i)=>({type:"SET_UI_NOTE_BODY",target:{type:O,id:re(t)},payload:{noteId:e,body:i}}),deleteUiNote:(t,e)=>({type:"DELETE_UI_NOTE",target:{type:O,id:re(t)},payload:{noteId:e}})},Vt=(t,e)=>{const i=cn(w,e);if(i===null)return null;const n=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":return G(t,n,o=>({...o,name:i.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return G(t,n,o=>({...o,description:i.payload.description}));case"SET_STORY_NAME":return j(t,n,o=>({...o,name:i.payload.name}));case"SET_STORY_DESCRIPTION":return j(t,n,o=>({...o,description:i.payload.description}));case"SET_STEP_NAME":return we(t,n,o=>({...o,name:i.payload.name}));case"SET_STEP_DESCRIPTION":return we(t,n,o=>({...o,description:i.payload.description}));case"SET_PREVIEW_KIND":return ee(t,n,o=>({...o,kind:i.payload.kind}));case"SET_PREVIEW_VIEWPORT":return ee(t,n,o=>({...o,viewport:i.payload.viewport}));case"SET_PREVIEW_LABEL":return ee(t,n,o=>({...o,label:i.payload.label}));case"REORDER_ACTIVITY":{const{after:o}=i.payload,s=de(t.activities,n,o);return s===null?null:{...t,activities:s}}case"REORDER_STORY":{const{after:o}=i.payload,s=$(t,n);if(!s)return null;const r=o===null?null:$(t,o);if(o!==null&&(!r||r.activity!==s.activity))return null;const a=de(s.activity.stories,s.story.id,r?.story.id??null);return a===null?null:G(t,s.activity.id,d=>({...d,stories:a}))}case"REORDER_STEP":{const{after:o}=i.payload,s=S(t,n);if(!s)return null;const r=o===null?null:S(t,o);if(o!==null&&(!r||r.story!==s.story))return null;const a=de(s.story.steps,s.step.id,r?.step.id??null);return a===null?null:j(t,C(s.activity.id,s.story.id),d=>({...d,steps:a}))}case"MOVE_STORY":{const{toActivity:o,after:s}=i.payload,r=$(t,n);if(!r)return null;const a=t.activities.find(v=>v.id===o);if(!a)return null;const d=s===null?null:$(t,s);if(s!==null&&(!d||d.activity!==a))return null;const l=d?.story.id??null;if(r.activity.id===o){const v=de(r.activity.stories,r.story.id,l);return v===null?null:G(t,o,f=>({...f,stories:v}))}if(a.stories.some(v=>v.id===r.story.id))return null;const p=Ve(a.stories,r.story,l);return Ue(t,v=>v.id===r.activity.id?{...v,stories:v.stories.filter(f=>f.id!==Ot(n))}:v.id===o?{...v,stories:p}:v)}case"MOVE_STEP":{const{toStory:o,after:s}=i.payload,r=S(t,n);if(!r)return null;const a=$(t,o);if(!a)return null;const d=s===null?null:S(t,s);if(s!==null&&(!d||d.story!==a.story))return null;const l=d?.step.id??null;if(r.story===a.story){const v=de(r.story.steps,r.step.id,l);return v===null?null:j(t,o,f=>({...f,steps:v}))}if(a.story.steps.some(v=>v.id===r.step.id))return null;const p=Ve(a.story.steps,r.step,l);return Ue(t,v=>({...v,stories:v.stories.map(f=>f===r.story?{...f,steps:f.steps.filter(I=>I.id!==Ot(n))}:f===a.story?{...f,steps:p}:f)}))}case"ADD_ACTIVITY":{const o=i.payload;if(t.activities.some(r=>r.id===o.id))return t;const s={id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},stories:[]};return{...t,activities:[...t.activities,s]}}case"ADD_STORY":{const o=i.payload,s=t.activities.find(a=>a.id===n);if(!s)return null;if(s.stories.some(a=>a.id===o.id))return t;const r={id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},steps:[]};return G(t,n,a=>({...a,stories:[...a.stories,r]}))}case"ADD_STEP":{const o=i.payload,s=$(t,n)?.story;if(!s)return null;if(s.steps.some(d=>d.id===o.id))return t;const r=o.panes??[],a={id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},panes:r};return ro(t,a)?j(t,n,d=>({...d,steps:[...d.steps,a]})):null}case"ADD_PREVIEW":{const o=i.payload,s=S(t,n)?.step;return s?F(s).some(r=>r.id===o.id)?t:E(t,o.id)?null:we(t,n,r=>({...r,panes:[...r.panes,{material:o}]})):null}case"DELETE_ACTIVITY":{const o=n;return t.activities.some(s=>s.id===o)?{...t,activities:t.activities.filter(s=>s.id!==o)}:null}case"DELETE_STORY":{const o=$(t,n);return o?G(t,o.activity.id,s=>({...s,stories:s.stories.filter(r=>r.id!==o.story.id)})):null}case"DELETE_STEP":{const o=S(t,n);return o?j(t,C(o.activity.id,o.story.id),s=>({...s,steps:s.steps.filter(r=>r.id!==o.step.id)})):null}case"DELETE_PREVIEW":{const o=E(t,n);return o?zt(t,o.owner,s=>s.filter(r=>r.id!==o.preview.id)):null}case"ADD_UI_NOTE":{const{id:o,body:s,createdAt:r}=i.payload,a=Q(n),d=a===void 0?void 0:E(t,a.previewId);if(a===void 0||d===void 0)return null;if(d.preview.notes?.some(p=>p.id===o&&p.selector===a.selector&&p.url===a.url))return t;if(Mt(t).includes(o))return null;const l={id:o,selector:a.selector,...a.text===void 0?{}:{text:a.text},...a.url===void 0?{}:{url:a.url},body:s,...r===void 0?{}:{createdAt:r}};return ee(t,d.preview.id,p=>({...p,notes:[...p.notes??[],l]}))}case"SET_UI_NOTE_BODY":{const{noteId:o,body:s}=i.payload,r=Q(n),a=r===void 0?void 0:E(t,r.previewId);return a?.preview.notes?.some(d=>d.id===o)?ee(t,a.preview.id,d=>({...d,notes:(d.notes??[]).map(l=>l.id===o?{...l,body:s}:l)})):null}case"DELETE_UI_NOTE":{const{noteId:o}=i.payload,s=Q(n),r=s===void 0?void 0:E(t,s.previewId);return r?.preview.notes?.some(a=>a.id===o)?ee(t,r.preview.id,a=>{const d=(a.notes??[]).filter(v=>v.id!==o),{notes:l,...p}=a;return d.length===0?p:{...p,notes:d}}):null}default:return pn(i)}},Ue=(t,e)=>({...t,activities:t.activities.map(e)}),G=(t,e,i)=>{const n=e;return t.activities.some(o=>o.id===n)?Ue(t,o=>o.id===n?i(o):o):null},j=(t,e,i)=>{const n=$(t,e);if(!n)return null;const o=n.story.id;return G(t,n.activity.id,s=>({...s,stories:s.stories.map(r=>r.id===o?i(r):r)}))},we=(t,e,i)=>{const n=S(t,e);if(!n)return null;const o=n.step.id;return j(t,C(n.activity.id,n.story.id),s=>({...s,steps:s.steps.map(r=>r.id===o?i(r):r)}))},ee=(t,e,i)=>{const n=E(t,e);if(!n)return null;const o=n.preview.id;return zt(t,n.owner,s=>s.map(r=>r.id===o?i(r):r))},ro=(t,e)=>{const i=F(e).map(n=>n.id);return oo(t,e)===null&&new Set(i).size===i.length&&!i.some(n=>E(t,n))},zt=(t,e,i)=>{if(e.kind==="step")return we(t,ae(e),o=>{const s=new Map(i([...F(o)]).map(r=>[r.id,r]));return{...o,panes:o.panes.flatMap(r=>{if(Z(r))return[r];const a=s.get(r.material.id);return a?[{material:a}]:[]})}});const n=e.screen.id;return{...t,apps:t.apps.map(o=>o.id===e.app.id?{...o,screens:o.screens.map(s=>s.id===n?{...s,previews:i(s.previews)}:s)}:o)}},de=(t,e,i)=>{const n=t.findIndex(r=>r.id===e);if(n<0||i!==null&&!t.some(r=>r.id===i))return null;if(e===i)return[...t];const o=t[n];if(o===void 0)return null;const s=t.filter(r=>r.id!==e);return Ve(s,o,i)},Ve=(t,e,i)=>{const n=[...t],o=i===null?-1:n.findIndex(s=>s.id===i);return n.splice(o+1,0,e),n},Yt={"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"'},ao={"laptop-13":'13" laptop',"laptop-15":'15" laptop',"full-hd":"Full HD","monitor-27":'27" monitor',ultrawide:"Ultrawide"},lo={"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"},le=un({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:t=>`Reorder ${t}`,addTitle:t=>`Add ${t}`,toFront:"\u2192 To the front",afterName:t=>`\u2192 Right after "${t}"`,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:(t,e)=>`${t} \xB7 ${e}`,targetMissing:(t,e)=>`${t} \xB7 ${e} (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:t=>`Used by ${t}`,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",commentOnElement:"Comment on element",uiCommentPin:(t,e)=>`Comment ${t}: ${e}`,uiCommentAs:"What it is",uiCommentFeedback:"Review comment",uiCommentFeedbackHint:"Sent to the Agent as a message. Gone once it is reflected.",uiCommentNote:"Note",uiCommentNoteHint:"Kept on the element as part of the prototype, shown as a badge in the scenario view.",uiNoteSubmit:"Keep",uiNotes:t=>t===1?"1 note":`${t} notes`,uiNotesOn:t=>`Notes on ${t}`,uiNoteDate:t=>Bt("en-US",t),deleteUiNoteAria:"Delete the note",editUiNoteAria:"Edit the note",editUiNoteLabel:"Note",editUiNoteHint:"Ctrl/Cmd + Enter to save, Esc to close",saveUiNote:"Save",cancelUiNote:"Cancel",closeUiNotes:"Close",addUiNote:"Add a note",editUiNote:"Edit a note",deleteUiNote:"Delete a note",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:t=>`Profile: ${t}`,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:t=>Yt[t]??ao[t]??t,deviceZoom:t=>`Shown at ${t}% 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:t=>`${t} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:t=>`${t} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:t=>`\u2192 "${t}" \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:(t,e)=>`${t} \xB7 ${e}`,targetMissing:(t,e)=>`${t} \xB7 ${e} (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:t=>`\u5229\u7528\u8005: ${t}`,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",commentOnElement:"\u8981\u7D20\u306B\u30B3\u30E1\u30F3\u30C8",uiCommentPin:(t,e)=>`\u30B3\u30E1\u30F3\u30C8 ${t}: ${e}`,uiCommentAs:"\u30B3\u30E1\u30F3\u30C8\u306E\u7A2E\u985E",uiCommentFeedback:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",uiCommentFeedbackHint:"Agent \u3078\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u9001\u4FE1\u3055\u308C\u307E\u3059\u3002\u53CD\u6620\u3055\u308C\u308B\u3068\u6D88\u3048\u307E\u3059\u3002",uiCommentNote:"\u30E1\u30E2",uiCommentNoteHint:"\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306E\u4E00\u90E8\u3068\u3057\u3066\u8981\u7D20\u306B\u6B8B\u308A\u3001\u30B7\u30CA\u30EA\u30AA\u30D3\u30E5\u30FC\u3067\u30D0\u30C3\u30B8\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u307E\u3059\u3002",uiNoteSubmit:"\u6B8B\u3059",uiNotes:t=>`\u30E1\u30E2 ${t} \u4EF6`,uiNotesOn:t=>`${t} \u306E\u30E1\u30E2`,uiNoteDate:t=>Bt("ja-JP",t),deleteUiNoteAria:"\u30E1\u30E2\u3092\u524A\u9664",editUiNoteAria:"\u30E1\u30E2\u3092\u7DE8\u96C6",editUiNoteLabel:"\u30E1\u30E2",editUiNoteHint:"Ctrl/Cmd + Enter \u3067\u4FDD\u5B58\u3001Esc \u3067\u9589\u3058\u308B",saveUiNote:"\u4FDD\u5B58",cancelUiNote:"\u30AD\u30E3\u30F3\u30BB\u30EB",closeUiNotes:"\u9589\u3058\u308B",addUiNote:"\u30E1\u30E2\u3092\u8FFD\u52A0",editUiNote:"\u30E1\u30E2\u3092\u7DE8\u96C6",deleteUiNote:"\u30E1\u30E2\u3092\u524A\u9664",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:t=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${t}`,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:t=>Yt[t]??lo[t]??t,deviceZoom:t=>`\u53CE\u307E\u308B\u3088\u3046 ${t}% \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"}}),Bt=(t,e)=>new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e)),co=["scenario","app"],V="view",ce=t=>t[V]==="app"?"app":"scenario",Wt=t=>({[V]:t==="app"?"app":null}),pe=(t,e)=>t===void 0?`\u2192 "${e}"`:`"${t}" \u2192 "${e}"`,po=t=>({SET_ACTIVITY_NAME:(e,i)=>({title:t.renameActivity,tone:"update",body:pe(U(i,e.target.id)?.name,k(w.SET_ACTIVITY_NAME,e).name)}),SET_ACTIVITY_DESCRIPTION:(e,i)=>({title:t.updateActivityDescription,tone:"update",body:ye(U(i,e.target.id)?.description,k(w.SET_ACTIVITY_DESCRIPTION,e).description)}),SET_STORY_NAME:(e,i)=>({title:t.renameStory,tone:"update",body:pe($(i,e.target.id)?.story.name,k(w.SET_STORY_NAME,e).name)}),SET_STORY_DESCRIPTION:(e,i)=>({title:t.updateStoryDescription,tone:"update",body:ye($(i,e.target.id)?.story.description,k(w.SET_STORY_DESCRIPTION,e).description)}),SET_STEP_NAME:(e,i)=>({title:t.renameStep,tone:"update",body:pe(S(i,e.target.id)?.step.name,k(w.SET_STEP_NAME,e).name)}),SET_STEP_DESCRIPTION:(e,i)=>({title:t.updateStepDescription,tone:"update",body:ye(S(i,e.target.id)?.step.description,k(w.SET_STEP_DESCRIPTION,e).description)}),SET_PREVIEW_KIND:(e,i)=>({title:t.changePreviewKind,tone:"update",body:pe(E(i,e.target.id)?.preview.kind,k(w.SET_PREVIEW_KIND,e).kind)}),SET_PREVIEW_VIEWPORT:(e,i)=>({title:t.changePreviewViewport,tone:"update",body:pe(E(i,e.target.id)?.preview.viewport,k(w.SET_PREVIEW_VIEWPORT,e).viewport)}),SET_PREVIEW_LABEL:e=>({title:t.changePreviewLabel,tone:"update",body:`\u2192 "${k(w.SET_PREVIEW_LABEL,e).label}"`}),REORDER_ACTIVITY:e=>Ye(t,t.activityGroup,k(w.REORDER_ACTIVITY,e).after),REORDER_STORY:e=>Ye(t,t.storyGroup,k(w.REORDER_STORY,e).after),REORDER_STEP:e=>Ye(t,t.stepGroup,k(w.REORDER_STEP,e).after),MOVE_STORY:(e,i)=>({title:t.moveStory,tone:"move",body:`\u2192 ${U(i,k(w.MOVE_STORY,e).toActivity)?.name??k(w.MOVE_STORY,e).toActivity}`}),MOVE_STEP:(e,i)=>({title:t.moveStep,tone:"move",body:`\u2192 ${$(i,k(w.MOVE_STEP,e).toStory)?.story.name??k(w.MOVE_STEP,e).toStory}`}),ADD_ACTIVITY:e=>be(t,t.activityGroup,k(w.ADD_ACTIVITY,e).name),ADD_STORY:e=>be(t,t.storyGroup,k(w.ADD_STORY,e).name),ADD_STEP:e=>be(t,t.stepGroup,k(w.ADD_STEP,e).name),ADD_PREVIEW:e=>be(t,t.previewGroup,k(w.ADD_PREVIEW,e).label??k(w.ADD_PREVIEW,e).id),DELETE_ACTIVITY:(e,i)=>ke(t,U(i,e.target.id)?.name),DELETE_STORY:(e,i)=>ke(t,$(i,e.target.id)?.story.name),DELETE_STEP:(e,i)=>ke(t,S(i,e.target.id)?.step.name),DELETE_PREVIEW:(e,i)=>ke(t,E(i,e.target.id)?.preview.label),ADD_UI_NOTE:e=>({title:t.addUiNote,tone:"create",body:`+ "${ze(k(w.ADD_UI_NOTE,e).body)}"`}),SET_UI_NOTE_BODY:(e,i)=>{const{noteId:n,body:o}=k(w.SET_UI_NOTE_BODY,e);return{title:t.editUiNote,tone:"update",body:ye(jt(i,n)?.body,o)}},DELETE_UI_NOTE:(e,i)=>{const{noteId:n}=k(w.DELETE_UI_NOTE,e),o=jt(i,n);return{title:t.deleteUiNote,tone:"delete",body:o===void 0?t.unknownTarget:`\u2212 "${ze(o.body)}"`}}}),ye=(t,e)=>{const i=e.length>90?`${e.slice(0,90)}\u2026`:e;return t===void 0||t===""?`\u2192 "${i}"`:`"${ze(t)}" \u2192 "${i}"`},ze=t=>t.length>60?`${t.slice(0,60)}\u2026`:t,Ye=(t,e,i)=>({title:t.reorderTitle(e),tone:"move",body:i===null?t.toFront:t.afterName(i)}),be=(t,e,i)=>({title:t.addTitle(e),tone:"create",body:`+ "${i}"`}),ke=(t,e)=>({title:t.deleteTitle,tone:"delete",body:e===void 0?t.unknownTarget:`\u2212 "${e}"`}),Ht=(t,e,i,n)=>{const o=po(t),s=Object.hasOwn(o,e.type)?o[e.type]:void 0,r=s?s(e,n??i):{title:e.type,tone:"meta"};return{title:r.title,targetLabel:Ft(t,i,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},qt=t=>`${t.type} ${Y(t.target)} ${JSON.stringify(t.payload)}`,Ft=(t,e,i)=>{switch(i.type){case"activity":{const n=U(e,i.id);return n?t.targetLabel(t.activityGroup,n.name):t.targetMissing(t.activityGroup,i.id)}case"story":{const n=$(e,i.id)?.story;return n?t.targetLabel(t.storyGroup,n.name):t.targetMissing(t.storyGroup,i.id)}case"step":{const n=S(e,i.id)?.step;return n?t.targetLabel(t.stepGroup,n.name):t.targetMissing(t.stepGroup,i.id)}case"screen":{const n=L(e,i.id)?.screen;return n?t.targetLabel(t.screenGroup,n.title):t.targetMissing(t.screenGroup,i.id)}case"preview":{const n=E(e,i.id)?.preview;return n?t.targetLabel(t.previewGroup,n.label??n.id):t.targetMissing(t.previewGroup,i.id)}case"page":return t.targetLabel(t.pageGroup,qe(e));case O:{const n=Q(i.id),o=n?E(e,n.previewId)?.preview:void 0;return n&&o?t.targetLabel(t.uiGroup,Be(o,n)):t.targetMissing(t.uiGroup,i.id)}default:return t.targetLabel(i.type,i.id)}},Be=(t,e)=>{const i=e.text===void 0?e.selector:`"${e.text}"`;return`${t.label??t.id} \u203A ${i}`},Gt=(t,e)=>{const i=[];for(const n of t){if(n.target.type!==O)continue;const o=Q(n.target.id);!o||!e.includes(o.previewId)||i.push({id:n.id,previewId:o.previewId,selector:o.selector,...o.url===void 0?{}:{url:o.url},number:i.length+1,body:st(n)})}return i},uo=(t,e)=>e.flatMap(i=>{const n=E(t,i)?.preview,o=new Map;for(const s of n?.notes??[]){const r=JSON.stringify([s.selector,s.url??null]);o.set(r,[...o.get(r)??[],s])}return n===void 0?[]:[...o.values()].map(s=>{const{selector:r,url:a}=s[0];return{previewId:i,selector:r,...a===void 0?{}:{url:a},label:Be(n,{selector:r,...ho(s)}),notes:s}})}),ho=t=>{const e=[...t].reverse().find(i=>i.text!==void 0)?.text;return e===void 0?{}:{text:e}},jt=(t,e)=>Ct(t).flatMap(i=>i.notes??[]).find(i=>i.id===e),Kt=(t,e)=>Gt(t,e).length,vo=/^[a-z][a-z0-9+.-]*:/i,fo=t=>{const e=t.baseUrl?.trim(),i=hn(t.title??"");return`${(e?e.startsWith("http")?e:`https://${e}`:`https://${i==="item"?"page":i}.example.com`).replace(/\/+$/,"")}/`},xe=(t,e,i=null)=>{const n=fo(t),o=i==null||i===""?e.url:i;if(!o)return`${n}${e.id}`;if(vo.test(o))return o;try{return decodeURI(new URL(o,n).href)}catch{return o}},mo=t=>{switch(t.type){case"activity":return{[V]:null,activity:t.id};case"story":return{[V]:null,activity:null,story:t.id};case"step":return{[V]:null,activity:null,story:null,step:t.id};case"screen":return{screen:t.id};default:return null}},Xt=(t,e)=>{const i=t.kind==="screen"?[{type:"screen",id:t.screen.id}]:[{type:"activity",id:t.activity.id},{type:"story",id:C(t.activity.id,t.story.id)},...t.kind==="step"?[{type:"step",id:ae(t)}]:[]];for(const n of e?.panes??[])n.kind==="screen"&&i.push({type:"screen",id:n.screen.screen.id});return[...new Set(i.map(Y))].join(" ")},We=",",Jt=t=>t.preview?.split(We)??[],go=(t,e)=>t.kind===e.kind&&t.viewport===e.viewport,Zt=(t,e,i)=>{const n=e.find(s=>i.includes(s.id));if(n)return n;const o=i.flatMap(s=>E(t,s)?.preview??[]);return e.find(s=>o.some(r=>go(s,r)))??e[0]},Qt=(t,e,i,n)=>{const o=e.screen.previews,s=i===void 0?Zt(t,o,Jt(n)):o.find(a=>a.id===i);if(!s)return;const r=i===void 0&&o.length>1;return{kind:"screen",screen:e,preview:s,pinned:i!==void 0,tabs:r?o:[]}},ei=t=>({layout:t.length>1?"side-by-side":"single",panes:t,shown:t.map(e=>e.preview)}),ti=(t,e,i)=>e.panes.flatMap(n=>{if(!Z(n))return[{kind:"material",preview:n.material}];const o=L(t,n.screen),s=o&&Qt(t,o,n.preview,i);return s?[s]:[]}),He=(t,e,i)=>{if(e.kind==="screen"){const n=Qt(t,e,void 0,i);return ei(n?[n]:[])}return ei(ti(t,e.step,i))},wo=(t,e)=>t.panes.flatMap(i=>i.kind!=="screen"||i.tabs.length===0?[]:[i.tabs.some(n=>n.id===e)?e:i.preview.id]).join(We),ii=(t,e)=>{const i=new Map;for(const n of e){const o=E(t,n)?.owner;if(o?.kind!=="screen"||o.screen.actions.length===0)continue;const s=i.get(o.screen.id)??{screen:o.screen,previewIds:[]};s.previewIds.push(n),i.set(o.screen.id,s)}return[...i.values()].map(({screen:n,previewIds:o})=>({screen:n,previewIds:o,actions:n.actions}))},yo=(t,e)=>[...F(e),...me(t,e).flatMap(i=>i.screen.previews)],bo=["activity","story","step","screen","preview"],ko=(t,e,i)=>{switch(e){case"activity":return U(t,i)!==void 0;case"story":return $(t,i)!==void 0||t.activities.some(n=>n.stories.some(o=>o.id===i));case"step":return S(t,i)!==void 0||W(t).some(n=>n.step.id===i);case"screen":return L(t,i)!==void 0;case"preview":return E(t,i)!==void 0;default:return!1}},ni=(t,e)=>{let i;if(e.navigate!==null)i=e.navigate.includes("=")?e.navigate:`step=${e.navigate}`;else{const s=e.href?.trim()??"";if(s===""||s==="#"||s.toLowerCase().startsWith("javascript:"))return"no-destination";if(!s.startsWith("#"))return null;i=s}const n=Re(i),o=bo.filter(s=>n[s]!==void 0);return o.length===0?e.navigate===null?null:"unknown-target":o.every(s=>ko(t,s,n[s]??""))?null:"unknown-target"},xo=(t,e)=>{const i=e.mail??{},n=[{label:t.mailFrom,value:i.from},{label:t.mailTo,value:i.to},{label:t.mailCc,value:i.cc},{label:t.mailDate,value:i.date}].flatMap(r=>r.value===void 0||r.value.trim()===""?[]:[{label:r.label,value:r.value}]),o=i.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||i.from?.trim(),s=o?Array.from(o)[0]?.toUpperCase():void 0;return{...i.subject===void 0||i.subject.trim()===""?{}:{subject:i.subject},...o?{sender:o}:{},...s===void 0?{}:{initial:s},rows:n}},oi=(t,e)=>{const i=[];for(const n of e.activities){i.push({value:Y({type:"activity",id:n.id}),label:n.name,group:t.activityGroup});for(const o of n.stories){i.push({value:Y({type:"story",id:C(n.id,o.id)}),label:`${n.name} \u203A ${o.name}`,group:t.storyGroup});for(const s of o.steps)i.push({value:Y({type:"step",id:ge(n,o,s)}),label:`${o.name} \u203A ${s.name}`,group:t.stepGroup})}}for(const{app:n,screen:o}of B(e))i.push({value:Y({type:"screen",id:o.id}),label:`${n.name} \u203A ${o.title}`,group:t.screenGroup});return i},Eo=(t,e,i)=>{const n=te(e,i);if(n?.kind==="screen"){const{screen:o}=n;return{value:Y({type:"screen",id:o.id}),label:o.title,group:t.screenGroup}}return n?.kind!=="step"?null:{value:Y({type:"step",id:ae(n)}),label:n.step.name,group:t.stepGroup}},te=(t,e)=>{if(ce(e)==="app"){const s=L(t,e.screen);return s?{kind:"screen",...s}:void 0}const i=S(t,e.step);if(i)return{kind:"step",...i};const n=U(t,e.activity),o=n?.stories.find(s=>s.id===e.story||C(n.id,s.id)===e.story);return n&&o?{kind:"story",activity:n,story:o}:void 0},si=(t,e)=>{const i=(d,l)=>l===void 0?{title:d}:{actor:l,title:d};if(e.kind==="screen")return i(e.screen.title,e.app.actor);const{activity:n,story:o,step:s}=e,r=me(t,s),a=r.length===1?r[0]:void 0;return i(a?.screen.title??s.name,s.actor??o.actor??n.actor??a?.app.actor)},So=(t,e)=>{const i=e.actor??t.actor;return i===void 0?{title:e.name}:{actor:i,title:e.name}},qe=t=>t.title??"UX Prototype",ri=(t,e)=>(e?t.preview=e:delete t.preview,t),$o=(t,e,i)=>{if(!e)return;const n=ti(t,e,i).flatMap(o=>o.kind==="screen"&&!o.pinned?[o.preview.id]:[]);return n.length===0?void 0:n.join(We)},ai=(t,e)=>{const i=()=>{if(e.step===void 0&&e.story===void 0)return;const s=di(t,{...e,[V]:""}),r=S(t,s.step);return r&&me(t,r.step)[0]},n=L(t,e.screen)??i()??B(t)[0],o={...e,[V]:"app"};for(const s of["activity","story","step"])delete o[s];return n?o.screen=n.screen.id:delete o.screen,ri(o,n&&Zt(t,n.screen.previews,Jt(e))?.id)},To=(t,e,i)=>{const n=r=>so(r.step,e);if(i&&n(i))return i;const o=i?.story.steps??[],s=r=>{const a=o[r];return i&&a?{...i,step:a,stepIndex:r}:void 0};for(let r=(i?.stepIndex??0)+1;r<o.length;r+=1){const a=s(r);if(a&&n(a))return a}for(let r=(i?.stepIndex??0)-1;r>=0;r-=1){const a=s(r);if(a&&n(a))return a}return W(t).find(n)},di=(t,e)=>{const i=U(t,e.activity),n=e.story,o=i?.stories.find(z=>z.id===n||C(i.id,z.id)===n),s=o&&i?{activity:i,story:o}:$(t,n),r=e.step,d=(s&&r?S(t,`${C(s.activity.id,s.story.id)}.${r}`):void 0)??S(t,r),l=e.screen,p=l===void 0?void 0:To(t,l,d);if(l!==void 0&&!p&&L(t,l))return ai(t,{...e,[V]:"app"});const v=p??d,f=v?.activity??s?.activity??i??t.activities[0],I=v?.story??(s&&s.activity===f?s.story:void 0)??f?.stories[0],P=v?.step??I?.steps[0],T={...e};return delete T.screen,f?T.activity=f.id:delete T.activity,I&&f?T.story=$(t,I.id)?I.id:C(f.id,I.id):delete T.story,P&&I&&f?T.step=S(t,P.id)?P.id:ge(f,I,P):delete T.step,delete T[V],ri(T,$o(t,P,e))},Ao=["activity","story","step","screen"],Ee=(t,e)=>ce(e)==="app"?ai(t,e):di(t,e),Io=(t,e)=>{const i=e.screen.previews.find(s=>s.kind==="browser");if(!i)return;let n;try{n=new URL(xe(t,i),"https://page.example.com")}catch{return}const o=n.pathname.split("/").filter(s=>s!=="").map(s=>{try{return decodeURIComponent(s)}catch{return s}});return{origin:n.origin,segments:o}},li=()=>({screens:[],children:new Map}),Fe=(t,e,i)=>{const[n,...o]=t.children.entries();if(t.screens.length===0&&n&&o.length===0&&i!=="/"){const[s,r]=n;return Fe(r,`${e}/${s}`,`${i}/${s}`)}return{segment:e,path:i,screens:t.screens,children:[...t.children.entries()].map(([s,r])=>Fe(r,`/${s}`,`${i==="/"?"":i}/${s}`))}},_o=t=>{const e=new Map;for(const[i,n]of t){const o=e.get(n.origin)??li();e.set(n.origin,o);let s=o;for(const r of n.segments){const a=s.children.get(r)??li();s.children.set(r,a),s=a}s.screens.push(i)}return[...e.entries()].map(([i,n])=>({origin:i,root:Fe(n,"/","/")}))},Po=(t,e)=>{const i=e.screens.map(s=>({app:e,screen:s})),n=[],o=[];for(const s of i){const r=Io(t,s);r?n.push([s,r]):o.push(s)}return{app:e,screens:i,trees:_o(n),others:o}},ci=t=>t.apps.map(e=>Po(t,e)).filter(e=>e.screens.length>0),pi=(t,e)=>e?.kind!=="screen"?t[0]:t.find(i=>i.app.id===e.app.id)??t[0],Do=(t,e)=>{switch(e.type){case"activity":return U(t,e.id)!==void 0;case"story":return $(t,e.id)!==void 0;case"step":return S(t,e.id)!==void 0;case"screen":return L(t,e.id)!==void 0;case"preview":return E(t,e.id)!==void 0;case"page":return!0;case O:{const i=Q(e.id);return i!==void 0&&E(t,i.previewId)!==void 0}default:return!1}},ui=t=>{const e=le(t);return{kind:"view",name:"prototype",label:"UX Prototype",addable:!1,parseBase:Rt,emptyBase:Nt,actions:w,apply:Vt,hasTarget:Do,canonicalTarget:(i,n)=>{if(n.type==="step"){const o=S(i,n.id);return o?{...n,id:ae(o)}:n}if(n.type==="story"){const o=$(i,n.id);return o?{...n,id:C(o.activity.id,o.story.id)}:n}if(n.type==="preview"){const o=E(i,n.id);return o?{...n,id:o.preview.id}:n}return n},describe:(i,n,o)=>Ht(e,i,n,o),serialize:qt,resolveNavigation:Ee,navigationHierarchy:Ao,navigationFor:(i,n)=>mo(n),commentTargets:(i,n)=>oi(e,i),currentTarget:(i,n)=>Eo(e,i,n),title:qe}},Ro=(t,e)=>{const i=e.flatMap(n=>{const o=Math.max(n.left,t.left)-t.left,s=Math.max(n.top,t.top)-t.top,r=Math.min(n.right,t.right)-t.left-o,a=Math.min(n.bottom,t.bottom)-t.top-s;return r>0&&a>0?[`M${o} ${s}h${r}v${a}h-${r}Z`]:[]});return i.length===0?"none":`path(evenodd, 'M0 0H${t.width}V${t.height}H0Z ${i.join(" ")}')`},Se="data-dpk-modal",No=t=>{try{return t.matches(":modal")}catch{return!1}},hi=t=>{t.setAttribute(Se,""),t.open||t.show()},vi=t=>{Object.hasOwn(t,"showModal")||Object.defineProperty(t,"showModal",{configurable:!0,value:()=>hi(t)})},fi=(t,e)=>{if(!No(e))return;const i=n=>{n.target===e&&(n.stopImmediatePropagation(),t.removeEventListener("close",i,!0))};t.addEventListener("close",i,!0),e.close(),hi(e)},mi=(t,e)=>{try{return Array.from(t.querySelectorAll(e))}catch{return[]}},Oo=(t,e)=>{const i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value");i?.set?i.set.call(t,e):t.value=e},Co=t=>t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"),Mo=(t,e)=>{if(Co(t)){const n=typeof e=="boolean"?e:t.value===e;return typeof e=="string"&&!n?!1:(t.checked=n,!0)}const i=String(e);return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?(Oo(t,i),!0):(t.textContent=i,!1)},Lo=(t,e)=>{const i=[];for(const[n,o]of Object.entries(e)){const s=mi(t,n);s.length===0&&i.push(n);for(const r of s)Mo(r,o)&&(r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})))}return i},Uo=(t,e)=>{const i=[];for(const n of e){const[o]=mi(t,n);o instanceof HTMLElement?o.click():i.push(n)}return i},Vo='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',gi=/^-?[A-Za-z_][\w-]*$/,wi=40,yi=(t,e)=>{const i=t.closest(Vo);return i!==null&&i!==e&&e.contains(i)?i:t},$e=t=>{const e=t.replace(/\s+/g," ").trim();if(e==="")return;const i=Array.from(e);return i.length>wi?`${i.slice(0,wi).join("")}\u2026`:e},zo=t=>{const e=t.getAttribute("aria-label")??t.getAttribute("title");if(e)return $e(e);const i=t.tagName.toLowerCase();return $e(i==="input"||i==="textarea"||i==="select"?t.getAttribute("placeholder")??t.getAttribute("name")??"":i==="img"?t.getAttribute("alt")??"":t.textContent??"")},Yo=t=>{const e=t.getAttribute("id");if(e&&gi.test(e))return`#${e}`;const i=t.tagName.toLowerCase(),n=Array.from(t.classList).filter(a=>gi.test(a)).slice(0,2).map(a=>`.${a}`).join(""),o=t.parentElement,s=o?Array.from(o.children).filter(a=>a.tagName===t.tagName):[],r=s.length>1?`:nth-of-type(${s.indexOf(t)+1})`:"";return`${i}${n}${r}`},Bo=(t,e,i)=>{try{const n=t.querySelectorAll(e);return n.length===1&&n[0]===i}catch{return!1}},Ge=(t,e)=>{const i=[];let n=t;for(;n!==null&&n!==e;){const s=Yo(n);if(i.unshift(s),s.startsWith("#")||Bo(e,i.join(" > "),t))break;n=n.parentElement}const o=zo(t);return{selector:i.length===0?":scope":i.join(" > "),tag:t.tagName.toLowerCase(),...o===void 0?{}:{text:o}}},Wo=(t,e)=>{if(e===":scope")return t;try{return t.querySelector(e)}catch{return null}},bi=" >>> ",Te=t=>t.localName==="iframe",Ho=t=>typeof t=="object"&&t!==null&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE,qo=t=>t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t,ue=t=>{if(!Te(t))return null;try{return t.contentDocument??null}catch{return null}},je=t=>{try{return t.defaultView?.frameElement??null}catch{return null}},Ae=t=>t.body??t.documentElement,ki=t=>{const e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView?.getComputedStyle(t),o=v=>parseFloat(v??"")||0,s=o(n?.borderLeftWidth)+o(n?.paddingLeft),r=o(n?.borderTopWidth)+o(n?.paddingTop),a=s+o(n?.borderRightWidth)+o(n?.paddingRight),d=r+o(n?.borderBottomWidth)+o(n?.paddingBottom),l=t.contentWindow?.innerWidth??0,p=l>0&&e.width>0?e.width/(l+a):1;return{left:e.left+s*p,top:e.top+r*p,width:Math.max(0,e.width-a*p),height:Math.max(0,e.height-d*p),scale:p}},Fo=(t,e)=>{const i=Math.max(t.left,e.left),n=Math.max(t.top,e.top),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height);return{left:i,top:n,width:Math.max(0,o-i),height:Math.max(0,s-n)}},xi=(t,e)=>{const i=t.getBoundingClientRect();let n={left:i.left,top:i.top,width:i.width,height:i.height},o=t.ownerDocument;for(;o!==e;){const s=je(o);if(s===null||!Te(s))break;const r=ki(s);n=Fo({left:r.left+n.left*r.scale,top:r.top+n.top*r.scale,width:n.width*r.scale,height:n.height*r.scale},r),o=s.ownerDocument}return n},Go=(t,e,i)=>{let n=t,o={x:e,y:i};for(;;){const s=ue(n);if(s===null||!Te(n))return n;const r=ki(n);o={x:(o.x-r.left)/r.scale,y:(o.y-r.top)/r.scale};const a=s.elementFromPoint(o.x,o.y);if(a===null)return n;n=a}},jo=(t,e)=>{if(t.ownerDocument===e.ownerDocument)return yi(t,e);const i=Ae(t.ownerDocument);return i.contains(t)&&t!==i?yi(t,i):i},Ko=(t,e)=>{const i=t.ownerDocument===e.ownerDocument?null:t,n=[];let o=t;for(;o.ownerDocument!==e.ownerDocument;){const a=Ae(o.ownerDocument);n.unshift(o===a||!a.contains(o)?":scope":Ge(o,a).selector);const d=je(o.ownerDocument);if(d===null)break;o=d}const s=Ge(o,e);if(i===null)return s;const r=Ge(i,Ae(i.ownerDocument));return{selector:[s.selector,...n].join(bi),tag:r.tag,...r.text===void 0?{}:{text:r.text}}},Ei=(t,e)=>{const i=e.split(bi);let n=t;for(const[o,s]of i.entries()){const r=Wo(n,s.trim());if(r===null||o===i.length-1)return r;const a=ue(r);if(a===null)return null;n=Ae(a)}return null},Xo=(t,e)=>{try{const i=new URL(t),n=new URL(e);if(i.origin!==n.origin)return t;const o=n.pathname.slice(0,n.pathname.lastIndexOf("/")+1);return`${i.pathname.startsWith(o)?i.pathname.slice(o.length):i.pathname}${i.search}${i.hash}`}catch{return t}},Si=(t,e)=>{const i=t.ownerDocument;if(i!==e)return Xo(i.URL,e.baseURI)},$i=(t,e)=>{const i=Ee(t,e),n=te(t,i);if(n?.kind!=="screen")return null;const[o]=He(t,n,i).shown;return o?.kind!=="browser"?null:{screen:n.screen.id,preview:o.id}},Ie=(t,e)=>{const i=te(t,Ee(t,{[V]:"app",...e}));return i?.kind==="screen"?i:void 0},Jo=(t,e,i,n=new Map)=>{const o=vt(e,i);if(o===null)return null;const s=ft(o);for(const{screen:r}of B(t))for(const a of r.previews){if(a.kind!=="browser")continue;const d=vt(xe(t,a,n.get(a.id)),i);if(d!==null&&ft(d)===s)return{screen:r.id,preview:a.id}}return null},Zo=(t,e,i)=>e===void 0||e.kind==="new-tab"?i.newTab:e.kind==="unreachable"?ut(e.url):Ie(t,e.page)?.screen.title??i.newTab,Ti=(t,e,i)=>{if(e===void 0||e.kind==="new-tab")return"";if(e.kind==="unreachable")return e.url;const n=Ie(t,e.page)?.screen.previews.find(o=>o.id===e.page.preview);return n===void 0?"":xe(t,n,i.get(n.id))},Ai=t=>{const e=ht(t);for(let i=e.index;i>=0;i-=1){const n=e.history[i];if(n?.kind==="page")return n.page}for(const i of t.tabs){const n=i.history[i.index];if(n?.kind==="page")return n.page}},Qo=(t,e)=>e===void 0?void 0:Ie(t,e)?.app.actor,Ii=(t,e,i,n=null,o=new Map)=>{const s=ht(e),r=s.history[s.index],a=Qo(t,Ai(e)??n??void 0);return{tabs:e.tabs.map(d=>({id:d.id,title:Zo(t,d.history[d.index],i),url:Ti(t,d.history[d.index],o),active:d.id===s.id})),entry:r,url:Ti(t,r,o),canBack:Pn(e),canForward:_n(e),...a===void 0?{}:{profile:a}}},es=t=>Ai(t)??null,ts=(t,e)=>{const i=e===null?void 0:Ie(t,e),n=pi(ci(t),i),o=[],s=(r,a)=>{for(const{screen:d}of a.screens){const l=d.previews.find(p=>p.kind==="browser");l!==void 0&&o.push({title:d.title,url:`${r}${a.path==="/"?"":a.path}`,page:{screen:d.id,preview:l.id}})}for(const d of a.children)s(r,d)};for(const r of n?.trees??[])s(ut(r.origin),r.root);return o},A=(t,e,i,n)=>({id:e,deviceClass:t,width:i,height:n}),_i=[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)],is={phone:A("phone","iphone-16",393,852),tablet:A("tablet","ipad-pro-11",834,1194),desktop:A("desktop","laptop-13",1280,800)},Pi=t=>t==="mobile"?"phone":t==="tablet"?"tablet":"desktop",ns=t=>t!=="plain",Di=t=>_i.filter(e=>e.deviceClass===t),os=(t,e)=>{const i=Pi(t),n=e[i];return Di(i).find(o=>o.id===n)??is[i]},ss=(t,e)=>{const i=_i.find(n=>n.id===e);return i===void 0||t[i.deviceClass]===e?t:{...t,[i.deviceClass]:e}},rs=(t,e)=>`${t.deviceName(e.id)} \xB7 ${e.width}\xD7${e.height}`,as=(t,e)=>{const i=[1,e.width/t.width];e.height!==void 0&&i.push(e.height/t.height);const n=Math.min(...i);return!Number.isFinite(n)||n<=0?1:Math.max(.1,Math.floor(n*100)/100)},Ri="--dpk-frame-height";class ds{#e;#d=new Map;constructor(e){this.#e=e}sync(e){const i=new Set;for(const n of e)Te(n)&&i.add(n);for(const[n,o]of this.#d)i.has(n)||(n.removeEventListener("load",o.onLoad),o.detach(),this.#d.delete(n));for(const n of i){if(this.#d.has(n))continue;const o={onLoad:()=>{o.detach(),o.detach=this.#t(n)},detach:()=>{}};this.#d.set(n,o),n.addEventListener("load",o.onLoad);const s=ue(n);s!==null&&s.readyState==="complete"&&s.URL!=="about:blank"&&o.onLoad()}}disconnect(){this.sync([])}#t(e){const i=ue(e),n=i?.defaultView;if(i===null||n===null||n===void 0)return()=>{};const o=()=>this.#e.changed(),s=()=>{const p=Math.ceil(i.documentElement.getBoundingClientRect().height);p>0&&e.style.setProperty(Ri,`${p}px`),o()},r=p=>this.#e.click(p,e),a=p=>this.#e.keydown(p);n.addEventListener("click",r),n.addEventListener("auxclick",r),i.addEventListener("keydown",a),i.addEventListener("scroll",o,!0),n.addEventListener("resize",o),n.addEventListener("hashchange",o),n.addEventListener("popstate",o);const d=new n.MutationObserver(o);d.observe(i.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});const l=typeof n.ResizeObserver=="function"?new n.ResizeObserver(s):null;return l?.observe(i.documentElement),s(),this.#e.loaded(e,i),()=>{n.removeEventListener("click",r),n.removeEventListener("auxclick",r),i.removeEventListener("keydown",a),i.removeEventListener("scroll",o,!0),n.removeEventListener("resize",o),n.removeEventListener("hashchange",o),n.removeEventListener("popstate",o),d.disconnect(),l?.disconnect()}}}const Ni=(t,e,i)=>{const{state:n,navigation:o}=t,s=te(n,o),r=ce(o);return c`
2
+ <div class="nav">
3
+ ${ps(t,e,r)}
4
+ ${r==="app"?us(t,e,s,i.app):s!==void 0&&s.kind!=="screen"?fs(t,e,s,i):c`<p class="nav-empty">${e.noActivityBefore}<code>activities</code>${e.noActivityAfter}</p>`}
5
+ </div>
6
+ `},ls={scenario:"viewScenario",app:"viewApp"},cs={scenario:"viewScenarioHint",app:"viewAppHint"},ps=(t,e,i)=>c`<nav class="dpk-segmented view-switch" aria-label=${e.viewLabel}>
7
+ ${co.map(n=>c`<a
8
+ class="view-option"
9
+ href=${t.hashFor(Wt(n))}
10
+ title=${e[cs[n]]}
11
+ aria-current=${n===i?"page":h}
12
+ data-view=${n}
13
+ >${e[ls[n]]}</a
14
+ >`)}
15
+ </nav>`,us=(t,e,i,n)=>{const o=i?.kind==="screen"?i:void 0,s=ci(t.state),r=pi(s,i),a={context:t,currentId:o?.screen.id},d=r?.others??[];return c`
16
+ ${s.length>1&&r?hs(t,e,s,r,n):h}
17
+ ${s.length===1&&r?.app.description?c`<p class="app-description">${r.app.description}</p>`:h}
18
+ <div class="steps-head">
19
+ <span class="dpk-label">${e.appScreens}</span>
20
+ <span class="dpk-label">${r?.screens.length??0}</span>
21
+ </div>
22
+ <p class="app-hint">${e.appScreensHint}</p>
23
+ ${r?.trees.map(l=>c`<section class="app-tree">
24
+ <h3 class="app-origin">${vs(l.origin)}</h3>
25
+ <ul class="tree">
26
+ ${Oi(a,l.root,0)}
27
+ </ul>
28
+ </section>`)}
29
+ ${d.length===0?h:c`<section class="app-group">
30
+ ${(r?.trees.length??0)>0?c`<h3 class="app-group-heading">${e.appOutsideBrowser}</h3>`:h}
31
+ <ul class="steps app-screens">
32
+ ${d.map(l=>{const p=Ci(a,l);return c`<li class="step-row" data-current=${String(p)}>
33
+ <a class="step-link" href=${Li(t,l)} aria-current=${p?"page":h}>
34
+ <span class="step-name">${l.screen.title}</span>
35
+ ${Ui(t,l)}
36
+ </a>
37
+ </li>`})}
38
+ </ul>
39
+ </section>`}
40
+ ${o?.screen.description?c`<div class="detail">
41
+ <div class="screen-description dpk-prose">${Ne(Oe(o.screen.description))}</div>
42
+ </div>`:h}
43
+ `},hs=(t,e,i,n,o)=>c`<div class="field">
44
+ <span class="dpk-label">${e.appSelectLabel}</span>
45
+ ${o.render({options:i.map((s,r)=>({value:String(r),label:s.app.name})),value:String(i.indexOf(n)),onChange:s=>{const r=i[Number(s)]?.screens[0];r&&t.navigate(Mi(r))},ariaLabel:e.appSelectLabel})}
46
+ ${n.app.description?c`<p class="app-description">${n.app.description}</p>`:h}
47
+ </div>`,Oi=(t,e,i)=>c`<li
48
+ class="tree-node"
49
+ >
50
+ ${e.screens.length===0&&i===0?h:e.screens.length===0?c`<div class="tree-row" data-depth=${String(i)} data-current="false">
51
+ <span class="tree-link" title=${e.path}><code class="tree-path">${e.segment}</code></span>
52
+ </div>`:e.screens.map(n=>{const o=Ci(t,n);return c`<div class="tree-row" data-depth=${String(i)} data-current=${String(o)}>
53
+ <a
54
+ class="tree-link"
55
+ href=${Li(t.context,n)}
56
+ title=${e.path}
57
+ aria-current=${o?"page":h}
58
+ >
59
+ <code class="tree-path">${e.segment}</code>
60
+ <span class="tree-title">${n.screen.title}</span>
61
+ ${Ui(t.context,n)}
62
+ </a>
63
+ </div>`})}
64
+ ${e.children.length>0?c`<ul class="tree">
65
+ ${e.children.map(n=>Oi(t,n,i+1))}
66
+ </ul>`:h}
67
+ </li>`,Ci=(t,e)=>e.screen.id===t.currentId,Mi=t=>({screen:t.screen.id,preview:null}),Li=(t,e)=>t.hashFor(Mi(e)),Ui=(t,e)=>{const i=t.commentCount({type:"screen",id:e.screen.id})+Kt(t.comments,e.screen.previews.map(n=>n.id));return i>0?c`<span class="step-note">${i}</span>`:h},vs=t=>t.replace(/^[a-z][a-z0-9+.-]*:\/\//i,""),fs=(t,e,i,n)=>{const{state:o}=t,{activity:s,story:r}=i,a=r.steps,d=i.kind==="step"?i.step:void 0,l=i.kind==="step"?ae(i):void 0;return c`
68
+ <div class="field">
69
+ <span class="dpk-label">Activity</span>
70
+ ${n.activity.render({options:o.activities.map(p=>({value:p.id,label:p.name})),value:s.id,onChange:p=>t.navigate({activity:p,story:null,step:null}),ariaLabel:"Activity"})}
71
+ </div>
72
+ <div class="field">
73
+ <span class="dpk-label">User Story</span>
74
+ ${n.story.render({options:s.stories.map(p=>({value:p.id,label:p.name})),value:r.id,onChange:p=>t.navigate({activity:s.id,story:p,step:null}),ariaLabel:"User Story"})}
75
+ </div>
76
+ <div class="steps-head">
77
+ <span class="dpk-label">Step</span>
78
+ <span class="dpk-label">${a.length}</span>
79
+ </div>
80
+ <ol class="steps">
81
+ ${vn(a,p=>ge(s,r,p),(p,v)=>{const f=ge(s,r,p),I=t.commentCount({type:"step",id:f})+Kt(t.comments,yo(o,p).map(P=>P.id));return c`
82
+ <li class="step-row" data-current=${String(p.id===d?.id)}>
83
+ <a class="step-link" href=${t.hashFor({activity:s.id,story:r.id,step:p.id})}>
84
+ <span class="step-index">${String(v+1).padStart(2,"0")}</span>
85
+ <span class="step-name">${p.name}</span>
86
+ ${I>0?c`<span class="step-note">${I}</span>`:h}
87
+ </a>
88
+ <span class="row-tools">
89
+ <button
90
+ class="dpk-icon-btn"
91
+ type="button"
92
+ aria-label=${e.deleteStepAria}
93
+ @click=${()=>t.dispatch(H.deleteStep(f))}
94
+ >
95
+ ${Ce()}
96
+ </button>
97
+ </span>
98
+ </li>
99
+ `})}
100
+ </ol>
101
+ <button class="dpk-btn" type="button" @click=${()=>gs(t,e,C(s.id,r.id))}>
102
+ ${e.addStepButton}
103
+ </button>
104
+ ${d?mt(l,c`<div class="detail">
105
+ <div class="detail-row">
106
+ <span class="dpk-label">${e.stepNameLabel}</span>
107
+ <span class="detail-value">
108
+ <dpk-inline-edit
109
+ wrap
110
+ .value=${d.name}
111
+ .label=${e.stepNameLabel}
112
+ @dpk-commit=${rt(p=>t.dispatch(H.setStepName(l??d.id,p)))}
113
+ ></dpk-inline-edit>
114
+ </span>
115
+ </div>
116
+ <div class="detail-row">
117
+ <span class="dpk-label">${e.descriptionLabel}</span>
118
+ <span class="detail-value">
119
+ <dpk-inline-edit
120
+ multiline
121
+ markdown
122
+ .value=${d.description??""}
123
+ .placeholder=${e.descriptionPlaceholder}
124
+ .label=${e.descriptionLabel}
125
+ @dpk-commit=${rt(p=>t.dispatch(H.setStepDescription(l??d.id,p)))}
126
+ ></dpk-inline-edit>
127
+ </span>
128
+ </div>
129
+ ${ms(t,e,d)}
130
+ </div>`):h}
131
+ `},ms=(t,e,i)=>{const n=me(t.state,i);return n.length===0?h:c`<div class="detail-row">
132
+ <span class="dpk-label">${e.screenGroup}</span>
133
+ <span class="detail-value">
134
+ ${n.map(({app:o,screen:s})=>c`<div class="step-screen-entry">
135
+ <a
136
+ class="step-screen"
137
+ href=${t.hashFor({...Wt("app"),screen:s.id})}
138
+ title=${e.openInApp}
139
+ >${o.name} › ${s.title}</a
140
+ >
141
+ ${s.description?c`<div class="screen-description dpk-prose">
142
+ ${Ne(Oe(s.description))}
143
+ </div>`:h}
144
+ </div>`)}
145
+ </span>
146
+ </div>`},gs=(t,e,i)=>{const n=at("new-step",Lt(t.state));t.dispatch(H.addStep(i,n,e.newStepName)).ok&&t.navigate({story:i,step:n})},ws=q(qn),ys=q(fn),Vi=(t,e,i="bar")=>c`<button
147
+ class=${i==="demo"?"demo-control actions-toggle":"dpk-btn actions-toggle"}
148
+ type="button"
149
+ data-role="actions"
150
+ aria-haspopup="menu"
151
+ aria-expanded=${String(e.open)}
152
+ title=${t.actionsHint}
153
+ @click=${e.toggle}
154
+ >
155
+ ${ws()} ${t.actions} ${ys()}
156
+ </button>`,bs=t=>{const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const i=[...e.querySelectorAll('[role="menuitem"]')],n=i.findIndex(a=>a===t.composedPath()[0]),o=t.key==="ArrowDown"?1:t.key==="ArrowUp"?-1:0,s=t.key==="Home"?0:t.key==="End"?i.length-1:o===0?-1:(n+o+i.length)%i.length,r=i[s];r!==void 0&&(t.preventDefault(),r.focus())},ks=(t,e)=>{if(!e.open||e.groups.length===0)return h;const i=e.groups.length>1;return c`<div
157
+ class="comment-pop actions-menu"
158
+ popover="manual"
159
+ role="menu"
160
+ aria-label=${t.actions}
161
+ @keydown=${bs}
162
+ >
163
+ ${e.groups.map(n=>c`<div class="actions-group" role="group" aria-label=${n.screen.title}>
164
+ ${i?c`<span class="actions-group-title" aria-hidden="true">${n.screen.title}</span>`:h}
165
+ ${n.actions.map(o=>c`<button
166
+ class="actions-item"
167
+ type="button"
168
+ role="menuitem"
169
+ data-action=${o.id}
170
+ @click=${()=>e.run(n.screen.id,o.id)}
171
+ >
172
+ <span class="actions-label">${o.label}</span>
173
+ ${o.description===void 0?h:c`<span class="actions-description">${o.description}</span>`}
174
+ </button>`)}
175
+ </div>`)}
176
+ </div>`},zi=(t,e,i="bar")=>{const n=e.mode.kind!=="off";return c`<button
177
+ class=${`${i==="demo"?"demo-control":n?"dpk-btn dpk-btn--accent":"dpk-btn"} ui-comment-toggle`}
178
+ type="button"
179
+ aria-pressed=${n?"true":"false"}
180
+ title=${t.uiCommentHint}
181
+ @click=${()=>e.send({kind:"toggle"})}
182
+ >
183
+ ${dt()} ${t.uiComment}
184
+ </button>`},xs=(t,e)=>e.mode.kind==="off"?h:c`<p class="ui-comment-hint" role="status">${dt()} ${t.uiCommentHint}</p>`,Es=(t,e)=>e.mode.kind==="off"?h:c`<div class="ui-layer" aria-hidden="true">
185
+ <div class="ui-catcher"></div>
186
+ <div class="ui-box ui-hover" hidden></div>
187
+ <div class="ui-box ui-picked" hidden></div>
188
+ ${e.pins.map(i=>c`<span
189
+ class="ui-pin"
190
+ hidden
191
+ data-preview=${i.previewId}
192
+ data-selector=${i.selector}
193
+ data-url=${i.url??h}
194
+ title=${t.uiCommentPin(i.number,i.body)}
195
+ >${i.number}</span
196
+ >`)}
197
+ </div>`,Ss=t=>t==="feedback"||t==="note",$s=(t,e)=>{const i=e.mode;if(i.kind!=="composing")return h;const n=Dn(i.body,e.notes,{key:`ui:${i.target.previewId}/${i.target.selector}`,...e.targetLabel===void 0?{}:{label:e.targetLabel},choice:{label:t.uiCommentAs,value:i.as,options:[{value:"feedback",label:t.uiCommentFeedback,hint:t.uiCommentFeedbackHint},{value:"note",label:t.uiCommentNote,hint:t.uiCommentNoteHint}]},...i.as==="note"?{submitLabel:t.uiNoteSubmit}:{}});return c`${mt(`${i.target.previewId}/${i.target.selector}`,Rn(e.composer,n,o=>{o.kind==="input"?e.send({kind:"input",body:o.body}):o.kind==="comment"?e.submit(o.body):o.kind==="choose"?Ss(o.value)&&e.send({kind:"choose",as:o.value}):e.send({kind:"dismiss"})}))}`},Yi=(t,e)=>c`<div class="demo-controls">
198
+ ${e.actions.groups.length>0?Vi(t,e.actions,"demo"):h}
199
+ ${zi(t,e.uiComment,"demo")}
200
+ <button class="demo-control demo-exit" type="button" title=${t.exitDemo} @click=${e.onExit}>
201
+ ${Ce()} ${t.exitDemo} <kbd>Esc</kbd>
202
+ </button>
203
+ </div>`,Bi={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},Wi={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},Ts={browser:0,native:22,mail:0,plain:0},Hi=(t,e,i)=>{const n=`--frame-width:${Bi[e]};--frame-min-height:${Wi[e]}`;if(i?.kind!=="device")return n;const o=Ts[t];return`${n};--device-width:${i.width+o}px;--device-height:${i.height+o}px;zoom:${i.zoom}`},As=t=>({back:t.browserBack,forward:t.browserForward,reload:t.browserReload,address:t.browserAddress,tabs:t.browserTabs,newTab:t.newTab,closeTab:t.closeTab,profile:t.browserProfile,guest:t.browserGuest,shortcuts:t.newTabShortcuts,unreachableTitle:t.unreachableTitle,unreachableBody:t.unreachableBody}),Is=(t,e)=>c`<slot name=${`preview:${t.id}`}></slot> ${e?h:c`<div class="frame-placeholder">
204
+ <span class="dpk-label">light dom preview</span>
205
+ <code>&lt;div slot="preview" data-preview-id="${t.id}"&gt;</code>
206
+ </div>`}`,_s=(t,e,i)=>{const{preview:n,viewport:o}=i,s={view:i.view,phone:o==="mobile",switcher:i.switcher,shortcuts:i.shortcuts.map(r=>({...r,href:t.hashFor(r.page)})),labels:As(e),...i.demo===void 0?{}:{extra:Yi(e,i.demo)},send:i.send};return c`<figure
207
+ class="frame browser"
208
+ data-kind="browser"
209
+ data-viewport=${o}
210
+ ?data-loading=${i.loading}
211
+ ?data-empty=${n!==void 0&&!i.hasContent}
212
+ data-window=${i.window.kind}
213
+ style=${Hi("browser",o,i.window)}
214
+ >
215
+ ${Nn(s)}
216
+ <div class="viewport browser-page">
217
+ ${On(s,n===void 0?void 0:Is(n,i.hasContent))}
218
+ </div>
219
+ ${Cn(s)}
220
+ </figure>`},ie=t=>`${t.previewId}/${t.selector}${t.url===void 0?"":` @ ${t.url}`}`,Ps=(t,e)=>e.badges.length===0?h:c`<div class="ui-notes">
221
+ ${e.badges.map(i=>{const n=e.open!==null&&ie(e.open)===ie(i);return c`<button
222
+ class="ui-note-badge"
223
+ type="button"
224
+ hidden
225
+ data-preview=${i.previewId}
226
+ data-selector=${i.selector}
227
+ data-url=${i.url??h}
228
+ data-key=${ie(i)}
229
+ aria-label=${t.uiNotesOn(i.label)}
230
+ aria-expanded=${n?"true":"false"}
231
+ title=${t.uiNotes(i.notes.length)}
232
+ @click=${()=>e.toggle(i)}
233
+ >
234
+ ${lt()}<span>${i.notes.length}</span>
235
+ </button>`})}
236
+ </div>`,Ds=(t,e)=>{const i=e.open;return i===null?h:c`<div
237
+ class="comment-pop ui-notes-pop"
238
+ popover="manual"
239
+ role="dialog"
240
+ aria-label=${t.uiNotesOn(i.label)}
241
+ data-key=${ie(i)}
242
+ >
243
+ <div class="ui-notes-head">
244
+ ${lt()}
245
+ <strong class="comment-target" title=${i.label}>${i.label}</strong>
246
+ <button
247
+ class="dpk-icon-btn"
248
+ type="button"
249
+ data-role="close-notes"
250
+ aria-label=${t.closeUiNotes}
251
+ @click=${e.close}
252
+ >
253
+ ${Ce()}
254
+ </button>
255
+ </div>
256
+ <ol class="ui-note-list">
257
+ ${i.notes.map(n=>e.editing?.noteId===n.id?c`<li data-id=${n.id}>${Rs(t,e,e.editing)}</li>`:c`<li data-id=${n.id}>
258
+ <div class="ui-note-main">
259
+ <p class="ui-note-body">${n.body}</p>
260
+ ${n.createdAt===void 0?h:c`<time class="ui-note-time" datetime=${n.createdAt}>${t.uiNoteDate(n.createdAt)}</time>`}
261
+ </div>
262
+ <button
263
+ class="dpk-icon-btn"
264
+ type="button"
265
+ data-role="edit-note"
266
+ aria-label=${t.editUiNoteAria}
267
+ title=${t.editUiNoteAria}
268
+ @click=${()=>e.edit(n.id,n.body)}
269
+ >
270
+ ${mn()}
271
+ </button>
272
+ <button
273
+ class="dpk-icon-btn"
274
+ type="button"
275
+ data-role="delete-note"
276
+ aria-label=${t.deleteUiNoteAria}
277
+ @click=${()=>e.remove(i,n.id)}
278
+ >
279
+ ${gn()}
280
+ </button>
281
+ </li>`)}
282
+ </ol>
283
+ </div>`},Rs=(t,e,i)=>c`
284
+ <div class="ui-note-editor">
285
+ <textarea
286
+ class="dpk-textarea"
287
+ aria-label=${t.editUiNoteLabel}
288
+ title=${t.editUiNoteHint}
289
+ .value=${i.body}
290
+ @input=${n=>{n.currentTarget instanceof HTMLTextAreaElement&&e.input(n.currentTarget.value)}}
291
+ @keydown=${n=>{n.isComposing||(n.key==="Enter"&&(n.metaKey||n.ctrlKey)?(n.preventDefault(),e.save()):n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),e.cancel()))}}
292
+ ></textarea>
293
+ <div class="ui-note-editor-actions">
294
+ <button class="dpk-btn dpk-btn--ghost" type="button" data-dpk-text-discard @click=${e.cancel}>
295
+ ${t.cancelUiNote}
296
+ </button>
297
+ <button
298
+ class="dpk-btn dpk-btn--accent"
299
+ type="button"
300
+ data-role="save-note"
301
+ ?disabled=${i.body.trim()===""}
302
+ @click=${e.save}
303
+ >
304
+ ${t.saveUiNote}
305
+ </button>
306
+ </div>
307
+ </div>
308
+ `,qi=(t,e,i)=>{const{state:n,navigation:o}=t,s=te(n,o),r=s===void 0||s.kind==="story"?void 0:s,a=ce(o)==="app",d=ji(n,[]);if(s?.kind==="story"){const{activity:R,story:_e}=s;return c`
309
+ <div class="stage">
310
+ <section class="stage-story" data-dpk-target=${Xt(s,null)}>
311
+ ${Fi(e,So(R,_e))}
312
+ ${_e.description?c`<div class="story-description dpk-prose">${Ne(Oe(_e.description))}</div>`:h}
313
+ <p class="stage-empty">${e.storyWithoutSteps}</p>
314
+ </section>
315
+ ${d}
316
+ </div>
317
+ `}if(!r)return c`
318
+ <div class="stage">
319
+ ${a?c`<p class="stage-empty">${e.noScreens}</p>`:c`<p class="stage-empty">
320
+ ${e.noStepBefore}<strong>Activity › UserStory › Step</strong>${e.noStepAfter}
321
+ </p>`}
322
+ ${d}
323
+ </div>
324
+ `;const l=He(n,r,o),{layout:p,panes:v,shown:f}=l,[I]=p==="single"?v:[],P=i.uiComment,T=i.lift,z=T?.mode==="demo",K=i.browser,Ze=K!==null&&K.view.entry?.kind!=="page"?[]:f,[X]=Ze,he=(X??f[0])?.viewport??"desktop",Qe=z&&K!==null&&he!=="mobile",et={onExit:i.onToggleDemo,uiComment:P,actions:i.actions},nn=X??f[0],tt=K!==null?"browser":nn?.kind??"browser",it=z&&tt==="browser"&&Pi(he)==="desktop",J=i.devices,ne=J===null||it||!ns(tt)?null:os(he,J.choice),nt=ne!==null&&J!==null?{kind:"device",width:ne.width,height:ne.height,zoom:J.zoom}:it?{kind:"fill"}:null;return c`
325
+ ${T===null?h:c`<div class="stage-placeholder" style=${`height:${T.height}px`}></div>`}
326
+ <div
327
+ class=${T===null?"stage":z?"stage is-demo":"stage is-maximized"}
328
+ data-ui-comment=${P.mode.kind}
329
+ popover=${T===null?h:"manual"}
330
+ @wheel=${T===null?h:{handleEvent:i.onLiftedWheel,passive:!1}}
331
+ >
332
+ ${z?Qe?h:Yi(e,et):c`<div class="stage-bar">
333
+ ${Fi(e,si(n,r))}
334
+ <div class="stage-tools">
335
+ ${I?.kind==="screen"&&I.tabs.length>0?Gi(t,l,I):h}
336
+ ${ne!==null&&J!==null?Us(e,ne,J,i.deviceSelect):h}
337
+ ${i.actions.groups.length>0?Vi(e,i.actions):h}
338
+ ${f.length>0?zi(e,P):h}
339
+ ${f.length===0?h:a?Vs(e,i.onToggleDemo):zs(e,T!==null,i.onToggleMaximize)}
340
+ </div>
341
+ </div>`}
342
+ ${r.kind==="step"&&r.step.situation!==void 0?Ms(e,r.step.situation):h}
343
+ ${z?h:xs(e,P)}
344
+ <div
345
+ class="canvas"
346
+ data-layout=${p}
347
+ data-dpk-target=${Xt(r,l)}
348
+ @click=${{handleEvent:i.canvasEvents.click,capture:!0}}
349
+ @pointermove=${{handleEvent:i.canvasEvents.pointermove,capture:!0}}
350
+ @pointerleave=${i.canvasEvents.pointerleave}
351
+ @wheel=${{handleEvent:i.canvasEvents.wheel,passive:!1}}
352
+ @scroll=${{handleEvent:i.canvasEvents.scroll,capture:!0}}
353
+ >
354
+ ${K!==null?_s(t,e,{...K,...X===void 0?{}:{preview:X},...Qe?{demo:et}:{},hasContent:X===void 0||i.hasPreviewContent(X.id),viewport:he,window:nt??{kind:"fill"}}):p==="side-by-side"?c`<div class="panes">
355
+ ${v.map(R=>c`<div class="pane" data-viewport=${R.preview.viewport} data-pane=${R.kind}>
356
+ ${Ls(t,l,R)}
357
+ ${Ke(t,e,R.preview,i.hasPreviewContent(R.preview.id),i.previewUrls)}
358
+ </div>`)}
359
+ </div>`:f.map(R=>Ke(t,e,R,i.hasPreviewContent(R.id),i.previewUrls,nt))}
360
+ ${f.length===0?c`<p class="dpk-label">${e.noPreviewMetadata}</p>`:h}
361
+ ${Ps(e,i.uiNotes)} ${Es(e,P)}
362
+ </div>
363
+ ${$s(e,P)} ${Ds(e,i.uiNotes)} ${ks(e,i.actions)}
364
+ ${ji(n,Ze.map(R=>R.id))}
365
+ </div>
366
+ `},Ns=q(Hn),Os=q(Yn),Cs={phone:q(Bn),tablet:q(Wn),desktop:q(zn)},Fi=(t,e)=>c`<div class="page-head">
367
+ ${e.actor===void 0?h:c`<span class="page-actor" role="note" aria-label=${t.pageActor(e.actor)} title=${e.actor}>
368
+ ${Ns()} <span class="page-actor-name">${e.actor}</span>
369
+ </span>`}
370
+ <h2 class="page-title">${e.title}</h2>
371
+ </div>`,Ms=(t,e)=>c`<aside class="situation">
372
+ <span class="situation-label">${t.situation}</span>
373
+ <p class="situation-text">${e}</p>
374
+ </aside>`,Gi=(t,e,i)=>c`<div class="dpk-segmented tabs" role="tablist">
375
+ ${i.tabs.map(n=>{const o=n.id===i.preview.id;return c`<a
376
+ class="tab"
377
+ role="tab"
378
+ data-current=${String(o)}
379
+ aria-selected=${o?"true":"false"}
380
+ href=${t.hashFor({preview:wo(e,n.id)})}
381
+ >${n.label??n.viewport}</a
382
+ >`})}
383
+ </div>`,Ls=(t,e,i)=>i.kind==="material"?i.preview.label===void 0?h:c`<span class="pane-label" title=${i.preview.label}>${i.preview.label}</span>`:c`<div class="pane-head">
384
+ <span class="pane-label" title=${i.screen.screen.title}>${i.screen.screen.title}</span>
385
+ ${i.tabs.length>0?Gi(t,e,i):h}
386
+ </div>`,Us=(t,e,i,n)=>{const o=Math.round(i.zoom*100);return c`<span class="device-pick" title=${t.deviceHint}>
387
+ ${Cs[e.deviceClass]()}
388
+ ${n.render({options:Di(e.deviceClass).map(s=>({value:s.id,label:rs(t,s)})),value:e.id,onChange:s=>i.onPick(s),ariaLabel:t.device,className:"device-select"})}
389
+ ${o<100?c`<span class="device-zoom" title=${t.deviceZoom(o)}>${o}%</span>`:h}
390
+ </span>`},Vs=(t,e)=>c`<button class="dpk-btn stage-demo" type="button" title=${t.demoHint} @click=${e}>
391
+ ${Os()} ${t.demo}
392
+ </button>`,zs=(t,e,i)=>c`<button
393
+ class="dpk-btn stage-maximize"
394
+ type="button"
395
+ aria-pressed=${e?"true":"false"}
396
+ title=${t.maximizeHint}
397
+ @click=${i}
398
+ >
399
+ ${e?c`${wn()} ${t.restore}`:c`${yn()} ${t.maximize}`}
400
+ </button>`,Ke=(t,e,i,n,o,s=null)=>c`
401
+ <figure
402
+ class="frame"
403
+ data-kind=${i.kind}
404
+ data-viewport=${i.viewport}
405
+ data-window=${s?.kind??h}
406
+ ?data-empty=${!n}
407
+ style=${Hi(i.kind,i.viewport,s)}
408
+ >
409
+ ${i.kind==="browser"?c`<div class="dpk-browser-frame-bar">
410
+ <span class="dpk-browser-frame-url"
411
+ >${xe(t.state,i,o.get(i.id))}</span
412
+ >
413
+ </div>`:i.kind==="mail"?Ys(xo(e,i)):h}
414
+ <div class="viewport">
415
+ ${i.kind==="native"?Bs():h}
416
+ <slot name=${`preview:${i.id}`}></slot>
417
+ ${n?h:c`<div class="frame-placeholder">
418
+ <span class="dpk-label">light dom preview</span>
419
+ <code>&lt;div slot="preview" data-preview-id="${i.id}"&gt;</code>
420
+ </div>`}
421
+ </div>
422
+ </figure>
423
+ `,Ys=t=>c`<header class="dpk-received-mail">
424
+ ${t.subject===void 0?h:c`<h3 class="dpk-received-mail-subject">${t.subject}</h3>`}
425
+ <div class="dpk-received-mail-envelope">
426
+ ${t.initial===void 0?h:c`<span class="dpk-avatar" data-size="lg" aria-hidden="true">${t.initial}</span>`}
427
+ <dl class="dpk-received-mail-meta">
428
+ ${t.rows.map(e=>c`<div>
429
+ <dt>${e.label}</dt>
430
+ <dd>${e.value}</dd>
431
+ </div>`)}
432
+ </dl>
433
+ </div>
434
+ </header>`,Bs=()=>c`<div class="dpk-status-bar"><span>9:41</span></div>`,ji=(t,e)=>{const n=[...B(t).flatMap(o=>o.screen.previews),...W(t).flatMap(o=>F(o.step))].filter(o=>!e.includes(o.id));return n.length===0?c`${h}`:c`<div class="parked" aria-hidden="true">
435
+ ${n.map(o=>c`<slot name=${`preview:${o.id}`}></slot>`)}
436
+ </div>`},Ws=bn`
437
+ :host {
438
+ --dpk-prototype-accent: var(--dpk-blue);
439
+ }
440
+
441
+ /* ---------------------------------------------------------------- sidebar */
442
+
443
+ .nav {
444
+ display: grid;
445
+ /* The sidebar's column, never its content's: a long story name is ellipsized
446
+ inside the rich select instead of widening the rail. */
447
+ grid-template-columns: minmax(0, 1fr);
448
+ gap: 14px;
449
+ align-content: start;
450
+ min-width: 0;
451
+ }
452
+
453
+ .nav > * {
454
+ min-width: 0;
455
+ }
456
+
457
+ .field {
458
+ display: grid;
459
+ grid-template-columns: minmax(0, 1fr);
460
+ gap: 5px;
461
+ min-width: 0;
462
+ }
463
+
464
+ .field > * {
465
+ min-width: 0;
466
+ }
467
+
468
+ /* Scenario or app: the segmented atom, stretched across the top of the sidebar. */
469
+ .view-switch {
470
+ display: flex;
471
+ min-width: 0;
472
+ }
473
+
474
+ .view-switch > * {
475
+ min-width: 0;
476
+ }
477
+
478
+ .view-option {
479
+ flex: 1 1 0;
480
+ text-align: center;
481
+ }
482
+
483
+ .app-hint {
484
+ margin: -6px 0 0;
485
+ font-size: 11.5px;
486
+ line-height: 1.55;
487
+ color: var(--dpk-ink-faint);
488
+ }
489
+
490
+ .app-group {
491
+ display: grid;
492
+ gap: 4px;
493
+ }
494
+
495
+ .app-group-heading {
496
+ margin: 0;
497
+ padding-left: 9px;
498
+ font-size: 11px;
499
+ font-weight: 600;
500
+ color: var(--dpk-ink-soft);
501
+ }
502
+
503
+ .app-description {
504
+ margin: 2px 0 0;
505
+ font-size: 11.5px;
506
+ line-height: 1.5;
507
+ color: var(--dpk-ink-faint);
508
+ }
509
+
510
+ .step-screen {
511
+ color: var(--dpk-ink);
512
+ font-size: 12.5px;
513
+ font-weight: 550;
514
+ }
515
+
516
+ .screen-description {
517
+ font-size: 12.5px;
518
+ line-height: 1.6;
519
+ color: var(--dpk-ink);
520
+ }
521
+
522
+ .app-tree {
523
+ display: grid;
524
+ gap: 4px;
525
+ }
526
+
527
+ .app-origin {
528
+ margin: 0;
529
+ padding-left: 9px;
530
+ font-family: var(--dpk-mono);
531
+ font-size: 10.5px;
532
+ font-weight: 500;
533
+ color: var(--dpk-ink-faint);
534
+ overflow-wrap: anywhere;
535
+ }
536
+
537
+ .tree {
538
+ list-style: none;
539
+ margin: 0;
540
+ padding: 0;
541
+ display: grid;
542
+ gap: 2px;
543
+ }
544
+
545
+ /* A path below another one is indented under it, with a guide line. */
546
+ .tree .tree {
547
+ margin-left: 14px;
548
+ padding-left: 6px;
549
+ border-left: 1px solid var(--dpk-rule);
550
+ }
551
+
552
+ .tree-node {
553
+ display: grid;
554
+ gap: 2px;
555
+ }
556
+
557
+ .tree-row {
558
+ position: relative;
559
+ border-radius: var(--dpk-radius-sm);
560
+ transition: background 140ms ease;
561
+ }
562
+
563
+ .tree-row:has(a):hover {
564
+ background: var(--dpk-paper-inset);
565
+ }
566
+
567
+ .tree-row[data-current='true'] {
568
+ background: linear-gradient(
569
+ 180deg,
570
+ color-mix(in srgb, var(--dpk-prototype-accent) 10%, var(--dpk-paper-raised)),
571
+ color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised))
572
+ );
573
+ box-shadow:
574
+ inset 0 0 0 1px color-mix(in srgb, var(--dpk-prototype-accent) 22%, transparent),
575
+ var(--dpk-shadow-xs);
576
+ }
577
+
578
+ .tree-link {
579
+ display: flex;
580
+ align-items: baseline;
581
+ flex-wrap: wrap;
582
+ gap: 2px 8px;
583
+ padding: 6px 4px 6px 9px;
584
+ text-decoration: none;
585
+ color: var(--dpk-ink-soft);
586
+ font-size: 12.5px;
587
+ }
588
+
589
+ .tree-path {
590
+ font-family: var(--dpk-mono);
591
+ font-size: 11.5px;
592
+ color: var(--dpk-ink);
593
+ overflow-wrap: anywhere;
594
+ }
595
+
596
+ span.tree-link .tree-path {
597
+ color: var(--dpk-ink-faint);
598
+ }
599
+
600
+ .tree-title {
601
+ min-width: 0;
602
+ color: var(--dpk-ink-soft);
603
+ }
604
+
605
+ .tree-row[data-current='true'] .tree-path,
606
+ .tree-row[data-current='true'] .tree-title {
607
+ color: var(--dpk-ink);
608
+ font-weight: 550;
609
+ }
610
+
611
+ .tree-link .step-note {
612
+ align-self: center;
613
+ }
614
+
615
+ .tree-link:focus-visible {
616
+ outline: none;
617
+ border-radius: var(--dpk-radius-sm);
618
+ box-shadow: var(--dpk-focus);
619
+ }
620
+
621
+ .steps.app-screens {
622
+ max-height: none;
623
+ }
624
+
625
+ .steps-head {
626
+ display: flex;
627
+ align-items: baseline;
628
+ justify-content: space-between;
629
+ padding-bottom: 5px;
630
+ border-bottom: 1px solid var(--dpk-rule);
631
+ }
632
+
633
+ .steps {
634
+ list-style: none;
635
+ margin: 0;
636
+ padding: 0;
637
+ display: grid;
638
+ /* A row is no wider than the list: a long step name ends in an ellipsis. */
639
+ grid-template-columns: minmax(0, 1fr);
640
+ gap: 2px;
641
+ max-height: 38vh;
642
+ overflow: auto;
643
+ }
644
+
645
+ .step-row {
646
+ position: relative;
647
+ display: flex;
648
+ align-items: center;
649
+ gap: 4px;
650
+ padding: 0 4px 0 9px;
651
+ border-radius: var(--dpk-radius-sm);
652
+ transition:
653
+ background 140ms ease,
654
+ box-shadow 140ms ease;
655
+ }
656
+
657
+ .step-row:hover {
658
+ background: var(--dpk-paper-inset);
659
+ }
660
+
661
+ .step-row[data-current='true'] {
662
+ background: linear-gradient(
663
+ 180deg,
664
+ color-mix(in srgb, var(--dpk-prototype-accent) 10%, var(--dpk-paper-raised)),
665
+ color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised))
666
+ );
667
+ box-shadow:
668
+ inset 0 0 0 1px color-mix(in srgb, var(--dpk-prototype-accent) 22%, transparent),
669
+ var(--dpk-shadow-xs);
670
+ }
671
+
672
+ .step-link {
673
+ display: flex;
674
+ flex: 1;
675
+ min-width: 0;
676
+ align-items: center;
677
+ gap: 7px;
678
+ padding: 7px 0;
679
+ text-decoration: none;
680
+ color: var(--dpk-ink-soft);
681
+ font-size: 12.5px;
682
+ font-weight: 460;
683
+ }
684
+
685
+ .step-row[data-current='true'] .step-link {
686
+ color: var(--dpk-ink);
687
+ font-weight: 550;
688
+ }
689
+
690
+ .step-index {
691
+ flex: 0 0 auto;
692
+ min-width: 17px;
693
+ padding: 1px 4px;
694
+ border-radius: var(--dpk-radius-xs);
695
+ background: var(--dpk-paper-inset);
696
+ font-family: var(--dpk-mono);
697
+ font-size: 9.5px;
698
+ font-variant-numeric: tabular-nums;
699
+ text-align: center;
700
+ color: var(--dpk-ink-faint);
701
+ transition:
702
+ background 140ms ease,
703
+ color 140ms ease;
704
+ }
705
+
706
+ .step-row[data-current='true'] .step-index {
707
+ background: linear-gradient(180deg, var(--dpk-blue), var(--dpk-blue-strong));
708
+ color: #fff;
709
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
710
+ }
711
+
712
+ .step-name {
713
+ min-width: 0;
714
+ overflow: hidden;
715
+ white-space: nowrap;
716
+ text-overflow: ellipsis;
717
+ }
718
+
719
+ .step-note {
720
+ margin-left: auto;
721
+ min-width: 16px;
722
+ padding: 1px 5px;
723
+ border-radius: 999px;
724
+ background: var(--dpk-accent);
725
+ color: var(--dpk-accent-ink);
726
+ font-family: var(--dpk-mono);
727
+ font-size: 9px;
728
+ font-variant-numeric: tabular-nums;
729
+ text-align: center;
730
+ }
731
+
732
+ .row-tools {
733
+ display: flex;
734
+ gap: 0;
735
+ opacity: 0;
736
+ transition: opacity 120ms ease;
737
+ }
738
+
739
+ .step-row:hover .row-tools,
740
+ .step-row[data-current='true'] .row-tools {
741
+ opacity: 1;
742
+ }
743
+
744
+ .detail {
745
+ display: grid;
746
+ /* As wide as the panel, not as a description's widest table or code line: those scroll. */
747
+ grid-template-columns: minmax(0, 1fr);
748
+ gap: 12px;
749
+ padding: 12px 12px 14px;
750
+ border: 1px solid var(--dpk-rule);
751
+ border-radius: var(--dpk-radius);
752
+ background: var(--dpk-paper-raised);
753
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
754
+ }
755
+
756
+ .detail-row {
757
+ display: grid;
758
+ grid-template-columns: minmax(0, 1fr);
759
+ gap: 4px;
760
+ }
761
+
762
+ .detail-value {
763
+ font-size: 12.5px;
764
+ color: var(--dpk-ink-soft);
765
+ }
766
+
767
+ .nav-empty {
768
+ font-size: 12px;
769
+ line-height: 1.6;
770
+ color: var(--dpk-ink-faint);
771
+ }
772
+
773
+ /* ------------------------------------------------------------------ stage */
774
+
775
+ .stage {
776
+ display: grid;
777
+ /* One column no wider than the main area: a wide row of panes scrolls inside the canvas. */
778
+ grid-template-columns: minmax(0, 1fr);
779
+ gap: 14px;
780
+ width: 100%;
781
+ min-width: 0;
782
+ }
783
+
784
+ /* A tighter top than the shell's leaves the preview more of the main column. */
785
+ :host {
786
+ --dpk-main-padding: 12px 24px 24px;
787
+ }
788
+
789
+ .stage-bar {
790
+ display: flex;
791
+ align-items: center;
792
+ justify-content: space-between;
793
+ gap: 10px 16px;
794
+ min-width: 0;
795
+ flex-wrap: wrap;
796
+ }
797
+
798
+ /*
799
+ * The page head and its tools stick to the top of the main column, so they
800
+ * stay in reach while a tall preview scrolls under them; the situation and
801
+ * the canvas scroll on. The bar spans the column edge to edge (cancelling
802
+ * the body's padding) on a frosted ground the content passes beneath. Above
803
+ * the UI-comment layer, below the memo, which opens over everything.
804
+ */
805
+ .stage:not(.is-maximized) > .stage-bar {
806
+ position: sticky;
807
+ top: 0;
808
+ z-index: 5;
809
+ margin: -12px -24px 0;
810
+ /* Its leading text clears the fold button a folded sidebar floats over this corner. */
811
+ padding: 10px 24px 10px calc(24px + var(--dpk-fold-clearance-left, 0px));
812
+ border-bottom: 1px solid var(--dpk-rule);
813
+ background: color-mix(in srgb, var(--dpk-paper-raised) 92%, transparent);
814
+ backdrop-filter: saturate(1.6) blur(14px);
815
+ }
816
+
817
+ /* ------------------------------------------------------------- page head */
818
+
819
+ .page-head {
820
+ display: flex;
821
+ align-items: center;
822
+ gap: 12px;
823
+ min-width: 0;
824
+ animation: dpk-page-head-in 260ms var(--dpk-ease) backwards;
825
+ }
826
+
827
+ @keyframes dpk-page-head-in {
828
+ from {
829
+ opacity: 0;
830
+ transform: translateY(4px);
831
+ }
832
+ }
833
+
834
+ .page-actor {
835
+ display: inline-flex;
836
+ /* A long role name gives way to the title first, down to a recognizable stub. */
837
+ flex: 0 1000 auto;
838
+ min-width: 72px;
839
+ align-items: center;
840
+ gap: 6px;
841
+ height: 26px;
842
+ padding: 0 11px 0 8px;
843
+ border-radius: 999px;
844
+ background: linear-gradient(
845
+ 180deg,
846
+ color-mix(in srgb, var(--dpk-blue) 16%, var(--dpk-paper-raised)),
847
+ color-mix(in srgb, var(--dpk-blue) 9%, var(--dpk-paper-raised))
848
+ );
849
+ box-shadow:
850
+ var(--dpk-bevel),
851
+ inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 32%, transparent),
852
+ var(--dpk-shadow-xs);
853
+ color: var(--dpk-blue);
854
+ font-size: 12px;
855
+ font-weight: 650;
856
+ letter-spacing: 0.01em;
857
+ white-space: nowrap;
858
+ max-width: 280px;
859
+ }
860
+
861
+ .page-actor-name {
862
+ min-width: 0;
863
+ overflow: hidden;
864
+ text-overflow: ellipsis;
865
+ }
866
+
867
+ .page-actor svg {
868
+ flex: none;
869
+ width: 13px;
870
+ height: 13px;
871
+ opacity: 0.9;
872
+ }
873
+
874
+ .page-title {
875
+ margin: 0;
876
+ min-width: 0;
877
+ overflow: hidden;
878
+ font-size: 19px;
879
+ font-weight: 700;
880
+ line-height: 1.3;
881
+ letter-spacing: -0.02em;
882
+ color: var(--dpk-ink);
883
+ text-overflow: ellipsis;
884
+ white-space: nowrap;
885
+ }
886
+
887
+ /* Wraps on a phone rather than pushing the last tools off the screen. */
888
+ .stage-tools {
889
+ display: flex;
890
+ flex-wrap: wrap;
891
+ justify-content: flex-end;
892
+ align-items: center;
893
+ gap: 8px;
894
+ min-width: 0;
895
+ margin-left: auto;
896
+ /* Maximize (and the other tools) sit below the floating menu otherwise. */
897
+ margin-inline-end: var(--dpk-floating-menu-clearance, 0px);
898
+ }
899
+
900
+ .stage-maximize svg,
901
+ .stage-demo svg {
902
+ width: 13px;
903
+ height: 13px;
904
+ }
905
+
906
+ .stage-demo {
907
+ display: inline-flex;
908
+ align-items: center;
909
+ gap: 6px;
910
+ }
911
+
912
+ .actions-toggle {
913
+ display: inline-flex;
914
+ align-items: center;
915
+ gap: 6px;
916
+ }
917
+
918
+ .actions-toggle svg {
919
+ width: 13px;
920
+ height: 13px;
921
+ }
922
+
923
+ .actions-toggle svg:last-child {
924
+ width: 12px;
925
+ height: 12px;
926
+ margin-left: -2px;
927
+ opacity: 0.7;
928
+ }
929
+
930
+ .actions-toggle[aria-expanded='true'] {
931
+ opacity: 1;
932
+ color: var(--dpk-ink);
933
+ }
934
+
935
+ /* A menu of what each screen on stage can do in one go. */
936
+ .actions-menu {
937
+ gap: 8px;
938
+ width: max-content;
939
+ min-width: 220px;
940
+ max-width: min(320px, calc(100vw - 24px));
941
+ padding: 6px;
942
+ }
943
+
944
+ .actions-group {
945
+ display: grid;
946
+ gap: 2px;
947
+ }
948
+
949
+ .actions-group + .actions-group {
950
+ padding-top: 6px;
951
+ border-top: 1px solid var(--dpk-rule);
952
+ }
953
+
954
+ .actions-group-title {
955
+ padding: 4px 10px 2px;
956
+ font-size: 11px;
957
+ font-weight: 600;
958
+ color: var(--dpk-ink-faint);
959
+ }
960
+
961
+ .actions-item {
962
+ display: grid;
963
+ gap: 2px;
964
+ width: 100%;
965
+ padding: 8px 10px;
966
+ border: 0;
967
+ border-radius: var(--dpk-radius-sm);
968
+ background: transparent;
969
+ color: var(--dpk-ink);
970
+ font: inherit;
971
+ text-align: left;
972
+ cursor: pointer;
973
+ }
974
+
975
+ .actions-item:hover,
976
+ .actions-item:focus-visible {
977
+ background: var(--dpk-accent-soft);
978
+ }
979
+
980
+ .actions-item:focus-visible {
981
+ outline: none;
982
+ box-shadow: var(--dpk-focus);
983
+ }
984
+
985
+ .actions-label {
986
+ font-weight: 600;
987
+ }
988
+
989
+ .actions-description {
990
+ font-size: 11.5px;
991
+ line-height: 1.45;
992
+ color: var(--dpk-ink-soft);
993
+ }
994
+
995
+ /* The app view's device: a pill like the rendition tabs, with the zoom it is drawn at. */
996
+ .device-pick {
997
+ position: relative;
998
+ display: inline-flex;
999
+ align-items: center;
1000
+ gap: 6px;
1001
+ height: 32px;
1002
+ padding: 0 6px 0 10px;
1003
+ box-sizing: border-box;
1004
+ border: 1px solid var(--dpk-rule);
1005
+ border-radius: 999px;
1006
+ background: var(--dpk-paper-sunken);
1007
+ box-shadow: inset 0 1px 2px rgba(20, 28, 44, 0.04);
1008
+ color: var(--dpk-ink-soft);
1009
+ }
1010
+
1011
+ .device-pick:focus-within {
1012
+ box-shadow: var(--dpk-focus);
1013
+ }
1014
+
1015
+ .device-pick svg {
1016
+ flex: none;
1017
+ width: 14px;
1018
+ height: 14px;
1019
+ }
1020
+
1021
+ .device-select {
1022
+ min-width: 0;
1023
+ padding: 0 4px 0 0;
1024
+ border: 0;
1025
+ background: transparent;
1026
+ color: var(--dpk-ink);
1027
+ font: 600 12px/1 var(--dpk-body);
1028
+ }
1029
+
1030
+ .device-zoom {
1031
+ padding: 3px 7px;
1032
+ border-radius: 999px;
1033
+ background: var(--dpk-paper-raised);
1034
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
1035
+ font: 600 10.5px/1 var(--dpk-mono);
1036
+ font-variant-numeric: tabular-nums;
1037
+ color: var(--dpk-ink-soft);
1038
+ }
1039
+
1040
+ .stage-empty {
1041
+ max-width: 62ch;
1042
+ padding: 16px 18px;
1043
+ border: 1px dashed var(--dpk-rule-strong);
1044
+ border-radius: var(--dpk-radius-lg);
1045
+ background: var(--dpk-paper-sunken);
1046
+ font-size: 13px;
1047
+ line-height: 1.7;
1048
+ color: var(--dpk-ink-soft);
1049
+ }
1050
+
1051
+ /* A story that has no steps yet: its heading, what it is for, and why no frame. */
1052
+ .stage-story {
1053
+ display: grid;
1054
+ gap: 12px;
1055
+ justify-items: start;
1056
+ }
1057
+
1058
+ .story-description {
1059
+ max-width: 62ch;
1060
+ margin: 0;
1061
+ font-size: 14px;
1062
+ line-height: 1.7;
1063
+ color: var(--dpk-ink);
1064
+ }
1065
+
1066
+ /* -------------------------------------------------------------- situation */
1067
+
1068
+ /*
1069
+ * What is going on around the previews: a stage direction, read before them.
1070
+ * The band spans the stage at any width (a maximized stage too); only the
1071
+ * text keeps a readable line length.
1072
+ */
1073
+ .situation {
1074
+ display: flex;
1075
+ align-items: baseline;
1076
+ gap: 10px;
1077
+ margin: -4px 0 -2px;
1078
+ padding: 8px 14px 8px 10px;
1079
+ border: 1px solid color-mix(in srgb, var(--dpk-prototype-accent) 16%, var(--dpk-rule));
1080
+ border-radius: var(--dpk-radius);
1081
+ background: color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised));
1082
+ box-shadow: var(--dpk-bevel);
1083
+ }
1084
+
1085
+ .situation-label {
1086
+ flex: none;
1087
+ padding: 2px 8px;
1088
+ border-radius: 999px;
1089
+ background: color-mix(in srgb, var(--dpk-prototype-accent) 13%, transparent);
1090
+ font-size: 10.5px;
1091
+ font-weight: 650;
1092
+ letter-spacing: 0.06em;
1093
+ color: var(--dpk-prototype-accent);
1094
+ }
1095
+
1096
+ .situation-text {
1097
+ max-width: 90ch;
1098
+ margin: 0;
1099
+ min-width: 0;
1100
+ font-size: 13px;
1101
+ line-height: 1.65;
1102
+ color: var(--dpk-ink);
1103
+ white-space: pre-line;
1104
+ overflow-wrap: anywhere;
1105
+ }
1106
+
1107
+ /* ----------------------------------------------------------------- canvas */
1108
+
1109
+ /*
1110
+ * The work surface the frame sits on: a quiet dot lattice that reads as a
1111
+ * canvas rather than empty page background, giving the frame somewhere to
1112
+ * cast its shadow.
1113
+ */
1114
+ .canvas {
1115
+ display: flex;
1116
+ justify-content: center;
1117
+ padding: 30px;
1118
+ border: 1px solid var(--dpk-rule);
1119
+ border-radius: var(--dpk-radius-xl);
1120
+ background: var(--dpk-dots), var(--dpk-paper-sunken);
1121
+ box-shadow: inset 0 1px 3px var(--dpk-shade-1);
1122
+ }
1123
+
1124
+ /* ---------------------------------------------------------- comment on UI */
1125
+
1126
+ .ui-comment-toggle svg,
1127
+ .ui-comment-hint svg {
1128
+ width: 14px;
1129
+ height: 14px;
1130
+ }
1131
+
1132
+ .ui-comment-toggle {
1133
+ display: inline-flex;
1134
+ align-items: center;
1135
+ gap: 6px;
1136
+ }
1137
+
1138
+ .ui-comment-hint {
1139
+ display: flex;
1140
+ align-items: center;
1141
+ gap: 8px;
1142
+ margin: -4px 0 -2px;
1143
+ padding: 7px 12px;
1144
+ border-radius: var(--dpk-radius);
1145
+ background: var(--dpk-accent-soft);
1146
+ color: var(--dpk-accent-strong, var(--dpk-accent));
1147
+ font-size: 12.5px;
1148
+ font-weight: 550;
1149
+ }
1150
+
1151
+ .canvas {
1152
+ position: relative;
1153
+ }
1154
+
1155
+ .stage:not([data-ui-comment='off']) .canvas ::slotted(*) {
1156
+ cursor: crosshair;
1157
+ }
1158
+
1159
+ /* Sized to the canvas's scroll area by the element; the boxes and pins show through. */
1160
+ .ui-catcher {
1161
+ position: absolute;
1162
+ top: 0;
1163
+ left: 0;
1164
+ z-index: 4;
1165
+ cursor: crosshair;
1166
+ }
1167
+
1168
+ /* Positioned against the canvas by the element, which measures the author's markup. */
1169
+ .ui-layer {
1170
+ display: contents;
1171
+ }
1172
+
1173
+ .ui-box {
1174
+ position: absolute;
1175
+ z-index: 2;
1176
+ box-sizing: border-box;
1177
+ border-radius: 4px;
1178
+ pointer-events: none;
1179
+ }
1180
+
1181
+ .ui-hover {
1182
+ outline: 2px solid var(--dpk-accent);
1183
+ outline-offset: 1px;
1184
+ background: color-mix(in srgb, var(--dpk-accent) 8%, transparent);
1185
+ }
1186
+
1187
+ .ui-picked {
1188
+ outline: 2px solid var(--dpk-accent);
1189
+ outline-offset: 2px;
1190
+ background: color-mix(in srgb, var(--dpk-accent) 14%, transparent);
1191
+ box-shadow: 0 0 0 6px color-mix(in srgb, var(--dpk-accent) 18%, transparent);
1192
+ }
1193
+
1194
+ .ui-pin {
1195
+ position: absolute;
1196
+ z-index: 3;
1197
+ display: grid;
1198
+ place-items: center;
1199
+ min-width: 20px;
1200
+ height: 20px;
1201
+ padding: 0 5px;
1202
+ box-sizing: border-box;
1203
+ transform: translate(-50%, -50%);
1204
+ border: 2px solid var(--dpk-paper-raised);
1205
+ border-radius: 999px 999px 999px 2px;
1206
+ background: var(--dpk-accent);
1207
+ color: var(--dpk-accent-ink);
1208
+ box-shadow: var(--dpk-shadow-sm);
1209
+ font-family: var(--dpk-mono);
1210
+ font-size: 10px;
1211
+ font-weight: 700;
1212
+ pointer-events: none;
1213
+ }
1214
+
1215
+ .ui-box[hidden],
1216
+ .ui-pin[hidden] {
1217
+ display: none;
1218
+ }
1219
+
1220
+ /* ---------------------------------------------------------- notes on the UI */
1221
+
1222
+ /* Positioned against the canvas by the element, like the pins; blue, so a note never reads as feedback. */
1223
+ .ui-notes {
1224
+ display: contents;
1225
+ }
1226
+
1227
+ .ui-note-badge {
1228
+ position: absolute;
1229
+ z-index: 3;
1230
+ display: inline-flex;
1231
+ align-items: center;
1232
+ gap: 3px;
1233
+ height: 20px;
1234
+ padding: 0 6px 0 5px;
1235
+ box-sizing: border-box;
1236
+ transform: translate(-50%, -50%);
1237
+ border: 2px solid var(--dpk-paper-raised);
1238
+ border-radius: 999px;
1239
+ background: var(--dpk-blue);
1240
+ color: #fff;
1241
+ box-shadow: var(--dpk-shadow-sm);
1242
+ font-family: var(--dpk-mono);
1243
+ font-size: 10px;
1244
+ font-weight: 700;
1245
+ line-height: 1;
1246
+ cursor: pointer;
1247
+ }
1248
+
1249
+ .ui-note-badge svg {
1250
+ width: 11px;
1251
+ height: 11px;
1252
+ }
1253
+
1254
+ .ui-note-badge:hover,
1255
+ .ui-note-badge[aria-expanded='true'] {
1256
+ background: var(--dpk-blue-strong);
1257
+ }
1258
+
1259
+ .ui-note-badge:focus-visible {
1260
+ outline: 2px solid var(--dpk-focus);
1261
+ outline-offset: 1px;
1262
+ }
1263
+
1264
+ .ui-note-badge[hidden] {
1265
+ display: none;
1266
+ }
1267
+
1268
+ .ui-notes-head {
1269
+ display: flex;
1270
+ align-items: center;
1271
+ gap: 6px;
1272
+ }
1273
+
1274
+ /* The badge's icon and blue: the list reads as the badge opened. */
1275
+ .ui-notes-head > svg {
1276
+ flex: none;
1277
+ width: 14px;
1278
+ height: 14px;
1279
+ color: var(--dpk-blue);
1280
+ }
1281
+
1282
+ .ui-notes-head .comment-target {
1283
+ flex: 1 1 auto;
1284
+ min-width: 0;
1285
+ overflow: hidden;
1286
+ text-overflow: ellipsis;
1287
+ white-space: nowrap;
1288
+ }
1289
+
1290
+ .ui-note-list {
1291
+ display: grid;
1292
+ gap: 6px;
1293
+ max-height: 240px;
1294
+ margin: 0;
1295
+ padding: 0;
1296
+ overflow: auto;
1297
+ list-style: none;
1298
+ }
1299
+
1300
+ .ui-note-list li {
1301
+ display: flex;
1302
+ align-items: flex-start;
1303
+ gap: 4px;
1304
+ padding: 8px 4px 8px 10px;
1305
+ border-radius: var(--dpk-radius-sm);
1306
+ background: var(--dpk-paper-sunken);
1307
+ }
1308
+
1309
+ .ui-note-main {
1310
+ display: grid;
1311
+ flex: 1 1 auto;
1312
+ gap: 2px;
1313
+ min-width: 0;
1314
+ }
1315
+
1316
+ .ui-note-body {
1317
+ margin: 0;
1318
+ color: var(--dpk-ink);
1319
+ font-size: 12.5px;
1320
+ line-height: 1.6;
1321
+ white-space: pre-wrap;
1322
+ overflow-wrap: anywhere;
1323
+ }
1324
+
1325
+ .ui-note-time {
1326
+ color: var(--dpk-ink-faint);
1327
+ font-family: var(--dpk-mono);
1328
+ font-size: 10.5px;
1329
+ }
1330
+
1331
+ /* Rewrite and delete sit together at the end of the row. */
1332
+ .ui-note-list li .dpk-icon-btn + .dpk-icon-btn {
1333
+ margin-left: -4px;
1334
+ }
1335
+
1336
+ .ui-note-list li:has(.ui-note-editor) {
1337
+ padding: 6px;
1338
+ }
1339
+
1340
+ .ui-note-editor {
1341
+ display: grid;
1342
+ flex: 1 1 auto;
1343
+ gap: 6px;
1344
+ min-width: 0;
1345
+ }
1346
+
1347
+ .ui-note-editor textarea {
1348
+ min-height: 72px;
1349
+ background: var(--dpk-paper-raised);
1350
+ font-size: 12.5px;
1351
+ }
1352
+
1353
+ .ui-note-editor-actions {
1354
+ display: flex;
1355
+ justify-content: flex-end;
1356
+ gap: 6px;
1357
+ }
1358
+
1359
+ /*
1360
+ * Side by side: what the user sees together, in one row. A fixed viewport
1361
+ * keeps its width as long as the row allows it, a fluid one takes the rest;
1362
+ * a row wider than the canvas scrolls sideways instead of squeezing a device.
1363
+ */
1364
+ .panes {
1365
+ display: flex;
1366
+ align-items: flex-start;
1367
+ justify-content: safe center;
1368
+ gap: 28px;
1369
+ width: 100%;
1370
+ min-width: 0;
1371
+ overflow-x: auto;
1372
+ padding-bottom: 4px;
1373
+ }
1374
+
1375
+ /*
1376
+ * A row wider than the stage fades out at the edge it scrolls toward, so the
1377
+ * panes past it read as a scroll away rather than cut off. The scroll timeline
1378
+ * is inactive while the row fits, which leaves it unmasked.
1379
+ */
1380
+ @supports (animation-timeline: scroll()) {
1381
+ .panes {
1382
+ animation: panes-edge linear both;
1383
+ animation-timeline: scroll(self inline);
1384
+ }
1385
+
1386
+ @keyframes panes-edge {
1387
+ 0% {
1388
+ mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
1389
+ }
1390
+ 2%,
1391
+ 98% {
1392
+ mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
1393
+ }
1394
+ 100% {
1395
+ mask-image: linear-gradient(90deg, transparent, #000 40px);
1396
+ }
1397
+ }
1398
+ }
1399
+
1400
+ /* A device shrinks at most to a width its layout still reads at, then the row scrolls. */
1401
+ .pane {
1402
+ display: grid;
1403
+ /* The pane's width is the device's: a long label never widens it. */
1404
+ grid-template-columns: minmax(0, 1fr);
1405
+ gap: 8px;
1406
+ flex: 0 1 var(--pane-width);
1407
+ min-width: min(var(--pane-width), 720px);
1408
+ }
1409
+
1410
+ .pane[data-viewport='mobile'] {
1411
+ --pane-width: 390px;
1412
+ }
1413
+
1414
+ .pane[data-viewport='tablet'] {
1415
+ --pane-width: 834px;
1416
+ }
1417
+
1418
+ .pane[data-viewport='desktop'] {
1419
+ --pane-width: 1180px;
1420
+ }
1421
+
1422
+ .pane[data-viewport='fluid'] {
1423
+ flex: 1 1 0;
1424
+ min-width: 240px;
1425
+ }
1426
+
1427
+ .pane .frame {
1428
+ width: 100%;
1429
+ }
1430
+
1431
+ .pane-head {
1432
+ display: flex;
1433
+ flex-wrap: wrap;
1434
+ align-items: center;
1435
+ justify-content: space-between;
1436
+ gap: 8px;
1437
+ }
1438
+
1439
+ .pane-head .tabs {
1440
+ padding: 2px;
1441
+ }
1442
+
1443
+ .pane-head .tab {
1444
+ padding: 3px 11px;
1445
+ font-size: 11.5px;
1446
+ }
1447
+
1448
+ /* One line over the pane; hovering names the whole label. */
1449
+ .pane-label {
1450
+ justify-self: start;
1451
+ min-width: 0;
1452
+ max-width: 100%;
1453
+ overflow: hidden;
1454
+ text-overflow: ellipsis;
1455
+ white-space: nowrap;
1456
+ padding: 2px 9px;
1457
+ border-radius: 999px;
1458
+ background: var(--dpk-paper-raised);
1459
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
1460
+ font-size: 11.5px;
1461
+ font-weight: 600;
1462
+ color: var(--dpk-ink-soft);
1463
+ }
1464
+
1465
+ /*
1466
+ * Maximized: the stage covers the tab — the page head, the tabs and the canvas
1467
+ * alone. It is also a manual popover in the top layer, so the UA popover box
1468
+ * (fit-content, margin, border, padding, colors) is reset here. The canvas
1469
+ * scrolls instead of the page, and a browser preview is at least as tall as
1470
+ * the tab allows; a phone keeps its device shape. Whatever sits above the
1471
+ * canvas (the situation, the comment-on-UI hint) keeps its own height, and the
1472
+ * canvas takes the rest.
1473
+ */
1474
+ .stage.is-maximized {
1475
+ position: fixed;
1476
+ inset: 0;
1477
+ z-index: 2147483000;
1478
+ display: flex;
1479
+ flex-direction: column;
1480
+ width: auto;
1481
+ height: auto;
1482
+ max-width: none;
1483
+ max-height: none;
1484
+ margin: 0;
1485
+ padding: 16px 20px 20px;
1486
+ border: 0;
1487
+ color: var(--dpk-ink);
1488
+ background: var(--dpk-paper);
1489
+ overflow: hidden;
1490
+ }
1491
+
1492
+ .stage.is-maximized > * {
1493
+ flex: none;
1494
+ }
1495
+
1496
+ .canvas:has(> .frame[data-window='device']) {
1497
+ align-items: flex-start;
1498
+ /* A device wider than the stage is drawn smaller to fit it, so it never widens the page. */
1499
+ min-width: 0;
1500
+ contain: inline-size;
1501
+ }
1502
+
1503
+ .stage.is-maximized > .canvas {
1504
+ flex: 1 1 0;
1505
+ min-height: 0;
1506
+ align-items: flex-start;
1507
+ overflow: auto;
1508
+ overscroll-behavior: contain;
1509
+ }
1510
+
1511
+ .stage.is-maximized .frame:not([data-kind='native'], [data-kind='plain']) {
1512
+ display: flex;
1513
+ flex-direction: column;
1514
+ min-height: 100%;
1515
+ }
1516
+
1517
+ .stage.is-maximized .frame:not([data-kind='native'], [data-kind='plain']) .viewport {
1518
+ flex: 1 0 auto;
1519
+ }
1520
+
1521
+ /*
1522
+ * Demo: the app view's browser alone across the tab, as if the reader were
1523
+ * using the app — no title, no tools, no canvas around it. The browser fills
1524
+ * the tab and its page scrolls inside the viewport; a phone stays phone wide.
1525
+ */
1526
+ .stage.is-demo {
1527
+ position: fixed;
1528
+ inset: 0;
1529
+ z-index: 2147483000;
1530
+ display: flex;
1531
+ flex-direction: column;
1532
+ width: auto;
1533
+ height: auto;
1534
+ max-width: none;
1535
+ max-height: none;
1536
+ margin: 0;
1537
+ padding: 0;
1538
+ border: 0;
1539
+ color: var(--dpk-ink);
1540
+ background: var(--dpk-paper-sunken);
1541
+ overflow: hidden;
1542
+ }
1543
+
1544
+ .stage.is-demo > .canvas {
1545
+ flex: 1 1 0;
1546
+ min-height: 0;
1547
+ padding: 0;
1548
+ border: 0;
1549
+ border-radius: 0;
1550
+ background: var(--dpk-dots), var(--dpk-paper-sunken);
1551
+ box-shadow: none;
1552
+ overflow: auto;
1553
+ overscroll-behavior: contain;
1554
+ }
1555
+
1556
+ .stage.is-demo .frame[data-window='fill'] {
1557
+ width: 100%;
1558
+ height: 100%;
1559
+ border: 0;
1560
+ border-radius: 0;
1561
+ box-shadow: none;
1562
+ }
1563
+
1564
+ /* A device keeps its size, in the middle of the tab (the element leaves 24px around it). */
1565
+ .stage.is-demo > .canvas > .frame[data-window='device'] {
1566
+ margin: auto;
1567
+ }
1568
+
1569
+ .stage.is-demo > .canvas > .frame:not([data-window]) {
1570
+ margin: 24px auto;
1571
+ }
1572
+
1573
+ /*
1574
+ * The demo's controls (commenting on the UI, the way out). Over a phone or a
1575
+ * frame outside the browser, they float at the top right.
1576
+ */
1577
+ .demo-controls {
1578
+ position: absolute;
1579
+ top: 12px;
1580
+ right: 16px;
1581
+ z-index: 3;
1582
+ display: flex;
1583
+ align-items: center;
1584
+ gap: 6px;
1585
+ }
1586
+
1587
+ .demo-control {
1588
+ display: inline-flex;
1589
+ align-items: center;
1590
+ gap: 6px;
1591
+ height: 30px;
1592
+ padding: 0 10px;
1593
+ border: 1px solid var(--dpk-rule-strong);
1594
+ border-radius: 999px;
1595
+ background: color-mix(in srgb, var(--dpk-paper-raised) 82%, transparent);
1596
+ backdrop-filter: blur(10px);
1597
+ box-shadow: var(--dpk-shadow);
1598
+ color: var(--dpk-ink-soft);
1599
+ font: 600 12px/1 var(--dpk-body);
1600
+ cursor: pointer;
1601
+ opacity: 0.55;
1602
+ transition:
1603
+ opacity 160ms var(--dpk-ease),
1604
+ color 160ms var(--dpk-ease);
1605
+ }
1606
+
1607
+ .demo-exit {
1608
+ padding-right: 8px;
1609
+ }
1610
+
1611
+ .demo-control:hover,
1612
+ .demo-control:focus-visible {
1613
+ opacity: 1;
1614
+ color: var(--dpk-ink);
1615
+ }
1616
+
1617
+ .demo-control:focus-visible {
1618
+ outline: none;
1619
+ box-shadow: var(--dpk-focus), var(--dpk-shadow);
1620
+ }
1621
+
1622
+ /* Commenting stays in sight: a click on the app now picks an element instead of using it. */
1623
+ .demo-control[aria-pressed='true'] {
1624
+ opacity: 1;
1625
+ border-color: var(--dpk-accent-strong);
1626
+ background: var(--dpk-accent);
1627
+ color: var(--dpk-accent-ink);
1628
+ }
1629
+
1630
+ .demo-control svg {
1631
+ width: 12px;
1632
+ height: 12px;
1633
+ }
1634
+
1635
+ /* A desktop browser has them at the free end of the tab strip, like window controls. */
1636
+ .browser-tabs .demo-controls {
1637
+ position: static;
1638
+ flex: none;
1639
+ align-self: center;
1640
+ margin: 0 0 3px auto;
1641
+ }
1642
+
1643
+ .browser-tabs .demo-control {
1644
+ height: 26px;
1645
+ }
1646
+
1647
+ .browser-tabs .demo-control:not([aria-pressed='true']) {
1648
+ opacity: 0.85;
1649
+ }
1650
+
1651
+ .demo-exit kbd {
1652
+ padding: 2px 5px;
1653
+ border: 1px solid var(--dpk-rule-strong);
1654
+ border-radius: var(--dpk-radius-xs);
1655
+ background: var(--dpk-paper-sunken);
1656
+ font: 600 10px/1 var(--dpk-mono);
1657
+ }
1658
+
1659
+ /* ------------------------------------------------------------------ frame */
1660
+
1661
+ .frame {
1662
+ width: min(var(--frame-width), 100%);
1663
+ max-width: 100%;
1664
+ margin: 0;
1665
+ border: 1px solid var(--dpk-rule);
1666
+ border-radius: var(--dpk-radius-lg);
1667
+ background: var(--dpk-paper-raised);
1668
+ box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
1669
+ overflow: hidden;
1670
+ /* However high the mock stacks its own layers, they stay under what the stage draws over the frame. */
1671
+ isolation: isolate;
1672
+ transition: box-shadow 200ms var(--dpk-ease);
1673
+ }
1674
+
1675
+ /*
1676
+ * Native previews are recognised by their device shape: a slim bezel, a status
1677
+ * bar with a punch-hole camera, and a home indicator. No address bar.
1678
+ */
1679
+ .frame[data-kind='native'] {
1680
+ padding: 10px;
1681
+ border-color: #22262e;
1682
+ border-radius: 28px;
1683
+ background: linear-gradient(160deg, #2e3440, #1a1d24);
1684
+ box-shadow:
1685
+ var(--dpk-shadow-lg),
1686
+ inset 0 1px 0 rgba(255, 255, 255, 0.06);
1687
+ }
1688
+
1689
+ .frame[data-kind='native'] .viewport {
1690
+ overflow: hidden;
1691
+ border-radius: 18px;
1692
+ }
1693
+
1694
+ /* A phone is portrait: derive the screen height from its width (~1:2.05)
1695
+ instead of reusing the browser preview heights. */
1696
+ .frame[data-kind='native'][data-viewport='mobile'] .viewport {
1697
+ min-height: calc((var(--frame-width, 390px) - 16px) * 2.05);
1698
+ }
1699
+
1700
+ /*
1701
+ * A plain preview is not a screen: no chrome, no bezel, no frame of its own.
1702
+ * The light DOM draws the whole object (a memo, a FAX, a paper form) and the
1703
+ * canvas is its desk, so it is as tall as its content.
1704
+ */
1705
+ .frame[data-kind='plain'] {
1706
+ border: none;
1707
+ border-radius: 0;
1708
+ background: transparent;
1709
+ box-shadow: none;
1710
+ overflow: visible;
1711
+ }
1712
+
1713
+ .frame[data-kind='plain'] .viewport {
1714
+ min-height: 0;
1715
+ background: transparent;
1716
+ }
1717
+
1718
+ .frame[data-kind='plain'][data-empty] .viewport {
1719
+ min-height: 180px;
1720
+ }
1721
+
1722
+ /* Home indicator. */
1723
+ .frame[data-kind='native'] .viewport::after {
1724
+ content: '';
1725
+ position: absolute;
1726
+ bottom: 8px;
1727
+ left: 50%;
1728
+ width: 88px;
1729
+ height: 4px;
1730
+ transform: translateX(-50%);
1731
+ border-radius: 999px;
1732
+ background: rgba(138, 146, 160, 0.55);
1733
+ }
1734
+
1735
+ /*
1736
+ * The preview is never scrolled on its own: it shows everything it contains and
1737
+ * the page scrolls as a whole. The flex column keeps a short mock filling
1738
+ * the frame's minimum height without pinning a maximum.
1739
+ */
1740
+ .viewport {
1741
+ position: relative;
1742
+ contain: layout;
1743
+ display: flex;
1744
+ flex-direction: column;
1745
+ width: 100%;
1746
+ min-height: var(--frame-min-height, 480px);
1747
+ /* A preview is the product's screen, not the kit's chrome: it stays light in a dark theme. */
1748
+ color-scheme: light;
1749
+ background: #fff;
1750
+ /* …and so does its ink: the kit's dark-theme text color would be invisible on it. */
1751
+ color: #1f2430;
1752
+ }
1753
+
1754
+ /*
1755
+ * The author's wrapper becomes the frame's filling layer: a one-cell grid makes
1756
+ * its height definite, so a mock that asks for height:100% fills the frame
1757
+ * instead of collapsing to its content.
1758
+ */
1759
+ /*
1760
+ * The author's wrapper is a stretch row: a mock fills a short frame and grows
1761
+ * the frame when its own content is taller. Stretching (rather than a
1762
+ * percentage height) is what makes the fill reliable.
1763
+ */
1764
+ /* Only the viewport carries the minimum height; the wrapper grows to fill it. */
1765
+ .viewport ::slotted(*) {
1766
+ display: grid;
1767
+ flex: 1 0 auto;
1768
+ min-width: 0;
1769
+ }
1770
+
1771
+ /*
1772
+ * The app view is a simulation: a screen runs in a window of a fixed size (a
1773
+ * device's screen, or the whole demo) and what does not fit scrolls inside
1774
+ * the author's wrapper, the way the real page scrolls under the device's own
1775
+ * chrome — the status bar, the address bar and a phone browser's bottom bar
1776
+ * stay where they are. The viewport contains layout, so a mock's
1777
+ * fixed position element (a tab bar, a modal) stays on the device screen.
1778
+ */
1779
+ .frame[data-window] {
1780
+ display: flex;
1781
+ flex: none;
1782
+ flex-direction: column;
1783
+ box-sizing: border-box;
1784
+ max-width: none;
1785
+ }
1786
+
1787
+ .frame[data-window='device'] {
1788
+ width: var(--device-width);
1789
+ height: var(--device-height);
1790
+ }
1791
+
1792
+ .frame[data-kind][data-window] .viewport {
1793
+ flex: 1 1 0;
1794
+ min-height: 0;
1795
+ overflow: hidden;
1796
+ }
1797
+
1798
+ .frame[data-window] .viewport ::slotted(*) {
1799
+ flex: 1 1 0;
1800
+ min-height: 0;
1801
+ overflow: auto;
1802
+ overscroll-behavior: contain;
1803
+ }
1804
+
1805
+ .frame-placeholder {
1806
+ position: absolute;
1807
+ inset: 12px;
1808
+ display: grid;
1809
+ align-content: center;
1810
+ justify-items: center;
1811
+ gap: 8px;
1812
+ padding: 12px;
1813
+ text-align: center;
1814
+ color: var(--dpk-ink-faint);
1815
+ border: 1px dashed var(--dpk-rule-strong);
1816
+ border-radius: var(--dpk-radius);
1817
+ background: var(--dpk-dots), var(--dpk-paper-sunken);
1818
+ }
1819
+
1820
+ .frame-placeholder code {
1821
+ padding: 3px 7px;
1822
+ border: 1px solid var(--dpk-rule);
1823
+ border-radius: var(--dpk-radius-xs);
1824
+ background: var(--dpk-paper-raised);
1825
+ font-family: var(--dpk-mono);
1826
+ font-size: 10px;
1827
+ }
1828
+
1829
+ .parked {
1830
+ display: none;
1831
+ }
1832
+ `,Hs=`
1833
+ /*
1834
+ * The wrapper is a stretch grid (see \`.viewport ::slotted(*)\`): one child
1835
+ * fills the frame, but several would share the extra height as gaps between
1836
+ * them, so they stack from the top instead (a \`<style>\` or \`<script>\` beside
1837
+ * the one child draws nothing and does not count). A shadow tree cannot see a
1838
+ * slotted element's children, hence the document rule; \`:where\` lets the
1839
+ * author's own \`align-content\` win.
1840
+ */
1841
+ :where(
1842
+ dpk-view-prototype
1843
+ > [data-preview-id]:has(> :not(style, script, template, link) ~ :not(style, script, template, link))
1844
+ ) {
1845
+ align-content: start;
1846
+ }
1847
+
1848
+ /*
1849
+ * A preview that is an iframe is as tall as the page it shows (the element
1850
+ * measures it into the property), so the scenario view lays it out like
1851
+ * markup of its own; a window of the app view sizes it instead, and the
1852
+ * page scrolls inside. \`:where\` lets the author size it otherwise.
1853
+ */
1854
+ :where(dpk-view-prototype > iframe[data-preview-id]) {
1855
+ display: block;
1856
+ width: 100%;
1857
+ height: var(${Ri}, auto);
1858
+ border: 0;
1859
+ }
1860
+
1861
+ dpk-view-prototype > [data-preview-id]:has(dialog[${Se}][open]) {
1862
+ position: relative;
1863
+ }
1864
+
1865
+ dpk-view-prototype > [data-preview-id]:has(dialog[${Se}][open])::after {
1866
+ content: '';
1867
+ position: absolute;
1868
+ inset: 0;
1869
+ z-index: 1;
1870
+ background: color-mix(in srgb, var(--dpk-ink, #111827) 38%, transparent);
1871
+ }
1872
+
1873
+ dpk-view-prototype > [data-preview-id] dialog[${Se}][open] {
1874
+ position: absolute;
1875
+ inset: 0;
1876
+ z-index: 2;
1877
+ max-width: calc(100% - 32px);
1878
+ max-height: calc(100% - 32px);
1879
+ margin: auto;
1880
+ }
1881
+ `,Xe={kind:"off"},qs=(t,e)=>{switch(e.kind){case"toggle":return t.kind==="off"?{kind:"picking",as:"feedback"}:Xe;case"exit":return Xe;case"pick":return t.kind==="off"?t:{kind:"composing",target:e.target,body:t.kind==="composing"?t.body:"",as:t.as};case"input":return t.kind==="composing"?{...t,body:e.body}:t;case"choose":return t.kind==="off"||t.as===e.as?t:{...t,as:e.as};case"dismiss":case"submitted":return t.kind==="off"?t:{kind:"picking",as:t.as};default:return t}},Fs={width:300,height:300},Gs=360,js={width:280,height:360},Ks={width:300,height:320},Ki=(t,e)=>({previewId:t.previewId,selector:e.selector,...e.text===void 0?{}:{text:e.text},...e.url===void 0?{}:{url:e.url}}),Xi=".comment-pop:not(.ui-notes-pop)",Xs="prototype-ui-comment",Js="comment-ui-element",Ji="dpk-view-prototype-document-styles",Zi=":scope > iframe[data-preview-id], :scope > [data-preview-id] iframe",Je=t=>{const e=Si(t,document);return e===void 0?void 0:Dt(e)},Zs=24,Qs=()=>{if(document.getElementById(Ji)!==null)return;const t=Object.assign(document.createElement("style"),{id:Ji,textContent:Hs});document.head.append(t)},er=(t,e,i)=>{const n=t.ownerDocument,o=(n.defaultView??window).getComputedStyle(t),s=n!==document&&t===n.scrollingElement,r=(s||/auto|scroll/.test(o.overflowX))&&t.scrollWidth>t.clientWidth,a=(s||/auto|scroll/.test(o.overflowY))&&t.scrollHeight>t.clientHeight,d=e<0?t.scrollLeft>0:e>0&&t.scrollLeft+t.clientWidth<t.scrollWidth-1,l=i<0?t.scrollTop>0:i>0&&t.scrollTop+t.clientHeight<t.scrollHeight-1;return r&&d||a&&l},Qi=t=>{if(t.assignedSlot!==null)return t.assignedSlot;if(t.parentElement!==null)return t.parentElement;const e=t.getRootNode();return qo(e)?e.host:e===t.ownerDocument&&e!==document?je(t.ownerDocument):null},tr=(t,e)=>{let i=t;for(;i!==null;){if(i===e)return!0;i=Qi(i)}return!1};class en extends ct{static{this.styles=[ct.styles,kn,xn,Tn,An,In,Mn,Ws]}#e=Xe;#d=!1;#t=null;#r=[];#x=new En(this);#oe={app:new fe(this),activity:new fe(this),story:new fe(this)};#se=new fe(this);#U=!1;#n=null;#o=null;#E=!1;#v=!1;#S=!1;#a=null;#$=null;#T={};#A=1;#f=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{this.#X(),this.#b()});#u=null;#h=null;#m=null;#I=!1;#s=null;#_=null;#g=null;#i=null;#w=null;#V=typeof MutationObserver>"u"?null:new MutationObserver(()=>{this.#P.sync(this.querySelectorAll(Zi)),this.#G()});#z=typeof MutationObserver>"u"?null:new MutationObserver(e=>{e.some(i=>i.attributeName==="data-url")&&this.requestUpdate()});#c=null;#P=new ds({changed:()=>this.#G(),click:e=>this.#Ne(e),keydown:e=>this.#N(e),loaded:(e,i)=>this.#$e(e,i)});#Y=new Set;constructor(){super(),new pt(this,{open:()=>this.#m!==null,closesOn:e=>!e.some(i=>i instanceof Element&&this.#de(i)),ownsEscape:()=>!0,dismiss:()=>this.#D(!0)}),new pt(this,{open:()=>this.#s!==null,closesOn:e=>!e.some(i=>i instanceof Element&&(i.classList.contains("ui-notes-pop")||i.classList.contains("ui-note-badge"))),ownsEscape:()=>!0,dismiss:()=>this.#R(!0)})}definitionFor(e){return ui(e)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#N),window.addEventListener("resize",this.#O),this.addEventListener("toggle",this.#J,!0),this.addEventListener("click",this.#k,!0),this.addEventListener("auxclick",this.#k,!0),this.#V?.observe(this,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.#z?.observe(this,{subtree:!0,attributes:!0,attributeFilter:["data-url"]}),Qs()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#N),window.removeEventListener("resize",this.#O),this.removeEventListener("toggle",this.#J,!0),this.removeEventListener("click",this.#k,!0),this.removeEventListener("auxclick",this.#k,!0),this.#f?.disconnect(),this.#u=null,this.#V?.disconnect(),this.#z?.disconnect(),this.#P.disconnect(),this.#c!==null&&cancelAnimationFrame(this.#c),this.#c=null,this.#te()}renderRegions(e){const i=le(this.locale),n=te(e.state,e.navigation),o=ce(e.navigation)==="app";this.#n!==null&&this.#n.mode==="demo"!==o&&this.#ee();const s=o?this.#Ie(e,i):null;return this.#E=s!==null,this.#r=n!==void 0&&n.kind!=="story"&&(s===null||s.view.entry?.kind==="page")?He(e.state,n,e.navigation).shown.map(r=>r.id):[],this.#a!==null&&this.#a.page!==this.#r.join(" ")&&this.#te(),{sidebar:Ni(e,i,this.#oe),main:qi(e,i,{deviceSelect:this.#se,hasPreviewContent:r=>this.#Oe(r),previewUrls:this.#M(),lift:this.#n,onToggleMaximize:()=>this.#L(this.#n===null?"maximized":null),onToggleDemo:()=>this.#L(this.#n===null?"demo":null),onLiftedWheel:this.#Ae,browser:s===null?null:{...s,loading:this.#a!==null},devices:o?{choice:this.#T,zoom:this.#A,onPick:r=>{this.#T=ss(this.#T,r),this.requestUpdate()}}:null,uiComment:this.#ue(e),uiNotes:this.#ve(e,o),actions:this.#re(e),canvasEvents:{click:this.#ge,pointermove:this.#we,pointerleave:this.#ye,wheel:this.#be,scroll:this.#O}})}}updated(){super.updated(),this.#P.sync(this.querySelectorAll(Zi)),this.#Se(),this.#Ee(),this.#xe(),this.#X();const e=this.#e;if(e.kind==="composing"&&!this.#r.includes(e.target.previewId)){this.#p({kind:"dismiss"});return}this.#Te(),this.#le(),this.#S&&(this.#S=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus()),this.#b(),this.#fe();const i=e.kind==="composing"&&!this.#d;if(this.#d=e.kind==="composing",e.kind!=="composing"||this.#t===null)return;const n=this.renderRoot.querySelector(Xi);if(!n)return;const o=this.#t.ownerDocument===document?this.#t:this.renderRoot.querySelector(".ui-picked");o!==null&&(this.#x.open(n,o,Fs,{placement:"right-start"}),i&&n.querySelector("textarea")?.focus({preventScroll:!0}))}#re(e){const i=ii(e.state,this.#r),n=i.map(s=>s.screen.id).join(" "),o=i.length>0&&this.#h===n;return{groups:i,open:o,toggle:()=>o?this.#D(!1):this.#ae(n),run:(s,r)=>this.#ce(s,r)}}#ae(e){this.#h=e,this.requestUpdate()}#D(e){this.#h!==null&&(this.#h=null,this.#I=e,this.requestUpdate())}#de(e){return e.classList.contains("actions-menu")||e.getAttribute("data-role")==="actions"}#le(){const e=this.renderRoot.querySelector(".actions-menu"),i=this.renderRoot.querySelector('[data-role="actions"]');if(e===null){this.#m=null,this.#I&&i?.focus({preventScroll:!0}),this.#I=!1;return}e===this.#m||i===null||(this.#m=e,this.#x.open(e,i,js),e.querySelector('[role="menuitem"]')?.focus({preventScroll:!0}))}#ce(e,i){this.#D(!0);const n=ii(this.derivation.state,this.#r).find(d=>d.screen.id===e),o=n?.actions.find(d=>d.id===i);if(n===void 0||o===void 0)return;const r=this.#y().filter(d=>n.previewIds.includes(d.getAttribute("data-preview-id")??"")).flatMap(d=>{const l=new CustomEvent("dpk-action",{bubbles:!0,detail:{id:o.id,screen:n.screen.id}});if(d.localName==="iframe")return d.dispatchEvent(l),[];const p=[...Lo(d,o.fill??{}),...Uo(d,o.click??[])];return d.dispatchEvent(l),[p]}),a=(r[0]??[]).filter(d=>r.every(l=>l.includes(d)));a.length!==0&&console.warn(`[dev-process-kit] <dpk-view-prototype>: action "${o.id}" of screen "${n.screen.id}" found nothing on screen for: ${a.join(", ")}`)}getContextMenuItems(e){const i=e.origin??null;return!(i instanceof Element)||this.#r.length===0||!this.#pe(i)?null:[{id:Xs,entries:[{kind:"item",id:Js,label:le(this.locale).commentOnElement,run:()=>{this.#e.kind==="off"&&this.#p({kind:"toggle"})}}]}]}#pe(e){const i=this.renderRoot.querySelector(".stage");return i!==null&&tr(e,i)?!0:this.#y().some(n=>n===e||n.contains(e))}#ue(e){const i=this.#e,n=i.kind==="composing"?i.target:void 0,o=n?E(e.state,n.previewId)?.preview:void 0,s=n?re(n):void 0,r=i.kind==="composing"&&i.as==="note"?(o?.notes??[]).filter(a=>a.selector===n?.selector).map(a=>a.body):e.comments.filter(a=>a.target.type===O&&a.target.id===s).map(a=>st(a));return{mode:i,pins:i.kind==="off"?[]:Gt(e.comments,this.#r),...n&&o?{targetLabel:Be(o,n)}:{},notes:r,composer:Ln(this.locale),send:a=>this.#p(a),submit:a=>this.#he(e.state,a)}}#p(e){const i=qs(this.#e,e);i!==this.#e&&(this.#e=i,i.kind!=="composing"&&(this.#t=null),i.kind!=="off"&&(this.#s=null),this.requestUpdate())}#he(e,i){const n=this.#e;if(n.kind!=="composing")return;(n.as==="note"?this.dispatch(H.addUiNote(n.target,at("note",Mt(e)),i,new Date().toISOString())):this.dispatch({type:Sn,target:{type:O,id:re(n.target)},payload:{body:i}})).ok&&this.#p({kind:"submitted"})}#ve(e,i){const n=i?[]:uo(e.state,this.#r),o=this.#e.kind==="off"&&this.#s!==null?n.find(r=>ie(r)===this.#s)??null:null;o===null&&(this.#s=null);const s=this.#i;return s!==null&&!o?.notes.some(r=>r.id===s.noteId)&&(this.#i=null),{badges:n,open:o,toggle:r=>{const a=ie(r);this.#s===a?this.#R(!1):(this.#s=a,this.#i=null,this.requestUpdate())},close:()=>this.#R(!0),remove:(r,a)=>{const d=r.notes.find(l=>l.id===a);d!==void 0&&this.dispatch(H.deleteUiNote(Ki(r,d),a))},editing:this.#i,edit:(r,a)=>{this.#i={noteId:r,body:a},this.#w={noteId:r,part:"editor"},this.requestUpdate()},input:r=>{this.#i!==null&&(this.#i={...this.#i,body:r}),this.requestUpdate()},save:()=>{const r=this.#i,a=o?.notes.find(l=>l.id===r?.noteId),d=r?.body.trim()??"";o===null||r===null||a===void 0||d===""||(d!==a.body&&this.dispatch(H.setUiNoteBody(Ki(o,a),a.id,d)),this.#B())},cancel:()=>this.#B()}}#B(){this.#i!==null&&(this.#w={noteId:this.#i.noteId,part:"edit"},this.#i=null,this.requestUpdate())}#R(e){this.#s!==null&&(this.#g=e?this.#s:null,this.#s=null,this.requestUpdate())}#fe(){const e=this.renderRoot.querySelector(".ui-notes-pop");if(e===null){this.#_=null,this.#g!==null&&this.#W(this.#g)?.focus({preventScroll:!0}),this.#g=null;return}const i=this.#W(e.dataset.key??""),n=this.#w;this.#w=null,n!==null&&e.querySelector(`li[data-id="${CSS.escape(n.noteId)}"]`)?.querySelector(n.part==="editor"?"textarea":'[data-role="edit-note"]')?.focus({preventScroll:!0}),!(e===this.#_||i===null)&&(this.#_=e,this.#x.open(e,i,Ks,{placement:"bottom-start"}),e.querySelector('[data-role="close-notes"]')?.focus({preventScroll:!0}))}#W(e){return Array.from(this.renderRoot.querySelectorAll(".ui-note-badge")).find(i=>i.dataset.key===e)??null}#H(e){const i=e.composedPath(),n=i[0];if(n instanceof Element&&n.classList.contains("ui-catcher"))return this.#me(e.clientX,e.clientY);const o=i.find(s=>s instanceof Element&&s.parentElement===this&&s.hasAttribute("data-preview-id"));return!o||!(n instanceof Element)||!o.contains(n)?null:this.#F(n,o)}#me(e,i){const n=this.#q(e,i);return n===null?null:this.#F(n.element,n.wrapper)}#q(e,i){if(typeof document.elementsFromPoint!="function")return null;const n=this.#y();for(const o of document.elementsFromPoint(e,i)){const s=n.find(r=>r.contains(o));if(s!==void 0)return{element:Go(o,e,i),wrapper:s}}return null}#F(e,i){const n=i.getAttribute("data-preview-id");if(!n)return null;const o=jo(e,i),s=Ko(o,i),r=Je(o);return{element:o,target:{previewId:n,selector:s.selector,...s.text===void 0?{}:{text:s.text},...r===void 0?{}:{url:r}}}}#y(){return Array.from(this.children).filter(e=>{const i=e.getAttribute("data-preview-id");return i!==null&&this.#r.includes(i)})}#ge=e=>{if(this.#e.kind==="off")return;const i=this.#H(e);i&&(e.preventDefault(),e.stopPropagation(),this.#t=i.element,this.#p({kind:"pick",target:i.target}))};#we=e=>{if(this.#e.kind==="off")return;const i=this.#H(e);this.#C(".ui-hover",i?.element??null)};#ye=()=>{this.#C(".ui-hover",null)};#be=e=>{const i=e.composedPath()[0];if(!(i instanceof Element)||!i.classList.contains("ui-catcher"))return;const n=this.renderRoot.querySelector(".canvas");let o=this.#q(e.clientX,e.clientY)?.element??null;for(;o!==null&&o!==n;){if(er(o,e.deltaX,e.deltaY)){e.preventDefault(),o.scrollBy({left:e.deltaX,top:e.deltaY});return}o=Qi(o)}};#N=e=>{e.key!=="Escape"||e.defaultPrevented||(this.#e.kind!=="off"?this.#p({kind:"exit"}):this.#L(null))};#O=()=>{this.#b()};#G(){this.#c!==null||typeof requestAnimationFrame!="function"||(this.#c=requestAnimationFrame(()=>{this.#c=null,this.#b()}))}#b(){const e=this.renderRoot.querySelector(".canvas");if(e&&this.#j(e,".ui-note-badge","left"),this.#e.kind==="off")return;const i=this.#ke();if((i===null||i.isConnected)&&this.#C(".ui-picked",i),!e)return;const n=this.renderRoot.querySelector(".ui-catcher");if(n){n.style.width=`${e.scrollWidth}px`,n.style.height=`${e.scrollHeight}px`;const o=[...this.renderRoot.querySelectorAll(".demo-controls")].map(s=>s.getBoundingClientRect());n.style.clipPath=Ro(n.getBoundingClientRect(),o)}this.#j(e,".ui-pin","right")}#ke(){const e=this.#e;if(e.kind!=="composing"||this.#t===null||this.#t.isConnected)return this.#t;const i=this.#Z(e.target.previewId),n=i?Ei(i,e.target.selector):null,o=e.target.url;return n!==null&&(o===void 0||Je(n)===o)&&(this.#t=n),this.#t}#j(e,i,n){for(const o of this.renderRoot.querySelectorAll(i)){const s=this.#Z(o.dataset.preview??""),r=s?Ei(s,o.dataset.selector??""):null,a=o.dataset.url,d=r!==null&&(a===void 0||Je(r)===a),l=r!==null&&d?xi(r,document):null;if(!l||l.width===0&&l.height===0){o.hidden=!0;continue}const p=this.#K(e);o.hidden=!1,o.style.left=`${(n==="left"?l.left:l.left+l.width)-p.left}px`,o.style.top=`${l.top-p.top}px`}}#C(e,i){const n=this.renderRoot.querySelector(e),o=this.renderRoot.querySelector(".canvas");if(!n||!o)return;const s=i===null?null:xi(i,document);if(!s){n.hidden=!0;return}const r=this.#K(o);n.hidden=!1,n.style.left=`${s.left-r.left}px`,n.style.top=`${s.top-r.top}px`,n.style.width=`${s.width}px`,n.style.height=`${s.height}px`}#K(e){const i=e.getBoundingClientRect();return{left:i.left+e.clientLeft-e.scrollLeft,top:i.top+e.clientTop-e.scrollTop}}#xe(){const e=this.renderRoot.querySelector(".canvas");e===this.#u||this.#f===null||(this.#u!==null&&this.#f.unobserve(this.#u),this.#u=e,e!==null&&this.#f.observe(e))}#X(){const e=this.renderRoot.querySelector('.frame[data-window="device"]'),i=e?.closest(".canvas");if(!e||!(i instanceof HTMLElement))return;const n=getComputedStyle(e),o={width:parseFloat(n.getPropertyValue("--device-width")),height:parseFloat(n.getPropertyValue("--device-height"))},s=getComputedStyle(i),r=i.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight),a=this.#n?.mode==="demo",d=a?Zs*2:0,l=as(o,{width:r-d,...a?{height:i.clientHeight-d}:{}});l!==this.#A&&(this.#A=l,this.requestUpdate())}#Ee(){for(const e of this.querySelectorAll(":scope > [data-preview-id]"))for(const i of e.querySelectorAll("dialog"))vi(i),fi(this,i)}#J=e=>{const i=e.target;!(i instanceof HTMLDialogElement)||!i.open||Array.from(this.children).some(n=>n.hasAttribute("data-preview-id")&&n.contains(i))&&(vi(i),fi(this,i))};#Z(e){return Array.from(this.children).find(i=>i.getAttribute("data-preview-id")===e)}#M(){const e=new Map;for(const i of this.children){const n=i.getAttribute("data-preview-id"),o=i.getAttribute("data-url");n!==null&&o!==null&&o!==""&&e.set(n,o)}return e}#Se(){if(this.#U||this.renderRoot.querySelector(".stage")===null)return;this.#U=!0;const e=this.derivation.state,i=[];for(const n of Array.from(this.children)){const o=n.getAttribute("data-preview-id");if(o!==null)for(const s of n.querySelectorAll("a, [data-dpk-navigate]")){const r=ni(e,{href:s.getAttribute("href"),navigate:s.getAttribute("data-dpk-navigate")});if(r===null)continue;const a=(s.textContent??"").replace(/\s+/g," ").trim().slice(0,40),d=s.getAttribute("data-dpk-navigate")??s.getAttribute("href")??"(no href)";i.push(` ${o}: <${s.tagName.toLowerCase()}> "${a}" \u2192 ${d} (${r})`)}}this.#Q(i)}#$e(e,i){const n=Si(i.documentElement,document)??i.URL;if(this.#Y.has(n))return;this.#Y.add(n);const o=e.getAttribute("data-preview-id")??e.closest("[data-preview-id]")?.getAttribute("data-preview-id")??"?",s=this.derivation.state,r=[];for(const a of i.querySelectorAll("[data-dpk-navigate]")){const d=a.getAttribute("data-dpk-navigate"),l=ni(s,{href:null,navigate:d});if(l===null)continue;const p=(a.textContent??"").replace(/\s+/g," ").trim().slice(0,40);r.push(` ${o} @ ${n}: <${a.localName}> "${p}" \u2192 ${d} (${l})`)}this.#Q(r)}#Q(e){e.length!==0&&console.warn(`[dev-process-kit] <dpk-view-prototype>: ${e.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"):
1882
+ `+e.join(`
1883
+ `))}#L(e){if(e===(this.#n?.mode??null))return;const i=this.renderRoot.querySelector(".stage"),n=this.#n?.height??i?.offsetHeight??0;this.#ee(),e!==null&&(this.#n={mode:e,height:n}),this.#h=null,this.#s=null,e!==null&&this.#e.kind==="composing"&&($n(this.renderRoot.querySelector(Xi)),this.#d=!1),this.requestUpdate()}#ee(){this.#n=null,this.#$=null}#Te(){const e=this.renderRoot.querySelector(".stage");if(!(this.#n===null||!e||typeof e.showPopover!="function")&&e!==this.#$){this.#$=e;try{e.showPopover()}catch{}}}#Ae=e=>{const i=this.renderRoot.querySelector(".canvas");(i===null||!e.composedPath().includes(i))&&e.preventDefault()};#Ie(e,i){const n=$i(e.state,e.navigation);this.#o=this.#o===null?n===null?null:Un(n):gt(this.#o,{kind:"observe",page:n});const o=this.#o;if(o===null)return null;const s=wt(o),r=s?.kind!=="page"&&o.seen!==null;if(n===null&&!r)return null;const a=es(o)??n;return{view:Ii(e.state,o,i,a,this.#M()),shortcuts:s?.kind==="new-tab"?ts(e.state,a):[],switcher:this.#v,send:d=>this.#Pe(d)}}#l(e){if(this.#o===null)return;const i=gt(this.#o,e);if(i===this.#o)return;this.#o=i;const n=wt(i);n?.kind==="page"&&this.#_e(n.page),this.requestUpdate()}#_e(e){this.navigate({screen:e.screen??null,preview:e.preview??null})}#Pe(e){switch(e.kind){case"reload":this.#Re();return;case"address":this.#De(e.input);return;case"back":case"forward":case"new-tab":this.#v=!1,this.#l({kind:e.kind});return;case"switcher":this.#v=e.open,this.requestUpdate();return;case"activate":this.#v=!1,this.#S=e.focus===!0,this.#l({kind:"activate",id:e.id}),this.requestUpdate();return;case"close-tab":this.#l({kind:e.kind,id:e.id});return;case"visit":this.#l({kind:"visit",page:e.page});return;default:return}}#De(e){const i=this.#o;if(i===null)return;const n=this.derivation.state,o=this.#M(),s=Ii(n,i,le(this.locale),null,o).url||"https://page.example.com/",r=Jo(n,e,s,o);if(r!==null){this.#l({kind:"visit",page:r});return}this.#l({kind:"unreachable",url:Vn(e,s)})}#Re(){if(this.#a!==null)return;const e=setTimeout(()=>{this.#a=null;for(const i of this.#y()){const n=ue(i);if(n!==null){n.location.reload();continue}for(const o of i.querySelectorAll("form"))o.reset();for(const o of i.querySelectorAll("dialog"))o.close();i.scrollTop=0,i.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser .viewport")?.scrollTo?.({top:0}),this.requestUpdate()},Gs);this.#a={page:this.#r.join(" "),timer:e},this.requestUpdate()}#te(){this.#a!==null&&(clearTimeout(this.#a.timer),this.#a=null)}#k=e=>{if(!this.#E||this.#e.kind!=="off"||this.#o===null||e.type==="auxclick"&&e.button!==1)return;const i=this.#ne(e);if(i===null)return;const n=e.metaKey||e.ctrlKey||e.button===1;!i.blank&&!n||(e.preventDefault(),e.stopPropagation(),this.#ie(i.patch,n))};#Ne(e){if(this.#e.kind!=="off"||e.type==="auxclick"&&e.button!==1)return;const i=this.#ne(e,{frame:!0});if(i===null)return;e.preventDefault();const n=e.metaKey||e.ctrlKey||e.button===1;this.#E&&this.#o!==null&&(i.blank||n)?this.#ie(i.patch,n):e.type==="click"&&this.navigate(i.patch)}#ie(e,i){const n=$i(this.derivation.state,Re(this.hashFor(e)));if(n===null){i||this.navigate(e);return}this.#l({kind:"open-tab",entry:{kind:"page",page:n},background:i})}#ne(e,{frame:i=!1}={}){const n=e.composedPath();if(!(i||n.some(s=>s instanceof Element&&s.parentElement===this&&s.hasAttribute("data-preview-id"))))return null;for(const s of n){if(!Ho(s)||s===this)break;const r=s,a=r.getAttribute("data-dpk-navigate"),d=!i&&r instanceof HTMLAnchorElement?r.getAttribute("href"):null,l=a??(d?.startsWith("#")?d:null);if(l===null)continue;const p=a!==null&&!a.includes("=")?`step=${a}`:l;return{patch:{...Re(p)},blank:r.getAttribute("target")==="_blank"}}return null}#Oe(e){return Array.from(this.querySelectorAll("[data-preview-id]")).some(i=>i.getAttribute("data-preview-id")===e)}}const tn=()=>{customElements.get("dpk-view-prototype")||customElements.define("dpk-view-prototype",en)},ir=Object.freeze(Object.defineProperty({__proto__:null,DpkViewPrototype:en,VIEWPORT_MIN_HEIGHT:Wi,VIEWPORT_WIDTH:Bi,allScreens:B,allStepIds:Lt,applyPrototypeAction:Vt,definePrototypeElement:tn,describePrototypeAction:Ht,emptyPrototypeBase:Nt,findActivity:U,findPreview:E,findScreen:L,findStep:S,findStory:$,flattenSteps:W,parsePrototypeBase:Rt,prototypeAction:H,prototypeActions:w,prototypeBaseSchema:It,prototypeCommentTargets:oi,prototypeDefinitionFor:ui,prototypeMessages:le,prototypePageHeading:si,prototypeTargetLabel:Ft,prototypeTitle:qe,renderFrame:Ke,renderNav:Ni,renderStage:qi,resolvePrototypeNavigation:Ee,serializePrototypeAction:qt},Symbol.toStringTag,{value:"Module"}));export{tn as d,ir as i};