@backtrack-js/browser 0.5.2 → 0.5.3
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/capturers/console.d.ts +0 -1
- package/dist/capturers/errors.d.ts +0 -1
- package/dist/capturers/index.d.ts +0 -1
- package/dist/capturers/navigation.d.ts +0 -1
- package/dist/capturers/network.d.ts +0 -1
- package/dist/capturers/performance.d.ts +0 -1
- package/dist/capturers/route-matcher.d.ts +0 -1
- package/dist/capturers/rrweb.d.ts +0 -1
- package/dist/capturers/sanitizer.d.ts +0 -1
- package/dist/core/flight-recorder.d.ts +0 -1
- package/dist/core/state-machine.d.ts +0 -1
- package/dist/dev-server/index.d.ts +0 -1
- package/dist/dev-server/middleware.d.ts +0 -1
- package/dist/dev-server.cjs +0 -1
- package/dist/dev-server.js +0 -1
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/markdown-Ao5Ah9MF.cjs +0 -1
- package/dist/markdown-D3C94OlY.js +0 -1
- package/dist/storage/batch-writer.d.ts +0 -1
- package/dist/storage/db.d.ts +0 -1
- package/dist/storage/incident-manager.d.ts +0 -1
- package/dist/storage/index.d.ts +0 -1
- package/dist/storage/retention.d.ts +0 -1
- package/dist/storage/session.d.ts +0 -1
- package/dist/types/artifact.d.ts +0 -1
- package/dist/types/chunk.d.ts +0 -1
- package/dist/types/health.d.ts +0 -1
- package/dist/types/incident.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/options.d.ts +0 -1
- package/dist/types/timeline.d.ts +0 -1
- package/dist/types/transport.d.ts +0 -1
- package/dist/utils/compression.d.ts +0 -1
- package/dist/utils/gist-uploader.d.ts +0 -1
- package/dist/utils/markdown.d.ts +0 -1
- package/dist/validation/validate.d.ts +0 -1
- package/dist/viewer/assets/{index-D8m3bwRf.js → index-BkV3C4kX.js} +1 -1
- package/dist/viewer/index.html +1 -1
- package/dist/widget/annotator.d.ts +0 -1
- package/dist/widget/styles.d.ts +0 -1
- package/dist/widget/widget.d.ts +0 -1
- package/package.json +13 -4
- package/dist/capturers/console.d.ts.map +0 -1
- package/dist/capturers/errors.d.ts.map +0 -1
- package/dist/capturers/index.d.ts.map +0 -1
- package/dist/capturers/navigation.d.ts.map +0 -1
- package/dist/capturers/network.d.ts.map +0 -1
- package/dist/capturers/performance.d.ts.map +0 -1
- package/dist/capturers/route-matcher.d.ts.map +0 -1
- package/dist/capturers/rrweb.d.ts.map +0 -1
- package/dist/capturers/sanitizer.d.ts.map +0 -1
- package/dist/core/flight-recorder.d.ts.map +0 -1
- package/dist/core/state-machine.d.ts.map +0 -1
- package/dist/dev-server/index.d.ts.map +0 -1
- package/dist/dev-server/middleware.d.ts.map +0 -1
- package/dist/dev-server.cjs.map +0 -1
- package/dist/dev-server.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-Ao5Ah9MF.cjs.map +0 -1
- package/dist/markdown-D3C94OlY.js.map +0 -1
- package/dist/storage/batch-writer.d.ts.map +0 -1
- package/dist/storage/db.d.ts.map +0 -1
- package/dist/storage/incident-manager.d.ts.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/retention.d.ts.map +0 -1
- package/dist/storage/session.d.ts.map +0 -1
- package/dist/types/artifact.d.ts.map +0 -1
- package/dist/types/chunk.d.ts.map +0 -1
- package/dist/types/health.d.ts.map +0 -1
- package/dist/types/incident.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/options.d.ts.map +0 -1
- package/dist/types/timeline.d.ts.map +0 -1
- package/dist/types/transport.d.ts.map +0 -1
- package/dist/utils/compression.d.ts.map +0 -1
- package/dist/utils/gist-uploader.d.ts.map +0 -1
- package/dist/utils/markdown.d.ts.map +0 -1
- package/dist/validation/validate.d.ts.map +0 -1
- package/dist/widget/annotator.d.ts.map +0 -1
- package/dist/widget/styles.d.ts.map +0 -1
- package/dist/widget/widget.d.ts.map +0 -1
|
@@ -7,4 +7,3 @@ export declare function globToRegex(pattern: string): RegExp;
|
|
|
7
7
|
* Verifica se um pathname ou URL corresponde a alguma das regras de sensitiveRoutes configuradas.
|
|
8
8
|
*/
|
|
9
9
|
export declare function matchesSensitiveRoute(pathname: string, matchers?: RouteMatcher[]): boolean;
|
|
10
|
-
//# sourceMappingURL=route-matcher.d.ts.map
|
|
@@ -34,4 +34,3 @@ export declare function sanitizePayloadString(payload: string, maxLength?: numbe
|
|
|
34
34
|
* Sanitiza headers HTTP redigindo Authorization, Cookies, Tokens e Chaves.
|
|
35
35
|
*/
|
|
36
36
|
export declare function sanitizeHeaders(headers: Record<string, string> | Headers | [string, string][] | undefined | null): Record<string, string> | undefined;
|
|
37
|
-
//# sourceMappingURL=sanitizer.d.ts.map
|
|
@@ -72,4 +72,3 @@ export declare class FlightRecorderImpl implements FlightRecorder {
|
|
|
72
72
|
* Função factory pública para instanciar o Flight Recorder.
|
|
73
73
|
*/
|
|
74
74
|
export declare function createFlightRecorder(options?: FlightRecorderOptions): FlightRecorder;
|
|
75
|
-
//# sourceMappingURL=flight-recorder.d.ts.map
|
|
@@ -11,4 +11,3 @@ export interface BacktrackMiddlewareOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export type ConnectLikeMiddleware = (req: IncomingMessage, res: ServerResponse, next?: (err?: unknown) => void) => void;
|
|
13
13
|
export declare function createBacktrackMiddleware(options: BacktrackMiddlewareOptions): ConnectLikeMiddleware;
|
|
14
|
-
//# sourceMappingURL=middleware.d.ts.map
|
package/dist/dev-server.cjs
CHANGED
|
@@ -4,4 +4,3 @@
|
|
|
4
4
|
`+e.readFileSync(r.mdPath,"utf8"),n=`${f}.${Date.now()}.tmp`;try{e.writeFileSync(n,s,{encoding:"utf8",flag:"wx"}),e.renameSync(n,f)}finally{m(n)&&e.unlinkSync(n)}return r.id}function E(i){const r=x();let s=r.length,n=r.reduce((c,a)=>c+a.size,e.statSync(f).size);for(const c of r){if(s<=F&&n<=v)break;c.id!==i&&(e.unlinkSync(c.mdPath),e.unlinkSync(c.jsonPath),s--,n-=c.size)}}return(i,r,s)=>{const n=(l,$)=>{!r.destroyed&&!r.headersSent&&(r.writeHead(l,{"Content-Type":"application/json",...l===405?{Allow:"POST"}:{}}),r.end(JSON.stringify($)))};if((i.url||"").split("?")[0]!=="/__backtrack/incident"){s?s():n(404,{error:"Not found"});return}if(i.method!=="POST"){n(405,{error:"Method Not Allowed"});return}if((i.headers["content-type"]||"").split(";")[0].trim().toLowerCase()!=="application/json"){n(415,{error:"Unsupported Media Type: application/json required"});return}if(!V(i,t.allowedOrigins)){n(403,{error:"Forbidden: invalid origin or non-local access"});return}let c=0,a=!1;const p=[];i.on("error",()=>{a=!0,p.length=0}),i.on("aborted",()=>{a=!0,p.length=0}),i.on("data",l=>{a||(c+=l.length,c>h?(a=!0,p.length=0,r.setHeader("Connection","close"),n(413,{error:"Payload Too Large"})):p.push(l))}),i.on("end",()=>{if(a)return;const l=Buffer.concat(p).toString("utf8");p.length=0;let $;try{$=JSON.parse(l)}catch{n(400,{error:"Invalid JSON"});return}const z=I.validateFlightRecorderArtifact($);if(!z.success){n(400,{error:"Invalid artifact schema"});return}const M=z.data,g=M.incident.id;if(!_(g)){n(400,{error:"Invalid incident ID format"});return}P=P.then(()=>{try{for(const u of[S,d]){if(e.existsSync(u)&&!e.lstatSync(u).isDirectory())throw new Error("Invalid output directory");e.mkdirSync(u,{recursive:!0})}const w=y.join(d,`${g}.json`),k=y.join(d,`${g}.md`),j=e.existsSync(w),O=e.existsSync(k);if(j&&(!m(w)||e.readFileSync(w,"utf8")!==l)||O&&(!m(k)||!j)){n(409,{error:"Conflict: incident ID exists with different content"});return}if(j&&O){const u=D();E(u),n(200,{id:g,status:"already_persisted"});return}const N=I.formatIncidentMarkdown(M),H=`> **Artefato completo:** [\`${g}.json\`](incidents/${g}.json)
|
|
5
5
|
|
|
6
6
|
`;if(Buffer.byteLength(l)+2*Buffer.byteLength(N)+Buffer.byteLength(H)>v){n(413,{error:"Incident size exceeds maxStorageBytes limit"});return}const R=`${Date.now()}-${Math.random().toString(36).slice(2)}`,B=`${w}.${R}.tmp`,b=`${k}.${R}.tmp`;let T=!1,C=!1;try{j||e.writeFileSync(B,l,{encoding:"utf8",flag:"wx"}),e.writeFileSync(b,N,{encoding:"utf8",flag:"wx"}),j||(e.renameSync(B,w),T=!0),e.renameSync(b,k),C=!0,D()}catch(u){throw C&&m(k)&&e.unlinkSync(k),T&&m(w)&&e.unlinkSync(w),u}finally{for(const u of[B,b])m(u)&&e.unlinkSync(u)}const J=x();E(J[J.length-1].id),n(201,{id:g,status:"saved"})}catch{n(500,{error:"Failed to persist incident"})}})})}}exports.createBacktrackMiddleware=G;
|
|
7
|
-
//# sourceMappingURL=dev-server.cjs.map
|
package/dist/dev-server.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1798,5 +1798,4 @@
|
|
|
1798
1798
|
</div>
|
|
1799
1799
|
</div>
|
|
1800
1800
|
</div>
|
|
1801
|
-
`}updateDomValues(){var i,a;if(!this.shadow)return;const t=this.shadow.querySelector(".backtrack-panel");if(this.isOpen&&!t){this.render();return}if(!this.isOpen&&t){this.render();return}const e=((i=this.health)==null?void 0:i.state)==="recording"?"backtrack-status-recording":((a=this.health)==null?void 0:a.state)==="degraded"?"backtrack-status-degraded":"backtrack-status-idle",r=this.shadow.querySelector(".backtrack-launcher-status-dot");r&&(r.className=`backtrack-launcher-status-dot ${e}`);const n=this.shadow.getElementById("btn-launcher");if(n){let s=n.querySelector(".backtrack-incident-badge-count");this.incidents.length>0?(s||(s=document.createElement("span"),s.className="backtrack-incident-badge-count",n.appendChild(s)),s.textContent=String(this.incidents.length)):s&&s.remove()}if(this.isOpen&&t){const s=this.shadow.getElementById("backtrack-saved-count-title");if(s&&(s.textContent=String(this.incidents.length)),!this.selectedIncidentId){const o=this.shadow.getElementById("backtrack-incident-list-container");if(o){const c=Array.from(o.querySelectorAll("[data-open-detail-id]")).map(u=>u.getAttribute("data-open-detail-id")).join(","),h=this.incidents.slice(0,8).map(u=>u.id).join(",");c!==h&&(o.innerHTML=this.renderIncidentsHtml(),this.attachIncidentListeners())}}}}attachIncidentListeners(){var t;this.shadow&&(this.shadow.querySelectorAll("[data-open-detail-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-open-detail-id");n&&(this.selectedIncidentId=n,this.render())})}),(t=this.shadow.getElementById("btn-back-to-list"))==null||t.addEventListener("click",()=>{this.selectedIncidentId=null,this.render()}),this.shadow.querySelectorAll("[data-view-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-view-id");n&&this.handleViewIncident(n)})}),this.shadow.querySelectorAll("[data-share-gist-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-share-gist-id");n&&this.handleShareGist(n)})}),this.shadow.querySelectorAll("[data-download-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-download-id");n&&this.handleDownloadIncident(n)})}),this.shadow.querySelectorAll("[data-copy-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-copy-id");n&&this.handleCopyMarkdown(n)})}),this.shadow.querySelectorAll("[data-delete-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-delete-id");n&&this.handleDeleteIncident(n)})}))}attachLauncherListeners(t){if(t.dataset.hasListeners)return;t.dataset.hasListeners="true";let e=0,r=0,n=0,i=0,a=!1;t.addEventListener("touchstart",s=>{if(s.touches.length===1&&this.container){const o=s.touches[0];e=o.clientX,r=o.clientY;const c=this.container.getBoundingClientRect();n=c.left,i=c.top,a=!1}},{passive:!0}),t.addEventListener("touchmove",s=>{if(s.touches.length===1&&this.container){const o=s.touches[0],c=o.clientX-e,h=o.clientY-r;(Math.abs(c)>5||Math.abs(h)>5)&&(a=!0,this.container.style.left=`${n+c}px`,this.container.style.top=`${i+h}px`,this.container.style.bottom="auto",this.container.style.right="auto")}},{passive:!0}),t.addEventListener("touchend",()=>{a&&(this.wasDragged=!0,setTimeout(()=>{this.wasDragged=!1},150))}),t.addEventListener("click",s=>{if(this.wasDragged){s.preventDefault(),s.stopPropagation();return}this.toggleOpen()})}attachPanelListeners(){var e,r,n,i,a,s,o,c,h,u,p,g,b,f,m,k,I,y,w,E,C,M,T,A,_;if(!this.shadow)return;(e=this.shadow.getElementById("btn-close"))==null||e.addEventListener("click",()=>{this.toggleOpen()}),(r=this.shadow.getElementById("btn-dismiss-banner"))==null||r.addEventListener("click",()=>{this.dismissBanner()}),(n=this.shadow.getElementById("btn-header-menu"))==null||n.addEventListener("click",B=>{B.stopPropagation(),this.isHeaderMenuOpen=!this.isHeaderMenuOpen,this.render()}),(i=this.shadow.getElementById("btn-hide-widget"))==null||i.addEventListener("click",B=>{B.stopPropagation(),this.isHeaderMenuOpen=!1,this.showHideConfirmModal=!0,this.render()}),(a=this.shadow.getElementById("btn-duration-60"))==null||a.addEventListener("click",()=>{this.selectedDurationSeconds=60,this.isCustomDuration=!1,this.render()}),(s=this.shadow.getElementById("btn-duration-300"))==null||s.addEventListener("click",()=>{this.selectedDurationSeconds=300,this.isCustomDuration=!1,this.render()}),(o=this.shadow.getElementById("btn-duration-all"))==null||o.addEventListener("click",()=>{this.selectedDurationSeconds=0,this.isCustomDuration=!1,this.render()}),(c=this.shadow.getElementById("btn-duration-custom"))==null||c.addEventListener("click",()=>{this.isCustomDuration=!0,this.render()});const t=this.shadow.getElementById("input-custom-duration");t&&(t.addEventListener("input",B=>{const P=parseInt(B.target.value,10);isNaN(P)||(this.selectedDurationSeconds=Math.max(5,Math.min(900,P)))}),t.addEventListener("change",B=>{const P=parseInt(B.target.value,10),W=isNaN(P)?60:Math.max(5,Math.min(900,P));this.selectedDurationSeconds=W,t.value=String(W)})),(h=this.shadow.getElementById("btn-save"))==null||h.addEventListener("click",()=>{this.handleCapture()}),(u=this.shadow.getElementById("btn-annotate"))==null||u.addEventListener("click",()=>{this.handleAnnotate()}),(p=this.shadow.getElementById("btn-clear"))==null||p.addEventListener("click",()=>{this.handleClear()}),this.attachIncidentListeners(),this.exportModalIncidentId&&((g=this.shadow.getElementById("btn-close-export-modal"))==null||g.addEventListener("click",()=>{this.closeExportModal()}),(b=this.shadow.getElementById("btn-cancel-export-modal"))==null||b.addEventListener("click",()=>{this.closeExportModal()}),(f=this.shadow.getElementById("check-include-incident-link"))==null||f.addEventListener("change",B=>{this.exportModalIncludeLink=B.target.checked,this.render()}),(m=this.shadow.getElementById("btn-confirm-export-modal"))==null||m.addEventListener("click",()=>{this.confirmCopyMarkdown()})),this.downloadModalIncidentId&&((k=this.shadow.getElementById("btn-close-download-modal"))==null||k.addEventListener("click",()=>{this.closeDownloadModal()}),(I=this.shadow.getElementById("btn-cancel-download-modal"))==null||I.addEventListener("click",()=>{this.closeDownloadModal()}),(y=this.shadow.getElementById("radio-format-ai"))==null||y.addEventListener("change",()=>{this.downloadModalFormat="ai",this.downloadModalError=null,this.render()}),(w=this.shadow.getElementById("radio-format-gzip"))==null||w.addEventListener("change",()=>{this.downloadModalFormat="gzip",this.downloadModalError=null,this.render()}),(E=this.shadow.getElementById("radio-format-uncompressed"))==null||E.addEventListener("change",()=>{this.downloadModalFormat="uncompressed",this.downloadModalError=null,this.render()}),(C=this.shadow.getElementById("btn-confirm-download-modal"))==null||C.addEventListener("click",()=>{this.confirmDownload()})),this.showHideConfirmModal&&((M=this.shadow.getElementById("btn-close-hide-modal"))==null||M.addEventListener("click",()=>{this.showHideConfirmModal=!1,this.render()}),(T=this.shadow.getElementById("btn-cancel-hide-modal"))==null||T.addEventListener("click",()=>{this.showHideConfirmModal=!1,this.render()}),(A=this.shadow.getElementById("btn-confirm-hide-modal"))==null||A.addEventListener("click",()=>{this.showHideConfirmModal=!1,this.hide()})),(_=this.shadow.querySelector(".backtrack-panel"))==null||_.addEventListener("click",B=>{if(this.isHeaderMenuOpen){const P=B.target;P!=null&&P.closest(".backtrack-header-menu-wrap")||(this.isHeaderMenuOpen=!1,this.render())}})}};l(O,"sessionGithubToken",null);let Q=O;const vt="0.5.2",v=class v{constructor(t,e){l(this,"options");l(this,"stateMachine");l(this,"db");l(this,"writer",null);l(this,"retention");l(this,"incidentManager",null);l(this,"widget",null);l(this,"consoleCapturer",null);l(this,"errorCapturer",null);l(this,"networkCapturer",null);l(this,"navigationCapturer",null);l(this,"rrwebCapturer",null);l(this,"performanceCapturer",null);l(this,"sequence",0);l(this,"retentionIntervalTimer",null);l(this,"retentionPromise",null);l(this,"cachedStorageBytes",0);l(this,"cachedIncidentCount",0);l(this,"pageHideHandler");l(this,"beforeUnloadHandler");l(this,"visibilityChangeHandler");l(this,"cachedProtectedBytes",0);l(this,"cachedBrowserEstimateBytes");l(this,"cachedBrowserQuotaBytes");l(this,"nextSequence",()=>(this.sequence++,this.sequence));l(this,"stoppingPromise");var r,n,i,a,s,o,c,h,u,p,g;this.options={bufferMinutes:(t==null?void 0:t.bufferMinutes)??5,afterErrorSeconds:(t==null?void 0:t.afterErrorSeconds)??15,maxStorageMb:(t==null?void 0:t.maxStorageMb)??50,captureHttpStatus:(t==null?void 0:t.captureHttpStatus)??[500,502,503,504],showWidget:(t==null?void 0:t.showWidget)??!1,widgetOptions:t==null?void 0:t.widgetOptions,metadata:t==null?void 0:t.metadata,recorderVersion:t==null?void 0:t.recorderVersion,ignoredUrls:t==null?void 0:t.ignoredUrls,network:{capturePayloads:((r=t==null?void 0:t.network)==null?void 0:r.capturePayloads)??!1,maxPayloadSize:((n=t==null?void 0:t.network)==null?void 0:n.maxPayloadSize)??64*1024},privacy:{maskAllInputs:((i=t==null?void 0:t.privacy)==null?void 0:i.maskAllInputs)??!0,maskAllText:((a=t==null?void 0:t.privacy)==null?void 0:a.maskAllText)??!1,blockMedia:((s=t==null?void 0:t.privacy)==null?void 0:s.blockMedia)??!0,blockSelector:(o=t==null?void 0:t.privacy)==null?void 0:o.blockSelector,maskTextSelector:(c=t==null?void 0:t.privacy)==null?void 0:c.maskTextSelector,sanitizeUrl:(h=t==null?void 0:t.privacy)==null?void 0:h.sanitizeUrl,sensitiveRoutes:(u=t==null?void 0:t.privacy)==null?void 0:u.sensitiveRoutes,autoMaskPII:(p=t==null?void 0:t.privacy)==null?void 0:p.autoMaskPII,recordCanvas:(g=t==null?void 0:t.privacy)==null?void 0:g.recordCanvas},storage:t==null?void 0:t.storage,sessionOptions:t==null?void 0:t.sessionOptions,batchWriterConfig:t==null?void 0:t.batchWriterConfig,transport:t==null?void 0:t.transport,beforeSend:t==null?void 0:t.beforeSend,context:t==null?void 0:t.context,getContext:t==null?void 0:t.getContext},this.stateMachine=new xt("stopped"),this.db=e||new St,this.retention=new At(this.db,{bufferMinutes:this.options.bufferMinutes,maxStorageMb:this.options.maxStorageMb})}static async init(t,e){if(v.activeInstance)return v.activeInstance;const r=new v(t,e);if(await r.start(),v.activeInstance=r,typeof window<"u"){const n=window;n.Backtrack=v,n.flightRecorder=r,n.hideBacktrack=()=>v.hideWidget(),n.showBacktrack=()=>v.showWidget(),n.toggleBacktrack=()=>v.toggleWidget()}return r}static hideWidget(){const t=v.activeInstance;if(t!=null&&t.widget)t.widget.hide();else try{if(typeof localStorage<"u"&&localStorage.setItem("backtrack_widget_hidden","true"),typeof document<"u"){const e=document.getElementById("__backtrack_widget_host__");e&&(e.style.display="none")}}catch{}}static showWidget(){const t=v.activeInstance;if(t!=null&&t.widget)t.widget.show();else try{if(typeof localStorage<"u"&&localStorage.removeItem("backtrack_widget_hidden"),typeof document<"u"){const e=document.getElementById("__backtrack_widget_host__");e&&(e.style.display="")}}catch{}}static toggleWidget(){const t=v.activeInstance;return t!=null&&t.widget?t.widget.toggle():typeof localStorage<"u"&&localStorage.getItem("backtrack_widget_hidden")==="true"?(v.showWidget(),!0):(v.hideWidget(),!1)}static hide(){v.hideWidget()}static show(){v.showWidget()}static toggle(){return v.toggleWidget()}static async resetInstance(){v.activeInstance&&(await v.activeInstance.stop(),v.activeInstance=null)}static getInstance(){return v.activeInstance}hideWidget(){this.widget?this.widget.hide():v.hideWidget()}showWidget(){this.widget?this.widget.show():v.showWidget()}toggleWidget(){return this.widget?this.widget.toggle():v.toggleWidget()}getEnvironmentMetadata(){const t=this.options.metadata;if(typeof window>"u")return{url:"http://localhost",userAgent:"node",viewport:{width:1280,height:720},...t};const e=window;return{url:window.location.href,userAgent:window.navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},appVersion:(t==null?void 0:t.appVersion)??e.__APP_VERSION__??e.__UTICKET_APP_VERSION__,gitBranch:(t==null?void 0:t.gitBranch)??e.__GIT_BRANCH__??e.__UTICKET_GIT_BRANCH__,gitCommit:(t==null?void 0:t.gitCommit)??e.__GIT_COMMIT__??e.__UTICKET_GIT_COMMIT__,...t}}async start(){var t,e,r,n;if(!this.stateMachine.isRecording())try{await this.db.open();const i=await Rt({...this.options.sessionOptions,...this.options.storage?{storage:this.options.storage}:{}}),a=await this.db.getChunksBySession(i.sessionId),s=Math.max(0,...a.flatMap(c=>(c.timeline||[]).map(h=>h.sequence))),o=Math.max(0,...a.map(c=>c.sequence));this.sequence=s,this.writer=new Tt(this.db,i.sessionId,i.tabId,{...this.options.batchWriterConfig,initialChunkSequence:o},c=>{var u;c instanceof Error&&(c.name==="QuotaExceededError"||((u=c.message)==null?void 0:u.includes("QuotaExceededError")))||typeof DOMException<"u"&&c instanceof DOMException&&c.name==="QuotaExceededError"?this.handleQuotaExceeded():this.stateMachine.transition({type:"DEGRADE",reason:"Falha ao persistir um lote; a gravação pode estar incompleta."})}),this.writer.setOnChunkPersisted(()=>{this.scheduleRetention()}),this.incidentManager=new et(this.db,i.sessionId,i.tabId,()=>this.getEnvironmentMetadata(),{afterErrorSeconds:this.options.afterErrorSeconds,recorderVersion:this.options.recorderVersion??vt,context:this.options.context,getContext:this.options.getContext,getRecordingIssues:()=>{var c;return[...this.stateMachine.getDegradedReasons(),...(((c=this.rrwebCapturer)==null?void 0:c.getDroppedEventsCount())??0)>0?["O capturador não conseguiu registrar parte do replay."]:[]]},getDroppedEventsCount:()=>{var c;return((c=this.rrwebCapturer)==null?void 0:c.getDroppedEventsCount())??0}}),this.incidentManager.setOnIncidentPending(()=>{this.stateMachine.transition({type:"TRIGGER_AUTO"})}),this.incidentManager.setOnIncidentFinalized(c=>{var h;(h=this.incidentManager)!=null&&h.getPendingIncident()||this.stateMachine.transition({type:"FINALIZE_INCIDENT"}),this.updateStatsCache(),this.sendIncident(c.id)}),this.incidentManager.setOnError(c=>{var u;c instanceof Error&&(c.name==="QuotaExceededError"||((u=c.message)==null?void 0:u.includes("QuotaExceededError")))||typeof DOMException<"u"&&c instanceof DOMException&&c.name==="QuotaExceededError"?this.handleQuotaExceeded():this.stateMachine.transition({type:"DEGRADE",reason:"Falha no gerenciamento de incidentes; o incidente pode não ter sido salvo completamente."})}),this.incidentManager.setBeforeFinalize(async()=>{this.writer&&await this.writer.flush()}),await this.incidentManager.init(),this.consoleCapturer=new Dt(this.writer,this.nextSequence),this.errorCapturer=new Lt(this.writer,this.incidentManager,this.nextSequence),this.networkCapturer=new zt(this.writer,this.incidentManager,this.nextSequence,{captureHttpStatus:this.options.captureHttpStatus,ignoredUrls:this.options.ignoredUrls,sanitizeUrlCallback:(t=this.options.privacy)==null?void 0:t.sanitizeUrl,capturePayloads:(e=this.options.network)==null?void 0:e.capturePayloads,maxPayloadSize:(r=this.options.network)==null?void 0:r.maxPayloadSize}),this.navigationCapturer=new Pt(this.writer,this.nextSequence,{sanitizeUrlCallback:(n=this.options.privacy)==null?void 0:n.sanitizeUrl}),this.rrwebCapturer=new $t(this.writer,{privacy:this.options.privacy}),this.performanceCapturer=new Ot(this.writer,this.nextSequence),this.consoleCapturer.start(),this.errorCapturer.start(),this.networkCapturer.start(),this.navigationCapturer.start(),this.rrwebCapturer.start(),this.performanceCapturer.start(),this.stateMachine.transition({type:"START"}),this.incidentManager.getPendingIncident()&&this.stateMachine.transition({type:"TRIGGER_AUTO"}),this.retentionIntervalTimer=setInterval(()=>{this.scheduleRetention()},3e4),this.updateStatsCache(),this.options.showWidget&&typeof window<"u"&&(this.widget=new Q(this,this.options.widgetOptions),this.widget.mount()),typeof window<"u"&&typeof window.addEventListener=="function"&&(this.pageHideHandler=()=>{var c;(c=this.incidentManager)==null||c.syncPendingIncidentDroppedEvents().catch(()=>{})},this.beforeUnloadHandler=()=>{var c;(c=this.incidentManager)==null||c.syncPendingIncidentDroppedEvents().catch(()=>{})},window.addEventListener("pagehide",this.pageHideHandler),window.addEventListener("beforeunload",this.beforeUnloadHandler)),typeof document<"u"&&typeof document.addEventListener=="function"&&(this.visibilityChangeHandler=()=>{var c;document.visibilityState==="hidden"&&((c=this.incidentManager)==null||c.syncPendingIncidentDroppedEvents().catch(()=>{}))},document.addEventListener("visibilitychange",this.visibilityChangeHandler))}catch(i){this.stateMachine.transition({type:"DEGRADE",reason:`Falha ao iniciar recorder: ${i instanceof Error?i.message:String(i)}`})}}scheduleRetention(){return this.retentionPromise?this.retentionPromise:(this.retentionPromise=(async()=>{try{this.incidentManager?await this.incidentManager.runExclusive(async()=>{var t;await((t=this.incidentManager)==null?void 0:t.protectSessionChunks()),await this.retention.prune(),await this.updateStatsCache()}):(await this.retention.prune(),await this.updateStatsCache())}catch{this.stateMachine.transition({type:"DEGRADE",reason:"Falha na manutenção do armazenamento local."})}finally{this.retentionPromise=null}})(),this.retentionPromise)}async handleQuotaExceeded(){try{this.incidentManager?await this.incidentManager.runExclusive(async()=>{var n;await((n=this.incidentManager)==null?void 0:n.protectSessionChunks()),await this.retention.emergencyPrune(),await this.updateStatsCache()}):(await this.retention.emergencyPrune(),await this.updateStatsCache())}catch{}const t=await this.retention.getStorageBreakdown().catch(()=>null),r=(t?t.bufferBytes===0&&t.protectedBytes>0:!1)||t!=null&&t.protectedExceedsLimit?"A quota do navegador foi excedida. Apenas conteúdo protegido permanece salvo; é necessário excluir incidentes ou limpar gravações para liberar espaço.":"A quota do navegador impediu a gravação de um lote. Um prune emergencial de dados não protegidos foi executado.";this.stateMachine.transition({type:"DEGRADE",reason:r})}async updateStatsCache(){try{const t=await this.retention.getStorageBreakdown();if(this.cachedStorageBytes=t.totalBytes,this.cachedProtectedBytes=t.protectedBytes,this.cachedIncidentCount=t.incidentCount,typeof navigator<"u"&&navigator.storage&&typeof navigator.storage.estimate=="function")try{const e=await navigator.storage.estimate();this.cachedBrowserEstimateBytes=e.usage,this.cachedBrowserQuotaBytes=e.quota}catch{}if(t.protectedExceedsLimit)this.stateMachine.transition({type:"DEGRADE",reason:"O armazenamento protegido por incidentes excede o limite configurado (maxStorageMb)."});else if(!t.isOverLimit&&this.stateMachine.isDegraded()){const e=this.stateMachine.getDegradedReasons();e.every(n=>n.includes("maxStorageMb")||n.includes("quota")||n.includes("Quota")||n.includes("armazenamento"))&&e.length>0&&this.stateMachine.transition({type:"RECOVER"})}}catch{}}async sendIncident(t){const e=this.options.transport;if(e)try{const r=await this.getArtifact(t),n=this.options.beforeSend?await this.options.beforeSend(r):r;n&&await e.send(n)}catch{}}stopCapturers(){var t,e,r,n,i,a;(t=this.rrwebCapturer)==null||t.stop(),(e=this.navigationCapturer)==null||e.stop(),(r=this.networkCapturer)==null||r.stop(),(n=this.errorCapturer)==null||n.stop(),(i=this.consoleCapturer)==null||i.stop(),(a=this.performanceCapturer)==null||a.stop()}clearRuntimeReferences(){this.rrwebCapturer=null,this.navigationCapturer=null,this.networkCapturer=null,this.errorCapturer=null,this.consoleCapturer=null,this.performanceCapturer=null,this.writer=null,this.incidentManager=null}async stop(){if(this.stateMachine.getState()!=="stopped"){if(this.stoppingPromise)return this.stoppingPromise;this.stoppingPromise=(async()=>{var t;if(this.stopCapturers(),this.retentionIntervalTimer&&(clearInterval(this.retentionIntervalTimer),this.retentionIntervalTimer=null),this.widget&&(this.widget.unmount(),this.widget=null),v.activeInstance===this&&(v.activeInstance=null),this.retentionPromise)try{await this.retentionPromise}catch{}typeof window<"u"&&typeof window.removeEventListener=="function"&&(this.pageHideHandler&&(window.removeEventListener("pagehide",this.pageHideHandler),this.pageHideHandler=void 0),this.beforeUnloadHandler&&(window.removeEventListener("beforeunload",this.beforeUnloadHandler),this.beforeUnloadHandler=void 0)),typeof document<"u"&&typeof document.removeEventListener=="function"&&this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0),this.writer&&await this.writer.flush(),(t=this.writer)==null||t.destroy(),this.incidentManager&&(await this.incidentManager.syncPendingIncidentDroppedEvents().catch(()=>{}),await this.incidentManager.destroy()),Z(),this.clearRuntimeReferences(),this.stateMachine.transition({type:"STOP"})})();try{await this.stoppingPromise}finally{this.stoppingPromise=void 0}}}async capture(t="manual",e,r){if(!this.incidentManager||!this.writer)throw new Error("FlightRecorder não está em execução.");const n=await this.incidentManager.runExclusive(async()=>{const i=Date.now();return this.writer.addTimelineEvent({id:`marker_manual_${i}`,timestamp:i,sequence:this.nextSequence(),type:"marker",label:`Captura manual: ${t}`}),await this.writer.flush(),this.incidentManager.executeManualTrigger({id:`trig_manual_${i}`,timestamp:i,type:"manual",signature:`manual_capture_${t}`,detail:{userReason:t,windowSeconds:e,annotationImage:r==null?void 0:r.annotationImage,notes:r==null?void 0:r.notes,annotations:r==null?void 0:r.annotations}},e)});return await this.updateStatsCache(),n}captureException(t,e){if(this.errorCapturer)try{return this.errorCapturer.captureException(t,e)}catch{}}async listIncidents(){try{return await this.db.listIncidents()}catch{return[]}}async getArtifact(t){return this.incidentManager?this.incidentManager.exportArtifact(t):new et(this.db,"","",()=>this.getEnvironmentMetadata(),{recorderVersion:this.options.recorderVersion??vt,context:this.options.context,getContext:this.options.getContext,getRecordingIssues:()=>this.stateMachine.getDegradedReasons()}).exportArtifact(t)}async exportIncident(t,e){const r=await this.getArtifact(t),n=new Date(r.incident.triggeredAt).toISOString().replace(/:/g,"-").replace(/\..+/,""),i=(e==null?void 0:e.aiOptimized)??!1,a=!i&&((e==null?void 0:e.compress)??!1),s=i?".ai.json":a?".ffr.json.gz":".ffr.json",o=`flight-recorder-${n}-${r.incident.reason}-${t}${s}`,c=i?{...r,replay:[],_aiNote:"Replay visual removido para otimizacao de IA. Timeline, erros de console e rede preservados."}:r;if(typeof window<"u"&&typeof document<"u"){let h;if(a){const g=await Mt(r);h=new Blob([g],{type:"application/gzip"})}else{const g=JSON.stringify(c,null,2);h=new Blob([g],{type:"application/json;charset=utf-8"})}const u=URL.createObjectURL(h),p=document.createElement("a");p.href=u,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}return c}async deleteIncident(t){this.incidentManager?(await this.incidentManager.deleteIncident(t),await this.incidentManager.runExclusive(async()=>{await this.retention.prune(),await this.updateStatsCache()})):(await this.db.deleteIncident(t),await this.retention.prune(),await this.updateStatsCache())}async clear(){if(this.writer&&await this.writer.flush(),this.retentionPromise)try{await this.retentionPromise}catch{}this.incidentManager&&await this.incidentManager.reset(),this.stateMachine.getState()==="incident_pending"&&this.stateMachine.transition({type:"FINALIZE_INCIDENT"}),await this.db.clearAll(),this.cachedStorageBytes=0,this.cachedProtectedBytes=0,this.cachedIncidentCount=0}getHealth(){var r,n;const t=((r=this.rrwebCapturer)==null?void 0:r.getDroppedEventsCount())??0,e=(this.options.maxStorageMb??50)*1024*1024;return{state:this.stateMachine.getState(),droppedEvents:t,storageBytes:this.cachedStorageBytes,protectedStorageBytes:this.cachedProtectedBytes,storageLimitBytes:e,storageLimitExceeded:this.cachedStorageBytes>e,protectedStorageExceeded:this.cachedProtectedBytes>e,browserStorageEstimateBytes:this.cachedBrowserEstimateBytes,browserStorageQuotaBytes:this.cachedBrowserQuotaBytes,pendingWrites:((n=this.writer)==null?void 0:n.getPendingWrites())??0,incidentCount:this.cachedIncidentCount,reasons:this.stateMachine.getDegradedReasons()}}getSequence(){return this.sequence}async flush(){this.writer&&await this.writer.flush()}async destroy(){await this.stop()}};l(v,"activeInstance",null);let U=v;function Nt(d){return new U(d)}exports.formatIncidentMarkdown=q.formatIncidentMarkdown;exports.getUtf8ByteLength=q.getUtf8ByteLength;exports.isReplayEvent=q.isReplayEvent;exports.isValidAnnotationImage=q.isValidAnnotationImage;exports.sortTimelineEvents=q.sortTimelineEvents;exports.validateFlightRecorderArtifact=q.validateFlightRecorderArtifact;exports.Backtrack=U;exports.BacktrackImpl=U;exports.BacktrackWidget=Q;exports.BatchWriter=Tt;exports.ConsoleCapturer=Dt;exports.DB_NAME=It;exports.DB_VERSION=Et;exports.ErrorCapturer=Lt;exports.FlightRecorderDB=St;exports.FlightRecorderImpl=U;exports.IncidentManager=et;exports.MAX_ARTIFACT_BYTES=Y;exports.NavigationCapturer=Pt;exports.NetworkCapturer=zt;exports.PerformanceCapturer=Ot;exports.RecorderStateMachine=xt;exports.RetentionEngine=At;exports.RrwebCapturer=$t;exports.STORE_CHUNKS=S;exports.STORE_INCIDENTS=R;exports.STORE_SESSIONS=$;exports.ScreenAnnotator=qt;exports.claimSessionContext=Rt;exports.closeSessionChannel=Z;exports.compressArtifact=Mt;exports.compressGzip=it;exports.createBacktrack=Nt;exports.createFlightRecorder=Nt;exports.decompressArtifact=Gt;exports.decompressGzip=J;exports.generateIncidentId=tt;exports.getOrCreateSessionContext=Bt;exports.globToRegex=Ht;exports.isGzip=Ct;exports.matchesSensitiveRoute=_t;exports.readLimitedStream=nt;exports.readResponseBytes=Wt;exports.redactSensitiveString=D;exports.resetSessionContext=Xt;exports.sanitizeAndSerialize=ct;exports.sanitizeHeaders=V;exports.sanitizePayloadString=G;exports.sanitizeUrl=X;exports.sliceReplayEventsForWindow=Vt;exports.sliceReplayEventsWithMetadata=at;exports.uploadArtifactToGist=rt;
|
|
1802
|
-
//# sourceMappingURL=index.cjs.map
|
|
1801
|
+
`}updateDomValues(){var i,a;if(!this.shadow)return;const t=this.shadow.querySelector(".backtrack-panel");if(this.isOpen&&!t){this.render();return}if(!this.isOpen&&t){this.render();return}const e=((i=this.health)==null?void 0:i.state)==="recording"?"backtrack-status-recording":((a=this.health)==null?void 0:a.state)==="degraded"?"backtrack-status-degraded":"backtrack-status-idle",r=this.shadow.querySelector(".backtrack-launcher-status-dot");r&&(r.className=`backtrack-launcher-status-dot ${e}`);const n=this.shadow.getElementById("btn-launcher");if(n){let s=n.querySelector(".backtrack-incident-badge-count");this.incidents.length>0?(s||(s=document.createElement("span"),s.className="backtrack-incident-badge-count",n.appendChild(s)),s.textContent=String(this.incidents.length)):s&&s.remove()}if(this.isOpen&&t){const s=this.shadow.getElementById("backtrack-saved-count-title");if(s&&(s.textContent=String(this.incidents.length)),!this.selectedIncidentId){const o=this.shadow.getElementById("backtrack-incident-list-container");if(o){const c=Array.from(o.querySelectorAll("[data-open-detail-id]")).map(u=>u.getAttribute("data-open-detail-id")).join(","),h=this.incidents.slice(0,8).map(u=>u.id).join(",");c!==h&&(o.innerHTML=this.renderIncidentsHtml(),this.attachIncidentListeners())}}}}attachIncidentListeners(){var t;this.shadow&&(this.shadow.querySelectorAll("[data-open-detail-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-open-detail-id");n&&(this.selectedIncidentId=n,this.render())})}),(t=this.shadow.getElementById("btn-back-to-list"))==null||t.addEventListener("click",()=>{this.selectedIncidentId=null,this.render()}),this.shadow.querySelectorAll("[data-view-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-view-id");n&&this.handleViewIncident(n)})}),this.shadow.querySelectorAll("[data-share-gist-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-share-gist-id");n&&this.handleShareGist(n)})}),this.shadow.querySelectorAll("[data-download-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-download-id");n&&this.handleDownloadIncident(n)})}),this.shadow.querySelectorAll("[data-copy-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-copy-id");n&&this.handleCopyMarkdown(n)})}),this.shadow.querySelectorAll("[data-delete-id]").forEach(e=>{e.addEventListener("click",r=>{const n=r.currentTarget.getAttribute("data-delete-id");n&&this.handleDeleteIncident(n)})}))}attachLauncherListeners(t){if(t.dataset.hasListeners)return;t.dataset.hasListeners="true";let e=0,r=0,n=0,i=0,a=!1;t.addEventListener("touchstart",s=>{if(s.touches.length===1&&this.container){const o=s.touches[0];e=o.clientX,r=o.clientY;const c=this.container.getBoundingClientRect();n=c.left,i=c.top,a=!1}},{passive:!0}),t.addEventListener("touchmove",s=>{if(s.touches.length===1&&this.container){const o=s.touches[0],c=o.clientX-e,h=o.clientY-r;(Math.abs(c)>5||Math.abs(h)>5)&&(a=!0,this.container.style.left=`${n+c}px`,this.container.style.top=`${i+h}px`,this.container.style.bottom="auto",this.container.style.right="auto")}},{passive:!0}),t.addEventListener("touchend",()=>{a&&(this.wasDragged=!0,setTimeout(()=>{this.wasDragged=!1},150))}),t.addEventListener("click",s=>{if(this.wasDragged){s.preventDefault(),s.stopPropagation();return}this.toggleOpen()})}attachPanelListeners(){var e,r,n,i,a,s,o,c,h,u,p,g,b,f,m,k,I,y,w,E,C,M,T,A,_;if(!this.shadow)return;(e=this.shadow.getElementById("btn-close"))==null||e.addEventListener("click",()=>{this.toggleOpen()}),(r=this.shadow.getElementById("btn-dismiss-banner"))==null||r.addEventListener("click",()=>{this.dismissBanner()}),(n=this.shadow.getElementById("btn-header-menu"))==null||n.addEventListener("click",B=>{B.stopPropagation(),this.isHeaderMenuOpen=!this.isHeaderMenuOpen,this.render()}),(i=this.shadow.getElementById("btn-hide-widget"))==null||i.addEventListener("click",B=>{B.stopPropagation(),this.isHeaderMenuOpen=!1,this.showHideConfirmModal=!0,this.render()}),(a=this.shadow.getElementById("btn-duration-60"))==null||a.addEventListener("click",()=>{this.selectedDurationSeconds=60,this.isCustomDuration=!1,this.render()}),(s=this.shadow.getElementById("btn-duration-300"))==null||s.addEventListener("click",()=>{this.selectedDurationSeconds=300,this.isCustomDuration=!1,this.render()}),(o=this.shadow.getElementById("btn-duration-all"))==null||o.addEventListener("click",()=>{this.selectedDurationSeconds=0,this.isCustomDuration=!1,this.render()}),(c=this.shadow.getElementById("btn-duration-custom"))==null||c.addEventListener("click",()=>{this.isCustomDuration=!0,this.render()});const t=this.shadow.getElementById("input-custom-duration");t&&(t.addEventListener("input",B=>{const P=parseInt(B.target.value,10);isNaN(P)||(this.selectedDurationSeconds=Math.max(5,Math.min(900,P)))}),t.addEventListener("change",B=>{const P=parseInt(B.target.value,10),W=isNaN(P)?60:Math.max(5,Math.min(900,P));this.selectedDurationSeconds=W,t.value=String(W)})),(h=this.shadow.getElementById("btn-save"))==null||h.addEventListener("click",()=>{this.handleCapture()}),(u=this.shadow.getElementById("btn-annotate"))==null||u.addEventListener("click",()=>{this.handleAnnotate()}),(p=this.shadow.getElementById("btn-clear"))==null||p.addEventListener("click",()=>{this.handleClear()}),this.attachIncidentListeners(),this.exportModalIncidentId&&((g=this.shadow.getElementById("btn-close-export-modal"))==null||g.addEventListener("click",()=>{this.closeExportModal()}),(b=this.shadow.getElementById("btn-cancel-export-modal"))==null||b.addEventListener("click",()=>{this.closeExportModal()}),(f=this.shadow.getElementById("check-include-incident-link"))==null||f.addEventListener("change",B=>{this.exportModalIncludeLink=B.target.checked,this.render()}),(m=this.shadow.getElementById("btn-confirm-export-modal"))==null||m.addEventListener("click",()=>{this.confirmCopyMarkdown()})),this.downloadModalIncidentId&&((k=this.shadow.getElementById("btn-close-download-modal"))==null||k.addEventListener("click",()=>{this.closeDownloadModal()}),(I=this.shadow.getElementById("btn-cancel-download-modal"))==null||I.addEventListener("click",()=>{this.closeDownloadModal()}),(y=this.shadow.getElementById("radio-format-ai"))==null||y.addEventListener("change",()=>{this.downloadModalFormat="ai",this.downloadModalError=null,this.render()}),(w=this.shadow.getElementById("radio-format-gzip"))==null||w.addEventListener("change",()=>{this.downloadModalFormat="gzip",this.downloadModalError=null,this.render()}),(E=this.shadow.getElementById("radio-format-uncompressed"))==null||E.addEventListener("change",()=>{this.downloadModalFormat="uncompressed",this.downloadModalError=null,this.render()}),(C=this.shadow.getElementById("btn-confirm-download-modal"))==null||C.addEventListener("click",()=>{this.confirmDownload()})),this.showHideConfirmModal&&((M=this.shadow.getElementById("btn-close-hide-modal"))==null||M.addEventListener("click",()=>{this.showHideConfirmModal=!1,this.render()}),(T=this.shadow.getElementById("btn-cancel-hide-modal"))==null||T.addEventListener("click",()=>{this.showHideConfirmModal=!1,this.render()}),(A=this.shadow.getElementById("btn-confirm-hide-modal"))==null||A.addEventListener("click",()=>{this.showHideConfirmModal=!1,this.hide()})),(_=this.shadow.querySelector(".backtrack-panel"))==null||_.addEventListener("click",B=>{if(this.isHeaderMenuOpen){const P=B.target;P!=null&&P.closest(".backtrack-header-menu-wrap")||(this.isHeaderMenuOpen=!1,this.render())}})}};l(O,"sessionGithubToken",null);let Q=O;const vt="0.5.3",v=class v{constructor(t,e){l(this,"options");l(this,"stateMachine");l(this,"db");l(this,"writer",null);l(this,"retention");l(this,"incidentManager",null);l(this,"widget",null);l(this,"consoleCapturer",null);l(this,"errorCapturer",null);l(this,"networkCapturer",null);l(this,"navigationCapturer",null);l(this,"rrwebCapturer",null);l(this,"performanceCapturer",null);l(this,"sequence",0);l(this,"retentionIntervalTimer",null);l(this,"retentionPromise",null);l(this,"cachedStorageBytes",0);l(this,"cachedIncidentCount",0);l(this,"pageHideHandler");l(this,"beforeUnloadHandler");l(this,"visibilityChangeHandler");l(this,"cachedProtectedBytes",0);l(this,"cachedBrowserEstimateBytes");l(this,"cachedBrowserQuotaBytes");l(this,"nextSequence",()=>(this.sequence++,this.sequence));l(this,"stoppingPromise");var r,n,i,a,s,o,c,h,u,p,g;this.options={bufferMinutes:(t==null?void 0:t.bufferMinutes)??5,afterErrorSeconds:(t==null?void 0:t.afterErrorSeconds)??15,maxStorageMb:(t==null?void 0:t.maxStorageMb)??50,captureHttpStatus:(t==null?void 0:t.captureHttpStatus)??[500,502,503,504],showWidget:(t==null?void 0:t.showWidget)??!1,widgetOptions:t==null?void 0:t.widgetOptions,metadata:t==null?void 0:t.metadata,recorderVersion:t==null?void 0:t.recorderVersion,ignoredUrls:t==null?void 0:t.ignoredUrls,network:{capturePayloads:((r=t==null?void 0:t.network)==null?void 0:r.capturePayloads)??!1,maxPayloadSize:((n=t==null?void 0:t.network)==null?void 0:n.maxPayloadSize)??64*1024},privacy:{maskAllInputs:((i=t==null?void 0:t.privacy)==null?void 0:i.maskAllInputs)??!0,maskAllText:((a=t==null?void 0:t.privacy)==null?void 0:a.maskAllText)??!1,blockMedia:((s=t==null?void 0:t.privacy)==null?void 0:s.blockMedia)??!0,blockSelector:(o=t==null?void 0:t.privacy)==null?void 0:o.blockSelector,maskTextSelector:(c=t==null?void 0:t.privacy)==null?void 0:c.maskTextSelector,sanitizeUrl:(h=t==null?void 0:t.privacy)==null?void 0:h.sanitizeUrl,sensitiveRoutes:(u=t==null?void 0:t.privacy)==null?void 0:u.sensitiveRoutes,autoMaskPII:(p=t==null?void 0:t.privacy)==null?void 0:p.autoMaskPII,recordCanvas:(g=t==null?void 0:t.privacy)==null?void 0:g.recordCanvas},storage:t==null?void 0:t.storage,sessionOptions:t==null?void 0:t.sessionOptions,batchWriterConfig:t==null?void 0:t.batchWriterConfig,transport:t==null?void 0:t.transport,beforeSend:t==null?void 0:t.beforeSend,context:t==null?void 0:t.context,getContext:t==null?void 0:t.getContext},this.stateMachine=new xt("stopped"),this.db=e||new St,this.retention=new At(this.db,{bufferMinutes:this.options.bufferMinutes,maxStorageMb:this.options.maxStorageMb})}static async init(t,e){if(v.activeInstance)return v.activeInstance;const r=new v(t,e);if(await r.start(),v.activeInstance=r,typeof window<"u"){const n=window;n.Backtrack=v,n.flightRecorder=r,n.hideBacktrack=()=>v.hideWidget(),n.showBacktrack=()=>v.showWidget(),n.toggleBacktrack=()=>v.toggleWidget()}return r}static hideWidget(){const t=v.activeInstance;if(t!=null&&t.widget)t.widget.hide();else try{if(typeof localStorage<"u"&&localStorage.setItem("backtrack_widget_hidden","true"),typeof document<"u"){const e=document.getElementById("__backtrack_widget_host__");e&&(e.style.display="none")}}catch{}}static showWidget(){const t=v.activeInstance;if(t!=null&&t.widget)t.widget.show();else try{if(typeof localStorage<"u"&&localStorage.removeItem("backtrack_widget_hidden"),typeof document<"u"){const e=document.getElementById("__backtrack_widget_host__");e&&(e.style.display="")}}catch{}}static toggleWidget(){const t=v.activeInstance;return t!=null&&t.widget?t.widget.toggle():typeof localStorage<"u"&&localStorage.getItem("backtrack_widget_hidden")==="true"?(v.showWidget(),!0):(v.hideWidget(),!1)}static hide(){v.hideWidget()}static show(){v.showWidget()}static toggle(){return v.toggleWidget()}static async resetInstance(){v.activeInstance&&(await v.activeInstance.stop(),v.activeInstance=null)}static getInstance(){return v.activeInstance}hideWidget(){this.widget?this.widget.hide():v.hideWidget()}showWidget(){this.widget?this.widget.show():v.showWidget()}toggleWidget(){return this.widget?this.widget.toggle():v.toggleWidget()}getEnvironmentMetadata(){const t=this.options.metadata;if(typeof window>"u")return{url:"http://localhost",userAgent:"node",viewport:{width:1280,height:720},...t};const e=window;return{url:window.location.href,userAgent:window.navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},appVersion:(t==null?void 0:t.appVersion)??e.__APP_VERSION__??e.__UTICKET_APP_VERSION__,gitBranch:(t==null?void 0:t.gitBranch)??e.__GIT_BRANCH__??e.__UTICKET_GIT_BRANCH__,gitCommit:(t==null?void 0:t.gitCommit)??e.__GIT_COMMIT__??e.__UTICKET_GIT_COMMIT__,...t}}async start(){var t,e,r,n;if(!this.stateMachine.isRecording())try{await this.db.open();const i=await Rt({...this.options.sessionOptions,...this.options.storage?{storage:this.options.storage}:{}}),a=await this.db.getChunksBySession(i.sessionId),s=Math.max(0,...a.flatMap(c=>(c.timeline||[]).map(h=>h.sequence))),o=Math.max(0,...a.map(c=>c.sequence));this.sequence=s,this.writer=new Tt(this.db,i.sessionId,i.tabId,{...this.options.batchWriterConfig,initialChunkSequence:o},c=>{var u;c instanceof Error&&(c.name==="QuotaExceededError"||((u=c.message)==null?void 0:u.includes("QuotaExceededError")))||typeof DOMException<"u"&&c instanceof DOMException&&c.name==="QuotaExceededError"?this.handleQuotaExceeded():this.stateMachine.transition({type:"DEGRADE",reason:"Falha ao persistir um lote; a gravação pode estar incompleta."})}),this.writer.setOnChunkPersisted(()=>{this.scheduleRetention()}),this.incidentManager=new et(this.db,i.sessionId,i.tabId,()=>this.getEnvironmentMetadata(),{afterErrorSeconds:this.options.afterErrorSeconds,recorderVersion:this.options.recorderVersion??vt,context:this.options.context,getContext:this.options.getContext,getRecordingIssues:()=>{var c;return[...this.stateMachine.getDegradedReasons(),...(((c=this.rrwebCapturer)==null?void 0:c.getDroppedEventsCount())??0)>0?["O capturador não conseguiu registrar parte do replay."]:[]]},getDroppedEventsCount:()=>{var c;return((c=this.rrwebCapturer)==null?void 0:c.getDroppedEventsCount())??0}}),this.incidentManager.setOnIncidentPending(()=>{this.stateMachine.transition({type:"TRIGGER_AUTO"})}),this.incidentManager.setOnIncidentFinalized(c=>{var h;(h=this.incidentManager)!=null&&h.getPendingIncident()||this.stateMachine.transition({type:"FINALIZE_INCIDENT"}),this.updateStatsCache(),this.sendIncident(c.id)}),this.incidentManager.setOnError(c=>{var u;c instanceof Error&&(c.name==="QuotaExceededError"||((u=c.message)==null?void 0:u.includes("QuotaExceededError")))||typeof DOMException<"u"&&c instanceof DOMException&&c.name==="QuotaExceededError"?this.handleQuotaExceeded():this.stateMachine.transition({type:"DEGRADE",reason:"Falha no gerenciamento de incidentes; o incidente pode não ter sido salvo completamente."})}),this.incidentManager.setBeforeFinalize(async()=>{this.writer&&await this.writer.flush()}),await this.incidentManager.init(),this.consoleCapturer=new Dt(this.writer,this.nextSequence),this.errorCapturer=new Lt(this.writer,this.incidentManager,this.nextSequence),this.networkCapturer=new zt(this.writer,this.incidentManager,this.nextSequence,{captureHttpStatus:this.options.captureHttpStatus,ignoredUrls:this.options.ignoredUrls,sanitizeUrlCallback:(t=this.options.privacy)==null?void 0:t.sanitizeUrl,capturePayloads:(e=this.options.network)==null?void 0:e.capturePayloads,maxPayloadSize:(r=this.options.network)==null?void 0:r.maxPayloadSize}),this.navigationCapturer=new Pt(this.writer,this.nextSequence,{sanitizeUrlCallback:(n=this.options.privacy)==null?void 0:n.sanitizeUrl}),this.rrwebCapturer=new $t(this.writer,{privacy:this.options.privacy}),this.performanceCapturer=new Ot(this.writer,this.nextSequence),this.consoleCapturer.start(),this.errorCapturer.start(),this.networkCapturer.start(),this.navigationCapturer.start(),this.rrwebCapturer.start(),this.performanceCapturer.start(),this.stateMachine.transition({type:"START"}),this.incidentManager.getPendingIncident()&&this.stateMachine.transition({type:"TRIGGER_AUTO"}),this.retentionIntervalTimer=setInterval(()=>{this.scheduleRetention()},3e4),this.updateStatsCache(),this.options.showWidget&&typeof window<"u"&&(this.widget=new Q(this,this.options.widgetOptions),this.widget.mount()),typeof window<"u"&&typeof window.addEventListener=="function"&&(this.pageHideHandler=()=>{var c;(c=this.incidentManager)==null||c.syncPendingIncidentDroppedEvents().catch(()=>{})},this.beforeUnloadHandler=()=>{var c;(c=this.incidentManager)==null||c.syncPendingIncidentDroppedEvents().catch(()=>{})},window.addEventListener("pagehide",this.pageHideHandler),window.addEventListener("beforeunload",this.beforeUnloadHandler)),typeof document<"u"&&typeof document.addEventListener=="function"&&(this.visibilityChangeHandler=()=>{var c;document.visibilityState==="hidden"&&((c=this.incidentManager)==null||c.syncPendingIncidentDroppedEvents().catch(()=>{}))},document.addEventListener("visibilitychange",this.visibilityChangeHandler))}catch(i){this.stateMachine.transition({type:"DEGRADE",reason:`Falha ao iniciar recorder: ${i instanceof Error?i.message:String(i)}`})}}scheduleRetention(){return this.retentionPromise?this.retentionPromise:(this.retentionPromise=(async()=>{try{this.incidentManager?await this.incidentManager.runExclusive(async()=>{var t;await((t=this.incidentManager)==null?void 0:t.protectSessionChunks()),await this.retention.prune(),await this.updateStatsCache()}):(await this.retention.prune(),await this.updateStatsCache())}catch{this.stateMachine.transition({type:"DEGRADE",reason:"Falha na manutenção do armazenamento local."})}finally{this.retentionPromise=null}})(),this.retentionPromise)}async handleQuotaExceeded(){try{this.incidentManager?await this.incidentManager.runExclusive(async()=>{var n;await((n=this.incidentManager)==null?void 0:n.protectSessionChunks()),await this.retention.emergencyPrune(),await this.updateStatsCache()}):(await this.retention.emergencyPrune(),await this.updateStatsCache())}catch{}const t=await this.retention.getStorageBreakdown().catch(()=>null),r=(t?t.bufferBytes===0&&t.protectedBytes>0:!1)||t!=null&&t.protectedExceedsLimit?"A quota do navegador foi excedida. Apenas conteúdo protegido permanece salvo; é necessário excluir incidentes ou limpar gravações para liberar espaço.":"A quota do navegador impediu a gravação de um lote. Um prune emergencial de dados não protegidos foi executado.";this.stateMachine.transition({type:"DEGRADE",reason:r})}async updateStatsCache(){try{const t=await this.retention.getStorageBreakdown();if(this.cachedStorageBytes=t.totalBytes,this.cachedProtectedBytes=t.protectedBytes,this.cachedIncidentCount=t.incidentCount,typeof navigator<"u"&&navigator.storage&&typeof navigator.storage.estimate=="function")try{const e=await navigator.storage.estimate();this.cachedBrowserEstimateBytes=e.usage,this.cachedBrowserQuotaBytes=e.quota}catch{}if(t.protectedExceedsLimit)this.stateMachine.transition({type:"DEGRADE",reason:"O armazenamento protegido por incidentes excede o limite configurado (maxStorageMb)."});else if(!t.isOverLimit&&this.stateMachine.isDegraded()){const e=this.stateMachine.getDegradedReasons();e.every(n=>n.includes("maxStorageMb")||n.includes("quota")||n.includes("Quota")||n.includes("armazenamento"))&&e.length>0&&this.stateMachine.transition({type:"RECOVER"})}}catch{}}async sendIncident(t){const e=this.options.transport;if(e)try{const r=await this.getArtifact(t),n=this.options.beforeSend?await this.options.beforeSend(r):r;n&&await e.send(n)}catch{}}stopCapturers(){var t,e,r,n,i,a;(t=this.rrwebCapturer)==null||t.stop(),(e=this.navigationCapturer)==null||e.stop(),(r=this.networkCapturer)==null||r.stop(),(n=this.errorCapturer)==null||n.stop(),(i=this.consoleCapturer)==null||i.stop(),(a=this.performanceCapturer)==null||a.stop()}clearRuntimeReferences(){this.rrwebCapturer=null,this.navigationCapturer=null,this.networkCapturer=null,this.errorCapturer=null,this.consoleCapturer=null,this.performanceCapturer=null,this.writer=null,this.incidentManager=null}async stop(){if(this.stateMachine.getState()!=="stopped"){if(this.stoppingPromise)return this.stoppingPromise;this.stoppingPromise=(async()=>{var t;if(this.stopCapturers(),this.retentionIntervalTimer&&(clearInterval(this.retentionIntervalTimer),this.retentionIntervalTimer=null),this.widget&&(this.widget.unmount(),this.widget=null),v.activeInstance===this&&(v.activeInstance=null),this.retentionPromise)try{await this.retentionPromise}catch{}typeof window<"u"&&typeof window.removeEventListener=="function"&&(this.pageHideHandler&&(window.removeEventListener("pagehide",this.pageHideHandler),this.pageHideHandler=void 0),this.beforeUnloadHandler&&(window.removeEventListener("beforeunload",this.beforeUnloadHandler),this.beforeUnloadHandler=void 0)),typeof document<"u"&&typeof document.removeEventListener=="function"&&this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0),this.writer&&await this.writer.flush(),(t=this.writer)==null||t.destroy(),this.incidentManager&&(await this.incidentManager.syncPendingIncidentDroppedEvents().catch(()=>{}),await this.incidentManager.destroy()),Z(),this.clearRuntimeReferences(),this.stateMachine.transition({type:"STOP"})})();try{await this.stoppingPromise}finally{this.stoppingPromise=void 0}}}async capture(t="manual",e,r){if(!this.incidentManager||!this.writer)throw new Error("FlightRecorder não está em execução.");const n=await this.incidentManager.runExclusive(async()=>{const i=Date.now();return this.writer.addTimelineEvent({id:`marker_manual_${i}`,timestamp:i,sequence:this.nextSequence(),type:"marker",label:`Captura manual: ${t}`}),await this.writer.flush(),this.incidentManager.executeManualTrigger({id:`trig_manual_${i}`,timestamp:i,type:"manual",signature:`manual_capture_${t}`,detail:{userReason:t,windowSeconds:e,annotationImage:r==null?void 0:r.annotationImage,notes:r==null?void 0:r.notes,annotations:r==null?void 0:r.annotations}},e)});return await this.updateStatsCache(),n}captureException(t,e){if(this.errorCapturer)try{return this.errorCapturer.captureException(t,e)}catch{}}async listIncidents(){try{return await this.db.listIncidents()}catch{return[]}}async getArtifact(t){return this.incidentManager?this.incidentManager.exportArtifact(t):new et(this.db,"","",()=>this.getEnvironmentMetadata(),{recorderVersion:this.options.recorderVersion??vt,context:this.options.context,getContext:this.options.getContext,getRecordingIssues:()=>this.stateMachine.getDegradedReasons()}).exportArtifact(t)}async exportIncident(t,e){const r=await this.getArtifact(t),n=new Date(r.incident.triggeredAt).toISOString().replace(/:/g,"-").replace(/\..+/,""),i=(e==null?void 0:e.aiOptimized)??!1,a=!i&&((e==null?void 0:e.compress)??!1),s=i?".ai.json":a?".ffr.json.gz":".ffr.json",o=`flight-recorder-${n}-${r.incident.reason}-${t}${s}`,c=i?{...r,replay:[],_aiNote:"Replay visual removido para otimizacao de IA. Timeline, erros de console e rede preservados."}:r;if(typeof window<"u"&&typeof document<"u"){let h;if(a){const g=await Mt(r);h=new Blob([g],{type:"application/gzip"})}else{const g=JSON.stringify(c,null,2);h=new Blob([g],{type:"application/json;charset=utf-8"})}const u=URL.createObjectURL(h),p=document.createElement("a");p.href=u,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}return c}async deleteIncident(t){this.incidentManager?(await this.incidentManager.deleteIncident(t),await this.incidentManager.runExclusive(async()=>{await this.retention.prune(),await this.updateStatsCache()})):(await this.db.deleteIncident(t),await this.retention.prune(),await this.updateStatsCache())}async clear(){if(this.writer&&await this.writer.flush(),this.retentionPromise)try{await this.retentionPromise}catch{}this.incidentManager&&await this.incidentManager.reset(),this.stateMachine.getState()==="incident_pending"&&this.stateMachine.transition({type:"FINALIZE_INCIDENT"}),await this.db.clearAll(),this.cachedStorageBytes=0,this.cachedProtectedBytes=0,this.cachedIncidentCount=0}getHealth(){var r,n;const t=((r=this.rrwebCapturer)==null?void 0:r.getDroppedEventsCount())??0,e=(this.options.maxStorageMb??50)*1024*1024;return{state:this.stateMachine.getState(),droppedEvents:t,storageBytes:this.cachedStorageBytes,protectedStorageBytes:this.cachedProtectedBytes,storageLimitBytes:e,storageLimitExceeded:this.cachedStorageBytes>e,protectedStorageExceeded:this.cachedProtectedBytes>e,browserStorageEstimateBytes:this.cachedBrowserEstimateBytes,browserStorageQuotaBytes:this.cachedBrowserQuotaBytes,pendingWrites:((n=this.writer)==null?void 0:n.getPendingWrites())??0,incidentCount:this.cachedIncidentCount,reasons:this.stateMachine.getDegradedReasons()}}getSequence(){return this.sequence}async flush(){this.writer&&await this.writer.flush()}async destroy(){await this.stop()}};l(v,"activeInstance",null);let U=v;function Nt(d){return new U(d)}exports.formatIncidentMarkdown=q.formatIncidentMarkdown;exports.getUtf8ByteLength=q.getUtf8ByteLength;exports.isReplayEvent=q.isReplayEvent;exports.isValidAnnotationImage=q.isValidAnnotationImage;exports.sortTimelineEvents=q.sortTimelineEvents;exports.validateFlightRecorderArtifact=q.validateFlightRecorderArtifact;exports.Backtrack=U;exports.BacktrackImpl=U;exports.BacktrackWidget=Q;exports.BatchWriter=Tt;exports.ConsoleCapturer=Dt;exports.DB_NAME=It;exports.DB_VERSION=Et;exports.ErrorCapturer=Lt;exports.FlightRecorderDB=St;exports.FlightRecorderImpl=U;exports.IncidentManager=et;exports.MAX_ARTIFACT_BYTES=Y;exports.NavigationCapturer=Pt;exports.NetworkCapturer=zt;exports.PerformanceCapturer=Ot;exports.RecorderStateMachine=xt;exports.RetentionEngine=At;exports.RrwebCapturer=$t;exports.STORE_CHUNKS=S;exports.STORE_INCIDENTS=R;exports.STORE_SESSIONS=$;exports.ScreenAnnotator=qt;exports.claimSessionContext=Rt;exports.closeSessionChannel=Z;exports.compressArtifact=Mt;exports.compressGzip=it;exports.createBacktrack=Nt;exports.createFlightRecorder=Nt;exports.decompressArtifact=Gt;exports.decompressGzip=J;exports.generateIncidentId=tt;exports.getOrCreateSessionContext=Bt;exports.globToRegex=Ht;exports.isGzip=Ct;exports.matchesSensitiveRoute=_t;exports.readLimitedStream=nt;exports.readResponseBytes=Wt;exports.redactSensitiveString=D;exports.resetSessionContext=Xt;exports.sanitizeAndSerialize=ct;exports.sanitizeHeaders=V;exports.sanitizePayloadString=G;exports.sanitizeUrl=X;exports.sliceReplayEventsForWindow=Vt;exports.sliceReplayEventsWithMetadata=at;exports.uploadArtifactToGist=rt;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,3 @@ import { FlightRecorderImpl, createFlightRecorder } from './core/flight-recorder
|
|
|
14
14
|
import type { FlightRecorder, FlightRecorderOptions } from './types/options';
|
|
15
15
|
export { FlightRecorderImpl as Backtrack, FlightRecorderImpl as BacktrackImpl, createFlightRecorder as createBacktrack };
|
|
16
16
|
export type { FlightRecorder as BacktrackRecorder, FlightRecorderOptions as BacktrackOptions };
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -4935,7 +4935,7 @@ const ae = `
|
|
|
4935
4935
|
};
|
|
4936
4936
|
l($, "sessionGithubToken", null);
|
|
4937
4937
|
let J = $;
|
|
4938
|
-
const ft = "0.5.
|
|
4938
|
+
const ft = "0.5.3", v = class v {
|
|
4939
4939
|
constructor(t, e) {
|
|
4940
4940
|
l(this, "options");
|
|
4941
4941
|
l(this, "stateMachine");
|
|
@@ -5462,4 +5462,3 @@ export {
|
|
|
5462
5462
|
gt as uploadArtifactToGist,
|
|
5463
5463
|
It as validateFlightRecorderArtifact
|
|
5464
5464
|
};
|
|
5465
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -6,4 +6,3 @@
|
|
|
6
6
|
`))d.trimStart().startsWith("````")?F?(F.push(d),V.push(F.join(`
|
|
7
7
|
`)),F=null):F=[d]:F?F.push(d):V.push(d);const z=[];let Y=0;for(const d of V){const g=q(d)+(z.length?1:0);Y+g<=ue&&(z.push(d),Y+=g)}return z.join(`
|
|
8
8
|
`)+K}exports.formatIncidentMarkdown=Ce;exports.getUtf8ByteLength=q;exports.isReplayEvent=re;exports.isValidAnnotationImage=se;exports.sortTimelineEvents=ve;exports.validateFlightRecorderArtifact=fe;
|
|
9
|
-
//# sourceMappingURL=markdown-Ao5Ah9MF.cjs.map
|
package/dist/storage/db.d.ts
CHANGED
package/dist/storage/index.d.ts
CHANGED
|
@@ -29,4 +29,3 @@ export declare function claimSessionContext(options?: ClaimSessionOptions): Prom
|
|
|
29
29
|
* Força a renovação da sessão (útil para testes ou reinicialização explícita).
|
|
30
30
|
*/
|
|
31
31
|
export declare function resetSessionContext(storage?: Storage): SessionContext;
|
|
32
|
-
//# sourceMappingURL=session.d.ts.map
|
package/dist/types/artifact.d.ts
CHANGED
package/dist/types/chunk.d.ts
CHANGED
package/dist/types/health.d.ts
CHANGED
package/dist/types/incident.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
package/dist/types/options.d.ts
CHANGED
package/dist/types/timeline.d.ts
CHANGED
|
@@ -72,4 +72,3 @@ export interface PerformanceTimelineEvent extends TimelineEventBase {
|
|
|
72
72
|
details?: string;
|
|
73
73
|
}
|
|
74
74
|
export type TimelineEvent = ConsoleTimelineEvent | ErrorTimelineEvent | NetworkTimelineEvent | NavigationTimelineEvent | MarkerTimelineEvent | PerformanceTimelineEvent;
|
|
75
|
-
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -3,4 +3,3 @@ export interface BacktrackTransport {
|
|
|
3
3
|
send(artifact: FlightRecorderArtifact): Promise<void>;
|
|
4
4
|
}
|
|
5
5
|
export type BeforeSend = (artifact: FlightRecorderArtifact) => FlightRecorderArtifact | null | Promise<FlightRecorderArtifact | null>;
|
|
6
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -25,4 +25,3 @@ export declare function compressArtifact(artifact: FlightRecorderArtifact): Prom
|
|
|
25
25
|
* Suporta transparentemente tanto arquivos compactados (.gz) quanto JSON comum.
|
|
26
26
|
*/
|
|
27
27
|
export declare function decompressArtifact(data: ArrayBuffer | Uint8Array | string | unknown, limit?: number): Promise<FlightRecorderArtifact>;
|
|
28
|
-
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -9,4 +9,3 @@ export interface GistUploadResult {
|
|
|
9
9
|
* Requer um Personal Access Token com o escopo 'gist'.
|
|
10
10
|
*/
|
|
11
11
|
export declare function uploadArtifactToGist(artifact: FlightRecorderArtifact, githubToken: string): Promise<GistUploadResult>;
|
|
12
|
-
//# sourceMappingURL=gist-uploader.d.ts.map
|
package/dist/utils/markdown.d.ts
CHANGED
|
@@ -17,4 +17,3 @@ export declare function getUtf8ByteLength(str: string): number;
|
|
|
17
17
|
* Compatível com navegador e Node.js, com limite rigoroso de tamanho e referências auditáveis.
|
|
18
18
|
*/
|
|
19
19
|
export declare function formatIncidentMarkdown(artifact: FlightRecorderArtifact, options?: MarkdownFormatOptions): string;
|
|
20
|
-
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -24,4 +24,3 @@ export declare function validateFlightRecorderArtifact(input: unknown): Validati
|
|
|
24
24
|
* Ordena eventos da timeline por timestamp crescente e sequence crescente.
|
|
25
25
|
*/
|
|
26
26
|
export declare function sortTimelineEvents(events: TimelineEvent[]): TimelineEvent[];
|
|
27
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -53,7 +53,7 @@ Error generating stack: `+i.message+`
|
|
|
53
53
|
> ⚠️ **Aviso:** O relatório atingiu o limite de ${Math.round(n/1024)} KiB em UTF-8 e foi resumido para respeitar o orçamento.`,z=n-xi(T),O=[];let G=null;for(const B of b.markdown.split(`
|
|
54
54
|
`))B.trimStart().startsWith("````")?G?(G.push(B),O.push(G.join(`
|
|
55
55
|
`)),G=null):G=[B]:G?G.push(B):O.push(B);const q=[];let R=0;for(const B of O){const I=xi(B)+(q.length?1:0);R+I<=z&&(q.push(B),R+=I)}return q.join(`
|
|
56
|
-
`)+T}async function km(e,t){if(!t||!t.trim())throw new Error('GitHub Token não fornecido. Gere um token com o escopo "gist".');const n=t.trim(),i=`backtrack-${e.incident.id}.ffr.json`,l=`Backtrack Incident Replay [${e.incident.id}]: ${e.incident.reason}`,a=JSON.stringify(e,null,2);if(new TextEncoder().encode(a).length>10*1024*1024)throw new Error("O artefato excede o limite máximo de 10 MB suportado para upload.");const r={description:l,public:!1,files:{[i]:{content:a}}},o=await fetch("https://api.github.com/gists",{method:"POST",headers:{Authorization:`Bearer ${n}`,Accept:"application/vnd.github+json","Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let h="";try{const c=await o.json();h=c.message||JSON.stringify(c)}catch{h=o.statusText}throw o.status===401?new Error(`Falha de autenticação no GitHub (401). Verifique se o seu token possui o escopo 'gist': ${h}`):o.status===422?new Error(`O arquivo excede o limite suportado pelo GitHub Gist (10MB): ${h}`):new Error(`Erro ao criar Gist no GitHub (${o.status}): ${h}`)}const f=await o.json(),u=f.files&&(f.files[i]||Object.values(f.files)[0]);return{gistId:f.id,gistUrl:f.html_url,rawUrl:(u==null?void 0:u.raw_url)||f.html_url}}const dw="0.5.2",Wo={version:dw};let Zi=null;const Hm=10*1024*1024,hw=({artifact:e,onReset:t})=>{var kt;const{incident:n,environment:i,diagnostics:l,recorderVersion:a}=e,[s,r]=L.useState(!1),[o,f]=L.useState(!1),[u,h]=L.useState(!1),[c,d]=L.useState(!1),[m,y]=L.useState(!1),[w,v]=L.useState(!1),p=L.useRef(null),x=L.useRef(null);L.useEffect(()=>{if(!w)return;const Y=p.current;return Y==null||Y.showModal(),()=>{var le;Y==null||Y.close(),(le=x.current)==null||le.focus()}},[w]);const[b,S]=L.useState(()=>{if(typeof window<"u"&&window.location.search){const le=new URLSearchParams(window.location.search).get("gist");if(le){const me=Math.floor(Math.max(0,(n.triggeredAt||n.finalizedAt)-n.startedAt)/1e3);return`${window.location.origin}/?gist=${le}${me>0?`&t=${me}`:""}`}}return null}),[N,C]=L.useState(!1),[T,z]=L.useState(!1),[O,G]=L.useState(null),[q,R]=L.useState(""),[B,I]=L.useState(!1),[_,A]=L.useState(!1),[j,Q]=L.useState(null),[F,E]=L.useState(null),[k,M]=L.useState(!1),[J,re]=L.useState(!1),[$,H]=L.useState(null);L.useEffect(()=>{const Y=le=>{le.key==="Escape"&&(w&&!N&&v(!1),m&&!J&&y(!1),c&&d(!1))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[w,m,c,N,J]);const ae=Y=>new Date(Y).toLocaleTimeString(),Xe=Y=>{const le=Math.max(1,Math.round(Y/1e3)),me=Math.floor(le/60),ye=le%60;return`${me.toString().padStart(2,"0")}:${ye.toString().padStart(2,"0")}`},Ke=Y=>{try{return new URL(Y).host}catch{return Y}},de=()=>{try{navigator.clipboard.writeText(n.id),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},te=Y=>{try{navigator.clipboard.writeText(Y),f(!0),setTimeout(()=>f(!1),2e3)}catch{}},Ie=()=>{H(null),y(!0)},vt=async()=>{re(!0),H(null);try{let Y;if(k){const ye=typeof window<"u"?new URLSearchParams(window.location.search):null,rn=ye==null?void 0:ye.get("gist");if(rn)Y=`${window.location.origin}/?gist=${rn}`;else{if(new TextEncoder().encode(JSON.stringify(e)).byteLength>Hm)throw new Error("O artefato excede o limite máximo permitido pelo GitHub Gist (10 MB).");let V=Zi;if(!V||!V.trim()){const W=prompt('Insira seu GitHub Personal Access Token (com permissão "gist") para gerar o link compartilhado:');if(!W||!W.trim()){re(!1);return}V=W.trim(),Zi=V}const Z=await km(e,V);Y=`${window.location.origin}/?gist=${Z.gistId}`}const Zt=Math.floor(Math.max(0,(e.incident.triggeredAt||e.incident.finalizedAt)-e.incident.startedAt)/1e3);Y&&Zt>0&&!Y.includes("&t=")&&!Y.includes("?t=")&&(Y+=(Y.includes("?")?"&":"?")+`t=${Zt}`)}const le=fw(e,{replayUrl:Y});let me=!1;if(typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText)try{await navigator.clipboard.writeText(le),me=!0}catch{}if(!me&&typeof document<"u")try{const ye=document.createElement("textarea");ye.value=le,ye.style.position="fixed",ye.style.opacity="0",document.body.appendChild(ye),ye.focus(),ye.select(),me=document.execCommand("copy"),document.body.removeChild(ye)}catch{me=!1}h(!0),y(!1),setTimeout(()=>h(!1),2500)}catch(Y){const le=Y instanceof Error?Y.message:String(Y);le.includes("401")&&(Zi=null),H(le)}finally{re(!1)}},sn=async()=>{C(!0),G(null);try{if(new TextEncoder().encode(JSON.stringify(e)).byteLength>Hm)throw new Error("O artefato excede o limite máximo permitido pelo GitHub Gist (10 MB).");const le=Zi||"";if(!le&&!q.trim()){I(!0),C(!1);return}const me=q.trim()||le;q.trim()&&(Zi=q.trim());const ye=await km(e,me),rn=Math.floor(Math.max(0,(n.triggeredAt||n.finalizedAt)-n.startedAt)/1e3),Zt=`${window.location.origin}/?gist=${ye.gistId}${rn>0?`&t=${rn}`:""}`;S(Zt),I(!1),await navigator.clipboard.writeText(Zt),z(!0),setTimeout(()=>z(!1),3e3)}catch(Y){const le=Y instanceof Error?Y.message:String(Y);le.includes("401")&&(Zi=null,I(!0)),G(le)}finally{C(!1)}},Jl=async()=>{if(b)try{await navigator.clipboard.writeText(b),z(!0),setTimeout(()=>z(!1),2500)}catch{}},he=async()=>{if(!j){E("Escolha uma opção antes de baixar");return}E(null);try{if(j==="ai"){const Y={...e,replay:[],_aiNote:"Replay visual removido para otimizacao de IA. Timeline, erros de console e rede preservados."},le=new Blob([JSON.stringify(Y,null,2)],{type:"application/json"}),me=URL.createObjectURL(le),ye=document.createElement("a");ye.href=me,ye.download=`${n.id}.ai.json`,ye.click(),URL.revokeObjectURL(me)}else if(j==="gzip")try{const Y=await nw(e),le=new Blob([Y],{type:"application/gzip"}),me=URL.createObjectURL(le),ye=document.createElement("a");ye.href=me,ye.download=`${n.id}.ffr.json.gz`,ye.click(),URL.revokeObjectURL(me)}catch{const Y=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),le=URL.createObjectURL(Y),me=document.createElement("a");me.href=le,me.download=`${n.id}.ffr.json`,me.click(),URL.revokeObjectURL(le)}else{const Y=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),le=URL.createObjectURL(Y),me=document.createElement("a");me.href=le,me.download=`${n.id}.ffr.json`,me.click(),URL.revokeObjectURL(le)}A(!0),setTimeout(()=>A(!1),2500)}catch{E("Falha ao baixar arquivo de gravação.")}};return g.jsxs("header",{className:"app-header",children:[l.degraded&&g.jsxs("div",{role:"alert",style:{padding:"12px 18px",background:"#422006",color:"#fef3c7"},children:[g.jsx("strong",{children:"Gravação incompleta"}),g.jsx("ul",{children:l.degradedReasons.map((Y,le)=>g.jsx("li",{children:Y},le))}),l.droppedEventsUnknown&&g.jsx("p",{children:"A quantidade total de eventos perdidos é desconhecida."})]}),g.jsxs("div",{className:"header-primary-band",children:[g.jsxs("div",{className:"header-brand-wrap",children:[g.jsx("span",{className:"brand-icon","aria-hidden":"true",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),g.jsx("polyline",{points:"3 3 3 8 8 8"}),g.jsx("polygon",{points:"10 8 16 12 10 16 10 8",fill:"currentColor",stroke:"none"})]})}),g.jsx("span",{className:"brand-title",children:"Backtrack JS"}),g.jsxs("span",{className:"brand-version-badge",title:a?`Visualizador v${Wo.version} (incidente gravado com v${a})`:`Backtrack JS v${Wo.version}`,children:["v",Wo.version]})]}),g.jsxs("div",{className:"header-actions",children:[n.annotationImage&&Rr(n.annotationImage)&&g.jsxs("button",{type:"button",className:"btn-secondary",onClick:()=>d(!0),style:{color:"#f59e0b",borderColor:"#f59e0b",display:"flex",alignItems:"center",gap:"6px"},title:"Ver anotação visual do QA na tela",children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M12 19l7-7 3 3-7 7-3-3z"}),g.jsx("path",{d:"M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"}),g.jsx("path",{d:"M2 2l7.586 7.586"}),g.jsx("circle",{cx:"11",cy:"11",r:"2"})]}),g.jsx("span",{children:"Anotação de Tela"})]}),g.jsxs("button",{type:"button",className:"btn-secondary",onClick:Ie,title:"Copiar Markdown para debug (ideal para IAs, Jira ou GitHub)",style:{display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),g.jsx("span",{children:u?"Copiado!":"Markdown para debug"})]}),g.jsx("button",{type:"button",className:"btn-secondary",onClick:t,"aria-label":"Carregar outro incidente",children:"Carregar outro arquivo"}),g.jsxs("button",{type:"button",className:"btn-secondary",onClick:()=>{G(null),Q(null),E(null),v(!0)},title:"Compartilhar gravação via link ou baixar arquivo",ref:x,style:{display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("circle",{cx:"18",cy:"5",r:"3"}),g.jsx("circle",{cx:"6",cy:"12",r:"3"}),g.jsx("circle",{cx:"18",cy:"19",r:"3"}),g.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),g.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),g.jsx("span",{children:"Compartilhar"})]})]})]}),m&&g.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.75)",zIndex:999999,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px"},onClick:()=>!J&&y(!1),children:g.jsxs("div",{style:{width:"100%",maxWidth:"460px",background:"#0f172a",borderRadius:"10px",border:"1px solid #334155",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5)",overflow:"hidden",display:"flex",flexDirection:"column"},onClick:Y=>Y.stopPropagation(),children:[g.jsxs("div",{style:{padding:"14px 18px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #1e293b"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#f8fafc",fontWeight:600,fontSize:"14px"},children:[g.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),g.jsx("span",{children:"Markdown para debug"})]}),g.jsx("button",{type:"button",style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"16px",cursor:"pointer",padding:"4px 8px"},onClick:()=>!J&&y(!1),"aria-label":"Fechar",children:"✕"})]}),g.jsxs("div",{style:{padding:"20px 18px",display:"flex",flexDirection:"column",gap:"14px"},children:[g.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",userSelect:"none"},children:[g.jsx("input",{type:"checkbox",checked:k,onChange:Y=>M(Y.target.checked),disabled:J,style:{marginTop:"2px",width:"16px",height:"16px",accentColor:"#2563eb",cursor:"pointer"}}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"#f1f5f9",fontSize:"13.5px",fontWeight:500},children:"Criar link externo no GitHub Gist (não listado)"}),g.jsx("div",{style:{color:"#94a3b8",fontSize:"12px",marginTop:"3px",lineHeight:"1.4"},children:"Por padrão, a cópia do Markdown é 100% local. Se marcado, enviará o artefato para um Gist não listado no GitHub e incluirá o link no relatório."})]})]}),k&&g.jsxs("div",{style:{padding:"8px 12px",background:"rgba(234, 179, 8, 0.1)",border:"1px solid rgba(234, 179, 8, 0.3)",borderRadius:"6px",color:"#fde047",fontSize:"11.5px",lineHeight:"1.4"},children:[g.jsx("strong",{children:"Aviso de privacidade:"})," O artefato poderá incluir replay visual, URLs, logs, respostas de rede, anotações e trechos do código-fonte incorporados durante a symbolication. Esses dados serão transmitidos aos servidores do GitHub como um Gist não listado."]}),$&&g.jsx("div",{style:{padding:"8px 12px",background:"rgba(239, 68, 68, 0.15)",border:"1px solid rgba(239, 68, 68, 0.3)",borderRadius:"6px",color:"#fca5a5",fontSize:"12px"},children:$})]}),g.jsxs("div",{style:{padding:"12px 18px",background:"#090d16",borderTop:"1px solid #1e293b",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[g.jsx("button",{type:"button",className:"btn-secondary",onClick:()=>y(!1),disabled:J,style:{padding:"6px 12px",fontSize:"12px"},children:"Cancelar"}),g.jsx("button",{type:"button",className:"btn-secondary",onClick:vt,disabled:J,style:{background:"#2563eb",borderColor:"#3b82f6",color:"#ffffff",fontWeight:500,padding:"6px 14px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},children:J?k?"Criando link do Gist...":"Copiando...":"Copiar Markdown para debug"})]})]})}),w&&g.jsx("dialog",{ref:p,className:"share-drawer-overlay","aria-labelledby":"share-drawer-title",onCancel:Y=>{Y.preventDefault(),N||v(!1)},onClick:()=>!N&&v(!1),children:g.jsxs("div",{className:"share-drawer",onClick:Y=>Y.stopPropagation(),children:[g.jsxs("div",{style:{padding:"14px 18px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #1e293b"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#f8fafc",fontWeight:600,fontSize:"14px"},children:[g.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("circle",{cx:"18",cy:"5",r:"3"}),g.jsx("circle",{cx:"6",cy:"12",r:"3"}),g.jsx("circle",{cx:"18",cy:"19",r:"3"}),g.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),g.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),g.jsx("span",{id:"share-drawer-title",children:"Compartilhar Incidente"})]}),g.jsx("button",{type:"button",style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"16px",cursor:"pointer",padding:"4px 8px"},onClick:()=>!N&&v(!1),"aria-label":"Fechar",children:"✕"})]}),g.jsxs("div",{className:"share-drawer-body",children:[g.jsxs("div",{className:"share-drawer-card",children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#60a5fa",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),g.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),g.jsx("strong",{style:{color:"#f8fafc",fontSize:"13px"},children:"Compartilhar via Link"})]}),g.jsx("p",{style:{margin:0,fontSize:"12px",color:"#94a3b8",lineHeight:1.4},children:"Gera um link do replay online (via GitHub Gist não listado) para qualquer pessoa com o link assistir no navegador."}),g.jsxs("div",{style:{padding:"6px 10px",background:"rgba(234, 179, 8, 0.1)",border:"1px solid rgba(234, 179, 8, 0.3)",borderRadius:"6px",color:"#fde047",fontSize:"11px",lineHeight:"1.35"},children:[g.jsx("strong",{children:"Aviso de privacidade:"})," O artefato poderá incluir replay visual, URLs, logs, respostas de rede, anotações e trechos do código-fonte incorporados durante a symbolication. Esses dados serão transmitidos aos servidores do GitHub como um Gist não listado."]}),b?g.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"4px"},children:[g.jsx("input",{type:"text",readOnly:!0,value:b,style:{flex:1,background:"#0f172a",border:"1px solid #334155",borderRadius:"6px",padding:"6px 10px",color:"#93c5fd",fontSize:"12px",fontFamily:"monospace"}}),g.jsx("button",{type:"button",className:"btn-primary",onClick:Jl,style:{padding:"6px 12px",fontSize:"12px",whiteSpace:"nowrap"},children:T?"✓ Copiado!":"Copiar Link"})]}):B?g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginTop:"4px"},children:[g.jsxs("label",{style:{fontSize:"11px",color:"#cbd5e1"},children:["GitHub Personal Access Token (classic com permissão ",g.jsx("code",{children:"gist"}),"):"]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("input",{type:"password",value:q,onChange:Y=>R(Y.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxx",style:{flex:1,background:"#0f172a",border:"1px solid #334155",borderRadius:"6px",padding:"6px 10px",color:"#f8fafc",fontSize:"12px"}}),g.jsx("button",{type:"button",className:"btn-primary",onClick:sn,disabled:N||!q.trim(),style:{padding:"6px 12px",fontSize:"12px",whiteSpace:"nowrap"},children:N?"Gerando...":"Salvar e Gerar"})]})]}):g.jsxs("button",{type:"button",className:"btn-primary",onClick:sn,disabled:N,style:{alignSelf:"flex-start",marginTop:"4px",padding:"6px 14px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),g.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),g.jsx("span",{children:N?"Gerando link online...":"Gerar e Copiar Link"})]}),O&&g.jsx("div",{style:{color:"#ef4444",fontSize:"11px",marginTop:"4px",background:"rgba(239, 68, 68, 0.1)",padding:"6px 10px",borderRadius:"4px",border:"1px solid rgba(239, 68, 68, 0.3)"},children:O})]}),g.jsxs("div",{className:"share-drawer-card",children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),g.jsx("polyline",{points:"7 10 12 15 17 10"}),g.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),g.jsx("strong",{style:{color:"#f8fafc",fontSize:"13px"},children:"Baixar Arquivo da Gravação"})]}),g.jsx("p",{style:{margin:0,fontSize:"12px",color:"#94a3b8",lineHeight:1.4},children:"Escolha o formato desejado para salvar a gravação no seu computador:"}),g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginTop:"2px"},children:[g.jsxs("label",{className:"share-format-option",onClick:()=>{Q("ai"),E(null)},children:[g.jsx("input",{type:"radio",name:"viewer-download-format",value:"ai",checked:j==="ai",onChange:()=>{Q("ai"),E(null)},style:{marginTop:"2px",cursor:"pointer",accentColor:"#2563eb"}}),g.jsxs("div",{children:[g.jsx("span",{style:{display:"block",fontSize:"12px",fontWeight:600,color:"#f1f5f9"},children:"JSON para IA (.ai.json)"}),g.jsx("p",{style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8",lineHeight:1.35},children:"Sem replay visual, otimizado para uso com IA. Ideal para Gemini e Claude."})]})]}),g.jsxs("label",{className:"share-format-option",onClick:()=>{Q("gzip"),E(null)},children:[g.jsx("input",{type:"radio",name:"viewer-download-format",value:"gzip",checked:j==="gzip",onChange:()=>{Q("gzip"),E(null)},style:{marginTop:"2px",cursor:"pointer",accentColor:"#2563eb"}}),g.jsxs("div",{children:[g.jsx("span",{style:{display:"block",fontSize:"12px",fontWeight:600,color:"#f1f5f9"},children:"Compactado Gzip (.ffr.json.gz)"}),g.jsx("p",{style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8",lineHeight:1.35},children:"Replay completo (~90% menor). Ideal para Slack, Jira e WhatsApp."})]})]}),g.jsxs("label",{className:"share-format-option",onClick:()=>{Q("uncompressed"),E(null)},children:[g.jsx("input",{type:"radio",name:"viewer-download-format",value:"uncompressed",checked:j==="uncompressed",onChange:()=>{Q("uncompressed"),E(null)},style:{marginTop:"2px",cursor:"pointer",accentColor:"#2563eb"}}),g.jsxs("div",{children:[g.jsx("span",{style:{display:"block",fontSize:"12px",fontWeight:600,color:"#f1f5f9"},children:"JSON Completo (.ffr.json)"}),g.jsx("p",{style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8",lineHeight:1.35},children:"Replay bruto descompactado (> 1 MB). Para inspeção direta."})]})]})]}),F&&g.jsx("div",{style:{color:"#fca5a5",fontSize:"11px",background:"rgba(239, 68, 68, 0.15)",padding:"6px 10px",borderRadius:"4px",border:"1px solid rgba(239, 68, 68, 0.3)"},children:F}),g.jsxs("button",{type:"button",className:"btn-secondary",onClick:he,style:{alignSelf:"flex-start",marginTop:"4px",padding:"6px 14px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),g.jsx("polyline",{points:"7 10 12 15 17 10"}),g.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),g.jsx("span",{children:_?"Download Iniciado!":"Baixar Arquivo"})]})]})]})]})}),c&&n.annotationImage&&Rr(n.annotationImage)&&g.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.85)",zIndex:999999,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px"},onClick:()=>d(!1),children:g.jsxs("div",{style:{position:"relative",maxWidth:"90vw",maxHeight:"85vh",background:"#0f172a",borderRadius:"8px",border:"1px solid #334155",overflow:"hidden",display:"flex",flexDirection:"column"},onClick:Y=>Y.stopPropagation(),children:[g.jsxs("div",{style:{padding:"10px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #1e293b"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"#f8fafc",fontSize:"13px",fontWeight:600},children:[g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M12 19l7-7 3 3-7 7-3-3z"}),g.jsx("path",{d:"M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"}),g.jsx("path",{d:"M2 2l7.586 7.586"}),g.jsx("circle",{cx:"11",cy:"11",r:"2"})]}),g.jsx("span",{children:"Anotação Visual Registrada no Incidente"})]}),g.jsx("button",{type:"button",style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"16px",cursor:"pointer"},onClick:()=>d(!1),children:"✕"})]}),g.jsx("img",{src:n.annotationImage,alt:"Anotação de tela",style:{maxWidth:"100%",maxHeight:"calc(85vh - 90px)",objectFit:"contain"}}),(()=>{var ye,rn,Zt,U;const Y=(Zt=(rn=(ye=n.triggers)==null?void 0:ye.find(V=>{var Z;return(Z=V.detail)==null?void 0:Z.notes}))==null?void 0:rn.detail)==null?void 0:Zt.notes,le=((U=n.annotations)==null?void 0:U.notes)||Y,me=Math.max(0,(n.triggeredAt||n.finalizedAt)-n.startedAt);return le?g.jsxs("div",{style:{padding:"10px 16px",background:"#1e293b",borderTop:"1px solid #334155",color:"#f8fafc",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},children:[g.jsxs("span",{style:{color:"#60a5fa",fontWeight:600},children:["QA [",Xe(me),"]:"]}),g.jsx("span",{children:le})]}):null})()]})}),g.jsx("div",{className:"header-secondary-band",children:g.jsxs("div",{className:"incident-meta-chips",children:[g.jsxs("button",{type:"button",className:"meta-chip meta-chip-btn",onClick:de,title:"Clique para copiar ID completo","aria-label":"Copiar ID do incidente",children:[g.jsx("span",{className:"meta-label",children:"ID:"}),g.jsx("strong",{className:"meta-value meta-id",children:n.id}),s&&g.jsx("span",{className:"meta-copied","aria-label":"Copiado",children:"✓"})]}),g.jsxs("div",{className:"meta-chip",children:[g.jsx("span",{className:"meta-label",children:"Hora:"}),g.jsx("strong",{className:"meta-value",children:ae(n.triggeredAt)})]}),g.jsxs("div",{className:"meta-chip",children:[g.jsx("span",{className:"meta-label",children:"Duração:"}),g.jsx("strong",{className:"meta-value",children:Xe(n.finalizedAt-n.startedAt)})]}),g.jsxs("div",{className:"meta-chip meta-chip-host",title:i.url,children:[g.jsx("span",{className:"meta-label",children:"Host:"}),g.jsx("strong",{className:"meta-value",children:Ke(i.url)})]}),g.jsxs("div",{className:"meta-chip",children:[g.jsx("span",{className:"meta-label",children:"Viewport:"}),g.jsxs("strong",{className:"meta-value",children:[i.viewport.width,"×",i.viewport.height]})]}),e.formatVersion===2&&e.context.release&&g.jsxs("div",{className:"meta-chip",title:"Release da aplicação",children:[g.jsx("span",{className:"meta-label",children:"Release:"}),g.jsx("strong",{className:"meta-value",children:e.context.release})]}),e.formatVersion===2&&e.context.environment&&g.jsxs("div",{className:"meta-chip",title:"Ambiente",children:[g.jsx("span",{className:"meta-label",children:"Env:"}),g.jsx("strong",{className:"meta-value",children:e.context.environment})]}),e.formatVersion===2&&((kt=e.context.correlation)==null?void 0:kt.traceId)&&g.jsxs("button",{type:"button",className:"meta-chip meta-chip-btn",onClick:()=>te(e.context.correlation.traceId),title:"Clique para copiar Trace ID","aria-label":"Copiar Trace ID",children:[g.jsx("span",{className:"meta-label",children:"Trace:"}),g.jsx("strong",{className:"meta-value",style:{fontFamily:"monospace"},children:e.context.correlation.traceId}),o&&g.jsx("span",{className:"meta-copied","aria-label":"Copiado",children:"✓"})]}),l.droppedEventsUnknown?g.jsx("div",{className:"meta-chip is-warning",children:"Perdas: quantidade desconhecida"}):l.droppedEvents>0?g.jsxs("div",{className:"meta-chip meta-chip-drops is-warning",children:[g.jsx("span",{className:"meta-label",children:"Drops:"}),g.jsx("strong",{className:"meta-value",children:l.droppedEvents})]}):g.jsxs("div",{className:"meta-chip meta-chip-drops",children:[g.jsx("span",{className:"meta-label",children:"Drops:"}),g.jsx("strong",{className:"meta-value",children:"0"})]})]})})]})};var Mr={},mw=Object.defineProperty,pw=(e,t,n)=>t in e?mw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>pw(e,typeof t!="symbol"?t+"":t,n),Gm,gw=Object.defineProperty,yw=(e,t,n)=>t in e?gw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$m=(e,t,n)=>yw(e,typeof t!="symbol"?t+"":t,n),qe=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(qe||{});Date.now().toString();function vw(e){return e.nodeType===e.ELEMENT_NODE}class z0{constructor(){$m(this,"idNodeMap",new Map),$m(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){const i=n.id;this.idNodeMap.set(i,t),this.nodeMetaMap.set(t,n)}replace(t,n){const i=this.getNode(t);if(i){const l=this.nodeMetaMap.get(i);l&&this.nodeMetaMap.set(n,l)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function U0(){return new z0}function bw(e){return e.toLowerCase()}function xw(e,t){return!e||!t||e.type!==t.type?!1:e.type===qe.Document?e.compatMode===t.compatMode:e.type===qe.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===qe.Comment||e.type===qe.Text||e.type===qe.CDATA?e.textContent===t.textContent:e.type===qe.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function Sw(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,l=n.pathname.match(i);return(l==null?void 0:l[1])??null}const ww=/(max|min)-device-(width|height)/,Vm=new RegExp(ww.source,"g"),Ew={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(e){e.params.match(Vm)&&(e.params=e.params.replace(Vm,"$1-$2"))}}}},Nw={postcssPlugin:"postcss-hover-classes",prepare:function(){const e=[];return{Rule:function(t){e.indexOf(t)===-1&&(e.push(t),t.selectors.forEach(function(n){n.includes(":hover")&&(t.selector+=`,
|
|
56
|
+
`)+T}async function km(e,t){if(!t||!t.trim())throw new Error('GitHub Token não fornecido. Gere um token com o escopo "gist".');const n=t.trim(),i=`backtrack-${e.incident.id}.ffr.json`,l=`Backtrack Incident Replay [${e.incident.id}]: ${e.incident.reason}`,a=JSON.stringify(e,null,2);if(new TextEncoder().encode(a).length>10*1024*1024)throw new Error("O artefato excede o limite máximo de 10 MB suportado para upload.");const r={description:l,public:!1,files:{[i]:{content:a}}},o=await fetch("https://api.github.com/gists",{method:"POST",headers:{Authorization:`Bearer ${n}`,Accept:"application/vnd.github+json","Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let h="";try{const c=await o.json();h=c.message||JSON.stringify(c)}catch{h=o.statusText}throw o.status===401?new Error(`Falha de autenticação no GitHub (401). Verifique se o seu token possui o escopo 'gist': ${h}`):o.status===422?new Error(`O arquivo excede o limite suportado pelo GitHub Gist (10MB): ${h}`):new Error(`Erro ao criar Gist no GitHub (${o.status}): ${h}`)}const f=await o.json(),u=f.files&&(f.files[i]||Object.values(f.files)[0]);return{gistId:f.id,gistUrl:f.html_url,rawUrl:(u==null?void 0:u.raw_url)||f.html_url}}const dw="0.5.3",Wo={version:dw};let Zi=null;const Hm=10*1024*1024,hw=({artifact:e,onReset:t})=>{var kt;const{incident:n,environment:i,diagnostics:l,recorderVersion:a}=e,[s,r]=L.useState(!1),[o,f]=L.useState(!1),[u,h]=L.useState(!1),[c,d]=L.useState(!1),[m,y]=L.useState(!1),[w,v]=L.useState(!1),p=L.useRef(null),x=L.useRef(null);L.useEffect(()=>{if(!w)return;const Y=p.current;return Y==null||Y.showModal(),()=>{var le;Y==null||Y.close(),(le=x.current)==null||le.focus()}},[w]);const[b,S]=L.useState(()=>{if(typeof window<"u"&&window.location.search){const le=new URLSearchParams(window.location.search).get("gist");if(le){const me=Math.floor(Math.max(0,(n.triggeredAt||n.finalizedAt)-n.startedAt)/1e3);return`${window.location.origin}/?gist=${le}${me>0?`&t=${me}`:""}`}}return null}),[N,C]=L.useState(!1),[T,z]=L.useState(!1),[O,G]=L.useState(null),[q,R]=L.useState(""),[B,I]=L.useState(!1),[_,A]=L.useState(!1),[j,Q]=L.useState(null),[F,E]=L.useState(null),[k,M]=L.useState(!1),[J,re]=L.useState(!1),[$,H]=L.useState(null);L.useEffect(()=>{const Y=le=>{le.key==="Escape"&&(w&&!N&&v(!1),m&&!J&&y(!1),c&&d(!1))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[w,m,c,N,J]);const ae=Y=>new Date(Y).toLocaleTimeString(),Xe=Y=>{const le=Math.max(1,Math.round(Y/1e3)),me=Math.floor(le/60),ye=le%60;return`${me.toString().padStart(2,"0")}:${ye.toString().padStart(2,"0")}`},Ke=Y=>{try{return new URL(Y).host}catch{return Y}},de=()=>{try{navigator.clipboard.writeText(n.id),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},te=Y=>{try{navigator.clipboard.writeText(Y),f(!0),setTimeout(()=>f(!1),2e3)}catch{}},Ie=()=>{H(null),y(!0)},vt=async()=>{re(!0),H(null);try{let Y;if(k){const ye=typeof window<"u"?new URLSearchParams(window.location.search):null,rn=ye==null?void 0:ye.get("gist");if(rn)Y=`${window.location.origin}/?gist=${rn}`;else{if(new TextEncoder().encode(JSON.stringify(e)).byteLength>Hm)throw new Error("O artefato excede o limite máximo permitido pelo GitHub Gist (10 MB).");let V=Zi;if(!V||!V.trim()){const W=prompt('Insira seu GitHub Personal Access Token (com permissão "gist") para gerar o link compartilhado:');if(!W||!W.trim()){re(!1);return}V=W.trim(),Zi=V}const Z=await km(e,V);Y=`${window.location.origin}/?gist=${Z.gistId}`}const Zt=Math.floor(Math.max(0,(e.incident.triggeredAt||e.incident.finalizedAt)-e.incident.startedAt)/1e3);Y&&Zt>0&&!Y.includes("&t=")&&!Y.includes("?t=")&&(Y+=(Y.includes("?")?"&":"?")+`t=${Zt}`)}const le=fw(e,{replayUrl:Y});let me=!1;if(typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText)try{await navigator.clipboard.writeText(le),me=!0}catch{}if(!me&&typeof document<"u")try{const ye=document.createElement("textarea");ye.value=le,ye.style.position="fixed",ye.style.opacity="0",document.body.appendChild(ye),ye.focus(),ye.select(),me=document.execCommand("copy"),document.body.removeChild(ye)}catch{me=!1}h(!0),y(!1),setTimeout(()=>h(!1),2500)}catch(Y){const le=Y instanceof Error?Y.message:String(Y);le.includes("401")&&(Zi=null),H(le)}finally{re(!1)}},sn=async()=>{C(!0),G(null);try{if(new TextEncoder().encode(JSON.stringify(e)).byteLength>Hm)throw new Error("O artefato excede o limite máximo permitido pelo GitHub Gist (10 MB).");const le=Zi||"";if(!le&&!q.trim()){I(!0),C(!1);return}const me=q.trim()||le;q.trim()&&(Zi=q.trim());const ye=await km(e,me),rn=Math.floor(Math.max(0,(n.triggeredAt||n.finalizedAt)-n.startedAt)/1e3),Zt=`${window.location.origin}/?gist=${ye.gistId}${rn>0?`&t=${rn}`:""}`;S(Zt),I(!1),await navigator.clipboard.writeText(Zt),z(!0),setTimeout(()=>z(!1),3e3)}catch(Y){const le=Y instanceof Error?Y.message:String(Y);le.includes("401")&&(Zi=null,I(!0)),G(le)}finally{C(!1)}},Jl=async()=>{if(b)try{await navigator.clipboard.writeText(b),z(!0),setTimeout(()=>z(!1),2500)}catch{}},he=async()=>{if(!j){E("Escolha uma opção antes de baixar");return}E(null);try{if(j==="ai"){const Y={...e,replay:[],_aiNote:"Replay visual removido para otimizacao de IA. Timeline, erros de console e rede preservados."},le=new Blob([JSON.stringify(Y,null,2)],{type:"application/json"}),me=URL.createObjectURL(le),ye=document.createElement("a");ye.href=me,ye.download=`${n.id}.ai.json`,ye.click(),URL.revokeObjectURL(me)}else if(j==="gzip")try{const Y=await nw(e),le=new Blob([Y],{type:"application/gzip"}),me=URL.createObjectURL(le),ye=document.createElement("a");ye.href=me,ye.download=`${n.id}.ffr.json.gz`,ye.click(),URL.revokeObjectURL(me)}catch{const Y=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),le=URL.createObjectURL(Y),me=document.createElement("a");me.href=le,me.download=`${n.id}.ffr.json`,me.click(),URL.revokeObjectURL(le)}else{const Y=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),le=URL.createObjectURL(Y),me=document.createElement("a");me.href=le,me.download=`${n.id}.ffr.json`,me.click(),URL.revokeObjectURL(le)}A(!0),setTimeout(()=>A(!1),2500)}catch{E("Falha ao baixar arquivo de gravação.")}};return g.jsxs("header",{className:"app-header",children:[l.degraded&&g.jsxs("div",{role:"alert",style:{padding:"12px 18px",background:"#422006",color:"#fef3c7"},children:[g.jsx("strong",{children:"Gravação incompleta"}),g.jsx("ul",{children:l.degradedReasons.map((Y,le)=>g.jsx("li",{children:Y},le))}),l.droppedEventsUnknown&&g.jsx("p",{children:"A quantidade total de eventos perdidos é desconhecida."})]}),g.jsxs("div",{className:"header-primary-band",children:[g.jsxs("div",{className:"header-brand-wrap",children:[g.jsx("span",{className:"brand-icon","aria-hidden":"true",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),g.jsx("polyline",{points:"3 3 3 8 8 8"}),g.jsx("polygon",{points:"10 8 16 12 10 16 10 8",fill:"currentColor",stroke:"none"})]})}),g.jsx("span",{className:"brand-title",children:"Backtrack JS"}),g.jsxs("span",{className:"brand-version-badge",title:a?`Visualizador v${Wo.version} (incidente gravado com v${a})`:`Backtrack JS v${Wo.version}`,children:["v",Wo.version]})]}),g.jsxs("div",{className:"header-actions",children:[n.annotationImage&&Rr(n.annotationImage)&&g.jsxs("button",{type:"button",className:"btn-secondary",onClick:()=>d(!0),style:{color:"#f59e0b",borderColor:"#f59e0b",display:"flex",alignItems:"center",gap:"6px"},title:"Ver anotação visual do QA na tela",children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M12 19l7-7 3 3-7 7-3-3z"}),g.jsx("path",{d:"M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"}),g.jsx("path",{d:"M2 2l7.586 7.586"}),g.jsx("circle",{cx:"11",cy:"11",r:"2"})]}),g.jsx("span",{children:"Anotação de Tela"})]}),g.jsxs("button",{type:"button",className:"btn-secondary",onClick:Ie,title:"Copiar Markdown para debug (ideal para IAs, Jira ou GitHub)",style:{display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),g.jsx("span",{children:u?"Copiado!":"Markdown para debug"})]}),g.jsx("button",{type:"button",className:"btn-secondary",onClick:t,"aria-label":"Carregar outro incidente",children:"Carregar outro arquivo"}),g.jsxs("button",{type:"button",className:"btn-secondary",onClick:()=>{G(null),Q(null),E(null),v(!0)},title:"Compartilhar gravação via link ou baixar arquivo",ref:x,style:{display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("circle",{cx:"18",cy:"5",r:"3"}),g.jsx("circle",{cx:"6",cy:"12",r:"3"}),g.jsx("circle",{cx:"18",cy:"19",r:"3"}),g.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),g.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),g.jsx("span",{children:"Compartilhar"})]})]})]}),m&&g.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.75)",zIndex:999999,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px"},onClick:()=>!J&&y(!1),children:g.jsxs("div",{style:{width:"100%",maxWidth:"460px",background:"#0f172a",borderRadius:"10px",border:"1px solid #334155",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5)",overflow:"hidden",display:"flex",flexDirection:"column"},onClick:Y=>Y.stopPropagation(),children:[g.jsxs("div",{style:{padding:"14px 18px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #1e293b"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#f8fafc",fontWeight:600,fontSize:"14px"},children:[g.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),g.jsx("span",{children:"Markdown para debug"})]}),g.jsx("button",{type:"button",style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"16px",cursor:"pointer",padding:"4px 8px"},onClick:()=>!J&&y(!1),"aria-label":"Fechar",children:"✕"})]}),g.jsxs("div",{style:{padding:"20px 18px",display:"flex",flexDirection:"column",gap:"14px"},children:[g.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",userSelect:"none"},children:[g.jsx("input",{type:"checkbox",checked:k,onChange:Y=>M(Y.target.checked),disabled:J,style:{marginTop:"2px",width:"16px",height:"16px",accentColor:"#2563eb",cursor:"pointer"}}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"#f1f5f9",fontSize:"13.5px",fontWeight:500},children:"Criar link externo no GitHub Gist (não listado)"}),g.jsx("div",{style:{color:"#94a3b8",fontSize:"12px",marginTop:"3px",lineHeight:"1.4"},children:"Por padrão, a cópia do Markdown é 100% local. Se marcado, enviará o artefato para um Gist não listado no GitHub e incluirá o link no relatório."})]})]}),k&&g.jsxs("div",{style:{padding:"8px 12px",background:"rgba(234, 179, 8, 0.1)",border:"1px solid rgba(234, 179, 8, 0.3)",borderRadius:"6px",color:"#fde047",fontSize:"11.5px",lineHeight:"1.4"},children:[g.jsx("strong",{children:"Aviso de privacidade:"})," O artefato poderá incluir replay visual, URLs, logs, respostas de rede, anotações e trechos do código-fonte incorporados durante a symbolication. Esses dados serão transmitidos aos servidores do GitHub como um Gist não listado."]}),$&&g.jsx("div",{style:{padding:"8px 12px",background:"rgba(239, 68, 68, 0.15)",border:"1px solid rgba(239, 68, 68, 0.3)",borderRadius:"6px",color:"#fca5a5",fontSize:"12px"},children:$})]}),g.jsxs("div",{style:{padding:"12px 18px",background:"#090d16",borderTop:"1px solid #1e293b",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[g.jsx("button",{type:"button",className:"btn-secondary",onClick:()=>y(!1),disabled:J,style:{padding:"6px 12px",fontSize:"12px"},children:"Cancelar"}),g.jsx("button",{type:"button",className:"btn-secondary",onClick:vt,disabled:J,style:{background:"#2563eb",borderColor:"#3b82f6",color:"#ffffff",fontWeight:500,padding:"6px 14px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},children:J?k?"Criando link do Gist...":"Copiando...":"Copiar Markdown para debug"})]})]})}),w&&g.jsx("dialog",{ref:p,className:"share-drawer-overlay","aria-labelledby":"share-drawer-title",onCancel:Y=>{Y.preventDefault(),N||v(!1)},onClick:()=>!N&&v(!1),children:g.jsxs("div",{className:"share-drawer",onClick:Y=>Y.stopPropagation(),children:[g.jsxs("div",{style:{padding:"14px 18px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #1e293b"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#f8fafc",fontWeight:600,fontSize:"14px"},children:[g.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("circle",{cx:"18",cy:"5",r:"3"}),g.jsx("circle",{cx:"6",cy:"12",r:"3"}),g.jsx("circle",{cx:"18",cy:"19",r:"3"}),g.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),g.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),g.jsx("span",{id:"share-drawer-title",children:"Compartilhar Incidente"})]}),g.jsx("button",{type:"button",style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"16px",cursor:"pointer",padding:"4px 8px"},onClick:()=>!N&&v(!1),"aria-label":"Fechar",children:"✕"})]}),g.jsxs("div",{className:"share-drawer-body",children:[g.jsxs("div",{className:"share-drawer-card",children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#60a5fa",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),g.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),g.jsx("strong",{style:{color:"#f8fafc",fontSize:"13px"},children:"Compartilhar via Link"})]}),g.jsx("p",{style:{margin:0,fontSize:"12px",color:"#94a3b8",lineHeight:1.4},children:"Gera um link do replay online (via GitHub Gist não listado) para qualquer pessoa com o link assistir no navegador."}),g.jsxs("div",{style:{padding:"6px 10px",background:"rgba(234, 179, 8, 0.1)",border:"1px solid rgba(234, 179, 8, 0.3)",borderRadius:"6px",color:"#fde047",fontSize:"11px",lineHeight:"1.35"},children:[g.jsx("strong",{children:"Aviso de privacidade:"})," O artefato poderá incluir replay visual, URLs, logs, respostas de rede, anotações e trechos do código-fonte incorporados durante a symbolication. Esses dados serão transmitidos aos servidores do GitHub como um Gist não listado."]}),b?g.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"4px"},children:[g.jsx("input",{type:"text",readOnly:!0,value:b,style:{flex:1,background:"#0f172a",border:"1px solid #334155",borderRadius:"6px",padding:"6px 10px",color:"#93c5fd",fontSize:"12px",fontFamily:"monospace"}}),g.jsx("button",{type:"button",className:"btn-primary",onClick:Jl,style:{padding:"6px 12px",fontSize:"12px",whiteSpace:"nowrap"},children:T?"✓ Copiado!":"Copiar Link"})]}):B?g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginTop:"4px"},children:[g.jsxs("label",{style:{fontSize:"11px",color:"#cbd5e1"},children:["GitHub Personal Access Token (classic com permissão ",g.jsx("code",{children:"gist"}),"):"]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("input",{type:"password",value:q,onChange:Y=>R(Y.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxx",style:{flex:1,background:"#0f172a",border:"1px solid #334155",borderRadius:"6px",padding:"6px 10px",color:"#f8fafc",fontSize:"12px"}}),g.jsx("button",{type:"button",className:"btn-primary",onClick:sn,disabled:N||!q.trim(),style:{padding:"6px 12px",fontSize:"12px",whiteSpace:"nowrap"},children:N?"Gerando...":"Salvar e Gerar"})]})]}):g.jsxs("button",{type:"button",className:"btn-primary",onClick:sn,disabled:N,style:{alignSelf:"flex-start",marginTop:"4px",padding:"6px 14px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),g.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),g.jsx("span",{children:N?"Gerando link online...":"Gerar e Copiar Link"})]}),O&&g.jsx("div",{style:{color:"#ef4444",fontSize:"11px",marginTop:"4px",background:"rgba(239, 68, 68, 0.1)",padding:"6px 10px",borderRadius:"4px",border:"1px solid rgba(239, 68, 68, 0.3)"},children:O})]}),g.jsxs("div",{className:"share-drawer-card",children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),g.jsx("polyline",{points:"7 10 12 15 17 10"}),g.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),g.jsx("strong",{style:{color:"#f8fafc",fontSize:"13px"},children:"Baixar Arquivo da Gravação"})]}),g.jsx("p",{style:{margin:0,fontSize:"12px",color:"#94a3b8",lineHeight:1.4},children:"Escolha o formato desejado para salvar a gravação no seu computador:"}),g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginTop:"2px"},children:[g.jsxs("label",{className:"share-format-option",onClick:()=>{Q("ai"),E(null)},children:[g.jsx("input",{type:"radio",name:"viewer-download-format",value:"ai",checked:j==="ai",onChange:()=>{Q("ai"),E(null)},style:{marginTop:"2px",cursor:"pointer",accentColor:"#2563eb"}}),g.jsxs("div",{children:[g.jsx("span",{style:{display:"block",fontSize:"12px",fontWeight:600,color:"#f1f5f9"},children:"JSON para IA (.ai.json)"}),g.jsx("p",{style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8",lineHeight:1.35},children:"Sem replay visual, otimizado para uso com IA. Ideal para Gemini e Claude."})]})]}),g.jsxs("label",{className:"share-format-option",onClick:()=>{Q("gzip"),E(null)},children:[g.jsx("input",{type:"radio",name:"viewer-download-format",value:"gzip",checked:j==="gzip",onChange:()=>{Q("gzip"),E(null)},style:{marginTop:"2px",cursor:"pointer",accentColor:"#2563eb"}}),g.jsxs("div",{children:[g.jsx("span",{style:{display:"block",fontSize:"12px",fontWeight:600,color:"#f1f5f9"},children:"Compactado Gzip (.ffr.json.gz)"}),g.jsx("p",{style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8",lineHeight:1.35},children:"Replay completo (~90% menor). Ideal para Slack, Jira e WhatsApp."})]})]}),g.jsxs("label",{className:"share-format-option",onClick:()=>{Q("uncompressed"),E(null)},children:[g.jsx("input",{type:"radio",name:"viewer-download-format",value:"uncompressed",checked:j==="uncompressed",onChange:()=>{Q("uncompressed"),E(null)},style:{marginTop:"2px",cursor:"pointer",accentColor:"#2563eb"}}),g.jsxs("div",{children:[g.jsx("span",{style:{display:"block",fontSize:"12px",fontWeight:600,color:"#f1f5f9"},children:"JSON Completo (.ffr.json)"}),g.jsx("p",{style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8",lineHeight:1.35},children:"Replay bruto descompactado (> 1 MB). Para inspeção direta."})]})]})]}),F&&g.jsx("div",{style:{color:"#fca5a5",fontSize:"11px",background:"rgba(239, 68, 68, 0.15)",padding:"6px 10px",borderRadius:"4px",border:"1px solid rgba(239, 68, 68, 0.3)"},children:F}),g.jsxs("button",{type:"button",className:"btn-secondary",onClick:he,style:{alignSelf:"flex-start",marginTop:"4px",padding:"6px 14px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),g.jsx("polyline",{points:"7 10 12 15 17 10"}),g.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),g.jsx("span",{children:_?"Download Iniciado!":"Baixar Arquivo"})]})]})]})]})}),c&&n.annotationImage&&Rr(n.annotationImage)&&g.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.85)",zIndex:999999,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px"},onClick:()=>d(!1),children:g.jsxs("div",{style:{position:"relative",maxWidth:"90vw",maxHeight:"85vh",background:"#0f172a",borderRadius:"8px",border:"1px solid #334155",overflow:"hidden",display:"flex",flexDirection:"column"},onClick:Y=>Y.stopPropagation(),children:[g.jsxs("div",{style:{padding:"10px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #1e293b"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"#f8fafc",fontSize:"13px",fontWeight:600},children:[g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M12 19l7-7 3 3-7 7-3-3z"}),g.jsx("path",{d:"M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"}),g.jsx("path",{d:"M2 2l7.586 7.586"}),g.jsx("circle",{cx:"11",cy:"11",r:"2"})]}),g.jsx("span",{children:"Anotação Visual Registrada no Incidente"})]}),g.jsx("button",{type:"button",style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"16px",cursor:"pointer"},onClick:()=>d(!1),children:"✕"})]}),g.jsx("img",{src:n.annotationImage,alt:"Anotação de tela",style:{maxWidth:"100%",maxHeight:"calc(85vh - 90px)",objectFit:"contain"}}),(()=>{var ye,rn,Zt,U;const Y=(Zt=(rn=(ye=n.triggers)==null?void 0:ye.find(V=>{var Z;return(Z=V.detail)==null?void 0:Z.notes}))==null?void 0:rn.detail)==null?void 0:Zt.notes,le=((U=n.annotations)==null?void 0:U.notes)||Y,me=Math.max(0,(n.triggeredAt||n.finalizedAt)-n.startedAt);return le?g.jsxs("div",{style:{padding:"10px 16px",background:"#1e293b",borderTop:"1px solid #334155",color:"#f8fafc",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},children:[g.jsxs("span",{style:{color:"#60a5fa",fontWeight:600},children:["QA [",Xe(me),"]:"]}),g.jsx("span",{children:le})]}):null})()]})}),g.jsx("div",{className:"header-secondary-band",children:g.jsxs("div",{className:"incident-meta-chips",children:[g.jsxs("button",{type:"button",className:"meta-chip meta-chip-btn",onClick:de,title:"Clique para copiar ID completo","aria-label":"Copiar ID do incidente",children:[g.jsx("span",{className:"meta-label",children:"ID:"}),g.jsx("strong",{className:"meta-value meta-id",children:n.id}),s&&g.jsx("span",{className:"meta-copied","aria-label":"Copiado",children:"✓"})]}),g.jsxs("div",{className:"meta-chip",children:[g.jsx("span",{className:"meta-label",children:"Hora:"}),g.jsx("strong",{className:"meta-value",children:ae(n.triggeredAt)})]}),g.jsxs("div",{className:"meta-chip",children:[g.jsx("span",{className:"meta-label",children:"Duração:"}),g.jsx("strong",{className:"meta-value",children:Xe(n.finalizedAt-n.startedAt)})]}),g.jsxs("div",{className:"meta-chip meta-chip-host",title:i.url,children:[g.jsx("span",{className:"meta-label",children:"Host:"}),g.jsx("strong",{className:"meta-value",children:Ke(i.url)})]}),g.jsxs("div",{className:"meta-chip",children:[g.jsx("span",{className:"meta-label",children:"Viewport:"}),g.jsxs("strong",{className:"meta-value",children:[i.viewport.width,"×",i.viewport.height]})]}),e.formatVersion===2&&e.context.release&&g.jsxs("div",{className:"meta-chip",title:"Release da aplicação",children:[g.jsx("span",{className:"meta-label",children:"Release:"}),g.jsx("strong",{className:"meta-value",children:e.context.release})]}),e.formatVersion===2&&e.context.environment&&g.jsxs("div",{className:"meta-chip",title:"Ambiente",children:[g.jsx("span",{className:"meta-label",children:"Env:"}),g.jsx("strong",{className:"meta-value",children:e.context.environment})]}),e.formatVersion===2&&((kt=e.context.correlation)==null?void 0:kt.traceId)&&g.jsxs("button",{type:"button",className:"meta-chip meta-chip-btn",onClick:()=>te(e.context.correlation.traceId),title:"Clique para copiar Trace ID","aria-label":"Copiar Trace ID",children:[g.jsx("span",{className:"meta-label",children:"Trace:"}),g.jsx("strong",{className:"meta-value",style:{fontFamily:"monospace"},children:e.context.correlation.traceId}),o&&g.jsx("span",{className:"meta-copied","aria-label":"Copiado",children:"✓"})]}),l.droppedEventsUnknown?g.jsx("div",{className:"meta-chip is-warning",children:"Perdas: quantidade desconhecida"}):l.droppedEvents>0?g.jsxs("div",{className:"meta-chip meta-chip-drops is-warning",children:[g.jsx("span",{className:"meta-label",children:"Drops:"}),g.jsx("strong",{className:"meta-value",children:l.droppedEvents})]}):g.jsxs("div",{className:"meta-chip meta-chip-drops",children:[g.jsx("span",{className:"meta-label",children:"Drops:"}),g.jsx("strong",{className:"meta-value",children:"0"})]})]})})]})};var Mr={},mw=Object.defineProperty,pw=(e,t,n)=>t in e?mw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>pw(e,typeof t!="symbol"?t+"":t,n),Gm,gw=Object.defineProperty,yw=(e,t,n)=>t in e?gw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$m=(e,t,n)=>yw(e,typeof t!="symbol"?t+"":t,n),qe=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(qe||{});Date.now().toString();function vw(e){return e.nodeType===e.ELEMENT_NODE}class z0{constructor(){$m(this,"idNodeMap",new Map),$m(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){const i=n.id;this.idNodeMap.set(i,t),this.nodeMetaMap.set(t,n)}replace(t,n){const i=this.getNode(t);if(i){const l=this.nodeMetaMap.get(i);l&&this.nodeMetaMap.set(n,l)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function U0(){return new z0}function bw(e){return e.toLowerCase()}function xw(e,t){return!e||!t||e.type!==t.type?!1:e.type===qe.Document?e.compatMode===t.compatMode:e.type===qe.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===qe.Comment||e.type===qe.Text||e.type===qe.CDATA?e.textContent===t.textContent:e.type===qe.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function Sw(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,l=n.pathname.match(i);return(l==null?void 0:l[1])??null}const ww=/(max|min)-device-(width|height)/,Vm=new RegExp(ww.source,"g"),Ew={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(e){e.params.match(Vm)&&(e.params=e.params.replace(Vm,"$1-$2"))}}}},Nw={postcssPlugin:"postcss-hover-classes",prepare:function(){const e=[];return{Rule:function(t){e.indexOf(t)===-1&&(e.push(t),t.selectors.forEach(function(n){n.includes(":hover")&&(t.selector+=`,
|
|
57
57
|
`+n.replace(/:hover/g,".\\:hover"))}))}}}};function Cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tw(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}),n}var Es={exports:{}},Ym;function Aw(){if(Ym)return Es.exports;Ym=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Es.exports=t(),Es.exports.createColors=t,Es.exports}const Rw={},Ow=Object.freeze(Object.defineProperty({__proto__:null,default:Rw},Symbol.toStringTag,{value:"Module"})),en=Tw(Ow);var eu,Xm;function Od(){if(Xm)return eu;Xm=1;let e=Aw(),t=en;class n extends Error{constructor(l,a,s,r,o,f){super(l),this.name="CssSyntaxError",this.reason=l,o&&(this.file=o),r&&(this.source=r),f&&(this.plugin=f),typeof a<"u"&&typeof s<"u"&&(typeof a=="number"?(this.line=a,this.column=s):(this.line=a.line,this.column=a.column,this.endLine=s.line,this.endColumn=s.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(l){if(!this.source)return"";let a=this.source;l==null&&(l=e.isColorSupported),t&&l&&(a=t(a));let s=a.split(/\r?\n/),r=Math.max(this.line-3,0),o=Math.min(this.line+2,s.length),f=String(o).length,u,h;if(l){let{bold:c,gray:d,red:m}=e.createColors(!0);u=y=>c(m(y)),h=y=>d(y)}else u=h=c=>c;return s.slice(r,o).map((c,d)=>{let m=r+1+d,y=" "+(" "+m).slice(-f)+" | ";if(m===this.line){let w=h(y.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return u(">")+h(y)+c+`
|
|
58
58
|
`+w+u("^")}return" "+h(y)+c}).join(`
|
|
59
59
|
`)}toString(){let l=this.showSourceCode();return l&&(l=`
|
package/dist/viewer/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/>
|
|
11
11
|
<title>Backtrack Viewer</title>
|
|
12
12
|
<link rel="icon" type="image/png" href="/assets/backtrack-favico-Ds-TMW85.png" />
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-BkV3C4kX.js"></script>
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-092olPra.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|