makethisbetter 1.5.0 → 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.
- package/dist/api/client.d.ts +6 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/i18n/de.d.ts +2 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/es.d.ts +2 -0
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/fr.d.ts +2 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/ja.d.ts +2 -0
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ko.d.ts +2 -0
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/zh-CN.d.ts +2 -0
- package/dist/i18n/zh-CN.d.ts.map +1 -1
- package/dist/makethisbetter.cjs +36 -15
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +480 -356
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +36 -15
- package/dist/makethisbetter.js.map +1 -1
- package/dist/popup/clarify.d.ts +10 -0
- package/dist/popup/clarify.d.ts.map +1 -1
- package/dist/screenshot/capture.d.ts.map +1 -1
- package/dist/widget/controller.d.ts +1 -0
- package/dist/widget/controller.d.ts.map +1 -1
- package/dist/widget/shadow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/client.test.ts +31 -0
- package/src/api/client.ts +75 -2
- package/src/i18n/de.ts +3 -1
- package/src/i18n/en.ts +3 -1
- package/src/i18n/es.ts +3 -1
- package/src/i18n/fr.ts +3 -1
- package/src/i18n/ja.ts +3 -1
- package/src/i18n/ko.ts +3 -1
- package/src/i18n/zh-CN.ts +3 -1
- package/src/popup/clarify.test.ts +136 -27
- package/src/popup/clarify.ts +128 -42
- package/src/screenshot/capture.test.ts +14 -12
- package/src/screenshot/capture.ts +8 -2
- package/src/styles/widget.css +137 -57
- package/src/widget/controller.test.ts +45 -0
- package/src/widget/controller.ts +11 -5
- package/src/widget/shadow.test.ts +19 -0
- package/src/widget/shadow.ts +4 -1
|
@@ -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
|
|
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 =
|
|
6
|
+
e.textContent = bt, this.root.appendChild(e);
|
|
7
7
|
}
|
|
8
8
|
el(t, e) {
|
|
9
9
|
const r = document.createElement(t);
|
|
@@ -17,10 +17,10 @@ class ft {
|
|
|
17
17
|
e.parentNode === this.root && this.root.removeChild(e);
|
|
18
18
|
}
|
|
19
19
|
destroy() {
|
|
20
|
-
|
|
20
|
+
this.host.remove();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
class
|
|
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
|
|
37
|
-
class
|
|
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">⚠️</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,
|
|
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
|
|
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
|
|
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
|
|
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 kt {
|
|
|
109
109
|
this.highlightEl.remove();
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
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 vt(i) {
|
|
|
126
126
|
}
|
|
127
127
|
return i.tagName.toLowerCase();
|
|
128
128
|
}
|
|
129
|
-
function
|
|
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
|
|
154
|
+
class _t {
|
|
155
155
|
constructor(t) {
|
|
156
156
|
this.pins = [], this.shadow = t;
|
|
157
157
|
}
|
|
@@ -167,19 +167,19 @@ class Et {
|
|
|
167
167
|
this.clearAll();
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
const
|
|
171
|
-
color:
|
|
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
|
|
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
|
}
|
|
181
181
|
startDraw(t, e) {
|
|
182
|
-
this.isDrawing = !0, this.points = [[t, e]], this.path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this.path.setAttribute("fill", "none"), this.path.setAttribute("stroke",
|
|
182
|
+
this.isDrawing = !0, this.points = [[t, e]], this.path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this.path.setAttribute("fill", "none"), this.path.setAttribute("stroke", v.color), this.path.setAttribute("stroke-width", v.width), this.path.setAttribute("stroke-linecap", v.linecap), this.path.setAttribute("stroke-linejoin", v.linejoin), this.path.setAttribute("style", `filter:${v.filter}`), this.svg.appendChild(this.path);
|
|
183
183
|
}
|
|
184
184
|
continueDraw(t, e) {
|
|
185
185
|
!this.isDrawing || !this.path || (this.points.push([t, e]), this.path.setAttribute("d", this.buildPathD()));
|
|
@@ -229,12 +229,12 @@ class Ct {
|
|
|
229
229
|
this.svg.remove();
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
const
|
|
232
|
+
const Mt = 5;
|
|
233
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
|
|
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
|
|
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 H {
|
|
|
257
257
|
}
|
|
258
258
|
updateHighlight() {
|
|
259
259
|
if (!this.interactionActive || this.drawLayer.isCurrentlyDrawing()) return;
|
|
260
|
-
const t =
|
|
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 H {
|
|
|
265
265
|
}
|
|
266
266
|
handleMouseUp(t) {
|
|
267
267
|
if (!this.drawLayer.isCurrentlyDrawing()) return;
|
|
268
|
-
if (this.drawLayer.getPointCount() >=
|
|
268
|
+
if (this.drawLayer.getPointCount() >= Mt) {
|
|
269
269
|
this.drawLayer.endDraw();
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
272
|
this.drawLayer.cancelCurrentDraw();
|
|
273
|
-
const e =
|
|
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 ?
|
|
277
|
+
targetSelector: e ? Ct(e) : void 0,
|
|
278
278
|
targetText: e?.textContent?.trim().slice(0, 200) ?? "",
|
|
279
279
|
targetName: r
|
|
280
280
|
};
|
|
@@ -287,10 +287,10 @@ class H {
|
|
|
287
287
|
this.dismissInteraction(), this.pinMarker.destroy(), this.drawLayer.destroy();
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function O(i, t) {
|
|
291
291
|
return document.elementsFromPoint(i, t).find((e) => e.id !== "mtb-widget-host") ?? null;
|
|
292
292
|
}
|
|
293
|
-
class
|
|
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
|
}
|
|
@@ -368,72 +368,121 @@ class Mt {
|
|
|
368
368
|
function p(i) {
|
|
369
369
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
370
370
|
}
|
|
371
|
-
const
|
|
372
|
-
class
|
|
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.doneTimer = 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.
|
|
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
|
-
<
|
|
380
|
-
<svg width="
|
|
381
|
-
<path d="
|
|
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"
|
|
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
|
-
<
|
|
389
|
-
<
|
|
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
|
-
|
|
422
|
+
const e = () => {
|
|
395
423
|
this.stopPolling(), this.onDone();
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
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() {
|
|
404
|
-
this.showThinking();
|
|
405
|
-
try {
|
|
406
|
-
const t = await this.apiClient.startClarification(this.feedbackId);
|
|
407
|
-
if (this.destroyed) return;
|
|
408
|
-
this.renderConversation(t.messages, t.done), t.done ? this.handleDone() : this.startPolling();
|
|
409
|
-
} catch {
|
|
410
|
-
if (this.destroyed) return;
|
|
411
|
-
this.onDone();
|
|
412
|
-
}
|
|
430
|
+
this.showThinking(), await this.runTurn(void 0);
|
|
413
431
|
}
|
|
414
432
|
async sendMessage(t) {
|
|
415
433
|
const e = this.inputEl.value.trim();
|
|
416
434
|
if (!(!e || this.sending)) {
|
|
417
435
|
this.sending = !0, this.inputEl.disabled = !0, this.sendBtn.disabled = !0, this.stopPolling(), this.appendMessage({ role: "user", content: e }), this.inputEl.value = "", this.showThinking();
|
|
418
436
|
try {
|
|
419
|
-
|
|
420
|
-
if (this.destroyed) return;
|
|
421
|
-
this.renderConversation(r.messages, r.done), r.done ? this.handleDone() : this.startPolling();
|
|
422
|
-
} catch {
|
|
423
|
-
if (this.destroyed) return;
|
|
424
|
-
this.onDone();
|
|
437
|
+
await this.runTurn(e);
|
|
425
438
|
} finally {
|
|
426
|
-
this.sending = !1, this.inputEl.disabled = !1, this.sendBtn.disabled =
|
|
439
|
+
this.sending = !1, this.inputEl.disabled = !1, this.sendBtn.disabled = !1, this.inputEl.focus();
|
|
427
440
|
}
|
|
428
441
|
}
|
|
429
442
|
}
|
|
443
|
+
// Streams the assistant reply; falls back to POST + polling if the backend
|
|
444
|
+
// doesn't support SSE (older server) or the stream errors mid-flight.
|
|
445
|
+
async runTurn(t) {
|
|
446
|
+
try {
|
|
447
|
+
const e = await this.apiClient.streamClarification(
|
|
448
|
+
this.feedbackId,
|
|
449
|
+
t,
|
|
450
|
+
(r) => this.appendStreamDelta(r)
|
|
451
|
+
);
|
|
452
|
+
if (this.destroyed) return;
|
|
453
|
+
this.endStreamingBubble(), this.renderConversation(e.messages, e.done), e.done ? this.handleDone() : this.startPolling();
|
|
454
|
+
} catch {
|
|
455
|
+
if (this.destroyed) return;
|
|
456
|
+
this.endStreamingBubble(), await this.runTurnViaPolling(t);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
async runTurnViaPolling(t) {
|
|
460
|
+
try {
|
|
461
|
+
const e = await this.apiClient.startClarification(this.feedbackId, t);
|
|
462
|
+
if (this.destroyed) return;
|
|
463
|
+
this.renderConversation(e.messages, e.done), e.done ? this.handleDone() : this.startPolling();
|
|
464
|
+
} catch {
|
|
465
|
+
if (this.destroyed) return;
|
|
466
|
+
this.onDone();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
appendStreamDelta(t) {
|
|
470
|
+
this.streamingBubble || (this.removeThinking(), this.streamingBubble = document.createElement("div"), this.streamingBubble.className = "mtb-clarify-bubble mtb-clarify-ai", this.messagesEl.appendChild(this.streamingBubble)), this.streamingBubble.textContent = (this.streamingBubble.textContent ?? "") + t, this.messagesEl.scrollTop = this.messagesEl.scrollHeight;
|
|
471
|
+
}
|
|
472
|
+
endStreamingBubble() {
|
|
473
|
+
this.streamingBubble = null;
|
|
474
|
+
}
|
|
430
475
|
startPolling() {
|
|
431
|
-
this.stopPolling(), this.pollTimer = setInterval(() => this.poll(),
|
|
476
|
+
this.stopPolling(), this.pollDeadline = Date.now() + Rt, this.pollTimer = setInterval(() => this.poll(), At);
|
|
432
477
|
}
|
|
433
478
|
stopPolling() {
|
|
434
479
|
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null);
|
|
435
480
|
}
|
|
436
481
|
async poll() {
|
|
482
|
+
if (Date.now() > this.pollDeadline) {
|
|
483
|
+
this.stopPolling(), this.handleDone();
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
437
486
|
try {
|
|
438
487
|
const t = await this.apiClient.getClarification(this.feedbackId);
|
|
439
488
|
if (this.destroyed) return;
|
|
@@ -446,7 +495,7 @@ class Rt {
|
|
|
446
495
|
handleDone() {
|
|
447
496
|
this.inputEl.disabled = !0, this.sendBtn.disabled = !0, this.doneTimer = setTimeout(() => {
|
|
448
497
|
this.destroyed || this.onDone();
|
|
449
|
-
},
|
|
498
|
+
}, Dt);
|
|
450
499
|
}
|
|
451
500
|
renderConversation(t, e) {
|
|
452
501
|
this.renderMessages(t);
|
|
@@ -464,18 +513,22 @@ class Rt {
|
|
|
464
513
|
e.className = t.role === "user" ? "mtb-clarify-bubble mtb-clarify-user" : "mtb-clarify-bubble mtb-clarify-ai", e.textContent = t.content, this.messagesEl.appendChild(e), this.messagesEl.scrollTop = this.messagesEl.scrollHeight;
|
|
465
514
|
}
|
|
466
515
|
showThinking() {
|
|
516
|
+
if (this.messagesEl.querySelector(".mtb-clarify-thinking")) return;
|
|
467
517
|
const t = document.createElement("div");
|
|
468
518
|
t.className = "mtb-clarify-bubble mtb-clarify-ai mtb-clarify-thinking", t.innerHTML = '<span class="mtb-dot"></span><span class="mtb-dot"></span><span class="mtb-dot"></span>', this.messagesEl.appendChild(t), this.messagesEl.scrollTop = this.messagesEl.scrollHeight;
|
|
469
519
|
}
|
|
520
|
+
removeThinking() {
|
|
521
|
+
this.messagesEl.querySelector(".mtb-clarify-thinking")?.remove();
|
|
522
|
+
}
|
|
470
523
|
destroy() {
|
|
471
524
|
this.destroyed = !0, this.stopPolling(), this.doneTimer !== null && (clearTimeout(this.doneTimer), this.doneTimer = null), this.el.remove();
|
|
472
525
|
}
|
|
473
526
|
}
|
|
474
|
-
function
|
|
527
|
+
function b(i) {
|
|
475
528
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
476
529
|
}
|
|
477
|
-
const
|
|
478
|
-
class
|
|
530
|
+
const It = 5e3, $t = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
531
|
+
class Ht {
|
|
479
532
|
constructor(t, e, r, s, n) {
|
|
480
533
|
this.messages = e, this.el = t.el("div", "mtb-success"), this.el.style.right = "20px", this.el.style.bottom = "20px";
|
|
481
534
|
const o = n?.skipFollowup ? e.success.title_no_ai : e.success.title, a = n?.skipFollowup ? e.success.message_no_ai : e.success.message, l = s ? `<button class="mtb-view-feedback-link">${e.success.view_feedback}</button>` : "", c = n?.emailCapture ? `
|
|
@@ -489,7 +542,7 @@ class Pt {
|
|
|
489
542
|
</div>` : "";
|
|
490
543
|
this.el.innerHTML = `
|
|
491
544
|
<div class="mtb-success-icon">
|
|
492
|
-
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${
|
|
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">
|
|
493
546
|
<polyline points="20 6 9 17 4 12"/>
|
|
494
547
|
</svg>
|
|
495
548
|
</div>
|
|
@@ -498,12 +551,12 @@ class Pt {
|
|
|
498
551
|
${c}
|
|
499
552
|
${l}
|
|
500
553
|
<button class="mtb-close-link">${e.success.close}</button>
|
|
501
|
-
`, 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(),
|
|
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);
|
|
502
555
|
}
|
|
503
556
|
bindEmailCapture(t) {
|
|
504
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 () => {
|
|
505
558
|
const o = e.value.trim();
|
|
506
|
-
if (
|
|
559
|
+
if (!$t.test(o)) {
|
|
507
560
|
e.classList.add("mtb-email-invalid");
|
|
508
561
|
return;
|
|
509
562
|
}
|
|
@@ -517,7 +570,7 @@ class Pt {
|
|
|
517
570
|
this.el.remove();
|
|
518
571
|
}
|
|
519
572
|
}
|
|
520
|
-
function
|
|
573
|
+
function Ot(i, t) {
|
|
521
574
|
if (i.match(/^[a-z]+:\/\//i))
|
|
522
575
|
return i;
|
|
523
576
|
if (i.match(/^\/\//))
|
|
@@ -527,7 +580,7 @@ function Ht(i, t) {
|
|
|
527
580
|
const e = document.implementation.createHTMLDocument(), r = e.createElement("base"), s = e.createElement("a");
|
|
528
581
|
return e.head.appendChild(r), e.body.appendChild(s), t && (r.href = t), s.href = i, s.href;
|
|
529
582
|
}
|
|
530
|
-
const
|
|
583
|
+
const Ft = /* @__PURE__ */ (() => {
|
|
531
584
|
let i = 0;
|
|
532
585
|
const t = () => (
|
|
533
586
|
// eslint-disable-next-line no-bitwise
|
|
@@ -535,33 +588,33 @@ const $t = /* @__PURE__ */ (() => {
|
|
|
535
588
|
);
|
|
536
589
|
return () => (i += 1, `u${t()}${i}`);
|
|
537
590
|
})();
|
|
538
|
-
function
|
|
591
|
+
function f(i) {
|
|
539
592
|
const t = [];
|
|
540
593
|
for (let e = 0, r = i.length; e < r; e++)
|
|
541
594
|
t.push(i[e]);
|
|
542
595
|
return t;
|
|
543
596
|
}
|
|
544
|
-
let
|
|
545
|
-
function
|
|
546
|
-
return
|
|
597
|
+
let y = null;
|
|
598
|
+
function it(i = {}) {
|
|
599
|
+
return y || (i.includeStyleProperties ? (y = i.includeStyleProperties, y) : (y = f(window.getComputedStyle(document.documentElement)), y));
|
|
547
600
|
}
|
|
548
|
-
function
|
|
601
|
+
function _(i, t) {
|
|
549
602
|
const r = (i.ownerDocument.defaultView || window).getComputedStyle(i).getPropertyValue(t);
|
|
550
603
|
return r ? parseFloat(r.replace("px", "")) : 0;
|
|
551
604
|
}
|
|
552
|
-
function
|
|
553
|
-
const t =
|
|
605
|
+
function Ut(i) {
|
|
606
|
+
const t = _(i, "border-left-width"), e = _(i, "border-right-width");
|
|
554
607
|
return i.clientWidth + t + e;
|
|
555
608
|
}
|
|
556
|
-
function
|
|
557
|
-
const t =
|
|
609
|
+
function jt(i) {
|
|
610
|
+
const t = _(i, "border-top-width"), e = _(i, "border-bottom-width");
|
|
558
611
|
return i.clientHeight + t + e;
|
|
559
612
|
}
|
|
560
|
-
function
|
|
561
|
-
const e = t.width ||
|
|
613
|
+
function rt(i, t = {}) {
|
|
614
|
+
const e = t.width || Ut(i), r = t.height || jt(i);
|
|
562
615
|
return { width: e, height: r };
|
|
563
616
|
}
|
|
564
|
-
function
|
|
617
|
+
function Bt() {
|
|
565
618
|
let i, t;
|
|
566
619
|
try {
|
|
567
620
|
t = process;
|
|
@@ -570,11 +623,11 @@ function Ot() {
|
|
|
570
623
|
const e = t && t.env ? t.env.devicePixelRatio : null;
|
|
571
624
|
return e && (i = parseInt(e, 10), Number.isNaN(i) && (i = 1)), i || window.devicePixelRatio || 1;
|
|
572
625
|
}
|
|
573
|
-
const
|
|
574
|
-
function
|
|
575
|
-
(i.width >
|
|
626
|
+
const u = 16384;
|
|
627
|
+
function zt(i) {
|
|
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));
|
|
576
629
|
}
|
|
577
|
-
function
|
|
630
|
+
function T(i) {
|
|
578
631
|
return new Promise((t, e) => {
|
|
579
632
|
const r = new Image();
|
|
580
633
|
r.onload = () => {
|
|
@@ -584,12 +637,12 @@ function E(i) {
|
|
|
584
637
|
}, r.onerror = e, r.crossOrigin = "anonymous", r.decoding = "async", r.src = i;
|
|
585
638
|
});
|
|
586
639
|
}
|
|
587
|
-
async function
|
|
640
|
+
async function qt(i) {
|
|
588
641
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
|
|
589
642
|
}
|
|
590
|
-
async function
|
|
643
|
+
async function Wt(i, t, e) {
|
|
591
644
|
const r = "http://www.w3.org/2000/svg", s = document.createElementNS(r, "svg"), n = document.createElementNS(r, "foreignObject");
|
|
592
|
-
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),
|
|
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);
|
|
593
646
|
}
|
|
594
647
|
const d = (i, t) => {
|
|
595
648
|
if (i instanceof t)
|
|
@@ -597,67 +650,67 @@ const d = (i, t) => {
|
|
|
597
650
|
const e = Object.getPrototypeOf(i);
|
|
598
651
|
return e === null ? !1 : e.constructor.name === t.name || d(e, t);
|
|
599
652
|
};
|
|
600
|
-
function
|
|
653
|
+
function Nt(i) {
|
|
601
654
|
const t = i.getPropertyValue("content");
|
|
602
655
|
return `${i.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
603
656
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
657
|
+
function Vt(i, t) {
|
|
658
|
+
return it(t).map((e) => {
|
|
606
659
|
const r = i.getPropertyValue(e), s = i.getPropertyPriority(e);
|
|
607
660
|
return `${e}: ${r}${s ? " !important" : ""};`;
|
|
608
661
|
}).join(" ");
|
|
609
662
|
}
|
|
610
|
-
function
|
|
611
|
-
const s = `.${i}:${t}`, n = e.cssText ?
|
|
663
|
+
function Yt(i, t, e, r) {
|
|
664
|
+
const s = `.${i}:${t}`, n = e.cssText ? Nt(e) : Vt(e, r);
|
|
612
665
|
return document.createTextNode(`${s}{${n}}`);
|
|
613
666
|
}
|
|
614
|
-
function
|
|
667
|
+
function F(i, t, e, r) {
|
|
615
668
|
const s = window.getComputedStyle(i, e), n = s.getPropertyValue("content");
|
|
616
669
|
if (n === "" || n === "none")
|
|
617
670
|
return;
|
|
618
|
-
const o =
|
|
671
|
+
const o = Ft();
|
|
619
672
|
try {
|
|
620
673
|
t.className = `${t.className} ${o}`;
|
|
621
674
|
} catch {
|
|
622
675
|
return;
|
|
623
676
|
}
|
|
624
677
|
const a = document.createElement("style");
|
|
625
|
-
a.appendChild(
|
|
678
|
+
a.appendChild(Yt(o, e, s, r)), t.appendChild(a);
|
|
626
679
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
680
|
+
function Xt(i, t, e) {
|
|
681
|
+
F(i, t, ":before", e), F(i, t, ":after", e);
|
|
629
682
|
}
|
|
630
|
-
const
|
|
631
|
-
woff:
|
|
632
|
-
woff2:
|
|
683
|
+
const U = "application/font-woff", j = "image/jpeg", Gt = {
|
|
684
|
+
woff: U,
|
|
685
|
+
woff2: U,
|
|
633
686
|
ttf: "application/font-truetype",
|
|
634
687
|
eot: "application/vnd.ms-fontobject",
|
|
635
688
|
png: "image/png",
|
|
636
|
-
jpg:
|
|
637
|
-
jpeg:
|
|
689
|
+
jpg: j,
|
|
690
|
+
jpeg: j,
|
|
638
691
|
gif: "image/gif",
|
|
639
692
|
tiff: "image/tiff",
|
|
640
693
|
svg: "image/svg+xml",
|
|
641
694
|
webp: "image/webp"
|
|
642
695
|
};
|
|
643
|
-
function
|
|
696
|
+
function Kt(i) {
|
|
644
697
|
const t = /\.([^./]*?)$/g.exec(i);
|
|
645
698
|
return t ? t[1] : "";
|
|
646
699
|
}
|
|
647
|
-
function
|
|
648
|
-
const t =
|
|
649
|
-
return
|
|
700
|
+
function I(i) {
|
|
701
|
+
const t = Kt(i).toLowerCase();
|
|
702
|
+
return Gt[t] || "";
|
|
650
703
|
}
|
|
651
|
-
function
|
|
704
|
+
function Jt(i) {
|
|
652
705
|
return i.split(/,/)[1];
|
|
653
706
|
}
|
|
654
|
-
function
|
|
707
|
+
function R(i) {
|
|
655
708
|
return i.search(/^(data:)/) !== -1;
|
|
656
709
|
}
|
|
657
|
-
function
|
|
710
|
+
function Qt(i, t) {
|
|
658
711
|
return `data:${t};base64,${i}`;
|
|
659
712
|
}
|
|
660
|
-
async function
|
|
713
|
+
async function st(i, t, e) {
|
|
661
714
|
const r = await fetch(i, t);
|
|
662
715
|
if (r.status === 404)
|
|
663
716
|
throw new Error(`Resource "${r.url}" not found`);
|
|
@@ -673,86 +726,86 @@ async function et(i, t, e) {
|
|
|
673
726
|
}, a.readAsDataURL(s);
|
|
674
727
|
});
|
|
675
728
|
}
|
|
676
|
-
const
|
|
677
|
-
function
|
|
729
|
+
const D = {};
|
|
730
|
+
function Zt(i, t, e) {
|
|
678
731
|
let r = i.replace(/\?.*/, "");
|
|
679
732
|
return e && (r = i), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
|
|
680
733
|
}
|
|
681
|
-
async function
|
|
682
|
-
const r =
|
|
683
|
-
if (
|
|
684
|
-
return
|
|
734
|
+
async function $(i, t, e) {
|
|
735
|
+
const r = Zt(i, t, e.includeQueryParams);
|
|
736
|
+
if (D[r] != null)
|
|
737
|
+
return D[r];
|
|
685
738
|
e.cacheBust && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
686
739
|
let s;
|
|
687
740
|
try {
|
|
688
|
-
const n = await
|
|
689
|
-
s =
|
|
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);
|
|
690
743
|
} catch (n) {
|
|
691
744
|
s = e.imagePlaceholder || "";
|
|
692
745
|
let o = `Failed to fetch resource: ${i}`;
|
|
693
746
|
n && (o = typeof n == "string" ? n : n.message), o && console.warn(o);
|
|
694
747
|
}
|
|
695
|
-
return
|
|
748
|
+
return D[r] = s, s;
|
|
696
749
|
}
|
|
697
|
-
async function
|
|
750
|
+
async function te(i) {
|
|
698
751
|
const t = i.toDataURL();
|
|
699
|
-
return t === "data:," ? i.cloneNode(!1) :
|
|
752
|
+
return t === "data:," ? i.cloneNode(!1) : T(t);
|
|
700
753
|
}
|
|
701
|
-
async function
|
|
754
|
+
async function ee(i, t) {
|
|
702
755
|
if (i.currentSrc) {
|
|
703
756
|
const n = document.createElement("canvas"), o = n.getContext("2d");
|
|
704
757
|
n.width = i.clientWidth, n.height = i.clientHeight, o?.drawImage(i, 0, 0, n.width, n.height);
|
|
705
758
|
const a = n.toDataURL();
|
|
706
|
-
return
|
|
759
|
+
return T(a);
|
|
707
760
|
}
|
|
708
|
-
const e = i.poster, r =
|
|
709
|
-
return
|
|
761
|
+
const e = i.poster, r = I(e), s = await $(e, r, t);
|
|
762
|
+
return T(s);
|
|
710
763
|
}
|
|
711
|
-
async function
|
|
764
|
+
async function ie(i, t) {
|
|
712
765
|
var e;
|
|
713
766
|
try {
|
|
714
767
|
if (!((e = i?.contentDocument) === null || e === void 0) && e.body)
|
|
715
|
-
return await
|
|
768
|
+
return await M(i.contentDocument.body, t, !0);
|
|
716
769
|
} catch {
|
|
717
770
|
}
|
|
718
771
|
return i.cloneNode(!1);
|
|
719
772
|
}
|
|
720
|
-
async function
|
|
721
|
-
return d(i, HTMLCanvasElement) ?
|
|
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));
|
|
722
775
|
}
|
|
723
|
-
const
|
|
724
|
-
async function
|
|
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) {
|
|
725
778
|
var r, s;
|
|
726
|
-
if (
|
|
779
|
+
if (nt(t))
|
|
727
780
|
return t;
|
|
728
781
|
let n = [];
|
|
729
|
-
return
|
|
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) => {
|
|
730
783
|
l && t.appendChild(l);
|
|
731
784
|
}), Promise.resolve()), t;
|
|
732
785
|
}
|
|
733
|
-
function
|
|
786
|
+
function oe(i, t, e) {
|
|
734
787
|
const r = t.style;
|
|
735
788
|
if (!r)
|
|
736
789
|
return;
|
|
737
790
|
const s = window.getComputedStyle(i);
|
|
738
|
-
s.cssText ? (r.cssText = s.cssText, r.transformOrigin = s.transformOrigin) :
|
|
791
|
+
s.cssText ? (r.cssText = s.cssText, r.transformOrigin = s.transformOrigin) : it(e).forEach((n) => {
|
|
739
792
|
let o = s.getPropertyValue(n);
|
|
740
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));
|
|
741
794
|
});
|
|
742
795
|
}
|
|
743
|
-
function
|
|
796
|
+
function ae(i, t) {
|
|
744
797
|
d(i, HTMLTextAreaElement) && (t.innerHTML = i.value), d(i, HTMLInputElement) && t.setAttribute("value", i.value);
|
|
745
798
|
}
|
|
746
|
-
function
|
|
799
|
+
function le(i, t) {
|
|
747
800
|
if (d(i, HTMLSelectElement)) {
|
|
748
801
|
const e = t, r = Array.from(e.children).find((s) => i.value === s.getAttribute("value"));
|
|
749
802
|
r && r.setAttribute("selected", "");
|
|
750
803
|
}
|
|
751
804
|
}
|
|
752
|
-
function
|
|
753
|
-
return d(t, Element) && (
|
|
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;
|
|
754
807
|
}
|
|
755
|
-
async function
|
|
808
|
+
async function de(i, t) {
|
|
756
809
|
const e = i.querySelectorAll ? i.querySelectorAll("use") : [];
|
|
757
810
|
if (e.length === 0)
|
|
758
811
|
return i;
|
|
@@ -761,7 +814,7 @@ async function ae(i, t) {
|
|
|
761
814
|
const a = e[n].getAttribute("xlink:href");
|
|
762
815
|
if (a) {
|
|
763
816
|
const l = i.querySelector(a), c = document.querySelector(a);
|
|
764
|
-
!l && c && !r[a] && (r[a] = await
|
|
817
|
+
!l && c && !r[a] && (r[a] = await M(c, t, !0));
|
|
765
818
|
}
|
|
766
819
|
}
|
|
767
820
|
const s = Object.values(r);
|
|
@@ -776,31 +829,31 @@ async function ae(i, t) {
|
|
|
776
829
|
}
|
|
777
830
|
return i;
|
|
778
831
|
}
|
|
779
|
-
async function
|
|
780
|
-
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) =>
|
|
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));
|
|
781
834
|
}
|
|
782
|
-
const
|
|
783
|
-
function
|
|
835
|
+
const ot = /url\((['"]?)([^'"]+?)\1\)/g, he = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ue = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
836
|
+
function me(i) {
|
|
784
837
|
const t = i.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
785
838
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
786
839
|
}
|
|
787
|
-
function
|
|
840
|
+
function fe(i) {
|
|
788
841
|
const t = [];
|
|
789
|
-
return i.replace(
|
|
842
|
+
return i.replace(ot, (e, r, s) => (t.push(s), e)), t.filter((e) => !R(e));
|
|
790
843
|
}
|
|
791
|
-
async function
|
|
844
|
+
async function pe(i, t, e, r, s) {
|
|
792
845
|
try {
|
|
793
|
-
const n = e ?
|
|
846
|
+
const n = e ? Ot(t, e) : t, o = I(t);
|
|
794
847
|
let a;
|
|
795
|
-
return s || (a = await
|
|
848
|
+
return s || (a = await $(n, o, r)), i.replace(me(t), `$1${a}$3`);
|
|
796
849
|
} catch {
|
|
797
850
|
}
|
|
798
851
|
return i;
|
|
799
852
|
}
|
|
800
|
-
function
|
|
801
|
-
return t ? i.replace(
|
|
853
|
+
function be(i, { preferredFontFormat: t }) {
|
|
854
|
+
return t ? i.replace(ue, (e) => {
|
|
802
855
|
for (; ; ) {
|
|
803
|
-
const [r, , s] =
|
|
856
|
+
const [r, , s] = he.exec(e) || [];
|
|
804
857
|
if (!s)
|
|
805
858
|
return "";
|
|
806
859
|
if (s === t)
|
|
@@ -808,32 +861,32 @@ function me(i, { preferredFontFormat: t }) {
|
|
|
808
861
|
}
|
|
809
862
|
}) : i;
|
|
810
863
|
}
|
|
811
|
-
function
|
|
812
|
-
return i.search(
|
|
864
|
+
function at(i) {
|
|
865
|
+
return i.search(ot) !== -1;
|
|
813
866
|
}
|
|
814
|
-
async function
|
|
815
|
-
if (!
|
|
867
|
+
async function lt(i, t, e) {
|
|
868
|
+
if (!at(i))
|
|
816
869
|
return i;
|
|
817
|
-
const r =
|
|
818
|
-
return
|
|
870
|
+
const r = be(i, e);
|
|
871
|
+
return fe(r).reduce((n, o) => n.then((a) => pe(a, o, t, e)), Promise.resolve(r));
|
|
819
872
|
}
|
|
820
|
-
async function
|
|
873
|
+
async function x(i, t, e) {
|
|
821
874
|
var r;
|
|
822
875
|
const s = (r = t.style) === null || r === void 0 ? void 0 : r.getPropertyValue(i);
|
|
823
876
|
if (s) {
|
|
824
|
-
const n = await
|
|
877
|
+
const n = await lt(s, null, e);
|
|
825
878
|
return t.style.setProperty(i, n, t.style.getPropertyPriority(i)), !0;
|
|
826
879
|
}
|
|
827
880
|
return !1;
|
|
828
881
|
}
|
|
829
|
-
async function
|
|
830
|
-
await
|
|
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);
|
|
831
884
|
}
|
|
832
|
-
async function
|
|
885
|
+
async function ye(i, t) {
|
|
833
886
|
const e = d(i, HTMLImageElement);
|
|
834
|
-
if (!(e && !
|
|
887
|
+
if (!(e && !R(i.src)) && !(d(i, SVGImageElement) && !R(i.href.baseVal)))
|
|
835
888
|
return;
|
|
836
|
-
const r = e ? i.src : i.href.baseVal, s = await
|
|
889
|
+
const r = e ? i.src : i.href.baseVal, s = await $(r, I(r), t);
|
|
837
890
|
await new Promise((n, o) => {
|
|
838
891
|
i.onload = n, i.onerror = t.onImageErrorHandler ? (...l) => {
|
|
839
892
|
try {
|
|
@@ -846,14 +899,14 @@ async function fe(i, t) {
|
|
|
846
899
|
a.decode && (a.decode = n), a.loading === "lazy" && (a.loading = "eager"), e ? (i.srcset = "", i.src = s) : i.href.baseVal = s;
|
|
847
900
|
});
|
|
848
901
|
}
|
|
849
|
-
async function
|
|
850
|
-
const r =
|
|
902
|
+
async function xe(i, t) {
|
|
903
|
+
const r = f(i.childNodes).map((s) => ct(s, t));
|
|
851
904
|
await Promise.all(r).then(() => i);
|
|
852
905
|
}
|
|
853
|
-
async function
|
|
854
|
-
d(i, Element) && (await
|
|
906
|
+
async function ct(i, t) {
|
|
907
|
+
d(i, Element) && (await ge(i, t), await ye(i, t), await xe(i, t));
|
|
855
908
|
}
|
|
856
|
-
function
|
|
909
|
+
function we(i, t) {
|
|
857
910
|
const { style: e } = i;
|
|
858
911
|
t.backgroundColor && (e.backgroundColor = t.backgroundColor), t.width && (e.width = `${t.width}px`), t.height && (e.height = `${t.height}px`);
|
|
859
912
|
const r = t.style;
|
|
@@ -861,23 +914,23 @@ function ge(i, t) {
|
|
|
861
914
|
e[s] = r[s];
|
|
862
915
|
}), i;
|
|
863
916
|
}
|
|
864
|
-
const
|
|
865
|
-
async function
|
|
866
|
-
let t =
|
|
917
|
+
const B = {};
|
|
918
|
+
async function z(i) {
|
|
919
|
+
let t = B[i];
|
|
867
920
|
if (t != null)
|
|
868
921
|
return t;
|
|
869
922
|
const r = await (await fetch(i)).text();
|
|
870
|
-
return t = { url: i, cssText: r },
|
|
923
|
+
return t = { url: i, cssText: r }, B[i] = t, t;
|
|
871
924
|
}
|
|
872
|
-
async function
|
|
925
|
+
async function q(i, t) {
|
|
873
926
|
let e = i.cssText;
|
|
874
927
|
const r = /url\(["']?([^"')]+)["']?\)/g, n = (e.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
875
928
|
let a = o.replace(r, "$1");
|
|
876
|
-
return a.startsWith("https://") || (a = new URL(a, i.url).href),
|
|
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]));
|
|
877
930
|
});
|
|
878
931
|
return Promise.all(n).then(() => e);
|
|
879
932
|
}
|
|
880
|
-
function
|
|
933
|
+
function W(i) {
|
|
881
934
|
if (i == null)
|
|
882
935
|
return [];
|
|
883
936
|
const t = [], e = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -903,32 +956,32 @@ function B(i) {
|
|
|
903
956
|
}
|
|
904
957
|
return t;
|
|
905
958
|
}
|
|
906
|
-
async function
|
|
959
|
+
async function ke(i, t) {
|
|
907
960
|
const e = [], r = [];
|
|
908
961
|
return i.forEach((s) => {
|
|
909
962
|
if ("cssRules" in s)
|
|
910
963
|
try {
|
|
911
|
-
|
|
964
|
+
f(s.cssRules || []).forEach((n, o) => {
|
|
912
965
|
if (n.type === CSSRule.IMPORT_RULE) {
|
|
913
966
|
let a = o + 1;
|
|
914
|
-
const l = n.href, c =
|
|
967
|
+
const l = n.href, c = z(l).then((h) => q(h, t)).then((h) => W(h).forEach((m) => {
|
|
915
968
|
try {
|
|
916
|
-
s.insertRule(
|
|
917
|
-
} catch (
|
|
969
|
+
s.insertRule(m, m.startsWith("@import") ? a += 1 : s.cssRules.length);
|
|
970
|
+
} catch (k) {
|
|
918
971
|
console.error("Error inserting rule from remote css", {
|
|
919
|
-
rule:
|
|
920
|
-
error:
|
|
972
|
+
rule: m,
|
|
973
|
+
error: k
|
|
921
974
|
});
|
|
922
975
|
}
|
|
923
|
-
})).catch((
|
|
924
|
-
console.error("Error loading remote css",
|
|
976
|
+
})).catch((h) => {
|
|
977
|
+
console.error("Error loading remote css", h.toString());
|
|
925
978
|
});
|
|
926
979
|
r.push(c);
|
|
927
980
|
}
|
|
928
981
|
});
|
|
929
982
|
} catch (n) {
|
|
930
983
|
const o = i.find((a) => a.href == null) || document.styleSheets[0];
|
|
931
|
-
s.href != null && r.push(
|
|
984
|
+
s.href != null && r.push(z(s.href).then((a) => q(a, t)).then((a) => W(a).forEach((l) => {
|
|
932
985
|
o.insertRule(l, o.cssRules.length);
|
|
933
986
|
})).catch((a) => {
|
|
934
987
|
console.error("Error loading remote stylesheet", a);
|
|
@@ -937,7 +990,7 @@ async function ye(i, t) {
|
|
|
937
990
|
}), Promise.all(r).then(() => (i.forEach((s) => {
|
|
938
991
|
if ("cssRules" in s)
|
|
939
992
|
try {
|
|
940
|
-
|
|
993
|
+
f(s.cssRules || []).forEach((n) => {
|
|
941
994
|
e.push(n);
|
|
942
995
|
});
|
|
943
996
|
} catch (n) {
|
|
@@ -945,79 +998,82 @@ async function ye(i, t) {
|
|
|
945
998
|
}
|
|
946
999
|
}), e));
|
|
947
1000
|
}
|
|
948
|
-
function
|
|
949
|
-
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) =>
|
|
1001
|
+
function ve(i) {
|
|
1002
|
+
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => at(t.style.getPropertyValue("src")));
|
|
950
1003
|
}
|
|
951
|
-
async function
|
|
1004
|
+
async function Se(i, t) {
|
|
952
1005
|
if (i.ownerDocument == null)
|
|
953
1006
|
throw new Error("Provided element is not within a Document");
|
|
954
|
-
const e =
|
|
955
|
-
return
|
|
1007
|
+
const e = f(i.ownerDocument.styleSheets), r = await ke(e, t);
|
|
1008
|
+
return ve(r);
|
|
956
1009
|
}
|
|
957
|
-
function
|
|
1010
|
+
function dt(i) {
|
|
958
1011
|
return i.trim().replace(/["']/g, "");
|
|
959
1012
|
}
|
|
960
|
-
function
|
|
1013
|
+
function Ee(i) {
|
|
961
1014
|
const t = /* @__PURE__ */ new Set();
|
|
962
1015
|
function e(r) {
|
|
963
1016
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((n) => {
|
|
964
|
-
t.add(
|
|
1017
|
+
t.add(dt(n));
|
|
965
1018
|
}), Array.from(r.children).forEach((n) => {
|
|
966
1019
|
n instanceof HTMLElement && e(n);
|
|
967
1020
|
});
|
|
968
1021
|
}
|
|
969
1022
|
return e(i), t;
|
|
970
1023
|
}
|
|
971
|
-
async function
|
|
972
|
-
const e = await
|
|
973
|
-
return (await Promise.all(e.filter((n) => r.has(
|
|
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) => {
|
|
974
1027
|
const o = n.parentStyleSheet ? n.parentStyleSheet.href : null;
|
|
975
|
-
return
|
|
1028
|
+
return lt(n.cssText, o, t);
|
|
976
1029
|
}))).join(`
|
|
977
1030
|
`);
|
|
978
1031
|
}
|
|
979
|
-
async function
|
|
980
|
-
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await
|
|
1032
|
+
async function _e(i, t) {
|
|
1033
|
+
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await Ce(i, t);
|
|
981
1034
|
if (e) {
|
|
982
1035
|
const r = document.createElement("style"), s = document.createTextNode(e);
|
|
983
1036
|
r.appendChild(s), i.firstChild ? i.insertBefore(r, i.firstChild) : i.appendChild(r);
|
|
984
1037
|
}
|
|
985
1038
|
}
|
|
986
|
-
async function
|
|
987
|
-
const { width: e, height: r } =
|
|
988
|
-
return await
|
|
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);
|
|
989
1042
|
}
|
|
990
|
-
async function
|
|
991
|
-
const { width: e, height: r } =
|
|
992
|
-
return o.width = c * l, o.height =
|
|
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;
|
|
993
1046
|
}
|
|
994
|
-
async function
|
|
995
|
-
return (await
|
|
1047
|
+
async function Le(i, t = {}) {
|
|
1048
|
+
return (await Me(i, t)).toDataURL("image/jpeg", t.quality || 1);
|
|
996
1049
|
}
|
|
997
|
-
async function
|
|
998
|
-
const t =
|
|
1050
|
+
async function Ae(i = []) {
|
|
1051
|
+
const t = De(i);
|
|
999
1052
|
try {
|
|
1000
|
-
const e = await
|
|
1053
|
+
const e = await Le(document.body, {
|
|
1054
|
+
quality: 0.85,
|
|
1055
|
+
pixelRatio: 1,
|
|
1056
|
+
backgroundColor: "#ffffff",
|
|
1001
1057
|
cacheBust: !0,
|
|
1002
1058
|
skipAutoScale: !1,
|
|
1003
1059
|
filter: (r) => !(r instanceof HTMLElement && r.id === "mtb-widget-host")
|
|
1004
1060
|
});
|
|
1005
|
-
return
|
|
1061
|
+
return Ie(e);
|
|
1006
1062
|
} catch {
|
|
1007
1063
|
return null;
|
|
1008
1064
|
} finally {
|
|
1009
1065
|
t?.remove();
|
|
1010
1066
|
}
|
|
1011
1067
|
}
|
|
1012
|
-
function
|
|
1068
|
+
function De(i) {
|
|
1013
1069
|
if (i.length === 0) return null;
|
|
1014
1070
|
const t = document.createElement("div");
|
|
1015
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;";
|
|
1016
1072
|
for (const [e, r] of i.entries())
|
|
1017
|
-
r.type === "pin" ? t.appendChild(
|
|
1073
|
+
r.type === "pin" ? t.appendChild(Re(r, e + 1)) : r.type === "draw" && r.drawPath && t.appendChild(Pe(r.drawPath));
|
|
1018
1074
|
return document.body.appendChild(t), t;
|
|
1019
1075
|
}
|
|
1020
|
-
function
|
|
1076
|
+
function Re(i, t) {
|
|
1021
1077
|
const e = document.createElement("div");
|
|
1022
1078
|
return e.textContent = String(t), e.style.cssText = [
|
|
1023
1079
|
"position:fixed",
|
|
@@ -1037,19 +1093,19 @@ function Le(i, t) {
|
|
|
1037
1093
|
"transform:translate(-50%,-50%)"
|
|
1038
1094
|
].join(";"), e;
|
|
1039
1095
|
}
|
|
1040
|
-
function
|
|
1096
|
+
function Pe(i) {
|
|
1041
1097
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1042
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;";
|
|
1043
1099
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1044
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;
|
|
1045
1101
|
}
|
|
1046
|
-
function
|
|
1102
|
+
function Ie(i) {
|
|
1047
1103
|
const [t, e] = i.split(","), r = t.match(/:(.*?);/)?.[1] ?? "image/png", s = atob(e), n = new Uint8Array(s.length);
|
|
1048
1104
|
for (let o = 0; o < s.length; o++)
|
|
1049
1105
|
n[o] = s.charCodeAt(o);
|
|
1050
1106
|
return new Blob([n], { type: r });
|
|
1051
1107
|
}
|
|
1052
|
-
class
|
|
1108
|
+
class $e {
|
|
1053
1109
|
constructor() {
|
|
1054
1110
|
this.listeners = /* @__PURE__ */ new Set(), this.originalOnError = null, this.installedOnError = null, this.rejectionHandler = null, this.hooked = !1;
|
|
1055
1111
|
}
|
|
@@ -1071,20 +1127,20 @@ class De {
|
|
|
1071
1127
|
for (const e of this.listeners) e(t);
|
|
1072
1128
|
}
|
|
1073
1129
|
}
|
|
1074
|
-
const
|
|
1075
|
-
class
|
|
1130
|
+
const ht = new $e(), He = 20;
|
|
1131
|
+
class Oe {
|
|
1076
1132
|
constructor() {
|
|
1077
1133
|
this.errors = [], this.unsubscribe = null;
|
|
1078
1134
|
}
|
|
1079
1135
|
start() {
|
|
1080
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1136
|
+
this.unsubscribe || (this.unsubscribe = ht.subscribe((t) => this.record(t)));
|
|
1081
1137
|
}
|
|
1082
1138
|
record(t) {
|
|
1083
1139
|
const e = t.line != null ? ` (${t.line}:${t.col ?? 0})` : "";
|
|
1084
1140
|
this.addError(`${t.message}${e}`);
|
|
1085
1141
|
}
|
|
1086
1142
|
addError(t) {
|
|
1087
|
-
this.errors.length >=
|
|
1143
|
+
this.errors.length >= He || this.errors.includes(t) || this.errors.push(t);
|
|
1088
1144
|
}
|
|
1089
1145
|
getErrors() {
|
|
1090
1146
|
return [...this.errors];
|
|
@@ -1093,7 +1149,7 @@ class He {
|
|
|
1093
1149
|
this.unsubscribe?.(), this.unsubscribe = null;
|
|
1094
1150
|
}
|
|
1095
1151
|
}
|
|
1096
|
-
const
|
|
1152
|
+
const Fe = 3, Ue = 1e3, je = 3, Be = 5e3, ze = 500, qe = 500, We = 300, Ne = /* @__PURE__ */ new Set([
|
|
1097
1153
|
"A",
|
|
1098
1154
|
"BUTTON",
|
|
1099
1155
|
"INPUT",
|
|
@@ -1102,7 +1158,7 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1102
1158
|
"LABEL",
|
|
1103
1159
|
"SUMMARY",
|
|
1104
1160
|
"DETAILS"
|
|
1105
|
-
]),
|
|
1161
|
+
]), Ve = /* @__PURE__ */ new Set([
|
|
1106
1162
|
"button",
|
|
1107
1163
|
"link",
|
|
1108
1164
|
"checkbox",
|
|
@@ -1116,19 +1172,19 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1116
1172
|
"listbox",
|
|
1117
1173
|
"slider",
|
|
1118
1174
|
"spinbutton"
|
|
1119
|
-
]),
|
|
1175
|
+
]), N = [
|
|
1120
1176
|
"404",
|
|
1121
1177
|
"500",
|
|
1122
1178
|
"not found",
|
|
1123
1179
|
"page not found",
|
|
1124
1180
|
"server error",
|
|
1125
1181
|
"internal server error"
|
|
1126
|
-
],
|
|
1182
|
+
], E = class E {
|
|
1127
1183
|
constructor(t) {
|
|
1128
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);
|
|
1129
1185
|
}
|
|
1130
1186
|
start() {
|
|
1131
|
-
this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors =
|
|
1187
|
+
this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = ht.subscribe((t) => {
|
|
1132
1188
|
this.errorCount++;
|
|
1133
1189
|
}), this.startNavigationTracking(), this.startFormTracking(), this.checkErrorPage());
|
|
1134
1190
|
}
|
|
@@ -1158,41 +1214,41 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1158
1214
|
if (!e || this.isWidgetElement(e)) return;
|
|
1159
1215
|
const r = Date.now();
|
|
1160
1216
|
this.clickHistory.push({ target: e, time: r });
|
|
1161
|
-
const s = r -
|
|
1162
|
-
if (this.clickHistory = this.clickHistory.filter((o) => o.time > s), this.clickHistory.filter((o) => o.target === e).length >=
|
|
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) {
|
|
1163
1219
|
this.clickHistory = [], this.emitHighPriority({
|
|
1164
1220
|
signal: "rage_click",
|
|
1165
|
-
target:
|
|
1221
|
+
target: w(e),
|
|
1166
1222
|
timestamp: r
|
|
1167
1223
|
});
|
|
1168
1224
|
return;
|
|
1169
1225
|
}
|
|
1170
1226
|
this.isInteractive(e) || (this.deadClickCount++, this.deadClickCount >= 3 && this.errorCount > 0 && (this.deadClickCount = 0, this.errorCount = 0, this.emitIfReady({
|
|
1171
1227
|
signal: "dead_click",
|
|
1172
|
-
target:
|
|
1228
|
+
target: w(e),
|
|
1173
1229
|
timestamp: r
|
|
1174
1230
|
}))), this.checkDeadClickDom(e, r);
|
|
1175
1231
|
}
|
|
1176
1232
|
handleNavigation() {
|
|
1177
1233
|
const t = Date.now();
|
|
1178
1234
|
this.navTimestamps.push(t);
|
|
1179
|
-
const e = t -
|
|
1180
|
-
this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >=
|
|
1235
|
+
const e = t - Be;
|
|
1236
|
+
this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >= je && (this.navTimestamps = [], this.emitIfReady({
|
|
1181
1237
|
signal: "rapid_navigation",
|
|
1182
1238
|
timestamp: t
|
|
1183
1239
|
})), setTimeout(() => {
|
|
1184
1240
|
this.active && this.checkErrorPage();
|
|
1185
|
-
},
|
|
1241
|
+
}, We);
|
|
1186
1242
|
}
|
|
1187
1243
|
handleFormSubmit(t) {
|
|
1188
1244
|
const e = t.target;
|
|
1189
1245
|
e instanceof HTMLFormElement && (this.isWidgetElement(e) || setTimeout(() => {
|
|
1190
1246
|
this.active && e.querySelector('[aria-invalid="true"], .is-invalid') && this.emitIfReady({
|
|
1191
1247
|
signal: "form_failure",
|
|
1192
|
-
target:
|
|
1248
|
+
target: w(e),
|
|
1193
1249
|
timestamp: Date.now()
|
|
1194
1250
|
});
|
|
1195
|
-
},
|
|
1251
|
+
}, ze));
|
|
1196
1252
|
}
|
|
1197
1253
|
handleFormInvalid(t) {
|
|
1198
1254
|
const e = t.target;
|
|
@@ -1200,7 +1256,7 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1200
1256
|
const r = e.closest("form");
|
|
1201
1257
|
this.emitIfReady({
|
|
1202
1258
|
signal: "form_failure",
|
|
1203
|
-
target:
|
|
1259
|
+
target: w(r || e),
|
|
1204
1260
|
timestamp: Date.now()
|
|
1205
1261
|
});
|
|
1206
1262
|
}
|
|
@@ -1208,7 +1264,7 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1208
1264
|
const t = location.href;
|
|
1209
1265
|
if (this.errorPageUrls.has(t)) return;
|
|
1210
1266
|
const e = document.title.toLowerCase();
|
|
1211
|
-
if (
|
|
1267
|
+
if (N.some((s) => e.includes(s))) {
|
|
1212
1268
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1213
1269
|
signal: "error_page",
|
|
1214
1270
|
detail: document.title,
|
|
@@ -1221,7 +1277,7 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1221
1277
|
);
|
|
1222
1278
|
for (const s of r) {
|
|
1223
1279
|
const n = s.textContent ?? "";
|
|
1224
|
-
if (n.length < 200 &&
|
|
1280
|
+
if (n.length < 200 && N.some((o) => n.toLowerCase().includes(o))) {
|
|
1225
1281
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1226
1282
|
signal: "error_page",
|
|
1227
1283
|
detail: n.trim().slice(0, 60),
|
|
@@ -1240,10 +1296,10 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1240
1296
|
const r = this.lastMutationAt >= e;
|
|
1241
1297
|
this.pendingDomChecks === 0 && this.disconnectDomObserver(), !r && this.active && this.emitIfReady({
|
|
1242
1298
|
signal: "dead_click_dom",
|
|
1243
|
-
target:
|
|
1299
|
+
target: w(t),
|
|
1244
1300
|
timestamp: e
|
|
1245
1301
|
});
|
|
1246
|
-
},
|
|
1302
|
+
}, qe));
|
|
1247
1303
|
}
|
|
1248
1304
|
ensureDomObserver() {
|
|
1249
1305
|
this.domObserver || (this.domObserver = new MutationObserver(() => {
|
|
@@ -1268,9 +1324,9 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1268
1324
|
return !1;
|
|
1269
1325
|
}
|
|
1270
1326
|
isInteractive(t) {
|
|
1271
|
-
if (
|
|
1327
|
+
if (Ne.has(t.tagName)) return !0;
|
|
1272
1328
|
const e = t.getAttribute("role");
|
|
1273
|
-
return !!(e &&
|
|
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'));
|
|
1274
1330
|
}
|
|
1275
1331
|
isWidgetElement(t) {
|
|
1276
1332
|
const e = document.getElementById("mtb-widget-host");
|
|
@@ -1278,40 +1334,40 @@ const $e = 3, Ie = 1e3, Fe = 3, Oe = 5e3, Ue = 500, je = 500, ze = 300, Be = /*
|
|
|
1278
1334
|
}
|
|
1279
1335
|
emitIfReady(t) {
|
|
1280
1336
|
const e = Date.now();
|
|
1281
|
-
e < this.cooldownUntil || (this.cooldownUntil = e +
|
|
1337
|
+
e < this.cooldownUntil || (this.cooldownUntil = e + E.COOLDOWN_MS, this.onFrustration(t));
|
|
1282
1338
|
}
|
|
1283
1339
|
emitHighPriority(t) {
|
|
1284
|
-
this.cooldownUntil = Date.now() +
|
|
1340
|
+
this.cooldownUntil = Date.now() + E.COOLDOWN_MS, this.onFrustration(t);
|
|
1285
1341
|
}
|
|
1286
1342
|
};
|
|
1287
|
-
|
|
1288
|
-
let
|
|
1289
|
-
function
|
|
1343
|
+
E.COOLDOWN_MS = 6e4;
|
|
1344
|
+
let P = E;
|
|
1345
|
+
function w(i) {
|
|
1290
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) ?? "";
|
|
1291
1347
|
return `<${t}${e}${r}>${s ? ` "${s}"` : ""}`;
|
|
1292
1348
|
}
|
|
1293
|
-
function
|
|
1349
|
+
function Ye() {
|
|
1294
1350
|
return {
|
|
1295
1351
|
page_url: window.location.href,
|
|
1296
1352
|
user_agent: navigator.userAgent,
|
|
1297
|
-
browser:
|
|
1298
|
-
os:
|
|
1353
|
+
browser: Xe(),
|
|
1354
|
+
os: Ge(),
|
|
1299
1355
|
screen_width: window.screen.width,
|
|
1300
1356
|
screen_height: window.screen.height
|
|
1301
1357
|
};
|
|
1302
1358
|
}
|
|
1303
|
-
function
|
|
1359
|
+
function Xe() {
|
|
1304
1360
|
const i = navigator.userAgent;
|
|
1305
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";
|
|
1306
1362
|
}
|
|
1307
|
-
function
|
|
1363
|
+
function Ge() {
|
|
1308
1364
|
const i = navigator.userAgent;
|
|
1309
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";
|
|
1310
1366
|
}
|
|
1311
|
-
const
|
|
1312
|
-
class
|
|
1367
|
+
const Ke = "https://makethisbetter.dev/api/v1";
|
|
1368
|
+
class Je {
|
|
1313
1369
|
constructor(t, e, r = 1e3, s, n) {
|
|
1314
|
-
this.projectKey = t, this.apiUrl = (e ??
|
|
1370
|
+
this.projectKey = t, this.apiUrl = (e ?? Ke).replace(/\/$/, ""), this.retryDelayMs = r, this.userToken = s, this.userTokenFn = n;
|
|
1315
1371
|
}
|
|
1316
1372
|
async resolveUserToken() {
|
|
1317
1373
|
return this.userTokenFn ? this.userTokenFn() : this.userToken;
|
|
@@ -1326,9 +1382,12 @@ class Xe {
|
|
|
1326
1382
|
const o = JSON.stringify(t.recording_events), a = new Blob([o], { type: "application/json" });
|
|
1327
1383
|
r.append("feedback[recording]", a, "recording.json"), r.append("feedback[recording_duration]", String(t.recording_duration ?? 0));
|
|
1328
1384
|
}
|
|
1329
|
-
|
|
1385
|
+
if (e) {
|
|
1386
|
+
const o = e.type === "image/jpeg" ? "jpg" : "png";
|
|
1387
|
+
r.append("feedback[screenshot]", e, `screenshot.${o}`);
|
|
1388
|
+
}
|
|
1330
1389
|
const s = await this.authHeaders();
|
|
1331
|
-
return s["X-Idempotency-Key"] =
|
|
1390
|
+
return s["X-Idempotency-Key"] = Ze(), (await this.fetchWithRetry(`${this.apiUrl}/widget/feedbacks`, {
|
|
1332
1391
|
method: "POST",
|
|
1333
1392
|
headers: s,
|
|
1334
1393
|
body: r
|
|
@@ -1376,28 +1435,77 @@ class Xe {
|
|
|
1376
1435
|
headers: e
|
|
1377
1436
|
})).json();
|
|
1378
1437
|
}
|
|
1438
|
+
// Streams a clarification turn over SSE. Calls onDelta for each token and
|
|
1439
|
+
// resolves with the committed result. Throws if the server doesn't stream
|
|
1440
|
+
// (e.g. old backend returns JSON) so the caller can fall back to polling.
|
|
1441
|
+
async streamClarification(t, e, r) {
|
|
1442
|
+
const s = {};
|
|
1443
|
+
e && (s.message = e);
|
|
1444
|
+
const n = await this.authHeaders("application/json");
|
|
1445
|
+
n.Accept = "text/event-stream";
|
|
1446
|
+
const o = await fetch(`${this.apiUrl}/widget/feedbacks/${t}/clarify`, {
|
|
1447
|
+
method: "POST",
|
|
1448
|
+
headers: n,
|
|
1449
|
+
body: JSON.stringify(s)
|
|
1450
|
+
}), a = o.headers.get("Content-Type") ?? "";
|
|
1451
|
+
if (!o.ok || !o.body || !a.includes("text/event-stream"))
|
|
1452
|
+
throw new Error("clarify stream unavailable");
|
|
1453
|
+
return Qe(o.body, r);
|
|
1454
|
+
}
|
|
1379
1455
|
async fetchWithRetry(t, e, r = 1) {
|
|
1380
1456
|
let s;
|
|
1381
1457
|
try {
|
|
1382
1458
|
s = await fetch(t, e);
|
|
1383
1459
|
} catch (n) {
|
|
1384
1460
|
if (r > 0)
|
|
1385
|
-
return await
|
|
1461
|
+
return await V(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
1386
1462
|
throw n;
|
|
1387
1463
|
}
|
|
1388
1464
|
if (s.ok) return s;
|
|
1389
1465
|
if (s.status >= 500 && r > 0)
|
|
1390
|
-
return await
|
|
1466
|
+
return await V(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
1391
1467
|
throw new Error(`HTTP ${s.status}`);
|
|
1392
1468
|
}
|
|
1393
1469
|
}
|
|
1394
|
-
function
|
|
1470
|
+
function V(i) {
|
|
1395
1471
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
1396
1472
|
}
|
|
1397
|
-
function
|
|
1473
|
+
async function Qe(i, t) {
|
|
1474
|
+
const e = i.getReader(), r = new TextDecoder();
|
|
1475
|
+
let s = "", n = { messages: [], done: !0 };
|
|
1476
|
+
const o = (a) => {
|
|
1477
|
+
const l = a.split(`
|
|
1478
|
+
`).find((k) => k.startsWith("event:")), c = a.split(`
|
|
1479
|
+
`).find((k) => k.startsWith("data:"));
|
|
1480
|
+
if (!c) return;
|
|
1481
|
+
const h = l?.slice(6).trim(), m = JSON.parse(c.slice(5).trim());
|
|
1482
|
+
h === "delta" && typeof m.text == "string" ? t(m.text) : h === "done" && (n = {
|
|
1483
|
+
messages: Array.isArray(m.messages) ? m.messages : [],
|
|
1484
|
+
done: m.done !== !1
|
|
1485
|
+
});
|
|
1486
|
+
};
|
|
1487
|
+
for (; ; ) {
|
|
1488
|
+
const { done: a, value: l } = await e.read();
|
|
1489
|
+
if (a) break;
|
|
1490
|
+
s += r.decode(l, { stream: !0 });
|
|
1491
|
+
let c;
|
|
1492
|
+
for (; (c = s.indexOf(`
|
|
1493
|
+
|
|
1494
|
+
`)) !== -1; ) {
|
|
1495
|
+
const h = s.slice(0, c);
|
|
1496
|
+
s = s.slice(c + 2);
|
|
1497
|
+
try {
|
|
1498
|
+
o(h);
|
|
1499
|
+
} catch {
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
return n;
|
|
1504
|
+
}
|
|
1505
|
+
function Ze() {
|
|
1398
1506
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
1399
1507
|
}
|
|
1400
|
-
function
|
|
1508
|
+
function ti(i, t, e, r, s, n, o, a) {
|
|
1401
1509
|
return {
|
|
1402
1510
|
description: i,
|
|
1403
1511
|
...t,
|
|
@@ -1417,50 +1525,50 @@ function Ge(i, t, e, r, s, n, o, a) {
|
|
|
1417
1525
|
recording_duration: n?.duration
|
|
1418
1526
|
};
|
|
1419
1527
|
}
|
|
1420
|
-
const
|
|
1421
|
-
let
|
|
1422
|
-
function
|
|
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() {
|
|
1423
1531
|
try {
|
|
1424
|
-
const i = window.localStorage.getItem(
|
|
1532
|
+
const i = window.localStorage.getItem(Y);
|
|
1425
1533
|
if (i?.startsWith("anon_")) return i;
|
|
1426
|
-
const t =
|
|
1427
|
-
return window.localStorage.setItem(
|
|
1534
|
+
const t = Q();
|
|
1535
|
+
return window.localStorage.setItem(Y, t), t;
|
|
1428
1536
|
} catch {
|
|
1429
|
-
return
|
|
1537
|
+
return X ?? (X = Q()), X;
|
|
1430
1538
|
}
|
|
1431
1539
|
}
|
|
1432
|
-
function
|
|
1540
|
+
function K() {
|
|
1433
1541
|
try {
|
|
1434
|
-
return window.localStorage.getItem(
|
|
1542
|
+
return window.localStorage.getItem(ut) ?? void 0;
|
|
1435
1543
|
} catch {
|
|
1436
|
-
return
|
|
1544
|
+
return ft ?? void 0;
|
|
1437
1545
|
}
|
|
1438
1546
|
}
|
|
1439
|
-
function
|
|
1440
|
-
|
|
1547
|
+
function ei(i) {
|
|
1548
|
+
ft = i;
|
|
1441
1549
|
try {
|
|
1442
|
-
window.localStorage.setItem(
|
|
1550
|
+
window.localStorage.setItem(ut, i);
|
|
1443
1551
|
} catch {
|
|
1444
1552
|
}
|
|
1445
1553
|
}
|
|
1446
|
-
function
|
|
1554
|
+
function ii() {
|
|
1447
1555
|
try {
|
|
1448
|
-
return window.localStorage.getItem(
|
|
1556
|
+
return window.localStorage.getItem(mt) ?? void 0;
|
|
1449
1557
|
} catch {
|
|
1450
|
-
return
|
|
1558
|
+
return pt ?? void 0;
|
|
1451
1559
|
}
|
|
1452
1560
|
}
|
|
1453
|
-
function
|
|
1454
|
-
|
|
1561
|
+
function J(i) {
|
|
1562
|
+
pt = i;
|
|
1455
1563
|
try {
|
|
1456
|
-
window.localStorage.setItem(
|
|
1564
|
+
window.localStorage.setItem(mt, i);
|
|
1457
1565
|
} catch {
|
|
1458
1566
|
}
|
|
1459
1567
|
}
|
|
1460
|
-
function
|
|
1568
|
+
function Q() {
|
|
1461
1569
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
|
|
1462
1570
|
}
|
|
1463
|
-
const
|
|
1571
|
+
const ri = {
|
|
1464
1572
|
tab: "Feedback",
|
|
1465
1573
|
toolbar: {
|
|
1466
1574
|
markup: "Mark up",
|
|
@@ -1516,12 +1624,14 @@ const Ze = {
|
|
|
1516
1624
|
max_reached: "Maximum recording time reached"
|
|
1517
1625
|
},
|
|
1518
1626
|
clarify: {
|
|
1627
|
+
title: "Make This Better AI",
|
|
1628
|
+
subtitle: "Sharpening your feedback",
|
|
1519
1629
|
thinking: "Thinking...",
|
|
1520
|
-
placeholder: "Type your
|
|
1630
|
+
placeholder: "Type your answer — or Skip",
|
|
1521
1631
|
send: "Send",
|
|
1522
1632
|
skip: "Skip"
|
|
1523
1633
|
}
|
|
1524
|
-
},
|
|
1634
|
+
}, si = {
|
|
1525
1635
|
tab: "反馈",
|
|
1526
1636
|
toolbar: {
|
|
1527
1637
|
markup: "标注",
|
|
@@ -1577,12 +1687,14 @@ const Ze = {
|
|
|
1577
1687
|
max_reached: "已达到最大录制时长"
|
|
1578
1688
|
},
|
|
1579
1689
|
clarify: {
|
|
1690
|
+
title: "让它更好 AI",
|
|
1691
|
+
subtitle: "正在完善你的反馈",
|
|
1580
1692
|
thinking: "思考中...",
|
|
1581
|
-
placeholder: "
|
|
1693
|
+
placeholder: "输入你的回答 —— 或跳过",
|
|
1582
1694
|
send: "发送",
|
|
1583
1695
|
skip: "跳过"
|
|
1584
1696
|
}
|
|
1585
|
-
},
|
|
1697
|
+
}, ni = {
|
|
1586
1698
|
tab: "フィードバック",
|
|
1587
1699
|
toolbar: {
|
|
1588
1700
|
markup: "マークアップ",
|
|
@@ -1638,12 +1750,14 @@ const Ze = {
|
|
|
1638
1750
|
max_reached: "最大録画時間に達しました"
|
|
1639
1751
|
},
|
|
1640
1752
|
clarify: {
|
|
1753
|
+
title: "Make This Better AI",
|
|
1754
|
+
subtitle: "フィードバックを整えています",
|
|
1641
1755
|
thinking: "考え中...",
|
|
1642
|
-
placeholder: "
|
|
1756
|
+
placeholder: "回答を入力 — またはスキップ",
|
|
1643
1757
|
send: "送信",
|
|
1644
1758
|
skip: "スキップ"
|
|
1645
1759
|
}
|
|
1646
|
-
},
|
|
1760
|
+
}, oi = {
|
|
1647
1761
|
tab: "피드백",
|
|
1648
1762
|
toolbar: {
|
|
1649
1763
|
markup: "마크업",
|
|
@@ -1699,12 +1813,14 @@ const Ze = {
|
|
|
1699
1813
|
max_reached: "최대 녹화 시간에 도달했습니다"
|
|
1700
1814
|
},
|
|
1701
1815
|
clarify: {
|
|
1816
|
+
title: "Make This Better AI",
|
|
1817
|
+
subtitle: "피드백을 다듬는 중",
|
|
1702
1818
|
thinking: "생각 중...",
|
|
1703
|
-
placeholder: "
|
|
1819
|
+
placeholder: "답변 입력 — 또는 건너뛰기",
|
|
1704
1820
|
send: "보내기",
|
|
1705
1821
|
skip: "건너뛰기"
|
|
1706
1822
|
}
|
|
1707
|
-
},
|
|
1823
|
+
}, ai = {
|
|
1708
1824
|
tab: "Comentarios",
|
|
1709
1825
|
toolbar: {
|
|
1710
1826
|
markup: "Anotar",
|
|
@@ -1760,12 +1876,14 @@ const Ze = {
|
|
|
1760
1876
|
max_reached: "Se alcanzó el tiempo máximo de grabación"
|
|
1761
1877
|
},
|
|
1762
1878
|
clarify: {
|
|
1879
|
+
title: "Make This Better AI",
|
|
1880
|
+
subtitle: "Afinando tus comentarios",
|
|
1763
1881
|
thinking: "Pensando...",
|
|
1764
|
-
placeholder: "Escribe tu respuesta
|
|
1882
|
+
placeholder: "Escribe tu respuesta — o Omitir",
|
|
1765
1883
|
send: "Enviar",
|
|
1766
1884
|
skip: "Omitir"
|
|
1767
1885
|
}
|
|
1768
|
-
},
|
|
1886
|
+
}, li = {
|
|
1769
1887
|
tab: "Avis",
|
|
1770
1888
|
toolbar: {
|
|
1771
1889
|
markup: "Annoter",
|
|
@@ -1821,12 +1939,14 @@ const Ze = {
|
|
|
1821
1939
|
max_reached: "Durée maximale d'enregistrement atteinte"
|
|
1822
1940
|
},
|
|
1823
1941
|
clarify: {
|
|
1942
|
+
title: "Make This Better AI",
|
|
1943
|
+
subtitle: "Affinement de votre retour",
|
|
1824
1944
|
thinking: "Réflexion...",
|
|
1825
|
-
placeholder: "
|
|
1945
|
+
placeholder: "Saisissez votre réponse — ou Ignorer",
|
|
1826
1946
|
send: "Envoyer",
|
|
1827
1947
|
skip: "Passer"
|
|
1828
1948
|
}
|
|
1829
|
-
},
|
|
1949
|
+
}, ci = {
|
|
1830
1950
|
tab: "Feedback",
|
|
1831
1951
|
toolbar: {
|
|
1832
1952
|
markup: "Markieren",
|
|
@@ -1882,57 +2002,59 @@ const Ze = {
|
|
|
1882
2002
|
max_reached: "Maximale Aufnahmezeit erreicht"
|
|
1883
2003
|
},
|
|
1884
2004
|
clarify: {
|
|
2005
|
+
title: "Make This Better AI",
|
|
2006
|
+
subtitle: "Wir schärfen dein Feedback",
|
|
1885
2007
|
thinking: "Einen Moment...",
|
|
1886
|
-
placeholder: "Antwort
|
|
2008
|
+
placeholder: "Gib deine Antwort ein — oder Überspringen",
|
|
1887
2009
|
send: "Senden",
|
|
1888
2010
|
skip: "Überspringen"
|
|
1889
2011
|
}
|
|
1890
|
-
},
|
|
1891
|
-
en:
|
|
1892
|
-
"zh-CN":
|
|
1893
|
-
ja:
|
|
1894
|
-
ko:
|
|
1895
|
-
es:
|
|
1896
|
-
fr:
|
|
1897
|
-
de:
|
|
2012
|
+
}, S = {
|
|
2013
|
+
en: ri,
|
|
2014
|
+
"zh-CN": si,
|
|
2015
|
+
ja: ni,
|
|
2016
|
+
ko: oi,
|
|
2017
|
+
es: ai,
|
|
2018
|
+
fr: li,
|
|
2019
|
+
de: ci
|
|
1898
2020
|
};
|
|
1899
|
-
function
|
|
1900
|
-
if (
|
|
2021
|
+
function di(i) {
|
|
2022
|
+
if (S[i]) return S[i];
|
|
1901
2023
|
const t = i.split("-")[0];
|
|
1902
|
-
return
|
|
2024
|
+
return S[t] ? S[t] : S.en;
|
|
1903
2025
|
}
|
|
1904
|
-
const
|
|
1905
|
-
let
|
|
1906
|
-
function
|
|
1907
|
-
return
|
|
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);
|
|
1908
2030
|
}
|
|
1909
|
-
async function
|
|
2031
|
+
async function pi() {
|
|
1910
2032
|
return (await import("@rrweb/record")).record;
|
|
1911
2033
|
}
|
|
1912
|
-
function
|
|
2034
|
+
function Z() {
|
|
1913
2035
|
const i = globalThis;
|
|
1914
2036
|
return i.rrwebRecord?.record ?? i.rrweb?.record;
|
|
1915
2037
|
}
|
|
1916
|
-
function
|
|
2038
|
+
function bi() {
|
|
1917
2039
|
return new Promise((i, t) => {
|
|
1918
|
-
const e =
|
|
2040
|
+
const e = Z();
|
|
1919
2041
|
if (e) {
|
|
1920
2042
|
i(e);
|
|
1921
2043
|
return;
|
|
1922
2044
|
}
|
|
1923
2045
|
const r = document.createElement("script");
|
|
1924
|
-
r.src =
|
|
1925
|
-
const s =
|
|
2046
|
+
r.src = ui, r.integrity = mi, r.crossOrigin = "anonymous", r.onload = () => {
|
|
2047
|
+
const s = Z();
|
|
1926
2048
|
s ? i(s) : t(new Error("rrweb record global not found after script load"));
|
|
1927
2049
|
}, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
|
|
1928
2050
|
});
|
|
1929
2051
|
}
|
|
1930
|
-
class
|
|
2052
|
+
class gi {
|
|
1931
2053
|
constructor(t, e) {
|
|
1932
2054
|
this.events = [], this.stopFn = null, this.startedAt = 0, this.timer = null, this.clickHandler = null, this.stopped = !1, this.shadow = t, this.onMaxReached = e;
|
|
1933
2055
|
}
|
|
1934
2056
|
async start() {
|
|
1935
|
-
const t = await
|
|
2057
|
+
const t = await fi();
|
|
1936
2058
|
this.startedAt = Date.now(), this.stopped = !1, this.stopFn = t({
|
|
1937
2059
|
emit: (e) => {
|
|
1938
2060
|
this.stopped || this.events.push(e);
|
|
@@ -1945,7 +2067,7 @@ class mi {
|
|
|
1945
2067
|
});
|
|
1946
2068
|
}, document.addEventListener("click", this.clickHandler, !0), this.timer = setTimeout(() => {
|
|
1947
2069
|
this.onMaxReached?.();
|
|
1948
|
-
},
|
|
2070
|
+
}, hi * 1e3);
|
|
1949
2071
|
}
|
|
1950
2072
|
stop() {
|
|
1951
2073
|
return this.stopped = !0, this.stopFn?.(), this.stopFn = null, this.cleanupTimer(), this.cleanupClickHandler(), {
|
|
@@ -1970,7 +2092,7 @@ class mi {
|
|
|
1970
2092
|
r.style.left = `${t}px`, r.style.top = `${e}px`, this.shadow.append(r), r.addEventListener("animationend", () => r.remove());
|
|
1971
2093
|
}
|
|
1972
2094
|
}
|
|
1973
|
-
class
|
|
2095
|
+
class yi {
|
|
1974
2096
|
constructor(t, e, r, s) {
|
|
1975
2097
|
this.intervalId = null, this.getDuration = r, this.el = t.el("div", "mtb-record-bar"), this.el.innerHTML = `
|
|
1976
2098
|
<span class="mtb-record-dot"></span>
|
|
@@ -1986,12 +2108,12 @@ class pi {
|
|
|
1986
2108
|
this.intervalId && (clearInterval(this.intervalId), this.intervalId = null), this.el.remove();
|
|
1987
2109
|
}
|
|
1988
2110
|
}
|
|
1989
|
-
class
|
|
2111
|
+
class xi {
|
|
1990
2112
|
constructor() {
|
|
1991
2113
|
this.session = null, this.bar = null, this.result = null;
|
|
1992
2114
|
}
|
|
1993
2115
|
async start(t, e, r) {
|
|
1994
|
-
this.session = new
|
|
2116
|
+
this.session = new gi(t, r), this.bar = new yi(
|
|
1995
2117
|
t,
|
|
1996
2118
|
e,
|
|
1997
2119
|
() => this.session?.getDuration() ?? 0,
|
|
@@ -2011,12 +2133,12 @@ class fi {
|
|
|
2011
2133
|
this.session?.destroy(), this.session = null, this.bar?.destroy(), this.bar = null;
|
|
2012
2134
|
}
|
|
2013
2135
|
}
|
|
2014
|
-
class
|
|
2136
|
+
class tt {
|
|
2015
2137
|
constructor(t) {
|
|
2016
|
-
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 =
|
|
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());
|
|
2017
2139
|
}
|
|
2018
2140
|
buildUI() {
|
|
2019
|
-
this.shadow = new
|
|
2141
|
+
this.shadow = new gt(this.config.theme ?? "auto"), this.tab = new yt(
|
|
2020
2142
|
this.shadow,
|
|
2021
2143
|
this.messages,
|
|
2022
2144
|
this.config.position ?? "right",
|
|
@@ -2028,7 +2150,7 @@ class Q {
|
|
|
2028
2150
|
this.mode === "idle" ? (this.dismissFrustrationPrompt(), this.enterAnnotationMode()) : this.exitAll();
|
|
2029
2151
|
}
|
|
2030
2152
|
handleFrustration() {
|
|
2031
|
-
this.mode !== "idle" || this.frustrationPrompt || (this.frustrationPrompt = new
|
|
2153
|
+
this.mode !== "idle" || this.frustrationPrompt || (this.frustrationPrompt = new wt(this.shadow, this.messages, {
|
|
2032
2154
|
onTell: () => {
|
|
2033
2155
|
this.dismissFrustrationPrompt(), this.enterAnnotationMode();
|
|
2034
2156
|
},
|
|
@@ -2039,7 +2161,7 @@ class Q {
|
|
|
2039
2161
|
this.frustrationPrompt?.destroy(), this.frustrationPrompt = null;
|
|
2040
2162
|
}
|
|
2041
2163
|
enterAnnotationMode() {
|
|
2042
|
-
this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new
|
|
2164
|
+
this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new kt(
|
|
2043
2165
|
this.shadow,
|
|
2044
2166
|
this.messages,
|
|
2045
2167
|
() => this.exitAll(),
|
|
@@ -2049,7 +2171,7 @@ class Q {
|
|
|
2049
2171
|
});
|
|
2050
2172
|
}
|
|
2051
2173
|
handleToolbarModeChange(t) {
|
|
2052
|
-
t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new
|
|
2174
|
+
t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new xi(), this.recordingManager.start(this.shadow, this.messages, () => {
|
|
2053
2175
|
this.recordingManager && (this.recordingManager.stop(), this.showPopup(window.innerWidth / 2, window.innerHeight / 2, this.messages.record.timer_label));
|
|
2054
2176
|
}).catch((e) => {
|
|
2055
2177
|
console.warn("[MakeThisBetter] Screen recording unavailable, falling back to markup:", e), this.mode === "recording" && (this.toolbar?.setMode("markup"), this.handleToolbarModeChange("markup"));
|
|
@@ -2058,7 +2180,7 @@ class Q {
|
|
|
2058
2180
|
})), this.mode = "annotating");
|
|
2059
2181
|
}
|
|
2060
2182
|
showPopup(t, e, r) {
|
|
2061
|
-
this.mode = "popup", this.session?.dismissInteraction(), this.popup = new
|
|
2183
|
+
this.mode = "popup", this.lastPopupPos = { x: t, y: e }, this.session?.dismissInteraction(), this.popup = new Lt(this.shadow, {
|
|
2062
2184
|
targetName: r,
|
|
2063
2185
|
x: t,
|
|
2064
2186
|
y: e,
|
|
@@ -2069,57 +2191,59 @@ class Q {
|
|
|
2069
2191
|
});
|
|
2070
2192
|
}
|
|
2071
2193
|
buildMyFeedbackHandler() {
|
|
2072
|
-
if (!this.config.user &&
|
|
2194
|
+
if (!this.config.user && ii())
|
|
2073
2195
|
return async () => {
|
|
2074
|
-
const t = await this.apiClient.createIdentityToken(
|
|
2075
|
-
!t?.identity_token || !t.board_url || (
|
|
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"));
|
|
2076
2198
|
};
|
|
2077
2199
|
}
|
|
2078
2200
|
async handleSubmit(t) {
|
|
2079
2201
|
if (!this.popup) return;
|
|
2080
2202
|
this.popup.setLoading(!0);
|
|
2081
2203
|
const e = this.currentAnnotation, r = this.recordingManager?.getRecording() ?? void 0, [s, n] = await Promise.all([
|
|
2082
|
-
|
|
2083
|
-
Promise.resolve(
|
|
2084
|
-
]), o =
|
|
2204
|
+
Ae(e ? [e] : []),
|
|
2205
|
+
Promise.resolve(Ye())
|
|
2206
|
+
]), o = ti(
|
|
2085
2207
|
t,
|
|
2086
2208
|
n,
|
|
2087
2209
|
this.consoleCollector.getErrors(),
|
|
2088
2210
|
e,
|
|
2089
2211
|
this.config.user,
|
|
2090
2212
|
r,
|
|
2091
|
-
this.config.user ? void 0 :
|
|
2092
|
-
this.config.user ? void 0 :
|
|
2213
|
+
this.config.user ? void 0 : G(),
|
|
2214
|
+
this.config.user ? void 0 : K()
|
|
2093
2215
|
);
|
|
2094
2216
|
try {
|
|
2095
2217
|
const a = await this.apiClient.submitFeedback(o, s);
|
|
2096
|
-
this.lastHandoff = { feedbackId: a.id, boardUrl: a.board_url, identityToken: a.identity_token }, a.board_url &&
|
|
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);
|
|
2097
2219
|
} catch {
|
|
2098
2220
|
this.popup?.setLoading(!1), this.popup?.setError(this.messages.error.submit);
|
|
2099
2221
|
}
|
|
2100
2222
|
}
|
|
2101
|
-
showClarify(t) {
|
|
2102
|
-
this.mode = "
|
|
2223
|
+
showClarify(t, e) {
|
|
2224
|
+
this.mode = "clarifying", this.tab?.setActive(!0), this.clarify = new Pt(this.shadow, {
|
|
2103
2225
|
feedbackId: t,
|
|
2104
2226
|
apiClient: this.apiClient,
|
|
2105
2227
|
messages: this.messages,
|
|
2228
|
+
x: e?.x,
|
|
2229
|
+
y: e?.y,
|
|
2106
2230
|
onDone: () => {
|
|
2107
2231
|
this.clarify?.destroy(), this.clarify = null, this.showSuccess();
|
|
2108
2232
|
}
|
|
2109
2233
|
});
|
|
2110
2234
|
}
|
|
2111
2235
|
showSuccess(t) {
|
|
2112
|
-
this.mode = "idle", this.tab?.setActive(!1), this.success = new
|
|
2236
|
+
this.mode = "idle", this.tab?.setActive(!1), this.success = new Ht(this.shadow, this.messages, () => {
|
|
2113
2237
|
this.success?.destroy(), this.success = null;
|
|
2114
2238
|
}, this.buildViewFeedbackHandler(), { ...t, emailCapture: this.buildEmailCapture() });
|
|
2115
2239
|
}
|
|
2116
2240
|
buildEmailCapture() {
|
|
2117
2241
|
const { feedbackId: t, identityToken: e } = this.lastHandoff;
|
|
2118
|
-
if (!(!t || !e) && !
|
|
2242
|
+
if (!(!t || !e) && !K())
|
|
2119
2243
|
return {
|
|
2120
2244
|
onSubmit: async (r) => {
|
|
2121
2245
|
const s = await this.apiClient.updateReporter(t, r, e);
|
|
2122
|
-
return s &&
|
|
2246
|
+
return s && ei(r), s;
|
|
2123
2247
|
}
|
|
2124
2248
|
};
|
|
2125
2249
|
}
|
|
@@ -2144,19 +2268,19 @@ class Q {
|
|
|
2144
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();
|
|
2145
2269
|
}
|
|
2146
2270
|
}
|
|
2147
|
-
let
|
|
2148
|
-
const
|
|
2271
|
+
let g = null;
|
|
2272
|
+
const wi = {
|
|
2149
2273
|
init(i) {
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
}) :
|
|
2274
|
+
g && (g.destroy(), g = null), document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
|
|
2275
|
+
g = new tt(i);
|
|
2276
|
+
}) : g = new tt(i);
|
|
2153
2277
|
},
|
|
2154
2278
|
destroy() {
|
|
2155
|
-
|
|
2279
|
+
g?.destroy(), g = null;
|
|
2156
2280
|
}
|
|
2157
2281
|
};
|
|
2158
|
-
typeof window < "u" && (window.MakeThisBetter =
|
|
2282
|
+
typeof window < "u" && (window.MakeThisBetter = wi);
|
|
2159
2283
|
export {
|
|
2160
|
-
|
|
2284
|
+
wi as MakeThisBetter
|
|
2161
2285
|
};
|
|
2162
2286
|
//# sourceMappingURL=makethisbetter.esm.js.map
|