makethisbetter 1.9.0 → 1.9.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/i18n/de.d.ts +1 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/en.d.ts +1 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/es.d.ts +1 -0
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/fr.d.ts +1 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/ja.d.ts +1 -0
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ko.d.ts +1 -0
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/zh-CN.d.ts +1 -0
- package/dist/i18n/zh-CN.d.ts.map +1 -1
- package/dist/makethisbetter.cjs +25 -17
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +418 -384
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +25 -17
- package/dist/makethisbetter.js.map +1 -1
- package/dist/popup/clarify.d.ts +3 -1
- package/dist/popup/clarify.d.ts.map +1 -1
- package/dist/popup/comment.d.ts +2 -0
- package/dist/popup/comment.d.ts.map +1 -1
- package/dist/widget/controller.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/i18n/de.ts +1 -0
- package/src/i18n/en.ts +1 -0
- package/src/i18n/es.ts +1 -0
- package/src/i18n/fr.ts +1 -0
- package/src/i18n/ja.ts +1 -0
- package/src/i18n/ko.ts +1 -0
- package/src/i18n/zh-CN.ts +1 -0
- package/src/popup/clarify.test.ts +90 -23
- package/src/popup/clarify.ts +40 -20
- package/src/popup/comment.test.ts +38 -0
- package/src/popup/comment.ts +15 -8
- package/src/styles/widget.css +64 -34
- package/src/widget/controller.test.ts +38 -9
- package/src/widget/controller.ts +16 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const yt = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:Inter,-apple-system,BlinkMacSystemFont,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 #05966973}.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}@media (max-width: 480px){.mtb-toolbar{max-width:calc(100vw - 16px);gap:6px}.mtb-toolbar-hint,.mtb-toolbar-sep{display:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{padding-right:10px;padding-left:10px}}.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.selected{border-color:#3b82f6;background:#3b82f60a}.mtb-highlight-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%,-100%);max-width:240px;overflow:hidden;text-overflow:ellipsis;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;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-highlight-tooltip.below{transform:translate(-50%)}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-color:#064e3b}.mtb-highlight-tooltip.below:after{top:auto;bottom:100%;border-top-color:transparent;border-bottom-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;display:flex;flex-direction:column;width:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{flex-shrink:0;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{min-height:0;padding:13px;overflow-y:auto;overscroll-behavior:contain}.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:10px;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 #10b98126}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#dc2626;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:32px;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12.5px;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:332px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;padding:24px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-success-icon{width:46px;height:46px;border-radius:50%;background:#05966917;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:5px;letter-spacing:-.01em;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-view-feedback-link{display:inline-flex;align-items:center;gap:5px;color:#047857;text-decoration:none;font-size:13px;font-weight:500;font-family:JetBrains Mono,monospace;background:none;border:none;cursor:pointer;transition:text-decoration .12s}.mtb-view-feedback-link:hover{text-decoration:underline}.mtb-close-link{margin-top:13px;background:none;border:none;cursor:pointer;font-size:12px;color:#0006;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:Inter,-apple-system,BlinkMacSystemFont,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:48px;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:16px;box-shadow:0 24px 64px #0000003d;display:flex;flex-direction:column;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,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:10px;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 #10b98126;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:10px;background:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:550;color:#0000008c;white-space:nowrap;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:10px;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}.mtb-clarify-error{margin-bottom:8px;color:#dc2626;font-size:11.5px;line-height:1.4;text-align:center}: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}}.mtb-dim-clickable{z-index:2147483643;pointer-events:auto;cursor:default;background:#0000001f}.mtb-draw-bar{position:fixed;bottom:48px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:8px;height:46px;padding:0 8px 0 12px;border-radius:13px;background:#fff;border:1px solid rgba(0,0,0,.08);box-shadow:0 10px 30px #0f172a38;animation:mtbBarIn .2s ease;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-draw-input{width:220px;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:13px;color:#191a1c;outline:none;background:#fafafa;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-draw-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126;background:#fff}.mtb-draw-input::placeholder{color:#00000057}.mtb-draw-icon-btn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:8px;background:transparent;color:#374151;cursor:pointer;transition:background .12s,color .12s}.mtb-draw-icon-btn:hover:not(:disabled){background:#0000000f}.mtb-draw-icon-btn:disabled{color:#00000038;cursor:default}.mtb-draw-sep{width:1px;height:22px;background:#0000001a}.mtb-draw-cancel{height:32px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;color:#0000008c;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:550;transition:background .12s}.mtb-draw-cancel:hover{background:#0000000a}.mtb-draw-submit{height:32px;padding:0 14px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-draw-submit:hover:not(:disabled){background:#047857}.mtb-draw-submit:disabled{opacity:.6;cursor:default}.mtb-draw-error{position:absolute;bottom:100%;left:12px;margin-bottom:6px;color:#dc2626;font-size:11.5px}.mtb-record-preview{margin-bottom:12px}.mtb-record-preview-stage{position:relative;width:100%;height:132px;border-radius:10px;overflow:hidden;background:#0f172a;display:flex;align-items:center;justify-content:center}.mtb-record-preview-stage.playing{align-items:flex-start;justify-content:flex-start}.mtb-record-preview-play{width:44px;height:44px;border-radius:50%;border:none;background:#ffffffeb;color:#059669;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .12s,background .12s}.mtb-record-preview-play:hover:not(:disabled){transform:scale(1.06);background:#fff}.mtb-record-preview-play:disabled{cursor:default;opacity:.6}.mtb-record-preview-badge{position:absolute;right:8px;bottom:8px;padding:2px 7px;border-radius:6px;background:#0009;color:#fff;font-size:11px;font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,monospace}.mtb-record-preview-fallback{color:#ffffffd9;font-size:12px}.mtb-record-preview-name{display:block;margin-top:5px;font-size:11px;color:#0000006b}';
|
|
2
|
-
class
|
|
1
|
+
const vt = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:Inter,-apple-system,BlinkMacSystemFont,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 #05966973}.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}@media (max-width: 480px){.mtb-toolbar{max-width:calc(100vw - 16px);gap:6px}.mtb-toolbar-hint,.mtb-toolbar-sep{display:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{padding-right:10px;padding-left:10px}}.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.selected{border-color:#3b82f6;background:#3b82f60a}.mtb-highlight-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%,-100%);max-width:240px;overflow:hidden;text-overflow:ellipsis;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;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-highlight-tooltip.below{transform:translate(-50%)}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-color:#064e3b}.mtb-highlight-tooltip.below:after{top:auto;bottom:100%;border-top-color:transparent;border-bottom-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;display:flex;flex-direction:column;width:min(320px,calc(100vw - 56px));background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{flex-shrink:0;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{min-height:0;padding:13px;overflow-y:auto;overscroll-behavior:contain}.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:10px;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 #10b98126}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#dc2626;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:32px;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12.5px;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:332px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;padding:24px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-success-icon{width:46px;height:46px;border-radius:50%;background:#05966917;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:5px;letter-spacing:-.01em;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-view-feedback-link{display:inline-flex;align-items:center;gap:5px;color:#047857;text-decoration:none;font-size:13px;font-weight:500;font-family:JetBrains Mono,monospace;background:none;border:none;cursor:pointer;transition:text-decoration .12s}.mtb-view-feedback-link:hover{text-decoration:underline}.mtb-close-link{margin-top:13px;background:none;border:none;cursor:pointer;font-size:12px;color:#0006;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:Inter,-apple-system,BlinkMacSystemFont,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:48px;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:min(346px,calc(100vw - 56px));background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;display:flex;flex-direction:column;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;overflow:hidden}.mtb-clarify-continuation{width:min(320px,calc(100vw - 56px));animation:none}.mtb-clarify-header{padding:8px 10px;display:flex;align-items:center;gap:7px;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:20px;height:20px;border-radius:6px;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:12px;font-weight:650;line-height:1.2;color:#191a1c}.mtb-clarify-subtitle{font-size:9.5px;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;overflow-y:auto;padding:8px 10px 4px;display:flex;flex-direction:column;gap:6px}.mtb-clarify-bubble{max-width:82%;padding:6px 10px;font-size:12px;line-height:1.4;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:11px 11px 11px 3px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border:1px solid #059669;border-radius:11px 11px 3px}.mtb-clarify-thinking{display:flex;align-items:center;gap:4px;padding:8px 12px}.mtb-clarify-thinking .mtb-dot{width:6px;height:6px;background:#059669b3}.mtb-clarify-footer{padding:3px 10px 10px;display:flex;flex-direction:column}.mtb-clarify-input{width:100%;height:40px;padding:7px 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:12px;line-height:1.4;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 #10b98126;background:#fff}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-actions{display:flex;gap:6px;margin-top:6px}.mtb-clarify-skip{flex:0 0 auto;height:30px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;color:#0000008c;white-space:nowrap;transition:background .12s}.mtb-clarify-skip:hover{background:#0000000a}.mtb-clarify-send{flex:1;height:30px;display:inline-flex;align-items:center;justify-content:center;gap:5px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-clarify-send:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled{background:#00000026;cursor:not-allowed}.mtb-clarify-send-feedback{width:100%;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-feedback:not(:disabled):hover{background:#047857}.mtb-clarify-send-feedback:disabled{background:#00000026;cursor:not-allowed}.mtb-clarify-error{margin-bottom:8px;color:#dc2626;font-size:11.5px;line-height:1.4;text-align:center}: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}}.mtb-dim-clickable{z-index:2147483643;pointer-events:auto;cursor:default;background:#0000001f}.mtb-draw-bar{position:fixed;bottom:48px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:8px;height:46px;padding:0 8px 0 12px;border-radius:13px;background:#fff;border:1px solid rgba(0,0,0,.08);box-shadow:0 10px 30px #0f172a38;animation:mtbBarIn .2s ease;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-draw-input{width:220px;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:13px;color:#191a1c;outline:none;background:#fafafa;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-draw-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126;background:#fff}.mtb-draw-input::placeholder{color:#00000057}.mtb-draw-icon-btn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:8px;background:transparent;color:#374151;cursor:pointer;transition:background .12s,color .12s}.mtb-draw-icon-btn:hover:not(:disabled){background:#0000000f}.mtb-draw-icon-btn:disabled{color:#00000038;cursor:default}.mtb-draw-sep{width:1px;height:22px;background:#0000001a}.mtb-draw-cancel{height:32px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;color:#0000008c;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:550;transition:background .12s}.mtb-draw-cancel:hover{background:#0000000a}.mtb-draw-submit{height:32px;padding:0 14px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-draw-submit:hover:not(:disabled){background:#047857}.mtb-draw-submit:disabled{opacity:.6;cursor:default}.mtb-draw-error{position:absolute;bottom:100%;left:12px;margin-bottom:6px;color:#dc2626;font-size:11.5px}.mtb-record-preview{margin-bottom:12px}.mtb-record-preview-stage{position:relative;width:100%;height:132px;border-radius:10px;overflow:hidden;background:#0f172a;display:flex;align-items:center;justify-content:center}.mtb-record-preview-stage.playing{align-items:flex-start;justify-content:flex-start}.mtb-record-preview-play{width:44px;height:44px;border-radius:50%;border:none;background:#ffffffeb;color:#059669;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .12s,background .12s}.mtb-record-preview-play:hover:not(:disabled){transform:scale(1.06);background:#fff}.mtb-record-preview-play:disabled{cursor:default;opacity:.6}.mtb-record-preview-badge{position:absolute;right:8px;bottom:8px;padding:2px 7px;border-radius:6px;background:#0009;color:#fff;font-size:11px;font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,monospace}.mtb-record-preview-fallback{color:#ffffffd9;font-size:12px}.mtb-record-preview-name{display:block;margin-top:5px;font-size:11px;color:#0000006b}';
|
|
2
|
+
class kt {
|
|
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 = vt, this.root.appendChild(e);
|
|
7
7
|
}
|
|
8
8
|
el(t, e) {
|
|
9
9
|
const r = document.createElement(t);
|
|
@@ -20,7 +20,7 @@ class wt {
|
|
|
20
20
|
this.host.remove();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
class
|
|
23
|
+
class St {
|
|
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"), this.idleLabel = n ?? e.tab, this.activeLabel = e.toolbar.exit, this.setLabel(this.idleLabel), this.el.addEventListener("click", s), t.append(this.el);
|
|
26
26
|
}
|
|
@@ -34,8 +34,8 @@ class xt {
|
|
|
34
34
|
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
class
|
|
37
|
+
const Et = 8e3;
|
|
38
|
+
class Ct {
|
|
39
39
|
constructor(t, e, r) {
|
|
40
40
|
this.el = t.el("div", "mtb-frustration-prompt"), this.el.innerHTML = `
|
|
41
41
|
<div class="mtb-frustration-icon">⚠️</div>
|
|
@@ -44,13 +44,13 @@ class kt {
|
|
|
44
44
|
<button class="mtb-frustration-tell">${e.frustration.action}</button>
|
|
45
45
|
<button class="mtb-frustration-dismiss">${e.frustration.dismiss}</button>
|
|
46
46
|
</div>
|
|
47
|
-
`, 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,
|
|
47
|
+
`, 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, Et);
|
|
48
48
|
}
|
|
49
49
|
destroy() {
|
|
50
50
|
this.el.remove();
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class _t {
|
|
54
54
|
constructor(t, e) {
|
|
55
55
|
this.onClick = e, this.el = t.el("div", "mtb-dim mtb-dim-clickable"), this.el.addEventListener("click", this.onClick), t.append(this.el);
|
|
56
56
|
}
|
|
@@ -58,7 +58,7 @@ class St {
|
|
|
58
58
|
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class Tt {
|
|
62
62
|
constructor(t, e, r, s) {
|
|
63
63
|
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", () => {
|
|
64
64
|
this.setMode("markup"), s?.("markup");
|
|
@@ -95,7 +95,7 @@ class Et {
|
|
|
95
95
|
this.el.remove();
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class Lt {
|
|
99
99
|
constructor(t, e) {
|
|
100
100
|
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);
|
|
101
101
|
}
|
|
@@ -103,7 +103,7 @@ class Ct {
|
|
|
103
103
|
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();
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class Mt {
|
|
107
107
|
constructor(t) {
|
|
108
108
|
this.highlightEl = t.el("div", "mtb-highlight"), this.tooltipEl = t.el("div", "mtb-highlight-tooltip"), this.hide(), t.append(this.highlightEl, this.tooltipEl);
|
|
109
109
|
}
|
|
@@ -112,7 +112,7 @@ class _t {
|
|
|
112
112
|
this.highlightEl.style.top = `${e.top - 2}px`, this.highlightEl.style.left = `${e.left - 2}px`, this.highlightEl.style.width = `${e.width + 4}px`, this.highlightEl.style.height = `${e.height + 4}px`, this.highlightEl.style.display = "block", this.showTooltip(t, e);
|
|
113
113
|
}
|
|
114
114
|
showTooltip(t, e) {
|
|
115
|
-
this.tooltipEl.textContent =
|
|
115
|
+
this.tooltipEl.textContent = F(t);
|
|
116
116
|
const r = e.top < 30;
|
|
117
117
|
this.tooltipEl.classList.toggle("below", r), this.tooltipEl.style.left = `${e.left + e.width / 2}px`, this.tooltipEl.style.top = r ? `${e.bottom + 8}px` : `${e.top - 8}px`, this.tooltipEl.style.display = "block";
|
|
118
118
|
}
|
|
@@ -126,7 +126,7 @@ class _t {
|
|
|
126
126
|
this.highlightEl.remove(), this.tooltipEl.remove();
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function F(i) {
|
|
130
130
|
if (i instanceof HTMLElement) {
|
|
131
131
|
const t = i.getAttribute("aria-label");
|
|
132
132
|
if (t) return t;
|
|
@@ -143,7 +143,7 @@ function I(i) {
|
|
|
143
143
|
}
|
|
144
144
|
return i.tagName.toLowerCase();
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function at(i) {
|
|
147
147
|
const t = [];
|
|
148
148
|
let e = i;
|
|
149
149
|
for (; e && e !== document.body && t.length < 5; ) {
|
|
@@ -168,7 +168,7 @@ function st(i) {
|
|
|
168
168
|
}
|
|
169
169
|
return t.join(" > ");
|
|
170
170
|
}
|
|
171
|
-
class
|
|
171
|
+
class Pt {
|
|
172
172
|
constructor(t) {
|
|
173
173
|
this.pins = [], this.shadow = t;
|
|
174
174
|
}
|
|
@@ -184,14 +184,14 @@ class Tt {
|
|
|
184
184
|
this.clearAll();
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
const
|
|
188
|
-
color:
|
|
187
|
+
const D = "#059669", Rt = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', S = {
|
|
188
|
+
color: D,
|
|
189
189
|
width: "3.5",
|
|
190
190
|
linecap: "round",
|
|
191
191
|
linejoin: "round",
|
|
192
192
|
filter: "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"
|
|
193
193
|
};
|
|
194
|
-
class
|
|
194
|
+
class Dt {
|
|
195
195
|
constructor(t) {
|
|
196
196
|
this.currentPath = null, this.currentPoints = [], this.isDrawing = !1, this.committed = [], this.redoStack = [], this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.svg.setAttribute("class", "mtb-draw-svg"), t.append(this.svg);
|
|
197
197
|
}
|
|
@@ -199,12 +199,12 @@ class Mt {
|
|
|
199
199
|
this.isDrawing = !0, this.currentPoints = [[t, e]], this.currentPath = this.createPath(), this.svg.appendChild(this.currentPath);
|
|
200
200
|
}
|
|
201
201
|
continueDraw(t, e) {
|
|
202
|
-
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, e]), this.currentPath.setAttribute("d",
|
|
202
|
+
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, e]), this.currentPath.setAttribute("d", j(this.currentPoints)));
|
|
203
203
|
}
|
|
204
204
|
// Commits the in-progress stroke to the undo stack and clears the redo stack.
|
|
205
205
|
// Callers decide whether the stroke has enough points before committing.
|
|
206
206
|
commitStroke() {
|
|
207
|
-
return !this.isDrawing || !this.currentPath ? !1 : (this.isDrawing = !1, this.committed.push({ path: this.currentPath, d:
|
|
207
|
+
return !this.isDrawing || !this.currentPath ? !1 : (this.isDrawing = !1, this.committed.push({ path: this.currentPath, d: j(this.currentPoints), points: this.currentPoints }), this.redoStack = [], this.currentPath = null, this.currentPoints = [], !0);
|
|
208
208
|
}
|
|
209
209
|
cancelCurrentDraw() {
|
|
210
210
|
this.currentPath?.remove(), this.currentPath = null, this.isDrawing = !1, this.currentPoints = [];
|
|
@@ -230,7 +230,7 @@ class Mt {
|
|
|
230
230
|
}
|
|
231
231
|
getAnnotation() {
|
|
232
232
|
if (this.committed.length === 0) return null;
|
|
233
|
-
const t = this.committed.flatMap((s) => s.points), [e, r] =
|
|
233
|
+
const t = this.committed.flatMap((s) => s.points), [e, r] = At(t);
|
|
234
234
|
return {
|
|
235
235
|
type: "draw",
|
|
236
236
|
x: e,
|
|
@@ -253,10 +253,10 @@ class Mt {
|
|
|
253
253
|
}
|
|
254
254
|
createPath() {
|
|
255
255
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
256
|
-
return t.setAttribute("fill", "none"), t.setAttribute("stroke",
|
|
256
|
+
return t.setAttribute("fill", "none"), t.setAttribute("stroke", S.color), t.setAttribute("stroke-width", S.width), t.setAttribute("stroke-linecap", S.linecap), t.setAttribute("stroke-linejoin", S.linejoin), t.setAttribute("style", `filter:${S.filter}`), t;
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function j(i) {
|
|
260
260
|
if (i.length === 0) return "";
|
|
261
261
|
const [t, e] = i[0];
|
|
262
262
|
let r = `M ${t} ${e}`;
|
|
@@ -266,14 +266,14 @@ function U(i) {
|
|
|
266
266
|
}
|
|
267
267
|
return r;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function At(i) {
|
|
270
270
|
const t = i.map((n) => n[0]), e = i.map((n) => n[1]), r = (Math.min(...t) + Math.max(...t)) / 2, s = (Math.min(...e) + Math.max(...e)) / 2;
|
|
271
271
|
return [r, s];
|
|
272
272
|
}
|
|
273
|
-
const
|
|
274
|
-
class
|
|
273
|
+
const Ht = 5;
|
|
274
|
+
class It {
|
|
275
275
|
constructor(t, e, r) {
|
|
276
|
-
this.messages = e, this.handlers = r, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new
|
|
276
|
+
this.messages = e, this.handlers = r, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new Mt(t), this.pinMarker = new Pt(t), this.drawLayer = new Dt(t), this.overlay = new Lt(t, {
|
|
277
277
|
onMouseDown: (s) => this.handleMouseDown(s),
|
|
278
278
|
onMouseMove: (s) => this.handleMouseMove(s),
|
|
279
279
|
onMouseUp: (s) => this.handleMouseUp(s),
|
|
@@ -296,7 +296,7 @@ class Dt {
|
|
|
296
296
|
}
|
|
297
297
|
updateHighlight() {
|
|
298
298
|
if (!this.interactionActive || this.drawLayer.isCurrentlyDrawing() || this.drawSessionActive()) return;
|
|
299
|
-
const t =
|
|
299
|
+
const t = q(this.lastMoveX, this.lastMoveY);
|
|
300
300
|
t ? this.highlighter.highlight(t) : this.highlighter.hide();
|
|
301
301
|
}
|
|
302
302
|
cancelPendingHighlight() {
|
|
@@ -309,16 +309,16 @@ class Dt {
|
|
|
309
309
|
// draw note bar; a tap on an element becomes a pin. Stray taps while a
|
|
310
310
|
// drawing already exists are ignored so they don't hijack the draw flow.
|
|
311
311
|
finishStroke(t) {
|
|
312
|
-
if (this.drawLayer.getCurrentPointCount() >=
|
|
312
|
+
if (this.drawLayer.getCurrentPointCount() >= Ht) {
|
|
313
313
|
this.drawLayer.commitStroke(), this.highlighter.hide(), this.handlers.onDrawStroke();
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
316
|
if (this.drawLayer.cancelCurrentDraw(), this.drawLayer.hasStrokes() || !t) return;
|
|
317
|
-
const e =
|
|
317
|
+
const e = q(t.clientX, t.clientY), r = e ? F(e) : this.messages.annotation.element, s = e?.getBoundingClientRect(), n = {
|
|
318
318
|
type: "pin",
|
|
319
319
|
x: t.clientX,
|
|
320
320
|
y: t.clientY,
|
|
321
|
-
targetSelector: e ?
|
|
321
|
+
targetSelector: e ? at(e) : void 0,
|
|
322
322
|
targetText: e?.textContent?.trim().slice(0, 200) ?? "",
|
|
323
323
|
targetName: r,
|
|
324
324
|
targetRect: s ? { top: s.top, left: s.left, width: s.width, height: s.height, bottom: s.bottom } : void 0
|
|
@@ -359,18 +359,18 @@ class Dt {
|
|
|
359
359
|
this.dismissInteraction(), this.highlighter.destroy(), this.pinMarker.destroy(), this.drawLayer.destroy();
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function q(i, t) {
|
|
363
363
|
return document.elementsFromPoint(i, t).find((e) => e.id !== "mtb-widget-host") ?? null;
|
|
364
364
|
}
|
|
365
|
-
const
|
|
366
|
-
function
|
|
367
|
-
const t = document.getElementById(
|
|
365
|
+
const $t = "mtb-widget-host";
|
|
366
|
+
function _(i) {
|
|
367
|
+
const t = document.getElementById($t);
|
|
368
368
|
return t ? t === i || t.contains(i) : !1;
|
|
369
369
|
}
|
|
370
370
|
function d(i) {
|
|
371
371
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
372
372
|
}
|
|
373
|
-
class
|
|
373
|
+
class Bt {
|
|
374
374
|
constructor(t, e) {
|
|
375
375
|
this.loading = !1, this.onSubmit = e.onSubmit, this.submitLabel = e.messages.draw.submit, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.input = this.el.querySelector(".mtb-draw-input"), this.undoBtn = this.el.querySelector(".mtb-draw-undo"), this.redoBtn = this.el.querySelector(".mtb-draw-redo"), this.submitBtn = this.el.querySelector(".mtb-draw-submit"), this.errorEl = this.el.querySelector(".mtb-draw-error"), this.undoBtn.addEventListener("click", e.onUndo), this.redoBtn.addEventListener("click", e.onRedo), this.el.querySelector(".mtb-draw-cancel").addEventListener("click", e.onCancel), this.submitBtn.addEventListener("click", () => this.submit()), this.input.addEventListener("keydown", (r) => {
|
|
376
376
|
r.isComposing || r.keyCode === 229 || r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.submit());
|
|
@@ -407,9 +407,9 @@ class Ht {
|
|
|
407
407
|
this.el.remove();
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
class
|
|
410
|
+
class Ft {
|
|
411
411
|
constructor(t, e) {
|
|
412
|
-
this.loading = !1, this.onSubmit = e.onSubmit, this.onClose = e.onClose, this.submitLabel = e.messages.popup.submit, this.messages = e.messages, 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, e.targetRect), this.bindEvents(e.messages), e.onMyFeedback && this.el.querySelector(".mtb-my-feedback").addEventListener("click", e.onMyFeedback), this.textarea.focus();
|
|
412
|
+
this.loading = !1, this.onSubmit = e.onSubmit, this.onClose = e.onClose, this.submitLabel = e.messages.popup.submit, this.messages = e.messages, 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, e.targetRect, e.position ?? "right"), this.bindEvents(e.messages), e.onMyFeedback && this.el.querySelector(".mtb-my-feedback").addEventListener("click", e.onMyFeedback), this.textarea.focus();
|
|
413
413
|
}
|
|
414
414
|
buildHTML(t) {
|
|
415
415
|
const e = t.messages, r = e.popup.quickOptions.map(
|
|
@@ -449,10 +449,10 @@ class It {
|
|
|
449
449
|
</div>
|
|
450
450
|
`;
|
|
451
451
|
}
|
|
452
|
-
positionPopup(t, e, r) {
|
|
453
|
-
const n =
|
|
454
|
-
let
|
|
455
|
-
r ? (
|
|
452
|
+
positionPopup(t, e, r, s) {
|
|
453
|
+
const n = window.innerWidth, o = window.innerHeight, a = 12, l = 8, c = 32, h = Math.min(320, n - 2 * a - c), u = this.el.offsetHeight || 260, m = a + (s === "left" ? c : 0), g = n - a - (s === "right" ? c : 0);
|
|
454
|
+
let y, b;
|
|
455
|
+
r ? (y = r.left, b = r.bottom + l, b + u > o - a && (b = r.top - u - l), b < a && (b = Math.min(r.bottom + l, o - u - a))) : (y = t + 12, b = e + 12), y + h > g && (y = g - h), y < m && (y = m), b < a && (b = a), this.el.style.left = `${y}px`, this.el.style.top = `${b}px`, this.el.style.maxHeight = `${o - b - a}px`;
|
|
456
456
|
}
|
|
457
457
|
bindEvents(t) {
|
|
458
458
|
this.el.querySelector(".mtb-popup-close").addEventListener("click", () => this.onClose()), this.el.querySelector(".mtb-cancel-btn").addEventListener("click", () => this.onClose()), this.errorEl = this.el.querySelector(".mtb-popup-error"), this.el.querySelectorAll(".mtb-quick-option").forEach((e) => {
|
|
@@ -478,31 +478,37 @@ class It {
|
|
|
478
478
|
setError(t) {
|
|
479
479
|
this.errorEl.textContent = t, this.errorEl.hidden = !1;
|
|
480
480
|
}
|
|
481
|
+
releaseElement() {
|
|
482
|
+
return this.el;
|
|
483
|
+
}
|
|
481
484
|
destroy() {
|
|
482
485
|
this.el.remove();
|
|
483
486
|
}
|
|
484
487
|
}
|
|
485
|
-
const
|
|
486
|
-
class
|
|
488
|
+
const Ut = 2e3, Ot = 45e3, zt = 346, jt = 270;
|
|
489
|
+
class qt {
|
|
487
490
|
constructor(t, e) {
|
|
488
|
-
this.pollTimer = null, this.pollDeadline = 0, this.streamingBubble = null, this.lastMessages = [], this.done = !1, this.sending = !1, this.finalizing = !1, this.destroyed = !1, this.submissionSessionId = e.submissionSessionId, this.submissionToken = e.submissionToken, this.apiClient = e.apiClient, this.onFinalize = e.onFinalize, this.i18n = e.messages, this.preloadedResult = e.preloadedResult, this.pendingClarification = e.pendingClarification
|
|
491
|
+
this.pollTimer = null, this.pollDeadline = 0, this.streamingBubble = null, this.lastMessages = [], this.done = !1, this.sending = !1, this.finalizing = !1, this.destroyed = !1, this.submissionSessionId = e.submissionSessionId, this.submissionToken = e.submissionToken, this.apiClient = e.apiClient, this.onFinalize = e.onFinalize, this.i18n = e.messages, this.preloadedResult = e.preloadedResult, this.pendingClarification = e.pendingClarification;
|
|
492
|
+
const r = e.element;
|
|
493
|
+
this.el = r ?? t.el("div", "mtb-clarify"), this.el.className = r ? "mtb-clarify mtb-clarify-continuation" : "mtb-clarify", this.el.innerHTML = this.buildHTML(e.messages), r || (t.append(this.el), this.positionCard(e.x, e.y, e.position ?? "right")), 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(), this.startConversation();
|
|
489
494
|
}
|
|
490
495
|
// Anchors the card near the annotation point, clamped to the viewport so it
|
|
491
496
|
// never overflows a screen edge (mirrors CommentPopup.positionPopup).
|
|
492
|
-
positionCard(t, e) {
|
|
493
|
-
const
|
|
497
|
+
positionCard(t, e, r) {
|
|
498
|
+
const s = window.innerWidth, n = window.innerHeight, o = 12, a = 32, l = Math.min(zt, s - 2 * o - a), c = this.el.offsetHeight || jt, h = o + (r === "left" ? a : 0), u = s - o - (r === "right" ? a : 0);
|
|
494
499
|
if (t === void 0 || e === void 0) {
|
|
495
|
-
|
|
500
|
+
const y = Math.max(h, (s - l) / 2);
|
|
501
|
+
this.el.style.left = `${Math.min(y, u - l)}px`, this.el.style.top = `${Math.max(o, (n - c) / 2)}px`, this.el.style.maxHeight = `${n - 2 * o}px`;
|
|
496
502
|
return;
|
|
497
503
|
}
|
|
498
|
-
let
|
|
499
|
-
|
|
504
|
+
let m = t + 12, g = e + 12;
|
|
505
|
+
m + l > u && (m = t - l - 12), m + l > u && (m = u - l), m < h && (m = h), g + c > n - o && (g = n - c - o), g < o && (g = o), this.el.style.left = `${m}px`, this.el.style.top = `${g}px`, this.el.style.maxHeight = `${n - g - o}px`;
|
|
500
506
|
}
|
|
501
507
|
buildHTML(t) {
|
|
502
508
|
return `
|
|
503
509
|
<div class="mtb-clarify-header">
|
|
504
510
|
<span class="mtb-clarify-icon">
|
|
505
|
-
<svg width="
|
|
511
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
|
|
506
512
|
<path d="M12 3l1.6 5.4L19 10l-5.4 1.6L12 17l-1.6-5.4L5 10l5.4-1.6L12 3z"/>
|
|
507
513
|
</svg>
|
|
508
514
|
</span>
|
|
@@ -511,18 +517,18 @@ class Ot {
|
|
|
511
517
|
<div class="mtb-clarify-subtitle">${d(t.clarify.subtitle)}</div>
|
|
512
518
|
</div>
|
|
513
519
|
<button class="mtb-clarify-close" type="button" title="${d(t.clarify.skip)}" aria-label="${d(t.clarify.skip)}">
|
|
514
|
-
<svg width="
|
|
520
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
515
521
|
<path d="M18 6L6 18M6 6l12 12"/>
|
|
516
522
|
</svg>
|
|
517
523
|
</button>
|
|
518
524
|
</div>
|
|
519
525
|
<div class="mtb-clarify-messages"></div>
|
|
520
526
|
<div class="mtb-clarify-footer">
|
|
521
|
-
<textarea class="mtb-clarify-input" rows="
|
|
527
|
+
<textarea class="mtb-clarify-input" rows="1" placeholder="${d(t.clarify.placeholder)}"></textarea>
|
|
522
528
|
<div class="mtb-clarify-actions">
|
|
523
529
|
<button class="mtb-clarify-skip" type="button">${d(t.clarify.skip)}</button>
|
|
524
530
|
<button class="mtb-clarify-send" type="button" disabled>
|
|
525
|
-
<svg width="
|
|
531
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
526
532
|
<line x1="22" y1="2" x2="11" y2="13"/>
|
|
527
533
|
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
|
528
534
|
</svg>
|
|
@@ -626,7 +632,7 @@ class Ot {
|
|
|
626
632
|
this.streamingBubble = null;
|
|
627
633
|
}
|
|
628
634
|
startPolling() {
|
|
629
|
-
this.stopPolling(), this.pollDeadline = Date.now() +
|
|
635
|
+
this.stopPolling(), this.pollDeadline = Date.now() + Ot, this.pollTimer = setInterval(() => this.poll(), Ut);
|
|
630
636
|
}
|
|
631
637
|
stopPolling() {
|
|
632
638
|
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null);
|
|
@@ -649,10 +655,21 @@ class Ot {
|
|
|
649
655
|
}
|
|
650
656
|
}
|
|
651
657
|
handleDone() {
|
|
652
|
-
this.done || (this.done = !0, this.stopPolling(), this.removeThinking(), this.
|
|
658
|
+
this.done || (this.done = !0, this.stopPolling(), this.removeThinking(), this.showFinalizeButton());
|
|
653
659
|
}
|
|
654
|
-
|
|
655
|
-
|
|
660
|
+
showFinalizeButton() {
|
|
661
|
+
const t = this.el.querySelector(".mtb-clarify-footer");
|
|
662
|
+
t.innerHTML = `
|
|
663
|
+
<button class="mtb-clarify-send-feedback" type="button">
|
|
664
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
665
|
+
<line x1="22" y1="2" x2="11" y2="13"/>
|
|
666
|
+
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
|
667
|
+
</svg>
|
|
668
|
+
<span>${d(this.i18n.clarify.send_feedback)}</span>
|
|
669
|
+
</button>
|
|
670
|
+
`, t.querySelector(".mtb-clarify-send-feedback").addEventListener("click", () => {
|
|
671
|
+
this.destroyed || this.finalize();
|
|
672
|
+
});
|
|
656
673
|
}
|
|
657
674
|
async finalize() {
|
|
658
675
|
if (!(this.finalizing || this.destroyed)) {
|
|
@@ -700,8 +717,8 @@ class Ot {
|
|
|
700
717
|
this.destroyed = !0, this.stopPolling(), this.el.remove();
|
|
701
718
|
}
|
|
702
719
|
}
|
|
703
|
-
const
|
|
704
|
-
class
|
|
720
|
+
const Nt = 5e3, Wt = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
721
|
+
class Vt {
|
|
705
722
|
constructor(t, e, r, s, n) {
|
|
706
723
|
this.messages = e, this.el = t.el("div", "mtb-success"), this.el.style.right = "20px", this.el.style.bottom = "20px";
|
|
707
724
|
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} <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg></button>` : "", c = n?.emailCapture ? `
|
|
@@ -715,7 +732,7 @@ class qt {
|
|
|
715
732
|
</div>` : "";
|
|
716
733
|
this.el.innerHTML = `
|
|
717
734
|
<div class="mtb-success-icon">
|
|
718
|
-
<svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="${
|
|
735
|
+
<svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="${D}" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
|
|
719
736
|
<polyline points="20 6 9 17 4 12"/>
|
|
720
737
|
</svg>
|
|
721
738
|
</div>
|
|
@@ -724,12 +741,12 @@ class qt {
|
|
|
724
741
|
${c}
|
|
725
742
|
${l}
|
|
726
743
|
<button class="mtb-close-link">${e.success.close}</button>
|
|
727
|
-
`, 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(),
|
|
744
|
+
`, 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(), Nt);
|
|
728
745
|
}
|
|
729
746
|
bindEmailCapture(t) {
|
|
730
747
|
const e = this.el.querySelector(".mtb-email-input"), r = this.el.querySelector(".mtb-email-submit"), s = this.el.querySelector(".mtb-email-error"), n = async () => {
|
|
731
748
|
const o = e.value.trim();
|
|
732
|
-
if (!
|
|
749
|
+
if (!Wt.test(o)) {
|
|
733
750
|
e.classList.add("mtb-email-invalid");
|
|
734
751
|
return;
|
|
735
752
|
}
|
|
@@ -743,7 +760,7 @@ class qt {
|
|
|
743
760
|
this.el.remove();
|
|
744
761
|
}
|
|
745
762
|
}
|
|
746
|
-
function
|
|
763
|
+
function Yt(i, t) {
|
|
747
764
|
if (i.match(/^[a-z]+:\/\//i))
|
|
748
765
|
return i;
|
|
749
766
|
if (i.match(/^\/\//))
|
|
@@ -753,7 +770,7 @@ function Nt(i, t) {
|
|
|
753
770
|
const e = document.implementation.createHTMLDocument(), r = e.createElement("base"), s = e.createElement("a");
|
|
754
771
|
return e.head.appendChild(r), e.body.appendChild(s), t && (r.href = t), s.href = i, s.href;
|
|
755
772
|
}
|
|
756
|
-
const
|
|
773
|
+
const Kt = /* @__PURE__ */ (() => {
|
|
757
774
|
let i = 0;
|
|
758
775
|
const t = () => (
|
|
759
776
|
// eslint-disable-next-line no-bitwise
|
|
@@ -761,33 +778,33 @@ const Wt = /* @__PURE__ */ (() => {
|
|
|
761
778
|
);
|
|
762
779
|
return () => (i += 1, `u${t()}${i}`);
|
|
763
780
|
})();
|
|
764
|
-
function
|
|
781
|
+
function x(i) {
|
|
765
782
|
const t = [];
|
|
766
783
|
for (let e = 0, r = i.length; e < r; e++)
|
|
767
784
|
t.push(i[e]);
|
|
768
785
|
return t;
|
|
769
786
|
}
|
|
770
|
-
let
|
|
771
|
-
function
|
|
772
|
-
return
|
|
787
|
+
let v = null;
|
|
788
|
+
function lt(i = {}) {
|
|
789
|
+
return v || (i.includeStyleProperties ? (v = i.includeStyleProperties, v) : (v = x(window.getComputedStyle(document.documentElement)), v));
|
|
773
790
|
}
|
|
774
|
-
function
|
|
791
|
+
function M(i, t) {
|
|
775
792
|
const r = (i.ownerDocument.defaultView || window).getComputedStyle(i).getPropertyValue(t);
|
|
776
793
|
return r ? parseFloat(r.replace("px", "")) : 0;
|
|
777
794
|
}
|
|
778
|
-
function
|
|
779
|
-
const t =
|
|
795
|
+
function Xt(i) {
|
|
796
|
+
const t = M(i, "border-left-width"), e = M(i, "border-right-width");
|
|
780
797
|
return i.clientWidth + t + e;
|
|
781
798
|
}
|
|
782
|
-
function
|
|
783
|
-
const t =
|
|
799
|
+
function Gt(i) {
|
|
800
|
+
const t = M(i, "border-top-width"), e = M(i, "border-bottom-width");
|
|
784
801
|
return i.clientHeight + t + e;
|
|
785
802
|
}
|
|
786
|
-
function
|
|
787
|
-
const e = t.width ||
|
|
803
|
+
function ct(i, t = {}) {
|
|
804
|
+
const e = t.width || Xt(i), r = t.height || Gt(i);
|
|
788
805
|
return { width: e, height: r };
|
|
789
806
|
}
|
|
790
|
-
function
|
|
807
|
+
function Jt() {
|
|
791
808
|
let i, t;
|
|
792
809
|
try {
|
|
793
810
|
t = process;
|
|
@@ -796,11 +813,11 @@ function Kt() {
|
|
|
796
813
|
const e = t && t.env ? t.env.devicePixelRatio : null;
|
|
797
814
|
return e && (i = parseInt(e, 10), Number.isNaN(i) && (i = 1)), i || window.devicePixelRatio || 1;
|
|
798
815
|
}
|
|
799
|
-
const
|
|
800
|
-
function
|
|
801
|
-
(i.width >
|
|
816
|
+
const p = 16384;
|
|
817
|
+
function Qt(i) {
|
|
818
|
+
(i.width > p || i.height > p) && (i.width > p && i.height > p ? i.width > i.height ? (i.height *= p / i.width, i.width = p) : (i.width *= p / i.height, i.height = p) : i.width > p ? (i.height *= p / i.width, i.width = p) : (i.width *= p / i.height, i.height = p));
|
|
802
819
|
}
|
|
803
|
-
function
|
|
820
|
+
function P(i) {
|
|
804
821
|
return new Promise((t, e) => {
|
|
805
822
|
const r = new Image();
|
|
806
823
|
r.onload = () => {
|
|
@@ -810,80 +827,80 @@ function T(i) {
|
|
|
810
827
|
}, r.onerror = e, r.crossOrigin = "anonymous", r.decoding = "async", r.src = i;
|
|
811
828
|
});
|
|
812
829
|
}
|
|
813
|
-
async function
|
|
830
|
+
async function Zt(i) {
|
|
814
831
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
|
|
815
832
|
}
|
|
816
|
-
async function
|
|
833
|
+
async function te(i, t, e) {
|
|
817
834
|
const r = "http://www.w3.org/2000/svg", s = document.createElementNS(r, "svg"), n = document.createElementNS(r, "foreignObject");
|
|
818
|
-
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),
|
|
835
|
+
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), Zt(s);
|
|
819
836
|
}
|
|
820
|
-
const
|
|
837
|
+
const f = (i, t) => {
|
|
821
838
|
if (i instanceof t)
|
|
822
839
|
return !0;
|
|
823
840
|
const e = Object.getPrototypeOf(i);
|
|
824
|
-
return e === null ? !1 : e.constructor.name === t.name ||
|
|
841
|
+
return e === null ? !1 : e.constructor.name === t.name || f(e, t);
|
|
825
842
|
};
|
|
826
|
-
function
|
|
843
|
+
function ee(i) {
|
|
827
844
|
const t = i.getPropertyValue("content");
|
|
828
845
|
return `${i.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
829
846
|
}
|
|
830
|
-
function
|
|
831
|
-
return
|
|
847
|
+
function ie(i, t) {
|
|
848
|
+
return lt(t).map((e) => {
|
|
832
849
|
const r = i.getPropertyValue(e), s = i.getPropertyPriority(e);
|
|
833
850
|
return `${e}: ${r}${s ? " !important" : ""};`;
|
|
834
851
|
}).join(" ");
|
|
835
852
|
}
|
|
836
|
-
function
|
|
837
|
-
const s = `.${i}:${t}`, n = e.cssText ?
|
|
853
|
+
function re(i, t, e, r) {
|
|
854
|
+
const s = `.${i}:${t}`, n = e.cssText ? ee(e) : ie(e, r);
|
|
838
855
|
return document.createTextNode(`${s}{${n}}`);
|
|
839
856
|
}
|
|
840
|
-
function
|
|
857
|
+
function N(i, t, e, r) {
|
|
841
858
|
const s = window.getComputedStyle(i, e), n = s.getPropertyValue("content");
|
|
842
859
|
if (n === "" || n === "none")
|
|
843
860
|
return;
|
|
844
|
-
const o =
|
|
861
|
+
const o = Kt();
|
|
845
862
|
try {
|
|
846
863
|
t.className = `${t.className} ${o}`;
|
|
847
864
|
} catch {
|
|
848
865
|
return;
|
|
849
866
|
}
|
|
850
867
|
const a = document.createElement("style");
|
|
851
|
-
a.appendChild(
|
|
868
|
+
a.appendChild(re(o, e, s, r)), t.appendChild(a);
|
|
852
869
|
}
|
|
853
|
-
function
|
|
854
|
-
|
|
870
|
+
function se(i, t, e) {
|
|
871
|
+
N(i, t, ":before", e), N(i, t, ":after", e);
|
|
855
872
|
}
|
|
856
|
-
const
|
|
857
|
-
woff:
|
|
858
|
-
woff2:
|
|
873
|
+
const W = "application/font-woff", V = "image/jpeg", ne = {
|
|
874
|
+
woff: W,
|
|
875
|
+
woff2: W,
|
|
859
876
|
ttf: "application/font-truetype",
|
|
860
877
|
eot: "application/vnd.ms-fontobject",
|
|
861
878
|
png: "image/png",
|
|
862
|
-
jpg:
|
|
863
|
-
jpeg:
|
|
879
|
+
jpg: V,
|
|
880
|
+
jpeg: V,
|
|
864
881
|
gif: "image/gif",
|
|
865
882
|
tiff: "image/tiff",
|
|
866
883
|
svg: "image/svg+xml",
|
|
867
884
|
webp: "image/webp"
|
|
868
885
|
};
|
|
869
|
-
function
|
|
886
|
+
function oe(i) {
|
|
870
887
|
const t = /\.([^./]*?)$/g.exec(i);
|
|
871
888
|
return t ? t[1] : "";
|
|
872
889
|
}
|
|
873
|
-
function
|
|
874
|
-
const t =
|
|
875
|
-
return
|
|
890
|
+
function U(i) {
|
|
891
|
+
const t = oe(i).toLowerCase();
|
|
892
|
+
return ne[t] || "";
|
|
876
893
|
}
|
|
877
|
-
function
|
|
894
|
+
function ae(i) {
|
|
878
895
|
return i.split(/,/)[1];
|
|
879
896
|
}
|
|
880
|
-
function
|
|
897
|
+
function I(i) {
|
|
881
898
|
return i.search(/^(data:)/) !== -1;
|
|
882
899
|
}
|
|
883
|
-
function
|
|
900
|
+
function le(i, t) {
|
|
884
901
|
return `data:${t};base64,${i}`;
|
|
885
902
|
}
|
|
886
|
-
async function
|
|
903
|
+
async function dt(i, t, e) {
|
|
887
904
|
const r = await fetch(i, t);
|
|
888
905
|
if (r.status === 404)
|
|
889
906
|
throw new Error(`Resource "${r.url}" not found`);
|
|
@@ -899,86 +916,86 @@ async function at(i, t, e) {
|
|
|
899
916
|
}, a.readAsDataURL(s);
|
|
900
917
|
});
|
|
901
918
|
}
|
|
902
|
-
const
|
|
903
|
-
function
|
|
919
|
+
const H = {};
|
|
920
|
+
function ce(i, t, e) {
|
|
904
921
|
let r = i.replace(/\?.*/, "");
|
|
905
922
|
return e && (r = i), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
|
|
906
923
|
}
|
|
907
|
-
async function
|
|
908
|
-
const r =
|
|
909
|
-
if (
|
|
910
|
-
return
|
|
924
|
+
async function O(i, t, e) {
|
|
925
|
+
const r = ce(i, t, e.includeQueryParams);
|
|
926
|
+
if (H[r] != null)
|
|
927
|
+
return H[r];
|
|
911
928
|
e.cacheBust && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
912
929
|
let s;
|
|
913
930
|
try {
|
|
914
|
-
const n = await
|
|
915
|
-
s =
|
|
931
|
+
const n = await dt(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""), ae(a)));
|
|
932
|
+
s = le(n, t);
|
|
916
933
|
} catch (n) {
|
|
917
934
|
s = e.imagePlaceholder || "";
|
|
918
935
|
let o = `Failed to fetch resource: ${i}`;
|
|
919
936
|
n && (o = typeof n == "string" ? n : n.message), o && console.warn(o);
|
|
920
937
|
}
|
|
921
|
-
return
|
|
938
|
+
return H[r] = s, s;
|
|
922
939
|
}
|
|
923
|
-
async function
|
|
940
|
+
async function de(i) {
|
|
924
941
|
const t = i.toDataURL();
|
|
925
|
-
return t === "data:," ? i.cloneNode(!1) :
|
|
942
|
+
return t === "data:," ? i.cloneNode(!1) : P(t);
|
|
926
943
|
}
|
|
927
|
-
async function
|
|
944
|
+
async function he(i, t) {
|
|
928
945
|
if (i.currentSrc) {
|
|
929
946
|
const n = document.createElement("canvas"), o = n.getContext("2d");
|
|
930
947
|
n.width = i.clientWidth, n.height = i.clientHeight, o?.drawImage(i, 0, 0, n.width, n.height);
|
|
931
948
|
const a = n.toDataURL();
|
|
932
|
-
return
|
|
949
|
+
return P(a);
|
|
933
950
|
}
|
|
934
|
-
const e = i.poster, r =
|
|
935
|
-
return
|
|
951
|
+
const e = i.poster, r = U(e), s = await O(e, r, t);
|
|
952
|
+
return P(s);
|
|
936
953
|
}
|
|
937
|
-
async function
|
|
954
|
+
async function ue(i, t) {
|
|
938
955
|
var e;
|
|
939
956
|
try {
|
|
940
957
|
if (!((e = i?.contentDocument) === null || e === void 0) && e.body)
|
|
941
|
-
return await
|
|
958
|
+
return await A(i.contentDocument.body, t, !0);
|
|
942
959
|
} catch {
|
|
943
960
|
}
|
|
944
961
|
return i.cloneNode(!1);
|
|
945
962
|
}
|
|
946
|
-
async function
|
|
947
|
-
return
|
|
963
|
+
async function me(i, t) {
|
|
964
|
+
return f(i, HTMLCanvasElement) ? de(i) : f(i, HTMLVideoElement) ? he(i, t) : f(i, HTMLIFrameElement) ? ue(i, t) : i.cloneNode(ht(i));
|
|
948
965
|
}
|
|
949
|
-
const
|
|
950
|
-
async function
|
|
966
|
+
const fe = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT", ht = (i) => i.tagName != null && i.tagName.toUpperCase() === "SVG";
|
|
967
|
+
async function pe(i, t, e) {
|
|
951
968
|
var r, s;
|
|
952
|
-
if (
|
|
969
|
+
if (ht(t))
|
|
953
970
|
return t;
|
|
954
971
|
let n = [];
|
|
955
|
-
return
|
|
972
|
+
return fe(i) && i.assignedNodes ? n = x(i.assignedNodes()) : f(i, HTMLIFrameElement) && (!((r = i.contentDocument) === null || r === void 0) && r.body) ? n = x(i.contentDocument.body.childNodes) : n = x(((s = i.shadowRoot) !== null && s !== void 0 ? s : i).childNodes), n.length === 0 || f(i, HTMLVideoElement) || await n.reduce((o, a) => o.then(() => A(a, e)).then((l) => {
|
|
956
973
|
l && t.appendChild(l);
|
|
957
974
|
}), Promise.resolve()), t;
|
|
958
975
|
}
|
|
959
|
-
function
|
|
976
|
+
function be(i, t, e) {
|
|
960
977
|
const r = t.style;
|
|
961
978
|
if (!r)
|
|
962
979
|
return;
|
|
963
980
|
const s = window.getComputedStyle(i);
|
|
964
|
-
s.cssText ? (r.cssText = s.cssText, r.transformOrigin = s.transformOrigin) :
|
|
981
|
+
s.cssText ? (r.cssText = s.cssText, r.transformOrigin = s.transformOrigin) : lt(e).forEach((n) => {
|
|
965
982
|
let o = s.getPropertyValue(n);
|
|
966
|
-
n === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`),
|
|
983
|
+
n === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), f(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));
|
|
967
984
|
});
|
|
968
985
|
}
|
|
969
|
-
function
|
|
970
|
-
|
|
986
|
+
function ge(i, t) {
|
|
987
|
+
f(i, HTMLTextAreaElement) && (t.innerHTML = i.value), f(i, HTMLInputElement) && t.setAttribute("value", i.value);
|
|
971
988
|
}
|
|
972
|
-
function
|
|
973
|
-
if (
|
|
989
|
+
function ye(i, t) {
|
|
990
|
+
if (f(i, HTMLSelectElement)) {
|
|
974
991
|
const e = t, r = Array.from(e.children).find((s) => i.value === s.getAttribute("value"));
|
|
975
992
|
r && r.setAttribute("selected", "");
|
|
976
993
|
}
|
|
977
994
|
}
|
|
978
|
-
function
|
|
979
|
-
return
|
|
995
|
+
function we(i, t, e) {
|
|
996
|
+
return f(t, Element) && (be(i, t, e), se(i, t, e), ge(i, t), ye(i, t)), t;
|
|
980
997
|
}
|
|
981
|
-
async function
|
|
998
|
+
async function xe(i, t) {
|
|
982
999
|
const e = i.querySelectorAll ? i.querySelectorAll("use") : [];
|
|
983
1000
|
if (e.length === 0)
|
|
984
1001
|
return i;
|
|
@@ -987,7 +1004,7 @@ async function ge(i, t) {
|
|
|
987
1004
|
const a = e[n].getAttribute("xlink:href");
|
|
988
1005
|
if (a) {
|
|
989
1006
|
const l = i.querySelector(a), c = document.querySelector(a);
|
|
990
|
-
!l && c && !r[a] && (r[a] = await
|
|
1007
|
+
!l && c && !r[a] && (r[a] = await A(c, t, !0));
|
|
991
1008
|
}
|
|
992
1009
|
}
|
|
993
1010
|
const s = Object.values(r);
|
|
@@ -1002,31 +1019,31 @@ async function ge(i, t) {
|
|
|
1002
1019
|
}
|
|
1003
1020
|
return i;
|
|
1004
1021
|
}
|
|
1005
|
-
async function
|
|
1006
|
-
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) =>
|
|
1022
|
+
async function A(i, t, e) {
|
|
1023
|
+
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) => me(r, t)).then((r) => pe(i, r, t)).then((r) => we(i, r, t)).then((r) => xe(r, t));
|
|
1007
1024
|
}
|
|
1008
|
-
const
|
|
1009
|
-
function
|
|
1025
|
+
const ut = /url\((['"]?)([^'"]+?)\1\)/g, ve = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ke = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
1026
|
+
function Se(i) {
|
|
1010
1027
|
const t = i.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
1011
1028
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
1012
1029
|
}
|
|
1013
|
-
function
|
|
1030
|
+
function Ee(i) {
|
|
1014
1031
|
const t = [];
|
|
1015
|
-
return i.replace(
|
|
1032
|
+
return i.replace(ut, (e, r, s) => (t.push(s), e)), t.filter((e) => !I(e));
|
|
1016
1033
|
}
|
|
1017
|
-
async function
|
|
1034
|
+
async function Ce(i, t, e, r, s) {
|
|
1018
1035
|
try {
|
|
1019
|
-
const n = e ?
|
|
1036
|
+
const n = e ? Yt(t, e) : t, o = U(t);
|
|
1020
1037
|
let a;
|
|
1021
|
-
return s || (a = await
|
|
1038
|
+
return s || (a = await O(n, o, r)), i.replace(Se(t), `$1${a}$3`);
|
|
1022
1039
|
} catch {
|
|
1023
1040
|
}
|
|
1024
1041
|
return i;
|
|
1025
1042
|
}
|
|
1026
|
-
function
|
|
1027
|
-
return t ? i.replace(
|
|
1043
|
+
function _e(i, { preferredFontFormat: t }) {
|
|
1044
|
+
return t ? i.replace(ke, (e) => {
|
|
1028
1045
|
for (; ; ) {
|
|
1029
|
-
const [r, , s] =
|
|
1046
|
+
const [r, , s] = ve.exec(e) || [];
|
|
1030
1047
|
if (!s)
|
|
1031
1048
|
return "";
|
|
1032
1049
|
if (s === t)
|
|
@@ -1034,32 +1051,32 @@ function Se(i, { preferredFontFormat: t }) {
|
|
|
1034
1051
|
}
|
|
1035
1052
|
}) : i;
|
|
1036
1053
|
}
|
|
1037
|
-
function
|
|
1038
|
-
return i.search(
|
|
1054
|
+
function mt(i) {
|
|
1055
|
+
return i.search(ut) !== -1;
|
|
1039
1056
|
}
|
|
1040
|
-
async function
|
|
1041
|
-
if (!
|
|
1057
|
+
async function ft(i, t, e) {
|
|
1058
|
+
if (!mt(i))
|
|
1042
1059
|
return i;
|
|
1043
|
-
const r =
|
|
1044
|
-
return
|
|
1060
|
+
const r = _e(i, e);
|
|
1061
|
+
return Ee(r).reduce((n, o) => n.then((a) => Ce(a, o, t, e)), Promise.resolve(r));
|
|
1045
1062
|
}
|
|
1046
|
-
async function
|
|
1063
|
+
async function k(i, t, e) {
|
|
1047
1064
|
var r;
|
|
1048
1065
|
const s = (r = t.style) === null || r === void 0 ? void 0 : r.getPropertyValue(i);
|
|
1049
1066
|
if (s) {
|
|
1050
|
-
const n = await
|
|
1067
|
+
const n = await ft(s, null, e);
|
|
1051
1068
|
return t.style.setProperty(i, n, t.style.getPropertyPriority(i)), !0;
|
|
1052
1069
|
}
|
|
1053
1070
|
return !1;
|
|
1054
1071
|
}
|
|
1055
|
-
async function
|
|
1056
|
-
await
|
|
1072
|
+
async function Te(i, t) {
|
|
1073
|
+
await k("background", i, t) || await k("background-image", i, t), await k("mask", i, t) || await k("-webkit-mask", i, t) || await k("mask-image", i, t) || await k("-webkit-mask-image", i, t);
|
|
1057
1074
|
}
|
|
1058
|
-
async function
|
|
1059
|
-
const e =
|
|
1060
|
-
if (!(e && !
|
|
1075
|
+
async function Le(i, t) {
|
|
1076
|
+
const e = f(i, HTMLImageElement);
|
|
1077
|
+
if (!(e && !I(i.src)) && !(f(i, SVGImageElement) && !I(i.href.baseVal)))
|
|
1061
1078
|
return;
|
|
1062
|
-
const r = e ? i.src : i.href.baseVal, s = await
|
|
1079
|
+
const r = e ? i.src : i.href.baseVal, s = await O(r, U(r), t);
|
|
1063
1080
|
await new Promise((n, o) => {
|
|
1064
1081
|
i.onload = n, i.onerror = t.onImageErrorHandler ? (...l) => {
|
|
1065
1082
|
try {
|
|
@@ -1072,14 +1089,14 @@ async function Ce(i, t) {
|
|
|
1072
1089
|
a.decode && (a.decode = n), a.loading === "lazy" && (a.loading = "eager"), e ? (i.srcset = "", i.src = s) : i.href.baseVal = s;
|
|
1073
1090
|
});
|
|
1074
1091
|
}
|
|
1075
|
-
async function
|
|
1076
|
-
const r =
|
|
1092
|
+
async function Me(i, t) {
|
|
1093
|
+
const r = x(i.childNodes).map((s) => pt(s, t));
|
|
1077
1094
|
await Promise.all(r).then(() => i);
|
|
1078
1095
|
}
|
|
1079
|
-
async function
|
|
1080
|
-
|
|
1096
|
+
async function pt(i, t) {
|
|
1097
|
+
f(i, Element) && (await Te(i, t), await Le(i, t), await Me(i, t));
|
|
1081
1098
|
}
|
|
1082
|
-
function
|
|
1099
|
+
function Pe(i, t) {
|
|
1083
1100
|
const { style: e } = i;
|
|
1084
1101
|
t.backgroundColor && (e.backgroundColor = t.backgroundColor), t.width && (e.width = `${t.width}px`), t.height && (e.height = `${t.height}px`);
|
|
1085
1102
|
const r = t.style;
|
|
@@ -1087,23 +1104,23 @@ function Te(i, t) {
|
|
|
1087
1104
|
e[s] = r[s];
|
|
1088
1105
|
}), i;
|
|
1089
1106
|
}
|
|
1090
|
-
const
|
|
1091
|
-
async function
|
|
1092
|
-
let t =
|
|
1107
|
+
const Y = {};
|
|
1108
|
+
async function K(i) {
|
|
1109
|
+
let t = Y[i];
|
|
1093
1110
|
if (t != null)
|
|
1094
1111
|
return t;
|
|
1095
1112
|
const r = await (await fetch(i)).text();
|
|
1096
|
-
return t = { url: i, cssText: r },
|
|
1113
|
+
return t = { url: i, cssText: r }, Y[i] = t, t;
|
|
1097
1114
|
}
|
|
1098
|
-
async function
|
|
1115
|
+
async function X(i, t) {
|
|
1099
1116
|
let e = i.cssText;
|
|
1100
1117
|
const r = /url\(["']?([^"')]+)["']?\)/g, n = (e.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
1101
1118
|
let a = o.replace(r, "$1");
|
|
1102
|
-
return a.startsWith("https://") || (a = new URL(a, i.url).href),
|
|
1119
|
+
return a.startsWith("https://") || (a = new URL(a, i.url).href), dt(a, t.fetchRequestInit, ({ result: l }) => (e = e.replace(o, `url(${l})`), [o, l]));
|
|
1103
1120
|
});
|
|
1104
1121
|
return Promise.all(n).then(() => e);
|
|
1105
1122
|
}
|
|
1106
|
-
function
|
|
1123
|
+
function G(i) {
|
|
1107
1124
|
if (i == null)
|
|
1108
1125
|
return [];
|
|
1109
1126
|
const t = [], e = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -1129,21 +1146,21 @@ function Y(i) {
|
|
|
1129
1146
|
}
|
|
1130
1147
|
return t;
|
|
1131
1148
|
}
|
|
1132
|
-
async function
|
|
1149
|
+
async function Re(i, t) {
|
|
1133
1150
|
const e = [], r = [];
|
|
1134
1151
|
return i.forEach((s) => {
|
|
1135
1152
|
if ("cssRules" in s)
|
|
1136
1153
|
try {
|
|
1137
|
-
|
|
1154
|
+
x(s.cssRules || []).forEach((n, o) => {
|
|
1138
1155
|
if (n.type === CSSRule.IMPORT_RULE) {
|
|
1139
1156
|
let a = o + 1;
|
|
1140
|
-
const l = n.href, c =
|
|
1157
|
+
const l = n.href, c = K(l).then((h) => X(h, t)).then((h) => G(h).forEach((u) => {
|
|
1141
1158
|
try {
|
|
1142
1159
|
s.insertRule(u, u.startsWith("@import") ? a += 1 : s.cssRules.length);
|
|
1143
|
-
} catch (
|
|
1160
|
+
} catch (m) {
|
|
1144
1161
|
console.error("Error inserting rule from remote css", {
|
|
1145
1162
|
rule: u,
|
|
1146
|
-
error:
|
|
1163
|
+
error: m
|
|
1147
1164
|
});
|
|
1148
1165
|
}
|
|
1149
1166
|
})).catch((h) => {
|
|
@@ -1154,7 +1171,7 @@ async function Le(i, t) {
|
|
|
1154
1171
|
});
|
|
1155
1172
|
} catch (n) {
|
|
1156
1173
|
const o = i.find((a) => a.href == null) || document.styleSheets[0];
|
|
1157
|
-
s.href != null && r.push(
|
|
1174
|
+
s.href != null && r.push(K(s.href).then((a) => X(a, t)).then((a) => G(a).forEach((l) => {
|
|
1158
1175
|
o.insertRule(l, o.cssRules.length);
|
|
1159
1176
|
})).catch((a) => {
|
|
1160
1177
|
console.error("Error loading remote stylesheet", a);
|
|
@@ -1163,7 +1180,7 @@ async function Le(i, t) {
|
|
|
1163
1180
|
}), Promise.all(r).then(() => (i.forEach((s) => {
|
|
1164
1181
|
if ("cssRules" in s)
|
|
1165
1182
|
try {
|
|
1166
|
-
|
|
1183
|
+
x(s.cssRules || []).forEach((n) => {
|
|
1167
1184
|
e.push(n);
|
|
1168
1185
|
});
|
|
1169
1186
|
} catch (n) {
|
|
@@ -1171,58 +1188,58 @@ async function Le(i, t) {
|
|
|
1171
1188
|
}
|
|
1172
1189
|
}), e));
|
|
1173
1190
|
}
|
|
1174
|
-
function
|
|
1175
|
-
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) =>
|
|
1191
|
+
function De(i) {
|
|
1192
|
+
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => mt(t.style.getPropertyValue("src")));
|
|
1176
1193
|
}
|
|
1177
|
-
async function
|
|
1194
|
+
async function Ae(i, t) {
|
|
1178
1195
|
if (i.ownerDocument == null)
|
|
1179
1196
|
throw new Error("Provided element is not within a Document");
|
|
1180
|
-
const e =
|
|
1181
|
-
return
|
|
1197
|
+
const e = x(i.ownerDocument.styleSheets), r = await Re(e, t);
|
|
1198
|
+
return De(r);
|
|
1182
1199
|
}
|
|
1183
|
-
function
|
|
1200
|
+
function bt(i) {
|
|
1184
1201
|
return i.trim().replace(/["']/g, "");
|
|
1185
1202
|
}
|
|
1186
|
-
function
|
|
1203
|
+
function He(i) {
|
|
1187
1204
|
const t = /* @__PURE__ */ new Set();
|
|
1188
1205
|
function e(r) {
|
|
1189
1206
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((n) => {
|
|
1190
|
-
t.add(
|
|
1207
|
+
t.add(bt(n));
|
|
1191
1208
|
}), Array.from(r.children).forEach((n) => {
|
|
1192
1209
|
n instanceof HTMLElement && e(n);
|
|
1193
1210
|
});
|
|
1194
1211
|
}
|
|
1195
1212
|
return e(i), t;
|
|
1196
1213
|
}
|
|
1197
|
-
async function
|
|
1198
|
-
const e = await
|
|
1199
|
-
return (await Promise.all(e.filter((n) => r.has(
|
|
1214
|
+
async function Ie(i, t) {
|
|
1215
|
+
const e = await Ae(i, t), r = He(i);
|
|
1216
|
+
return (await Promise.all(e.filter((n) => r.has(bt(n.style.fontFamily))).map((n) => {
|
|
1200
1217
|
const o = n.parentStyleSheet ? n.parentStyleSheet.href : null;
|
|
1201
|
-
return
|
|
1218
|
+
return ft(n.cssText, o, t);
|
|
1202
1219
|
}))).join(`
|
|
1203
1220
|
`);
|
|
1204
1221
|
}
|
|
1205
|
-
async function
|
|
1206
|
-
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await
|
|
1222
|
+
async function $e(i, t) {
|
|
1223
|
+
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await Ie(i, t);
|
|
1207
1224
|
if (e) {
|
|
1208
1225
|
const r = document.createElement("style"), s = document.createTextNode(e);
|
|
1209
1226
|
r.appendChild(s), i.firstChild ? i.insertBefore(r, i.firstChild) : i.appendChild(r);
|
|
1210
1227
|
}
|
|
1211
1228
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
const { width: e, height: r } =
|
|
1214
|
-
return await
|
|
1229
|
+
async function Be(i, t = {}) {
|
|
1230
|
+
const { width: e, height: r } = ct(i, t), s = await A(i, t, !0);
|
|
1231
|
+
return await $e(s, t), await pt(s, t), Pe(s, t), await te(s, e, r);
|
|
1215
1232
|
}
|
|
1216
|
-
async function
|
|
1217
|
-
const { width: e, height: r } =
|
|
1218
|
-
return o.width = c * l, o.height = h * l, t.skipAutoScale ||
|
|
1233
|
+
async function Fe(i, t = {}) {
|
|
1234
|
+
const { width: e, height: r } = ct(i, t), s = await Be(i, t), n = await P(s), o = document.createElement("canvas"), a = o.getContext("2d"), l = t.pixelRatio || Jt(), c = t.canvasWidth || e, h = t.canvasHeight || r;
|
|
1235
|
+
return o.width = c * l, o.height = h * l, t.skipAutoScale || Qt(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;
|
|
1219
1236
|
}
|
|
1220
|
-
async function
|
|
1221
|
-
return (await
|
|
1237
|
+
async function Ue(i, t = {}) {
|
|
1238
|
+
return (await Fe(i, t)).toDataURL("image/jpeg", t.quality || 1);
|
|
1222
1239
|
}
|
|
1223
|
-
async function
|
|
1240
|
+
async function Oe(i = []) {
|
|
1224
1241
|
try {
|
|
1225
|
-
const t = await
|
|
1242
|
+
const t = await Ue(document.body, {
|
|
1226
1243
|
quality: 0.85,
|
|
1227
1244
|
pixelRatio: 1,
|
|
1228
1245
|
backgroundColor: "#ffffff",
|
|
@@ -1231,29 +1248,29 @@ async function Be(i = []) {
|
|
|
1231
1248
|
filter: (e) => !(e instanceof HTMLElement && e.id === "mtb-widget-host")
|
|
1232
1249
|
});
|
|
1233
1250
|
if (i.length > 0) {
|
|
1234
|
-
const e = await
|
|
1251
|
+
const e = await ze(t, i);
|
|
1235
1252
|
if (e) return e;
|
|
1236
1253
|
}
|
|
1237
|
-
return
|
|
1254
|
+
return Ye(t);
|
|
1238
1255
|
} catch {
|
|
1239
1256
|
return null;
|
|
1240
1257
|
}
|
|
1241
1258
|
}
|
|
1242
|
-
async function
|
|
1259
|
+
async function ze(i, t) {
|
|
1243
1260
|
const e = document.createElement("canvas"), r = e.getContext("2d");
|
|
1244
1261
|
if (!r) return null;
|
|
1245
|
-
const s = await
|
|
1262
|
+
const s = await We(i);
|
|
1246
1263
|
if (!s) return null;
|
|
1247
1264
|
e.width = s.naturalWidth || window.innerWidth, e.height = s.naturalHeight || window.innerHeight, r.drawImage(s, 0, 0);
|
|
1248
1265
|
const n = e.width / window.innerWidth, o = e.height / window.innerHeight;
|
|
1249
1266
|
let a = 0;
|
|
1250
1267
|
for (const l of t)
|
|
1251
|
-
l.type === "draw" && l.drawPath ?
|
|
1252
|
-
return
|
|
1268
|
+
l.type === "draw" && l.drawPath ? je(r, l.drawPath, n, o) : l.type === "pin" && qe(r, l.x * n, l.y * o, ++a);
|
|
1269
|
+
return Ve(e);
|
|
1253
1270
|
}
|
|
1254
|
-
function
|
|
1255
|
-
i.save(), i.strokeStyle =
|
|
1256
|
-
for (const s of
|
|
1271
|
+
function je(i, t, e, r) {
|
|
1272
|
+
i.save(), i.strokeStyle = D, i.lineWidth = 3.5, i.lineCap = "round", i.lineJoin = "round", i.shadowColor = "rgba(5,150,105,0.35)", i.shadowOffsetY = 1, i.shadowBlur = 2;
|
|
1273
|
+
for (const s of Ne(t))
|
|
1257
1274
|
if (s.length !== 0) {
|
|
1258
1275
|
i.beginPath(), i.moveTo(s[0][0] * e, s[0][1] * r);
|
|
1259
1276
|
for (let n = 1; n < s.length; n++) i.lineTo(s[n][0] * e, s[n][1] * r);
|
|
@@ -1261,10 +1278,10 @@ function Ue(i, t, e, r) {
|
|
|
1261
1278
|
}
|
|
1262
1279
|
i.restore();
|
|
1263
1280
|
}
|
|
1264
|
-
function
|
|
1265
|
-
i.save(), i.shadowColor = "rgba(5,150,105,0.45)", i.shadowOffsetY = 2, i.shadowBlur = 8, i.fillStyle =
|
|
1281
|
+
function qe(i, t, e, r) {
|
|
1282
|
+
i.save(), i.shadowColor = "rgba(5,150,105,0.45)", i.shadowOffsetY = 2, i.shadowBlur = 8, i.fillStyle = D, i.beginPath(), i.arc(t, e, 11, 0, Math.PI * 2), i.fill(), i.shadowColor = "transparent", i.lineWidth = 2, i.strokeStyle = "#ffffff", i.stroke(), i.fillStyle = "#ffffff", i.font = `700 10px ${Rt}`, i.textAlign = "center", i.textBaseline = "middle", i.fillText(String(r), t, e), i.restore();
|
|
1266
1283
|
}
|
|
1267
|
-
function
|
|
1284
|
+
function Ne(i) {
|
|
1268
1285
|
const t = [];
|
|
1269
1286
|
let e = null;
|
|
1270
1287
|
const r = i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g) ?? [];
|
|
@@ -1274,13 +1291,13 @@ function ze(i) {
|
|
|
1274
1291
|
}
|
|
1275
1292
|
return t;
|
|
1276
1293
|
}
|
|
1277
|
-
function
|
|
1294
|
+
function We(i) {
|
|
1278
1295
|
return new Promise((t) => {
|
|
1279
1296
|
const e = new Image();
|
|
1280
1297
|
e.onload = () => t(e), e.onerror = () => t(null), e.src = i;
|
|
1281
1298
|
});
|
|
1282
1299
|
}
|
|
1283
|
-
function
|
|
1300
|
+
function Ve(i) {
|
|
1284
1301
|
return new Promise((t) => {
|
|
1285
1302
|
try {
|
|
1286
1303
|
i.toBlob((e) => t(e), "image/jpeg", 0.85);
|
|
@@ -1289,13 +1306,13 @@ function qe(i) {
|
|
|
1289
1306
|
}
|
|
1290
1307
|
});
|
|
1291
1308
|
}
|
|
1292
|
-
function
|
|
1309
|
+
function Ye(i) {
|
|
1293
1310
|
const [t, e] = i.split(","), r = t.match(/:(.*?);/)?.[1] ?? "image/png", s = atob(e), n = new Uint8Array(s.length);
|
|
1294
1311
|
for (let o = 0; o < s.length; o++)
|
|
1295
1312
|
n[o] = s.charCodeAt(o);
|
|
1296
1313
|
return new Blob([n], { type: r });
|
|
1297
1314
|
}
|
|
1298
|
-
class
|
|
1315
|
+
class Ke {
|
|
1299
1316
|
constructor() {
|
|
1300
1317
|
this.listeners = /* @__PURE__ */ new Set(), this.originalOnError = null, this.installedOnError = null, this.rejectionHandler = null, this.hooked = !1;
|
|
1301
1318
|
}
|
|
@@ -1317,20 +1334,20 @@ class We {
|
|
|
1317
1334
|
for (const e of this.listeners) e(t);
|
|
1318
1335
|
}
|
|
1319
1336
|
}
|
|
1320
|
-
const
|
|
1321
|
-
class
|
|
1337
|
+
const z = new Ke(), Xe = 20;
|
|
1338
|
+
class Ge {
|
|
1322
1339
|
constructor() {
|
|
1323
1340
|
this.errors = [], this.unsubscribe = null;
|
|
1324
1341
|
}
|
|
1325
1342
|
start() {
|
|
1326
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1343
|
+
this.unsubscribe || (this.unsubscribe = z.subscribe((t) => this.record(t)));
|
|
1327
1344
|
}
|
|
1328
1345
|
record(t) {
|
|
1329
1346
|
const e = t.line != null ? ` (${t.line}:${t.col ?? 0})` : "";
|
|
1330
1347
|
this.addError(`${t.message}${e}`);
|
|
1331
1348
|
}
|
|
1332
1349
|
addError(t) {
|
|
1333
|
-
this.errors.length >=
|
|
1350
|
+
this.errors.length >= Xe || this.errors.includes(t) || this.errors.push(t);
|
|
1334
1351
|
}
|
|
1335
1352
|
getErrors() {
|
|
1336
1353
|
return [...this.errors];
|
|
@@ -1339,13 +1356,13 @@ class Ye {
|
|
|
1339
1356
|
this.unsubscribe?.(), this.unsubscribe = null;
|
|
1340
1357
|
}
|
|
1341
1358
|
}
|
|
1342
|
-
const
|
|
1343
|
-
class
|
|
1359
|
+
const Je = 20;
|
|
1360
|
+
class Qe {
|
|
1344
1361
|
constructor() {
|
|
1345
1362
|
this.breadcrumbs = [], this.active = !1, this.unsubscribeErrors = null, this.boundPopstateHandler = null, this.originalPushState = null, this.originalReplaceState = null, this.installedPushState = null, this.installedReplaceState = null, this.lastUrl = "", this.boundClickHandler = (t) => this.handleClick(t), this.boundChangeHandler = (t) => this.handleChange(t);
|
|
1346
1363
|
}
|
|
1347
1364
|
start() {
|
|
1348
|
-
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors =
|
|
1365
|
+
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors = z.subscribe((t) => this.recordError(t)), this.startNavigationTracking());
|
|
1349
1366
|
}
|
|
1350
1367
|
stop() {
|
|
1351
1368
|
this.active && (this.active = !1, document.removeEventListener("click", this.boundClickHandler, !0), document.removeEventListener("change", this.boundChangeHandler, !0), this.unsubscribeErrors?.(), this.unsubscribeErrors = null, this.stopNavigationTracking());
|
|
@@ -1354,25 +1371,25 @@ class Xe {
|
|
|
1354
1371
|
return [...this.breadcrumbs];
|
|
1355
1372
|
}
|
|
1356
1373
|
add(t) {
|
|
1357
|
-
this.breadcrumbs.push(t), this.breadcrumbs.length >
|
|
1374
|
+
this.breadcrumbs.push(t), this.breadcrumbs.length > Je && this.breadcrumbs.shift();
|
|
1358
1375
|
}
|
|
1359
1376
|
handleClick(t) {
|
|
1360
1377
|
const e = t.target;
|
|
1361
|
-
if (e && !
|
|
1378
|
+
if (e && !_(e))
|
|
1362
1379
|
try {
|
|
1363
1380
|
this.add({
|
|
1364
1381
|
type: "ui",
|
|
1365
1382
|
category: "ui.click",
|
|
1366
1383
|
timestamp: Date.now(),
|
|
1367
|
-
message:
|
|
1368
|
-
data: { selector:
|
|
1384
|
+
message: F(e),
|
|
1385
|
+
data: { selector: at(e) }
|
|
1369
1386
|
});
|
|
1370
1387
|
} catch {
|
|
1371
1388
|
}
|
|
1372
1389
|
}
|
|
1373
1390
|
handleChange(t) {
|
|
1374
1391
|
const e = t.target;
|
|
1375
|
-
if (e && !
|
|
1392
|
+
if (e && !_(e))
|
|
1376
1393
|
try {
|
|
1377
1394
|
const r = e, s = r.name || r.placeholder || e.getAttribute("aria-label") || e.tagName;
|
|
1378
1395
|
this.add({
|
|
@@ -1418,7 +1435,7 @@ class Xe {
|
|
|
1418
1435
|
}));
|
|
1419
1436
|
}
|
|
1420
1437
|
}
|
|
1421
|
-
const
|
|
1438
|
+
const Ze = 3, ti = 1e3, ei = 3, ii = 5e3, J = 500, ri = 500, si = 300, ni = /* @__PURE__ */ new Set([
|
|
1422
1439
|
"A",
|
|
1423
1440
|
"BUTTON",
|
|
1424
1441
|
"INPUT",
|
|
@@ -1427,7 +1444,7 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1427
1444
|
"LABEL",
|
|
1428
1445
|
"SUMMARY",
|
|
1429
1446
|
"DETAILS"
|
|
1430
|
-
]),
|
|
1447
|
+
]), oi = /* @__PURE__ */ new Set([
|
|
1431
1448
|
"button",
|
|
1432
1449
|
"link",
|
|
1433
1450
|
"checkbox",
|
|
@@ -1441,19 +1458,19 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1441
1458
|
"listbox",
|
|
1442
1459
|
"slider",
|
|
1443
1460
|
"spinbutton"
|
|
1444
|
-
]),
|
|
1461
|
+
]), Q = [
|
|
1445
1462
|
"404",
|
|
1446
1463
|
"500",
|
|
1447
1464
|
"not found",
|
|
1448
1465
|
"page not found",
|
|
1449
1466
|
"server error",
|
|
1450
1467
|
"internal server error"
|
|
1451
|
-
],
|
|
1468
|
+
], T = class T {
|
|
1452
1469
|
constructor(t) {
|
|
1453
1470
|
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.recentSubmitForms = /* @__PURE__ */ new WeakSet(), this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.onFrustration = t, this.boundClickHandler = (e) => this.handleClick(e);
|
|
1454
1471
|
}
|
|
1455
1472
|
start() {
|
|
1456
|
-
this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors =
|
|
1473
|
+
this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = z.subscribe((t) => {
|
|
1457
1474
|
this.errorCount++;
|
|
1458
1475
|
}), this.startNavigationTracking(), this.startFormTracking(), this.checkErrorPage());
|
|
1459
1476
|
}
|
|
@@ -1480,54 +1497,54 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1480
1497
|
}
|
|
1481
1498
|
handleClick(t) {
|
|
1482
1499
|
const e = t.target;
|
|
1483
|
-
if (!e ||
|
|
1500
|
+
if (!e || _(e)) return;
|
|
1484
1501
|
const r = Date.now();
|
|
1485
1502
|
this.clickHistory.push({ target: e, time: r });
|
|
1486
|
-
const s = r -
|
|
1487
|
-
if (this.clickHistory = this.clickHistory.filter((o) => o.time > s), this.clickHistory.filter((o) => o.target === e).length >=
|
|
1503
|
+
const s = r - ti;
|
|
1504
|
+
if (this.clickHistory = this.clickHistory.filter((o) => o.time > s), this.clickHistory.filter((o) => o.target === e).length >= Ze) {
|
|
1488
1505
|
this.clickHistory = [], this.emitHighPriority({
|
|
1489
1506
|
signal: "rage_click",
|
|
1490
|
-
target:
|
|
1507
|
+
target: E(e),
|
|
1491
1508
|
timestamp: r
|
|
1492
1509
|
});
|
|
1493
1510
|
return;
|
|
1494
1511
|
}
|
|
1495
1512
|
this.isInteractive(e) || (this.deadClickCount++, this.deadClickCount >= 3 && this.errorCount > 0 && (this.deadClickCount = 0, this.errorCount = 0, this.emitIfReady({
|
|
1496
1513
|
signal: "dead_click",
|
|
1497
|
-
target:
|
|
1514
|
+
target: E(e),
|
|
1498
1515
|
timestamp: r
|
|
1499
1516
|
}))), this.checkDeadClickDom(e, r);
|
|
1500
1517
|
}
|
|
1501
1518
|
handleNavigation() {
|
|
1502
1519
|
const t = Date.now();
|
|
1503
1520
|
this.navTimestamps.push(t);
|
|
1504
|
-
const e = t -
|
|
1505
|
-
this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >=
|
|
1521
|
+
const e = t - ii;
|
|
1522
|
+
this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >= ei && (this.navTimestamps = [], this.emitIfReady({
|
|
1506
1523
|
signal: "rapid_navigation",
|
|
1507
1524
|
timestamp: t
|
|
1508
1525
|
})), setTimeout(() => {
|
|
1509
1526
|
this.active && this.checkErrorPage();
|
|
1510
|
-
},
|
|
1527
|
+
}, si);
|
|
1511
1528
|
}
|
|
1512
1529
|
handleFormSubmit(t) {
|
|
1513
1530
|
const e = t.target;
|
|
1514
|
-
e instanceof HTMLFormElement && (
|
|
1531
|
+
e instanceof HTMLFormElement && (_(e) || (this.recentSubmitForms.add(e), setTimeout(() => {
|
|
1515
1532
|
this.recentSubmitForms.delete(e);
|
|
1516
|
-
},
|
|
1533
|
+
}, J), setTimeout(() => {
|
|
1517
1534
|
this.active && e.querySelector('[aria-invalid="true"], .is-invalid') && this.emitIfReady({
|
|
1518
1535
|
signal: "form_failure",
|
|
1519
|
-
target:
|
|
1536
|
+
target: E(e),
|
|
1520
1537
|
timestamp: Date.now()
|
|
1521
1538
|
});
|
|
1522
|
-
},
|
|
1539
|
+
}, J)));
|
|
1523
1540
|
}
|
|
1524
1541
|
handleFormInvalid(t) {
|
|
1525
1542
|
const e = t.target;
|
|
1526
|
-
if (!e ||
|
|
1543
|
+
if (!e || _(e)) return;
|
|
1527
1544
|
const r = e.closest("form");
|
|
1528
1545
|
!r || !this.recentSubmitForms.has(r) || this.emitIfReady({
|
|
1529
1546
|
signal: "form_failure",
|
|
1530
|
-
target:
|
|
1547
|
+
target: E(r),
|
|
1531
1548
|
timestamp: Date.now()
|
|
1532
1549
|
});
|
|
1533
1550
|
}
|
|
@@ -1535,7 +1552,7 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1535
1552
|
const t = location.href;
|
|
1536
1553
|
if (this.errorPageUrls.has(t)) return;
|
|
1537
1554
|
const e = document.title.toLowerCase();
|
|
1538
|
-
if (
|
|
1555
|
+
if (Q.some((s) => e.includes(s))) {
|
|
1539
1556
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1540
1557
|
signal: "error_page",
|
|
1541
1558
|
detail: document.title,
|
|
@@ -1548,7 +1565,7 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1548
1565
|
);
|
|
1549
1566
|
for (const s of r) {
|
|
1550
1567
|
const n = s.textContent ?? "";
|
|
1551
|
-
if (n.length < 200 &&
|
|
1568
|
+
if (n.length < 200 && Q.some((o) => n.toLowerCase().includes(o))) {
|
|
1552
1569
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1553
1570
|
signal: "error_page",
|
|
1554
1571
|
detail: n.trim().slice(0, 60),
|
|
@@ -1567,10 +1584,10 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1567
1584
|
const r = this.lastMutationAt >= e;
|
|
1568
1585
|
this.pendingDomChecks === 0 && this.disconnectDomObserver(), !r && this.active && this.emitIfReady({
|
|
1569
1586
|
signal: "dead_click_dom",
|
|
1570
|
-
target:
|
|
1587
|
+
target: E(t),
|
|
1571
1588
|
timestamp: e
|
|
1572
1589
|
});
|
|
1573
|
-
},
|
|
1590
|
+
}, ri));
|
|
1574
1591
|
}
|
|
1575
1592
|
ensureDomObserver() {
|
|
1576
1593
|
this.domObserver || (this.domObserver = new MutationObserver(() => {
|
|
@@ -1595,46 +1612,46 @@ const Ge = 3, Je = 1e3, Qe = 3, Ze = 5e3, K = 500, ti = 500, ei = 300, ii = /* @
|
|
|
1595
1612
|
return !1;
|
|
1596
1613
|
}
|
|
1597
1614
|
isInteractive(t) {
|
|
1598
|
-
if (
|
|
1615
|
+
if (ni.has(t.tagName)) return !0;
|
|
1599
1616
|
const e = t.getAttribute("role");
|
|
1600
|
-
return !!(e &&
|
|
1617
|
+
return !!(e && oi.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'));
|
|
1601
1618
|
}
|
|
1602
1619
|
emitIfReady(t) {
|
|
1603
1620
|
const e = Date.now();
|
|
1604
|
-
e < this.cooldownUntil || (this.cooldownUntil = e +
|
|
1621
|
+
e < this.cooldownUntil || (this.cooldownUntil = e + T.COOLDOWN_MS, this.onFrustration(t));
|
|
1605
1622
|
}
|
|
1606
1623
|
emitHighPriority(t) {
|
|
1607
|
-
this.cooldownUntil = Date.now() +
|
|
1624
|
+
this.cooldownUntil = Date.now() + T.COOLDOWN_MS, this.onFrustration(t);
|
|
1608
1625
|
}
|
|
1609
1626
|
};
|
|
1610
|
-
|
|
1611
|
-
let
|
|
1612
|
-
function
|
|
1627
|
+
T.COOLDOWN_MS = 6e4;
|
|
1628
|
+
let $ = T;
|
|
1629
|
+
function E(i) {
|
|
1613
1630
|
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) ?? "";
|
|
1614
1631
|
return `<${t}${e}${r}>${s ? ` "${s}"` : ""}`;
|
|
1615
1632
|
}
|
|
1616
|
-
function
|
|
1633
|
+
function ai() {
|
|
1617
1634
|
return {
|
|
1618
1635
|
page_url: window.location.href,
|
|
1619
1636
|
user_agent: navigator.userAgent,
|
|
1620
|
-
browser:
|
|
1621
|
-
os:
|
|
1637
|
+
browser: li(),
|
|
1638
|
+
os: ci(),
|
|
1622
1639
|
screen_width: window.screen.width,
|
|
1623
1640
|
screen_height: window.screen.height
|
|
1624
1641
|
};
|
|
1625
1642
|
}
|
|
1626
|
-
function
|
|
1643
|
+
function li() {
|
|
1627
1644
|
const i = navigator.userAgent;
|
|
1628
1645
|
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";
|
|
1629
1646
|
}
|
|
1630
|
-
function
|
|
1647
|
+
function ci() {
|
|
1631
1648
|
const i = navigator.userAgent;
|
|
1632
1649
|
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";
|
|
1633
1650
|
}
|
|
1634
|
-
const
|
|
1635
|
-
class
|
|
1651
|
+
const di = "https://makethisbetter.dev/api/v1";
|
|
1652
|
+
class hi {
|
|
1636
1653
|
constructor(t, e, r = 1e3, s, n) {
|
|
1637
|
-
this.projectKey = t, this.apiUrl = (e ??
|
|
1654
|
+
this.projectKey = t, this.apiUrl = (e ?? di).replace(/\/$/, ""), this.retryDelayMs = r, this.userToken = s, this.userTokenFn = n;
|
|
1638
1655
|
}
|
|
1639
1656
|
async resolveUserToken() {
|
|
1640
1657
|
return this.userTokenFn ? this.userTokenFn() : this.userToken;
|
|
@@ -1648,7 +1665,7 @@ class li {
|
|
|
1648
1665
|
return r["X-Submission-Token"] = t, r;
|
|
1649
1666
|
}
|
|
1650
1667
|
async createSubmissionSession(t, e) {
|
|
1651
|
-
const r =
|
|
1668
|
+
const r = fi(), s = new FormData();
|
|
1652
1669
|
if (s.append("feedback[description]", t.description), s.append("feedback[page_url]", t.page_url), s.append("feedback[user_agent]", t.user_agent), s.append("feedback[browser]", t.browser), s.append("feedback[os]", t.os), s.append("feedback[screen_width]", String(t.screen_width)), s.append("feedback[screen_height]", String(t.screen_height)), s.append("feedback[console_errors]", JSON.stringify(t.console_errors)), s.append("feedback[annotations]", JSON.stringify(t.annotations)), t.target_element && s.append("feedback[target_element]", JSON.stringify(t.target_element)), t.user_id && s.append("feedback[user_id]", t.user_id), t.reporter_external_id && s.append("feedback[reporter_external_id]", t.reporter_external_id), t.reporter_email && s.append("feedback[reporter_email]", t.reporter_email), t.user_email && s.append("feedback[user_email]", t.user_email), t.user_name && s.append("feedback[user_name]", t.user_name), t.breadcrumbs && t.breadcrumbs.length > 0 && s.append("feedback[breadcrumbs]", JSON.stringify(t.breadcrumbs)), t.recording_events && t.recording_events.length > 0) {
|
|
1653
1670
|
const l = JSON.stringify(t.recording_events), c = new Blob([l], { type: "application/json" });
|
|
1654
1671
|
s.append("feedback[recording]", c, "interaction-replay.json"), s.append("feedback[recording_duration]", String(t.recording_duration ?? 0));
|
|
@@ -1658,7 +1675,7 @@ class li {
|
|
|
1658
1675
|
s.append("feedback[screenshot]", e, `screenshot.${l}`);
|
|
1659
1676
|
}
|
|
1660
1677
|
const n = await this.authHeaders();
|
|
1661
|
-
return n["X-Submission-Token"] = r, n["X-Idempotency-Key"] =
|
|
1678
|
+
return n["X-Submission-Token"] = r, n["X-Idempotency-Key"] = mi(), { ...(await (await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions`, {
|
|
1662
1679
|
method: "POST",
|
|
1663
1680
|
headers: n,
|
|
1664
1681
|
body: s
|
|
@@ -1719,7 +1736,7 @@ class li {
|
|
|
1719
1736
|
}), o = n.headers.get("Content-Type") ?? "";
|
|
1720
1737
|
if (!n.ok || !n.body || !o.includes("text/event-stream"))
|
|
1721
1738
|
throw new Error("clarify stream unavailable");
|
|
1722
|
-
return
|
|
1739
|
+
return ui(n.body, r);
|
|
1723
1740
|
}
|
|
1724
1741
|
async finalizeSubmissionSession(t, e) {
|
|
1725
1742
|
const r = await this.submissionHeaders(e);
|
|
@@ -1741,25 +1758,25 @@ class li {
|
|
|
1741
1758
|
s = await fetch(t, e);
|
|
1742
1759
|
} catch (n) {
|
|
1743
1760
|
if (r > 0)
|
|
1744
|
-
return await
|
|
1761
|
+
return await Z(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
1745
1762
|
throw n;
|
|
1746
1763
|
}
|
|
1747
1764
|
if (s.ok) return s;
|
|
1748
1765
|
if (s.status >= 500 && r > 0)
|
|
1749
|
-
return await
|
|
1766
|
+
return await Z(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
1750
1767
|
throw new Error(`HTTP ${s.status}`);
|
|
1751
1768
|
}
|
|
1752
1769
|
}
|
|
1753
|
-
function
|
|
1770
|
+
function Z(i) {
|
|
1754
1771
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
1755
1772
|
}
|
|
1756
|
-
async function
|
|
1773
|
+
async function ui(i, t) {
|
|
1757
1774
|
const e = i.getReader(), r = new TextDecoder();
|
|
1758
1775
|
let s = "", n = { messages: [], done: !0 };
|
|
1759
1776
|
const o = (a) => {
|
|
1760
1777
|
const l = a.split(`
|
|
1761
|
-
`).find((
|
|
1762
|
-
`).find((
|
|
1778
|
+
`).find((m) => m.startsWith("event:")), c = a.split(`
|
|
1779
|
+
`).find((m) => m.startsWith("data:"));
|
|
1763
1780
|
if (!c) return;
|
|
1764
1781
|
const h = l?.slice(6).trim(), u = JSON.parse(c.slice(5).trim());
|
|
1765
1782
|
h === "delta" && typeof u.text == "string" ? t(u.text) : h === "done" && (n = {
|
|
@@ -1785,16 +1802,16 @@ async function ci(i, t) {
|
|
|
1785
1802
|
}
|
|
1786
1803
|
return n;
|
|
1787
1804
|
}
|
|
1788
|
-
function
|
|
1805
|
+
function mi() {
|
|
1789
1806
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
1790
1807
|
}
|
|
1791
|
-
function
|
|
1808
|
+
function fi() {
|
|
1792
1809
|
if (typeof crypto > "u" || typeof crypto.getRandomValues != "function")
|
|
1793
1810
|
throw new Error("Secure random generation is unavailable");
|
|
1794
1811
|
const i = crypto.getRandomValues(new Uint8Array(32));
|
|
1795
1812
|
return Array.from(i, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
1796
1813
|
}
|
|
1797
|
-
function
|
|
1814
|
+
function pi(i, t, e, r, s, n, o, a, l) {
|
|
1798
1815
|
return {
|
|
1799
1816
|
description: i,
|
|
1800
1817
|
...t,
|
|
@@ -1815,50 +1832,50 @@ function ui(i, t, e, r, s, n, o, a, l) {
|
|
|
1815
1832
|
breadcrumbs: l
|
|
1816
1833
|
};
|
|
1817
1834
|
}
|
|
1818
|
-
const
|
|
1819
|
-
let
|
|
1820
|
-
function
|
|
1835
|
+
const tt = "mtb_anon_id", gt = "mtb_reporter_email", yt = "mtb_board_url";
|
|
1836
|
+
let et = null, wt = null, xt = null;
|
|
1837
|
+
function it() {
|
|
1821
1838
|
try {
|
|
1822
|
-
const i = window.localStorage.getItem(
|
|
1839
|
+
const i = window.localStorage.getItem(tt);
|
|
1823
1840
|
if (i?.startsWith("anon_")) return i;
|
|
1824
|
-
const t =
|
|
1825
|
-
return window.localStorage.setItem(
|
|
1841
|
+
const t = nt();
|
|
1842
|
+
return window.localStorage.setItem(tt, t), t;
|
|
1826
1843
|
} catch {
|
|
1827
|
-
return
|
|
1844
|
+
return et ?? (et = nt()), et;
|
|
1828
1845
|
}
|
|
1829
1846
|
}
|
|
1830
|
-
function
|
|
1847
|
+
function rt() {
|
|
1831
1848
|
try {
|
|
1832
|
-
return window.localStorage.getItem(
|
|
1849
|
+
return window.localStorage.getItem(gt) ?? void 0;
|
|
1833
1850
|
} catch {
|
|
1834
|
-
return
|
|
1851
|
+
return wt ?? void 0;
|
|
1835
1852
|
}
|
|
1836
1853
|
}
|
|
1837
|
-
function
|
|
1838
|
-
|
|
1854
|
+
function bi(i) {
|
|
1855
|
+
wt = i;
|
|
1839
1856
|
try {
|
|
1840
|
-
window.localStorage.setItem(
|
|
1857
|
+
window.localStorage.setItem(gt, i);
|
|
1841
1858
|
} catch {
|
|
1842
1859
|
}
|
|
1843
1860
|
}
|
|
1844
|
-
function
|
|
1861
|
+
function gi() {
|
|
1845
1862
|
try {
|
|
1846
|
-
return window.localStorage.getItem(
|
|
1863
|
+
return window.localStorage.getItem(yt) ?? void 0;
|
|
1847
1864
|
} catch {
|
|
1848
|
-
return
|
|
1865
|
+
return xt ?? void 0;
|
|
1849
1866
|
}
|
|
1850
1867
|
}
|
|
1851
|
-
function
|
|
1852
|
-
|
|
1868
|
+
function st(i) {
|
|
1869
|
+
xt = i;
|
|
1853
1870
|
try {
|
|
1854
|
-
window.localStorage.setItem(
|
|
1871
|
+
window.localStorage.setItem(yt, i);
|
|
1855
1872
|
} catch {
|
|
1856
1873
|
}
|
|
1857
1874
|
}
|
|
1858
|
-
function
|
|
1875
|
+
function nt() {
|
|
1859
1876
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
|
|
1860
1877
|
}
|
|
1861
|
-
const
|
|
1878
|
+
const yi = {
|
|
1862
1879
|
tab: "Feedback",
|
|
1863
1880
|
toolbar: {
|
|
1864
1881
|
markup: "Mark up",
|
|
@@ -1929,10 +1946,11 @@ const pi = {
|
|
|
1929
1946
|
thinking: "Thinking...",
|
|
1930
1947
|
placeholder: "Type your answer — or skip the question",
|
|
1931
1948
|
send: "Send",
|
|
1949
|
+
send_feedback: "Send feedback",
|
|
1932
1950
|
skip: "Skip & send",
|
|
1933
1951
|
retry: "Retry"
|
|
1934
1952
|
}
|
|
1935
|
-
},
|
|
1953
|
+
}, wi = {
|
|
1936
1954
|
tab: "反馈",
|
|
1937
1955
|
toolbar: {
|
|
1938
1956
|
markup: "标注",
|
|
@@ -2003,10 +2021,11 @@ const pi = {
|
|
|
2003
2021
|
thinking: "思考中...",
|
|
2004
2022
|
placeholder: "输入回答,或跳过问题",
|
|
2005
2023
|
send: "发送",
|
|
2024
|
+
send_feedback: "发送反馈",
|
|
2006
2025
|
skip: "跳过并发送",
|
|
2007
2026
|
retry: "重试"
|
|
2008
2027
|
}
|
|
2009
|
-
},
|
|
2028
|
+
}, xi = {
|
|
2010
2029
|
tab: "フィードバック",
|
|
2011
2030
|
toolbar: {
|
|
2012
2031
|
markup: "マークアップ",
|
|
@@ -2077,10 +2096,11 @@ const pi = {
|
|
|
2077
2096
|
thinking: "考え中...",
|
|
2078
2097
|
placeholder: "回答を入力、または質問をスキップ",
|
|
2079
2098
|
send: "送信",
|
|
2099
|
+
send_feedback: "フィードバックを送信",
|
|
2080
2100
|
skip: "スキップして送信",
|
|
2081
2101
|
retry: "再試行"
|
|
2082
2102
|
}
|
|
2083
|
-
},
|
|
2103
|
+
}, vi = {
|
|
2084
2104
|
tab: "피드백",
|
|
2085
2105
|
toolbar: {
|
|
2086
2106
|
markup: "마크업",
|
|
@@ -2151,10 +2171,11 @@ const pi = {
|
|
|
2151
2171
|
thinking: "생각 중...",
|
|
2152
2172
|
placeholder: "답변을 입력하거나 질문을 건너뛰세요",
|
|
2153
2173
|
send: "보내기",
|
|
2174
|
+
send_feedback: "피드백 보내기",
|
|
2154
2175
|
skip: "건너뛰고 보내기",
|
|
2155
2176
|
retry: "재시도"
|
|
2156
2177
|
}
|
|
2157
|
-
},
|
|
2178
|
+
}, ki = {
|
|
2158
2179
|
tab: "Comentarios",
|
|
2159
2180
|
toolbar: {
|
|
2160
2181
|
markup: "Anotar",
|
|
@@ -2225,10 +2246,11 @@ const pi = {
|
|
|
2225
2246
|
thinking: "Pensando...",
|
|
2226
2247
|
placeholder: "Escribe tu respuesta — u omite la pregunta",
|
|
2227
2248
|
send: "Enviar",
|
|
2249
|
+
send_feedback: "Enviar comentario",
|
|
2228
2250
|
skip: "Omitir y enviar",
|
|
2229
2251
|
retry: "Reintentar"
|
|
2230
2252
|
}
|
|
2231
|
-
},
|
|
2253
|
+
}, Si = {
|
|
2232
2254
|
tab: "Avis",
|
|
2233
2255
|
toolbar: {
|
|
2234
2256
|
markup: "Annoter",
|
|
@@ -2299,10 +2321,11 @@ const pi = {
|
|
|
2299
2321
|
thinking: "Réflexion...",
|
|
2300
2322
|
placeholder: "Saisissez votre réponse — ou ignorez la question",
|
|
2301
2323
|
send: "Envoyer",
|
|
2324
|
+
send_feedback: "Envoyer le retour",
|
|
2302
2325
|
skip: "Ignorer et envoyer",
|
|
2303
2326
|
retry: "Réessayer"
|
|
2304
2327
|
}
|
|
2305
|
-
},
|
|
2328
|
+
}, Ei = {
|
|
2306
2329
|
tab: "Feedback",
|
|
2307
2330
|
toolbar: {
|
|
2308
2331
|
markup: "Markieren",
|
|
@@ -2373,55 +2396,56 @@ const pi = {
|
|
|
2373
2396
|
thinking: "Einen Moment...",
|
|
2374
2397
|
placeholder: "Antwort eingeben — oder Frage überspringen",
|
|
2375
2398
|
send: "Senden",
|
|
2399
|
+
send_feedback: "Feedback senden",
|
|
2376
2400
|
skip: "Überspringen & senden",
|
|
2377
2401
|
retry: "Erneut versuchen"
|
|
2378
2402
|
}
|
|
2379
|
-
},
|
|
2380
|
-
en:
|
|
2381
|
-
"zh-CN":
|
|
2382
|
-
ja:
|
|
2383
|
-
ko:
|
|
2384
|
-
es:
|
|
2385
|
-
fr:
|
|
2386
|
-
de:
|
|
2403
|
+
}, C = {
|
|
2404
|
+
en: yi,
|
|
2405
|
+
"zh-CN": wi,
|
|
2406
|
+
ja: xi,
|
|
2407
|
+
ko: vi,
|
|
2408
|
+
es: ki,
|
|
2409
|
+
fr: Si,
|
|
2410
|
+
de: Ei
|
|
2387
2411
|
};
|
|
2388
|
-
function
|
|
2389
|
-
if (
|
|
2412
|
+
function Ci(i) {
|
|
2413
|
+
if (C[i]) return C[i];
|
|
2390
2414
|
const t = i.split("-")[0];
|
|
2391
|
-
return
|
|
2415
|
+
return C[t] ? C[t] : C.en;
|
|
2392
2416
|
}
|
|
2393
|
-
const
|
|
2394
|
-
let
|
|
2395
|
-
function
|
|
2396
|
-
return
|
|
2417
|
+
const _i = 60, Ti = "https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js", Li = "sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";
|
|
2418
|
+
let L = null;
|
|
2419
|
+
function Mi() {
|
|
2420
|
+
return L || (L = Pi().catch(() => Ri()), L);
|
|
2397
2421
|
}
|
|
2398
|
-
async function
|
|
2422
|
+
async function Pi() {
|
|
2399
2423
|
return (await import("@rrweb/record")).record;
|
|
2400
2424
|
}
|
|
2401
|
-
function
|
|
2425
|
+
function ot() {
|
|
2402
2426
|
const i = globalThis;
|
|
2403
2427
|
return i.rrwebRecord?.record ?? i.rrweb?.record;
|
|
2404
2428
|
}
|
|
2405
|
-
function
|
|
2429
|
+
function Ri() {
|
|
2406
2430
|
return new Promise((i, t) => {
|
|
2407
|
-
const e =
|
|
2431
|
+
const e = ot();
|
|
2408
2432
|
if (e) {
|
|
2409
2433
|
i(e);
|
|
2410
2434
|
return;
|
|
2411
2435
|
}
|
|
2412
2436
|
const r = document.createElement("script");
|
|
2413
|
-
r.src =
|
|
2414
|
-
const s =
|
|
2437
|
+
r.src = Ti, r.integrity = Li, r.crossOrigin = "anonymous", r.onload = () => {
|
|
2438
|
+
const s = ot();
|
|
2415
2439
|
s ? i(s) : t(new Error("rrweb record global not found after script load"));
|
|
2416
2440
|
}, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
|
|
2417
2441
|
});
|
|
2418
2442
|
}
|
|
2419
|
-
class
|
|
2443
|
+
class Di {
|
|
2420
2444
|
constructor(t, e) {
|
|
2421
2445
|
this.events = [], this.stopFn = null, this.startedAt = 0, this.timer = null, this.clickHandler = null, this.stopped = !1, this.shadow = t, this.onMaxReached = e;
|
|
2422
2446
|
}
|
|
2423
2447
|
async start() {
|
|
2424
|
-
const t = await
|
|
2448
|
+
const t = await Mi();
|
|
2425
2449
|
this.startedAt = Date.now(), this.stopped = !1, this.stopFn = t({
|
|
2426
2450
|
emit: (e) => {
|
|
2427
2451
|
this.stopped || this.events.push(e);
|
|
@@ -2434,7 +2458,7 @@ class Mi {
|
|
|
2434
2458
|
});
|
|
2435
2459
|
}, document.addEventListener("click", this.clickHandler, !0), this.timer = setTimeout(() => {
|
|
2436
2460
|
this.onMaxReached?.();
|
|
2437
|
-
},
|
|
2461
|
+
}, _i * 1e3);
|
|
2438
2462
|
}
|
|
2439
2463
|
stop() {
|
|
2440
2464
|
return this.stopped = !0, this.stopFn?.(), this.stopFn = null, this.cleanupTimer(), this.cleanupClickHandler(), {
|
|
@@ -2459,7 +2483,7 @@ class Mi {
|
|
|
2459
2483
|
r.style.left = `${t}px`, r.style.top = `${e}px`, this.shadow.append(r), r.addEventListener("animationend", () => r.remove());
|
|
2460
2484
|
}
|
|
2461
2485
|
}
|
|
2462
|
-
class
|
|
2486
|
+
class Ai {
|
|
2463
2487
|
constructor(t, e, r, s) {
|
|
2464
2488
|
this.intervalId = null, this.getDuration = r, this.el = t.el("div", "mtb-record-bar"), this.el.innerHTML = `
|
|
2465
2489
|
<span class="mtb-record-dot"></span>
|
|
@@ -2475,12 +2499,12 @@ class Pi {
|
|
|
2475
2499
|
this.intervalId && (clearInterval(this.intervalId), this.intervalId = null), this.el.remove();
|
|
2476
2500
|
}
|
|
2477
2501
|
}
|
|
2478
|
-
class
|
|
2502
|
+
class Hi {
|
|
2479
2503
|
constructor() {
|
|
2480
2504
|
this.session = null, this.bar = null, this.result = null;
|
|
2481
2505
|
}
|
|
2482
2506
|
async start(t, e, r) {
|
|
2483
|
-
this.session = new
|
|
2507
|
+
this.session = new Di(t, r), this.bar = new Ai(
|
|
2484
2508
|
t,
|
|
2485
2509
|
e,
|
|
2486
2510
|
() => this.session?.getDuration() ?? 0,
|
|
@@ -2500,8 +2524,8 @@ class Ri {
|
|
|
2500
2524
|
this.session?.destroy(), this.session = null, this.bar?.destroy(), this.bar = null;
|
|
2501
2525
|
}
|
|
2502
2526
|
}
|
|
2503
|
-
const
|
|
2504
|
-
class
|
|
2527
|
+
const Ii = 3e3;
|
|
2528
|
+
class B {
|
|
2505
2529
|
constructor(t) {
|
|
2506
2530
|
this.tab = null, this.toolbar = null, this.session = null, this.drawBar = null, this.dim = null, this.popup = null, this.clarify = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.mode = "idle", this.via = "pin", this.currentAnnotation = null, this.submittingUi = null, this.lastPopupPos = null, this.recordingManager = null, this.activeSubmission = null, this.submissionAttempt = 0, this.lastHandoff = {}, this.frustrationDismissedByUser = !1, this.handleKeydown = (e) => {
|
|
2507
2531
|
if (e.key === "Escape")
|
|
@@ -2519,10 +2543,10 @@ class H {
|
|
|
2519
2543
|
}
|
|
2520
2544
|
}, this.handleRecordStop = () => {
|
|
2521
2545
|
this.recordingManager && (this.recordingManager.stop(), this.via = "record", this.showPopup(window.innerWidth / 2, window.innerHeight / 2, this.messages.record.timer_label));
|
|
2522
|
-
}, this.config = t, this.messages =
|
|
2546
|
+
}, this.config = t, this.messages = Ci(t.locale ?? "en"), this.apiClient = new hi(t.projectKey, t.apiUrl, void 0, t.userToken, t.userTokenFn), this.consoleCollector = new Ge(), this.consoleCollector.start(), this.breadcrumbCollector = new Qe(), this.breadcrumbCollector.start(), this.buildUI(), t.frustrationDetection !== !1 && (this.frustrationDetector = new $(() => this.handleFrustration()), this.frustrationDetector.start()), document.addEventListener("keydown", this.handleKeydown, !0);
|
|
2523
2547
|
}
|
|
2524
2548
|
buildUI() {
|
|
2525
|
-
this.shadow = new
|
|
2549
|
+
this.shadow = new kt(this.config.theme ?? "auto"), this.tab = new St(
|
|
2526
2550
|
this.shadow,
|
|
2527
2551
|
this.messages,
|
|
2528
2552
|
this.config.position ?? "right",
|
|
@@ -2534,7 +2558,7 @@ class H {
|
|
|
2534
2558
|
this.mode === "idle" ? (this.dismissFrustrationPrompt(), this.enterAnnotationMode()) : this.exitAll();
|
|
2535
2559
|
}
|
|
2536
2560
|
handleFrustration() {
|
|
2537
|
-
this.mode !== "idle" || this.frustrationPrompt || this.frustrationDismissedByUser || (this.frustrationPrompt = new
|
|
2561
|
+
this.mode !== "idle" || this.frustrationPrompt || this.frustrationDismissedByUser || (this.frustrationPrompt = new Ct(this.shadow, this.messages, {
|
|
2538
2562
|
onTell: () => {
|
|
2539
2563
|
this.dismissFrustrationPrompt(), this.enterAnnotationMode();
|
|
2540
2564
|
},
|
|
@@ -2547,7 +2571,7 @@ class H {
|
|
|
2547
2571
|
this.frustrationPrompt?.destroy(), this.frustrationPrompt = null;
|
|
2548
2572
|
}
|
|
2549
2573
|
enterAnnotationMode() {
|
|
2550
|
-
this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new
|
|
2574
|
+
this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new Tt(
|
|
2551
2575
|
this.shadow,
|
|
2552
2576
|
this.messages,
|
|
2553
2577
|
() => this.exitAll(),
|
|
@@ -2555,7 +2579,7 @@ class H {
|
|
|
2555
2579
|
), this.session = this.createSession();
|
|
2556
2580
|
}
|
|
2557
2581
|
createSession() {
|
|
2558
|
-
return new
|
|
2582
|
+
return new It(this.shadow, this.messages, {
|
|
2559
2583
|
onPin: (t, e) => {
|
|
2560
2584
|
this.currentAnnotation = t, this.via = "pin", this.showPopup(t.x, t.y, e, t.targetRect);
|
|
2561
2585
|
},
|
|
@@ -2569,14 +2593,14 @@ class H {
|
|
|
2569
2593
|
}
|
|
2570
2594
|
if (t === "record") {
|
|
2571
2595
|
if (this.mode === "recording") return;
|
|
2572
|
-
this.mode = "recording", this.currentAnnotation = null, this.teardownDraw(), this.session?.destroy(), this.session = null, this.recordingManager = new
|
|
2596
|
+
this.mode = "recording", this.currentAnnotation = null, this.teardownDraw(), this.session?.destroy(), this.session = null, this.recordingManager = new Hi(), this.recordingManager.start(this.shadow, this.messages, this.handleRecordStop).catch((e) => {
|
|
2573
2597
|
console.warn("[MakeThisBetter] Interaction replay unavailable, falling back to markup:", e), this.mode === "recording" && (this.toolbar?.setMode("markup"), this.handleToolbarModeChange("markup"));
|
|
2574
2598
|
});
|
|
2575
2599
|
} else
|
|
2576
2600
|
this.recordingManager?.destroy(), this.recordingManager = null, this.teardownDraw(), this.session || (this.session = this.createSession()), this.mode = "annotating";
|
|
2577
2601
|
}
|
|
2578
2602
|
handleDrawStroke() {
|
|
2579
|
-
this.mode !== "drawing" && (this.mode = "drawing", this.drawBar = new
|
|
2603
|
+
this.mode !== "drawing" && (this.mode = "drawing", this.drawBar = new Bt(this.shadow, {
|
|
2580
2604
|
messages: this.messages,
|
|
2581
2605
|
onUndo: () => this.handleDrawUndoRedo("undo"),
|
|
2582
2606
|
onRedo: () => this.handleDrawUndoRedo("redo"),
|
|
@@ -2605,7 +2629,7 @@ class H {
|
|
|
2605
2629
|
this.currentAnnotation = e, this.via = "draw", this.session?.dismissInteraction(), this.submittingUi = this.drawBar, this.handleSubmit(t || this.messages.annotation.drawing);
|
|
2606
2630
|
}
|
|
2607
2631
|
showPopup(t, e, r, s) {
|
|
2608
|
-
this.mode = "popup", this.lastPopupPos = { x: t, y: e }, this.teardownDraw(), this.session?.dismissInteraction(), this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.dim = new
|
|
2632
|
+
this.mode = "popup", this.lastPopupPos = { x: t, y: e }, this.teardownDraw(), this.session?.dismissInteraction(), this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.dim = new _t(this.shadow, () => this.exitAll()), this.popup = new Ft(this.shadow, {
|
|
2609
2633
|
targetName: r,
|
|
2610
2634
|
x: t,
|
|
2611
2635
|
y: e,
|
|
@@ -2613,33 +2637,34 @@ class H {
|
|
|
2613
2637
|
messages: this.messages,
|
|
2614
2638
|
onSubmit: (n) => this.handleSubmit(n),
|
|
2615
2639
|
onClose: () => this.exitAll(),
|
|
2616
|
-
onMyFeedback: this.buildMyFeedbackHandler()
|
|
2640
|
+
onMyFeedback: this.buildMyFeedbackHandler(),
|
|
2641
|
+
position: this.config.position ?? "right"
|
|
2617
2642
|
}), this.submittingUi = this.popup;
|
|
2618
2643
|
}
|
|
2619
2644
|
buildMyFeedbackHandler() {
|
|
2620
|
-
if (!this.config.user &&
|
|
2645
|
+
if (!this.config.user && gi())
|
|
2621
2646
|
return async () => {
|
|
2622
|
-
const t = await this.apiClient.createIdentityToken(
|
|
2623
|
-
!t?.identity_token || !t.board_url || (
|
|
2647
|
+
const t = await this.apiClient.createIdentityToken(it());
|
|
2648
|
+
!t?.identity_token || !t.board_url || (st(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
|
|
2624
2649
|
};
|
|
2625
2650
|
}
|
|
2626
2651
|
async handleSubmit(t) {
|
|
2627
2652
|
const e = this.submittingUi;
|
|
2628
2653
|
if (!e) return;
|
|
2629
2654
|
const r = ++this.submissionAttempt;
|
|
2630
|
-
e.setLoading(!0), await
|
|
2655
|
+
e.setLoading(!0), await $i();
|
|
2631
2656
|
const s = this.currentAnnotation, n = this.recordingManager?.getRecording() ?? void 0, [o, a] = await Promise.all([
|
|
2632
|
-
|
|
2633
|
-
Promise.resolve(
|
|
2634
|
-
]), l =
|
|
2657
|
+
Oe(s ? [s] : []),
|
|
2658
|
+
Promise.resolve(ai())
|
|
2659
|
+
]), l = pi(
|
|
2635
2660
|
t,
|
|
2636
2661
|
a,
|
|
2637
2662
|
this.consoleCollector.getErrors(),
|
|
2638
2663
|
s,
|
|
2639
2664
|
this.config.user,
|
|
2640
2665
|
n,
|
|
2641
|
-
this.config.user ? void 0 :
|
|
2642
|
-
this.config.user ? void 0 :
|
|
2666
|
+
this.config.user ? void 0 : it(),
|
|
2667
|
+
this.config.user ? void 0 : rt(),
|
|
2643
2668
|
this.breadcrumbCollector.getBreadcrumbs()
|
|
2644
2669
|
);
|
|
2645
2670
|
try {
|
|
@@ -2657,7 +2682,11 @@ class H {
|
|
|
2657
2682
|
}
|
|
2658
2683
|
async speculativeClarify(t, e, r) {
|
|
2659
2684
|
if (!t.ai_clarify_available) {
|
|
2660
|
-
|
|
2685
|
+
const l = this.teardownSubmittingUi(!0);
|
|
2686
|
+
this.showClarify(t, e, {
|
|
2687
|
+
element: l,
|
|
2688
|
+
preloadedResult: { messages: [], done: !0 }
|
|
2689
|
+
});
|
|
2661
2690
|
return;
|
|
2662
2691
|
}
|
|
2663
2692
|
const s = this.apiClient.streamClarification(
|
|
@@ -2666,19 +2695,24 @@ class H {
|
|
|
2666
2695
|
() => {
|
|
2667
2696
|
}
|
|
2668
2697
|
).catch(() => null), n = new Promise(
|
|
2669
|
-
(
|
|
2698
|
+
(l) => setTimeout(() => l(null), Ii)
|
|
2670
2699
|
), o = await Promise.race([s, n]);
|
|
2671
|
-
r
|
|
2700
|
+
if (r !== this.submissionAttempt) return;
|
|
2701
|
+
const a = this.teardownSubmittingUi(!0);
|
|
2702
|
+
o ? this.showClarify(t, e, { element: a, preloadedResult: o }) : this.showClarify(t, e, { element: a, pendingClarification: s });
|
|
2672
2703
|
}
|
|
2673
|
-
teardownSubmittingUi() {
|
|
2674
|
-
|
|
2704
|
+
teardownSubmittingUi(t = !1) {
|
|
2705
|
+
const e = t ? this.popup?.releaseElement() : void 0;
|
|
2706
|
+
return this.teardownDraw(), e || this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.session?.hideHighlight(), this.session?.destroy(), this.session = null, this.recordingManager?.destroy(), this.recordingManager = null, this.submittingUi = null, e;
|
|
2675
2707
|
}
|
|
2676
2708
|
showClarify(t, e, r) {
|
|
2677
|
-
this.mode = "clarifying", this.tab?.setActive(!0), this.clarify = new
|
|
2709
|
+
this.mode = "clarifying", this.tab?.setActive(!0), this.clarify = new qt(this.shadow, {
|
|
2678
2710
|
submissionSessionId: t.id,
|
|
2679
2711
|
submissionToken: t.token,
|
|
2680
2712
|
apiClient: this.apiClient,
|
|
2681
2713
|
messages: this.messages,
|
|
2714
|
+
element: r?.element,
|
|
2715
|
+
position: this.config.position ?? "right",
|
|
2682
2716
|
x: e?.x,
|
|
2683
2717
|
y: e?.y,
|
|
2684
2718
|
onFinalize: () => this.finalizeSubmission(),
|
|
@@ -2694,21 +2728,21 @@ class H {
|
|
|
2694
2728
|
feedbackId: r.id,
|
|
2695
2729
|
boardUrl: r.board_url,
|
|
2696
2730
|
identityToken: r.identity_token
|
|
2697
|
-
}, r.board_url &&
|
|
2731
|
+
}, r.board_url && st(r.board_url), this.clarify?.destroy(), this.clarify = null, this.toolbar?.destroy(), this.toolbar = null, this.showSuccess({ skipFollowup: t.ai_clarify_available === !1 }));
|
|
2698
2732
|
}
|
|
2699
2733
|
showSuccess(t) {
|
|
2700
|
-
this.mode = "idle", this.tab?.setActive(!1), this.success = new
|
|
2734
|
+
this.mode = "idle", this.tab?.setActive(!1), this.success = new Vt(this.shadow, this.messages, () => {
|
|
2701
2735
|
this.success?.destroy(), this.success = null;
|
|
2702
2736
|
}, this.buildViewFeedbackHandler(), { ...t, emailCapture: this.buildEmailCapture() });
|
|
2703
2737
|
}
|
|
2704
2738
|
buildEmailCapture() {
|
|
2705
2739
|
if (this.config.user) return;
|
|
2706
2740
|
const { feedbackId: t, identityToken: e } = this.lastHandoff;
|
|
2707
|
-
if (!(!t || !e) && !
|
|
2741
|
+
if (!(!t || !e) && !rt())
|
|
2708
2742
|
return {
|
|
2709
2743
|
onSubmit: async (r) => {
|
|
2710
2744
|
const s = await this.apiClient.updateReporter(t, r, e);
|
|
2711
|
-
return s &&
|
|
2745
|
+
return s && bi(r), s;
|
|
2712
2746
|
}
|
|
2713
2747
|
};
|
|
2714
2748
|
}
|
|
@@ -2736,24 +2770,24 @@ class H {
|
|
|
2736
2770
|
document.removeEventListener("keydown", this.handleKeydown, !0), this.exitAll(), this.consoleCollector.stop(), this.breadcrumbCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.recordingManager?.destroy(), this.shadow.destroy();
|
|
2737
2771
|
}
|
|
2738
2772
|
}
|
|
2739
|
-
function
|
|
2773
|
+
function $i() {
|
|
2740
2774
|
return new Promise((i) => requestAnimationFrame(() => setTimeout(i, 0)));
|
|
2741
2775
|
}
|
|
2742
|
-
let
|
|
2743
|
-
const
|
|
2776
|
+
let w = null, R = null;
|
|
2777
|
+
const Bi = {
|
|
2744
2778
|
init(i) {
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
}) :
|
|
2779
|
+
w && (w.destroy(), w = null), R = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
|
|
2780
|
+
w = new B(i);
|
|
2781
|
+
}) : w = new B(i);
|
|
2748
2782
|
},
|
|
2749
2783
|
destroy() {
|
|
2750
|
-
|
|
2784
|
+
w?.destroy(), w = null, R = null;
|
|
2751
2785
|
}
|
|
2752
2786
|
};
|
|
2753
|
-
typeof window < "u" && (window.MakeThisBetter =
|
|
2754
|
-
|
|
2787
|
+
typeof window < "u" && (window.MakeThisBetter = Bi, document.addEventListener("turbo:load", () => {
|
|
2788
|
+
R && !document.getElementById("mtb-widget-host") && (w?.destroy(), w = new B(R));
|
|
2755
2789
|
}));
|
|
2756
2790
|
export {
|
|
2757
|
-
|
|
2791
|
+
Bi as MakeThisBetter
|
|
2758
2792
|
};
|
|
2759
2793
|
//# sourceMappingURL=makethisbetter.esm.js.map
|