bugstash 0.1.13 → 0.1.16
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/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ ${e.stack??""}`;if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{
|
|
|
16
16
|
15% { opacity: 0.7; }
|
|
17
17
|
100% { opacity: 0; }
|
|
18
18
|
}
|
|
19
|
-
`,document.head.appendChild(e)}document.body.appendChild(A),A.addEventListener("animationend",()=>A.remove())}async function Tt(){id();try{let A=await ld();if(A)return A}catch{}try{let A=await cd();if(A)return A}catch{}return null}async function ld(){let A=await _o(document.body,{scale:.5,useCORS:!0,allowTaint:!
|
|
19
|
+
`,document.head.appendChild(e)}document.body.appendChild(A),A.addEventListener("animationend",()=>A.remove())}async function Tt(){id();try{let A=await ld();if(A)return A}catch{}try{let A=await cd();if(A)return A}catch{}return null}async function ld(){let A=await _o(document.body,{scale:.5,useCORS:!0,allowTaint:!1,logging:!1,backgroundColor:null,ignoreElements:e=>e.classList?.contains("bs-fab")||e.classList?.contains("bs-toolbar")||e.classList?.contains("bs-modal")||e.classList?.contains("bs-backdrop")||e.id==="bs-flash-style"});try{return A.toDataURL("image/jpeg",.6)}catch{return null}}async function cd(){let A=window.innerWidth,e=window.innerHeight,t=document.documentElement.cloneNode(!0),r=document.documentElement.querySelectorAll("*"),n=t.querySelectorAll("*");for(let c=0;c<r.length&&c<n.length;c++){let B=window.getComputedStyle(r[c]),g=n[c];if(g.style){let p=["background","background-color","background-image","color","font","font-size","font-family","font-weight","border","border-radius","padding","margin","display","flex-direction","align-items","justify-content","gap","width","height","max-width","max-height","overflow","position","top","left","right","bottom","box-shadow","text-shadow","opacity","transform","text-align","line-height","letter-spacing","text-decoration","visibility","z-index","grid-template-columns","grid-template-rows","box-sizing"];for(let f of p)try{g.style.setProperty(f,B.getPropertyValue(f))}catch{}}}t.querySelectorAll('script, [data-bugstash], .bs-fab, .bs-toolbar, .bs-modal, .bs-backdrop, [id="bs-flash-style"]').forEach(c=>c.remove()),t.querySelectorAll("img").forEach(c=>{try{let B=c.getAttribute("src")||"";B&&!B.startsWith("data:")&&!B.startsWith(window.location.origin)&&(c.removeAttribute("src"),c.style.backgroundColor="#e5e7eb")}catch{}}),t.querySelectorAll("iframe, canvas, video, audio").forEach(c=>c.remove());let a=new XMLSerializer().serializeToString(t),i=`<svg xmlns="http://www.w3.org/2000/svg" width="${A}" height="${e}"><foreignObject width="100%" height="100%">${a}</foreignObject></svg>`,o=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(o);return new Promise(c=>{let B=new Image;B.crossOrigin="anonymous",B.onload=()=>{let g=document.createElement("canvas");g.width=A*.5,g.height=e*.5;let p=g.getContext("2d");if(!p){URL.revokeObjectURL(l),c(null);return}p.scale(.5,.5),p.drawImage(B,0,0),URL.revokeObjectURL(l);try{c(g.toDataURL("image/jpeg",.6))}catch{c(null)}},B.onerror=()=>{URL.revokeObjectURL(l),c(null)},B.src=l})}var Bd="https://bugstash-backend.vercel.app",Xo="https://bugstash-backend.vercel.app",yA=Bd,is=!1;function Jo(A){yA=A.replace(/\/$/,""),is=!1}function Wo(){return yA}async function zA(A,e){try{return await fetch(A,e)}catch(t){if(is)throw t;is=!0;let r=yA;yA=Xo;let n=A.replace(r,Xo);return fetch(n,e)}}var ls="bugstash_auth";function cs(){try{let A=localStorage.getItem(ls);if(!A)return null;let e=JSON.parse(A);return e.tokens.expiresAt<Date.now(),e}catch{return null}}function Yo(A){localStorage.setItem(ls,JSON.stringify(A))}function ud(){localStorage.removeItem(ls)}function VA(){return cs()?.user||null}function zo(){return cs()?.tokens.accessToken||null}async function he(){let A=cs();if(!A)return{"Content-Type":"application/json"};if(A.tokens.expiresAt<Date.now()+6e4)try{let e=await zA(`${yA}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:A.tokens.refreshToken})});if(e.ok){let t=await e.json();t.success&&(A.tokens=t.data,Yo(A))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${A.tokens.accessToken}`}}async function Vr(A,e,t){try{let n=await(await zA(`${yA}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:A,password:e,projectId:t})})).json();return n.success&&Yo({user:n.data.user,tokens:n.data.tokens}),n}catch{return{success:!1,error:"Network error"}}}async function _r(){ud()}async function Bs(A){try{let e=await he();return await(await zA(`${yA}/api/reports`,{method:"POST",headers:e,body:JSON.stringify(A)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function $o(A,e){try{let t=await he();return await(await zA(`${yA}/api/pins/by-page?projectId=${A}&pathname=${encodeURIComponent(e)}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function us(A){try{let e=await he();return await(await zA(`${yA}/api/pins`,{method:"POST",headers:e,body:JSON.stringify(A)})).json()}catch{return{success:!1,error:"Network error"}}}async function Xr(A,e){try{let t=await he();return await(await zA(`${yA}/api/pins/${A}`,{method:"PUT",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function Zo(A){try{let e=await he();return await(await zA(`${yA}/api/pins/${A}`,{method:"DELETE",headers:e})).json()}catch{return{success:!1,error:"Network error"}}}async function jo(A){try{let e=await he();return await(await zA(`${yA}/api/pins/${A}/comments`,{headers:e})).json()}catch{return{success:!1,error:"Network error"}}}async function gs(A,e,t=[]){try{let r=await he();return await(await zA(`${yA}/api/pins/${A}/comments`,{method:"POST",headers:r,body:JSON.stringify({body:e,mentions:t})})).json()}catch{return{success:!1,error:"Network error"}}}async function qo(A){try{let e=await he();return await(await zA(`${yA}/api/members/for-project/${A}`,{headers:e})).json()}catch{return{success:!1,error:"Network error"}}}var ds="bugstash_offline_queue";function fs(A){let e=Ai();e.push({...A,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(ds,JSON.stringify(e))}function Ai(){try{return JSON.parse(localStorage.getItem(ds)||"[]")}catch{return[]}}async function gd(){let A=Ai();if(A.length===0)return 0;let e=0,t=[];for(let r of A)try{let n;switch(r.type){case"create_pin":n=await us(r.data);break;case"create_comment":n=await gs(r.data.pinId,r.data.body,r.data.mentions);break;case"update_pin":n=await Xr(r.data.pinId,r.data.updates);break;case"submit_report":n=await Bs(r.data);break;default:n={success:!1,error:"Unknown action"}}n.success?e++:t.push(r)}catch{t.push(r)}return localStorage.setItem(ds,JSON.stringify(t)),e}typeof window<"u"&&window.addEventListener("online",()=>{gd().catch(()=>{})});var ps=[{id:"slate",name:"Slate",preview:["#0f1117","#6E9ED0"],vars:{"--bs-bg":"#0f1117","--bs-bg2":"#1a1d27","--bs-bg3":"#2a2d37","--bs-text":"#e8eaed","--bs-muted":"#9ca3af","--bs-border":"#2a2d37","--bs-accent":"#6E9ED0","--bs-accent2":"#C3CAD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#4a7ba8","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"black",name:"Dark",preview:["#0a0a0a","#ffffff"],vars:{"--bs-bg":"#0a0a0a","--bs-bg2":"#141414","--bs-bg3":"#1e1e1e","--bs-text":"#f5f5f5","--bs-muted":"#737373","--bs-border":"#262626","--bs-accent":"#f5f5f5","--bs-accent2":"#d4d4d4","--bs-fab1":"#262626","--bs-fab2":"#171717","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"white",name:"Light",preview:["#ffffff","#0a0a0a"],vars:{"--bs-bg":"#ffffff","--bs-bg2":"#f5f5f5","--bs-bg3":"#e5e5e5","--bs-text":"#0a0a0a","--bs-muted":"#737373","--bs-border":"#e5e5e5","--bs-accent":"#0a0a0a","--bs-accent2":"#404040","--bs-fab1":"#0a0a0a","--bs-fab2":"#262626","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function Jr(){return ps}function Wr(A){return ps.find(e=>e.id===A)}function ei(){return ps[0]}var ws=[{id:"classic",name:"Center",description:"Centered modal",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides from right",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides from bottom",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar",description:"Side navigation",tabPosition:"left"}];function Yr(){return ws}function Dt(A){return ws.find(e=>e.id===A)}function ti(){return ws[0]}var ri=`
|
|
20
20
|
/* \u2500\u2500 1. Classic (default \u2014 no overrides) \u2500\u2500 */
|
|
21
21
|
|
|
22
22
|
/* \u2500\u2500 2. Drawer Right \u2500\u2500 */
|
|
@@ -464,8 +464,6 @@ ${e.stack??""}`;if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{
|
|
|
464
464
|
<div class="bs-lp-cmt-body">${ne(e.body)}</div>
|
|
465
465
|
</div>
|
|
466
466
|
`,t.scrollTop=t.scrollHeight)}})}function Fd(){let A=window.location.pathname,e=()=>{window.location.pathname!==A&&(A=window.location.pathname,window.location.href,Bi())},t=history.pushState,r=history.replaceState;history.pushState=function(...n){t.apply(this,n),e()},history.replaceState=function(...n){r.apply(this,n),e()},window.addEventListener("popstate",e)}function ne(A){let e=document.createElement("div");return e.textContent=A,e.innerHTML}var EA,iA=null,nA=null,H=null,KA=null,Gt=null,Pt=null,MA=!1,en=!1,$e="report";var be=ei(),Ee=ti(),sA={bug:'<svg width="28" height="28" viewBox="55 38 60 105" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M95.8 44h-29c-3 0-5.4 2.4-5.4 5.4v29c0 3 2.4 5.4 5.4 5.4h19.5c13 0 23.5-10.5 23.5-23.5v-2.8c0-7.5-6-13.5-13.5-13.5h-.5zm-6.2 28.2H74.8V57.4h14.8c5.8 0 10.4 4.7 10.4 10.4s-4.7 10.4-10.4 10.4z" fill="rgba(255,255,255,0.85)"/><path d="M100.4 96h-33.6c-3 0-5.4 2.4-5.4 5.4v33.6c0 3 2.4 5.4 5.4 5.4h22c15 0 27-12 27-27v-3.9c0-7.5-6-13.5-13.5-13.5h-1.9zm-7.8 32.2H74.8v-20h17.8c6.7 0 12.2 5.5 12.2 12.2 0 4.3-3.5 7.8-7.8 7.8h-4.6z" fill="rgba(255,255,255,1)"/></svg>',x:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',cam:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>',check:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>',report:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>',console:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>',network:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',ctx:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',settings:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>',history:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',pin:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>',sun:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>',moon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',keyboard:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="2" y="4" width="20" height="16" rx="2"/><line x1="6" y1="8" x2="6" y2="8"/><line x1="10" y1="8" x2="10" y2="8"/><line x1="14" y1="8" x2="14" y2="8"/><line x1="18" y1="8" x2="18" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="6" y1="16" x2="18" y2="16"/></svg>'},yd=`
|
|
467
|
-
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');
|
|
468
|
-
|
|
469
467
|
/* \u2500\u2500 FAB \u2500\u2500 */
|
|
470
468
|
.bs-fab {
|
|
471
469
|
all: unset;
|
|
@@ -1652,10 +1650,10 @@ ${e.stack??""}`;if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{
|
|
|
1652
1650
|
<div class="bs-scroll">${l}</div>`,document.body.appendChild(H),iA&&iA.classList.add("bs-open"),requestAnimationFrame(()=>{KA?.classList.add("bs-in"),H?.classList.add("bs-in")}),H.querySelectorAll(".bs-tab").forEach(B=>{B.addEventListener("click",()=>An(B.dataset.tab))}),H.querySelector("[data-bs-close]")?.addEventListener("click",OA),KA.addEventListener("click",OA),H.querySelector("[data-bs-pin-toggle]")?.addEventListener("click",()=>{let B=Nt(),g=H?.querySelector("[data-bs-pin-toggle]");g&&(g.classList.toggle("active",B),g.innerHTML=`
|
|
1653
1651
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
|
|
1654
1652
|
Pins ${B?"ON":"OFF"}
|
|
1655
|
-
`)}),H.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{_r(),OA(),setTimeout(()=>ae(),300)}),r?bi():Od();let c=B=>{B.key==="Escape"&&(OA(),document.removeEventListener("keydown",c))};document.addEventListener("keydown",c)}function Od(){if(!H)return;let A=H.querySelector("#bs-login-submit"),e=H.querySelector("#bs-login-email"),t=H.querySelector("#bs-login-pass"),r=H.querySelector("#bs-login-error");if(!A||!e||!t)return;let n=async()=>{let s=e.value.trim(),a=t.value;if(!s||!a){r.textContent="Please enter email and password",r.style.display="block";return}A.setAttribute("disabled","true"),A.textContent="Signing in...",r.style.display="none";let i=await Vr(s,a,EA.projectId);i.success?(Rt(EA.projectId),kt(EA.projectId),OA(),setTimeout(()=>ae(),300)):(r.textContent=i.error||"Invalid credentials",r.style.display="block",A.removeAttribute("disabled"),A.textContent="Sign In")};A.addEventListener("click",n),t.addEventListener("keydown",s=>{s.key==="Enter"&&n()}),e.addEventListener("keydown",s=>{s.key==="Enter"&&t.focus()}),setTimeout(()=>e.focus(),100)}function OA(){MA&&(iA&&iA.classList.remove("bs-open"),H&&(H.classList.remove("bs-in"),H.classList.add("bs-out")),KA&&KA.classList.remove("bs-in"),setTimeout(()=>{H?.remove(),KA?.remove(),H=null,KA=null,MA=!1},350))}function xe(A){for(let[e,t]of Object.entries(be.vars))A.style.setProperty(e,t)}function tn(A){let e=Wr(A);e&&(be=e,H&&xe(H),iA&&xe(iA),nA&&xe(nA))}function Qi(){return be.id}function Ci(A){let e=Dt(A);e&&(Ee=e,MA&&(OA(),setTimeout(ae,400)))}function Ui(){return Ee.id}function mi(A){EA=A,Gt=document.createElement("style"),Gt.textContent=yd+ri,document.head.appendChild(Gt);let e=A.panelPosition==="bottom-left"?"left":"right";iA=document.createElement("button"),iA.className="bs-fab",xe(iA),iA.innerHTML=`${sA.bug}<span class="bs-fab-label">Report a bug</span>`,iA.style[e]="24px",iA.addEventListener("click",()=>MA?OA():ae()),document.body.appendChild(iA),nA=document.createElement("div"),nA.className="bs-toolbar",nA.style[e]="32px",xe(nA);let r=navigator.platform.toUpperCase().includes("MAC")?"\u2318":"Ctrl",n=[{icon:sA.cam,tip:"Screenshot",kbd:`${r}+Shift+S`,action:async()=>{let s=await Tt();s&&(MA||ae(),setTimeout(()=>{let a=H?.querySelector("[data-bs-screenshot]");if(a){a.__screenshot=s,a.classList.add("bs-captured");let i=a.querySelector("[data-bs-shot-title]"),o=a.querySelector("[data-bs-shot-sub]");i&&(i.textContent="Screenshot captured!"),o&&(o.textContent="Click to retake or annotate"),a.click()}},400))}},{icon:sA.pin,tip:"Toggle Pins",kbd:`${r}+Shift+P`,id:"bs-tb-pin",action:()=>{if(!VA()){MA||ae();return}document.getElementById("bugstash-live-pins")||(Rt(EA.projectId),kt(EA.projectId));let a=Nt(),i=nA?.querySelector("#bs-tb-pin");i&&i.classList.toggle("bs-active",a);let o=H?.querySelector("[data-bs-pin-toggle]");o&&(o.classList.toggle("active",a),o.innerHTML=`
|
|
1653
|
+
`)}),H.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{_r(),OA(),setTimeout(()=>ae(),300)}),r?bi():Od();let c=B=>{B.key==="Escape"&&(OA(),document.removeEventListener("keydown",c))};document.addEventListener("keydown",c)}function Od(){if(!H)return;let A=H.querySelector("#bs-login-submit"),e=H.querySelector("#bs-login-email"),t=H.querySelector("#bs-login-pass"),r=H.querySelector("#bs-login-error");if(!A||!e||!t)return;let n=async()=>{let s=e.value.trim(),a=t.value;if(!s||!a){r.textContent="Please enter email and password",r.style.display="block";return}A.setAttribute("disabled","true"),A.textContent="Signing in...",r.style.display="none";let i=await Vr(s,a,EA.projectId);i.success?(Rt(EA.projectId),kt(EA.projectId),OA(),setTimeout(()=>ae(),300)):(r.textContent=i.error||"Invalid credentials",r.style.display="block",A.removeAttribute("disabled"),A.textContent="Sign In")};A.addEventListener("click",n),t.addEventListener("keydown",s=>{s.key==="Enter"&&n()}),e.addEventListener("keydown",s=>{s.key==="Enter"&&t.focus()}),setTimeout(()=>e.focus(),100)}function OA(){MA&&(iA&&iA.classList.remove("bs-open"),H&&(H.classList.remove("bs-in"),H.classList.add("bs-out")),KA&&KA.classList.remove("bs-in"),setTimeout(()=>{H?.remove(),KA?.remove(),H=null,KA=null,MA=!1},350))}function xe(A){for(let[e,t]of Object.entries(be.vars))A.style.setProperty(e,t)}function tn(A){let e=Wr(A);e&&(be=e,H&&xe(H),iA&&xe(iA),nA&&xe(nA))}function Qi(){return be.id}function Ci(A){let e=Dt(A);e&&(Ee=e,MA&&(OA(),setTimeout(ae,400)))}function Ui(){return Ee.id}function mi(A){if(EA=A,!document.getElementById("bs-fonts")){let s=document.createElement("link");s.id="bs-fonts",s.rel="stylesheet",s.href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap",document.head.appendChild(s)}Gt=document.createElement("style"),Gt.textContent=yd+ri,document.head.appendChild(Gt);let e=A.panelPosition==="bottom-left"?"left":"right";iA=document.createElement("button"),iA.className="bs-fab",xe(iA),iA.innerHTML=`${sA.bug}<span class="bs-fab-label">Report a bug</span>`,iA.style[e]="24px",iA.addEventListener("click",()=>MA?OA():ae()),document.body.appendChild(iA),nA=document.createElement("div"),nA.className="bs-toolbar",nA.style[e]="32px",xe(nA);let r=navigator.platform.toUpperCase().includes("MAC")?"\u2318":"Ctrl",n=[{icon:sA.cam,tip:"Screenshot",kbd:`${r}+Shift+S`,action:async()=>{let s=await Tt();s&&(MA||ae(),setTimeout(()=>{let a=H?.querySelector("[data-bs-screenshot]");if(a){a.__screenshot=s,a.classList.add("bs-captured");let i=a.querySelector("[data-bs-shot-title]"),o=a.querySelector("[data-bs-shot-sub]");i&&(i.textContent="Screenshot captured!"),o&&(o.textContent="Click to retake or annotate"),a.click()}},400))}},{icon:sA.pin,tip:"Toggle Pins",kbd:`${r}+Shift+P`,id:"bs-tb-pin",action:()=>{if(!VA()){MA||ae();return}document.getElementById("bugstash-live-pins")||(Rt(EA.projectId),kt(EA.projectId));let a=Nt(),i=nA?.querySelector("#bs-tb-pin");i&&i.classList.toggle("bs-active",a);let o=H?.querySelector("[data-bs-pin-toggle]");o&&(o.classList.toggle("active",a),o.innerHTML=`
|
|
1656
1654
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
|
|
1657
1655
|
Pins ${a?"ON":"OFF"}
|
|
1658
|
-
`)}},{icon:be.id==="black"?sA.sun:sA.moon,tip:"Toggle Theme",kbd:`${r}+Shift+T`,id:"bs-tb-theme",action:()=>{let s=be.id==="black"?"white":"black";tn(s),nA&&xe(nA);let a=nA?.querySelector("#bs-tb-theme");a&&(a.innerHTML=`${be.id==="black"?sA.sun:sA.moon}<span class="bs-toolbar-tip">${be.id==="black"?"Light":"Dark"} Mode<span class="bs-toolbar-kbd">${r}+Shift+T</span></span>`)}},{icon:sA.report,tip:"Open Panel",kbd:`${r}+Shift+B`,action:()=>{MA?OA():ae()}}];for(let s of n){let a=document.createElement("button");a.className="bs-toolbar-btn",s.id&&(a.id=s.id),a.innerHTML=`${s.icon}<span class="bs-toolbar-tip">${s.tip}<span class="bs-toolbar-kbd">${s.kbd}</span></span>`,a.addEventListener("click",i=>{i.stopPropagation(),s.action()}),nA.appendChild(a)}document.body.appendChild(nA),iA.addEventListener("mouseenter",()=>{MA||gi()}),iA.addEventListener("mouseleave",s=>{let a=s.relatedTarget;nA?.contains(a)||hs()}),nA.addEventListener("mouseenter",()=>gi()),nA.addEventListener("mouseleave",s=>{let a=s.relatedTarget;iA?.contains(a)||hs()}),Pt=s=>{(s.ctrlKey||s.metaKey)&&s.shiftKey&&(s.key==="B"||s.key==="b"?(s.preventDefault(),MA?OA():ae()):s.key==="S"||s.key==="s"?(s.preventDefault(),n[0].action()):s.key==="P"||s.key==="p"?(s.preventDefault(),n[1].action()):(s.key==="T"||s.key==="t")&&(s.preventDefault(),n[2].action()))},document.addEventListener("keydown",Pt)}function gi(){en||MA||(en=!0,nA?.classList.add("bs-show"))}function hs(){en=!1,nA?.classList.remove("bs-show")}function vi(){OA(),iA?.remove(),iA=null,nA?.remove(),nA=null,en=!1,Gt?.remove(),Gt=null,Pt&&document.removeEventListener("keydown",Pt),Pt=null}var $A=null,tA=null,R=null,oe=null,rn="freehand",nn="#ef4444",Rd=3,je=[],xA=null,Vt=!1,sn=null,Nd=[{id:"freehand",label:"Draw",icon:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z"},{id:"rectangle",label:"Rect",icon:"M3 3h18v18H3V3zm2 2v14h14V5H5z"},{id:"circle",label:"Circle",icon:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},{id:"arrow",label:"Arrow",icon:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}],Gd=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function Ei(A){return new Promise(e=>{sn=e,je=[],xA=null,rn="freehand",nn="#ef4444",Pd(A)})}function Pd(A){$A&&$A.remove(),$A=document.createElement("div"),$A.id="bs-annotation-overlay";let e=document.createElement("style");e.textContent=`
|
|
1656
|
+
`)}},{icon:be.id==="black"?sA.sun:sA.moon,tip:"Toggle Theme",kbd:`${r}+Shift+T`,id:"bs-tb-theme",action:()=>{let s=be.id==="black"?"white":"black";tn(s),nA&&xe(nA);let a=nA?.querySelector("#bs-tb-theme");a&&(a.innerHTML=`${be.id==="black"?sA.sun:sA.moon}<span class="bs-toolbar-tip">${be.id==="black"?"Light":"Dark"} Mode<span class="bs-toolbar-kbd">${r}+Shift+T</span></span>`)}},{icon:sA.report,tip:"Open Panel",kbd:`${r}+Shift+B`,action:()=>{MA?OA():ae()}}];for(let s of n){let a=document.createElement("button");a.className="bs-toolbar-btn",s.id&&(a.id=s.id),a.innerHTML=`${s.icon}<span class="bs-toolbar-tip">${s.tip}<span class="bs-toolbar-kbd">${s.kbd}</span></span>`,a.addEventListener("click",i=>{i.stopPropagation(),s.action()}),nA.appendChild(a)}document.body.appendChild(nA),iA.addEventListener("mouseenter",()=>{MA||gi()}),iA.addEventListener("mouseleave",s=>{let a=s.relatedTarget;nA?.contains(a)||hs()}),nA.addEventListener("mouseenter",()=>gi()),nA.addEventListener("mouseleave",s=>{let a=s.relatedTarget;iA?.contains(a)||hs()}),Pt=s=>{(s.ctrlKey||s.metaKey)&&s.shiftKey&&(s.key==="B"||s.key==="b"?(s.preventDefault(),MA?OA():ae()):s.key==="S"||s.key==="s"?(s.preventDefault(),n[0].action()):s.key==="P"||s.key==="p"?(s.preventDefault(),n[1].action()):(s.key==="T"||s.key==="t")&&(s.preventDefault(),n[2].action()))},document.addEventListener("keydown",Pt)}function gi(){en||MA||(en=!0,nA?.classList.add("bs-show"))}function hs(){en=!1,nA?.classList.remove("bs-show")}function vi(){OA(),iA?.remove(),iA=null,nA?.remove(),nA=null,en=!1,Gt?.remove(),Gt=null,document.getElementById("bs-fonts")?.remove(),Pt&&document.removeEventListener("keydown",Pt),Pt=null}var $A=null,tA=null,R=null,oe=null,rn="freehand",nn="#ef4444",Rd=3,je=[],xA=null,Vt=!1,sn=null,Nd=[{id:"freehand",label:"Draw",icon:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z"},{id:"rectangle",label:"Rect",icon:"M3 3h18v18H3V3zm2 2v14h14V5H5z"},{id:"circle",label:"Circle",icon:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},{id:"arrow",label:"Arrow",icon:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}],Gd=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function Ei(A){return new Promise(e=>{sn=e,je=[],xA=null,rn="freehand",nn="#ef4444",Pd(A)})}function Pd(A){$A&&$A.remove(),$A=document.createElement("div"),$A.id="bs-annotation-overlay";let e=document.createElement("style");e.textContent=`
|
|
1659
1657
|
#bs-annotation-overlay {
|
|
1660
1658
|
position: fixed; inset: 0; z-index: 2147483647;
|
|
1661
1659
|
background: rgba(0,0,0,0.85);
|