notemend 0.1.25 → 0.1.27
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 +27 -9
- package/bin/notemend.mjs +18 -18
- package/bin/step.mjs +2 -0
- package/package.json +1 -1
- package/src/client/index.js +109 -96
- package/src/client/notemend.css +1 -1
- package/src/integration.mjs +1 -1
- package/src/next.mjs +7 -1
- package/src/server/middleware.mjs +7 -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 +15 -2
- package/thread.d.ts +8 -0
package/src/client/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};async function Lt(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<6e4&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!Ut.via)return fetch(`/__devbar/${n}`,r);let d=await Ut.via(n,r);if(d.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let g=await d.clone().json().catch(()=>null);g?.signed&&Object.assign(Ut.signed,g.signed)}return d}var ei=n=>Ut.via?Ut.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,as=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),nt={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 ni(){let n=await Lt("config");if(!n.ok)throw new Error(`config ${n.status}`);let r=await n.json();return r.breakpoints=r.breakpoints.map(d=>({...d,max:d.max??1/0})),r}var si=["iPhone","Android","Foldable","Tablet","Laptop & display"],En=[{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 hl=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null;var Mn={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},ro=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,ml=/^(png|jpe?g|webp|gif|webm)$/i,gl=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],oi=n=>{let r=String(n??"").split(".").pop().toLowerCase(),d=gl.find(([,,g])=>g.split(" ").includes(r));return d?{label:d[0],color:d[1]}:{label:"FILE",color:"#717171"}},lo=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),bl=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]])),ai=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>bl[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),ii=n=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return r&&!ro.test(r[1])?r[1].toLowerCase():""},kn=n=>{let r=String(n??"");if(r.startsWith("data:")){let h=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!h)return null;let x=/;ext=([a-z0-9]{1,8})/i.exec(h[2])?.[1]?.toLowerCase()??Object.keys(Mn).find(S=>Mn[S]===h[1]);return x?`${/;name=([\w-]+)/.exec(h[2])?.[1]||"document"}.${x}`:null}let d=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(d))return null;let g=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(d);return g&&!ml.test(g[2])?`${g[1]||"document"}.${g[2].toLowerCase()}`:null},qe=n=>{let r=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(d=>({...d,images:[]}))];for(let d of n.images||[]){if(hl(d))continue;let g=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(d)?.[1]),h=0;r.forEach((x,S)=>{Date.parse(x.at)<=g&&(h=S)}),r[h].images.push(d)}return r.filter(d=>!d.deleted)},ri=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],li=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var fl=20,di=(n,r,d)=>{let g={...n||{}},h=g[r]||[];if(!h.length&&Object.keys(g).length>=fl)return null;let x=h.includes(d)?h.filter(S=>S!==d):[...h,d];return x.length?g[r]=x:delete g[r],Object.keys(g).length?g:void 0},ci=n=>n.nickname||n.name||n.email,yl=(n,r)=>{let d="@"+r.toLowerCase(),g=-1;for(let h=n.indexOf(d);h!==-1;h=n.indexOf(d,h+1))/[\p{L}\p{N}_.-]/u.test(n[h+d.length]??"")||(g=h);return g};var vl={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},on=n=>vl[n]||(n?"AI agent":"Claude"),is="3.6 3.6 10.8 10.8",rs="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",co=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,St=n=>n==="claude"||co(n)!=null;var wl=["new","approved","progress","review","waiting"],Gt=n=>wl.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":St(n?.assignee)?"approved":"new",$t=n=>n?.client===!0||n?.shared===!0;var ls=()=>[{assignee:"claude",handle:"Claude",owner:null}],uo=(n,r=[])=>{let d=String(n||"").toLowerCase(),g=null,h=-1;for(let x of ls()){let S=yl(d,x.handle);S>h&&(h=S,g=x.assignee)}return g};var $l=2*36e5,Fe=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<$l?n.working:null,xl=n=>/@guest\.notemend\.com$/i.test(String(n||"")),po=n=>xl(n.by)&&!n.approvedBy,le=(n,r=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":St(n.assignee)?"done":null;if(po(n))return"held";if(!St(n.assignee))return null;let d=qe(n),g=d[d.length-1];return d.length>1&&g.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(g.at))?"asks":Fe(n,r)?"working":n.working?"stuck":Gt(n)==="approved"?"queued":null};var ui=rs.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[d,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(d-9,9-g)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var pi=(n,r)=>{if(n.archivedAt)return!0;if(!r||n.status!=="done"||n.doneBy==="claude")return!1;let d=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(g=>!g.deleted).map(g=>Date.parse(g.at||"")||0));return!!d&&Date.now()-d>r*864e5};var p=n=>n.replace(/[&<>"]/g,r=>({"&":"&","<":"<",">":">",'"':"""})[r]),Ln=n=>n?new Date(n).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",je='<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>',jt='<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>',Sn='<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>',Te='<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>',hi='<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>',mi='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Ae='<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>',ee=n=>`<svg viewBox="${is}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${rs}" stroke-width="1.15" stroke-linecap="round"/></svg>`,ho=(n,r)=>`<svg viewBox="${is}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${ui.map((d,g)=>`<path d="${d}" stroke-width="1.15" stroke-linecap="round"${g<r?"":' class="is-off"'}/>`).join("")}</svg>`,yt=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`;function gi(n){let r=location.pathname.replace(/\/$/,"")||"/",d=n.client?' style="display:none"':"",g=n.breakpoints.map(y=>["new","progress","review","waiting","done"].map(N=>`<b data-bp="${p(y.id)}" data-state="${N}" hidden>${yt(y.icon,11)}<i></i></b>`).join("")).join(""),h=n.groups.map(y=>`<li class="dt-pages-group">${p(y)}</li>`+n.pages.filter(N=>N.group===y).map(N=>`<li><a href="${/^\/(?![\/\\])/.test(N.route)?p(N.route):"#"}"${N.route===r?' aria-current="page"':""}><span class="dt-menu-label">${p(N.label)}</span><em class="dt-pages-n" hidden>${g}</em></a></li>`).join("")).join(""),x=[...new Set(n.devices.map(y=>y.group))].map(y=>`<p class="dt-devices-group">${p(y)}</p>`+n.devices.filter(N=>N.group===y).map(N=>`<button type="button" data-device="${p(N.id)}" aria-pressed="false"${N.note?` title="${p(N.note)}"`:""}><span class="dt-menu-label">${p(N.label)}</span><em>${N.w}×${N.h}</em></button>`).join("")).join(""),S=si.map(y=>`<p class="dt-devices-group">${p(y)}</p>`+En.filter(N=>N.group===y).map(N=>`<button type="button" data-emu="${p(N.id)}" aria-pressed="false"><span class="dt-menu-label">${p(N.label)}</span><em>${N.w}×${N.h}</em></button>`).join("")).join(""),B=n.breakpoints.map(y=>`<button class="dt-icon dt-bp" type="button" data-bp="${p(y.id)}" aria-pressed="false" title="${p(y.label)}">${yt(y.icon,16)}</button>`).join(""),v=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),L="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
1
|
+
import"./notemend.css";var Dt={base:"",via:null,signed:{},live:!1,signOut:null};async function Ct(n,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<8e3&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Dt.via){let u=window.__notemendEarly,p=!i.method||i.method==="GET"?u?.[n]:void 0;if(p){delete u[n];let v=await p;if(v)return v}return fetch(`/__devbar/${n}`,i)}let l=await Dt.via(n,i);if(l.ok&&n.startsWith("comments")&&(i.method??"GET")==="GET"){let u=await l.clone().json().catch(()=>null);u?.signed&&Object.assign(Dt.signed,u.signed)}return l}var Gi=n=>Dt.via?Dt.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Ns=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),st={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,i)=>{try{localStorage.setItem(n,i)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}};async function Yi(){let n=await Ct("config");if(!n.ok)throw new Error(`config ${n.status}`);let i=await n.json();return i.breakpoints=i.breakpoints.map(l=>({...l,max:l.max??1/0})),i}var Xi=["iPhone","Android","Foldable","Tablet","Laptop & display"],_n=[{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 md=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null;var Wn={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},_o=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,gd=/^(png|jpe?g|webp|gif|webm)$/i,fd=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],Zi=n=>{let i=String(n??"").split(".").pop().toLowerCase(),l=fd.find(([,,u])=>u.split(" ").includes(i));return l?{label:l[0],color:l[1]}:{label:"FILE",color:"#717171"}},Wo=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),bd=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,i)=>[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",""][i]])),Qi=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>bd[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),tr=n=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return i&&!_o.test(i[1])?i[1].toLowerCase():""},zn=n=>{let i=String(n??"");if(i.startsWith("data:")){let p=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!p)return null;let v=/;ext=([a-z0-9]{1,8})/i.exec(p[2])?.[1]?.toLowerCase()??Object.keys(Wn).find(k=>Wn[k]===p[1]);return v?`${/;name=([\w-]+)/.exec(p[2])?.[1]||"document"}.${v}`:null}let l=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(l))return null;let u=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(l);return u&&!gd.test(u[2])?`${u[1]||"document"}.${u[2].toLowerCase()}`:null},Se=n=>{let i=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(l=>({...l,images:[]}))];for(let l of n.images||[]){if(md(l))continue;let u=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(l)?.[1]),p=0;i.forEach((v,k)=>{Date.parse(v.at)<=u&&(p=k)}),i[p].images.push(l)}return i.filter(l=>!l.deleted)},er=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],nr=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var yd=20,sr=(n,i,l)=>{let u={...n||{}},p=u[i]||[];if(!p.length&&Object.keys(u).length>=yd)return null;let v=p.includes(l)?p.filter(k=>k!==l):[...p,l];return v.length?u[i]=v:delete u[i],Object.keys(u).length?u:void 0},or=n=>n.nickname||n.name||n.email,vd=(n,i)=>{let l="@"+i.toLowerCase(),u=-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]??"")||(u=p);return u};var wd=/https?:\/\/[^\s<>"']+/g,Ji=n=>{let i=n.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},$d=n=>{let i;try{i=new URL(n)}catch{return{label:String(n),kind:"link"}}let l=i.hostname.replace(/^www\./,""),u=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(l))return{label:u[2]?`Figma \xB7 ${Ji([u[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(l==="github.com"&&u.length){let[v,k,H,f]=u;return{label:`GitHub \xB7 ${k??v}${/^(pull|issues)$/.test(H??"")&&f?` #${f}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(l))return{label:"Loom",kind:"link"};let p=Ji(u);return{label:p?`${l} \xB7 ${p.length>32?p.slice(0,31)+"\u2026":p}`:l,kind:"link"}},zo=n=>{let i=String(n??""),l=[],u=0;for(let p of i.matchAll(wd)){let v=p[0].replace(/[.,;:!?)\]]+$/,"");p.index>u&&l.push(i.slice(u,p.index)),l.push({url:v,...$d(v)}),u=p.index+v.length}return u<i.length&&l.push(i.slice(u)),l},ar=n=>zo(n).map(i=>typeof i=="string"?i:i.label).join(""),xd={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},vn=n=>xd[n]||(n?"AI agent":"Claude"),Bs="3.6 3.6 10.8 10.8",Rs="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",Ps=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,At=n=>n==="claude"||Ps(n)!=null;var Ed=["new","approved","progress","review","waiting"],Jt=n=>Ed.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":At(n?.assignee)?"approved":"new",Mt=n=>n?.client===!0||n?.shared===!0;var Os=()=>[{assignee:"claude",handle:"Claude",owner:null}],Vo=(n,i=[])=>{let l=String(n||"").toLowerCase(),u=null,p=-1;for(let v of Os()){let k=vd(l,v.handle);k>p&&(p=k,u=v.assignee)}return u};var Md=2*36e5,Re=(n,i=Date.now())=>n?.working&&n.status!=="done"&&i-Date.parse(n.working.at)<Md?n.working:null,Is=(n,i,l=Date.now())=>{let u=String(n?.by||n?.byName||"").toLowerCase();if(!u||i==="done")return null;let p=i==="claude"||At(n.assignee),v=Ds(n)?"":p?Re(n,l)?.by||n.doneFor||n.handedBy||Ps(n.assignee)||u:n.assignee||"";return{writer:u,taker:String(v).toLowerCase(),claude:p}},kd=n=>/@guest\.notemend\.com$/i.test(String(n||"")),Ds=n=>kd(n.by)&&!n.approvedBy,se=(n,i=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":At(n.assignee)?"done":null;if(Ds(n))return"held";if(!At(n.assignee))return null;let l=Se(n),u=l[l.length-1];return l.length>1&&u.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(u.at))?"asks":Re(n,i)?"working":n.working?"stuck":Jt(n)==="approved"?"queued":null};var ir=Rs.split("M").filter(Boolean).map(n=>{let i=n.match(/[\d.]+/g).map(Number),[l,u]=/H/.test(n)?[i[2],i[1]]:/V/.test(n)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+n,a:(Math.atan2(l-9,9-u)+2*Math.PI)%(2*Math.PI)}}).sort((n,i)=>n.a-i.a).map(n=>n.d);var rr=(n,i)=>{if(n.archivedAt)return!0;if(!i||n.status!=="done"||n.doneBy==="claude")return!1;let l=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(u=>!u.deleted).map(u=>Date.parse(u.at||"")||0));return!!l&&Date.now()-l>i*864e5};var g=n=>n.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),Je=n=>n?new Date(n).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Ze='<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>',qt='<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>',Vn='<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>',Pe='<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>',lr='<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>',dr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Te='<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>',Wt=n=>`<svg viewBox="${Bs}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${Rs}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Ko=(n,i)=>`<svg viewBox="${Bs}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${ir.map((l,u)=>`<path d="${l}" stroke-width="1.15" stroke-linecap="round"${u<i?"":' class="is-off"'}/>`).join("")}</svg>`,yt=(n,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${n}</svg>`;function cr(n){let i=location.pathname.replace(/\/$/,"")||"/",l=n.client?' style="display:none"':"",u=n.breakpoints.map(y=>["new","progress","review","waiting","done"].map(R=>`<b data-bp="${g(y.id)}" data-state="${R}" hidden>${yt(y.icon,11)}<i></i></b>`).join("")).join(""),p=n.groups.map(y=>`<li class="dt-pages-group">${g(y)}</li>`+n.pages.filter(R=>R.group===y).map(R=>`<li><a href="${/^\/(?![\/\\])/.test(R.route)?g(R.route):"#"}"${R.route===i?' aria-current="page"':""}><span class="dt-menu-label">${g(R.label)}</span><em class="dt-pages-n" hidden>${u}</em></a></li>`).join("")).join(""),v=[...new Set(n.devices.map(y=>y.group))].map(y=>`<p class="dt-devices-group">${g(y)}</p>`+n.devices.filter(R=>R.group===y).map(R=>`<button type="button" data-device="${g(R.id)}" aria-pressed="false"${R.note?` title="${g(R.note)}"`:""}><span class="dt-menu-label">${g(R.label)}</span><em>${R.w}×${R.h}</em></button>`).join("")).join(""),k=Xi.map(y=>`<p class="dt-devices-group">${g(y)}</p>`+_n.filter(R=>R.group===y).map(R=>`<button type="button" data-emu="${g(R.id)}" aria-pressed="false"><span class="dt-menu-label">${g(R.label)}</span><em>${R.w}×${R.h}</em></button>`).join("")).join(""),H=n.breakpoints.map(y=>`<button class="dt-icon dt-bp" type="button" data-bp="${g(y.id)}" aria-pressed="false" title="${g(y.label)}">${yt(y.icon,16)}</button>`).join(""),f=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),$="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
2
|
<!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
|
|
3
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="${
|
|
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="${g(n.brand.logo)}" alt="" />`:""}
|
|
5
5
|
<div class="dt-group dt-group--menus">
|
|
6
6
|
<details class="dt-pages" name="dt-menu">
|
|
7
7
|
<summary aria-label="Pages" title="Pages">
|
|
8
8
|
${yt('<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">${
|
|
9
|
+
<span class="dt-pages-name">${g(i)}</span>
|
|
10
10
|
</summary>
|
|
11
|
-
<ul>${
|
|
11
|
+
<ul>${p}</ul>
|
|
12
12
|
</details>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div class="dt-group" role="group" aria-label="Inspect"${
|
|
15
|
+
<div class="dt-group" role="group" aria-label="Inspect"${l}>
|
|
16
16
|
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
17
17
|
${yt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
18
18
|
</button>
|
|
@@ -50,7 +50,7 @@ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
50
50
|
</button>
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
|
-
<div class="dt-group dt-bps" role="group" aria-label="Screen size">${
|
|
53
|
+
<div class="dt-group dt-bps" role="group" aria-label="Screen size">${H}</div>
|
|
54
54
|
|
|
55
55
|
<div class="dt-group dt-group--menus">
|
|
56
56
|
<details class="dt-devices" name="dt-menu">
|
|
@@ -65,12 +65,12 @@ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
65
65
|
</div>
|
|
66
66
|
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
67
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
|
-
${
|
|
68
|
+
${v}
|
|
69
69
|
</div>
|
|
70
70
|
<div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
|
|
71
71
|
<p class="dt-menu-note">Opens the canvas at the device's size. Comments go to its breakpoint.</p>
|
|
72
72
|
<input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
|
|
73
|
-
${
|
|
73
|
+
${k}
|
|
74
74
|
</div>
|
|
75
75
|
</div>
|
|
76
76
|
</details>
|
|
@@ -82,7 +82,7 @@ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
82
82
|
</summary>
|
|
83
83
|
<div class="dt-keys-menu">
|
|
84
84
|
<div class="dt-set-main">
|
|
85
|
-
${n.me?.email?`<p class="dt-set-who">Signed in as<b>${
|
|
85
|
+
${n.me?.email?`<p class="dt-set-who">Signed in as<b>${g(n.me.email)}</b></p><hr>`:""}
|
|
86
86
|
<button type="button" data-set="keys"${n.shortcuts?"":" hidden"}>${yt('<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" />',14)}<span>Keyboard shortcuts</span><kbd>?</kbd></button>
|
|
87
87
|
<button type="button" data-set="hide">${yt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${n.shortcuts?"<kbd>\\</kbd>":""}</button>
|
|
88
88
|
<hr data-set-out hidden>
|
|
@@ -96,16 +96,25 @@ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
96
96
|
</div>
|
|
97
97
|
</details>
|
|
98
98
|
</div>
|
|
99
|
-
<!-- the two spaces: the studio's threads and its clients' \u2014 a pill of its own left of the bar
|
|
100
|
-
|
|
99
|
+
<!-- the two spaces: the studio's threads and its clients' \u2014 a pill of its own left of the bar
|
|
100
|
+
(Figma: Bar components \u203A Space switch), the card's handoff way: both marks inside, a knob
|
|
101
|
+
sliding under the one in use, each with its open count as a badge (M switches). The studio's only. -->
|
|
101
102
|
<span class="dt-space" role="radiogroup" aria-label="Whose threads" hidden>
|
|
103
|
+
<i class="dt-space-knob" aria-hidden="true"></i>
|
|
102
104
|
<button type="button" class="dt-space-btn" data-space="studio" role="radio" aria-checked="true" data-tip="Studio \xB7 M">${yt('<rect x="3.5" y="4.5" width="13" height="11" rx="2" /><path d="M3.5 8h13" />',15)}<b class="dt-space-n" hidden>0</b></button>
|
|
103
105
|
<button type="button" class="dt-space-btn" data-space="clients" role="radio" aria-checked="false" data-tip="Clients \xB7 M">${yt('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',15)}<b class="dt-space-n" hidden>0</b></button>
|
|
104
106
|
</span>
|
|
107
|
+
<!-- pin filters: a ring after the spaces pill (Figma: Bar components \u203A Pin filter, Pin filter menu) \u2014 its
|
|
108
|
+
rim a chart of whose this page's pins are, the count in the middle; its menu filters them and the
|
|
109
|
+
rest dim (F). The studio's only, as the pill is. -->
|
|
110
|
+
<span class="dt-pinf" hidden>
|
|
111
|
+
<button type="button" class="dt-pinf-btn" aria-haspopup="menu" aria-expanded="false" data-tip="Show pins \xB7 F"><svg viewBox="0 0 40 40" aria-hidden="true"><circle class="dt-pinf-track" cx="20" cy="20" r="11.75"/><g class="dt-pinf-arcs" transform="rotate(-90 20 20)"></g></svg><b class="dt-pinf-n">0</b></button>
|
|
112
|
+
<div class="dt-pinf-menu" role="menu" aria-label="Show pins" hidden></div>
|
|
113
|
+
</span>
|
|
105
114
|
<!-- push to Claude: one round button \u2014 a press sends what waits for Claude; a right click or a
|
|
106
115
|
long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
|
|
107
116
|
<span class="dt-push" hidden${n.client?' style="display:none"':""}>
|
|
108
|
-
<button class="dt-push-all" type="button" aria-label="Push to Claude"><svg viewBox="${
|
|
117
|
+
<button class="dt-push-all" type="button" aria-label="Push to Claude"><svg viewBox="${Bs}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Rs}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
|
|
109
118
|
>
|
|
110
119
|
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to Claude"></div>
|
|
111
120
|
</span>
|
|
@@ -124,14 +133,14 @@ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
124
133
|
|
|
125
134
|
<div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
|
|
126
135
|
<div class="dt-stage">
|
|
127
|
-
<span class="dt-frame-handle" data-edge="l" title="${
|
|
136
|
+
<span class="dt-frame-handle" data-edge="l" title="${$}"></span>
|
|
128
137
|
<div class="dt-device">
|
|
129
138
|
<div class="dt-shell"></div>
|
|
130
139
|
<iframe title="Breakpoint preview"></iframe>
|
|
131
140
|
<div class="dt-chrome" data-at="top"></div>
|
|
132
141
|
<div class="dt-chrome" data-at="bottom"></div>
|
|
133
142
|
</div>
|
|
134
|
-
<span class="dt-frame-handle" data-edge="r" title="${
|
|
143
|
+
<span class="dt-frame-handle" data-edge="r" title="${$}"></span>
|
|
135
144
|
</div>
|
|
136
145
|
<div class="dt-ruler"></div>
|
|
137
146
|
<span class="dt-frame-size"></span>
|
|
@@ -146,132 +155,136 @@ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
146
155
|
<aside class="dt-history" hidden aria-label="Comment history"></aside>
|
|
147
156
|
<div class="dt-notes-hi" hidden aria-hidden="true"><span class="dt-hi-box"></span><span class="dt-hi-tag"></span></div>
|
|
148
157
|
<div class="dt-notes-overlay" hidden role="region" aria-label="Comments on this page"></div>
|
|
158
|
+
<!-- the clients' space: a frame round the page and its name in a notch at the top, with \xD7 back to the studio's -->
|
|
159
|
+
<div class="dt-client-frame" aria-hidden="true"></div>
|
|
160
|
+
<div class="dt-client-tab">${yt('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',13)}<span>Clients space</span><button type="button" class="dt-client-x" aria-label="Back to the studio's space" data-tip="Back to the studio\u2019s space \xB7 M">${yt('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
|
|
149
161
|
<div class="dt-grid-overlay" hidden aria-hidden="true">
|
|
150
|
-
<div class="${
|
|
151
|
-
<div class="${
|
|
162
|
+
<div class="${g(n.grid.container)} dt-overlay-container">
|
|
163
|
+
<div class="${g(n.grid.grid)} dt-overlay-grid">${f}</div>
|
|
152
164
|
</div>
|
|
153
165
|
</div>
|
|
154
166
|
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
155
|
-
`)}var bi=[{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"/>'}],an=(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>`,_e=n=>bi.find(r=>r.id===n)||bi[0];var mt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",fi={open:"Open",done:"Resolved",claude:"To check"};var Ot={ready:Promise.resolve(),toggle:(n,r)=>{Ot.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{Ot.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var El=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,yi=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(El,"$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 ds=[],mo=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)}},We=(n,r)=>{ds.push({at:new Date().toISOString(),kind:n,text:yi(r.replace(/\s+/g," ").trim()).slice(0,500)}),ds.length>50&&ds.shift()},vi=!1;function wi(n){if(vi||typeof window>"u")return;vi=!0;let r=console.error;console.error=(...h)=>{We("console",h.map(mo).join(" ")),r.apply(console,h)},addEventListener("error",h=>{if(h instanceof ErrorEvent)return We("error",`${h.message}${h.filename?` (${h.filename}:${h.lineno})`:""}`);let x=h.target,S=x?.src||x?.href;S&&!n(S)&&We("network",`${x.tagName?.toLowerCase()} ${S} did not load`)},!0),addEventListener("unhandledrejection",h=>We("rejection",mo(h.reason)));let d=window.fetch;window.fetch=async(h,x)=>{let S=typeof h=="string"?h:h instanceof URL?h.href:h.url,B=(x?.method||(h instanceof Request?h.method:"GET")).toUpperCase();try{let v=await d.call(window,h,x);return v.status>=400&&!n(S)&&We("network",`${B} ${S} \u2192 ${v.status}`),v}catch(v){throw!n(S)&&v?.name!=="AbortError"&&We("network",`${B} ${S} \u2192 no answer (${mo(v)})`),v}};let g=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(h,x,...S){return this._nm=`${h.toUpperCase()} ${String(x)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(x))||We("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),g.call(this,h,x,...S)}}var $i=(n=Date.now())=>ds.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function xi(n){let r=w=>{let c=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,$=w/c;return Math.round($*10)%10===0?String(Math.round($)):$.toFixed(1)},d=(w,c,$,H,R,D="p")=>{if($<=0||H<=0)return"";let W=R!==""?`<span class="dt-pad-chip dt-pad-chip--${D}" style="left:${w+$/2}px;top:${c+H/2}px">${R}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${D}" style="left:${w}px;top:${c}px;width:${$}px;height:${H}px"></span>${W}`},g=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],h="button, a, input, select, textarea, label, [role='button']",x=w=>{let c=w;for(let $=0;c&&$<6;$++,c=c.parentElement){if(c.matches(h))return c;let H=getComputedStyle(c);if(g.some(R=>parseFloat(H[R])>=2))return c}return w},S=(w,c)=>{let $=parseFloat(c.columnGap)||0,H=parseFloat(c.rowGap)||0;if(!(c.display.includes("flex")||c.display.includes("grid"))||!$&&!H)return"";let R=[...w.children].map(W=>W.getBoundingClientRect()).filter(W=>W.width||W.height),D="";for(let W=1;W<R.length;W++){let U=R[W-1],I=R[W];if($&&I.left>=U.right-1){let Z=Math.max(U.top,I.top);D+=d(U.right,Z,I.left-U.right,Math.min(U.bottom,I.bottom)-Z,r($),"g")}else if(H&&I.top>=U.bottom-1){let Z=Math.min(U.left,I.left);D+=d(Z,U.bottom,Math.max(U.right,I.right)-Z,I.top-U.bottom,r(H),"g")}}return D},B=w=>`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px"></span>`,v=(w,c,$="")=>`<span class="dt-pad-tag" style="left:${c.left}px;top:${Math.max(2,c.top-22)}px">${w.tagName.toLowerCase()+(w.classList[0]?"."+w.classList[0]:"")}${$}</span>`,L=w=>{let c=w.getBoundingClientRect(),$=getComputedStyle(w),H=parseFloat($.paddingTop),R=parseFloat($.paddingRight),D=parseFloat($.paddingBottom),W=parseFloat($.paddingLeft),U=B(c);U+=d(c.left,c.top,c.width,H,H>=2?r(H):""),U+=d(c.left,c.bottom-D,c.width,D,D>=2?r(D):""),U+=d(c.left,c.top+H,W,c.height-H-D,W>=2?r(W):""),U+=d(c.right-R,c.top+H,R,c.height-H-D,R>=2?r(R):"");let I=parseFloat($.marginTop),Z=parseFloat($.marginRight),kt=parseFloat($.marginBottom),pt=parseFloat($.marginLeft);U+=d(c.left,c.top-I,c.width,I,I>=2?r(I):"","m"),U+=d(c.left,c.bottom,c.width,kt,kt>=2?r(kt):"","m"),U+=d(c.left-pt,c.top,pt,c.height,pt>=2?r(pt):"","m"),U+=d(c.right,c.top,Z,c.height,Z>=2?r(Z):"","m"),U+=S(w,$);let qt=parseFloat($.columnGap)||0,se=parseFloat($.rowGap)||0,Yt=($.display.includes("flex")||$.display.includes("grid"))&&(qt||se)?` \xB7 gap ${r(qt)}${se&&se!==qt?"/"+r(se):""}`:"",wt="",Ce=w.parentElement;if(w.matches(h)&&Ce){let Rt=getComputedStyle(Ce);U+=S(Ce,Rt);let be=parseFloat(Rt.columnGap)||parseFloat(Rt.rowGap)||0;wt=` \xB7 ${r(c.width)}\xD7${r(c.height)}${be&&(Rt.display.includes("flex")||Rt.display.includes("grid"))?` \xB7 gap ${r(be)} in its row`:""}`}n.innerHTML=U+v(w,c,Yt+wt)},y=w=>{let c=w.getBoundingClientRect();n.innerHTML=B(c)+`<span class="dt-pad-chip" style="left:${c.left+c.width/2}px;top:${c.top+c.height/2}px">${r(c.width)} \xD7 ${r(c.height)}</span>`+v(w,c)},N=w=>{let c=(w.match(/[\d.]+/g)||[]).map(Number);if(c.length<3)return w;let $="#"+c.slice(0,3).map(H=>Math.round(H).toString(16).padStart(2,"0")).join("");return c[3]!==void 0&&c[3]<1?`${$} \xB7 ${Math.round(c[3]*100)}%`:$},k=null,f=()=>{if(k)return k;let w=getComputedStyle(document.documentElement),c=document.createElement("span");c.style.display="none",document.body.append(c);let $=[];for(let H of Array.from(w)){if(!H.startsWith("--"))continue;let R=w.getPropertyValue(H).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(R))continue;c.style.color="rgb(1, 2, 3)",c.style.color=R;let D=getComputedStyle(c).color;D&&D!=="rgb(1, 2, 3)"&&$.push([D,H])}return c.remove(),$.sort((H,R)=>H[1].length-R[1].length),k=$,$},T=w=>f().find(([c])=>c===w)?.[1]??"",F=null,et=()=>{if(F)return F;let w=[],c=$=>{for(let H of Array.from($))H instanceof CSSStyleRule?H.style.cssText.includes("var(--")&&w.push({sel:H.selectorText,style:H.style}):H instanceof CSSMediaRule?matchMedia(H.conditionText).matches&&c(H.cssRules):"cssRules"in H&&c(H.cssRules)};for(let $ of Array.from(document.styleSheets))try{c($.cssRules)}catch{}return F=w},V={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(w=>[`border-${w}-color`,[`border-${w}-color`,"border-color",`border-${w}`,"border"]]))},gt=(w,c)=>{let $=V[c]??[c],H=c==="color";for(let R=w;R;R=H?R.parentElement:null){let D=I=>$.map(Z=>/var\(\s*(--[\w-]+)/.exec(I.getPropertyValue(Z))?.[1]).find(Boolean),W=R instanceof HTMLElement?D(R.style):void 0;if(W)return W;let U="";for(let I of et()){let Z=!1;try{Z=R.matches(I.sel)}catch{}Z&&(U=D(I.style)||U)}if(U)return U;if(H&&R.parentElement&&getComputedStyle(R).color!==getComputedStyle(R.parentElement).color)break}return""},j=(w,c,$)=>{let H=gt(w,c);if(H)return`<b class="dt-var">${H}</b> <em>${N($)}</em>`;let R=T($);return R?`<span title="Same value as ${R}; not written with it">\u2248 ${R}</span> <em>${N($)}</em>`:N($)},tt=w=>`<i class="dt-type-sw" style="background:${w}"></i>`,ut={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},bt=w=>(w.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),st=(w,c)=>w.slice(0,3).map(($,H)=>$*w[3]+c[H]*(1-w[3])).concat([1]),ne=w=>{let c=[];for(let $=w;$;$=$.parentElement){let H=getComputedStyle($);if(H.backgroundImage!=="none")return null;let R=bt(H.backgroundColor);if(R[3]>0&&(c.push(R),R[3]>=1))break}return c.reduceRight(($,H)=>st(H,$),[255,255,255,1])},Tt=w=>{let[c,$,H]=w.slice(0,3).map(R=>(R/=255,R<=.03928?R/12.92:((R+.055)/1.055)**2.4));return .2126*c+.7152*$+.0722*H},Mt=(w,c,$)=>{let H=ne(w);if(!H)return["Contrast","<em>on an image</em>"];let R=st(bt(c.color),H),[D,W]=[Tt(R),Tt(H)].sort((kt,pt)=>pt-kt),U=(D+.05)/(W+.05),I=$>=24||$>=18.66&&Number(c.fontWeight)>=700,Z=U>=(I?4.5:7)?"AAA":U>=(I?3:4.5)?"AA":"fails AA";return["Contrast",`${U.toFixed(2)}:1 <em class="${Z==="fails AA"?"dt-type-bad":""}">${Z}${I?" \xB7 large":""}</em>`]},_t=w=>{let c=w.getBoundingClientRect(),$=getComputedStyle(w),H=parseFloat($.fontSize),R=$.lineHeight==="normal"?0:parseFloat($.lineHeight),D=parseFloat($.letterSpacing)||0,W=pt=>`${(pt*100).toFixed(1).replace(/\.0$/,"")}%`,U=[["Font",$.fontFamily.split(",")[0].replace(/["']/g,"")+($.fontStyle!=="normal"?` ${$.fontStyle}`:"")],["Weight",`${ut[$.fontWeight]??""} <em>${$.fontWeight}</em>`],["Size",`${r(H)}px`],["Line",R?`${W(R/H)} <em>${r(R)}px</em>`:"normal"],["Letter",D?`${W(D/H)} <em>${D.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",tt($.color)+j(w,"color",$.color)],Mt(w,$,H)],Z=c.bottom+150<innerHeight?c.bottom+8:Math.max(8,c.top-158),kt=Math.min(Math.max(8,c.left),innerWidth-210);n.innerHTML=B(c)+v(w,c)+`<div class="dt-type-card" style="left:${kt}px;top:${Z}px">${U.map(([pt,qt])=>`<span class="dt-type-row"><b>${pt}</b><span>${qt}</span></span>`).join("")}</div>`},E=w=>w.every(c=>c===w[0])?w[0]:w[1]===w[3]&&w[0]===w[2]?`${w[0]} ${w[1]}`:w.join(" "),it=w=>/^rgba\(.*,\s*0\)$|^transparent$/.test(w),ft=(w,c,$,H="")=>{let R=16+$.length*18,W=c.bottom+R+12<innerHeight?c.bottom+8:Math.max(8,c.top-R-8),U=Math.min(Math.max(8,c.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${c.left}px;top:${c.top}px;width:${c.width}px;height:${c.height}px${H?`;border-radius:${H}`:""}"></span>`+v(w,c)+`<div class="dt-type-card dt-style-card" style="left:${U}px;top:${W}px">${$.map(([I,Z])=>`<span class="dt-type-row"><b>${I}</b><span>${Z}</span></span>`).join("")}</div>`};return{spacer:x,drawPads:L,drawSize:y,drawType:_t,drawColor:w=>{let c=getComputedStyle(w),$=[];c.backgroundImage!=="none"&&$.push(["Fill",`<em>${/gradient/.test(c.backgroundImage)?"gradient":"image"}</em>`]),it(c.backgroundColor)||$.push(["Fill",tt(c.backgroundColor)+j(w,"background-color",c.backgroundColor)]),w.textContent?.trim()&&$.push(["Text",tt(c.color)+j(w,"color",c.color)]),Number(c.opacity)<1&&$.push(["Opacity",`${Math.round(Number(c.opacity)*100)}%`]),$.length||$.push(["Color","<em>no fill or text</em>"]),ft(w,w.getBoundingClientRect(),$)},drawBorder:w=>{let c=getComputedStyle(w),$=[],H=["top","right","bottom","left"],R=H.map(W=>parseFloat(c.getPropertyValue(`border-${W}-width`))||0);if(R.some(W=>W>0)){let W=H.filter((I,Z)=>R[Z]>0);$.push(["Width",`${E(R.map(r))} <em>${c.getPropertyValue(`border-${W[0]}-style`)}</em>`]);let U=W.map(I=>c.getPropertyValue(`border-${I}-color`));W.forEach((I,Z)=>{Z&&U[Z]===U[0]||$.push([Z?`\u21B3 ${I}`:"Color",tt(U[Z])+j(w,`border-${I}-color`,U[Z])])})}else $.push(["Width","<em>none</em>"]);let D=["top-left","top-right","bottom-right","bottom-left"].map(W=>{let[U,I=U]=c.getPropertyValue(`border-${W}-radius`).split(" "),Z=kt=>kt.endsWith("%")?kt:r(parseFloat(kt)||0);return U===I?Z(U):`${Z(U)}/${Z(I)}`});$.push(["Radius",E(D)]),ft(w,w.getBoundingClientRect(),$,c.borderRadius)}}}var Dt=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim();function Ei(){let n=k=>{let f=[],T=k;for(;T&&T.tagName!=="HTML"&&f.length<8;){if(T.id){f.unshift("#"+CSS.escape(T.id));break}let F=T.parentElement,et=T.tagName.toLowerCase(),V=F?[...F.children].filter(gt=>gt.tagName===T.tagName):[];f.unshift(V.length>1?`${et}:nth-of-type(${V.indexOf(T)+1})`:et),T=F}return f.join(">")},r=(k,f)=>!f||Dt(k.textContent||"").slice(0,60)===f,d=(k,f)=>[k||"*",...(f||[]).map(T=>"."+CSS.escape(T))].join(""),g=k=>{try{return[...document.querySelectorAll(d(k.tag,k.classes))]}catch{return[]}},h=k=>{let f=Dt(k.textContent||"").replace(/\s+/g," ");for(let T=k.parentElement,F=0;T&&T!==document.body&&F<4;T=T.parentElement,F++){let et=Dt(T.textContent||"").replace(/\s+/g," ");if(et&&et!==f)return et}return""},x=k=>h(k).slice(0,80),S=(k,f)=>!f||h(k).startsWith(f),B=k=>{let f=null;try{f=document.querySelector(k.selector)}catch{f=null}if(f&&r(f,k.label)&&S(f,k.ctx))return f;let T=g(k),F=Dt(k.label)?T.filter(V=>r(V,k.label)):[];return(F.find(V=>S(V,k.ctx))??T.find(V=>k.ctx&&S(V,k.ctx)&&!Dt(k.label)))||F[0]||(f&&r(f,k.label)?f:null)||(k.nth!=null?T[k.nth]:null)||T[0]||f},v=k=>{let f=null;for(let T=k,F=k.parentElement;F&&F!==document.body&&getComputedStyle(T).position!=="fixed";T=F,F=F.parentElement){let et=getComputedStyle(F);if(et.overflowX==="visible"&&et.overflowY==="visible")continue;let V=F.getBoundingClientRect();f=f?{l:Math.max(f.l,V.left),t:Math.max(f.t,V.top),r:Math.min(f.r,V.right),b:Math.min(f.b,V.bottom)}:{l:V.left,t:V.top,r:V.right,b:V.bottom}}return f},L=k=>{let f=k.getBoundingClientRect();return(f.width>0||f.height>0)&&(!k.checkVisibility||k.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},y=(k,f)=>{for(let T=f.parentElement;T&&T!==document.body;T=T.parentElement){if(!L(T))continue;let F=f.getBoundingClientRect();if(F.width||F.height)return{x:F.left+F.width*k.rx,y:F.top+F.height*k.ry,off:"",el:f,hidden:T};let et=T.getBoundingClientRect();return{x:et.left,y:et.top,off:"",el:f,hidden:T}}return null};return{cssPath:n,poolOf:g,contextOf:x,resolveEl:B,anchorOf:(k,f=B(k))=>{if(!f)return null;if(!L(f))return y(k,f);let T=f.getBoundingClientRect(),F=T.left+T.width*k.rx,et=T.top+T.height*k.ry,V=v(f);if(!V)return{x:F,y:et,off:"",el:f};if(V.r-V.l<18||V.b-V.t<18)return null;let gt=Math.min(Math.max(F,V.l),V.r-18),j=Math.min(Math.max(et,V.t+18),V.b),tt=F<V.l?"l":F>V.r-18?"r":et<V.t+18?"t":et>V.b?"b":"";return{x:gt,y:j,off:tt,el:f}}}}var Mi=(n,r)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(d=>`<rect x="${.5+d*3}" y="${8.5-d*2.5}" width="2" height="${3+d*2.5}" rx="0.6" fill="${r}" stroke="none" opacity="${d<n?1:.28}"/>`).join("")}</svg>`;function ki(n,r,d){let g=document.createElement("div");g.className="dt-field-menu",g.setAttribute("role","listbox"),g.hidden=!0,document.body.append(g);for(let S of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])g.addEventListener(S,B=>B.stopPropagation());let h=null,x=()=>{g.hidden=!0,h=null};for(let S of n)S.addEventListener("mousedown",B=>{let v=B.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!v){g.contains(B.target)||x();return}if(B.preventDefault(),h===v){x();return}h=v;let L=v.classList.contains("dt-more-select"),y=f=>L?f.dataset.on!=null:f.selected;g.innerHTML=[...v.options].map((f,T)=>f.hidden?"":`${f.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${T}" aria-selected="${y(f)}"${f.dataset.danger!=null?' class="is-danger"':""}>${f.dataset.icon?f.dataset.icon:f.dataset.initial!=null?f.dataset.face?`<img class="dt-face" src="${r(f.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(f.dataset.initial)}</b>`:`<i style="background:${r(f.dataset.c||"#717171")}"></i>`}<span>${r(f.text)}</span>${f.dataset.hint?`<small>${r(f.dataset.hint)}</small>`:""}${y(f)?d:""}</button>`).join("");let N=v.parentElement.getBoundingClientRect();g.style.left=`${N.left}px`,g.style.top=`${N.bottom+4}px`,g.style.minWidth=`${N.width}px`,g.hidden=!1;let k=g.getBoundingClientRect();k.bottom>innerHeight-8&&(g.style.top=`${N.top-4-k.height}px`),k.right>innerWidth-8&&(g.style.left=`${Math.max(8,N.right-k.width)}px`)});g.addEventListener("click",S=>{let B=S.target.closest("[data-i]");if(!B||!h)return;let v=h;x(),!(v.selectedIndex===Number(B.dataset.i)&&!v.classList.contains("dt-more-select"))&&(v.selectedIndex=Number(B.dataset.i),v.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",S=>{S.key==="Escape"&&!g.hidden&&(S.stopPropagation(),x())},!0),document.addEventListener("pointerdown",S=>{!g.hidden&&!g.contains(S.target)&&!S.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&x()},!0),addEventListener("scroll",S=>{g.contains(S.target)||x()},!0)}var Ve=n=>n.replace(/[&<>"]/g,r=>({"&":"&","<":"<",">":">",'"':"""})[r]),G={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>'},go=(n,r)=>n.toLocaleTimeString("en-US",r),cs=n=>go(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),Ml={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 kl(n,r,d,g,h){let x=n.w+2*r.side,S=n.h+r.top+r.bottom,B=(d-x)/2,v=`<rect class="dt-shell-screen" x="${h}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,L="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let y=(N,k,f)=>`<rect class="dt-shell-btn" x="${N}" y="${k}" width="4" height="${f}" rx="2"/>`;L+=n.shell==="punch"?y(B+x-1,150,70)+y(B+x-1,240,44):y(B-3,120,28)+y(B-3,170,56)+y(B-3,236,56)+y(B+x-1,190,90),L+=`<rect class="dt-shell-body" x="${B}" y="0" width="${x}" height="${S}" rx="${r.body}"/>`,L+=`<rect class="dt-shell-bezel" x="${B+3}" y="3" width="${x-6}" height="${S-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(L+=`<rect class="dt-shell-slot" x="${d/2-26}" y="44" width="52" height="6" rx="3"/>`,L+=`<circle class="dt-shell-slot" cx="${d/2-48}" cy="47" r="5"/>`,L+=`<circle class="dt-shell-homebtn" cx="${d/2}" cy="${S-46}" r="28"/>`)}else if(n.shell==="tablet")L+=`<rect class="dt-shell-body dt-shell-body--light" x="${B}" y="0" width="${x}" height="${S}" rx="${r.body}"/>`,L+=`<rect class="dt-shell-bezel" x="${B+4}" y="4" width="${x-8}" height="${S-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let y=Math.round(x*.1);L+=`<path class="dt-shell-stand" d="M${d/2-y/2} ${S-2}h${y}l${y*.2} 84h${-y*1.4}z"/>`,L+=`<rect class="dt-shell-stand" x="${d/2-x*.15}" y="${S+80}" width="${x*.3}" height="14" rx="7"/>`,L+=`<rect class="dt-shell-body" x="${B}" y="0" width="${x}" height="${S}" rx="${r.body}"/>`}else{let y=x+(r.extraW??0),N=(d-y)/2,k=r.extraH??16;L+=`<path class="dt-shell-body" d="M${B} ${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${S}H${B}z"/>`,L+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${N} ${S}h${y}v${k-8}a8 8 0 0 1-8 8H${N+8}a8 8 0 0 1-8-8z"/>`,L+=`<rect class="dt-shell-lip" x="${d/2-x*.07}" y="${S}" width="${x*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${d} ${g}" width="${d}" height="${g}" aria-hidden="true">${L}${v}</svg>`}var Ll={"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})},Sl=({d:n,now:r,cutout:d},g)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${g}px"><span class="dt-sb-l">${G.signal}${G.wifi}</span><b>${cs(r)}</b><span class="dt-sb-r">${G.battery}</span></div>`;let h=d??{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:${h.x}px;top:${h.y}px;width:${h.width}px;height:${h.height}px"></span><b class="dt-sb-time" style="top:${h.y}px;height:${h.height}px">${cs(r)}</b><span class="dt-sb-icons" style="top:${h.y}px;height:${h.height}px">${G.signal}${G.wifi}${G.battery}</span></div>`},Tl=({d:n,host:r,min:d},g)=>{let h=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return d?`<div class="dt-ios-bar is-min" style="height:${g}px"><span class="dt-ios-mini">${Ve(r)}</span>${h}</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" aria-label="Back" title="Back">${G.back}</button><span class="dt-glass dt-ios-url"><span>${Ve(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${G.reload}</button></span><span class="dt-glass dt-glass--round">${G.dots}</span></div>${h}</div>`},Al=({now:n,min:r},d)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${go(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${G.wifi}${G.signal}${G.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${G.tune}<span>${Ve(d)}</span></span><span class="dt-and-tabs">1</span>${G.dotsV}</div>`),Cl=()=>`<div class="dt-and-nav">${G.recent}${G.home}${G.navBack}</div>`,Hl=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${cs(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${G.wifi}${G.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${G.sidebar}<button data-nav="back" aria-label="Back" title="Back">${G.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${G.fwd}</button></span><span class="dt-ipad-url">${G.lock}<span>${Ve(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${G.reload}</button></span><span class="dt-bar-group">${G.share}${G.plus}${G.tabs}</span></div>`,Bl=({now:n,host:r},d)=>'<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>'+(d?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${G.wifi}${G.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${cs(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">${G.sidebar}<button data-nav="back" aria-label="Back" title="Back">${G.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${G.fwd}</button></span><span class="dt-mac-url">${G.lock}<span>${Ve(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${G.reload}</button></span><span class="dt-bar-group">${G.share}${G.plus}${G.tabs}</span></div>`,Nl=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,Rl=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${Ve(r||n)}</span>${G.close}</span><span class="dt-win-new">${G.plus}</span><span class="dt-win-ctrl">${G.winMin}${G.winMax}${G.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${G.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${G.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${G.reload}</button></span><span class="dt-win-url">${G.tune}<span>${Ve(n)}</span>${G.star}</span><span class="dt-bar-group">${G.user}${G.dotsV}</span></div>`,Pl=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,d)=>`<i style="--hue:${200+d*30}"></i>`).join("")}</span><span class="dt-win-tray">${G.chevUp}${G.wifi}${G.volume}${G.battery}<span class="dt-win-clock">${go(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function Li(n,r){let d=Ml[n.shell](n),g=n.w+2*d.side,h=n.h+d.top+d.bottom,x=g+(d.extraW??0),S=h+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?d.extraH??0:0),B=(x-g)/2+d.side,v=Ll[n.browser](n),L=r.min?v.topMin??v.top:v.top,y=r.min?v.bottomMin??v.bottom:v.bottom,N={...r,d:n},k="",f="";switch(n.browser){case"safari-ios":k=Sl(N,L),f=Tl(N,y);break;case"chrome-android":k=Al(N,r.host),f=Cl();break;case"safari-ipad":k=Hl(N),f='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":k=Bl(N,n.shell==="macbook"),f=Nl();break;case"chrome-windows":k=Rl(N),f=Pl(N);break}return{footprint:{w:x,h:S},screen:{x:B,y:d.top,w:n.w,h:n.h,r:d.r,rb:d.rb??d.r},topH:L,bottomH:y,shell:kl(n,d,x,S,B),top:k,bottom:f,canMinimize:v.topMin!==void 0&&(v.topMin!==v.top||v.bottomMin!==v.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var ze=null;function An(n){if(ze??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!ze||!n)return[0,0,0,0];ze.clearRect(0,0,1,1),ze.fillStyle="rgba(0, 0, 0, 0)",ze.fillStyle=n,ze.fillRect(0,0,1,1);let[r,d,g,h]=ze.getImageData(0,0,1,1).data;return[r,d,g,h/255]}var Tn=([n,r,d])=>`rgb(${n}, ${r}, ${d})`;function Si(n){let r=n.defaultView,d=f=>!f||An(f)[3]===0,g=[n.body,n.documentElement].map(f=>f&&r.getComputedStyle(f).backgroundColor).find(f=>f&&!d(f)),[h,x,S,B]=g?An(g):[255,255,255,1],v=[h,x,S].map(f=>Math.round(f*B+255*(1-B))),L=f=>{let[T,F,et,V]=An(f);if(V>=.75)return Tn([T,F,et]);let gt=(j,tt)=>Math.round(j*V+tt*(1-V));return Tn([gt(T,v[0]),gt(F,v[1]),gt(et,v[2])])},y=f=>{let T=n.elementFromPoint(r.innerWidth/2,f);for(;T&&T!==n.documentElement;T=T.parentElement){let F=r.getComputedStyle(T);if(F.position!=="fixed"&&F.position!=="sticky")continue;let et=T.getBoundingClientRect().width>=r.innerWidth*.9,V=F.backdropFilter&&F.backdropFilter!=="none";return et&&!V&&!d(F.backgroundColor)?L(F.backgroundColor):null}return null},N=n.querySelector('meta[name="theme-color"]')?.content||"",k=N&&!d(N)?Tn(An(N)):"";return{top:y(4)??Tn(v),bottom:y(r.innerHeight-4)??Tn(v),theme:k}}function bo(n){let[r,d,g]=An(n).map(h=>h/255).map(h=>h<=.04045?h/12.92:((h+.055)/1.055)**2.4);return .2126*r+.7152*d+.0722*g>.4?"#000":"#fff"}function Ti(n){let{cfg:r,inFrame:d,persist:g,frame:h,frameEl:x,devicesMenu:S,bpBtns:B,notesOverlay:v,WIDE:L,bpOf:y,currentBp:N,deviceById:k,notesOn:f,filter:T,filterTo:F,dropFrameDrafts:et,putAway:V,tellFrame:gt,syncBpButtons:j,render:tt,reread:ut}=n,bt=r.breakpoints,st=document.querySelector(".dt-device"),ne=document.querySelector(".dt-shell"),Tt=document.querySelector('.dt-chrome[data-at="top"]'),Mt=document.querySelector('.dt-chrome[data-at="bottom"]'),_t=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],it=document.querySelector(".dt-frame-size"),ft=document.querySelector(".dt-frame-rotate"),Nt=document.querySelector(".dt-frame-bars"),Wt="overlay",w="",c="dt-w",$="dt-canvas",H="dt-device",R=nt.getItem($)==="1",D=nt.getItem(H)||"";D&&!k(D)&&(D="",nt.setItem(H,""));let W=Number(nt.getItem(c))||0,U="dt-emu",I=(()=>{try{return JSON.parse(nt.getItem(U)||"null")}catch{return null}})(),Z=()=>I?En.find(M=>M.id===I.id)??null:null,kt=()=>{let M=Z();return M?I.turned?{w:M.h,h:M.w}:{w:M.w,h:M.h}:null},pt=nt.getItem("dt-bars-min")==="1",qt=M=>{I=M,g(U,M?JSON.stringify(M):"")},se=M=>{it.textContent=M,h.style.setProperty("--dt-badge-w",`${it.offsetWidth}px`)},Yt=M=>{if(!M){_t.innerHTML="";return}let C="";for(let P=0;P<=M;P+=50)C+=`<span class="dt-tick${P%200===0?" is-major":""}" style="left:${P}px"></span>`;for(let P of bt)for(let at of[P.min,P.max])at>0&&Number.isFinite(at)&&at<=M&&(C+=`<span class="dt-edge" style="left:${at}px" title="${P.label} edge"></span>`);_t.innerHTML=C,_t.style.width=`${M}px`},wt=()=>{let M=parseFloat(st.style.width)||0,C=parseFloat(st.style.height)||0;if(!M||!C){st.style.transform="",delete st.dataset.scaled;return}let P=D||I?Math.min(1,(innerWidth-80)/M,(innerHeight-120)/C):Math.min(1,(innerWidth-80)/M);st.style.transform=P<1?`scale(${P})`:"",st.dataset.scaled=P<1?String(Math.round(P*100)):""},Ce=M=>En.find(C=>C.w===M.w&&C.h===M.h&&C.cutout?.shape==="pill")?.cutout,Rt=()=>{try{return x.contentDocument}catch{return null}},be=()=>Rt()?.title.split("\u2014").pop()?.trim()||"",X=()=>{let M=Rt(),C=D?k(D):null;if(!M?.body||!C)return;let P=Si(M),at=C.browser==="chrome-android"?P.theme||"rgb(255, 255, 255)":P.top,ct=C.browser==="chrome-android"?"rgb(255, 255, 255)":P.bottom;st.style.setProperty("--dt-top",at),st.style.setProperty("--dt-top-ink",bo(at)),st.style.setProperty("--dt-bottom",ct),st.style.setProperty("--dt-bottom-ink",bo(ct));let Et=Tt.querySelector(".dt-win-tab > span");Et&&(Et.textContent=be()||location.host)},Me=0;x.addEventListener("load",()=>{let M=Rt();if(!M)return;let C=window.__notemendHosted;if(C&&!x.contentWindow?.__notemendHosted&&!M.querySelector(`script[src^="${C.base}/bar.js"]`)){let P=M.createElement("script");P.src=`${C.base}/bar.js`,P.dataset.project=C.project,M.head.append(P)}X(),x.contentWindow?.addEventListener("scroll",()=>{Me||(Me=requestAnimationFrame(()=>{Me=0,X()}))},{passive:!0})});for(let M of[Tt,Mt])M.addEventListener("click",C=>{let P=C.target.closest("[data-nav]")?.dataset.nav;if(P)try{let at=x.contentWindow?.navigation;if(!Rt()||!at)throw new Error("foreign");P==="back"?at.canGoBack&&at.back():P==="fwd"?at.canGoForward&&at.forward():at.reload()}catch{(P==="reload"||P==="back")&&(x.src=location.href)}});Nt.addEventListener("click",()=>{pt=!pt,g("dt-bars-min",pt?"1":"0"),Ft()});let Ft=()=>{if(d)return;let M=D?k(D)??null:null;if(D&&!M&&(D="",nt.setItem(H,"")),!M&&!R){h.hidden=!0,x.removeAttribute("src"),Ot.toggle("dt-framing",!1),v.hidden=!f(),_t.innerHTML="",j(),ft.hidden=!0,Nt.hidden=!0,F(null),w="",et(),j(),Pt(),ut();return}if(h.hidden=!1,Ot.toggle("dt-framing",!0),v.hidden=!0,x.src||(x.src=location.href),M){let C=Li(M,{host:location.host,title:be(),now:new Date,min:pt,cutout:Ce(M)}),{screen:P}=C;h.dataset.mode="device",st.dataset.shell=M.shell,st.dataset.browser=M.browser,st.style.width=`${C.footprint.w}px`,st.style.height=`${C.footprint.h}px`,st.style.setProperty("--dt-r",`${P.r}px`),st.style.setProperty("--dt-rb",`${P.rb}px`),ne.innerHTML=C.shell;let at=(oe,fe,de,Ke)=>{oe.innerHTML=Ke,oe.style.cssText=`left:${P.x}px;top:${fe}px;width:${P.w}px;height:${de}px`};at(Tt,P.y,C.topH,C.top),at(Mt,P.y+P.h-C.bottomH,C.bottomH,C.bottom);let ct=P.h-C.topH-C.bottomH;x.style.position="absolute",x.style.left=`${P.x}px`,x.style.top=`${P.y+C.topH}px`,x.style.width=`${P.w}px`,x.style.height=`${ct}px`,_t.innerHTML="";let Et=pt&&C.canMinimize;Wt=C.scrollbar,w=`${M.label}${Et?" \xB7 bars folded":""}`,F(y(M.w)),gt({notes:f(),scrollbar:Wt,device:w}),Nt.hidden=!C.canMinimize,Nt.setAttribute("aria-pressed",String(Et)),se(`${M.label} \xB7 page ${M.w}\xD7${ct} of ${M.w}\xD7${M.h}${Et?" \xB7 bars folded":""} \xB7 ${bt.find(oe=>oe.id===T())?.label??""}`),X()}else{let C=kt();C||qt(null);let P=C?.w||W||bt.find(Et=>Et.id===N()).ideal;W=P,h.dataset.mode="canvas",delete st.dataset.shell,delete st.dataset.browser,ne.innerHTML=Tt.innerHTML=Mt.innerHTML="",Tt.style.cssText=Mt.style.cssText="",Nt.hidden=!0,Wt="overlay",st.style.width=`${P}px`,st.style.height=`${C?.h??innerHeight-84}px`,x.style.position="",x.style.left=x.style.top="",x.style.width="100%",x.style.height="100%",Yt(P),gt({notes:f()});let at=bt.find(Et=>Et.id===y(P)),ct=Z();w=ct?`${ct.label}${I?.turned?" \xB7 landscape":""}`:"",gt({scrollbar:Wt,device:w}),se(ct&&C?`${ct.label} \xB7 ${C.w}\xD7${C.h} \xB7 ${at.label}`:`${P}px \xB7 ${at.label}`),F(y(P))}ft.hidden=!(Z()?.rotates&&!M),Pt(),wt(),j(),ut()},rn=M=>{let C=bt.find(P=>P.id===M);D="",nt.setItem(H,""),qt(null),R=M!==L,W=R?C.ideal:0,F(R?M:null),nt.setItem($,R?"1":"0"),nt.setItem(c,String(W)),V(),Ft()};for(let M of B)M.addEventListener("click",()=>rn(M.dataset.bp));for(let M of document.querySelectorAll("[data-device]"))M.addEventListener("click",()=>{D=M.dataset.device===D?"":M.dataset.device,nt.setItem(H,D),S.open=!1,Ft()});for(let M of document.querySelectorAll("[data-emu]"))M.addEventListener("click",()=>{let C=I?.id===M.dataset.emu&&!D;D="",nt.setItem(H,""),qt(C?null:{id:M.dataset.emu,turned:!1}),R=!C,W=0,nt.setItem($,R?"1":"0"),F(null),V(),S.open=!1,Ft()});ft.addEventListener("click",()=>{I&&(qt({...I,turned:!I.turned}),V(),Ft())});let K=[...S.querySelectorAll("[data-tab]")],At=[...S.querySelectorAll("[data-panel]")],Q=M=>{for(let C of K)C.setAttribute("aria-selected",String(C.dataset.tab===M));for(let C of At)C.hidden=C.dataset.panel!==M;g("dt-devices-tab",M)};for(let M of K)M.addEventListener("click",()=>Q(M.dataset.tab));Q(nt.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let A=S.querySelector(".dt-emu-search");A.addEventListener("input",()=>{let M=A.value.trim().toLowerCase(),C=null,P=!1,at=()=>{C&&(C.hidden=!P)};for(let ct of A.parentElement.children){if(ct.classList.contains("dt-devices-group")){at(),C=ct,P=!1;continue}ct.dataset.emu&&(ct.hidden=!!M&&!ct.textContent.toLowerCase().includes(M),P||=!ct.hidden)}at()});let ln=S.querySelector(".dt-devices-name");function Pt(){for(let C of S.querySelectorAll("[data-device]"))C.setAttribute("aria-pressed",String(C.dataset.device===D));let M=!D&&!h.hidden?I?.id:void 0;for(let C of S.querySelectorAll("[data-emu]"))C.setAttribute("aria-pressed",String(C.dataset.emu===M));ln.textContent=D&&k(D)?.label||M&&Z()?.label||"Device"}let xt=M=>bt.find(C=>C.id===M),ht=M=>{let C=xt(T()??N());return Math.max(C.min||320,Math.min(Number.isFinite(C.max)?C.max:2560,Math.round(M)))};for(let M of E){let C=M.dataset.edge==="l"?-1:1;M.addEventListener("pointerdown",P=>{if(D)return;P.preventDefault(),I&&(qt(null),Ft()),M.setPointerCapture(P.pointerId);let at=P.clientX,ct=W,Et=Number(st.dataset.scaled||100)/100;h.dataset.dragging="1";let oe=de=>{W=ht(ct+C*(de.clientX-at)*2/Et),st.style.width=`${W}px`,Yt(W),se(`${W}px \xB7 ${xt(y(W)).label}`),wt()},fe=()=>{M.removeEventListener("pointermove",oe),M.removeEventListener("pointerup",fe),M.removeEventListener("pointercancel",fe),delete h.dataset.dragging,nt.setItem(c,String(W)),Ft()};M.addEventListener("pointermove",oe),M.addEventListener("pointerup",fe),M.addEventListener("pointercancel",fe)}),M.addEventListener("dblclick",()=>{if(D)return;qt(null);let P=xt(T()??N()),at=[P.min||320,Number.isFinite(P.max)?P.max:P.ideal];W=Math.abs(W-at[0])<Math.abs(W-at[1])?at[0]:at[1],nt.setItem(c,String(W)),Ft()})}let Ct=N();return addEventListener("resize",()=>{j(),N()!==Ct&&(Ct=N(),tt()),h.hidden||(!D&&!I&&(st.style.height=`${innerHeight-84}px`),wt())}),{apply:Ft,pickBp:rn,look:()=>({scrollbar:Wt,device:w}),restore:()=>{R||D?Ft():Pt()}}}var Ai='<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>',Ci='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Il='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Hi(n){let{bp:r,notes:d,breakpoints:g,bandOfNote:h,whoseAgent:x,statusTools:S,showResolved:B,showArchived:v,drafts:L,find:y}=n,N=d.filter(E=>h(E)===r),k=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(it=>!it.deleted).map(it=>it.text)].join(" ").toLowerCase(),f=E=>y.view==="me"?n.forMe(E):y.view==="agent"?n.forAgent(E):!0,T=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,F=N.filter(E=>f(E)&&(!y.q||k(E).includes(y.q.trim().toLowerCase()))).sort((E,it)=>(y.sort==="unread"?Number(n.unread(it))-Number(n.unread(E)):0)||T(it)-T(E)),et={open:[],claude:[],done:[],archived:[]};for(let E of F)et[mt(E)==="done"&&n.archived(E)?"archived":mt(E)].push(E);let V=E=>{let it=(E.replies??[]).filter(R=>!R.deleted),ft=_e(E.category),Nt=mt(E),Wt=Nt==="claude"&&!n.agentless(E),w=n.orphan(E),c=it.length?it[it.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text},$=(R,D)=>R.by&&D.by?R.by===D.by:R.byName===D.byName,H=n.unread(E);return`<div class="dt-hist-row is-${Nt}${Nt==="done"?n.archived(E)?" is-archived":" is-resolved":""}${w?" is-orphan":""}${H?" is-unread":""}">
|
|
167
|
+
`)}var ur=[{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"/>'}],wn=(n,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Qe=n=>ur.find(i=>i.id===n)||ur[0];var bt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",pr={open:"Open",done:"Resolved",claude:"To check"};var Ft={ready:Promise.resolve(),toggle:(n,i)=>{Ft.ready.then(()=>document.documentElement.classList.toggle(n,i))},set:(n,i)=>{Ft.ready.then(()=>document.documentElement.style.setProperty(n,i))}};var Ld=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,hr=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(Ld,"$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 $n=[],Uo=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)}},Sd=/ResizeObserver loop (completed with undelivered notifications|limit exceeded)/,tn=(n,i)=>{if(Sd.test(i))return;let l=hr(i.replace(/\s+/g," ").trim()).slice(0,500),u=$n[$n.length-1];if(u&&u.kind===n&&u.text.replace(/ ×\d+$/,"")===l){let p=Number(/ ×(\d+)$/.exec(u.text)?.[1]??1)+1;u.text=`${l} \xD7${p}`,u.at=new Date().toISOString();return}$n.push({at:new Date().toISOString(),kind:n,text:l}),$n.length>50&&$n.shift()},mr=!1;function gr(n){if(mr||typeof window>"u")return;mr=!0;let i=console.error;console.error=(...p)=>{tn("console",p.map(Uo).join(" ")),i.apply(console,p)},addEventListener("error",p=>{if(p instanceof ErrorEvent)return tn("error",`${p.message}${p.filename?` (${p.filename}:${p.lineno})`:""}`);let v=p.target,k=v?.src||v?.href;k&&!n(k)&&tn("network",`${v.tagName?.toLowerCase()} ${k} did not load`)},!0),addEventListener("unhandledrejection",p=>tn("rejection",Uo(p.reason)));let l=window.fetch;window.fetch=async(p,v)=>{let k=typeof p=="string"?p:p instanceof URL?p.href:p.url,H=(v?.method||(p instanceof Request?p.method:"GET")).toUpperCase();try{let f=await l.call(window,p,v);return f.status>=400&&!n(k)&&tn("network",`${H} ${k} \u2192 ${f.status}`),f}catch(f){throw!n(k)&&f?.name!=="AbortError"&&tn("network",`${H} ${k} \u2192 no answer (${Uo(f)})`),f}};let u=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(p,v,...k){return this._nm=`${p.toUpperCase()} ${String(v)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(v))||tn("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),u.call(this,p,v,...k)}}var fr=(n=Date.now())=>$n.filter(i=>n-Date.parse(i.at)<10*6e4).slice(-20);function br(n){let i=w=>{let m=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,M=w/m;return Math.round(M*10)%10===0?String(Math.round(M)):M.toFixed(1)},l=(w,m,M,B,D,z="p")=>{if(M<=0||B<=0)return"";let U=D!==""?`<span class="dt-pad-chip dt-pad-chip--${z}" style="left:${w+M/2}px;top:${m+B/2}px">${D}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${z}" style="left:${w}px;top:${m}px;width:${M}px;height:${B}px"></span>${U}`},u=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],p="button, a, input, select, textarea, label, [role='button']",v=w=>{let m=w;for(let M=0;m&&M<6;M++,m=m.parentElement){if(m.matches(p))return m;let B=getComputedStyle(m);if(u.some(D=>parseFloat(B[D])>=2))return m}return w},k=(w,m)=>{let M=parseFloat(m.columnGap)||0,B=parseFloat(m.rowGap)||0;if(!(m.display.includes("flex")||m.display.includes("grid"))||!M&&!B)return"";let D=[...w.children].map(U=>U.getBoundingClientRect()).filter(U=>U.width||U.height),z="";for(let U=1;U<D.length;U++){let tt=D[U-1],X=D[U];if(M&&X.left>=tt.right-1){let at=Math.max(tt.top,X.top);z+=l(tt.right,at,X.left-tt.right,Math.min(tt.bottom,X.bottom)-at,i(M),"g")}else if(B&&X.top>=tt.bottom-1){let at=Math.min(tt.left,X.left);z+=l(at,tt.bottom,Math.max(tt.right,X.right)-at,X.top-tt.bottom,i(B),"g")}}return z},H=w=>`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px"></span>`,f=(w,m,M="")=>`<span class="dt-pad-tag" style="left:${m.left}px;top:${Math.max(2,m.top-22)}px">${w.tagName.toLowerCase()+(w.classList[0]?"."+w.classList[0]:"")}${M}</span>`,$=w=>{let m=w.getBoundingClientRect(),M=getComputedStyle(w),B=parseFloat(M.paddingTop),D=parseFloat(M.paddingRight),z=parseFloat(M.paddingBottom),U=parseFloat(M.paddingLeft),tt=H(m);tt+=l(m.left,m.top,m.width,B,B>=2?i(B):""),tt+=l(m.left,m.bottom-z,m.width,z,z>=2?i(z):""),tt+=l(m.left,m.top+B,U,m.height-B-z,U>=2?i(U):""),tt+=l(m.right-D,m.top+B,D,m.height-B-z,D>=2?i(D):"");let X=parseFloat(M.marginTop),at=parseFloat(M.marginRight),ct=parseFloat(M.marginBottom),kt=parseFloat(M.marginLeft);tt+=l(m.left,m.top-X,m.width,X,X>=2?i(X):"","m"),tt+=l(m.left,m.bottom,m.width,ct,ct>=2?i(ct):"","m"),tt+=l(m.left-kt,m.top,kt,m.height,kt>=2?i(kt):"","m"),tt+=l(m.right,m.top,at,m.height,at>=2?i(at):"","m"),tt+=k(w,M);let Nt=parseFloat(M.columnGap)||0,Bt=parseFloat(M.rowGap)||0,sn=(M.display.includes("flex")||M.display.includes("grid"))&&(Nt||Bt)?` \xB7 gap ${i(Nt)}${Bt&&Bt!==Nt?"/"+i(Bt):""}`:"",fe="",Kt=w.parentElement;if(w.matches(p)&&Kt){let vt=getComputedStyle(Kt);tt+=k(Kt,vt);let Oe=parseFloat(vt.columnGap)||parseFloat(vt.rowGap)||0;fe=` \xB7 ${i(m.width)}\xD7${i(m.height)}${Oe&&(vt.display.includes("flex")||vt.display.includes("grid"))?` \xB7 gap ${i(Oe)} in its row`:""}`}n.innerHTML=tt+f(w,m,sn+fe)},y=w=>{let m=w.getBoundingClientRect();n.innerHTML=H(m)+`<span class="dt-pad-chip" style="left:${m.left+m.width/2}px;top:${m.top+m.height/2}px">${i(m.width)} \xD7 ${i(m.height)}</span>`+f(w,m)},R=w=>{let m=(w.match(/[\d.]+/g)||[]).map(Number);if(m.length<3)return w;let M="#"+m.slice(0,3).map(B=>Math.round(B).toString(16).padStart(2,"0")).join("");return m[3]!==void 0&&m[3]<1?`${M} \xB7 ${Math.round(m[3]*100)}%`:M},Q=null,_=()=>{if(Q)return Q;let w=getComputedStyle(document.documentElement),m=document.createElement("span");m.style.display="none",document.body.append(m);let M=[];for(let B of Array.from(w)){if(!B.startsWith("--"))continue;let D=w.getPropertyValue(B).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(D))continue;m.style.color="rgb(1, 2, 3)",m.style.color=D;let z=getComputedStyle(m).color;z&&z!=="rgb(1, 2, 3)"&&M.push([z,B])}return m.remove(),M.sort((B,D)=>B[1].length-D[1].length),Q=M,M},Y=w=>_().find(([m])=>m===w)?.[1]??"",ht=null,P=()=>{if(ht)return ht;let w=[],m=M=>{for(let B of Array.from(M))B instanceof CSSStyleRule?B.style.cssText.includes("var(--")&&w.push({sel:B.selectorText,style:B.style}):B instanceof CSSMediaRule?matchMedia(B.conditionText).matches&&m(B.cssRules):"cssRules"in B&&m(B.cssRules)};for(let M of Array.from(document.styleSheets))try{m(M.cssRules)}catch{}return ht=w},A={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(w=>[`border-${w}-color`,[`border-${w}-color`,"border-color",`border-${w}`,"border"]]))},W=(w,m)=>{let M=A[m]??[m],B=m==="color";for(let D=w;D;D=B?D.parentElement:null){let z=X=>M.map(at=>/var\(\s*(--[\w-]+)/.exec(X.getPropertyValue(at))?.[1]).find(Boolean),U=D instanceof HTMLElement?z(D.style):void 0;if(U)return U;let tt="";for(let X of P()){let at=!1;try{at=D.matches(X.sel)}catch{}at&&(tt=z(X.style)||tt)}if(tt)return tt;if(B&&D.parentElement&&getComputedStyle(D).color!==getComputedStyle(D.parentElement).color)break}return""},L=(w,m,M)=>{let B=W(w,m);if(B)return`<b class="dt-var">${B}</b> <em>${R(M)}</em>`;let D=Y(M);return D?`<span title="Same value as ${D}; not written with it">\u2248 ${D}</span> <em>${R(M)}</em>`:R(M)},j=w=>`<i class="dt-type-sw" style="background:${w}"></i>`,I={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},rt=w=>(w.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ot=(w,m)=>w.slice(0,3).map((M,B)=>M*w[3]+m[B]*(1-w[3])).concat([1]),Pt=w=>{let m=[];for(let M=w;M;M=M.parentElement){let B=getComputedStyle(M);if(B.backgroundImage!=="none")return null;let D=rt(B.backgroundColor);if(D[3]>0&&(m.push(D),D[3]>=1))break}return m.reduceRight((M,B)=>ot(B,M),[255,255,255,1])},Ht=w=>{let[m,M,B]=w.slice(0,3).map(D=>(D/=255,D<=.03928?D/12.92:((D+.055)/1.055)**2.4));return .2126*m+.7152*M+.0722*B},St=(w,m,M)=>{let B=Pt(w);if(!B)return["Contrast","<em>on an image</em>"];let D=ot(rt(m.color),B),[z,U]=[Ht(D),Ht(B)].sort((ct,kt)=>kt-ct),tt=(z+.05)/(U+.05),X=M>=24||M>=18.66&&Number(m.fontWeight)>=700,at=tt>=(X?4.5:7)?"AAA":tt>=(X?3:4.5)?"AA":"fails AA";return["Contrast",`${tt.toFixed(2)}:1 <em class="${at==="fails AA"?"dt-type-bad":""}">${at}${X?" \xB7 large":""}</em>`]},zt=w=>{let m=w.getBoundingClientRect(),M=getComputedStyle(w),B=parseFloat(M.fontSize),D=M.lineHeight==="normal"?0:parseFloat(M.lineHeight),z=parseFloat(M.letterSpacing)||0,U=kt=>`${(kt*100).toFixed(1).replace(/\.0$/,"")}%`,tt=[["Font",M.fontFamily.split(",")[0].replace(/["']/g,"")+(M.fontStyle!=="normal"?` ${M.fontStyle}`:"")],["Weight",`${I[M.fontWeight]??""} <em>${M.fontWeight}</em>`],["Size",`${i(B)}px`],["Line",D?`${U(D/B)} <em>${i(D)}px</em>`:"normal"],["Letter",z?`${U(z/B)} <em>${z.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",j(M.color)+L(w,"color",M.color)],St(w,M,B)],at=m.bottom+150<innerHeight?m.bottom+8:Math.max(8,m.top-158),ct=Math.min(Math.max(8,m.left),innerWidth-210);n.innerHTML=H(m)+f(w,m)+`<div class="dt-type-card" style="left:${ct}px;top:${at}px">${tt.map(([kt,Nt])=>`<span class="dt-type-row"><b>${kt}</b><span>${Nt}</span></span>`).join("")}</div>`},E=w=>w.every(m=>m===w[0])?w[0]:w[1]===w[3]&&w[0]===w[2]?`${w[0]} ${w[1]}`:w.join(" "),pt=w=>/^rgba\(.*,\s*0\)$|^transparent$/.test(w),wt=(w,m,M,B="")=>{let D=16+M.length*18,U=m.bottom+D+12<innerHeight?m.bottom+8:Math.max(8,m.top-D-8),tt=Math.min(Math.max(8,m.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${m.left}px;top:${m.top}px;width:${m.width}px;height:${m.height}px${B?`;border-radius:${B}`:""}"></span>`+f(w,m)+`<div class="dt-type-card dt-style-card" style="left:${tt}px;top:${U}px">${M.map(([X,at])=>`<span class="dt-type-row"><b>${X}</b><span>${at}</span></span>`).join("")}</div>`};return{spacer:v,drawPads:$,drawSize:y,drawType:zt,drawColor:w=>{let m=getComputedStyle(w),M=[];m.backgroundImage!=="none"&&M.push(["Fill",`<em>${/gradient/.test(m.backgroundImage)?"gradient":"image"}</em>`]),pt(m.backgroundColor)||M.push(["Fill",j(m.backgroundColor)+L(w,"background-color",m.backgroundColor)]),w.textContent?.trim()&&M.push(["Text",j(m.color)+L(w,"color",m.color)]),Number(m.opacity)<1&&M.push(["Opacity",`${Math.round(Number(m.opacity)*100)}%`]),M.length||M.push(["Color","<em>no fill or text</em>"]),wt(w,w.getBoundingClientRect(),M)},drawBorder:w=>{let m=getComputedStyle(w),M=[],B=["top","right","bottom","left"],D=B.map(U=>parseFloat(m.getPropertyValue(`border-${U}-width`))||0);if(D.some(U=>U>0)){let U=B.filter((X,at)=>D[at]>0);M.push(["Width",`${E(D.map(i))} <em>${m.getPropertyValue(`border-${U[0]}-style`)}</em>`]);let tt=U.map(X=>m.getPropertyValue(`border-${X}-color`));U.forEach((X,at)=>{at&&tt[at]===tt[0]||M.push([at?`\u21B3 ${X}`:"Color",j(tt[at])+L(w,`border-${X}-color`,tt[at])])})}else M.push(["Width","<em>none</em>"]);let z=["top-left","top-right","bottom-right","bottom-left"].map(U=>{let[tt,X=tt]=m.getPropertyValue(`border-${U}-radius`).split(" "),at=ct=>ct.endsWith("%")?ct:i(parseFloat(ct)||0);return tt===X?at(tt):`${at(tt)}/${at(X)}`});M.push(["Radius",E(z)]),wt(w,w.getBoundingClientRect(),M,m.borderRadius)}}}var Rt=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Kn=(n,i,l=!1)=>{for(let u=i*4;;u*=4){let p=l?Rt(n.slice(0,u)).replace(/\s+/g," "):Rt(n.slice(0,u));if(p.length>=i||u>=n.length)return p.slice(0,i)}},yr='[class^="dt-"],[class*=" dt-"],.devtools',qs=n=>{let i=n;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(yr)};function vr(){let n=(P,A)=>P?[...P.children].filter(W=>W.tagName.toUpperCase()===A.toUpperCase()&&!(P===document.body&&W.matches(yr))):[],i=P=>{let A=[],W=P;for(;W&&W.tagName!=="HTML"&&A.length<8;){if(W.id){A.unshift("#"+CSS.escape(W.id));break}let L=W.parentElement,j=W.tagName.toLowerCase(),I=n(L,W.tagName),rt=L===document.body&&I.length>1?[...W.classList].find(ot=>/^[\w-]+$/.test(ot)&&I.filter(Pt=>Pt.classList.contains(ot)).length===1):void 0;A.unshift(rt?`${j}.${rt}`:I.length>1?`${j}:nth-of-type(${I.indexOf(W)+1})`:j),W=L}return A.join(">")},l=P=>{let A=P.split(">"),W=null;for(let[L,j]of A.entries()){if(j.startsWith("#")){if(L)return null;W=document.querySelector(j);continue}let I=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(j);if(!I)return document.querySelector(P);if(!W){if(I[1]!=="body"||I[2]||I[3])return document.querySelector(P);W=document.body;continue}let rt=n(W,I[1].toUpperCase());if(W=(I[2]?rt.find(ot=>ot.classList.contains(I[2])):rt[I[3]?Number(I[3])-1:0])??null,!W)return null}return W},u=P=>P.replace(/\s+/g," ").trim(),p=(P,A)=>!A||u(Kn(P.textContent||"",60))===u(A),v=(P,A)=>[P||"*",...(A||[]).map(W=>"."+CSS.escape(W))].join(""),k=P=>{try{return[...document.querySelectorAll(v(P.tag,P.classes))].filter(A=>!qs(A))}catch{return[]}},f=P=>{let A=P.textContent||"",W=null;for(let L=P.parentElement,j=0;L&&L!==document.body&&j<4;L=L.parentElement,j++){let I=L.textContent||"";if(I===A)continue;let rt=Kn(I,80,!0);if(rt&&(rt!==Kn(A,80,!0)||(W??=Rt(A).replace(/\s+/g," "),Rt(I).replace(/\s+/g," ")!==W)))return rt}return""},$=P=>f(P),y=(P,A)=>!A||f(P).startsWith(A),R=P=>{let A=null;try{A=l(P.selector)}catch{A=null}if(A&&qs(A)&&(A=null),A&&p(A,P.label)&&y(A,P.ctx))return A;let W=k(P),L=Rt(P.label)?W.filter(I=>p(I,P.label)):[],j=L.find(I=>y(I,P.ctx))??W.find(I=>P.ctx&&y(I,P.ctx)&&!Rt(P.label));return j||(Rt(P.label)?A&&!P.ctx&&p(A,P.label)?A:L.length===1?L[0]:null:A||(P.nth!=null?W[P.nth]??null:null))},Q=P=>{let A=null;for(let W=P,L=P.parentElement;L&&L!==document.body&&getComputedStyle(W).position!=="fixed";W=L,L=L.parentElement){let j=getComputedStyle(L);if(j.overflowX==="visible"&&j.overflowY==="visible")continue;let I=L.getBoundingClientRect();A=A?{l:Math.max(A.l,I.left),t:Math.max(A.t,I.top),r:Math.min(A.r,I.right),b:Math.min(A.b,I.bottom)}:{l:I.left,t:I.top,r:I.right,b:I.bottom}}return A},_=P=>{let A=P.getBoundingClientRect();return(A.width>0||A.height>0)&&(!P.checkVisibility||P.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},Y=(P,A)=>{let W=A;for(let L=A.parentElement;L&&L!==document.body;L=L.parentElement){if(!_(L)){W=L;continue}let j=A.getBoundingClientRect();if(j.width||j.height)return{x:j.left+j.width*P.rx,y:j.top+j.height*P.ry,off:"",el:A,hidden:L,shut:W};let I=L.getBoundingClientRect();return{x:I.left,y:I.top,off:"",el:A,hidden:L,shut:W}}return null};return{cssPath:i,poolOf:k,contextOf:$,resolveEl:R,anchorOf:(P,A=R(P))=>{if(!A)return null;if(!_(A))return Y(P,A);let W=A.getBoundingClientRect(),L=W.left+W.width*P.rx,j=W.top+W.height*P.ry,I=Q(A);if(!I)return{x:L,y:j,off:"",el:A};if(I.r-I.l<18||I.b-I.t<18)return null;let rt=Math.min(Math.max(L,I.l),I.r-18),ot=Math.min(Math.max(j,I.t+18),I.b),Pt=L<I.l?"l":L>I.r-18?"r":j<I.t+18?"t":j>I.b?"b":"";return{x:rt,y:ot,off:Pt,el:A}}}}var wr=(n,i)=>`<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="${i}" stroke="none" opacity="${l<n?1:.28}"/>`).join("")}</svg>`;function $r(n,i,l){let u=document.createElement("div");u.className="dt-field-menu",u.setAttribute("role","listbox"),u.hidden=!0,document.body.append(u);for(let k of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])u.addEventListener(k,H=>H.stopPropagation());let p=null,v=()=>{u.hidden=!0,p=null};for(let k of n)k.addEventListener("mousedown",H=>{let f=H.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!f){u.contains(H.target)||v();return}if(H.preventDefault(),p===f){v();return}p=f;let $=f.classList.contains("dt-more-select"),y=_=>$?_.dataset.on!=null:_.selected;u.innerHTML=[...f.options].map((_,Y)=>_.hidden?"":`${_.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${Y}" aria-selected="${y(_)}"${_.dataset.danger!=null?' class="is-danger"':""}>${_.dataset.icon?_.dataset.icon:_.dataset.initial!=null?_.dataset.face?`<img class="dt-face" src="${i(_.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(_.dataset.initial)}</b>`:`<i style="background:${i(_.dataset.c||"#717171")}"></i>`}<span>${i(_.text)}</span>${_.dataset.hint?`<small>${i(_.dataset.hint)}</small>`:""}${y(_)?l:""}</button>`).join("");let R=f.parentElement.getBoundingClientRect();u.style.left=`${R.left}px`,u.style.top=`${R.bottom+4}px`,u.style.minWidth=`${R.width}px`,u.hidden=!1;let Q=u.getBoundingClientRect();Q.bottom>innerHeight-8&&(u.style.top=`${R.top-4-Q.height}px`),Q.right>innerWidth-8&&(u.style.left=`${Math.max(8,R.right-Q.width)}px`)});u.addEventListener("click",k=>{let H=k.target.closest("[data-i]");if(!H||!p)return;let f=p;v(),!(f.selectedIndex===Number(H.dataset.i)&&!f.classList.contains("dt-more-select"))&&(f.selectedIndex=Number(H.dataset.i),f.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",k=>{k.key==="Escape"&&!u.hidden&&(k.stopPropagation(),v())},!0),document.addEventListener("pointerdown",k=>{!u.hidden&&!u.contains(k.target)&&!k.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&v()},!0),addEventListener("scroll",k=>{u.contains(k.target)||v()},!0)}var nn=n=>n.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),Z={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>'},Go=(n,i)=>n.toLocaleTimeString("en-US",i),Fs=n=>Go(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),Td={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 Ad(n,i,l,u,p){let v=n.w+2*i.side,k=n.h+i.top+i.bottom,H=(l-v)/2,f=`<rect class="dt-shell-screen" x="${p}" y="${i.top}" width="${n.w}" height="${n.h}" rx="${i.r}"/>`,$="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let y=(R,Q,_)=>`<rect class="dt-shell-btn" x="${R}" y="${Q}" width="4" height="${_}" rx="2"/>`;$+=n.shell==="punch"?y(H+v-1,150,70)+y(H+v-1,240,44):y(H-3,120,28)+y(H-3,170,56)+y(H-3,236,56)+y(H+v-1,190,90),$+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${k}" rx="${i.body}"/>`,$+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${v-6}" height="${k-6}" rx="${i.body-3}"/>`,n.shell==="home"&&($+=`<rect class="dt-shell-slot" x="${l/2-26}" y="44" width="52" height="6" rx="3"/>`,$+=`<circle class="dt-shell-slot" cx="${l/2-48}" cy="47" r="5"/>`,$+=`<circle class="dt-shell-homebtn" cx="${l/2}" cy="${k-46}" r="28"/>`)}else if(n.shell==="tablet")$+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${v}" height="${k}" rx="${i.body}"/>`,$+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${v-8}" height="${k-8}" rx="${i.body-4}"/>`;else if(n.shell==="monitor"){let y=Math.round(v*.1);$+=`<path class="dt-shell-stand" d="M${l/2-y/2} ${k-2}h${y}l${y*.2} 84h${-y*1.4}z"/>`,$+=`<rect class="dt-shell-stand" x="${l/2-v*.15}" y="${k+80}" width="${v*.3}" height="14" rx="7"/>`,$+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${k}" rx="${i.body}"/>`}else{let y=v+(i.extraW??0),R=(l-y)/2,Q=i.extraH??16;$+=`<path class="dt-shell-body" d="M${H} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${v-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${k}H${H}z"/>`,$+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${R} ${k}h${y}v${Q-8}a8 8 0 0 1-8 8H${R+8}a8 8 0 0 1-8-8z"/>`,$+=`<rect class="dt-shell-lip" x="${l/2-v*.07}" y="${k}" width="${v*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${l} ${u}" width="${l}" height="${u}" aria-hidden="true">${$}${f}</svg>`}var Cd={"safari-ios":n=>{let i=n.shell==="home"?20:n.w>=400?62:59;return{top:i,bottom:98,topMin:i,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})},Hd=({d:n,now:i,cutout:l},u)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${u}px"><span class="dt-sb-l">${Z.signal}${Z.wifi}</span><b>${Fs(i)}</b><span class="dt-sb-r">${Z.battery}</span></div>`;let p=l??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${u}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">${Fs(i)}</b><span class="dt-sb-icons" style="top:${p.y}px;height:${p.height}px">${Z.signal}${Z.wifi}${Z.battery}</span></div>`},Nd=({d:n,host:i,min:l},u)=>{let p=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return l?`<div class="dt-ios-bar is-min" style="height:${u}px"><span class="dt-ios-mini">${nn(i)}</span>${p}</div>`:`<div class="dt-ios-bar" style="height:${u}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${Z.back}</button><span class="dt-glass dt-ios-url"><span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-glass dt-glass--round">${Z.dots}</span></div>${p}</div>`},Bd=({now:n,min:i},l)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Go(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${Z.wifi}${Z.signal}${Z.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${Z.tune}<span>${nn(l)}</span></span><span class="dt-and-tabs">1</span>${Z.dotsV}</div>`),Rd=()=>`<div class="dt-and-nav">${Z.recent}${Z.home}${Z.navBack}</div>`,Pd=({now:n,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Fs(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${Z.wifi}${Z.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${Z.sidebar}<button data-nav="back" aria-label="Back" title="Back">${Z.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${Z.fwd}</button></span><span class="dt-ipad-url">${Z.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-bar-group">${Z.share}${Z.plus}${Z.tabs}</span></div>`,Od=({now:n,host:i},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">${Z.wifi}${Z.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Fs(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">${Z.sidebar}<button data-nav="back" aria-label="Back" title="Back">${Z.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${Z.fwd}</button></span><span class="dt-mac-url">${Z.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-bar-group">${Z.share}${Z.plus}${Z.tabs}</span></div>`,Id=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,Dd=({host:n,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${nn(i||n)}</span>${Z.close}</span><span class="dt-win-new">${Z.plus}</span><span class="dt-win-ctrl">${Z.winMin}${Z.winMax}${Z.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${Z.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${Z.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-win-url">${Z.tune}<span>${nn(n)}</span>${Z.star}</span><span class="dt-bar-group">${Z.user}${Z.dotsV}</span></div>`,qd=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,l)=>`<i style="--hue:${200+l*30}"></i>`).join("")}</span><span class="dt-win-tray">${Z.chevUp}${Z.wifi}${Z.volume}${Z.battery}<span class="dt-win-clock">${Go(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function xr(n,i){let l=Td[n.shell](n),u=n.w+2*l.side,p=n.h+l.top+l.bottom,v=u+(l.extraW??0),k=p+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?l.extraH??0:0),H=(v-u)/2+l.side,f=Cd[n.browser](n),$=i.min?f.topMin??f.top:f.top,y=i.min?f.bottomMin??f.bottom:f.bottom,R={...i,d:n},Q="",_="";switch(n.browser){case"safari-ios":Q=Hd(R,$),_=Nd(R,y);break;case"chrome-android":Q=Bd(R,i.host),_=Rd();break;case"safari-ipad":Q=Pd(R),_='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":Q=Od(R,n.shell==="macbook"),_=Id();break;case"chrome-windows":Q=Dd(R),_=qd(R);break}return{footprint:{w:v,h:k},screen:{x:H,y:l.top,w:n.w,h:n.h,r:l.r,rb:l.rb??l.r},topH:$,bottomH:y,shell:Ad(n,l,v,k,H),top:Q,bottom:_,canMinimize:f.topMin!==void 0&&(f.topMin!==f.top||f.bottomMin!==f.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var en=null;function Gn(n){if(en??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!en||!n)return[0,0,0,0];en.clearRect(0,0,1,1),en.fillStyle="rgba(0, 0, 0, 0)",en.fillStyle=n,en.fillRect(0,0,1,1);let[i,l,u,p]=en.getImageData(0,0,1,1).data;return[i,l,u,p/255]}var Un=([n,i,l])=>`rgb(${n}, ${i}, ${l})`;function Er(n){let i=n.defaultView,l=_=>!_||Gn(_)[3]===0,u=[n.body,n.documentElement].map(_=>_&&i.getComputedStyle(_).backgroundColor).find(_=>_&&!l(_)),[p,v,k,H]=u?Gn(u):[255,255,255,1],f=[p,v,k].map(_=>Math.round(_*H+255*(1-H))),$=_=>{let[Y,ht,P,A]=Gn(_);if(A>=.75)return Un([Y,ht,P]);let W=(L,j)=>Math.round(L*A+j*(1-A));return Un([W(Y,f[0]),W(ht,f[1]),W(P,f[2])])},y=_=>{let Y=n.elementFromPoint(i.innerWidth/2,_);for(;Y&&Y!==n.documentElement;Y=Y.parentElement){let ht=i.getComputedStyle(Y);if(ht.position!=="fixed"&&ht.position!=="sticky")continue;let P=Y.getBoundingClientRect().width>=i.innerWidth*.9,A=ht.backdropFilter&&ht.backdropFilter!=="none";return P&&!A&&!l(ht.backgroundColor)?$(ht.backgroundColor):null}return null},R=n.querySelector('meta[name="theme-color"]')?.content||"",Q=R&&!l(R)?Un(Gn(R)):"";return{top:y(4)??Un(f),bottom:y(i.innerHeight-4)??Un(f),theme:Q}}function Yo(n){let[i,l,u]=Gn(n).map(p=>p/255).map(p=>p<=.04045?p/12.92:((p+.055)/1.055)**2.4);return .2126*i+.7152*l+.0722*u>.4?"#000":"#fff"}function Mr(n){let{cfg:i,inFrame:l,persist:u,frame:p,frameEl:v,devicesMenu:k,bpBtns:H,notesOverlay:f,WIDE:$,bpOf:y,currentBp:R,deviceById:Q,notesOn:_,filter:Y,filterTo:ht,dropFrameDrafts:P,putAway:A,tellFrame:W,syncBpButtons:L,render:j,reread:I}=n,rt=i.breakpoints,ot=document.querySelector(".dt-device"),Pt=document.querySelector(".dt-shell"),Ht=document.querySelector('.dt-chrome[data-at="top"]'),St=document.querySelector('.dt-chrome[data-at="bottom"]'),zt=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],pt=document.querySelector(".dt-frame-size"),wt=document.querySelector(".dt-frame-rotate"),Ot=document.querySelector(".dt-frame-bars"),Vt="overlay",w="",m="dt-w",M="dt-canvas",B="dt-device",D=st.getItem(M)==="1",z=st.getItem(B)||"";z&&!Q(z)&&(z="",st.setItem(B,""));let U=Number(st.getItem(m))||0,tt="dt-emu",X=(()=>{try{return JSON.parse(st.getItem(tt)||"null")}catch{return null}})(),at=()=>X?_n.find(x=>x.id===X.id)??null:null,ct=()=>{let x=at();return x?X.turned?{w:x.h,h:x.w}:{w:x.w,h:x.h}:null},kt=st.getItem("dt-bars-min")==="1",Nt=x=>{X=x,u(tt,x?JSON.stringify(x):"")},Bt=x=>{pt.textContent=x,p.style.setProperty("--dt-badge-w",`${pt.offsetWidth}px`)},sn=x=>{if(!x){zt.innerHTML="";return}let T="";for(let O=0;O<=x;O+=50)T+=`<span class="dt-tick${O%200===0?" is-major":""}" style="left:${O}px"></span>`;for(let O of rt)for(let J of[O.min,O.max])J>0&&Number.isFinite(J)&&J<=x&&(T+=`<span class="dt-edge" style="left:${J}px" title="${O.label} edge"></span>`);zt.innerHTML=T,zt.style.width=`${x}px`},fe=()=>{let x=parseFloat(ot.style.width)||0,T=parseFloat(ot.style.height)||0;if(!x||!T){ot.style.transform="",delete ot.dataset.scaled;return}let O=z||X?Math.min(1,(innerWidth-80)/x,(innerHeight-120)/T):Math.min(1,(innerWidth-80)/x);ot.style.transform=O<1?`scale(${O})`:"",ot.dataset.scaled=O<1?String(Math.round(O*100)):""},Kt=x=>_n.find(T=>T.w===x.w&&T.h===x.h&&T.cutout?.shape==="pill")?.cutout,vt=()=>{try{return v.contentDocument}catch{return null}},Oe=()=>vt()?.title.split("\u2014").pop()?.trim()||"",Ae=()=>{let x=vt(),T=z?Q(z):null;if(!x?.body||!T)return;let O=Er(x),J=T.browser==="chrome-android"?O.theme||"rgb(255, 255, 255)":O.top,dt=T.browser==="chrome-android"?"rgb(255, 255, 255)":O.bottom;ot.style.setProperty("--dt-top",J),ot.style.setProperty("--dt-top-ink",Yo(J)),ot.style.setProperty("--dt-bottom",dt),ot.style.setProperty("--dt-bottom-ink",Yo(dt));let _t=Ht.querySelector(".dt-win-tab > span");_t&&(_t.textContent=Oe()||location.host)},Ie=0;v.addEventListener("load",()=>{let x=vt();if(!x)return;let T=window.__notemendHosted;if(T&&!v.contentWindow?.__notemendHosted&&!x.querySelector(`script[src^="${T.base}/bar.js"]`)){let O=x.createElement("script");O.src=`${T.base}/bar.js`,O.dataset.project=T.project,x.head.append(O)}Ae(),v.contentWindow?.addEventListener("scroll",()=>{Ie||(Ie=requestAnimationFrame(()=>{Ie=0,Ae()}))},{passive:!0})});for(let x of[Ht,St])x.addEventListener("click",T=>{let O=T.target.closest("[data-nav]")?.dataset.nav;if(O)try{let J=v.contentWindow?.navigation;if(!vt()||!J)throw new Error("foreign");O==="back"?J.canGoBack&&J.back():O==="fwd"?J.canGoForward&&J.forward():J.reload()}catch{(O==="reload"||O==="back")&&(v.src=location.href)}});Ot.addEventListener("click",()=>{kt=!kt,u("dt-bars-min",kt?"1":"0"),K()});let K=()=>{if(l)return;let x=z?Q(z)??null:null;if(z&&!x&&(z="",st.setItem(B,"")),!x&&!D){p.hidden=!0,v.removeAttribute("src"),Ft.toggle("dt-framing",!1),f.hidden=!_(),zt.innerHTML="",L(),wt.hidden=!0,Ot.hidden=!0,ht(null),w="",P(),L(),S(),I();return}if(p.hidden=!1,Ft.toggle("dt-framing",!0),f.hidden=!0,v.src||(v.src=location.href),x){let T=xr(x,{host:location.host,title:Oe(),now:new Date,min:kt,cutout:Kt(x)}),{screen:O}=T;p.dataset.mode="device",ot.dataset.shell=x.shell,ot.dataset.browser=x.browser,ot.style.width=`${T.footprint.w}px`,ot.style.height=`${T.footprint.h}px`,ot.style.setProperty("--dt-r",`${O.r}px`),ot.style.setProperty("--dt-rb",`${O.rb}px`),Pt.innerHTML=T.shell;let J=(Ut,Tt,an,qe)=>{Ut.innerHTML=qe,Ut.style.cssText=`left:${O.x}px;top:${Tt}px;width:${O.w}px;height:${an}px`};J(Ht,O.y,T.topH,T.top),J(St,O.y+O.h-T.bottomH,T.bottomH,T.bottom);let dt=O.h-T.topH-T.bottomH;v.style.position="absolute",v.style.left=`${O.x}px`,v.style.top=`${O.y+T.topH}px`,v.style.width=`${O.w}px`,v.style.height=`${dt}px`,zt.innerHTML="";let _t=kt&&T.canMinimize;Vt=T.scrollbar,w=`${x.label}${_t?" \xB7 bars folded":""}`,ht(y(x.w)),W({notes:_(),scrollbar:Vt,device:w}),Ot.hidden=!T.canMinimize,Ot.setAttribute("aria-pressed",String(_t)),Bt(`${x.label} \xB7 page ${x.w}\xD7${dt} of ${x.w}\xD7${x.h}${_t?" \xB7 bars folded":""} \xB7 ${rt.find(Ut=>Ut.id===Y())?.label??""}`),Ae()}else{let T=ct();T||Nt(null);let O=T?.w||U||rt.find(_t=>_t.id===R()).ideal;U=O,p.dataset.mode="canvas",delete ot.dataset.shell,delete ot.dataset.browser,Pt.innerHTML=Ht.innerHTML=St.innerHTML="",Ht.style.cssText=St.style.cssText="",Ot.hidden=!0,Vt="overlay",ot.style.width=`${O}px`,ot.style.height=`${T?.h??innerHeight-84}px`,v.style.position="",v.style.left=v.style.top="",v.style.width="100%",v.style.height="100%",sn(O),W({notes:_()});let J=rt.find(_t=>_t.id===y(O)),dt=at();w=dt?`${dt.label}${X?.turned?" \xB7 landscape":""}`:"",W({scrollbar:Vt,device:w}),Bt(dt&&T?`${dt.label} \xB7 ${T.w}\xD7${T.h} \xB7 ${J.label}`:`${O}px \xB7 ${J.label}`),ht(y(O))}wt.hidden=!(at()?.rotates&&!x),S(),fe(),L(),I()},be=x=>{let T=rt.find(O=>O.id===x);z="",st.setItem(B,""),Nt(null),D=!(y(innerWidth)===x||x===$&&innerWidth>=T.min),U=D?T.ideal:0,ht(D?x:null),st.setItem(M,D?"1":"0"),st.setItem(m,String(U)),A(),K()};for(let x of H)x.addEventListener("click",()=>be(x.dataset.bp));for(let x of document.querySelectorAll("[data-device]"))x.addEventListener("click",()=>{z=x.dataset.device===z?"":x.dataset.device,st.setItem(B,z),k.open=!1,K()});for(let x of document.querySelectorAll("[data-emu]"))x.addEventListener("click",()=>{let T=X?.id===x.dataset.emu&&!z;z="",st.setItem(B,""),Nt(T?null:{id:x.dataset.emu,turned:!1}),D=!T,U=0,st.setItem(M,D?"1":"0"),ht(null),A(),k.open=!1,K()});wt.addEventListener("click",()=>{X&&(Nt({...X,turned:!X.turned}),A(),K())});let on=[...k.querySelectorAll("[data-tab]")],Xn=[...k.querySelectorAll("[data-panel]")],G=x=>{for(let T of on)T.setAttribute("aria-selected",String(T.dataset.tab===x));for(let T of Xn)T.hidden=T.dataset.panel!==x;u("dt-devices-tab",x)};for(let x of on)x.addEventListener("click",()=>G(x.dataset.tab));G(st.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let $t=k.querySelector(".dt-emu-search");$t.addEventListener("input",()=>{let x=$t.value.trim().toLowerCase(),T=null,O=!1,J=()=>{T&&(T.hidden=!O)};for(let dt of $t.parentElement.children){if(dt.classList.contains("dt-devices-group")){J(),T=dt,O=!1;continue}dt.dataset.emu&&(dt.hidden=!!x&&!dt.textContent.toLowerCase().includes(x),O||=!dt.hidden)}J()});let nt=k.querySelector(".dt-devices-name");function S(){for(let T of k.querySelectorAll("[data-device]"))T.setAttribute("aria-pressed",String(T.dataset.device===z));let x=!z&&!p.hidden?X?.id:void 0;for(let T of k.querySelectorAll("[data-emu]"))T.setAttribute("aria-pressed",String(T.dataset.emu===x));nt.textContent=z&&Q(z)?.label||x&&at()?.label||"Device"}let De=x=>rt.find(T=>T.id===x),jt=x=>{let T=De(Y()??R());return Math.max(T.min||320,Math.min(Number.isFinite(T.max)?T.max:2560,Math.round(x)))};for(let x of E){let T=x.dataset.edge==="l"?-1:1;x.addEventListener("pointerdown",O=>{if(z)return;O.preventDefault(),X&&(Nt(null),K()),x.setPointerCapture(O.pointerId);let J=O.clientX,dt=U,_t=Number(ot.dataset.scaled||100)/100;p.dataset.dragging="1";let Ut=an=>{U=jt(dt+T*(an.clientX-J)*2/_t),ot.style.width=`${U}px`,sn(U),Bt(`${U}px \xB7 ${De(y(U)).label}`),fe()},Tt=()=>{x.removeEventListener("pointermove",Ut),x.removeEventListener("pointerup",Tt),x.removeEventListener("pointercancel",Tt),delete p.dataset.dragging,st.setItem(m,String(U)),K()};x.addEventListener("pointermove",Ut),x.addEventListener("pointerup",Tt),x.addEventListener("pointercancel",Tt)}),x.addEventListener("dblclick",()=>{if(z)return;Nt(null);let O=De(Y()??R()),J=[O.min||320,Number.isFinite(O.max)?O.max:O.ideal];U=Math.abs(U-J[0])<Math.abs(U-J[1])?J[0]:J[1],st.setItem(m,String(U)),K()})}let Jn=R(),xn=()=>{let x=rt.find(T=>T.id===$);return D&&!z&&!X&&U===x.ideal&&innerWidth>=x.min};return addEventListener("resize",()=>{if(xn()){be($);return}L(),R()!==Jn&&(Jn=R(),j()),p.hidden||(!z&&!X&&(ot.style.height=`${innerHeight-84}px`),fe())}),{apply:K,pickBp:be,look:()=>({scrollbar:Vt,device:w}),restore:()=>{xn()?be($):D||z?K():S()}}}var kr='<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>',Lr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Fd='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Sr(n){let{bp:i,notes:l,breakpoints:u,bandOfNote:p,whoseAgent:v,statusTools:k,showResolved:H,showArchived:f,drafts:$,find:y}=n,R=l.filter(E=>p(E)===i),Q=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(pt=>!pt.deleted).map(pt=>pt.text)].join(" ").toLowerCase(),_=E=>y.view==="me"?n.forMe(E):y.view==="agent"?n.forAgent(E):!0,Y=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,ht=R.filter(E=>_(E)&&(!y.q||Q(E).includes(y.q.trim().toLowerCase()))).sort((E,pt)=>(y.sort==="unread"?Number(n.unread(pt))-Number(n.unread(E)):0)||Y(pt)-Y(E)),P={open:[],claude:[],done:[],archived:[]};for(let E of ht)P[bt(E)==="done"&&n.archived(E)?"archived":bt(E)].push(E);let A=E=>{let pt=(E.replies??[]).filter(D=>!D.deleted),wt=Qe(E.category),Ot=bt(E),Vt=Ot==="claude"&&!n.agentless(E),w=n.orphan(E),m=pt.length?pt[pt.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text},M=(D,z)=>D.by&&z.by?D.by===z.by:D.byName===z.byName,B=n.unread(E);return`<div class="dt-hist-row is-${Ot}${Ot==="done"?n.archived(E)?" is-archived":" is-resolved":""}${w?" is-orphan":""}${B?" is-unread":""}">
|
|
156
168
|
<button class="dt-hist-go" data-go="${E.id}">
|
|
157
169
|
${n.marker(E)}
|
|
158
170
|
<span class="dt-hist-body">
|
|
159
|
-
<span class="dt-hist-id"><b class="dt-hist-who">${
|
|
160
|
-
<span class="dt-hist-text">${
|
|
171
|
+
<span class="dt-hist-id"><b class="dt-hist-who">${g(E.byName||"You")}</b><i class="dt-hist-type" style="color:${wt.color}" data-tip="${g(wt.label)}">${wn(wt)}</i><em>#${E.id>0?E.id:"\u2026"} \xB7 ${Je(E.updatedAt||E.createdAt)}</em>${Vt?`<b class="dt-hist-claude" data-unmark="${E.id}" role="button" tabindex="0" title="To check \u2014 ${g(v(E.doneAgent,E.doneFor))} fixed it \xB7 click to reopen">${Wt(9)}${g(vn(E.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${w?'<b class="dt-hist-orphan" title="The element is not on this page any more">gone</b>':n.hiddenNow(E)?'<b class="dt-hist-orphan is-hidden" title="Inside a menu or a popup that is closed now \u2014 open it and the pin moves onto it">hidden</b>':""}${B?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
|
|
172
|
+
<span class="dt-hist-text">${m.author==="claude"?`<b>${g(v(m.agent,m.by))}:</b> `:pt.length&&!M(m,E)?`<b class="dt-hist-by">${g(m.byName||"Someone")}:</b> `:""}${g(ar(m.text))}</span>
|
|
161
173
|
</span>
|
|
162
174
|
</button>
|
|
163
|
-
<span class="dt-note-tools dt-hist-tools">${n.assign(E)}${
|
|
164
|
-
><button data-rm="${E.id}" title="Delete this comment">${
|
|
165
|
-
</div>`},
|
|
166
|
-
title="${E.label}: ${
|
|
167
|
-
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${
|
|
175
|
+
<span class="dt-note-tools dt-hist-tools">${n.assign(E)}${k(E)}<i class="dt-note-sep"></i
|
|
176
|
+
><button data-rm="${E.id}" title="Delete this comment">${Ze}</button></span>
|
|
177
|
+
</div>`},W=u.find(E=>E.id===i),L=u.map(E=>{let pt=l.filter(wt=>p(wt)===E.id&&bt(wt)!=="done");return{band:E,open:pt.filter(wt=>bt(wt)==="open").length,total:pt.length}}).filter(E=>E.total&&E.band.id!==i),j=L.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${L.map(({band:E,open:pt,total:wt})=>`<button data-bp="${E.id}" data-state="${pt?"open":"claude"}"
|
|
178
|
+
title="${E.label}: ${pt} open \xB7 ${wt-pt} to check"
|
|
179
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${wt}</i></button>`).join("")}</div>`:"",I=["open","claude","done","archived"],rt={...pr,archived:"Archived"},ot=I.filter(E=>P[E].length&&(E==="done"?H:E==="archived"?f:!0)),Pt=E=>`<div class="dt-hist-row is-draft">
|
|
168
180
|
<button class="dt-hist-go" data-draft-go="${E.i}">
|
|
169
|
-
<span class="dt-hist-n">${
|
|
181
|
+
<span class="dt-hist-n">${Vn}</span>
|
|
170
182
|
<span class="dt-hist-body">
|
|
171
|
-
<span class="dt-hist-id">${
|
|
172
|
-
<span class="dt-hist-text">${E.text?
|
|
183
|
+
<span class="dt-hist-id">${g(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>
|
|
184
|
+
<span class="dt-hist-text">${E.text?g(E.text):`${E.shots} screenshot${E.shots===1?"":"s"}`}</span>
|
|
173
185
|
</span>
|
|
174
186
|
</button>
|
|
175
|
-
<span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${
|
|
176
|
-
</div>`,
|
|
177
|
-
<label class="dt-hist-search">${
|
|
178
|
-
<button type="button" class="dt-tip-r dt-hist-filter${y.view!=="all"||y.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${y.menu}" data-tip="Filter">${
|
|
179
|
-
${y.menu?`<div class="dt-hist-menu" role="menu">${
|
|
187
|
+
<span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${Ze}</button></span>
|
|
188
|
+
</div>`,Ht=R.filter(E=>bt(E)!=="done"),St=(E,pt,wt,Ot,Vt)=>`<button type="button" role="menuitemradio" aria-checked="${Ot}" ${E}="${pt}"><i>${Ot?qt:""}</i><span>${wt}</span>${Vt==null?"":`<em>${Vt}</em>`}</button>`,zt=()=>`<div class="dt-hist-find">
|
|
189
|
+
<label class="dt-hist-search">${kr}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${g(y.q)}" spellcheck="false">${y.q?`<button type="button" data-hist-clear aria-label="Clear search">${Pe}</button>`:""}</label>
|
|
190
|
+
<button type="button" class="dt-tip-r dt-hist-filter${y.view!=="all"||y.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${y.menu}" data-tip="Filter">${Fd}</button>
|
|
191
|
+
${y.menu?`<div class="dt-hist-menu" role="menu">${St("data-hist-view","me","For me",y.view==="me",Ht.filter(n.forMe).length)}${St("data-hist-view","agent","Agent",y.view==="agent",Ht.filter(n.forAgent).length)}${St("data-hist-view","all","All",y.view==="all",Ht.length)}<hr>${St("data-hist-sort","new","Newest",y.sort==="new")}${St("data-hist-sort","unread","Unread first",y.sort==="unread")}</div>`:""}
|
|
180
192
|
</div>`;return`<div class="dt-hist-head">
|
|
181
|
-
<span class="dt-hist-here" title="${
|
|
182
|
-
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${
|
|
193
|
+
<span class="dt-hist-here" title="${W?.label??i}"
|
|
194
|
+
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${W?.icon??""}</svg></span>
|
|
183
195
|
<span class="dt-hist-title">Threads</span>
|
|
184
|
-
${
|
|
185
|
-
${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">${
|
|
196
|
+
${j}
|
|
197
|
+
${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">${qt}${n.checks}</button>`:""}
|
|
186
198
|
<button class="dt-hist-refresh" data-refresh aria-label="Load the latest comments">
|
|
187
199
|
<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>
|
|
188
200
|
</button>
|
|
189
201
|
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
|
|
190
202
|
<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>
|
|
191
203
|
</button>
|
|
192
|
-
</div>`+
|
|
193
|
-
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${
|
|
204
|
+
</div>`+zt()+(ot.length||$.length?`<div class="dt-hist-list">${$.length?`<p class="dt-hist-group">Drafts<em>${$.length}</em></p>${$.map(Pt).join("")}`:""}${ot.map(E=>`<p class="dt-hist-group">${rt[E]}<em>${P[E].length}</em>${E==="done"&&n.archives?`<button type="button" class="dt-tip-r dt-hist-archive-all" data-archive-all="${P.done.map(pt=>pt.id).join(",")}" data-tip="Archive every resolved thread here">${Lr}Archive all</button>`:""}</p>`+P[E].map(A).join("")).join("")}</div>`:y.q.trim()?`<div class="dt-hist-empty">${kr}<p>No comments match \xAB${g(y.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:y.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">${P.done.length||P.archived.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">
|
|
205
|
+
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${H}"
|
|
194
206
|
><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
|
|
195
207
|
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
196
|
-
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${
|
|
197
|
-
>${
|
|
198
|
-
</div>`}function
|
|
199
|
-
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${
|
|
200
|
-
<span class="dt-review-n">${
|
|
201
|
-
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${
|
|
202
|
-
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${
|
|
203
|
-
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${
|
|
204
|
-
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Te}</button>`,T.hidden=!1};T.addEventListener("click",async j=>{let tt=j.target.closest("[data-r]"),ut=k();if(!tt||!ut)return;if(tt.dataset.r==="stop"){f(null),T.hidden=!0;return}if(tt.dataset.r==="prev"){gt();return}let bt=ut.ids[ut.i];f({...ut,i:ut.i+1});let st=d().find(Tt=>Tt.id===bt),ne=tt.dataset.r==="ok"&&st?L(st):tt.dataset.r==="no"?x(bt,!1):null;V(),await ne});let gt=()=>{let j=k();if(j){for(let tt=j.i-1;tt>=0;tt--)if(y(j.ids[tt])){f({...j,i:tt}),V();return}}};return document.addEventListener("keydown",j=>{T.hidden||j.metaKey||j.ctrlKey||j.altKey||j.key!=="ArrowLeft"&&j.key!=="ArrowRight"||j.target.closest?.("input, textarea, select, [contenteditable]")||(j.preventDefault(),j.key==="ArrowLeft"?gt():T.querySelector('[data-r="skip"]')?.click())}),{start:et,toCheck:F,resume:()=>{k()&&V()}}}function Ni(n,r){let d=null,g=null,h=document.querySelector(".dt-turbo"),x="/notemend:turbo",S=()=>{let B=!!d&&Date.now()-Date.parse(d.at)<18e4,v=B?d.mode==="push"?"push":g?.paused?"paused":"on":"none",L=B?on(d.agent):"",y=v==="none"?`Turbo is off. Run ${x} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:v==="push"?`Push mode: ${L} takes comments when you press Push to Claude. For live, run ${x} instead`:v==="on"?`Turbo on: ${L} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${L} is listening but waits \u2014 click to resume`;h.dataset.state=v,h.dataset.tip=y,h.setAttribute("aria-label",y),h.setAttribute("aria-checked",String(v==="on")),n&&(h.hidden=!0)};return setInterval(S,3e4),h.addEventListener("click",async()=>{let B=h.dataset.state;if(B==="none"||B==="push"){await navigator.clipboard?.writeText(x).catch(()=>{}),r(`Copied ${x} \u2014 paste it in Claude Code`);return}let v=B==="on"?"off":"on";g={paused:v==="off"},S();try{let L=await Lt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:v})});if(!L.ok)throw new Error(String(L.status));r(v==="off"?"Turbo paused":"Turbo on")}catch{g={paused:v==="on"},S(),r("Could not switch turbo \u2014 try again")}}),B=>{d=B.listening??null,g=B.turbo??null,S()}}function Ri(n,r){let d=n.breakpoints,g=n.categories,h=(d.find(t=>!Number.isFinite(t.max))??d[0]).id,x=t=>d.find(e=>t>=e.min&&t<=e.max)?.id??h,S=t=>t.breakpoint||h,B=t=>n.devices.find(e=>e.id===t),v=as,L=(t,e)=>{v||nt.setItem(t,e)},y=t=>Lt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),N=t=>t.replace(/\/+$/,"")||"/",k=N(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 f=document.querySelector(".dt-grid-btn"),T=document.querySelector(".dt-grid-overlay"),F="dt-grid",et=()=>{let t=T.querySelector(".dt-overlay-grid");if(T.classList.remove("is-auto"),getComputedStyle(t).display==="grid")return;let e=0,s=0;for(let o of[...document.body.querySelectorAll("*")].slice(0,600)){if(o.closest(Me))continue;let a=getComputedStyle(o);if(a.maxWidth==="none"||a.marginLeft!==a.marginRight||parseFloat(a.marginLeft)<=0)continue;let i=o.getBoundingClientRect();i.width>e&&(e=i.width,s=i.left)}e||(s=24,e=innerWidth-48),T.classList.add("is-auto"),T.style.setProperty("--grid-x",`${s}px`),T.style.setProperty("--grid-w",`${e}px`),T.style.setProperty("--grid-gap",innerWidth<768?"16px":"24px")},V=t=>{T.hidden=!t,t&&et(),f.setAttribute("aria-pressed",String(t)),L(F,t?"1":"0"),Qt({grid:t})};f.addEventListener("click",()=>V(T.hidden===!0)),addEventListener("resize",()=>{T.hidden||et()});let gt=document.querySelector(".dt-pages-name"),j=()=>{let t=null;for(let i of document.querySelectorAll(".dt-pages a"))N(new URL(i.href).pathname)===k?(i.setAttribute("aria-current","page"),t=i):i.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),o=t?.querySelector(".dt-menu-label")?.textContent?.trim()||e||gt.textContent||"",a=o.trim().split(/\s+/);gt.textContent=a.length>3?`${a.slice(0,3).join(" ")}\u2026`:o,gt.title=a.length>3?o:""};j();let tt=[...document.querySelectorAll(".devtools details")],ut=!1,bt=()=>{let t=tt.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]=bt();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{ut=tt.some(e=>e.open&&!e.contains(t.target))&&bt().length>0},!0),addEventListener("blur",bt);let st=document.querySelector(".dt-pad-overlay"),ne="dt-inspect",Tt=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),Mt=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),_t={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")},E="",it=0,{spacer:ft,drawPads:Nt,drawSize:Wt,drawType:w,drawColor:c,drawBorder:$}=xi(st),H=t=>{it||(it=requestAnimationFrame(()=>{it=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Tt)){st.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),E==="sizes"?Wt(e):E==="type"?w(e):E==="color"?c(e):E==="border"?$(e):Nt(t.altKey?e:ft(e))}))},R=t=>{E=t;for(let[e,s]of Object.entries(_t))s.setAttribute("aria-pressed",String(e===t));L(ne,t),Qt({inspect:t}),st.hidden=!t,st.innerHTML="",t?document.addEventListener("mousemove",H):document.removeEventListener("mousemove",H)};for(let[t,e]of Object.entries(_t))e.addEventListener("click",()=>{t!==E&&$e(!1),R(E===t?"":t)});let D=document.querySelector(".dt-notes-btn"),W=[...document.querySelectorAll(".dt-bp")],U=document.querySelector(".dt-history-btn"),I=document.querySelector(".dt-history"),Z=document.querySelector(".dt-studio-btn"),kt=document.querySelector(".dt-devices"),pt=document.querySelector(".dt-notes-hi"),qt=pt.querySelector(".dt-hi-box"),se=pt.querySelector(".dt-hi-tag"),Yt=document.querySelector(".dt-frame"),wt=document.createElement("div");wt.className="dt-spot",wt.hidden=!0,wt.setAttribute("aria-hidden","true"),document.body.append(wt);let Ce=t=>{if(!t||!At){wt.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;wt.style.setProperty("--spot-x",`${e.left-s}px`),wt.style.setProperty("--spot-y",`${e.top-s}px`),wt.style.setProperty("--spot-w",`${e.width+s*2}px`),wt.style.setProperty("--spot-h",`${e.height+s*2}px`),wt.hidden&&(pt.hidden=!0),wt.hidden=!1},Rt=Yt.querySelector("iframe"),be=document.querySelector(".dt-notes-count"),X=document.querySelector(".dt-notes-overlay"),Me=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame",Ft=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(Me).forEach(Ft);let rn="dt-notes",K=[],At=!1,Q=null,A=null,ln=0,Pt="",xt=[],ht=null,Ct=[],M=10,C=(t=A)=>!!(t&&((t.text?.trim().length??0)>=M||t.images?.length)),P=()=>{A&&C()&&Ct.push(A),A=null},at=0,ct=()=>{if(!C()||performance.now()-at<4e3)return!0;at=performance.now();let t=X.querySelector(".dt-note[data-draft]");return t&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&t.animate([0,-6,6,-4,4,0].map(e=>({transform:`translateX(${e}px)`})),{duration:320,easing:"ease-out",composite:"add"}),t?.querySelector(".dt-note-input")?.focus(),Ht("Not sent \u2014 close again to keep it as a draft",2400),!1},Et=null,oe=null,fe=()=>`dt-draft:${n.me?.email??""}:${k}${v?":canvas":""}`,de=fe(),Ke=0,us=()=>{if(!A&&!Ct.length&&!Pt){nt.removeItem(de);return}let t={draft:A,parked:Ct,reply:Pt?{for:Et,text:Pt}:null};try{localStorage.setItem(de,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(de,JSON.stringify({...t,draft:A&&e(A),parked:Ct.map(e)}))}catch{}}},dn=()=>{clearTimeout(Ke),Ke=setTimeout(us,200)};addEventListener("pagehide",()=>{clearTimeout(Ke),us()});let Ue=nt.getItem("dt-space")==="clients"?"clients":"studio",Ge=()=>!!n.me&&!n.client,cn=t=>!Ge()||Ue==="clients"===$t(t),Cn=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,ae=nt.getItem("dt-resolved")!=="0",ke=nt.getItem("dt-archived")==="1",ie=t=>pi(t,n.autoArchive),Di=t=>mt(t)!=="done"||(ie(t)?ke:ae),zt={q:"",menu:!1,view:["me","agent"].includes(nt.getItem("dt-view")??"")?nt.getItem("dt-view"):"all",sort:nt.getItem("dt-sort")==="unread"?"unread":"new"},qi=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Fi=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],ji=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),s=e(qi),o=e(Fi),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ps=()=>x(innerWidth),Le=()=>oe??ps(),fo=()=>{let t=Le();for(let e of W)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:yo,poolOf:vo,contextOf:wo,resolveEl:_i,anchorOf:Wi}=Ei(),hs=new WeakMap,$o=()=>{hs=new WeakMap},ce=t=>{let e=hs.get(t);return(e===void 0||e&&!e.isConnected)&&(e=_i(t),hs.set(t,e)),e},Hn=new Map,Xt=t=>{Hn.size||requestAnimationFrame(()=>Hn.clear());let e=Hn.get(t);return e===void 0&&(e=Wi(t,ce(t)),Hn.set(t,e)),e},xo=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},Bn=[],ms=t=>{for(let e of Bn)e.play();Bn=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),Bn.push(s))},gs=()=>{if(A)return ce(A);let t=Q!=null?K.find(s=>s.id===Q):null;if(!t)return null;let e=Xt(t);return e&&!e.off&&!e.hidden?ce(t):null},bs="claude",zi=()=>(n.team??[]).filter(t=>t.email!==n.me?.email),He=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...zi()],Eo='<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>',Mo=(t,e,s=!1)=>{let o=St(t)?"agent":t?"person":"nobody",a=un(o==="person"?t:fs()),i=[["person",a?Rn(a.avatar_url,a.name||a.email):ks,o==="person"?`${Ye(t)==="you"?"You":Ye(t)} \u2014 pick someone else`:a?`Give it to ${a.email===n.me?.email?"me":a.name||a.email}`:"A person"],["nobody",Eo,"Anyone \u2014 nobody has taken it yet"],["agent",ee(12),s?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],l=e!=null?K.find(b=>b.id===e):void 0,m=o==="agent"&&l?ws[le(l)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${m?` style="--step-c:${m}"`:""}>${i.filter(([b])=>b!=="person"||o==="person"||He().length).map(([b,O,_])=>b===o?`<span class="dt-hand-stop dt-hand-stop--${b} is-on" role="radio" aria-checked="true" data-tip="${p(_)}" aria-label="${p(_)}">${b==="person"?Yi(t,e):O}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${b}" role="radio" aria-checked="false" data-act="hand" data-v="${b}"${e?` data-id="${e}"`:""} data-tip="${p(_)}" aria-label="${p(_)}"${b==="agent"&&s?" disabled":""}>${O}</button>`).join("")}</span>`},fs=()=>{let t=Ki();return t&&!St(t)&&He().some(e=>e.email===t)?t:He()[0]?.email??""},Vi=()=>{let t=X.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},ko="cubic-bezier(0.32, 0.72, 0, 1)",Lo=t=>{let e=X.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),X.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()),qs=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:ko});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:ko});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"})},So=(t,e)=>{let s=qs>performance.now()?void 0:Vi(),o=e==="agent"?bs:e==="person"?fs():e==="me"?n.me?.email??"":"";if(!t){if(!A)return;A.assignee=o,A.stage=St(o)?"approved":!A.stage||A.stage==="approved"?"new":A.stage,e==="person"&&nt.setItem("nm-for",o),vs(o),dn(),J(),Lo(s);return}ys(t,o),Lo(s)},ys=(t,e)=>{let s=K.find(i=>i.id===t);if(s&&Fe(s)&&!St(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?Gt(s):"new",a=St(e)?"approved":o==="approved"?"new":o;Jt(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>y({id:t,assignee:e||null,stage:a}),St(e)?"Approving it for the agent":"Reassigning")},Ki=()=>nt.getItem("nm-for")??"",vs=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e!==null&&(e===""||e===bs||He().some(s=>s.email===e))?e:null}catch{return null}},Nn=t=>St(t)?"#d97757":t?"#0d99ff":"#717171",Ye=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],un=t=>t?n.team?.find(e=>e.email===t):void 0,To=t=>{let e=Dt(t??"").split(/\s+/).filter(Boolean);return p(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},Rn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${p(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${To(e)}</b>`,Ao=t=>{let e=un(t.by);return e||t.byName?Rn(e?.avatar_url,e?.name||t.byName||t.by):""},Co=t=>`var(--dt-avatar-${[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,ws={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Xe=(()=>{try{return JSON.parse(nt.getItem("dt-seen")||"{}")}catch{return{}}})(),Ho=()=>L("dt-seen",JSON.stringify(Xe)),Bo=t=>{let e=qe(t);if(!(t.id in Xe))return Xe[t.id]=e.length,Ho(),!1;let s=e[e.length-1];return e.length>Xe[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},Ui=t=>{let e=qe(t).length;Xe[t.id]!==e&&(Xe[t.id]=e,Ho())},$s=t=>{let e=un(t);return e?` data-face="${p(e.avatar_url??"")}" data-initial="${To(e.name||e.email)}"`:""},No=t=>n.client||Vt()||$t(t)||mt(t)==="done"?"":`<span class="dt-hist-hand">${Mo(t.assignee??"",t.id)}</span>`,Be=(t,e)=>on(t),Ro=t=>{let e=un(t);return e?Rn(e.avatar_url,e.name||e.email):""},Gi=t=>{let e=un(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${p(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${ee(12)}</b>`},Yi=(t,e)=>{let s=(a,i)=>`<option value="${p(a)}" data-c="${Nn(a)}"${$s(a||null)}${t===a?" selected":""}>${p(i)}</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:${Nn(t)}">${Ro(t||null)||ks}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
|
|
208
|
+
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${f}"
|
|
209
|
+
>${Lr}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
210
|
+
</div>`}function Tr(n){let{inFrame:i,everything:l,route:u,open:p,settle:v,keepIn:k,toast:H,waits:f,approve:$}=n,y=L=>{let j=l().find(I=>I.id===L);return!!j&&f(j)},R="nm-review",Q=()=>{try{return JSON.parse(sessionStorage.getItem(R)||"null")}catch{return null}},_=L=>{try{L?sessionStorage.setItem(R,JSON.stringify(L)):sessionStorage.removeItem(R)}catch{}},Y=document.createElement("div");Y.className="dt-review",Y.setAttribute("role","region"),Y.setAttribute("aria-label","Checking fixes"),Y.hidden=!0,k(Y),i||document.body.append(Y);let ht=()=>l().filter(f),P=()=>{let L=ht().sort((j,I)=>+(I.route===u())-+(j.route===u())||String(j.route).localeCompare(String(I.route))||j.id-I.id).map(j=>j.id);L.length&&(_({ids:L,i:0}),A())},A=()=>{let L=Q();if(!L||i){Y.hidden=!0;return}for(;L.i<L.ids.length&&!y(L.ids[L.i]);)L.i++;if(L.i>=L.ids.length){_(null),Y.hidden=!0,H("Every fix is checked.");return}_(L);let j=l().find(rt=>rt.id===L.ids[L.i]);if(j.route&&j.route!==u()){location.assign(j.route+location.search);return}p(j);let I=L.ids.slice(0,L.i).some(y);Y.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
211
|
+
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${I?"":" disabled"}>${lr}</button>
|
|
212
|
+
<span class="dt-review-n">${L.i+1} of ${L.ids.length}</span>
|
|
213
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${dr}</button></span>
|
|
214
|
+
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${qt}</button>
|
|
215
|
+
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${Te}</button>
|
|
216
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Pe}</button>`,Y.hidden=!1};Y.addEventListener("click",async L=>{let j=L.target.closest("[data-r]"),I=Q();if(!j||!I)return;if(j.dataset.r==="stop"){_(null),Y.hidden=!0;return}if(j.dataset.r==="prev"){W();return}let rt=I.ids[I.i];_({...I,i:I.i+1});let ot=l().find(Ht=>Ht.id===rt),Pt=j.dataset.r==="ok"&&ot?$(ot):j.dataset.r==="no"?v(rt,!1):null;A(),await Pt});let W=()=>{let L=Q();if(L){for(let j=L.i-1;j>=0;j--)if(y(L.ids[j])){_({...L,i:j}),A();return}}};return document.addEventListener("keydown",L=>{Y.hidden||L.metaKey||L.ctrlKey||L.altKey||L.key!=="ArrowLeft"&&L.key!=="ArrowRight"||L.target.closest?.("input, textarea, select, [contenteditable]")||(L.preventDefault(),L.key==="ArrowLeft"?W():Y.querySelector('[data-r="skip"]')?.click())}),{start:P,toCheck:ht,resume:()=>{Q()&&A()}}}function Ar(n,i){let l=null,u=null,p=document.querySelector(".dt-turbo"),v="/notemend:turbo",k=()=>{let H=!!l&&Date.now()-Date.parse(l.at)<18e4,f=H?l.mode==="push"?"push":u?.paused?"paused":"on":"none",$=H?vn(l.agent):"",y=f==="none"?`Turbo is off. Run ${v} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:f==="push"?`Push mode: ${$} takes comments when you press Push to Claude. For live, run ${v} instead`:f==="on"?`Turbo on: ${$} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${$} is listening but waits \u2014 click to resume`;p.dataset.state=f,p.dataset.tip=y,p.setAttribute("aria-label",y),p.setAttribute("aria-checked",String(f==="on")),n&&(p.hidden=!0)};return setInterval(k,3e4),p.addEventListener("click",async()=>{let H=p.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(v).catch(()=>{}),i(`Copied ${v} \u2014 paste it in Claude Code`);return}let f=H==="on"?"off":"on";u={paused:f==="off"},k();try{let $=await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:f})});if(!$.ok)throw new Error(String($.status));i(f==="off"?"Turbo paused":"Turbo on")}catch{u={paused:f==="on"},k(),i("Could not switch turbo \u2014 try again")}}),H=>{l=H.listening??null,u=H.turbo??null,k()}}var jd=new Set(["data-wired"]),Yn=n=>{if(!(n instanceof Element))return null;let i=n.dataset;return i.msg?`m:${i.msg}`:i.id?`${n.tagName}:${n.classList[0]??""}:${i.id}`:"draft"in i?`${n.tagName}:draft`:i.parked?`${n.tagName}:parked:${i.parked}`:null},Cr=(n,i)=>n.nodeType===i.nodeType&&n.nodeName===i.nodeName&&Yn(n)===Yn(i);function _d(n,i){for(let{name:l}of[...n.attributes])!i.hasAttribute(l)&&!jd.has(l)&&n.removeAttribute(l);for(let{name:l,value:u}of i.attributes)n.getAttribute(l)!==u&&n.setAttribute(l,u);n instanceof HTMLInputElement&&i instanceof HTMLInputElement&&(n.checked!==i.checked&&(n.checked=i.checked),n!==document.activeElement&&n.value!==i.value&&(n.value=i.value))}function Hr(n,i){let l=[...n.childNodes],u=new Map;for(let f of l){let $=Yn(f);$&&u.set($,f)}let p=new Set,v=0,k=[];for(let f of[...i.childNodes]){let $=Yn(f),y=$?u.get($):void 0;if(!$){for(;v<l.length&&(p.has(l[v])||Yn(l[v]));)v++;v<l.length&&Cr(l[v],f)&&(y=l[v++])}y&&!p.has(y)&&Cr(y,f)?(p.add(y),Wd(y,f),k.push(y)):k.push(f)}for(let f of l)p.has(f)||n.removeChild(f);let H=n.firstChild;for(let f of k){if(f===H){H=H.nextSibling;continue}n.insertBefore(f,H)}}function Wd(n,i){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==i.nodeValue&&(n.nodeValue=i.nodeValue);return}if(!(!(n instanceof Element)||!(i instanceof Element))){if(_d(n,i),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==i.value&&(n.value=i.value);return}if(n instanceof SVGElement){n.innerHTML!==i.innerHTML&&(n.innerHTML=i.innerHTML);return}Hr(n,i),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==i.value&&(n.value=i.value)}}function Xo(n,i){let l=document.createElement("template");l.innerHTML=i,Hr(n,l.content)}function Nr(n,i){let l=n.breakpoints,u=n.categories,p=(l.find(t=>!Number.isFinite(t.max))??l[0]).id,v=t=>l.find(e=>t>=e.min&&t<=e.max)?.id??p,k=t=>t.breakpoint||p,H=t=>n.devices.find(e=>e.id===t),f=Ns,$=(t,e)=>{f||st.setItem(t,e)},y=t=>Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),R=t=>t.replace(/\/+$/,"")||"/",Q=R(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 _=document.querySelector(".dt-grid-btn"),Y=document.querySelector(".dt-grid-overlay"),ht="dt-grid",P=()=>{let t=Y.querySelector(".dt-overlay-grid");if(Y.classList.remove("is-auto"),getComputedStyle(t).display==="grid")return;let e=0,s=0;for(let o of[...document.body.querySelectorAll("*")].slice(0,600)){if(o.closest(be)||getComputedStyle(o).maxWidth==="none")continue;let a=o.getBoundingClientRect();a.left<=0||Math.abs(a.left-(document.documentElement.clientWidth-a.right))>2||a.width>e&&(e=a.width,s=a.left)}e||(s=24,e=innerWidth-48),Y.classList.add("is-auto"),Y.style.setProperty("--grid-x",`${s}px`),Y.style.setProperty("--grid-w",`${e}px`),Y.style.setProperty("--grid-gap",innerWidth<768?"16px":"24px")},A=t=>{Y.hidden=!t,t&&P(),_.setAttribute("aria-pressed",String(t)),$(ht,t?"1":"0"),ee({grid:t})};_.addEventListener("click",()=>A(Y.hidden===!0)),addEventListener("resize",()=>{Y.hidden||P()});let W=document.querySelector(".dt-pages-name"),L=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))R(new URL(r.href).pathname)===Q?(r.setAttribute("aria-current","page"),t=r):r.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),o=t?.querySelector(".dt-menu-label")?.textContent?.trim()||e||W.textContent||"",a=o.trim().split(/\s+/);W.textContent=a.length>3?`${a.slice(0,3).join(" ")}\u2026`:o,a.length>3?W.title=o:W.removeAttribute("title")};L();let j=[...document.querySelectorAll(".devtools details")],I=!1,rt=()=>{let t=j.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]=rt();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{I=j.some(e=>e.open&&!e.contains(t.target))&&rt().length>0},!0),addEventListener("blur",rt);let ot=document.querySelector(".dt-pad-overlay"),Pt="dt-inspect",Ht=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),St=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),zt={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")},E="",pt=0,{spacer:wt,drawPads:Ot,drawSize:Vt,drawType:w,drawColor:m,drawBorder:M}=br(ot),B=null,D=()=>{B&&E&&z(B)},z=t=>{B=t,!pt&&(pt=requestAnimationFrame(()=>{pt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Ht)){ot.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),E==="sizes"?Vt(e):E==="type"?w(e):E==="color"?m(e):E==="border"?M(e):Ot(t.altKey?e:wt(e))}))},U=t=>{E=t;for(let[e,s]of Object.entries(zt))s.setAttribute("aria-pressed",String(e===t));$(Pt,t),ee({inspect:t}),ot.hidden=!t,ot.innerHTML="",t?(document.addEventListener("mousemove",z),addEventListener("scroll",D,!0)):(document.removeEventListener("mousemove",z),removeEventListener("scroll",D,!0))};for(let[t,e]of Object.entries(zt))e.addEventListener("click",()=>{t!==E&&he(!1),U(E===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||$t)return;let e=t.target;e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??"")||(E?(U(""),t.preventDefault()):Y.hidden||(A(!1),t.preventDefault()))});let tt=document.querySelector(".dt-notes-btn"),X=[...document.querySelectorAll(".dt-bp")],at=document.querySelector(".dt-history-btn"),ct=document.querySelector(".dt-history"),kt=document.querySelector(".dt-studio-btn"),Nt=document.querySelector(".dt-devices"),Bt=document.querySelector(".dt-notes-hi"),sn=Bt.querySelector(".dt-hi-box"),fe=Bt.querySelector(".dt-hi-tag"),Kt=document.querySelector(".dt-frame"),vt=document.createElement("div");vt.className="dt-spot",vt.hidden=!0,vt.setAttribute("aria-hidden","true"),document.body.append(vt);let Oe=t=>{if(!t||!$t){vt.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;vt.style.setProperty("--spot-x",`${e.left-s}px`),vt.style.setProperty("--spot-y",`${e.top-s}px`),vt.style.setProperty("--spot-w",`${e.width+s*2}px`),vt.style.setProperty("--spot-h",`${e.height+s*2}px`),vt.hidden&&(Bt.hidden=!0),vt.hidden=!1},Ae=Kt.querySelector("iframe"),Ie=document.querySelector(".dt-notes-count"),K=document.querySelector(".dt-notes-overlay"),be=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",on=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(be).forEach(on);let Xn="dt-notes",G=[],$t=!1,nt=null,S=null,De=0,jt="",Jn=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!qs(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let r=getComputedStyle(a).position;if(r==="fixed"||r==="sticky")return!a.contains(t)}return!1},xn=new WeakSet,x=null,T={};K.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete T[s.dataset.id],s.remove())},!0);let O=[],J=null,dt=[],_t=10,Ut=(t=S)=>!!(t&&((t.text?.trim().length??0)>=_t||t.images?.length)),Tt=()=>{S&&Ut()&&dt.push(S),S=null},an=0,qe=()=>{if(!Ut()||performance.now()-an<4e3)return!0;an=performance.now();let t=K.querySelector(".dt-note[data-draft]");return t&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&t.animate([0,-6,6,-4,4,0].map(e=>({transform:`translateX(${e}px)`})),{duration:320,easing:"ease-out",composite:"add"}),t?.querySelector(".dt-note-input")?.focus(),Lt("Not sent \u2014 close again to keep it as a draft",2400),!1},rn=null,js=null,Jo=()=>`dt-draft:${n.me?.email??""}:${Q}${f?":canvas":""}`,ln=Jo(),Zn=0,En=()=>{if(!S&&!dt.length&&!jt){st.removeItem(ln);return}let t={draft:S,parked:dt,reply:jt?{for:rn,text:jt}:null};try{localStorage.setItem(ln,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(ln,JSON.stringify({...t,draft:S&&e(S),parked:dt.map(e)}))}catch{}}},Mn=()=>{clearTimeout(Zn),Zn=setTimeout(En,200)};addEventListener("pagehide",()=>{clearTimeout(Zn),En()});let ye=st.getItem("dt-space")==="clients"?"clients":"studio",Ce=()=>!!n.me&&!n.client,dn=t=>!Ce()||ye==="clients"===Mt(t),Zo=["all","nobody","mine","others","claude","wrote","check"],le=Zo.find(t=>t===st.getItem("dt-pinf"))??"all",_s=()=>{},Qn=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Zt=st.getItem("dt-resolved")!=="0",ve=st.getItem("dt-archived")==="1",oe=t=>rr(t,n.autoArchive),Qo=t=>oe(t)?ve:bt(t)!=="done"||Zt,Gt={q:"",menu:!1,view:["me","agent"].includes(st.getItem("dt-view")??"")?st.getItem("dt-view"):"all",sort:st.getItem("dt-sort")==="unread"?"unread":"new"},Or=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Ir=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Dr=()=>{let t=navigator.userAgent,e=r=>r.find(([d])=>d.test(t)),s=e(Or),o=e(Ir),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},Ws=()=>v(innerWidth),we=()=>js??Ws(),ta=()=>{let t=we();for(let e of X)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ea,poolOf:na,contextOf:sa,resolveEl:qr,anchorOf:Fr}=vr(),zs=new Map,oa=()=>{zs=new Map},de=t=>{let e=JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth]),s=zs.get(e);return(s===void 0||s&&!s.isConnected)&&(s=qr(t),zs.set(e,s)),s},ts=new Map,Qt=t=>{ts.size||requestAnimationFrame(()=>ts.clear());let e=ts.get(t);return e===void 0&&(e=Fr(t,de(t)),ts.set(t,e)),e},aa=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},es=[],Vs=t=>{for(let e of es)e.play();es=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),es.push(s))},Ks=()=>{if(S)return de(S);let t=nt!=null?G.find(s=>s.id===nt):null;if(!t)return null;let e=Qt(t);return e&&!e.off&&!e.hidden?de(t):null},Us="claude",ia=()=>n.client||It()||ye==="clients"?n.team??[]:is(),jr=()=>ia().filter(t=>t.email!==n.me?.email),Fe=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...jr()],ra='<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=At(t)?"agent":t?"person":"nobody",a=$e(o==="person"?t:Gs()),r=[["person",a?cn(a.avatar_url,a.name||a.email):no,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",ra,"Anyone \u2014 nobody has taken it yet"],["agent",Wt(12),s?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],d=e!=null?G.find(h=>h.id===e):void 0,b=o==="agent"&&d?Zs[se(d)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${b?` style="--step-c:${b}"`:""}>${r.filter(([h])=>h!=="person"||o==="person"||Fe().length).map(([h,N,V])=>h===o?`<span class="dt-hand-stop dt-hand-stop--${h} is-on" role="radio" aria-checked="true" data-tip="${g(V)}" aria-label="${g(V)}">${h==="person"?Kr(t,e):N}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${h}" role="radio" aria-checked="false" data-act="hand" data-v="${h}"${e?` data-id="${e}"`:""} data-tip="${g(V)}" aria-label="${g(V)}"${h==="agent"&&s?" disabled":""}>${N}</button>`).join("")}</span>`},Gs=()=>{let t=Wr();return t&&!At(t)&&Fe().some(e=>e.email===t)?t:Fe()[0]?.email??""},_r=()=>{let t=K.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},da="cubic-bezier(0.32, 0.72, 0, 1)",ca=t=>{let e=K.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),K.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()),fo=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:da});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:da});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"})},ua=(t,e)=>{let s=fo>performance.now()?void 0:_r(),o=e==="agent"?Us:e==="person"?Gs():e==="me"?n.me?.email??"":"";if(!t){if(!S)return;S.assignee=o,S.stage=At(o)?"approved":!S.stage||S.stage==="approved"?"new":S.stage,e==="person"&&st.setItem("nm-for",o),Xs(o),Mn(),et(),ca(s);return}Ys(t,o),ca(s)},Ys=(t,e)=>{let s=G.find(r=>r.id===t);if(s&&Re(s)&&!At(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?Jt(s):"new",a=At(e)?"approved":o==="approved"?"new":o;te(r=>r.map(d=>d.id===t?{...d,assignee:e||void 0,stage:a}:d),()=>y({id:t,assignee:e||null,stage:a}),At(e)?"Approving it for the agent":"Reassigning")},Wr=()=>st.getItem("nm-for")??"",Xs=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e!==null&&(e===""||e===Us||Fe().some(s=>s.email===e))?e:null}catch{return null}},ns=t=>At(t)?"#d97757":t?"#0d99ff":"#717171",je=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],$e=t=>t?n.team?.find(e=>e.email===t):void 0,pa=t=>{let e=Rt(t??"").split(/\s+/).filter(Boolean);return g(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},cn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${g(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${pa(e)}</b>`,ha=t=>{let e=$e(t.by);return e||t.byName?cn(e?.avatar_url,e?.name||t.byName||t.by):""},kn=t=>`var(--dt-avatar-${[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,ma=(t,e)=>{let s=$e(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return cn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${kn(t)}" `)},Js=(t,e)=>$e(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Zs={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},_e=(()=>{try{return JSON.parse(st.getItem("dt-seen")||"{}")}catch{return{}}})(),ga=()=>$("dt-seen",JSON.stringify(_e)),Qs=t=>{let e=Se(t);if(!(t.id in _e))return _e[t.id]=e.length,ga(),!1;let s=e[e.length-1];return e.length>_e[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},zr=t=>{let e=Se(t).length;_e[t.id]!==e&&(_e[t.id]=e,ga())},to=t=>{let e=$e(t);return e?` data-face="${g(e.avatar_url??"")}" data-initial="${pa(e.name||e.email)}"`:""},fa=t=>n.client||It()||Mt(t)||bt(t)==="done"?"":`<span class="dt-hist-hand">${la(t.assignee??"",t.id)}</span>`,We=(t,e)=>vn(t),ba=t=>{let e=$e(t);return e?cn(e.avatar_url,e.name||e.email):""},Vr=t=>{let e=$e(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${g(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${Wt(12)}</b>`},Kr=(t,e)=>{let s=(a,r)=>`<option value="${g(a)}" data-c="${ns(a)}"${to(a||null)}${t===a?" selected":""}>${g(r)}</option>`,o=ia().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:${ns(t)}">${ba(t||null)||no}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
|
|
205
217
|
${n.me?s(n.me.email,`Me \xB7 ${n.me.name||n.me.email}`):""}
|
|
206
|
-
${o.map(a=>s(a.email,a.name||a.email)).join("")}${t&&t!==n.me?.email&&!o.some(a=>a.email===t)?s(t,
|
|
207
|
-
</select></span></label>`},
|
|
208
|
-
`).find(s=>
|
|
218
|
+
${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)):""}
|
|
219
|
+
</select></span></label>`},Ur=t=>`<div class="dt-suggest dt-suggest--read"><del>${g(t.from)}</del><ins>${g(t.to)}</ins></div>`,ya=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return g([s,Rt(e??"")&&`\u201C${Rt(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},va='<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>',Gr=(t,e,s=!1)=>{let o=Qe(t);return s?`<span class="dt-field dt-field--bare"><span class="dt-field-box">${wn(o)}<span class="dt-field-label">${g(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare" data-tip="Type: ${g(o.label)}"><span class="dt-field-box">${wn(o)}<span class="dt-field-label">${g(o.label)}</span>${va}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${u.map(a=>`<option value="${a.id}" data-c="${a.color}" data-icon="${g(wn(a))}"${a.id===t?" selected":""}>${a.label}</option>`).join("")}</select></span></label>`},Ln=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","To check","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875]],ss=(t,e)=>{let o=2*Math.PI*e,a=8+3.3*Math.sin(o),r=8-3.3*Math.cos(o),d=`<path d="M8 8V${8-3.3}A${3.3} ${3.3} 0 ${e>.5?1:0} 1 ${a.toFixed(2)} ${r.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"/>${d}</svg>`},un=t=>Re(t)||Jt(t)==="progress"?"progress":Jt(t)==="review"?"review":Jt(t)==="waiting"?"waiting":"new",wa=(t,e)=>{if(e==="all")return!0;let s=bt(t),o=Is(t,s),a=(n.me?.email??"").toLowerCase();return e==="nobody"?!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?(t.by??"").toLowerCase()===a:s==="claude"||s==="open"&&(se(t)==="review"||un(t)==="review")},os={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"done"},eo=[...Ln,["done","Resolved","#30a46c",1]],Yr=t=>{let e=se(t),s=t.status==="done"&&e!=="review"?"done":e&&os[e]?os[e]:un(t),[,,o,a]=eo.find(r=>r[0]===s);return`<label class="dt-field" data-tip="${e&&os[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${ss(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${eo.map(([r,d,b,h])=>`<option value="${r}" data-c="${b}" data-icon="${g(ss(b,h))}"${r===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${oe(t)?"unarchive":"archive"}" data-sep data-icon="${g(rs)}">${oe(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Xr=(t,e)=>{let{reopenedAt:s,reopenedBy:o}=t;if(!s||t.status==="done")return e.join("");let a=Date.parse(s),r=Se(t).findIndex((b,h)=>h>0&&!!b.at&&Date.parse(b.at)>a),d=o?o==="you"||o===n.me?.email?"you":o==="claude"?"Claude":je(o):"";return e.splice(r<0?e.length:r,0,`<p class="dt-note-event">${Te}${g(d?`Reopened by ${d}`:"Reopened")} \xB7 ${Je(s)}</p>`),e.join("")},Jr=t=>{let e=t.from,s=a=>`<p class="dt-note-from">${so}${a}</p>`;return e?s(Mt(t)?"Duplicated from a studio thread":"Duplicated from a client thread"):n.client?"":xt.find(a=>a.from?.id===t.id)?s(Mt(t)?"Duplicated to the workspace":"Duplicated for the client"):""},Zr=t=>{let e=t.status==="done"?"done":un(t),[,s,o,a]=eo.find(r=>r[0]===e);return`<span class="dt-field"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${ss(o,a)}<span class="dt-field-label">${s}</span></span></span>`},Qr=(t,e)=>{let s=G.find(r=>r.id===t);if(!s)return;if(e==="done"){Me(t,!0);return}if(e==="archive"||e==="unarchive"){ze(t,e==="archive");return}let o=e==="new"?At(s.assignee)?"approved":"new":e,a=s.status==="done"?{status:"open",doneBy:null}:{};te(r=>r.map(d=>d.id===t?{...d,...a,stage:o}:d),()=>y({id:t,...a,stage:o}),"Setting the status")},as=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],tl=(t,e)=>{let s=Math.max(0,as.findIndex(b=>b[0]===t)),[,o,a,r]=as[s],d=as[(s+1)%as.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${d[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${d[1]}" aria-label="Priority ${o}">${wr(r,a)}<span>${o}</span></button>`},It=()=>!!n.me&&/@guest\.notemend\.com$/i.test(n.me.email),$a=(t,e,s,o,a=!1,r=!1,d=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":tl(t,s)}${Gr(Qe(e).id,s,r)}</span>${n.client||It()||d?"":la(o,s,a)}</div>`,xa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 3l14 14M8.6 5.2A7.6 7.6 0 0 1 10 5c4.5 0 7.5 5 7.5 5a12.6 12.6 0 0 1-2.3 2.8M5.6 6.6A12.4 12.4 0 0 0 2.5 10s3 5 7.5 5c1.4 0 2.6-.4 3.7-1" stroke-linejoin="round"/></svg>',el=t=>{let e=Rt(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
|
|
220
|
+
`).find(s=>Rt(s))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},no='<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>',nl='<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>',Ea='<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>',so='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="7" y="7" width="9.5" height="9.5" rx="2"/><path d="M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7"/></svg>',Ma='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 7h11M12 4l3 3-3 3M16 13H5M8 10l-3 3 3 3"/></svg>',ka='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2l-.9.9"/><path d="M11.5 8.5a3 3 0 0 0-4.2 0L5 10.8A3 3 0 0 0 9.2 15l.9-.9"/></svg>',La=t=>{let e=(a,r,d,b="")=>`<option value="${a}" data-icon="${g(r)}"${b}>${d}</option>`,s=t&&Ce()?Mt(t)?e("dup",so,"Duplicate to workspace")+(t.client?"":e("move",Ma,"Move to workspace")):e("dup",so,"Duplicate for the client")+e("move",Ma,"Move to clients"):"",o=t&&n.client&&t.status==="done"?e("reopen",Te,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${Ea}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
209
221
|
<option value="" hidden selected></option>
|
|
210
|
-
${s}${o}${t?e("link",
|
|
211
|
-
${e(t?"rm":"discard",
|
|
212
|
-
</select></label>`},
|
|
213
|
-
${s.map(a=>`<option value="${
|
|
214
|
-
</select></span></label>`},hn='<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>',Wo='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',lr='<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>',dr=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,cr=(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 m=s.querySelector(".dt-voice-track i"),b=s.querySelector(".dt-voice-time"),O=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{m.style.transform=`scaleX(${O()?Math.min(1,o.currentTime/O()):0})`,b.textContent=dr(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=lr,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=Wo,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let i=()=>{if(e){let m=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-m.left)/m.width))*o.duration);return}if(!o.paused){o.pause();return}X.querySelectorAll(".dt-voice audio").forEach(m=>{m!==o&&m.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?i():l(),{once:!0}):i();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,i()},{once:!0}),o.currentTime=1e9}},Ss=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),zo=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),mn=new Map,ur=t=>{if(!t.startsWith("data:"))return t;let e=mn.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]})),mn.set(t,e),mn.size>8){let[a,i]=mn.entries().next().value;URL.revokeObjectURL(i),mn.delete(a)}}return e},pr=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${Wo}</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="${ur(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">${Mr}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${hn}</button>`}</span>`,Ts=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,hr=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},As=t=>{let e=oi(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},mr=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${As(e)}<span class="dt-file-text"><b>${p(Ts(e))}</b>${o?"":`<small>${hr(t)}</small>`}</span>`;return`<span class="dt-file" title="${p(e)}">${o?`<a class="dt-file-open" href="${p(lo(e)?t:a)}"${lo(e)?' target="_blank" rel="noreferrer"':` download="${p(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${p(a)}" download="${p(e)}" aria-label="Download ${p(e)}" data-tip="Download">${fr}</a>`:`<span class="dt-file-open">${i}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${hn}</button>`}</span>`},gr=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${p(s)}"><span class="dt-file-open">${As(s)}<span class="dt-file-text"><b>${p(Ts(s))}</b><small>${p(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${hn}</button></span>`},br=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${p(s)}"><span class="dt-file-open">${As(s)}<span class="dt-file-text"><b>${p(Ts(s))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${hn}</button></span>`},Vo=(t,e,s=t)=>t.startsWith(Dn)?gr(t,e??""):t.startsWith(Hs)?br(t,e??""):kn(s)?mr(t,kn(s),e):Ss(s)?pr(t,e):`<span class="dt-shot${zo(s)?" dt-shot--video":""}">${zo(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">${hn}</button>`}</span>`,Cs=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=ei(o);return Vo(a,e===void 0?void 0:`data-id="${e}" data-img="${p(o)}"`,o)}).join("")}</div>`:"",Ko=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>Vo(e,`data-i="${s}"`)).join("")}</div>`:"",On='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',fr='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',yr='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',Dn="refused:\0",Hs="big:\0",qn=new Map,Je=t=>!t.startsWith(Hs),Dl='<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>',vr='<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>',wr='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',$r=90,Bs=32,xr=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",Fn=!1,Er=async(t,e)=>{if(Fn||!t)return;let s=Number(t.dataset.id)||0;Fn=!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(dt){Fn=!1,e.classList.remove("is-asking");let It=dt?.name;Ht(It==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":It==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":It==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${dt?.message||It||"unknown error"}`);return}e.classList.remove("is-asking");let a=()=>X.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),i=document.createElement("div");i.className="dt-rec",i.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${je}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Bs)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${wr}</button>`;let l=i.querySelector("b"),m=[...i.querySelectorAll(".dt-rec-wave i")],b=new AudioContext,O=b.createAnalyser();O.fftSize=512,b.createMediaStreamSource(o).connect(O);let _=new Uint8Array(O.fftSize),u=[],z=new MediaRecorder(o,{audioBitsPerSecond:32e3}),q=[],lt=Date.now(),Y=!0,te=setInterval(()=>{let dt=a();dt&&i.parentElement!==dt&&dt.appendChild(i),O.getByteTimeDomainData(_);let It=0;for(let ot of _)It+=((ot-128)/128)**2;u.push(Math.min(1,Math.sqrt(It/_.length)*4));let re=u.slice(-Bs);m.forEach((ot,sn)=>{let De=re[sn-(Bs-re.length)];ot.style.transform=`scaleY(${Math.max(.1,De??0).toFixed(2)})`,ot.classList.toggle("is-empty",De===void 0)});let Ee=Math.floor((Date.now()-lt)/1e3);l.textContent=`${Math.floor(Ee/60)}:${String(Ee%60).padStart(2,"0")}`,Ee>=$r&&z.state!=="inactive"&&z.stop()},90),Bt=dt=>{Y=dt,z.state!=="inactive"&&z.stop()};i.querySelector(".dt-rec-x").addEventListener("click",dt=>{dt.stopPropagation(),Bt(!1)}),i.querySelector(".dt-rec-done").addEventListener("click",dt=>{dt.stopPropagation(),Bt(!0)}),i.addEventListener("keydown",dt=>{dt.key==="Escape"&&(dt.stopPropagation(),Bt(!1))}),z.ondataavailable=dt=>{dt.data.size&&q.push(dt.data)},z.onstop=async()=>{if(clearInterval(te),o.getTracks().forEach(re=>re.stop()),b.close().catch(()=>{}),i.remove(),Fn=!1,!Y)return;let dt=new Blob(q,{type:z.mimeType||"audio/webm"}),It=await new Promise(re=>{let Ee=new FileReader;Ee.onload=()=>re(String(Ee.result)),Ee.readAsDataURL(dt)});s?xt.push(It):A&&(A.images??=[]).push(It),J(),a()?.querySelector("textarea")?.focus()},z.start(1e3),a()?.appendChild(i),i.querySelector(".dt-rec-done").focus()},Uo="\u{1F3A4} Voice note",Mr='<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>',kr=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?A?.images??[]:xt)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await Lt("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){Ht(i.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${i.text}`:i.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},ye=new Map,Go=async(t,e,s)=>{let o=`${t}:${e}`;if(!s&&ye.has(o)){ye.delete(o),J();return}let a=K.find(b=>b.id===t),i=a&&qe(a).find(b=>(b.at??"0")===e);if(!i?.text)return;ye.set(o,null),J();let l=await Lt("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:s||navigator.language||"en"})}).catch(()=>null),m=l?await l.json().catch(()=>({})):{};ye.has(o)&&(l?.ok&&m.text?ye.set(o,m.text):(ye.delete(o),Ht(m.error||"Could not translate it \u2014 try again.")),J())},Lr=["uk","ru","en"],Sr=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Tr=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${Io}</span><select class="dt-lang-select" data-id="${t}" data-at="${p(e)}" aria-label="Translate into"><option value="" selected hidden></option>${Lr.map(s=>`<option value="${p(s)}">${p(Sr(s))}</option>`).join("")}</select></label>`,Ar='<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>',Cr='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',Yo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',Ns=()=>n.me?.email??"you",Hr=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,i])=>{let l=i.includes(Ns()),m=i.map(b=>b===Ns()?"You":Ye(b)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${p(e)}" data-emoji="${p(a)}" aria-pressed="${l}" data-tip="${p(m)}" aria-label="${p(`${a} ${i.length}: ${m}`)}">${p(a)}<span>${i.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${p(e)}" data-tip="Add reaction" aria-label="Add reaction">${Yo}</button></div>`:""},Xo=(t,e,s)=>{jn();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?li:ri).map(O=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${p(O)}" aria-label="${p(O)}">${p(O)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${Do}</button>`),ve={...s,btn:t},X.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,m=8,b=a.bottom+l+i.height<=innerHeight-m;o.style.top=`${b?a.bottom+l:Math.max(m,a.top-l-i.height)}px`,o.style.left=`${Math.min(Math.max(m,a.right-i.width),innerWidth-m-i.width)}px`,o.querySelector("button")?.focus()},ve=null,jn=()=>{X.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),ve=null},Br=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},Jo=(t,e,s)=>{let o=a=>{let i=di(a.reactions,s,Ns());return i===null?a:{...a,reactions:i}};Jt(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?o(l):l)}:o(i)),()=>y({id:t,react:{at:e,emoji:s}}),"The reaction")},Nr='<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>',Rs=1e4,Zo=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
215
|
-
<textarea class="${t}" rows="1" maxlength="${
|
|
222
|
+
${s}${o}${t?e("link",ka,"Copy link"):""}
|
|
223
|
+
${e(t?"rm":"discard",Ze,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
|
|
224
|
+
</select></label>`},is=()=>(n.team??[]).filter(t=>!n.studio||n.studio.includes(t.email)),Sa=t=>{let e=t||n.lead||"",s=is();return!s.length||s.some(o=>o.email===e)?e:s[0].email},sl=t=>{let e=Sa(t),s=is();if(!s.length)return"";let o=ba(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${ns(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
|
|
225
|
+
${s.map(a=>`<option value="${g(a.email)}" data-c="${ns(a.email)}"${to(a.email)}${e===a.email?" selected":""}>${g(a.name||a.email)}</option>`).join("")}
|
|
226
|
+
</select></span></label>`},Sn='<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>',Ta='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ol='<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>',al=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,il=(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 b=s.querySelector(".dt-voice-track i"),h=s.querySelector(".dt-voice-time"),N=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{b.style.transform=`scaleX(${N()?Math.min(1,o.currentTime/N()):0})`,h.textContent=al(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ol,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=Ta,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let b=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*o.duration);return}if(!o.paused){o.pause();return}K.querySelectorAll(".dt-voice audio").forEach(b=>{b!==o&&b.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():d(),{once:!0}):r();return}d();function d(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},oo=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),Aa=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Tn=new Map,rl=t=>{if(!t.startsWith("data:"))return t;let e=Tn.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]})),Tn.set(t,e),Tn.size>8){let[a,r]=Tn.entries().next().value;URL.revokeObjectURL(r),Tn.delete(a)}}return e},ll=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${Ta}</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="${rl(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">${wl}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${Sn}</button>`}</span>`,ao=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,dl=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},io=t=>{let e=Zi(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},cl=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${io(e)}<span class="dt-file-text"><b>${g(ao(e))}</b>${o?"":`<small>${dl(t)}</small>`}</span>`;return`<span class="dt-file" title="${g(e)}">${o?`<a class="dt-file-open" href="${g(Wo(e)?t:a)}"${Wo(e)?' target="_blank" rel="noreferrer"':` download="${g(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${g(a)}" download="${g(e)}" aria-label="Download ${g(e)}" data-tip="Download">${hl}</a>`:`<span class="dt-file-open">${r}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${Sn}</button>`}</span>`},ul=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${g(s)}"><span class="dt-file-open">${io(s)}<span class="dt-file-text"><b>${g(ao(s))}</b><small>${g(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Sn}</button></span>`},pl=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${g(s)}"><span class="dt-file-open">${io(s)}<span class="dt-file-text"><b>${g(ao(s))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Sn}</button></span>`},Ca=(t,e,s=t)=>t.startsWith(ls)?ul(t,e??""):t.startsWith(lo)?pl(t,e??""):zn(s)?cl(t,zn(s),e):oo(s)?ll(t,e):`<span class="dt-shot${Aa(s)?" dt-shot--video":""}">${Aa(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">${Sn}</button>`}</span>`,ro=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=Gi(o);return Ca(a,e===void 0?void 0:`data-id="${e}" data-img="${g(o)}"`,o)}).join("")}</div>`:"",Ha=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>Ca(e,`data-i="${s}"`)).join("")}</div>`:"",rs='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',hl='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',ml='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',ls="refused:\0",lo="big:\0",ds=new Map,pn=t=>!t.startsWith(lo),Vd='<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>',gl='<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>',fl='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',bl=90,co=32,yl=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",cs=!1,vl=async(t,e)=>{if(cs||!t)return;let s=Number(t.dataset.id)||0;cs=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Lt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(mt){clearTimeout(o),cs=!1,e.classList.remove("is-asking");let gt=mt?.name;Lt(gt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":gt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":gt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${mt?.message||gt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>K.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">${Ze}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(co)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${fl}</button>`;let b=d.querySelector("b"),h=[...d.querySelectorAll(".dt-rec-wave i")],N=new AudioContext,V=N.createAnalyser();V.fftSize=512,N.createMediaStreamSource(a).connect(V);let c=new Uint8Array(V.fftSize),F=[],q=new MediaRecorder(a,{audioBitsPerSecond:32e3}),lt=[],C=Date.now(),it=!0,Et=setInterval(()=>{let mt=r();if(!mt){ne(!1);return}d.parentElement!==mt&&mt.appendChild(d),V.getByteTimeDomainData(c);let gt=0;for(let yn of c)gt+=((yn-128)/128)**2;F.push(Math.min(1,Math.sqrt(gt/c.length)*4));let Le=F.slice(-co);h.forEach((yn,Ls)=>{let ge=Le[Ls-(co-Le.length)];yn.style.transform=`scaleY(${Math.max(.1,ge??0).toFixed(2)})`,yn.classList.toggle("is-empty",ge===void 0)});let re=Math.floor((Date.now()-C)/1e3);b.textContent=`${Math.floor(re/60)}:${String(re%60).padStart(2,"0")}`,re>=bl&&q.state!=="inactive"&&q.stop()},90),ne=mt=>{it=mt,q.state!=="inactive"&&q.stop()};d.querySelector(".dt-rec-x").addEventListener("click",mt=>{mt.stopPropagation(),ne(!1)}),d.querySelector(".dt-rec-done").addEventListener("click",mt=>{mt.stopPropagation(),ne(!0)}),d.addEventListener("keydown",mt=>{mt.key==="Escape"&&(mt.stopPropagation(),ne(!1))}),q.ondataavailable=mt=>{mt.data.size&<.push(mt.data)},q.onstop=async()=>{if(clearInterval(Et),a.getTracks().forEach(Le=>Le.stop()),N.close().catch(()=>{}),d.remove(),cs=!1,!it)return;let mt=new Blob(lt,{type:q.mimeType||"audio/webm"}),gt=await new Promise(Le=>{let re=new FileReader;re.onload=()=>Le(String(re.result)),re.readAsDataURL(mt)});s?O.push(gt):S&&(S.images??=[]).push(gt),et(),r()?.querySelector("textarea")?.focus()},q.start(1e3),r()?.appendChild(d),d.querySelector(".dt-rec-done").focus()},Na="\u{1F3A4} Voice note",wl='<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>',$l=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?S?.images??[]:O)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await Ct("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),r=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!r.text){Lt(r.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let d=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");d&&(d.value=d.value.trim()?`${d.value.trimEnd()} ${r.text}`:r.text,d.dispatchEvent(new Event("input",{bubbles:!0})),d.focus())},xe=new Map,Ba=async(t,e,s)=>{let o=`${t}:${e}`;if(!s&&xe.has(o)){xe.delete(o),et();return}let a=G.find(h=>h.id===t),r=a&&Se(a).find(h=>(h.at??"0")===e);if(!r?.text)return;xe.set(o,null),et();let d=await Ct("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:s||navigator.language||"en"})}).catch(()=>null),b=d?await d.json().catch(()=>({})):{};xe.has(o)&&(d?.ok&&b.text?xe.set(o,b.text):(xe.delete(o),Lt(b.error||"Could not translate it \u2014 try again.")),et())},xl=["uk","ru","en"],El=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Ml=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${va}</span><select class="dt-lang-select" data-id="${t}" data-at="${g(e)}" aria-label="Translate into"><option value="" selected hidden></option>${xl.map(s=>`<option value="${g(s)}">${g(El(s))}</option>`).join("")}</select></label>`,kl='<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>',Ll='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',Ra='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',uo=()=>n.me?.email??"you",Sl=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let d=r.includes(uo()),b=r.map(h=>h===uo()?"You":je(h)).join(", ");return`<button type="button" class="dt-react${d?" is-mine":""}" data-act="react" data-id="${t}" data-at="${g(e)}" data-emoji="${g(a)}" aria-pressed="${d}" data-tip="${g(b)}" aria-label="${g(`${a} ${r.length}: ${b}`)}">${g(a)}<span>${r.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${g(e)}" data-tip="Add reaction" aria-label="Add reaction">${Ra}</button></div>`:""},Pa=(t,e,s)=>{us();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?nr:er).map(N=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${g(N)}" aria-label="${g(N)}">${g(N)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${Ea}</button>`),Ee={...s,btn:t},K.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),d=6,b=8,h=a.bottom+d+r.height<=innerHeight-b;o.style.top=`${h?a.bottom+d:Math.max(b,a.top-d-r.height)}px`,o.style.left=`${Math.min(Math.max(b,a.right-r.width),innerWidth-b-r.width)}px`,o.querySelector("button")?.focus()},Ee=null,us=()=>{K.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Ee=null},Tl=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},Oa=(t,e,s)=>{let o=a=>{let r=sr(a.reactions,s,uo());return r===null?a:{...a,reactions:r}};te(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(d=>d.at===e?o(d):d)}:o(r)),()=>y({id:t,react:{at:e,emoji:s}}),"The reaction")},Al='<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>',po=1e4,Ia=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
227
|
+
<textarea class="${t}" rows="1" maxlength="${po}" aria-label="${e}" placeholder="${e}">${g(s)}</textarea>
|
|
216
228
|
${a}
|
|
217
229
|
<div class="dt-compose-bar">
|
|
218
|
-
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${
|
|
219
|
-
${
|
|
230
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Al}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${ml}</button>
|
|
231
|
+
${yl()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${gl}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Ll}</button></span>
|
|
220
232
|
<button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
|
|
221
233
|
><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>
|
|
222
234
|
</div>
|
|
223
|
-
</div></div>`,
|
|
224
|
-
class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":s==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${
|
|
225
|
-
style="left:${
|
|
226
|
-
title="${
|
|
227
|
-
style="left:${
|
|
235
|
+
</div></div>`,ho=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),Da=()=>dt.map((t,e)=>({i:e,el:ho(t.tag,t.classes),text:Rt(t.text??""),shots:t.images?.length??0,orphan:!Qt(t)})),mo=[],qa="",ae=t=>{let e=t.working;return We(e?.agent,e?.by??Ps(t.assignee))},Fa=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`},ps=(t,e)=>{let s=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${ae(t)} \u2014 it takes it on its next run`,asks:`${ae(t)} is waiting for your answer`,working:`${ae(t)} is on it \xB7 ${Fa(s?.at)}`,stuck:`${ae(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${We(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},ja=t=>{if(n.client||It()||Mt(t))return"";let e=se(t);if(!e)return n.client||It()||t.status==="done"||Mt(t)?"":`<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">${Ko(13,0)}</button>`;let s=Ko(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${g(ps(t,e))}" aria-label="${g(ps(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${g(ps(t,e))}" role="img" aria-label="${g(ps(t,e))}">${s}</span>`},An=t=>!!n.client&&!(n.me&&t.by===n.me.email),_a=(t,e=!0)=>{if(An(t))return e?ja(t):"";let s=bt(t),o=s==="done",a=oe(t);return`${e?ja(t):""}<button data-act="${o?"reopen":"done"}" data-id="${t.id}"
|
|
236
|
+
class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":s==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${qt}</button>${n.client||It()?"":`<button data-act="${a?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${a?" is-on":""}" title="${a?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${rs}</button>`}`},Cl=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!oe(t)&&!An(t)){let h=t.confirmedBy?t.confirmedBy===n.me?.email?"you":je(t.confirmedBy):"",N=t.confirmedAt;return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${g(h?`Resolved by ${h}`:"Resolved")}</b>${N?` \xB7 ${Je(N)}`:""}</span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${Te}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act is-main" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${rs}</button></div>`)}if(n.client||Mt(t))return"";let e=se(t),s={act:"hand",v:"me",icon:no,tip:n.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Te,tip:"Reopen"},a=[{act:"accept",icon:qt,tip:"Looks right \u2014 mark it resolved",main:!0},{act:"sendback",icon:Te,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,d=!At(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":je(t.assignee):"",b=e==="queued"?{step:e,title:`With ${ae(t)} \u2014 queued`,acts:[s]}:e==="working"?{step:e,title:`With ${ae(t)} \u2014 working`,acts:[s],live:!0}:e==="asks"?{step:e,title:`With ${ae(t)} \u2014 it asks you`,acts:[]}:e==="stuck"?{step:e,title:`With ${ae(t)} \u2014 silent for ${Fa(r?.at)}`,acts:[s]}:e==="review"?null:Jt(t)==="review"&&d?{step:"review",title:`To check \u2014 ${d} ${d==="You"?"say":"says"} done`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&n.me&&!It()?{step:"anyone",title:"Anyone",acts:[{act:"hand",v:"me",icon:qt,tip:"Take it myself"},{act:"hand",v:"agent",icon:Wt(13),tip:`Give it to ${ae(t)}`},{act:"give",icon:nl,tip:"Give it to someone",pick:!0}]}:null;return b?`<div class="dt-step dt-step--${b.step}">${b.step==="anyone"?ra:""}<span class="dt-step-text"><b>${g(b.title)}</b></span>${b.acts.map(h=>h.pick?`<label class="dt-step-act" data-tip="${g(h.tip)}">${h.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${g(h.tip)}"><option value="" selected hidden></option>${Fe().map(N=>`<option value="${g(N.email)}"${to(N.email)}>${g(N.email===n.me?.email?`Me \xB7 ${N.name||N.email}`:N.name||N.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${h.main?" is-main":""}" data-act="${h.act}" data-id="${t.id}"${h.v?` data-v="${h.v}"`:""} data-tip="${g(h.tip)}" aria-label="${g(h.tip)}">${h.icon}</button>`).join("")}${b.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},Hl=async(t,e)=>{let s=e?G.find(a=>a.id===t):void 0,o=await y(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:za(G.find(a=>a.id===t))});return o.ok&&s&&No(de(s)).then(a=>{a&&y({id:t,after:a})}),o},hs=0,Wa=()=>{},ms=t=>(hs++,t.finally(()=>{hs--,Wa()})),te=async(t,e,s)=>{let o=G,a=xt;G=t(G),xt=t(xt),et();let r=await ms(e()).catch(()=>null);if(!r?.ok){G=o,xt=a,et(),qn(`${s} did not go through`,r);return}let d=gn([await r.json().catch(()=>null)])[0];d&&(G=G.map(b=>b.id===d.id?d:b),xt=xt.map(b=>b.id===d.id?d:b),et()),Ge()},za=t=>t?At(t.assignee)?"approved":t.assignee?"progress":"new":"new",Me=async(t,e)=>{await te(r=>r.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:za(d),reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Hl(t,e),e?"Resolving":"Reopening");let s=xt.find(r=>r.id===t),o=s?.from,a=o&&xt.find(r=>r.id===o.id);e&&s?.status==="done"&&a&&Mt(a)&&!Mt(s)&&a.status!=="done"&&(await y({id:a.id,reply:"Fixed \u2014 please check.",status:"done",doneBy:"you"}).catch(()=>null),Ge())},ze=async(t,e,s=!1)=>{let o=G.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await te(r=>r.map(d=>d.id===t?{...d,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:d),()=>y({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&He(`Archived #${t}`,()=>ze(t,!1,!0))},He=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${g(t)}</span><button type="button">${g(s)}</button>`,on(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>o.remove(),5e3)},go=t=>te(e=>e.filter(s=>s.id!==t),()=>Ct(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Nl=t=>{let e=G.filter(a=>k(a)===t),s=e.filter(a=>bt(a)==="open").length,o=e.filter(a=>bt(a)==="claude").length;Ie.innerHTML=s?String(s):o?Wt(9):"\u2713",Ie.dataset.state=s?"open":o?"claude":"done",Ie.hidden=e.length===0},fo=0,Va,Cn=()=>{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",Cn),addEventListener("resize",Cn),document.addEventListener("focusin",Cn),document.addEventListener("focusout",()=>setTimeout(Cn));let et=()=>{for(let c of Object.keys(T))c!==String(nt)&&delete T[c];requestAnimationFrame(Cn);let t=fo-performance.now();if(t>0){clearTimeout(Va),Va=setTimeout(et,t);return}if(Mn(),f){let c=Da(),F=JSON.stringify(c);F!==qa&&(qa=F,parent.postMessage({dt:!0,drafts:c},location.origin))}ta(),ct.toggleAttribute("data-yield",nt!=null||!!S),nt!==rn&&(jt="",O=[],rn=nt),J&&J.id!==nt&&(J=null);let e=we();if(Nl(e),_s(),!$t){K.innerHTML="",Vs(null),vt.hidden=!0;return}let s=e;if(nt!=null&&!S){let c=G.find(F=>F.id===nt);c&&k(c)!==s&&(nt=null)}let o="",a=G.filter(c=>k(c)===s&&(Qo(c)&&dn(c)||c.id===nt));for(let c of a){let F=Qt(c);if(!F&&nt!==c.id)continue;let q=bt(c),lt=!F,C=F??{x:0,y:0},it=Qe(c.category),Et=Re(c),ne=q==="done"?null:se(c),mt=ne?Zs[ne]??"":"",gt=Is(c,q),Le=!!gt&&!gt.taker,re=!!gt&&!!gt.taker&>.taker!==gt.writer,yn=mt||Ln.find(ge=>ge[0]===un(c))[2],Ls=gt?Le?` \xB7 ${Js(gt.writer,c)} \xB7 nobody has it yet`:` \xB7 ${re?`${Js(gt.writer,c)} \u2192 `:""}${Js(gt.taker,c)}${gt.claude?` \xB7 Claude${Et?" is working":ne==="asks"?" asks":ne==="review"||q==="claude"?" fixed it":""}`:""}`:"";if(nt===c.id){let ge=Qs(c)?Se(c).length-_e[c.id]:0;ge>0&&(T[c.id]=ge),zr(c)}if(lt||(o+=`<button class="dt-pin dt-pin--${q}${q==="done"&&!oe(c)?" dt-pin--resolved":""}${gt?` dt-pin--people${Le?" dt-pin--nobody":""}${re?" dt-pin--pair":""}`:mt?" dt-pin--agent":""}${Et?" dt-pin--working":""}${q==="open"&&Jt(c)==="review"?" dt-pin--review":""}${F?.hidden?" dt-pin--hidden":""}${nt!==c.id&&!wa(c,le)?" dt-pin--dim":""}" data-id="${c.id}"${F?.off?` data-off="${F.off}"`:""} aria-label="Comment ${c.id}, ${q==="open"?"open":q==="claude"?`resolved by ${g(We(c.doneAgent,c.doneFor))}`:"resolved"}${g(Ls.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!gt&&mt?`, with ${g(ae(c))}`:""}" aria-expanded="${nt===c.id}"
|
|
237
|
+
style="left:${C.x}px;top:${C.y}px;--cat:${it.color};--ring:${yn};--hue:${kn(c.by||c.byName||"")}${mt?`;--step-c:${mt}`:""}"
|
|
238
|
+
title="${g(c.text.slice(0,80))} \xB7 ${it.label}${gt?g(Ls):Et?` \xB7 ${g(We(Et.agent,Et.by))} is on it`:""}${q==="claude"?` \xB7 resolved by ${g(We(c.doneAgent,c.doneFor))} \u2014 tick to confirm`:q==="done"?" \xB7 resolved":""}${Po(c)?" \u2014 drag to move":""}"${Po(c)?" data-move":""}>${q==="done"?"\u2713":gt?`${ma(gt.writer,c)}${re?ma(gt.taker,c):""}${gt.claude?`<i class="dt-pin-claude" aria-hidden="true">${Wt(8)}</i>`:""}`:mt?Wt(11):ha(c)}${q!=="done"&&nt!==c.id&&Qs(c)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button><i class="dt-pin-eye" data-eye="${c.id}" aria-hidden="true" style="left:${C.x}px;top:${C.y}px"${F?.hidden?"":" hidden"}>${xa}</i>`),nt===c.id){let ge=Se(c),pd=se(c)==="review"&&!n.client?ge.map(ut=>ut.author).lastIndexOf("claude"):-1;o+=`<div class="dt-note${lt?" dt-note--orphan":""}" data-id="${c.id}" role="dialog" aria-label="Comment ${c.id}"
|
|
239
|
+
style="left:${C.x}px;top:${C.y}px">
|
|
228
240
|
<div class="dt-note-bar">
|
|
229
|
-
<span class="dt-note-el"${n.client?"":` data-tip="${
|
|
241
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${ya(c.selector,c.label)}"`}>${n.client?`Comment #${c.id>0?c.id:"\u2026"}`:g(ho(c.tag,c.classes))}</span>
|
|
230
242
|
<span class="dt-note-tools">
|
|
231
|
-
${
|
|
243
|
+
${_a(c)}
|
|
232
244
|
<i class="dt-note-sep"></i>
|
|
233
|
-
${
|
|
234
|
-
<button data-act="close" data-id="${
|
|
245
|
+
${An(c)?"":La(c)}
|
|
246
|
+
<button data-act="close" data-id="${c.id}" data-tip="Close" aria-label="Close">${Pe}</button>
|
|
235
247
|
</span>
|
|
236
248
|
</div>
|
|
237
249
|
${lt?'<p class="dt-note-orphan">Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here.</p>':""}
|
|
238
|
-
<div class="dt-note-hidden"${
|
|
239
|
-
${(()=>{let
|
|
240
|
-
${
|
|
250
|
+
<div class="dt-note-hidden"${F?.hidden?"":" hidden"}>${xa}<p><b>Hidden right now</b>It sits inside \xAB${g(el(F?.shut??F?.hidden))}\xBB, which is closed. Open it on the page and the pin moves onto the spot.</p><button type="button" data-act="where" data-id="${c.id}">Show where</button></div>
|
|
251
|
+
${(()=>{let ut=(An(c)||It()?Zr(c):Yr(c))+(c.host&&c.host!==location.host?`<span class="dt-note-host" title="Written on ${g(c.host)}">${g(c.host)}</span>`:"");return ut?`<div class="dt-note-meta">${ut}</div>`:""})()}
|
|
252
|
+
${Jr(c)}
|
|
241
253
|
<div class="dt-note-thread">
|
|
242
|
-
${
|
|
243
|
-
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${
|
|
244
|
-
<textarea class="dt-note-edit-input" rows="1" maxlength="${
|
|
245
|
-
${
|
|
254
|
+
${Xr(c,ge.map((ut,Ss)=>{let Ts=Ss===0?null:ut.at??null,As=ut.author==="you"&&(!ut.by||ut.by===n.me?.email),Wi=As&&J?.id===c.id&&J.at===Ts,Fn=n.team?.find(jn=>jn.email===ut.by),zi=ut.author==="claude"?We(ut.agent,ut.by):As?"You":Fn?.name||ut.byName||ut.by||"You",Vi=ut.author==="claude"?Fn?.agent_avatar_url?`<img class="dt-msg-face" src="${g(Fn.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${Wt(11)}</span>`:Fn?.avatar_url?`<img class="dt-msg-face" src="${g(Fn.avatar_url)}" alt="">`:"",Fo=`${c.id}:${ut.at??"0"}`,Cs=xe.get(Fo),Ki=!As&&n.voice&&ut.text?`<button class="dt-msg-edit${xe.has(Fo)?" is-on":""}" data-act="translate" data-id="${c.id}" data-at="${g(ut.at??"0")}" title="${xe.has(Fo)?"Show the original":"Translate into your language"}">${kl}</button>${Ml(c.id,ut.at??"0")}`:"",Hs=c.id<=0?null:Ss===0?"":c.replies?.some(jn=>jn.at===ut.at)?ut.at:null,jo=Hs===null?"":Sl(c.id,Hs,ut.reactions),hd=Hs!==null&&!jo?`<button class="dt-msg-edit" data-act="react-pick" data-id="${c.id}" data-at="${g(Hs)}" data-tip="Add reaction" aria-label="Add reaction">${Ra}</button>`:"",Ui=`<div class="dt-msg-head">${Vi}<b>${g(zi)}</b><time>${Je(ut.at)}</time>${hd}${Ki}${As&&!Wi?`<button class="dt-msg-edit" data-act="edit" data-id="${c.id}" data-at="${g(Ts??"")}" title="Edit">${Vn}</button>${Ts?`<button class="dt-msg-edit" data-act="unsay" data-id="${c.id}" data-at="${g(Ts)}" title="Delete">${Ze}</button>`:""}`:""}</div>`;return Ss===pd?`<div class="dt-msg dt-msg--done" data-msg="${c.id}:${g(ut.at??"0")}"><div class="dt-msg-head">${Vi}<b>${g(zi)} fixed it</b><time>${Je(ut.at)}</time>${Ki}</div><p${Cs===null?' class="is-asking"':""}>${Mi(Cs||ut.text)}</p>${ro(ut.images)}${jo}
|
|
255
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${c.id}">${qt}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${c.id}">${Te}Send back</button></div></div>`:Wi?`<div class="dt-msg">${Ui}<div class="dt-compose">
|
|
256
|
+
<textarea class="dt-note-edit-input" rows="1" maxlength="${po}" aria-label="Edit the message">${g(J.text)}</textarea>
|
|
257
|
+
${ro(ut.images.filter(jn=>!J.drop.includes(jn.split("/").pop())),c.id)}
|
|
246
258
|
<div class="dt-compose-bar">
|
|
247
259
|
<button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
|
|
248
|
-
<button class="dt-send${
|
|
260
|
+
<button class="dt-send${J.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${qt}</button>
|
|
249
261
|
</div>
|
|
250
|
-
</div></div>`:`<div class="dt-msg" data-msg="${
|
|
262
|
+
</div></div>`:`<div class="dt-msg" data-msg="${c.id}:${g(ut.at??"0")}">${Ui}<p${Cs===null?' class="is-asking"':""}>${Mi(Cs||ut.text)}</p>${Ss===0&&c.suggest?Ur(c.suggest):""}${ro(ut.images)}${jo}</div>`}))}
|
|
251
263
|
</div>
|
|
252
|
-
${
|
|
253
|
-
${
|
|
254
|
-
${
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
264
|
+
${T[c.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${c.id}">${T[c.id]} new ${T[c.id]===1?"reply":"replies"} \u2193</button>`:""}
|
|
265
|
+
${Cl(c)}
|
|
266
|
+
${Ia("dt-note-reply-input",se(c)==="asks"?`Answer ${g(ae(c))}`:"Reply",jt,`data-act="reply" data-id="${c.id}"`,Ha(O))}
|
|
267
|
+
${$a(c.priority,c.category,c.id,c.assignee??"",Ds(c),An(c),Mt(c))}
|
|
268
|
+
</div>`}}dt.forEach((c,F)=>{let q=Qt(c);q&&(o+=`<button class="dt-pin dt-pin--draft" data-parked="${F}" data-act="draft-open" data-i="${F}"
|
|
269
|
+
style="left:${q.x}px;top:${q.y}px" title="Draft, not sent \u2014 click to finish it">${Vn}</button>`)});let r=S&&Qt(S);if(S){let c=r?.x??0,F=r?.y??0;o+=`${r?`<span class="dt-pin dt-pin--draft" data-draft style="left:${c}px;top:${F}px"></span>`:""}
|
|
270
|
+
<div class="dt-note${r?"":" dt-note--orphan"}" data-draft style="left:${c}px;top:${F}px">
|
|
258
271
|
<div class="dt-note-bar">
|
|
259
|
-
<span class="dt-note-el"${n.client?"":` data-tip="${
|
|
260
|
-
${
|
|
272
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${ya(S.selector,S.label)}"`}>${n.client?"New comment":g(ho(S.tag,S.classes))}</span>
|
|
273
|
+
${Ut()?'<span class="dt-note-draft">Draft</span>':""}
|
|
261
274
|
<span class="dt-note-tools">
|
|
262
275
|
|
|
263
|
-
${
|
|
264
|
-
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${
|
|
276
|
+
${La()}
|
|
277
|
+
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Pe}</button>
|
|
265
278
|
</span>
|
|
266
279
|
</div>
|
|
267
|
-
${
|
|
268
|
-
${(()=>{let q=
|
|
269
|
-
${n.client?`<div class="dt-note-meta">${
|
|
270
|
-
${
|
|
271
|
-
<span class="dt-suggest-was">Now: <del>${
|
|
272
|
-
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${
|
|
280
|
+
${r?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
|
|
281
|
+
${(()=>{let q=r?de(S):null,lt=q&&G.find(C=>C.id>0&&bt(C)==="open"&&de(C)===q);return lt?`<p class="dt-note-twin">Already open here: \u201C${g(lt.text.slice(0,60))}${lt.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${lt.id}">Open it</button></p>`:""})()}
|
|
282
|
+
${n.client?`<div class="dt-note-meta">${sl(S.assignee)}</div>`:""}
|
|
283
|
+
${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">${Pe}</button></span>
|
|
284
|
+
<span class="dt-suggest-was">Now: <del>${g(S.suggest.from.slice(0,160))}${S.suggest.from.length>160?"\u2026":""}</del></span>
|
|
285
|
+
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${g(S.suggest.to)}</textarea>
|
|
273
286
|
<span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
|
|
274
|
-
${
|
|
275
|
-
${
|
|
276
|
-
</div>`}let l=new Map([...X.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}])),m=new Set([...X.querySelectorAll("[data-msg]")].map(u=>u.dataset.msg)),b=X.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");X.innerHTML=o,b&&Qn(".dt-note-reply-input");for(let u of X.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let z=u.closest(".dt-note").dataset.id,q=l.get(z);if(!q)continue;let lt=[...u.querySelectorAll("[data-msg]")].filter(Y=>!m.has(Y.dataset.msg));for(let Y of lt)Y.classList.add("dt-msg--new");u.scrollTop=q.end&<.length?u.scrollHeight:q.top}let O=Math.min(innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8;for(let u of X.querySelectorAll(".dt-note")){let z=u.getBoundingClientRect(),q=z.top,lt=O-q,Y=q-32;z.bottom>O&&Y>lt&&(u.dataset.flip="1"),z.right>innerWidth-8&&(u.dataset.flipx="1"),z=u.getBoundingClientRect();let te=u.dataset.flip?8-z.top:z.bottom-O,Bt=u.querySelector(".dt-note-thread");te>0&&Bt&&(Bt.style.maxHeight=`${Math.max(64,Bt.clientHeight-te)}px`);let dt=u.getBoundingClientRect().top;u.dataset.flip&&dt<8&&(u.style.marginTop=`${8-dt}px`)}Ze(s),ms(gs()),pe();for(let u of X.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Qs(u);let _=X.querySelector(".dt-note-input");_&&(_.focus(),_.setSelectionRange(_.value.length,_.value.length))},Or=()=>{let t=!1,e=[];for(let s of X.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(s.classList.contains("dt-note--orphan")||s.classList.contains("is-dragging"))continue;let o=K.find(i=>i.id===Number(s.dataset.id)),a=o&&Xt(o);e.push([s,a]),a&&xo(a.el)&&(t=!0)}for(let s of X.querySelectorAll("[data-draft], [data-parked]")){if(s.classList.contains("dt-note--orphan"))continue;let o=s.dataset.parked?Ct[Number(s.dataset.parked)]:A;e.push([s,o?Xt(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,s.classList.toggle("dt-pin--hidden",!!o.hidden)),s.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!Bn.length&&(A||Q!=null)){let s=gs();s&&xo(s)&&ms(s)}Ce(A||Q!=null?gs():null),t&&pe()},Ze=t=>{if(!I.hidden&&(I.innerHTML=Hi({bp:t,notes:K.filter(cn),breakpoints:d,bandOfNote:S,orphan:e=>!Xt(e),hiddenNow:e=>!!Xt(e)?.hidden,whoseAgent:Be,statusTools:e=>sa(e,!No(e)),showResolved:ae,showArchived:ke,archived:ie,drafts:Yt.hidden?Qo():Is,checks:v?0:zn.toCheck().length,marker:qr,assign:No,find:zt,forMe:Dr,forAgent:e=>!!le(e)&&mt(e)!=="done",unread:Bo,agentless:e=>n.client||Vt()||$t(e),archives:!n.client&&!Vt()}),Qe)){let e=I.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Qe.at,Qe.at),Qe=null}},Qe=null,Dr=t=>{if(mt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||mt(t)==="claude"||Gt(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return qe(t).some(s=>s.text.toLowerCase().includes("@"+e))},qr=t=>{let e=le(t),s=ws[e??""],o=mt(t)==="done"?ie(t)?`<i class="dt-hist-badge is-archived">${On}</i>`:`<i class="dt-hist-badge is-done">${jt}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${ee(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${xs.find(i=>i[0]===pn(t))[2]}"></i>`,a=Ao(t);return a?`<span class="dt-hist-face" style="--hue:${Co(t.by||t.byName||"")}">${a}${o}</span>`:`<span class="dt-hist-n" style="--cat:${_e(t.category).color}">${o}</span>`},Fs=t=>I.toggleAttribute("data-collapsed",t);I.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(zt.q=e.value,Qe={at:e.selectionStart??e.value.length},Ze(Le()))}),I.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Oe(),setTimeout(()=>delete e.dataset.spin,500);return}if(I.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){Fs(!1);return}if(t.target.closest("[data-fold]")){Fs(!I.hasAttribute("data-collapsed"));return}let s=t.target.closest(".dt-hist-bands [data-bp]");if(s){qa(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?(zt.view=o.dataset.histView,L("dt-view",zt.view),zt.menu=!1):o.dataset.histSort?(zt.sort=o.dataset.histSort,L("dt-sort",zt.sort),zt.menu=!1):o.hasAttribute("data-hist-clear")?(zt.q="",Qe={at:0}):zt.menu=!zt.menu,Ze(Le());return}zt.menu&&!t.target.closest(".dt-hist-menu")&&(zt.menu=!1,Ze(Le()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let z=a.dataset.draftRm!==void 0,q=Number(z?a.dataset.draftRm:a.dataset.draftGo);Yt.hidden?z?ia(q):js(q):Qt(z?{dropDraft:q}:{openDraft:q});return}let i=t.target.closest("[data-unmark]");if(i){t.stopPropagation(),await we(Number(i.dataset.unmark),!1);return}let l=t.target.closest(".dt-hist-tools [data-act]");if(l){await we(Number(l.dataset.id),l.dataset.act==="done");return}let m=t.target.closest("[data-rm]");if(m){Q=null,await Ds(Number(m.dataset.rm));return}if(t.target.closest("[data-review]")){zn.start();return}if(t.target.closest("[data-resolved]")){Ws(!ae);return}if(t.target.closest("[data-archived]")){zs(!ke);return}let b=t.target.closest("[data-archive-all]");if(b){let z=b.dataset.archiveAll.split(",").map(Number);for(let q of z)await Ne(q,!0,!0);Re(`Archived ${z.length}`,()=>{for(let q of z)Ne(q,!1,!0)});return}let O=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(O){await Ne(Number(O.dataset.id),O.dataset.act==="archive");return}let _=t.target.closest("[data-go]");if(!_)return;let u=Number(_.dataset.go);if(!Yt.hidden){Qt({open:u});return}fn(u)});let fn=t=>{Q=t,P(),J();let e=K.find(o=>o.id===t),s=e&&Xt(e);s?scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"}):e&&ce(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||X.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},js=t=>{let[e]=Ct.splice(t,1);if(!e)return;P(),A=e,Q=null;let s=Xt(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),J()},ia=t=>{Ct.splice(t,1),J()},zn=Bi({inFrame:v,everything:()=>vt,route:()=>k,settle:we,keepIn:Ft,toast:t=>Ht(t),waits:t=>mt(t)==="claude"||mt(t)==="done"&&!ie(t),approve:t=>mt(t)==="claude"?we(t.id,!0):Ne(t.id,!0,!0),open:t=>{if(At||$e(!0),S(t)!==Le()){qa(S(t));for(let e of[600,1500])setTimeout(()=>Qt({open:t.id}),e)}else fn(t.id)}}),Fr=t=>{I.hidden=!t,U.setAttribute("aria-pressed",String(t)),L("dt-history",t?"1":"0"),J()},_s=document.querySelector(".dt-resolved-btn"),Vn=document.querySelector(".dt-space"),jr=t=>{if(Vn){Vn.hidden=!Ge();for(let e of Vn.querySelectorAll("[data-space]")){let s=e.dataset.space;e.setAttribute("aria-checked",String(s===Ue));let o=e.querySelector(".dt-space-n");o.textContent=String(t[s]),o.hidden=!t[s]}}},Kn=t=>{!Ge()||t===Ue||(Ue=t,L("dt-space",t),Q!=null&&!cn(K.find(e=>e.id===Q))&&(Q=null),P(),Un(vt),J(),Ze(Le()))};Vn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&Kn(e.dataset.space)});let Ws=t=>{ae=t,_s.setAttribute("aria-pressed",String(t)),L("dt-resolved",t?"1":"0"),Qt({resolved:t}),J(),Ie(!0)},zs=t=>{ke=t,L("dt-archived",t?"1":"0"),Qt({archived:t}),J(),Ie(!0)};_s.addEventListener("click",()=>Ws(!ae)),_s.setAttribute("aria-pressed",String(ae)),U.addEventListener("click",()=>{let t=I.hidden===!0;t&&!At&&$e(!0),t&&Fs(!1),Fr(t)});let pe=()=>{ln||!At||(ln=requestAnimationFrame(()=>{ln=0,Or()}))},ra=`${Me}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,_r=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(ra))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(ra))},la=new MutationObserver(t=>{t.every(_r)||($o(),pe())}),da=new ResizeObserver(()=>pe()),ca=()=>{X.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&pe()},vt=[],ua=()=>{},yn=new Set,Kt={at:"",ids:[]},Un=t=>{vt=t,queueMicrotask(()=>ua());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={},o={studio:0,clients:0};for(let b of t){if(ie(b)||(mt(b)!=="done"&&o[$t(b)?"clients":"studio"]++,!cn(b)))continue;let O=mt(b),_=le(b),u=O==="done"?"done":O==="claude"?"review":_&&Pn[_]||pn(b),z=s[b.route??""]??={...e(),bands:{}};z[u]++;let q=S(b);(z.bands[q]??=e())[u]++}jr(o);let a=["new","progress","review","waiting","done"],i={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},l=b=>a.map(O=>[O,O==="done"&&!ae?0:b[O]]),m=b=>l(b).reduce((O,[,_])=>O+_,0);for(let b of document.querySelectorAll(".dt-pages a")){let O=b.querySelector(".dt-pages-n");if(!O)continue;let _=s[new URL(b.href).pathname.replace(/\/+$/,"")||"/"];for(let q of d){let lt=_?.bands[q.id];for(let[Y,te]of l(lt??e())){let Bt=O.querySelector(`[data-bp="${q.id}"][data-state="${Y}"]`);Bt.hidden=!te,te&&(Bt.querySelector("i").textContent=String(te),Bt.title=`${q.label}: ${te} ${i[Y]}`)}}let u=_?m(_):0;O.hidden=!u;let z=_?d.filter(q=>_.bands[q.id]&&m(_.bands[q.id])).map(q=>`${q.label} ${m(_.bands[q.id])}`).join(" \xB7 "):"";O.title=u?`${a.filter(q=>_[q]).map(q=>`${_[q]} ${i[q]}`).join(" \xB7 ")}
|
|
277
|
-
${z}`:""}},tn=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"):[]})),Wr=Ni(v,t=>Ht(t)),Zt=document.querySelector(".dt-push"),he=Zt.querySelector(".dt-push-menu"),me=new Set,en=new Set,Gn=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",Yn=()=>n.client||Vt()||v?[]:vt.filter(t=>t.status!=="done"&&St(t.assignee)&&Gt(t)==="approved"&&!Fe(t)&&!ie(t)&&!yn.has(t.id)),Xn=()=>Yn().filter(t=>!me.has(t.id)),pa=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?jt:""}</i>`,ha=()=>{let t=Yn(),e=[...new Set(t.map(o=>o.route??"/"))],s=Xn().length;he.innerHTML=`<div class="dt-push-head">${ee(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),i=a.filter(l=>!me.has(l.id)).length;return`<button type="button" class="dt-push-page${en.has(o)?" is-open":""}" data-push-route="${p(o)}"><span data-push-fold="${p(o)}">${en.has(o)?"\u25BE":"\u25B8"}</span>${pa(i>0,i>0&&i<a.length)}<span class="dt-push-route">${p(o)}</span><em>${a.length}</em></button>`+(en.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${pa(!me.has(l.id))}<span><small>#${l.id}</small>${p(l.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>${ee(13)}Send ${s} to Claude</button>`},Vs=()=>["push","paused"].includes(Gn()),Ks=()=>Kt.ids.filter(t=>{let e=vt.find(s=>s.id===t);return!!e&&e.status!=="done"&&Gt(e)!=="review"&&(yn.has(t)||!!Fe(e)||Gt(e)==="approved")}),ma="",zr=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Pe=()=>{let t=Gn(),e=Xn().length,s=Ks(),o=Kt.ids.length-s.length,a=s.length>0&&Vs();if(Zt.classList.toggle("is-working",a),s.length&&(ma=Kt.at),!s.length&&Kt.ids.length&&Kt.at&&ma===Kt.at&&!zr(Kt.at)){try{sessionStorage.setItem("nm-batch-done",Kt.at)}catch{}vt.length&&Re(`Claude finished ${Kt.ids.length} \u2014 check the fixes`,()=>zn.start(),"Check")}Zt.hidden=n.client||Vt()||v,Zt.classList.toggle("is-live",Vs()),Zt.classList.toggle("is-quiet",t==="on");let i=Zt.querySelector(".dt-push-n");i.textContent=String(a?s.length:e),i.hidden=a?!1:!e||t==="on",Zt.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude is on ${s.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to Claude: turbo is on \u2014 Claude takes each comment as it lands":t==="none"?`Push to Claude: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to Claude: ${e} ${e===1?"comment waits":"comments wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark comments for Claude, then send them here",document.querySelector(".devtools")?.style.setProperty("--dt-push-w",Zt.hidden?"0px":`${Zt.offsetWidth+8}px`),(Zt.hidden||!Yn().length)&&(he.hidden=!0),he.hidden||ha()},ga=async t=>{if(!t.length&&Vs()){Ht("Nothing waits for Claude \u2014 mark comments for Claude first");return}if(Gn()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Ht("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(Gn()==="on"){Ht("Turbo is on \u2014 Claude takes each comment as it lands");return}he.hidden=!0;let e=t.map(o=>o.id),s=await Lt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!s?.ok){wn("Could not send them to Claude",s);return}for(let o of e)yn.add(o);Kt={at:Kt.ids.some(o=>Ks().includes(o))?Kt.at:new Date().toISOString(),ids:[...new Set([...Ks(),...e])]},Pe(),Re(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await Lt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)yn.delete(o);Pe()}),Oe()},Jn=Zt.querySelector(".dt-push-all"),ba=0,Us=!1,fa=()=>{he.hidden=!1,ha()};Jn.addEventListener("click",()=>{if(Us){Us=!1;return}ga(Xn())}),Jn.addEventListener("contextmenu",t=>{t.preventDefault(),he.hidden?fa():he.hidden=!0}),Jn.addEventListener("pointerdown",t=>{t.button===0&&(ba=window.setTimeout(()=>{Us=!0,fa()},500))});for(let t of["pointerup","pointerleave","pointercancel"])Jn.addEventListener(t,()=>clearTimeout(ba));he.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){ga(Xn());return}if(i==="all")me.clear();else if(s){let l=s.dataset.pushFold;en.has(l)?en.delete(l):en.add(l)}else if(o){let l=Yn().filter(b=>(b.route??"/")===o.dataset.pushRoute),m=l.some(b=>!me.has(b.id));for(let b of l)m?me.add(b.id):me.delete(b.id)}else if(a){let l=Number(a.dataset.pushId);me.has(l)?me.delete(l):me.add(l)}Pe()}),document.addEventListener("pointerdown",t=>{!he.hidden&&!Zt.contains(t.target)&&(he.hidden=!0)},!0),setInterval(Pe,3e4),ua=Pe;let ya=document.querySelector(".dt-turbo");ya&&new MutationObserver(Pe).observe(ya,{attributes:!0,attributeFilter:["data-state"]}),Pe();let Zn="",Gs=!1,va=t=>{Zn=t.version??"",Wr(t);let e=t.turbo;yn=new Set(e?.push?.ids??[]),Kt={at:e?.batch?.at??"",ids:e?.batch?.ids??[]};let s=tn(t.comments);Un(s);let o=s.filter(a=>a.route===k);if(!(Cn&&(K=o,wa()))){if(JSON.stringify(o)===JSON.stringify(K)){!I.hidden&&!v&&J();return}if(X.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){Zn="",setTimeout(vn,5e3);return}K=o,J(),Qt({reload:!0})}},Ie=async(t=!1)=>{let e=[t||!Zn?"":`since=${Zn}`,ae||ke?"":"open=1"].filter(Boolean).join("&");try{let s=await Lt(`comments${e?`?${e}`:""}`);s.status===200&&va(await s.json())}catch{}},vn=async()=>{document.hidden||Gs||Os||(Gs=!0,await Ie(),Gs=!1)},wa=()=>{let t=Cn&&K.find(e=>e.id===Cn);return t?(Cn=0,Ge()&&!cn(t)&&Kn($t(t)?"clients":"studio"),At||$e(!0),fn(t.id),!0):!1},Ys=()=>{K=vt.filter(t=>t.route===k),wa()||J()},Xs=0,$a=t=>{Xs||(Xs=requestAnimationFrame(()=>{Xs=0;let e=t.target;if(!At||e.closest(Mt)){pt.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(pt.hidden=!1,!s)return;let o=s.getBoundingClientRect();qt.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,se.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)}`,se.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},xa=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),ht){ht=null,J();return}if(A){ct()&&(P(),J());return}if(Q!==null){Q=null,J();return}$e(!1)}},Ea=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Ma=t=>{t.target.closest?.(Mt)||t.stopPropagation()},ka=t=>{if(t.target.closest(Mt))return;if(t.preventDefault(),t.stopPropagation(),ut){ut=!1;return}if(!getSelection()?.isCollapsed)return;X.hidden=!0;let s=document.elementFromPoint(t.clientX,t.clientY);if(X.hidden=!1,!s||!ct())return;P();let o=s.getBoundingClientRect(),a=s.tagName.toLowerCase(),i=[...s.classList].filter(m=>!/^(astro|svelte|css)-/.test(m)).slice(0,2);A={selector:yo(s),tag:a,classes:i,nth:vo({tag:a,classes:i}).indexOf(s),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Dt(s.textContent||"").slice(0,60),ctx:wo(s),category:g[0].id,...Ge()&&Ue==="clients"?{shared:!0}:{}};let l=n.client||Vt()||A.shared?null:vs();l&&(A.assignee=l,A.stage=St(l)?"approved":"new"),Sa.set(A,Jr().then(()=>Js(s))),Q=null,pt.hidden=!0,J()},Vr=2200,Kr=900*1024,La=8*1024*1024,Ur=3*1024*1024,Gr=50*1024*1024,Yr=1200,Xr=1600,Js=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let i=e.getBoundingClientRect();if(i.width>=360&&i.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 i=getComputedStyle(a).backgroundColor;i&&i!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(i)&&(o=i)}if(!o){let[a,i,l]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*i+.114*l>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),i=Math.min(1,Yr/s.width,Xr/s.height),l=await Promise.race([a(e,{scale:i,quality:.8,timeout:4e3,backgroundColor:o,filter:m=>!(m instanceof Element&&m.closest(Me))}),new Promise(m=>setTimeout(()=>m(null),8e3))]);return l&&l.length<La?l:null}catch{return null}},Sa=new WeakMap,Jr=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Ht=(t,e=2800)=>{let s=document.createElement("div");return s.className="dt-toast",s.textContent=t,document.body.append(s),setTimeout(()=>s.remove(),e),s},Ta=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),i=qn.get(o);if(qn.delete(o),!i){Ht(`${a} was not sent \u2014 attach it again`);continue}let l=Ht(`Uploading ${a}\u2026`,12e4),m=await Lt("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(u=>u.ok?u.json():null).catch(()=>null),b=m&&await fetch(m.url,{method:"PUT",headers:{"content-type":m.type,"x-upsert":"false"},body:i}).catch(()=>null),O=b?.ok&&await y({id:t,uploaded:[m.name]}).catch(()=>null);if(l.remove(),!O||!O.ok){Ht(b===null&&m?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let _=tn([await O.json().catch(()=>null)])[0];_&&(K=K.map(u=>u.id===_.id?_:u),J()),Ht(`${a} sent`)}},wn=(t,e)=>Ht(navigator.onLine?`${t}${e?` (${e.status})`:""}.`:`${t} \u2014 you are offline. Try again once you are back online.`,6e3),Zr=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),Qr=async t=>{let e=await createImageBitmap(t),s=Math.min(1,Vr/Math.max(e.width,e.height));if(s===1&&t.size<=Kr)return e.close(),Zr(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)},Zs=async(t,e)=>{let s=[],o=(a,i)=>s.push(`${Dn}${a}\0${i}`);for(let a of t){let i,l=ii(a.name)||Object.keys(Mn).find(m=>Mn[m]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,ro.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>Gr){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>Ur&&Ut.via){let b=`${Date.now()}-${qn.size}`;qn.set(b,a),s.push(`${Hs}${b}\0${a.name}\0${a.size}`);continue}let m=await new Promise((b,O)=>{let _=new FileReader;_.onload=()=>b(String(_.result).split(",")[1]),_.onerror=O,_.readAsDataURL(a)}).catch(()=>"");m?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${ai(a.name)||"file"};ext=${l};base64,${m}`):o(a.name,"Could not be read");continue}try{i=await Qr(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>La){o(a.name,"Too large even after shrinking");continue}s.push(i)}if(s.length){if(!Number(e?.dataset.id)){A&&((A.images??=[]).push(...s),J());return}xt.push(...s),J(),Qn(".dt-note-reply-input")}},Aa=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);X.addEventListener("paste",t=>{let e=Aa(t.clipboardData?.items);e.length&&(t.preventDefault(),Zs(e,t.target.closest(".dt-note")))}),X.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),X.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),X.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=Aa(t.dataTransfer?.items);s.length&&Zs(s,e)});let Qn=t=>{let e=X.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},Ca=()=>{Qn(".dt-note-edit-input"),X.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Qs=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=Rs-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},tl=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),el=()=>n.client||Vt()||A?.shared||Q!=null&&$t(K.find(t=>t.id===Q))?[]:ls(),Ha=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let s=tl(t);if(!s)return;let o=s[1].toLowerCase(),a=(n.team??[]).filter(l=>[l.name,l.nickname,l.email].some(m=>m?.toLowerCase().startsWith(o))).slice(0,5),i=el().filter(l=>l.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!a.length&&!i.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...a.map(l=>`<button type="button" role="option" data-act="mention" data-handle="${p(ci(l))}">${Rn(l.avatar_url,l.name||l.email)}<span class="dt-mention-who"><b>${p(l.name||l.email)}</b>${l.name?`<span>${p(l.email)}</span>`:""}</span></button>`),...i.map(l=>`<button type="button" role="option" data-act="mention" data-handle="${p(l.handle)}">${Gi(l.owner)}<span class="dt-mention-who"><b>${p(l.handle)}</b><span>${l.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((l,m)=>l.replace('role="option"',`role="option" aria-selected="${m===0}"`)).join("")}</div>`)},Ba=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...ls().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>p(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=p(t);return e.length?s.replace(new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"),o=>`<span class="dt-at">${o}</span>`):s},Na=(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()},nl=(t,e)=>{if(!t){A&&(A.category=e),J();return}Jt(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>y({id:t,category:e}),"Changing the type")};ki([X,I],p,jt),I.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&ys(Number(e.dataset.id),e.value)}),I.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let s=e.dataset.v;ys(Number(e.dataset.id),s==="agent"?bs:s==="person"?fs():"")},!0);let sl=t=>$t(t)?"studio":"clients",Ra=async(t,e=!1)=>{let s=K.find(a=>a.id===t);if(!s)return;let o=!$t(s);Q===t&&(Q=null),await Jt(a=>a.map(i=>i.id===t?{...i,shared:o||void 0,client:o?i.client:void 0}:i),()=>y(o?{id:t,shared:o}:{id:t,shared:!1,client:!1}),o?"Moving it to clients":"Moving it to the workspace"),Un(vt),e||Re(o?"Moved to clients":"Moved to the workspace",()=>Ra(t,!0))},ol=async t=>{let e=K.find(m=>m.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...$t(e)?{}:{shared:!0}};for(let m of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[m]!=null&&(o[m]=s[m]);let a=await Wn(Lt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){wn("The copy was not made",a);return}let i=tn([await a.json().catch(()=>null)])[0];i&&(vt=[...vt,i],K=vt.filter(m=>m.route===k)),Un(vt),J(),Oe();let l=sl(e);Re(l==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{i&&(Kn(l),fn(i.id))},"Open")},al=t=>{let e=`${location.origin}${location.pathname}?notemend#thread-${t}`;navigator.clipboard?.writeText(e).then(()=>Ht("Link copied"),()=>Ht(e,6e3))};X.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let l=e.value,m=Number(e.dataset.id)||0;e.value="",l==="dup"?ol(m):l==="move"?Ra(m):l==="link"?al(m):l==="reopen"?we(m,!1):l==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(Q=null,Ds(m)):l==="discard"&&(A=null,J());return}let s=t.target.closest(".dt-lang-select");if(s){Go(Number(s.dataset.id),s.dataset.at,s.value);return}let o=t.target.closest(".dt-cat-select");if(o){nl(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){er(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-for-select");if(i){if(nt.setItem("nm-for",i.value),n.client){A&&(A.assignee=i.value,vs(i.value),J());return}So(Number(i.dataset.id)||0,"person")}}),X.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&A?.suggest){A.suggest.to=e.value,dn(),Qs(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");s&&(Ha(s),s.classList.contains("dt-note-input")?A&&(A.text=s.value):s.classList.contains("dt-note-edit-input")?ht&&(ht.text=s.value):Pt=s.value,dn(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Qs(s))}),X.addEventListener("keydown",t=>{if(t.key==="Escape"&&X.querySelector(".dt-emoji")){t.stopPropagation();let a=ve?.box??ve?.btn;jn(),a?.focus();return}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()&&Ha(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Na(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())});let rt=null,ts=!1;function to(t){return!n.client||!!n.me&&t.by===n.me.email}let Pa=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},eo=Pa("dt-drag-box--home"),Ia=Pa("dt-drag-box--to"),no=t=>{let e=Dt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Oa=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left-3}px;top:${o.top-3}px;width:${o.width+6}px;height:${o.height+6}px`,t.querySelector("span").textContent=s,t.hidden=!1},il=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(Mt)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,rl=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},ll=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:yo(t),tag:a,classes:i,nth:vo({tag:a,classes:i}).indexOf(t),label:Dt(t.textContent||"").slice(0,60),ctx:wo(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},so=()=>{rt&&(rt.pin.classList.remove("is-dragging"),eo.hidden=Ia.hidden=!0,rt=null,pe())};X.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=K.find(o=>o.id===Number(e.dataset.id));!s||!to(s)||(rt={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:ce(s),to:null},e.setPointerCapture(t.pointerId))}),X.addEventListener("pointermove",t=>{if(!rt||!rt.on&&Math.hypot(t.clientX-rt.x0,t.clientY-rt.y0)<4)return;rt.on=!0,rt.pin.classList.add("is-dragging"),rt.pin.style.left=`${t.clientX}px`,rt.pin.style.top=`${t.clientY}px`,rt.to=rt.home&&rl(rt.home,t.clientX,t.clientY)?rt.home:il(t.clientX,t.clientY);let e=rt.to&&rt.to!==rt.home;Oa(eo,rt.home,e?"":rt.home?no(rt.home):""),eo.classList.toggle("is-left",!!e),Oa(Ia,e?rt.to:null,e?`Move to ${no(rt.to)}`:"")}),X.addEventListener("pointerup",async t=>{if(!rt)return;let e=rt;if(!e.on||!e.to){so();return}ts=!0,setTimeout(()=>{ts=!1},0);let s=K.find(m=>m.id===e.id),o=ll(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(so(),!s)return;let i={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(m,b)=>Jt(O=>O.map(_=>_.id===e.id?{..._,...m}:_),()=>y({id:e.id,move:m}),b);await l(o,"Moving the pin"),a&&Re(`Moved to ${no(e.to)}`,()=>l(i,"Putting the pin back"))}),X.addEventListener("click",t=>{ts&&(t.stopImmediatePropagation(),t.preventDefault(),ts=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&rt?.on&&(t.stopImmediatePropagation(),so())},!0),X.addEventListener("click",async t=>{let e=t.target.closest("button"),s=ve?.btn;if(e?.closest(".dt-emoji")||jn(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="react"){Jo(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Xo(e,o==="emoji-pick",o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&ve){let i=ve;Xo(i.btn,!0,i);return}if(o==="emoji"&&ve){let i=ve;jn(),i.box?Br(i.box,e.dataset.emoji):i.id&&Jo(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?Jt(l=>l.map(m=>m.id===a?{...m,priority:i??void 0}:m),()=>y({id:a,priority:i}),"Setting the priority"):A&&(A.priority=i??void 0,dn(),J());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&Na(i,e.dataset.handle);return}if(!o){if(A&&!ct())return;if(Q=Q===a?null:a,Q!=null&&e.dataset.off){let i=K.find(m=>m.id===a);(i&&ce(i))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}P(),J();return}if(o==="speak"){Er(e.closest(".dt-note"),e);return}if(o==="voice-write"){kr(e);return}if(o==="voice"||o==="voice-seek"){cr(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let i=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");i.addEventListener("change",()=>{i.files?.length&&Zs([...i.files],l)}),i.click();return}if(o==="unshot"){a?ht&&ht.drop.push(e.dataset.img):(e.closest("[data-draft]")?A?.images??[]:xt).splice(Number(e.dataset.i),1),J(),ht&&Ca();return}if(o==="edit"){let i=K.find(b=>b.id===a),l=e.dataset.at||null,m=l?i?.replies?.find(b=>b.at===l)?.text:i?.text;if(m===void 0)return;ht={id:a,at:l,text:m,drop:[]},J(),Ca();return}if(o==="edit-cancel"){ht=null,J();return}if(o==="translate"){Go(a,e.dataset.at);return}if(o==="unsay"){let i=e.dataset.at;if(!confirm("Delete this reply?"))return;await Jt(l=>l.map(m=>m.id!==a?m:{...m,replies:(m.replies??[]).map(b=>b.at===i?{...b,text:"",deleted:!0}:b)}),()=>y({id:a,unsay:i}),"Deleting the reply");return}if(o==="edit-save"){let i=ht;if(!i)return;let l=i.text.trim();if(!l){X.querySelector(".dt-note-edit-input")?.focus();return}ht=null;let m=b=>i.drop.includes(b.split("/").pop());await Jt(b=>b.map(O=>O.id!==i.id?O:{...O,...i.at==null?{text:l}:{replies:(O.replies??[]).map(_=>_.at===i.at?{..._,text:l}:_)},images:(O.images??[]).filter(_=>!m(_))}),()=>y({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(b=>(b.ok||(ht=i),b),b=>{throw ht=i,b}),"Saving the edit");return}if(o==="cancel"){ct()&&(P(),J());return}if(o==="twin"){if(!ct())return;P(),Q=Number(e.dataset.id),J();return}if(o==="discard"){A=null,J();return}if(o==="draft-open"){js(Number(e.dataset.i));return}if(o==="close"){Q=null,J();return}if(o==="where"){let i=K.find(O=>O.id===Number(e.dataset.id)),l=i&&Xt(i)?.hidden;if(!l)return;let m=l.getBoundingClientRect();l.scrollIntoView({block:"nearest",behavior:"smooth"});let b=document.createElement("div");b.className="dt-where",b.style.cssText=`left:${m.left}px;top:${m.top}px;width:${m.width}px;height:${m.height}px`,document.body.append(b),b.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>b.remove());return}if(o==="unsuggest"&&A){A.suggest=null,J();return}if(o==="save"){if(!A)return;A.images&&(A.images=A.images.filter(Y=>!Y.startsWith(Dn)));let i=(A.images??[]).filter(Y=>!Je(Y)),l=A.suggest&&A.suggest.to.trim()!==A.suggest.from?{from:A.suggest.from,to:A.suggest.to.trim()}:null,m=X.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(A.images?.some(Ss)?Uo:A.images?.some(Y=>Je(Y)&&!kn(Y))?"See the attached image":A.images?.length?"See the attached file":"");if(!m){X.querySelector(".dt-note-input")?.focus();return}let b=A,O=n.client?null:uo(m,He()),_=Sa.get(b)??Js(ce(b)),u={...b,images:b.images?.filter(Je),route:k,text:m,suggest:l,assignee:n.client?_o(b.assignee)||void 0:O??(b.assignee||void 0),shared:n.client?!0:b.shared===!0,stage:n.client?"new":O?"approved":b.stage??(St(b.assignee)?"approved":"new"),breakpoint:ps(),browser:ji(),device:v?Da:"",viewport:{w:innerWidth,h:innerHeight},logs:$i(),host:location.host},z={...b,id:-Date.now(),text:m,route:k,status:"open",note:"",doneBy:null,breakpoint:u.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};K=[...K,z],A=null,J();let q=await Wn(Lt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(u)})).catch(()=>null);if(!q?.ok){K=K.filter(Y=>Y!==z),P(),A=b,J(),wn("Comment was not saved",q);return}let lt=tn([await q.json().catch(()=>null)])[0];K=K.map(Y=>Y===z&<?lt:Y),J(),lt&&_.then(Y=>{Y&&y({id:lt.id,before:Y})}),lt&&i.length&&Ta(lt.id,i),Oe();return}if(o==="reply"){let i=X.querySelector(".dt-note-reply-input");xt=xt.filter(Y=>!Y.startsWith(Dn));let l=i.value.trim()||(xt.some(Ss)?Uo:xt.some(Y=>Je(Y)&&!kn(Y))?"See the attached image":xt.length?"See the attached file":"");if(!l){i.focus();return}let m=xt;Pt="",xt=[];let b=K,O=n.client?null:uo(l,He()),_=K.find(Y=>Y.id===a),u=O&&_&&(O!==_.assignee||Gt(_)!=="approved"||_.status==="done")?{assignee:O,stage:"approved",..._.status==="done"?{status:"open",doneBy:null}:{}}:{};K=K.map(Y=>Y.id===a?{...Y,...u,replies:[...Y.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:Y),J();let z=await Wn(y({id:a,reply:l,images:m.filter(Je),...u})).catch(()=>null);if(!z?.ok){K=b,Pt=l,xt=m,J(),wn("Reply was not sent",z);return}let q=tn([await z.json().catch(()=>null)])[0];q&&(K=K.map(Y=>Y.id===q.id?q:Y),J()),Oe();let lt=m.filter(Y=>!Je(Y));lt.length&&Ta(a,lt);return}if(o==="hand"){So(a,e.dataset.v);return}if(o==="sendback"){await we(a,!1),Qn(".dt-note-reply-input");return}if(o==="accept"){await we(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(Q=null),await Ne(a,o==="archive");return}e.classList.contains("dt-step-act")||(Q=null),o==="rm"?await Ds(a):await we(a,o==="done")});let Da="",Qt=t=>{Yt.hidden||Rt.contentWindow?.postMessage({dt:!0,...t},location.origin)},dl=()=>({notes:At,grid:!T.hidden,inspect:E,resolved:ae,archived:ke,...Fa.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!v&&t.source===Rt.contentWindow){if(e.key){Ua(e.key[0],e.key[1])?.run();return}if(e.closeMenus){bt();return}if(e.drafts){Is=e.drafts,Ze(Le());return}}if(v&&typeof e.openDraft=="number"){js(e.openDraft);return}if(v&&typeof e.dropDraft=="number"){ia(e.dropDraft);return}if(v&&typeof e.device=="string"&&(Da=e.device),v&&e.scrollbar&&Ot.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Rt.contentWindow){Qt(dl());return}typeof e.notes=="boolean"&&e.notes!==At&&$e(e.notes,!1),typeof e.open=="number"&&fn(e.open),typeof e.grid=="boolean"&&e.grid===T.hidden&&V(e.grid),typeof e.inspect=="string"&&e.inspect!==E&&R(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==ae&&Ws(e.resolved),typeof e.archived=="boolean"&&e.archived!==ke&&zs(e.archived),e.reload&&Ie()});let Oe=async()=>{await Ie(),Qt({reload:!0}),v&&parent.postMessage({dt:!0,reload:!0},location.origin)},$e=(t,e=!0)=>{if(At=t,D.setAttribute("aria-pressed",String(t)),t?!v&&I.hidden&&nt.getItem("dt-history")!=="0"&&(I.hidden=!1,U.setAttribute("aria-pressed","true")):(I.hidden=!0,U.setAttribute("aria-pressed","false")),L(rn,t?"1":"0"),Qt({notes:t}),v&&e&&parent.postMessage({dt:!0,notes:t},location.origin),X.hidden=!t||!Yt.hidden,Ot.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",ka,!0);for(let s of Ea)document.addEventListener(s,Ma,!0);document.addEventListener("keydown",xa),document.addEventListener("mousemove",$a),addEventListener("scroll",pe,!0),addEventListener("resize",pe),addEventListener("pointerover",ca,!0),$o(),la.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),da.observe(document.body),Ys()}else{P(),Q=null,document.removeEventListener("click",ka,!0);for(let s of Ea)document.removeEventListener(s,Ma,!0);document.removeEventListener("keydown",xa),document.removeEventListener("mousemove",$a),pt.hidden=!0,removeEventListener("scroll",pe,!0),removeEventListener("resize",pe),removeEventListener("pointerover",ca,!0),la.disconnect(),da.disconnect(),X.innerHTML=""}},{pickBp:qa,...Fa}=Ti({cfg:n,inFrame:v,persist:L,frame:Yt,frameEl:Rt,devicesMenu:kt,bpBtns:W,notesOverlay:X,WIDE:h,bpOf:x,currentBp:ps,deviceById:B,notesOn:()=>At,filter:()=>oe,filterTo:t=>{oe=t},dropFrameDrafts:()=>{Is=[]},putAway:()=>{Q=null,P()},tellFrame:Qt,syncBpButtons:fo,render:()=>J(),reread:()=>{At?Ys():J()}}),ja="dt-studio",_a=t=>{Z.setAttribute("aria-pressed",String(t)),Ot.toggle("dt-no-studio",!t),L(ja,t?"1":"0")};Z.addEventListener("click",()=>_a(Z.getAttribute("aria-pressed")!=="true")),_a(nt.getItem(ja)!=="0"),D.addEventListener("click",()=>$e(!At));let Se=document.querySelector(".devtools"),nn=document.querySelector(".dt-tab"),Wa=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-Se.getBoundingClientRect().top)+12}px`);new ResizeObserver(Wa).observe(Se),addEventListener("resize",Wa);let za=t=>{Se.toggleAttribute("data-collapsed",t),nn.toggleAttribute("data-collapsed",t),nn.setAttribute("aria-expanded",String(!t)),nn.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of Se.querySelectorAll(".dt-group"))e.inert=t;t&&bt(),L("dt-collapsed",t?"1":"0")};nn.addEventListener("click",()=>za(!Se.hasAttribute("data-collapsed")));let xe=document.querySelector(".dt-keys"),Va=xe.querySelector(".dt-set-keys"),oo=t=>{Va.hidden=!t,xe.querySelector(".dt-set-main").hidden=t};if(Ut.signOut)for(let t of xe.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;xe.querySelector("summary").addEventListener("click",()=>oo(!1)),xe.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return oo(s==="keys");xe.open=!1,s==="hide"&&nn.click(),s==="out"&&confirm("Sign out of Notemend on this site?")&&Ut.signOut?.()});let ge=t=>()=>Se.querySelector(t)?.click(),Ka=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},es=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:ge(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:ge(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:ge(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>zs(!ke)},{group:"Threads",code:"KeyM",hint:"M",label:"Studio / clients",run:()=>Kn(Ue==="clients"?"studio":"clients")},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:ge(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:ge(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:ge(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:ge(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:ge(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:ge(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:ge(".dt-studio-btn")}]:[],...W.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:()=>{kt.open=!kt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Ka(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Ka(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>nn.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=xe.open&&!Va.hidden;xe.open=!t,oo(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),Ua=(t,e)=>es.find(s=>s.code===t&&!s.shift==!e),cl=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 es){let s=e.el&&Se.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>${p(e)}</span><kbd>${p(s)}</kbd></div>`;if(xe.querySelector(".dt-keys-list").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(es.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+es.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||cl(e.target))return;let s=Ua(e.code,e.shiftKey);s&&(e.preventDefault(),v?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):s.run())}),v){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",s=>{s.key==="Escape"&&e()})}}if(!v){za(nt.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>Se.setAttribute("data-ready",""))),Fa.restore(),V(nt.getItem(F)==="1");let t=nt.getItem(ne);t&&t in _t&&R(t),$e(nt.getItem(rn)==="1")}let Ga=()=>{try{let t=JSON.parse(nt.getItem(de)||"null");Ct=(t?.parked??[]).filter(e=>C(e)),t?.draft&&document.querySelector(t.draft.selector)?(A=t.draft,!At&&!v&&$e(!0)):C(t?.draft)&&Ct.push(t.draft),t?.reply?.text&&(Pt=t.reply.text,Et=Q=t.reply.for??null),(A||Ct.length||Pt)&&J()}catch{nt.removeItem(de)}};Ga();let Ya=()=>setTimeout(()=>{let t=N(location.pathname);t!==k&&(clearTimeout(Ke),us(),k=t,de=fe(),A=null,Ct=[],Pt="",Et=null,Q=null,ht=null,K=[],j(),Ga(),Ys(),Ie())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),Ya()}}addEventListener("popstate",Ya),r.then(async t=>{t.status===200&&va(await t.json())},()=>{}).then(()=>ae?Ie(!0):void 0).then(zn.resume),document.addEventListener("visibilitychange",()=>{document.hidden||vn()}),addEventListener("focus",vn),addEventListener("notemend:changed",()=>{v||vn()});let ul=0;v||setInterval(()=>{(!Ut.live||++ul%6===0)&&vn()},2e4),v&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Pi(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,d=r.showModal,g=null,h=null,x=()=>{if(g){h?.disconnect(),h=null;for(let v of n)document.body.append(v);try{g.hidePopover()}catch{}g.remove(),g=null}},S=()=>{x();let v=document.querySelector("dialog:modal");v&&B(v)},B=v=>{x(),g=document.createElement("div"),g.className="dt-host",g.setAttribute("popover","manual"),g.append(...n),v.append(g);try{g.showPopover()}catch{}v.addEventListener("close",S,{once:!0}),h=new MutationObserver(()=>{v.isConnected||S()}),h.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){d.call(this),this.isConnected&&B(this)}}var Ol=".devtools, [class^='dt-'], [class*=' dt-']";function Ii(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let r=null,d,g=0,h=L=>{let y=L.getAttribute("title");y!==null&&(L.removeAttribute("title"),L.hasAttribute("data-tip")||L.setAttribute("data-tip",y),!L.hasAttribute("aria-label")&&!L.textContent?.trim()&&L.setAttribute("aria-label",y))},x=L=>{let y=L?.closest?.("[data-tip], [title]");return y&&y.closest(Ol)&&!y.closest(".dt-tipbox")?y:null},S=L=>{let y=L.getAttribute("data-tip");if(!y||L.getAttribute("aria-expanded")==="true")return B();n.textContent=y,n.hidden=!1;let N=L.getBoundingClientRect(),k=n.getBoundingClientRect(),f=6,T=8,F=N.bottom+f+k.height<=innerHeight-T;n.style.top=`${F?N.bottom+f:Math.max(T,N.top-f-k.height)}px`,n.style.left=`${Math.min(Math.max(T,N.left+N.width/2-k.width/2),innerWidth-T-k.width)}px`,n.classList.toggle("is-mono",L.classList.contains("dt-note-el")),L.setAttribute("aria-describedby",n.id)},B=()=>{clearTimeout(d),r&&!n.hidden&&(g=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,n.hidden=!0},v=L=>{L!==r&&(B(),h(L),r=L,performance.now()<g?S(L):d=setTimeout(()=>r===L&&S(L),300))};document.addEventListener("pointerover",L=>{let y=x(L.target);y?v(y):r&&!r.contains(L.target)&&B()},!0),document.addEventListener("pointerout",L=>{r&&!r.contains(L.relatedTarget)&&B()},!0),document.addEventListener("focusin",L=>{let y=x(L.target);y&&L.target.matches(":focus-visible")&&v(y)},!0),document.addEventListener("focusout",B,!0),document.addEventListener("pointerdown",B,!0),document.addEventListener("keydown",L=>{L.key==="Escape"&&B()},!0),addEventListener("scroll",B,!0),new MutationObserver(()=>{r&&!r.isConnected&&B()}).observe(document.body,{childList:!0,subtree:!0})}function Oi(){let n=window;if(n.__notemend)return;n.__notemend=!0,wi(d=>d.includes("/__devbar/")||!!Ut.base&&d.startsWith(Ut.base)),Ot.ready=new Promise(d=>{if(!("__next_f"in self))return d();let g=0,h=()=>Object.keys(document.documentElement).some(x=>x.startsWith("__reactFiber$"))||++g>330?d():setTimeout(h,30);h()}),Ot.toggle("dt-in-frame",as);let r=Lt("comments?open=1");ni().then(d=>{Ot.set("--dt-z",String(d.zIndex));let g=d.brand?.color;if(g&&/^#[0-9a-f]{6}$/i.test(g)){let[h,x,S]=[1,3,5].map(B=>parseInt(g.slice(B,B+2),16)/255);Ot.set("--dt-accent",g),Ot.set("--dt-accent-ink",.2126*h+.7152*x+.0722*S>.55?"#000000":"#ffffff")}gi(d),Ri(d,r),Ii(),Pi([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(h=>document.querySelector(h)).filter(h=>!!h))}).catch(d=>console.warn("[notemend] not started:",d))}Oi();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|
|
287
|
+
${Ia("dt-note-input",S.suggest?"Why (optional)":"Comment",S.text??"",'data-act="save"',Ha(S.images))}
|
|
288
|
+
${$a(S.priority,S.category,void 0,S.assignee??"",!1,!1,!!S.shared)}
|
|
289
|
+
</div>`}let d=new Map([...K.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(c=>[c.closest(".dt-note").dataset.id,{top:c.scrollTop,end:c.scrollTop+c.clientHeight>=c.scrollHeight-4}])),b=new Set([...K.querySelectorAll("[data-msg]")].map(c=>c.dataset.msg)),h=K.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Xo(K,o),h&&!K.contains(document.activeElement)&&xs(".dt-note-reply-input");for(let c of K.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let F=c.closest(".dt-note").dataset.id,q=d.get(F);if(!q)continue;let lt=[...c.querySelectorAll("[data-msg]")].filter(it=>!b.has(it.dataset.msg));for(let it of lt)it.classList.add("dt-msg--new");c.scrollTop=q.end&<.length||String(x)===F?c.scrollHeight:q.top;let C=lt.filter(it=>!it.querySelector(".dt-msg-edit")).length;if(C&&!q.end&&String(x)!==F){T[F]=(T[F]??0)+C;let it=T[F],Et=c.parentElement.querySelector(".dt-new-below")??c.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Et.dataset,{act:"newbelow",id:F}),Et.textContent=`${it} new ${it===1?"reply":"replies"} \u2193`}}for(let c of K.querySelectorAll(".dt-new-below")){let F=c.closest(".dt-note")?.querySelector(".dt-note-thread");(!F||F.scrollTop+F.clientHeight>=F.scrollHeight-4)&&(delete T[c.dataset.id],c.remove())}x=null;let N=Math.min(innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8;for(let c of K.querySelectorAll(".dt-note")){let F=c.getBoundingClientRect(),q=F.top,lt=N-q,C=q-32;F.bottom>N&&C>lt&&(c.dataset.flip="1"),F.right>innerWidth-8&&(c.dataset.flipx="1"),F=c.getBoundingClientRect();let it=c.dataset.flip?F.height-(N-8):F.bottom-N,Et=c.querySelector(".dt-note-thread");it>0&&Et&&(Et.style.maxHeight=`${Math.max(40,Et.clientHeight-it)}px`),c.getBoundingClientRect().height>N-8&&(Object.assign(c.style,{maxHeight:`${N-8}px`,overflowY:"auto"}),c.classList.add("is-capped"),xn.has(c)||(xn.add(c),c.scrollTop=c.scrollHeight));let ne=c.getBoundingClientRect().bottom-N;ne>0&&(c.style.marginTop=`${-ne}px`);let mt=c.getBoundingClientRect().top;mt<8&&(c.style.marginTop=`${(parseFloat(c.style.marginTop)||0)+8-mt}px`)}hn(s),Vs(Ks()),ce();for(let c of K.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Ro(c);let V=K.querySelector(".dt-note-input");V&&document.activeElement!==V&&(V.focus(),V.setSelectionRange(V.value.length,V.value.length))},Bl=()=>{let t=!1,e=[];for(let s of K.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(s.classList.contains("dt-note--orphan")||s.classList.contains("is-dragging"))continue;let o=G.find(r=>r.id===Number(s.dataset.id)),a=o&&Qt(o);e.push([s,a&&s.matches(".dt-pin")&&Jn(a.el,a.x,a.y)?null:a]),a&&aa(a.el)&&(t=!0)}for(let s of K.querySelectorAll("[data-draft], [data-parked]")){if(s.classList.contains("dt-note--orphan"))continue;let o=s.dataset.parked?dt[Number(s.dataset.parked)]:S;e.push([s,o?Qt(o):null])}for(let[s,o]of e){if(!o){s.style.visibility="hidden";let a=s.nextElementSibling;a?.matches(".dt-pin-eye")&&(a.hidden=!0);continue}if(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,s.classList.toggle("dt-pin--hidden",!!o.hidden);let a=s.nextElementSibling;a?.matches(".dt-pin-eye")&&(a.hidden=!o.hidden,a.style.left=`${o.x}px`,a.style.top=`${o.y}px`)}s.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!es.length&&(S||nt!=null)){let s=Ks();s&&aa(s)&&Vs(s)}Oe(S||nt!=null?Ks():null),t&&ce()},hn=t=>{if(!ct.hidden&&(Xo(ct,Sr({bp:t,notes:G.filter(dn),breakpoints:l,bandOfNote:k,orphan:e=>!Qt(e),hiddenNow:e=>!!Qt(e)?.hidden,whoseAgent:We,statusTools:e=>_a(e,!fa(e)),showResolved:Zt,showArchived:ve,archived:oe,drafts:Kt.hidden?Da():mo,checks:f?0:gs.toCheck().length,marker:Pl,assign:fa,find:Gt,forMe:Rl,forAgent:e=>!!se(e)&&bt(e)!=="done",unread:Qs,agentless:e=>n.client||It()||Mt(e),archives:!n.client&&!It()})),mn)){let e=ct.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(mn.at,mn.at),mn=null}},mn=null,Rl=t=>{if(bt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||bt(t)==="claude"||Jt(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return Se(t).some(s=>s.text.toLowerCase().includes("@"+e))},Pl=t=>{let e=se(t),s=Zs[e??""],o=bt(t)==="done"?oe(t)?`<i class="dt-hist-badge is-archived">${rs}</i>`:`<i class="dt-hist-badge is-done">${qt}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Wt(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Ln.find(r=>r[0]===un(t))[2]}"></i>`,a=ha(t);return a?`<span class="dt-hist-face" style="--hue:${kn(t.by||t.byName||"")}">${a}${o}</span>`:`<span class="dt-hist-n" style="--cat:${Qe(t.category).color}">${o}</span>`},bo=t=>ct.toggleAttribute("data-collapsed",t);ct.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(Gt.q=e.value,mn={at:e.selectionStart??e.value.length},hn(we()))}),ct.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Ge(),setTimeout(()=>delete e.dataset.spin,500);return}if(ct.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){bo(!1);return}if(t.target.closest("[data-fold]")){bo(!ct.hasAttribute("data-collapsed"));return}let s=t.target.closest(".dt-hist-bands [data-bp]");if(s){Hi(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?(Gt.view=o.dataset.histView,$("dt-view",Gt.view),Gt.menu=!1):o.dataset.histSort?(Gt.sort=o.dataset.histSort,$("dt-sort",Gt.sort),Gt.menu=!1):o.hasAttribute("data-hist-clear")?(Gt.q="",mn={at:0}):Gt.menu=!Gt.menu,hn(we());return}Gt.menu&&!t.target.closest(".dt-hist-menu")&&(Gt.menu=!1,hn(we()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let F=a.dataset.draftRm!==void 0,q=Number(F?a.dataset.draftRm:a.dataset.draftGo);Kt.hidden?F?Ka(q):yo(q):ee(F?{dropDraft:q}:{openDraft:q});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await Me(Number(r.dataset.unmark),!1);return}let d=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(d){await Me(Number(d.dataset.id),d.dataset.act==="done");return}let b=t.target.closest("[data-rm]");if(b){if(!confirm("Delete this thread and its replies? This cannot be undone."))return;nt=null,await go(Number(b.dataset.rm));return}if(t.target.closest("[data-review]")){gs.start();return}if(t.target.closest("[data-resolved]")){wo(!Zt);return}if(t.target.closest("[data-archived]")){$o(!ve);return}let h=t.target.closest("[data-archive-all]");if(h){let F=h.dataset.archiveAll.split(",").map(Number);for(let q of F)await ze(q,!0,!0);He(`Archived ${F.length}`,()=>{for(let q of F)ze(q,!1,!0)});return}let N=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(N){await ze(Number(N.dataset.id),N.dataset.act==="archive");return}let V=t.target.closest("[data-go]");if(!V)return;let c=Number(V.dataset.go);if(!Kt.hidden){ee({open:c});return}Hn(c)});let Hn=t=>{nt=t,Tt(),et();let e=G.find(o=>o.id===t),s=e&&Qt(e);s?scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"}):e&&de(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||K.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},yo=t=>{let[e]=dt.splice(t,1);if(!e)return;Tt(),S=e,nt=null;let s=Qt(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),et()},Ka=t=>{dt.splice(t,1),et()},gs=Tr({inFrame:f,everything:()=>xt,route:()=>Q,settle:Me,keepIn:on,toast:t=>Lt(t),waits:t=>bt(t)==="claude"||bt(t)==="done"&&!oe(t),approve:t=>bt(t)==="claude"?Me(t.id,!0):ze(t.id,!0,!0),open:t=>{if($t||he(!0),k(t)!==we()){Hi(k(t));for(let e of[600,1500])setTimeout(()=>ee({open:t.id}),e)}else Hn(t.id)}}),Ol=t=>{ct.hidden=!t,at.setAttribute("aria-pressed",String(t)),$("dt-history",t?"1":"0"),et()},vo=document.querySelector(".dt-resolved-btn"),Nn=document.querySelector(".dt-space"),Il=t=>{if(!Nn)return;Nn.hidden=!Ce(),Nn.dataset.on=ye;let e=document.documentElement,s=e.dataset.dtSpace==="clients";Ce()&&ye==="clients"?(e.dataset.dtSpace="clients",s||(e.classList.add("dt-client-glow"),window.setTimeout(()=>e.classList.remove("dt-client-glow"),1700))):delete e.dataset.dtSpace;for(let o of Nn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===ye));let r=o.querySelector(".dt-space-n");r.textContent=String(t[a]),r.hidden=!t[a]}},Ua=0,Bn=t=>{if(!Ce()||t===ye)return;let e=()=>{ye=t,$("dt-space",t),nt!=null&&!dn(G.find(o=>o.id===nt))&&(nt=null),Tt(),fs(xt),et(),hn(we())};if(matchMedia("(prefers-reduced-motion: reduce)").matches)return e();let s=document.documentElement;s.classList.add("dt-switching"),clearTimeout(Ua),Ua=window.setTimeout(()=>{e(),requestAnimationFrame(()=>s.classList.remove("dt-switching"))},120)};document.querySelector(".dt-client-x")?.addEventListener("click",()=>Bn("studio")),Nn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&Bn(e.dataset.space)});let Ne=document.querySelector(".dt-pinf"),Rn=Ne.querySelector(".dt-pinf-btn"),ie=Ne.querySelector(".dt-pinf-menu"),Ga={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",claude:"My Claude",wrote:"Written by me",check:"To check"},Dl=()=>G.filter(t=>k(t)===we()&&Qo(t)&&dn(t)),Pn=(t,e=!1)=>{ie.hidden=!t,Rn.setAttribute("aria-expanded",String(t)),t&&(_s(),e&&ie.querySelector('[aria-checked="true"]')?.focus())};_s=()=>{let t=Dl();if(Ne.hidden=!Ce()||!t.length,Ne.hidden){ie.hidden=!0;return}let e=Object.fromEntries(Zo.map(C=>[C,t.filter(it=>wa(it,C)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",kn(s)],["others","var(--dt-faint)"]],a=o.reduce((C,[it])=>C+e[it],0)||1,r=11.75,d=o.filter(([C])=>e[C]).length>1?.42:0,b=2*Math.PI*r,h=0,N="";for(let[C,it]of o){let Et=2*Math.PI*e[C]/a;e[C]&&(N+=`<circle cx="20" cy="20" r="${r}" stroke="${it}" stroke-dasharray="${(Math.max(.3,Et-d)*r).toFixed(2)} ${b.toFixed(2)}" stroke-dashoffset="${(-(h+d/2)*r).toFixed(2)}"${le===C?' class="is-on"':le!=="all"?' class="is-off"':""}/>`),h+=Et}if(Ne.querySelector(".dt-pinf-arcs").innerHTML=N,Ne.querySelector(".dt-pinf-n").textContent=String(e[le]),Rn.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} nobody has, ${e.mine} mine, ${e.others} everyone else's${le==="all"?"":`; showing ${Ga[le]}, ${e[le]}`}`),ie.hidden)return;let V=[...new Set(t.map(C=>Is(C,bt(C))?.taker).filter(C=>!!C&&C!==s))].slice(0,2),c=C=>cn($e(C)?.avatar_url,$e(C)?.name||C,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${kn(C)}" `),F={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:c(s),others:V.map(c).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${Wt(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:ss(Ln[2][2],Ln[2][3])},q=(C,it)=>`<b class="dt-pinf-share"><i style="--c:${it};width:${Math.round(100*e[C]/e.all)}%"></i></b>`,lt=(C,it="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${le===C}" data-pinf="${C}"><i class="dt-pinf-glyph">${F[C]}</i><span>${Ga[C]}</span>${it?q(C,it):""}<em>${e[C]}</em>${qt}</button>`;ie.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${lt("all")}${o.map(([C,it])=>lt(C,it)).join("")}<hr>${lt("claude")}${lt("wrote")}${lt("check")}${n.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Rn.addEventListener("click",t=>Pn(ie.hidden,t.detail===0)),ie.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(le=e.dataset.pinf,$("dt-pinf",le),Pn(!1),Rn.focus(),$t?et():he(!0))}),ie.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Pn(!1),Rn.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...ie.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!ie.hidden&&!Ne.contains(t.target)&&Pn(!1)},!0);let wo=t=>{Zt=t,vo.setAttribute("aria-pressed",String(t)),$("dt-resolved",t?"1":"0"),ee({resolved:t}),et(),Ke(!0)},$o=t=>{ve=t,$("dt-archived",t?"1":"0"),ee({archived:t}),et(),Ke(!0)};vo.addEventListener("click",()=>wo(!Zt)),vo.setAttribute("aria-pressed",String(Zt)),at.addEventListener("click",()=>{let t=ct.hidden===!0;t&&!$t&&he(!0),t&&bo(!1),Ol(t)});let ce=()=>{De||!$t||(De=requestAnimationFrame(()=>{De=0,Bl()}))},Ya=`${be}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,ql=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Ya))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Ya))},Xa=()=>{let t=document.querySelector(".dt-room")??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==t&&document.body.append(t)},Ja=new MutationObserver(t=>{$t&&!f&&document.body.lastElementChild?.className!=="dt-room"&&Xa(),!t.every(ql)&&(oa(),ce())}),Za=new ResizeObserver(()=>ce()),Qa=()=>{K.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&ce()},xt=[],ti=()=>{},On=new Set,Yt={at:"",ids:[]},fs=t=>{xt=t,queueMicrotask(()=>ti());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={},o={studio:0,clients:0};for(let h of t){if(oe(h)||(bt(h)!=="done"&&o[Mt(h)?"clients":"studio"]++,!dn(h)))continue;let N=bt(h),V=se(h),c=N==="done"?"done":N==="claude"?"review":V&&os[V]||un(h),F=s[h.route??""]??={...e(),bands:{}};F[c]++;let q=k(h);(F.bands[q]??=e())[c]++}Il(o);let a=["new","progress","review","waiting","done"],r={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},d=h=>a.map(N=>[N,N==="done"&&!Zt?0:h[N]]),b=h=>d(h).reduce((N,[,V])=>N+V,0);for(let h of document.querySelectorAll(".dt-pages a")){let N=h.querySelector(".dt-pages-n");if(!N)continue;let V=s[new URL(h.href).pathname.replace(/\/+$/,"")||"/"];for(let q of l){let lt=V?.bands[q.id];for(let[C,it]of d(lt??e())){let Et=N.querySelector(`[data-bp="${q.id}"][data-state="${C}"]`);Et.hidden=!it,it&&(Et.querySelector("i").textContent=String(it),Et.title=`${q.label}: ${it} ${r[C]}`)}}let c=V?b(V):0;N.hidden=!c;let F=V?l.filter(q=>V.bands[q.id]&&b(V.bands[q.id])).map(q=>`${q.label} ${b(V.bands[q.id])}`).join(" \xB7 "):"";N.title=c?`${a.filter(q=>V[q]).map(q=>`${V[q]} ${r[q]}`).join(" \xB7 ")}
|
|
290
|
+
${F}`:""}},gn=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"):[]})),Fl=Ar(f,t=>Lt(t)),Xt=document.querySelector(".dt-push"),ue=Xt.querySelector(".dt-push-menu"),pe=new Set,fn=new Set,bs=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ys=()=>n.client||It()||f?[]:xt.filter(t=>t.status!=="done"&&At(t.assignee)&&Jt(t)==="approved"&&!Re(t)&&!oe(t)&&!On.has(t.id)),vs=()=>ys().filter(t=>!pe.has(t.id)),ei=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?qt:""}</i>`,ni=()=>{let t=ys(),e=[...new Set(t.map(o=>o.route??"/"))],s=vs().length;ue.innerHTML=`<div class="dt-push-head">${Wt(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(d=>(d.route??"/")===o),r=a.filter(d=>!pe.has(d.id)).length;return`<button type="button" class="dt-push-page${fn.has(o)?" is-open":""}" data-push-route="${g(o)}"><span data-push-fold="${g(o)}">${fn.has(o)?"\u25BE":"\u25B8"}</span>${ei(r>0,r>0&&r<a.length)}<span class="dt-push-route">${g(o)}</span><em>${a.length}</em></button>`+(fn.has(o)?a.map(d=>`<button type="button" class="dt-push-thread" data-push-id="${d.id}">${ei(!pe.has(d.id))}<span><small>#${d.id}</small>${g(d.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>${Wt(13)}Send ${s} to Claude</button>`},xo=()=>["push","paused"].includes(bs()),Eo=()=>Yt.ids.filter(t=>{let e=xt.find(s=>s.id===t);return!!e&&e.status!=="done"&&Jt(e)!=="review"&&(On.has(t)||!!Re(e)||Jt(e)==="approved")}),si="",jl=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Ve=()=>{let t=bs(),e=vs().length,s=Eo(),o=Yt.ids.length-s.length,a=s.length>0&&xo();if(Xt.classList.toggle("is-working",a),s.length&&(si=Yt.at),!s.length&&Yt.ids.length&&Yt.at&&si===Yt.at&&!jl(Yt.at)){try{sessionStorage.setItem("nm-batch-done",Yt.at)}catch{}xt.length&&He(`Claude finished ${Yt.ids.length} \u2014 check the fixes`,()=>gs.start(),"Check")}Xt.hidden=n.client||It()||f,Xt.classList.toggle("is-live",xo()),Xt.classList.toggle("is-quiet",t==="on");let r=Xt.querySelector(".dt-push-n");r.textContent=String(a?s.length:e),r.hidden=a?!1:!e||t==="on",Xt.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude is on ${s.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to Claude: turbo is on \u2014 Claude takes each comment as it lands":t==="none"?`Push to Claude: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to Claude: ${e} ${e===1?"comment waits":"comments wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark comments for Claude, then send them here",(Xt.hidden||!ys().length)&&(ue.hidden=!0),ue.hidden||ni()},oi=async t=>{if(!t.length&&xo()){Lt("Nothing waits for Claude \u2014 mark comments for Claude first");return}if(bs()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Lt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(bs()==="on"){Lt("Turbo is on \u2014 Claude takes each comment as it lands");return}ue.hidden=!0;let e=t.map(o=>o.id),s=await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!s?.ok){qn("Could not send them to Claude",s);return}for(let o of e)On.add(o);Yt={at:Yt.ids.some(o=>Eo().includes(o))?Yt.at:new Date().toISOString(),ids:[...new Set([...Eo(),...e])]},Ve(),He(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)On.delete(o);Ve()}),Ge()},ws=Xt.querySelector(".dt-push-all"),ai=0,Mo=!1,ii=()=>{ue.hidden=!1,ni()};ws.addEventListener("click",()=>{if(Mo){Mo=!1;return}oi(vs())}),ws.addEventListener("contextmenu",t=>{t.preventDefault(),ue.hidden?ii():ue.hidden=!0}),ws.addEventListener("pointerdown",t=>{t.button===0&&(ai=window.setTimeout(()=>{Mo=!0,ii()},500))});for(let t of["pointerup","pointerleave","pointercancel"])ws.addEventListener(t,()=>clearTimeout(ai));ue.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),r=e.closest("[data-push]")?.dataset.push;if(r==="send"){oi(vs());return}if(r==="all")pe.clear();else if(s){let d=s.dataset.pushFold;fn.has(d)?fn.delete(d):fn.add(d)}else if(o){let d=ys().filter(h=>(h.route??"/")===o.dataset.pushRoute),b=d.some(h=>!pe.has(h.id));for(let h of d)b?pe.add(h.id):pe.delete(h.id)}else if(a){let d=Number(a.dataset.pushId);pe.has(d)?pe.delete(d):pe.add(d)}Ve()}),document.addEventListener("pointerdown",t=>{!ue.hidden&&!Xt.contains(t.target)&&(ue.hidden=!0)},!0),new ResizeObserver(()=>document.querySelector(".devtools")?.style.setProperty("--dt-push-w",Xt.hidden?"0px":`${Xt.offsetWidth+8}px`)).observe(Xt),setInterval(Ve,3e4),ti=Ve;let ri=document.querySelector(".dt-turbo");ri&&new MutationObserver(Ve).observe(ri,{attributes:!0,attributeFilter:["data-state"]}),Ve();let In="",ko=!1,bn="dt-threads",li=String([Dt.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Lo="",$s=null,_l=t=>{f||t.version&&t.version===Lo||($s||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=$s;$s=null,Lo=e.version??"";let s=JSON.stringify({project:li,body:e});s.length<2e6?st.setItem(bn,s):st.removeItem(bn)},{timeout:3e3}),$s=t)},So=(t,e=!1)=>{In=t.version??"",Fl(t);let s=t.turbo;On=new Set(s?.push?.ids??[]),Yt={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=gn(t.comments);if(e&&(Zt||ve)){let r=new Set(o.map(d=>d.id));o=[...o,...xt.filter(d=>bt(d)==="done"&&!r.has(d.id))]}_l({...t,comments:o}),fs(o);let a=o.filter(r=>r.route===Q);if(!(Qn&&(G=a,di()))){if(JSON.stringify(a)===JSON.stringify(G)){!ct.hidden&&!f&&et();return}G=a,et(),ee({reload:!0})}},Ke=async(t=!1)=>{let e=[t||!In?"":`since=${In}`,Zt||ve?"":"open=1"].filter(Boolean).join("&");try{let s=await Ct(`comments${e?`?${e}`:""}`);s.status===200&&So(await s.json())}catch{}},Dn=!1,Ue=async()=>{if(!document.hidden){if(ko||hs){Dn=!0;return}ko=!0,await Ke(),ko=!1,Dn&&(Dn=!1,Ue())}};Wa=()=>{Dn&&!hs&&(Dn=!1,Ue())};let di=()=>{let t=Qn&&G.find(e=>e.id===Qn);return t?(Qn=0,Ce()&&!dn(t)&&Bn(Mt(t)?"clients":"studio"),$t||he(!0),Hn(t.id),!0):!1},To=()=>{G=xt.filter(t=>t.route===Q),di()||et()},Ao=0,Co=null,ci=()=>{Co&&$t&&Ho(Co)},Ho=t=>{Co=t,!Ao&&(Ao=requestAnimationFrame(()=>{Ao=0;let e=t.target;if(!$t||e.closest(St)){Bt.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(Bt.hidden=!1,!s)return;let o=s.getBoundingClientRect();sn.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,fe.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)}`,fe.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},ui=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),J){J=null,et();return}if(S){qe()&&(Tt(),et());return}if(nt!==null){nt=null,et();return}he(!1)}},pi=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],hi=!1,mi=t=>{t.type==="pointerdown"&&(hi=t.pointerType==="touch"),!t.target.closest?.(St)&&t.stopPropagation()},gi=t=>{hi&&!t.target.closest?.(St)&&t.preventDefault()},fi=t=>{if(t.target.closest(St))return;if(t.preventDefault(),t.stopPropagation(),I){I=!1;return}if(!getSelection()?.isCollapsed)return;K.hidden=!0;let s=document.elementFromPoint(t.clientX,t.clientY);if(K.hidden=!1,!s||!qe())return;Tt();let o=s.getBoundingClientRect(),a=s.tagName.toLowerCase(),r=[...s.classList].filter(b=>!/^(astro|svelte|css)-/.test(b)).slice(0,2);S={selector:ea(s),tag:a,classes:r,nth:na({tag:a,classes:r}).indexOf(s),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Rt(s.textContent||"").slice(0,60),ctx:sa(s),category:u[0].id,...Ce()&&ye==="clients"?{shared:!0}:{}};let d=n.client||It()||S.shared?null:Xs();d&&(S.assignee=d,S.stage=At(d)?"approved":"new"),yi.set(S,Yl().then(()=>No(s))),nt=null,Bt.hidden=!0,et()},Wl=2200,zl=900*1024,bi=8*1024*1024,Vl=3*1024*1024,Kl=50*1024*1024,Ul=1200,Gl=1600,No=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let r=e.getBoundingClientRect();if(r.width>=360&&r.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 r=getComputedStyle(a).backgroundColor;r&&r!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(r)&&(o=r)}if(!o){let[a,r,d]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*d>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,Ul/s.width,Gl/s.height),d=await Promise.race([a(e,{scale:r,quality:.8,timeout:4e3,backgroundColor:o,filter:b=>!(b instanceof Element&&b.closest(be))}),new Promise(b=>setTimeout(()=>b(null),8e3))]);return d&&d.length<bi?d:null}catch{return null}},yi=new WeakMap,Yl=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Lt=(t,e=2800)=>{let s=document.createElement("div");return s.className="dt-toast",s.textContent=t,document.body.append(s),setTimeout(()=>s.remove(),e),s},vi=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),r=ds.get(o);if(ds.delete(o),!r){Lt(`${a} was not sent \u2014 attach it again`);continue}let d=Lt(`Uploading ${a}\u2026`,12e4),b=await Ct("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(c=>c.ok?c.json():null).catch(()=>null),h=b&&await fetch(b.url,{method:"PUT",headers:{"content-type":b.type,"x-upsert":"false"},body:r}).catch(()=>null),N=h?.ok&&await y({id:t,uploaded:[b.name]}).catch(()=>null);if(d.remove(),!N||!N.ok){Lt(h===null&&b?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let V=gn([await N.json().catch(()=>null)])[0];V&&(G=G.map(c=>c.id===V.id?V:c),et()),Lt(`${a} sent`)}},wi=t=>{let e=t.filter(s=>s.startsWith(ls)).length;return e&&Lt(e===1?"One file was left out \u2014 its chip said why":`${e} files were left out \u2014 their chips said why`,4e3),t.filter(s=>!s.startsWith(ls))},qn=async(t,e)=>{if(!navigator.onLine){Lt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Lt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},Xl=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),Jl=async t=>{let e=await createImageBitmap(t),s=Math.min(1,Wl/Math.max(e.width,e.height));if(s===1&&t.size<=zl)return e.close(),Xl(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)},Bo=async(t,e)=>{let s=[],o=(a,r)=>s.push(`${ls}${a}\0${r}`);for(let a of t){let r,d=tr(a.name)||Object.keys(Wn).find(b=>Wn[b]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!d){o(a.name,_o.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>Kl){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>Vl&&Dt.via){let h=`${Date.now()}-${ds.size}`;ds.set(h,a),s.push(`${lo}${h}\0${a.name}\0${a.size}`);continue}let b=await new Promise((h,N)=>{let V=new FileReader;V.onload=()=>h(String(V.result).split(",")[1]),V.onerror=N,V.readAsDataURL(a)}).catch(()=>"");b?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Qi(a.name)||"file"};ext=${d};base64,${b}`):o(a.name,"Could not be read");continue}try{r=await Jl(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>bi){o(a.name,"Too large even after shrinking");continue}s.push(r)}if(s.length){if(!Number(e?.dataset.id)){S&&((S.images??=[]).push(...s),et());return}O.push(...s),et(),xs(".dt-note-reply-input")}},$i=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);K.addEventListener("paste",t=>{let e=$i(t.clipboardData?.items);e.length&&(t.preventDefault(),Bo(e,t.target.closest(".dt-note")))}),K.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),K.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),K.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=$i(t.dataTransfer?.items);s.length&&Bo(s,e)});let xs=t=>{let e=K.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},xi=()=>{xs(".dt-note-edit-input"),K.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Ro=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=po-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},Zl=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Ql=()=>n.client||It()||S?.shared||nt!=null&&Mt(G.find(t=>t.id===nt))?[]:Os(),Ei=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let s=Zl(t);if(!s)return;let o=s[1].toLowerCase(),a=nt!=null?G.find(h=>h.id===nt):void 0,d=(n.client||It()||S?.shared||a&&Mt(a)?n.team??[]:is()).filter(h=>[h.name,h.nickname,h.email].some(N=>N?.toLowerCase().startsWith(o))).slice(0,5),b=Ql().filter(h=>h.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!d.length&&!b.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(h=>`<button type="button" role="option" data-act="mention" data-handle="${g(or(h))}">${cn(h.avatar_url,h.name||h.email)}<span class="dt-mention-who"><b>${g(h.name||h.email)}</b>${h.name?`<span>${g(h.email)}</span>`:""}</span></button>`),...b.map(h=>`<button type="button" role="option" data-act="mention" data-handle="${g(h.handle)}">${Vr(h.owner)}<span class="dt-mention-who"><b>${g(h.handle)}</b><span>${h.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((h,N)=>h.replace('role="option"',`role="option" aria-selected="${N===0}"`)).join("")}</div>`)},td='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',ed='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',Mi=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Os().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>g(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"):null;return zo(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${g(o.url)}" target="_blank" rel="noopener noreferrer" title="${g(o.url)}">${o.kind==="pr"?td:ka}<span>${g(o.label)}</span>${ed}</a>`:s?g(o).replace(s,a=>`<span class="dt-at">${a}</span>`):g(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let ki=(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()},nd=(t,e)=>{if(!t){S&&(S.category=e),et();return}te(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>y({id:t,category:e}),"Changing the type")};$r([K,ct],g,qt),ct.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&Ys(Number(e.dataset.id),e.value)}),ct.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let s=e.dataset.v;Ys(Number(e.dataset.id),s==="agent"?Us:s==="person"?Gs():"")},!0);let sd=t=>Mt(t)?"studio":"clients",Li=async(t,e=!1)=>{let s=G.find(a=>a.id===t);if(!s||Mt(s)&&s.client)return;let o=!Mt(s);nt===t&&(nt=null),await te(a=>a.map(r=>r.id===t?{...r,shared:o||void 0,client:o?r.client:void 0}:r),()=>y(o?{id:t,shared:o}:{id:t,shared:!1,client:!1}),o?"Moving it to clients":"Moving it to the workspace"),fs(xt),e||He(o?"Moved to clients":"Moved to the workspace",()=>Li(t,!0))},od=async t=>{let e=G.find(b=>b.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...Mt(e)?{}:{shared:!0}};for(let b of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[b]!=null&&(o[b]=s[b]);let a=await ms(Ct("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){qn("The copy was not made",a);return}let r=gn([await a.json().catch(()=>null)])[0];r&&(xt=[...xt,r],G=xt.filter(b=>b.route===Q)),fs(xt),et(),Ge();let d=sd(e);He(d==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{r&&(Bn(d),Hn(r.id))},"Open")},ad=t=>{let e=`${location.origin}${location.pathname}?notemend#thread-${t}`;navigator.clipboard?.writeText(e).then(()=>Lt("Link copied"),()=>Lt(e,6e3))};K.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,b=Number(e.dataset.id)||0;e.value="",d==="dup"?od(b):d==="move"?Li(b):d==="link"?ad(b):d==="reopen"?Me(b,!1):d==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(nt=null,go(b)):d==="discard"&&(S=null,et());return}let s=t.target.closest(".dt-lang-select");if(s){Ba(Number(s.dataset.id),s.dataset.at,s.value);return}let o=t.target.closest(".dt-cat-select");if(o){nd(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){Qr(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(r){if(st.setItem("nm-for",r.value),n.client){S&&(S.assignee=r.value,Xs(r.value),et());return}ua(Number(r.dataset.id)||0,"person")}}),K.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&S?.suggest){S.suggest.to=e.value,Mn(),Ro(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");s&&(Ei(s),s.classList.contains("dt-note-input")?S&&(S.text=s.value):s.classList.contains("dt-note-edit-input")?J&&(J.text=s.value):jt=s.value,Mn(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Ro(s))}),K.addEventListener("keydown",t=>{if(t.key==="Escape"&&K.querySelector(".dt-emoji")){t.stopPropagation();let a=Ee?.box??Ee?.btn;us(),a?.focus();return}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()&&Ei(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),ki(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())});let ft=null,Es=!1;function Po(t){return!n.client||!!n.me&&t.by===n.me.email}let Si=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},Oo=Si("dt-drag-box--home"),Ti=Si("dt-drag-box--to"),Io=t=>{let e=Rt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Ai=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left-3}px;top:${o.top-3}px;width:${o.width+6}px;height:${o.height+6}px`,t.querySelector("span").textContent=s,t.hidden=!1},id=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(St)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,rd=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},ld=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(d=>!/^(astro|svelte|css)-/.test(d)).slice(0,2);return{selector:ea(t),tag:a,classes:r,nth:na({tag:a,classes:r}).indexOf(t),label:Kn(t.textContent||"",60),ctx:sa(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},Do=()=>{ft&&(ft.pin.classList.remove("is-dragging"),Oo.hidden=Ti.hidden=!0,ft=null,ce())};K.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=G.find(o=>o.id===Number(e.dataset.id));!s||!Po(s)||(ft={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:de(s),to:null},e.setPointerCapture(t.pointerId))}),K.addEventListener("pointermove",t=>{if(!ft||!ft.on&&Math.hypot(t.clientX-ft.x0,t.clientY-ft.y0)<4)return;ft.on=!0,ft.pin.classList.add("is-dragging"),ft.pin.style.left=`${t.clientX}px`,ft.pin.style.top=`${t.clientY}px`,ft.to=ft.home&&rd(ft.home,t.clientX,t.clientY)?ft.home:id(t.clientX,t.clientY);let e=ft.to&&ft.to!==ft.home;Ai(Oo,ft.home,e?"":ft.home?Io(ft.home):""),Oo.classList.toggle("is-left",!!e),Ai(Ti,e?ft.to:null,e?`Move to ${Io(ft.to)}`:"")}),K.addEventListener("pointerup",async t=>{if(!ft)return;let e=ft;if(!e.on||!e.to){Do();return}Es=!0,setTimeout(()=>{Es=!1},0);let s=G.find(b=>b.id===e.id),o=ld(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Do(),!s)return;let r={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},d=(b,h)=>te(N=>N.map(V=>V.id===e.id?{...V,...b}:V),()=>y({id:e.id,move:b}),h);await d(o,"Moving the pin"),a&&He(`Moved to ${Io(e.to)}`,()=>d(r,"Putting the pin back"))}),K.addEventListener("click",t=>{Es&&(t.stopImmediatePropagation(),t.preventDefault(),Es=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&ft?.on&&(t.stopImmediatePropagation(),Do())},!0),K.addEventListener("click",async t=>{let e=t.target.closest("button"),s=Ee?.btn;if(e?.closest(".dt-emoji")||us(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="react"){Oa(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Pa(e,o==="emoji-pick",o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&Ee){let r=Ee;Pa(r.btn,!0,r);return}if(o==="emoji"&&Ee){let r=Ee;us(),r.box?Tl(r.box,e.dataset.emoji):r.id&&Oa(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?te(d=>d.map(b=>b.id===a?{...b,priority:r??void 0}:b),()=>y({id:a,priority:r}),"Setting the priority"):S&&(S.priority=r??void 0,Mn(),et());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&ki(r,e.dataset.handle);return}if(!o){if(S&&!qe())return;if(nt=nt===a?null:a,nt!=null&&e.dataset.off){let r=G.find(b=>b.id===a);(r&&de(r))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}Tt(),et();return}if(o==="speak"){vl(e.closest(".dt-note"),e);return}if(o==="voice-write"){$l(e);return}if(o==="voice"||o==="voice-seek"){il(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let r=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),d=e.closest(".dt-note");r.addEventListener("change",()=>{r.files?.length&&Bo([...r.files],d)}),r.click();return}if(o==="unshot"){a?J&&J.drop.push(e.dataset.img):(e.closest("[data-draft]")?S?.images??[]:O).splice(Number(e.dataset.i),1),et(),J&&xi();return}if(o==="edit"){let r=G.find(h=>h.id===a),d=e.dataset.at||null,b=d?r?.replies?.find(h=>h.at===d)?.text:r?.text;if(b===void 0)return;J={id:a,at:d,text:b,drop:[]},et(),xi();return}if(o==="edit-cancel"){J=null,et();return}if(o==="translate"){Ba(a,e.dataset.at);return}if(o==="unsay"){let r=e.dataset.at;if(!confirm("Delete this reply?"))return;await te(d=>d.map(b=>b.id!==a?b:{...b,replies:(b.replies??[]).map(h=>h.at===r?{...h,text:"",deleted:!0}:h)}),()=>y({id:a,unsay:r}),"Deleting the reply");return}if(o==="edit-save"){let r=J;if(!r)return;let d=r.text.trim();if(!d){K.querySelector(".dt-note-edit-input")?.focus();return}J=null;let b=h=>r.drop.includes(h.split("/").pop());await te(h=>h.map(N=>N.id!==r.id?N:{...N,...r.at==null?{text:d}:{replies:(N.replies??[]).map(V=>V.at===r.at?{...V,text:d}:V)},images:(N.images??[]).filter(V=>!b(V))}),()=>y({id:r.id,edit:{at:r.at,text:d},...r.drop.length?{removeImage:r.drop}:{}}).then(h=>(h.ok||(J=r),h),h=>{throw J=r,h}),"Saving the edit");return}if(o==="cancel"){qe()&&(Tt(),et());return}if(o==="twin"){if(!qe())return;Tt(),nt=Number(e.dataset.id),et();return}if(o==="discard"){S=null,et();return}if(o==="draft-open"){yo(Number(e.dataset.i));return}if(o==="close"){nt=null,et();return}if(o==="where"){let r=G.find(N=>N.id===Number(e.dataset.id)),d=r&&Qt(r)?.hidden;if(!d)return;let b=d.getBoundingClientRect();d.scrollIntoView({block:"nearest",behavior:"smooth"});let h=document.createElement("div");h.className="dt-where",h.style.cssText=`left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px`,document.body.append(h),h.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>h.remove());return}if(o==="unsuggest"&&S){S.suggest=null,et();return}if(o==="save"){if(!S)return;S.images&&(S.images=wi(S.images));let r=(S.images??[]).filter(C=>!pn(C)),d=S.suggest&&S.suggest.to.trim()!==S.suggest.from?{from:S.suggest.from,to:S.suggest.to.trim()}:null,b=K.querySelector(".dt-note-input").value.trim()||(d?"Change the text":"")||(S.images?.some(oo)?Na:S.images?.some(C=>pn(C)&&!zn(C))?"See the attached image":S.images?.length?"See the attached file":"");if(!b){K.querySelector(".dt-note-input")?.focus();return}let h=S,N=n.client?null:Vo(b,Fe()),V=yi.get(h)??No(de(h)),c={...h,images:h.images?.filter(pn),route:Q,text:b,suggest:d,assignee:n.client?Sa(h.assignee)||void 0:N??(h.assignee||void 0),shared:n.client?!0:h.shared===!0,stage:n.client?"new":N?"approved":h.stage??(At(h.assignee)?"approved":"new"),breakpoint:Ws(),browser:Dr(),device:f?Ci:"",viewport:{w:innerWidth,h:innerHeight},logs:fr(),host:location.host},F={...h,id:-Date.now(),text:b,route:Q,status:"open",note:"",doneBy:null,breakpoint:c.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...d?{suggest:d}:{},by:n.me?.email,byName:n.me?.name};G=[...G,F],S=null,et();let q=await ms(Ct("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)})).catch(()=>null);if(!q?.ok){G=G.filter(C=>C!==F),Tt(),S=h,et(),qn("Comment was not saved",q);return}let lt=gn([await q.json().catch(()=>null)])[0];G=G.map(C=>C===F&<?lt:C),et(),lt&&V.then(C=>{C&&y({id:lt.id,before:C})}),lt&&r.length&&vi(lt.id,r),Ge();return}if(o==="reply"){let r=K.querySelector(".dt-note-reply-input");O=wi(O);let d=r.value.trim()||(O.some(oo)?Na:O.some(C=>pn(C)&&!zn(C))?"See the attached image":O.length?"See the attached file":"");if(!d){r.focus();return}let b=O;jt=d,rn=a,En(),jt="",O=[],r.value="";let h=G,N=n.client?null:Vo(d,Fe()),V=G.find(C=>C.id===a),c=N&&V&&(N!==V.assignee||Jt(V)!=="approved"||V.status==="done")?{assignee:N,stage:"approved",...V.status==="done"?{status:"open",doneBy:null}:{}}:{};G=G.map(C=>C.id===a?{...C,...c,replies:[...C.replies??[],{author:"you",text:d,at:new Date().toISOString(),by:n.me?.email}]}:C),x=a,et();let F=await ms(y({id:a,reply:d,images:b.filter(pn),...c})).catch(()=>null);if(!F?.ok){G=h,jt=d,O=b,et();let C=K.querySelector(".dt-note-reply-input");C&&!C.value&&(C.value=d);let it=()=>K.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?He(`Reply was not sent${F?` (${F.status})`:""} \u2014 it is back in the box`,it,"Retry"):qn("Reply was not sent",F);return}En();let q=gn([await F.json().catch(()=>null)])[0];q&&(G=G.map(C=>C.id===q.id?q:C),et()),Ge();let lt=b.filter(C=>!pn(C));lt.length&&vi(a,lt);return}if(o==="newbelow"){let r=e.closest(".dt-note")?.querySelector(".dt-note-thread");r?.scrollTo({top:r.scrollHeight,behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),delete T[a],e.remove();return}if(o==="hand"){ua(a,e.dataset.v);return}if(o==="sendback"){await Me(a,!1),xs(".dt-note-reply-input");return}if(o==="accept"){await Me(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(nt=null),await ze(a,o==="archive");return}e.classList.contains("dt-step-act")||(nt=null),o==="rm"?await go(a):await Me(a,o==="done")});let Ci="",ee=t=>{Kt.hidden||Ae.contentWindow?.postMessage({dt:!0,...t},location.origin)},dd=()=>({notes:$t,grid:!Y.hidden,inspect:E,resolved:Zt,archived:ve,...Ni.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!f&&t.source===Ae.contentWindow){if(e.key){qi(e.key[0],e.key[1])?.run();return}if(e.closeMenus){rt();return}if(e.drafts){mo=e.drafts,hn(we());return}}if(f&&typeof e.openDraft=="number"){yo(e.openDraft);return}if(f&&typeof e.dropDraft=="number"){Ka(e.dropDraft);return}if(f&&typeof e.device=="string"&&(Ci=e.device),f&&e.scrollbar&&Ft.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ae.contentWindow){ee(dd());return}typeof e.notes=="boolean"&&e.notes!==$t&&he(e.notes,!1),typeof e.open=="number"&&Hn(e.open),typeof e.grid=="boolean"&&e.grid===Y.hidden&&A(e.grid),typeof e.inspect=="string"&&e.inspect!==E&&U(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Zt&&wo(e.resolved),typeof e.archived=="boolean"&&e.archived!==ve&&$o(e.archived),e.reload&&Ke()});let Ge=async()=>{await Ke(),ee({reload:!0}),f&&parent.postMessage({dt:!0,reload:!0},location.origin)},he=(t,e=!0)=>{if($t=t,tt.setAttribute("aria-pressed",String(t)),t?!f&&ct.hidden&&st.getItem("dt-history")!=="0"&&(ct.hidden=!1,at.setAttribute("aria-pressed","true")):(ct.hidden=!0,at.setAttribute("aria-pressed","false")),$(Xn,t?"1":"0"),ee({notes:t}),f&&e&&parent.postMessage({dt:!0,notes:t},location.origin),K.hidden=!t||!Kt.hidden,Ft.toggle("dt-noting",t),t&&!f?Xa():document.querySelector(".dt-room")?.remove(),t){U(""),document.addEventListener("click",fi,!0);for(let s of pi)document.addEventListener(s,mi,!0);document.addEventListener("contextmenu",gi,!0),document.addEventListener("keydown",ui),document.addEventListener("mousemove",Ho),addEventListener("scroll",ce,!0),addEventListener("scroll",ci,!0),addEventListener("resize",ce),addEventListener("pointerover",Qa,!0),oa(),Ja.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),Za.observe(document.body),To()}else{Tt(),nt=null,document.removeEventListener("click",fi,!0);for(let s of pi)document.removeEventListener(s,mi,!0);document.removeEventListener("contextmenu",gi,!0),document.removeEventListener("keydown",ui),document.removeEventListener("mousemove",Ho),Bt.hidden=!0,removeEventListener("scroll",ce,!0),removeEventListener("scroll",ci,!0),removeEventListener("resize",ce),removeEventListener("pointerover",Qa,!0),Ja.disconnect(),Za.disconnect(),K.innerHTML=""}},{pickBp:Hi,...Ni}=Mr({cfg:n,inFrame:f,persist:$,frame:Kt,frameEl:Ae,devicesMenu:Nt,bpBtns:X,notesOverlay:K,WIDE:p,bpOf:v,currentBp:Ws,deviceById:H,notesOn:()=>$t,filter:()=>js,filterTo:t=>{js=t},dropFrameDrafts:()=>{mo=[]},putAway:()=>{nt=null,Tt()},tellFrame:ee,syncBpButtons:ta,render:()=>et(),reread:()=>{$t?To():et()}}),Bi="dt-studio",Ri=t=>{kt.setAttribute("aria-pressed",String(t)),Ft.toggle("dt-no-studio",!t),$(Bi,t?"1":"0")};kt.addEventListener("click",()=>Ri(kt.getAttribute("aria-pressed")!=="true")),Ri(st.getItem(Bi)!=="0"),tt.addEventListener("click",()=>he(!$t));let Be=document.querySelector(".devtools"),Ye=document.querySelector(".dt-tab"),Pi=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-Be.getBoundingClientRect().top)+12}px`);new ResizeObserver(Pi).observe(Be),addEventListener("resize",Pi);let Oi=t=>{Be.toggleAttribute("data-collapsed",t),Ye.toggleAttribute("data-collapsed",t),Ye.setAttribute("aria-expanded",String(!t)),Ye.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of Be.children)e instanceof HTMLElement&&!e.contains(Ye)&&(e.inert=t);t&&rt(),$("dt-collapsed",t?"1":"0")};Ye.addEventListener("click",()=>Oi(!Be.hasAttribute("data-collapsed")));let ke=document.querySelector(".dt-keys"),Ii=ke.querySelector(".dt-set-keys"),qo=t=>{Ii.hidden=!t,ke.querySelector(".dt-set-main").hidden=t};if(Dt.signOut)for(let t of ke.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;ke.querySelector("summary").addEventListener("click",()=>qo(!1)),ke.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return qo(s==="keys");ke.open=!1,s==="hide"&&Ye.click(),s==="out"&&confirm("Sign out of Notemend on this site?")&&(st.removeItem(bn),Dt.signOut?.())});let me=t=>()=>Be.querySelector(t)?.click(),Di=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},Ms=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:me(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:me(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:me(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>$o(!ve)},{group:"Threads",code:"KeyM",hint:"M",label:"Studio / clients",run:()=>Bn(ye==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Ne.hidden||Pn(ie.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:me(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:me(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:me(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:me(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:me(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:me(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:me(".dt-studio-btn")}]:[],...X.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:()=>{Nt.open=!Nt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Di(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Di(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Ye.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=ke.open&&!Ii.hidden;ke.open=!t,qo(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),qi=(t,e)=>Ms.find(s=>s.code===t&&!s.shift==!e),cd=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 Ms){let s=e.el&&Be.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>${g(e)}</span><kbd>${g(s)}</kbd></div>`;if(ke.querySelector(".dt-keys-list").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(Ms.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+Ms.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||cd(e.target))return;let s=qi(e.code,e.shiftKey);s&&(e.preventDefault(),f?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):s.run())}),f){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",s=>{s.key==="Escape"&&e()})}}if(!f){Oi(st.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>Be.setAttribute("data-ready",""))),Ni.restore(),A(st.getItem(ht)==="1");let t=st.getItem(Pt);t&&t in zt&&U(t),he(st.getItem(Xn)==="1")}let Fi=()=>{try{let t=JSON.parse(st.getItem(ln)||"null");dt=(t?.parked??[]).filter(s=>Ut(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};t?.draft&&e(t.draft.selector)?(S=t.draft,!$t&&!f&&he(!0)):Ut(t?.draft)&&dt.push(t.draft),t?.reply?.text&&(jt=t.reply.text,rn=nt=t.reply.for??null),(S||dt.length||jt)&&et()}catch{st.removeItem(ln)}};Fi();let ji=()=>setTimeout(()=>{let t=R(location.pathname);t!==Q&&(clearTimeout(Zn),En(),Q=t,ln=Jo(),S=null,dt=[],jt="",rn=null,nt=null,J=null,G=[],L(),Fi(),To(),Ke())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),ji()}}addEventListener("popstate",ji);try{let t=JSON.parse(st.getItem(bn)||"null");t?.project===li&&t.body?(Lo=t.body.version??"",So(t.body),In=""):t&&st.removeItem(bn)}catch{st.removeItem(bn)}i.then(async t=>{t.status===200&&So(await t.json(),!0)},()=>{}).then(()=>Zt?Ke(!0):void 0).then(gs.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Ue()}),addEventListener("focus",Ue),addEventListener("notemend:changed",()=>{f||Ue()});let ks=!1,Xe=null,_i=()=>{if(!(f||Dt.via||!("EventSource"in window))){if(document.hidden){Xe?.close(),Xe=null,ks=!1;return}Xe||(Xe=new EventSource("/__devbar/events"),Xe.onopen=()=>{ks=!0},Xe.onerror=()=>{ks=!1},Xe.onmessage=t=>{t.data!==In&&Ue()})}};_i(),document.addEventListener("visibilitychange",_i);let ud=0;f||setInterval(()=>{(!(Dt.live||ks)||++ud%6===0)&&Ue()},2e4),f&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Br(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,l=i.showModal,u=null,p=null,v=()=>{if(u){p?.disconnect(),p=null;for(let f of n)document.body.append(f);try{u.hidePopover()}catch{}u.remove(),u=null}},k=()=>{v();let f=document.querySelector("dialog:modal");f&&H(f)},H=f=>{v(),u=document.createElement("div"),u.className="dt-host",u.setAttribute("popover","manual"),u.append(...n),f.append(u);try{u.showPopover()}catch{}f.addEventListener("close",k,{once:!0}),p=new MutationObserver(()=>{f.isConnected||k()}),p.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){l.call(this),this.isConnected&&H(this)}}var zd=".devtools, [class^='dt-'], [class*=' dt-']";function Rr(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let i=null,l,u=0,p=$=>{let y=$.getAttribute("title");y!==null&&($.removeAttribute("title"),$.hasAttribute("data-tip")||$.setAttribute("data-tip",y),!$.hasAttribute("aria-label")&&!$.textContent?.trim()&&$.setAttribute("aria-label",y))},v=$=>{let y=$?.closest?.("[data-tip], [title]");return y&&y.closest(zd)&&!y.closest(".dt-tipbox")?y:null},k=$=>{let y=$.getAttribute("data-tip");if(!y||$.getAttribute("aria-expanded")==="true")return H();n.textContent=y,n.hidden=!1;let R=$.getBoundingClientRect(),Q=n.getBoundingClientRect(),_=6,Y=8,ht=R.bottom+_+Q.height<=innerHeight-Y;n.style.top=`${ht?R.bottom+_:Math.max(Y,R.top-_-Q.height)}px`,n.style.left=`${Math.min(Math.max(Y,R.left+R.width/2-Q.width/2),innerWidth-Y-Q.width)}px`,n.classList.toggle("is-mono",$.classList.contains("dt-note-el")),$.setAttribute("aria-describedby",n.id)},H=()=>{clearTimeout(l),i&&!n.hidden&&(u=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,n.hidden=!0},f=$=>{$!==i&&(H(),p($),i=$,performance.now()<u?k($):l=setTimeout(()=>i===$&&k($),300))};document.addEventListener("pointerover",$=>{let y=v($.target);y?f(y):i&&!i.contains($.target)&&H()},!0),document.addEventListener("pointerout",$=>{i&&!i.contains($.relatedTarget)&&H()},!0),document.addEventListener("focusin",$=>{let y=v($.target);y&&$.target.matches(":focus-visible")&&f(y)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",$=>{$.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{i&&!i.isConnected&&H()}).observe(document.body,{childList:!0,subtree:!0})}function Pr(){let n=window;if(n.__notemend)return;n.__notemend=!0,gr(l=>l.includes("/__devbar/")||!!Dt.base&&l.startsWith(Dt.base)),Ft.ready=new Promise(l=>{if(!("__next_f"in self))return l();let u=0,p=()=>Object.keys(document.documentElement).some(v=>v.startsWith("__reactFiber$"))||++u>330?l():setTimeout(p,30);p()}),Ft.toggle("dt-in-frame",Ns);let i=Ct("comments?open=1");Yi().then(l=>{Ft.set("--dt-z",String(l.zIndex));let u=l.brand?.color;if(u&&/^#[0-9a-f]{6}$/i.test(u)){let[p,v,k]=[1,3,5].map(H=>parseInt(u.slice(H,H+2),16)/255);Ft.set("--dt-accent",u),Ft.set("--dt-accent-ink",.2126*p+.7152*v+.0722*k>.55?"#000000":"#ffffff")}cr(l),Nr(l,i),Rr(),Br([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(p=>document.querySelector(p)).filter(p=>!!p))}).catch(l=>console.warn("[notemend] not started:",l))}Pr();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|