notemend 0.1.18 → 0.1.21
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/.claude-plugin/plugin.json +1 -1
- package/README.md +9 -5
- package/bin/notemend.mjs +15 -15
- package/package.json +1 -1
- package/src/client/index.js +248 -1
- package/src/client/notemend.css +1 -1
- package/src/hosting.mjs +1 -1
- package/src/next.mjs +1 -1
- package/src/server/middleware.mjs +1 -1
- package/src/store/cloud.mjs +3 -3
- package/src/store/comments.mjs +3 -3
- package/src/store/thread.mjs +1 -1
- package/store.d.ts +30 -5
- package/thread.d.ts +12 -3
- package/src/client/anchor.js +0 -1
- package/src/client/api.js +0 -1
- package/src/client/boot.js +0 -1
- package/src/client/canvas.js +0 -1
- package/src/client/config.js +0 -1
- package/src/client/devices.js +0 -1
- package/src/client/field-menu.js +0 -1
- package/src/client/inspect.js +0 -1
- package/src/client/logs.js +0 -1
- package/src/client/markup.js +0 -128
- package/src/client/panel.js +0 -43
- package/src/client/review.js +0 -7
- package/src/client/run.js +0 -74
- package/src/client/toplayer.js +0 -1
- package/src/client/turbo.js +0 -1
package/src/client/index.js
CHANGED
|
@@ -1 +1,248 @@
|
|
|
1
|
-
import"./notemend.css";import{start as t}from"./boot";t(),import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|
|
1
|
+
import"./notemend.css";var Xt={base:"",via:null,signed:{},live:!1};async function Rt(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<6e4&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!Xt.via)return fetch(`/__devbar/${n}`,r);let l=await Xt.via(n,r);if(l.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let g=await l.clone().json().catch(()=>null);g?.signed&&Object.assign(Xt.signed,g.signed)}return l}var ko=n=>Xt.via?Xt.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,mn=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),Q={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,r)=>{try{localStorage.setItem(n,r)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}};async function So(){let n=await Rt("config");if(!n.ok)throw new Error(`config ${n.status}`);let r=await n.json();return r.breakpoints=r.breakpoints.map(l=>({...l,max:l.max??1/0})),r}var Lo=["iPhone","Android","Foldable","Tablet","Laptop & display"],We=[{id:"iphone-se",label:"iPhone SE",group:"iPhone",w:375,h:667,dpr:2,rotates:!0,mobile:!0},{id:"iphone-xr",label:"iPhone XR",group:"iPhone",w:414,h:896,dpr:2,rotates:!0,mobile:!0,insets:{left:0,top:44,right:0,bottom:34},cutout:{shape:"notch",x:92,y:0,width:231,height:33,"upper-radius":6,"lower-radius":25}},{id:"iphone-12-pro",label:"iPhone 12 Pro",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:90,y:0,width:210,height:32,"upper-radius":6,"lower-radius":23}},{id:"iphone-14",label:"iPhone 14",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-plus",label:"iPhone 14 Plus",group:"iPhone",w:428,h:926,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:133,y:0,width:161,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-pro",label:"iPhone 14 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-14-pro-max",label:"iPhone 14 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15",label:"iPhone 15",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-plus",label:"iPhone 15 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro",label:"iPhone 15 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16e",label:"iPhone 16e",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-16",label:"iPhone 16",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-plus",label:"iPhone 16 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro",label:"iPhone 16 Pro",group:"iPhone",w:402,h:874,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:139,y:14,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro-max",label:"iPhone 16 Pro Max",group:"iPhone",w:440,h:956,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:158,y:14,width:125,height:37,"border-radius":19}},{id:"jiophone-2",label:"JioPhone 2",group:"Android",w:240,h:320,dpr:1,rotates:!0,mobile:!0},{id:"pixel-7",label:"Pixel 7",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:52,right:0,bottom:0},cutout:{shape:"circle",x:183,y:0,width:55,height:52,cx:206,cy:26,radius:13}},{id:"pixel-8",label:"Pixel 8",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:182,y:0,width:46,height:50,cx:206,cy:25,radius:14}},{id:"pixel-8-pro",label:"Pixel 8 Pro",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:37,height:50,cx:224,cy:25,radius:14}},{id:"pixel-8a",label:"Pixel 8a",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:46,right:0,bottom:0},cutout:{shape:"circle",x:185,y:0,width:42,height:46,cx:206,cy:26,radius:13}},{id:"pixel-9",label:"Pixel 9",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"pixel-9-pro",label:"Pixel 9 Pro",group:"Android",w:427,h:952,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:68,right:0,bottom:0},cutout:{shape:"circle",x:195,y:0,width:36,height:68,cx:213,cy:34,radius:16}},{id:"pixel-9-pro-xl",label:"Pixel 9 Pro XL",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:66,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:38,height:66,cx:224,cy:33,radius:16}},{id:"pixel-10",label:"Pixel 10",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"samsung-galaxy-s8",label:"Samsung Galaxy S8+",group:"Android",w:360,h:740,dpr:4,rotates:!0,mobile:!0},{id:"samsung-galaxy-a55",label:"Samsung Galaxy A55",group:"Android",w:360,h:800,dpr:2.25,rotates:!0,mobile:!0},{id:"samsung-galaxy-s20-ultra",label:"Samsung Galaxy S20 Ultra",group:"Android",w:412,h:915,dpr:3.5,rotates:!0,mobile:!0},{id:"samsung-galaxy-a51-71",label:"Samsung Galaxy A51/71",group:"Android",w:412,h:914,dpr:2.625,rotates:!0,mobile:!0},{id:"facebook-on-android",label:"Facebook on Android",group:"Android",w:412,h:892,dpr:3.5,rotates:!0,mobile:!0},{id:"moto-g4",label:"Moto G4",group:"Android",w:360,h:640,dpr:3,rotates:!0,mobile:!0},{id:"moto-g-power",label:"Moto G Power",group:"Android",w:412,h:823,dpr:1.75,rotates:!0,mobile:!0},{id:"surface-duo",label:"Surface Duo",group:"Foldable",w:540,h:720,dpr:2.5,rotates:!0,mobile:!0},{id:"pixel-9-pro-fold",label:"Pixel 9 Pro Fold",group:"Foldable",w:412,h:922,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-6",label:"Galaxy Z Fold 6",group:"Foldable",w:412,h:968,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-5",label:"Galaxy Z Fold 5",group:"Foldable",w:344,h:882,dpr:2.625,rotates:!0,mobile:!0},{id:"asus-zenbook-fold",label:"Asus Zenbook Fold",group:"Foldable",w:853,h:1280,dpr:1.5,rotates:!0,mobile:!1},{id:"ipad-mini",label:"iPad Mini",group:"Tablet",w:768,h:1024,dpr:2,rotates:!0,mobile:!0},{id:"ipad-pro-13",label:"iPad Pro 13",group:"Tablet",w:1032,h:1376,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-7",label:"Surface Pro 7",group:"Tablet",w:912,h:1368,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-10",label:"Surface Pro 10",group:"Tablet",w:960,h:1440,dpr:2,rotates:!0,mobile:!0},{id:"galaxy-tab-s4",label:"Galaxy Tab S4",group:"Tablet",w:712,h:1138,dpr:2.25,rotates:!0,mobile:!0},{id:"nest-hub-max",label:"Nest Hub Max",group:"Laptop & display",w:1280,h:800,dpr:2,rotates:!1,mobile:!0},{id:"laptop-with-touch",label:"Laptop with touch",group:"Laptop & display",w:1280,h:950,dpr:1,rotates:!1,mobile:!1},{id:"laptop-with-hidpi-screen",label:"Laptop with HiDPI screen",group:"Laptop & display",w:1440,h:900,dpr:2,rotates:!1,mobile:!1},{id:"laptop-with-mdpi-screen",label:"Laptop with MDPI screen",group:"Laptop & display",w:1280,h:800,dpr:1,rotates:!1,mobile:!1}];var hr=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null;var de={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},gr=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((n,r)=>[n,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][r]])),To=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>gr[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Xn=n=>{let r=String(n??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r),p=g&&Object.keys(de).find(x=>de[x]===g[1]);return p?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${p}`:null}let l=/-\d+(?:\.([\w-]+))?\.(pdf|docx?)(?:\?|$)/i.exec(r.split("/").pop());return l?`${l[1]||"document"}.${l[2].toLowerCase()}`:null},be=n=>{let r=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[]},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(l=>({...l,images:[]}))];for(let l of n.images||[]){if(hr(l))continue;let g=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(l)?.[1]),p=0;r.forEach((x,M)=>{Date.parse(x.at)<=g&&(p=M)}),r[p].images.push(l)}return r.filter(l=>!l.deleted)},Ao=n=>n.nickname||n.name||n.email,br=(n,r)=>{let l="@"+r.toLowerCase(),g=-1;for(let p=n.indexOf(l);p!==-1;p=n.indexOf(l,p+1))/[\p{L}\p{N}_.-]/u.test(n[p+l.length]??"")||(g=p);return g};var fr={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Ce=n=>fr[n]||(n?"AI agent":"Claude"),Jn="3.6 3.6 10.8 10.8",Zn="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",Qn=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,wt=n=>n==="claude"||Qn(n)!=null;var yr=["new","approved","progress","review","waiting","accepted"],Ot=n=>yr.includes(n?.stage)?n.stage:wt(n?.assignee)?"approved":"new";var hn=()=>[{assignee:"claude",handle:"Claude",owner:null}],ts=(n,r=[])=>{let l=String(n||"").toLowerCase(),g=null,p=-1;for(let x of hn()){let M=br(l,x.handle);M>p&&(p=M,g=x.assignee)}return g};var vr=2*36e5,ze=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<vr?n.working:null,wr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),es=n=>wr(n.by)&&!n.approvedBy,Ft=(n,r=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":wt(n.assignee)?"done":null;if(n.stage==="accepted")return wt(n.assignee)?"done":null;if(es(n))return"held";if(!wt(n.assignee))return null;let l=be(n),g=l[l.length-1];return l.length>1&&g.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(g.at))?"asks":ze(n,r)?"working":n.working?"stuck":Ot(n)==="approved"?"queued":null};var Co=Zn.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[l,g]=/H/.test(n)?[r[2],r[1]]:/V/.test(n)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+n,a:(Math.atan2(l-9,9-g)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var y=n=>n.replace(/[&<>"]/g,r=>({"&":"&","<":"<",">":">",'"':"""})[r]),Ve=n=>n?new Date(n).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",fe='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',It='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',Ue='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',ce='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',Ho='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M12 5l-5 5 5 5" stroke-linejoin="round"/></svg>',Bo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',He='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',Jt=n=>`<svg viewBox="${Jn}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${Zn}" stroke-width="1.15" stroke-linecap="round"/></svg>`,ns=(n,r)=>`<svg viewBox="${Jn}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Co.map((l,g)=>`<path d="${l}" stroke-width="1.15" stroke-linecap="round"${g<r?"":' class="is-off"'}/>`).join("")}</svg>`,$t=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`;function Ro(n){let r=location.pathname.replace(/\/$/,"")||"/",l=n.client?' style="display:none"':"",g=n.breakpoints.map(h=>["new","progress","review","waiting","accepted","done"].map(m=>`<b data-bp="${y(h.id)}" data-state="${m}" hidden>${$t(h.icon,11)}<i></i></b>`).join("")).join(""),p=n.groups.map(h=>`<li class="dt-pages-group">${y(h)}</li>`+n.pages.filter(m=>m.group===h).map(m=>`<li><a href="${/^\/(?![\/\\])/.test(m.route)?y(m.route):"#"}"${m.route===r?' aria-current="page"':""}><span class="dt-menu-label">${y(m.label)}</span><em class="dt-pages-n" hidden>${g}</em></a></li>`).join("")).join(""),x=[...new Set(n.devices.map(h=>h.group))].map(h=>`<p class="dt-devices-group">${y(h)}</p>`+n.devices.filter(m=>m.group===h).map(m=>`<button type="button" data-device="${y(m.id)}" aria-pressed="false"${m.note?` title="${y(m.note)}"`:""}><span class="dt-menu-label">${y(m.label)}</span><em>${m.w}×${m.h}</em></button>`).join("")).join(""),M=Lo.map(h=>`<p class="dt-devices-group">${y(h)}</p>`+We.filter(m=>m.group===h).map(m=>`<button type="button" data-emu="${y(m.id)}" aria-pressed="false"><span class="dt-menu-label">${y(m.label)}</span><em>${m.w}×${m.h}</em></button>`).join("")).join(""),H=n.breakpoints.map(h=>`<button class="dt-icon dt-bp" type="button" data-bp="${y(h.id)}" aria-pressed="false" title="${y(h.label)}">${$t(h.icon,16)}</button>`).join(""),$=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),A="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
|
+
<!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
|
|
3
|
+
<div class="devtools">
|
|
4
|
+
${n.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(n.brand.logo)?`<img class="dt-brand" src="${y(n.brand.logo)}" alt="" />`:""}
|
|
5
|
+
<div class="dt-group dt-group--menus">
|
|
6
|
+
<details class="dt-pages" name="dt-menu">
|
|
7
|
+
<summary aria-label="Pages" title="Pages">
|
|
8
|
+
${$t('<rect x="4.5" y="2.5" width="11" height="15" rx="1.5" /><path d="M7.5 6.6h5M7.5 10h5M7.5 13.4h3" />')}
|
|
9
|
+
<span class="dt-pages-name">${y(r)}</span>
|
|
10
|
+
</summary>
|
|
11
|
+
<ul>${p}</ul>
|
|
12
|
+
</details>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="dt-group" role="group" aria-label="Inspect"${l}>
|
|
16
|
+
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
17
|
+
${$t('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
18
|
+
</button>
|
|
19
|
+
<button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
|
|
20
|
+
${$t('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
|
|
21
|
+
</button>
|
|
22
|
+
<button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
|
|
23
|
+
${$t('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
|
|
24
|
+
</button>
|
|
25
|
+
<button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
|
|
26
|
+
${$t('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
|
|
27
|
+
</button>
|
|
28
|
+
<button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
|
|
29
|
+
${$t('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
|
|
30
|
+
</button>
|
|
31
|
+
<button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
|
|
32
|
+
${$t('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
|
|
33
|
+
</button>
|
|
34
|
+
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${n.sanity?"":" hidden"}>
|
|
35
|
+
${$t('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div class="dt-group" role="group" aria-label="Comments">
|
|
40
|
+
<button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
|
|
41
|
+
${$t('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
|
|
42
|
+
<span class="dt-notes-count" hidden></span>
|
|
43
|
+
</button>
|
|
44
|
+
<button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
|
|
45
|
+
${$t('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
|
|
46
|
+
</button>
|
|
47
|
+
<!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
|
|
48
|
+
<button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
|
|
49
|
+
${$t('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="dt-group dt-bps" role="group" aria-label="Breakpoint">${H}</div>
|
|
54
|
+
|
|
55
|
+
<div class="dt-group dt-group--menus">
|
|
56
|
+
<details class="dt-devices" name="dt-menu">
|
|
57
|
+
<summary title="Devices">
|
|
58
|
+
${$t('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
|
|
59
|
+
<span class="dt-devices-name">Device</span>
|
|
60
|
+
</summary>
|
|
61
|
+
<div class="dt-devices-menu">
|
|
62
|
+
<div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
|
|
63
|
+
<button type="button" role="tab" data-tab="preview" aria-selected="true">Preview</button>
|
|
64
|
+
<button type="button" role="tab" data-tab="devtools" aria-selected="false">DevTools</button>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
67
|
+
<p class="dt-menu-note">The screens most visitors use, with the browser around the page. Comments go to the breakpoint its width falls in, with the device named.</p>
|
|
68
|
+
${x}
|
|
69
|
+
</div>
|
|
70
|
+
<div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
|
|
71
|
+
<p class="dt-menu-note">Opens the canvas at the device's size. Comments go to its breakpoint.</p>
|
|
72
|
+
<input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
|
|
73
|
+
${M}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</details>
|
|
77
|
+
<!-- the list is written by the script, from the same table that runs the keys -->
|
|
78
|
+
<details class="dt-keys" name="dt-menu"${n.shortcuts?"":" hidden"}>
|
|
79
|
+
<summary class="dt-icon" title="Shortcuts">
|
|
80
|
+
${$t('<rect x="2" y="5" width="16" height="10" rx="2" /><path d="M5.5 8.5h.01M8.5 8.5h.01M11.5 8.5h.01M14.5 8.5h.01M6.5 12h7" />')}
|
|
81
|
+
</summary>
|
|
82
|
+
<div class="dt-keys-menu"></div>
|
|
83
|
+
</details>
|
|
84
|
+
</div>
|
|
85
|
+
<!-- turbo: its own round button beside the bar, always there for the studio \u2014 lit while
|
|
86
|
+
an agent session takes comments, grey when none is listening or it is paused here -->
|
|
87
|
+
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${n.client?" hidden":""}>
|
|
88
|
+
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${$t('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
|
|
89
|
+
</button>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<!-- The handle under the bar, on the window's bottom edge. Its own element, not the
|
|
93
|
+
bar's child: it stays put while the bar slides away. -->
|
|
94
|
+
<button class="dt-tab" type="button" aria-expanded="true" aria-label="Hide the bar">
|
|
95
|
+
<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M5.5 8 10 12.5 14.5 8" /></svg>
|
|
96
|
+
</button>
|
|
97
|
+
|
|
98
|
+
<div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
|
|
99
|
+
<div class="dt-stage">
|
|
100
|
+
<span class="dt-frame-handle" data-edge="l" title="${A}"></span>
|
|
101
|
+
<div class="dt-device">
|
|
102
|
+
<div class="dt-shell"></div>
|
|
103
|
+
<iframe title="Breakpoint preview"></iframe>
|
|
104
|
+
<div class="dt-chrome" data-at="top"></div>
|
|
105
|
+
<div class="dt-chrome" data-at="bottom"></div>
|
|
106
|
+
</div>
|
|
107
|
+
<span class="dt-frame-handle" data-edge="r" title="${A}"></span>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="dt-ruler"></div>
|
|
110
|
+
<span class="dt-frame-size"></span>
|
|
111
|
+
<button class="dt-frame-bars dt-frame-btn" type="button" hidden title="Browser bars: shown / folded on scroll">
|
|
112
|
+
<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3v14M6.5 6.5 10 3l3.5 3.5M6.5 13.5 10 17l3.5-3.5" /></svg>
|
|
113
|
+
</button>
|
|
114
|
+
<button class="dt-frame-rotate dt-frame-btn" type="button" hidden title="Rotate">
|
|
115
|
+
<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M14.5 5.5A6.5 6.5 0 1 0 16.5 10" /><path d="M16.8 3.6v3.4h-3.4" /></svg>
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<aside class="dt-history" hidden aria-label="Comment history"></aside>
|
|
120
|
+
<div class="dt-notes-hi" hidden aria-hidden="true"><span class="dt-hi-box"></span><span class="dt-hi-tag"></span></div>
|
|
121
|
+
<div class="dt-notes-overlay" hidden role="region" aria-label="Comments on this page"></div>
|
|
122
|
+
<div class="dt-grid-overlay" hidden aria-hidden="true">
|
|
123
|
+
<div class="${y(n.grid.container)} dt-overlay-container">
|
|
124
|
+
<div class="${y(n.grid.grid)} dt-overlay-grid">${$}</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
128
|
+
`)}var No=[{id:"general",label:"General",color:"#0d99ff",icon:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>'},{id:"bug",label:"Bug",color:"#e5484d",icon:'<path d="m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3 3 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4"/>'},{id:"text",label:"Text",color:"#f5c451",icon:'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'},{id:"motion",label:"Motion",color:"#a475f9",icon:'<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2M9.6 4.6A2 2 0 1 1 11 8H2M12.6 19.4A2 2 0 1 0 14 16H2"/>'},{id:"design",label:"Design",color:"#d6409f",icon:'<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.97 6.01 17.46 2 12 2z"/><circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/>'},{id:"content",label:"Content",color:"#30a46c",icon:'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8"/>'}],ss=(n,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,ye=n=>No.find(r=>r.id===n)||No[0];var ct=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",Po={open:"Open",done:"Resolved",claude:"Resolved by an agent"};var Mt={ready:Promise.resolve(),toggle:(n,r)=>{Mt.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{Mt.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var $r=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Do=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace($r,"$1\u2022\u2022\u2022").replace(/\b(Bearer|Basic|Token)\s+[\w.~+/=-]+/gi,"$1 \u2022\u2022\u2022").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"\u2022\u2022\u2022");var gn=[],os=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},ve=(n,r)=>{gn.push({at:new Date().toISOString(),kind:n,text:Do(r.replace(/\s+/g," ").trim()).slice(0,500)}),gn.length>50&&gn.shift()},Oo=!1;function Io(n){if(Oo||typeof window>"u")return;Oo=!0;let r=console.error;console.error=(...p)=>{ve("console",p.map(os).join(" ")),r.apply(console,p)},addEventListener("error",p=>{if(p instanceof ErrorEvent)return ve("error",`${p.message}${p.filename?` (${p.filename}:${p.lineno})`:""}`);let x=p.target,M=x?.src||x?.href;M&&!n(M)&&ve("network",`${x.tagName?.toLowerCase()} ${M} did not load`)},!0),addEventListener("unhandledrejection",p=>ve("rejection",os(p.reason)));let l=window.fetch;window.fetch=async(p,x)=>{let M=typeof p=="string"?p:p instanceof URL?p.href:p.url,H=(x?.method||(p instanceof Request?p.method:"GET")).toUpperCase();try{let $=await l.call(window,p,x);return $.status>=400&&!n(M)&&ve("network",`${H} ${M} \u2192 ${$.status}`),$}catch($){throw!n(M)&&$?.name!=="AbortError"&&ve("network",`${H} ${M} \u2192 no answer (${os($)})`),$}};let g=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(p,x,...M){return this._nm=`${p.toUpperCase()} ${String(x)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(x))||ve("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),g.call(this,p,x,...M)}}var qo=(n=Date.now())=>gn.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function Fo(n){let r=b=>{let i=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,f=b/i;return Math.round(f*10)%10===0?String(Math.round(f)):f.toFixed(1)},l=(b,i,f,C,R,K="p")=>{if(f<=0||C<=0)return"";let D=R!==""?`<span class="dt-pad-chip dt-pad-chip--${K}" style="left:${b+f/2}px;top:${i+C/2}px">${R}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${K}" style="left:${b}px;top:${i}px;width:${f}px;height:${C}px"></span>${D}`},g=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],p=b=>{let i=b;for(let f=0;i&&f<6;f++,i=i.parentElement){let C=getComputedStyle(i);if(g.some(R=>parseFloat(C[R])>=2))return i}return b},x=(b,i)=>{let f=parseFloat(i.columnGap)||0,C=parseFloat(i.rowGap)||0;if(!(i.display.includes("flex")||i.display.includes("grid"))||!f&&!C)return"";let R=[...b.children].map(D=>D.getBoundingClientRect()).filter(D=>D.width||D.height),K="";for(let D=1;D<R.length;D++){let N=R[D-1],j=R[D];if(f&&j.left>=N.right-1){let W=Math.max(N.top,j.top);K+=l(N.right,W,j.left-N.right,Math.min(N.bottom,j.bottom)-W,r(f),"g")}else if(C&&j.top>=N.bottom-1){let W=Math.min(N.left,j.left);K+=l(W,N.bottom,Math.max(N.right,j.right)-W,j.top-N.bottom,r(C),"g")}}return K},M=b=>`<span class="dt-pad-outline" style="left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px"></span>`,H=(b,i,f="")=>`<span class="dt-pad-tag" style="left:${i.left}px;top:${Math.max(2,i.top-22)}px">${b.tagName.toLowerCase()+(b.classList[0]?"."+b.classList[0]:"")}${f}</span>`,$=b=>{let i=b.getBoundingClientRect(),f=getComputedStyle(b),C=parseFloat(f.paddingTop),R=parseFloat(f.paddingRight),K=parseFloat(f.paddingBottom),D=parseFloat(f.paddingLeft),N=M(i);N+=l(i.left,i.top,i.width,C,C>=2?r(C):""),N+=l(i.left,i.bottom-K,i.width,K,K>=2?r(K):""),N+=l(i.left,i.top+C,D,i.height-C-K,D>=2?r(D):""),N+=l(i.right-R,i.top+C,R,i.height-C-K,R>=2?r(R):"");let j=parseFloat(f.marginTop),W=parseFloat(f.marginRight),pt=parseFloat(f.marginBottom),gt=parseFloat(f.marginLeft);N+=l(i.left,i.top-j,i.width,j,j>=2?r(j):"","m"),N+=l(i.left,i.bottom,i.width,pt,pt>=2?r(pt):"","m"),N+=l(i.left-gt,i.top,gt,i.height,gt>=2?r(gt):"","m"),N+=l(i.right,i.top,W,i.height,W>=2?r(W):"","m"),N+=x(b,f);let Ht=parseFloat(f.columnGap)||0,Lt=parseFloat(f.rowGap)||0,Bt=(f.display.includes("flex")||f.display.includes("grid"))&&(Ht||Lt)?` \xB7 gap ${r(Ht)}${Lt&&Lt!==Ht?"/"+r(Lt):""}`:"";n.innerHTML=N+H(b,i,Bt)},A=b=>{let i=b.getBoundingClientRect();n.innerHTML=M(i)+`<span class="dt-pad-chip" style="left:${i.left+i.width/2}px;top:${i.top+i.height/2}px">${r(i.width)} \xD7 ${r(i.height)}</span>`+H(b,i)},h=b=>{let i=(b.match(/[\d.]+/g)||[]).map(Number);if(i.length<3)return b;let f="#"+i.slice(0,3).map(C=>Math.round(C).toString(16).padStart(2,"0")).join("");return i[3]!==void 0&&i[3]<1?`${f} \xB7 ${Math.round(i[3]*100)}%`:f},m=null,k=()=>{if(m)return m;let b=getComputedStyle(document.documentElement),i=document.createElement("span");i.style.display="none",document.body.append(i);let f=[];for(let C of Array.from(b)){if(!C.startsWith("--"))continue;let R=b.getPropertyValue(C).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(R))continue;i.style.color="rgb(1, 2, 3)",i.style.color=R;let K=getComputedStyle(i).color;K&&K!=="rgb(1, 2, 3)"&&f.push([K,C])}return i.remove(),f.sort((C,R)=>C[1].length-R[1].length),m=f,f},O=b=>k().find(([i])=>i===b)?.[1]??"",z=null,I=()=>{if(z)return z;let b=[],i=f=>{for(let C of Array.from(f))C instanceof CSSStyleRule?C.style.cssText.includes("var(--")&&b.push({sel:C.selectorText,style:C.style}):C instanceof CSSMediaRule?matchMedia(C.conditionText).matches&&i(C.cssRules):"cssRules"in C&&i(C.cssRules)};for(let f of Array.from(document.styleSheets))try{i(f.cssRules)}catch{}return z=b},q={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(b=>[`border-${b}-color`,[`border-${b}-color`,"border-color",`border-${b}`,"border"]]))},U=(b,i)=>{let f=q[i]??[i],C=i==="color";for(let R=b;R;R=C?R.parentElement:null){let K=j=>f.map(W=>/var\(\s*(--[\w-]+)/.exec(j.getPropertyValue(W))?.[1]).find(Boolean),D=R instanceof HTMLElement?K(R.style):void 0;if(D)return D;let N="";for(let j of I()){let W=!1;try{W=R.matches(j.sel)}catch{}W&&(N=K(j.style)||N)}if(N)return N;if(C&&R.parentElement&&getComputedStyle(R).color!==getComputedStyle(R.parentElement).color)break}return""},et=(b,i,f)=>{let C=U(b,i);if(C)return`<b class="dt-var">${C}</b> <em>${h(f)}</em>`;let R=O(f);return R?`<span title="Same value as ${R}; not written with it">\u2248 ${R}</span> <em>${h(f)}</em>`:h(f)},at=b=>`<i class="dt-type-sw" style="background:${b}"></i>`,kt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},St=b=>(b.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),vt=(b,i)=>b.slice(0,3).map((f,C)=>f*b[3]+i[C]*(1-b[3])).concat([1]),ot=b=>{let i=[];for(let f=b;f;f=f.parentElement){let C=getComputedStyle(f);if(C.backgroundImage!=="none")return null;let R=St(C.backgroundColor);if(R[3]>0&&(i.push(R),R[3]>=1))break}return i.reduceRight((f,C)=>vt(C,f),[255,255,255,1])},At=b=>{let[i,f,C]=b.slice(0,3).map(R=>(R/=255,R<=.03928?R/12.92:((R+.055)/1.055)**2.4));return .2126*i+.7152*f+.0722*C},Ct=(b,i,f)=>{let C=ot(b);if(!C)return["Contrast","<em>on an image</em>"];let R=vt(St(i.color),C),[K,D]=[At(R),At(C)].sort((pt,gt)=>gt-pt),N=(K+.05)/(D+.05),j=f>=24||f>=18.66&&Number(i.fontWeight)>=700,W=N>=(j?4.5:7)?"AAA":N>=(j?3:4.5)?"AA":"fails AA";return["Contrast",`${N.toFixed(2)}:1 <em class="${W==="fails AA"?"dt-type-bad":""}">${W}${j?" \xB7 large":""}</em>`]},E=b=>{let i=b.getBoundingClientRect(),f=getComputedStyle(b),C=parseFloat(f.fontSize),R=f.lineHeight==="normal"?0:parseFloat(f.lineHeight),K=parseFloat(f.letterSpacing)||0,D=gt=>`${(gt*100).toFixed(1).replace(/\.0$/,"")}%`,N=[["Font",f.fontFamily.split(",")[0].replace(/["']/g,"")+(f.fontStyle!=="normal"?` ${f.fontStyle}`:"")],["Weight",`${kt[f.fontWeight]??""} <em>${f.fontWeight}</em>`],["Size",`${r(C)}px`],["Line",R?`${D(R/C)} <em>${r(R)}px</em>`:"normal"],["Letter",K?`${D(K/C)} <em>${K.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",at(f.color)+et(b,"color",f.color)],Ct(b,f,C)],W=i.bottom+150<innerHeight?i.bottom+8:Math.max(8,i.top-158),pt=Math.min(Math.max(8,i.left),innerWidth-210);n.innerHTML=M(i)+H(b,i)+`<div class="dt-type-card" style="left:${pt}px;top:${W}px">${N.map(([gt,Ht])=>`<span class="dt-type-row"><b>${gt}</b><span>${Ht}</span></span>`).join("")}</div>`},J=b=>b.every(i=>i===b[0])?b[0]:b[1]===b[3]&&b[0]===b[2]?`${b[0]} ${b[1]}`:b.join(" "),ut=b=>/^rgba\(.*,\s*0\)$|^transparent$/.test(b),Nt=(b,i,f,C="")=>{let R=16+f.length*18,D=i.bottom+R+12<innerHeight?i.bottom+8:Math.max(8,i.top-R-8),N=Math.min(Math.max(8,i.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${i.left}px;top:${i.top}px;width:${i.width}px;height:${i.height}px${C?`;border-radius:${C}`:""}"></span>`+H(b,i)+`<div class="dt-type-card dt-style-card" style="left:${N}px;top:${D}px">${f.map(([j,W])=>`<span class="dt-type-row"><b>${j}</b><span>${W}</span></span>`).join("")}</div>`};return{spacer:p,drawPads:$,drawSize:A,drawType:E,drawColor:b=>{let i=getComputedStyle(b),f=[];i.backgroundImage!=="none"&&f.push(["Fill",`<em>${/gradient/.test(i.backgroundImage)?"gradient":"image"}</em>`]),ut(i.backgroundColor)||f.push(["Fill",at(i.backgroundColor)+et(b,"background-color",i.backgroundColor)]),b.textContent?.trim()&&f.push(["Text",at(i.color)+et(b,"color",i.color)]),Number(i.opacity)<1&&f.push(["Opacity",`${Math.round(Number(i.opacity)*100)}%`]),f.length||f.push(["Color","<em>no fill or text</em>"]),Nt(b,b.getBoundingClientRect(),f)},drawBorder:b=>{let i=getComputedStyle(b),f=[],C=["top","right","bottom","left"],R=C.map(D=>parseFloat(i.getPropertyValue(`border-${D}-width`))||0);if(R.some(D=>D>0)){let D=C.filter((j,W)=>R[W]>0);f.push(["Width",`${J(R.map(r))} <em>${i.getPropertyValue(`border-${D[0]}-style`)}</em>`]);let N=D.map(j=>i.getPropertyValue(`border-${j}-color`));D.forEach((j,W)=>{W&&N[W]===N[0]||f.push([W?`\u21B3 ${j}`:"Color",at(N[W])+et(b,`border-${j}-color`,N[W])])})}else f.push(["Width","<em>none</em>"]);let K=["top-left","top-right","bottom-right","bottom-left"].map(D=>{let[N,j=N]=i.getPropertyValue(`border-${D}-radius`).split(" "),W=pt=>pt.endsWith("%")?pt:r(parseFloat(pt)||0);return N===j?W(N):`${W(N)}/${W(j)}`});f.push(["Radius",J(K)]),Nt(b,b.getBoundingClientRect(),f,i.borderRadius)}}}var jt=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim();function jo(){let n=h=>{let m=[],k=h;for(;k&&k.tagName!=="HTML"&&m.length<8;){if(k.id){m.unshift("#"+CSS.escape(k.id));break}let O=k.parentElement,z=k.tagName.toLowerCase(),I=O?[...O.children].filter(q=>q.tagName===k.tagName):[];m.unshift(I.length>1?`${z}:nth-of-type(${I.indexOf(k)+1})`:z),k=O}return m.join(">")},r=(h,m)=>!m||jt(h.textContent||"").slice(0,60)===m,l=(h,m)=>[h||"*",...(m||[]).map(k=>"."+CSS.escape(k))].join(""),g=h=>{try{return[...document.querySelectorAll(l(h.tag,h.classes))]}catch{return[]}},p=h=>{let m=jt(h.textContent||"").replace(/\s+/g," ");for(let k=h.parentElement,O=0;k&&k!==document.body&&O<4;k=k.parentElement,O++){let z=jt(k.textContent||"").replace(/\s+/g," ");if(z&&z!==m)return z}return""},x=h=>p(h).slice(0,80),M=(h,m)=>!m||p(h).startsWith(m),H=h=>{let m=null;try{m=document.querySelector(h.selector)}catch{m=null}if(m&&r(m,h.label)&&M(m,h.ctx))return m;let k=g(h),O=jt(h.label)?k.filter(I=>r(I,h.label)):[];return(O.find(I=>M(I,h.ctx))??k.find(I=>h.ctx&&M(I,h.ctx)&&!jt(h.label)))||O[0]||(m&&r(m,h.label)?m:null)||(h.nth!=null?k[h.nth]:null)||k[0]||m},$=h=>{let m=null;for(let k=h,O=h.parentElement;O&&O!==document.body&&getComputedStyle(k).position!=="fixed";k=O,O=O.parentElement){let z=getComputedStyle(O);if(z.overflowX==="visible"&&z.overflowY==="visible")continue;let I=O.getBoundingClientRect();m=m?{l:Math.max(m.l,I.left),t:Math.max(m.t,I.top),r:Math.min(m.r,I.right),b:Math.min(m.b,I.bottom)}:{l:I.left,t:I.top,r:I.right,b:I.bottom}}return m};return{cssPath:n,poolOf:g,contextOf:x,resolveEl:H,anchorOf:(h,m=H(h))=>{if(!m)return null;let k=m.getBoundingClientRect();if(!k.width&&!k.height)return null;let O=k.left+k.width*h.rx,z=k.top+k.height*h.ry,I=$(m);if(!I)return{x:O,y:z,off:"",el:m};if(I.r-I.l<18||I.b-I.t<18)return null;let q=Math.min(Math.max(O,I.l),I.r-18),U=Math.min(Math.max(z,I.t+18),I.b),et=O<I.l?"l":O>I.r-18?"r":z<I.t+18?"t":z>I.b?"b":"";return{x:q,y:U,off:et,el:m}}}}var _o=(n,r)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(l=>`<rect x="${.5+l*3}" y="${8.5-l*2.5}" width="2" height="${3+l*2.5}" rx="0.6" fill="${r}" stroke="none" opacity="${l<n?1:.28}"/>`).join("")}</svg>`;function Wo(n,r,l){let g=document.createElement("div");g.className="dt-field-menu",g.setAttribute("role","listbox"),g.hidden=!0,document.body.append(g);for(let M of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])g.addEventListener(M,H=>H.stopPropagation());let p=null,x=()=>{g.hidden=!0,p=null};n.addEventListener("mousedown",M=>{let H=M.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!H){g.contains(M.target)||x();return}if(M.preventDefault(),p===H){x();return}p=H;let $=H.classList.contains("dt-more-select"),A=k=>$?k.dataset.on!=null:k.selected;g.innerHTML=[...H.options].map((k,O)=>k.hidden?"":`${k.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${O}" aria-selected="${A(k)}"${k.dataset.danger!=null?' class="is-danger"':""}>${k.dataset.icon?k.dataset.icon:k.dataset.initial!=null?k.dataset.face?`<img class="dt-face" src="${r(k.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(k.dataset.initial)}</b>`:`<i style="background:${r(k.dataset.c||"#717171")}"></i>`}<span>${r(k.text)}</span>${k.dataset.hint?`<small>${r(k.dataset.hint)}</small>`:""}${A(k)?l:""}</button>`).join("");let h=H.parentElement.getBoundingClientRect();g.style.left=`${h.left}px`,g.style.top=`${h.bottom+4}px`,g.style.minWidth=`${h.width}px`,g.hidden=!1;let m=g.getBoundingClientRect();m.bottom>innerHeight-8&&(g.style.top=`${h.top-4-m.height}px`),m.right>innerWidth-8&&(g.style.left=`${Math.max(8,h.right-m.width)}px`)}),g.addEventListener("click",M=>{let H=M.target.closest("[data-i]");if(!H||!p)return;let $=p;x(),!($.selectedIndex===Number(H.dataset.i)&&!$.classList.contains("dt-more-select"))&&($.selectedIndex=Number(H.dataset.i),$.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",M=>{M.key==="Escape"&&!g.hidden&&(M.stopPropagation(),x())},!0),document.addEventListener("pointerdown",M=>{!g.hidden&&!g.contains(M.target)&&!M.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&x()},!0),addEventListener("scroll",M=>{g.contains(M.target)||x()},!0)}var $e=n=>n.replace(/[&<>"]/g,r=>({"&":"&","<":"<",">":">",'"':"""})[r]),_={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},as=(n,r)=>n.toLocaleTimeString("en-US",r),bn=n=>as(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),xr={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function Er(n,r,l,g,p){let x=n.w+2*r.side,M=n.h+r.top+r.bottom,H=(l-x)/2,$=`<rect class="dt-shell-screen" x="${p}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,A="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let h=(m,k,O)=>`<rect class="dt-shell-btn" x="${m}" y="${k}" width="4" height="${O}" rx="2"/>`;A+=n.shell==="punch"?h(H+x-1,150,70)+h(H+x-1,240,44):h(H-3,120,28)+h(H-3,170,56)+h(H-3,236,56)+h(H+x-1,190,90),A+=`<rect class="dt-shell-body" x="${H}" y="0" width="${x}" height="${M}" rx="${r.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${x-6}" height="${M-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(A+=`<rect class="dt-shell-slot" x="${l/2-26}" y="44" width="52" height="6" rx="3"/>`,A+=`<circle class="dt-shell-slot" cx="${l/2-48}" cy="47" r="5"/>`,A+=`<circle class="dt-shell-homebtn" cx="${l/2}" cy="${M-46}" r="28"/>`)}else if(n.shell==="tablet")A+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${x}" height="${M}" rx="${r.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${x-8}" height="${M-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let h=Math.round(x*.1);A+=`<path class="dt-shell-stand" d="M${l/2-h/2} ${M-2}h${h}l${h*.2} 84h${-h*1.4}z"/>`,A+=`<rect class="dt-shell-stand" x="${l/2-x*.15}" y="${M+80}" width="${x*.3}" height="14" rx="7"/>`,A+=`<rect class="dt-shell-body" x="${H}" y="0" width="${x}" height="${M}" rx="${r.body}"/>`}else{let h=x+(r.extraW??0),m=(l-h)/2,k=r.extraH??16;A+=`<path class="dt-shell-body" d="M${H} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${x-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${M}H${H}z"/>`,A+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${m} ${M}h${h}v${k-8}a8 8 0 0 1-8 8H${m+8}a8 8 0 0 1-8-8z"/>`,A+=`<rect class="dt-shell-lip" x="${l/2-x*.07}" y="${M}" width="${x*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${l} ${g}" width="${l}" height="${g}" aria-hidden="true">${A}${$}</svg>`}var Mr={"safari-ios":n=>{let r=n.shell==="home"?20:n.w>=400?62:59;return{top:r,bottom:98,topMin:r,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},kr=({d:n,now:r,cutout:l},g)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${g}px"><span class="dt-sb-l">${_.signal}${_.wifi}</span><b>${bn(r)}</b><span class="dt-sb-r">${_.battery}</span></div>`;let p=l??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${g}px"><span class="dt-island" style="left:${p.x}px;top:${p.y}px;width:${p.width}px;height:${p.height}px"></span><b class="dt-sb-time" style="top:${p.y}px;height:${p.height}px">${bn(r)}</b><span class="dt-sb-icons" style="top:${p.y}px;height:${p.height}px">${_.signal}${_.wifi}${_.battery}</span></div>`},Sr=({d:n,host:r,min:l},g)=>{let p=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return l?`<div class="dt-ios-bar is-min" style="height:${g}px"><span class="dt-ios-mini">${$e(r)}</span>${p}</div>`:`<div class="dt-ios-bar" style="height:${g}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back">${_.back}</button><span class="dt-glass dt-ios-url"><span>${$e(r)}</span><button data-nav="reload">${_.reload}</button></span><span class="dt-glass dt-glass--round">${_.dots}</span></div>${p}</div>`},Lr=({now:n,min:r},l)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${as(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${_.wifi}${_.signal}${_.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${_.tune}<span>${$e(l)}</span></span><span class="dt-and-tabs">1</span>${_.dotsV}</div>`),Tr=()=>`<div class="dt-and-nav">${_.recent}${_.home}${_.navBack}</div>`,Ar=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${bn(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${_.wifi}${_.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${_.sidebar}<button data-nav="back">${_.back}</button><button data-nav="fwd">${_.fwd}</button></span><span class="dt-ipad-url">${_.lock}<span>${$e(r)}</span><button data-nav="reload">${_.reload}</button></span><span class="dt-bar-group">${_.share}${_.plus}${_.tabs}</span></div>`,Cr=({now:n,host:r},l)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(l?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${_.wifi}${_.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${bn(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${_.sidebar}<button data-nav="back">${_.back}</button><button data-nav="fwd">${_.fwd}</button></span><span class="dt-mac-url">${_.lock}<span>${$e(r)}</span><button data-nav="reload">${_.reload}</button></span><span class="dt-bar-group">${_.share}${_.plus}${_.tabs}</span></div>`,Hr=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,Br=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${$e(r||n)}</span>${_.close}</span><span class="dt-win-new">${_.plus}</span><span class="dt-win-ctrl">${_.winMin}${_.winMax}${_.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back">${_.back}</button><button data-nav="fwd">${_.fwd}</button><button data-nav="reload">${_.reload}</button></span><span class="dt-win-url">${_.tune}<span>${$e(n)}</span>${_.star}</span><span class="dt-bar-group">${_.user}${_.dotsV}</span></div>`,Rr=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,l)=>`<i style="--hue:${200+l*30}"></i>`).join("")}</span><span class="dt-win-tray">${_.chevUp}${_.wifi}${_.volume}${_.battery}<span class="dt-win-clock">${as(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function zo(n,r){let l=xr[n.shell](n),g=n.w+2*l.side,p=n.h+l.top+l.bottom,x=g+(l.extraW??0),M=p+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?l.extraH??0:0),H=(x-g)/2+l.side,$=Mr[n.browser](n),A=r.min?$.topMin??$.top:$.top,h=r.min?$.bottomMin??$.bottom:$.bottom,m={...r,d:n},k="",O="";switch(n.browser){case"safari-ios":k=kr(m,A),O=Sr(m,h);break;case"chrome-android":k=Lr(m,r.host),O=Tr();break;case"safari-ipad":k=Ar(m),O='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":k=Cr(m,n.shell==="macbook"),O=Hr();break;case"chrome-windows":k=Br(m),O=Rr(m);break}return{footprint:{w:x,h:M},screen:{x:H,y:l.top,w:n.w,h:n.h,r:l.r,rb:l.rb??l.r},topH:A,bottomH:h,shell:Er(n,l,x,M,H),top:k,bottom:O,canMinimize:$.topMin!==void 0&&($.topMin!==$.top||$.bottomMin!==$.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var we=null;function Ke(n){if(we??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!we||!n)return[0,0,0,0];we.clearRect(0,0,1,1),we.fillStyle="rgba(0, 0, 0, 0)",we.fillStyle=n,we.fillRect(0,0,1,1);let[r,l,g,p]=we.getImageData(0,0,1,1).data;return[r,l,g,p/255]}var Ge=([n,r,l])=>`rgb(${n}, ${r}, ${l})`;function Vo(n){let r=n.defaultView,l=O=>!O||Ke(O)[3]===0,g=[n.body,n.documentElement].map(O=>O&&r.getComputedStyle(O).backgroundColor).find(O=>O&&!l(O)),[p,x,M,H]=g?Ke(g):[255,255,255,1],$=[p,x,M].map(O=>Math.round(O*H+255*(1-H))),A=O=>{let[z,I,q,U]=Ke(O);if(U>=.75)return Ge([z,I,q]);let et=(at,kt)=>Math.round(at*U+kt*(1-U));return Ge([et(z,$[0]),et(I,$[1]),et(q,$[2])])},h=O=>{let z=n.elementFromPoint(r.innerWidth/2,O);for(;z&&z!==n.documentElement;z=z.parentElement){let I=r.getComputedStyle(z);if(I.position!=="fixed"&&I.position!=="sticky")continue;let q=z.getBoundingClientRect().width>=r.innerWidth*.9,U=I.backdropFilter&&I.backdropFilter!=="none";return q&&!U&&!l(I.backgroundColor)?A(I.backgroundColor):null}return null},m=n.querySelector('meta[name="theme-color"]')?.content||"",k=m&&!l(m)?Ge(Ke(m)):"";return{top:h(4)??Ge($),bottom:h(r.innerHeight-4)??Ge($),theme:k}}function rs(n){let[r,l,g]=Ke(n).map(p=>p/255).map(p=>p<=.04045?p/12.92:((p+.055)/1.055)**2.4);return .2126*r+.7152*l+.0722*g>.4?"#000":"#fff"}function Uo(n){let{cfg:r,inFrame:l,persist:g,frame:p,frameEl:x,devicesMenu:M,bpBtns:H,notesOverlay:$,WIDE:A,bpOf:h,currentBp:m,deviceById:k,notesOn:O,filter:z,filterTo:I,dropFrameDrafts:q,putAway:U,tellFrame:et,syncBpButtons:at,render:kt,reread:St}=n,vt=r.breakpoints,ot=document.querySelector(".dt-device"),At=document.querySelector(".dt-shell"),Ct=document.querySelector('.dt-chrome[data-at="top"]'),E=document.querySelector('.dt-chrome[data-at="bottom"]'),J=document.querySelector(".dt-ruler"),ut=[...document.querySelectorAll(".dt-frame-handle")],Nt=document.querySelector(".dt-frame-size"),Pt=document.querySelector(".dt-frame-rotate"),_t=document.querySelector(".dt-frame-bars"),b="overlay",i="",f="dt-w",C="dt-canvas",R="dt-device",K=Q.getItem(C)==="1",D=Q.getItem(R)||"";D&&!k(D)&&(D="",Q.setItem(R,""));let N=Number(Q.getItem(f))||0,j="dt-emu",W=(()=>{try{return JSON.parse(Q.getItem(j)||"null")}catch{return null}})(),pt=()=>W?We.find(w=>w.id===W.id)??null:null,gt=()=>{let w=pt();return w?W.turned?{w:w.h,h:w.w}:{w:w.w,h:w.h}:null},Ht=Q.getItem("dt-bars-min")==="1",Lt=w=>{W=w,g(j,w?JSON.stringify(w):"")},Bt=w=>{Nt.textContent=w,p.style.setProperty("--dt-badge-w",`${Nt.offsetWidth}px`)},ue=w=>{if(!w){J.innerHTML="";return}let L="";for(let B=0;B<=w;B+=50)L+=`<span class="dt-tick${B%200===0?" is-major":""}" style="left:${B}px"></span>`;for(let B of vt)for(let tt of[B.min,B.max])tt>0&&Number.isFinite(tt)&&tt<=w&&(L+=`<span class="dt-edge" style="left:${tt}px" title="${B.label} edge"></span>`);J.innerHTML=L,J.style.width=`${w}px`},pe=()=>{let w=parseFloat(ot.style.width)||0,L=parseFloat(ot.style.height)||0;if(!w||!L){ot.style.transform="",delete ot.dataset.scaled;return}let B=D||W?Math.min(1,(innerWidth-80)/w,(innerHeight-120)/L):Math.min(1,(innerWidth-80)/w);ot.style.transform=B<1?`scale(${B})`:"",ot.dataset.scaled=B<1?String(Math.round(B*100)):""},Y=w=>We.find(L=>L.w===w.w&&L.h===w.h&&L.cutout?.shape==="pill")?.cutout,ee=()=>{try{return x.contentDocument}catch{return null}},Be=()=>ee()?.title.split("\u2014").pop()?.trim()||"",xe=()=>{let w=ee(),L=D?k(D):null;if(!w?.body||!L)return;let B=Vo(w),tt=L.browser==="chrome-android"?B.theme||"rgb(255, 255, 255)":B.top,dt=L.browser==="chrome-android"?"rgb(255, 255, 255)":B.bottom;ot.style.setProperty("--dt-top",tt),ot.style.setProperty("--dt-top-ink",rs(tt)),ot.style.setProperty("--dt-bottom",dt),ot.style.setProperty("--dt-bottom-ink",rs(dt));let mt=Ct.querySelector(".dt-win-tab > span");mt&&(mt.textContent=Be()||location.host)},G=0;x.addEventListener("load",()=>{let w=ee();if(!w)return;let L=window.__notemendHosted;if(L&&!x.contentWindow?.__notemendHosted&&!w.querySelector(`script[src^="${L.base}/bar.js"]`)){let B=w.createElement("script");B.src=`${L.base}/bar.js`,B.dataset.project=L.project,w.head.append(B)}xe(),x.contentWindow?.addEventListener("scroll",()=>{G||(G=requestAnimationFrame(()=>{G=0,xe()}))},{passive:!0})});for(let w of[Ct,E])w.addEventListener("click",L=>{let B=L.target.closest("[data-nav]")?.dataset.nav;if(B)try{let tt=x.contentWindow?.navigation;if(!ee()||!tt)throw new Error("foreign");B==="back"?tt.canGoBack&&tt.back():B==="fwd"?tt.canGoForward&&tt.forward():tt.reload()}catch{(B==="reload"||B==="back")&&(x.src=location.href)}});_t.addEventListener("click",()=>{Ht=!Ht,g("dt-bars-min",Ht?"1":"0"),lt()});let lt=()=>{if(l)return;let w=D?k(D)??null:null;if(D&&!w&&(D="",Q.setItem(R,"")),!w&&!K){p.hidden=!0,x.removeAttribute("src"),Mt.toggle("dt-framing",!1),$.hidden=!O(),J.innerHTML="",at(),Pt.hidden=!0,_t.hidden=!0,I(null),i="",q(),at(),ft(),St();return}if(p.hidden=!1,Mt.toggle("dt-framing",!0),$.hidden=!0,x.src||(x.src=location.href),w){let L=zo(w,{host:location.host,title:Be(),now:new Date,min:Ht,cutout:Y(w)}),{screen:B}=L;p.dataset.mode="device",ot.dataset.shell=w.shell,ot.dataset.browser=w.browser,ot.style.width=`${L.footprint.w}px`,ot.style.height=`${L.footprint.h}px`,ot.style.setProperty("--dt-r",`${B.r}px`),ot.style.setProperty("--dt-rb",`${B.rb}px`),At.innerHTML=L.shell;let tt=(bt,ht,Ne,fn)=>{bt.innerHTML=fn,bt.style.cssText=`left:${B.x}px;top:${ht}px;width:${B.w}px;height:${Ne}px`};tt(Ct,B.y,L.topH,L.top),tt(E,B.y+B.h-L.bottomH,L.bottomH,L.bottom);let dt=B.h-L.topH-L.bottomH;x.style.position="absolute",x.style.left=`${B.x}px`,x.style.top=`${B.y+L.topH}px`,x.style.width=`${B.w}px`,x.style.height=`${dt}px`,J.innerHTML="";let mt=Ht&&L.canMinimize;b=L.scrollbar,i=`${w.label}${mt?" \xB7 bars folded":""}`,I(h(w.w)),et({notes:O(),scrollbar:b,device:i}),_t.hidden=!L.canMinimize,_t.setAttribute("aria-pressed",String(mt)),Bt(`${w.label} \xB7 page ${w.w}\xD7${dt} of ${w.w}\xD7${w.h}${mt?" \xB7 bars folded":""} \xB7 ${vt.find(bt=>bt.id===z())?.label??""}`),xe()}else{let L=gt();L||Lt(null);let B=L?.w||N||vt.find(mt=>mt.id===m()).ideal;N=B,p.dataset.mode="canvas",delete ot.dataset.shell,delete ot.dataset.browser,At.innerHTML=Ct.innerHTML=E.innerHTML="",Ct.style.cssText=E.style.cssText="",_t.hidden=!0,b="overlay",ot.style.width=`${B}px`,ot.style.height=`${L?.h??innerHeight-84}px`,x.style.position="",x.style.left=x.style.top="",x.style.width="100%",x.style.height="100%",ue(B),et({notes:O()});let tt=vt.find(mt=>mt.id===h(B)),dt=pt();i=dt?`${dt.label}${W?.turned?" \xB7 landscape":""}`:"",et({scrollbar:b,device:i}),Bt(dt&&L?`${dt.label} \xB7 ${L.w}\xD7${L.h} \xB7 ${tt.label}`:`${B}px \xB7 ${tt.label}`),I(h(B))}Pt.hidden=!(pt()?.rotates&&!w),ft(),pe(),at(),St()},st=w=>{let L=vt.find(B=>B.id===w);D="",Q.setItem(R,""),Lt(null),K=w!==A,N=K?L.ideal:0,I(K?w:null),Q.setItem(C,K?"1":"0"),Q.setItem(f,String(N)),U(),lt()};for(let w of H)w.addEventListener("click",()=>st(w.dataset.bp));for(let w of document.querySelectorAll("[data-device]"))w.addEventListener("click",()=>{D=w.dataset.device===D?"":w.dataset.device,Q.setItem(R,D),M.open=!1,lt()});for(let w of document.querySelectorAll("[data-emu]"))w.addEventListener("click",()=>{let L=W?.id===w.dataset.emu&&!D;D="",Q.setItem(R,""),Lt(L?null:{id:w.dataset.emu,turned:!1}),K=!L,N=0,Q.setItem(C,K?"1":"0"),I(null),U(),M.open=!1,lt()});Pt.addEventListener("click",()=>{W&&(Lt({...W,turned:!W.turned}),U(),lt())});let S=[...M.querySelectorAll("[data-tab]")],Re=[...M.querySelectorAll("[data-panel]")],Tt=w=>{for(let L of S)L.setAttribute("aria-selected",String(L.dataset.tab===w));for(let L of Re)L.hidden=L.dataset.panel!==w;g("dt-devices-tab",w)};for(let w of S)w.addEventListener("click",()=>Tt(w.dataset.tab));Tt(Q.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let xt=M.querySelector(".dt-emu-search");xt.addEventListener("input",()=>{let w=xt.value.trim().toLowerCase(),L=null,B=!1,tt=()=>{L&&(L.hidden=!B)};for(let dt of xt.parentElement.children){if(dt.classList.contains("dt-devices-group")){tt(),L=dt,B=!1;continue}dt.dataset.emu&&(dt.hidden=!!w&&!dt.textContent.toLowerCase().includes(w),B||=!dt.hidden)}tt()});let it=M.querySelector(".dt-devices-name");function ft(){for(let L of M.querySelectorAll("[data-device]"))L.setAttribute("aria-pressed",String(L.dataset.device===D));let w=!D&&!p.hidden?W?.id:void 0;for(let L of M.querySelectorAll("[data-emu]"))L.setAttribute("aria-pressed",String(L.dataset.emu===w));it.textContent=D&&k(D)?.label||w&&pt()?.label||"Device"}let ne=w=>vt.find(L=>L.id===w),Dt=w=>{let L=ne(z()??m());return Math.max(L.min||320,Math.min(Number.isFinite(L.max)?L.max:2560,Math.round(w)))};for(let w of ut){let L=w.dataset.edge==="l"?-1:1;w.addEventListener("pointerdown",B=>{if(D)return;B.preventDefault(),W&&(Lt(null),lt()),w.setPointerCapture(B.pointerId);let tt=B.clientX,dt=N,mt=Number(ot.dataset.scaled||100)/100;p.dataset.dragging="1";let bt=Ne=>{N=Dt(dt+L*(Ne.clientX-tt)*2/mt),ot.style.width=`${N}px`,ue(N),Bt(`${N}px \xB7 ${ne(h(N)).label}`),pe()},ht=()=>{w.removeEventListener("pointermove",bt),w.removeEventListener("pointerup",ht),w.removeEventListener("pointercancel",ht),delete p.dataset.dragging,Q.setItem(f,String(N)),lt()};w.addEventListener("pointermove",bt),w.addEventListener("pointerup",ht),w.addEventListener("pointercancel",ht)}),w.addEventListener("dblclick",()=>{if(D)return;Lt(null);let B=ne(z()??m()),tt=[B.min||320,Number.isFinite(B.max)?B.max:B.ideal];N=Math.abs(N-tt[0])<Math.abs(N-tt[1])?tt[0]:tt[1],Q.setItem(f,String(N)),lt()})}let se=m();return addEventListener("resize",()=>{at(),m()!==se&&(se=m(),kt()),p.hidden||(!D&&!W&&(ot.style.height=`${innerHeight-84}px`),pe())}),{apply:lt,pickBp:st,look:()=>({scrollbar:b,device:i}),restore:()=>{K||D?lt():ft()}}}var Go='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg>',Nr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Ko(n){let{bp:r,notes:l,breakpoints:g,bandOfNote:p,whoseAgent:x,statusTools:M,showResolved:H,drafts:$,find:A}=n,h=l.filter(E=>p(E)===r),m=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(J=>!J.deleted).map(J=>J.text)].join(" ").toLowerCase(),k=E=>A.view==="me"?n.forMe(E):A.view==="agent"?n.forAgent(E):!0,O=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,z=h.filter(E=>k(E)&&(!A.q||m(E).includes(A.q.trim().toLowerCase()))).sort((E,J)=>(A.sort==="unread"?Number(n.unread(J))-Number(n.unread(E)):0)||O(J)-O(E)),I={open:[],claude:[],done:[]};for(let E of z)I[ct(E)].push(E);let q=E=>{let J=(E.replies??[]).filter(f=>!f.deleted),ut=J.length+(E.note?1:0),Nt=ye(E.category),Pt=ct(E),_t=Pt==="claude",b=n.orphan(E),i=J.length?J[J.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text};return`<div class="dt-hist-row is-${Pt}${b?" is-orphan":""}">
|
|
129
|
+
<button class="dt-hist-go" data-go="${E.id}">
|
|
130
|
+
${n.marker(E)}
|
|
131
|
+
<span class="dt-hist-body">
|
|
132
|
+
<span class="dt-hist-id">#${E.id>0?E.id:"\u2026"}<em>${Nt.label}</em>${_t?`<b class="dt-hist-claude" data-unmark="${E.id}" role="button" tabindex="0" title="Resolved by ${y(x(E.doneAgent,E.doneFor))} \u2014 click to clear: back to open">${Jt(9)}${y(Ce(E.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${b?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
133
|
+
<span class="dt-hist-text">${i.author==="claude"?`<b>${y(x(i.agent,i.by))}:</b> `:""}${y(i.text)}</span>
|
|
134
|
+
<span class="dt-hist-meta">${Ve(E.updatedAt||E.createdAt)}${E.device?` \xB7 ${y(E.device)}`:E.browser?` \xB7 ${y(E.browser)}`:""}${ut?` \xB7 ${ut} repl${ut===1?"y":"ies"}`:""}</span>
|
|
135
|
+
</span>
|
|
136
|
+
</button>
|
|
137
|
+
<span class="dt-note-tools dt-hist-tools">${M(E)}<i class="dt-note-sep"></i
|
|
138
|
+
><button data-rm="${E.id}" title="Delete this comment">${fe}</button></span>
|
|
139
|
+
</div>`},U=g.find(E=>E.id===r),et=g.map(E=>{let J=l.filter(ut=>p(ut)===E.id&&ct(ut)!=="done");return{band:E,open:J.filter(ut=>ct(ut)==="open").length,total:J.length}}).filter(E=>E.total&&E.band.id!==r),at=et.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${et.map(({band:E,open:J,total:ut})=>`<button data-bp="${E.id}" data-state="${J?"open":"claude"}"
|
|
140
|
+
title="${E.label}: ${J} open \xB7 ${ut-J} to check"
|
|
141
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${ut}</i></button>`).join("")}</div>`:"",St=["open","claude","done"].filter(E=>I[E].length&&(E!=="done"||H)),vt=E=>`<div class="dt-hist-row is-draft">
|
|
142
|
+
<button class="dt-hist-go" data-draft-go="${E.i}">
|
|
143
|
+
<span class="dt-hist-n">${Ue}</span>
|
|
144
|
+
<span class="dt-hist-body">
|
|
145
|
+
<span class="dt-hist-id">${y(E.el)}${E.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
146
|
+
<span class="dt-hist-text">${E.text?y(E.text):`${E.shots} screenshot${E.shots===1?"":"s"}`}</span>
|
|
147
|
+
</span>
|
|
148
|
+
</button>
|
|
149
|
+
<span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${fe}</button></span>
|
|
150
|
+
</div>`,ot=h.filter(E=>ct(E)!=="done"),At=(E,J,ut,Nt,Pt)=>`<button type="button" role="menuitemradio" aria-checked="${Nt}" ${E}="${J}"><i>${Nt?It:""}</i><span>${ut}</span>${Pt==null?"":`<em>${Pt}</em>`}</button>`,Ct=()=>`<div class="dt-hist-find">
|
|
151
|
+
<label class="dt-hist-search">${Go}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${y(A.q)}" spellcheck="false">${A.q?`<button type="button" data-hist-clear aria-label="Clear search">${ce}</button>`:""}</label>
|
|
152
|
+
<button type="button" class="dt-hist-filter${A.view!=="all"||A.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${A.menu}" data-tip="Filter">${Nr}</button>
|
|
153
|
+
${A.menu?`<div class="dt-hist-menu" role="menu">${At("data-hist-view","me","For me",A.view==="me",ot.filter(n.forMe).length)}${At("data-hist-view","agent","Agent",A.view==="agent",ot.filter(n.forAgent).length)}${At("data-hist-view","all","All",A.view==="all",ot.length)}<hr>${At("data-hist-sort","new","Newest",A.sort==="new")}${At("data-hist-sort","unread","Unread first",A.sort==="unread")}</div>`:""}
|
|
154
|
+
</div>`;return`<div class="dt-hist-head">
|
|
155
|
+
<span class="dt-hist-here" title="${U?.label??r}"
|
|
156
|
+
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${U?.icon??""}</svg></span>
|
|
157
|
+
<span class="dt-hist-title">Comments</span>
|
|
158
|
+
${at}
|
|
159
|
+
${n.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${n.checks} ${n.checks===1?"fix":"fixes"}" data-tip="${n.checks} ${n.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${It}${n.checks}</button>`:""}
|
|
160
|
+
<button class="dt-hist-refresh" data-refresh aria-label="Reload comments from the file">
|
|
161
|
+
<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M16 10a6 6 0 1 1-1.8-4.3"/><path d="M16.3 3.4v3.4h-3.4"/></svg>
|
|
162
|
+
</button>
|
|
163
|
+
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
|
|
164
|
+
<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.5 8.5 10 12.5l4.5-4"/></svg>
|
|
165
|
+
</button>
|
|
166
|
+
</div>`+Ct()+(St.length||$.length?`<div class="dt-hist-list">${$.length?`<p class="dt-hist-group">Drafts<em>${$.length}</em></p>${$.map(vt).join("")}`:""}${St.map(E=>`<p class="dt-hist-group">${Po[E]}<em>${I[E].length}</em></p>`+I[E].map(q).join("")).join("")}</div>`:A.q.trim()?`<div class="dt-hist-empty">${Go}<p>No comments match \xAB${y(A.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:A.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<p class="dt-hist-empty">${I.done.length?"Everything here is resolved.":"No comments at this breakpoint yet. Click anything on the page to leave one."}</p>`)+`<div class="dt-hist-foot">
|
|
167
|
+
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${H}"
|
|
168
|
+
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="10" r="7.5"/><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round"/></svg
|
|
169
|
+
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
170
|
+
</div>`}function Yo(n){let{inFrame:r,everything:l,route:g,open:p,settle:x,keepIn:M,toast:H}=n,$="nm-review",A=()=>{try{return JSON.parse(sessionStorage.getItem($)||"null")}catch{return null}},h=q=>{try{q?sessionStorage.setItem($,JSON.stringify(q)):sessionStorage.removeItem($)}catch{}},m=document.createElement("div");m.className="dt-review",m.setAttribute("role","region"),m.setAttribute("aria-label","Checking fixes"),m.hidden=!0,M(m),r||document.body.append(m);let k=()=>l().filter(q=>ct(q)==="claude"),O=()=>{let q=k().sort((U,et)=>+(et.route===g())-+(U.route===g())||String(U.route).localeCompare(String(et.route))||U.id-et.id).map(U=>U.id);q.length&&(h({ids:q,i:0}),z())},z=()=>{let q=A();if(!q||r){m.hidden=!0;return}for(;q.i<q.ids.length&&ct(l().find(at=>at.id===q.ids[q.i])??{status:"done"})!=="claude";)q.i++;if(q.i>=q.ids.length){h(null),m.hidden=!0,H("Every fix is checked.");return}h(q);let U=l().find(at=>at.id===q.ids[q.i]);if(U.route&&U.route!==g()){location.assign(U.route+location.search);return}p(U);let et=q.ids.slice(0,q.i).some(at=>ct(l().find(kt=>kt.id===at)??{status:"done"})==="claude");m.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
171
|
+
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${et?"":" disabled"}>${Ho}</button>
|
|
172
|
+
<span class="dt-review-n">${q.i+1} of ${q.ids.length}</span>
|
|
173
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Bo}</button></span>
|
|
174
|
+
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${It}</button>
|
|
175
|
+
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${He}</button>
|
|
176
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${ce}</button>`,m.hidden=!1};m.addEventListener("click",async q=>{let U=q.target.closest("[data-r]"),et=A();if(!U||!et)return;if(U.dataset.r==="stop"){h(null),m.hidden=!0;return}if(U.dataset.r==="prev"){I();return}let at=et.ids[et.i];h({...et,i:et.i+1});let kt=U.dataset.r==="ok"?x(at,!0):U.dataset.r==="no"?x(at,!1):null;z(),await kt});let I=()=>{let q=A();if(q){for(let U=q.i-1;U>=0;U--)if(ct(l().find(et=>et.id===q.ids[U])??{status:"done"})==="claude"){h({...q,i:U}),z();return}}};return document.addEventListener("keydown",q=>{m.hidden||q.metaKey||q.ctrlKey||q.altKey||q.key!=="ArrowLeft"&&q.key!=="ArrowRight"||q.target.closest?.("input, textarea, select, [contenteditable]")||(q.preventDefault(),q.key==="ArrowLeft"?I():m.querySelector('[data-r="skip"]')?.click())}),{start:O,toCheck:k,resume:()=>{A()&&z()}}}function Xo(n,r){let l=null,g=null,p=document.querySelector(".dt-turbo"),x="/notemend:turbo",M=()=>{let H=!!l&&Date.now()-Date.parse(l.at)<18e4,$=H?g?.paused?"paused":"on":"none",A=H?Ce(l.agent):"",h=$==="none"?`Turbo is off. Run ${x} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:$==="on"?`Turbo on: ${A} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${A} is listening but waits \u2014 click to resume`;p.dataset.state=$,p.dataset.tip=h,p.setAttribute("aria-label",h),p.setAttribute("aria-checked",String($==="on")),n&&(p.hidden=!0)};return setInterval(M,3e4),p.addEventListener("click",async()=>{let H=p.dataset.state;if(H==="none"){await navigator.clipboard?.writeText(x).catch(()=>{}),r(`Copied ${x} \u2014 paste it in Claude Code`);return}let $=H==="on"?"off":"on";g={paused:$==="off"},M();try{let A=await Rt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:$})});if(!A.ok)throw new Error(String(A.status));r($==="off"?"Turbo paused":"Turbo on")}catch{g={paused:$==="on"},M(),r("Could not switch turbo \u2014 try again")}}),H=>{l=H.listening??null,g=H.turbo??null,M()}}function Jo(n,r){let l=n.breakpoints,g=n.categories,p=(l.find(t=>!Number.isFinite(t.max))??l[0]).id,x=t=>l.find(e=>t>=e.min&&t<=e.max)?.id??p,M=t=>t.breakpoint||p,H=t=>n.devices.find(e=>e.id===t),$=mn,A=(t,e)=>{$||Q.setItem(t,e)},h=t=>Rt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),m=t=>t.replace(/\/+$/,"")||"/",k=m(location.pathname);for(let t of document.querySelectorAll(".devtools .dt-icon[title]"))t.dataset.tip=t.title,t.getAttribute("aria-label")||t.setAttribute("aria-label",t.title),t.removeAttribute("title");let O=document.querySelector(".dt-grid-btn"),z=document.querySelector(".dt-grid-overlay"),I="dt-grid",q=t=>{z.hidden=!t,O.setAttribute("aria-pressed",String(t)),A(I,t?"1":"0"),qt({grid:t})};O.addEventListener("click",()=>q(z.hidden===!0));let U=document.querySelector(".dt-pages-name"),et=()=>{let t=null;for(let o of document.querySelectorAll(".dt-pages a"))m(new URL(o.href).pathname)===k?(o.setAttribute("aria-current","page"),t=o):o.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),s=t?.querySelector(".dt-menu-label")?.textContent?.trim();U.textContent=s||e||U.textContent};et();let at=[...document.querySelectorAll(".devtools details")],kt=!1,St=()=>{let t=at.filter(e=>e.open);for(let e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=St();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{kt=at.some(e=>e.open&&!e.contains(t.target))&&St().length>0},!0),addEventListener("blur",St);let vt=document.querySelector(".dt-pad-overlay"),ot="dt-inspect",At=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),Ct=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-review",".dt-field-menu",'[aria-modal="true"]',...n.ignore].join(", "),E={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),border:document.querySelector(".dt-border-btn")},J="",ut=0,{spacer:Nt,drawPads:Pt,drawSize:_t,drawType:b,drawColor:i,drawBorder:f}=Fo(vt),C=t=>{ut||(ut=requestAnimationFrame(()=>{ut=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(At)){vt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),J==="sizes"?_t(e):J==="type"?b(e):J==="color"?i(e):J==="border"?f(e):Pt(t.altKey?e:Nt(e))}))},R=t=>{J=t;for(let[e,s]of Object.entries(E))s.setAttribute("aria-pressed",String(e===t));A(ot,t),qt({inspect:t}),vt.hidden=!t,vt.innerHTML="",t?document.addEventListener("mousemove",C):document.removeEventListener("mousemove",C)};for(let[t,e]of Object.entries(E))e.addEventListener("click",()=>{t!==J&&ae(!1),R(J===t?"":t)});let K=document.querySelector(".dt-notes-btn"),D=[...document.querySelectorAll(".dt-bp")],N=document.querySelector(".dt-history-btn"),j=document.querySelector(".dt-history"),W=document.querySelector(".dt-studio-btn"),pt=document.querySelector(".dt-devices"),gt=document.querySelector(".dt-notes-hi"),Ht=gt.querySelector(".dt-hi-box"),Lt=gt.querySelector(".dt-hi-tag"),Bt=document.querySelector(".dt-frame"),ue=Bt.querySelector("iframe"),pe=document.querySelector(".dt-notes-count"),Y=document.querySelector(".dt-notes-overlay"),ee=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame",Be=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(ee).forEach(Be);let xe="dt-notes",G=[],lt=!1,st=null,S=null,Re=0,Tt="",xt=[],it=null,ft=[],ne=(t=S)=>!!(t&&(t.text?.trim()||t.images?.length)),Dt=()=>{S&&ne()&&ft.push(S),S=null},se=null,w=null,L=()=>`dt-draft:${k}${$?":canvas":""}`,B=L(),tt=0,dt=()=>{if(!S&&!ft.length&&!Tt){Q.removeItem(B);return}let t={draft:S,parked:ft,reply:Tt?{for:se,text:Tt}:null};try{localStorage.setItem(B,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(B,JSON.stringify({...t,draft:S&&e(S),parked:ft.map(e)}))}catch{}}},mt=()=>{clearTimeout(tt),tt=setTimeout(dt,200)};addEventListener("pagehide",()=>{clearTimeout(tt),dt()});let bt=Q.getItem("dt-resolved")!=="0",ht={q:"",menu:!1,view:["me","agent"].includes(Q.getItem("dt-view")??"")?Q.getItem("dt-view"):"all",sort:Q.getItem("dt-sort")==="unread"?"unread":"new"},Ne=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],fn=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],ta=()=>{let t=navigator.userAgent,e=d=>d.find(([c])=>c.test(t)),s=e(Ne),o=e(fn),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},yn=()=>x(innerWidth),me=()=>w??yn(),is=()=>{let t=me();for(let e of D)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ea,poolOf:na,contextOf:sa,resolveEl:oa,anchorOf:aa}=jo(),vn=new WeakMap,ls=()=>{vn=new WeakMap},Zt=t=>{let e=vn.get(t);return(e===void 0||e&&!e.isConnected)&&(e=oa(t),vn.set(t,e)),e},Ye=new Map,Wt=t=>{Ye.size||requestAnimationFrame(()=>Ye.clear());let e=Ye.get(t);return e===void 0&&(e=aa(t,Zt(t)),Ye.set(t,e)),e},ds=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},Xe=[],wn=t=>{for(let e of Xe)e.play();Xe=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),Xe.push(s))},cs=()=>{if(S)return Zt(S);let t=st!=null?G.find(s=>s.id===st):null;if(!t)return null;let e=Wt(t);return e&&!e.off?Zt(t):null},ra="claude",ia=()=>(n.team??[]).filter(t=>t.email!==n.me?.email),Ee=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...ia()],us='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="10" cy="10" r="6.5" stroke-dasharray="2.4 2.4"/></svg>',la=(t,e,s=!1)=>{let o=wt(t)?"agent":t?"person":"nobody",a=De(o==="person"?t:ps()),d=[["person",a?Ze(a.avatar_url,a.name||a.email):sn,o==="person"?`${Je(t)==="you"?"You":Je(t)} \u2014 pick someone else`:a?`Give it to ${a.email===n.me?.email?"me":a.name||a.email}`:"A person"],["nobody",us,"Anyone \u2014 nobody has taken it yet"],["agent",Jt(12),s?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],c=e!=null?G.find(T=>T.id===e):void 0,v=o==="agent"&&c?$n[Ft(c)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${v?` style="--step-c:${v}"`:""}>${d.filter(([T])=>T!=="person"||o==="person"||Ee().length).map(([T,P,u])=>T===o?`<span class="dt-hand-stop dt-hand-stop--${T} is-on" role="radio" aria-checked="true" data-tip="${y(u)}" aria-label="${y(u)}">${T==="person"?ha(t,e):P}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${T}" role="radio" aria-checked="false" data-act="hand" data-v="${T}"${e?` data-id="${e}"`:""} data-tip="${y(u)}" aria-label="${y(u)}"${T==="agent"&&s?" disabled":""}>${P}</button>`).join("")}</span>`},ps=()=>{let t=ua();return t&&!wt(t)&&Ee().some(e=>e.email===t)?t:Ee()[0]?.email??""},da=()=>{let t=Y.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},ms="cubic-bezier(0.32, 0.72, 0, 1)",hs=t=>{let e=Y.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let s=e.getBoundingClientRect(),o=document.createElement("span");o.className="dt-hand dt-hand-ghost",o.style.cssText=`left:${t.rect.left}px;top:${t.rect.top}px;width:${t.rect.width}px;height:${t.rect.height}px`,t.ghost.querySelectorAll("select").forEach(a=>a.tabIndex=-1),o.append(t.ghost),Y.append(o),o.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>o.remove(),()=>o.remove()),Rn=performance.now()+480,e.animate([{transform:`translateX(${t.rect.left-s.left}px)`,width:`${t.rect.width}px`},{transform:"none",width:`${s.width}px`}],{duration:460,easing:ms});for(let a of e.children)a.animate([{opacity:0,transform:"scale(0.92)",filter:"blur(3px)"},{opacity:0,transform:"scale(0.92)",filter:"blur(3px)",offset:.4},{opacity:1,transform:"none",filter:"blur(0)"}],{duration:460,easing:ms});for(let a of e.parentElement?.querySelectorAll("button.dt-hand-stop")??[])a.animate([{opacity:0},{opacity:1}],{duration:300,delay:140,easing:"ease-out",fill:"backwards"})},ca=(t,e)=>{let s=Rn>performance.now()?void 0:da(),o=e==="agent"?ra:e==="person"?ps():e==="me"?n.me?.email??"":"";if(!t){if(!S)return;S.assignee=o,S.stage=wt(o)?"approved":!S.stage||S.stage==="approved"?"new":S.stage,e==="person"&&Q.setItem("nm-for",o),mt(),V(),hs(s);return}let a=G.find(v=>v.id===t);if(a&&ze(a)&&!wt(o)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let d=a?Ot(a):"new",c=wt(o)?"approved":d==="approved"?"new":d;Vt(v=>v.map(T=>T.id===t?{...T,assignee:o||void 0,stage:c}:T),()=>h({id:t,assignee:o||null,stage:c}),wt(o)?"Approving it for the agent":"Reassigning"),hs(s)},ua=()=>Q.getItem("nm-for")??"",Pe=t=>wt(t)?"#d97757":t?"#0d99ff":"#717171",Je=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],De=t=>t?n.team?.find(e=>e.email===t):void 0,gs=t=>{let e=jt(t??"").split(/\s+/).filter(Boolean);return y(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},Ze=(t,e,s="dt-face")=>t?`<img class="${s}" src="${y(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${gs(e)}</b>`,bs=t=>{let e=De(t.by);return e||t.byName?Ze(e?.avatar_url,e?.name||t.byName||t.by):""},fs=t=>`var(--dt-avatar-${[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,$n={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Me=(()=>{try{return JSON.parse(Q.getItem("dt-seen")||"{}")}catch{return{}}})(),ys=()=>A("dt-seen",JSON.stringify(Me)),vs=t=>{let e=be(t);if(!(t.id in Me))return Me[t.id]=e.length,ys(),!1;let s=e[e.length-1];return e.length>Me[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},pa=t=>{let e=be(t).length;Me[t.id]!==e&&(Me[t.id]=e,ys())},xn=t=>{let e=De(t);return e?` data-face="${y(e.avatar_url??"")}" data-initial="${gs(e.name||e.email)}"`:""},he=(t,e)=>Ce(t),ws=t=>{let e=De(t);return e?Ze(e.avatar_url,e.name||e.email):""},ma=t=>{let e=De(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${y(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${Jt(12)}</b>`},ha=(t,e)=>{let s=(a,d)=>`<option value="${y(a)}" data-c="${Pe(a)}"${xn(a||null)}${t===a?" selected":""}>${y(d)}</option>`,o=(n.team??[]).filter(a=>a.email!==n.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${Pe(t)}">${ws(t||null)||sn}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
|
|
177
|
+
${n.me?s(n.me.email,`Me \xB7 ${n.me.name||n.me.email}`):""}
|
|
178
|
+
${o.map(a=>s(a.email,a.name||a.email)).join("")}${t&&t!==n.me?.email&&!o.some(a=>a.email===t)?s(t,Je(t)):""}
|
|
179
|
+
</select></span></label>`},ga=t=>`<div class="dt-suggest dt-suggest--read"><del>${y(t.from)}</del><ins>${y(t.to)}</ins></div>`,$s=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return y([s,jt(e??"")&&`\u201C${jt(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},xs='<svg class="dt-chev" viewBox="0 0 12 12" width="9" height="9" aria-hidden="true"><path d="M3 4.5 6 7.5 9 4.5"/></svg>',ba=(t,e)=>{let s=ye(t);return`<label class="dt-field dt-field--bare" data-tip="Type: ${y(s.label)}"><span class="dt-field-box">${ss(s)}<span class="dt-field-label">${y(s.label)}</span>${xs}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(o=>`<option value="${o.id}" data-c="${o.color}" data-icon="${y(ss(o))}"${o.id===t?" selected":""}>${o.label}</option>`).join("")}</select></span></label>`},En=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","Needs review","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875],["accepted","Accepted","#30a46c",.95]],Es=(t,e)=>{let o=2*Math.PI*e,a=8+3.3*Math.sin(o),d=8-3.3*Math.cos(o),c=`<path d="M8 8V${8-3.3}A${3.3} ${3.3} 0 ${e>.5?1:0} 1 ${a.toFixed(2)} ${d.toFixed(2)}Z" fill="${t}"/>`;return`<svg class="dt-stage-icon" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><rect x="3.2" y="3.2" width="9.6" height="9.6" rx="2.4" transform="rotate(45 8 8)" fill="none" stroke="${t}" stroke-width="1.5"/>${c}</svg>`},Qe=t=>Ot(t)==="accepted"?"accepted":ze(t)||Ot(t)==="progress"?"progress":Ot(t)==="review"?"review":Ot(t)==="waiting"?"waiting":"new",tn={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"accepted"},Ms=[...En,["done","Resolved","#30a46c",1]],fa=t=>{let e=Ft(t),s=t.status==="done"&&e!=="review"?"done":e&&tn[e]?tn[e]:Qe(t),[,,o,a]=Ms.find(d=>d[0]===s);return`<label class="dt-field" data-tip="${e&&tn[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Es(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${Ms.map(([d,c,v,T])=>`<option value="${d}" data-c="${v}" data-icon="${y(Es(v,T))}"${d===s?" selected":""}>${c}</option>`).join("")}</select></span></label>`},ks=(t,e)=>{let s=G.find(d=>d.id===t);if(!s)return;if(e==="done"){ke(t,!0);return}let o=e==="new"?wt(s.assignee)?"approved":"new":e,a=s.status==="done"?{status:"open",doneBy:null}:{};Vt(d=>d.map(c=>c.id===t?{...c,...a,stage:o}:c),()=>h({id:t,...a,stage:o}),"Setting the status")},en=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],ya=(t,e)=>{let s=Math.max(0,en.findIndex(v=>v[0]===t)),[,o,a,d]=en[s],c=en[(s+1)%en.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${c[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${c[1]}" aria-label="Priority ${o}">${_o(d,a)}<span>${o}</span></button>`},nn=()=>!!n.me&&/@guest\.notemend\.com$/i.test(n.me.email),Ss=(t,e,s,o,a=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":ya(t,s)}${ba(ye(e).id,s)}</span>${n.client||nn()?"":la(o,s,a)}</div>`,sn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/></svg>',va='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="8.5" cy="6.8" r="3"/><path d="M2.8 16.5c.6-3 3-4.8 5.7-4.8 1.3 0 2.5.4 3.5 1.1M15.5 11v5M13 13.5h5" stroke-linejoin="round"/></svg>',wa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/><path d="M3.5 3.5l13 13"/></svg>',$a='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.1" fill="currentColor" stroke="none"/></svg>',Ls=(t,e)=>`<label class="dt-more" data-tip="More"><span aria-hidden="true">${$a}</span><select class="dt-more-select"${e?` data-id="${e}"`:""} aria-label="More">
|
|
180
|
+
<option value="" hidden selected></option>
|
|
181
|
+
${n.client?"":`<option value="team" data-icon="${y(wa)}"${t?"":" data-on"}>Team only</option>
|
|
182
|
+
<option value="client" data-icon="${y(sn)}"${t?" data-on":""}>Team and client</option>`}
|
|
183
|
+
<option value="${e?"rm":"discard"}" data-icon="${y(fe)}" data-danger${n.client?"":" data-sep"}>${e?"Delete thread":"Discard draft"}</option>
|
|
184
|
+
</select></label>`,Ts='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z"/><circle cx="10" cy="10" r="2.3"/></svg>',As=()=>(n.team??[]).filter(t=>!n.studio||n.studio.includes(t.email)),Cs=t=>{let e=t||n.lead||"",s=As();return!s.length||s.some(o=>o.email===e)?e:s[0].email},xa=t=>{let e=Cs(t),s=As();if(!s.length)return"";let o=ws(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Pe(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
|
|
185
|
+
${s.map(a=>`<option value="${y(a.email)}" data-c="${Pe(a.email)}"${xn(a.email)}${e===a.email?" selected":""}>${y(a.name||a.email)}</option>`).join("")}
|
|
186
|
+
</select></span></label>`},Mn='<svg viewBox="0 0 20 20" width="9" height="9" aria-hidden="true"><path d="M5.5 5.5l9 9M14.5 5.5l-9 9"/></svg>',Hs='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',Ea='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M2.5 1.5h2.5v9H2.5zM7 1.5h2.5v9H7z"/></svg>',Ma=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,ka=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let v=s.querySelector(".dt-voice-track i"),T=s.querySelector(".dt-voice-time"),P=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{v.style.transform=`scaleX(${P()?Math.min(1,o.currentTime/P()):0})`,T.textContent=Ma(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=Ea,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=Hs,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let d=()=>{if(e){let v=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-v.left)/v.width))*o.duration);return}if(!o.paused){o.pause();return}Y.querySelectorAll(".dt-voice audio").forEach(v=>{v!==o&&v.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?d():c(),{once:!0}):d();return}c();function c(){o.addEventListener("timeupdate",()=>{o.currentTime=0,d()},{once:!0}),o.currentTime=1e9}},kn=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),Bs=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Oe=new Map,Sa=t=>{if(!t.startsWith("data:"))return t;let e=Oe.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),Oe.set(t,e),Oe.size>8){let[a,d]=Oe.entries().next().value;URL.revokeObjectURL(d),Oe.delete(a)}}return e},La=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${Hs}</button><button type="button" class="dt-voice-track" data-act="voice-seek" aria-label="Jump"><i></i></button><span class="dt-voice-time">0:00</span><audio src="${Sa(t)}" preload="metadata"></audio>${e===void 0?"":`<button class="dt-voice-rm" data-act="voice-write" ${e} aria-label="Write it out" title="Write it out \u2014 its words go in the box">${Na}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${Mn}</button>`}</span>`,Ta=(t,e,s)=>`<span class="dt-shot dt-doc">${t.startsWith("data:")?`<span class="dt-doc-name">${Ps}${y(e)}</span>`:`<a class="dt-doc-name" href="${t}" target="_blank" rel="noreferrer">${Ps}${y(e)}</a>`}${s===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${s} aria-label="Remove">${Mn}</button>`}</span>`,Rs=(t,e,s=t)=>Xn(s)?Ta(t,Xn(s),e):kn(s)?La(t,e):`<span class="dt-shot${Bs(s)?" dt-shot--video":""}">${Bs(s)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${Mn}</button>`}</span>`,Sn=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=ko(o);return Rs(a,e===void 0?void 0:`data-id="${e}" data-img="${y(o)}"`,o)}).join("")}</div>`:"",Ns=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>Rs(e,`data-i="${s}"`)).join("")}</div>`:"",Ps='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M11.5 2.5H6a1.5 1.5 0 0 0-1.5 1.5v12A1.5 1.5 0 0 0 6 17.5h8a1.5 1.5 0 0 0 1.5-1.5V6.5z"/><path d="M11.5 2.5v4h4"/></svg>',Aa='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="7.5" y="3" width="5" height="9" rx="2.5"/><path d="M5 9.5a5 5 0 0 0 10 0M10 14.5V17"/></svg>',Ca='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Ha=90,Ln=32,Ba=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",on=!1,Ra=async(t,e)=>{if(on||!t)return;let s=Number(t.dataset.id)||0;on=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o;try{o=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(rt){on=!1,e.classList.remove("is-asking");let Et=rt?.name;Ut(Et==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Et==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Et==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${rt?.message||Et||"unknown error"}`);return}e.classList.remove("is-asking");let a=()=>Y.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),d=document.createElement("div");d.className="dt-rec",d.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${fe}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Ln)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Ca}</button>`;let c=d.querySelector("b"),v=[...d.querySelectorAll(".dt-rec-wave i")],T=new AudioContext,P=T.createAnalyser();P.fftSize=512,T.createMediaStreamSource(o).connect(P);let u=new Uint8Array(P.fftSize),X=[],F=new MediaRecorder(o,{audioBitsPerSecond:32e3}),nt=[],yt=Date.now(),Kt=!0,Yt=setInterval(()=>{let rt=a();rt&&d.parentElement!==rt&&rt.appendChild(d),P.getByteTimeDomainData(u);let Et=0;for(let le of u)Et+=((le-128)/128)**2;X.push(Math.min(1,Math.sqrt(Et/u.length)*4));let ie=X.slice(-Ln);v.forEach((le,Ae)=>{let ge=ie[Ae-(Ln-ie.length)];le.style.transform=`scaleY(${Math.max(.1,ge??0).toFixed(2)})`,le.classList.toggle("is-empty",ge===void 0)});let Z=Math.floor((Date.now()-yt)/1e3);c.textContent=`${Math.floor(Z/60)}:${String(Z%60).padStart(2,"0")}`,Z>=Ha&&F.state!=="inactive"&&F.stop()},90),Te=rt=>{Kt=rt,F.state!=="inactive"&&F.stop()};d.querySelector(".dt-rec-x").addEventListener("click",rt=>{rt.stopPropagation(),Te(!1)}),d.querySelector(".dt-rec-done").addEventListener("click",rt=>{rt.stopPropagation(),Te(!0)}),d.addEventListener("keydown",rt=>{rt.key==="Escape"&&(rt.stopPropagation(),Te(!1))}),F.ondataavailable=rt=>{rt.data.size&&nt.push(rt.data)},F.onstop=async()=>{if(clearInterval(Yt),o.getTracks().forEach(ie=>ie.stop()),T.close().catch(()=>{}),d.remove(),on=!1,!Kt)return;let rt=new Blob(nt,{type:F.mimeType||"audio/webm"}),Et=await new Promise(ie=>{let Z=new FileReader;Z.onload=()=>ie(String(Z.result)),Z.readAsDataURL(rt)});s?xt.push(Et):S&&(S.images??=[]).push(Et),V(),a()?.querySelector("textarea")?.focus()},F.start(1e3),a()?.appendChild(d),d.querySelector(".dt-rec-done").focus()},Ds="\u{1F3A4} Voice note",Na='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><rect x="2.5" y="4.5" width="15" height="11" rx="2"/><path d="M6 11.5h3M11 11.5h3M6 8.5h8"/></svg>',Pa=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?S?.images??[]:xt)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await Rt("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),d=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!d.text){Ut(d.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let c=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");c&&(c.value=c.value.trim()?`${c.value.trimEnd()} ${d.text}`:d.text,c.dispatchEvent(new Event("input",{bubbles:!0})),c.focus())},Qt=new Map,Os=async(t,e,s)=>{let o=`${t}:${e}`;if(!s&&Qt.has(o)){Qt.delete(o),V();return}let a=G.find(T=>T.id===t),d=a&&be(a).find(T=>(T.at??"0")===e);if(!d?.text)return;Qt.set(o,null),V();let c=await Rt("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:d.text,to:s||navigator.language||"en"})}).catch(()=>null),v=c?await c.json().catch(()=>({})):{};Qt.has(o)&&(c?.ok&&v.text?Qt.set(o,v.text):(Qt.delete(o),Ut(v.error||"Could not translate it \u2014 try again.")),V())},Da=["uk","ru","en"],Oa=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Ia=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${xs}</span><select class="dt-lang-select" data-id="${t}" data-at="${y(e)}" aria-label="Translate into"><option value="" selected hidden></option>${Da.map(s=>`<option value="${y(s)}">${y(Oa(s))}</option>`).join("")}</select></label>`,qa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 5h8M7 3v2m2 0c-.6 3.2-2.8 6-6 7.5M5.5 8.5c.8 1.6 2.2 2.9 4 3.8M10.5 17l3.25-7.5L17 17m-5.5-2h4.5"/></svg>',Fa='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2"/><circle cx="7.5" cy="8.5" r="1.4"/><path d="m3.5 14.5 4-4 3 3 2-2 4 4"/></svg>',Is=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
187
|
+
<textarea class="${t}" rows="1" placeholder="${e}">${y(s)}</textarea>
|
|
188
|
+
${a}
|
|
189
|
+
<div class="dt-compose-bar">
|
|
190
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a screenshot, a PDF or a Word file \u2014 or paste or drop one">${Fa}</button>
|
|
191
|
+
${Ba()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Aa}</button>`:""}</span>
|
|
192
|
+
<button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
|
|
193
|
+
><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 15.5v-11M5.5 9 10 4.5 14.5 9"/></svg></button>
|
|
194
|
+
</div>
|
|
195
|
+
</div></div>`,Tn=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),qs=()=>ft.map((t,e)=>({i:e,el:Tn(t.tag,t.classes),text:jt(t.text??""),shots:t.images?.length??0,orphan:!Wt(t)})),An=[],Fs="",zt=t=>{let e=t.working;return he(e?.agent,e?.by??Qn(t.assignee))},js=t=>{let e=Math.max(1,Math.round((Date.now()-Date.parse(t??""))/6e4)||1);return e<60?`${e} min`:`${Math.round(e/60)} h`},an=(t,e)=>{let s=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${zt(t)} \u2014 it takes it on its next run`,asks:`${zt(t)} is waiting for your answer`,working:`${zt(t)} is on it \xB7 ${js(s?.at)}`,stuck:`${zt(t)} went quiet \u2014 its next run takes it again`,review:`Resolved by ${he(t.doneAgent,t.doneFor)} \u2014 click to clear`,done:"Resolved"}[e]},ja=t=>{let e=Ft(t);if(!e)return n.client||nn()||t.status==="done"?"":`<button class="dt-note-state dt-step--none" data-act="hand" data-v="agent" data-id="${t.id}" data-tip="Hand to Claude" aria-label="Hand to Claude">${ns(13,0)}</button>`;let s=ns(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${y(an(t,e))}" aria-label="${y(an(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${y(an(t,e))}" role="img" aria-label="${y(an(t,e))}">${s}</span>`},_s=t=>{let e=ct(t),s=e==="done";return`${ja(t)}<button data-act="${s?"reopen":"done"}" data-id="${t.id}"
|
|
196
|
+
class="dt-note-resolve${s?" is-on":""}" title="${s?"Reopen":e==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${It}</button>`},_a=t=>t?new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}):"",Wa=t=>{if(n.client)return"";let e=Ft(t),s={act:"hand",v:"me",icon:sn,tip:n.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:He,tip:"Reopen"},a=[{act:"accept",icon:It,tip:"Looks right \u2014 accept it",main:!0},{act:"sendback",icon:He,tip:"Send it back \u2014 say what is wrong below"}],d=t.working,c=!wt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":Je(t.assignee):"",v=e==="queued"?{step:e,title:`Queued for ${zt(t)}`,acts:[s]}:e==="working"?{step:e,title:`${zt(t)} is working`,acts:[s],live:!0}:e==="asks"?{step:e,title:`${zt(t)} asks`,acts:[]}:e==="stuck"?{step:e,title:`${zt(t)} silent for ${js(d?.at)}`,acts:[s]}:e==="review"?null:t.status!=="done"&&Ot(t)==="accepted"?{step:"done",title:`Accepted${t.acceptedAt?` \xB7 ${_a(t.acceptedAt)}`:""}`,acts:[{...o,act:"sendback",tip:"Send it back"}]}:Ot(t)==="review"&&c?{step:"review",title:`${c} ${c==="You"?"say":"says"} done \u2014 check it`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&n.me&&!nn()?{step:"anyone",title:"Unassigned",acts:[{act:"hand",v:"me",icon:It,tip:"Take it myself"},{act:"hand",v:"agent",icon:Jt(13),tip:`Give it to ${zt(t)}`},{act:"give",icon:va,tip:"Give it to someone",pick:!0}]}:null;return v?`<div class="dt-step dt-step--${v.step}">${v.step==="anyone"?us:""}<span class="dt-step-text"><b>${y(v.title)}</b></span>${v.acts.map(T=>T.pick?`<label class="dt-step-act" data-tip="${y(T.tip)}">${T.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${y(T.tip)}"><option value="" selected hidden></option>${Ee().map(P=>`<option value="${y(P.email)}"${xn(P.email)}>${y(P.email===n.me?.email?`Me \xB7 ${P.name||P.email}`:P.name||P.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${T.main?" is-main":""}" data-act="${T.act}" data-id="${t.id}"${T.v?` data-v="${T.v}"`:""} data-tip="${y(T.tip)}" aria-label="${y(T.tip)}">${T.icon}</button>`).join("")}${v.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},za=async(t,e)=>{let s=e?G.find(a=>a.id===t):void 0,o=await h(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:Ws(G.find(a=>a.id===t))});return o.ok&&s&&Wn(Zt(s)).then(a=>{a&&h({id:t,after:a})}),o},Cn=0,Hn=t=>(Cn++,t.finally(()=>{Cn--})),Vt=async(t,e,s)=>{let o=G,a=te;G=t(G),te=t(te),V();let d=await Hn(e()).catch(()=>null);if(!d?.ok){G=o,te=a,V(),zn(`${s} did not go through`,d);return}let c=rn([await d.json().catch(()=>null)])[0];c&&(G=G.map(v=>v.id===c.id?c:v),te=te.map(v=>v.id===c.id?c:v),V()),cn()},Ws=t=>t?wt(t.assignee)?"approved":t.assignee?"progress":"new":"new",ke=(t,e)=>Vt(s=>s.map(o=>o.id===t?{...o,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:Ws(o),reopenedAt:new Date().toISOString()}}:o),()=>za(t,e),e?"Resolving":"Reopening"),Bn=t=>Vt(e=>e.filter(s=>s.id!==t),()=>Rt(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Va=t=>{let e=G.filter(a=>M(a)===t),s=e.filter(a=>ct(a)==="open").length,o=e.filter(a=>ct(a)==="claude").length;pe.innerHTML=s?String(s):o?Jt(9):"\u2713",pe.dataset.state=s?"open":o?"claude":"done",pe.hidden=e.length===0},Rn=0,zs,Ie=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t)return;t.style.translate="";let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)};window.visualViewport?.addEventListener("resize",Ie),addEventListener("resize",Ie),document.addEventListener("focusin",Ie),document.addEventListener("focusout",()=>setTimeout(Ie));let V=()=>{requestAnimationFrame(Ie);let t=Rn-performance.now();if(t>0){clearTimeout(zs),zs=setTimeout(V,t);return}if(mt(),$){let u=qs(),X=JSON.stringify(u);X!==Fs&&(Fs=X,parent.postMessage({dt:!0,drafts:u},location.origin))}is(),j.toggleAttribute("data-yield",st!=null||!!S),st!==se&&(Tt="",xt=[],se=st),it&&it.id!==st&&(it=null);let e=me();if(Va(e),!lt){Y.innerHTML="",wn(null);return}let s=e,o="",a=G.filter(u=>M(u)===s&&(bt||ct(u)!=="done"||u.id===st));for(let u of a){let X=Wt(u);if(!X&&st!==u.id)continue;let F=ct(u),nt=!X,yt=X??{x:0,y:0},Kt=ye(u.category),Yt=ze(u),Te=F==="done"?null:Ft(u),rt=Te?$n[Te]??"":"";if(st===u.id&&pa(u),nt||(o+=`<button class="dt-pin dt-pin--${F}${rt?" dt-pin--agent":""}${Yt?" dt-pin--working":""}${F==="open"&&Ot(u)==="review"?" dt-pin--review":""}" data-id="${u.id}"${X?.off?` data-off="${X.off}"`:""} aria-label="Comment ${u.id}, ${F==="open"?"open":F==="claude"?`resolved by ${y(he(u.doneAgent,u.doneFor))}`:"resolved"}" aria-expanded="${st===u.id}"
|
|
197
|
+
style="left:${yt.x}px;top:${yt.y}px;--cat:${Kt.color};--ring:${En.find(Et=>Et[0]===Qe(u))[2]};--hue:${fs(u.by||u.byName||"")}${rt?`;--step-c:${rt}`:""}"
|
|
198
|
+
title="${y(u.text.slice(0,80))} \xB7 ${Kt.label}${Yt?` \xB7 ${y(he(Yt.agent,Yt.by))} is on it`:""}${F==="claude"?` \xB7 resolved by ${y(he(u.doneAgent,u.doneFor))} \u2014 tick to confirm`:F==="done"?" \xB7 resolved":""}">${F==="done"?"\u2713":rt?Jt(11):bs(u)}${F!=="done"&&st!==u.id&&vs(u)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button>`),st===u.id){let Et=be(u),ie=Ft(u)==="review"&&!n.client?Et.map(Z=>Z.author).lastIndexOf("claude"):-1;o+=`<div class="dt-note${nt?" dt-note--orphan":""}" data-id="${u.id}" role="dialog" aria-label="Comment ${u.id}"
|
|
199
|
+
style="left:${yt.x}px;top:${yt.y}px">
|
|
200
|
+
<div class="dt-note-bar">
|
|
201
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${$s(u.selector,u.label)}"`}>${n.client?`Comment #${u.id>0?u.id:"\u2026"}`:y(Tn(u.tag,u.classes))}</span>
|
|
202
|
+
<span class="dt-note-tools">
|
|
203
|
+
${!n.client&&u.shared?`<span class="dt-note-eye" data-tip="The client sees this thread" role="img" aria-label="The client sees this thread">${Ts}</span>`:""}
|
|
204
|
+
${_s(u)}
|
|
205
|
+
<i class="dt-note-sep"></i>
|
|
206
|
+
${Ls(u.shared,u.id)}
|
|
207
|
+
<button data-act="close" data-id="${u.id}" data-tip="Close" aria-label="Close">${ce}</button>
|
|
208
|
+
</span>
|
|
209
|
+
</div>
|
|
210
|
+
${nt?'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>':""}
|
|
211
|
+
${(()=>{let Z=(n.client?"":fa(u))+(u.host&&u.host!==location.host?`<span class="dt-note-host" title="Written on ${y(u.host)}">${y(u.host)}</span>`:"");return Z?`<div class="dt-note-meta">${Z}</div>`:""})()}
|
|
212
|
+
<div class="dt-note-thread">
|
|
213
|
+
${Et.map((Z,le)=>{let Ae=le===0?null:Z.at??null,ge=Z.author==="you"&&(!Z.by||Z.by===n.me?.email),wo=ge&&it?.id===u.id&&it.at===Ae,_e=n.team?.find(Yn=>Yn.email===Z.by),$o=Z.author==="claude"?he(Z.agent,Z.by):ge?"You":_e?.name||Z.byName||Z.by||"You",xo=Z.author==="claude"?_e?.agent_avatar_url?`<img class="dt-msg-face" src="${y(_e.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${Jt(11)}</span>`:_e?.avatar_url?`<img class="dt-msg-face" src="${y(_e.avatar_url)}" alt="">`:"",Kn=`${u.id}:${Z.at??"0"}`,pn=Qt.get(Kn),Eo=!ge&&n.voice&&Z.text?`<button class="dt-msg-edit${Qt.has(Kn)?" is-on":""}" data-act="translate" data-id="${u.id}" data-at="${y(Z.at??"0")}" title="${Qt.has(Kn)?"Show the original":"Translate into your language"}">${qa}</button>${Ia(u.id,Z.at??"0")}`:"",Mo=`<div class="dt-msg-head">${xo}<b>${y($o)}</b><time>${Ve(Z.at)}</time>${Eo}${ge&&!wo?`<button class="dt-msg-edit" data-act="edit" data-id="${u.id}" data-at="${y(Ae??"")}" title="Edit">${Ue}</button>${Ae?`<button class="dt-msg-edit" data-act="unsay" data-id="${u.id}" data-at="${y(Ae)}" title="Delete">${fe}</button>`:""}`:""}</div>`;return le===ie?`<div class="dt-msg dt-msg--done" data-msg="${u.id}:${y(Z.at??"0")}"><div class="dt-msg-head">${xo}<b>${y($o)} fixed it</b><time>${Ve(Z.at)}</time>${Eo}</div><p${pn===null?' class="is-asking"':""}>${ro(pn||Z.text)}</p>${Sn(Z.images)}
|
|
214
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${u.id}">${It}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${u.id}">${He}Send back</button></div></div>`:wo?`<div class="dt-msg">${Mo}<div class="dt-compose">
|
|
215
|
+
<textarea class="dt-note-edit-input" rows="1">${y(it.text)}</textarea>
|
|
216
|
+
${Sn(Z.images.filter(Yn=>!it.drop.includes(Yn.split("/").pop())),u.id)}
|
|
217
|
+
<div class="dt-compose-bar">
|
|
218
|
+
<button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
|
|
219
|
+
<button class="dt-send${it.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${It}</button>
|
|
220
|
+
</div>
|
|
221
|
+
</div></div>`:`<div class="dt-msg" data-msg="${u.id}:${y(Z.at??"0")}">${Mo}<p${pn===null?' class="is-asking"':""}>${ro(pn||Z.text)}</p>${le===0&&u.suggest?ga(u.suggest):""}${Sn(Z.images)}</div>`}).join("")}
|
|
222
|
+
</div>
|
|
223
|
+
${Wa(u)}
|
|
224
|
+
${Is("dt-note-reply-input",Ft(u)==="asks"?`Answer ${y(zt(u))}`:"Reply",Tt,`data-act="reply" data-id="${u.id}"`,Ns(xt))}
|
|
225
|
+
${Ss(u.priority,u.category,u.id,u.assignee??"",es(u))}
|
|
226
|
+
</div>`}}ft.forEach((u,X)=>{let F=Wt(u);F&&(o+=`<button class="dt-pin dt-pin--draft" data-parked="${X}" data-act="draft-open" data-i="${X}"
|
|
227
|
+
style="left:${F.x}px;top:${F.y}px" title="Draft, not sent \u2014 click to finish it">${Ue}</button>`)});let d=S&&Wt(S);if(S){let u=d?.x??0,X=d?.y??0;o+=`${d?`<span class="dt-pin dt-pin--draft" data-draft style="left:${u}px;top:${X}px"></span>`:""}
|
|
228
|
+
<div class="dt-note${d?"":" dt-note--orphan"}" data-draft style="left:${u}px;top:${X}px">
|
|
229
|
+
<div class="dt-note-bar">
|
|
230
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${$s(S.selector,S.label)}"`}>${n.client?"New comment":y(Tn(S.tag,S.classes))}</span>
|
|
231
|
+
${ne()?'<span class="dt-note-draft">Draft</span>':""}
|
|
232
|
+
<span class="dt-note-tools">
|
|
233
|
+
${!n.client&&S.shared?`<span class="dt-note-eye" data-tip="The client will see this thread" role="img" aria-label="The client will see this thread">${Ts}</span>`:""}
|
|
234
|
+
${Ls(S.shared)}
|
|
235
|
+
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${ce}</button>
|
|
236
|
+
</span>
|
|
237
|
+
</div>
|
|
238
|
+
${d?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
|
|
239
|
+
${(()=>{let F=d?Zt(S):null,nt=F&&G.find(yt=>yt.id>0&&ct(yt)==="open"&&Zt(yt)===F);return nt?`<p class="dt-note-twin">Already open here: \u201C${y(nt.text.slice(0,60))}${nt.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${nt.id}">Open it</button></p>`:""})()}
|
|
240
|
+
${n.client?`<div class="dt-note-meta">${xa(S.assignee)}</div>`:""}
|
|
241
|
+
${S.suggest?`<div class="dt-suggest"><span class="dt-suggest-head">New wording for this text<button data-act="unsuggest" title="Keep the text as it is">${ce}</button></span>
|
|
242
|
+
<span class="dt-suggest-was">Now: <del>${y(S.suggest.from.slice(0,160))}${S.suggest.from.length>160?"\u2026":""}</del></span>
|
|
243
|
+
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${y(S.suggest.to)}</textarea>
|
|
244
|
+
<span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
|
|
245
|
+
${Is("dt-note-input",S.suggest?"Why (optional)":"Comment",S.text??"",'data-act="save"',Ns(S.images))}
|
|
246
|
+
${Ss(S.priority,S.category,void 0,S.assignee??"")}
|
|
247
|
+
</div>`}let c=new Map([...Y.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(u=>[u.closest(".dt-note").dataset.id,{top:u.scrollTop,end:u.scrollTop+u.clientHeight>=u.scrollHeight-4}])),v=new Set([...Y.querySelectorAll("[data-msg]")].map(u=>u.dataset.msg)),T=Y.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Y.innerHTML=o,T&&dn(".dt-note-reply-input");for(let u of Y.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let X=u.closest(".dt-note").dataset.id,F=c.get(X);if(!F)continue;let nt=[...u.querySelectorAll("[data-msg]")].filter(yt=>!v.has(yt.dataset.msg));for(let yt of nt)yt.classList.add("dt-msg--new");u.scrollTop=F.end&&nt.length?u.scrollHeight:F.top}for(let u of Y.querySelectorAll(".dt-note")){let X=u.getBoundingClientRect();X.bottom>innerHeight-8&&(u.dataset.flip="1"),X.right>innerWidth-8&&(u.dataset.flipx="1")}qe(s),wn(cs()),oe();for(let u of Y.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Un(u);let P=Y.querySelector(".dt-note-input");P&&(P.focus(),P.setSelectionRange(P.value.length,P.value.length))},Ua=()=>{let t=!1,e=[];for(let s of Y.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(s.classList.contains("dt-note--orphan"))continue;let o=G.find(d=>d.id===Number(s.dataset.id)),a=o&&Wt(o);e.push([s,a]),a&&ds(a.el)&&(t=!0)}for(let s of Y.querySelectorAll("[data-draft], [data-parked]")){if(s.classList.contains("dt-note--orphan"))continue;let o=s.dataset.parked?ft[Number(s.dataset.parked)]:S;e.push([s,o?Wt(o):null])}for(let[s,o]of e){if(!o){s.style.visibility="hidden";continue}s.style.visibility="",s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.matches(".dt-pin[data-id]")&&(o.off?s.dataset.off=o.off:delete s.dataset.off)}if(!Xe.length&&(S||st!=null)){let s=cs();s&&ds(s)&&wn(s)}t&&oe()},qe=t=>{if(!j.hidden&&(j.innerHTML=Ko({bp:t,notes:G,breakpoints:l,bandOfNote:M,orphan:e=>!Wt(e),whoseAgent:he,statusTools:_s,showResolved:bt,drafts:Bt.hidden?qs():An,checks:$?0:On.toCheck().length,marker:Ka,find:ht,forMe:Ga,forAgent:e=>!!Ft(e)&&ct(e)!=="done",unread:vs}),Se)){let e=j.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Se.at,Se.at),Se=null}},Se=null,Ga=t=>{if(ct(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||ct(t)==="claude"||Ot(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return be(t).some(s=>s.text.toLowerCase().includes("@"+e))},Ka=t=>{if(ct(t)==="done")return'<span class="dt-hist-n"></span>';let s=$n[Ft(t)??""];if(s)return`<span class="dt-hist-face dt-hist-face--agent" style="--step-c:${s}">${Jt(10)}</span>`;let o=bs(t);return o?`<span class="dt-hist-face" style="--ring:${En.find(a=>a[0]===Qe(t))[2]};--hue:${fs(t.by||t.byName||"")}">${o}</span>`:`<span class="dt-hist-n" style="--cat:${ye(t.category).color}"></span>`},Nn=t=>j.toggleAttribute("data-collapsed",t);j.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(ht.q=e.value,Se={at:e.selectionStart??e.value.length},qe(me()))}),j.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await cn(),setTimeout(()=>delete e.dataset.spin,500);return}if(j.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){Nn(!1);return}if(t.target.closest("[data-fold]")){Nn(!j.hasAttribute("data-collapsed"));return}let s=t.target.closest(".dt-hist-bands [data-bp]");if(s){co(s.dataset.bp);return}let o=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(o){o.dataset.histView?(ht.view=o.dataset.histView,A("dt-view",ht.view),ht.menu=!1):o.dataset.histSort?(ht.sort=o.dataset.histSort,A("dt-sort",ht.sort),ht.menu=!1):o.hasAttribute("data-hist-clear")?(ht.q="",Se={at:0}):ht.menu=!ht.menu,qe(me());return}ht.menu&&!t.target.closest(".dt-hist-menu")&&(ht.menu=!1,qe(me()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let u=a.dataset.draftRm!==void 0,X=Number(u?a.dataset.draftRm:a.dataset.draftGo);Bt.hidden?u?Vs(X):Dn(X):qt(u?{dropDraft:X}:{openDraft:X});return}let d=t.target.closest("[data-unmark]");if(d){t.stopPropagation(),await ke(Number(d.dataset.unmark),!1);return}let c=t.target.closest(".dt-hist-tools [data-act]");if(c){await ke(Number(c.dataset.id),c.dataset.act==="done");return}let v=t.target.closest("[data-rm]");if(v){st=null,await Bn(Number(v.dataset.rm));return}if(t.target.closest("[data-review]")){On.start();return}if(t.target.closest("[data-resolved]")){qn(!bt);return}let T=t.target.closest("[data-go]");if(!T)return;let P=Number(T.dataset.go);if(!Bt.hidden){qt({open:P});return}Pn(P)});let Pn=t=>{st=t,Dt(),V();let e=G.find(o=>o.id===t),s=e&&Wt(e);s?scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"}):e&&Zt(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||Y.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},Dn=t=>{let[e]=ft.splice(t,1);if(!e)return;Dt(),S=e,st=null;let s=Wt(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),V()},Vs=t=>{ft.splice(t,1),V()},On=Yo({inFrame:$,everything:()=>te,route:()=>k,settle:ke,keepIn:Be,toast:t=>Ut(t),open:t=>{if(lt||ae(!0),M(t)!==me()){co(M(t));for(let e of[600,1500])setTimeout(()=>qt({open:t.id}),e)}else Pn(t.id)}}),Ya=t=>{j.hidden=!t,N.setAttribute("aria-pressed",String(t)),A("dt-history",t?"1":"0"),V()},In=document.querySelector(".dt-resolved-btn"),qn=t=>{bt=t,In.setAttribute("aria-pressed",String(t)),A("dt-resolved",t?"1":"0"),qt({resolved:t}),V(),Le(!0)};In.addEventListener("click",()=>qn(!bt)),In.setAttribute("aria-pressed",String(bt)),N.addEventListener("click",()=>{let t=j.hidden===!0;t&&!lt&&ae(!0),t&&Nn(!1),Ya(t)});let oe=()=>{Re||!lt||(Re=requestAnimationFrame(()=>{Re=0,Ua()}))},Us=`${ee}, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,Xa=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Us))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Us))},Gs=new MutationObserver(t=>{t.every(Xa)||(ls(),oe())}),Ks=new ResizeObserver(()=>oe()),te=[],Ja=t=>{te=t;let e=()=>({new:0,progress:0,review:0,waiting:0,accepted:0,done:0}),s={};for(let v of t){let T=ct(v),P=Ft(v),u=T==="done"?"done":T==="claude"?"review":P&&tn[P]||Qe(v),X=s[v.route??""]??={...e(),bands:{}};X[u]++;let F=M(v);(X.bands[F]??=e())[u]++}let o=["new","progress","review","waiting","accepted","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",accepted:"accepted",done:"resolved"},d=v=>o.map(T=>[T,T==="done"&&!bt?0:v[T]]),c=v=>d(v).reduce((T,[,P])=>T+P,0);for(let v of document.querySelectorAll(".dt-pages a")){let T=v.querySelector(".dt-pages-n");if(!T)continue;let P=s[new URL(v.href).pathname.replace(/\/+$/,"")||"/"];for(let F of l){let nt=P?.bands[F.id];for(let[yt,Kt]of d(nt??e())){let Yt=T.querySelector(`[data-bp="${F.id}"][data-state="${yt}"]`);Yt.hidden=!Kt,Kt&&(Yt.querySelector("i").textContent=String(Kt),Yt.title=`${F.label}: ${Kt} ${a[yt]}`)}}let u=P?c(P):0;T.hidden=!u;let X=P?l.filter(F=>P.bands[F.id]&&c(P.bands[F.id])).map(F=>`${F.label} ${c(P.bands[F.id])}`).join(" \xB7 "):"";T.title=u?`${o.filter(F=>P[F]).map(F=>`${P[F]} ${a[F]}`).join(" \xB7 ")}
|
|
248
|
+
${X}`:""}},rn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string").map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(s=>typeof s?.text=="string"):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[]})),Za=Xo($,t=>Ut(t)),ln="",Fn=!1,Ys=t=>{ln=t.version??"",Za(t);let e=rn(t.comments);Ja(e);let s=e.filter(o=>o.route===k);if(JSON.stringify(s)===JSON.stringify(G)){!j.hidden&&!$&&V();return}if(Y.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){ln="",setTimeout(Fe,5e3);return}G=s,V(),qt({reload:!0})},Le=async(t=!1)=>{let e=[t||!ln?"":`since=${ln}`,bt?"":"open=1"].filter(Boolean).join("&");try{let s=await Rt(`comments${e?`?${e}`:""}`);s.status===200&&Ys(await s.json())}catch{}},Fe=async()=>{document.hidden||Fn||Cn||(Fn=!0,await Le(),Fn=!1)},jn=()=>{G=te.filter(t=>t.route===k),V()},_n=0,Xs=t=>{_n||(_n=requestAnimationFrame(()=>{_n=0;let e=t.target;if(!lt||e.closest(Ct)){gt.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(gt.hidden=!1,!s)return;let o=s.getBoundingClientRect();Ht.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Lt.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Lt.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},Js=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),it){it=null,V();return}if(S){Dt(),V();return}if(st!==null){st=null,V();return}ae(!1)}},Zs=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Qs=t=>{t.target.closest?.(Ct)||t.stopPropagation()},to=t=>{if(t.target.closest(Ct))return;if(t.preventDefault(),t.stopPropagation(),kt){kt=!1;return}if(!getSelection()?.isCollapsed)return;Y.hidden=!0;let s=document.elementFromPoint(t.clientX,t.clientY);if(Y.hidden=!1,!s)return;Dt();let o=s.getBoundingClientRect(),a=s.tagName.toLowerCase(),d=[...s.classList].filter(c=>!/^(astro|svelte|css)-/.test(c)).slice(0,2);S={selector:ea(s),tag:a,classes:d,nth:na({tag:a,classes:d}).indexOf(s),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:jt(s.textContent||"").slice(0,60),ctx:sa(s),category:g[0].id},no.set(S,or().then(()=>Wn(s))),st=null,gt.hidden=!0,V()},Qa=2200,tr=900*1024,eo=8*1024*1024,er=3*1024*1024,nr=1200,sr=1600,Wn=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let d=e.getBoundingClientRect();if(d.width>=360&&d.height>=140)break;e=e.parentElement}let s=e?.getBoundingClientRect();if(!e||!s?.width||!s.height)return null;let o="";for(let a=e;a&&!o;a=a.parentElement){let d=getComputedStyle(a).backgroundColor;d&&d!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(d)&&(o=d)}if(!o){let[a,d,c]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*d+.114*c>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),d=Math.min(1,nr/s.width,sr/s.height),c=await Promise.race([a(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:o,filter:v=>!(v instanceof Element&&v.closest(ee))}),new Promise(v=>setTimeout(()=>v(null),8e3))]);return c&&c.length<eo?c:null}catch{return null}},no=new WeakMap,or=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Ut=(t,e=2800)=>{let s=document.createElement("div");s.className="dt-toast",s.textContent=t,document.body.append(s),setTimeout(()=>s.remove(),e)},zn=(t,e)=>Ut(navigator.onLine?`${t}${e?` (${e.status})`:""}.`:`${t} \u2014 you are offline. Try again once you are back online.`,6e3),ar=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),rr=async t=>{let e=await createImageBitmap(t),s=Math.min(1,Qa/Math.max(e.width,e.height));if(s===1&&t.size<=tr)return e.close(),ar(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},Vn=async(t,e)=>{let s=[];for(let o of t){let a,d=Object.keys(de).find(c=>de[c]===o.type||o.name.toLowerCase().endsWith(`.${c}`));if(d){if(o.size>er){Ut(`${o.name} is over 3 MB \u2014 send a link to it instead.`);continue}let c=await new Promise((v,T)=>{let P=new FileReader;P.onload=()=>v(String(P.result).split(",")[1]),P.onerror=T,P.readAsDataURL(o)}).catch(()=>"");c?s.push(`data:${de[d]};name=${To(o.name)||"document"};base64,${c}`):Ut(`${o.name} could not be read.`);continue}try{a=await rr(o)}catch{Ut("That image could not be read.");continue}if(a.length>eo){Ut("Screenshot is too large even after shrinking.");continue}s.push(a)}if(s.length){if(!Number(e?.dataset.id)){S&&((S.images??=[]).push(...s),V());return}xt.push(...s),V(),dn(".dt-note-reply-input")}},so=t=>[...t??[]].filter(e=>e.kind==="file"&&(e.type.startsWith("image/")||Object.values(de).includes(e.type))).map(e=>e.getAsFile()).filter(Boolean);Y.addEventListener("paste",t=>{let e=so(t.clipboardData?.items);e.length&&(t.preventDefault(),Vn(e,t.target.closest(".dt-note")))}),Y.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),Y.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),Y.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=so(t.dataTransfer?.items);s.length&&Vn(s,e)});let dn=t=>{let e=Y.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},oo=()=>{dn(".dt-note-edit-input"),Y.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Un=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden"},ir=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),lr=()=>n.client||nn()?[]:hn(),ao=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let s=ir(t);if(!s)return;let o=s[1].toLowerCase(),a=(n.team??[]).filter(c=>[c.name,c.nickname,c.email].some(v=>v?.toLowerCase().startsWith(o))).slice(0,5),d=lr().filter(c=>c.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!a.length&&!d.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...a.map(c=>`<button type="button" role="option" data-act="mention" data-handle="${y(Ao(c))}">${Ze(c.avatar_url,c.name||c.email)}<span class="dt-mention-who"><b>${y(c.name||c.email)}</b>${c.name?`<span>${y(c.email)}</span>`:""}</span></button>`),...d.map(c=>`<button type="button" role="option" data-act="mention" data-handle="${y(c.handle)}">${ma(c.owner)}<span class="dt-mention-who"><b>${y(c.handle)}</b><span>${c.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((c,v)=>c.replace('role="option"',`role="option" aria-selected="${v===0}"`)).join("")}</div>`)},ro=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...hn().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>y(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=y(t);return e.length?s.replace(new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"),o=>`<span class="dt-at">${o}</span>`):s},io=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},dr=(t,e)=>{if(!t){S&&(S.category=e),V();return}Vt(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>h({id:t,category:e}),"Changing the type")};Wo(Y,y,It);let cr=(t,e)=>{t?Vt(s=>s.map(o=>o.id===t?{...o,shared:e||void 0}:o),()=>h({id:t,shared:e}),e?"Sharing with the client":"Keeping it to the team"):S&&(S.shared=e||void 0,mt(),V())};Y.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let v=e.value,T=Number(e.dataset.id)||0;e.value="",v==="team"||v==="client"?cr(T,v==="client"):v==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(st=null,Bn(T)):v==="discard"&&(S=null,V());return}let s=t.target.closest(".dt-lang-select");if(s){Os(Number(s.dataset.id),s.dataset.at,s.value);return}let o=t.target.closest(".dt-cat-select");if(o){dr(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){ks(Number(a.dataset.id),a.value);return}let d=t.target.closest(".dt-for-select");if(!d)return;d.parentElement?.style.setProperty("--cat",Pe(d.value));let c=Number(d.dataset.id);if(c){let v=d.value||null;Vt(T=>T.map(P=>P.id===c?{...P,assignee:v??void 0}:P),()=>h({id:c,assignee:v}),"Reassigning");return}S&&(S.assignee=d.value,Q.setItem("nm-for",d.value),mt())}),Y.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&S?.suggest){S.suggest.to=e.value,mt(),Un(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");s&&(ao(s),s.classList.contains("dt-note-input")?S&&(S.text=s.value):s.classList.contains("dt-note-edit-input")?it&&(it.text=s.value):Tt=s.value,mt(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Un(s))}),Y.addEventListener("keydown",t=>{let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&ao(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),io(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())}),Y.addEventListener("click",async t=>{let e=t.target.closest("button");if(!e)return;let s=e.dataset.act,o=Number(e.dataset.id);if(s==="prio"){let a=e.dataset.v||null;o?Vt(d=>d.map(c=>c.id===o?{...c,priority:a??void 0}:c),()=>h({id:o,priority:a}),"Setting the priority"):S&&(S.priority=a??void 0,mt(),V());return}if(s==="mention"){let a=e.closest(".dt-compose")?.querySelector("textarea");a&&io(a,e.dataset.handle);return}if(!s){if(st=st===o?null:o,st!=null&&e.dataset.off){let a=G.find(c=>c.id===o);(a&&Zt(a))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}Dt(),V();return}if(s==="speak"){Ra(e.closest(".dt-note"),e);return}if(s==="voice-write"){Pa(e);return}if(s==="voice"||s==="voice-seek"){ka(e,s==="voice-seek"?t:null);return}if(s==="attach"){let a=Object.assign(document.createElement("input"),{type:"file",accept:`image/*,.pdf,.doc,.docx,${Object.values(de)}`,multiple:!0}),d=e.closest(".dt-note");a.addEventListener("change",()=>{a.files?.length&&Vn([...a.files],d)}),a.click();return}if(s==="unshot"){o?it&&it.drop.push(e.dataset.img):(e.closest("[data-draft]")?S?.images??[]:xt).splice(Number(e.dataset.i),1),V(),it&&oo();return}if(s==="edit"){let a=G.find(v=>v.id===o),d=e.dataset.at||null,c=d?a?.replies?.find(v=>v.at===d)?.text:a?.text;if(c===void 0)return;it={id:o,at:d,text:c,drop:[]},V(),oo();return}if(s==="edit-cancel"){it=null,V();return}if(s==="translate"){Os(o,e.dataset.at);return}if(s==="unsay"){let a=e.dataset.at;if(!confirm("Delete this reply?"))return;await Vt(d=>d.map(c=>c.id!==o?c:{...c,replies:(c.replies??[]).map(v=>v.at===a?{...v,text:"",deleted:!0}:v)}),()=>h({id:o,unsay:a}),"Deleting the reply");return}if(s==="edit-save"){let a=it;if(!a)return;let d=a.text.trim();if(!d){Y.querySelector(".dt-note-edit-input")?.focus();return}it=null;let c=v=>a.drop.includes(v.split("/").pop());await Vt(v=>v.map(T=>T.id!==a.id?T:{...T,...a.at==null?{text:d}:{replies:(T.replies??[]).map(P=>P.at===a.at?{...P,text:d}:P)},images:(T.images??[]).filter(P=>!c(P))}),()=>h({id:a.id,edit:{at:a.at,text:d},...a.drop.length?{removeImage:a.drop}:{}}).then(v=>(v.ok||(it=a),v),v=>{throw it=a,v}),"Saving the edit");return}if(s==="cancel"){Dt(),V();return}if(s==="twin"){Dt(),st=Number(e.dataset.id),V();return}if(s==="discard"){S=null,V();return}if(s==="draft-open"){Dn(Number(e.dataset.i));return}if(s==="close"){st=null,V();return}if(s==="unsuggest"&&S){S.suggest=null,V();return}if(s==="save"){if(!S)return;let a=S.suggest&&S.suggest.to.trim()!==S.suggest.from?{from:S.suggest.from,to:S.suggest.to.trim()}:null,d=Y.querySelector(".dt-note-input").value.trim()||(a?"Change the text":"")||(S.images?.some(kn)?Ds:S.images?.length?"See the attached image":"");if(!d){Y.querySelector(".dt-note-input")?.focus();return}let c=S,v=n.client?null:ts(d,Ee()),T=no.get(c)??Wn(Zt(c)),P={...c,route:k,text:d,suggest:a,assignee:n.client?Cs(c.assignee)||void 0:v??(c.assignee||void 0),shared:n.client?!0:c.shared===!0,stage:n.client?"new":v?"approved":c.stage??(wt(c.assignee)?"approved":"new"),breakpoint:yn(),browser:ta(),device:$?lo:"",viewport:{w:innerWidth,h:innerHeight},logs:qo(),host:location.host},u={...c,id:-Date.now(),text:d,route:k,status:"open",note:"",doneBy:null,breakpoint:P.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...a?{suggest:a}:{},by:n.me?.email,byName:n.me?.name};G=[...G,u],S=null,V();let X=await Hn(Rt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(P)})).catch(()=>null);if(!X?.ok){G=G.filter(nt=>nt!==u),Dt(),S=c,V(),zn("Comment was not saved",X);return}let F=rn([await X.json().catch(()=>null)])[0];G=G.map(nt=>nt===u&&F?F:nt),V(),F&&T.then(nt=>{nt&&h({id:F.id,before:nt})}),cn();return}if(s==="reply"){let a=Y.querySelector(".dt-note-reply-input"),d=a.value.trim()||(xt.some(kn)?Ds:xt.length?"See the attached image":"");if(!d){a.focus();return}let c=xt;Tt="",xt=[];let v=G,T=n.client?null:ts(d,Ee()),P=G.find(nt=>nt.id===o),u=T&&P&&(T!==P.assignee||Ot(P)!=="approved"||P.status==="done")?{assignee:T,stage:"approved",...P.status==="done"?{status:"open",doneBy:null}:{}}:{};G=G.map(nt=>nt.id===o?{...nt,...u,replies:[...nt.replies??[],{author:"you",text:d,at:new Date().toISOString(),by:n.me?.email}]}:nt),V();let X=await Hn(h({id:o,reply:d,images:c,...u})).catch(()=>null);if(!X?.ok){G=v,Tt=d,xt=c,V(),zn("Reply was not sent",X);return}let F=rn([await X.json().catch(()=>null)])[0];F&&(G=G.map(nt=>nt.id===F.id?F:nt),V()),cn();return}if(s==="hand"){ca(o,e.dataset.v);return}if(s==="sendback"){await ke(o,!1),dn(".dt-note-reply-input");return}if(s==="accept"){ks(o,"accepted");return}e.classList.contains("dt-step-act")||(st=null),s==="rm"?await Bn(o):await ke(o,s==="done")});let lo="",qt=t=>{Bt.hidden||ue.contentWindow?.postMessage({dt:!0,...t},location.origin)},ur=()=>({notes:lt,grid:!z.hidden,inspect:J,resolved:bt,...uo.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!$&&t.source===ue.contentWindow){if(e.key){fo(e.key[0],e.key[1])?.run();return}if(e.closeMenus){St();return}if(e.drafts){An=e.drafts,qe(me());return}}if($&&typeof e.openDraft=="number"){Dn(e.openDraft);return}if($&&typeof e.dropDraft=="number"){Vs(e.dropDraft);return}if($&&typeof e.device=="string"&&(lo=e.device),$&&e.scrollbar&&Mt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===ue.contentWindow){qt(ur());return}typeof e.notes=="boolean"&&e.notes!==lt&&ae(e.notes,!1),typeof e.open=="number"&&Pn(e.open),typeof e.grid=="boolean"&&e.grid===z.hidden&&q(e.grid),typeof e.inspect=="string"&&e.inspect!==J&&R(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==bt&&qn(e.resolved),e.reload&&Le()});let cn=async()=>{await Le(),qt({reload:!0}),$&&parent.postMessage({dt:!0,reload:!0},location.origin)},ae=(t,e=!0)=>{if(lt=t,K.setAttribute("aria-pressed",String(t)),t?!$&&j.hidden&&Q.getItem("dt-history")!=="0"&&(j.hidden=!1,N.setAttribute("aria-pressed","true")):(j.hidden=!0,N.setAttribute("aria-pressed","false")),A(xe,t?"1":"0"),qt({notes:t}),$&&e&&parent.postMessage({dt:!0,notes:t},location.origin),Y.hidden=!t||!Bt.hidden,Mt.toggle("dt-noting",t),t&&!document.querySelector(".dt-room")?document.body.append(Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"})):t||document.querySelector(".dt-room")?.remove(),t){R(""),document.addEventListener("click",to,!0);for(let s of Zs)document.addEventListener(s,Qs,!0);document.addEventListener("keydown",Js),document.addEventListener("mousemove",Xs),addEventListener("scroll",oe,!0),addEventListener("resize",oe),ls(),Gs.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),Ks.observe(document.body),jn()}else{Dt(),st=null,document.removeEventListener("click",to,!0);for(let s of Zs)document.removeEventListener(s,Qs,!0);document.removeEventListener("keydown",Js),document.removeEventListener("mousemove",Xs),gt.hidden=!0,removeEventListener("scroll",oe,!0),removeEventListener("resize",oe),Gs.disconnect(),Ks.disconnect(),Y.innerHTML=""}},{pickBp:co,...uo}=Uo({cfg:n,inFrame:$,persist:A,frame:Bt,frameEl:ue,devicesMenu:pt,bpBtns:D,notesOverlay:Y,WIDE:p,bpOf:x,currentBp:yn,deviceById:H,notesOn:()=>lt,filter:()=>w,filterTo:t=>{w=t},dropFrameDrafts:()=>{An=[]},putAway:()=>{st=null,Dt()},tellFrame:qt,syncBpButtons:is,render:()=>V(),reread:()=>{lt?jn():V()}}),po="dt-studio",mo=t=>{W.setAttribute("aria-pressed",String(t)),Mt.toggle("dt-no-studio",!t),A(po,t?"1":"0")};W.addEventListener("click",()=>mo(W.getAttribute("aria-pressed")!=="true")),mo(Q.getItem(po)!=="0"),K.addEventListener("click",()=>ae(!lt));let re=document.querySelector(".devtools"),je=document.querySelector(".dt-tab"),ho=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-re.getBoundingClientRect().top)+12}px`);new ResizeObserver(ho).observe(re),addEventListener("resize",ho);let go=t=>{re.toggleAttribute("data-collapsed",t),je.toggleAttribute("data-collapsed",t),je.setAttribute("aria-expanded",String(!t)),je.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of re.querySelectorAll(".dt-group"))e.inert=t;t&&St(),A("dt-collapsed",t?"1":"0")};je.addEventListener("click",()=>go(!re.hasAttribute("data-collapsed")));let Gn=document.querySelector(".dt-keys"),Gt=t=>()=>re.querySelector(t)?.click(),bo=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},un=[{group:"Comments",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:Gt(".dt-notes-btn")},{group:"Comments",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Comments panel",el:".dt-history-btn",run:Gt(".dt-history-btn")},{group:"Comments",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:Gt(".dt-resolved-btn")},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:Gt(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:Gt(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:Gt(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:Gt(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:Gt(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:Gt(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:Gt(".dt-studio-btn")}]:[],...D.slice(0,9).map((t,e)=>({group:"Breakpoints",code:`Digit${e+1}`,hint:String(e+1),label:t.dataset.tip??t.title,el:`.dt-bp[data-bp="${t.dataset.bp}"]`,run:()=>t.click()})),{group:"View",code:"KeyD",hint:"D",label:"Devices",run:()=>{pt.open=!pt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:bo(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:bo(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>je.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"This list",el:".dt-keys summary",run:()=>{Gn.open=!Gn.open}}].filter(t=>!n.client||t.group!=="Inspect"),fo=(t,e)=>un.find(s=>s.code===t&&!s.shift==!e),pr=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(n.shortcuts){for(let e of un){let s=e.el&&re.querySelector(e.el);s&&(s.dataset.tip=`${s.dataset.tip??e.label} \xB7 ${e.hint}`,s.setAttribute("aria-keyshortcuts",e.hint.startsWith("\u21E7")?`Shift+${e.hint.slice(1)}`:e.hint))}let t=(e,s)=>`<div class="dt-key-row"><span>${y(e)}</span><kbd>${y(s)}</kbd></div>`;if(Gn.querySelector(".dt-keys-menu").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(un.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+un.filter(s=>s.group===e).map(s=>t(s.label,s.hint)).join("")).join("")+'<p class="dt-devices-group">In a comment</p>'+t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"),document.addEventListener("keydown",e=>{if(e.repeat||e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||pr(e.target))return;let s=fo(e.code,e.shiftKey);s&&(e.preventDefault(),$?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):s.run())}),$){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",s=>{s.key==="Escape"&&e()})}}if(!$){go(Q.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>re.setAttribute("data-ready",""))),uo.restore(),q(Q.getItem(I)==="1");let t=Q.getItem(ot);t&&t in E&&R(t),ae(Q.getItem(xe)==="1")}let yo=()=>{try{let t=JSON.parse(Q.getItem(B)||"null");ft=(t?.parked??[]).filter(e=>ne(e)),t?.draft&&document.querySelector(t.draft.selector)?(S=t.draft,!lt&&!$&&ae(!0)):ne(t?.draft)&&ft.push(t.draft),t?.reply?.text&&(Tt=t.reply.text,se=st=t.reply.for??null),(S||ft.length||Tt)&&V()}catch{Q.removeItem(B)}};yo();let vo=()=>setTimeout(()=>{let t=m(location.pathname);t!==k&&(clearTimeout(tt),dt(),k=t,B=L(),S=null,ft=[],Tt="",se=null,st=null,it=null,G=[],et(),yo(),jn(),Le())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),vo()}}addEventListener("popstate",vo),r.then(async t=>{t.status===200&&Ys(await t.json())},()=>{}).then(()=>bt?Le(!0):void 0).then(On.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Fe()}),addEventListener("focus",Fe),addEventListener("notemend:changed",()=>{$||Fe()});let mr=0;$||setInterval(()=>{(!Xt.live||++mr%6===0)&&Fe()},2e4),$&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Zo(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,l=r.showModal,g=null,p=null,x=()=>{if(g){p?.disconnect(),p=null;for(let $ of n)document.body.append($);try{g.hidePopover()}catch{}g.remove(),g=null}},M=()=>{x();let $=document.querySelector("dialog:modal");$&&H($)},H=$=>{x(),g=document.createElement("div"),g.className="dt-host",g.setAttribute("popover","manual"),g.append(...n),$.append(g);try{g.showPopover()}catch{}$.addEventListener("close",M,{once:!0}),p=new MutationObserver(()=>{$.isConnected||M()}),p.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){l.call(this),this.isConnected&&H(this)}}function Qo(){let n=window;if(n.__notemend)return;n.__notemend=!0,Io(l=>l.includes("/__devbar/")||!!Xt.base&&l.startsWith(Xt.base)),Mt.ready=new Promise(l=>{if(!("__next_f"in self))return l();let g=0,p=()=>Object.keys(document.documentElement).some(x=>x.startsWith("__reactFiber$"))||++g>330?l():setTimeout(p,30);p()}),Mt.toggle("dt-in-frame",mn);let r=Rt("comments?open=1");So().then(l=>{Mt.set("--dt-z",String(l.zIndex));let g=l.brand?.color;if(g&&/^#[0-9a-f]{6}$/i.test(g)){let[p,x,M]=[1,3,5].map(H=>parseInt(g.slice(H,H+2),16)/255);Mt.set("--dt-accent",g),Mt.set("--dt-accent-ink",.2126*p+.7152*x+.0722*M>.55?"#000000":"#ffffff")}Ro(l),Jo(l,r),Zo([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab"].map(p=>document.querySelector(p)).filter(p=>!!p))}).catch(l=>console.warn("[notemend] not started:",l))}Qo();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|