@makefully/notefully 0.1.20 → 0.1.22
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/notefully.iife.js +5 -5
- package/dist/notefully.js +118 -112
- package/package.json +1 -1
package/dist/notefully.iife.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var Notefully=(function(A){"use strict";function Se(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),e&&(r.href=e),o.href=t,o.href}const ve=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function T(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let j=null;function kt(t={}){return j||(t.includeStyleProperties?(j=t.includeStyleProperties,j):(j=T(window.getComputedStyle(document.documentElement)),j))}function G(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function xe(t){const e=G(t,"border-left-width"),n=G(t,"border-right-width");return t.clientWidth+e+n}function Ee(t){const e=G(t,"border-top-width"),n=G(t,"border-bottom-width");return t.clientHeight+e+n}function It(t,e={}){const n=e.width||xe(t),r=e.height||Ee(t);return{width:n,height:r}}function Me(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const E=16384;function Ce(t){(t.width>E||t.height>E)&&(t.width>E&&t.height>E?t.width>t.height?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E):t.width>E?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E))}function J(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function Le(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function $e(t,e,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${e}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${e} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(t),Le(o)}const x=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||x(n,e)};function Re(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Ae(t,e){return kt(e).map(n=>{const r=t.getPropertyValue(n),o=t.getPropertyPriority(n);return`${n}: ${r}${o?" !important":""};`}).join(" ")}function Pe(t,e,n,r){const o=`.${t}:${e}`,i=n.cssText?Re(n):Ae(n,r);return document.createTextNode(`${o}{${i}}`)}function Ot(t,e,n,r){const o=window.getComputedStyle(t,n),i=o.getPropertyValue("content");if(i===""||i==="none")return;const a=ve();try{e.className=`${e.className} ${a}`}catch{return}const s=document.createElement("style");s.appendChild(Pe(a,n,o,r)),e.appendChild(s)}function Te(t,e,n){Ot(t,e,":before",n),Ot(t,e,":after",n)}const Ht="application/font-woff",Dt="image/jpeg",ke={woff:Ht,woff2:Ht,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Dt,jpeg:Dt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ie(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function st(t){const e=Ie(t).toLowerCase();return ke[e]||""}function Oe(t){return t.split(/,/)[1]}function ct(t){return t.search(/^(data:)/)!==-1}function He(t,e){return`data:${e};base64,${t}`}async function Ft(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise((i,a)=>{const s=new FileReader;s.onerror=a,s.onloadend=()=>{try{i(n({res:r,result:s.result}))}catch(l){a(l)}},s.readAsDataURL(o)})}const lt={};function De(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function ut(t,e,n){const r=De(t,e,n.includeQueryParams);if(lt[r]!=null)return lt[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let o;try{const i=await Ft(t,n.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),Oe(s)));o=He(i,e)}catch(i){o=n.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;i&&(a=typeof i=="string"?i:i.message),a&&console.warn(a)}return lt[r]=o,o}async function Fe(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):J(e)}async function Ue(t,e){if(t.currentSrc){const i=document.createElement("canvas"),a=i.getContext("2d");i.width=t.clientWidth,i.height=t.clientHeight,a==null||a.drawImage(t,0,0,i.width,i.height);const s=i.toDataURL();return J(s)}const n=t.poster,r=st(n),o=await ut(n,r,e);return J(o)}async function je(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await Q(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function _e(t,e){return x(t,HTMLCanvasElement)?Fe(t):x(t,HTMLVideoElement)?Ue(t,e):x(t,HTMLIFrameElement)?je(t,e):t.cloneNode(Ut(t))}const Ne=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Ut=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Be(t,e,n){var r,o;if(Ut(e))return e;let i=[];return Ne(t)&&t.assignedNodes?i=T(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?i=T(t.contentDocument.body.childNodes):i=T(((o=t.shadowRoot)!==null&&o!==void 0?o:t).childNodes),i.length===0||x(t,HTMLVideoElement)||await i.reduce((a,s)=>a.then(()=>Q(s,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Ve(t,e,n){const r=e.style;if(!r)return;const o=window.getComputedStyle(t);o.cssText?(r.cssText=o.cssText,r.transformOrigin=o.transformOrigin):kt(n).forEach(i=>{let a=o.getPropertyValue(i);i==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),x(t,HTMLIFrameElement)&&i==="display"&&a==="inline"&&(a="block"),i==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),r.setProperty(i,a,o.getPropertyPriority(i))})}function We(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function qe(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(o=>t.value===o.getAttribute("value"));r&&r.setAttribute("selected","")}}function ze(t,e,n){return x(e,Element)&&(Ve(t,e,n),Te(t,e,n),We(t,e),qe(t,e)),e}async function Xe(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let i=0;i<n.length;i++){const s=n[i].getAttribute("xlink:href");if(s){const l=t.querySelector(s),u=document.querySelector(s);!l&&u&&!r[s]&&(r[s]=await Q(u,e,!0))}}const o=Object.values(r);if(o.length){const i="http://www.w3.org/1999/xhtml",a=document.createElementNS(i,"svg");a.setAttribute("xmlns",i),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const s=document.createElementNS(i,"defs");a.appendChild(s);for(let l=0;l<o.length;l++)s.appendChild(o[l]);t.appendChild(a)}return t}async function Q(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>_e(r,e)).then(r=>Be(t,r,e)).then(r=>ze(t,r,e)).then(r=>Xe(r,e))}const jt=/url\((['"]?)([^'"]+?)\1\)/g,Ye=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ke=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ge(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Je(t){const e=[];return t.replace(jt,(n,r,o)=>(e.push(o),n)),e.filter(n=>!ct(n))}async function Qe(t,e,n,r,o){try{const i=n?Se(e,n):e,a=st(e);let s;return o||(s=await ut(i,a,r)),t.replace(Ge(e),`$1${s}$3`)}catch{}return t}function Ze(t,{preferredFontFormat:e}){return e?t.replace(Ke,n=>{for(;;){const[r,,o]=Ye.exec(n)||[];if(!o)return"";if(o===e)return`src: ${r};`}}):t}function _t(t){return t.search(jt)!==-1}async function Nt(t,e,n){if(!_t(t))return t;const r=Ze(t,n);return Je(r).reduce((i,a)=>i.then(s=>Qe(s,a,e,n)),Promise.resolve(r))}async function _(t,e,n){var r;const o=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(o){const i=await Nt(o,null,n);return e.style.setProperty(t,i,e.style.getPropertyPriority(t)),!0}return!1}async function tn(t,e){await _("background",t,e)||await _("background-image",t,e),await _("mask",t,e)||await _("-webkit-mask",t,e)||await _("mask-image",t,e)||await _("-webkit-mask-image",t,e)}async function en(t,e){const n=x(t,HTMLImageElement);if(!(n&&!ct(t.src))&&!(x(t,SVGImageElement)&&!ct(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,o=await ut(r,st(r),e);await new Promise((i,a)=>{t.onload=i,t.onerror=e.onImageErrorHandler?(...l)=>{try{i(e.onImageErrorHandler(...l))}catch(u){a(u)}}:a;const s=t;s.decode&&(s.decode=i),s.loading==="lazy"&&(s.loading="eager"),n?(t.srcset="",t.src=o):t.href.baseVal=o})}async function nn(t,e){const r=T(t.childNodes).map(o=>Bt(o,e));await Promise.all(r).then(()=>t)}async function Bt(t,e){x(t,Element)&&(await tn(t,e),await en(t,e),await nn(t,e))}function rn(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(o=>{n[o]=r[o]}),t}const Vt={};async function Wt(t){let e=Vt[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},Vt[t]=e,e}async function qt(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async a=>{let s=a.replace(r,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),Ft(s,e.fetchRequestInit,({result:l})=>(n=n.replace(a,`url(${l})`),[a,l]))});return Promise.all(i).then(()=>n)}function zt(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const o=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=o.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(o,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(a,"gi");for(;;){let l=i.exec(r);if(l===null){if(l=s.exec(r),l===null)break;i.lastIndex=s.lastIndex}else s.lastIndex=i.lastIndex;e.push(l[0])}return e}async function on(t,e){const n=[],r=[];return t.forEach(o=>{if("cssRules"in o)try{T(o.cssRules||[]).forEach((i,a)=>{if(i.type===CSSRule.IMPORT_RULE){let s=a+1;const l=i.href,u=Wt(l).then(d=>qt(d,e)).then(d=>zt(d).forEach(p=>{try{o.insertRule(p,p.startsWith("@import")?s+=1:o.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:p,error:y})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(u)}})}catch(i){const a=t.find(s=>s.href==null)||document.styleSheets[0];o.href!=null&&r.push(Wt(o.href).then(s=>qt(s,e)).then(s=>zt(s).forEach(l=>{a.insertRule(l,a.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",i)}}),Promise.all(r).then(()=>(t.forEach(o=>{if("cssRules"in o)try{T(o.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${o.href}`,i)}}),n))}function an(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>_t(e.style.getPropertyValue("src")))}async function sn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=T(t.ownerDocument.styleSheets),r=await on(n,e);return an(r)}function Xt(t){return t.trim().replace(/["']/g,"")}function cn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{e.add(Xt(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(t),e}async function ln(t,e){const n=await sn(t,e),r=cn(t);return(await Promise.all(n.filter(i=>r.has(Xt(i.style.fontFamily))).map(i=>{const a=i.parentStyleSheet?i.parentStyleSheet.href:null;return Nt(i.cssText,a,e)}))).join(`
|
|
2
|
-
`)}async function un(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await ln(t,e);if(n){const r=document.createElement("style"),o=document.createTextNode(n);r.appendChild(o),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function dn(t,e={}){const{width:n,height:r}=It(t,e),o=await Q(t,e,!0);return await un(o,e),await Bt(o,e),rn(o,e),await $e(o,n,r)}async function fn(t,e={}){const{width:n,height:r}=It(t,e),o=await dn(t,e),i=await J(o),a=document.createElement("canvas"),s=a.getContext("2d"),l=e.pixelRatio||Me(),u=e.canvasWidth||n,d=e.canvasHeight||r;return a.width=u*l,a.height=d*l,e.skipAutoScale||Ce(a),a.style.width=`${u}`,a.style.height=`${d}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(i,0,0,a.width,a.height),a}async function hn(t,e={}){return(await fn(t,e)).toDataURL()}const Z="data-nf-capture-chrome";function mn(t){return t instanceof Element&&(t.hasAttribute(Z)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function pn(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(n=>{const r=n.getBoundingClientRect(),o=document.createElement("div");o.setAttribute("data-nf-mask-cover","1"),o.style.cssText=["position:fixed",`left:${r.left}px`,`top:${r.top}px`,`width:${Math.max(r.width,4)}px`,`height:${Math.max(r.height,4)}px`,"background:#111","z-index:2147483646","pointer-events:none"].join(";"),document.body.appendChild(o),t.push(o)}),()=>t.forEach(n=>n.remove())}function yn(){const t=document.querySelector(`[${Z}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(Z,"1"),e.className="nf-capture-chrome",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML='<span class="nf-capture-chrome-pill">Capturing…</span>',document.body.appendChild(e),e}function gn(){document.querySelectorAll(`[${Z}]`).forEach(t=>t.remove())}async function wn(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=yn();t&&(t.style.display="none");const r=pn();await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)));try{return await hn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:o=>!mn(o)})}finally{r(),n.remove(),gn(),t&&(t.style.display=e)}}function bn(t=""){const e=String(t||"");return e?/Windows NT/i.test(e)?"Windows":/iPhone|iPad|iPod/i.test(e)?"iOS":/Mac OS X|Macintosh/i.test(e)?"macOS":/Android/i.test(e)?"Android":/CrOS/i.test(e)?"ChromeOS":/Linux/i.test(e)?"Linux":"Other":""}function Sn(t=""){const e=String(t||"");return e?/Edg\//i.test(e)?"Edge":/OPR\/|Opera/i.test(e)?"Opera":/Firefox\//i.test(e)?"Firefox":/Chrome\//i.test(e)||/CriOS\//i.test(e)?"Chrome":/Safari\//i.test(e)?"Safari":"Other":""}function vn(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:bn(e),browser:Sn(e),language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio||1},user:{userId:t.userId||null,email:t.email||null,displayName:t.displayName||null}}}const Yt=new Set(["userId","email","displayName"]),Kt={id:"userId",username:"displayName",name:"displayName"},Gt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit"]),Jt={slug:"Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",projectSlug:"Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",project:"Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",username:"Pass people via Notefully.identify({ displayName }) (username is an identify alias), not init().",userId:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",email:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",displayName:"Pass people via Notefully.identify({ userId, email, displayName }), not init()."};function xn(t={},e={}){const n=e.warn||Qt,r=t&&typeof t=="object"?t:{},o={},i=[];for(const a of Yt)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a]);for(const[a,s]of Object.entries(Kt))Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(o,s)||(o[s]=r[a]));for(const a of Object.keys(r))Yt.has(a)||Object.prototype.hasOwnProperty.call(Kt,a)||i.push(a);if(i.length){const a=i.some(s=>s==="name"||s==="slug"||s==="projectSlug")?" Pass the package/report name via Notefully.init({ name }), not identify().":"";n(`Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+a)}return o}function En(t={},e={}){const n=e.warn||Qt,r=t&&typeof t=="object"?t:{},o=Object.keys(r).filter(i=>!Gt.has(i));if(o.length)for(const i of o){if(Jt[i]){n(`Notefully.init: ignoring "${i}". ${Jt[i]}`);continue}n(`Notefully.init: ignoring unknown key "${i}". Supported: ${[...Gt].join(", ")}.`)}}function Qt(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const Mn=80;function Cn(){const t=[],e={};let n=!1;const r=(i,a)=>{let s="";try{s=a.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{s=String(a[0])}t.push({level:i,text:s.slice(0,2e3),at:Date.now()}),t.length>Mn&&t.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(i=>{e[i]=console[i].bind(console),console[i]=(...a)=>{r(i,a),e[i](...a)}}),window.addEventListener("error",i=>{r("error",[i.message||"window.error"])}),window.addEventListener("unhandledrejection",i=>{r("error",[i.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function Ln(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const o=()=>{if(r=!1,n)try{n.stop()}catch{}};return{start:()=>{if(!e)throw new Error("Speech recognition is not supported in this browser.");return r?(o(),!1):(n=new e,n.continuous=!0,n.interimResults=!0,n.lang=navigator.language||"en-US",n.onresult=a=>{let s="";for(let l=a.resultIndex;l<a.results.length;l+=1)a.results[l].isFinal&&(s+=a.results[l][0].transcript);s&&t(s)},n.onerror=()=>{r=!1},n.onend=()=>{r=!1},n.start(),r=!0,!0)},stop:o,isSupported:()=>!!e,isActive:()=>r}}const $n=60*1e3;function Rn({onStart:t,onStop:e,onError:n}){let r=null,o=null,i=[],a=null;const s=()=>{if(a&&(clearTimeout(a),a=null),o&&o.state!=="inactive")try{o.stop()}catch{}r&&(r.getTracks().forEach(d=>d.stop()),r=null)},l=()=>{if(o&&o.state==="recording"){o.stop();return}s(),e(null)};return{start:async()=>{var d,p;if(!((d=navigator.mediaDevices)!=null&&d.getDisplayMedia))throw new Error("Screen recording is not supported in this browser.");r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"}),i=[],o=new MediaRecorder(r,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),o.ondataavailable=y=>{y.data&&y.data.size&&i.push(y.data)},o.onstop=()=>{const y=i.length?new Blob(i,{type:o.mimeType||"video/webm"}):null;s(),e(y)},(p=r.getVideoTracks()[0])==null||p.addEventListener("ended",()=>l()),o.start(),a=setTimeout(l,$n)},stop:l}}function An(){const t=new Set;return{alloc(){let e=1;for(;t.has(e);)e+=1;return t.add(e),e},free(e){const n=Number(e);Number.isInteger(n)&&n>0&&t.delete(n)},peekUsed(){return[...t].sort((e,n)=>e-n)}}}const dt={x:0,y:0,w:1,h:1};function Zt(){const t=An();let e=[],n={...dt},r=1;return{list:()=>e.filter(i=>Tn(i,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(i){return n=Pn(i),n},resetCrop(){return n={...dt},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(i,a){const s={id:`s${r++}`,type:i,number:t.alloc(),x:.2,y:.2,w:i==="arrow"?.2:.22,h:i==="arrow"?.05:.16,x2:.4,y2:.28,...a};return e.push(s),s},update(i,a){const s=e.find(l=>l.id===i);return s?(Object.assign(s,a),s):null},remove(i){const a=e.findIndex(l=>l.id===i);if(a<0)return null;const[s]=e.splice(a,1);return t.free(s.number),s},reset(){for(e=[],n={...dt},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function Pn(t){const e=Math.min(Math.max(t.x,0),.95),n=Math.min(Math.max(t.y,0),.95),r=Math.min(Math.max(t.w,.05),1-e),o=Math.min(Math.max(t.h,.05),1-n);return{x:e,y:n,w:r,h:o}}function Tn(t,e){const n=t.type==="arrow"?(t.x+(t.x2??t.x))/2:t.x+(t.w||0)/2,r=t.type==="arrow"?(t.y+(t.y2??t.y))/2:t.y+(t.h||0)/2;return n>=e.x&&r>=e.y&&n<=e.x+e.w&&r<=e.y+e.h}function ft(t){const e=Math.max(1,Number(t)||1);return{stroke:Math.max(2,e*.0075),badgeRadius:Math.max(8,e*.025),fontSize:Math.max(10,e*.0275),arrowHead:Math.max(8,e*.035),arrowHeadAngle:.4}}function kn(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:o,colors:i={}}){const a=i.mark||"#fdd341",s=i.markText||"#2a2140",l=ft(r);t.save(),t.lineWidth=l.stroke,t.lineCap="round",t.lineJoin="round",t.strokeStyle=a,t.fillStyle=a,t.font=`700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`,e.forEach(u=>{const d=ht(u.x,n,r),p=mt(u.y,n,o),y=u.w/n.w*r,C=u.h/n.h*o,R=l.stroke/2;if(u.type==="rect")t.strokeRect(d+R,p+R,Math.max(0,y-l.stroke),Math.max(0,C-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(d+y/2,p+C/2,Math.max(.5,y/2-R),Math.max(.5,C/2-R),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const N=ht(u.x2??u.x+u.w,n,r),B=mt(u.y2??u.y,n,o);On(t,d,p,N,B,l)}if(u.number==null||u.number==="")return;const D=In(u,n,r,o,d,p,y),K=String(u.number);t.beginPath(),t.arc(D.x,D.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=a,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(K,D.x,D.y+.5),t.fillStyle=a}),t.restore()}function ht(t,e,n){return(t-e.x)/e.w*n}function mt(t,e,n){return(t-e.y)/e.h*n}function In(t,e,n,r,o,i,a){if(t.type==="arrow"){const s=ht(t.x2??t.x+t.w,e,n),l=mt(t.y2??t.y,e,r);return{x:(o+s)/2,y:(i+l)/2}}return{x:o+a/2,y:i}}function te(t,e,n,r,o){const i=Math.atan2(r-e,n-t),a=o.arrowHead,s=Math.min(o.stroke,a*.2),l=n,u=r,d=n-Math.cos(i)*a,p=r-Math.sin(i)*a,y={x:l-a*Math.cos(i-o.arrowHeadAngle),y:u-a*Math.sin(i-o.arrowHeadAngle)},C={x:l-a*Math.cos(i+o.arrowHeadAngle),y:u-a*Math.sin(i+o.arrowHeadAngle)},R={x:n-Math.cos(i)*s,y:r-Math.sin(i)*s};return{angle:i,tipX:l,tipY:u,baseX:d,baseY:p,left:y,right:C,shaftEnd:R}}function On(t,e,n,r,o,i){const a=te(e,n,r,o,i);t.beginPath(),t.moveTo(e,n),t.lineTo(a.shaftEnd.x,a.shaftEnd.y),t.stroke(),t.beginPath(),t.moveTo(a.tipX,a.tipY),t.lineTo(a.left.x,a.left.y),t.lineTo(a.right.x,a.right.y),t.closePath(),t.fill()}function Hn(t,e,n,r={}){return new Promise((o,i)=>{const a=new Image;a.onload=()=>{const s=Math.round(e.x*a.width),l=Math.round(e.y*a.height),u=Math.max(1,Math.round(e.w*a.width)),d=Math.max(1,Math.round(e.h*a.height)),p=document.createElement("canvas");p.width=u,p.height=d;const y=p.getContext("2d");y.drawImage(a,s,l,u,d,0,0,u,d),kn(y,{stickers:n,crop:e,width:u,height:d,colors:r}),p.toBlob(C=>{if(!C){i(new Error("Could not encode screenshot"));return}o(C)},"image/png")},a.onerror=()=>i(new Error("Could not load screenshot")),a.src=t})}const Dn=["bug","idea","other"],Fn=["maker","all-business","brighter-day","quiet-night"],ee="maker",Un=new Set(["crop","arrow","rect","circle"]),pt=.02,ne=.05,jn=`
|
|
1
|
+
var Notefully=(function(A){"use strict";function Se(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),e&&(r.href=e),o.href=t,o.href}const ve=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function T(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let j=null;function kt(t={}){return j||(t.includeStyleProperties?(j=t.includeStyleProperties,j):(j=T(window.getComputedStyle(document.documentElement)),j))}function G(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function xe(t){const e=G(t,"border-left-width"),n=G(t,"border-right-width");return t.clientWidth+e+n}function Ee(t){const e=G(t,"border-top-width"),n=G(t,"border-bottom-width");return t.clientHeight+e+n}function It(t,e={}){const n=e.width||xe(t),r=e.height||Ee(t);return{width:n,height:r}}function Ce(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const E=16384;function Me(t){(t.width>E||t.height>E)&&(t.width>E&&t.height>E?t.width>t.height?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E):t.width>E?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E))}function J(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function Le(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function $e(t,e,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${e}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${e} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(t),Le(o)}const x=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||x(n,e)};function Re(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Ae(t,e){return kt(e).map(n=>{const r=t.getPropertyValue(n),o=t.getPropertyPriority(n);return`${n}: ${r}${o?" !important":""};`}).join(" ")}function Pe(t,e,n,r){const o=`.${t}:${e}`,i=n.cssText?Re(n):Ae(n,r);return document.createTextNode(`${o}{${i}}`)}function Ot(t,e,n,r){const o=window.getComputedStyle(t,n),i=o.getPropertyValue("content");if(i===""||i==="none")return;const a=ve();try{e.className=`${e.className} ${a}`}catch{return}const s=document.createElement("style");s.appendChild(Pe(a,n,o,r)),e.appendChild(s)}function Te(t,e,n){Ot(t,e,":before",n),Ot(t,e,":after",n)}const Ht="application/font-woff",Dt="image/jpeg",ke={woff:Ht,woff2:Ht,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Dt,jpeg:Dt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ie(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function st(t){const e=Ie(t).toLowerCase();return ke[e]||""}function Oe(t){return t.split(/,/)[1]}function ct(t){return t.search(/^(data:)/)!==-1}function He(t,e){return`data:${e};base64,${t}`}async function Ft(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise((i,a)=>{const s=new FileReader;s.onerror=a,s.onloadend=()=>{try{i(n({res:r,result:s.result}))}catch(l){a(l)}},s.readAsDataURL(o)})}const lt={};function De(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function ut(t,e,n){const r=De(t,e,n.includeQueryParams);if(lt[r]!=null)return lt[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let o;try{const i=await Ft(t,n.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),Oe(s)));o=He(i,e)}catch(i){o=n.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;i&&(a=typeof i=="string"?i:i.message),a&&console.warn(a)}return lt[r]=o,o}async function Fe(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):J(e)}async function Ue(t,e){if(t.currentSrc){const i=document.createElement("canvas"),a=i.getContext("2d");i.width=t.clientWidth,i.height=t.clientHeight,a==null||a.drawImage(t,0,0,i.width,i.height);const s=i.toDataURL();return J(s)}const n=t.poster,r=st(n),o=await ut(n,r,e);return J(o)}async function je(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await Q(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function _e(t,e){return x(t,HTMLCanvasElement)?Fe(t):x(t,HTMLVideoElement)?Ue(t,e):x(t,HTMLIFrameElement)?je(t,e):t.cloneNode(Ut(t))}const Ne=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Ut=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Be(t,e,n){var r,o;if(Ut(e))return e;let i=[];return Ne(t)&&t.assignedNodes?i=T(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?i=T(t.contentDocument.body.childNodes):i=T(((o=t.shadowRoot)!==null&&o!==void 0?o:t).childNodes),i.length===0||x(t,HTMLVideoElement)||await i.reduce((a,s)=>a.then(()=>Q(s,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Ve(t,e,n){const r=e.style;if(!r)return;const o=window.getComputedStyle(t);o.cssText?(r.cssText=o.cssText,r.transformOrigin=o.transformOrigin):kt(n).forEach(i=>{let a=o.getPropertyValue(i);i==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),x(t,HTMLIFrameElement)&&i==="display"&&a==="inline"&&(a="block"),i==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),r.setProperty(i,a,o.getPropertyPriority(i))})}function We(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function qe(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(o=>t.value===o.getAttribute("value"));r&&r.setAttribute("selected","")}}function ze(t,e,n){return x(e,Element)&&(Ve(t,e,n),Te(t,e,n),We(t,e),qe(t,e)),e}async function Xe(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let i=0;i<n.length;i++){const s=n[i].getAttribute("xlink:href");if(s){const l=t.querySelector(s),u=document.querySelector(s);!l&&u&&!r[s]&&(r[s]=await Q(u,e,!0))}}const o=Object.values(r);if(o.length){const i="http://www.w3.org/1999/xhtml",a=document.createElementNS(i,"svg");a.setAttribute("xmlns",i),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const s=document.createElementNS(i,"defs");a.appendChild(s);for(let l=0;l<o.length;l++)s.appendChild(o[l]);t.appendChild(a)}return t}async function Q(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>_e(r,e)).then(r=>Be(t,r,e)).then(r=>ze(t,r,e)).then(r=>Xe(r,e))}const jt=/url\((['"]?)([^'"]+?)\1\)/g,Ye=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ke=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ge(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Je(t){const e=[];return t.replace(jt,(n,r,o)=>(e.push(o),n)),e.filter(n=>!ct(n))}async function Qe(t,e,n,r,o){try{const i=n?Se(e,n):e,a=st(e);let s;return o||(s=await ut(i,a,r)),t.replace(Ge(e),`$1${s}$3`)}catch{}return t}function Ze(t,{preferredFontFormat:e}){return e?t.replace(Ke,n=>{for(;;){const[r,,o]=Ye.exec(n)||[];if(!o)return"";if(o===e)return`src: ${r};`}}):t}function _t(t){return t.search(jt)!==-1}async function Nt(t,e,n){if(!_t(t))return t;const r=Ze(t,n);return Je(r).reduce((i,a)=>i.then(s=>Qe(s,a,e,n)),Promise.resolve(r))}async function _(t,e,n){var r;const o=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(o){const i=await Nt(o,null,n);return e.style.setProperty(t,i,e.style.getPropertyPriority(t)),!0}return!1}async function tn(t,e){await _("background",t,e)||await _("background-image",t,e),await _("mask",t,e)||await _("-webkit-mask",t,e)||await _("mask-image",t,e)||await _("-webkit-mask-image",t,e)}async function en(t,e){const n=x(t,HTMLImageElement);if(!(n&&!ct(t.src))&&!(x(t,SVGImageElement)&&!ct(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,o=await ut(r,st(r),e);await new Promise((i,a)=>{t.onload=i,t.onerror=e.onImageErrorHandler?(...l)=>{try{i(e.onImageErrorHandler(...l))}catch(u){a(u)}}:a;const s=t;s.decode&&(s.decode=i),s.loading==="lazy"&&(s.loading="eager"),n?(t.srcset="",t.src=o):t.href.baseVal=o})}async function nn(t,e){const r=T(t.childNodes).map(o=>Bt(o,e));await Promise.all(r).then(()=>t)}async function Bt(t,e){x(t,Element)&&(await tn(t,e),await en(t,e),await nn(t,e))}function rn(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(o=>{n[o]=r[o]}),t}const Vt={};async function Wt(t){let e=Vt[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},Vt[t]=e,e}async function qt(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async a=>{let s=a.replace(r,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),Ft(s,e.fetchRequestInit,({result:l})=>(n=n.replace(a,`url(${l})`),[a,l]))});return Promise.all(i).then(()=>n)}function zt(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const o=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=o.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(o,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(a,"gi");for(;;){let l=i.exec(r);if(l===null){if(l=s.exec(r),l===null)break;i.lastIndex=s.lastIndex}else s.lastIndex=i.lastIndex;e.push(l[0])}return e}async function on(t,e){const n=[],r=[];return t.forEach(o=>{if("cssRules"in o)try{T(o.cssRules||[]).forEach((i,a)=>{if(i.type===CSSRule.IMPORT_RULE){let s=a+1;const l=i.href,u=Wt(l).then(d=>qt(d,e)).then(d=>zt(d).forEach(p=>{try{o.insertRule(p,p.startsWith("@import")?s+=1:o.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:p,error:y})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(u)}})}catch(i){const a=t.find(s=>s.href==null)||document.styleSheets[0];o.href!=null&&r.push(Wt(o.href).then(s=>qt(s,e)).then(s=>zt(s).forEach(l=>{a.insertRule(l,a.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",i)}}),Promise.all(r).then(()=>(t.forEach(o=>{if("cssRules"in o)try{T(o.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${o.href}`,i)}}),n))}function an(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>_t(e.style.getPropertyValue("src")))}async function sn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=T(t.ownerDocument.styleSheets),r=await on(n,e);return an(r)}function Xt(t){return t.trim().replace(/["']/g,"")}function cn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{e.add(Xt(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(t),e}async function ln(t,e){const n=await sn(t,e),r=cn(t);return(await Promise.all(n.filter(i=>r.has(Xt(i.style.fontFamily))).map(i=>{const a=i.parentStyleSheet?i.parentStyleSheet.href:null;return Nt(i.cssText,a,e)}))).join(`
|
|
2
|
+
`)}async function un(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await ln(t,e);if(n){const r=document.createElement("style"),o=document.createTextNode(n);r.appendChild(o),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function dn(t,e={}){const{width:n,height:r}=It(t,e),o=await Q(t,e,!0);return await un(o,e),await Bt(o,e),rn(o,e),await $e(o,n,r)}async function fn(t,e={}){const{width:n,height:r}=It(t,e),o=await dn(t,e),i=await J(o),a=document.createElement("canvas"),s=a.getContext("2d"),l=e.pixelRatio||Ce(),u=e.canvasWidth||n,d=e.canvasHeight||r;return a.width=u*l,a.height=d*l,e.skipAutoScale||Me(a),a.style.width=`${u}`,a.style.height=`${d}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(i,0,0,a.width,a.height),a}async function hn(t,e={}){return(await fn(t,e)).toDataURL()}const Z="data-nf-capture-chrome";function mn(t){return t instanceof Element&&(t.hasAttribute(Z)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function pn(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(n=>{const r=n.getBoundingClientRect(),o=document.createElement("div");o.setAttribute("data-nf-mask-cover","1"),o.style.cssText=["position:fixed",`left:${r.left}px`,`top:${r.top}px`,`width:${Math.max(r.width,4)}px`,`height:${Math.max(r.height,4)}px`,"background:#111","z-index:2147483646","pointer-events:none"].join(";"),document.body.appendChild(o),t.push(o)}),()=>t.forEach(n=>n.remove())}function yn(){const t=document.querySelector(`[${Z}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(Z,"1"),e.className="nf-capture-chrome",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML='<span class="nf-capture-chrome-pill">Capturing…</span>',document.body.appendChild(e),e}function gn(){document.querySelectorAll(`[${Z}]`).forEach(t=>t.remove())}async function wn(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=yn();t&&(t.style.display="none");const r=pn();await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)));try{return await hn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:o=>!mn(o)})}finally{r(),n.remove(),gn(),t&&(t.style.display=e)}}function bn(t=""){const e=String(t||"");return e?/Windows NT/i.test(e)?"Windows":/iPhone|iPad|iPod/i.test(e)?"iOS":/Mac OS X|Macintosh/i.test(e)?"macOS":/Android/i.test(e)?"Android":/CrOS/i.test(e)?"ChromeOS":/Linux/i.test(e)?"Linux":"Other":""}function Sn(t=""){const e=String(t||"");return e?/Edg\//i.test(e)?"Edge":/OPR\/|Opera/i.test(e)?"Opera":/Firefox\//i.test(e)?"Firefox":/Chrome\//i.test(e)||/CriOS\//i.test(e)?"Chrome":/Safari\//i.test(e)?"Safari":"Other":""}function vn(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:bn(e),browser:Sn(e),language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio||1},user:{userId:t.userId||null,email:t.email||null,displayName:t.displayName||null}}}const Yt=new Set(["userId","email","displayName"]),Kt={id:"userId",username:"displayName",name:"displayName"},Gt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit"]),Jt={slug:"Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",projectSlug:"Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",project:"Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",username:"Pass people via Notefully.identify({ displayName }) (username is an identify alias), not init().",userId:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",email:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",displayName:"Pass people via Notefully.identify({ userId, email, displayName }), not init()."};function xn(t={},e={}){const n=e.warn||Qt,r=t&&typeof t=="object"?t:{},o={},i=[];for(const a of Yt)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a]);for(const[a,s]of Object.entries(Kt))Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(o,s)||(o[s]=r[a]));for(const a of Object.keys(r))Yt.has(a)||Object.prototype.hasOwnProperty.call(Kt,a)||i.push(a);if(i.length){const a=i.some(s=>s==="name"||s==="slug"||s==="projectSlug")?" Pass the package/report name via Notefully.init({ name }), not identify().":"";n(`Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+a)}return o}function En(t={},e={}){const n=e.warn||Qt,r=t&&typeof t=="object"?t:{},o=Object.keys(r).filter(i=>!Gt.has(i));if(o.length)for(const i of o){if(Jt[i]){n(`Notefully.init: ignoring "${i}". ${Jt[i]}`);continue}n(`Notefully.init: ignoring unknown key "${i}". Supported: ${[...Gt].join(", ")}.`)}}function Qt(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const Cn=80;function Mn(){const t=[],e={};let n=!1;const r=(i,a)=>{let s="";try{s=a.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{s=String(a[0])}t.push({level:i,text:s.slice(0,2e3),at:Date.now()}),t.length>Cn&&t.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(i=>{e[i]=console[i].bind(console),console[i]=(...a)=>{r(i,a),e[i](...a)}}),window.addEventListener("error",i=>{r("error",[i.message||"window.error"])}),window.addEventListener("unhandledrejection",i=>{r("error",[i.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function Ln(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const o=()=>{if(r=!1,n)try{n.stop()}catch{}};return{start:()=>{if(!e)throw new Error("Speech recognition is not supported in this browser.");return r?(o(),!1):(n=new e,n.continuous=!0,n.interimResults=!0,n.lang=navigator.language||"en-US",n.onresult=a=>{let s="";for(let l=a.resultIndex;l<a.results.length;l+=1)a.results[l].isFinal&&(s+=a.results[l][0].transcript);s&&t(s)},n.onerror=()=>{r=!1},n.onend=()=>{r=!1},n.start(),r=!0,!0)},stop:o,isSupported:()=>!!e,isActive:()=>r}}const $n=60*1e3;function Rn({onStart:t,onStop:e,onError:n}){let r=null,o=null,i=[],a=null;const s=()=>{if(a&&(clearTimeout(a),a=null),o&&o.state!=="inactive")try{o.stop()}catch{}r&&(r.getTracks().forEach(d=>d.stop()),r=null)},l=()=>{if(o&&o.state==="recording"){o.stop();return}s(),e(null)};return{start:async()=>{var d,p;if(!((d=navigator.mediaDevices)!=null&&d.getDisplayMedia))throw new Error("Screen recording is not supported in this browser.");r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"}),i=[],o=new MediaRecorder(r,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),o.ondataavailable=y=>{y.data&&y.data.size&&i.push(y.data)},o.onstop=()=>{const y=i.length?new Blob(i,{type:o.mimeType||"video/webm"}):null;s(),e(y)},(p=r.getVideoTracks()[0])==null||p.addEventListener("ended",()=>l()),o.start(),a=setTimeout(l,$n)},stop:l}}function An(){const t=new Set;return{alloc(){let e=1;for(;t.has(e);)e+=1;return t.add(e),e},free(e){const n=Number(e);Number.isInteger(n)&&n>0&&t.delete(n)},peekUsed(){return[...t].sort((e,n)=>e-n)}}}const dt={x:0,y:0,w:1,h:1};function Zt(){const t=An();let e=[],n={...dt},r=1;return{list:()=>e.filter(i=>Tn(i,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(i){return n=Pn(i),n},resetCrop(){return n={...dt},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(i,a){const s={id:`s${r++}`,type:i,number:t.alloc(),x:.2,y:.2,w:i==="arrow"?.2:.22,h:i==="arrow"?.05:.16,x2:.4,y2:.28,...a};return e.push(s),s},update(i,a){const s=e.find(l=>l.id===i);return s?(Object.assign(s,a),s):null},remove(i){const a=e.findIndex(l=>l.id===i);if(a<0)return null;const[s]=e.splice(a,1);return t.free(s.number),s},reset(){for(e=[],n={...dt},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function Pn(t){const e=Math.min(Math.max(t.x,0),.95),n=Math.min(Math.max(t.y,0),.95),r=Math.min(Math.max(t.w,.05),1-e),o=Math.min(Math.max(t.h,.05),1-n);return{x:e,y:n,w:r,h:o}}function Tn(t,e){const n=t.type==="arrow"?(t.x+(t.x2??t.x))/2:t.x+(t.w||0)/2,r=t.type==="arrow"?(t.y+(t.y2??t.y))/2:t.y+(t.h||0)/2;return n>=e.x&&r>=e.y&&n<=e.x+e.w&&r<=e.y+e.h}function ft(t){const e=Math.max(1,Number(t)||1);return{stroke:Math.max(2,e*.0075),badgeRadius:Math.max(8,e*.025),fontSize:Math.max(10,e*.0275),arrowHead:Math.max(8,e*.035),arrowHeadAngle:.4}}function kn(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:o,colors:i={}}){const a=i.mark||"#fdd341",s=i.markText||"#2a2140",l=ft(r);t.save(),t.lineWidth=l.stroke,t.lineCap="round",t.lineJoin="round",t.strokeStyle=a,t.fillStyle=a,t.font=`700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`,e.forEach(u=>{const d=ht(u.x,n,r),p=mt(u.y,n,o),y=u.w/n.w*r,M=u.h/n.h*o,R=l.stroke/2;if(u.type==="rect")t.strokeRect(d+R,p+R,Math.max(0,y-l.stroke),Math.max(0,M-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(d+y/2,p+M/2,Math.max(.5,y/2-R),Math.max(.5,M/2-R),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const N=ht(u.x2??u.x+u.w,n,r),B=mt(u.y2??u.y,n,o);On(t,d,p,N,B,l)}if(u.number==null||u.number==="")return;const D=In(u,n,r,o,d,p,y),K=String(u.number);t.beginPath(),t.arc(D.x,D.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=a,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(K,D.x,D.y+.5),t.fillStyle=a}),t.restore()}function ht(t,e,n){return(t-e.x)/e.w*n}function mt(t,e,n){return(t-e.y)/e.h*n}function In(t,e,n,r,o,i,a){if(t.type==="arrow"){const s=ht(t.x2??t.x+t.w,e,n),l=mt(t.y2??t.y,e,r);return{x:(o+s)/2,y:(i+l)/2}}return{x:o+a/2,y:i}}function te(t,e,n,r,o){const i=Math.atan2(r-e,n-t),a=o.arrowHead,s=Math.min(o.stroke,a*.2),l=n,u=r,d=n-Math.cos(i)*a,p=r-Math.sin(i)*a,y={x:l-a*Math.cos(i-o.arrowHeadAngle),y:u-a*Math.sin(i-o.arrowHeadAngle)},M={x:l-a*Math.cos(i+o.arrowHeadAngle),y:u-a*Math.sin(i+o.arrowHeadAngle)},R={x:n-Math.cos(i)*s,y:r-Math.sin(i)*s};return{angle:i,tipX:l,tipY:u,baseX:d,baseY:p,left:y,right:M,shaftEnd:R}}function On(t,e,n,r,o,i){const a=te(e,n,r,o,i);t.beginPath(),t.moveTo(e,n),t.lineTo(a.shaftEnd.x,a.shaftEnd.y),t.stroke(),t.beginPath(),t.moveTo(a.tipX,a.tipY),t.lineTo(a.left.x,a.left.y),t.lineTo(a.right.x,a.right.y),t.closePath(),t.fill()}function Hn(t,e,n,r={}){return new Promise((o,i)=>{const a=new Image;a.onload=()=>{const s=Math.round(e.x*a.width),l=Math.round(e.y*a.height),u=Math.max(1,Math.round(e.w*a.width)),d=Math.max(1,Math.round(e.h*a.height)),p=document.createElement("canvas");p.width=u,p.height=d;const y=p.getContext("2d");y.drawImage(a,s,l,u,d,0,0,u,d),kn(y,{stickers:n,crop:e,width:u,height:d,colors:r}),p.toBlob(M=>{if(!M){i(new Error("Could not encode screenshot"));return}o(M)},"image/png")},a.onerror=()=>i(new Error("Could not load screenshot")),a.src=t})}const Dn=["bug","idea","other"],Fn=["maker","all-business","brighter-day","quiet-night"],ee="maker",Un=new Set(["crop","arrow","rect","circle"]),pt=.02,ne=.05,jn=`
|
|
3
3
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
4
4
|
<path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
|
|
5
5
|
<path fill="currentColor" d="M14.7 13.05 20.2 7.55a1.55 1.55 0 0 1 2.2 2.2l-5.5 5.5-.45 1.9a.6.6 0 0 1-.72.45l-1.9-.45.87-1.9z"/>
|
|
6
6
|
</svg>
|
|
7
|
-
`;function k(t){return`<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}const I={crop:k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:k('<circle cx="12" cy="12" r="8"/>'),discard:k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),video:k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},re=
|
|
7
|
+
`;function k(t){return`<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}const I={crop:k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:k('<circle cx="12" cy="12" r="8"/>'),discard:k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),video:k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},re=Mn();re.hook();const ie=10,_n=80,oe="notefully.author",yt="Anonymous";let f={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:ee,video:!1,consoleLogLimit:ie},L={},h=null,c={},m=Zt(),b="",W="",P=null,tt="bug",O=null,$=null,g=null,w=null,et=null,U=null,q=null,H={w:0,h:0},gt=!1;function S(t){return h.querySelector(t)}function ae(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return Fn.includes(e)?e:ee}function se(t,e){return h&&getComputedStyle(h).getPropertyValue(t).trim()||e}async function Nn(t){return(await fetch(t)).blob()}function v(t,e=!1){c.status&&(c.status.textContent=t||"",et&&(clearTimeout(et),et=null),t&&!e&&(et=setTimeout(()=>{c.status.textContent=""},4e3)))}function wt(){return h&&document.body.contains(h)||(h=document.createElement("div"),h.id="notefully",h.innerHTML=`
|
|
8
8
|
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${jn}</button>
|
|
9
9
|
<div class="nf-dialog" hidden>
|
|
10
10
|
<div class="nf-panel">
|
|
@@ -36,8 +36,8 @@ var Notefully=(function(A){"use strict";function Se(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
36
36
|
</div>
|
|
37
37
|
</div>
|
|
38
38
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
39
|
-
`,document.body.appendChild(h),c={launcher:
|
|
39
|
+
`,document.body.appendChild(h),c={launcher:S(".nf-launcher"),dialog:S(".nf-dialog"),stage:S(".nf-stage"),canvas:S(".nf-canvas"),text:S(".nf-text"),author:S(".nf-author"),restore:S(".nf-restore"),status:S(".nf-status"),audio:S(".nf-audio"),video:S(".nf-video"),discard:S(".nf-discard-shot"),stop:S(".nf-stop-video"),resetCrop:S(".nf-reset-crop"),submit:S(".nf-submit"),shot:null},Bn(),nt()),h}function nt(){var t;h&&(h.dataset.theme=ae(f.theme),f.hideLauncher?h.setAttribute("data-nf-hidden-launcher",""):h.removeAttribute("data-nf-hidden-launcher"),c.video&&(c.video.hidden=!f.video),(t=c.dialog)!=null&&t.hidden&&rt())}function rt(){c.launcher&&(c.launcher.hidden=!!f.hideLauncher)}function Bn(){c.launcher.addEventListener("click",()=>$t()),S(".nf-dialog").addEventListener("click",t=>{t.target===c.dialog&&Y()}),h.querySelectorAll(".nf-tool").forEach(t=>{t.addEventListener("click",()=>St(t.dataset.tool))}),c.resetCrop.addEventListener("click",Kn),c.canvas.addEventListener("pointerdown",Wn),c.canvas.addEventListener("dragstart",t=>t.preventDefault()),h.querySelectorAll("[data-kind]").forEach(t=>{t.addEventListener("click",()=>bt(t.dataset.kind))}),c.discard.addEventListener("click",Gn),c.restore.addEventListener("click",Jn),c.audio.addEventListener("click",Qn),c.video.addEventListener("click",Zn),c.stop.addEventListener("click",()=>q==null?void 0:q.stop()),S(".nf-submit").addEventListener("click",()=>{Rt().catch(t=>v(t.message||"Submit failed."))}),bt("bug"),St(null)}function bt(t){tt=Dn.includes(t)?t:"bug",h.querySelectorAll("[data-kind]").forEach(e=>{e.dataset.active=String(e.dataset.kind===tt)})}function St(t){O=Un.has(t)?t:null,$=null,h.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===O)}),c.canvas&&(c.canvas.dataset.draw=O?"true":"false"),b&&C()}function ce(t){return Math.min(1,Math.max(0,t))}function z(){return c.shot||c.canvas}function it(t){const e=z().getBoundingClientRect();return{x:ce((t.clientX-e.left)/Math.max(e.width,1)),y:ce((t.clientY-e.top)/Math.max(e.height,1))}}function Vn(t){const e=z().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function le(t){const e=it(t),n=m.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function ot(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:n,y:r,w:Math.max(pt,Math.abs(e.x-t.x)),h:Math.max(pt,Math.abs(e.y-t.y))}}function vt(t){h&&(t?h.dataset.grabbing="true":delete h.dataset.grabbing)}function xt(t){try{c.canvas.setPointerCapture(t.pointerId)}catch{}}function Et(){window.addEventListener("pointermove",de),window.addEventListener("pointerup",at),window.addEventListener("pointercancel",at)}function ue(){window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",at),window.removeEventListener("pointercancel",at)}function Wn(t){if(t.button!==0||!b)return;if(!t.target.closest(".nf-sticker")&&!Vn(t)){$=null,C();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),$=n.dataset.id,xt(t),qn({kind:"sticker",id:$,dir:(e==null?void 0:e.dataset.dir)||"move"},t),C();return}if($=null,O==="crop"){t.preventDefault(),xt(t),g={kind:"crop",start:it(t),current:it(t)},Et(),C();return}if(O==="arrow"||O==="rect"||O==="circle"){t.preventDefault(),xt(t);const r=le(t);g={kind:"sticker",type:O,start:r,current:r},Et(),C();return}C()}function qn(t,e){e.preventDefault(),e.stopPropagation();const n=z().getBoundingClientRect(),r=m.list().find(o=>o.id===t.id);w={...t,startX:e.clientX,startY:e.clientY,crop:m.crop(),sticker:r?{...r}:null,rect:n},vt(t.dir==="move"||t.dir==="start"||t.dir==="end"),Et()}function de(t){if(g){g.current=g.kind==="crop"?it(t):le(t),C();return}if(!w)return;const e=(t.clientX-w.startX)/w.rect.width*w.crop.w,n=(t.clientY-w.startY)/w.rect.height*w.crop.h,r=w.sticker;if(r){if(w.dir==="end")m.update(r.id,{x2:r.x2+e,y2:r.y2+n});else if(w.dir==="start")m.update(r.id,{x:r.x+e,y:r.y+n});else if(w.dir==="move")m.update(r.id,{x:r.x+e,y:r.y+n,x2:(r.x2||r.x)+e,y2:(r.y2||r.y)+n});else{const o={x:r.x,y:r.y,w:r.w,h:r.h};zn(o,w.dir,e,n),m.update(r.id,o)}C()}}function zn(t,e,n,r){if(e.includes("e")&&(t.w=Math.max(.04,t.w+n)),e.includes("s")&&(t.h=Math.max(.04,t.h+r)),e.includes("w")){const o=Math.max(.04,t.w-n);t.x+=t.w-o,t.w=o}if(e.includes("n")){const o=Math.max(.04,t.h-r);t.y+=t.h-o,t.h=o}}function at(t){if(ue(),vt(!1),g){Xn();return}if(w){if(w.kind==="sticker"){const e=c.canvas.getBoundingClientRect();(t.clientX<e.left-24||t.clientX>e.right+24||t.clientY<e.top-24||t.clientY>e.bottom+24)&&(m.remove(w.id),$=null)}w=null,C()}}function Xn(){const t=g;if(g=null,!t)return;if(t.kind==="crop"){const n=ot(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<ne||Math.abs(t.current.y-t.start.y)<ne){C();return}const o=m.crop();m.setCrop({x:o.x+n.x*o.w,y:o.y+n.y*o.h,w:n.w*o.w,h:n.h*o.h}),X();return}const e=Yn(t);e&&($=e.id),C()}function Yn(t){if(t.type==="arrow"){const e=t.current.x-t.start.x,n=t.current.y-t.start.y;return Math.hypot(e,n)<pt?m.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):m.add("arrow",{x:t.start.x,y:t.start.y,x2:t.current.x,y2:t.current.y,w:Math.abs(e),h:Math.abs(n)})}return m.add(t.type,ot(t.start,t.current))}function Kn(){m.resetCrop(),$=null,X()}function Ct(){c.resetCrop&&(c.resetCrop.hidden=!m.isCropped())}function Mt(t){if(!c.audio)return;const e=t?"Stop audio":"Record audio";c.audio.title=e,c.audio.setAttribute("aria-label",e),c.audio.dataset.active=String(!!t)}function Gn(){b&&(W=b),b="",c.stage.hidden=!0,c.restore.hidden=!W}function Jn(){W&&(b=W,c.stage.hidden=!1,c.restore.hidden=!0,X())}function Qn(){try{if(U||(U=Ln(e=>{const n=c.text.value.trim();c.text.value=n?`${n} ${e}`:e})),!U.isSupported()){v("Audio-to-text is not supported in this browser.");return}const t=U.start();Mt(t),v(t?"Listening…":"")}catch(t){v(t.message)}}async function Zn(){if(!f.video){v("Video is disabled on this host.");return}c.dialog.hidden=!0,c.stop.hidden=!1,nt(),c.launcher.hidden=!0,q=Rn({onStart(){},onStop(t){P=t,c.stop.hidden=!0,rt(),c.dialog.hidden=!1,X(),v(t?"Video attached.":"Recording cancelled.")},onError(t){v(t.message)}});try{await q.start()}catch(t){c.stop.hidden=!0,rt(),c.dialog.hidden=!1,v(t.message)}}function X(){if(c.shot=null,!b){c.canvas.style.removeProperty("--nf-shot-aspect"),c.canvas.style.removeProperty("aspect-ratio"),c.canvas.innerHTML=P?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(P)}"></video>`:"",Ct();return}c.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${b}" draggable="false"></div>`,c.shot=c.canvas.querySelector(".nf-shot");const t=c.shot.querySelector("img");t.draggable=!1,t.addEventListener("dragstart",n=>n.preventDefault());const e=()=>{tr(t),C()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e()}function tr(t){const e=t.naturalWidth||H.w,n=t.naturalHeight||H.h;if(e&&n&&(H={w:e,h:n},c.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),c.canvas.style.aspectRatio=`${e} / ${n}`),!c.shot||!H.w||!H.h)return;const r=m.crop(),o=H.w/H.h,i=r.w/r.h*o,a=Math.min(1,i/o),s=Math.min(1,o/i);c.shot.style.left=`${(1-a)/2*100}%`,c.shot.style.top=`${(1-s)/2*100}%`,c.shot.style.width=`${a*100}%`,c.shot.style.height=`${s*100}%`,t.style.width=`${100/r.w}%`,t.style.height=`${100/r.h}%`,t.style.left=`${-r.x/r.w*100}%`,t.style.top=`${-r.y/r.h*100}%`}function er(t){return t.type==="arrow"?{id:"preview",type:"arrow",number:"",x:t.start.x,y:t.start.y,x2:t.current.x,y2:t.current.y,w:Math.abs(t.current.x-t.start.x),h:Math.abs(t.current.y-t.start.y)}:{id:"preview",type:t.type,number:"",...ot(t.start,t.current)}}function C(){if((c.shot||c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(i=>i.remove()),!b||!c.shot){Ct();return}const e=m.crop(),n=z(),r=ft(n.clientWidth||400);if(c.shot.style.setProperty("--nf-anno-stroke",`${r.stroke}px`),c.shot.style.setProperty("--nf-anno-badge",`${r.badgeRadius*2}px`),c.shot.style.setProperty("--nf-anno-badge-font",`${r.fontSize}px`),c.shot.style.setProperty("--nf-anno-handle",`${Math.max(8,r.stroke*2.5)}px`),(g==null?void 0:g.kind)==="crop"){const i=document.createElement("div");i.className="nf-crop",fe(i,ot(g.start,g.current),{x:0,y:0,w:1,h:1}),c.shot.appendChild(i)}const o=m.list().slice();if((g==null?void 0:g.kind)==="sticker"&&o.push(er(g)),o.forEach(i=>{const a=i.id==="preview",s=!a&&i.id===$,l=document.createElement("div");if(l.className=`nf-sticker nf-${i.type}`,l.dataset.id=i.id,s&&(l.dataset.selected="true"),a&&(l.dataset.preview="true"),i.type==="arrow"?nr(l,i,e,s,r):(fe(l,i,e),s&&["nw","ne","sw","se"].forEach(u=>Lt(l,u))),!a&&i.number){const u=document.createElement("span");u.className="nf-badge",u.textContent=String(i.number),l.appendChild(u)}c.shot.appendChild(l)}),c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(i=>i.remove()),P){const i=document.createElement("video");i.className="nf-recording-preview",i.controls=!0,i.src=URL.createObjectURL(P),i.style.position="absolute",i.style.right="8px",i.style.bottom="8px",i.style.width="160px",c.canvas.appendChild(i)}Ct()}function nr(t,e,n,r,o=ft(400)){const i=z(),a=i.clientWidth,s=i.clientHeight,l=(e.x-n.x)/n.w*a,u=(e.y-n.y)/n.h*s,d=((e.x2??e.x+e.w)-n.x)/n.w*a,p=((e.y2??e.y)-n.y)/n.h*s,y=Math.max(18,o.arrowHead+o.stroke*2),M=Math.min(l,d)-y,R=Math.min(u,p)-y,D=Math.max(2,Math.abs(d-l))+y*2,K=Math.max(2,Math.abs(p-u))+y*2,N=l-M,B=u-R,Pt=d-M,Tt=p-R,F=te(N,B,Pt,Tt,o),V=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${M}px`,t.style.top=`${R}px`,t.style.width=`${D}px`,t.style.height=`${K}px`,V.setAttribute("class","nf-arrow-svg"),V.setAttribute("viewBox",`0 0 ${D} ${K}`),V.setAttribute("width",String(D)),V.setAttribute("height",String(K)),V.innerHTML=`
|
|
40
40
|
<line class="nf-arrow-hit" x1="${N}" y1="${B}" x2="${Pt}" y2="${Tt}" />
|
|
41
41
|
<line class="nf-arrow-shaft" x1="${N}" y1="${B}" x2="${F.shaftEnd.x}" y2="${F.shaftEnd.y}" />
|
|
42
42
|
<polygon class="nf-arrow-head" points="${F.tipX},${F.tipY} ${F.left.x},${F.left.y} ${F.right.x},${F.right.y}" />
|
|
43
|
-
`,t.appendChild(V),r&&(Lt(t,"start",{left:N-5,top:B-5}),Lt(t,"end",{left:Pt-5,top:Tt-5}))}function Lt(t,e,n){const r=document.createElement("span");r.className="nf-handle",r.dataset.dir=e,n&&(r.style.left=`${n.left}px`,r.style.top=`${n.top}px`),t.appendChild(r)}function fe(t,e,n){t.style.left=`${(e.x-n.x)/n.w*100}%`,t.style.top=`${(e.y-n.y)/n.h*100}%`,t.style.width=`${e.w/n.w*100}%`,t.style.height=`${e.h/n.h*100}%`}function
|
|
43
|
+
`,t.appendChild(V),r&&(Lt(t,"start",{left:N-5,top:B-5}),Lt(t,"end",{left:Pt-5,top:Tt-5}))}function Lt(t,e,n){const r=document.createElement("span");r.className="nf-handle",r.dataset.dir=e,n&&(r.style.left=`${n.left}px`,r.style.top=`${n.top}px`),t.appendChild(r)}function fe(t,e,n){t.style.left=`${(e.x-n.x)/n.w*100}%`,t.style.top=`${(e.y-n.y)/n.h*100}%`,t.style.width=`${e.w/n.w*100}%`,t.style.height=`${e.h/n.h*100}%`}function rr(){try{return String(localStorage.getItem(oe)||"").trim()}catch{return""}}function ir(t){const e=String(t||"").trim();if(!(!e||e===yt))try{localStorage.setItem(oe,e)}catch{}}function he(){return!!(String(L.userId||"").trim()||String(L.email||"").trim()||String(L.displayName||"").trim())}function or(){return String(L.displayName||L.email||L.userId||"").trim()}function ar(){var e;if(he())return or()||yt;const t=String(((e=c.author)==null?void 0:e.value)||"").trim();return t?(ir(t),t):yt}function me(){if(!c.author)return;const t=he();if(c.author.hidden=t,t){c.author.value="";return}c.author.value=rr()}function pe(t,e=ie){const n=Number(t);return Number.isFinite(n)?Math.min(_n,Math.max(0,Math.floor(n))):e}function ye(t={}){return En(t),f={...f,endpoint:String(t.endpoint||f.endpoint||"").replace(/\/$/,""),projectKey:t.projectKey==null?f.projectKey:String(t.projectKey),version:t.version==null?f.version:String(t.version),name:t.name==null?f.name:String(t.name||""),targets:t.targets===void 0?f.targets:t.targets,hideLauncher:t.hideLauncher==null?f.hideLauncher:!!t.hideLauncher,theme:ae(t.theme??f.theme),video:t.video==null?f.video:!!t.video,consoleLogLimit:t.consoleLogLimit==null?f.consoleLogLimit:pe(t.consoleLogLimit,f.consoleLogLimit)},wt(),nt(),At}async function $t(){wt(),nt(),c.launcher.hidden=!0,m=Zt(),H={w:0,h:0},P=null,$=null,g=null,w=null,tt="bug",bt("bug"),St(null),Mt(!1),c.text.value="",me(),v("");try{b=await wn(),W=b,c.stage.hidden=!1,c.restore.hidden=!0,v("")}catch{b="",v("Screenshot failed; you can still send text.")}c.dialog.hidden=!1,X(),c.text.focus()}function Y(){h&&(U==null||U.stop(),Mt(!1),ue(),g=null,w=null,vt(!1),c.dialog.hidden=!0,c.stop.hidden=!0,rt())}function ge(t={}){L={...L,...xn(t)},me()}async function Rt(){if(wt(),gt)return null;const t=c.text.value.trim();if(!t&&!b&&!P)return v("Add a note, screenshot, or video first."),null;if(!f.endpoint||!f.projectKey)return v("Notefully is missing endpoint or projectKey."),null;gt=!0,we(!0),v("Submitting…",!0);try{const e=ar(),n=new FormData;if(n.append("message",t),n.append("kind",tt),n.append("version",f.version||"0.0.0"),n.append("author",e),f.name&&n.append("name",f.name),n.append("context",JSON.stringify({...vn({...L,displayName:L.displayName||e}),author:e,console:re.snapshot().slice(-pe(f.consoleLogLimit))})),n.append("annotations",JSON.stringify(m.list())),n.append("crop",JSON.stringify(m.crop())),Array.isArray(f.targets)&&n.append("targets",JSON.stringify(f.targets)),b){const i=await Nn(b);if(n.append("screenshot",i,"screenshot.png"),m.list().length||m.isCropped()){const a=await Hn(b,m.crop(),m.list(),{mark:se("--nf-mark","#fdd341"),markText:se("--nf-mark-text","#2a2140")});n.append("screenshotBaked",a,"screenshot.baked.png")}}P&&n.append("recording",P,"recording.webm");const r=await fetch(`${f.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":f.projectKey},body:n});let o=null;try{o=await r.json()}catch{o=null}if(!r.ok)throw v((o==null?void 0:o.error)||"Submit failed."),new Error((o==null?void 0:o.error)||`Submit failed (${r.status})`);return v("Sent. Thank you."),Y(),o}finally{gt=!1,we(!1)}}function we(t){c.submit&&(c.submit.disabled=!!t,c.submit.setAttribute("aria-busy",t?"true":"false"))}function be(){Y(),h==null||h.remove(),h=null,c={}}const At={init:ye,open:$t,close:Y,identify:ge,submit:Rt,destroy:be};return typeof window<"u"&&(window.Notefully=At),A.close=Y,A.default=At,A.destroy=be,A.identify=ge,A.init=ye,A.open=$t,A.submit=Rt,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),A})({});
|
package/dist/notefully.js
CHANGED
|
@@ -22,9 +22,9 @@ function D(t) {
|
|
|
22
22
|
e.push(t[n]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
|
-
let
|
|
25
|
+
let _ = null;
|
|
26
26
|
function Wt(t = {}) {
|
|
27
|
-
return
|
|
27
|
+
return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ = D(window.getComputedStyle(document.documentElement)), _));
|
|
28
28
|
}
|
|
29
29
|
function K(t, e) {
|
|
30
30
|
const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
|
|
@@ -221,17 +221,17 @@ function je(t, e, n) {
|
|
|
221
221
|
i === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && i === "display" && a === "inline" && (a = "block"), i === "d" && e.getAttribute("d") && (a = `path(${e.getAttribute("d")})`), r.setProperty(i, a, o.getPropertyPriority(i));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Ne(t, e) {
|
|
225
225
|
x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function _e(t, e) {
|
|
228
228
|
if (x(t, HTMLSelectElement)) {
|
|
229
229
|
const r = Array.from(e.children).find((o) => t.value === o.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
function Be(t, e, n) {
|
|
234
|
-
return x(e, Element) && (je(t, e, n), $e(t, e, n),
|
|
234
|
+
return x(e, Element) && (je(t, e, n), $e(t, e, n), Ne(t, e), _e(t, e)), e;
|
|
235
235
|
}
|
|
236
236
|
async function Ve(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
@@ -395,10 +395,10 @@ async function tn(t, e) {
|
|
|
395
395
|
const l = i.href, u = kt(l).then((d) => It(d, e)).then((d) => Ot(d).forEach((m) => {
|
|
396
396
|
try {
|
|
397
397
|
o.insertRule(m, m.startsWith("@import") ? s += 1 : o.cssRules.length);
|
|
398
|
-
} catch (
|
|
398
|
+
} catch (y) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: m,
|
|
401
|
-
error:
|
|
401
|
+
error: y
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
})).catch((d) => {
|
|
@@ -505,7 +505,7 @@ function fn() {
|
|
|
505
505
|
function hn() {
|
|
506
506
|
document.querySelectorAll(`[${J}]`).forEach((t) => t.remove());
|
|
507
507
|
}
|
|
508
|
-
async function
|
|
508
|
+
async function pn() {
|
|
509
509
|
const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = fn();
|
|
510
510
|
t && (t.style.display = "none");
|
|
511
511
|
const r = dn();
|
|
@@ -520,7 +520,7 @@ async function mn() {
|
|
|
520
520
|
r(), n.remove(), hn(), t && (t.style.display = e);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function mn(t = "") {
|
|
524
524
|
const e = String(t || "");
|
|
525
525
|
return e ? /Windows NT/i.test(e) ? "Windows" : /iPhone|iPad|iPod/i.test(e) ? "iOS" : /Mac OS X|Macintosh/i.test(e) ? "macOS" : /Android/i.test(e) ? "Android" : /CrOS/i.test(e) ? "ChromeOS" : /Linux/i.test(e) ? "Linux" : "Other" : "";
|
|
526
526
|
}
|
|
@@ -534,7 +534,7 @@ function gn(t = {}) {
|
|
|
534
534
|
url: location.href,
|
|
535
535
|
title: document.title,
|
|
536
536
|
userAgent: e,
|
|
537
|
-
os:
|
|
537
|
+
os: mn(e),
|
|
538
538
|
browser: yn(e),
|
|
539
539
|
language: navigator.language,
|
|
540
540
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -697,11 +697,11 @@ function Cn({ onStart: t, onStop: e, onError: n }) {
|
|
|
697
697
|
selfBrowserSurface: "include"
|
|
698
698
|
}), i = [], o = new MediaRecorder(r, {
|
|
699
699
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
700
|
-
}), o.ondataavailable = (
|
|
701
|
-
|
|
700
|
+
}), o.ondataavailable = (y) => {
|
|
701
|
+
y.data && y.data.size && i.push(y.data);
|
|
702
702
|
}, o.onstop = () => {
|
|
703
|
-
const
|
|
704
|
-
s(), e(
|
|
703
|
+
const y = i.length ? new Blob(i, { type: o.mimeType || "video/webm" }) : null;
|
|
704
|
+
s(), e(y);
|
|
705
705
|
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), o.start(), a = setTimeout(l, En);
|
|
706
706
|
}, stop: l };
|
|
707
707
|
}
|
|
@@ -799,43 +799,43 @@ function Rn(t, {
|
|
|
799
799
|
}) {
|
|
800
800
|
const a = i.mark || "#fdd341", s = i.markText || "#2a2140", l = Ct(r);
|
|
801
801
|
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = a, t.fillStyle = a, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
|
|
802
|
-
const d = ht(u.x, n, r), m =
|
|
802
|
+
const d = ht(u.x, n, r), m = pt(u.y, n, o), y = u.w / n.w * r, C = u.h / n.h * o, L = l.stroke / 2;
|
|
803
803
|
if (u.type === "rect")
|
|
804
804
|
t.strokeRect(
|
|
805
805
|
d + L,
|
|
806
806
|
m + L,
|
|
807
|
-
Math.max(0,
|
|
807
|
+
Math.max(0, y - l.stroke),
|
|
808
808
|
Math.max(0, C - l.stroke)
|
|
809
809
|
);
|
|
810
810
|
else if (u.type === "circle")
|
|
811
811
|
t.beginPath(), t.ellipse(
|
|
812
|
-
d +
|
|
812
|
+
d + y / 2,
|
|
813
813
|
m + C / 2,
|
|
814
|
-
Math.max(0.5,
|
|
814
|
+
Math.max(0.5, y / 2 - L),
|
|
815
815
|
Math.max(0.5, C / 2 - L),
|
|
816
816
|
0,
|
|
817
817
|
0,
|
|
818
818
|
Math.PI * 2
|
|
819
819
|
), t.stroke();
|
|
820
820
|
else if (u.type === "arrow") {
|
|
821
|
-
const U = ht(u.x2 ?? u.x + u.w, n, r), j =
|
|
821
|
+
const U = ht(u.x2 ?? u.x + u.w, n, r), j = pt(u.y2 ?? u.y, n, o);
|
|
822
822
|
Pn(t, d, m, U, j, l);
|
|
823
823
|
}
|
|
824
824
|
if (u.number == null || u.number === "")
|
|
825
825
|
return;
|
|
826
|
-
const P = An(u, n, r, o, d, m,
|
|
826
|
+
const P = An(u, n, r, o, d, m, y), V = String(u.number);
|
|
827
827
|
t.beginPath(), t.arc(P.x, P.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(V, P.x, P.y + 0.5), t.fillStyle = a;
|
|
828
828
|
}), t.restore();
|
|
829
829
|
}
|
|
830
830
|
function ht(t, e, n) {
|
|
831
831
|
return (t - e.x) / e.w * n;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function pt(t, e, n) {
|
|
834
834
|
return (t - e.y) / e.h * n;
|
|
835
835
|
}
|
|
836
836
|
function An(t, e, n, r, o, i, a) {
|
|
837
837
|
if (t.type === "arrow") {
|
|
838
|
-
const s = ht(t.x2 ?? t.x + t.w, e, n), l =
|
|
838
|
+
const s = ht(t.x2 ?? t.x + t.w, e, n), l = pt(t.y2 ?? t.y, e, r);
|
|
839
839
|
return {
|
|
840
840
|
x: (o + s) / 2,
|
|
841
841
|
y: (i + l) / 2
|
|
@@ -844,7 +844,7 @@ function An(t, e, n, r, o, i, a) {
|
|
|
844
844
|
return { x: o + a / 2, y: i };
|
|
845
845
|
}
|
|
846
846
|
function ee(t, e, n, r, o) {
|
|
847
|
-
const i = Math.atan2(r - e, n - t), a = o.arrowHead, s = Math.min(o.stroke, a * 0.2), l = n, u = r, d = n - Math.cos(i) * a, m = r - Math.sin(i) * a,
|
|
847
|
+
const i = Math.atan2(r - e, n - t), a = o.arrowHead, s = Math.min(o.stroke, a * 0.2), l = n, u = r, d = n - Math.cos(i) * a, m = r - Math.sin(i) * a, y = {
|
|
848
848
|
x: l - a * Math.cos(i - o.arrowHeadAngle),
|
|
849
849
|
y: u - a * Math.sin(i - o.arrowHeadAngle)
|
|
850
850
|
}, C = {
|
|
@@ -854,7 +854,7 @@ function ee(t, e, n, r, o) {
|
|
|
854
854
|
x: n - Math.cos(i) * s,
|
|
855
855
|
y: r - Math.sin(i) * s
|
|
856
856
|
};
|
|
857
|
-
return { angle: i, tipX: l, tipY: u, baseX: d, baseY: m, left:
|
|
857
|
+
return { angle: i, tipX: l, tipY: u, baseX: d, baseY: m, left: y, right: C, shaftEnd: L };
|
|
858
858
|
}
|
|
859
859
|
function Pn(t, e, n, r, o, i) {
|
|
860
860
|
const a = ee(e, n, r, o, i);
|
|
@@ -866,8 +866,8 @@ function Tn(t, e, n, r = {}) {
|
|
|
866
866
|
a.onload = () => {
|
|
867
867
|
const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), d = Math.max(1, Math.round(e.h * a.height)), m = document.createElement("canvas");
|
|
868
868
|
m.width = u, m.height = d;
|
|
869
|
-
const
|
|
870
|
-
|
|
869
|
+
const y = m.getContext("2d");
|
|
870
|
+
y.drawImage(a, s, l, u, d, 0, 0, u, d), Rn(y, {
|
|
871
871
|
stickers: n,
|
|
872
872
|
crop: e,
|
|
873
873
|
width: u,
|
|
@@ -883,7 +883,7 @@ function Tn(t, e, n, r = {}) {
|
|
|
883
883
|
}, a.onerror = () => i(new Error("Could not load screenshot")), a.src = t;
|
|
884
884
|
});
|
|
885
885
|
}
|
|
886
|
-
const kn = ["bug", "idea", "other"], In = ["maker", "all-business", "brighter-day", "quiet-night"], ne = "maker", On = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]),
|
|
886
|
+
const kn = ["bug", "idea", "other"], In = ["maker", "all-business", "brighter-day", "quiet-night"], ne = "maker", On = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), mt = 0.02, jt = 0.05, Hn = `
|
|
887
887
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
888
888
|
<path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
|
|
889
889
|
<path fill="currentColor" d="M14.7 13.05 20.2 7.55a1.55 1.55 0 0 1 2.2 2.2l-5.5 5.5-.45 1.9a.6.6 0 0 1-.72.45l-1.9-.45.87-1.9z"/>
|
|
@@ -914,7 +914,7 @@ let f = {
|
|
|
914
914
|
theme: ne,
|
|
915
915
|
video: !1,
|
|
916
916
|
consoleLogLimit: ie
|
|
917
|
-
}, R = {}, h = null, c = {},
|
|
917
|
+
}, R = {}, h = null, c = {}, p = te(), v = "", q = "", A = null, Q = "bug", H = null, $ = null, w = null, g = null, Y = null, F = null, W = null, O = { w: 0, h: 0 }, ut = !1;
|
|
918
918
|
function b(t) {
|
|
919
919
|
return h.querySelector(t);
|
|
920
920
|
}
|
|
@@ -922,9 +922,12 @@ function ae(t) {
|
|
|
922
922
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
923
923
|
return In.includes(e) ? e : ne;
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Nt(t, e) {
|
|
926
926
|
return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
|
|
927
927
|
}
|
|
928
|
+
async function Fn(t) {
|
|
929
|
+
return (await fetch(t)).blob();
|
|
930
|
+
}
|
|
928
931
|
function S(t, e = !1) {
|
|
929
932
|
c.status && (c.status.textContent = t || "", Y && (clearTimeout(Y), Y = null), t && !e && (Y = setTimeout(() => {
|
|
930
933
|
c.status.textContent = "";
|
|
@@ -979,7 +982,7 @@ function Mt() {
|
|
|
979
982
|
resetCrop: b(".nf-reset-crop"),
|
|
980
983
|
submit: b(".nf-submit"),
|
|
981
984
|
shot: null
|
|
982
|
-
},
|
|
985
|
+
}, Un(), rt()), h;
|
|
983
986
|
}
|
|
984
987
|
function rt() {
|
|
985
988
|
var t;
|
|
@@ -988,15 +991,15 @@ function rt() {
|
|
|
988
991
|
function Z() {
|
|
989
992
|
c.launcher && (c.launcher.hidden = !!f.hideLauncher);
|
|
990
993
|
}
|
|
991
|
-
function
|
|
994
|
+
function Un() {
|
|
992
995
|
c.launcher.addEventListener("click", () => he()), b(".nf-dialog").addEventListener("click", (t) => {
|
|
993
996
|
t.target === c.dialog && ot();
|
|
994
997
|
}), h.querySelectorAll(".nf-tool").forEach((t) => {
|
|
995
998
|
t.addEventListener("click", () => wt(t.dataset.tool));
|
|
996
|
-
}), c.resetCrop.addEventListener("click",
|
|
999
|
+
}), c.resetCrop.addEventListener("click", qn), c.canvas.addEventListener("pointerdown", Nn), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), h.querySelectorAll("[data-kind]").forEach((t) => {
|
|
997
1000
|
t.addEventListener("click", () => gt(t.dataset.kind));
|
|
998
|
-
}), c.discard.addEventListener("click",
|
|
999
|
-
|
|
1001
|
+
}), c.discard.addEventListener("click", zn), c.restore.addEventListener("click", Xn), c.audio.addEventListener("click", Yn), c.video.addEventListener("click", Kn), c.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), b(".nf-submit").addEventListener("click", () => {
|
|
1002
|
+
pe().catch((t) => S(t.message || "Submit failed."));
|
|
1000
1003
|
}), gt("bug"), wt(null);
|
|
1001
1004
|
}
|
|
1002
1005
|
function gt(t) {
|
|
@@ -1009,7 +1012,7 @@ function wt(t) {
|
|
|
1009
1012
|
e.dataset.active = String(e.dataset.tool === H);
|
|
1010
1013
|
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), v && M();
|
|
1011
1014
|
}
|
|
1012
|
-
function
|
|
1015
|
+
function _t(t) {
|
|
1013
1016
|
return Math.min(1, Math.max(0, t));
|
|
1014
1017
|
}
|
|
1015
1018
|
function z() {
|
|
@@ -1018,16 +1021,16 @@ function z() {
|
|
|
1018
1021
|
function tt(t) {
|
|
1019
1022
|
const e = z().getBoundingClientRect();
|
|
1020
1023
|
return {
|
|
1021
|
-
x:
|
|
1022
|
-
y:
|
|
1024
|
+
x: _t((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
1025
|
+
y: _t((t.clientY - e.top) / Math.max(e.height, 1))
|
|
1023
1026
|
};
|
|
1024
1027
|
}
|
|
1025
|
-
function
|
|
1028
|
+
function jn(t) {
|
|
1026
1029
|
const e = z().getBoundingClientRect();
|
|
1027
1030
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1028
1031
|
}
|
|
1029
1032
|
function se(t) {
|
|
1030
|
-
const e = tt(t), n =
|
|
1033
|
+
const e = tt(t), n = p.crop();
|
|
1031
1034
|
return {
|
|
1032
1035
|
x: n.x + e.x * n.w,
|
|
1033
1036
|
y: n.y + e.y * n.h
|
|
@@ -1038,8 +1041,8 @@ function it(t, e) {
|
|
|
1038
1041
|
return {
|
|
1039
1042
|
x: n,
|
|
1040
1043
|
y: r,
|
|
1041
|
-
w: Math.max(
|
|
1042
|
-
h: Math.max(
|
|
1044
|
+
w: Math.max(mt, Math.abs(e.x - t.x)),
|
|
1045
|
+
h: Math.max(mt, Math.abs(e.y - t.y))
|
|
1043
1046
|
};
|
|
1044
1047
|
}
|
|
1045
1048
|
function Lt(t) {
|
|
@@ -1057,10 +1060,10 @@ function bt() {
|
|
|
1057
1060
|
function ce() {
|
|
1058
1061
|
window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", et), window.removeEventListener("pointercancel", et);
|
|
1059
1062
|
}
|
|
1060
|
-
function
|
|
1063
|
+
function Nn(t) {
|
|
1061
1064
|
if (t.button !== 0 || !v)
|
|
1062
1065
|
return;
|
|
1063
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1066
|
+
if (!t.target.closest(".nf-sticker") && !jn(t)) {
|
|
1064
1067
|
$ = null, M();
|
|
1065
1068
|
return;
|
|
1066
1069
|
}
|
|
@@ -1087,12 +1090,12 @@ function jn(t) {
|
|
|
1087
1090
|
}
|
|
1088
1091
|
function _n(t, e) {
|
|
1089
1092
|
e.preventDefault(), e.stopPropagation();
|
|
1090
|
-
const n = z().getBoundingClientRect(), r =
|
|
1093
|
+
const n = z().getBoundingClientRect(), r = p.list().find((o) => o.id === t.id);
|
|
1091
1094
|
g = {
|
|
1092
1095
|
...t,
|
|
1093
1096
|
startX: e.clientX,
|
|
1094
1097
|
startY: e.clientY,
|
|
1095
|
-
crop:
|
|
1098
|
+
crop: p.crop(),
|
|
1096
1099
|
sticker: r ? { ...r } : null,
|
|
1097
1100
|
rect: n
|
|
1098
1101
|
}, Lt(t.dir === "move" || t.dir === "start" || t.dir === "end"), bt();
|
|
@@ -1107,17 +1110,17 @@ function le(t) {
|
|
|
1107
1110
|
const e = (t.clientX - g.startX) / g.rect.width * g.crop.w, n = (t.clientY - g.startY) / g.rect.height * g.crop.h, r = g.sticker;
|
|
1108
1111
|
if (r) {
|
|
1109
1112
|
if (g.dir === "end")
|
|
1110
|
-
|
|
1113
|
+
p.update(r.id, {
|
|
1111
1114
|
x2: r.x2 + e,
|
|
1112
1115
|
y2: r.y2 + n
|
|
1113
1116
|
});
|
|
1114
1117
|
else if (g.dir === "start")
|
|
1115
|
-
|
|
1118
|
+
p.update(r.id, {
|
|
1116
1119
|
x: r.x + e,
|
|
1117
1120
|
y: r.y + n
|
|
1118
1121
|
});
|
|
1119
1122
|
else if (g.dir === "move")
|
|
1120
|
-
|
|
1123
|
+
p.update(r.id, {
|
|
1121
1124
|
x: r.x + e,
|
|
1122
1125
|
y: r.y + n,
|
|
1123
1126
|
x2: (r.x2 || r.x) + e,
|
|
@@ -1125,12 +1128,12 @@ function le(t) {
|
|
|
1125
1128
|
});
|
|
1126
1129
|
else {
|
|
1127
1130
|
const o = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1128
|
-
|
|
1131
|
+
Bn(o, g.dir, e, n), p.update(r.id, o);
|
|
1129
1132
|
}
|
|
1130
1133
|
M();
|
|
1131
1134
|
}
|
|
1132
1135
|
}
|
|
1133
|
-
function
|
|
1136
|
+
function Bn(t, e, n, r) {
|
|
1134
1137
|
if (e.includes("e") && (t.w = Math.max(0.04, t.w + n)), e.includes("s") && (t.h = Math.max(0.04, t.h + r)), e.includes("w")) {
|
|
1135
1138
|
const o = Math.max(0.04, t.w - n);
|
|
1136
1139
|
t.x += t.w - o, t.w = o;
|
|
@@ -1142,18 +1145,18 @@ function Nn(t, e, n, r) {
|
|
|
1142
1145
|
}
|
|
1143
1146
|
function et(t) {
|
|
1144
1147
|
if (ce(), Lt(!1), w) {
|
|
1145
|
-
|
|
1148
|
+
Vn();
|
|
1146
1149
|
return;
|
|
1147
1150
|
}
|
|
1148
1151
|
if (g) {
|
|
1149
1152
|
if (g.kind === "sticker") {
|
|
1150
1153
|
const e = c.canvas.getBoundingClientRect();
|
|
1151
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (
|
|
1154
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (p.remove(g.id), $ = null);
|
|
1152
1155
|
}
|
|
1153
1156
|
g = null, M();
|
|
1154
1157
|
}
|
|
1155
1158
|
}
|
|
1156
|
-
function
|
|
1159
|
+
function Vn() {
|
|
1157
1160
|
const t = w;
|
|
1158
1161
|
if (w = null, !t)
|
|
1159
1162
|
return;
|
|
@@ -1163,8 +1166,8 @@ function Bn() {
|
|
|
1163
1166
|
M();
|
|
1164
1167
|
return;
|
|
1165
1168
|
}
|
|
1166
|
-
const o =
|
|
1167
|
-
|
|
1169
|
+
const o = p.crop();
|
|
1170
|
+
p.setCrop({
|
|
1168
1171
|
x: o.x + n.x * o.w,
|
|
1169
1172
|
y: o.y + n.y * o.h,
|
|
1170
1173
|
w: n.w * o.w,
|
|
@@ -1172,20 +1175,20 @@ function Bn() {
|
|
|
1172
1175
|
}), X();
|
|
1173
1176
|
return;
|
|
1174
1177
|
}
|
|
1175
|
-
const e =
|
|
1178
|
+
const e = Wn(t);
|
|
1176
1179
|
e && ($ = e.id), M();
|
|
1177
1180
|
}
|
|
1178
|
-
function
|
|
1181
|
+
function Wn(t) {
|
|
1179
1182
|
if (t.type === "arrow") {
|
|
1180
1183
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1181
|
-
return Math.hypot(e, n) <
|
|
1184
|
+
return Math.hypot(e, n) < mt ? p.add("arrow", {
|
|
1182
1185
|
x: t.start.x,
|
|
1183
1186
|
y: t.start.y,
|
|
1184
1187
|
x2: t.start.x + 0.12,
|
|
1185
1188
|
y2: t.start.y,
|
|
1186
1189
|
w: 0.12,
|
|
1187
1190
|
h: 0.02
|
|
1188
|
-
}) :
|
|
1191
|
+
}) : p.add("arrow", {
|
|
1189
1192
|
x: t.start.x,
|
|
1190
1193
|
y: t.start.y,
|
|
1191
1194
|
x2: t.current.x,
|
|
@@ -1194,13 +1197,13 @@ function Vn(t) {
|
|
|
1194
1197
|
h: Math.abs(n)
|
|
1195
1198
|
});
|
|
1196
1199
|
}
|
|
1197
|
-
return
|
|
1200
|
+
return p.add(t.type, it(t.start, t.current));
|
|
1198
1201
|
}
|
|
1199
|
-
function
|
|
1200
|
-
|
|
1202
|
+
function qn() {
|
|
1203
|
+
p.resetCrop(), $ = null, X();
|
|
1201
1204
|
}
|
|
1202
1205
|
function St() {
|
|
1203
|
-
c.resetCrop && (c.resetCrop.hidden = !
|
|
1206
|
+
c.resetCrop && (c.resetCrop.hidden = !p.isCropped());
|
|
1204
1207
|
}
|
|
1205
1208
|
function $t(t) {
|
|
1206
1209
|
if (!c.audio)
|
|
@@ -1208,13 +1211,13 @@ function $t(t) {
|
|
|
1208
1211
|
const e = t ? "Stop audio" : "Record audio";
|
|
1209
1212
|
c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
|
|
1210
1213
|
}
|
|
1211
|
-
function
|
|
1214
|
+
function zn() {
|
|
1212
1215
|
v && (q = v), v = "", c.stage.hidden = !0, c.restore.hidden = !q;
|
|
1213
1216
|
}
|
|
1214
|
-
function
|
|
1217
|
+
function Xn() {
|
|
1215
1218
|
q && (v = q, c.stage.hidden = !1, c.restore.hidden = !0, X());
|
|
1216
1219
|
}
|
|
1217
|
-
function
|
|
1220
|
+
function Yn() {
|
|
1218
1221
|
try {
|
|
1219
1222
|
if (F || (F = xn((e) => {
|
|
1220
1223
|
const n = c.text.value.trim();
|
|
@@ -1229,7 +1232,7 @@ function Xn() {
|
|
|
1229
1232
|
S(t.message);
|
|
1230
1233
|
}
|
|
1231
1234
|
}
|
|
1232
|
-
async function
|
|
1235
|
+
async function Kn() {
|
|
1233
1236
|
if (!f.video) {
|
|
1234
1237
|
S("Video is disabled on this host.");
|
|
1235
1238
|
return;
|
|
@@ -1259,18 +1262,18 @@ function X() {
|
|
|
1259
1262
|
const t = c.shot.querySelector("img");
|
|
1260
1263
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1261
1264
|
const e = () => {
|
|
1262
|
-
|
|
1265
|
+
Gn(t), M();
|
|
1263
1266
|
};
|
|
1264
1267
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1265
1268
|
}
|
|
1266
|
-
function
|
|
1269
|
+
function Gn(t) {
|
|
1267
1270
|
const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
|
|
1268
1271
|
if (e && n && (O = { w: e, h: n }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), c.canvas.style.aspectRatio = `${e} / ${n}`), !c.shot || !O.w || !O.h)
|
|
1269
1272
|
return;
|
|
1270
|
-
const r =
|
|
1273
|
+
const r = p.crop(), o = O.w / O.h, i = r.w / r.h * o, a = Math.min(1, i / o), s = Math.min(1, o / i);
|
|
1271
1274
|
c.shot.style.left = `${(1 - a) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${a * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
|
|
1272
1275
|
}
|
|
1273
|
-
function
|
|
1276
|
+
function Jn(t) {
|
|
1274
1277
|
return t.type === "arrow" ? {
|
|
1275
1278
|
id: "preview",
|
|
1276
1279
|
type: "arrow",
|
|
@@ -1293,15 +1296,15 @@ function M() {
|
|
|
1293
1296
|
St();
|
|
1294
1297
|
return;
|
|
1295
1298
|
}
|
|
1296
|
-
const e =
|
|
1299
|
+
const e = p.crop(), n = z(), r = Ct(n.clientWidth || 400);
|
|
1297
1300
|
if (c.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), c.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), c.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), c.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (w == null ? void 0 : w.kind) === "crop") {
|
|
1298
1301
|
const i = document.createElement("div");
|
|
1299
1302
|
i.className = "nf-crop", Bt(i, it(w.start, w.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(i);
|
|
1300
1303
|
}
|
|
1301
|
-
const o =
|
|
1302
|
-
if ((w == null ? void 0 : w.kind) === "sticker" && o.push(
|
|
1304
|
+
const o = p.list().slice();
|
|
1305
|
+
if ((w == null ? void 0 : w.kind) === "sticker" && o.push(Jn(w)), o.forEach((i) => {
|
|
1303
1306
|
const a = i.id === "preview", s = !a && i.id === $, l = document.createElement("div");
|
|
1304
|
-
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ?
|
|
1307
|
+
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ? Qn(l, i, e, s, r) : (Bt(l, i, e), s && ["nw", "ne", "sw", "se"].forEach((u) => vt(l, u))), !a && i.number) {
|
|
1305
1308
|
const u = document.createElement("span");
|
|
1306
1309
|
u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
|
|
1307
1310
|
}
|
|
@@ -1312,13 +1315,13 @@ function M() {
|
|
|
1312
1315
|
}
|
|
1313
1316
|
St();
|
|
1314
1317
|
}
|
|
1315
|
-
function
|
|
1316
|
-
const i = z(), a = i.clientWidth, s = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, d = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, m = ((e.y2 ?? e.y) - n.y) / n.h * s,
|
|
1317
|
-
t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${P}px`, t.style.height = `${V}px`,
|
|
1318
|
+
function Qn(t, e, n, r, o = Ct(400)) {
|
|
1319
|
+
const i = z(), a = i.clientWidth, s = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, d = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, m = ((e.y2 ?? e.y) - n.y) / n.h * s, y = Math.max(18, o.arrowHead + o.stroke * 2), C = Math.min(l, d) - y, L = Math.min(u, m) - y, P = Math.max(2, Math.abs(d - l)) + y * 2, V = Math.max(2, Math.abs(m - u)) + y * 2, U = l - C, j = u - L, at = d - C, st = m - L, T = ee(U, j, at, st, o), N = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1320
|
+
t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${P}px`, t.style.height = `${V}px`, N.setAttribute("class", "nf-arrow-svg"), N.setAttribute("viewBox", `0 0 ${P} ${V}`), N.setAttribute("width", String(P)), N.setAttribute("height", String(V)), N.innerHTML = `
|
|
1318
1321
|
<line class="nf-arrow-hit" x1="${U}" y1="${j}" x2="${at}" y2="${st}" />
|
|
1319
1322
|
<line class="nf-arrow-shaft" x1="${U}" y1="${j}" x2="${T.shaftEnd.x}" y2="${T.shaftEnd.y}" />
|
|
1320
1323
|
<polygon class="nf-arrow-head" points="${T.tipX},${T.tipY} ${T.left.x},${T.left.y} ${T.right.x},${T.right.y}" />
|
|
1321
|
-
`, t.appendChild(
|
|
1324
|
+
`, t.appendChild(N), r && (vt(t, "start", { left: U - 5, top: j - 5 }), vt(t, "end", { left: at - 5, top: st - 5 }));
|
|
1322
1325
|
}
|
|
1323
1326
|
function vt(t, e, n) {
|
|
1324
1327
|
const r = document.createElement("span");
|
|
@@ -1327,14 +1330,14 @@ function vt(t, e, n) {
|
|
|
1327
1330
|
function Bt(t, e, n) {
|
|
1328
1331
|
t.style.left = `${(e.x - n.x) / n.w * 100}%`, t.style.top = `${(e.y - n.y) / n.h * 100}%`, t.style.width = `${e.w / n.w * 100}%`, t.style.height = `${e.h / n.h * 100}%`;
|
|
1329
1332
|
}
|
|
1330
|
-
function
|
|
1333
|
+
function Zn() {
|
|
1331
1334
|
try {
|
|
1332
1335
|
return String(localStorage.getItem(oe) || "").trim();
|
|
1333
1336
|
} catch {
|
|
1334
1337
|
return "";
|
|
1335
1338
|
}
|
|
1336
1339
|
}
|
|
1337
|
-
function
|
|
1340
|
+
function tr(t) {
|
|
1338
1341
|
const e = String(t || "").trim();
|
|
1339
1342
|
if (!(!e || e === yt))
|
|
1340
1343
|
try {
|
|
@@ -1345,17 +1348,17 @@ function Zn(t) {
|
|
|
1345
1348
|
function ue() {
|
|
1346
1349
|
return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
|
|
1347
1350
|
}
|
|
1348
|
-
function
|
|
1351
|
+
function er() {
|
|
1349
1352
|
return String(
|
|
1350
1353
|
R.displayName || R.email || R.userId || ""
|
|
1351
1354
|
).trim();
|
|
1352
1355
|
}
|
|
1353
|
-
function
|
|
1356
|
+
function nr() {
|
|
1354
1357
|
var e;
|
|
1355
1358
|
if (ue())
|
|
1356
|
-
return
|
|
1359
|
+
return er() || yt;
|
|
1357
1360
|
const t = String(((e = c.author) == null ? void 0 : e.value) || "").trim();
|
|
1358
|
-
return t ? (
|
|
1361
|
+
return t ? (tr(t), t) : yt;
|
|
1359
1362
|
}
|
|
1360
1363
|
function de() {
|
|
1361
1364
|
if (!c.author)
|
|
@@ -1365,13 +1368,13 @@ function de() {
|
|
|
1365
1368
|
c.author.value = "";
|
|
1366
1369
|
return;
|
|
1367
1370
|
}
|
|
1368
|
-
c.author.value =
|
|
1371
|
+
c.author.value = Zn();
|
|
1369
1372
|
}
|
|
1370
1373
|
function fe(t, e = ie) {
|
|
1371
1374
|
const n = Number(t);
|
|
1372
1375
|
return Number.isFinite(n) ? Math.min(Dn, Math.max(0, Math.floor(n))) : e;
|
|
1373
1376
|
}
|
|
1374
|
-
function
|
|
1377
|
+
function rr(t = {}) {
|
|
1375
1378
|
return bn(t), f = {
|
|
1376
1379
|
...f,
|
|
1377
1380
|
endpoint: String(t.endpoint || f.endpoint || "").replace(/\/$/, ""),
|
|
@@ -1383,12 +1386,12 @@ function nr(t = {}) {
|
|
|
1383
1386
|
theme: ae(t.theme ?? f.theme),
|
|
1384
1387
|
video: t.video == null ? f.video : !!t.video,
|
|
1385
1388
|
consoleLogLimit: t.consoleLogLimit == null ? f.consoleLogLimit : fe(t.consoleLogLimit, f.consoleLogLimit)
|
|
1386
|
-
}, Mt(), rt(),
|
|
1389
|
+
}, Mt(), rt(), me;
|
|
1387
1390
|
}
|
|
1388
1391
|
async function he() {
|
|
1389
|
-
Mt(), rt(), c.launcher.hidden = !0,
|
|
1392
|
+
Mt(), rt(), c.launcher.hidden = !0, p = te(), O = { w: 0, h: 0 }, A = null, $ = null, w = null, g = null, Q = "bug", gt("bug"), wt(null), $t(!1), c.text.value = "", de(), S("");
|
|
1390
1393
|
try {
|
|
1391
|
-
v = await
|
|
1394
|
+
v = await pn(), q = v, c.stage.hidden = !1, c.restore.hidden = !0, S("");
|
|
1392
1395
|
} catch {
|
|
1393
1396
|
v = "", S("Screenshot failed; you can still send text.");
|
|
1394
1397
|
}
|
|
@@ -1397,10 +1400,10 @@ async function he() {
|
|
|
1397
1400
|
function ot() {
|
|
1398
1401
|
h && (F == null || F.stop(), $t(!1), ce(), w = null, g = null, Lt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Z());
|
|
1399
1402
|
}
|
|
1400
|
-
function
|
|
1403
|
+
function ir(t = {}) {
|
|
1401
1404
|
R = { ...R, ...wn(t) }, de();
|
|
1402
1405
|
}
|
|
1403
|
-
async function
|
|
1406
|
+
async function pe() {
|
|
1404
1407
|
if (Mt(), ut)
|
|
1405
1408
|
return null;
|
|
1406
1409
|
const t = c.text.value.trim();
|
|
@@ -1410,7 +1413,7 @@ async function me() {
|
|
|
1410
1413
|
return S("Notefully is missing endpoint or projectKey."), null;
|
|
1411
1414
|
ut = !0, Vt(!0), S("Submitting…", !0);
|
|
1412
1415
|
try {
|
|
1413
|
-
const e =
|
|
1416
|
+
const e = nr(), n = new FormData();
|
|
1414
1417
|
if (n.append("message", t), n.append("kind", Q), n.append("version", f.version || "0.0.0"), n.append("author", e), f.name && n.append("name", f.name), n.append("context", JSON.stringify({
|
|
1415
1418
|
...gn({
|
|
1416
1419
|
...R,
|
|
@@ -1418,17 +1421,20 @@ async function me() {
|
|
|
1418
1421
|
}),
|
|
1419
1422
|
author: e,
|
|
1420
1423
|
console: re.snapshot().slice(-fe(f.consoleLogLimit))
|
|
1421
|
-
})), n.append("annotations", JSON.stringify(
|
|
1422
|
-
const i = await
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1424
|
+
})), n.append("annotations", JSON.stringify(p.list())), n.append("crop", JSON.stringify(p.crop())), Array.isArray(f.targets) && n.append("targets", JSON.stringify(f.targets)), v) {
|
|
1425
|
+
const i = await Fn(v);
|
|
1426
|
+
if (n.append("screenshot", i, "screenshot.png"), p.list().length || p.isCropped()) {
|
|
1427
|
+
const a = await Tn(
|
|
1428
|
+
v,
|
|
1429
|
+
p.crop(),
|
|
1430
|
+
p.list(),
|
|
1431
|
+
{
|
|
1432
|
+
mark: Nt("--nf-mark", "#fdd341"),
|
|
1433
|
+
markText: Nt("--nf-mark-text", "#2a2140")
|
|
1434
|
+
}
|
|
1435
|
+
);
|
|
1436
|
+
n.append("screenshotBaked", a, "screenshot.baked.png");
|
|
1437
|
+
}
|
|
1432
1438
|
}
|
|
1433
1439
|
A && n.append("recording", A, "recording.webm");
|
|
1434
1440
|
const r = await fetch(`${f.endpoint}/v1/reports`, {
|
|
@@ -1454,17 +1460,17 @@ async function me() {
|
|
|
1454
1460
|
function Vt(t) {
|
|
1455
1461
|
c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1456
1462
|
}
|
|
1457
|
-
function
|
|
1463
|
+
function or() {
|
|
1458
1464
|
ot(), h == null || h.remove(), h = null, c = {};
|
|
1459
1465
|
}
|
|
1460
|
-
const
|
|
1461
|
-
typeof window < "u" && (window.Notefully =
|
|
1466
|
+
const me = { init: rr, open: he, close: ot, identify: ir, submit: pe, destroy: or };
|
|
1467
|
+
typeof window < "u" && (window.Notefully = me);
|
|
1462
1468
|
export {
|
|
1463
1469
|
ot as close,
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1470
|
+
me as default,
|
|
1471
|
+
or as destroy,
|
|
1472
|
+
ir as identify,
|
|
1473
|
+
rr as init,
|
|
1468
1474
|
he as open,
|
|
1469
|
-
|
|
1475
|
+
pe as submit
|
|
1470
1476
|
};
|