makethisbetter 1.5.1 → 1.5.2

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.
Files changed (42) hide show
  1. package/dist/api/client.d.ts.map +1 -1
  2. package/dist/i18n/de.d.ts +2 -0
  3. package/dist/i18n/de.d.ts.map +1 -1
  4. package/dist/i18n/en.d.ts +2 -0
  5. package/dist/i18n/en.d.ts.map +1 -1
  6. package/dist/i18n/es.d.ts +2 -0
  7. package/dist/i18n/es.d.ts.map +1 -1
  8. package/dist/i18n/fr.d.ts +2 -0
  9. package/dist/i18n/fr.d.ts.map +1 -1
  10. package/dist/i18n/ja.d.ts +2 -0
  11. package/dist/i18n/ja.d.ts.map +1 -1
  12. package/dist/i18n/ko.d.ts +2 -0
  13. package/dist/i18n/ko.d.ts.map +1 -1
  14. package/dist/i18n/zh-CN.d.ts +2 -0
  15. package/dist/i18n/zh-CN.d.ts.map +1 -1
  16. package/dist/makethisbetter.cjs +42 -25
  17. package/dist/makethisbetter.cjs.map +1 -1
  18. package/dist/makethisbetter.esm.js +384 -336
  19. package/dist/makethisbetter.esm.js.map +1 -1
  20. package/dist/makethisbetter.js +42 -25
  21. package/dist/makethisbetter.js.map +1 -1
  22. package/dist/popup/clarify.d.ts +3 -0
  23. package/dist/popup/clarify.d.ts.map +1 -1
  24. package/dist/screenshot/capture.d.ts.map +1 -1
  25. package/dist/widget/controller.d.ts +1 -0
  26. package/dist/widget/controller.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/api/client.ts +2 -1
  29. package/src/i18n/de.ts +3 -1
  30. package/src/i18n/en.ts +3 -1
  31. package/src/i18n/es.ts +3 -1
  32. package/src/i18n/fr.ts +3 -1
  33. package/src/i18n/ja.ts +3 -1
  34. package/src/i18n/ko.ts +3 -1
  35. package/src/i18n/zh-CN.ts +3 -1
  36. package/src/popup/clarify.test.ts +67 -25
  37. package/src/popup/clarify.ts +61 -19
  38. package/src/screenshot/capture.test.ts +14 -12
  39. package/src/screenshot/capture.ts +8 -2
  40. package/src/styles/widget.css +137 -57
  41. package/src/widget/controller.test.ts +45 -0
  42. package/src/widget/controller.ts +11 -5
@@ -1,9 +1,9 @@
1
- const pt = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;line-height:1.5;color:#191a1c;-webkit-font-smoothing:antialiased}:host([data-mtb-theme="dark"]) .mtb-popup,:host([data-mtb-theme="dark"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-popup-title,:host([data-mtb-theme="dark"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-quick-option,:host([data-mtb-theme="dark"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-close,:host([data-mtb-theme="dark"]) .mtb-success-msg,:host([data-mtb-theme="dark"]) .mtb-close-link{color:#ffffffad}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-popup,:host([data-mtb-theme="auto"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-popup-title,:host([data-mtb-theme="auto"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-quick-option,:host([data-mtb-theme="auto"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-close,:host([data-mtb-theme="auto"]) .mtb-success-msg,:host([data-mtb-theme="auto"]) .mtb-close-link{color:#ffffffad}}.mtb-tab{position:fixed;top:50%;right:0;transform:translateY(-50%);z-index:2147483646;display:flex;align-items:center;justify-content:center;width:32px;padding:14px 0;background:#059669;color:#fff;border-radius:8px 0 0 8px;cursor:pointer;box-shadow:-2px 0 14px #05966959;transition:background .15s,box-shadow .15s,width .15s;writing-mode:vertical-lr;text-orientation:mixed;font-size:12px;font-weight:600;letter-spacing:.04em;user-select:none;border:none;outline:none}.mtb-tab.left{right:auto;left:0;border-radius:0 8px 8px 0;box-shadow:2px 0 14px #05966959}.mtb-tab:hover{background:#047857;box-shadow:-3px 0 20px #05966980}.mtb-tab.active{background:#065f46}.mtb-toolbar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:11px;height:46px;padding:0 7px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbBarIn .2s ease;white-space:nowrap}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar-modes{display:flex;align-items:center;gap:3px;background:#ffffff29;border-radius:9px;padding:3px}.mtb-toolbar-mode-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:7px;border:none;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;white-space:nowrap;background:transparent;color:#fffffff2;transition:all .12s}.mtb-toolbar-mode-btn.active{background:#fff;color:#047857}.mtb-toolbar-hint{font-size:12px;color:#fffffff2;white-space:nowrap}.mtb-toolbar-sep{width:1px;height:20px;background:#ffffff38}.mtb-exit-btn{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 12px;border-radius:8px;font-size:11.5px;font-weight:500;color:#fff;cursor:pointer;background:#ffffff29;border:none;font-family:inherit;transition:background .12s}.mtb-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair}.mtb-dim{position:fixed;inset:0;z-index:2147483639;background:#00000014}.mtb-highlight{position:fixed;z-index:2147483641;pointer-events:none;border:2px solid #10b981;border-radius:6px;background:#10b9810f;transition:all .08s ease}.mtb-highlight-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%);background:#064e3b;color:#fff;padding:4px 10px;border-radius:6px;font-size:11px;font-weight:500;white-space:nowrap;box-shadow:0 4px 12px #0000002e}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-color:#064e3b}.mtb-draw-svg{position:fixed;inset:0;z-index:2147483643;pointer-events:none;width:100%;height:100%;overflow:visible}.mtb-pin{position:fixed;z-index:2147483644;pointer-events:none;width:22px;height:22px;border-radius:50% 50% 50% 2px;background:#059669;border:2px solid #fff;display:flex;align-items:center;justify-content:center;font-size:10px;color:#fff;font-weight:700;box-shadow:0 2px 8px #05966973;animation:mtbPinPop .25s cubic-bezier(.34,1.56,.64,1);transform:translate(-50%,-50%)}@keyframes mtbPinPop{0%{transform:translate(-50%,-50%) scale(.4)}to{transform:translate(-50%,-50%) scale(1)}}.mtb-popup{position:fixed;z-index:2147483645;width:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:14px;box-shadow:0 12px 40px #00000029;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{padding:11px 13px 11px 14px;border-bottom:1px solid rgba(0,0,0,.06);display:flex;align-items:center;gap:8px}.mtb-popup-icon{width:20px;height:20px;border-radius:5px;background:#10b9811a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-popup-title{flex:1;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#191a1c}.mtb-popup-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;align-items:center;border-radius:4px;transition:color .12s}.mtb-popup-close:hover{color:#000000b3}.mtb-popup-body{padding:13px}.mtb-quick-options{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}.mtb-quick-option{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border:1px solid rgba(0,0,0,.09);border-radius:10px;background:#fafafa;cursor:pointer;font-family:inherit;font-size:13px;color:#191a1c;text-align:left;transition:all .12s}.mtb-quick-option:hover{background:#10b9810f;border-color:#10b9814d}.mtb-quick-option-emoji{font-size:15px;flex-shrink:0;line-height:1}.mtb-textarea-wrap{position:relative}.mtb-textarea{width:100%;height:64px;padding:9px 11px;border:1px solid rgba(0,0,0,.12);border-radius:9px;font-family:inherit;font-size:12.5px;line-height:1.5;color:#191a1c;outline:none;background:#fff;resize:none;transition:border-color .12s,box-shadow .12s}.mtb-textarea:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b9811f}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#b91c1c;font-size:11.5px}.mtb-popup-error:empty,.mtb-popup-error[hidden]{display:none}.mtb-popup-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.mtb-cancel-btn,.mtb-submit-btn{min-width:72px;height:30px;border:none;border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-cancel-btn{background:#f3f4f6;color:#000000ad}.mtb-cancel-btn:hover{background:#e5e7eb}.mtb-submit-btn{background:#d1d5db;color:#fff}.mtb-submit-btn.ready{background:#059669}.mtb-submit-btn.ready:hover{background:#047857}.mtb-submit-btn.loading{background:#059669;opacity:.7;cursor:wait}.mtb-submit-btn:disabled{cursor:not-allowed}.mtb-success{position:fixed;z-index:2147483645;width:300px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;padding:26px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.mtb-success-icon{width:44px;height:44px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:6px;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-close-link{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:#000000b3}.mtb-email-capture{margin-bottom:14px;text-align:left}.mtb-email-prompt{font-size:12px;color:#0000008c;line-height:1.5;margin-bottom:8px}.mtb-email-row{display:flex;gap:6px}.mtb-email-input{flex:1;min-width:0;font-size:12.5px;font-family:inherit;padding:7px 10px;border:1px solid rgba(0,0,0,.14);border-radius:8px;outline:none}.mtb-email-input:focus{border-color:#059669}.mtb-email-input.mtb-email-invalid{border-color:#dc2626}.mtb-email-submit{font-size:12px;font-weight:600;font-family:inherit;color:#fff;background:#059669;border:none;border-radius:8px;padding:7px 12px;cursor:pointer;white-space:nowrap}.mtb-email-submit:disabled{opacity:.6;cursor:default}.mtb-email-error{font-size:11.5px;color:#dc2626;margin-top:6px}.mtb-email-saved{font-size:12px;color:#059669;line-height:1.5}.mtb-my-feedback{display:block;margin:8px auto 0;background:none;border:none;cursor:pointer;font-size:11.5px;font-family:inherit;color:#0006;text-decoration:underline;text-underline-offset:2px;transition:color .12s}.mtb-my-feedback:hover{color:#059669}.mtb-pet{position:fixed;bottom:20px;right:20px;z-index:2147483646;cursor:pointer;width:52px;height:52px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:transparent;animation:mtbPetBounce 3s ease-in-out infinite;transition:transform .2s;user-select:none;outline:none;filter:drop-shadow(0 4px 12px rgba(5,150,105,.35))}.mtb-pet:hover{transform:scale(1.12);animation-play-state:paused}.mtb-pet:hover .mtb-pet-bubble{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet.active{animation:none;opacity:.6}.mtb-pet-svg{display:block}@keyframes mtbPetBounce{0%,to{transform:translateY(0)}50%{transform:translateY(-6px)}}.mtb-pet-bubble{position:absolute;bottom:100%;left:50%;transform:translate(-50%) translateY(4px);margin-bottom:8px;background:#064e3b;color:#fff;padding:6px 12px;border-radius:8px;font-size:12px;font-weight:500;white-space:nowrap;box-shadow:0 4px 14px #0000002e;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}.mtb-pet-bubble.visible{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet-bubble.hidden{opacity:0;pointer-events:none}.mtb-pet-bubble:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:5px solid transparent;border-top-color:#064e3b}.mtb-frustration-prompt{position:fixed;bottom:20px;right:20px;z-index:2147483645;display:flex;align-items:center;gap:10px;padding:12px 16px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:12px;box-shadow:0 8px 30px #0000001f;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}:host([data-mtb-theme="dark"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}}.mtb-frustration-icon{width:32px;height:32px;border-radius:50%;background:#eab3081a;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:16px;line-height:1}.mtb-frustration-text{font-size:13px;font-weight:500;color:inherit;line-height:1.4}.mtb-frustration-actions{display:flex;gap:6px;flex-shrink:0}.mtb-frustration-tell{height:28px;padding:0 12px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-frustration-tell:hover{background:#047857}.mtb-frustration-dismiss{height:28px;padding:0 8px;border:none;border-radius:7px;background:transparent;color:#0006;cursor:pointer;font-family:inherit;font-size:12px;transition:color .12s}.mtb-frustration-dismiss:hover{color:#000000b3}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}}.mtb-record-bar{position:fixed;bottom:24px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:12px;height:42px;padding:0 8px 0 14px;border-radius:12px;background:#0f172aeb;box-shadow:0 8px 24px #00000040;animation:mtbBarIn .2s ease}.mtb-record-dot{width:8px;height:8px;border-radius:50%;background:#ef4444;animation:mtbRecordPulse 1.2s ease-in-out infinite;flex-shrink:0}@keyframes mtbRecordPulse{0%,to{opacity:1}50%{opacity:.3}}.mtb-record-timer{font-family:JetBrains Mono,SF Mono,Fira Code,Cascadia Code,monospace;font-size:13px;font-weight:500;color:#fff;font-variant-numeric:tabular-nums;letter-spacing:.02em;min-width:38px}.mtb-record-stop{height:28px;padding:0 14px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-record-stop:hover{background:#047857}.mtb-click-ripple{position:fixed;z-index:2147483644;width:24px;height:24px;border-radius:50%;border:2px solid #10b981;background:#10b98133;pointer-events:none;transform:translate(-50%,-50%) scale(.5);animation:mtbClickRipple .3s ease-out forwards}@keyframes mtbClickRipple{0%{transform:translate(-50%,-50%) scale(.5);opacity:1}to{transform:translate(-50%,-50%) scale(2);opacity:0}}.mtb-dot{display:inline-block;width:4px;height:4px;border-radius:50%;background:#fff;animation:mtbDot 1.2s infinite}.mtb-dot:nth-child(2){animation-delay:.2s}.mtb-dot:nth-child(3){animation-delay:.4s}@keyframes mtbDot{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}.mtb-clarify{position:fixed;z-index:2147483645;width:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;display:flex;flex-direction:column;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;overflow:hidden}.mtb-clarify-header{padding:10px 13px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:26px;height:26px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-clarify-skip{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-clarify-skip:hover{color:#000000b3}.mtb-clarify-messages{flex:1;max-height:240px;overflow-y:auto;padding:12px 13px;display:flex;flex-direction:column;gap:8px}.mtb-clarify-bubble{max-width:85%;padding:8px 12px;border-radius:12px;font-size:13px;line-height:1.5;word-wrap:break-word}.mtb-clarify-ai{align-self:flex-start;background:#f3f4f6;color:#191a1c;border-bottom-left-radius:4px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border-bottom-right-radius:4px}.mtb-clarify-thinking{display:flex;align-items:center;gap:3px;padding:10px 16px}.mtb-clarify-thinking .mtb-dot{background:#9ca3af}.mtb-clarify-footer{padding:10px 13px;border-top:1px solid rgba(0,0,0,.06);display:flex;gap:8px}.mtb-clarify-input{flex:1;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:12.5px;color:#191a1c;outline:none;background:#fff;transition:border-color .12s,box-shadow .12s}.mtb-clarify-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b9811f}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-send{height:32px;padding:0 14px;border:none;border-radius:8px;background:#d1d5db;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s;flex-shrink:0}.mtb-clarify-send:not(:disabled){background:#059669}.mtb-clarify-send:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled{cursor:not-allowed}:host([data-mtb-theme="dark"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-footer{border-top-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-skip{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover{color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-ai{background:#1f2327;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-footer{border-top-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-skip{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover{color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-ai{background:#1f2327;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}}';
2
- class ft {
1
+ const bt = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;line-height:1.5;color:#191a1c;-webkit-font-smoothing:antialiased}:host([data-mtb-theme="dark"]) .mtb-popup,:host([data-mtb-theme="dark"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-popup-title,:host([data-mtb-theme="dark"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-quick-option,:host([data-mtb-theme="dark"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-close,:host([data-mtb-theme="dark"]) .mtb-success-msg,:host([data-mtb-theme="dark"]) .mtb-close-link{color:#ffffffad}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-popup,:host([data-mtb-theme="auto"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-popup-title,:host([data-mtb-theme="auto"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-quick-option,:host([data-mtb-theme="auto"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-close,:host([data-mtb-theme="auto"]) .mtb-success-msg,:host([data-mtb-theme="auto"]) .mtb-close-link{color:#ffffffad}}.mtb-tab{position:fixed;top:50%;right:0;transform:translateY(-50%);z-index:2147483646;display:flex;align-items:center;justify-content:center;width:32px;padding:14px 0;background:#059669;color:#fff;border-radius:8px 0 0 8px;cursor:pointer;box-shadow:-2px 0 14px #05966959;transition:background .15s,box-shadow .15s,width .15s;writing-mode:vertical-lr;text-orientation:mixed;font-size:12px;font-weight:600;letter-spacing:.04em;user-select:none;border:none;outline:none}.mtb-tab.left{right:auto;left:0;border-radius:0 8px 8px 0;box-shadow:2px 0 14px #05966959}.mtb-tab:hover{background:#047857;box-shadow:-3px 0 20px #05966980}.mtb-tab.active{background:#065f46}.mtb-toolbar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:11px;height:46px;padding:0 7px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbBarIn .2s ease;white-space:nowrap}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar-modes{display:flex;align-items:center;gap:3px;background:#ffffff29;border-radius:9px;padding:3px}.mtb-toolbar-mode-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:7px;border:none;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;white-space:nowrap;background:transparent;color:#fffffff2;transition:all .12s}.mtb-toolbar-mode-btn.active{background:#fff;color:#047857}.mtb-toolbar-hint{font-size:12px;color:#fffffff2;white-space:nowrap}.mtb-toolbar-sep{width:1px;height:20px;background:#ffffff38}.mtb-exit-btn{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 12px;border-radius:8px;font-size:11.5px;font-weight:500;color:#fff;cursor:pointer;background:#ffffff29;border:none;font-family:inherit;transition:background .12s}.mtb-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair}.mtb-dim{position:fixed;inset:0;z-index:2147483639;background:#00000014}.mtb-highlight{position:fixed;z-index:2147483641;pointer-events:none;border:2px solid #10b981;border-radius:6px;background:#10b9810f;transition:all .08s ease}.mtb-highlight-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%);background:#064e3b;color:#fff;padding:4px 10px;border-radius:6px;font-size:11px;font-weight:500;white-space:nowrap;box-shadow:0 4px 12px #0000002e}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-color:#064e3b}.mtb-draw-svg{position:fixed;inset:0;z-index:2147483643;pointer-events:none;width:100%;height:100%;overflow:visible}.mtb-pin{position:fixed;z-index:2147483644;pointer-events:none;width:22px;height:22px;border-radius:50% 50% 50% 2px;background:#059669;border:2px solid #fff;display:flex;align-items:center;justify-content:center;font-size:10px;color:#fff;font-weight:700;box-shadow:0 2px 8px #05966973;animation:mtbPinPop .25s cubic-bezier(.34,1.56,.64,1);transform:translate(-50%,-50%)}@keyframes mtbPinPop{0%{transform:translate(-50%,-50%) scale(.4)}to{transform:translate(-50%,-50%) scale(1)}}.mtb-popup{position:fixed;z-index:2147483645;width:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:14px;box-shadow:0 12px 40px #00000029;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{padding:11px 13px 11px 14px;border-bottom:1px solid rgba(0,0,0,.06);display:flex;align-items:center;gap:8px}.mtb-popup-icon{width:20px;height:20px;border-radius:5px;background:#10b9811a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-popup-title{flex:1;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#191a1c}.mtb-popup-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;align-items:center;border-radius:4px;transition:color .12s}.mtb-popup-close:hover{color:#000000b3}.mtb-popup-body{padding:13px}.mtb-quick-options{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}.mtb-quick-option{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border:1px solid rgba(0,0,0,.09);border-radius:10px;background:#fafafa;cursor:pointer;font-family:inherit;font-size:13px;color:#191a1c;text-align:left;transition:all .12s}.mtb-quick-option:hover{background:#10b9810f;border-color:#10b9814d}.mtb-quick-option-emoji{font-size:15px;flex-shrink:0;line-height:1}.mtb-textarea-wrap{position:relative}.mtb-textarea{width:100%;height:64px;padding:9px 11px;border:1px solid rgba(0,0,0,.12);border-radius:9px;font-family:inherit;font-size:12.5px;line-height:1.5;color:#191a1c;outline:none;background:#fff;resize:none;transition:border-color .12s,box-shadow .12s}.mtb-textarea:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b9811f}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#b91c1c;font-size:11.5px}.mtb-popup-error:empty,.mtb-popup-error[hidden]{display:none}.mtb-popup-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.mtb-cancel-btn,.mtb-submit-btn{min-width:72px;height:30px;border:none;border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-cancel-btn{background:#f3f4f6;color:#000000ad}.mtb-cancel-btn:hover{background:#e5e7eb}.mtb-submit-btn{background:#d1d5db;color:#fff}.mtb-submit-btn.ready{background:#059669}.mtb-submit-btn.ready:hover{background:#047857}.mtb-submit-btn.loading{background:#059669;opacity:.7;cursor:wait}.mtb-submit-btn:disabled{cursor:not-allowed}.mtb-success{position:fixed;z-index:2147483645;width:300px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;padding:26px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.mtb-success-icon{width:44px;height:44px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:6px;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-close-link{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:#000000b3}.mtb-email-capture{margin-bottom:14px;text-align:left}.mtb-email-prompt{font-size:12px;color:#0000008c;line-height:1.5;margin-bottom:8px}.mtb-email-row{display:flex;gap:6px}.mtb-email-input{flex:1;min-width:0;font-size:12.5px;font-family:inherit;padding:7px 10px;border:1px solid rgba(0,0,0,.14);border-radius:8px;outline:none}.mtb-email-input:focus{border-color:#059669}.mtb-email-input.mtb-email-invalid{border-color:#dc2626}.mtb-email-submit{font-size:12px;font-weight:600;font-family:inherit;color:#fff;background:#059669;border:none;border-radius:8px;padding:7px 12px;cursor:pointer;white-space:nowrap}.mtb-email-submit:disabled{opacity:.6;cursor:default}.mtb-email-error{font-size:11.5px;color:#dc2626;margin-top:6px}.mtb-email-saved{font-size:12px;color:#059669;line-height:1.5}.mtb-my-feedback{display:block;margin:8px auto 0;background:none;border:none;cursor:pointer;font-size:11.5px;font-family:inherit;color:#0006;text-decoration:underline;text-underline-offset:2px;transition:color .12s}.mtb-my-feedback:hover{color:#059669}.mtb-pet{position:fixed;bottom:20px;right:20px;z-index:2147483646;cursor:pointer;width:52px;height:52px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:transparent;animation:mtbPetBounce 3s ease-in-out infinite;transition:transform .2s;user-select:none;outline:none;filter:drop-shadow(0 4px 12px rgba(5,150,105,.35))}.mtb-pet:hover{transform:scale(1.12);animation-play-state:paused}.mtb-pet:hover .mtb-pet-bubble{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet.active{animation:none;opacity:.6}.mtb-pet-svg{display:block}@keyframes mtbPetBounce{0%,to{transform:translateY(0)}50%{transform:translateY(-6px)}}.mtb-pet-bubble{position:absolute;bottom:100%;left:50%;transform:translate(-50%) translateY(4px);margin-bottom:8px;background:#064e3b;color:#fff;padding:6px 12px;border-radius:8px;font-size:12px;font-weight:500;white-space:nowrap;box-shadow:0 4px 14px #0000002e;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}.mtb-pet-bubble.visible{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet-bubble.hidden{opacity:0;pointer-events:none}.mtb-pet-bubble:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:5px solid transparent;border-top-color:#064e3b}.mtb-frustration-prompt{position:fixed;bottom:20px;right:20px;z-index:2147483645;display:flex;align-items:center;gap:10px;padding:12px 16px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:12px;box-shadow:0 8px 30px #0000001f;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}:host([data-mtb-theme="dark"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}}.mtb-frustration-icon{width:32px;height:32px;border-radius:50%;background:#eab3081a;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:16px;line-height:1}.mtb-frustration-text{font-size:13px;font-weight:500;color:inherit;line-height:1.4}.mtb-frustration-actions{display:flex;gap:6px;flex-shrink:0}.mtb-frustration-tell{height:28px;padding:0 12px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-frustration-tell:hover{background:#047857}.mtb-frustration-dismiss{height:28px;padding:0 8px;border:none;border-radius:7px;background:transparent;color:#0006;cursor:pointer;font-family:inherit;font-size:12px;transition:color .12s}.mtb-frustration-dismiss:hover{color:#000000b3}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}}.mtb-record-bar{position:fixed;bottom:24px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:12px;height:42px;padding:0 8px 0 14px;border-radius:12px;background:#0f172aeb;box-shadow:0 8px 24px #00000040;animation:mtbBarIn .2s ease}.mtb-record-dot{width:8px;height:8px;border-radius:50%;background:#ef4444;animation:mtbRecordPulse 1.2s ease-in-out infinite;flex-shrink:0}@keyframes mtbRecordPulse{0%,to{opacity:1}50%{opacity:.3}}.mtb-record-timer{font-family:JetBrains Mono,SF Mono,Fira Code,Cascadia Code,monospace;font-size:13px;font-weight:500;color:#fff;font-variant-numeric:tabular-nums;letter-spacing:.02em;min-width:38px}.mtb-record-stop{height:28px;padding:0 14px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-record-stop:hover{background:#047857}.mtb-click-ripple{position:fixed;z-index:2147483644;width:24px;height:24px;border-radius:50%;border:2px solid #10b981;background:#10b98133;pointer-events:none;transform:translate(-50%,-50%) scale(.5);animation:mtbClickRipple .3s ease-out forwards}@keyframes mtbClickRipple{0%{transform:translate(-50%,-50%) scale(.5);opacity:1}to{transform:translate(-50%,-50%) scale(2);opacity:0}}.mtb-dot{display:inline-block;width:4px;height:4px;border-radius:50%;background:#fff;animation:mtbDot 1.2s infinite}.mtb-dot:nth-child(2){animation-delay:.2s}.mtb-dot:nth-child(3){animation-delay:.4s}@keyframes mtbDot{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}.mtb-clarify{position:fixed;z-index:2147483645;width:346px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:14px;box-shadow:0 12px 40px #00000029;display:flex;flex-direction:column;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;overflow:hidden}.mtb-clarify-header{padding:11px 13px 11px 14px;display:flex;align-items:center;gap:9px;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:24px;height:24px;border-radius:7px;background:linear-gradient(140deg,#10b981,#059669);box-shadow:0 1px 3px #05966966;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-clarify-titles{flex:1;min-width:0}.mtb-clarify-title{font-size:12.5px;font-weight:650;line-height:1.2;color:#191a1c}.mtb-clarify-subtitle{font-size:10px;color:#0000006b}.mtb-clarify-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;transition:color .12s}.mtb-clarify-close:hover{color:#000000b3}.mtb-clarify-messages{flex:1;max-height:250px;overflow-y:auto;padding:13px 13px 5px;display:flex;flex-direction:column;gap:9px}.mtb-clarify-bubble{max-width:82%;padding:9px 12px;font-size:12.5px;line-height:1.5;white-space:pre-wrap;word-break:break-word}.mtb-clarify-ai{align-self:flex-start;background:#fff;color:#191a1c;border:1px solid rgba(0,0,0,.09);border-radius:13px 13px 13px 4px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border:1px solid #059669;border-radius:13px 13px 4px}.mtb-clarify-thinking{display:flex;align-items:center;gap:4px;padding:11px 14px}.mtb-clarify-thinking .mtb-dot{width:6px;height:6px;background:#059669b3}.mtb-clarify-footer{padding:3px 13px 13px;display:flex;flex-direction:column}.mtb-clarify-input{width:100%;height:52px;padding:9px 11px;border:1px solid rgba(0,0,0,.12);border-radius:9px;font-family:inherit;font-size:13px;line-height:1.5;color:#191a1c;outline:none;background:#fafafa;resize:none;box-sizing:border-box;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-clarify-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b9811f;background:#fff}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-actions{display:flex;gap:8px;margin-top:9px}.mtb-clarify-skip{flex:0 0 auto;height:34px;padding:0 14px;border:1px solid rgba(0,0,0,.12);border-radius:9px;background:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:550;color:#0000008c;transition:background .12s}.mtb-clarify-skip:hover{background:#0000000a}.mtb-clarify-send{flex:1;height:34px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:none;border-radius:9px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-clarify-send:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled{background:#00000026;cursor:not-allowed}:host([data-mtb-theme="dark"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-subtitle{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-close{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-close:hover{color:#ffffffbf}:host([data-mtb-theme="dark"]) .mtb-clarify-skip{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover{background:#ffffff0f}:host([data-mtb-theme="dark"]) .mtb-clarify-ai{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-subtitle{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-close{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-close:hover{color:#ffffffbf}:host([data-mtb-theme="auto"]) .mtb-clarify-skip{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover{background:#ffffff0f}:host([data-mtb-theme="auto"]) .mtb-clarify-ai{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}}';
2
+ class gt {
3
3
  constructor(t = "auto") {
4
4
  this.host = document.createElement("div"), this.host.id = "mtb-widget-host", this.host.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646;", this.host.setAttribute("data-mtb-theme", t), document.body.appendChild(this.host), this.root = this.host.attachShadow({ mode: "open" });
5
5
  const e = document.createElement("style");
6
- e.textContent = pt, this.root.appendChild(e);
6
+ e.textContent = bt, this.root.appendChild(e);
7
7
  }
8
8
  el(t, e) {
9
9
  const r = document.createElement(t);
@@ -20,7 +20,7 @@ class ft {
20
20
  this.host.remove();
21
21
  }
22
22
  }
23
- class bt {
23
+ class yt {
24
24
  constructor(t, e, r, s, n) {
25
25
  this.onClick = s, this.el = t.el("button", "mtb-tab"), r === "left" && this.el.classList.add("left");
26
26
  const o = n ?? e.tab;
@@ -33,8 +33,8 @@ class bt {
33
33
  this.el.removeEventListener("click", this.onClick), this.el.remove();
34
34
  }
35
35
  }
36
- const gt = 8e3;
37
- class yt {
36
+ const xt = 8e3;
37
+ class wt {
38
38
  constructor(t, e, r) {
39
39
  this.el = t.el("div", "mtb-frustration-prompt"), this.el.innerHTML = `
40
40
  <div class="mtb-frustration-icon">&#9888;&#65039;</div>
@@ -43,13 +43,13 @@ class yt {
43
43
  <button class="mtb-frustration-tell">${e.frustration.action}</button>
44
44
  <button class="mtb-frustration-dismiss">${e.frustration.dismiss}</button>
45
45
  </div>
46
- `, this.el.querySelector(".mtb-frustration-tell").addEventListener("click", r.onTell), this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click", r.onDismiss), t.append(this.el), setTimeout(r.onDismiss, gt);
46
+ `, this.el.querySelector(".mtb-frustration-tell").addEventListener("click", r.onTell), this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click", r.onDismiss), t.append(this.el), setTimeout(r.onDismiss, xt);
47
47
  }
48
48
  destroy() {
49
49
  this.el.remove();
50
50
  }
51
51
  }
52
- class wt {
52
+ class kt {
53
53
  constructor(t, e, r, s) {
54
54
  this.currentMode = "markup", this.messages = e, this.el = t.el("div", "mtb-toolbar"), this.el.innerHTML = this.buildHTML(e), t.append(this.el), this.hintEl = this.el.querySelector(".mtb-toolbar-hint"), this.markupBtn = this.el.querySelector(".mtb-toolbar-mode-markup"), this.recordBtn = this.el.querySelector(".mtb-toolbar-mode-record"), this.markupBtn.addEventListener("click", () => {
55
55
  this.setMode("markup"), s?.("markup");
@@ -86,7 +86,7 @@ class wt {
86
86
  this.el.remove();
87
87
  }
88
88
  }
89
- class xt {
89
+ class vt {
90
90
  constructor(t, e) {
91
91
  this.onMouseDown = e.onMouseDown, this.onMouseMove = e.onMouseMove, this.onMouseUp = e.onMouseUp, this.onMouseLeave = e.onMouseLeave, this.overlayEl = t.el("div", "mtb-overlay"), this.overlayEl.addEventListener("mousedown", this.onMouseDown), this.overlayEl.addEventListener("mousemove", this.onMouseMove), this.overlayEl.addEventListener("mouseup", this.onMouseUp), this.overlayEl.addEventListener("mouseleave", this.onMouseLeave), t.append(this.overlayEl), this.dimEl = t.el("div", "mtb-dim"), t.append(this.dimEl);
92
92
  }
@@ -94,7 +94,7 @@ class xt {
94
94
  this.overlayEl.removeEventListener("mousedown", this.onMouseDown), this.overlayEl.removeEventListener("mousemove", this.onMouseMove), this.overlayEl.removeEventListener("mouseup", this.onMouseUp), this.overlayEl.removeEventListener("mouseleave", this.onMouseLeave), this.overlayEl.remove(), this.dimEl.remove();
95
95
  }
96
96
  }
97
- class vt {
97
+ class St {
98
98
  constructor(t) {
99
99
  this.highlightEl = t.el("div", "mtb-highlight"), this.hide(), t.append(this.highlightEl);
100
100
  }
@@ -109,7 +109,7 @@ class vt {
109
109
  this.highlightEl.remove();
110
110
  }
111
111
  }
112
- function kt(i) {
112
+ function Et(i) {
113
113
  if (i instanceof HTMLElement) {
114
114
  const t = i.getAttribute("aria-label");
115
115
  if (t) return t;
@@ -126,7 +126,7 @@ function kt(i) {
126
126
  }
127
127
  return i.tagName.toLowerCase();
128
128
  }
129
- function St(i) {
129
+ function Ct(i) {
130
130
  const t = [];
131
131
  let e = i;
132
132
  for (; e && e !== document.body && t.length < 5; ) {
@@ -151,7 +151,7 @@ function St(i) {
151
151
  }
152
152
  return t.join(" > ");
153
153
  }
154
- class Et {
154
+ class _t {
155
155
  constructor(t) {
156
156
  this.pins = [], this.shadow = t;
157
157
  }
@@ -167,14 +167,14 @@ class Et {
167
167
  this.clearAll();
168
168
  }
169
169
  }
170
- const A = "#059669", v = {
171
- color: A,
170
+ const et = "#059669", v = {
171
+ color: et,
172
172
  width: "3.5",
173
173
  linecap: "round",
174
174
  linejoin: "round",
175
175
  filter: "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"
176
176
  };
177
- class Ct {
177
+ class Tt {
178
178
  constructor(t, e) {
179
179
  this.path = null, this.points = [], this.isDrawing = !1, this.onDrawComplete = e, this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.svg.setAttribute("class", "mtb-draw-svg"), t.append(this.svg);
180
180
  }
@@ -229,12 +229,12 @@ class Ct {
229
229
  this.svg.remove();
230
230
  }
231
231
  }
232
- const _t = 5;
233
- class $ {
232
+ const Mt = 5;
233
+ class H {
234
234
  constructor(t, e, r) {
235
- this.messages = e, this.onReady = r, this.pinCount = 0, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new vt(t), this.pinMarker = new Et(t), this.drawLayer = new Ct(t, (s) => {
235
+ this.messages = e, this.onReady = r, this.pinCount = 0, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new St(t), this.pinMarker = new _t(t), this.drawLayer = new Tt(t, (s) => {
236
236
  this.onReady(s, this.messages.annotation.drawing);
237
- }), this.overlay = new xt(t, {
237
+ }), this.overlay = new vt(t, {
238
238
  onMouseDown: (s) => this.handleMouseDown(s),
239
239
  onMouseMove: (s) => this.handleMouseMove(s),
240
240
  onMouseUp: (s) => this.handleMouseUp(s),
@@ -257,7 +257,7 @@ class $ {
257
257
  }
258
258
  updateHighlight() {
259
259
  if (!this.interactionActive || this.drawLayer.isCurrentlyDrawing()) return;
260
- const t = I(this.lastMoveX, this.lastMoveY);
260
+ const t = O(this.lastMoveX, this.lastMoveY);
261
261
  t ? this.highlighter.highlight(t) : this.highlighter.hide();
262
262
  }
263
263
  cancelPendingHighlight() {
@@ -265,16 +265,16 @@ class $ {
265
265
  }
266
266
  handleMouseUp(t) {
267
267
  if (!this.drawLayer.isCurrentlyDrawing()) return;
268
- if (this.drawLayer.getPointCount() >= _t) {
268
+ if (this.drawLayer.getPointCount() >= Mt) {
269
269
  this.drawLayer.endDraw();
270
270
  return;
271
271
  }
272
272
  this.drawLayer.cancelCurrentDraw();
273
- const e = I(t.clientX, t.clientY), r = e ? kt(e) : this.messages.annotation.element, s = {
273
+ const e = O(t.clientX, t.clientY), r = e ? Et(e) : this.messages.annotation.element, s = {
274
274
  type: "pin",
275
275
  x: t.clientX,
276
276
  y: t.clientY,
277
- targetSelector: e ? St(e) : void 0,
277
+ targetSelector: e ? Ct(e) : void 0,
278
278
  targetText: e?.textContent?.trim().slice(0, 200) ?? "",
279
279
  targetName: r
280
280
  };
@@ -287,19 +287,19 @@ class $ {
287
287
  this.dismissInteraction(), this.pinMarker.destroy(), this.drawLayer.destroy();
288
288
  }
289
289
  }
290
- function I(i, t) {
290
+ function O(i, t) {
291
291
  return document.elementsFromPoint(i, t).find((e) => e.id !== "mtb-widget-host") ?? null;
292
292
  }
293
- class Tt {
293
+ class Lt {
294
294
  constructor(t, e) {
295
295
  this.loading = !1, this.onSubmit = e.onSubmit, this.onClose = e.onClose, this.submitLabel = e.messages.popup.submit, this.el = t.el("div", "mtb-popup"), this.el.innerHTML = this.buildHTML(e), t.append(this.el), this.textarea = this.el.querySelector(".mtb-textarea"), this.submitBtn = this.el.querySelector(".mtb-submit-btn"), this.positionPopup(e.x, e.y), this.bindEvents(e.messages), e.onMyFeedback && this.el.querySelector(".mtb-my-feedback").addEventListener("click", e.onMyFeedback), this.textarea.focus();
296
296
  }
297
297
  buildHTML(t) {
298
298
  const e = t.messages, r = e.popup.quickOptions.map(
299
299
  (s) => `
300
- <button class="mtb-quick-option" data-quick="${f(s.label)}">
300
+ <button class="mtb-quick-option" data-quick="${p(s.label)}">
301
301
  <span class="mtb-quick-option-emoji">${s.emoji}</span>
302
- <span>${f(s.label)}</span>
302
+ <span>${p(s.label)}</span>
303
303
  </button>`
304
304
  ).join("");
305
305
  return `
@@ -309,7 +309,7 @@ class Tt {
309
309
  <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/>
310
310
  </svg>
311
311
  </div>
312
- <span class="mtb-popup-title">${e.popup.about} "${f(t.targetName)}"</span>
312
+ <span class="mtb-popup-title">${e.popup.about} "${p(t.targetName)}"</span>
313
313
  <button class="mtb-popup-close" aria-label="Close">
314
314
  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
315
315
  <path d="M18 6L6 18M6 6l12 12"/>
@@ -321,14 +321,14 @@ class Tt {
321
321
  ${r}
322
322
  </div>
323
323
  <div class="mtb-textarea-wrap">
324
- <textarea class="mtb-textarea" placeholder="${f(e.popup.placeholder)}"></textarea>
324
+ <textarea class="mtb-textarea" placeholder="${p(e.popup.placeholder)}"></textarea>
325
325
  </div>
326
326
  <div class="mtb-popup-error" role="alert"></div>
327
327
  <div class="mtb-popup-actions">
328
- <button class="mtb-cancel-btn" type="button">${f(e.popup.cancel)}</button>
329
- <button class="mtb-submit-btn" type="button" disabled>${f(e.popup.submit)}</button>
328
+ <button class="mtb-cancel-btn" type="button">${p(e.popup.cancel)}</button>
329
+ <button class="mtb-submit-btn" type="button" disabled>${p(e.popup.submit)}</button>
330
330
  </div>
331
- ${t.onMyFeedback ? `<button class="mtb-my-feedback" type="button">${f(e.popup.my_feedback)}</button>` : ""}
331
+ ${t.onMyFeedback ? `<button class="mtb-my-feedback" type="button">${p(e.popup.my_feedback)}</button>` : ""}
332
332
  </div>
333
333
  `;
334
334
  }
@@ -365,39 +365,65 @@ class Tt {
365
365
  this.el.remove();
366
366
  }
367
367
  }
368
- function f(i) {
368
+ function p(i) {
369
369
  return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
370
370
  }
371
- const Mt = 2e3, Lt = 2e3, Dt = 45e3;
372
- class Rt {
371
+ const At = 2e3, Dt = 2e3, Rt = 45e3, L = 346, A = 320;
372
+ class Pt {
373
373
  constructor(t, e) {
374
- this.pollTimer = null, this.pollDeadline = 0, this.doneTimer = null, this.streamingBubble = null, this.sending = !1, this.destroyed = !1, this.feedbackId = e.feedbackId, this.apiClient = e.apiClient, this.onDone = e.onDone, this.el = t.el("div", "mtb-clarify"), this.el.style.right = "20px", this.el.style.bottom = "20px", this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.messagesEl = this.el.querySelector(".mtb-clarify-messages"), this.inputEl = this.el.querySelector(".mtb-clarify-input"), this.sendBtn = this.el.querySelector(".mtb-clarify-send"), this.bindEvents(e.messages), this.startConversation();
374
+ this.pollTimer = null, this.pollDeadline = 0, this.doneTimer = null, this.streamingBubble = null, this.sending = !1, this.destroyed = !1, this.feedbackId = e.feedbackId, this.apiClient = e.apiClient, this.onDone = e.onDone, this.el = t.el("div", "mtb-clarify"), this.el.innerHTML = this.buildHTML(e.messages), this.positionCard(e.x, e.y), t.append(this.el), this.messagesEl = this.el.querySelector(".mtb-clarify-messages"), this.inputEl = this.el.querySelector(".mtb-clarify-input"), this.sendBtn = this.el.querySelector(".mtb-clarify-send"), this.bindEvents(e.messages), this.startConversation();
375
+ }
376
+ // Anchors the card near the annotation point, clamped to the viewport so it
377
+ // never overflows a screen edge (mirrors CommentPopup.positionPopup).
378
+ positionCard(t, e) {
379
+ const r = window.innerWidth, s = window.innerHeight, n = 12;
380
+ if (t === void 0 || e === void 0) {
381
+ this.el.style.left = `${Math.max(n, (r - L) / 2)}px`, this.el.style.top = `${Math.max(n, (s - A) / 2)}px`;
382
+ return;
383
+ }
384
+ let o = t + 12, a = e + 12;
385
+ o + L > r - n && (o = t - L - 12), o < n && (o = n), a + A > s - n && (a = s - A - n), a < n && (a = n), this.el.style.left = `${o}px`, this.el.style.top = `${a}px`;
375
386
  }
376
387
  buildHTML(t) {
377
388
  return `
378
389
  <div class="mtb-clarify-header">
379
- <div class="mtb-clarify-icon">
380
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${A}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
381
- <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
390
+ <span class="mtb-clarify-icon">
391
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
392
+ <path d="M12 3l1.6 5.4L19 10l-5.4 1.6L12 17l-1.6-5.4L5 10l5.4-1.6L12 3z"/>
382
393
  </svg>
394
+ </span>
395
+ <div class="mtb-clarify-titles">
396
+ <div class="mtb-clarify-title">${b(t.clarify.title)}</div>
397
+ <div class="mtb-clarify-subtitle">${b(t.clarify.subtitle)}</div>
383
398
  </div>
384
- <button class="mtb-clarify-skip">${M(t.clarify.skip)}</button>
399
+ <button class="mtb-clarify-close" type="button" title="${b(t.clarify.skip)}" aria-label="${b(t.clarify.skip)}">
400
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
401
+ <path d="M18 6L6 18M6 6l12 12"/>
402
+ </svg>
403
+ </button>
385
404
  </div>
386
405
  <div class="mtb-clarify-messages"></div>
387
406
  <div class="mtb-clarify-footer">
388
- <input class="mtb-clarify-input" type="text" placeholder="${M(t.clarify.placeholder)}" />
389
- <button class="mtb-clarify-send" disabled>${M(t.clarify.send)}</button>
407
+ <textarea class="mtb-clarify-input" rows="2" placeholder="${b(t.clarify.placeholder)}"></textarea>
408
+ <div class="mtb-clarify-actions">
409
+ <button class="mtb-clarify-skip" type="button">${b(t.clarify.skip)}</button>
410
+ <button class="mtb-clarify-send" type="button">
411
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
412
+ <line x1="22" y1="2" x2="11" y2="13"/>
413
+ <polygon points="22 2 15 22 11 13 2 9 22 2"/>
414
+ </svg>
415
+ <span>${b(t.clarify.send)}</span>
416
+ </button>
417
+ </div>
390
418
  </div>
391
419
  `;
392
420
  }
393
421
  bindEvents(t) {
394
- this.el.querySelector(".mtb-clarify-skip").addEventListener("click", () => {
422
+ const e = () => {
395
423
  this.stopPolling(), this.onDone();
396
- }), this.inputEl.addEventListener("input", () => {
397
- const e = this.inputEl.value.trim().length > 0;
398
- this.sendBtn.disabled = !e || this.sending;
399
- }), this.inputEl.addEventListener("keydown", (e) => {
400
- e.isComposing || e.keyCode === 229 || e.key === "Enter" && (e.preventDefault(), this.sendMessage(t));
424
+ };
425
+ this.el.querySelector(".mtb-clarify-skip").addEventListener("click", e), this.el.querySelector(".mtb-clarify-close").addEventListener("click", e), this.inputEl.addEventListener("keydown", (r) => {
426
+ r.isComposing || r.keyCode === 229 || r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.sendMessage(t));
401
427
  }), this.sendBtn.addEventListener("click", () => this.sendMessage(t));
402
428
  }
403
429
  async startConversation() {
@@ -410,7 +436,7 @@ class Rt {
410
436
  try {
411
437
  await this.runTurn(e);
412
438
  } finally {
413
- this.sending = !1, this.inputEl.disabled = !1, this.sendBtn.disabled = this.inputEl.value.trim().length === 0, this.inputEl.focus();
439
+ this.sending = !1, this.inputEl.disabled = !1, this.sendBtn.disabled = !1, this.inputEl.focus();
414
440
  }
415
441
  }
416
442
  }
@@ -447,7 +473,7 @@ class Rt {
447
473
  this.streamingBubble = null;
448
474
  }
449
475
  startPolling() {
450
- this.stopPolling(), this.pollDeadline = Date.now() + Dt, this.pollTimer = setInterval(() => this.poll(), Mt);
476
+ this.stopPolling(), this.pollDeadline = Date.now() + Rt, this.pollTimer = setInterval(() => this.poll(), At);
451
477
  }
452
478
  stopPolling() {
453
479
  this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null);
@@ -469,7 +495,7 @@ class Rt {
469
495
  handleDone() {
470
496
  this.inputEl.disabled = !0, this.sendBtn.disabled = !0, this.doneTimer = setTimeout(() => {
471
497
  this.destroyed || this.onDone();
472
- }, Lt);
498
+ }, Dt);
473
499
  }
474
500
  renderConversation(t, e) {
475
501
  this.renderMessages(t);
@@ -498,10 +524,10 @@ class Rt {
498
524
  this.destroyed = !0, this.stopPolling(), this.doneTimer !== null && (clearTimeout(this.doneTimer), this.doneTimer = null), this.el.remove();
499
525
  }
500
526
  }
501
- function M(i) {
527
+ function b(i) {
502
528
  return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
503
529
  }
504
- const At = 5e3, Pt = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
530
+ const It = 5e3, $t = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
505
531
  class Ht {
506
532
  constructor(t, e, r, s, n) {
507
533
  this.messages = e, this.el = t.el("div", "mtb-success"), this.el.style.right = "20px", this.el.style.bottom = "20px";
@@ -516,7 +542,7 @@ class Ht {
516
542
  </div>` : "";
517
543
  this.el.innerHTML = `
518
544
  <div class="mtb-success-icon">
519
- <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${A}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
545
+ <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${et}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
520
546
  <polyline points="20 6 9 17 4 12"/>
521
547
  </svg>
522
548
  </div>
@@ -525,12 +551,12 @@ class Ht {
525
551
  ${c}
526
552
  ${l}
527
553
  <button class="mtb-close-link">${e.success.close}</button>
528
- `, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", r), s && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", s), n?.emailCapture ? this.bindEmailCapture(n.emailCapture.onSubmit) : setTimeout(() => r(), At);
554
+ `, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", r), s && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", s), n?.emailCapture ? this.bindEmailCapture(n.emailCapture.onSubmit) : setTimeout(() => r(), It);
529
555
  }
530
556
  bindEmailCapture(t) {
531
557
  const e = this.el.querySelector(".mtb-email-input"), r = this.el.querySelector(".mtb-email-submit"), s = this.el.querySelector(".mtb-email-error"), n = async () => {
532
558
  const o = e.value.trim();
533
- if (!Pt.test(o)) {
559
+ if (!$t.test(o)) {
534
560
  e.classList.add("mtb-email-invalid");
535
561
  return;
536
562
  }
@@ -544,7 +570,7 @@ class Ht {
544
570
  this.el.remove();
545
571
  }
546
572
  }
547
- function $t(i, t) {
573
+ function Ot(i, t) {
548
574
  if (i.match(/^[a-z]+:\/\//i))
549
575
  return i;
550
576
  if (i.match(/^\/\//))
@@ -554,7 +580,7 @@ function $t(i, t) {
554
580
  const e = document.implementation.createHTMLDocument(), r = e.createElement("base"), s = e.createElement("a");
555
581
  return e.head.appendChild(r), e.body.appendChild(s), t && (r.href = t), s.href = i, s.href;
556
582
  }
557
- const It = /* @__PURE__ */ (() => {
583
+ const Ft = /* @__PURE__ */ (() => {
558
584
  let i = 0;
559
585
  const t = () => (
560
586
  // eslint-disable-next-line no-bitwise
@@ -562,33 +588,33 @@ const It = /* @__PURE__ */ (() => {
562
588
  );
563
589
  return () => (i += 1, `u${t()}${i}`);
564
590
  })();
565
- function p(i) {
591
+ function f(i) {
566
592
  const t = [];
567
593
  for (let e = 0, r = i.length; e < r; e++)
568
594
  t.push(i[e]);
569
595
  return t;
570
596
  }
571
- let g = null;
572
- function tt(i = {}) {
573
- return g || (i.includeStyleProperties ? (g = i.includeStyleProperties, g) : (g = p(window.getComputedStyle(document.documentElement)), g));
597
+ let y = null;
598
+ function it(i = {}) {
599
+ return y || (i.includeStyleProperties ? (y = i.includeStyleProperties, y) : (y = f(window.getComputedStyle(document.documentElement)), y));
574
600
  }
575
- function C(i, t) {
601
+ function _(i, t) {
576
602
  const r = (i.ownerDocument.defaultView || window).getComputedStyle(i).getPropertyValue(t);
577
603
  return r ? parseFloat(r.replace("px", "")) : 0;
578
604
  }
579
- function Ot(i) {
580
- const t = C(i, "border-left-width"), e = C(i, "border-right-width");
605
+ function Ut(i) {
606
+ const t = _(i, "border-left-width"), e = _(i, "border-right-width");
581
607
  return i.clientWidth + t + e;
582
608
  }
583
- function Ft(i) {
584
- const t = C(i, "border-top-width"), e = C(i, "border-bottom-width");
609
+ function jt(i) {
610
+ const t = _(i, "border-top-width"), e = _(i, "border-bottom-width");
585
611
  return i.clientHeight + t + e;
586
612
  }
587
- function et(i, t = {}) {
588
- const e = t.width || Ot(i), r = t.height || Ft(i);
613
+ function rt(i, t = {}) {
614
+ const e = t.width || Ut(i), r = t.height || jt(i);
589
615
  return { width: e, height: r };
590
616
  }
591
- function Ut() {
617
+ function Bt() {
592
618
  let i, t;
593
619
  try {
594
620
  t = process;
@@ -598,10 +624,10 @@ function Ut() {
598
624
  return e && (i = parseInt(e, 10), Number.isNaN(i) && (i = 1)), i || window.devicePixelRatio || 1;
599
625
  }
600
626
  const u = 16384;
601
- function jt(i) {
627
+ function zt(i) {
602
628
  (i.width > u || i.height > u) && (i.width > u && i.height > u ? i.width > i.height ? (i.height *= u / i.width, i.width = u) : (i.width *= u / i.height, i.height = u) : i.width > u ? (i.height *= u / i.width, i.width = u) : (i.width *= u / i.height, i.height = u));
603
629
  }
604
- function _(i) {
630
+ function T(i) {
605
631
  return new Promise((t, e) => {
606
632
  const r = new Image();
607
633
  r.onload = () => {
@@ -611,12 +637,12 @@ function _(i) {
611
637
  }, r.onerror = e, r.crossOrigin = "anonymous", r.decoding = "async", r.src = i;
612
638
  });
613
639
  }
614
- async function Bt(i) {
640
+ async function qt(i) {
615
641
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
616
642
  }
617
- async function zt(i, t, e) {
643
+ async function Wt(i, t, e) {
618
644
  const r = "http://www.w3.org/2000/svg", s = document.createElementNS(r, "svg"), n = document.createElementNS(r, "foreignObject");
619
- return s.setAttribute("width", `${t}`), s.setAttribute("height", `${e}`), s.setAttribute("viewBox", `0 0 ${t} ${e}`), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), s.appendChild(n), n.appendChild(i), Bt(s);
645
+ return s.setAttribute("width", `${t}`), s.setAttribute("height", `${e}`), s.setAttribute("viewBox", `0 0 ${t} ${e}`), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), s.appendChild(n), n.appendChild(i), qt(s);
620
646
  }
621
647
  const d = (i, t) => {
622
648
  if (i instanceof t)
@@ -624,67 +650,67 @@ const d = (i, t) => {
624
650
  const e = Object.getPrototypeOf(i);
625
651
  return e === null ? !1 : e.constructor.name === t.name || d(e, t);
626
652
  };
627
- function qt(i) {
653
+ function Nt(i) {
628
654
  const t = i.getPropertyValue("content");
629
655
  return `${i.cssText} content: '${t.replace(/'|"/g, "")}';`;
630
656
  }
631
- function Wt(i, t) {
632
- return tt(t).map((e) => {
657
+ function Vt(i, t) {
658
+ return it(t).map((e) => {
633
659
  const r = i.getPropertyValue(e), s = i.getPropertyPriority(e);
634
660
  return `${e}: ${r}${s ? " !important" : ""};`;
635
661
  }).join(" ");
636
662
  }
637
- function Nt(i, t, e, r) {
638
- const s = `.${i}:${t}`, n = e.cssText ? qt(e) : Wt(e, r);
663
+ function Yt(i, t, e, r) {
664
+ const s = `.${i}:${t}`, n = e.cssText ? Nt(e) : Vt(e, r);
639
665
  return document.createTextNode(`${s}{${n}}`);
640
666
  }
641
- function O(i, t, e, r) {
667
+ function F(i, t, e, r) {
642
668
  const s = window.getComputedStyle(i, e), n = s.getPropertyValue("content");
643
669
  if (n === "" || n === "none")
644
670
  return;
645
- const o = It();
671
+ const o = Ft();
646
672
  try {
647
673
  t.className = `${t.className} ${o}`;
648
674
  } catch {
649
675
  return;
650
676
  }
651
677
  const a = document.createElement("style");
652
- a.appendChild(Nt(o, e, s, r)), t.appendChild(a);
678
+ a.appendChild(Yt(o, e, s, r)), t.appendChild(a);
653
679
  }
654
- function Vt(i, t, e) {
655
- O(i, t, ":before", e), O(i, t, ":after", e);
680
+ function Xt(i, t, e) {
681
+ F(i, t, ":before", e), F(i, t, ":after", e);
656
682
  }
657
- const F = "application/font-woff", U = "image/jpeg", Yt = {
658
- woff: F,
659
- woff2: F,
683
+ const U = "application/font-woff", j = "image/jpeg", Gt = {
684
+ woff: U,
685
+ woff2: U,
660
686
  ttf: "application/font-truetype",
661
687
  eot: "application/vnd.ms-fontobject",
662
688
  png: "image/png",
663
- jpg: U,
664
- jpeg: U,
689
+ jpg: j,
690
+ jpeg: j,
665
691
  gif: "image/gif",
666
692
  tiff: "image/tiff",
667
693
  svg: "image/svg+xml",
668
694
  webp: "image/webp"
669
695
  };
670
- function Xt(i) {
696
+ function Kt(i) {
671
697
  const t = /\.([^./]*?)$/g.exec(i);
672
698
  return t ? t[1] : "";
673
699
  }
674
- function P(i) {
675
- const t = Xt(i).toLowerCase();
676
- return Yt[t] || "";
700
+ function I(i) {
701
+ const t = Kt(i).toLowerCase();
702
+ return Gt[t] || "";
677
703
  }
678
- function Kt(i) {
704
+ function Jt(i) {
679
705
  return i.split(/,/)[1];
680
706
  }
681
- function D(i) {
707
+ function R(i) {
682
708
  return i.search(/^(data:)/) !== -1;
683
709
  }
684
- function Gt(i, t) {
710
+ function Qt(i, t) {
685
711
  return `data:${t};base64,${i}`;
686
712
  }
687
- async function it(i, t, e) {
713
+ async function st(i, t, e) {
688
714
  const r = await fetch(i, t);
689
715
  if (r.status === 404)
690
716
  throw new Error(`Resource "${r.url}" not found`);
@@ -700,86 +726,86 @@ async function it(i, t, e) {
700
726
  }, a.readAsDataURL(s);
701
727
  });
702
728
  }
703
- const L = {};
704
- function Jt(i, t, e) {
729
+ const D = {};
730
+ function Zt(i, t, e) {
705
731
  let r = i.replace(/\?.*/, "");
706
732
  return e && (r = i), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
707
733
  }
708
- async function H(i, t, e) {
709
- const r = Jt(i, t, e.includeQueryParams);
710
- if (L[r] != null)
711
- return L[r];
734
+ async function $(i, t, e) {
735
+ const r = Zt(i, t, e.includeQueryParams);
736
+ if (D[r] != null)
737
+ return D[r];
712
738
  e.cacheBust && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
713
739
  let s;
714
740
  try {
715
- const n = await it(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""), Kt(a)));
716
- s = Gt(n, t);
741
+ const n = await st(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""), Jt(a)));
742
+ s = Qt(n, t);
717
743
  } catch (n) {
718
744
  s = e.imagePlaceholder || "";
719
745
  let o = `Failed to fetch resource: ${i}`;
720
746
  n && (o = typeof n == "string" ? n : n.message), o && console.warn(o);
721
747
  }
722
- return L[r] = s, s;
748
+ return D[r] = s, s;
723
749
  }
724
- async function Qt(i) {
750
+ async function te(i) {
725
751
  const t = i.toDataURL();
726
- return t === "data:," ? i.cloneNode(!1) : _(t);
752
+ return t === "data:," ? i.cloneNode(!1) : T(t);
727
753
  }
728
- async function Zt(i, t) {
754
+ async function ee(i, t) {
729
755
  if (i.currentSrc) {
730
756
  const n = document.createElement("canvas"), o = n.getContext("2d");
731
757
  n.width = i.clientWidth, n.height = i.clientHeight, o?.drawImage(i, 0, 0, n.width, n.height);
732
758
  const a = n.toDataURL();
733
- return _(a);
759
+ return T(a);
734
760
  }
735
- const e = i.poster, r = P(e), s = await H(e, r, t);
736
- return _(s);
761
+ const e = i.poster, r = I(e), s = await $(e, r, t);
762
+ return T(s);
737
763
  }
738
- async function te(i, t) {
764
+ async function ie(i, t) {
739
765
  var e;
740
766
  try {
741
767
  if (!((e = i?.contentDocument) === null || e === void 0) && e.body)
742
- return await T(i.contentDocument.body, t, !0);
768
+ return await M(i.contentDocument.body, t, !0);
743
769
  } catch {
744
770
  }
745
771
  return i.cloneNode(!1);
746
772
  }
747
- async function ee(i, t) {
748
- return d(i, HTMLCanvasElement) ? Qt(i) : d(i, HTMLVideoElement) ? Zt(i, t) : d(i, HTMLIFrameElement) ? te(i, t) : i.cloneNode(rt(i));
773
+ async function re(i, t) {
774
+ return d(i, HTMLCanvasElement) ? te(i) : d(i, HTMLVideoElement) ? ee(i, t) : d(i, HTMLIFrameElement) ? ie(i, t) : i.cloneNode(nt(i));
749
775
  }
750
- const ie = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT", rt = (i) => i.tagName != null && i.tagName.toUpperCase() === "SVG";
751
- async function re(i, t, e) {
776
+ const se = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT", nt = (i) => i.tagName != null && i.tagName.toUpperCase() === "SVG";
777
+ async function ne(i, t, e) {
752
778
  var r, s;
753
- if (rt(t))
779
+ if (nt(t))
754
780
  return t;
755
781
  let n = [];
756
- return ie(i) && i.assignedNodes ? n = p(i.assignedNodes()) : d(i, HTMLIFrameElement) && (!((r = i.contentDocument) === null || r === void 0) && r.body) ? n = p(i.contentDocument.body.childNodes) : n = p(((s = i.shadowRoot) !== null && s !== void 0 ? s : i).childNodes), n.length === 0 || d(i, HTMLVideoElement) || await n.reduce((o, a) => o.then(() => T(a, e)).then((l) => {
782
+ return se(i) && i.assignedNodes ? n = f(i.assignedNodes()) : d(i, HTMLIFrameElement) && (!((r = i.contentDocument) === null || r === void 0) && r.body) ? n = f(i.contentDocument.body.childNodes) : n = f(((s = i.shadowRoot) !== null && s !== void 0 ? s : i).childNodes), n.length === 0 || d(i, HTMLVideoElement) || await n.reduce((o, a) => o.then(() => M(a, e)).then((l) => {
757
783
  l && t.appendChild(l);
758
784
  }), Promise.resolve()), t;
759
785
  }
760
- function se(i, t, e) {
786
+ function oe(i, t, e) {
761
787
  const r = t.style;
762
788
  if (!r)
763
789
  return;
764
790
  const s = window.getComputedStyle(i);
765
- s.cssText ? (r.cssText = s.cssText, r.transformOrigin = s.transformOrigin) : tt(e).forEach((n) => {
791
+ s.cssText ? (r.cssText = s.cssText, r.transformOrigin = s.transformOrigin) : it(e).forEach((n) => {
766
792
  let o = s.getPropertyValue(n);
767
793
  n === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), d(i, HTMLIFrameElement) && n === "display" && o === "inline" && (o = "block"), n === "d" && t.getAttribute("d") && (o = `path(${t.getAttribute("d")})`), r.setProperty(n, o, s.getPropertyPriority(n));
768
794
  });
769
795
  }
770
- function ne(i, t) {
796
+ function ae(i, t) {
771
797
  d(i, HTMLTextAreaElement) && (t.innerHTML = i.value), d(i, HTMLInputElement) && t.setAttribute("value", i.value);
772
798
  }
773
- function oe(i, t) {
799
+ function le(i, t) {
774
800
  if (d(i, HTMLSelectElement)) {
775
801
  const e = t, r = Array.from(e.children).find((s) => i.value === s.getAttribute("value"));
776
802
  r && r.setAttribute("selected", "");
777
803
  }
778
804
  }
779
- function ae(i, t, e) {
780
- return d(t, Element) && (se(i, t, e), Vt(i, t, e), ne(i, t), oe(i, t)), t;
805
+ function ce(i, t, e) {
806
+ return d(t, Element) && (oe(i, t, e), Xt(i, t, e), ae(i, t), le(i, t)), t;
781
807
  }
782
- async function le(i, t) {
808
+ async function de(i, t) {
783
809
  const e = i.querySelectorAll ? i.querySelectorAll("use") : [];
784
810
  if (e.length === 0)
785
811
  return i;
@@ -788,7 +814,7 @@ async function le(i, t) {
788
814
  const a = e[n].getAttribute("xlink:href");
789
815
  if (a) {
790
816
  const l = i.querySelector(a), c = document.querySelector(a);
791
- !l && c && !r[a] && (r[a] = await T(c, t, !0));
817
+ !l && c && !r[a] && (r[a] = await M(c, t, !0));
792
818
  }
793
819
  }
794
820
  const s = Object.values(r);
@@ -803,31 +829,31 @@ async function le(i, t) {
803
829
  }
804
830
  return i;
805
831
  }
806
- async function T(i, t, e) {
807
- return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) => ee(r, t)).then((r) => re(i, r, t)).then((r) => ae(i, r, t)).then((r) => le(r, t));
832
+ async function M(i, t, e) {
833
+ return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) => re(r, t)).then((r) => ne(i, r, t)).then((r) => ce(i, r, t)).then((r) => de(r, t));
808
834
  }
809
- const st = /url\((['"]?)([^'"]+?)\1\)/g, ce = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, de = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
810
- function he(i) {
835
+ const ot = /url\((['"]?)([^'"]+?)\1\)/g, he = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ue = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
836
+ function me(i) {
811
837
  const t = i.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
812
838
  return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
813
839
  }
814
- function ue(i) {
840
+ function fe(i) {
815
841
  const t = [];
816
- return i.replace(st, (e, r, s) => (t.push(s), e)), t.filter((e) => !D(e));
842
+ return i.replace(ot, (e, r, s) => (t.push(s), e)), t.filter((e) => !R(e));
817
843
  }
818
- async function me(i, t, e, r, s) {
844
+ async function pe(i, t, e, r, s) {
819
845
  try {
820
- const n = e ? $t(t, e) : t, o = P(t);
846
+ const n = e ? Ot(t, e) : t, o = I(t);
821
847
  let a;
822
- return s || (a = await H(n, o, r)), i.replace(he(t), `$1${a}$3`);
848
+ return s || (a = await $(n, o, r)), i.replace(me(t), `$1${a}$3`);
823
849
  } catch {
824
850
  }
825
851
  return i;
826
852
  }
827
- function pe(i, { preferredFontFormat: t }) {
828
- return t ? i.replace(de, (e) => {
853
+ function be(i, { preferredFontFormat: t }) {
854
+ return t ? i.replace(ue, (e) => {
829
855
  for (; ; ) {
830
- const [r, , s] = ce.exec(e) || [];
856
+ const [r, , s] = he.exec(e) || [];
831
857
  if (!s)
832
858
  return "";
833
859
  if (s === t)
@@ -835,32 +861,32 @@ function pe(i, { preferredFontFormat: t }) {
835
861
  }
836
862
  }) : i;
837
863
  }
838
- function nt(i) {
839
- return i.search(st) !== -1;
864
+ function at(i) {
865
+ return i.search(ot) !== -1;
840
866
  }
841
- async function ot(i, t, e) {
842
- if (!nt(i))
867
+ async function lt(i, t, e) {
868
+ if (!at(i))
843
869
  return i;
844
- const r = pe(i, e);
845
- return ue(r).reduce((n, o) => n.then((a) => me(a, o, t, e)), Promise.resolve(r));
870
+ const r = be(i, e);
871
+ return fe(r).reduce((n, o) => n.then((a) => pe(a, o, t, e)), Promise.resolve(r));
846
872
  }
847
- async function y(i, t, e) {
873
+ async function x(i, t, e) {
848
874
  var r;
849
875
  const s = (r = t.style) === null || r === void 0 ? void 0 : r.getPropertyValue(i);
850
876
  if (s) {
851
- const n = await ot(s, null, e);
877
+ const n = await lt(s, null, e);
852
878
  return t.style.setProperty(i, n, t.style.getPropertyPriority(i)), !0;
853
879
  }
854
880
  return !1;
855
881
  }
856
- async function fe(i, t) {
857
- await y("background", i, t) || await y("background-image", i, t), await y("mask", i, t) || await y("-webkit-mask", i, t) || await y("mask-image", i, t) || await y("-webkit-mask-image", i, t);
882
+ async function ge(i, t) {
883
+ await x("background", i, t) || await x("background-image", i, t), await x("mask", i, t) || await x("-webkit-mask", i, t) || await x("mask-image", i, t) || await x("-webkit-mask-image", i, t);
858
884
  }
859
- async function be(i, t) {
885
+ async function ye(i, t) {
860
886
  const e = d(i, HTMLImageElement);
861
- if (!(e && !D(i.src)) && !(d(i, SVGImageElement) && !D(i.href.baseVal)))
887
+ if (!(e && !R(i.src)) && !(d(i, SVGImageElement) && !R(i.href.baseVal)))
862
888
  return;
863
- const r = e ? i.src : i.href.baseVal, s = await H(r, P(r), t);
889
+ const r = e ? i.src : i.href.baseVal, s = await $(r, I(r), t);
864
890
  await new Promise((n, o) => {
865
891
  i.onload = n, i.onerror = t.onImageErrorHandler ? (...l) => {
866
892
  try {
@@ -873,14 +899,14 @@ async function be(i, t) {
873
899
  a.decode && (a.decode = n), a.loading === "lazy" && (a.loading = "eager"), e ? (i.srcset = "", i.src = s) : i.href.baseVal = s;
874
900
  });
875
901
  }
876
- async function ge(i, t) {
877
- const r = p(i.childNodes).map((s) => at(s, t));
902
+ async function xe(i, t) {
903
+ const r = f(i.childNodes).map((s) => ct(s, t));
878
904
  await Promise.all(r).then(() => i);
879
905
  }
880
- async function at(i, t) {
881
- d(i, Element) && (await fe(i, t), await be(i, t), await ge(i, t));
906
+ async function ct(i, t) {
907
+ d(i, Element) && (await ge(i, t), await ye(i, t), await xe(i, t));
882
908
  }
883
- function ye(i, t) {
909
+ function we(i, t) {
884
910
  const { style: e } = i;
885
911
  t.backgroundColor && (e.backgroundColor = t.backgroundColor), t.width && (e.width = `${t.width}px`), t.height && (e.height = `${t.height}px`);
886
912
  const r = t.style;
@@ -888,23 +914,23 @@ function ye(i, t) {
888
914
  e[s] = r[s];
889
915
  }), i;
890
916
  }
891
- const j = {};
892
- async function B(i) {
893
- let t = j[i];
917
+ const B = {};
918
+ async function z(i) {
919
+ let t = B[i];
894
920
  if (t != null)
895
921
  return t;
896
922
  const r = await (await fetch(i)).text();
897
- return t = { url: i, cssText: r }, j[i] = t, t;
923
+ return t = { url: i, cssText: r }, B[i] = t, t;
898
924
  }
899
- async function z(i, t) {
925
+ async function q(i, t) {
900
926
  let e = i.cssText;
901
927
  const r = /url\(["']?([^"')]+)["']?\)/g, n = (e.match(/url\([^)]+\)/g) || []).map(async (o) => {
902
928
  let a = o.replace(r, "$1");
903
- return a.startsWith("https://") || (a = new URL(a, i.url).href), it(a, t.fetchRequestInit, ({ result: l }) => (e = e.replace(o, `url(${l})`), [o, l]));
929
+ return a.startsWith("https://") || (a = new URL(a, i.url).href), st(a, t.fetchRequestInit, ({ result: l }) => (e = e.replace(o, `url(${l})`), [o, l]));
904
930
  });
905
931
  return Promise.all(n).then(() => e);
906
932
  }
907
- function q(i) {
933
+ function W(i) {
908
934
  if (i == null)
909
935
  return [];
910
936
  const t = [], e = /(\/\*[\s\S]*?\*\/)/gi;
@@ -930,21 +956,21 @@ function q(i) {
930
956
  }
931
957
  return t;
932
958
  }
933
- async function we(i, t) {
959
+ async function ke(i, t) {
934
960
  const e = [], r = [];
935
961
  return i.forEach((s) => {
936
962
  if ("cssRules" in s)
937
963
  try {
938
- p(s.cssRules || []).forEach((n, o) => {
964
+ f(s.cssRules || []).forEach((n, o) => {
939
965
  if (n.type === CSSRule.IMPORT_RULE) {
940
966
  let a = o + 1;
941
- const l = n.href, c = B(l).then((h) => z(h, t)).then((h) => q(h).forEach((m) => {
967
+ const l = n.href, c = z(l).then((h) => q(h, t)).then((h) => W(h).forEach((m) => {
942
968
  try {
943
969
  s.insertRule(m, m.startsWith("@import") ? a += 1 : s.cssRules.length);
944
- } catch (x) {
970
+ } catch (k) {
945
971
  console.error("Error inserting rule from remote css", {
946
972
  rule: m,
947
- error: x
973
+ error: k
948
974
  });
949
975
  }
950
976
  })).catch((h) => {
@@ -955,7 +981,7 @@ async function we(i, t) {
955
981
  });
956
982
  } catch (n) {
957
983
  const o = i.find((a) => a.href == null) || document.styleSheets[0];
958
- s.href != null && r.push(B(s.href).then((a) => z(a, t)).then((a) => q(a).forEach((l) => {
984
+ s.href != null && r.push(z(s.href).then((a) => q(a, t)).then((a) => W(a).forEach((l) => {
959
985
  o.insertRule(l, o.cssRules.length);
960
986
  })).catch((a) => {
961
987
  console.error("Error loading remote stylesheet", a);
@@ -964,7 +990,7 @@ async function we(i, t) {
964
990
  }), Promise.all(r).then(() => (i.forEach((s) => {
965
991
  if ("cssRules" in s)
966
992
  try {
967
- p(s.cssRules || []).forEach((n) => {
993
+ f(s.cssRules || []).forEach((n) => {
968
994
  e.push(n);
969
995
  });
970
996
  } catch (n) {
@@ -972,79 +998,82 @@ async function we(i, t) {
972
998
  }
973
999
  }), e));
974
1000
  }
975
- function xe(i) {
976
- return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => nt(t.style.getPropertyValue("src")));
1001
+ function ve(i) {
1002
+ return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => at(t.style.getPropertyValue("src")));
977
1003
  }
978
- async function ve(i, t) {
1004
+ async function Se(i, t) {
979
1005
  if (i.ownerDocument == null)
980
1006
  throw new Error("Provided element is not within a Document");
981
- const e = p(i.ownerDocument.styleSheets), r = await we(e, t);
982
- return xe(r);
1007
+ const e = f(i.ownerDocument.styleSheets), r = await ke(e, t);
1008
+ return ve(r);
983
1009
  }
984
- function lt(i) {
1010
+ function dt(i) {
985
1011
  return i.trim().replace(/["']/g, "");
986
1012
  }
987
- function ke(i) {
1013
+ function Ee(i) {
988
1014
  const t = /* @__PURE__ */ new Set();
989
1015
  function e(r) {
990
1016
  (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((n) => {
991
- t.add(lt(n));
1017
+ t.add(dt(n));
992
1018
  }), Array.from(r.children).forEach((n) => {
993
1019
  n instanceof HTMLElement && e(n);
994
1020
  });
995
1021
  }
996
1022
  return e(i), t;
997
1023
  }
998
- async function Se(i, t) {
999
- const e = await ve(i, t), r = ke(i);
1000
- return (await Promise.all(e.filter((n) => r.has(lt(n.style.fontFamily))).map((n) => {
1024
+ async function Ce(i, t) {
1025
+ const e = await Se(i, t), r = Ee(i);
1026
+ return (await Promise.all(e.filter((n) => r.has(dt(n.style.fontFamily))).map((n) => {
1001
1027
  const o = n.parentStyleSheet ? n.parentStyleSheet.href : null;
1002
- return ot(n.cssText, o, t);
1028
+ return lt(n.cssText, o, t);
1003
1029
  }))).join(`
1004
1030
  `);
1005
1031
  }
1006
- async function Ee(i, t) {
1007
- const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await Se(i, t);
1032
+ async function _e(i, t) {
1033
+ const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await Ce(i, t);
1008
1034
  if (e) {
1009
1035
  const r = document.createElement("style"), s = document.createTextNode(e);
1010
1036
  r.appendChild(s), i.firstChild ? i.insertBefore(r, i.firstChild) : i.appendChild(r);
1011
1037
  }
1012
1038
  }
1013
- async function Ce(i, t = {}) {
1014
- const { width: e, height: r } = et(i, t), s = await T(i, t, !0);
1015
- return await Ee(s, t), await at(s, t), ye(s, t), await zt(s, e, r);
1039
+ async function Te(i, t = {}) {
1040
+ const { width: e, height: r } = rt(i, t), s = await M(i, t, !0);
1041
+ return await _e(s, t), await ct(s, t), we(s, t), await Wt(s, e, r);
1016
1042
  }
1017
- async function _e(i, t = {}) {
1018
- const { width: e, height: r } = et(i, t), s = await Ce(i, t), n = await _(s), o = document.createElement("canvas"), a = o.getContext("2d"), l = t.pixelRatio || Ut(), c = t.canvasWidth || e, h = t.canvasHeight || r;
1019
- return o.width = c * l, o.height = h * l, t.skipAutoScale || jt(o), o.style.width = `${c}`, o.style.height = `${h}`, t.backgroundColor && (a.fillStyle = t.backgroundColor, a.fillRect(0, 0, o.width, o.height)), a.drawImage(n, 0, 0, o.width, o.height), o;
1043
+ async function Me(i, t = {}) {
1044
+ const { width: e, height: r } = rt(i, t), s = await Te(i, t), n = await T(s), o = document.createElement("canvas"), a = o.getContext("2d"), l = t.pixelRatio || Bt(), c = t.canvasWidth || e, h = t.canvasHeight || r;
1045
+ return o.width = c * l, o.height = h * l, t.skipAutoScale || zt(o), o.style.width = `${c}`, o.style.height = `${h}`, t.backgroundColor && (a.fillStyle = t.backgroundColor, a.fillRect(0, 0, o.width, o.height)), a.drawImage(n, 0, 0, o.width, o.height), o;
1020
1046
  }
1021
- async function Te(i, t = {}) {
1022
- return (await _e(i, t)).toDataURL();
1047
+ async function Le(i, t = {}) {
1048
+ return (await Me(i, t)).toDataURL("image/jpeg", t.quality || 1);
1023
1049
  }
1024
- async function Me(i = []) {
1025
- const t = Le(i);
1050
+ async function Ae(i = []) {
1051
+ const t = De(i);
1026
1052
  try {
1027
- const e = await Te(document.body, {
1053
+ const e = await Le(document.body, {
1054
+ quality: 0.85,
1055
+ pixelRatio: 1,
1056
+ backgroundColor: "#ffffff",
1028
1057
  cacheBust: !0,
1029
1058
  skipAutoScale: !1,
1030
1059
  filter: (r) => !(r instanceof HTMLElement && r.id === "mtb-widget-host")
1031
1060
  });
1032
- return Ae(e);
1061
+ return Ie(e);
1033
1062
  } catch {
1034
1063
  return null;
1035
1064
  } finally {
1036
1065
  t?.remove();
1037
1066
  }
1038
1067
  }
1039
- function Le(i) {
1068
+ function De(i) {
1040
1069
  if (i.length === 0) return null;
1041
1070
  const t = document.createElement("div");
1042
1071
  t.setAttribute("data-mtb-capture-annotations", "true"), t.setAttribute("aria-hidden", "true"), t.style.cssText = "position:fixed;inset:0;pointer-events:none;z-index:2147483645;";
1043
1072
  for (const [e, r] of i.entries())
1044
- r.type === "pin" ? t.appendChild(De(r, e + 1)) : r.type === "draw" && r.drawPath && t.appendChild(Re(r.drawPath));
1073
+ r.type === "pin" ? t.appendChild(Re(r, e + 1)) : r.type === "draw" && r.drawPath && t.appendChild(Pe(r.drawPath));
1045
1074
  return document.body.appendChild(t), t;
1046
1075
  }
1047
- function De(i, t) {
1076
+ function Re(i, t) {
1048
1077
  const e = document.createElement("div");
1049
1078
  return e.textContent = String(t), e.style.cssText = [
1050
1079
  "position:fixed",
@@ -1064,19 +1093,19 @@ function De(i, t) {
1064
1093
  "transform:translate(-50%,-50%)"
1065
1094
  ].join(";"), e;
1066
1095
  }
1067
- function Re(i) {
1096
+ function Pe(i) {
1068
1097
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1069
1098
  t.setAttribute("width", "100%"), t.setAttribute("height", "100%"), t.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.innerHeight}`), t.style.cssText = "position:fixed;inset:0;width:100%;height:100%;overflow:visible;";
1070
1099
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1071
1100
  return e.setAttribute("d", i), e.setAttribute("fill", "none"), e.setAttribute("stroke", "#059669"), e.setAttribute("stroke-width", "3.5"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "round"), e.setAttribute("filter", "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"), t.appendChild(e), t;
1072
1101
  }
1073
- function Ae(i) {
1102
+ function Ie(i) {
1074
1103
  const [t, e] = i.split(","), r = t.match(/:(.*?);/)?.[1] ?? "image/png", s = atob(e), n = new Uint8Array(s.length);
1075
1104
  for (let o = 0; o < s.length; o++)
1076
1105
  n[o] = s.charCodeAt(o);
1077
1106
  return new Blob([n], { type: r });
1078
1107
  }
1079
- class Pe {
1108
+ class $e {
1080
1109
  constructor() {
1081
1110
  this.listeners = /* @__PURE__ */ new Set(), this.originalOnError = null, this.installedOnError = null, this.rejectionHandler = null, this.hooked = !1;
1082
1111
  }
@@ -1098,13 +1127,13 @@ class Pe {
1098
1127
  for (const e of this.listeners) e(t);
1099
1128
  }
1100
1129
  }
1101
- const ct = new Pe(), He = 20;
1102
- class $e {
1130
+ const ht = new $e(), He = 20;
1131
+ class Oe {
1103
1132
  constructor() {
1104
1133
  this.errors = [], this.unsubscribe = null;
1105
1134
  }
1106
1135
  start() {
1107
- this.unsubscribe || (this.unsubscribe = ct.subscribe((t) => this.record(t)));
1136
+ this.unsubscribe || (this.unsubscribe = ht.subscribe((t) => this.record(t)));
1108
1137
  }
1109
1138
  record(t) {
1110
1139
  const e = t.line != null ? ` (${t.line}:${t.col ?? 0})` : "";
@@ -1120,7 +1149,7 @@ class $e {
1120
1149
  this.unsubscribe?.(), this.unsubscribe = null;
1121
1150
  }
1122
1151
  }
1123
- const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /* @__PURE__ */ new Set([
1152
+ const Fe = 3, Ue = 1e3, je = 3, Be = 5e3, ze = 500, qe = 500, We = 300, Ne = /* @__PURE__ */ new Set([
1124
1153
  "A",
1125
1154
  "BUTTON",
1126
1155
  "INPUT",
@@ -1129,7 +1158,7 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1129
1158
  "LABEL",
1130
1159
  "SUMMARY",
1131
1160
  "DETAILS"
1132
- ]), We = /* @__PURE__ */ new Set([
1161
+ ]), Ve = /* @__PURE__ */ new Set([
1133
1162
  "button",
1134
1163
  "link",
1135
1164
  "checkbox",
@@ -1143,19 +1172,19 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1143
1172
  "listbox",
1144
1173
  "slider",
1145
1174
  "spinbutton"
1146
- ]), W = [
1175
+ ]), N = [
1147
1176
  "404",
1148
1177
  "500",
1149
1178
  "not found",
1150
1179
  "page not found",
1151
1180
  "server error",
1152
1181
  "internal server error"
1153
- ], S = class S {
1182
+ ], E = class E {
1154
1183
  constructor(t) {
1155
1184
  this.clickHistory = [], this.unsubscribeErrors = null, this.active = !1, this.errorCount = 0, this.deadClickCount = 0, this.cooldownUntil = 0, this.navTimestamps = [], this.boundPopstateHandler = null, this.originalPushState = null, this.originalReplaceState = null, this.installedPushState = null, this.installedReplaceState = null, this.boundSubmitHandler = null, this.boundInvalidHandler = null, this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.onFrustration = t, this.boundClickHandler = (e) => this.handleClick(e);
1156
1185
  }
1157
1186
  start() {
1158
- this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = ct.subscribe((t) => {
1187
+ this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = ht.subscribe((t) => {
1159
1188
  this.errorCount++;
1160
1189
  }), this.startNavigationTracking(), this.startFormTracking(), this.checkErrorPage());
1161
1190
  }
@@ -1185,8 +1214,8 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1185
1214
  if (!e || this.isWidgetElement(e)) return;
1186
1215
  const r = Date.now();
1187
1216
  this.clickHistory.push({ target: e, time: r });
1188
- const s = r - Oe;
1189
- if (this.clickHistory = this.clickHistory.filter((o) => o.time > s), this.clickHistory.filter((o) => o.target === e).length >= Ie) {
1217
+ const s = r - Ue;
1218
+ if (this.clickHistory = this.clickHistory.filter((o) => o.time > s), this.clickHistory.filter((o) => o.target === e).length >= Fe) {
1190
1219
  this.clickHistory = [], this.emitHighPriority({
1191
1220
  signal: "rage_click",
1192
1221
  target: w(e),
@@ -1203,13 +1232,13 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1203
1232
  handleNavigation() {
1204
1233
  const t = Date.now();
1205
1234
  this.navTimestamps.push(t);
1206
- const e = t - Ue;
1207
- this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >= Fe && (this.navTimestamps = [], this.emitIfReady({
1235
+ const e = t - Be;
1236
+ this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >= je && (this.navTimestamps = [], this.emitIfReady({
1208
1237
  signal: "rapid_navigation",
1209
1238
  timestamp: t
1210
1239
  })), setTimeout(() => {
1211
1240
  this.active && this.checkErrorPage();
1212
- }, ze);
1241
+ }, We);
1213
1242
  }
1214
1243
  handleFormSubmit(t) {
1215
1244
  const e = t.target;
@@ -1219,7 +1248,7 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1219
1248
  target: w(e),
1220
1249
  timestamp: Date.now()
1221
1250
  });
1222
- }, je));
1251
+ }, ze));
1223
1252
  }
1224
1253
  handleFormInvalid(t) {
1225
1254
  const e = t.target;
@@ -1235,7 +1264,7 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1235
1264
  const t = location.href;
1236
1265
  if (this.errorPageUrls.has(t)) return;
1237
1266
  const e = document.title.toLowerCase();
1238
- if (W.some((s) => e.includes(s))) {
1267
+ if (N.some((s) => e.includes(s))) {
1239
1268
  this.errorPageUrls.add(t), this.emitHighPriority({
1240
1269
  signal: "error_page",
1241
1270
  detail: document.title,
@@ -1248,7 +1277,7 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1248
1277
  );
1249
1278
  for (const s of r) {
1250
1279
  const n = s.textContent ?? "";
1251
- if (n.length < 200 && W.some((o) => n.toLowerCase().includes(o))) {
1280
+ if (n.length < 200 && N.some((o) => n.toLowerCase().includes(o))) {
1252
1281
  this.errorPageUrls.add(t), this.emitHighPriority({
1253
1282
  signal: "error_page",
1254
1283
  detail: n.trim().slice(0, 60),
@@ -1270,7 +1299,7 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1270
1299
  target: w(t),
1271
1300
  timestamp: e
1272
1301
  });
1273
- }, Be));
1302
+ }, qe));
1274
1303
  }
1275
1304
  ensureDomObserver() {
1276
1305
  this.domObserver || (this.domObserver = new MutationObserver(() => {
@@ -1295,9 +1324,9 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1295
1324
  return !1;
1296
1325
  }
1297
1326
  isInteractive(t) {
1298
- if (qe.has(t.tagName)) return !0;
1327
+ if (Ne.has(t.tagName)) return !0;
1299
1328
  const e = t.getAttribute("role");
1300
- return !!(e && We.has(e) || t.hasAttribute("onclick") || t.hasAttribute("tabindex") || t.contentEditable === "true" || window.getComputedStyle(t).cursor === "pointer" || t.closest('a, button, [role="button"], [role="link"], label'));
1329
+ return !!(e && Ve.has(e) || t.hasAttribute("onclick") || t.hasAttribute("tabindex") || t.contentEditable === "true" || window.getComputedStyle(t).cursor === "pointer" || t.closest('a, button, [role="button"], [role="link"], label'));
1301
1330
  }
1302
1331
  isWidgetElement(t) {
1303
1332
  const e = document.getElementById("mtb-widget-host");
@@ -1305,40 +1334,40 @@ const Ie = 3, Oe = 1e3, Fe = 3, Ue = 5e3, je = 500, Be = 500, ze = 300, qe = /*
1305
1334
  }
1306
1335
  emitIfReady(t) {
1307
1336
  const e = Date.now();
1308
- e < this.cooldownUntil || (this.cooldownUntil = e + S.COOLDOWN_MS, this.onFrustration(t));
1337
+ e < this.cooldownUntil || (this.cooldownUntil = e + E.COOLDOWN_MS, this.onFrustration(t));
1309
1338
  }
1310
1339
  emitHighPriority(t) {
1311
- this.cooldownUntil = Date.now() + S.COOLDOWN_MS, this.onFrustration(t);
1340
+ this.cooldownUntil = Date.now() + E.COOLDOWN_MS, this.onFrustration(t);
1312
1341
  }
1313
1342
  };
1314
- S.COOLDOWN_MS = 6e4;
1315
- let R = S;
1343
+ E.COOLDOWN_MS = 6e4;
1344
+ let P = E;
1316
1345
  function w(i) {
1317
1346
  const t = i.tagName.toLowerCase(), e = i.id ? `#${i.id}` : "", r = i.className && typeof i.className == "string" ? "." + i.className.trim().split(/\s+/).slice(0, 2).join(".") : "", s = i.textContent?.trim().slice(0, 30) ?? "";
1318
1347
  return `<${t}${e}${r}>${s ? ` "${s}"` : ""}`;
1319
1348
  }
1320
- function Ne() {
1349
+ function Ye() {
1321
1350
  return {
1322
1351
  page_url: window.location.href,
1323
1352
  user_agent: navigator.userAgent,
1324
- browser: Ve(),
1325
- os: Ye(),
1353
+ browser: Xe(),
1354
+ os: Ge(),
1326
1355
  screen_width: window.screen.width,
1327
1356
  screen_height: window.screen.height
1328
1357
  };
1329
1358
  }
1330
- function Ve() {
1359
+ function Xe() {
1331
1360
  const i = navigator.userAgent;
1332
1361
  return /Edg\//.test(i) ? `Edge ${i.match(/Edg\/(\S+)/)?.[1] ?? ""}` : /OPR\//.test(i) ? `Opera ${i.match(/OPR\/(\S+)/)?.[1] ?? ""}` : /Chrome\//.test(i) ? `Chrome ${i.match(/Chrome\/(\S+)/)?.[1] ?? ""}` : /Safari\//.test(i) && /Version\//.test(i) ? `Safari ${i.match(/Version\/(\S+)/)?.[1] ?? ""}` : /Firefox\//.test(i) ? `Firefox ${i.match(/Firefox\/(\S+)/)?.[1] ?? ""}` : "Unknown";
1333
1362
  }
1334
- function Ye() {
1363
+ function Ge() {
1335
1364
  const i = navigator.userAgent;
1336
1365
  return /Windows NT 10/.test(i) ? "Windows 10/11" : /Windows NT/.test(i) ? "Windows" : /Mac OS X 10_15|macOS 1[56789]/.test(i) || /Mac OS X/.test(i) ? "macOS" : /Android/.test(i) ? `Android ${i.match(/Android (\d+)/)?.[1] ?? ""}` : /iPhone|iPad|iPod/.test(i) ? "iOS" : /Linux/.test(i) ? "Linux" : "Unknown";
1337
1366
  }
1338
- const Xe = "https://makethisbetter.dev/api/v1";
1339
- class Ke {
1367
+ const Ke = "https://makethisbetter.dev/api/v1";
1368
+ class Je {
1340
1369
  constructor(t, e, r = 1e3, s, n) {
1341
- this.projectKey = t, this.apiUrl = (e ?? Xe).replace(/\/$/, ""), this.retryDelayMs = r, this.userToken = s, this.userTokenFn = n;
1370
+ this.projectKey = t, this.apiUrl = (e ?? Ke).replace(/\/$/, ""), this.retryDelayMs = r, this.userToken = s, this.userTokenFn = n;
1342
1371
  }
1343
1372
  async resolveUserToken() {
1344
1373
  return this.userTokenFn ? this.userTokenFn() : this.userToken;
@@ -1353,9 +1382,12 @@ class Ke {
1353
1382
  const o = JSON.stringify(t.recording_events), a = new Blob([o], { type: "application/json" });
1354
1383
  r.append("feedback[recording]", a, "recording.json"), r.append("feedback[recording_duration]", String(t.recording_duration ?? 0));
1355
1384
  }
1356
- e && r.append("feedback[screenshot]", e, "screenshot.png");
1385
+ if (e) {
1386
+ const o = e.type === "image/jpeg" ? "jpg" : "png";
1387
+ r.append("feedback[screenshot]", e, `screenshot.${o}`);
1388
+ }
1357
1389
  const s = await this.authHeaders();
1358
- return s["X-Idempotency-Key"] = Je(), (await this.fetchWithRetry(`${this.apiUrl}/widget/feedbacks`, {
1390
+ return s["X-Idempotency-Key"] = Ze(), (await this.fetchWithRetry(`${this.apiUrl}/widget/feedbacks`, {
1359
1391
  method: "POST",
1360
1392
  headers: s,
1361
1393
  body: r
@@ -1418,7 +1450,7 @@ class Ke {
1418
1450
  }), a = o.headers.get("Content-Type") ?? "";
1419
1451
  if (!o.ok || !o.body || !a.includes("text/event-stream"))
1420
1452
  throw new Error("clarify stream unavailable");
1421
- return Ge(o.body, r);
1453
+ return Qe(o.body, r);
1422
1454
  }
1423
1455
  async fetchWithRetry(t, e, r = 1) {
1424
1456
  let s;
@@ -1426,25 +1458,25 @@ class Ke {
1426
1458
  s = await fetch(t, e);
1427
1459
  } catch (n) {
1428
1460
  if (r > 0)
1429
- return await N(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
1461
+ return await V(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
1430
1462
  throw n;
1431
1463
  }
1432
1464
  if (s.ok) return s;
1433
1465
  if (s.status >= 500 && r > 0)
1434
- return await N(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
1466
+ return await V(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
1435
1467
  throw new Error(`HTTP ${s.status}`);
1436
1468
  }
1437
1469
  }
1438
- function N(i) {
1470
+ function V(i) {
1439
1471
  return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
1440
1472
  }
1441
- async function Ge(i, t) {
1473
+ async function Qe(i, t) {
1442
1474
  const e = i.getReader(), r = new TextDecoder();
1443
1475
  let s = "", n = { messages: [], done: !0 };
1444
1476
  const o = (a) => {
1445
1477
  const l = a.split(`
1446
- `).find((x) => x.startsWith("event:")), c = a.split(`
1447
- `).find((x) => x.startsWith("data:"));
1478
+ `).find((k) => k.startsWith("event:")), c = a.split(`
1479
+ `).find((k) => k.startsWith("data:"));
1448
1480
  if (!c) return;
1449
1481
  const h = l?.slice(6).trim(), m = JSON.parse(c.slice(5).trim());
1450
1482
  h === "delta" && typeof m.text == "string" ? t(m.text) : h === "done" && (n = {
@@ -1470,10 +1502,10 @@ async function Ge(i, t) {
1470
1502
  }
1471
1503
  return n;
1472
1504
  }
1473
- function Je() {
1505
+ function Ze() {
1474
1506
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
1475
1507
  }
1476
- function Qe(i, t, e, r, s, n, o, a) {
1508
+ function ti(i, t, e, r, s, n, o, a) {
1477
1509
  return {
1478
1510
  description: i,
1479
1511
  ...t,
@@ -1493,50 +1525,50 @@ function Qe(i, t, e, r, s, n, o, a) {
1493
1525
  recording_duration: n?.duration
1494
1526
  };
1495
1527
  }
1496
- const V = "mtb_anon_id", dt = "mtb_reporter_email", ht = "mtb_board_url";
1497
- let Y = null, ut = null, mt = null;
1498
- function X() {
1528
+ const Y = "mtb_anon_id", ut = "mtb_reporter_email", mt = "mtb_board_url";
1529
+ let X = null, ft = null, pt = null;
1530
+ function G() {
1499
1531
  try {
1500
- const i = window.localStorage.getItem(V);
1532
+ const i = window.localStorage.getItem(Y);
1501
1533
  if (i?.startsWith("anon_")) return i;
1502
- const t = J();
1503
- return window.localStorage.setItem(V, t), t;
1534
+ const t = Q();
1535
+ return window.localStorage.setItem(Y, t), t;
1504
1536
  } catch {
1505
- return Y ?? (Y = J()), Y;
1537
+ return X ?? (X = Q()), X;
1506
1538
  }
1507
1539
  }
1508
1540
  function K() {
1509
1541
  try {
1510
- return window.localStorage.getItem(dt) ?? void 0;
1542
+ return window.localStorage.getItem(ut) ?? void 0;
1511
1543
  } catch {
1512
- return ut ?? void 0;
1544
+ return ft ?? void 0;
1513
1545
  }
1514
1546
  }
1515
- function Ze(i) {
1516
- ut = i;
1547
+ function ei(i) {
1548
+ ft = i;
1517
1549
  try {
1518
- window.localStorage.setItem(dt, i);
1550
+ window.localStorage.setItem(ut, i);
1519
1551
  } catch {
1520
1552
  }
1521
1553
  }
1522
- function ti() {
1554
+ function ii() {
1523
1555
  try {
1524
- return window.localStorage.getItem(ht) ?? void 0;
1556
+ return window.localStorage.getItem(mt) ?? void 0;
1525
1557
  } catch {
1526
- return mt ?? void 0;
1558
+ return pt ?? void 0;
1527
1559
  }
1528
1560
  }
1529
- function G(i) {
1530
- mt = i;
1561
+ function J(i) {
1562
+ pt = i;
1531
1563
  try {
1532
- window.localStorage.setItem(ht, i);
1564
+ window.localStorage.setItem(mt, i);
1533
1565
  } catch {
1534
1566
  }
1535
1567
  }
1536
- function J() {
1568
+ function Q() {
1537
1569
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
1538
1570
  }
1539
- const ei = {
1571
+ const ri = {
1540
1572
  tab: "Feedback",
1541
1573
  toolbar: {
1542
1574
  markup: "Mark up",
@@ -1592,12 +1624,14 @@ const ei = {
1592
1624
  max_reached: "Maximum recording time reached"
1593
1625
  },
1594
1626
  clarify: {
1627
+ title: "Make This Better AI",
1628
+ subtitle: "Sharpening your feedback",
1595
1629
  thinking: "Thinking...",
1596
- placeholder: "Type your response...",
1630
+ placeholder: "Type your answer — or Skip",
1597
1631
  send: "Send",
1598
1632
  skip: "Skip"
1599
1633
  }
1600
- }, ii = {
1634
+ }, si = {
1601
1635
  tab: "反馈",
1602
1636
  toolbar: {
1603
1637
  markup: "标注",
@@ -1653,12 +1687,14 @@ const ei = {
1653
1687
  max_reached: "已达到最大录制时长"
1654
1688
  },
1655
1689
  clarify: {
1690
+ title: "让它更好 AI",
1691
+ subtitle: "正在完善你的反馈",
1656
1692
  thinking: "思考中...",
1657
- placeholder: "输入你的回复...",
1693
+ placeholder: "输入你的回答 —— 或跳过",
1658
1694
  send: "发送",
1659
1695
  skip: "跳过"
1660
1696
  }
1661
- }, ri = {
1697
+ }, ni = {
1662
1698
  tab: "フィードバック",
1663
1699
  toolbar: {
1664
1700
  markup: "マークアップ",
@@ -1714,12 +1750,14 @@ const ei = {
1714
1750
  max_reached: "最大録画時間に達しました"
1715
1751
  },
1716
1752
  clarify: {
1753
+ title: "Make This Better AI",
1754
+ subtitle: "フィードバックを整えています",
1717
1755
  thinking: "考え中...",
1718
- placeholder: "回答を入力...",
1756
+ placeholder: "回答を入力 — またはスキップ",
1719
1757
  send: "送信",
1720
1758
  skip: "スキップ"
1721
1759
  }
1722
- }, si = {
1760
+ }, oi = {
1723
1761
  tab: "피드백",
1724
1762
  toolbar: {
1725
1763
  markup: "마크업",
@@ -1775,12 +1813,14 @@ const ei = {
1775
1813
  max_reached: "최대 녹화 시간에 도달했습니다"
1776
1814
  },
1777
1815
  clarify: {
1816
+ title: "Make This Better AI",
1817
+ subtitle: "피드백을 다듬는 중",
1778
1818
  thinking: "생각 중...",
1779
- placeholder: "답변을 입력하세요...",
1819
+ placeholder: "답변 입력 — 또는 건너뛰기",
1780
1820
  send: "보내기",
1781
1821
  skip: "건너뛰기"
1782
1822
  }
1783
- }, ni = {
1823
+ }, ai = {
1784
1824
  tab: "Comentarios",
1785
1825
  toolbar: {
1786
1826
  markup: "Anotar",
@@ -1836,12 +1876,14 @@ const ei = {
1836
1876
  max_reached: "Se alcanzó el tiempo máximo de grabación"
1837
1877
  },
1838
1878
  clarify: {
1879
+ title: "Make This Better AI",
1880
+ subtitle: "Afinando tus comentarios",
1839
1881
  thinking: "Pensando...",
1840
- placeholder: "Escribe tu respuesta...",
1882
+ placeholder: "Escribe tu respuesta — o Omitir",
1841
1883
  send: "Enviar",
1842
1884
  skip: "Omitir"
1843
1885
  }
1844
- }, oi = {
1886
+ }, li = {
1845
1887
  tab: "Avis",
1846
1888
  toolbar: {
1847
1889
  markup: "Annoter",
@@ -1897,12 +1939,14 @@ const ei = {
1897
1939
  max_reached: "Durée maximale d'enregistrement atteinte"
1898
1940
  },
1899
1941
  clarify: {
1942
+ title: "Make This Better AI",
1943
+ subtitle: "Affinement de votre retour",
1900
1944
  thinking: "Réflexion...",
1901
- placeholder: "Tapez votre réponse...",
1945
+ placeholder: "Saisissez votre réponse — ou Ignorer",
1902
1946
  send: "Envoyer",
1903
1947
  skip: "Passer"
1904
1948
  }
1905
- }, ai = {
1949
+ }, ci = {
1906
1950
  tab: "Feedback",
1907
1951
  toolbar: {
1908
1952
  markup: "Markieren",
@@ -1958,57 +2002,59 @@ const ei = {
1958
2002
  max_reached: "Maximale Aufnahmezeit erreicht"
1959
2003
  },
1960
2004
  clarify: {
2005
+ title: "Make This Better AI",
2006
+ subtitle: "Wir schärfen dein Feedback",
1961
2007
  thinking: "Einen Moment...",
1962
- placeholder: "Antwort eingeben...",
2008
+ placeholder: "Gib deine Antwort ein — oder Überspringen",
1963
2009
  send: "Senden",
1964
2010
  skip: "Überspringen"
1965
2011
  }
1966
- }, k = {
1967
- en: ei,
1968
- "zh-CN": ii,
1969
- ja: ri,
1970
- ko: si,
1971
- es: ni,
1972
- fr: oi,
1973
- de: ai
2012
+ }, S = {
2013
+ en: ri,
2014
+ "zh-CN": si,
2015
+ ja: ni,
2016
+ ko: oi,
2017
+ es: ai,
2018
+ fr: li,
2019
+ de: ci
1974
2020
  };
1975
- function li(i) {
1976
- if (k[i]) return k[i];
2021
+ function di(i) {
2022
+ if (S[i]) return S[i];
1977
2023
  const t = i.split("-")[0];
1978
- return k[t] ? k[t] : k.en;
2024
+ return S[t] ? S[t] : S.en;
1979
2025
  }
1980
- const ci = 60, di = "https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js", hi = "sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";
1981
- let E = null;
1982
- function ui() {
1983
- return E || (E = mi().catch(() => pi()), E);
2026
+ const hi = 60, ui = "https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js", mi = "sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";
2027
+ let C = null;
2028
+ function fi() {
2029
+ return C || (C = pi().catch(() => bi()), C);
1984
2030
  }
1985
- async function mi() {
2031
+ async function pi() {
1986
2032
  return (await import("@rrweb/record")).record;
1987
2033
  }
1988
- function Q() {
2034
+ function Z() {
1989
2035
  const i = globalThis;
1990
2036
  return i.rrwebRecord?.record ?? i.rrweb?.record;
1991
2037
  }
1992
- function pi() {
2038
+ function bi() {
1993
2039
  return new Promise((i, t) => {
1994
- const e = Q();
2040
+ const e = Z();
1995
2041
  if (e) {
1996
2042
  i(e);
1997
2043
  return;
1998
2044
  }
1999
2045
  const r = document.createElement("script");
2000
- r.src = di, r.integrity = hi, r.crossOrigin = "anonymous", r.onload = () => {
2001
- const s = Q();
2046
+ r.src = ui, r.integrity = mi, r.crossOrigin = "anonymous", r.onload = () => {
2047
+ const s = Z();
2002
2048
  s ? i(s) : t(new Error("rrweb record global not found after script load"));
2003
2049
  }, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
2004
2050
  });
2005
2051
  }
2006
- class fi {
2052
+ class gi {
2007
2053
  constructor(t, e) {
2008
2054
  this.events = [], this.stopFn = null, this.startedAt = 0, this.timer = null, this.clickHandler = null, this.stopped = !1, this.shadow = t, this.onMaxReached = e;
2009
2055
  }
2010
2056
  async start() {
2011
- const t = await ui();
2057
+ const t = await fi();
2012
2058
  this.startedAt = Date.now(), this.stopped = !1, this.stopFn = t({
2013
2059
  emit: (e) => {
2014
2060
  this.stopped || this.events.push(e);
@@ -2021,7 +2067,7 @@ class fi {
2021
2067
  });
2022
2068
  }, document.addEventListener("click", this.clickHandler, !0), this.timer = setTimeout(() => {
2023
2069
  this.onMaxReached?.();
2024
- }, ci * 1e3);
2070
+ }, hi * 1e3);
2025
2071
  }
2026
2072
  stop() {
2027
2073
  return this.stopped = !0, this.stopFn?.(), this.stopFn = null, this.cleanupTimer(), this.cleanupClickHandler(), {
@@ -2046,7 +2092,7 @@ class fi {
2046
2092
  r.style.left = `${t}px`, r.style.top = `${e}px`, this.shadow.append(r), r.addEventListener("animationend", () => r.remove());
2047
2093
  }
2048
2094
  }
2049
- class bi {
2095
+ class yi {
2050
2096
  constructor(t, e, r, s) {
2051
2097
  this.intervalId = null, this.getDuration = r, this.el = t.el("div", "mtb-record-bar"), this.el.innerHTML = `
2052
2098
  <span class="mtb-record-dot"></span>
@@ -2062,12 +2108,12 @@ class bi {
2062
2108
  this.intervalId && (clearInterval(this.intervalId), this.intervalId = null), this.el.remove();
2063
2109
  }
2064
2110
  }
2065
- class gi {
2111
+ class xi {
2066
2112
  constructor() {
2067
2113
  this.session = null, this.bar = null, this.result = null;
2068
2114
  }
2069
2115
  async start(t, e, r) {
2070
- this.session = new fi(t, r), this.bar = new bi(
2116
+ this.session = new gi(t, r), this.bar = new yi(
2071
2117
  t,
2072
2118
  e,
2073
2119
  () => this.session?.getDuration() ?? 0,
@@ -2087,12 +2133,12 @@ class gi {
2087
2133
  this.session?.destroy(), this.session = null, this.bar?.destroy(), this.bar = null;
2088
2134
  }
2089
2135
  }
2090
- class Z {
2136
+ class tt {
2091
2137
  constructor(t) {
2092
- this.tab = null, this.toolbar = null, this.session = null, this.popup = null, this.clarify = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.mode = "idle", this.currentAnnotation = null, this.recordingManager = null, this.lastHandoff = {}, this.config = t, this.messages = li(t.locale ?? "en"), this.apiClient = new Ke(t.projectKey, t.apiUrl, void 0, t.userToken, t.userTokenFn), this.consoleCollector = new $e(), this.consoleCollector.start(), this.buildUI(), t.frustrationDetection !== !1 && (this.frustrationDetector = new R(() => this.handleFrustration()), this.frustrationDetector.start());
2138
+ this.tab = null, this.toolbar = null, this.session = null, this.popup = null, this.clarify = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.mode = "idle", this.currentAnnotation = null, this.lastPopupPos = null, this.recordingManager = null, this.lastHandoff = {}, this.config = t, this.messages = di(t.locale ?? "en"), this.apiClient = new Je(t.projectKey, t.apiUrl, void 0, t.userToken, t.userTokenFn), this.consoleCollector = new Oe(), this.consoleCollector.start(), this.buildUI(), t.frustrationDetection !== !1 && (this.frustrationDetector = new P(() => this.handleFrustration()), this.frustrationDetector.start());
2093
2139
  }
2094
2140
  buildUI() {
2095
- this.shadow = new ft(this.config.theme ?? "auto"), this.tab = new bt(
2141
+ this.shadow = new gt(this.config.theme ?? "auto"), this.tab = new yt(
2096
2142
  this.shadow,
2097
2143
  this.messages,
2098
2144
  this.config.position ?? "right",
@@ -2104,7 +2150,7 @@ class Z {
2104
2150
  this.mode === "idle" ? (this.dismissFrustrationPrompt(), this.enterAnnotationMode()) : this.exitAll();
2105
2151
  }
2106
2152
  handleFrustration() {
2107
- this.mode !== "idle" || this.frustrationPrompt || (this.frustrationPrompt = new yt(this.shadow, this.messages, {
2153
+ this.mode !== "idle" || this.frustrationPrompt || (this.frustrationPrompt = new wt(this.shadow, this.messages, {
2108
2154
  onTell: () => {
2109
2155
  this.dismissFrustrationPrompt(), this.enterAnnotationMode();
2110
2156
  },
@@ -2115,26 +2161,26 @@ class Z {
2115
2161
  this.frustrationPrompt?.destroy(), this.frustrationPrompt = null;
2116
2162
  }
2117
2163
  enterAnnotationMode() {
2118
- this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new wt(
2164
+ this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new kt(
2119
2165
  this.shadow,
2120
2166
  this.messages,
2121
2167
  () => this.exitAll(),
2122
2168
  (t) => this.handleToolbarModeChange(t)
2123
- ), this.session = new $(this.shadow, this.messages, (t, e) => {
2169
+ ), this.session = new H(this.shadow, this.messages, (t, e) => {
2124
2170
  this.currentAnnotation = t, this.showPopup(t.x, t.y, e);
2125
2171
  });
2126
2172
  }
2127
2173
  handleToolbarModeChange(t) {
2128
- t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new gi(), this.recordingManager.start(this.shadow, this.messages, () => {
2174
+ t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new xi(), this.recordingManager.start(this.shadow, this.messages, () => {
2129
2175
  this.recordingManager && (this.recordingManager.stop(), this.showPopup(window.innerWidth / 2, window.innerHeight / 2, this.messages.record.timer_label));
2130
2176
  }).catch((e) => {
2131
2177
  console.warn("[MakeThisBetter] Screen recording unavailable, falling back to markup:", e), this.mode === "recording" && (this.toolbar?.setMode("markup"), this.handleToolbarModeChange("markup"));
2132
- })) : (this.recordingManager?.destroy(), this.recordingManager = null, this.session || (this.session = new $(this.shadow, this.messages, (e, r) => {
2178
+ })) : (this.recordingManager?.destroy(), this.recordingManager = null, this.session || (this.session = new H(this.shadow, this.messages, (e, r) => {
2133
2179
  this.currentAnnotation = e, this.showPopup(e.x, e.y, r);
2134
2180
  })), this.mode = "annotating");
2135
2181
  }
2136
2182
  showPopup(t, e, r) {
2137
- this.mode = "popup", this.session?.dismissInteraction(), this.popup = new Tt(this.shadow, {
2183
+ this.mode = "popup", this.lastPopupPos = { x: t, y: e }, this.session?.dismissInteraction(), this.popup = new Lt(this.shadow, {
2138
2184
  targetName: r,
2139
2185
  x: t,
2140
2186
  y: e,
@@ -2145,40 +2191,42 @@ class Z {
2145
2191
  });
2146
2192
  }
2147
2193
  buildMyFeedbackHandler() {
2148
- if (!this.config.user && ti())
2194
+ if (!this.config.user && ii())
2149
2195
  return async () => {
2150
- const t = await this.apiClient.createIdentityToken(X());
2151
- !t?.identity_token || !t.board_url || (G(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
2196
+ const t = await this.apiClient.createIdentityToken(G());
2197
+ !t?.identity_token || !t.board_url || (J(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
2152
2198
  };
2153
2199
  }
2154
2200
  async handleSubmit(t) {
2155
2201
  if (!this.popup) return;
2156
2202
  this.popup.setLoading(!0);
2157
2203
  const e = this.currentAnnotation, r = this.recordingManager?.getRecording() ?? void 0, [s, n] = await Promise.all([
2158
- Me(e ? [e] : []),
2159
- Promise.resolve(Ne())
2160
- ]), o = Qe(
2204
+ Ae(e ? [e] : []),
2205
+ Promise.resolve(Ye())
2206
+ ]), o = ti(
2161
2207
  t,
2162
2208
  n,
2163
2209
  this.consoleCollector.getErrors(),
2164
2210
  e,
2165
2211
  this.config.user,
2166
2212
  r,
2167
- this.config.user ? void 0 : X(),
2213
+ this.config.user ? void 0 : G(),
2168
2214
  this.config.user ? void 0 : K()
2169
2215
  );
2170
2216
  try {
2171
2217
  const a = await this.apiClient.submitFeedback(o, s);
2172
- this.lastHandoff = { feedbackId: a.id, boardUrl: a.board_url, identityToken: a.identity_token }, a.board_url && G(a.board_url), this.popup?.destroy(), this.popup = null, this.session?.destroy(), this.session = null, this.toolbar?.destroy(), this.toolbar = null, this.recordingManager?.destroy(), this.recordingManager = null, a.skip_followup === !0 || a.ai_clarify_available === !1 ? this.showSuccess({ skipFollowup: !0 }) : this.showClarify(a.id);
2218
+ this.lastHandoff = { feedbackId: a.id, boardUrl: a.board_url, identityToken: a.identity_token }, a.board_url && J(a.board_url), this.popup?.destroy(), this.popup = null, this.session?.destroy(), this.session = null, this.toolbar?.destroy(), this.toolbar = null, this.recordingManager?.destroy(), this.recordingManager = null, a.skip_followup === !0 || a.ai_clarify_available === !1 ? this.showSuccess({ skipFollowup: !0 }) : this.showClarify(a.id, this.lastPopupPos);
2173
2219
  } catch {
2174
2220
  this.popup?.setLoading(!1), this.popup?.setError(this.messages.error.submit);
2175
2221
  }
2176
2222
  }
2177
- showClarify(t) {
2178
- this.mode = "idle", this.tab?.setActive(!1), this.clarify = new Rt(this.shadow, {
2223
+ showClarify(t, e) {
2224
+ this.mode = "clarifying", this.tab?.setActive(!0), this.clarify = new Pt(this.shadow, {
2179
2225
  feedbackId: t,
2180
2226
  apiClient: this.apiClient,
2181
2227
  messages: this.messages,
2228
+ x: e?.x,
2229
+ y: e?.y,
2182
2230
  onDone: () => {
2183
2231
  this.clarify?.destroy(), this.clarify = null, this.showSuccess();
2184
2232
  }
@@ -2195,7 +2243,7 @@ class Z {
2195
2243
  return {
2196
2244
  onSubmit: async (r) => {
2197
2245
  const s = await this.apiClient.updateReporter(t, r, e);
2198
- return s && Ze(r), s;
2246
+ return s && ei(r), s;
2199
2247
  }
2200
2248
  };
2201
2249
  }
@@ -2220,19 +2268,19 @@ class Z {
2220
2268
  this.exitAll(), this.consoleCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.recordingManager?.destroy(), this.shadow.destroy();
2221
2269
  }
2222
2270
  }
2223
- let b = null;
2224
- const yi = {
2271
+ let g = null;
2272
+ const wi = {
2225
2273
  init(i) {
2226
- b && (b.destroy(), b = null), document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
2227
- b = new Z(i);
2228
- }) : b = new Z(i);
2274
+ g && (g.destroy(), g = null), document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
2275
+ g = new tt(i);
2276
+ }) : g = new tt(i);
2229
2277
  },
2230
2278
  destroy() {
2231
- b?.destroy(), b = null;
2279
+ g?.destroy(), g = null;
2232
2280
  }
2233
2281
  };
2234
- typeof window < "u" && (window.MakeThisBetter = yi);
2282
+ typeof window < "u" && (window.MakeThisBetter = wi);
2235
2283
  export {
2236
- yi as MakeThisBetter
2284
+ wi as MakeThisBetter
2237
2285
  };
2238
2286
  //# sourceMappingURL=makethisbetter.esm.js.map