@makefully/notefully 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +31 -28
- package/dist/notefully.js +481 -447
- package/package.json +3 -2
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-success: #1a7a3c;--nf-fail: #c2185b;--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-success: #1a7a3c;--nf-fail: #c2185b;--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-success: #1f7a3a;--nf-fail: #b42318;--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-success: #1f7a3a;--nf-fail: #c4476a;--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-success: #7dcea0;--nf-fail: #e89898;--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],#notefully .nf-author[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)}}
|
|
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-success: #1a7a3c;--nf-fail: #c2185b;--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-success: #1a7a3c;--nf-fail: #c2185b;--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-success: #1f7a3a;--nf-fail: #b42318;--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-success: #1f7a3a;--nf-fail: #c4476a;--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-success: #7dcea0;--nf-fail: #e89898;--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],#notefully .nf-author[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-panel-body{display:flex;flex-direction:column;gap:12px;min-height:0}#notefully .nf-panel-body[hidden]{display:none!important}#notefully .nf-success-msg{margin:0;text-align:center;font:700 1.35rem/1.2 ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;color:var(--nf-success)}#notefully .nf-success-msg[hidden]{display:none!important}#notefully .nf-dialog.nf-success{pointer-events:none}#notefully .nf-dialog.nf-success .nf-panel{width:auto;min-width:11rem;max-width:min(280px,90vw);max-height:none;overflow:hidden;padding:1.75rem 2.35rem;align-items:center;justify-content:center;gap:0}@media(prefers-reduced-motion:reduce){#notefully .nf-dialog.nf-success .nf-panel{transform:none!important;transition:none!important}}#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,39 +1,42 @@
|
|
|
1
|
-
var Notefully=(function(R){"use strict";function Le(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"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}const $e=(()=>{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 B=null;function Ht(t={}){return B||(t.includeStyleProperties?(B=t.includeStyleProperties,B):(B=P(window.getComputedStyle(document.documentElement)),B))}function Q(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function Ae(t){const e=Q(t,"border-left-width"),n=Q(t,"border-right-width");return t.clientWidth+e+n}function Re(t){const e=Q(t,"border-top-width"),n=Q(t,"border-bottom-width");return t.clientHeight+e+n}function Dt(t,e={}){const n=e.width||Ae(t),r=e.height||Re(t);return{width:n,height:r}}function ke(){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 Pe(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 Z(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 Te(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Ie(t,e,n){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(t),Te(i)}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 Oe(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function He(t,e){return Ht(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function De(t,e,n,r){const i=`.${t}:${e}`,o=n.cssText?Oe(n):He(n,r);return document.createTextNode(`${i}{${o}}`)}function Ft(t,e,n,r){const i=window.getComputedStyle(t,n),o=i.getPropertyValue("content");if(o===""||o==="none")return;const a=$e();try{e.className=`${e.className} ${a}`}catch{return}const s=document.createElement("style");s.appendChild(De(a,n,i,r)),e.appendChild(s)}function Fe(t,e,n){Ft(t,e,":before",n),Ft(t,e,":after",n)}const Ut="application/font-woff",jt="image/jpeg",Ue={woff:Ut,woff2:Ut,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:jt,jpeg:jt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function je(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function lt(t){const e=je(t).toLowerCase();return Ue[e]||""}function _e(t){return t.split(/,/)[1]}function ut(t){return t.search(/^(data:)/)!==-1}function Be(t,e){return`data:${e};base64,${t}`}async function _t(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const i=await r.blob();return new Promise((o,a)=>{const s=new FileReader;s.onerror=a,s.onloadend=()=>{try{o(n({res:r,result:s.result}))}catch(l){a(l)}},s.readAsDataURL(i)})}const dt={};function Ne(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 ft(t,e,n){const r=Ne(t,e,n.includeQueryParams);if(dt[r]!=null)return dt[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const o=await _t(t,n.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),_e(s)));i=Be(o,e)}catch(o){i=n.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;o&&(a=typeof o=="string"?o:o.message),a&&console.warn(a)}return dt[r]=i,i}async function Ve(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):Z(e)}async function ze(t,e){if(t.currentSrc){const o=document.createElement("canvas"),a=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,a==null||a.drawImage(t,0,0,o.width,o.height);const s=o.toDataURL();return Z(s)}const n=t.poster,r=lt(n),i=await ft(n,r,e);return Z(i)}async function We(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await tt(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function qe(t,e){return x(t,HTMLCanvasElement)?Ve(t):x(t,HTMLVideoElement)?ze(t,e):x(t,HTMLIFrameElement)?We(t,e):t.cloneNode(Bt(t))}const Ke=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Bt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Xe(t,e,n){var r,i;if(Bt(e))return e;let o=[];return Ke(t)&&t.assignedNodes?o=P(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?o=P(t.contentDocument.body.childNodes):o=P(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),o.length===0||x(t,HTMLVideoElement)||await o.reduce((a,s)=>a.then(()=>tt(s,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Ye(t,e,n){const r=e.style;if(!r)return;const i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):Ht(n).forEach(o=>{let a=i.getPropertyValue(o);o==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),x(t,HTMLIFrameElement)&&o==="display"&&a==="inline"&&(a="block"),o==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),r.setProperty(o,a,i.getPropertyPriority(o))})}function Ge(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Je(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function Qe(t,e,n){return x(e,Element)&&(Ye(t,e,n),Fe(t,e,n),Ge(t,e),Je(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 o=0;o<n.length;o++){const s=n[o].getAttribute("xlink:href");if(s){const l=t.querySelector(s),u=document.querySelector(s);!l&&u&&!r[s]&&(r[s]=await tt(u,e,!0))}}const i=Object.values(r);if(i.length){const o="http://www.w3.org/1999/xhtml",a=document.createElementNS(o,"svg");a.setAttribute("xmlns",o),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const s=document.createElementNS(o,"defs");a.appendChild(s);for(let l=0;l<i.length;l++)s.appendChild(i[l]);t.appendChild(a)}return t}async function tt(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>qe(r,e)).then(r=>Xe(t,r,e)).then(r=>Qe(t,r,e)).then(r=>Ze(r,e))}const Nt=/url\((['"]?)([^'"]+?)\1\)/g,tn=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,en=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function nn(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function rn(t){const e=[];return t.replace(Nt,(n,r,i)=>(e.push(i),n)),e.filter(n=>!ut(n))}async function on(t,e,n,r,i){try{const o=n?Le(e,n):e,a=lt(e);let s;return i||(s=await ft(o,a,r)),t.replace(nn(e),`$1${s}$3`)}catch{}return t}function an(t,{preferredFontFormat:e}){return e?t.replace(en,n=>{for(;;){const[r,,i]=tn.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function Vt(t){return t.search(Nt)!==-1}async function zt(t,e,n){if(!Vt(t))return t;const r=an(t,n);return rn(r).reduce((o,a)=>o.then(s=>on(s,a,e,n)),Promise.resolve(r))}async function N(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const o=await zt(i,null,n);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function sn(t,e){await N("background",t,e)||await N("background-image",t,e),await N("mask",t,e)||await N("-webkit-mask",t,e)||await N("mask-image",t,e)||await N("-webkit-mask-image",t,e)}async function cn(t,e){const n=x(t,HTMLImageElement);if(!(n&&!ut(t.src))&&!(x(t,SVGImageElement)&&!ut(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await ft(r,lt(r),e);await new Promise((o,a)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...l)=>{try{o(e.onImageErrorHandler(...l))}catch(u){a(u)}}:a;const s=t;s.decode&&(s.decode=o),s.loading==="lazy"&&(s.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function ln(t,e){const r=P(t.childNodes).map(i=>Wt(i,e));await Promise.all(r).then(()=>t)}async function Wt(t,e){x(t,Element)&&(await sn(t,e),await cn(t,e),await ln(t,e))}function un(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(i=>{n[i]=r[i]}),t}const qt={};async function Kt(t){let e=qt[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},qt[t]=e,e}async function Xt(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async a=>{let s=a.replace(r,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),_t(s,e.fetchRequestInit,({result:l})=>(n=n.replace(a,`url(${l})`),[a,l]))});return Promise.all(o).then(()=>n)}function Yt(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(i,"");const o=/@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=o.exec(r);if(l===null){if(l=s.exec(r),l===null)break;o.lastIndex=s.lastIndex}else s.lastIndex=o.lastIndex;e.push(l[0])}return e}async function dn(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{P(i.cssRules||[]).forEach((o,a)=>{if(o.type===CSSRule.IMPORT_RULE){let s=a+1;const l=o.href,u=Kt(l).then(h=>Xt(h,e)).then(h=>Yt(h).forEach(m=>{try{i.insertRule(m,m.startsWith("@import")?s+=1:i.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:m,error:y})}})).catch(h=>{console.error("Error loading remote css",h.toString())});r.push(u)}})}catch(o){const a=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&r.push(Kt(i.href).then(s=>Xt(s,e)).then(s=>Yt(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",o)}}),Promise.all(r).then(()=>(t.forEach(i=>{if("cssRules"in i)try{P(i.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),n))}function fn(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Vt(e.style.getPropertyValue("src")))}async function hn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=P(t.ownerDocument.styleSheets),r=await dn(n,e);return fn(r)}function Gt(t){return t.trim().replace(/["']/g,"")}function pn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(o=>{e.add(Gt(o))}),Array.from(r.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(t),e}async function mn(t,e){const n=await hn(t,e),r=pn(t);return(await Promise.all(n.filter(o=>r.has(Gt(o.style.fontFamily))).map(o=>{const a=o.parentStyleSheet?o.parentStyleSheet.href:null;return zt(o.cssText,a,e)}))).join(`
|
|
2
|
-
`)}async function yn(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await mn(t,e);if(n){const r=document.createElement("style"),i=document.createTextNode(n);r.appendChild(i),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function gn(t,e={}){const{width:n,height:r}=Dt(t,e),i=await tt(t,e,!0);return await yn(i,e),await Wt(i,e),un(i,e),await Ie(i,n,r)}async function wn(t,e={}){const{width:n,height:r}=Dt(t,e),i=await gn(t,e),o=await Z(i),a=document.createElement("canvas"),s=a.getContext("2d"),l=e.pixelRatio||ke(),u=e.canvasWidth||n,h=e.canvasHeight||r;return a.width=u*l,a.height=h*l,e.skipAutoScale||Pe(a),a.style.width=`${u}`,a.style.height=`${h}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(o,0,0,a.width,a.height),a}async function bn(t,e={}){return(await wn(t,e)).toDataURL()}const et="data-nf-capture-chrome";function Sn(t){return t instanceof Element&&(t.hasAttribute(et)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function vn(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(n=>{const r=n.getBoundingClientRect(),i=document.createElement("div");i.setAttribute("data-nf-mask-cover","1"),i.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(i),t.push(i)}),()=>t.forEach(n=>n.remove())}function xn(){const t=document.querySelector(`[${et}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(et,"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 En(){document.querySelectorAll(`[${et}]`).forEach(t=>t.remove())}async function Cn(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=xn();t&&(t.style.display="none");const r=vn();await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i)));try{return await bn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:i=>!Sn(i)})}finally{r(),n.remove(),En(),t&&(t.style.display=e)}}function Mn(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 Ln(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 $n(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:Mn(e),browser:Ln(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 Jt=new Set(["userId","email","displayName"]),Qt={id:"userId",username:"displayName",name:"displayName"},Zt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit","kinds"]),te={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 An(t={},e={}){const n=e.warn||ee,r=t&&typeof t=="object"?t:{},i={},o=[];for(const a of Jt)Object.prototype.hasOwnProperty.call(r,a)&&(i[a]=r[a]);for(const[a,s]of Object.entries(Qt))Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(i,s)||(i[s]=r[a]));for(const a of Object.keys(r))Jt.has(a)||Object.prototype.hasOwnProperty.call(Qt,a)||o.push(a);if(o.length){const a=o.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): ${o.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+a)}return i}function Rn(t={},e={}){const n=e.warn||ee,r=t&&typeof t=="object"?t:{},i=Object.keys(r).filter(o=>!Zt.has(o));if(i.length)for(const o of i){if(te[o]){n(`Notefully.init: ignoring "${o}". ${te[o]}`);continue}n(`Notefully.init: ignoring unknown key "${o}". Supported: ${[...Zt].join(", ")}.`)}}function ee(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const kn=80;function Pn(){const t=[],e={};let n=!1;const r=(o,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:o,text:s.slice(0,2e3),at:Date.now()}),t.length>kn&&t.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(o=>{e[o]=console[o].bind(console),console[o]=(...a)=>{r(o,a),e[o](...a)}}),window.addEventListener("error",o=>{r("error",[o.message||"window.error"])}),window.addEventListener("unhandledrejection",o=>{r("error",[o.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function Tn(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const i=()=>{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?(i(),!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:i,isSupported:()=>!!e,isActive:()=>r}}const In=60*1e3;function On({onStart:t,onStop:e,onError:n}){let r=null,i=null,o=[],a=null;const s=()=>{if(a&&(clearTimeout(a),a=null),i&&i.state!=="inactive")try{i.stop()}catch{}r&&(r.getTracks().forEach(h=>h.stop()),r=null)},l=()=>{if(i&&i.state==="recording"){i.stop();return}s(),e(null)};return{start:async()=>{var h,m;if(!((h=navigator.mediaDevices)!=null&&h.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"}),o=[],i=new MediaRecorder(r,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),i.ondataavailable=y=>{y.data&&y.data.size&&o.push(y.data)},i.onstop=()=>{const y=o.length?new Blob(o,{type:i.mimeType||"video/webm"}):null;s(),e(y)},(m=r.getVideoTracks()[0])==null||m.addEventListener("ended",()=>l()),i.start(),a=setTimeout(l,In)},stop:l}}function Hn(){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 ht={x:0,y:0,w:1,h:1};function ne(){const t=Hn();let e=[],n={...ht},r=1;return{list:()=>e.filter(o=>Fn(o,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(o){return n=Dn(o),n},resetCrop(){return n={...ht},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(o,a){const s={id:`s${r++}`,type:o,number:t.alloc(),x:.2,y:.2,w:o==="arrow"?.2:.22,h:o==="arrow"?.05:.16,x2:.4,y2:.28,...a};return e.push(s),s},update(o,a){const s=e.find(l=>l.id===o);return s?(Object.assign(s,a),s):null},remove(o){const a=e.findIndex(l=>l.id===o);if(a<0)return null;const[s]=e.splice(a,1);return t.free(s.number),s},reset(){for(e=[],n={...ht},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function Dn(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),i=Math.min(Math.max(t.h,.05),1-n);return{x:e,y:n,w:r,h:i}}function Fn(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 pt(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 Un(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:i,colors:o={}}){const a=o.mark||"#fdd341",s=o.markText||"#2a2140",l=pt(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 h=mt(u.x,n,r),m=yt(u.y,n,i),y=u.w/n.w*r,M=u.h/n.h*i,A=l.stroke/2;if(u.type==="rect")t.strokeRect(h+A,m+A,Math.max(0,y-l.stroke),Math.max(0,M-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(h+y/2,m+M/2,Math.max(.5,y/2-A),Math.max(.5,M/2-A),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const V=mt(u.x2??u.x+u.w,n,r),z=yt(u.y2??u.y,n,i);_n(t,h,m,V,z,l)}if(u.number==null||u.number==="")return;const D=jn(u,n,r,i,h,m,y),J=String(u.number);t.beginPath(),t.arc(D.x,D.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=a,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(J,D.x,D.y+.5),t.fillStyle=a}),t.restore()}function mt(t,e,n){return(t-e.x)/e.w*n}function yt(t,e,n){return(t-e.y)/e.h*n}function jn(t,e,n,r,i,o,a){if(t.type==="arrow"){const s=mt(t.x2??t.x+t.w,e,n),l=yt(t.y2??t.y,e,r);return{x:(i+s)/2,y:(o+l)/2}}return{x:i+a/2,y:o}}function re(t,e,n,r,i){const o=Math.atan2(r-e,n-t),a=i.arrowHead,s=Math.min(i.stroke,a*.2),l=n,u=r,h=n-Math.cos(o)*a,m=r-Math.sin(o)*a,y={x:l-a*Math.cos(o-i.arrowHeadAngle),y:u-a*Math.sin(o-i.arrowHeadAngle)},M={x:l-a*Math.cos(o+i.arrowHeadAngle),y:u-a*Math.sin(o+i.arrowHeadAngle)},A={x:n-Math.cos(o)*s,y:r-Math.sin(o)*s};return{angle:o,tipX:l,tipY:u,baseX:h,baseY:m,left:y,right:M,shaftEnd:A}}function _n(t,e,n,r,i,o){const a=re(e,n,r,i,o);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 Bn(t,e,n,r={}){return new Promise((i,o)=>{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)),h=Math.max(1,Math.round(e.h*a.height)),m=document.createElement("canvas");m.width=u,m.height=h;const y=m.getContext("2d");y.drawImage(a,s,l,u,h,0,0,u,h),Un(y,{stickers:n,crop:e,width:u,height:h,colors:r}),m.toBlob(M=>{if(!M){o(new Error("Could not encode screenshot"));return}i(M)},"image/png")},a.onerror=()=>o(new Error("Could not load screenshot")),a.src=t})}const U=[{id:"bug",label:"Bug"},{id:"idea",label:"Idea"},{id:"other",label:"Other"}];function ie(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function gt(t){const e=String(t||"").trim();return e?e.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function Nn(t){if(!Array.isArray(t)||!t.length)return U.map(r=>({...r}));const e=new Set,n=[];for(const r of t){let i="",o="";typeof r=="string"||typeof r=="number"?(i=ie(r),o=gt(i)):r&&typeof r=="object"&&(i=ie(r.id??r.value??r.kind),o=String(r.label||r.name||gt(i)).trim()||gt(i)),!(!i||e.has(i))&&(e.add(i),n.push({id:i,label:o}))}return n.length?n:U.map(r=>({...r}))}function nt(t){var n;const e=Array.isArray(t)&&t.length?t:U;return e.some(r=>r.id==="bug")?"bug":((n=e[0])==null?void 0:n.id)||"other"}const Vn=["maker","all-business","brighter-day","quiet-night"],oe="maker",zn=new Set(["crop","arrow","rect","circle"]),wt=.02,ae=.05,Wn=`
|
|
1
|
+
var Notefully=(function(A){"use strict";function Re(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"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}const Ae=(()=>{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 _=null;function Ft(t={}){return _||(t.includeStyleProperties?(_=t.includeStyleProperties,_):(_=P(window.getComputedStyle(document.documentElement)),_))}function Q(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function ke(t){const e=Q(t,"border-left-width"),n=Q(t,"border-right-width");return t.clientWidth+e+n}function Pe(t){const e=Q(t,"border-top-width"),n=Q(t,"border-bottom-width");return t.clientHeight+e+n}function Dt(t,e={}){const n=e.width||ke(t),r=e.height||Pe(t);return{width:n,height:r}}function Te(){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 M=16384;function Ie(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 Z(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 Oe(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function He(t,e,n){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(t),Oe(i)}const E=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||E(n,e)};function Fe(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function De(t,e){return Ft(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function Be(t,e,n,r){const i=`.${t}:${e}`,o=n.cssText?Fe(n):De(n,r);return document.createTextNode(`${i}{${o}}`)}function Bt(t,e,n,r){const i=window.getComputedStyle(t,n),o=i.getPropertyValue("content");if(o===""||o==="none")return;const a=Ae();try{e.className=`${e.className} ${a}`}catch{return}const s=document.createElement("style");s.appendChild(Be(a,n,i,r)),e.appendChild(s)}function Ue(t,e,n){Bt(t,e,":before",n),Bt(t,e,":after",n)}const Ut="application/font-woff",jt="image/jpeg",je={woff:Ut,woff2:Ut,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:jt,jpeg:jt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function _e(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function lt(t){const e=_e(t).toLowerCase();return je[e]||""}function Ne(t){return t.split(/,/)[1]}function ut(t){return t.search(/^(data:)/)!==-1}function Ve(t,e){return`data:${e};base64,${t}`}async function _t(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const i=await r.blob();return new Promise((o,a)=>{const s=new FileReader;s.onerror=a,s.onloadend=()=>{try{o(n({res:r,result:s.result}))}catch(l){a(l)}},s.readAsDataURL(i)})}const dt={};function ze(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 ft(t,e,n){const r=ze(t,e,n.includeQueryParams);if(dt[r]!=null)return dt[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const o=await _t(t,n.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),Ne(s)));i=Ve(o,e)}catch(o){i=n.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;o&&(a=typeof o=="string"?o:o.message),a&&console.warn(a)}return dt[r]=i,i}async function We(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):Z(e)}async function qe(t,e){if(t.currentSrc){const o=document.createElement("canvas"),a=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,a==null||a.drawImage(t,0,0,o.width,o.height);const s=o.toDataURL();return Z(s)}const n=t.poster,r=lt(n),i=await ft(n,r,e);return Z(i)}async function Ke(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await tt(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Xe(t,e){return E(t,HTMLCanvasElement)?We(t):E(t,HTMLVideoElement)?qe(t,e):E(t,HTMLIFrameElement)?Ke(t,e):t.cloneNode(Nt(t))}const Ye=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Nt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Ge(t,e,n){var r,i;if(Nt(e))return e;let o=[];return Ye(t)&&t.assignedNodes?o=P(t.assignedNodes()):E(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?o=P(t.contentDocument.body.childNodes):o=P(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),o.length===0||E(t,HTMLVideoElement)||await o.reduce((a,s)=>a.then(()=>tt(s,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Je(t,e,n){const r=e.style;if(!r)return;const i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):Ft(n).forEach(o=>{let a=i.getPropertyValue(o);o==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),E(t,HTMLIFrameElement)&&o==="display"&&a==="inline"&&(a="block"),o==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),r.setProperty(o,a,i.getPropertyPriority(o))})}function Qe(t,e){E(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),E(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Ze(t,e){if(E(t,HTMLSelectElement)){const r=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function tn(t,e,n){return E(e,Element)&&(Je(t,e,n),Ue(t,e,n),Qe(t,e),Ze(t,e)),e}async function en(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let o=0;o<n.length;o++){const s=n[o].getAttribute("xlink:href");if(s){const l=t.querySelector(s),u=document.querySelector(s);!l&&u&&!r[s]&&(r[s]=await tt(u,e,!0))}}const i=Object.values(r);if(i.length){const o="http://www.w3.org/1999/xhtml",a=document.createElementNS(o,"svg");a.setAttribute("xmlns",o),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const s=document.createElementNS(o,"defs");a.appendChild(s);for(let l=0;l<i.length;l++)s.appendChild(i[l]);t.appendChild(a)}return t}async function tt(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>Xe(r,e)).then(r=>Ge(t,r,e)).then(r=>tn(t,r,e)).then(r=>en(r,e))}const Vt=/url\((['"]?)([^'"]+?)\1\)/g,nn=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,rn=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function on(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function an(t){const e=[];return t.replace(Vt,(n,r,i)=>(e.push(i),n)),e.filter(n=>!ut(n))}async function sn(t,e,n,r,i){try{const o=n?Re(e,n):e,a=lt(e);let s;return i||(s=await ft(o,a,r)),t.replace(on(e),`$1${s}$3`)}catch{}return t}function cn(t,{preferredFontFormat:e}){return e?t.replace(rn,n=>{for(;;){const[r,,i]=nn.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function zt(t){return t.search(Vt)!==-1}async function Wt(t,e,n){if(!zt(t))return t;const r=cn(t,n);return an(r).reduce((o,a)=>o.then(s=>sn(s,a,e,n)),Promise.resolve(r))}async function N(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const o=await Wt(i,null,n);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function ln(t,e){await N("background",t,e)||await N("background-image",t,e),await N("mask",t,e)||await N("-webkit-mask",t,e)||await N("mask-image",t,e)||await N("-webkit-mask-image",t,e)}async function un(t,e){const n=E(t,HTMLImageElement);if(!(n&&!ut(t.src))&&!(E(t,SVGImageElement)&&!ut(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await ft(r,lt(r),e);await new Promise((o,a)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...l)=>{try{o(e.onImageErrorHandler(...l))}catch(u){a(u)}}:a;const s=t;s.decode&&(s.decode=o),s.loading==="lazy"&&(s.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function dn(t,e){const r=P(t.childNodes).map(i=>qt(i,e));await Promise.all(r).then(()=>t)}async function qt(t,e){E(t,Element)&&(await ln(t,e),await un(t,e),await dn(t,e))}function fn(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(i=>{n[i]=r[i]}),t}const Kt={};async function Xt(t){let e=Kt[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},Kt[t]=e,e}async function Yt(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async a=>{let s=a.replace(r,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),_t(s,e.fetchRequestInit,({result:l})=>(n=n.replace(a,`url(${l})`),[a,l]))});return Promise.all(o).then(()=>n)}function Gt(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(i,"");const o=/@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=o.exec(r);if(l===null){if(l=s.exec(r),l===null)break;o.lastIndex=s.lastIndex}else s.lastIndex=o.lastIndex;e.push(l[0])}return e}async function hn(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{P(i.cssRules||[]).forEach((o,a)=>{if(o.type===CSSRule.IMPORT_RULE){let s=a+1;const l=o.href,u=Xt(l).then(f=>Yt(f,e)).then(f=>Gt(f).forEach(m=>{try{i.insertRule(m,m.startsWith("@import")?s+=1:i.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:m,error:y})}})).catch(f=>{console.error("Error loading remote css",f.toString())});r.push(u)}})}catch(o){const a=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&r.push(Xt(i.href).then(s=>Yt(s,e)).then(s=>Gt(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",o)}}),Promise.all(r).then(()=>(t.forEach(i=>{if("cssRules"in i)try{P(i.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),n))}function pn(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>zt(e.style.getPropertyValue("src")))}async function mn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=P(t.ownerDocument.styleSheets),r=await hn(n,e);return pn(r)}function Jt(t){return t.trim().replace(/["']/g,"")}function yn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(o=>{e.add(Jt(o))}),Array.from(r.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(t),e}async function gn(t,e){const n=await mn(t,e),r=yn(t);return(await Promise.all(n.filter(o=>r.has(Jt(o.style.fontFamily))).map(o=>{const a=o.parentStyleSheet?o.parentStyleSheet.href:null;return Wt(o.cssText,a,e)}))).join(`
|
|
2
|
+
`)}async function wn(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await gn(t,e);if(n){const r=document.createElement("style"),i=document.createTextNode(n);r.appendChild(i),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function bn(t,e={}){const{width:n,height:r}=Dt(t,e),i=await tt(t,e,!0);return await wn(i,e),await qt(i,e),fn(i,e),await He(i,n,r)}async function Sn(t,e={}){const{width:n,height:r}=Dt(t,e),i=await bn(t,e),o=await Z(i),a=document.createElement("canvas"),s=a.getContext("2d"),l=e.pixelRatio||Te(),u=e.canvasWidth||n,f=e.canvasHeight||r;return a.width=u*l,a.height=f*l,e.skipAutoScale||Ie(a),a.style.width=`${u}`,a.style.height=`${f}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(o,0,0,a.width,a.height),a}async function vn(t,e={}){return(await Sn(t,e)).toDataURL()}const et="data-nf-capture-chrome";function xn(t){return t instanceof Element&&(t.hasAttribute(et)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function En(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(n=>{const r=n.getBoundingClientRect(),i=document.createElement("div");i.setAttribute("data-nf-mask-cover","1"),i.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(i),t.push(i)}),()=>t.forEach(n=>n.remove())}function Mn(){const t=document.querySelector(`[${et}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(et,"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 Cn(){document.querySelectorAll(`[${et}]`).forEach(t=>t.remove())}async function Ln(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=Mn();t&&(t.style.display="none");const r=En();await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i)));try{return await vn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:i=>!xn(i)})}finally{r(),n.remove(),Cn(),t&&(t.style.display=e)}}function $n(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 Rn(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 An(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:$n(e),browser:Rn(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 Qt=new Set(["userId","email","displayName"]),Zt={id:"userId",username:"displayName",name:"displayName"},te=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit","kinds"]),ee={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 kn(t={},e={}){const n=e.warn||ne,r=t&&typeof t=="object"?t:{},i={},o=[];for(const a of Qt)Object.prototype.hasOwnProperty.call(r,a)&&(i[a]=r[a]);for(const[a,s]of Object.entries(Zt))Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(i,s)||(i[s]=r[a]));for(const a of Object.keys(r))Qt.has(a)||Object.prototype.hasOwnProperty.call(Zt,a)||o.push(a);if(o.length){const a=o.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): ${o.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+a)}return i}function Pn(t={},e={}){const n=e.warn||ne,r=t&&typeof t=="object"?t:{},i=Object.keys(r).filter(o=>!te.has(o));if(i.length)for(const o of i){if(ee[o]){n(`Notefully.init: ignoring "${o}". ${ee[o]}`);continue}n(`Notefully.init: ignoring unknown key "${o}". Supported: ${[...te].join(", ")}.`)}}function ne(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const Tn=80;function In(){const t=[],e={};let n=!1;const r=(o,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:o,text:s.slice(0,2e3),at:Date.now()}),t.length>Tn&&t.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(o=>{e[o]=console[o].bind(console),console[o]=(...a)=>{r(o,a),e[o](...a)}}),window.addEventListener("error",o=>{r("error",[o.message||"window.error"])}),window.addEventListener("unhandledrejection",o=>{r("error",[o.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function On(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const i=()=>{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?(i(),!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:i,isSupported:()=>!!e,isActive:()=>r}}const Hn=60*1e3;function Fn({onStart:t,onStop:e,onError:n}){let r=null,i=null,o=[],a=null;const s=()=>{if(a&&(clearTimeout(a),a=null),i&&i.state!=="inactive")try{i.stop()}catch{}r&&(r.getTracks().forEach(f=>f.stop()),r=null)},l=()=>{if(i&&i.state==="recording"){i.stop();return}s(),e(null)};return{start:async()=>{var f,m;if(!((f=navigator.mediaDevices)!=null&&f.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"}),o=[],i=new MediaRecorder(r,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),i.ondataavailable=y=>{y.data&&y.data.size&&o.push(y.data)},i.onstop=()=>{const y=o.length?new Blob(o,{type:i.mimeType||"video/webm"}):null;s(),e(y)},(m=r.getVideoTracks()[0])==null||m.addEventListener("ended",()=>l()),i.start(),a=setTimeout(l,Hn)},stop:l}}function Dn(){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 ht={x:0,y:0,w:1,h:1};function re(){const t=Dn();let e=[],n={...ht},r=1;return{list:()=>e.filter(o=>Un(o,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(o){return n=Bn(o),n},resetCrop(){return n={...ht},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(o,a){const s={id:`s${r++}`,type:o,number:t.alloc(),x:.2,y:.2,w:o==="arrow"?.2:.22,h:o==="arrow"?.05:.16,x2:.4,y2:.28,...a};return e.push(s),s},update(o,a){const s=e.find(l=>l.id===o);return s?(Object.assign(s,a),s):null},remove(o){const a=e.findIndex(l=>l.id===o);if(a<0)return null;const[s]=e.splice(a,1);return t.free(s.number),s},reset(){for(e=[],n={...ht},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function Bn(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),i=Math.min(Math.max(t.h,.05),1-n);return{x:e,y:n,w:r,h:i}}function Un(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 pt(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 jn(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:i,colors:o={}}){const a=o.mark||"#fdd341",s=o.markText||"#2a2140",l=pt(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 f=mt(u.x,n,r),m=yt(u.y,n,i),y=u.w/n.w*r,x=u.h/n.h*i,R=l.stroke/2;if(u.type==="rect")t.strokeRect(f+R,m+R,Math.max(0,y-l.stroke),Math.max(0,x-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(f+y/2,m+x/2,Math.max(.5,y/2-R),Math.max(.5,x/2-R),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const V=mt(u.x2??u.x+u.w,n,r),z=yt(u.y2??u.y,n,i);Nn(t,f,m,V,z,l)}if(u.number==null||u.number==="")return;const F=_n(u,n,r,i,f,m,y),J=String(u.number);t.beginPath(),t.arc(F.x,F.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=a,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(J,F.x,F.y+.5),t.fillStyle=a}),t.restore()}function mt(t,e,n){return(t-e.x)/e.w*n}function yt(t,e,n){return(t-e.y)/e.h*n}function _n(t,e,n,r,i,o,a){if(t.type==="arrow"){const s=mt(t.x2??t.x+t.w,e,n),l=yt(t.y2??t.y,e,r);return{x:(i+s)/2,y:(o+l)/2}}return{x:i+a/2,y:o}}function ie(t,e,n,r,i){const o=Math.atan2(r-e,n-t),a=i.arrowHead,s=Math.min(i.stroke,a*.2),l=n,u=r,f=n-Math.cos(o)*a,m=r-Math.sin(o)*a,y={x:l-a*Math.cos(o-i.arrowHeadAngle),y:u-a*Math.sin(o-i.arrowHeadAngle)},x={x:l-a*Math.cos(o+i.arrowHeadAngle),y:u-a*Math.sin(o+i.arrowHeadAngle)},R={x:n-Math.cos(o)*s,y:r-Math.sin(o)*s};return{angle:o,tipX:l,tipY:u,baseX:f,baseY:m,left:y,right:x,shaftEnd:R}}function Nn(t,e,n,r,i,o){const a=ie(e,n,r,i,o);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 Vn(t,e,n,r={}){return new Promise((i,o)=>{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)),f=Math.max(1,Math.round(e.h*a.height)),m=document.createElement("canvas");m.width=u,m.height=f;const y=m.getContext("2d");y.drawImage(a,s,l,u,f,0,0,u,f),jn(y,{stickers:n,crop:e,width:u,height:f,colors:r}),m.toBlob(x=>{if(!x){o(new Error("Could not encode screenshot"));return}i(x)},"image/png")},a.onerror=()=>o(new Error("Could not load screenshot")),a.src=t})}const B=[{id:"bug",label:"Bug"},{id:"idea",label:"Idea"},{id:"other",label:"Other"}];function oe(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function gt(t){const e=String(t||"").trim();return e?e.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function zn(t){if(!Array.isArray(t)||!t.length)return B.map(r=>({...r}));const e=new Set,n=[];for(const r of t){let i="",o="";typeof r=="string"||typeof r=="number"?(i=oe(r),o=gt(i)):r&&typeof r=="object"&&(i=oe(r.id??r.value??r.kind),o=String(r.label||r.name||gt(i)).trim()||gt(i)),!(!i||e.has(i))&&(e.add(i),n.push({id:i,label:o}))}return n.length?n:B.map(r=>({...r}))}function nt(t){var n;const e=Array.isArray(t)&&t.length?t:B;return e.some(r=>r.id==="bug")?"bug":((n=e[0])==null?void 0:n.id)||"other"}const Wn=["maker","all-business","brighter-day","quiet-night"],ae="maker",qn=new Set(["crop","arrow","rect","circle"]),wt=.02,se=.05,Kn=`
|
|
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 I={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"/>')},
|
|
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 I={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"/>')},ce=In();ce.hook();const le=10,Xn=80,ue="notefully.author",bt="Anonymous";let d={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:ae,video:!1,consoleLogLimit:le,kinds:B.map(t=>({...t}))},L={},h=null,c={},p=re(),S="",q="",k=null,U=nt(B),O=null,$=null,w=null,b=null,rt=null,j=null,K=null,H={w:0,h:0},St=!1,vt=!1;function g(t){return h.querySelector(t)}function de(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return Wn.includes(e)?e:ae}function fe(t,e){return h&&getComputedStyle(h).getPropertyValue(t).trim()||e}async function Yn(t){return(await fetch(t)).blob()}function v(t,e=!1){c.status&&(c.status.textContent=t||"",rt&&(clearTimeout(rt),rt=null),t&&!e&&(rt=setTimeout(()=>{c.status.textContent=""},4e3)))}function xt(){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…">${Kn}</button>
|
|
9
9
|
<div class="nf-dialog" hidden>
|
|
10
10
|
<div class="nf-panel">
|
|
11
|
-
<div class="nf-
|
|
12
|
-
<div class="nf-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
<div class="nf-panel-body">
|
|
12
|
+
<div class="nf-stage">
|
|
13
|
+
<div class="nf-palette">
|
|
14
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${I.crop}</button>
|
|
15
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${I.resetCrop}</button>
|
|
16
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${I.arrow}</button>
|
|
17
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${I.rect}</button>
|
|
18
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${I.circle}</button>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="nf-canvas"></div>
|
|
18
21
|
</div>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<button class="nf-
|
|
22
|
+
<textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
|
|
23
|
+
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
24
|
+
<div class="nf-kind"></div>
|
|
25
|
+
<div class="nf-actions">
|
|
26
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${I.discard}</button>
|
|
27
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${I.audio}</button>
|
|
28
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${I.video}</button>
|
|
29
|
+
<button class="nf-submit" type="button">Submit</button>
|
|
30
|
+
</div>
|
|
31
|
+
<button class="nf-restore" type="button" hidden>Restore screenshot</button>
|
|
32
|
+
<div class="nf-status"></div>
|
|
29
33
|
</div>
|
|
30
|
-
<
|
|
31
|
-
<div class="nf-status"></div>
|
|
34
|
+
<p class="nf-success-msg" hidden aria-live="polite">Submitted!</p>
|
|
32
35
|
</div>
|
|
33
36
|
</div>
|
|
34
37
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
35
|
-
`,document.body.appendChild(f),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},Xn(),it()),f}function it(){var t;f&&(f.dataset.theme=ue(d.theme),d.hideLauncher?f.setAttribute("data-nf-hidden-launcher",""):f.removeAttribute("data-nf-hidden-launcher"),c.video&&(c.video.hidden=!d.video),he(),(t=c.dialog)!=null&&t.hidden&&ot())}function ot(){c.launcher&&(c.launcher.hidden=!!d.hideLauncher)}function Xn(){c.launcher.addEventListener("click",()=>kt()),b(".nf-dialog").addEventListener("click",e=>{e.target===c.dialog&&G()}),f.querySelectorAll(".nf-tool").forEach(e=>{e.addEventListener("click",()=>Et(e.dataset.tool))}),c.resetCrop.addEventListener("click",er),c.canvas.addEventListener("pointerdown",Gn),c.canvas.addEventListener("dragstart",e=>e.preventDefault());const t=b(".nf-kind");t&&t.addEventListener("click",e=>{const n=e.target.closest("[data-kind]");n&&xt(n.dataset.kind)}),c.discard.addEventListener("click",nr),c.restore.addEventListener("click",rr),c.audio.addEventListener("click",ir),c.video.addEventListener("click",or),c.stop.addEventListener("click",()=>K==null?void 0:K.stop()),b(".nf-submit").addEventListener("click",()=>{Pt().catch(e=>v(e.message||"Submit failed."))}),he(),Et(null)}function fe(t){return String(t||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function he(){const t=f==null?void 0:f.querySelector(".nf-kind");if(!t)return;const e=Array.isArray(d.kinds)&&d.kinds.length?d.kinds:U;t.innerHTML=e.map(i=>`<button type="button" data-kind="${fe(i.id)}">${fe(i.label)}</button>`).join("");const r=e.map(i=>i.id).includes(j)?j:nt(e);xt(r)}function xt(t){j=(d.kinds||U).map(n=>n.id).includes(t)?t:nt(d.kinds),f==null||f.querySelectorAll("[data-kind]").forEach(n=>{n.dataset.active=String(n.dataset.kind===j)})}function Et(t){O=zn.has(t)?t:null,$=null,f.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===O)}),c.canvas&&(c.canvas.dataset.draw=O?"true":"false"),S&&C()}function pe(t){return Math.min(1,Math.max(0,t))}function X(){return c.shot||c.canvas}function at(t){const e=X().getBoundingClientRect();return{x:pe((t.clientX-e.left)/Math.max(e.width,1)),y:pe((t.clientY-e.top)/Math.max(e.height,1))}}function Yn(t){const e=X().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function me(t){const e=at(t),n=p.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function st(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(wt,Math.abs(e.x-t.x)),h:Math.max(wt,Math.abs(e.y-t.y))}}function Ct(t){f&&(t?f.dataset.grabbing="true":delete f.dataset.grabbing)}function Mt(t){try{c.canvas.setPointerCapture(t.pointerId)}catch{}}function Lt(){window.addEventListener("pointermove",ge),window.addEventListener("pointerup",ct),window.addEventListener("pointercancel",ct)}function ye(){window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",ct),window.removeEventListener("pointercancel",ct)}function Gn(t){if(t.button!==0||!S)return;if(!t.target.closest(".nf-sticker")&&!Yn(t)){$=null,C();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),$=n.dataset.id,Mt(t),Jn({kind:"sticker",id:$,dir:(e==null?void 0:e.dataset.dir)||"move"},t),C();return}if($=null,O==="crop"){t.preventDefault(),Mt(t),g={kind:"crop",start:at(t),current:at(t)},Lt(),C();return}if(O==="arrow"||O==="rect"||O==="circle"){t.preventDefault(),Mt(t);const r=me(t);g={kind:"sticker",type:O,start:r,current:r},Lt(),C();return}C()}function Jn(t,e){e.preventDefault(),e.stopPropagation();const n=X().getBoundingClientRect(),r=p.list().find(i=>i.id===t.id);w={...t,startX:e.clientX,startY:e.clientY,crop:p.crop(),sticker:r?{...r}:null,rect:n},Ct(t.dir==="move"||t.dir==="start"||t.dir==="end"),Lt()}function ge(t){if(g){g.current=g.kind==="crop"?at(t):me(t),C();return}if(!w)return;const e=(t.clientX-w.startX)/w.rect.width*w.crop.w,n=(t.clientY-w.startY)/w.rect.height*w.crop.h,r=w.sticker;if(r){if(w.dir==="end")p.update(r.id,{x2:r.x2+e,y2:r.y2+n});else if(w.dir==="start")p.update(r.id,{x:r.x+e,y:r.y+n});else if(w.dir==="move")p.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 i={x:r.x,y:r.y,w:r.w,h:r.h};Qn(i,w.dir,e,n),p.update(r.id,i)}C()}}function Qn(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 i=Math.max(.04,t.w-n);t.x+=t.w-i,t.w=i}if(e.includes("n")){const i=Math.max(.04,t.h-r);t.y+=t.h-i,t.h=i}}function ct(t){if(ye(),Ct(!1),g){Zn();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)&&(p.remove(w.id),$=null)}w=null,C()}}function Zn(){const t=g;if(g=null,!t)return;if(t.kind==="crop"){const n=st(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<ae||Math.abs(t.current.y-t.start.y)<ae){C();return}const i=p.crop();p.setCrop({x:i.x+n.x*i.w,y:i.y+n.y*i.h,w:n.w*i.w,h:n.h*i.h}),Y();return}const e=tr(t);e&&($=e.id),C()}function tr(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)<wt?p.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):p.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 p.add(t.type,st(t.start,t.current))}function er(){p.resetCrop(),$=null,Y()}function $t(){c.resetCrop&&(c.resetCrop.hidden=!p.isCropped())}function At(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 nr(){S&&(q=S),S="",c.stage.hidden=!0,c.restore.hidden=!q}function rr(){q&&(S=q,c.stage.hidden=!1,c.restore.hidden=!0,Y())}function ir(){try{if(_||(_=Tn(e=>{const n=c.text.value.trim();c.text.value=n?`${n} ${e}`:e})),!_.isSupported()){v("Audio-to-text is not supported in this browser.");return}const t=_.start();At(t),v(t?"Listening…":"")}catch(t){v(t.message)}}async function or(){if(!d.video){v("Video is disabled on this host.");return}c.dialog.hidden=!0,c.stop.hidden=!1,it(),c.launcher.hidden=!0,K=On({onStart(){},onStop(t){k=t,c.stop.hidden=!0,ot(),c.dialog.hidden=!1,Y(),v(t?"Video attached.":"Recording cancelled.")},onError(t){v(t.message)}});try{await K.start()}catch(t){c.stop.hidden=!0,ot(),c.dialog.hidden=!1,v(t.message)}}function Y(){if(c.shot=null,!S){c.canvas.style.removeProperty("--nf-shot-aspect"),c.canvas.style.removeProperty("aspect-ratio"),c.canvas.innerHTML=k?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(k)}"></video>`:"",$t();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=()=>{ar(t),C()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e()}function ar(t){const e=t.naturalWidth||H.w,n=t.naturalHeight||H.h;if(e&&n&&(H={w:e,h:n},c.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),c.canvas.style.aspectRatio=`${e} / ${n}`),!c.shot||!H.w||!H.h)return;const r=p.crop(),i=H.w/H.h,o=r.w/r.h*i,a=Math.min(1,o/i),s=Math.min(1,i/o);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 sr(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:"",...st(t.start,t.current)}}function C(){if((c.shot||c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(o=>o.remove()),!S||!c.shot){$t();return}const e=p.crop(),n=X(),r=pt(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 o=document.createElement("div");o.className="nf-crop",we(o,st(g.start,g.current),{x:0,y:0,w:1,h:1}),c.shot.appendChild(o)}const i=p.list().slice();if((g==null?void 0:g.kind)==="sticker"&&i.push(sr(g)),i.forEach(o=>{const a=o.id==="preview",s=!a&&o.id===$,l=document.createElement("div");if(l.className=`nf-sticker nf-${o.type}`,l.dataset.id=o.id,s&&(l.dataset.selected="true"),a&&(l.dataset.preview="true"),o.type==="arrow"?cr(l,o,e,s,r):(we(l,o,e),s&&["nw","ne","sw","se"].forEach(u=>Rt(l,u))),!a&&o.number){const u=document.createElement("span");u.className="nf-badge",u.textContent=String(o.number),l.appendChild(u)}c.shot.appendChild(l)}),c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(o=>o.remove()),k){const o=document.createElement("video");o.className="nf-recording-preview",o.controls=!0,o.src=URL.createObjectURL(k),o.style.position="absolute",o.style.right="8px",o.style.bottom="8px",o.style.width="160px",c.canvas.appendChild(o)}$t()}function cr(t,e,n,r,i=pt(400)){const o=X(),a=o.clientWidth,s=o.clientHeight,l=(e.x-n.x)/n.w*a,u=(e.y-n.y)/n.h*s,h=((e.x2??e.x+e.w)-n.x)/n.w*a,m=((e.y2??e.y)-n.y)/n.h*s,y=Math.max(18,i.arrowHead+i.stroke*2),M=Math.min(l,h)-y,A=Math.min(u,m)-y,D=Math.max(2,Math.abs(h-l))+y*2,J=Math.max(2,Math.abs(m-u))+y*2,V=l-M,z=u-A,It=h-M,Ot=m-A,F=re(V,z,It,Ot,i),W=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${M}px`,t.style.top=`${A}px`,t.style.width=`${D}px`,t.style.height=`${J}px`,W.setAttribute("class","nf-arrow-svg"),W.setAttribute("viewBox",`0 0 ${D} ${J}`),W.setAttribute("width",String(D)),W.setAttribute("height",String(J)),W.innerHTML=`
|
|
36
|
-
<line class="nf-arrow-hit" x1="${V}" y1="${z}" x2="${
|
|
37
|
-
<line class="nf-arrow-shaft" x1="${V}" y1="${z}" x2="${
|
|
38
|
-
<polygon class="nf-arrow-head" points="${
|
|
39
|
-
`,t.appendChild(W),r&&(
|
|
38
|
+
`,document.body.appendChild(h),c={launcher:g(".nf-launcher"),dialog:g(".nf-dialog"),panel:g(".nf-panel"),panelBody:g(".nf-panel-body"),successMsg:g(".nf-success-msg"),stage:g(".nf-stage"),canvas:g(".nf-canvas"),text:g(".nf-text"),author:g(".nf-author"),restore:g(".nf-restore"),status:g(".nf-status"),audio:g(".nf-audio"),video:g(".nf-video"),discard:g(".nf-discard-shot"),stop:g(".nf-stop-video"),resetCrop:g(".nf-reset-crop"),submit:g(".nf-submit"),shot:null},Gn(),it()),h}function it(){var t;h&&(h.dataset.theme=de(d.theme),d.hideLauncher?h.setAttribute("data-nf-hidden-launcher",""):h.removeAttribute("data-nf-hidden-launcher"),c.video&&(c.video.hidden=!d.video),pe(),(t=c.dialog)!=null&&t.hidden&&ot())}function ot(){c.launcher&&(c.launcher.hidden=!!d.hideLauncher)}function Gn(){c.launcher.addEventListener("click",()=>Pt()),g(".nf-dialog").addEventListener("click",e=>{vt||e.target===c.dialog&&G()}),h.querySelectorAll(".nf-tool").forEach(e=>{e.addEventListener("click",()=>Mt(e.dataset.tool))}),c.resetCrop.addEventListener("click",rr),c.canvas.addEventListener("pointerdown",Qn),c.canvas.addEventListener("dragstart",e=>e.preventDefault());const t=g(".nf-kind");t&&t.addEventListener("click",e=>{const n=e.target.closest("[data-kind]");n&&Et(n.dataset.kind)}),c.discard.addEventListener("click",ir),c.restore.addEventListener("click",or),c.audio.addEventListener("click",ar),c.video.addEventListener("click",sr),c.stop.addEventListener("click",()=>K==null?void 0:K.stop()),g(".nf-submit").addEventListener("click",()=>{Tt().catch(e=>v(e.message||"Submit failed."))}),pe(),Mt(null)}function he(t){return String(t||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function pe(){const t=h==null?void 0:h.querySelector(".nf-kind");if(!t)return;const e=Array.isArray(d.kinds)&&d.kinds.length?d.kinds:B;t.innerHTML=e.map(i=>`<button type="button" data-kind="${he(i.id)}">${he(i.label)}</button>`).join("");const r=e.map(i=>i.id).includes(U)?U:nt(e);Et(r)}function Et(t){U=(d.kinds||B).map(n=>n.id).includes(t)?t:nt(d.kinds),h==null||h.querySelectorAll("[data-kind]").forEach(n=>{n.dataset.active=String(n.dataset.kind===U)})}function Mt(t){O=qn.has(t)?t:null,$=null,h.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===O)}),c.canvas&&(c.canvas.dataset.draw=O?"true":"false"),S&&C()}function me(t){return Math.min(1,Math.max(0,t))}function X(){return c.shot||c.canvas}function at(t){const e=X().getBoundingClientRect();return{x:me((t.clientX-e.left)/Math.max(e.width,1)),y:me((t.clientY-e.top)/Math.max(e.height,1))}}function Jn(t){const e=X().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function ye(t){const e=at(t),n=p.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function st(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(wt,Math.abs(e.x-t.x)),h:Math.max(wt,Math.abs(e.y-t.y))}}function Ct(t){h&&(t?h.dataset.grabbing="true":delete h.dataset.grabbing)}function Lt(t){try{c.canvas.setPointerCapture(t.pointerId)}catch{}}function $t(){window.addEventListener("pointermove",we),window.addEventListener("pointerup",ct),window.addEventListener("pointercancel",ct)}function ge(){window.removeEventListener("pointermove",we),window.removeEventListener("pointerup",ct),window.removeEventListener("pointercancel",ct)}function Qn(t){if(t.button!==0||!S)return;if(!t.target.closest(".nf-sticker")&&!Jn(t)){$=null,C();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),$=n.dataset.id,Lt(t),Zn({kind:"sticker",id:$,dir:(e==null?void 0:e.dataset.dir)||"move"},t),C();return}if($=null,O==="crop"){t.preventDefault(),Lt(t),w={kind:"crop",start:at(t),current:at(t)},$t(),C();return}if(O==="arrow"||O==="rect"||O==="circle"){t.preventDefault(),Lt(t);const r=ye(t);w={kind:"sticker",type:O,start:r,current:r},$t(),C();return}C()}function Zn(t,e){e.preventDefault(),e.stopPropagation();const n=X().getBoundingClientRect(),r=p.list().find(i=>i.id===t.id);b={...t,startX:e.clientX,startY:e.clientY,crop:p.crop(),sticker:r?{...r}:null,rect:n},Ct(t.dir==="move"||t.dir==="start"||t.dir==="end"),$t()}function we(t){if(w){w.current=w.kind==="crop"?at(t):ye(t),C();return}if(!b)return;const e=(t.clientX-b.startX)/b.rect.width*b.crop.w,n=(t.clientY-b.startY)/b.rect.height*b.crop.h,r=b.sticker;if(r){if(b.dir==="end")p.update(r.id,{x2:r.x2+e,y2:r.y2+n});else if(b.dir==="start")p.update(r.id,{x:r.x+e,y:r.y+n});else if(b.dir==="move")p.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 i={x:r.x,y:r.y,w:r.w,h:r.h};tr(i,b.dir,e,n),p.update(r.id,i)}C()}}function tr(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 i=Math.max(.04,t.w-n);t.x+=t.w-i,t.w=i}if(e.includes("n")){const i=Math.max(.04,t.h-r);t.y+=t.h-i,t.h=i}}function ct(t){if(ge(),Ct(!1),w){er();return}if(b){if(b.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)&&(p.remove(b.id),$=null)}b=null,C()}}function er(){const t=w;if(w=null,!t)return;if(t.kind==="crop"){const n=st(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<se||Math.abs(t.current.y-t.start.y)<se){C();return}const i=p.crop();p.setCrop({x:i.x+n.x*i.w,y:i.y+n.y*i.h,w:n.w*i.w,h:n.h*i.h}),Y();return}const e=nr(t);e&&($=e.id),C()}function nr(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)<wt?p.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):p.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 p.add(t.type,st(t.start,t.current))}function rr(){p.resetCrop(),$=null,Y()}function Rt(){c.resetCrop&&(c.resetCrop.hidden=!p.isCropped())}function At(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 ir(){S&&(q=S),S="",c.stage.hidden=!0,c.restore.hidden=!q}function or(){q&&(S=q,c.stage.hidden=!1,c.restore.hidden=!0,Y())}function ar(){try{if(j||(j=On(e=>{const n=c.text.value.trim();c.text.value=n?`${n} ${e}`:e})),!j.isSupported()){v("Audio-to-text is not supported in this browser.");return}const t=j.start();At(t),v(t?"Listening…":"")}catch(t){v(t.message)}}async function sr(){if(!d.video){v("Video is disabled on this host.");return}c.dialog.hidden=!0,c.stop.hidden=!1,it(),c.launcher.hidden=!0,K=Fn({onStart(){},onStop(t){k=t,c.stop.hidden=!0,ot(),c.dialog.hidden=!1,Y(),v(t?"Video attached.":"Recording cancelled.")},onError(t){v(t.message)}});try{await K.start()}catch(t){c.stop.hidden=!0,ot(),c.dialog.hidden=!1,v(t.message)}}function Y(){if(c.shot=null,!S){c.canvas.style.removeProperty("--nf-shot-aspect"),c.canvas.style.removeProperty("aspect-ratio"),c.canvas.innerHTML=k?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(k)}"></video>`:"",Rt();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=()=>{cr(t),C()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e()}function cr(t){const e=t.naturalWidth||H.w,n=t.naturalHeight||H.h;if(e&&n&&(H={w:e,h:n},c.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),c.canvas.style.aspectRatio=`${e} / ${n}`),!c.shot||!H.w||!H.h)return;const r=p.crop(),i=H.w/H.h,o=r.w/r.h*i,a=Math.min(1,o/i),s=Math.min(1,i/o);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 lr(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:"",...st(t.start,t.current)}}function C(){if((c.shot||c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(o=>o.remove()),!S||!c.shot){Rt();return}const e=p.crop(),n=X(),r=pt(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`),(w==null?void 0:w.kind)==="crop"){const o=document.createElement("div");o.className="nf-crop",be(o,st(w.start,w.current),{x:0,y:0,w:1,h:1}),c.shot.appendChild(o)}const i=p.list().slice();if((w==null?void 0:w.kind)==="sticker"&&i.push(lr(w)),i.forEach(o=>{const a=o.id==="preview",s=!a&&o.id===$,l=document.createElement("div");if(l.className=`nf-sticker nf-${o.type}`,l.dataset.id=o.id,s&&(l.dataset.selected="true"),a&&(l.dataset.preview="true"),o.type==="arrow"?ur(l,o,e,s,r):(be(l,o,e),s&&["nw","ne","sw","se"].forEach(u=>kt(l,u))),!a&&o.number){const u=document.createElement("span");u.className="nf-badge",u.textContent=String(o.number),l.appendChild(u)}c.shot.appendChild(l)}),c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(o=>o.remove()),k){const o=document.createElement("video");o.className="nf-recording-preview",o.controls=!0,o.src=URL.createObjectURL(k),o.style.position="absolute",o.style.right="8px",o.style.bottom="8px",o.style.width="160px",c.canvas.appendChild(o)}Rt()}function ur(t,e,n,r,i=pt(400)){const o=X(),a=o.clientWidth,s=o.clientHeight,l=(e.x-n.x)/n.w*a,u=(e.y-n.y)/n.h*s,f=((e.x2??e.x+e.w)-n.x)/n.w*a,m=((e.y2??e.y)-n.y)/n.h*s,y=Math.max(18,i.arrowHead+i.stroke*2),x=Math.min(l,f)-y,R=Math.min(u,m)-y,F=Math.max(2,Math.abs(f-l))+y*2,J=Math.max(2,Math.abs(m-u))+y*2,V=l-x,z=u-R,Ot=f-x,Ht=m-R,D=ie(V,z,Ot,Ht,i),W=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${x}px`,t.style.top=`${R}px`,t.style.width=`${F}px`,t.style.height=`${J}px`,W.setAttribute("class","nf-arrow-svg"),W.setAttribute("viewBox",`0 0 ${F} ${J}`),W.setAttribute("width",String(F)),W.setAttribute("height",String(J)),W.innerHTML=`
|
|
39
|
+
<line class="nf-arrow-hit" x1="${V}" y1="${z}" x2="${Ot}" y2="${Ht}" />
|
|
40
|
+
<line class="nf-arrow-shaft" x1="${V}" y1="${z}" x2="${D.shaftEnd.x}" y2="${D.shaftEnd.y}" />
|
|
41
|
+
<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(W),r&&(kt(t,"start",{left:V-5,top:z-5}),kt(t,"end",{left:Ot-5,top:Ht-5}))}function kt(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 be(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 dr(){try{return String(localStorage.getItem(ue)||"").trim()}catch{return""}}function fr(t){const e=String(t||"").trim();if(!(!e||e===bt))try{localStorage.setItem(ue,e)}catch{}}function Se(){return!!(String(L.userId||"").trim()||String(L.email||"").trim()||String(L.displayName||"").trim())}function hr(){return String(L.displayName||L.email||L.userId||"").trim()}function pr(){var e;if(Se())return hr()||bt;const t=String(((e=c.author)==null?void 0:e.value)||"").trim();return t?(fr(t),t):bt}function ve(){if(!c.author)return;const t=Se();if(c.author.hidden=t,t){c.author.value="";return}c.author.value=dr()}function xe(t,e=le){const n=Number(t);return Number.isFinite(n)?Math.min(Xn,Math.max(0,Math.floor(n))):e}function Ee(t={}){Pn(t);const e=Object.prototype.hasOwnProperty.call(t,"kinds");return d={...d,endpoint:String(t.endpoint||d.endpoint||"").replace(/\/$/,""),projectKey:t.projectKey==null?d.projectKey:String(t.projectKey),version:t.version==null?d.version:String(t.version),name:t.name==null?d.name:String(t.name||""),targets:t.targets===void 0?d.targets:t.targets,hideLauncher:t.hideLauncher==null?d.hideLauncher:!!t.hideLauncher,theme:de(t.theme??d.theme),video:t.video==null?d.video:!!t.video,consoleLogLimit:t.consoleLogLimit==null?d.consoleLogLimit:xe(t.consoleLogLimit,d.consoleLogLimit),kinds:e?zn(t.kinds):d.kinds},xt(),it(),It}async function Pt(){xt(),Me(),it(),c.launcher.hidden=!0,p=re(),H={w:0,h:0},k=null,$=null,w=null,b=null,U=nt(d.kinds),Et(U),Mt(null),At(!1),c.text.value="",ve(),v("");try{S=await Ln(),q=S,c.stage.hidden=!1,c.restore.hidden=!0,v("")}catch{S="",v("Screenshot failed; you can still send text.")}c.dialog.hidden=!1,Y(),c.text.focus()}function G(){h&&(j==null||j.stop(),At(!1),ge(),w=null,b=null,Ct(!1),Me(),c.dialog.hidden=!0,c.stop.hidden=!0,ot())}function mr(){const t=c.dialog,e=c.panel,n=c.panelBody,r=c.successMsg;if(!t||!e||!n||!r)return Promise.resolve();vt=!0,v("");const i=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,o=e.getBoundingClientRect();if(n.hidden=!0,r.hidden=!1,t.classList.add("nf-success"),t.style.opacity="1",i)return new Promise(u=>{window.setTimeout(()=>u(),1e3)});const a=e.getBoundingClientRect(),s=a.width>0?o.width/a.width:1,l=a.height>0?o.height/a.height:1;return e.style.transformOrigin="center center",e.style.transition="none",e.style.transform=`scale(${s}, ${l})`,e.getBoundingClientRect(),new Promise(u=>{let f=!1;const m=()=>{f||(f=!0,e.removeEventListener("transitionend",y),window.setTimeout(()=>{t.style.transition="opacity 0.28s ease",t.style.opacity="0",window.setTimeout(()=>u(),280)},1e3))},y=x=>{x.target!==e||x.propertyName!=="transform"||m()};e.addEventListener("transitionend",y),requestAnimationFrame(()=>{e.style.transition="transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)",e.style.transform="scale(1)"}),window.setTimeout(m,700)})}function Me(){vt=!1,c.dialog&&(c.dialog.classList.remove("nf-success"),c.dialog.style.opacity="",c.dialog.style.transition="",c.panel&&(c.panel.style.transform="",c.panel.style.transition="",c.panel.style.transformOrigin=""),c.panelBody&&(c.panelBody.hidden=!1),c.successMsg&&(c.successMsg.hidden=!0))}function Ce(t={}){L={...L,...kn(t)},ve()}async function Tt(){if(xt(),St)return null;const t=c.text.value.trim();if(!t&&!S&&!k)return v("Add a note, screenshot, or video first."),null;if(!d.endpoint||!d.projectKey)return v("Notefully is missing endpoint or projectKey."),null;St=!0,Le(!0),v("Submitting…",!0);try{const e=pr(),n=new FormData;if(n.append("message",t),n.append("kind",U),n.append("version",d.version||"0.0.0"),n.append("author",e),d.name&&n.append("name",d.name),n.append("context",JSON.stringify({...An({...L,displayName:L.displayName||e}),author:e,console:ce.snapshot().slice(-xe(d.consoleLogLimit))})),n.append("annotations",JSON.stringify(p.list())),n.append("crop",JSON.stringify(p.crop())),Array.isArray(d.targets)&&n.append("targets",JSON.stringify(d.targets)),S){const o=await Yn(S);if(n.append("screenshot",o,"screenshot.png"),p.list().length||p.isCropped()){const a=await Vn(S,p.crop(),p.list(),{mark:fe("--nf-mark","#fdd341"),markText:fe("--nf-mark-text","#2a2140")});n.append("screenshotBaked",a,"screenshot.baked.png")}}k&&n.append("recording",k,"recording.webm");const r=await fetch(`${d.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":d.projectKey},body:n});let i=null;try{i=await r.json()}catch{i=null}if(!r.ok)throw v((i==null?void 0:i.error)||"Submit failed."),new Error((i==null?void 0:i.error)||`Submit failed (${r.status})`);return await mr(),G(),i}finally{St=!1,Le(!1)}}function Le(t){c.submit&&(c.submit.disabled=!!t,c.submit.setAttribute("aria-busy",t?"true":"false"))}function $e(){G(),h==null||h.remove(),h=null,c={}}const It={init:Ee,open:Pt,close:G,identify:Ce,submit:Tt,destroy:$e};return typeof window<"u"&&(window.Notefully=It),A.close=G,A.default=It,A.destroy=$e,A.identify=Ce,A.init=Ee,A.open=Pt,A.submit=Tt,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),A})({});
|