dev-process-kit 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/boards.js +1 -1
- package/dist/chunks/{shared-CKIn5p8J.js → shared-4JaCIu01.js} +1 -1
- package/dist/chunks/{shared-BDAaq_FM.js → shared-C-ujfGnT.js} +1 -1
- package/dist/chunks/{shared-CkOyWfwZ.js → shared-CHQBlCl0.js} +1 -1
- package/dist/chunks/{shared-DF9b2Hdv.js → shared-CMWEqwI3.js} +1 -1
- package/dist/chunks/shared-CsLKVrK7.js +6912 -0
- package/dist/chunks/{shared-DRCtnrZO.js → shared-D0_BoWj3.js} +1 -1
- package/dist/chunks/{shared-BBKduY__.js → shared-D1ZujbZA.js} +1 -1
- package/dist/chunks/{shared-DnSwEx91.js → shared-D2fmf6zb.js} +1 -1
- package/dist/chunks/{shared-lPeFJij5.js → shared-D80rPPNF.js} +1 -1
- package/dist/chunks/{shared-O0o2ls6e.js → shared-DErYmK9C.js} +9 -2
- package/dist/chunks/{shared-Cd0_rxlc.js → shared-DPD_cXES.js} +1 -1
- package/dist/chunks/{shared-CTxoriaS.js → shared-HkbNG84_.js} +1 -1
- package/dist/chunks/{shared-B2S6Vsb5.js → shared-JOvfFoxb.js} +1 -1
- package/dist/chunks/shared-KHA87RsJ.js +3360 -0
- package/dist/chunks/{shared-DZNeJT2R.js → shared-SjAP9bK0.js} +1 -1
- package/dist/chunks/{shared-BWIla41c.js → shared-_0Ev6y6i.js} +127 -127
- package/dist/chunks/shared-lVXxL9i3.js +1 -0
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/views/delegation-poker.js +1 -1
- package/dist/views/plain.js +1 -1
- package/dist/views/prototype.js +1 -1
- package/dist/views/slides.js +1 -1
- package/dist/views/task-board.js +1 -1
- package/dist/views/usm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-Bj6Oqtla.js +0 -2530
- package/dist/chunks/shared-CBzul9Ae.js +0 -1
- package/dist/chunks/shared-zNs0yAfd.js +0 -6724
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a4 as e}from"./shared-
|
|
1
|
+
import{a4 as e}from"./shared-_0Ev6y6i.js";const r=e`
|
|
2
2
|
/* ------------------------------------------------------------ count */
|
|
3
3
|
|
|
4
4
|
/* How many: a small rounded mono figure, beside a tab or a heading. data-size='sm' is quieter. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a4 as e,a$ as t,b0 as o,b1 as n}from"./shared-
|
|
1
|
+
import{a4 as e,a$ as t,b0 as o,b1 as n}from"./shared-_0Ev6y6i.js";import{a as d,c as i}from"./shared-D0_BoWj3.js";import{m as p}from"./shared-C-ujfGnT.js";const r=e`
|
|
2
2
|
/*
|
|
3
3
|
* A chart: a framed plot with its head above it. CSS only — the author draws
|
|
4
4
|
* the SVG and this styles it, so a line chart reads as the kit's own: rules
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as X,L as g,C as $,g as ee,al as S,a5 as d,ag as r,aZ as te,aw as ie,aD as ne,t as E,a4 as se,V as T}from"./shared-
|
|
1
|
+
import{_ as X,L as g,C as $,g as ee,al as S,a5 as d,ag as r,aZ as te,aw as ie,aD as ne,t as E,a4 as se,V as T}from"./shared-_0Ev6y6i.js";import{a as ae}from"./shared-D1ZujbZA.js";import{m as oe,q as N,k as p,h as C,j as u,C as re,v as de,w as le,x as ce,d as pe,o as ue}from"./shared-CJZKj_HI.js";const q=["title","section","content"],he=N({id:re,layout:p(ce(q),"content"),title:de(u(),le(1)),subtitle:p(u(),""),points:p(C(u()),[]),notes:p(u(),"")}),P=N({title:p(u(),""),slides:p(C(he),[])}),A=t=>{const e=oe(P,t),i=new Set;for(const n of e.slides){if(i.has(n.id))throw new Error(`duplicate slide id: ${n.id}`);i.add(n.id)}return{title:e.title,slides:e.slides}},z=()=>({title:"",slides:[]}),l=(t,e)=>e===void 0?-1:t.slides.findIndex(i=>i.id===e),D=(t,e)=>t.slides[l(t,e)],c="SET_SLIDE_NOTES",me=ue({notes:u()}),b={[c]:pe(c,"slide",me)},H={setNotes:(t,e)=>({type:c,target:{type:"slide",id:t},payload:{notes:e}})},M=(t,e)=>{switch(e.type){case c:{if(e.target.type!=="slide")return null;const i=l(t,e.target.id);if(i===-1)return null;const n=b[c].parse(e);if(n===null)return null;const{notes:a}=n.payload;return{...t,slides:t.slides.map((s,o)=>o===i?{...s,notes:a}:s)}}default:return null}},v=X({en:{wholeDeck:"Whole deck",slideGroup:"Slide",outline:"Slides",previous:"Previous slide",next:"Next slide",position:(t,e)=>`Slide ${t} of ${e}`,present:"Present",presentation:"Presentation",exitPresentation:"Exit presentation",speakerNotes:"Speaker notes",speakerNotesHint:"Only the presenter sees these. They are never projected.",speakerNotesPlaceholder:"What to say on this slide",saveNotes:"Save notes",commentOnSlide:"Comment on this slide",commentPlaceholder:"A question, or what should change (passed to the agent)",addComment:"Add comment",deleteComment:"Delete this comment",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"Full screen",fullscreenHint:"\u2190 \u2192 to move \xB7 Esc to leave",noSlidesBefore:"There are no slides yet. Add them to ",noSlidesAfter:" in the base data."},ja:{wholeDeck:"\u30C7\u30C3\u30AD\u5168\u4F53",slideGroup:"\u30B9\u30E9\u30A4\u30C9",outline:"\u30B9\u30E9\u30A4\u30C9",previous:"\u524D\u306E\u30B9\u30E9\u30A4\u30C9",next:"\u6B21\u306E\u30B9\u30E9\u30A4\u30C9",position:(t,e)=>`${e} \u679A\u4E2D ${t} \u679A\u76EE`,present:"\u30D7\u30EC\u30BC\u30F3",presentation:"\u30D7\u30EC\u30BC\u30F3\u8868\u793A",exitPresentation:"\u30D7\u30EC\u30BC\u30F3\u3092\u7D42\u4E86",speakerNotes:"\u30B9\u30D4\u30FC\u30AB\u30FC\u30CE\u30FC\u30C8",speakerNotesHint:"\u767A\u8868\u8005\u3060\u3051\u306B\u898B\u3048\u307E\u3059\u3002\u30B9\u30E9\u30A4\u30C9\u306B\u306F\u6295\u5F71\u3055\u308C\u307E\u305B\u3093\u3002",speakerNotesPlaceholder:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u3067\u8A71\u3059\u3053\u3068",saveNotes:"\u30CE\u30FC\u30C8\u3092\u4FDD\u5B58",commentOnSlide:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u306B\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u8CEA\u554F\u3084\u3001\u5909\u3048\u3066\u307B\u3057\u3044\u3053\u3068\uFF08Agent \u306B\u6E21\u308B\uFF09",addComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",deleteComment:"\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"\u5168\u753B\u9762\u8868\u793A",fullscreenHint:"\u2190 \u2192 \u3067\u79FB\u52D5 \xB7 Esc \u3067\u623B\u308B",noSlidesBefore:"\u30B9\u30E9\u30A4\u30C9\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base data \u306E ",noSlidesAfter:" \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),f="present",k="1",m=t=>t[f]===k,O=t=>({[f]:t?k:null}),j=t=>t.title===""?"Slides":t.title,x=(t,e)=>`${e+1}. ${t.title}`,L=(t,e,i)=>{switch(i.type){case"slide":{const n=l(e,i.id),a=e.slides[n];return a===void 0?i.id:x(a,n)}case"page":return t.wholeDeck;default:return i.id}},F=(t,e,i)=>{const n=L(t,i,e.target);return e.type===c?{title:t.speakerNotes,targetLabel:n,tone:"update"}:{title:e.type,targetLabel:n,tone:"meta"}},_=t=>`${t.type} ${g(t.target)} ${JSON.stringify(t.payload)}`,K=(t,e)=>e.slides.map((i,n)=>({value:g({type:"slide",id:i.id}),label:x(i,n),group:t.slideGroup})),R=(t,e,i)=>{const n=l(e,i.slide),a=e.slides[n];return a===void 0?null:{value:g({type:"slide",id:a.id}),label:x(a,n),group:t.slideGroup}},B=(t,e)=>{const i=t.slides[l(t,e.slide)]??t.slides[0],n={...e};return i?n.slide=i.id:delete n.slide,(i===void 0||!m(e))&&delete n[f],n},w=(t,e)=>{const i=l(t,e.slide),n=i===-1?0:i,a=t.slides[n];return a===void 0?null:{slide:a,index:n,total:t.slides.length,previous:t.slides[n-1],next:t.slides[n+1]}},ge=(t,e)=>t.filter(i=>i.type===$&&i.target.type==="slide"&&i.target.id===e).map(i=>({id:i.id,body:ee(i)})).filter(i=>i.body!==""),G=(t,e)=>{switch(e.type){case"slide":return D(t,e.id)!==void 0;case"page":return!0;default:return!1}},I=t=>{const e=v(t);return{kind:"view",name:"slides",label:"Slides",addable:!1,parseBase:A,emptyBase:z,actions:b,apply:M,hasTarget:G,describe:(i,n)=>F(e,i,n),serialize:_,resolveNavigation:B,navigationFor:(i,n)=>n.type==="slide"?{slide:n.id}:null,commentTargets:i=>K(e,i),currentTarget:(i,n)=>R(e,i,n),title:j}},fe={ArrowRight:"next",PageDown:"next",ArrowLeft:"previous",PageUp:"previous",Home:"first",End:"last"},U=t=>t.altKey===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0?null:fe[t.key]??null,Y=(t,e,i)=>{const n=t.slides.length-1;if(n<0)return;const a=Math.max(l(t,e),0),s={next:Math.min(a+1,n),previous:Math.max(a-1,0),first:0,last:n}[i];return t.slides[s]?.id},be=(t,e)=>{const{state:i,navigation:n}=t,a=n.slide;return r`
|
|
2
2
|
<nav class="outline" aria-label=${e.outline}>
|
|
3
3
|
<div class="outline-head">
|
|
4
4
|
<span class="dpk-label">${e.outline}</span>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a6 as o,a4 as d,x as p,ag as u}from"./shared-
|
|
1
|
+
import{a6 as o,a4 as d,x as p,ag as u}from"./shared-_0Ev6y6i.js";import{v as h,L as k,Q as f,j as m}from"./shared-CJZKj_HI.js";const g={github:o`<path fill-rule="evenodd" d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path>`,gitlab:o`<path d="M8 15 1.2 9.9a.7.7 0 0 1-.25-.78L2.7 2.6a.35.35 0 0 1 .66 0L5.1 7.6h5.8l1.74-5a.35.35 0 0 1 .66 0l1.75 6.52a.7.7 0 0 1-.25.78z"></path>`,jira:o`<path d="M14.6 7.4 8.6 1.4 8 .8 3.5 5.3 1.4 7.4a.85.85 0 0 0 0 1.2l4.1 4.1L8 15.2l4.5-4.5.07-.07 2.03-2.03a.85.85 0 0 0 0-1.2zM8 9.9 5.9 8 8 5.9 10.1 8z"></path>`,linear:o`<path d="M1.2 9.4a6.9 6.9 0 0 0 5.4 5.4zM1 7.3l7.7 7.7a7 7 0 0 0 1.9-.5L1.5 5.4a7 7 0 0 0-.5 1.9zm1.2-3.1 9.6 9.6a7 7 0 0 0 1.2-1.1L3.3 3a7 7 0 0 0-1.1 1.2zM4.3 2.3a7 7 0 1 1 9.4 9.4z"></path>`,figma:o`<path d="M5.5 1h2.3v4.6H5.5a2.3 2.3 0 1 1 0-4.6zm2.3 0h2.3a2.3 2.3 0 1 1 0 4.6H7.8zm2.3 4.6a2.3 2.3 0 1 1 0 4.6 2.3 2.3 0 0 1 0-4.6zM5.5 5.6h2.3v4.6H5.5a2.3 2.3 0 1 1 0-4.6zm0 4.6h2.3v2.3a2.3 2.3 0 1 1-2.3-2.3z"></path>`,notion:o`<path fill-rule="evenodd" d="M2.5 1.6 11 1c1 0 1.3.1 2 .6l2.1 1.5c.4.3.5.4.5.7v9.6c0 .7-.3 1.1-1.1 1.2l-9.4.6c-.6 0-.9-.1-1.2-.5L1.9 12c-.3-.5-.5-.8-.5-1.3V2.8c0-.6.3-1.1 1.1-1.2zM5 4.4v8.9l8.6-.5V4zm1 1.2 2.9-.2 3 4.7V5.6l-.8-.1v-.5l2-.1v.6l-.6.1v6.1l-.9.1-3.5-5.4v4.9l.8.2v.5l-2.3.1v-.5l.6-.2V6.4l-.8-.1z"></path>`},x=i=>i==="web"?p():u`<svg class="link-mark" viewBox="0 0 16 16" aria-hidden="true">${g[i]}</svg>`,v=d`
|
|
2
2
|
.link-mark {
|
|
3
3
|
fill: currentColor;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as G,a4 as E,a7 as D,O as I,i as Y,a3 as Et,a8 as V,ai as Dt,a5 as p,ag as l,aQ as It,al as b,B as X,aj as At,b3 as Lt,r as Ot,q as Bt,w as J,u as qt,k as Mt}from"./shared-
|
|
1
|
+
import{_ as G,a4 as E,a7 as D,O as I,i as Y,a3 as Et,a8 as V,ai as Dt,a5 as p,ag as l,aQ as It,al as b,B as X,aj as At,b3 as Lt,r as Ot,q as Bt,w as J,u as qt,k as Mt}from"./shared-_0Ev6y6i.js";import{o as Ut}from"./shared-D4PPk0Dk.js";import{m as _t,s as A,q as C,o as L,k as w,J as Q,v as y,w as k,j as g,A as O,h as T,n as Z,R as B,g as Nt,x as tt}from"./shared-CJZKj_HI.js";const zt={active:[],match:"single"},Pt=(s,t)=>t.active.length===0?!0:t.match==="all"?t.active.every(e=>s.includes(e)):t.active.some(e=>s.includes(e)),q=s=>{try{return s.split("/").map(t=>decodeURIComponent(t))}catch{return null}},et="BC:",jt=s=>`${et}${s}`,$={kind:"idle"},M="text/plain",Ht=s=>`${s.type}:${s.id}`,rt=(s,t)=>{const e=(s??"").trim();if(e.length===0)return null;const r=e.indexOf(":");if(r<0)return{type:t,id:e};const a=e.slice(0,r),i=e.slice(r+1);return a.length===0||i.length===0?null:{type:a,id:i}},st=(s,t)=>t<=s.top+s.height/2?"before":"after";class Ft{#e;#r=$;#n;constructor(t){this.#e=t,t.addController(this)}hostDisconnected(){this.reset()}get state(){return this.#r}get item(){return this.#r.kind==="dragging"?this.#r.item:null}isDragging(t,e){const r=this.item;return r!==null&&r.type===t&&r.id===e}isOver(t){return this.#r.kind!=="idle"&&this.#r.over===t}reset(){clearTimeout(this.#n),this.#n=void 0,this.#t($)}source(t){return{dragstart:e=>{e.dataTransfer&&(e.dataTransfer.setData(M,Ht(t)),e.dataTransfer.effectAllowed="move"),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#n=void 0,this.#t({kind:"dragging",item:t,over:null})},0)},dragend:()=>this.reset()}}target(t){return{dragenter:r=>{this.#i(t.accepts)&&(r.preventDefault(),this.#a(t.key))},dragover:r=>{this.#i(t.accepts)&&(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),this.#a(t.key))},dragleave:()=>{this.isOver(t.key)&&this.#a(null)},drop:r=>{r.preventDefault();const a=rt(r.dataTransfer?.getData(M),t.accepts)??this.item;if(this.#t($),!a||a.type!==t.accepts)return;const i=t.hovered?.(r)??null;t.onDrop({item:{type:t.accepts,id:a.id},hoveredId:i?.id??null,place:i?st(i.element.getBoundingClientRect(),r.clientY):"end",event:r})}}}combine(t,e){const r=()=>{const a=this.item!==null;return e.flatMap(([i,o])=>a||i===t?[o]:[])};return{dragenter:a=>r().forEach(i=>i.dragenter(a)),dragover:a=>r().forEach(i=>i.dragover(a)),dragleave:()=>e.forEach(([,a])=>a.dragleave()),drop:a=>{const i=rt(a.dataTransfer?.getData(M),t)?.type??this.item?.type,o=e.find(([n])=>n===i)?.[1];if(o){o.drop(a);return}a.preventDefault(),this.#t($)}}}#i(t){const e=this.item;return e===null||e.type===t}#a(t){const e=this.#r;if(e.kind==="dragging"){e.over!==t&&this.#t({...e,over:t});return}if(t===null){e.kind==="receiving"&&this.#t($);return}(e.kind==="idle"||e.over!==t)&&this.#t({kind:"receiving",over:t})}#t(t){this.#r!==t&&(this.#r=t,this.#e.requestUpdate())}}const R=(s,t,e,r)=>{const i=s.filter(c=>c!==t).at(-1)??null;if(e===null||r==="end")return i;const o=s.indexOf(t),n=s.indexOf(e);if(n<0)return i;const d=c=>c<=0?null:s.at(c-1)??null;return o>=0?o<n?e:d(n):r==="after"?e:d(n)},at=(s,t)=>new Intl.DateTimeFormat(s,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)),Kt=G({en:{heading:"Comments",commentsOn:s=>`Comments on \u201C${s}\u201D`,commentCountAria:s=>`${s} comment${s===1?"":"s"}`,empty:"No comments yet.",add:"Add comment",cancel:"Cancel",deleteComment:"Delete comment",sendFailed:"Could not save the comment.",commentDate:s=>at("en-US",s)},ja:{heading:"\u30B3\u30E1\u30F3\u30C8",commentsOn:s=>`\u300C${s}\u300D\u306E\u30B3\u30E1\u30F3\u30C8`,commentCountAria:s=>`\u30B3\u30E1\u30F3\u30C8 ${s} \u4EF6`,empty:"\u30B3\u30E1\u30F3\u30C8\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",add:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",deleteComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",sendFailed:"\u30B3\u30E1\u30F3\u30C8\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",commentDate:s=>at("ja-JP",s)}}),Wt=E`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
}
|
|
@@ -720,11 +720,18 @@ import{_ as G,a4 as E,a7 as D,O as I,i as Y,a3 as Et,a8 as V,ai as Dt,a5 as p,ag
|
|
|
720
720
|
host places inside reads as something set down on the board rather than
|
|
721
721
|
text in a table cell. */
|
|
722
722
|
.matrix-cell {
|
|
723
|
-
|
|
723
|
+
display: grid;
|
|
724
724
|
background: var(--dpk-dots), var(--dpk-paper-sunken);
|
|
725
725
|
border-left: 1px solid var(--dpk-rule);
|
|
726
726
|
border-top: 1px solid var(--dpk-rule);
|
|
727
727
|
}
|
|
728
|
+
/* The slotted content fills the whole cell, pad included, so a host's
|
|
729
|
+
drop target or click area is the box the reader sees rather than its
|
|
730
|
+
content's own height — a row grows to its tallest cell. */
|
|
731
|
+
.matrix-cell ::slotted(*) {
|
|
732
|
+
box-sizing: border-box;
|
|
733
|
+
padding: var(--dpk-matrix-cell-pad);
|
|
734
|
+
}
|
|
728
735
|
|
|
729
736
|
/* Row drag: the head is the handle (hover/active cursor), the whole row the target. */
|
|
730
737
|
.matrix-row-head[draggable='true'] {
|
|
@@ -1,4 +1,4 @@
|
|
|
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`
|
|
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-_0Ev6y6i.js";import{c as Tn,a as An}from"./shared-D0_BoWj3.js";import{m as In}from"./shared-C-ujfGnT.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-4JaCIu01.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
2
|
<div class="nav">
|
|
3
3
|
${ps(t,e,r)}
|
|
4
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>`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as S,L as T,V as _}from"./shared-
|
|
1
|
+
import{_ as S,L as T,V as _}from"./shared-_0Ev6y6i.js";import{m as j,q as a,k as o,h as k,j as l,C as B,v as E,w as $}from"./shared-CJZKj_HI.js";const r=S({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),x=a({id:B,title:E(l(),$(1))}),c=a({title:o(l(),""),sections:o(k(x),[])}),p=t=>{const e=j(c,t),i=new Set;for(const n of e.sections){if(i.has(n.id))throw new Error(`duplicate section id: ${n.id}`);i.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),s=(t,e)=>t.sections.find(i=>i.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,i)=>{switch(i.type){case"section":return s(e,i.id)?.title??i.id;case"page":return t.wholePage;default:return i.id}},g=(t,e,i)=>({title:e.type,targetLabel:u(t,i,e.target),tone:"meta"}),f=t=>`${t.type} ${T(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(i=>({value:`section:${i.id}`,label:i.title,group:t.sectionGroup})),w=(t,e)=>e,y=(t,e)=>{switch(e.type){case"section":return s(t,e.id)!==void 0;case"page":return!0;default:return!1}},P=t=>{const e=r(t);return{kind:"view",name:"plain",label:"Plain",addable:!1,parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:y,describe:(i,n)=>g(e,i,n),serialize:f,resolveNavigation:w,commentTargets:i=>h(e,i),title:m}};class b extends _{definitionFor(e){return P(e)}renderRegions(e){return{}}}const v=()=>{customElements.get("dpk-view-plain")||customElements.define("dpk-view-plain",b)},L=Object.freeze(Object.defineProperty({__proto__:null,DpkViewPlain:b,definePlainElement:v,describePlainAction:g,emptyPlainBase:d,findSection:s,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:P,plainHasTarget:y,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:w,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{v as d,L as i};
|