@makefully/notefully 0.1.10 → 0.1.11
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 +1 -1
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +9 -8
- package/dist/notefully.js +352 -319
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/notefully.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#notefully{all:initial;--nf-launcher-left: 16px;--nf-launcher-bottom: 16px;--nf-radius: 10px;--nf-z: 2147483000;--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-mark: #fdd341;--nf-mark-text: #2a2140;--nf-canvas-bg: #111;font-family:ui-sans-serif,system-ui,sans-serif;color:var(--nf-text)}#notefully[data-theme=maker]{--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-mark: #fdd341;--nf-mark-text: #2a2140}#notefully[data-theme=all-business]{--nf-accent: #5c6570;--nf-accent-text: #ffffff;--nf-accent-hot: #8a4a4a;--nf-btn: #5c6570;--nf-btn-border: #3a4048;--nf-btn-text: #ffffff;--nf-panel: #ffffff;--nf-text: #1f1f23;--nf-muted: rgba(31, 31, 35, .68);--nf-input: #f0f0f2;--nf-border: rgba(0, 0, 0, .14);--nf-backdrop: rgba(20, 20, 24, .4);--nf-danger: #8a4a4a;--nf-mark: #3d6ea8;--nf-mark-text: #ffffff}#notefully[data-theme=brighter-day]{--nf-accent: #5aa8dc;--nf-accent-text: #ffffff;--nf-accent-hot: #f08ab8;--nf-btn: #5aa8dc;--nf-btn-border: #3d7eae;--nf-btn-text: #ffffff;--nf-panel: #fffdf6;--nf-text: #2a2440;--nf-muted: rgba(42, 36, 64, .68);--nf-input: #ffeef5;--nf-border: rgba(90, 168, 220, .28);--nf-backdrop: rgba(60, 40, 70, .35);--nf-danger: #f08ab8;--nf-mark: #5aa8dc;--nf-mark-text: #ffffff}#notefully[data-theme=quiet-night]{--nf-accent: #c4aa5a;--nf-accent-text: #121416;--nf-accent-hot: #6e3a3a;--nf-btn: #3a4048;--nf-btn-border: #0e1012;--nf-btn-text: #d8dbe0;--nf-panel: #1c1f24;--nf-text: #d8dbe0;--nf-muted: rgba(216, 219, 224, .68);--nf-input: #262a30;--nf-border: rgba(255, 255, 255, .12);--nf-backdrop: rgba(0, 0, 0, .65);--nf-danger: #c88888;--nf-mark: #c4aa5a;--nf-mark-text: #121416}#notefully *{box-sizing:border-box}#notefully .nf-launcher{position:fixed;left:var(--nf-launcher-left);bottom:var(--nf-launcher-bottom);z-index:var(--nf-z);width:48px;height:48px;padding:0;display:grid;place-items:center;background:var(--nf-btn);color:var(--nf-btn-text);border:1px solid var(--nf-btn-border);border-radius:999px;cursor:pointer;box-shadow:0 8px 24px #00000040}#notefully .nf-launcher-icon{width:22px;height:22px;display:block}#notefully .nf-launcher[hidden],#notefully .nf-dialog[hidden],#notefully .nf-stop-video[hidden],#notefully .nf-stage[hidden],#notefully .nf-reset-crop[hidden],#notefully .nf-restore[hidden],#notefully .nf-video[hidden]{display:none!important}#notefully .nf-dialog{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--nf-z);background:var(--nf-backdrop);display:flex;align-items:center;justify-content:center;padding:24px}#notefully .nf-panel{width:min(920px,100%);max-height:calc(100vh - 48px);overflow:auto;background:var(--nf-panel);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:var(--nf-radius);padding:16px;display:flex;flex-direction:column;gap:12px}#notefully .nf-stage{display:flex;flex-direction:column;gap:8px}#notefully .nf-palette{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-tool,#notefully .nf-reset-crop,#notefully .nf-icon-btn{background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:6px 10px;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif}#notefully .nf-icon-btn{width:36px;height:36px;padding:0;display:grid;place-items:center;flex:0 0 36px}#notefully .nf-icon{width:18px;height:18px;display:block}#notefully .nf-tool[data-active=true],#notefully .nf-icon-btn[data-active=true]{border-color:var(--nf-accent);color:var(--nf-accent);box-shadow:inset 0 0 0 1px var(--nf-accent)}#notefully .nf-canvas{position:relative;width:min(100%,calc(48vh * var(--nf-shot-aspect, 16 / 9)));max-height:48vh;aspect-ratio:var(--nf-shot-aspect, auto);margin-inline:auto;background:var(--nf-canvas-bg);border-radius:8px;overflow:hidden;-webkit-user-select:none;user-select:none;touch-action:none}#notefully .nf-canvas[data-draw=true],#notefully .nf-canvas[data-draw=true] .nf-shot{cursor:crosshair}#notefully .nf-sticker{cursor:grab}#notefully .nf-sticker[data-preview=true]{cursor:crosshair}#notefully .nf-sticker.nf-arrow .nf-arrow-hit{cursor:grab}#notefully[data-grabbing=true] .nf-canvas,#notefully[data-grabbing=true] .nf-shot,#notefully[data-grabbing=true] .nf-sticker,#notefully[data-grabbing=true] .nf-sticker *{cursor:grabbing}#notefully .nf-shot{position:absolute;overflow:hidden;--nf-anno-stroke: 3px;--nf-anno-badge: 20px;--nf-anno-badge-font: 11px;--nf-anno-handle: 10px}#notefully .nf-shot img{position:absolute;display:block;max-height:none;pointer-events:none;-webkit-user-drag:none;user-drag:none}#notefully .nf-canvas video.nf-recording-preview{display:block;width:160px;height:auto;max-height:none;object-fit:contain;pointer-events:auto}#notefully .nf-sticker,#notefully .nf-crop{position:absolute;pointer-events:auto;color:var(--nf-mark)}#notefully .nf-sticker[data-selected=true]{z-index:4}#notefully .nf-sticker[data-preview=true],#notefully .nf-sticker.nf-arrow{pointer-events:none}#notefully .nf-sticker.nf-arrow .nf-handle{pointer-events:auto}#notefully .nf-rect,#notefully .nf-circle{border:var(--nf-anno-stroke) solid var(--nf-mark);background:transparent;box-sizing:border-box}#notefully .nf-circle{border-radius:50%}#notefully .nf-arrow-svg{display:block;overflow:visible;pointer-events:none}#notefully .nf-arrow-hit{fill:none;stroke:transparent;stroke-width:16;pointer-events:stroke}#notefully .nf-arrow-shaft{fill:none;stroke:currentColor;stroke-width:var(--nf-anno-stroke);stroke-linecap:round;pointer-events:none}#notefully .nf-arrow-head{fill:currentColor;stroke:none;pointer-events:none}#notefully .nf-badge{position:absolute;left:50%;top:0;transform:translate(-50%,-50%);box-sizing:border-box;min-width:var(--nf-anno-badge);height:var(--nf-anno-badge);padding:0 calc(var(--nf-anno-badge-font) * .35);border-radius:50%;background:var(--nf-mark);color:var(--nf-mark-text);font:700 var(--nf-anno-badge-font)/var(--nf-anno-badge) ui-sans-serif,system-ui,sans-serif;text-align:center;pointer-events:none;z-index:4}#notefully .nf-sticker.nf-arrow .nf-badge{top:50%}#notefully .nf-handle{position:absolute;width:var(--nf-anno-handle);height:var(--nf-anno-handle);background:#fff;border:2px solid var(--nf-mark);border-radius:2px;z-index:5;box-sizing:border-box}#notefully .nf-handle[data-dir=nw]{left:-6px;top:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=ne]{right:-6px;top:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=sw]{left:-6px;bottom:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=se]{right:-6px;bottom:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=start],#notefully .nf-handle[data-dir=end]{margin:0;cursor:grab}#notefully .nf-crop{border:2px dashed var(--nf-accent);background:color-mix(in srgb,var(--nf-accent) 14%,transparent);box-shadow:0 0 0 9999px #00000073;pointer-events:none}#notefully .nf-text{width:100%;min-height:96px;resize:vertical;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-kind{display:flex;gap:8px}#notefully .nf-kind button{background:var(--nf-input);color:var(--nf-muted);border:1px solid var(--nf-border);border-radius:999px;padding:6px 12px;cursor:pointer}#notefully .nf-kind button[data-active=true]{color:var(--nf-accent-text);background:var(--nf-accent);border-color:var(--nf-accent)}#notefully .nf-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-actions button{border:1px solid var(--nf-border);border-radius:8px;padding:8px 12px;cursor:pointer;font:600 13px ui-sans-serif,system-ui,sans-serif;background:var(--nf-input);color:var(--nf-text)}#notefully .nf-actions .nf-icon-btn{padding:0}#notefully .nf-submit{margin-left:auto;background:var(--nf-btn)!important;color:var(--nf-btn-text)!important;border-color:var(--nf-btn-border)!important}#notefully .nf-submit:disabled{opacity:.55;cursor:wait}#notefully .nf-restore{background:transparent;color:var(--nf-muted);border:0;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif;text-decoration:underline}#notefully .nf-status{color:var(--nf-muted);font:13px ui-sans-serif,system-ui,sans-serif;min-height:1.2em}#notefully .nf-stop-video{position:fixed;top:16px;left:50%;transform:translate(-50%);z-index:calc(var(--nf-z) + 1);background:var(--nf-danger);color:#fff;border:0;border-radius:999px;padding:10px 18px;font:700 14px ui-sans-serif,system-ui,sans-serif;cursor:pointer}#notefully[data-nf-hidden-launcher] .nf-launcher{display:none!important}.nf-capture-chrome{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483645;display:grid;place-items:center;pointer-events:none;background:#140c1c47;animation:nf-capture-fade .16s ease-out both}.nf-capture-chrome-pill{display:inline-flex;align-items:center;gap:.55em;padding:.65em 1.1em;border-radius:999px;background:#f7f4fbf0;color:#2a2140;font:650 14px ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;box-shadow:0 10px 28px #140c1c38}.nf-capture-chrome-pill:before{content:"";width:.7em;height:.7em;border-radius:50%;border:2px solid rgba(42,33,64,.22);border-top-color:#864093;animation:nf-capture-spin .7s linear infinite}@keyframes nf-capture-fade{0%{opacity:0}to{opacity:1}}@keyframes nf-capture-spin{to{transform:rotate(360deg)}}
|
|
1
|
+
#notefully{all:initial;--nf-launcher-left: 16px;--nf-launcher-bottom: 16px;--nf-radius: 10px;--nf-z: 2147483000;--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-mark: #fdd341;--nf-mark-text: #2a2140;--nf-canvas-bg: #111;font-family:ui-sans-serif,system-ui,sans-serif;color:var(--nf-text)}#notefully[data-theme=maker]{--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-mark: #fdd341;--nf-mark-text: #2a2140}#notefully[data-theme=all-business]{--nf-accent: #5c6570;--nf-accent-text: #ffffff;--nf-accent-hot: #8a4a4a;--nf-btn: #5c6570;--nf-btn-border: #3a4048;--nf-btn-text: #ffffff;--nf-panel: #ffffff;--nf-text: #1f1f23;--nf-muted: rgba(31, 31, 35, .68);--nf-input: #f0f0f2;--nf-border: rgba(0, 0, 0, .14);--nf-backdrop: rgba(20, 20, 24, .4);--nf-danger: #8a4a4a;--nf-mark: #3d6ea8;--nf-mark-text: #ffffff}#notefully[data-theme=brighter-day]{--nf-accent: #5aa8dc;--nf-accent-text: #ffffff;--nf-accent-hot: #f08ab8;--nf-btn: #5aa8dc;--nf-btn-border: #3d7eae;--nf-btn-text: #ffffff;--nf-panel: #fffdf6;--nf-text: #2a2440;--nf-muted: rgba(42, 36, 64, .68);--nf-input: #ffeef5;--nf-border: rgba(90, 168, 220, .28);--nf-backdrop: rgba(60, 40, 70, .35);--nf-danger: #f08ab8;--nf-mark: #5aa8dc;--nf-mark-text: #ffffff}#notefully[data-theme=quiet-night]{--nf-accent: #c4aa5a;--nf-accent-text: #121416;--nf-accent-hot: #6e3a3a;--nf-btn: #3a4048;--nf-btn-border: #0e1012;--nf-btn-text: #d8dbe0;--nf-panel: #1c1f24;--nf-text: #d8dbe0;--nf-muted: rgba(216, 219, 224, .68);--nf-input: #262a30;--nf-border: rgba(255, 255, 255, .12);--nf-backdrop: rgba(0, 0, 0, .65);--nf-danger: #c88888;--nf-mark: #c4aa5a;--nf-mark-text: #121416}#notefully *{box-sizing:border-box}#notefully .nf-launcher{position:fixed;left:var(--nf-launcher-left);bottom:var(--nf-launcher-bottom);z-index:var(--nf-z);width:48px;height:48px;padding:0;display:grid;place-items:center;background:var(--nf-btn);color:var(--nf-btn-text);border:1px solid var(--nf-btn-border);border-radius:999px;cursor:pointer;box-shadow:0 8px 24px #00000040}#notefully .nf-launcher-icon{width:22px;height:22px;display:block}#notefully .nf-launcher[hidden],#notefully .nf-dialog[hidden],#notefully .nf-stop-video[hidden],#notefully .nf-stage[hidden],#notefully .nf-reset-crop[hidden],#notefully .nf-restore[hidden],#notefully .nf-video[hidden]{display:none!important}#notefully .nf-dialog{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--nf-z);background:var(--nf-backdrop);display:flex;align-items:center;justify-content:center;padding:24px}#notefully .nf-panel{width:min(920px,100%);max-height:calc(100vh - 48px);overflow:auto;background:var(--nf-panel);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:var(--nf-radius);padding:16px;display:flex;flex-direction:column;gap:12px}#notefully .nf-stage{display:flex;flex-direction:column;gap:8px}#notefully .nf-palette{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-tool,#notefully .nf-reset-crop,#notefully .nf-icon-btn{background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:6px 10px;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif}#notefully .nf-icon-btn{width:36px;height:36px;padding:0;display:grid;place-items:center;flex:0 0 36px}#notefully .nf-icon{width:18px;height:18px;display:block}#notefully .nf-tool[data-active=true],#notefully .nf-icon-btn[data-active=true]{border-color:var(--nf-accent);color:var(--nf-accent);box-shadow:inset 0 0 0 1px var(--nf-accent)}#notefully .nf-canvas{position:relative;width:min(100%,calc(48vh * var(--nf-shot-aspect, 16 / 9)));max-height:48vh;aspect-ratio:var(--nf-shot-aspect, auto);margin-inline:auto;background:var(--nf-canvas-bg);border-radius:8px;overflow:hidden;-webkit-user-select:none;user-select:none;touch-action:none}#notefully .nf-canvas[data-draw=true],#notefully .nf-canvas[data-draw=true] .nf-shot{cursor:crosshair}#notefully .nf-sticker{cursor:grab}#notefully .nf-sticker[data-preview=true]{cursor:crosshair}#notefully .nf-sticker.nf-arrow .nf-arrow-hit{cursor:grab}#notefully[data-grabbing=true] .nf-canvas,#notefully[data-grabbing=true] .nf-shot,#notefully[data-grabbing=true] .nf-sticker,#notefully[data-grabbing=true] .nf-sticker *{cursor:grabbing}#notefully .nf-shot{position:absolute;overflow:hidden;--nf-anno-stroke: 3px;--nf-anno-badge: 20px;--nf-anno-badge-font: 11px;--nf-anno-handle: 10px}#notefully .nf-shot img{position:absolute;display:block;max-height:none;pointer-events:none;-webkit-user-drag:none;user-drag:none}#notefully .nf-canvas video.nf-recording-preview{display:block;width:160px;height:auto;max-height:none;object-fit:contain;pointer-events:auto}#notefully .nf-sticker,#notefully .nf-crop{position:absolute;pointer-events:auto;color:var(--nf-mark)}#notefully .nf-sticker[data-selected=true]{z-index:4}#notefully .nf-sticker[data-preview=true],#notefully .nf-sticker.nf-arrow{pointer-events:none}#notefully .nf-sticker.nf-arrow .nf-handle{pointer-events:auto}#notefully .nf-rect,#notefully .nf-circle{border:var(--nf-anno-stroke) solid var(--nf-mark);background:transparent;box-sizing:border-box}#notefully .nf-circle{border-radius:50%}#notefully .nf-arrow-svg{display:block;overflow:visible;pointer-events:none}#notefully .nf-arrow-hit{fill:none;stroke:transparent;stroke-width:16;pointer-events:stroke}#notefully .nf-arrow-shaft{fill:none;stroke:currentColor;stroke-width:var(--nf-anno-stroke);stroke-linecap:round;pointer-events:none}#notefully .nf-arrow-head{fill:currentColor;stroke:none;pointer-events:none}#notefully .nf-badge{position:absolute;left:50%;top:0;transform:translate(-50%,-50%);box-sizing:border-box;min-width:var(--nf-anno-badge);height:var(--nf-anno-badge);padding:0 calc(var(--nf-anno-badge-font) * .35);border-radius:50%;background:var(--nf-mark);color:var(--nf-mark-text);font:700 var(--nf-anno-badge-font)/var(--nf-anno-badge) ui-sans-serif,system-ui,sans-serif;text-align:center;pointer-events:none;z-index:4}#notefully .nf-sticker.nf-arrow .nf-badge{top:50%}#notefully .nf-handle{position:absolute;width:var(--nf-anno-handle);height:var(--nf-anno-handle);background:#fff;border:2px solid var(--nf-mark);border-radius:2px;z-index:5;box-sizing:border-box}#notefully .nf-handle[data-dir=nw]{left:-6px;top:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=ne]{right:-6px;top:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=sw]{left:-6px;bottom:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=se]{right:-6px;bottom:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=start],#notefully .nf-handle[data-dir=end]{margin:0;cursor:grab}#notefully .nf-crop{border:2px dashed var(--nf-accent);background:color-mix(in srgb,var(--nf-accent) 14%,transparent);box-shadow:0 0 0 9999px #00000073;pointer-events:none}#notefully .nf-text{width:100%;min-height:96px;resize:vertical;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-author{width:100%;box-sizing:border-box;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-author::placeholder{color:var(--nf-muted)}#notefully .nf-kind{display:flex;gap:8px}#notefully .nf-kind button{background:var(--nf-input);color:var(--nf-muted);border:1px solid var(--nf-border);border-radius:999px;padding:6px 12px;cursor:pointer}#notefully .nf-kind button[data-active=true]{color:var(--nf-accent-text);background:var(--nf-accent);border-color:var(--nf-accent)}#notefully .nf-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-actions button{border:1px solid var(--nf-border);border-radius:8px;padding:8px 12px;cursor:pointer;font:600 13px ui-sans-serif,system-ui,sans-serif;background:var(--nf-input);color:var(--nf-text)}#notefully .nf-actions .nf-icon-btn{padding:0}#notefully .nf-submit{margin-left:auto;background:var(--nf-btn)!important;color:var(--nf-btn-text)!important;border-color:var(--nf-btn-border)!important}#notefully .nf-submit:disabled{opacity:.55;cursor:wait}#notefully .nf-restore{background:transparent;color:var(--nf-muted);border:0;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif;text-decoration:underline}#notefully .nf-status{color:var(--nf-muted);font:13px ui-sans-serif,system-ui,sans-serif;min-height:1.2em}#notefully .nf-stop-video{position:fixed;top:16px;left:50%;transform:translate(-50%);z-index:calc(var(--nf-z) + 1);background:var(--nf-danger);color:#fff;border:0;border-radius:999px;padding:10px 18px;font:700 14px ui-sans-serif,system-ui,sans-serif;cursor:pointer}#notefully[data-nf-hidden-launcher] .nf-launcher{display:none!important}.nf-capture-chrome{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483645;display:grid;place-items:center;pointer-events:none;background:#140c1c47;animation:nf-capture-fade .16s ease-out both}.nf-capture-chrome-pill{display:inline-flex;align-items:center;gap:.55em;padding:.65em 1.1em;border-radius:999px;background:#f7f4fbf0;color:#2a2140;font:650 14px ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;box-shadow:0 10px 28px #140c1c38}.nf-capture-chrome-pill:before{content:"";width:.7em;height:.7em;border-radius:50%;border:2px solid rgba(42,33,64,.22);border-top-color:#864093;animation:nf-capture-spin .7s linear infinite}@keyframes nf-capture-fade{0%{opacity:0}to{opacity:1}}@keyframes nf-capture-spin{to{transform:rotate(360deg)}}
|
package/dist/notefully.iife.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var Notefully=(function(R){"use strict";function ye(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 ge=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function A(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let j=null;function Tt(t={}){return j||(t.includeStyleProperties?(j=t.includeStyleProperties,j):(j=A(window.getComputedStyle(document.documentElement)),j))}function Y(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function we(t){const e=Y(t,"border-left-width"),n=Y(t,"border-right-width");return t.clientWidth+e+n}function be(t){const e=Y(t,"border-top-width"),n=Y(t,"border-bottom-width");return t.clientHeight+e+n}function kt(t,e={}){const n=e.width||we(t),r=e.height||be(t);return{width:n,height:r}}function ve(){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 Se(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 G(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 xe(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Ee(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),xe(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 Ce(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Me(t,e){return Tt(e).map(n=>{const r=t.getPropertyValue(n),o=t.getPropertyPriority(n);return`${n}: ${r}${o?" !important":""};`}).join(" ")}function Le(t,e,n,r){const o=`.${t}:${e}`,i=n.cssText?Ce(n):Me(n,r);return document.createTextNode(`${o}{${i}}`)}function It(t,e,n,r){const o=window.getComputedStyle(t,n),i=o.getPropertyValue("content");if(i===""||i==="none")return;const a=ge();try{e.className=`${e.className} ${a}`}catch{return}const s=document.createElement("style");s.appendChild(Le(a,n,o,r)),e.appendChild(s)}function $e(t,e,n){It(t,e,":before",n),It(t,e,":after",n)}const Ot="application/font-woff",Ht="image/jpeg",Re={woff:Ot,woff2:Ot,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Ht,jpeg:Ht,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 Re[e]||""}function Ae(t){return t.split(/,/)[1]}function st(t){return t.search(/^(data:)/)!==-1}function Te(t,e){return`data:${e};base64,${t}`}async function Dt(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 ct={};function ke(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 lt(t,e,n){const r=ke(t,e,n.includeQueryParams);if(ct[r]!=null)return ct[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let o;try{const i=await Dt(t,n.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),Ae(s)));o=Te(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 ct[r]=o,o}async function Ie(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):G(e)}async function Oe(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 G(s)}const n=t.poster,r=at(n),o=await lt(n,r,e);return G(o)}async function He(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await J(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function De(t,e){return x(t,HTMLCanvasElement)?Ie(t):x(t,HTMLVideoElement)?Oe(t,e):x(t,HTMLIFrameElement)?He(t,e):t.cloneNode(Ft(t))}const Fe=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Ft=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function je(t,e,n){var r,o;if(Ft(e))return e;let i=[];return Fe(t)&&t.assignedNodes?i=A(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?i=A(t.contentDocument.body.childNodes):i=A(((o=t.shadowRoot)!==null&&o!==void 0?o:t).childNodes),i.length===0||x(t,HTMLVideoElement)||await i.reduce((a,s)=>a.then(()=>J(s,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Ue(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):Tt(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 _e(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Be(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(o=>t.value===o.getAttribute("value"));r&&r.setAttribute("selected","")}}function Ve(t,e,n){return x(e,Element)&&(Ue(t,e,n),$e(t,e,n),_e(t,e),Be(t,e)),e}async function Ne(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 J(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 J(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>De(r,e)).then(r=>je(t,r,e)).then(r=>Ve(t,r,e)).then(r=>Ne(r,e))}const jt=/url\((['"]?)([^'"]+?)\1\)/g,We=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,qe=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ze(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Xe(t){const e=[];return t.replace(jt,(n,r,o)=>(e.push(o),n)),e.filter(n=>!st(n))}async function Ke(t,e,n,r,o){try{const i=n?ye(e,n):e,a=at(e);let s;return o||(s=await lt(i,a,r)),t.replace(ze(e),`$1${s}$3`)}catch{}return t}function Ye(t,{preferredFontFormat:e}){return e?t.replace(qe,n=>{for(;;){const[r,,o]=We.exec(n)||[];if(!o)return"";if(o===e)return`src: ${r};`}}):t}function Ut(t){return t.search(jt)!==-1}async function _t(t,e,n){if(!Ut(t))return t;const r=Ye(t,n);return Xe(r).reduce((i,a)=>i.then(s=>Ke(s,a,e,n)),Promise.resolve(r))}async function U(t,e,n){var r;const o=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(o){const i=await _t(o,null,n);return e.style.setProperty(t,i,e.style.getPropertyPriority(t)),!0}return!1}async function Ge(t,e){await U("background",t,e)||await U("background-image",t,e),await U("mask",t,e)||await U("-webkit-mask",t,e)||await U("mask-image",t,e)||await U("-webkit-mask-image",t,e)}async function Je(t,e){const n=x(t,HTMLImageElement);if(!(n&&!st(t.src))&&!(x(t,SVGImageElement)&&!st(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,o=await lt(r,at(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 Qe(t,e){const r=A(t.childNodes).map(o=>Bt(o,e));await Promise.all(r).then(()=>t)}async function Bt(t,e){x(t,Element)&&(await Ge(t,e),await Je(t,e),await Qe(t,e))}function Ze(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 Nt(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 Wt(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),Dt(s,e.fetchRequestInit,({result:l})=>(n=n.replace(a,`url(${l})`),[a,l]))});return Promise.all(i).then(()=>n)}function qt(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 tn(t,e){const n=[],r=[];return t.forEach(o=>{if("cssRules"in o)try{A(o.cssRules||[]).forEach((i,a)=>{if(i.type===CSSRule.IMPORT_RULE){let s=a+1;const l=i.href,u=Nt(l).then(d=>Wt(d,e)).then(d=>qt(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(Nt(o.href).then(s=>Wt(s,e)).then(s=>qt(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{A(o.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${o.href}`,i)}}),n))}function en(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Ut(e.style.getPropertyValue("src")))}async function nn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=A(t.ownerDocument.styleSheets),r=await tn(n,e);return en(r)}function zt(t){return t.trim().replace(/["']/g,"")}function rn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{e.add(zt(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(t),e}async function on(t,e){const n=await nn(t,e),r=rn(t);return(await Promise.all(n.filter(i=>r.has(zt(i.style.fontFamily))).map(i=>{const a=i.parentStyleSheet?i.parentStyleSheet.href:null;return _t(i.cssText,a,e)}))).join(`
|
|
2
|
-
`)}async function an(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await on(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 sn(t,e={}){const{width:n,height:r}=kt(t,e),o=await J(t,e,!0);return await an(o,e),await Bt(o,e),Ze(o,e),await Ee(o,n,r)}async function cn(t,e={}){const{width:n,height:r}=kt(t,e),o=await sn(t,e),i=await G(o),a=document.createElement("canvas"),s=a.getContext("2d"),l=e.pixelRatio||ve(),u=e.canvasWidth||n,d=e.canvasHeight||r;return a.width=u*l,a.height=d*l,e.skipAutoScale||Se(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 ln(t,e={}){return(await cn(t,e)).toDataURL()}const Q="data-nf-capture-chrome";function un(t){return t instanceof Element&&(t.hasAttribute(Q)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function dn(){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 fn(){const t=document.querySelector(`[${Q}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(Q,"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 hn(){document.querySelectorAll(`[${Q}]`).forEach(t=>t.remove())}async function mn(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=fn();t&&(t.style.display="none");const r=dn();await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)));try{return await ln(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:o=>!un(o)})}finally{r(),n.remove(),hn(),t&&(t.style.display=e)}}function pn(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 yn(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 gn(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:pn(e),browser:yn(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 Xt=new Set(["userId","email","displayName"]),Kt={id:"userId",username:"displayName",name:"displayName"},Yt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit"]),Gt={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 wn(t={},e={}){const n=e.warn||Jt,r=t&&typeof t=="object"?t:{},o={},i=[];for(const a of Xt)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))Xt.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 bn(t={},e={}){const n=e.warn||Jt,r=t&&typeof t=="object"?t:{},o=Object.keys(r).filter(i=>!Yt.has(i));if(o.length)for(const i of o){if(Gt[i]){n(`Notefully.init: ignoring "${i}". ${Gt[i]}`);continue}n(`Notefully.init: ignoring unknown key "${i}". Supported: ${[...Yt].join(", ")}.`)}}function Jt(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const vn=80;function Sn(){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>vn&&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 xn(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 En=60*1e3;function Cn({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,En)},stop:l}}function Mn(){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 ut={x:0,y:0,w:1,h:1};function Qt(){const t=Mn();let e=[],n={...ut},r=1;return{list:()=>e.filter(i=>$n(i,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(i){return n=Ln(i),n},resetCrop(){return n={...ut},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={...ut},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function Ln(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 $n(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 dt(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 Rn(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=dt(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=ft(u.x,n,r),p=ht(u.y,n,o),y=u.w/n.w*r,M=u.h/n.h*o,$=l.stroke/2;if(u.type==="rect")t.strokeRect(d+$,p+$,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-$),Math.max(.5,M/2-$),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const _=ft(u.x2??u.x+u.w,n,r),B=ht(u.y2??u.y,n,o);An(t,d,p,_,B,l)}if(u.number==null||u.number==="")return;const H=Pn(u,n,r,o,d,p,y),K=String(u.number);t.beginPath(),t.arc(H.x,H.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=a,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(K,H.x,H.y+.5),t.fillStyle=a}),t.restore()}function ft(t,e,n){return(t-e.x)/e.w*n}function ht(t,e,n){return(t-e.y)/e.h*n}function Pn(t,e,n,r,o,i,a){if(t.type==="arrow"){const s=ft(t.x2??t.x+t.w,e,n),l=ht(t.y2??t.y,e,r);return{x:(o+s)/2,y:(i+l)/2}}return{x:o+a/2,y:i}}function Zt(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)},$={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:$}}function An(t,e,n,r,o,i){const a=Zt(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 Tn(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),Rn(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 kn=["bug","idea","other"],In=["maker","all-business","brighter-day","quiet-night"],te="maker",On=new Set(["crop","arrow","rect","circle"]),mt=.02,ee=.05,Hn=`
|
|
1
|
+
var Notefully=(function(R){"use strict";function be(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 P(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let U=null;function Tt(t={}){return U||(t.includeStyleProperties?(U=t.includeStyleProperties,U):(U=P(window.getComputedStyle(document.documentElement)),U))}function G(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function Se(t){const e=G(t,"border-left-width"),n=G(t,"border-right-width");return t.clientWidth+e+n}function xe(t){const e=G(t,"border-top-width"),n=G(t,"border-bottom-width");return t.clientHeight+e+n}function kt(t,e={}){const n=e.width||Se(t),r=e.height||xe(t);return{width:n,height:r}}function Ee(){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 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,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),Ce(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 $e(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Re(t,e){return Tt(e).map(n=>{const r=t.getPropertyValue(n),o=t.getPropertyPriority(n);return`${n}: ${r}${o?" !important":""};`}).join(" ")}function Ae(t,e,n,r){const o=`.${t}:${e}`,i=n.cssText?$e(n):Re(n,r);return document.createTextNode(`${o}{${i}}`)}function It(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(Ae(a,n,o,r)),e.appendChild(s)}function Pe(t,e,n){It(t,e,":before",n),It(t,e,":after",n)}const Ot="application/font-woff",Ht="image/jpeg",Te={woff:Ot,woff2:Ot,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Ht,jpeg:Ht,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function ke(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function st(t){const e=ke(t).toLowerCase();return Te[e]||""}function Ie(t){return t.split(/,/)[1]}function ct(t){return t.search(/^(data:)/)!==-1}function Oe(t,e){return`data:${e};base64,${t}`}async function Dt(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 He(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=He(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 Dt(t,n.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),Ie(s)));o=Oe(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 De(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):J(e)}async function Fe(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 Ue(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 je(t,e){return x(t,HTMLCanvasElement)?De(t):x(t,HTMLVideoElement)?Fe(t,e):x(t,HTMLIFrameElement)?Ue(t,e):t.cloneNode(Ft(t))}const _e=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Ft=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Ne(t,e,n){var r,o;if(Ft(e))return e;let i=[];return _e(t)&&t.assignedNodes?i=P(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?i=P(t.contentDocument.body.childNodes):i=P(((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 Be(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):Tt(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 Ve(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function We(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(o=>t.value===o.getAttribute("value"));r&&r.setAttribute("selected","")}}function qe(t,e,n){return x(e,Element)&&(Be(t,e,n),Pe(t,e,n),Ve(t,e),We(t,e)),e}async function ze(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=>je(r,e)).then(r=>Ne(t,r,e)).then(r=>qe(t,r,e)).then(r=>ze(r,e))}const Ut=/url\((['"]?)([^'"]+?)\1\)/g,Xe=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ye=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ke(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Ge(t){const e=[];return t.replace(Ut,(n,r,o)=>(e.push(o),n)),e.filter(n=>!ct(n))}async function Je(t,e,n,r,o){try{const i=n?be(e,n):e,a=st(e);let s;return o||(s=await ut(i,a,r)),t.replace(Ke(e),`$1${s}$3`)}catch{}return t}function Qe(t,{preferredFontFormat:e}){return e?t.replace(Ye,n=>{for(;;){const[r,,o]=Xe.exec(n)||[];if(!o)return"";if(o===e)return`src: ${r};`}}):t}function jt(t){return t.search(Ut)!==-1}async function _t(t,e,n){if(!jt(t))return t;const r=Qe(t,n);return Ge(r).reduce((i,a)=>i.then(s=>Je(s,a,e,n)),Promise.resolve(r))}async function j(t,e,n){var r;const o=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(o){const i=await _t(o,null,n);return e.style.setProperty(t,i,e.style.getPropertyPriority(t)),!0}return!1}async function Ze(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 tn(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 en(t,e){const r=P(t.childNodes).map(o=>Nt(o,e));await Promise.all(r).then(()=>t)}async function Nt(t,e){x(t,Element)&&(await Ze(t,e),await tn(t,e),await en(t,e))}function nn(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 Bt={};async function Vt(t){let e=Bt[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},Bt[t]=e,e}async function Wt(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),Dt(s,e.fetchRequestInit,({result:l})=>(n=n.replace(a,`url(${l})`),[a,l]))});return Promise.all(i).then(()=>n)}function qt(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 rn(t,e){const n=[],r=[];return t.forEach(o=>{if("cssRules"in o)try{P(o.cssRules||[]).forEach((i,a)=>{if(i.type===CSSRule.IMPORT_RULE){let s=a+1;const l=i.href,u=Vt(l).then(d=>Wt(d,e)).then(d=>qt(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(Vt(o.href).then(s=>Wt(s,e)).then(s=>qt(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{P(o.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${o.href}`,i)}}),n))}function on(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>jt(e.style.getPropertyValue("src")))}async function an(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=P(t.ownerDocument.styleSheets),r=await rn(n,e);return on(r)}function zt(t){return t.trim().replace(/["']/g,"")}function sn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{e.add(zt(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(t),e}async function cn(t,e){const n=await an(t,e),r=sn(t);return(await Promise.all(n.filter(i=>r.has(zt(i.style.fontFamily))).map(i=>{const a=i.parentStyleSheet?i.parentStyleSheet.href:null;return _t(i.cssText,a,e)}))).join(`
|
|
2
|
+
`)}async function ln(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await cn(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 un(t,e={}){const{width:n,height:r}=kt(t,e),o=await Q(t,e,!0);return await ln(o,e),await Nt(o,e),nn(o,e),await Le(o,n,r)}async function dn(t,e={}){const{width:n,height:r}=kt(t,e),o=await un(t,e),i=await J(o),a=document.createElement("canvas"),s=a.getContext("2d"),l=e.pixelRatio||Ee(),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 fn(t,e={}){return(await dn(t,e)).toDataURL()}const Z="data-nf-capture-chrome";function hn(t){return t instanceof Element&&(t.hasAttribute(Z)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function mn(){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 pn(){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 yn(){document.querySelectorAll(`[${Z}]`).forEach(t=>t.remove())}async function gn(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=pn();t&&(t.style.display="none");const r=mn();await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)));try{return await fn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:o=>!hn(o)})}finally{r(),n.remove(),yn(),t&&(t.style.display=e)}}function wn(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 bn(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:wn(e),browser:bn(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 Xt=new Set(["userId","email","displayName"]),Yt={id:"userId",username:"displayName",name:"displayName"},Kt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit"]),Gt={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 Sn(t={},e={}){const n=e.warn||Jt,r=t&&typeof t=="object"?t:{},o={},i=[];for(const a of Xt)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a]);for(const[a,s]of Object.entries(Yt))Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(o,s)||(o[s]=r[a]));for(const a of Object.keys(r))Xt.has(a)||Object.prototype.hasOwnProperty.call(Yt,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 xn(t={},e={}){const n=e.warn||Jt,r=t&&typeof t=="object"?t:{},o=Object.keys(r).filter(i=>!Kt.has(i));if(o.length)for(const i of o){if(Gt[i]){n(`Notefully.init: ignoring "${i}". ${Gt[i]}`);continue}n(`Notefully.init: ignoring unknown key "${i}". Supported: ${[...Kt].join(", ")}.`)}}function Jt(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const En=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>En&&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 Cn(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 Ln=60*1e3;function $n({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,Ln)},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 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 Qt(){const t=Rn();let e=[],n={...dt},r=1;return{list:()=>e.filter(i=>Pn(i,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(i){return n=An(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 An(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 Pn(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 Tn(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,$=l.stroke/2;if(u.type==="rect")t.strokeRect(d+$,p+$,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-$),Math.max(.5,C/2-$),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const _=ht(u.x2??u.x+u.w,n,r),N=mt(u.y2??u.y,n,o);In(t,d,p,_,N,l)}if(u.number==null||u.number==="")return;const H=kn(u,n,r,o,d,p,y),K=String(u.number);t.beginPath(),t.arc(H.x,H.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=a,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(K,H.x,H.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 kn(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 Zt(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)},$={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:$}}function In(t,e,n,r,o,i){const a=Zt(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 On(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),Tn(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 Hn=["bug","idea","other"],Dn=["maker","all-business","brighter-day","quiet-night"],te="maker",Fn=new Set(["crop","arrow","rect","circle"]),pt=.02,ee=.05,Un=`
|
|
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 T(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:T('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:T('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:T('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:T('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:T('<circle cx="12" cy="12" r="8"/>'),discard:T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:T('<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:T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},ne=
|
|
8
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
7
|
+
`;function T(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:T('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:T('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:T('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:T('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:T('<circle cx="12" cy="12" r="8"/>'),discard:T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:T('<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:T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},ne=Mn();ne.hook();const re=10,jn=80,ie="notefully.author",oe="Anonymous";let f={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:te,video:!1,consoleLogLimit:re},V={},h=null,c={},m=Qt(),S="",W="",A=null,tt="bug",I=null,L=null,g=null,w=null,et=null,F=null,q=null,O={w:0,h:0},yt=!1;function b(t){return h.querySelector(t)}function ae(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return Dn.includes(e)?e:te}function se(t,e){return h&&getComputedStyle(h).getPropertyValue(t).trim()||e}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 gt(){return h&&document.body.contains(h)||(h=document.createElement("div"),h.id="notefully",h.innerHTML=`
|
|
8
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Un}</button>
|
|
9
9
|
<div class="nf-dialog" hidden>
|
|
10
10
|
<div class="nf-panel">
|
|
11
11
|
<div class="nf-stage">
|
|
@@ -19,6 +19,7 @@ var Notefully=(function(R){"use strict";function ye(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
19
19
|
<div class="nf-canvas"></div>
|
|
20
20
|
</div>
|
|
21
21
|
<textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
|
|
22
|
+
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
22
23
|
<div class="nf-kind">
|
|
23
24
|
<button type="button" data-kind="bug">Bug</button>
|
|
24
25
|
<button type="button" data-kind="idea">Idea</button>
|
|
@@ -35,8 +36,8 @@ var Notefully=(function(R){"use strict";function ye(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
35
36
|
</div>
|
|
36
37
|
</div>
|
|
37
38
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
38
|
-
`,document.body.appendChild(h),c={launcher:
|
|
39
|
-
<line class="nf-arrow-hit" x1="${_}" y1="${
|
|
40
|
-
<line class="nf-arrow-shaft" x1="${_}" y1="${
|
|
39
|
+
`,document.body.appendChild(h),c={launcher:b(".nf-launcher"),dialog:b(".nf-dialog"),stage:b(".nf-stage"),canvas:b(".nf-canvas"),text:b(".nf-text"),author:b(".nf-author"),restore:b(".nf-restore"),status:b(".nf-status"),audio:b(".nf-audio"),video:b(".nf-video"),discard:b(".nf-discard-shot"),stop:b(".nf-stop-video"),resetCrop:b(".nf-reset-crop"),submit:b(".nf-submit"),shot:null},_n(),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 _n(){c.launcher.addEventListener("click",()=>Lt()),b(".nf-dialog").addEventListener("click",t=>{t.target===c.dialog&&Y()}),h.querySelectorAll(".nf-tool").forEach(t=>{t.addEventListener("click",()=>bt(t.dataset.tool))}),c.resetCrop.addEventListener("click",Xn),c.canvas.addEventListener("pointerdown",Bn),c.canvas.addEventListener("dragstart",t=>t.preventDefault()),h.querySelectorAll("[data-kind]").forEach(t=>{t.addEventListener("click",()=>wt(t.dataset.kind))}),c.discard.addEventListener("click",Yn),c.restore.addEventListener("click",Kn),c.audio.addEventListener("click",Gn),c.video.addEventListener("click",Jn),c.stop.addEventListener("click",()=>q==null?void 0:q.stop()),b(".nf-submit").addEventListener("click",()=>{$t().catch(t=>v(t.message||"Submit failed."))}),wt("bug"),bt(null)}function wt(t){tt=Hn.includes(t)?t:"bug",h.querySelectorAll("[data-kind]").forEach(e=>{e.dataset.active=String(e.dataset.kind===tt)})}function bt(t){I=Fn.has(t)?t:null,L=null,h.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===I)}),c.canvas&&(c.canvas.dataset.draw=I?"true":"false"),S&&M()}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 Nn(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 St(t){try{c.canvas.setPointerCapture(t.pointerId)}catch{}}function xt(){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 Bn(t){if(t.button!==0||!S)return;if(!t.target.closest(".nf-sticker")&&!Nn(t)){L=null,M();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),L=n.dataset.id,St(t),Vn({kind:"sticker",id:L,dir:(e==null?void 0:e.dataset.dir)||"move"},t),M();return}if(L=null,I==="crop"){t.preventDefault(),St(t),g={kind:"crop",start:it(t),current:it(t)},xt(),M();return}if(I==="arrow"||I==="rect"||I==="circle"){t.preventDefault(),St(t);const r=le(t);g={kind:"sticker",type:I,start:r,current:r},xt(),M();return}M()}function Vn(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"),xt()}function de(t){if(g){g.current=g.kind==="crop"?it(t):le(t),M();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};Wn(o,w.dir,e,n),m.update(r.id,o)}M()}}function Wn(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){qn();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),L=null)}w=null,M()}}function qn(){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)<ee||Math.abs(t.current.y-t.start.y)<ee){M();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=zn(t);e&&(L=e.id),M()}function zn(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 Xn(){m.resetCrop(),L=null,X()}function Et(){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 Yn(){S&&(W=S),S="",c.stage.hidden=!0,c.restore.hidden=!W}function Kn(){W&&(S=W,c.stage.hidden=!1,c.restore.hidden=!0,X())}function Gn(){try{if(F||(F=Cn(e=>{const n=c.text.value.trim();c.text.value=n?`${n} ${e}`:e})),!F.isSupported()){v("Audio-to-text is not supported in this browser.");return}const t=F.start();Mt(t),v(t?"Listening…":"")}catch(t){v(t.message)}}async function Jn(){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=$n({onStart(){},onStop(t){A=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,!S){c.canvas.style.removeProperty("--nf-shot-aspect"),c.canvas.style.removeProperty("aspect-ratio"),c.canvas.innerHTML=A?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(A)}"></video>`:"",Et();return}c.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${S}" 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=()=>{Qn(t),M()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e()}function Qn(t){const e=t.naturalWidth||O.w,n=t.naturalHeight||O.h;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)return;const r=m.crop(),o=O.w/O.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 Zn(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 M(){if((c.shot||c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(i=>i.remove()),!S||!c.shot){Et();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(Zn(g)),o.forEach(i=>{const a=i.id==="preview",s=!a&&i.id===L,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"?tr(l,i,e,s,r):(fe(l,i,e),s&&["nw","ne","sw","se"].forEach(u=>Ct(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()),A){const i=document.createElement("video");i.className="nf-recording-preview",i.controls=!0,i.src=URL.createObjectURL(A),i.style.position="absolute",i.style.right="8px",i.style.bottom="8px",i.style.width="160px",c.canvas.appendChild(i)}Et()}function tr(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),C=Math.min(l,d)-y,$=Math.min(u,p)-y,H=Math.max(2,Math.abs(d-l))+y*2,K=Math.max(2,Math.abs(p-u))+y*2,_=l-C,N=u-$,At=d-C,Pt=p-$,D=Zt(_,N,At,Pt,o),B=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${C}px`,t.style.top=`${$}px`,t.style.width=`${H}px`,t.style.height=`${K}px`,B.setAttribute("class","nf-arrow-svg"),B.setAttribute("viewBox",`0 0 ${H} ${K}`),B.setAttribute("width",String(H)),B.setAttribute("height",String(K)),B.innerHTML=`
|
|
40
|
+
<line class="nf-arrow-hit" x1="${_}" y1="${N}" x2="${At}" y2="${Pt}" />
|
|
41
|
+
<line class="nf-arrow-shaft" x1="${_}" y1="${N}" x2="${D.shaftEnd.x}" y2="${D.shaftEnd.y}" />
|
|
41
42
|
<polygon class="nf-arrow-head" points="${D.tipX},${D.tipY} ${D.left.x},${D.left.y} ${D.right.x},${D.right.y}" />
|
|
42
|
-
`,t.appendChild(
|
|
43
|
+
`,t.appendChild(B),r&&(Ct(t,"start",{left:_-5,top:N-5}),Ct(t,"end",{left:At-5,top:Pt-5}))}function Ct(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 er(){try{return String(localStorage.getItem(ie)||"").trim()}catch{return""}}function nr(t){const e=String(t||"").trim();if(!(!e||e===oe))try{localStorage.setItem(ie,e)}catch{}}function rr(){const t=String(V.displayName||"").trim();return t||er()}function ir(){var e;const t=String(((e=c.author)==null?void 0:e.value)||"").trim();return t?(nr(t),t):oe}function he(){c.author&&(c.author.value=rr())}function me(t,e=re){const n=Number(t);return Number.isFinite(n)?Math.min(jn,Math.max(0,Math.floor(n))):e}function pe(t={}){return xn(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:me(t.consoleLogLimit,f.consoleLogLimit)},gt(),nt(),Rt}async function Lt(){gt(),nt(),c.launcher.hidden=!0,m=Qt(),O={w:0,h:0},A=null,L=null,g=null,w=null,tt="bug",wt("bug"),bt(null),Mt(!1),c.text.value="",he(),v("");try{S=await gn(),W=S,c.stage.hidden=!1,c.restore.hidden=!0,v("")}catch{S="",v("Screenshot failed; you can still send text.")}c.dialog.hidden=!1,X(),c.text.focus()}function Y(){h&&(F==null||F.stop(),Mt(!1),ue(),g=null,w=null,vt(!1),c.dialog.hidden=!0,c.stop.hidden=!0,rt())}function ye(t={}){V={...V,...Sn(t)},he()}async function $t(){if(gt(),yt)return null;const t=c.text.value.trim();if(!t&&!S&&!A)return v("Add a note, screenshot, or video first."),null;if(!f.endpoint||!f.projectKey)return v("Notefully is missing endpoint or projectKey."),null;yt=!0,ge(!0),v("Submitting…",!0);try{const e=ir(),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({...V,displayName:V.displayName||e}),author:e,console:ne.snapshot().slice(-me(f.consoleLogLimit))})),n.append("annotations",JSON.stringify(m.list())),Array.isArray(f.targets)&&n.append("targets",JSON.stringify(f.targets)),S){const i=await On(S,m.crop(),m.list(),{mark:se("--nf-mark","#fdd341"),markText:se("--nf-mark-text","#2a2140")});n.append("screenshot",i,"screenshot.png")}A&&n.append("recording",A,"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{yt=!1,ge(!1)}}function ge(t){c.submit&&(c.submit.disabled=!!t,c.submit.setAttribute("aria-busy",t?"true":"false"))}function we(){Y(),h==null||h.remove(),h=null,c={}}const Rt={init:pe,open:Lt,close:Y,identify:ye,submit:$t,destroy:we};return typeof window<"u"&&(window.Notefully=Rt),R.close=Y,R.default=Rt,R.destroy=we,R.identify=ye,R.init=pe,R.open=Lt,R.submit=$t,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),R})({});
|