makethisbetter 1.12.0 → 1.12.1
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/annotate/toolbar.d.ts +4 -3
- package/dist/annotate/toolbar.d.ts.map +1 -1
- package/dist/makethisbetter.cjs +6 -6
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +40 -31
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +6 -6
- package/dist/makethisbetter.js.map +1 -1
- package/package.json +1 -1
- package/src/annotate/toolbar.ts +41 -26
- package/src/styles/widget.css +13 -0
|
@@ -8,12 +8,13 @@ export declare class AnnotationToolbar {
|
|
|
8
8
|
private recordBtn;
|
|
9
9
|
private messages;
|
|
10
10
|
private currentMode;
|
|
11
|
-
private
|
|
11
|
+
private idleTimer;
|
|
12
12
|
private faded;
|
|
13
13
|
private handlePointerMove;
|
|
14
14
|
constructor(shadow: ShadowContainer, messages: I18nMessages, onExit: () => void, onModeChange?: (mode: ToolbarMode) => void);
|
|
15
|
-
private
|
|
16
|
-
private
|
|
15
|
+
private restartIdleTimer;
|
|
16
|
+
private clearIdleTimer;
|
|
17
|
+
private fadeToolbar;
|
|
17
18
|
private restoreToolbar;
|
|
18
19
|
private buildHTML;
|
|
19
20
|
setMode(mode: ToolbarMode): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../src/annotate/toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../src/annotate/toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAK7C,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,EAAE,CAAgB;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,WAAW,CAAwB;IAE3C,OAAO,CAAC,SAAS,CAA6C;IAC9D,OAAO,CAAC,KAAK,CAAQ;IAWrB,OAAO,CAAC,iBAAiB,CAexB;gBAGC,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,MAAM,IAAI,EAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IA6B5C,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,SAAS;IAoBjB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAahC,OAAO,IAAI,WAAW;IAItB,OAAO,IAAI,IAAI;CAKhB"}
|
package/dist/makethisbetter.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";var Xt=Object.create;var it=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Qt=Object.prototype.hasOwnProperty;var Zt=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Gt(t))!Qt.call(i,s)&&s!==e&&it(i,s,{get:()=>t[s],enumerable:!(r=Kt(t,s))||r.enumerable});return i};var te=(i,t,e)=>(e=i!=null?Xt(Jt(i)):{},Zt(t||!i||!i.__esModule?it(e,"default",{value:i,enumerable:!0}):e,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=`*,*: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{--mtb-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Ccircle cx='12' cy='12' r='2.4' fill='%23000' stroke='none'/%3E%3Cpath d='M12 1.8v3.4M12 18.8v3.4M1.8 12h3.4M18.8 12h3.4'/%3E%3C/svg%3E");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;transition:opacity .15s ease}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar-faded{opacity:.3}.mtb-toolbar-modes{display:flex;align-items:center;gap:3px;background:#ffffff29;border-radius:9px;padding:3px}.mtb-toolbar-mode-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:7px;border:none;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;white-space:nowrap;background:transparent;color:#fffffff2;transition:all .12s}.mtb-toolbar-mode-btn.active{background:#fff;color:#047857}.mtb-toolbar-hint{font-size:12px;color:#fffffff2;white-space:nowrap}.mtb-toolbar-sep{width:1px;height:20px;background:#ffffff38}.mtb-exit-btn{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 12px;border-radius:8px;font-size:11.5px;font-weight:500;color:#fff;cursor:pointer;background:#ffffff29;border:none;font-family:inherit;transition:background .12s}.mtb-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair;touch-action:none}.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.selected{background:#10b9811a;border-color:#10b98180}.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,.mtb-clarify-fallback{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,.mtb-clarify-fallback:hover{background:#0000000a}.mtb-clarify-send,.mtb-clarify-retry{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,.mtb-clarify-retry:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled,.mtb-clarify-retry: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,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback: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,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback: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}@media (pointer: coarse){.mtb-tab:after{content:"";position:absolute;inset:-6px 0 -6px -12px}.mtb-tab.left:after{inset:-6px -12px -6px 0}.mtb-toolbar{height:56px;border-radius:16px}.mtb-toolbar-mode-btn,.mtb-exit-btn,.mtb-popup-close,.mtb-cancel-btn,.mtb-submit-btn{min-height:44px}}@media (max-width: 480px){.mtb-tab{width:36px;height:40px;padding:0;font-size:0;writing-mode:horizontal-tb;border-radius:12px 0 0 12px;right:env(safe-area-inset-right,0px)}.mtb-tab.left{left:env(safe-area-inset-left,0px);border-radius:0 12px 12px 0}.mtb-tab:before{content:"";width:18px;height:18px;background:currentColor;-webkit-mask:var(--mtb-tab-icon) center / contain no-repeat;mask:var(--mtb-tab-icon) center / contain no-repeat}.mtb-toolbar{top:0;left:0;right:0;width:100%;max-width:none;transform:none;border-radius:0;gap:6px;justify-content:center;padding:env(safe-area-inset-top,0px) 8px 0;height:calc(56px + env(safe-area-inset-top,0px));animation:mtbBarInMobile .2s ease}.mtb-toolbar-hint,.mtb-toolbar-sep{display:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{padding-right:10px;padding-left:10px}.mtb-popup{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0;animation:mtbSheetUp .28s cubic-bezier(.34,1.56,.64,1)}.mtb-popup-actions{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-clarify{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0}.mtb-clarify-footer{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-draw-bar{left:0;right:0;bottom:0;transform:none;height:auto;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0}}@keyframes mtbBarInMobile{0%{transform:translateY(-14px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes mtbSheetUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}`;class ie{constructor(t="auto"){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"});const e=document.createElement("style");e.textContent=ee,this.root.appendChild(e)}el(t,e){const r=document.createElement(t);return e&&(r.className=e),r}append(...t){for(const e of t)this.root.appendChild(e)}remove(...t){for(const e of t)e.parentNode===this.root&&this.root.removeChild(e)}destroy(){this.host.remove()}}class re{constructor(t,e,r,s,n){this.active=!1,this.onClick=s,this.customText=n,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)}setLabel(t){this.el.textContent=t,this.el.setAttribute("aria-label",t)}setMessages(t){this.idleLabel=this.customText??t.tab,this.activeLabel=t.toolbar.exit,this.setLabel(this.active?this.activeLabel:this.idleLabel)}setActive(t){this.active=t,this.el.classList.toggle("active",t),this.setLabel(t?this.activeLabel:this.idleLabel)}destroy(){this.el.removeEventListener("click",this.onClick),this.el.remove()}}const se=8e3;class ne{constructor(t,e,r){this.autoHideTimer=null,this.el=t.el("div","mtb-frustration-prompt"),this.el.innerHTML=`
|
|
1
|
+
"use strict";var Xt=Object.create;var it=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Qt=Object.prototype.hasOwnProperty;var Zt=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Gt(t))!Qt.call(i,s)&&s!==e&&it(i,s,{get:()=>t[s],enumerable:!(r=Kt(t,s))||r.enumerable});return i};var te=(i,t,e)=>(e=i!=null?Xt(Jt(i)):{},Zt(t||!i||!i.__esModule?it(e,"default",{value:i,enumerable:!0}):e,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=`*,*: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{--mtb-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Ccircle cx='12' cy='12' r='2.4' fill='%23000' stroke='none'/%3E%3Cpath d='M12 1.8v3.4M12 18.8v3.4M1.8 12h3.4M18.8 12h3.4'/%3E%3C/svg%3E");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;transition:opacity .15s ease;pointer-events:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{pointer-events:auto}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar-faded{opacity:.3}.mtb-toolbar-modes{display:flex;align-items:center;gap:3px;background:#ffffff29;border-radius:9px;padding:3px}.mtb-toolbar-mode-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:7px;border:none;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;white-space:nowrap;background:transparent;color:#fffffff2;transition:all .12s}.mtb-toolbar-mode-btn.active{background:#fff;color:#047857}.mtb-toolbar-hint{font-size:12px;color:#fffffff2;white-space:nowrap}.mtb-toolbar-sep{width:1px;height:20px;background:#ffffff38}.mtb-exit-btn{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 12px;border-radius:8px;font-size:11.5px;font-weight:500;color:#fff;cursor:pointer;background:#ffffff29;border:none;font-family:inherit;transition:background .12s}.mtb-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair;touch-action:none}.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.selected{background:#10b9811a;border-color:#10b98180}.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,.mtb-clarify-fallback{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,.mtb-clarify-fallback:hover{background:#0000000a}.mtb-clarify-send,.mtb-clarify-retry{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,.mtb-clarify-retry:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled,.mtb-clarify-retry: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,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback: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,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback: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}@media (pointer: coarse){.mtb-tab:after{content:"";position:absolute;inset:-6px 0 -6px -12px}.mtb-tab.left:after{inset:-6px -12px -6px 0}.mtb-toolbar{height:56px;border-radius:16px}.mtb-toolbar-mode-btn,.mtb-exit-btn,.mtb-popup-close,.mtb-cancel-btn,.mtb-submit-btn{min-height:44px}}@media (max-width: 480px){.mtb-tab{width:36px;height:40px;padding:0;font-size:0;writing-mode:horizontal-tb;border-radius:12px 0 0 12px;right:env(safe-area-inset-right,0px)}.mtb-tab.left{left:env(safe-area-inset-left,0px);border-radius:0 12px 12px 0}.mtb-tab:before{content:"";width:18px;height:18px;background:currentColor;-webkit-mask:var(--mtb-tab-icon) center / contain no-repeat;mask:var(--mtb-tab-icon) center / contain no-repeat}.mtb-toolbar{top:0;left:0;right:0;width:100%;max-width:none;transform:none;border-radius:0;gap:6px;justify-content:center;padding:env(safe-area-inset-top,0px) 8px 0;height:calc(56px + env(safe-area-inset-top,0px));animation:mtbBarInMobile .2s ease}.mtb-toolbar-hint,.mtb-toolbar-sep{display:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{padding-right:10px;padding-left:10px}.mtb-popup{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0;animation:mtbSheetUp .28s cubic-bezier(.34,1.56,.64,1)}.mtb-popup-actions{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-clarify{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0}.mtb-clarify-footer{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-draw-bar{left:0;right:0;bottom:0;transform:none;height:auto;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0}}@keyframes mtbBarInMobile{0%{transform:translateY(-14px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes mtbSheetUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}`;class ie{constructor(t="auto"){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"});const e=document.createElement("style");e.textContent=ee,this.root.appendChild(e)}el(t,e){const r=document.createElement(t);return e&&(r.className=e),r}append(...t){for(const e of t)this.root.appendChild(e)}remove(...t){for(const e of t)e.parentNode===this.root&&this.root.removeChild(e)}destroy(){this.host.remove()}}class re{constructor(t,e,r,s,n){this.active=!1,this.onClick=s,this.customText=n,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)}setLabel(t){this.el.textContent=t,this.el.setAttribute("aria-label",t)}setMessages(t){this.idleLabel=this.customText??t.tab,this.activeLabel=t.toolbar.exit,this.setLabel(this.active?this.activeLabel:this.idleLabel)}setActive(t){this.active=t,this.el.classList.toggle("active",t),this.setLabel(t?this.activeLabel:this.idleLabel)}destroy(){this.el.removeEventListener("click",this.onClick),this.el.remove()}}const se=8e3;class ne{constructor(t,e,r){this.autoHideTimer=null,this.el=t.el("div","mtb-frustration-prompt"),this.el.innerHTML=`
|
|
2
2
|
<div class="mtb-frustration-icon">⚠️</div>
|
|
3
3
|
<span class="mtb-frustration-text">${e.frustration.prompt}</span>
|
|
4
4
|
<div class="mtb-frustration-actions">
|
|
5
5
|
<button class="mtb-frustration-tell">${e.frustration.action}</button>
|
|
6
6
|
<button class="mtb-frustration-dismiss">${e.frustration.dismiss}</button>
|
|
7
7
|
</div>
|
|
8
|
-
`,this.el.querySelector(".mtb-frustration-tell").addEventListener("click",r.onTell),this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click",r.onDismiss),t.append(this.el),this.autoHideTimer=setTimeout(r.onAutoHide,se)}destroy(){this.autoHideTimer&&(clearTimeout(this.autoHideTimer),this.autoHideTimer=null),this.el.remove()}}class oe{constructor(t,e){this.onClick=e,this.el=t.el("div","mtb-dim mtb-dim-clickable"),this.el.addEventListener("click",this.onClick),t.append(this.el)}destroy(){this.el.removeEventListener("click",this.onClick),this.el.remove()}}class ae{constructor(){this.locked=!1,this.prevOverflow="",this.prevTouchAction=""}isTouchPointer(){return window.matchMedia?.("(pointer: coarse)").matches??!1}lock(){this.locked||!this.isTouchPointer()||(this.locked=!0,this.prevOverflow=document.body.style.overflow,this.prevTouchAction=document.body.style.touchAction,document.body.style.overflow="hidden",document.body.style.touchAction="none")}unlock(){this.locked&&(this.locked=!1,document.body.style.overflow=this.prevOverflow,document.body.style.touchAction=this.prevTouchAction)}isLocked(){return this.locked}}const le=
|
|
8
|
+
`,this.el.querySelector(".mtb-frustration-tell").addEventListener("click",r.onTell),this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click",r.onDismiss),t.append(this.el),this.autoHideTimer=setTimeout(r.onAutoHide,se)}destroy(){this.autoHideTimer&&(clearTimeout(this.autoHideTimer),this.autoHideTimer=null),this.el.remove()}}class oe{constructor(t,e){this.onClick=e,this.el=t.el("div","mtb-dim mtb-dim-clickable"),this.el.addEventListener("click",this.onClick),t.append(this.el)}destroy(){this.el.removeEventListener("click",this.onClick),this.el.remove()}}class ae{constructor(){this.locked=!1,this.prevOverflow="",this.prevTouchAction=""}isTouchPointer(){return window.matchMedia?.("(pointer: coarse)").matches??!1}lock(){this.locked||!this.isTouchPointer()||(this.locked=!0,this.prevOverflow=document.body.style.overflow,this.prevTouchAction=document.body.style.touchAction,document.body.style.overflow="hidden",document.body.style.touchAction="none")}unlock(){this.locked&&(this.locked=!1,document.body.style.overflow=this.prevOverflow,document.body.style.touchAction=this.prevTouchAction)}isLocked(){return this.locked}}const le=400;class ce{constructor(t,e,r,s){this.currentMode="markup",this.idleTimer=null,this.faded=!1,this.handlePointerMove=n=>{if(n.pointerType!=="mouse")return;const o=this.el.getBoundingClientRect();if(n.clientX>=o.left&&n.clientX<=o.right&&n.clientY>=o.top&&n.clientY<=o.bottom){this.clearIdleTimer(),this.restoreToolbar();return}this.fadeToolbar(),this.restartIdleTimer()},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",()=>{this.setMode("markup"),s?.("markup")}),this.recordBtn.addEventListener("click",()=>{this.setMode("record"),s?.("record")}),this.el.querySelector(".mtb-exit-btn").addEventListener("click",r),this.el.addEventListener("click",()=>{this.clearIdleTimer(),this.restoreToolbar()}),document.addEventListener("pointermove",this.handlePointerMove)}restartIdleTimer(){this.clearIdleTimer(),this.idleTimer=setTimeout(()=>{this.idleTimer=null,this.restoreToolbar()},le)}clearIdleTimer(){this.idleTimer!==null&&(clearTimeout(this.idleTimer),this.idleTimer=null)}fadeToolbar(){this.faded||(this.faded=!0,this.el.classList.add("mtb-toolbar-faded"))}restoreToolbar(){this.faded&&(this.faded=!1,this.el.classList.remove("mtb-toolbar-faded"))}buildHTML(t){return`
|
|
9
9
|
<div class="mtb-toolbar-modes">
|
|
10
10
|
<button class="mtb-toolbar-mode-btn mtb-toolbar-mode-markup active">
|
|
11
11
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><line x1="12" y1="3" x2="12" y2="7"/><line x1="12" y1="17" x2="12" y2="21"/><line x1="3" y1="12" x2="7" y2="12"/><line x1="17" y1="12" x2="21" y2="12"/></svg>${t.toolbar.markup}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<path d="M18 6L6 18M6 6l12 12"/>
|
|
22
22
|
</svg>${t.toolbar.exit}
|
|
23
23
|
</button>
|
|
24
|
-
`}setMode(t){this.currentMode=t,t==="markup"?(this.markupBtn.classList.add("active"),this.recordBtn.classList.remove("active"),this.hintEl.textContent=this.messages.toolbar.hint):(this.markupBtn.classList.remove("active"),this.recordBtn.classList.add("active"),this.hintEl.textContent=this.messages.toolbar.hintRecord)}getMode(){return this.currentMode}destroy(){this.clearFadeTimer(),document.removeEventListener("pointermove",this.handlePointerMove),this.el.remove()}}class de{constructor(t,e){this.handlers=e,this.overlayEl=t.el("div","mtb-overlay"),this.onPointerDown=r=>{const s=r;if(s.isPrimary){try{this.overlayEl.setPointerCapture(s.pointerId)}catch{}this.handlers.onPointerDown(s)}},this.onPointerMove=r=>{const s=r;s.isPrimary&&this.handlers.onPointerMove(s)},this.onPointerUp=r=>{const s=r;s.isPrimary&&(this.releaseCapture(s.pointerId),this.handlers.onPointerUp(s))},this.onPointerCancel=r=>{const s=r;s.isPrimary&&(this.releaseCapture(s.pointerId),this.handlers.onPointerCancel(s))},this.overlayEl.addEventListener("pointerdown",this.onPointerDown),this.overlayEl.addEventListener("pointermove",this.onPointerMove),this.overlayEl.addEventListener("pointerup",this.onPointerUp),this.overlayEl.addEventListener("pointercancel",this.onPointerCancel),t.append(this.overlayEl),this.dimEl=t.el("div","mtb-dim"),t.append(this.dimEl)}releaseCapture(t){try{this.overlayEl.releasePointerCapture(t)}catch{}}destroy(){this.overlayEl.removeEventListener("pointerdown",this.onPointerDown),this.overlayEl.removeEventListener("pointermove",this.onPointerMove),this.overlayEl.removeEventListener("pointerup",this.onPointerUp),this.overlayEl.removeEventListener("pointercancel",this.onPointerCancel),this.overlayEl.remove(),this.dimEl.remove()}}class he{constructor(t){this.highlightEl=t.el("div","mtb-highlight"),this.tooltipEl=t.el("div","mtb-highlight-tooltip"),this.hide(),t.append(this.highlightEl,this.tooltipEl)}highlight(t){const e=t.getBoundingClientRect();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)}showTooltip(t,e){this.tooltipEl.textContent=G(t);const r=e.top<30;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"}select(){this.highlightEl.classList.add("selected"),this.tooltipEl.style.display="none"}hide(){this.highlightEl.style.display="none",this.highlightEl.classList.remove("selected"),this.tooltipEl.style.display="none"}destroy(){this.highlightEl.remove(),this.tooltipEl.remove()}}function G(i){if(i instanceof HTMLElement){const t=i.getAttribute("aria-label");if(t)return t;const e=i.getAttribute("title");if(e)return e;const r=i.textContent?.trim().slice(0,40);if(r)return r;const s=i.placeholder;if(s)return s;const n=i.alt;if(n)return n;const o=i.getAttribute("data-mark");if(o)return o}return i.tagName.toLowerCase()}function Lt(i){const t=[];let e=i;for(;e&&e!==document.body&&t.length<5;){let r=e.tagName.toLowerCase();if(e.id){r=`#${e.id}`,t.unshift(r);break}const s=Array.from(e.classList).filter(o=>!o.startsWith("mtb-")).slice(0,2).join(".");s&&(r+=`.${s}`);const n=e.parentElement;if(n){const o=Array.from(n.children).filter(a=>a.tagName===e.tagName);if(o.length>1){const a=o.indexOf(e)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),e=e.parentElement}return t.join(" > ")}class ue{constructor(t){this.pins=[],this.shadow=t}addPin(t,e){const r=this.shadow.el("div","mtb-pin");r.style.top=`${e}px`,r.style.left=`${t}px`,this.shadow.append(r),this.pins.push(r)}clearAll(){for(const t of this.pins)t.remove();this.pins=[]}destroy(){this.clearAll()}}const O="#059669",me="5,150,105";function J(i){return`rgba(${me},${i})`}const fe='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',C={color:O,width:"3.5",linecap:"round",linejoin:"round",filter:`drop-shadow(0 1px 2px ${J(.35)})`};class be{constructor(t){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)}startDraw(t,e){this.isDrawing=!0,this.currentPoints=[[t,e]],this.currentPath=this.createPath(),this.svg.appendChild(this.currentPath)}continueDraw(t,e){!this.isDrawing||!this.currentPath||(this.currentPoints.push([t,e]),this.currentPath.setAttribute("d",rt(this.currentPoints)))}commitStroke(){return!this.isDrawing||!this.currentPath?!1:(this.isDrawing=!1,this.committed.push({path:this.currentPath,d:rt(this.currentPoints),points:this.currentPoints}),this.redoStack=[],this.currentPath=null,this.currentPoints=[],!0)}cancelCurrentDraw(){this.currentPath?.remove(),this.currentPath=null,this.isDrawing=!1,this.currentPoints=[]}undo(){const t=this.committed.pop();return t?(t.path.remove(),this.redoStack.push({d:t.d,points:t.points}),!0):!1}redo(){const t=this.redoStack.pop();if(!t)return!1;const e=this.createPath();return e.setAttribute("d",t.d),this.svg.appendChild(e),this.committed.push({path:e,d:t.d,points:t.points}),!0}canUndo(){return this.committed.length>0}canRedo(){return this.redoStack.length>0}hasStrokes(){return this.committed.length>0}getAnnotation(){if(this.committed.length===0)return null;const t=this.committed.flatMap(s=>s.points),[e,r]=pe(t);return{type:"draw",x:e,y:r,drawPath:this.committed.map(s=>s.d).join(" ")}}clearAll(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);this.currentPath=null,this.isDrawing=!1,this.currentPoints=[],this.committed=[],this.redoStack=[]}isCurrentlyDrawing(){return this.isDrawing}getCurrentPointCount(){return this.currentPoints.length}destroy(){this.svg.remove()}createPath(){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","none"),t.setAttribute("stroke",C.color),t.setAttribute("stroke-width",C.width),t.setAttribute("stroke-linecap",C.linecap),t.setAttribute("stroke-linejoin",C.linejoin),t.setAttribute("style",`filter:${C.filter}`),t}}function rt(i){if(i.length===0)return"";const[t,e]=i[0];let r=`M ${t} ${e}`;for(let s=1;s<i.length;s++){const[n,o]=i[s];r+=` L ${n} ${o}`}return r}function pe(i){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;return[r,s]}const ge=5;class ye{constructor(t,e,r){this.messages=e,this.handlers=r,this.interactionActive=!0,this.pendingHighlightFrame=null,this.lastMoveX=0,this.lastMoveY=0,this.highlighter=new he(t),this.pinMarker=new ue(t),this.drawLayer=new be(t),this.overlay=new de(t,{onPointerDown:s=>this.handlePointerDown(s),onPointerMove:s=>this.handlePointerMove(s),onPointerUp:s=>this.handlePointerUp(s),onPointerCancel:()=>{this.drawLayer.isCurrentlyDrawing()&&this.finishStroke(),this.cancelPendingHighlight(),this.highlighter.hide()}})}handlePointerDown(t){t.preventDefault(),this.drawLayer.startDraw(t.clientX,t.clientY)}handlePointerMove(t){if(this.drawLayer.isCurrentlyDrawing()){this.cancelPendingHighlight(),this.drawLayer.continueDraw(t.clientX,t.clientY),this.highlighter.hide();return}this.lastMoveX=t.clientX,this.lastMoveY=t.clientY,this.pendingHighlightFrame===null&&(this.pendingHighlightFrame=requestAnimationFrame(()=>{this.pendingHighlightFrame=null,this.updateHighlight()}))}updateHighlight(){if(!this.interactionActive||this.drawLayer.isCurrentlyDrawing()||this.drawSessionActive())return;const t=st(this.lastMoveX,this.lastMoveY);t?this.highlighter.highlight(t):this.highlighter.hide()}cancelPendingHighlight(){this.pendingHighlightFrame!==null&&(cancelAnimationFrame(this.pendingHighlightFrame),this.pendingHighlightFrame=null)}handlePointerUp(t){this.drawLayer.isCurrentlyDrawing()&&this.finishStroke(t)}finishStroke(t){if(this.drawLayer.getCurrentPointCount()>=ge){this.drawLayer.commitStroke(),this.highlighter.hide(),this.handlers.onDrawStroke();return}if(this.drawLayer.cancelCurrentDraw(),this.drawLayer.hasStrokes()||!t)return;const e=st(t.clientX,t.clientY),r=e?G(e):this.messages.annotation.element,s=e?.getBoundingClientRect(),n={type:"pin",x:t.clientX,y:t.clientY,targetSelector:e?Lt(e):void 0,targetText:e?.textContent?.trim().slice(0,200)??"",targetName:r,targetRect:s?{top:s.top,left:s.left,width:s.width,height:s.height,bottom:s.bottom}:void 0};this.pinMarker.addPin(t.clientX,t.clientY),this.highlighter.select(),this.handlers.onPin(n,r)}undoDraw(){this.drawLayer.undo()}redoDraw(){this.drawLayer.redo()}canUndoDraw(){return this.drawLayer.canUndo()}canRedoDraw(){return this.drawLayer.canRedo()}hasDrawStrokes(){return this.drawLayer.hasStrokes()}drawSessionActive(){return this.drawLayer.hasStrokes()||this.drawLayer.canRedo()}getDrawAnnotation(){return this.drawLayer.getAnnotation()}clearDraw(){this.drawLayer.clearAll()}dismissInteraction(){this.interactionActive&&(this.interactionActive=!1,this.cancelPendingHighlight(),this.overlay.destroy())}hideHighlight(){this.highlighter.hide()}destroy(){this.dismissInteraction(),this.highlighter.destroy(),this.pinMarker.destroy(),this.drawLayer.destroy()}}function st(i,t){return document.elementsFromPoint(i,t).find(e=>e.id!=="mtb-widget-host")??null}const we="mtb-widget-host";function S(i){const t=document.getElementById(we);return t?t===i||t.contains(i):!1}function h(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class ve{constructor(){this.onChange=null,this.handler=()=>{this.onChange?.(this.current())}}current(){const t=window.visualViewport;return t?Math.max(0,Math.round(window.innerHeight-(t.height+t.offsetTop))):0}observe(t){const e=window.visualViewport;e&&(this.onChange=t,e.addEventListener("resize",this.handler),e.addEventListener("scroll",this.handler))}stop(){const t=window.visualViewport;this.onChange=null,t&&(t.removeEventListener("resize",this.handler),t.removeEventListener("scroll",this.handler))}}const xe=480;function ke(){return window.innerWidth<=xe}class Q{constructor(t){this.el=t,this.inset=new ve}apply(){return ke()?(this.el.style.left="",this.el.style.top="",this.el.style.maxHeight="",this.lift(this.inset.current()),this.inset.observe(t=>this.lift(t)),!0):!1}release(){this.inset.stop()}lift(t){this.el.style.bottom=t>0?`${t}px`:""}}class Se{constructor(t,e){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.sheet=new Q(this.el),this.sheet.apply(),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=>{r.isComposing||r.keyCode===229||r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),this.submit())}),this.input.focus()}buildHTML(t){return`
|
|
24
|
+
`}setMode(t){this.currentMode=t,t==="markup"?(this.markupBtn.classList.add("active"),this.recordBtn.classList.remove("active"),this.hintEl.textContent=this.messages.toolbar.hint):(this.markupBtn.classList.remove("active"),this.recordBtn.classList.add("active"),this.hintEl.textContent=this.messages.toolbar.hintRecord)}getMode(){return this.currentMode}destroy(){this.clearIdleTimer(),document.removeEventListener("pointermove",this.handlePointerMove),this.el.remove()}}class de{constructor(t,e){this.handlers=e,this.overlayEl=t.el("div","mtb-overlay"),this.onPointerDown=r=>{const s=r;if(s.isPrimary){try{this.overlayEl.setPointerCapture(s.pointerId)}catch{}this.handlers.onPointerDown(s)}},this.onPointerMove=r=>{const s=r;s.isPrimary&&this.handlers.onPointerMove(s)},this.onPointerUp=r=>{const s=r;s.isPrimary&&(this.releaseCapture(s.pointerId),this.handlers.onPointerUp(s))},this.onPointerCancel=r=>{const s=r;s.isPrimary&&(this.releaseCapture(s.pointerId),this.handlers.onPointerCancel(s))},this.overlayEl.addEventListener("pointerdown",this.onPointerDown),this.overlayEl.addEventListener("pointermove",this.onPointerMove),this.overlayEl.addEventListener("pointerup",this.onPointerUp),this.overlayEl.addEventListener("pointercancel",this.onPointerCancel),t.append(this.overlayEl),this.dimEl=t.el("div","mtb-dim"),t.append(this.dimEl)}releaseCapture(t){try{this.overlayEl.releasePointerCapture(t)}catch{}}destroy(){this.overlayEl.removeEventListener("pointerdown",this.onPointerDown),this.overlayEl.removeEventListener("pointermove",this.onPointerMove),this.overlayEl.removeEventListener("pointerup",this.onPointerUp),this.overlayEl.removeEventListener("pointercancel",this.onPointerCancel),this.overlayEl.remove(),this.dimEl.remove()}}class he{constructor(t){this.highlightEl=t.el("div","mtb-highlight"),this.tooltipEl=t.el("div","mtb-highlight-tooltip"),this.hide(),t.append(this.highlightEl,this.tooltipEl)}highlight(t){const e=t.getBoundingClientRect();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)}showTooltip(t,e){this.tooltipEl.textContent=G(t);const r=e.top<30;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"}select(){this.highlightEl.classList.add("selected"),this.tooltipEl.style.display="none"}hide(){this.highlightEl.style.display="none",this.highlightEl.classList.remove("selected"),this.tooltipEl.style.display="none"}destroy(){this.highlightEl.remove(),this.tooltipEl.remove()}}function G(i){if(i instanceof HTMLElement){const t=i.getAttribute("aria-label");if(t)return t;const e=i.getAttribute("title");if(e)return e;const r=i.textContent?.trim().slice(0,40);if(r)return r;const s=i.placeholder;if(s)return s;const n=i.alt;if(n)return n;const o=i.getAttribute("data-mark");if(o)return o}return i.tagName.toLowerCase()}function Lt(i){const t=[];let e=i;for(;e&&e!==document.body&&t.length<5;){let r=e.tagName.toLowerCase();if(e.id){r=`#${e.id}`,t.unshift(r);break}const s=Array.from(e.classList).filter(o=>!o.startsWith("mtb-")).slice(0,2).join(".");s&&(r+=`.${s}`);const n=e.parentElement;if(n){const o=Array.from(n.children).filter(a=>a.tagName===e.tagName);if(o.length>1){const a=o.indexOf(e)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),e=e.parentElement}return t.join(" > ")}class ue{constructor(t){this.pins=[],this.shadow=t}addPin(t,e){const r=this.shadow.el("div","mtb-pin");r.style.top=`${e}px`,r.style.left=`${t}px`,this.shadow.append(r),this.pins.push(r)}clearAll(){for(const t of this.pins)t.remove();this.pins=[]}destroy(){this.clearAll()}}const O="#059669",me="5,150,105";function J(i){return`rgba(${me},${i})`}const fe='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',C={color:O,width:"3.5",linecap:"round",linejoin:"round",filter:`drop-shadow(0 1px 2px ${J(.35)})`};class be{constructor(t){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)}startDraw(t,e){this.isDrawing=!0,this.currentPoints=[[t,e]],this.currentPath=this.createPath(),this.svg.appendChild(this.currentPath)}continueDraw(t,e){!this.isDrawing||!this.currentPath||(this.currentPoints.push([t,e]),this.currentPath.setAttribute("d",rt(this.currentPoints)))}commitStroke(){return!this.isDrawing||!this.currentPath?!1:(this.isDrawing=!1,this.committed.push({path:this.currentPath,d:rt(this.currentPoints),points:this.currentPoints}),this.redoStack=[],this.currentPath=null,this.currentPoints=[],!0)}cancelCurrentDraw(){this.currentPath?.remove(),this.currentPath=null,this.isDrawing=!1,this.currentPoints=[]}undo(){const t=this.committed.pop();return t?(t.path.remove(),this.redoStack.push({d:t.d,points:t.points}),!0):!1}redo(){const t=this.redoStack.pop();if(!t)return!1;const e=this.createPath();return e.setAttribute("d",t.d),this.svg.appendChild(e),this.committed.push({path:e,d:t.d,points:t.points}),!0}canUndo(){return this.committed.length>0}canRedo(){return this.redoStack.length>0}hasStrokes(){return this.committed.length>0}getAnnotation(){if(this.committed.length===0)return null;const t=this.committed.flatMap(s=>s.points),[e,r]=pe(t);return{type:"draw",x:e,y:r,drawPath:this.committed.map(s=>s.d).join(" ")}}clearAll(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);this.currentPath=null,this.isDrawing=!1,this.currentPoints=[],this.committed=[],this.redoStack=[]}isCurrentlyDrawing(){return this.isDrawing}getCurrentPointCount(){return this.currentPoints.length}destroy(){this.svg.remove()}createPath(){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","none"),t.setAttribute("stroke",C.color),t.setAttribute("stroke-width",C.width),t.setAttribute("stroke-linecap",C.linecap),t.setAttribute("stroke-linejoin",C.linejoin),t.setAttribute("style",`filter:${C.filter}`),t}}function rt(i){if(i.length===0)return"";const[t,e]=i[0];let r=`M ${t} ${e}`;for(let s=1;s<i.length;s++){const[n,o]=i[s];r+=` L ${n} ${o}`}return r}function pe(i){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;return[r,s]}const ge=5;class ye{constructor(t,e,r){this.messages=e,this.handlers=r,this.interactionActive=!0,this.pendingHighlightFrame=null,this.lastMoveX=0,this.lastMoveY=0,this.highlighter=new he(t),this.pinMarker=new ue(t),this.drawLayer=new be(t),this.overlay=new de(t,{onPointerDown:s=>this.handlePointerDown(s),onPointerMove:s=>this.handlePointerMove(s),onPointerUp:s=>this.handlePointerUp(s),onPointerCancel:()=>{this.drawLayer.isCurrentlyDrawing()&&this.finishStroke(),this.cancelPendingHighlight(),this.highlighter.hide()}})}handlePointerDown(t){t.preventDefault(),this.drawLayer.startDraw(t.clientX,t.clientY)}handlePointerMove(t){if(this.drawLayer.isCurrentlyDrawing()){this.cancelPendingHighlight(),this.drawLayer.continueDraw(t.clientX,t.clientY),this.highlighter.hide();return}this.lastMoveX=t.clientX,this.lastMoveY=t.clientY,this.pendingHighlightFrame===null&&(this.pendingHighlightFrame=requestAnimationFrame(()=>{this.pendingHighlightFrame=null,this.updateHighlight()}))}updateHighlight(){if(!this.interactionActive||this.drawLayer.isCurrentlyDrawing()||this.drawSessionActive())return;const t=st(this.lastMoveX,this.lastMoveY);t?this.highlighter.highlight(t):this.highlighter.hide()}cancelPendingHighlight(){this.pendingHighlightFrame!==null&&(cancelAnimationFrame(this.pendingHighlightFrame),this.pendingHighlightFrame=null)}handlePointerUp(t){this.drawLayer.isCurrentlyDrawing()&&this.finishStroke(t)}finishStroke(t){if(this.drawLayer.getCurrentPointCount()>=ge){this.drawLayer.commitStroke(),this.highlighter.hide(),this.handlers.onDrawStroke();return}if(this.drawLayer.cancelCurrentDraw(),this.drawLayer.hasStrokes()||!t)return;const e=st(t.clientX,t.clientY),r=e?G(e):this.messages.annotation.element,s=e?.getBoundingClientRect(),n={type:"pin",x:t.clientX,y:t.clientY,targetSelector:e?Lt(e):void 0,targetText:e?.textContent?.trim().slice(0,200)??"",targetName:r,targetRect:s?{top:s.top,left:s.left,width:s.width,height:s.height,bottom:s.bottom}:void 0};this.pinMarker.addPin(t.clientX,t.clientY),this.highlighter.select(),this.handlers.onPin(n,r)}undoDraw(){this.drawLayer.undo()}redoDraw(){this.drawLayer.redo()}canUndoDraw(){return this.drawLayer.canUndo()}canRedoDraw(){return this.drawLayer.canRedo()}hasDrawStrokes(){return this.drawLayer.hasStrokes()}drawSessionActive(){return this.drawLayer.hasStrokes()||this.drawLayer.canRedo()}getDrawAnnotation(){return this.drawLayer.getAnnotation()}clearDraw(){this.drawLayer.clearAll()}dismissInteraction(){this.interactionActive&&(this.interactionActive=!1,this.cancelPendingHighlight(),this.overlay.destroy())}hideHighlight(){this.highlighter.hide()}destroy(){this.dismissInteraction(),this.highlighter.destroy(),this.pinMarker.destroy(),this.drawLayer.destroy()}}function st(i,t){return document.elementsFromPoint(i,t).find(e=>e.id!=="mtb-widget-host")??null}const we="mtb-widget-host";function S(i){const t=document.getElementById(we);return t?t===i||t.contains(i):!1}function h(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class ve{constructor(){this.onChange=null,this.handler=()=>{this.onChange?.(this.current())}}current(){const t=window.visualViewport;return t?Math.max(0,Math.round(window.innerHeight-(t.height+t.offsetTop))):0}observe(t){const e=window.visualViewport;e&&(this.onChange=t,e.addEventListener("resize",this.handler),e.addEventListener("scroll",this.handler))}stop(){const t=window.visualViewport;this.onChange=null,t&&(t.removeEventListener("resize",this.handler),t.removeEventListener("scroll",this.handler))}}const xe=480;function ke(){return window.innerWidth<=xe}class Q{constructor(t){this.el=t,this.inset=new ve}apply(){return ke()?(this.el.style.left="",this.el.style.top="",this.el.style.maxHeight="",this.lift(this.inset.current()),this.inset.observe(t=>this.lift(t)),!0):!1}release(){this.inset.stop()}lift(t){this.el.style.bottom=t>0?`${t}px`:""}}class Se{constructor(t,e){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.sheet=new Q(this.el),this.sheet.apply(),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=>{r.isComposing||r.keyCode===229||r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),this.submit())}),this.input.focus()}buildHTML(t){return`
|
|
25
25
|
<input class="mtb-draw-input" type="text" placeholder="${h(t.draw.note_placeholder)}" />
|
|
26
26
|
<button class="mtb-draw-icon-btn mtb-draw-undo" type="button" title="${h(t.draw.undo)}" aria-label="${h(t.draw.undo)}" disabled>
|
|
27
27
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 14L4 9l5-5"/><path d="M4 9h11a5 5 0 0 1 0 10h-1"/></svg>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
`).find(m=>m.startsWith("event:")),c=a.split(`
|
|
70
70
|
`).find(m=>m.startsWith("data:"));if(!c)return;const d=l?.slice(6).trim(),u=JSON.parse(c.slice(5).trim());d==="delta"&&typeof u.text=="string"?t(u.text):d==="done"&&(n={messages:Array.isArray(u.messages)?u.messages:[],done:u.done!==!1,failed:u.error===!0})};for(;;){const{done:a,value:l}=await e.read();if(a)break;s+=r.decode(l,{stream:!0});let c;for(;(c=s.indexOf(`
|
|
71
71
|
|
|
72
|
-
`))!==-1;){const d=s.slice(0,c);s=s.slice(c+2);try{o(d)}catch{}}}if(s+=r.decode(),s.trim())try{o(s)}catch{}if(!n)throw new Error("clarify stream ended before done");return n}function Me(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}function Pe(){if(typeof crypto>"u"||typeof crypto.getRandomValues!="function")throw new Error("Secure random generation is unavailable");const i=crypto.getRandomValues(new Uint8Array(32));return Array.from(i,t=>t.toString(16).padStart(2,"0")).join("")}const Ae=2e3,Re=45e3,
|
|
72
|
+
`))!==-1;){const d=s.slice(0,c);s=s.slice(c+2);try{o(d)}catch{}}}if(s+=r.decode(),s.trim())try{o(s)}catch{}if(!n)throw new Error("clarify stream ended before done");return n}function Me(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}function Pe(){if(typeof crypto>"u"||typeof crypto.getRandomValues!="function")throw new Error("Secure random generation is unavailable");const i=crypto.getRandomValues(new Uint8Array(32));return Array.from(i,t=>t.toString(16).padStart(2,"0")).join("")}const Ae=2e3,Re=45e3,Ie=346,De=270;class He{constructor(t,e){this.pollTimer=null,this.pollDeadline=0,this.streamingBubble=null,this.lastMessages=[],this.done=!1,this.sending=!1,this.finalizing=!1,this.destroyed=!1,this.unrecoverable=!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;const r=e.element;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),this.sheet=new Q(this.el),r?this.sheet.apply():(t.append(this.el),this.positionCard(e.x,e.y,e.position??"right")),this.messagesEl=this.el.querySelector(".mtb-clarify-messages"),this.bindEvents(),this.startConversation()}positionCard(t,e,r){if(this.sheet.apply())return;const s=window.innerWidth,n=window.innerHeight,o=12,a=32,l=Math.min(Ie,s-2*o-a),c=this.el.offsetHeight||De,d=o+(r==="left"?a:0),u=s-o-(r==="right"?a:0);if(t===void 0||e===void 0){const y=Math.max(d,(s-l)/2);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`;return}let m=t+12,g=e+12;m+l>u&&(m=t-l-12),m+l>u&&(m=u-l),m<d&&(m=d),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`}buildHTML(t){return`
|
|
73
73
|
<div class="mtb-clarify-header">
|
|
74
74
|
<span class="mtb-clarify-icon">
|
|
75
75
|
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -136,8 +136,8 @@
|
|
|
136
136
|
${c}
|
|
137
137
|
${l}
|
|
138
138
|
<button class="mtb-close-link">${e.success.close}</button>
|
|
139
|
-
`,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(),$e)}bindEmailCapture(t){const e=this.el.querySelector(".mtb-email-input"),r=this.el.querySelector(".mtb-email-submit"),s=this.el.querySelector(".mtb-email-error"),n=async()=>{const o=e.value.trim();if(!Fe.test(o)){e.classList.add("mtb-email-invalid");return}e.classList.remove("mtb-email-invalid"),s.hidden=!0,r.disabled=!0,await t(o)?this.el.querySelector(".mtb-email-capture").innerHTML=`<div class="mtb-email-saved">${this.messages.success.email_saved}</div>`:(s.hidden=!1,r.disabled=!1)};r.addEventListener("click",n),e.addEventListener("keydown",o=>{o.key==="Enter"&&n()})}destroy(){this.el.remove()}}function Ue(i,t){if(i.match(/^[a-z]+:\/\//i))return i;if(i.match(/^\/\//))return window.location.protocol+i;if(i.match(/^[a-z]+:/i))return i;const e=document.implementation.createHTMLDocument(),r=e.createElement("base"),s=e.createElement("a");return e.head.appendChild(r),e.body.appendChild(s),t&&(r.href=t),s.href=i,s.href}const Oe=(()=>{let i=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(i+=1,`u${t()}${i}`)})();function v(i){const t=[];for(let e=0,r=i.length;e<r;e++)t.push(i[e]);return t}let x=null;function Pt(i={}){return x||(i.includeStyleProperties?(x=i.includeStyleProperties,x):(x=v(window.getComputedStyle(document.documentElement)),x))}function $(i,t){const r=(i.ownerDocument.defaultView||window).getComputedStyle(i).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function ze(i){const t=$(i,"border-left-width"),e=$(i,"border-right-width");return i.clientWidth+t+e}function je(i){const t=$(i,"border-top-width"),e=$(i,"border-bottom-width");return i.clientHeight+t+e}function At(i,t={}){const e=t.width||ze(i),r=t.height||je(i);return{width:e,height:r}}function qe(){let i,t;try{t=process}catch{}const e=t&&t.env?t.env.devicePixelRatio:null;return e&&(i=parseInt(e,10),Number.isNaN(i)&&(i=1)),i||window.devicePixelRatio||1}const p=16384;function Ne(i){(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))}function F(i){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=e,r.crossOrigin="anonymous",r.decoding="async",r.src=i})}async function We(i){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Ve(i,t,e){const r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),n=document.createElementNS(r,"foreignObject");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),We(s)}const b=(i,t)=>{if(i instanceof t)return!0;const e=Object.getPrototypeOf(i);return e===null?!1:e.constructor.name===t.name||b(e,t)};function Ye(i){const t=i.getPropertyValue("content");return`${i.cssText} content: '${t.replace(/'|"/g,"")}';`}function Xe(i,t){return Pt(t).map(e=>{const r=i.getPropertyValue(e),s=i.getPropertyPriority(e);return`${e}: ${r}${s?" !important":""};`}).join(" ")}function Ke(i,t,e,r){const s=`.${i}:${t}`,n=e.cssText?Ye(e):Xe(e,r);return document.createTextNode(`${s}{${n}}`)}function ot(i,t,e,r){const s=window.getComputedStyle(i,e),n=s.getPropertyValue("content");if(n===""||n==="none")return;const o=Oe();try{t.className=`${t.className} ${o}`}catch{return}const a=document.createElement("style");a.appendChild(Ke(o,e,s,r)),t.appendChild(a)}function Ge(i,t,e){ot(i,t,":before",e),ot(i,t,":after",e)}const at="application/font-woff",lt="image/jpeg",Je={woff:at,woff2:at,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:lt,jpeg:lt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Qe(i){const t=/\.([^./]*?)$/g.exec(i);return t?t[1]:""}function Z(i){const t=Qe(i).toLowerCase();return Je[t]||""}function Ze(i){return i.split(/,/)[1]}function V(i){return i.search(/^(data:)/)!==-1}function ti(i,t){return`data:${t};base64,${i}`}async function Rt(i,t,e){const r=await fetch(i,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const s=await r.blob();return new Promise((n,o)=>{const a=new FileReader;a.onerror=o,a.onloadend=()=>{try{n(e({res:r,result:a.result}))}catch(l){o(l)}},a.readAsDataURL(s)})}const j={};function ei(i,t,e){let r=i.replace(/\?.*/,"");return e&&(r=i),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function tt(i,t,e){const r=ei(i,t,e.includeQueryParams);if(j[r]!=null)return j[r];e.cacheBust&&(i+=(/\?/.test(i)?"&":"?")+new Date().getTime());let s;try{const n=await Rt(i,e.fetchRequestInit,({res:o,result:a})=>(t||(t=o.headers.get("Content-Type")||""),Ze(a)));s=ti(n,t)}catch(n){s=e.imagePlaceholder||"";let o=`Failed to fetch resource: ${i}`;n&&(o=typeof n=="string"?n:n.message),o&&console.warn(o)}return j[r]=s,s}async function ii(i){const t=i.toDataURL();return t==="data:,"?i.cloneNode(!1):F(t)}async function ri(i,t){if(i.currentSrc){const n=document.createElement("canvas"),o=n.getContext("2d");n.width=i.clientWidth,n.height=i.clientHeight,o?.drawImage(i,0,0,n.width,n.height);const a=n.toDataURL();return F(a)}const e=i.poster,r=Z(e),s=await tt(e,r,t);return F(s)}async function si(i,t){var e;try{if(!((e=i?.contentDocument)===null||e===void 0)&&e.body)return await z(i.contentDocument.body,t,!0)}catch{}return i.cloneNode(!1)}async function ni(i,t){return b(i,HTMLCanvasElement)?ii(i):b(i,HTMLVideoElement)?ri(i,t):b(i,HTMLIFrameElement)?si(i,t):i.cloneNode(Dt(i))}const oi=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SLOT",Dt=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SVG";async function ai(i,t,e){var r,s;if(Dt(t))return t;let n=[];return oi(i)&&i.assignedNodes?n=v(i.assignedNodes()):b(i,HTMLIFrameElement)&&(!((r=i.contentDocument)===null||r===void 0)&&r.body)?n=v(i.contentDocument.body.childNodes):n=v(((s=i.shadowRoot)!==null&&s!==void 0?s:i).childNodes),n.length===0||b(i,HTMLVideoElement)||await n.reduce((o,a)=>o.then(()=>z(a,e)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function li(i,t,e){const r=t.style;if(!r)return;const s=window.getComputedStyle(i);s.cssText?(r.cssText=s.cssText,r.transformOrigin=s.transformOrigin):Pt(e).forEach(n=>{let o=s.getPropertyValue(n);n==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),b(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))})}function ci(i,t){b(i,HTMLTextAreaElement)&&(t.innerHTML=i.value),b(i,HTMLInputElement)&&t.setAttribute("value",i.value)}function di(i,t){if(b(i,HTMLSelectElement)){const e=t,r=Array.from(e.children).find(s=>i.value===s.getAttribute("value"));r&&r.setAttribute("selected","")}}function hi(i,t,e){return b(t,Element)&&(li(i,t,e),Ge(i,t,e),ci(i,t),di(i,t)),t}async function ui(i,t){const e=i.querySelectorAll?i.querySelectorAll("use"):[];if(e.length===0)return i;const r={};for(let n=0;n<e.length;n++){const a=e[n].getAttribute("xlink:href");if(a){const l=i.querySelector(a),c=document.querySelector(a);!l&&c&&!r[a]&&(r[a]=await z(c,t,!0))}}const s=Object.values(r);if(s.length){const n="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg");o.setAttribute("xmlns",n),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const a=document.createElementNS(n,"defs");o.appendChild(a);for(let l=0;l<s.length;l++)a.appendChild(s[l]);i.appendChild(o)}return i}async function z(i,t,e){return!e&&t.filter&&!t.filter(i)?null:Promise.resolve(i).then(r=>ni(r,t)).then(r=>ai(i,r,t)).then(r=>hi(i,r,t)).then(r=>ui(r,t))}const It=/url\((['"]?)([^'"]+?)\1\)/g,mi=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,fi=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function bi(i){const t=i.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function pi(i){const t=[];return i.replace(It,(e,r,s)=>(t.push(s),e)),t.filter(e=>!V(e))}async function gi(i,t,e,r,s){try{const n=e?Ue(t,e):t,o=Z(t);let a;return s||(a=await tt(n,o,r)),i.replace(bi(t),`$1${a}$3`)}catch{}return i}function yi(i,{preferredFontFormat:t}){return t?i.replace(fi,e=>{for(;;){const[r,,s]=mi.exec(e)||[];if(!s)return"";if(s===t)return`src: ${r};`}}):i}function Ht(i){return i.search(It)!==-1}async function $t(i,t,e){if(!Ht(i))return i;const r=yi(i,e);return pi(r).reduce((n,o)=>n.then(a=>gi(a,o,t,e)),Promise.resolve(r))}async function k(i,t,e){var r;const s=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(i);if(s){const n=await $t(s,null,e);return t.style.setProperty(i,n,t.style.getPropertyPriority(i)),!0}return!1}async function wi(i,t){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)}async function vi(i,t){const e=b(i,HTMLImageElement);if(!(e&&!V(i.src))&&!(b(i,SVGImageElement)&&!V(i.href.baseVal)))return;const r=e?i.src:i.href.baseVal,s=await tt(r,Z(r),t);await new Promise((n,o)=>{i.onload=n,i.onerror=t.onImageErrorHandler?(...l)=>{try{n(t.onImageErrorHandler(...l))}catch(c){o(c)}}:o;const a=i;a.decode&&(a.decode=n),a.loading==="lazy"&&(a.loading="eager"),e?(i.srcset="",i.src=s):i.href.baseVal=s})}async function xi(i,t){const r=v(i.childNodes).map(s=>Ft(s,t));await Promise.all(r).then(()=>i)}async function Ft(i,t){b(i,Element)&&(await wi(i,t),await vi(i,t),await xi(i,t))}function ki(i,t){const{style:e}=i;t.backgroundColor&&(e.backgroundColor=t.backgroundColor),t.width&&(e.width=`${t.width}px`),t.height&&(e.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(s=>{e[s]=r[s]}),i}const ct={};async function dt(i){let t=ct[i];if(t!=null)return t;const r=await(await fetch(i)).text();return t={url:i,cssText:r},ct[i]=t,t}async function ht(i,t){let e=i.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,n=(e.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,i.url).href),Rt(a,t.fetchRequestInit,({result:l})=>(e=e.replace(o,`url(${l})`),[o,l]))});return Promise.all(n).then(()=>e)}function ut(i){if(i==null)return[];const t=[],e=/(\/\*[\s\S]*?\*\/)/gi;let r=i.replace(e,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=s.exec(r);if(l===null)break;t.push(l[0])}r=r.replace(s,"");const n=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(o,"gi");for(;;){let l=n.exec(r);if(l===null){if(l=a.exec(r),l===null)break;n.lastIndex=a.lastIndex}else a.lastIndex=n.lastIndex;t.push(l[0])}return t}async function Si(i,t){const e=[],r=[];return i.forEach(s=>{if("cssRules"in s)try{v(s.cssRules||[]).forEach((n,o)=>{if(n.type===CSSRule.IMPORT_RULE){let a=o+1;const l=n.href,c=dt(l).then(d=>ht(d,t)).then(d=>ut(d).forEach(u=>{try{s.insertRule(u,u.startsWith("@import")?a+=1:s.cssRules.length)}catch(m){console.error("Error inserting rule from remote css",{rule:u,error:m})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(c)}})}catch(n){const o=i.find(a=>a.href==null)||document.styleSheets[0];s.href!=null&&r.push(dt(s.href).then(a=>ht(a,t)).then(a=>ut(a).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",n)}}),Promise.all(r).then(()=>(i.forEach(s=>{if("cssRules"in s)try{v(s.cssRules||[]).forEach(n=>{e.push(n)})}catch(n){console.error(`Error while reading CSS rules from ${s.href}`,n)}}),e))}function Ei(i){return i.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ht(t.style.getPropertyValue("src")))}async function Ci(i,t){if(i.ownerDocument==null)throw new Error("Provided element is not within a Document");const e=v(i.ownerDocument.styleSheets),r=await Si(e,t);return Ei(r)}function Bt(i){return i.trim().replace(/["']/g,"")}function _i(i){const t=new Set;function e(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(n=>{t.add(Bt(n))}),Array.from(r.children).forEach(n=>{n instanceof HTMLElement&&e(n)})}return e(i),t}async function Ti(i,t){const e=await Ci(i,t),r=_i(i);return(await Promise.all(e.filter(n=>r.has(Bt(n.style.fontFamily))).map(n=>{const o=n.parentStyleSheet?n.parentStyleSheet.href:null;return $t(n.cssText,o,t)}))).join(`
|
|
140
|
-
`)}async function Li(i,t){const e=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Ti(i,t);if(e){const r=document.createElement("style"),s=document.createTextNode(e);r.appendChild(s),i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r)}}async function Mi(i,t={}){const{width:e,height:r}=At(i,t),s=await z(i,t,!0);return await Li(s,t),await Ft(s,t),ki(s,t),await Ve(s,e,r)}async function Pi(i,t={}){const{width:e,height:r}=At(i,t),s=await Mi(i,t),n=await F(s),o=document.createElement("canvas"),a=o.getContext("2d"),l=t.pixelRatio||qe(),c=t.canvasWidth||e,d=t.canvasHeight||r;return o.width=c*l,o.height=d*l,t.skipAutoScale||Ne(o),o.style.width=`${c}`,o.style.height=`${d}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,o.width,o.height)),a.drawImage(n,0,0,o.width,o.height),o}async function Ai(i,t={}){return(await Pi(i,t)).toDataURL("image/jpeg",t.quality||1)}const q=400,N=300,mt=150,ft=.3,bt=.85;function Ri(i){let t=1/0,e=1/0,r=-1/0,s=-1/0;for(const n of i)if(n.type==="pin"){if(t=Math.min(t,n.x),e=Math.min(e,n.y),r=Math.max(r,n.x),s=Math.max(s,n.y),n.targetRect){const o=n.targetRect;t=Math.min(t,o.left),e=Math.min(e,o.top),r=Math.max(r,o.left+o.width),s=Math.max(s,o.bottom)}}else if(n.type==="draw"&&n.drawPath)for(const o of Ut(n.drawPath))for(const[a,l]of o)t=Math.min(t,a),e=Math.min(e,l),r=Math.max(r,a),s=Math.max(s,l);return!isFinite(t)||!isFinite(e)?null:{minX:t,minY:e,maxX:r,maxY:s}}function Di(i,t,e){const r=Ri(i);if(!r)return null;const s=Math.max(mt,t*ft),n=Math.max(mt,e*ft);let o=r.minX-s,a=r.minY-n,l=r.maxX-r.minX+s*2,c=r.maxY-r.minY+n*2;return l<q&&(o-=(q-l)/2,l=q),c<N&&(a-=(N-c)/2,c=N),o=Math.max(0,o),a=Math.max(0,a),l=Math.min(l,t-o),c=Math.min(c,e-a),l>=t*bt&&c>=e*bt?null:{x:Math.round(o),y:Math.round(a),width:Math.round(l),height:Math.round(c)}}function Ii(i,t){const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const r=e.getContext("2d");return r&&r.drawImage(i,t.x,t.y,t.width,t.height,0,0,t.width,t.height),e}async function Hi(i=[]){try{const t=Bi(document.body),e=await Ai(document.body,{quality:.85,pixelRatio:1,backgroundColor:"#ffffff",skipFonts:!0,skipAutoScale:!1,filter:r=>!(r instanceof HTMLElement&&r.id==="mtb-widget-host")});if(i.length>0){const r=await $i(e,i,t);if(r)return r}return zi(e)}catch{return null}}async function $i(i,t,e){const r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;const n=await Oi(i);if(!n)return null;r.width=n.naturalWidth||window.innerWidth,r.height=n.naturalHeight||window.innerHeight,s.drawImage(n,0,0);const o=r.width/e.width,a=r.height/e.height;let l=0;for(const d of t)d.type==="draw"&&d.drawPath?Fi(s,d.drawPath,e,o,a):d.type==="pin"&&Ui(s,(d.x-e.left)*o,(d.y-e.top)*a,++l);const c=Di(t,window.innerWidth,window.innerHeight);if(c){const d=Math.max(0,Math.round((c.x-e.left)*o)),u=Math.max(0,Math.round((c.y-e.top)*a)),m=Math.min(r.width,Math.round((c.x+c.width-e.left)*o)),g=Math.min(r.height,Math.round((c.y+c.height-e.top)*a)),y={x:d,y:u,width:m-d,height:g-u};return pt(Ii(r,y))}return pt(r)}function Fi(i,t,e,r,s){i.save(),i.strokeStyle=O,i.lineWidth=3.5,i.lineCap="round",i.lineJoin="round",i.shadowColor=J(.35),i.shadowOffsetY=1,i.shadowBlur=2;for(const n of Ut(t))if(n.length!==0){i.beginPath(),i.moveTo((n[0][0]-e.left)*r,(n[0][1]-e.top)*s);for(let o=1;o<n.length;o++)i.lineTo((n[o][0]-e.left)*r,(n[o][1]-e.top)*s);i.stroke()}i.restore()}function Bi(i){const t=i.getBoundingClientRect(),e=window.getComputedStyle(i),r=parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),s=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth);return{left:t.left,top:t.top,width:i.clientWidth+(Number.isFinite(r)?r:0)||window.innerWidth,height:i.clientHeight+(Number.isFinite(s)?s:0)||window.innerHeight}}function Ui(i,t,e,r){i.save(),i.shadowColor=J(.45),i.shadowOffsetY=2,i.shadowBlur=8,i.fillStyle=O,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 ${fe}`,i.textAlign="center",i.textBaseline="middle",i.fillText(String(r),t,e),i.restore()}function Ut(i){const t=[];let e=null;const r=i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g)??[];for(const s of r){const[n,o]=s.slice(1).trim().split(/\s+/).map(Number);Number.isNaN(n)||Number.isNaN(o)||(s[0]==="M"?(e=[[n,o]],t.push(e)):e&&e.push([n,o]))}return t}function Oi(i){return new Promise(t=>{const e=new Image;e.onload=()=>t(e),e.onerror=()=>t(null),e.src=i})}function pt(i){return new Promise(t=>{try{i.toBlob(e=>t(e),"image/jpeg",.85)}catch{t(null)}})}function zi(i){const[t,e]=i.split(","),r=t.match(/:(.*?);/)?.[1]??"image/png",s=atob(e),n=new Uint8Array(s.length);for(let o=0;o<s.length;o++)n[o]=s.charCodeAt(o);return new Blob([n],{type:r})}class ji{constructor(){this.listeners=new Set,this.originalOnError=null,this.installedOnError=null,this.rejectionHandler=null,this.hooked=!1}subscribe(t){return this.listeners.add(t),this.hook(),()=>{this.listeners.delete(t),this.listeners.size===0&&this.unhook()}}hook(){this.hooked||(this.hooked=!0,this.originalOnError=window.onerror,this.installedOnError=(t,e,r,s,n)=>(this.emit({message:String(t),source:e,line:r,col:s,error:n}),this.originalOnError?this.originalOnError.call(window,t,e,r,s,n):!1),window.onerror=this.installedOnError,this.rejectionHandler=t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason);this.emit({message:`Unhandled rejection: ${e}`})},window.addEventListener("unhandledrejection",this.rejectionHandler))}unhook(){this.hooked&&(this.hooked=!1,window.onerror===this.installedOnError&&(window.onerror=this.originalOnError),this.installedOnError=null,this.originalOnError=null,this.rejectionHandler&&(window.removeEventListener("unhandledrejection",this.rejectionHandler),this.rejectionHandler=null))}emit(t){for(const e of this.listeners)e(t)}}const et=new ji,qi=20;class Ni{constructor(){this.errors=[],this.unsubscribe=null}start(){this.unsubscribe||(this.unsubscribe=et.subscribe(t=>this.record(t)))}record(t){const e=t.line!=null?` (${t.line}:${t.col??0})`:"";this.addError(`${t.message}${e}`)}addError(t){this.errors.length>=qi||this.errors.includes(t)||this.errors.push(t)}getErrors(){return[...this.errors]}stop(){this.unsubscribe?.(),this.unsubscribe=null}}const I=new Set;let L=null,M=null,P=null,B=null,A=null;function Ot(i){I.add(i),Wi();let t=!1;return()=>{t||(t=!0,I.delete(i),I.size===0&&Vi())}}function W(){for(const i of[...I])try{i()}catch{}}function Wi(){if(P)return;A=()=>W(),window.addEventListener("popstate",A),L=history.pushState,M=history.replaceState;const i=L,t=M;P=function(e,r,s){i.call(history,e,r,s),W()},B=function(e,r,s){t.call(history,e,r,s),W()},history.pushState=P,history.replaceState=B}function Vi(){A&&(window.removeEventListener("popstate",A),A=null),L&&history.pushState===P&&(history.pushState=L),M&&history.replaceState===B&&(history.replaceState=M),L=null,M=null,P=null,B=null}const Yi=20;class Xi{constructor(){this.breadcrumbs=[],this.active=!1,this.unsubscribeErrors=null,this.unsubscribeNavigation=null,this.lastUrl="",this.boundClickHandler=t=>this.handleClick(t),this.boundChangeHandler=t=>this.handleChange(t)}start(){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=et.subscribe(t=>this.recordError(t)),this.unsubscribeNavigation=Ot(()=>this.handleNavigation()))}stop(){this.active&&(this.active=!1,document.removeEventListener("click",this.boundClickHandler,!0),document.removeEventListener("change",this.boundChangeHandler,!0),this.unsubscribeErrors?.(),this.unsubscribeErrors=null,this.unsubscribeNavigation?.(),this.unsubscribeNavigation=null)}getBreadcrumbs(){return[...this.breadcrumbs]}add(t){this.breadcrumbs.push(t),this.breadcrumbs.length>Yi&&this.breadcrumbs.shift()}handleClick(t){const e=t.target;if(e&&!S(e))try{this.add({type:"ui",category:"ui.click",timestamp:Date.now(),message:G(e),data:{selector:Lt(e)}})}catch{}}handleChange(t){const e=t.target;if(e&&!S(e))try{const r=e,s=r.name||r.placeholder||e.getAttribute("aria-label")||e.tagName;this.add({type:"ui",category:"ui.input",timestamp:Date.now(),message:s,data:{field:s}})}catch{}}recordError(t){this.add({type:"console",category:"console.error",timestamp:Date.now(),message:t.message,data:{message:t.message}})}handleNavigation(){if(!this.active)return;const t=this.lastUrl,e=location.href;t!==e&&(this.lastUrl=e,this.add({type:"navigation",category:"navigation",timestamp:Date.now(),message:`${t} → ${e}`,data:{from:t,to:e}}))}}const zt="mtb_frustration_state";let Y=null;function U(){try{const i=window.sessionStorage.getItem(zt);return H(i?JSON.parse(i):Y)}catch{return H(Y)}}function jt(i){const t=H(i);Y=t;try{window.sessionStorage.setItem(zt,JSON.stringify(t))}catch{}}function Ki(){return U().dismissedByUser}function Gi(){jt({...U(),dismissedByUser:!0})}function H(i){const t=i??{};return{navTimestamps:Array.isArray(t.navTimestamps)?t.navTimestamps.filter(e=>typeof e=="number"):[],cooldownUntil:typeof t.cooldownUntil=="number"?t.cooldownUntil:0,errorPageUrls:Array.isArray(t.errorPageUrls)?t.errorPageUrls.filter(e=>typeof e=="string").slice(-20):[],dismissedByUser:t.dismissedByUser===!0}}const Ji=3,Qi=1e3,Zi=3,tr=5e3,gt=500,er=500,ir=300,rr=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL","SUMMARY","DETAILS"]),sr=new Set(["button","link","checkbox","radio","tab","menuitem","option","switch","textbox","combobox","listbox","slider","spinbutton"]),yt=["404","500","not found","page not found","server error","internal server error"],R=class R{constructor(t){this.clickHistory=[],this.unsubscribeErrors=null,this.active=!1,this.errorCount=0,this.deadClickCount=0,this.cooldownUntil=0,this.navTimestamps=[],this.unsubscribeNavigation=null,this.boundPageLeaveHandler=null,this.lastNavigationAt=-1,this.boundSubmitHandler=null,this.boundInvalidHandler=null,this.recentSubmitForms=new WeakSet,this.errorPageUrls=new Set,this.domObserver=null,this.pendingDomChecks=0,this.lastMutationAt=-1,this.onFrustration=t,this.boundClickHandler=e=>this.handleClick(e)}start(){this.active||(this.active=!0,this.restoreState(),document.addEventListener("click",this.boundClickHandler,!0),this.unsubscribeErrors=et.subscribe(t=>{this.errorCount++}),this.startNavigationTracking(),this.startFormTracking(),this.checkErrorPage())}stop(){this.active&&(this.active=!1,document.removeEventListener("click",this.boundClickHandler,!0),this.unsubscribeErrors?.(),this.unsubscribeErrors=null,this.clickHistory=[],this.stopNavigationTracking(),this.stopFormTracking(),this.errorPageUrls.clear(),this.disconnectDomObserver())}startNavigationTracking(){this.unsubscribeNavigation=Ot(()=>this.handleNavigation()),this.boundPageLeaveHandler=()=>this.noteNavigationStarted(),window.addEventListener("beforeunload",this.boundPageLeaveHandler),window.addEventListener("pagehide",this.boundPageLeaveHandler)}stopNavigationTracking(){this.unsubscribeNavigation?.(),this.unsubscribeNavigation=null,this.navTimestamps=[],this.boundPageLeaveHandler&&(window.removeEventListener("beforeunload",this.boundPageLeaveHandler),window.removeEventListener("pagehide",this.boundPageLeaveHandler),this.boundPageLeaveHandler=null),this.lastNavigationAt=-1}noteNavigationStarted(){this.lastNavigationAt=Date.now()}restoreState(){const t=U();this.navTimestamps=t.navTimestamps,this.cooldownUntil=t.cooldownUntil,this.errorPageUrls=new Set(t.errorPageUrls)}persistState(){const t=U();jt({...t,navTimestamps:this.navTimestamps,cooldownUntil:this.cooldownUntil,errorPageUrls:[...this.errorPageUrls]})}startFormTracking(){this.boundSubmitHandler=t=>this.handleFormSubmit(t),this.boundInvalidHandler=t=>this.handleFormInvalid(t),document.addEventListener("submit",this.boundSubmitHandler,!0),document.addEventListener("invalid",this.boundInvalidHandler,!0)}stopFormTracking(){this.boundSubmitHandler&&(document.removeEventListener("submit",this.boundSubmitHandler,!0),this.boundSubmitHandler=null),this.boundInvalidHandler&&(document.removeEventListener("invalid",this.boundInvalidHandler,!0),this.boundInvalidHandler=null)}handleClick(t){const e=t.target;if(!e||S(e))return;this.trackFormSubmitIntent(e);const r=Date.now();this.clickHistory.push({target:e,time:r});const s=r-Qi;if(this.clickHistory=this.clickHistory.filter(o=>o.time>s),this.clickHistory.filter(o=>o.target===e).length>=Ji){this.clickHistory=[],this.emitHighPriority({signal:"rage_click",target:_(e),timestamp:r});return}this.isInteractive(e)||(this.deadClickCount++,this.deadClickCount>=3&&this.errorCount>0&&(this.deadClickCount=0,this.errorCount=0,this.emitIfReady({signal:"dead_click",target:_(e),timestamp:r}))),this.checkDeadClickDom(e,r)}handleNavigation(){const t=Date.now();this.noteNavigationStarted(),this.navTimestamps.push(t);const e=t-tr;this.navTimestamps=this.navTimestamps.filter(r=>r>e),this.navTimestamps.length>=Zi&&(this.navTimestamps=[],this.emitIfReady({signal:"rapid_navigation",timestamp:t})),this.persistState(),setTimeout(()=>{this.active&&this.checkErrorPage()},ir)}handleFormSubmit(t){const e=t.target;e instanceof HTMLFormElement&&(S(e)||(this.rememberSubmitAttempt(e),setTimeout(()=>{this.active&&e.querySelector('[aria-invalid="true"], .is-invalid')&&this.emitIfReady({signal:"form_failure",target:_(e),timestamp:Date.now()})},gt)))}trackFormSubmitIntent(t){const e=t.closest("button, input");(e instanceof HTMLButtonElement||e instanceof HTMLInputElement)&&(e.type!=="submit"&&e.type!=="image"||!e.form||S(e.form)||this.rememberSubmitAttempt(e.form))}rememberSubmitAttempt(t){this.recentSubmitForms.add(t),setTimeout(()=>{this.recentSubmitForms.delete(t)},gt)}handleFormInvalid(t){const e=t.target;if(!e||S(e))return;const r=e.closest("form");!r||!this.recentSubmitForms.has(r)||this.emitIfReady({signal:"form_failure",target:_(r),timestamp:Date.now()})}checkErrorPage(){const t=location.href;if(this.errorPageUrls.has(t))return;const e=document.title.toLowerCase();if(yt.some(s=>e.includes(s))){this.errorPageUrls.add(t),this.emitHighPriority({signal:"error_page",detail:document.title,timestamp:Date.now()});return}const r=document.querySelectorAll('h1, h2, [class*="error"], [class*="not-found"], [id*="error"], [id*="not-found"]');for(const s of r){const n=s.textContent??"";if(n.length<200&&yt.some(o=>n.toLowerCase().includes(o))){this.errorPageUrls.add(t),this.emitHighPriority({signal:"error_page",detail:n.trim().slice(0,60),timestamp:Date.now()});return}}}checkDeadClickDom(t,e){this.looksInteractive(t)&&(this.pendingDomChecks++,this.ensureDomObserver(),setTimeout(()=>{this.pendingDomChecks--;const r=this.lastMutationAt>=e,s=this.lastNavigationAt>=e;this.pendingDomChecks===0&&this.disconnectDomObserver(),!r&&!s&&this.active&&this.emitIfReady({signal:"dead_click_dom",target:_(t),timestamp:e})},er))}ensureDomObserver(){this.domObserver||(this.domObserver=new MutationObserver(()=>{this.lastMutationAt=Date.now()}),this.domObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}disconnectDomObserver(){this.domObserver?.disconnect(),this.domObserver=null}looksInteractive(t){if(window.getComputedStyle(t).cursor==="pointer")return!0;if(t.classList)for(const r of t.classList){const s=r.toLowerCase();if(s.includes("btn")||s.includes("button"))return!0}return!1}isInteractive(t){if(rr.has(t.tagName))return!0;const e=t.getAttribute("role");return!!(e&&sr.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'))}emitIfReady(t){const e=Date.now();e<this.cooldownUntil||(this.cooldownUntil=e+R.COOLDOWN_MS,this.persistState(),this.onFrustration(t))}emitHighPriority(t){this.cooldownUntil=Date.now()+R.COOLDOWN_MS,this.persistState(),this.onFrustration(t)}};R.COOLDOWN_MS=6e4;let X=R;function _(i){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)??"";return`<${t}${e}${r}>${s?` "${s}"`:""}`}function nr(){return{page_url:window.location.href,user_agent:navigator.userAgent,browser:or(),os:ar(),screen_width:window.screen.width,screen_height:window.screen.height}}function or(){const i=navigator.userAgent;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"}function ar(){const i=navigator.userAgent;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"}function lr(i,t,e,r,s,n,o,a,l){return{description:i,...t,console_errors:e,annotations:r?[r]:[],target_element:r?.targetSelector?{selector:r.targetSelector,text:r.targetText??"",name:r.targetName??""}:void 0,user_id:s?.id,user_email:s?.email,user_name:s?.name,reporter_external_id:s?void 0:o,reporter_email:s?void 0:a,recording_events:n?.events,recording_duration:n?.duration,breadcrumbs:l}}const wt="mtb_anon_id",qt="mtb_reporter_email",Nt="mtb_board_url";let vt=null,Wt=null,Vt=null;function xt(){try{const i=window.localStorage.getItem(wt);if(i?.startsWith("anon_"))return i;const t=Et();return window.localStorage.setItem(wt,t),t}catch{return vt??(vt=Et()),vt}}function kt(){try{return window.localStorage.getItem(qt)??void 0}catch{return Wt??void 0}}function cr(i){Wt=i;try{window.localStorage.setItem(qt,i)}catch{}}function dr(){try{return window.localStorage.getItem(Nt)??void 0}catch{return Vt??void 0}}function St(i){Vt=i;try{window.localStorage.setItem(Nt,i)}catch{}}function Et(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`anon_${crypto.randomUUID()}`:`anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}`}const hr={tab:"Feedback",toolbar:{markup:"Mark up",record:"Record",hint:"Click to comment, drag to draw",hintRecord:"Recording your screen",exit:"Exit"},popup:{about:"About",placeholder:"Describe the issue or suggestion...",submit:"Submit",cancel:"Cancel",my_feedback:"My feedback",quickOptions:[{emoji:"🐛",label:"Something's broken"},{emoji:"💡",label:"I have a suggestion"},{emoji:"🤔",label:"I'm confused"}]},success:{title:"Sent — thanks!",message:"Your note and captured technical context are on their way to the team. You’ll hear back when it’s resolved.",title_no_ai:"Thanks! We've received your feedback.",message_no_ai:"The team will take it from here. You'll hear back when it's resolved.",view_feedback:"View my feedback",close:"Close",email_prompt:"Want updates? Leave your email and we'll let you know when it's resolved.",email_placeholder:"you@example.com",email_submit:"Notify me",email_saved:"You'll get an email when it's resolved.",email_error:"Couldn't save your email. Please try again."},error:{submit:"Failed to submit. Please try again."},pet:{bubble:"Need help?"},frustration:{prompt:"Something not working? Tell us.",action:"Annotate",dismiss:"Dismiss"},annotation:{drawing:"Drawing",element:"element"},draw:{note_placeholder:"Add a note to your drawing",undo:"Undo",redo:"Redo",cancel:"Cancel",submit:"Submit"},record:{stop:"Stop",timer_label:"Recording",max_reached:"Maximum recording time reached",replay_label:"screen-recording.json",play:"Play recording",close:"Close",preview_unavailable:"Preview unavailable"},clarify:{title:"Make This Better AI",subtitle:"Sharpening your feedback",thinking:"Thinking...",placeholder:"Type your answer — or skip the question",send:"Send",send_feedback:"Send feedback",skip:"Skip & send",retry:"Retry",error:"AI clarification failed. Please try again.",expired:"This feedback session expired before it could be sent. Please close the widget and submit again."}},ur={tab:"反馈",toolbar:{markup:"标注",record:"录屏",hint:"点击评论,拖动绘制",hintRecord:"正在录制屏幕",exit:"退出"},popup:{about:"关于",placeholder:"描述问题或建议...",submit:"提交",cancel:"取消",my_feedback:"我的反馈",quickOptions:[{emoji:"🐛",label:"出问题了"},{emoji:"💡",label:"我有一个建议"},{emoji:"🤔",label:"我有点困惑"}]},success:{title:"已发送,感谢!",message:"您的反馈和采集到的技术上下文正在发送给团队。问题解决后,您会收到通知。",title_no_ai:"感谢!我们已收到您的反馈。",message_no_ai:"接下来由团队处理。问题解决后,您会收到通知。",view_feedback:"查看我的反馈",close:"关闭",email_prompt:"想了解进展?留下邮箱,问题解决后我们会通知您。",email_placeholder:"you@example.com",email_submit:"通知我",email_saved:"问题解决后您会收到邮件通知。",email_error:"邮箱保存失败,请重试。"},error:{submit:"提交失败,请重试。"},pet:{bubble:"需要帮助吗?"},frustration:{prompt:"遇到问题了?告诉我们。",action:"标注",dismiss:"关闭"},annotation:{drawing:"绘制",element:"元素"},draw:{note_placeholder:"给你的绘制添加说明",undo:"撤销",redo:"重做",cancel:"取消",submit:"提交"},record:{stop:"停止",timer_label:"录制中",max_reached:"已达到最长录制时间",replay_label:"screen-recording.json",play:"播放录屏",close:"关闭",preview_unavailable:"暂无法预览"},clarify:{title:"Make This Better AI",subtitle:"正在完善你的反馈",thinking:"思考中...",placeholder:"输入回答,或跳过问题",send:"发送",send_feedback:"发送反馈",skip:"跳过并发送",retry:"重试",error:"AI 澄清失败,请重试。",expired:"这条反馈在发送前已过期。请关闭组件后重新提交。"}},mr={tab:"フィードバック",toolbar:{markup:"マークアップ",record:"録画",hint:"クリックでコメント、ドラッグで描画",hintRecord:"画面を録画中",exit:"終了"},popup:{about:"概要",placeholder:"問題や提案を入力してください...",submit:"送信",cancel:"キャンセル",my_feedback:"自分のフィードバック",quickOptions:[{emoji:"🐛",label:"不具合があります"},{emoji:"💡",label:"提案があります"},{emoji:"🤔",label:"わかりにくいです"}]},success:{title:"送信しました。ありがとうございます!",message:"ご意見と取得した技術情報をチームに送信しました。解決次第お知らせします。",title_no_ai:"ありがとうございます!フィードバックを受け付けました。",message_no_ai:"チームが対応します。解決次第お知らせします。",view_feedback:"フィードバックを確認",close:"閉じる",email_prompt:"進捗を知りたい場合は、メールアドレスをご記入ください。解決次第お知らせします。",email_placeholder:"you@example.com",email_submit:"通知を受け取る",email_saved:"解決次第メールでお知らせします。",email_error:"メールアドレスを保存できませんでした。もう一度お試しください。"},error:{submit:"送信に失敗しました。もう一度お試しください。"},pet:{bubble:"お困りですか?"},frustration:{prompt:"うまくいかないことがありますか?お知らせください。",action:"注釈",dismiss:"閉じる"},annotation:{drawing:"描画",element:"要素"},draw:{note_placeholder:"描画にメモを追加",undo:"元に戻す",redo:"やり直す",cancel:"キャンセル",submit:"送信"},record:{stop:"停止",timer_label:"録画中",max_reached:"最大記録時間に達しました",replay_label:"screen-recording.json",play:"録画を再生",close:"閉じる",preview_unavailable:"プレビューは利用できません"},clarify:{title:"Make This Better AI",subtitle:"フィードバックを整えています",thinking:"考え中...",placeholder:"回答を入力、または質問をスキップ",send:"送信",send_feedback:"フィードバックを送信",skip:"スキップして送信",retry:"再試行",error:"AIによる確認に失敗しました。もう一度お試しください。",expired:"このフィードバックは送信される前に有効期限が切れました。ウィジェットを閉じて、もう一度送信してください。"}},fr={tab:"피드백",toolbar:{markup:"마크업",record:"녹화",hint:"클릭하여 댓글, 드래그하여 그리기",hintRecord:"화면 녹화 중",exit:"나가기"},popup:{about:"정보",placeholder:"문제 또는 제안 사항을 설명해 주세요...",submit:"제출",cancel:"취소",my_feedback:"내 피드백",quickOptions:[{emoji:"🐛",label:"문제가 있어요"},{emoji:"💡",label:"제안이 있어요"},{emoji:"🤔",label:"헷갈려요"}]},success:{title:"전송되었습니다. 감사합니다!",message:"피드백과 수집된 기술 정보가 팀에 전달되었습니다. 해결되면 알려드리겠습니다.",title_no_ai:"감사합니다! 피드백을 접수했습니다.",message_no_ai:"팀에서 처리합니다. 해결되면 알려드리겠습니다.",view_feedback:"내 피드백 보기",close:"닫기",email_prompt:"진행 상황이 궁금하신가요? 이메일을 남겨주시면 해결 시 알려드립니다.",email_placeholder:"you@example.com",email_submit:"알림 받기",email_saved:"해결되면 이메일로 알려드립니다.",email_error:"이메일을 저장하지 못했습니다. 다시 시도해 주세요."},error:{submit:"제출에 실패했습니다. 다시 시도해 주세요."},pet:{bubble:"도움이 필요하신가요?"},frustration:{prompt:"문제가 있으신가요? 알려 주세요.",action:"주석",dismiss:"닫기"},annotation:{drawing:"그리기",element:"요소"},draw:{note_placeholder:"그림에 메모 추가",undo:"실행 취소",redo:"다시 실행",cancel:"취소",submit:"보내기"},record:{stop:"중지",timer_label:"녹화 중",max_reached:"최대 녹화 시간에 도달했습니다",replay_label:"screen-recording.json",play:"녹화 재생",close:"닫기",preview_unavailable:"미리보기를 사용할 수 없습니다"},clarify:{title:"Make This Better AI",subtitle:"피드백을 다듬는 중",thinking:"생각 중...",placeholder:"답변을 입력하거나 질문을 건너뛰세요",send:"보내기",send_feedback:"피드백 보내기",skip:"건너뛰고 보내기",retry:"재시도",error:"AI 확인에 실패했습니다. 다시 시도해 주세요.",expired:"이 피드백 세션은 전송되기 전에 만료되었습니다. 위젯을 닫고 다시 보내 주세요."}},br={tab:"Comentarios",toolbar:{markup:"Anotar",record:"Grabar",hint:"Clic para comentar, arrastrar para dibujar",hintRecord:"Grabando pantalla",exit:"Salir"},popup:{about:"Acerca de",placeholder:"Describe el problema o sugerencia...",submit:"Enviar",cancel:"Cancelar",my_feedback:"Mis comentarios",quickOptions:[{emoji:"🐛",label:"Algo no funciona"},{emoji:"💡",label:"Tengo una sugerencia"},{emoji:"🤔",label:"Estoy confundido"}]},success:{title:"Enviado, ¡gracias!",message:"Tu nota y el contexto técnico capturado se han enviado al equipo. Te avisaremos cuando se resuelva.",title_no_ai:"¡Gracias! Hemos recibido tu comentario.",message_no_ai:"El equipo se encargará a partir de aquí. Te avisaremos cuando se resuelva.",view_feedback:"Ver mis comentarios",close:"Cerrar",email_prompt:"¿Quieres novedades? Deja tu correo y te avisaremos cuando se resuelva.",email_placeholder:"tu@ejemplo.com",email_submit:"Avisarme",email_saved:"Recibirás un correo cuando se resuelva.",email_error:"No se pudo guardar tu correo. Inténtalo de nuevo."},error:{submit:"Error al enviar. Por favor, inténtalo de nuevo."},pet:{bubble:"¿Necesitas ayuda?"},frustration:{prompt:"¿Algo no funciona? Cuéntanos.",action:"Anotar",dismiss:"Cerrar"},annotation:{drawing:"Dibujo",element:"elemento"},draw:{note_placeholder:"Añade una nota a tu dibujo",undo:"Deshacer",redo:"Rehacer",cancel:"Cancelar",submit:"Enviar"},record:{stop:"Detener",timer_label:"Grabando",max_reached:"Tiempo máximo de grabación alcanzado",replay_label:"screen-recording.json",play:"Reproducir grabación",close:"Cerrar",preview_unavailable:"Vista previa no disponible"},clarify:{title:"Make This Better AI",subtitle:"Afinando tus comentarios",thinking:"Pensando...",placeholder:"Escribe tu respuesta — u omite la pregunta",send:"Enviar",send_feedback:"Enviar comentario",skip:"Omitir y enviar",retry:"Reintentar",error:"No se pudo completar la aclaración con IA. Inténtalo de nuevo.",expired:"Esta sesión de comentarios caducó antes de poder enviarse. Cierra el widget y envíalo de nuevo."}},pr={tab:"Avis",toolbar:{markup:"Annoter",record:"Enregistrer",hint:"Cliquer pour commenter, glisser pour dessiner",hintRecord:"Enregistrement de l'écran",exit:"Quitter"},popup:{about:"À propos",placeholder:"Décrivez le problème ou votre suggestion...",submit:"Envoyer",cancel:"Annuler",my_feedback:"Mes avis",quickOptions:[{emoji:"🐛",label:"Quelque chose ne fonctionne pas"},{emoji:"💡",label:"J'ai une suggestion"},{emoji:"🤔",label:"Je suis perplexe"}]},success:{title:"Envoyé, merci !",message:"Votre message et le contexte technique collecté ont été transmis à l’équipe. Vous serez informé(e) dès que ce sera résolu.",title_no_ai:"Merci ! Nous avons bien reçu votre avis.",message_no_ai:"L’équipe prend le relais. Vous serez informé(e) dès que ce sera résolu.",view_feedback:"Voir mes avis",close:"Fermer",email_prompt:"Envie de suivre l'avancement ? Laissez votre e-mail et nous vous préviendrons une fois résolu.",email_placeholder:"vous@exemple.com",email_submit:"Me prévenir",email_saved:"Vous recevrez un e-mail une fois résolu.",email_error:"Impossible d'enregistrer votre e-mail. Veuillez réessayer."},error:{submit:"Échec de l'envoi. Veuillez réessayer."},pet:{bubble:"Besoin d'aide ?"},frustration:{prompt:"Un problème ? Dites-le-nous.",action:"Annoter",dismiss:"Fermer"},annotation:{drawing:"Dessin",element:"élément"},draw:{note_placeholder:"Ajoutez une note à votre dessin",undo:"Annuler",redo:"Rétablir",cancel:"Annuler",submit:"Envoyer"},record:{stop:"Arrêter",timer_label:"Enregistrement",max_reached:"Durée maximale d'enregistrement atteinte",replay_label:"screen-recording.json",play:"Lire l'enregistrement",close:"Fermer",preview_unavailable:"Aperçu indisponible"},clarify:{title:"Make This Better AI",subtitle:"Affinement de votre retour",thinking:"Réflexion...",placeholder:"Saisissez votre réponse — ou ignorez la question",send:"Envoyer",send_feedback:"Envoyer le retour",skip:"Ignorer et envoyer",retry:"Réessayer",error:"La clarification par IA a échoué. Réessayez.",expired:"Cette session de retour a expiré avant d'avoir pu être envoyée. Fermez le widget et renvoyez-la."}},gr={tab:"Feedback",toolbar:{markup:"Markieren",record:"Aufnehmen",hint:"Klicken zum Kommentieren, ziehen zum Zeichnen",hintRecord:"Bildschirm wird aufgenommen",exit:"Beenden"},popup:{about:"Info",placeholder:"Beschreiben Sie das Problem oder Ihren Vorschlag...",submit:"Absenden",cancel:"Abbrechen",my_feedback:"Mein Feedback",quickOptions:[{emoji:"🐛",label:"Etwas funktioniert nicht"},{emoji:"💡",label:"Ich habe einen Vorschlag"},{emoji:"🤔",label:"Ich bin verwirrt"}]},success:{title:"Gesendet, vielen Dank!",message:"Ihre Nachricht und der erfasste technische Kontext wurden an das Team gesendet. Sie werden benachrichtigt, sobald das Problem gelöst ist.",title_no_ai:"Vielen Dank! Wir haben Ihr Feedback erhalten.",message_no_ai:"Das Team übernimmt ab hier. Sie werden benachrichtigt, sobald das Problem gelöst ist.",view_feedback:"Mein Feedback ansehen",close:"Schließen",email_prompt:"Updates gewünscht? Hinterlassen Sie Ihre E-Mail und wir melden uns, sobald es gelöst ist.",email_placeholder:"sie@beispiel.de",email_submit:"Benachrichtigen",email_saved:"Sie erhalten eine E-Mail, sobald es gelöst ist.",email_error:"E-Mail konnte nicht gespeichert werden. Bitte versuchen Sie es erneut."},error:{submit:"Senden fehlgeschlagen. Bitte versuchen Sie es erneut."},pet:{bubble:"Brauchen Sie Hilfe?"},frustration:{prompt:"Etwas funktioniert nicht? Sagen Sie es uns.",action:"Kommentieren",dismiss:"Schließen"},annotation:{drawing:"Zeichnung",element:"Element"},draw:{note_placeholder:"Fügen Sie Ihrer Zeichnung eine Notiz hinzu",undo:"Rückgängig",redo:"Wiederholen",cancel:"Abbrechen",submit:"Absenden"},record:{stop:"Stopp",timer_label:"Aufnahme",max_reached:"Maximale Aufnahmedauer erreicht",replay_label:"screen-recording.json",play:"Aufnahme abspielen",close:"Schließen",preview_unavailable:"Vorschau nicht verfügbar"},clarify:{title:"Make This Better AI",subtitle:"Wir schärfen dein Feedback",thinking:"Einen Moment...",placeholder:"Antwort eingeben — oder Frage überspringen",send:"Senden",send_feedback:"Feedback senden",skip:"Überspringen & senden",retry:"Erneut versuchen",error:"Die KI-Klärung ist fehlgeschlagen. Bitte erneut versuchen.",expired:"Diese Feedback-Sitzung ist abgelaufen, bevor sie gesendet werden konnte. Bitte schließe das Widget und sende erneut."}},T={en:hr,"zh-CN":ur,ja:mr,ko:fr,es:br,fr:pr,de:gr};function Ct(i){if(T[i])return T[i];const t=i.split("-")[0];return T[t]?T[t]:T.en}const yr=60,wr="rr-block",vr="rr-mask",xr="https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js",kr="sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";let D=null;function Sr(){return D||(D=Er().catch(()=>Cr()),D)}async function Er(){return(await import("@rrweb/record")).record}function _t(){const i=globalThis;return i.rrwebRecord?.record??i.rrweb?.record}function Cr(){return new Promise((i,t)=>{const e=_t();if(e){i(e);return}const r=document.createElement("script");r.src=xr,r.integrity=kr,r.crossOrigin="anonymous",r.onload=()=>{const s=_t();s?i(s):t(new Error("rrweb record global not found after script load"))},r.onerror=()=>t(new Error("Failed to load rrweb from CDN")),document.head.appendChild(r)})}class _r{constructor(t,e,r={}){this.events=[],this.stopFn=null,this.startedAt=0,this.timer=null,this.clickHandler=null,this.stopped=!1,this.destroyed=!1,this.shadow=t,this.onMaxReached=e,this.options=r}async start(){const t=await Sr();this.destroyed||(this.startedAt=Date.now(),this.stopped=!1,this.stopFn=t({emit:e=>{this.stopped||this.events.push(e)},maskAllInputs:this.options.maskAllInputs??!0,blockClass:wr,maskTextClass:vr}),this.clickHandler=e=>{this.showClickRipple(e.clientX,e.clientY),t.addCustomEvent?.("mtb-click",{x:e.clientX,y:e.clientY,target:e.target instanceof HTMLElement?e.target.tagName:""})},document.addEventListener("click",this.clickHandler,!0),this.timer=setTimeout(()=>{this.onMaxReached?.()},yr*1e3))}stop(){return this.stopped=!0,this.stopFn?.(),this.stopFn=null,this.cleanupTimer(),this.cleanupClickHandler(),{events:this.events,duration:this.getDuration()}}getDuration(){return this.startedAt===0?0:Math.max(1,Math.round((Date.now()-this.startedAt)/1e3))}destroy(){this.destroyed=!0,this.stopped=!0,this.stopFn?.(),this.stopFn=null,this.cleanupTimer(),this.cleanupClickHandler(),this.events=[],this.startedAt=0}cleanupTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}cleanupClickHandler(){this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null)}showClickRipple(t,e){const r=this.shadow.el("div","mtb-click-ripple");r.style.left=`${t}px`,r.style.top=`${e}px`,this.shadow.append(r),r.addEventListener("animationend",()=>r.remove())}}class Tr{constructor(t,e,r,s){this.intervalId=null,this.getDuration=r,this.el=t.el("div","mtb-record-bar"),this.el.innerHTML=`
|
|
139
|
+
`,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(),$e)}bindEmailCapture(t){const e=this.el.querySelector(".mtb-email-input"),r=this.el.querySelector(".mtb-email-submit"),s=this.el.querySelector(".mtb-email-error"),n=async()=>{const o=e.value.trim();if(!Fe.test(o)){e.classList.add("mtb-email-invalid");return}e.classList.remove("mtb-email-invalid"),s.hidden=!0,r.disabled=!0,await t(o)?this.el.querySelector(".mtb-email-capture").innerHTML=`<div class="mtb-email-saved">${this.messages.success.email_saved}</div>`:(s.hidden=!1,r.disabled=!1)};r.addEventListener("click",n),e.addEventListener("keydown",o=>{o.key==="Enter"&&n()})}destroy(){this.el.remove()}}function Ue(i,t){if(i.match(/^[a-z]+:\/\//i))return i;if(i.match(/^\/\//))return window.location.protocol+i;if(i.match(/^[a-z]+:/i))return i;const e=document.implementation.createHTMLDocument(),r=e.createElement("base"),s=e.createElement("a");return e.head.appendChild(r),e.body.appendChild(s),t&&(r.href=t),s.href=i,s.href}const Oe=(()=>{let i=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(i+=1,`u${t()}${i}`)})();function v(i){const t=[];for(let e=0,r=i.length;e<r;e++)t.push(i[e]);return t}let x=null;function Pt(i={}){return x||(i.includeStyleProperties?(x=i.includeStyleProperties,x):(x=v(window.getComputedStyle(document.documentElement)),x))}function $(i,t){const r=(i.ownerDocument.defaultView||window).getComputedStyle(i).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function ze(i){const t=$(i,"border-left-width"),e=$(i,"border-right-width");return i.clientWidth+t+e}function je(i){const t=$(i,"border-top-width"),e=$(i,"border-bottom-width");return i.clientHeight+t+e}function At(i,t={}){const e=t.width||ze(i),r=t.height||je(i);return{width:e,height:r}}function qe(){let i,t;try{t=process}catch{}const e=t&&t.env?t.env.devicePixelRatio:null;return e&&(i=parseInt(e,10),Number.isNaN(i)&&(i=1)),i||window.devicePixelRatio||1}const p=16384;function Ne(i){(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))}function F(i){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=e,r.crossOrigin="anonymous",r.decoding="async",r.src=i})}async function We(i){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Ve(i,t,e){const r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),n=document.createElementNS(r,"foreignObject");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),We(s)}const b=(i,t)=>{if(i instanceof t)return!0;const e=Object.getPrototypeOf(i);return e===null?!1:e.constructor.name===t.name||b(e,t)};function Ye(i){const t=i.getPropertyValue("content");return`${i.cssText} content: '${t.replace(/'|"/g,"")}';`}function Xe(i,t){return Pt(t).map(e=>{const r=i.getPropertyValue(e),s=i.getPropertyPriority(e);return`${e}: ${r}${s?" !important":""};`}).join(" ")}function Ke(i,t,e,r){const s=`.${i}:${t}`,n=e.cssText?Ye(e):Xe(e,r);return document.createTextNode(`${s}{${n}}`)}function ot(i,t,e,r){const s=window.getComputedStyle(i,e),n=s.getPropertyValue("content");if(n===""||n==="none")return;const o=Oe();try{t.className=`${t.className} ${o}`}catch{return}const a=document.createElement("style");a.appendChild(Ke(o,e,s,r)),t.appendChild(a)}function Ge(i,t,e){ot(i,t,":before",e),ot(i,t,":after",e)}const at="application/font-woff",lt="image/jpeg",Je={woff:at,woff2:at,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:lt,jpeg:lt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Qe(i){const t=/\.([^./]*?)$/g.exec(i);return t?t[1]:""}function Z(i){const t=Qe(i).toLowerCase();return Je[t]||""}function Ze(i){return i.split(/,/)[1]}function V(i){return i.search(/^(data:)/)!==-1}function ti(i,t){return`data:${t};base64,${i}`}async function Rt(i,t,e){const r=await fetch(i,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const s=await r.blob();return new Promise((n,o)=>{const a=new FileReader;a.onerror=o,a.onloadend=()=>{try{n(e({res:r,result:a.result}))}catch(l){o(l)}},a.readAsDataURL(s)})}const j={};function ei(i,t,e){let r=i.replace(/\?.*/,"");return e&&(r=i),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function tt(i,t,e){const r=ei(i,t,e.includeQueryParams);if(j[r]!=null)return j[r];e.cacheBust&&(i+=(/\?/.test(i)?"&":"?")+new Date().getTime());let s;try{const n=await Rt(i,e.fetchRequestInit,({res:o,result:a})=>(t||(t=o.headers.get("Content-Type")||""),Ze(a)));s=ti(n,t)}catch(n){s=e.imagePlaceholder||"";let o=`Failed to fetch resource: ${i}`;n&&(o=typeof n=="string"?n:n.message),o&&console.warn(o)}return j[r]=s,s}async function ii(i){const t=i.toDataURL();return t==="data:,"?i.cloneNode(!1):F(t)}async function ri(i,t){if(i.currentSrc){const n=document.createElement("canvas"),o=n.getContext("2d");n.width=i.clientWidth,n.height=i.clientHeight,o?.drawImage(i,0,0,n.width,n.height);const a=n.toDataURL();return F(a)}const e=i.poster,r=Z(e),s=await tt(e,r,t);return F(s)}async function si(i,t){var e;try{if(!((e=i?.contentDocument)===null||e===void 0)&&e.body)return await z(i.contentDocument.body,t,!0)}catch{}return i.cloneNode(!1)}async function ni(i,t){return b(i,HTMLCanvasElement)?ii(i):b(i,HTMLVideoElement)?ri(i,t):b(i,HTMLIFrameElement)?si(i,t):i.cloneNode(It(i))}const oi=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SLOT",It=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SVG";async function ai(i,t,e){var r,s;if(It(t))return t;let n=[];return oi(i)&&i.assignedNodes?n=v(i.assignedNodes()):b(i,HTMLIFrameElement)&&(!((r=i.contentDocument)===null||r===void 0)&&r.body)?n=v(i.contentDocument.body.childNodes):n=v(((s=i.shadowRoot)!==null&&s!==void 0?s:i).childNodes),n.length===0||b(i,HTMLVideoElement)||await n.reduce((o,a)=>o.then(()=>z(a,e)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function li(i,t,e){const r=t.style;if(!r)return;const s=window.getComputedStyle(i);s.cssText?(r.cssText=s.cssText,r.transformOrigin=s.transformOrigin):Pt(e).forEach(n=>{let o=s.getPropertyValue(n);n==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),b(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))})}function ci(i,t){b(i,HTMLTextAreaElement)&&(t.innerHTML=i.value),b(i,HTMLInputElement)&&t.setAttribute("value",i.value)}function di(i,t){if(b(i,HTMLSelectElement)){const e=t,r=Array.from(e.children).find(s=>i.value===s.getAttribute("value"));r&&r.setAttribute("selected","")}}function hi(i,t,e){return b(t,Element)&&(li(i,t,e),Ge(i,t,e),ci(i,t),di(i,t)),t}async function ui(i,t){const e=i.querySelectorAll?i.querySelectorAll("use"):[];if(e.length===0)return i;const r={};for(let n=0;n<e.length;n++){const a=e[n].getAttribute("xlink:href");if(a){const l=i.querySelector(a),c=document.querySelector(a);!l&&c&&!r[a]&&(r[a]=await z(c,t,!0))}}const s=Object.values(r);if(s.length){const n="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg");o.setAttribute("xmlns",n),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const a=document.createElementNS(n,"defs");o.appendChild(a);for(let l=0;l<s.length;l++)a.appendChild(s[l]);i.appendChild(o)}return i}async function z(i,t,e){return!e&&t.filter&&!t.filter(i)?null:Promise.resolve(i).then(r=>ni(r,t)).then(r=>ai(i,r,t)).then(r=>hi(i,r,t)).then(r=>ui(r,t))}const Dt=/url\((['"]?)([^'"]+?)\1\)/g,mi=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,fi=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function bi(i){const t=i.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function pi(i){const t=[];return i.replace(Dt,(e,r,s)=>(t.push(s),e)),t.filter(e=>!V(e))}async function gi(i,t,e,r,s){try{const n=e?Ue(t,e):t,o=Z(t);let a;return s||(a=await tt(n,o,r)),i.replace(bi(t),`$1${a}$3`)}catch{}return i}function yi(i,{preferredFontFormat:t}){return t?i.replace(fi,e=>{for(;;){const[r,,s]=mi.exec(e)||[];if(!s)return"";if(s===t)return`src: ${r};`}}):i}function Ht(i){return i.search(Dt)!==-1}async function $t(i,t,e){if(!Ht(i))return i;const r=yi(i,e);return pi(r).reduce((n,o)=>n.then(a=>gi(a,o,t,e)),Promise.resolve(r))}async function k(i,t,e){var r;const s=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(i);if(s){const n=await $t(s,null,e);return t.style.setProperty(i,n,t.style.getPropertyPriority(i)),!0}return!1}async function wi(i,t){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)}async function vi(i,t){const e=b(i,HTMLImageElement);if(!(e&&!V(i.src))&&!(b(i,SVGImageElement)&&!V(i.href.baseVal)))return;const r=e?i.src:i.href.baseVal,s=await tt(r,Z(r),t);await new Promise((n,o)=>{i.onload=n,i.onerror=t.onImageErrorHandler?(...l)=>{try{n(t.onImageErrorHandler(...l))}catch(c){o(c)}}:o;const a=i;a.decode&&(a.decode=n),a.loading==="lazy"&&(a.loading="eager"),e?(i.srcset="",i.src=s):i.href.baseVal=s})}async function xi(i,t){const r=v(i.childNodes).map(s=>Ft(s,t));await Promise.all(r).then(()=>i)}async function Ft(i,t){b(i,Element)&&(await wi(i,t),await vi(i,t),await xi(i,t))}function ki(i,t){const{style:e}=i;t.backgroundColor&&(e.backgroundColor=t.backgroundColor),t.width&&(e.width=`${t.width}px`),t.height&&(e.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(s=>{e[s]=r[s]}),i}const ct={};async function dt(i){let t=ct[i];if(t!=null)return t;const r=await(await fetch(i)).text();return t={url:i,cssText:r},ct[i]=t,t}async function ht(i,t){let e=i.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,n=(e.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,i.url).href),Rt(a,t.fetchRequestInit,({result:l})=>(e=e.replace(o,`url(${l})`),[o,l]))});return Promise.all(n).then(()=>e)}function ut(i){if(i==null)return[];const t=[],e=/(\/\*[\s\S]*?\*\/)/gi;let r=i.replace(e,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=s.exec(r);if(l===null)break;t.push(l[0])}r=r.replace(s,"");const n=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(o,"gi");for(;;){let l=n.exec(r);if(l===null){if(l=a.exec(r),l===null)break;n.lastIndex=a.lastIndex}else a.lastIndex=n.lastIndex;t.push(l[0])}return t}async function Si(i,t){const e=[],r=[];return i.forEach(s=>{if("cssRules"in s)try{v(s.cssRules||[]).forEach((n,o)=>{if(n.type===CSSRule.IMPORT_RULE){let a=o+1;const l=n.href,c=dt(l).then(d=>ht(d,t)).then(d=>ut(d).forEach(u=>{try{s.insertRule(u,u.startsWith("@import")?a+=1:s.cssRules.length)}catch(m){console.error("Error inserting rule from remote css",{rule:u,error:m})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(c)}})}catch(n){const o=i.find(a=>a.href==null)||document.styleSheets[0];s.href!=null&&r.push(dt(s.href).then(a=>ht(a,t)).then(a=>ut(a).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",n)}}),Promise.all(r).then(()=>(i.forEach(s=>{if("cssRules"in s)try{v(s.cssRules||[]).forEach(n=>{e.push(n)})}catch(n){console.error(`Error while reading CSS rules from ${s.href}`,n)}}),e))}function Ei(i){return i.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ht(t.style.getPropertyValue("src")))}async function Ci(i,t){if(i.ownerDocument==null)throw new Error("Provided element is not within a Document");const e=v(i.ownerDocument.styleSheets),r=await Si(e,t);return Ei(r)}function Bt(i){return i.trim().replace(/["']/g,"")}function _i(i){const t=new Set;function e(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(n=>{t.add(Bt(n))}),Array.from(r.children).forEach(n=>{n instanceof HTMLElement&&e(n)})}return e(i),t}async function Ti(i,t){const e=await Ci(i,t),r=_i(i);return(await Promise.all(e.filter(n=>r.has(Bt(n.style.fontFamily))).map(n=>{const o=n.parentStyleSheet?n.parentStyleSheet.href:null;return $t(n.cssText,o,t)}))).join(`
|
|
140
|
+
`)}async function Li(i,t){const e=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Ti(i,t);if(e){const r=document.createElement("style"),s=document.createTextNode(e);r.appendChild(s),i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r)}}async function Mi(i,t={}){const{width:e,height:r}=At(i,t),s=await z(i,t,!0);return await Li(s,t),await Ft(s,t),ki(s,t),await Ve(s,e,r)}async function Pi(i,t={}){const{width:e,height:r}=At(i,t),s=await Mi(i,t),n=await F(s),o=document.createElement("canvas"),a=o.getContext("2d"),l=t.pixelRatio||qe(),c=t.canvasWidth||e,d=t.canvasHeight||r;return o.width=c*l,o.height=d*l,t.skipAutoScale||Ne(o),o.style.width=`${c}`,o.style.height=`${d}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,o.width,o.height)),a.drawImage(n,0,0,o.width,o.height),o}async function Ai(i,t={}){return(await Pi(i,t)).toDataURL("image/jpeg",t.quality||1)}const q=400,N=300,mt=150,ft=.3,bt=.85;function Ri(i){let t=1/0,e=1/0,r=-1/0,s=-1/0;for(const n of i)if(n.type==="pin"){if(t=Math.min(t,n.x),e=Math.min(e,n.y),r=Math.max(r,n.x),s=Math.max(s,n.y),n.targetRect){const o=n.targetRect;t=Math.min(t,o.left),e=Math.min(e,o.top),r=Math.max(r,o.left+o.width),s=Math.max(s,o.bottom)}}else if(n.type==="draw"&&n.drawPath)for(const o of Ut(n.drawPath))for(const[a,l]of o)t=Math.min(t,a),e=Math.min(e,l),r=Math.max(r,a),s=Math.max(s,l);return!isFinite(t)||!isFinite(e)?null:{minX:t,minY:e,maxX:r,maxY:s}}function Ii(i,t,e){const r=Ri(i);if(!r)return null;const s=Math.max(mt,t*ft),n=Math.max(mt,e*ft);let o=r.minX-s,a=r.minY-n,l=r.maxX-r.minX+s*2,c=r.maxY-r.minY+n*2;return l<q&&(o-=(q-l)/2,l=q),c<N&&(a-=(N-c)/2,c=N),o=Math.max(0,o),a=Math.max(0,a),l=Math.min(l,t-o),c=Math.min(c,e-a),l>=t*bt&&c>=e*bt?null:{x:Math.round(o),y:Math.round(a),width:Math.round(l),height:Math.round(c)}}function Di(i,t){const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const r=e.getContext("2d");return r&&r.drawImage(i,t.x,t.y,t.width,t.height,0,0,t.width,t.height),e}async function Hi(i=[]){try{const t=Bi(document.body),e=await Ai(document.body,{quality:.85,pixelRatio:1,backgroundColor:"#ffffff",skipFonts:!0,skipAutoScale:!1,filter:r=>!(r instanceof HTMLElement&&r.id==="mtb-widget-host")});if(i.length>0){const r=await $i(e,i,t);if(r)return r}return zi(e)}catch{return null}}async function $i(i,t,e){const r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;const n=await Oi(i);if(!n)return null;r.width=n.naturalWidth||window.innerWidth,r.height=n.naturalHeight||window.innerHeight,s.drawImage(n,0,0);const o=r.width/e.width,a=r.height/e.height;let l=0;for(const d of t)d.type==="draw"&&d.drawPath?Fi(s,d.drawPath,e,o,a):d.type==="pin"&&Ui(s,(d.x-e.left)*o,(d.y-e.top)*a,++l);const c=Ii(t,window.innerWidth,window.innerHeight);if(c){const d=Math.max(0,Math.round((c.x-e.left)*o)),u=Math.max(0,Math.round((c.y-e.top)*a)),m=Math.min(r.width,Math.round((c.x+c.width-e.left)*o)),g=Math.min(r.height,Math.round((c.y+c.height-e.top)*a)),y={x:d,y:u,width:m-d,height:g-u};return pt(Di(r,y))}return pt(r)}function Fi(i,t,e,r,s){i.save(),i.strokeStyle=O,i.lineWidth=3.5,i.lineCap="round",i.lineJoin="round",i.shadowColor=J(.35),i.shadowOffsetY=1,i.shadowBlur=2;for(const n of Ut(t))if(n.length!==0){i.beginPath(),i.moveTo((n[0][0]-e.left)*r,(n[0][1]-e.top)*s);for(let o=1;o<n.length;o++)i.lineTo((n[o][0]-e.left)*r,(n[o][1]-e.top)*s);i.stroke()}i.restore()}function Bi(i){const t=i.getBoundingClientRect(),e=window.getComputedStyle(i),r=parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),s=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth);return{left:t.left,top:t.top,width:i.clientWidth+(Number.isFinite(r)?r:0)||window.innerWidth,height:i.clientHeight+(Number.isFinite(s)?s:0)||window.innerHeight}}function Ui(i,t,e,r){i.save(),i.shadowColor=J(.45),i.shadowOffsetY=2,i.shadowBlur=8,i.fillStyle=O,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 ${fe}`,i.textAlign="center",i.textBaseline="middle",i.fillText(String(r),t,e),i.restore()}function Ut(i){const t=[];let e=null;const r=i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g)??[];for(const s of r){const[n,o]=s.slice(1).trim().split(/\s+/).map(Number);Number.isNaN(n)||Number.isNaN(o)||(s[0]==="M"?(e=[[n,o]],t.push(e)):e&&e.push([n,o]))}return t}function Oi(i){return new Promise(t=>{const e=new Image;e.onload=()=>t(e),e.onerror=()=>t(null),e.src=i})}function pt(i){return new Promise(t=>{try{i.toBlob(e=>t(e),"image/jpeg",.85)}catch{t(null)}})}function zi(i){const[t,e]=i.split(","),r=t.match(/:(.*?);/)?.[1]??"image/png",s=atob(e),n=new Uint8Array(s.length);for(let o=0;o<s.length;o++)n[o]=s.charCodeAt(o);return new Blob([n],{type:r})}class ji{constructor(){this.listeners=new Set,this.originalOnError=null,this.installedOnError=null,this.rejectionHandler=null,this.hooked=!1}subscribe(t){return this.listeners.add(t),this.hook(),()=>{this.listeners.delete(t),this.listeners.size===0&&this.unhook()}}hook(){this.hooked||(this.hooked=!0,this.originalOnError=window.onerror,this.installedOnError=(t,e,r,s,n)=>(this.emit({message:String(t),source:e,line:r,col:s,error:n}),this.originalOnError?this.originalOnError.call(window,t,e,r,s,n):!1),window.onerror=this.installedOnError,this.rejectionHandler=t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason);this.emit({message:`Unhandled rejection: ${e}`})},window.addEventListener("unhandledrejection",this.rejectionHandler))}unhook(){this.hooked&&(this.hooked=!1,window.onerror===this.installedOnError&&(window.onerror=this.originalOnError),this.installedOnError=null,this.originalOnError=null,this.rejectionHandler&&(window.removeEventListener("unhandledrejection",this.rejectionHandler),this.rejectionHandler=null))}emit(t){for(const e of this.listeners)e(t)}}const et=new ji,qi=20;class Ni{constructor(){this.errors=[],this.unsubscribe=null}start(){this.unsubscribe||(this.unsubscribe=et.subscribe(t=>this.record(t)))}record(t){const e=t.line!=null?` (${t.line}:${t.col??0})`:"";this.addError(`${t.message}${e}`)}addError(t){this.errors.length>=qi||this.errors.includes(t)||this.errors.push(t)}getErrors(){return[...this.errors]}stop(){this.unsubscribe?.(),this.unsubscribe=null}}const D=new Set;let L=null,M=null,P=null,B=null,A=null;function Ot(i){D.add(i),Wi();let t=!1;return()=>{t||(t=!0,D.delete(i),D.size===0&&Vi())}}function W(){for(const i of[...D])try{i()}catch{}}function Wi(){if(P)return;A=()=>W(),window.addEventListener("popstate",A),L=history.pushState,M=history.replaceState;const i=L,t=M;P=function(e,r,s){i.call(history,e,r,s),W()},B=function(e,r,s){t.call(history,e,r,s),W()},history.pushState=P,history.replaceState=B}function Vi(){A&&(window.removeEventListener("popstate",A),A=null),L&&history.pushState===P&&(history.pushState=L),M&&history.replaceState===B&&(history.replaceState=M),L=null,M=null,P=null,B=null}const Yi=20;class Xi{constructor(){this.breadcrumbs=[],this.active=!1,this.unsubscribeErrors=null,this.unsubscribeNavigation=null,this.lastUrl="",this.boundClickHandler=t=>this.handleClick(t),this.boundChangeHandler=t=>this.handleChange(t)}start(){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=et.subscribe(t=>this.recordError(t)),this.unsubscribeNavigation=Ot(()=>this.handleNavigation()))}stop(){this.active&&(this.active=!1,document.removeEventListener("click",this.boundClickHandler,!0),document.removeEventListener("change",this.boundChangeHandler,!0),this.unsubscribeErrors?.(),this.unsubscribeErrors=null,this.unsubscribeNavigation?.(),this.unsubscribeNavigation=null)}getBreadcrumbs(){return[...this.breadcrumbs]}add(t){this.breadcrumbs.push(t),this.breadcrumbs.length>Yi&&this.breadcrumbs.shift()}handleClick(t){const e=t.target;if(e&&!S(e))try{this.add({type:"ui",category:"ui.click",timestamp:Date.now(),message:G(e),data:{selector:Lt(e)}})}catch{}}handleChange(t){const e=t.target;if(e&&!S(e))try{const r=e,s=r.name||r.placeholder||e.getAttribute("aria-label")||e.tagName;this.add({type:"ui",category:"ui.input",timestamp:Date.now(),message:s,data:{field:s}})}catch{}}recordError(t){this.add({type:"console",category:"console.error",timestamp:Date.now(),message:t.message,data:{message:t.message}})}handleNavigation(){if(!this.active)return;const t=this.lastUrl,e=location.href;t!==e&&(this.lastUrl=e,this.add({type:"navigation",category:"navigation",timestamp:Date.now(),message:`${t} → ${e}`,data:{from:t,to:e}}))}}const zt="mtb_frustration_state";let Y=null;function U(){try{const i=window.sessionStorage.getItem(zt);return H(i?JSON.parse(i):Y)}catch{return H(Y)}}function jt(i){const t=H(i);Y=t;try{window.sessionStorage.setItem(zt,JSON.stringify(t))}catch{}}function Ki(){return U().dismissedByUser}function Gi(){jt({...U(),dismissedByUser:!0})}function H(i){const t=i??{};return{navTimestamps:Array.isArray(t.navTimestamps)?t.navTimestamps.filter(e=>typeof e=="number"):[],cooldownUntil:typeof t.cooldownUntil=="number"?t.cooldownUntil:0,errorPageUrls:Array.isArray(t.errorPageUrls)?t.errorPageUrls.filter(e=>typeof e=="string").slice(-20):[],dismissedByUser:t.dismissedByUser===!0}}const Ji=3,Qi=1e3,Zi=3,tr=5e3,gt=500,er=500,ir=300,rr=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL","SUMMARY","DETAILS"]),sr=new Set(["button","link","checkbox","radio","tab","menuitem","option","switch","textbox","combobox","listbox","slider","spinbutton"]),yt=["404","500","not found","page not found","server error","internal server error"],R=class R{constructor(t){this.clickHistory=[],this.unsubscribeErrors=null,this.active=!1,this.errorCount=0,this.deadClickCount=0,this.cooldownUntil=0,this.navTimestamps=[],this.unsubscribeNavigation=null,this.boundPageLeaveHandler=null,this.lastNavigationAt=-1,this.boundSubmitHandler=null,this.boundInvalidHandler=null,this.recentSubmitForms=new WeakSet,this.errorPageUrls=new Set,this.domObserver=null,this.pendingDomChecks=0,this.lastMutationAt=-1,this.onFrustration=t,this.boundClickHandler=e=>this.handleClick(e)}start(){this.active||(this.active=!0,this.restoreState(),document.addEventListener("click",this.boundClickHandler,!0),this.unsubscribeErrors=et.subscribe(t=>{this.errorCount++}),this.startNavigationTracking(),this.startFormTracking(),this.checkErrorPage())}stop(){this.active&&(this.active=!1,document.removeEventListener("click",this.boundClickHandler,!0),this.unsubscribeErrors?.(),this.unsubscribeErrors=null,this.clickHistory=[],this.stopNavigationTracking(),this.stopFormTracking(),this.errorPageUrls.clear(),this.disconnectDomObserver())}startNavigationTracking(){this.unsubscribeNavigation=Ot(()=>this.handleNavigation()),this.boundPageLeaveHandler=()=>this.noteNavigationStarted(),window.addEventListener("beforeunload",this.boundPageLeaveHandler),window.addEventListener("pagehide",this.boundPageLeaveHandler)}stopNavigationTracking(){this.unsubscribeNavigation?.(),this.unsubscribeNavigation=null,this.navTimestamps=[],this.boundPageLeaveHandler&&(window.removeEventListener("beforeunload",this.boundPageLeaveHandler),window.removeEventListener("pagehide",this.boundPageLeaveHandler),this.boundPageLeaveHandler=null),this.lastNavigationAt=-1}noteNavigationStarted(){this.lastNavigationAt=Date.now()}restoreState(){const t=U();this.navTimestamps=t.navTimestamps,this.cooldownUntil=t.cooldownUntil,this.errorPageUrls=new Set(t.errorPageUrls)}persistState(){const t=U();jt({...t,navTimestamps:this.navTimestamps,cooldownUntil:this.cooldownUntil,errorPageUrls:[...this.errorPageUrls]})}startFormTracking(){this.boundSubmitHandler=t=>this.handleFormSubmit(t),this.boundInvalidHandler=t=>this.handleFormInvalid(t),document.addEventListener("submit",this.boundSubmitHandler,!0),document.addEventListener("invalid",this.boundInvalidHandler,!0)}stopFormTracking(){this.boundSubmitHandler&&(document.removeEventListener("submit",this.boundSubmitHandler,!0),this.boundSubmitHandler=null),this.boundInvalidHandler&&(document.removeEventListener("invalid",this.boundInvalidHandler,!0),this.boundInvalidHandler=null)}handleClick(t){const e=t.target;if(!e||S(e))return;this.trackFormSubmitIntent(e);const r=Date.now();this.clickHistory.push({target:e,time:r});const s=r-Qi;if(this.clickHistory=this.clickHistory.filter(o=>o.time>s),this.clickHistory.filter(o=>o.target===e).length>=Ji){this.clickHistory=[],this.emitHighPriority({signal:"rage_click",target:_(e),timestamp:r});return}this.isInteractive(e)||(this.deadClickCount++,this.deadClickCount>=3&&this.errorCount>0&&(this.deadClickCount=0,this.errorCount=0,this.emitIfReady({signal:"dead_click",target:_(e),timestamp:r}))),this.checkDeadClickDom(e,r)}handleNavigation(){const t=Date.now();this.noteNavigationStarted(),this.navTimestamps.push(t);const e=t-tr;this.navTimestamps=this.navTimestamps.filter(r=>r>e),this.navTimestamps.length>=Zi&&(this.navTimestamps=[],this.emitIfReady({signal:"rapid_navigation",timestamp:t})),this.persistState(),setTimeout(()=>{this.active&&this.checkErrorPage()},ir)}handleFormSubmit(t){const e=t.target;e instanceof HTMLFormElement&&(S(e)||(this.rememberSubmitAttempt(e),setTimeout(()=>{this.active&&e.querySelector('[aria-invalid="true"], .is-invalid')&&this.emitIfReady({signal:"form_failure",target:_(e),timestamp:Date.now()})},gt)))}trackFormSubmitIntent(t){const e=t.closest("button, input");(e instanceof HTMLButtonElement||e instanceof HTMLInputElement)&&(e.type!=="submit"&&e.type!=="image"||!e.form||S(e.form)||this.rememberSubmitAttempt(e.form))}rememberSubmitAttempt(t){this.recentSubmitForms.add(t),setTimeout(()=>{this.recentSubmitForms.delete(t)},gt)}handleFormInvalid(t){const e=t.target;if(!e||S(e))return;const r=e.closest("form");!r||!this.recentSubmitForms.has(r)||this.emitIfReady({signal:"form_failure",target:_(r),timestamp:Date.now()})}checkErrorPage(){const t=location.href;if(this.errorPageUrls.has(t))return;const e=document.title.toLowerCase();if(yt.some(s=>e.includes(s))){this.errorPageUrls.add(t),this.emitHighPriority({signal:"error_page",detail:document.title,timestamp:Date.now()});return}const r=document.querySelectorAll('h1, h2, [class*="error"], [class*="not-found"], [id*="error"], [id*="not-found"]');for(const s of r){const n=s.textContent??"";if(n.length<200&&yt.some(o=>n.toLowerCase().includes(o))){this.errorPageUrls.add(t),this.emitHighPriority({signal:"error_page",detail:n.trim().slice(0,60),timestamp:Date.now()});return}}}checkDeadClickDom(t,e){this.looksInteractive(t)&&(this.pendingDomChecks++,this.ensureDomObserver(),setTimeout(()=>{this.pendingDomChecks--;const r=this.lastMutationAt>=e,s=this.lastNavigationAt>=e;this.pendingDomChecks===0&&this.disconnectDomObserver(),!r&&!s&&this.active&&this.emitIfReady({signal:"dead_click_dom",target:_(t),timestamp:e})},er))}ensureDomObserver(){this.domObserver||(this.domObserver=new MutationObserver(()=>{this.lastMutationAt=Date.now()}),this.domObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}disconnectDomObserver(){this.domObserver?.disconnect(),this.domObserver=null}looksInteractive(t){if(window.getComputedStyle(t).cursor==="pointer")return!0;if(t.classList)for(const r of t.classList){const s=r.toLowerCase();if(s.includes("btn")||s.includes("button"))return!0}return!1}isInteractive(t){if(rr.has(t.tagName))return!0;const e=t.getAttribute("role");return!!(e&&sr.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'))}emitIfReady(t){const e=Date.now();e<this.cooldownUntil||(this.cooldownUntil=e+R.COOLDOWN_MS,this.persistState(),this.onFrustration(t))}emitHighPriority(t){this.cooldownUntil=Date.now()+R.COOLDOWN_MS,this.persistState(),this.onFrustration(t)}};R.COOLDOWN_MS=6e4;let X=R;function _(i){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)??"";return`<${t}${e}${r}>${s?` "${s}"`:""}`}function nr(){return{page_url:window.location.href,user_agent:navigator.userAgent,browser:or(),os:ar(),screen_width:window.screen.width,screen_height:window.screen.height}}function or(){const i=navigator.userAgent;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"}function ar(){const i=navigator.userAgent;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"}function lr(i,t,e,r,s,n,o,a,l){return{description:i,...t,console_errors:e,annotations:r?[r]:[],target_element:r?.targetSelector?{selector:r.targetSelector,text:r.targetText??"",name:r.targetName??""}:void 0,user_id:s?.id,user_email:s?.email,user_name:s?.name,reporter_external_id:s?void 0:o,reporter_email:s?void 0:a,recording_events:n?.events,recording_duration:n?.duration,breadcrumbs:l}}const wt="mtb_anon_id",qt="mtb_reporter_email",Nt="mtb_board_url";let vt=null,Wt=null,Vt=null;function xt(){try{const i=window.localStorage.getItem(wt);if(i?.startsWith("anon_"))return i;const t=Et();return window.localStorage.setItem(wt,t),t}catch{return vt??(vt=Et()),vt}}function kt(){try{return window.localStorage.getItem(qt)??void 0}catch{return Wt??void 0}}function cr(i){Wt=i;try{window.localStorage.setItem(qt,i)}catch{}}function dr(){try{return window.localStorage.getItem(Nt)??void 0}catch{return Vt??void 0}}function St(i){Vt=i;try{window.localStorage.setItem(Nt,i)}catch{}}function Et(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`anon_${crypto.randomUUID()}`:`anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}`}const hr={tab:"Feedback",toolbar:{markup:"Mark up",record:"Record",hint:"Click to comment, drag to draw",hintRecord:"Recording your screen",exit:"Exit"},popup:{about:"About",placeholder:"Describe the issue or suggestion...",submit:"Submit",cancel:"Cancel",my_feedback:"My feedback",quickOptions:[{emoji:"🐛",label:"Something's broken"},{emoji:"💡",label:"I have a suggestion"},{emoji:"🤔",label:"I'm confused"}]},success:{title:"Sent — thanks!",message:"Your note and captured technical context are on their way to the team. You’ll hear back when it’s resolved.",title_no_ai:"Thanks! We've received your feedback.",message_no_ai:"The team will take it from here. You'll hear back when it's resolved.",view_feedback:"View my feedback",close:"Close",email_prompt:"Want updates? Leave your email and we'll let you know when it's resolved.",email_placeholder:"you@example.com",email_submit:"Notify me",email_saved:"You'll get an email when it's resolved.",email_error:"Couldn't save your email. Please try again."},error:{submit:"Failed to submit. Please try again."},pet:{bubble:"Need help?"},frustration:{prompt:"Something not working? Tell us.",action:"Annotate",dismiss:"Dismiss"},annotation:{drawing:"Drawing",element:"element"},draw:{note_placeholder:"Add a note to your drawing",undo:"Undo",redo:"Redo",cancel:"Cancel",submit:"Submit"},record:{stop:"Stop",timer_label:"Recording",max_reached:"Maximum recording time reached",replay_label:"screen-recording.json",play:"Play recording",close:"Close",preview_unavailable:"Preview unavailable"},clarify:{title:"Make This Better AI",subtitle:"Sharpening your feedback",thinking:"Thinking...",placeholder:"Type your answer — or skip the question",send:"Send",send_feedback:"Send feedback",skip:"Skip & send",retry:"Retry",error:"AI clarification failed. Please try again.",expired:"This feedback session expired before it could be sent. Please close the widget and submit again."}},ur={tab:"反馈",toolbar:{markup:"标注",record:"录屏",hint:"点击评论,拖动绘制",hintRecord:"正在录制屏幕",exit:"退出"},popup:{about:"关于",placeholder:"描述问题或建议...",submit:"提交",cancel:"取消",my_feedback:"我的反馈",quickOptions:[{emoji:"🐛",label:"出问题了"},{emoji:"💡",label:"我有一个建议"},{emoji:"🤔",label:"我有点困惑"}]},success:{title:"已发送,感谢!",message:"您的反馈和采集到的技术上下文正在发送给团队。问题解决后,您会收到通知。",title_no_ai:"感谢!我们已收到您的反馈。",message_no_ai:"接下来由团队处理。问题解决后,您会收到通知。",view_feedback:"查看我的反馈",close:"关闭",email_prompt:"想了解进展?留下邮箱,问题解决后我们会通知您。",email_placeholder:"you@example.com",email_submit:"通知我",email_saved:"问题解决后您会收到邮件通知。",email_error:"邮箱保存失败,请重试。"},error:{submit:"提交失败,请重试。"},pet:{bubble:"需要帮助吗?"},frustration:{prompt:"遇到问题了?告诉我们。",action:"标注",dismiss:"关闭"},annotation:{drawing:"绘制",element:"元素"},draw:{note_placeholder:"给你的绘制添加说明",undo:"撤销",redo:"重做",cancel:"取消",submit:"提交"},record:{stop:"停止",timer_label:"录制中",max_reached:"已达到最长录制时间",replay_label:"screen-recording.json",play:"播放录屏",close:"关闭",preview_unavailable:"暂无法预览"},clarify:{title:"Make This Better AI",subtitle:"正在完善你的反馈",thinking:"思考中...",placeholder:"输入回答,或跳过问题",send:"发送",send_feedback:"发送反馈",skip:"跳过并发送",retry:"重试",error:"AI 澄清失败,请重试。",expired:"这条反馈在发送前已过期。请关闭组件后重新提交。"}},mr={tab:"フィードバック",toolbar:{markup:"マークアップ",record:"録画",hint:"クリックでコメント、ドラッグで描画",hintRecord:"画面を録画中",exit:"終了"},popup:{about:"概要",placeholder:"問題や提案を入力してください...",submit:"送信",cancel:"キャンセル",my_feedback:"自分のフィードバック",quickOptions:[{emoji:"🐛",label:"不具合があります"},{emoji:"💡",label:"提案があります"},{emoji:"🤔",label:"わかりにくいです"}]},success:{title:"送信しました。ありがとうございます!",message:"ご意見と取得した技術情報をチームに送信しました。解決次第お知らせします。",title_no_ai:"ありがとうございます!フィードバックを受け付けました。",message_no_ai:"チームが対応します。解決次第お知らせします。",view_feedback:"フィードバックを確認",close:"閉じる",email_prompt:"進捗を知りたい場合は、メールアドレスをご記入ください。解決次第お知らせします。",email_placeholder:"you@example.com",email_submit:"通知を受け取る",email_saved:"解決次第メールでお知らせします。",email_error:"メールアドレスを保存できませんでした。もう一度お試しください。"},error:{submit:"送信に失敗しました。もう一度お試しください。"},pet:{bubble:"お困りですか?"},frustration:{prompt:"うまくいかないことがありますか?お知らせください。",action:"注釈",dismiss:"閉じる"},annotation:{drawing:"描画",element:"要素"},draw:{note_placeholder:"描画にメモを追加",undo:"元に戻す",redo:"やり直す",cancel:"キャンセル",submit:"送信"},record:{stop:"停止",timer_label:"録画中",max_reached:"最大記録時間に達しました",replay_label:"screen-recording.json",play:"録画を再生",close:"閉じる",preview_unavailable:"プレビューは利用できません"},clarify:{title:"Make This Better AI",subtitle:"フィードバックを整えています",thinking:"考え中...",placeholder:"回答を入力、または質問をスキップ",send:"送信",send_feedback:"フィードバックを送信",skip:"スキップして送信",retry:"再試行",error:"AIによる確認に失敗しました。もう一度お試しください。",expired:"このフィードバックは送信される前に有効期限が切れました。ウィジェットを閉じて、もう一度送信してください。"}},fr={tab:"피드백",toolbar:{markup:"마크업",record:"녹화",hint:"클릭하여 댓글, 드래그하여 그리기",hintRecord:"화면 녹화 중",exit:"나가기"},popup:{about:"정보",placeholder:"문제 또는 제안 사항을 설명해 주세요...",submit:"제출",cancel:"취소",my_feedback:"내 피드백",quickOptions:[{emoji:"🐛",label:"문제가 있어요"},{emoji:"💡",label:"제안이 있어요"},{emoji:"🤔",label:"헷갈려요"}]},success:{title:"전송되었습니다. 감사합니다!",message:"피드백과 수집된 기술 정보가 팀에 전달되었습니다. 해결되면 알려드리겠습니다.",title_no_ai:"감사합니다! 피드백을 접수했습니다.",message_no_ai:"팀에서 처리합니다. 해결되면 알려드리겠습니다.",view_feedback:"내 피드백 보기",close:"닫기",email_prompt:"진행 상황이 궁금하신가요? 이메일을 남겨주시면 해결 시 알려드립니다.",email_placeholder:"you@example.com",email_submit:"알림 받기",email_saved:"해결되면 이메일로 알려드립니다.",email_error:"이메일을 저장하지 못했습니다. 다시 시도해 주세요."},error:{submit:"제출에 실패했습니다. 다시 시도해 주세요."},pet:{bubble:"도움이 필요하신가요?"},frustration:{prompt:"문제가 있으신가요? 알려 주세요.",action:"주석",dismiss:"닫기"},annotation:{drawing:"그리기",element:"요소"},draw:{note_placeholder:"그림에 메모 추가",undo:"실행 취소",redo:"다시 실행",cancel:"취소",submit:"보내기"},record:{stop:"중지",timer_label:"녹화 중",max_reached:"최대 녹화 시간에 도달했습니다",replay_label:"screen-recording.json",play:"녹화 재생",close:"닫기",preview_unavailable:"미리보기를 사용할 수 없습니다"},clarify:{title:"Make This Better AI",subtitle:"피드백을 다듬는 중",thinking:"생각 중...",placeholder:"답변을 입력하거나 질문을 건너뛰세요",send:"보내기",send_feedback:"피드백 보내기",skip:"건너뛰고 보내기",retry:"재시도",error:"AI 확인에 실패했습니다. 다시 시도해 주세요.",expired:"이 피드백 세션은 전송되기 전에 만료되었습니다. 위젯을 닫고 다시 보내 주세요."}},br={tab:"Comentarios",toolbar:{markup:"Anotar",record:"Grabar",hint:"Clic para comentar, arrastrar para dibujar",hintRecord:"Grabando pantalla",exit:"Salir"},popup:{about:"Acerca de",placeholder:"Describe el problema o sugerencia...",submit:"Enviar",cancel:"Cancelar",my_feedback:"Mis comentarios",quickOptions:[{emoji:"🐛",label:"Algo no funciona"},{emoji:"💡",label:"Tengo una sugerencia"},{emoji:"🤔",label:"Estoy confundido"}]},success:{title:"Enviado, ¡gracias!",message:"Tu nota y el contexto técnico capturado se han enviado al equipo. Te avisaremos cuando se resuelva.",title_no_ai:"¡Gracias! Hemos recibido tu comentario.",message_no_ai:"El equipo se encargará a partir de aquí. Te avisaremos cuando se resuelva.",view_feedback:"Ver mis comentarios",close:"Cerrar",email_prompt:"¿Quieres novedades? Deja tu correo y te avisaremos cuando se resuelva.",email_placeholder:"tu@ejemplo.com",email_submit:"Avisarme",email_saved:"Recibirás un correo cuando se resuelva.",email_error:"No se pudo guardar tu correo. Inténtalo de nuevo."},error:{submit:"Error al enviar. Por favor, inténtalo de nuevo."},pet:{bubble:"¿Necesitas ayuda?"},frustration:{prompt:"¿Algo no funciona? Cuéntanos.",action:"Anotar",dismiss:"Cerrar"},annotation:{drawing:"Dibujo",element:"elemento"},draw:{note_placeholder:"Añade una nota a tu dibujo",undo:"Deshacer",redo:"Rehacer",cancel:"Cancelar",submit:"Enviar"},record:{stop:"Detener",timer_label:"Grabando",max_reached:"Tiempo máximo de grabación alcanzado",replay_label:"screen-recording.json",play:"Reproducir grabación",close:"Cerrar",preview_unavailable:"Vista previa no disponible"},clarify:{title:"Make This Better AI",subtitle:"Afinando tus comentarios",thinking:"Pensando...",placeholder:"Escribe tu respuesta — u omite la pregunta",send:"Enviar",send_feedback:"Enviar comentario",skip:"Omitir y enviar",retry:"Reintentar",error:"No se pudo completar la aclaración con IA. Inténtalo de nuevo.",expired:"Esta sesión de comentarios caducó antes de poder enviarse. Cierra el widget y envíalo de nuevo."}},pr={tab:"Avis",toolbar:{markup:"Annoter",record:"Enregistrer",hint:"Cliquer pour commenter, glisser pour dessiner",hintRecord:"Enregistrement de l'écran",exit:"Quitter"},popup:{about:"À propos",placeholder:"Décrivez le problème ou votre suggestion...",submit:"Envoyer",cancel:"Annuler",my_feedback:"Mes avis",quickOptions:[{emoji:"🐛",label:"Quelque chose ne fonctionne pas"},{emoji:"💡",label:"J'ai une suggestion"},{emoji:"🤔",label:"Je suis perplexe"}]},success:{title:"Envoyé, merci !",message:"Votre message et le contexte technique collecté ont été transmis à l’équipe. Vous serez informé(e) dès que ce sera résolu.",title_no_ai:"Merci ! Nous avons bien reçu votre avis.",message_no_ai:"L’équipe prend le relais. Vous serez informé(e) dès que ce sera résolu.",view_feedback:"Voir mes avis",close:"Fermer",email_prompt:"Envie de suivre l'avancement ? Laissez votre e-mail et nous vous préviendrons une fois résolu.",email_placeholder:"vous@exemple.com",email_submit:"Me prévenir",email_saved:"Vous recevrez un e-mail une fois résolu.",email_error:"Impossible d'enregistrer votre e-mail. Veuillez réessayer."},error:{submit:"Échec de l'envoi. Veuillez réessayer."},pet:{bubble:"Besoin d'aide ?"},frustration:{prompt:"Un problème ? Dites-le-nous.",action:"Annoter",dismiss:"Fermer"},annotation:{drawing:"Dessin",element:"élément"},draw:{note_placeholder:"Ajoutez une note à votre dessin",undo:"Annuler",redo:"Rétablir",cancel:"Annuler",submit:"Envoyer"},record:{stop:"Arrêter",timer_label:"Enregistrement",max_reached:"Durée maximale d'enregistrement atteinte",replay_label:"screen-recording.json",play:"Lire l'enregistrement",close:"Fermer",preview_unavailable:"Aperçu indisponible"},clarify:{title:"Make This Better AI",subtitle:"Affinement de votre retour",thinking:"Réflexion...",placeholder:"Saisissez votre réponse — ou ignorez la question",send:"Envoyer",send_feedback:"Envoyer le retour",skip:"Ignorer et envoyer",retry:"Réessayer",error:"La clarification par IA a échoué. Réessayez.",expired:"Cette session de retour a expiré avant d'avoir pu être envoyée. Fermez le widget et renvoyez-la."}},gr={tab:"Feedback",toolbar:{markup:"Markieren",record:"Aufnehmen",hint:"Klicken zum Kommentieren, ziehen zum Zeichnen",hintRecord:"Bildschirm wird aufgenommen",exit:"Beenden"},popup:{about:"Info",placeholder:"Beschreiben Sie das Problem oder Ihren Vorschlag...",submit:"Absenden",cancel:"Abbrechen",my_feedback:"Mein Feedback",quickOptions:[{emoji:"🐛",label:"Etwas funktioniert nicht"},{emoji:"💡",label:"Ich habe einen Vorschlag"},{emoji:"🤔",label:"Ich bin verwirrt"}]},success:{title:"Gesendet, vielen Dank!",message:"Ihre Nachricht und der erfasste technische Kontext wurden an das Team gesendet. Sie werden benachrichtigt, sobald das Problem gelöst ist.",title_no_ai:"Vielen Dank! Wir haben Ihr Feedback erhalten.",message_no_ai:"Das Team übernimmt ab hier. Sie werden benachrichtigt, sobald das Problem gelöst ist.",view_feedback:"Mein Feedback ansehen",close:"Schließen",email_prompt:"Updates gewünscht? Hinterlassen Sie Ihre E-Mail und wir melden uns, sobald es gelöst ist.",email_placeholder:"sie@beispiel.de",email_submit:"Benachrichtigen",email_saved:"Sie erhalten eine E-Mail, sobald es gelöst ist.",email_error:"E-Mail konnte nicht gespeichert werden. Bitte versuchen Sie es erneut."},error:{submit:"Senden fehlgeschlagen. Bitte versuchen Sie es erneut."},pet:{bubble:"Brauchen Sie Hilfe?"},frustration:{prompt:"Etwas funktioniert nicht? Sagen Sie es uns.",action:"Kommentieren",dismiss:"Schließen"},annotation:{drawing:"Zeichnung",element:"Element"},draw:{note_placeholder:"Fügen Sie Ihrer Zeichnung eine Notiz hinzu",undo:"Rückgängig",redo:"Wiederholen",cancel:"Abbrechen",submit:"Absenden"},record:{stop:"Stopp",timer_label:"Aufnahme",max_reached:"Maximale Aufnahmedauer erreicht",replay_label:"screen-recording.json",play:"Aufnahme abspielen",close:"Schließen",preview_unavailable:"Vorschau nicht verfügbar"},clarify:{title:"Make This Better AI",subtitle:"Wir schärfen dein Feedback",thinking:"Einen Moment...",placeholder:"Antwort eingeben — oder Frage überspringen",send:"Senden",send_feedback:"Feedback senden",skip:"Überspringen & senden",retry:"Erneut versuchen",error:"Die KI-Klärung ist fehlgeschlagen. Bitte erneut versuchen.",expired:"Diese Feedback-Sitzung ist abgelaufen, bevor sie gesendet werden konnte. Bitte schließe das Widget und sende erneut."}},T={en:hr,"zh-CN":ur,ja:mr,ko:fr,es:br,fr:pr,de:gr};function Ct(i){if(T[i])return T[i];const t=i.split("-")[0];return T[t]?T[t]:T.en}const yr=60,wr="rr-block",vr="rr-mask",xr="https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js",kr="sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";let I=null;function Sr(){return I||(I=Er().catch(()=>Cr()),I)}async function Er(){return(await import("@rrweb/record")).record}function _t(){const i=globalThis;return i.rrwebRecord?.record??i.rrweb?.record}function Cr(){return new Promise((i,t)=>{const e=_t();if(e){i(e);return}const r=document.createElement("script");r.src=xr,r.integrity=kr,r.crossOrigin="anonymous",r.onload=()=>{const s=_t();s?i(s):t(new Error("rrweb record global not found after script load"))},r.onerror=()=>t(new Error("Failed to load rrweb from CDN")),document.head.appendChild(r)})}class _r{constructor(t,e,r={}){this.events=[],this.stopFn=null,this.startedAt=0,this.timer=null,this.clickHandler=null,this.stopped=!1,this.destroyed=!1,this.shadow=t,this.onMaxReached=e,this.options=r}async start(){const t=await Sr();this.destroyed||(this.startedAt=Date.now(),this.stopped=!1,this.stopFn=t({emit:e=>{this.stopped||this.events.push(e)},maskAllInputs:this.options.maskAllInputs??!0,blockClass:wr,maskTextClass:vr}),this.clickHandler=e=>{this.showClickRipple(e.clientX,e.clientY),t.addCustomEvent?.("mtb-click",{x:e.clientX,y:e.clientY,target:e.target instanceof HTMLElement?e.target.tagName:""})},document.addEventListener("click",this.clickHandler,!0),this.timer=setTimeout(()=>{this.onMaxReached?.()},yr*1e3))}stop(){return this.stopped=!0,this.stopFn?.(),this.stopFn=null,this.cleanupTimer(),this.cleanupClickHandler(),{events:this.events,duration:this.getDuration()}}getDuration(){return this.startedAt===0?0:Math.max(1,Math.round((Date.now()-this.startedAt)/1e3))}destroy(){this.destroyed=!0,this.stopped=!0,this.stopFn?.(),this.stopFn=null,this.cleanupTimer(),this.cleanupClickHandler(),this.events=[],this.startedAt=0}cleanupTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}cleanupClickHandler(){this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null)}showClickRipple(t,e){const r=this.shadow.el("div","mtb-click-ripple");r.style.left=`${t}px`,r.style.top=`${e}px`,this.shadow.append(r),r.addEventListener("animationend",()=>r.remove())}}class Tr{constructor(t,e,r,s){this.intervalId=null,this.getDuration=r,this.el=t.el("div","mtb-record-bar"),this.el.innerHTML=`
|
|
141
141
|
<span class="mtb-record-dot"></span>
|
|
142
142
|
<span class="mtb-record-timer">00:00</span>
|
|
143
143
|
<button class="mtb-record-stop" type="button">${e.record.stop}</button>
|