whose-turn 1.0.0-alpha.4 → 1.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +32 -24
- package/dist/assets/_plugin-vue_export-helper-BxUUR8De.js +18 -0
- package/dist/assets/_plugin-vue_export-helper-aQHODzfZ.css +1 -0
- package/dist/assets/bem-HybmjowO.js +1 -0
- package/dist/assets/index-C4WWZEBZ.css +1 -0
- package/dist/assets/index-oEi3SjBF.js +3 -0
- package/dist/assets/report-D7II0AfP.css +1 -0
- package/dist/assets/report-GgVB1dt8.js +1 -0
- package/dist/assets/scheme-BtoCLyX6.js +1 -0
- package/dist/assets/sheet-CXZ1EA3c.js +1 -0
- package/dist/index.html +6 -6
- package/dist/report.html +5 -5
- package/dist/sheet.html +4 -4
- package/install.sh +18 -6
- package/launch.sh +11 -0
- package/lib/api.mjs +23 -4
- package/lib/config.mjs +47 -22
- package/lib/default-table.mjs +3 -3
- package/lib/feedback.mjs +0 -1
- package/lib/handoff.mjs +1 -1
- package/lib/palette.mjs +2 -3
- package/lib/rules.mjs +11 -9
- package/lib/secrets.mjs +10 -2
- package/lib/static.mjs +6 -2
- package/lib/table.mjs +18 -0
- package/lib/update.mjs +4 -5
- package/lib/workspace.mjs +23 -8
- package/package.json +2 -1
- package/dist/assets/_plugin-vue_export-helper-BKveAJb2.css +0 -1
- package/dist/assets/_plugin-vue_export-helper-DHr5RHTx.js +0 -18
- package/dist/assets/bem-COKTjsky.js +0 -1
- package/dist/assets/index-B23uRijc.css +0 -1
- package/dist/assets/index-D-P2XKhJ.js +0 -3
- package/dist/assets/report-BtGnm9ax.js +0 -1
- package/dist/assets/report-xVOo7qip.css +0 -1
- package/dist/assets/scheme-DJ3WNw60.js +0 -1
- package/dist/assets/sheet-CBYGM-FG.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{w as Q,t as nt,r as ot,s as xs,c as x,n as ye,a as gt,d as j,o as l,b as i,F as W,e as L,f as ee,u as p,g as q,h as a,i as v,j as S,k as B,_ as K,l as at,m as J,p as U,q as Y,v as $s,x as Ve,y as Ee,z as Je,A as Pt,B as Ze,C as oe,D as Ss,E as ze,G as fe,H as Ie,I as Cs,J as Rs}from"./_plugin-vue_export-helper-BxUUR8De.js";import{s as Ts,m as lt,u as Bt,a as Ut,r as Vt,p as As,b as Ms,i as yt,l as Ht,c as Es,M as te,d as Ae,e as Se,f as zs,g as He,h as ke,j as Is,k as we,n as Os,o as Ds,q as Ps,t as rt,v as Bs,w as Us,x as Vs,y as Hs,z as kt,A as Ws}from"./scheme-BtoCLyX6.js";import{g as We,r as Fs,a as qs,e as Ns,w as Wt,p as ie,b as re,T as Qe,S as Oe,c as le,h as js,s as it,i as Ft,m as be,d as Ls,f as qt,j as ct,k as Ys,l as ut,n as Ks,y as Xs,o as Nt,q as Gs,t as Js,u as jt,v as Zs}from"./bem-HybmjowO.js";const ve=Ts(Vt),wt=(e,t)=>{const s=te,o=new Float32Array(s*s);for(let r=0;r<o.length;r+=1)o[r]=e[r]===t?1e6:0;const n=(r,u,c)=>{o[u]+c<o[r]&&(o[r]=o[u]+c)};for(let r=0;r<s;r+=1)for(let u=0;u<s;u+=1){const c=r*s+u;u>0&&n(c,c-1,1),r>0&&n(c,c-s,1),u>0&&r>0&&n(c,c-s-1,Math.SQRT2),u<s-1&&r>0&&n(c,c-s+1,Math.SQRT2)}for(let r=s-1;r>=0;r-=1)for(let u=s-1;u>=0;u-=1){const c=r*s+u;u<s-1&&n(c,c+1,1),r<s-1&&n(c,c+s,1),u<s-1&&r<s-1&&n(c,c+s+1,Math.SQRT2),u>0&&r<s-1&&n(c,c+s-1,Math.SQRT2)}return o},Ye=e=>{const t=String(e||"").trim(),s=/^#([0-9a-f]{6})$/i.exec(t);if(s)return[0,2,4].map(n=>parseInt(s[1].slice(n,n+2),16));const o=t.match(/[\d.]+/g);return o&&o.length>=3?o.slice(0,3).map(Number):null},Qs=e=>{const t=getComputedStyle(e),s=Ye(t.getPropertyValue("--md-primary"))||[44,86,151],o=Ye(t.getPropertyValue("--md-on-primary-container"))||s;return{core:yt()?s:s.map((n,r)=>Ht(n,o[r],.35)),rim:Ye(t.getPropertyValue("--blob-3"))||[23,223,220],strength:yt()?.9:1}},en=(e,t,s)=>({size:e.range(.85,1.05)*Math.min(t,s),right:e.chance(.4),bottom:e.chance(.7),overflowX:e.range(-.02,.06),overflowY:e.range(-.02,.04)}),tn=e=>{const t={minX:te,maxX:0,minY:te,maxY:0};for(let o=0;o<e.length;o+=1)if(e[o]){const n=o%te,r=Math.floor(o/te);t.minX=Math.min(t.minX,n),t.maxX=Math.max(t.maxX,n),t.minY=Math.min(t.minY,r),t.maxY=Math.max(t.maxY,r)}const s=o=>(o-te/2)/Ae;return{minX:s(t.minX),maxX:s(t.maxX),minY:s(t.minY),maxY:s(t.maxY)}},sn=(e,t,s,o)=>{const n=t.maxX-t.minX,r=t.maxY-t.minY,u=Math.min(e.size,2*s*.95/n,2*o*.98/r),c=u/2,_=-e.overflowX*u,h=-e.overflowY*u;return{size:u,centerX:e.right?s-_-t.maxX*c:_-t.minX*c,centerY:e.bottom?o-h-t.maxY*c:h-t.minY*c}},nn=(e,t,s)=>"rgba("+e.core.map((n,r)=>Math.round(Ht(n,e.rim[r],t))).join(",")+","+s.toFixed(3)+")",on=(e,t,s)=>{const o=[],n=t.size/62,r=t.size/2/Ae,u=t.size*zs/4,c=n*.866;for(let _=0,h=t.centerY-u;h<t.centerY+u;_+=1,h+=c)for(let d=t.centerX-u+_%2*n/2;d<t.centerX+u;d+=n){const f=d+e.range(-.3,.3)*n,b=h+e.range(-.3,.3)*n,k=Math.floor((f-t.centerX)/r+te/2),I=Math.floor((b-t.centerY)/r+te/2);if(k<0||I<0||k>=te||I>=te)continue;const w=I*te+k,y=e.next(),g=e.range(.75,1.25),$=e.range(-.15,.15);if(s.inside[w]){const A=s.depth[w]/Ae,P=Se(A/.035),X=Se(A/.3);if(y>.5+.5*P)continue;o.push({x:f,y:b,radius:n*.5*(.45+.55*P)*(.95+.3*X)*g,alpha:.5+.25*P+.25*X,tint:Se(.65-.65*X+$)})}else{const A=s.gap[w]/Ae;if(y>.14*Math.exp(-A/.05)+.004)continue;o.push({x:f,y:b,radius:n*e.range(.1,.24),alpha:.35,tint:Se(.8+$)})}}return o},an=()=>document.getElementById("wt"),ln=()=>document.getElementById("backdrop"),Lt=()=>Math.floor(Math.random()*4294967296),Ce={},H={workspace:"",seed:Lt(),species:"",wantedSpecies:"",wantedPose:"",built:null},rn=(e,t)=>{const s=Es(H.seed),o=ve[Math.floor(s.next()*ve.length)];H.species=ve.includes(H.wantedSpecies)?H.wantedSpecies:o;const n=en(s,e,t),r={facing:n.right?-1:1,tilt:s.range(-.07,.07),stretchX:s.range(.92,1.08),stretchY:s.range(.92,1.08)};s.chance(.25)&&(r.facing=-r.facing);const u=As(Ms(Vt,H.species,s,{pose:H.wantedPose}).shapes,r),c={inside:u,depth:wt(u,1),gap:wt(u,0)},_=sn(n,tn(u),e,t);return{key:H.seed+":"+H.species+":"+e+"x"+t,dots:on(s,_,c)}},De=()=>{const e=ln();if(!e)return;const t=e.clientWidth,s=e.clientHeight,o=window.devicePixelRatio||1,n=Math.round(t*o),r=Math.round(s*o);(e.width!==n||e.height!==r)&&(e.width=n,e.height=r);const u=e.getContext("2d");if(!u||(u.setTransform(o,0,0,o,0,0),u.clearRect(0,0,t,s),!t||!s))return;const c=H.seed+":"+(H.wantedSpecies||"?")+":"+t+"x"+s;(!H.built||H.built.key.split(":")[0]!==String(H.seed)||!H.built.key.endsWith(t+"x"+s)||H.wantedSpecies&&H.species!==H.wantedSpecies)&&(H.built=rn(t,s));const _=an();if(!_)return c;const h=Qs(_);return H.built.dots.forEach(d=>{u.fillStyle=nn(h,d.tint,d.alpha*h.strength),u.beginPath(),u.arc(d.x,d.y,d.radius,0,Math.PI*2),u.fill()}),c};window.whoseTurnBackdrop={species:ve.slice(),seeded:lt,get current(){return{workspace:H.workspace,species:H.species,seed:H.seed}},show:e=>{const t=e||{},s=String(t.workspace||"");Ce[s]||(Ce[s]=Lt());const o=t.seed!==void 0?Number(t.seed)>>>0:Ce[s];Ce[s]=o;const n=t.species&&ve.includes(t.species)?t.species:"",r=String(t.pose||"");return s===H.workspace&&o===H.seed&&n===H.wantedSpecies&&r===H.wantedPose&&H.built||(H.workspace=s,H.seed=o,H.wantedSpecies=n,H.wantedPose=r,H.built=null,De()),window.whoseTurnBackdrop.current},repaint:De};Q(He,De);Bt(window,"resize",Ut(De,200));const{show:Yt,repaint:cn,seeded:Yi}=window.whoseTurnBackdrop,un=()=>{window.tippy&&window.tippy.delegate(document.body,{target:"[data-tip]",content:e=>e.dataset.tip||"",trigger:"mouseenter focus click",delay:[0,80],duration:[120,80],interactive:!0,maxWidth:440,placement:"top",theme:"wt",appendTo:()=>document.body})},dn=()=>{let e=0;return{next:()=>++e,accepts:t=>t===e}},bt=e=>{const t=structuredClone(nt(e)),s=t.connectors||{},o=t.rules||{};return o.statuses=o.statuses||{},{...t,connectors:Array.isArray(s)?s:Object.entries(s).map(([n,r])=>({type:n,...r})),rules:o,theme:t.theme||{}}},pn=e=>{const t=structuredClone(nt(e));return t.theme&&!Object.keys(t.theme).length&&delete t.theme,t.rules&&!Object.keys(t.rules.statuses||{}).length&&delete t.rules.statuses,t.rules&&!Object.keys(t.rules).length&&delete t.rules,t},xt=new WeakMap;let hn=0;const Re=e=>{const t=nt(e);let s=xt.get(t);return s||(s=++hn,xt.set(t,s)),s},$t=e=>JSON.stringify(e),_n=(e,t)=>{const s=[];return e.forEach(o=>o.connectors.forEach(n=>{const r=t.get(n)||{};Object.keys(r).forEach(u=>{r[u]&&s.push({ws:o.id,connector:n.id||n.type,key:u,value:r[u]})})})),s},ce=(e,t,s)=>{typeof s=="boolean"||s&&s.length?e[t]=s:delete e[t]},fn=(e,t)=>{const s=o=>{const n=t.indexOf(o.id);return n<0?t.length:n};return[...e].sort((o,n)=>s(o)-s(n))},vn=(e,t,s,o)=>{const n=e.filter(r=>r!==t);return n.splice(n.indexOf(s)+(o?0:1),0,t),n},mn={backlog:"in the backlog",passed:"passed",code_review:"in review",qa:"in testing",on_hold:"on hold",todo:"to do",in_progress:"in progress",done:"done"},Kt=e=>mn[e]||`in ${e.replace(/_/g," ")}`,gn={you:"your move",reviewer:"the reviewer's move",qa:"the tester's move",them:"waiting on others"},yn={"ticket.hold_reason":"the hold reason","ticket.status_name":"the status","ticket.key":"the ticket key","pr.number":"the PR number","pr.base":"the target branch","pr.commenter":"the commenter","run.workflow":"the workflow","run.branch":"the branch","comment.author":"the author"},de=e=>yn[e]||e.replace(/[._]/g," "),kn=(e,t,s)=>e?t:s,wn={approved:"the PR is approved",changes_requested:"changes are requested on the PR",none:"the PR has no review"},bn=(e,t)=>{switch(e){case"ticket.status":return`the ticket is ${Kt(String(t))}`;case"ticket.assignee":return t==="me"?"the ticket is on you":`the ticket is assigned to ${t}`;case"pr.checks":return t==="none"?"the PR has no checks":`the PR checks are ${t}`;case"pr.review":return wn[String(t)]||`the PR review is ${t}`;case"pr.base":return`the PR goes into ${t}`;default:return`${de(e)} is ${t}`}},St={"ticket.done":["the ticket is done","the ticket is not done"],"ticket.started":["the ticket is started","the ticket is not started"],"pr.open":["the PR is open","no PR is open"],"pr.merged":["the PR is merged","the PR is not merged"],"pr.unanswered":["a comment on the PR waits for your answer","no comment on the PR waits for your answer"],"comment.mentions_me":["you are mentioned and have not answered","no mention of you waits for an answer"],"comment.is_question":["the mention is a question","the mention is not a question"],"run.failed":["a workflow run failed","no workflow run failed"],"run.mine":["the run is yours","the run is not yours"]},xn=(e,t,s)=>{if(t==="present")return kn(s,`${de(e)} is given`,`${de(e)} is missing`);if(t==="prefix")return e==="pr.base"?`the PR goes into a branch starting with ${s}`:`${de(e)} starts with ${s}`;if(e==="unanswered_count"){const n=Number(s);return`${{gt:`more than ${n}`,gte:`at least ${n}`,lt:`fewer than ${n}`,lte:`at most ${n}`}[t]} mentions of you wait for an answer`}const o={gt:"more than",gte:"at least",lt:"less than",lte:"at most"};return`${de(e)} is ${o[t]} ${s}`},$n=(e,t)=>Array.isArray(t)?e==="ticket.status"?`the ticket is ${t.map(s=>Kt(String(s))).join(" or ")}`:`${de(e)} is ${t.join(" or ")}`:t&&typeof t=="object"?Object.entries(t).map(([s,o])=>xn(e,s,o)).join(" and "):typeof t=="boolean"&&St[e]?St[e][t?0:1]:bn(e,t),Sn=e=>e.replace(/\{([\w.]+)\}/g,(t,s)=>`{${de(s)}}`),Cn=e=>{const t=Object.entries(e.when).map(([o,n])=>$n(o,n)),s=e.then.whose==="hidden"?"not shown":`${gn[e.then.whose]||e.then.whose}, "${Sn(e.then.next||"")}"`;return{when:t.length?`When ${t.join(" and ")}:`:"In every other case:",then:s}},Rn=e=>e.modal?"modal":e.settings?"settings":e.feedback?"feedback":null,Tn=(e,t)=>{const s=new URLSearchParams(e).get("mode");return s==="app"||s==="tab"?s:t==="app"?"app":"tab"},An=e=>"/?mode=tab"+(e?"&ws="+encodeURIComponent(e):""),Mn=e=>({width:e.outerWidth,height:e.outerHeight}),Xt={writeDefaults:!1},Gt=ke("wt-ws","",Xt),Jt=Is("wt-mode","",Xt),m=xs({workspaces:[],workspace:{id:"",name:"",connectors:[],links:[],key_pattern:"",theme:null},turn:[],feed:[],marks:{seen:[],base:0,handled:{}},counts:{mine:0,others:0,failing:0,done:0},todos:[],errors:{},health:{ok:!0,stale:!1,fresh_at:"",failing:[],alerts:[]},problems:[],polled_at:"",update:{current:"",latest:"",available:!1,state:"idle"}}),z=ot({ws:new URLSearchParams(location.search).get("ws")||Gt.value,open:new Set,mode:Tn(location.search,Jt.value),live:!1,reconnects:0,status:"Connecting…",modal:null,feedback:!1,settings:!1,settingsDirty:!1,settingsAsk:!1,settingsAt:""});Jt.value=z.mode;const Pe=we("",6e3),pe=(e,t)=>{const s=re(e,t);return s&&(Pe.value=s),!s},En=()=>{z.mode==="app"&&Bt(window,"resize",Ut(()=>ie("/api/window",Mn(window)).catch(pe),600))},Zt={resume:()=>{}},he=Ds({scheduler:e=>{const t=Ps(e,3e4,{immediate:!1});return Zt.resume=t.resume,t}}),Ke=x(()=>{const e=m.workspace.theme;return e&&e.light&&e.dark?e[He.value?"dark":"light"]:{}}),ne=x(()=>m.counts),Ct=x(()=>{const e=m.workspace.name,t=e?e+": ":"",s=Object.entries(m.errors||{}),o=m.health.failing||[],n=c=>o.find(({source:_})=>c===_||c.startsWith(_+".")),r=o.map(({source:c,polls:_})=>{const h=s.filter(([d])=>{var f;return((f=n(d))==null?void 0:f.source)===c}).map(([,d])=>d);return`Source ${c}: ${h.join(", ")||"failing"}, failed ${_} polls in a row`}),u=new Set(o.map(({source:c})=>"failing:"+c));return[...m.problems||[],...m.health.alerts.filter(c=>!u.has(c.id||"")).map(c=>c.text),...r,...s.filter(([c])=>!n(c)).map(([c,_])=>t+c+": "+_)]}),Qt=(e="")=>{z.settingsAt=e,z.settings=!0},es=x(()=>Rn(z)),zn=()=>{const e=es.value;if(e==="modal"&&(z.modal=null),e==="feedback"&&(z.feedback=!1),e==="settings"){if(z.settingsDirty){z.settingsAsk=!0;return}z.settings=!1}},et=new Map,In=(e,t)=>{t&&et.set(e,document.activeElement)},On=(e,t)=>{if(t)return;const s=et.get(e);et.delete(e),s instanceof HTMLElement&&s.focus()},Dn={modal:()=>!!z.modal,settings:()=>z.settings,feedback:()=>z.feedback};Object.entries(Dn).forEach(([e,t])=>{Q(t,s=>In(e,s),{flush:"sync"}),Q(t,s=>On(e,s),{flush:"post"})});let Be=-1,tt=0;const Rt=dn(),xe=(e=z.ws)=>{const t=Rt.next();return We("/api/state"+(e?"?ws="+encodeURIComponent(e):"")).then(s=>Rt.accepts(t)?s.error?Fs(s.error)!=="NO_SUCH_WORKSPACE"||!qs(e)?(z.status=Ns(s.error,"Could not load"),m):xe(""):(Object.assign(m,s),z.ws=m.workspace.id,z.status="",Yt({workspace:m.workspace.id}),document.title="Whose Turn · "+m.workspace.name,m):m)},ts=()=>(Be=-1,xe()),ge=Os("/api/stream",[],{immediate:!1,autoConnect:!1,autoReconnect:!0,serializer:{read:e=>JSON.parse(e||"null")}});Q(ge.status,e=>{z.live=e==="OPEN",z.live&&(z.status="",z.reconnects++)},{flush:"sync"});Q(ge.error,e=>{e&&(z.status="Disconnected from the local server, retrying…")},{flush:"sync"});Q(ge.data,e=>{if(e){if("update"in e){m.update=e.update;return}typeof e.open_moves=="number"&&(m.workspaces=Wt(m.workspaces,e.ws,e.open_moves)),!(m.workspace.id&&e.ws!==m.workspace.id)&&(z.status="",e.version!==Be?(Be=e.version,tt===0&&xe()):m.polled_at=e.polled_at)}},{flush:"sync"});const Pn=()=>{ge.eventSource.value||ge.open()},Bn=()=>(Zt.resume(),xe().then(Pn)),Un=e=>e===m.workspace.id?Promise.resolve():(Be=-1,tt++,xe(e).then(()=>{z.ws===e&&(Gt.value=z.ws,z.open.clear())},()=>{Pe.value=Oe+"; staying on "+m.workspace.name+"."}).finally(()=>{tt--})),ss=(e,t)=>ie(e,{ws:m.workspace.id,...t}),me=e=>ss("/api/marks",e).then(t=>{const s=re(t);return s||(Object.assign(m,{marks:t.marks,turn:t.turn,counts:t.counts}),m.workspaces=Wt(m.workspaces,m.workspace.id,t.counts.mine)),s},t=>re(t)),Vn=e=>ss("/api/todos",e).then(t=>{const s=re(t,{unreachable:Qe});return!s&&Array.isArray(t)&&(m.todos=t),s},t=>re(t,{unreachable:Qe})),Tt=e=>We("/api/config").then(t=>ie("/api/config",{workspaces:fn(t.workspaces,e),secrets:[]})).then(t=>{pe(t,{refused:"The order was not saved"})&&ts()},t=>pe(t,{refused:"The order was not saved"})),At=()=>{z.status="Checking now…",ie("/api/refresh").catch(e=>{z.status="",pe(e)}),Yt({workspace:m.workspace.id,seed:Math.floor(Math.random()*4294967296)})},Hn="M12 2.5l1.9 5.6 5.6 1.9-5.6 1.9L12 17.5l-1.9-5.6L4.5 10l5.6-1.9L12 2.5zM5 15l.9 2.6 2.6.9-2.6.9L5 22l-.9-2.6-2.6-.9 2.6-.9L5 15zm14-2l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7.7-2z",Wn="M16 1H6a2 2 0 0 0-2 2v12h2V3h10V1zm3 4H10a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16h-9V7h9v14z",Fn="M19.4 13a7.6 7.6 0 0 0 0-2l2-1.5-2-3.4-2.4 1a7.5 7.5 0 0 0-1.7-1L15 3.5H9l-.3 2.6a7.5 7.5 0 0 0-1.7 1l-2.4-1-2 3.4 2 1.5a7.6 7.6 0 0 0 0 2l-2 1.5 2 3.4 2.4-1a7.5 7.5 0 0 0 1.7 1l.3 2.6h6l.3-2.6a7.5 7.5 0 0 0 1.7-1l2.4 1 2-3.4-2-1.5zM12 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7z",qn="M19 8h-1.8a5.9 5.9 0 0 0-1.3-1.9l1.6-1.6-1.4-1.4-1.9 1.9A5.7 5.7 0 0 0 12 4.5a5.7 5.7 0 0 0-2.2.5L7.9 3.1 6.5 4.5l1.6 1.6A5.9 5.9 0 0 0 6.8 8H5v2h1.2a7 7 0 0 0 0 1v1H5v2h1.3a6 6 0 0 0 11.4 0H19v-2h-1.2v-1a7 7 0 0 0 0-1H19V8zm-7 10a4 4 0 0 1-4-4v-3a4 4 0 0 1 8 0v3a4 4 0 0 1-4 4zm-1-7h2v5h-2z",Nn=e=>{let t=2166136261;for(let s=0;s<e.length;s+=1)t^=e.charCodeAt(s),t=Math.imul(t,16777619);return t>>>0},ns=e=>{const t=String(e||"").trim().split(/[\s_-]+/).filter(Boolean);return(t.length>=2?t.slice(0,3).map(o=>o.charAt(0)):(t[0]||"?").slice(0,2).split("")).join("").toUpperCase()},jn=e=>({1:17,2:14,3:11})[e.length]||11,os=(e,t)=>{const s=t(Nn(e.id)),o=[],n=3+Math.floor(s()*3);for(let u=0;u<n;u+=1){const c=s()*Math.PI*2,_=9+s()*7;o.push({cx:(18+Math.cos(c)*_).toFixed(1),cy:(18+Math.sin(c)*_).toFixed(1),r:(1.6+s()*2.2).toFixed(1),opacity:(.35+s()*.4).toFixed(2)})}const r=ns(e.name||e.id);return{dots:o,glyph:r,fontSize:jn(r)}},Ln=(e,t)=>{const s=e.dots.map(r=>`<circle cx="${r.cx}" cy="${r.cy}" r="${r.r}" fill="${t.dot}" opacity="${r.opacity}"/>`).join(""),o=e.fontSize>=17?24:23,n=e.glyph.replace(/[&<>]/g,"");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><rect width="36" height="36" rx="10" fill="${t.fill}"/>${s}<text x="18" y="${o}" text-anchor="middle" font-size="${e.fontSize}" font-weight="700" letter-spacing="-0.5" font-family="Roboto, Inter, system-ui, sans-serif" fill="${t.ink}">${n}</text></svg>`},Mt='a[href], button:not([disabled]), input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])',Yn="input, textarea, select, [contenteditable]",Kn=(e,t,s)=>{if(!e.length)return null;const o=s?e[0]:e[e.length-1];return t===o||!e.some(n=>n===t)?s?e[e.length-1]:e[0]:null},Xn=e=>{let t=null;Q(e,s=>{s?(t=document.activeElement,ye(()=>{var r;const o=document.querySelectorAll(".modal"),n=o[o.length-1];n&&!n.contains(document.activeElement)&&((r=n.querySelector(Mt))==null||r.focus())})):(t==null||t.focus(),t=null)}),rt("Tab",s=>{if(!e.value)return;const o=document.querySelectorAll(".modal"),n=o[o.length-1],r=n?[...n.querySelectorAll(Mt)]:[],u=Kn(r,document.activeElement,s.shiftKey);u&&(s.preventDefault(),u.focus())},{target:document})},Et={"/":".feed__search-input",t:".todos__input"},Gn=e=>rt(Object.keys(Et),t=>{const s=t.target;if(e.value||t.metaKey||t.ctrlKey||t.altKey||s!=null&&s.closest(Yn))return;const o=document.querySelector(Et[t.key]);o&&(t.preventDefault(),o.focus())},{target:document}),Jn=30,zt=(e,t,s)=>Math.round(Math.max(t,Math.min(s,e))),Zn=(e,t)=>Math.ceil(e+(t>1?Jn:0)),Qn=(e,t,s)=>e-t*s.length-s.reduce((o,n)=>o+(n.collapsed?n.height:n.floor),0),dt=e=>{const t=ke("wt-panel-sizes",{},{writeDefaults:!1});return{size:x(()=>t.value[gt(e)]??null),set:n=>{const r=gt(e);if(!r)return;const{[r]:u,...c}=t.value;t.value=n===null?c:{...c,[r]:n}}}},eo={class:"rail","aria-label":"Workspaces"},to=["data-drop","href","aria-label","aria-selected","onClick","onKeydown","onDragstart","onDragover","onDrop"],so={viewBox:"0 0 36 36",class:"rail__icon","aria-hidden":"true"},no=["fill"],oo=["cx","cy","r","fill","opacity"],ao=["y","font-size","fill"],lo={class:"rail__label"},ro={key:0,class:"rail__warn",title:"A source of this workspace fails"},io={key:1,class:"rail__badge"},co={viewBox:"0 0 24 24",class:"rail__gear","aria-hidden":"true"},uo=["d"],po=j({__name:"Rail",emits:["settings"],setup(e,{emit:t}){const s=t,o=x(()=>Object.fromEntries(m.workspaces.map(g=>[g.id,os(g,lt)]))),n=x(()=>Object.fromEntries(m.workspaces.map(g=>{const $=g.theme?g.theme[He.value?"dark":"light"]:null;return[g.id,{fill:$?$["--md-primary-container"]:"var(--md-primary-container)",ink:$?$["--md-on-primary-container"]:"var(--md-on-primary-container)",dot:$?$["--md-primary"]:"var(--md-primary)"}]}))),r=g=>g.id===m.workspace.id?Object.keys(m.errors||{}).length>0:!!g.failing_sources,u=g=>{g.detail>0&&g.currentTarget.blur()},c=(g,$)=>{u(g),Un($)},_=g=>{s("settings"),u(g)},h=async(g,$)=>{const A=g.key==="ArrowUp"?-1:g.key==="ArrowDown"?1:0,P=m.workspaces.map(O=>O.id),X=P.indexOf($.id);if(!g.altKey||!A||X+A<0||X+A>=P.length)return;g.preventDefault();const D=g.currentTarget;P.splice(X+A,0,...P.splice(X,1)),await Tt(P),await ye(),D.focus()},d=B(""),f=B({}),b=g=>{const $=g.currentTarget;return g.clientY-$.getBoundingClientRect().top<$.offsetHeight/2},k=(g,$)=>{d.value=$.id,g.dataTransfer&&(g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",$.id))},I=()=>{d.value="",f.value={}},w=(g,$)=>{if(!d.value||d.value===$.id)return;g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="move");const A=b(g)?"before":"after";(f.value.id!==$.id||f.value.side!==A)&&(f.value={id:$.id,side:A})},y=(g,$)=>{if(!d.value||d.value===$.id)return;g.preventDefault();const A=vn(m.workspaces.map(P=>P.id),d.value,$.id,b(g));f.value={},Tt(A)};return(g,$)=>(l(),i("nav",eo,[(l(!0),i(W,null,L(p(m).workspaces,A=>(l(),i("a",{key:A.id,class:q(["rail__item",{"rail__item--dragging":d.value===A.id}]),"data-drop":f.value.id===A.id?f.value.side:null,href:"?ws="+encodeURIComponent(A.id),"aria-label":A.name,"aria-selected":A.id===p(m).workspace.id,draggable:"true",onClick:ee(P=>c(P,A.id),["prevent"]),onKeydown:P=>h(P,A),onDragstart:P=>k(P,A),onDragend:I,onDragover:P=>w(P,A),onDragleave:$[0]||($[0]=P=>f.value={}),onDrop:P=>y(P,A)},[(l(),i("svg",so,[a("rect",{x:"0",y:"0",width:"36",height:"36",rx:"10",fill:n.value[A.id].fill},null,8,no),(l(!0),i(W,null,L(o.value[A.id].dots,(P,X)=>(l(),i("circle",{key:X,cx:P.cx,cy:P.cy,r:P.r,fill:n.value[A.id].dot,opacity:P.opacity},null,8,oo))),128)),a("text",{x:"18",y:o.value[A.id].fontSize>=17?24:23,"text-anchor":"middle","font-size":o.value[A.id].fontSize,"font-weight":"700","letter-spacing":"-0.5","font-family":"Roboto, Inter, system-ui, sans-serif",fill:n.value[A.id].ink},v(o.value[A.id].glyph),9,ao)])),a("span",lo,v(A.name),1),r(A)?(l(),i("span",ro,"!")):S("",!0),A.open_moves?(l(),i("span",io,v(A.open_moves),1)):S("",!0)],42,to))),128)),$[2]||($[2]=a("span",{class:"rail__spacer"},null,-1)),a("a",{class:"rail__item",href:"#settings","aria-label":"Settings",onClick:ee(_,["prevent"])},[(l(),i("svg",co,[a("path",{d:p(Fn),fill:"currentColor"},null,8,uo)])),$[1]||($[1]=a("span",{class:"rail__label"},"Settings",-1))])]))}}),ho=K(po,[["__scopeId","data-v-58c52f35"]]),Xe=" · checks every minute",as=(e,t,s,o)=>{const n=e.failing.map(u=>u.source),r=t?le(t):"—";return n.length&&n.length>=s?{dot:"off",text:"No data: "+n.join(", ")+" failing · last data "+le(e.fresh_at),failing:n,noData:!0}:e.stale?{dot:"off",text:"Stale · last data "+le(e.fresh_at)+Xe,failing:n,noData:!1}:n.length?{dot:o?"warn":"off",text:n.join(", ")+" failing · last check "+r+Xe,failing:n,noData:!1}:{dot:o?"ok":"off",text:"Live · last check "+r+Xe,failing:n,noData:!1}},_o=["data-tip"],fo={class:"ai-button__icon",viewBox:"0 0 24 24","aria-hidden":"true"},vo=["d"],mo={class:"ai-button__badge",viewBox:"0 0 24 24","aria-hidden":"true"},go=["d"],yo=j({__name:"AiButton",props:{query:{},big:{type:Boolean}},setup(e){const t=e,s={"":"Copy for AI: this with its context as text, ready to paste into Claude or any other assistant",sent:"Copied",failed:"Could not copy"},o=we("",1600),n=x(()=>s[o.value]),r=B(null);Q(n,c=>{var _,h;return(h=(_=r.value)==null?void 0:_._tippy)==null?void 0:h.setContent(c)});const u=()=>js(t.query).then(c=>navigator.clipboard.writeText(c)).then(()=>{o.value="sent"},()=>{o.value="failed"});return(c,_)=>(l(),i("button",{ref_key:"button",ref:r,type:"button",class:q(["ai-button",{"ai-button--big":e.big,"ai-button--sent":p(o)==="sent","ai-button--failed":p(o)==="failed"}]),"aria-label":"Copy for AI","data-tip":n.value,onClick:ee(u,["stop"])},[(l(),i("svg",fo,[a("path",{d:p(Wn),fill:"currentColor"},null,8,vo)])),(l(),i("svg",mo,[a("path",{d:p(Hn),fill:"currentColor"},null,8,go)]))],10,_o))}}),_e=K(yo,[["__scopeId","data-v-46197bdc"]]),st="wt-updated-to",ko=()=>window.location.reload(),wo=e=>{try{sessionStorage.setItem(st,e)}catch{}},bo=()=>{try{const e=sessionStorage.getItem(st)||"";return sessionStorage.removeItem(st),e}catch{return""}},xo={key:0,class:"update-chip update-chip--done",role:"status"},$o={key:2,class:"update-chip update-chip--busy",role:"status"},So=["title"],Co=15e3,Ro=9e4,To=j({__name:"UpdateChip",setup(e){const t=B(!1),s=B(""),o=B(""),n=B(""),r=B(!1),u=we("",Co),c=x(()=>m.update),_=x(()=>t.value||c.value.state==="installing"),h=x(()=>c.value.state==="restarting"||!!s.value&&!z.live),d=x(()=>!n.value&&(_.value||h.value||!!s.value)),{start:f,stop:b}=Bs(()=>r.value=!0,Ro,{immediate:!1});at(()=>{u.value=bo()}),Q(()=>c.value.current,w=>{if(w){if(!o.value){o.value=w;return}w!==o.value&&(n.value=w,s.value="",b())}},{immediate:!0});const k=()=>{if(d.value)return;t.value=!0,r.value=!1,s.value=c.value.latest,f();const w=y=>{if(t.value=!1,!pe(y,{refused:"The update did not start"})){s.value="",b();return}m.update=y.update};ie("/api/update").then(w,w)},I=()=>{n.value&&wo(n.value),ko()};return(w,y)=>p(u)?(l(),i("span",xo,"Updated to "+v(p(u)),1)):n.value?(l(),i("button",{key:1,type:"button",class:"update-chip update-chip--ready",title:"Reload the window to apply the changes",onClick:I}," Updated to "+v(n.value)+" · Reload ",1)):d.value?(l(),i("span",$o,[y[0]||(y[0]=a("span",{class:"update-chip__spinner","aria-hidden":"true"},null,-1)),J(v(h.value?"Restarting…":`Installing ${s.value||c.value.latest}…`),1),r.value?(l(),i("button",{key:0,type:"button",class:"update-chip__link",title:"The restart is taking longer than usual",onClick:I}," Reload ")):S("",!0)])):c.value.available&&c.value.state==="failed"?(l(),i("button",{key:3,type:"button",class:"update-chip update-chip--failed",title:c.value.reason,onClick:k}," Update failed · Retry ",8,So)):c.value.available?(l(),i("button",{key:4,type:"button",class:"update-chip",onClick:k},v(c.value.latest)+" is out · Update ",1)):S("",!0)}}),Ao=K(To,[["__scopeId","data-v-c36ae07d"]]),Mo={class:"status-bar"},Eo={class:"status-bar__icon",viewBox:"0 0 24 24","aria-hidden":"true"},zo=["d"],Io={key:0,class:"status-bar__notice",role:"alert"},Oo=["href"],Do=["aria-disabled"],Po=5e3,Bo=j({__name:"StatusBar",emits:["report"],setup(e,{emit:t}){const s=t,o=x(()=>(he.value,as(m.health,m.polled_at,m.workspace.connectors.length,z.live))),n=B(!1),r=B(!1),u=x(()=>r.value?"Opened in the app window. You can close this tab.":z.status||o.value.text),c=h=>pe(h,{refused:"The app window did not open"}),_=()=>{if(n.value)return;n.value=!0,setTimeout(()=>n.value=!1,Po);const h=d=>{c(d),r.value=!re(d)};ie("/api/open",{mode:"app"}).then(h,h)};return(h,d)=>(l(),i("div",Mo,[a("button",{type:"button",class:"btn status-bar__btn status-bar__report",title:"A bug or a wish about this monitor, straight to its backlog",onClick:d[0]||(d[0]=f=>s("report"))},[(l(),i("svg",Eo,[a("path",{d:p(qn),fill:"currentColor"},null,8,zo)])),d[2]||(d[2]=J("Report ",-1))]),a("span",{class:q(["status-bar__live",{"status-bar__live--off":o.value.dot==="off","status-bar__live--warn":o.value.dot==="warn"}])},null,2),a("span",null,v(u.value),1),p(Pe)?(l(),i("span",Io,v(p(Pe)),1)):S("",!0),U(Ao),a("button",{type:"button",class:"btn status-bar__btn",onClick:d[1]||(d[1]=(...f)=>p(At)&&p(At)(...f))},"Refresh now"),p(z).mode==="app"?(l(),i("a",{key:1,class:"btn status-bar__btn",href:p(An)(p(z).ws),target:"_blank",rel:"noopener"},"Open in browser",8,Oo)):(l(),i("button",{key:2,type:"button",class:q(["btn status-bar__btn",{"status-bar__btn--busy":n.value}]),"aria-disabled":n.value,onClick:_},v(n.value?"Opening…":"Open as app"),11,Do)),U(_e,{query:{all:"1"}}),d[3]||(d[3]=a("span",{class:"ai-hint status-bar__ai-hint"},"Copy for AI: everything",-1))]))}}),Uo=K(Bo,[["__scopeId","data-v-1a4ce564"]]),ls=e=>{const t=ke("wt-collapsed",[],{writeDefaults:!1}),s=x(()=>t.value.includes(e));return{collapsed:s,toggle:()=>{t.value=s.value?t.value.filter(n=>n!==e):[...t.value,e]}}},Vo=["href"],Ho={key:1},ae=j({__name:"ExtLink",props:{text:{default:""},url:{default:""}},setup(e){const t=e,s=x(()=>it(t.url));return(o,n)=>s.value?(l(),i("a",{key:0,href:s.value,target:"_blank",rel:"noopener"},v(e.text),9,Vo)):(l(),i("span",Ho,v(e.text),1))}}),Wo={class:"workspace-header__title"},Fo={class:"workspace-header__name"},qo={key:0,class:"workspace-header__line workspace-header__strip"},No={class:"workspace-header__count"},jo={class:"workspace-header__count"},Lo={class:"workspace-header__count"},Yo={class:"workspace-header__count"},Ko={class:"workspace-header__line workspace-header__give"},Xo={class:"workspace-header__links"},Go={class:"workspace-header__tiles"},Jo={class:"workspace-header__tile-value"},Zo={class:"workspace-header__tile"},Qo={class:"workspace-header__tile-value"},ea={class:"workspace-header__tile-value"},ta={class:"workspace-header__tile"},sa={class:"workspace-header__tile-value"},na=j({__name:"WorkspaceHeader",setup(e){const{collapsed:t,toggle:s}=ls("header");return(o,n)=>(l(),i("header",{id:"summary",class:q(["island workspace-header",{"workspace-header--collapsed":p(t)}])},[a("div",Wo,[a("h1",Fo,v(p(m).workspace.name||"Whose Turn"),1),p(t)?(l(),i("p",qo,[n[1]||(n[1]=J(" Your move ",-1)),a("b",No,v(p(ne).mine),1),n[2]||(n[2]=J(" · Waiting on others ",-1)),a("b",jo,v(p(ne).others),1),n[3]||(n[3]=J(" · Failing ",-1)),a("b",Lo,v(p(ne).failing),1),n[4]||(n[4]=J(" · Done ",-1)),a("b",Yo,v(p(ne).done),1)])):S("",!0),a("p",Ko,[U(_e,{query:{ws:p(m).workspace.id,kind:"workspace"},big:""},null,8,["query"]),n[5]||(n[5]=a("span",{class:"ai-hint"},"Copy for AI: this workspace",-1)),a("span",Xo,[(l(!0),i(W,null,L(p(m).workspace.links||[],r=>(l(),Y(ae,{key:r.url,text:r.label,url:r.url,title:r.url},null,8,["text","url","title"]))),128))])])]),a("button",{type:"button",class:q(["fold-toggle workspace-header__fold",{"fold-toggle--folded":p(t)}]),"aria-label":"Fold the header","data-tip":"Fold the header; it stays folded until you open it again",onClick:n[0]||(n[0]=ee((...r)=>p(s)&&p(s)(...r),["stop"]))}," ▾ ",2),a("div",Go,[a("div",{class:q(["workspace-header__tile",{"workspace-header__tile--you":p(ne).mine>0}])},[n[6]||(n[6]=a("span",{class:"workspace-header__tile-label"},"Your move",-1)),a("strong",Jo,v(p(ne).mine),1)],2),a("div",Zo,[n[7]||(n[7]=a("span",{class:"workspace-header__tile-label"},"Waiting on others",-1)),a("strong",Qo,v(p(ne).others),1)]),a("div",{class:q(["workspace-header__tile",{"workspace-header__tile--fail":p(ne).failing}])},[n[8]||(n[8]=a("span",{class:"workspace-header__tile-label"},"Open PRs with failing checks",-1)),a("strong",ea,v(p(ne).failing),1)],2),a("div",ta,[n[9]||(n[9]=a("span",{class:"workspace-header__tile-label"},"Done in the last 30 days",-1)),a("strong",sa,v(p(ne).done),1)])])],2))}}),oa=K(na,[["__scopeId","data-v-3421a7f0"]]),pt=e=>{Q(()=>z.reconnects,e)},aa=j({__name:"Chevron",props:{open:{type:Boolean},tag:{default:"button"}},setup(e){return(t,s)=>(l(),Y($s(e.tag),{class:q(["chevron",{"chevron--open":e.open}]),type:e.tag==="button"?"button":void 0,"aria-expanded":e.tag==="button"?e.open:void 0},null,8,["class","type","aria-expanded"]))}}),Fe=K(aa,[["__scopeId","data-v-a14fa9ba"]]),la=["aria-orientation","aria-label"],It=16,ra=j({__name:"ResizeHandle",props:{label:{},axis:{},bounds:{type:Function},grow:{},top:{type:Boolean}},emits:["resize","reset"],setup(e,{emit:t}){const s=e,o=t,n=s.grow??1;let r={pointer:0,size:0,min:0,max:0};const u=d=>s.axis==="y"?d.clientY:d.clientX,c=d=>{const{current:f,min:b,max:k}=s.bounds();r={pointer:u(d),size:f,min:b,max:k},d.currentTarget.setPointerCapture(d.pointerId)},_=d=>{if(!d.currentTarget.hasPointerCapture(d.pointerId))return;const f=(u(d)-r.pointer)*n;o("resize",zt(r.size+f,r.min,r.max))},h=d=>{const f=s.axis==="y"?"ArrowDown":"ArrowRight",b=s.axis==="y"?"ArrowUp":"ArrowLeft";if(d.key!==f&&d.key!==b)return;d.preventDefault();const{current:k,min:I,max:w}=s.bounds(),y=(d.key===f?It:-It)*n;o("resize",zt(k+y,I,w))};return(d,f)=>(l(),i("div",{class:q(["resize-handle",["resize-handle--"+e.axis,{"resize-handle--top":e.top}]]),role:"separator",tabindex:"0","aria-orientation":e.axis==="y"?"horizontal":"vertical","aria-label":e.label,"data-tip":"Drag to resize; double click to reset",onPointerdown:ee(c,["prevent"]),onPointermove:_,onKeydown:h,onDblclick:f[0]||(f[0]=b=>o("reset"))},null,42,la))}}),rs=K(ra,[["__scopeId","data-v-8e637688"]]),ia=["id"],ca={class:"island__head"},ua={class:"island__title"},da={class:"island__note"},pa={class:"island__note-text"},ha=["aria-label","data-tip"],_a={class:"island__body"},fa=280,va=360,ma=j({__name:"Island",props:{id:{},sizeKey:{default:""},title:{},note:{default:""},tip:{default:""},column:{type:Boolean},resize:{default:"height"}},setup(e){const t=e,{collapsed:s,toggle:o}=ls(t.id),{size:n,set:r}=dt(()=>t.sizeKey),u=Ve("root"),c=B(0),_=y=>parseFloat(y)||0,h=(y,g)=>{let $=0;for(let A=y.parentElement;A&&A!==g;A=A.parentElement)$+=A.scrollTop;return $},d=(y,g)=>{const $=[...y.children].find(P=>P.contains(g));return($?[...y.children].slice([...y.children].indexOf($)+1):[]).filter(P=>!P.classList.contains("row-scroll__more")).reduce((P,X)=>{const D=X;return P+(_(getComputedStyle(D).minHeight)||D.offsetHeight)},0)},f=()=>{const y=u.value,g=y==null?void 0:y.querySelector(".island__body");if(!y||!g||s.value||t.resize!=="height")return;const $=g.querySelectorAll("tbody > tr, .todos__list > li"),A=y.getBoundingClientRect().top,P=_(getComputedStyle(g).paddingBottom);if(!$.length){c.value=Math.ceil(g.offsetTop+g.scrollHeight);return}const X=$[0].getBoundingClientRect().bottom-A+h($[0],y);c.value=Zn(X+d(g,$[0])+P+2,$.length)};let b=0;const k=()=>{cancelAnimationFrame(b),b=requestAnimationFrame(f)};at(()=>{var g;const y=(g=u.value)==null?void 0:g.querySelector(".island__body");y&&(Us(y,k,{childList:!0,subtree:!0}),Vs(y,k)),k()});const I=y=>{var g;return[...((g=y.parentElement)==null?void 0:g.children)??[]].filter($=>$!==y&&$ instanceof HTMLElement).map($=>({collapsed:$.classList.contains("island--collapsed"),height:$.offsetHeight,floor:_($.style.getPropertyValue("--island-floor"))}))},w=()=>{const y=u.value;if(f(),t.resize==="width"){const A=y.parentElement,P=_(getComputedStyle(A).columnGap);return{current:y.offsetWidth,min:fa,max:A.clientWidth-P-va}}const g=y.parentElement,$=_(getComputedStyle(g).rowGap);return{current:y.offsetHeight,min:c.value,max:Math.max(Qn(g.clientHeight,$,I(y)),g.clientHeight)}};return(y,g)=>(l(),i("section",{id:e.id,ref_key:"root",ref:u,class:q(["island",{"island--collapsed":p(s),"island--column":e.column,"island--sized":p(n)!==null&&e.resize==="height"}]),style:Ee(e.resize==="height"?{"--island-floor":c.value+"px","--island-height":(p(n)??0)+"px"}:void 0)},[a("div",ca,[U(Fe,{open:!p(s),"aria-label":"Fold "+e.title,"data-tip":"Fold this panel; it stays folded until you open it again",onClick:ee(p(o),["stop"])},null,8,["open","aria-label","onClick"]),a("h2",ua,[J(v(e.title)+" ",1),Je(y.$slots,"head",{},void 0)]),a("p",da,[a("span",pa,v(e.note),1),e.tip?(l(),i("button",{key:0,type:"button",class:"hint-icon","aria-label":"About "+e.title,"data-tip":e.tip}," ? ",8,ha)):S("",!0)])]),a("div",_a,[Je(y.$slots,"default",{},void 0)]),p(s)?S("",!0):(l(),Y(rs,{key:0,label:"Resize "+e.title,axis:e.resize==="width"?"x":"y",grow:e.resize==="width"?-1:1,bounds:w,onResize:p(r),onReset:g[0]||(g[0]=$=>p(r)(null))},null,8,["label","axis","grow","onResize"]))],14,ia))}}),qe=K(ma,[["__scopeId","data-v-3605428a"]]),ga=["aria-label"],ya=["aria-pressed","onClick"],ka={key:0,class:"count"},wa=j({__name:"Segmented",props:Ze({options:{},label:{default:""},chips:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Pt(e,"modelValue");return(s,o)=>(l(),i("span",{class:q(["segmented",{"segmented--chips":e.chips}]),role:"group","aria-label":e.label},[(l(!0),i(W,null,L(e.options,n=>(l(),i("button",{key:n.id,type:"button",class:"segmented__option","aria-pressed":t.value===n.id,onClick:r=>t.value=n.id},[J(v(n.label),1),n.count!==void 0?(l(),i("b",ka,v(n.count),1)):S("",!0)],8,ya))),128))],10,ga))}}),Ue=K(wa,[["__scopeId","data-v-201d5e2f"]]),ba={class:"ticket-cell"},xa={class:"ticket-cell__summary"},$a=j({__name:"TicketCell",props:{row:{}},setup(e){return(t,s)=>(l(),i("td",ba,[U(ae,{text:e.row.key,url:p(Ft)(e.row)?e.row.pr_url:e.row.ticket_url,class:"ticket-key"},null,8,["text","url"]),a("span",xa,v(e.row.summary),1)]))}}),ht=K($a,[["__scopeId","data-v-e2d11a0b"]]),Sa={key:0,class:"pr-cell"},Ca={key:1,class:"pill"},Ra=j({__name:"PrCell",props:{row:{}},setup(e){return(t,s)=>(l(),i("td",null,[e.row.pr&&!p(Ft)(e.row)?(l(),i("span",Sa,[U(ae,{text:e.row.pr,url:e.row.pr_url,class:"pr-cell__link"},null,8,["text","url"]),e.row.pr_state==="OPEN"&&e.row.checks?(l(),i("span",{key:0,class:q(["pill",p(be)("pill",p(Ls)(e.row.checks))])},v(e.row.checks),3)):e.row.pr_state?(l(),i("span",Ca,v(e.row.pr_state.toLowerCase()),1)):S("",!0)])):S("",!0)]))}}),is=K(Ra,[["__scopeId","data-v-6078ccbd"]]),Ta=["open"],Aa={class:"recently-done__summary"},Ma={class:"count"},Ea={class:"table"},za=["data-tip"],Ia={class:"table__actions"},Oa=480,Da=j({__name:"RecentlyDone",setup(e){const{size:t,set:s}=dt(()=>`${m.workspace.id}:recently-done`),o=Ve("list"),n=h=>{var f;const d=(f=h.closest(".island__body"))==null?void 0:f.querySelector(".row-scroll");return d?Math.max(0,d.clientHeight-(parseFloat(getComputedStyle(d).minHeight)||0)):0},r=()=>{const h=o.value,f=(h.querySelector("tbody > tr")??h).getBoundingClientRect().bottom-h.getBoundingClientRect().top,b=parseFloat(getComputedStyle(h).paddingBottom)||0;return{current:h.offsetHeight,min:Math.ceil(f+h.scrollTop+b),max:Math.min(Oa,h.offsetHeight+n(h))}},u=ke("wt-recent-open",!1,{writeDefaults:!1,serializer:{read:h=>h==="1",write:h=>h?"1":"0"}}),c=h=>{u.value=h.target.open},_=x(()=>(he.value,Ys(m.turn).map(h=>({row:h,since:ut(h.status_since||h.updated)}))));return(h,d)=>_.value.length?(l(),i("details",{key:0,class:"recently-done",open:p(u),onToggle:c},[a("summary",Aa,[U(Fe,{tag:"span",open:p(u)},null,8,["open"]),d[1]||(d[1]=J(" Recently done ",-1)),a("span",Ma,v(_.value.length),1)]),a("div",{ref_key:"list",ref:o,class:"recently-done__list",style:Ee(p(t)===null?void 0:{maxHeight:p(t)+"px",height:p(t)+"px"})},[a("table",Ea,[d[2]||(d[2]=a("thead",null,[a("tr",null,[a("th",null,"Ticket"),a("th",null,"Status"),a("th",null,"Done"),a("th",{class:"table__actions-col"},[a("span",{class:"visually-hidden"},"Copy for AI")])])],-1)),a("tbody",null,[(l(!0),i(W,null,L(_.value,({row:f,since:b})=>(l(),i("tr",{key:f.row_id},[U(ht,{row:f},null,8,["row"]),a("td",null,[a("span",{class:q(["pill",p(be)("pill",p(qt)(f.status_group))])},v(f.status),3)]),a("td",null,[a("span",{class:"age","data-tip":"Done "+p(ct)(f.status_since||f.updated)},v(b.text),9,za)]),a("td",Ia,[U(_e,{class:"table__ai",query:{ws:p(m).workspace.id,kind:"row",ref:f.row_id}},null,8,["query"])])]))),128))])])],4),p(u)?(l(),Y(rs,{key:0,label:"Resize Recently done",axis:"y",top:"",grow:-1,bounds:r,onResize:p(s),onReset:d[0]||(d[0]=f=>p(s)(null))},null,8,["onResize"])):S("",!0)],40,Ta)):S("",!0)}}),Pa=K(Da,[["__scopeId","data-v-68a4b78e"]]),Ba=13,Ua=j({__name:"RowScroll",props:{floor:{type:Boolean}},setup(e){const t=B(null),s=B(null),{y:o}=Hs(t),{height:n}=kt(t),{height:r}=kt(s),u=()=>{var d,f,b;return[...((b=(f=(d=s.value)==null?void 0:d.querySelector("table"))==null?void 0:f.tBodies[0])==null?void 0:b.rows)||[]]},c=()=>{const d=t.value;return d?d.getBoundingClientRect().top+d.clientTop+d.clientHeight:0},_=x(()=>(o.value,n.value,r.value,Ks(u().map(d=>d.getBoundingClientRect().bottom),c(),Ba))),h=()=>{var w,y;const d=t.value,f=u(),b=f[f.length-_.value];if(!d||!b)return;const I=((y=(w=s.value)==null?void 0:w.querySelector("thead"))==null?void 0:y.getBoundingClientRect().bottom)??d.getBoundingClientRect().top;d.scrollBy({top:b.getBoundingClientRect().top-I,behavior:"smooth"})};return(d,f)=>(l(),i(W,null,[a("div",{ref_key:"scroller",ref:t,class:q(["row-scroll",{"row-scroll--floor":e.floor}])},[a("div",{ref_key:"content",ref:s},[Je(d.$slots,"default",{},void 0)],512)],2),_.value?(l(),i("button",{key:0,type:"button",class:"row-scroll__more",onClick:h}," +"+v(_.value)+" more ",1)):S("",!0)],64))}}),cs=K(Ua,[["__scopeId","data-v-263b2407"]]),Va=B("open"),Ha=()=>Va,Wa={key:0,class:"your-move__undo",role:"status"},Fa={class:"table"},qa={key:0},Na={key:1,class:"hide-narrow"},ja={class:"hint-row"},La={class:"your-move__next"},Ya=["data-tip"],Ka=["data-tip"],Xa=["data-tip"],Ga={key:0,class:"alert alert--inline your-move__problem",role:"alert"},Ja={class:"table__actions"},Za=["aria-label","onClick"],Qa={key:1,class:"empty"},el=j({__name:"YourMove",setup(e){const t=Ha(),s=x(()=>{he.value;const f=Xs(m.turn,t.value);return{...f,rows:f.rows.map(b=>({...b,age:ut(b.row.activity_at)}))}}),o=x(()=>Nt(s.value.rows.map(f=>f.row))),n=x(()=>s.value.rows.some(f=>f.row.comment)),r=x(()=>[{id:"open",label:"Open",count:s.value.open},{id:"handled",label:"Handled",count:s.value.handled}]),u=x(()=>{if(t.value==="handled")return"Nothing marked as handled.";const{noData:f,failing:b}=as(m.health,m.polled_at,m.workspace.connectors.length,z.live);return f?"No data: "+b.join(", ")+(b.length===1?" is":" are")+" failing. Check Settings.":"Nothing is waiting on you."}),c=ot(new Map);pt(()=>c.clear());const _=async f=>{const b=f.row.row_id,k=await me({handled:{[b]:f.handled?null:new Date().toISOString()}});k?c.set(b,k):(c.delete(b),h.value=f.handled?"":b)},h=we("",8e3),d=()=>{const f=h.value;return h.value="",me({handled:{[f]:null}})};return(f,b)=>(l(),Y(qe,{id:"your-move","size-key":`${p(m).workspace.id}:your-move`,title:"Your move",note:"Next step is yours",tip:"Each row is something where the next step is yours. Ticket, PR and comment open in a new tab."},{head:oe(()=>[U(Ue,{modelValue:p(t),"onUpdate:modelValue":b[0]||(b[0]=k=>Ss(t)?t.value=k:null),options:r.value,label:"Show",class:"your-move__view"},null,8,["modelValue","options"])]),default:oe(()=>[p(h)?(l(),i("p",Wa,[b[1]||(b[1]=J(" Marked handled. ",-1)),a("button",{type:"button",class:"your-move__undo-btn",onClick:d},"Undo")])):S("",!0),U(cs,{floor:""},{default:oe(()=>[a("table",Fa,[a("thead",null,[a("tr",null,[b[2]||(b[2]=a("th",null,"Ticket",-1)),b[3]||(b[3]=a("th",null,"Next step",-1)),o.value?(l(),i("th",qa,"PR")):S("",!0),n.value?(l(),i("th",Na,"Last comment")):S("",!0),b[4]||(b[4]=a("th",{class:"table__actions-col"},[a("span",{class:"visually-hidden"},"Mark")],-1))])]),a("tbody",null,[(l(!0),i(W,null,L(s.value.rows,k=>(l(),i("tr",{key:k.row.row_id,class:q(["your-move__row",{"your-move__row--handled":k.handled}])},[U(ht,{row:k.row},null,8,["row"]),a("td",null,[a("span",ja,[a("span",La,v(k.row.next),1),k.age.text?(l(),i("span",{key:0,class:q(["age",{"age--old":k.age.old}]),"data-tip":"Waiting since "+p(ct)(k.row.activity_at)},v(k.age.text),11,Ya)):S("",!0),k.row.why?(l(),i("button",{key:1,type:"button",class:"hint-label","aria-label":"Why this is your move","data-tip":k.row.why}," why ",8,Ka)):S("",!0),k.handled?(l(),i("span",{key:2,class:"handled-chip","data-tip":"Marked "+p(le)(p(m).marks.handled[k.row.row_id]||"")+". Comes back in 7 days if it is still open, or sooner when something new happens."},"handled",8,Xa)):S("",!0)]),c.get(k.row.row_id)?(l(),i("p",Ga,v(c.get(k.row.row_id)),1)):S("",!0)]),o.value?(l(),Y(is,{key:0,row:k.row},null,8,["row"])):S("",!0),n.value?(l(),i("td",{key:1,class:q(["hide-narrow",{"your-move__quote":k.row.comment}])},[k.row.comment?(l(),Y(ae,{key:0,text:k.row.comment,url:k.row.comment_url},null,8,["text","url"])):S("",!0)],2)):S("",!0),a("td",Ja,[U(_e,{class:"table__ai",query:{ws:p(m).workspace.id,kind:"row",ref:k.row.row_id}},null,8,["query"]),a("button",{type:"button",class:q(["your-move__mark",{"your-move__mark--undo":k.handled}]),"aria-label":(k.handled?"Move back to open: ":"Mark as handled: ")+k.row.key,onClick:ee(I=>_(k),["stop"])},v(k.handled?"Undo":"Handled"),11,Za)])],2))),128))])])]),_:1}),s.value.rows.length?S("",!0):(l(),i("p",Qa,v(u.value),1)),p(t)==="open"?(l(),Y(Pa,{key:2})):S("",!0)]),_:1},8,["size-key"]))}}),tl=K(el,[["__scopeId","data-v-a331a3e6"]]),sl=B(!1),nl=()=>sl,ol={class:"todos__add"},al={key:0,class:"alert alert--inline",role:"alert"},ll={key:1,class:"todos__undo",role:"status"},rl={class:"todos__list"},il=["aria-checked","aria-label","onClick"],cl=["onKeydown"],ul=["onDblclick"],dl={class:"todos__meta"},pl=["onClick"],hl=["onClick"],_l={key:0,class:"empty todos__empty"},fl=j({__name:"Todos",setup(e){const t=nl(),s=B(""),o=x(()=>(m.todos||[]).filter(O=>!O.done)),n=x(()=>(m.todos||[]).filter(O=>O.done)),r=x(()=>new RegExp(m.workspace.key_pattern||"(?!)","g")),u=O=>{const N=[];let V=0;const M=O.text;for(const F of M.matchAll(r.value))F.index>V&&N.push({text:M.slice(V,F.index)}),N.push({text:F[0],url:F[0]===O.key?O.ticket_url:""}),V=F.index+F[0].length;return V<M.length&&N.push({text:M.slice(V)}),N},c=x(()=>(he.value,(t.value?o.value.concat(n.value):o.value).map(O=>({todo:O,parts:u(O),meta:(O.by&&O.by!=="you"?O.by+" · ":"")+le(O.created)})))),_=B("");pt(()=>{_.value=""});const h=async O=>(_.value=await Vn(O),!_.value),d=async()=>{const O=s.value.trim();O&&await h({action:"add",text:O})&&s.value.trim()===O&&(s.value="")},f=O=>h({action:O.done?"undo":"done",id:O.id}),b=B(null),k=async O=>{await h({action:"delete",id:O.id})&&(b.value=O)},I=async()=>{const O=b.value;if(b.value=null,O&&await h({action:"add",text:O.text})&&O.done){const N=(m.todos||[]).find(V=>V.text===O.text&&!V.done);N&&await h({action:"done",id:N.id})}},w=B(""),y=B(""),g=Ve("editBox"),$=async O=>{var N,V;w.value=O.id,y.value=O.text,await ye(),(V=(N=g.value)==null?void 0:N[0])==null||V.focus()},A=()=>{w.value=""},P=async O=>{const N=y.value.trim();if(!N||N===O.text)return A();await h({action:"edit",id:O.id,text:N})&&A()},X=x({get:()=>t.value?"done":"open",set:O=>{t.value=O==="done"}}),D=x(()=>[{id:"open",label:"Open",count:o.value.length},{id:"done",label:"Done",count:n.value.length}]);return(O,N)=>(l(),Y(qe,{id:"todo","size-key":`${p(m).workspace.id}:todo`,title:"To do",note:"Your own notes",tip:'Your personal to-dos, kept on this machine. Add here, or ask Claude: "add to my to-do: …". A ticket key like PROJ-123 in the text becomes a link.'},{head:oe(()=>[U(Ue,{modelValue:X.value,"onUpdate:modelValue":N[0]||(N[0]=V=>X.value=V),options:D.value,label:"Show",class:"todos__view"},null,8,["modelValue","options"])]),default:oe(()=>[a("div",ol,[ze(a("input",{"onUpdate:modelValue":N[1]||(N[1]=V=>s.value=V),class:"input todos__input",type:"text",placeholder:"Add a to-do and press Enter","aria-label":"New to-do",autocomplete:"off",onKeydown:fe(d,["enter"])},null,544),[[Ie,s.value]]),a("button",{type:"button",class:"btn btn--tonal",onClick:d},"Add")]),_.value?(l(),i("p",al,v(_.value),1)):S("",!0),b.value?(l(),i("p",ll,[N[3]||(N[3]=J(" To-do deleted. ",-1)),a("button",{type:"button",class:"todos__undo-btn",onClick:I},"Undo")])):S("",!0),a("ul",rl,[(l(!0),i(W,null,L(c.value,({todo:V,parts:M,meta:F})=>(l(),i("li",{key:V.id,class:q(["todos__item",{"todos__item--done":V.done}])},[a("button",{type:"button",class:q(["todos__check",{"todos__check--on":V.done}]),role:"checkbox","aria-checked":!!V.done,"aria-label":V.done?"Mark not done":"Mark done",onClick:T=>f(V)},null,10,il),w.value===V.id?ze((l(),i("input",{key:0,ref_for:!0,ref_key:"editBox",ref:g,"onUpdate:modelValue":N[2]||(N[2]=T=>y.value=T),class:"input todos__edit",type:"text",maxlength:"500","aria-label":"Edit to-do",autocomplete:"off",onKeydown:[fe(T=>P(V),["enter"]),fe(A,["esc"])],onBlur:A},null,40,cl)),[[Ie,y.value]]):(l(),i("span",{key:1,class:"todos__text",onDblclick:T=>$(V)},[(l(!0),i(W,null,L(M,(T,Z)=>(l(),i(W,{key:Z},[T.url!==void 0?(l(),Y(ae,{key:0,text:T.text,url:T.url},null,8,["text","url"])):(l(),i(W,{key:1},[J(v(T.text),1)],64))],64))),128))],40,ul)),a("span",dl,v(F),1),a("button",{type:"button",class:"todos__pencil","aria-label":"Edit to-do",onClick:T=>$(V)}," ✎ ",8,pl),a("button",{type:"button",class:"todos__delete","aria-label":"Delete to-do",onClick:T=>k(V)}," × ",8,hl)],2))),128)),c.value.length?S("",!0):(l(),i("span",_l,v(p(t)?"Nothing here yet.":"Nothing to do. Add one above, or ask Claude."),1))])]),_:1},8,["size-key"]))}}),vl=K(fl,[["__scopeId","data-v-6dbdbb66"]]),ml={key:0,class:"count"},gl={key:0,class:"empty"},yl={class:"table waiting__table"},kl={key:0,class:"hide-narrow"},wl={key:1,class:"waiting__col waiting__col--pr"},bl=["data-tip"],xl={key:0,class:"hide-narrow"},$l={key:0,class:"hint-row"},Sl=["data-tip"],Cl={class:"table__actions"},Rl=j({__name:"Waiting",setup(e){const t=x(()=>(he.value,Gs(m.turn).map(r=>({row:r,since:r.status_since?ut(r.status_since):null,own:r.status_group==="backlog"})))),s=x(()=>Nt(t.value.map(({row:r})=>r))),o=x(()=>t.value.some(({row:r,own:u})=>r.hold_url||!u&&r.next)),n=x(()=>t.value.length&&t.value.every(({own:r})=>r)?"Your backlog":"Someone else holds the next step");return(r,u)=>(l(),Y(qe,{id:"waiting","size-key":`${p(m).workspace.id}:waiting`,title:"Waiting on others",note:n.value,tip:"Tickets you touched in the last 30 days where someone else holds the next step: a reviewer, QA, or a new owner."},{head:oe(()=>[t.value.length?(l(),i("span",ml,v(t.value.length),1)):S("",!0)]),default:oe(()=>[t.value.length?(l(),Y(cs,{key:1},{default:oe(()=>[a("table",yl,[a("thead",null,[a("tr",null,[u[0]||(u[0]=a("th",{class:"waiting__col waiting__col--ticket"},"Ticket",-1)),u[1]||(u[1]=a("th",{class:"waiting__col waiting__col--status"},"Status",-1)),u[2]||(u[2]=a("th",{class:"waiting__col waiting__col--with"},"With",-1)),o.value?(l(),i("th",kl,"Waiting for")):S("",!0),s.value?(l(),i("th",wl,"PR")):S("",!0),u[3]||(u[3]=a("th",{class:"table__actions-col waiting__col waiting__col--actions"},[a("span",{class:"visually-hidden"},"Copy for AI")],-1))])]),a("tbody",null,[(l(!0),i(W,null,L(t.value,({row:c,since:_,own:h})=>(l(),i("tr",{key:c.row_id},[U(ht,{row:c},null,8,["row"]),a("td",null,[a("span",{class:q(["pill",p(be)("pill",p(qt)(c.status_group))])},v(c.status),3)]),a("td",null,[J(v(h?"you":c.whose)+" ",1),_?(l(),i("span",{key:0,class:q(["age",{"age--old":_.hours>=72}]),"data-tip":c.status+" since "+p(ct)(c.status_since)},v(_.text),11,bl)):S("",!0)]),o.value?(l(),i("td",xl,[c.hold_url?(l(),i("span",$l,[U(ae,{text:c.next,url:c.hold_url,class:"waiting__reason"},null,8,["text","url"]),a("button",{type:"button",class:"hint-label","aria-label":"Full reason","data-tip":c.hold_full||c.next}," full ",8,Sl)])):h?S("",!0):(l(),i(W,{key:1},[J(v(c.next),1)],64))])):S("",!0),s.value?(l(),Y(is,{key:1,row:c},null,8,["row"])):S("",!0),a("td",Cl,[U(_e,{class:"table__ai",query:{ws:p(m).workspace.id,kind:"row",ref:c.row_id}},null,8,["query"])])]))),128))])])]),_:1})):(l(),i("p",gl,"Nothing is waiting on someone else."))]),_:1},8,["size-key","note"]))}}),Tl=K(Rl,[["__scopeId","data-v-90e8bf77"]]),Al=(e,t)=>e.seen instanceof Set?e.seen.has(t):e.seen.includes(t),us=(e,t)=>new Date(e.at).getTime()>(t.base||0)&&!Al(t,e.id),Ml=(e,t)=>{const s=String(t||"").toLowerCase().split(/\s+/).filter(Boolean);if(!s.length)return!0;const o=[e.ref,e.key,e.title,e.kind,e.who,e.text,e.body].join(" ").toLowerCase();return s.every(n=>o.includes(n))},El=e=>e.key||e.ref||e.id,zl=(e,t)=>{const s=new Map;for(const o of e){const n=El(o),r=s.get(n)||{id:n,items:[],newest:o.at,unread:0,title:""};s.set(n,r),r.items.push(o),r.title||(r.title=o.title||""),o.at>r.newest&&(r.newest=o.at),us(o,t)&&(r.unread+=1)}return[...s.values()].sort((o,n)=>String(n.newest).localeCompare(String(o.newest)))},Il=e=>new Set(e.filter(t=>t.group==="you"&&!t.handled).map(t=>t.key)),Ol=(e,t=2)=>{const s=[...new Set(e.map(n=>n.kind))],o=s.length-t;return s.slice(0,t).join(" · ")+(o>0?` +${o}`:"")},Dl=e=>/fail|changes/.test(e)?"bad":/approved|merged|passed/.test(e)?"ok":"",Pl=e=>/comment|approved|changes|mentioned|review requested/.test(e.kind)&&String(e.body||"").trim()!=="",ds=e=>e.ref!==e.key&&(e.key||e.title)||"",Bl=e=>[ds(e),e.text===e.title?"":e.text].filter(Boolean).join(" · "),Ul=e=>e.type==="github"&&e.label==="GitHub"?"GH":ns(e.label),Vl={class:"feed-item__body"},Hl={class:"feed-item__top"},Wl={key:1,class:"feed-item__who"},Fl={key:2,class:"at-you"},ql={class:"feed-item__right"},Nl={class:"timestamp feed-item__when"},jl={key:0,class:"feed-item__text"},Ll={class:"feed-item__full"},Yl={class:"feed-item__actions"},Kl={key:1,class:"feed-item__text"},Xl=j({__name:"FeedItem",props:{item:{},source:{},fresh:{type:Boolean},expanded:{type:Boolean}},emits:["open","toggle","seen"],setup(e,{emit:t}){const s=e,o=t,n=x(()=>Ul(s.source)),r=x(()=>ds(s.item)),u=x(()=>Bl(s.item)),c=x(()=>Dl(s.item.kind)),_=x(()=>c.value||(s.source.type==="github"?"":"jira")),h=x(()=>Pl(s.item)),d=x(()=>h.value&&s.expanded),f=x(()=>(he.value,le(s.item.at))),b=()=>{s.fresh&&o("seen",s.item.id)},k=()=>{o("toggle",s.item.id),b()};return(I,w)=>(l(),i("li",{class:q(["feed-item",{"feed-item--new":e.fresh,"feed-item--open":d.value}]),onClick:b},[a("span",{class:q(["feed-item__icon",p(be)("feed-item__icon",_.value)])},v(n.value),3),a("div",Vl,[a("div",Hl,[h.value?(l(),Y(Fe,{key:0,open:d.value,"aria-label":d.value?"Collapse":"Expand",onClick:ee(k,["stop"])},null,8,["open","aria-label"])):S("",!0),U(ae,{text:e.item.ref,url:e.item.url},null,8,["text","url"]),a("span",{class:q(["feed-item__kind",{"feed-item__kind--bad":c.value==="bad"}])},v(e.item.kind),3),e.item.who?(l(),i("span",Wl,v(e.item.who),1)):S("",!0),e.item.mention?(l(),i("span",Fl,"@you")):S("",!0),a("span",ql,[a("span",Nl,v(f.value),1)])]),d.value?(l(),i(W,{key:0},[r.value?(l(),i("span",jl,v(r.value),1)):S("",!0),a("div",Ll,v(e.item.body),1),a("div",Yl,[a("button",{type:"button",class:"btn btn--tonal",onClick:w[0]||(w[0]=ee(y=>o("open",e.item),["stop"]))}," Open formatted "),U(_e,{query:{ws:p(m).workspace.id,kind:"feed",ref:e.item.id}},null,8,["query"]),U(ae,{text:"Open in "+e.source.label,url:e.item.url,class:"btn"},null,8,["text","url"])])],64)):u.value?(l(),i("span",Kl,v(u.value),1)):S("",!0)])],2))}}),Ot=K(Xl,[["__scopeId","data-v-03f50e9f"]]),Gl=ot({source:"all",view:ke("wt-feed-view","ticket",{writeDefaults:!1}),query:"",openGroups:new Set}),Jl=()=>Gl,Zl={key:0,class:"feed__new-count"},Ql={class:"feed__bar"},er={key:0,class:"alert alert--inline",role:"alert"},tr={key:1,class:"feed__undo",role:"status"},sr={class:"feed__search"},nr={class:"feed__search-count"},or={key:2,class:"empty"},ar={key:3,class:"feed__list"},lr=["title","onClick"],rr={class:"feed__group-text"},ir={class:"feed__group-key"},cr={key:0,class:"feed__group-sum"},ur={class:"feed__group-meta"},dr={class:"feed__group-kinds"},pr={class:"timestamp feed__group-when"},hr={key:0,class:"feed__children"},_r=j({__name:"Feed",emits:["open"],setup(e,{emit:t}){const s=t,o=Jl(),n=[{id:"ticket",label:"By ticket"},{id:"flat",label:"Flat"}],r=x(()=>m.workspace.connectors||[]),u=x(()=>Object.fromEntries(r.value.map(M=>[M.id,M]))),c=M=>u.value[M]||{id:M,type:M,label:M},_=x(()=>r.value.length>1?[{id:"all",label:"All"}].concat(r.value.map(M=>({id:M.id,label:M.label}))):[]),h=x({get:()=>_.value.some(M=>M.id===o.source)?o.source:"all",set:M=>{o.source=M}});Q(()=>m.workspace.id,()=>{o.query=""});const d=x(()=>({base:m.marks.base,seen:new Set(m.marks.seen)})),f=M=>us(M,d.value),b=x(()=>m.feed.filter(f).length),k=x(()=>m.feed.filter(M=>h.value==="all"||M.source===h.value)),I=x(()=>k.value.filter(M=>Ml(M,o.query)).slice(0,200)),w=x(()=>new Map(m.turn.map(M=>[M.key,M]))),y=x(()=>Il(m.turn)),g=x(()=>(he.value,zl(I.value,d.value).map(M=>({...M,row:w.value.get(M.id),move:y.value.has(M.id),when:le(M.newest),kinds:Ol(M.items),open:o.openGroups.has(M.id)||!!o.query})))),$=(M,F)=>{M.has(F)?M.delete(F):M.add(F)},A=M=>$(o.openGroups,M.id),P=M=>$(z.open,M),X=M=>me({seen:[M]}).then(pe),D=B("");pt(()=>{D.value=""});const O=B(null),N=async()=>{const M=new Set(m.marks.seen),F={base:m.marks.base,added:m.feed.map(T=>T.id).filter(T=>!M.has(T))};D.value=await me({seen:m.feed.map(T=>T.id),base:Date.now()}),O.value=D.value?null:F},V=async()=>{const M=O.value;O.value=null,M&&(D.value=await me({unseen:M.added,base:M.base}))};return(M,F)=>(l(),Y(qe,{id:"feed","size-key":`${p(m).workspace.id}:feed`,title:"What changed",note:"Newest first, every source",tip:"Newest first: comments, reviews, merges and failed checks on your PRs, and ticket changes. Each item opens where it happened.",class:"feed",column:"",resize:"width"},{head:oe(()=>[b.value?(l(),i("span",Zl,v(b.value)+" new",1)):S("",!0)]),default:oe(()=>[a("div",Ql,[_.value.length?(l(),Y(Ue,{key:0,modelValue:h.value,"onUpdate:modelValue":F[0]||(F[0]=T=>h.value=T),options:_.value,label:"Feed source"},null,8,["modelValue","options"])):S("",!0),U(Ue,{modelValue:p(o).view,"onUpdate:modelValue":F[1]||(F[1]=T=>p(o).view=T),options:n,label:"Feed view"},null,8,["modelValue"])]),D.value?(l(),i("p",er,v(D.value),1)):S("",!0),O.value?(l(),i("p",tr,[F[5]||(F[5]=J(" Marked all read. ",-1)),a("button",{type:"button",class:"feed__undo-btn",onClick:V},"Undo")])):S("",!0),a("div",sr,[ze(a("input",{"onUpdate:modelValue":F[2]||(F[2]=T=>p(o).query=T),class:"input feed__search-input",type:"search",placeholder:"Search the feed: key, author, words…","aria-label":"Search the feed",autocomplete:"off"},null,512),[[Ie,p(o).query,void 0,{trim:!0}]]),a("span",nr,v(p(o).query?I.value.length+" of "+k.value.length:""),1),a("button",{type:"button",class:"feed__mark-read",onClick:N},"Mark all read")]),p(m).feed.length?(l(),i("ol",ar,[p(o).view==="ticket"?(l(!0),i(W,{key:0},L(g.value,T=>(l(),i("li",{key:T.id,class:q(["feed__group",{"feed__group--new":T.unread,"feed__group--open":T.open,"feed__group--move":T.move}])},[a("div",{class:"feed__group-head",title:T.move?"Your move on this ticket":void 0,onClick:Z=>A(T)},[U(Fe,{open:T.open,"aria-label":"Fold "+T.id},null,8,["open","aria-label"]),a("div",rr,[a("div",ir,[U(ae,{text:T.id,url:T.row?T.row.ticket_url:T.items[0].url,class:"ticket-key feed__group-ticket"},null,8,["text","url"]),T.row||T.title?(l(),i("span",cr,v(T.row?T.row.summary:T.title),1)):S("",!0)]),a("div",ur,[a("span",{class:q(["feed__group-count",{"feed__group-count--new":T.unread}])},v(T.unread?T.unread+" new":T.items.length+(T.items.length===1?" event":" events")),3),a("span",dr,v(T.kinds),1),a("span",pr,v(T.when),1)])]),U(_e,{class:"feed__group-copy",query:{ws:p(m).workspace.id,kind:"thread",ref:T.id}},null,8,["query"])],8,lr),T.open?(l(),i("ul",hr,[(l(!0),i(W,null,L(T.items,Z=>(l(),Y(Ot,{key:Z.id,item:Z,source:c(Z.source),fresh:f(Z),expanded:p(z).open.has(Z.id),onOpen:F[3]||(F[3]=Ne=>s("open",Ne)),onToggle:P,onSeen:X},null,8,["item","source","fresh","expanded"]))),128))])):S("",!0)],2))),128)):(l(!0),i(W,{key:1},L(I.value,T=>(l(),Y(Ot,{key:T.id,item:T,source:c(T.source),fresh:f(T),expanded:p(z).open.has(T.id),onOpen:F[4]||(F[4]=Z=>s("open",Z)),onToggle:P,onSeen:X},null,8,["item","source","fresh","expanded"]))),128))])):(l(),i("p",or," No changes yet. New comments, reviews and status changes show up here. "))]),_:1},8,["size-key"]))}}),fr=K(_r,[["__scopeId","data-v-ce5c36bb"]]),vr={id:"first-run",class:"island first-run","aria-labelledby":"first-run-title"},mr={class:"first-run__text"},gr=j({__name:"FirstRun",setup(e){const t=()=>Qt("connectors");return(s,o)=>(l(),i("section",vr,[o[1]||(o[1]=a("h2",{id:"first-run-title",class:"first-run__title"}," Whose Turn watches your tickets and pull requests and shows what is waiting on you. ",-1)),a("p",mr,[a("b",null,v(p(m).workspace.name),1),o[0]||(o[0]=J(" has no sources yet, so there is nothing to watch. Connect a repository or a tracker. ",-1))]),a("div",{class:"first-run__actions"},[a("button",{type:"button",class:"btn btn--tonal",onClick:t},"Add a source")]),o[2]||(o[2]=a("p",{class:"first-run__text first-run__ai"},' Or ask Claude: "add my GitHub repository to Whose Turn." ',-1))]))}}),yr=K(gr,[["__scopeId","data-v-84359c2d"]]),kr=new RegExp("(`[^`]{1,500}`)|(\\*\\*[^*]{1,500}\\*\\*)|(\\[[^\\]]{1,300}\\]\\(https?:\\/\\/[^)\\s]{1,2000}\\))|(https?:\\/\\/[^\\s<>()]{1,2000})|(@[A-Za-z0-9-]+(?: [A-Z][a-z]+)?)|((?<![A-Za-z0-9])\\*[^*\\s][^*]{0,500}\\*(?![A-Za-z0-9])|(?<![A-Za-z0-9])_[^_\\s][^_]{0,500}_(?![A-Za-z0-9]))","g"),Dt=(e,t)=>{const s=it(t);return s?{type:"link",text:e,href:s}:{type:"text",text:e}},wr=e=>{const t=e[0];if(e[1])return{type:"code",text:t.slice(1,-1)};if(e[2])return{type:"strong",text:t.slice(2,-2)};if(e[3]){const s=t.indexOf("](");return Dt(t.slice(1,s),t.slice(s+2,-1))}return e[4]?Dt(t,t):e[5]?{type:"mention",text:t}:{type:"em",text:t.slice(1,-1)}},Te=e=>{const t=new RegExp(kr),s=[];let o=0,n;for(;n=t.exec(e);)n.index>o&&s.push({type:"text",text:e.slice(o,n.index)}),s.push(wr(n)),o=n.index+n[0].length;return o<e.length&&s.push({type:"text",text:e.slice(o)}),s},br=e=>{const t=String(e||"").replace(/<!--[\s\S]*?-->/g,"").split(`
|
|
2
|
+
`),s=[];let o=[],n=null;const r=()=>{o.length&&(s.push({type:"paragraph",lines:o.map(Te)}),o=[]),n=null};for(let u=0;u<t.length;u++){const c=t[u];if(/^\s*```/.test(c)){r();const f=[];for(u++;u<t.length&&!/^\s*```/.test(t[u]);u++)f.push(t[u]);s.push({type:"fence",text:f.join(`
|
|
3
|
+
`)});continue}const _=c.match(/^(#{1,6})\s+(.*)$/);if(_){r(),s.push({type:"heading",level:_[1].length<=2?4:5,inline:Te(_[2])});continue}const h=c.match(/^>\s?(.*)$/);if(h){r(),s.push({type:"quote",inline:Te(h[1])});continue}const d=c.match(/^\s*([-*+]|\d+[.)])\s+(.*)$/);if(d){const f=n;o.length&&(r(),n=f);const b=/\d/.test(d[1]),k=n,I=k&&k.ordered===b?k:{type:"list",ordered:b,items:[]};I!==k&&s.push(I),n=I,I.items.push(Te(d[2]));continue}if(!c.trim()){r();continue}n=null,o.push(c)}return r(),s},Me=(e,t,s="")=>{const o=document.createElement(e);return o.textContent=t,s&&(o.className=s),o},xr=e=>{if(e.type==="text")return document.createTextNode(e.text);if(e.type==="link"){const t=Me("a",e.text);return t.setAttribute("href",e.href),t.setAttribute("target","_blank"),t.setAttribute("rel","noopener"),t}return e.type==="mention"?Me("span",e.text,"markdown-view__mention"):Me(e.type,e.text)},ps=(e,t)=>{e.forEach(s=>t.append(xr(s)))},Ge=(e,t)=>{const s=document.createElement(e);return ps(t,s),s},$r=e=>{if(e.type==="fence"){const s=document.createElement("pre");return s.append(Me("code",e.text)),s}if(e.type==="heading")return Ge(`h${e.level}`,e.inline);if(e.type==="quote")return Ge("blockquote",e.inline);if(e.type==="list"){const s=document.createElement(e.ordered?"ol":"ul");return e.items.forEach(o=>s.append(Ge("li",o))),s}const t=document.createElement("p");return e.lines.forEach((s,o)=>{o&&t.append(document.createElement("br")),ps(s,t)}),t},Sr=e=>{const t=document.createDocumentFragment();return br(e).forEach(s=>t.append($r(s))),t},Cr=j({__name:"MarkdownView",props:{source:{default:""}},setup(e){const t=e,s=B(null);return Cs(()=>{s.value&&s.value.replaceChildren(Sr(t.source))}),(o,n)=>(l(),i("div",{ref_key:"host",ref:s,class:"markdown-view"},null,512))}}),Rr=K(Cr,[["__scopeId","data-v-dcf42e95"]]),Tr={class:"modal__card"},Ar={class:"modal__head"},Mr={id:"modal-title",class:"modal__title"},Er=["href"],zr=j({__name:"CommentModal",setup(e){const t=x(()=>z.modal),s=x(()=>t.value?[t.value.ref,t.value.kind,t.value.who].filter(Boolean).join(" · "):""),o=x(()=>t.value?it(t.value.url):""),n=x(()=>{var c;const u=(m.workspace.connectors||[]).find(_=>{var h;return _.id===((h=t.value)==null?void 0:h.source)});return"Open in "+(u?u.label:(c=t.value)==null?void 0:c.source)}),r=()=>{z.modal=null};return(u,c)=>t.value?(l(),i("div",{key:0,class:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:ee(r,["self"])},[a("div",Tr,[a("div",Ar,[a("h3",Mr,v(s.value),1),o.value?(l(),i("a",{key:0,class:"btn",href:o.value,target:"_blank",rel:"noopener"},v(n.value),9,Er)):S("",!0),a("button",{type:"button",class:"btn",onClick:r},"Close")]),U(Rr,{source:t.value.body||t.value.text||""},null,8,["source"])])])):S("",!0)}}),Ir={class:"modal__card feedback-sheet__card"},Or={class:"modal__head"},Dr={class:"modal__meta"},Pr=["aria-disabled"],Br={key:0,class:"alert"},Ur={class:"sheet-form"},Vr=["placeholder","onKeydown"],Hr={key:0,class:"feedback-sheet__note"},Wr={key:1,class:"feedback-sheet__note"},Fr={key:2,class:"empty"},qr=["href"],Nr={key:3,class:"feedback-sheet__reports"},jr=["href"],Lr={class:"feedback-sheet__report-title"},Yr={class:"timestamp"},Kr=j({__name:"FeedbackSheet",setup(e){const t=B(""),s=B(null),o=B(!1),n=B([]),r=B(null),u=B(""),c=B(!0),_=we("",1600),h=B([]),d=w=>"/report?id="+encodeURIComponent(w),f=()=>We("/api/feedback").then(w=>{c.value=w.configured,u.value=w.configured?"Linear · "+w.project:"not connected",h.value=w.reports||[]},()=>{n.value=[Oe+"; past reports cannot be loaded."]}),b=()=>{z.feedback=!1},k=()=>{const w=t.value.trim();if(!w){n.value=["Write at least one line."];return}n.value=[],navigator.clipboard.writeText(w).then(()=>{_.value="sent"},()=>{_.value="failed"})},I=()=>{if(!c.value||o.value)return;const w=t.value.trim();if(!w){n.value=["Write at least one line."];return}o.value=!0,ie("/api/feedback",{text:w,from:"the window",ws:m.workspace.id,kind_ref:{kind:"workspace",ref:m.workspace.id}}).then(y=>{if(o.value=!1,y.error){n.value=jt(y.error);return}r.value=y.issue||null,t.value="",h.value=y.reports||h.value}).catch(y=>{o.value=!1,n.value=[re(y,{refused:"Not sent",unreachable:Qe})]})};return Q(()=>z.feedback,w=>{w&&(n.value=[],r.value=null,f().then(()=>ye(()=>{var y;return(y=s.value)==null?void 0:y.focus()})))}),(w,y)=>p(z).feedback?(l(),i("div",{key:0,class:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",onClick:ee(b,["self"])},[a("div",Ir,[a("div",Or,[y[1]||(y[1]=a("h3",{id:"feedback-title",class:"modal__title"},"Report a problem or a wish",-1)),a("span",Dr,v(u.value),1),a("button",{type:"button",class:"btn btn--tonal","aria-disabled":!c.value||o.value,onClick:I},v(o.value?"Composing…":"Send"),9,Pr),a("button",{type:"button",class:"btn",onClick:b},"Close")]),n.value.length?(l(),i("div",Br,v(n.value.join(" · ")),1)):S("",!0),a("div",Ur,[ze(a("textarea",{ref_key:"field",ref:s,"onUpdate:modelValue":y[0]||(y[0]=g=>t.value=g),class:"input feedback-sheet__text",rows:"5",placeholder:"Describe the problem or the wish in your own words."+(c.value?" Cmd+Enter sends.":""),autocomplete:"off",onKeydown:[fe(ee(I,["meta","prevent"]),["enter"]),fe(ee(I,["ctrl","prevent"]),["enter"])]},null,40,Vr),[[Ie,t.value]]),c.value?(l(),i("p",Wr," An assistant turns it into a proper issue (title, kind, description) and files it in the Whose Turn backlog with this workspace's summary attached. ")):(l(),i("p",Hr,[y[2]||(y[2]=J(" The maintainer's tracker is not connected on this machine, so nothing can be sent from here. Copy your remark and pass it on yourself. ",-1)),a("button",{type:"button",class:"btn",onClick:k},v(p(_)==="sent"?"Copied":p(_)==="failed"?"Could not copy":"Copy remark"),1)])),r.value?(l(),i("p",Fr,[y[3]||(y[3]=J(" Filed as ",-1)),a("a",{href:d(r.value.identifier),target:"_blank",rel:"noopener"},v(r.value.identifier),9,qr),J(" · "+v(r.value.title),1)])):S("",!0),h.value.length?(l(),i("div",Nr,[y[4]||(y[4]=a("h4",{class:"sheet-form__heading"},"Your reports",-1)),(l(!0),i(W,null,L(h.value,g=>(l(),i("div",{key:g.id,class:"feedback-sheet__report"},[a("a",{href:d(g.id),target:"_blank",rel:"noopener"},v(g.id),9,jr),a("span",Lr,v(g.title),1),a("span",{class:q(["pill",p(be)("pill",p(Js)(g.outcome))])},v(g.state||"filed"),3),a("span",Yr,v(p(le)(g.changed_at||g.filed_at)),1)]))),128))])):S("",!0)])])])):S("",!0)}}),Xr=K(Kr,[["__scopeId","data-v-8e2792d9"]]),Gr={class:"field-row"},Jr={class:"field-row__label"},Zr={key:0,class:"field-row__check"},Qr=["checked"],ei=["aria-invalid","value"],ti={key:0,value:""},si=["value"],ni=["value"],oi={key:3,class:"field-row__inline"},ai=["value"],li=["value"],ri=["aria-invalid","value"],ii=["aria-invalid","placeholder","value"],ci={key:6,class:"field-row__error",role:"alert"},ui={key:7,class:"field-row__hint"},di=j({__name:"FieldRow",props:Ze({spec:{},placeholder:{default:""},hint:{default:""},error:{default:""}},{modelValue:{type:[String,Array,Boolean]},modelModifiers:{}}),emits:Ze(["secret"],["update:modelValue"]),setup(e,{emit:t}){const s=e,o=t,n=Pt(e,"modelValue"),r=/^#[0-9a-f]{6}$/i,u=()=>String(n.value??""),c=()=>n.value||[],_=k=>{n.value=k},h=()=>n.value??s.spec.default??!1,d=k=>{n.value=k===(s.spec.default??!1)?void 0:k},f=k=>k.target.value,b=k=>_(k.split(",").map(I=>I.trim()).filter(Boolean));return(k,I)=>(l(),i("div",Gr,[a("label",Jr,v(e.spec.label)+v(e.spec.required?" *":""),1),e.spec.boolean?(l(),i("label",Zr,[a("input",{type:"checkbox",checked:h(),onChange:I[0]||(I[0]=w=>d(w.target.checked))},null,40,Qr),J(" "+v(e.hint||e.spec.hint),1)])):e.spec.choices?(l(),i("select",{key:1,class:"input","aria-invalid":!!e.error,value:u(),onChange:I[1]||(I[1]=w=>_(f(w)))},[!e.spec.required&&!e.spec.choices.includes(u())?(l(),i("option",ti,"(default)")):S("",!0),u()&&!e.spec.choices.includes(u())?(l(),i("option",{key:1,value:u()},v(u()),9,si)):S("",!0),(l(!0),i(W,null,L(e.spec.choices,w=>(l(),i("option",{key:w,value:w},v(w),9,ni))),128))],40,ei)):e.spec.secret?(l(),i("input",{key:2,class:"input",type:"password",placeholder:"paste to replace",autocomplete:"off",onInput:I[2]||(I[2]=w=>o("secret",e.spec.key,f(w)))},null,32)):e.spec.colour?(l(),i("div",oi,[a("input",{class:"input field-row__colour",type:"color",value:r.test(u())?u():"#888888",onInput:I[3]||(I[3]=w=>_(f(w)))},null,40,ai),a("input",{class:"input",type:"text",placeholder:"#rrggbb",value:u(),onInput:I[4]||(I[4]=w=>_(f(w)))},null,40,li),a("button",{type:"button",class:"btn",onClick:I[5]||(I[5]=w=>_(""))},"None")])):e.spec.list?(l(),i("input",{key:4,class:"input",type:"text","aria-invalid":!!e.error,value:c().join(", "),onInput:I[6]||(I[6]=w=>b(f(w)))},null,40,ri)):(l(),i("input",{key:5,class:"input",type:"text","aria-invalid":!!e.error,placeholder:e.placeholder,value:u(),onInput:I[7]||(I[7]=w=>_(f(w)))},null,40,ii)),e.error?(l(),i("small",ci,v(e.error),1)):S("",!0),!e.spec.boolean&&(e.hint||e.spec.hint)?(l(),i("small",ui,v(e.hint||e.spec.hint),1)):S("",!0)]))}}),ue=K(di,[["__scopeId","data-v-33714840"]]),pi={class:"modal__card settings-sheet__card"},hi={class:"modal__head"},_i={class:"modal__meta"},fi={key:0,class:"settings-sheet__dirty"},vi={key:0,class:"settings-sheet__confirm",role:"alertdialog"},mi={class:"settings-sheet__confirm-text"},gi={key:1,class:"alert settings-sheet__alert",role:"alert"},yi={key:2,class:"alert settings-sheet__alert"},ki={key:3,class:"settings-sheet__body"},wi={class:"settings-sheet__list"},bi=["aria-current","onClick"],xi={class:"sheet-form"},$i={key:0,class:"empty"},Si={ref:"connectors-head",class:"sheet-form__heading"},Ci={class:"settings-sheet__connector-head"},Ri={class:"settings-sheet__connector-name"},Ti=["onClick"],Ai={class:"settings-sheet__actions"},Mi=["onClick"],Ei={key:0,class:"settings-sheet__rules"},zi={class:"settings-sheet__rule-when"},Ii={class:"settings-sheet__rule-then"},Oi={key:1,class:"empty"},Di=j({__name:"SettingsSheet",setup(e){const t=B([]),s=B(0),o=B([]),n=B({workspace:[],theme:[],rules:[],statuses:[]}),r=B(""),u=B([]),c=B({}),_=new Map,h=B({}),d=B({}),f=Ve("connectors-head"),b=new Map,k=B(0),I=B(""),w=B(null),y=B(""),g=x(()=>z.settings&&!y.value&&(k.value>0||$t(t.value)!==I.value)),$=R=>c.value[`workspaces[${s.value}].${R}`]||"",A=x(()=>{const R=D.value&&_.get(Re(D.value));return R&&D.value&&R!==D.value.id?`Its to-dos and marks stay under the old id "${R}"; they do not follow the rename.`:""}),P={key:"id",label:"Source id"},X={key:"label",label:"Label"},D=x(()=>t.value[s.value]),O=x(()=>(D.value&&h.value[D.value.id]||[]).map(Cn)),N=x(()=>D.value&&d.value[D.value.id]||[]),V=R=>o.value.find(E=>E.type===R.type)||{type:R.type,label:R.type,fields:[]},M=x(()=>t.value.map((R,E)=>({uid:Re(R),label:R.name||R.id||"Workspace "+(E+1)}))),F=x(()=>{var R;return(((R=D.value)==null?void 0:R.connectors)||[]).map(E=>({entry:E,uid:Re(E),spec:V(E)}))}),T=R=>{var C;const E=(C=m.workspaces.find(G=>G.id===R))==null?void 0:C.theme_seed;return E?`empty: ${E}, derived from the workspace id`:"empty derives one from the workspace id"},Z=(R,E)=>R[E],Ne=(R,E,C)=>{b.set(R,Object.assign(b.get(R)||{},{[E]:C})),k.value+=1},hs=(R,E,C)=>E==="id"?R.id=String(C??""):ce(R,E,C),_s=()=>{t.value.push(bt({id:"new-"+(t.value.length+1),name:"New workspace"})),s.value=t.value.length-1},fs=()=>{t.value.splice(s.value,1),s.value=Math.max(0,s.value-1)},vs=()=>{D.value&&(w.value={text:`Delete ${D.value.name||D.value.id}? Its to-dos and marks stay on disk.`,yes:"Delete",no:"Keep",run:fs})},ms=R=>{var E;return(E=D.value)==null?void 0:E.connectors.push({type:R.type})},gs=R=>{D.value&&(b.delete(D.value.connectors[R]),D.value.connectors.splice(R,1))},ys=R=>{if(!D.value)return;const E=V(D.value.connectors[R]).label;w.value={text:`Remove the ${E} source from ${D.value.name||D.value.id}?`,yes:"Remove",no:"Keep",run:()=>gs(R)}},ks=()=>We("/api/config").then(R=>{y.value="",t.value=(R.workspaces||[]).map(bt),o.value=R.connectors||[],n.value=R.fields,b.clear(),k.value=0,w.value=null,s.value=Math.max(0,t.value.findIndex(E=>E.id===m.workspace.id)),r.value=R.config_file||"",u.value=R.problems||[],c.value={},_.clear(),t.value.forEach(E=>_.set(Re(E),E.id)),h.value=R.tables||{},d.value=R.table_warnings||{},I.value=$t(t.value)}).catch(()=>{y.value=Oe+"; settings cannot be loaded."}).then(ye).then(()=>{var R;z.settingsAt==="connectors"&&((R=f.value)==null||R.scrollIntoView({block:"start"})),z.settingsAt=""}),je=()=>{z.settings=!1},_t=()=>{w.value={text:"Discard changes?",yes:"Discard",no:"Keep editing",run:je}},ft=()=>g.value?_t():je(),vt=R=>{const E=w.value;w.value=null,R&&(E==null||E.run())},ws=async()=>{try{const R=await ie("/api/config",{workspaces:t.value.map(E=>pn(E)),secrets:_n(t.value,b)});if(R.error){const E=Zs(R.error);c.value=Object.fromEntries(E.filter(C=>C.field!=="workspaces").map(C=>[C.field,C.description])),u.value=E.length?E.filter(C=>C.field==="workspaces").map(C=>C.description):jt(R.error),E.length&&!u.value.length&&(u.value=["Fix the marked fields; nothing was saved."]);return}je(),ts()}catch(R){u.value=[re(R,{unreachable:Oe+"; your changes are kept, save again."})]}};return Q(g,R=>{z.settingsDirty=R},{immediate:!0}),Q(()=>z.settingsAsk,R=>{R&&(z.settingsAsk=!1,_t())}),Q(()=>z.settings,R=>{R&&ks()}),(R,E)=>p(z).settings?(l(),i("div",{key:0,class:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:ee(ft,["self"])},[a("div",pi,[a("div",hi,[E[2]||(E[2]=a("h3",{id:"settings-title",class:"modal__title"},"Settings",-1)),a("span",_i,v(r.value),1),g.value?(l(),i("span",fi,"Unsaved changes")):S("",!0),y.value?S("",!0):(l(),i("button",{key:1,type:"button",class:"btn btn--tonal",onClick:ws},"Save")),a("button",{type:"button",class:"btn",onClick:ft},"Close")]),w.value?(l(),i("div",vi,[a("span",mi,v(w.value.text),1),a("button",{type:"button",class:"btn btn--danger",onClick:E[0]||(E[0]=C=>vt(!0))},v(w.value.yes),1),a("button",{type:"button",class:"btn",onClick:E[1]||(E[1]=C=>vt(!1))},v(w.value.no),1)])):S("",!0),y.value?(l(),i("div",gi,v(y.value),1)):u.value.length?(l(),i("div",yi,v(u.value.join(" · ")),1)):S("",!0),y.value?S("",!0):(l(),i("div",ki,[a("ul",wi,[(l(!0),i(W,null,L(M.value,(C,G)=>(l(),i("li",{key:C.uid},[a("button",{type:"button",class:"settings-sheet__workspace","aria-current":G===s.value,onClick:$e=>s.value=G},v(C.label),9,bi)]))),128)),a("li",null,[a("button",{type:"button",class:"settings-sheet__workspace settings-sheet__workspace--add",onClick:_s}," + Add workspace ")])]),a("div",xi,[D.value?(l(),i(W,{key:1},[E[3]||(E[3]=a("h4",{class:"sheet-form__heading"},"Workspace",-1)),(l(!0),i(W,null,L(n.value.workspace,C=>(l(),Y(ue,{key:C.key,spec:C,hint:C.key==="id"?A.value:"",error:$(C.key),"model-value":Z(D.value,C.key),"onUpdate:modelValue":G=>hs(D.value,C.key,G)},null,8,["spec","hint","error","model-value","onUpdate:modelValue"]))),128)),E[4]||(E[4]=a("h4",{class:"sheet-form__heading"},"Theme",-1)),(l(!0),i(W,null,L(n.value.theme,C=>{var G;return l(),Y(ue,{key:C.key,spec:C,hint:C.key==="seed"&&!((G=D.value.theme)!=null&&G.seed)?T(D.value.id):"","model-value":Z(D.value.theme,C.key),"onUpdate:modelValue":$e=>p(ce)(D.value.theme,C.key,$e)},null,8,["spec","hint","model-value","onUpdate:modelValue"])}),128)),a("h4",Si,"Sources",512),(l(!0),i(W,null,L(F.value,({entry:C,spec:G,uid:$e},mt)=>(l(),i("div",{key:$e,class:"settings-sheet__connector"},[a("div",Ci,[a("strong",Ri,v(G.label),1),a("button",{type:"button",class:"btn btn--danger",onClick:se=>ys(mt)}," Remove ",8,Ti)]),U(ue,{spec:P,placeholder:G.type,hint:"only needed when one type appears twice","model-value":Z(C,"id"),"onUpdate:modelValue":se=>p(ce)(C,"id",se)},null,8,["placeholder","model-value","onUpdate:modelValue"]),U(ue,{spec:X,placeholder:G.label,hint:"its name in the feed","model-value":Z(C,"label"),"onUpdate:modelValue":se=>p(ce)(C,"label",se)},null,8,["placeholder","model-value","onUpdate:modelValue"]),(l(!0),i(W,null,L(G.fields,se=>(l(),Y(ue,{key:se.key,spec:se,error:$("connectors["+mt+"]."+se.key),"model-value":Z(C,se.key),"onUpdate:modelValue":Le=>p(ce)(C,se.key,Le),onSecret:(Le,bs)=>Ne(C,Le,bs)},null,8,["spec","error","model-value","onUpdate:modelValue","onSecret"]))),128))]))),128)),a("div",Ai,[(l(!0),i(W,null,L(o.value,C=>(l(),i("button",{key:C.type,type:"button",class:"btn",onClick:G=>ms(C)}," + Add "+v(C.label)+" source ",9,Mi))),128))]),E[5]||(E[5]=a("h4",{class:"sheet-form__heading"},"Rules",-1)),(l(!0),i(W,null,L(n.value.rules,C=>(l(),Y(ue,{key:C.key,spec:C,error:$("rules."+C.key),"model-value":Z(D.value.rules,C.key),"onUpdate:modelValue":G=>p(ce)(D.value.rules,C.key,G)},null,8,["spec","error","model-value","onUpdate:modelValue"]))),128)),(l(!0),i(W,null,L(n.value.statuses,C=>(l(),Y(ue,{key:C.key,spec:C,"model-value":Z(D.value.rules.statuses,C.key),"onUpdate:modelValue":G=>p(ce)(D.value.rules.statuses,C.key,G)},null,8,["spec","model-value","onUpdate:modelValue"]))),128)),E[6]||(E[6]=a("h4",{class:"sheet-form__heading"},"Whose turn table",-1)),E[7]||(E[7]=a("p",{class:"settings-sheet__rules-note"}," The rows in force, top to bottom: the first one that fits decides. Read-only here: ask Claude to change them. ",-1)),(l(!0),i(W,null,L(N.value,C=>(l(),i("p",{key:C,class:"settings-sheet__rules-warning"},v(C),1))),128)),O.value.length?(l(),i("ol",Ei,[(l(!0),i(W,null,L(O.value,(C,G)=>(l(),i("li",{key:G,class:"settings-sheet__rule"},[a("span",zi,v(C.when),1),a("span",Ii,v(C.then),1)]))),128))])):(l(),i("p",Oi,"Save the workspace to see its rows.")),a("div",{class:"settings-sheet__actions"},[a("button",{type:"button",class:"btn btn--danger",onClick:vs}," Delete workspace ")])],64)):(l(),i("p",$i,"No workspaces yet. Add one on the left."))])]))])])):S("",!0)}}),Pi=K(Di,[["__scopeId","data-v-649d0735"]]),Bi={class:"app__shell"},Ui=["inert"],Vi={id:"wt",class:"dashboard dashboard--fit"},Hi=["inert"],Wi={class:"dashboard__main"},Fi=j({__name:"App",setup(e){const t=x(()=>!!m.workspace.id&&!m.workspace.connectors.length),{size:s}=dt(()=>`${m.workspace.id}:feed`),o=x(()=>s.value===null?void 0:{"--feed-width":s.value+"px"}),n=x(()=>es.value!==null);Xn(n),Gn(n),Q(Ke,cn,{flush:"post"});const r={light:{fill:"#d8e2ff",ink:"#001a41",dot:"#2c5697"},dark:{fill:"#2b4678",ink:"#d8e2ff",dot:"#adc6ff"}},u=x(()=>{const{id:c,name:_}=m.workspace;if(!c)return null;const h=Ke.value,d=r[He.value?"dark":"light"],f={fill:h["--md-primary-container"]||d.fill,ink:h["--md-on-primary-container"]||d.ink,dot:h["--md-primary"]||d.dot};return"data:image/svg+xml,"+encodeURIComponent(Ln(os({id:c,name:_},lt),f))});return Ws(u),rt("Escape",zn,{target:document}),at(()=>{En()}),(c,_)=>(l(),i("div",{class:"app",style:Ee(p(Ke))},[U(ho,{inert:n.value,onSettings:_[0]||(_[0]=h=>p(z).settings=!0)},null,8,["inert"]),a("div",Bi,[U(Uo,{inert:n.value,onReport:_[1]||(_[1]=h=>p(z).feedback=!0)},null,8,["inert"]),p(Ct).length?(l(),i("div",{key:0,class:"alert",inert:n.value},[J(v(p(Ct).join(" · "))+" ",1),a("button",{type:"button",class:"alert__action",onClick:_[2]||(_[2]=h=>p(Qt)())},"Open Settings")],8,Ui)):S("",!0),a("div",Vi,[_[4]||(_[4]=a("canvas",{id:"backdrop",class:"dashboard__backdrop","aria-hidden":"true"},null,-1)),U(oa,{inert:n.value},null,8,["inert"]),t.value?(l(),Y(yr,{key:0,inert:n.value},null,8,["inert"])):(l(),i("div",{key:1,class:"dashboard__layout",style:Ee(o.value),inert:n.value},[a("div",Wi,[U(tl,{class:"dashboard__move"}),U(vl,{class:"dashboard__todo"}),U(Tl,{class:"dashboard__waiting"})]),U(fr,{class:"dashboard__feed",onOpen:_[3]||(_[3]=h=>p(z).modal=h)})],12,Hi)),U(Xr),U(Pi),U(zr)])])],4))}}),qi=K(Fi,[["__scopeId","data-v-6bc064de"]]);Rs(qi).mount("#app");Bn();un();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.report-page[data-v-16ea9dee]{box-sizing:border-box;height:auto;max-width:720px;margin:40px auto;padding:28px 32px;border:1px solid var(--md-outline-variant);border-radius:16px;background:var(--md-surface);color:var(--md-on-surface);font-family:var(--md-font);font-size:14px;line-height:1.5}.report-page__note[data-v-16ea9dee]{margin:0;font-size:15px}.report-page__back[data-v-16ea9dee]{display:inline-block;margin-top:24px;color:var(--md-primary)}.report-page__head[data-v-16ea9dee]{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.report-page__title[data-v-16ea9dee]{flex:1;min-width:0;margin:0;font-size:20px;font-weight:600}.report-page__id[data-v-16ea9dee]{color:var(--md-primary);font-weight:700}.report-page__meta[data-v-16ea9dee]{margin:6px 0 20px;color:var(--md-on-surface-variant);font-size:13px}.report-page__heading[data-v-16ea9dee]{margin:18px 0 8px;color:var(--md-on-surface-variant);font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}.report-page__text[data-v-16ea9dee]{margin:0;white-space:pre-wrap}.report-page__answer[data-v-16ea9dee]{padding:10px 0;border-top:1px solid var(--md-outline-variant)}.report-page__answer-meta[data-v-16ea9dee]{margin:0 0 4px;color:var(--md-on-surface-variant);font-size:12px}.report-page__unanswered[data-v-16ea9dee]{margin:0;padding:10px 12px;border-radius:8px;background:var(--md-error-container);color:var(--md-on-error-container);font-weight:600}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as v,l as w,o as s,b as o,i as a,F as c,h as t,g as f,u as p,m as u,j as h,e as k,k as g,_ as y,J as x}from"./_plugin-vue_export-helper-BxUUR8De.js";import{g as N,S as b,m as R,t as C,j as d}from"./bem-HybmjowO.js";const B={class:"app report-page"},S={key:0,class:"report-page__note"},T={class:"report-page__head"},V={class:"report-page__id"},E={class:"report-page__title"},L={class:"report-page__meta"},P={class:"report-page__section"},W={class:"report-page__text"},j={class:"report-page__section"},A={key:0,class:"report-page__unanswered"},D={key:1,class:"empty"},F={class:"report-page__answer-meta"},I={class:"report-page__text"},J=v({__name:"ReportPage",setup(z){const n=new URLSearchParams(location.search).get("id")||"",e=g(null),i=g(n?"Loading…":"No report id in the link.");return w(()=>{n&&(document.title=n+" · Your report · Whose Turn",N("/api/feedback?id="+encodeURIComponent(n)).then(l=>{e.value=l.report||null,i.value=l.report?"":"No report "+n+" was filed from this machine."}).catch(()=>{i.value=b+"; reload this page once it is back."}))}),(l,r)=>(s(),o("main",B,[e.value?(s(),o(c,{key:1},[t("header",T,[t("span",V,a(e.value.id),1),t("h1",E,a(e.value.title),1),t("span",{class:f(["pill",p(R)("pill",p(C)(e.value.outcome))])},a(e.value.state||"filed, not yet seen"),3)]),t("p",L,[u(a(e.value.kind||"report")+" · filed "+a(p(d)(e.value.filed_at)),1),e.value.changed_at?(s(),o(c,{key:0},[u(" · last change "+a(p(d)(e.value.changed_at)),1)],64)):h("",!0)]),t("section",P,[r[0]||(r[0]=t("h2",{class:"report-page__heading"},"What you reported",-1)),t("p",W,a(e.value.body||"(no text kept)"),1)]),t("section",j,[r[1]||(r[1]=t("h2",{class:"report-page__heading"},"Answers",-1)),e.value.unanswered?(s(),o("p",A," Closed without an answer. The maintainer owes you a reason; this page will show it once it is written. ")):e.value.answers.length?h("",!0):(s(),o("p",D,"No answer yet.")),(s(!0),o(c,null,k(e.value.answers,(_,m)=>(s(),o("article",{key:m,class:"report-page__answer"},[t("p",F,a(_.by||"maintainer")+" · "+a(p(d)(_.at)),1),t("p",I,a(_.text),1)]))),128))])],64)):(s(),o("p",S,a(i.value),1)),r[2]||(r[2]=t("a",{class:"report-page__back",href:"/"},"Back to the window",-1))]))}}),U=y(J,[["__scopeId","data-v-16ea9dee"]]);x(U).mount("#app");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as P,L as J,a as Y,M as _,N as we,O as xe,P as He,k as _e,n as ke,Q as ne,R as Se,S as Ne,T as Le,l as We,U as Pe,D as $e,I as Ce,c as x,u as Ie,r as pe}from"./_plugin-vue_export-helper-BxUUR8De.js";function z(e,t){return Le()?(Pe(e,t),!0):!1}const Z=new WeakMap,ze=(...e)=>{var t;const a=e[0],n=(t=ne())===null||t===void 0?void 0:t.proxy,i=n??Le();if(i==null&&!Se())throw new Error("injectLocal must be called in setup");return i&&Z.has(i)&&a in Z.get(i)?Z.get(i)[a]:Ne(...e)},B=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Fe=e=>e!=null,Be=Object.prototype.toString,qe=e=>Be.call(e)==="[object Object]",A=()=>{};function ie(...e){if(e.length!==1)return xe(...e);const t=e[0];return typeof t=="function"?He(we(()=>({get:t,set:A}))):_e(t)}function oe(e,t){function a(...n){return new Promise((i,o)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(i).catch(o)})}return"cancel"in e&&Object.assign(a,{cancel:e.cancel,flush:e.flush,isPending:e.isPending}),a}const Ee=e=>e();function Ve(e,t={}){let a,n,i=A,o=A;const s=_(!1),r=c=>{clearTimeout(c),i(),i=A};let l;return Object.assign(c=>{const u=Y(e),d=Y(t.maxWait);return a&&r(a),u<=0||d!==void 0&&d<=0?(n&&(r(n),n=void 0),s.value=!1,Promise.resolve(c())):(s.value=!0,new Promise((g,p)=>{i=t.rejectOnCancel?p:g,o=g,l=c,d&&!n&&(n=setTimeout(()=>{a&&r(a),n=void 0,s.value=!1,g(l())},d)),a=setTimeout(()=>{n&&r(n),n=void 0,s.value=!1,g(c())},u)}))},{cancel:()=>{a&&(r(a),a=void 0),n&&(r(n),n=void 0),s.value=!1,o=A},flush:()=>{if(s.value){a&&(clearTimeout(a),a=void 0),n&&(clearTimeout(n),n=void 0),s.value=!1;const c=o;i=A,o=A,c(l())}},isPending:J(s)})}function Je(...e){let t=0,a,n=!0,i=A,o,s,r,l,h;!$e(e[0])&&typeof e[0]=="object"?{delay:s,trailing:r=!0,leading:l=!0,rejectOnCancel:h=!1}=e[0]:[s,r=!0,l=!0,h=!1]=e;const c=()=>{a&&(clearTimeout(a),a=void 0,i(),i=A)};return d=>{const g=Y(s),p=Date.now()-t,b=()=>o=d();return c(),g<=0?(t=Date.now(),b()):(p>g?(t=Date.now(),(l||!n)&&b()):r&&(o=new Promise((v,R)=>{i=h?R:v,a=setTimeout(()=>{t=Date.now(),n=!0,v(b()),c()},Math.max(0,g-p))})),!l&&!a&&(a=setTimeout(()=>n=!0,g)),n=!1,o)}}function Ke(e=Ee,t={}){const{initialState:a="active"}=t,n=ie(a==="active");function i(){n.value=!1}function o(){n.value=!0}const s=(...r)=>{n.value&&e(...r)};return{isActive:J(n),pause:i,resume:o,eventFilter:s}}function fe(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function V(e){return Array.isArray(e)?e:[e]}function Ue(e){return ne()}function ea(e,t=1e4){return we((a,n)=>{let i=Y(e),o;const s=()=>setTimeout(()=>{i=Y(e),n()},Y(t));return z(()=>{clearTimeout(o)}),{get(){return a(),i},set(r){i=r,n(),clearTimeout(o),o=s()}}})}function Ge(e,t=200,a={}){return oe(Ve(t,a),e)}function Qe(e,t=200,a=!0,n=!0,i=!1){return oe(Je(t,a,n,i),e)}function Ze(e,t,a={}){const{eventFilter:n=Ee,...i}=a;return P(e,oe(n,t),i)}function et(e,t,a={}){const{eventFilter:n,initialState:i="active",...o}=a,{eventFilter:s,pause:r,resume:l,isActive:h}=Ke(n,{initialState:i});return{stop:Ze(e,t,{...o,eventFilter:s}),pause:r,resume:l,isActive:h}}function se(e,t=!0,a){Ue()?We(e,a):t?e():ke(e)}function ta(e,t=1e3,a={}){const{immediate:n=!0,immediateCallback:i=!1}=a;let o=null;const s=_(!1);function r(){o&&(clearInterval(o),o=null)}function l(){s.value=!1,r()}function h(){const c=Y(t);c<=0||(s.value=!0,i&&e(),r(),s.value&&(o=setInterval(e,c)))}return n&&B&&h(),($e(t)||typeof t=="function")&&z(P(t,()=>{s.value&&B&&h()})),z(l),{isActive:J(s),pause:l,resume:h}}function aa(e,t,a={}){const{immediate:n=!0,immediateCallback:i=!1}=a,o=_(!1);let s;function r(){s&&(clearTimeout(s),s=void 0)}function l(){o.value=!1,r()}function h(...c){i&&e(),r(),o.value=!0,s=setTimeout(()=>{o.value=!1,s=void 0,e(...c)},Y(t))}return n&&(o.value=!0,B&&h()),z(l),{isPending:J(o),start:h,stop:l}}function tt(e,t,a){return P(e,t,{...a,immediate:!0})}const $=B?window:void 0,at=B?window.document:void 0;function N(e){var t;const a=Y(e);return(t=a==null?void 0:a.$el)!==null&&t!==void 0?t:a}function q(...e){const t=(n,i,o,s)=>(n.addEventListener(i,o,s),()=>n.removeEventListener(i,o,s)),a=x(()=>{const n=V(Y(e[0])).filter(i=>i!=null);return n.every(i=>typeof i!="string")?n:void 0});return tt(()=>{var n,i;return[(n=(i=a.value)===null||i===void 0?void 0:i.map(o=>N(o)))!==null&&n!==void 0?n:[$].filter(o=>o!=null),V(Y(a.value?e[1]:e[0])),V(Ie(a.value?e[2]:e[1])),Y(a.value?e[3]:e[2])]},([n,i,o,s],r,l)=>{if(!(n!=null&&n.length)||!(i!=null&&i.length)||!(o!=null&&o.length))return;const h=qe(s)?{...s}:s,c=n.flatMap(u=>i.flatMap(d=>o.map(g=>t(u,d,g,h))));l(()=>{c.forEach(u=>u())})},{flush:"post"})}function nt(){const e=_(!1),t=ne();return t&&We(()=>{e.value=!0},t),e}function re(e){const t=nt();return x(()=>(t.value,!!e()))}function it(e,t,a={}){const{window:n=$,...i}=a;let o;const s=re(()=>n&&"MutationObserver"in n),r=()=>{o&&(o.disconnect(),o=void 0)},l=x(()=>{const d=Y(e),g=V(d).map(N).filter(Fe);return new Set(g)}),h=P(l,d=>{r(),s.value&&d.size&&(o=new MutationObserver(t),d.forEach(g=>o.observe(g,i)))},{immediate:!0,flush:"post"}),c=()=>o==null?void 0:o.takeRecords(),u=()=>{h(),r()};return z(u),{isSupported:s,stop:u,takeRecords:c}}function ot(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function na(...e){let t,a,n={};e.length===3?(t=e[0],a=e[1],n=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,a=e[0],n=e[1]):(t=e[0],a=e[1]):(t=!0,a=e[0]);const{target:i=$,eventName:o="keydown",passive:s=!1,dedupe:r=!1}=n,l=ot(t);return q(i,o,c=>{c.repeat&&Y(r)||l(c)&&a(c)},s)}function st(e,t={}){const{immediate:a=!0,fpsLimit:n=null,window:i=$,once:o=!1}=t,s=_(!1),r=x(()=>{const g=Y(n);return g?1e3/g:null});let l=0,h=null;function c(g){if(!s.value||!i)return;l||(l=g);const p=g-l;if(r.value&&p<r.value){h=i.requestAnimationFrame(c);return}if(l=g,e({delta:p,timestamp:g}),o){s.value=!1,h=null;return}h=i.requestAnimationFrame(c)}function u(){!s.value&&i&&(s.value=!0,l=0,h=i.requestAnimationFrame(c))}function d(){s.value=!1,h!=null&&i&&(i.cancelAnimationFrame(h),h=null)}return a&&u(),z(d),{isActive:J(s),pause:d,resume:u}}const rt=Symbol("vueuse-ssr-width");function lt(){const e=Se()?ze(rt,null):null;return typeof e=="number"?e:void 0}function dt(e,t={}){const{window:a=$,ssrWidth:n=lt()}=t,i=re(()=>a&&"matchMedia"in a&&typeof a.matchMedia=="function"),o=_(typeof n=="number"),s=_(),r=_(!1),l=h=>{r.value=h.matches};return Ce(()=>{if(o.value){o.value=!i.value;const h=Y(e).split(",");r.value=h.some(c=>{const u=c.includes("not all"),d=c.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),g=c.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let p=!!(d||g);return d&&p&&(p=n>=fe(d[1])),g&&p&&(p=n<=fe(g[1])),u?!p:p});return}i.value&&(s.value=a.matchMedia(Y(e)),r.value=s.value.matches)}),q(s,"change",l,{passive:!0}),x(()=>r.value)}const K=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},U="__vueuse_ssr_handlers__",ut=ct();function ct(){return U in K||(K[U]=K[U]||{}),K[U]}function ht(e,t){return ut[e]||t}function gt(e){return dt("(prefers-color-scheme: dark)",e)}function pt(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const ft={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},be="vueuse-storage";function je(e,t,a,n={}){var i;const{flush:o="pre",deep:s=!0,listenToStorageChanges:r=!0,writeDefaults:l=!0,mergeDefaults:h=!1,shallow:c,window:u=$,eventFilter:d,onError:g=f=>{console.error(f)},initOnMounted:p}=n,b=(c?_:_e)(typeof t=="function"?t():t),v=x(()=>Y(e));if(!a)try{a=ht("getDefaultStorage",()=>$==null?void 0:$.localStorage)()}catch(f){g(f)}if(!a)return b;const R=Y(t),w=pt(R),X=(i=n.serializer)!==null&&i!==void 0?i:ft[w],{pause:k,resume:H}=et(b,f=>T(f),{flush:o,deep:s,eventFilter:d});P(v,()=>D(),{flush:o});let W=!1;const E=f=>{p&&!W||D(f)},j=f=>{p&&!W||C(f)};u&&r&&(a instanceof Storage?q(u,"storage",E,{passive:!0}):q(u,be,j)),p?se(()=>{W=!0,D()}):D();function y(f,m){if(u){const S={key:v.value,oldValue:f,newValue:m,storageArea:a};u.dispatchEvent(a instanceof Storage?new StorageEvent("storage",S):new CustomEvent(be,{detail:S}))}}function T(f){try{const m=a.getItem(v.value);if(f==null)y(m,null),a.removeItem(v.value);else{const S=X.write(f);m!==S&&(a.setItem(v.value,S),y(m,S))}}catch(m){g(m)}}function L(f){const m=f?f.newValue:a.getItem(v.value);if(m==null)return l&&R!=null&&a.setItem(v.value,X.write(R)),R;if(!f&&h){const S=X.read(m);return typeof h=="function"?h(S,R):w==="object"&&!Array.isArray(S)?{...R,...S}:S}else return typeof m!="string"?m:X.read(m)}function D(f){if(!(f&&f.storageArea!==a)){if(f&&f.key==null){b.value=R;return}if(!(f&&f.key!==v.value)){k();try{const m=X.write(b.value);(f===void 0||(f==null?void 0:f.newValue)!==m)&&(b.value=L(f))}catch(m){g(m)}finally{f?ke(H):H()}}}}function C(f){D(f.detail)}return b}function bt(e,t,a={}){const{window:n=$,...i}=a;let o;const s=re(()=>n&&"ResizeObserver"in n),r=()=>{o&&(o.disconnect(),o=void 0)},l=x(()=>{const u=Y(e);return Array.isArray(u)?u.map(d=>N(d)):[N(u)]}),h=P(l,u=>{if(r(),s.value&&n){o=new ResizeObserver(t);for(const d of u)d instanceof Element&&o.observe(d,i)}},{immediate:!0,flush:"post"}),c=()=>{r(),h()};return z(c),{isSupported:s,stop:c}}function ia(e,t={width:0,height:0},a={}){const{window:n=$,box:i="content-box"}=a,o=x(()=>{var u;return(u=N(e))===null||u===void 0||(u=u.namespaceURI)===null||u===void 0?void 0:u.includes("svg")}),s=_(t.width),r=_(t.height),{stop:l}=bt(e,([u])=>{const d=i==="border-box"?u.borderBoxSize:i==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(n&&o.value){const g=N(e);if(g){const p=g.getBoundingClientRect();s.value=p.width,r.value=p.height}}else if(d){const g=V(d);s.value=g.reduce((p,{inlineSize:b})=>p+b,0),r.value=g.reduce((p,{blockSize:b})=>p+b,0)}else s.value=u.contentRect.width,r.value=u.contentRect.height},a);se(()=>{const u=N(e);if(u&&"offsetWidth"in u)if(i==="content-box"&&n){const d=n.getComputedStyle(u),g=Number.parseFloat(d.paddingLeft)+Number.parseFloat(d.paddingRight),p=Number.parseFloat(d.paddingTop)+Number.parseFloat(d.paddingBottom),b=Number.parseFloat(d.borderLeftWidth)+Number.parseFloat(d.borderRightWidth),v=Number.parseFloat(d.borderTopWidth)+Number.parseFloat(d.borderBottomWidth);s.value=u.offsetWidth-g-b,r.value=u.offsetHeight-p-v}else s.value=u.offsetWidth,r.value=u.offsetHeight;else u&&(s.value=t.width,r.value=t.height)});const h=P(()=>N(e),u=>{s.value=u?t.width:0,r.value=u?t.height:0});function c(){l(),h()}return{width:s,height:r,stop:c}}function yt(e){return e===!0?{}:e}const mt="message";function oa(e,t=[],a={}){const n=_(null),i=_(null),o=_("CONNECTING"),s=_(null),r=_(null),l=ie(e),h=_(null);let c=!1,u=0;const{withCredentials:d=!1,immediate:g=!0,autoConnect:p=!0,autoReconnect:b,serializer:v={read:k=>k}}=a,R=()=>{B&&s.value&&(s.value.close(),s.value=null,o.value="CLOSED",c=!0)},w=()=>{if(c||typeof l.value>"u")return;const k=new EventSource(l.value,{withCredentials:d});o.value="CONNECTING",s.value=k,k.onopen=()=>{o.value="OPEN",r.value=null},k.onerror=H=>{if(o.value="CLOSED",r.value=H,k.readyState===2&&!c&&b){k.close();const{retries:W=-1,delay:E=1e3,onFailed:j}=yt(b);u+=1,typeof W=="number"&&(W<0||u<W)||typeof W=="function"&&W()?setTimeout(w,E):j==null||j()}},t=t.length>0?t:[mt];for(const H of t)q(k,H,W=>{var E,j;n.value=H,i.value=(E=v.read(W.data))!==null&&E!==void 0?E:null,h.value=(j=W.lastEventId)!==null&&j!==void 0?j:null},{passive:!0})},X=()=>{B&&(R(),c=!1,u=0,w())};return g&&X(),p&&P(l,X),z(R),{eventSource:s,event:n,data:i,status:o,error:r,open:X,close:R,lastEventId:h}}function sa(e=null,t={}){const{baseUrl:a="",rel:n="icon",document:i=at}=t,o=ie(e),s=r=>{const l=i==null?void 0:i.head.querySelectorAll(`link[rel*="${n}"]`);if(!l||l.length===0){const h=i==null?void 0:i.createElement("link");h&&(h.rel=n,h.href=`${a}${r}`,h.type=`image/${r.split(".").pop()}`,i==null||i.head.append(h));return}l==null||l.forEach(h=>h.href=`${a}${r}`)};return P(o,(r,l)=>{typeof r=="string"&&r!==l&&s(r)},{immediate:!0}),o}const ye=1;function ra(e,t={}){const{throttle:a=0,idle:n=200,onStop:i=A,onScroll:o=A,offset:s={left:0,right:0,top:0,bottom:0},observe:r={mutation:!1},eventListenerOptions:l={capture:!1,passive:!0},behavior:h="auto",window:c=$,onError:u=y=>{console.error(y)}}=t,d=typeof r=="boolean"?{mutation:r}:r,g=_(0),p=_(0),b=x({get(){return g.value},set(y){R(y,void 0)}}),v=x({get(){return p.value},set(y){R(void 0,y)}});function R(y,T){var L,D,C,f;if(!c)return;const m=Y(e);if(!m)return;(L=m instanceof Document?c.document.body:m)===null||L===void 0||L.scrollTo({top:(D=Y(T))!==null&&D!==void 0?D:v.value,left:(C=Y(y))!==null&&C!==void 0?C:b.value,behavior:Y(h)});const S=(m==null||(f=m.document)===null||f===void 0?void 0:f.documentElement)||(m==null?void 0:m.documentElement)||m;b!=null&&(g.value=S.scrollLeft),v!=null&&(p.value=S.scrollTop)}const w=_(!1),X=pe({left:!0,right:!1,top:!0,bottom:!1}),k=pe({left:!1,right:!1,top:!1,bottom:!1}),H=y=>{w.value&&(w.value=!1,k.left=!1,k.right=!1,k.top=!1,k.bottom=!1,i(y))},W=Ge(H,a+n),E=y=>{var T;if(!c)return;const L=(y==null||(T=y.document)===null||T===void 0?void 0:T.documentElement)||(y==null?void 0:y.documentElement)||N(y),{display:D,flexDirection:C,direction:f}=c.getComputedStyle(L),m=f==="rtl"?-1:1,S=L.scrollLeft;k.left=S<g.value,k.right=S>g.value;const ue=Math.abs(S*m)<=(s.left||0),ce=Math.abs(S*m)+L.clientWidth>=L.scrollWidth-(s.right||0)-ye;D==="flex"&&C==="row-reverse"?(X.left=ce,X.right=ue):(X.left=ue,X.right=ce),g.value=S;let F=L.scrollTop;y===c.document&&!F&&(F=c.document.body.scrollTop),k.top=F<p.value,k.bottom=F>p.value;const he=Math.abs(F)<=(s.top||0),ge=Math.abs(F)+L.clientHeight>=L.scrollHeight-(s.bottom||0)-ye;D==="flex"&&C==="column-reverse"?(X.top=ge,X.bottom=he):(X.top=he,X.bottom=ge),p.value=F},j=y=>{var T;if(!c)return;const L=(T=y.target.documentElement)!==null&&T!==void 0?T:y.target;E(L),w.value=!0,W(y),o(y)};return q(e,"scroll",a?Qe(j,a,!0,!1):j,l),se(()=>{try{const y=Y(e);if(!y)return;E(y)}catch(y){u(y)}}),d!=null&&d.mutation&&e!=null&&e!==c&&e!==document&&it(e,()=>{const y=Y(e);y&&E(y)},{attributes:!0,childList:!0,subtree:!0}),q(e,"scrollend",H,l),{x:b,y:v,isScrolling:w,arrivedState:X,directions:k,measure(){const y=Y(e);c&&y&&E(y)}}}function la(e,t,a={}){const{window:n=$}=a;return je(e,t,n==null?void 0:n.localStorage,a)}function da(e={}){const{controls:t=!1,scheduler:a=st}=e,n=_(new Date),o=a(()=>n.value=new Date);return t?{now:n,...o}:n}function ua(e,t,a={}){const{window:n=$}=a;return je(e,t,n==null?void 0:n.sessionStorage,a)}const vt=e=>{let t=e>>>0;return()=>{t=t+1831565813>>>0;let a=t;return a=Math.imul(a^a>>>15,a|1),a^=a+Math.imul(a^a>>>7,a|61),((a^a>>>14)>>>0)/4294967296}},ca=e=>{const t=vt(e),a=(n,i)=>n+(i-n)*t();return{next:t,range:a,int:(n,i)=>Math.floor(a(n,i+1)),chance:n=>t()<n,vary:(n,i=.12)=>n*a(1-i,1+i)}},De=(e,t=0,a=1)=>Math.min(a,Math.max(t,e)),Te=(e,t,a)=>e+(t-e)*a,G=/\s*(?:(\d+\.?\d*(?:e[+-]?\d+)?|\.\d+)|([A-Za-z_]\w*)|(<=|>=|==|!=|[-+*/%<>(),[\]]))/iy,Yt=e=>{const t=e.trim(),a=[];for(G.lastIndex=0;G.lastIndex<t.length;){const n=G.exec(t);if(!n)throw new Error(`cannot read "${t.slice(G.lastIndex).trim()}" in expression "${t}"`);a.push(n[1]!==void 0?{number:Number(n[1])}:n[2]!==void 0?{name:n[2]}:{op:n[3]})}return a},ee={"<":[1,(e,t)=>e<t],">":[1,(e,t)=>e>t],"<=":[1,(e,t)=>e<=t],">=":[1,(e,t)=>e>=t],"==":[1,(e,t)=>e===t],"!=":[1,(e,t)=>e!==t],"+":[2,(e,t)=>e+t],"-":[2,(e,t)=>e-t],"*":[3,(e,t)=>e*t],"/":[3,(e,t)=>e/t],"%":[3,(e,t)=>e%t]},Rt={range:(e,t,a)=>e.random.range(t,a),int:(e,t,a)=>e.random.int(t,a),chance:(e,t)=>e.random.chance(t),vary:(e,t,a)=>e.random.vary(t,a),cos:(e,t)=>Math.cos(t),sin:(e,t)=>Math.sin(t),sqrt:(e,t)=>Math.sqrt(t),abs:(e,t)=>Math.abs(t),hypot:(e,...t)=>Math.hypot(...t),min:(e,...t)=>Math.min(...t),max:(e,...t)=>Math.max(...t),lerp:(e,t,a,n)=>Te(t,a,n),clamp:(e,t,a,n)=>De(t,a,n),len:(e,t)=>t.length},me=new Map,Xt=e=>{const t=me.get(e);if(t)return t;const a=Yt(e);let n=0;const i=()=>a[n],o=()=>a[n++],s=d=>{const g=o();if(!g||g.op!==d)throw new Error(`expected "${d}" in expression "${e}"`)},r=()=>{const d=[];if(i()&&i().op===")")return o(),d;do d.push(c(0));while(i()&&i().op===","&&o());return s(")"),d},l=()=>{const d=o();if(!d)throw new Error(`expression "${e}" ends early`);const g=d.number;if(g!==void 0)return()=>g;if(d.op==="-"){const p=h();return(b,v)=>-p(b,v)}if(d.op==="("){const p=c(0);return s(")"),p}if(d.name!==void 0){const p=d.name;if(i()&&i().op==="("){o();const b=r();if(p==="if")return(R,w)=>b[0](R,w)?b[1](R,w):b[2](R,w);const v=Rt[p];if(!v)throw new Error(`unknown function "${p}" in expression "${e}"`);return(R,w)=>v(w,...b.map(X=>X(R,w)))}return p==="PI"?()=>Math.PI:b=>{if(!(p in b))throw new Error(`unknown name "${p}" in expression "${e}"`);return b[p]}}throw new Error(`unexpected "${d.op}" in expression "${e}"`)},h=()=>{let d=l();for(;i()&&i().op==="[";){o();const g=c(0);s("]");const p=d;d=(b,v)=>p(b,v)[g(b,v)]}return d},c=d=>{let g=h();for(;i()&&ee[i().op??""]&&ee[i().op??""][0]>=d;){const[p,b]=ee[o().op??""],v=c(p+1),R=g;g=(w,X)=>b(R(w,X),v(w,X))}return g},u=c(0);if(n<a.length)throw new Error(`unexpected "${JSON.stringify(a[n])}" in expression "${e}"`);return me.set(e,u),u},te=e=>Object.create(e),I=(e,t,a)=>{const n=Object.keys(e).filter(i=>!t.includes(i));if(n.length)throw new Error(`${a} has unknown key "${n[0]}"`)},M=(e,t,a)=>{if(typeof e=="number")return e;if(typeof e=="string")return Xt(e)(t,a);if(Array.isArray(e))return e.map(n=>M(n,t,a));if(e&&typeof e=="object"&&"if"in e)return I(e,["if","then","else"],"value {if}"),M(M(e.if,t,a)?e.then:e.else,t,a);if(e&&typeof e=="object"&&e.map){const n=e.map;return I(n,["count","values","as","let","value"],"value {map}"),Oe(n,t,a).map(i=>(le(n.let,i,a),M(n.value,i,a)))}throw new Error(`cannot evaluate ${JSON.stringify(e)}`)},le=(e,t,a)=>{Object.entries(e||{}).forEach(([n,i])=>{t[n]=M(i,t,a)})},Oe=(e,t,a)=>(e.values!==void 0?M(e.values,t,a):Array.from({length:M(e.count,t,a)},(i,o)=>o)).map((i,o)=>{const s=te(t);return s.index=o,e.as&&(s[e.as]=i),s}),ve={ellipse:e=>{const[t,a,n,i,o=0]=e;return{kind:"ellipse",x:t,y:a,radiusX:n,radiusY:i,angle:o}},circle:e=>{const[t,a,n]=e;return{kind:"ellipse",x:t,y:a,radiusX:n,radiusY:n,angle:0}},polygon:e=>({kind:"polygon",points:e}),blob:e=>({kind:"blob",points:e}),tube:(e,t,a,n)=>({kind:"tube",points:e,radii:[].concat(M(t.radii,a,n))})},Q=(e,t,a,n)=>{e.forEach(i=>{const o=Object.keys(ve).find(s=>s in i);if(o){I(i,[o,"radii","cut","part"],`shape {${o}}`);const s=ve[o](M(i[o],t,a),i,t,a);n.push(i.cut?Object.assign({},s,{cut:!0}):s)}else if("let"in i)I(i,["let","part"],"statement {let}"),le(i.let,t,a);else if("repeat"in i){I(i,["repeat","part"],"statement {repeat}");const s=i.repeat;I(s,["count","values","as","body"],"repeat"),Oe(s,t,a).forEach(r=>Q(s.body||[],r,a,n))}else if("if"in i)I(i,["if","then","else","part"],"statement {if}"),Q((M(i.if,t,a)?i.then:i.else)||[],te(t),a,n);else if("use"in i){I(i,["use","with","part"],"statement {use}");const s=a.defs[i.use];if(!s)throw new Error(`unknown def "${i.use}"`);const r=te(t);Object.entries(i.with||{}).forEach(([l,h])=>{r[l]=M(h,t,a)}),Q(s,r,a,n)}else throw new Error(`unknown statement ${JSON.stringify(i)}`)})},wt=(e,t)=>{const a={...e};return Object.entries(t||{}).forEach(([n,i])=>{const o=a[n]||{};a[n]={...o,...i,params:{...o.params,...i.params},drop:[...o.drop||[],...i.drop||[]],body:[...o.body||[],...i.body||[]]}}),a},Ye=new WeakMap,de=(e,t,a=[])=>{const n=Ye.get(e)||new Map;Ye.set(e,n);const i=n.get(t);if(i)return i;const o=e[t];if(!o)throw new Error(`unknown species "${t}"`);if(a.includes(t))throw new Error(`species "${t}" extends itself through ${a.join(" > ")}`);const s=o.extends?de(e,o.extends,[...a,t]):{params:{},defs:{},body:[],poses:{}},r={name:t,params:{...s.params,...o.params},defs:{...s.defs,...o.defs},body:[...s.body.filter(l=>!(o.drop||[]).includes(l.part??"")),...o.body||[]],poses:wt(s.poses,o.poses)};return n.set(t,r),r},Ae=e=>Object.entries(e.poses).map(([t,a])=>[t,a.weight===void 0?1:a.weight]).filter(([,t])=>t>0),_t=(e,t)=>{if(e.length<2)return e.length?e[0][0]:"";let a=t.next()*e.reduce((i,[,o])=>i+o,0);return(e.find(([,i])=>(a-=i,a<0))||e[e.length-1])[0]},ha=(e,t,a,n={})=>{const i=de(e,t),o=Ae(i),s=n.pose&&o.some(([d])=>d===n.pose)?n.pose:_t(o,a),r=i.poses[s]||{},l=new Set(r.drop||[]),h={random:a,defs:i.defs},c={},u=[];try{le({...i.params,...r.params},c,h),Q([...i.body.filter(d=>!l.has(d.part??"")),...r.body||[]],c,h,u)}catch(d){throw new Error(`species "${t}"${s?` (pose ${s})`:""}: ${d.message}`,{cause:d})}return{shapes:u,pose:s}},ga=e=>Object.keys(e).filter(t=>!e[t].abstract),pa=(e,t)=>{const a=Ae(de(e,t)).map(([n])=>n);return a.length?a:[""]},O=256,ae=2.6,Re=O/ae,kt=(e,t,a,n,i)=>{const o=i*i,s=o*i,r=l=>.5*(2*t[l]+(-e[l]+a[l])*i+(2*e[l]-5*t[l]+4*a[l]-n[l])*o+(-e[l]+3*t[l]-3*a[l]+n[l])*s);return[r(0),r(1)]},Xe=(e,t,a)=>{const n=e.length,i=r=>t?e[(r+n)%n]:e[De(r,0,n-1)],o=t?n:n-1,s=[];for(let r=0;r<o;r+=1)for(let l=0;l<a;l+=1)s.push(kt(i(r-1),i(r),i(r+1),i(r+2),l/a));return t||s.push(e[n-1]),s},St=(e,t)=>{if(e.length===1)return e[0];const a=t*(e.length-1),n=Math.min(e.length-2,Math.floor(a));return Te(e[n],e[n+1],a-n)},Me=(e,t)=>{if(e.globalCompositeOperation=t.cut?"destination-out":"source-over",e.beginPath(),t.kind==="ellipse")e.ellipse(t.x,t.y,t.radiusX,t.radiusY,t.angle,0,Math.PI*2),e.fill();else if(t.kind==="polygon"||t.kind==="blob")(t.kind==="blob"?Xe(t.points,!0,12):t.points).forEach(([n,i],o)=>o===0?e.moveTo(n,i):e.lineTo(n,i)),e.closePath(),e.fill();else if(t.kind==="tube"){const a=Xe(t.points,!1,24);a.forEach(([n,i],o)=>{const s=St(t.radii,o/Math.max(1,a.length-1));e.moveTo(n+s,i),e.arc(n,i,s,0,Math.PI*2)}),e.fill()}},fa=(e,t)=>{const a=document.createElement("canvas");a.width=O,a.height=O;const n=a.getContext("2d",{willReadFrequently:!0});if(!n)return new Uint8Array(O*O);n.translate(O/2,O/2),n.scale(Re*t.facing*t.stretchX,Re*t.stretchY),n.rotate(t.tilt),n.fillStyle="#000",e.forEach(s=>Me(n,s));const i=n.getImageData(0,0,O,O).data,o=new Uint8Array(O*O);for(let s=0;s<o.length;s+=1)o[s]=i[s*4+3]>127?1:0;return o},ba=(e,t,a)=>{const n=e.getContext("2d");n&&(n.clearRect(0,0,e.width,e.height),n.save(),n.translate(e.width/2,e.height/2),n.scale(e.width/ae,e.width/ae),n.fillStyle=a,t.forEach(i=>Me(n,i)),n.restore())},Lt=!0,Wt={groundY:.8,bodyRadiusX:"range(0.4, 0.46)",bodyRadiusY:"range(0.27, 0.32)",bodyAngle:-.45,legLength:"range(0.28, 0.34)",bodyY:"groundY - legLength - bodyRadiusY",headRadius:"range(0.15, 0.18)",headX:"bodyRadiusX * 0.55",headY:"bodyY - bodyRadiusY * 0.95 - headRadius * 0.4",neckWidth:"headRadius * 0.85",beakLength:"range(0.17, 0.23)",beakHeight:.09,tailLength:"range(0.3, 0.4)",tailSpread:.14,tailDrop:.18,legWidth:.022,wingWidth:.12},$t=[{ellipse:[0,"bodyY","bodyRadiusX","bodyRadiusY","bodyAngle"],part:"body"},{tube:[["bodyRadiusX * 0.25","bodyY - bodyRadiusY * 0.4"],["headX","headY + headRadius * 0.4"]],radii:["bodyRadiusY * 0.7","neckWidth"],part:"neck"},{circle:["headX","headY","headRadius"],part:"head"},{polygon:[["headX + headRadius * 0.7","headY - beakHeight * 0.6"],["headX + headRadius + beakLength","headY + beakHeight * 0.3"],["headX + headRadius * 0.7","headY + beakHeight * 0.7"]],part:"head"},{circle:["headX + headRadius * 0.3","headY - headRadius * 0.15",.025],cut:!0,part:"eye"},{polygon:[["-bodyRadiusX * 0.6","bodyY - tailSpread * 0.4"],["-bodyRadiusX * 0.6 - tailLength","bodyY + tailDrop - tailSpread"],["-bodyRadiusX * 0.6 - tailLength * 0.95","bodyY + tailDrop + tailSpread * 0.4"],["-bodyRadiusX * 0.3","bodyY + tailSpread * 0.6"]],part:"tail"},{tube:[["-bodyRadiusX * 0.55","bodyY - bodyRadiusY * 0.15"],["-bodyRadiusX * 0.1","bodyY + bodyRadiusY * 0.3"],["bodyRadiusX * 0.35","bodyY - bodyRadiusY * 0.05"]],radii:.012,cut:!0,part:"wing"},{repeat:{values:[-.08,.1],as:"legShift",body:[{tube:[["legShift","bodyY + bodyRadiusY * 0.6"],["legShift","groundY"]],radii:"legWidth"},{ellipse:["legShift + 0.05","groundY",.07,.02]}]},part:"legs"}],Et={perched:{weight:3},sleeping:{weight:1,params:{headX:"bodyRadiusX * 0.35",headY:"bodyY - bodyRadiusY * 0.55",beakLength:.1,bodyAngle:-.2},drop:["neck","eye","wing"],body:[{tube:[["headX + headRadius * 0.4","headY - headRadius * 0.1"],["headX + headRadius * 0.65","headY - headRadius * 0.05"]],radii:.012,cut:!0}]},front:{weight:1,params:{headX:0,headY:"bodyY - bodyRadiusX * 0.8 - headRadius * 0.2"},drop:["body","neck","head","eye","tail","wing","legs"],body:[{ellipse:[0,"bodyY - 0.02","bodyRadiusY * 1.25","bodyRadiusX * 0.95"]},{circle:["headX","headY","headRadius * 1.1"]},{polygon:[["headX - beakHeight","headY + headRadius * 0.15"],["headX + beakHeight","headY + headRadius * 0.15"],["headX","headY + headRadius * 0.15 + beakLength * 0.6"]]},{repeat:{values:[-1,1],as:"side",body:[{circle:["headX + side * headRadius * 0.45","headY - headRadius * 0.2",.027],cut:!0},{ellipse:["side * bodyRadiusY * 1.15","bodyY + 0.02","wingWidth * 0.9","bodyRadiusX * 0.6","side * -0.15"]},{tube:[["side * 0.1","groundY - legLength"],["side * 0.1","groundY"]],radii:"legWidth"},{ellipse:["side * 0.12","groundY",.07,.02]}]}}]}},jt={abstract:Lt,params:Wt,body:$t,poses:Et},Dt=!0,Tt={groundY:.7,bodyRadiusX:"range(0.5, 0.56)",bodyRadiusY:"range(0.26, 0.31)",legLength:"range(0.4, 0.5)",legWidth:.07,stride:0,bodyY:"groundY - bodyRadiusY - legLength",headRadiusX:"range(0.19, 0.22)",headRadiusY:"range(0.16, 0.18)",headX:"bodyRadiusX * 0.95",headY:"bodyY - bodyRadiusY * 0.8",neckWidth:"headRadiusY * 0.9",snoutLength:.16,snoutRadius:.08,earHeight:"range(0.16, 0.22)",earWidth:.09,earSpread:"range(0.1, 0.3)",eyeSize:.028,tailLength:"range(0.35, 0.45)",tailLift:"range(0.05, 0.2)",tailWidth:.06},Ot={ears:[{repeat:{values:[-.5,.3],as:"shift",body:[{polygon:[["headX + headRadiusX * shift - earWidth","headY - headRadiusY * 0.5"],["headX + headRadiusX * shift - earWidth * 0.2","headY - headRadiusY * 0.75 - earHeight"],["headX + headRadiusX * shift + earWidth","headY - headRadiusY * 0.7"]]}]}}]},At=[{ellipse:[0,"bodyY","bodyRadiusX","bodyRadiusY"],part:"body"},{tube:[["bodyRadiusX * 0.5","bodyY - bodyRadiusY * 0.2"],["headX - headRadiusX * 0.3","headY + headRadiusY * 0.2"]],radii:["bodyRadiusY * 0.8","neckWidth"],part:"neck"},{ellipse:["headX","headY","headRadiusX","headRadiusY"],part:"head"},{ellipse:["headX + headRadiusX * 0.75","headY + headRadiusY * 0.35","snoutLength","snoutRadius"],part:"head"},{use:"ears",part:"head"},{circle:["headX + headRadiusX * 0.4","headY - headRadiusY * 0.15","eyeSize"],cut:!0,part:"eye"},{tube:[["-bodyRadiusX * 0.85","bodyY - bodyRadiusY * 0.2"],["-bodyRadiusX * 0.85 - tailLength * 0.5","bodyY - bodyRadiusY * 0.2 - tailLift * 0.5"],["-bodyRadiusX * 0.85 - tailLength","bodyY - bodyRadiusY * 0.2 - tailLift"]],radii:["tailWidth","tailWidth * 0.9","tailWidth * 0.6"],part:"tail"},{repeat:{values:[-.72,-.5,.4,.68],as:"along",body:[{let:{swing:"if(index % 2 == 0, stride, -stride)",legX:"along * bodyRadiusX",hipY:"bodyY + bodyRadiusY * 0.5"}},{tube:[["legX","hipY"],["legX + swing","(hipY + groundY) / 2"],["legX + swing * 1.2","groundY"]],radii:["legWidth * 1.25","legWidth * 0.9","legWidth * 0.8"]}]},part:"legs"}],Mt={standing:{weight:3},walking:{weight:2,params:{stride:"range(0.06, 0.14)"}},sleeping:{weight:1,params:{legLength:.02,headX:"bodyRadiusX * 0.8",headY:"groundY - headRadiusY",tailLift:.02},drop:["legs","eye","neck"],body:[{ellipse:["bodyRadiusX * 0.55","groundY - 0.05","bodyRadiusX * 0.28",.06]},{tube:[["headX + headRadiusX * 0.2","headY - headRadiusY * 0.1"],["headX + headRadiusX * 0.4","headY"],["headX + headRadiusX * 0.6","headY - headRadiusY * 0.1"]],radii:.012,cut:!0}]},sitting:{weight:1,params:{headX:"bodyRadiusY * 0.5",headY:"groundY - bodyRadiusX * 1.55 - headRadiusY * 0.4"},drop:["body","neck","legs","tail"],body:[{ellipse:["bodyRadiusY * 0.2","groundY - bodyRadiusX * 0.85","bodyRadiusY * 1.05","bodyRadiusX * 0.9",.12]},{ellipse:["-bodyRadiusY * 0.55","groundY - bodyRadiusY * 0.55","bodyRadiusY * 1.2","bodyRadiusY * 0.62"]},{tube:[["bodyRadiusY * 0.75","groundY - bodyRadiusX * 1.0"],["bodyRadiusY * 0.8","groundY"]],radii:"legWidth * 1.1"},{tube:[["-bodyRadiusY * 1.2","groundY - 0.05"],["-bodyRadiusY * 1.2 - tailLength","groundY - 0.03"]],radii:["tailWidth","tailWidth * 0.6"]}]},front:{weight:1,params:{headX:0,headY:"groundY - bodyRadiusX * 1.1 - headRadiusY * 0.9"},drop:["body","neck","head","eye","legs","tail"],body:[{ellipse:[0,"groundY - bodyRadiusX * 0.7","bodyRadiusY * 1.25","bodyRadiusX * 0.75"]},{ellipse:["headX","headY","headRadiusX * 1.15","headRadiusY * 1.1"]},{ellipse:["headX","headY + headRadiusY * 0.45","snoutRadius * 1.5","snoutRadius"]},{repeat:{values:[-1,1],as:"side",body:[{polygon:[["headX + side * headRadiusX * 1.05","headY - headRadiusY * 0.3"],["headX + side * headRadiusX * (0.75 + earSpread)","headY - headRadiusY * 0.8 - earHeight"],["headX + side * headRadiusX * 0.3","headY - headRadiusY * 1.0"]]},{circle:["headX + side * headRadiusX * 0.5","headY - headRadiusY * 0.15","eyeSize * 1.2"],cut:!0},{tube:[["side * bodyRadiusY * 0.55","groundY - bodyRadiusX * 0.4"],["side * bodyRadiusY * 0.55","groundY"]],radii:"legWidth * 1.3"}]}},{circle:["headX","headY + headRadiusY * 0.3","snoutRadius * 0.35"],cut:!0}]}},xt={abstract:Dt,params:Tt,defs:Ot,body:At,poses:Mt},Ht=!0,Nt={length:"range(0.85, 0.95)",height:"range(0.36, 0.42)",arch:0,dorsalHeight:"range(0.2, 0.28)",finLength:.22,flukeSpan:.32,eyeX:.58,eyeSize:.035},Pt=[{blob:[["length","arch * 0.6"],["length * 0.55","-height * 0.8 - arch * 0.2"],["-length * 0.2","-height * 0.7 - arch * 0.2"],["-length * 0.75","-height * 0.12 + arch * 0.6"],["-length * 0.75","height * 0.12 + arch * 0.6"],["-length * 0.2","height * 0.8 - arch * 0.4"],["length * 0.5","height * 0.75 - arch * 0.2"]]},{polygon:[["-length * 0.7","arch * 0.6"],["-length - flukeSpan * 0.55","arch * 0.6 - flukeSpan"],["-length - flukeSpan * 0.3","arch * 0.6"],["-length - flukeSpan * 0.55","arch * 0.6 + flukeSpan"]],part:"fluke"},{polygon:[["length * 0.3","-height * 0.75 - arch * 0.2"],["-length * 0.2","-height * 0.7 - arch * 0.2 - dorsalHeight"],["-length * 0.35","-height * 0.65 - arch * 0.2"]]},{ellipse:["length * 0.2","height * 0.6 - arch * 0.3","finLength",.06,.6]},{circle:["length * eyeX","-height * 0.1 + arch * 0.4","eyeSize"],cut:!0}],Ct={cruising:{weight:3},leaping:{weight:0,params:{arch:.38}}},It={abstract:Ht,params:Nt,body:Pt,poses:Ct},zt=[{let:{humpHeight:"range(0.18, 0.3)",headDrop:"range(-0.08, 0.12)",legLength:"range(0.68, 0.8)"}},{ellipse:[-.1,0,"vary(0.62, 0.06)","vary(0.38, 0.06)"]},{ellipse:[.2,-.12,.32,"humpHeight + 0.1"]},{ellipse:[.62,"-0.02 + headDrop",.27,.23,.15]},{ellipse:[.82,"0.08 + headDrop",.12,.09,.5]},{circle:[.5,"-0.24 + headDrop",.1]},{circle:[.68,"-0.26 + headDrop",.09]},{circle:[-.72,-.08,.07]},{circle:[.7,"-0.04 + headDrop",.03],cut:!0},{repeat:{values:[-.55,-.3,.15,.36],as:"legX",body:[{tube:[["legX",.15],["legX + range(-0.04, 0.04)","legLength"]],radii:[.14,.12]},{ellipse:["legX + 0.06","legLength + 0.03",.14,.06]}]}}],Ft={body:zt},Bt={sitting:{weight:.55,body:[{let:{headX:"range(0.12, 0.28)",headY:"range(-0.58, -0.45)",earHeight:"range(0.26, 0.4)",earTilt:"range(-0.08, 0.08)",curlsForward:"chance(0.5)",tailPoints:{if:"curlsForward",then:[[-.5,.78],[-.2,.92],[.25,.9],["range(0.45, 0.6)","range(0.7, 0.85)"]],else:[[-.55,.7],[-.88,.62],["-range(0.9, 1.05)",.3],["-range(0.75, 0.95)","range(-0.05, 0.15)"]]}}},{ellipse:[-.15,.45,"vary(0.48)","vary(0.4)"]},{ellipse:[.1,.05,"vary(0.3)",.5,-.15]},{ellipse:["headX","headY","vary(0.27, 0.08)","vary(0.23, 0.08)"]},{polygon:[["headX - 0.25","headY - 0.04"],["headX - 0.2 + earTilt","headY - 0.12 - earHeight"],["headX - 0.02","headY - 0.18"]]},{polygon:[["headX + 0.04","headY - 0.18"],["headX + 0.22 + earTilt","headY - 0.12 - earHeight"],["headX + 0.27","headY - 0.03"]]},{tube:[[.14,.3],[.16,.86]],radii:.07},{tube:[[.3,.3],[.33,.86]],radii:.065},{tube:"tailPoints",radii:[.075,.07,.065,.055]},{ellipse:["headX - 0.1","headY - 0.01",.045,.03],cut:!0},{ellipse:["headX + 0.1","headY - 0.01",.045,.03],cut:!0}]},walking:{weight:.45,body:[{let:{tailHeight:"range(0.6, 0.95)",tailHook:"range(-0.25, 0.15)",stride:"range(0.05, 0.16)",headY:"range(-0.32, -0.18)"}},{ellipse:[-.05,.05,"vary(0.58, 0.08)","vary(0.22)"]},{ellipse:[.62,"headY",.21,.19]},{polygon:[[.45,"headY - 0.08"],[.47,"headY - 0.38"],[.6,"headY - 0.17"]]},{polygon:[[.64,"headY - 0.17"],[.76,"headY - 0.38"],[.8,"headY - 0.06"]]},{tube:[[-.45,.1],["-0.45 - stride",.42],["-0.42 - stride",.68]],radii:[.08,.055,.05]},{tube:[[-.25,.12],["-0.22 + stride",.45],["-0.2 + stride",.68]],radii:[.07,.05,.05]},{tube:[[.3,.12],["0.3 + stride",.45],["0.32 + stride",.68]],radii:[.07,.05,.05]},{tube:[[.42,.12],["0.42 - stride",.45],["0.43 - stride",.68]],radii:[.07,.05,.05]},{tube:[[-.58,-.02],[-.85,-.25],[-.85,"-tailHeight + 0.2"],["-0.7 + tailHook","-tailHeight"]],radii:[.06,.055,.05,.045]},{ellipse:[.68,"headY - 0.02",.035,.022],cut:!0}]}},qt={poses:Bt},Vt={antler:[{let:{height:"range(0.42, 0.6)"}},{let:{beam:[["rootX","rootY"],["rootX - 0.1 * spread","rootY - height * 0.4"],["rootX - 0.06 * spread","rootY - height * 0.8"],["rootX + 0.08 * spread","rootY - height"]]}},{tube:"beam",radii:[.04,.036,.032,.026]},{repeat:{count:"int(2, 4)",body:[{let:{anchor:"beam[min(3, index + 1)]",length:"range(0.12, 0.2)"}},{tube:["anchor",["anchor[0] + length * 0.7 * spread","anchor[1] - length"]],radii:[.03,.024]}]}}]},Jt=[{let:{neckLean:"range(0.4, 0.55)",headY:"range(-0.55, -0.42)",legLength:"range(0.85, 0.95)",headX:"neckLean + 0.08"}},{ellipse:[-.1,.05,"vary(0.48, 0.06)","vary(0.21, 0.08)"]},{tube:[[.25,0],["neckLean - 0.05",-.25],["neckLean","headY + 0.05"]],radii:[.13,.09,.075]},{ellipse:["headX","headY",.14,.09,.4]},{ellipse:["headX + 0.13","headY + 0.07",.09,.06,.4]},{ellipse:["headX - 0.13","headY - 0.06",.1,.035,-.5]},{ellipse:[-.58,-.04,.07,.04,-.5]},{tube:[[-.45,.12],[-.5,.5],[-.42,"legLength"]],radii:[.055,.035,.03]},{tube:[[-.32,.14],[-.34,.5],[-.3,"legLength"]],radii:[.05,.035,.03]},{tube:[[.2,.15],[.22,.55],[.2,"legLength"]],radii:[.045,.035,.03]},{tube:[[.32,.12],[.36,.52],[.33,"legLength"]],radii:[.045,.035,.03]},{circle:["headX + 0.02","headY - 0.02",.025],cut:!0},{use:"antler",with:{rootX:"headX - 0.06",rootY:"headY - 0.06",spread:-.8}},{use:"antler",with:{rootX:"headX + 0.04",rootY:"headY - 0.06",spread:1.3}}],Kt={defs:Vt,body:Jt},Ut={length:"range(0.8, 0.88)",height:"range(0.2, 0.25)",dorsalHeight:.2,flukeSpan:.36,finLength:.2,eyeX:.62,eyeSize:.025},Gt=["fluke"],Qt=[{ellipse:["-length * 0.85","arch * 0.6 - flukeSpan * 0.45","flukeSpan * 0.55",.07,-.95],part:"fluke"},{ellipse:["-length * 0.85","arch * 0.6 + flukeSpan * 0.45","flukeSpan * 0.55",.07,.95],part:"fluke"},{ellipse:["length + 0.03","height * 0.35 + arch * 0.6",.15,.06,.12]}],Zt={leaping:{weight:1}},e0={extends:"swimmer",params:Ut,drop:Gt,body:Qt,poses:Zt},t0={bodyRadiusX:"range(0.5, 0.56)",bodyRadiusY:"range(0.27, 0.3)",bodyAngle:-.1,legLength:.16,headRadius:.15,headX:"bodyRadiusX * 0.7",headY:"bodyY - bodyRadiusY - 0.12",neckWidth:.1,beakLength:.17,beakHeight:.07,tailLength:.2,tailSpread:.1,tailDrop:-.12,wingWidth:.15},a0={extends:"bird",params:t0},n0=[{let:{earSize:"range(0.9, 1.15)",trunkCurl:"range(-0.1, 0.25)",headY:"range(-0.32, -0.2)",legLength:"range(0.76, 0.86)"}},{ellipse:[-.15,0,"vary(0.6, 0.06)","vary(0.4, 0.06)"]},{ellipse:[.45,"headY",.3,.3]},{tube:[[-.73,-.1],[-.8,.15],[-.8,.38]],radii:[.025,.02,.035]},{repeat:{values:[-.6,-.36,.05,.26],as:"legX",body:[{tube:[["legX",.2],["legX","legLength"]],radii:.12}]}},{tube:[[.6,"headY + 0.28"],[.78,"headY + 0.38"],[.92,"headY + 0.3"]],radii:.035,cut:!0},{tube:[[.68,"headY - 0.02"],[.84,"headY + 0.25"],[.86,"headY + 0.6"],["0.9 + trunkCurl","headY + 0.92"],["1.02 + trunkCurl","headY + 0.85"]],radii:[.12,.1,.075,.055,.045]},{let:{earPoints:{map:{values:[[.12,-.52],[.38,-.6],[.48,-.22],[.38,.16],[.14,.1],[.02,-.2]],as:"point",value:["0.27 + (point[0] - 0.27) * earSize","headY + 0.05 + (point[1] + 0.2) * earSize"]}}}},{blob:"earPoints"},{tube:["earPoints[1]","earPoints[2]","earPoints[3]"],radii:.022,cut:!0},{circle:[.58,"headY - 0.04",.035],cut:!0}],i0={body:n0},o0={height:"range(0.4, 0.48)",dorsalHeight:.22,eyeX:.62,eyeSize:.05},s0={extends:"swimmer",params:o0},r0=["neck"],l0={bodyRadiusX:"range(0.3, 0.34)",bodyRadiusY:.2,bodyAngle:-.12,legLength:"range(0.75, 0.85)",headRadius:.07,headX:"range(0.38, 0.48)",headY:"bodyY - bodyRadiusY - range(0.7, 0.8)",beakLength:.12,beakHeight:.05,tailLength:.12,tailSpread:.06,tailDrop:.02,legWidth:.026,wingWidth:.08},d0=[{tube:[["bodyRadiusX * 0.55","bodyY - bodyRadiusY * 0.4"],["bodyRadiusX * 0.9","bodyY - bodyRadiusY - 0.28"],["headX - 0.14","headY + 0.3"],["headX - 0.02","headY + 0.08"]],radii:[.075,.04,.035,.03],part:"neck"}],u0={sleeping:{weight:0},front:{weight:0}},c0={extends:"bird",drop:r0,params:l0,body:d0,poses:u0},h0=[{let:{earHeight:"range(0.28, 0.4)",snout:"range(0.95, 1.1)",tailDroop:"range(-0.15, 0.25)",tailBush:"range(0.13, 0.19)",legLength:"range(0.6, 0.72)"}},{ellipse:[-.05,.05,"vary(0.48, 0.08)","vary(0.19)"]},{ellipse:[.35,0,.18,.22]},{blob:[[.28,-.12],[.52,-.32],[.72,-.28],["snout",-.12],[.75,-.04],[.48,.14]]},{polygon:[[.48,-.26],[.5,"-0.28 - earHeight"],[.63,-.31]]},{polygon:[[.6,-.3],[.7,"-0.28 - earHeight * 0.95"],[.75,-.25]]},{tube:[[-.45,.02],[-.75,"0.12 + tailDroop * 0.5"],[-1,"0.08 + tailDroop"],[-1.15,"-0.06 + tailDroop"]],radii:[.06,"tailBush","tailBush * 0.85",.025]},{ellipse:[.7,-.17,.035,.022,-.3],cut:!0},{repeat:{values:[-.4,-.25,.28,.4],as:"legX",body:[{let:{step:"if(index % 2 == 0, range(-0.08, 0.08), 0)"}},{tube:[["legX",.12],["legX + step","legLength"]],radii:[.05,.035]}]}}],g0={body:h0},p0=[{let:{bodyY:"range(0.05, 0.15)",bodyRadiusX:"range(0.6, 0.72)",bodyRadiusY:"range(0.3, 0.38)",spikeCount:"int(11, 17)",spikeLength:"range(0.3, 0.45)",sweep:"range(0.2, 0.55)",frontAngle:"PI * range(1.62, 1.75)"}},{ellipse:[0,"bodyY","bodyRadiusX","bodyRadiusY"]},{repeat:{count:"spikeCount",body:[{let:{angle:"lerp(PI * 0.88, frontAngle, index / (spikeCount - 1)) + range(-0.04, 0.04)",baseX:"cos(angle) * bodyRadiusX * 0.9",baseY:"bodyY + sin(angle) * bodyRadiusY * 0.9",directionX:"cos(angle) - sweep",directionY:"sin(angle) * 1.2",directionLength:"hypot(directionX, directionY)",length:"spikeLength * range(0.7, 1.25)",halfWidth:"range(0.07, 0.1)",tangentX:"-directionY / directionLength",tangentY:"directionX / directionLength"}},{polygon:[["baseX - tangentX * halfWidth","baseY - tangentY * halfWidth"],["baseX + directionX / directionLength * (length + 0.08)","baseY + directionY / directionLength * (length + 0.08)"],["baseX + tangentX * halfWidth","baseY + tangentY * halfWidth"]]}]}},{let:{snoutX:"bodyRadiusX * 0.85",snoutReach:"range(0.28, 0.42)"}},{ellipse:["snoutX - 0.05","bodyY + 0.12",.3,.2,.3]},{polygon:[["snoutX - 0.05","bodyY - 0.02"],["snoutX + snoutReach","bodyY + 0.25"],["snoutX - 0.1","bodyY + 0.3"]]},{circle:["snoutX + snoutReach - 0.02","bodyY + 0.25",.055]},{repeat:{values:[-.42,-.15,.22,.45],as:"legX",body:[{tube:[["legX","bodyY + bodyRadiusY * 0.7"],["legX + 0.04","bodyY + bodyRadiusY + range(0.08, 0.14)"]],radii:.06}]}},{circle:["snoutX + 0.04","bodyY + 0.08",.04],cut:!0}],f0={body:p0},b0=["neck"],y0={bodyRadiusX:"range(0.6, 0.68)",bodyRadiusY:"range(0.3, 0.34)",legLength:"range(0.6, 0.7)",legWidth:.055,headRadiusX:.17,headRadiusY:.14,headX:"bodyRadiusX * 0.95 + 0.22",headY:"bodyY - bodyRadiusY - 0.32",neckWidth:.1,snoutLength:.24,snoutRadius:.09,earHeight:.1,earWidth:.05,tailLength:.3,tailLift:"range(-0.6, -0.4)",tailWidth:.07},m0=[{tube:[["bodyRadiusX * 0.55","bodyY - bodyRadiusY * 0.9"],["bodyRadiusX * 0.7","bodyY - bodyRadiusY - 0.2"],["headX - 0.06","headY - headRadiusY * 0.8"]],radii:[.1,.075,.045],part:"neck"}],v0={sitting:{weight:0},front:{weight:0}},Y0={extends:"quadruped",drop:b0,params:y0,body:m0,poses:v0},R0=[{let:{mantleRadius:"range(0.38, 0.46)",mantleLift:"range(0.35, 0.5)",armCount:"int(7, 8)",sway:"range(0.2, 0.5)"}},{ellipse:[0,"-mantleLift","mantleRadius","mantleRadius * 1.25"]},{ellipse:[0,.05,"mantleRadius * 1.1",.3]},{repeat:{count:"armCount",body:[{let:{spread:"lerp(-0.65, 0.65, index / (armCount - 1))",wave:"if(index % 2 == 0, sway, -sway) * range(0.6, 1.2)",reach:"range(0.5, 0.7)"}},{tube:[["spread * 0.45",.1],["spread * 0.9 + wave * 0.3","reach * 0.5"],["spread * 1.2 + wave","reach"],["spread * 1.1 + wave * 1.4","reach + 0.18"]],radii:[.1,.075,.05,.02]}]}},{circle:["-mantleRadius * 0.4","-mantleLift + 0.15",.07],cut:!0},{circle:["mantleRadius * 0.4","-mantleLift + 0.15",.07],cut:!0}],X0={body:R0},w0={bodyRadiusX:"range(0.56, 0.62)",bodyRadiusY:"range(0.2, 0.24)",legLength:"range(0.16, 0.22)",legWidth:.075,headRadiusX:.17,headRadiusY:.15,headX:"bodyRadiusX + 0.02",headY:"bodyY - bodyRadiusY * 0.7",neckWidth:"bodyRadiusY * 0.8",snoutLength:.11,snoutRadius:.07,earHeight:.04,earWidth:.05,tailLength:"range(0.5, 0.62)",tailLift:"range(-0.1, 0.05)",tailWidth:.11},_0={extends:"quadruped",params:w0},k0=[{let:{tuftHeight:"range(0.3, 0.5)",eyeSize:"range(0.13, 0.17)",lookX:"range(-0.04, 0.04)"}},{ellipse:[0,.15,"vary(0.46, 0.08)","vary(0.6, 0.06)"]},{ellipse:[0,-.4,.44,.33]},{polygon:[[-.42,-.5],[-.5,"-0.5 - tuftHeight"],[-.16,-.66]]},{polygon:[[.42,-.5],[.5,"-0.5 - tuftHeight"],[.16,-.66]]},{ellipse:[-.42,.2,.15,.42,.18]},{ellipse:[.42,.2,.15,.42,-.18]},{tube:[[-1.15,.82],[0,.8],[1.15,"range(0.78, 0.88)"]],radii:.05},{tube:[[-.14,.7],[-.16,.82]],radii:.045},{tube:[[.14,.7],[.16,.82]],radii:.045},{circle:[-.2,-.4,"eyeSize"],cut:!0},{circle:[.2,-.4,"eyeSize"],cut:!0},{circle:["-0.2 + lookX",-.4,"eyeSize * 0.42"]},{circle:["0.2 + lookX",-.4,"eyeSize * 0.42"]},{polygon:[[-.05,-.27],[.05,-.27],[0,-.14]],cut:!0},{repeat:{count:3,as:"row",body:[{repeat:{values:[-1,0,1],as:"column",body:[{let:{featherX:"column * 0.16 + (row % 2) * 0.08 - 0.04",featherY:"0.05 + row * 0.15"}},{tube:[["featherX - 0.05","featherY"],["featherX","featherY + 0.04"],["featherX + 0.05","featherY"]],radii:.014,cut:!0}]}}]}}],S0={body:k0},L0=["wing"],W0={bodyRadiusX:"range(0.55, 0.62)",bodyRadiusY:"range(0.3, 0.34)",bodyAngle:"-PI / 2",legLength:.06,headRadius:.17,headX:.04,headY:"bodyY - bodyRadiusX * 0.85",neckWidth:.15,beakLength:.15,beakHeight:.06,tailLength:.12,tailSpread:.08,tailDrop:.1,wingWidth:.07},$0=[{ellipse:["-bodyRadiusY * 0.95","bodyY + 0.02",.08,"bodyRadiusX * 0.6",.15],part:"flipper"},{ellipse:["bodyRadiusY * 0.95","bodyY + 0.02",.08,"bodyRadiusX * 0.6",-.15],part:"flipper"}],E0={sleeping:{weight:0}},j0={extends:"bird",drop:L0,params:W0,body:$0,poses:E0},D0={bodyRadiusX:"range(0.56, 0.62)",bodyRadiusY:"range(0.36, 0.4)",legLength:"range(0.2, 0.26)",legWidth:.08,headRadiusX:.25,headRadiusY:.23,headX:"bodyRadiusX * 0.95",headY:"bodyY + 0.02",neckWidth:.22,snoutLength:.12,snoutRadius:.12,earHeight:.1,earWidth:.1,earSpread:.1,tailLength:.14,tailLift:"range(0.15, 0.25)",tailWidth:.035},T0={sitting:{weight:0}},O0={extends:"quadruped",params:D0,poses:T0},A0={ear:[{ellipse:["baseX + sin(angle) * length","baseY - cos(angle) * length",.085,"length","angle"]}]},M0=[{let:{earLength:"range(0.38, 0.52)",earLean:"range(-0.5, 0.05)",floppy:"chance(0.3)",headX:"range(0.36, 0.46)",headY:"range(-0.18, -0.05)"}},{ellipse:[-.2,.35,"vary(0.46, 0.08)","vary(0.38, 0.08)"]},{ellipse:[.08,.22,.38,.33]},{ellipse:["headX","headY",.24,.2,.2]},{use:"ear",with:{baseX:"headX - 0.06",baseY:"headY - 0.12",angle:"earLean",length:"earLength"}},{use:"ear",with:{baseX:"headX + 0.04",baseY:"headY - 0.1",angle:"earLean + if(floppy, 1.2, 0.25)",length:"earLength * if(floppy, 0.85, 0.95)"}},{circle:[-.68,.2,"range(0.11, 0.15)"]},{ellipse:[-.08,.72,.3,.07]},{tube:[[.3,.35],[.36,.72]],radii:.06},{circle:["headX + 0.06","headY - 0.04",.035],cut:!0}],x0={defs:A0,body:M0},H0=[{let:{hornLength:"range(0.62, 0.85)",hornLean:"range(-0.12, 0.02)",headDrop:"range(0, 0.12)",legLength:"range(0.68, 0.82)"}},{ellipse:[-.15,.05,"vary(0.62, 0.06)","vary(0.36, 0.08)"]},{ellipse:[.15,-.1,.34,.3]},{blob:[[.3,-.2],[.68,"-0.02 + headDrop"],[1.02,"0.24 + headDrop"],[.98,"0.42 + headDrop"],[.62,"0.42 + headDrop"],[.36,.3]]},{polygon:[[.8,"0.24 + headDrop"],[.84,"0.1 + headDrop"],["0.96 + hornLean","0.24 + headDrop - hornLength"],[1.05,"0.3 + headDrop"]]},{polygon:[[.66,"0.1 + headDrop"],["0.74 + hornLean","0.08 + headDrop - hornLength * 0.45"],[.82,"0.16 + headDrop"]]},{polygon:[[.34,-.14],["range(0.28, 0.34)",-.46],[.48,-.12]]},{tube:[[-.74,-.02],[-.84,.12],[-.83,.28]],radii:.025},{circle:[.6,"0.18 + headDrop",.03],cut:!0},{repeat:{values:[-.56,-.32,.08,.3],as:"legX",body:[{tube:[["legX",.2],["legX + range(-0.03, 0.03)","legLength"]],radii:.12}]}}],N0={body:H0},P0={length:"range(0.85, 0.92)",height:"range(0.2, 0.24)",dorsalHeight:"range(0.35, 0.42)",finLength:.3,flukeSpan:.4,eyeX:.68,eyeSize:.022},C0={extends:"swimmer",params:P0},I0=[{let:{shellRadius:"range(0.48, 0.6)",shellX:"range(-0.25, -0.1)",shellY:"0.55 - shellRadius - range(0.02, 0.08)",turns:"range(2.6, 3.4)",stalk:"range(0.3, 0.42)"}},{let:{spiral:{map:{count:49,as:"step",let:{angle:"step / 48 * turns * PI * 2",radius:"shellRadius * 0.86 * (step / 48)"},value:["shellX + cos(angle) * radius","shellY + sin(angle) * radius"]}}}},{blob:[[-.95,.66],[-.5,.56],[.4,.56],[.68,.38],[.82,.08],[.95,.02],[1.02,.18],[.96,.5],[.8,.7],[-.88,.76]]},{circle:["shellX","shellY","shellRadius"]},{tube:"spiral",radii:.026,cut:!0},{tube:[[.88,.08],["0.95 + range(0, 0.08)","0.08 - stalk"]],radii:.024},{circle:["0.95 + 0.04","0.08 - stalk - 0.02",.05]},{tube:[[.82,.1],[.78,"0.1 - stalk * 0.8"]],radii:.022},{circle:[.78,"0.1 - stalk * 0.8 - 0.02",.045]}],z0={body:I0},F0=[{let:{shellHeight:"range(0.45, 0.6)",shellWidth:"range(0.66, 0.76)",neckReach:"range(0.85, 1.0)",dome:{map:{count:25,as:"step",let:{angle:"PI + (step / 24) * PI"},value:["cos(angle) * shellWidth","0.25 + sin(angle) * shellHeight"]}},scuteY:"0.25 - shellHeight * 0.45"}},{polygon:"dome"},{ellipse:[0,.27,"shellWidth + 0.07",.08]},{tube:[["shellWidth - 0.1",.24],["neckReach - 0.15",.1]],radii:.09},{ellipse:["neckReach",.08,.17,.12,-.1]},{ellipse:["-shellWidth * 0.62",.42,.12,.16,.3]},{ellipse:["shellWidth * 0.6",.42,.12,.16,-.3]},{polygon:[["-shellWidth - 0.02",.22],["-shellWidth - 0.2",.3],["-shellWidth - 0.02",.3]]},{tube:[["-shellWidth * 0.95",.2],["-shellWidth * 0.5","scuteY"],["shellWidth * 0.5","scuteY"],["shellWidth * 0.95",.2]],radii:.015,cut:!0},{tube:[["-shellWidth * 0.25","scuteY"],["-shellWidth * 0.3",.2]],radii:.015,cut:!0},{tube:[["shellWidth * 0.25","scuteY"],["shellWidth * 0.3",.2]],radii:.015,cut:!0},{tube:[["-shellWidth * 0.2","scuteY"],[0,"0.25 - shellHeight * 0.95"]],radii:.014,cut:!0},{tube:[["shellWidth * 0.2","scuteY"],[0,"0.25 - shellHeight * 0.95"]],radii:.014,cut:!0},{circle:["neckReach + 0.06",.04,.028],cut:!0}],B0={body:F0},q0=[{let:{belly:"range(0.24, 0.34)",back:"range(-0.42, -0.32)",tailLift:"range(-0.35, 0.05)",spout:"chance(0.75)"}},{blob:[[.9,-.02],[.72,"back + 0.1"],[.3,"back"],[-.2,"back + 0.12"],[-.6,"-0.08 + tailLift * 0.4"],[-.88,"tailLift * 0.8"],[-.62,"0.12 + tailLift * 0.3"],[-.1,"belly"],[.5,"belly + 0.02"],[.84,.18]]},{ellipse:[-1,"tailLift - 0.16","vary(0.28)",.075,-.85]},{ellipse:[-1,"tailLift + 0.13","vary(0.28)",.075,.85]},{ellipse:[.22,"belly + 0.08","vary(0.24)",.065,.55]},{tube:[[.88,.1],[.6,.16],[.32,.12]],radii:.018,cut:!0},{circle:[.42,.04,.035],cut:!0},{if:"spout",then:[{tube:[[.55,"back - 0.06"],[.56,"back - 0.3"],[.44,"back - 0.5"]],radii:[.035,.03,.02]},{tube:[[.56,"back - 0.3"],[.7,"back - 0.48"]],radii:[.03,.02]},{circle:[.38,"back - 0.48",.03]},{circle:[.76,"back - 0.42",.025]},{circle:[.6,"back - 0.6",.025]}]}],V0={body:q0},J0={bodyRadiusX:"range(0.58, 0.66)",bodyRadiusY:"range(0.26, 0.3)",legLength:"range(0.52, 0.62)",legWidth:.06,headRadiusX:.2,headRadiusY:.16,snoutLength:.24,snoutRadius:.07,earHeight:"range(0.2, 0.26)",tailLength:"range(0.4, 0.5)",tailLift:"range(-0.25, -0.05)",tailWidth:.09},K0={extends:"quadruped",params:J0},U0=Object.assign({"./base/bird.json":jt,"./base/quadruped.json":xt,"./base/swimmer.json":It,"./bear.json":Ft,"./cat.json":qt,"./deer.json":Kt,"./dolphin.json":e0,"./duck.json":a0,"./elephant.json":i0,"./fish.json":s0,"./flamingo.json":c0,"./fox.json":g0,"./hedgehog.json":f0,"./horse.json":Y0,"./octopus.json":X0,"./otter.json":_0,"./owl.json":S0,"./penguin.json":j0,"./pig.json":O0,"./rabbit.json":x0,"./rhino.json":N0,"./shark.json":C0,"./snail.json":z0,"./turtle.json":B0,"./whale.json":V0,"./wolf.json":K0}),ya=Object.fromEntries(Object.entries(U0).map(([e,t])=>[e.replace(/^.*\//,"").replace(/\.json$/,""),t])),G0=gt(),Q0=()=>G0.value,ma=x(Q0);export{sa as A,ba as B,pa as C,O as M,Ge as a,ha as b,ca as c,Re as d,De as e,ae as f,ma as g,la as h,Q0 as i,ua as j,ea as k,Te as l,vt as m,oa as n,da as o,fa as p,ta as q,ya as r,ga as s,na as t,q as u,aa as v,it as w,bt as x,ra as y,ia as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as M,I,o as t,b as l,i,h as a,k as c,c as k,_ as N,l as T,w as U,m as d,E as h,K as w,u as C,F as g,e as f,H as $,j as E,q as F,y as P,J as q}from"./_plugin-vue_export-helper-BxUUR8De.js";import{B as A,b as D,r as y,c as L,s as j,C as z,g as H}from"./scheme-BtoCLyX6.js";const J={class:"species-cell"},K={key:0,class:"species-cell__error"},O={class:"species-cell__seed"},R=M({__name:"SpeciesCell",props:{name:{},pose:{},seed:{},ink:{}},setup(m){const o=m,n=c(null),r=k(()=>{try{return{shapes:D(y,o.name,L(o.seed),{pose:o.pose}).shapes,error:""}}catch(u){return{shapes:[],error:u.message}}});return I(()=>{n.value&&!r.value.error&&o.ink&&A(n.value,r.value.shapes,o.ink)}),(u,_)=>(t(),l("figure",J,[r.value.error?(t(),l("p",K,i(r.value.error),1)):(t(),l("canvas",{key:1,ref_key:"canvas",ref:n,class:"species-cell__canvas",width:"260",height:"260"},null,512)),a("figcaption",O,i(m.seed),1)]))}}),G=N(R,[["__scopeId","data-v-220e2a5a"]]),Q={class:"sheet-page__head"},W={class:"sheet-page__field"},X={value:""},Y=["value"],Z={class:"sheet-page__field"},ee={class:"sheet-page__field"},se={class:"sheet-page__label"},ae={key:0,class:"sheet-page__pose"},te=M({__name:"SheetPage",setup(m){const o=new URLSearchParams(location.search),n=c(Math.min(12,Math.max(1,Number(o.get("seeds"))||6))),r=c(Number(o.get("from"))||1),u=c(o.get("species")||""),_=j(y),V=k(()=>Array.from({length:n.value},(p,e)=>r.value+e)),B=k(()=>_.filter(p=>!u.value||p===u.value).flatMap(p=>z(y,p).map(e=>({name:p,pose:e,key:`${p}:${e}`})))),v=c(null),b=c(""),S=()=>{v.value&&(b.value=getComputedStyle(v.value).color)};return T(S),U(H,S),(p,e)=>(t(),l("main",{ref_key:"page",ref:v,class:"app sheet-page"},[a("header",Q,[e[6]||(e[6]=a("h1",{class:"sheet-page__title"},"Species sheet",-1)),a("label",W,[e[3]||(e[3]=d("Species ",-1)),h(a("select",{"onUpdate:modelValue":e[0]||(e[0]=s=>u.value=s)},[a("option",X,"all ("+i(C(_).length)+")",1),(t(!0),l(g,null,f(C(_),s=>(t(),l("option",{key:s,value:s},i(s),9,Y))),128))],512),[[w,u.value]])]),a("label",Z,[e[4]||(e[4]=d("Seeds ",-1)),h(a("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>n.value=s),class:"sheet-page__number",type:"number",min:"1",max:"12"},null,512),[[$,n.value,void 0,{number:!0}]])]),a("label",ee,[e[5]||(e[5]=d("From seed ",-1)),h(a("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>r.value=s),class:"sheet-page__number",type:"number",min:"0"},null,512),[[$,r.value,void 0,{number:!0}]])])]),(t(!0),l(g,null,f(B.value,s=>(t(),l("section",{key:s.key,class:"sheet-page__row"},[a("h2",se,[d(i(s.name),1),s.pose?(t(),l("small",ae,i(s.pose),1)):E("",!0)]),a("div",{class:"sheet-page__cells",style:P({gridTemplateColumns:`repeat(${n.value}, minmax(0, 1fr))`})},[(t(!0),l(g,null,f(V.value,x=>(t(),F(G,{key:x,name:s.name,pose:s.pose,seed:x,ink:b.value},null,8,["name","pose","seed","ink"]))),128))],4)]))),128))],512))}}),le=N(te,[["__scopeId","data-v-b4daa75a"]]);q(le).mount("#app");
|
package/dist/index.html
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
<title>Whose Turn</title>
|
|
7
7
|
<script src="/vendor/popper.min.js"></script>
|
|
8
8
|
<script src="/vendor/tippy-bundle.umd.min.js"></script>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/scheme-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/bem-
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/_plugin-vue_export-helper-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-oEi3SjBF.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-BxUUR8De.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/scheme-BtoCLyX6.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/bem-HybmjowO.js">
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/_plugin-vue_export-helper-aQHODzfZ.css">
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C4WWZEBZ.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body class="page">
|
|
17
17
|
<div id="app" class="page__mount"></div>
|
package/dist/report.html
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>Your report · Whose Turn</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/report-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/bem-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/_plugin-vue_export-helper-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/report-
|
|
7
|
+
<script type="module" crossorigin src="/assets/report-GgVB1dt8.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-BxUUR8De.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/bem-HybmjowO.js">
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/_plugin-vue_export-helper-aQHODzfZ.css">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/report-D7II0AfP.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body class="page page--scroll">
|
|
14
14
|
<div id="app" class="page__mount"></div>
|
package/dist/sheet.html
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>Species sheet · Whose Turn</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/sheet-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/scheme-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/_plugin-vue_export-helper-
|
|
7
|
+
<script type="module" crossorigin src="/assets/sheet-CXZ1EA3c.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-BxUUR8De.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/scheme-BtoCLyX6.js">
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/_plugin-vue_export-helper-aQHODzfZ.css">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/sheet-DYpaJaXO.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body class="page page--scroll">
|
package/install.sh
CHANGED
|
@@ -12,19 +12,28 @@ NODE=$(command -v node) || { echo "Node 22 or newer is needed on PATH."; exit 1;
|
|
|
12
12
|
NODE_DIR=$(dirname "$NODE")
|
|
13
13
|
PORT=$("$NODE" --input-type=module -e "const { pathToFileURL } = await import('node:url'); const { defaultDataDir, resolvePort } = await import(pathToFileURL(process.argv[1]).href); console.log(resolvePort(process.env.WHOSE_TURN_DATA || defaultDataDir()))" "$DIR/lib/config.mjs")
|
|
14
14
|
URL="http://127.0.0.1:${PORT:-8765}/"
|
|
15
|
+
PASSED=()
|
|
16
|
+
[[ -n ${WHOSE_TURN_DATA:-} ]] && PASSED+=(WHOSE_TURN_DATA)
|
|
17
|
+
[[ -n ${WHOSE_TURN_PORT:-} ]] && PASSED+=(WHOSE_TURN_PORT)
|
|
18
|
+
PASSED_NOTE=""
|
|
19
|
+
((${#PASSED[@]})) && PASSED_NOTE=" ${PASSED[*]} from this shell $([[ ${#PASSED[@]} -gt 1 ]] && echo are || echo is) written into it."
|
|
20
|
+
|
|
21
|
+
xml_escape() { local v=${1//&/&}; v=${v//</<}; echo "${v//>/>}"; }
|
|
15
22
|
|
|
16
23
|
install_macos() {
|
|
17
24
|
local plist=$HOME/Library/LaunchAgents/local.whose-turn.plist
|
|
18
25
|
local log=$HOME/Library/Logs/whose-turn.log
|
|
26
|
+
local extra="" name
|
|
27
|
+
for name in "${PASSED[@]}"; do extra+="<key>$name</key><string>$(xml_escape "${!name}")</string>"; done
|
|
19
28
|
mkdir -p "$HOME/Library/LaunchAgents" "$HOME/Library/Logs"
|
|
20
29
|
cat > "$plist" <<PL
|
|
21
30
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
22
31
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
23
32
|
<plist version="1.0"><dict>
|
|
24
33
|
<key>Label</key><string>local.whose-turn</string>
|
|
25
|
-
<key>ProgramArguments</key><array><string
|
|
34
|
+
<key>ProgramArguments</key><array><string>/bin/bash</string><string>$DIR/launch.sh</string></array>
|
|
26
35
|
<key>WorkingDirectory</key><string>$DIR</string>
|
|
27
|
-
<key>EnvironmentVariables</key><dict><key>PATH</key><string>$NODE_DIR:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string
|
|
36
|
+
<key>EnvironmentVariables</key><dict><key>PATH</key><string>$NODE_DIR:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string><key>WHOSE_TURN_NODE</key><string>$NODE</string>$extra</dict>
|
|
28
37
|
<key>RunAtLoad</key><true/>
|
|
29
38
|
<key>KeepAlive</key><true/>
|
|
30
39
|
<key>StandardOutPath</key><string>$log</string>
|
|
@@ -33,29 +42,32 @@ install_macos() {
|
|
|
33
42
|
PL
|
|
34
43
|
launchctl bootout "gui/$(id -u)" "$plist" 2>/dev/null || true
|
|
35
44
|
launchctl bootstrap "gui/$(id -u)" "$plist"
|
|
36
|
-
echo "Installed. The monitor runs at $URL and starts at login
|
|
45
|
+
echo "Installed. The monitor runs at $URL and starts at login.$PASSED_NOTE"
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
install_linux() {
|
|
40
49
|
command -v systemctl > /dev/null || { echo "systemd is needed: systemctl is not on PATH."; exit 1; }
|
|
41
50
|
local unit_dir=$HOME/.config/systemd/user
|
|
51
|
+
local extra="" name
|
|
52
|
+
for name in "${PASSED[@]}"; do extra+="Environment=\"$name=${!name}\""$'\n'; done
|
|
42
53
|
mkdir -p "$unit_dir"
|
|
43
54
|
cat > "$unit_dir/whose-turn.service" <<UNIT
|
|
44
55
|
[Unit]
|
|
45
56
|
Description=Whose Turn monitor
|
|
46
57
|
|
|
47
58
|
[Service]
|
|
48
|
-
ExecStart
|
|
59
|
+
ExecStart=/bin/bash "$DIR/launch.sh"
|
|
49
60
|
WorkingDirectory=$DIR
|
|
50
61
|
Environment=PATH=$NODE_DIR:/usr/local/bin:/usr/bin:/bin
|
|
51
|
-
|
|
62
|
+
Environment="WHOSE_TURN_NODE=$NODE"
|
|
63
|
+
${extra}Restart=on-failure
|
|
52
64
|
|
|
53
65
|
[Install]
|
|
54
66
|
WantedBy=default.target
|
|
55
67
|
UNIT
|
|
56
68
|
systemctl --user daemon-reload
|
|
57
69
|
systemctl --user enable --now whose-turn
|
|
58
|
-
echo "Installed. The monitor runs at $URL and starts at login. Logs: journalctl --user -u whose-turn"
|
|
70
|
+
echo "Installed. The monitor runs at $URL and starts at login. Logs: journalctl --user -u whose-turn.$PASSED_NOTE"
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
case "$(uname -s)" in
|
package/launch.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Starts server.mjs with whichever node the login shell resolves now, then PATH, then the install-time hint.
|
|
3
|
+
DIR=$(cd "$(dirname "$0")" && pwd -P)
|
|
4
|
+
NODE=""
|
|
5
|
+
if [[ -n ${SHELL:-} && -x $SHELL ]]; then
|
|
6
|
+
NODE=$("$SHELL" -lc 'command -v node' 2> /dev/null | tail -n 1)
|
|
7
|
+
fi
|
|
8
|
+
[[ -x $NODE ]] || NODE=$(command -v node) || NODE=""
|
|
9
|
+
[[ -x $NODE ]] || NODE=${WHOSE_TURN_NODE:-}
|
|
10
|
+
[[ -x $NODE ]] || { echo "whose-turn: no node found in the login shell or on PATH; install Node 22 or newer."; exit 1; }
|
|
11
|
+
exec "$NODE" "$DIR/server.mjs"
|