notemend 0.1.22 → 0.1.23

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.
@@ -1,11 +1,11 @@
1
- import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};async function Dt(s,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<6e4&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Wt.via)return fetch(`/__devbar/${s}`,i);let d=await Wt.via(s,i);if(d.ok&&s.startsWith("comments")&&(i.method??"GET")==="GET"){let m=await d.clone().json().catch(()=>null);m?.signed&&Object.assign(Wt.signed,m.signed)}return d}var ea=s=>Wt.via?Wt.signed[s]??"":`/__devbar/image?name=${encodeURIComponent(s)}`,Cn=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),et={getItem:s=>{try{return localStorage.getItem(s)}catch{return null}},setItem:(s,i)=>{try{localStorage.setItem(s,i)}catch{}},removeItem:s=>{try{localStorage.removeItem(s)}catch{}}};async function na(){let s=await Dt("config");if(!s.ok)throw new Error(`config ${s.status}`);let i=await s.json();return i.breakpoints=i.breakpoints.map(d=>({...d,max:d.max??1/0})),i}var sa=["iPhone","Android","Foldable","Tablet","Laptop & display"],tn=[{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 er=s=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(s))?.[1]??null;var en={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},ws=/^(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,nr=/^(png|jpe?g|webp|gif|webm)$/i,sr=[["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"]],oa=s=>{let i=String(s??"").split(".").pop().toLowerCase(),d=sr.find(([,,m])=>m.split(" ").includes(i));return d?{label:d[0],color:d[1]}:{label:"FILE",color:"#717171"}},$s=s=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(s??"").split("?")[0]),or=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((s,i)=>[s,["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]])),aa=s=>String(s??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>or[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),ia=s=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(s??""));return i&&!ws.test(i[1])?i[1].toLowerCase():""},nn=s=>{let i=String(s??"");if(i.startsWith("data:")){let p=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!p)return null;let x=/;ext=([a-z0-9]{1,8})/i.exec(p[2])?.[1]?.toLowerCase()??Object.keys(en).find(k=>en[k]===p[1]);return x?`${/;name=([\w-]+)/.exec(p[2])?.[1]||"document"}.${x}`:null}let d=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(d))return null;let m=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(d);return m&&!nr.test(m[2])?`${m[1]||"document"}.${m[2].toLowerCase()}`:null},Te=s=>{let i=[{author:"you",text:s.text,at:s.createdAt,by:s.by,byName:s.byName,images:[]},...s.note?[{author:"claude",text:s.note,at:s.updatedAt,images:[]}]:[],...(s.replies||[]).map(d=>({...d,images:[]}))];for(let d of s.images||[]){if(er(d))continue;let m=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(d)?.[1]),p=0;i.forEach((x,k)=>{Date.parse(x.at)<=m&&(p=k)}),i[p].images.push(d)}return i.filter(d=>!d.deleted)},ra=s=>s.nickname||s.name||s.email,ar=(s,i)=>{let d="@"+i.toLowerCase(),m=-1;for(let p=s.indexOf(d);p!==-1;p=s.indexOf(d,p+1))/[\p{L}\p{N}_.-]/u.test(s[p+d.length]??"")||(m=p);return m};var ir={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},ze=s=>ir[s]||(s?"AI agent":"Claude"),Hn="3.6 3.6 10.8 10.8",Bn="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",xs=s=>typeof s=="string"&&s.startsWith("agent:")?s.slice(6):null,xt=s=>s==="claude"||xs(s)!=null;var rr=["new","approved","progress","review","waiting","accepted"],zt=s=>rr.includes(s?.stage)?s.stage:xt(s?.assignee)?"approved":"new";var Nn=()=>[{assignee:"claude",handle:"Claude",owner:null}],Es=(s,i=[])=>{let d=String(s||"").toLowerCase(),m=null,p=-1;for(let x of Nn()){let k=ar(d,x.handle);k>p&&(p=k,m=x.assignee)}return m};var lr=2*36e5,sn=(s,i=Date.now())=>s?.working&&s.status!=="done"&&i-Date.parse(s.working.at)<lr?s.working:null,dr=s=>/@guest\.notemend\.com$/i.test(String(s||"")),Rn=s=>dr(s.by)&&!s.approvedBy,Jt=(s,i=Date.now())=>{if(!s)return null;if(s.status==="done")return s.doneBy==="claude"?"review":xt(s.assignee)?"done":null;if(s.stage==="accepted")return xt(s.assignee)?"done":null;if(Rn(s))return"held";if(!xt(s.assignee))return null;let d=Te(s),m=d[d.length-1];return d.length>1&&m.author==="claude"&&!(s.reopenedAt&&Date.parse(s.reopenedAt)>=Date.parse(m.at))?"asks":sn(s,i)?"working":s.working?"stuck":zt(s)==="approved"?"queued":null};var la=Bn.split("M").filter(Boolean).map(s=>{let i=s.match(/[\d.]+/g).map(Number),[d,m]=/H/.test(s)?[i[2],i[1]]:/V/.test(s)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+s,a:(Math.atan2(d-9,9-m)+2*Math.PI)%(2*Math.PI)}}).sort((s,i)=>s.a-i.a).map(s=>s.d);var da=(s,i)=>{if(s.archivedAt)return!0;if(!i||s.status!=="done"||s.doneBy==="claude")return!1;let d=Math.max(Date.parse(s.confirmedAt||s.updatedAt||"")||0,...(s.replies||[]).filter(m=>!m.deleted).map(m=>Date.parse(m.at||"")||0));return!!d&&Date.now()-d>i*864e5};var h=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[i]),on=s=>s?new Date(s).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Ae='<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>',an='<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>',ge='<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>',ca='<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>',ua='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Ce='<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>',Vt=s=>`<svg viewBox="${Hn}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude"><path d="${Bn}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Ms=(s,i)=>`<svg viewBox="${Hn}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude dt-claude--fill">${la.map((d,m)=>`<path d="${d}" stroke-width="1.15" stroke-linecap="round"${m<i?"":' class="is-off"'}/>`).join("")}</svg>`,ft=(s,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${s}</svg>`;function pa(s){let i=location.pathname.replace(/\/$/,"")||"/",d=s.client?' style="display:none"':"",m=s.breakpoints.map($=>["new","progress","review","waiting","accepted","done"].map(H=>`<b data-bp="${h($.id)}" data-state="${H}" hidden>${ft($.icon,11)}<i></i></b>`).join("")).join(""),p=s.groups.map($=>`<li class="dt-pages-group">${h($)}</li>`+s.pages.filter(H=>H.group===$).map(H=>`<li><a href="${/^\/(?![\/\\])/.test(H.route)?h(H.route):"#"}"${H.route===i?' aria-current="page"':""}><span class="dt-menu-label">${h(H.label)}</span><em class="dt-pages-n" hidden>${m}</em></a></li>`).join("")).join(""),x=[...new Set(s.devices.map($=>$.group))].map($=>`<p class="dt-devices-group">${h($)}</p>`+s.devices.filter(H=>H.group===$).map(H=>`<button type="button" data-device="${h(H.id)}" aria-pressed="false"${H.note?` title="${h(H.note)}"`:""}><span class="dt-menu-label">${h(H.label)}</span><em>${H.w}&times;${H.h}</em></button>`).join("")).join(""),k=sa.map($=>`<p class="dt-devices-group">${h($)}</p>`+tn.filter(H=>H.group===$).map(H=>`<button type="button" data-emu="${h(H.id)}" aria-pressed="false"><span class="dt-menu-label">${h(H.label)}</span><em>${H.w}&times;${H.h}</em></button>`).join("")).join(""),N=s.breakpoints.map($=>`<button class="dt-icon dt-bp" type="button" data-bp="${h($.id)}" aria-pressed="false" title="${h($.label)}">${ft($.icon,16)}</button>`).join(""),w=Array.from({length:s.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),F="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
1
+ import"./notemend.css";var Ut={base:"",via:null,signed:{},live:!1,signOut:null};async function Ct(s,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<6e4&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Ut.via)return fetch(`/__devbar/${s}`,i);let d=await Ut.via(s,i);if(d.ok&&s.startsWith("comments")&&(i.method??"GET")==="GET"){let m=await d.clone().json().catch(()=>null);m?.signed&&Object.assign(Ut.signed,m.signed)}return d}var ga=s=>Ut.via?Ut.signed[s]??"":`/__devbar/image?name=${encodeURIComponent(s)}`,Nn=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),et={getItem:s=>{try{return localStorage.getItem(s)}catch{return null}},setItem:(s,i)=>{try{localStorage.setItem(s,i)}catch{}},removeItem:s=>{try{localStorage.removeItem(s)}catch{}}};async function ba(){let s=await Ct("config");if(!s.ok)throw new Error(`config ${s.status}`);let i=await s.json();return i.breakpoints=i.breakpoints.map(d=>({...d,max:d.max??1/0})),i}var fa=["iPhone","Android","Foldable","Tablet","Laptop & display"],sn=[{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 gr=s=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(s))?.[1]??null;var on={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},Ls=/^(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,br=/^(png|jpe?g|webp|gif|webm)$/i,fr=[["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"]],va=s=>{let i=String(s??"").split(".").pop().toLowerCase(),d=fr.find(([,,m])=>m.split(" ").includes(i));return d?{label:d[0],color:d[1]}:{label:"FILE",color:"#717171"}},Ss=s=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(s??"").split("?")[0]),vr=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((s,i)=>[s,["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]])),ya=s=>String(s??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>vr[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),wa=s=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(s??""));return i&&!Ls.test(i[1])?i[1].toLowerCase():""},an=s=>{let i=String(s??"");if(i.startsWith("data:")){let p=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!p)return null;let x=/;ext=([a-z0-9]{1,8})/i.exec(p[2])?.[1]?.toLowerCase()??Object.keys(on).find(k=>on[k]===p[1]);return x?`${/;name=([\w-]+)/.exec(p[2])?.[1]||"document"}.${x}`:null}let d=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(d))return null;let m=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(d);return m&&!br.test(m[2])?`${m[1]||"document"}.${m[2].toLowerCase()}`:null},He=s=>{let i=[{author:"you",text:s.text,at:s.createdAt,by:s.by,byName:s.byName,images:[]},...s.note?[{author:"claude",text:s.note,at:s.updatedAt,images:[]}]:[],...(s.replies||[]).map(d=>({...d,images:[]}))];for(let d of s.images||[]){if(gr(d))continue;let m=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(d)?.[1]),p=0;i.forEach((x,k)=>{Date.parse(x.at)<=m&&(p=k)}),i[p].images.push(d)}return i.filter(d=>!d.deleted)},$a=s=>s.nickname||s.name||s.email,yr=(s,i)=>{let d="@"+i.toLowerCase(),m=-1;for(let p=s.indexOf(d);p!==-1;p=s.indexOf(d,p+1))/[\p{L}\p{N}_.-]/u.test(s[p+d.length]??"")||(m=p);return m};var wr={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Ve=s=>wr[s]||(s?"AI agent":"Claude"),Rn="3.6 3.6 10.8 10.8",Pn="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",Ts=s=>typeof s=="string"&&s.startsWith("agent:")?s.slice(6):null,$t=s=>s==="claude"||Ts(s)!=null;var $r=["new","approved","progress","review","waiting","accepted"],_t=s=>$r.includes(s?.stage)?s.stage:$t(s?.assignee)?"approved":"new";var On=()=>[{assignee:"claude",handle:"Claude",owner:null}],As=(s,i=[])=>{let d=String(s||"").toLowerCase(),m=null,p=-1;for(let x of On()){let k=yr(d,x.handle);k>p&&(p=k,m=x.assignee)}return m};var xr=2*36e5,Ke=(s,i=Date.now())=>s?.working&&s.status!=="done"&&i-Date.parse(s.working.at)<xr?s.working:null,Er=s=>/@guest\.notemend\.com$/i.test(String(s||"")),Cs=s=>Er(s.by)&&!s.approvedBy,Zt=(s,i=Date.now())=>{if(!s)return null;if(s.status==="done")return s.doneBy==="claude"?"review":$t(s.assignee)?"done":null;if(s.stage==="accepted")return $t(s.assignee)?"done":null;if(Cs(s))return"held";if(!$t(s.assignee))return null;let d=He(s),m=d[d.length-1];return d.length>1&&m.author==="claude"&&!(s.reopenedAt&&Date.parse(s.reopenedAt)>=Date.parse(m.at))?"asks":Ke(s,i)?"working":s.working?"stuck":_t(s)==="approved"?"queued":null};var xa=Pn.split("M").filter(Boolean).map(s=>{let i=s.match(/[\d.]+/g).map(Number),[d,m]=/H/.test(s)?[i[2],i[1]]:/V/.test(s)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+s,a:(Math.atan2(d-9,9-m)+2*Math.PI)%(2*Math.PI)}}).sort((s,i)=>s.a-i.a).map(s=>s.d);var Ea=(s,i)=>{if(s.archivedAt)return!0;if(!i||s.status!=="done"||s.doneBy==="claude")return!1;let d=Math.max(Date.parse(s.confirmedAt||s.updatedAt||"")||0,...(s.replies||[]).filter(m=>!m.deleted).map(m=>Date.parse(m.at||"")||0));return!!d&&Date.now()-d>i*864e5};var h=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[i]),rn=s=>s?new Date(s).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Be='<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>',Wt='<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>',ln='<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>',be='<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>',Ma='<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>',ka='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Ne='<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>',Gt=s=>`<svg viewBox="${Rn}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude"><path d="${Pn}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Hs=(s,i)=>`<svg viewBox="${Rn}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude dt-claude--fill">${xa.map((d,m)=>`<path d="${d}" stroke-width="1.15" stroke-linecap="round"${m<i?"":' class="is-off"'}/>`).join("")}</svg>`,vt=(s,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${s}</svg>`;function La(s){let i=location.pathname.replace(/\/$/,"")||"/",d=s.client?' style="display:none"':"",m=s.breakpoints.map($=>["new","progress","review","waiting","accepted","done"].map(H=>`<b data-bp="${h($.id)}" data-state="${H}" hidden>${vt($.icon,11)}<i></i></b>`).join("")).join(""),p=s.groups.map($=>`<li class="dt-pages-group">${h($)}</li>`+s.pages.filter(H=>H.group===$).map(H=>`<li><a href="${/^\/(?![\/\\])/.test(H.route)?h(H.route):"#"}"${H.route===i?' aria-current="page"':""}><span class="dt-menu-label">${h(H.label)}</span><em class="dt-pages-n" hidden>${m}</em></a></li>`).join("")).join(""),x=[...new Set(s.devices.map($=>$.group))].map($=>`<p class="dt-devices-group">${h($)}</p>`+s.devices.filter(H=>H.group===$).map(H=>`<button type="button" data-device="${h(H.id)}" aria-pressed="false"${H.note?` title="${h(H.note)}"`:""}><span class="dt-menu-label">${h(H.label)}</span><em>${H.w}&times;${H.h}</em></button>`).join("")).join(""),k=fa.map($=>`<p class="dt-devices-group">${h($)}</p>`+sn.filter(H=>H.group===$).map(H=>`<button type="button" data-emu="${h(H.id)}" aria-pressed="false"><span class="dt-menu-label">${h(H.label)}</span><em>${H.w}&times;${H.h}</em></button>`).join("")).join(""),N=s.breakpoints.map($=>`<button class="dt-icon dt-bp" type="button" data-bp="${h($.id)}" aria-pressed="false" title="${h($.label)}">${vt($.icon,16)}</button>`).join(""),w=Array.from({length:s.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),F="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
4
  ${s.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(s.brand.logo)?`<img class="dt-brand" src="${h(s.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
- ${ft('<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" />')}
8
+ ${vt('<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
9
  <span class="dt-pages-name">${h(i)}</span>
10
10
  </summary>
11
11
  <ul>${p}</ul>
@@ -14,39 +14,39 @@ import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};
14
14
 
15
15
  <div class="dt-group" role="group" aria-label="Inspect"${d}>
16
16
  <button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
17
- ${ft('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
17
+ ${vt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
18
18
  </button>
19
19
  <button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
20
- ${ft('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
20
+ ${vt('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
21
21
  </button>
22
22
  <button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
23
- ${ft('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
23
+ ${vt('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
24
24
  </button>
25
25
  <button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
26
- ${ft('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
26
+ ${vt('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
27
27
  </button>
28
28
  <button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
29
- ${ft('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
29
+ ${vt('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
30
30
  </button>
31
31
  <button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
32
- ${ft('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
32
+ ${vt('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
33
33
  </button>
34
34
  <button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${s.sanity?"":" hidden"}>
35
- ${ft('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
35
+ ${vt('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
36
36
  </button>
37
37
  </div>
38
38
 
39
39
  <div class="dt-group" role="group" aria-label="Comments">
40
40
  <button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
41
- ${ft('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
41
+ ${vt('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
42
42
  <span class="dt-notes-count" hidden></span>
43
43
  </button>
44
44
  <button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
45
- ${ft('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
45
+ ${vt('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
46
46
  </button>
47
47
  <!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
48
48
  <button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
49
- ${ft('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
49
+ ${vt('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
50
50
  </button>
51
51
  </div>
52
52
 
@@ -55,7 +55,7 @@ import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};
55
55
  <div class="dt-group dt-group--menus">
56
56
  <details class="dt-devices" name="dt-menu">
57
57
  <summary title="Devices">
58
- ${ft('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
58
+ ${vt('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
59
59
  <span class="dt-devices-name">Device</span>
60
60
  </summary>
61
61
  <div class="dt-devices-menu">
@@ -78,18 +78,18 @@ import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};
78
78
  the table that runs them), hiding the bar, signing out of a hosted bar -->
79
79
  <details class="dt-keys" name="dt-menu">
80
80
  <summary class="dt-icon" title="Settings">
81
- ${ft('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></g>')}
81
+ ${vt('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></g>')}
82
82
  </summary>
83
83
  <div class="dt-keys-menu">
84
84
  <div class="dt-set-main">
85
85
  ${s.me?.email?`<p class="dt-set-who">Signed in as<b>${h(s.me.email)}</b></p><hr>`:""}
86
- <button type="button" data-set="keys"${s.shortcuts?"":" hidden"}>${ft('<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
- <button type="button" data-set="hide">${ft('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${s.shortcuts?"<kbd>\\</kbd>":""}</button>
86
+ <button type="button" data-set="keys"${s.shortcuts?"":" hidden"}>${vt('<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
+ <button type="button" data-set="hide">${vt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${s.shortcuts?"<kbd>\\</kbd>":""}</button>
88
88
  <hr data-set-out hidden>
89
- <button type="button" data-set="out" hidden>${ft('<path d="M8 3.5H5a1.5 1.5 0 0 0-1.5 1.5v10A1.5 1.5 0 0 0 5 16.5h3M12.5 13.5 16 10l-3.5-3.5M16 10H8" />',14)}<span>Sign out</span></button>
89
+ <button type="button" data-set="out" hidden>${vt('<path d="M8 3.5H5a1.5 1.5 0 0 0-1.5 1.5v10A1.5 1.5 0 0 0 5 16.5h3M12.5 13.5 16 10l-3.5-3.5M16 10H8" />',14)}<span>Sign out</span></button>
90
90
  </div>
91
91
  <div class="dt-set-keys" hidden>
92
- <button type="button" class="dt-set-back" data-set="back">${ft('<path d="M12 5l-5 5 5 5" />',13)}<span>Keyboard shortcuts</span></button>
92
+ <button type="button" class="dt-set-back" data-set="back">${vt('<path d="M12 5l-5 5 5 5" />',13)}<span>Keyboard shortcuts</span></button>
93
93
  <hr>
94
94
  <div class="dt-keys-list"></div>
95
95
  </div>
@@ -99,7 +99,7 @@ import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};
99
99
  <!-- push to Claude: one press hands every comment nobody has to the agent; the arrow picks
100
100
  which pages and threads. Beside turbo, the studio's only, shown while there is any. -->
101
101
  <span class="dt-push" hidden${s.client?' style="display:none"':""}>
102
- <button class="dt-push-all" type="button"><svg viewBox="${Hn}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Bn}" stroke-width="1.1" stroke-linecap="round"/></svg><span>Push to Claude</span><b class="dt-push-n">0</b></button
102
+ <button class="dt-push-all" type="button"><svg viewBox="${Rn}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Pn}" stroke-width="1.1" stroke-linecap="round"/></svg><span>Push to Claude</span><b class="dt-push-n">0</b></button
103
103
  ><i class="dt-push-sep" aria-hidden="true"></i
104
104
  ><button class="dt-push-pick" type="button" aria-label="Pick pages and threads" aria-expanded="false" data-tip="Pick pages and threads"><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M6 8l4 4 4-4"/></svg></button>
105
105
  <div class="dt-push-menu" hidden role="dialog" aria-label="What goes to Claude"></div>
@@ -107,7 +107,7 @@ import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};
107
107
  <!-- turbo: its own round button beside the bar, always there for the studio \u2014 lit while
108
108
  an agent session takes comments, grey when none is listening or it is paused here -->
109
109
  <button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${s.client?" hidden":""}>
110
- <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${ft('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
110
+ <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${vt('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
111
111
  </button>
112
112
  </div>
113
113
 
@@ -147,128 +147,128 @@ import"./notemend.css";var Wt={base:"",via:null,signed:{},live:!1,signOut:null};
147
147
  </div>
148
148
  </div>
149
149
  <div class="dt-pad-overlay" hidden aria-hidden="true"></div>
150
- `)}var ha=[{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"/>'}],ks=(s,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${s.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s.icon}</svg>`,He=s=>ha.find(i=>i.id===s)||ha[0];var ut=s=>s.status!=="done"?"open":s.doneBy==="claude"?"claude":"done",ma={open:"Open",done:"Resolved",claude:"Resolved by an agent"};var At={ready:Promise.resolve(),toggle:(s,i)=>{At.ready.then(()=>document.documentElement.classList.toggle(s,i))},set:(s,i)=>{At.ready.then(()=>document.documentElement.style.setProperty(s,i))}};var cr=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,ga=s=>String(s??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(cr,"$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 Pn=[],Ss=s=>{if(s instanceof Error)return`${s.name}: ${s.message}`;if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}},Be=(s,i)=>{Pn.push({at:new Date().toISOString(),kind:s,text:ga(i.replace(/\s+/g," ").trim()).slice(0,500)}),Pn.length>50&&Pn.shift()},ba=!1;function fa(s){if(ba||typeof window>"u")return;ba=!0;let i=console.error;console.error=(...p)=>{Be("console",p.map(Ss).join(" ")),i.apply(console,p)},addEventListener("error",p=>{if(p instanceof ErrorEvent)return Be("error",`${p.message}${p.filename?` (${p.filename}:${p.lineno})`:""}`);let x=p.target,k=x?.src||x?.href;k&&!s(k)&&Be("network",`${x.tagName?.toLowerCase()} ${k} did not load`)},!0),addEventListener("unhandledrejection",p=>Be("rejection",Ss(p.reason)));let d=window.fetch;window.fetch=async(p,x)=>{let k=typeof p=="string"?p:p instanceof URL?p.href:p.url,N=(x?.method||(p instanceof Request?p.method:"GET")).toUpperCase();try{let w=await d.call(window,p,x);return w.status>=400&&!s(k)&&Be("network",`${N} ${k} \u2192 ${w.status}`),w}catch(w){throw!s(k)&&w?.name!=="AbortError"&&Be("network",`${N} ${k} \u2192 no answer (${Ss(w)})`),w}};let m=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(p,x,...k){return this._nm=`${p.toUpperCase()} ${String(x)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(s(String(x))||Be("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),m.call(this,p,x,...k)}}var va=(s=Date.now())=>Pn.filter(i=>s-Date.parse(i.at)<10*6e4).slice(-20);function ya(s){let i=f=>{let c=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,y=f/c;return Math.round(y*10)%10===0?String(Math.round(y)):y.toFixed(1)},d=(f,c,y,C,B,J="p")=>{if(y<=0||C<=0)return"";let I=B!==""?`<span class="dt-pad-chip dt-pad-chip--${J}" style="left:${f+y/2}px;top:${c+C/2}px">${B}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${J}" style="left:${f}px;top:${c}px;width:${y}px;height:${C}px"></span>${I}`},m=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],p=f=>{let c=f;for(let y=0;c&&y<6;y++,c=c.parentElement){let C=getComputedStyle(c);if(m.some(B=>parseFloat(C[B])>=2))return c}return f},x=(f,c)=>{let y=parseFloat(c.columnGap)||0,C=parseFloat(c.rowGap)||0;if(!(c.display.includes("flex")||c.display.includes("grid"))||!y&&!C)return"";let B=[...f.children].map(I=>I.getBoundingClientRect()).filter(I=>I.width||I.height),J="";for(let I=1;I<B.length;I++){let R=B[I-1],j=B[I];if(y&&j.left>=R.right-1){let V=Math.max(R.top,j.top);J+=d(R.right,V,j.left-R.right,Math.min(R.bottom,j.bottom)-V,i(y),"g")}else if(C&&j.top>=R.bottom-1){let V=Math.min(R.left,j.left);J+=d(V,R.bottom,Math.max(R.right,j.right)-V,j.top-R.bottom,i(C),"g")}}return J},k=f=>`<span class="dt-pad-outline" style="left:${f.left}px;top:${f.top}px;width:${f.width}px;height:${f.height}px"></span>`,N=(f,c,y="")=>`<span class="dt-pad-tag" style="left:${c.left}px;top:${Math.max(2,c.top-22)}px">${f.tagName.toLowerCase()+(f.classList[0]?"."+f.classList[0]:"")}${y}</span>`,w=f=>{let c=f.getBoundingClientRect(),y=getComputedStyle(f),C=parseFloat(y.paddingTop),B=parseFloat(y.paddingRight),J=parseFloat(y.paddingBottom),I=parseFloat(y.paddingLeft),R=k(c);R+=d(c.left,c.top,c.width,C,C>=2?i(C):""),R+=d(c.left,c.bottom-J,c.width,J,J>=2?i(J):""),R+=d(c.left,c.top+C,I,c.height-C-J,I>=2?i(I):""),R+=d(c.right-B,c.top+C,B,c.height-C-J,B>=2?i(B):"");let j=parseFloat(y.marginTop),V=parseFloat(y.marginRight),gt=parseFloat(y.marginBottom),bt=parseFloat(y.marginLeft);R+=d(c.left,c.top-j,c.width,j,j>=2?i(j):"","m"),R+=d(c.left,c.bottom,c.width,gt,gt>=2?i(gt):"","m"),R+=d(c.left-bt,c.top,bt,c.height,bt>=2?i(bt):"","m"),R+=d(c.right,c.top,V,c.height,V>=2?i(V):"","m"),R+=x(f,y);let Nt=parseFloat(y.columnGap)||0,Ct=parseFloat(y.rowGap)||0,Rt=(y.display.includes("flex")||y.display.includes("grid"))&&(Nt||Ct)?` \xB7 gap ${i(Nt)}${Ct&&Ct!==Nt?"/"+i(Ct):""}`:"";s.innerHTML=R+N(f,c,Rt)},F=f=>{let c=f.getBoundingClientRect();s.innerHTML=k(c)+`<span class="dt-pad-chip" style="left:${c.left+c.width/2}px;top:${c.top+c.height/2}px">${i(c.width)} \xD7 ${i(c.height)}</span>`+N(f,c)},$=f=>{let c=(f.match(/[\d.]+/g)||[]).map(Number);if(c.length<3)return f;let y="#"+c.slice(0,3).map(C=>Math.round(C).toString(16).padStart(2,"0")).join("");return c[3]!==void 0&&c[3]<1?`${y} \xB7 ${Math.round(c[3]*100)}%`:y},H=null,S=()=>{if(H)return H;let f=getComputedStyle(document.documentElement),c=document.createElement("span");c.style.display="none",document.body.append(c);let y=[];for(let C of Array.from(f)){if(!C.startsWith("--"))continue;let B=f.getPropertyValue(C).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(B))continue;c.style.color="rgb(1, 2, 3)",c.style.color=B;let J=getComputedStyle(c).color;J&&J!=="rgb(1, 2, 3)"&&y.push([J,C])}return c.remove(),y.sort((C,B)=>C[1].length-B[1].length),H=y,y},g=f=>S().find(([c])=>c===f)?.[1]??"",T=null,_=()=>{if(T)return T;let f=[],c=y=>{for(let C of Array.from(y))C instanceof CSSStyleRule?C.style.cssText.includes("var(--")&&f.push({sel:C.selectorText,style:C.style}):C instanceof CSSMediaRule?matchMedia(C.conditionText).matches&&c(C.cssRules):"cssRules"in C&&c(C.cssRules)};for(let y of Array.from(document.styleSheets))try{c(y.cssRules)}catch{}return T=f},X={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(f=>[`border-${f}-color`,[`border-${f}-color`,"border-color",`border-${f}`,"border"]]))},W=(f,c)=>{let y=X[c]??[c],C=c==="color";for(let B=f;B;B=C?B.parentElement:null){let J=j=>y.map(V=>/var\(\s*(--[\w-]+)/.exec(j.getPropertyValue(V))?.[1]).find(Boolean),I=B instanceof HTMLElement?J(B.style):void 0;if(I)return I;let R="";for(let j of _()){let V=!1;try{V=B.matches(j.sel)}catch{}V&&(R=J(j.style)||R)}if(R)return R;if(C&&B.parentElement&&getComputedStyle(B).color!==getComputedStyle(B.parentElement).color)break}return""},dt=(f,c,y)=>{let C=W(f,c);if(C)return`<b class="dt-var">${C}</b> <em>${$(y)}</em>`;let B=g(y);return B?`<span title="Same value as ${B}; not written with it">\u2248 ${B}</span> <em>${$(y)}</em>`:$(y)},q=f=>`<i class="dt-type-sw" style="background:${f}"></i>`,Q={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},it=f=>(f.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),pt=(f,c)=>f.slice(0,3).map((y,C)=>y*f[3]+c[C]*(1-f[3])).concat([1]),nt=f=>{let c=[];for(let y=f;y;y=y.parentElement){let C=getComputedStyle(y);if(C.backgroundImage!=="none")return null;let B=it(C.backgroundColor);if(B[3]>0&&(c.push(B),B[3]>=1))break}return c.reduceRight((y,C)=>pt(C,y),[255,255,255,1])},Kt=f=>{let[c,y,C]=f.slice(0,3).map(B=>(B/=255,B<=.03928?B/12.92:((B+.055)/1.055)**2.4));return .2126*c+.7152*y+.0722*C},yt=(f,c,y)=>{let C=nt(f);if(!C)return["Contrast","<em>on an image</em>"];let B=pt(it(c.color),C),[J,I]=[Kt(B),Kt(C)].sort((gt,bt)=>bt-gt),R=(J+.05)/(I+.05),j=y>=24||y>=18.66&&Number(c.fontWeight)>=700,V=R>=(j?4.5:7)?"AAA":R>=(j?3:4.5)?"AA":"fails AA";return["Contrast",`${R.toFixed(2)}:1 <em class="${V==="fails AA"?"dt-type-bad":""}">${V}${j?" \xB7 large":""}</em>`]},Et=f=>{let c=f.getBoundingClientRect(),y=getComputedStyle(f),C=parseFloat(y.fontSize),B=y.lineHeight==="normal"?0:parseFloat(y.lineHeight),J=parseFloat(y.letterSpacing)||0,I=bt=>`${(bt*100).toFixed(1).replace(/\.0$/,"")}%`,R=[["Font",y.fontFamily.split(",")[0].replace(/["']/g,"")+(y.fontStyle!=="normal"?` ${y.fontStyle}`:"")],["Weight",`${Q[y.fontWeight]??""} <em>${y.fontWeight}</em>`],["Size",`${i(C)}px`],["Line",B?`${I(B/C)} <em>${i(B)}px</em>`:"normal"],["Letter",J?`${I(J/C)} <em>${J.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",q(y.color)+dt(f,"color",y.color)],yt(f,y,C)],V=c.bottom+150<innerHeight?c.bottom+8:Math.max(8,c.top-158),gt=Math.min(Math.max(8,c.left),innerWidth-210);s.innerHTML=k(c)+N(f,c)+`<div class="dt-type-card" style="left:${gt}px;top:${V}px">${R.map(([bt,Nt])=>`<span class="dt-type-row"><b>${bt}</b><span>${Nt}</span></span>`).join("")}</div>`},ht=f=>f.every(c=>c===f[0])?f[0]:f[1]===f[3]&&f[0]===f[2]?`${f[0]} ${f[1]}`:f.join(" "),E=f=>/^rgba\(.*,\s*0\)$|^transparent$/.test(f),at=(f,c,y,C="")=>{let B=16+y.length*18,I=c.bottom+B+12<innerHeight?c.bottom+8:Math.max(8,c.top-B-8),R=Math.min(Math.max(8,c.left),innerWidth-230);s.innerHTML=`<span class="dt-pad-outline" style="left:${c.left}px;top:${c.top}px;width:${c.width}px;height:${c.height}px${C?`;border-radius:${C}`:""}"></span>`+N(f,c)+`<div class="dt-type-card dt-style-card" style="left:${R}px;top:${I}px">${y.map(([j,V])=>`<span class="dt-type-row"><b>${j}</b><span>${V}</span></span>`).join("")}</div>`};return{spacer:p,drawPads:w,drawSize:F,drawType:Et,drawColor:f=>{let c=getComputedStyle(f),y=[];c.backgroundImage!=="none"&&y.push(["Fill",`<em>${/gradient/.test(c.backgroundImage)?"gradient":"image"}</em>`]),E(c.backgroundColor)||y.push(["Fill",q(c.backgroundColor)+dt(f,"background-color",c.backgroundColor)]),f.textContent?.trim()&&y.push(["Text",q(c.color)+dt(f,"color",c.color)]),Number(c.opacity)<1&&y.push(["Opacity",`${Math.round(Number(c.opacity)*100)}%`]),y.length||y.push(["Color","<em>no fill or text</em>"]),at(f,f.getBoundingClientRect(),y)},drawBorder:f=>{let c=getComputedStyle(f),y=[],C=["top","right","bottom","left"],B=C.map(I=>parseFloat(c.getPropertyValue(`border-${I}-width`))||0);if(B.some(I=>I>0)){let I=C.filter((j,V)=>B[V]>0);y.push(["Width",`${ht(B.map(i))} <em>${c.getPropertyValue(`border-${I[0]}-style`)}</em>`]);let R=I.map(j=>c.getPropertyValue(`border-${j}-color`));I.forEach((j,V)=>{V&&R[V]===R[0]||y.push([V?`\u21B3 ${j}`:"Color",q(R[V])+dt(f,`border-${j}-color`,R[V])])})}else y.push(["Width","<em>none</em>"]);let J=["top-left","top-right","bottom-right","bottom-left"].map(I=>{let[R,j=R]=c.getPropertyValue(`border-${I}-radius`).split(" "),V=gt=>gt.endsWith("%")?gt:i(parseFloat(gt)||0);return R===j?V(R):`${V(R)}/${V(j)}`});y.push(["Radius",ht(J)]),at(f,f.getBoundingClientRect(),y,c.borderRadius)}}}var Ft=s=>(s??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim();function wa(){let s=S=>{let g=[],T=S;for(;T&&T.tagName!=="HTML"&&g.length<8;){if(T.id){g.unshift("#"+CSS.escape(T.id));break}let _=T.parentElement,X=T.tagName.toLowerCase(),W=_?[..._.children].filter(dt=>dt.tagName===T.tagName):[];g.unshift(W.length>1?`${X}:nth-of-type(${W.indexOf(T)+1})`:X),T=_}return g.join(">")},i=(S,g)=>!g||Ft(S.textContent||"").slice(0,60)===g,d=(S,g)=>[S||"*",...(g||[]).map(T=>"."+CSS.escape(T))].join(""),m=S=>{try{return[...document.querySelectorAll(d(S.tag,S.classes))]}catch{return[]}},p=S=>{let g=Ft(S.textContent||"").replace(/\s+/g," ");for(let T=S.parentElement,_=0;T&&T!==document.body&&_<4;T=T.parentElement,_++){let X=Ft(T.textContent||"").replace(/\s+/g," ");if(X&&X!==g)return X}return""},x=S=>p(S).slice(0,80),k=(S,g)=>!g||p(S).startsWith(g),N=S=>{let g=null;try{g=document.querySelector(S.selector)}catch{g=null}if(g&&i(g,S.label)&&k(g,S.ctx))return g;let T=m(S),_=Ft(S.label)?T.filter(W=>i(W,S.label)):[];return(_.find(W=>k(W,S.ctx))??T.find(W=>S.ctx&&k(W,S.ctx)&&!Ft(S.label)))||_[0]||(g&&i(g,S.label)?g:null)||(S.nth!=null?T[S.nth]:null)||T[0]||g},w=S=>{let g=null;for(let T=S,_=S.parentElement;_&&_!==document.body&&getComputedStyle(T).position!=="fixed";T=_,_=_.parentElement){let X=getComputedStyle(_);if(X.overflowX==="visible"&&X.overflowY==="visible")continue;let W=_.getBoundingClientRect();g=g?{l:Math.max(g.l,W.left),t:Math.max(g.t,W.top),r:Math.min(g.r,W.right),b:Math.min(g.b,W.bottom)}:{l:W.left,t:W.top,r:W.right,b:W.bottom}}return g},F=S=>{let g=S.getBoundingClientRect();return(g.width>0||g.height>0)&&(!S.checkVisibility||S.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},$=(S,g)=>{for(let T=g.parentElement;T&&T!==document.body;T=T.parentElement){if(!F(T))continue;let _=g.getBoundingClientRect();if(_.width||_.height)return{x:_.left+_.width*S.rx,y:_.top+_.height*S.ry,off:"",el:g,hidden:T};let X=T.getBoundingClientRect();return{x:X.left,y:X.top,off:"",el:g,hidden:T}}return null};return{cssPath:s,poolOf:m,contextOf:x,resolveEl:N,anchorOf:(S,g=N(S))=>{if(!g)return null;if(!F(g))return $(S,g);let T=g.getBoundingClientRect(),_=T.left+T.width*S.rx,X=T.top+T.height*S.ry,W=w(g);if(!W)return{x:_,y:X,off:"",el:g};if(W.r-W.l<18||W.b-W.t<18)return null;let dt=Math.min(Math.max(_,W.l),W.r-18),q=Math.min(Math.max(X,W.t+18),W.b),Q=_<W.l?"l":_>W.r-18?"r":X<W.t+18?"t":X>W.b?"b":"";return{x:dt,y:q,off:Q,el:g}}}}var $a=(s,i)=>`<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="${i}" stroke="none" opacity="${d<s?1:.28}"/>`).join("")}</svg>`;function xa(s,i,d){let m=document.createElement("div");m.className="dt-field-menu",m.setAttribute("role","listbox"),m.hidden=!0,document.body.append(m);for(let k of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])m.addEventListener(k,N=>N.stopPropagation());let p=null,x=()=>{m.hidden=!0,p=null};for(let k of s)k.addEventListener("mousedown",N=>{let w=N.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!w){m.contains(N.target)||x();return}if(N.preventDefault(),p===w){x();return}p=w;let F=w.classList.contains("dt-more-select"),$=g=>F?g.dataset.on!=null:g.selected;m.innerHTML=[...w.options].map((g,T)=>g.hidden?"":`${g.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${T}" aria-selected="${$(g)}"${g.dataset.danger!=null?' class="is-danger"':""}>${g.dataset.icon?g.dataset.icon:g.dataset.initial!=null?g.dataset.face?`<img class="dt-face" src="${i(g.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(g.dataset.initial)}</b>`:`<i style="background:${i(g.dataset.c||"#717171")}"></i>`}<span>${i(g.text)}</span>${g.dataset.hint?`<small>${i(g.dataset.hint)}</small>`:""}${$(g)?d:""}</button>`).join("");let H=w.parentElement.getBoundingClientRect();m.style.left=`${H.left}px`,m.style.top=`${H.bottom+4}px`,m.style.minWidth=`${H.width}px`,m.hidden=!1;let S=m.getBoundingClientRect();S.bottom>innerHeight-8&&(m.style.top=`${H.top-4-S.height}px`),S.right>innerWidth-8&&(m.style.left=`${Math.max(8,H.right-S.width)}px`)});m.addEventListener("click",k=>{let N=k.target.closest("[data-i]");if(!N||!p)return;let w=p;x(),!(w.selectedIndex===Number(N.dataset.i)&&!w.classList.contains("dt-more-select"))&&(w.selectedIndex=Number(N.dataset.i),w.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",k=>{k.key==="Escape"&&!m.hidden&&(k.stopPropagation(),x())},!0),document.addEventListener("pointerdown",k=>{!m.hidden&&!m.contains(k.target)&&!k.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&x()},!0),addEventListener("scroll",k=>{m.contains(k.target)||x()},!0)}var Re=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[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>'},Ls=(s,i)=>s.toLocaleTimeString("en-US",i),In=s=>Ls(s,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),ur={island:s=>({side:12,top:12,bottom:12,r:s.w>=430?62:55,body:s.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:s=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((s.w+32)*.12),extraH:18}),laptop:s=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((s.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function pr(s,i,d,m,p){let x=s.w+2*i.side,k=s.h+i.top+i.bottom,N=(d-x)/2,w=`<rect class="dt-shell-screen" x="${p}" y="${i.top}" width="${s.w}" height="${s.h}" rx="${i.r}"/>`,F="";if(s.shell==="island"||s.shell==="home"||s.shell==="punch"){let $=(H,S,g)=>`<rect class="dt-shell-btn" x="${H}" y="${S}" width="4" height="${g}" rx="2"/>`;F+=s.shell==="punch"?$(N+x-1,150,70)+$(N+x-1,240,44):$(N-3,120,28)+$(N-3,170,56)+$(N-3,236,56)+$(N+x-1,190,90),F+=`<rect class="dt-shell-body" x="${N}" y="0" width="${x}" height="${k}" rx="${i.body}"/>`,F+=`<rect class="dt-shell-bezel" x="${N+3}" y="3" width="${x-6}" height="${k-6}" rx="${i.body-3}"/>`,s.shell==="home"&&(F+=`<rect class="dt-shell-slot" x="${d/2-26}" y="44" width="52" height="6" rx="3"/>`,F+=`<circle class="dt-shell-slot" cx="${d/2-48}" cy="47" r="5"/>`,F+=`<circle class="dt-shell-homebtn" cx="${d/2}" cy="${k-46}" r="28"/>`)}else if(s.shell==="tablet")F+=`<rect class="dt-shell-body dt-shell-body--light" x="${N}" y="0" width="${x}" height="${k}" rx="${i.body}"/>`,F+=`<rect class="dt-shell-bezel" x="${N+4}" y="4" width="${x-8}" height="${k-8}" rx="${i.body-4}"/>`;else if(s.shell==="monitor"){let $=Math.round(x*.1);F+=`<path class="dt-shell-stand" d="M${d/2-$/2} ${k-2}h${$}l${$*.2} 84h${-$*1.4}z"/>`,F+=`<rect class="dt-shell-stand" x="${d/2-x*.15}" y="${k+80}" width="${x*.3}" height="14" rx="7"/>`,F+=`<rect class="dt-shell-body" x="${N}" y="0" width="${x}" height="${k}" rx="${i.body}"/>`}else{let $=x+(i.extraW??0),H=(d-$)/2,S=i.extraH??16;F+=`<path class="dt-shell-body" d="M${N} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${x-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${k}H${N}z"/>`,F+=`<path class="dt-shell-base${s.shell==="macbook"?" dt-shell-base--silver":""}" d="M${H} ${k}h${$}v${S-8}a8 8 0 0 1-8 8H${H+8}a8 8 0 0 1-8-8z"/>`,F+=`<rect class="dt-shell-lip" x="${d/2-x*.07}" y="${k}" width="${x*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${d} ${m}" width="${d}" height="${m}" aria-hidden="true">${F}${w}</svg>`}var hr={"safari-ios":s=>{let i=s.shell==="home"?20:s.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})},mr=({d:s,now:i,cutout:d},m)=>{if(s.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${m}px"><span class="dt-sb-l">${z.signal}${z.wifi}</span><b>${In(i)}</b><span class="dt-sb-r">${z.battery}</span></div>`;let p=d??{x:(s.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${m}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">${In(i)}</b><span class="dt-sb-icons" style="top:${p.y}px;height:${p.height}px">${z.signal}${z.wifi}${z.battery}</span></div>`},gr=({d:s,host:i,min:d},m)=>{let p=s.shell==="home"?"":'<i class="dt-home-ind"></i>';return d?`<div class="dt-ios-bar is-min" style="height:${m}px"><span class="dt-ios-mini">${Re(i)}</span>${p}</div>`:`<div class="dt-ios-bar" style="height:${m}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back">${z.back}</button><span class="dt-glass dt-ios-url"><span>${Re(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-glass dt-glass--round">${z.dots}</span></div>${p}</div>`},br=({now:s,min:i},d)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Ls(s,{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>${Re(d)}</span></span><span class="dt-and-tabs">1</span>${z.dotsV}</div>`),fr=()=>`<div class="dt-and-nav">${z.recent}${z.home}${z.navBack}</div>`,vr=({now:s,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${In(s)} ${s.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">${z.back}</button><button data-nav="fwd">${z.fwd}</button></span><span class="dt-ipad-url">${z.lock}<span>${Re(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-bar-group">${z.share}${z.plus}${z.tabs}</span></div>`,yr=({now:s,host:i},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">${z.wifi}${z.battery}<span>${s.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${In(s)}</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">${z.back}</button><button data-nav="fwd">${z.fwd}</button></span><span class="dt-mac-url">${z.lock}<span>${Re(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-bar-group">${z.share}${z.plus}${z.tabs}</span></div>`,wr=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(s,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,$r=({host:s,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${Re(i||s)}</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">${z.back}</button><button data-nav="fwd">${z.fwd}</button><button data-nav="reload">${z.reload}</button></span><span class="dt-win-url">${z.tune}<span>${Re(s)}</span>${z.star}</span><span class="dt-bar-group">${z.user}${z.dotsV}</span></div>`,xr=({now:s})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,d)=>`<i style="--hue:${200+d*30}"></i>`).join("")}</span><span class="dt-win-tray">${z.chevUp}${z.wifi}${z.volume}${z.battery}<span class="dt-win-clock">${Ls(s,{hour:"numeric",minute:"2-digit"})}<br>${s.toLocaleDateString("en-US")}</span></span></div>`;function Ea(s,i){let d=ur[s.shell](s),m=s.w+2*d.side,p=s.h+d.top+d.bottom,x=m+(d.extraW??0),k=p+(s.shell==="monitor"||s.shell==="macbook"||s.shell==="laptop"?d.extraH??0:0),N=(x-m)/2+d.side,w=hr[s.browser](s),F=i.min?w.topMin??w.top:w.top,$=i.min?w.bottomMin??w.bottom:w.bottom,H={...i,d:s},S="",g="";switch(s.browser){case"safari-ios":S=mr(H,F),g=gr(H,$);break;case"chrome-android":S=br(H,i.host),g=fr();break;case"safari-ipad":S=vr(H),g='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":S=yr(H,s.shell==="macbook"),g=wr();break;case"chrome-windows":S=$r(H),g=xr(H);break}return{footprint:{w:x,h:k},screen:{x:N,y:d.top,w:s.w,h:s.h,r:d.r,rb:d.rb??d.r},topH:F,bottomH:$,shell:pr(s,d,x,k,N),top:S,bottom:g,canMinimize:w.topMin!==void 0&&(w.topMin!==w.top||w.bottomMin!==w.bottom),scrollbar:s.browser==="chrome-windows"?"classic":"overlay"}}var Ne=null;function ln(s){if(Ne??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!Ne||!s)return[0,0,0,0];Ne.clearRect(0,0,1,1),Ne.fillStyle="rgba(0, 0, 0, 0)",Ne.fillStyle=s,Ne.fillRect(0,0,1,1);let[i,d,m,p]=Ne.getImageData(0,0,1,1).data;return[i,d,m,p/255]}var rn=([s,i,d])=>`rgb(${s}, ${i}, ${d})`;function Ma(s){let i=s.defaultView,d=g=>!g||ln(g)[3]===0,m=[s.body,s.documentElement].map(g=>g&&i.getComputedStyle(g).backgroundColor).find(g=>g&&!d(g)),[p,x,k,N]=m?ln(m):[255,255,255,1],w=[p,x,k].map(g=>Math.round(g*N+255*(1-N))),F=g=>{let[T,_,X,W]=ln(g);if(W>=.75)return rn([T,_,X]);let dt=(q,Q)=>Math.round(q*W+Q*(1-W));return rn([dt(T,w[0]),dt(_,w[1]),dt(X,w[2])])},$=g=>{let T=s.elementFromPoint(i.innerWidth/2,g);for(;T&&T!==s.documentElement;T=T.parentElement){let _=i.getComputedStyle(T);if(_.position!=="fixed"&&_.position!=="sticky")continue;let X=T.getBoundingClientRect().width>=i.innerWidth*.9,W=_.backdropFilter&&_.backdropFilter!=="none";return X&&!W&&!d(_.backgroundColor)?F(_.backgroundColor):null}return null},H=s.querySelector('meta[name="theme-color"]')?.content||"",S=H&&!d(H)?rn(ln(H)):"";return{top:$(4)??rn(w),bottom:$(i.innerHeight-4)??rn(w),theme:S}}function Ts(s){let[i,d,m]=ln(s).map(p=>p/255).map(p=>p<=.04045?p/12.92:((p+.055)/1.055)**2.4);return .2126*i+.7152*d+.0722*m>.4?"#000":"#fff"}function ka(s){let{cfg:i,inFrame:d,persist:m,frame:p,frameEl:x,devicesMenu:k,bpBtns:N,notesOverlay:w,WIDE:F,bpOf:$,currentBp:H,deviceById:S,notesOn:g,filter:T,filterTo:_,dropFrameDrafts:X,putAway:W,tellFrame:dt,syncBpButtons:q,render:Q,reread:it}=s,pt=i.breakpoints,nt=document.querySelector(".dt-device"),Kt=document.querySelector(".dt-shell"),yt=document.querySelector('.dt-chrome[data-at="top"]'),Et=document.querySelector('.dt-chrome[data-at="bottom"]'),ht=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],at=document.querySelector(".dt-frame-size"),mt=document.querySelector(".dt-frame-rotate"),Bt=document.querySelector(".dt-frame-bars"),f="overlay",c="",y="dt-w",C="dt-canvas",B="dt-device",J=et.getItem(C)==="1",I=et.getItem(B)||"";I&&!S(I)&&(I="",et.setItem(B,""));let R=Number(et.getItem(y))||0,j="dt-emu",V=(()=>{try{return JSON.parse(et.getItem(j)||"null")}catch{return null}})(),gt=()=>V?tn.find(v=>v.id===V.id)??null:null,bt=()=>{let v=gt();return v?V.turned?{w:v.h,h:v.w}:{w:v.w,h:v.h}:null},Nt=et.getItem("dt-bars-min")==="1",Ct=v=>{V=v,m(j,v?JSON.stringify(v):"")},Rt=v=>{at.textContent=v,p.style.setProperty("--dt-badge-w",`${at.offsetWidth}px`)},kt=v=>{if(!v){ht.innerHTML="";return}let A="";for(let P=0;P<=v;P+=50)A+=`<span class="dt-tick${P%200===0?" is-major":""}" style="left:${P}px"></span>`;for(let P of pt)for(let ot of[P.min,P.max])ot>0&&Number.isFinite(ot)&&ot<=v&&(A+=`<span class="dt-edge" style="left:${ot}px" title="${P.label} edge"></span>`);ht.innerHTML=A,ht.style.width=`${v}px`},Ve=()=>{let v=parseFloat(nt.style.width)||0,A=parseFloat(nt.style.height)||0;if(!v||!A){nt.style.transform="",delete nt.dataset.scaled;return}let P=I||V?Math.min(1,(innerWidth-80)/v,(innerHeight-120)/A):Math.min(1,(innerWidth-80)/v);nt.style.transform=P<1?`scale(${P})`:"",nt.dataset.scaled=P<1?String(Math.round(P*100)):""},Pe=v=>tn.find(A=>A.w===v.w&&A.h===v.h&&A.cutout?.shape==="pill")?.cutout,ce=()=>{try{return x.contentDocument}catch{return null}},Y=()=>ce()?.title.split("\u2014").pop()?.trim()||"",be=()=>{let v=ce(),A=I?S(I):null;if(!v?.body||!A)return;let P=Ma(v),ot=A.browser==="chrome-android"?P.theme||"rgb(255, 255, 255)":P.top,lt=A.browser==="chrome-android"?"rgb(255, 255, 255)":P.bottom;nt.style.setProperty("--dt-top",ot),nt.style.setProperty("--dt-top-ink",Ts(ot)),nt.style.setProperty("--dt-bottom",lt),nt.style.setProperty("--dt-bottom-ink",Ts(lt));let wt=yt.querySelector(".dt-win-tab > span");wt&&(wt.textContent=Y()||location.host)},fe=0;x.addEventListener("load",()=>{let v=ce();if(!v)return;let A=window.__notemendHosted;if(A&&!x.contentWindow?.__notemendHosted&&!v.querySelector(`script[src^="${A.base}/bar.js"]`)){let P=v.createElement("script");P.src=`${A.base}/bar.js`,P.dataset.project=A.project,v.head.append(P)}be(),x.contentWindow?.addEventListener("scroll",()=>{fe||(fe=requestAnimationFrame(()=>{fe=0,be()}))},{passive:!0})});for(let v of[yt,Et])v.addEventListener("click",A=>{let P=A.target.closest("[data-nav]")?.dataset.nav;if(P)try{let ot=x.contentWindow?.navigation;if(!ce()||!ot)throw new Error("foreign");P==="back"?ot.canGoBack&&ot.back():P==="fwd"?ot.canGoForward&&ot.forward():ot.reload()}catch{(P==="reload"||P==="back")&&(x.src=location.href)}});Bt.addEventListener("click",()=>{Nt=!Nt,m("dt-bars-min",Nt?"1":"0"),Pt()});let Pt=()=>{if(d)return;let v=I?S(I)??null:null;if(I&&!v&&(I="",et.setItem(B,"")),!v&&!J){p.hidden=!0,x.removeAttribute("src"),At.toggle("dt-framing",!1),w.hidden=!g(),ht.innerHTML="",q(),mt.hidden=!0,Bt.hidden=!0,_(null),c="",X(),q(),vt(),it();return}if(p.hidden=!1,At.toggle("dt-framing",!0),w.hidden=!0,x.src||(x.src=location.href),v){let A=Ea(v,{host:location.host,title:Y(),now:new Date,min:Nt,cutout:Pe(v)}),{screen:P}=A;p.dataset.mode="device",nt.dataset.shell=v.shell,nt.dataset.browser=v.browser,nt.style.width=`${A.footprint.w}px`,nt.style.height=`${A.footprint.h}px`,nt.style.setProperty("--dt-r",`${P.r}px`),nt.style.setProperty("--dt-rb",`${P.rb}px`),Kt.innerHTML=A.shell;let ot=(Ut,Ht,Lt,Zt)=>{Ut.innerHTML=Zt,Ut.style.cssText=`left:${P.x}px;top:${Ht}px;width:${P.w}px;height:${Lt}px`};ot(yt,P.y,A.topH,A.top),ot(Et,P.y+P.h-A.bottomH,A.bottomH,A.bottom);let lt=P.h-A.topH-A.bottomH;x.style.position="absolute",x.style.left=`${P.x}px`,x.style.top=`${P.y+A.topH}px`,x.style.width=`${P.w}px`,x.style.height=`${lt}px`,ht.innerHTML="";let wt=Nt&&A.canMinimize;f=A.scrollbar,c=`${v.label}${wt?" \xB7 bars folded":""}`,_($(v.w)),dt({notes:g(),scrollbar:f,device:c}),Bt.hidden=!A.canMinimize,Bt.setAttribute("aria-pressed",String(wt)),Rt(`${v.label} \xB7 page ${v.w}\xD7${lt} of ${v.w}\xD7${v.h}${wt?" \xB7 bars folded":""} \xB7 ${pt.find(Ut=>Ut.id===T())?.label??""}`),be()}else{let A=bt();A||Ct(null);let P=A?.w||R||pt.find(wt=>wt.id===H()).ideal;R=P,p.dataset.mode="canvas",delete nt.dataset.shell,delete nt.dataset.browser,Kt.innerHTML=yt.innerHTML=Et.innerHTML="",yt.style.cssText=Et.style.cssText="",Bt.hidden=!0,f="overlay",nt.style.width=`${P}px`,nt.style.height=`${A?.h??innerHeight-84}px`,x.style.position="",x.style.left=x.style.top="",x.style.width="100%",x.style.height="100%",kt(P),dt({notes:g()});let ot=pt.find(wt=>wt.id===$(P)),lt=gt();c=lt?`${lt.label}${V?.turned?" \xB7 landscape":""}`:"",dt({scrollbar:f,device:c}),Rt(lt&&A?`${lt.label} \xB7 ${A.w}\xD7${A.h} \xB7 ${ot.label}`:`${P}px \xB7 ${ot.label}`),_($(P))}mt.hidden=!(gt()?.rotates&&!v),vt(),Ve(),q(),it()},G=v=>{let A=pt.find(P=>P.id===v);I="",et.setItem(B,""),Ct(null),J=v!==F,R=J?A.ideal:0,_(J?v:null),et.setItem(C,J?"1":"0"),et.setItem(y,String(R)),W(),Pt()};for(let v of N)v.addEventListener("click",()=>G(v.dataset.bp));for(let v of document.querySelectorAll("[data-device]"))v.addEventListener("click",()=>{I=v.dataset.device===I?"":v.dataset.device,et.setItem(B,I),k.open=!1,Pt()});for(let v of document.querySelectorAll("[data-emu]"))v.addEventListener("click",()=>{let A=V?.id===v.dataset.emu&&!I;I="",et.setItem(B,""),Ct(A?null:{id:v.dataset.emu,turned:!1}),J=!A,R=0,et.setItem(C,J?"1":"0"),_(null),W(),k.open=!1,Pt()});mt.addEventListener("click",()=>{V&&(Ct({...V,turned:!V.turned}),W(),Pt())});let Mt=[...k.querySelectorAll("[data-tab]")],st=[...k.querySelectorAll("[data-panel]")],M=v=>{for(let A of Mt)A.setAttribute("aria-selected",String(A.dataset.tab===v));for(let A of st)A.hidden=A.dataset.panel!==v;m("dt-devices-tab",v)};for(let v of Mt)v.addEventListener("click",()=>M(v.dataset.tab));M(et.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let ve=k.querySelector(".dt-emu-search");ve.addEventListener("input",()=>{let v=ve.value.trim().toLowerCase(),A=null,P=!1,ot=()=>{A&&(A.hidden=!P)};for(let lt of ve.parentElement.children){if(lt.classList.contains("dt-devices-group")){ot(),A=lt,P=!1;continue}lt.dataset.emu&&(lt.hidden=!!v&&!lt.textContent.toLowerCase().includes(v),P||=!lt.hidden)}ot()});let It=k.querySelector(".dt-devices-name");function vt(){for(let A of k.querySelectorAll("[data-device]"))A.setAttribute("aria-pressed",String(A.dataset.device===I));let v=!I&&!p.hidden?V?.id:void 0;for(let A of k.querySelectorAll("[data-emu]"))A.setAttribute("aria-pressed",String(A.dataset.emu===v));It.textContent=I&&S(I)?.label||v&&gt()?.label||"Device"}let rt=v=>pt.find(A=>A.id===v),St=v=>{let A=rt(T()??H());return Math.max(A.min||320,Math.min(Number.isFinite(A.max)?A.max:2560,Math.round(v)))};for(let v of E){let A=v.dataset.edge==="l"?-1:1;v.addEventListener("pointerdown",P=>{if(I)return;P.preventDefault(),V&&(Ct(null),Pt()),v.setPointerCapture(P.pointerId);let ot=P.clientX,lt=R,wt=Number(nt.dataset.scaled||100)/100;p.dataset.dragging="1";let Ut=Lt=>{R=St(lt+A*(Lt.clientX-ot)*2/wt),nt.style.width=`${R}px`,kt(R),Rt(`${R}px \xB7 ${rt($(R)).label}`),Ve()},Ht=()=>{v.removeEventListener("pointermove",Ut),v.removeEventListener("pointerup",Ht),v.removeEventListener("pointercancel",Ht),delete p.dataset.dragging,et.setItem(y,String(R)),Pt()};v.addEventListener("pointermove",Ut),v.addEventListener("pointerup",Ht),v.addEventListener("pointercancel",Ht)}),v.addEventListener("dblclick",()=>{if(I)return;Ct(null);let P=rt(T()??H()),ot=[P.min||320,Number.isFinite(P.max)?P.max:P.ideal];R=Math.abs(R-ot[0])<Math.abs(R-ot[1])?ot[0]:ot[1],et.setItem(y,String(R)),Pt()})}let ye=H();return addEventListener("resize",()=>{q(),H()!==ye&&(ye=H(),Q()),p.hidden||(!I&&!V&&(nt.style.height=`${innerHeight-84}px`),Ve())}),{apply:Pt,pickBp:G,look:()=>({scrollbar:f,device:c}),restore:()=>{J||I?Pt():vt()}}}var Sa='<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>',La='<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>',Er='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Ta(s){let{bp:i,notes:d,breakpoints:m,bandOfNote:p,whoseAgent:x,statusTools:k,showResolved:N,showArchived:w,drafts:F,find:$}=s,H=d.filter(E=>p(E)===i),S=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(at=>!at.deleted).map(at=>at.text)].join(" ").toLowerCase(),g=E=>$.view==="me"?s.forMe(E):$.view==="agent"?s.forAgent(E):!0,T=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,_=H.filter(E=>g(E)&&(!$.q||S(E).includes($.q.trim().toLowerCase()))).sort((E,at)=>($.sort==="unread"?Number(s.unread(at))-Number(s.unread(E)):0)||T(at)-T(E)),X={open:[],claude:[],done:[],archived:[]};for(let E of _)X[ut(E)==="done"&&s.archived(E)?"archived":ut(E)].push(E);let W=E=>{let at=(E.replies??[]).filter(B=>!B.deleted),mt=at.length+(E.note?1:0),Bt=He(E.category),f=ut(E),c=f==="claude",y=s.orphan(E),C=at.length?at[at.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text};return`<div class="dt-hist-row is-${f}${f==="done"?s.archived(E)?" is-archived":" is-resolved":""}${y?" is-orphan":""}">
150
+ `)}var Sa=[{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"/>'}],Bs=(s,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${s.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s.icon}</svg>`,Re=s=>Sa.find(i=>i.id===s)||Sa[0];var pt=s=>s.status!=="done"?"open":s.doneBy==="claude"?"claude":"done",Ta={open:"Open",done:"Resolved",claude:"Resolved by an agent"};var Ht={ready:Promise.resolve(),toggle:(s,i)=>{Ht.ready.then(()=>document.documentElement.classList.toggle(s,i))},set:(s,i)=>{Ht.ready.then(()=>document.documentElement.style.setProperty(s,i))}};var Mr=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Aa=s=>String(s??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(Mr,"$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 In=[],Ns=s=>{if(s instanceof Error)return`${s.name}: ${s.message}`;if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}},Pe=(s,i)=>{In.push({at:new Date().toISOString(),kind:s,text:Aa(i.replace(/\s+/g," ").trim()).slice(0,500)}),In.length>50&&In.shift()},Ca=!1;function Ha(s){if(Ca||typeof window>"u")return;Ca=!0;let i=console.error;console.error=(...p)=>{Pe("console",p.map(Ns).join(" ")),i.apply(console,p)},addEventListener("error",p=>{if(p instanceof ErrorEvent)return Pe("error",`${p.message}${p.filename?` (${p.filename}:${p.lineno})`:""}`);let x=p.target,k=x?.src||x?.href;k&&!s(k)&&Pe("network",`${x.tagName?.toLowerCase()} ${k} did not load`)},!0),addEventListener("unhandledrejection",p=>Pe("rejection",Ns(p.reason)));let d=window.fetch;window.fetch=async(p,x)=>{let k=typeof p=="string"?p:p instanceof URL?p.href:p.url,N=(x?.method||(p instanceof Request?p.method:"GET")).toUpperCase();try{let w=await d.call(window,p,x);return w.status>=400&&!s(k)&&Pe("network",`${N} ${k} \u2192 ${w.status}`),w}catch(w){throw!s(k)&&w?.name!=="AbortError"&&Pe("network",`${N} ${k} \u2192 no answer (${Ns(w)})`),w}};let m=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(p,x,...k){return this._nm=`${p.toUpperCase()} ${String(x)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(s(String(x))||Pe("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),m.call(this,p,x,...k)}}var Ba=(s=Date.now())=>In.filter(i=>s-Date.parse(i.at)<10*6e4).slice(-20);function Na(s){let i=f=>{let c=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,y=f/c;return Math.round(y*10)%10===0?String(Math.round(y)):y.toFixed(1)},d=(f,c,y,C,B,J="p")=>{if(y<=0||C<=0)return"";let I=B!==""?`<span class="dt-pad-chip dt-pad-chip--${J}" style="left:${f+y/2}px;top:${c+C/2}px">${B}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${J}" style="left:${f}px;top:${c}px;width:${y}px;height:${C}px"></span>${I}`},m=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],p=f=>{let c=f;for(let y=0;c&&y<6;y++,c=c.parentElement){let C=getComputedStyle(c);if(m.some(B=>parseFloat(C[B])>=2))return c}return f},x=(f,c)=>{let y=parseFloat(c.columnGap)||0,C=parseFloat(c.rowGap)||0;if(!(c.display.includes("flex")||c.display.includes("grid"))||!y&&!C)return"";let B=[...f.children].map(I=>I.getBoundingClientRect()).filter(I=>I.width||I.height),J="";for(let I=1;I<B.length;I++){let R=B[I-1],j=B[I];if(y&&j.left>=R.right-1){let V=Math.max(R.top,j.top);J+=d(R.right,V,j.left-R.right,Math.min(R.bottom,j.bottom)-V,i(y),"g")}else if(C&&j.top>=R.bottom-1){let V=Math.min(R.left,j.left);J+=d(V,R.bottom,Math.max(R.right,j.right)-V,j.top-R.bottom,i(C),"g")}}return J},k=f=>`<span class="dt-pad-outline" style="left:${f.left}px;top:${f.top}px;width:${f.width}px;height:${f.height}px"></span>`,N=(f,c,y="")=>`<span class="dt-pad-tag" style="left:${c.left}px;top:${Math.max(2,c.top-22)}px">${f.tagName.toLowerCase()+(f.classList[0]?"."+f.classList[0]:"")}${y}</span>`,w=f=>{let c=f.getBoundingClientRect(),y=getComputedStyle(f),C=parseFloat(y.paddingTop),B=parseFloat(y.paddingRight),J=parseFloat(y.paddingBottom),I=parseFloat(y.paddingLeft),R=k(c);R+=d(c.left,c.top,c.width,C,C>=2?i(C):""),R+=d(c.left,c.bottom-J,c.width,J,J>=2?i(J):""),R+=d(c.left,c.top+C,I,c.height-C-J,I>=2?i(I):""),R+=d(c.right-B,c.top+C,B,c.height-C-J,B>=2?i(B):"");let j=parseFloat(y.marginTop),V=parseFloat(y.marginRight),bt=parseFloat(y.marginBottom),ft=parseFloat(y.marginLeft);R+=d(c.left,c.top-j,c.width,j,j>=2?i(j):"","m"),R+=d(c.left,c.bottom,c.width,bt,bt>=2?i(bt):"","m"),R+=d(c.left-ft,c.top,ft,c.height,ft>=2?i(ft):"","m"),R+=d(c.right,c.top,V,c.height,V>=2?i(V):"","m"),R+=x(f,y);let Ot=parseFloat(y.columnGap)||0,Nt=parseFloat(y.rowGap)||0,It=(y.display.includes("flex")||y.display.includes("grid"))&&(Ot||Nt)?` \xB7 gap ${i(Ot)}${Nt&&Nt!==Ot?"/"+i(Nt):""}`:"";s.innerHTML=R+N(f,c,It)},F=f=>{let c=f.getBoundingClientRect();s.innerHTML=k(c)+`<span class="dt-pad-chip" style="left:${c.left+c.width/2}px;top:${c.top+c.height/2}px">${i(c.width)} \xD7 ${i(c.height)}</span>`+N(f,c)},$=f=>{let c=(f.match(/[\d.]+/g)||[]).map(Number);if(c.length<3)return f;let y="#"+c.slice(0,3).map(C=>Math.round(C).toString(16).padStart(2,"0")).join("");return c[3]!==void 0&&c[3]<1?`${y} \xB7 ${Math.round(c[3]*100)}%`:y},H=null,L=()=>{if(H)return H;let f=getComputedStyle(document.documentElement),c=document.createElement("span");c.style.display="none",document.body.append(c);let y=[];for(let C of Array.from(f)){if(!C.startsWith("--"))continue;let B=f.getPropertyValue(C).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(B))continue;c.style.color="rgb(1, 2, 3)",c.style.color=B;let J=getComputedStyle(c).color;J&&J!=="rgb(1, 2, 3)"&&y.push([J,C])}return c.remove(),y.sort((C,B)=>C[1].length-B[1].length),H=y,y},b=f=>L().find(([c])=>c===f)?.[1]??"",T=null,_=()=>{if(T)return T;let f=[],c=y=>{for(let C of Array.from(y))C instanceof CSSStyleRule?C.style.cssText.includes("var(--")&&f.push({sel:C.selectorText,style:C.style}):C instanceof CSSMediaRule?matchMedia(C.conditionText).matches&&c(C.cssRules):"cssRules"in C&&c(C.cssRules)};for(let y of Array.from(document.styleSheets))try{c(y.cssRules)}catch{}return T=f},X={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(f=>[`border-${f}-color`,[`border-${f}-color`,"border-color",`border-${f}`,"border"]]))},W=(f,c)=>{let y=X[c]??[c],C=c==="color";for(let B=f;B;B=C?B.parentElement:null){let J=j=>y.map(V=>/var\(\s*(--[\w-]+)/.exec(j.getPropertyValue(V))?.[1]).find(Boolean),I=B instanceof HTMLElement?J(B.style):void 0;if(I)return I;let R="";for(let j of _()){let V=!1;try{V=B.matches(j.sel)}catch{}V&&(R=J(j.style)||R)}if(R)return R;if(C&&B.parentElement&&getComputedStyle(B).color!==getComputedStyle(B.parentElement).color)break}return""},ct=(f,c,y)=>{let C=W(f,c);if(C)return`<b class="dt-var">${C}</b> <em>${$(y)}</em>`;let B=b(y);return B?`<span title="Same value as ${B}; not written with it">\u2248 ${B}</span> <em>${$(y)}</em>`:$(y)},q=f=>`<i class="dt-type-sw" style="background:${f}"></i>`,Q={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},it=f=>(f.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ht=(f,c)=>f.slice(0,3).map((y,C)=>y*f[3]+c[C]*(1-f[3])).concat([1]),nt=f=>{let c=[];for(let y=f;y;y=y.parentElement){let C=getComputedStyle(y);if(C.backgroundImage!=="none")return null;let B=it(C.backgroundColor);if(B[3]>0&&(c.push(B),B[3]>=1))break}return c.reduceRight((y,C)=>ht(C,y),[255,255,255,1])},Yt=f=>{let[c,y,C]=f.slice(0,3).map(B=>(B/=255,B<=.03928?B/12.92:((B+.055)/1.055)**2.4));return .2126*c+.7152*y+.0722*C},yt=(f,c,y)=>{let C=nt(f);if(!C)return["Contrast","<em>on an image</em>"];let B=ht(it(c.color),C),[J,I]=[Yt(B),Yt(C)].sort((bt,ft)=>ft-bt),R=(J+.05)/(I+.05),j=y>=24||y>=18.66&&Number(c.fontWeight)>=700,V=R>=(j?4.5:7)?"AAA":R>=(j?3:4.5)?"AA":"fails AA";return["Contrast",`${R.toFixed(2)}:1 <em class="${V==="fails AA"?"dt-type-bad":""}">${V}${j?" \xB7 large":""}</em>`]},Mt=f=>{let c=f.getBoundingClientRect(),y=getComputedStyle(f),C=parseFloat(y.fontSize),B=y.lineHeight==="normal"?0:parseFloat(y.lineHeight),J=parseFloat(y.letterSpacing)||0,I=ft=>`${(ft*100).toFixed(1).replace(/\.0$/,"")}%`,R=[["Font",y.fontFamily.split(",")[0].replace(/["']/g,"")+(y.fontStyle!=="normal"?` ${y.fontStyle}`:"")],["Weight",`${Q[y.fontWeight]??""} <em>${y.fontWeight}</em>`],["Size",`${i(C)}px`],["Line",B?`${I(B/C)} <em>${i(B)}px</em>`:"normal"],["Letter",J?`${I(J/C)} <em>${J.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",q(y.color)+ct(f,"color",y.color)],yt(f,y,C)],V=c.bottom+150<innerHeight?c.bottom+8:Math.max(8,c.top-158),bt=Math.min(Math.max(8,c.left),innerWidth-210);s.innerHTML=k(c)+N(f,c)+`<div class="dt-type-card" style="left:${bt}px;top:${V}px">${R.map(([ft,Ot])=>`<span class="dt-type-row"><b>${ft}</b><span>${Ot}</span></span>`).join("")}</div>`},mt=f=>f.every(c=>c===f[0])?f[0]:f[1]===f[3]&&f[0]===f[2]?`${f[0]} ${f[1]}`:f.join(" "),E=f=>/^rgba\(.*,\s*0\)$|^transparent$/.test(f),at=(f,c,y,C="")=>{let B=16+y.length*18,I=c.bottom+B+12<innerHeight?c.bottom+8:Math.max(8,c.top-B-8),R=Math.min(Math.max(8,c.left),innerWidth-230);s.innerHTML=`<span class="dt-pad-outline" style="left:${c.left}px;top:${c.top}px;width:${c.width}px;height:${c.height}px${C?`;border-radius:${C}`:""}"></span>`+N(f,c)+`<div class="dt-type-card dt-style-card" style="left:${R}px;top:${I}px">${y.map(([j,V])=>`<span class="dt-type-row"><b>${j}</b><span>${V}</span></span>`).join("")}</div>`};return{spacer:p,drawPads:w,drawSize:F,drawType:Mt,drawColor:f=>{let c=getComputedStyle(f),y=[];c.backgroundImage!=="none"&&y.push(["Fill",`<em>${/gradient/.test(c.backgroundImage)?"gradient":"image"}</em>`]),E(c.backgroundColor)||y.push(["Fill",q(c.backgroundColor)+ct(f,"background-color",c.backgroundColor)]),f.textContent?.trim()&&y.push(["Text",q(c.color)+ct(f,"color",c.color)]),Number(c.opacity)<1&&y.push(["Opacity",`${Math.round(Number(c.opacity)*100)}%`]),y.length||y.push(["Color","<em>no fill or text</em>"]),at(f,f.getBoundingClientRect(),y)},drawBorder:f=>{let c=getComputedStyle(f),y=[],C=["top","right","bottom","left"],B=C.map(I=>parseFloat(c.getPropertyValue(`border-${I}-width`))||0);if(B.some(I=>I>0)){let I=C.filter((j,V)=>B[V]>0);y.push(["Width",`${mt(B.map(i))} <em>${c.getPropertyValue(`border-${I[0]}-style`)}</em>`]);let R=I.map(j=>c.getPropertyValue(`border-${j}-color`));I.forEach((j,V)=>{V&&R[V]===R[0]||y.push([V?`\u21B3 ${j}`:"Color",q(R[V])+ct(f,`border-${j}-color`,R[V])])})}else y.push(["Width","<em>none</em>"]);let J=["top-left","top-right","bottom-right","bottom-left"].map(I=>{let[R,j=R]=c.getPropertyValue(`border-${I}-radius`).split(" "),V=bt=>bt.endsWith("%")?bt:i(parseFloat(bt)||0);return R===j?V(R):`${V(R)}/${V(j)}`});y.push(["Radius",mt(J)]),at(f,f.getBoundingClientRect(),y,c.borderRadius)}}}var Bt=s=>(s??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim();function Ra(){let s=L=>{let b=[],T=L;for(;T&&T.tagName!=="HTML"&&b.length<8;){if(T.id){b.unshift("#"+CSS.escape(T.id));break}let _=T.parentElement,X=T.tagName.toLowerCase(),W=_?[..._.children].filter(ct=>ct.tagName===T.tagName):[];b.unshift(W.length>1?`${X}:nth-of-type(${W.indexOf(T)+1})`:X),T=_}return b.join(">")},i=(L,b)=>!b||Bt(L.textContent||"").slice(0,60)===b,d=(L,b)=>[L||"*",...(b||[]).map(T=>"."+CSS.escape(T))].join(""),m=L=>{try{return[...document.querySelectorAll(d(L.tag,L.classes))]}catch{return[]}},p=L=>{let b=Bt(L.textContent||"").replace(/\s+/g," ");for(let T=L.parentElement,_=0;T&&T!==document.body&&_<4;T=T.parentElement,_++){let X=Bt(T.textContent||"").replace(/\s+/g," ");if(X&&X!==b)return X}return""},x=L=>p(L).slice(0,80),k=(L,b)=>!b||p(L).startsWith(b),N=L=>{let b=null;try{b=document.querySelector(L.selector)}catch{b=null}if(b&&i(b,L.label)&&k(b,L.ctx))return b;let T=m(L),_=Bt(L.label)?T.filter(W=>i(W,L.label)):[];return(_.find(W=>k(W,L.ctx))??T.find(W=>L.ctx&&k(W,L.ctx)&&!Bt(L.label)))||_[0]||(b&&i(b,L.label)?b:null)||(L.nth!=null?T[L.nth]:null)||T[0]||b},w=L=>{let b=null;for(let T=L,_=L.parentElement;_&&_!==document.body&&getComputedStyle(T).position!=="fixed";T=_,_=_.parentElement){let X=getComputedStyle(_);if(X.overflowX==="visible"&&X.overflowY==="visible")continue;let W=_.getBoundingClientRect();b=b?{l:Math.max(b.l,W.left),t:Math.max(b.t,W.top),r:Math.min(b.r,W.right),b:Math.min(b.b,W.bottom)}:{l:W.left,t:W.top,r:W.right,b:W.bottom}}return b},F=L=>{let b=L.getBoundingClientRect();return(b.width>0||b.height>0)&&(!L.checkVisibility||L.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},$=(L,b)=>{for(let T=b.parentElement;T&&T!==document.body;T=T.parentElement){if(!F(T))continue;let _=b.getBoundingClientRect();if(_.width||_.height)return{x:_.left+_.width*L.rx,y:_.top+_.height*L.ry,off:"",el:b,hidden:T};let X=T.getBoundingClientRect();return{x:X.left,y:X.top,off:"",el:b,hidden:T}}return null};return{cssPath:s,poolOf:m,contextOf:x,resolveEl:N,anchorOf:(L,b=N(L))=>{if(!b)return null;if(!F(b))return $(L,b);let T=b.getBoundingClientRect(),_=T.left+T.width*L.rx,X=T.top+T.height*L.ry,W=w(b);if(!W)return{x:_,y:X,off:"",el:b};if(W.r-W.l<18||W.b-W.t<18)return null;let ct=Math.min(Math.max(_,W.l),W.r-18),q=Math.min(Math.max(X,W.t+18),W.b),Q=_<W.l?"l":_>W.r-18?"r":X<W.t+18?"t":X>W.b?"b":"";return{x:ct,y:q,off:Q,el:b}}}}var Pa=(s,i)=>`<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="${i}" stroke="none" opacity="${d<s?1:.28}"/>`).join("")}</svg>`;function Oa(s,i,d){let m=document.createElement("div");m.className="dt-field-menu",m.setAttribute("role","listbox"),m.hidden=!0,document.body.append(m);for(let k of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])m.addEventListener(k,N=>N.stopPropagation());let p=null,x=()=>{m.hidden=!0,p=null};for(let k of s)k.addEventListener("mousedown",N=>{let w=N.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!w){m.contains(N.target)||x();return}if(N.preventDefault(),p===w){x();return}p=w;let F=w.classList.contains("dt-more-select"),$=b=>F?b.dataset.on!=null:b.selected;m.innerHTML=[...w.options].map((b,T)=>b.hidden?"":`${b.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${T}" aria-selected="${$(b)}"${b.dataset.danger!=null?' class="is-danger"':""}>${b.dataset.icon?b.dataset.icon:b.dataset.initial!=null?b.dataset.face?`<img class="dt-face" src="${i(b.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(b.dataset.initial)}</b>`:`<i style="background:${i(b.dataset.c||"#717171")}"></i>`}<span>${i(b.text)}</span>${b.dataset.hint?`<small>${i(b.dataset.hint)}</small>`:""}${$(b)?d:""}</button>`).join("");let H=w.parentElement.getBoundingClientRect();m.style.left=`${H.left}px`,m.style.top=`${H.bottom+4}px`,m.style.minWidth=`${H.width}px`,m.hidden=!1;let L=m.getBoundingClientRect();L.bottom>innerHeight-8&&(m.style.top=`${H.top-4-L.height}px`),L.right>innerWidth-8&&(m.style.left=`${Math.max(8,H.right-L.width)}px`)});m.addEventListener("click",k=>{let N=k.target.closest("[data-i]");if(!N||!p)return;let w=p;x(),!(w.selectedIndex===Number(N.dataset.i)&&!w.classList.contains("dt-more-select"))&&(w.selectedIndex=Number(N.dataset.i),w.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",k=>{k.key==="Escape"&&!m.hidden&&(k.stopPropagation(),x())},!0),document.addEventListener("pointerdown",k=>{!m.hidden&&!m.contains(k.target)&&!k.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&x()},!0),addEventListener("scroll",k=>{m.contains(k.target)||x()},!0)}var Ie=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[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>'},Rs=(s,i)=>s.toLocaleTimeString("en-US",i),Dn=s=>Rs(s,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),kr={island:s=>({side:12,top:12,bottom:12,r:s.w>=430?62:55,body:s.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:s=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((s.w+32)*.12),extraH:18}),laptop:s=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((s.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function Lr(s,i,d,m,p){let x=s.w+2*i.side,k=s.h+i.top+i.bottom,N=(d-x)/2,w=`<rect class="dt-shell-screen" x="${p}" y="${i.top}" width="${s.w}" height="${s.h}" rx="${i.r}"/>`,F="";if(s.shell==="island"||s.shell==="home"||s.shell==="punch"){let $=(H,L,b)=>`<rect class="dt-shell-btn" x="${H}" y="${L}" width="4" height="${b}" rx="2"/>`;F+=s.shell==="punch"?$(N+x-1,150,70)+$(N+x-1,240,44):$(N-3,120,28)+$(N-3,170,56)+$(N-3,236,56)+$(N+x-1,190,90),F+=`<rect class="dt-shell-body" x="${N}" y="0" width="${x}" height="${k}" rx="${i.body}"/>`,F+=`<rect class="dt-shell-bezel" x="${N+3}" y="3" width="${x-6}" height="${k-6}" rx="${i.body-3}"/>`,s.shell==="home"&&(F+=`<rect class="dt-shell-slot" x="${d/2-26}" y="44" width="52" height="6" rx="3"/>`,F+=`<circle class="dt-shell-slot" cx="${d/2-48}" cy="47" r="5"/>`,F+=`<circle class="dt-shell-homebtn" cx="${d/2}" cy="${k-46}" r="28"/>`)}else if(s.shell==="tablet")F+=`<rect class="dt-shell-body dt-shell-body--light" x="${N}" y="0" width="${x}" height="${k}" rx="${i.body}"/>`,F+=`<rect class="dt-shell-bezel" x="${N+4}" y="4" width="${x-8}" height="${k-8}" rx="${i.body-4}"/>`;else if(s.shell==="monitor"){let $=Math.round(x*.1);F+=`<path class="dt-shell-stand" d="M${d/2-$/2} ${k-2}h${$}l${$*.2} 84h${-$*1.4}z"/>`,F+=`<rect class="dt-shell-stand" x="${d/2-x*.15}" y="${k+80}" width="${x*.3}" height="14" rx="7"/>`,F+=`<rect class="dt-shell-body" x="${N}" y="0" width="${x}" height="${k}" rx="${i.body}"/>`}else{let $=x+(i.extraW??0),H=(d-$)/2,L=i.extraH??16;F+=`<path class="dt-shell-body" d="M${N} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${x-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${k}H${N}z"/>`,F+=`<path class="dt-shell-base${s.shell==="macbook"?" dt-shell-base--silver":""}" d="M${H} ${k}h${$}v${L-8}a8 8 0 0 1-8 8H${H+8}a8 8 0 0 1-8-8z"/>`,F+=`<rect class="dt-shell-lip" x="${d/2-x*.07}" y="${k}" width="${x*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${d} ${m}" width="${d}" height="${m}" aria-hidden="true">${F}${w}</svg>`}var Sr={"safari-ios":s=>{let i=s.shell==="home"?20:s.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})},Tr=({d:s,now:i,cutout:d},m)=>{if(s.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${m}px"><span class="dt-sb-l">${z.signal}${z.wifi}</span><b>${Dn(i)}</b><span class="dt-sb-r">${z.battery}</span></div>`;let p=d??{x:(s.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${m}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">${Dn(i)}</b><span class="dt-sb-icons" style="top:${p.y}px;height:${p.height}px">${z.signal}${z.wifi}${z.battery}</span></div>`},Ar=({d:s,host:i,min:d},m)=>{let p=s.shell==="home"?"":'<i class="dt-home-ind"></i>';return d?`<div class="dt-ios-bar is-min" style="height:${m}px"><span class="dt-ios-mini">${Ie(i)}</span>${p}</div>`:`<div class="dt-ios-bar" style="height:${m}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back">${z.back}</button><span class="dt-glass dt-ios-url"><span>${Ie(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-glass dt-glass--round">${z.dots}</span></div>${p}</div>`},Cr=({now:s,min:i},d)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Rs(s,{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>${Ie(d)}</span></span><span class="dt-and-tabs">1</span>${z.dotsV}</div>`),Hr=()=>`<div class="dt-and-nav">${z.recent}${z.home}${z.navBack}</div>`,Br=({now:s,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Dn(s)} ${s.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">${z.back}</button><button data-nav="fwd">${z.fwd}</button></span><span class="dt-ipad-url">${z.lock}<span>${Ie(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-bar-group">${z.share}${z.plus}${z.tabs}</span></div>`,Nr=({now:s,host:i},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">${z.wifi}${z.battery}<span>${s.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${Dn(s)}</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">${z.back}</button><button data-nav="fwd">${z.fwd}</button></span><span class="dt-mac-url">${z.lock}<span>${Ie(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-bar-group">${z.share}${z.plus}${z.tabs}</span></div>`,Rr=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(s,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,Pr=({host:s,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${Ie(i||s)}</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">${z.back}</button><button data-nav="fwd">${z.fwd}</button><button data-nav="reload">${z.reload}</button></span><span class="dt-win-url">${z.tune}<span>${Ie(s)}</span>${z.star}</span><span class="dt-bar-group">${z.user}${z.dotsV}</span></div>`,Or=({now:s})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,d)=>`<i style="--hue:${200+d*30}"></i>`).join("")}</span><span class="dt-win-tray">${z.chevUp}${z.wifi}${z.volume}${z.battery}<span class="dt-win-clock">${Rs(s,{hour:"numeric",minute:"2-digit"})}<br>${s.toLocaleDateString("en-US")}</span></span></div>`;function Ia(s,i){let d=kr[s.shell](s),m=s.w+2*d.side,p=s.h+d.top+d.bottom,x=m+(d.extraW??0),k=p+(s.shell==="monitor"||s.shell==="macbook"||s.shell==="laptop"?d.extraH??0:0),N=(x-m)/2+d.side,w=Sr[s.browser](s),F=i.min?w.topMin??w.top:w.top,$=i.min?w.bottomMin??w.bottom:w.bottom,H={...i,d:s},L="",b="";switch(s.browser){case"safari-ios":L=Tr(H,F),b=Ar(H,$);break;case"chrome-android":L=Cr(H,i.host),b=Hr();break;case"safari-ipad":L=Br(H),b='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":L=Nr(H,s.shell==="macbook"),b=Rr();break;case"chrome-windows":L=Pr(H),b=Or(H);break}return{footprint:{w:x,h:k},screen:{x:N,y:d.top,w:s.w,h:s.h,r:d.r,rb:d.rb??d.r},topH:F,bottomH:$,shell:Lr(s,d,x,k,N),top:L,bottom:b,canMinimize:w.topMin!==void 0&&(w.topMin!==w.top||w.bottomMin!==w.bottom),scrollbar:s.browser==="chrome-windows"?"classic":"overlay"}}var Oe=null;function cn(s){if(Oe??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!Oe||!s)return[0,0,0,0];Oe.clearRect(0,0,1,1),Oe.fillStyle="rgba(0, 0, 0, 0)",Oe.fillStyle=s,Oe.fillRect(0,0,1,1);let[i,d,m,p]=Oe.getImageData(0,0,1,1).data;return[i,d,m,p/255]}var dn=([s,i,d])=>`rgb(${s}, ${i}, ${d})`;function Da(s){let i=s.defaultView,d=b=>!b||cn(b)[3]===0,m=[s.body,s.documentElement].map(b=>b&&i.getComputedStyle(b).backgroundColor).find(b=>b&&!d(b)),[p,x,k,N]=m?cn(m):[255,255,255,1],w=[p,x,k].map(b=>Math.round(b*N+255*(1-N))),F=b=>{let[T,_,X,W]=cn(b);if(W>=.75)return dn([T,_,X]);let ct=(q,Q)=>Math.round(q*W+Q*(1-W));return dn([ct(T,w[0]),ct(_,w[1]),ct(X,w[2])])},$=b=>{let T=s.elementFromPoint(i.innerWidth/2,b);for(;T&&T!==s.documentElement;T=T.parentElement){let _=i.getComputedStyle(T);if(_.position!=="fixed"&&_.position!=="sticky")continue;let X=T.getBoundingClientRect().width>=i.innerWidth*.9,W=_.backdropFilter&&_.backdropFilter!=="none";return X&&!W&&!d(_.backgroundColor)?F(_.backgroundColor):null}return null},H=s.querySelector('meta[name="theme-color"]')?.content||"",L=H&&!d(H)?dn(cn(H)):"";return{top:$(4)??dn(w),bottom:$(i.innerHeight-4)??dn(w),theme:L}}function Ps(s){let[i,d,m]=cn(s).map(p=>p/255).map(p=>p<=.04045?p/12.92:((p+.055)/1.055)**2.4);return .2126*i+.7152*d+.0722*m>.4?"#000":"#fff"}function qa(s){let{cfg:i,inFrame:d,persist:m,frame:p,frameEl:x,devicesMenu:k,bpBtns:N,notesOverlay:w,WIDE:F,bpOf:$,currentBp:H,deviceById:L,notesOn:b,filter:T,filterTo:_,dropFrameDrafts:X,putAway:W,tellFrame:ct,syncBpButtons:q,render:Q,reread:it}=s,ht=i.breakpoints,nt=document.querySelector(".dt-device"),Yt=document.querySelector(".dt-shell"),yt=document.querySelector('.dt-chrome[data-at="top"]'),Mt=document.querySelector('.dt-chrome[data-at="bottom"]'),mt=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],at=document.querySelector(".dt-frame-size"),gt=document.querySelector(".dt-frame-rotate"),Pt=document.querySelector(".dt-frame-bars"),f="overlay",c="",y="dt-w",C="dt-canvas",B="dt-device",J=et.getItem(C)==="1",I=et.getItem(B)||"";I&&!L(I)&&(I="",et.setItem(B,""));let R=Number(et.getItem(y))||0,j="dt-emu",V=(()=>{try{return JSON.parse(et.getItem(j)||"null")}catch{return null}})(),bt=()=>V?sn.find(v=>v.id===V.id)??null:null,ft=()=>{let v=bt();return v?V.turned?{w:v.h,h:v.w}:{w:v.w,h:v.h}:null},Ot=et.getItem("dt-bars-min")==="1",Nt=v=>{V=v,m(j,v?JSON.stringify(v):"")},It=v=>{at.textContent=v,p.style.setProperty("--dt-badge-w",`${at.offsetWidth}px`)},Lt=v=>{if(!v){mt.innerHTML="";return}let A="";for(let O=0;O<=v;O+=50)A+=`<span class="dt-tick${O%200===0?" is-major":""}" style="left:${O}px"></span>`;for(let O of ht)for(let ot of[O.min,O.max])ot>0&&Number.isFinite(ot)&&ot<=v&&(A+=`<span class="dt-edge" style="left:${ot}px" title="${O.label} edge"></span>`);mt.innerHTML=A,mt.style.width=`${v}px`},Ue=()=>{let v=parseFloat(nt.style.width)||0,A=parseFloat(nt.style.height)||0;if(!v||!A){nt.style.transform="",delete nt.dataset.scaled;return}let O=I||V?Math.min(1,(innerWidth-80)/v,(innerHeight-120)/A):Math.min(1,(innerWidth-80)/v);nt.style.transform=O<1?`scale(${O})`:"",nt.dataset.scaled=O<1?String(Math.round(O*100)):""},De=v=>sn.find(A=>A.w===v.w&&A.h===v.h&&A.cutout?.shape==="pill")?.cutout,ue=()=>{try{return x.contentDocument}catch{return null}},U=()=>ue()?.title.split("\u2014").pop()?.trim()||"",fe=()=>{let v=ue(),A=I?L(I):null;if(!v?.body||!A)return;let O=Da(v),ot=A.browser==="chrome-android"?O.theme||"rgb(255, 255, 255)":O.top,dt=A.browser==="chrome-android"?"rgb(255, 255, 255)":O.bottom;nt.style.setProperty("--dt-top",ot),nt.style.setProperty("--dt-top-ink",Ps(ot)),nt.style.setProperty("--dt-bottom",dt),nt.style.setProperty("--dt-bottom-ink",Ps(dt));let xt=yt.querySelector(".dt-win-tab > span");xt&&(xt.textContent=U()||location.host)},ve=0;x.addEventListener("load",()=>{let v=ue();if(!v)return;let A=window.__notemendHosted;if(A&&!x.contentWindow?.__notemendHosted&&!v.querySelector(`script[src^="${A.base}/bar.js"]`)){let O=v.createElement("script");O.src=`${A.base}/bar.js`,O.dataset.project=A.project,v.head.append(O)}fe(),x.contentWindow?.addEventListener("scroll",()=>{ve||(ve=requestAnimationFrame(()=>{ve=0,fe()}))},{passive:!0})});for(let v of[yt,Mt])v.addEventListener("click",A=>{let O=A.target.closest("[data-nav]")?.dataset.nav;if(O)try{let ot=x.contentWindow?.navigation;if(!ue()||!ot)throw new Error("foreign");O==="back"?ot.canGoBack&&ot.back():O==="fwd"?ot.canGoForward&&ot.forward():ot.reload()}catch{(O==="reload"||O==="back")&&(x.src=location.href)}});Pt.addEventListener("click",()=>{Ot=!Ot,m("dt-bars-min",Ot?"1":"0"),Dt()});let Dt=()=>{if(d)return;let v=I?L(I)??null:null;if(I&&!v&&(I="",et.setItem(B,"")),!v&&!J){p.hidden=!0,x.removeAttribute("src"),Ht.toggle("dt-framing",!1),w.hidden=!b(),mt.innerHTML="",q(),gt.hidden=!0,Pt.hidden=!0,_(null),c="",X(),q(),wt(),it();return}if(p.hidden=!1,Ht.toggle("dt-framing",!0),w.hidden=!0,x.src||(x.src=location.href),v){let A=Ia(v,{host:location.host,title:U(),now:new Date,min:Ot,cutout:De(v)}),{screen:O}=A;p.dataset.mode="device",nt.dataset.shell=v.shell,nt.dataset.browser=v.browser,nt.style.width=`${A.footprint.w}px`,nt.style.height=`${A.footprint.h}px`,nt.style.setProperty("--dt-r",`${O.r}px`),nt.style.setProperty("--dt-rb",`${O.rb}px`),Yt.innerHTML=A.shell;let ot=(Xt,Rt,Tt,Qt)=>{Xt.innerHTML=Qt,Xt.style.cssText=`left:${O.x}px;top:${Rt}px;width:${O.w}px;height:${Tt}px`};ot(yt,O.y,A.topH,A.top),ot(Mt,O.y+O.h-A.bottomH,A.bottomH,A.bottom);let dt=O.h-A.topH-A.bottomH;x.style.position="absolute",x.style.left=`${O.x}px`,x.style.top=`${O.y+A.topH}px`,x.style.width=`${O.w}px`,x.style.height=`${dt}px`,mt.innerHTML="";let xt=Ot&&A.canMinimize;f=A.scrollbar,c=`${v.label}${xt?" \xB7 bars folded":""}`,_($(v.w)),ct({notes:b(),scrollbar:f,device:c}),Pt.hidden=!A.canMinimize,Pt.setAttribute("aria-pressed",String(xt)),It(`${v.label} \xB7 page ${v.w}\xD7${dt} of ${v.w}\xD7${v.h}${xt?" \xB7 bars folded":""} \xB7 ${ht.find(Xt=>Xt.id===T())?.label??""}`),fe()}else{let A=ft();A||Nt(null);let O=A?.w||R||ht.find(xt=>xt.id===H()).ideal;R=O,p.dataset.mode="canvas",delete nt.dataset.shell,delete nt.dataset.browser,Yt.innerHTML=yt.innerHTML=Mt.innerHTML="",yt.style.cssText=Mt.style.cssText="",Pt.hidden=!0,f="overlay",nt.style.width=`${O}px`,nt.style.height=`${A?.h??innerHeight-84}px`,x.style.position="",x.style.left=x.style.top="",x.style.width="100%",x.style.height="100%",Lt(O),ct({notes:b()});let ot=ht.find(xt=>xt.id===$(O)),dt=bt();c=dt?`${dt.label}${V?.turned?" \xB7 landscape":""}`:"",ct({scrollbar:f,device:c}),It(dt&&A?`${dt.label} \xB7 ${A.w}\xD7${A.h} \xB7 ${ot.label}`:`${O}px \xB7 ${ot.label}`),_($(O))}gt.hidden=!(bt()?.rotates&&!v),wt(),Ue(),q(),it()},Y=v=>{let A=ht.find(O=>O.id===v);I="",et.setItem(B,""),Nt(null),J=v!==F,R=J?A.ideal:0,_(J?v:null),et.setItem(C,J?"1":"0"),et.setItem(y,String(R)),W(),Dt()};for(let v of N)v.addEventListener("click",()=>Y(v.dataset.bp));for(let v of document.querySelectorAll("[data-device]"))v.addEventListener("click",()=>{I=v.dataset.device===I?"":v.dataset.device,et.setItem(B,I),k.open=!1,Dt()});for(let v of document.querySelectorAll("[data-emu]"))v.addEventListener("click",()=>{let A=V?.id===v.dataset.emu&&!I;I="",et.setItem(B,""),Nt(A?null:{id:v.dataset.emu,turned:!1}),J=!A,R=0,et.setItem(C,J?"1":"0"),_(null),W(),k.open=!1,Dt()});gt.addEventListener("click",()=>{V&&(Nt({...V,turned:!V.turned}),W(),Dt())});let kt=[...k.querySelectorAll("[data-tab]")],st=[...k.querySelectorAll("[data-panel]")],M=v=>{for(let A of kt)A.setAttribute("aria-selected",String(A.dataset.tab===v));for(let A of st)A.hidden=A.dataset.panel!==v;m("dt-devices-tab",v)};for(let v of kt)v.addEventListener("click",()=>M(v.dataset.tab));M(et.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let ye=k.querySelector(".dt-emu-search");ye.addEventListener("input",()=>{let v=ye.value.trim().toLowerCase(),A=null,O=!1,ot=()=>{A&&(A.hidden=!O)};for(let dt of ye.parentElement.children){if(dt.classList.contains("dt-devices-group")){ot(),A=dt,O=!1;continue}dt.dataset.emu&&(dt.hidden=!!v&&!dt.textContent.toLowerCase().includes(v),O||=!dt.hidden)}ot()});let qt=k.querySelector(".dt-devices-name");function wt(){for(let A of k.querySelectorAll("[data-device]"))A.setAttribute("aria-pressed",String(A.dataset.device===I));let v=!I&&!p.hidden?V?.id:void 0;for(let A of k.querySelectorAll("[data-emu]"))A.setAttribute("aria-pressed",String(A.dataset.emu===v));qt.textContent=I&&L(I)?.label||v&&bt()?.label||"Device"}let lt=v=>ht.find(A=>A.id===v),St=v=>{let A=lt(T()??H());return Math.max(A.min||320,Math.min(Number.isFinite(A.max)?A.max:2560,Math.round(v)))};for(let v of E){let A=v.dataset.edge==="l"?-1:1;v.addEventListener("pointerdown",O=>{if(I)return;O.preventDefault(),V&&(Nt(null),Dt()),v.setPointerCapture(O.pointerId);let ot=O.clientX,dt=R,xt=Number(nt.dataset.scaled||100)/100;p.dataset.dragging="1";let Xt=Tt=>{R=St(dt+A*(Tt.clientX-ot)*2/xt),nt.style.width=`${R}px`,Lt(R),It(`${R}px \xB7 ${lt($(R)).label}`),Ue()},Rt=()=>{v.removeEventListener("pointermove",Xt),v.removeEventListener("pointerup",Rt),v.removeEventListener("pointercancel",Rt),delete p.dataset.dragging,et.setItem(y,String(R)),Dt()};v.addEventListener("pointermove",Xt),v.addEventListener("pointerup",Rt),v.addEventListener("pointercancel",Rt)}),v.addEventListener("dblclick",()=>{if(I)return;Nt(null);let O=lt(T()??H()),ot=[O.min||320,Number.isFinite(O.max)?O.max:O.ideal];R=Math.abs(R-ot[0])<Math.abs(R-ot[1])?ot[0]:ot[1],et.setItem(y,String(R)),Dt()})}let we=H();return addEventListener("resize",()=>{q(),H()!==we&&(we=H(),Q()),p.hidden||(!I&&!V&&(nt.style.height=`${innerHeight-84}px`),Ue())}),{apply:Dt,pickBp:Y,look:()=>({scrollbar:f,device:c}),restore:()=>{J||I?Dt():wt()}}}var Fa='<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>',ja='<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>',Ir='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function _a(s){let{bp:i,notes:d,breakpoints:m,bandOfNote:p,whoseAgent:x,statusTools:k,showResolved:N,showArchived:w,drafts:F,find:$}=s,H=d.filter(E=>p(E)===i),L=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(at=>!at.deleted).map(at=>at.text)].join(" ").toLowerCase(),b=E=>$.view==="me"?s.forMe(E):$.view==="agent"?s.forAgent(E):!0,T=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,_=H.filter(E=>b(E)&&(!$.q||L(E).includes($.q.trim().toLowerCase()))).sort((E,at)=>($.sort==="unread"?Number(s.unread(at))-Number(s.unread(E)):0)||T(at)-T(E)),X={open:[],claude:[],done:[],archived:[]};for(let E of _)X[pt(E)==="done"&&s.archived(E)?"archived":pt(E)].push(E);let W=E=>{let at=(E.replies??[]).filter(B=>!B.deleted),gt=at.length+(E.note?1:0),Pt=Re(E.category),f=pt(E),c=f==="claude",y=s.orphan(E),C=at.length?at[at.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text};return`<div class="dt-hist-row is-${f}${f==="done"?s.archived(E)?" is-archived":" is-resolved":""}${y?" is-orphan":""}">
151
151
  <button class="dt-hist-go" data-go="${E.id}">
152
152
  ${s.marker(E)}
153
153
  <span class="dt-hist-body">
154
- <span class="dt-hist-id">#${E.id>0?E.id:"\u2026"}<em>${Bt.label}</em>${c?`<b class="dt-hist-claude" data-unmark="${E.id}" role="button" tabindex="0" title="Resolved by ${h(x(E.doneAgent,E.doneFor))} \u2014 click to clear: back to open">${Vt(9)}${h(ze(E.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${y?'<b class="dt-hist-orphan" title="The element is not on this page any more">gone</b>':s.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>':""}</span>
154
+ <span class="dt-hist-id">#${E.id>0?E.id:"\u2026"}<em>${Pt.label}</em>${c?`<b class="dt-hist-claude" data-unmark="${E.id}" role="button" tabindex="0" title="Resolved by ${h(x(E.doneAgent,E.doneFor))} \u2014 click to clear: back to open">${Gt(9)}${h(Ve(E.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${y?'<b class="dt-hist-orphan" title="The element is not on this page any more">gone</b>':s.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>':""}</span>
155
155
  <span class="dt-hist-text">${C.author==="claude"?`<b>${h(x(C.agent,C.by))}:</b> `:""}${h(C.text)}</span>
156
- <span class="dt-hist-meta">${on(E.updatedAt||E.createdAt)}${E.device?` \xB7 ${h(E.device)}`:E.browser?` \xB7 ${h(E.browser)}`:""}${mt?` \xB7 ${mt} repl${mt===1?"y":"ies"}`:""}</span>
156
+ <span class="dt-hist-meta">${rn(E.updatedAt||E.createdAt)}${E.device?` \xB7 ${h(E.device)}`:E.browser?` \xB7 ${h(E.browser)}`:""}${gt?` \xB7 ${gt} repl${gt===1?"y":"ies"}`:""}</span>
157
157
  </span>
158
158
  </button>
159
159
  <span class="dt-note-tools dt-hist-tools">${s.assign(E)}${k(E)}<i class="dt-note-sep"></i
160
- ><button data-rm="${E.id}" title="Delete this comment">${Ae}</button></span>
161
- </div>`},dt=m.find(E=>E.id===i),q=m.map(E=>{let at=d.filter(mt=>p(mt)===E.id&&ut(mt)!=="done");return{band:E,open:at.filter(mt=>ut(mt)==="open").length,total:at.length}}).filter(E=>E.total&&E.band.id!==i),Q=q.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${q.map(({band:E,open:at,total:mt})=>`<button data-bp="${E.id}" data-state="${at?"open":"claude"}"
162
- title="${E.label}: ${at} open \xB7 ${mt-at} to check"
163
- ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${mt}</i></button>`).join("")}</div>`:"",it=["open","claude","done","archived"],pt={...ma,archived:"Archived"},nt=it.filter(E=>X[E].length&&(E==="done"?N:E==="archived"?w:!0)),Kt=E=>`<div class="dt-hist-row is-draft">
160
+ ><button data-rm="${E.id}" title="Delete this comment">${Be}</button></span>
161
+ </div>`},ct=m.find(E=>E.id===i),q=m.map(E=>{let at=d.filter(gt=>p(gt)===E.id&&pt(gt)!=="done");return{band:E,open:at.filter(gt=>pt(gt)==="open").length,total:at.length}}).filter(E=>E.total&&E.band.id!==i),Q=q.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${q.map(({band:E,open:at,total:gt})=>`<button data-bp="${E.id}" data-state="${at?"open":"claude"}"
162
+ title="${E.label}: ${at} open \xB7 ${gt-at} to check"
163
+ ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${gt}</i></button>`).join("")}</div>`:"",it=["open","claude","done","archived"],ht={...Ta,archived:"Archived"},nt=it.filter(E=>X[E].length&&(E==="done"?N:E==="archived"?w:!0)),Yt=E=>`<div class="dt-hist-row is-draft">
164
164
  <button class="dt-hist-go" data-draft-go="${E.i}">
165
- <span class="dt-hist-n">${an}</span>
165
+ <span class="dt-hist-n">${ln}</span>
166
166
  <span class="dt-hist-body">
167
167
  <span class="dt-hist-id">${h(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>
168
168
  <span class="dt-hist-text">${E.text?h(E.text):`${E.shots} screenshot${E.shots===1?"":"s"}`}</span>
169
169
  </span>
170
170
  </button>
171
- <span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${Ae}</button></span>
172
- </div>`,yt=H.filter(E=>ut(E)!=="done"),Et=(E,at,mt,Bt,f)=>`<button type="button" role="menuitemradio" aria-checked="${Bt}" ${E}="${at}"><i>${Bt?qt:""}</i><span>${mt}</span>${f==null?"":`<em>${f}</em>`}</button>`,ht=()=>`<div class="dt-hist-find">
173
- <label class="dt-hist-search">${Sa}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${h($.q)}" spellcheck="false">${$.q?`<button type="button" data-hist-clear aria-label="Clear search">${ge}</button>`:""}</label>
174
- <button type="button" class="dt-hist-filter${$.view!=="all"||$.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${$.menu}" data-tip="Filter">${Er}</button>
175
- ${$.menu?`<div class="dt-hist-menu" role="menu">${Et("data-hist-view","me","For me",$.view==="me",yt.filter(s.forMe).length)}${Et("data-hist-view","agent","Agent",$.view==="agent",yt.filter(s.forAgent).length)}${Et("data-hist-view","all","All",$.view==="all",yt.length)}<hr>${Et("data-hist-sort","new","Newest",$.sort==="new")}${Et("data-hist-sort","unread","Unread first",$.sort==="unread")}</div>`:""}
171
+ <span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${Be}</button></span>
172
+ </div>`,yt=H.filter(E=>pt(E)!=="done"),Mt=(E,at,gt,Pt,f)=>`<button type="button" role="menuitemradio" aria-checked="${Pt}" ${E}="${at}"><i>${Pt?Wt:""}</i><span>${gt}</span>${f==null?"":`<em>${f}</em>`}</button>`,mt=()=>`<div class="dt-hist-find">
173
+ <label class="dt-hist-search">${Fa}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${h($.q)}" spellcheck="false">${$.q?`<button type="button" data-hist-clear aria-label="Clear search">${be}</button>`:""}</label>
174
+ <button type="button" class="dt-hist-filter${$.view!=="all"||$.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${$.menu}" data-tip="Filter">${Ir}</button>
175
+ ${$.menu?`<div class="dt-hist-menu" role="menu">${Mt("data-hist-view","me","For me",$.view==="me",yt.filter(s.forMe).length)}${Mt("data-hist-view","agent","Agent",$.view==="agent",yt.filter(s.forAgent).length)}${Mt("data-hist-view","all","All",$.view==="all",yt.length)}<hr>${Mt("data-hist-sort","new","Newest",$.sort==="new")}${Mt("data-hist-sort","unread","Unread first",$.sort==="unread")}</div>`:""}
176
176
  </div>`;return`<div class="dt-hist-head">
177
- <span class="dt-hist-here" title="${dt?.label??i}"
178
- ><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${dt?.icon??""}</svg></span>
177
+ <span class="dt-hist-here" title="${ct?.label??i}"
178
+ ><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${ct?.icon??""}</svg></span>
179
179
  <span class="dt-hist-title">Comments</span>
180
180
  ${Q}
181
- ${s.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${s.checks} ${s.checks===1?"fix":"fixes"}" data-tip="${s.checks} ${s.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${qt}${s.checks}</button>`:""}
181
+ ${s.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${s.checks} ${s.checks===1?"fix":"fixes"}" data-tip="${s.checks} ${s.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${Wt}${s.checks}</button>`:""}
182
182
  <button class="dt-hist-refresh" data-refresh aria-label="Reload comments from the file">
183
183
  <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>
184
184
  </button>
185
185
  <button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
186
186
  <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>
187
187
  </button>
188
- </div>`+ht()+(nt.length||F.length?`<div class="dt-hist-list">${F.length?`<p class="dt-hist-group">Drafts<em>${F.length}</em></p>${F.map(Kt).join("")}`:""}${nt.map(E=>`<p class="dt-hist-group">${pt[E]}<em>${X[E].length}</em>${E==="done"?`<button type="button" class="dt-hist-archive-all" data-archive-all="${X.done.map(at=>at.id).join(",")}" data-tip="Archive every resolved thread here">${La}Archive all</button>`:""}</p>`+X[E].map(W).join("")).join("")}</div>`:$.q.trim()?`<div class="dt-hist-empty">${Sa}<p>No comments match \xAB${h($.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:$.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">${X.done.length||X.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">
188
+ </div>`+mt()+(nt.length||F.length?`<div class="dt-hist-list">${F.length?`<p class="dt-hist-group">Drafts<em>${F.length}</em></p>${F.map(Yt).join("")}`:""}${nt.map(E=>`<p class="dt-hist-group">${ht[E]}<em>${X[E].length}</em>${E==="done"?`<button type="button" class="dt-hist-archive-all" data-archive-all="${X.done.map(at=>at.id).join(",")}" data-tip="Archive every resolved thread here">${ja}Archive all</button>`:""}</p>`+X[E].map(W).join("")).join("")}</div>`:$.q.trim()?`<div class="dt-hist-empty">${Fa}<p>No comments match \xAB${h($.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:$.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">${X.done.length||X.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">
189
189
  <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${N}"
190
190
  ><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
191
191
  ><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
192
192
  <button class="dt-hist-resolved" data-archived role="switch" aria-checked="${w}"
193
- >${La}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
194
- </div>`}function Aa(s){let{inFrame:i,everything:d,route:m,open:p,settle:x,keepIn:k,toast:N,waits:w,approve:F}=s,$=q=>{let Q=d().find(it=>it.id===q);return!!Q&&w(Q)},H="nm-review",S=()=>{try{return JSON.parse(sessionStorage.getItem(H)||"null")}catch{return null}},g=q=>{try{q?sessionStorage.setItem(H,JSON.stringify(q)):sessionStorage.removeItem(H)}catch{}},T=document.createElement("div");T.className="dt-review",T.setAttribute("role","region"),T.setAttribute("aria-label","Checking fixes"),T.hidden=!0,k(T),i||document.body.append(T);let _=()=>d().filter(w),X=()=>{let q=_().sort((Q,it)=>+(it.route===m())-+(Q.route===m())||String(Q.route).localeCompare(String(it.route))||Q.id-it.id).map(Q=>Q.id);q.length&&(g({ids:q,i:0}),W())},W=()=>{let q=S();if(!q||i){T.hidden=!0;return}for(;q.i<q.ids.length&&!$(q.ids[q.i]);)q.i++;if(q.i>=q.ids.length){g(null),T.hidden=!0,N("Every fix is checked.");return}g(q);let Q=d().find(pt=>pt.id===q.ids[q.i]);if(Q.route&&Q.route!==m()){location.assign(Q.route+location.search);return}p(Q);let it=q.ids.slice(0,q.i).some($);T.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
195
- <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${it?"":" disabled"}>${ca}</button>
193
+ >${ja}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
194
+ </div>`}function Wa(s){let{inFrame:i,everything:d,route:m,open:p,settle:x,keepIn:k,toast:N,waits:w,approve:F}=s,$=q=>{let Q=d().find(it=>it.id===q);return!!Q&&w(Q)},H="nm-review",L=()=>{try{return JSON.parse(sessionStorage.getItem(H)||"null")}catch{return null}},b=q=>{try{q?sessionStorage.setItem(H,JSON.stringify(q)):sessionStorage.removeItem(H)}catch{}},T=document.createElement("div");T.className="dt-review",T.setAttribute("role","region"),T.setAttribute("aria-label","Checking fixes"),T.hidden=!0,k(T),i||document.body.append(T);let _=()=>d().filter(w),X=()=>{let q=_().sort((Q,it)=>+(it.route===m())-+(Q.route===m())||String(Q.route).localeCompare(String(it.route))||Q.id-it.id).map(Q=>Q.id);q.length&&(b({ids:q,i:0}),W())},W=()=>{let q=L();if(!q||i){T.hidden=!0;return}for(;q.i<q.ids.length&&!$(q.ids[q.i]);)q.i++;if(q.i>=q.ids.length){b(null),T.hidden=!0,N("Every fix is checked.");return}b(q);let Q=d().find(ht=>ht.id===q.ids[q.i]);if(Q.route&&Q.route!==m()){location.assign(Q.route+location.search);return}p(Q);let it=q.ids.slice(0,q.i).some($);T.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
195
+ <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${it?"":" disabled"}>${Ma}</button>
196
196
  <span class="dt-review-n">${q.i+1} of ${q.ids.length}</span>
197
- <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${ua}</button></span>
198
- <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>
199
- <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${Ce}</button>
200
- <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${ge}</button>`,T.hidden=!1};T.addEventListener("click",async q=>{let Q=q.target.closest("[data-r]"),it=S();if(!Q||!it)return;if(Q.dataset.r==="stop"){g(null),T.hidden=!0;return}if(Q.dataset.r==="prev"){dt();return}let pt=it.ids[it.i];g({...it,i:it.i+1});let nt=d().find(yt=>yt.id===pt),Kt=Q.dataset.r==="ok"&&nt?F(nt):Q.dataset.r==="no"?x(pt,!1):null;W(),await Kt});let dt=()=>{let q=S();if(q){for(let Q=q.i-1;Q>=0;Q--)if($(q.ids[Q])){g({...q,i:Q}),W();return}}};return document.addEventListener("keydown",q=>{T.hidden||q.metaKey||q.ctrlKey||q.altKey||q.key!=="ArrowLeft"&&q.key!=="ArrowRight"||q.target.closest?.("input, textarea, select, [contenteditable]")||(q.preventDefault(),q.key==="ArrowLeft"?dt():T.querySelector('[data-r="skip"]')?.click())}),{start:X,toCheck:_,resume:()=>{S()&&W()}}}function Ca(s,i){let d=null,m=null,p=document.querySelector(".dt-turbo"),x="/notemend:turbo",k=()=>{let N=!!d&&Date.now()-Date.parse(d.at)<18e4,w=N?m?.paused?"paused":"on":"none",F=N?ze(d.agent):"",$=w==="none"?`Turbo is off. Run ${x} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:w==="on"?`Turbo on: ${F} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${F} is listening but waits \u2014 click to resume`;p.dataset.state=w,p.dataset.tip=$,p.setAttribute("aria-label",$),p.setAttribute("aria-checked",String(w==="on")),s&&(p.hidden=!0)};return setInterval(k,3e4),p.addEventListener("click",async()=>{let N=p.dataset.state;if(N==="none"){await navigator.clipboard?.writeText(x).catch(()=>{}),i(`Copied ${x} \u2014 paste it in Claude Code`);return}let w=N==="on"?"off":"on";m={paused:w==="off"},k();try{let F=await Dt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:w})});if(!F.ok)throw new Error(String(F.status));i(w==="off"?"Turbo paused":"Turbo on")}catch{m={paused:w==="on"},k(),i("Could not switch turbo \u2014 try again")}}),N=>{d=N.listening??null,m=N.turbo??null,k()}}function Ha(s,i){let d=s.breakpoints,m=s.categories,p=(d.find(t=>!Number.isFinite(t.max))??d[0]).id,x=t=>d.find(e=>t>=e.min&&t<=e.max)?.id??p,k=t=>t.breakpoint||p,N=t=>s.devices.find(e=>e.id===t),w=Cn,F=(t,e)=>{w||et.setItem(t,e)},$=t=>Dt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),H=t=>t.replace(/\/+$/,"")||"/",S=H(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 g=document.querySelector(".dt-grid-btn"),T=document.querySelector(".dt-grid-overlay"),_="dt-grid",X=t=>{T.hidden=!t,g.setAttribute("aria-pressed",String(t)),F(_,t?"1":"0"),_t({grid:t})};g.addEventListener("click",()=>X(T.hidden===!0));let W=document.querySelector(".dt-pages-name"),dt=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))H(new URL(r.href).pathname)===S?(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,W.title=a.length>3?o:""};dt();let q=[...document.querySelectorAll(".devtools details")],Q=!1,it=()=>{let t=q.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]=it();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{Q=q.some(e=>e.open&&!e.contains(t.target))&&it().length>0},!0),addEventListener("blur",it);let pt=document.querySelector(".dt-pad-overlay"),nt="dt-inspect",Kt=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...s.ignore].join(", "),yt=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-review",".dt-field-menu",".dt-toast",'[aria-modal="true"]',...s.ignore].join(", "),Et={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")},ht="",E=0,{spacer:at,drawPads:mt,drawSize:Bt,drawType:f,drawColor:c,drawBorder:y}=ya(pt),C=t=>{E||(E=requestAnimationFrame(()=>{E=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Kt)){pt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),ht==="sizes"?Bt(e):ht==="type"?f(e):ht==="color"?c(e):ht==="border"?y(e):mt(t.altKey?e:at(e))}))},B=t=>{ht=t;for(let[e,n]of Object.entries(Et))n.setAttribute("aria-pressed",String(e===t));F(nt,t),_t({inspect:t}),pt.hidden=!t,pt.innerHTML="",t?document.addEventListener("mousemove",C):document.removeEventListener("mousemove",C)};for(let[t,e]of Object.entries(Et))e.addEventListener("click",()=>{t!==ht&&ue(!1),B(ht===t?"":t)});let J=document.querySelector(".dt-notes-btn"),I=[...document.querySelectorAll(".dt-bp")],R=document.querySelector(".dt-history-btn"),j=document.querySelector(".dt-history"),V=document.querySelector(".dt-studio-btn"),gt=document.querySelector(".dt-devices"),bt=document.querySelector(".dt-notes-hi"),Nt=bt.querySelector(".dt-hi-box"),Ct=bt.querySelector(".dt-hi-tag"),Rt=document.querySelector(".dt-frame"),kt=document.createElement("div");kt.className="dt-spot",kt.hidden=!0,kt.setAttribute("aria-hidden","true"),document.body.append(kt);let Ve=t=>{if(!t||!Mt){kt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;kt.style.setProperty("--spot-x",`${e.left-n}px`),kt.style.setProperty("--spot-y",`${e.top-n}px`),kt.style.setProperty("--spot-w",`${e.width+n*2}px`),kt.style.setProperty("--spot-h",`${e.height+n*2}px`),kt.hidden&&(bt.hidden=!0),kt.hidden=!1},Pe=Rt.querySelector("iframe"),ce=document.querySelector(".dt-notes-count"),Y=document.querySelector(".dt-notes-overlay"),be=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame",fe=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(be).forEach(fe);let Pt="dt-notes",G=[],Mt=!1,st=null,M=null,ve=0,It="",vt=[],rt=null,St=[],ye=(t=M)=>!!(t&&(t.text?.trim()||t.images?.length)),v=()=>{M&&ye()&&St.push(M),M=null},A=null,P=null,ot=()=>`dt-draft:${S}${w?":canvas":""}`,lt=ot(),wt=0,Ut=()=>{if(!M&&!St.length&&!It){et.removeItem(lt);return}let t={draft:M,parked:St,reply:It?{for:A,text:It}:null};try{localStorage.setItem(lt,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(lt,JSON.stringify({...t,draft:M&&e(M),parked:St.map(e)}))}catch{}}},Ht=()=>{clearTimeout(wt),wt=setTimeout(Ut,200)};addEventListener("pagehide",()=>{clearTimeout(wt),Ut()});let Lt=et.getItem("dt-resolved")!=="0",Zt=et.getItem("dt-archived")==="1",Qt=t=>da(t,s.autoArchive),Ra=t=>ut(t)!=="done"||(Qt(t)?Zt:Lt),Ot={q:"",menu:!1,view:["me","agent"].includes(et.getItem("dt-view")??"")?et.getItem("dt-view"):"all",sort:et.getItem("dt-sort")==="unread"?"unread":"new"},Pa=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Ia=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Oa=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),n=e(Pa),o=e(Ia),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},On=()=>x(innerWidth),we=()=>P??On(),As=()=>{let t=we();for(let e of I)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Da,poolOf:qa,contextOf:Fa,resolveEl:ja,anchorOf:_a}=wa(),Dn=new WeakMap,Cs=()=>{Dn=new WeakMap},ie=t=>{let e=Dn.get(t);return(e===void 0||e&&!e.isConnected)&&(e=ja(t),Dn.set(t,e)),e},dn=new Map,jt=t=>{dn.size||requestAnimationFrame(()=>dn.clear());let e=dn.get(t);return e===void 0&&(e=_a(t,ie(t)),dn.set(t,e)),e},Hs=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},cn=[],qn=t=>{for(let e of cn)e.play();cn=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),cn.push(n))},Fn=()=>{if(M)return ie(M);let t=st!=null?G.find(n=>n.id===st):null;if(!t)return null;let e=jt(t);return e&&!e.off&&!e.hidden?ie(t):null},un="claude",Wa=()=>(s.team??[]).filter(t=>t.email!==s.me?.email),$e=()=>[...s.me?(s.team??[]).filter(t=>t.email===s.me.email):[],...Wa()],Bs='<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>',Ns=(t,e,n=!1)=>{let o=xt(t)?"agent":t?"person":"nobody",a=Ge(o==="person"?t:jn()),r=[["person",a?pn(a.avatar_url,a.name||a.email):bn,o==="person"?`${Ue(t)==="you"?"You":Ue(t)} \u2014 pick someone else`:a?`Give it to ${a.email===s.me?.email?"me":a.name||a.email}`:"A person"],["nobody",Bs,"Anyone \u2014 nobody has taken it yet"],["agent",Vt(12),n?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],l=e!=null?G.find(L=>L.id===e):void 0,b=o==="agent"&&l?zn[Jt(l)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${b?` style="--step-c:${b}"`:""}>${r.filter(([L])=>L!=="person"||o==="person"||$e().length).map(([L,O,u])=>L===o?`<span class="dt-hand-stop dt-hand-stop--${L} is-on" role="radio" aria-checked="true" data-tip="${h(u)}" aria-label="${h(u)}">${L==="person"?Ya(t,e):O}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${L}" role="radio" aria-checked="false" data-act="hand" data-v="${L}"${e?` data-id="${e}"`:""} data-tip="${h(u)}" aria-label="${h(u)}"${L==="agent"&&n?" disabled":""}>${O}</button>`).join("")}</span>`},jn=()=>{let t=Ka();return t&&!xt(t)&&$e().some(e=>e.email===t)?t:$e()[0]?.email??""},za=()=>{let t=Y.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},Rs="cubic-bezier(0.32, 0.72, 0, 1)",Ps=t=>{let e=Y.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let n=e.getBoundingClientRect(),o=document.createElement("span");o.className="dt-hand dt-hand-ghost",o.style.cssText=`left:${t.rect.left}px;top:${t.rect.top}px;width:${t.rect.width}px;height:${t.rect.height}px`,t.ghost.querySelectorAll("select").forEach(a=>a.tabIndex=-1),o.append(t.ghost),Y.append(o),o.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>o.remove(),()=>o.remove()),ss=performance.now()+480,e.animate([{transform:`translateX(${t.rect.left-n.left}px)`,width:`${t.rect.width}px`},{transform:"none",width:`${n.width}px`}],{duration:460,easing:Rs});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:Rs});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"})},Va=(t,e)=>{let n=ss>performance.now()?void 0:za(),o=e==="agent"?un:e==="person"?jn():e==="me"?s.me?.email??"":"";if(!t){if(!M)return;M.assignee=o,M.stage=xt(o)?"approved":!M.stage||M.stage==="approved"?"new":M.stage,e==="person"&&et.setItem("nm-for",o),Wn(o),Ht(),U(),Ps(n);return}_n(t,o),Ps(n)},_n=(t,e)=>{let n=G.find(r=>r.id===t);if(n&&sn(n)&&!xt(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=n?zt(n):"new",a=xt(e)?"approved":o==="approved"?"new":o;Gt(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>$({id:t,assignee:e||null,stage:a}),xt(e)?"Approving it for the agent":"Reassigning")},Ka=()=>et.getItem("nm-for")??"",Wn=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===un||$e().some(n=>n.email===e))?e:null}catch{return null}},Ke=t=>xt(t)?"#d97757":t?"#0d99ff":"#717171",Ue=t=>t===s.me?.email?"you":s.team?.find(e=>e.email===t)?.name||t.split("@")[0],Ge=t=>t?s.team?.find(e=>e.email===t):void 0,Is=t=>{let e=Ft(t??"").split(/\s+/).filter(Boolean);return h(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},pn=(t,e,n="dt-face")=>t?`<img class="${n}" src="${h(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Is(e)}</b>`,Os=t=>{let e=Ge(t.by);return e||t.byName?pn(e?.avatar_url,e?.name||t.byName||t.by):""},Ds=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,zn={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Ie=(()=>{try{return JSON.parse(et.getItem("dt-seen")||"{}")}catch{return{}}})(),qs=()=>F("dt-seen",JSON.stringify(Ie)),Fs=t=>{let e=Te(t);if(!(t.id in Ie))return Ie[t.id]=e.length,qs(),!1;let n=e[e.length-1];return e.length>Ie[t.id]&&!(n?.author==="you"&&(!n.by||n.by===s.me?.email))},Ua=t=>{let e=Te(t).length;Ie[t.id]!==e&&(Ie[t.id]=e,qs())},Vn=t=>{let e=Ge(t);return e?` data-face="${h(e.avatar_url??"")}" data-initial="${Is(e.name||e.email)}"`:""},js=t=>s.client||Ee()||ut(t)==="done"?"":`<span class="dt-hist-hand">${Ns(t.assignee??"",t.id)}</span>`,xe=(t,e)=>ze(t),_s=t=>{let e=Ge(t);return e?pn(e.avatar_url,e.name||e.email):""},Ga=t=>{let e=Ge(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${h(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${Vt(12)}</b>`},Ya=(t,e)=>{let n=(a,r)=>`<option value="${h(a)}" data-c="${Ke(a)}"${Vn(a||null)}${t===a?" selected":""}>${h(r)}</option>`,o=(s.team??[]).filter(a=>a.email!==s.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${Ke(t)}">${_s(t||null)||bn}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
197
+ <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${ka}</button></span>
198
+ <button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${Wt}</button>
199
+ <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${Ne}</button>
200
+ <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${be}</button>`,T.hidden=!1};T.addEventListener("click",async q=>{let Q=q.target.closest("[data-r]"),it=L();if(!Q||!it)return;if(Q.dataset.r==="stop"){b(null),T.hidden=!0;return}if(Q.dataset.r==="prev"){ct();return}let ht=it.ids[it.i];b({...it,i:it.i+1});let nt=d().find(yt=>yt.id===ht),Yt=Q.dataset.r==="ok"&&nt?F(nt):Q.dataset.r==="no"?x(ht,!1):null;W(),await Yt});let ct=()=>{let q=L();if(q){for(let Q=q.i-1;Q>=0;Q--)if($(q.ids[Q])){b({...q,i:Q}),W();return}}};return document.addEventListener("keydown",q=>{T.hidden||q.metaKey||q.ctrlKey||q.altKey||q.key!=="ArrowLeft"&&q.key!=="ArrowRight"||q.target.closest?.("input, textarea, select, [contenteditable]")||(q.preventDefault(),q.key==="ArrowLeft"?ct():T.querySelector('[data-r="skip"]')?.click())}),{start:X,toCheck:_,resume:()=>{L()&&W()}}}function za(s,i){let d=null,m=null,p=document.querySelector(".dt-turbo"),x="/notemend:turbo",k=()=>{let N=!!d&&Date.now()-Date.parse(d.at)<18e4,w=N?m?.paused?"paused":"on":"none",F=N?Ve(d.agent):"",$=w==="none"?`Turbo is off. Run ${x} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:w==="on"?`Turbo on: ${F} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${F} is listening but waits \u2014 click to resume`;p.dataset.state=w,p.dataset.tip=$,p.setAttribute("aria-label",$),p.setAttribute("aria-checked",String(w==="on")),s&&(p.hidden=!0)};return setInterval(k,3e4),p.addEventListener("click",async()=>{let N=p.dataset.state;if(N==="none"){await navigator.clipboard?.writeText(x).catch(()=>{}),i(`Copied ${x} \u2014 paste it in Claude Code`);return}let w=N==="on"?"off":"on";m={paused:w==="off"},k();try{let F=await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:w})});if(!F.ok)throw new Error(String(F.status));i(w==="off"?"Turbo paused":"Turbo on")}catch{m={paused:w==="on"},k(),i("Could not switch turbo \u2014 try again")}}),N=>{d=N.listening??null,m=N.turbo??null,k()}}function Va(s,i){let d=s.breakpoints,m=s.categories,p=(d.find(t=>!Number.isFinite(t.max))??d[0]).id,x=t=>d.find(e=>t>=e.min&&t<=e.max)?.id??p,k=t=>t.breakpoint||p,N=t=>s.devices.find(e=>e.id===t),w=Nn,F=(t,e)=>{w||et.setItem(t,e)},$=t=>Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),H=t=>t.replace(/\/+$/,"")||"/",L=H(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 b=document.querySelector(".dt-grid-btn"),T=document.querySelector(".dt-grid-overlay"),_="dt-grid",X=t=>{T.hidden=!t,b.setAttribute("aria-pressed",String(t)),F(_,t?"1":"0"),Kt({grid:t})};b.addEventListener("click",()=>X(T.hidden===!0));let W=document.querySelector(".dt-pages-name"),ct=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))H(new URL(r.href).pathname)===L?(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,W.title=a.length>3?o:""};ct();let q=[...document.querySelectorAll(".devtools details")],Q=!1,it=()=>{let t=q.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]=it();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{Q=q.some(e=>e.open&&!e.contains(t.target))&&it().length>0},!0),addEventListener("blur",it);let ht=document.querySelector(".dt-pad-overlay"),nt="dt-inspect",Yt=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...s.ignore].join(", "),yt=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...s.ignore].join(", "),Mt={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")},mt="",E=0,{spacer:at,drawPads:gt,drawSize:Pt,drawType:f,drawColor:c,drawBorder:y}=Na(ht),C=t=>{E||(E=requestAnimationFrame(()=>{E=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Yt)){ht.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),mt==="sizes"?Pt(e):mt==="type"?f(e):mt==="color"?c(e):mt==="border"?y(e):gt(t.altKey?e:at(e))}))},B=t=>{mt=t;for(let[e,n]of Object.entries(Mt))n.setAttribute("aria-pressed",String(e===t));F(nt,t),Kt({inspect:t}),ht.hidden=!t,ht.innerHTML="",t?document.addEventListener("mousemove",C):document.removeEventListener("mousemove",C)};for(let[t,e]of Object.entries(Mt))e.addEventListener("click",()=>{t!==mt&&pe(!1),B(mt===t?"":t)});let J=document.querySelector(".dt-notes-btn"),I=[...document.querySelectorAll(".dt-bp")],R=document.querySelector(".dt-history-btn"),j=document.querySelector(".dt-history"),V=document.querySelector(".dt-studio-btn"),bt=document.querySelector(".dt-devices"),ft=document.querySelector(".dt-notes-hi"),Ot=ft.querySelector(".dt-hi-box"),Nt=ft.querySelector(".dt-hi-tag"),It=document.querySelector(".dt-frame"),Lt=document.createElement("div");Lt.className="dt-spot",Lt.hidden=!0,Lt.setAttribute("aria-hidden","true"),document.body.append(Lt);let Ue=t=>{if(!t||!kt){Lt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;Lt.style.setProperty("--spot-x",`${e.left-n}px`),Lt.style.setProperty("--spot-y",`${e.top-n}px`),Lt.style.setProperty("--spot-w",`${e.width+n*2}px`),Lt.style.setProperty("--spot-h",`${e.height+n*2}px`),Lt.hidden&&(ft.hidden=!0),Lt.hidden=!1},De=It.querySelector("iframe"),ue=document.querySelector(".dt-notes-count"),U=document.querySelector(".dt-notes-overlay"),fe=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame",ve=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(fe).forEach(ve);let Dt="dt-notes",Y=[],kt=!1,st=null,M=null,ye=0,qt="",wt=[],lt=null,St=[],we=(t=M)=>!!(t&&(t.text?.trim()||t.images?.length)),v=()=>{M&&we()&&St.push(M),M=null},A=null,O=null,ot=()=>`dt-draft:${L}${w?":canvas":""}`,dt=ot(),xt=0,Xt=()=>{if(!M&&!St.length&&!qt){et.removeItem(dt);return}let t={draft:M,parked:St,reply:qt?{for:A,text:qt}:null};try{localStorage.setItem(dt,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(dt,JSON.stringify({...t,draft:M&&e(M),parked:St.map(e)}))}catch{}}},Rt=()=>{clearTimeout(xt),xt=setTimeout(Xt,200)};addEventListener("pagehide",()=>{clearTimeout(xt),Xt()});let Tt=et.getItem("dt-resolved")!=="0",Qt=et.getItem("dt-archived")==="1",te=t=>Ea(t,s.autoArchive),Ga=t=>pt(t)!=="done"||(te(t)?Qt:Tt),Ft={q:"",menu:!1,view:["me","agent"].includes(et.getItem("dt-view")??"")?et.getItem("dt-view"):"all",sort:et.getItem("dt-sort")==="unread"?"unread":"new"},Ya=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Xa=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Ja=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),n=e(Ya),o=e(Xa),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},qn=()=>x(innerWidth),$e=()=>O??qn(),Os=()=>{let t=$e();for(let e of I)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Is,poolOf:Ds,contextOf:qs,resolveEl:Za,anchorOf:Qa}=Ra(),Fn=new WeakMap,Fs=()=>{Fn=new WeakMap},ee=t=>{let e=Fn.get(t);return(e===void 0||e&&!e.isConnected)&&(e=Za(t),Fn.set(t,e)),e},un=new Map,zt=t=>{un.size||requestAnimationFrame(()=>un.clear());let e=un.get(t);return e===void 0&&(e=Qa(t,ee(t)),un.set(t,e)),e},js=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},pn=[],jn=t=>{for(let e of pn)e.play();pn=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),pn.push(n))},_n=()=>{if(M)return ee(M);let t=st!=null?Y.find(n=>n.id===st):null;if(!t)return null;let e=zt(t);return e&&!e.off&&!e.hidden?ee(t):null},Wn="claude",ti=()=>(s.team??[]).filter(t=>t.email!==s.me?.email),xe=()=>[...s.me?(s.team??[]).filter(t=>t.email===s.me.email):[],...ti()],_s='<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>',Ws=(t,e,n=!1)=>{let o=$t(t)?"agent":t?"person":"nobody",a=Xe(o==="person"?t:zn()),r=[["person",a?hn(a.avatar_url,a.name||a.email):fn,o==="person"?`${Ye(t)==="you"?"You":Ye(t)} \u2014 pick someone else`:a?`Give it to ${a.email===s.me?.email?"me":a.name||a.email}`:"A person"],["nobody",_s,"Anyone \u2014 nobody has taken it yet"],["agent",Gt(12),n?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],l=e!=null?Y.find(S=>S.id===e):void 0,g=o==="agent"&&l?Un[Zt(l)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${g?` style="--step-c:${g}"`:""}>${r.filter(([S])=>S!=="person"||o==="person"||xe().length).map(([S,P,u])=>S===o?`<span class="dt-hand-stop dt-hand-stop--${S} is-on" role="radio" aria-checked="true" data-tip="${h(u)}" aria-label="${h(u)}">${S==="person"?ii(t,e):P}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${S}" role="radio" aria-checked="false" data-act="hand" data-v="${S}"${e?` data-id="${e}"`:""} data-tip="${h(u)}" aria-label="${h(u)}"${S==="agent"&&n?" disabled":""}>${P}</button>`).join("")}</span>`},zn=()=>{let t=si();return t&&!$t(t)&&xe().some(e=>e.email===t)?t:xe()[0]?.email??""},ei=()=>{let t=U.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},zs="cubic-bezier(0.32, 0.72, 0, 1)",Vs=t=>{let e=U.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let n=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),U.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()),as=performance.now()+480,e.animate([{transform:`translateX(${t.rect.left-n.left}px)`,width:`${t.rect.width}px`},{transform:"none",width:`${n.width}px`}],{duration:460,easing:zs});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:zs});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"})},ni=(t,e)=>{let n=as>performance.now()?void 0:ei(),o=e==="agent"?Wn:e==="person"?zn():e==="me"?s.me?.email??"":"";if(!t){if(!M)return;M.assignee=o,M.stage=$t(o)?"approved":!M.stage||M.stage==="approved"?"new":M.stage,e==="person"&&et.setItem("nm-for",o),Kn(o),Rt(),G(),Vs(n);return}Vn(t,o),Vs(n)},Vn=(t,e)=>{let n=Y.find(r=>r.id===t);if(n&&Ke(n)&&!$t(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=n?_t(n):"new",a=$t(e)?"approved":o==="approved"?"new":o;Vt(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>$({id:t,assignee:e||null,stage:a}),$t(e)?"Approving it for the agent":"Reassigning")},si=()=>et.getItem("nm-for")??"",Kn=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===Wn||xe().some(n=>n.email===e))?e:null}catch{return null}},Ge=t=>$t(t)?"#d97757":t?"#0d99ff":"#717171",Ye=t=>t===s.me?.email?"you":s.team?.find(e=>e.email===t)?.name||t.split("@")[0],Xe=t=>t?s.team?.find(e=>e.email===t):void 0,Ks=t=>{let e=Bt(t??"").split(/\s+/).filter(Boolean);return h(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},hn=(t,e,n="dt-face")=>t?`<img class="${n}" src="${h(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Ks(e)}</b>`,Us=t=>{let e=Xe(t.by);return e||t.byName?hn(e?.avatar_url,e?.name||t.byName||t.by):""},Gs=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,Un={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},qe=(()=>{try{return JSON.parse(et.getItem("dt-seen")||"{}")}catch{return{}}})(),Ys=()=>F("dt-seen",JSON.stringify(qe)),Xs=t=>{let e=He(t);if(!(t.id in qe))return qe[t.id]=e.length,Ys(),!1;let n=e[e.length-1];return e.length>qe[t.id]&&!(n?.author==="you"&&(!n.by||n.by===s.me?.email))},oi=t=>{let e=He(t).length;qe[t.id]!==e&&(qe[t.id]=e,Ys())},Gn=t=>{let e=Xe(t);return e?` data-face="${h(e.avatar_url??"")}" data-initial="${Ks(e.name||e.email)}"`:""},Js=t=>s.client||Me()||pt(t)==="done"?"":`<span class="dt-hist-hand">${Ws(t.assignee??"",t.id)}</span>`,Ee=(t,e)=>Ve(t),Zs=t=>{let e=Xe(t);return e?hn(e.avatar_url,e.name||e.email):""},ai=t=>{let e=Xe(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${h(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${Gt(12)}</b>`},ii=(t,e)=>{let n=(a,r)=>`<option value="${h(a)}" data-c="${Ge(a)}"${Gn(a||null)}${t===a?" selected":""}>${h(r)}</option>`,o=(s.team??[]).filter(a=>a.email!==s.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${Ge(t)}">${Zs(t||null)||fn}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
201
201
  ${s.me?n(s.me.email,`Me \xB7 ${s.me.name||s.me.email}`):""}
202
- ${o.map(a=>n(a.email,a.name||a.email)).join("")}${t&&t!==s.me?.email&&!o.some(a=>a.email===t)?n(t,Ue(t)):""}
203
- </select></span></label>`},Xa=t=>`<div class="dt-suggest dt-suggest--read"><del>${h(t.from)}</del><ins>${h(t.to)}</ins></div>`,Ws=(t,e)=>{let n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return h([n,Ft(e??"")&&`\u201C${Ft(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},zs='<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>',Ja=(t,e)=>{let n=He(t);return`<label class="dt-field dt-field--bare" data-tip="Type: ${h(n.label)}"><span class="dt-field-box">${ks(n)}<span class="dt-field-label">${h(n.label)}</span>${zs}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${m.map(o=>`<option value="${o.id}" data-c="${o.color}" data-icon="${h(ks(o))}"${o.id===t?" selected":""}>${o.label}</option>`).join("")}</select></span></label>`},Kn=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","Needs review","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875],["accepted","Accepted","#30a46c",.95]],Vs=(t,e)=>{let o=2*Math.PI*e,a=8+3.3*Math.sin(o),r=8-3.3*Math.cos(o),l=`<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"/>${l}</svg>`},hn=t=>zt(t)==="accepted"?"accepted":sn(t)||zt(t)==="progress"?"progress":zt(t)==="review"?"review":zt(t)==="waiting"?"waiting":"new",mn={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"accepted"},Ks=[...Kn,["done","Resolved","#30a46c",1]],Za=t=>{let e=Jt(t),n=t.status==="done"&&e!=="review"?"done":e&&mn[e]?mn[e]:hn(t),[,,o,a]=Ks.find(r=>r[0]===n);return`<label class="dt-field" data-tip="${e&&mn[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Vs(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${Ks.map(([r,l,b,L])=>`<option value="${r}" data-c="${b}" data-icon="${h(Vs(b,L))}"${r===n?" selected":""}>${l}</option>`).join("")}${`<option value="${Qt(t)?"unarchive":"archive"}" data-sep data-icon="${h(Yn)}">${Qt(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Us=(t,e)=>{let n=G.find(r=>r.id===t);if(!n)return;if(e==="done"){Me(t,!0);return}if(e==="archive"||e==="unarchive"){ke(t,e==="archive");return}let o=e==="new"?xt(n.assignee)?"approved":"new":e,a=n.status==="done"?{status:"open",doneBy:null}:{};Gt(r=>r.map(l=>l.id===t?{...l,...a,stage:o}:l),()=>$({id:t,...a,stage:o}),"Setting the status")},gn=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],Qa=(t,e)=>{let n=Math.max(0,gn.findIndex(b=>b[0]===t)),[,o,a,r]=gn[n],l=gn[(n+1)%gn.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${l[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${l[1]}" aria-label="Priority ${o}">${$a(r,a)}<span>${o}</span></button>`},Ee=()=>!!s.me&&/@guest\.notemend\.com$/i.test(s.me.email),Gs=(t,e,n,o,a=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${s.client?"":Qa(t,n)}${Ja(He(e).id,n)}</span>${s.client||Ee()?"":Ns(o,n,a)}</div>`,ti='<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>',ei=t=>{let e=Ft(t?.innerText?.split(`
204
- `).find(n=>Ft(n))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},bn='<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>',ni='<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>',si='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/><path d="M3.5 3.5l13 13"/></svg>',oi='<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>',Ys=(t,e)=>`<label class="dt-more" data-tip="More"><span aria-hidden="true">${oi}</span><select class="dt-more-select"${e?` data-id="${e}"`:""} aria-label="More">
202
+ ${o.map(a=>n(a.email,a.name||a.email)).join("")}${t&&t!==s.me?.email&&!o.some(a=>a.email===t)?n(t,Ye(t)):""}
203
+ </select></span></label>`},ri=t=>`<div class="dt-suggest dt-suggest--read"><del>${h(t.from)}</del><ins>${h(t.to)}</ins></div>`,Qs=(t,e)=>{let n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return h([n,Bt(e??"")&&`\u201C${Bt(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},to='<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>',li=(t,e)=>{let n=Re(t);return`<label class="dt-field dt-field--bare" data-tip="Type: ${h(n.label)}"><span class="dt-field-box">${Bs(n)}<span class="dt-field-label">${h(n.label)}</span>${to}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${m.map(o=>`<option value="${o.id}" data-c="${o.color}" data-icon="${h(Bs(o))}"${o.id===t?" selected":""}>${o.label}</option>`).join("")}</select></span></label>`},Yn=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","Needs review","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875],["accepted","Accepted","#30a46c",.95]],eo=(t,e)=>{let o=2*Math.PI*e,a=8+3.3*Math.sin(o),r=8-3.3*Math.cos(o),l=`<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"/>${l}</svg>`},mn=t=>_t(t)==="accepted"?"accepted":Ke(t)||_t(t)==="progress"?"progress":_t(t)==="review"?"review":_t(t)==="waiting"?"waiting":"new",gn={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"accepted"},no=[...Yn,["done","Resolved","#30a46c",1]],di=t=>{let e=Zt(t),n=t.status==="done"&&e!=="review"?"done":e&&gn[e]?gn[e]:mn(t),[,,o,a]=no.find(r=>r[0]===n);return`<label class="dt-field" data-tip="${e&&gn[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${eo(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${no.map(([r,l,g,S])=>`<option value="${r}" data-c="${g}" data-icon="${h(eo(g,S))}"${r===n?" selected":""}>${l}</option>`).join("")}${`<option value="${te(t)?"unarchive":"archive"}" data-sep data-icon="${h(Zn)}">${te(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},so=(t,e)=>{let n=Y.find(r=>r.id===t);if(!n)return;if(e==="done"){ke(t,!0);return}if(e==="archive"||e==="unarchive"){Le(t,e==="archive");return}let o=e==="new"?$t(n.assignee)?"approved":"new":e,a=n.status==="done"?{status:"open",doneBy:null}:{};Vt(r=>r.map(l=>l.id===t?{...l,...a,stage:o}:l),()=>$({id:t,...a,stage:o}),"Setting the status")},bn=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],ci=(t,e)=>{let n=Math.max(0,bn.findIndex(g=>g[0]===t)),[,o,a,r]=bn[n],l=bn[(n+1)%bn.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${l[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${l[1]}" aria-label="Priority ${o}">${Pa(r,a)}<span>${o}</span></button>`},Me=()=>!!s.me&&/@guest\.notemend\.com$/i.test(s.me.email),oo=(t,e,n,o,a=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${s.client?"":ci(t,n)}${li(Re(e).id,n)}</span>${s.client||Me()?"":Ws(o,n,a)}</div>`,ui='<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>',pi=t=>{let e=Bt(t?.innerText?.split(`
204
+ `).find(n=>Bt(n))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},fn='<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>',hi='<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>',mi='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/><path d="M3.5 3.5l13 13"/></svg>',gi='<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>',ao=(t,e)=>`<label class="dt-more" data-tip="More"><span aria-hidden="true">${gi}</span><select class="dt-more-select"${e?` data-id="${e}"`:""} aria-label="More">
205
205
  <option value="" hidden selected></option>
206
- ${s.client?"":`<option value="team" data-icon="${h(si)}"${t?"":" data-on"}>Team only</option>
207
- <option value="client" data-icon="${h(bn)}"${t?" data-on":""}>Team and client</option>`}
208
- <option value="${e?"rm":"discard"}" data-icon="${h(Ae)}" data-danger${s.client?"":" data-sep"}>${e?"Delete thread":"Discard draft"}</option>
209
- </select></label>`,Xs='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z"/><circle cx="10" cy="10" r="2.3"/></svg>',Js=()=>(s.team??[]).filter(t=>!s.studio||s.studio.includes(t.email)),Zs=t=>{let e=t||s.lead||"",n=Js();return!n.length||n.some(o=>o.email===e)?e:n[0].email},ai=t=>{let e=Zs(t),n=Js();if(!n.length)return"";let o=_s(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Ke(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
210
- ${n.map(a=>`<option value="${h(a.email)}" data-c="${Ke(a.email)}"${Vn(a.email)}${e===a.email?" selected":""}>${h(a.name||a.email)}</option>`).join("")}
211
- </select></span></label>`},fn='<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>',Qs='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ii='<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>',ri=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,li=(t,e)=>{let n=t.closest(".dt-voice"),o=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let b=n.querySelector(".dt-voice-track i"),L=n.querySelector(".dt-voice-time"),O=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{b.style.transform=`scaleX(${O()?Math.min(1,o.currentTime/O()):0})`,L.textContent=ri(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ii,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=Qs,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let b=n.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}Y.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():l(),{once:!0}):r();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},Un=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),to=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Ye=new Map,di=t=>{if(!t.startsWith("data:"))return t;let e=Ye.get(t);if(!e){let[n,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),Ye.set(t,e),Ye.size>8){let[a,r]=Ye.entries().next().value;URL.revokeObjectURL(r),Ye.delete(a)}}return e},ci=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${Qs}</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="${di(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">${$i}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${fn}</button>`}</span>`,eo=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,ui=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`},no=t=>{let e=oa(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},pi=(t,e,n)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${no(e)}<span class="dt-file-text"><b>${h(eo(e))}</b>${o?"":`<small>${ui(t)}</small>`}</span>`;return`<span class="dt-file" title="${h(e)}">${o?`<a class="dt-file-open" href="${h($s(e)?t:a)}"${$s(e)?' target="_blank" rel="noreferrer"':` download="${h(e)}"`}>${r}</a><a class="dt-file-get" href="${h(a)}" download="${h(e)}" aria-label="Download ${h(e)}" data-tip="Download">${mi}</a>`:`<span class="dt-file-open">${r}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${fn}</button>`}</span>`},hi=(t,e)=>{let[,n,o]=t.split("\0");return`<span class="dt-file is-refused" title="${h(n)}"><span class="dt-file-open">${no(n)}<span class="dt-file-text"><b>${h(eo(n))}</b><small>${h(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${fn}</button></span>`},so=(t,e,n=t)=>t.startsWith(vn)?hi(t,e??""):nn(n)?pi(t,nn(n),e):Un(n)?ci(t,e):`<span class="dt-shot${to(n)?" dt-shot--video":""}">${to(n)?`<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">${fn}</button>`}</span>`,Gn=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let o=n.split("/").pop(),a=ea(o);return so(a,e===void 0?void 0:`data-id="${e}" data-img="${h(o)}"`,o)}).join("")}</div>`:"",oo=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>so(e,`data-i="${n}"`)).join("")}</div>`:"",Yn='<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>',mi='<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>',gi='<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>',vn="refused:\0",Mr='<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>',bi='<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>',fi='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',vi=90,Xn=32,yi=()=>!!s.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",yn=!1,wi=async(t,e)=>{if(yn||!t)return;let n=Number(t.dataset.id)||0;yn=!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(ct){yn=!1,e.classList.remove("is-asking");let Tt=ct?.name;qe(Tt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Tt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Tt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${ct?.message||Tt||"unknown error"}`);return}e.classList.remove("is-asking");let a=()=>Y.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),r=document.createElement("div");r.className="dt-rec",r.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Ae}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Xn)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${fi}</button>`;let l=r.querySelector("b"),b=[...r.querySelectorAll(".dt-rec-wave i")],L=new AudioContext,O=L.createAnalyser();O.fftSize=512,L.createMediaStreamSource(o).connect(O);let u=new Uint8Array(O.fftSize),Z=[],D=new MediaRecorder(o,{audioBitsPerSecond:32e3}),K=[],$t=Date.now(),oe=!0,ae=setInterval(()=>{let ct=a();ct&&r.parentElement!==ct&&ct.appendChild(r),O.getByteTimeDomainData(u);let Tt=0;for(let me of u)Tt+=((me-128)/128)**2;Z.push(Math.min(1,Math.sqrt(Tt/u.length)*4));let he=Z.slice(-Xn);b.forEach((me,We)=>{let Le=he[We-(Xn-he.length)];me.style.transform=`scaleY(${Math.max(.1,Le??0).toFixed(2)})`,me.classList.toggle("is-empty",Le===void 0)});let tt=Math.floor((Date.now()-$t)/1e3);l.textContent=`${Math.floor(tt/60)}:${String(tt%60).padStart(2,"0")}`,tt>=vi&&D.state!=="inactive"&&D.stop()},90),_e=ct=>{oe=ct,D.state!=="inactive"&&D.stop()};r.querySelector(".dt-rec-x").addEventListener("click",ct=>{ct.stopPropagation(),_e(!1)}),r.querySelector(".dt-rec-done").addEventListener("click",ct=>{ct.stopPropagation(),_e(!0)}),r.addEventListener("keydown",ct=>{ct.key==="Escape"&&(ct.stopPropagation(),_e(!1))}),D.ondataavailable=ct=>{ct.data.size&&K.push(ct.data)},D.onstop=async()=>{if(clearInterval(ae),o.getTracks().forEach(he=>he.stop()),L.close().catch(()=>{}),r.remove(),yn=!1,!oe)return;let ct=new Blob(K,{type:D.mimeType||"audio/webm"}),Tt=await new Promise(he=>{let tt=new FileReader;tt.onload=()=>he(String(tt.result)),tt.readAsDataURL(ct)});n?vt.push(Tt):M&&(M.images??=[]).push(Tt),U(),a()?.querySelector("textarea")?.focus()},D.start(1e3),a()?.appendChild(r),r.querySelector(".dt-rec-done").focus()},ao="\u{1F3A4} Voice note",$i='<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>',xi=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?M?.images??[]:vt)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await Dt("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){qe(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 l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${r.text}`:r.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},re=new Map,io=async(t,e,n)=>{let o=`${t}:${e}`;if(!n&&re.has(o)){re.delete(o),U();return}let a=G.find(L=>L.id===t),r=a&&Te(a).find(L=>(L.at??"0")===e);if(!r?.text)return;re.set(o,null),U();let l=await Dt("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:n||navigator.language||"en"})}).catch(()=>null),b=l?await l.json().catch(()=>({})):{};re.has(o)&&(l?.ok&&b.text?re.set(o,b.text):(re.delete(o),qe(b.error||"Could not translate it \u2014 try again.")),U())},Ei=["uk","ru","en"],Mi=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},ki=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${zs}</span><select class="dt-lang-select" data-id="${t}" data-at="${h(e)}" aria-label="Translate into"><option value="" selected hidden></option>${Ei.map(n=>`<option value="${h(n)}">${h(Mi(n))}</option>`).join("")}</select></label>`,Si='<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>',Li='<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>',ro=(t,e,n,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
206
+ ${s.client?"":`<option value="team" data-icon="${h(mi)}"${t?"":" data-on"}>Team only</option>
207
+ <option value="client" data-icon="${h(fn)}"${t?" data-on":""}>Team and client</option>`}
208
+ <option value="${e?"rm":"discard"}" data-icon="${h(Be)}" data-danger${s.client?"":" data-sep"}>${e?"Delete thread":"Discard draft"}</option>
209
+ </select></label>`,io='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z"/><circle cx="10" cy="10" r="2.3"/></svg>',ro=()=>(s.team??[]).filter(t=>!s.studio||s.studio.includes(t.email)),lo=t=>{let e=t||s.lead||"",n=ro();return!n.length||n.some(o=>o.email===e)?e:n[0].email},bi=t=>{let e=lo(t),n=ro();if(!n.length)return"";let o=Zs(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Ge(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
210
+ ${n.map(a=>`<option value="${h(a.email)}" data-c="${Ge(a.email)}"${Gn(a.email)}${e===a.email?" selected":""}>${h(a.name||a.email)}</option>`).join("")}
211
+ </select></span></label>`},vn='<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>',co='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',fi='<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>',vi=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,yi=(t,e)=>{let n=t.closest(".dt-voice"),o=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let g=n.querySelector(".dt-voice-track i"),S=n.querySelector(".dt-voice-time"),P=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{g.style.transform=`scaleX(${P()?Math.min(1,o.currentTime/P()):0})`,S.textContent=vi(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=fi,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=co,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let g=n.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-g.left)/g.width))*o.duration);return}if(!o.paused){o.pause();return}U.querySelectorAll(".dt-voice audio").forEach(g=>{g!==o&&g.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():l(),{once:!0}):r();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},Xn=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),uo=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Je=new Map,wi=t=>{if(!t.startsWith("data:"))return t;let e=Je.get(t);if(!e){let[n,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),Je.set(t,e),Je.size>8){let[a,r]=Je.entries().next().value;URL.revokeObjectURL(r),Je.delete(a)}}return e},$i=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${co}</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="${wi(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">${Bi}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${vn}</button>`}</span>`,po=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,xi=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`},ho=t=>{let e=va(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},Ei=(t,e,n)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${ho(e)}<span class="dt-file-text"><b>${h(po(e))}</b>${o?"":`<small>${xi(t)}</small>`}</span>`;return`<span class="dt-file" title="${h(e)}">${o?`<a class="dt-file-open" href="${h(Ss(e)?t:a)}"${Ss(e)?' target="_blank" rel="noreferrer"':` download="${h(e)}"`}>${r}</a><a class="dt-file-get" href="${h(a)}" download="${h(e)}" aria-label="Download ${h(e)}" data-tip="Download">${ki}</a>`:`<span class="dt-file-open">${r}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${vn}</button>`}</span>`},Mi=(t,e)=>{let[,n,o]=t.split("\0");return`<span class="dt-file is-refused" title="${h(n)}"><span class="dt-file-open">${ho(n)}<span class="dt-file-text"><b>${h(po(n))}</b><small>${h(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${vn}</button></span>`},mo=(t,e,n=t)=>t.startsWith(yn)?Mi(t,e??""):an(n)?Ei(t,an(n),e):Xn(n)?$i(t,e):`<span class="dt-shot${uo(n)?" dt-shot--video":""}">${uo(n)?`<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">${vn}</button>`}</span>`,Jn=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let o=n.split("/").pop(),a=ga(o);return mo(a,e===void 0?void 0:`data-id="${e}" data-img="${h(o)}"`,o)}).join("")}</div>`:"",go=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>mo(e,`data-i="${n}"`)).join("")}</div>`:"",Zn='<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>',ki='<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>',Li='<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>',yn="refused:\0",Dr='<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>',Si='<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>',Ti='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Ai=90,Qn=32,Ci=()=>!!s.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",wn=!1,Hi=async(t,e)=>{if(wn||!t)return;let n=Number(t.dataset.id)||0;wn=!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(ut){wn=!1,e.classList.remove("is-asking");let At=ut?.name;Ae(At==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":At==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":At==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${ut?.message||At||"unknown error"}`);return}e.classList.remove("is-asking");let a=()=>U.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),r=document.createElement("div");r.className="dt-rec",r.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Be}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Qn)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Ti}</button>`;let l=r.querySelector("b"),g=[...r.querySelectorAll(".dt-rec-wave i")],S=new AudioContext,P=S.createAnalyser();P.fftSize=512,S.createMediaStreamSource(o).connect(P);let u=new Uint8Array(P.fftSize),Z=[],D=new MediaRecorder(o,{audioBitsPerSecond:32e3}),K=[],Et=Date.now(),re=!0,le=setInterval(()=>{let ut=a();ut&&r.parentElement!==ut&&ut.appendChild(r),P.getByteTimeDomainData(u);let At=0;for(let ge of u)At+=((ge-128)/128)**2;Z.push(Math.min(1,Math.sqrt(At/u.length)*4));let me=Z.slice(-Qn);g.forEach((ge,ze)=>{let Ce=me[ze-(Qn-me.length)];ge.style.transform=`scaleY(${Math.max(.1,Ce??0).toFixed(2)})`,ge.classList.toggle("is-empty",Ce===void 0)});let tt=Math.floor((Date.now()-Et)/1e3);l.textContent=`${Math.floor(tt/60)}:${String(tt%60).padStart(2,"0")}`,tt>=Ai&&D.state!=="inactive"&&D.stop()},90),We=ut=>{re=ut,D.state!=="inactive"&&D.stop()};r.querySelector(".dt-rec-x").addEventListener("click",ut=>{ut.stopPropagation(),We(!1)}),r.querySelector(".dt-rec-done").addEventListener("click",ut=>{ut.stopPropagation(),We(!0)}),r.addEventListener("keydown",ut=>{ut.key==="Escape"&&(ut.stopPropagation(),We(!1))}),D.ondataavailable=ut=>{ut.data.size&&K.push(ut.data)},D.onstop=async()=>{if(clearInterval(le),o.getTracks().forEach(me=>me.stop()),S.close().catch(()=>{}),r.remove(),wn=!1,!re)return;let ut=new Blob(K,{type:D.mimeType||"audio/webm"}),At=await new Promise(me=>{let tt=new FileReader;tt.onload=()=>me(String(tt.result)),tt.readAsDataURL(ut)});n?wt.push(At):M&&(M.images??=[]).push(At),G(),a()?.querySelector("textarea")?.focus()},D.start(1e3),a()?.appendChild(r),r.querySelector(".dt-rec-done").focus()},bo="\u{1F3A4} Voice note",Bi='<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>',Ni=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?M?.images??[]:wt)[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){Ae(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 l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${r.text}`:r.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},de=new Map,fo=async(t,e,n)=>{let o=`${t}:${e}`;if(!n&&de.has(o)){de.delete(o),G();return}let a=Y.find(S=>S.id===t),r=a&&He(a).find(S=>(S.at??"0")===e);if(!r?.text)return;de.set(o,null),G();let l=await Ct("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:n||navigator.language||"en"})}).catch(()=>null),g=l?await l.json().catch(()=>({})):{};de.has(o)&&(l?.ok&&g.text?de.set(o,g.text):(de.delete(o),Ae(g.error||"Could not translate it \u2014 try again.")),G())},Ri=["uk","ru","en"],Pi=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Oi=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${to}</span><select class="dt-lang-select" data-id="${t}" data-at="${h(e)}" aria-label="Translate into"><option value="" selected hidden></option>${Ri.map(n=>`<option value="${h(n)}">${h(Pi(n))}</option>`).join("")}</select></label>`,Ii='<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>',Di='<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>',vo=(t,e,n,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
212
212
  <textarea class="${t}" rows="1" placeholder="${e}">${h(n)}</textarea>
213
213
  ${a}
214
214
  <div class="dt-compose-bar">
215
- <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Li}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 3 MB">${gi}</button>
216
- ${yi()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${bi}</button>`:""}</span>
215
+ <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Di}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 3 MB">${Li}</button>
216
+ ${Ci()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Si}</button>`:""}</span>
217
217
  <button class="dt-send${n.trim()?" is-ready":""}" ${o} title="Send (Enter)"
218
218
  ><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>
219
219
  </div>
220
- </div></div>`,Jn=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),lo=()=>St.map((t,e)=>({i:e,el:Jn(t.tag,t.classes),text:Ft(t.text??""),shots:t.images?.length??0,orphan:!jt(t)})),Zn=[],co="",te=t=>{let e=t.working;return xe(e?.agent,e?.by??xs(t.assignee))},uo=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`},wn=(t,e)=>{let n=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${te(t)} \u2014 it takes it on its next run`,asks:`${te(t)} is waiting for your answer`,working:`${te(t)} is on it \xB7 ${uo(n?.at)}`,stuck:`${te(t)} went quiet \u2014 its next run takes it again`,review:`Resolved by ${xe(t.doneAgent,t.doneFor)} \u2014 click to clear`,done:"Resolved"}[e]},Ti=t=>{let e=Jt(t);if(!e)return s.client||Ee()||t.status==="done"?"":`<button class="dt-note-state dt-step--none" data-act="hand" data-v="agent" data-id="${t.id}" data-tip="Hand to Claude" aria-label="Hand to Claude">${Ms(13,0)}</button>`;let n=Ms(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${h(wn(t,e))}" aria-label="${h(wn(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${h(wn(t,e))}" role="img" aria-label="${h(wn(t,e))}">${n}</span>`},po=(t,e=!0)=>{let n=ut(t),o=n==="done",a=Qt(t);return`${e?Ti(t):""}<button data-act="${o?"reopen":"done"}" data-id="${t.id}"
221
- class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${qt}</button><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"}">${Yn}</button>`},Ai=t=>t?new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}):"",Ci=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Qt(t)){let L=t.confirmedBy?t.confirmedBy===s.me?.email?"you":Ue(t.confirmedBy):"";return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${h(L?`Resolved by ${L} \u2014 check it`:"Resolved \u2014 check it")}</b></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">${Ce}</button><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">${Yn}</button></div>`}if(s.client)return"";let e=Jt(t),n={act:"hand",v:"me",icon:bn,tip:s.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Ce,tip:"Reopen"},a=[{act:"accept",icon:qt,tip:"Looks right \u2014 accept it",main:!0},{act:"sendback",icon:Ce,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,l=!xt(t.assignee)&&t.assignee?t.assignee===s.me?.email?"You":Ue(t.assignee):"",b=e==="queued"?{step:e,title:`Queued for ${te(t)}`,acts:[n]}:e==="working"?{step:e,title:`${te(t)} is working`,acts:[n],live:!0}:e==="asks"?{step:e,title:`${te(t)} asks`,acts:[]}:e==="stuck"?{step:e,title:`${te(t)} silent for ${uo(r?.at)}`,acts:[n]}:e==="review"?null:t.status!=="done"&&zt(t)==="accepted"?{step:"done",title:`Accepted${t.acceptedAt?` \xB7 ${Ai(t.acceptedAt)}`:""}`,acts:[{...o,act:"sendback",tip:"Send it back"}]}:zt(t)==="review"&&l?{step:"review",title:`${l} ${l==="You"?"say":"says"} done \u2014 check it`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&s.me&&!Ee()?{step:"anyone",title:"Unassigned",acts:[{act:"hand",v:"me",icon:qt,tip:"Take it myself"},{act:"hand",v:"agent",icon:Vt(13),tip:`Give it to ${te(t)}`},{act:"give",icon:ni,tip:"Give it to someone",pick:!0}]}:null;return b?`<div class="dt-step dt-step--${b.step}">${b.step==="anyone"?Bs:""}<span class="dt-step-text"><b>${h(b.title)}</b></span>${b.acts.map(L=>L.pick?`<label class="dt-step-act" data-tip="${h(L.tip)}">${L.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${h(L.tip)}"><option value="" selected hidden></option>${$e().map(O=>`<option value="${h(O.email)}"${Vn(O.email)}>${h(O.email===s.me?.email?`Me \xB7 ${O.name||O.email}`:O.name||O.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${L.main?" is-main":""}" data-act="${L.act}" data-id="${t.id}"${L.v?` data-v="${L.v}"`:""} data-tip="${h(L.tip)}" aria-label="${h(L.tip)}">${L.icon}</button>`).join("")}${b.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},Hi=async(t,e)=>{let n=e?G.find(a=>a.id===t):void 0,o=await $(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:ho(G.find(a=>a.id===t))});return o.ok&&n&&ms(ie(n)).then(a=>{a&&$({id:t,after:a})}),o},Qn=0,ts=t=>(Qn++,t.finally(()=>{Qn--})),Gt=async(t,e,n)=>{let o=G,a=ee;G=t(G),ee=t(ee),U();let r=await ts(e()).catch(()=>null);if(!r?.ok){G=o,ee=a,U(),Sn(`${n} did not go through`,r);return}let l=$n([await r.json().catch(()=>null)])[0];l&&(G=G.map(b=>b.id===l.id?l:b),ee=ee.map(b=>b.id===l.id?l:b),U()),Fe()},ho=t=>t?xt(t.assignee)?"approved":t.assignee?"progress":"new":"new",Me=(t,e)=>Gt(n=>n.map(o=>o.id===t?{...o,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:ho(o),reopenedAt:new Date().toISOString()}}:o),()=>Hi(t,e),e?"Resolving":"Reopening"),ke=async(t,e,n=!1)=>{let o=G.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Gt(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?s.me?.email:void 0}:l),()=>$({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&es(`Archived #${t}`,()=>ke(t,!1,!0))},es=(t,e)=>{let n=document.createElement("div");n.className="dt-toast dt-toast--undo",n.innerHTML=`<span>${h(t)}</span><button type="button">Undo</button>`,fe(n),n.querySelector("button").addEventListener("click",()=>{n.remove(),e()}),document.body.append(n),setTimeout(()=>n.remove(),5e3)},ns=t=>Gt(e=>e.filter(n=>n.id!==t),()=>Dt(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Bi=t=>{let e=G.filter(a=>k(a)===t),n=e.filter(a=>ut(a)==="open").length,o=e.filter(a=>ut(a)==="claude").length;ce.innerHTML=n?String(n):o?Vt(9):"\u2713",ce.dataset.state=n?"open":o?"claude":"done",ce.hidden=e.length===0},ss=0,mo,Xe=()=>{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,n=t.getBoundingClientRect(),o=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,n.top-8)}px`)};window.visualViewport?.addEventListener("resize",Xe),addEventListener("resize",Xe),document.addEventListener("focusin",Xe),document.addEventListener("focusout",()=>setTimeout(Xe));let U=()=>{requestAnimationFrame(Xe);let t=ss-performance.now();if(t>0){clearTimeout(mo),mo=setTimeout(U,t);return}if(Ht(),w){let u=lo(),Z=JSON.stringify(u);Z!==co&&(co=Z,parent.postMessage({dt:!0,drafts:u},location.origin))}As(),j.toggleAttribute("data-yield",st!=null||!!M),st!==A&&(It="",vt=[],A=st),rt&&rt.id!==st&&(rt=null);let e=we();if(Bi(e),!Mt){Y.innerHTML="",qn(null),kt.hidden=!0;return}let n=e,o="",a=G.filter(u=>k(u)===n&&(Ra(u)||u.id===st));for(let u of a){let Z=jt(u);if(!Z&&st!==u.id)continue;let D=ut(u),K=!Z,$t=Z??{x:0,y:0},oe=He(u.category),ae=sn(u),_e=D==="done"?null:Jt(u),ct=_e?zn[_e]??"":"";if(st===u.id&&Ua(u),K||(o+=`<button class="dt-pin dt-pin--${D}${D==="done"&&!Qt(u)?" dt-pin--resolved":""}${ct?" dt-pin--agent":""}${ae?" dt-pin--working":""}${D==="open"&&zt(u)==="review"?" dt-pin--review":""}${Z?.hidden?" dt-pin--hidden":""}" data-id="${u.id}"${Z?.off?` data-off="${Z.off}"`:""} aria-label="Comment ${u.id}, ${D==="open"?"open":D==="claude"?`resolved by ${h(xe(u.doneAgent,u.doneFor))}`:"resolved"}" aria-expanded="${st===u.id}"
222
- style="left:${$t.x}px;top:${$t.y}px;--cat:${oe.color};--ring:${Kn.find(Tt=>Tt[0]===hn(u))[2]};--hue:${Ds(u.by||u.byName||"")}${ct?`;--step-c:${ct}`:""}"
223
- title="${h(u.text.slice(0,80))} \xB7 ${oe.label}${ae?` \xB7 ${h(xe(ae.agent,ae.by))} is on it`:""}${D==="claude"?` \xB7 resolved by ${h(xe(u.doneAgent,u.doneFor))} \u2014 tick to confirm`:D==="done"?" \xB7 resolved":""}">${D==="done"?"\u2713":ct?Vt(11):Os(u)}${D!=="done"&&st!==u.id&&Fs(u)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button>`),st===u.id){let Tt=Te(u),he=Jt(u)==="review"&&!s.client?Tt.map(tt=>tt.author).lastIndexOf("claude"):-1;o+=`<div class="dt-note${K?" dt-note--orphan":""}" data-id="${u.id}" role="dialog" aria-label="Comment ${u.id}"
224
- style="left:${$t.x}px;top:${$t.y}px">
220
+ </div></div>`,ts=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),yo=()=>St.map((t,e)=>({i:e,el:ts(t.tag,t.classes),text:Bt(t.text??""),shots:t.images?.length??0,orphan:!zt(t)})),es=[],wo="",ne=t=>{let e=t.working;return Ee(e?.agent,e?.by??Ts(t.assignee))},$o=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`},$n=(t,e)=>{let n=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${ne(t)} \u2014 it takes it on its next run`,asks:`${ne(t)} is waiting for your answer`,working:`${ne(t)} is on it \xB7 ${$o(n?.at)}`,stuck:`${ne(t)} went quiet \u2014 its next run takes it again`,review:`Resolved by ${Ee(t.doneAgent,t.doneFor)} \u2014 click to clear`,done:"Resolved"}[e]},qi=t=>{let e=Zt(t);if(!e)return s.client||Me()||t.status==="done"?"":`<button class="dt-note-state dt-step--none" data-act="hand" data-v="agent" data-id="${t.id}" data-tip="Hand to Claude" aria-label="Hand to Claude">${Hs(13,0)}</button>`;let n=Hs(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${h($n(t,e))}" aria-label="${h($n(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${h($n(t,e))}" role="img" aria-label="${h($n(t,e))}">${n}</span>`},xo=(t,e=!0)=>{let n=pt(t),o=n==="done",a=te(t);return`${e?qi(t):""}<button data-act="${o?"reopen":"done"}" data-id="${t.id}"
221
+ class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Wt}</button><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"}">${Zn}</button>`},Fi=t=>t?new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}):"",ji=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!te(t)){let S=t.confirmedBy?t.confirmedBy===s.me?.email?"you":Ye(t.confirmedBy):"";return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${h(S?`Resolved by ${S} \u2014 check it`:"Resolved \u2014 check it")}</b></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">${Ne}</button><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">${Zn}</button></div>`}if(s.client)return"";let e=Zt(t),n={act:"hand",v:"me",icon:fn,tip:s.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Ne,tip:"Reopen"},a=[{act:"accept",icon:Wt,tip:"Looks right \u2014 accept it",main:!0},{act:"sendback",icon:Ne,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,l=!$t(t.assignee)&&t.assignee?t.assignee===s.me?.email?"You":Ye(t.assignee):"",g=e==="queued"?{step:e,title:`Queued for ${ne(t)}`,acts:[n]}:e==="working"?{step:e,title:`${ne(t)} is working`,acts:[n],live:!0}:e==="asks"?{step:e,title:`${ne(t)} asks`,acts:[]}:e==="stuck"?{step:e,title:`${ne(t)} silent for ${$o(r?.at)}`,acts:[n]}:e==="review"?null:t.status!=="done"&&_t(t)==="accepted"?{step:"done",title:`Accepted${t.acceptedAt?` \xB7 ${Fi(t.acceptedAt)}`:""}`,acts:[{...o,act:"sendback",tip:"Send it back"}]}:_t(t)==="review"&&l?{step:"review",title:`${l} ${l==="You"?"say":"says"} done \u2014 check it`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&s.me&&!Me()?{step:"anyone",title:"Unassigned",acts:[{act:"hand",v:"me",icon:Wt,tip:"Take it myself"},{act:"hand",v:"agent",icon:Gt(13),tip:`Give it to ${ne(t)}`},{act:"give",icon:hi,tip:"Give it to someone",pick:!0}]}:null;return g?`<div class="dt-step dt-step--${g.step}">${g.step==="anyone"?_s:""}<span class="dt-step-text"><b>${h(g.title)}</b></span>${g.acts.map(S=>S.pick?`<label class="dt-step-act" data-tip="${h(S.tip)}">${S.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${h(S.tip)}"><option value="" selected hidden></option>${xe().map(P=>`<option value="${h(P.email)}"${Gn(P.email)}>${h(P.email===s.me?.email?`Me \xB7 ${P.name||P.email}`:P.name||P.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${S.main?" is-main":""}" data-act="${S.act}" data-id="${t.id}"${S.v?` data-v="${S.v}"`:""} data-tip="${h(S.tip)}" aria-label="${h(S.tip)}">${S.icon}</button>`).join("")}${g.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},_i=async(t,e)=>{let n=e?Y.find(a=>a.id===t):void 0,o=await $(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:Eo(Y.find(a=>a.id===t))});return o.ok&&n&&bs(ee(n)).then(a=>{a&&$({id:t,after:a})}),o},ns=0,ss=t=>(ns++,t.finally(()=>{ns--})),Vt=async(t,e,n)=>{let o=Y,a=oe;Y=t(Y),oe=t(oe),G();let r=await ss(e()).catch(()=>null);if(!r?.ok){Y=o,oe=a,G(),Tn(`${n} did not go through`,r);return}let l=Mn([await r.json().catch(()=>null)])[0];l&&(Y=Y.map(g=>g.id===l.id?l:g),oe=oe.map(g=>g.id===l.id?l:g),G()),en()},Eo=t=>t?$t(t.assignee)?"approved":t.assignee?"progress":"new":"new",ke=(t,e)=>Vt(n=>n.map(o=>o.id===t?{...o,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:Eo(o),reopenedAt:new Date().toISOString()}}:o),()=>_i(t,e),e?"Resolving":"Reopening"),Le=async(t,e,n=!1)=>{let o=Y.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Vt(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?s.me?.email:void 0}:l),()=>$({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&xn(`Archived #${t}`,()=>Le(t,!1,!0))},xn=(t,e)=>{let n=document.createElement("div");n.className="dt-toast dt-toast--undo",n.innerHTML=`<span>${h(t)}</span><button type="button">Undo</button>`,ve(n),n.querySelector("button").addEventListener("click",()=>{n.remove(),e()}),document.body.append(n),setTimeout(()=>n.remove(),5e3)},os=t=>Vt(e=>e.filter(n=>n.id!==t),()=>Ct(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Wi=t=>{let e=Y.filter(a=>k(a)===t),n=e.filter(a=>pt(a)==="open").length,o=e.filter(a=>pt(a)==="claude").length;ue.innerHTML=n?String(n):o?Gt(9):"\u2713",ue.dataset.state=n?"open":o?"claude":"done",ue.hidden=e.length===0},as=0,Mo,Ze=()=>{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,n=t.getBoundingClientRect(),o=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,n.top-8)}px`)};window.visualViewport?.addEventListener("resize",Ze),addEventListener("resize",Ze),document.addEventListener("focusin",Ze),document.addEventListener("focusout",()=>setTimeout(Ze));let G=()=>{requestAnimationFrame(Ze);let t=as-performance.now();if(t>0){clearTimeout(Mo),Mo=setTimeout(G,t);return}if(Rt(),w){let u=yo(),Z=JSON.stringify(u);Z!==wo&&(wo=Z,parent.postMessage({dt:!0,drafts:u},location.origin))}Os(),j.toggleAttribute("data-yield",st!=null||!!M),st!==A&&(qt="",wt=[],A=st),lt&&lt.id!==st&&(lt=null);let e=$e();if(Wi(e),!kt){U.innerHTML="",jn(null),Lt.hidden=!0;return}let n=e,o="",a=Y.filter(u=>k(u)===n&&(Ga(u)||u.id===st));for(let u of a){let Z=zt(u);if(!Z&&st!==u.id)continue;let D=pt(u),K=!Z,Et=Z??{x:0,y:0},re=Re(u.category),le=Ke(u),We=D==="done"?null:Zt(u),ut=We?Un[We]??"":"";if(st===u.id&&oi(u),K||(o+=`<button class="dt-pin dt-pin--${D}${D==="done"&&!te(u)?" dt-pin--resolved":""}${ut?" dt-pin--agent":""}${le?" dt-pin--working":""}${D==="open"&&_t(u)==="review"?" dt-pin--review":""}${Z?.hidden?" dt-pin--hidden":""}" data-id="${u.id}"${Z?.off?` data-off="${Z.off}"`:""} aria-label="Comment ${u.id}, ${D==="open"?"open":D==="claude"?`resolved by ${h(Ee(u.doneAgent,u.doneFor))}`:"resolved"}" aria-expanded="${st===u.id}"
222
+ style="left:${Et.x}px;top:${Et.y}px;--cat:${re.color};--ring:${Yn.find(At=>At[0]===mn(u))[2]};--hue:${Gs(u.by||u.byName||"")}${ut?`;--step-c:${ut}`:""}"
223
+ title="${h(u.text.slice(0,80))} \xB7 ${re.label}${le?` \xB7 ${h(Ee(le.agent,le.by))} is on it`:""}${D==="claude"?` \xB7 resolved by ${h(Ee(u.doneAgent,u.doneFor))} \u2014 tick to confirm`:D==="done"?" \xB7 resolved":""}${ys(u)?" \u2014 drag to move":""}"${ys(u)?" data-move":""}>${D==="done"?"\u2713":ut?Gt(11):Us(u)}${D!=="done"&&st!==u.id&&Xs(u)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button>`),st===u.id){let At=He(u),me=Zt(u)==="review"&&!s.client?At.map(tt=>tt.author).lastIndexOf("claude"):-1;o+=`<div class="dt-note${K?" dt-note--orphan":""}" data-id="${u.id}" role="dialog" aria-label="Comment ${u.id}"
224
+ style="left:${Et.x}px;top:${Et.y}px">
225
225
  <div class="dt-note-bar">
226
- <span class="dt-note-el"${s.client?"":` data-tip="${Ws(u.selector,u.label)}"`}>${s.client?`Comment #${u.id>0?u.id:"\u2026"}`:h(Jn(u.tag,u.classes))}</span>
226
+ <span class="dt-note-el"${s.client?"":` data-tip="${Qs(u.selector,u.label)}"`}>${s.client?`Comment #${u.id>0?u.id:"\u2026"}`:h(ts(u.tag,u.classes))}</span>
227
227
  <span class="dt-note-tools">
228
- ${!s.client&&u.shared?`<span class="dt-note-eye" data-tip="The client sees this thread" role="img" aria-label="The client sees this thread">${Xs}</span>`:""}
229
- ${po(u)}
228
+ ${!s.client&&u.shared?`<span class="dt-note-eye" data-tip="The client sees this thread" role="img" aria-label="The client sees this thread">${io}</span>`:""}
229
+ ${xo(u)}
230
230
  <i class="dt-note-sep"></i>
231
- ${Ys(u.shared,u.id)}
232
- <button data-act="close" data-id="${u.id}" data-tip="Close" aria-label="Close">${ge}</button>
231
+ ${ao(u.shared,u.id)}
232
+ <button data-act="close" data-id="${u.id}" data-tip="Close" aria-label="Close">${be}</button>
233
233
  </span>
234
234
  </div>
235
235
  ${K?'<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>':""}
236
- <div class="dt-note-hidden"${Z?.hidden?"":" hidden"}>${ti}<p><b>Hidden right now</b>It sits inside \xAB${h(ei(Z?.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="${u.id}">Show where</button></div>
237
- ${(()=>{let tt=(s.client?"":Za(u))+(u.host&&u.host!==location.host?`<span class="dt-note-host" title="Written on ${h(u.host)}">${h(u.host)}</span>`:"");return tt?`<div class="dt-note-meta">${tt}</div>`:""})()}
236
+ <div class="dt-note-hidden"${Z?.hidden?"":" hidden"}>${ui}<p><b>Hidden right now</b>It sits inside \xAB${h(pi(Z?.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="${u.id}">Show where</button></div>
237
+ ${(()=>{let tt=(s.client?"":di(u))+(u.host&&u.host!==location.host?`<span class="dt-note-host" title="Written on ${h(u.host)}">${h(u.host)}</span>`:"");return tt?`<div class="dt-note-meta">${tt}</div>`:""})()}
238
238
  <div class="dt-note-thread">
239
- ${Tt.map((tt,me)=>{let We=me===0?null:tt.at??null,Le=tt.author==="you"&&(!tt.by||tt.by===s.me?.email),Xo=Le&&rt?.id===u.id&&rt.at===We,Qe=s.team?.find(ys=>ys.email===tt.by),Jo=tt.author==="claude"?xe(tt.agent,tt.by):Le?"You":Qe?.name||tt.byName||tt.by||"You",Zo=tt.author==="claude"?Qe?.agent_avatar_url?`<img class="dt-msg-face" src="${h(Qe.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${Vt(11)}</span>`:Qe?.avatar_url?`<img class="dt-msg-face" src="${h(Qe.avatar_url)}" alt="">`:"",vs=`${u.id}:${tt.at??"0"}`,An=re.get(vs),Qo=!Le&&s.voice&&tt.text?`<button class="dt-msg-edit${re.has(vs)?" is-on":""}" data-act="translate" data-id="${u.id}" data-at="${h(tt.at??"0")}" title="${re.has(vs)?"Show the original":"Translate into your language"}">${Si}</button>${ki(u.id,tt.at??"0")}`:"",ta=`<div class="dt-msg-head">${Zo}<b>${h(Jo)}</b><time>${on(tt.at)}</time>${Qo}${Le&&!Xo?`<button class="dt-msg-edit" data-act="edit" data-id="${u.id}" data-at="${h(We??"")}" title="Edit">${an}</button>${We?`<button class="dt-msg-edit" data-act="unsay" data-id="${u.id}" data-at="${h(We)}" title="Delete">${Ae}</button>`:""}`:""}</div>`;return me===he?`<div class="dt-msg dt-msg--done" data-msg="${u.id}:${h(tt.at??"0")}"><div class="dt-msg-head">${Zo}<b>${h(Jo)} fixed it</b><time>${on(tt.at)}</time>${Qo}</div><p${An===null?' class="is-asking"':""}>${Io(An||tt.text)}</p>${Gn(tt.images)}
240
- <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${u.id}">${qt}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${u.id}">${Ce}Send back</button></div></div>`:Xo?`<div class="dt-msg">${ta}<div class="dt-compose">
241
- <textarea class="dt-note-edit-input" rows="1">${h(rt.text)}</textarea>
242
- ${Gn(tt.images.filter(ys=>!rt.drop.includes(ys.split("/").pop())),u.id)}
239
+ ${At.map((tt,ge)=>{let ze=ge===0?null:tt.at??null,Ce=tt.author==="you"&&(!tt.by||tt.by===s.me?.email),ca=Ce&&lt?.id===u.id&&lt.at===ze,nn=s.team?.find(ks=>ks.email===tt.by),ua=tt.author==="claude"?Ee(tt.agent,tt.by):Ce?"You":nn?.name||tt.byName||tt.by||"You",pa=tt.author==="claude"?nn?.agent_avatar_url?`<img class="dt-msg-face" src="${h(nn.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${Gt(11)}</span>`:nn?.avatar_url?`<img class="dt-msg-face" src="${h(nn.avatar_url)}" alt="">`:"",Ms=`${u.id}:${tt.at??"0"}`,Bn=de.get(Ms),ha=!Ce&&s.voice&&tt.text?`<button class="dt-msg-edit${de.has(Ms)?" is-on":""}" data-act="translate" data-id="${u.id}" data-at="${h(tt.at??"0")}" title="${de.has(Ms)?"Show the original":"Translate into your language"}">${Ii}</button>${Oi(u.id,tt.at??"0")}`:"",ma=`<div class="dt-msg-head">${pa}<b>${h(ua)}</b><time>${rn(tt.at)}</time>${ha}${Ce&&!ca?`<button class="dt-msg-edit" data-act="edit" data-id="${u.id}" data-at="${h(ze??"")}" title="Edit">${ln}</button>${ze?`<button class="dt-msg-edit" data-act="unsay" data-id="${u.id}" data-at="${h(ze)}" title="Delete">${Be}</button>`:""}`:""}</div>`;return ge===me?`<div class="dt-msg dt-msg--done" data-msg="${u.id}:${h(tt.at??"0")}"><div class="dt-msg-head">${pa}<b>${h(ua)} fixed it</b><time>${rn(tt.at)}</time>${ha}</div><p${Bn===null?' class="is-asking"':""}>${Uo(Bn||tt.text)}</p>${Jn(tt.images)}
240
+ <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${u.id}">${Wt}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${u.id}">${Ne}Send back</button></div></div>`:ca?`<div class="dt-msg">${ma}<div class="dt-compose">
241
+ <textarea class="dt-note-edit-input" rows="1">${h(lt.text)}</textarea>
242
+ ${Jn(tt.images.filter(ks=>!lt.drop.includes(ks.split("/").pop())),u.id)}
243
243
  <div class="dt-compose-bar">
244
244
  <button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
245
- <button class="dt-send${rt.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${qt}</button>
245
+ <button class="dt-send${lt.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${Wt}</button>
246
246
  </div>
247
- </div></div>`:`<div class="dt-msg" data-msg="${u.id}:${h(tt.at??"0")}">${ta}<p${An===null?' class="is-asking"':""}>${Io(An||tt.text)}</p>${me===0&&u.suggest?Xa(u.suggest):""}${Gn(tt.images)}</div>`}).join("")}
247
+ </div></div>`:`<div class="dt-msg" data-msg="${u.id}:${h(tt.at??"0")}">${ma}<p${Bn===null?' class="is-asking"':""}>${Uo(Bn||tt.text)}</p>${ge===0&&u.suggest?ri(u.suggest):""}${Jn(tt.images)}</div>`}).join("")}
248
248
  </div>
249
- ${Ci(u)}
250
- ${ro("dt-note-reply-input",Jt(u)==="asks"?`Answer ${h(te(u))}`:"Reply",It,`data-act="reply" data-id="${u.id}"`,oo(vt))}
251
- ${Gs(u.priority,u.category,u.id,u.assignee??"",Rn(u))}
252
- </div>`}}St.forEach((u,Z)=>{let D=jt(u);D&&(o+=`<button class="dt-pin dt-pin--draft" data-parked="${Z}" data-act="draft-open" data-i="${Z}"
253
- style="left:${D.x}px;top:${D.y}px" title="Draft, not sent \u2014 click to finish it">${an}</button>`)});let r=M&&jt(M);if(M){let u=r?.x??0,Z=r?.y??0;o+=`${r?`<span class="dt-pin dt-pin--draft" data-draft style="left:${u}px;top:${Z}px"></span>`:""}
249
+ ${ji(u)}
250
+ ${vo("dt-note-reply-input",Zt(u)==="asks"?`Answer ${h(ne(u))}`:"Reply",qt,`data-act="reply" data-id="${u.id}"`,go(wt))}
251
+ ${oo(u.priority,u.category,u.id,u.assignee??"",Cs(u))}
252
+ </div>`}}St.forEach((u,Z)=>{let D=zt(u);D&&(o+=`<button class="dt-pin dt-pin--draft" data-parked="${Z}" data-act="draft-open" data-i="${Z}"
253
+ style="left:${D.x}px;top:${D.y}px" title="Draft, not sent \u2014 click to finish it">${ln}</button>`)});let r=M&&zt(M);if(M){let u=r?.x??0,Z=r?.y??0;o+=`${r?`<span class="dt-pin dt-pin--draft" data-draft style="left:${u}px;top:${Z}px"></span>`:""}
254
254
  <div class="dt-note${r?"":" dt-note--orphan"}" data-draft style="left:${u}px;top:${Z}px">
255
255
  <div class="dt-note-bar">
256
- <span class="dt-note-el"${s.client?"":` data-tip="${Ws(M.selector,M.label)}"`}>${s.client?"New comment":h(Jn(M.tag,M.classes))}</span>
257
- ${ye()?'<span class="dt-note-draft">Draft</span>':""}
256
+ <span class="dt-note-el"${s.client?"":` data-tip="${Qs(M.selector,M.label)}"`}>${s.client?"New comment":h(ts(M.tag,M.classes))}</span>
257
+ ${we()?'<span class="dt-note-draft">Draft</span>':""}
258
258
  <span class="dt-note-tools">
259
- ${!s.client&&M.shared?`<span class="dt-note-eye" data-tip="The client will see this thread" role="img" aria-label="The client will see this thread">${Xs}</span>`:""}
260
- ${Ys(M.shared)}
261
- <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${ge}</button>
259
+ ${!s.client&&M.shared?`<span class="dt-note-eye" data-tip="The client will see this thread" role="img" aria-label="The client will see this thread">${io}</span>`:""}
260
+ ${ao(M.shared)}
261
+ <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${be}</button>
262
262
  </span>
263
263
  </div>
264
264
  ${r?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
265
- ${(()=>{let D=r?ie(M):null,K=D&&G.find($t=>$t.id>0&&ut($t)==="open"&&ie($t)===D);return K?`<p class="dt-note-twin">Already open here: \u201C${h(K.text.slice(0,60))}${K.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${K.id}">Open it</button></p>`:""})()}
266
- ${s.client?`<div class="dt-note-meta">${ai(M.assignee)}</div>`:""}
267
- ${M.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">${ge}</button></span>
265
+ ${(()=>{let D=r?ee(M):null,K=D&&Y.find(Et=>Et.id>0&&pt(Et)==="open"&&ee(Et)===D);return K?`<p class="dt-note-twin">Already open here: \u201C${h(K.text.slice(0,60))}${K.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${K.id}">Open it</button></p>`:""})()}
266
+ ${s.client?`<div class="dt-note-meta">${bi(M.assignee)}</div>`:""}
267
+ ${M.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">${be}</button></span>
268
268
  <span class="dt-suggest-was">Now: <del>${h(M.suggest.from.slice(0,160))}${M.suggest.from.length>160?"\u2026":""}</del></span>
269
269
  <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${h(M.suggest.to)}</textarea>
270
270
  <span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
271
- ${ro("dt-note-input",M.suggest?"Why (optional)":"Comment",M.text??"",'data-act="save"',oo(M.images))}
272
- ${Gs(M.priority,M.category,void 0,M.assignee??"")}
273
- </div>`}let l=new Map([...Y.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(u=>[u.closest(".dt-note").dataset.id,{top:u.scrollTop,end:u.scrollTop+u.clientHeight>=u.scrollHeight-4}])),b=new Set([...Y.querySelectorAll("[data-msg]")].map(u=>u.dataset.msg)),L=Y.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Y.innerHTML=o,L&&Ln(".dt-note-reply-input");for(let u of Y.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let Z=u.closest(".dt-note").dataset.id,D=l.get(Z);if(!D)continue;let K=[...u.querySelectorAll("[data-msg]")].filter($t=>!b.has($t.dataset.msg));for(let $t of K)$t.classList.add("dt-msg--new");u.scrollTop=D.end&&K.length?u.scrollHeight:D.top}for(let u of Y.querySelectorAll(".dt-note")){let Z=u.getBoundingClientRect();Z.bottom>innerHeight-8&&(u.dataset.flip="1"),Z.right>innerWidth-8&&(u.dataset.flipx="1")}Je(n),qn(Fn()),le();for(let u of Y.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))bs(u);let O=Y.querySelector(".dt-note-input");O&&(O.focus(),O.setSelectionRange(O.value.length,O.value.length))},Ni=()=>{let t=!1,e=[];for(let n of Y.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(n.classList.contains("dt-note--orphan"))continue;let o=G.find(r=>r.id===Number(n.dataset.id)),a=o&&jt(o);e.push([n,a]),a&&Hs(a.el)&&(t=!0)}for(let n of Y.querySelectorAll("[data-draft], [data-parked]")){if(n.classList.contains("dt-note--orphan"))continue;let o=n.dataset.parked?St[Number(n.dataset.parked)]:M;e.push([n,o?jt(o):null])}for(let[n,o]of e){if(!o){n.style.visibility="hidden";continue}n.style.visibility="",n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.matches(".dt-pin[data-id]")&&(o.off?n.dataset.off=o.off:delete n.dataset.off,n.classList.toggle("dt-pin--hidden",!!o.hidden)),n.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!cn.length&&(M||st!=null)){let n=Fn();n&&Hs(n)&&qn(n)}Ve(M||st!=null?Fn():null),t&&le()},Je=t=>{if(!j.hidden&&(j.innerHTML=Ta({bp:t,notes:G,breakpoints:d,bandOfNote:k,orphan:e=>!jt(e),hiddenNow:e=>!!jt(e)?.hidden,whoseAgent:xe,statusTools:e=>po(e,!js(e)),showResolved:Lt,showArchived:Zt,archived:Qt,drafts:Rt.hidden?lo():Zn,checks:w?0:rs.toCheck().length,marker:Pi,assign:js,find:Ot,forMe:Ri,forAgent:e=>!!Jt(e)&&ut(e)!=="done",unread:Fs}),Oe)){let e=j.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Oe.at,Oe.at),Oe=null}},Oe=null,Ri=t=>{if(ut(t)==="done"||!s.me)return!1;if(t.assignee===s.me.email||ut(t)==="claude"||zt(t)==="review"&&t.assignee!==s.me.email)return!0;let e=(s.me.name||s.me.email).split(/[\s@]/)[0].toLowerCase();return Te(t).some(n=>n.text.toLowerCase().includes("@"+e))},Pi=t=>{if(ut(t)==="done")return'<span class="dt-hist-n"></span>';let n=zn[Jt(t)??""];if(n)return`<span class="dt-hist-face dt-hist-face--agent" style="--step-c:${n}">${Vt(10)}</span>`;let o=Os(t);return o?`<span class="dt-hist-face" style="--ring:${Kn.find(a=>a[0]===hn(t))[2]};--hue:${Ds(t.by||t.byName||"")}">${o}</span>`:`<span class="dt-hist-n" style="--cat:${He(t.category).color}"></span>`},os=t=>j.toggleAttribute("data-collapsed",t);j.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(Ot.q=e.value,Oe={at:e.selectionStart??e.value.length},Je(we()))}),j.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Fe(),setTimeout(()=>delete e.dataset.spin,500);return}if(j.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){os(!1);return}if(t.target.closest("[data-fold]")){os(!j.hasAttribute("data-collapsed"));return}let n=t.target.closest(".dt-hist-bands [data-bp]");if(n){qo(n.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?(Ot.view=o.dataset.histView,F("dt-view",Ot.view),Ot.menu=!1):o.dataset.histSort?(Ot.sort=o.dataset.histSort,F("dt-sort",Ot.sort),Ot.menu=!1):o.hasAttribute("data-hist-clear")?(Ot.q="",Oe={at:0}):Ot.menu=!Ot.menu,Je(we());return}Ot.menu&&!t.target.closest(".dt-hist-menu")&&(Ot.menu=!1,Je(we()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let D=a.dataset.draftRm!==void 0,K=Number(D?a.dataset.draftRm:a.dataset.draftGo);Rt.hidden?D?go(K):is(K):_t(D?{dropDraft:K}:{openDraft:K});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await Me(Number(r.dataset.unmark),!1);return}let l=t.target.closest(".dt-hist-tools [data-act]");if(l){await Me(Number(l.dataset.id),l.dataset.act==="done");return}let b=t.target.closest("[data-rm]");if(b){st=null,await ns(Number(b.dataset.rm));return}if(t.target.closest("[data-review]")){rs.start();return}if(t.target.closest("[data-resolved]")){ds(!Lt);return}if(t.target.closest("[data-archived]")){cs(!Zt);return}let L=t.target.closest("[data-archive-all]");if(L){let D=L.dataset.archiveAll.split(",").map(Number);for(let K of D)await ke(K,!0,!0);es(`Archived ${D.length}`,()=>{for(let K of D)ke(K,!1,!0)});return}let O=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(O){await ke(Number(O.dataset.id),O.dataset.act==="archive");return}let u=t.target.closest("[data-go]");if(!u)return;let Z=Number(u.dataset.go);if(!Rt.hidden){_t({open:Z});return}as(Z)});let as=t=>{st=t,v(),U();let e=G.find(o=>o.id===t),n=e&&jt(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&ie(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||Y.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},is=t=>{let[e]=St.splice(t,1);if(!e)return;v(),M=e,st=null;let n=jt(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),U()},go=t=>{St.splice(t,1),U()},rs=Aa({inFrame:w,everything:()=>ee,route:()=>S,settle:Me,keepIn:fe,toast:t=>qe(t),waits:t=>ut(t)==="claude"||ut(t)==="done"&&!Qt(t),approve:t=>ut(t)==="claude"?Me(t.id,!0):ke(t.id,!0,!0),open:t=>{if(Mt||ue(!0),k(t)!==we()){qo(k(t));for(let e of[600,1500])setTimeout(()=>_t({open:t.id}),e)}else as(t.id)}}),Ii=t=>{j.hidden=!t,R.setAttribute("aria-pressed",String(t)),F("dt-history",t?"1":"0"),U()},ls=document.querySelector(".dt-resolved-btn"),ds=t=>{Lt=t,ls.setAttribute("aria-pressed",String(t)),F("dt-resolved",t?"1":"0"),_t({resolved:t}),U(),Se(!0)},cs=t=>{Zt=t,F("dt-archived",t?"1":"0"),_t({archived:t}),U(),Se(!0)};ls.addEventListener("click",()=>ds(!Lt)),ls.setAttribute("aria-pressed",String(Lt)),R.addEventListener("click",()=>{let t=j.hidden===!0;t&&!Mt&&ue(!0),t&&os(!1),Ii(t)});let le=()=>{ve||!Mt||(ve=requestAnimationFrame(()=>{ve=0,Ni()}))},bo=`${be}, .dt-where, .dt-spot, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,Oi=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(bo))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(o=>o instanceof Element&&o.matches(bo))},fo=new MutationObserver(t=>{t.every(Oi)||(Cs(),le())}),vo=new ResizeObserver(()=>le()),yo=()=>{Y.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&le()},ee=[],wo=()=>{},Di=t=>{ee=t,queueMicrotask(()=>wo());let e=()=>({new:0,progress:0,review:0,waiting:0,accepted:0,done:0}),n={};for(let b of t){if(Qt(b))continue;let L=ut(b),O=Jt(b),u=L==="done"?"done":L==="claude"?"review":O&&mn[O]||hn(b),Z=n[b.route??""]??={...e(),bands:{}};Z[u]++;let D=k(b);(Z.bands[D]??=e())[u]++}let o=["new","progress","review","waiting","accepted","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",accepted:"accepted",done:"resolved"},r=b=>o.map(L=>[L,L==="done"&&!Lt?0:b[L]]),l=b=>r(b).reduce((L,[,O])=>L+O,0);for(let b of document.querySelectorAll(".dt-pages a")){let L=b.querySelector(".dt-pages-n");if(!L)continue;let O=n[new URL(b.href).pathname.replace(/\/+$/,"")||"/"];for(let D of d){let K=O?.bands[D.id];for(let[$t,oe]of r(K??e())){let ae=L.querySelector(`[data-bp="${D.id}"][data-state="${$t}"]`);ae.hidden=!oe,oe&&(ae.querySelector("i").textContent=String(oe),ae.title=`${D.label}: ${oe} ${a[$t]}`)}}let u=O?l(O):0;L.hidden=!u;let Z=O?d.filter(D=>O.bands[D.id]&&l(O.bands[D.id])).map(D=>`${D.label} ${l(O.bands[D.id])}`).join(" \xB7 "):"";L.title=u?`${o.filter(D=>O[D]).map(D=>`${O[D]} ${a[D]}`).join(" \xB7 ")}
274
- ${Z}`:""}},$n=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(n=>typeof n?.text=="string"):[],images:Array.isArray(e.images)?e.images.filter(n=>typeof n=="string"):[]})),qi=Ca(w,t=>qe(t)),Yt=document.querySelector(".dt-push"),Xt=Yt.querySelector(".dt-push-menu"),ne=new Set,De=new Set,$o=()=>document.querySelector(".dt-turbo")?.dataset.state==="on",xn=()=>s.client||Ee()||w?[]:ee.filter(t=>t.status!=="done"&&!t.assignee&&!Rn(t)&&!Qt(t)),En=()=>xn().filter(t=>!ne.has(t.id)),xo=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?qt:""}</i>`,Eo=()=>{let t=xn(),e=[...new Set(t.map(o=>o.route??"/"))],n=En().length;Xt.innerHTML=`<div class="dt-push-head">${Vt(14)}<b>What goes to Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),r=a.filter(l=>!ne.has(l.id)).length;return`<button type="button" class="dt-push-page${De.has(o)?" is-open":""}" data-push-route="${h(o)}"><span data-push-fold="${h(o)}">${De.has(o)?"\u25BE":"\u25B8"}</span>${xo(r>0,r>0&&r<a.length)}<span class="dt-push-route">${h(o)}</span><em>${a.length}</em></button>`+(De.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${xo(!ne.has(l.id))}<span><small>#${l.id}</small>${h(l.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>${Vt(13)}Send ${n} to Claude</button>`},Mn=()=>{let t=xn();Yt.hidden=!t.length,Yt.classList.toggle("is-live",$o()),Yt.querySelector(".dt-push-n").textContent=String(En().length),document.querySelector(".devtools")?.style.setProperty("--dt-push-w",Yt.hidden?"0px":`${Yt.offsetWidth+8}px`),t.length||(Xt.hidden=!0),Xt.hidden||Eo()},Mo=async t=>{if(!t.length)return;Xt.hidden=!0,Yt.querySelector(".dt-push-pick").setAttribute("aria-expanded","false");let e=await Promise.all(t.map(o=>$({id:o.id,assignee:un,stage:"approved"}).catch(()=>null))),n=t.filter((o,a)=>e[a]?.ok).map(o=>o.id);if(!n.length){Sn("Nothing was sent to Claude");return}await Fe(),es(`${n.length} sent to Claude${$o()?" \u2014 Turbo is taking them":" \u2014 run /notemend:turbo in Claude Code to start"}`,async()=>{await Promise.all(n.map(o=>$({id:o,assignee:null,stage:"new"}).catch(()=>null))),Fe()})};Yt.querySelector(".dt-push-all").addEventListener("click",()=>Mo(En())),Yt.querySelector(".dt-push-pick").addEventListener("click",t=>{Xt.hidden=!Xt.hidden,t.currentTarget.setAttribute("aria-expanded",String(!Xt.hidden)),Xt.hidden||Eo()}),Xt.addEventListener("click",t=>{let e=t.target,n=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"){Mo(En());return}if(r==="all")ne.clear();else if(n){let l=n.dataset.pushFold;De.has(l)?De.delete(l):De.add(l)}else if(o){let l=xn().filter(L=>(L.route??"/")===o.dataset.pushRoute),b=l.some(L=>!ne.has(L.id));for(let L of l)b?ne.add(L.id):ne.delete(L.id)}else if(a){let l=Number(a.dataset.pushId);ne.has(l)?ne.delete(l):ne.add(l)}Mn()}),document.addEventListener("pointerdown",t=>{!Xt.hidden&&!Yt.contains(t.target)&&(Xt.hidden=!0,Yt.querySelector(".dt-push-pick").setAttribute("aria-expanded","false"))},!0),setInterval(Mn,3e4),wo=Mn,Mn();let kn="",us=!1,ko=t=>{kn=t.version??"",qi(t);let e=$n(t.comments);Di(e);let n=e.filter(o=>o.route===S);if(JSON.stringify(n)===JSON.stringify(G)){!j.hidden&&!w&&U();return}if(Y.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){kn="",setTimeout(Ze,5e3);return}G=n,U(),_t({reload:!0})},Se=async(t=!1)=>{let e=[t||!kn?"":`since=${kn}`,Lt||Zt?"":"open=1"].filter(Boolean).join("&");try{let n=await Dt(`comments${e?`?${e}`:""}`);n.status===200&&ko(await n.json())}catch{}},Ze=async()=>{document.hidden||us||Qn||(us=!0,await Se(),us=!1)},ps=()=>{G=ee.filter(t=>t.route===S),U()},hs=0,So=t=>{hs||(hs=requestAnimationFrame(()=>{hs=0;let e=t.target;if(!Mt||e.closest(yt)){bt.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(bt.hidden=!1,!n)return;let o=n.getBoundingClientRect();Nt.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Ct.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Ct.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},Lo=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),rt){rt=null,U();return}if(M){v(),U();return}if(st!==null){st=null,U();return}ue(!1)}},To=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Ao=t=>{t.target.closest?.(yt)||t.stopPropagation()},Co=t=>{if(t.target.closest(yt))return;if(t.preventDefault(),t.stopPropagation(),Q){Q=!1;return}if(!getSelection()?.isCollapsed)return;Y.hidden=!0;let n=document.elementFromPoint(t.clientX,t.clientY);if(Y.hidden=!1,!n)return;v();let o=n.getBoundingClientRect(),a=n.tagName.toLowerCase(),r=[...n.classList].filter(b=>!/^(astro|svelte|css)-/.test(b)).slice(0,2);M={selector:Da(n),tag:a,classes:r,nth:qa({tag:a,classes:r}).indexOf(n),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Ft(n.textContent||"").slice(0,60),ctx:Fa(n),category:m[0].id};let l=s.client||Ee()?null:Wn();l&&(M.assignee=l,M.stage=xt(l)?"approved":"new"),Bo.set(M,Vi().then(()=>ms(n))),st=null,bt.hidden=!0,U()},Fi=2200,ji=900*1024,Ho=8*1024*1024,_i=3*1024*1024,Wi=1200,zi=1600,ms=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 n=e?.getBoundingClientRect();if(!e||!n?.width||!n.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,l]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*l>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,Wi/n.width,zi/n.height),l=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 l&&l.length<Ho?l:null}catch{return null}},Bo=new WeakMap,Vi=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),qe=(t,e=2800)=>{let n=document.createElement("div");n.className="dt-toast",n.textContent=t,document.body.append(n),setTimeout(()=>n.remove(),e)},Sn=(t,e)=>qe(navigator.onLine?`${t}${e?` (${e.status})`:""}.`:`${t} \u2014 you are offline. Try again once you are back online.`,6e3),Ki=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),Ui=async t=>{let e=await createImageBitmap(t),n=Math.min(1,Fi/Math.max(e.width,e.height));if(n===1&&t.size<=ji)return e.close(),Ki(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*n),o.height=Math.round(e.height*n),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},gs=async(t,e)=>{let n=[],o=(a,r)=>n.push(`${vn}${a}\0${r}`);for(let a of t){let r,l=ia(a.name)||Object.keys(en).find(b=>en[b]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,ws.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>_i){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 3 MB from the bar`);continue}let b=await new Promise((L,O)=>{let u=new FileReader;u.onload=()=>L(String(u.result).split(",")[1]),u.onerror=O,u.readAsDataURL(a)}).catch(()=>"");b?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${aa(a.name)||"file"};ext=${l};base64,${b}`):o(a.name,"Could not be read");continue}try{r=await Ui(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>Ho){o(a.name,"Too large even after shrinking");continue}n.push(r)}if(n.length){if(!Number(e?.dataset.id)){M&&((M.images??=[]).push(...n),U());return}vt.push(...n),U(),Ln(".dt-note-reply-input")}},No=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);Y.addEventListener("paste",t=>{let e=No(t.clipboardData?.items);e.length&&(t.preventDefault(),gs(e,t.target.closest(".dt-note")))}),Y.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),Y.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),Y.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=No(t.dataTransfer?.items);n.length&&gs(n,e)});let Ln=t=>{let e=Y.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},Ro=()=>{Ln(".dt-note-edit-input"),Y.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},bs=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden"},Gi=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Yi=()=>s.client||Ee()?[]:Nn(),Po=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let n=Gi(t);if(!n)return;let o=n[1].toLowerCase(),a=(s.team??[]).filter(l=>[l.name,l.nickname,l.email].some(b=>b?.toLowerCase().startsWith(o))).slice(0,5),r=Yi().filter(l=>l.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!a.length&&!r.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="${h(ra(l))}">${pn(l.avatar_url,l.name||l.email)}<span class="dt-mention-who"><b>${h(l.name||l.email)}</b>${l.name?`<span>${h(l.email)}</span>`:""}</span></button>`),...r.map(l=>`<button type="button" role="option" data-act="mention" data-handle="${h(l.handle)}">${Ga(l.owner)}<span class="dt-mention-who"><b>${h(l.handle)}</b><span>${l.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((l,b)=>l.replace('role="option"',`role="option" aria-selected="${b===0}"`)).join("")}</div>`)},Io=t=>{let e=[...(s.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Nn().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>h(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=h(t);return e.length?n.replace(new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"),o=>`<span class="dt-at">${o}</span>`):n},Oo=(t,e)=>{let n=t.selectionStart??t.value.length,o=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(n)}`,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()},Xi=(t,e)=>{if(!t){M&&(M.category=e),U();return}Gt(n=>n.map(o=>o.id===t?{...o,category:e}:o),()=>$({id:t,category:e}),"Changing the type")};xa([Y,j],h,qt),j.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&_n(Number(e.dataset.id),e.value)}),j.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let n=e.dataset.v;_n(Number(e.dataset.id),n==="agent"?un:n==="person"?jn():"")},!0);let Ji=(t,e)=>{t?Gt(n=>n.map(o=>o.id===t?{...o,shared:e||void 0}:o),()=>$({id:t,shared:e}),e?"Sharing with the client":"Keeping it to the team"):M&&(M.shared=e||void 0,Ht(),U())};Y.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let b=e.value,L=Number(e.dataset.id)||0;e.value="",b==="team"||b==="client"?Ji(L,b==="client"):b==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(st=null,ns(L)):b==="discard"&&(M=null,U());return}let n=t.target.closest(".dt-lang-select");if(n){io(Number(n.dataset.id),n.dataset.at,n.value);return}let o=t.target.closest(".dt-cat-select");if(o){Xi(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){Us(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(!r)return;r.parentElement?.style.setProperty("--cat",Ke(r.value));let l=Number(r.dataset.id);if(l){let b=r.value||null;Gt(L=>L.map(O=>O.id===l?{...O,assignee:b??void 0}:O),()=>$({id:l,assignee:b}),"Reassigning");return}M&&(M.assignee=r.value,et.setItem("nm-for",r.value),Wn(r.value),Ht())}),Y.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&M?.suggest){M.suggest.to=e.value,Ht(),bs(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(Po(n),n.classList.contains("dt-note-input")?M&&(M.text=n.value):n.classList.contains("dt-note-edit-input")?rt&&(rt.text=n.value):It=n.value,Ht(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),bs(n))}),Y.addEventListener("keydown",t=>{let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let n=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!n()&&Po(e);let o=n();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Oo(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())}),Y.addEventListener("click",async t=>{let e=t.target.closest("button");if(!e)return;let n=e.dataset.act,o=Number(e.dataset.id);if(n==="prio"){let a=e.dataset.v||null;o?Gt(r=>r.map(l=>l.id===o?{...l,priority:a??void 0}:l),()=>$({id:o,priority:a}),"Setting the priority"):M&&(M.priority=a??void 0,Ht(),U());return}if(n==="mention"){let a=e.closest(".dt-compose")?.querySelector("textarea");a&&Oo(a,e.dataset.handle);return}if(!n){if(st=st===o?null:o,st!=null&&e.dataset.off){let a=G.find(l=>l.id===o);(a&&ie(a))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}v(),U();return}if(n==="speak"){wi(e.closest(".dt-note"),e);return}if(n==="voice-write"){xi(e);return}if(n==="voice"||n==="voice-seek"){li(e,n==="voice-seek"?t:null);return}if(n==="attach"||n==="attach-file"){let a=Object.assign(document.createElement("input"),{type:"file",accept:n==="attach"?"image/*":"",multiple:!0}),r=e.closest(".dt-note");a.addEventListener("change",()=>{a.files?.length&&gs([...a.files],r)}),a.click();return}if(n==="unshot"){o?rt&&rt.drop.push(e.dataset.img):(e.closest("[data-draft]")?M?.images??[]:vt).splice(Number(e.dataset.i),1),U(),rt&&Ro();return}if(n==="edit"){let a=G.find(b=>b.id===o),r=e.dataset.at||null,l=r?a?.replies?.find(b=>b.at===r)?.text:a?.text;if(l===void 0)return;rt={id:o,at:r,text:l,drop:[]},U(),Ro();return}if(n==="edit-cancel"){rt=null,U();return}if(n==="translate"){io(o,e.dataset.at);return}if(n==="unsay"){let a=e.dataset.at;if(!confirm("Delete this reply?"))return;await Gt(r=>r.map(l=>l.id!==o?l:{...l,replies:(l.replies??[]).map(b=>b.at===a?{...b,text:"",deleted:!0}:b)}),()=>$({id:o,unsay:a}),"Deleting the reply");return}if(n==="edit-save"){let a=rt;if(!a)return;let r=a.text.trim();if(!r){Y.querySelector(".dt-note-edit-input")?.focus();return}rt=null;let l=b=>a.drop.includes(b.split("/").pop());await Gt(b=>b.map(L=>L.id!==a.id?L:{...L,...a.at==null?{text:r}:{replies:(L.replies??[]).map(O=>O.at===a.at?{...O,text:r}:O)},images:(L.images??[]).filter(O=>!l(O))}),()=>$({id:a.id,edit:{at:a.at,text:r},...a.drop.length?{removeImage:a.drop}:{}}).then(b=>(b.ok||(rt=a),b),b=>{throw rt=a,b}),"Saving the edit");return}if(n==="cancel"){v(),U();return}if(n==="twin"){v(),st=Number(e.dataset.id),U();return}if(n==="discard"){M=null,U();return}if(n==="draft-open"){is(Number(e.dataset.i));return}if(n==="close"){st=null,U();return}if(n==="where"){let a=G.find(L=>L.id===Number(e.dataset.id)),r=a&&jt(a)?.hidden;if(!r)return;let l=r.getBoundingClientRect();r.scrollIntoView({block:"nearest",behavior:"smooth"});let b=document.createElement("div");b.className="dt-where",b.style.cssText=`left:${l.left}px;top:${l.top}px;width:${l.width}px;height:${l.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(n==="unsuggest"&&M){M.suggest=null,U();return}if(n==="save"){if(!M)return;M.images&&(M.images=M.images.filter(K=>!K.startsWith(vn)));let a=M.suggest&&M.suggest.to.trim()!==M.suggest.from?{from:M.suggest.from,to:M.suggest.to.trim()}:null,r=Y.querySelector(".dt-note-input").value.trim()||(a?"Change the text":"")||(M.images?.some(Un)?ao:M.images?.some(K=>!nn(K))?"See the attached image":M.images?.length?"See the attached file":"");if(!r){Y.querySelector(".dt-note-input")?.focus();return}let l=M,b=s.client?null:Es(r,$e()),L=Bo.get(l)??ms(ie(l)),O={...l,route:S,text:r,suggest:a,assignee:s.client?Zs(l.assignee)||void 0:b??(l.assignee||void 0),shared:s.client?!0:l.shared===!0,stage:s.client?"new":b?"approved":l.stage??(xt(l.assignee)?"approved":"new"),breakpoint:On(),browser:Oa(),device:w?Do:"",viewport:{w:innerWidth,h:innerHeight},logs:va(),host:location.host},u={...l,id:-Date.now(),text:r,route:S,status:"open",note:"",doneBy:null,breakpoint:O.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...a?{suggest:a}:{},by:s.me?.email,byName:s.me?.name};G=[...G,u],M=null,U();let Z=await ts(Dt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(O)})).catch(()=>null);if(!Z?.ok){G=G.filter(K=>K!==u),v(),M=l,U(),Sn("Comment was not saved",Z);return}let D=$n([await Z.json().catch(()=>null)])[0];G=G.map(K=>K===u&&D?D:K),U(),D&&L.then(K=>{K&&$({id:D.id,before:K})}),Fe();return}if(n==="reply"){let a=Y.querySelector(".dt-note-reply-input");vt=vt.filter(K=>!K.startsWith(vn));let r=a.value.trim()||(vt.some(Un)?ao:vt.some(K=>!nn(K))?"See the attached image":vt.length?"See the attached file":"");if(!r){a.focus();return}let l=vt;It="",vt=[];let b=G,L=s.client?null:Es(r,$e()),O=G.find(K=>K.id===o),u=L&&O&&(L!==O.assignee||zt(O)!=="approved"||O.status==="done")?{assignee:L,stage:"approved",...O.status==="done"?{status:"open",doneBy:null}:{}}:{};G=G.map(K=>K.id===o?{...K,...u,replies:[...K.replies??[],{author:"you",text:r,at:new Date().toISOString(),by:s.me?.email}]}:K),U();let Z=await ts($({id:o,reply:r,images:l,...u})).catch(()=>null);if(!Z?.ok){G=b,It=r,vt=l,U(),Sn("Reply was not sent",Z);return}let D=$n([await Z.json().catch(()=>null)])[0];D&&(G=G.map(K=>K.id===D.id?D:K),U()),Fe();return}if(n==="hand"){Va(o,e.dataset.v);return}if(n==="sendback"){await Me(o,!1),Ln(".dt-note-reply-input");return}if(n==="accept"){Us(o,"accepted");return}if(n==="archive"||n==="unarchive"){n==="archive"&&!e.classList.contains("dt-step-act")&&(st=null),await ke(o,n==="archive");return}e.classList.contains("dt-step-act")||(st=null),n==="rm"?await ns(o):await Me(o,n==="done")});let Do="",_t=t=>{Rt.hidden||Pe.contentWindow?.postMessage({dt:!0,...t},location.origin)},Zi=()=>({notes:Mt,grid:!T.hidden,inspect:ht,resolved:Lt,archived:Zt,...Fo.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!w&&t.source===Pe.contentWindow){if(e.key){Uo(e.key[0],e.key[1])?.run();return}if(e.closeMenus){it();return}if(e.drafts){Zn=e.drafts,Je(we());return}}if(w&&typeof e.openDraft=="number"){is(e.openDraft);return}if(w&&typeof e.dropDraft=="number"){go(e.dropDraft);return}if(w&&typeof e.device=="string"&&(Do=e.device),w&&e.scrollbar&&At.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Pe.contentWindow){_t(Zi());return}typeof e.notes=="boolean"&&e.notes!==Mt&&ue(e.notes,!1),typeof e.open=="number"&&as(e.open),typeof e.grid=="boolean"&&e.grid===T.hidden&&X(e.grid),typeof e.inspect=="string"&&e.inspect!==ht&&B(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Lt&&ds(e.resolved),typeof e.archived=="boolean"&&e.archived!==Zt&&cs(e.archived),e.reload&&Se()});let Fe=async()=>{await Se(),_t({reload:!0}),w&&parent.postMessage({dt:!0,reload:!0},location.origin)},ue=(t,e=!0)=>{if(Mt=t,J.setAttribute("aria-pressed",String(t)),t?!w&&j.hidden&&et.getItem("dt-history")!=="0"&&(j.hidden=!1,R.setAttribute("aria-pressed","true")):(j.hidden=!0,R.setAttribute("aria-pressed","false")),F(Pt,t?"1":"0"),_t({notes:t}),w&&e&&parent.postMessage({dt:!0,notes:t},location.origin),Y.hidden=!t||!Rt.hidden,At.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){B(""),document.addEventListener("click",Co,!0);for(let n of To)document.addEventListener(n,Ao,!0);document.addEventListener("keydown",Lo),document.addEventListener("mousemove",So),addEventListener("scroll",le,!0),addEventListener("resize",le),addEventListener("pointerover",yo,!0),Cs(),fo.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),vo.observe(document.body),ps()}else{v(),st=null,document.removeEventListener("click",Co,!0);for(let n of To)document.removeEventListener(n,Ao,!0);document.removeEventListener("keydown",Lo),document.removeEventListener("mousemove",So),bt.hidden=!0,removeEventListener("scroll",le,!0),removeEventListener("resize",le),removeEventListener("pointerover",yo,!0),fo.disconnect(),vo.disconnect(),Y.innerHTML=""}},{pickBp:qo,...Fo}=ka({cfg:s,inFrame:w,persist:F,frame:Rt,frameEl:Pe,devicesMenu:gt,bpBtns:I,notesOverlay:Y,WIDE:p,bpOf:x,currentBp:On,deviceById:N,notesOn:()=>Mt,filter:()=>P,filterTo:t=>{P=t},dropFrameDrafts:()=>{Zn=[]},putAway:()=>{st=null,v()},tellFrame:_t,syncBpButtons:As,render:()=>U(),reread:()=>{Mt?ps():U()}}),jo="dt-studio",_o=t=>{V.setAttribute("aria-pressed",String(t)),At.toggle("dt-no-studio",!t),F(jo,t?"1":"0")};V.addEventListener("click",()=>_o(V.getAttribute("aria-pressed")!=="true")),_o(et.getItem(jo)!=="0"),J.addEventListener("click",()=>ue(!Mt));let pe=document.querySelector(".devtools"),je=document.querySelector(".dt-tab"),Wo=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-pe.getBoundingClientRect().top)+12}px`);new ResizeObserver(Wo).observe(pe),addEventListener("resize",Wo);let zo=t=>{pe.toggleAttribute("data-collapsed",t),je.toggleAttribute("data-collapsed",t),je.setAttribute("aria-expanded",String(!t)),je.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of pe.querySelectorAll(".dt-group"))e.inert=t;t&&it(),F("dt-collapsed",t?"1":"0")};je.addEventListener("click",()=>zo(!pe.hasAttribute("data-collapsed")));let de=document.querySelector(".dt-keys"),Vo=de.querySelector(".dt-set-keys"),fs=t=>{Vo.hidden=!t,de.querySelector(".dt-set-main").hidden=t};if(Wt.signOut)for(let t of de.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;de.querySelector("summary").addEventListener("click",()=>fs(!1)),de.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return fs(n==="keys");de.open=!1,n==="hide"&&je.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&Wt.signOut?.()});let se=t=>()=>pe.querySelector(t)?.click(),Ko=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},Tn=[{group:"Comments",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:se(".dt-notes-btn")},{group:"Comments",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Comments panel",el:".dt-history-btn",run:se(".dt-history-btn")},{group:"Comments",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:se(".dt-resolved-btn")},{group:"Comments",code:"KeyA",hint:"A",label:"Show archived",run:()=>cs(!Zt)},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:se(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:se(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:se(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:se(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:se(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:se(".dt-border-btn")},...s.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:se(".dt-studio-btn")}]:[],...I.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:()=>{gt.open=!gt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Ko(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Ko(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>je.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=de.open&&!Vo.hidden;de.open=!t,fs(!t)}}].filter(t=>!s.client||t.group!=="Inspect"),Uo=(t,e)=>Tn.find(n=>n.code===t&&!n.shift==!e),Qi=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(s.shortcuts){for(let e of Tn){let n=e.el&&pe.querySelector(e.el);n&&(n.dataset.tip=`${n.dataset.tip??e.label} \xB7 ${e.hint}`,n.setAttribute("aria-keyshortcuts",e.hint.startsWith("\u21E7")?`Shift+${e.hint.slice(1)}`:e.hint))}let t=(e,n)=>`<div class="dt-key-row"><span>${h(e)}</span><kbd>${h(n)}</kbd></div>`;if(de.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(Tn.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+Tn.filter(n=>n.group===e).map(n=>t(n.label,n.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||Qi(e.target))return;let n=Uo(e.code,e.shiftKey);n&&(e.preventDefault(),w?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):n.run())}),w){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n=>{n.key==="Escape"&&e()})}}if(!w){zo(et.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>pe.setAttribute("data-ready",""))),Fo.restore(),X(et.getItem(_)==="1");let t=et.getItem(nt);t&&t in Et&&B(t),ue(et.getItem(Pt)==="1")}let Go=()=>{try{let t=JSON.parse(et.getItem(lt)||"null");St=(t?.parked??[]).filter(e=>ye(e)),t?.draft&&document.querySelector(t.draft.selector)?(M=t.draft,!Mt&&!w&&ue(!0)):ye(t?.draft)&&St.push(t.draft),t?.reply?.text&&(It=t.reply.text,A=st=t.reply.for??null),(M||St.length||It)&&U()}catch{et.removeItem(lt)}};Go();let Yo=()=>setTimeout(()=>{let t=H(location.pathname);t!==S&&(clearTimeout(wt),Ut(),S=t,lt=ot(),M=null,St=[],It="",A=null,st=null,rt=null,G=[],dt(),Go(),ps(),Se())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),Yo()}}addEventListener("popstate",Yo),i.then(async t=>{t.status===200&&ko(await t.json())},()=>{}).then(()=>Lt?Se(!0):void 0).then(rs.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Ze()}),addEventListener("focus",Ze),addEventListener("notemend:changed",()=>{w||Ze()});let tr=0;w||setInterval(()=>{(!Wt.live||++tr%6===0)&&Ze()},2e4),w&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Ba(s){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,d=i.showModal,m=null,p=null,x=()=>{if(m){p?.disconnect(),p=null;for(let w of s)document.body.append(w);try{m.hidePopover()}catch{}m.remove(),m=null}},k=()=>{x();let w=document.querySelector("dialog:modal");w&&N(w)},N=w=>{x(),m=document.createElement("div"),m.className="dt-host",m.setAttribute("popover","manual"),m.append(...s),w.append(m);try{m.showPopover()}catch{}w.addEventListener("close",k,{once:!0}),p=new MutationObserver(()=>{w.isConnected||k()}),p.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){d.call(this),this.isConnected&&N(this)}}function Na(){let s=window;if(s.__notemend)return;s.__notemend=!0,fa(d=>d.includes("/__devbar/")||!!Wt.base&&d.startsWith(Wt.base)),At.ready=new Promise(d=>{if(!("__next_f"in self))return d();let m=0,p=()=>Object.keys(document.documentElement).some(x=>x.startsWith("__reactFiber$"))||++m>330?d():setTimeout(p,30);p()}),At.toggle("dt-in-frame",Cn);let i=Dt("comments?open=1");na().then(d=>{At.set("--dt-z",String(d.zIndex));let m=d.brand?.color;if(m&&/^#[0-9a-f]{6}$/i.test(m)){let[p,x,k]=[1,3,5].map(N=>parseInt(m.slice(N,N+2),16)/255);At.set("--dt-accent",m),At.set("--dt-accent-ink",.2126*p+.7152*x+.0722*k>.55?"#000000":"#ffffff")}pa(d),Ha(d,i),Ba([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab"].map(p=>document.querySelector(p)).filter(p=>!!p))}).catch(d=>console.warn("[notemend] not started:",d))}Na();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
271
+ ${vo("dt-note-input",M.suggest?"Why (optional)":"Comment",M.text??"",'data-act="save"',go(M.images))}
272
+ ${oo(M.priority,M.category,void 0,M.assignee??"")}
273
+ </div>`}let l=new Map([...U.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}])),g=new Set([...U.querySelectorAll("[data-msg]")].map(u=>u.dataset.msg)),S=U.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");U.innerHTML=o,S&&An(".dt-note-reply-input");for(let u of U.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let Z=u.closest(".dt-note").dataset.id,D=l.get(Z);if(!D)continue;let K=[...u.querySelectorAll("[data-msg]")].filter(Et=>!g.has(Et.dataset.msg));for(let Et of K)Et.classList.add("dt-msg--new");u.scrollTop=D.end&&K.length?u.scrollHeight:D.top}for(let u of U.querySelectorAll(".dt-note")){let Z=u.getBoundingClientRect();Z.bottom>innerHeight-8&&(u.dataset.flip="1"),Z.right>innerWidth-8&&(u.dataset.flipx="1")}Qe(n),jn(_n()),se();for(let u of U.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))vs(u);let P=U.querySelector(".dt-note-input");P&&(P.focus(),P.setSelectionRange(P.value.length,P.value.length))},zi=()=>{let t=!1,e=[];for(let n of U.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(n.classList.contains("dt-note--orphan")||n.classList.contains("is-dragging"))continue;let o=Y.find(r=>r.id===Number(n.dataset.id)),a=o&&zt(o);e.push([n,a]),a&&js(a.el)&&(t=!0)}for(let n of U.querySelectorAll("[data-draft], [data-parked]")){if(n.classList.contains("dt-note--orphan"))continue;let o=n.dataset.parked?St[Number(n.dataset.parked)]:M;e.push([n,o?zt(o):null])}for(let[n,o]of e){if(!o){n.style.visibility="hidden";continue}n.style.visibility="",n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.matches(".dt-pin[data-id]")&&(o.off?n.dataset.off=o.off:delete n.dataset.off,n.classList.toggle("dt-pin--hidden",!!o.hidden)),n.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!pn.length&&(M||st!=null)){let n=_n();n&&js(n)&&jn(n)}Ue(M||st!=null?_n():null),t&&se()},Qe=t=>{if(!j.hidden&&(j.innerHTML=_a({bp:t,notes:Y,breakpoints:d,bandOfNote:k,orphan:e=>!zt(e),hiddenNow:e=>!!zt(e)?.hidden,whoseAgent:Ee,statusTools:e=>xo(e,!Js(e)),showResolved:Tt,showArchived:Qt,archived:te,drafts:It.hidden?yo():es,checks:w?0:ds.toCheck().length,marker:Ki,assign:Js,find:Ft,forMe:Vi,forAgent:e=>!!Zt(e)&&pt(e)!=="done",unread:Xs}),Fe)){let e=j.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Fe.at,Fe.at),Fe=null}},Fe=null,Vi=t=>{if(pt(t)==="done"||!s.me)return!1;if(t.assignee===s.me.email||pt(t)==="claude"||_t(t)==="review"&&t.assignee!==s.me.email)return!0;let e=(s.me.name||s.me.email).split(/[\s@]/)[0].toLowerCase();return He(t).some(n=>n.text.toLowerCase().includes("@"+e))},Ki=t=>{if(pt(t)==="done")return'<span class="dt-hist-n"></span>';let n=Un[Zt(t)??""];if(n)return`<span class="dt-hist-face dt-hist-face--agent" style="--step-c:${n}">${Gt(10)}</span>`;let o=Us(t);return o?`<span class="dt-hist-face" style="--ring:${Yn.find(a=>a[0]===mn(t))[2]};--hue:${Gs(t.by||t.byName||"")}">${o}</span>`:`<span class="dt-hist-n" style="--cat:${Re(t.category).color}"></span>`},is=t=>j.toggleAttribute("data-collapsed",t);j.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(Ft.q=e.value,Fe={at:e.selectionStart??e.value.length},Qe($e()))}),j.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await en(),setTimeout(()=>delete e.dataset.spin,500);return}if(j.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){is(!1);return}if(t.target.closest("[data-fold]")){is(!j.hasAttribute("data-collapsed"));return}let n=t.target.closest(".dt-hist-bands [data-bp]");if(n){Qo(n.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?(Ft.view=o.dataset.histView,F("dt-view",Ft.view),Ft.menu=!1):o.dataset.histSort?(Ft.sort=o.dataset.histSort,F("dt-sort",Ft.sort),Ft.menu=!1):o.hasAttribute("data-hist-clear")?(Ft.q="",Fe={at:0}):Ft.menu=!Ft.menu,Qe($e());return}Ft.menu&&!t.target.closest(".dt-hist-menu")&&(Ft.menu=!1,Qe($e()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let D=a.dataset.draftRm!==void 0,K=Number(D?a.dataset.draftRm:a.dataset.draftGo);It.hidden?D?ko(K):ls(K):Kt(D?{dropDraft:K}:{openDraft:K});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await ke(Number(r.dataset.unmark),!1);return}let l=t.target.closest(".dt-hist-tools [data-act]");if(l){await ke(Number(l.dataset.id),l.dataset.act==="done");return}let g=t.target.closest("[data-rm]");if(g){st=null,await os(Number(g.dataset.rm));return}if(t.target.closest("[data-review]")){ds.start();return}if(t.target.closest("[data-resolved]")){us(!Tt);return}if(t.target.closest("[data-archived]")){ps(!Qt);return}let S=t.target.closest("[data-archive-all]");if(S){let D=S.dataset.archiveAll.split(",").map(Number);for(let K of D)await Le(K,!0,!0);xn(`Archived ${D.length}`,()=>{for(let K of D)Le(K,!1,!0)});return}let P=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(P){await Le(Number(P.dataset.id),P.dataset.act==="archive");return}let u=t.target.closest("[data-go]");if(!u)return;let Z=Number(u.dataset.go);if(!It.hidden){Kt({open:Z});return}rs(Z)});let rs=t=>{st=t,v(),G();let e=Y.find(o=>o.id===t),n=e&&zt(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&ee(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||U.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},ls=t=>{let[e]=St.splice(t,1);if(!e)return;v(),M=e,st=null;let n=zt(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),G()},ko=t=>{St.splice(t,1),G()},ds=Wa({inFrame:w,everything:()=>oe,route:()=>L,settle:ke,keepIn:ve,toast:t=>Ae(t),waits:t=>pt(t)==="claude"||pt(t)==="done"&&!te(t),approve:t=>pt(t)==="claude"?ke(t.id,!0):Le(t.id,!0,!0),open:t=>{if(kt||pe(!0),k(t)!==$e()){Qo(k(t));for(let e of[600,1500])setTimeout(()=>Kt({open:t.id}),e)}else rs(t.id)}}),Ui=t=>{j.hidden=!t,R.setAttribute("aria-pressed",String(t)),F("dt-history",t?"1":"0"),G()},cs=document.querySelector(".dt-resolved-btn"),us=t=>{Tt=t,cs.setAttribute("aria-pressed",String(t)),F("dt-resolved",t?"1":"0"),Kt({resolved:t}),G(),Te(!0)},ps=t=>{Qt=t,F("dt-archived",t?"1":"0"),Kt({archived:t}),G(),Te(!0)};cs.addEventListener("click",()=>us(!Tt)),cs.setAttribute("aria-pressed",String(Tt)),R.addEventListener("click",()=>{let t=j.hidden===!0;t&&!kt&&pe(!0),t&&is(!1),Ui(t)});let se=()=>{ye||!kt||(ye=requestAnimationFrame(()=>{ye=0,zi()}))},Lo=`${fe}, .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`,Gi=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Lo))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(o=>o instanceof Element&&o.matches(Lo))},So=new MutationObserver(t=>{t.every(Gi)||(Fs(),se())}),To=new ResizeObserver(()=>se()),Ao=()=>{U.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&se()},oe=[],Co=()=>{},En=new Set,Yi=t=>{oe=t,queueMicrotask(()=>Co());let e=()=>({new:0,progress:0,review:0,waiting:0,accepted:0,done:0}),n={};for(let g of t){if(te(g))continue;let S=pt(g),P=Zt(g),u=S==="done"?"done":S==="claude"?"review":P&&gn[P]||mn(g),Z=n[g.route??""]??={...e(),bands:{}};Z[u]++;let D=k(g);(Z.bands[D]??=e())[u]++}let o=["new","progress","review","waiting","accepted","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",accepted:"accepted",done:"resolved"},r=g=>o.map(S=>[S,S==="done"&&!Tt?0:g[S]]),l=g=>r(g).reduce((S,[,P])=>S+P,0);for(let g of document.querySelectorAll(".dt-pages a")){let S=g.querySelector(".dt-pages-n");if(!S)continue;let P=n[new URL(g.href).pathname.replace(/\/+$/,"")||"/"];for(let D of d){let K=P?.bands[D.id];for(let[Et,re]of r(K??e())){let le=S.querySelector(`[data-bp="${D.id}"][data-state="${Et}"]`);le.hidden=!re,re&&(le.querySelector("i").textContent=String(re),le.title=`${D.label}: ${re} ${a[Et]}`)}}let u=P?l(P):0;S.hidden=!u;let Z=P?d.filter(D=>P.bands[D.id]&&l(P.bands[D.id])).map(D=>`${D.label} ${l(P.bands[D.id])}`).join(" \xB7 "):"";S.title=u?`${o.filter(D=>P[D]).map(D=>`${P[D]} ${a[D]}`).join(" \xB7 ")}
274
+ ${Z}`:""}},Mn=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(n=>typeof n?.text=="string"):[],images:Array.isArray(e.images)?e.images.filter(n=>typeof n=="string"):[]})),Xi=za(w,t=>Ae(t)),jt=document.querySelector(".dt-push"),Jt=jt.querySelector(".dt-push-menu"),ae=new Set,je=new Set,Ho=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",kn=()=>s.client||Me()||w?[]:oe.filter(t=>t.status!=="done"&&$t(t.assignee)&&_t(t)==="approved"&&!Ke(t)&&!te(t)&&!En.has(t.id)),Ln=()=>kn().filter(t=>!ae.has(t.id)),Bo=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?Wt:""}</i>`,No=()=>{let t=kn(),e=[...new Set(t.map(o=>o.route??"/"))],n=Ln().length;Jt.innerHTML=`<div class="dt-push-head">${Gt(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),r=a.filter(l=>!ae.has(l.id)).length;return`<button type="button" class="dt-push-page${je.has(o)?" is-open":""}" data-push-route="${h(o)}"><span data-push-fold="${h(o)}">${je.has(o)?"\u25BE":"\u25B8"}</span>${Bo(r>0,r>0&&r<a.length)}<span class="dt-push-route">${h(o)}</span><em>${a.length}</em></button>`+(je.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Bo(!ae.has(l.id))}<span><small>#${l.id}</small>${h(l.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>${Gt(13)}Send ${n} to Claude</button>`},Se=()=>{let t=kn(),e=Ho();jt.hidden=!t.length||e==="on",jt.classList.toggle("is-live",e==="paused");let n=Ln().length;jt.querySelector(".dt-push-n").textContent=String(n),jt.querySelector(".dt-push-all").dataset.tip=e==="paused"?`${n} ${n===1?"comment waits":"comments wait"} for Claude \u2014 send ${n===1?"it":"them all"}`:`Claude Code isn\u2019t listening \u2014 run /notemend:turbo, then Push sends ${n===1?"it":`these ${n}`}`,document.querySelector(".devtools")?.style.setProperty("--dt-push-w",jt.hidden?"0px":`${jt.offsetWidth+8}px`),jt.hidden&&(Jt.hidden=!0),Jt.hidden||No()},Ro=async t=>{if(!t.length)return;if(Ho()==="none"){await navigator.clipboard?.writeText("/notemend:turbo").catch(()=>{}),Ae("Copied /notemend:turbo \u2014 run it in Claude Code, then Push sends them");return}Jt.hidden=!0,jt.querySelector(".dt-push-pick").setAttribute("aria-expanded","false");let e=t.map(o=>o.id),n=await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!n?.ok){Tn("Could not send them to Claude",n);return}for(let o of e)En.add(o);Se(),xn(`${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)En.delete(o);Se()}),en()};jt.querySelector(".dt-push-all").addEventListener("click",()=>Ro(Ln())),jt.querySelector(".dt-push-pick").addEventListener("click",t=>{Jt.hidden=!Jt.hidden,t.currentTarget.setAttribute("aria-expanded",String(!Jt.hidden)),Jt.hidden||No()}),Jt.addEventListener("click",t=>{let e=t.target,n=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"){Ro(Ln());return}if(r==="all")ae.clear();else if(n){let l=n.dataset.pushFold;je.has(l)?je.delete(l):je.add(l)}else if(o){let l=kn().filter(S=>(S.route??"/")===o.dataset.pushRoute),g=l.some(S=>!ae.has(S.id));for(let S of l)g?ae.add(S.id):ae.delete(S.id)}else if(a){let l=Number(a.dataset.pushId);ae.has(l)?ae.delete(l):ae.add(l)}Se()}),document.addEventListener("pointerdown",t=>{!Jt.hidden&&!jt.contains(t.target)&&(Jt.hidden=!0,jt.querySelector(".dt-push-pick").setAttribute("aria-expanded","false"))},!0),setInterval(Se,3e4),Co=Se;let Po=document.querySelector(".dt-turbo");Po&&new MutationObserver(Se).observe(Po,{attributes:!0,attributeFilter:["data-state"]}),Se();let Sn="",hs=!1,Oo=t=>{Sn=t.version??"",Xi(t),En=new Set(t.turbo?.push?.ids??[]);let e=Mn(t.comments);Yi(e);let n=e.filter(o=>o.route===L);if(JSON.stringify(n)===JSON.stringify(Y)){!j.hidden&&!w&&G();return}if(U.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){Sn="",setTimeout(tn,5e3);return}Y=n,G(),Kt({reload:!0})},Te=async(t=!1)=>{let e=[t||!Sn?"":`since=${Sn}`,Tt||Qt?"":"open=1"].filter(Boolean).join("&");try{let n=await Ct(`comments${e?`?${e}`:""}`);n.status===200&&Oo(await n.json())}catch{}},tn=async()=>{document.hidden||hs||ns||(hs=!0,await Te(),hs=!1)},ms=()=>{Y=oe.filter(t=>t.route===L),G()},gs=0,Io=t=>{gs||(gs=requestAnimationFrame(()=>{gs=0;let e=t.target;if(!kt||e.closest(yt)){ft.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(ft.hidden=!1,!n)return;let o=n.getBoundingClientRect();Ot.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Nt.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Nt.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},Do=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),lt){lt=null,G();return}if(M){v(),G();return}if(st!==null){st=null,G();return}pe(!1)}},qo=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Fo=t=>{t.target.closest?.(yt)||t.stopPropagation()},jo=t=>{if(t.target.closest(yt))return;if(t.preventDefault(),t.stopPropagation(),Q){Q=!1;return}if(!getSelection()?.isCollapsed)return;U.hidden=!0;let n=document.elementFromPoint(t.clientX,t.clientY);if(U.hidden=!1,!n)return;v();let o=n.getBoundingClientRect(),a=n.tagName.toLowerCase(),r=[...n.classList].filter(g=>!/^(astro|svelte|css)-/.test(g)).slice(0,2);M={selector:Is(n),tag:a,classes:r,nth:Ds({tag:a,classes:r}).indexOf(n),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Bt(n.textContent||"").slice(0,60),ctx:qs(n),category:m[0].id};let l=s.client||Me()?null:Kn();l&&(M.assignee=l,M.stage=$t(l)?"approved":"new"),Wo.set(M,nr().then(()=>bs(n))),st=null,ft.hidden=!0,G()},Ji=2200,Zi=900*1024,_o=8*1024*1024,Qi=3*1024*1024,tr=1200,er=1600,bs=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 n=e?.getBoundingClientRect();if(!e||!n?.width||!n.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,l]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*l>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,tr/n.width,er/n.height),l=await Promise.race([a(e,{scale:r,quality:.8,timeout:4e3,backgroundColor:o,filter:g=>!(g instanceof Element&&g.closest(fe))}),new Promise(g=>setTimeout(()=>g(null),8e3))]);return l&&l.length<_o?l:null}catch{return null}},Wo=new WeakMap,nr=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Ae=(t,e=2800)=>{let n=document.createElement("div");n.className="dt-toast",n.textContent=t,document.body.append(n),setTimeout(()=>n.remove(),e)},Tn=(t,e)=>Ae(navigator.onLine?`${t}${e?` (${e.status})`:""}.`:`${t} \u2014 you are offline. Try again once you are back online.`,6e3),sr=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),or=async t=>{let e=await createImageBitmap(t),n=Math.min(1,Ji/Math.max(e.width,e.height));if(n===1&&t.size<=Zi)return e.close(),sr(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*n),o.height=Math.round(e.height*n),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},fs=async(t,e)=>{let n=[],o=(a,r)=>n.push(`${yn}${a}\0${r}`);for(let a of t){let r,l=wa(a.name)||Object.keys(on).find(g=>on[g]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,Ls.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>Qi){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 3 MB from the bar`);continue}let g=await new Promise((S,P)=>{let u=new FileReader;u.onload=()=>S(String(u.result).split(",")[1]),u.onerror=P,u.readAsDataURL(a)}).catch(()=>"");g?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${ya(a.name)||"file"};ext=${l};base64,${g}`):o(a.name,"Could not be read");continue}try{r=await or(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>_o){o(a.name,"Too large even after shrinking");continue}n.push(r)}if(n.length){if(!Number(e?.dataset.id)){M&&((M.images??=[]).push(...n),G());return}wt.push(...n),G(),An(".dt-note-reply-input")}},zo=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);U.addEventListener("paste",t=>{let e=zo(t.clipboardData?.items);e.length&&(t.preventDefault(),fs(e,t.target.closest(".dt-note")))}),U.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),U.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),U.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=zo(t.dataTransfer?.items);n.length&&fs(n,e)});let An=t=>{let e=U.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},Vo=()=>{An(".dt-note-edit-input"),U.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},vs=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden"},ar=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),ir=()=>s.client||Me()?[]:On(),Ko=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let n=ar(t);if(!n)return;let o=n[1].toLowerCase(),a=(s.team??[]).filter(l=>[l.name,l.nickname,l.email].some(g=>g?.toLowerCase().startsWith(o))).slice(0,5),r=ir().filter(l=>l.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!a.length&&!r.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="${h($a(l))}">${hn(l.avatar_url,l.name||l.email)}<span class="dt-mention-who"><b>${h(l.name||l.email)}</b>${l.name?`<span>${h(l.email)}</span>`:""}</span></button>`),...r.map(l=>`<button type="button" role="option" data-act="mention" data-handle="${h(l.handle)}">${ai(l.owner)}<span class="dt-mention-who"><b>${h(l.handle)}</b><span>${l.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((l,g)=>l.replace('role="option"',`role="option" aria-selected="${g===0}"`)).join("")}</div>`)},Uo=t=>{let e=[...(s.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...On().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>h(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=h(t);return e.length?n.replace(new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"),o=>`<span class="dt-at">${o}</span>`):n},Go=(t,e)=>{let n=t.selectionStart??t.value.length,o=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(n)}`,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()},rr=(t,e)=>{if(!t){M&&(M.category=e),G();return}Vt(n=>n.map(o=>o.id===t?{...o,category:e}:o),()=>$({id:t,category:e}),"Changing the type")};Oa([U,j],h,Wt),j.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&Vn(Number(e.dataset.id),e.value)}),j.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let n=e.dataset.v;Vn(Number(e.dataset.id),n==="agent"?Wn:n==="person"?zn():"")},!0);let lr=(t,e)=>{t?Vt(n=>n.map(o=>o.id===t?{...o,shared:e||void 0}:o),()=>$({id:t,shared:e}),e?"Sharing with the client":"Keeping it to the team"):M&&(M.shared=e||void 0,Rt(),G())};U.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let g=e.value,S=Number(e.dataset.id)||0;e.value="",g==="team"||g==="client"?lr(S,g==="client"):g==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(st=null,os(S)):g==="discard"&&(M=null,G());return}let n=t.target.closest(".dt-lang-select");if(n){fo(Number(n.dataset.id),n.dataset.at,n.value);return}let o=t.target.closest(".dt-cat-select");if(o){rr(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){so(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(!r)return;r.parentElement?.style.setProperty("--cat",Ge(r.value));let l=Number(r.dataset.id);if(l){let g=r.value||null;Vt(S=>S.map(P=>P.id===l?{...P,assignee:g??void 0}:P),()=>$({id:l,assignee:g}),"Reassigning");return}M&&(M.assignee=r.value,et.setItem("nm-for",r.value),Kn(r.value),Rt())}),U.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&M?.suggest){M.suggest.to=e.value,Rt(),vs(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(Ko(n),n.classList.contains("dt-note-input")?M&&(M.text=n.value):n.classList.contains("dt-note-edit-input")?lt&&(lt.text=n.value):qt=n.value,Rt(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),vs(n))}),U.addEventListener("keydown",t=>{let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let n=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!n()&&Ko(e);let o=n();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Go(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,Cn=!1;function ys(t){return!s.client||!!s.me&&t.by===s.me.email}let Yo=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},ws=Yo("dt-drag-box--home"),Xo=Yo("dt-drag-box--to"),$s=t=>{let e=Bt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Jo=(t,e,n="")=>{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=n,t.hidden=!1},dr=(t,e)=>document.elementsFromPoint(t,e).find(n=>!n.closest(yt)&&!n.closest(".dt-drag-box")&&n!==document.documentElement&&n!==document.body)??null,cr=(t,e,n)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&n>=o.top&&n<=o.bottom},ur=(t,e,n)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:Is(t),tag:a,classes:r,nth:Ds({tag:a,classes:r}).indexOf(t),label:Bt(t.textContent||"").slice(0,60),ctx:qs(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,(n-o.top)/o.height)):.5}},xs=()=>{rt&&(rt.pin.classList.remove("is-dragging"),ws.hidden=Xo.hidden=!0,rt=null,se())};U.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let n=Y.find(o=>o.id===Number(e.dataset.id));!n||!ys(n)||(rt={id:n.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:ee(n),to:null},e.setPointerCapture(t.pointerId))}),U.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&&cr(rt.home,t.clientX,t.clientY)?rt.home:dr(t.clientX,t.clientY);let e=rt.to&&rt.to!==rt.home;Jo(ws,rt.home,e?"":rt.home?$s(rt.home):""),ws.classList.toggle("is-left",!!e),Jo(Xo,e?rt.to:null,e?`Move to ${$s(rt.to)}`:"")}),U.addEventListener("pointerup",async t=>{if(!rt)return;let e=rt;if(!e.on||!e.to){xs();return}Cn=!0,setTimeout(()=>{Cn=!1},0);let n=Y.find(g=>g.id===e.id),o=ur(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(xs(),!n)return;let r={selector:n.selector,tag:n.tag,classes:n.classes,nth:n.nth,label:n.label,ctx:n.ctx,rx:n.rx,ry:n.ry},l=(g,S)=>Vt(P=>P.map(u=>u.id===e.id?{...u,...g}:u),()=>$({id:e.id,move:g}),S);await l(o,"Moving the pin"),a&&xn(`Moved to ${$s(e.to)}`,()=>l(r,"Putting the pin back"))}),U.addEventListener("click",t=>{Cn&&(t.stopImmediatePropagation(),t.preventDefault(),Cn=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&rt?.on&&(t.stopImmediatePropagation(),xs())},!0),U.addEventListener("click",async t=>{let e=t.target.closest("button");if(!e)return;let n=e.dataset.act,o=Number(e.dataset.id);if(n==="prio"){let a=e.dataset.v||null;o?Vt(r=>r.map(l=>l.id===o?{...l,priority:a??void 0}:l),()=>$({id:o,priority:a}),"Setting the priority"):M&&(M.priority=a??void 0,Rt(),G());return}if(n==="mention"){let a=e.closest(".dt-compose")?.querySelector("textarea");a&&Go(a,e.dataset.handle);return}if(!n){if(st=st===o?null:o,st!=null&&e.dataset.off){let a=Y.find(l=>l.id===o);(a&&ee(a))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}v(),G();return}if(n==="speak"){Hi(e.closest(".dt-note"),e);return}if(n==="voice-write"){Ni(e);return}if(n==="voice"||n==="voice-seek"){yi(e,n==="voice-seek"?t:null);return}if(n==="attach"||n==="attach-file"){let a=Object.assign(document.createElement("input"),{type:"file",accept:n==="attach"?"image/*":"",multiple:!0}),r=e.closest(".dt-note");a.addEventListener("change",()=>{a.files?.length&&fs([...a.files],r)}),a.click();return}if(n==="unshot"){o?lt&&lt.drop.push(e.dataset.img):(e.closest("[data-draft]")?M?.images??[]:wt).splice(Number(e.dataset.i),1),G(),lt&&Vo();return}if(n==="edit"){let a=Y.find(g=>g.id===o),r=e.dataset.at||null,l=r?a?.replies?.find(g=>g.at===r)?.text:a?.text;if(l===void 0)return;lt={id:o,at:r,text:l,drop:[]},G(),Vo();return}if(n==="edit-cancel"){lt=null,G();return}if(n==="translate"){fo(o,e.dataset.at);return}if(n==="unsay"){let a=e.dataset.at;if(!confirm("Delete this reply?"))return;await Vt(r=>r.map(l=>l.id!==o?l:{...l,replies:(l.replies??[]).map(g=>g.at===a?{...g,text:"",deleted:!0}:g)}),()=>$({id:o,unsay:a}),"Deleting the reply");return}if(n==="edit-save"){let a=lt;if(!a)return;let r=a.text.trim();if(!r){U.querySelector(".dt-note-edit-input")?.focus();return}lt=null;let l=g=>a.drop.includes(g.split("/").pop());await Vt(g=>g.map(S=>S.id!==a.id?S:{...S,...a.at==null?{text:r}:{replies:(S.replies??[]).map(P=>P.at===a.at?{...P,text:r}:P)},images:(S.images??[]).filter(P=>!l(P))}),()=>$({id:a.id,edit:{at:a.at,text:r},...a.drop.length?{removeImage:a.drop}:{}}).then(g=>(g.ok||(lt=a),g),g=>{throw lt=a,g}),"Saving the edit");return}if(n==="cancel"){v(),G();return}if(n==="twin"){v(),st=Number(e.dataset.id),G();return}if(n==="discard"){M=null,G();return}if(n==="draft-open"){ls(Number(e.dataset.i));return}if(n==="close"){st=null,G();return}if(n==="where"){let a=Y.find(S=>S.id===Number(e.dataset.id)),r=a&&zt(a)?.hidden;if(!r)return;let l=r.getBoundingClientRect();r.scrollIntoView({block:"nearest",behavior:"smooth"});let g=document.createElement("div");g.className="dt-where",g.style.cssText=`left:${l.left}px;top:${l.top}px;width:${l.width}px;height:${l.height}px`,document.body.append(g),g.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>g.remove());return}if(n==="unsuggest"&&M){M.suggest=null,G();return}if(n==="save"){if(!M)return;M.images&&(M.images=M.images.filter(K=>!K.startsWith(yn)));let a=M.suggest&&M.suggest.to.trim()!==M.suggest.from?{from:M.suggest.from,to:M.suggest.to.trim()}:null,r=U.querySelector(".dt-note-input").value.trim()||(a?"Change the text":"")||(M.images?.some(Xn)?bo:M.images?.some(K=>!an(K))?"See the attached image":M.images?.length?"See the attached file":"");if(!r){U.querySelector(".dt-note-input")?.focus();return}let l=M,g=s.client?null:As(r,xe()),S=Wo.get(l)??bs(ee(l)),P={...l,route:L,text:r,suggest:a,assignee:s.client?lo(l.assignee)||void 0:g??(l.assignee||void 0),shared:s.client?!0:l.shared===!0,stage:s.client?"new":g?"approved":l.stage??($t(l.assignee)?"approved":"new"),breakpoint:qn(),browser:Ja(),device:w?Zo:"",viewport:{w:innerWidth,h:innerHeight},logs:Ba(),host:location.host},u={...l,id:-Date.now(),text:r,route:L,status:"open",note:"",doneBy:null,breakpoint:P.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...a?{suggest:a}:{},by:s.me?.email,byName:s.me?.name};Y=[...Y,u],M=null,G();let Z=await ss(Ct("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(P)})).catch(()=>null);if(!Z?.ok){Y=Y.filter(K=>K!==u),v(),M=l,G(),Tn("Comment was not saved",Z);return}let D=Mn([await Z.json().catch(()=>null)])[0];Y=Y.map(K=>K===u&&D?D:K),G(),D&&S.then(K=>{K&&$({id:D.id,before:K})}),en();return}if(n==="reply"){let a=U.querySelector(".dt-note-reply-input");wt=wt.filter(K=>!K.startsWith(yn));let r=a.value.trim()||(wt.some(Xn)?bo:wt.some(K=>!an(K))?"See the attached image":wt.length?"See the attached file":"");if(!r){a.focus();return}let l=wt;qt="",wt=[];let g=Y,S=s.client?null:As(r,xe()),P=Y.find(K=>K.id===o),u=S&&P&&(S!==P.assignee||_t(P)!=="approved"||P.status==="done")?{assignee:S,stage:"approved",...P.status==="done"?{status:"open",doneBy:null}:{}}:{};Y=Y.map(K=>K.id===o?{...K,...u,replies:[...K.replies??[],{author:"you",text:r,at:new Date().toISOString(),by:s.me?.email}]}:K),G();let Z=await ss($({id:o,reply:r,images:l,...u})).catch(()=>null);if(!Z?.ok){Y=g,qt=r,wt=l,G(),Tn("Reply was not sent",Z);return}let D=Mn([await Z.json().catch(()=>null)])[0];D&&(Y=Y.map(K=>K.id===D.id?D:K),G()),en();return}if(n==="hand"){ni(o,e.dataset.v);return}if(n==="sendback"){await ke(o,!1),An(".dt-note-reply-input");return}if(n==="accept"){so(o,"accepted");return}if(n==="archive"||n==="unarchive"){n==="archive"&&!e.classList.contains("dt-step-act")&&(st=null),await Le(o,n==="archive");return}e.classList.contains("dt-step-act")||(st=null),n==="rm"?await os(o):await ke(o,n==="done")});let Zo="",Kt=t=>{It.hidden||De.contentWindow?.postMessage({dt:!0,...t},location.origin)},pr=()=>({notes:kt,grid:!T.hidden,inspect:mt,resolved:Tt,archived:Qt,...ta.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!w&&t.source===De.contentWindow){if(e.key){ra(e.key[0],e.key[1])?.run();return}if(e.closeMenus){it();return}if(e.drafts){es=e.drafts,Qe($e());return}}if(w&&typeof e.openDraft=="number"){ls(e.openDraft);return}if(w&&typeof e.dropDraft=="number"){ko(e.dropDraft);return}if(w&&typeof e.device=="string"&&(Zo=e.device),w&&e.scrollbar&&Ht.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===De.contentWindow){Kt(pr());return}typeof e.notes=="boolean"&&e.notes!==kt&&pe(e.notes,!1),typeof e.open=="number"&&rs(e.open),typeof e.grid=="boolean"&&e.grid===T.hidden&&X(e.grid),typeof e.inspect=="string"&&e.inspect!==mt&&B(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Tt&&us(e.resolved),typeof e.archived=="boolean"&&e.archived!==Qt&&ps(e.archived),e.reload&&Te()});let en=async()=>{await Te(),Kt({reload:!0}),w&&parent.postMessage({dt:!0,reload:!0},location.origin)},pe=(t,e=!0)=>{if(kt=t,J.setAttribute("aria-pressed",String(t)),t?!w&&j.hidden&&et.getItem("dt-history")!=="0"&&(j.hidden=!1,R.setAttribute("aria-pressed","true")):(j.hidden=!0,R.setAttribute("aria-pressed","false")),F(Dt,t?"1":"0"),Kt({notes:t}),w&&e&&parent.postMessage({dt:!0,notes:t},location.origin),U.hidden=!t||!It.hidden,Ht.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){B(""),document.addEventListener("click",jo,!0);for(let n of qo)document.addEventListener(n,Fo,!0);document.addEventListener("keydown",Do),document.addEventListener("mousemove",Io),addEventListener("scroll",se,!0),addEventListener("resize",se),addEventListener("pointerover",Ao,!0),Fs(),So.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),To.observe(document.body),ms()}else{v(),st=null,document.removeEventListener("click",jo,!0);for(let n of qo)document.removeEventListener(n,Fo,!0);document.removeEventListener("keydown",Do),document.removeEventListener("mousemove",Io),ft.hidden=!0,removeEventListener("scroll",se,!0),removeEventListener("resize",se),removeEventListener("pointerover",Ao,!0),So.disconnect(),To.disconnect(),U.innerHTML=""}},{pickBp:Qo,...ta}=qa({cfg:s,inFrame:w,persist:F,frame:It,frameEl:De,devicesMenu:bt,bpBtns:I,notesOverlay:U,WIDE:p,bpOf:x,currentBp:qn,deviceById:N,notesOn:()=>kt,filter:()=>O,filterTo:t=>{O=t},dropFrameDrafts:()=>{es=[]},putAway:()=>{st=null,v()},tellFrame:Kt,syncBpButtons:Os,render:()=>G(),reread:()=>{kt?ms():G()}}),ea="dt-studio",na=t=>{V.setAttribute("aria-pressed",String(t)),Ht.toggle("dt-no-studio",!t),F(ea,t?"1":"0")};V.addEventListener("click",()=>na(V.getAttribute("aria-pressed")!=="true")),na(et.getItem(ea)!=="0"),J.addEventListener("click",()=>pe(!kt));let he=document.querySelector(".devtools"),_e=document.querySelector(".dt-tab"),sa=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-he.getBoundingClientRect().top)+12}px`);new ResizeObserver(sa).observe(he),addEventListener("resize",sa);let oa=t=>{he.toggleAttribute("data-collapsed",t),_e.toggleAttribute("data-collapsed",t),_e.setAttribute("aria-expanded",String(!t)),_e.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of he.querySelectorAll(".dt-group"))e.inert=t;t&&it(),F("dt-collapsed",t?"1":"0")};_e.addEventListener("click",()=>oa(!he.hasAttribute("data-collapsed")));let ce=document.querySelector(".dt-keys"),aa=ce.querySelector(".dt-set-keys"),Es=t=>{aa.hidden=!t,ce.querySelector(".dt-set-main").hidden=t};if(Ut.signOut)for(let t of ce.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;ce.querySelector("summary").addEventListener("click",()=>Es(!1)),ce.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return Es(n==="keys");ce.open=!1,n==="hide"&&_e.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&Ut.signOut?.()});let ie=t=>()=>he.querySelector(t)?.click(),ia=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},Hn=[{group:"Comments",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:ie(".dt-notes-btn")},{group:"Comments",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Comments panel",el:".dt-history-btn",run:ie(".dt-history-btn")},{group:"Comments",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:ie(".dt-resolved-btn")},{group:"Comments",code:"KeyA",hint:"A",label:"Show archived",run:()=>ps(!Qt)},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:ie(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:ie(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:ie(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:ie(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:ie(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:ie(".dt-border-btn")},...s.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:ie(".dt-studio-btn")}]:[],...I.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:()=>{bt.open=!bt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:ia(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:ia(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>_e.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=ce.open&&!aa.hidden;ce.open=!t,Es(!t)}}].filter(t=>!s.client||t.group!=="Inspect"),ra=(t,e)=>Hn.find(n=>n.code===t&&!n.shift==!e),hr=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(s.shortcuts){for(let e of Hn){let n=e.el&&he.querySelector(e.el);n&&(n.dataset.tip=`${n.dataset.tip??e.label} \xB7 ${e.hint}`,n.setAttribute("aria-keyshortcuts",e.hint.startsWith("\u21E7")?`Shift+${e.hint.slice(1)}`:e.hint))}let t=(e,n)=>`<div class="dt-key-row"><span>${h(e)}</span><kbd>${h(n)}</kbd></div>`;if(ce.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(Hn.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+Hn.filter(n=>n.group===e).map(n=>t(n.label,n.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||hr(e.target))return;let n=ra(e.code,e.shiftKey);n&&(e.preventDefault(),w?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):n.run())}),w){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n=>{n.key==="Escape"&&e()})}}if(!w){oa(et.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>he.setAttribute("data-ready",""))),ta.restore(),X(et.getItem(_)==="1");let t=et.getItem(nt);t&&t in Mt&&B(t),pe(et.getItem(Dt)==="1")}let la=()=>{try{let t=JSON.parse(et.getItem(dt)||"null");St=(t?.parked??[]).filter(e=>we(e)),t?.draft&&document.querySelector(t.draft.selector)?(M=t.draft,!kt&&!w&&pe(!0)):we(t?.draft)&&St.push(t.draft),t?.reply?.text&&(qt=t.reply.text,A=st=t.reply.for??null),(M||St.length||qt)&&G()}catch{et.removeItem(dt)}};la();let da=()=>setTimeout(()=>{let t=H(location.pathname);t!==L&&(clearTimeout(xt),Xt(),L=t,dt=ot(),M=null,St=[],qt="",A=null,st=null,lt=null,Y=[],ct(),la(),ms(),Te())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),da()}}addEventListener("popstate",da),i.then(async t=>{t.status===200&&Oo(await t.json())},()=>{}).then(()=>Tt?Te(!0):void 0).then(ds.resume),document.addEventListener("visibilitychange",()=>{document.hidden||tn()}),addEventListener("focus",tn),addEventListener("notemend:changed",()=>{w||tn()});let mr=0;w||setInterval(()=>{(!Ut.live||++mr%6===0)&&tn()},2e4),w&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Ka(s){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,d=i.showModal,m=null,p=null,x=()=>{if(m){p?.disconnect(),p=null;for(let w of s)document.body.append(w);try{m.hidePopover()}catch{}m.remove(),m=null}},k=()=>{x();let w=document.querySelector("dialog:modal");w&&N(w)},N=w=>{x(),m=document.createElement("div"),m.className="dt-host",m.setAttribute("popover","manual"),m.append(...s),w.append(m);try{m.showPopover()}catch{}w.addEventListener("close",k,{once:!0}),p=new MutationObserver(()=>{w.isConnected||k()}),p.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){d.call(this),this.isConnected&&N(this)}}function Ua(){let s=window;if(s.__notemend)return;s.__notemend=!0,Ha(d=>d.includes("/__devbar/")||!!Ut.base&&d.startsWith(Ut.base)),Ht.ready=new Promise(d=>{if(!("__next_f"in self))return d();let m=0,p=()=>Object.keys(document.documentElement).some(x=>x.startsWith("__reactFiber$"))||++m>330?d():setTimeout(p,30);p()}),Ht.toggle("dt-in-frame",Nn);let i=Ct("comments?open=1");ba().then(d=>{Ht.set("--dt-z",String(d.zIndex));let m=d.brand?.color;if(m&&/^#[0-9a-f]{6}$/i.test(m)){let[p,x,k]=[1,3,5].map(N=>parseInt(m.slice(N,N+2),16)/255);Ht.set("--dt-accent",m),Ht.set("--dt-accent-ink",.2126*p+.7152*x+.0722*k>.55?"#000000":"#ffffff")}La(d),Va(d,i),Ka([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab"].map(p=>document.querySelector(p)).filter(p=>!!p))}).catch(d=>console.warn("[notemend] not started:",d))}Ua();import.meta.hot&&import.meta.hot.accept(()=>location.reload());