@makefully/notefully 0.1.0 → 0.1.1
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/README.md +44 -44
- package/dist/notefully.iife.js +8 -7
- package/dist/notefully.js +232 -231
- package/package.json +47 -47
package/README.md
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# Notefully
|
|
2
|
-
|
|
3
|
-
In-app feedback for web apps: screenshot + numbered stickers, dictation, and optional short video.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @makefully/notefully
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Embed
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<link rel="stylesheet" href="node_modules/@makefully/notefully/dist/notefully.css">
|
|
15
|
-
<script type="module">
|
|
16
|
-
import Notefully from '@makefully/notefully';
|
|
17
|
-
|
|
18
|
-
Notefully.init({
|
|
19
|
-
endpoint: 'https://your-relay.example',
|
|
20
|
-
projectKey: 'nfk_…',
|
|
21
|
-
version: '1.4.2',
|
|
22
|
-
theme: 'maker', // maker | all-business | brighter-day | quiet-night
|
|
23
|
-
video: false // default; set true to enable screen recording
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Or via the IIFE build:
|
|
29
|
-
|
|
30
|
-
```html
|
|
31
|
-
<link rel="stylesheet" href="node_modules/@makefully/notefully/dist/notefully.css">
|
|
32
|
-
<script src="node_modules/@makefully/notefully/dist/notefully.iife.js"></script>
|
|
33
|
-
<script>
|
|
34
|
-
Notefully.init({
|
|
35
|
-
endpoint: 'https://your-relay.example',
|
|
36
|
-
projectKey: 'nfk_…',
|
|
37
|
-
version: '1.4.2'
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Hide the default launcher and call `Notefully.open()` / `Notefully.submit()` from your own UI if you prefer.
|
|
43
|
-
|
|
44
|
-
You need a Notefully relay endpoint and project key from your Makefully account. Secrets never go in the widget.
|
|
1
|
+
# Notefully
|
|
2
|
+
|
|
3
|
+
In-app feedback for web apps: screenshot + numbered stickers, dictation, and optional short video.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @makefully/notefully
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Embed
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<link rel="stylesheet" href="node_modules/@makefully/notefully/dist/notefully.css">
|
|
15
|
+
<script type="module">
|
|
16
|
+
import Notefully from '@makefully/notefully';
|
|
17
|
+
|
|
18
|
+
Notefully.init({
|
|
19
|
+
endpoint: 'https://your-relay.example',
|
|
20
|
+
projectKey: 'nfk_…',
|
|
21
|
+
version: '1.4.2',
|
|
22
|
+
theme: 'maker', // maker | all-business | brighter-day | quiet-night
|
|
23
|
+
video: false // default; set true to enable screen recording
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or via the IIFE build:
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<link rel="stylesheet" href="node_modules/@makefully/notefully/dist/notefully.css">
|
|
32
|
+
<script src="node_modules/@makefully/notefully/dist/notefully.iife.js"></script>
|
|
33
|
+
<script>
|
|
34
|
+
Notefully.init({
|
|
35
|
+
endpoint: 'https://your-relay.example',
|
|
36
|
+
projectKey: 'nfk_…',
|
|
37
|
+
version: '1.4.2'
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Hide the default launcher and call `Notefully.open()` / `Notefully.submit()` from your own UI if you prefer.
|
|
43
|
+
|
|
44
|
+
You need a Notefully relay endpoint and project key from your Makefully account. Secrets never go in the widget.
|
package/dist/notefully.iife.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var Notefully=(function(L){"use strict";function ne(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 r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),e&&(n.href=e),i.href=t,i.href}const re=(()=>{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 r=0,n=t.length;r<n;r++)e.push(t[r]);return e}let q=null;function Rt(t={}){return q||(t.includeStyleProperties?(q=t.includeStyleProperties,q):(q=T(window.getComputedStyle(document.documentElement)),q))}function K(t,e){const n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function ie(t){const e=K(t,"border-left-width"),r=K(t,"border-right-width");return t.clientWidth+e+r}function ae(t){const e=K(t,"border-top-width"),r=K(t,"border-bottom-width");return t.clientHeight+e+r}function $t(t,e={}){const r=e.width||ie(t),n=e.height||ae(t);return{width:r,height:n}}function oe(){let t,e;try{e=process}catch{}const r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const M=16384;function se(t){(t.width>M||t.height>M)&&(t.width>M&&t.height>M?t.width>t.height?(t.height*=M/t.width,t.width=M):(t.width*=M/t.height,t.height=M):t.width>M?(t.height*=M/t.width,t.width=M):(t.width*=M/t.height,t.height=M))}function J(t){return new Promise((e,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>e(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function ce(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function le(t,e,r){const n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${e} ${r}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),i.appendChild(a),a.appendChild(t),ce(i)}const E=(t,e)=>{if(t instanceof e)return!0;const r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||E(r,e)};function ue(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function de(t,e){return Rt(e).map(r=>{const n=t.getPropertyValue(r),i=t.getPropertyPriority(r);return`${r}: ${n}${i?" !important":""};`}).join(" ")}function fe(t,e,r,n){const i=`.${t}:${e}`,a=r.cssText?ue(r):de(r,n);return document.createTextNode(`${i}{${a}}`)}function Lt(t,e,r,n){const i=window.getComputedStyle(t,r),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=re();try{e.className=`${e.className} ${o}`}catch{return}const s=document.createElement("style");s.appendChild(fe(o,r,i,n)),e.appendChild(s)}function he(t,e,r){Lt(t,e,":before",r),Lt(t,e,":after",r)}const Pt="application/font-woff",Tt="image/jpeg",me={woff:Pt,woff2:Pt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Tt,jpeg:Tt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function pe(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function at(t){const e=pe(t).toLowerCase();return me[e]||""}function ge(t){return t.split(/,/)[1]}function ot(t){return t.search(/^(data:)/)!==-1}function ye(t,e){return`data:${e};base64,${t}`}async function At(t,e,r){const n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const i=await n.blob();return new Promise((a,o)=>{const s=new FileReader;s.onerror=o,s.onloadend=()=>{try{a(r({res:n,result:s.result}))}catch(l){o(l)}},s.readAsDataURL(i)})}const st={};function we(t,e,r){let n=t.replace(/\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),e?`[${e}]${n}`:n}async function ct(t,e,r){const n=we(t,e,r.includeQueryParams);if(st[n]!=null)return st[n];r.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const a=await At(t,r.fetchRequestInit,({res:o,result:s})=>(e||(e=o.headers.get("Content-Type")||""),ge(s)));i=ye(a,e)}catch(a){i=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return st[n]=i,i}async function be(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):J(e)}async function xe(t,e){if(t.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=t.clientWidth,a.height=t.clientHeight,o==null||o.drawImage(t,0,0,a.width,a.height);const s=a.toDataURL();return J(s)}const r=t.poster,n=at(r),i=await ct(r,n,e);return J(i)}async function ve(t,e){var r;try{if(!((r=t==null?void 0:t.contentDocument)===null||r===void 0)&&r.body)return await N(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Se(t,e){return E(t,HTMLCanvasElement)?be(t):E(t,HTMLVideoElement)?xe(t,e):E(t,HTMLIFrameElement)?ve(t,e):t.cloneNode(kt(t))}const Ee=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",kt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Ce(t,e,r){var n,i;if(kt(e))return e;let a=[];return Ee(t)&&t.assignedNodes?a=T(t.assignedNodes()):E(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?a=T(t.contentDocument.body.childNodes):a=T(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),a.length===0||E(t,HTMLVideoElement)||await a.reduce((o,s)=>o.then(()=>N(s,r)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Me(t,e,r){const n=e.style;if(!n)return;const i=window.getComputedStyle(t);i.cssText?(n.cssText=i.cssText,n.transformOrigin=i.transformOrigin):Rt(r).forEach(a=>{let o=i.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),E(t,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),n.setProperty(a,o,i.getPropertyPriority(a))})}function Re(t,e){E(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),E(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function $e(t,e){if(E(t,HTMLSelectElement)){const n=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function Le(t,e,r){return E(e,Element)&&(Me(t,e,r),he(t,e,r),Re(t,e),$e(t,e)),e}async function Pe(t,e){const r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;const n={};for(let a=0;a<r.length;a++){const s=r[a].getAttribute("xlink:href");if(s){const l=t.querySelector(s),b=document.querySelector(s);!l&&b&&!n[s]&&(n[s]=await N(b,e,!0))}}const i=Object.values(n);if(i.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const s=document.createElementNS(a,"defs");o.appendChild(s);for(let l=0;l<i.length;l++)s.appendChild(i[l]);t.appendChild(o)}return t}async function N(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>Se(n,e)).then(n=>Ce(t,n,e)).then(n=>Le(t,n,e)).then(n=>Pe(n,e))}const It=/url\((['"]?)([^'"]+?)\1\)/g,Te=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ae=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ke(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Ie(t){const e=[];return t.replace(It,(r,n,i)=>(e.push(i),r)),e.filter(r=>!ot(r))}async function De(t,e,r,n,i){try{const a=r?ne(e,r):e,o=at(e);let s;return i||(s=await ct(a,o,n)),t.replace(ke(e),`$1${s}$3`)}catch{}return t}function Fe(t,{preferredFontFormat:e}){return e?t.replace(Ae,r=>{for(;;){const[n,,i]=Te.exec(r)||[];if(!i)return"";if(i===e)return`src: ${n};`}}):t}function Dt(t){return t.search(It)!==-1}async function Ft(t,e,r){if(!Dt(t))return t;const n=Fe(t,r);return Ie(n).reduce((a,o)=>a.then(s=>De(s,o,e,r)),Promise.resolve(n))}async function j(t,e,r){var n;const i=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(i){const a=await Ft(i,null,r);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function He(t,e){await j("background",t,e)||await j("background-image",t,e),await j("mask",t,e)||await j("-webkit-mask",t,e)||await j("mask-image",t,e)||await j("-webkit-mask-image",t,e)}async function Oe(t,e){const r=E(t,HTMLImageElement);if(!(r&&!ot(t.src))&&!(E(t,SVGImageElement)&&!ot(t.href.baseVal)))return;const n=r?t.src:t.href.baseVal,i=await ct(n,at(n),e);await new Promise((a,o)=>{t.onload=a,t.onerror=e.onImageErrorHandler?(...l)=>{try{a(e.onImageErrorHandler(...l))}catch(b){o(b)}}:o;const s=t;s.decode&&(s.decode=a),s.loading==="lazy"&&(s.loading="eager"),r?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Ue(t,e){const n=T(t.childNodes).map(i=>Ht(i,e));await Promise.all(n).then(()=>t)}async function Ht(t,e){E(t,Element)&&(await He(t,e),await Oe(t,e),await Ue(t,e))}function Ve(t,e){const{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);const n=e.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),t}const Ot={};async function Ut(t){let e=Ot[t];if(e!=null)return e;const n=await(await fetch(t)).text();return e={url:t,cssText:n},Ot[t]=e,e}async function Vt(t,e){let r=t.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,a=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let s=o.replace(n,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),At(s,e.fetchRequestInit,({result:l})=>(r=r.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>r)}function Bt(t){if(t==null)return[];const e=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=t.replace(r,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(n);if(l===null)break;e.push(l[0])}n=n.replace(i,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(o,"gi");for(;;){let l=a.exec(n);if(l===null){if(l=s.exec(n),l===null)break;a.lastIndex=s.lastIndex}else s.lastIndex=a.lastIndex;e.push(l[0])}return e}async function Be(t,e){const r=[],n=[];return t.forEach(i=>{if("cssRules"in i)try{T(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let s=o+1;const l=a.href,b=Ut(l).then(p=>Vt(p,e)).then(p=>Bt(p).forEach(h=>{try{i.insertRule(h,h.startsWith("@import")?s+=1:i.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:h,error:w})}})).catch(p=>{console.error("Error loading remote css",p.toString())});n.push(b)}})}catch(a){const o=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&n.push(Ut(i.href).then(s=>Vt(s,e)).then(s=>Bt(s).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",a)}}),Promise.all(n).then(()=>(t.forEach(i=>{if("cssRules"in i)try{T(i.cssRules||[]).forEach(a=>{r.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),r))}function _e(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Dt(e.style.getPropertyValue("src")))}async function We(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=T(t.ownerDocument.styleSheets),n=await Be(r,e);return _e(n)}function _t(t){return t.trim().replace(/["']/g,"")}function qe(t){const e=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(a=>{e.add(_t(a))}),Array.from(n.children).forEach(a=>{a instanceof HTMLElement&&r(a)})}return r(t),e}async function je(t,e){const r=await We(t,e),n=qe(t);return(await Promise.all(r.filter(a=>n.has(_t(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return Ft(a.cssText,o,e)}))).join(`
|
|
2
|
-
`)}async function
|
|
1
|
+
var Notefully=(function(L){"use strict";function ne(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 r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),e&&(n.href=e),i.href=t,i.href}const re=(()=>{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 r=0,n=t.length;r<n;r++)e.push(t[r]);return e}let q=null;function $t(t={}){return q||(t.includeStyleProperties?(q=t.includeStyleProperties,q):(q=T(window.getComputedStyle(document.documentElement)),q))}function K(t,e){const n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function ie(t){const e=K(t,"border-left-width"),r=K(t,"border-right-width");return t.clientWidth+e+r}function ae(t){const e=K(t,"border-top-width"),r=K(t,"border-bottom-width");return t.clientHeight+e+r}function Rt(t,e={}){const r=e.width||ie(t),n=e.height||ae(t);return{width:r,height:n}}function oe(){let t,e;try{e=process}catch{}const r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const M=16384;function se(t){(t.width>M||t.height>M)&&(t.width>M&&t.height>M?t.width>t.height?(t.height*=M/t.width,t.width=M):(t.width*=M/t.height,t.height=M):t.width>M?(t.height*=M/t.width,t.width=M):(t.width*=M/t.height,t.height=M))}function J(t){return new Promise((e,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>e(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function ce(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function le(t,e,r){const n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${e} ${r}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),i.appendChild(a),a.appendChild(t),ce(i)}const E=(t,e)=>{if(t instanceof e)return!0;const r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||E(r,e)};function ue(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function de(t,e){return $t(e).map(r=>{const n=t.getPropertyValue(r),i=t.getPropertyPriority(r);return`${r}: ${n}${i?" !important":""};`}).join(" ")}function fe(t,e,r,n){const i=`.${t}:${e}`,a=r.cssText?ue(r):de(r,n);return document.createTextNode(`${i}{${a}}`)}function Lt(t,e,r,n){const i=window.getComputedStyle(t,r),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=re();try{e.className=`${e.className} ${o}`}catch{return}const s=document.createElement("style");s.appendChild(fe(o,r,i,n)),e.appendChild(s)}function he(t,e,r){Lt(t,e,":before",r),Lt(t,e,":after",r)}const Pt="application/font-woff",Tt="image/jpeg",me={woff:Pt,woff2:Pt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Tt,jpeg:Tt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function pe(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function at(t){const e=pe(t).toLowerCase();return me[e]||""}function ge(t){return t.split(/,/)[1]}function ot(t){return t.search(/^(data:)/)!==-1}function ye(t,e){return`data:${e};base64,${t}`}async function At(t,e,r){const n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const i=await n.blob();return new Promise((a,o)=>{const s=new FileReader;s.onerror=o,s.onloadend=()=>{try{a(r({res:n,result:s.result}))}catch(l){o(l)}},s.readAsDataURL(i)})}const st={};function we(t,e,r){let n=t.replace(/\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),e?`[${e}]${n}`:n}async function ct(t,e,r){const n=we(t,e,r.includeQueryParams);if(st[n]!=null)return st[n];r.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const a=await At(t,r.fetchRequestInit,({res:o,result:s})=>(e||(e=o.headers.get("Content-Type")||""),ge(s)));i=ye(a,e)}catch(a){i=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return st[n]=i,i}async function be(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):J(e)}async function ve(t,e){if(t.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=t.clientWidth,a.height=t.clientHeight,o==null||o.drawImage(t,0,0,a.width,a.height);const s=a.toDataURL();return J(s)}const r=t.poster,n=at(r),i=await ct(r,n,e);return J(i)}async function xe(t,e){var r;try{if(!((r=t==null?void 0:t.contentDocument)===null||r===void 0)&&r.body)return await N(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Se(t,e){return E(t,HTMLCanvasElement)?be(t):E(t,HTMLVideoElement)?ve(t,e):E(t,HTMLIFrameElement)?xe(t,e):t.cloneNode(kt(t))}const Ee=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",kt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Ce(t,e,r){var n,i;if(kt(e))return e;let a=[];return Ee(t)&&t.assignedNodes?a=T(t.assignedNodes()):E(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?a=T(t.contentDocument.body.childNodes):a=T(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),a.length===0||E(t,HTMLVideoElement)||await a.reduce((o,s)=>o.then(()=>N(s,r)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Me(t,e,r){const n=e.style;if(!n)return;const i=window.getComputedStyle(t);i.cssText?(n.cssText=i.cssText,n.transformOrigin=i.transformOrigin):$t(r).forEach(a=>{let o=i.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),E(t,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),n.setProperty(a,o,i.getPropertyPriority(a))})}function $e(t,e){E(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),E(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Re(t,e){if(E(t,HTMLSelectElement)){const n=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function Le(t,e,r){return E(e,Element)&&(Me(t,e,r),he(t,e,r),$e(t,e),Re(t,e)),e}async function Pe(t,e){const r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;const n={};for(let a=0;a<r.length;a++){const s=r[a].getAttribute("xlink:href");if(s){const l=t.querySelector(s),b=document.querySelector(s);!l&&b&&!n[s]&&(n[s]=await N(b,e,!0))}}const i=Object.values(n);if(i.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const s=document.createElementNS(a,"defs");o.appendChild(s);for(let l=0;l<i.length;l++)s.appendChild(i[l]);t.appendChild(o)}return t}async function N(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>Se(n,e)).then(n=>Ce(t,n,e)).then(n=>Le(t,n,e)).then(n=>Pe(n,e))}const It=/url\((['"]?)([^'"]+?)\1\)/g,Te=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ae=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ke(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Ie(t){const e=[];return t.replace(It,(r,n,i)=>(e.push(i),r)),e.filter(r=>!ot(r))}async function De(t,e,r,n,i){try{const a=r?ne(e,r):e,o=at(e);let s;return i||(s=await ct(a,o,n)),t.replace(ke(e),`$1${s}$3`)}catch{}return t}function Fe(t,{preferredFontFormat:e}){return e?t.replace(Ae,r=>{for(;;){const[n,,i]=Te.exec(r)||[];if(!i)return"";if(i===e)return`src: ${n};`}}):t}function Dt(t){return t.search(It)!==-1}async function Ft(t,e,r){if(!Dt(t))return t;const n=Fe(t,r);return Ie(n).reduce((a,o)=>a.then(s=>De(s,o,e,r)),Promise.resolve(n))}async function j(t,e,r){var n;const i=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(i){const a=await Ft(i,null,r);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function He(t,e){await j("background",t,e)||await j("background-image",t,e),await j("mask",t,e)||await j("-webkit-mask",t,e)||await j("mask-image",t,e)||await j("-webkit-mask-image",t,e)}async function Oe(t,e){const r=E(t,HTMLImageElement);if(!(r&&!ot(t.src))&&!(E(t,SVGImageElement)&&!ot(t.href.baseVal)))return;const n=r?t.src:t.href.baseVal,i=await ct(n,at(n),e);await new Promise((a,o)=>{t.onload=a,t.onerror=e.onImageErrorHandler?(...l)=>{try{a(e.onImageErrorHandler(...l))}catch(b){o(b)}}:o;const s=t;s.decode&&(s.decode=a),s.loading==="lazy"&&(s.loading="eager"),r?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Ue(t,e){const n=T(t.childNodes).map(i=>Ht(i,e));await Promise.all(n).then(()=>t)}async function Ht(t,e){E(t,Element)&&(await He(t,e),await Oe(t,e),await Ue(t,e))}function Ve(t,e){const{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);const n=e.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),t}const Ot={};async function Ut(t){let e=Ot[t];if(e!=null)return e;const n=await(await fetch(t)).text();return e={url:t,cssText:n},Ot[t]=e,e}async function Vt(t,e){let r=t.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,a=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let s=o.replace(n,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),At(s,e.fetchRequestInit,({result:l})=>(r=r.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>r)}function Bt(t){if(t==null)return[];const e=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=t.replace(r,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(n);if(l===null)break;e.push(l[0])}n=n.replace(i,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(o,"gi");for(;;){let l=a.exec(n);if(l===null){if(l=s.exec(n),l===null)break;a.lastIndex=s.lastIndex}else s.lastIndex=a.lastIndex;e.push(l[0])}return e}async function Be(t,e){const r=[],n=[];return t.forEach(i=>{if("cssRules"in i)try{T(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let s=o+1;const l=a.href,b=Ut(l).then(p=>Vt(p,e)).then(p=>Bt(p).forEach(h=>{try{i.insertRule(h,h.startsWith("@import")?s+=1:i.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:h,error:w})}})).catch(p=>{console.error("Error loading remote css",p.toString())});n.push(b)}})}catch(a){const o=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&n.push(Ut(i.href).then(s=>Vt(s,e)).then(s=>Bt(s).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",a)}}),Promise.all(n).then(()=>(t.forEach(i=>{if("cssRules"in i)try{T(i.cssRules||[]).forEach(a=>{r.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),r))}function _e(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Dt(e.style.getPropertyValue("src")))}async function We(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=T(t.ownerDocument.styleSheets),n=await Be(r,e);return _e(n)}function _t(t){return t.trim().replace(/["']/g,"")}function qe(t){const e=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(a=>{e.add(_t(a))}),Array.from(n.children).forEach(a=>{a instanceof HTMLElement&&r(a)})}return r(t),e}async function je(t,e){const r=await We(t,e),n=qe(t);return(await Promise.all(r.filter(a=>n.has(_t(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return Ft(a.cssText,o,e)}))).join(`
|
|
2
|
+
`)}async function ze(t,e){const r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await je(t,e);if(r){const n=document.createElement("style"),i=document.createTextNode(r);n.appendChild(i),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function Xe(t,e={}){const{width:r,height:n}=Rt(t,e),i=await N(t,e,!0);return await ze(i,e),await Ht(i,e),Ve(i,e),await le(i,r,n)}async function Ge(t,e={}){const{width:r,height:n}=Rt(t,e),i=await Xe(t,e),a=await J(i),o=document.createElement("canvas"),s=o.getContext("2d"),l=e.pixelRatio||oe(),b=e.canvasWidth||r,p=e.canvasHeight||n;return o.width=b*l,o.height=p*l,e.skipAutoScale||se(o),o.style.width=`${b}`,o.style.height=`${p}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,o.width,o.height)),s.drawImage(a,0,0,o.width,o.height),o}async function Ye(t,e={}){return(await Ge(t,e)).toDataURL()}function Ke(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(r=>{const n=r.getBoundingClientRect(),i=document.createElement("div");i.setAttribute("data-nf-mask-cover","1"),i.style.cssText=["position:fixed",`left:${n.left}px`,`top:${n.top}px`,`width:${Math.max(n.width,4)}px`,`height:${Math.max(n.height,4)}px`,"background:#111","z-index:2147483646","pointer-events:none"].join(";"),document.body.appendChild(i),t.push(i)}),()=>t.forEach(r=>r.remove())}async function Je(){const t=document.getElementById("notefully"),e=t?t.style.display:"";t&&(t.style.display="none");const r=Ke();await new Promise(n=>requestAnimationFrame(()=>requestAnimationFrame(n)));try{return await Ye(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:n=>n instanceof Element?n.id!=="notefully"&&!n.hasAttribute("data-nf-mask-cover"):!0})}finally{r(),t&&(t.style.display=e)}}function Ne(t={}){return{url:location.href,title:document.title,userAgent:navigator.userAgent,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 Ze=80;function Qe(){const t=[],e={};let r=!1;const n=(a,o)=>{let s="";try{s=o.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{s=String(o[0])}t.push({level:a,text:s.slice(0,2e3),at:Date.now()}),t.length>Ze&&t.shift()};return{hook:()=>{r||typeof window>"u"||(r=!0,["log","info","warn","error"].forEach(a=>{e[a]=console[a].bind(console),console[a]=(...o)=>{n(a,o),e[a](...o)}}),window.addEventListener("error",a=>{n("error",[a.message||"window.error"])}),window.addEventListener("unhandledrejection",a=>{n("error",[a.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function tn(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let r=null,n=!1;const i=()=>{if(n=!1,r)try{r.stop()}catch{}};return{start:()=>{if(!e)throw new Error("Speech recognition is not supported in this browser.");return n?(i(),!1):(r=new e,r.continuous=!0,r.interimResults=!0,r.lang=navigator.language||"en-US",r.onresult=o=>{let s="";for(let l=o.resultIndex;l<o.results.length;l+=1)o.results[l].isFinal&&(s+=o.results[l][0].transcript);s&&t(s)},r.onerror=()=>{n=!1},r.onend=()=>{n=!1},r.start(),n=!0,!0)},stop:i,isSupported:()=>!!e,isActive:()=>n}}const en=60*1e3;function nn({onStart:t,onStop:e,onError:r}){let n=null,i=null,a=[],o=null;const s=()=>{if(o&&(clearTimeout(o),o=null),i&&i.state!=="inactive")try{i.stop()}catch{}n&&(n.getTracks().forEach(p=>p.stop()),n=null)},l=()=>{if(i&&i.state==="recording"){i.stop();return}s(),e(null)};return{start:async()=>{var p,h;if(!((p=navigator.mediaDevices)!=null&&p.getDisplayMedia))throw new Error("Screen recording is not supported in this browser.");n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"}),a=[],i=new MediaRecorder(n,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),i.ondataavailable=w=>{w.data&&w.data.size&&a.push(w.data)},i.onstop=()=>{const w=a.length?new Blob(a,{type:i.mimeType||"video/webm"}):null;s(),e(w)},(h=n.getVideoTracks()[0])==null||h.addEventListener("ended",()=>l()),i.start(),o=setTimeout(l,en)},stop:l}}function rn(){const t=new Set;return{alloc(){let e=1;for(;t.has(e);)e+=1;return t.add(e),e},free(e){const r=Number(e);Number.isInteger(r)&&r>0&&t.delete(r)},peekUsed(){return[...t].sort((e,r)=>e-r)}}}const lt={x:0,y:0,w:1,h:1};function Wt(){const t=rn();let e=[],r={...lt},n=1;return{list:()=>e.filter(a=>on(a,r)),all:()=>e.slice(),crop:()=>({...r}),setCrop(a){return r=an(a),r},resetCrop(){return r={...lt},r},isCropped(){return r.x>1e-6||r.y>1e-6||r.w<.999999||r.h<.999999},add(a,o){const s={id:`s${n++}`,type:a,number:t.alloc(),x:.2,y:.2,w:a==="arrow"?.2:.22,h:a==="arrow"?.05:.16,x2:.4,y2:.28,...o};return e.push(s),s},update(a,o){const s=e.find(l=>l.id===a);return s?(Object.assign(s,o),s):null},remove(a){const o=e.findIndex(l=>l.id===a);if(o<0)return null;const[s]=e.splice(o,1);return t.free(s.number),s},reset(){for(e=[],r={...lt},n=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function an(t){const e=Math.min(Math.max(t.x,0),.95),r=Math.min(Math.max(t.y,0),.95),n=Math.min(Math.max(t.w,.05),1-e),i=Math.min(Math.max(t.h,.05),1-r);return{x:e,y:r,w:n,h:i}}function on(t,e){const r=t.type==="arrow"?(t.x+(t.x2??t.x))/2:t.x+(t.w||0)/2,n=t.type==="arrow"?(t.y+(t.y2??t.y))/2:t.y+(t.h||0)/2;return r>=e.x&&n>=e.y&&r<=e.x+e.w&&n<=e.y+e.h}function sn(t,e,r,n={}){const i=n.mark||"#fdd341",a=n.markText||"#2a2140";return new Promise((o,s)=>{const l=new Image;l.onload=()=>{const b=Math.round(e.x*l.width),p=Math.round(e.y*l.height),h=Math.max(1,Math.round(e.w*l.width)),w=Math.max(1,Math.round(e.h*l.height)),F=document.createElement("canvas");F.width=h,F.height=w;const f=F.getContext("2d");f.drawImage(l,b,p,h,w,0,0,h,w),f.lineWidth=Math.max(3,Math.round(h/400)),f.strokeStyle=i,f.fillStyle=i,f.font=`700 ${Math.max(14,Math.round(h/40))}px sans-serif`,r.forEach(m=>{const H=ut(m.x,e,h),O=dt(m.y,e,w),U=m.w/e.w*h,_=m.h/e.h*w;if(m.type==="rect")f.strokeRect(H,O,U,_);else if(m.type==="circle")f.beginPath(),f.ellipse(H+U/2,O+_/2,U/2,_/2,0,0,Math.PI*2),f.stroke();else if(m.type==="arrow"){const Pn=ut(m.x2??m.x+m.w,e,h),Tn=dt(m.y2??m.y,e,w);ln(f,H,O,Pn,Tn)}const W=cn(m,e,h,w,H,O,U),V=String(m.number);f.beginPath(),f.arc(W.x,W.y,11,0,Math.PI*2),f.fill(),f.fillStyle=a,f.textAlign="center",f.textBaseline="middle",f.fillText(V,W.x,W.y),f.fillStyle=i}),F.toBlob(m=>{if(!m){s(new Error("Could not encode screenshot"));return}o(m)},"image/png")},l.onerror=()=>s(new Error("Could not load screenshot")),l.src=t})}function ut(t,e,r){return(t-e.x)/e.w*r}function dt(t,e,r){return(t-e.y)/e.h*r}function cn(t,e,r,n,i,a,o){if(t.type==="arrow"){const s=ut(t.x2??t.x+t.w,e,r),l=dt(t.y2??t.y,e,n);return{x:(i+s)/2,y:(a+l)/2}}return{x:i+o/2,y:a}}function ln(t,e,r,n,i){const a=Math.atan2(i-r,n-e),o=14,s=2,l=n-Math.cos(a)*s,b=i-Math.sin(a)*s;t.beginPath(),t.moveTo(e,r),t.lineTo(l,b),t.stroke(),t.beginPath(),t.moveTo(n,i),t.lineTo(n-o*Math.cos(a-.4),i-o*Math.sin(a-.4)),t.lineTo(n-o*Math.cos(a+.4),i-o*Math.sin(a+.4)),t.closePath(),t.fill()}const un=["bug","idea","other"],dn=["maker","all-business","brighter-day","quiet-night"],qt="maker",fn=new Set(["crop","arrow","rect","circle"]),ft=.02,jt=.05,hn=`
|
|
3
3
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
4
|
-
<path fill="currentColor" d="
|
|
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
|
+
<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"/>
|
|
5
6
|
</svg>
|
|
6
|
-
`;function A(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 k={crop:A('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:A('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:A('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:A('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:A('<circle cx="12" cy="12" r="8"/>'),discard:A('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:A('<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:A('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},
|
|
7
|
-
<button class="nf-launcher" type="button" title="
|
|
7
|
+
`;function A(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 k={crop:A('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:A('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:A('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:A('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:A('<circle cx="12" cy="12" r="8"/>'),discard:A('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:A('<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:A('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},zt=Qe();zt.hook();let v={endpoint:"",projectKey:"",version:"0.0.0",targets:null,hideLauncher:!1,theme:qt,video:!1},ht={},u=null,c={},d=Wt(),x="",z="",P=null,Z="bug",I=null,R=null,g=null,y=null,Q=null,B=null,X=null,D={w:0,h:0};function C(t){return u.querySelector(t)}function Xt(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return dn.includes(e)?e:qt}function Gt(t,e){return u&&getComputedStyle(u).getPropertyValue(t).trim()||e}function S(t,e=!1){c.status&&(c.status.textContent=t||"",Q&&(clearTimeout(Q),Q=null),t&&!e&&(Q=setTimeout(()=>{c.status.textContent=""},4e3)))}function mt(){return u&&document.body.contains(u)||(u=document.createElement("div"),u.id="notefully",u.innerHTML=`
|
|
8
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${hn}</button>
|
|
8
9
|
<div class="nf-dialog" hidden>
|
|
9
10
|
<div class="nf-panel">
|
|
10
11
|
<div class="nf-stage">
|
|
@@ -34,7 +35,7 @@ var Notefully=(function(L){"use strict";function ne(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
34
35
|
</div>
|
|
35
36
|
</div>
|
|
36
37
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
37
|
-
`,document.body.appendChild(u),c={launcher:C(".nf-launcher"),dialog:C(".nf-dialog"),stage:C(".nf-stage"),canvas:C(".nf-canvas"),text:C(".nf-text"),restore:C(".nf-restore"),status:C(".nf-status"),audio:C(".nf-audio"),video:C(".nf-video"),discard:C(".nf-discard-shot"),stop:C(".nf-stop-video"),resetCrop:C(".nf-reset-crop"),shot:null},mn(),tt()),u}function tt(){u&&(u.dataset.theme=
|
|
38
|
+
`,document.body.appendChild(u),c={launcher:C(".nf-launcher"),dialog:C(".nf-dialog"),stage:C(".nf-stage"),canvas:C(".nf-canvas"),text:C(".nf-text"),restore:C(".nf-restore"),status:C(".nf-status"),audio:C(".nf-audio"),video:C(".nf-video"),discard:C(".nf-discard-shot"),stop:C(".nf-stop-video"),resetCrop:C(".nf-reset-crop"),shot:null},mn(),tt()),u}function tt(){u&&(u.dataset.theme=Xt(v.theme),v.hideLauncher?u.setAttribute("data-nf-hidden-launcher",""):u.removeAttribute("data-nf-hidden-launcher"),c.video&&(c.video.hidden=!v.video))}function mn(){c.launcher.addEventListener("click",()=>Et()),C(".nf-dialog").addEventListener("click",t=>{t.target===c.dialog&&Y()}),u.querySelectorAll(".nf-tool").forEach(t=>{t.addEventListener("click",()=>gt(t.dataset.tool))}),c.resetCrop.addEventListener("click",xn),c.canvas.addEventListener("pointerdown",gn),c.canvas.addEventListener("dragstart",t=>t.preventDefault()),u.querySelectorAll("[data-kind]").forEach(t=>{t.addEventListener("click",()=>pt(t.dataset.kind))}),c.discard.addEventListener("click",Sn),c.restore.addEventListener("click",En),c.audio.addEventListener("click",Cn),c.video.addEventListener("click",Mn),c.stop.addEventListener("click",()=>X==null?void 0:X.stop()),C(".nf-submit").addEventListener("click",()=>{Ct().catch(t=>S(t.message||"Submit failed."))}),pt("bug"),gt(null)}function pt(t){Z=un.includes(t)?t:"bug",u.querySelectorAll("[data-kind]").forEach(e=>{e.dataset.active=String(e.dataset.kind===Z)})}function gt(t){I=fn.has(t)?t:null,R=null,u.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===I)}),c.canvas&&(c.canvas.dataset.draw=I?"true":"false"),x&&$()}function Yt(t){return Math.min(1,Math.max(0,t))}function et(){return c.shot||c.canvas}function nt(t){const e=et().getBoundingClientRect();return{x:Yt((t.clientX-e.left)/Math.max(e.width,1)),y:Yt((t.clientY-e.top)/Math.max(e.height,1))}}function pn(t){const e=et().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function Kt(t){const e=nt(t),r=d.crop();return{x:r.x+e.x*r.w,y:r.y+e.y*r.h}}function rt(t,e){const r=Math.min(t.x,e.x),n=Math.min(t.y,e.y);return{x:r,y:n,w:Math.max(ft,Math.abs(e.x-t.x)),h:Math.max(ft,Math.abs(e.y-t.y))}}function yt(t){u&&(t?u.dataset.grabbing="true":delete u.dataset.grabbing)}function wt(t){try{c.canvas.setPointerCapture(t.pointerId)}catch{}}function bt(){window.addEventListener("pointermove",Nt),window.addEventListener("pointerup",it),window.addEventListener("pointercancel",it)}function Jt(){window.removeEventListener("pointermove",Nt),window.removeEventListener("pointerup",it),window.removeEventListener("pointercancel",it)}function gn(t){if(t.button!==0||!x)return;if(!t.target.closest(".nf-sticker")&&!pn(t)){R=null,$();return}const e=t.target.closest(".nf-handle"),r=t.target.closest(".nf-sticker");if(r&&r.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),R=r.dataset.id,wt(t),yn({kind:"sticker",id:R,dir:(e==null?void 0:e.dataset.dir)||"move"},t),$();return}if(R=null,I==="crop"){t.preventDefault(),wt(t),g={kind:"crop",start:nt(t),current:nt(t)},bt(),$();return}if(I==="arrow"||I==="rect"||I==="circle"){t.preventDefault(),wt(t);const n=Kt(t);g={kind:"sticker",type:I,start:n,current:n},bt(),$();return}$()}function yn(t,e){e.preventDefault(),e.stopPropagation();const r=et().getBoundingClientRect(),n=d.list().find(i=>i.id===t.id);y={...t,startX:e.clientX,startY:e.clientY,crop:d.crop(),sticker:n?{...n}:null,rect:r},yt(t.dir==="move"||t.dir==="start"||t.dir==="end"),bt()}function Nt(t){if(g){g.current=g.kind==="crop"?nt(t):Kt(t),$();return}if(!y)return;const e=(t.clientX-y.startX)/y.rect.width*y.crop.w,r=(t.clientY-y.startY)/y.rect.height*y.crop.h,n=y.sticker;if(n){if(y.dir==="end")d.update(n.id,{x2:n.x2+e,y2:n.y2+r});else if(y.dir==="start")d.update(n.id,{x:n.x+e,y:n.y+r});else if(y.dir==="move")d.update(n.id,{x:n.x+e,y:n.y+r,x2:(n.x2||n.x)+e,y2:(n.y2||n.y)+r});else{const i={x:n.x,y:n.y,w:n.w,h:n.h};wn(i,y.dir,e,r),d.update(n.id,i)}$()}}function wn(t,e,r,n){if(e.includes("e")&&(t.w=Math.max(.04,t.w+r)),e.includes("s")&&(t.h=Math.max(.04,t.h+n)),e.includes("w")){const i=Math.max(.04,t.w-r);t.x+=t.w-i,t.w=i}if(e.includes("n")){const i=Math.max(.04,t.h-n);t.y+=t.h-i,t.h=i}}function it(t){if(Jt(),yt(!1),g){bn();return}if(y){if(y.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)&&(d.remove(y.id),R=null)}y=null,$()}}function bn(){const t=g;if(g=null,!t)return;if(t.kind==="crop"){const r=rt(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<jt||Math.abs(t.current.y-t.start.y)<jt){$();return}const i=d.crop();d.setCrop({x:i.x+r.x*i.w,y:i.y+r.y*i.h,w:r.w*i.w,h:r.h*i.h}),G();return}const e=vn(t);e&&(R=e.id),$()}function vn(t){if(t.type==="arrow"){const e=t.current.x-t.start.x,r=t.current.y-t.start.y;return Math.hypot(e,r)<ft?d.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):d.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(r)})}return d.add(t.type,rt(t.start,t.current))}function xn(){d.resetCrop(),R=null,G()}function vt(){c.resetCrop&&(c.resetCrop.hidden=!d.isCropped())}function xt(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 Sn(){x&&(z=x),x="",c.stage.hidden=!0,c.restore.hidden=!z}function En(){z&&(x=z,c.stage.hidden=!1,c.restore.hidden=!0,G())}function Cn(){try{if(B||(B=tn(e=>{const r=c.text.value.trim();c.text.value=r?`${r} ${e}`:e})),!B.isSupported()){S("Audio-to-text is not supported in this browser.");return}const t=B.start();xt(t),S(t?"Listening…":"")}catch(t){S(t.message)}}async function Mn(){if(!v.video){S("Video is disabled on this host.");return}c.dialog.hidden=!0,c.stop.hidden=!1,tt(),c.launcher.hidden=!0,X=nn({onStart(){},onStop(t){P=t,c.stop.hidden=!0,c.launcher.hidden=!1,c.dialog.hidden=!1,G(),S(t?"Video attached.":"Recording cancelled.")},onError(t){S(t.message)}});try{await X.start()}catch(t){c.stop.hidden=!0,c.launcher.hidden=!1,c.dialog.hidden=!1,S(t.message)}}function G(){if(c.shot=null,!x){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>`:"",vt();return}c.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${x}" draggable="false"></div>`,c.shot=c.canvas.querySelector(".nf-shot");const t=c.shot.querySelector("img");t.draggable=!1,t.addEventListener("dragstart",r=>r.preventDefault());const e=()=>{$n(t),$()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e()}function $n(t){const e=t.naturalWidth||D.w,r=t.naturalHeight||D.h;if(e&&r&&(D={w:e,h:r},c.canvas.style.setProperty("--nf-shot-aspect",String(e/r)),c.canvas.style.aspectRatio=`${e} / ${r}`),!c.shot||!D.w||!D.h)return;const n=d.crop(),i=D.w/D.h,a=n.w/n.h*i,o=Math.min(1,a/i),s=Math.min(1,i/a);c.shot.style.left=`${(1-o)/2*100}%`,c.shot.style.top=`${(1-s)/2*100}%`,c.shot.style.width=`${o*100}%`,c.shot.style.height=`${s*100}%`,t.style.width=`${100/n.w}%`,t.style.height=`${100/n.h}%`,t.style.left=`${-n.x/n.w*100}%`,t.style.top=`${-n.y/n.h*100}%`}function Rn(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:"",...rt(t.start,t.current)}}function $(){if((c.shot||c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(n=>n.remove()),!x||!c.shot){vt();return}const e=d.crop();if((g==null?void 0:g.kind)==="crop"){const n=document.createElement("div");n.className="nf-crop",Zt(n,rt(g.start,g.current),{x:0,y:0,w:1,h:1}),c.shot.appendChild(n)}const r=d.list().slice();if((g==null?void 0:g.kind)==="sticker"&&r.push(Rn(g)),r.forEach(n=>{const i=n.id==="preview",a=!i&&n.id===R,o=document.createElement("div");if(o.className=`nf-sticker nf-${n.type}`,o.dataset.id=n.id,a&&(o.dataset.selected="true"),i&&(o.dataset.preview="true"),n.type==="arrow"?Ln(o,n,e,a):(Zt(o,n,e),a&&["nw","ne","sw","se"].forEach(s=>St(o,s))),!i&&n.number){const s=document.createElement("span");s.className="nf-badge",s.textContent=String(n.number),o.appendChild(s)}c.shot.appendChild(o)}),c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(n=>n.remove()),P){const n=document.createElement("video");n.className="nf-recording-preview",n.controls=!0,n.src=URL.createObjectURL(P),n.style.position="absolute",n.style.right="8px",n.style.bottom="8px",n.style.width="160px",c.canvas.appendChild(n)}vt()}function Ln(t,e,r,n){const i=et(),a=i.clientWidth,o=i.clientHeight,s=(e.x-r.x)/r.w*a,l=(e.y-r.y)/r.h*o,b=((e.x2??e.x+e.w)-r.x)/r.w*a,p=((e.y2??e.y)-r.y)/r.h*o,h=18,w=Math.min(s,b)-h,F=Math.min(l,p)-h,f=Math.max(2,Math.abs(b-s))+h*2,m=Math.max(2,Math.abs(p-l))+h*2,H=s-w,O=l-F,U=b-w,_=p-F,W=`nf-ah-${e.id}`,V=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${w}px`,t.style.top=`${F}px`,t.style.width=`${f}px`,t.style.height=`${m}px`,V.setAttribute("class","nf-arrow-svg"),V.setAttribute("viewBox",`0 0 ${f} ${m}`),V.setAttribute("width",String(f)),V.setAttribute("height",String(m)),V.innerHTML=`
|
|
38
39
|
<defs>
|
|
39
40
|
<marker id="${W}" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
|
|
40
41
|
<path d="M0,0 L10,5 L0,10 Z" fill="currentColor" />
|
|
@@ -42,4 +43,4 @@ var Notefully=(function(L){"use strict";function ne(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
42
43
|
</defs>
|
|
43
44
|
<line class="nf-arrow-hit" x1="${H}" y1="${O}" x2="${U}" y2="${_}" />
|
|
44
45
|
<line class="nf-arrow-shaft" x1="${H}" y1="${O}" x2="${U}" y2="${_}" marker-end="url(#${W})" />
|
|
45
|
-
`,t.appendChild(V),n&&(St(t,"start",{left:H-5,top:O-5}),St(t,"end",{left:U-5,top:_-5}))}function St(t,e,r){const n=document.createElement("span");n.className="nf-handle",n.dataset.dir=e,r&&(n.style.left=`${r.left}px`,n.style.top=`${r.top}px`),t.appendChild(n)}function Zt(t,e,r){t.style.left=`${(e.x-r.x)/r.w*100}%`,t.style.top=`${(e.y-r.y)/r.h*100}%`,t.style.width=`${e.w/r.w*100}%`,t.style.height=`${e.h/r.h*100}%`}function Qt(t={}){return
|
|
46
|
+
`,t.appendChild(V),n&&(St(t,"start",{left:H-5,top:O-5}),St(t,"end",{left:U-5,top:_-5}))}function St(t,e,r){const n=document.createElement("span");n.className="nf-handle",n.dataset.dir=e,r&&(n.style.left=`${r.left}px`,n.style.top=`${r.top}px`),t.appendChild(n)}function Zt(t,e,r){t.style.left=`${(e.x-r.x)/r.w*100}%`,t.style.top=`${(e.y-r.y)/r.h*100}%`,t.style.width=`${e.w/r.w*100}%`,t.style.height=`${e.h/r.h*100}%`}function Qt(t={}){return v={...v,...t,endpoint:String(t.endpoint||v.endpoint||"").replace(/\/$/,""),theme:Xt(t.theme??v.theme),video:t.video==null?v.video:!!t.video},mt(),tt(),Mt}async function Et(){mt(),tt(),c.launcher.hidden=!0,d=Wt(),D={w:0,h:0},P=null,R=null,g=null,y=null,Z="bug",pt("bug"),gt(null),xt(!1),c.text.value="",S("Capturing…");try{x=await Je(),z=x,c.stage.hidden=!1,c.restore.hidden=!0}catch{x="",S("Screenshot failed; you can still send text.")}c.dialog.hidden=!1,G(),c.text.focus()}function Y(){u&&(B==null||B.stop(),xt(!1),Jt(),g=null,y=null,yt(!1),c.dialog.hidden=!0,c.stop.hidden=!0,c.launcher.hidden=!1)}function te(t={}){ht={...ht,...t}}async function Ct(){mt();const t=c.text.value.trim();if(!t&&!x&&!P)return S("Add a note, screenshot, or video first."),null;if(!v.endpoint||!v.projectKey)return S("Notefully is missing endpoint or projectKey."),null;S("Submitting…",!0);const e=new FormData;if(e.append("message",t),e.append("kind",Z),e.append("version",v.version||"0.0.0"),e.append("context",JSON.stringify({...Ne(ht),console:zt.snapshot()})),e.append("annotations",JSON.stringify(d.list())),Array.isArray(v.targets)&&e.append("targets",JSON.stringify(v.targets)),x){const i=await sn(x,d.crop(),d.list(),{mark:Gt("--nf-mark","#fdd341"),markText:Gt("--nf-mark-text","#2a2140")});e.append("screenshot",i,"screenshot.png")}P&&e.append("recording",P,"recording.webm");const r=await fetch(`${v.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":v.projectKey},body:e});let n=null;try{n=await r.json()}catch{n=null}if(!r.ok)throw S((n==null?void 0:n.error)||"Submit failed."),new Error((n==null?void 0:n.error)||`Submit failed (${r.status})`);return S("Sent. Thank you."),Y(),n}function ee(){Y(),u==null||u.remove(),u=null,c={}}const Mt={init:Qt,open:Et,close:Y,identify:te,submit:Ct,destroy:ee};return typeof window<"u"&&(window.Notefully=Mt),L.close=Y,L.default=Mt,L.destroy=ee,L.identify=te,L.init=Qt,L.open=Et,L.submit=Ct,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),L})({});
|