dev-process-kit 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1 -0
  2. package/dist/chunks/shared-7qenhU4J.js +2173 -0
  3. package/dist/chunks/{shared-DNiXOQGv.js → shared-8lYUcRvS.js} +25 -15
  4. package/dist/chunks/shared-BHGClRU3.js +29 -0
  5. package/dist/chunks/{shared-neoJW11Z.js → shared-BIdQ89rB.js} +1 -1
  6. package/dist/chunks/{shared-CeKc6Dau.js → shared-BOFIcKZe.js} +8 -8
  7. package/dist/chunks/shared-Cia5FdOF.js +1112 -0
  8. package/dist/chunks/shared-D4czF1TI.js +1252 -0
  9. package/dist/chunks/{shared-DTHigJqb.js → shared-D6Yx-euS.js} +2 -2
  10. package/dist/chunks/{shared-D0gARZBn.js → shared-Dkx_2Lbf.js} +336 -268
  11. package/dist/chunks/shared-Dn5j0MCU.js +1 -0
  12. package/dist/chunks/{shared-C3hk-KNy.js → shared-SGSKyTNs.js} +7 -7
  13. package/dist/chunks/shared-U2T3astJ.js +1094 -0
  14. package/dist/chunks/shared-nW8tfMgg.js +556 -0
  15. package/dist/chunks/{shared-COxqP1sG.js → shared-p8037r6P.js} +2 -2
  16. package/dist/components.js +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/templates/delegation-poker.js +1 -1
  19. package/dist/templates/event-storming.js +1 -1
  20. package/dist/templates/example-mapping.js +1 -1
  21. package/dist/templates/grill.js +1 -1
  22. package/dist/templates/plain.js +1 -1
  23. package/dist/templates/prototype.js +1 -1
  24. package/dist/templates/slides.js +1 -1
  25. package/dist/templates/task-board.js +1 -1
  26. package/dist/templates/usm.js +1 -1
  27. package/dist/templates/whiteboard.js +1 -0
  28. package/package.json +3 -2
  29. package/dist/chunks/shared-0Pfezoy6.js +0 -761
  30. package/dist/chunks/shared-BanCvjbk.js +0 -609
  31. package/dist/chunks/shared-Bfq73Ivq.js +0 -1963
  32. package/dist/chunks/shared-DIroHwFk.js +0 -1
  33. package/dist/chunks/shared-DKa1TPDo.js +0 -556
  34. package/dist/chunks/shared-Dmq2K4Cr.js +0 -29
@@ -1,4 +1,4 @@
1
- import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,ag as V,q as w,v as qo,as as Io,ap as Qo,ai as Uo,ak as B,P as Ho,f as Ko,_ as Mo,V as Fo,R as S,a1 as s,a2 as n,A as jo,a3 as y,aK as Z,aL as Yo,aC as P,K as Xo,az as Jo,a0 as Vo,T as oo,m as Zo,aE as oe}from"./shared-Bfq73Ivq.js";const eo=["working","waiting","blocked","done"],D=["todo","doing","blocked","done"],ao=["agent","human"],E=["why","what","goals","nonGoals"],T=J(c(),V(1)),ee=b({id:h,name:T,kind:i($(ao),"agent")}),ae=b({id:h,title:T,status:i($(D),"todo"),assignee:i(h),note:i(c()),proposed:i(X(),!1),reason:i(c())}),te=b({id:h,label:i(c()),href:T,kind:i(c()),description:i(c())}),re=b({why:i(c()),what:i(c()),goals:i(f(c()),[]),nonGoals:i(f(c()),[])}),ne=b({id:h,from:i(h),at:i(c()),title:i(c()),body:i(c()),points:i(f(c()),[])}),de=b({id:h,ref:i(T),title:T,description:i(c()),blocking:i(X(),!1),assumption:i(c())}),to=b({title:i(c(),""),status:i($(eo)),updatedAt:i(c()),context:i(re,{}),members:i(f(ee),[]),todos:i(f(ae),[]),outputs:i(f(te),[]),log:i(f(ne),[]),questions:i(f(de),[])}),A=(e,o)=>{const a=new Set;for(const t of o){if(a.has(t))throw new Error(`duplicate ${e} id: ${t}`);a.add(t)}},u=e=>e===void 0||e.trim()===""?null:e,W=e=>e.filter(o=>o.trim()!==""),ro=e=>{const o=Ro(to,e);A("member",o.members.map(t=>t.id)),A("todo",o.todos.map(t=>t.id)),A("output",o.outputs.map(t=>t.id)),A("log",o.log.map(t=>t.id)),A("question",o.questions.map(t=>t.id));const a=new Set(o.members.map(t=>t.id));for(const t of o.todos)if(t.assignee!==void 0&&!a.has(t.assignee))throw new Error(`todo ${t.id} is assigned to ${t.assignee}, which is not in members`);for(const t of o.log){if(t.from!==void 0&&!a.has(t.from))throw new Error(`log entry ${t.id} is from ${t.from}, which is not in members`);if(u(t.title)===null&&u(t.body)===null)throw new Error(`log entry ${t.id} needs a title or a body`)}for(const t of o.questions)if(!t.blocking&&u(t.assumption)===null)throw new Error(`question ${t.id} does not block, so it needs the assumption the agent works on`);return{title:o.title,status:o.status??null,updatedAt:u(o.updatedAt),context:{why:u(o.context.why),what:u(o.context.what),goals:W(o.context.goals),nonGoals:W(o.context.nonGoals)},members:o.members,todos:o.todos.map(t=>({id:t.id,title:t.title,status:t.status,assignee:t.assignee??null,note:u(t.note),proposed:t.proposed,reason:u(t.reason),added:!1})),outputs:o.outputs.map(t=>({id:t.id,label:u(t.label),href:t.href,kind:u(t.kind),description:u(t.description)})),log:o.log.map(t=>({id:t.id,from:t.from??null,at:u(t.at),title:u(t.title),body:u(t.body),points:W(t.points)})),questions:o.questions.map((t,r)=>({id:t.id,ref:t.ref??`Q${r+1}`,title:t.title,description:u(t.description),blocking:t.blocking,assumption:u(t.assumption)})),answers:{},decisions:{}}},no=()=>({title:"",status:null,updatedAt:null,context:{why:null,what:null,goals:[],nonGoals:[]},members:[],todos:[],outputs:[],log:[],questions:[],answers:{},decisions:{}}),O=(e,o)=>o===null?void 0:e.members.find(a=>a.id===o),k=(e,o)=>e.todos.find(a=>a.id===o),so=(e,o)=>e.log.find(a=>a.id===o),io=e=>E.includes(e),N=(e,o)=>{const a=e.context[o];return typeof a=="string"||a!==null&&a.length>0},C=(e,o)=>e.questions.find(a=>a.id===o),lo=(e,o)=>{const a=e.answers[o.id];return a===void 0?!1:a.kind==="approve"||a.text.trim()!==""},R=(e,o)=>!o.proposed||e.decisions[o.id]==="accept",q=(e,o)=>R(e,o)&&O(e,o.assignee)?.kind==="human",po=(e,o,a)=>{const t={...e};return a===null?delete t[o]:t[o]=a,t},I=(e,o,a)=>({...e,answers:po(e.answers,o,a)}),se=(e,o,a)=>({...e,decisions:po(e.decisions,o,a)}),ie=(e,o,a)=>({...e,todos:e.todos.map(t=>t.id===o?a(t):t)}),m={ANSWER_QUESTION:w("ANSWER_QUESTION","question",Uo("kind",[b({kind:B("approve")}),b({kind:B("answer"),text:c()}),b({kind:B("clear")})])),DECIDE_PROPOSAL:w("DECIDE_PROPOSAL","todo",b({decision:$(["accept","decline","clear"])})),SET_TODO_STATUS:w("SET_TODO_STATUS","todo",b({status:$(D)})),ADD_TODO:w("ADD_TODO","page",b({id:h,title:J(c(),Qo(),V(1)),assignee:Io(h)}),{dedupeKey:qo}),DELETE_TODO:w("DELETE_TODO","todo",b({}))},co={type:"page",id:"task-board"},Q=(e,o)=>({type:"ANSWER_QUESTION",target:{type:"question",id:e},payload:o}),uo=(e,o)=>({type:"DECIDE_PROPOSAL",target:{type:"todo",id:e},payload:{decision:o}}),bo=(e,o)=>({type:"SET_TODO_STATUS",target:{type:"todo",id:e},payload:{status:o}}),go=(e,o,a)=>({type:"ADD_TODO",target:co,payload:{id:e,title:o,assignee:a}}),ho=e=>({type:"DELETE_TODO",target:{type:"todo",id:e},payload:{}}),ko=(e,o)=>{const a=Ho(m,o);if(a===null)return null;const t=a.target.id;switch(a.type){case"ANSWER_QUESTION":{const r=C(e,t);if(r===void 0)return null;const d=a.payload;return d.kind==="clear"?I(e,t,null):d.kind==="approve"?r.assumption===null?null:I(e,t,{kind:"approve"}):I(e,t,{kind:"answer",text:d.text})}case"DECIDE_PROPOSAL":{if(k(e,t)?.proposed!==!0)return null;const{decision:r}=a.payload;return se(e,t,r==="clear"?null:r)}case"SET_TODO_STATUS":{const r=k(e,t);if(r===void 0||!q(e,r))return null;const{status:d}=a.payload;return ie(e,t,l=>({...l,status:d}))}case"ADD_TODO":{const{payload:r}=a;return k(e,r.id)!==void 0||r.assignee!==null&&O(e,r.assignee)===void 0?null:{...e,todos:[...e.todos,{id:r.id,title:r.title,status:"todo",assignee:r.assignee,note:null,proposed:!1,reason:null,added:!0}]}}case"DELETE_TODO":return k(e,t)?.added!==!0?null:{...e,todos:e.todos.filter(r=>r.id!==t)};default:return Ko(a)}},U=Mo({en:{wholeBoard:"Whole board",statusWorking:"Working",statusWaiting:"Waiting on you",statusBlocked:"Blocked",statusDone:"Done",todoTodo:"To do",todoDoing:"In progress",todoBlocked:"Blocked",todoDone:"Done",kindAgent:"Agent",kindHuman:"Human",updatedAt:e=>`Updated ${e}`,context:"What this task is about",contextWhy:"Why",contextWhat:"What",contextGoals:"Goals",contextNonGoals:"Non-goals",noContext:"The agent has not written down why and what yet.",tabs:"Board sections",tabContext:"Context",tabLog:"Work log",tabQuestions:"Questions",openCount:e=>`${e} open`,noQuestions:"The agent has nothing to ask right now.",questions:"Questions from the agent",questionsProgress:(e,o)=>`${e} of ${o} replied`,blockingGroup:"Blocking \u2014 the agent waits for your decision",provisionalGroup:"Going ahead on an assumption \u2014 the agent adjusts if you answer otherwise",blockingTag:"Blocking",assumption:"Assumption",recommendation:"Agent recommends",approveAssumption:"OK, go with this",approveRecommendation:"OK, go with the recommendation",answerOther:"Answer differently",answerOf:e=>`Your answer to ${e}`,answerPlaceholder:"What you expect instead\u2026",blockingPlaceholder:"Your decision\u2026",approvedTag:"Approved",answeredTag:"Answered",todos:"Todo",progress:(e,o)=>`${e} of ${o} done`,noTodosYet:"No todos yet",assignee:"Assignee",unassigned:"Unassigned",memberOption:(e,o)=>`${e} (${o})`,statusOf:e=>`Status of \u201C${e}\u201D`,filterTodos:"Show todos",filterAll:"All",filterHuman:"People",doneGroup:e=>`Done (${e})`,noHumanTodos:"Nobody but the agent has a todo.",addedTag:"Added by you",changedTag:"Changed",removeAdded:"Remove this todo you added",noTodos:"There are no todos yet.",newTodo:"New todo",newTodoPlaceholder:"Add a todo for the agent\u2026",newTodoAssignee:"Assignee of the new todo",addTodo:"Add",proposedMark:"Proposed by the agent",reason:"Why",accept:"Accept",decline:"Decline",decisionOf:e=>`Decision on \u201C${e}\u201D`,acceptedTag:"Accepted",declinedTag:"Declined",undoDecision:"Undo",outputs:"Outputs",noOutputs:"Nothing has been produced yet.",copy:e=>`Copy ${e}`,copied:"Copied",log:"Conversation with the agent",logLede:"Newest first",noLog:"Nothing has been exchanged yet.",fromAgent:"Agent",latestTag:"Latest",commentOn:e=>`Comment on ${e}`,todoGroup:"Todo",logGroup:"Log",contextGroup:"Context",proposalGroup:"Proposal",questionGroup:"Question",approved:"Approve the assumption",answered:"Answer",answerCleared:"Clear the reply",accepted:"Accept the proposal",declined:"Decline the proposal",decisionCleared:"Clear the decision",statusChanged:"Change the status",todoAdded:"Add a todo",todoRemoved:"Remove the added todo",quoted:e=>`\u2192 \u201C${e}\u201D`,change:(e,o)=>`${e} \u2192 ${o}`},ja:{wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53",statusWorking:"\u4F5C\u696D\u4E2D",statusWaiting:"\u3042\u306A\u305F\u306E\u8FD4\u7B54\u5F85\u3061",statusBlocked:"\u30D6\u30ED\u30C3\u30AF\u4E2D",statusDone:"\u5B8C\u4E86",todoTodo:"\u672A\u7740\u624B",todoDoing:"\u9032\u884C\u4E2D",todoBlocked:"\u30D6\u30ED\u30C3\u30AF",todoDone:"\u5B8C\u4E86",kindAgent:"Agent",kindHuman:"\u4EBA\u9593",updatedAt:e=>`\u66F4\u65B0 ${e}`,context:"\u3053\u306E\u30BF\u30B9\u30AF\u306E\u524D\u63D0",contextWhy:"Why \u2014 \u306A\u305C\u3084\u308B\u304B",contextWhat:"What \u2014 \u4F55\u3092\u3084\u308B\u304B",contextGoals:"\u30B4\u30FC\u30EB",contextNonGoals:"\u3084\u3089\u306A\u3044\u3053\u3068",noContext:"Agent \u306F\u307E\u3060 Why / What \u3092\u66F8\u3044\u3066\u3044\u307E\u305B\u3093\u3002",tabs:"\u30DC\u30FC\u30C9\u306E\u533A\u5206",tabContext:"Context",tabLog:"\u4F5C\u696D\u30ED\u30B0",tabQuestions:"\u8CEA\u554F",openCount:e=>`\u672A\u56DE\u7B54 ${e} \u4EF6`,noQuestions:"\u4ECA Agent \u304B\u3089\u805E\u304D\u305F\u3044\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\u3002",questions:"Agent \u304B\u3089\u306E\u8CEA\u554F",questionsProgress:(e,o)=>`\u8FD4\u7B54\u6E08\u307F ${e} / ${o}`,blockingGroup:"\u30D6\u30ED\u30C3\u30AB\u30FC \u2014 \u6C7A\u3081\u3066\u3082\u3089\u3046\u307E\u3067\u5148\u306B\u9032\u3081\u306A\u3044",provisionalGroup:"\u4EEE\u306E\u524D\u63D0\u3067\u9032\u884C\u4E2D \u2014 \u9055\u3048\u3070\u65B9\u91DD\u3092\u76F4\u3059",blockingTag:"\u30D6\u30ED\u30C3\u30AB\u30FC",assumption:"\u4EEE\u56DE\u7B54",recommendation:"Agent \u306E\u63A8\u5968",approveAssumption:"\u3053\u306E\u524D\u63D0\u3067 OK",approveRecommendation:"\u63A8\u5968\u3069\u304A\u308A\u3067 OK",answerOther:"\u5225\u306E\u56DE\u7B54\u3092\u3059\u308B",answerOf:e=>`${e} \u3078\u306E\u56DE\u7B54`,answerPlaceholder:"\u671F\u5F85\u3059\u308B\u56DE\u7B54\u3092\u5165\u529B\u2026",blockingPlaceholder:"\u3069\u3046\u3059\u308B\u304B\u3092\u5165\u529B\u2026",approvedTag:"\u627F\u8A8D\u6E08\u307F",answeredTag:"\u56DE\u7B54\u6E08\u307F",todos:"Todo",progress:(e,o)=>`${o} \u4EF6\u4E2D ${e} \u4EF6\u5B8C\u4E86`,noTodosYet:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",assignee:"\u62C5\u5F53",unassigned:"\u672A\u5272\u308A\u5F53\u3066",memberOption:(e,o)=>`${e}\uFF08${o}\uFF09`,statusOf:e=>`\u300C${e}\u300D\u306E\u72B6\u614B`,filterTodos:"\u8868\u793A\u3059\u308B Todo",filterAll:"\u3059\u3079\u3066",filterHuman:"\u4EBA\u9593\u306E\u62C5\u5F53",doneGroup:e=>`\u5B8C\u4E86 ${e} \u4EF6`,noHumanTodos:"\u4EBA\u9593\u304C\u62C5\u5F53\u3059\u308B Todo \u306F\u3042\u308A\u307E\u305B\u3093\u3002",addedTag:"\u3042\u306A\u305F\u304C\u8FFD\u52A0",changedTag:"\u5909\u66F4\u3042\u308A",removeAdded:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3059",noTodos:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",newTodo:"\u65B0\u3057\u3044 Todo",newTodoPlaceholder:"Agent \u306B\u983C\u3080 Todo \u3092\u8FFD\u52A0\u2026",newTodoAssignee:"\u65B0\u3057\u3044 Todo \u306E\u62C5\u5F53",addTodo:"\u8FFD\u52A0",proposedMark:"Agent \u304B\u3089\u306E\u63D0\u6848",reason:"\u306A\u305C",accept:"\u627F\u8A8D",decline:"\u898B\u9001\u308A",decisionOf:e=>`\u300C${e}\u300D\u306E\u5224\u65AD`,acceptedTag:"\u627F\u8A8D\u6E08\u307F",declinedTag:"\u898B\u9001\u308A",undoDecision:"\u53D6\u308A\u6D88\u3059",outputs:"\u6210\u679C\u7269",noOutputs:"\u307E\u3060\u6210\u679C\u7269\u306F\u3042\u308A\u307E\u305B\u3093\u3002",copy:e=>`${e} \u3092\u30B3\u30D4\u30FC`,copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",log:"Agent \u3068\u306E\u3084\u308A\u3068\u308A",logLede:"\u65B0\u3057\u3044\u9806",noLog:"\u307E\u3060\u3084\u308A\u3068\u308A\u306F\u3042\u308A\u307E\u305B\u3093\u3002",fromAgent:"Agent",latestTag:"\u6700\u65B0",commentOn:e=>`${e} \u306B\u30B3\u30E1\u30F3\u30C8`,todoGroup:"Todo",logGroup:"\u4F5C\u696D\u30ED\u30B0",contextGroup:"Context",proposalGroup:"\u63D0\u6848",questionGroup:"\u8CEA\u554F",approved:"\u524D\u63D0\u3092\u627F\u8A8D",answered:"\u56DE\u7B54",answerCleared:"\u8FD4\u7B54\u3092\u30AF\u30EA\u30A2",accepted:"\u63D0\u6848\u3092\u627F\u8A8D",declined:"\u63D0\u6848\u3092\u898B\u9001\u308A",decisionCleared:"\u63D0\u6848\u306E\u5224\u65AD\u3092\u30AF\u30EA\u30A2",statusChanged:"\u72B6\u614B\u3092\u5909\u66F4",todoAdded:"Todo \u3092\u8FFD\u52A0",todoRemoved:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3057",quoted:e=>`\u2192 \u300C${e}\u300D`,change:(e,o)=>`${e} \u2192 ${o}`}}),xo=(e,o)=>{switch(o){case"working":return e.statusWorking;case"waiting":return e.statusWaiting;case"blocked":return e.statusBlocked;case"done":return e.statusDone}},z=(e,o)=>{switch(o){case"todo":return e.todoTodo;case"doing":return e.todoDoing;case"blocked":return e.todoBlocked;case"done":return e.todoDone}},le=(e,o)=>o==="agent"?e.kindAgent:e.kindHuman,L=(e,o)=>{switch(o){case"why":return e.contextWhy;case"what":return e.contextWhat;case"goals":return e.contextGoals;case"nonGoals":return e.contextNonGoals}},fo=48,H=e=>{const o=e.title??e.body??e.id;return o.length<=fo?o:`${o.slice(0,fo-1)}\u2026`},pe=(e,o,a)=>a===null?e.unassigned:O(o,a)?.name??a,mo=e=>e.title===""?"Task Context Board":e.title,vo=(e,o,a)=>{switch(a.type){case"todo":{const t=k(o,a.id);return`${t?.proposed===!0?e.proposalGroup:e.todoGroup} \xB7 ${t?.title??a.id}`}case"log":{const t=so(o,a.id);return`${e.logGroup} \xB7 ${t===void 0?a.id:H(t)}`}case"context":return`${e.contextGroup} \xB7 ${io(a.id)?L(e,a.id):a.id}`;case"question":{const t=C(o,a.id);return t===void 0?a.id:`${t.ref} \xB7 ${t.title}`}case"page":return e.wholeBoard;default:return a.id}},ce=(e,o)=>{switch(o){case"accept":return{title:e.accepted,tone:"update"};case"decline":return{title:e.declined,tone:"update"};case"clear":return{title:e.decisionCleared,tone:"delete"}}},ue=(e,o,a)=>{switch(a.type){case"ANSWER_QUESTION":{const t=S(m.ANSWER_QUESTION,a);if(t.kind==="clear")return{title:e.answerCleared,tone:"delete"};if(t.kind==="approve"){const r=C(o,a.target.id)?.assumption??null;return{title:e.approved,tone:"update",...r===null?{}:{body:e.quoted(r)}}}return{title:e.answered,tone:"update",body:e.quoted(t.text.slice(0,120))}}case"DECIDE_PROPOSAL":return ce(e,S(m.DECIDE_PROPOSAL,a).decision);case"SET_TODO_STATUS":{const{status:t}=S(m.SET_TODO_STATUS,a),r=k(o,a.target.id)?.status,d=z(e,t);return{title:e.statusChanged,tone:"update",body:r===void 0?d:e.change(z(e,r),d)}}case"ADD_TODO":{const t=S(m.ADD_TODO,a);return{title:e.todoAdded,tone:"create",targetLabel:`${e.todoGroup} \xB7 ${t.title}`,...t.assignee===null?{}:{body:`${e.assignee}: ${pe(e,o,t.assignee)}`}}}case"DELETE_TODO":return{title:e.todoRemoved,tone:"delete"};default:return{title:a.type,tone:"meta"}}},$o=(e,o,a,t)=>{let r;try{r=ue(e,t??a,o)}catch{r={title:o.type,tone:"meta"}}return{title:r.title,targetLabel:r.targetLabel??vo(e,a,o.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},wo=e=>`${e.type} ${Fo(e.target)} ${JSON.stringify(e.payload)}`,yo=(e,o)=>[...o.questions.map(a=>({value:`question:${a.id}`,label:`${a.ref} \xB7 ${a.title}`,group:e.questionGroup})),...o.todos.map(a=>({value:`todo:${a.id}`,label:a.title,group:a.proposed?e.proposalGroup:e.todoGroup})),...o.log.map(a=>({value:`log:${a.id}`,label:H(a),group:e.logGroup})),...E.filter(a=>N(o,a)).map(a=>({value:`context:${a}`,label:L(e,a),group:e.contextGroup}))],To=(e,o)=>o,Ao=(e,o,a)=>({parts:E.filter(t=>N(o,t)).map(t=>{const r=o.context[t];return{id:t,title:L(e,t),text:typeof r=="string"?r:null,items:typeof r=="string"||r===null?[]:r,comments:a(`context:${t}`)}})}),be=(e,o,a)=>{const t=e.answers[o.id];return{id:o.id,ref:o.ref,title:o.title,description:o.description,blocking:o.blocking,assumption:o.assumption,reply:t?.kind??"none",resolved:lo(e,o),draft:t?.kind==="answer"?t.text:"",comments:a(`question:${o.id}`)}},Oo=(e,o)=>{const a=e.questions.map(r=>be(e,r,o)),t=a.filter(r=>r.resolved).length;return{blocking:a.filter(r=>r.blocking),provisional:a.filter(r=>!r.blocking),resolved:t,total:a.length,open:a.length-t,blockingOpen:a.filter(r=>r.blocking&&!r.resolved).length}},ge=(e,o,a,t,r)=>{const d=k(a,t.id),l=O(o,t.assignee);return{id:t.id,title:t.title,note:t.note,reason:t.reason,status:t.status,statusLabel:z(e,t.status),assignee:t.assignee,assigneeName:l?.name??null,assigneeKind:l?.kind??null,editable:q(o,t),proposal:t.proposed?o.decisions[t.id]??"pending":null,added:t.added,changed:d!==void 0&&d.status!==t.status,comments:r(`todo:${t.id}`)}},So=(e,o,a,t,r="all")=>{const d=o.todos.filter(p=>R(o,p)),l=d.filter(p=>p.status==="done").length,g=o.members.some(p=>p.kind==="human"),x=g?r:"all",F=p=>p.assigneeKind==="human",G=o.todos.map(p=>ge(e,o,a,p,t)),j=x==="human"?G.filter(F):G,Y=p=>p.status==="done"&&k(a,p.id)?.status==="done";return{todos:j.filter(p=>!Y(p)),done:j.filter(Y),filter:x,canFilter:g,humanCount:G.filter(F).length,progress:{done:l,total:d.length,label:d.length===0?e.noTodosYet:e.progress(l,d.length)},statuses:D.map(p=>({value:p,label:z(e,p)})),members:o.members.map(p=>({id:p.id,label:e.memberOption(p.name,le(e,p.kind))}))}},Do=e=>{if(!/^[a-z][a-z\d+.-]*:\/\//i.test(e))return{kind:"path"};try{return{kind:"url",host:new URL(e).host}}catch{return{kind:"path"}}},Eo=e=>e.outputs.map(o=>({id:o.id,title:o.label??o.href,labelled:o.label!==null,href:o.href,kind:o.kind,description:o.description,place:Do(o.href)})),Co=(e,o,a)=>({entries:o.log.map((t,r)=>{const d=O(o,t.from);return{id:t.id,author:d===void 0?null:{name:d.name,kind:d.kind},at:t.at,title:t.title,body:t.body,points:t.points,label:H(t),latest:r===o.log.length-1,comments:a(`log:${t.id}`)}}).reverse(),status:o.status===null&&o.updatedAt===null?null:{status:o.status,label:o.status===null?null:xo(e,o.status),updatedAt:o.updatedAt}}),zo=(e,o)=>{switch(o.type){case"todo":return k(e,o.id)!==void 0;case"log":return so(e,o.id)!==void 0;case"context":return io(o.id)&&N(e,o.id);case"question":return C(e,o.id)!==void 0;case"page":return!0;default:return!1}},Lo=e=>{const o=U(e);return{name:"task-board",label:"Task Context Board",parseBase:ro,emptyBase:no,actions:m,apply:ko,hasTarget:zo,describe:(a,t,r)=>$o(o,a,t,r),serialize:wo,resolveNavigation:To,commentTargets:a=>yo(o,a),title:mo}},_=(e,o,a,t)=>n`
1
+ import{ab as Ro,ac as b,ad as i,ae as f,af as c,ag as w,aw as h,an as X,ah as J,ai as V,p as $,v as Qo,av as qo,as as Io,ak as Uo,am as B,P as Ho,e as Mo,a0 as Ko,V as Fo,R as S,a3 as s,a4 as n,A as jo,a5 as y,aP as Z,aQ as Yo,aF as P,K as Xo,aC as Jo,a2 as Vo,T as oo,l as Zo,aH as oe}from"./shared-7qenhU4J.js";const eo=["working","waiting","blocked","done"],D=["todo","doing","blocked","done"],ao=["agent","human"],E=["why","what","goals","nonGoals"],T=J(c(),V(1)),ee=b({id:h,name:T,kind:i(w(ao),"agent")}),ae=b({id:h,title:T,status:i(w(D),"todo"),assignee:i(h),note:i(c()),proposed:i(X(),!1),reason:i(c())}),te=b({id:h,label:i(c()),href:T,kind:i(c()),description:i(c())}),re=b({why:i(c()),what:i(c()),goals:i(f(c()),[]),nonGoals:i(f(c()),[])}),ne=b({id:h,from:i(h),at:i(c()),title:i(c()),body:i(c()),points:i(f(c()),[])}),de=b({id:h,ref:i(T),title:T,description:i(c()),blocking:i(X(),!1),assumption:i(c())}),to=b({title:i(c(),""),status:i(w(eo)),updatedAt:i(c()),context:i(re,{}),members:i(f(ee),[]),todos:i(f(ae),[]),outputs:i(f(te),[]),log:i(f(ne),[]),questions:i(f(de),[])}),A=(e,o)=>{const a=new Set;for(const t of o){if(a.has(t))throw new Error(`duplicate ${e} id: ${t}`);a.add(t)}},u=e=>e===void 0||e.trim()===""?null:e,W=e=>e.filter(o=>o.trim()!==""),ro=e=>{const o=Ro(to,e);A("member",o.members.map(t=>t.id)),A("todo",o.todos.map(t=>t.id)),A("output",o.outputs.map(t=>t.id)),A("log",o.log.map(t=>t.id)),A("question",o.questions.map(t=>t.id));const a=new Set(o.members.map(t=>t.id));for(const t of o.todos)if(t.assignee!==void 0&&!a.has(t.assignee))throw new Error(`todo ${t.id} is assigned to ${t.assignee}, which is not in members`);for(const t of o.log){if(t.from!==void 0&&!a.has(t.from))throw new Error(`log entry ${t.id} is from ${t.from}, which is not in members`);if(u(t.title)===null&&u(t.body)===null)throw new Error(`log entry ${t.id} needs a title or a body`)}for(const t of o.questions)if(!t.blocking&&u(t.assumption)===null)throw new Error(`question ${t.id} does not block, so it needs the assumption the agent works on`);return{title:o.title,status:o.status??null,updatedAt:u(o.updatedAt),context:{why:u(o.context.why),what:u(o.context.what),goals:W(o.context.goals),nonGoals:W(o.context.nonGoals)},members:o.members,todos:o.todos.map(t=>({id:t.id,title:t.title,status:t.status,assignee:t.assignee??null,note:u(t.note),proposed:t.proposed,reason:u(t.reason),added:!1})),outputs:o.outputs.map(t=>({id:t.id,label:u(t.label),href:t.href,kind:u(t.kind),description:u(t.description)})),log:o.log.map(t=>({id:t.id,from:t.from??null,at:u(t.at),title:u(t.title),body:u(t.body),points:W(t.points)})),questions:o.questions.map((t,r)=>({id:t.id,ref:t.ref??`Q${r+1}`,title:t.title,description:u(t.description),blocking:t.blocking,assumption:u(t.assumption)})),answers:{},decisions:{}}},no=()=>({title:"",status:null,updatedAt:null,context:{why:null,what:null,goals:[],nonGoals:[]},members:[],todos:[],outputs:[],log:[],questions:[],answers:{},decisions:{}}),O=(e,o)=>o===null?void 0:e.members.find(a=>a.id===o),k=(e,o)=>e.todos.find(a=>a.id===o),so=(e,o)=>e.log.find(a=>a.id===o),io=e=>E.includes(e),N=(e,o)=>{const a=e.context[o];return typeof a=="string"||a!==null&&a.length>0},C=(e,o)=>e.questions.find(a=>a.id===o),lo=(e,o)=>{const a=e.answers[o.id];return a===void 0?!1:a.kind==="approve"||a.text.trim()!==""},R=(e,o)=>!o.proposed||e.decisions[o.id]==="accept",Q=(e,o)=>R(e,o)&&O(e,o.assignee)?.kind==="human",po=(e,o,a)=>{const t={...e};return a===null?delete t[o]:t[o]=a,t},q=(e,o,a)=>({...e,answers:po(e.answers,o,a)}),se=(e,o,a)=>({...e,decisions:po(e.decisions,o,a)}),ie=(e,o,a)=>({...e,todos:e.todos.map(t=>t.id===o?a(t):t)}),m={ANSWER_QUESTION:$("ANSWER_QUESTION","question",Uo("kind",[b({kind:B("approve")}),b({kind:B("answer"),text:c()}),b({kind:B("clear")})])),DECIDE_PROPOSAL:$("DECIDE_PROPOSAL","todo",b({decision:w(["accept","decline","clear"])})),SET_TODO_STATUS:$("SET_TODO_STATUS","todo",b({status:w(D)})),ADD_TODO:$("ADD_TODO","page",b({id:h,title:J(c(),Io(),V(1)),assignee:qo(h)}),{dedupeKey:Qo}),DELETE_TODO:$("DELETE_TODO","todo",b({}))},co={type:"page",id:"task-board"},I=(e,o)=>({type:"ANSWER_QUESTION",target:{type:"question",id:e},payload:o}),uo=(e,o)=>({type:"DECIDE_PROPOSAL",target:{type:"todo",id:e},payload:{decision:o}}),bo=(e,o)=>({type:"SET_TODO_STATUS",target:{type:"todo",id:e},payload:{status:o}}),go=(e,o,a)=>({type:"ADD_TODO",target:co,payload:{id:e,title:o,assignee:a}}),ho=e=>({type:"DELETE_TODO",target:{type:"todo",id:e},payload:{}}),ko=(e,o)=>{const a=Ho(m,o);if(a===null)return null;const t=a.target.id;switch(a.type){case"ANSWER_QUESTION":{const r=C(e,t);if(r===void 0)return null;const d=a.payload;return d.kind==="clear"?q(e,t,null):d.kind==="approve"?r.assumption===null?null:q(e,t,{kind:"approve"}):q(e,t,{kind:"answer",text:d.text})}case"DECIDE_PROPOSAL":{if(k(e,t)?.proposed!==!0)return null;const{decision:r}=a.payload;return se(e,t,r==="clear"?null:r)}case"SET_TODO_STATUS":{const r=k(e,t);if(r===void 0||!Q(e,r))return null;const{status:d}=a.payload;return ie(e,t,l=>({...l,status:d}))}case"ADD_TODO":{const{payload:r}=a;return k(e,r.id)!==void 0||r.assignee!==null&&O(e,r.assignee)===void 0?null:{...e,todos:[...e.todos,{id:r.id,title:r.title,status:"todo",assignee:r.assignee,note:null,proposed:!1,reason:null,added:!0}]}}case"DELETE_TODO":return k(e,t)?.added!==!0?null:{...e,todos:e.todos.filter(r=>r.id!==t)};default:return Mo(a)}},U=Ko({en:{wholeBoard:"Whole board",statusWorking:"Working",statusWaiting:"Waiting on you",statusBlocked:"Blocked",statusDone:"Done",todoTodo:"To do",todoDoing:"In progress",todoBlocked:"Blocked",todoDone:"Done",kindAgent:"Agent",kindHuman:"Human",updatedAt:e=>`Updated ${e}`,context:"What this task is about",contextWhy:"Why",contextWhat:"What",contextGoals:"Goals",contextNonGoals:"Non-goals",noContext:"The agent has not written down why and what yet.",tabs:"Board sections",tabContext:"Context",tabLog:"Work log",tabQuestions:"Questions",openCount:e=>`${e} open`,noQuestions:"The agent has nothing to ask right now.",questions:"Questions from the agent",questionsProgress:(e,o)=>`${e} of ${o} replied`,blockingGroup:"Blocking \u2014 the agent waits for your decision",provisionalGroup:"Going ahead on an assumption \u2014 the agent adjusts if you answer otherwise",blockingTag:"Blocking",assumption:"Assumption",recommendation:"Agent recommends",approveAssumption:"OK, go with this",approveRecommendation:"OK, go with the recommendation",answerOther:"Answer differently",answerOf:e=>`Your answer to ${e}`,answerPlaceholder:"What you expect instead\u2026",blockingPlaceholder:"Your decision\u2026",approvedTag:"Approved",answeredTag:"Answered",todos:"Todo",progress:(e,o)=>`${e} of ${o} done`,noTodosYet:"No todos yet",assignee:"Assignee",unassigned:"Unassigned",memberOption:(e,o)=>`${e} (${o})`,statusOf:e=>`Status of \u201C${e}\u201D`,filterTodos:"Show todos",filterAll:"All",filterHuman:"People",doneGroup:e=>`Done (${e})`,noHumanTodos:"Nobody but the agent has a todo.",addedTag:"Added by you",changedTag:"Changed",removeAdded:"Remove this todo you added",noTodos:"There are no todos yet.",newTodo:"New todo",newTodoPlaceholder:"Add a todo for the agent\u2026",newTodoAssignee:"Assignee of the new todo",addTodo:"Add",proposedMark:"Proposed by the agent",reason:"Why",accept:"Accept",decline:"Decline",decisionOf:e=>`Decision on \u201C${e}\u201D`,acceptedTag:"Accepted",declinedTag:"Declined",undoDecision:"Undo",outputs:"Outputs",noOutputs:"Nothing has been produced yet.",copy:e=>`Copy ${e}`,copied:"Copied",log:"Conversation with the agent",logLede:"Newest first",noLog:"Nothing has been exchanged yet.",fromAgent:"Agent",latestTag:"Latest",commentOn:e=>`Comment on ${e}`,todoGroup:"Todo",logGroup:"Log",contextGroup:"Context",proposalGroup:"Proposal",questionGroup:"Question",approved:"Approve the assumption",answered:"Answer",answerCleared:"Clear the reply",accepted:"Accept the proposal",declined:"Decline the proposal",decisionCleared:"Clear the decision",statusChanged:"Change the status",todoAdded:"Add a todo",todoRemoved:"Remove the added todo",quoted:e=>`\u2192 \u201C${e}\u201D`,change:(e,o)=>`${e} \u2192 ${o}`},ja:{wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53",statusWorking:"\u4F5C\u696D\u4E2D",statusWaiting:"\u3042\u306A\u305F\u306E\u8FD4\u7B54\u5F85\u3061",statusBlocked:"\u30D6\u30ED\u30C3\u30AF\u4E2D",statusDone:"\u5B8C\u4E86",todoTodo:"\u672A\u7740\u624B",todoDoing:"\u9032\u884C\u4E2D",todoBlocked:"\u30D6\u30ED\u30C3\u30AF",todoDone:"\u5B8C\u4E86",kindAgent:"Agent",kindHuman:"\u4EBA\u9593",updatedAt:e=>`\u66F4\u65B0 ${e}`,context:"\u3053\u306E\u30BF\u30B9\u30AF\u306E\u524D\u63D0",contextWhy:"Why \u2014 \u306A\u305C\u3084\u308B\u304B",contextWhat:"What \u2014 \u4F55\u3092\u3084\u308B\u304B",contextGoals:"\u30B4\u30FC\u30EB",contextNonGoals:"\u3084\u3089\u306A\u3044\u3053\u3068",noContext:"Agent \u306F\u307E\u3060 Why / What \u3092\u66F8\u3044\u3066\u3044\u307E\u305B\u3093\u3002",tabs:"\u30DC\u30FC\u30C9\u306E\u533A\u5206",tabContext:"Context",tabLog:"\u4F5C\u696D\u30ED\u30B0",tabQuestions:"\u8CEA\u554F",openCount:e=>`\u672A\u56DE\u7B54 ${e} \u4EF6`,noQuestions:"\u4ECA Agent \u304B\u3089\u805E\u304D\u305F\u3044\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\u3002",questions:"Agent \u304B\u3089\u306E\u8CEA\u554F",questionsProgress:(e,o)=>`\u8FD4\u7B54\u6E08\u307F ${e} / ${o}`,blockingGroup:"\u30D6\u30ED\u30C3\u30AB\u30FC \u2014 \u6C7A\u3081\u3066\u3082\u3089\u3046\u307E\u3067\u5148\u306B\u9032\u3081\u306A\u3044",provisionalGroup:"\u4EEE\u306E\u524D\u63D0\u3067\u9032\u884C\u4E2D \u2014 \u9055\u3048\u3070\u65B9\u91DD\u3092\u76F4\u3059",blockingTag:"\u30D6\u30ED\u30C3\u30AB\u30FC",assumption:"\u4EEE\u56DE\u7B54",recommendation:"Agent \u306E\u63A8\u5968",approveAssumption:"\u3053\u306E\u524D\u63D0\u3067 OK",approveRecommendation:"\u63A8\u5968\u3069\u304A\u308A\u3067 OK",answerOther:"\u5225\u306E\u56DE\u7B54\u3092\u3059\u308B",answerOf:e=>`${e} \u3078\u306E\u56DE\u7B54`,answerPlaceholder:"\u671F\u5F85\u3059\u308B\u56DE\u7B54\u3092\u5165\u529B\u2026",blockingPlaceholder:"\u3069\u3046\u3059\u308B\u304B\u3092\u5165\u529B\u2026",approvedTag:"\u627F\u8A8D\u6E08\u307F",answeredTag:"\u56DE\u7B54\u6E08\u307F",todos:"Todo",progress:(e,o)=>`${o} \u4EF6\u4E2D ${e} \u4EF6\u5B8C\u4E86`,noTodosYet:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",assignee:"\u62C5\u5F53",unassigned:"\u672A\u5272\u308A\u5F53\u3066",memberOption:(e,o)=>`${e}\uFF08${o}\uFF09`,statusOf:e=>`\u300C${e}\u300D\u306E\u72B6\u614B`,filterTodos:"\u8868\u793A\u3059\u308B Todo",filterAll:"\u3059\u3079\u3066",filterHuman:"\u4EBA\u9593\u306E\u62C5\u5F53",doneGroup:e=>`\u5B8C\u4E86 ${e} \u4EF6`,noHumanTodos:"\u4EBA\u9593\u304C\u62C5\u5F53\u3059\u308B Todo \u306F\u3042\u308A\u307E\u305B\u3093\u3002",addedTag:"\u3042\u306A\u305F\u304C\u8FFD\u52A0",changedTag:"\u5909\u66F4\u3042\u308A",removeAdded:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3059",noTodos:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",newTodo:"\u65B0\u3057\u3044 Todo",newTodoPlaceholder:"Agent \u306B\u983C\u3080 Todo \u3092\u8FFD\u52A0\u2026",newTodoAssignee:"\u65B0\u3057\u3044 Todo \u306E\u62C5\u5F53",addTodo:"\u8FFD\u52A0",proposedMark:"Agent \u304B\u3089\u306E\u63D0\u6848",reason:"\u306A\u305C",accept:"\u627F\u8A8D",decline:"\u898B\u9001\u308A",decisionOf:e=>`\u300C${e}\u300D\u306E\u5224\u65AD`,acceptedTag:"\u627F\u8A8D\u6E08\u307F",declinedTag:"\u898B\u9001\u308A",undoDecision:"\u53D6\u308A\u6D88\u3059",outputs:"\u6210\u679C\u7269",noOutputs:"\u307E\u3060\u6210\u679C\u7269\u306F\u3042\u308A\u307E\u305B\u3093\u3002",copy:e=>`${e} \u3092\u30B3\u30D4\u30FC`,copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",log:"Agent \u3068\u306E\u3084\u308A\u3068\u308A",logLede:"\u65B0\u3057\u3044\u9806",noLog:"\u307E\u3060\u3084\u308A\u3068\u308A\u306F\u3042\u308A\u307E\u305B\u3093\u3002",fromAgent:"Agent",latestTag:"\u6700\u65B0",commentOn:e=>`${e} \u306B\u30B3\u30E1\u30F3\u30C8`,todoGroup:"Todo",logGroup:"\u4F5C\u696D\u30ED\u30B0",contextGroup:"Context",proposalGroup:"\u63D0\u6848",questionGroup:"\u8CEA\u554F",approved:"\u524D\u63D0\u3092\u627F\u8A8D",answered:"\u56DE\u7B54",answerCleared:"\u8FD4\u7B54\u3092\u30AF\u30EA\u30A2",accepted:"\u63D0\u6848\u3092\u627F\u8A8D",declined:"\u63D0\u6848\u3092\u898B\u9001\u308A",decisionCleared:"\u63D0\u6848\u306E\u5224\u65AD\u3092\u30AF\u30EA\u30A2",statusChanged:"\u72B6\u614B\u3092\u5909\u66F4",todoAdded:"Todo \u3092\u8FFD\u52A0",todoRemoved:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3057",quoted:e=>`\u2192 \u300C${e}\u300D`,change:(e,o)=>`${e} \u2192 ${o}`}}),xo=(e,o)=>{switch(o){case"working":return e.statusWorking;case"waiting":return e.statusWaiting;case"blocked":return e.statusBlocked;case"done":return e.statusDone}},z=(e,o)=>{switch(o){case"todo":return e.todoTodo;case"doing":return e.todoDoing;case"blocked":return e.todoBlocked;case"done":return e.todoDone}},le=(e,o)=>o==="agent"?e.kindAgent:e.kindHuman,L=(e,o)=>{switch(o){case"why":return e.contextWhy;case"what":return e.contextWhat;case"goals":return e.contextGoals;case"nonGoals":return e.contextNonGoals}},fo=48,H=e=>{const o=e.title??e.body??e.id;return o.length<=fo?o:`${o.slice(0,fo-1)}\u2026`},pe=(e,o,a)=>a===null?e.unassigned:O(o,a)?.name??a,mo=e=>e.title===""?"Task Context Board":e.title,vo=(e,o,a)=>{switch(a.type){case"todo":{const t=k(o,a.id);return`${t?.proposed===!0?e.proposalGroup:e.todoGroup} \xB7 ${t?.title??a.id}`}case"log":{const t=so(o,a.id);return`${e.logGroup} \xB7 ${t===void 0?a.id:H(t)}`}case"context":return`${e.contextGroup} \xB7 ${io(a.id)?L(e,a.id):a.id}`;case"question":{const t=C(o,a.id);return t===void 0?a.id:`${t.ref} \xB7 ${t.title}`}case"page":return e.wholeBoard;default:return a.id}},ce=(e,o)=>{switch(o){case"accept":return{title:e.accepted,tone:"update"};case"decline":return{title:e.declined,tone:"update"};case"clear":return{title:e.decisionCleared,tone:"delete"}}},ue=(e,o,a)=>{switch(a.type){case"ANSWER_QUESTION":{const t=S(m.ANSWER_QUESTION,a);if(t.kind==="clear")return{title:e.answerCleared,tone:"delete"};if(t.kind==="approve"){const r=C(o,a.target.id)?.assumption??null;return{title:e.approved,tone:"update",...r===null?{}:{body:e.quoted(r)}}}return{title:e.answered,tone:"update",body:e.quoted(t.text.slice(0,120))}}case"DECIDE_PROPOSAL":return ce(e,S(m.DECIDE_PROPOSAL,a).decision);case"SET_TODO_STATUS":{const{status:t}=S(m.SET_TODO_STATUS,a),r=k(o,a.target.id)?.status,d=z(e,t);return{title:e.statusChanged,tone:"update",body:r===void 0?d:e.change(z(e,r),d)}}case"ADD_TODO":{const t=S(m.ADD_TODO,a);return{title:e.todoAdded,tone:"create",targetLabel:`${e.todoGroup} \xB7 ${t.title}`,...t.assignee===null?{}:{body:`${e.assignee}: ${pe(e,o,t.assignee)}`}}}case"DELETE_TODO":return{title:e.todoRemoved,tone:"delete"};default:return{title:a.type,tone:"meta"}}},wo=(e,o,a,t)=>{let r;try{r=ue(e,t??a,o)}catch{r={title:o.type,tone:"meta"}}return{title:r.title,targetLabel:r.targetLabel??vo(e,a,o.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},$o=e=>`${e.type} ${Fo(e.target)} ${JSON.stringify(e.payload)}`,yo=(e,o)=>[...o.questions.map(a=>({value:`question:${a.id}`,label:`${a.ref} \xB7 ${a.title}`,group:e.questionGroup})),...o.todos.map(a=>({value:`todo:${a.id}`,label:a.title,group:a.proposed?e.proposalGroup:e.todoGroup})),...o.log.map(a=>({value:`log:${a.id}`,label:H(a),group:e.logGroup})),...E.filter(a=>N(o,a)).map(a=>({value:`context:${a}`,label:L(e,a),group:e.contextGroup}))],To=(e,o)=>o,Ao=(e,o,a)=>({parts:E.filter(t=>N(o,t)).map(t=>{const r=o.context[t];return{id:t,title:L(e,t),text:typeof r=="string"?r:null,items:typeof r=="string"||r===null?[]:r,comments:a(`context:${t}`)}})}),be=(e,o,a)=>{const t=e.answers[o.id];return{id:o.id,ref:o.ref,title:o.title,description:o.description,blocking:o.blocking,assumption:o.assumption,reply:t?.kind??"none",resolved:lo(e,o),draft:t?.kind==="answer"?t.text:"",comments:a(`question:${o.id}`)}},Oo=(e,o)=>{const a=e.questions.map(r=>be(e,r,o)),t=a.filter(r=>r.resolved).length;return{blocking:a.filter(r=>r.blocking),provisional:a.filter(r=>!r.blocking),resolved:t,total:a.length,open:a.length-t,blockingOpen:a.filter(r=>r.blocking&&!r.resolved).length}},ge=(e,o,a,t,r)=>{const d=k(a,t.id),l=O(o,t.assignee);return{id:t.id,title:t.title,note:t.note,reason:t.reason,status:t.status,statusLabel:z(e,t.status),assignee:t.assignee,assigneeName:l?.name??null,assigneeKind:l?.kind??null,editable:Q(o,t),proposal:t.proposed?o.decisions[t.id]??"pending":null,added:t.added,changed:d!==void 0&&d.status!==t.status,comments:r(`todo:${t.id}`)}},So=(e,o,a,t,r="all")=>{const d=o.todos.filter(p=>R(o,p)),l=d.filter(p=>p.status==="done").length,g=o.members.some(p=>p.kind==="human"),x=g?r:"all",F=p=>p.assigneeKind==="human",G=o.todos.map(p=>ge(e,o,a,p,t)),j=x==="human"?G.filter(F):G,Y=p=>p.status==="done"&&k(a,p.id)?.status==="done";return{todos:j.filter(p=>!Y(p)),done:j.filter(Y),filter:x,canFilter:g,humanCount:G.filter(F).length,progress:{done:l,total:d.length,label:d.length===0?e.noTodosYet:e.progress(l,d.length)},statuses:D.map(p=>({value:p,label:z(e,p)})),members:o.members.map(p=>({id:p.id,label:e.memberOption(p.name,le(e,p.kind))}))}},Do=e=>{if(!/^[a-z][a-z\d+.-]*:\/\//i.test(e))return{kind:"path"};try{return{kind:"url",host:new URL(e).host}}catch{return{kind:"path"}}},Eo=e=>e.outputs.map(o=>({id:o.id,title:o.label??o.href,labelled:o.label!==null,href:o.href,kind:o.kind,description:o.description,place:Do(o.href)})),Co=(e,o,a)=>({entries:o.log.map((t,r)=>{const d=O(o,t.from);return{id:t.id,author:d===void 0?null:{name:d.name,kind:d.kind},at:t.at,title:t.title,body:t.body,points:t.points,label:H(t),latest:r===o.log.length-1,comments:a(`log:${t.id}`)}}).reverse(),status:o.status===null&&o.updatedAt===null?null:{status:o.status,label:o.status===null?null:xo(e,o.status),updatedAt:o.updatedAt}}),zo=(e,o)=>{switch(o.type){case"todo":return k(e,o.id)!==void 0;case"log":return so(e,o.id)!==void 0;case"context":return io(o.id)&&N(e,o.id);case"question":return C(e,o.id)!==void 0;case"page":return!0;default:return!1}},Lo=e=>{const o=U(e);return{name:"task-board",label:"Task Context Board",parseBase:ro,emptyBase:no,actions:m,apply:ko,hasTarget:zo,describe:(a,t,r)=>wo(o,a,t,r),serialize:$o,resolveNavigation:To,commentTargets:a=>yo(o,a),title:mo}},_=(e,o,a,t)=>n`
2
2
  <button
3
3
  class="dpk-icon-btn board-comment"
4
4
  type="button"
@@ -9,7 +9,7 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
9
9
  >
10
10
  ${jo()} ${a>0?n`<span class="dpk-icon-badge">${a}</span>`:s}
11
11
  </button>
12
- `,K=(e,o,a,t=null)=>n`
12
+ `,M=(e,o,a,t=null)=>n`
13
13
  <header class="board-section-head">
14
14
  <h2 id=${e}>${o}</h2>
15
15
  ${a===null?s:n`<span class="board-section-meta">${a}</span>`}
@@ -36,7 +36,7 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
36
36
  </article>
37
37
  `,xe=(e,o,a)=>o.total===0?s:n`
38
38
  <section class="board-section" data-section="questions" aria-labelledby="board-questions">
39
- ${K("board-questions",e.questions,e.questionsProgress(o.resolved,o.total))}
39
+ ${M("board-questions",e.questions,e.questionsProgress(o.resolved,o.total))}
40
40
  ${_o(e,"blocking",e.blockingGroup,o.blocking,a)}
41
41
  ${_o(e,"provisional",e.provisionalGroup,o.provisional,a)}
42
42
  </section>
@@ -99,12 +99,12 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
99
99
  </div>
100
100
  `,ve=(e,o,a,t)=>n`
101
101
  <section class="board-section board-rail-section" data-section="outputs" aria-labelledby="board-outputs">
102
- ${K("board-outputs",e.outputs,o.length===0?null:String(o.length))}
102
+ ${M("board-outputs",e.outputs,o.length===0?null:String(o.length))}
103
103
  ${o.length===0?n`<p class="board-empty">${e.noOutputs}</p>`:n`<ul class="board-outputs">
104
- ${y(o,r=>r.id,r=>$e(e,r,a===r.id,t))}
104
+ ${y(o,r=>r.id,r=>we(e,r,a===r.id,t))}
105
105
  </ul>`}
106
106
  </section>
107
- `,$e=(e,o,a,t)=>{const r=o.place,d=a?e.copied:e.copy(o.href);return n`
107
+ `,we=(e,o,a,t)=>{const r=o.place,d=a?e.copied:e.copy(o.href);return n`
108
108
  <li class="board-output" data-output=${o.id} data-place=${r.kind}>
109
109
  <div class="board-output-body">
110
110
  <div class="board-output-head">
@@ -134,9 +134,9 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
134
134
  </span>`}
135
135
  ${o.updatedAt===null?s:n`<span class="board-updated">${e.updatedAt(o.updatedAt)}</span>`}
136
136
  </div>
137
- `,we=(e,o,a)=>n`
137
+ `,$e=(e,o,a)=>n`
138
138
  <section class="board-section" data-section="log" aria-labelledby="board-log">
139
- ${K("board-log",e.log,o.entries.length===0?null:e.logLede)}
139
+ ${M("board-log",e.log,o.entries.length===0?null:e.logLede)}
140
140
  ${o.entries.length===0?n`${o.status===null?s:Go(e,o.status)}
141
141
  <p class="board-empty">${e.noLog}</p>`:n`<ol class="board-log">
142
142
  ${y(o.entries,t=>t.id,t=>ye(e,t,t.latest?o.status:null,a))}
@@ -183,7 +183,7 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
183
183
  ${Ae(e,d)}${l===null||l===0?s:n`<span class="board-tab-count">${l}</span>`}
184
184
  </button>`})}
185
185
  </div>
186
- `,M=(e,o,a)=>n`
186
+ `,K=(e,o,a)=>n`
187
187
  <div
188
188
  class="board-panel"
189
189
  id=${`board-panel-${e}`}
@@ -391,11 +391,21 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
391
391
  border-top: 1px solid var(--dpk-rule);
392
392
  }
393
393
 
394
- /* Stacked, the rail takes the full width: there is no edge to drag. */
395
- .dpk-sidebar-resizer {
394
+ /* Stacked, the rail takes the full width: there is no edge to drag or
395
+ fold on. A rail folded on a wider screen is a bar to unfold it. */
396
+ .dpk-sidebar-resizer,
397
+ .dpk-body > .dpk-sidebar-toggle {
396
398
  display: none;
397
399
  }
398
400
 
401
+ .dpk-sidebar-strip {
402
+ width: auto;
403
+ padding: 8px 14px;
404
+ justify-content: flex-start;
405
+ border-left: 0;
406
+ border-top: 1px solid var(--dpk-rule);
407
+ }
408
+
399
409
  /* The body scrolls here, so an absolute panel would scroll away with it:
400
410
  the review takes the screen instead, below the floating button. */
401
411
  .dpk-notes {
@@ -1589,10 +1599,10 @@ import{a9 as Ro,aa as b,ab as i,ac as f,ad as c,ae as $,at as h,al as X,af as J,
1589
1599
  `,main:n`
1590
1600
  <div class="board">
1591
1601
  ${Se(a,g,{log:d.entries.length,questions:r.open,alert:r.blockingOpen>0},x=>{this.tab=x},x=>this.#t(x))}
1592
- ${M("context",g,he(a,Ao(a,o.state,t),this.#n(),l))}
1593
- ${M("log",g,we(a,d,l))}
1594
- ${M("questions",g,r.total===0?n`<p class="board-empty">${a.noQuestions}</p>`:xe(a,r,l))}
1602
+ ${K("context",g,he(a,Ao(a,o.state,t),this.#n(),l))}
1603
+ ${K("log",g,$e(a,d,l))}
1604
+ ${K("questions",g,r.total===0?n`<p class="board-empty">${a.noQuestions}</p>`:xe(a,r,l))}
1595
1605
  </div>
1596
1606
  `}}updated(){super.updated();const o=this.#o;o!==null&&(this.#o=null,this.renderRoot.querySelector(`[data-answer-text="${o}"]`)?.focus())}#t(o){const a=Te(this.tab,o.key);a!==null&&(o.preventDefault(),this.tab=a,this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-tab="${a}"]`)?.focus()))}#r(o,a){return a.status===null?s:n`<span class="board-status board-status--header" data-status=${a.status}>
1597
1607
  <span class="board-status-dot" aria-hidden="true"></span>${xo(o,a.status)}
1598
- </span>`}#n(){return this.querySelector(':scope > [slot="main"]')!==null}#d(){return{answer:(o,a)=>this.#s(o,a),answerOther:o=>this.#i(o),decide:(o,a)=>this.dispatch(uo(o,a)),setStatus:(o,a)=>this.dispatch(bo(o,a)),filterTodos:o=>{this.todoFilter=o},addTodo:(o,a)=>this.#l(o,a),deleteTodo:o=>this.dispatch(ho(o)),copy:(o,a)=>{this.#p(o,a)},comment:o=>this.requestComment(o)}}#s(o,a){this.dispatch(Q(o,a))}#i(o){this.dispatch(Q(o,{kind:"answer",text:""})).ok&&(this.#o=o)}#l(o,a){const{base:t,state:r}=this.derivation,d=[...t.todos,...r.todos].map(l=>l.id);this.dispatch(go(Zo(o,d),o,a))}async#p(o,a){await oe(a)&&(clearTimeout(this.#a),this.#e=o,this.requestUpdate(),this.#a=setTimeout(()=>{this.#e=null,this.requestUpdate()},Ne))}}const No=()=>{customElements.get("dpk-template-task-board")||customElements.define("dpk-template-task-board",Wo)},Re=Object.freeze(Object.defineProperty({__proto__:null,CONTEXT_PARTS:E,DpkTemplateTaskBoard:Wo,MEMBER_KINDS:ao,TASK_BOARD_PAGE:co,TASK_STATUSES:eo,TODO_STATUSES:D,addTodo:go,answerQuestion:Q,applyTaskBoardAction:ko,contextPartTitle:L,decideProposal:uo,defineTaskBoardElement:No,deleteTodo:ho,describeTaskBoardAction:$o,emptyTaskBoardBase:no,isAnswered:lo,isHumanTodo:q,isPlanned:R,outputLocation:Do,parseTaskBoardBase:ro,presentContext:Ao,presentLog:Co,presentOutputs:Eo,presentQuestions:Oo,presentTodos:So,resolveTaskBoardNavigation:To,serializeTaskBoardAction:wo,setTodoStatus:bo,taskBoardActions:m,taskBoardBaseSchema:to,taskBoardCommentTargets:yo,taskBoardDefinitionFor:Lo,taskBoardHasTarget:zo,taskBoardMessages:U,taskBoardTargetLabel:vo,taskBoardTitle:mo},Symbol.toStringTag,{value:"Module"}));export{No as d,Re as i};
1608
+ </span>`}#n(){return this.querySelector(':scope > [slot="main"]')!==null}#d(){return{answer:(o,a)=>this.#s(o,a),answerOther:o=>this.#i(o),decide:(o,a)=>this.dispatch(uo(o,a)),setStatus:(o,a)=>this.dispatch(bo(o,a)),filterTodos:o=>{this.todoFilter=o},addTodo:(o,a)=>this.#l(o,a),deleteTodo:o=>this.dispatch(ho(o)),copy:(o,a)=>{this.#p(o,a)},comment:o=>this.requestComment(o)}}#s(o,a){this.dispatch(I(o,a))}#i(o){this.dispatch(I(o,{kind:"answer",text:""})).ok&&(this.#o=o)}#l(o,a){const{base:t,state:r}=this.derivation,d=[...t.todos,...r.todos].map(l=>l.id);this.dispatch(go(Zo(o,d),o,a))}async#p(o,a){await oe(a)&&(clearTimeout(this.#a),this.#e=o,this.requestUpdate(),this.#a=setTimeout(()=>{this.#e=null,this.requestUpdate()},Ne))}}const No=()=>{customElements.get("dpk-template-task-board")||customElements.define("dpk-template-task-board",Wo)},Re=Object.freeze(Object.defineProperty({__proto__:null,CONTEXT_PARTS:E,DpkTemplateTaskBoard:Wo,MEMBER_KINDS:ao,TASK_BOARD_PAGE:co,TASK_STATUSES:eo,TODO_STATUSES:D,addTodo:go,answerQuestion:I,applyTaskBoardAction:ko,contextPartTitle:L,decideProposal:uo,defineTaskBoardElement:No,deleteTodo:ho,describeTaskBoardAction:wo,emptyTaskBoardBase:no,isAnswered:lo,isHumanTodo:Q,isPlanned:R,outputLocation:Do,parseTaskBoardBase:ro,presentContext:Ao,presentLog:Co,presentOutputs:Eo,presentQuestions:Oo,presentTodos:So,resolveTaskBoardNavigation:To,serializeTaskBoardAction:$o,setTodoStatus:bo,taskBoardActions:m,taskBoardBaseSchema:to,taskBoardCommentTargets:yo,taskBoardDefinitionFor:Lo,taskBoardHasTarget:zo,taskBoardMessages:U,taskBoardTargetLabel:vo,taskBoardTitle:mo},Symbol.toStringTag,{value:"Module"}));export{No as d,Re as i};
@@ -0,0 +1,29 @@
1
+ import{a0 as Wt,a3 as lt,a4 as K}from"./shared-7qenhU4J.js";const I=Math.min,S=Math.max,Q=Math.round,Z=Math.floor,$=t=>({x:t,y:t}),Nt={left:"right",right:"left",bottom:"top",top:"bottom"};function Vt(t,e,n){return S(t,I(e,n))}function U(t,e){return typeof t=="function"?t(e):t}function _(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function xt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}function P(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function vt(t){return xt(P(t))}function _t(t,e,n){n===void 0&&(n=!1);const o=Y(t),i=vt(t),s=bt(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=tt(r)),[r,tt(r)]}function Ht(t){const e=tt(t);return[at(t),e,at(e)]}function at(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Rt=["left","right"],Ct=["right","left"],Bt=["top","bottom"],zt=["bottom","top"];function It(t,e,n){switch(t){case"top":case"bottom":return n?e?Ct:Rt:e?Rt:Ct;case"left":case"right":return e?Bt:zt;default:return[]}}function Xt(t,e,n,o){const i=Y(t);let s=It(_(t),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(at)))),s}function tt(t){const e=_(t);return Nt[e]+t.slice(e.length)}function jt(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function qt(t){return typeof t!="number"?jt(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function At(t,e,n){let{reference:o,floating:i}=t;const s=P(e),r=vt(e),c=bt(r),l=_(e),a=s==="y",f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let d;switch(l){case"top":d={x:f,y:o.y-i.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-i.width,y:u};break;default:d={x:o.x,y:o.y}}const h=Y(e);return h&&(d[r]+=m*(h==="end"?1:-1)*(n&&a?-1:1)),d}async function Kt(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:m=!1,padding:d=0}=U(e,t),h=qt(d),w=c[m?u==="floating"?"reference":"floating":u],p=et(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),y=u==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},C=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:x,strategy:l}):y);return{top:(p.top-C.top+h.top)/b.y,bottom:(C.bottom-p.bottom+h.bottom)/b.y,left:(p.left-C.left+h.left)/b.x,right:(C.right-p.right+h.right)/b.x}}const Ut=50,Yt=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,c=r.detectOverflow?r:{...r,detectOverflow:Kt},l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=At(a,o,l),m=o,d=0;const h={};for(let g=0;g<s.length;g++){const w=s[g];if(!w)continue;const{name:p,fn:y}=w,{x,y:b,data:C,reset:v}=await y({x:f,y:u,initialPlacement:o,placement:m,strategy:i,middlewareData:h,rects:a,platform:c,elements:{reference:t,floating:e}});f=x??f,u=b??u,h[p]={...h[p],...C},v&&d<Ut&&(d++,typeof v=="object"&&(v.placement&&(m=v.placement),v.rects&&(a=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:f,y:u}=At(a,m,l)),g=-1)}return{x:f,y:u,placement:m,strategy:i,middlewareData:h}},Gt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...w}=U(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const p=_(i),y=P(c),x=_(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=m||(x||!g?[tt(c)]:Ht(c)),v=h!=="none";!m&&v&&C.push(...Xt(c,g,h,b));const D=[c,...C],T=await l.detectOverflow(e,w),W=[];let O=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&W.push(T[p]),u){const N=_t(i,r,b);W.push(T[N[0]],T[N[1]])}if(O=[...O,{placement:i,overflows:W}],!W.every(N=>N<=0)){var gt,wt;const N=(((gt=s.flip)==null?void 0:gt.index)||0)+1,ct=D[N];if(ct&&(!(u==="alignment"?y!==P(ct):!1)||O.every(A=>P(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:N,overflows:O},reset:{placement:ct}};let q=(wt=O.filter(V=>V.overflows[0]<=0).sort((V,A)=>V.overflows[1]-A.overflows[1])[0])==null?void 0:wt.placement;if(!q)switch(d){case"bestFit":{var yt;const V=(yt=O.filter(A=>{if(v){const M=P(A.placement);return M===y||M==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(M=>M>0).reduce((M,Ft)=>M+Ft,0)]).sort((A,M)=>A[1]-M[1])[0])==null?void 0:yt[0];V&&(q=V);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}},Jt=new Set(["left","top"]);async function Qt(t,e){const{placement:n,platform:o,elements:i}=t,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=_(n),c=Y(n),l=P(n)==="y",a=Jt.has(r)?-1:1,f=s&&l?-1:1,u=U(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),l?{x:d*f,y:m*a}:{x:m*a,y:d*f}}const Zt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:s,placement:r,middlewareData:c}=e,l=await Qt(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},te=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...a}=U(t,e),f={x:n,y:o},u=await s.detectOverflow(e,a),m=P(i),d=xt(m);let h=f[d],g=f[m];const w=(y,x)=>Vt(x+u[y==="y"?"top":"left"],x,x-u[y==="y"?"bottom":"right"]);r&&(h=w(d,h)),c&&(g=w(m,g));const p=l.fn({...e,[d]:h,[m]:g});return{...p,data:{x:p.x-n,y:p.y-o,enabled:{[d]:r,[m]:c}}}}}},ee=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:s}=e,{apply:r=()=>{},...c}=U(t,e),l=await i.detectOverflow(e,c),a=_(n),f=Y(n),u=P(n)==="y",{width:m,height:d}=o.floating;let h,g;a==="top"||a==="bottom"?(h=a,g=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=a,h=f==="end"?"top":"bottom");const w=d-l.top-l.bottom,p=m-l.left-l.right,y=I(d-l[h],w),x=I(m-l[g],p),b=e.middlewareData.shift,C=!b;let v=y,D=x;b!=null&&b.enabled.x&&(D=p),b!=null&&b.enabled.y&&(v=w),C&&!f&&(u?D=m-2*S(l.left,l.right):v=d-2*S(l.top,l.bottom)),await r({...e,availableWidth:D,availableHeight:v});const T=await i.getDimensions(s.floating);return m!==T.width||d!==T.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function X(t){return Ot(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Ot(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ot(t){return nt()?t instanceof Node||t instanceof R(t).Node:!1}function L(t){return nt()?t instanceof Element||t instanceof R(t).Element:!1}function F(t){return nt()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function Lt(t){return!nt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=E(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function ne(t){return/^(table|td|th)$/.test(X(t))}function it(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const oe=/transform|translate|scale|rotate|perspective|filter/,ie=/paint|layout|strict|content/,H=t=>!!t&&t!=="none";let ft;function ut(t){const e=L(t)?E(t):t;return H(e.transform)||H(e.translate)||H(e.scale)||H(e.rotate)||H(e.perspective)||!dt()&&(H(e.backdropFilter)||H(e.filter))||oe.test(e.willChange||"")||ie.test(e.contain||"")}function se(t){let e=B(t);for(;F(e)&&!G(e);){if(ut(e))return e;if(it(e))return null;e=B(e)}return null}function dt(){return ft==null&&(ft=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ft}function G(t){return/^(html|body|#document)$/.test(X(t))}function E(t){return R(t).getComputedStyle(t)}function st(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(X(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lt(t)&&t.host||k(t);return Lt(e)?e.host:e}function Et(t){const e=B(t);return G(e)?(t.ownerDocument||t).body:F(e)&&ot(e)?e:Et(e)}function J(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Et(t),s=i===((o=t.ownerDocument)==null?void 0:o.body),r=R(i);if(s){const c=mt(r);return e.concat(r,r.visualViewport||[],ot(i)?i:[],c&&n?J(c):[])}else return e.concat(i,J(i,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Tt(t){const e=E(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=F(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,c=Q(n)!==s||Q(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function ht(t){return L(t)?t:t.contextElement}function j(t){const e=ht(t);if(!F(e))return $(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:s}=Tt(e);let r=(s?Q(n.width):n.width)/o,c=(s?Q(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const re=$(0);function St(t){const e=R(t);return!dt()||!e.visualViewport?re:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ce(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===R(t)}function z(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=ht(t);let r=$(1);e&&(o?L(o)&&(r=j(o)):r=j(t));const c=ce(s,n,o)?St(s):$(0);let l=(i.left+c.x)/r.x,a=(i.top+c.y)/r.y,f=i.width/r.x,u=i.height/r.y;if(s&&o){const m=R(s),d=L(o)?R(o):o;let h=m,g=mt(h);for(;g&&d!==h;){const w=j(g),p=g.getBoundingClientRect(),y=E(g),x=p.left+(g.clientLeft+parseFloat(y.paddingLeft))*w.x,b=p.top+(g.clientTop+parseFloat(y.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,u*=w.y,l+=x,a+=b,h=R(g),g=mt(h)}}return et({width:f,height:u,x:l,y:a})}function rt(t,e){const n=st(t).scrollLeft;return e?e.left+n:z(k(t)).left+n}function $t(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-rt(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function le(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const s=i==="fixed",r=k(o),c=e?it(e.floating):!1;if(o===r||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=$(1);const f=$(0),u=F(o);if((u||!s)&&((X(o)!=="body"||ot(r))&&(l=st(o)),u)){const d=z(o);a=j(o),f.x=d.x+o.clientLeft,f.y=d.y+o.clientTop}const m=r&&!u&&!s?$t(r,l):$(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+f.x+m.x,y:n.y*a.y-l.scrollTop*a.y+f.y+m.y}}function ae(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function fe(t){const e=st(t),n=t.ownerDocument.body,o=S(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=S(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+rt(t);const r=-e.scrollTop;return E(n).direction==="rtl"&&(s+=S(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:s,y:r}}const ue=25;function de(t,e,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=R(t),s=k(t),r=i.visualViewport;let c=s.clientWidth,l=s.clientHeight,a=0,f=0;if(r){const m=!dt()||e==="fixed";o?m||(a=-r.offsetLeft,f=-r.offsetTop):(c=r.width,l=r.height,m&&(a=r.offsetLeft,f=r.offsetTop))}if(rt(s)<=0){const m=s.ownerDocument,d=m.body,h=getComputedStyle(d),g=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,w=Math.abs(s.clientWidth-d.clientWidth-g),p=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;p<=ue&&(c-=p)}return{width:c,height:l,x:a,y:f}}function me(t,e){const n=z(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=j(t),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,a=o*s.y;return{width:r,height:c,x:l,y:a}}function Pt(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=de(t,n,e);else if(e==="document")o=fe(k(t));else if(L(e))o=me(e,n);else{const i=St(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return et(o)}function he(t,e){const n=e.get(t);if(n)return n;let o=J(t,[],!1).filter(c=>L(c)&&X(c)!=="body"),i=null;const s=E(t).position==="fixed";let r=s?B(t):t;for(;L(r)&&!G(r);){const c=E(r),l=ut(r),a=i?i.position:s?"fixed":"";!l&&(a==="fixed"||a==="absolute"&&c.position==="static")?o=o.filter(u=>u!==r):i=c,r=B(r)}return e.set(t,o),o}function pe(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[...n==="clippingAncestors"?it(e)?[]:he(e,this._c):[].concat(n),o],c=Pt(e,r[0],i);let l=c.top,a=c.right,f=c.bottom,u=c.left;for(let m=1;m<r.length;m++){const d=Pt(e,r[m],i);l=S(d.top,l),a=I(d.right,a),f=I(d.bottom,f),u=S(d.left,u)}return{width:a-u,height:f-l,x:u,y:l}}function ge(t){const{width:e,height:n}=Tt(t);return{width:e,height:n}}function we(t,e,n){const o=F(e),i=k(e),s=n==="fixed",r=z(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=$(0);if((o||!s)&&((X(e)!=="body"||ot(i))&&(c=st(e)),o)){const m=z(e,!0,s,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}!o&&i&&(l.x=rt(i));const a=i&&!o&&!s?$t(i,c):$(0),f=r.left+c.scrollLeft-l.x-a.x,u=r.top+c.scrollTop-l.y-a.y;return{x:f,y:u,width:r.width,height:r.height}}function pt(t){return E(t).position==="static"}function kt(t,e){if(!F(t)||E(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function Dt(t,e){const n=R(t);if(it(t))return n;if(!F(t)){let i=B(t);for(;i&&!G(i);){if(L(i)&&!pt(i))return i;i=B(i)}return n}let o=kt(t,e);for(;o&&ne(o)&&pt(o);)o=kt(o,e);return o&&G(o)&&pt(o)&&!ut(o)?n:o||se(t)||n}const ye=async function(t){const e=this.getOffsetParent||Dt,n=this.getDimensions,o=await n(t.floating);return{reference:we(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function xe(t){return E(t).direction==="rtl"}const be={convertOffsetParentRelativeRectToViewportRelativeRect:le,getDocumentElement:k,getClippingRect:pe,getOffsetParent:Dt,getElementRects:ye,getClientRects:ae,getDimensions:ge,getScale:j,isElement:L,isRTL:xe};function Mt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ve(t,e,n){let o=null,i;const s=k(t);function r(){var f;clearTimeout(i),(f=o)==null||f.disconnect(),o=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),r();const m=t.getBoundingClientRect(),{left:d,top:h,width:g,height:w}=m;if(f||e(),!g||!w)return;const p=Z(h),y=Z(s.clientWidth-(d+g)),x=Z(s.clientHeight-(h+w)),b=Z(d),v={rootMargin:-p+"px "+-y+"px "+-x+"px "+-b+"px",threshold:S(0,I(1,u))||1};let D=!0;function T(W){const O=W[0].intersectionRatio;if(!Mt(m,t.getBoundingClientRect()))return c();if(O!==u){if(!D)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}D=!1}try{o=new IntersectionObserver(T,{...v,root:s.ownerDocument})}catch{o=new IntersectionObserver(T,v)}o.observe(t)}const l=R(t),a=()=>c(n);return l.addEventListener("resize",a),c(!0),()=>{l.removeEventListener("resize",a),r()}}function Re(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=ht(t),f=i||s?[...a?J(a):[],...e?J(e):[]]:[];f.forEach(p=>{i&&p.addEventListener("scroll",n),s&&p.addEventListener("resize",n)});const u=a&&c?ve(a,n,s):null;let m=-1,d=null;r&&(d=new ResizeObserver(p=>{let[y]=p;y&&y.target===a&&d&&e&&(d.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),n()}),a&&!l&&d.observe(a),e&&d.observe(e));let h,g=l?z(t):null;l&&w();function w(){const p=z(t);g&&!Mt(g,p)&&n(),g=p,h=requestAnimationFrame(w)}return n(),()=>{var p;f.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),u?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(h)}}const Ce=Zt,Ae=te,Oe=Gt,Le=ee,Ee=(t,e,n)=>{const o=new Map,i=n??{},s={...be,...i.platform,_c:o};return Yt(t,e,{...i,platform:s})},Te=(t,e)=>({top:e,bottom:e,right:t}),Se=(t,e,n,o={})=>{if(typeof t.showPopover!="function")return()=>{};try{t.showPopover()}catch{return()=>{}}let i=!0,s=0;const r=e instanceof Element?e:{getBoundingClientRect:()=>({x:e.right,y:e.top,left:e.right,right:e.right,top:e.top,bottom:e.bottom,width:0,height:e.bottom-e.top})};t.style.width=`${n.width}px`,t.style.maxHeight=`${n.height}px`;const l=Re(r,t,()=>{const a=++s;Ee(r,t,{strategy:"fixed",placement:o.placement??"bottom-end",middleware:[Ce(8),Oe({padding:8,fallbackAxisSideDirection:"end"}),Ae({padding:8}),Le({padding:8,apply:({availableWidth:f,availableHeight:u})=>{!i||a!==s||(t.style.width=`${Math.max(0,Math.min(n.width,f))}px`,t.style.maxHeight=`${Math.max(0,Math.min(n.height,u))}px`)}})]}).then(({x:f,y:u})=>{!i||a!==s||!t.isConnected||(t.style.left=`${f}px`,t.style.top=`${u}px`)}).catch(()=>{})},{animationFrame:o.trackTransform??!1,elementResize:typeof ResizeObserver<"u",layoutShift:typeof IntersectionObserver<"u"});return()=>{i=!1,l()}},$e=t=>{if(!(!t||typeof t.hidePopover!="function"))try{t.hidePopover()}catch{}};class Pe{#e;#t=new Map;constructor(e){this.#e=e,e.addController(this)}hostConnected(){this.#e.requestUpdate()}hostUpdated(){for(const[e,n]of this.#t)e.isConnected||(n(),this.#t.delete(e))}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}open(e,n,o,i){this.#t.get(e)?.(),this.#t.set(e,Se(e,n,o,i))}}const ke=Wt({en:{comment:"Comment",commentOn:t=>`Comment on ${t}`,submit:"Send",cancel:"Cancel"},ja:{comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:t=>`${t}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`,submit:"\u9001\u4FE1",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"}}),De=(t,e,n={})=>({body:t,notes:e,submission:t.trim()||null,label:n.label??null,error:n.error??null}),Me=(t,e,n)=>{const o=()=>{e.submission!==null&&n({kind:"comment",body:e.submission})};return K`<div
2
+ class="comment-pop"
3
+ popover="manual"
4
+ role="dialog"
5
+ aria-label=${e.label?t.commentOn(e.label):t.comment}
6
+ @click=${i=>i.stopPropagation()}
7
+ @keydown=${i=>{i.isComposing||i.key!=="Escape"||(i.preventDefault(),i.stopPropagation(),n({kind:"dismiss"}))}}
8
+ >
9
+ ${e.label?K`<strong class="comment-target">${e.label}</strong>`:lt}
10
+ ${e.error?K`<p class="comment-error" role="alert">${e.error}</p>`:lt}
11
+ ${e.notes.length?K`<ul class="comment-list">
12
+ ${e.notes.map(i=>K`<li>${i}</li>`)}
13
+ </ul>`:lt}
14
+ <textarea
15
+ class="dpk-textarea"
16
+ aria-label=${t.comment}
17
+ .value=${e.body}
18
+ @input=${i=>{i.currentTarget instanceof HTMLTextAreaElement&&n({kind:"input",body:i.currentTarget.value})}}
19
+ @keydown=${i=>{i.isComposing||i.key==="Enter"&&(i.ctrlKey||i.metaKey)&&(i.preventDefault(),o())}}
20
+ ></textarea>
21
+ <div class="pop-actions">
22
+ <button class="dpk-btn dpk-btn--accent" type="button" ?disabled=${e.submission===null} @click=${o}>
23
+ ${t.submit}
24
+ </button>
25
+ <button class="dpk-btn dpk-btn--ghost" type="button" @click=${()=>n({kind:"dismiss"})}>
26
+ ${t.cancel}
27
+ </button>
28
+ </div>
29
+ </div>`};export{Pe as P,Te as a,$e as b,ke as c,De as p,Me as r};
@@ -1 +1 @@
1
- import{aG as t,aH as a,a1 as i,aI as n}from"./shared-Bfq73Ivq.js";const o=t(class extends a{constructor(){super(...arguments),this.key=i}render(s,e){return this.key=s,e}update(s,[e,r]){return e!==this.key&&(n(s),this.key=e),r}});export{o as i};
1
+ import{aL as t,aM as a,a3 as i,aN as n}from"./shared-7qenhU4J.js";const o=t(class extends a{constructor(){super(...arguments),this.key=i}render(s,e){return this.key=s,e}update(s,[e,r]){return e!==this.key&&(n(s),this.key=e),r}});export{o as i};
@@ -1,4 +1,4 @@
1
- import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,ac as $,a9 as ke,R as z,_ as ve,V as xe,a2 as s,a3 as F,a1 as d,au as O,a0 as me,T as P,aD as we,aE as ye}from"./shared-Bfq73Ivq.js";import{c as N}from"./shared-ml5h7U5L.js";const $e=(t,e,r)=>r.top<e.top?t+r.top-e.top:r.bottom<=e.bottom?t:t+Math.min(r.bottom-e.bottom,r.top-e.top),Te=(t,e)=>{const i=t.getBoundingClientRect().top+t.clientTop;t.scrollTop=$e(t.scrollTop,{top:i,bottom:i+t.clientHeight},e.getBoundingClientRect())},Se=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()}),g({kind:v("clear")})]),T={ANSWER_QUESTION:be("ANSWER_QUESTION","question",Se)},G=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Re=g({id:h(p(),b(1)),label:h(p(),b(1))}),B=g({id:h(p(),b(1)),ref:u(h(p(),b(1))),title:h(p(),b(1)),description:u(p()),note:u(p()),options:u($(Re),[]),freeText:u(fe(),!0)}),Ce=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()})]),Ae=g({...B.entries,answer:u(Ce)}),qe=g({label:u(h(p(),b(1))),questions:$(Ae)}),_=g({title:u(p(),""),questions:$(B),history:u($(qe),[])}),M=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},U=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Ee=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...U(t),answer:e}},H=t=>{const e=ke(_,t);return{title:e.title,questions:M(e.questions).map(U),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:M(r.questions).map(Ee)}))}},W=()=>({title:"",questions:[],answers:{},pastRounds:[]}),f=(t,e)=>t.questions.find(r=>r.id===e),Qe=(t,e)=>f(t,e)?.ref??e,q=(t,e)=>{const r=f(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},x=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",S=(t,e)=>x(t,e)!=="",D=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},j=t=>({total:t.questions.length,answered:t.questions.filter(e=>S(e,t.answers[e.id])).length}),R=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},Y=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=f(t,e.target.id);if(!r)return null;const i=z(T.ANSWER_QUESTION,e);return i.kind==="clear"?R(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?R(t,r.id,{kind:"option",optionId:i.optionId}):null:R(t,r.id,{kind:"free",text:i.text})},m=ve({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),V=t=>t.title===""?"Visually Grill":t.title,K=(t,e,r)=>{switch(r.type){case"question":return q(e,r.id);case"page":return t.wholePage;default:return r.id}},Ie=(t,e,r)=>{const i=z(T.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=f(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},J=(t,e,r,i)=>{let n;try{n=Ie(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:K(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},X=t=>`${t.type} ${xe(t.target)} ${JSON.stringify(t.payload)}`,Z=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:q(e,r.id),group:t.questionGroup})),ee=(t,e)=>{const r=e.question;if(r!==void 0&&f(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},te=(t,e)=>{const r=e.question;return r!==void 0&&f(t,r)?r:t.questions[0]?.id??null},Le=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!S(a,t.answers[a.id]))?.id??null},re=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:D(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),ze=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:x(t,i)!=="",summary:x(t,i),choices:re(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},ie=(t,e)=>{const r=te(t,e);return{questions:t.questions.map(i=>ze(i,t,r))}},ne=(t,e)=>{const r=j(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},ae=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=ae(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Oe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=x(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:re(n,a),freeText:a?.kind==="free"?a.text:null}})}},oe=(t,e)=>{switch(e.type){case"question":return f(t,e.id)!==void 0;case"page":return!0;default:return!1}},se=t=>{const e=m(t);return{name:"grill",label:"Visually Grill",parseBase:H,emptyBase:W,actions:T,apply:Y,hasTarget:oe,describe:(r,i,n)=>J(e,r,i,n),serialize:X,resolveNavigation:ee,commentTargets:r=>Z(e,r),title:V}},w="data-grill-questions",Pe=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},le=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of Pe(t))for(const l of o.querySelectorAll(`[${w}]`)){const k=l.getAttribute(w)??"";for(const C of k.split(/\s+/)){if(C==="")continue;const c=n.get(C);c&&a.push({index:a.length,target:l,questionId:c.id,ref:c.ref,title:c.title,answered:S(c,e.answers[c.id]),open:c.id===i})}}return a},de=(t,e)=>{const r=t.getBoundingClientRect(),i=new Map;e.forEach((a,o)=>{const l=t.querySelector(`[data-label="${o}"]`);if(!l)return;const k=i.get(a.target)??[];k.push(l),i.set(a.target,k)});const n=new Map;for(const[a,o]of i){const l=a.getBoundingClientRect(),k=l.width>0||l.height>0,c=n.get(a)??Ne(a,t);n.set(a,c);const E=l.bottom>r.top&&l.top<r.bottom&&l.right>r.left&&l.left<r.right,Q=l.bottom>c.top&&l.top<c.bottom;o.forEach((y,ge)=>{if(y.dataset.visible=String(k&&E&&Q),!k||!E||!Q)return;const A=y.offsetWidth,I=y.offsetHeight,ue=l.right-r.left-A+8-(o.length-1-ge)*(A+5),he=l.top-r.top-I/2;y.style.transform=`translate(${N(ue,0,Math.max(0,t.clientWidth-A))}px, ${N(he,0,Math.max(0,t.clientHeight-I))}px)`})}},Ne=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},Ge=(t,e,r)=>s`
1
+ import{p as be,ak as L,ac as g,ah as h,ai as b,af as p,am as v,ad as u,an as fe,ae as $,ab as ke,R as z,a0 as ve,V as xe,a4 as s,a5 as F,a3 as d,ax as O,a2 as me,T as P,aG as we,aH as ye}from"./shared-7qenhU4J.js";import{c as N}from"./shared-ml5h7U5L.js";const $e=(t,e,r)=>r.top<e.top?t+r.top-e.top:r.bottom<=e.bottom?t:t+Math.min(r.bottom-e.bottom,r.top-e.top),Te=(t,e)=>{const i=t.getBoundingClientRect().top+t.clientTop;t.scrollTop=$e(t.scrollTop,{top:i,bottom:i+t.clientHeight},e.getBoundingClientRect())},Se=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()}),g({kind:v("clear")})]),T={ANSWER_QUESTION:be("ANSWER_QUESTION","question",Se)},G=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Re=g({id:h(p(),b(1)),label:h(p(),b(1))}),B=g({id:h(p(),b(1)),ref:u(h(p(),b(1))),title:h(p(),b(1)),description:u(p()),note:u(p()),options:u($(Re),[]),freeText:u(fe(),!0)}),Ce=L("kind",[g({kind:v("option"),optionId:h(p(),b(1))}),g({kind:v("free"),text:p()})]),Ae=g({...B.entries,answer:u(Ce)}),qe=g({label:u(h(p(),b(1))),questions:$(Ae)}),_=g({title:u(p(),""),questions:$(B),history:u($(qe),[])}),H=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},M=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Ee=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...M(t),answer:e}},U=t=>{const e=ke(_,t);return{title:e.title,questions:H(e.questions).map(M),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:H(r.questions).map(Ee)}))}},W=()=>({title:"",questions:[],answers:{},pastRounds:[]}),f=(t,e)=>t.questions.find(r=>r.id===e),Qe=(t,e)=>f(t,e)?.ref??e,q=(t,e)=>{const r=f(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},x=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",S=(t,e)=>x(t,e)!=="",j=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},D=t=>({total:t.questions.length,answered:t.questions.filter(e=>S(e,t.answers[e.id])).length}),R=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},Y=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=f(t,e.target.id);if(!r)return null;const i=z(T.ANSWER_QUESTION,e);return i.kind==="clear"?R(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?R(t,r.id,{kind:"option",optionId:i.optionId}):null:R(t,r.id,{kind:"free",text:i.text})},m=ve({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),V=t=>t.title===""?"Visually Grill":t.title,K=(t,e,r)=>{switch(r.type){case"question":return q(e,r.id);case"page":return t.wholePage;default:return r.id}},Ie=(t,e,r)=>{const i=z(T.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=f(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},J=(t,e,r,i)=>{let n;try{n=Ie(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:K(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},X=t=>`${t.type} ${xe(t.target)} ${JSON.stringify(t.payload)}`,Z=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:q(e,r.id),group:t.questionGroup})),ee=(t,e)=>{const r=e.question;if(r!==void 0&&f(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},te=(t,e)=>{const r=e.question;return r!==void 0&&f(t,r)?r:t.questions[0]?.id??null},Le=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!S(a,t.answers[a.id]))?.id??null},re=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:j(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),ze=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:x(t,i)!=="",summary:x(t,i),choices:re(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},ie=(t,e)=>{const r=te(t,e);return{questions:t.questions.map(i=>ze(i,t,r))}},ne=(t,e)=>{const r=D(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},ae=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=ae(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Oe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=x(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:re(n,a),freeText:a?.kind==="free"?a.text:null}})}},oe=(t,e)=>{switch(e.type){case"question":return f(t,e.id)!==void 0;case"page":return!0;default:return!1}},se=t=>{const e=m(t);return{name:"grill",label:"Visually Grill",parseBase:U,emptyBase:W,actions:T,apply:Y,hasTarget:oe,describe:(r,i,n)=>J(e,r,i,n),serialize:X,resolveNavigation:ee,commentTargets:r=>Z(e,r),title:V}},w="data-grill-questions",Pe=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},le=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of Pe(t))for(const l of o.querySelectorAll(`[${w}]`)){const k=l.getAttribute(w)??"";for(const C of k.split(/\s+/)){if(C==="")continue;const c=n.get(C);c&&a.push({index:a.length,target:l,questionId:c.id,ref:c.ref,title:c.title,answered:S(c,e.answers[c.id]),open:c.id===i})}}return a},de=(t,e)=>{const r=t.getBoundingClientRect(),i=new Map;e.forEach((a,o)=>{const l=t.querySelector(`[data-label="${o}"]`);if(!l)return;const k=i.get(a.target)??[];k.push(l),i.set(a.target,k)});const n=new Map;for(const[a,o]of i){const l=a.getBoundingClientRect(),k=l.width>0||l.height>0,c=n.get(a)??Ne(a,t);n.set(a,c);const E=l.bottom>r.top&&l.top<r.bottom&&l.right>r.left&&l.left<r.right,Q=l.bottom>c.top&&l.top<c.bottom;o.forEach((y,ge)=>{if(y.dataset.visible=String(k&&E&&Q),!k||!E||!Q)return;const A=y.offsetWidth,I=y.offsetHeight,ue=l.right-r.left-A+8-(o.length-1-ge)*(A+5),he=l.top-r.top-I/2;y.style.transform=`translate(${N(ue,0,Math.max(0,t.clientWidth-A))}px, ${N(he,0,Math.max(0,t.clientHeight-I))}px)`})}},Ne=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},Ge=(t,e,r)=>s`
2
2
  <div class="grill-list">
3
3
  ${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:F(e.questions,i=>i.id,i=>Be(t,i,r))}
4
4
  </div>
@@ -67,12 +67,12 @@ import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,
67
67
  <span>${e.label}</span>
68
68
  </span>
69
69
  </label>
70
- `,Me=(t,e)=>s`
70
+ `,He=(t,e)=>s`
71
71
  <div class="grill-list">
72
72
  <p class="grill-round-note">${t.pastRound(e.label)}</p>
73
- ${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:F(e.questions,r=>r.id,r=>Ue(r))}
73
+ ${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:F(e.questions,r=>r.id,r=>Me(r))}
74
74
  </div>
75
- `,Ue=t=>s`
75
+ `,Me=t=>s`
76
76
  <details
77
77
  class="grill-question grill-question--past"
78
78
  data-question=${t.id}
@@ -98,7 +98,7 @@ import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,
98
98
  ${t.freeText===null?d:s`<p class="grill-past-choice grill-past-free" data-checked="true">${t.freeText}</p>`}
99
99
  </div>
100
100
  </details>
101
- `,He=me`
101
+ `,Ue=me`
102
102
  /*
103
103
  * The rail and its hand-off only work inside a bounded shell. A page that gives
104
104
  * the host no height (no \`height: 100%\` up the chain) would grow the shell to
@@ -865,7 +865,7 @@ import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,
865
865
  outline: none;
866
866
  box-shadow: var(--dpk-focus);
867
867
  }
868
- `;class pe extends P{static{this.styles=[P.styles,He]}get sidebarLayout(){return{side:"right",defaultWidth:336}}definitionFor(e){return se(e)}static{this.properties={tab:{state:!0},folded:{state:!0},round:{state:!0}}}#o=[];#s=!1;#a=null;#l=null;#r=null;#e="idle";#i=null;#n={kind:"idle"};constructor(){super(),this.tab="questions",this.folded=!1,this.round="current"}connectedCallback(){super.connectedCallback(),document.addEventListener("scroll",this.#t,!0),window.addEventListener("resize",this.#t),this.addEventListener("dpk-diagram-view",this.#t)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scroll",this.#t,!0),window.removeEventListener("resize",this.#t),this.removeEventListener("dpk-diagram-view",this.#t),this.#r?.disconnect(),this.#r=null,this.#d()}renderRegions(e){return this.#o=le(this,e.state,e.navigation),{header:this.#b(e),main:this.#m(e,this.#o),sidebar:this.#f(e),sidebarHidden:this.folded}}updated(){super.updated(),this.#T(),this.#t(),this.#S();const e=this.#l;e!==null&&(this.#l=null,this.renderRoot.querySelector(`[data-free-text="${e}"]`)?.focus())}get integratedReview(){return!0}requestComment(e){this.tab="review",this.folded=!1,super.requestComment(e)}#p(e,r){this.tab="questions",this.folded=!1,this.round="current",this.#a=null,e.navigate({question:r})}#b(e){const r=m(this.locale),i=ne(r,e.state),n=r.toggleLabel(this.folded?r.openPanel:r.closePanel,i.progress);return s`
868
+ `;class pe extends P{static{this.styles=[P.styles,Ue]}get sidebarLayout(){return{side:"right",defaultWidth:336,collapsible:!1}}definitionFor(e){return se(e)}static{this.properties={tab:{state:!0},folded:{state:!0},round:{state:!0}}}#o=[];#s=!1;#a=null;#l=null;#r=null;#e="idle";#i=null;#n={kind:"idle"};constructor(){super(),this.tab="questions",this.folded=!1,this.round="current"}connectedCallback(){super.connectedCallback(),document.addEventListener("scroll",this.#t,!0),window.addEventListener("resize",this.#t),this.addEventListener("dpk-diagram-view",this.#t)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scroll",this.#t,!0),window.removeEventListener("resize",this.#t),this.removeEventListener("dpk-diagram-view",this.#t),this.#r?.disconnect(),this.#r=null,this.#d()}renderRegions(e){return this.#o=le(this,e.state,e.navigation),{header:this.#b(e),main:this.#m(e,this.#o),sidebar:this.#f(e),sidebarHidden:this.folded}}updated(){super.updated(),this.#T(),this.#t(),this.#S();const e=this.#l;e!==null&&(this.#l=null,this.renderRoot.querySelector(`[data-free-text="${e}"]`)?.focus())}get integratedReview(){return!0}requestComment(e){this.tab="review",this.folded=!1,super.requestComment(e)}#p(e,r){this.tab="questions",this.folded=!1,this.round="current",this.#a=null,e.navigate({question:r})}#b(e){const r=m(this.locale),i=ne(r,e.state),n=r.toggleLabel(this.folded?r.openPanel:r.closePanel,i.progress);return s`
869
869
  <button
870
870
  type="button"
871
871
  class="grill-toggle"
@@ -905,7 +905,7 @@ import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,
905
905
  aria-labelledby="grill-tab-questions"
906
906
  ?hidden=${this.tab!=="questions"}
907
907
  >
908
- ${a===null?Ge(r,ie(e.state,e.navigation),{open:o=>this.#p(e,o),answer:(o,l)=>this.#w(o,l),next:o=>this.#g(o)}):Me(r,a)}
908
+ ${a===null?Ge(r,ie(e.state,e.navigation),{open:o=>this.#p(e,o),answer:(o,l)=>this.#w(o,l),next:o=>this.#g(o)}):He(r,a)}
909
909
  </div>
910
910
  <div
911
911
  class="grill-tab-panel"
@@ -1007,4 +1007,4 @@ import{q as be,ai as L,aa as g,af as h,ag as b,ad as p,ak as v,ab as u,al as fe,
1007
1007
  `)}
1008
1008
  </div>
1009
1009
  </div>
1010
- `}#w(e,r){if(this.dispatch(G(e,r)).ok){if(r.kind==="option"){this.#g(e);return}r.kind==="free"&&r.text===""&&(this.#l=e)}}#g(e){const r=Le(this.derivation.state,e);r!==null&&this.navigate({question:r})}async#u(){const e=this.api.exportBrief(),r=await ye(e);this.#d(),this.#e=r?"copied":"failed",this.#h()}async#y(){this.#d(),this.#n={kind:"pending"},this.requestUpdate();const e=await this.sendToClaude();this.#n=e.ok?{kind:"sent"}:{kind:"failed",reason:e.reason},e.ok?this.#h():this.requestUpdate()}#h(){this.requestUpdate(),this.#i=setTimeout(()=>{this.#i=null,this.#e="idle",this.#n={kind:"idle"},this.requestUpdate()},2400)}#d(){this.#i!==null&&clearTimeout(this.#i),this.#i=null,this.#e="idle",this.#n={kind:"idle"}}#$(){this.requestUpdate()}#T(){this.#r?.disconnect(),this.#r??=new MutationObserver(()=>{this.#$(),this.#t()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[w]});for(const e of this.querySelectorAll("*"))e===this||!e.shadowRoot||this.#r.observe(e.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[w]})}#t=()=>{this.#s||(this.#s=!0,requestAnimationFrame(()=>{this.#s=!1;const e=this.renderRoot.querySelector(".grill-labels");e&&de(e,this.#o)}))};#S(){const e=this.navigation.question??null;if(this.tab!=="questions"||this.round!=="current"||this.folded||e===null||e===this.#a)return;this.#a=e;const r=this.renderRoot.querySelector(`[data-question="${e}"]`),i=r?.closest(".grill-list");r&&i&&Te(i,r)}}const ce=()=>{customElements.get("dpk-template-grill")||customElements.define("dpk-template-grill",pe)},We=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateGrill:pe,GRILL_QUESTIONS_ATTRIBUTE:w,answerCounts:j,answerQuestion:G,answerText:x,applyGrillAction:Y,collectLabelBindings:le,defineGrillElement:ce,describeGrillAction:J,emptyGrillBase:W,findQuestion:f,grillActions:T,grillBaseSchema:_,grillCommentTargets:Z,grillDefinitionFor:se,grillHasTarget:oe,grillMessages:m,grillTargetLabel:K,grillTitle:V,isAnswered:S,openQuestionId:te,optionLetter:D,parseGrillBase:H,positionLabels:de,presentGrillHeader:ne,presentGrillPanel:ie,questionLabel:q,questionRef:Qe,resolveGrillNavigation:ee,serializeGrillAction:X,withAnswer:R},Symbol.toStringTag,{value:"Module"}));export{ce as d,We as i};
1010
+ `}#w(e,r){if(this.dispatch(G(e,r)).ok){if(r.kind==="option"){this.#g(e);return}r.kind==="free"&&r.text===""&&(this.#l=e)}}#g(e){const r=Le(this.derivation.state,e);r!==null&&this.navigate({question:r})}async#u(){const e=this.api.exportBrief(),r=await ye(e);this.#d(),this.#e=r?"copied":"failed",this.#h()}async#y(){this.#d(),this.#n={kind:"pending"},this.requestUpdate();const e=await this.sendToClaude();this.#n=e.ok?{kind:"sent"}:{kind:"failed",reason:e.reason},e.ok?this.#h():this.requestUpdate()}#h(){this.requestUpdate(),this.#i=setTimeout(()=>{this.#i=null,this.#e="idle",this.#n={kind:"idle"},this.requestUpdate()},2400)}#d(){this.#i!==null&&clearTimeout(this.#i),this.#i=null,this.#e="idle",this.#n={kind:"idle"}}#$(){this.requestUpdate()}#T(){this.#r?.disconnect(),this.#r??=new MutationObserver(()=>{this.#$(),this.#t()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[w]});for(const e of this.querySelectorAll("*"))e===this||!e.shadowRoot||this.#r.observe(e.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[w]})}#t=()=>{this.#s||(this.#s=!0,requestAnimationFrame(()=>{this.#s=!1;const e=this.renderRoot.querySelector(".grill-labels");e&&de(e,this.#o)}))};#S(){const e=this.navigation.question??null;if(this.tab!=="questions"||this.round!=="current"||this.folded||e===null||e===this.#a)return;this.#a=e;const r=this.renderRoot.querySelector(`[data-question="${e}"]`),i=r?.closest(".grill-list");r&&i&&Te(i,r)}}const ce=()=>{customElements.get("dpk-template-grill")||customElements.define("dpk-template-grill",pe)},We=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateGrill:pe,GRILL_QUESTIONS_ATTRIBUTE:w,answerCounts:D,answerQuestion:G,answerText:x,applyGrillAction:Y,collectLabelBindings:le,defineGrillElement:ce,describeGrillAction:J,emptyGrillBase:W,findQuestion:f,grillActions:T,grillBaseSchema:_,grillCommentTargets:Z,grillDefinitionFor:se,grillHasTarget:oe,grillMessages:m,grillTargetLabel:K,grillTitle:V,isAnswered:S,openQuestionId:te,optionLetter:j,parseGrillBase:U,positionLabels:de,presentGrillHeader:ne,presentGrillPanel:ie,questionLabel:q,questionRef:Qe,resolveGrillNavigation:ee,serializeGrillAction:X,withAnswer:R},Symbol.toStringTag,{value:"Module"}));export{ce as d,We as i};