notemend 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/src/client/index.js +125 -125
- package/src/client/notemend.css +1 -1
package/src/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ae(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!de.via){let p=window.__notemendEarly,g=!r.method||r.method==="GET"?p?.[n]:void 0;if(g){delete p[n];let b=await g;if(b)return b}return fetch(`/__devbar/${n}`,r)}let u=await de.via(n,r);if(u.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let p=await u.json().catch(()=>{});p?.signed&&Object.assign(de.signed,p.signed),u.json=()=>p===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(p)}return u}var ar=n=>de.via?de.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Bs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),mt={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,r)=>{try{localStorage.setItem(n,r)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},lc=()=>mt.getItem("dt-resolved")==="0"&&mt.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var pc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,mc=n=>{let r={};for(let u of n?.images||[]){let p=pc(u);p&&(r[p]=u)}return r},bo={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},ir=/^(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,Fm=/^(png|jpe?g|webp|gif|webm)$/i,Ma=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Zt=(n,r)=>{let u=String(n??"");if(u.length<=r)return u;let p="";if(Ma)for(let{segment:g}of Ma.segment(u)){if(p.length+g.length>r)break;p+=g}else for(let g of u){if(p.length+g.length>r)break;p+=g}return p},jm=[["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"]],hc=n=>{let r=String(n??"").split(".").pop().toLowerCase(),u=jm.find(([,,p])=>p.split(" ").includes(r));return u?{label:u[0],color:u[1]}:{label:"FILE",color:"#717171"}},rr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),_m=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((n,r)=>[n,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][r]])),gc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>_m[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),fc=n=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return r&&!ir.test(r[1])?r[1].toLowerCase():""};var yo=n=>{let r=String(n??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!g)return null;let b=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(bo).find(E=>bo[E]===g[1]);return b?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${b}`:null}let u=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(u))return null;let p=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(u);return p&&!Fm.test(p[2])?`${p[1]||"document"}.${p[2].toLowerCase()}`:null},en=n=>{let r=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(u=>({...u,images:[]}))];for(let u of n.images||[]){if(pc(u))continue;let p=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(u)?.[1]?.slice(0,13)),g=0;r.forEach((b,E)=>{Date.parse(b.at)<=p&&(g=E)}),r[g].images.push(u)}return r.filter(u=>!u.deleted)},bc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],yc=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var Wm=20,vc=(n,r,u)=>{let p={...n||{}},g=p[r]||[];if(!g.length&&Object.keys(p).length>=Wm)return null;let b=g.includes(u)?g.filter(E=>E!==u):[...g,u];return b.length?p[r]=b:delete p[r],Object.keys(p).length?p:void 0},wc=n=>n.nickname||n.name||n.email,lr="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",zm=new RegExp("^"+lr,"u"),Vm=(n,r)=>{let u="@"+r.toLowerCase(),p=-1;for(let g=n.indexOf(u);g!==-1;g=n.indexOf(u,g+1))zm.test(n.slice(g+u.length))&&(p=g);return p};var Gm=/https?:\/\/[^\s<>"']+/g,dc=n=>{let r=n.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},Km=n=>{let r;try{r=new URL(n)}catch{return{label:String(n),kind:"link"}}let u=r.hostname.replace(/^www\./,""),p=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(u))return{label:p[2]?`Figma \xB7 ${dc([p[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(u==="github.com"&&p.length){let[b,E,H,y]=p;return{label:`GitHub \xB7 ${E??b}${/^(pull|issues)$/.test(H??"")&&y?` #${y}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(u))return{label:"Loom",kind:"link"};let g=dc(p);return{label:g?`${u} \xB7 ${g.length>32?Zt(g,31)+"\u2026":g}`:u,kind:"link"}},dr=n=>{let r=String(n??""),u=[],p=0;for(let g of r.matchAll(Gm)){let b=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>p&&u.push(r.slice(p,g.index)),u.push({url:b,...Km(b)}),p=g.index+b.length}return p<r.length&&u.push(r.slice(p)),u},$c=n=>dr(n).map(r=>typeof r=="string"?r:r.label).join(""),cc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},xc=new Map,Ec=(n=[])=>{for(let r of n)r?.email&&xc.set(r.email.toLowerCase(),r.agent_name?.trim()||"")},Wn=(n,r)=>r&&xc.get(String(ur(r)??r).toLowerCase())||"Agent",cr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!cc[n]?"":`via ${cc[n]}`,ka="3.6 3.6 10.8 10.8",La="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",ur=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Jt=n=>n==="claude"||ur(n)!=null;var Um=["new","approved","progress","review","waiting"],Be=n=>Um.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Jt(n?.assignee)?"approved":"new",qt=n=>n?.client===!0||n?.shared===!0,Mc=(n,r,u="")=>`Duplicated from ${u?u==="you"?"your":`${u}\u2019s`:"a"} ${(r?qt(r):!qt(n))?"client":"studio"} thread`,kc=n=>qt(n)?"Duplicated for the client":"Mirrored to Team",Ps=n=>Number.isInteger(n?.from?.id)&&!qt(n),Lc=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,fo={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Sc=(n,r=Date.now())=>n?.status==="done"?fo.done:ln(n,r)||["progress","review","waiting"].includes(Be(n))?fo.progress:fo.new,Tc="Fixed \u2014 please check.",Ac=n=>n?.status==="done"&&!qt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var Sa=["agent","claude","codex","gemini"];var pr=(n,r=[])=>{let u=String(n||"").toLowerCase();return Sa.some(p=>Vm(u,p)!==-1)?"claude":null},Hc=(n,r=[],u="")=>{let p=String(n||"").replace(/^@/,"").toLowerCase();if(Sa.includes(p))return"agent";let g=r.find(b=>[b.name,b.nickname,b.email].some(E=>E&&E.toLowerCase()===p));return g&&u&&g.email?.toLowerCase()===u.toLowerCase()?"you":"person"};var Ym=2*36e5,ln=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<Ym?n.working:null;var vo=(n,r,u=Date.now())=>{let p=String(n?.by||n?.byName||"").toLowerCase();if(!p||r==="done")return null;let g=r==="claude"||Jt(n.assignee),b=g?ln(n,u)?.by||n.doneFor||n.handedBy||ur(n.assignee)||p:n.assignee||"";return{writer:p,taker:String(b).toLowerCase(),claude:g}},mr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),we=(n,r=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Jt(n.assignee)?"done":null;if(!Jt(n.assignee))return null;let u=en(n),p=u[u.length-1],g=ln(n,r);return u.length>1&&p.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(p.at))&&(!g||String(p.text??"").includes("?"))?"asks":g?g.step&&r-Date.parse(g.at)>Xm?"stuck":"working":n.working?"stuck":Be(n)==="approved"?"queued":null},Xm=10*6e4,uc=(n,r=Date.now())=>{let u=Math.floor((r-Date.parse(n??""))/6e4);return u>=1?u<60?`${u} min`:`${Math.floor(u/60)} h`:"now"},hr=(n,r=31)=>{let u=Ma?[...Ma.segment(String(n??""))].map(b=>b.segment):[...String(n??"")];if(u.length<=r)return u.join("");let p=u.join("").match(/\.\w{1,8}$/)?.[0],g=p?p.length+3:0;return u.slice(0,r-1-g).join("")+"\u2026"+(g?u.slice(-g).join(""):"")},gr=(n,r=Date.now())=>{let u=n?.status!=="done"?n?.working:null;return u?.at?{step:u.step?String(u.step):null,elapsed:uc(u.since??u.at,r),silent:uc(u.at,r),stale:!ln(n,r)}:null};var Cc=La.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[u,p]=/H/.test(n)?[r[2],r[1]]:/V/.test(n)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+n,a:(Math.atan2(u-9,9-p)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var Nc=(n,r)=>{if(n.archivedAt)return!0;if(!r||n.status!=="done"||n.doneBy==="claude")return!1;let u=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(p=>!p.deleted).map(p=>Date.parse(p.at||"")||0));return!!u&&Date.now()-u>r*864e5},Jm=["uk","ru","en"],Rc=n=>{try{let r=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return r[0].toUpperCase()+r.slice(1)}catch{return n}},fr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},Ta=n=>/[іїєґІЇЄҐ]/.test(n)?"uk":/[ыэъёЫЭЪЁ]/.test(n)?"ru":/\p{Script=Cyrillic}/u.test(n)?"":/\p{L}/u.test(n)&&!/[^\p{Script=Latin}\P{L}]/u.test(n)?"en":"",Bc=(n,r="en")=>{let u=Ta(n),p=r.split("-")[0].toLowerCase();return[...new Set([p,...Jm])].filter(g=>g!==u)};async function Pc(){let n=await ae("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let r=await n.json();return r.breakpoints=r.breakpoints.map(u=>({...u,max:u.max??1/0})),Ec(r.team),r}var Ic=["iPhone","Android","Foldable","Tablet","Laptop & display"],wo=[{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 f=n=>n.replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]),zn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",yr=(n,r=u=>new Date(u).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):r(n),cs='<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>',$e='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',Vn='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',Ln='<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>',Sn='<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>',Aa='<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>',Ha='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',bn='<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>',Pe=n=>`<svg viewBox="${ka}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${La}" stroke-width="1.15" stroke-linecap="round"/></svg>`,vr=(n,r)=>`<svg viewBox="${ka}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Cc.map((u,p)=>`<path d="${u}" stroke-width="1.15" stroke-linecap="round"${p<r?"":' class="is-off"'}/>`).join("")}</svg>`,xt=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`,Zm=n=>n.breakpoints.map(r=>["new","progress","review","waiting","done"].map(u=>`<b data-bp="${f(r.id)}" data-state="${u}" hidden>${xt(r.icon,11)}<i></i></b>`).join("")).join(""),Oc=(n,r,u,p)=>`<li${p?` draggable="true" data-route="${f(r.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(r.route)?f(r.route):"#"}"${r.route===u?' aria-current="page"':""}>`+(p?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(r.label)}</span><em class="dt-pages-n" hidden>${Zm(n)}</em></a></li>`,Qm='<svg viewBox="0 4 100 100" width="18" height="18" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',$o=xt('<path d="M6 8l4 4 4-4" />',12),br='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',qc='<circle cx="8" cy="7" r="3" /><path d="M2.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M13.5 12.5l1.2 1.2 2.3-2.4" />',wr={studio:br,clients:qc};function Dc(n){let r=n.client?' style="display:none"':"",u=[...new Set(n.devices.map(T=>T.group))].map(T=>`<p class="dt-devices-group">${f(T)}</p>`+n.devices.filter(x=>x.group===T).map(x=>`<button type="button" data-device="${f(x.id)}" aria-pressed="false"${x.note?` title="${f(x.note)}"`:""}><span class="dt-menu-label">${f(x.label)}</span><em>${x.w}×${x.h}</em></button>`).join("")).join(""),p=Ic.map(T=>`<p class="dt-devices-group">${f(T)}</p>`+wo.filter(x=>x.group===T).map(x=>`<button type="button" data-emu="${f(x.id)}" aria-pressed="false"><span class="dt-menu-label">${f(x.label)}</span><em>${x.w}×${x.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(T=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(T.id)}" aria-pressed="false" title="${f(T.label)}">${xt(T.icon,16)}</button>`).join(""),b="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",E="The page at the device\u2019s size. A thread goes to its breakpoint.",H=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),y="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
1
|
+
import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ie(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!ce.via){let h=window.__notemendEarly,g=!r.method||r.method==="GET"?h?.[n]:void 0;if(g){delete h[n];let b=await g;if(b)return b}return fetch(`/__devbar/${n}`,r)}let u=await ce.via(n,r);if(u.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let h=await u.json().catch(()=>{});h?.signed&&Object.assign(ce.signed,h.signed),u.json=()=>h===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(h)}return u}var pr=n=>ce.via?ce.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Fs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),pt={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,r)=>{try{localStorage.setItem(n,r)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},uc=()=>pt.getItem("dt-resolved")==="0"&&pt.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var gc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,fc=n=>{let r={};for(let u of n?.images||[]){let h=gc(u);h&&(r[h]=u)}return r},wo={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},mr=/^(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,Fm=/^(png|jpe?g|webp|gif|webm)$/i,Ha=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,te=(n,r)=>{let u=String(n??"");if(u.length<=r)return u;let h="";if(Ha)for(let{segment:g}of Ha.segment(u)){if(h.length+g.length>r)break;h+=g}else for(let g of u){if(h.length+g.length>r)break;h+=g}return h},jm=[["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"]],bc=n=>{let r=String(n??"").split(".").pop().toLowerCase(),u=jm.find(([,,h])=>h.split(" ").includes(r));return u?{label:u[0],color:u[1]}:{label:"FILE",color:"#717171"}},hr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),_m=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((n,r)=>[n,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][r]])),yc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>_m[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),vc=n=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return r&&!mr.test(r[1])?r[1].toLowerCase():""};var $o=n=>{let r=String(n??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!g)return null;let b=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(wo).find(M=>wo[M]===g[1]);return b?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${b}`:null}let u=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(u))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(u);return h&&!Fm.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},sn=n=>{let r=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(u=>({...u,images:[]}))];for(let u of n.images||[]){if(gc(u))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(u)?.[1]?.slice(0,13)),g=0;r.forEach((b,M)=>{Date.parse(b.at)<=h&&(g=M)}),r[g].images.push(u)}return r.filter(u=>!u.deleted)},wc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],$c=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var Wm=20,xc=(n,r,u)=>{let h={...n||{}},g=h[r]||[];if(!g.length&&Object.keys(h).length>=Wm)return null;let b=g.includes(u)?g.filter(M=>M!==u):[...g,u];return b.length?h[r]=b:delete h[r],Object.keys(h).length?h:void 0},Ec=n=>n.nickname||n.name||n.email,gr="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",zm=new RegExp("^"+gr,"u"),Vm=(n,r)=>{let u="@"+r.toLowerCase(),h=-1;for(let g=n.indexOf(u);g!==-1;g=n.indexOf(u,g+1))zm.test(n.slice(g+u.length))&&(h=g);return h};var Gm=/https?:\/\/[^\s<>"']+/g,pc=n=>{let r=n.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},Um=n=>{let r;try{r=new URL(n)}catch{return{label:String(n),kind:"link"}}let u=r.hostname.replace(/^www\./,""),h=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(u))return{label:h[2]?`Figma \xB7 ${pc([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(u==="github.com"&&h.length){let[b,M,A,y]=h;return{label:`GitHub \xB7 ${M??b}${/^(pull|issues)$/.test(A??"")&&y?` #${y}`:""}`,kind:A==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(u))return{label:"Loom",kind:"link"};let g=pc(h);return{label:g?`${u} \xB7 ${g.length>32?te(g,31)+"\u2026":g}`:u,kind:"link"}},fr=n=>{let r=String(n??""),u=[],h=0;for(let g of r.matchAll(Gm)){let b=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>h&&u.push(r.slice(h,g.index)),u.push({url:b,...Um(b)}),h=g.index+b.length}return h<r.length&&u.push(r.slice(h)),u},Mc=n=>fr(n).map(r=>typeof r=="string"?r:r.label).join(""),mc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},kc=new Map,Lc=(n=[])=>{for(let r of n)r?.email&&kc.set(r.email.toLowerCase(),r.agent_name?.trim()||"")},Vn=(n,r)=>r&&kc.get(String(yr(r)??r).toLowerCase())||"Agent",br=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!mc[n]?"":`via ${mc[n]}`,Ca="3.6 3.6 10.8 10.8",Na="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",yr=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Qt=n=>n==="claude"||yr(n)!=null;var Km=["new","approved","progress","review","waiting"],qe=n=>Km.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Qt(n?.assignee)?"approved":"new",Dt=n=>n?.client===!0||n?.shared===!0,Sc=(n,r,u="")=>`Duplicated from ${u?u==="you"?"your":`${u}\u2019s`:"a"} ${(r?Dt(r):!Dt(n))?"client":"studio"} thread`,Tc=n=>Dt(n)?"Duplicated for the client":"Mirrored to Team",js=n=>Number.isInteger(n?.from?.id)&&!Dt(n),Ac=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,vo={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Hc=(n,r=Date.now())=>n?.status==="done"?vo.done:cn(n,r)||["progress","review","waiting"].includes(qe(n))?vo.progress:vo.new,Cc="Fixed \u2014 please check.",Nc=n=>n?.status==="done"&&!Dt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var Ba=["agent","claude","codex","gemini"];var vr=(n,r=[])=>{let u=String(n||"").toLowerCase();return Ba.some(h=>Vm(u,h)!==-1)?"claude":null},Bc=(n,r=[],u="")=>{let h=String(n||"").replace(/^@/,"").toLowerCase();if(Ba.includes(h))return"agent";let g=r.find(b=>[b.name,b.nickname,b.email].some(M=>M&&M.toLowerCase()===h));return g&&u&&g.email?.toLowerCase()===u.toLowerCase()?"you":"person"};var Ym=2*36e5,cn=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<Ym?n.working:null;var xo=(n,r,u=Date.now())=>{let h=String(n?.by||n?.byName||"").toLowerCase();if(!h||r==="done")return null;let g=r==="claude"||Qt(n.assignee),b=g?cn(n,u)?.by||n.doneFor||n.handedBy||yr(n.assignee)||h:n.assignee||"";return{writer:h,taker:String(b).toLowerCase(),claude:g}},wr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),$e=(n,r=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Qt(n.assignee)?"done":null;if(!Qt(n.assignee))return null;let u=sn(n),h=u[u.length-1],g=cn(n,r);return u.length>1&&h.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(h.at))&&(!g||String(h.text??"").includes("?"))?"asks":g?g.step&&r-Date.parse(g.at)>Xm?"stuck":"working":n.working?"stuck":qe(n)==="approved"?"queued":null},Xm=10*6e4,hc=(n,r=Date.now())=>{let u=Math.floor((r-Date.parse(n??""))/6e4);return u>=1?u<60?`${u} min`:`${Math.floor(u/60)} h`:"now"},$r=(n,r=31)=>{let u=Ha?[...Ha.segment(String(n??""))].map(b=>b.segment):[...String(n??"")];if(u.length<=r)return u.join("");let h=u.join("").match(/\.\w{1,8}$/)?.[0],g=h?h.length+3:0;return u.slice(0,r-1-g).join("")+"\u2026"+(g?u.slice(-g).join(""):"")},xr=(n,r=Date.now())=>{let u=n?.status!=="done"?n?.working:null;return u?.at?{step:u.step?String(u.step):null,elapsed:hc(u.since??u.at,r),silent:hc(u.at,r),stale:!cn(n,r)}:null};var Rc=Na.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[u,h]=/H/.test(n)?[r[2],r[1]]:/V/.test(n)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+n,a:(Math.atan2(u-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var Pc=(n,r)=>{if(n.archivedAt)return!0;if(!r||n.status!=="done"||n.doneBy==="claude")return!1;let u=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!u&&Date.now()-u>r*864e5},Jm=["uk","ru","en"],Ic=n=>{try{let r=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return r[0].toUpperCase()+r.slice(1)}catch{return n}},Er=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},Ra=n=>/[іїєґІЇЄҐ]/.test(n)?"uk":/[ыэъёЫЭЪЁ]/.test(n)?"ru":/\p{Script=Cyrillic}/u.test(n)?"":/\p{L}/u.test(n)&&!/[^\p{Script=Latin}\P{L}]/u.test(n)?"en":"",Oc=(n,r="en")=>{let u=Ra(n),h=r.split("-")[0].toLowerCase();return[...new Set([h,...Jm])].filter(g=>g!==u)};async function qc(){let n=await ie("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let r=await n.json();return r.breakpoints=r.breakpoints.map(u=>({...u,max:u.max??1/0})),Lc(r.team),r}var Dc=["iPhone","Android","Foldable","Tablet","Laptop & display"],Eo=[{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 f=n=>n.replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]),Gn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",kr=(n,r=u=>new Date(u).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):r(n),Un='<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>',xe='<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>',Kn='<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>',wn='<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>',Tn='<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>',Pa='<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>',Ia='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',un='<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>',De=n=>`<svg viewBox="${Ca}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${Na}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Lr=(n,r)=>`<svg viewBox="${Ca}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Rc.map((u,h)=>`<path d="${u}" stroke-width="1.15" stroke-linecap="round"${h<r?"":' class="is-off"'}/>`).join("")}</svg>`,Et=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`,Zm=n=>n.breakpoints.map(r=>["new","progress","review","waiting","done"].map(u=>`<b data-bp="${f(r.id)}" data-state="${u}" hidden>${Et(r.icon,11)}<i></i></b>`).join("")).join(""),Fc=(n,r,u,h)=>`<li${h?` draggable="true" data-route="${f(r.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(r.route)?f(r.route):"#"}"${r.route===u?' aria-current="page"':""}>`+(h?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(r.label)}</span><em class="dt-pages-n" hidden>${Zm(n)}</em></a></li>`,Qm='<svg viewBox="0 4 100 100" width="18" height="18" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',Mo=Et('<path d="M6 8l4 4 4-4" />',12),Mr='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',jc='<circle cx="8" cy="7" r="3" /><path d="M2.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M13.5 12.5l1.2 1.2 2.3-2.4" />',Sr={studio:Mr,clients:jc};function _c(n){let r=n.client?' style="display:none"':"",u=[...new Set(n.devices.map(T=>T.group))].map(T=>`<p class="dt-devices-group">${f(T)}</p>`+n.devices.filter(E=>E.group===T).map(E=>`<button type="button" data-device="${f(E.id)}" aria-pressed="false"${E.note?` title="${f(E.note)}"`:""}><span class="dt-menu-label">${f(E.label)}</span><em>${E.w}×${E.h}</em></button>`).join("")).join(""),h=Dc.map(T=>`<p class="dt-devices-group">${f(T)}</p>`+Eo.filter(E=>E.group===T).map(E=>`<button type="button" data-emu="${f(E.id)}" aria-pressed="false"><span class="dt-menu-label">${f(E.label)}</span><em>${E.w}×${E.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(T=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(T.id)}" aria-pressed="false" title="${f(T.label)}">${Et(T.icon,16)}</button>`).join(""),b="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",M="The page at the device\u2019s size. A thread goes to its breakpoint.",A=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),y="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
2
|
<!-- The top strip (Figma Proposals 33 \xABW9\xBB, 10.11): the mark, the studio / the space \u2304 on the left,
|
|
3
3
|
the address \u2014 the page list with its folders and search \u2014 in the middle, you and settings on the right.
|
|
4
4
|
The bar below keeps the tools. It does not fold (10.11). -->
|
|
@@ -7,54 +7,54 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
7
7
|
<span class="dt-strip-mark">${Qm}</span>
|
|
8
8
|
${n.studioName?`<span class="dt-strip-studio">${f(n.studioName)}</span>`:""}
|
|
9
9
|
<details class="dt-space" name="dt-menu" hidden>
|
|
10
|
-
<summary data-tip="Switch space \xB7 M"><span class="dt-space-ic">${
|
|
10
|
+
<summary data-tip="Switch space \xB7 M"><span class="dt-space-ic">${Et(Mr,14)}</span><span class="dt-space-name">Team</span>${Mo}</summary>
|
|
11
11
|
<div class="dt-space-menu" role="menu" aria-label="Whose threads">
|
|
12
|
-
<button type="button" role="menuitemradio" data-space="studio" aria-checked="true">${
|
|
13
|
-
<button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${
|
|
12
|
+
<button type="button" role="menuitemradio" data-space="studio" aria-checked="true">${Et(Mr,14)}<span><b>Team</b><em>Only people in ${f(n.studioName||"your studio")}</em></span><i class="dt-space-n"></i></button>
|
|
13
|
+
<button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${Et(jc,14)}<span><b>Client</b><em>Also visible to the client of this project</em></span><i class="dt-space-n"></i></button>
|
|
14
14
|
</div>
|
|
15
15
|
</details>
|
|
16
16
|
</div>
|
|
17
17
|
<details class="dt-pages" name="dt-menu">
|
|
18
18
|
<summary aria-label="Pages">
|
|
19
|
-
<span class="dt-pages-copy" role="button" tabindex="0" aria-label="Copy the page\u2019s link" data-tip="Copy link">${
|
|
19
|
+
<span class="dt-pages-copy" role="button" tabindex="0" aria-label="Copy the page\u2019s link" data-tip="Copy link">${Et('<path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-.9.9M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l.9-.9" />',15)}</span>
|
|
20
20
|
<span class="dt-pages-addr"><span class="dt-pages-host">${f(location.host)}</span><span class="dt-pages-slash">/</span><span class="dt-pages-name"></span></span>
|
|
21
|
-
<em class="dt-pages-here" hidden></em>${
|
|
21
|
+
<em class="dt-pages-here" hidden></em>${Mo}
|
|
22
22
|
</summary>
|
|
23
23
|
<div class="dt-pages-menu">
|
|
24
|
-
<label class="dt-pages-find">${
|
|
24
|
+
<label class="dt-pages-find">${Et('<circle cx="9" cy="9" r="5.5" /><path d="m13.2 13.2 3.3 3.3" />',14)}<input type="search" placeholder="Search pages" aria-label="Search pages" /><kbd>/</kbd></label>
|
|
25
25
|
<ul class="dt-pages-list"></ul>
|
|
26
26
|
<div class="dt-pages-hits" hidden></div>
|
|
27
|
-
<div class="dt-pages-foot" hidden><button type="button" class="dt-folder-new">${
|
|
27
|
+
<div class="dt-pages-foot" hidden><button type="button" class="dt-folder-new">${Et('<path d="M10 4.5v11M4.5 10h11" />',14)}<span>New folder</span></button><p class="dt-sel-hint" hidden></p></div>
|
|
28
28
|
</div>
|
|
29
29
|
</details>
|
|
30
30
|
<div class="dt-strip-side dt-strip-end">
|
|
31
31
|
<details class="dt-me" name="dt-menu"${n.me?"":" hidden"}>
|
|
32
|
-
<summary data-tip="You"><span class="dt-me-face"></span><span class="dt-me-name">${f(n.me?.name||n.me?.email||"")}</span>${
|
|
32
|
+
<summary data-tip="You"><span class="dt-me-face"></span><span class="dt-me-name">${f(n.me?.name||n.me?.email||"")}</span>${Mo}</summary>
|
|
33
33
|
<div class="dt-me-menu" role="menu">
|
|
34
34
|
<p class="dt-set-who">Signed in as<b>${f(n.me?.email??"")}</b></p><hr>
|
|
35
|
-
<a role="menuitem" class="dt-me-cab" target="_blank" rel="noopener" hidden>${
|
|
36
|
-
<a role="menuitem" class="dt-me-acc" target="_blank" rel="noopener" hidden>${
|
|
35
|
+
<a role="menuitem" class="dt-me-cab" target="_blank" rel="noopener" hidden>${Et('<path d="M11 3.5h5.5V9M16.5 3.5 9 11M14 11.5v4A1.5 1.5 0 0 1 12.5 17h-8A1.5 1.5 0 0 1 3 15.5v-8A1.5 1.5 0 0 1 4.5 6h4" />',14)}<span>Open the cabinet</span></a>
|
|
36
|
+
<a role="menuitem" class="dt-me-acc" target="_blank" rel="noopener" hidden>${Et('<circle cx="7.5" cy="7" r="3" /><path d="M2 16.5c.5-2.8 2.6-4.5 5.5-4.5s5 1.7 5.5 4.5M13 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1.4.6 2.3 2 2.5 4.1" />',14)}<span>Account</span></a>
|
|
37
37
|
<hr data-set-out hidden>
|
|
38
|
-
<button type="button" role="menuitem" data-set="out" hidden>${
|
|
38
|
+
<button type="button" role="menuitem" data-set="out" hidden>${Et('<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>
|
|
39
39
|
</div>
|
|
40
40
|
</details>
|
|
41
41
|
<!-- settings (the top strip, beside \u2303; who you are and signing out moved to the profile): the keys (their list in the same menu, written by the script from
|
|
42
42
|
the table that runs them), hiding the bar, signing out of a hosted bar -->
|
|
43
43
|
<details class="dt-keys" name="dt-menu">
|
|
44
44
|
<summary class="dt-icon" title="Settings">
|
|
45
|
-
${
|
|
45
|
+
${Et('<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>')}
|
|
46
46
|
</summary>
|
|
47
47
|
<div class="dt-keys-menu">
|
|
48
48
|
<div class="dt-set-main">
|
|
49
|
-
${n.client?"":`<button type="button" data-set="grid">${
|
|
50
|
-
<button type="button" data-set="custom">${
|
|
51
|
-
<button type="button" data-set="keys"${n.shortcuts?"":" hidden"}>${
|
|
52
|
-
<button type="button" data-set="hide">${
|
|
49
|
+
${n.client?"":`<button type="button" data-set="grid">${Et('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />',14)}<span>Grid</span><em class="dt-set-hint">Auto</em>${Et('<path d="M8 5l5 5-5 5" />',12)}</button>`}
|
|
50
|
+
<button type="button" data-set="custom">${Et('<rect x="3" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="3" y="11.5" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="11.5" width="5.5" height="5.5" rx="1.5" stroke-dasharray="2 1.6" />',14)}<span>Customize the bar</span></button>
|
|
51
|
+
<button type="button" data-set="keys"${n.shortcuts?"":" hidden"}>${Et('<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>
|
|
52
|
+
<button type="button" data-set="hide">${Et('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${n.shortcuts?"<kbd>\\</kbd>":""}</button>
|
|
53
53
|
</div>
|
|
54
54
|
<!-- the project's grid (Figma: Settings menu \u203A Pane=Grid \xB7 Custom / Grid \xB7 Auto), drawn by run.ts -->
|
|
55
55
|
<div class="dt-set-grid" hidden></div>
|
|
56
56
|
<div class="dt-set-keys" hidden>
|
|
57
|
-
<button type="button" class="dt-set-back" data-set="back">${
|
|
57
|
+
<button type="button" class="dt-set-back" data-set="back">${Et('<path d="M15.5 10h-11M9 5.5 4.5 10 9 14.5" />',13)}<span>Keyboard shortcuts</span></button>
|
|
58
58
|
<hr>
|
|
59
59
|
<div class="dt-keys-list"></div>
|
|
60
60
|
</div>
|
|
@@ -68,49 +68,49 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
68
68
|
${n.client&&n.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(n.brand.logo)?`<img class="dt-brand" src="${f(n.brand.logo)}" alt="" />`:""}
|
|
69
69
|
<div class="dt-group" role="group" aria-label="Inspect"${r}>
|
|
70
70
|
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
71
|
-
${
|
|
71
|
+
${Et('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
72
72
|
</button>
|
|
73
73
|
<button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
|
|
74
|
-
${
|
|
74
|
+
${Et('<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" />')}
|
|
75
75
|
</button>
|
|
76
76
|
<button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
|
|
77
|
-
${
|
|
77
|
+
${Et('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
|
|
78
78
|
</button>
|
|
79
79
|
<button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
|
|
80
|
-
${
|
|
80
|
+
${Et('<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" />')}
|
|
81
81
|
</button>
|
|
82
82
|
<button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
|
|
83
|
-
${
|
|
83
|
+
${Et('<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" />')}
|
|
84
84
|
</button>
|
|
85
85
|
<button class="dt-icon dt-contrast-btn" type="button" aria-pressed="false" title="Contrast">
|
|
86
|
-
${
|
|
86
|
+
${Et('<circle cx="10" cy="10" r="7" /><path d="M10 3a7 7 0 0 1 0 14z" fill="currentColor" />')}
|
|
87
87
|
</button>
|
|
88
88
|
<!-- Figma \xABBar \xB7 Vision \xB7 4 Vision sheet\xBB: the view as six kinds of eyes, filled in by run.ts -->
|
|
89
89
|
<details class="dt-vision" name="dt-menu">
|
|
90
90
|
<summary class="dt-icon" title="Vision">
|
|
91
|
-
${
|
|
91
|
+
${Et('<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.5" />')}
|
|
92
92
|
</summary>
|
|
93
93
|
<div class="dt-sheet dt-vision-sheet"></div>
|
|
94
94
|
</details>
|
|
95
95
|
<button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
|
|
96
|
-
${
|
|
96
|
+
${Et('<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" />')}
|
|
97
97
|
</button>
|
|
98
98
|
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${n.sanity?"":" hidden"}>
|
|
99
|
-
${
|
|
99
|
+
${Et('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
|
|
100
100
|
</button>
|
|
101
101
|
</div>
|
|
102
102
|
|
|
103
103
|
<div class="dt-group" role="group" aria-label="Threads">
|
|
104
104
|
<button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
|
|
105
|
-
${
|
|
105
|
+
${Et('<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" />')}
|
|
106
106
|
<span class="dt-notes-count" hidden></span>
|
|
107
107
|
</button>
|
|
108
108
|
<button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
|
|
109
|
-
${
|
|
109
|
+
${Et('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
|
|
110
110
|
</button>
|
|
111
111
|
<!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
|
|
112
112
|
<button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
|
|
113
|
-
${
|
|
113
|
+
${Et('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
|
|
114
114
|
</button>
|
|
115
115
|
</div>
|
|
116
116
|
|
|
@@ -119,20 +119,20 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
119
119
|
<div class="dt-group dt-group--menus">
|
|
120
120
|
<details class="dt-devices" name="dt-menu">
|
|
121
121
|
<summary title="Devices">
|
|
122
|
-
${
|
|
122
|
+
${Et('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
|
|
123
123
|
<span class="dt-devices-name">Device</span>
|
|
124
124
|
</summary>
|
|
125
125
|
<div class="dt-devices-menu">
|
|
126
126
|
<div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
|
|
127
127
|
<button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${b}" data-tip="${b}">Preview</button>
|
|
128
|
-
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${
|
|
128
|
+
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${M}" data-tip="${M}">DevTools</button>
|
|
129
129
|
</div>
|
|
130
130
|
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
131
131
|
${u}
|
|
132
132
|
</div>
|
|
133
133
|
<div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
|
|
134
134
|
<input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
|
|
135
|
-
${
|
|
135
|
+
${h}
|
|
136
136
|
</div>
|
|
137
137
|
</div>
|
|
138
138
|
</details>
|
|
@@ -151,14 +151,14 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
151
151
|
<!-- push to Claude: one square tool in the agent's well \u2014 a press sends what waits for Claude; a right
|
|
152
152
|
click or a long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
|
|
153
153
|
<span class="dt-push" hidden${n.client?' style="display:none"':""}>
|
|
154
|
-
<button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${
|
|
154
|
+
<button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${Ca}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Na}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
|
|
155
155
|
>
|
|
156
156
|
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to the agent"></div>
|
|
157
157
|
</span>
|
|
158
158
|
<!-- turbo: a bolt in the agent's well beside push, always there for the studio \u2014 lit while
|
|
159
159
|
an agent session takes comments, grey when none is listening or it is paused here -->
|
|
160
160
|
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${n.client?" hidden":""}>
|
|
161
|
-
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${
|
|
161
|
+
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${Et('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
|
|
162
162
|
</button>
|
|
163
163
|
</div>
|
|
164
164
|
|
|
@@ -196,148 +196,148 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
196
196
|
<div class="dt-notes-overlay" hidden role="region" aria-label="Threads on this page"></div>
|
|
197
197
|
<!-- the clients' space: a frame round the page and its name in a notch at the top, with \xD7 back to the studio's -->
|
|
198
198
|
<div class="dt-client-frame" aria-hidden="true"></div>
|
|
199
|
-
<div class="dt-client-tab" inert aria-hidden="true">${
|
|
199
|
+
<div class="dt-client-tab" inert aria-hidden="true">${Et('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',13)}<span>Client space</span><button type="button" class="dt-client-x" aria-label="Back to Team" data-tip="Back to Team \xB7 M">${Et('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
|
|
200
200
|
<div class="dt-grid-overlay" hidden>
|
|
201
201
|
<div class="dt-grid-chip"><span></span><button type="button" hidden>Edit</button></div>
|
|
202
202
|
<div class="${f(n.grid.container)} dt-overlay-container" aria-hidden="true">
|
|
203
|
-
<div class="${f(n.grid.grid)} dt-overlay-grid">${
|
|
203
|
+
<div class="${f(n.grid.grid)} dt-overlay-grid">${A}</div>
|
|
204
204
|
</div>
|
|
205
205
|
</div>
|
|
206
206
|
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
207
|
-
`)}var Ve=(n,r)=>{let u=r<=0?"":r>=1?"6,0.5 11.5,6 6,11.5 0.5,6":["6,6","6,0.5",...["11.5,6","6,11.5","0.5,6"].slice(0,Math.round(r*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${u?`<polygon points="${u}" fill="${n}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${n}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Fc=[{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"/>'}],jc=(n,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Is=n=>Fc.find(r=>r.id===n)||Fc[0];var Dt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",_c={open:"Open",done:"Resolved",claude:"To check"};var ee={ready:Promise.resolve(),toggle:(n,r)=>{ee.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{ee.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var th=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Wc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(th,"$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 ps=[],$r=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},eh=/ResizeObserver loop/,us=(n,r)=>{if(eh.test(r))return;let u=Zt(Wc(r.replace(/\s+/g," ").trim()),500),p=ps.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===u);if(p>=0){let[g]=ps.splice(p,1),b=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;ps.push({at:new Date().toISOString(),kind:n,text:`${u} \xD7${b}`});return}ps.push({at:new Date().toISOString(),kind:n,text:u}),ps.length>50&&ps.shift()},zc=!1;function Vc(n){if(zc||typeof window>"u")return;zc=!0;let r=console.error;console.error=(...g)=>{us("console",g.map($r).join(" ")),r.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return us("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let b=g.target,E=b?.src||b?.href;E&&!n(E)&&us("network",`${b.tagName?.toLowerCase()} ${E} did not load`)},!0),addEventListener("unhandledrejection",g=>us("rejection",$r(g.reason)));let u=window.fetch;window.fetch=async(g,b)=>{let E=typeof g=="string"?g:g instanceof URL?g.href:g.url,H=(b?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let y=await u.call(window,g,b);return y.status>=400&&!n(E)&&us("network",`${H} ${E} \u2192 ${y.status}`),y}catch(y){throw!n(E)&&y?.name!=="AbortError"&&us("network",`${H} ${E} \u2192 no answer (${$r(y)})`),y}};let p=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,b,...E){return this._nm=`${g.toUpperCase()} ${String(b)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(b))||us("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),p.call(this,g,b,...E)}}var Gc=(n=Date.now())=>ps.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function Kc(n){let r=L=>{let w=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,C=L/w;return Math.round(C*10)%10===0?String(Math.round(C)):C.toFixed(1)},u=(L,w,C,q,F,wt="p")=>{if(C<=0||q<=0)return"";let $t=F!==""?`<span class="dt-pad-chip dt-pad-chip--${wt}" style="left:${L+C/2}px;top:${w+q/2}px">${F}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${wt}" style="left:${L}px;top:${w}px;width:${C}px;height:${q}px"></span>${$t}`},p=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",b=L=>{let w=L;for(let C=0;w&&C<6;C++,w=w.parentElement){if(w.matches(g))return w;let q=getComputedStyle(w);if(p.some(F=>parseFloat(q[F])>=2))return w}return L},E=(L,w)=>{let C=parseFloat(w.columnGap)||0,q=parseFloat(w.rowGap)||0;if(!(w.display.includes("flex")||w.display.includes("grid"))||!C&&!q)return"";let F=[...L.children].map(ot=>ot.getBoundingClientRect()).filter(ot=>ot.width||ot.height),wt="",$t=(ot,et)=>r(Math.abs(ot-et)<=1?et:ot);for(let ot=1;ot<F.length;ot++){let et=F[ot-1],ct=F[ot];if(C&&ct.left>=et.right-1){let ft=Math.max(et.top,ct.top);wt+=u(et.right,ft,ct.left-et.right,Math.min(et.bottom,ct.bottom)-ft,$t(ct.left-et.right,C),"g")}else if(q&&ct.top>=et.bottom-1){let ft=Math.min(et.left,ct.left);wt+=u(ft,et.bottom,Math.max(et.right,ct.right)-ft,ct.top-et.bottom,$t(ct.top-et.bottom,q),"g")}}return wt},H=L=>`<span class="dt-pad-outline" style="left:${L.left}px;top:${L.top}px;width:${L.width}px;height:${L.height}px"></span>`,y=(L,w,C="")=>`<span class="dt-pad-tag" style="left:${w.left}px;top:${Math.max(2,w.top-22)}px">${L.tagName.toLowerCase()+(L.classList[0]?"."+L.classList[0]:"")}${C}</span>`,T=L=>{let w=L.getBoundingClientRect(),C=getComputedStyle(L),q=parseFloat(C.paddingTop),F=parseFloat(C.paddingRight),wt=parseFloat(C.paddingBottom),$t=parseFloat(C.paddingLeft),ot=H(w);ot+=u(w.left,w.top,w.width,q,q>=2?r(q):""),ot+=u(w.left,w.bottom-wt,w.width,wt,wt>=2?r(wt):""),ot+=u(w.left,w.top+q,$t,w.height-q-wt,$t>=2?r($t):""),ot+=u(w.right-F,w.top+q,F,w.height-q-wt,F>=2?r(F):"");let et=parseFloat(C.marginTop),ct=parseFloat(C.marginRight),ft=parseFloat(C.marginBottom),Nt=parseFloat(C.marginLeft);ot+=u(w.left,w.top-et,w.width,et,et>=2?r(et):"","m"),ot+=u(w.left,w.bottom,w.width,ft,ft>=2?r(ft):"","m"),ot+=u(w.left-Nt,w.top,Nt,w.height,Nt>=2?r(Nt):"","m"),ot+=u(w.right,w.top,ct,w.height,ct>=2?r(ct):"","m"),ot+=E(L,C);let ye=parseFloat(C.columnGap)||0,Ie=parseFloat(C.rowGap)||0,xe=(C.display.includes("flex")||C.display.includes("grid"))&&(ye||Ie)?` \xB7 gap ${r(ye)}${Ie&&Ie!==ye?"/"+r(Ie):""}`:"",Gt="",ce=L.parentElement;if(L.matches(g)&&ce){let he=getComputedStyle(ce);ot+=E(ce,he);let Oe=parseFloat(he.columnGap)||parseFloat(he.rowGap)||0;Gt=` \xB7 ${r(w.width)}\xD7${r(w.height)}${Oe&&(he.display.includes("flex")||he.display.includes("grid"))?` \xB7 gap ${r(Oe)} in its row`:""}`}let Se=Gt?"":` \xB7 ${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}`;n.innerHTML=ot+y(L,w,Se+xe+Gt)},x=L=>{let w=L.getBoundingClientRect();n.innerHTML=H(w).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${w.left+w.width/2}px;top:${w.bottom+6}px">${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}</span>`},D=L=>{let w=(L.match(/[\d.]+/g)||[]).map(Number);if(w.length<3)return L;let C="#"+w.slice(0,3).map(q=>Math.round(q).toString(16).padStart(2,"0")).join("");return w[3]!==void 0&&w[3]<1?`${C} \xB7 ${Math.round(w[3]*100)}%`:C},dt=null,J=()=>{if(dt)return dt;let L=getComputedStyle(document.documentElement),w=document.createElement("span");w.style.display="none",document.body.append(w);let C=[];for(let q of Array.from(L)){if(!q.startsWith("--"))continue;let F=L.getPropertyValue(q).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(F))continue;w.style.color="rgb(1, 2, 3)",w.style.color=F;let wt=getComputedStyle(w).color;wt&&wt!=="rgb(1, 2, 3)"&&C.push([wt,q])}return w.remove(),C.sort((q,F)=>q[1].length-F[1].length),dt=C,C},tt=L=>J().find(([w])=>w===L)?.[1]??"",O=null,St=()=>{if(O)return O;let L=[],w=C=>{for(let q of Array.from(C))q instanceof CSSStyleRule?q.style.cssText.includes("var(--")&&L.push({sel:q.selectorText,style:q.style}):q instanceof CSSMediaRule?matchMedia(q.conditionText).matches&&w(q.cssRules):"cssRules"in q&&w(q.cssRules)};for(let C of Array.from(document.styleSheets))try{w(C.cssRules)}catch{}return O=L},Wt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(L=>[`border-${L}-color`,[`border-${L}-color`,"border-color",`border-${L}`,"border"]]))},Tt=(L,w)=>{let C=Wt[w]??[w],q=w==="color";for(let F=L;F;F=q?F.parentElement:null){let wt=et=>C.map(ct=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(ct))?.[1]).find(Boolean),$t=F instanceof HTMLElement?wt(F.style):void 0;if($t)return $t;let ot="";for(let et of St()){let ct=!1;try{ct=F.matches(et.sel)}catch{}ct&&(ot=wt(et.style)||ot)}if(ot)return ot;if(q&&F.parentElement&&getComputedStyle(F).color!==getComputedStyle(F.parentElement).color)break}return""},at=(L,w,C)=>{let q=getComputedStyle(L).getPropertyValue(w).trim();if(!q)return D(C);let F=document.createElement("span");if(F.style.display="none",F.style.color=q,!F.style.color)return D(C);document.body.append(F);let wt=getComputedStyle(F).color;return F.remove(),D(wt)},vt=(L,w,C)=>{let q=Tt(L,w);if(q)return`<b class="dt-var">${q}</b> <em>${at(L,q,C)}</em>`;let F=tt(C);return F?`<span title="Same value as ${F}; not written with it">\u2248 ${F}</span> <em>${D(C)}</em>`:D(C)},Ft=L=>`<i class="dt-type-sw" style="background:${L}"></i>`,zt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=L=>(L.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ne=(L,w)=>L.slice(0,3).map((C,q)=>C*L[3]+w[q]*(1-L[3])).concat([1]),be=L=>{let w=[];for(let C=L;C;C=C.parentElement){let q=getComputedStyle(C);if(q.backgroundImage!=="none")return null;let F=Lt(q.backgroundColor);if(F[3]>0&&(w.push(F),F[3]>=1))break}return w.reduceRight((C,q)=>ne(q,C),[255,255,255,1])},re=L=>{let[w,C,q]=L.slice(0,3).map(F=>(F/=255,F<=.03928?F/12.92:((F+.055)/1.055)**2.4));return .2126*w+.7152*C+.0722*q},me=(L,w,C)=>{let q=be(L);if(!q)return["Contrast","<em>on an image</em>"];let F=ne(Lt(w.color),q),[wt,$t]=[re(F),re(q)].sort((ft,Nt)=>Nt-ft),ot=(wt+.05)/($t+.05),et=C>=24||C>=18.66&&Number(w.fontWeight)>=700,ct=ot>=(et?4.5:7)?"AAA":ot>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${ot.toFixed(2)}:1 <em class="${ct==="fails AA"?"dt-type-bad":""}">${ct}${et?" \xB7 large":""}</em>`]},S=L=>{let w=L.getBoundingClientRect(),C=getComputedStyle(L),q=parseFloat(C.fontSize),F=C.lineHeight==="normal"?0:parseFloat(C.lineHeight),wt=parseFloat(C.letterSpacing)||0,$t=Nt=>`${(Nt*100).toFixed(1).replace(/\.0$/,"")}%`,ot=[["Font",C.fontFamily.split(",")[0].replace(/["']/g,"")+(C.fontStyle!=="normal"?` ${C.fontStyle}`:"")],["Weight",`${zt[C.fontWeight]??""} <em>${C.fontWeight}</em>`],["Size",`${r(q)}px`],["Line",F?`${$t(F/q)} <em>${r(F)}px</em>`:"normal"],["Letter",wt?`${$t(wt/q)} <em>${wt.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",Ft(C.color)+vt(L,"color",C.color)],me(L,C,q)],ct=w.bottom+150<innerHeight?w.bottom+8:Math.max(8,w.top-158),ft=Math.min(Math.max(8,w.left),innerWidth-210);n.innerHTML=H(w)+y(L,w)+`<div class="dt-type-card" style="left:${ft}px;top:${ct}px">${ot.map(([Nt,ye])=>`<span class="dt-type-row"><b>${Nt}</b><span>${ye}</span></span>`).join("")}</div>`},k=L=>L.every(w=>w===L[0])?L[0]:L[1]===L[3]&&L[0]===L[2]?`${L[0]} ${L[1]}`:L.join(" "),W=L=>/^rgba\(.*,\s*0\)$|^transparent$/.test(L),U=(L,w,C,q="")=>{let F=20+C.length*21,$t=w.bottom+F+12<innerHeight?w.bottom+8:Math.max(8,w.top-F-8),ot=Math.min(Math.max(8,w.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px${q?`;border-radius:${q}`:""}"></span>`+y(L,w)+`<div class="dt-type-card dt-style-card" style="left:${ot}px;top:${$t}px">${C.map(([et,ct])=>`<span class="dt-type-row"><b>${et}</b><span>${ct}</span></span>`).join("")}</div>`},$=L=>{let w=getComputedStyle(L),C=[];w.backgroundImage!=="none"&&C.push(["Fill",`<em>${/gradient/.test(w.backgroundImage)?"gradient":"image"}</em>`]),W(w.backgroundColor)||C.push(["Fill",Ft(w.backgroundColor)+vt(L,"background-color",w.backgroundColor)]),L.textContent?.trim()&&C.push(["Text",Ft(w.color)+vt(L,"color",w.color)]),C.push(["Opacity",`${Math.round(Number(w.opacity)*100)}%`]),C.length||C.push(["Color","<em>no fill or text</em>"]),U(L,L.getBoundingClientRect(),C)},I=L=>{let w=getComputedStyle(L),C=[],q=["top","right","bottom","left"],F=q.map($t=>parseFloat(w.getPropertyValue(`border-${$t}-width`))||0);if(F.some($t=>$t>0)){let $t=q.filter((et,ct)=>F[ct]>0);q.forEach((et,ct)=>C.push([et[0].toUpperCase()+et.slice(1),`${r(F[ct])} <em>${w.getPropertyValue(`border-${et}-style`)}</em>`]));let ot=$t.map(et=>w.getPropertyValue(`border-${et}-color`));$t.forEach((et,ct)=>{ct&&ot[ct]===ot[0]||C.push([ct?`\u21B3 ${et}`:"Color",Ft(ot[ct])+vt(L,`border-${et}-color`,ot[ct])])})}else C.push(["Width","<em>none</em>"]);let wt=["top-left","top-right","bottom-right","bottom-left"].map($t=>{let[ot,et=ot]=w.getPropertyValue(`border-${$t}-radius`).split(" "),ct=ft=>ft.endsWith("%")?ft:r(parseFloat(ft)||0);return ot===et?ct(ot):`${ct(ot)}/${ct(et)}`});C.push(["Radius",k(wt)]),U(L,L.getBoundingClientRect(),C,w.borderRadius)},ht=(L,w)=>{let[C,q]=[re(L),re(w)].sort((F,wt)=>wt-F);return(C+.05)/(q+.05)},At=L=>"#"+L.slice(0,3).map(w=>Math.round(w).toString(16).padStart(2,"0")).join(""),Ht=(L,w,C)=>{let[q,F,wt]=L.map(xe=>xe/255),$t=Math.max(q,F,wt),ot=Math.min(q,F,wt),et=($t+ot)/2,ct=$t-ot,ft=ct?ct/(1-Math.abs(2*et-1)):0,Nt=ct?$t===q?((F-wt)/ct%6+6)%6:$t===F?(wt-q)/ct+2:(q-F)/ct+4:0,ye=xe=>{let Gt=(1-Math.abs(2*xe-1))*ft,ce=Gt*(1-Math.abs(Nt%2-1)),Se=xe-Gt/2,[he,Oe,gs]=Nt<1?[Gt,ce,0]:Nt<2?[ce,Gt,0]:Nt<3?[0,Gt,ce]:Nt<4?[0,ce,Gt]:Nt<5?[ce,0,Gt]:[Gt,0,ce];return[he,Oe,gs].map(Hn=>Math.min(255,Math.max(0,Math.round((Hn+Se)*255)))).concat([1])},Ie=re(L)>=re(w);for(let xe of Ie?[1,-1]:[-1,1]){let Gt=xe>0?1:0;if(ht(ye(Gt),w)<C)continue;let ce=et,Se=Gt;for(let he=0;he<20;he++){let Oe=(ce+Se)/2;ht(ye(Oe),w)>=C?Se=Oe:ce=Oe}return ye(Se)}return null},gt={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},Et=L=>`${L.toFixed(1).replace(/\.0$/,"")} : 1`,Q="",se=null,jt=!1,Bt=L=>{L!==se&&(se=L,jt=!1),Q="";let w=L.getBoundingClientRect(),C=(L instanceof HTMLInputElement||L instanceof HTMLTextAreaElement)&&!L.value&&!!L.placeholder,q=getComputedStyle(L,C?"::placeholder":null),F=parseFloat(q.fontSize),wt=F>=24||F>=18.66&&Number(q.fontWeight)>=700,$t=be(L),ot=ft=>`<i class="dt-type-sw" style="background:${ft}"></i>`,et;if(!L.textContent?.trim()&&!C&&!(L instanceof HTMLInputElement&&L.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!$t)et='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let ft=ne(Lt(q.color),$t),Nt=ht(ft,$t),ye=wt?3:4.5,Ie=Nt>=7?["ok",gt.ok+"AAA"]:Nt>=4.5?["ok",gt.ok+"AA"]:Nt>=3?["warn","Large text only"]:["bad","Fails"],xe=`<div class="dt-ct-ratio"><b>${Et(Nt)}</b><span class="dt-ct-chip dt-ct-chip--${Ie[0]}">${Ie[1]}</span></div>`;if(Nt>=7){et=xe,n.innerHTML=H(w)+y(L,w,C?" \xB7 placeholder":"")+Un(w,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Gt=(Se,he)=>`<div class="dt-ct-check">${Nt>=he?gt.ok:gt.x}<span>${Se}</span><em>${Et(he).replace(".0","")}</em></div>`,ce=Nt>=ye?null:Ht(ft,$t,ye);ce&&(Q=At(ce)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${ot(At(ft))}${At(ft)}</b></div><div><span>Background</span><b>${ot(At($t))}${At($t)}</b></div></div>`+xe+Gt("Body text \xB7 AA",4.5)+Gt("Large text \xB7 AA",3)+Gt("Body text \xB7 AAA",7)+(Q?jt?`<div class="dt-ct-fix dt-ct-fix--done">${gt.ok}<span>Copied ${Q}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${ot(Q)}${Q}</b>${gt.copy}</div>`:"")}let ct=`<div class="dt-ct-card"><div class="dt-ct-head">${gt.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=H(w)+y(L,w,C?" \xB7 placeholder":"")+Un(w,210,ct)},Un=(L,w,C)=>{let q=L.bottom+w+12<innerHeight?L.bottom+8:Math.max(8,L.top-w-8),F=Math.min(Math.max(8,L.left),innerWidth-260);return C.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${F}px;top:${q}px"`)};return{spacer:b,drawPads:T,drawSize:x,drawType:S,drawColor:$,drawBorder:I,drawContrast:Bt,contrastFix:()=>Q,markCopied:()=>{jt=!0}}}var ie=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Uc=(n,r,u=!1)=>{for(let p=r*4;;p*=4){let g=u?ie(n.slice(0,p)).replace(/\s+/g," "):ie(n.slice(0,p));if(g.length>=r||p>=n.length)return g}},Os=(n,r,u=!1)=>Zt(Uc(n,r,u),r),Yc='[class^="dt-"],[class*=" dt-"],.devtools',Tn=n=>{let r=n;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(Yc)};function Xc(){let n=(S,k)=>S?[...S.children].filter(W=>W.tagName.toUpperCase()===k.toUpperCase()&&!(S===document.body&&W.matches(Yc))):[],r=S=>{let k=[],W=S;for(;W&&W.tagName!=="HTML"&&k.length<8;){if(W.id){k.unshift("#"+CSS.escape(W.id));break}let U=W.parentElement,$=W.tagName.toLowerCase(),I=n(U,W.tagName),ht=U===document.body&&I.length>1?[...W.classList].find(At=>/^[\w-]+$/.test(At)&&I.filter(Ht=>Ht.classList.contains(At)).length===1):void 0;k.unshift(ht?`${$}.${ht}`:I.length>1?`${$}:nth-of-type(${I.indexOf(W)+1})`:$),W=U}return k.join(">")},u=S=>{let k=S.split(">"),W=null;for(let[U,$]of k.entries()){if($.startsWith("#")){if(U)return null;W=document.querySelector($);continue}let I=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec($);if(!I)return document.querySelector(S);if(!W){if(I[1]!=="body"||I[2]||I[3])return document.querySelector(S);W=document.body;continue}let ht=n(W,I[1].toUpperCase());if(W=(I[2]?ht.find(At=>At.classList.contains(I[2])):ht[I[3]?Number(I[3])-1:0])??null,!W)return null}return W},p=S=>S.replace(/\s+/g," ").trim(),g=(S,k)=>{if(!k)return!0;let W=Uc(S.textContent||"",60),U=p(k);return p(Zt(W,60))===U||p(W.slice(0,60))===U},b=(S,k)=>[S||"*",...(k||[]).map(W=>"."+CSS.escape(W))].join(""),E=S=>{try{return[...document.querySelectorAll(b(S.tag,S.classes))].filter(k=>!Tn(k))}catch{return[]}},H=S=>{for(let k of S.classes??[]){let W=E({tag:S.tag,classes:[k]});if(W.length)return W}return E({tag:S.tag}).slice(0,400)},T=S=>{let k=S.textContent||"",W=null;for(let U=S.parentElement,$=0;U&&U!==document.body&&$<4;U=U.parentElement,$++){let I=U.textContent||"";if(I===k)continue;let ht=Os(I,80,!0);if(ht&&(ht!==Os(k,80,!0)||(W??=ie(k).replace(/\s+/g," "),ie(I).replace(/\s+/g," ")!==W)))return ht}return""},x=S=>T(S),D=(S,k,W=120)=>Zt(ie(S.getAttribute(k)),W)||void 0,dt=S=>{for(let k=S.parentElement,W=0;k&&k!==document.body&&W<4;k=k.parentElement,W++){let U=k.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(U&&U!==S&&!S.contains(U))return Os(U.textContent||"",60,!0)||void 0}},J=S=>{let k=W=>W?Os(W.textContent||"",30,!0):"";return(k(S.previousElementSibling)+"|"+k(S.nextElementSibling)).replace(/^\|$/,"")||void 0},tt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,O=S=>{let k=[...S.attributes].find(U=>tt.test(U.name)&&U.value),W=(S.getAttribute("src")||S.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:S.id?Zt(S.id,80):void 0,data:k?`${k.name}=${Zt(k.value,80)}`:void 0,aria:D(S,"aria-label"),alt:D(S,"alt"),title:D(S,"title"),src:W,href:D(S,"href"),head:dt(S),sib:J(S)}).filter(([,U])=>U))},St=(S,k)=>!k||T(S).startsWith(k),Wt=new WeakMap,Tt=S=>Wt.get(S)??"found",at=S=>{let k=S.fp,W=null;try{W=u(S.selector)}catch{}let U=E(S),$=U.length?U:H(S),I=new Set($.slice(0,400));if(W&&!Tn(W)&&I.add(W),k.id){let gt=document.getElementById(k.id);gt&&I.add(gt)}if(k.data){let[gt,Et]=k.data.split(/=(.*)/s);try{document.querySelectorAll(`[${gt}="${CSS.escape(Et)}"]`).forEach(Q=>I.add(Q))}catch{}}let ht=null,At=null,Ht=0;for(let gt of I){if(Tn(gt))continue;let Et=k.id&>.id===k.id||k.data&>.getAttribute(k.data.split("=")[0])===k.data.split(/=(.*)/s)[1]?35:0,Q=ie(S.label)&&g(gt,S.label)||k.aria&&D(gt,"aria-label")===k.aria||k.alt&&D(gt,"alt")===k.alt||k.title&&D(gt,"title")===k.title||k.href&&D(gt,"href")===k.href||k.src&&(gt.getAttribute("src")||gt.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===k.src?25:0,se=k.head&&dt(gt)===k.head||k.sib&&J(gt)===k.sib||S.ctx&&T(gt).startsWith(S.ctx)?15:0,jt=Et+Q+se,Bt=jt+(gt===W?40:0)+(S.nth!=null&&$[S.nth]===gt?5:0);jt||(Bt=Math.min(Bt,39)),Q&&(Ht++,At={el:gt,score:Bt}),(!ht||Bt>ht.score)&&(ht={el:gt,score:Bt})}return At&&Ht===1&&At.score<40&&(!ht||ht.score<40)?{el:At.el,score:40}:ht},vt=S=>{let k=Ft(S),W=null;if(k){try{W=u(S.selector)}catch{}return Wt.set(S,k===W?"found":"moved"),k}let U=S.fp?at(S):null;return U&&U.score>=40?(Wt.set(S,U.score>=70?"moved":"probably"),U.el):(Wt.set(S,"gone"),null)},Ft=S=>{let k=null;try{k=u(S.selector)}catch{k=null}if(k&&Tn(k)&&(k=null),k&&g(k,S.label)&&St(k,S.ctx))return k;let W=E(S),U=W.length?W:H(S),$=ie(S.label)?U.filter(Ht=>g(Ht,S.label)):[],I=(S.ctx?$.find(Ht=>St(Ht,S.ctx)):$.length===1?$[0]:void 0)??(S.ctx&&!ie(S.label)?W.find(Ht=>St(Ht,S.ctx)):void 0);if(I)return I;if(S.ctx&&$.length===1&&p(ie(S.label)).length>=20)return $[0];let ht=Ht=>Ht.split(">").slice(0,2).join(">"),At=Ht=>!S.ctx&&ht(r(Ht))===ht(S.selector);return ie(S.label)?k&&!S.ctx&&g(k,S.label)?k:$.length===1&&At($[0])?$[0]:null:k||(S.nth!=null?W[S.nth]??null:null)},zt=S=>{let k=null;for(let W=S,U=S.parentElement;U&&U!==document.body&&getComputedStyle(W).position!=="fixed";W=U,U=U.parentElement){let $=getComputedStyle(U);if($.overflowX==="visible"&&$.overflowY==="visible")continue;let I=U.getBoundingClientRect();k=k?{l:Math.max(k.l,I.left),t:Math.max(k.t,I.top),r:Math.min(k.r,I.right),b:Math.min(k.b,I.bottom)}:{l:I.left,t:I.top,r:I.right,b:I.bottom}}return k},Lt=S=>{let k=S.getBoundingClientRect();return(k.width>0||k.height>0)&&(!S.checkVisibility||S.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},ne=S=>({...S,x:Math.min(Math.max(S.x,3),document.documentElement.clientWidth-30),y:S.y>=0&&S.y<19?19:S.y}),be=(S,k)=>{let W=k;for(let U=k.parentElement;U&&U!==document.body;U=U.parentElement){if(!Lt(U)){W=U;continue}let $=k.getBoundingClientRect();if($.width||$.height)return ne({x:$.left+$.width*S.rx,y:$.top+$.height*S.ry,el:k,hidden:U,shut:W});let I=U.getBoundingClientRect();return ne({x:I.left,y:I.top,el:k,hidden:U,shut:W})}return null},re=S=>{let k=S.opener?Ft(S.opener):null;if(!k||!Lt(k))return null;let W=k.getBoundingClientRect();return ne({x:W.right-4,y:W.top+4,el:k,opener:k})};return{cssPath:r,poolOf:E,contextOf:x,resolveEl:vt,anchorOf:(S,k=vt(S))=>{if(!k)return re(S);if(!Lt(k))return re(S)??be(S,k);let W=k.getBoundingClientRect(),U=W.left+W.width*S.rx,$=W.top+W.height*S.ry,I=zt(k);return I?U<I.l||U>I.r||$<I.t||$>I.b?null:{x:U,y:$,el:k}:{x:U,y:$,el:k}},anchorState:Tt,fingerprintOf:O}}var Jc=(n,r)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(u=>`<rect x="${u*5}" y="${6-u*2}" width="3" height="${5+u*2}" rx="1" fill="${u<n?r:"#fff"}" stroke="none"${u<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function Zc(n,r,u){let p=document.createElement("div");p.className="dt-field-menu",p.setAttribute("role","listbox"),p.hidden=!0,document.body.append(p);for(let E of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])p.addEventListener(E,H=>H.stopPropagation());let g=null,b=()=>{p.hidden=!0,g=null};for(let E of n)E.addEventListener("mousedown",H=>{let y=H.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!y){p.contains(H.target)||b();return}if(H.preventDefault(),g===y){b();return}g=y;let T=y.classList.contains("dt-more-select"),x=O=>T?O.dataset.on!=null:O.selected,D=y.dataset.search;p.innerHTML=(D?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${r(D)}" aria-label="${r(D)}" spellcheck="false"></label>`:"")+[...y.options].map((O,St)=>O.hidden?"":O.dataset.head!=null?`<p class="dt-field-head">${r(O.text)}${O.dataset.note?`<small>${r(O.dataset.note)}</small>`:""}</p>`:`${O.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${St}" aria-selected="${x(O)}"${O.disabled?" disabled":""}${O.dataset.hint?` data-tip="${r(O.dataset.hint)}" data-hint="${r(O.dataset.hint.toLowerCase())}"`:""}${O.dataset.danger!=null?' class="is-danger"':""}>${O.dataset.icon?O.dataset.icon:O.dataset.initial!=null?O.dataset.face?`<img class="dt-face" src="${r(O.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(O.dataset.initial)}</b>`:O.dataset.bare!=null?"":`<i style="background:${r(O.dataset.c||"#717171")}"></i>`}<span>${r(O.text)}</span>${O.dataset.note?`<small>${r(O.dataset.note)}</small>`:""}${x(O)?u:""}</button>${O.dataset.sepAfter!=null?"<hr>":""}`).join("")+(D?'<p class="dt-field-none" hidden></p>':""),p.classList.toggle("is-people",!!D);let dt=y.parentElement.getBoundingClientRect(),J=D?y.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;p.style.left=`${J?J.left+4:dt.left}px`,p.style.top=`${dt.bottom+4}px`,p.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,p.style.width=J?`${J.width-8}px`:"",p.hidden=!1;for(let O of p.querySelectorAll("[data-hint]")){let St=O.querySelector("span");St.scrollWidth>St.clientWidth&&(O.dataset.tip=`${St.textContent} \xB7 ${O.dataset.tip}`)}let tt=p.getBoundingClientRect();(tt.bottom>innerHeight-8||D&&y.closest(".dt-note"))&&(p.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(p.style.left=`${Math.max(8,dt.right-tt.width)}px`),p.querySelector(".dt-field-search input")?.focus()});p.addEventListener("input",E=>{let H=E.target.value.trim().toLowerCase(),y=0;for(let x of p.querySelectorAll("[data-i]"))x.hidden=!!H&&!x.textContent.toLowerCase().includes(H)&&!x.dataset.hint?.includes(H),x.hidden||y++;for(let x of p.querySelectorAll("hr"))x.hidden=!!H;let T=p.querySelector(".dt-field-none");T&&(T.hidden=y>0,T.textContent=`No one matches \xAB${E.target.value.trim()}\xBB`)}),p.addEventListener("keydown",E=>{E.key!=="Enter"||!E.target.matches("input")||(E.preventDefault(),p.querySelector("[data-i]:not([hidden])")?.click())}),p.addEventListener("click",E=>{let H=E.target.closest("[data-i]");if(!H||!g)return;let y=g;b(),!(y.selectedIndex===Number(H.dataset.i)&&!y.classList.contains("dt-more-select"))&&(y.selectedIndex=Number(H.dataset.i),y.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",E=>{E.key==="Escape"&&!p.hidden&&(E.stopPropagation(),b())},!0),document.addEventListener("pointerdown",E=>{!p.hidden&&!p.contains(E.target)&&!E.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&b()},!0),addEventListener("scroll",E=>{p.contains(E.target)||b()},!0)}var Gn=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,An=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(r=>r.effect?.getComputedTiming().iterations!==1/0).map(r=>r.finished)),xo=new WeakMap,Kn=(n,r)=>{let u=xo.has(n);xo.set(n,r),!u&&(n.setAttribute("data-leaving",""),An(n).then(()=>{let p=xo.get(n);p&&(xo.delete(n),n.removeAttribute("data-leaving"),p())}))},Eo=n=>{xo.delete(n),n.removeAttribute("data-leaving")},Qc=n=>{let r=n.cloneNode(!0);for(let u of["id","data-id","data-draft","data-parked"])r.removeAttribute(u);r.setAttribute("data-ghost",""),r.setAttribute("aria-hidden","true"),r.inert=!0,n.after(r),An(r).then(()=>r.remove())},Mo=(n,r)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",r),An(n).then(()=>{n.getAttribute("data-nudge")===r&&n.removeAttribute("data-nudge")})},tu=n=>{let r=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),u=r.indexOf(" ");return{duration:parseFloat(r)*(/^[\d.]+s$/.test(r.slice(0,u))?1e3:1),easing:r.slice(u+1)}},Ca=(n,r,u=1/0)=>{let p=n.hidden?0:Math.min(n.offsetHeight,u),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(y=>y.cancel()),n.hidden=!1;let b=r?Math.min(n.scrollHeight,u):0,E=()=>{n.hidden=!r};if(!Gn()||p===b)return E();let H=n.animate([{height:`${p}px`,opacity:g,overflow:"hidden"},{height:`${b}px`,opacity:r?1:0,overflow:"hidden"}],{...tu(r?"--dt-smooth":"--dt-snappy"),fill:"forwards"});H.onfinish=()=>{E(),H.cancel()}},xr=(n,r,u,p,g)=>{if(n.getAnimations().forEach(E=>E.cancel()),!Gn()||Math.abs(r-u)<1)return g();let b=n.animate([{height:`${r}px`,overflow:"hidden"},{height:`${u}px`,overflow:"hidden"}],{...tu(p?"--dt-smooth":"--dt-snappy"),fill:"forwards"});b.onfinish=()=>{g(),b.cancel()}};var nh=".devtools, [class^='dt-'], [class*=' dt-']",sh=300,eu=null,nu=n=>{eu=n};function su(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let r=null,u,p=0,g=T=>{let x=T.getAttribute("title");x!==null&&(T.removeAttribute("title"),T.hasAttribute("data-tip")||T.setAttribute("data-tip",x),!T.hasAttribute("aria-label")&&!T.textContent?.trim()&&T.setAttribute("aria-label",x))},b=T=>{let x=T?.closest?.("[data-tip], [title]");return x&&x.closest(nh)&&!x.closest(".dt-tipbox")?x:null},E=T=>{let x=T.getAttribute("data-tip");if(!x||T.getAttribute("aria-expanded")==="true")return H();let D=eu?.(T);n.classList.toggle("is-peek",!!D),D?n.innerHTML=D:n.textContent=x,Eo(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=T.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,O=8;if(D){let Wt=dt.right+8+J.width<=innerWidth-O;n.style.left=`${Wt?dt.right+8:Math.max(O,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(O,dt.top-4),innerHeight-O-J.height)}px`,T.setAttribute("aria-describedby",n.id);return}let St=dt.bottom+tt+J.height<=innerHeight-O;n.style.top=`${St?dt.bottom+tt:Math.max(O,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(O,dt.left+dt.width/2-J.width/2),innerWidth-O-J.width)}px`,n.classList.toggle("is-mono",T.classList.contains("dt-note-el")),T.setAttribute("aria-describedby",n.id)},H=()=>{clearTimeout(u),r&&!n.hidden&&(p=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,n.hidden||Kn(n,()=>{n.hidden=!0})},y=T=>{T!==r&&(H(),g(T),r=T,performance.now()<p?E(T):u=setTimeout(()=>r===T&&E(T),sh))};document.addEventListener("pointerover",T=>{let x=b(T.target);x?y(x):r&&!r.contains(T.target)&&H()},!0),document.addEventListener("pointerout",T=>{r&&!r.contains(T.relatedTarget)&&H()},!0),document.addEventListener("focusin",T=>{let x=T.target,D=b(x);D&&x.matches(":focus-visible")&&y(D)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",T=>{T.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{r&&(!r.isConnected||r.getAttribute("aria-expanded")==="true")&&H()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var pt={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>'},Er=(n,r)=>n.toLocaleTimeString("en-US",r),Na=n=>Er(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),oh={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function ah(n,r,u,p,g){let b=n.w+2*r.side,E=n.h+r.top+r.bottom,H=(u-b)/2,y=`<rect class="dt-shell-screen" x="${g}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,T="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let x=(D,dt,J)=>`<rect class="dt-shell-btn" x="${D}" y="${dt}" width="4" height="${J}" rx="2"/>`;T+=n.shell==="punch"?x(H+b-1,150,70)+x(H+b-1,240,44):x(H-3,120,28)+x(H-3,170,56)+x(H-3,236,56)+x(H+b-1,190,90),T+=`<rect class="dt-shell-body" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${b-6}" height="${E-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(T+=`<rect class="dt-shell-slot" x="${u/2-26}" y="44" width="52" height="6" rx="3"/>`,T+=`<circle class="dt-shell-slot" cx="${u/2-48}" cy="47" r="5"/>`,T+=`<circle class="dt-shell-homebtn" cx="${u/2}" cy="${E-46}" r="28"/>`)}else if(n.shell==="tablet")T+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${b-8}" height="${E-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let x=Math.round(b*.1);T+=`<path class="dt-shell-stand" d="M${u/2-x/2} ${E-2}h${x}l${x*.2} 84h${-x*1.4}z"/>`,T+=`<rect class="dt-shell-stand" x="${u/2-b*.15}" y="${E+80}" width="${b*.3}" height="14" rx="7"/>`,T+=`<rect class="dt-shell-body" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`}else{let x=b+(r.extraW??0),D=(u-x)/2,dt=r.extraH??16;T+=`<path class="dt-shell-body" d="M${H} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${b-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${E}H${H}z"/>`,T+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${D} ${E}h${x}v${dt-8}a8 8 0 0 1-8 8H${D+8}a8 8 0 0 1-8-8z"/>`,T+=`<rect class="dt-shell-lip" x="${u/2-b*.07}" y="${E}" width="${b*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${u} ${p}" width="${u}" height="${p}" aria-hidden="true">${T}${y}</svg>`}var ih={"safari-ios":n=>{let r=n.shell==="home"?20:n.w>=400?62:59;return{top:r,bottom:98,topMin:r,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},rh=({d:n,now:r,cutout:u},p)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${p}px"><span class="dt-sb-l">${pt.signal}${pt.wifi}</span><b>${Na(r)}</b><span class="dt-sb-r">${pt.battery}</span></div>`;let g=u??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${p}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${Na(r)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${pt.signal}${pt.wifi}${pt.battery}</span></div>`},lh=({d:n,host:r,min:u},p)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return u?`<div class="dt-ios-bar is-min" style="height:${p}px"><span class="dt-ios-mini">${f(r)}</span>${g}</div>`:`<div class="dt-ios-bar" style="height:${p}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${pt.back}</button><span class="dt-glass dt-ios-url"><span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-glass dt-glass--round">${pt.dots}</span></div>${g}</div>`},dh=({now:n,min:r},u)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Er(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${pt.wifi}${pt.signal}${pt.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${pt.tune}<span>${f(u)}</span></span><span class="dt-and-tabs">1</span>${pt.dotsV}</div>`),ch=()=>`<div class="dt-and-nav">${pt.recent}${pt.home}${pt.navBack}</div>`,uh=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Na(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${pt.wifi}${pt.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${pt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button></span><span class="dt-ipad-url">${pt.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-bar-group">${pt.share}${pt.plus}${pt.tabs}</span></div>`,ph=({now:n,host:r},u)=>'<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>'+(u?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${pt.wifi}${pt.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Na(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${pt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button></span><span class="dt-mac-url">${pt.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-bar-group">${pt.share}${pt.plus}${pt.tabs}</span></div>`,mh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,hh=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(r||n)}</span>${pt.close}</span><span class="dt-win-new">${pt.plus}</span><span class="dt-win-ctrl">${pt.winMin}${pt.winMax}${pt.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-win-url">${pt.tune}<span>${f(n)}</span>${pt.star}</span><span class="dt-bar-group">${pt.user}${pt.dotsV}</span></div>`,gh=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,u)=>`<i style="--hue:${200+u*30}"></i>`).join("")}</span><span class="dt-win-tray">${pt.chevUp}${pt.wifi}${pt.volume}${pt.battery}<span class="dt-win-clock">${Er(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function ou(n,r){let u=oh[n.shell](n),p=n.w+2*u.side,g=n.h+u.top+u.bottom,b=p+(u.extraW??0),E=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?u.extraH??0:0),H=(b-p)/2+u.side,y=ih[n.browser](n),T=r.min?y.topMin??y.top:y.top,x=r.min?y.bottomMin??y.bottom:y.bottom,D={...r,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=rh(D,T),J=lh(D,x);break;case"chrome-android":dt=dh(D,r.host),J=ch();break;case"safari-ipad":dt=uh(D),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=ph(D,n.shell==="macbook"),J=mh();break;case"chrome-windows":dt=hh(D),J=gh(D);break}return{footprint:{w:b,h:E},screen:{x:H,y:u.top,w:n.w,h:n.h,r:u.r,rb:u.rb??u.r},topH:T,bottomH:x,shell:ah(n,u,b,E,H),top:dt,bottom:J,canMinimize:y.topMin!==void 0&&(y.topMin!==y.top||y.bottomMin!==y.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var ms=null;function Lo(n){if(ms??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!ms||!n)return[0,0,0,0];ms.clearRect(0,0,1,1),ms.fillStyle="rgba(0, 0, 0, 0)",ms.fillStyle=n,ms.fillRect(0,0,1,1);let[r,u,p,g]=ms.getImageData(0,0,1,1).data;return[r,u,p,g/255]}var ko=([n,r,u])=>`rgb(${n}, ${r}, ${u})`;function au(n){let r=n.defaultView,u=J=>!J||Lo(J)[3]===0,p=[n.body,n.documentElement].map(J=>J&&r.getComputedStyle(J).backgroundColor).find(J=>J&&!u(J)),[g,b,E,H]=p?Lo(p):[255,255,255,1],y=[g,b,E].map(J=>Math.round(J*H+255*(1-H))),T=J=>{let[tt,O,St,Wt]=Lo(J);if(Wt>=.75)return ko([tt,O,St]);let Tt=(at,vt)=>Math.round(at*Wt+vt*(1-Wt));return ko([Tt(tt,y[0]),Tt(O,y[1]),Tt(St,y[2])])},x=J=>{let tt=n.elementFromPoint(r.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let O=r.getComputedStyle(tt);if(O.position!=="fixed"&&O.position!=="sticky")continue;let St=tt.getBoundingClientRect().width>=r.innerWidth*.9,Wt=O.backdropFilter&&O.backdropFilter!=="none";return St&&!Wt&&!u(O.backgroundColor)?T(O.backgroundColor):null}return null},D=n.querySelector('meta[name="theme-color"]')?.content||"",dt=D&&!u(D)?ko(Lo(D)):"";return{top:x(4)??ko(y),bottom:x(r.innerHeight-4)??ko(y),theme:dt}}function Mr(n){let[r,u,p]=Lo(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*r+.7152*u+.0722*p>.4?"#000":"#fff"}function iu(n){let{cfg:r,inFrame:u,persist:p,frame:g,frameEl:b,devicesMenu:E,bpBtns:H,notesOverlay:y,WIDE:T,bpOf:x,currentBp:D,deviceById:dt,notesOn:J,filter:tt,filterTo:O,dropFrameDrafts:St,putAway:Wt,tellFrame:Tt,syncBpButtons:at,render:vt,reread:Ft}=n,zt=r.breakpoints,Lt=document.querySelector(".dt-device"),ne=document.querySelector(".dt-shell"),be=document.querySelector('.dt-chrome[data-at="top"]'),re=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),S=[...document.querySelectorAll(".dt-frame-handle")],k=document.querySelector(".dt-frame-size"),W=document.querySelector(".dt-frame-rotate"),U=document.querySelector(".dt-frame-bars"),$="overlay",I="",ht="dt-w",At="dt-canvas",Ht="dt-device",gt=mt.getItem(At)==="1",Et=mt.getItem(Ht)||"";Et&&!dt(Et)&&(Et="",mt.setItem(Ht,""));let Q=Number(mt.getItem(ht))||0,se="dt-emu",jt=(()=>{try{return JSON.parse(mt.getItem(se)||"null")}catch{return null}})(),Bt=()=>jt?wo.find(R=>R.id===jt.id)??null:null,Un=()=>{let R=Bt();return R?jt.turned?{w:R.h,h:R.w}:{w:R.w,h:R.h}:null},dn=mt.getItem("dt-bars-min")==="1",Le=R=>{jt=R,p(se,R?JSON.stringify(R):"")},L=R=>{k.textContent=R,g.style.setProperty("--dt-badge-w",`${k.offsetWidth}px`)},w=R=>{if(!R){me.innerHTML="";return}let P="";for(let Y=0;Y<=R;Y+=50)P+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of zt)for(let Pt of[Y.min,Y.max])Pt>0&&Number.isFinite(Pt)&&Pt<=R&&(P+=`<span class="dt-edge" style="left:${Pt}px" title="${Y.label} edge"></span>`);me.innerHTML=P,me.style.width=`${R}px`},C=()=>{let R=parseFloat(Lt.style.width)||0,P=parseFloat(Lt.style.height)||0;if(!R||!P){Lt.style.transform="",delete Lt.dataset.scaled;return}let Y=Et||jt?Math.min(1,(innerWidth-80)/R,(innerHeight-120)/P):Math.min(1,(innerWidth-80)/R);Lt.style.transform=Y<1?`scale(${Y})`:"",Lt.dataset.scaled=Y<1?String(Math.round(Y*100)):""},q=R=>wo.find(P=>P.w===R.w&&P.h===R.h&&P.cutout?.shape==="pill")?.cutout,F=()=>{try{return b.contentDocument}catch{return null}},wt=()=>F()?.title.split("\u2014").pop()?.trim()||"",$t=()=>{let R=F(),P=Et?dt(Et):null;if(!R?.body||!P)return;let Y=au(R),Pt=P.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Yt=P.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Lt.style.setProperty("--dt-top",Pt),Lt.style.setProperty("--dt-top-ink",Mr(Pt)),Lt.style.setProperty("--dt-bottom",Yt),Lt.style.setProperty("--dt-bottom-ink",Mr(Yt));let ve=be.querySelector(".dt-win-tab > span");ve&&(ve.textContent=wt()||location.host)},ot=0;b.addEventListener("load",()=>{let R=F();if(!R)return;let P=window.__notemendHosted;if(P&&!b.contentWindow?.__notemendHosted&&!R.querySelector(`script[src^="${P.base}/bar.js"]`)){let Y=R.createElement("script");Y.src=`${P.base}/bar.js`,Y.dataset.project=P.project,R.head.append(Y)}$t(),b.contentWindow?.addEventListener("scroll",()=>{ot||(ot=requestAnimationFrame(()=>{ot=0,$t()}))},{passive:!0})});for(let R of[be,re])R.addEventListener("click",P=>{let Y=P.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let Pt=b.contentWindow?.navigation;if(!F()||!Pt)throw new Error("foreign");Y==="back"?Pt.canGoBack&&Pt.back():Y==="fwd"?Pt.canGoForward&&Pt.forward():Pt.reload()}catch{(Y==="reload"||Y==="back")&&(b.src=location.href)}});U.addEventListener("click",()=>{dn=!dn,p("dt-bars-min",dn?"1":"0"),ft()});let et=[],ct=R=>{for(let P of et)P.inert=!1;et=R?[...document.body.children].filter(P=>P instanceof HTMLElement&&!P.inert&&!P.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let P of et)P.inert=!0},ft=()=>{if(u)return;let R=Et?dt(Et)??null:null;if(Et&&!R&&(Et="",mt.setItem(Ht,"")),!R&&!gt){let P="";try{let Y=b.getAttribute("src")?b.contentWindow?.location:null;Y?.origin===location.origin&&(P=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,ct(!1),b.removeAttribute("src"),ee.toggle("dt-framing",!1),y.hidden=!J(),me.innerHTML="",at(),W.hidden=!0,U.hidden=!0,O(null),I="",St(),at(),Se(),P&&P!==location.pathname+location.search+location.hash){location.assign(P);return}Ft();return}if(g.hidden=!1,ct(!0),ee.toggle("dt-framing",!0),y.hidden=!0,b.src||(b.src=location.href),R){let P=ou(R,{host:location.host,title:wt(),now:new Date,min:dn,cutout:q(R)}),{screen:Y}=P;g.dataset.mode="device",Lt.dataset.shell=R.shell,Lt.dataset.browser=R.browser,Lt.style.width=`${P.footprint.w}px`,Lt.style.height=`${P.footprint.h}px`,Lt.style.setProperty("--dt-r",`${Y.r}px`),Lt.style.setProperty("--dt-rb",`${Y.rb}px`),ne.innerHTML=P.shell;let Pt=(rt,ge,Yn,Xn)=>{rt.innerHTML=Xn,rt.style.cssText=`left:${Y.x}px;top:${ge}px;width:${Y.w}px;height:${Yn}px`};Pt(be,Y.y,P.topH,P.top),Pt(re,Y.y+Y.h-P.bottomH,P.bottomH,P.bottom);let Yt=Y.h-P.topH-P.bottomH;b.style.position="absolute",b.style.left=`${Y.x}px`,b.style.top=`${Y.y+P.topH}px`,b.style.width=`${Y.w}px`,b.style.height=`${Yt}px`,me.innerHTML="";let ve=dn&&P.canMinimize;$=P.scrollbar,I=`${R.label}${ve?" \xB7 bars folded":""}`,O(x(R.w)),Tt({notes:J(),scrollbar:$,device:I}),U.hidden=!P.canMinimize,U.setAttribute("aria-pressed",String(ve)),L(`${R.label} ${R.w}\xD7${R.h} \xB7 page ${R.w}\xD7${Yt}${ve?" \xB7 bars folded":""} \xB7 ${zt.find(rt=>rt.id===tt())?.label??""}`),$t()}else{let P=Un();P||Le(null);let Y=P?.w||Q||zt.find(ve=>ve.id===D()).ideal;Q=Y,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,ne.innerHTML=be.innerHTML=re.innerHTML="",be.style.cssText=re.style.cssText="",U.hidden=!0,$="overlay",Lt.style.width=`${Y}px`,Lt.style.height=`${P?.h??innerHeight-84}px`,b.style.position="",b.style.left=b.style.top="",b.style.width="100%",b.style.height="100%",w(Y),Tt({notes:J()});let Pt=zt.find(ve=>ve.id===x(Y)),Yt=Bt();I=Yt?`${Yt.label}${jt?.turned?" \xB7 landscape":""}`:"",Tt({scrollbar:$,device:I}),L(Yt&&P?`${Yt.label} \xB7 ${P.w}\xD7${P.h} \xB7 ${Pt.label}`:`${Y}px \xB7 ${Pt.label}`),O(x(Y))}W.hidden=!(Bt()?.rotates&&!R),Se(),C(),at(),Ft()},Nt=R=>{let P=zt.find(Y=>Y.id===R);Et="",mt.setItem(Ht,""),Le(null),gt=D()!==R,Q=gt?P.ideal:0,O(gt?R:null),mt.setItem(At,gt?"1":"0"),mt.setItem(ht,String(Q)),Wt(),ft()};for(let R of H)R.addEventListener("click",()=>Nt(R.dataset.bp));for(let R of document.querySelectorAll("[data-device]"))R.addEventListener("click",()=>{Et=R.dataset.device===Et?"":R.dataset.device,mt.setItem(Ht,Et),E.open=!1,ft()});for(let R of document.querySelectorAll("[data-emu]"))R.addEventListener("click",()=>{let P=jt?.id===R.dataset.emu&&!Et;Et="",mt.setItem(Ht,""),Le(P?null:{id:R.dataset.emu,turned:!1}),gt=!P,Q=0,mt.setItem(At,gt?"1":"0"),O(null),Wt(),E.open=!1,ft()});W.addEventListener("click",()=>{jt&&(Le({...jt,turned:!jt.turned}),Wt(),ft())});let ye=[...E.querySelectorAll("[data-tab]")],Ie=[...E.querySelectorAll("[data-panel]")],xe=R=>{for(let P of ye)P.setAttribute("aria-selected",String(P.dataset.tab===R));for(let P of Ie)P.hidden=P.dataset.panel!==R;p("dt-devices-tab",R)};for(let R of ye)R.addEventListener("click",()=>xe(R.dataset.tab));xe(mt.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Gt=E.querySelector(".dt-emu-search");Gt.addEventListener("input",()=>{let R=Gt.value.trim().toLowerCase(),P=null,Y=!1,Pt=()=>{P&&(P.hidden=!Y)};for(let Yt of Gt.parentElement.children){if(Yt.classList.contains("dt-devices-group")){Pt(),P=Yt,Y=!1;continue}Yt.dataset.emu&&(Yt.hidden=!!R&&!Yt.textContent.toLowerCase().includes(R),Y||=!Yt.hidden)}Pt()});let ce=E.querySelector(".dt-devices-name");function Se(){for(let P of E.querySelectorAll("[data-device]"))P.setAttribute("aria-pressed",String(P.dataset.device===Et));let R=!Et&&!g.hidden?jt?.id:void 0;for(let P of E.querySelectorAll("[data-emu]"))P.setAttribute("aria-pressed",String(P.dataset.emu===R));ce.textContent=Et&&dt(Et)?.label||R&&Bt()?.label||"Device"}let he=R=>zt.find(P=>P.id===R),Oe=R=>{let P=he(tt()??D());return Math.max(P.min||320,Math.min(Number.isFinite(P.max)?P.max:2560,Math.round(R)))};for(let R of S){let P=R.dataset.edge==="l"?-1:1;R.addEventListener("pointerdown",Y=>{if(Et)return;Y.preventDefault(),jt&&(Le(null),ft()),R.setPointerCapture(Y.pointerId);let Pt=Y.clientX,Yt=Q,ve=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let rt=Yn=>{Q=Oe(Yt+P*(Yn.clientX-Pt)*2/ve),Lt.style.width=`${Q}px`,w(Q),L(`${Q}px \xB7 ${he(x(Q)).label}`),C()},ge=()=>{R.removeEventListener("pointermove",rt),R.removeEventListener("pointerup",ge),R.removeEventListener("pointercancel",ge),delete g.dataset.dragging,mt.setItem(ht,String(Q)),ft()};R.addEventListener("pointermove",rt),R.addEventListener("pointerup",ge),R.addEventListener("pointercancel",ge)}),R.addEventListener("dblclick",()=>{if(Et)return;Le(null);let Y=he(tt()??D()),Pt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];Q=Math.abs(Q-Pt[0])<Math.abs(Q-Pt[1])?Pt[0]:Pt[1],mt.setItem(ht,String(Q)),ft()})}let gs=D(),Hn=()=>{let R=zt.find(P=>P.id===T);return gt&&!Et&&!jt&&Q===R.ideal&&innerWidth>=R.min};return addEventListener("resize",()=>{if(Hn()){Nt(T);return}at(),D()!==gs&&(gs=D(),vt()),g.hidden||(!Et&&!jt&&(Lt.style.height=`${innerHeight-84}px`),C())}),{apply:ft,pickBp:Nt,look:()=>({scrollbar:$,device:I}),restore:()=>{Hn()?Nt(T):gt||Et?ft():Se()}}}var ru='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none"/></svg>',lu='<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>',fh='<svg viewBox="0 0 20 20" width="10" height="10" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="3"/><path d="M10 3v14"/></svg>',bh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function du(n){let{bp:r,notes:u,breakpoints:p,bandOfNote:g,showResolved:b,showArchived:E,drafts:H,find:y}=n,T=u.filter($=>g($)===r),x=$=>[$.text,$.note,$.byName,...($.replies??[]).filter(I=>!I.deleted).map(I=>I.text)].join(" ").toLowerCase(),D=$=>y.view==="me"?n.forMe($):y.view==="agent"?n.forAgent($):!0,dt=$=>Date.parse($.updatedAt||$.createdAt||"")||0,J=$=>Date.parse($.createdAt||"")||0,tt=T.filter($=>D($)&&(!y.q||x($).includes(y.q.trim().toLowerCase()))).sort(($,I)=>y.sort==="old"?J($)-J(I):y.sort==="new"?J(I)-J($):(y.sort==="unread"?Number(n.unread(I))-Number(n.unread($)):0)||dt(I)-dt($)),O={open:[],claude:[],done:[],archived:[]};for(let $ of tt)O[Dt($)==="done"&&n.archived($)?"archived":Dt($)].push($);let St=$=>{let I=Dt($),ht=n.orphan($),At=n.unread($),Ht=n.picking&&n.pickable($),gt=!!Ht&&n.picking.has($.id),Et=n.mirror($),Q=zn($.updatedAt||$.createdAt),se=Et?`<i class="dt-hist-mirror"${Et==="there"?` data-tip="In Team too \xB7 ${f(Q)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${fh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${I}${I==="done"?n.archived($)?" is-archived":" is-resolved":""}${ht?" is-orphan":""}${At?" is-unread":""}${n.menuFor===$.id?" is-menu":""}${gt?" is-picked":""}${n.picking&&!Ht?` is-unpickable${Et?" is-dim":""}`:""}">
|
|
208
|
-
<button class="dt-hist-go" data-go="${
|
|
209
|
-
${
|
|
207
|
+
`)}var Ke=(n,r)=>{let u=r<=0?"":r>=1?"6,0.5 11.5,6 6,11.5 0.5,6":["6,6","6,0.5",...["11.5,6","6,11.5","0.5,6"].slice(0,Math.round(r*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${u?`<polygon points="${u}" fill="${n}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${n}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Wc=[{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"/>'}],zc=(n,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,_s=n=>Wc.find(r=>r.id===n)||Wc[0];var It=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",Vc={open:"Open",done:"Resolved",claude:"To check"};var ne={ready:Promise.resolve(),toggle:(n,r)=>{ne.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{ne.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var th=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Gc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(th,"$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 bs=[],Tr=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},eh=/ResizeObserver loop/,fs=(n,r)=>{if(eh.test(r))return;let u=te(Gc(r.replace(/\s+/g," ").trim()),500),h=bs.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===u);if(h>=0){let[g]=bs.splice(h,1),b=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;bs.push({at:new Date().toISOString(),kind:n,text:`${u} \xD7${b}`});return}bs.push({at:new Date().toISOString(),kind:n,text:u}),bs.length>50&&bs.shift()},Uc=!1;function Kc(n){if(Uc||typeof window>"u")return;Uc=!0;let r=console.error;console.error=(...g)=>{fs("console",g.map(Tr).join(" ")),r.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return fs("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let b=g.target,M=b?.src||b?.href;M&&!n(M)&&fs("network",`${b.tagName?.toLowerCase()} ${M} did not load`)},!0),addEventListener("unhandledrejection",g=>fs("rejection",Tr(g.reason)));let u=window.fetch;window.fetch=async(g,b)=>{let M=typeof g=="string"?g:g instanceof URL?g.href:g.url,A=(b?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let y=await u.call(window,g,b);return y.status>=400&&!n(M)&&fs("network",`${A} ${M} \u2192 ${y.status}`),y}catch(y){throw!n(M)&&y?.name!=="AbortError"&&fs("network",`${A} ${M} \u2192 no answer (${Tr(y)})`),y}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,b,...M){return this._nm=`${g.toUpperCase()} ${String(b)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(b))||fs("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,g,b,...M)}}var Yc=(n=Date.now())=>bs.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function Xc(n){let r=L=>{let w=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,H=L/w;return Math.round(H*10)%10===0?String(Math.round(H)):H.toFixed(1)},u=(L,w,H,D,j,vt="p")=>{if(H<=0||D<=0)return"";let xt=j!==""?`<span class="dt-pad-chip dt-pad-chip--${vt}" style="left:${L+H/2}px;top:${w+D/2}px">${j}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${vt}" style="left:${L}px;top:${w}px;width:${H}px;height:${D}px"></span>${xt}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",b=L=>{let w=L;for(let H=0;w&&H<6;H++,w=w.parentElement){if(w.matches(g))return w;let D=getComputedStyle(w);if(h.some(j=>parseFloat(D[j])>=2))return w}return L},M=(L,w)=>{let H=parseFloat(w.columnGap)||0,D=parseFloat(w.rowGap)||0;if(!(w.display.includes("flex")||w.display.includes("grid"))||!H&&!D)return"";let j=[...L.children].map(st=>st.getBoundingClientRect()).filter(st=>st.width||st.height),vt="",xt=(st,et)=>r(Math.abs(st-et)<=1?et:st);for(let st=1;st<j.length;st++){let et=j[st-1],ct=j[st];if(H&&ct.left>=et.right-1){let gt=Math.max(et.top,ct.top);vt+=u(et.right,gt,ct.left-et.right,Math.min(et.bottom,ct.bottom)-gt,xt(ct.left-et.right,H),"g")}else if(D&&ct.top>=et.bottom-1){let gt=Math.min(et.left,ct.left);vt+=u(gt,et.bottom,Math.max(et.right,ct.right)-gt,ct.top-et.bottom,xt(ct.top-et.bottom,D),"g")}}return vt},A=L=>`<span class="dt-pad-outline" style="left:${L.left}px;top:${L.top}px;width:${L.width}px;height:${L.height}px"></span>`,y=(L,w,H="")=>`<span class="dt-pad-tag" style="left:${w.left}px;top:${Math.max(2,w.top-22)}px">${L.tagName.toLowerCase()+(L.classList[0]?"."+L.classList[0]:"")}${H}</span>`,T=L=>{let w=L.getBoundingClientRect(),H=getComputedStyle(L),D=parseFloat(H.paddingTop),j=parseFloat(H.paddingRight),vt=parseFloat(H.paddingBottom),xt=parseFloat(H.paddingLeft),st=A(w);st+=u(w.left,w.top,w.width,D,D>=2?r(D):""),st+=u(w.left,w.bottom-vt,w.width,vt,vt>=2?r(vt):""),st+=u(w.left,w.top+D,xt,w.height-D-vt,xt>=2?r(xt):""),st+=u(w.right-j,w.top+D,j,w.height-D-vt,j>=2?r(j):"");let et=parseFloat(H.marginTop),ct=parseFloat(H.marginRight),gt=parseFloat(H.marginBottom),Rt=parseFloat(H.marginLeft);st+=u(w.left,w.top-et,w.width,et,et>=2?r(et):"","m"),st+=u(w.left,w.bottom,w.width,gt,gt>=2?r(gt):"","m"),st+=u(w.left-Rt,w.top,Rt,w.height,Rt>=2?r(Rt):"","m"),st+=u(w.right,w.top,ct,w.height,ct>=2?r(ct):"","m"),st+=M(L,H);let ve=parseFloat(H.columnGap)||0,Fe=parseFloat(H.rowGap)||0,Ee=(H.display.includes("flex")||H.display.includes("grid"))&&(ve||Fe)?` \xB7 gap ${r(ve)}${Fe&&Fe!==ve?"/"+r(Fe):""}`:"",Ut="",ue=L.parentElement;if(L.matches(g)&&ue){let he=getComputedStyle(ue);st+=M(ue,he);let je=parseFloat(he.columnGap)||parseFloat(he.rowGap)||0;Ut=` \xB7 ${r(w.width)}\xD7${r(w.height)}${je&&(he.display.includes("flex")||he.display.includes("grid"))?` \xB7 gap ${r(je)} in its row`:""}`}let Se=Ut?"":` \xB7 ${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}`;n.innerHTML=st+y(L,w,Se+Ee+Ut)},E=L=>{let w=L.getBoundingClientRect();n.innerHTML=A(w).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${w.left+w.width/2}px;top:${w.bottom+6}px">${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}</span>`},F=L=>{let w=(L.match(/[\d.]+/g)||[]).map(Number);if(w.length<3)return L;let H="#"+w.slice(0,3).map(D=>Math.round(D).toString(16).padStart(2,"0")).join("");return w[3]!==void 0&&w[3]<1?`${H} \xB7 ${Math.round(w[3]*100)}%`:H},dt=null,J=()=>{if(dt)return dt;let L=getComputedStyle(document.documentElement),w=document.createElement("span");w.style.display="none",document.body.append(w);let H=[];for(let D of Array.from(L)){if(!D.startsWith("--"))continue;let j=L.getPropertyValue(D).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(j))continue;w.style.color="rgb(1, 2, 3)",w.style.color=j;let vt=getComputedStyle(w).color;vt&&vt!=="rgb(1, 2, 3)"&&H.push([vt,D])}return w.remove(),H.sort((D,j)=>D[1].length-j[1].length),dt=H,H},tt=L=>J().find(([w])=>w===L)?.[1]??"",q=null,At=()=>{if(q)return q;let L=[],w=H=>{for(let D of Array.from(H))D instanceof CSSStyleRule?D.style.cssText.includes("var(--")&&L.push({sel:D.selectorText,style:D.style}):D instanceof CSSMediaRule?matchMedia(D.conditionText).matches&&w(D.cssRules):"cssRules"in D&&w(D.cssRules)};for(let H of Array.from(document.styleSheets))try{w(H.cssRules)}catch{}return q=L},Wt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(L=>[`border-${L}-color`,[`border-${L}-color`,"border-color",`border-${L}`,"border"]]))},Ht=(L,w)=>{let H=Wt[w]??[w],D=w==="color";for(let j=L;j;j=D?j.parentElement:null){let vt=et=>H.map(ct=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(ct))?.[1]).find(Boolean),xt=j instanceof HTMLElement?vt(j.style):void 0;if(xt)return xt;let st="";for(let et of At()){let ct=!1;try{ct=j.matches(et.sel)}catch{}ct&&(st=vt(et.style)||st)}if(st)return st;if(D&&j.parentElement&&getComputedStyle(j).color!==getComputedStyle(j.parentElement).color)break}return""},it=(L,w,H)=>{let D=getComputedStyle(L).getPropertyValue(w).trim();if(!D)return F(H);let j=document.createElement("span");if(j.style.display="none",j.style.color=D,!j.style.color)return F(H);document.body.append(j);let vt=getComputedStyle(j).color;return j.remove(),F(vt)},ft=(L,w,H)=>{let D=Ht(L,w);if(D)return`<b class="dt-var">${D}</b> <em>${it(L,D,H)}</em>`;let j=tt(H);return j?`<span title="Same value as ${j}; not written with it">\u2248 ${j}</span> <em>${F(H)}</em>`:F(H)},Ft=L=>`<i class="dt-type-sw" style="background:${L}"></i>`,_t={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=L=>(L.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),se=(L,w)=>L.slice(0,3).map((H,D)=>H*L[3]+w[D]*(1-L[3])).concat([1]),ye=L=>{let w=[];for(let H=L;H;H=H.parentElement){let D=getComputedStyle(H);if(D.backgroundImage!=="none")return null;let j=Lt(D.backgroundColor);if(j[3]>0&&(w.push(j),j[3]>=1))break}return w.reduceRight((H,D)=>se(D,H),[255,255,255,1])},le=L=>{let[w,H,D]=L.slice(0,3).map(j=>(j/=255,j<=.03928?j/12.92:((j+.055)/1.055)**2.4));return .2126*w+.7152*H+.0722*D},me=(L,w,H)=>{let D=ye(L);if(!D)return["Contrast","<em>on an image</em>"];let j=se(Lt(w.color),D),[vt,xt]=[le(j),le(D)].sort((gt,Rt)=>Rt-gt),st=(vt+.05)/(xt+.05),et=H>=24||H>=18.66&&Number(w.fontWeight)>=700,ct=st>=(et?4.5:7)?"AAA":st>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${st.toFixed(2)}:1 <em class="${ct==="fails AA"?"dt-type-bad":""}">${ct}${et?" \xB7 large":""}</em>`]},S=L=>{let w=L.getBoundingClientRect(),H=getComputedStyle(L),D=parseFloat(H.fontSize),j=H.lineHeight==="normal"?0:parseFloat(H.lineHeight),vt=parseFloat(H.letterSpacing)||0,xt=Rt=>`${(Rt*100).toFixed(1).replace(/\.0$/,"")}%`,st=[["Font",H.fontFamily.split(",")[0].replace(/["']/g,"")+(H.fontStyle!=="normal"?` ${H.fontStyle}`:"")],["Weight",`${_t[H.fontWeight]??""} <em>${H.fontWeight}</em>`],["Size",`${r(D)}px`],["Line",j?`${xt(j/D)} <em>${r(j)}px</em>`:"normal"],["Letter",vt?`${xt(vt/D)} <em>${vt.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",Ft(H.color)+ft(L,"color",H.color)],me(L,H,D)],ct=w.bottom+150<innerHeight?w.bottom+8:Math.max(8,w.top-158),gt=Math.min(Math.max(8,w.left),innerWidth-210);n.innerHTML=A(w)+y(L,w)+`<div class="dt-type-card" style="left:${gt}px;top:${ct}px">${st.map(([Rt,ve])=>`<span class="dt-type-row"><b>${Rt}</b><span>${ve}</span></span>`).join("")}</div>`},k=L=>L.every(w=>w===L[0])?L[0]:L[1]===L[3]&&L[0]===L[2]?`${L[0]} ${L[1]}`:L.join(" "),z=L=>/^rgba\(.*,\s*0\)$|^transparent$/.test(L),K=(L,w,H,D="")=>{let j=20+H.length*21,xt=w.bottom+j+12<innerHeight?w.bottom+8:Math.max(8,w.top-j-8),st=Math.min(Math.max(8,w.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px${D?`;border-radius:${D}`:""}"></span>`+y(L,w)+`<div class="dt-type-card dt-style-card" style="left:${st}px;top:${xt}px">${H.map(([et,ct])=>`<span class="dt-type-row"><b>${et}</b><span>${ct}</span></span>`).join("")}</div>`},x=L=>{let w=getComputedStyle(L),H=[];w.backgroundImage!=="none"&&H.push(["Fill",`<em>${/gradient/.test(w.backgroundImage)?"gradient":"image"}</em>`]),z(w.backgroundColor)||H.push(["Fill",Ft(w.backgroundColor)+ft(L,"background-color",w.backgroundColor)]),L.textContent?.trim()&&H.push(["Text",Ft(w.color)+ft(L,"color",w.color)]),H.push(["Opacity",`${Math.round(Number(w.opacity)*100)}%`]),H.length||H.push(["Color","<em>no fill or text</em>"]),K(L,L.getBoundingClientRect(),H)},O=L=>{let w=getComputedStyle(L),H=[],D=["top","right","bottom","left"],j=D.map(xt=>parseFloat(w.getPropertyValue(`border-${xt}-width`))||0);if(j.some(xt=>xt>0)){let xt=D.filter((et,ct)=>j[ct]>0);D.forEach((et,ct)=>H.push([et[0].toUpperCase()+et.slice(1),`${r(j[ct])} <em>${w.getPropertyValue(`border-${et}-style`)}</em>`]));let st=xt.map(et=>w.getPropertyValue(`border-${et}-color`));xt.forEach((et,ct)=>{ct&&st[ct]===st[0]||H.push([ct?`\u21B3 ${et}`:"Color",Ft(st[ct])+ft(L,`border-${et}-color`,st[ct])])})}else H.push(["Width","<em>none</em>"]);let vt=["top-left","top-right","bottom-right","bottom-left"].map(xt=>{let[st,et=st]=w.getPropertyValue(`border-${xt}-radius`).split(" "),ct=gt=>gt.endsWith("%")?gt:r(parseFloat(gt)||0);return st===et?ct(st):`${ct(st)}/${ct(et)}`});H.push(["Radius",k(vt)]),K(L,L.getBoundingClientRect(),H,w.borderRadius)},mt=(L,w)=>{let[H,D]=[le(L),le(w)].sort((j,vt)=>vt-j);return(H+.05)/(D+.05)},Ct=L=>"#"+L.slice(0,3).map(w=>Math.round(w).toString(16).padStart(2,"0")).join(""),Bt=(L,w,H)=>{let[D,j,vt]=L.map(Ee=>Ee/255),xt=Math.max(D,j,vt),st=Math.min(D,j,vt),et=(xt+st)/2,ct=xt-st,gt=ct?ct/(1-Math.abs(2*et-1)):0,Rt=ct?xt===D?((j-vt)/ct%6+6)%6:xt===j?(vt-D)/ct+2:(D-j)/ct+4:0,ve=Ee=>{let Ut=(1-Math.abs(2*Ee-1))*gt,ue=Ut*(1-Math.abs(Rt%2-1)),Se=Ee-Ut/2,[he,je,ws]=Rt<1?[Ut,ue,0]:Rt<2?[ue,Ut,0]:Rt<3?[0,Ut,ue]:Rt<4?[0,ue,Ut]:Rt<5?[ue,0,Ut]:[Ut,0,ue];return[he,je,ws].map(Cn=>Math.min(255,Math.max(0,Math.round((Cn+Se)*255)))).concat([1])},Fe=le(L)>=le(w);for(let Ee of Fe?[1,-1]:[-1,1]){let Ut=Ee>0?1:0;if(mt(ve(Ut),w)<H)continue;let ue=et,Se=Ut;for(let he=0;he<20;he++){let je=(ue+Se)/2;mt(ve(je),w)>=H?Se=je:ue=je}return ve(Se)}return null},ht={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},St=L=>`${L.toFixed(1).replace(/\.0$/,"")} : 1`,Z="",oe=null,jt=!1,Ot=L=>{L!==oe&&(oe=L,jt=!1),Z="";let w=L.getBoundingClientRect(),H=(L instanceof HTMLInputElement||L instanceof HTMLTextAreaElement)&&!L.value&&!!L.placeholder,D=getComputedStyle(L,H?"::placeholder":null),j=parseFloat(D.fontSize),vt=j>=24||j>=18.66&&Number(D.fontWeight)>=700,xt=ye(L),st=gt=>`<i class="dt-type-sw" style="background:${gt}"></i>`,et;if(!L.textContent?.trim()&&!H&&!(L instanceof HTMLInputElement&&L.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!xt)et='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let gt=se(Lt(D.color),xt),Rt=mt(gt,xt),ve=vt?3:4.5,Fe=Rt>=7?["ok",ht.ok+"AAA"]:Rt>=4.5?["ok",ht.ok+"AA"]:Rt>=3?["warn","Large text only"]:["bad","Fails"],Ee=`<div class="dt-ct-ratio"><b>${St(Rt)}</b><span class="dt-ct-chip dt-ct-chip--${Fe[0]}">${Fe[1]}</span></div>`;if(Rt>=7){et=Ee,n.innerHTML=A(w)+y(L,w,H?" \xB7 placeholder":"")+Jn(w,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Ut=(Se,he)=>`<div class="dt-ct-check">${Rt>=he?ht.ok:ht.x}<span>${Se}</span><em>${St(he).replace(".0","")}</em></div>`,ue=Rt>=ve?null:Bt(gt,xt,ve);ue&&(Z=Ct(ue)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${st(Ct(gt))}${Ct(gt)}</b></div><div><span>Background</span><b>${st(Ct(xt))}${Ct(xt)}</b></div></div>`+Ee+Ut("Body text \xB7 AA",4.5)+Ut("Large text \xB7 AA",3)+Ut("Body text \xB7 AAA",7)+(Z?jt?`<div class="dt-ct-fix dt-ct-fix--done">${ht.ok}<span>Copied ${Z}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${st(Z)}${Z}</b>${ht.copy}</div>`:"")}let ct=`<div class="dt-ct-card"><div class="dt-ct-head">${ht.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=A(w)+y(L,w,H?" \xB7 placeholder":"")+Jn(w,210,ct)},Jn=(L,w,H)=>{let D=L.bottom+w+12<innerHeight?L.bottom+8:Math.max(8,L.top-w-8),j=Math.min(Math.max(8,L.left),innerWidth-260);return H.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${j}px;top:${D}px"`)};return{spacer:b,drawPads:T,drawSize:E,drawType:S,drawColor:x,drawBorder:O,drawContrast:Ot,contrastFix:()=>Z,markCopied:()=>{jt=!0}}}var re=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Jc=(n,r,u=!1)=>{for(let h=r*4;;h*=4){let g=u?re(n.slice(0,h)).replace(/\s+/g," "):re(n.slice(0,h));if(g.length>=r||h>=n.length)return g}},Ws=(n,r,u=!1)=>te(Jc(n,r,u),r),Zc='[class^="dt-"],[class*=" dt-"],.devtools',An=n=>{let r=n;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(Zc)};function Qc(){let n=(S,k)=>S?[...S.children].filter(z=>z.tagName.toUpperCase()===k.toUpperCase()&&!(S===document.body&&z.matches(Zc))):[],r=S=>{let k=[],z=S;for(;z&&z.tagName!=="HTML"&&k.length<8;){if(z.id){k.unshift("#"+CSS.escape(z.id));break}let K=z.parentElement,x=z.tagName.toLowerCase(),O=n(K,z.tagName),mt=K===document.body&&O.length>1?[...z.classList].find(Ct=>/^[\w-]+$/.test(Ct)&&O.filter(Bt=>Bt.classList.contains(Ct)).length===1):void 0;k.unshift(mt?`${x}.${mt}`:O.length>1?`${x}:nth-of-type(${O.indexOf(z)+1})`:x),z=K}return k.join(">")},u=S=>{let k=S.split(">"),z=null;for(let[K,x]of k.entries()){if(x.startsWith("#")){if(K)return null;z=document.querySelector(x);continue}let O=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(x);if(!O)return document.querySelector(S);if(!z){if(O[1]!=="body"||O[2]||O[3])return document.querySelector(S);z=document.body;continue}let mt=n(z,O[1].toUpperCase());if(z=(O[2]?mt.find(Ct=>Ct.classList.contains(O[2])):mt[O[3]?Number(O[3])-1:0])??null,!z)return null}return z},h=S=>S.replace(/\s+/g," ").trim(),g=(S,k)=>{if(!k)return!0;let z=Jc(S.textContent||"",60),K=h(k);return h(te(z,60))===K||h(z.slice(0,60))===K},b=(S,k)=>[S||"*",...(k||[]).map(z=>"."+CSS.escape(z))].join(""),M=S=>{try{return[...document.querySelectorAll(b(S.tag,S.classes))].filter(k=>!An(k))}catch{return[]}},A=S=>{for(let k of S.classes??[]){let z=M({tag:S.tag,classes:[k]});if(z.length)return z}return M({tag:S.tag}).slice(0,400)},T=S=>{let k=S.textContent||"",z=null;for(let K=S.parentElement,x=0;K&&K!==document.body&&x<4;K=K.parentElement,x++){let O=K.textContent||"";if(O===k)continue;let mt=Ws(O,80,!0);if(mt&&(mt!==Ws(k,80,!0)||(z??=re(k).replace(/\s+/g," "),re(O).replace(/\s+/g," ")!==z)))return mt}return""},E=S=>T(S),F=(S,k,z=120)=>te(re(S.getAttribute(k)),z)||void 0,dt=S=>{for(let k=S.parentElement,z=0;k&&k!==document.body&&z<4;k=k.parentElement,z++){let K=k.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(K&&K!==S&&!S.contains(K))return Ws(K.textContent||"",60,!0)||void 0}},J=S=>{let k=z=>z?Ws(z.textContent||"",30,!0):"";return(k(S.previousElementSibling)+"|"+k(S.nextElementSibling)).replace(/^\|$/,"")||void 0},tt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,q=S=>{let k=[...S.attributes].find(K=>tt.test(K.name)&&K.value),z=(S.getAttribute("src")||S.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:S.id?te(S.id,80):void 0,data:k?`${k.name}=${te(k.value,80)}`:void 0,aria:F(S,"aria-label"),alt:F(S,"alt"),title:F(S,"title"),src:z,href:F(S,"href"),head:dt(S),sib:J(S)}).filter(([,K])=>K))},At=(S,k)=>!k||T(S).startsWith(k),Wt=new WeakMap,Ht=S=>Wt.get(S)??"found",it=S=>{let k=S.fp,z=null;try{z=u(S.selector)}catch{}let K=M(S),x=K.length?K:A(S),O=new Set(x.slice(0,400));if(z&&!An(z)&&O.add(z),k.id){let ht=document.getElementById(k.id);ht&&O.add(ht)}if(k.data){let[ht,St]=k.data.split(/=(.*)/s);try{document.querySelectorAll(`[${ht}="${CSS.escape(St)}"]`).forEach(Z=>O.add(Z))}catch{}}let mt=null,Ct=null,Bt=0;for(let ht of O){if(An(ht))continue;let St=k.id&&ht.id===k.id||k.data&&ht.getAttribute(k.data.split("=")[0])===k.data.split(/=(.*)/s)[1]?35:0,Z=re(S.label)&&g(ht,S.label)||k.aria&&F(ht,"aria-label")===k.aria||k.alt&&F(ht,"alt")===k.alt||k.title&&F(ht,"title")===k.title||k.href&&F(ht,"href")===k.href||k.src&&(ht.getAttribute("src")||ht.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===k.src?25:0,oe=k.head&&dt(ht)===k.head||k.sib&&J(ht)===k.sib||S.ctx&&T(ht).startsWith(S.ctx)?15:0,jt=St+Z+oe,Ot=jt+(ht===z?40:0)+(S.nth!=null&&x[S.nth]===ht?5:0);jt||(Ot=Math.min(Ot,39)),Z&&(Bt++,Ct={el:ht,score:Ot}),(!mt||Ot>mt.score)&&(mt={el:ht,score:Ot})}return Ct&&Bt===1&&Ct.score<40&&(!mt||mt.score<40)?{el:Ct.el,score:40}:mt},ft=S=>{let k=Ft(S),z=null;if(k){try{z=u(S.selector)}catch{}return Wt.set(S,k===z?"found":"moved"),k}let K=S.fp?it(S):null;return K&&K.score>=40?(Wt.set(S,K.score>=70?"moved":"probably"),K.el):(Wt.set(S,"gone"),null)},Ft=S=>{let k=null;try{k=u(S.selector)}catch{k=null}if(k&&An(k)&&(k=null),k&&g(k,S.label)&&At(k,S.ctx))return k;let z=M(S),K=z.length?z:A(S),x=re(S.label)?K.filter(Bt=>g(Bt,S.label)):[],O=(S.ctx?x.find(Bt=>At(Bt,S.ctx)):x.length===1?x[0]:void 0)??(S.ctx&&!re(S.label)?z.find(Bt=>At(Bt,S.ctx)):void 0);if(O)return O;if(S.ctx&&x.length===1&&h(re(S.label)).length>=20)return x[0];let mt=Bt=>Bt.split(">").slice(0,2).join(">"),Ct=Bt=>!S.ctx&&mt(r(Bt))===mt(S.selector);return re(S.label)?k&&!S.ctx&&g(k,S.label)?k:x.length===1&&Ct(x[0])?x[0]:null:k||(S.nth!=null?z[S.nth]??null:null)},_t=S=>{let k=null;for(let z=S,K=S.parentElement;K&&K!==document.body&&getComputedStyle(z).position!=="fixed";z=K,K=K.parentElement){let x=getComputedStyle(K);if(x.overflowX==="visible"&&x.overflowY==="visible")continue;let O=K.getBoundingClientRect();k=k?{l:Math.max(k.l,O.left),t:Math.max(k.t,O.top),r:Math.min(k.r,O.right),b:Math.min(k.b,O.bottom)}:{l:O.left,t:O.top,r:O.right,b:O.bottom}}return k},Lt=S=>{let k=S.getBoundingClientRect();return(k.width>0||k.height>0)&&(!S.checkVisibility||S.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},se=S=>({...S,x:Math.min(Math.max(S.x,3),document.documentElement.clientWidth-30),y:S.y>=0&&S.y<19?19:S.y}),ye=(S,k)=>{let z=k;for(let K=k.parentElement;K&&K!==document.body;K=K.parentElement){if(!Lt(K)){z=K;continue}let x=k.getBoundingClientRect();if(x.width||x.height)return se({x:x.left+x.width*S.rx,y:x.top+x.height*S.ry,el:k,hidden:K,shut:z});let O=K.getBoundingClientRect();return se({x:O.left,y:O.top,el:k,hidden:K,shut:z})}return null},le=S=>{let k=S.opener?Ft(S.opener):null;if(!k||!Lt(k))return null;let z=k.getBoundingClientRect();return se({x:z.right-4,y:z.top+4,el:k,opener:k})};return{cssPath:r,poolOf:M,contextOf:E,resolveEl:ft,anchorOf:(S,k=ft(S))=>{if(!k)return le(S);if(!Lt(k))return le(S)??ye(S,k);let z=k.getBoundingClientRect(),K=z.left+z.width*S.rx,x=z.top+z.height*S.ry,O=_t(k);return O?K<O.l||K>O.r||x<O.t||x>O.b?null:{x:K,y:x,el:k}:{x:K,y:x,el:k}},anchorState:Ht,fingerprintOf:q}}var tu=(n,r)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(u=>`<rect x="${u*5}" y="${6-u*2}" width="3" height="${5+u*2}" rx="1" fill="${u<n?r:"#fff"}" stroke="none"${u<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function eu(n,r,u){let h=document.createElement("div");h.className="dt-field-menu",h.setAttribute("role","listbox"),h.hidden=!0,document.body.append(h);for(let M of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])h.addEventListener(M,A=>A.stopPropagation());let g=null,b=()=>{h.hidden=!0,g=null};for(let M of n)M.addEventListener("mousedown",A=>{let y=A.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!y){h.contains(A.target)||b();return}if(A.preventDefault(),g===y){b();return}g=y;let T=y.classList.contains("dt-more-select"),E=q=>T?q.dataset.on!=null:q.selected,F=y.dataset.search;h.innerHTML=(F?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${r(F)}" aria-label="${r(F)}" spellcheck="false"></label>`:"")+[...y.options].map((q,At)=>q.hidden?"":q.dataset.head!=null?`<p class="dt-field-head">${r(q.text)}${q.dataset.note?`<small>${r(q.dataset.note)}</small>`:""}</p>`:`${q.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${At}" aria-selected="${E(q)}"${q.disabled?" disabled":""}${q.dataset.hint?` data-tip="${r(q.dataset.hint)}" data-hint="${r(q.dataset.hint.toLowerCase())}"`:""}${q.dataset.danger!=null?' class="is-danger"':""}>${q.dataset.icon?q.dataset.icon:q.dataset.initial!=null?q.dataset.face?`<img class="dt-face" src="${r(q.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(q.dataset.initial)}</b>`:q.dataset.bare!=null?"":`<i style="background:${r(q.dataset.c||"#717171")}"></i>`}<span>${r(q.text)}</span>${q.dataset.note?`<small>${r(q.dataset.note)}</small>`:""}${E(q)?u:""}</button>${q.dataset.sepAfter!=null?"<hr>":""}`).join("")+(F?'<p class="dt-field-none" hidden></p>':""),h.classList.toggle("is-people",!!F);let dt=y.parentElement.getBoundingClientRect(),J=F?y.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;h.style.left=`${J?J.left+4:dt.left}px`,h.style.top=`${dt.bottom+4}px`,h.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,h.style.width=J?`${J.width-8}px`:"",h.hidden=!1;for(let q of h.querySelectorAll("[data-hint]")){let At=q.querySelector("span");At.scrollWidth>At.clientWidth&&(q.dataset.tip=`${At.textContent} \xB7 ${q.dataset.tip}`)}let tt=h.getBoundingClientRect();(tt.bottom>innerHeight-8||F&&y.closest(".dt-note"))&&(h.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(h.style.left=`${Math.max(8,dt.right-tt.width)}px`),h.querySelector(".dt-field-search input")?.focus()});h.addEventListener("input",M=>{let A=M.target.value.trim().toLowerCase(),y=0;for(let E of h.querySelectorAll("[data-i]"))E.hidden=!!A&&!E.textContent.toLowerCase().includes(A)&&!E.dataset.hint?.includes(A),E.hidden||y++;for(let E of h.querySelectorAll("hr"))E.hidden=!!A;let T=h.querySelector(".dt-field-none");T&&(T.hidden=y>0,T.textContent=`No one matches \xAB${M.target.value.trim()}\xBB`)}),h.addEventListener("keydown",M=>{M.key!=="Enter"||!M.target.matches("input")||(M.preventDefault(),h.querySelector("[data-i]:not([hidden])")?.click())}),h.addEventListener("click",M=>{let A=M.target.closest("[data-i]");if(!A||!g)return;let y=g;b(),!(y.selectedIndex===Number(A.dataset.i)&&!y.classList.contains("dt-more-select"))&&(y.selectedIndex=Number(A.dataset.i),y.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",M=>{M.key==="Escape"&&!h.hidden&&(M.stopPropagation(),b())},!0),document.addEventListener("pointerdown",M=>{!h.hidden&&!h.contains(M.target)&&!M.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&b()},!0),addEventListener("scroll",M=>{h.contains(M.target)||b()},!0)}var Yn=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,Hn=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(r=>r.effect?.getComputedTiming().iterations!==1/0).map(r=>r.finished)),ko=new WeakMap,Xn=(n,r)=>{let u=ko.has(n);ko.set(n,r),!u&&(n.setAttribute("data-leaving",""),Hn(n).then(()=>{let h=ko.get(n);h&&(ko.delete(n),n.removeAttribute("data-leaving"),h())}))},Lo=n=>{ko.delete(n),n.removeAttribute("data-leaving")},nu=n=>{let r=n.cloneNode(!0);for(let u of["id","data-id","data-draft","data-parked"])r.removeAttribute(u);r.setAttribute("data-ghost",""),r.setAttribute("aria-hidden","true"),r.inert=!0,n.after(r),Hn(r).then(()=>r.remove())},So=(n,r)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",r),Hn(n).then(()=>{n.getAttribute("data-nudge")===r&&n.removeAttribute("data-nudge")})},su=n=>{let r=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),u=r.indexOf(" ");return{duration:parseFloat(r)*(/^[\d.]+s$/.test(r.slice(0,u))?1e3:1),easing:r.slice(u+1)}},Oa=(n,r,u=1/0)=>{let h=n.hidden?0:Math.min(n.offsetHeight,u),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(y=>y.cancel()),n.hidden=!1;let b=r?Math.min(n.scrollHeight,u):0,M=()=>{n.hidden=!r};if(!Yn()||h===b)return M();let A=n.animate([{height:`${h}px`,opacity:g,overflow:"hidden"},{height:`${b}px`,opacity:r?1:0,overflow:"hidden"}],{...su(r?"--dt-smooth":"--dt-snappy"),fill:"forwards"});A.onfinish=()=>{M(),A.cancel()}},Ar=(n,r,u,h,g)=>{if(n.getAnimations().forEach(M=>M.cancel()),!Yn()||Math.abs(r-u)<1)return g();let b=n.animate([{height:`${r}px`,overflow:"hidden"},{height:`${u}px`,overflow:"hidden"}],{...su(h?"--dt-smooth":"--dt-snappy"),fill:"forwards"});b.onfinish=()=>{g(),b.cancel()}};var nh=".devtools, [class^='dt-'], [class*=' dt-']",sh=300,ou=null,au=n=>{ou=n};function iu(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let r=null,u,h=0,g=T=>{let E=T.getAttribute("title");E!==null&&(T.removeAttribute("title"),T.hasAttribute("data-tip")||T.setAttribute("data-tip",E),!T.hasAttribute("aria-label")&&!T.textContent?.trim()&&T.setAttribute("aria-label",E))},b=T=>{let E=T?.closest?.("[data-tip], [title]");return E&&E.closest(nh)&&!E.closest(".dt-tipbox")?E:null},M=T=>{let E=T.getAttribute("data-tip");if(!E||T.getAttribute("aria-expanded")==="true")return A();let F=ou?.(T);n.classList.toggle("is-peek",!!F),F?n.innerHTML=F:n.textContent=E,Lo(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=T.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,q=8;if(F){let Wt=dt.right+8+J.width<=innerWidth-q;n.style.left=`${Wt?dt.right+8:Math.max(q,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(q,dt.top-4),innerHeight-q-J.height)}px`,T.setAttribute("aria-describedby",n.id);return}let At=dt.bottom+tt+J.height<=innerHeight-q;n.style.top=`${At?dt.bottom+tt:Math.max(q,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(q,dt.left+dt.width/2-J.width/2),innerWidth-q-J.width)}px`,n.classList.toggle("is-mono",T.classList.contains("dt-note-el")),T.setAttribute("aria-describedby",n.id)},A=()=>{clearTimeout(u),r&&!n.hidden&&(h=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,n.hidden||Xn(n,()=>{n.hidden=!0})},y=T=>{T!==r&&(A(),g(T),r=T,performance.now()<h?M(T):u=setTimeout(()=>r===T&&M(T),sh))};document.addEventListener("pointerover",T=>{let E=b(T.target);E?y(E):r&&!r.contains(T.target)&&A()},!0),document.addEventListener("pointerout",T=>{r&&!r.contains(T.relatedTarget)&&A()},!0),document.addEventListener("focusin",T=>{let E=T.target,F=b(E);F&&E.matches(":focus-visible")&&y(F)},!0),document.addEventListener("focusout",A,!0),document.addEventListener("pointerdown",A,!0),document.addEventListener("keydown",T=>{T.key==="Escape"&&A()},!0),addEventListener("scroll",A,!0),new MutationObserver(()=>{r&&(!r.isConnected||r.getAttribute("aria-expanded")==="true")&&A()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var ut={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>'},Hr=(n,r)=>n.toLocaleTimeString("en-US",r),qa=n=>Hr(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),oh={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function ah(n,r,u,h,g){let b=n.w+2*r.side,M=n.h+r.top+r.bottom,A=(u-b)/2,y=`<rect class="dt-shell-screen" x="${g}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,T="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let E=(F,dt,J)=>`<rect class="dt-shell-btn" x="${F}" y="${dt}" width="4" height="${J}" rx="2"/>`;T+=n.shell==="punch"?E(A+b-1,150,70)+E(A+b-1,240,44):E(A-3,120,28)+E(A-3,170,56)+E(A-3,236,56)+E(A+b-1,190,90),T+=`<rect class="dt-shell-body" x="${A}" y="0" width="${b}" height="${M}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${A+3}" y="3" width="${b-6}" height="${M-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(T+=`<rect class="dt-shell-slot" x="${u/2-26}" y="44" width="52" height="6" rx="3"/>`,T+=`<circle class="dt-shell-slot" cx="${u/2-48}" cy="47" r="5"/>`,T+=`<circle class="dt-shell-homebtn" cx="${u/2}" cy="${M-46}" r="28"/>`)}else if(n.shell==="tablet")T+=`<rect class="dt-shell-body dt-shell-body--light" x="${A}" y="0" width="${b}" height="${M}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${A+4}" y="4" width="${b-8}" height="${M-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let E=Math.round(b*.1);T+=`<path class="dt-shell-stand" d="M${u/2-E/2} ${M-2}h${E}l${E*.2} 84h${-E*1.4}z"/>`,T+=`<rect class="dt-shell-stand" x="${u/2-b*.15}" y="${M+80}" width="${b*.3}" height="14" rx="7"/>`,T+=`<rect class="dt-shell-body" x="${A}" y="0" width="${b}" height="${M}" rx="${r.body}"/>`}else{let E=b+(r.extraW??0),F=(u-E)/2,dt=r.extraH??16;T+=`<path class="dt-shell-body" d="M${A} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${b-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${M}H${A}z"/>`,T+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${F} ${M}h${E}v${dt-8}a8 8 0 0 1-8 8H${F+8}a8 8 0 0 1-8-8z"/>`,T+=`<rect class="dt-shell-lip" x="${u/2-b*.07}" y="${M}" width="${b*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${u} ${h}" width="${u}" height="${h}" aria-hidden="true">${T}${y}</svg>`}var ih={"safari-ios":n=>{let r=n.shell==="home"?20:n.w>=400?62:59;return{top:r,bottom:98,topMin:r,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},rh=({d:n,now:r,cutout:u},h)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${ut.signal}${ut.wifi}</span><b>${qa(r)}</b><span class="dt-sb-r">${ut.battery}</span></div>`;let g=u??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${qa(r)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${ut.signal}${ut.wifi}${ut.battery}</span></div>`},lh=({d:n,host:r,min:u},h)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return u?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${f(r)}</span>${g}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${ut.back}</button><span class="dt-glass dt-ios-url"><span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ut.reload}</button></span><span class="dt-glass dt-glass--round">${ut.dots}</span></div>${g}</div>`},dh=({now:n,min:r},u)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Hr(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${ut.wifi}${ut.signal}${ut.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${ut.tune}<span>${f(u)}</span></span><span class="dt-and-tabs">1</span>${ut.dotsV}</div>`),ch=()=>`<div class="dt-and-nav">${ut.recent}${ut.home}${ut.navBack}</div>`,uh=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${qa(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${ut.wifi}${ut.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${ut.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ut.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ut.fwd}</button></span><span class="dt-ipad-url">${ut.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ut.reload}</button></span><span class="dt-bar-group">${ut.share}${ut.plus}${ut.tabs}</span></div>`,ph=({now:n,host:r},u)=>'<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>'+(u?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${ut.wifi}${ut.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${qa(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${ut.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ut.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ut.fwd}</button></span><span class="dt-mac-url">${ut.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ut.reload}</button></span><span class="dt-bar-group">${ut.share}${ut.plus}${ut.tabs}</span></div>`,mh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,hh=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(r||n)}</span>${ut.close}</span><span class="dt-win-new">${ut.plus}</span><span class="dt-win-ctrl">${ut.winMin}${ut.winMax}${ut.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${ut.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ut.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${ut.reload}</button></span><span class="dt-win-url">${ut.tune}<span>${f(n)}</span>${ut.star}</span><span class="dt-bar-group">${ut.user}${ut.dotsV}</span></div>`,gh=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,u)=>`<i style="--hue:${200+u*30}"></i>`).join("")}</span><span class="dt-win-tray">${ut.chevUp}${ut.wifi}${ut.volume}${ut.battery}<span class="dt-win-clock">${Hr(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function ru(n,r){let u=oh[n.shell](n),h=n.w+2*u.side,g=n.h+u.top+u.bottom,b=h+(u.extraW??0),M=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?u.extraH??0:0),A=(b-h)/2+u.side,y=ih[n.browser](n),T=r.min?y.topMin??y.top:y.top,E=r.min?y.bottomMin??y.bottom:y.bottom,F={...r,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=rh(F,T),J=lh(F,E);break;case"chrome-android":dt=dh(F,r.host),J=ch();break;case"safari-ipad":dt=uh(F),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=ph(F,n.shell==="macbook"),J=mh();break;case"chrome-windows":dt=hh(F),J=gh(F);break}return{footprint:{w:b,h:M},screen:{x:A,y:u.top,w:n.w,h:n.h,r:u.r,rb:u.rb??u.r},topH:T,bottomH:E,shell:ah(n,u,b,M,A),top:dt,bottom:J,canMinimize:y.topMin!==void 0&&(y.topMin!==y.top||y.bottomMin!==y.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var ys=null;function Ao(n){if(ys??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!ys||!n)return[0,0,0,0];ys.clearRect(0,0,1,1),ys.fillStyle="rgba(0, 0, 0, 0)",ys.fillStyle=n,ys.fillRect(0,0,1,1);let[r,u,h,g]=ys.getImageData(0,0,1,1).data;return[r,u,h,g/255]}var To=([n,r,u])=>`rgb(${n}, ${r}, ${u})`;function lu(n){let r=n.defaultView,u=J=>!J||Ao(J)[3]===0,h=[n.body,n.documentElement].map(J=>J&&r.getComputedStyle(J).backgroundColor).find(J=>J&&!u(J)),[g,b,M,A]=h?Ao(h):[255,255,255,1],y=[g,b,M].map(J=>Math.round(J*A+255*(1-A))),T=J=>{let[tt,q,At,Wt]=Ao(J);if(Wt>=.75)return To([tt,q,At]);let Ht=(it,ft)=>Math.round(it*Wt+ft*(1-Wt));return To([Ht(tt,y[0]),Ht(q,y[1]),Ht(At,y[2])])},E=J=>{let tt=n.elementFromPoint(r.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let q=r.getComputedStyle(tt);if(q.position!=="fixed"&&q.position!=="sticky")continue;let At=tt.getBoundingClientRect().width>=r.innerWidth*.9,Wt=q.backdropFilter&&q.backdropFilter!=="none";return At&&!Wt&&!u(q.backgroundColor)?T(q.backgroundColor):null}return null},F=n.querySelector('meta[name="theme-color"]')?.content||"",dt=F&&!u(F)?To(Ao(F)):"";return{top:E(4)??To(y),bottom:E(r.innerHeight-4)??To(y),theme:dt}}function Cr(n){let[r,u,h]=Ao(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*r+.7152*u+.0722*h>.4?"#000":"#fff"}function du(n){let{cfg:r,inFrame:u,persist:h,frame:g,frameEl:b,devicesMenu:M,bpBtns:A,notesOverlay:y,WIDE:T,bpOf:E,currentBp:F,deviceById:dt,notesOn:J,filter:tt,filterTo:q,dropFrameDrafts:At,putAway:Wt,tellFrame:Ht,syncBpButtons:it,render:ft,reread:Ft}=n,_t=r.breakpoints,Lt=document.querySelector(".dt-device"),se=document.querySelector(".dt-shell"),ye=document.querySelector('.dt-chrome[data-at="top"]'),le=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),S=[...document.querySelectorAll(".dt-frame-handle")],k=document.querySelector(".dt-frame-size"),z=document.querySelector(".dt-frame-rotate"),K=document.querySelector(".dt-frame-bars"),x="overlay",O="",mt="dt-w",Ct="dt-canvas",Bt="dt-device",ht=pt.getItem(Ct)==="1",St=pt.getItem(Bt)||"";St&&!dt(St)&&(St="",pt.setItem(Bt,""));let Z=Number(pt.getItem(mt))||0,oe="dt-emu",jt=(()=>{try{return JSON.parse(pt.getItem(oe)||"null")}catch{return null}})(),Ot=()=>jt?Eo.find(B=>B.id===jt.id)??null:null,Jn=()=>{let B=Ot();return B?jt.turned?{w:B.h,h:B.w}:{w:B.w,h:B.h}:null},pn=pt.getItem("dt-bars-min")==="1",Le=B=>{jt=B,h(oe,B?JSON.stringify(B):"")},L=B=>{k.textContent=B,g.style.setProperty("--dt-badge-w",`${k.offsetWidth}px`)},w=B=>{if(!B){me.innerHTML="";return}let P="";for(let Y=0;Y<=B;Y+=50)P+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of _t)for(let qt of[Y.min,Y.max])qt>0&&Number.isFinite(qt)&&qt<=B&&(P+=`<span class="dt-edge" style="left:${qt}px" title="${Y.label} edge"></span>`);me.innerHTML=P,me.style.width=`${B}px`},H=()=>{let B=parseFloat(Lt.style.width)||0,P=parseFloat(Lt.style.height)||0;if(!B||!P){Lt.style.transform="",delete Lt.dataset.scaled;return}let Y=St||jt?Math.min(1,(innerWidth-80)/B,(innerHeight-120)/P):Math.min(1,(innerWidth-80)/B);Lt.style.transform=Y<1?`scale(${Y})`:"",Lt.dataset.scaled=Y<1?String(Math.round(Y*100)):""},D=B=>Eo.find(P=>P.w===B.w&&P.h===B.h&&P.cutout?.shape==="pill")?.cutout,j=()=>{try{return b.contentDocument}catch{return null}},vt=()=>j()?.title.split("\u2014").pop()?.trim()||"",xt=()=>{let B=j(),P=St?dt(St):null;if(!B?.body||!P)return;let Y=lu(B),qt=P.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Xt=P.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Lt.style.setProperty("--dt-top",qt),Lt.style.setProperty("--dt-top-ink",Cr(qt)),Lt.style.setProperty("--dt-bottom",Xt),Lt.style.setProperty("--dt-bottom-ink",Cr(Xt));let we=ye.querySelector(".dt-win-tab > span");we&&(we.textContent=vt()||location.host)},st=0;b.addEventListener("load",()=>{let B=j();if(!B)return;let P=window.__notemendHosted;if(P&&!b.contentWindow?.__notemendHosted&&!B.querySelector(`script[src^="${P.base}/bar.js"]`)){let Y=B.createElement("script");Y.src=`${P.base}/bar.js`,Y.dataset.project=P.project,B.head.append(Y)}xt(),b.contentWindow?.addEventListener("scroll",()=>{st||(st=requestAnimationFrame(()=>{st=0,xt()}))},{passive:!0})});for(let B of[ye,le])B.addEventListener("click",P=>{let Y=P.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let qt=b.contentWindow?.navigation;if(!j()||!qt)throw new Error("foreign");Y==="back"?qt.canGoBack&&qt.back():Y==="fwd"?qt.canGoForward&&qt.forward():qt.reload()}catch{(Y==="reload"||Y==="back")&&(b.src=location.href)}});K.addEventListener("click",()=>{pn=!pn,h("dt-bars-min",pn?"1":"0"),gt()});let et=[],ct=B=>{for(let P of et)P.inert=!1;et=B?[...document.body.children].filter(P=>P instanceof HTMLElement&&!P.inert&&!P.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let P of et)P.inert=!0},gt=()=>{if(u)return;let B=St?dt(St)??null:null;if(St&&!B&&(St="",pt.setItem(Bt,"")),!B&&!ht){let P="";try{let Y=b.getAttribute("src")?b.contentWindow?.location:null;Y?.origin===location.origin&&(P=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,ct(!1),b.removeAttribute("src"),ne.toggle("dt-framing",!1),y.hidden=!J(),me.innerHTML="",it(),z.hidden=!0,K.hidden=!0,q(null),O="",At(),it(),Se(),P&&P!==location.pathname+location.search+location.hash){location.assign(P);return}Ft();return}if(g.hidden=!1,ct(!0),ne.toggle("dt-framing",!0),y.hidden=!0,b.src||(b.src=location.href),B){let P=ru(B,{host:location.host,title:vt(),now:new Date,min:pn,cutout:D(B)}),{screen:Y}=P;g.dataset.mode="device",Lt.dataset.shell=B.shell,Lt.dataset.browser=B.browser,Lt.style.width=`${P.footprint.w}px`,Lt.style.height=`${P.footprint.h}px`,Lt.style.setProperty("--dt-r",`${Y.r}px`),Lt.style.setProperty("--dt-rb",`${Y.rb}px`),se.innerHTML=P.shell;let qt=(rt,ge,Zn,Qn)=>{rt.innerHTML=Qn,rt.style.cssText=`left:${Y.x}px;top:${ge}px;width:${Y.w}px;height:${Zn}px`};qt(ye,Y.y,P.topH,P.top),qt(le,Y.y+Y.h-P.bottomH,P.bottomH,P.bottom);let Xt=Y.h-P.topH-P.bottomH;b.style.position="absolute",b.style.left=`${Y.x}px`,b.style.top=`${Y.y+P.topH}px`,b.style.width=`${Y.w}px`,b.style.height=`${Xt}px`,me.innerHTML="";let we=pn&&P.canMinimize;x=P.scrollbar,O=`${B.label}${we?" \xB7 bars folded":""}`,q(E(B.w)),Ht({notes:J(),scrollbar:x,device:O}),K.hidden=!P.canMinimize,K.setAttribute("aria-pressed",String(we)),L(`${B.label} ${B.w}\xD7${B.h} \xB7 page ${B.w}\xD7${Xt}${we?" \xB7 bars folded":""} \xB7 ${_t.find(rt=>rt.id===tt())?.label??""}`),xt()}else{let P=Jn();P||Le(null);let Y=P?.w||Z||_t.find(we=>we.id===F()).ideal;Z=Y,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,se.innerHTML=ye.innerHTML=le.innerHTML="",ye.style.cssText=le.style.cssText="",K.hidden=!0,x="overlay",Lt.style.width=`${Y}px`,Lt.style.height=`${P?.h??innerHeight-84}px`,b.style.position="",b.style.left=b.style.top="",b.style.width="100%",b.style.height="100%",w(Y),Ht({notes:J()});let qt=_t.find(we=>we.id===E(Y)),Xt=Ot();O=Xt?`${Xt.label}${jt?.turned?" \xB7 landscape":""}`:"",Ht({scrollbar:x,device:O}),L(Xt&&P?`${Xt.label} \xB7 ${P.w}\xD7${P.h} \xB7 ${qt.label}`:`${Y}px \xB7 ${qt.label}`),q(E(Y))}z.hidden=!(Ot()?.rotates&&!B),Se(),H(),it(),Ft()},Rt=B=>{let P=_t.find(Y=>Y.id===B);St="",pt.setItem(Bt,""),Le(null),ht=F()!==B,Z=ht?P.ideal:0,q(ht?B:null),pt.setItem(Ct,ht?"1":"0"),pt.setItem(mt,String(Z)),Wt(),gt()};for(let B of A)B.addEventListener("click",()=>Rt(B.dataset.bp));for(let B of document.querySelectorAll("[data-device]"))B.addEventListener("click",()=>{St=B.dataset.device===St?"":B.dataset.device,pt.setItem(Bt,St),M.open=!1,gt()});for(let B of document.querySelectorAll("[data-emu]"))B.addEventListener("click",()=>{let P=jt?.id===B.dataset.emu&&!St;St="",pt.setItem(Bt,""),Le(P?null:{id:B.dataset.emu,turned:!1}),ht=!P,Z=0,pt.setItem(Ct,ht?"1":"0"),q(null),Wt(),M.open=!1,gt()});z.addEventListener("click",()=>{jt&&(Le({...jt,turned:!jt.turned}),Wt(),gt())});let ve=[...M.querySelectorAll("[data-tab]")],Fe=[...M.querySelectorAll("[data-panel]")],Ee=B=>{for(let P of ve)P.setAttribute("aria-selected",String(P.dataset.tab===B));for(let P of Fe)P.hidden=P.dataset.panel!==B;h("dt-devices-tab",B)};for(let B of ve)B.addEventListener("click",()=>Ee(B.dataset.tab));Ee(pt.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Ut=M.querySelector(".dt-emu-search");Ut.addEventListener("input",()=>{let B=Ut.value.trim().toLowerCase(),P=null,Y=!1,qt=()=>{P&&(P.hidden=!Y)};for(let Xt of Ut.parentElement.children){if(Xt.classList.contains("dt-devices-group")){qt(),P=Xt,Y=!1;continue}Xt.dataset.emu&&(Xt.hidden=!!B&&!Xt.textContent.toLowerCase().includes(B),Y||=!Xt.hidden)}qt()});let ue=M.querySelector(".dt-devices-name");function Se(){for(let P of M.querySelectorAll("[data-device]"))P.setAttribute("aria-pressed",String(P.dataset.device===St));let B=!St&&!g.hidden?jt?.id:void 0;for(let P of M.querySelectorAll("[data-emu]"))P.setAttribute("aria-pressed",String(P.dataset.emu===B));ue.textContent=St&&dt(St)?.label||B&&Ot()?.label||"Device"}let he=B=>_t.find(P=>P.id===B),je=B=>{let P=he(tt()??F());return Math.max(P.min||320,Math.min(Number.isFinite(P.max)?P.max:2560,Math.round(B)))};for(let B of S){let P=B.dataset.edge==="l"?-1:1;B.addEventListener("pointerdown",Y=>{if(St)return;Y.preventDefault(),jt&&(Le(null),gt()),B.setPointerCapture(Y.pointerId);let qt=Y.clientX,Xt=Z,we=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let rt=Zn=>{Z=je(Xt+P*(Zn.clientX-qt)*2/we),Lt.style.width=`${Z}px`,w(Z),L(`${Z}px \xB7 ${he(E(Z)).label}`),H()},ge=()=>{B.removeEventListener("pointermove",rt),B.removeEventListener("pointerup",ge),B.removeEventListener("pointercancel",ge),delete g.dataset.dragging,pt.setItem(mt,String(Z)),gt()};B.addEventListener("pointermove",rt),B.addEventListener("pointerup",ge),B.addEventListener("pointercancel",ge)}),B.addEventListener("dblclick",()=>{if(St)return;Le(null);let Y=he(tt()??F()),qt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];Z=Math.abs(Z-qt[0])<Math.abs(Z-qt[1])?qt[0]:qt[1],pt.setItem(mt,String(Z)),gt()})}let ws=F(),Cn=()=>{let B=_t.find(P=>P.id===T);return ht&&!St&&!jt&&Z===B.ideal&&innerWidth>=B.min};return addEventListener("resize",()=>{if(Cn()){Rt(T);return}it(),F()!==ws&&(ws=F(),ft()),g.hidden||(!St&&!jt&&(Lt.style.height=`${innerHeight-84}px`),H())}),{apply:gt,pickBp:Rt,look:()=>({scrollbar:x,device:O}),restore:()=>{Cn()?Rt(T):ht||St?gt():Se()}}}var cu='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none"/></svg>',uu='<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>',fh='<svg viewBox="0 0 20 20" width="10" height="10" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="3"/><path d="M10 3v14"/></svg>',bh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function pu(n){let{bp:r,notes:u,breakpoints:h,bandOfNote:g,showResolved:b,showArchived:M,drafts:A,find:y}=n,T=u.filter(x=>g(x)===r),E=x=>[x.text,x.note,x.byName,...(x.replies??[]).filter(O=>!O.deleted).map(O=>O.text)].join(" ").toLowerCase(),F=x=>y.view==="me"?n.forMe(x):y.view==="agent"?n.forAgent(x):!0,dt=x=>Date.parse(x.updatedAt||x.createdAt||"")||0,J=x=>Date.parse(x.createdAt||"")||0,tt=T.filter(x=>F(x)&&(!y.q||E(x).includes(y.q.trim().toLowerCase()))).sort((x,O)=>y.sort==="old"?J(x)-J(O):y.sort==="new"?J(O)-J(x):(y.sort==="unread"?Number(n.unread(O))-Number(n.unread(x)):0)||dt(O)-dt(x)),q={open:[],claude:[],done:[],archived:[]};for(let x of tt)q[It(x)==="done"&&n.archived(x)?"archived":It(x)].push(x);let At=x=>{let O=It(x),mt=n.orphan(x),Ct=n.unread(x),Bt=n.picking&&n.pickable(x),ht=!!Bt&&n.picking.has(x.id),St=n.mirror(x),Z=Gn(x.updatedAt||x.createdAt),oe=St?`<i class="dt-hist-mirror"${St==="there"?` data-tip="In Team too \xB7 ${f(Z)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${fh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${O}${O==="done"?n.archived(x)?" is-archived":" is-resolved":""}${mt?" is-orphan":""}${Ct?" is-unread":""}${n.menuFor===x.id?" is-menu":""}${ht?" is-picked":""}${n.picking&&!Bt?` is-unpickable${St?" is-dim":""}`:""}">
|
|
208
|
+
<button class="dt-hist-go" data-go="${x.id}" data-tip="${f(x.text.slice(0,80))}"${Bt?` role="checkbox" aria-checked="${ht}"`:""}>
|
|
209
|
+
${Bt?`<span class="dt-hist-pick" aria-hidden="true"><i class="dt-hist-box">${ht?xe:""}</i></span>`:n.marker(x)}
|
|
210
210
|
<span class="dt-hist-body">
|
|
211
|
-
<span class="dt-hist-id"><b class="dt-hist-who">${f(
|
|
212
|
-
<span class="dt-hist-text">${f(
|
|
211
|
+
<span class="dt-hist-id"><b class="dt-hist-who">${f(x.byName||"You")}</b>${oe}${St==="there"?"":`<em>\xB7 ${Z}</em>`}${Ct?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
|
|
212
|
+
<span class="dt-hist-text">${f(Mc(x.text||x.note))}</span>${n.replied(x)}
|
|
213
213
|
</span>
|
|
214
214
|
</button>
|
|
215
|
-
<span class="dt-note-tools dt-hist-tools">${n.tick(
|
|
216
|
-
</div>`},Wt=
|
|
217
|
-
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${
|
|
218
|
-
>${
|
|
219
|
-
<button class="dt-hist-go" data-draft-go="${
|
|
220
|
-
${n.draftFace||`<span class="dt-hist-n">${
|
|
215
|
+
<span class="dt-note-tools dt-hist-tools">${n.tick(x)}${n.assign(x)}<button type="button" class="dt-hist-more" data-row-more="${x.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===x.id}">${cu}</button>${n.rowMenu(x)}</span>
|
|
216
|
+
</div>`},Wt=h.map(x=>{let O=u.filter(mt=>g(mt)===x.id&&It(mt)!=="done");return{band:x,open:O.filter(mt=>It(mt)==="open").length,total:O.length}}).filter(x=>x.total&&x.band.id!==r),Ht=Wt.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${Wt.map(({band:x,open:O,total:mt})=>{let Ct=`${x.label}: ${O} open \xB7 ${mt-O} to check`;return`<button data-bp="${x.id}" data-state="${O?"open":"claude"}" title="${Ct}" aria-label="${Ct}"
|
|
217
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${x.icon}</svg><i>${mt}</i></button>`}).join("")}</div>`:"",it=["open","claude","done","archived"],ft={...Vc,archived:"Archived"},Ft=(x,O,mt)=>`<button type="button" class="dt-hist-gfold" data-gfold="${x}" aria-expanded="${!n.shut(x)}"
|
|
218
|
+
>${_t[x]??""}${O}<em>${mt}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut(x)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,_t={open:Ke("#0d99ff",0),claude:Ke("#8e4ec6",.5),done:Ke("#30a46c",1),archived:Ke("#717171",1)},Lt=n.cap,se=it.filter(x=>q[x].length&&(x==="done"?b:x==="archived"?M:!0)),ye=x=>`<div class="dt-hist-row is-draft">
|
|
219
|
+
<button class="dt-hist-go" data-draft-go="${x.i}">
|
|
220
|
+
${n.draftFace||`<span class="dt-hist-n">${Kn}</span>`}
|
|
221
221
|
<span class="dt-hist-body">
|
|
222
|
-
<span class="dt-hist-id">${n.draftFace?`<b class="dt-hist-who">${f(n.draftName)}</b><em>\xB7 draft \xB7 ${f(
|
|
223
|
-
<span class="dt-hist-text">${
|
|
222
|
+
<span class="dt-hist-id">${n.draftFace?`<b class="dt-hist-who">${f(n.draftName)}</b><em>\xB7 draft \xB7 ${f(x.el)}</em>`:f(x.el)}${x.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
223
|
+
<span class="dt-hist-text">${x.text?f(x.text):`${x.shots} screenshot${x.shots===1?"":"s"}`}</span>
|
|
224
224
|
</span>
|
|
225
|
-
</button>${n.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${
|
|
226
|
-
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${
|
|
227
|
-
</div>`,
|
|
228
|
-
<label class="dt-hist-search">${
|
|
225
|
+
</button>${n.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${Kn}</span></span>`:""}
|
|
226
|
+
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${x.i}" title="Discard this draft">${Un}</button></span></span>
|
|
227
|
+
</div>`,le=T.filter(x=>It(x)!=="done"),me=(x,O,mt,Ct,Bt)=>`<button type="button" role="menuitemradio" aria-checked="${Ct}" ${x}="${O}"><i>${Ct?xe:""}</i><span>${mt}</span>${Bt==null?"":`<em>${Bt}</em>`}</button>`,S=()=>`<div class="dt-hist-find">
|
|
228
|
+
<label class="dt-hist-search">${uu}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(y.q)}" spellcheck="false">${y.q?`<button type="button" data-hist-clear aria-label="Clear search">${Tn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
|
|
229
229
|
<button type="button" class="dt-tip-r dt-hist-filter${y.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${y.menu}" data-tip="Filter">${bh}</button>
|
|
230
|
-
${y.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",y.view==="me",
|
|
231
|
-
</div>`,k=(
|
|
232
|
-
<button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${
|
|
230
|
+
${y.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",y.view==="me",le.filter(n.forMe).length)}${me("data-hist-view","agent","Agent",y.view==="agent",le.filter(n.forAgent).length)}${me("data-hist-view","all","All",y.view==="all",le.length)}</div>`:""}
|
|
231
|
+
</div>`,k=(x,O,mt,Ct)=>`<button type="button" role="menuitemcheckbox" ${x} aria-checked="${O}"><span>${mt}</span><kbd>${Ct}</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>`,z=x=>x.map(O=>O.id).join(","),K=()=>`<div class="dt-hist-menu is-panel" role="menu">
|
|
232
|
+
<button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${q.open.length?`<button type="button" role="menuitem" data-resolve-all="${z(q.open)}"><span>Resolve all open</span><em>${q.open.length}</em></button>`:""}${n.mirrorAll.length?`<button type="button" role="menuitem" data-mirror-all="${n.mirrorAll.join(",")}"><span>Mirror all open to Team</span><em>${n.mirrorAll.length}</em></button>`:""}${n.archives&&q.done.length?`<button type="button" role="menuitem" data-archive-all="${z(q.done)}"><span>Archive all resolved</span><em>${q.done.length}</em></button>`:""}<hr>${k("data-resolved",b,"Show resolved","R")}${n.archives?k("data-archived",M,"Show archived","A"):""}<hr>
|
|
233
233
|
<p class="dt-hist-menu-head">Sort</p>${me("data-hist-sort","new","Newest first",y.sort==="new")}${me("data-hist-sort","old","Oldest first",y.sort==="old")}${me("data-hist-sort","reply","Last reply",y.sort==="reply")}${me("data-hist-sort","unread","Unread first",y.sort==="unread")}</div>`;return`<div class="dt-hist-head">
|
|
234
234
|
<span class="dt-hist-here"
|
|
235
235
|
><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="13" rx="2"/><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5"/></svg></span>
|
|
236
236
|
<span class="dt-hist-title">Threads</span>
|
|
237
237
|
${n.clients?'<span class="dt-hist-space"><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true"><circle cx="9" cy="7" r="3"/><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9"/><path d="M14.5 12.5l1.2 1.2 2.3-2.4"/></svg>Client</span>':""}
|
|
238
|
-
${
|
|
238
|
+
${Ht}
|
|
239
239
|
${n.checks&&!n.clients?`<button class="dt-review-btn" data-review aria-label="Check all ${n.checks} ${n.checks===1?"fix":"fixes"}" data-tip="${n.checks} ${n.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${n.checks}</button>`:""}
|
|
240
|
-
<button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${y.more}">${
|
|
240
|
+
<button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${y.more}">${cu}</button>${y.more&&!n.folded?K():""}
|
|
241
241
|
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!n.folded}">
|
|
242
242
|
<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>
|
|
243
243
|
</button>
|
|
244
|
-
</div>`+(n.folded?"":S()+(
|
|
244
|
+
</div>`+(n.folded?"":S()+(se.length||A.length?`<div class="dt-hist-list">${A.length?`<p class="dt-hist-group">${Ft("drafts","Drafts",A.length)}</p>${n.shut("drafts")?"":A.map(ye).join("")}`:""}${se.map(x=>{if(n.shut(x))return`<p class="dt-hist-group">${Ft(x,ft[x],q[x].length)}</p>`;let O=q[x].slice(0,Math.max(0,Lt));Lt-=O.length;let mt=q[x].slice(O.length).find(Bt=>Bt.id===n.keep);mt&&O.push(mt);let Ct=q[x].length-O.length;return`<p class="dt-hist-group">${Ft(x,ft[x],q[x].length)}</p>${O.map(At).join("")}${Ct?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${Ct} more in ${ft[x]}</button>`:""}`}).join("")}</div>`:y.q.trim()?`<div class="dt-hist-empty">${uu}<p>No threads match \xAB${f(y.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:y.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<div class="dt-hist-empty is-blank"><i><svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><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-2zM10 6v5M7.5 8.5h5" stroke-linejoin="round"/></svg></i>${q.done.length||q.archived.length?"<b>Everything here is resolved.</b>":b?"<b>No threads at this breakpoint yet</b><p>Click anything on the page to leave one.</p>":"<b>Nothing open at this breakpoint</b><p>Resolved threads are hidden \u2014 \xABShow resolved\xBB below brings them back.</p>"}</div>`)+(n.picking?`<div class="dt-hist-foot is-picking" role="toolbar" aria-label="Selected threads"><span class="dt-hist-sel" aria-live="polite">${n.picking.size} selected</span
|
|
245
245
|
><button type="button" data-pick-mirror${n.picking.size?"":" disabled"}><kbd>M</kbd>Mirror to Team</button><button type="button" data-pick-cancel><kbd>Esc</kbd>Cancel</button></div>`:`<div class="dt-hist-foot">
|
|
246
246
|
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${b}"
|
|
247
247
|
><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
|
|
248
248
|
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
249
|
-
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${
|
|
250
|
-
>${
|
|
251
|
-
</div>`))}function
|
|
252
|
-
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${Ft?"":" disabled"}>${
|
|
253
|
-
<span class="dt-review-n">${
|
|
254
|
-
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${
|
|
255
|
-
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${
|
|
256
|
-
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${
|
|
257
|
-
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Sn}</button>`,tt.hidden=!1};tt.addEventListener("click",async at=>{let vt=at.target.closest("[data-r]"),Ft=dt();if(!vt||!Ft)return;if(vt.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(vt.dataset.r==="prev"){Tt();return}let zt=Ft.ids[Ft.i];J({...Ft,i:Ft.i+1});let Lt=u().find(be=>be.id===zt),ne=vt.dataset.r==="ok"&&Lt?T(Lt):vt.dataset.r==="no"?b(zt,!1):null;Wt(),await ne});let Tt=()=>{let at=dt();if(at){for(let vt=at.i-1;vt>=0;vt--)if(x(at.ids[vt])){J({...at,i:vt}),Wt();return}}};return document.addEventListener("keydown",at=>{tt.hidden||at.metaKey||at.ctrlKey||at.altKey||at.key!=="ArrowLeft"&&at.key!=="ArrowRight"||at.target.closest?.("input, textarea, select, [contenteditable]")||(at.preventDefault(),at.key==="ArrowLeft"?Tt():tt.querySelector('[data-r="skip"]')?.click())}),{start:St,toCheck:O,resume:()=>{dt()&&Wt()}}}function uu(n,r){let u=null,p=null,g=document.querySelector(".dt-turbo"),b="/notemend:turbo",E=()=>{let H=!!u&&Date.now()-Date.parse(u.at)<18e4,y=H?u.mode==="push"?"push":p?.paused?"paused":"on":"none",T=H?Wn(u.agent):"",x=y==="none"?`Turbo is off. Run ${b} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:y==="push"?`Push mode: ${T} takes threads when you press Push to the agent. For live, run ${b} instead`:y==="on"?`Turbo on: ${T} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${T} is listening but waits \u2014 click to resume`;g.dataset.state=y,g.dataset.tip=x,g.setAttribute("aria-label",x),g.setAttribute("aria-checked",String(y==="on")),n&&(g.hidden=!0)};return setInterval(E,3e4),g.addEventListener("click",async()=>{let H=g.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(b).catch(()=>{}),r(`Copied ${b} \u2014 paste it in Claude Code`);return}let y=H==="on"?"off":"on";p={paused:y==="off"},E();try{let T=await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:y})});if(!T.ok)throw new Error(String(T.status));r(y==="off"?"Turbo paused":"Turbo on")}catch{p={paused:y==="on"},E(),r("Could not switch turbo \u2014 try again")}}),H=>{u=H.listening??null,p=H.turbo??null,E()}}var yh=new Set(["data-wired","data-nudge"]),vh=".dt-note",pu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),So=n=>{if(!(n instanceof Element))return null;let r=n.dataset;return r.msg?`m:${r.msg}`:r.id?`${n.tagName}:${n.classList[0]??""}:${r.id}`:"draft"in r?`${n.tagName}:draft`:r.parked?`${n.tagName}:parked:${r.parked}`:r.k?`${n.tagName}:k:${r.k}`:null},mu=(n,r)=>n.nodeType===r.nodeType&&n.nodeName===r.nodeName&&So(n)===So(r);function wh(n,r){for(let{name:u}of[...n.attributes])!r.hasAttribute(u)&&!yh.has(u)&&n.removeAttribute(u);for(let{name:u,value:p}of r.attributes)n.getAttribute(u)!==p&&n.setAttribute(u,p);n instanceof HTMLInputElement&&r instanceof HTMLInputElement&&(n.checked!==r.checked&&(n.checked=r.checked),n!==document.activeElement&&n.value!==r.value&&(n.value=r.value))}function hu(n,r){let u=[...n.childNodes].filter(y=>!pu(y)),p=new Map;for(let y of u){let T=So(y);T&&p.set(T,y)}let g=new Set,b=0,E=[];for(let y of[...r.childNodes]){let T=So(y),x=T?p.get(T):void 0;if(!T){for(;b<u.length&&(g.has(u[b])||So(u[b]));)b++;b<u.length&&mu(u[b],y)&&(x=u[b++])}x&&!g.has(x)&&mu(x,y)?(g.add(x),$h(x,y),E.push(x)):E.push(y)}for(let y of u)g.has(y)||(y instanceof HTMLElement&&y.matches(vh)&&Qc(y),n.removeChild(y));let H=n.firstChild;for(let y of E){for(;H&&pu(H);)H=H.nextSibling;if(y===H){H=H.nextSibling;continue}n.insertBefore(y,H)}}function $h(n,r){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==r.nodeValue&&(n.nodeValue=r.nodeValue);return}if(!(!(n instanceof Element)||!(r instanceof Element))){if(wh(n,r),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==r.value&&(n.value=r.value);return}if(n instanceof SVGElement){n.innerHTML!==r.innerHTML&&(n.innerHTML=r.innerHTML);return}hu(n,r),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==r.value&&(n.value=r.value)}}function kr(n,r){let u=document.createElement("template");u.innerHTML=r,hu(n,u.content)}function gu(n,r,u=!1){let p=n.breakpoints,g=n.categories,b=(p.find(t=>!Number.isFinite(t.max))??p[0]).id,E=t=>p.find(e=>t>=e.min&&t<=e.max)?.id??b,H=(t,e)=>{let s=E(t);if(Bs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...p].sort((l,d)=>l.min-d.min),a=e<500?E(767):(o[o.length-2]??o[0]).id,i=l=>o.findIndex(d=>d.id===l);return i(s)>i(a)?a:s},y=t=>t.breakpoint||b,T=t=>n.devices.find(e=>e.id===t),x=Bs,D=(t,e)=>{x||mt.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??B).find(a=>a.id===t.id),s=J.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},O=t=>t.replace(/\/+$/,"")||"/",St=O(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 Wt=document.querySelector(".dt-grid-btn"),Tt=document.querySelector(".dt-grid-overlay"),at=Tt.querySelector(".dt-overlay-grid"),vt=Tt.querySelector(".dt-grid-chip"),Ft="dt-grid",zt=n.projectGrid??null,Lt=()=>H(innerWidth,innerHeight),ne=()=>zt?.mode==="custom"?zt.widths?.[Lt()]??null:null,be=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),re=t=>be(t).length,me=()=>{let t=Tt.hidden;t&&(Tt.style.visibility="hidden",Tt.hidden=!1);try{return S()}finally{t&&(Tt.hidden=!0,Tt.style.visibility="")}},S=()=>{let t=document.documentElement.clientWidth;Tt.classList.remove("is-auto");let e=getComputedStyle(at);if(e.display==="grid"&&re(e)>1){let i=at.getBoundingClientRect();return{cols:re(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(i.left),w:Math.round(i.width),from:"site"}}let s=null,o=null;for(let i of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(i.closest(fs)||Tt.contains(i))continue;let l=i.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(i);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let m=parseFloat(d.paddingLeft)||0;s={x:l.left+m,w:l.width-m-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let c=d.display.endsWith("grid")?be(d):[];if(c.length>1){if(!c.every(v=>Math.abs(v-c[0])<2))continue;let m=parseFloat(d.columnGap)||0;o={cols:c.length,gap:m,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:c.reduce((v,A)=>v+A,0)+m*(c.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let m=[...i.children].map(A=>A.getBoundingClientRect()).filter(A=>A.width&&A.height),v=m.filter(A=>Math.abs(A.top-m[0].top)<2).sort((A,j)=>A.left-j.left);v.length>1&&v.every(A=>Math.abs(A.width-v[0].width)<2)&&(o={cols:v.length,gap:Math.max(0,v[1].left-v[0].right),x:v[0].left,w:v.at(-1).right-v[0].left})}}let a=i=>({...i,gap:Math.round(i.gap),x:Math.round(i.x),w:Math.round(i.w)});return a(o?{...o,...s??{},from:"page"}:{cols:n.grid.columns,gap:innerWidth<768?16:24,...s??{x:24,w:t-48},from:"guess"})},k=null,W=(t,e,s,o)=>{Tt.classList.add("is-auto"),at.children.length!==t&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),Tt.style.setProperty("--grid-x",`${s}px`),Tt.style.setProperty("--grid-w",`${o}px`),Tt.style.setProperty("--grid-gap",`${e}px`)},U=()=>{let t=ne(),e=vt.querySelector("span");if(vt.querySelector("button").hidden=!t||x,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));W(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}at.children.length!==n.grid.columns&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),k=me(),k.from!=="site"&&W(k.cols,k.gap,k.x,k.w),e.textContent=k.from==="guess"?`Guessed \xB7 ${k.cols} \xD7 ${k.w}`:`From the page \xB7 ${k.cols} \xD7 ${k.w} \xB7 gap ${k.gap}`},$=()=>{vt.classList.remove("is-lifted");let t=vt.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();vt.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},I=t=>{Tt.hidden=!t,t&&(U(),$()),Wt.setAttribute("aria-pressed",String(t)),D(Ft,t?"1":"0"),We({grid:t})};Wt.addEventListener("click",()=>I(Tt.hidden===!0)),addEventListener("resize",()=>{Tt.hidden||(U(),$())});let ht=document.querySelector(".dt-pages-name"),At=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:O(t.location.pathname),title:t.document.title}:null}catch{return null}},Ht=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},gt=()=>{let e=At()?.route??St,s=null;for(let l of document.querySelectorAll(".dt-pages a"))O(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");Ht();let i=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);ht.textContent=e==="/"?"":e.replace(/^\//,""),ht.closest("summary").toggleAttribute("data-home",e==="/")},Et=(!!n.gridAdmin||!!n.arrange)&&!n.client,Q=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),se=new Set((()=>{try{return JSON.parse(mt.getItem("dt-folders-open")||"[]")}catch{return[]}})()),jt=new Set((()=>{try{return JSON.parse(mt.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),Bt=document.querySelector(".dt-pages-list"),Un=()=>gt(),dn=t=>xt(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Le=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(Q.flatMap(d=>d.pages)),s=d=>Oc(n,d,St,Et),o=d=>Q.filter(c=>(c.parent&&Q.some(m=>m.id===c.parent)?c.parent:null)===d),a=d=>d.pages.includes(St)||o(d.id).some(a),i=(d,c)=>s(d).replace("<li",`<li style="--d:${c}"`),l=(d,c)=>{let m=se.has(d.id)||!jt.has(d.id)&&a(d),v=d.pages.map(j=>t.get(j)).filter(j=>!!j),A=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${c}"${m?" data-open":""}${Et?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${m}">${$o}${dn(m)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(Et?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${xt('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${m?"":" hidden"}>${A.map(j=>l(j,c+1)).join("")}${v.map(j=>i(j,c+1)).join("")}${v.length||A.length?"":`<li class="dt-folder-empty" style="--d:${c+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};Bt.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>i(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!Et,Un()};Le();let L=document.querySelector(".dt-pages");L&&!L.querySelector("li")&&L.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let w=[...document.querySelectorAll(".devtools details, .dt-strip details")],C=!1,q=t=>Kn(t,()=>{t.open=!1}),F=()=>{let t=w.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)q(e);return t};for(let t of w)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Eo(t)):t.open&&(e.preventDefault(),q(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=F();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{C=w.some(e=>e.open&&!e.contains(t.target))&&F().length>0},!0),addEventListener("blur",F);let wt=document.querySelector(".dt-pad-overlay"),$t="dt-inspect",ot=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),et=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),ct={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},ft="",Nt=0,{spacer:ye,drawPads:Ie,drawSize:xe,drawType:Gt,drawColor:ce,drawBorder:Se,drawContrast:he,contrastFix:Oe,markCopied:gs}=Kc(wt),Hn=null,R=()=>{Hn&&ft&&P(Hn)},P=t=>{Hn=t,!Nt&&(Nt=requestAnimationFrame(()=>{Nt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(ot)){wt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),ft==="sizes"?xe(e):ft==="type"?Gt(e):ft==="color"?ce(e):ft==="contrast"?he(e):ft==="border"?Se(e):Ie(t.altKey?e:ye(e))}))},Y=t=>{ft=t;for(let[e,s]of Object.entries(ct))s.setAttribute("aria-pressed",String(e===t));D($t,t),We({inspect:t}),wt.hidden=!t,wt.innerHTML="",t?(document.addEventListener("mousemove",P),addEventListener("scroll",R,!0),addEventListener("resize",R)):(document.removeEventListener("mousemove",P),removeEventListener("scroll",R,!0),removeEventListener("resize",R))};document.addEventListener("click",t=>{ft!=="contrast"||!Oe()||t.target.closest?.(ot)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(Oe()).catch(()=>{}),gs(),R())},!0);for(let[t,e]of Object.entries(ct))e.addEventListener("click",()=>{t!==ft&&Qe(!1),Y(ft===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Kt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{x&&parent.postMessage({dt:!0,...o},location.origin)};ft?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):Tt.hidden||(I(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Pt=document.querySelector(".dt-notes-btn"),Yt=[...document.querySelectorAll(".dt-bp")],ve=document.querySelector(".dt-history-btn"),rt=document.querySelector(".dt-history"),ge=document.querySelector(".dt-elsewhere"),Yn=document.querySelector(".dt-studio-btn"),Xn=document.querySelector(".dt-devices"),Jn=document.querySelector(".dt-notes-hi"),xu=Jn.querySelector(".dt-hi-box"),Ar=Jn.querySelector(".dt-hi-tag"),yn=document.querySelector(".dt-frame"),Ge=document.createElement("div");Ge.className="dt-spot",Ge.hidden=!0,Ge.setAttribute("aria-hidden","true"),document.body.append(Ge);let Eu=t=>{if(!t||!Kt){Ge.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Ge.style.setProperty("--spot-x",`${e.left-s}px`),Ge.style.setProperty("--spot-y",`${e.top-s}px`),Ge.style.setProperty("--spot-w",`${e.width+s*2}px`),Ge.style.setProperty("--spot-h",`${e.height+s*2}px`),Ge.hidden&&(Jn.hidden=!0),Ge.hidden=!1},qs=yn.querySelector("iframe");qs.addEventListener("load",gt),new MutationObserver(gt).observe(yn,{attributes:!0,attributeFilter:["hidden"]});let Ra=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),fs=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Ba=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(fs).forEach(Ba);let Hr="dt-notes",B=[],Kt=!1,X=null,N=null,Pa=0,Ae="",Mu=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!Tn(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let i=getComputedStyle(a).position;if(i==="fixed"||i==="sticky")return!a.contains(t)}return!1},Cr=new WeakSet,Ao=null,Ho=null,qe={},Co=" \xB7 hidden \u2014 inside something closed",No=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};nt.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&No(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&No(e)},!0),nt.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete qe[s.dataset.id],s.remove())},!0);let Ee=[],Qt=null,De=[],ku=10,Ds=(t=N)=>!!(t&&((t.text?.trim().length??0)>=ku||t.images?.length)),nn=()=>{N&&Ds()&&De.push(N),N=null},Nr=0,Fs=()=>{if(!Ds()||performance.now()-Nr<4e3)return!0;Nr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&Mo(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Ut("Not sent \u2014 close again to keep it as a draft",2400),!1},cn=null,Ia=new Map,Oa=null,Rr=()=>`dt-draft:${n.me?.email??""}:${St}${x?":canvas":""}`,vn=Rr(),Ro=0,js=()=>{if(!N&&!De.length&&!Ae){mt.removeItem(vn);return}let t={draft:N,parked:De,reply:Ae?{for:cn,text:Ae}:null};try{localStorage.setItem(vn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(vn,JSON.stringify({...t,draft:N&&e(N),parked:De.map(e)}))}catch{}}},Zn=()=>{clearTimeout(Ro),Ro=setTimeout(js,200)};addEventListener("pagehide",()=>{clearTimeout(Ro),js();try{sessionStorage.setItem(`nm-open:${vn}`,X==null?"":String(X))}catch{}});let Fe=mt.getItem("dt-space")==="clients"?"clients":"studio",Ke=()=>!!n.me&&!n.client,wn=t=>!Ke()||Fe==="clients"===qt(t),Br=["all","nobody","mine","others","resolved","claude","wrote","check"],$n=Br.find(t=>t===mt.getItem("dt-pinf"))??"all",qa=()=>{},Bo=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Ue=mt.getItem("dt-resolved")!=="0",un=mt.getItem("dt-archived")==="1",Me=t=>Nc(t,n.autoArchive),Po=t=>Me(t)?un:Dt(t)!=="done"||Ue,oe={q:"",menu:!1,more:!1,view:["me","agent"].includes(mt.getItem("dt-view")??"")?mt.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(mt.getItem("dt-sort")??"")?mt.getItem("dt-sort"):"new"},Cn=null,Io=t=>yt.find(e=>e.from?.id===t.id&&Ps(e)),Da=t=>Ps(t)?yt.find(e=>e.id===t.from.id&&qt(e)):void 0,He=null,Oo=null,qo=()=>Ke()&&Fe==="clients",bs=t=>qo()&&qt(t)&&Dt(t)==="open"&&!Io(t),Fa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="2.5"/><path d="M10 3.5v13"/></svg>',Lu=t=>{let e=n.client?void 0:Da(t);if(!e)return"";let s=Sc(e);return`<button type="button" class="dt-field dt-field--bare dt-field--client" data-act="open-orig" data-id="${e.id}" data-tip="What the client sees now \u2014 open their thread" aria-label="The client sees: ${f(s)}. Open their thread"><span class="dt-field-box"><svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true">${wr.clients}</svg><span class="dt-field-label">Client \xB7 ${f(s)}</span><svg class="dt-field-ext" viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg></span></button>`},Su=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Tu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Au=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),s=e(Su),o=e(Tu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ja=()=>H(innerWidth,innerHeight),Xt=()=>Oa??ja(),Pr=()=>{let t=Xt();for(let e of Yt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:_a,poolOf:Wa,contextOf:za,resolveEl:Hu,anchorOf:Cu,anchorState:Nu,fingerprintOf:Do}=Xc(),ys=new Map,_s=()=>{ys=new Map},Ir=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Ce=t=>{let e=Ir(t),s=ys.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Hu(t),st:Nu(t)},ys.set(e,s)),s.el},Fo=t=>(Ce(t),ys.get(Ir(t))?.st??"found"),Ws=0,zs=null,jo="",Or=()=>{Ws=Math.max(Ws,scrollY+innerHeight)},qr=(t,e)=>e==="gone"&&!!t.spot&&(Or(),t.spot.y>Ws&&Ws<document.documentElement.scrollHeight-1);addEventListener("scroll",()=>{Or(),zs!=null&&Ws>=zs&&(zs=null,setTimeout(()=>{_s(),Z()},600))},{capture:!0,passive:!0});let Ru=t=>{let e=Fo(t);return(qr(t,e)?"later":e)+(Te(t)?"":" \xB7 no pin")},Dr=t=>{t.spot&&scrollTo({top:Math.max(0,t.spot.y-innerHeight/2),behavior:"smooth"})},Va=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!Tn(e)&&!e.closest(".devtools")&&(Va=[Va.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let Bu='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',Pu=t=>{let e=[...Va].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let s=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!s||!s.isConnected||s.contains(t)||t.contains(s)||Tn(s))return null;let o=t.closest(Bu);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),i=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:_a(s),tag:a,classes:i,nth:Wa({tag:a,classes:i}).indexOf(s),label:Zt(ie(s.textContent||""),60),ctx:za(s),fp:Do(s),rx:.5,ry:.5}},_o=new Map,Te=t=>{_o.size||requestAnimationFrame(()=>_o.clear());let e=_o.get(t);return e===void 0&&(e=Cu(t,Ce(t)),_o.set(t,e)),e},Fr=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},Wo=[],Ga=t=>{for(let e of Wo)e.play();Wo=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),Wo.push(s))},Ka=()=>{if(N)return Ce(N);let t=X!=null?B.find(s=>s.id===X):null;if(!t)return null;let e=Te(t);return e&&!e.hidden?Ce(t):null},jr="claude",Iu=()=>(n.client||Fe==="clients"?n.team??[]:Xo()).filter(t=>!mr(t.email)),Ou=()=>Iu().filter(t=>t.email!==n.me?.email),Vs=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Ou()],_r='<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>',Ua=(t,e)=>{let s=e==="agent"?jr:e==="me"?n.me?.email??"":"";if(!t){if(!N)return;N.assignee=s,N.stage=Jt(s)?"approved":!N.stage||N.stage==="approved"?"new":N.stage,Gs(s),N.carried=!1,Zn(),Z();return}zo(t,s)},zo=(t,e)=>{let s=B.find(i=>i.id===t);if(s&&ln(s)&&!Jt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?Be(s):"new",a=Jt(e)?"approved":o==="approved"?"new":o;Ye(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Jt(e)?"Approving it for the agent":"Reassigning")},qu=(t,e)=>{if(e&&mt.setItem("nm-for",e),!t){if(!N)return;N.assignee=e,N.stage==="approved"&&(N.stage="new"),Gs(e),N.carried=!1,Zn(),Z();return}zo(t,e)},Du='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9M15.5 4v3.5H12" stroke-linecap="round" stroke-linejoin="round"/></svg>',Gs=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Jt(e)&&Vs().some(s=>s.email===e)?e:null}catch{return null}},Wr=t=>Jt(t)?"#d97757":t?"#0d99ff":"#717171",pn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],sn=t=>t?n.team?.find(e=>e.email===t):void 0,Vo=t=>{let e=ie(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Nn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${Vo(e)}</b>`,Ya=t=>{let e=sn(t.by);return e||t.byName?Nn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Ne=t=>`var(--dt-avatar-${sn(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,mn=(t,e)=>{let s=sn(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Nn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Ne(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},zr=()=>n.me?`${mn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${Vn}</i>`:Vn,Qn=new Map,Xa=new Map,Vr=0,Fu=(t,e)=>{let s=e==="found"?null:e;n.client||x||t.id<=0||(t.anchor??null)===s||Qn.get(t.id)===s||(Qn.set(t.id,s),Xa.set(t.id,s),clearTimeout(Vr),Vr=window.setTimeout(()=>{for(let[o,a]of Xa){let i=B.find(d=>d.id===o),l=i?Fo(i):"found";if(!i||(l==="found"?null:l)!==a){Qn.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let c=B.find(m=>m.id===o);c&&(c.anchor=a)}}).catch(()=>Qn.delete(o))}Xa.clear()},4e3))},ju=t=>{let e=!!Ce(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${Yo}<span>${e?"Scrolled out of view":"Hidden right now"}</span></b>${e?`<button type="button" data-act="show-el" data-id="${t.id}">Show it</button>`:""}</div>`},_u=(t,e,s,o)=>{let a=(d,c,m=!1)=>`<button type="button" class="dt-lost-btn${m?" is-main":""}" data-act="${d}" data-id="${t.id}">${c}</button>`,i=(d,c,m)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${m}" aria-label="${m}">${c}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${Yo}<span>Not on the page yet</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Go to its place</button></div>`;if(o&&s==="gone"){let d=mc(t).before,c=Dt(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${t.spot&&!c?"Its element is gone \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here."}</p>${d?`<img class="dt-lost-shot" src="${f(ar(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${c?"":`<span class="dt-lost-acts">${ro(t)?a("repin","Re-pin",!0):""}${i("lost-resolve",$e,"Resolve")}${l?i("archive",Ln,"Archive"):""}</span>`}</div>`}return s==="probably"?`<div class="dt-lost dt-lost--maybe"><p>The page changed since \u2014 is this still its element?</p><span class="dt-lost-acts">${ro(t)?a("pin-yes","Yes, it\u2019s this",!0)+a("repin","Re-pin"):""}</span></div>`:e?.opener?`<div class="dt-lost dt-lost--inside"><p>Inside ${f(lo(e.opener))} \u2014 closed now.</p><span class="dt-lost-acts">${a("open-it","Open it",!0)}</span></div>`:""},Ja=(t,e)=>sn(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Go={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Rn=(()=>{try{return JSON.parse(mt.getItem("dt-seen")||"{}")}catch{return{}}})(),Za=()=>D("dt-seen",JSON.stringify(Rn)),Gr=t=>{let e=en(t);if(!(t.id in Rn))return Rn[t.id]=e.length,Za(),!1;let s=e[e.length-1];return e.length>Rn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},Kr=t=>{let e=en(t).length;Rn[t.id]!==e&&(Rn[t.id]=e,Za())},Wu=t=>{let e=sn(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${Vo(e.name||e.email)}"`:""},zu=t=>n.client||qt(t)||Dt(t)==="done"?"":Jr(t,t.assignee??"",t.id),Vu=t=>{let e=Dt(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Dt(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?bn:$e}</button>`},Gu=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${Pe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(a)}">${mn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},Ku=t=>{if(Cn!==t.id)return"";let e=(a,i,l="")=>`<button type="button" role="menuitem" ${a} class="${l}"><span>${i}</span></button>`,s=Me(t),o=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${o&&!qt(t)?`<div class="dt-hist-assign"><span>Assign</span>${Xr(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,"Mark as unread")}${e(`data-row-link="${t.id}"`,"Copy link")}${qo()?e(`data-row-select="${t.id}"`,"Select")+(bs(t)?e(`data-row-mirror="${t.id}"`,"Mirror to Team"):""):""}${o&&Ke()&&!t.client?e(`data-row-move="${t.id}"`,qt(t)?"Move to Team":"Move to Client"):""}${o||!$s(t)?"<hr>":""}${o?`<button type="button" role="menuitem" data-act="${s?"unarchive":"archive"}" data-id="${t.id}"><span>${s?"Unarchive":"Archive"}</span></button>`:""}${$s(t)?"":e(`data-rm="${t.id}"`,"Delete thread","is-danger")}</div>`},Ur={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};nu(t=>{if(t.matches(".dt-hist-go[data-go]")){let v=B.find(Rt=>Rt.id===Number(t.dataset.go)),A=v&&[...v.replies??[]].reverse().find(Rt=>!Rt.deleted);if(!v||!A)return null;let j=A.author==="claude",h=(A.by||"you").toLowerCase(),G=j?En(v):A.by?A.by===n.me?.email?"You":pn(A.by):"You",z=j?`<span class="dt-hist-face is-agent">${Pe(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(h)}">${mn(h,v)}</span>`,It=(A.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(A.files?.length?'<span class="dt-peek-chip">File</span>':"")+(A.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${z}</span><b>${f(G)}</b>${j?`<em>${f(cr(A.agent)||"")}</em>`:""}${A.editedAt?"<em>edited</em>":""}<em>${zn(A.at)}</em></span>`+(A.text?`<span class="dt-peek-text is-reply">${f(Zt(A.text,320))}</span>`:"")+(It?`<span class="dt-peek-files">${It}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=B.find(v=>v.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(v=>v.author!=="claude").map(v=>v.by)].filter(Boolean).map(v=>v.toLowerCase()))].slice(0,3),o=Dt(e),a=n.client||qt(e)||o==="done"?null:we(e),i=a&&Ur[a]&&(Jt(e.assignee)||a==="review")?a:null,l=Bn.find(v=>v[0]===ts(e)),[d,c]=o==="done"?Me(e)?["#717171","Archived"]:["#30a46c","Resolved"]:i?[Ur[i],`${En(e)}${Qa(e)}`]:[l[2],l[1]],m=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(v=>`<span class="dt-hist-face" style="--hue:${Ne(v)}">${mn(v,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${zn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Zt(e.text,240))}</span><span class="dt-peek-foot">${Ve(d,o==="done"?1:0)}<span>${f(c)}${m?` \xB7 ${m} ${m===1?"reply":"replies"}`:""}</span></span>`});let Qa=t=>{let e=we(t),s=gr(t);return e==="working"?s?.step?` \xB7 ${hr(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},Uu=t=>{let e=sn(t);return e?Nn(e.avatar_url,e.name||e.email):""},Yr=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${Wr(t)}"`:""}${Wu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,Xr=(t,e,s=!1)=>{let o=Jt(t),a=o?"":t,i=sn(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${f(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Ne(a.toLowerCase())}" aria-hidden="true">${Vo(i.name||i.email)}</b>`:a?nl:_r,d=a?i?.name||pn(a):"Anyone",c=A=>{let j=sn(A);return j?.avatar_url?`<img class="dt-menu-face" src="${f(j.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Ne(A.toLowerCase())}">${[...Vo(j?.name||A)][0]}</b>`},m=(A,j,h="")=>`<option value="${f(A)}" data-icon="${f(A?c(A):_r)}"${h?` data-hint="${f(h)}"`:""}${A===a?" selected":""}${A?"":" data-sep-after"}>${f(j)}</option>`,v=Vs();return`<label class="dt-owner${i?" has-face":""}${s?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":s?f(d):"Who takes it"}">${l}${s?"":`<span class="dt-owner-name">${f(d)}</span>`}${Ks}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
258
|
-
${
|
|
259
|
-
</select></label>`},
|
|
260
|
-
`).find(s=>
|
|
249
|
+
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${M}"
|
|
250
|
+
>${wn}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
251
|
+
</div>`))}function mu(n){let{inFrame:r,everything:u,route:h,open:g,settle:b,keepIn:M,toast:A,waits:y,approve:T}=n,E=it=>{let ft=u().find(Ft=>Ft.id===it);return!!ft&&y(ft)},F="nm-review",dt=()=>{try{return JSON.parse(sessionStorage.getItem(F)||"null")}catch{return null}},J=it=>{try{it?sessionStorage.setItem(F,JSON.stringify(it)):sessionStorage.removeItem(F)}catch{}},tt=document.createElement("div");tt.className="dt-review",tt.setAttribute("role","region"),tt.setAttribute("aria-label","Checking fixes"),tt.hidden=!0,M(tt),r||document.body.append(tt);let q=()=>u().filter(y),At=()=>{let it=q().sort((ft,Ft)=>+(Ft.route===h())-+(ft.route===h())||String(ft.route).localeCompare(String(Ft.route))||ft.id-Ft.id).map(ft=>ft.id);it.length&&(J({ids:it,i:0}),Wt())},Wt=()=>{let it=dt();if(!it||r){tt.hidden=!0;return}for(;it.i<it.ids.length&&!E(it.ids[it.i]);)it.i++;if(it.i>=it.ids.length){J(null),tt.hidden=!0,A("Every fix is checked.");return}J(it);let ft=u().find(Lt=>Lt.id===it.ids[it.i]);if(ft.route&&ft.route!==h()){location.assign(ft.route+location.search);return}g(ft);let Ft=it.ids.slice(0,it.i).some(E),_t=it.ids.filter(E);tt.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
252
|
+
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${Ft?"":" disabled"}>${Pa}</button>
|
|
253
|
+
<span class="dt-review-n">${_t.indexOf(ft.id)+1} of ${_t.length}</span>
|
|
254
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Ia}</button></span>
|
|
255
|
+
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${xe}</button>
|
|
256
|
+
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${un}</button>
|
|
257
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Tn}</button>`,tt.hidden=!1};tt.addEventListener("click",async it=>{let ft=it.target.closest("[data-r]"),Ft=dt();if(!ft||!Ft)return;if(ft.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(ft.dataset.r==="prev"){Ht();return}let _t=Ft.ids[Ft.i];J({...Ft,i:Ft.i+1});let Lt=u().find(ye=>ye.id===_t),se=ft.dataset.r==="ok"&&Lt?T(Lt):ft.dataset.r==="no"?b(_t,!1):null;Wt(),await se});let Ht=()=>{let it=dt();if(it){for(let ft=it.i-1;ft>=0;ft--)if(E(it.ids[ft])){J({...it,i:ft}),Wt();return}}};return document.addEventListener("keydown",it=>{tt.hidden||it.metaKey||it.ctrlKey||it.altKey||it.key!=="ArrowLeft"&&it.key!=="ArrowRight"||it.target.closest?.("input, textarea, select, [contenteditable]")||(it.preventDefault(),it.key==="ArrowLeft"?Ht():tt.querySelector('[data-r="skip"]')?.click())}),{start:At,toCheck:q,resume:()=>{dt()&&Wt()}}}function hu(n,r){let u=null,h=null,g=document.querySelector(".dt-turbo"),b="/notemend:turbo",M=()=>{let A=!!u&&Date.now()-Date.parse(u.at)<18e4,y=A?u.mode==="push"?"push":h?.paused?"paused":"on":"none",T=A?Vn(u.agent):"",E=y==="none"?`Turbo is off. Run ${b} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:y==="push"?`Push mode: ${T} takes threads when you press Push to the agent. For live, run ${b} instead`:y==="on"?`Turbo on: ${T} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${T} is listening but waits \u2014 click to resume`;g.dataset.state=y,g.dataset.tip=E,g.setAttribute("aria-label",E),g.setAttribute("aria-checked",String(y==="on")),n&&(g.hidden=!0)};return setInterval(M,3e4),g.addEventListener("click",async()=>{let A=g.dataset.state;if(A==="none"||A==="push"){await navigator.clipboard?.writeText(b).catch(()=>{}),r(`Copied ${b} \u2014 paste it in Claude Code`);return}let y=A==="on"?"off":"on";h={paused:y==="off"},M();try{let T=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:y})});if(!T.ok)throw new Error(String(T.status));r(y==="off"?"Turbo paused":"Turbo on")}catch{h={paused:y==="on"},M(),r("Could not switch turbo \u2014 try again")}}),A=>{u=A.listening??null,h=A.turbo??null,M()}}var yh=new Set(["data-wired","data-nudge"]),vh=".dt-note",gu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),Ho=n=>{if(!(n instanceof Element))return null;let r=n.dataset;return r.msg?`m:${r.msg}`:r.id?`${n.tagName}:${n.classList[0]??""}:${r.id}`:"draft"in r?`${n.tagName}:draft`:r.parked?`${n.tagName}:parked:${r.parked}`:r.k?`${n.tagName}:k:${r.k}`:null},fu=(n,r)=>n.nodeType===r.nodeType&&n.nodeName===r.nodeName&&Ho(n)===Ho(r);function wh(n,r){for(let{name:u}of[...n.attributes])!r.hasAttribute(u)&&!yh.has(u)&&n.removeAttribute(u);for(let{name:u,value:h}of r.attributes)n.getAttribute(u)!==h&&n.setAttribute(u,h);n instanceof HTMLInputElement&&r instanceof HTMLInputElement&&(n.checked!==r.checked&&(n.checked=r.checked),n!==document.activeElement&&n.value!==r.value&&(n.value=r.value))}function bu(n,r){let u=[...n.childNodes].filter(y=>!gu(y)),h=new Map;for(let y of u){let T=Ho(y);T&&h.set(T,y)}let g=new Set,b=0,M=[];for(let y of[...r.childNodes]){let T=Ho(y),E=T?h.get(T):void 0;if(!T){for(;b<u.length&&(g.has(u[b])||Ho(u[b]));)b++;b<u.length&&fu(u[b],y)&&(E=u[b++])}E&&!g.has(E)&&fu(E,y)?(g.add(E),$h(E,y),M.push(E)):M.push(y)}for(let y of u)g.has(y)||(y instanceof HTMLElement&&y.matches(vh)&&nu(y),n.removeChild(y));let A=n.firstChild;for(let y of M){for(;A&&gu(A);)A=A.nextSibling;if(y===A){A=A.nextSibling;continue}n.insertBefore(y,A)}}function $h(n,r){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==r.nodeValue&&(n.nodeValue=r.nodeValue);return}if(!(!(n instanceof Element)||!(r instanceof Element))){if(wh(n,r),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==r.value&&(n.value=r.value);return}if(n instanceof SVGElement){n.innerHTML!==r.innerHTML&&(n.innerHTML=r.innerHTML);return}bu(n,r),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==r.value&&(n.value=r.value)}}function Nr(n,r){let u=document.createElement("template");u.innerHTML=r,bu(n,u.content)}function yu(n,r,u=!1){let h=n.breakpoints,g=n.categories,b=(h.find(t=>!Number.isFinite(t.max))??h[0]).id,M=t=>h.find(e=>t>=e.min&&t<=e.max)?.id??b,A=(t,e)=>{let s=M(t);if(Fs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...h].sort((l,d)=>l.min-d.min),a=e<500?M(767):(o[o.length-2]??o[0]).id,i=l=>o.findIndex(d=>d.id===l);return i(s)>i(a)?a:s},y=t=>t.breakpoint||b,T=t=>n.devices.find(e=>e.id===t),E=Fs,F=(t,e)=>{E||pt.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??I).find(a=>a.id===t.id),s=J.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},q=t=>t.replace(/\/+$/,"")||"/",At=q(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 Wt=document.querySelector(".dt-grid-btn"),Ht=document.querySelector(".dt-grid-overlay"),it=Ht.querySelector(".dt-overlay-grid"),ft=Ht.querySelector(".dt-grid-chip"),Ft="dt-grid",_t=n.projectGrid??null,Lt=()=>A(innerWidth,innerHeight),se=()=>_t?.mode==="custom"?_t.widths?.[Lt()]??null:null,ye=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),le=t=>ye(t).length,me=()=>{let t=Ht.hidden;t&&(Ht.style.visibility="hidden",Ht.hidden=!1);try{return S()}finally{t&&(Ht.hidden=!0,Ht.style.visibility="")}},S=()=>{let t=document.documentElement.clientWidth;Ht.classList.remove("is-auto");let e=getComputedStyle(it);if(e.display==="grid"&&le(e)>1){let i=it.getBoundingClientRect();return{cols:le(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(i.left),w:Math.round(i.width),from:"site"}}let s=null,o=null;for(let i of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(i.closest($s)||Ht.contains(i))continue;let l=i.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(i);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let p=parseFloat(d.paddingLeft)||0;s={x:l.left+p,w:l.width-p-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let c=d.display.endsWith("grid")?ye(d):[];if(c.length>1){if(!c.every(v=>Math.abs(v-c[0])<2))continue;let p=parseFloat(d.columnGap)||0;o={cols:c.length,gap:p,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:c.reduce((v,N)=>v+N,0)+p*(c.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let p=[...i.children].map(N=>N.getBoundingClientRect()).filter(N=>N.width&&N.height),v=p.filter(N=>Math.abs(N.top-p[0].top)<2).sort((N,W)=>N.left-W.left);v.length>1&&v.every(N=>Math.abs(N.width-v[0].width)<2)&&(o={cols:v.length,gap:Math.max(0,v[1].left-v[0].right),x:v[0].left,w:v.at(-1).right-v[0].left})}}let a=i=>({...i,gap:Math.round(i.gap),x:Math.round(i.x),w:Math.round(i.w)});return a(o?{...o,...s??{},from:"page"}:{cols:n.grid.columns,gap:innerWidth<768?16:24,...s??{x:24,w:t-48},from:"guess"})},k=null,z=(t,e,s,o)=>{Ht.classList.add("is-auto"),it.children.length!==t&&(it.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),Ht.style.setProperty("--grid-x",`${s}px`),Ht.style.setProperty("--grid-w",`${o}px`),Ht.style.setProperty("--grid-gap",`${e}px`)},K=()=>{let t=se(),e=ft.querySelector("span");if(ft.querySelector("button").hidden=!t||E,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));z(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}it.children.length!==n.grid.columns&&(it.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),k=me(),k.from!=="site"&&z(k.cols,k.gap,k.x,k.w),e.textContent=k.from==="guess"?`Guessed \xB7 ${k.cols} \xD7 ${k.w}`:`From the page \xB7 ${k.cols} \xD7 ${k.w} \xB7 gap ${k.gap}`},x=()=>{ft.classList.remove("is-lifted");let t=ft.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();ft.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},O=t=>{Ht.hidden=!t,t&&(K(),x()),Wt.setAttribute("aria-pressed",String(t)),F(Ft,t?"1":"0"),Ue({grid:t})};Wt.addEventListener("click",()=>O(Ht.hidden===!0)),addEventListener("resize",()=>{Ht.hidden||(K(),x())});let mt=document.querySelector(".dt-pages-name"),Ct=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:q(t.location.pathname),title:t.document.title}:null}catch{return null}},Bt=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},ht=()=>{let e=Ct()?.route??At,s=null;for(let l of document.querySelectorAll(".dt-pages a"))q(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");Bt();let i=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);mt.textContent=e==="/"?"":e.replace(/^\//,""),mt.closest("summary").toggleAttribute("data-home",e==="/")},St=(!!n.gridAdmin||!!n.arrange)&&!n.client,Z=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),oe=new Set((()=>{try{return JSON.parse(pt.getItem("dt-folders-open")||"[]")}catch{return[]}})()),jt=new Set((()=>{try{return JSON.parse(pt.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),Ot=document.querySelector(".dt-pages-list"),Jn=()=>ht(),pn=t=>Et(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Le=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(Z.flatMap(d=>d.pages)),s=d=>Fc(n,d,At,St),o=d=>Z.filter(c=>(c.parent&&Z.some(p=>p.id===c.parent)?c.parent:null)===d),a=d=>d.pages.includes(At)||o(d.id).some(a),i=(d,c)=>s(d).replace("<li",`<li style="--d:${c}"`),l=(d,c)=>{let p=oe.has(d.id)||!jt.has(d.id)&&a(d),v=d.pages.map(W=>t.get(W)).filter(W=>!!W),N=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${c}"${p?" data-open":""}${St?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${p}">${Mo}${pn(p)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(St?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${Et('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${p?"":" hidden"}>${N.map(W=>l(W,c+1)).join("")}${v.map(W=>i(W,c+1)).join("")}${v.length||N.length?"":`<li class="dt-folder-empty" style="--d:${c+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};Ot.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>i(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!St,Jn()};Le();let L=document.querySelector(".dt-pages");L&&!L.querySelector("li")&&L.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let w=[...document.querySelectorAll(".devtools details, .dt-strip details")],H=!1,D=t=>Xn(t,()=>{t.open=!1}),j=()=>{let t=w.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)D(e);return t};for(let t of w)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Lo(t)):t.open&&(e.preventDefault(),D(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=j();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{H=w.some(e=>e.open&&!e.contains(t.target))&&j().length>0},!0),addEventListener("blur",j);let vt=document.querySelector(".dt-pad-overlay"),xt="dt-inspect",st=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),et=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),ct={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},gt="",Rt=0,{spacer:ve,drawPads:Fe,drawSize:Ee,drawType:Ut,drawColor:ue,drawBorder:Se,drawContrast:he,contrastFix:je,markCopied:ws}=Xc(vt),Cn=null,B=()=>{Cn&>&&P(Cn)},P=t=>{Cn=t,!Rt&&(Rt=requestAnimationFrame(()=>{Rt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(st)){vt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),gt==="sizes"?Ee(e):gt==="type"?Ut(e):gt==="color"?ue(e):gt==="contrast"?he(e):gt==="border"?Se(e):Fe(t.altKey?e:ve(e))}))},Y=t=>{gt=t;for(let[e,s]of Object.entries(ct))s.setAttribute("aria-pressed",String(e===t));F(xt,t),Ue({inspect:t}),vt.hidden=!t,vt.innerHTML="",t?(document.addEventListener("mousemove",P),addEventListener("scroll",B,!0),addEventListener("resize",B)):(document.removeEventListener("mousemove",P),removeEventListener("scroll",B,!0),removeEventListener("resize",B))};document.addEventListener("click",t=>{gt!=="contrast"||!je()||t.target.closest?.(st)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(je()).catch(()=>{}),ws(),B())},!0);for(let[t,e]of Object.entries(ct))e.addEventListener("click",()=>{t!==gt&&en(!1),Y(gt===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Jt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{E&&parent.postMessage({dt:!0,...o},location.origin)};gt?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):Ht.hidden||(O(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let qt=document.querySelector(".dt-notes-btn"),Xt=[...document.querySelectorAll(".dt-bp")],we=document.querySelector(".dt-history-btn"),rt=document.querySelector(".dt-history"),ge=document.querySelector(".dt-elsewhere"),Zn=document.querySelector(".dt-studio-btn"),Qn=document.querySelector(".dt-devices"),ts=document.querySelector(".dt-notes-hi"),ku=ts.querySelector(".dt-hi-box"),Ir=ts.querySelector(".dt-hi-tag"),$n=document.querySelector(".dt-frame"),Ye=document.createElement("div");Ye.className="dt-spot",Ye.hidden=!0,Ye.setAttribute("aria-hidden","true"),document.body.append(Ye);let Lu=t=>{if(!t||!Jt){Ye.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Ye.style.setProperty("--spot-x",`${e.left-s}px`),Ye.style.setProperty("--spot-y",`${e.top-s}px`),Ye.style.setProperty("--spot-w",`${e.width+s*2}px`),Ye.style.setProperty("--spot-h",`${e.height+s*2}px`),Ye.hidden&&(ts.hidden=!0),Ye.hidden=!1},zs=$n.querySelector("iframe");zs.addEventListener("load",ht),new MutationObserver(ht).observe($n,{attributes:!0,attributeFilter:["hidden"]});let Da=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),$s=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Fa=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll($s).forEach(Fa);let Or="dt-notes",I=[],Jt=!1,X=null,C=null,ja=0,He="",Su=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!An(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let i=getComputedStyle(a).position;if(i==="fixed"||i==="sticky")return!a.contains(t)}return!1},qr=new WeakSet,No=null,Bo=null,_e={},Ro=" \xB7 hidden \u2014 inside something closed",Po=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};nt.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&Po(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&Po(e)},!0),nt.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete _e[s.dataset.id],s.remove())},!0);let Me=[],ee=null,We=[],Tu=10,Vs=(t=C)=>!!(t&&((t.text?.trim().length??0)>=Tu||t.images?.length)),on=()=>{C&&Vs()&&We.push(C),C=null},Dr=0,Gs=()=>{if(!Vs()||performance.now()-Dr<4e3)return!0;Dr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&So(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Kt("Not sent \u2014 close again to keep it as a draft",2400),!1},mn=null,_a=new Map,Wa=null,Fr=()=>`dt-draft:${n.me?.email??""}:${At}${E?":canvas":""}`,xn=Fr(),Io=0,Us=()=>{if(!C&&!We.length&&!He){pt.removeItem(xn);return}let t={draft:C,parked:We,reply:He?{for:mn,text:He}:null};try{localStorage.setItem(xn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(xn,JSON.stringify({...t,draft:C&&e(C),parked:We.map(e)}))}catch{}}},es=()=>{clearTimeout(Io),Io=setTimeout(Us,200)};addEventListener("pagehide",()=>{clearTimeout(Io),Us();try{sessionStorage.setItem(`nm-open:${xn}`,X==null?"":String(X))}catch{}});let ze=pt.getItem("dt-space")==="clients"?"clients":"studio",Xe=()=>!!n.me&&!n.client,En=t=>!Xe()||ze==="clients"===Dt(t),jr=["all","nobody","mine","others","resolved","claude","wrote","check"],Mn=jr.find(t=>t===pt.getItem("dt-pinf"))??"all",za=()=>{},Oo=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Je=pt.getItem("dt-resolved")!=="0",hn=pt.getItem("dt-archived")==="1",ke=t=>Pc(t,n.autoArchive),qo=t=>ke(t)?hn:It(t)!=="done"||Je,ae={q:"",menu:!1,more:!1,view:["me","agent"].includes(pt.getItem("dt-view")??"")?pt.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(pt.getItem("dt-sort")??"")?pt.getItem("dt-sort"):"new"},Nn=null,Do=t=>bt.find(e=>e.from?.id===t.id&&js(e)),Va=t=>js(t)?bt.find(e=>e.id===t.from.id&&Dt(e)):void 0,Ce=null,Fo=null,jo=()=>Xe()&&ze==="clients",xs=t=>jo()&&Dt(t)&&It(t)==="open"&&!Do(t),_o='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="2.5"/><path d="M10 3.5v13"/></svg>',Au=t=>{let e=n.client?void 0:Va(t);if(!e)return"";let s=Hc(e);return`<button type="button" class="dt-field dt-field--bare dt-field--client" data-act="open-orig" data-id="${e.id}" data-tip="What the client sees now \u2014 open their thread" aria-label="The client sees: ${f(s)}. Open their thread"><span class="dt-field-box"><svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true">${Sr.clients}</svg><span class="dt-field-label">Client \xB7 ${f(s)}</span><svg class="dt-field-ext" viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg></span></button>`},Hu=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Cu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Nu=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),s=e(Hu),o=e(Cu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},Ga=()=>A(innerWidth,innerHeight),Zt=()=>Wa??Ga(),_r=()=>{let t=Zt();for(let e of Xt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Ua,poolOf:Ka,contextOf:Ya,resolveEl:Bu,anchorOf:Ru,anchorState:Pu,fingerprintOf:Wo}=Qc(),Es=new Map,zo=()=>{Es=new Map},Wr=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Ne=t=>{let e=Wr(t),s=Es.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Bu(t),st:Pu(t)},Es.set(e,s)),s.el},Xa=t=>(Ne(t),Es.get(Wr(t))?.st??"found"),Ks=0,Ys=null,Vo="",zr=()=>{Ks=Math.max(Ks,scrollY+innerHeight)},Vr=(t,e)=>e==="gone"&&(zr(),Ks<document.documentElement.scrollHeight-1&&(!t.spot||t.spot.y>Ks));addEventListener("scroll",()=>{zr(),Ys!=null&&Ks>=Ys-1&&(Ys=null,setTimeout(()=>{zo(),Q(),Mm()},600))},{capture:!0,passive:!0});let Iu=t=>{let e=Xa(t);return(Vr(t,e)?"later":e)+(Te(t)?"":" \xB7 no pin")},Ja=null,Gr=t=>{Ja=t.id??null,scrollTo({top:t.spot?Math.max(0,t.spot.y-innerHeight/2):document.documentElement.scrollHeight,behavior:"smooth"})},Za=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!An(e)&&!e.closest(".devtools")&&(Za=[Za.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let Ou='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',qu=t=>{let e=[...Za].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let s=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!s||!s.isConnected||s.contains(t)||t.contains(s)||An(s))return null;let o=t.closest(Ou);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),i=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:Ua(s),tag:a,classes:i,nth:Ka({tag:a,classes:i}).indexOf(s),label:te(re(s.textContent||""),60),ctx:Ya(s),fp:Wo(s),rx:.5,ry:.5}},Go=new Map,Te=t=>{Go.size||requestAnimationFrame(()=>Go.clear());let e=Go.get(t);return e===void 0&&(e=Ru(t,Ne(t)),Go.set(t,e)),e},Ur=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},Uo=[],Qa=t=>{for(let e of Uo)e.play();Uo=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),Uo.push(s))},ti=()=>{if(C)return Ne(C);let t=X!=null?I.find(s=>s.id===X):null;if(!t)return null;let e=Te(t);return e&&!e.hidden?Ne(t):null},Kr="claude",Du=()=>(n.client||ze==="clients"?n.team??[]:ta()).filter(t=>!wr(t.email)),Fu=()=>Du().filter(t=>t.email!==n.me?.email),Xs=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Fu()],Yr='<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>',ei=(t,e)=>{let s=e==="agent"?Kr:e==="me"?n.me?.email??"":"";if(!t){if(!C)return;C.assignee=s,C.stage=Qt(s)?"approved":!C.stage||C.stage==="approved"?"new":C.stage,Js(s),C.carried=!1,es(),Q();return}Ko(t,s)},Ko=(t,e)=>{let s=I.find(i=>i.id===t);if(s&&cn(s)&&!Qt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?qe(s):"new",a=Qt(e)?"approved":o==="approved"?"new":o;rn(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Qt(e)?"Approving it for the agent":"Reassigning")},ju=(t,e)=>{if(e&&pt.setItem("nm-for",e),!t){if(!C)return;C.assignee=e,C.stage==="approved"&&(C.stage="new"),Js(e),C.carried=!1,es(),Q();return}Ko(t,e)},_u='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9M15.5 4v3.5H12" stroke-linecap="round" stroke-linejoin="round"/></svg>',Js=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Qt(e)&&Xs().some(s=>s.email===e)?e:null}catch{return null}},Xr=t=>Qt(t)?"#d97757":t?"#0d99ff":"#717171",gn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],an=t=>t?n.team?.find(e=>e.email===t):void 0,Yo=t=>{let e=re(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Bn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${Yo(e)}</b>`,ni=t=>{let e=an(t.by);return e||t.byName?Bn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Be=t=>`var(--dt-avatar-${an(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,fn=(t,e)=>{let s=an(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Bn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Be(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},Jr=()=>n.me?`${fn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${Kn}</i>`:Kn,ns=new Map,si=new Map,Zr=0,Wu=(t,e)=>{let s=e==="found"?null:e;n.client||E||t.id<=0||(t.anchor??null)===s||ns.get(t.id)===s||(ns.set(t.id,s),si.set(t.id,s),clearTimeout(Zr),Zr=window.setTimeout(()=>{for(let[o,a]of si){let i=I.find(d=>d.id===o),l=i?Xa(i):"found";if(!i||(l==="found"?null:l)!==a){ns.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let c=I.find(p=>p.id===o);c&&(c.anchor=a)}}).catch(()=>ns.delete(o))}si.clear()},4e3))},zu=t=>{let e=!!Ne(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${Qs}<span>${e?"Scrolled out of view":"Hidden right now"}</span></b>${e?`<button type="button" data-act="show-el" data-id="${t.id}">Show it</button>`:""}</div>`},Vu=(t,e,s,o)=>{let a=(d,c,p=!1)=>`<button type="button" class="dt-lost-btn${p?" is-main":""}" data-act="${d}" data-id="${t.id}">${c}</button>`,i=(d,c,p)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${p}" aria-label="${p}">${c}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${Qs}<span>Further down the page</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Show it</button></div>`;if(o&&s==="gone"){let d=fc(t).before,c=It(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${c?"Not on the page now. The thread stays: answer or reopen it here.":d?"Not on the page now \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on the page now. Pin it to something else, or close the thread."}</p>${d?`<img class="dt-lost-shot" src="${f(pr(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${c?"":`<span class="dt-lost-acts">${Bs(t)?a("repin","Re-pin",!0):""}${i("lost-resolve",xe,"Resolve")}${l?i("archive",wn,"Archive"):""}</span>`}</div>`}return e?.opener?`<div class="dt-note-hidden dt-note-away"><b>${Qs}<span>In ${f(mo(e.opener))} \u2014 closed</span></b><button type="button" data-act="open-it" data-id="${t.id}">Show it</button></div>`:""},oi=(t,e)=>an(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Xo={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Rn=(()=>{try{return JSON.parse(pt.getItem("dt-seen")||"{}")}catch{return{}}})(),ai=()=>F("dt-seen",JSON.stringify(Rn)),Qr=t=>{let e=sn(t);if(!(t.id in Rn))return Rn[t.id]=e.length,ai(),!1;let s=e[e.length-1];return e.length>Rn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},tl=t=>{let e=sn(t).length;Rn[t.id]!==e&&(Rn[t.id]=e,ai())},Gu=t=>{let e=an(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${Yo(e.name||e.email)}"`:""},Uu=t=>n.client||Dt(t)||It(t)==="done"?"":ol(t,t.assignee??"",t.id),Ku=t=>{let e=It(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":It(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?un:xe}</button>`},Yu=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${De(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Be(a)}">${fn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},Xu=t=>{if(Nn!==t.id)return"";let e=(l,d,c,p="")=>`<button type="button" role="menuitem" ${l} class="${p}"><i>${d}</i><span>${c}</span></button>`,s='<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><circle cx="10" cy="10" r="2" fill="currentColor" stroke="none"/></svg>',o='<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="3"/><path d="m7 10.2 2.2 2.2L13.2 8"/></svg>',a=ke(t),i=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${i&&!Dt(t)?`<div class="dt-hist-assign"><span>Assign</span>${sl(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,s,"Mark as unread")}${e(`data-row-link="${t.id}"`,ui,"Copy link")}${jo()?e(`data-row-select="${t.id}"`,o,"Select")+(xs(t)?e(`data-row-mirror="${t.id}"`,_o,"Mirror to Team"):""):""}${i&&Xe()&&!t.client?e(`data-row-move="${t.id}"`,ci,Dt(t)?"Move to Team":"Move to Client"):""}${i||!Ls(t)?"<hr>":""}${i?e(`data-act="${a?"unarchive":"archive"}" data-id="${t.id}"`,a?un:wn,a?"Unarchive":"Archive"):""}${Ls(t)?"":e(`data-rm="${t.id}"`,Un,"Delete thread","is-danger")}</div>`},el={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};au(t=>{if(t.matches(".dt-hist-go[data-go]")){let v=I.find($t=>$t.id===Number(t.dataset.go)),N=v&&[...v.replies??[]].reverse().find($t=>!$t.deleted);if(!v||!N)return null;let W=N.author==="claude",m=(N.by||"you").toLowerCase(),_=W?Ln(v):N.by?N.by===n.me?.email?"You":gn(N.by):"You",G=W?`<span class="dt-hist-face is-agent">${De(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Be(m)}">${fn(m,v)}</span>`,Nt=(N.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(N.files?.length?'<span class="dt-peek-chip">File</span>':"")+(N.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${G}</span><b>${f(_)}</b>${W?`<em>${f(br(N.agent)||"")}</em>`:""}${N.editedAt?"<em>edited</em>":""}<em>${Gn(N.at)}</em></span>`+(N.text?`<span class="dt-peek-text is-reply">${f(te(N.text,320))}</span>`:"")+(Nt?`<span class="dt-peek-files">${Nt}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=I.find(v=>v.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(v=>v.author!=="claude").map(v=>v.by)].filter(Boolean).map(v=>v.toLowerCase()))].slice(0,3),o=It(e),a=n.client||Dt(e)||o==="done"?null:$e(e),i=a&&el[a]&&(Qt(e.assignee)||a==="review")?a:null,l=Pn.find(v=>v[0]===ss(e)),[d,c]=o==="done"?ke(e)?["#717171","Archived"]:["#30a46c","Resolved"]:i?[el[i],`${Ln(e)}${ii(e)}`]:[l[2],l[1]],p=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(v=>`<span class="dt-hist-face" style="--hue:${Be(v)}">${fn(v,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${Gn(e.createdAt)}</em></span><span class="dt-peek-text">${f(te(e.text,240))}</span><span class="dt-peek-foot">${Ke(d,o==="done"?1:0)}<span>${f(c)}${p?` \xB7 ${p} ${p===1?"reply":"replies"}`:""}</span></span>`});let ii=t=>{let e=$e(t),s=xr(t);return e==="working"?s?.step?` \xB7 ${$r(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},Ju=t=>{let e=an(t);return e?Bn(e.avatar_url,e.name||e.email):""},nl=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${Xr(t)}"`:""}${Gu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,sl=(t,e,s=!1)=>{let o=Qt(t),a=o?"":t,i=an(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${f(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Be(a.toLowerCase())}" aria-hidden="true">${Yo(i.name||i.email)}</b>`:a?dl:Yr,d=a?i?.name||gn(a):"Anyone",c=N=>{let W=an(N);return W?.avatar_url?`<img class="dt-menu-face" src="${f(W.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Be(N.toLowerCase())}">${[...Yo(W?.name||N)][0]}</b>`},p=(N,W,m="")=>`<option value="${f(N)}" data-icon="${f(N?c(N):Yr)}"${m?` data-hint="${f(m)}"`:""}${N===a?" selected":""}${N?"":" data-sep-after"}>${f(W)}</option>`,v=Xs();return`<label class="dt-owner${i?" has-face":""}${s?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":s?f(d):"Who takes it"}">${l}${s?"":`<span class="dt-owner-name">${f(d)}</span>`}${Jo}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
258
|
+
${p("","Anyone")}${v.map(N=>p(N.email,N.email===n.me?.email?`Me \xB7 ${N.name||N.email}`:N.name||N.email,N.email)).join("")}${a&&!v.some(N=>N.email===a)?p(a,gn(a)):""}
|
|
259
|
+
</select></label>`},Zu={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},ol=(t,e,s,o=!1)=>{let a=t?$e(t):Qt(e)?"queued":null,i=!!a&&(Qt(e)||a==="review"),l=o?"The agent does not work in the clients\u2019 space":i?"Take it back":"Give to the agent",d=i?`With the agent \u2014 ${Zu[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${i?" is-on":""}" data-act="claude"${s?` data-id="${s}"`:""}${i?` data-step="${a}" style="--step-c:${Xo[a]??Xo.queued}"`:""} aria-pressed="${i}" data-tip="${f(l)}" aria-label="${f(d)}"${o?" disabled":""}>${De(13)}</button>`},al=t=>{if(!t){if(!C)return;ei(0,Qt(C.assignee)?"nobody":"agent");return}let e=I.find(o=>o.id===t);if(!e)return;let s=$e(e);Ko(t,Qt(e.assignee)||s==="review"?"":Kr)},Qu=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,il=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([s,re(e??"")&&`\u201C${te(re(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},Jo='<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>',ri=(t,e,s=!1)=>{let o=_s(t),a=i=>zc(i).replace("<svg ",`<svg style="stroke:${i.color}" `);return s?`<span class="dt-field dt-field--bare dt-field--type"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare dt-field--type" data-tip="Type: ${f(o.label)}"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span>${Jo}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(i=>`<option value="${i.id}" data-c="${i.color}" data-icon="${f(a(i))}"${i.id===t?" selected":""}>${i.label}</option>`).join("")}</select></span></label>`},Pn=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],ss=t=>cn(t)||qe(t)==="progress"?"progress":qe(t)==="review"?"review":qe(t)==="waiting"?"waiting":"new",rl=(t,e)=>{if(e==="all")return!0;let s=It(t),o=xo(t,s),a=(n.me?.email??"").toLowerCase();return e==="nobody"?s!=="done"&&!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="resolved"?s==="done":e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?!t.by||t.by.toLowerCase()===a:s==="claude"||s==="open"&&($e(t)==="review"||ss(t)==="review")},Zo={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},In=[...Pn,["done","Resolved","#30a46c",1]],tp=t=>{let e=$e(t);return t.status==="done"&&e!=="review"?"done":e&&Zo[e]?Zo[e]:ss(t)},ep=t=>{let e=$e(t),s=tp(t),[,,o,a]=In.find(l=>l[0]===s),i=!n.client&&Va(t)?l=>` data-note="${f(vo[l])}"`:()=>"";return`<label class="dt-field" data-tip="${e&&Zo[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Ke(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${i("new")?'<option disabled data-head data-note="The client sees">Status</option>':""}${In.map(([l,d,c,p])=>`<option value="${l}" data-c="${c}" data-icon="${f(Ke(c,p))}"${i(l)}${l===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${ke(t)?"unarchive":"archive"}" data-sep data-icon="${f(wn)}">${ke(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Qo=(t,e,s)=>`<p class="dt-note-event"><span>${t}<b>${f(e)}</b>${s?`<time>${kr(s,Gn)}</time>`:""}</span></p>`,Ms=new Map,np=(t,e,s=1/0)=>{let{reopenedAt:o,reopenedBy:a,movedAt:i,movedBy:l,movedFrom:d,repinnedAt:c,repinnedBy:p,repinnedFrom:v}=t,N=sn(t),W=Mt=>{let Tt=Date.parse(Mt),Pt=N.findIndex((Ae,Pe)=>Pe>0&&!!Ae.at&&Date.parse(Ae.at)>Tt);return Pt<0?N.length:Pt},m=Mt=>Mt?Mt==="you"||Mt===n.me?.email?"you":Mt==="claude"?"the agent":gn(Mt):"",_=[],G=sp(t);if(G&&_.push([G.at?W(G.at):0,Qo(G.icon,G.words,G.time)]),i&&d&&_.push([W(i),Qo(li,`Moved from ${d}${l?` by ${m(l)}`:""}`,i)]),c&&_.push([W(c),Qo(li,`Re-pinned${p?` by ${m(p)}`:""}${v?` from ${v}`:""}`,c)]),o&&t.status!=="done"){let Mt=m(a);_.push([W(o),Qo(un,Mt?`Reopened by ${Mt}`:"Reopened",o)])}let Nt=e.map(()=>!0);for(let[Mt,Tt]of _.sort((Pt,Ae)=>Ae[0]-Pt[0]))e.splice(Mt,0,Tt),Nt.splice(Mt,0,!1);let $t=Nt.flatMap((Mt,Tt)=>Mt?[Tt]:[]),Yt=$t.length-1-s;if(Yt<2)return e.join("");let Gt=[...new Set(sn(t).slice(1,1+Yt).map(Mt=>Mt.author==="claude"?"@agent":(Mt.by||n.me?.email||"you").toLowerCase()))].slice(0,3).map(Mt=>Mt==="@agent"?`<span class="dt-hist-face is-agent">${De(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Be(Mt)}">${fn(Mt,t)}</span>`).join("");return[...e.slice(0,$t[1]),`<button type="button" class="dt-note-fold" data-act="unfold" data-id="${t.id}"><span class="dt-hist-faces">${Gt}</span>${Yt} more replies</button>`,...e.slice($t[$t.length-s])].join("")},sp=t=>{let e=t.from;if(e){if(js(t))return{icon:_o,words:Ac(t.mirroredBy?t.mirroredBy===n.me?.email?"you":(t.mirroredByName||gn(t.mirroredBy)).split(" ")[0]:""),at:null,time:t.createdAt};let o=bt.find(a=>a.id===e.id);return{icon:di,words:Sc(t,o,o?.by?gn(o.by):""),at:null,time:t.createdAt}}if(n.client)return null;let s=bt.find(o=>o.from?.id===t.id);return s?{icon:js(s)?_o:di,words:Tc(s),at:s.createdAt??null,time:s.createdAt}:null},op=(t,e)=>{let s=I.find(l=>l.id===t);if(!s)return;if(e==="done"){Ze(t,!0);return}if(e==="archive"||e==="unarchive"){as(t,e==="archive");return}if(Qt(s.assignee)&&!Dt(s)){s.status==="done"?Ze(t,!1):(Kt("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),Q());return}let a=e==="new"&&Qt(s.assignee)?"approved":e,i=s.status==="done"?{status:"open",doneBy:null}:{};rn(l=>l.map(d=>d.id===t?{...d,...i,stage:a}:d),()=>tt({id:t,...i,stage:a}),"Setting the status")},Zs=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],ap=(t,e)=>{let s=Math.max(0,Zs.findIndex(d=>d[0]===t)),[,o,a,i]=Zs[s],l=Zs[(s+1)%Zs.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}">${tu(i,a)}<span>${o}</span></button>`},ll=(t,e,s,o,a=!1,i=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":ap(t,s)}${l?"":ri(_s(e).id,s,a)}</span>${n.client?"":`<span class="dt-who">${i?"":sl(o,s)}${ol(s?I.find(d=>d.id===s):void 0,o,s,i)}</span>`}</div>`,Qs='<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>',ip=t=>{let e=re(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
|
|
260
|
+
`).find(s=>re(s))??"");return e?e.length>30?`${te(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},dl='<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>',cl='<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>',li='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5 4.5v5a3 3 0 0 0 3 3h7.5M12.5 9.5l3 3-3 3" stroke-linejoin="round"/></svg>',di='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="7" y="7" width="9.5" height="9.5" rx="2"/><path d="M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7"/></svg>',ci='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 7h11M12 4l3 3-3 3M16 13H5M8 10l-3 3 3 3"/></svg>',ui='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2l-.9.9"/><path d="M11.5 8.5a3 3 0 0 0-4.2 0L5 10.8A3 3 0 0 0 9.2 15l.9-.9"/></svg>',ul=t=>{let e=(a,i,l,d="")=>`<option value="${a}" data-icon="${f(i)}"${d}>${l}</option>`,s=t&&Xe()?Dt(t)?(Do(t)?"":e("mirror",_o,"Mirror to Team"))+(t.client?"":e("move",ci,"Move to Team")):e("dup",di,"Duplicate for the client")+e("move",ci,"Move to Client"):"",o=t&&n.client&&t.status==="done"?e("reopen",un,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${cl}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
261
261
|
<option value="" hidden selected></option>
|
|
262
|
-
${s}${o}${t?e("link",
|
|
263
|
-
${e(t?"rm":"discard",
|
|
264
|
-
</select></label>`},
|
|
265
|
-
${s.map(a=>
|
|
266
|
-
</select></span></label>`},Ys='<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>',dl='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ap='<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>',ip=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,rp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),c=s.querySelector(".dt-voice-time"),m=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${m()?Math.min(1,o.currentTime/m()):0})`,c.textContent=ip(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ap,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=dl,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let i=()=>{if(e){let d=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*o.duration);return}if(!o.paused){o.pause();return}nt.querySelectorAll(".dt-voice audio").forEach(d=>{d!==o&&d.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?i():l(),{once:!0}):i();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,i()},{once:!0}),o.currentTime=1e9}},ni=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),cl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Xs=new Map,lp=t=>{if(!t.startsWith("data:"))return t;let e=Xs.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),Xs.set(t,e),Xs.size>8){let[a,i]=Xs.entries().next().value;URL.revokeObjectURL(i),Xs.delete(a)}}return e},dp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${dl}</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="${lp(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">${$p}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${Ys}</button>`}</span>`,si=t=>t.length>30?`${Zt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,cp=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`},oi=t=>{let e=hc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},up=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${oi(e)}<span class="dt-file-text"><b>${f(si(e))}</b>${o?"":`<small>${cp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(rr(e)?t:a)}"${rr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${hp}</a>`:`<span class="dt-file-open">${i}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${Ys}</button>`}</span>`},pp=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${oi(s)}<span class="dt-file-text"><b>${f(si(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button></span>`},mp=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${oi(s)}<span class="dt-file-text"><b>${f(si(s))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button></span>`},ul=(t,e,s=t)=>t.startsWith(Jo)?pp(t,e??""):t.startsWith(ii)?mp(t,e??""):yo(s)?up(t,yo(s),e):ni(s)?dp(t,e):`<span class="dt-shot${cl(s)?" dt-shot--video":""}">${cl(s)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button>`}</span>`,ai=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=ar(o);return ul(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",pl=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>ul(e,`data-i="${s}"`)).join("")}</div>`:"",hp='<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>',gp='<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>',Jo="refused:\0",ii="big:\0",Zo=new Map,ws=t=>!t.startsWith(ii),fp='<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>',bp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',yp=90,ri=32,vp=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",Qo=!1,wp=async(t,e)=>{if(Qo||!t)return;let s=Number(t.dataset.id)||0;Qo=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Ut("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(bt){clearTimeout(o),Qo=!1,e.classList.remove("is-asking");let Ot=bt?.name;Ut(Ot==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Ot==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Ot==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${bt?.message||Ot||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let i=()=>nt.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${cs}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(ri)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${bp}</button>`;let d=l.querySelector("b"),c=[...l.querySelectorAll(".dt-rec-wave i")],m=new AudioContext,v=m.createAnalyser();v.fftSize=512,m.createMediaStreamSource(a).connect(v);let A=new Uint8Array(v.fftSize),j=[],h=new MediaRecorder(a,{audioBitsPerSecond:32e3}),G=[],z=Date.now(),It=!0,Rt=setInterval(()=>{let bt=i();if(!bt){le(!1);return}l.parentElement!==bt&&bt.appendChild(l),v.getByteTimeDomainData(A);let Ot=0;for(let Ct of A)Ot+=((Ct-128)/128)**2;j.push(Math.min(1,Math.sqrt(Ot/A.length)*4));let Mt=j.slice(-ri);c.forEach((Ct,_t)=>{let ke=Mt[_t-(ri-Mt.length)];Ct.style.transform=`scaleY(${Math.max(.1,ke??0).toFixed(2)})`,Ct.classList.toggle("is-empty",ke===void 0)});let kt=Math.floor((Date.now()-z)/1e3);d.textContent=`${Math.floor(kt/60)}:${String(kt%60).padStart(2,"0")}`,kt>=yp&&h.state!=="inactive"&&h.stop()},90),le=bt=>{It=bt,h.state!=="inactive"&&h.stop()};l.querySelector(".dt-rec-x").addEventListener("click",bt=>{bt.stopPropagation(),le(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",bt=>{bt.stopPropagation(),le(!0)}),l.addEventListener("keydown",bt=>{bt.key==="Escape"&&(bt.stopPropagation(),le(!1))}),h.ondataavailable=bt=>{bt.data.size&&G.push(bt.data)},h.onstop=async()=>{if(clearInterval(Rt),a.getTracks().forEach(Mt=>Mt.stop()),m.close().catch(()=>{}),l.remove(),Qo=!1,!It)return;let bt=new Blob(G,{type:h.mimeType||"audio/webm"}),Ot=await new Promise(Mt=>{let kt=new FileReader;kt.onload=()=>Mt(String(kt.result)),kt.readAsDataURL(bt)});s?Ee.push(Ot):N&&(N.images??=[]).push(Ot),Z(),i()?.querySelector("textarea")?.focus()},h.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},ml="\u{1F3A4} Voice note",$p='<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>',xp=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?N?.images??[]:Ee)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ae("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){Ut(i.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${i.text}`:i.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},hn=new Map,li=new Map,di=async(t,e,s)=>{let o=`${t}:${e}`;if(li.delete(o),!s){hn.delete(o),Z();return}let a=B.find(c=>c.id===t),i=a&&en(a).find(c=>(c.at??"0")===e);if(!i?.text)return;hn.set(o,{to:s,text:null}),Z();let l=await ae("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};hn.get(o)?.to===s&&(l?.ok&&d.text?hn.set(o,{to:s,text:d.text}):(hn.delete(o),li.set(o,s)),Z())},Ep=(t,e,s)=>{let o=hn.get(`${t}:${e}`),a=Ta(s),i=(navigator.language||"en").split("-")[0].toLowerCase();return`<label class="dt-msg-edit dt-msg-lang${o?" is-on":""}" data-tip="Translate">${o?.text===null?`<span class="dt-tr-spin">${Mp}</span>`:Lp}<span aria-hidden="true">${Ks}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${f(fr(a))}`:"Translate into"}</option>${Bc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===i?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Rc(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(bn)}"${o?"":" disabled"}>Show original</option></select></label>`},Mp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',kp=(t,e,s)=>{let o=`${t}:${e}`,a=Ta(s);if(hn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(fr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let i=li.get(o);return i?`<p class="dt-tr-note is-error" role="alert">Could not translate it \xB7 <button type="button" data-act="tr-retry" data-id="${t}" data-at="${f(e)}" data-to="${f(i)}">Try again</button></p>`:""},Lp='<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>',Sp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',hl='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',ci=()=>n.me?.email??"you",Tp=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,i])=>{let l=i.includes(ci()),d=i.map(c=>c===ci()?"You":pn(c)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${i.length}: ${d}`)}">${f(a)}<span>${i.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${hl}</button></div>`:""},gl=(t,e,s)=>{ta();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?yc:bc).map(v=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(v)}" aria-label="${f(v)}">${f(v)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${sl}</button>`),xn={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,d=8,c=a.top-l-i.height>=d;o.style.top=`${c?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let m=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,m-i.width),innerWidth-d-i.width)}px`,o.querySelector("button")?.focus()},xn=null,ta=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),xn=null},Ap=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},fl=(t,e,s)=>{let o=a=>{let i=vc(a.reactions,s,ci());return i===null?a:{...a,reactions:i}};Ye(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?o(l):l)}:o(i)),()=>tt({id:t,react:{at:e,emoji:s}}),"The reaction")},Hp='<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>',ui=1e4,bl=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
267
|
-
<textarea class="${t}" rows="1" maxlength="${
|
|
262
|
+
${s}${o}${t&&t.id>0&&It(t)==="open"&&Bs(t)?e("repin",li,"Re-pin"):""}${t?e("link",ui,"Copy link"):""}${t&&!n.client&&t.id>0?e(ke(t)?"unarchive":"archive",wn,ke(t)?"Out of the archive":"Archive"):""}
|
|
263
|
+
${e(t?"rm":"discard",Un,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
|
|
264
|
+
</select></label>`},ta=()=>n.studio?(n.team??[]).filter(t=>n.studio.includes(t.email)):[],pl=t=>{let e=t||n.lead||"",s=ta();return!s.length||s.some(o=>o.email===e)?e:s[0].email},rp=t=>{let e=pl(t),s=ta();if(!s.length)return"";let o=Ju(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Xr(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
|
|
265
|
+
${s.map(a=>nl(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
|
|
266
|
+
</select></span></label>`},to='<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>',ml='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',lp='<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>',dp=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,cp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),c=s.querySelector(".dt-voice-time"),p=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${p()?Math.min(1,o.currentTime/p()):0})`,c.textContent=dp(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=lp,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=ml,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let i=()=>{if(e){let d=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*o.duration);return}if(!o.paused){o.pause();return}nt.querySelectorAll(".dt-voice audio").forEach(d=>{d!==o&&d.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?i():l(),{once:!0}):i();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,i()},{once:!0}),o.currentTime=1e9}},pi=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),hl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),eo=new Map,up=t=>{if(!t.startsWith("data:"))return t;let e=eo.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),eo.set(t,e),eo.size>8){let[a,i]=eo.entries().next().value;URL.revokeObjectURL(i),eo.delete(a)}}return e},pp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${ml}</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="${up(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">${Mp}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${to}</button>`}</span>`,mi=t=>t.length>30?`${te(t,17)}\u2026${[...t].slice(-11).join("")}`:t,mp=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`},hi=t=>{let e=bc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},hp=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${hi(e)}<span class="dt-file-text"><b>${f(mi(e))}</b>${o?"":`<small>${mp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(hr(e)?t:a)}"${hr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${bp}</a>`:`<span class="dt-file-open">${i}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${to}</button>`}</span>`},gp=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${hi(s)}<span class="dt-file-text"><b>${f(mi(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${to}</button></span>`},fp=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${hi(s)}<span class="dt-file-text"><b>${f(mi(s))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${to}</button></span>`},gl=(t,e,s=t)=>t.startsWith(ea)?gp(t,e??""):t.startsWith(fi)?fp(t,e??""):$o(s)?hp(t,$o(s),e):pi(s)?pp(t,e):`<span class="dt-shot${hl(s)?" dt-shot--video":""}">${hl(s)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${to}</button>`}</span>`,gi=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=pr(o);return gl(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",fl=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>gl(e,`data-i="${s}"`)).join("")}</div>`:"",bp='<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>',yp='<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>',ea="refused:\0",fi="big:\0",na=new Map,ks=t=>!t.startsWith(fi),vp='<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>',wp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',$p=90,bi=32,xp=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",sa=!1,Ep=async(t,e)=>{if(sa||!t)return;let s=Number(t.dataset.id)||0;sa=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Kt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(yt){clearTimeout(o),sa=!1,e.classList.remove("is-asking");let Gt=yt?.name;Kt(Gt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Gt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Gt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${yt?.message||Gt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let i=()=>nt.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Un}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(bi)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${wp}</button>`;let d=l.querySelector("b"),c=[...l.querySelectorAll(".dt-rec-wave i")],p=new AudioContext,v=p.createAnalyser();v.fftSize=512,p.createMediaStreamSource(a).connect(v);let N=new Uint8Array(v.fftSize),W=[],m=new MediaRecorder(a,{audioBitsPerSecond:32e3}),_=[],G=Date.now(),Nt=!0,$t=setInterval(()=>{let yt=i();if(!yt){Yt(!1);return}l.parentElement!==yt&&yt.appendChild(l),v.getByteTimeDomainData(N);let Gt=0;for(let Pt of N)Gt+=((Pt-128)/128)**2;W.push(Math.min(1,Math.sqrt(Gt/N.length)*4));let Mt=W.slice(-bi);c.forEach((Pt,Ae)=>{let Pe=Mt[Ae-(bi-Mt.length)];Pt.style.transform=`scaleY(${Math.max(.1,Pe??0).toFixed(2)})`,Pt.classList.toggle("is-empty",Pe===void 0)});let Tt=Math.floor((Date.now()-G)/1e3);d.textContent=`${Math.floor(Tt/60)}:${String(Tt%60).padStart(2,"0")}`,Tt>=$p&&m.state!=="inactive"&&m.stop()},90),Yt=yt=>{Nt=yt,m.state!=="inactive"&&m.stop()};l.querySelector(".dt-rec-x").addEventListener("click",yt=>{yt.stopPropagation(),Yt(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",yt=>{yt.stopPropagation(),Yt(!0)}),l.addEventListener("keydown",yt=>{yt.key==="Escape"&&(yt.stopPropagation(),Yt(!1))}),m.ondataavailable=yt=>{yt.data.size&&_.push(yt.data)},m.onstop=async()=>{if(clearInterval($t),a.getTracks().forEach(Mt=>Mt.stop()),p.close().catch(()=>{}),l.remove(),sa=!1,!Nt)return;let yt=new Blob(_,{type:m.mimeType||"audio/webm"}),Gt=await new Promise(Mt=>{let Tt=new FileReader;Tt.onload=()=>Mt(String(Tt.result)),Tt.readAsDataURL(yt)});s?Me.push(Gt):C&&(C.images??=[]).push(Gt),Q(),i()?.querySelector("textarea")?.focus()},m.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},bl="\u{1F3A4} Voice note",Mp='<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>',kp=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?C?.images??[]:Me)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ie("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){Kt(i.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${i.text}`:i.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},bn=new Map,yi=new Map,vi=async(t,e,s)=>{let o=`${t}:${e}`;if(yi.delete(o),!s){bn.delete(o),Q();return}let a=I.find(c=>c.id===t),i=a&&sn(a).find(c=>(c.at??"0")===e);if(!i?.text)return;bn.set(o,{to:s,text:null}),Q();let l=await ie("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};bn.get(o)?.to===s&&(l?.ok&&d.text?bn.set(o,{to:s,text:d.text}):(bn.delete(o),yi.set(o,s)),Q())},Lp=(t,e,s)=>{let o=bn.get(`${t}:${e}`),a=Ra(s),i=(navigator.language||"en").split("-")[0].toLowerCase();return`<label class="dt-msg-edit dt-msg-lang${o?" is-on":""}" data-tip="Translate">${o?.text===null?`<span class="dt-tr-spin">${Sp}</span>`:Ap}<span aria-hidden="true">${Jo}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${f(Er(a))}`:"Translate into"}</option>${Oc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===i?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Ic(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(un)}"${o?"":" disabled"}>Show original</option></select></label>`},Sp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',Tp=(t,e,s)=>{let o=`${t}:${e}`,a=Ra(s);if(bn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(Er(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let i=yi.get(o);return i?`<p class="dt-tr-note is-error" role="alert">Could not translate it \xB7 <button type="button" data-act="tr-retry" data-id="${t}" data-at="${f(e)}" data-to="${f(i)}">Try again</button></p>`:""},Ap='<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>',Hp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',yl='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',wi=()=>n.me?.email??"you",Cp=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,i])=>{let l=i.includes(wi()),d=i.map(c=>c===wi()?"You":gn(c)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${i.length}: ${d}`)}">${f(a)}<span>${i.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${yl}</button></div>`:""},vl=(t,e,s)=>{oa();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?$c:wc).map(v=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(v)}" aria-label="${f(v)}">${f(v)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${cl}</button>`),kn={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,d=8,c=a.top-l-i.height>=d;o.style.top=`${c?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let p=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,p-i.width),innerWidth-d-i.width)}px`,o.querySelector("button")?.focus()},kn=null,oa=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),kn=null},Np=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},wl=(t,e,s)=>{let o=a=>{let i=xc(a.reactions,s,wi());return i===null?a:{...a,reactions:i}};rn(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?o(l):l)}:o(i)),()=>tt({id:t,react:{at:e,emoji:s}}),"The reaction")},Bp='<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>',$i=1e4,$l=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
267
|
+
<textarea class="${t}" rows="1" maxlength="${$i}" aria-label="${e}" placeholder="${e}">${f(s)}</textarea>
|
|
268
268
|
${a}
|
|
269
269
|
<div class="dt-compose-bar">
|
|
270
|
-
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${
|
|
271
|
-
${
|
|
270
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Bp}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${yp}</button>
|
|
271
|
+
${xp()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${vp}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Hp}</button></span>
|
|
272
272
|
<button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
|
|
273
273
|
><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>
|
|
274
274
|
</div>
|
|
275
|
-
</div></div>`,
|
|
276
|
-
class="dt-note-resolve${a&&!i?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${$e}</button>${n.client||!s?"":`<button data-act="${i?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${i?" is-on":""}" title="${i?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${Ln}</button>`}`},Rp='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',mi=new Map,Bp=(t,e)=>{let s=hr(e,25),o=mi.get(t);o?.now!==s&&mi.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=mi.get(t),i=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${i?`<span class="dt-step-was" data-k="was:${f(i)}" aria-hidden="true">${f(i)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},Pp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Me(t)){let m=t.confirmedBy?t.confirmedBy===n.me?.email?"you":pn(t.confirmedBy).split(" ")[0]:"",v=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ve(Pn[Pn.length-1][2],1)}<span class="dt-step-text"><b>${f(m?`Resolved by ${m}`:"Resolved")}${v?` \xB7 ${f(yr(v))}`:""}</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">${bn}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${Ln}</button></div>`)}if(n.client||qt(t))return"";let e=we(t),s={act:"hand",v:"me",icon:nl,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:bn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:$e,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=gr(t),i=!Jt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":pn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:Be(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let c=d.step==="review"?Ve(Bn[2][2],Bn[2][3]):`<i class="dt-step-mark">${Pe(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${c}${d.now?`${Rp}<span class="dt-step-text" aria-live="polite"><b>${Bp(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(m=>m.pick?`<label class="dt-step-act" data-tip="${f(m.tip)}">${m.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(m.tip)}"><option value="" selected hidden></option>${Vs().map(v=>Yr(v.email,v.email===n.me?.email?`Me \xB7 ${v.name||v.email}`:v.name||v.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${m.main?" is-main":""}${m.label?" has-label":""}" data-act="${m.act}" data-id="${t.id}"${m.v?` data-v="${m.v}"`:""} data-tip="${f(m.tip)}" aria-label="${f(m.tip)}">${m.icon}${m.label?f(m.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Ip=async(t,e,s)=>{let o=e?B.find(i=>i.id===t):void 0,a=await tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s});return a.ok&&o&&qi(Ce(o)).then(i=>{i&&tt({id:t,after:i.url})}),a},es=0,$l=()=>{},In=t=>(es++,t.finally(()=>{es--,$l()})),Ye=async(t,e,s)=>{let o=B,a=yt;B=t(B),yt=t(yt),Z();let i;dt=o;try{i=e()}finally{dt=null}let l=await In(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let m=qn([d.thread])[0];B=(es?B:o).map(A=>m&&A.id===m.id?m:A),yt=(es?yt:a).map(A=>m&&A.id===m.id?m:A),Z();let v=d.by?d.by==="claude"?"The agent":pn(d.by):"Someone";Ut(`${v[0].toUpperCase()}${v.slice(1)} changed the ${d.field} just now`,6e3),Ze();return}if(!l?.ok){es?Ze():(B=o,yt=a,Z()),Dn(`${s} did not go through`,l);return}let c=qn([await l.json().catch(()=>null)])[0];c&&(B=B.map(m=>m.id===c.id?c:m),yt=yt.map(m=>m.id===c.id?c:m),Z()),Ze()},Op=t=>t?Jt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!qt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},xl=async(t,e)=>{let s=[];for(let o=0;o<t.length;o+=6)s.push(...await Promise.all(t.slice(o,o+6).map(e)));return s},Xe=async(t,e)=>{let s=e?void 0:Op(B.find(l=>l.id===t)??yt.find(l=>l.id===t));await Ye(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...s,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Ip(t,e,s),e?"Resolving":"Reopening");let o=yt.find(l=>l.id===t),a=e?Ac(o):null,i=a!=null&&yt.find(l=>l.id===a);i&&qt(i)&&i.status!=="done"&&(await tt({id:i.id,reply:Tc,status:"done",doneBy:"you"}).catch(()=>null),Ze())},ns=async(t,e,s=!1)=>{let o=B.find(i=>i.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Ye(i=>i.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:l),()=>tt({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&Re(`Archived #${t}`,()=>ns(t,!1,!0))},Re=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Ba(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>Kn(o,()=>o.remove()),5e3)},sa=new Set,oa=new Set,Js=new Map,El=(t,e,s,o,a)=>{Js.get(t)?.(),s();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),Js.delete(t),a())},d=window.setTimeout(l,5e3);Js.set(t,l),Re(e,()=>{i||(i=!0,clearTimeout(d),Js.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...Js.values()])t()});let Ml=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],hi=t=>{let e=B.find(i=>i.id===t),s=B.findIndex(i=>i.id===t),o=yt.find(i=>i.id===t),a=yt.findIndex(i=>i.id===t);El(`t${t}`,`Thread #${t} deleted`,()=>{sa.add(t),B=B.filter(i=>i.id!==t),yt=yt.filter(i=>i.id!==t),Z()},()=>{sa.delete(t),B=Ml(B,e,s),yt=Ml(yt,o,a),Z()},async()=>{let i=await In(ae(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);sa.delete(t),i?.ok||Dn("Deleting did not go through",i),Ze()})},qp=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(B)??o(yt);if(!a)return;let i=(l,d)=>l.map(c=>c.id!==t?c:{...c,replies:(c.replies??[]).map(m=>m.at===e?d(m):m)});El(`r${s}`,"Reply deleted",()=>{oa.add(s),B=i(B,l=>({...l,text:"",deleted:!0})),yt=i(yt,l=>({...l,text:"",deleted:!0})),Z()},()=>{oa.delete(s),B=i(B,()=>a),yt=i(yt,()=>a),Z()},async()=>{let l=await In(tt({id:t,unsay:e})).catch(()=>null);oa.delete(s),l?.ok||Dn("Deleting the reply did not go through",l),Ze()})},xs=null,kl=t=>Math.max(70,t*18),Ll=t=>{let e=Dt(t),s=Us.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(Me(t)?30:e==="done"?20:e==="claude"?10:0)-s},Dp=(t,e)=>{let s=[];for(let a of t){let i=e.get(a.id);if(!i)continue;let l=s.find(d=>{let c=e.get(d[0].id);return Math.abs(c.x-i.x)<6&&Math.abs(c.y-i.y)<6});l?l.push(a):s.push([a])}let o=new Map;for(let a of s){if(a.length<2)continue;a.sort((c,m)=>Ll(c)-Ll(m)||m.id-c.id);let i=a.length,l=kl(i),d=String(a[0].id);a.forEach((c,m)=>{let v=(-150+120*m/(i-1))*(Math.PI/180);o.set(c.id,{key:d,i:m,n:i,fx:Math.round(l*Math.cos(v))-14,fy:Math.round(l*Math.sin(v))+4})})}return o},gi=t=>{if(xs!==t){xs=t;for(let e of nt.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!xs){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&gi(i.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${xs}"]`);if(!e){xs=null;return}let s=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-s,t.clientY-(o-40))>kl(a)+36&&gi(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),gi(e.dataset.stack))},!0);let Fp=(t,e)=>{let s=e||x||N?[]:p.filter(d=>d.id!==t).map(d=>({band:d,n:B.filter(c=>y(c)===d.id&&Po(c)&&wn(c)).length})).filter(d=>d.n).sort((d,c)=>c.n-d.n);if(ge.hidden=!s.length,!s.length)return;let[o,...a]=s,i=({band:d,n:c})=>`${c} ${c===1?"pin":"pins"} on ${d.label}`;ge.dataset.bp=o.band.id;let l=`${xt(o.band.icon,15)}<span>${f(i(o))}</span>${Ha}`;ge.dataset.html!==l&&(ge.innerHTML=l,ge.dataset.html=l),ge.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${o.band.label}`,ge.setAttribute("aria-label",`${i(o)} \u2014 switch to ${o.band.label}`)};ge.addEventListener("click",()=>{ge.dataset.bp&&Gi(ge.dataset.bp)});let jp=t=>{let e=B.filter(a=>y(a)===t),s=e.filter(a=>Dt(a)==="open").length,o=e.filter(a=>Dt(a)==="claude").length;Ra.innerHTML=s?String(s):o?Pe(9):"\u2713",Ra.dataset.state=s?"open":o?"claude":"done",Ra.hidden=e.length===0},Zs=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",ss))return;let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)},Sl=window.visualViewport?.height??innerHeight,Tl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Sl;if(Sl=t,!e||!nt.querySelector(".dt-note"))return Zs();Z();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Tl),addEventListener("resize",Tl),document.addEventListener("focusin",Zs),document.addEventListener("focusout",()=>setTimeout(Zs));let aa=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},fi=!1,Al=null,_p=()=>{if(X===Al||(Al=X,rt.hasAttribute("data-collapsed")&&!fi))return;let t=X!=null?B.find(o=>o.id===X):void 0,e=t&&Te(t),s=!1;if(e){rt.removeAttribute("data-collapsed");let o=rt.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(ss||e.y>o.top&&e.y<o.bottom)}fi=s,rt.toggleAttribute("data-collapsed",s)},Hl=t=>{let e=rt.hidden?null:rt.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Cl=(t,e=aa())=>{if(t.style.marginTop="",ss)return;let s=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${s-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||s)+8-a}px`)},bi=t=>{let e=aa();for(let s of nt.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let v of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(v);s.classList.remove("is-capped");let i=s.getBoundingClientRect(),l=i.top,d=e-l,c=l-28;if(i.bottom>e&&c>d&&(s.dataset.flip="1"),i.right>Hl(i)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let v=s.getBoundingClientRect(),A=Hl(v);v.right>A-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(v.right-A+8)}px`)}i=s.getBoundingClientRect();let m=s.dataset.flip?i.height-(e-8):i.bottom-e;m>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-m)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Cr.has(s)?s.scrollTop=a:(Cr.add(s),s.scrollTop=s.scrollHeight)),Cl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},Nl=0,ss=!1,ia=t=>{t?.target?.closest?.(fs)||(clearTimeout(Nl),Nl=window.setTimeout(()=>{ss=!1,nt.querySelector(".dt-note")&&(bi([]),requestAnimationFrame(Zs),Je())},ss?300:150))},Z=()=>{for(let h of Object.keys(qe))h!==String(X)&&delete qe[h];for(let h of vs.keys())h!==X&&vs.delete(h);if(requestAnimationFrame(Zs),Zn(),x){let h=yl(),G=JSON.stringify(h);G!==vl&&(vl=G,parent.postMessage({dt:!0,drafts:h},location.origin))}if(Pr(),rt.toggleAttribute("data-yield",X!=null||!!N),X!==cn){cn!=null&&(Ae||Ee.length)?Ia.set(cn,{text:Ae,images:[...Ee]}):cn!=null&&Ia.delete(cn);let h=X!=null?Ia.get(X):void 0;Ae=h?.text??"",Ee=h?[...h.images]:[],cn=X}Qt&&Qt.id!==X&&(Qt=null);let t=Xt();if(jp(t),qa(),!Kt){nt.innerHTML="",Ga(null),Ge.hidden=!0,ge.hidden=!0;return}let e=t;if(X!=null&&!N){let h=B.find(G=>G.id===X);h&&y(h)!==e&&(X=null)}_p();let s="",o=B.filter(h=>y(h)===e&&(Po(h)&&wn(h)||h.id===X)),a=new Map(o.map(h=>[h.id,Te(h)])),i=Dp(o,a);jo="";for(let h of o){let G=a.get(h.id)??null,z=i.get(h.id),It=Fo(h),Rt=qr(h,It)?"later":It;Rt==="later"&&(zs=Math.min(zs??1/0,h.spot.y)),h.id===X&&(jo=Rt+(G?"":" \xB7 no pin"));let le=!G&&!!h.spot&&Dt(h)==="open"&&Rt==="gone";if(!G&&!le&&X!==h.id)continue;let bt=Dt(h),Ot=!G,Mt=G??(le?{x:h.spot.x-scrollX,y:h.spot.y-scrollY}:{x:0,y:0});Rt!=="later"&&Fu(h,bt==="open"?Rt:"found"),le&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${h.id}" aria-expanded="${X===h.id}" aria-label="Thread ${h.id}, its element is gone" title="${f(Zt(h.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${Mt.x}px;top:${Mt.y}px"></button>`);let kt=Is(h.category),Ct=ln(h),_t=bt==="done"?null:we(h),ke=_t?Go[_t]??"":"",pe=vo(h,bt),tr=!!pe&&!pe.taker,kn=!!pe&&!!pe.taker&&pe.taker!==pe.writer,rn=bt==="done"?vo(h,"open"):null,go=!!rn&&!rn.claude&&!!rn.taker&&rn.taker!==rn.writer,M=ke||Bn.find(K=>K[0]===ts(h))[2],V=pe?tr?` \xB7 ${Ja(pe.writer,h)} \xB7 anyone can take it`:` \xB7 ${kn?`${Ja(pe.writer,h)} \u2192 `:""}${Ja(pe.taker,h)}${pe.claude?` \xB7 ${En(h)}${Qa(h)}`:""}`:"";if(X===h.id&&(vs.has(h.id)||vs.set(h.id,Math.max(2,en(h).length-(Rn[h.id]??en(h).length))),Kr(h)),Ot||(s+=`<button class="dt-pin dt-pin--${bt}${bt==="done"&&!Me(h)?" dt-pin--resolved":""}${pe?` dt-pin--people${kn?" dt-pin--pair":""}`:go?" dt-pin--people dt-pin--pair":ke?" dt-pin--agent":""}${Ct?" dt-pin--working":""}${bt==="open"&&Be(h)==="review"?" dt-pin--review":""}${G?.hidden?" dt-pin--hidden":""}${Rt==="probably"?" dt-pin--probably":""}${G?.opener?" dt-pin--inside":""}${X!==h.id&&!tl(h,$n)?" dt-pin--dim":""}${z?` dt-pin--stack${z.i?"":" dt-pin--stacktop"}${xs===z.key?" is-fanned":""}`:""}" data-id="${h.id}"${z?` data-stack="${z.key}"`:""} aria-label="Thread ${h.id}, ${bt==="open"?"open":bt==="claude"?`resolved by ${f(Wn(h.doneAgent,h.doneFor))}`:"resolved"}${f(V.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!pe&&ke?`, with ${f(En(h))}`:""}${G?.hidden?Co:""}" aria-expanded="${X===h.id}"
|
|
277
|
-
style="left:${Mt.x}px;top:${Mt.y}px;--cat:${
|
|
278
|
-
title="${f(
|
|
275
|
+
</div></div>`,aa=(t,e,s)=>(t||/^[a-z][a-z0-9-]*/i.exec(s?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),xl=()=>We.map((t,e)=>({i:e,el:aa(t.tag,t.classes,t.selector),text:re(t.text??""),shots:t.images?.length??0,orphan:!Te(t)})),xi=[],El="",Ln=t=>{let e=t.working;return Vn(e?.agent,e?.by??t.doneFor)},Rp=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`},ia=(t,e)=>{let s=t.working;return{queued:"Queued for the agent \u2014 it takes it on its next run",asks:`${Ln(t)} is waiting for your answer`,working:`${Ln(t)} is on it \xB7 ${Rp(s?.at)}`,stuck:`${Ln(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Vn(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},Pp=t=>{if(n.client||Dt(t))return"";let e=$e(t);if(!e)return 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 the agent" aria-label="Hand to the agent">${Lr(13,0)}</button>`;let s=Lr(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(ia(t,e))}" aria-label="${f(ia(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(ia(t,e))}" role="img" aria-label="${f(ia(t,e))}">${s}</span>`},Ls=t=>!!n.client&&!(n.me&&t.by===n.me.email),Ml=(t,e=!0,s=!0)=>{let o=It(t),a=o==="done",i=ke(t);return`${e?Pp(t):""}<button data-act="${a?"reopen":"done"}" data-id="${t.id}"
|
|
276
|
+
class="dt-note-resolve${a&&!i?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${xe}</button>${n.client||!s?"":`<button data-act="${i?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${i?" is-on":""}" title="${i?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${wn}</button>`}`},Ip='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',Ei=new Map,Op=(t,e)=>{let s=$r(e,25),o=Ei.get(t);o?.now!==s&&Ei.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=Ei.get(t),i=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${i?`<span class="dt-step-was" data-k="was:${f(i)}" aria-hidden="true">${f(i)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},qp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!ke(t)){let p=t.confirmedBy?t.confirmedBy===n.me?.email?"you":gn(t.confirmedBy).split(" ")[0]:"",v=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ke(In[In.length-1][2],1)}<span class="dt-step-text"><b>${f(p?`Resolved by ${p}`:"Resolved")}${v?` \xB7 ${f(kr(v))}`:""}</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">${un}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${wn}</button></div>`)}if(n.client||Dt(t))return"";let e=$e(t),s={act:"hand",v:"me",icon:dl,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:un,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:xe,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=xr(t),i=!Qt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":gn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:qe(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let c=d.step==="review"?Ke(Pn[2][2],Pn[2][3]):`<i class="dt-step-mark">${De(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${c}${d.now?`${Ip}<span class="dt-step-text" aria-live="polite"><b>${Op(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(p=>p.pick?`<label class="dt-step-act" data-tip="${f(p.tip)}">${p.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(p.tip)}"><option value="" selected hidden></option>${Xs().map(v=>nl(v.email,v.email===n.me?.email?`Me \xB7 ${v.name||v.email}`:v.name||v.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${p.main?" is-main":""}${p.label?" has-label":""}" data-act="${p.act}" data-id="${t.id}"${p.v?` data-v="${p.v}"`:""} data-tip="${f(p.tip)}" aria-label="${f(p.tip)}">${p.icon}${p.label?f(p.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Dp=async(t,e,s)=>{let o=e?I.find(i=>i.id===t):void 0,a=await tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s});return a.ok&&o&&Ki(Ne(o)).then(i=>{i&&tt({id:t,after:i.url})}),a},os=0,kl=()=>{},On=t=>(os++,t.finally(()=>{os--,kl()})),rn=async(t,e,s)=>{let o=I,a=bt;I=t(I),bt=t(bt),Q();let i;dt=o;try{i=e()}finally{dt=null}let l=await On(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let p=Dn([d.thread])[0];I=(os?I:o).map(N=>p&&N.id===p.id?p:N),bt=(os?bt:a).map(N=>p&&N.id===p.id?p:N),Q();let v=d.by?d.by==="claude"?"The agent":gn(d.by):"Someone";Kt(`${v[0].toUpperCase()}${v.slice(1)} changed the ${d.field} just now`,6e3),tn();return}if(!l?.ok){os?tn():(I=o,bt=a,Q()),Fn(`${s} did not go through`,l);return}let c=Dn([await l.json().catch(()=>null)])[0];c&&(I=I.map(p=>p.id===c.id?c:p),bt=bt.map(p=>p.id===c.id?c:p),Q()),tn()},Fp=t=>t?Qt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!Dt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},Ll=async(t,e)=>{let s=[];for(let o=0;o<t.length;o+=6)s.push(...await Promise.all(t.slice(o,o+6).map(e)));return s},Ze=async(t,e)=>{let s=e?void 0:Fp(I.find(l=>l.id===t)??bt.find(l=>l.id===t));await rn(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...s,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Dp(t,e,s),e?"Resolving":"Reopening");let o=bt.find(l=>l.id===t),a=e?Nc(o):null,i=a!=null&&bt.find(l=>l.id===a);i&&Dt(i)&&i.status!=="done"&&(await tt({id:i.id,reply:Cc,status:"done",doneBy:"you"}).catch(()=>null),tn())},as=async(t,e,s=!1)=>{let o=I.find(i=>i.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await rn(i=>i.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:l),()=>tt({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&Re(`Archived #${t}`,()=>as(t,!1,!0))},Re=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Fa(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>Xn(o,()=>o.remove()),5e3)},ra=new Set,la=new Set,no=new Map,Sl=(t,e,s,o,a)=>{no.get(t)?.(),s();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),no.delete(t),a())},d=window.setTimeout(l,5e3);no.set(t,l),Re(e,()=>{i||(i=!0,clearTimeout(d),no.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...no.values()])t()});let Tl=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],Mi=t=>{let e=I.find(i=>i.id===t),s=I.findIndex(i=>i.id===t),o=bt.find(i=>i.id===t),a=bt.findIndex(i=>i.id===t);Sl(`t${t}`,`Thread #${t} deleted`,()=>{ra.add(t),I=I.filter(i=>i.id!==t),bt=bt.filter(i=>i.id!==t),Q()},()=>{ra.delete(t),I=Tl(I,e,s),bt=Tl(bt,o,a),Q()},async()=>{let i=await On(ie(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);ra.delete(t),i?.ok||Fn("Deleting did not go through",i),tn()})},jp=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(I)??o(bt);if(!a)return;let i=(l,d)=>l.map(c=>c.id!==t?c:{...c,replies:(c.replies??[]).map(p=>p.at===e?d(p):p)});Sl(`r${s}`,"Reply deleted",()=>{la.add(s),I=i(I,l=>({...l,text:"",deleted:!0})),bt=i(bt,l=>({...l,text:"",deleted:!0})),Q()},()=>{la.delete(s),I=i(I,()=>a),bt=i(bt,()=>a),Q()},async()=>{let l=await On(tt({id:t,unsay:e})).catch(()=>null);la.delete(s),l?.ok||Fn("Deleting the reply did not go through",l),tn()})},Ss=null,Al=t=>Math.max(70,t*18),Hl=t=>{let e=It(t),s=Zs.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(ke(t)?30:e==="done"?20:e==="claude"?10:0)-s},_p=(t,e)=>{let s=[];for(let a of t){let i=e.get(a.id);if(!i)continue;let l=s.find(d=>{let c=e.get(d[0].id);return Math.abs(c.x-i.x)<6&&Math.abs(c.y-i.y)<6});l?l.push(a):s.push([a])}let o=new Map;for(let a of s){if(a.length<2)continue;a.sort((c,p)=>Hl(c)-Hl(p)||p.id-c.id);let i=a.length,l=Al(i),d=String(a[0].id);a.forEach((c,p)=>{let v=(-150+120*p/(i-1))*(Math.PI/180);o.set(c.id,{key:d,i:p,n:i,fx:Math.round(l*Math.cos(v))-14,fy:Math.round(l*Math.sin(v))+4})})}return o},ki=t=>{if(Ss!==t){Ss=t;for(let e of nt.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!Ss){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&ki(i.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${Ss}"]`);if(!e){Ss=null;return}let s=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-s,t.clientY-(o-40))>Al(a)+36&&ki(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),ki(e.dataset.stack))},!0);let Wp=(t,e)=>{let s=e||E||C?[]:h.filter(d=>d.id!==t).map(d=>({band:d,n:I.filter(c=>y(c)===d.id&&qo(c)&&En(c)).length})).filter(d=>d.n).sort((d,c)=>c.n-d.n);if(ge.hidden=!s.length,!s.length)return;let[o,...a]=s,i=({band:d,n:c})=>`${c} ${c===1?"pin":"pins"} on ${d.label}`;ge.dataset.bp=o.band.id;let l=`${Et(o.band.icon,15)}<span>${f(i(o))}</span>${Ia}`;ge.dataset.html!==l&&(ge.innerHTML=l,ge.dataset.html=l),ge.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${o.band.label}`,ge.setAttribute("aria-label",`${i(o)} \u2014 switch to ${o.band.label}`)};ge.addEventListener("click",()=>{ge.dataset.bp&&nr(ge.dataset.bp)});let zp=t=>{let e=I.filter(a=>y(a)===t),s=e.filter(a=>It(a)==="open").length,o=e.filter(a=>It(a)==="claude").length;Da.innerHTML=s?String(s):o?De(9):"\u2713",Da.dataset.state=s?"open":o?"claude":"done",Da.hidden=e.length===0},so=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",is))return;let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)},Cl=window.visualViewport?.height??innerHeight,Nl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Cl;if(Cl=t,!e||!nt.querySelector(".dt-note"))return so();Q();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Nl),addEventListener("resize",Nl),document.addEventListener("focusin",so),document.addEventListener("focusout",()=>setTimeout(so));let da=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},Li=!1,Bl=null,Vp=()=>{if(X===Bl||(Bl=X,rt.hasAttribute("data-collapsed")&&!Li))return;let t=X!=null?I.find(o=>o.id===X):void 0,e=t&&Te(t),s=!1;if(e){rt.removeAttribute("data-collapsed");let o=rt.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(is||e.y>o.top&&e.y<o.bottom)}Li=s,rt.toggleAttribute("data-collapsed",s)},Rl=t=>{let e=rt.hidden?null:rt.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Pl=(t,e=da())=>{if(t.style.marginTop="",is)return;let s=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${s-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||s)+8-a}px`)},Si=t=>{let e=da();for(let s of nt.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let v of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(v);s.classList.remove("is-capped");let i=s.getBoundingClientRect(),l=i.top,d=e-l,c=l-28;if(i.bottom>e&&c>d&&(s.dataset.flip="1"),i.right>Rl(i)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let v=s.getBoundingClientRect(),N=Rl(v);v.right>N-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(v.right-N+8)}px`)}i=s.getBoundingClientRect();let p=s.dataset.flip?i.height-(e-8):i.bottom-e;p>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-p)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),qr.has(s)?s.scrollTop=a:(qr.add(s),s.scrollTop=s.scrollHeight)),Pl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},Il=0,is=!1,ca=t=>{t?.target?.closest?.($s)||(clearTimeout(Il),Il=window.setTimeout(()=>{is=!1,nt.querySelector(".dt-note")&&(Si([]),requestAnimationFrame(so),Qe())},is?300:150))},Q=()=>{for(let m of Object.keys(_e))m!==String(X)&&delete _e[m];for(let m of Ms.keys())m!==X&&Ms.delete(m);if(requestAnimationFrame(so),es(),E){let m=xl(),_=JSON.stringify(m);_!==El&&(El=_,parent.postMessage({dt:!0,drafts:m},location.origin))}if(_r(),rt.toggleAttribute("data-yield",X!=null||!!C),X!==mn){mn!=null&&(He||Me.length)?_a.set(mn,{text:He,images:[...Me]}):mn!=null&&_a.delete(mn);let m=X!=null?_a.get(X):void 0;He=m?.text??"",Me=m?[...m.images]:[],mn=X}ee&&ee.id!==X&&(ee=null);let t=Zt();if(zp(t),za(),!Jt){nt.innerHTML="",Qa(null),Ye.hidden=!0,ge.hidden=!0;return}let e=t;if(X!=null&&!C){let m=I.find(_=>_.id===X);m&&y(m)!==e&&(X=null)}Vp();let s="",o=I.filter(m=>y(m)===e&&(qo(m)&&En(m)||m.id===X)),a=new Map(o.map(m=>[m.id,Te(m)])),i=_p(o,a);Vo="";for(let m of o){let _=a.get(m.id)??null,G=i.get(m.id),Nt=Xa(m),$t=Vr(m,Nt)?"later":Nt;$t==="later"&&(Ys=Math.min(Ys??1/0,m.spot?.y??document.documentElement.scrollHeight)),m.id===X&&(Vo=$t+(_?"":" \xB7 no pin"));let Yt=!_&&!!m.spot&&It(m)==="open"&&$t==="gone";if(!_&&!Yt&&X!==m.id)continue;let yt=It(m),Gt=!_,Mt=_??(Yt?{x:m.spot.x-scrollX,y:m.spot.y-scrollY}:{x:0,y:0});$t!=="later"&&Wu(m,yt==="open"?$t:"found"),Yt&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${m.id}" aria-expanded="${X===m.id}" aria-label="Thread ${m.id}, its element is gone" title="${f(te(m.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${Mt.x}px;top:${Mt.y}px"></button>`);let Tt=_s(m.category),Pt=cn(m),Ae=yt==="done"?null:$e(m),Pe=Ae?Xo[Ae]??"":"",Vt=xo(m,yt),Sa=!!Vt&&!Vt.taker,ms=!!Vt&&!!Vt.taker&&Vt.taker!==Vt.writer,Ie=yt==="done"?xo(m,"open"):null,de=!!Ie&&!Ie.claude&&!!Ie.taker&&Ie.taker!==Ie.writer,hs=Pe||Pn.find(Wn=>Wn[0]===ss(m))[2],Ta=Vt?Sa?` \xB7 ${oi(Vt.writer,m)} \xB7 anyone can take it`:` \xB7 ${ms?`${oi(Vt.writer,m)} \u2192 `:""}${oi(Vt.taker,m)}${Vt.claude?` \xB7 ${Ln(m)}${ii(m)}`:""}`:"";if(X===m.id&&(Ms.has(m.id)||Ms.set(m.id,Math.max(2,sn(m).length-(Rn[m.id]??sn(m).length))),tl(m)),Gt||(s+=`<button class="dt-pin dt-pin--${yt}${yt==="done"&&!ke(m)?" dt-pin--resolved":""}${Vt?` dt-pin--people${ms?" dt-pin--pair":""}`:de?" dt-pin--people dt-pin--pair":Pe?" dt-pin--agent":""}${Pt?" dt-pin--working":""}${yt==="open"&&qe(m)==="review"?" dt-pin--review":""}${_?.hidden||_?.opener?" dt-pin--hidden":""}${_?.opener?" dt-pin--inside":""}${X!==m.id&&!rl(m,Mn)?" dt-pin--dim":""}${G?` dt-pin--stack${G.i?"":" dt-pin--stacktop"}${Ss===G.key?" is-fanned":""}`:""}" data-id="${m.id}"${G?` data-stack="${G.key}"`:""} aria-label="Thread ${m.id}, ${yt==="open"?"open":yt==="claude"?`resolved by ${f(Vn(m.doneAgent,m.doneFor))}`:"resolved"}${f(Ta.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!Vt&&Pe?`, with ${f(Ln(m))}`:""}${_?.hidden?Ro:""}" aria-expanded="${X===m.id}"
|
|
277
|
+
style="left:${Mt.x}px;top:${Mt.y}px;--cat:${Tt.color};--ring:${hs};--hue:${Be(m.by||m.byName||"")}${Pe?`;--step-c:${Pe}`:""}${Ai.has(m.id)?`;--dt-page:${Ai.get(m.id)}`:""}${G?`;--fx:${G.fx}px;--fy:${G.fy}px`:""}"
|
|
278
|
+
title="${f(te(m.text,80))} \xB7 ${Tt.label}${Vt?f(Ta):Pt||Ae==="queued"?` \xB7 ${f(Ln(m)+ii(m))}`:""}${yt==="claude"?` \xB7 resolved by ${f(Vn(m.doneAgent,m.doneFor))} \u2014 tick to confirm`:yt==="done"?" \xB7 resolved":""}${_?.hidden||_?.opener?Ro:""}${Bs(m)?" \u2014 drag to move":""}"${Bs(m)?" data-move":""}>${yt==="done"?Ie?`${fn(Ie.writer,m)}${de?fn(Ie.taker,m):""}<i class="dt-pin-cut" aria-hidden="true">${xe}</i>`:"\u2713":Vt?`${fn(Vt.writer,m)}${ms?fn(Vt.taker,m):""}${Vt.claude?`<i class="dt-pin-claude" aria-hidden="true">${De(9)}</i>`:""}`:Pe?De(11):ni(m)}${X!==m.id&&Qr(m)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${G&&!G.i?`<i class="dt-pin-count" aria-hidden="true">${G.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}</button><i class="dt-pin-eye" data-eye="${m.id}" aria-hidden="true" style="left:${Mt.x}px;top:${Mt.y}px"${_?.hidden||_?.opener?"":" hidden"}>${Qs}</i>`),X===m.id){let Wn=sn(m),zn=$e(m)==="review"&&!n.client?Wn.map(wt=>wt.author).lastIndexOf("claude"):-1,qs=$e(m)==="asks"&&!n.client?Wn.length-1:-1;s+=`<div class="dt-note${Gt?" dt-note--orphan":""}" data-id="${m.id}" role="dialog" aria-label="Thread ${m.id}"
|
|
279
279
|
style="left:${Mt.x}px;top:${Mt.y}px">
|
|
280
280
|
<div class="dt-note-bar">
|
|
281
|
-
${
|
|
282
|
-
<span class="dt-note-el"${n.client?"":` data-tip="${
|
|
281
|
+
${m.id>0&&!(n.client||Dt(m))?`<span class="dt-note-num">#${m.id}</span>`:""}${m.by||m.byName?`<i class="dt-note-pin" style="--pin-c:${hs}" aria-hidden="true">${fn((m.by||m.byName||"").toLowerCase(),m)}</i>`:""}
|
|
282
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${il(m.selector,m.label)}"`}>${n.client||Dt(m)?`Thread #${m.id>0?m.id:"\u2026"}`:f(aa(m.tag,m.classes,m.selector))}</span>
|
|
283
283
|
<span class="dt-note-tools">
|
|
284
|
-
${
|
|
284
|
+
${Ml(m,!1,!1)}
|
|
285
285
|
<i class="dt-note-sep"></i>
|
|
286
|
-
${
|
|
287
|
-
<button data-act="close" data-id="${
|
|
286
|
+
${Ls(m)?"":ul(m)}
|
|
287
|
+
<button data-act="close" data-id="${m.id}" data-tip="Close" aria-label="Close">${Tn}</button>
|
|
288
288
|
</span>
|
|
289
289
|
</div>
|
|
290
|
-
${
|
|
291
|
-
${(
|
|
292
|
-
${
|
|
293
|
-
${(()=>{let
|
|
290
|
+
${Vu(m,_,$t,Gt)}
|
|
291
|
+
${(wt=>`<div class="dt-note-hidden"${_?.hidden?"":" hidden"}><b>${Qs}<span>${wt?`In \xAB${f(wt)}\xBB \u2014 closed`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${m.id}">Show it</button></div>`)(ip(_?.shut&&_.shut!==_.el?_.shut:_?.hidden))}
|
|
292
|
+
${Gt&&$t!=="gone"&&$t!=="later"?zu(m):""}
|
|
293
|
+
${(()=>{let wt=ep(m)+ri(_s(m.category).id,m.id,Ls(m))+Au(m)+(m.host&&m.host!==location.host?`<span class="dt-note-host" title="Written on ${f(m.host)}">${f(m.host)}</span>`:"");return wt?`<div class="dt-note-meta">${wt}</div>`:""})()}
|
|
294
294
|
<div class="dt-note-thread">
|
|
295
|
-
${
|
|
296
|
-
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${
|
|
297
|
-
<textarea class="dt-note-edit-input" rows="1" maxlength="${
|
|
298
|
-
${
|
|
295
|
+
${np(m,Wn.map((wt,$)=>{let R=$===0?null:wt.at??null,U=wt.author==="you"&&(!wt.by||wt.by===n.me?.email),V=U&&ee?.id===m.id&&ee.at===R,ot=n.team?.find(gs=>gs.email===wt.by),kt=wt.author==="claude"?Vn(wt.agent,wt.by):U?"You":ot?.name||wt.byName||wt.by||"You",at=wt.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${De(11)}</span>`:(gs=>Bn(ot?.avatar_url,ot?.name||wt.byName||(U?n.me?.name:"")||wt.by||kt,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Be(gs)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((wt.by||(U?n.me?.email??"":"")||kt).toLowerCase()),lt=`${m.id}:${wt.at??"0"}`,be=bn.get(lt)?.text,Oe=!U&&n.voice&&wt.text?Lp(m.id,wt.at??"0",wt.text):"",Ds=Oe?Tp(m.id,wt.at??"0",wt.text):"",Aa=m.id<=0?null:$===0?"":m.replies?.some(gs=>gs.at===wt.at)?wt.at:null,cr=Aa===null?"":Cp(m.id,Aa,wt.reactions),Dm=Aa!==null&&!cr?`<button class="dt-msg-edit" data-act="react-pick" data-id="${m.id}" data-at="${f(Aa)}" data-tip="Add reaction" aria-label="Add reaction">${yl}</button>`:"",cc=wt.author==="claude"?[br(wt.agent),wt.by&&wt.by!==n.me?.email?(ot?.name||wt.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",ur=`<div class="dt-msg-head">${at}<b>${f(kt)}</b>${cc?`<span class="dt-msg-sub">${f(cc)}</span>`:""}<time>${Gn(wt.at)}</time>${Dm}${Oe}${U&&!V?`<button class="dt-msg-edit" data-act="edit" data-id="${m.id}" data-at="${f(R??"")}" title="Edit">${Kn}</button>${R?`<button class="dt-msg-edit" data-act="unsay" data-id="${m.id}" data-at="${f(R)}" title="Delete">${Un}</button>`:""}`:""}</div>`;return $===zn?`<div class="dt-msg dt-msg--done" data-msg="${m.id}:${f(wt.at??"0")}"><div class="dt-msg-head">${at}<b>${f(kt)} fixed it</b><time>${Gn(wt.at)}</time>${Oe}</div><p${bn.get(lt)?.text===null?' class="is-asking"':""}>${Ld(be||wt.text)}</p>${Ds}${gi(wt.images)}${cr}
|
|
296
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${m.id}">${xe}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${m.id}">${un}Send back</button></div></div>`:V?`<div class="dt-msg">${ur}<div class="dt-compose">
|
|
297
|
+
<textarea class="dt-note-edit-input" rows="1" maxlength="${$i}" aria-label="Edit the message">${f(ee.text)}</textarea>
|
|
298
|
+
${gi(wt.images.filter(gs=>!ee.drop.includes(gs.split("/").pop())),m.id)}
|
|
299
299
|
<div class="dt-compose-bar">
|
|
300
300
|
<button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
|
|
301
|
-
<button class="dt-send${
|
|
301
|
+
<button class="dt-send${ee.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${xe}</button>
|
|
302
302
|
</div>
|
|
303
|
-
</div></div>`:`<div class="dt-msg${
|
|
303
|
+
</div></div>`:`<div class="dt-msg${U?" dt-msg--mine":""}${$===qs?" dt-msg--asks":""}" data-msg="${m.id}:${f(wt.at??"0")}">${$===qs?ur.replace(`<b>${f(kt)}</b>`,`<b>${f(kt)} asks</b>`):ur}<p${bn.get(lt)?.text===null?' class="is-asking"':""}>${Ld(be||wt.text)}</p>${Ds}${$===0&&m.suggest?Qu(m.suggest):""}${gi(wt.images)}${cr}</div>`}),ee?.id===m.id?1/0:(Ms.get(m.id)??2)+(zn===Wn.length-1||qs>=0?1:0))}
|
|
304
304
|
</div>
|
|
305
|
-
${
|
|
306
|
-
${
|
|
307
|
-
${
|
|
308
|
-
${
|
|
309
|
-
</div>`}}
|
|
310
|
-
style="left:${
|
|
311
|
-
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${
|
|
305
|
+
${_e[m.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${m.id}">${_e[m.id]} new ${_e[m.id]===1?"reply":"replies"} \u2193</button>`:""}
|
|
306
|
+
${qp(m)}
|
|
307
|
+
${$l("dt-note-reply-input",$e(m)==="asks"?`Answer ${f(Ln(m))}`:"Reply",He,`data-act="reply" data-id="${m.id}"`,fl(Me))}
|
|
308
|
+
${ll(m.priority,m.category,m.id,m.assignee??"",Ls(m),Dt(m),!0)}
|
|
309
|
+
</div>`}}We.forEach((m,_)=>{let G=Te(m);G&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${_}" data-act="draft-open" data-i="${_}"
|
|
310
|
+
style="left:${G.x}px;top:${G.y}px" title="Draft, not sent \u2014 click to finish it">${Jr()}</button>`)});let l=C&&Te(C);if(C){let m=l?.x??0,_=l?.y??0;s+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${m}px;top:${_}px">${Jr()}</span>`:""}
|
|
311
|
+
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${m}px;top:${_}px">
|
|
312
312
|
<div class="dt-note-bar">
|
|
313
|
-
<span class="dt-note-el"${n.client?"":` data-tip="${
|
|
314
|
-
${
|
|
313
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${il(C.selector,C.label)}"`}>${n.client?"New thread":f(aa(C.tag,C.classes,C.selector))}</span>
|
|
314
|
+
${Vs()?'<span class="dt-note-draft">Draft</span>':""}
|
|
315
315
|
<span class="dt-note-tools">
|
|
316
316
|
|
|
317
|
-
${
|
|
318
|
-
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${
|
|
317
|
+
${ul()}
|
|
318
|
+
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Tn}</button>
|
|
319
319
|
</span>
|
|
320
320
|
</div>
|
|
321
321
|
${l?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
|
|
322
|
-
${(()=>{let
|
|
323
|
-
${n.client?`<div class="dt-note-meta">${
|
|
324
|
-
${
|
|
325
|
-
<span class="dt-suggest-was">Now: <del>${f(
|
|
326
|
-
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(
|
|
322
|
+
${(()=>{let G=l?Ne(C):null,Nt=G&&I.find($t=>$t.id>0&&It($t)==="open"&&Ne($t)===G);return Nt?`<p class="dt-note-twin">Already open here: \u201C${f(te(Nt.text,60))}${Nt.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${Nt.id}">Open it</button></p>`:""})()}
|
|
323
|
+
${n.client?`<div class="dt-note-meta">${rp(C.assignee)}</div>`:""}
|
|
324
|
+
${C.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">${Tn}</button></span>
|
|
325
|
+
<span class="dt-suggest-was">Now: <del>${f(te(C.suggest.from,160))}${C.suggest.from.length>160?"\u2026":""}</del></span>
|
|
326
|
+
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(C.suggest.to)}</textarea>
|
|
327
327
|
<span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
|
|
328
|
-
<div class="dt-note-meta dt-note-type">${
|
|
329
|
-
${
|
|
330
|
-
${
|
|
331
|
-
${
|
|
332
|
-
</div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(h=>[h.closest(".dt-note").dataset.id,{top:h.scrollTop,end:h.scrollTop+h.clientHeight>=h.scrollHeight-4}])),c=new Set([...nt.querySelectorAll("[data-msg]")].map(h=>h.dataset.msg)),m=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Fp(e,yn.hidden?o.some(h=>!!a.get(h.id)):o.length>0),kr(nt,s),m&&!nt.contains(document.activeElement)&&io(".dt-note-reply-input");let v=[],A=[];for(let h of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let G=h.closest(".dt-note").dataset.id,z=d.get(G);if(!z){v.push(h),delete qe[G],h.parentElement.querySelector(".dt-new-below")?.remove();continue}let It=[...h.querySelectorAll("[data-msg]")].filter(bt=>!c.has(bt.dataset.msg));for(let bt of It)bt.classList.add("dt-msg--new");let Rt=z.end||String(Ho)===G;Rt&&A.push(h),h.scrollTop=Rt?h.scrollHeight:z.top;let le=It.filter(bt=>!bt.classList.contains("dt-msg--mine")).length;if(le&&!z.end&&String(Ho)!==G){qe[G]=(qe[G]??0)+le;let bt=qe[G],Ot=h.parentElement.querySelector(".dt-new-below")??h.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Ot.dataset,{act:"newbelow",id:G}),Ot.textContent=`${bt} new ${bt===1?"reply":"replies"} \u2193`}}for(let h of nt.querySelectorAll(".dt-new-below")){let G=h.closest(".dt-note")?.querySelector(".dt-note-thread");(!G||G.scrollTop+G.clientHeight>=G.scrollHeight-4)&&(delete qe[h.dataset.id],h.remove())}Ho=null,bi([...v,...A]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(No)),X==null?Ao=null:X!==Ao&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(Ao=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&io(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),ue(e),Ga(Ka()),Je();for(let h of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Fi(h);let j=nt.querySelector(".dt-note-input");j&&document.activeElement!==j&&(j.focus(),j.setSelectionRange(j.value.length,j.value.length))},yi=0,Wp=()=>{Mi&&Kt&&!x&&zl();let t=!1,e=document.getAnimations().some(l=>l.playState==="running"),s=[],o=!1;for(let l of nt.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(l.classList.contains("dt-note--orphan")||l.classList.contains("is-dragging"))continue;if(l.classList.contains("dt-pin--ghost")){let m=B.find(v=>v.id===Number(l.dataset.id))?.spot;s.push([l,m?{x:m.x-scrollX,y:m.y-scrollY,el:document.body}:null]);continue}let d=B.find(m=>m.id===Number(l.dataset.id)),c=d&&Te(d);s.push([l,c&&l.matches(".dt-pin")&&Mu(c.el,c.x,c.y)?null:c]),c&&e&&Fr(c.el)&&(t=!0)}for(let l of nt.querySelectorAll("[data-draft], [data-parked]")){if(l.classList.contains("dt-note--orphan"))continue;let d=l.dataset.parked?De[Number(l.dataset.parked)]:N;s.push([l,d?Te(d):null])}let a=(l,d,c)=>{Math.abs(parseFloat(l.style.left)-d)<.05||(l.style.left=`${d}px`,o=!0),Math.abs(parseFloat(l.style.top)-c)<.05||(l.style.top=`${c}px`,o=!0)};for(let[l,d]of s){let c=l.nextElementSibling;if(!d){l.style.visibility!=="hidden"&&(l.style.visibility="hidden"),c?.matches(".dt-pin-eye")&&!c.hidden&&(c.hidden=!0);continue}if(l.style.visibility&&(l.style.visibility=""),a(l,d.x,d.y),l.matches(".dt-pin[data-id]")){if(l.classList.contains("dt-pin--hidden")!==!!d.hidden){l.classList.toggle("dt-pin--hidden",!!d.hidden);for(let m of["title","aria-label"]){let v=(l.getAttribute(m)??"").replace(Co,"");l.setAttribute(m,d.hidden?v.replace(/( \u2014 drag to move)?$/,`${Co}$1`):v)}}c?.matches(".dt-pin-eye")&&(c.hidden!==!d.hidden&&(c.hidden=!d.hidden),d.hidden&&a(c,d.x,d.y))}l.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!d.hidden)}if(!Wo.length&&(N||X!=null)){let l=Ka();l&&e&&Fr(l)&&Ga(l)}let i=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(i.length){let l=aa();for(let d of i)d.style.visibility!=="hidden"&&Cl(d,l)}Eu(N||X!=null?Ka():null),yi=o?0:yi+1,t&&Je(),clearTimeout(Rl),Rl=window.setTimeout(zp,150)},vi=new Map,Rl=0,zp=()=>{let t=new Map,e=o=>{let a=[],i="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){i=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){i="var(--dt-bg)";break}let c=getComputedStyle(l);if(c.backgroundImage!=="none"){i="var(--dt-bg)";break}let m=c.backgroundColor.match(/[\d.]+/g);if(m&&(m[3]===void 0?1:+m[3])>=.9){i=c.backgroundColor;break}}i||="#fff";for(let l of a)t.set(l,i);return i},s=[];for(let o of nt.querySelectorAll(".dt-pin[data-id]")){if(o.style.visibility==="hidden"||o.classList.contains("is-dragging"))continue;let a=o.getBoundingClientRect(),i=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!Tn(l));i&&s.push([o,e(i)])}for(let[o,a]of s)vi.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Bl=t=>`dt-gfold:${n.project||location.host}:${t}`,ue=t=>{if(rt.hidden){rt.replaceChildren();return}if(rt.toggleAttribute("data-picking",!!He),kr(rt,du({bp:t,notes:B.filter(wn),breakpoints:p,bandOfNote:y,orphan:e=>!Te(e),statusTools:e=>wl(e,!1),tick:Vu,replied:Gu,rowMenu:Ku,menuFor:Cn,showResolved:Ue,showArchived:un,archived:Me,drafts:yn.hidden?yl():pi,checks:x?0:la.toCheck().length,clients:Ke()&&Fe==="clients",marker:Gp,assign:zu,mirror:e=>Ke()?Da(e)?"here":qt(e)&&Io(e)?"there":"":"",picking:He,pickable:bs,mirrorAll:qo()?B.filter(e=>wn(e)&&y(e)===t&&bs(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Ne(n.me.email)}">${Ya({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:oe,forMe:Vp,forAgent:e=>!!we(e)&&Dt(e)!=="done",unread:Gr,archives:!n.client,deletable:e=>!$s(e),folded:rt.hasAttribute("data-collapsed"),shut:e=>mt.getItem(Bl(e))==="1",cap:Pl,keep:X})),Es){let e=rt.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Es.at,Es.at),Es=null}},Es=null,Pl=150,Vp=t=>{if(Dt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Dt(t)==="claude"||Be(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return en(t).some(s=>s.text.toLowerCase().includes("@"+e))},Gp=t=>{let e=we(t),s=Go[e??""],o=Dt(t)==="done"?Me(t)?`<i class="dt-hist-badge is-archived">${Ln}</i>`:`<i class="dt-hist-badge is-done">${$e}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Pe(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Bn.find(i=>i[0]===ts(t))[2]}"></i>`,a=Ya(t)||Nn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Ne(t.by||t.byName||"you")}">${a}</span>`},ra=t=>{fi=!1;let e=rt.hasAttribute("data-collapsed");if(t===e||rt.hidden){rt.toggleAttribute("data-collapsed",t),Z();return}let s=rt.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){rt.setAttribute("data-folding",""),xr(rt,rt.offsetHeight,s,!1,()=>{rt.removeAttribute("data-folding"),rt.setAttribute("data-collapsed",""),Z()});return}rt.removeAttribute("data-folding"),rt.removeAttribute("data-collapsed"),Z(),xr(rt,s,rt.offsetHeight,!0,()=>{})},Il=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Ol=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},Kp=t=>{let e=Bl(t),s=mt.getItem(e)==="1",o=rt.querySelector(".dt-hist-list"),a=o?.clientHeight??600,i=()=>rt.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let m=i(),v=m?Il(m):[],A=()=>{D(e,"1"),ue(Xt())};if(!v.length||!Gn())return A();let j=Ol(v);Ca(j,!1,a),An(j).then(A);return}D(e,""),ue(Xt());let l=i(),d=l?Il(l):[];if(!d.length||!Gn())return;let c=Ol(d);c.hidden=!0,Ca(c,!0,a),An(c).then(()=>{c.isConnected&&(c.before(...c.children),c.remove())})};rt.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(oe.q=e.value,Es={at:e.selectionStart??e.value.length},ue(Xt()))}),rt.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){oe.more=!oe.more,Cn=null,oe.menu=!1,ue(Xt());return}let s=e.closest("[data-row-more]");if(s){let kt=Number(s.dataset.rowMore);Cn=Cn===kt?null:kt,oe.more=!1,ue(Xt());return}if((oe.more||Cn!=null)&&!e.closest(".dt-hist-menu")&&(oe.more=!1,Cn=null,ue(Xt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{oe.more=!1,Cn=null};if(e.closest("[data-hist-rows]")){Pl+=300,ue(Xt());return}if(e.closest("[data-read-all]")){for(let kt of B)Kr(kt);o(),ue(Xt());return}let a=e.closest("[data-resolve-all]");if(a){let kt=a.dataset.resolveAll.split(",").map(Number);o(),await xl(kt,Ct=>Xe(Ct,!0)),Re(`Resolved ${kt.length}`,()=>xl(kt,Ct=>Xe(Ct,!1)));return}let i=e.closest("[data-row-unread]");if(i){let kt=Number(i.dataset.rowUnread);Rn[kt]=Math.max(0,en(B.find(Ct=>Ct.id===kt)).length-1),Za(),o(),ue(Xt());return}let l=e.closest("[data-row-link]");if(l){o(),ue(Xt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Ut("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let kt=Number(d.dataset.rowSelect),Ct=B.find(_t=>_t.id===kt);He=new Set(Ct&&bs(Ct)?[kt]:[]),Oo=kt,ue(Xt());return}let c=e.closest("[data-row-mirror]");if(c){o(),ue(Xt()),await ga([Number(c.dataset.rowMirror)]);return}let m=e.closest("[data-mirror-all]");if(m){o(),ue(Xt()),await ga(m.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await xd();return}if(e.closest("[data-pick-cancel]")){_i();return}let v=e.closest(".dt-hist-go[data-go]");if(v&&qo()&&(He||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),$m(Number(v.dataset.go),t.shiftKey);return}let A=e.closest("[data-row-move]");if(A){o(),await ji(Number(A.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),rt.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){ra(!1);return}if(t.target.closest("[data-fold]")){ra(!rt.hasAttribute("data-collapsed"));return}let j=t.target.closest("[data-gfold]");if(j){Kp(j.dataset.gfold);return}let h=t.target.closest(".dt-hist-bands [data-bp]");if(h){Gi(h.dataset.bp);return}let G=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(G){G.dataset.histView?(oe.view=G.dataset.histView,D("dt-view",oe.view),oe.menu=!1):G.dataset.histSort?(oe.sort=G.dataset.histSort,D("dt-sort",oe.sort),oe.menu=!1,oe.more=!1):G.hasAttribute("data-hist-clear")?(oe.q="",Es={at:0}):oe.menu=!oe.menu,ue(Xt());return}oe.menu&&!t.target.closest(".dt-hist-menu")&&(oe.menu=!1,ue(Xt()));let z=t.target.closest("[data-draft-go], [data-draft-rm]");if(z){let kt=z.dataset.draftRm!==void 0,Ct=Number(kt?z.dataset.draftRm:z.dataset.draftGo);yn.hidden?kt?ql(Ct):wi(Ct):We(kt?{dropDraft:Ct}:{openDraft:Ct});return}let It=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(oe.more=!1),It){await Xe(Number(It.dataset.id),It.dataset.act==="done");return}let Rt=t.target.closest("[data-rm]");if(Rt){X=null,hi(Number(Rt.dataset.rm));return}if(t.target.closest("[data-review]")){la.start();return}if(t.target.closest("[data-resolved]")){xi(!Ue);return}if(t.target.closest("[data-archived]")){Ei(!un);return}let le=t.target.closest("[data-archive-all]");if(le){let kt=le.dataset.archiveAll.split(",").map(Number);for(let Ct of kt)await ns(Ct,!0,!0);Re(`Archived ${kt.length}`,()=>{for(let Ct of kt)ns(Ct,!1,!0)});return}let bt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(bt){await ns(Number(bt.dataset.id),bt.dataset.act==="archive");return}let Ot=t.target.closest("[data-go]");if(!Ot)return;let Mt=Number(Ot.dataset.go);if(!yn.hidden){We({open:Mt});return}Ms(Mt)});let Ms=t=>{X=t,Ao=null,nn(),ss=!0,Z();let e=B.find(a=>a.id===t),s=e&&Te(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Ce(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):Dr(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&Mo(o,"land"),ia()},wi=t=>{let[e]=De.splice(t,1);if(!e)return;nn(),N=e,X=null;let s=Te(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Z()},ql=t=>{De.splice(t,1),Z()},la=cu({inFrame:x,everything:()=>yt,route:()=>St,settle:Xe,keepIn:Ba,toast:t=>Ut(t),waits:t=>Dt(t)==="claude"||Dt(t)==="open"&&ts(t)==="review",approve:t=>Xe(t.id,!0),open:t=>{if(Kt||Qe(!0),y(t)!==Xt()){Gi(y(t));for(let e of[600,1500])setTimeout(()=>We({open:t.id}),e)}else Ms(t.id)}}),Dl=t=>{if(rt.hidden){t?.();return}Kn(rt,()=>{rt.hidden=!0,t?.()})},Fl=()=>{Eo(rt),rt.hidden=!1},Up=t=>{t?Fl():Dl(),ve.setAttribute("aria-pressed",String(t)),D("dt-history",t?"1":"0"),Z()},$i=document.querySelector(".dt-resolved-btn"),On=document.querySelector(".dt-space"),Yp=()=>{if(!On)return;On.hidden=!Ke(),On.dataset.on=Fe;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Ke()&&Fe==="clients"?(t.dataset.dtSpace="clients",e||(t.classList.add("dt-client-glow"),window.setTimeout(()=>t.classList.remove("dt-client-glow"),1700))):delete t.dataset.dtSpace;let s=document.querySelector(".dt-client-tab");s&&(s.inert=t.dataset.dtSpace!=="clients",s.ariaHidden=s.inert?"true":null);for(let o of On.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===Fe));let i=yt.filter(l=>!Me(l)&&Dt(l)!=="done"&&qt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=i?String(i):""}On.querySelector(".dt-space-name").textContent=Fe==="clients"?"Client":"Team",On.querySelector(".dt-space-ic").innerHTML=xt(wr[Fe],14)},jl=0,ks=t=>{if(!Ke()||t===Fe)return;let e=()=>{Fe=t,He=null,D("dt-space",t),X!=null&&!wn(B.find(a=>a.id===X))&&(X=null),nn(),os(yt),Z(),ue(Xt())},s=document.documentElement,o=++jl;s.classList.add("dt-switching"),Promise.all([An(nt),An(rt)]).then(()=>{o===jl&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>ks("studio")),On?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(On.open=!1,ks(e.dataset.space))});let Ls=document.querySelector(".dt-pinf"),Ss=Ls.querySelector(".dt-pinf-btn"),on=Ls.querySelector(".dt-pinf-menu"),_l={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},Xp=()=>B.filter(t=>y(t)===Xt()&&Po(t)&&wn(t)),Qs=(t,e=!1)=>{on.hidden=!t,Ss.setAttribute("aria-expanded",String(t)),t&&(qa(),e&&on.querySelector('[aria-checked="true"]')?.focus())};qa=()=>{let t=Xp();if(Ls.hidden=!Ke()||!t.length,Ls.hidden){on.hidden=!0;return}let e=Object.fromEntries(Br.map(m=>[m,t.filter(v=>tl(v,m)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Ne(s)],["others","var(--dt-faint)"]];if(Ss.toggleAttribute("data-on",$n!=="all"),Ss.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} anyone can take, ${e.mine} mine, ${e.others} everyone else's, ${e.resolved} resolved${$n==="all"?"":`; showing ${_l[$n]}, ${e[$n]}`}`),on.hidden)return;let a=[...new Set(t.map(m=>vo(m,Dt(m))?.taker).filter(m=>!!m&&m!==s))].slice(0,2),i=m=>Nn(sn(m)?.avatar_url,sn(m)?.name||m,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ne(m)}" `),l={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:i(s),others:a.map(i).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${Pe(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Ve(Bn[2][2],Bn[2][3]),resolved:Ve(Pn[Pn.length-1][2],Pn[Pn.length-1][3])},d=(m,v)=>`<b class="dt-pinf-share"><i style="--c:${v};width:${Math.round(100*e[m]/e.all)}%"></i></b>`,c=(m,v="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${$n===m}" data-pinf="${m}"><i class="dt-pinf-glyph">${l[m]}</i><span>${_l[m]}</span>${v?d(m,v):""}<em>${e[m]}</em>${$e}</button>`;on.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${c("all")}${o.map(([m,v])=>c(m,v)).join("")}${e.resolved||$n==="resolved"?c("resolved"):""}<hr>${c("claude")}${c("wrote")}${c("check")}${n.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Ss.addEventListener("click",t=>Qs(on.hidden,t.detail===0)),on.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&($n=e.dataset.pinf,D("dt-pinf",$n),Qs(!1),Ss.focus(),Kt?Z():Qe(!0))}),on.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Qs(!1),Ss.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...on.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!on.hidden&&!Ls.contains(t.target)&&Qs(!1)},!0);let xi=t=>{Ue=t,$i.setAttribute("aria-pressed",String(t)),D("dt-resolved",t?"1":"0"),We({resolved:t}),Z(),as(!0)},Ei=t=>{un=t,D("dt-archived",t?"1":"0"),We({archived:t}),Z(),as(!0)};$i.addEventListener("click",()=>xi(!Ue)),$i.setAttribute("aria-pressed",String(Ue)),ve.addEventListener("click",()=>{let t=rt.hidden||rt.hasAttribute("data-leaving");t&&!Kt&&Qe(!0),t&&ra(!1),Up(t)});let Je=()=>{Pa||!Kt||(Pa=requestAnimationFrame(()=>{Pa=0,Wp()}))},Wl=`${fs}, .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`,Jp=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Wl))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Wl))},Mi=!1,zl=()=>{Mi=!1;let t=document.scrollingElement??document.documentElement,e=document.querySelector(".dt-room");if(t.scrollHeight-(e?.offsetHeight??0)<=t.clientHeight+1){e?.remove();return}let s=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==s&&document.body.append(s)},ki=0,Li=!1,Si=!1,Vl=0,Zp=()=>{if(!Kt)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Xt();return B.some(s=>!t.has(s.id)&&y(s)===e&&Po(s)&&wn(s)&&!!Te(s))},Qp=()=>Kt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=B.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!Ce(e)}),tm=()=>Kt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=B.find(s=>s.id===Number(t.dataset.id));return!!e&&Fo(e)==="probably"!==t.classList.contains("dt-pin--probably")}),Gl=new MutationObserver(t=>{if(Kt&&!x&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Mi=!0}t.every(Jp)||((yi<3||t.some(e=>e.type!=="attributes"))&&Je(),t.some(e=>e.type!=="attributes")?Li=!0:t.some(e=>e.attributeName==="class")&&(Si=!0),ki||(ki=window.setTimeout(()=>{if(ki=0,Li)_s();else if(Si&&performance.now()-Vl>1e3){Vl=performance.now();for(let[s,o]of ys)o.el||ys.delete(s)}Li=Si=!1;let e=X!=null?B.find(s=>s.id===X):void 0;Zp()||Qp()||tm()||e&&jo&&Ru(e)!==jo?Z():Je()},150)))}),Kl=new ResizeObserver(()=>Je()),Ul=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&Je()},yt=[],Yl=()=>{},to=new Set,je={at:"",ids:[]},os=t=>{yt=t,queueMicrotask(()=>Yl());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Me(d)||!wn(d))continue;let c=Dt(d),m=we(d),v=c==="done"?"done":c==="claude"?"review":m&&Ko[m]||ts(d),A=s[d.route??""]??={...e(),bands:{}};A[v]++;let j=y(d);(A.bands[j]??=e())[v]++}Yp();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>o.map(c=>[c,c==="done"&&!Ue?0:d[c]]),l=d=>i(d).reduce((c,[,m])=>c+m,0);for(let d of document.querySelectorAll(".dt-pages a")){let c=d.querySelector(".dt-pages-n");if(!c)continue;let m=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let j of p){let h=m?.bands[j.id];for(let[G,z]of i(h??e())){let It=c.querySelector(`[data-bp="${j.id}"][data-state="${G}"]`);It.hidden=!z,z&&(It.querySelector("i").textContent=String(z),It.title=`${j.label}: ${z} ${a[G]}`)}}let v=m?l(m):0;c.hidden=!v;let A=m?p.filter(j=>m.bands[j.id]&&l(m.bands[j.id])).map(j=>`${j.label} ${l(m.bands[j.id])}`).join(" \xB7 "):"";c.title=v?`${o.filter(j=>m[j]).map(j=>`${m[j]} ${a[j]}`).join(" \xB7 ")}
|
|
333
|
-
${A}`:"",d.dataset.n=String(v)}for(let d of document.querySelectorAll(".dt-folder")){let c=d.querySelectorAll(":scope > ul li[data-route] > a").length,m=[...d.querySelectorAll("a[data-n]")].reduce((A,j)=>A+Number(j.dataset.n),0),v=d.querySelector(".dt-folder-n");v.textContent=c?String(c):"",v.title=`${c} ${c===1?"page":"pages"}${m?` \xB7 ${m} open ${m===1?"thread":"threads"}`:""}`}Ht()},qn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!sa.has(Number(e.id))).map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(s=>typeof s?.text=="string").map(s=>oa.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Ps(e)&&typeof e.from.by=="string"?{by:e.from.by,byName:typeof e.from.byName=="string"?e.from.byName:void 0,mirroredBy:e.by,mirroredByName:e.byName}:{}})),em=uu(x,t=>Ut(t,2800,document.querySelector(".dt-turbo")??void 0)),_e=document.querySelector(".dt-push"),gn=_e.querySelector(".dt-push-menu"),fn=new Set,eo=new Set([St]),da=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ca=()=>n.client||x?[]:yt.filter(t=>t.status!=="done"&&Jt(t.assignee)&&!qt(t)&&Be(t)==="approved"&&!ln(t)&&!Me(t)&&!to.has(t.id)),ua=()=>ca().filter(t=>!fn.has(t.id)),Xl=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?$e:""}</i>`,Jl=()=>{let t=ca(),e=[...new Set(t.map(o=>o.route??"/"))],s=ua().length;gn.innerHTML=`<div class="dt-push-head">${Pe(14)}<b>Waiting for the agent</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),i=a.filter(l=>!fn.has(l.id)).length;return`<button type="button" class="dt-push-page${eo.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${Ks}</span>${Xl(i>0,i>0&&i<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(eo.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Xl(!fn.has(l.id))}<span><small>#${l.id}</small>${f(Zt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},Zl=()=>["push","paused"].includes(da()),Ti=()=>je.ids.filter(t=>{let e=yt.find(s=>s.id===t);return!!e&&e.status!=="done"&&Be(e)!=="review"&&(to.has(t)||!!ln(e)||Be(e)==="approved")}),Ql="",nm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Mn=()=>{let t=da(),e=ua().length,s=Ti(),o=je.ids.length-s.length,a=s.length>0&&Zl();if(s.length&&(Ql=je.at),!s.length&&je.ids.length&&je.at&&Ql===je.at&&!nm(je.at)){try{sessionStorage.setItem("nm-batch-done",je.at)}catch{}yt.length&&Re(`The agent finished ${je.ids.length} \u2014 check the fixes`,()=>la.start(),"Check")}_e.hidden=n.client||x||!e&&!_e.matches(".is-sending, .is-sent");let i=_e.querySelector(".dt-push-n");i.textContent=String(e),i.hidden=!e||_e.classList.contains("is-sent"),_e.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${s.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to the agent: turbo is on \u2014 the agent takes each thread as it lands":t==="none"?`Push to the agent: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to the agent: ${e} ${e===1?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to the agent: nothing waits for the agent yet \u2014 mark threads for the agent, then send them here",(_e.hidden||!ca().length)&&(gn.hidden=!0),gn.hidden||Jl()},td=async t=>{if(!t.length&&Zl()){Ut("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(da()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Ut("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(da()==="on"){Ut("Turbo is on \u2014 the agent takes each thread as it lands");return}gn.hidden=!0;let e=t.map(o=>o.id);_e.classList.add("is-sending");let s=await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(_e.classList.remove("is-sending"),!s?.ok){Dn("Could not send them to the agent",s),Mn();return}for(let o of e)to.add(o);_e.classList.add("is-sent"),setTimeout(()=>{_e.classList.remove("is-sent"),Mn()},700),je={at:je.ids.some(o=>Ti().includes(o))?je.at:new Date().toISOString(),ids:[...new Set([...Ti(),...e])]},Mn(),Re(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)to.delete(o);Mn()}),Ze()},pa=_e.querySelector(".dt-push-all"),ed=0,Ai=!1,nd=()=>{gn.hidden=!1,Jl()};pa.addEventListener("click",()=>{if(Ai){Ai=!1;return}td(ua())}),pa.addEventListener("contextmenu",t=>{t.preventDefault(),gn.hidden?nd():gn.hidden=!0}),pa.addEventListener("pointerdown",t=>{t.button===0&&(ed=window.setTimeout(()=>{Ai=!0,nd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])pa.addEventListener(t,()=>clearTimeout(ed));gn.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){td(ua());return}if(i==="all")fn.clear();else if(s){let l=s.dataset.pushFold;eo.has(l)?eo.delete(l):eo.add(l)}else if(o){let l=ca().filter(c=>(c.route??"/")===o.dataset.pushRoute),d=l.some(c=>!fn.has(c.id));for(let c of l)d?fn.add(c.id):fn.delete(c.id)}else if(a){let l=Number(a.dataset.pushId);fn.has(l)?fn.delete(l):fn.add(l)}Mn()}),document.addEventListener("pointerdown",t=>{!gn.hidden&&!_e.contains(t.target)&&(gn.hidden=!0)},!0),setInterval(Mn,3e4),Yl=Mn;let sd=document.querySelector(".dt-turbo");sd&&new MutationObserver(Mn).observe(sd,{attributes:!0,attributeFilter:["data-state"]}),Mn();let no="",Hi=!1,Ts="dt-threads",od=String([de.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Ci="",ma=null,sm=t=>{x||t.version&&t.version===Ci||(ma||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=ma;ma=null,Ci=e.version??"";let s=JSON.stringify({project:od,body:e});s.length<2e6?mt.setItem(Ts,s):mt.removeItem(Ts)},{timeout:3e3}),ma=t)},Ni=(t,e=!1)=>{no=t.version??"",em(t);let s=t.turbo;to=new Set(s?.push?.ids??[]),je={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=qn(t.comments);if(e&&(Ue||un)){let i=new Set(o.map(l=>l.id));o=[...o,...yt.filter(l=>Dt(l)==="done"&&!i.has(l.id))]}sm({...t,comments:o}),os(o);let a=o.filter(i=>i.route===St);if(!(Bo&&(B=a,ad()))){if(JSON.stringify(a)===JSON.stringify(B)){!rt.hidden&&!x&&Z();return}B=a,Z(),We({reload:!0})}},as=async(t=!1)=>{let e=[t||!no?"":`since=${no}`,Ue||un?"":"open=1"].filter(Boolean).join("&");try{let s=await ae(`comments${e?`?${e}`:""}`);s.status===200&&Ni(await s.json())}catch{}},so=!1,is=async()=>{if(!document.hidden){if(Hi||es){so=!0;return}Hi=!0,await as(),Hi=!1,so&&(so=!1,is())}};$l=()=>{so&&!es&&(so=!1,is())};let ad=()=>{let t=Bo&&B.find(e=>e.id===Bo);return t?(Bo=0,Ke()&&!wn(t)&&ks(qt(t)?"clients":"studio"),Kt||Qe(!0),Ms(t.id),!0):!1},Ri=()=>{B=yt.filter(t=>t.route===St),ad()||Z()},Bi=0,Pi=null,ha=()=>{Pi&&Kt&&Ii(Pi)},Ii=t=>{Pi=t,!Bi&&(Bi=requestAnimationFrame(()=>{Bi=0;let e=t.target;if(!Kt||e.closest(et)){Jn.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(Jn.hidden=!1,!s)return;let o=s.getBoundingClientRect();xu.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Ar.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Ar.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},id=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),Qt){Qt=null,Z();return}if(N){Fs()&&(nn(),Z());return}if(X!==null){X=null,Z();return}Qe(!1)}},rd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],oo=!1,ao=null,rs=document.createElement("div");rs.className="dt-repin-hint",rs.hidden=!0,rs.setAttribute("role","status"),rs.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(rs);let ld=()=>{ao=null,rs.hidden=!0,ee.toggle("dt-repinning",!1)},om=t=>{ao=t,X=null,rs.hidden=!1,ee.toggle("dt-repinning",!0),Z()};document.addEventListener("keydown",t=>{t.key==="Escape"&&ao!=null&&(t.stopImmediatePropagation(),ld())},!0);let dd=!1,cd=t=>{oo||(t.type==="pointerdown"&&(dd=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},ud=t=>{let e=t.target;dd&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},pd=t=>{!oo&&t.button===0&&t.target.closest?.(":disabled")&&Oi(t)},Oi=t=>{if(oo)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),C){C=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;nt.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(et)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(nt.hidden=!1,!a)return;if(ao!=null){let m=ao;ld();let v=a.getBoundingClientRect();Em(m,a,s?v.left+v.width/2:t.clientX,s?v.top+v.height/2:t.clientY);return}if(!Fs())return;nn();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(m=>!/^(astro|svelte|css)-/.test(m)).slice(0,2);N={selector:_a(a),tag:l,classes:d,nth:Wa({tag:l,classes:d}).indexOf(a),rx:i.width&&!s?(t.clientX-i.left)/i.width:.5,ry:i.height&&!s?(t.clientY-i.top)/i.height:.5,label:Zt(ie(a.textContent||""),60),ctx:za(a),fp:Do(a),spot:{x:Math.round((s?i.left+i.width/2:t.clientX)+scrollX),y:Math.round((s?i.top+i.height/2:t.clientY)+scrollY)},opener:Pu(a),category:g[0].id,...Ke()&&Fe==="clients"?{shared:!0}:{}};let c=n.client||N.shared?null:Gs();c&&(N.assignee=c,N.stage="new",N.carried=!0),hd.set(N,um().then(()=>qi(a))),X=null,Jn.hidden=!0,Z()},am=2200,im=900*1024,md=8*1024*1024,rm=3*1024*1024,lm=50*1024*1024,dm=1200,cm=1600,qi=async t=>{let e=t instanceof HTMLElement?t:null;for(let l=0;e&&l<4&&e.parentElement&&e.parentElement!==document.body;l++){let d=e.getBoundingClientRect();if(d.width>=360&&d.height>=140)break;e=e.parentElement}let s=e?.getBoundingClientRect();if(!e||!s?.width||!s.height)return null;let o=t?.getBoundingClientRect(),a=o&&o.width&&o.height?{x:(o.left-s.left)/s.width,y:(o.top-s.top)/s.height,w:o.width/s.width,h:o.height/s.height}:null,i="";for(let l=e;l&&!i;l=l.parentElement){let d=getComputedStyle(l).backgroundColor;d&&d!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(d)&&(i=d)}if(!i){let[l,d,c]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);i=.299*l+.587*d+.114*c>140?"#111":"#fff"}try{let{domToWebp:l}=await import("modern-screenshot"),d=Math.min(1,dm/s.width,cm/s.height),c=await Promise.race([l(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:i,filter:m=>!(m instanceof Element&&m.closest(fs))}),new Promise(m=>setTimeout(()=>m(null),8e3))]);return c&&c.length<md?{url:c,box:a}:null}catch{return null}},hd=new WeakMap,um=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Ut=(t,e=2800,s)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))Kn(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),i=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,i+8),innerWidth-i-8)}px`}return setTimeout(()=>Kn(o,()=>o.remove()),e),o},gd=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),i=Zo.get(o);if(Zo.delete(o),!i){Ut(`${a} was not sent \u2014 attach it again`);continue}let l=Ut(`Uploading ${a}\u2026`,12e4),d=await ae("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(A=>A.ok?A.json():null).catch(()=>null),c=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),m=c?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!m||!m.ok){Ut(c===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let v=qn([await m.json().catch(()=>null)])[0];v&&(B=B.map(A=>A.id===v.id?v:A),Z()),Ut(`${a} sent`)}},fd=t=>{let e=t.filter(s=>s.startsWith(Jo)).map(s=>s.split("\0"));return e.length&&Ut(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,s,o])=>`${s} (${o})`).join(", ")}`,6e3),t.filter(s=>!s.startsWith(Jo))},Dn=async(t,e)=>{if(!navigator.onLine){Ut(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Ut(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},pm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),mm=async t=>{let e=await createImageBitmap(t),s=Math.min(1,am/Math.max(e.width,e.height));if(s===1&&t.size<=im)return e.close(),pm(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},Di=async(t,e)=>{let s=[],o=(a,i)=>s.push(`${Jo}${a}\0${i}`);for(let a of t){let i,l=fc(a.name)||Object.keys(bo).find(d=>bo[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,ir.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>lm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>rm&&de.via){let c=`${Date.now()}-${Zo.size}`;Zo.set(c,a),s.push(`${ii}${c}\0${a.name}\0${a.size}`);continue}let d=await new Promise((c,m)=>{let v=new FileReader;v.onload=()=>c(String(v.result).split(",")[1]),v.onerror=m,v.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${gc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{i=await mm(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>md){o(a.name,"Too large even after shrinking");continue}s.push(i)}if(s.length){if(!Number(e?.dataset.id)){N&&((N.images??=[]).push(...s),Z());return}Ee.push(...s),Z(),io(".dt-note-reply-input")}},bd=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=bd(t.clipboardData?.items);e.length&&(t.preventDefault(),Di(e,t.target.closest(".dt-note")))}),nt.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),nt.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),nt.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=bd(t.dataTransfer?.items);s.length&&Di(s,e)});let io=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},yd=()=>{io(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Fi=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=ui-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},hm=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),vd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=hm(t);if(!o)return;let a=o[1].toLowerCase(),i=X!=null?B.find(m=>m.id===X):void 0,d=(n.client||N?.shared||i&&qt(i)?n.team??[]:Xo()).filter(m=>!mr(m.email)).filter(m=>m.email!==n.me?.email&&[m.name,m.nickname,m.email].some(v=>v?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(m=>`<button type="button" role="option" data-act="mention" data-handle="${f(wc(m))}">${Nn(m.avatar_url,m.name||m.email)}<span class="dt-mention-who"><b>${f(m.name||m.email)}</b>${m.name?`<span>${f(m.email)}</span>`:""}</span></button>`)].map((m,v)=>m.replace('role="option"',`role="option" aria-selected="${v===0}"`)).join("")}</div>`);let c=t.nextElementSibling;s&&(c.style.animation="none"),c.getBoundingClientRect().top<8&&c.classList.add("is-below")},gm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',fm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',wd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Sa].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${lr}`,"giu"):null;return dr(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${f(o.url)}" target="_blank" rel="noopener noreferrer" title="${f(o.url)}">${o.kind==="pr"?gm:il}<span>${f(o.label)}</span>${fm}</a>`:s?f(o).replace(s,a=>{let i=Hc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${i}">${i==="agent"?Pe(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let $d=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()};document.addEventListener("pointerdown",t=>{for(let e of nt.querySelectorAll(".dt-mentions"))e.contains(t.target)||(e.closest(".dt-compose")?.querySelector("textarea")?.setAttribute("data-no-mention",""),e.remove())},!0);let bm=(t,e)=>{if(!t){N&&(N.category=e),Z();return}Ye(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};Zc([nt,rt],f,$e),rt.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&zo(Number(e.dataset.id),e.value)}),rt.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),Zr(Number(e.dataset.id)))},!0);let ym=t=>qt(t)?"studio":"clients",ji=async(t,e=!1)=>{let s=B.find(i=>i.id===t);if(!s||qt(s)&&s.client)return;let o=!qt(s);X===t&&(X=null);let a=o&&Jt(s.assignee)?{assignee:null,stage:"new"}:{};await Ye(i=>i.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:o||void 0,client:o?l.client:void 0}:l),()=>tt(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to Client":"Moving it to Team"),os(yt),e||Re(o?"Moved to Client":"Moved to Team",()=>ji(t,!0))},vm=async t=>{let e=B.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...qt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Dn("The copy was not made",a);return}let i=qn([await a.json().catch(()=>null)])[0];i&&(yt=[...yt,i],B=yt.filter(d=>d.route===St)),os(yt),Z(),Ze();let l=ym(e);Re(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{i&&(ks(l),Ms(i.id))},"Open")},wm=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],ga=async t=>{let e=[],s=0;for(let o of t){let a=yt.find(m=>m.id===o);if(!a||!qt(a)||Io(a))continue;let i=a,l={text:a.text,from:{id:a.id}};for(let m of wm)i[m]!=null&&(l[m]=i[m]);let d=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Dn("Not mirrored",d);break}let c=qn([await d.json().catch(()=>null)])[0];c&&(d.status===201?e.push(c):s++,yt=[...yt.filter(m=>m.id!==c.id),c])}if(B=yt.filter(o=>o.route===St),os(yt),Z(),Ze(),!e.length){s&&Ut("Already mirrored");return}Re(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));yt=yt.filter(a=>!o.has(a.id)),B=B.filter(a=>!o.has(a.id)),os(yt),Z();for(let a of o)await In(ae(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);Ze()})},_i=()=>{He=null,Oo=null,ue(Xt())},xd=async()=>{let t=[...He??[]];_i(),t.length&&await ga(t)},$m=(t,e)=>{let s=B.find(o=>o.id===t);if(He??=new Set,s&&bs(s)){let o=[...rt.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Oo??t),i=o.indexOf(t);if(e&&a>=0&&i>=0)for(let l of o.slice(Math.min(a,i),Math.max(a,i)+1)){let d=B.find(c=>c.id===l);d&&bs(d)&&He.add(l)}else He.has(t)?He.delete(t):He.add(t);Oo=t}ue(Xt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&He&&(t.stopImmediatePropagation(),t.preventDefault(),_i())},!0);let xm=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}¬emend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>Ut("Link copied"),()=>Ut(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,c=Number(e.dataset.id)||0;e.value="",d==="dup"?vm(c):d==="mirror"?ga([c]):d==="move"?ji(c):d==="link"?xm(c):d==="reopen"?Xe(c,!1):d==="archive"||d==="unarchive"?ns(c,d==="archive"):d==="rm"?(X=null,hi(c)):d==="discard"&&(N=null,Z());return}let s=t.target.closest(".dt-lang-select");if(s){di(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){bm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){ep(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){qu(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(mt.setItem("nm-for",l.value),n.client){N&&(N.assignee=l.value,Gs(l.value),Z());return}Ua(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&N?.suggest){N.suggest.to=e.value,Zn(),Fi(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),vd(s),s.classList.contains("dt-note-input")?N&&(N.text=s.value):s.classList.contains("dt-note-edit-input")?Qt&&(Qt.text=s.value):Ae=s.value,Zn(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Fi(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>aa()&&(bi([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),nt.addEventListener("keydown",t=>{if(t.key==="Escape"&&nt.querySelector(".dt-emoji")){t.stopPropagation();let a=xn?.box??xn?.btn;ta(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&!e.hasAttribute("data-no-mention")&&vd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),$d(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Vt=null,fa=!1;function ro(t){return!n.client||!!n.me&&t.by===n.me.email}let Ed=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},Wi=Ed("dt-drag-box--home"),Md=Ed("dt-drag-box--to"),kd=()=>{let t=document.body.currentCSSZoom??1;for(let e of document.querySelectorAll(".dt-notes-overlay, .dt-notes-hi, .dt-spot, .dt-pad-overlay, .dt-drag-box"))e.style.zoom=t===1?"":String(1/t)};kd(),addEventListener("resize",kd);let Em=async(t,e,s,o)=>{let a=B.find(m=>m.id===t);if(!a)return;let i={...zi(e,s,o),fp:Do(e),spot:{x:Math.round(s+scrollX),y:Math.round(o+scrollY)}},l={selector:a.selector,tag:a.tag,classes:a.classes,nth:a.nth,label:a.label,ctx:a.ctx,rx:a.rx,ry:a.ry,fp:a.fp,spot:a.spot},d=`${ea(a.tag,a.classes,a.selector)}${ie(a.label)?` \xAB${Zt(ie(a.label),24)}\xBB`:""}`,c=(m,v,A)=>Ye(j=>j.map(h=>h.id===t?{...h,...m,anchor:null,...v?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:h),()=>tt({id:t,move:m,anchor:null,repin:v?d:!1}),A);Qn.delete(t),await c(i,!0,"Re-pinning"),Re(`Pinned to ${lo(e)}`,()=>{Qn.delete(t),c(l,!1,"Putting the pin back")})},Mm=async t=>{let e=B.find(i=>i.id===t),s=e&&Ce(e);if(!e||!s)return;let o=s.getBoundingClientRect(),a={...zi(s,o.left+o.width*e.rx,o.top+o.height*e.ry),fp:Do(s)};Qn.delete(t),await Ye(i=>i.map(l=>l.id===t?{...l,...a,anchor:null}:l),()=>tt({id:t,move:a,anchor:null}),"Keeping the pin here"),_s(),Z()},km=t=>{let e=B.find(i=>i.id===t),s=e&&Te(e)?.opener;if(!e||!s)return;oo=!0;let o=s.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0,view:window};try{for(let i of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(i.startsWith("pointer")?PointerEvent:MouseEvent)(i,a))}finally{oo=!1}X=null,setTimeout(()=>{_s(),X=t,Z()},180)},lo=t=>{let e=Zt(ie(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Ld=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,t.querySelector("span").textContent=s,t.hidden=!1},Lm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Sm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},zi=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:_a(t),tag:a,classes:i,nth:Wa({tag:a,classes:i}).indexOf(t),label:Os(t.textContent||"",60),ctx:za(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},Vi=()=>{Vt&&(Vt.on&&Mo(Vt.pin,"land"),Vt.pin.classList.remove("is-dragging"),ee.toggle("dt-dragging",!1),Wi.hidden=Md.hidden=!0,Vt=null,Je())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=B.find(o=>o.id===Number(e.dataset.id));!s||!ro(s)||(Vt={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Ce(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!Vt||!Vt.on&&Math.hypot(t.clientX-Vt.x0,t.clientY-Vt.y0)<4)return;Vt.on=!0,Vt.pin.classList.add("is-dragging"),ee.toggle("dt-dragging",!0),Vt.pin.style.left=`${t.clientX}px`,Vt.pin.style.top=`${t.clientY}px`,Vt.to=Vt.home&&Sm(Vt.home,t.clientX,t.clientY)?Vt.home:Lm(t.clientX,t.clientY);let e=Vt.to&&Vt.to!==Vt.home;Ld(Wi,Vt.home,e?"":Vt.home?lo(Vt.home):""),Wi.classList.toggle("is-left",!!e),Ld(Md,e?Vt.to:null,e?`Move to ${lo(Vt.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!Vt)return;let e=Vt;if(!e.on||!e.to){Vi();return}fa=!0,setTimeout(()=>{fa=!1},0);let s=B.find(d=>d.id===e.id),o=zi(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Vi(),!s)return;let i={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(d,c)=>Ye(m=>m.map(v=>v.id===e.id?{...v,...d}:v),()=>tt({id:e.id,move:d}),c);await l(o,"Moving the pin"),a&&Re(`Moved to ${lo(e.to)}`,()=>l(i,"Putting the pin back"))}),nt.addEventListener("click",t=>{fa&&(t.stopImmediatePropagation(),t.preventDefault(),fa=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Vt?.on&&(t.stopImmediatePropagation(),Vi())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=xn?.btn;if(e?.closest(".dt-emoji")||ta(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){ks("clients"),Ms(a);return}if(o==="react"){fl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&gl(e,!1,o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&xn){let i=xn;gl(i.btn,!0,i);return}if(o==="emoji"&&xn){let i=xn;ta(),i.box?Ap(i.box,e.dataset.emoji):i.id&&fl(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?Ye(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>tt({id:a,priority:i}),"Setting the priority"):N&&(N.priority=i??void 0,Zn(),Z());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&$d(i,e.dataset.handle);return}if(!o){if(N&&!Fs())return;X=X===a?null:a,nn(),Z(),ss&&ia();return}if(o==="speak"){wp(e.closest(".dt-note"),e);return}if(o==="voice-write"){xp(e);return}if(o==="voice"||o==="voice-seek"){rp(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let i=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");i.addEventListener("change",()=>{i.files?.length&&Di([...i.files],l)}),i.click();return}if(o==="unshot"){a?Qt&&Qt.drop.push(e.dataset.img):(e.closest("[data-draft]")?N?.images??[]:Ee).splice(Number(e.dataset.i),1),Z(),Qt&&yd();return}if(o==="edit"){let i=B.find(c=>c.id===a),l=e.dataset.at||null,d=l?i?.replies?.find(c=>c.at===l)?.text:i?.text;if(d===void 0)return;Qt={id:a,at:l,text:d,drop:[]},Z(),yd();return}if(o==="edit-cancel"){Qt=null,Z();return}if(o==="tr-orig"){di(a,e.dataset.at,null);return}if(o==="tr-retry"){di(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let i=e.dataset.at;qp(a,i);return}if(o==="edit-save"){let i=Qt;if(!i)return;let l=i.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}Qt=null;let d=c=>i.drop.includes(c.split("/").pop());await Ye(c=>c.map(m=>m.id!==i.id?m:{...m,...i.at==null?{text:l}:{replies:(m.replies??[]).map(v=>v.at===i.at?{...v,text:l}:v)},images:(m.images??[]).filter(v=>!d(v))}),()=>tt({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(c=>(c.ok||(Qt=i),c),c=>{throw Qt=i,c}),"Saving the edit");return}if(o==="cancel"){Fs()&&(nn(),Z());return}if(o==="twin"){if(!Fs())return;nn(),X=Number(e.dataset.id),Z();return}if(o==="discard"){N=null,Z();return}if(o==="draft-open"){wi(Number(e.dataset.i));return}if(o==="close"){X=null,Z();return}if(o==="hidden-why"){let i=e.getAttribute("aria-expanded")!=="true";e.setAttribute("aria-expanded",String(i)),e.parentElement.querySelector("p").hidden=!i;return}if(o==="go-spot"){let i=B.find(l=>l.id===Number(e.dataset.id));i&&Dr(i);return}if(o==="show-el"){let i=B.find(l=>l.id===Number(e.dataset.id));i&&Ce(i)?.scrollIntoView({block:"center",inline:"center",behavior:Gn()?"smooth":"auto"});return}if(o==="where"){let i=B.find(j=>j.id===Number(e.dataset.id)),l=i&&Te(i),d=l?.hidden;if(!d)return;let c=j=>{let h=j.getBoundingClientRect();return(h.width||h.height)&&j.checkVisibility?.()!==!1?h:null},m=l.shut instanceof HTMLElement?l.shut:null,v=m&&c(m);if(m&&!v){let j=m.getAttribute("style");m.setAttribute("style",`${j??""};display:block!important`),v=c(m),j==null?m.removeAttribute("style"):m.setAttribute("style",j)}v??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let A=document.createElement("div");A.className="dt-where",A.style.cssText=`left:${v.left}px;top:${v.top}px;width:${v.width}px;height:${v.height}px`,document.body.append(A),An(A).then(()=>A.remove());return}if(o==="unsuggest"&&N){N.suggest=null,Z();return}if(o==="uncarry"&&N){N.assignee="",N.carried=!1,Gs(""),Zn(),Z();return}if(o==="save"){if(!N)return;N.images&&(N.images=fd(N.images));let i=(N.images??[]).filter(z=>!ws(z)),l=N.suggest&&N.suggest.to.trim()!==N.suggest.from?{from:N.suggest.from,to:N.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(N.images?.some(ni)?ml:N.images?.some(z=>ws(z)&&!yo(z))?"See the attached image":N.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let c=N,m=n.client||c.shared===!0?null:pr(d,Vs()),v=hd.get(c)??qi(Ce(c)),A={...c,images:c.images?.filter(ws),route:St,text:d,suggest:l,assignee:n.client?ll(c.assignee)||void 0:m??(c.assignee||void 0),shared:n.client?!0:c.shared===!0,stage:n.client?"new":m?"approved":c.stage??(Jt(c.assignee)?"approved":"new"),breakpoint:ja(),browser:Au(),device:x?Sd:"",viewport:{w:innerWidth,h:innerHeight},logs:Gc(),host:location.host},j={...c,id:-Date.now(),text:d,route:St,status:"open",note:"",doneBy:null,breakpoint:A.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};B=[...B,j],N=null,Z();let h=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(A)})).catch(()=>null);if(!h?.ok){B=B.filter(z=>z!==j),nn(),N=c,Z(),Dn("Thread was not saved",h);return}let G=qn([await h.json().catch(()=>null)])[0];B=B.map(z=>z===j&&G?G:z),Z(),G&&v.then(z=>{z&&tt({id:G.id,before:z.url,box:z.box})}),G&&i.length&&gd(G.id,i),Ze();return}if(o==="reply"){let i=nt.querySelector(".dt-note-reply-input");Ee=fd(Ee);let l=i.value.trim()||(Ee.some(ni)?ml:Ee.some(z=>ws(z)&&!yo(z))?"See the attached image":Ee.length?"See the attached file":"");if(!l){i.focus();return}let d=Ee;Ae=l,cn=a,js(),Ae="",Ee=[],i.value="";let c=B,m=B.find(z=>z.id===a),v=n.client||qt(m)?null:pr(l,Vs()),A=v&&m&&(v!==m.assignee||Be(m)!=="approved"||m.status==="done")?{assignee:v,stage:"approved",...m.status==="done"?{status:"open",doneBy:null}:{}}:{};B=B.map(z=>z.id===a?{...z,...A,replies:[...z.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:z),Ho=a,Z();let j=await In(tt({id:a,reply:l,images:d.filter(ws),...A})).catch(()=>null);if(!j?.ok){B=c,Ae=l,Ee=d,Z();let z=nt.querySelector(".dt-note-reply-input");z&&!z.value&&(z.value=l);let It=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Re(`Reply was not sent${j?` (${j.status})`:""} \u2014 it is back in the box`,It,"Retry"):Dn("Reply was not sent",j);return}js();let h=qn([await j.json().catch(()=>null)])[0];h&&(B=B.map(z=>z.id===h.id?h:z),Z()),Ze();let G=d.filter(z=>!ws(z));G.length&&gd(a,G);return}if(o==="unfold"){vs.set(a,1/0),Z();let i=nt.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(i){for(let l of i.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");i.scrollTop=i.scrollHeight,No(i)}delete qe[a],i?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let i=e.closest(".dt-note")?.querySelector(".dt-note-thread");i?.scrollTo({top:i.scrollHeight,behavior:Gn()?"smooth":"auto"}),delete qe[a],e.remove();return}if(o==="hand"){Ua(a,e.dataset.v);return}if(o==="repin"){om(a);return}if(o==="pin-yes"){await Mm(a);return}if(o==="open-it"){km(a);return}if(o==="lost-resolve"){X=null,await Xe(a,!0);return}if(o==="claude"){Zr(a);return}if(o==="sendback"){await Xe(a,!1),io(".dt-note-reply-input");return}if(o==="accept"){await Xe(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await ns(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await hi(a):await Xe(a,o==="done")});let Sd="",We=t=>{yn.hidden||qs.contentWindow?.postMessage({dt:!0,...t},location.origin)},Tm=()=>({notes:Kt,grid:!Tt.hidden,inspect:ft,resolved:Ue,archived:un,...Td.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(x&&e.projectGrid!==void 0){zt=e.projectGrid,Tt.hidden||U();return}if(!x&&t.source===qs.contentWindow){if(e.key){Qd(e.key[0],e.key[1])?.run();return}if(e.closeMenus){F();return}if(e.route){gt();return}if(e.drafts){pi=e.drafts,ue(Xt());return}}if(x&&typeof e.openDraft=="number"){wi(e.openDraft);return}if(x&&typeof e.dropDraft=="number"){ql(e.dropDraft);return}if(x&&typeof e.device=="string"&&(Sd=e.device),x&&e.scrollbar&&ee.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===qs.contentWindow){We(Tm());return}typeof e.notes=="boolean"&&e.notes!==Kt&&Qe(e.notes,!1),typeof e.open=="number"&&Ms(e.open),typeof e.grid=="boolean"&&e.grid===Tt.hidden&&I(e.grid),typeof e.inspect=="string"&&e.inspect!==ft&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Ue&&xi(e.resolved),typeof e.archived=="boolean"&&e.archived!==un&&Ei(e.archived),e.reload&&as()});let Ze=async()=>{await as(),We({reload:!0}),x&&parent.postMessage({dt:!0,reload:!0},location.origin)},Qe=(t,e=!0)=>{if(Kt=t,Pt.setAttribute("aria-pressed",String(t)),t?!x&&rt.hidden&&mt.getItem("dt-history")==="1"&&(Fl(),ve.setAttribute("aria-pressed","true")):(Dl(()=>{Kt||rt.replaceChildren()}),ve.setAttribute("aria-pressed","false")),D(Hr,t?"1":"0"),We({notes:t}),x&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!yn.hidden,ee.toggle("dt-noting",t),t&&!x?zl():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",Oi,!0),document.addEventListener("pointerup",pd,!0);for(let s of rd)document.addEventListener(s,cd,!0);document.addEventListener("contextmenu",ud,!0),document.addEventListener("keydown",id),document.addEventListener("mousemove",Ii),addEventListener("scroll",Je,!0),addEventListener("scroll",ha,!0),addEventListener("scroll",ia,!0),addEventListener("resize",Je),addEventListener("resize",ha),addEventListener("pointerover",Ul,!0),_s(),Gl.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),Kl.observe(document.body),Ri()}else{nn(),X=null,document.removeEventListener("click",Oi,!0),document.removeEventListener("pointerup",pd,!0);for(let s of rd)document.removeEventListener(s,cd,!0);document.removeEventListener("contextmenu",ud,!0),document.removeEventListener("keydown",id),document.removeEventListener("mousemove",Ii),Jn.hidden=!0,removeEventListener("scroll",Je,!0),removeEventListener("scroll",ha,!0),removeEventListener("scroll",ia,!0),removeEventListener("resize",Je),removeEventListener("resize",ha),removeEventListener("pointerover",Ul,!0),Gl.disconnect(),Kl.disconnect(),nt.innerHTML=""}},{pickBp:Gi,...Td}=iu({cfg:n,inFrame:x,persist:D,frame:yn,frameEl:qs,devicesMenu:Xn,bpBtns:Yt,notesOverlay:nt,WIDE:b,bpOf:E,currentBp:ja,deviceById:T,notesOn:()=>Kt,filter:()=>Oa,filterTo:t=>{Oa=t},dropFrameDrafts:()=>{pi=[]},putAway:()=>{X=null,nn()},tellFrame:We,syncBpButtons:Pr,render:()=>Z(),reread:()=>{Kt?Ri():Z()}}),Ad="dt-studio",Hd=t=>{Yn.setAttribute("aria-pressed",String(t)),ee.toggle("dt-no-studio",!t),D(Ad,t?"1":"0")};Yn.addEventListener("click",()=>Hd(Yn.getAttribute("aria-pressed")!=="true")),Hd(mt.getItem(Ad)!=="0"),Pt.addEventListener("click",()=>Qe(!Kt));let fe=document.querySelector(".devtools"),As=document.querySelector(".dt-tab"),Cd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-fe.getBoundingClientRect().top)+12}px`);new ResizeObserver(Cd).observe(fe),addEventListener("resize",Cd);let Am=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),Nd=()=>{fe.removeAttribute("data-tight");let t=fe.getBoundingClientRect().right,e=Am(),s=!1;for(let o of fe.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}fe.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Rd=0,Ki=()=>{cancelAnimationFrame(Rd),Rd=requestAnimationFrame(Nd)},Hm=new ResizeObserver(Ki);for(let t of fe.children)Hm.observe(t);addEventListener("resize",Ki),Nd();for(let t of[1500,4e3])setTimeout(Ki,t);for(let t of w)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||rt.hidden))return;let s=e.getBoundingClientRect(),o=rt.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Bd=t=>{fe.toggleAttribute("data-collapsed",t),As.toggleAttribute("data-collapsed",t),As.setAttribute("aria-expanded",String(!t)),As.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),fe.inert=t,t&&F(),t&&Ns&&ya(""),t&&Kt&&!N&&X==null&&Qe(!1),D("dt-collapsed",t?"1":"0")};As.addEventListener("click",()=>Bd(!fe.hasAttribute("data-collapsed")));let an=document.querySelector(".dt-keys"),Pd=an.querySelector(".dt-set-keys"),Cm=an.querySelector(".dt-set-main"),co=an.querySelector(".dt-set-grid"),Id=an.querySelector('[data-set="grid"] .dt-set-hint'),uo=t=>{if(Cm.hidden=t!=="main",Pd.hidden=t!=="keys",co.hidden=t!=="grid",t==="grid"&&Pm(),Id){let e=ne();Id.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},Ui=t=>uo(t?"keys":"main"),Yi={desktop:{cols:12,gutter:24,margin:24,max:1200},tablet:{cols:8,gutter:16,margin:24,max:null},landscape:{cols:4,gutter:16,margin:16,max:null},portrait:{cols:4,gutter:16,margin:16,max:null}},po={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Nm=["cols","gutter","margin","max"],ba=(t,e)=>Math.min(po[t][1],Math.max(po[t][0],Math.round(e))),Rm=()=>({...Yi,...zt?.widths}),Xi=()=>!!n.project&&!!n.gridAdmin,Od=()=>!Tt.hidden&&!ne()&&k?k:me(),Bm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Pm=()=>{let t=Xi(),e=Rm(),s=Lt(),o=ne(),a=p.find(c=>c.id===s),i=(c,m)=>`<div class="dt-grid-row"><span>${c}</span><b>${m}</b></div>`,l=(de.cabinet||n.cabinet)&&n.project?` <a href="${f(`${de.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
328
|
+
<div class="dt-note-meta dt-note-type">${ri(_s(C.category).id,void 0,!1)}</div>
|
|
329
|
+
${$l("dt-note-input",C.suggest?"Why (optional)":"Comment",C.text??"",'data-act="save"',fl(C.images))}
|
|
330
|
+
${C.carried&&C.assignee?`<p class="dt-carried">${_u}<span>For ${f(an(C.assignee)?.name||C.assignee.split("@")[0])} \xB7 from your last comment</span><button type="button" data-act="uncarry" aria-label="Don\u2019t carry it over" data-tip="Back to Anyone \u2014 and the next ones too">${Tn}</button></p>`:""}
|
|
331
|
+
${ll(C.priority,C.category,void 0,C.assignee??"",!1,!!C.shared,!0)}
|
|
332
|
+
</div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(m=>[m.closest(".dt-note").dataset.id,{top:m.scrollTop,end:m.scrollTop+m.clientHeight>=m.scrollHeight-4}])),c=new Set([...nt.querySelectorAll("[data-msg]")].map(m=>m.dataset.msg)),p=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Wp(e,$n.hidden?o.some(m=>!!a.get(m.id)):o.length>0),Nr(nt,s),p&&!nt.contains(document.activeElement)&&po(".dt-note-reply-input");let v=[],N=[];for(let m of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let _=m.closest(".dt-note").dataset.id,G=d.get(_);if(!G){v.push(m),delete _e[_],m.parentElement.querySelector(".dt-new-below")?.remove();continue}let Nt=[...m.querySelectorAll("[data-msg]")].filter(yt=>!c.has(yt.dataset.msg));for(let yt of Nt)yt.classList.add("dt-msg--new");let $t=G.end||String(Bo)===_;$t&&N.push(m),m.scrollTop=$t?m.scrollHeight:G.top;let Yt=Nt.filter(yt=>!yt.classList.contains("dt-msg--mine")).length;if(Yt&&!G.end&&String(Bo)!==_){_e[_]=(_e[_]??0)+Yt;let yt=_e[_],Gt=m.parentElement.querySelector(".dt-new-below")??m.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Gt.dataset,{act:"newbelow",id:_}),Gt.textContent=`${yt} new ${yt===1?"reply":"replies"} \u2193`}}for(let m of nt.querySelectorAll(".dt-new-below")){let _=m.closest(".dt-note")?.querySelector(".dt-note-thread");(!_||_.scrollTop+_.clientHeight>=_.scrollHeight-4)&&(delete _e[m.dataset.id],m.remove())}Bo=null,Si([...v,...N]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(Po)),X==null?No=null:X!==No&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(No=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&po(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),pe(e),Qa(ti()),Qe();for(let m of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Xi(m);let W=nt.querySelector(".dt-note-input");W&&document.activeElement!==W&&(W.focus(),W.setSelectionRange(W.value.length,W.value.length))},Ti=0,Gp=()=>{Ri&&Jt&&!E&&Yl();let t=!1,e=document.getAnimations().some(l=>l.playState==="running"),s=[],o=!1;for(let l of nt.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(l.classList.contains("dt-note--orphan")||l.classList.contains("is-dragging"))continue;if(l.classList.contains("dt-pin--ghost")){let p=I.find(v=>v.id===Number(l.dataset.id))?.spot;s.push([l,p?{x:p.x-scrollX,y:p.y-scrollY,el:document.body}:null]);continue}let d=I.find(p=>p.id===Number(l.dataset.id)),c=d&&Te(d);s.push([l,c&&l.matches(".dt-pin")&&Su(c.el,c.x,c.y)?null:c]),c&&e&&Ur(c.el)&&(t=!0)}for(let l of nt.querySelectorAll("[data-draft], [data-parked]")){if(l.classList.contains("dt-note--orphan"))continue;let d=l.dataset.parked?We[Number(l.dataset.parked)]:C;s.push([l,d?Te(d):null])}let a=(l,d,c)=>{Math.abs(parseFloat(l.style.left)-d)<.05||(l.style.left=`${d}px`,o=!0),Math.abs(parseFloat(l.style.top)-c)<.05||(l.style.top=`${c}px`,o=!0)};for(let[l,d]of s){let c=l.nextElementSibling;if(!d){l.style.visibility!=="hidden"&&(l.style.visibility="hidden"),c?.matches(".dt-pin-eye")&&!c.hidden&&(c.hidden=!0);continue}if(l.style.visibility&&(l.style.visibility=""),a(l,d.x,d.y),l.matches(".dt-pin[data-id]")){let p=!!(d.hidden||d.opener);if(l.classList.contains("dt-pin--hidden")!==p){l.classList.toggle("dt-pin--hidden",p);for(let v of["title","aria-label"]){let N=(l.getAttribute(v)??"").replace(Ro,"");l.setAttribute(v,p?N.replace(/( \u2014 drag to move)?$/,`${Ro}$1`):N)}}c?.matches(".dt-pin-eye")&&(c.hidden===p&&(c.hidden=!p),p&&a(c,d.x,d.y))}l.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!d.hidden)}if(!Uo.length&&(C||X!=null)){let l=ti();l&&e&&Ur(l)&&Qa(l)}let i=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(i.length){let l=da();for(let d of i)d.style.visibility!=="hidden"&&Pl(d,l)}Lu(C||X!=null?ti():null),Ti=o?0:Ti+1,t&&Qe(),clearTimeout(Ol),Ol=window.setTimeout(Up,150)},Ai=new Map,Ol=0,Up=()=>{let t=new Map,e=o=>{let a=[],i="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){i=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){i="var(--dt-bg)";break}let c=getComputedStyle(l);if(c.backgroundImage!=="none"){i="var(--dt-bg)";break}let p=c.backgroundColor.match(/[\d.]+/g);if(p&&(p[3]===void 0?1:+p[3])>=.9){i=c.backgroundColor;break}}i||="#fff";for(let l of a)t.set(l,i);return i},s=[];for(let o of nt.querySelectorAll(".dt-pin[data-id]")){if(o.style.visibility==="hidden"||o.classList.contains("is-dragging"))continue;let a=o.getBoundingClientRect(),i=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!An(l));i&&s.push([o,e(i)])}for(let[o,a]of s)Ai.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},ql=t=>`dt-gfold:${n.project||location.host}:${t}`,pe=t=>{if(rt.hidden){rt.replaceChildren();return}if(rt.toggleAttribute("data-picking",!!Ce),Nr(rt,pu({bp:t,notes:I.filter(En),breakpoints:h,bandOfNote:y,orphan:e=>!Te(e),statusTools:e=>Ml(e,!1),tick:Ku,replied:Yu,rowMenu:Xu,menuFor:Nn,showResolved:Je,showArchived:hn,archived:ke,drafts:$n.hidden?xl():xi,checks:E?0:pa.toCheck().length,clients:Xe()&&ze==="clients",marker:Yp,assign:Uu,mirror:e=>Xe()?Va(e)?"here":Dt(e)&&Do(e)?"there":"":"",picking:Ce,pickable:xs,mirrorAll:jo()?I.filter(e=>En(e)&&y(e)===t&&xs(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Be(n.me.email)}">${ni({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:ae,forMe:Kp,forAgent:e=>!!$e(e)&&It(e)!=="done",unread:Qr,archives:!n.client,deletable:e=>!Ls(e),folded:rt.hasAttribute("data-collapsed"),shut:e=>pt.getItem(ql(e))==="1",cap:Dl,keep:X})),Ts){let e=rt.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Ts.at,Ts.at),Ts=null}},Ts=null,Dl=150,Kp=t=>{if(It(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||It(t)==="claude"||qe(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return sn(t).some(s=>s.text.toLowerCase().includes("@"+e))},Yp=t=>{let e=$e(t),s=Xo[e??""],o=It(t)==="done"?ke(t)?`<i class="dt-hist-badge is-archived">${wn}</i>`:`<i class="dt-hist-badge is-done">${xe}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${De(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Pn.find(i=>i[0]===ss(t))[2]}"></i>`,a=ni(t)||Bn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Be(t.by||t.byName||"you")}">${a}</span>`},ua=t=>{Li=!1;let e=rt.hasAttribute("data-collapsed");if(t===e||rt.hidden){rt.toggleAttribute("data-collapsed",t),Q();return}let s=rt.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){rt.setAttribute("data-folding",""),Ar(rt,rt.offsetHeight,s,!1,()=>{rt.removeAttribute("data-folding"),rt.setAttribute("data-collapsed",""),Q()});return}rt.removeAttribute("data-folding"),rt.removeAttribute("data-collapsed"),Q(),Ar(rt,s,rt.offsetHeight,!0,()=>{})},Fl=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},jl=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},Xp=t=>{let e=ql(t),s=pt.getItem(e)==="1",o=rt.querySelector(".dt-hist-list"),a=o?.clientHeight??600,i=()=>rt.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let p=i(),v=p?Fl(p):[],N=()=>{F(e,"1"),pe(Zt())};if(!v.length||!Yn())return N();let W=jl(v);Oa(W,!1,a),Hn(W).then(N);return}F(e,""),pe(Zt());let l=i(),d=l?Fl(l):[];if(!d.length||!Yn())return;let c=jl(d);c.hidden=!0,Oa(c,!0,a),Hn(c).then(()=>{c.isConnected&&(c.before(...c.children),c.remove())})};rt.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(ae.q=e.value,Ts={at:e.selectionStart??e.value.length},pe(Zt()))}),rt.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){ae.more=!ae.more,Nn=null,ae.menu=!1,pe(Zt());return}let s=e.closest("[data-row-more]");if(s){let Tt=Number(s.dataset.rowMore);Nn=Nn===Tt?null:Tt,ae.more=!1,pe(Zt());return}if((ae.more||Nn!=null)&&!e.closest(".dt-hist-menu")&&(ae.more=!1,Nn=null,pe(Zt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{ae.more=!1,Nn=null};if(e.closest("[data-hist-rows]")){Dl+=300,pe(Zt());return}if(e.closest("[data-read-all]")){for(let Tt of I)tl(Tt);o(),pe(Zt());return}let a=e.closest("[data-resolve-all]");if(a){let Tt=a.dataset.resolveAll.split(",").map(Number);o(),await Ll(Tt,Pt=>Ze(Pt,!0)),Re(`Resolved ${Tt.length}`,()=>Ll(Tt,Pt=>Ze(Pt,!1)));return}let i=e.closest("[data-row-unread]");if(i){let Tt=Number(i.dataset.rowUnread);Rn[Tt]=Math.max(0,sn(I.find(Pt=>Pt.id===Tt)).length-1),ai(),o(),pe(Zt());return}let l=e.closest("[data-row-link]");if(l){o(),pe(Zt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Kt("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let Tt=Number(d.dataset.rowSelect),Pt=I.find(Ae=>Ae.id===Tt);Ce=new Set(Pt&&xs(Pt)?[Tt]:[]),Fo=Tt,pe(Zt());return}let c=e.closest("[data-row-mirror]");if(c){o(),pe(Zt()),await va([Number(c.dataset.rowMirror)]);return}let p=e.closest("[data-mirror-all]");if(p){o(),pe(Zt()),await va(p.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await Td();return}if(e.closest("[data-pick-cancel]")){Zi();return}let v=e.closest(".dt-hist-go[data-go]");if(v&&jo()&&(Ce||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),$m(Number(v.dataset.go),t.shiftKey);return}let N=e.closest("[data-row-move]");if(N){o(),await Ji(Number(N.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),rt.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){ua(!1);return}if(t.target.closest("[data-fold]")){ua(!rt.hasAttribute("data-collapsed"));return}let W=t.target.closest("[data-gfold]");if(W){Xp(W.dataset.gfold);return}let m=t.target.closest(".dt-hist-bands [data-bp]");if(m){nr(m.dataset.bp);return}let _=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(_){_.dataset.histView?(ae.view=_.dataset.histView,F("dt-view",ae.view),ae.menu=!1):_.dataset.histSort?(ae.sort=_.dataset.histSort,F("dt-sort",ae.sort),ae.menu=!1,ae.more=!1):_.hasAttribute("data-hist-clear")?(ae.q="",Ts={at:0}):ae.menu=!ae.menu,pe(Zt());return}ae.menu&&!t.target.closest(".dt-hist-menu")&&(ae.menu=!1,pe(Zt()));let G=t.target.closest("[data-draft-go], [data-draft-rm]");if(G){let Tt=G.dataset.draftRm!==void 0,Pt=Number(Tt?G.dataset.draftRm:G.dataset.draftGo);$n.hidden?Tt?_l(Pt):Hi(Pt):Ue(Tt?{dropDraft:Pt}:{openDraft:Pt});return}let Nt=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(ae.more=!1),Nt){await Ze(Number(Nt.dataset.id),Nt.dataset.act==="done");return}let $t=t.target.closest("[data-rm]");if($t){X=null,Mi(Number($t.dataset.rm));return}if(t.target.closest("[data-review]")){pa.start();return}if(t.target.closest("[data-resolved]")){Ni(!Je);return}if(t.target.closest("[data-archived]")){Bi(!hn);return}let Yt=t.target.closest("[data-archive-all]");if(Yt){let Tt=Yt.dataset.archiveAll.split(",").map(Number);for(let Pt of Tt)await as(Pt,!0,!0);Re(`Archived ${Tt.length}`,()=>{for(let Pt of Tt)as(Pt,!1,!0)});return}let yt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(yt){await as(Number(yt.dataset.id),yt.dataset.act==="archive");return}let Gt=t.target.closest("[data-go]");if(!Gt)return;let Mt=Number(Gt.dataset.go);if(!$n.hidden){Ue({open:Mt});return}rs(Mt)});let rs=t=>{X=t,No=null,on(),is=!0,Q();let e=I.find(a=>a.id===t),s=e&&Te(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Ne(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):Gr(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&So(o,"land"),ca()},Hi=t=>{let[e]=We.splice(t,1);if(!e)return;on(),C=e,X=null;let s=Te(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Q()},_l=t=>{We.splice(t,1),Q()},pa=mu({inFrame:E,everything:()=>bt,route:()=>At,settle:Ze,keepIn:Fa,toast:t=>Kt(t),waits:t=>It(t)==="claude"||It(t)==="open"&&ss(t)==="review",approve:t=>Ze(t.id,!0),open:t=>{if(Jt||en(!0),y(t)!==Zt()){nr(y(t));for(let e of[600,1500])setTimeout(()=>Ue({open:t.id}),e)}else rs(t.id)}}),Wl=t=>{if(rt.hidden){t?.();return}Xn(rt,()=>{rt.hidden=!0,t?.()})},zl=()=>{Lo(rt),rt.hidden=!1},Jp=t=>{t?zl():Wl(),we.setAttribute("aria-pressed",String(t)),F("dt-history",t?"1":"0"),Q()},Ci=document.querySelector(".dt-resolved-btn"),qn=document.querySelector(".dt-space"),Zp=()=>{if(!qn)return;qn.hidden=!Xe(),qn.dataset.on=ze;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Xe()&&ze==="clients"?(t.dataset.dtSpace="clients",e||(t.classList.add("dt-client-glow"),window.setTimeout(()=>t.classList.remove("dt-client-glow"),1700))):delete t.dataset.dtSpace;let s=document.querySelector(".dt-client-tab");s&&(s.inert=t.dataset.dtSpace!=="clients",s.ariaHidden=s.inert?"true":null);for(let o of qn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===ze));let i=bt.filter(l=>!ke(l)&&It(l)!=="done"&&Dt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=i?String(i):""}qn.querySelector(".dt-space-name").textContent=ze==="clients"?"Client":"Team",qn.querySelector(".dt-space-ic").innerHTML=Et(Sr[ze],14)},Vl=0,As=t=>{if(!Xe()||t===ze)return;let e=()=>{ze=t,Ce=null,F("dt-space",t),X!=null&&!En(I.find(a=>a.id===X))&&(X=null),on(),ls(bt),Q(),pe(Zt())},s=document.documentElement,o=++Vl;s.classList.add("dt-switching"),Promise.all([Hn(nt),Hn(rt)]).then(()=>{o===Vl&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>As("studio")),qn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(qn.open=!1,As(e.dataset.space))});let Hs=document.querySelector(".dt-pinf"),Cs=Hs.querySelector(".dt-pinf-btn"),ln=Hs.querySelector(".dt-pinf-menu"),Gl={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},Qp=()=>I.filter(t=>y(t)===Zt()&&qo(t)&&En(t)),oo=(t,e=!1)=>{ln.hidden=!t,Cs.setAttribute("aria-expanded",String(t)),t&&(za(),e&&ln.querySelector('[aria-checked="true"]')?.focus())};za=()=>{let t=Qp();if(Hs.hidden=!Xe()||!t.length,Hs.hidden){ln.hidden=!0;return}let e=Object.fromEntries(jr.map(p=>[p,t.filter(v=>rl(v,p)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Be(s)],["others","var(--dt-faint)"]];if(Cs.toggleAttribute("data-on",Mn!=="all"),Cs.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} anyone can take, ${e.mine} mine, ${e.others} everyone else's, ${e.resolved} resolved${Mn==="all"?"":`; showing ${Gl[Mn]}, ${e[Mn]}`}`),ln.hidden)return;let a=[...new Set(t.map(p=>xo(p,It(p))?.taker).filter(p=>!!p&&p!==s))].slice(0,2),i=p=>Bn(an(p)?.avatar_url,an(p)?.name||p,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Be(p)}" `),l={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:i(s),others:a.map(i).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${De(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Ke(Pn[2][2],Pn[2][3]),resolved:Ke(In[In.length-1][2],In[In.length-1][3])},d=(p,v)=>`<b class="dt-pinf-share"><i style="--c:${v};width:${Math.round(100*e[p]/e.all)}%"></i></b>`,c=(p,v="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Mn===p}" data-pinf="${p}"><i class="dt-pinf-glyph">${l[p]}</i><span>${Gl[p]}</span>${v?d(p,v):""}<em>${e[p]}</em>${xe}</button>`;ln.innerHTML=`${c("all")}${o.map(([p,v])=>c(p,v)).join("")}${e.resolved||Mn==="resolved"?c("resolved"):""}<hr>${c("claude")}${c("wrote")}${c("check")}`},Cs.addEventListener("click",t=>oo(ln.hidden,t.detail===0)),ln.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(Mn=e.dataset.pinf,F("dt-pinf",Mn),oo(!1),Cs.focus(),Jt?Q():en(!0))}),ln.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),oo(!1),Cs.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...ln.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!ln.hidden&&!Hs.contains(t.target)&&oo(!1)},!0);let Ni=t=>{Je=t,Ci.setAttribute("aria-pressed",String(t)),F("dt-resolved",t?"1":"0"),Ue({resolved:t}),Q(),ds(!0)},Bi=t=>{hn=t,F("dt-archived",t?"1":"0"),Ue({archived:t}),Q(),ds(!0)};Ci.addEventListener("click",()=>Ni(!Je)),Ci.setAttribute("aria-pressed",String(Je)),we.addEventListener("click",()=>{let t=rt.hidden||rt.hasAttribute("data-leaving");t&&!Jt&&en(!0),t&&ua(!1),Jp(t)});let Qe=()=>{ja||!Jt||(ja=requestAnimationFrame(()=>{ja=0,Gp()}))},Ul=`${$s}, .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`,Kl=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Ul))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Ul))},Ri=!1,Yl=()=>{Ri=!1;let t=document.scrollingElement??document.documentElement,e=document.querySelector(".dt-room");if(t.scrollHeight-(e?.offsetHeight??0)<=t.clientHeight+1){e?.remove();return}let s=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==s&&document.body.append(s)},Pi=0,Ii=!1,Oi=!1,Xl=0,tm=()=>{if(!Jt)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Zt();return I.some(s=>!t.has(s.id)&&y(s)===e&&qo(s)&&En(s)&&!!Te(s))},em=()=>Jt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=I.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!Ne(e)}),Jl=new MutationObserver(t=>{if(Jt&&!E&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Ri=!0}t.every(Kl)||((Ti<3||t.some(e=>e.type!=="attributes"))&&Qe(),t.some(e=>e.type!=="attributes")?Ii=!0:t.some(e=>e.attributeName==="class")&&(Oi=!0),Pi||(Pi=window.setTimeout(()=>{if(Pi=0,Ii)zo();else if(Oi&&performance.now()-Xl>1e3){Xl=performance.now();for(let[s,o]of Es)o.el||Es.delete(s)}Ii=Oi=!1;let e=X!=null?I.find(s=>s.id===X):void 0;tm()||em()||e&&Vo&&Iu(e)!==Vo?Q():Qe()},150)))}),Zl=new ResizeObserver(()=>Qe()),Ql=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&Qe()},bt=[],td=()=>{},ao=new Set,Ve={at:"",ids:[]},ls=t=>{bt=t,queueMicrotask(()=>td());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(ke(d)||!En(d))continue;let c=It(d),p=$e(d),v=c==="done"?"done":c==="claude"?"review":p&&Zo[p]||ss(d),N=s[d.route??""]??={...e(),bands:{}};N[v]++;let W=y(d);(N.bands[W]??=e())[v]++}Zp();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>o.map(c=>[c,c==="done"&&!Je?0:d[c]]),l=d=>i(d).reduce((c,[,p])=>c+p,0);for(let d of document.querySelectorAll(".dt-pages a")){let c=d.querySelector(".dt-pages-n");if(!c)continue;let p=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let W of h){let m=p?.bands[W.id];for(let[_,G]of i(m??e())){let Nt=c.querySelector(`[data-bp="${W.id}"][data-state="${_}"]`);Nt.hidden=!G,G&&(Nt.querySelector("i").textContent=String(G),Nt.title=`${W.label}: ${G} ${a[_]}`)}}let v=p?l(p):0;c.hidden=!v;let N=p?h.filter(W=>p.bands[W.id]&&l(p.bands[W.id])).map(W=>`${W.label} ${l(p.bands[W.id])}`).join(" \xB7 "):"";c.title=v?`${o.filter(W=>p[W]).map(W=>`${p[W]} ${a[W]}`).join(" \xB7 ")}
|
|
333
|
+
${N}`:"",d.dataset.n=String(v)}for(let d of document.querySelectorAll(".dt-folder")){let c=d.querySelectorAll(":scope > ul li[data-route] > a").length,p=[...d.querySelectorAll("a[data-n]")].reduce((N,W)=>N+Number(W.dataset.n),0),v=d.querySelector(".dt-folder-n");v.textContent=c?String(c):"",v.title=`${c} ${c===1?"page":"pages"}${p?` \xB7 ${p} open ${p===1?"thread":"threads"}`:""}`}Bt()},Dn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!ra.has(Number(e.id))).map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(s=>typeof s?.text=="string").map(s=>la.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...js(e)&&typeof e.from.by=="string"?{by:e.from.by,byName:typeof e.from.byName=="string"?e.from.byName:void 0,mirroredBy:e.by,mirroredByName:e.byName}:{}})),nm=hu(E,t=>Kt(t,2800,document.querySelector(".dt-turbo")??void 0)),Ge=document.querySelector(".dt-push"),yn=Ge.querySelector(".dt-push-menu"),vn=new Set,io=new Set([At]),ma=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ha=()=>n.client||E?[]:bt.filter(t=>t.status!=="done"&&Qt(t.assignee)&&!Dt(t)&&qe(t)==="approved"&&!cn(t)&&!ke(t)&&!ao.has(t.id)),ga=()=>ha().filter(t=>!vn.has(t.id)),ed=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?xe:""}</i>`,nd=()=>{let t=ha(),e=[...new Set(t.map(o=>o.route??"/"))],s=ga().length;yn.innerHTML=`<div class="dt-push-head">${De(14)}<b>Waiting for the agent</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),i=a.filter(l=>!vn.has(l.id)).length;return`<button type="button" class="dt-push-page${io.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${Jo}</span>${ed(i>0,i>0&&i<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(io.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${ed(!vn.has(l.id))}<span><small>#${l.id}</small>${f(te(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},sd=()=>["push","paused"].includes(ma()),qi=()=>Ve.ids.filter(t=>{let e=bt.find(s=>s.id===t);return!!e&&e.status!=="done"&&qe(e)!=="review"&&(ao.has(t)||!!cn(e)||qe(e)==="approved")}),od="",sm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Sn=()=>{let t=ma(),e=ga().length,s=qi(),o=Ve.ids.length-s.length,a=s.length>0&&sd();if(s.length&&(od=Ve.at),!s.length&&Ve.ids.length&&Ve.at&&od===Ve.at&&!sm(Ve.at)){try{sessionStorage.setItem("nm-batch-done",Ve.at)}catch{}bt.length&&Re(`The agent finished ${Ve.ids.length} \u2014 check the fixes`,()=>pa.start(),"Check")}Ge.hidden=n.client||E||!e&&!Ge.matches(".is-sending, .is-sent");let i=Ge.querySelector(".dt-push-n");i.textContent=String(e),i.hidden=!e||Ge.classList.contains("is-sent"),Ge.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${s.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to the agent: turbo is on \u2014 the agent takes each thread as it lands":t==="none"?`Push to the agent: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to the agent: ${e} ${e===1?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to the agent: nothing waits for the agent yet \u2014 mark threads for the agent, then send them here",(Ge.hidden||!ha().length)&&(yn.hidden=!0),yn.hidden||nd()},ad=async t=>{if(!t.length&&sd()){Kt("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(ma()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Kt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(ma()==="on"){Kt("Turbo is on \u2014 the agent takes each thread as it lands");return}yn.hidden=!0;let e=t.map(o=>o.id);Ge.classList.add("is-sending");let s=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(Ge.classList.remove("is-sending"),!s?.ok){Fn("Could not send them to the agent",s),Sn();return}for(let o of e)ao.add(o);Ge.classList.add("is-sent"),setTimeout(()=>{Ge.classList.remove("is-sent"),Sn()},700),Ve={at:Ve.ids.some(o=>qi().includes(o))?Ve.at:new Date().toISOString(),ids:[...new Set([...qi(),...e])]},Sn(),Re(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)ao.delete(o);Sn()}),tn()},fa=Ge.querySelector(".dt-push-all"),id=0,Di=!1,rd=()=>{yn.hidden=!1,nd()};fa.addEventListener("click",()=>{if(Di){Di=!1;return}ad(ga())}),fa.addEventListener("contextmenu",t=>{t.preventDefault(),yn.hidden?rd():yn.hidden=!0}),fa.addEventListener("pointerdown",t=>{t.button===0&&(id=window.setTimeout(()=>{Di=!0,rd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])fa.addEventListener(t,()=>clearTimeout(id));yn.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){ad(ga());return}if(i==="all")vn.clear();else if(s){let l=s.dataset.pushFold;io.has(l)?io.delete(l):io.add(l)}else if(o){let l=ha().filter(c=>(c.route??"/")===o.dataset.pushRoute),d=l.some(c=>!vn.has(c.id));for(let c of l)d?vn.add(c.id):vn.delete(c.id)}else if(a){let l=Number(a.dataset.pushId);vn.has(l)?vn.delete(l):vn.add(l)}Sn()}),document.addEventListener("pointerdown",t=>{!yn.hidden&&!Ge.contains(t.target)&&(yn.hidden=!0)},!0),setInterval(Sn,3e4),td=Sn;let ld=document.querySelector(".dt-turbo");ld&&new MutationObserver(Sn).observe(ld,{attributes:!0,attributeFilter:["data-state"]}),Sn();let ro="",Fi=!1,Ns="dt-threads",dd=String([ce.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),ji="",ba=null,om=t=>{E||t.version&&t.version===ji||(ba||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=ba;ba=null,ji=e.version??"";let s=JSON.stringify({project:dd,body:e});s.length<2e6?pt.setItem(Ns,s):pt.removeItem(Ns)},{timeout:3e3}),ba=t)},_i=(t,e=!1)=>{ro=t.version??"",nm(t);let s=t.turbo;ao=new Set(s?.push?.ids??[]),Ve={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=Dn(t.comments);if(e&&(Je||hn)){let i=new Set(o.map(l=>l.id));o=[...o,...bt.filter(l=>It(l)==="done"&&!i.has(l.id))]}om({...t,comments:o}),ls(o);let a=o.filter(i=>i.route===At);if(!(Oo&&(I=a,cd()))){if(JSON.stringify(a)===JSON.stringify(I)){!rt.hidden&&!E&&Q();return}I=a,Q(),Ue({reload:!0})}},ds=async(t=!1)=>{let e=[t||!ro?"":`since=${ro}`,Je||hn?"":"open=1"].filter(Boolean).join("&");try{let s=await ie(`comments${e?`?${e}`:""}`);s.status===200&&_i(await s.json())}catch{}},lo=!1,cs=async()=>{if(!document.hidden){if(Fi||os){lo=!0;return}Fi=!0,await ds(),Fi=!1,lo&&(lo=!1,cs())}};kl=()=>{lo&&!os&&(lo=!1,cs())};let cd=()=>{let t=Oo&&I.find(e=>e.id===Oo);return t?(Oo=0,Xe()&&!En(t)&&As(Dt(t)?"clients":"studio"),Jt||en(!0),rs(t.id),!0):!1},Wi=()=>{I=bt.filter(t=>t.route===At),cd()||Q()},zi=0,Vi=null,ya=()=>{Vi&&Jt&&Gi(Vi)},Gi=t=>{Vi=t,!zi&&(zi=requestAnimationFrame(()=>{zi=0;let e=t.target;if(!Jt||e.closest(et)){ts.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(ts.hidden=!1,!s)return;let o=s.getBoundingClientRect();ku.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Ir.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Ir.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},ud=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),ee){ee=null,Q();return}if(C){Gs()&&(on(),Q());return}if(X!==null){X=null,Q();return}en(!1)}},pd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],co=!1,uo=null,us=document.createElement("div");us.className="dt-repin-hint",us.hidden=!0,us.setAttribute("role","status"),us.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(us);let md=()=>{uo=null,us.hidden=!0,ne.toggle("dt-repinning",!1)},hd=t=>{uo=t,X=null,us.hidden=!1,ne.toggle("dt-repinning",!0),Q()};document.addEventListener("keydown",t=>{t.key==="Escape"&&uo!=null&&(t.stopImmediatePropagation(),md())},!0);let gd=!1,fd=t=>{co||(t.type==="pointerdown"&&(gd=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},bd=t=>{let e=t.target;gd&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},yd=t=>{!co&&t.button===0&&t.target.closest?.(":disabled")&&Ui(t)},Ui=t=>{if(co)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),H){H=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;nt.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(et)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(nt.hidden=!1,!a)return;if(uo!=null){let p=uo;md();let v=a.getBoundingClientRect();Em(p,a,s?v.left+v.width/2:t.clientX,s?v.top+v.height/2:t.clientY);return}if(!Gs())return;on();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(p=>!/^(astro|svelte|css)-/.test(p)).slice(0,2);C={selector:Ua(a),tag:l,classes:d,nth:Ka({tag:l,classes:d}).indexOf(a),rx:i.width&&!s?(t.clientX-i.left)/i.width:.5,ry:i.height&&!s?(t.clientY-i.top)/i.height:.5,label:te(re(a.textContent||""),60),ctx:Ya(a),fp:Wo(a),spot:{x:Math.round((s?i.left+i.width/2:t.clientX)+scrollX),y:Math.round((s?i.top+i.height/2:t.clientY)+scrollY)},opener:qu(a),category:g[0].id,...Xe()&&ze==="clients"?{shared:!0}:{}};let c=n.client||C.shared?null:Js();c&&(C.assignee=c,C.stage="new",C.carried=!0),wd.set(C,um().then(()=>Ki(a))),X=null,ts.hidden=!0,Q()},am=2200,im=900*1024,vd=8*1024*1024,rm=3*1024*1024,lm=50*1024*1024,dm=1200,cm=1600,Ki=async t=>{let e=t instanceof HTMLElement?t:null;for(let l=0;e&&l<4&&e.parentElement&&e.parentElement!==document.body;l++){let d=e.getBoundingClientRect();if(d.width>=360&&d.height>=140)break;e=e.parentElement}let s=e?.getBoundingClientRect();if(!e||!s?.width||!s.height)return null;let o=t?.getBoundingClientRect(),a=o&&o.width&&o.height?{x:(o.left-s.left)/s.width,y:(o.top-s.top)/s.height,w:o.width/s.width,h:o.height/s.height}:null,i="";for(let l=e;l&&!i;l=l.parentElement){let d=getComputedStyle(l).backgroundColor;d&&d!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(d)&&(i=d)}if(!i){let[l,d,c]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);i=.299*l+.587*d+.114*c>140?"#111":"#fff"}try{let{domToWebp:l}=await import("modern-screenshot"),d=Math.min(1,dm/s.width,cm/s.height),c=await Promise.race([l(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:i,filter:p=>!(p instanceof Element&&p.closest($s))}),new Promise(p=>setTimeout(()=>p(null),8e3))]);return c&&c.length<vd?{url:c,box:a}:null}catch{return null}},wd=new WeakMap,um=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Kt=(t,e=2800,s)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))Xn(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),i=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,i+8),innerWidth-i-8)}px`}return setTimeout(()=>Xn(o,()=>o.remove()),e),o},$d=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),i=na.get(o);if(na.delete(o),!i){Kt(`${a} was not sent \u2014 attach it again`);continue}let l=Kt(`Uploading ${a}\u2026`,12e4),d=await ie("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(N=>N.ok?N.json():null).catch(()=>null),c=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),p=c?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!p||!p.ok){Kt(c===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let v=Dn([await p.json().catch(()=>null)])[0];v&&(I=I.map(N=>N.id===v.id?v:N),Q()),Kt(`${a} sent`)}},xd=t=>{let e=t.filter(s=>s.startsWith(ea)).map(s=>s.split("\0"));return e.length&&Kt(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,s,o])=>`${s} (${o})`).join(", ")}`,6e3),t.filter(s=>!s.startsWith(ea))},Fn=async(t,e)=>{if(!navigator.onLine){Kt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Kt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},pm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),mm=async t=>{let e=await createImageBitmap(t),s=Math.min(1,am/Math.max(e.width,e.height));if(s===1&&t.size<=im)return e.close(),pm(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},Yi=async(t,e)=>{let s=[],o=(a,i)=>s.push(`${ea}${a}\0${i}`);for(let a of t){let i,l=vc(a.name)||Object.keys(wo).find(d=>wo[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,mr.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>lm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>rm&&ce.via){let c=`${Date.now()}-${na.size}`;na.set(c,a),s.push(`${fi}${c}\0${a.name}\0${a.size}`);continue}let d=await new Promise((c,p)=>{let v=new FileReader;v.onload=()=>c(String(v.result).split(",")[1]),v.onerror=p,v.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${yc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{i=await mm(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>vd){o(a.name,"Too large even after shrinking");continue}s.push(i)}if(s.length){if(!Number(e?.dataset.id)){C&&((C.images??=[]).push(...s),Q());return}Me.push(...s),Q(),po(".dt-note-reply-input")}},Ed=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=Ed(t.clipboardData?.items);e.length&&(t.preventDefault(),Yi(e,t.target.closest(".dt-note")))}),nt.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),nt.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),nt.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=Ed(t.dataTransfer?.items);s.length&&Yi(s,e)});let po=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},Md=()=>{po(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Xi=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=$i-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},hm=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),kd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=hm(t);if(!o)return;let a=o[1].toLowerCase(),i=X!=null?I.find(p=>p.id===X):void 0,d=(n.client||C?.shared||i&&Dt(i)?n.team??[]:ta()).filter(p=>!wr(p.email)).filter(p=>p.email!==n.me?.email&&[p.name,p.nickname,p.email].some(v=>v?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(p=>`<button type="button" role="option" data-act="mention" data-handle="${f(Ec(p))}">${Bn(p.avatar_url,p.name||p.email)}<span class="dt-mention-who"><b>${f(p.name||p.email)}</b>${p.name?`<span>${f(p.email)}</span>`:""}</span></button>`)].map((p,v)=>p.replace('role="option"',`role="option" aria-selected="${v===0}"`)).join("")}</div>`);let c=t.nextElementSibling;s&&(c.style.animation="none"),c.getBoundingClientRect().top<8&&c.classList.add("is-below")},gm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',fm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',Ld=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Ba].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${gr}`,"giu"):null;return fr(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${f(o.url)}" target="_blank" rel="noopener noreferrer" title="${f(o.url)}">${o.kind==="pr"?gm:ui}<span>${f(o.label)}</span>${fm}</a>`:s?f(o).replace(s,a=>{let i=Bc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${i}">${i==="agent"?De(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let Sd=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()};document.addEventListener("pointerdown",t=>{for(let e of nt.querySelectorAll(".dt-mentions"))e.contains(t.target)||(e.closest(".dt-compose")?.querySelector("textarea")?.setAttribute("data-no-mention",""),e.remove())},!0);let bm=(t,e)=>{if(!t){C&&(C.category=e),Q();return}rn(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};eu([nt,rt],f,xe),rt.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&Ko(Number(e.dataset.id),e.value)}),rt.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),al(Number(e.dataset.id)))},!0);let ym=t=>Dt(t)?"studio":"clients",Ji=async(t,e=!1)=>{let s=I.find(i=>i.id===t);if(!s||Dt(s)&&s.client)return;let o=!Dt(s);X===t&&(X=null);let a=o&&Qt(s.assignee)?{assignee:null,stage:"new"}:{};await rn(i=>i.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:o||void 0,client:o?l.client:void 0}:l),()=>tt(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to Client":"Moving it to Team"),ls(bt),e||Re(o?"Moved to Client":"Moved to Team",()=>Ji(t,!0))},vm=async t=>{let e=I.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...Dt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await On(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Fn("The copy was not made",a);return}let i=Dn([await a.json().catch(()=>null)])[0];i&&(bt=[...bt,i],I=bt.filter(d=>d.route===At)),ls(bt),Q(),tn();let l=ym(e);Re(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{i&&(As(l),rs(i.id))},"Open")},wm=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],va=async t=>{let e=[],s=0;for(let o of t){let a=bt.find(p=>p.id===o);if(!a||!Dt(a)||Do(a))continue;let i=a,l={text:a.text,from:{id:a.id}};for(let p of wm)i[p]!=null&&(l[p]=i[p]);let d=await On(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Fn("Not mirrored",d);break}let c=Dn([await d.json().catch(()=>null)])[0];c&&(d.status===201?e.push(c):s++,bt=[...bt.filter(p=>p.id!==c.id),c])}if(I=bt.filter(o=>o.route===At),ls(bt),Q(),tn(),!e.length){s&&Kt("Already mirrored");return}Re(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));bt=bt.filter(a=>!o.has(a.id)),I=I.filter(a=>!o.has(a.id)),ls(bt),Q();for(let a of o)await On(ie(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);tn()})},Zi=()=>{Ce=null,Fo=null,pe(Zt())},Td=async()=>{let t=[...Ce??[]];Zi(),t.length&&await va(t)},$m=(t,e)=>{let s=I.find(o=>o.id===t);if(Ce??=new Set,s&&xs(s)){let o=[...rt.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Fo??t),i=o.indexOf(t);if(e&&a>=0&&i>=0)for(let l of o.slice(Math.min(a,i),Math.max(a,i)+1)){let d=I.find(c=>c.id===l);d&&xs(d)&&Ce.add(l)}else Ce.has(t)?Ce.delete(t):Ce.add(t);Fo=t}pe(Zt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&Ce&&(t.stopImmediatePropagation(),t.preventDefault(),Zi())},!0);let xm=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}¬emend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>Kt("Link copied"),()=>Kt(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,c=Number(e.dataset.id)||0;e.value="",d==="dup"?vm(c):d==="mirror"?va([c]):d==="move"?Ji(c):d==="repin"?hd(c):d==="link"?xm(c):d==="reopen"?Ze(c,!1):d==="archive"||d==="unarchive"?as(c,d==="archive"):d==="rm"?(X=null,Mi(c)):d==="discard"&&(C=null,Q());return}let s=t.target.closest(".dt-lang-select");if(s){vi(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){bm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){op(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){ju(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(pt.setItem("nm-for",l.value),n.client){C&&(C.assignee=l.value,Js(l.value),Q());return}ei(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&C?.suggest){C.suggest.to=e.value,es(),Xi(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),kd(s),s.classList.contains("dt-note-input")?C&&(C.text=s.value):s.classList.contains("dt-note-edit-input")?ee&&(ee.text=s.value):He=s.value,es(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Xi(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>da()&&(Si([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),nt.addEventListener("keydown",t=>{if(t.key==="Escape"&&nt.querySelector(".dt-emoji")){t.stopPropagation();let a=kn?.box??kn?.btn;oa(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&!e.hasAttribute("data-no-mention")&&kd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Sd(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let zt=null,wa=!1;function Bs(t){return!n.client||!!n.me&&t.by===n.me.email}let Ad=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},Qi=Ad("dt-drag-box--home"),Hd=Ad("dt-drag-box--to"),Cd=()=>{let t=document.body.currentCSSZoom??1;for(let e of document.querySelectorAll(".dt-notes-overlay, .dt-notes-hi, .dt-spot, .dt-pad-overlay, .dt-drag-box"))e.style.zoom=t===1?"":String(1/t)};Cd(),addEventListener("resize",Cd);let Em=async(t,e,s,o)=>{let a=I.find(p=>p.id===t);if(!a)return;let i={...tr(e,s,o),fp:Wo(e),spot:{x:Math.round(s+scrollX),y:Math.round(o+scrollY)}},l={selector:a.selector,tag:a.tag,classes:a.classes,nth:a.nth,label:a.label,ctx:a.ctx,rx:a.rx,ry:a.ry,fp:a.fp,spot:a.spot},d=`${aa(a.tag,a.classes,a.selector)}${re(a.label)?` \xAB${te(re(a.label),24)}\xBB`:""}`,c=(p,v,N)=>rn(W=>W.map(m=>m.id===t?{...m,...p,anchor:null,...v?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:m),()=>tt({id:t,move:p,anchor:null,repin:v?d:!1}),N);ns.delete(t),await c(i,!0,"Re-pinning"),Re(`Pinned to ${mo(e)}`,()=>{ns.delete(t),c(l,!1,"Putting the pin back")})},Mm=()=>{let t=Ja;Ja=null;let e=t!=null?I.find(d=>d.id===t):null,s=e&&Ne(e);if(!e||!s||(X===e.id&&rs(e.id),e.spot||!Bs(e)))return;let o=s.getBoundingClientRect(),a=o.left+o.width*e.rx,i=o.top+o.height*e.ry,l={...tr(s,a,i),fp:Wo(s),spot:{x:Math.round(a+scrollX),y:Math.round(i+scrollY)}};ns.delete(e.id),tt({id:e.id,move:l,anchor:null}).then(d=>{d.ok&&Object.assign(e,l,{anchor:null})}).catch(()=>{})},km=t=>{let e=I.find(i=>i.id===t),s=e&&Te(e)?.opener;if(!e||!s)return;co=!0;let o=s.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0,view:window};try{for(let i of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(i.startsWith("pointer")?PointerEvent:MouseEvent)(i,a))}finally{co=!1}X=null,setTimeout(()=>{zo(),X=t,Q()},180)},mo=t=>{let e=te(re(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Nd=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,t.querySelector("span").textContent=s,t.hidden=!1},Lm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Sm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},tr=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:Ua(t),tag:a,classes:i,nth:Ka({tag:a,classes:i}).indexOf(t),label:Ws(t.textContent||"",60),ctx:Ya(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},er=()=>{zt&&(zt.on&&So(zt.pin,"land"),zt.pin.classList.remove("is-dragging"),ne.toggle("dt-dragging",!1),Qi.hidden=Hd.hidden=!0,zt=null,Qe())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=I.find(o=>o.id===Number(e.dataset.id));!s||!Bs(s)||(zt={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Ne(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!zt||!zt.on&&Math.hypot(t.clientX-zt.x0,t.clientY-zt.y0)<4)return;zt.on=!0,zt.pin.classList.add("is-dragging"),ne.toggle("dt-dragging",!0),zt.pin.style.left=`${t.clientX}px`,zt.pin.style.top=`${t.clientY}px`,zt.to=zt.home&&Sm(zt.home,t.clientX,t.clientY)?zt.home:Lm(t.clientX,t.clientY);let e=zt.to&&zt.to!==zt.home;Nd(Qi,zt.home,e?"":zt.home?mo(zt.home):""),Qi.classList.toggle("is-left",!!e),Nd(Hd,e?zt.to:null,e?`Move to ${mo(zt.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!zt)return;let e=zt;if(!e.on||!e.to){er();return}wa=!0,setTimeout(()=>{wa=!1},0);let s=I.find(d=>d.id===e.id),o=tr(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(er(),!s)return;let i={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(d,c)=>rn(p=>p.map(v=>v.id===e.id?{...v,...d}:v),()=>tt({id:e.id,move:d}),c);await l(o,"Moving the pin"),a&&Re(`Moved to ${mo(e.to)}`,()=>l(i,"Putting the pin back"))}),nt.addEventListener("click",t=>{wa&&(t.stopImmediatePropagation(),t.preventDefault(),wa=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&zt?.on&&(t.stopImmediatePropagation(),er())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=kn?.btn;if(e?.closest(".dt-emoji")||oa(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){As("clients"),rs(a);return}if(o==="react"){wl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&vl(e,!1,o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&kn){let i=kn;vl(i.btn,!0,i);return}if(o==="emoji"&&kn){let i=kn;oa(),i.box?Np(i.box,e.dataset.emoji):i.id&&wl(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?rn(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>tt({id:a,priority:i}),"Setting the priority"):C&&(C.priority=i??void 0,es(),Q());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&Sd(i,e.dataset.handle);return}if(!o){if(C&&!Gs())return;X=X===a?null:a,on(),Q(),is&&ca();return}if(o==="speak"){Ep(e.closest(".dt-note"),e);return}if(o==="voice-write"){kp(e);return}if(o==="voice"||o==="voice-seek"){cp(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let i=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");i.addEventListener("change",()=>{i.files?.length&&Yi([...i.files],l)}),i.click();return}if(o==="unshot"){a?ee&&ee.drop.push(e.dataset.img):(e.closest("[data-draft]")?C?.images??[]:Me).splice(Number(e.dataset.i),1),Q(),ee&&Md();return}if(o==="edit"){let i=I.find(c=>c.id===a),l=e.dataset.at||null,d=l?i?.replies?.find(c=>c.at===l)?.text:i?.text;if(d===void 0)return;ee={id:a,at:l,text:d,drop:[]},Q(),Md();return}if(o==="edit-cancel"){ee=null,Q();return}if(o==="tr-orig"){vi(a,e.dataset.at,null);return}if(o==="tr-retry"){vi(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let i=e.dataset.at;jp(a,i);return}if(o==="edit-save"){let i=ee;if(!i)return;let l=i.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}ee=null;let d=c=>i.drop.includes(c.split("/").pop());await rn(c=>c.map(p=>p.id!==i.id?p:{...p,...i.at==null?{text:l}:{replies:(p.replies??[]).map(v=>v.at===i.at?{...v,text:l}:v)},images:(p.images??[]).filter(v=>!d(v))}),()=>tt({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(c=>(c.ok||(ee=i),c),c=>{throw ee=i,c}),"Saving the edit");return}if(o==="cancel"){Gs()&&(on(),Q());return}if(o==="twin"){if(!Gs())return;on(),X=Number(e.dataset.id),Q();return}if(o==="discard"){C=null,Q();return}if(o==="draft-open"){Hi(Number(e.dataset.i));return}if(o==="close"){X=null,Q();return}if(o==="go-spot"){let i=I.find(l=>l.id===Number(e.dataset.id));i&&Gr(i);return}if(o==="show-el"){let i=I.find(l=>l.id===Number(e.dataset.id));i&&Ne(i)?.scrollIntoView({block:"center",inline:"center",behavior:Yn()?"smooth":"auto"});return}if(o==="where"){let i=I.find(W=>W.id===Number(e.dataset.id)),l=i&&Te(i),d=l?.hidden;if(!d)return;let c=W=>{let m=W.getBoundingClientRect();return(m.width||m.height)&&W.checkVisibility?.()!==!1?m:null},p=l.shut instanceof HTMLElement?l.shut:null,v=p&&c(p);if(p&&!v){let W=p.getAttribute("style");p.setAttribute("style",`${W??""};display:block!important`),v=c(p),W==null?p.removeAttribute("style"):p.setAttribute("style",W)}v??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let N=document.createElement("div");N.className="dt-where",N.style.cssText=`left:${v.left}px;top:${v.top}px;width:${v.width}px;height:${v.height}px`,document.body.append(N),Hn(N).then(()=>N.remove());return}if(o==="unsuggest"&&C){C.suggest=null,Q();return}if(o==="uncarry"&&C){C.assignee="",C.carried=!1,Js(""),es(),Q();return}if(o==="save"){if(!C)return;C.images&&(C.images=xd(C.images));let i=(C.images??[]).filter(G=>!ks(G)),l=C.suggest&&C.suggest.to.trim()!==C.suggest.from?{from:C.suggest.from,to:C.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(C.images?.some(pi)?bl:C.images?.some(G=>ks(G)&&!$o(G))?"See the attached image":C.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let c=C,p=n.client||c.shared===!0?null:vr(d,Xs()),v=wd.get(c)??Ki(Ne(c)),N={...c,images:c.images?.filter(ks),route:At,text:d,suggest:l,assignee:n.client?pl(c.assignee)||void 0:p??(c.assignee||void 0),shared:n.client?!0:c.shared===!0,stage:n.client?"new":p?"approved":c.stage??(Qt(c.assignee)?"approved":"new"),breakpoint:Ga(),browser:Nu(),device:E?Bd:"",viewport:{w:innerWidth,h:innerHeight},logs:Yc(),host:location.host},W={...c,id:-Date.now(),text:d,route:At,status:"open",note:"",doneBy:null,breakpoint:N.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};I=[...I,W],C=null,Q();let m=await On(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(N)})).catch(()=>null);if(!m?.ok){I=I.filter(G=>G!==W),on(),C=c,Q(),Fn("Thread was not saved",m);return}let _=Dn([await m.json().catch(()=>null)])[0];I=I.map(G=>G===W&&_?_:G),Q(),_&&v.then(G=>{G&&tt({id:_.id,before:G.url,box:G.box})}),_&&i.length&&$d(_.id,i),tn();return}if(o==="reply"){let i=nt.querySelector(".dt-note-reply-input");Me=xd(Me);let l=i.value.trim()||(Me.some(pi)?bl:Me.some(G=>ks(G)&&!$o(G))?"See the attached image":Me.length?"See the attached file":"");if(!l){i.focus();return}let d=Me;He=l,mn=a,Us(),He="",Me=[],i.value="";let c=I,p=I.find(G=>G.id===a),v=n.client||Dt(p)?null:vr(l,Xs()),N=v&&p&&(v!==p.assignee||qe(p)!=="approved"||p.status==="done")?{assignee:v,stage:"approved",...p.status==="done"?{status:"open",doneBy:null}:{}}:{};I=I.map(G=>G.id===a?{...G,...N,replies:[...G.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:G),Bo=a,Q();let W=await On(tt({id:a,reply:l,images:d.filter(ks),...N})).catch(()=>null);if(!W?.ok){I=c,He=l,Me=d,Q();let G=nt.querySelector(".dt-note-reply-input");G&&!G.value&&(G.value=l);let Nt=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Re(`Reply was not sent${W?` (${W.status})`:""} \u2014 it is back in the box`,Nt,"Retry"):Fn("Reply was not sent",W);return}Us();let m=Dn([await W.json().catch(()=>null)])[0];m&&(I=I.map(G=>G.id===m.id?m:G),Q()),tn();let _=d.filter(G=>!ks(G));_.length&&$d(a,_);return}if(o==="unfold"){Ms.set(a,1/0),Q();let i=nt.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(i){for(let l of i.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");i.scrollTop=i.scrollHeight,Po(i)}delete _e[a],i?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let i=e.closest(".dt-note")?.querySelector(".dt-note-thread");i?.scrollTo({top:i.scrollHeight,behavior:Yn()?"smooth":"auto"}),delete _e[a],e.remove();return}if(o==="hand"){ei(a,e.dataset.v);return}if(o==="repin"){hd(a);return}if(o==="open-it"){km(a);return}if(o==="lost-resolve"){X=null,await Ze(a,!0);return}if(o==="claude"){al(a);return}if(o==="sendback"){await Ze(a,!1),po(".dt-note-reply-input");return}if(o==="accept"){await Ze(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await as(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await Mi(a):await Ze(a,o==="done")});let Bd="",Ue=t=>{$n.hidden||zs.contentWindow?.postMessage({dt:!0,...t},location.origin)},Tm=()=>({notes:Jt,grid:!Ht.hidden,inspect:gt,resolved:Je,archived:hn,...Rd.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(E&&e.projectGrid!==void 0){_t=e.projectGrid,Ht.hidden||K();return}if(!E&&t.source===zs.contentWindow){if(e.key){ac(e.key[0],e.key[1])?.run();return}if(e.closeMenus){j();return}if(e.route){ht();return}if(e.drafts){xi=e.drafts,pe(Zt());return}}if(E&&typeof e.openDraft=="number"){Hi(e.openDraft);return}if(E&&typeof e.dropDraft=="number"){_l(e.dropDraft);return}if(E&&typeof e.device=="string"&&(Bd=e.device),E&&e.scrollbar&&ne.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===zs.contentWindow){Ue(Tm());return}typeof e.notes=="boolean"&&e.notes!==Jt&&en(e.notes,!1),typeof e.open=="number"&&rs(e.open),typeof e.grid=="boolean"&&e.grid===Ht.hidden&&O(e.grid),typeof e.inspect=="string"&&e.inspect!==gt&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Je&&Ni(e.resolved),typeof e.archived=="boolean"&&e.archived!==hn&&Bi(e.archived),e.reload&&ds()});let tn=async()=>{await ds(),Ue({reload:!0}),E&&parent.postMessage({dt:!0,reload:!0},location.origin)},en=(t,e=!0)=>{if(Jt=t,qt.setAttribute("aria-pressed",String(t)),t?!E&&rt.hidden&&pt.getItem("dt-history")==="1"&&(zl(),we.setAttribute("aria-pressed","true")):(Wl(()=>{Jt||rt.replaceChildren()}),we.setAttribute("aria-pressed","false")),F(Or,t?"1":"0"),Ue({notes:t}),E&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!$n.hidden,ne.toggle("dt-noting",t),t&&!E?Yl():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",Ui,!0),document.addEventListener("pointerup",yd,!0);for(let s of pd)document.addEventListener(s,fd,!0);document.addEventListener("contextmenu",bd,!0),document.addEventListener("keydown",ud),document.addEventListener("mousemove",Gi),addEventListener("scroll",Qe,!0),addEventListener("scroll",ya,!0),addEventListener("scroll",ca,!0),addEventListener("resize",Qe),addEventListener("resize",ya),addEventListener("pointerover",Ql,!0),zo(),Jl.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),Zl.observe(document.body),Wi()}else{on(),X=null,document.removeEventListener("click",Ui,!0),document.removeEventListener("pointerup",yd,!0);for(let s of pd)document.removeEventListener(s,fd,!0);document.removeEventListener("contextmenu",bd,!0),document.removeEventListener("keydown",ud),document.removeEventListener("mousemove",Gi),ts.hidden=!0,removeEventListener("scroll",Qe,!0),removeEventListener("scroll",ya,!0),removeEventListener("scroll",ca,!0),removeEventListener("resize",Qe),removeEventListener("resize",ya),removeEventListener("pointerover",Ql,!0),Jl.disconnect(),Zl.disconnect(),nt.innerHTML=""}},{pickBp:nr,...Rd}=du({cfg:n,inFrame:E,persist:F,frame:$n,frameEl:zs,devicesMenu:Qn,bpBtns:Xt,notesOverlay:nt,WIDE:b,bpOf:M,currentBp:Ga,deviceById:T,notesOn:()=>Jt,filter:()=>Wa,filterTo:t=>{Wa=t},dropFrameDrafts:()=>{xi=[]},putAway:()=>{X=null,on()},tellFrame:Ue,syncBpButtons:_r,render:()=>Q(),reread:()=>{Jt?Wi():Q()}}),Pd="dt-studio",Id=t=>{Zn.setAttribute("aria-pressed",String(t)),ne.toggle("dt-no-studio",!t),F(Pd,t?"1":"0")};Zn.addEventListener("click",()=>Id(Zn.getAttribute("aria-pressed")!=="true")),Id(pt.getItem(Pd)!=="0"),qt.addEventListener("click",()=>en(!Jt));let fe=document.querySelector(".devtools"),Rs=document.querySelector(".dt-tab"),Od=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-fe.getBoundingClientRect().top)+12}px`);new ResizeObserver(Od).observe(fe),addEventListener("resize",Od);let Am=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),qd=()=>{fe.removeAttribute("data-tight");let t=fe.getBoundingClientRect().right,e=Am(),s=!1;for(let o of fe.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}fe.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Dd=0,sr=()=>{cancelAnimationFrame(Dd),Dd=requestAnimationFrame(qd)},Hm=new ResizeObserver(sr);for(let t of fe.children)Hm.observe(t);addEventListener("resize",sr),qd();for(let t of[1500,4e3])setTimeout(sr,t);for(let t of w)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||rt.hidden||t.matches(".dt-keys")))return;let s=e.getBoundingClientRect(),o=rt.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Fd=t=>{fe.toggleAttribute("data-collapsed",t),Rs.toggleAttribute("data-collapsed",t),Rs.setAttribute("aria-expanded",String(!t)),Rs.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),fe.inert=t,t&&j(),t&&Os&&xa(""),t&&Jt&&!C&&X==null&&en(!1),F("dt-collapsed",t?"1":"0")};Rs.addEventListener("click",()=>Fd(!fe.hasAttribute("data-collapsed")));let dn=document.querySelector(".dt-keys"),jd=dn.querySelector(".dt-set-keys"),Cm=dn.querySelector(".dt-set-main"),ho=dn.querySelector(".dt-set-grid"),_d=dn.querySelector('[data-set="grid"] .dt-set-hint'),go=t=>{if(Cm.hidden=t!=="main",jd.hidden=t!=="keys",ho.hidden=t!=="grid",t==="grid"&&Pm(),_d){let e=se();_d.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},or=t=>go(t?"keys":"main"),ar={desktop:{cols:12,gutter:24,margin:24,max:1200},tablet:{cols:8,gutter:16,margin:24,max:null},landscape:{cols:4,gutter:16,margin:16,max:null},portrait:{cols:4,gutter:16,margin:16,max:null}},fo={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Nm=["cols","gutter","margin","max"],$a=(t,e)=>Math.min(fo[t][1],Math.max(fo[t][0],Math.round(e))),Bm=()=>({...ar,..._t?.widths}),ir=()=>!!n.project&&!!n.gridAdmin,Wd=()=>!Ht.hidden&&!se()&&k?k:me(),Rm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Pm=()=>{let t=ir(),e=Bm(),s=Lt(),o=se(),a=h.find(c=>c.id===s),i=(c,p)=>`<div class="dt-grid-row"><span>${c}</span><b>${p}</b></div>`,l=(ce.cabinet||n.cabinet)&&n.project?` <a href="${f(`${ce.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
334
334
|
<div class="dt-grid-fields">${Nm.map(c=>`<label><span>${c==="cols"?"Cols":c[0].toUpperCase()+c.slice(1)}</span>
|
|
335
|
-
<input type="number" inputmode="numeric" step="1" min="${
|
|
336
|
-
${
|
|
337
|
-
<p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let c=Od();d=i(c.from==="guess"?"Guessed":"Read from the page",`${c.cols} \xD7 ${c.w}`)+i("Gap",String(c.gap))+i("Margin",String(c.x))}co.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Aa}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(c=>`<button type="button" role="radio" data-grid-mode="${c}" aria-checked="${c==="custom"==!!o}"${t?"":" disabled"}>${c==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},qd=async(t,e)=>{let s=zt,o=c=>{c&&!co.hidden&&uo("grid"),Tt.hidden||U(),We({projectGrid:zt})};zt=t(zt),o(e);let a=await ae("config").then(c=>c.ok?c.json():null).catch(()=>null),i=t(a?a.projectGrid??null:s),l=await ae("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){zt=(await l.json()).grid??null;return}let d=l?await l.text():"";Ut(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),zt=s,o(!0)};if(co.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!Xi()||e==="custom"==!!ne())return;let s=Lt(),o=e==="custom"?Od():null,a=document.documentElement.clientWidth,i=o&&{cols:ba("cols",o.cols),gutter:ba("gutter",o.gap),margin:ba("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:ba("max",o.w)};qd(l=>({mode:e,widths:{...Yi,...l?.widths,...i?{[s]:i}:{}}}),!0)}),co.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=ne();if(!s||!o||!Xi())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=po[s];if(a===null?s!=="max":!Number.isInteger(a)||a<i||a>l){Ut(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${i}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Lt();qd(c=>({mode:"custom",widths:{...Yi,...c?.widths,[d]:{...c?.widths?.[d]??o,[s]:a}}}),!1)}),vt.querySelector("button").addEventListener("click",()=>{F(),an.open=!0,uo("grid")}),uo("main"),de.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;Im();function Im(){let t=document.querySelector(".dt-strip"),e=document.documentElement;if(x){t.hidden=!0;return}ee.toggle("dt-strip-on",!0);let s=t.querySelector(".dt-me");if(n.me){s.querySelector(".dt-me-face").innerHTML=Nn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Ne(n.me.email.toLowerCase())}" `);let M=de.cabinet||n.cabinet;if(M){let V=s.querySelector(".dt-me-cab"),K=s.querySelector(".dt-me-acc");V.href=n.project?`${M}/p/${n.project}`:M,V.hidden=!1,K.href=`${M}/settings?tab=account`,K.hidden=!1}}s.addEventListener("click",M=>{let V=M.target.closest("[data-set], a");V&&(s.open=!1,V.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(mt.removeItem(Ts),de.signOut?.()))});let o=t.querySelector(".dt-pages"),a=o.querySelector(".dt-pages-find input"),i=o.querySelector(".dt-pages-hits"),l=o.querySelector(".dt-pages-foot");o.addEventListener("toggle",()=>{if(o.open){a.value="",d(),requestAnimationFrame(()=>a.focus());let M=o.querySelector(".dt-pages-copy");M&&(delete M.dataset.copied,M.dataset.tip="Copy link")}});let d=()=>{let M=a.value.trim().toLowerCase();if(Bt.hidden=!!M,i.hidden=!M,l.classList.toggle("is-off",!!M),!M)return;let V=n.pages.filter(K=>K.label.toLowerCase().includes(M)||K.route.toLowerCase().includes(M)).slice(0,12);i.innerHTML=V.length?`<ul>${V.map(K=>`<li><a href="${f(K.route)}"${K.route===St?' aria-current="page"':""}><span class="dt-menu-label">${f(K.label)}</span><em class="dt-pages-route">${f(K.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(a.value.trim())}\u201D</p>`};a.addEventListener("input",d),a.addEventListener("keydown",M=>{M.key==="Enter"&&(M.preventDefault(),i.querySelector("a")?.click()),M.key==="Escape"&&a.value&&(M.preventDefault(),M.stopPropagation(),a.value="",d())});let c=o.querySelector(".dt-pages-copy"),m=M=>{M.preventDefault(),M.stopPropagation(),M instanceof MouseEvent&&M.detail>0&&c.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),c.dataset.copied="",c.dataset.tip="Link copied",clearTimeout(Number(c.dataset.t)),c.dataset.t=String(window.setTimeout(()=>{delete c.dataset.copied,c.dataset.tip="Copy link"},1600))};c.addEventListener("click",m),c.addEventListener("keydown",M=>{(M.key==="Enter"||M.key===" ")&&m(M)}),Un=()=>{gt(),os(yt),Et&&It()};let v=()=>{D("dt-folders-open",JSON.stringify([...se])),D("dt-folders-closed",JSON.stringify([...jt]))};if(Bt.addEventListener("click",M=>{let V=M.target,K=V.closest(".dt-folder-more");if(K)return M.preventDefault(),pe(K);let ut=V.closest(".dt-folder-row");if(!ut||ut.querySelector("input"))return;let lt=ut.parentElement,_=lt.dataset.folder,st=!lt.hasAttribute("data-open");st?(se.add(_),jt.delete(_)):(se.delete(_),jt.add(_)),v(),lt.toggleAttribute("data-open",st),ut.setAttribute("aria-expanded",String(st)),ut.children[1].outerHTML=dn(st),Ca(lt.querySelector(":scope > ul"),st)}),Bt.addEventListener("keydown",M=>{(M.key==="Enter"||M.key===" ")&&M.target.matches(".dt-folder-row")&&(M.preventDefault(),M.target.click())}),!Et)return;let A=new Set,j="",h=M=>{let V=M.closest("li[data-route]");if(V)return`p:${V.dataset.route}`;let K=M.closest(".dt-folder:not(.dt-folder--site)");return K&&M.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},G=()=>[...Bt.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(M=>M.matches(".dt-folder")||M.offsetParent).map(M=>M.dataset.route?`p:${M.dataset.route}`:`f:${M.dataset.folder}`),z=l.querySelector(".dt-sel-hint");function It(){for(let V of Bt.querySelectorAll(".is-picked"))V.classList.remove("is-picked");for(let V of A)(V.startsWith("p:")?Bt.querySelector(`li[data-route="${CSS.escape(V.slice(2))}"] > a`):Bt.querySelector(`[data-folder="${CSS.escape(V.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let M=A.size;z.hidden=!M,z.innerHTML=M?`<b>${M} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let Rt=()=>{A.size&&(A.clear(),j="",It())};Bt.addEventListener("click",M=>{let V=M,K=V.metaKey||V.ctrlKey,ut=V.shiftKey,lt=h(M.target);if(!lt||!K&&!ut){M.target.closest(".dt-folder-more")||Rt();return}if(M.preventDefault(),M.stopImmediatePropagation(),ut&&j){let _=G(),st=_.indexOf(j),it=_.indexOf(lt);if(st>=0&&it>=0)for(let te of _.slice(Math.min(st,it),Math.max(st,it)+1))A.add(te)}else A.has(lt)?A.delete(lt):A.add(lt);j=lt,It()},!0),o.addEventListener("toggle",()=>{o.open||Rt()});let le=()=>{let M=G().filter(st=>A.has(st)&&st.startsWith("p:")).map(st=>st.slice(2)),V=[...A].filter(st=>st.startsWith("f:")).map(st=>st.slice(2)).filter(st=>!Q.some(it=>A.has(`f:${it.id}`)&&kt(st,it.id)));if(!M.length&&!V.length)return;let K=new Set([...M.map(st=>Q.find(it=>it.pages.includes(st))?.id??""),...V.map(st=>Q.find(it=>it.id===st)?.parent??"")]),ut=K.size===1&&[...K][0]||null,lt=Math.random().toString(36).slice(2,10),_=[{id:lt,name:"Untitled folder",pages:M,...ut?{parent:ut}:{}},...Q.map(st=>({...st,pages:st.pages.filter(it=>!M.includes(it)),...V.includes(st.id)?{parent:lt}:{}}))];ut&&(se.add(ut),jt.delete(ut)),A.clear(),j="",se.add(lt),jt.delete(lt),v(),Ot(_),Ct(lt,!1)};z.addEventListener("click",M=>{let V=M.target.closest("[data-sel]")?.dataset.sel;V==="group"&&le(),V==="ungroup"&&bt()});let bt=()=>{let M=new Set([...A].filter(ut=>ut.startsWith("f:")).map(ut=>ut.slice(2)));for(let ut of A)if(ut.startsWith("p:")){let lt=Q.find(_=>_.pages.includes(ut.slice(2)));lt&&M.add(lt.id)}if(!M.size)return;let V=Q,K=Q.filter(ut=>M.has(ut.id));A.clear(),j="",Ot(Mt(Q,M)),Re(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ot(V))};document.addEventListener("keydown",M=>{if(!(!o.open||M.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(M.key==="Escape"&&A.size){M.preventDefault(),M.stopImmediatePropagation(),Rt();return}(M.metaKey||M.ctrlKey)&&M.code==="KeyG"&&A.size&&(M.preventDefault(),M.stopImmediatePropagation(),M.shiftKey?bt():le())}},!0),Bt.addEventListener("dblclick",M=>{let V=M.target.closest(".dt-folder:not(.dt-folder--site)");!V||M.target.closest(".dt-folder-more, input")||!M.target.closest(".dt-folder-row")||(M.preventDefault(),Ct(V.dataset.folder,!1))});let Ot=async M=>{let V=Q;Q=M,Le();let K=await ae("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:M})}).catch(()=>null);if(K?.ok){let lt=(await K.json()).folders??[];JSON.stringify(lt)!==JSON.stringify(Q)&&(Q=lt,Le());return}let ut=K?await K.text():"";Ut(K?(()=>{try{return JSON.parse(ut).error}catch{return ut}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),Q=V,Le()},Mt=(M,V)=>{let K=M.map(ut=>({...ut,pages:[...ut.pages]}));for(let ut of V){let lt=K.find(it=>it.id===ut);if(!lt)continue;let _=lt.parent&&K.some(it=>it.id===lt.parent&&it.id!==ut)?lt.parent:null;K=K.filter(it=>it.id!==ut).map(it=>it.parent===ut?{...it,parent:_}:it);let st=_?K.find(it=>it.id===_):null;if(st)for(let it of lt.pages)st.pages.includes(it)||st.pages.push(it)}return K.map(({parent:ut,...lt})=>ut?{...lt,parent:ut}:lt)},kt=(M,V)=>{let K=Q.find(ut=>ut.id===M);return!!K?.parent&&(K.parent===V||kt(K.parent,V))},Ct=(M,V)=>{let K=Bt.querySelector(`[data-folder="${CSS.escape(M)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let ut=Q.find(it=>it.id===M),lt=document.createElement("input");lt.className="dt-folder-name",lt.value=ut.name,lt.maxLength=60,lt.setAttribute("aria-label","Folder name"),K.replaceWith(lt),lt.focus(),lt.select();let _=!1,st=it=>{if(_)return;_=!0;let te=lt.value.trim();if(it&&te)return void Ot(Q.map(ze=>ze.id===M?{...ze,name:te}:ze));V&&(Q=Q.filter(ze=>ze.id!==M)),Le()};lt.addEventListener("keydown",it=>{it.key==="Enter"&&(it.preventDefault(),st(!0)),it.key==="Escape"&&(it.preventDefault(),it.stopPropagation(),st(!1)),it.stopPropagation()}),lt.addEventListener("blur",()=>st(!0)),lt.addEventListener("click",it=>it.stopPropagation())};l.querySelector(".dt-folder-new").addEventListener("click",()=>{let M=Math.random().toString(36).slice(2,10);Q=[{id:M,name:"Untitled folder",pages:[]},...Q],se.add(M),v(),Le(),Ct(M,!0)});let _t=null,ke=()=>{_t?.remove(),_t=null};o.addEventListener("toggle",()=>{o.open||ke()});function pe(M){ke();let V=M.closest(".dt-folder").dataset.folder,K=Q.find(_=>_.id===V);_t=document.createElement("div"),_t.className="dt-folder-menu",_t.setAttribute("role","menu"),_t.innerHTML=`<button type="button" role="menuitem" data-do="rename">${Vn}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${xt('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${dn(!1)}<span>New folder inside</span></button>`+(K.pages.length||Q.some(_=>_.parent===K.id)?`<button type="button" role="menuitem" data-do="ungroup">${xt('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${cs}<span>Delete folder</span></button>`,o.append(_t);let ut=M.getBoundingClientRect(),lt=o.getBoundingClientRect();_t.style.left=`${ut.right-lt.left+6}px`,_t.style.top=`${ut.top-lt.top-4}px`,_t.addEventListener("click",_=>{let st=_.target.closest("[data-do]")?.dataset.do;if(!st)return;if(ke(),st==="rename")return Ct(V,!1);if(st==="add")return tr(V,M);if(st==="sub"){let te=Math.random().toString(36).slice(2,10);return Q=[{id:te,name:"Untitled folder",pages:[],parent:V},...Q],se.add(V),se.add(te),jt.delete(V),v(),Le(),Ct(te,!0)}let it=Q;Ot(Mt(Q,new Set([V]))),Re(st==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ot(it))})}function tr(M,V){ke();let K=Q.find(st=>st.id===M),ut=n.pages.filter(st=>!K.pages.includes(st.route));_t=document.createElement("div"),_t.className="dt-folder-menu dt-folder-add",_t.setAttribute("role","menu"),_t.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(ut.length?ut.map(st=>`<button type="button" role="menuitem" data-route="${f(st.route)}"><span>${f(st.label)}</span><em class="dt-pages-route">${f(st.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),o.append(_t);let lt=V.getBoundingClientRect(),_=o.getBoundingClientRect();_t.style.left=`${lt.right-_.left+6}px`,_t.style.top=`${lt.top-_.top-4}px`,_t.addEventListener("click",st=>{let it=st.target.closest("[data-route]");if(!it)return;let te=it.dataset.route;it.remove(),se.add(M),jt.delete(M),v(),Ot(Q.map(ze=>({...ze,pages:ze.id===M?[...ze.pages.filter(_n=>_n!==te),te]:ze.pages.filter(_n=>_n!==te)})))})}let kn="";Bt.addEventListener("dragstart",M=>{let V=M.target.closest("li[data-route], li.dt-folder");V&&(M.stopPropagation(),kn=V.dataset.route??`f:${V.dataset.folder}`,V.classList.add("is-dragging"),M.dataTransfer?.setData("text/plain",kn),M.dataTransfer&&(M.dataTransfer.effectAllowed="move"))});let rn=M=>M?.closest?.(".dt-folder:not(.dt-folder--site)")??null;Bt.addEventListener("dragover",M=>{if(!kn)return;M.preventDefault();let V=rn(M.target);for(let K of Bt.querySelectorAll(".is-drop"))K!==V&&K.classList.remove("is-drop");V?.classList.add("is-drop"),Bt.classList.toggle("is-drop-out",!V)}),Bt.addEventListener("dragend",()=>{kn="",Bt.classList.remove("is-drop-out");for(let M of Bt.querySelectorAll(".is-drop, .is-dragging"))M.classList.remove("is-drop","is-dragging")});let go=M=>requestAnimationFrame(()=>{let V=Bt.querySelector(M);V&&(Mo(V,"glow"),V.scrollIntoView({block:"nearest",behavior:Gn()?"smooth":"auto"}))});Bt.addEventListener("drop",M=>{M.preventDefault();let V=kn,K=rn(M.target)?.dataset.folder;if(!V)return;if(V.startsWith("f:")){let _=V.slice(2);if(K===_||K&&kt(K,_))return;let st=Q.map(it=>it.id===_?{...it,parent:K??null}:it).map(({parent:it,...te})=>it?{...te,parent:it}:te);K&&(se.add(K),jt.delete(K),v()),JSON.stringify(st)!==JSON.stringify(Q)&&(Ot(st),go(`[data-folder="${CSS.escape(_)}"] > .dt-folder-row`));return}let ut=Q.map(_=>({..._,pages:_.pages.filter(st=>st!==V)})),lt=K?ut.find(_=>_.id===K):null;lt&&(lt.pages.push(V),se.add(lt.id),v()),JSON.stringify(ut)!==JSON.stringify(Q)&&(Ot(ut),go(`li[data-route="${CSS.escape(V)}"] > a`))})}an.querySelector("summary").addEventListener("click",()=>Ui(!1));let Fn=fe.querySelector(".dt-vision"),Hs=Fn.querySelector(".dt-vision-sheet"),mo=[{id:"",name:"Normal",hint:"",css:"none"},{id:"grey",name:"Greyscale",hint:"only light and dark",css:"grayscale(1)"},{id:"low",name:"Low vision",hint:"slightly blurred",css:"blur(2.5px)"},{id:"deut",name:"Deuteranopia",hint:"red\u2013green, most common",css:"url(#dt-deut)",m:"0.367322 0.860646 -0.227968 0 0 0.280085 0.672501 0.047413 0 0 -0.011820 0.042940 0.968881 0 0 0 0 0 1 0"},{id:"prot",name:"Protanopia",hint:"red\u2013green",css:"url(#dt-prot)",m:"0.152286 1.052583 -0.204868 0 0 0.114503 0.786281 0.099216 0 0 -0.003882 -0.048116 1.051998 0 0 0 0 0 1 0"},{id:"trit",name:"Tritanopia",hint:"blue\u2013yellow",css:"url(#dt-trit)",m:"1.255528 -0.076749 -0.178779 0 0 -0.078411 0.930809 0.147602 0 0 0.004733 0.691367 0.303900 0 0 0 0 0 1 0"}];document.body.insertAdjacentHTML("beforeend",`<svg class="dt-vision-defs" width="0" height="0" aria-hidden="true">${mo.filter(t=>t.m).map(t=>`<filter id="dt-${t.id}" color-interpolation-filters="linearRGB"><feColorMatrix type="matrix" values="${t.m}"/></filter>`).join("")}</svg>`);let Dd=document.createElement("style");document.head.append(Dd);let Cs=document.createElement("div");Cs.className="dt-seeing",Cs.hidden=!0,fe.append(Cs);let Ns="",ya=t=>{Ns=t;let e=mo.find(s=>s.id===t)??mo[0];Dd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Fn.toggleAttribute("data-on",!!t),Cs.hidden=!t,Cs.innerHTML=t?`${xt('<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.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${xt('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Cs.addEventListener("click",t=>{t.target.closest("button")&&ya("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Ns||t.defaultPrevented||tc(t.target)||(ya(""),t.preventDefault())});let va=null,Ji=0,Zi=0,Fd=()=>{let t=Math.round((Date.now()-Ji)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},jd=t=>{if(t==="none"){Hs.className="dt-sheet dt-vision-sheet dt-vision-list",Hs.innerHTML='<p class="dt-vision-title">See the page as</p>'+mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Ns}"><span>${s.name}</span>${s.id===Ns?xt('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;Hs.className="dt-sheet dt-vision-sheet",Hs.innerHTML=`<div class="dt-vision-head"><b>This view, six ways</b><span class="dt-vision-ago">${t==="taking"?"taking a snapshot\u2026":`snapshot \xB7 ${Fd()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${xt('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Ns}"><span class="dt-vision-thumb">${va&&t==="ready"?`<img src="${va}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},Qi=async()=>{let t=++Zi;jd("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",s=null;try{let{domToWebp:o}=await import("modern-screenshot");s=await Promise.race([o(document.body,{width:innerWidth,height:innerHeight,scale:460/innerWidth,quality:.75,timeout:4e3,backgroundColor:e,style:{transform:`translate(${-scrollX}px, ${-scrollY}px)`},filter:a=>!(a instanceof Element&&a.closest(`${fs}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==Zi||!Fn.open||(va=s,Ji=Date.now(),jd(s?"ready":"none"))},_d=0,Wd=0,zd=()=>{clearTimeout(Wd),Wd=window.setTimeout(Qi,400)};Fn.addEventListener("toggle",()=>{if(clearInterval(_d),removeEventListener("scroll",zd,!0),!Fn.open){Zi++;return}Qi(),addEventListener("scroll",zd,!0),_d=window.setInterval(()=>{let t=Hs.querySelector(".dt-vision-ago");t&&va&&Ji&&(t.textContent=`snapshot \xB7 ${Fd()}`)},1e3)}),Hs.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void Qi();let s=e.closest("[data-vision]");s&&(ya(s.dataset.vision??""),Fn.open=!1)});let ho=fe.querySelector(".dt-custom"),wa=ho.querySelector(".dt-custom-sheet"),Vd="dt-hidden-tools",Gd="dt-new-seen",Kd=["contrast","vision"],Ud=()=>{let t=(o,a,i)=>{let l=fe.querySelector(a);return l?{id:o,el:l,name:i}:null},e=[t("grid",".dt-grid-btn","Grid"),t("pads",".dt-pad-btn","Spacing"),t("sizes",".dt-size-btn","Size"),t("type",".dt-type-btn","Typography"),t("color",".dt-color-btn","Color"),t("border",".dt-border-btn","Border"),t("contrast",".dt-contrast-btn","Contrast"),t("vision",".dt-vision","Vision")],s=[...Yt.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,i)=>i.toUpperCase())})),{id:"devices",el:Xn,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},Yd=t=>(mt.getItem(t)??"").split(",").filter(Boolean),jn=new Set(Yd(Vd)),Xd=()=>{for(let{tools:e}of Ud())for(let s of e)s.el.toggleAttribute("data-off",jn.has(s.id));Object.entries(ct).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},Om=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",Jd=()=>{let t=Yd(Gd);wa.innerHTML=Ud().map(({group:e,tools:s})=>{let o=s.filter(a=>!jn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${s.length}</span></p><div class="dt-custom-well">${s.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!jn.has(a.id)}">${Om(a.el)}<span>${f(a.name)}</span>${Kd.includes(a.id)&&!t.includes(a.id)?'<i class="dt-custom-new">New</i>':""}</button>`).join("")}</div>`}).join("")+`<div class="dt-custom-foot"><button type="button" class="dt-custom-all"${jn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};wa.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){ho.open=!1;return}e.closest(".dt-custom-all")&&jn.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;jn.delete(o)||jn.add(o)}!s&&!e.closest(".dt-custom-all")||(D(Vd,[...jn].join(",")),Xd(),Jd(),wa.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),ho.addEventListener("toggle",()=>{ho.open?(Jd(),wa.querySelector(".dt-custom-tile")?.focus()):D(Gd,Kd.join(","))}),Xd(),an.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return Ui(s==="keys");if(s==="grid")return uo("grid");an.open=!1,s==="custom"&&(ho.open=!0),s==="hide"&&As.click()});let tn=t=>()=>fe.querySelector(t)?.click(),Zd=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},$a=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:tn(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:tn(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:tn(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>Ei(!un)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){F(),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&tn(".dt-history-btn")(),rt.hasAttribute("data-collapsed")&&ra(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>He?void xd():ks(Fe==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Ls.hidden||Qs(on.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:tn(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:tn(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:tn(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:tn(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:tn(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:tn(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Fn.open=!Fn.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:tn(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:tn(".dt-studio-btn")}]:[],...Yt.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:()=>{Xn.open=!Xn.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Zd(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Zd(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>As.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=an.open&&!Pd.hidden;an.open=!t,Ui(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),Qd=(t,e)=>$a.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&fe.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&Xn.hasAttribute("data-off"))),tc=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(n.shortcuts){for(let o of $a){let a=o.el&&fe.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set($a.map(o=>o.group))].map(o=>e(o,$a.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(s.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),an.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${s.slice(0,2).join("")}</div><div class="dt-keys-half">${s.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||tc(o.composedPath()[0]??o.target))return;let a=Qd(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(x?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),x){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!x){Bd(mt.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>fe.setAttribute("data-ready",""))),Td.restore(),I(mt.getItem(Ft)==="1");let t=mt.getItem($t);t&&t in ct&&Y(t),Qe(mt.getItem(Hr)==="1"&&St!=="/connect")}let ec=()=>{try{let t=JSON.parse(mt.getItem(vn)||"null");De=(t?.parked??[]).filter(s=>Ds(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(N=t.draft,!Kt&&!x&&Qe(!0)):Ds(t?.draft)&&De.push(t.draft),t?.reply?.text&&(Ae=t.reply.text,cn=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${vn}`))||null,sessionStorage.removeItem(`nm-open:${vn}`)}catch{}(N||De.length||Ae)&&Z()}catch{mt.removeItem(vn)}};ec();let nc=()=>setTimeout(()=>{let t=O(location.pathname);t!==St&&(clearTimeout(Ro),js(),St=t,x&&parent.postMessage({dt:!0,route:t},location.origin),vn=Rr(),N=null,De=[],Ae="",cn=null,X=null,Qt=null,B=[],Kt&&!x&&Qe(!1),gt(),ec(),Ri(),as())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),nc()}}addEventListener("popstate",nc);try{let t=JSON.parse(mt.getItem(Ts)||"null");t?.project===od&&t.body?(Ci=t.body.version??"",Ni(t.body),no=""):t&&mt.removeItem(Ts)}catch{mt.removeItem(Ts)}r.then(async t=>{t.status===200&&Ni(await t.json(),!u)},()=>{}).then(()=>!u&&(Ue||un)?as(!0):void 0).then(la.resume),document.addEventListener("visibilitychange",()=>{document.hidden||is()}),addEventListener("focus",is),addEventListener("notemend:changed",()=>{x||is()});let xa=!1,ls=null,sc=()=>{if(!(x||de.via||!("EventSource"in window))){if(document.hidden){ls?.close(),ls=null,xa=!1;return}ls||(ls=new EventSource("/__devbar/events"),ls.onopen=()=>{xa=!0},ls.onerror=()=>{xa=!1},ls.onmessage=t=>{t.data!==no&&is()})}};sc(),document.addEventListener("visibilitychange",sc);let qm=0;x||setInterval(()=>{(!(de.live||xa)||++qm%6===0)&&is()},2e4),setInterval(()=>{!document.hidden&&B.some(t=>ln(t))&&Z()},3e4),x&&parent.postMessage({dt:!0,hello:!0},location.origin)}function fu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,u=r.showModal,p=null,g=null,b=()=>{if(p){g?.disconnect(),g=null;for(let y of n)document.body.append(y);try{p.hidePopover()}catch{}p.remove(),p=null}},E=()=>{b();let y=document.querySelector("dialog:modal");y&&H(y)},H=y=>{b(),p=document.createElement("div"),p.className="dt-host",p.setAttribute("popover","manual"),p.append(...n),y.append(p);try{p.showPopover()}catch{}y.addEventListener("close",E,{once:!0}),g=new MutationObserver(()=>{y.isConnected||E()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){u.call(this),this.isConnected&&H(this)}}function Lr(n,r,u,p=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let b=document.createElement(n?"a":"span");b instanceof HTMLAnchorElement&&n&&(b.href=n,b.target=u,p&&(b.rel=p)),b.className="nm-ask-go",b.textContent=r;let E=document.createElement("style");return E.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
|
|
335
|
+
<input type="number" inputmode="numeric" step="1" min="${fo[c][0]}" max="${fo[c][1]}" data-grid-k="${c}" value="${o[c]??""}"${c==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
|
|
336
|
+
${h.filter(c=>c.id!==s&&e[c.id]).map(c=>i(`${f(Rm(c.label))} \xB7 ${c.ideal}`,`${e[c.id].cols} \xB7 ${e[c.id].gutter} \xB7 ${e[c.id].margin}`)).join("")}<hr>
|
|
337
|
+
<p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let c=Wd();d=i(c.from==="guess"?"Guessed":"Read from the page",`${c.cols} \xD7 ${c.w}`)+i("Gap",String(c.gap))+i("Margin",String(c.x))}ho.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Pa}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(c=>`<button type="button" role="radio" data-grid-mode="${c}" aria-checked="${c==="custom"==!!o}"${t?"":" disabled"}>${c==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},zd=async(t,e)=>{let s=_t,o=c=>{c&&!ho.hidden&&go("grid"),Ht.hidden||K(),Ue({projectGrid:_t})};_t=t(_t),o(e);let a=await ie("config").then(c=>c.ok?c.json():null).catch(()=>null),i=t(a?a.projectGrid??null:s),l=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){_t=(await l.json()).grid??null;return}let d=l?await l.text():"";Kt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),_t=s,o(!0)};if(ho.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!ir()||e==="custom"==!!se())return;let s=Lt(),o=e==="custom"?Wd():null,a=document.documentElement.clientWidth,i=o&&{cols:$a("cols",o.cols),gutter:$a("gutter",o.gap),margin:$a("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:$a("max",o.w)};zd(l=>({mode:e,widths:{...ar,...l?.widths,...i?{[s]:i}:{}}}),!0)}),ho.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=se();if(!s||!o||!ir())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=fo[s];if(a===null?s!=="max":!Number.isInteger(a)||a<i||a>l){Kt(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${i}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Lt();zd(c=>({mode:"custom",widths:{...ar,...c?.widths,[d]:{...c?.widths?.[d]??o,[s]:a}}}),!1)}),ft.querySelector("button").addEventListener("click",()=>{j(),dn.open=!0,go("grid")}),go("main"),ce.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;Im();function Im(){let t=document.querySelector(".dt-strip"),e=document.documentElement;if(E){t.hidden=!0;return}ne.toggle("dt-strip-on",!0);let s=new Map,o=$=>{let R=getComputedStyle($);if(R.position!=="fixed"&&R.position!=="sticky")return null;let U=$.computedStyleMap?.().get("top")?.toString();if(U?U==="auto":R.top==="auto"||parseFloat(R.top)>parseFloat(R.bottom))return null;if(R.position==="sticky"){for(let V=$.parentElement;V&&V!==document.body;V=V.parentElement)if(getComputedStyle(V).overflowY!=="visible")return null}return`calc(${R.top} + 40px)`},a=$=>{for(let V of $??[])V.style.top=s.get(V)??"",s.delete(V);let U=($??[...document.body.children].filter(V=>!/(^|\s)(dt-|devtools)/.test(String(V.className))).flatMap(V=>[V,...V.querySelectorAll("*")])).filter(V=>V.isConnected&&V.style&&!s.has(V)).map(V=>[V,o(V)]).filter(V=>V[1]);for(let[V,ot]of U)s.set(V,V.style.top),V.style.setProperty("top",ot,"important"),i.observe(V,{attributes:!0,attributeFilter:["class"]})},i=new MutationObserver($=>a([...new Set($.map(R=>R.target))].filter(R=>s.has(R)))),l=0,d=()=>{l||=window.setTimeout(()=>{l=0,a()},500)};new MutationObserver($=>{$.every(Kl)||d()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),addEventListener("resize",()=>{a([...s.keys()]),d()}),a();let c=t.querySelector(".dt-me");if(n.me){c.querySelector(".dt-me-face").innerHTML=Bn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Be(n.me.email.toLowerCase())}" `);let $=ce.cabinet||n.cabinet;if($){let R=c.querySelector(".dt-me-cab"),U=c.querySelector(".dt-me-acc");R.href=n.project?`${$}/p/${n.project}`:$,R.hidden=!1,U.href=`${$}/settings?tab=account`,U.hidden=!1}}c.addEventListener("click",$=>{let R=$.target.closest("[data-set], a");R&&(c.open=!1,R.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(pt.removeItem(Ns),ce.signOut?.()))});let p=t.querySelector(".dt-pages"),v=p.querySelector(".dt-pages-find input"),N=p.querySelector(".dt-pages-hits"),W=p.querySelector(".dt-pages-foot");p.addEventListener("toggle",()=>{if(p.open){v.value="",m(),requestAnimationFrame(()=>v.focus());let $=p.querySelector(".dt-pages-copy");$&&(delete $.dataset.copied,$.dataset.tip="Copy link")}});let m=()=>{let $=v.value.trim().toLowerCase();if(Ot.hidden=!!$,N.hidden=!$,W.classList.toggle("is-off",!!$),!$)return;let R=n.pages.filter(U=>U.label.toLowerCase().includes($)||U.route.toLowerCase().includes($)).slice(0,12);N.innerHTML=R.length?`<ul>${R.map(U=>`<li><a href="${f(U.route)}"${U.route===At?' aria-current="page"':""}><span class="dt-menu-label">${f(U.label)}</span><em class="dt-pages-route">${f(U.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(v.value.trim())}\u201D</p>`};v.addEventListener("input",m),v.addEventListener("keydown",$=>{$.key==="Enter"&&($.preventDefault(),N.querySelector("a")?.click()),$.key==="Escape"&&v.value&&($.preventDefault(),$.stopPropagation(),v.value="",m())});let _=p.querySelector(".dt-pages-copy"),G=$=>{$.preventDefault(),$.stopPropagation(),$ instanceof MouseEvent&&$.detail>0&&_.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),_.dataset.copied="",_.dataset.tip="Link copied",clearTimeout(Number(_.dataset.t)),_.dataset.t=String(window.setTimeout(()=>{delete _.dataset.copied,_.dataset.tip="Copy link"},1600))};_.addEventListener("click",G),_.addEventListener("keydown",$=>{($.key==="Enter"||$.key===" ")&&G($)}),Jn=()=>{ht(),ls(bt),St&&Tt()};let Nt=()=>{F("dt-folders-open",JSON.stringify([...oe])),F("dt-folders-closed",JSON.stringify([...jt]))};if(Ot.addEventListener("click",$=>{let R=$.target,U=R.closest(".dt-folder-more");if(U)return $.preventDefault(),Ta(U);let V=R.closest(".dt-folder-row");if(!V||V.querySelector("input"))return;let ot=V.parentElement,kt=ot.dataset.folder,at=!ot.hasAttribute("data-open");at?(oe.add(kt),jt.delete(kt)):(oe.delete(kt),jt.add(kt)),Nt(),ot.toggleAttribute("data-open",at),V.setAttribute("aria-expanded",String(at)),V.children[1].outerHTML=pn(at),Oa(ot.querySelector(":scope > ul"),at)}),Ot.addEventListener("keydown",$=>{($.key==="Enter"||$.key===" ")&&$.target.matches(".dt-folder-row")&&($.preventDefault(),$.target.click())}),!St)return;let $t=new Set,Yt="",yt=$=>{let R=$.closest("li[data-route]");if(R)return`p:${R.dataset.route}`;let U=$.closest(".dt-folder:not(.dt-folder--site)");return U&&$.closest(".dt-folder-row")?`f:${U.dataset.folder}`:""},Gt=()=>[...Ot.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter($=>$.matches(".dt-folder")||$.offsetParent).map($=>$.dataset.route?`p:${$.dataset.route}`:`f:${$.dataset.folder}`),Mt=W.querySelector(".dt-sel-hint");function Tt(){for(let R of Ot.querySelectorAll(".is-picked"))R.classList.remove("is-picked");for(let R of $t)(R.startsWith("p:")?Ot.querySelector(`li[data-route="${CSS.escape(R.slice(2))}"] > a`):Ot.querySelector(`[data-folder="${CSS.escape(R.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let $=$t.size;Mt.hidden=!$,Mt.innerHTML=$?`<b>${$} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let Pt=()=>{$t.size&&($t.clear(),Yt="",Tt())};Ot.addEventListener("click",$=>{let R=$,U=R.metaKey||R.ctrlKey,V=R.shiftKey,ot=yt($.target);if(!ot||!U&&!V){$.target.closest(".dt-folder-more")||Pt();return}if($.preventDefault(),$.stopImmediatePropagation(),V&&Yt){let kt=Gt(),at=kt.indexOf(Yt),lt=kt.indexOf(ot);if(at>=0&<>=0)for(let be of kt.slice(Math.min(at,lt),Math.max(at,lt)+1))$t.add(be)}else $t.has(ot)?$t.delete(ot):$t.add(ot);Yt=ot,Tt()},!0),p.addEventListener("toggle",()=>{p.open||Pt()});let Ae=()=>{let $=Gt().filter(at=>$t.has(at)&&at.startsWith("p:")).map(at=>at.slice(2)),R=[...$t].filter(at=>at.startsWith("f:")).map(at=>at.slice(2)).filter(at=>!Z.some(lt=>$t.has(`f:${lt.id}`)&&ms(at,lt.id)));if(!$.length&&!R.length)return;let U=new Set([...$.map(at=>Z.find(lt=>lt.pages.includes(at))?.id??""),...R.map(at=>Z.find(lt=>lt.id===at)?.parent??"")]),V=U.size===1&&[...U][0]||null,ot=Math.random().toString(36).slice(2,10),kt=[{id:ot,name:"Untitled folder",pages:$,...V?{parent:V}:{}},...Z.map(at=>({...at,pages:at.pages.filter(lt=>!$.includes(lt)),...R.includes(at.id)?{parent:ot}:{}}))];V&&(oe.add(V),jt.delete(V)),$t.clear(),Yt="",oe.add(ot),jt.delete(ot),Nt(),Vt(kt),Ie(ot,!1)};Mt.addEventListener("click",$=>{let R=$.target.closest("[data-sel]")?.dataset.sel;R==="group"&&Ae(),R==="ungroup"&&Pe()});let Pe=()=>{let $=new Set([...$t].filter(V=>V.startsWith("f:")).map(V=>V.slice(2)));for(let V of $t)if(V.startsWith("p:")){let ot=Z.find(kt=>kt.pages.includes(V.slice(2)));ot&&$.add(ot.id)}if(!$.size)return;let R=Z,U=Z.filter(V=>$.has(V.id));$t.clear(),Yt="",Vt(Sa(Z,$)),Re(U.length===1?`Ungrouped \u201C${U[0].name}\u201D`:`Ungrouped ${U.length} folders`,()=>Vt(R))};document.addEventListener("keydown",$=>{if(!(!p.open||$.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if($.key==="Escape"&&$t.size){$.preventDefault(),$.stopImmediatePropagation(),Pt();return}($.metaKey||$.ctrlKey)&&$.code==="KeyG"&&$t.size&&($.preventDefault(),$.stopImmediatePropagation(),$.shiftKey?Pe():Ae())}},!0),Ot.addEventListener("dblclick",$=>{let R=$.target.closest(".dt-folder:not(.dt-folder--site)");!R||$.target.closest(".dt-folder-more, input")||!$.target.closest(".dt-folder-row")||($.preventDefault(),Ie(R.dataset.folder,!1))});let Vt=async $=>{let R=Z;Z=$,Le();let U=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:$})}).catch(()=>null);if(U?.ok){let ot=(await U.json()).folders??[];JSON.stringify(ot)!==JSON.stringify(Z)&&(Z=ot,Le());return}let V=U?await U.text():"";Kt(U?(()=>{try{return JSON.parse(V).error}catch{return V}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),Z=R,Le()},Sa=($,R)=>{let U=$.map(V=>({...V,pages:[...V.pages]}));for(let V of R){let ot=U.find(lt=>lt.id===V);if(!ot)continue;let kt=ot.parent&&U.some(lt=>lt.id===ot.parent&<.id!==V)?ot.parent:null;U=U.filter(lt=>lt.id!==V).map(lt=>lt.parent===V?{...lt,parent:kt}:lt);let at=kt?U.find(lt=>lt.id===kt):null;if(at)for(let lt of ot.pages)at.pages.includes(lt)||at.pages.push(lt)}return U.map(({parent:V,...ot})=>V?{...ot,parent:V}:ot)},ms=($,R)=>{let U=Z.find(V=>V.id===$);return!!U?.parent&&(U.parent===R||ms(U.parent,R))},Ie=($,R)=>{let U=Ot.querySelector(`[data-folder="${CSS.escape($)}"] .dt-folder-row .dt-menu-label`);if(!U)return;let V=Z.find(lt=>lt.id===$),ot=document.createElement("input");ot.className="dt-folder-name",ot.value=V.name,ot.maxLength=60,ot.setAttribute("aria-label","Folder name"),U.replaceWith(ot),ot.focus(),ot.select();let kt=!1,at=lt=>{if(kt)return;kt=!0;let be=ot.value.trim();if(lt&&be)return void Vt(Z.map(Oe=>Oe.id===$?{...Oe,name:be}:Oe));R&&(Z=Z.filter(Oe=>Oe.id!==$)),Le()};ot.addEventListener("keydown",lt=>{lt.key==="Enter"&&(lt.preventDefault(),at(!0)),lt.key==="Escape"&&(lt.preventDefault(),lt.stopPropagation(),at(!1)),lt.stopPropagation()}),ot.addEventListener("blur",()=>at(!0)),ot.addEventListener("click",lt=>lt.stopPropagation())};W.querySelector(".dt-folder-new").addEventListener("click",()=>{let $=Math.random().toString(36).slice(2,10);Z=[{id:$,name:"Untitled folder",pages:[]},...Z],oe.add($),Nt(),Le(),Ie($,!0)});let de=null,hs=()=>{de?.remove(),de=null};p.addEventListener("toggle",()=>{p.open||hs()});function Ta($){hs();let R=$.closest(".dt-folder").dataset.folder,U=Z.find(kt=>kt.id===R);de=document.createElement("div"),de.className="dt-folder-menu",de.setAttribute("role","menu"),de.innerHTML=`<button type="button" role="menuitem" data-do="rename">${Kn}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${Et('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${pn(!1)}<span>New folder inside</span></button>`+(U.pages.length||Z.some(kt=>kt.parent===U.id)?`<button type="button" role="menuitem" data-do="ungroup">${Et('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${Un}<span>Delete folder</span></button>`,p.append(de);let V=$.getBoundingClientRect(),ot=p.getBoundingClientRect();de.style.left=`${V.right-ot.left+6}px`,de.style.top=`${V.top-ot.top-4}px`,de.addEventListener("click",kt=>{let at=kt.target.closest("[data-do]")?.dataset.do;if(!at)return;if(hs(),at==="rename")return Ie(R,!1);if(at==="add")return Wn(R,$);if(at==="sub"){let be=Math.random().toString(36).slice(2,10);return Z=[{id:be,name:"Untitled folder",pages:[],parent:R},...Z],oe.add(R),oe.add(be),jt.delete(R),Nt(),Le(),Ie(be,!0)}let lt=Z;Vt(Sa(Z,new Set([R]))),Re(at==="delete"?`Deleted \u201C${U.name}\u201D`:`Ungrouped \u201C${U.name}\u201D`,()=>Vt(lt))})}function Wn($,R){hs();let U=Z.find(at=>at.id===$),V=n.pages.filter(at=>!U.pages.includes(at.route));de=document.createElement("div"),de.className="dt-folder-menu dt-folder-add",de.setAttribute("role","menu"),de.innerHTML=`<p class="dt-pages-group">Add to ${f(U.name)}</p>`+(V.length?V.map(at=>`<button type="button" role="menuitem" data-route="${f(at.route)}"><span>${f(at.label)}</span><em class="dt-pages-route">${f(at.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),p.append(de);let ot=R.getBoundingClientRect(),kt=p.getBoundingClientRect();de.style.left=`${ot.right-kt.left+6}px`,de.style.top=`${ot.top-kt.top-4}px`,de.addEventListener("click",at=>{let lt=at.target.closest("[data-route]");if(!lt)return;let be=lt.dataset.route;lt.remove(),oe.add($),jt.delete($),Nt(),Vt(Z.map(Oe=>({...Oe,pages:Oe.id===$?[...Oe.pages.filter(Ds=>Ds!==be),be]:Oe.pages.filter(Ds=>Ds!==be)})))})}let zn="";Ot.addEventListener("dragstart",$=>{let R=$.target.closest("li[data-route], li.dt-folder");R&&($.stopPropagation(),zn=R.dataset.route??`f:${R.dataset.folder}`,R.classList.add("is-dragging"),$.dataTransfer?.setData("text/plain",zn),$.dataTransfer&&($.dataTransfer.effectAllowed="move"))});let qs=$=>$?.closest?.(".dt-folder:not(.dt-folder--site)")??null;Ot.addEventListener("dragover",$=>{if(!zn)return;$.preventDefault();let R=qs($.target);for(let U of Ot.querySelectorAll(".is-drop"))U!==R&&U.classList.remove("is-drop");R?.classList.add("is-drop"),Ot.classList.toggle("is-drop-out",!R)}),Ot.addEventListener("dragend",()=>{zn="",Ot.classList.remove("is-drop-out");for(let $ of Ot.querySelectorAll(".is-drop, .is-dragging"))$.classList.remove("is-drop","is-dragging")});let wt=$=>requestAnimationFrame(()=>{let R=Ot.querySelector($);R&&(So(R,"glow"),R.scrollIntoView({block:"nearest",behavior:Yn()?"smooth":"auto"}))});Ot.addEventListener("drop",$=>{$.preventDefault();let R=zn,U=qs($.target)?.dataset.folder;if(!R)return;if(R.startsWith("f:")){let kt=R.slice(2);if(U===kt||U&&ms(U,kt))return;let at=Z.map(lt=>lt.id===kt?{...lt,parent:U??null}:lt).map(({parent:lt,...be})=>lt?{...be,parent:lt}:be);U&&(oe.add(U),jt.delete(U),Nt()),JSON.stringify(at)!==JSON.stringify(Z)&&(Vt(at),wt(`[data-folder="${CSS.escape(kt)}"] > .dt-folder-row`));return}let V=Z.map(kt=>({...kt,pages:kt.pages.filter(at=>at!==R)})),ot=U?V.find(kt=>kt.id===U):null;ot&&(ot.pages.push(R),oe.add(ot.id),Nt()),JSON.stringify(V)!==JSON.stringify(Z)&&(Vt(V),wt(`li[data-route="${CSS.escape(R)}"] > a`))})}dn.querySelector("summary").addEventListener("click",()=>or(!1));let jn=fe.querySelector(".dt-vision"),Ps=jn.querySelector(".dt-vision-sheet"),bo=[{id:"",name:"Normal",hint:"",css:"none"},{id:"grey",name:"Greyscale",hint:"only light and dark",css:"grayscale(1)"},{id:"low",name:"Low vision",hint:"slightly blurred",css:"blur(2.5px)"},{id:"deut",name:"Deuteranopia",hint:"red\u2013green, most common",css:"url(#dt-deut)",m:"0.367322 0.860646 -0.227968 0 0 0.280085 0.672501 0.047413 0 0 -0.011820 0.042940 0.968881 0 0 0 0 0 1 0"},{id:"prot",name:"Protanopia",hint:"red\u2013green",css:"url(#dt-prot)",m:"0.152286 1.052583 -0.204868 0 0 0.114503 0.786281 0.099216 0 0 -0.003882 -0.048116 1.051998 0 0 0 0 0 1 0"},{id:"trit",name:"Tritanopia",hint:"blue\u2013yellow",css:"url(#dt-trit)",m:"1.255528 -0.076749 -0.178779 0 0 -0.078411 0.930809 0.147602 0 0 0.004733 0.691367 0.303900 0 0 0 0 0 1 0"}];document.body.insertAdjacentHTML("beforeend",`<svg class="dt-vision-defs" width="0" height="0" aria-hidden="true">${bo.filter(t=>t.m).map(t=>`<filter id="dt-${t.id}" color-interpolation-filters="linearRGB"><feColorMatrix type="matrix" values="${t.m}"/></filter>`).join("")}</svg>`);let Vd=document.createElement("style");document.head.append(Vd);let Is=document.createElement("div");Is.className="dt-seeing",Is.hidden=!0,fe.append(Is);let Os="",xa=t=>{Os=t;let e=bo.find(s=>s.id===t)??bo[0];Vd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",jn.toggleAttribute("data-on",!!t),Is.hidden=!t,Is.innerHTML=t?`${Et('<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.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${Et('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Is.addEventListener("click",t=>{t.target.closest("button")&&xa("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Os||t.defaultPrevented||ic(t.target)||(xa(""),t.preventDefault())});let Ea=null,rr=0,lr=0,Gd=()=>{let t=Math.round((Date.now()-rr)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},Ud=t=>{if(t==="none"){Ps.className="dt-sheet dt-vision-sheet dt-vision-list",Ps.innerHTML='<p class="dt-vision-title">See the page as</p>'+bo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Os}"><span>${s.name}</span>${s.id===Os?Et('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;Ps.className="dt-sheet dt-vision-sheet",Ps.innerHTML=`<div class="dt-vision-head"><b>This view, six ways</b><span class="dt-vision-ago">${t==="taking"?"taking a snapshot\u2026":`snapshot \xB7 ${Gd()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${Et('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${bo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Os}"><span class="dt-vision-thumb">${Ea&&t==="ready"?`<img src="${Ea}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},dr=async()=>{let t=++lr;Ud("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",s=null;try{let{domToWebp:o}=await import("modern-screenshot");s=await Promise.race([o(document.body,{width:innerWidth,height:innerHeight,scale:460/innerWidth,quality:.75,timeout:4e3,backgroundColor:e,style:{transform:`translate(${-scrollX}px, ${-scrollY}px)`},filter:a=>!(a instanceof Element&&a.closest(`${$s}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==lr||!jn.open||(Ea=s,rr=Date.now(),Ud(s?"ready":"none"))},Kd=0,Yd=0,Xd=()=>{clearTimeout(Yd),Yd=window.setTimeout(dr,400)};jn.addEventListener("toggle",()=>{if(clearInterval(Kd),removeEventListener("scroll",Xd,!0),!jn.open){lr++;return}dr(),addEventListener("scroll",Xd,!0),Kd=window.setInterval(()=>{let t=Ps.querySelector(".dt-vision-ago");t&&Ea&&rr&&(t.textContent=`snapshot \xB7 ${Gd()}`)},1e3)}),Ps.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void dr();let s=e.closest("[data-vision]");s&&(xa(s.dataset.vision??""),jn.open=!1)});let yo=fe.querySelector(".dt-custom"),Ma=yo.querySelector(".dt-custom-sheet"),Jd="dt-hidden-tools",Zd="dt-new-seen",Qd=["contrast","vision"],tc=()=>{let t=(o,a,i)=>{let l=fe.querySelector(a);return l?{id:o,el:l,name:i}:null},e=[t("grid",".dt-grid-btn","Grid"),t("pads",".dt-pad-btn","Spacing"),t("sizes",".dt-size-btn","Size"),t("type",".dt-type-btn","Typography"),t("color",".dt-color-btn","Color"),t("border",".dt-border-btn","Border"),t("contrast",".dt-contrast-btn","Contrast"),t("vision",".dt-vision","Vision")],s=[...Xt.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,i)=>i.toUpperCase())})),{id:"devices",el:Qn,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},ec=t=>(pt.getItem(t)??"").split(",").filter(Boolean),_n=new Set(ec(Jd)),nc=()=>{for(let{tools:e}of tc())for(let s of e)s.el.toggleAttribute("data-off",_n.has(s.id));Object.entries(ct).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},Om=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",sc=()=>{let t=ec(Zd);Ma.innerHTML=tc().map(({group:e,tools:s})=>{let o=s.filter(a=>!_n.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${s.length}</span></p><div class="dt-custom-well">${s.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!_n.has(a.id)}">${Om(a.el)}<span>${f(a.name)}</span>${Qd.includes(a.id)&&!t.includes(a.id)?'<i class="dt-custom-new">New</i>':""}</button>`).join("")}</div>`}).join("")+`<div class="dt-custom-foot"><button type="button" class="dt-custom-all"${_n.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};Ma.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){yo.open=!1;return}e.closest(".dt-custom-all")&&_n.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;_n.delete(o)||_n.add(o)}!s&&!e.closest(".dt-custom-all")||(F(Jd,[..._n].join(",")),nc(),sc(),Ma.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),yo.addEventListener("toggle",()=>{yo.open?(sc(),Ma.querySelector(".dt-custom-tile")?.focus()):F(Zd,Qd.join(","))}),nc(),dn.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return or(s==="keys");if(s==="grid")return go("grid");dn.open=!1,s==="custom"&&(yo.open=!0),s==="hide"&&Rs.click()});let nn=t=>()=>fe.querySelector(t)?.click(),oc=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},ka=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:nn(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:nn(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:nn(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>Bi(!hn)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){j(),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&nn(".dt-history-btn")(),rt.hasAttribute("data-collapsed")&&ua(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>Ce?void Td():As(ze==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Hs.hidden||oo(ln.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:nn(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:nn(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:nn(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:nn(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:nn(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:nn(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{jn.open=!jn.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:nn(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:nn(".dt-studio-btn")}]:[],...Xt.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:()=>{Qn.open=!Qn.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:oc(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:oc(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Rs.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=dn.open&&!jd.hidden;dn.open=!t,or(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),ac=(t,e)=>ka.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&fe.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&Qn.hasAttribute("data-off"))),ic=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(n.shortcuts){for(let o of ka){let a=o.el&&fe.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set(ka.map(o=>o.group))].map(o=>e(o,ka.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(s.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),dn.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${s.slice(0,2).join("")}</div><div class="dt-keys-half">${s.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||ic(o.composedPath()[0]??o.target))return;let a=ac(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(E?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),E){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!E){Fd(pt.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>fe.setAttribute("data-ready",""))),Rd.restore(),O(pt.getItem(Ft)==="1");let t=pt.getItem(xt);t&&t in ct&&Y(t),en(pt.getItem(Or)==="1"&&At!=="/connect")}let rc=()=>{try{let t=JSON.parse(pt.getItem(xn)||"null");We=(t?.parked??[]).filter(s=>Vs(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(C=t.draft,!Jt&&!E&&en(!0)):Vs(t?.draft)&&We.push(t.draft),t?.reply?.text&&(He=t.reply.text,mn=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${xn}`))||null,sessionStorage.removeItem(`nm-open:${xn}`)}catch{}(C||We.length||He)&&Q()}catch{pt.removeItem(xn)}};rc();let lc=()=>setTimeout(()=>{let t=q(location.pathname);t!==At&&(clearTimeout(Io),Us(),At=t,E&&parent.postMessage({dt:!0,route:t},location.origin),xn=Fr(),C=null,We=[],He="",mn=null,X=null,ee=null,I=[],Jt&&!E&&en(!1),ht(),rc(),Wi(),ds())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),lc()}}addEventListener("popstate",lc);try{let t=JSON.parse(pt.getItem(Ns)||"null");t?.project===dd&&t.body?(ji=t.body.version??"",_i(t.body),ro=""):t&&pt.removeItem(Ns)}catch{pt.removeItem(Ns)}r.then(async t=>{t.status===200&&_i(await t.json(),!u)},()=>{}).then(()=>!u&&(Je||hn)?ds(!0):void 0).then(pa.resume),document.addEventListener("visibilitychange",()=>{document.hidden||cs()}),addEventListener("focus",cs),addEventListener("notemend:changed",()=>{E||cs()});let La=!1,ps=null,dc=()=>{if(!(E||ce.via||!("EventSource"in window))){if(document.hidden){ps?.close(),ps=null,La=!1;return}ps||(ps=new EventSource("/__devbar/events"),ps.onopen=()=>{La=!0},ps.onerror=()=>{La=!1},ps.onmessage=t=>{t.data!==ro&&cs()})}};dc(),document.addEventListener("visibilitychange",dc);let qm=0;E||setInterval(()=>{(!(ce.live||La)||++qm%6===0)&&cs()},2e4),setInterval(()=>{!document.hidden&&I.some(t=>cn(t))&&Q()},3e4),E&&parent.postMessage({dt:!0,hello:!0},location.origin)}function vu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,u=r.showModal,h=null,g=null,b=()=>{if(h){g?.disconnect(),g=null;for(let y of n)document.body.append(y);try{h.hidePopover()}catch{}h.remove(),h=null}},M=()=>{b();let y=document.querySelector("dialog:modal");y&&A(y)},A=y=>{b(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...n),y.append(h);try{h.showPopover()}catch{}y.addEventListener("close",M,{once:!0}),g=new MutationObserver(()=>{y.isConnected||M()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){u.call(this),this.isConnected&&A(this)}}function Br(n,r,u,h=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let b=document.createElement(n?"a":"span");b instanceof HTMLAnchorElement&&n&&(b.href=n,b.target=u,h&&(b.rel=h)),b.className="nm-ask-go",b.textContent=r;let M=document.createElement("style");return M.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
|
|
338
338
|
.nm-ask:has(a.nm-ask-go:hover){border-color:rgba(255,255,255,.14)!important}
|
|
339
339
|
.nm-ask-go{transition:background-color 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1)}
|
|
340
340
|
a.nm-ask-go:hover{background:#ff7a33!important}
|
|
341
341
|
a.nm-ask-go:active{background:#d94d00!important;transform:translateY(1px)}
|
|
342
342
|
.nm-ask-go:focus-visible{outline:2px solid #ff6a1a;outline-offset:2px}
|
|
343
|
-
@media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,b.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(
|
|
343
|
+
@media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,b.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(M,b),document.body.append(g),{pill:g,link:b}}function wu(n){let r=window;if(r.__notemend)return;r.__notemend=!0,Kc(g=>g.includes("/__devbar/")||!!ce.base&&g.startsWith(ce.base)),ne.ready=new Promise(g=>{if(!("__next_f"in self))return g();let b=0,M=()=>Object.keys(document.documentElement).some(A=>A.startsWith("__reactFiber$"))||++b>330?g():setTimeout(M,30);M()}),ne.toggle("dt-in-frame",Fs),ne.toggle("dt-strip-on",!Fs);let u=uc(),h=ie(u);qc().then(async g=>{await n,ne.set("--dt-z",String(g.zIndex));let b=g.client?g.brand?.color:null;if(b&&/^#[0-9a-f]{6}$/i.test(b)){let[T,E,F]=[1,3,5].map(dt=>parseInt(b.slice(dt,dt+2),16)/255);ne.set("--dt-accent",b),ne.set("--dt-accent-ink",.2126*T+.7152*E+.0722*F>.55?"#000000":"#ffffff")}_c(g);let M="",A=()=>{let T=document.body.currentCSSZoom??1,E=T>0&&Math.abs(T-1)>.001?String(1/T):"1";E!==M&&(M=E,ne.set("--dt-unzoom",E))};A();let y=new MutationObserver(A);for(let T of[document.documentElement,document.body])y.observe(T,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",A),yu(g,h,u==="comments"),iu(),vu([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-tipbox"].map(T=>document.querySelector(T)).filter(T=>!!T))}).catch(g=>{console.warn("[notemend] not started:",g),ne.toggle("dt-strip-on",!1);let b=window.__notemendHosted;ce.via&&String(g).includes("config 403")&&b?.ask&&(ce.refused=!0,b.ask("You\u2019re not in this project \u2014 sign in as someone else")),!ce.via&&String(g).includes("config 401")&&xh(String(g.said??""))})}function xh(n){if(/link/i.test(n)&&!/sign in/i.test(n)){Br(null,"Link this site to comment: npx notemend link <project-id>","");return}let{link:r}=Br("/__devbar/signin","Sign in to comment","notemend-signin"),u=0;r.addEventListener("click",()=>{clearInterval(u),u=window.setInterval(async()=>{let h=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(h?.done){clearInterval(u),location.reload();return}h?.code&&(r.textContent=`Allow code ${h.code} in the cabinet tab`)},1500)})}var $u=window,vs=class extends Error{},xu=n=>new Set([...n.querySelectorAll("script")].filter(r=>!r.src.includes("/@vite/client")).map(r=>r.src?`src:${r.getAttribute("src").replace(/[?&]t=\d+/,"")}`:`inline:${r.textContent}`)),Eu=(n,r)=>{let u=xu(n);return[...xu(r)].some(h=>!u.has(h))};function Eh(n,r){let u=[],h=n.firstChild;for(let g of r){let b=h;for(;b&&!(b.nodeName===g.nodeName&&(!(g instanceof Element)||!g.id||b.id===g.id));)b=b.nextSibling;u.push(b),b&&(h=b.nextSibling)}return u}function Mh(n,r,u){for(let{name:h,value:g}of u.attributes){let b=r.getAttribute(h);if(b!==g)if(h==="class"&&b!=null){let M=new Set(b.split(/\s+/)),A=new Set(g.split(/\s+/));for(let y of M)y&&!A.has(y)&&n.classList.remove(y);for(let y of A)y&&!M.has(y)&&n.classList.add(y)}else n.setAttribute(h,g)}for(let{name:h}of r.attributes)u.hasAttribute(h)||n.removeAttribute(h)}function Mu(n,r,u){if(r.isEqualNode(u))return;if(r.nodeType!==Node.ELEMENT_NODE||u.nodeType!==Node.ELEMENT_NODE||r.nodeName!==u.nodeName||u.nodeName==="ASTRO-ISLAND"){if(r.nodeType===Node.TEXT_NODE&&u.nodeType===Node.TEXT_NODE){n.nodeValue=u.nodeValue;return}n.parentNode.replaceChild(document.importNode(u,!0),n);return}Mh(n,r,u);let h=[...r.childNodes],g=[...u.childNodes],b=Eh(n,h),M=0,A=0;for(;M<h.length&&M<g.length&&h[M].isEqualNode(g[M]);)M++;for(;A<h.length-M&&A<g.length-M&&h[h.length-1-A].isEqualNode(g[g.length-1-A]);)A++;let y=h.slice(M,h.length-A),T=g.slice(M,g.length-A);if(y.length===T.length&&y.every((J,tt)=>J.nodeName===T[tt].nodeName)){y.forEach((J,tt)=>{let q=b[M+tt];if(!q)throw new vs;Mu(q,J,T[tt])});return}let E=A?b[h.length-A]:null,F=M?b[M-1]:null;if(A&&!E||M&&!F)throw new vs;for(let J of b.slice(M,h.length-A))J?.parentNode?.removeChild(J);let dt=E??(F?F.nextSibling:n.firstChild);for(let J of T)n.insertBefore(document.importNode(J,!0),dt)}function kh(n){for(let r of n.head.querySelectorAll("style, link[rel=stylesheet]")){let u=r.getAttribute("data-vite-dev-id"),h=r.getAttribute("href"),g=[...document.head.querySelectorAll("style, link[rel=stylesheet]")].find(b=>u?b.getAttribute("data-vite-dev-id")===u:h?b.getAttribute("href")===h:b.textContent===r.textContent);g?u&&r.tagName==="STYLE"&&g.textContent!==r.textContent&&(g.textContent=r.textContent):document.head.append(document.importNode(r,!0))}n.title&&n.title!==document.title&&(document.title=n.title)}var Co=null,Rr=!1;function Pr(){return Co?(Rr=!0,Co):(Co=(async()=>{try{let n=$u.__notemendPage,r=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!n||!r.ok||!(r.headers.get("content-type")??"").includes("html"))throw new vs;let u=new DOMParser().parseFromString(await r.text(),"text/html");if(Eu(n,u.body)||Eu(document.head,u.head))throw new vs;kh(u),Mu(document.body,n,u.body),$u.__notemendPage=u.body,document.querySelector('meta[name="astro-view-transitions-enabled"]')&&(document.dispatchEvent(new Event("astro:after-swap")),document.dispatchEvent(new Event("astro:page-load")))}catch(n){n instanceof vs||console.warn("[notemend] refresh in place failed, reloading:",n),location.reload()}finally{Co=null,Rr&&(Rr=!1,Pr())}})(),Co)}wu();import.meta.hot&&import.meta.hot.accept(()=>location.reload());import.meta.hot?.on&&import.meta.hot.on("notemend:refresh",()=>{import.meta.hot?.send?.("notemend:refreshed"),Pr()});
|