makethisbetter 1.20.0 → 1.20.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/makethisbetter.cjs +13 -13
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +546 -528
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +12 -12
- package/dist/makethisbetter.js.map +1 -1
- package/dist/widget/shadow.d.ts +2 -0
- package/dist/widget/shadow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/i18n/de.ts +1 -1
- package/src/i18n/en.ts +1 -1
- package/src/i18n/es.ts +1 -1
- package/src/i18n/fr.ts +1 -1
- package/src/i18n/ja.ts +1 -1
- package/src/i18n/ko.ts +1 -1
- package/src/i18n/zh-CN.ts +1 -1
- package/src/widget/shadow.ts +26 -0
package/dist/makethisbetter.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";var Le=Object.create;var vt=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var De=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Me(t))!Ie.call(i,n)&&n!==e&&vt(i,n,{get:()=>t[n],enumerable:!(r=Pe(t,n))||r.enumerable});return i};var He=(i,t,e)=>(e=i!=null?Le(Re(i)):{},De(t||!i||!i.__esModule?vt(e,"default",{value:i,enumerable:!0}):e,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Fe=`*,*: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{--mtb-panel-bg: #fff;--mtb-panel-border: rgba(0, 0, 0, .1);--mtb-panel-divider: rgba(0, 0, 0, .06);--mtb-fg: #191a1c;--mtb-field-bg: #fff;--mtb-field-bg-subtle: #fafafa;--mtb-field-border: rgba(0, 0, 0, .12);--mtb-field-border-soft: rgba(0, 0, 0, .09);--mtb-placeholder-fg: rgba(0, 0, 0, .34);--mtb-action-bg: #fff;--mtb-action-border: rgba(0, 0, 0, .12);--mtb-action-fg: rgba(0, 0, 0, .55);--mtb-action-hover-bg: rgba(0, 0, 0, .04);--mtb-popup-close-fg: rgba(0, 0, 0, .38);--mtb-success-msg-fg: rgba(0, 0, 0, .45);--mtb-close-link-fg: rgba(0, 0, 0, .4);--mtb-clarify-subtitle-fg: rgba(0, 0, 0, .42);--mtb-clarify-close-fg: rgba(0, 0, 0, .38);--mtb-clarify-close-hover-fg: rgba(0, 0, 0, .7);--mtb-dismiss-fg: rgba(0, 0, 0, .4);--mtb-dismiss-hover-fg: rgba(0, 0, 0, .7);--mtb-quick-hover-bg: rgba(16, 185, 129, .06);--mtb-quick-hover-border: rgba(16, 185, 129, .3);--mtb-quick-selected-bg: rgba(16, 185, 129, .1);--mtb-quick-selected-border: rgba(16, 185, 129, .5);--mtb-field-focus-border: #10b981;--mtb-clarify-input-focus-bg: #fff;--mtb-popup-close-hover-fg: rgba(0, 0, 0, .7);--mtb-close-link-hover-fg: rgba(0, 0, 0, .7)}:host([data-mtb-theme="dark"]){--mtb-panel-bg: #151719;--mtb-panel-border: rgba(255, 255, 255, .12);--mtb-panel-divider: rgba(255, 255, 255, .1);--mtb-fg: #f9fafb;--mtb-field-bg: #1f2327;--mtb-field-bg-subtle: #1f2327;--mtb-field-border: rgba(255, 255, 255, .12);--mtb-field-border-soft: rgba(255, 255, 255, .12);--mtb-placeholder-fg: rgba(255, 255, 255, .4);--mtb-action-bg: #1f2327;--mtb-action-border: rgba(255, 255, 255, .14);--mtb-action-fg: rgba(255, 255, 255, .7);--mtb-action-hover-bg: rgba(255, 255, 255, .06);--mtb-popup-close-fg: rgba(255, 255, 255, .68);--mtb-success-msg-fg: rgba(255, 255, 255, .55);--mtb-close-link-fg: rgba(255, 255, 255, .68);--mtb-clarify-subtitle-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-hover-fg: rgba(255, 255, 255, .75);--mtb-dismiss-fg: rgba(255, 255, 255, .4);--mtb-dismiss-hover-fg: rgba(255, 255, 255, .7);--mtb-quick-hover-bg: #1f2327;--mtb-quick-hover-border: rgba(255, 255, 255, .12);--mtb-quick-selected-bg: #1f2327;--mtb-quick-selected-border: rgba(255, 255, 255, .12);--mtb-field-focus-border: rgba(255, 255, 255, .12);--mtb-clarify-input-focus-bg: #1f2327;--mtb-popup-close-hover-fg: rgba(255, 255, 255, .68);--mtb-close-link-hover-fg: rgba(255, 255, 255, .68)}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]){--mtb-panel-bg: #151719;--mtb-panel-border: rgba(255, 255, 255, .12);--mtb-panel-divider: rgba(255, 255, 255, .1);--mtb-fg: #f9fafb;--mtb-field-bg: #1f2327;--mtb-field-bg-subtle: #1f2327;--mtb-field-border: rgba(255, 255, 255, .12);--mtb-field-border-soft: rgba(255, 255, 255, .12);--mtb-placeholder-fg: rgba(255, 255, 255, .4);--mtb-action-bg: #1f2327;--mtb-action-border: rgba(255, 255, 255, .14);--mtb-action-fg: rgba(255, 255, 255, .7);--mtb-action-hover-bg: rgba(255, 255, 255, .06);--mtb-popup-close-fg: rgba(255, 255, 255, .68);--mtb-success-msg-fg: rgba(255, 255, 255, .55);--mtb-close-link-fg: rgba(255, 255, 255, .68);--mtb-clarify-subtitle-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-hover-fg: rgba(255, 255, 255, .75);--mtb-dismiss-fg: rgba(255, 255, 255, .4);--mtb-dismiss-hover-fg: rgba(255, 255, 255, .7);--mtb-quick-hover-bg: #1f2327;--mtb-quick-hover-border: rgba(255, 255, 255, .12);--mtb-quick-selected-bg: #1f2327;--mtb-quick-selected-border: rgba(255, 255, 255, .12);--mtb-field-focus-border: rgba(255, 255, 255, .12);--mtb-clarify-input-focus-bg: #1f2327;--mtb-popup-close-hover-fg: rgba(255, 255, 255, .68);--mtb-close-link-hover-fg: rgba(255, 255, 255, .68)}}.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");--mtb-tab-bg: #059669;--mtb-tab-hover-bg: #047857;--mtb-tab-active-bg: #065f46;--mtb-tab-shadow-color: 5, 150, 105;--mtb-tab-fg: #fff;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:var(--mtb-tab-bg);color:var(--mtb-tab-fg);border-radius:8px 0 0 8px;cursor:pointer;box-shadow:-2px 0 14px rgba(var(--mtb-tab-shadow-color),.35);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 rgba(var(--mtb-tab-shadow-color),.35)}.mtb-tab:hover{background:var(--mtb-tab-hover-bg);box-shadow:-3px 0 20px rgba(var(--mtb-tab-shadow-color),.45)}.mtb-tab.active{background:var(--mtb-tab-active-bg)}.mtb-hint-bar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;height:38px;padding:0 16px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbHintIn .2s ease;white-space:nowrap;transition:opacity .15s ease;pointer-events:none}.mtb-hint-bar--under-pointer{opacity:.3}.mtb-hint-bar.mtb-hint-bar--dismissed{display:none}@keyframes mtbHintIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar{position:fixed;top:50%;right:8px;transform:translateY(-50%);z-index:2147483647;display:flex;flex-direction:column;align-items:center;gap:6px;width:38px;padding:6px 0;max-height:calc(100vh - 24px);border-radius:19px;background:linear-gradient(160deg,#10b981,#059669);box-shadow:0 8px 22px #0f172a33;animation:mtbEdgeBarIn .2s ease;white-space:nowrap;pointer-events:none}.mtb-toolbar.left{right:auto;left:8px;animation:mtbEdgeBarInLeft .2s ease}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}@keyframes mtbEdgeBarIn{0%{transform:translate(12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}@keyframes mtbEdgeBarInLeft{0%{transform:translate(-12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}.mtb-toolbar-label{display:none}:host([data-mtb-toolbar]) .mtb-tab{display:none}.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:20px;height:1px;align-self:center;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-toolbar-modes{flex-direction:column;gap:6px;padding:0;background:none;border-radius:0}.mtb-toolbar-mode-btn,.mtb-exit-btn{pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:0;width:30px;height:30px;padding:0;border-radius:50%;background:none;color:#ffffffb8}.mtb-toolbar-mode-btn:hover,.mtb-exit-btn:hover{background:#ffffff29;color:#fff}.mtb-toolbar-mode-btn.active,.mtb-toolbar-mode-btn.active:hover{background:#fff;color:#047857}.mtb-exit-btn{color:#fff}.mtb-toolbar-sep{width:16px;height:1px;margin:1px 0;align-self:center;background:#ffffff47}.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:#2563eb;background:#2563eb0a}.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:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:16px;color:var(--mtb-fg);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 var(--mtb-panel-divider);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:var(--mtb-fg)}.mtb-popup-close{background:none;border:none;cursor:pointer;padding:3px;color:var(--mtb-popup-close-fg);display:flex;align-items:center;border-radius:4px;transition:color .12s}.mtb-popup-close:hover{color:var(--mtb-popup-close-hover-fg)}.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 var(--mtb-field-border-soft);border-radius:10px;background:var(--mtb-field-bg-subtle);cursor:pointer;font-family:inherit;font-size:13px;color:var(--mtb-fg);text-align:left;transition:all .12s}.mtb-quick-option:hover{background:var(--mtb-quick-hover-bg);border-color:var(--mtb-quick-hover-border)}.mtb-quick-option.selected{background:var(--mtb-quick-selected-bg);border-color:var(--mtb-quick-selected-border)}.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 var(--mtb-field-border);border-radius:10px;font-family:inherit;font-size:12.5px;line-height:1.5;color:var(--mtb-fg);outline:none;background:var(--mtb-field-bg);resize:none;transition:border-color .12s,box-shadow .12s}.mtb-textarea:focus{border-color:var(--mtb-field-focus-border);box-shadow:0 0 0 3px #10b98126}.mtb-textarea::placeholder{color:var(--mtb-placeholder-fg)}.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:1px solid transparent;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:#fff;border-color:#0000001f;color:#191a1c}.mtb-cancel-btn:hover{background:#fafafa}.mtb-submit-btn{background:#f7f7f8;border-color:#0000001a;color:#00000059}.mtb-submit-btn.ready{background:#059669;border-color:#059669;color:#fff}.mtb-submit-btn.ready:hover{background:#047857;border-color:#047857}.mtb-submit-btn:disabled{cursor:not-allowed}.mtb-success{position:fixed;z-index:2147483645;width:332px;background:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:16px;color:var(--mtb-fg);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:var(--mtb-fg)}.mtb-success-msg{font-size:12px;color:var(--mtb-success-msg-fg);margin-bottom:14px;line-height:1.5}.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:inherit;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:11px;color:var(--mtb-close-link-fg);font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:var(--mtb-close-link-hover-fg)}.mtb-email-capture{margin-bottom:14px;text-align:left}.mtb-email-prompt{font-size:12px;color:var(--mtb-success-msg-fg);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:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:12px;color:var(--mtb-fg);box-shadow:0 8px 30px #0000001f;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.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:var(--mtb-dismiss-fg);cursor:pointer;font-family:inherit;font-size:12px;transition:color .12s}.mtb-frustration-dismiss:hover{color:var(--mtb-dismiss-hover-fg)}.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:#dc2626;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));min-height:min(270px,calc(100vh - 24px));background:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:16px;color:var(--mtb-fg);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 var(--mtb-panel-divider)}.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:var(--mtb-fg)}.mtb-clarify-subtitle{font-size:9.5px;color:var(--mtb-clarify-subtitle-fg)}.mtb-clarify-close{background:none;border:none;cursor:pointer;padding:3px;color:var(--mtb-clarify-close-fg);display:flex;transition:color .12s}.mtb-clarify-close:hover{color:var(--mtb-clarify-close-hover-fg)}.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:var(--mtb-field-bg);color:var(--mtb-fg);border:1px solid var(--mtb-field-border-soft);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 var(--mtb-field-border);border-radius:8px;font-family:inherit;font-size:12px;line-height:1.4;color:var(--mtb-fg);outline:none;background:var(--mtb-field-bg-subtle);resize:none;box-sizing:border-box;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-clarify-input:focus{border-color:var(--mtb-field-focus-border);box-shadow:0 0 0 3px #10b98126;background:var(--mtb-clarify-input-focus-bg)}.mtb-clarify-input::placeholder{color:var(--mtb-placeholder-fg)}.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 var(--mtb-action-border);border-radius:8px;background:var(--mtb-action-bg);cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;color:var(--mtb-action-fg);white-space:nowrap;transition:background .12s}.mtb-clarify-skip:hover,.mtb-clarify-fallback:hover{background:var(--mtb-action-hover-bg)}.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[aria-busy=true]:disabled{background:#059669;cursor:wait}.mtb-clarify-send-spinner{width:13px;height:13px;display:none;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;animation:mtbSpin .7s linear infinite}@keyframes mtbSpin{to{transform:rotate(360deg)}}.mtb-clarify-send[aria-busy=true] svg,.mtb-clarify-send[aria-busy=true] .mtb-clarify-send-label{display:none}.mtb-clarify-send[aria-busy=true] .mtb-clarify-send-spinner{display:block}.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}.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-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{min-height:56px;border-radius:16px}.mtb-toolbar-mode-btn,.mtb-exit-btn,.mtb-popup-close,.mtb-cancel-btn,.mtb-submit-btn{min-height:44px}.mtb-textarea,.mtb-clarify-input,.mtb-draw-input,.mtb-email-input{font-size:16px}}@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{inset:0 0 auto;width:100%;max-width:none;max-height:none;transform:none;flex-direction:row;align-items:center;border-radius:0;gap:8px;justify-content:center;padding:env(safe-area-inset-top,0px) 8px 0;height:calc(44px + env(safe-area-inset-top,0px));min-height:calc(44px + env(safe-area-inset-top,0px));border-bottom:1px solid rgba(60,60,67,.16);background:#f8f8f8f5;box-shadow:0 1px 3px #00000014;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);animation:none}.mtb-toolbar-modes{flex-direction:row;gap:0;padding:2px;background:#7676801f;border-radius:8px}.mtb-toolbar-sep{display:none}.mtb-hint-bar{top:calc(44px + env(safe-area-inset-top,0px));right:0;bottom:0;left:0;transform:none;justify-content:center;height:auto;padding:0 24px;border-radius:0;background:#0000001a;box-shadow:none;animation:none;white-space:normal;text-align:center;transition:none}.mtb-hint-bar .mtb-toolbar-hint{max-width:280px;color:#fffffff5;font-size:17px;font-weight:600;line-height:1.4;letter-spacing:0;white-space:normal;text-shadow:0 1px 3px rgba(0,0,0,.45)}.mtb-toolbar-mode-btn,.mtb-exit-btn{position:relative;width:auto;height:32px;min-height:32px;gap:6px;border-radius:6px;padding-right:8px;padding-left:8px;color:#3c3c43d1;transition:none}.mtb-toolbar-mode-btn:hover{background:transparent;color:#3c3c43d1}.mtb-toolbar-mode-btn.active,.mtb-toolbar-mode-btn.active:hover{background:#fff;color:#047857;box-shadow:0 1px 3px #0000001f}.mtb-toolbar-mode-btn:after,.mtb-exit-btn:after{content:"";position:absolute;inset:-6px 0}.mtb-exit-btn{width:32px;padding:0;border-radius:50%;background:#7676801f}.mtb-exit-btn:hover{background:#7676801f;color:#3c3c43d1}.mtb-toolbar-label{display:inline}.mtb-exit-btn .mtb-toolbar-label{display:none}.mtb-popup{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0;animation:none}.mtb-popup-actions{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-clarify{inset:auto 0 0;width:auto;min-height:min(270px,85vh);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}.mtb-frustration-prompt{left:0;right:0;bottom:0;flex-direction:column;align-items:stretch;gap:12px;padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0;border-width:1px 0 0;animation:none}.mtb-frustration-actions{display:flex;gap:8px}.mtb-frustration-tell,.mtb-frustration-dismiss{flex:1;min-height:44px}}`;class $e{constructor(t="auto"){const e=document.getElementById("mtb-widget-host");this.ownsHost=!e,this.host=e??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),this.ownsHost&&document.body.appendChild(this.host),this.root=this.host.shadowRoot??this.host.attachShadow({mode:"open"}),this.root.replaceChildren();const r=document.createElement("style");r.textContent=Fe,this.root.appendChild(r)}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(){if(!this.ownsHost){this.root.replaceChildren(),this.host.removeAttribute("data-mtb-toolbar");return}this.host.remove()}}class Ue{constructor(t,e,r,n,s,o){this.active=!1,this.onClick=n,this.customText=s,this.el=t.el("button","mtb-tab"),r==="left"&&this.el.classList.add("left"),this.setCustomColor(o),this.idleLabel=s??e.tab,this.activeLabel=e.toolbar.exit,this.setLabel(this.idleLabel),this.el.addEventListener("click",n),t.append(this.el)}setCustomColor(t){if(!t||!/^#[0-9a-f]{6}$/i.test(t))return;const e=[1,3,5].map(n=>parseInt(t.slice(n,n+2),16)),r=n=>`#${e.map(o=>Math.round(o*(1-n))).map(o=>o.toString(16).padStart(2,"0")).join("")}`;this.el.style.setProperty("--mtb-tab-bg",t.toLowerCase()),this.el.style.setProperty("--mtb-tab-hover-bg",r(.15)),this.el.style.setProperty("--mtb-tab-active-bg",r(.28)),this.el.style.setProperty("--mtb-tab-shadow-color",e.join(", ")),this.el.style.setProperty("--mtb-tab-fg",this.foregroundFor(e))}foregroundFor(t){const e=t.map(n=>{const s=n/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4});return .2126*e[0]+.7152*e[1]+.0722*e[2]>.179?"#191a1c":"#fff"}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 Be="mtb-widget-host";function T(i){const t=document.getElementById(Be);return t?t===i||t.contains(i):!1}function c(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Ne=8e3;class Oe{constructor(t,e,r){this.autoHideTimer=null,this.el=t.el("div","mtb-frustration-prompt"),this.el.innerHTML=`
|
|
1
|
+
"use strict";var Me=Object.create;var kt=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty;var Fe=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ie(t))!He.call(i,n)&&n!==e&&kt(i,n,{get:()=>t[n],enumerable:!(r=Re(t,n))||r.enumerable});return i};var $e=(i,t,e)=>(e=i!=null?Me(De(i)):{},Fe(t||!i||!i.__esModule?kt(e,"default",{value:i,enumerable:!0}):e,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ne=`*,*: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{--mtb-panel-bg: #fff;--mtb-panel-border: rgba(0, 0, 0, .1);--mtb-panel-divider: rgba(0, 0, 0, .06);--mtb-fg: #191a1c;--mtb-field-bg: #fff;--mtb-field-bg-subtle: #fafafa;--mtb-field-border: rgba(0, 0, 0, .12);--mtb-field-border-soft: rgba(0, 0, 0, .09);--mtb-placeholder-fg: rgba(0, 0, 0, .34);--mtb-action-bg: #fff;--mtb-action-border: rgba(0, 0, 0, .12);--mtb-action-fg: rgba(0, 0, 0, .55);--mtb-action-hover-bg: rgba(0, 0, 0, .04);--mtb-popup-close-fg: rgba(0, 0, 0, .38);--mtb-success-msg-fg: rgba(0, 0, 0, .45);--mtb-close-link-fg: rgba(0, 0, 0, .4);--mtb-clarify-subtitle-fg: rgba(0, 0, 0, .42);--mtb-clarify-close-fg: rgba(0, 0, 0, .38);--mtb-clarify-close-hover-fg: rgba(0, 0, 0, .7);--mtb-dismiss-fg: rgba(0, 0, 0, .4);--mtb-dismiss-hover-fg: rgba(0, 0, 0, .7);--mtb-quick-hover-bg: rgba(16, 185, 129, .06);--mtb-quick-hover-border: rgba(16, 185, 129, .3);--mtb-quick-selected-bg: rgba(16, 185, 129, .1);--mtb-quick-selected-border: rgba(16, 185, 129, .5);--mtb-field-focus-border: #10b981;--mtb-clarify-input-focus-bg: #fff;--mtb-popup-close-hover-fg: rgba(0, 0, 0, .7);--mtb-close-link-hover-fg: rgba(0, 0, 0, .7)}:host([data-mtb-theme="dark"]){--mtb-panel-bg: #151719;--mtb-panel-border: rgba(255, 255, 255, .12);--mtb-panel-divider: rgba(255, 255, 255, .1);--mtb-fg: #f9fafb;--mtb-field-bg: #1f2327;--mtb-field-bg-subtle: #1f2327;--mtb-field-border: rgba(255, 255, 255, .12);--mtb-field-border-soft: rgba(255, 255, 255, .12);--mtb-placeholder-fg: rgba(255, 255, 255, .4);--mtb-action-bg: #1f2327;--mtb-action-border: rgba(255, 255, 255, .14);--mtb-action-fg: rgba(255, 255, 255, .7);--mtb-action-hover-bg: rgba(255, 255, 255, .06);--mtb-popup-close-fg: rgba(255, 255, 255, .68);--mtb-success-msg-fg: rgba(255, 255, 255, .55);--mtb-close-link-fg: rgba(255, 255, 255, .68);--mtb-clarify-subtitle-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-hover-fg: rgba(255, 255, 255, .75);--mtb-dismiss-fg: rgba(255, 255, 255, .4);--mtb-dismiss-hover-fg: rgba(255, 255, 255, .7);--mtb-quick-hover-bg: #1f2327;--mtb-quick-hover-border: rgba(255, 255, 255, .12);--mtb-quick-selected-bg: #1f2327;--mtb-quick-selected-border: rgba(255, 255, 255, .12);--mtb-field-focus-border: rgba(255, 255, 255, .12);--mtb-clarify-input-focus-bg: #1f2327;--mtb-popup-close-hover-fg: rgba(255, 255, 255, .68);--mtb-close-link-hover-fg: rgba(255, 255, 255, .68)}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]){--mtb-panel-bg: #151719;--mtb-panel-border: rgba(255, 255, 255, .12);--mtb-panel-divider: rgba(255, 255, 255, .1);--mtb-fg: #f9fafb;--mtb-field-bg: #1f2327;--mtb-field-bg-subtle: #1f2327;--mtb-field-border: rgba(255, 255, 255, .12);--mtb-field-border-soft: rgba(255, 255, 255, .12);--mtb-placeholder-fg: rgba(255, 255, 255, .4);--mtb-action-bg: #1f2327;--mtb-action-border: rgba(255, 255, 255, .14);--mtb-action-fg: rgba(255, 255, 255, .7);--mtb-action-hover-bg: rgba(255, 255, 255, .06);--mtb-popup-close-fg: rgba(255, 255, 255, .68);--mtb-success-msg-fg: rgba(255, 255, 255, .55);--mtb-close-link-fg: rgba(255, 255, 255, .68);--mtb-clarify-subtitle-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-fg: rgba(255, 255, 255, .45);--mtb-clarify-close-hover-fg: rgba(255, 255, 255, .75);--mtb-dismiss-fg: rgba(255, 255, 255, .4);--mtb-dismiss-hover-fg: rgba(255, 255, 255, .7);--mtb-quick-hover-bg: #1f2327;--mtb-quick-hover-border: rgba(255, 255, 255, .12);--mtb-quick-selected-bg: #1f2327;--mtb-quick-selected-border: rgba(255, 255, 255, .12);--mtb-field-focus-border: rgba(255, 255, 255, .12);--mtb-clarify-input-focus-bg: #1f2327;--mtb-popup-close-hover-fg: rgba(255, 255, 255, .68);--mtb-close-link-hover-fg: rgba(255, 255, 255, .68)}}.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");--mtb-tab-bg: #059669;--mtb-tab-hover-bg: #047857;--mtb-tab-active-bg: #065f46;--mtb-tab-shadow-color: 5, 150, 105;--mtb-tab-fg: #fff;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:var(--mtb-tab-bg);color:var(--mtb-tab-fg);border-radius:8px 0 0 8px;cursor:pointer;box-shadow:-2px 0 14px rgba(var(--mtb-tab-shadow-color),.35);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 rgba(var(--mtb-tab-shadow-color),.35)}.mtb-tab:hover{background:var(--mtb-tab-hover-bg);box-shadow:-3px 0 20px rgba(var(--mtb-tab-shadow-color),.45)}.mtb-tab.active{background:var(--mtb-tab-active-bg)}.mtb-hint-bar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;height:38px;padding:0 16px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbHintIn .2s ease;white-space:nowrap;transition:opacity .15s ease;pointer-events:none}.mtb-hint-bar--under-pointer{opacity:.3}.mtb-hint-bar.mtb-hint-bar--dismissed{display:none}@keyframes mtbHintIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar{position:fixed;top:50%;right:8px;transform:translateY(-50%);z-index:2147483647;display:flex;flex-direction:column;align-items:center;gap:6px;width:38px;padding:6px 0;max-height:calc(100vh - 24px);border-radius:19px;background:linear-gradient(160deg,#10b981,#059669);box-shadow:0 8px 22px #0f172a33;animation:mtbEdgeBarIn .2s ease;white-space:nowrap;pointer-events:none}.mtb-toolbar.left{right:auto;left:8px;animation:mtbEdgeBarInLeft .2s ease}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}@keyframes mtbEdgeBarIn{0%{transform:translate(12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}@keyframes mtbEdgeBarInLeft{0%{transform:translate(-12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}.mtb-toolbar-label{display:none}:host([data-mtb-toolbar]) .mtb-tab{display:none}.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:20px;height:1px;align-self:center;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-toolbar-modes{flex-direction:column;gap:6px;padding:0;background:none;border-radius:0}.mtb-toolbar-mode-btn,.mtb-exit-btn{pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:0;width:30px;height:30px;padding:0;border-radius:50%;background:none;color:#ffffffb8}.mtb-toolbar-mode-btn:hover,.mtb-exit-btn:hover{background:#ffffff29;color:#fff}.mtb-toolbar-mode-btn.active,.mtb-toolbar-mode-btn.active:hover{background:#fff;color:#047857}.mtb-exit-btn{color:#fff}.mtb-toolbar-sep{width:16px;height:1px;margin:1px 0;align-self:center;background:#ffffff47}.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:#2563eb;background:#2563eb0a}.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:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:16px;color:var(--mtb-fg);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 var(--mtb-panel-divider);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:var(--mtb-fg)}.mtb-popup-close{background:none;border:none;cursor:pointer;padding:3px;color:var(--mtb-popup-close-fg);display:flex;align-items:center;border-radius:4px;transition:color .12s}.mtb-popup-close:hover{color:var(--mtb-popup-close-hover-fg)}.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 var(--mtb-field-border-soft);border-radius:10px;background:var(--mtb-field-bg-subtle);cursor:pointer;font-family:inherit;font-size:13px;color:var(--mtb-fg);text-align:left;transition:all .12s}.mtb-quick-option:hover{background:var(--mtb-quick-hover-bg);border-color:var(--mtb-quick-hover-border)}.mtb-quick-option.selected{background:var(--mtb-quick-selected-bg);border-color:var(--mtb-quick-selected-border)}.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 var(--mtb-field-border);border-radius:10px;font-family:inherit;font-size:12.5px;line-height:1.5;color:var(--mtb-fg);outline:none;background:var(--mtb-field-bg);resize:none;transition:border-color .12s,box-shadow .12s}.mtb-textarea:focus{border-color:var(--mtb-field-focus-border);box-shadow:0 0 0 3px #10b98126}.mtb-textarea::placeholder{color:var(--mtb-placeholder-fg)}.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:1px solid transparent;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:#fff;border-color:#0000001f;color:#191a1c}.mtb-cancel-btn:hover{background:#fafafa}.mtb-submit-btn{background:#f7f7f8;border-color:#0000001a;color:#00000059}.mtb-submit-btn.ready{background:#059669;border-color:#059669;color:#fff}.mtb-submit-btn.ready:hover{background:#047857;border-color:#047857}.mtb-submit-btn:disabled{cursor:not-allowed}.mtb-success{position:fixed;z-index:2147483645;width:332px;background:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:16px;color:var(--mtb-fg);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:var(--mtb-fg)}.mtb-success-msg{font-size:12px;color:var(--mtb-success-msg-fg);margin-bottom:14px;line-height:1.5}.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:inherit;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:11px;color:var(--mtb-close-link-fg);font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:var(--mtb-close-link-hover-fg)}.mtb-email-capture{margin-bottom:14px;text-align:left}.mtb-email-prompt{font-size:12px;color:var(--mtb-success-msg-fg);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:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:12px;color:var(--mtb-fg);box-shadow:0 8px 30px #0000001f;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.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:var(--mtb-dismiss-fg);cursor:pointer;font-family:inherit;font-size:12px;transition:color .12s}.mtb-frustration-dismiss:hover{color:var(--mtb-dismiss-hover-fg)}.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:#dc2626;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));min-height:min(270px,calc(100vh - 24px));background:var(--mtb-panel-bg);border:1px solid var(--mtb-panel-border);border-radius:16px;color:var(--mtb-fg);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 var(--mtb-panel-divider)}.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:var(--mtb-fg)}.mtb-clarify-subtitle{font-size:9.5px;color:var(--mtb-clarify-subtitle-fg)}.mtb-clarify-close{background:none;border:none;cursor:pointer;padding:3px;color:var(--mtb-clarify-close-fg);display:flex;transition:color .12s}.mtb-clarify-close:hover{color:var(--mtb-clarify-close-hover-fg)}.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:var(--mtb-field-bg);color:var(--mtb-fg);border:1px solid var(--mtb-field-border-soft);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 var(--mtb-field-border);border-radius:8px;font-family:inherit;font-size:12px;line-height:1.4;color:var(--mtb-fg);outline:none;background:var(--mtb-field-bg-subtle);resize:none;box-sizing:border-box;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-clarify-input:focus{border-color:var(--mtb-field-focus-border);box-shadow:0 0 0 3px #10b98126;background:var(--mtb-clarify-input-focus-bg)}.mtb-clarify-input::placeholder{color:var(--mtb-placeholder-fg)}.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 var(--mtb-action-border);border-radius:8px;background:var(--mtb-action-bg);cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;color:var(--mtb-action-fg);white-space:nowrap;transition:background .12s}.mtb-clarify-skip:hover,.mtb-clarify-fallback:hover{background:var(--mtb-action-hover-bg)}.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[aria-busy=true]:disabled{background:#059669;cursor:wait}.mtb-clarify-send-spinner{width:13px;height:13px;display:none;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;animation:mtbSpin .7s linear infinite}@keyframes mtbSpin{to{transform:rotate(360deg)}}.mtb-clarify-send[aria-busy=true] svg,.mtb-clarify-send[aria-busy=true] .mtb-clarify-send-label{display:none}.mtb-clarify-send[aria-busy=true] .mtb-clarify-send-spinner{display:block}.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}.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-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{min-height:56px;border-radius:16px}.mtb-toolbar-mode-btn,.mtb-exit-btn,.mtb-popup-close,.mtb-cancel-btn,.mtb-submit-btn{min-height:44px}.mtb-textarea,.mtb-clarify-input,.mtb-draw-input,.mtb-email-input{font-size:16px}}@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{inset:0 0 auto;width:100%;max-width:none;max-height:none;transform:none;flex-direction:row;align-items:center;border-radius:0;gap:8px;justify-content:center;padding:env(safe-area-inset-top,0px) 8px 0;height:calc(44px + env(safe-area-inset-top,0px));min-height:calc(44px + env(safe-area-inset-top,0px));border-bottom:1px solid rgba(60,60,67,.16);background:#f8f8f8f5;box-shadow:0 1px 3px #00000014;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);animation:none}.mtb-toolbar-modes{flex-direction:row;gap:0;padding:2px;background:#7676801f;border-radius:8px}.mtb-toolbar-sep{display:none}.mtb-hint-bar{top:calc(44px + env(safe-area-inset-top,0px));right:0;bottom:0;left:0;transform:none;justify-content:center;height:auto;padding:0 24px;border-radius:0;background:#0000001a;box-shadow:none;animation:none;white-space:normal;text-align:center;transition:none}.mtb-hint-bar .mtb-toolbar-hint{max-width:280px;color:#fffffff5;font-size:17px;font-weight:600;line-height:1.4;letter-spacing:0;white-space:normal;text-shadow:0 1px 3px rgba(0,0,0,.45)}.mtb-toolbar-mode-btn,.mtb-exit-btn{position:relative;width:auto;height:32px;min-height:32px;gap:6px;border-radius:6px;padding-right:8px;padding-left:8px;color:#3c3c43d1;transition:none}.mtb-toolbar-mode-btn:hover{background:transparent;color:#3c3c43d1}.mtb-toolbar-mode-btn.active,.mtb-toolbar-mode-btn.active:hover{background:#fff;color:#047857;box-shadow:0 1px 3px #0000001f}.mtb-toolbar-mode-btn:after,.mtb-exit-btn:after{content:"";position:absolute;inset:-6px 0}.mtb-exit-btn{width:32px;padding:0;border-radius:50%;background:#7676801f}.mtb-exit-btn:hover{background:#7676801f;color:#3c3c43d1}.mtb-toolbar-label{display:inline}.mtb-exit-btn .mtb-toolbar-label{display:none}.mtb-popup{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0;animation:none}.mtb-popup-actions{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-clarify{inset:auto 0 0;width:auto;min-height:min(270px,85vh);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}.mtb-frustration-prompt{left:0;right:0;bottom:0;flex-direction:column;align-items:stretch;gap:12px;padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0;border-width:1px 0 0;animation:none}.mtb-frustration-actions{display:flex;gap:8px}.mtb-frustration-tell,.mtb-frustration-dismiss{flex:1;min-height:44px}}`,F=class F{constructor(t="auto"){this.stopHostInteraction=n=>{n.stopPropagation()};const e=document.getElementById("mtb-widget-host");this.ownsHost=!e,this.host=e??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),this.ownsHost&&document.body.appendChild(this.host),this.root=this.host.shadowRoot??this.host.attachShadow({mode:"open"}),this.root.replaceChildren();for(const n of F.HOST_INTERACTION_EVENTS)this.root.addEventListener(n,this.stopHostInteraction);const r=document.createElement("style");r.textContent=Ne,this.root.appendChild(r)}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(){for(const t of F.HOST_INTERACTION_EVENTS)this.root.removeEventListener(t,this.stopHostInteraction);if(!this.ownsHost){this.root.replaceChildren(),this.host.removeAttribute("data-mtb-toolbar");return}this.host.remove()}};F.HOST_INTERACTION_EVENTS=["pointerdown","pointerup","pointercancel","mousedown","mouseup","touchstart","touchend","touchcancel","click"];let ct=F;class Ue{constructor(t,e,r,n,s,o){this.active=!1,this.onClick=n,this.customText=s,this.el=t.el("button","mtb-tab"),r==="left"&&this.el.classList.add("left"),this.setCustomColor(o),this.idleLabel=s??e.tab,this.activeLabel=e.toolbar.exit,this.setLabel(this.idleLabel),this.el.addEventListener("click",n),t.append(this.el)}setCustomColor(t){if(!t||!/^#[0-9a-f]{6}$/i.test(t))return;const e=[1,3,5].map(n=>parseInt(t.slice(n,n+2),16)),r=n=>`#${e.map(o=>Math.round(o*(1-n))).map(o=>o.toString(16).padStart(2,"0")).join("")}`;this.el.style.setProperty("--mtb-tab-bg",t.toLowerCase()),this.el.style.setProperty("--mtb-tab-hover-bg",r(.15)),this.el.style.setProperty("--mtb-tab-active-bg",r(.28)),this.el.style.setProperty("--mtb-tab-shadow-color",e.join(", ")),this.el.style.setProperty("--mtb-tab-fg",this.foregroundFor(e))}foregroundFor(t){const e=t.map(n=>{const s=n/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4});return .2126*e[0]+.7152*e[1]+.0722*e[2]>.179?"#191a1c":"#fff"}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 Be="mtb-widget-host";function T(i){const t=document.getElementById(Be);return t?t===i||t.contains(i):!1}function c(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Oe=8e3;class ze{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">${c(e.frustration.prompt)}</span>
|
|
4
4
|
<div class="mtb-frustration-actions">
|
|
5
5
|
<button class="mtb-frustration-tell">${c(e.frustration.action)}</button>
|
|
6
6
|
<button class="mtb-frustration-dismiss">${c(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,
|
|
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,Oe)}destroy(){this.autoHideTimer&&(clearTimeout(this.autoHideTimer),this.autoHideTimer=null),this.el.remove()}}const qe=400;class je{constructor(t,e,r=()=>Date.now()){this.bornAt=Date.now(),this.bornAt=r(),this.onClick=()=>{r()-this.bornAt<qe||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()}}function x(){return window.matchMedia?.("(pointer: coarse)").matches??!1}class We{constructor(){this.applied=!1,this.previousPadding="",this.previousTransition=""}reserve(t){if(this.applied||t<=0)return;this.applied=!0;const e=document.body.style;this.previousPadding=e.paddingTop,this.previousTransition=e.transition;const r=parseFloat(getComputedStyle(document.body).paddingTop)||0;e.transition="none",e.paddingTop=`${r+t}px`}release(){if(!this.applied)return;this.applied=!1;const t=document.body.style;t.paddingTop=this.previousPadding,t.transition=this.previousTransition}isApplied(){return this.applied}}const Ve=44;class Ye{constructor(t,e,r,n,s="right",o=!0){this.currentMode="markup",this.handlePointerMove=a=>{if(a.pointerType!=="mouse")return;const l=this.hintBarEl.getBoundingClientRect(),d=a.clientX>=l.left&&a.clientX<=l.right&&a.clientY>=l.top&&a.clientY<=l.bottom;this.hintBarEl.classList.toggle("mtb-hint-bar--under-pointer",d)},this.dismissTouchHint=()=>{this.hintBarEl.classList.add("mtb-hint-bar--dismissed"),document.removeEventListener("pointerdown",this.dismissTouchHint,!0)},this.messages=e,this.touch=x(),this.hintBarEl=t.el("div","mtb-hint-bar"),this.hintBarEl.innerHTML=`<span class="mtb-toolbar-hint">${c(this.idleHint())}</span>`,this.touch&&!o&&this.hintBarEl.classList.add("mtb-hint-bar--dismissed"),this.el=t.el("div","mtb-toolbar"),s==="left"&&this.el.classList.add("left"),this.el.innerHTML=this.buildHTML(e),t.append(this.hintBarEl,this.el),this.host=t.host,this.host.setAttribute("data-mtb-toolbar",""),this.hintTextEl=this.hintBarEl.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"),n?.("markup")}),this.recordBtn.addEventListener("click",()=>{this.setMode("record"),n?.("record")}),this.el.querySelector(".mtb-exit-btn").addEventListener("click",r),document.addEventListener("pointermove",this.handlePointerMove),this.touch&&o&&document.addEventListener("pointerdown",this.dismissTouchHint,!0)}buildHTML(t){return`
|
|
9
9
|
<div class="mtb-toolbar-modes">
|
|
10
10
|
<button class="mtb-toolbar-mode-btn mtb-toolbar-mode-markup active" aria-label="${c(t.toolbar.markup)}" title="${c(t.toolbar.markup)}">
|
|
11
11
|
<svg width="16" height="16" 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><span class="mtb-toolbar-label">${c(t.toolbar.markup)}</span>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<path d="M18 6L6 18M6 6l12 12"/>
|
|
21
21
|
</svg><span class="mtb-toolbar-label">${c(t.toolbar.exit)}</span>
|
|
22
22
|
</button>
|
|
23
|
-
`}idleHint(){return this.touch?this.messages.toolbar.hintTouch:this.messages.toolbar.hint}setMode(t){this.currentMode=t,t==="markup"?(this.markupBtn.classList.add("active"),this.recordBtn.classList.remove("active"),this.hintTextEl.textContent=this.idleHint()):(this.markupBtn.classList.remove("active"),this.recordBtn.classList.add("active"),this.hintTextEl.textContent=this.messages.toolbar.hintRecord)}getMode(){return this.currentMode}height(){return this.el.getBoundingClientRect().height||We}destroy(){document.removeEventListener("pointermove",this.handlePointerMove),document.removeEventListener("pointerdown",this.dismissTouchHint,!0),this.host.removeAttribute("data-mtb-toolbar"),this.hintBarEl.remove(),this.el.remove()}}class Ye{constructor(t,e){this.handlers=e,this.overlayEl=t.el("div","mtb-overlay"),this.onPointerDown=r=>{const n=r;if(n.isPrimary){try{this.overlayEl.setPointerCapture(n.pointerId)}catch{}this.handlers.onPointerDown(n)}},this.onPointerMove=r=>{const n=r;n.isPrimary&&this.handlers.onPointerMove(n)},this.onPointerUp=r=>{const n=r;n.isPrimary&&(this.releaseCapture(n.pointerId),this.handlers.onPointerUp(n))},this.onPointerCancel=r=>{const n=r;n.isPrimary&&(this.releaseCapture(n.pointerId),this.handlers.onPointerCancel(n))},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 Xe{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=mt(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()}}const Ke=/^(script|style|noscript|template)$/i;function Zt(i,t=80){let e="";for(const r of Array.from(i.childNodes)){if(e.length>=t)break;r.nodeType===3?e+=r.nodeValue??"":r instanceof Element&&!Ke.test(r.tagName)&&(e+=Zt(r,t-e.length))}return e}function mt(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=Zt(i).trim().slice(0,40);if(r)return r;const n=i.placeholder;if(n)return n;const s=i.alt;if(s)return s;const o=i.getAttribute("data-mark");if(o)return o}return i.tagName.toLowerCase()}function Qt(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 n=Array.from(e.classList).filter(o=>!o.startsWith("mtb-")).slice(0,2).join(".");n&&(r+=`.${n}`);const s=e.parentElement;if(s){const o=Array.from(s.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 Ge{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 J="#059669",Je="5,150,105";function bt(i){return`rgba(${Je},${i})`}const Ze='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',L={color:J,width:"3.5",linecap:"round",linejoin:"round",filter:`drop-shadow(0 1px 2px ${bt(.35)})`};class Qe{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",xt(this.currentPoints)))}getCurrentSpan(){const[t]=this.currentPoints;if(!t)return 0;let e=0;for(const[r,n]of this.currentPoints)e=Math.max(e,Math.hypot(r-t[0],n-t[1]));return e}commitStroke(){return!this.isDrawing||!this.currentPath?!1:(this.isDrawing=!1,this.committed.push({path:this.currentPath,d:xt(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(n=>n.points),[e,r]=ti(t);return{type:"draw",x:e,y:r,drawPath:this.committed.map(n=>n.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}destroy(){this.svg.remove()}createPath(){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","none"),t.setAttribute("stroke",L.color),t.setAttribute("stroke-width",L.width),t.setAttribute("stroke-linecap",L.linecap),t.setAttribute("stroke-linejoin",L.linejoin),t.setAttribute("style",`filter:${L.filter}`),t}}function xt(i){if(i.length===0)return"";const[t,e]=i[0];let r=`M ${t} ${e}`;for(let n=1;n<i.length;n++){const[s,o]=i[n];r+=` L ${s} ${o}`}return r}function ti(i){const t=i.map(s=>s[0]),e=i.map(s=>s[1]),r=(Math.min(...t)+Math.max(...t))/2,n=(Math.min(...e)+Math.max(...e))/2;return[r,n]}const g="[Filtered]",ei=/-----BEGIN ((?:[A-Z0-9]+ )*PRIVATE KEY)-----[\s\S]*?-----END \1-----/g,ii=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,ri=[/\bsk-(?:proj-)?[A-Za-z0-9_-]{20,}\b/g,/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{20,}\b/g,/\bgh[pousr]_[A-Za-z0-9]{30,}\b/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bxox[baprs]-[A-Za-z0-9-]{20,}\b/g],ni=/\b(?:\d[ -]?){12,18}\d\b/g,si=/\bhttps?:\/\/[^\s<>"']+/gi,oi=new Set(["type","autocomplete","name","id","aria_label","placeholder"]),ai=new Set(["value","content"]),li=new Set(["password","hidden","file"]),ci=new Set(["current_password","new_password","one_time_code","cc_number","cc_csc","cc_exp","cc_exp_month","cc_exp_year"]),di=/(?:^|_)(?:password|passwd|passcode|card_(?:number|no)(?:_[0-9]+)?|credit_card|cc_(?:number|num|csc|cvv|cvc|exp|expiry)|cvv|cvc|csc|security_code|one_time_(?:code|password)|otp(?:_code)?|verification_code|auth(?:entication)?_token|access_token|refresh_token|id_token|token|api_key|client_secret|secret|authorization|cookie|set_cookie|credential|private_key|hidden_value|file_name|filename)(?:$|_(?:value|field|input|confirmation|confirm|header|data|pem)$)/;function A(i){let t=i.replace(ei,g).replace(ii,g);for(const e of ri)t=t.replace(e,g);return t=t.replace(ni,e=>hi(e)?g:e),t.replace(si,e=>$(e)||g)}function $(i){try{const t=new URL(i);return`${t.origin}${t.pathname}`}catch{return""}}function j(i,t){if(t&&te(t)&&i!=null)return g;if(typeof i=="string")return A(i);if(Array.isArray(i))return i.map(e=>j(e));if(i&&typeof i=="object"){const e=ee(i);return Object.fromEntries(Object.entries(i).map(([n,s])=>{const o=e&&ai.has(M(n))&&s!=null?g:j(s,n);return[A(n),o]}))}return i}function te(i){return di.test(M(i))}function ee(i){return Object.entries(i).some(([t,e])=>{if(typeof e!="string")return!1;const r=M(t);return oi.has(r)?r==="type"?li.has(M(e)):r==="autocomplete"?e.split(/\s+/).some(n=>ci.has(M(n))):te(e):!1})}function M(i){return i.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function hi(i){const t=i.replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let e=0,r=!1;for(let n=t.length-1;n>=0;n-=1){let s=Number(t[n]);r&&(s*=2,s>9&&(s-=9)),e+=s,r=!r}return e%10===0}function ie(i){return ee({type:i.getAttribute("type"),autocomplete:i.getAttribute("autocomplete"),name:i.getAttribute("name"),id:i.id,"aria-label":i.getAttribute("aria-label"),placeholder:i.getAttribute("placeholder")})}function W(i,t){return i&&(ie(t)?g:A(i))}const ui=512;function re(){return new WeakMap}function ne(i,t){let e=i.parentElement;for(;e&&e!==document.body&&e!==document.documentElement;){const r=se(e,t);if(r==="sensitive")return!0;if(r==="contains-sensitive-child"||r==="too-large")return!1;e=e.parentElement}return!1}function se(i,t){const e=t.get(i);if(e)return e;const r=i.textContent??"";let n="none";return r.length>ui?n="too-large":A(r)!==r&&(n=Array.from(i.children).some(o=>{const a=se(o,t);return a==="sensitive"||a==="contains-sensitive-child"})?"contains-sensitive-child":"sensitive"),t.set(i,n),n}const mi=60,kt=["value","content"],bi=Object.fromEntries(["button","checkbox","color","date","datetime-local","email","file","hidden","image","month","number","password","radio","range","reset","search","select","submit","tel","text","textarea","time","url","week"].map(i=>[i,!0])),Z="rr-block",U="rr-mask",pi="https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js",fi="sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";let B=null;function gi(){return B||(B=wi().catch(()=>vi()),B)}function yi(i,t){const e=j(i);return lt(e,t,re()),e}function lt(i,t,e){if(Array.isArray(i)){i.forEach(a=>lt(a,t,e));return}if(!St(i))return;const r=St(i.attributes)?i.attributes:null,n=r&&kt.some(a=>typeof r[a]=="string"),o=(typeof i.text=="string"||typeof i.textContent=="string"||typeof i.value=="string"||n)&&typeof i.id=="number"?t.mirror.getNode(i.id):null;if(o instanceof Element){if(typeof i.text=="string"&&(i.text=W(i.text,o)),r)for(const a of kt){const l=r[a];typeof l=="string"&&(r[a]=W(l,o))}}else o?.nodeType===Node.TEXT_NODE&&ne(o,e)&&(typeof i.textContent=="string"&&(i.textContent=g),typeof i.value=="string"&&(i.value=g));Object.values(i).forEach(a=>lt(a,t,e))}function St(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}async function wi(){return(await import("@rrweb/record")).record}function Et(){const i=globalThis;return i.rrwebRecord?.record??i.rrweb?.record}function vi(){return new Promise((i,t)=>{const e=Et();if(e){i(e);return}const r=document.createElement("script");r.src=pi,r.integrity=fi,r.crossOrigin="anonymous",r.onload=()=>{const n=Et();n?i(n):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 xi{constructor(t,e){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}async start(){const t=await gi();this.destroyed||(this.startedAt=Date.now(),this.stopped=!1,this.stopFn=t({emit:e=>{if(!this.stopped)try{this.events.push(yi(e,t))}catch{}},maskAllInputs:!1,maskInputOptions:bi,maskInputFn:(e,r)=>r.closest(`.${U}`)?g:W(e,r),maskTextFn:()=>g,blockClass:Z,maskTextClass:U}),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?.()},mi*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())}}const ki=`.${Z}, .${U}`;function Q(i){return i.closest(ki)!==null}function pt(i){const t=i.getAttribute("role")?.trim().split(/\s+/)[0];return t&&/^[a-z][a-z0-9-]*$/i.test(t)?t:i.tagName.toLowerCase()}function oe(i){return i.tagName.toLowerCase()}const Si=10;function Tt(i){return Q(i)?{name:pt(i),text:"",selector:oe(i)}:{name:mt(i),text:i.textContent?.trim().slice(0,200)??"",selector:Qt(i)}}class Ei{constructor(t,e,r){this.messages=e,this.handlers=r,this.interactionActive=!0,this.pendingHighlightFrame=null,this.lastMoveX=0,this.lastMoveY=0,this.touch=x(),this.highlighter=new Xe(t),this.pinMarker=new Ge(t),this.drawLayer=new Qe(t),this.overlay=new Ye(t,{onPointerDown:n=>this.handlePointerDown(n),onPointerMove:n=>this.handlePointerMove(n),onPointerUp:n=>this.handlePointerUp(n),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=et(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.getCurrentSpan()>=Si){this.drawLayer.commitStroke(),this.highlighter.hide(),this.handlers.onDrawStroke();return}if(this.drawLayer.cancelCurrentDraw(),this.touch||this.drawLayer.hasStrokes()||!t)return;const e=et(t.clientX,t.clientY),r=e?Tt(e):null,n=r?.name??this.messages.annotation.element,s=e?.getBoundingClientRect(),o={type:"pin",x:t.clientX,y:t.clientY,targetSelector:r?.selector,targetText:r?.text??"",targetName:n,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(o,n)}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(){const t=this.drawLayer.getAnnotation();if(!t)return null;const e=et(t.x,t.y);if(!e)return t;const r=e.getBoundingClientRect(),n=Tt(e);return{...t,targetSelector:n.selector,targetText:n.text,targetName:n.name,targetRect:{top:r.top,left:r.left,width:r.width,height:r.height,bottom:r.bottom}}}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 et(i,t){return document.elementsFromPoint(i,t).find(e=>e.id!=="mtb-widget-host")??null}const Ti=140;class _i{constructor(){this.onChange=null,this.timer=null,this.lastReading=null,this.handler=()=>{this.timer!==null&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null;const t=this.current();if(t===this.lastReading){this.lastReading=null,this.onChange?.(t);return}this.lastReading=t,this.handler()},Ti)}}current(){const t=window.visualViewport;if(!t||t.height<=0)return 0;const e=Math.round(window.innerHeight-(t.height+t.offsetTop));return Math.min(Math.max(0,e),window.innerHeight)}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,this.lastReading=null,this.timer!==null&&(clearTimeout(this.timer),this.timer=null),t&&(t.removeEventListener("resize",this.handler),t.removeEventListener("scroll",this.handler))}}const Ci=480;function Ai(){return window.innerWidth<=Ci}class ft{constructor(t){this.el=t,this.inset=new _i}apply(){return Ai()?(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){const e=Math.max(0,window.innerHeight-this.el.offsetHeight),r=Math.min(t,e);this.el.style.bottom=r>0?`${r}px`:""}}class Li{constructor(t,e){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 ft(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.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({preventScroll:!0})}buildHTML(t){return`
|
|
23
|
+
`}idleHint(){return this.touch?this.messages.toolbar.hintTouch:this.messages.toolbar.hint}setMode(t){this.currentMode=t,t==="markup"?(this.markupBtn.classList.add("active"),this.recordBtn.classList.remove("active"),this.hintTextEl.textContent=this.idleHint()):(this.markupBtn.classList.remove("active"),this.recordBtn.classList.add("active"),this.hintTextEl.textContent=this.messages.toolbar.hintRecord)}getMode(){return this.currentMode}height(){return this.el.getBoundingClientRect().height||Ve}destroy(){document.removeEventListener("pointermove",this.handlePointerMove),document.removeEventListener("pointerdown",this.dismissTouchHint,!0),this.host.removeAttribute("data-mtb-toolbar"),this.hintBarEl.remove(),this.el.remove()}}class Xe{constructor(t,e){this.handlers=e,this.overlayEl=t.el("div","mtb-overlay"),this.onPointerDown=r=>{const n=r;if(n.isPrimary){try{this.overlayEl.setPointerCapture(n.pointerId)}catch{}this.handlers.onPointerDown(n)}},this.onPointerMove=r=>{const n=r;n.isPrimary&&this.handlers.onPointerMove(n)},this.onPointerUp=r=>{const n=r;n.isPrimary&&(this.releaseCapture(n.pointerId),this.handlers.onPointerUp(n))},this.onPointerCancel=r=>{const n=r;n.isPrimary&&(this.releaseCapture(n.pointerId),this.handlers.onPointerCancel(n))},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 Ke{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=pt(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()}}const Ge=/^(script|style|noscript|template)$/i;function te(i,t=80){let e="";for(const r of Array.from(i.childNodes)){if(e.length>=t)break;r.nodeType===3?e+=r.nodeValue??"":r instanceof Element&&!Ge.test(r.tagName)&&(e+=te(r,t-e.length))}return e}function pt(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=te(i).trim().slice(0,40);if(r)return r;const n=i.placeholder;if(n)return n;const s=i.alt;if(s)return s;const o=i.getAttribute("data-mark");if(o)return o}return i.tagName.toLowerCase()}function ee(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 n=Array.from(e.classList).filter(o=>!o.startsWith("mtb-")).slice(0,2).join(".");n&&(r+=`.${n}`);const s=e.parentElement;if(s){const o=Array.from(s.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 Je{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 Z="#059669",Ze="5,150,105";function ft(i){return`rgba(${Ze},${i})`}const Qe='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',L={color:Z,width:"3.5",linecap:"round",linejoin:"round",filter:`drop-shadow(0 1px 2px ${ft(.35)})`};class ti{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",St(this.currentPoints)))}getCurrentSpan(){const[t]=this.currentPoints;if(!t)return 0;let e=0;for(const[r,n]of this.currentPoints)e=Math.max(e,Math.hypot(r-t[0],n-t[1]));return e}commitStroke(){return!this.isDrawing||!this.currentPath?!1:(this.isDrawing=!1,this.committed.push({path:this.currentPath,d:St(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(n=>n.points),[e,r]=ei(t);return{type:"draw",x:e,y:r,drawPath:this.committed.map(n=>n.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}destroy(){this.svg.remove()}createPath(){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","none"),t.setAttribute("stroke",L.color),t.setAttribute("stroke-width",L.width),t.setAttribute("stroke-linecap",L.linecap),t.setAttribute("stroke-linejoin",L.linejoin),t.setAttribute("style",`filter:${L.filter}`),t}}function St(i){if(i.length===0)return"";const[t,e]=i[0];let r=`M ${t} ${e}`;for(let n=1;n<i.length;n++){const[s,o]=i[n];r+=` L ${s} ${o}`}return r}function ei(i){const t=i.map(s=>s[0]),e=i.map(s=>s[1]),r=(Math.min(...t)+Math.max(...t))/2,n=(Math.min(...e)+Math.max(...e))/2;return[r,n]}const g="[Filtered]",ii=/-----BEGIN ((?:[A-Z0-9]+ )*PRIVATE KEY)-----[\s\S]*?-----END \1-----/g,ri=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,ni=[/\bsk-(?:proj-)?[A-Za-z0-9_-]{20,}\b/g,/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{20,}\b/g,/\bgh[pousr]_[A-Za-z0-9]{30,}\b/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bxox[baprs]-[A-Za-z0-9-]{20,}\b/g],si=/\b(?:\d[ -]?){12,18}\d\b/g,oi=/\bhttps?:\/\/[^\s<>"']+/gi,ai=new Set(["type","autocomplete","name","id","aria_label","placeholder"]),li=new Set(["value","content"]),ci=new Set(["password","hidden","file"]),di=new Set(["current_password","new_password","one_time_code","cc_number","cc_csc","cc_exp","cc_exp_month","cc_exp_year"]),hi=/(?:^|_)(?:password|passwd|passcode|card_(?:number|no)(?:_[0-9]+)?|credit_card|cc_(?:number|num|csc|cvv|cvc|exp|expiry)|cvv|cvc|csc|security_code|one_time_(?:code|password)|otp(?:_code)?|verification_code|auth(?:entication)?_token|access_token|refresh_token|id_token|token|api_key|client_secret|secret|authorization|cookie|set_cookie|credential|private_key|hidden_value|file_name|filename)(?:$|_(?:value|field|input|confirmation|confirm|header|data|pem)$)/;function A(i){let t=i.replace(ii,g).replace(ri,g);for(const e of ni)t=t.replace(e,g);return t=t.replace(si,e=>ui(e)?g:e),t.replace(oi,e=>N(e)||g)}function N(i){try{const t=new URL(i);return`${t.origin}${t.pathname}`}catch{return""}}function W(i,t){if(t&&ie(t)&&i!=null)return g;if(typeof i=="string")return A(i);if(Array.isArray(i))return i.map(e=>W(e));if(i&&typeof i=="object"){const e=re(i);return Object.fromEntries(Object.entries(i).map(([n,s])=>{const o=e&&li.has(M(n))&&s!=null?g:W(s,n);return[A(n),o]}))}return i}function ie(i){return hi.test(M(i))}function re(i){return Object.entries(i).some(([t,e])=>{if(typeof e!="string")return!1;const r=M(t);return ai.has(r)?r==="type"?ci.has(M(e)):r==="autocomplete"?e.split(/\s+/).some(n=>di.has(M(n))):ie(e):!1})}function M(i){return i.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function ui(i){const t=i.replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let e=0,r=!1;for(let n=t.length-1;n>=0;n-=1){let s=Number(t[n]);r&&(s*=2,s>9&&(s-=9)),e+=s,r=!r}return e%10===0}function ne(i){return re({type:i.getAttribute("type"),autocomplete:i.getAttribute("autocomplete"),name:i.getAttribute("name"),id:i.id,"aria-label":i.getAttribute("aria-label"),placeholder:i.getAttribute("placeholder")})}function V(i,t){return i&&(ne(t)?g:A(i))}const mi=512;function se(){return new WeakMap}function oe(i,t){let e=i.parentElement;for(;e&&e!==document.body&&e!==document.documentElement;){const r=ae(e,t);if(r==="sensitive")return!0;if(r==="contains-sensitive-child"||r==="too-large")return!1;e=e.parentElement}return!1}function ae(i,t){const e=t.get(i);if(e)return e;const r=i.textContent??"";let n="none";return r.length>mi?n="too-large":A(r)!==r&&(n=Array.from(i.children).some(o=>{const a=ae(o,t);return a==="sensitive"||a==="contains-sensitive-child"})?"contains-sensitive-child":"sensitive"),t.set(i,n),n}const bi=60,Et=["value","content"],pi=Object.fromEntries(["button","checkbox","color","date","datetime-local","email","file","hidden","image","month","number","password","radio","range","reset","search","select","submit","tel","text","textarea","time","url","week"].map(i=>[i,!0])),Q="rr-block",U="rr-mask",fi="https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js",gi="sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";let B=null;function yi(){return B||(B=vi().catch(()=>xi()),B)}function wi(i,t){const e=W(i);return dt(e,t,se()),e}function dt(i,t,e){if(Array.isArray(i)){i.forEach(a=>dt(a,t,e));return}if(!Tt(i))return;const r=Tt(i.attributes)?i.attributes:null,n=r&&Et.some(a=>typeof r[a]=="string"),o=(typeof i.text=="string"||typeof i.textContent=="string"||typeof i.value=="string"||n)&&typeof i.id=="number"?t.mirror.getNode(i.id):null;if(o instanceof Element){if(typeof i.text=="string"&&(i.text=V(i.text,o)),r)for(const a of Et){const l=r[a];typeof l=="string"&&(r[a]=V(l,o))}}else o?.nodeType===Node.TEXT_NODE&&oe(o,e)&&(typeof i.textContent=="string"&&(i.textContent=g),typeof i.value=="string"&&(i.value=g));Object.values(i).forEach(a=>dt(a,t,e))}function Tt(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}async function vi(){return(await import("@rrweb/record")).record}function _t(){const i=globalThis;return i.rrwebRecord?.record??i.rrweb?.record}function xi(){return new Promise((i,t)=>{const e=_t();if(e){i(e);return}const r=document.createElement("script");r.src=fi,r.integrity=gi,r.crossOrigin="anonymous",r.onload=()=>{const n=_t();n?i(n):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 ki{constructor(t,e){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}async start(){const t=await yi();this.destroyed||(this.startedAt=Date.now(),this.stopped=!1,this.stopFn=t({emit:e=>{if(!this.stopped)try{this.events.push(wi(e,t))}catch{}},maskAllInputs:!1,maskInputOptions:pi,maskInputFn:(e,r)=>r.closest(`.${U}`)?g:V(e,r),maskTextFn:()=>g,blockClass:Q,maskTextClass:U}),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?.()},bi*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())}}const Si=`.${Q}, .${U}`;function tt(i){return i.closest(Si)!==null}function gt(i){const t=i.getAttribute("role")?.trim().split(/\s+/)[0];return t&&/^[a-z][a-z0-9-]*$/i.test(t)?t:i.tagName.toLowerCase()}function le(i){return i.tagName.toLowerCase()}const Ei=10;function Ct(i){return tt(i)?{name:gt(i),text:"",selector:le(i)}:{name:pt(i),text:i.textContent?.trim().slice(0,200)??"",selector:ee(i)}}class Ti{constructor(t,e,r){this.messages=e,this.handlers=r,this.interactionActive=!0,this.pendingHighlightFrame=null,this.lastMoveX=0,this.lastMoveY=0,this.touch=x(),this.highlighter=new Ke(t),this.pinMarker=new Je(t),this.drawLayer=new ti(t),this.overlay=new Xe(t,{onPointerDown:n=>this.handlePointerDown(n),onPointerMove:n=>this.handlePointerMove(n),onPointerUp:n=>this.handlePointerUp(n),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=it(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.getCurrentSpan()>=Ei){this.drawLayer.commitStroke(),this.highlighter.hide(),this.handlers.onDrawStroke();return}if(this.drawLayer.cancelCurrentDraw(),this.touch||this.drawLayer.hasStrokes()||!t)return;const e=it(t.clientX,t.clientY),r=e?Ct(e):null,n=r?.name??this.messages.annotation.element,s=e?.getBoundingClientRect(),o={type:"pin",x:t.clientX,y:t.clientY,targetSelector:r?.selector,targetText:r?.text??"",targetName:n,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(o,n)}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(){const t=this.drawLayer.getAnnotation();if(!t)return null;const e=it(t.x,t.y);if(!e)return t;const r=e.getBoundingClientRect(),n=Ct(e);return{...t,targetSelector:n.selector,targetText:n.text,targetName:n.name,targetRect:{top:r.top,left:r.left,width:r.width,height:r.height,bottom:r.bottom}}}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 it(i,t){return document.elementsFromPoint(i,t).find(e=>e.id!=="mtb-widget-host")??null}const _i=140;class Ci{constructor(){this.onChange=null,this.timer=null,this.lastReading=null,this.handler=()=>{this.timer!==null&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null;const t=this.current();if(t===this.lastReading){this.lastReading=null,this.onChange?.(t);return}this.lastReading=t,this.handler()},_i)}}current(){const t=window.visualViewport;if(!t||t.height<=0)return 0;const e=Math.round(window.innerHeight-(t.height+t.offsetTop));return Math.min(Math.max(0,e),window.innerHeight)}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,this.lastReading=null,this.timer!==null&&(clearTimeout(this.timer),this.timer=null),t&&(t.removeEventListener("resize",this.handler),t.removeEventListener("scroll",this.handler))}}const Ai=480;function Li(){return window.innerWidth<=Ai}class yt{constructor(t){this.el=t,this.inset=new Ci}apply(){return Li()?(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){const e=Math.max(0,window.innerHeight-this.el.offsetHeight),r=Math.min(t,e);this.el.style.bottom=r>0?`${r}px`:""}}class Pi{constructor(t,e){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 yt(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.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({preventScroll:!0})}buildHTML(t){return`
|
|
24
24
|
<input class="mtb-draw-input" type="text" placeholder="${c(t.draw.note_placeholder)}" />
|
|
25
25
|
<button class="mtb-draw-icon-btn mtb-draw-undo" type="button" title="${c(t.draw.undo)}" aria-label="${c(t.draw.undo)}" disabled>
|
|
26
26
|
<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>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<span class="mtb-draw-sep"></span>
|
|
32
32
|
<button class="mtb-draw-cancel" type="button">${c(t.draw.cancel)}</button>
|
|
33
33
|
<button class="mtb-draw-submit" type="button">${c(t.draw.submit)}</button>
|
|
34
|
-
`}setUndoRedo(t,e){this.undoBtn.disabled=!t,this.redoBtn.disabled=!e}submit(){this.onSubmit(this.input.value.trim())}destroy(){this.sheet.release(),this.el.remove()}}function
|
|
34
|
+
`}setUndoRedo(t,e){this.undoBtn.disabled=!t,this.redoBtn.disabled=!e}submit(){this.onSubmit(this.input.value.trim())}destroy(){this.sheet.release(),this.el.remove()}}function Mi(i){let t=!1;const e=()=>{t=!0},r=n=>{n.detail>0&&!t&&(n.stopPropagation(),n.preventDefault()),t=!1};return i.addEventListener("pointerdown",e,!0),i.addEventListener("click",r,!0),()=>{i.removeEventListener("pointerdown",e,!0),i.removeEventListener("click",r,!0)}}class At{constructor(t,e){this.releaseGuard=null,this.selectedQuickOption=null,this.onSubmit=e.onSubmit,this.onClose=e.onClose,this.submitLabel=e.messages.popup.submit,this.messages=e.messages,this.el=t.el("div","mtb-popup"),this.el.innerHTML=this.buildHTML(e),t.append(this.el),this.sheet=new yt(this.el),x()&&(this.releaseGuard=Mi(this.el)),this.textarea=this.el.querySelector(".mtb-textarea"),this.submitBtn=this.el.querySelector(".mtb-submit-btn"),this.positionPopup(e.x,e.y,e.targetRect,e.position??"right"),this.bindEvents(e.messages),e.onMyFeedback&&this.el.querySelector(".mtb-my-feedback").addEventListener("click",e.onMyFeedback),x()||this.textarea.focus({preventScroll:!0})}buildHTML(t){const e=t.messages,r=e.popup.quickOptions.map(n=>`
|
|
35
35
|
<button class="mtb-quick-option" data-quick="${c(n.label)}">
|
|
36
36
|
<span class="mtb-quick-option-emoji">${c(n.emoji)}</span>
|
|
37
37
|
<span>${c(n.label)}</span>
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
</div>
|
|
63
63
|
${t.onMyFeedback?`<button class="mtb-my-feedback" type="button">${c(e.popup.my_feedback)}</button>`:""}
|
|
64
64
|
</div>
|
|
65
|
-
`}positionPopup(t,e,r,n){if(this.sheet.apply())return;const s=window.innerWidth,o=window.innerHeight,a=12,l=8,d=32,u=Math.min(320,s-2*a-d),h=this.el.offsetHeight||260,m=a+(n==="left"?d:0),w=s-a-(n==="right"?d:0);let v,y;const
|
|
65
|
+
`}positionPopup(t,e,r,n){if(this.sheet.apply())return;const s=window.innerWidth,o=window.innerHeight,a=12,l=8,d=32,u=Math.min(320,s-2*a-d),h=this.el.offsetHeight||260,m=a+(n==="left"?d:0),w=s-a-(n==="right"?d:0);let v,y;const Pe=r&&r.width<s*.6&&r.height<o*.6;r&&Pe?(v=r.left,y=r.bottom+l,y+h>o-a&&(y=r.top-h-l),y<a&&(y=Math.min(r.bottom+l,o-h-a))):(v=t+12,y=e+12),v+u>w&&(v=w-u),v<m&&(v=m),y<a&&(y=a),this.el.style.left=`${v}px`,this.el.style.top=`${y}px`,this.el.style.maxHeight=`${o-y-a}px`}bindEvents(t){this.el.querySelector(".mtb-popup-close").addEventListener("click",()=>this.onClose()),this.el.querySelector(".mtb-cancel-btn").addEventListener("click",()=>this.onClose()),this.el.querySelectorAll(".mtb-quick-option").forEach(e=>{e.addEventListener("click",()=>{const r=e.dataset.quick??"";if(this.textarea.value.trim().length===0){this.textarea.value=r,this.updateSubmitState(),this.submit();return}this.selectedQuickOption=r,this.el.querySelectorAll(".mtb-quick-option").forEach(n=>{n.classList.toggle("selected",n===e)})})}),this.textarea.addEventListener("input",()=>this.updateSubmitState()),this.textarea.addEventListener("keydown",e=>{e.isComposing||e.keyCode===229||e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),this.submit())}),this.submitBtn.addEventListener("click",()=>this.submit())}updateSubmitState(){const t=this.textarea.value.trim().length>0;this.submitBtn.classList.toggle("ready",t),this.submitBtn.disabled=!t}submit(){const t=this.textarea.value.trim();if(!t)return;const e=this.selectedQuickOption?`[${this.selectedQuickOption}] ${t}`:t;this.onSubmit(e)}releaseElement(){return this.releaseGuard?.(),this.releaseGuard=null,this.sheet.release(),this.el}destroy(){this.releaseGuard?.(),this.releaseGuard=null,this.sheet.release(),this.el.remove()}}class ce extends Error{constructor(t){super(`HTTP ${t}`),this.name="ApiError",this.status=t}}function Ri(i){return i instanceof ce&&i.status===409}const Ii="https://makethisbetter.dev/api/v1",Di="sensitive-data-v1";class Hi{constructor(t,e,r=1e3,n,s){this.projectKey=t,this.apiUrl=(e??Ii).replace(/\/$/,""),this.retryDelayMs=r,this.userToken=n,this.userTokenFn=s}async resolveUserToken(){return this.userTokenFn?this.userTokenFn():this.userToken}async authHeaders(t){const e={"X-Project-Key":this.projectKey},r=await this.resolveUserToken();return r&&(e["X-User-Token"]=r),t&&(e["Content-Type"]=t),e}async submissionHeaders(t,e){const r=await this.authHeaders(e);return r["X-Submission-Token"]=t,r}async createSubmissionSession(t,e){const r=Ni(),n=new FormData;if(n.append("feedback[description]",t.description),n.append("feedback[page_url]",t.page_url),n.append("feedback[user_agent]",t.user_agent),n.append("feedback[browser]",t.browser),n.append("feedback[os]",t.os),n.append("feedback[screen_width]",String(t.screen_width)),n.append("feedback[screen_height]",String(t.screen_height)),n.append("feedback[console_errors]",JSON.stringify(t.console_errors)),n.append("feedback[annotations]",JSON.stringify(t.annotations)),t.target_element&&n.append("feedback[target_element]",JSON.stringify(t.target_element)),t.user_id&&n.append("feedback[user_id]",t.user_id),t.reporter_external_id&&n.append("feedback[reporter_external_id]",t.reporter_external_id),t.reporter_email&&n.append("feedback[reporter_email]",t.reporter_email),t.user_email&&n.append("feedback[user_email]",t.user_email),t.user_name&&n.append("feedback[user_name]",t.user_name),t.breadcrumbs&&t.breadcrumbs.length>0&&n.append("feedback[breadcrumbs]",JSON.stringify(t.breadcrumbs)),t.recording_events&&t.recording_events.length>0){const l=JSON.stringify(t.recording_events),d=new Blob([l],{type:"application/json"});n.append("feedback[recording]",d,"interaction-replay.json"),n.append("feedback[recording_duration]",String(t.recording_duration??0))}if(e){const l=e.type==="image/jpeg"?"jpg":"png";n.append("feedback[screenshot]",e,`screenshot.${l}`)}const s=await this.authHeaders();return s["X-Submission-Token"]=r,s["X-MTB-Capture-Policy"]=Di,s["X-Idempotency-Key"]=$i(),{...(await(await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions`,{method:"POST",headers:s,body:n})).json()).submission_session,token:r}}async createIdentityToken(t){const e=await this.authHeaders("application/json");try{return await(await this.fetchWithRetry(`${this.apiUrl}/widget/identity_tokens`,{method:"POST",headers:e,body:JSON.stringify({reporter_external_id:t})})).json()}catch{return null}}async updateReporter(t,e,r){const n=await this.authHeaders("application/json");n["X-Identity-Token"]=r;try{return await this.fetchWithRetry(`${this.apiUrl}/widget/feedbacks/${t}/reporter`,{method:"PATCH",headers:n,body:JSON.stringify({reporter:{email:e}})}),!0}catch{return!1}}async startClarification(t,e,r){const n={};return r&&(n.message=A(r)),this.requestClarification(t,e,n)}async retryClarification(t,e){return this.requestClarification(t,e,{retry:!0})}async requestClarification(t,e,r){const n=await this.submissionHeaders(e,"application/json");return(await(await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions/${t}/clarification`,{method:"POST",headers:n,body:JSON.stringify(r)})).json()).clarification}async getClarification(t,e){const r=await this.submissionHeaders(e);return(await(await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions/${t}/clarification`,{method:"GET",headers:r})).json()).clarification}async streamClarification(t,e,r,n){const s=await this.submissionHeaders(e,"application/json");s.Accept="text/event-stream";const o=await fetch(`${this.apiUrl}/widget/feedback_submission_sessions/${t}/clarification`,{method:"POST",headers:s,body:JSON.stringify({}),signal:n}),a=o.headers.get("Content-Type")??"";if(!o.ok||!o.body||!a.includes("text/event-stream"))throw new Error("clarify stream unavailable");return Fi(o.body,r)}async finalizeSubmissionSession(t,e){const r=await this.submissionHeaders(e);return(await(await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions/${t}/feedback`,{method:"POST",headers:r})).json()).feedback}async abandonSubmissionSession(t,e){const r=await this.submissionHeaders(e);await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions/${t}`,{method:"DELETE",headers:r})}async fetchWithRetry(t,e,r=1){let n;try{n=await fetch(t,e)}catch(s){if(r>0)return await Lt(this.retryDelayMs),this.fetchWithRetry(t,e,r-1);throw s}if(n.ok)return n;if(n.status>=500&&r>0)return await Lt(this.retryDelayMs),this.fetchWithRetry(t,e,r-1);throw new ce(n.status)}}function Lt(i){return i<=0?Promise.resolve():new Promise(t=>setTimeout(t,i))}async function Fi(i,t){const e=i.getReader(),r=new TextDecoder;let n="",s=null;const o=a=>{const l=a.split(`
|
|
66
66
|
`).find(m=>m.startsWith("event:")),d=a.split(`
|
|
67
67
|
`).find(m=>m.startsWith("data:"));if(!d)return;const u=l?.slice(6).trim(),h=JSON.parse(d.slice(5).trim());u==="delta"&&typeof h.text=="string"?t(h.text):u==="done"&&(s={messages:Array.isArray(h.messages)?h.messages:[],done:h.done!==!1,failed:h.error===!0})};for(;;){const{done:a,value:l}=await e.read();if(a)break;n+=r.decode(l,{stream:!0});let d;for(;(d=n.indexOf(`
|
|
68
68
|
|
|
69
|
-
`))!==-1;){const u=n.slice(0,d);n=n.slice(d+2);try{o(u)}catch{}}}if(n+=r.decode(),n.trim())try{o(n)}catch{}if(!s)throw new Error("clarify stream ended before done");return s}function
|
|
69
|
+
`))!==-1;){const u=n.slice(0,d);n=n.slice(d+2);try{o(u)}catch{}}}if(n+=r.decode(),n.trim())try{o(n)}catch{}if(!s)throw new Error("clarify stream ended before done");return s}function $i(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}function Ni(){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 Ui=2e3,Bi=45e3,Pt=12e3,Oi=346,zi=270;class qi{constructor(t,e){this.pollTimer=null,this.pollDeadline=0,this.streamingBubble=null,this.lastMessages=[],this.done=!1,this.sending=!1,this.finalSubmissionStarted=!1,this.finalizing=!1,this.destroyed=!1,this.streamAbort=null,this.unrecoverable=!1,this.submissionFailed=!1,this.handleKeydown=n=>{n.isComposing||n.keyCode===229||n.key!=="Enter"||n.shiftKey||n.target===this.inputEl&&!this.inputEl.disabled||(n.preventDefault(),this.skipAndFinalize())},this.submissionSessionId=e.submissionSessionId??"",this.submissionToken=e.submissionToken??"",this.apiClient=e.apiClient,this.onFinalize=e.onFinalize,this.onCancel=e.onCancel,this.i18n=e.messages,this.pendingSession=e.pendingSession,this.onRetrySubmission=e.onRetrySubmission;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 yt(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(),window.addEventListener("keydown",this.handleKeydown),this.startConversation()}positionCard(t,e,r){if(this.sheet.apply())return;const n=window.innerWidth,s=window.innerHeight,o=12,a=32,l=Math.min(Oi,n-2*o-a),d=this.el.offsetHeight||zi,u=o+(r==="left"?a:0),h=n-o-(r==="right"?a:0);if(t===void 0||e===void 0){const v=Math.max(u,(n-l)/2);this.el.style.left=`${Math.min(v,h-l)}px`,this.el.style.top=`${Math.max(o,(s-d)/2)}px`,this.el.style.maxHeight=`${s-2*o}px`;return}let m=t+12,w=e+12;m+l>h&&(m=t-l-12),m+l>h&&(m=h-l),m<u&&(m=u),w+d>s-o&&(w=s-d-o),w<o&&(w=o),this.el.style.left=`${m}px`,this.el.style.top=`${w}px`,this.el.style.maxHeight=`${s-w-o}px`}buildHTML(t){return`
|
|
70
70
|
<div class="mtb-clarify-header">
|
|
71
71
|
<span class="mtb-clarify-icon">
|
|
72
72
|
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
`}bindEvents(){this.el.querySelector(".mtb-clarify-close").addEventListener("click",()=>this.skipAndFinalize()),this.bindConversationControls()}bindConversationControls(){this.inputEl=this.el.querySelector(".mtb-clarify-input"),this.sendBtn=this.el.querySelector(".mtb-clarify-send"),this.el.querySelector(".mtb-clarify-skip").addEventListener("click",()=>this.skipAndFinalize()),this.inputEl.addEventListener("input",()=>{this.sendBtn.disabled=!this.inputEl.value.trim()}),this.inputEl.addEventListener("keydown",t=>{t.isComposing||t.keyCode===229||t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),this.sendMessage())}),this.sendBtn.addEventListener("click",()=>this.sendMessage())}skipAndFinalize(){if(this.submissionFailed){this.onCancel?.();return}this.stopPolling(),this.finalize()}async startConversation(){if(this.showThinking(),this.pendingSession){this.inputEl.disabled=!0,await this.adoptSession(this.pendingSession);return}await this.runInitialTurn()}async adoptSession(t){let e;try{e=await t}catch{e=null}if(!this.destroyed){if(!e){this.showSubmissionFailure();return}if(this.submissionSessionId=e.id,this.submissionToken=e.token,this.inputEl.disabled=!1,!e.ai_clarify_available){this.applyResult({messages:[],done:!0});return}await this.runInitialTurn()}}showSubmissionFailure(){this.submissionFailed=!0,this.stopPolling(),this.removeThinking();const t=this.el.querySelector(".mtb-clarify-footer");t.innerHTML=`
|
|
102
102
|
<div class="mtb-clarify-error">${c(this.i18n.error.submit)}</div>
|
|
103
103
|
<button class="mtb-clarify-send-feedback mtb-clarify-retry" type="button">${c(this.i18n.clarify.retry)}</button>
|
|
104
|
-
`,t.querySelector(".mtb-clarify-retry").addEventListener("click",()=>{this.destroyed||this.retrySubmission()})}async retrySubmission(){!this.onRetrySubmission||this.sending||(this.submissionFailed=!1,this.showConversationControls(),this.inputEl.disabled=!0,this.showThinking(),await this.adoptSession(this.onRetrySubmission()))}async sendMessage(){const t=this.inputEl.value.trim();if(!(!t||this.sending||!this.submissionSessionId)){this.sending=!0,this.inputEl.disabled=!0,this.sendBtn.disabled=!0,this.sendBtn.setAttribute("aria-busy","true"),this.stopPolling(),this.finalSubmissionStarted=!0,this.appendMessage({role:"user",content:t}),this.inputEl.value="",this.clearError();try{await this.runAnswerTurn(t)}catch{if(this.destroyed)return;this.finalSubmissionStarted=!1,this.sending=!1,this.renderConversation(this.lastMessages,!1),this.inputEl.value=t,this.showError(),this.sendBtn.removeAttribute("aria-busy"),this.inputEl.disabled=!1,this.sendBtn.disabled=!this.inputEl.value.trim(),this.inputEl.focus({preventScroll:!0})}}}async runInitialTurn(){const t=new AbortController;this.streamAbort=t;let e=setTimeout(()=>t.abort(),
|
|
104
|
+
`,t.querySelector(".mtb-clarify-retry").addEventListener("click",()=>{this.destroyed||this.retrySubmission()})}async retrySubmission(){!this.onRetrySubmission||this.sending||(this.submissionFailed=!1,this.showConversationControls(),this.inputEl.disabled=!0,this.showThinking(),await this.adoptSession(this.onRetrySubmission()))}async sendMessage(){const t=this.inputEl.value.trim();if(!(!t||this.sending||!this.submissionSessionId)){this.sending=!0,this.inputEl.disabled=!0,this.sendBtn.disabled=!0,this.sendBtn.setAttribute("aria-busy","true"),this.stopPolling(),this.finalSubmissionStarted=!0,this.appendMessage({role:"user",content:t}),this.inputEl.value="",this.clearError();try{await this.runAnswerTurn(t)}catch{if(this.destroyed)return;this.finalSubmissionStarted=!1,this.sending=!1,this.renderConversation(this.lastMessages,!1),this.inputEl.value=t,this.showError(),this.sendBtn.removeAttribute("aria-busy"),this.inputEl.disabled=!1,this.sendBtn.disabled=!this.inputEl.value.trim(),this.inputEl.focus({preventScroll:!0})}}}async runInitialTurn(){const t=new AbortController;this.streamAbort=t;let e=setTimeout(()=>t.abort(),Pt);try{const r=await this.apiClient.streamClarification(this.submissionSessionId,this.submissionToken,n=>{clearTimeout(e),e=setTimeout(()=>t.abort(),Pt),this.appendStreamDelta(n)},t.signal);if(this.destroyed)return;this.endStreamingBubble(),this.applyResult(r)||this.startPolling()}catch{if(this.destroyed)return;this.endStreamingBubble(),await this.runInitialTurnViaPolling()}finally{clearTimeout(e),this.streamAbort===t&&(this.streamAbort=null)}}async runInitialTurnViaPolling(){try{const t=await this.apiClient.startClarification(this.submissionSessionId,this.submissionToken);if(this.destroyed)return;this.applyResult(t)||this.startPolling()}catch{if(this.destroyed)return;this.handleFailure()}}async runAnswerTurn(t){const e=await this.apiClient.startClarification(this.submissionSessionId,this.submissionToken,t);this.destroyed||this.applyFinalSubmissionResult(e)||this.startPolling()}showError(){const t=this.el.querySelector(".mtb-clarify-footer"),e=document.createElement("div");e.className="mtb-clarify-error",e.textContent=this.i18n.error.submit,t.prepend(e)}clearError(){this.el.querySelector(".mtb-clarify-error")?.remove()}appendStreamDelta(t){this.streamingBubble||(this.removeThinking(),this.streamingBubble=document.createElement("div"),this.streamingBubble.className="mtb-clarify-bubble mtb-clarify-ai",this.messagesEl.appendChild(this.streamingBubble)),this.streamingBubble.textContent=(this.streamingBubble.textContent??"")+t,this.messagesEl.scrollTop=this.messagesEl.scrollHeight}endStreamingBubble(){this.streamingBubble=null}startPolling(){this.stopPolling(),this.pollDeadline=Date.now()+Bi,this.pollTimer=setInterval(()=>this.poll(),Ui)}stopPolling(){this.pollTimer!==null&&(clearInterval(this.pollTimer),this.pollTimer=null)}async poll(){if(Date.now()>this.pollDeadline){this.stopPolling(),this.handleFailure();return}try{const t=await this.apiClient.getClarification(this.submissionSessionId,this.submissionToken);if(this.destroyed)return;(this.finalSubmissionStarted?this.applyFinalSubmissionResult(t):this.applyResult(t))&&this.stopPolling()}catch{if(this.destroyed)return;this.stopPolling(),this.handleFailure()}}handleDone(t){if(!this.done){if(this.done=!0,this.stopPolling(),this.removeThinking(),t){this.finalize();return}this.showFinalizeButton()}}handleFailure(){this.done||(this.done=!0,this.sending=!1,this.finalSubmissionStarted=!1,this.stopPolling(),this.removeThinking(),this.showClarificationFailureActions())}showClarificationFailureActions(){const t=this.el.querySelector(".mtb-clarify-footer");t.innerHTML=`
|
|
105
105
|
<div class="mtb-clarify-error">${c(this.i18n.clarify.error)}</div>
|
|
106
106
|
<div class="mtb-clarify-actions">
|
|
107
107
|
<button class="mtb-clarify-fallback" type="button">${c(this.i18n.clarify.send_feedback)}</button>
|
|
@@ -115,10 +115,10 @@
|
|
|
115
115
|
</svg>
|
|
116
116
|
<span>${c(this.i18n.clarify.send_feedback)}</span>
|
|
117
117
|
</button>
|
|
118
|
-
`,t.querySelector(".mtb-clarify-send-feedback").addEventListener("click",()=>{this.destroyed||this.finalize()})}async finalize(){if(!(this.finalizing||this.destroyed||this.unrecoverable)){this.finalizing=!0,this.el.querySelectorAll("button").forEach(t=>{t.disabled=!0});try{await this.onFinalize()}catch(t){if(this.destroyed)return;if(this.finalizing=!1,this.clearError(),
|
|
118
|
+
`,t.querySelector(".mtb-clarify-send-feedback").addEventListener("click",()=>{this.destroyed||this.finalize()})}async finalize(){if(!(this.finalizing||this.destroyed||this.unrecoverable)){this.finalizing=!0,this.el.querySelectorAll("button").forEach(t=>{t.disabled=!0});try{await this.onFinalize()}catch(t){if(this.destroyed)return;if(this.finalizing=!1,this.clearError(),Ri(t)){this.showUnrecoverable();return}this.showFinalizeRetry()}}}showUnrecoverable(){this.unrecoverable=!0,this.stopPolling();const t=this.el.querySelector(".mtb-clarify-footer");t.innerHTML=`<div class="mtb-clarify-error">${c(this.i18n.clarify.expired)}</div>`}showFinalizeRetry(){const t=this.el.querySelector(".mtb-clarify-footer");t.innerHTML=`
|
|
119
119
|
<div class="mtb-clarify-error">${c(this.i18n.error.submit)}</div>
|
|
120
120
|
<button class="mtb-clarify-send-feedback mtb-clarify-retry" type="button">${c(this.i18n.clarify.retry)}</button>
|
|
121
|
-
`,t.querySelector(".mtb-clarify-retry").addEventListener("click",()=>{this.destroyed||this.finalize()})}renderConversation(t,e){this.lastMessages=t,this.renderMessages(t);const r=t[t.length-1];!e&&(!r||r.role==="user")&&this.showThinking()}renderMessages(t){this.messagesEl.innerHTML="";for(const e of t)this.appendMessage(e);this.messagesEl.scrollTop=this.messagesEl.scrollHeight}appendMessage(t){const e=document.createElement("div");e.className=t.role==="user"?"mtb-clarify-bubble mtb-clarify-user":"mtb-clarify-bubble mtb-clarify-ai",e.textContent=t.content,this.messagesEl.appendChild(e),this.messagesEl.scrollTop=this.messagesEl.scrollHeight}showThinking(){if(this.messagesEl.querySelector(".mtb-clarify-thinking"))return;const t=document.createElement("div");t.className="mtb-clarify-bubble mtb-clarify-ai mtb-clarify-thinking",t.innerHTML='<span class="mtb-dot"></span><span class="mtb-dot"></span><span class="mtb-dot"></span>',this.messagesEl.appendChild(t),this.messagesEl.scrollTop=this.messagesEl.scrollHeight}removeThinking(){this.messagesEl.querySelector(".mtb-clarify-thinking")?.remove()}destroy(){this.destroyed=!0,window.removeEventListener("keydown",this.handleKeydown),this.streamAbort?.abort(),this.streamAbort=null,this.stopPolling(),this.sheet.release(),this.el.remove()}}const
|
|
121
|
+
`,t.querySelector(".mtb-clarify-retry").addEventListener("click",()=>{this.destroyed||this.finalize()})}renderConversation(t,e){this.lastMessages=t,this.renderMessages(t);const r=t[t.length-1];!e&&(!r||r.role==="user")&&this.showThinking()}renderMessages(t){this.messagesEl.innerHTML="";for(const e of t)this.appendMessage(e);this.messagesEl.scrollTop=this.messagesEl.scrollHeight}appendMessage(t){const e=document.createElement("div");e.className=t.role==="user"?"mtb-clarify-bubble mtb-clarify-user":"mtb-clarify-bubble mtb-clarify-ai",e.textContent=t.content,this.messagesEl.appendChild(e),this.messagesEl.scrollTop=this.messagesEl.scrollHeight}showThinking(){if(this.messagesEl.querySelector(".mtb-clarify-thinking"))return;const t=document.createElement("div");t.className="mtb-clarify-bubble mtb-clarify-ai mtb-clarify-thinking",t.innerHTML='<span class="mtb-dot"></span><span class="mtb-dot"></span><span class="mtb-dot"></span>',this.messagesEl.appendChild(t),this.messagesEl.scrollTop=this.messagesEl.scrollHeight}removeThinking(){this.messagesEl.querySelector(".mtb-clarify-thinking")?.remove()}destroy(){this.destroyed=!0,window.removeEventListener("keydown",this.handleKeydown),this.streamAbort?.abort(),this.streamAbort=null,this.stopPolling(),this.sheet.release(),this.el.remove()}}const ji=5e3,Wi=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;class Vi{constructor(t,e,r,n,s){this.messages=e,this.el=t.el("div","mtb-success"),this.el.style.right="20px",this.el.style.bottom="20px";const o=s?.skipFollowup?e.success.title_no_ai:e.success.title,a=s?.skipFollowup?e.success.message_no_ai:e.success.message,l=n?`<button class="mtb-view-feedback-link">${c(e.success.view_feedback)} <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg></button>`:"",d=s?.emailCapture?`
|
|
122
122
|
<div class="mtb-email-capture">
|
|
123
123
|
<div class="mtb-email-prompt">${c(e.success.email_prompt)}</div>
|
|
124
124
|
<div class="mtb-email-row">
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
<div class="mtb-email-error" hidden>${c(e.success.email_error)}</div>
|
|
129
129
|
</div>`:"";this.el.innerHTML=`
|
|
130
130
|
<div class="mtb-success-icon">
|
|
131
|
-
<svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="${
|
|
131
|
+
<svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="${Z}" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
|
|
132
132
|
<polyline points="20 6 9 17 4 12"/>
|
|
133
133
|
</svg>
|
|
134
134
|
</div>
|
|
@@ -137,10 +137,10 @@
|
|
|
137
137
|
${d}
|
|
138
138
|
${l}
|
|
139
139
|
<button class="mtb-close-link">${c(e.success.close)}</button>
|
|
140
|
-
`,t.append(this.el),this.el.querySelector(".mtb-close-link").addEventListener("click",r),n&&this.el.querySelector(".mtb-view-feedback-link").addEventListener("click",n),s?.emailCapture?this.bindEmailCapture(s.emailCapture.onSubmit):setTimeout(()=>r(),qi)}bindEmailCapture(t){const e=this.el.querySelector(".mtb-email-input"),r=this.el.querySelector(".mtb-email-submit"),n=this.el.querySelector(".mtb-email-error"),s=async()=>{const o=e.value.trim();if(!ji.test(o)){e.classList.add("mtb-email-invalid");return}e.classList.remove("mtb-email-invalid"),n.hidden=!0,r.disabled=!0,await t(o)?this.el.querySelector(".mtb-email-capture").innerHTML=`<div class="mtb-email-saved">${c(this.messages.success.email_saved)}</div>`:(n.hidden=!1,r.disabled=!1)};r.addEventListener("click",s),e.addEventListener("keydown",o=>{o.key==="Enter"&&s()})}destroy(){this.el.remove()}}function Vi(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"),n=e.createElement("a");return e.head.appendChild(r),e.body.appendChild(n),t&&(r.href=t),n.href=i,n.href}const Yi=(()=>{let i=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(i+=1,`u${t()}${i}`)})();function k(i){const t=[];for(let e=0,r=i.length;e<r;e++)t.push(i[e]);return t}let S=null;function le(i={}){return S||(i.includeStyleProperties?(S=i.includeStyleProperties,S):(S=k(window.getComputedStyle(document.documentElement)),S))}function V(i,t){const r=(i.ownerDocument.defaultView||window).getComputedStyle(i).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function Xi(i){const t=V(i,"border-left-width"),e=V(i,"border-right-width");return i.clientWidth+t+e}function Ki(i){const t=V(i,"border-top-width"),e=V(i,"border-bottom-width");return i.clientHeight+t+e}function ce(i,t={}){const e=t.width||Xi(i),r=t.height||Ki(i);return{width:e,height:r}}function Gi(){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 f=16384;function Ji(i){(i.width>f||i.height>f)&&(i.width>f&&i.height>f?i.width>i.height?(i.height*=f/i.width,i.width=f):(i.width*=f/i.height,i.height=f):i.width>f?(i.height*=f/i.width,i.width=f):(i.width*=f/i.height,i.height=f))}function Y(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 Zi(i){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Qi(i,t,e){const r="http://www.w3.org/2000/svg",n=document.createElementNS(r,"svg"),s=document.createElementNS(r,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${e}`),n.setAttribute("viewBox",`0 0 ${t} ${e}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),n.appendChild(s),s.appendChild(i),Zi(n)}const p=(i,t)=>{if(i instanceof t)return!0;const e=Object.getPrototypeOf(i);return e===null?!1:e.constructor.name===t.name||p(e,t)};function tr(i){const t=i.getPropertyValue("content");return`${i.cssText} content: '${t.replace(/'|"/g,"")}';`}function er(i,t){return le(t).map(e=>{const r=i.getPropertyValue(e),n=i.getPropertyPriority(e);return`${e}: ${r}${n?" !important":""};`}).join(" ")}function ir(i,t,e,r){const n=`.${i}:${t}`,s=e.cssText?tr(e):er(e,r);return document.createTextNode(`${n}{${s}}`)}function Lt(i,t,e,r){const n=window.getComputedStyle(i,e),s=n.getPropertyValue("content");if(s===""||s==="none")return;const o=Yi();try{t.className=`${t.className} ${o}`}catch{return}const a=document.createElement("style");a.appendChild(ir(o,e,n,r)),t.appendChild(a)}function rr(i,t,e){Lt(i,t,":before",e),Lt(i,t,":after",e)}const Pt="application/font-woff",Mt="image/jpeg",nr={woff:Pt,woff2:Pt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Mt,jpeg:Mt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function sr(i){const t=/\.([^./]*?)$/g.exec(i);return t?t[1]:""}function gt(i){const t=sr(i).toLowerCase();return nr[t]||""}function or(i){return i.split(/,/)[1]}function ct(i){return i.search(/^(data:)/)!==-1}function ar(i,t){return`data:${t};base64,${i}`}async function de(i,t,e){const r=await fetch(i,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const n=await r.blob();return new Promise((s,o)=>{const a=new FileReader;a.onerror=o,a.onloadend=()=>{try{s(e({res:r,result:a.result}))}catch(l){o(l)}},a.readAsDataURL(n)})}const it={};function lr(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 yt(i,t,e){const r=lr(i,t,e.includeQueryParams);if(it[r]!=null)return it[r];e.cacheBust&&(i+=(/\?/.test(i)?"&":"?")+new Date().getTime());let n;try{const s=await de(i,e.fetchRequestInit,({res:o,result:a})=>(t||(t=o.headers.get("Content-Type")||""),or(a)));n=ar(s,t)}catch(s){n=e.imagePlaceholder||"";let o=`Failed to fetch resource: ${i}`;s&&(o=typeof s=="string"?s:s.message),o&&console.warn(o)}return it[r]=n,n}async function cr(i){const t=i.toDataURL();return t==="data:,"?i.cloneNode(!1):Y(t)}async function dr(i,t){if(i.currentSrc){const s=document.createElement("canvas"),o=s.getContext("2d");s.width=i.clientWidth,s.height=i.clientHeight,o?.drawImage(i,0,0,s.width,s.height);const a=s.toDataURL();return Y(a)}const e=i.poster,r=gt(e),n=await yt(e,r,t);return Y(n)}async function hr(i,t){var e;try{if(!((e=i?.contentDocument)===null||e===void 0)&&e.body)return await tt(i.contentDocument.body,t,!0)}catch{}return i.cloneNode(!1)}async function ur(i,t){return p(i,HTMLCanvasElement)?cr(i):p(i,HTMLVideoElement)?dr(i,t):p(i,HTMLIFrameElement)?hr(i,t):i.cloneNode(he(i))}const mr=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SLOT",he=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SVG";async function br(i,t,e){var r,n;if(he(t))return t;let s=[];return mr(i)&&i.assignedNodes?s=k(i.assignedNodes()):p(i,HTMLIFrameElement)&&(!((r=i.contentDocument)===null||r===void 0)&&r.body)?s=k(i.contentDocument.body.childNodes):s=k(((n=i.shadowRoot)!==null&&n!==void 0?n:i).childNodes),s.length===0||p(i,HTMLVideoElement)||await s.reduce((o,a)=>o.then(()=>tt(a,e)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function pr(i,t,e){const r=t.style;if(!r)return;const n=window.getComputedStyle(i);n.cssText?(r.cssText=n.cssText,r.transformOrigin=n.transformOrigin):le(e).forEach(s=>{let o=n.getPropertyValue(s);s==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),p(i,HTMLIFrameElement)&&s==="display"&&o==="inline"&&(o="block"),s==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(s,o,n.getPropertyPriority(s))})}function fr(i,t){p(i,HTMLTextAreaElement)&&(t.innerHTML=i.value),p(i,HTMLInputElement)&&t.setAttribute("value",i.value)}function gr(i,t){if(p(i,HTMLSelectElement)){const e=t,r=Array.from(e.children).find(n=>i.value===n.getAttribute("value"));r&&r.setAttribute("selected","")}}function yr(i,t,e){return p(t,Element)&&(pr(i,t,e),rr(i,t,e),fr(i,t),gr(i,t)),t}async function wr(i,t){const e=i.querySelectorAll?i.querySelectorAll("use"):[];if(e.length===0)return i;const r={};for(let s=0;s<e.length;s++){const a=e[s].getAttribute("xlink:href");if(a){const l=i.querySelector(a),d=document.querySelector(a);!l&&d&&!r[a]&&(r[a]=await tt(d,t,!0))}}const n=Object.values(r);if(n.length){const s="http://www.w3.org/1999/xhtml",o=document.createElementNS(s,"svg");o.setAttribute("xmlns",s),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const a=document.createElementNS(s,"defs");o.appendChild(a);for(let l=0;l<n.length;l++)a.appendChild(n[l]);i.appendChild(o)}return i}async function tt(i,t,e){return!e&&t.filter&&!t.filter(i)?null:Promise.resolve(i).then(r=>ur(r,t)).then(r=>br(i,r,t)).then(r=>yr(i,r,t)).then(r=>wr(r,t))}const ue=/url\((['"]?)([^'"]+?)\1\)/g,vr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,xr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function kr(i){const t=i.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Sr(i){const t=[];return i.replace(ue,(e,r,n)=>(t.push(n),e)),t.filter(e=>!ct(e))}async function Er(i,t,e,r,n){try{const s=e?Vi(t,e):t,o=gt(t);let a;return n||(a=await yt(s,o,r)),i.replace(kr(t),`$1${a}$3`)}catch{}return i}function Tr(i,{preferredFontFormat:t}){return t?i.replace(xr,e=>{for(;;){const[r,,n]=vr.exec(e)||[];if(!n)return"";if(n===t)return`src: ${r};`}}):i}function me(i){return i.search(ue)!==-1}async function be(i,t,e){if(!me(i))return i;const r=Tr(i,e);return Sr(r).reduce((s,o)=>s.then(a=>Er(a,o,t,e)),Promise.resolve(r))}async function E(i,t,e){var r;const n=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(i);if(n){const s=await be(n,null,e);return t.style.setProperty(i,s,t.style.getPropertyPriority(i)),!0}return!1}async function _r(i,t){await E("background",i,t)||await E("background-image",i,t),await E("mask",i,t)||await E("-webkit-mask",i,t)||await E("mask-image",i,t)||await E("-webkit-mask-image",i,t)}async function Cr(i,t){const e=p(i,HTMLImageElement);if(!(e&&!ct(i.src))&&!(p(i,SVGImageElement)&&!ct(i.href.baseVal)))return;const r=e?i.src:i.href.baseVal,n=await yt(r,gt(r),t);await new Promise((s,o)=>{i.onload=s,i.onerror=t.onImageErrorHandler?(...l)=>{try{s(t.onImageErrorHandler(...l))}catch(d){o(d)}}:o;const a=i;a.decode&&(a.decode=s),a.loading==="lazy"&&(a.loading="eager"),e?(i.srcset="",i.src=n):i.href.baseVal=n})}async function Ar(i,t){const r=k(i.childNodes).map(n=>pe(n,t));await Promise.all(r).then(()=>i)}async function pe(i,t){p(i,Element)&&(await _r(i,t),await Cr(i,t),await Ar(i,t))}function Lr(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(n=>{e[n]=r[n]}),i}const Rt={};async function It(i){let t=Rt[i];if(t!=null)return t;const r=await(await fetch(i)).text();return t={url:i,cssText:r},Rt[i]=t,t}async function Dt(i,t){let e=i.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,s=(e.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,i.url).href),de(a,t.fetchRequestInit,({result:l})=>(e=e.replace(o,`url(${l})`),[o,l]))});return Promise.all(s).then(()=>e)}function Ht(i){if(i==null)return[];const t=[],e=/(\/\*[\s\S]*?\*\/)/gi;let r=i.replace(e,"");const n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=n.exec(r);if(l===null)break;t.push(l[0])}r=r.replace(n,"");const s=/@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=s.exec(r);if(l===null){if(l=a.exec(r),l===null)break;s.lastIndex=a.lastIndex}else a.lastIndex=s.lastIndex;t.push(l[0])}return t}async function Pr(i,t){const e=[],r=[];return i.forEach(n=>{if("cssRules"in n)try{k(n.cssRules||[]).forEach((s,o)=>{if(s.type===CSSRule.IMPORT_RULE){let a=o+1;const l=s.href,d=It(l).then(u=>Dt(u,t)).then(u=>Ht(u).forEach(h=>{try{n.insertRule(h,h.startsWith("@import")?a+=1:n.cssRules.length)}catch(m){console.error("Error inserting rule from remote css",{rule:h,error:m})}})).catch(u=>{console.error("Error loading remote css",u.toString())});r.push(d)}})}catch(s){const o=i.find(a=>a.href==null)||document.styleSheets[0];n.href!=null&&r.push(It(n.href).then(a=>Dt(a,t)).then(a=>Ht(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",s)}}),Promise.all(r).then(()=>(i.forEach(n=>{if("cssRules"in n)try{k(n.cssRules||[]).forEach(s=>{e.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${n.href}`,s)}}),e))}function Mr(i){return i.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>me(t.style.getPropertyValue("src")))}async function Rr(i,t){if(i.ownerDocument==null)throw new Error("Provided element is not within a Document");const e=k(i.ownerDocument.styleSheets),r=await Pr(e,t);return Mr(r)}function fe(i){return i.trim().replace(/["']/g,"")}function Ir(i){const t=new Set;function e(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(s=>{t.add(fe(s))}),Array.from(r.children).forEach(s=>{s instanceof HTMLElement&&e(s)})}return e(i),t}async function Dr(i,t){const e=await Rr(i,t),r=Ir(i);return(await Promise.all(e.filter(s=>r.has(fe(s.style.fontFamily))).map(s=>{const o=s.parentStyleSheet?s.parentStyleSheet.href:null;return be(s.cssText,o,t)}))).join(`
|
|
141
|
-
`)}async function Hr(i,t){const e=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Dr(i,t);if(e){const r=document.createElement("style"),n=document.createTextNode(e);r.appendChild(n),i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r)}}async function Fr(i,t={}){const{width:e,height:r}=ce(i,t),n=await tt(i,t,!0);return await Hr(n,t),await pe(n,t),Lr(n,t),await Qi(n,e,r)}async function $r(i,t={}){const{width:e,height:r}=ce(i,t),n=await Fr(i,t),s=await Y(n),o=document.createElement("canvas"),a=o.getContext("2d"),l=t.pixelRatio||Gi(),d=t.canvasWidth||e,u=t.canvasHeight||r;return o.width=d*l,o.height=u*l,t.skipAutoScale||Ji(o),o.style.width=`${d}`,o.style.height=`${u}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,o.width,o.height)),a.drawImage(s,0,0,o.width,o.height),o}async function Ur(i,t={}){return(await $r(i,t)).toDataURL("image/jpeg",t.quality||1)}const rt=400,nt=300,Ft=150,$t=.3,Ut=.85;function ge(i){let t=1/0,e=1/0,r=-1/0,n=-1/0;for(const s of i)if(s.type==="pin"){if(t=Math.min(t,s.x),e=Math.min(e,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y),s.targetRect){const o=s.targetRect;t=Math.min(t,o.left),e=Math.min(e,o.top),r=Math.max(r,o.left+o.width),n=Math.max(n,o.bottom)}}else if(s.type==="draw"&&s.drawPath)for(const o of ye(s.drawPath))for(const[a,l]of o)t=Math.min(t,a),e=Math.min(e,l),r=Math.max(r,a),n=Math.max(n,l);return!isFinite(t)||!isFinite(e)?null:{minX:t,minY:e,maxX:r,maxY:n}}function Br(i,t,e){const r=ge(i);if(!r)return null;const n=Math.max(Ft,t*$t),s=Math.max(Ft,e*$t);let o=r.minX-n,a=r.minY-s,l=r.maxX-r.minX+n*2,d=r.maxY-r.minY+s*2;return l<rt&&(o-=(rt-l)/2,l=rt),d<nt&&(a-=(nt-d)/2,d=nt),l=Math.min(l,t),d=Math.min(d,e),o=Math.min(Math.max(0,o),t-l),a=Math.min(Math.max(0,a),e-d),l>=t*Ut&&d>=e*Ut?null:{x:Math.round(o),y:Math.round(a),width:Math.round(l),height:Math.round(d)}}function Nr(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 Or(i=[]){try{const t=tn(document.body),e=i.map(zr),r=Gr(document.body),n=await Ur(document.body,{quality:.85,width:t.width,height:t.height,pixelRatio:Qr(t),backgroundColor:"#ffffff",skipFonts:!1,skipAutoScale:!1,filter:s=>!(s instanceof HTMLElement&&s.id==="mtb-widget-host")});return await Yr(n,e,t,r)}catch{return null}}function zr(i){const t=jr(qr(i));return t.x===0&&t.y===0?i:{...i,x:i.x+t.x,y:i.y+t.y,targetRect:i.targetRect&&{...i.targetRect,top:i.targetRect.top+t.y,left:i.targetRect.left+t.x,bottom:i.targetRect.bottom+t.y},drawPath:i.drawPath&&Vr(i.drawPath,t)}}function qr(i){if(i.targetSelector)try{const t=document.querySelector(i.targetSelector);if(t)return t}catch{}return document.elementsFromPoint?.(i.x,i.y)[0]??null}function jr(i){let t=0,e=0,r=i;for(;r&&r!==document.body;)r instanceof HTMLElement&&(t+=r.scrollLeft,e+=r.scrollTop),r=Wr(r);return{x:t,y:e}}function Wr(i){if(i.parentElement)return i.parentElement;const t=i.getRootNode();return t instanceof ShadowRoot?t.host:null}function Vr(i,t){return i.replace(/([ML])\s*(-?(?:\d+\.?\d*|\.\d+))\s+(-?(?:\d+\.?\d*|\.\d+))/g,(e,r,n,s)=>`${r} ${Number(n)+t.x} ${Number(s)+t.y}`)}async function Yr(i,t,e,r){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return null;const o=await rn(i);if(!o)return null;n.width=o.naturalWidth||window.innerWidth,n.height=o.naturalHeight||window.innerHeight,s.drawImage(o,0,0);const a=n.width/e.width,l=n.height/e.height;s.fillStyle="#e5e7eb";for(const h of r)s.fillRect((h.left-e.left)*a,(h.top-e.top)*l,h.width*a,h.height*l);let d=0;for(const h of t)h.type==="draw"&&h.drawPath?Zr(s,h.drawPath,e,a,l):h.type==="pin"&&en(s,(h.x-e.left)*a,(h.y-e.top)*l,++d);if(!Xr(t,e,a,l,n))return N(n);const u=Br(t,window.innerWidth,window.innerHeight);if(u){const h=Kr(u,e,a,l,n);return N(h?Nr(n,h):n)}return N(n)}function Xr(i,t,e,r,n){const s=ge(i);if(!s)return!0;const o=(s.minX-t.left)*e,a=(s.minY-t.top)*r,l=(s.maxX-t.left)*e,d=(s.maxY-t.top)*r;return o>=0&&a>=0&&l<=n.width&&d<=n.height}function Kr(i,t,e,r,n){const s=Math.min(n.width,Math.round(i.width*e)),o=Math.min(n.height,Math.round(i.height*r));if(s<=0||o<=0)return null;const a=Math.round((i.x-t.left)*e),l=Math.round((i.y-t.top)*r);return{x:Math.min(Math.max(0,a),n.width-s),y:Math.min(Math.max(0,l),n.height-o),width:s,height:o}}function Gr(i){const t=[];for(const s of Jr(i,`.${Z}`))st(t,s.getBoundingClientRect());for(const s of i.querySelectorAll("input, textarea, select")){if(Bt(s))continue;const o=s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement?s.value:"",a=s.closest(`.${U}`)!==null,l=ie(s)||W(o,s)!==o;!a&&!l||st(t,s.getBoundingClientRect(),Ot)}const e=document.createTreeWalker(i,NodeFilter.SHOW_TEXT),r=re();let n=e.nextNode();for(;n;){const s=n.parentElement,o=n.textContent??"",a=s?.closest(`.${U}`)!==null,l=A(o)!==o||ne(n,r);if(s&&!Bt(s)&&(a||l)){const d=document.createRange();d.selectNodeContents(n);for(const u of Array.from(d.getClientRects()))st(t,u,Ot)}n=e.nextNode()}return t}function Jr(i,t){const e=Array.from(i.querySelectorAll(t));return i.matches(t)?[i,...e]:e}function Bt(i){return i.closest("#mtb-widget-host")!==null||i.closest(`.${Z}`)!==null}function st(i,t,e=0){if(![t.left,t.top,t.width,t.height].every(Number.isFinite))throw new Error("Invalid privacy redaction geometry");t.width<=0||t.height<=0||i.push({left:t.left-e,top:t.top-e,width:t.width+e*2,height:t.height+e*2})}function Zr(i,t,e,r,n){i.save(),i.strokeStyle=J,i.lineWidth=3.5,i.lineCap="round",i.lineJoin="round",i.shadowColor=bt(.35),i.shadowOffsetY=1,i.shadowBlur=2;for(const s of ye(t))if(s.length!==0){i.beginPath(),i.moveTo((s[0][0]-e.left)*r,(s[0][1]-e.top)*n);for(let o=1;o<s.length;o++)i.lineTo((s[o][0]-e.left)*r,(s[o][1]-e.top)*n);i.stroke()}i.restore()}const Nt=16e6,Ot=2;function Qr(i){const t=i.width*i.height;return!Number.isFinite(t)||t<=Nt?1:Math.sqrt(Nt/t)}function tn(i){const t=i.getBoundingClientRect(),e=window.getComputedStyle(i),r=parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),n=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),s=document.documentElement,o=Math.max(i.clientWidth,i.scrollWidth,s.clientWidth,s.scrollWidth),a=Math.max(i.clientHeight,i.scrollHeight,s.clientHeight,s.scrollHeight);return{left:t.left,top:t.top,width:o+(Number.isFinite(r)?r:0)||window.innerWidth,height:a+(Number.isFinite(n)?n:0)||window.innerHeight}}function en(i,t,e,r){i.save(),i.shadowColor=bt(.45),i.shadowOffsetY=2,i.shadowBlur=8,i.fillStyle=J,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 ${Ze}`,i.textAlign="center",i.textBaseline="middle",i.fillText(String(r),t,e),i.restore()}function ye(i){const t=[];let e=null;const r=i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g)??[];for(const n of r){const[s,o]=n.slice(1).trim().split(/\s+/).map(Number);Number.isNaN(s)||Number.isNaN(o)||(n[0]==="M"?(e=[[s,o]],t.push(e)):e&&e.push([s,o]))}return t}function rn(i){return new Promise(t=>{const e=new Image;e.onload=()=>t(e),e.onerror=()=>t(null),e.src=i})}function N(i){return new Promise(t=>{try{i.toBlob(e=>t(e),"image/jpeg",.85)}catch{t(null)}})}class nn{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,n,s)=>(this.emit({name:sn(s),message:String(t),source:e,line:r,col:n,error:s}),this.originalOnError?this.originalOnError.call(window,t,e,r,n,s):!1),window.onerror=this.installedOnError,this.rejectionHandler=t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason),r=t.reason instanceof Error?t.reason.name:"UnhandledRejection";this.emit({name:r,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 wt=new nn;function sn(i){return!i||typeof i!="object"||!("name"in i)?void 0:String(i.name)||void 0}function we(i){const t=on(i.name)||an(i.message),e=ln(i);return e?`${t} (${e})`:t}function on(i){return i&&/^[A-Za-z][A-Za-z0-9]*(?:Error|Exception|Rejection)$/.test(i)?i:""}function an(i){return i.match(/^([A-Za-z][A-Za-z0-9]*(?:Error|Exception))\b/)?.[1]??"Error"}function ln(i){if(!i.source)return"";try{const t=new URL(i.source,window.location.href).pathname;return i.line==null?t:`${t}:${i.line}:${i.col??0}`}catch{return""}}const cn=20;class dn{constructor(){this.errors=[],this.unsubscribe=null}start(){this.unsubscribe||(this.unsubscribe=wt.subscribe(t=>this.record(t)))}record(t){this.addError(we(t))}addError(t){this.errors.length>=cn||this.errors.includes(t)||this.errors.push(t)}getErrors(){return[...this.errors]}stop(){this.unsubscribe?.(),this.unsubscribe=null}}const z=new Set;let R=null,I=null,D=null,X=null,H=null,K=null;function ve(i){z.add(i),hn();let t=!1;return()=>{t||(t=!0,z.delete(i),z.size===0&&un())}}function ot(i,t){const e={type:i,fromUrl:t,toUrl:location.href};K=e.toUrl;for(const r of[...z])try{r(e)}catch{}}function hn(){if(D)return;K=location.href,H=()=>ot("pop",K??location.href),window.addEventListener("popstate",H),R=history.pushState,I=history.replaceState;const i=R,t=I;D=function(e,r,n){const s=location.href;i.call(history,e,r,n),ot("push",s)},X=function(e,r,n){const s=location.href;t.call(history,e,r,n),ot("replace",s)},history.pushState=D,history.replaceState=X}function un(){H&&(window.removeEventListener("popstate",H),H=null),R&&history.pushState===D&&(history.pushState=R),I&&history.replaceState===X&&(history.replaceState=I),R=null,I=null,D=null,X=null,K=null}const mn=20;function bn(i){return Q(i)?pt(i):mt(i)}function pn(i){return Q(i)?oe(i):Qt(i)}class fn{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=wt.subscribe(t=>this.recordError(t)),this.unsubscribeNavigation=ve(()=>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>mn&&this.breadcrumbs.shift()}handleClick(t){const e=t.target;if(e&&!T(e))try{this.add({type:"ui",category:"ui.click",timestamp:Date.now(),message:bn(e),data:{selector:pn(e)}})}catch{}}handleChange(t){const e=t.target;if(e&&!T(e))try{const r=e,n=Q(e)?pt(e):r.name||r.placeholder||e.getAttribute("aria-label")||e.tagName;this.add({type:"ui",category:"ui.input",timestamp:Date.now(),message:n,data:{field:n}})}catch{}}recordError(t){const e=we(t);this.add({type:"console",category:"console.error",timestamp:Date.now(),message:e,data:{message:e}})}handleNavigation(){if(!this.active)return;const t=this.lastUrl,e=location.href;if(t===e)return;this.lastUrl=e;const r=$(t),n=$(e);this.add({type:"navigation",category:"navigation",timestamp:Date.now(),message:`${r} → ${n}`,data:{from:r,to:n}})}}const xe="mtb_frustration_state";let dt=null;function G(){try{const i=window.sessionStorage.getItem(xe);return q(i?JSON.parse(i):dt)}catch{return q(dt)}}function ke(i){const t=q(i);dt=t;try{window.sessionStorage.setItem(xe,JSON.stringify(t))}catch{}}function gn(){return G().dismissedByUser}function yn(){ke({...G(),dismissedByUser:!0})}function q(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 wn=4,vn=1500,xn=3,kn=5e3,at=500,Sn=2,En=3e4,Tn=2e3,_n=5e3,Cn=3e4,An=1e3,Ln=300,Pn=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL","SUMMARY","DETAILS"]),Mn=new Set(["button","link","checkbox","radio","tab","menuitem","option","switch","textbox","combobox","listbox","slider","spinbutton"]),Rn=new Set(["A","BUTTON","SUMMARY"]),In=new Set(["button","link","tab","menuitem"]),zt=[/\bnot found\b/,/\bserver error\b/,/^\s*(?:http\s*)?[45]\d{2}\s*$/,/\b(?:error|http|status)\s*[:-]?\s*[45]\d{2}\b/,/\b[45]\d{2}\s*[:-]?\s*error\b/],F=class F{constructor(t){this.clickHistory=[],this.unsubscribeErrors=null,this.active=!1,this.lastInteraction=null,this.cooldownUntil=0,this.navTimestamps=[],this.unsubscribeNavigation=null,this.boundPageLeaveHandler=null,this.boundTurboNavigationHandler=null,this.lastNavigationAt=-1,this.userNavigationIntentUntil=0,this.boundSubmitHandler=null,this.boundInvalidHandler=null,this.recentSubmitForms=new WeakSet,this.recentFailedForms=new WeakSet,this.formFailureTimestamps=new WeakMap,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=wt.subscribe(()=>{const t=Date.now();if(!this.lastInteraction||t-this.lastInteraction.time>Tn)return;const e=this.lastInteraction;this.lastInteraction=null,this.emitIfReady({signal:"dead_click",target:O(e.target),detail:"Uncaught error after interaction",timestamp:t})}),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.lastInteraction=null,this.stopNavigationTracking(),this.stopFormTracking(),this.errorPageUrls.clear(),this.disconnectDomObserver())}startNavigationTracking(){this.unsubscribeNavigation=ve(t=>this.handleNavigation(t)),this.boundPageLeaveHandler=()=>this.noteNavigationStarted(),window.addEventListener("beforeunload",this.boundPageLeaveHandler),window.addEventListener("pagehide",this.boundPageLeaveHandler),this.boundTurboNavigationHandler=()=>{this.noteNavigationStarted(),this.userNavigationIntentUntil=Date.now()+Cn},document.addEventListener("turbo:before-visit",this.boundTurboNavigationHandler),document.addEventListener("turbo:submit-start",this.boundTurboNavigationHandler),document.addEventListener("turbo:before-fetch-request",this.boundTurboNavigationHandler)}stopNavigationTracking(){this.unsubscribeNavigation?.(),this.unsubscribeNavigation=null,this.navTimestamps=[],this.boundPageLeaveHandler&&(window.removeEventListener("beforeunload",this.boundPageLeaveHandler),window.removeEventListener("pagehide",this.boundPageLeaveHandler),this.boundPageLeaveHandler=null),this.boundTurboNavigationHandler&&(document.removeEventListener("turbo:before-visit",this.boundTurboNavigationHandler),document.removeEventListener("turbo:submit-start",this.boundTurboNavigationHandler),document.removeEventListener("turbo:before-fetch-request",this.boundTurboNavigationHandler),this.boundTurboNavigationHandler=null),this.lastNavigationAt=-1,this.userNavigationIntentUntil=0}noteNavigationStarted(){this.lastNavigationAt=Date.now()}restoreState(){const t=G();this.navTimestamps=t.navTimestamps,this.cooldownUntil=t.cooldownUntil,this.errorPageUrls=new Set(t.errorPageUrls)}persistState(){const t=G();ke({...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||T(e))return;this.trackFormSubmitIntent(e),this.trackNativeNavigationIntent(t,e);const r=this.interactionTarget(e),n=Date.now();this.lastInteraction={target:r,time:n},this.userNavigationIntentUntil=n+_n,this.clickHistory.push({target:r,time:n});const s=n-vn;if(this.clickHistory=this.clickHistory.filter(a=>a.time>s),this.clickHistory.filter(a=>a.target===r).length>=wn){this.clickHistory=[],this.emitHighPriority({signal:"rage_click",target:O(r),timestamp:n});return}this.checkDeadClickDom(r,n)}handleNavigation(t){const e=Date.now();this.noteNavigationStarted();const r=t.type!=="replace"&&t.fromUrl!==t.toUrl,n=t.type==="pop"||e<=this.userNavigationIntentUntil;if(r&&n){this.navTimestamps.push(e);const s=e-kn;this.navTimestamps=this.navTimestamps.filter(o=>o>s),this.navTimestamps.length>=xn&&(this.navTimestamps=[],this.emitIfReady({signal:"rapid_navigation",timestamp:e})),t.type==="push"&&(this.userNavigationIntentUntil=0)}this.persistState(),setTimeout(()=>{this.active&&this.checkErrorPage()},Ln)}handleFormSubmit(t){const e=t.target;e instanceof HTMLFormElement&&(T(e)||(this.rememberSubmitAttempt(e),setTimeout(()=>{this.active&&e.querySelector('[aria-invalid="true"], .is-invalid')&&this.recordFormFailure(e)},at)))}trackFormSubmitIntent(t){const e=t.closest("button, input");(e instanceof HTMLButtonElement||e instanceof HTMLInputElement)&&(e.type!=="submit"&&e.type!=="image"||!e.form||T(e.form)||this.rememberSubmitAttempt(e.form))}trackNativeNavigationIntent(t,e){e.closest("a[href]")&&queueMicrotask(()=>{this.active&&!t.defaultPrevented&&this.noteNavigationStarted()})}rememberSubmitAttempt(t){this.recentSubmitForms.add(t),setTimeout(()=>{this.recentSubmitForms.delete(t)},at)}recordFormFailure(t){if(this.recentFailedForms.has(t))return;this.recentFailedForms.add(t),setTimeout(()=>this.recentFailedForms.delete(t),at);const e=Date.now(),r=e-En,n=(this.formFailureTimestamps.get(t)??[]).filter(s=>s>r);n.push(e),this.formFailureTimestamps.set(t,n),!(n.length<Sn)&&(this.formFailureTimestamps.set(t,[]),this.emitIfReady({signal:"form_failure",target:O(t),timestamp:e}))}handleFormInvalid(t){const e=t.target;if(!e||T(e))return;const r=e.closest("form");!r||!this.recentSubmitForms.has(r)||this.recordFormFailure(r)}checkErrorPage(){const t=location.href;if(this.errorPageUrls.has(t))return;const e=document.title.toLowerCase();if(zt.some(n=>n.test(e))){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 n of r){const s=n.textContent??"";if(s.length<200&&zt.some(o=>o.test(s.toLowerCase()))){this.errorPageUrls.add(t),this.emitHighPriority({signal:"error_page",detail:s.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,n=this.lastNavigationAt>=e;this.pendingDomChecks===0&&this.disconnectDomObserver(),!r&&!n&&this.active&&this.emitIfReady({signal:"dead_click_dom",target:O(t),timestamp:e})},An))}ensureDomObserver(){this.domObserver||(this.domObserver=new MutationObserver(()=>{this.lastMutationAt=Date.now()}),this.domObserver.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}disconnectDomObserver(){this.domObserver?.disconnect(),this.domObserver=null}looksInteractive(t){if(Rn.has(t.tagName)||t.hasAttribute("onclick"))return!0;const e=t.getAttribute("role");if(e&&In.has(e)||window.getComputedStyle(t).cursor==="pointer")return!0;if(t.classList)for(const n of t.classList){const s=n.toLowerCase();if(s.includes("btn")||s.includes("button"))return!0}return!1}interactionTarget(t){let e=t;for(;e&&e!==document.body;){if(this.isIntrinsicInteractive(e))return e;e=e.parentElement}let r=t;for(e=t.parentElement;e&&e!==document.body&&this.looksInteractive(e);)r=e,e=e.parentElement;return r}isIntrinsicInteractive(t){if(Pn.has(t.tagName))return!0;const e=t.getAttribute("role");return e&&Mn.has(e)||t.hasAttribute("onclick")||t.hasAttribute("tabindex")?!0:t.contentEditable==="true"}emitIfReady(t){const e=Date.now();e<this.cooldownUntil||(this.cooldownUntil=e+F.COOLDOWN_MS,this.persistState(),this.onFrustration(t))}emitHighPriority(t){this.cooldownUntil=Date.now()+F.COOLDOWN_MS,this.persistState(),this.onFrustration(t)}};F.COOLDOWN_MS=6e4;let ht=F;function O(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("."):"",n=i.textContent?.trim().slice(0,30)??"";return`<${t}${e}${r}>${n?` "${n}"`:""}`}function Dn(){return{page_url:$(window.location.href),user_agent:navigator.userAgent,browser:Hn(),os:Fn(),screen_width:window.screen.width,screen_height:window.screen.height}}function Hn(){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 Fn(){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 $n(i,t,e,r,n,s,o,a,l){return{...j({description:i,...t,page_url:$(t.page_url),console_errors:e,annotations:r?[r]:[],target_element:r?.targetSelector?{selector:r.targetSelector,text:r.targetText??"",name:r.targetName??""}:void 0,recording_events:s?.events,recording_duration:s?.duration,breadcrumbs:l}),user_id:n?.id,user_email:n?.email,user_name:n?.name,reporter_external_id:n?void 0:o,reporter_email:n?void 0:a}}const qt="mtb_anon_id",Se="mtb_reporter_email",Ee="mtb_board_url";let jt=null,Te=null,_e=null;function Wt(){try{const i=window.localStorage.getItem(qt);if(i?.startsWith("anon_"))return i;const t=Xt();return window.localStorage.setItem(qt,t),t}catch{return jt??(jt=Xt()),jt}}function Vt(){try{return window.localStorage.getItem(Se)??void 0}catch{return Te??void 0}}function Un(i){Te=i;try{window.localStorage.setItem(Se,i)}catch{}}function Bn(){try{return window.localStorage.getItem(Ee)??void 0}catch{return _e??void 0}}function Yt(i){_e=i;try{window.localStorage.setItem(Ee,i)}catch{}}function Xt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`anon_${crypto.randomUUID()}`:`anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}`}const Nn={tab:"Feedback",toolbar:{markup:"Mark up",record:"Record",hint:"Click to comment, drag to draw",hintTouch:"Drag to mark what's wrong",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."}},On={tab:"反馈",toolbar:{markup:"标注",record:"录屏",hint:"点击标注,拖动绘制",hintTouch:"用手指圈出问题",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:"这条反馈在发送前已过期。请关闭组件后重新提交。"}},zn={tab:"フィードバック",toolbar:{markup:"マークアップ",record:"録画",hint:"クリックでコメント、ドラッグで描画",hintTouch:"ドラッグして問題箇所を囲んでください",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:"このフィードバックは送信される前に有効期限が切れました。ウィジェットを閉じて、もう一度送信してください。"}},qn={tab:"피드백",toolbar:{markup:"마크업",record:"녹화",hint:"클릭하여 댓글, 드래그하여 그리기",hintTouch:"드래그해서 문제가 있는 곳을 표시하세요",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:"이 피드백 세션은 전송되기 전에 만료되었습니다. 위젯을 닫고 다시 보내 주세요."}},jn={tab:"Comentarios",toolbar:{markup:"Anotar",record:"Grabar",hint:"Clic para comentar, arrastrar para dibujar",hintTouch:"Arrastra para marcar el problema",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."}},Wn={tab:"Avis",toolbar:{markup:"Annoter",record:"Enregistrer",hint:"Cliquer pour commenter, glisser pour dessiner",hintTouch:"Faites glisser pour marquer le problème",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."}},Vn={tab:"Feedback",toolbar:{markup:"Markieren",record:"Aufnehmen",hint:"Klicken zum Kommentieren, ziehen zum Zeichnen",hintTouch:"Ziehen, um das Problem zu markieren",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."}},P={en:Nn,"zh-CN":On,ja:zn,ko:qn,es:jn,fr:Wn,de:Vn};function Kt(i){if(P[i])return P[i];const t=i.split("-")[0];return P[t]?P[t]:P.en}class Yn{constructor(t,e,r,n){this.intervalId=null,this.getDuration=r,this.el=t.el("div","mtb-record-bar"),this.el.innerHTML=`
|
|
140
|
+
`,t.append(this.el),this.el.querySelector(".mtb-close-link").addEventListener("click",r),n&&this.el.querySelector(".mtb-view-feedback-link").addEventListener("click",n),s?.emailCapture?this.bindEmailCapture(s.emailCapture.onSubmit):setTimeout(()=>r(),ji)}bindEmailCapture(t){const e=this.el.querySelector(".mtb-email-input"),r=this.el.querySelector(".mtb-email-submit"),n=this.el.querySelector(".mtb-email-error"),s=async()=>{const o=e.value.trim();if(!Wi.test(o)){e.classList.add("mtb-email-invalid");return}e.classList.remove("mtb-email-invalid"),n.hidden=!0,r.disabled=!0,await t(o)?this.el.querySelector(".mtb-email-capture").innerHTML=`<div class="mtb-email-saved">${c(this.messages.success.email_saved)}</div>`:(n.hidden=!1,r.disabled=!1)};r.addEventListener("click",s),e.addEventListener("keydown",o=>{o.key==="Enter"&&s()})}destroy(){this.el.remove()}}function Yi(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"),n=e.createElement("a");return e.head.appendChild(r),e.body.appendChild(n),t&&(r.href=t),n.href=i,n.href}const Xi=(()=>{let i=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(i+=1,`u${t()}${i}`)})();function k(i){const t=[];for(let e=0,r=i.length;e<r;e++)t.push(i[e]);return t}let S=null;function de(i={}){return S||(i.includeStyleProperties?(S=i.includeStyleProperties,S):(S=k(window.getComputedStyle(document.documentElement)),S))}function Y(i,t){const r=(i.ownerDocument.defaultView||window).getComputedStyle(i).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function Ki(i){const t=Y(i,"border-left-width"),e=Y(i,"border-right-width");return i.clientWidth+t+e}function Gi(i){const t=Y(i,"border-top-width"),e=Y(i,"border-bottom-width");return i.clientHeight+t+e}function he(i,t={}){const e=t.width||Ki(i),r=t.height||Gi(i);return{width:e,height:r}}function Ji(){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 f=16384;function Zi(i){(i.width>f||i.height>f)&&(i.width>f&&i.height>f?i.width>i.height?(i.height*=f/i.width,i.width=f):(i.width*=f/i.height,i.height=f):i.width>f?(i.height*=f/i.width,i.width=f):(i.width*=f/i.height,i.height=f))}function X(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 Qi(i){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function tr(i,t,e){const r="http://www.w3.org/2000/svg",n=document.createElementNS(r,"svg"),s=document.createElementNS(r,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${e}`),n.setAttribute("viewBox",`0 0 ${t} ${e}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),n.appendChild(s),s.appendChild(i),Qi(n)}const p=(i,t)=>{if(i instanceof t)return!0;const e=Object.getPrototypeOf(i);return e===null?!1:e.constructor.name===t.name||p(e,t)};function er(i){const t=i.getPropertyValue("content");return`${i.cssText} content: '${t.replace(/'|"/g,"")}';`}function ir(i,t){return de(t).map(e=>{const r=i.getPropertyValue(e),n=i.getPropertyPriority(e);return`${e}: ${r}${n?" !important":""};`}).join(" ")}function rr(i,t,e,r){const n=`.${i}:${t}`,s=e.cssText?er(e):ir(e,r);return document.createTextNode(`${n}{${s}}`)}function Mt(i,t,e,r){const n=window.getComputedStyle(i,e),s=n.getPropertyValue("content");if(s===""||s==="none")return;const o=Xi();try{t.className=`${t.className} ${o}`}catch{return}const a=document.createElement("style");a.appendChild(rr(o,e,n,r)),t.appendChild(a)}function nr(i,t,e){Mt(i,t,":before",e),Mt(i,t,":after",e)}const Rt="application/font-woff",It="image/jpeg",sr={woff:Rt,woff2:Rt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:It,jpeg:It,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function or(i){const t=/\.([^./]*?)$/g.exec(i);return t?t[1]:""}function wt(i){const t=or(i).toLowerCase();return sr[t]||""}function ar(i){return i.split(/,/)[1]}function ht(i){return i.search(/^(data:)/)!==-1}function lr(i,t){return`data:${t};base64,${i}`}async function ue(i,t,e){const r=await fetch(i,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const n=await r.blob();return new Promise((s,o)=>{const a=new FileReader;a.onerror=o,a.onloadend=()=>{try{s(e({res:r,result:a.result}))}catch(l){o(l)}},a.readAsDataURL(n)})}const rt={};function cr(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 vt(i,t,e){const r=cr(i,t,e.includeQueryParams);if(rt[r]!=null)return rt[r];e.cacheBust&&(i+=(/\?/.test(i)?"&":"?")+new Date().getTime());let n;try{const s=await ue(i,e.fetchRequestInit,({res:o,result:a})=>(t||(t=o.headers.get("Content-Type")||""),ar(a)));n=lr(s,t)}catch(s){n=e.imagePlaceholder||"";let o=`Failed to fetch resource: ${i}`;s&&(o=typeof s=="string"?s:s.message),o&&console.warn(o)}return rt[r]=n,n}async function dr(i){const t=i.toDataURL();return t==="data:,"?i.cloneNode(!1):X(t)}async function hr(i,t){if(i.currentSrc){const s=document.createElement("canvas"),o=s.getContext("2d");s.width=i.clientWidth,s.height=i.clientHeight,o?.drawImage(i,0,0,s.width,s.height);const a=s.toDataURL();return X(a)}const e=i.poster,r=wt(e),n=await vt(e,r,t);return X(n)}async function ur(i,t){var e;try{if(!((e=i?.contentDocument)===null||e===void 0)&&e.body)return await et(i.contentDocument.body,t,!0)}catch{}return i.cloneNode(!1)}async function mr(i,t){return p(i,HTMLCanvasElement)?dr(i):p(i,HTMLVideoElement)?hr(i,t):p(i,HTMLIFrameElement)?ur(i,t):i.cloneNode(me(i))}const br=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SLOT",me=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SVG";async function pr(i,t,e){var r,n;if(me(t))return t;let s=[];return br(i)&&i.assignedNodes?s=k(i.assignedNodes()):p(i,HTMLIFrameElement)&&(!((r=i.contentDocument)===null||r===void 0)&&r.body)?s=k(i.contentDocument.body.childNodes):s=k(((n=i.shadowRoot)!==null&&n!==void 0?n:i).childNodes),s.length===0||p(i,HTMLVideoElement)||await s.reduce((o,a)=>o.then(()=>et(a,e)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function fr(i,t,e){const r=t.style;if(!r)return;const n=window.getComputedStyle(i);n.cssText?(r.cssText=n.cssText,r.transformOrigin=n.transformOrigin):de(e).forEach(s=>{let o=n.getPropertyValue(s);s==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),p(i,HTMLIFrameElement)&&s==="display"&&o==="inline"&&(o="block"),s==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(s,o,n.getPropertyPriority(s))})}function gr(i,t){p(i,HTMLTextAreaElement)&&(t.innerHTML=i.value),p(i,HTMLInputElement)&&t.setAttribute("value",i.value)}function yr(i,t){if(p(i,HTMLSelectElement)){const e=t,r=Array.from(e.children).find(n=>i.value===n.getAttribute("value"));r&&r.setAttribute("selected","")}}function wr(i,t,e){return p(t,Element)&&(fr(i,t,e),nr(i,t,e),gr(i,t),yr(i,t)),t}async function vr(i,t){const e=i.querySelectorAll?i.querySelectorAll("use"):[];if(e.length===0)return i;const r={};for(let s=0;s<e.length;s++){const a=e[s].getAttribute("xlink:href");if(a){const l=i.querySelector(a),d=document.querySelector(a);!l&&d&&!r[a]&&(r[a]=await et(d,t,!0))}}const n=Object.values(r);if(n.length){const s="http://www.w3.org/1999/xhtml",o=document.createElementNS(s,"svg");o.setAttribute("xmlns",s),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const a=document.createElementNS(s,"defs");o.appendChild(a);for(let l=0;l<n.length;l++)a.appendChild(n[l]);i.appendChild(o)}return i}async function et(i,t,e){return!e&&t.filter&&!t.filter(i)?null:Promise.resolve(i).then(r=>mr(r,t)).then(r=>pr(i,r,t)).then(r=>wr(i,r,t)).then(r=>vr(r,t))}const be=/url\((['"]?)([^'"]+?)\1\)/g,xr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,kr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Sr(i){const t=i.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Er(i){const t=[];return i.replace(be,(e,r,n)=>(t.push(n),e)),t.filter(e=>!ht(e))}async function Tr(i,t,e,r,n){try{const s=e?Yi(t,e):t,o=wt(t);let a;return n||(a=await vt(s,o,r)),i.replace(Sr(t),`$1${a}$3`)}catch{}return i}function _r(i,{preferredFontFormat:t}){return t?i.replace(kr,e=>{for(;;){const[r,,n]=xr.exec(e)||[];if(!n)return"";if(n===t)return`src: ${r};`}}):i}function pe(i){return i.search(be)!==-1}async function fe(i,t,e){if(!pe(i))return i;const r=_r(i,e);return Er(r).reduce((s,o)=>s.then(a=>Tr(a,o,t,e)),Promise.resolve(r))}async function E(i,t,e){var r;const n=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(i);if(n){const s=await fe(n,null,e);return t.style.setProperty(i,s,t.style.getPropertyPriority(i)),!0}return!1}async function Cr(i,t){await E("background",i,t)||await E("background-image",i,t),await E("mask",i,t)||await E("-webkit-mask",i,t)||await E("mask-image",i,t)||await E("-webkit-mask-image",i,t)}async function Ar(i,t){const e=p(i,HTMLImageElement);if(!(e&&!ht(i.src))&&!(p(i,SVGImageElement)&&!ht(i.href.baseVal)))return;const r=e?i.src:i.href.baseVal,n=await vt(r,wt(r),t);await new Promise((s,o)=>{i.onload=s,i.onerror=t.onImageErrorHandler?(...l)=>{try{s(t.onImageErrorHandler(...l))}catch(d){o(d)}}:o;const a=i;a.decode&&(a.decode=s),a.loading==="lazy"&&(a.loading="eager"),e?(i.srcset="",i.src=n):i.href.baseVal=n})}async function Lr(i,t){const r=k(i.childNodes).map(n=>ge(n,t));await Promise.all(r).then(()=>i)}async function ge(i,t){p(i,Element)&&(await Cr(i,t),await Ar(i,t),await Lr(i,t))}function Pr(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(n=>{e[n]=r[n]}),i}const Dt={};async function Ht(i){let t=Dt[i];if(t!=null)return t;const r=await(await fetch(i)).text();return t={url:i,cssText:r},Dt[i]=t,t}async function Ft(i,t){let e=i.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,s=(e.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,i.url).href),ue(a,t.fetchRequestInit,({result:l})=>(e=e.replace(o,`url(${l})`),[o,l]))});return Promise.all(s).then(()=>e)}function $t(i){if(i==null)return[];const t=[],e=/(\/\*[\s\S]*?\*\/)/gi;let r=i.replace(e,"");const n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=n.exec(r);if(l===null)break;t.push(l[0])}r=r.replace(n,"");const s=/@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=s.exec(r);if(l===null){if(l=a.exec(r),l===null)break;s.lastIndex=a.lastIndex}else a.lastIndex=s.lastIndex;t.push(l[0])}return t}async function Mr(i,t){const e=[],r=[];return i.forEach(n=>{if("cssRules"in n)try{k(n.cssRules||[]).forEach((s,o)=>{if(s.type===CSSRule.IMPORT_RULE){let a=o+1;const l=s.href,d=Ht(l).then(u=>Ft(u,t)).then(u=>$t(u).forEach(h=>{try{n.insertRule(h,h.startsWith("@import")?a+=1:n.cssRules.length)}catch(m){console.error("Error inserting rule from remote css",{rule:h,error:m})}})).catch(u=>{console.error("Error loading remote css",u.toString())});r.push(d)}})}catch(s){const o=i.find(a=>a.href==null)||document.styleSheets[0];n.href!=null&&r.push(Ht(n.href).then(a=>Ft(a,t)).then(a=>$t(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",s)}}),Promise.all(r).then(()=>(i.forEach(n=>{if("cssRules"in n)try{k(n.cssRules||[]).forEach(s=>{e.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${n.href}`,s)}}),e))}function Rr(i){return i.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>pe(t.style.getPropertyValue("src")))}async function Ir(i,t){if(i.ownerDocument==null)throw new Error("Provided element is not within a Document");const e=k(i.ownerDocument.styleSheets),r=await Mr(e,t);return Rr(r)}function ye(i){return i.trim().replace(/["']/g,"")}function Dr(i){const t=new Set;function e(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(s=>{t.add(ye(s))}),Array.from(r.children).forEach(s=>{s instanceof HTMLElement&&e(s)})}return e(i),t}async function Hr(i,t){const e=await Ir(i,t),r=Dr(i);return(await Promise.all(e.filter(s=>r.has(ye(s.style.fontFamily))).map(s=>{const o=s.parentStyleSheet?s.parentStyleSheet.href:null;return fe(s.cssText,o,t)}))).join(`
|
|
141
|
+
`)}async function Fr(i,t){const e=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Hr(i,t);if(e){const r=document.createElement("style"),n=document.createTextNode(e);r.appendChild(n),i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r)}}async function $r(i,t={}){const{width:e,height:r}=he(i,t),n=await et(i,t,!0);return await Fr(n,t),await ge(n,t),Pr(n,t),await tr(n,e,r)}async function Nr(i,t={}){const{width:e,height:r}=he(i,t),n=await $r(i,t),s=await X(n),o=document.createElement("canvas"),a=o.getContext("2d"),l=t.pixelRatio||Ji(),d=t.canvasWidth||e,u=t.canvasHeight||r;return o.width=d*l,o.height=u*l,t.skipAutoScale||Zi(o),o.style.width=`${d}`,o.style.height=`${u}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,o.width,o.height)),a.drawImage(s,0,0,o.width,o.height),o}async function Ur(i,t={}){return(await Nr(i,t)).toDataURL("image/jpeg",t.quality||1)}const nt=400,st=300,Nt=150,Ut=.3,Bt=.85;function we(i){let t=1/0,e=1/0,r=-1/0,n=-1/0;for(const s of i)if(s.type==="pin"){if(t=Math.min(t,s.x),e=Math.min(e,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y),s.targetRect){const o=s.targetRect;t=Math.min(t,o.left),e=Math.min(e,o.top),r=Math.max(r,o.left+o.width),n=Math.max(n,o.bottom)}}else if(s.type==="draw"&&s.drawPath)for(const o of ve(s.drawPath))for(const[a,l]of o)t=Math.min(t,a),e=Math.min(e,l),r=Math.max(r,a),n=Math.max(n,l);return!isFinite(t)||!isFinite(e)?null:{minX:t,minY:e,maxX:r,maxY:n}}function Br(i,t,e){const r=we(i);if(!r)return null;const n=Math.max(Nt,t*Ut),s=Math.max(Nt,e*Ut);let o=r.minX-n,a=r.minY-s,l=r.maxX-r.minX+n*2,d=r.maxY-r.minY+s*2;return l<nt&&(o-=(nt-l)/2,l=nt),d<st&&(a-=(st-d)/2,d=st),l=Math.min(l,t),d=Math.min(d,e),o=Math.min(Math.max(0,o),t-l),a=Math.min(Math.max(0,a),e-d),l>=t*Bt&&d>=e*Bt?null:{x:Math.round(o),y:Math.round(a),width:Math.round(l),height:Math.round(d)}}function Or(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 zr(i=[]){try{const t=en(document.body),e=i.map(qr),r=Jr(document.body),n=await Ur(document.body,{quality:.85,width:t.width,height:t.height,pixelRatio:tn(t),backgroundColor:"#ffffff",skipFonts:!1,skipAutoScale:!1,filter:s=>!(s instanceof HTMLElement&&s.id==="mtb-widget-host")});return await Xr(n,e,t,r)}catch{return null}}function qr(i){const t=Wr(jr(i));return t.x===0&&t.y===0?i:{...i,x:i.x+t.x,y:i.y+t.y,targetRect:i.targetRect&&{...i.targetRect,top:i.targetRect.top+t.y,left:i.targetRect.left+t.x,bottom:i.targetRect.bottom+t.y},drawPath:i.drawPath&&Yr(i.drawPath,t)}}function jr(i){if(i.targetSelector)try{const t=document.querySelector(i.targetSelector);if(t)return t}catch{}return document.elementsFromPoint?.(i.x,i.y)[0]??null}function Wr(i){let t=0,e=0,r=i;for(;r&&r!==document.body;)r instanceof HTMLElement&&(t+=r.scrollLeft,e+=r.scrollTop),r=Vr(r);return{x:t,y:e}}function Vr(i){if(i.parentElement)return i.parentElement;const t=i.getRootNode();return t instanceof ShadowRoot?t.host:null}function Yr(i,t){return i.replace(/([ML])\s*(-?(?:\d+\.?\d*|\.\d+))\s+(-?(?:\d+\.?\d*|\.\d+))/g,(e,r,n,s)=>`${r} ${Number(n)+t.x} ${Number(s)+t.y}`)}async function Xr(i,t,e,r){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return null;const o=await nn(i);if(!o)return null;n.width=o.naturalWidth||window.innerWidth,n.height=o.naturalHeight||window.innerHeight,s.drawImage(o,0,0);const a=n.width/e.width,l=n.height/e.height;s.fillStyle="#e5e7eb";for(const h of r)s.fillRect((h.left-e.left)*a,(h.top-e.top)*l,h.width*a,h.height*l);let d=0;for(const h of t)h.type==="draw"&&h.drawPath?Qr(s,h.drawPath,e,a,l):h.type==="pin"&&rn(s,(h.x-e.left)*a,(h.y-e.top)*l,++d);if(!Kr(t,e,a,l,n))return O(n);const u=Br(t,window.innerWidth,window.innerHeight);if(u){const h=Gr(u,e,a,l,n);return O(h?Or(n,h):n)}return O(n)}function Kr(i,t,e,r,n){const s=we(i);if(!s)return!0;const o=(s.minX-t.left)*e,a=(s.minY-t.top)*r,l=(s.maxX-t.left)*e,d=(s.maxY-t.top)*r;return o>=0&&a>=0&&l<=n.width&&d<=n.height}function Gr(i,t,e,r,n){const s=Math.min(n.width,Math.round(i.width*e)),o=Math.min(n.height,Math.round(i.height*r));if(s<=0||o<=0)return null;const a=Math.round((i.x-t.left)*e),l=Math.round((i.y-t.top)*r);return{x:Math.min(Math.max(0,a),n.width-s),y:Math.min(Math.max(0,l),n.height-o),width:s,height:o}}function Jr(i){const t=[];for(const s of Zr(i,`.${Q}`))ot(t,s.getBoundingClientRect());for(const s of i.querySelectorAll("input, textarea, select")){if(Ot(s))continue;const o=s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement?s.value:"",a=s.closest(`.${U}`)!==null,l=ne(s)||V(o,s)!==o;!a&&!l||ot(t,s.getBoundingClientRect(),qt)}const e=document.createTreeWalker(i,NodeFilter.SHOW_TEXT),r=se();let n=e.nextNode();for(;n;){const s=n.parentElement,o=n.textContent??"",a=s?.closest(`.${U}`)!==null,l=A(o)!==o||oe(n,r);if(s&&!Ot(s)&&(a||l)){const d=document.createRange();d.selectNodeContents(n);for(const u of Array.from(d.getClientRects()))ot(t,u,qt)}n=e.nextNode()}return t}function Zr(i,t){const e=Array.from(i.querySelectorAll(t));return i.matches(t)?[i,...e]:e}function Ot(i){return i.closest("#mtb-widget-host")!==null||i.closest(`.${Q}`)!==null}function ot(i,t,e=0){if(![t.left,t.top,t.width,t.height].every(Number.isFinite))throw new Error("Invalid privacy redaction geometry");t.width<=0||t.height<=0||i.push({left:t.left-e,top:t.top-e,width:t.width+e*2,height:t.height+e*2})}function Qr(i,t,e,r,n){i.save(),i.strokeStyle=Z,i.lineWidth=3.5,i.lineCap="round",i.lineJoin="round",i.shadowColor=ft(.35),i.shadowOffsetY=1,i.shadowBlur=2;for(const s of ve(t))if(s.length!==0){i.beginPath(),i.moveTo((s[0][0]-e.left)*r,(s[0][1]-e.top)*n);for(let o=1;o<s.length;o++)i.lineTo((s[o][0]-e.left)*r,(s[o][1]-e.top)*n);i.stroke()}i.restore()}const zt=16e6,qt=2;function tn(i){const t=i.width*i.height;return!Number.isFinite(t)||t<=zt?1:Math.sqrt(zt/t)}function en(i){const t=i.getBoundingClientRect(),e=window.getComputedStyle(i),r=parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),n=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),s=document.documentElement,o=Math.max(i.clientWidth,i.scrollWidth,s.clientWidth,s.scrollWidth),a=Math.max(i.clientHeight,i.scrollHeight,s.clientHeight,s.scrollHeight);return{left:t.left,top:t.top,width:o+(Number.isFinite(r)?r:0)||window.innerWidth,height:a+(Number.isFinite(n)?n:0)||window.innerHeight}}function rn(i,t,e,r){i.save(),i.shadowColor=ft(.45),i.shadowOffsetY=2,i.shadowBlur=8,i.fillStyle=Z,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 ${Qe}`,i.textAlign="center",i.textBaseline="middle",i.fillText(String(r),t,e),i.restore()}function ve(i){const t=[];let e=null;const r=i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g)??[];for(const n of r){const[s,o]=n.slice(1).trim().split(/\s+/).map(Number);Number.isNaN(s)||Number.isNaN(o)||(n[0]==="M"?(e=[[s,o]],t.push(e)):e&&e.push([s,o]))}return t}function nn(i){return new Promise(t=>{const e=new Image;e.onload=()=>t(e),e.onerror=()=>t(null),e.src=i})}function O(i){return new Promise(t=>{try{i.toBlob(e=>t(e),"image/jpeg",.85)}catch{t(null)}})}class sn{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,n,s)=>(this.emit({name:on(s),message:String(t),source:e,line:r,col:n,error:s}),this.originalOnError?this.originalOnError.call(window,t,e,r,n,s):!1),window.onerror=this.installedOnError,this.rejectionHandler=t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason),r=t.reason instanceof Error?t.reason.name:"UnhandledRejection";this.emit({name:r,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 xt=new sn;function on(i){return!i||typeof i!="object"||!("name"in i)?void 0:String(i.name)||void 0}function xe(i){const t=an(i.name)||ln(i.message),e=cn(i);return e?`${t} (${e})`:t}function an(i){return i&&/^[A-Za-z][A-Za-z0-9]*(?:Error|Exception|Rejection)$/.test(i)?i:""}function ln(i){return i.match(/^([A-Za-z][A-Za-z0-9]*(?:Error|Exception))\b/)?.[1]??"Error"}function cn(i){if(!i.source)return"";try{const t=new URL(i.source,window.location.href).pathname;return i.line==null?t:`${t}:${i.line}:${i.col??0}`}catch{return""}}const dn=20;class hn{constructor(){this.errors=[],this.unsubscribe=null}start(){this.unsubscribe||(this.unsubscribe=xt.subscribe(t=>this.record(t)))}record(t){this.addError(xe(t))}addError(t){this.errors.length>=dn||this.errors.includes(t)||this.errors.push(t)}getErrors(){return[...this.errors]}stop(){this.unsubscribe?.(),this.unsubscribe=null}}const q=new Set;let R=null,I=null,D=null,K=null,H=null,G=null;function ke(i){q.add(i),un();let t=!1;return()=>{t||(t=!0,q.delete(i),q.size===0&&mn())}}function at(i,t){const e={type:i,fromUrl:t,toUrl:location.href};G=e.toUrl;for(const r of[...q])try{r(e)}catch{}}function un(){if(D)return;G=location.href,H=()=>at("pop",G??location.href),window.addEventListener("popstate",H),R=history.pushState,I=history.replaceState;const i=R,t=I;D=function(e,r,n){const s=location.href;i.call(history,e,r,n),at("push",s)},K=function(e,r,n){const s=location.href;t.call(history,e,r,n),at("replace",s)},history.pushState=D,history.replaceState=K}function mn(){H&&(window.removeEventListener("popstate",H),H=null),R&&history.pushState===D&&(history.pushState=R),I&&history.replaceState===K&&(history.replaceState=I),R=null,I=null,D=null,K=null,G=null}const bn=20;function pn(i){return tt(i)?gt(i):pt(i)}function fn(i){return tt(i)?le(i):ee(i)}class gn{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=xt.subscribe(t=>this.recordError(t)),this.unsubscribeNavigation=ke(()=>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>bn&&this.breadcrumbs.shift()}handleClick(t){const e=t.target;if(e&&!T(e))try{this.add({type:"ui",category:"ui.click",timestamp:Date.now(),message:pn(e),data:{selector:fn(e)}})}catch{}}handleChange(t){const e=t.target;if(e&&!T(e))try{const r=e,n=tt(e)?gt(e):r.name||r.placeholder||e.getAttribute("aria-label")||e.tagName;this.add({type:"ui",category:"ui.input",timestamp:Date.now(),message:n,data:{field:n}})}catch{}}recordError(t){const e=xe(t);this.add({type:"console",category:"console.error",timestamp:Date.now(),message:e,data:{message:e}})}handleNavigation(){if(!this.active)return;const t=this.lastUrl,e=location.href;if(t===e)return;this.lastUrl=e;const r=N(t),n=N(e);this.add({type:"navigation",category:"navigation",timestamp:Date.now(),message:`${r} → ${n}`,data:{from:r,to:n}})}}const Se="mtb_frustration_state";let ut=null;function J(){try{const i=window.sessionStorage.getItem(Se);return j(i?JSON.parse(i):ut)}catch{return j(ut)}}function Ee(i){const t=j(i);ut=t;try{window.sessionStorage.setItem(Se,JSON.stringify(t))}catch{}}function yn(){return J().dismissedByUser}function wn(){Ee({...J(),dismissedByUser:!0})}function j(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 vn=4,xn=1500,kn=3,Sn=5e3,lt=500,En=2,Tn=3e4,_n=2e3,Cn=5e3,An=3e4,Ln=1e3,Pn=300,Mn=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL","SUMMARY","DETAILS"]),Rn=new Set(["button","link","checkbox","radio","tab","menuitem","option","switch","textbox","combobox","listbox","slider","spinbutton"]),In=new Set(["A","BUTTON","SUMMARY"]),Dn=new Set(["button","link","tab","menuitem"]),jt=[/\bnot found\b/,/\bserver error\b/,/^\s*(?:http\s*)?[45]\d{2}\s*$/,/\b(?:error|http|status)\s*[:-]?\s*[45]\d{2}\b/,/\b[45]\d{2}\s*[:-]?\s*error\b/],$=class ${constructor(t){this.clickHistory=[],this.unsubscribeErrors=null,this.active=!1,this.lastInteraction=null,this.cooldownUntil=0,this.navTimestamps=[],this.unsubscribeNavigation=null,this.boundPageLeaveHandler=null,this.boundTurboNavigationHandler=null,this.lastNavigationAt=-1,this.userNavigationIntentUntil=0,this.boundSubmitHandler=null,this.boundInvalidHandler=null,this.recentSubmitForms=new WeakSet,this.recentFailedForms=new WeakSet,this.formFailureTimestamps=new WeakMap,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=xt.subscribe(()=>{const t=Date.now();if(!this.lastInteraction||t-this.lastInteraction.time>_n)return;const e=this.lastInteraction;this.lastInteraction=null,this.emitIfReady({signal:"dead_click",target:z(e.target),detail:"Uncaught error after interaction",timestamp:t})}),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.lastInteraction=null,this.stopNavigationTracking(),this.stopFormTracking(),this.errorPageUrls.clear(),this.disconnectDomObserver())}startNavigationTracking(){this.unsubscribeNavigation=ke(t=>this.handleNavigation(t)),this.boundPageLeaveHandler=()=>this.noteNavigationStarted(),window.addEventListener("beforeunload",this.boundPageLeaveHandler),window.addEventListener("pagehide",this.boundPageLeaveHandler),this.boundTurboNavigationHandler=()=>{this.noteNavigationStarted(),this.userNavigationIntentUntil=Date.now()+An},document.addEventListener("turbo:before-visit",this.boundTurboNavigationHandler),document.addEventListener("turbo:submit-start",this.boundTurboNavigationHandler),document.addEventListener("turbo:before-fetch-request",this.boundTurboNavigationHandler)}stopNavigationTracking(){this.unsubscribeNavigation?.(),this.unsubscribeNavigation=null,this.navTimestamps=[],this.boundPageLeaveHandler&&(window.removeEventListener("beforeunload",this.boundPageLeaveHandler),window.removeEventListener("pagehide",this.boundPageLeaveHandler),this.boundPageLeaveHandler=null),this.boundTurboNavigationHandler&&(document.removeEventListener("turbo:before-visit",this.boundTurboNavigationHandler),document.removeEventListener("turbo:submit-start",this.boundTurboNavigationHandler),document.removeEventListener("turbo:before-fetch-request",this.boundTurboNavigationHandler),this.boundTurboNavigationHandler=null),this.lastNavigationAt=-1,this.userNavigationIntentUntil=0}noteNavigationStarted(){this.lastNavigationAt=Date.now()}restoreState(){const t=J();this.navTimestamps=t.navTimestamps,this.cooldownUntil=t.cooldownUntil,this.errorPageUrls=new Set(t.errorPageUrls)}persistState(){const t=J();Ee({...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||T(e))return;this.trackFormSubmitIntent(e),this.trackNativeNavigationIntent(t,e);const r=this.interactionTarget(e),n=Date.now();this.lastInteraction={target:r,time:n},this.userNavigationIntentUntil=n+Cn,this.clickHistory.push({target:r,time:n});const s=n-xn;if(this.clickHistory=this.clickHistory.filter(a=>a.time>s),this.clickHistory.filter(a=>a.target===r).length>=vn){this.clickHistory=[],this.emitHighPriority({signal:"rage_click",target:z(r),timestamp:n});return}this.checkDeadClickDom(r,n)}handleNavigation(t){const e=Date.now();this.noteNavigationStarted();const r=t.type!=="replace"&&t.fromUrl!==t.toUrl,n=t.type==="pop"||e<=this.userNavigationIntentUntil;if(r&&n){this.navTimestamps.push(e);const s=e-Sn;this.navTimestamps=this.navTimestamps.filter(o=>o>s),this.navTimestamps.length>=kn&&(this.navTimestamps=[],this.emitIfReady({signal:"rapid_navigation",timestamp:e})),t.type==="push"&&(this.userNavigationIntentUntil=0)}this.persistState(),setTimeout(()=>{this.active&&this.checkErrorPage()},Pn)}handleFormSubmit(t){const e=t.target;e instanceof HTMLFormElement&&(T(e)||(this.rememberSubmitAttempt(e),setTimeout(()=>{this.active&&e.querySelector('[aria-invalid="true"], .is-invalid')&&this.recordFormFailure(e)},lt)))}trackFormSubmitIntent(t){const e=t.closest("button, input");(e instanceof HTMLButtonElement||e instanceof HTMLInputElement)&&(e.type!=="submit"&&e.type!=="image"||!e.form||T(e.form)||this.rememberSubmitAttempt(e.form))}trackNativeNavigationIntent(t,e){e.closest("a[href]")&&queueMicrotask(()=>{this.active&&!t.defaultPrevented&&this.noteNavigationStarted()})}rememberSubmitAttempt(t){this.recentSubmitForms.add(t),setTimeout(()=>{this.recentSubmitForms.delete(t)},lt)}recordFormFailure(t){if(this.recentFailedForms.has(t))return;this.recentFailedForms.add(t),setTimeout(()=>this.recentFailedForms.delete(t),lt);const e=Date.now(),r=e-Tn,n=(this.formFailureTimestamps.get(t)??[]).filter(s=>s>r);n.push(e),this.formFailureTimestamps.set(t,n),!(n.length<En)&&(this.formFailureTimestamps.set(t,[]),this.emitIfReady({signal:"form_failure",target:z(t),timestamp:e}))}handleFormInvalid(t){const e=t.target;if(!e||T(e))return;const r=e.closest("form");!r||!this.recentSubmitForms.has(r)||this.recordFormFailure(r)}checkErrorPage(){const t=location.href;if(this.errorPageUrls.has(t))return;const e=document.title.toLowerCase();if(jt.some(n=>n.test(e))){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 n of r){const s=n.textContent??"";if(s.length<200&&jt.some(o=>o.test(s.toLowerCase()))){this.errorPageUrls.add(t),this.emitHighPriority({signal:"error_page",detail:s.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,n=this.lastNavigationAt>=e;this.pendingDomChecks===0&&this.disconnectDomObserver(),!r&&!n&&this.active&&this.emitIfReady({signal:"dead_click_dom",target:z(t),timestamp:e})},Ln))}ensureDomObserver(){this.domObserver||(this.domObserver=new MutationObserver(()=>{this.lastMutationAt=Date.now()}),this.domObserver.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}disconnectDomObserver(){this.domObserver?.disconnect(),this.domObserver=null}looksInteractive(t){if(In.has(t.tagName)||t.hasAttribute("onclick"))return!0;const e=t.getAttribute("role");if(e&&Dn.has(e)||window.getComputedStyle(t).cursor==="pointer")return!0;if(t.classList)for(const n of t.classList){const s=n.toLowerCase();if(s.includes("btn")||s.includes("button"))return!0}return!1}interactionTarget(t){let e=t;for(;e&&e!==document.body;){if(this.isIntrinsicInteractive(e))return e;e=e.parentElement}let r=t;for(e=t.parentElement;e&&e!==document.body&&this.looksInteractive(e);)r=e,e=e.parentElement;return r}isIntrinsicInteractive(t){if(Mn.has(t.tagName))return!0;const e=t.getAttribute("role");return e&&Rn.has(e)||t.hasAttribute("onclick")||t.hasAttribute("tabindex")?!0:t.contentEditable==="true"}emitIfReady(t){const e=Date.now();e<this.cooldownUntil||(this.cooldownUntil=e+$.COOLDOWN_MS,this.persistState(),this.onFrustration(t))}emitHighPriority(t){this.cooldownUntil=Date.now()+$.COOLDOWN_MS,this.persistState(),this.onFrustration(t)}};$.COOLDOWN_MS=6e4;let mt=$;function z(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("."):"",n=i.textContent?.trim().slice(0,30)??"";return`<${t}${e}${r}>${n?` "${n}"`:""}`}function Hn(){return{page_url:N(window.location.href),user_agent:navigator.userAgent,browser:Fn(),os:$n(),screen_width:window.screen.width,screen_height:window.screen.height}}function Fn(){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 $n(){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 Nn(i,t,e,r,n,s,o,a,l){return{...W({description:i,...t,page_url:N(t.page_url),console_errors:e,annotations:r?[r]:[],target_element:r?.targetSelector?{selector:r.targetSelector,text:r.targetText??"",name:r.targetName??""}:void 0,recording_events:s?.events,recording_duration:s?.duration,breadcrumbs:l}),user_id:n?.id,user_email:n?.email,user_name:n?.name,reporter_external_id:n?void 0:o,reporter_email:n?void 0:a}}const Wt="mtb_anon_id",Te="mtb_reporter_email",_e="mtb_board_url";let Vt=null,Ce=null,Ae=null;function Yt(){try{const i=window.localStorage.getItem(Wt);if(i?.startsWith("anon_"))return i;const t=Gt();return window.localStorage.setItem(Wt,t),t}catch{return Vt??(Vt=Gt()),Vt}}function Xt(){try{return window.localStorage.getItem(Te)??void 0}catch{return Ce??void 0}}function Un(i){Ce=i;try{window.localStorage.setItem(Te,i)}catch{}}function Bn(){try{return window.localStorage.getItem(_e)??void 0}catch{return Ae??void 0}}function Kt(i){Ae=i;try{window.localStorage.setItem(_e,i)}catch{}}function Gt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`anon_${crypto.randomUUID()}`:`anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}`}const On={tab:"Feedback",toolbar:{markup:"Mark up",record:"Record",hint:"Click to comment, drag to draw",hintTouch:"Drag to mark what's wrong",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:"Couldn't load the question. Send your feedback as is.",expired:"This feedback session expired before it could be sent. Please close the widget and submit again."}},zn={tab:"反馈",toolbar:{markup:"标注",record:"录屏",hint:"点击标注,拖动绘制",hintTouch:"用手指圈出问题",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:"追问加载失败,可以直接发送反馈。",expired:"这条反馈在发送前已过期。请关闭组件后重新提交。"}},qn={tab:"フィードバック",toolbar:{markup:"マークアップ",record:"録画",hint:"クリックでコメント、ドラッグで描画",hintTouch:"ドラッグして問題箇所を囲んでください",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:"質問を読み込めませんでした。そのままフィードバックを送信できます。",expired:"このフィードバックは送信される前に有効期限が切れました。ウィジェットを閉じて、もう一度送信してください。"}},jn={tab:"피드백",toolbar:{markup:"마크업",record:"녹화",hint:"클릭하여 댓글, 드래그하여 그리기",hintTouch:"드래그해서 문제가 있는 곳을 표시하세요",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:"질문을 불러오지 못했습니다. 피드백을 그대로 보내세요.",expired:"이 피드백 세션은 전송되기 전에 만료되었습니다. 위젯을 닫고 다시 보내 주세요."}},Wn={tab:"Comentarios",toolbar:{markup:"Anotar",record:"Grabar",hint:"Clic para comentar, arrastrar para dibujar",hintTouch:"Arrastra para marcar el problema",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 cargar la pregunta. Envía tus comentarios tal cual.",expired:"Esta sesión de comentarios caducó antes de poder enviarse. Cierra el widget y envíalo de nuevo."}},Vn={tab:"Avis",toolbar:{markup:"Annoter",record:"Enregistrer",hint:"Cliquer pour commenter, glisser pour dessiner",hintTouch:"Faites glisser pour marquer le problème",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:"Impossible de charger la question. Envoyez votre avis tel quel.",expired:"Cette session de retour a expiré avant d'avoir pu être envoyée. Fermez le widget et renvoyez-la."}},Yn={tab:"Feedback",toolbar:{markup:"Markieren",record:"Aufnehmen",hint:"Klicken zum Kommentieren, ziehen zum Zeichnen",hintTouch:"Ziehen, um das Problem zu markieren",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 Frage konnte nicht geladen werden. Senden Sie Ihr Feedback einfach so.",expired:"Diese Feedback-Sitzung ist abgelaufen, bevor sie gesendet werden konnte. Bitte schließe das Widget und sende erneut."}},P={en:On,"zh-CN":zn,ja:qn,ko:jn,es:Wn,fr:Vn,de:Yn};function Jt(i){if(P[i])return P[i];const t=i.split("-")[0];return P[t]?P[t]:P.en}class Xn{constructor(t,e,r,n){this.intervalId=null,this.getDuration=r,this.el=t.el("div","mtb-record-bar"),this.el.innerHTML=`
|
|
142
142
|
<span class="mtb-record-dot"></span>
|
|
143
143
|
<span class="mtb-record-timer">00:00</span>
|
|
144
144
|
<button class="mtb-record-stop" type="button">${c(e.record.stop)}</button>
|
|
145
|
-
`,t.append(this.el),this.timerEl=this.el.querySelector(".mtb-record-timer"),this.el.querySelector(".mtb-record-stop").addEventListener("click",n),this.intervalId=setInterval(()=>this.updateTimer(),1e3)}updateTimer(){const t=this.getDuration(),e=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");this.timerEl.textContent=`${e}:${r}`}destroy(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.el.remove()}}class Xn{constructor(){this.session=null,this.bar=null,this.result=null}async start(t,e,r){this.session=new xi(t,r),this.bar=new Yn(t,e,()=>this.session?.getDuration()??0,r),await this.session.start()}stop(){return this.session?(this.result=this.session.stop(),this.teardownUI(),this.result):null}getRecording(){return this.result}destroy(){this.teardownUI(),this.result=null}teardownUI(){this.session?.destroy(),this.session=null,this.bar?.destroy(),this.bar=null}}function Gt(){const{hostname:i}=window.location;return i==="localhost"||i==="127.0.0.1"||i==="[::1]"||i.endsWith(".localhost")||i.endsWith(".local")||i.endsWith(".test")}class ut{constructor(t){this.tab=null,this.toolbar=null,this.session=null,this.drawBar=null,this.dim=null,this.pageOffset=new je,this.popup=null,this.clarify=null,this.success=null,this.frustrationPrompt=null,this.frustrationDetector=null,this.mode="idle",this.via="pin",this.currentAnnotation=null,this.submittingUi=null,this.lastPopupPos=null,this.recordingManager=null,this.activeSubmission=null,this.pendingSubmissionRequest=null,this.submissionAttempt=0,this.touchHintShown=!1,this.lastHandoff={},this.handleKeydown=e=>{if(e.key==="Escape"&&!(e.isComposing||e.keyCode===229))switch(this.mode){case"annotating":case"popup":e.preventDefault(),e.stopPropagation(),this.exitAll();break;case"drawing":e.preventDefault(),e.stopPropagation(),this.cancelDraw();break;case"recording":e.preventDefault(),e.stopPropagation(),this.handleRecordStop();break}},this.handleRecordStop=()=>{this.recordingManager&&(this.recordingManager.stop(),this.via="record",this.showPopup(window.innerWidth/2,window.innerHeight/2,this.messages.record.timer_label))},this.config=t,this.messages=Kt(t.locale??document.documentElement.lang??"en"),this.apiClient=new Di(t.projectKey,t.apiUrl,void 0,t.userToken,t.userTokenFn),this.consoleCollector=new dn,this.consoleCollector.start(),this.breadcrumbCollector=new fn,this.breadcrumbCollector.start(),this.buildUI(),t.frustrationDetection!==!1&&(this.frustrationDetector=new ht(()=>this.handleFrustration()),this.frustrationDetector.start()),document.addEventListener("keydown",this.handleKeydown,!0)}buildUI(){if(this.shadow=new $e(this.config.theme??"auto"),this.config.entryMode==="api"){Gt()&&console.warn('[MakeThisBetter] entryMode: "api" renders no launcher. Call MakeThisBetter.open() from your own UI.');return}if(x()){Gt()&&console.warn("[MakeThisBetter] No launcher is rendered on touch devices. Call MakeThisBetter.open() from your own mobile UI.");return}this.mountTab()}mountTab(){this.tab||(this.tab=new Ue(this.shadow,this.messages,this.config.position??"right",()=>this.handleTabClick(),this.config.tabText,this.config.tabColor))}open(){this.mode==="idle"&&(this.dismissFrustrationPrompt(),this.enterAnnotationMode())}close(){this.mode!=="idle"&&this.exitAll()}showLauncher(){x()||(this.mountTab(),this.tab?.setActive(this.mode!=="idle"))}hideLauncher(){this.tab?.destroy(),this.tab=null}setLocale(t){this.config.locale=t,this.messages=Kt(t),this.tab?.setMessages(this.messages)}handleTabClick(){this.mode==="idle"?(this.dismissFrustrationPrompt(),this.enterAnnotationMode()):this.exitAll()}handleFrustration(){this.mode!=="idle"||this.frustrationPrompt||gn()||(this.frustrationPrompt=new Oe(this.shadow,this.messages,{onTell:()=>{this.dismissFrustrationPrompt(),this.enterAnnotationMode()},onDismiss:()=>{yn(),this.dismissFrustrationPrompt()},onAutoHide:()=>this.dismissFrustrationPrompt()}))}dismissFrustrationPrompt(){this.frustrationPrompt?.destroy(),this.frustrationPrompt=null}enterAnnotationMode(){this.mode="annotating",this.tab?.setActive(!0);const t=x();this.toolbar=new Ve(this.shadow,this.messages,()=>this.exitAll(),e=>this.handleToolbarModeChange(e),this.config.position??"right",!t||!this.touchHintShown),t&&(this.touchHintShown=!0),this.session=this.createSession(),t&&this.toolbar&&this.pageOffset.reserve(this.toolbar.height())}createSession(){return new Ei(this.shadow,this.messages,{onPin:(t,e)=>{this.currentAnnotation=t,this.via="pin",this.showPopup(t.x,t.y,e,t.targetRect)},onDrawStroke:()=>this.handleDrawStroke()})}handleToolbarModeChange(t){if(this.mode==="clarifying"){this.toolbar?.setMode(this.via==="record"?"record":"markup");return}if(t==="record"){if(this.mode==="recording")return;this.mode="recording",this.currentAnnotation=null,this.teardownDraw(),this.session?.destroy(),this.session=null,this.recordingManager=new Xn,this.recordingManager.start(this.shadow,this.messages,this.handleRecordStop).catch(e=>{console.warn("[MakeThisBetter] Interaction replay unavailable, falling back to markup:",e),this.mode==="recording"&&(this.toolbar?.setMode("markup"),this.handleToolbarModeChange("markup"))})}else this.recordingManager?.destroy(),this.recordingManager=null,this.teardownDraw(),this.session||(this.session=this.createSession()),this.mode="annotating"}handleDrawStroke(){if(x()){this.showDrawSheet();return}this.mode!=="drawing"&&(this.mode="drawing",this.drawBar=new Li(this.shadow,{messages:this.messages,onUndo:()=>this.handleDrawUndoRedo("undo"),onRedo:()=>this.handleDrawUndoRedo("redo"),onCancel:()=>this.cancelDraw(),onSubmit:t=>this.handleDrawSubmit(t)})),this.refreshDrawBar()}showDrawSheet(){this.mode!=="drawing"&&(this.mode="drawing",this.popup=new _t(this.shadow,{targetName:this.messages.annotation.drawing,x:window.innerWidth/2,y:window.innerHeight/2,messages:this.messages,onSubmit:t=>this.handleDrawSubmit(t),onClose:()=>this.cancelDraw(),position:this.config.position??"right"}),this.submittingUi=this.popup)}handleDrawUndoRedo(t){t==="undo"?this.session?.undoDraw():this.session?.redoDraw(),this.refreshDrawBar()}refreshDrawBar(){this.session&&this.drawBar?.setUndoRedo(this.session.canUndoDraw(),this.session.canRedoDraw())}cancelDraw(){this.session?.clearDraw(),this.teardownDraw(),this.popup?.destroy(),this.popup=null,this.dim?.destroy(),this.dim=null,this.submittingUi=null,this.mode="annotating"}teardownDraw(){this.drawBar?.destroy(),this.drawBar=null}handleDrawSubmit(t){const e=this.session?.getDrawAnnotation();if(!e){this.cancelDraw();return}this.currentAnnotation=e,this.via="draw",this.session?.dismissInteraction(),this.submittingUi=this.drawBar??this.popup,this.handleSubmit(t||this.messages.annotation.drawing)}showPopup(t,e,r,n){this.mode="popup",this.lastPopupPos={x:t,y:e},this.teardownDraw(),this.session?.dismissInteraction(),this.popup?.destroy(),this.popup=null,this.dim?.destroy(),this.dim=null,this.dim=new qe(this.shadow,()=>this.exitAll()),this.popup=new _t(this.shadow,{targetName:r,x:t,y:e,targetRect:n,messages:this.messages,onSubmit:s=>this.handleSubmit(s),onClose:()=>this.exitAll(),onMyFeedback:this.buildMyFeedbackHandler(),position:this.config.position??"right"}),this.submittingUi=this.popup}buildMyFeedbackHandler(){if(!this.config.user&&Bn())return async()=>{const t=await this.apiClient.createIdentityToken(Wt());!t?.identity_token||!t.board_url||(Yt(t.board_url),window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`,"_blank"))}}handleSubmit(t){if(!this.submittingUi)return;const e=this.currentAnnotation,r=this.recordingManager?.getRecording()??void 0,n=this.teardownSubmittingUi(!0),s=()=>this.startSubmissionRequest(t,e,r);this.showClarify(this.lastPopupPos,{element:n,pendingSession:s(),onRetrySubmission:s})}startSubmissionRequest(t,e,r){const n=++this.submissionAttempt,s=this.createSubmission(t,e,r,n);return this.pendingSubmissionRequest=s,s}async createSubmission(t,e,r,n){await Kn();const[s,o]=await Promise.all([Or(e?[e]:[]),Promise.resolve(Dn())]),a=$n(t,o,this.consoleCollector.getErrors(),e,this.config.user,r,this.config.user?void 0:Wt(),this.config.user?void 0:Vt(),this.breadcrumbCollector.getBreadcrumbs());try{const l=await this.apiClient.createSubmissionSession(a,s);return n!==this.submissionAttempt?(await this.apiClient.abandonSubmissionSession(l.id,l.token).catch(()=>{}),null):(this.activeSubmission=l,l)}catch{return null}}teardownSubmittingUi(t=!1){const e=t?this.popup?.releaseElement():void 0;return this.teardownDraw(),e||this.popup?.destroy(),this.popup=null,this.dim?.destroy(),this.dim=null,this.session?.hideHighlight(),this.session?.destroy(),this.session=null,this.recordingManager?.destroy(),this.recordingManager=null,this.submittingUi=null,e}showClarify(t,e){this.mode="clarifying",this.tab?.setActive(!0),this.clarify=new zi(this.shadow,{apiClient:this.apiClient,messages:this.messages,element:e.element,position:this.config.position??"right",x:t?.x,y:t?.y,onFinalize:()=>this.finalizeSubmission(),onCancel:()=>this.exitAll(),pendingSession:e.pendingSession,onRetrySubmission:e.onRetrySubmission})}async finalizeSubmission(){const t=this.submissionAttempt,e=this.activeSubmission??await(this.pendingSubmissionRequest??Promise.resolve(null));if(t!==this.submissionAttempt)return;if(!e)throw new Error("No active submission session");const r=await this.apiClient.finalizeSubmissionSession(e.id,e.token);t!==this.submissionAttempt||this.activeSubmission!==e||(this.activeSubmission=null,this.pendingSubmissionRequest=null,this.lastHandoff={feedbackId:r.id,boardUrl:r.board_url,identityToken:r.identity_token},r.board_url&&Yt(r.board_url),this.clarify?.destroy(),this.clarify=null,this.teardownToolbar(),this.showSuccess({skipFollowup:e.ai_clarify_available===!1}))}showSuccess(t){this.mode="idle",this.tab?.setActive(!1),this.success=new Wi(this.shadow,this.messages,()=>{this.success?.destroy(),this.success=null},this.buildViewFeedbackHandler(),{...t,emailCapture:this.buildEmailCapture()})}buildEmailCapture(){if(this.config.user)return;const{feedbackId:t,identityToken:e}=this.lastHandoff;if(!(!t||!e)&&!Vt())return{onSubmit:async r=>{const n=await this.apiClient.updateReporter(t,r,e);return n&&Un(r),n}}}buildViewFeedbackHandler(){const{boardUrl:t,identityToken:e}=this.lastHandoff;if(t){if(e)return()=>{window.open(`${t}?identity=${encodeURIComponent(e)}`,"_blank")};if(this.config.userToken||this.config.userTokenFn)return async()=>{const r=await this.apiClient.resolveUserToken();r&&window.open(`${t}?identity=${encodeURIComponent(r)}`,"_blank")}}}teardownToolbar(){this.pageOffset.release(),this.toolbar?.destroy(),this.toolbar=null}exitAll(){this.submissionAttempt+=1;const t=this.activeSubmission;this.activeSubmission=null,this.pendingSubmissionRequest=null,t&&this.apiClient.abandonSubmissionSession(t.id,t.token).catch(()=>{}),this.mode="idle",this.via="pin",this.tab?.setActive(!1),this.teardownToolbar(),this.teardownDraw(),this.session?.hideHighlight(),this.session?.destroy(),this.session=null,this.dim?.destroy(),this.dim=null,this.popup?.destroy(),this.popup=null,this.clarify?.destroy(),this.clarify=null,this.currentAnnotation=null,this.submittingUi=null,this.recordingManager?.destroy(),this.recordingManager=null}destroy(){document.removeEventListener("keydown",this.handleKeydown,!0),this.exitAll(),this.consoleCollector.stop(),this.breadcrumbCollector.stop(),this.frustrationDetector?.stop(),this.dismissFrustrationPrompt(),this.clarify?.destroy(),this.success?.destroy(),this.tab?.destroy(),this.recordingManager?.destroy(),this.shadow.destroy()}}function Kn(){return new Promise(i=>requestAnimationFrame(()=>setTimeout(i,0)))}let b=null,_=null,C=null;function Jt(){C&&(document.removeEventListener("DOMContentLoaded",C),C=null)}const Ce={init(i){Jt(),b&&(b.destroy(),b=null),_=i,document.readyState==="loading"?(C=()=>{C=null,b=new ut(i)},document.addEventListener("DOMContentLoaded",C,{once:!0})):b=new ut(i)},destroy(){Jt(),b?.destroy(),b=null,_=null},setLocale(i){_&&(_.locale=i),b?.setLocale(i)},open(){b?.open()},close(){b?.close()},showLauncher(){b?.showLauncher()},hideLauncher(){b?.hideLauncher()}};typeof window<"u"&&(window.MakeThisBetter=Ce,document.addEventListener("turbo:load",()=>{const i=document.getElementById("mtb-widget-host");_&&(!i||!i.shadowRoot)&&(b?.destroy(),i?.remove(),b=new ut(_))}));exports.MakeThisBetter=Ce;
|
|
145
|
+
`,t.append(this.el),this.timerEl=this.el.querySelector(".mtb-record-timer"),this.el.querySelector(".mtb-record-stop").addEventListener("click",n),this.intervalId=setInterval(()=>this.updateTimer(),1e3)}updateTimer(){const t=this.getDuration(),e=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");this.timerEl.textContent=`${e}:${r}`}destroy(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.el.remove()}}class Kn{constructor(){this.session=null,this.bar=null,this.result=null}async start(t,e,r){this.session=new ki(t,r),this.bar=new Xn(t,e,()=>this.session?.getDuration()??0,r),await this.session.start()}stop(){return this.session?(this.result=this.session.stop(),this.teardownUI(),this.result):null}getRecording(){return this.result}destroy(){this.teardownUI(),this.result=null}teardownUI(){this.session?.destroy(),this.session=null,this.bar?.destroy(),this.bar=null}}function Zt(){const{hostname:i}=window.location;return i==="localhost"||i==="127.0.0.1"||i==="[::1]"||i.endsWith(".localhost")||i.endsWith(".local")||i.endsWith(".test")}class bt{constructor(t){this.tab=null,this.toolbar=null,this.session=null,this.drawBar=null,this.dim=null,this.pageOffset=new We,this.popup=null,this.clarify=null,this.success=null,this.frustrationPrompt=null,this.frustrationDetector=null,this.mode="idle",this.via="pin",this.currentAnnotation=null,this.submittingUi=null,this.lastPopupPos=null,this.recordingManager=null,this.activeSubmission=null,this.pendingSubmissionRequest=null,this.submissionAttempt=0,this.touchHintShown=!1,this.lastHandoff={},this.handleKeydown=e=>{if(e.key==="Escape"&&!(e.isComposing||e.keyCode===229))switch(this.mode){case"annotating":case"popup":e.preventDefault(),e.stopPropagation(),this.exitAll();break;case"drawing":e.preventDefault(),e.stopPropagation(),this.cancelDraw();break;case"recording":e.preventDefault(),e.stopPropagation(),this.handleRecordStop();break}},this.handleRecordStop=()=>{this.recordingManager&&(this.recordingManager.stop(),this.via="record",this.showPopup(window.innerWidth/2,window.innerHeight/2,this.messages.record.timer_label))},this.config=t,this.messages=Jt(t.locale??document.documentElement.lang??"en"),this.apiClient=new Hi(t.projectKey,t.apiUrl,void 0,t.userToken,t.userTokenFn),this.consoleCollector=new hn,this.consoleCollector.start(),this.breadcrumbCollector=new gn,this.breadcrumbCollector.start(),this.buildUI(),t.frustrationDetection!==!1&&(this.frustrationDetector=new mt(()=>this.handleFrustration()),this.frustrationDetector.start()),document.addEventListener("keydown",this.handleKeydown,!0)}buildUI(){if(this.shadow=new ct(this.config.theme??"auto"),this.config.entryMode==="api"){Zt()&&console.warn('[MakeThisBetter] entryMode: "api" renders no launcher. Call MakeThisBetter.open() from your own UI.');return}if(x()){Zt()&&console.warn("[MakeThisBetter] No launcher is rendered on touch devices. Call MakeThisBetter.open() from your own mobile UI.");return}this.mountTab()}mountTab(){this.tab||(this.tab=new Ue(this.shadow,this.messages,this.config.position??"right",()=>this.handleTabClick(),this.config.tabText,this.config.tabColor))}open(){this.mode==="idle"&&(this.dismissFrustrationPrompt(),this.enterAnnotationMode())}close(){this.mode!=="idle"&&this.exitAll()}showLauncher(){x()||(this.mountTab(),this.tab?.setActive(this.mode!=="idle"))}hideLauncher(){this.tab?.destroy(),this.tab=null}setLocale(t){this.config.locale=t,this.messages=Jt(t),this.tab?.setMessages(this.messages)}handleTabClick(){this.mode==="idle"?(this.dismissFrustrationPrompt(),this.enterAnnotationMode()):this.exitAll()}handleFrustration(){this.mode!=="idle"||this.frustrationPrompt||yn()||(this.frustrationPrompt=new ze(this.shadow,this.messages,{onTell:()=>{this.dismissFrustrationPrompt(),this.enterAnnotationMode()},onDismiss:()=>{wn(),this.dismissFrustrationPrompt()},onAutoHide:()=>this.dismissFrustrationPrompt()}))}dismissFrustrationPrompt(){this.frustrationPrompt?.destroy(),this.frustrationPrompt=null}enterAnnotationMode(){this.mode="annotating",this.tab?.setActive(!0);const t=x();this.toolbar=new Ye(this.shadow,this.messages,()=>this.exitAll(),e=>this.handleToolbarModeChange(e),this.config.position??"right",!t||!this.touchHintShown),t&&(this.touchHintShown=!0),this.session=this.createSession(),t&&this.toolbar&&this.pageOffset.reserve(this.toolbar.height())}createSession(){return new Ti(this.shadow,this.messages,{onPin:(t,e)=>{this.currentAnnotation=t,this.via="pin",this.showPopup(t.x,t.y,e,t.targetRect)},onDrawStroke:()=>this.handleDrawStroke()})}handleToolbarModeChange(t){if(this.mode==="clarifying"){this.toolbar?.setMode(this.via==="record"?"record":"markup");return}if(t==="record"){if(this.mode==="recording")return;this.mode="recording",this.currentAnnotation=null,this.teardownDraw(),this.session?.destroy(),this.session=null,this.recordingManager=new Kn,this.recordingManager.start(this.shadow,this.messages,this.handleRecordStop).catch(e=>{console.warn("[MakeThisBetter] Interaction replay unavailable, falling back to markup:",e),this.mode==="recording"&&(this.toolbar?.setMode("markup"),this.handleToolbarModeChange("markup"))})}else this.recordingManager?.destroy(),this.recordingManager=null,this.teardownDraw(),this.session||(this.session=this.createSession()),this.mode="annotating"}handleDrawStroke(){if(x()){this.showDrawSheet();return}this.mode!=="drawing"&&(this.mode="drawing",this.drawBar=new Pi(this.shadow,{messages:this.messages,onUndo:()=>this.handleDrawUndoRedo("undo"),onRedo:()=>this.handleDrawUndoRedo("redo"),onCancel:()=>this.cancelDraw(),onSubmit:t=>this.handleDrawSubmit(t)})),this.refreshDrawBar()}showDrawSheet(){this.mode!=="drawing"&&(this.mode="drawing",this.popup=new At(this.shadow,{targetName:this.messages.annotation.drawing,x:window.innerWidth/2,y:window.innerHeight/2,messages:this.messages,onSubmit:t=>this.handleDrawSubmit(t),onClose:()=>this.cancelDraw(),position:this.config.position??"right"}),this.submittingUi=this.popup)}handleDrawUndoRedo(t){t==="undo"?this.session?.undoDraw():this.session?.redoDraw(),this.refreshDrawBar()}refreshDrawBar(){this.session&&this.drawBar?.setUndoRedo(this.session.canUndoDraw(),this.session.canRedoDraw())}cancelDraw(){this.session?.clearDraw(),this.teardownDraw(),this.popup?.destroy(),this.popup=null,this.dim?.destroy(),this.dim=null,this.submittingUi=null,this.mode="annotating"}teardownDraw(){this.drawBar?.destroy(),this.drawBar=null}handleDrawSubmit(t){const e=this.session?.getDrawAnnotation();if(!e){this.cancelDraw();return}this.currentAnnotation=e,this.via="draw",this.session?.dismissInteraction(),this.submittingUi=this.drawBar??this.popup,this.handleSubmit(t||this.messages.annotation.drawing)}showPopup(t,e,r,n){this.mode="popup",this.lastPopupPos={x:t,y:e},this.teardownDraw(),this.session?.dismissInteraction(),this.popup?.destroy(),this.popup=null,this.dim?.destroy(),this.dim=null,this.dim=new je(this.shadow,()=>this.exitAll()),this.popup=new At(this.shadow,{targetName:r,x:t,y:e,targetRect:n,messages:this.messages,onSubmit:s=>this.handleSubmit(s),onClose:()=>this.exitAll(),onMyFeedback:this.buildMyFeedbackHandler(),position:this.config.position??"right"}),this.submittingUi=this.popup}buildMyFeedbackHandler(){if(!this.config.user&&Bn())return async()=>{const t=await this.apiClient.createIdentityToken(Yt());!t?.identity_token||!t.board_url||(Kt(t.board_url),window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`,"_blank"))}}handleSubmit(t){if(!this.submittingUi)return;const e=this.currentAnnotation,r=this.recordingManager?.getRecording()??void 0,n=this.teardownSubmittingUi(!0),s=()=>this.startSubmissionRequest(t,e,r);this.showClarify(this.lastPopupPos,{element:n,pendingSession:s(),onRetrySubmission:s})}startSubmissionRequest(t,e,r){const n=++this.submissionAttempt,s=this.createSubmission(t,e,r,n);return this.pendingSubmissionRequest=s,s}async createSubmission(t,e,r,n){await Gn();const[s,o]=await Promise.all([zr(e?[e]:[]),Promise.resolve(Hn())]),a=Nn(t,o,this.consoleCollector.getErrors(),e,this.config.user,r,this.config.user?void 0:Yt(),this.config.user?void 0:Xt(),this.breadcrumbCollector.getBreadcrumbs());try{const l=await this.apiClient.createSubmissionSession(a,s);return n!==this.submissionAttempt?(await this.apiClient.abandonSubmissionSession(l.id,l.token).catch(()=>{}),null):(this.activeSubmission=l,l)}catch{return null}}teardownSubmittingUi(t=!1){const e=t?this.popup?.releaseElement():void 0;return this.teardownDraw(),e||this.popup?.destroy(),this.popup=null,this.dim?.destroy(),this.dim=null,this.session?.hideHighlight(),this.session?.destroy(),this.session=null,this.recordingManager?.destroy(),this.recordingManager=null,this.submittingUi=null,e}showClarify(t,e){this.mode="clarifying",this.tab?.setActive(!0),this.clarify=new qi(this.shadow,{apiClient:this.apiClient,messages:this.messages,element:e.element,position:this.config.position??"right",x:t?.x,y:t?.y,onFinalize:()=>this.finalizeSubmission(),onCancel:()=>this.exitAll(),pendingSession:e.pendingSession,onRetrySubmission:e.onRetrySubmission})}async finalizeSubmission(){const t=this.submissionAttempt,e=this.activeSubmission??await(this.pendingSubmissionRequest??Promise.resolve(null));if(t!==this.submissionAttempt)return;if(!e)throw new Error("No active submission session");const r=await this.apiClient.finalizeSubmissionSession(e.id,e.token);t!==this.submissionAttempt||this.activeSubmission!==e||(this.activeSubmission=null,this.pendingSubmissionRequest=null,this.lastHandoff={feedbackId:r.id,boardUrl:r.board_url,identityToken:r.identity_token},r.board_url&&Kt(r.board_url),this.clarify?.destroy(),this.clarify=null,this.teardownToolbar(),this.showSuccess({skipFollowup:e.ai_clarify_available===!1}))}showSuccess(t){this.mode="idle",this.tab?.setActive(!1),this.success=new Vi(this.shadow,this.messages,()=>{this.success?.destroy(),this.success=null},this.buildViewFeedbackHandler(),{...t,emailCapture:this.buildEmailCapture()})}buildEmailCapture(){if(this.config.user)return;const{feedbackId:t,identityToken:e}=this.lastHandoff;if(!(!t||!e)&&!Xt())return{onSubmit:async r=>{const n=await this.apiClient.updateReporter(t,r,e);return n&&Un(r),n}}}buildViewFeedbackHandler(){const{boardUrl:t,identityToken:e}=this.lastHandoff;if(t){if(e)return()=>{window.open(`${t}?identity=${encodeURIComponent(e)}`,"_blank")};if(this.config.userToken||this.config.userTokenFn)return async()=>{const r=await this.apiClient.resolveUserToken();r&&window.open(`${t}?identity=${encodeURIComponent(r)}`,"_blank")}}}teardownToolbar(){this.pageOffset.release(),this.toolbar?.destroy(),this.toolbar=null}exitAll(){this.submissionAttempt+=1;const t=this.activeSubmission;this.activeSubmission=null,this.pendingSubmissionRequest=null,t&&this.apiClient.abandonSubmissionSession(t.id,t.token).catch(()=>{}),this.mode="idle",this.via="pin",this.tab?.setActive(!1),this.teardownToolbar(),this.teardownDraw(),this.session?.hideHighlight(),this.session?.destroy(),this.session=null,this.dim?.destroy(),this.dim=null,this.popup?.destroy(),this.popup=null,this.clarify?.destroy(),this.clarify=null,this.currentAnnotation=null,this.submittingUi=null,this.recordingManager?.destroy(),this.recordingManager=null}destroy(){document.removeEventListener("keydown",this.handleKeydown,!0),this.exitAll(),this.consoleCollector.stop(),this.breadcrumbCollector.stop(),this.frustrationDetector?.stop(),this.dismissFrustrationPrompt(),this.clarify?.destroy(),this.success?.destroy(),this.tab?.destroy(),this.recordingManager?.destroy(),this.shadow.destroy()}}function Gn(){return new Promise(i=>requestAnimationFrame(()=>setTimeout(i,0)))}let b=null,_=null,C=null;function Qt(){C&&(document.removeEventListener("DOMContentLoaded",C),C=null)}const Le={init(i){Qt(),b&&(b.destroy(),b=null),_=i,document.readyState==="loading"?(C=()=>{C=null,b=new bt(i)},document.addEventListener("DOMContentLoaded",C,{once:!0})):b=new bt(i)},destroy(){Qt(),b?.destroy(),b=null,_=null},setLocale(i){_&&(_.locale=i),b?.setLocale(i)},open(){b?.open()},close(){b?.close()},showLauncher(){b?.showLauncher()},hideLauncher(){b?.hideLauncher()}};typeof window<"u"&&(window.MakeThisBetter=Le,document.addEventListener("turbo:load",()=>{const i=document.getElementById("mtb-widget-host");_&&(!i||!i.shadowRoot)&&(b?.destroy(),i?.remove(),b=new bt(_))}));exports.MakeThisBetter=Le;
|
|
146
146
|
//# sourceMappingURL=makethisbetter.cjs.map
|