@memlab/lens 1.0.1 → 1.0.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.
@@ -1 +1,26 @@
1
- (()=>{"use strict";var e={23:function(e,t,n){var i,o=this&&this.__classPrivateFieldSet||function(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n},s=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMVisualizationExtension=void 0,r(n(150));const l=r(n(271)),a=n(860);class c extends a.BasicExtension{constructor(e){super(e),i.set(this,void 0),o(this,i,new l.default,"f")}afterScan(e){const t=this.scanner;if(t.isDevMode()){const e=t.getDetachedDOMInfo();s(this,i,"f").repaint(e)}}}t.DOMVisualizationExtension=c,i=new WeakMap},54:function(e,t,n){var i,o,s,r,l,a,c,u,d,f,h,p,v=this&&this.__classPrivateFieldSet||function(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n},m=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMObserver=void 0;const y=n(313),g=n(498),w=(0,y.isWeakAPINative)(),b=void 0!==window.MutationObserver;t.DOMObserver=class{constructor(){i.add(this),o.set(this,void 0),s.set(this,void 0),r.set(this,void 0),l.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u.set(this,void 0),v(this,o,0,"f"),v(this,s,0,"f"),v(this,l,[],"f"),v(this,a,new WeakSet,"f"),v(this,u,[],"f"),this.startMonitoring()}register(e){m(this,u,"f").push(e)}startMonitoring(){if(!w||!b)return;if(null!=m(this,r,"f"))return;v(this,r,new MutationObserver((e=>{let t=[];const n=e=>{if(null==e)return;if(e.nodeType!=Node.ELEMENT_NODE)return;const n=e;if(!(0,g.isVisualizerElement)(n)){const e=m(this,i,"m",p).call(this,n);t=[...t,...e]}};e.forEach((e=>{e.addedNodes.forEach(n),e.removedNodes.forEach(n)})),m(this,u,"f").forEach((e=>e(t)))})),"f");const e=()=>{var t;document.body?null===(t=m(this,r,"f"))||void 0===t||t.observe(document.body,{childList:!0,subtree:!0}):setTimeout(e,0)};e(),v(this,c,window.setInterval((()=>{m(this,i,"m",d).call(this)}),3e3),"f")}stopMonitoring(){null!=m(this,r,"f")&&(m(this,r,"f").disconnect(),v(this,r,null,"f")),null!=m(this,c,"f")&&(window.clearInterval(m(this,c,"f")),v(this,c,null,"f"))}getDOMElements(){return[...m(this,l,"f")]}getStats(){try{v(this,o,m(this,i,"m",f).call(this),"f"),v(this,s,m(this,i,"m",h).call(this),"f")}catch(e){}return{elements:m(this,o,"f"),detachedElements:m(this,s,"f")}}},o=new WeakMap,s=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,i=new WeakSet,d=function(){const e=[],t=new Set;for(const n of m(this,l,"f")){const i=n.deref();null==i||t.has(i)||(e.push(n),t.add(i))}v(this,l,e,"f")},f=function(){var e,t;return v(this,o,null!==(t=null===(e=null===document||void 0===document?void 0:document.getElementsByTagName("*"))||void 0===e?void 0:e.length)&&void 0!==t?t:0,"f")},h=function(){let e=0;for(const t of m(this,l,"f")){const n=t.deref();n&&!1===n.isConnected&&++e}return v(this,s,e,"f")},p=function(e){const t=[e],n=new Set,i=[];for(;t.length>0;){const e=t.pop();if(null==e||n.has(e))continue;if((null==e?void 0:e.nodeType)!==Node.ELEMENT_NODE)continue;const o=e;if((0,g.isVisualizerElement)(o))continue;if(n.add(o),!m(this,a,"f").has(o)){const e=new WeakRef(o);m(this,l,"f").push(e),m(this,a,"f").add(o),i.push(e)}const s=o.childNodes;for(let e=0;e<s.length;++e)t.push(s[e])}return i}},150:function(e,t,n){var i,o,s,r,l,a,c,u,d=this&&this.__classPrivateFieldSet||function(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n},f=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0});const h=n(498);o=new WeakMap,i=new WeakSet,s=function(e){if(!f(this,o,"f")){const e=f(this,i,"m",l).call(this);d(this,o,e,"f")}f(this,i,"m",c).call(this,e)},r=function(e){document.body&&document.body.appendChild(e)},l=function(){const e=(0,h.createVisualizerElement)("canvas");return e.id="overlayCanvas",f(this,i,"m",r).call(this,e),e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="none",e.style.zIndex="99999",e.width=window.innerWidth,e.height=window.innerHeight,e},a=function(e){const{boundingRect:t}=e;return JSON.stringify({boundingRect:t})},c=function(e){const t=f(this,o,"f");if(!t)return;const n=t.getContext("2d");if(null==n)return;n.strokeStyle="rgba(75, 192, 192, 0.8)",n.lineWidth=2,n.fillStyle="rgba(75, 192, 192, 0.05)",n.font="11px Inter, system-ui, -apple-system, sans-serif";const s=new Set;e.forEach((e=>{var t;const o=e.boundingRect;if(null==o)return;const r=f(this,i,"m",a).call(this,e);if(s.has(r))return;s.add(r),n.fillRect(o.left,o.top,o.width,o.height),n.strokeRect(o.left,o.top,o.width,o.height);const l=null===(t=e.componentStack)||void 0===t?void 0:t[0];if(l){const t=e.element.deref(),i=null==t?void 0:t.detachedElementId,s=`${l}${i?` (${i})`:""}`;n.fillStyle="rgba(74, 131, 224, 1)",n.fillText(s,o.left+5,o.top+15),n.fillStyle="rgba(75, 192, 192, 0.05)"}}))},u=function(){var e;const t=f(this,o,"f");if(t){const n=t.getContext("2d");null==n||n.clearRect(0,0,t.width,t.height),null===(e=t.parentNode)||void 0===e||e.removeChild(t)}d(this,o,null,"f")},t.default=class{constructor(){i.add(this),o.set(this,void 0),d(this,o,null,"f")}repaint(e){f(this,i,"m",u).call(this),f(this,i,"m",s).call(this,e)}}},271:function(e,t,n){var i,o,s,r,l,a,c,u,d,f,h,p,v,m,y,g,w,b,M=this&&this.__classPrivateFieldSet||function(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n},E=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},k=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const _=k(n(150)),C=n(368),O=n(341),S=n(701),T=n(476),x=n(498);class W extends _.default{constructor(){super(),i.add(this),o.set(this,void 0),s.set(this,void 0),r.set(this,void 0),l.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u.set(this,[]),M(this,c,{value:!1},"f"),M(this,s,(0,C.createOverlayDiv)(),"f"),(0,x.tryToAttachOverlay)(E(this,s,"f")),M(this,r,(0,O.createControlWidget)(E(this,s,"f"),E(this,c,"f"),(e=>{E(this,u,"f").push(e)})),"f"),(0,x.tryToAttachOverlay)(E(this,r,"f")),M(this,o,new Map,"f"),M(this,a,E(this,i,"m",f).call(this),"f"),M(this,l,new Set,"f"),E(this,i,"m",d).call(this)}repaint(e){E(this,s,"f").remove(),E(this,i,"m",y).call(this,e),E(this,i,"m",w).call(this,e),E(this,i,"m",b).call(this),(0,x.tryToAttachOverlay)(E(this,s,"f"))}}o=new WeakMap,s=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,i=new WeakSet,d=function(){document.addEventListener("keydown",(e=>{"d"!==e.key&&"D"!==e.key||null!=E(this,a,"f").selectedElementId&&E(this,l,"f").add(E(this,a,"f").selectedElementId)}))},f=function(){const e={detachedDOMElementsCount:0,totalDOMElementsCount:(0,T.getDOMElementCount)(),selectedElementId:null,selectedReactComponentStack:[],pinnedElementId:null,setPinnedElementId:t=>{var n,o;if(e.pinnedElementId==t)return;const s=E(this,i,"m",h).call(this,e.pinnedElementId);null===(n=null==s?void 0:s.__unpinned)||void 0===n||n.call(s);const r=E(this,i,"m",h).call(this,t);null===(o=null==r?void 0:r.__pinned)||void 0===o||o.call(r),e.pinnedElementId=t}};return e},h=function(e){if(null==e)return null;const t=E(this,o,"f").get(e);return null==t?null:t.visualizerElementRef.deref()},p=function(e){const t=new Set;for(const n of e){const e=n.element.deref();if(null==e)continue;const i=e.detachedElementId;null!=i&&t.add(i)}return t},v=function(e,t){const n=E(this,o,"f").get(e);if(null==n)return;const i=new Set;let s=n.elementInfo.element.deref();for(;s&&!s.isConnected;){const e=s.detachedElementId,n=parseInt(e,10);if(i.has(n))break;i.add(n);const r=E(this,o,"f").get(n);if(null==r)break;const l=r.visualizerElementRef.deref();if(null==l)break;t(l),s=s.parentElement}},m=function(e){var t;const n=E(this,o,"f").get(e);if(E(this,o,"f").delete(e),null==n)return;const i=n.visualizerElementRef.deref();null!=i&&(null===(t=null==i?void 0:i.__cleanup)||void 0===t||t.call(i),i.remove())},y=function(e){for(const[e,t]of E(this,o,"f").entries())null!=e&&null==t.elementInfo.element.deref()&&E(this,i,"m",m).call(this,e);const t=E(this,i,"m",p).call(this,e);for(const[e]of E(this,o,"f").entries())null!=e&&(t.has(e)&&!E(this,l,"f").has(e)||E(this,i,"m",m).call(this,e))},g=function(e){var t;const n=e.element.deref();if(null==n)return 0;const i=n.detachedElementId;if(null==i)return 0;const o=null!==(t=e.boundingRect)&&void 0!==t?t:{width:50,height:50};let s=9999;return s+=parseInt(i,10),s+=Math.floor(1e7/(o.width*o.height)),s},w=function(e){for(const t of e){const e=t.element.deref();if(null==e)continue;const n=e.detachedElementId;if(null==n)continue;if(E(this,l,"f").has(n))continue;if(E(this,o,"f").has(n))continue;if(null==e)continue;if(e.isConnected)continue;const r=E(this,i,"m",g).call(this,t),c=(0,S.createOverlayRectangle)(n,t,E(this,s,"f"),(e=>{E(this,a,"f").selectedElementId=e,E(this,i,"m",b).call(this),null!=e&&E(this,i,"m",v).call(this,e,(e=>{var t;null===(t=null==e?void 0:e.__selected)||void 0===t||t.call(e)}))}),(e=>{E(this,a,"f").selectedElementId===e&&(E(this,a,"f").selectedElementId=null,E(this,i,"m",b).call(this)),null!=e&&E(this,i,"m",v).call(this,e,(e=>{var t;null===(t=null==e?void 0:e.__unselected)||void 0===t||t.call(e)}))}),(e=>{E(this,a,"f").pinnedElementId===e?E(this,a,"f").setPinnedElementId(null):E(this,a,"f").setPinnedElementId(e),E(this,i,"m",b).call(this)}),r);if(null==c||null==c.deref())return null;const u={elementInfo:t,visualizerElementRef:c};E(this,o,"f").set(n,u)}},b=function(){var e,t,n;const i=E(this,a,"f");null!=i.pinnedElementId&&(i.selectedElementId=i.pinnedElementId),i.detachedDOMElementsCount=E(this,o,"f").size,i.totalDOMElementsCount=(0,T.getDOMElementCount)();const s=null===(t=E(this,o,"f").get(null!==(e=i.selectedElementId)&&void 0!==e?e:-1))||void 0===t?void 0:t.elementInfo;i.selectedReactComponentStack=null!==(n=null==s?void 0:s.componentStack)&&void 0!==n?n:[];for(const e of E(this,u,"f"))e(Object.assign({},E(this,a,"f")))},t.default=W},282:function(e,t,n){var i,o,s,r,l,a,c,u,d,f,h,p,v,m,y,g,w,b,M,E,k,_,C,O,S=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),T=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),x=this&&this.__importStar||(i=function(e){return i=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},i(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=i(e),o=0;o<n.length;o++)"default"!==n[o]&&S(t,e,n[o]);return T(t,e),t}),W=this&&this.__classPrivateFieldSet||function(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n},I=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},R=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n},P=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const N=x(n(476)),F=P(n(302)),D=n(737),j=n(54),L=n(346),z=n(953);class H{constructor(e={}){var t,n,i,g;o.add(this),s.set(this,void 0),r.set(this,void 0),l.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u.set(this,void 0),d.set(this,void 0),f.set(this,void 0),h.set(this,void 0),p.set(this,void 0),v.set(this,void 0),m.set(this,void 0),y.set(this,void 0),W(this,s,[],"f"),W(this,r,!1,"f"),W(this,a,new WeakMap,"f"),W(this,c,new WeakMap,"f"),W(this,u,[],"f"),W(this,y,e.trackEventListenerLeaks?z.EventListenerTracker.getInstance():null,"f"),W(this,d,new F.default,"f"),W(this,l,0,"f"),W(this,f,null!==(t=e.isDevMode)&&void 0!==t&&t,"f"),W(this,h,null!==(n=e.subscribers)&&void 0!==n?n:[],"f"),W(this,p,null!==(i=e.extensions)&&void 0!==i?i:[],"f"),W(this,v,null!==(g=e.scanIntervalMs)&&void 0!==g?g:L.config.performance.scanIntervalMs,"f")}subscribe(e){return I(this,h,"f").push(e),()=>this.unsubscribe(e)}unsubscribe(e){W(this,h,I(this,h,"f").filter((t=>t!==e)),"f")}registerExtension(e){return I(this,p,"f").push(e),()=>this.unregisterExtension(e)}unregisterExtension(e){W(this,p,I(this,p,"f").filter((t=>t!==e)),"f")}start(){W(this,r,!0,"f"),W(this,l,setInterval(I(this,o,"m",E).bind(this),I(this,v,"f")),"f"),L.config.features.enableMutationObserver&&(null==I(this,m,"f")&&W(this,m,new j.DOMObserver,"f"),I(this,m,"f").startMonitoring()),console.log("[Memory] Tracking React and DOM memory...")}pause(){W(this,r,!1,"f")}stop(){var e;W(this,r,!1,"f"),clearInterval(I(this,l,"f")),W(this,s,[],"f"),null===(e=I(this,m,"f"))||void 0===e||e.stopMonitoring()}recordBoundingRectangles(e){for(const t of e){const e=t.deref();if(null==e||I(this,a,"f").has(e))continue;const n=N.getBoundingClientRect(e);null!=n&&I(this,a,"f").set(e,n)}}getDetachedDOMInfo(){var e;const t=[];for(const n of I(this,s,"f")){const i=n.deref();if(null==i||i.isConnected)continue;const o=i;if(null==o.detachedElementId){const e=H.nextElementId++;o.detachedElementIdStr=`memory-id-${e}@`,o.detachedElementId=e}const s=null!==(e=I(this,c,"f").get(i))&&void 0!==e?e:[];t.push({element:n,boundingRect:I(this,a,"f").get(i),componentStack:s})}return t}isDevMode(){return I(this,f,"f")}getCachedComponentName(e){var t;const n="<Unknown>",i=e.deref();if(null==i)return n;const o=I(this,c,"f").get(i);return null==o?n:null!==(t=o[0])&&void 0!==t?t:n}updateFiberNodes(e){const t=new WeakSet;for(const e of I(this,u,"f")){const n=e.deref();null!=n&&t.add(n)}const n=new WeakSet;for(const t of e){const e=t.deref();null!=e&&n.add(e)}const i=[],s=[];for(const e of I(this,u,"f")){const t=e.deref();null!=t&&(n.has(t)?(s.push(e),null==t.return&&i.push(e)):i.push(e))}for(const n of e){const e=n.deref();null!=e&&(t.has(e)||s.push(n))}return W(this,u,s,"f"),I(this,o,"m",g).call(this,"known fibers: ",I(this,u,"f").length),I(this,o,"m",g).call(this,"leaked fibers: ",i.length),i}packLeakedFibers(e){const t=[];for(const n of e)t.push(new B(n));return t}scan(){const e=Date.now();I(this,o,"m",C).call(this);const t=I(this,s,"f"),n=I(this,o,"m",_).call(this);I(this,o,"m",k).call(this,n),this.recordBoundingRectangles(n),N.updateWeakRefList(t,n);const i=I(this,d,"f").scan(t,I(this,c,"f")),r=this.updateFiberNodes(i.fiberNodes);i.leakedFibers=r,i.eventListenerLeaks=I(this,o,"m",O).call(this),window.leakedFibers=this.packLeakedFibers(r);const l=Date.now();return I(this,o,"m",g).call(this,`scan took ${l-e}ms`),i}}s=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,y=new WeakMap,o=new WeakSet,g=function(...e){I(this,f,"f")&&L.config.features.enableConsoleLogs&&N.consoleLog(...e)},w=function(e){for(const t of I(this,h,"f"))t(e);const t=e.end-e.start;I(this,o,"m",g).call(this,"duration: ",`${t} ms`);const{scanner:n,leakedFibers:i,fiberNodes:s}=e,r=R(e,["scanner","leakedFibers","fiberNodes"]);I(this,o,"m",g).call(this,r)},b=function(){for(const e of I(this,p,"f"))null==e||e.beforeScan()},M=function(e){for(const t of I(this,p,"f"))null==t||t.afterScan(e)},E=function(){if(!I(this,r,"f"))return;I(this,o,"m",b).call(this);const e=performance.now(),t=this.scan(),n=performance.now(),i=Object.assign(Object.assign({},t),{start:e,end:n,scanner:this});I(this,o,"m",w).call(this,i),I(this,o,"m",M).call(this,i)},k=function(e){for(const t of e){const e=t.deref();if(null==e||I(this,c,"f").has(e))continue;const n=(0,D.getFiberNodeFromElement)(e);null!=n&&I(this,c,"f").set(e,(0,D.getReactComponentStack)(n))}},_=function(){return null==I(this,m,"f")?N.getDOMElements():[...N.getDOMElements(),...I(this,m,"f").getDOMElements()]},C=function(){null!=(null===window||void 0===window?void 0:window.gc)&&window.gc()},O=function(){var e;if(null==I(this,y,"f"))return[];const t=I(this,y,"f").scan(this.getCachedComponentName.bind(this)),n=[];for(const[i,o]of t.entries()){const t=new Map;for(const n of o){const i=null!==(e=t.get(n.type))&&void 0!==e?e:0;t.set(n.type,i+1)}for(const[e,o]of t.entries())n.push({type:e,componentName:i,count:o})}return n},H.nextElementId=0,t.default=H;class B{constructor(e){this.leakedFiber=e}}},302:function(e,t,n){var i,o=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||(i=function(e){return i=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},i(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=i(e),r=0;r<n.length;r++)"default"!==n[r]&&o(t,e,n[r]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0});const l=r(n(476)),a=n(737),c=n(847);t.default=class{scan(e,t){var n;const i=new Set,o=new Set,s=new Map,r=new Map,u=new Set,d=new Set,f=[];let h=0,p=0;function v(e){(0,a.traverseFiber)(e,(e=>{if(d.has(e))return!0;d.add(e);const t=(0,a.getDisplayNameOfFiberNode)(e);return null!=t&&(0,c.isValidComponentName)(t)?(o.add(t),l.addCountbyKey(s,t,1),!0):void 0}),!0)}for(const o of e){const e=o.deref();if(null==e)continue;if(++h,!e.isConnected){if(t.has(e)){const i=(null!==(n=t.get(e))&&void 0!==n?n:[])[0];e.__component_name=i,l.addCountbyKey(r,i,1)}++p}const s=(0,a.getFiberNodeFromElement)(e);if(null==s)continue;v(s);const c=(0,a.getTopMostFiberWithChild)(s);null!=c&&(i.has(c)||(i.add(c),(0,a.traverseFiber)(c,(e=>{if(u.has(e))return!0;u.add(e),f.push(new WeakRef(e)),v(e)}),!1)))}return u.clear(),d.clear(),i.clear(),{components:o,componentToFiberNodeCount:s,totalElements:h,totalDetachedElements:p,detachedComponentToFiberNodeCount:r,fiberNodes:f,leakedFibers:[]}}}},313:(e,t)=>{var n,i,o;Object.defineProperty(t,"__esModule",{value:!0}),t.WeakMapPlus=t.WeakMapNoOp=t.WeakSetNoOp=t.WeakRefNoOp=void 0,t.getNativeWeakMap=function(){return l?r:null},t.getNativeWeakMapOrFallback=function(){return l&&r?r:v},t.getNativeWeakSet=function(){return c?a:null},t.getNativeWeakSetOrFallback=function(){return c&&a?a:p},t.getNativeWeakRef=function(){return d?u:null},t.getNativeWeakRefOrFallback=function(){return d&&u?u:h},t.isWeakMapNative=y,t.isWeakSetNative=g,t.isWeakRefNative=w,t.isWeakAPINative=function(){return f};const s="undefined"!=typeof window?window:self,r=null!==(n=s.WeakMap)&&void 0!==n?n:null,l=y(),a=null!==(i=s.WeakSet)&&void 0!==i?i:null,c=g(),u=null!==(o=s.WeakRef)&&void 0!==o?o:null,d=w(),f=l&&c&&d;class h{constructor(e){}deref(){}}t.WeakRefNoOp=h;class p{constructor(e){}add(e){return this}delete(e){return!1}has(e){return!1}}t.WeakSetNoOp=p;class v{constructor(e){}delete(e){return!1}get(e){}has(e){return!1}set(e,t){return this}}function m(e){return"function"==typeof e.replace?e.replace(/\n/g," ").replace(/\s+/g," "):null}function y(){return null!==r&&"function"==typeof r.toString&&"function WeakMap() { [native code] }"===m(r.toString())}function g(){return null!==a&&"function"==typeof a.toString&&"function WeakSet() { [native code] }"===m(a.toString())}function w(){return null!==u&&"function"==typeof u.toString&&"function WeakRef() { [native code] }"===m(u.toString())}t.WeakMapNoOp=v;class b{constructor(e={}){this.strongMap=null,this.noopMap=!1,this.entriesMap=new Map,this.keyToId=new WeakMap;const{fallback:t="strong",cleanupMs:n=1e3}=e;this.isWeak=f,this.fallbackMode=t,this.isWeak?this.cleanupInterval=setInterval((()=>this.cleanup()),n):("strong"===t?this.strongMap=new Map:"noop"===t&&(this.noopMap=!0),this.cleanupInterval=-1)}getOrCreateId(e){let t=this.keyToId.get(e);return t||(t=Symbol(),this.keyToId.set(e,t)),t}set(e,t){var n;if(!this.isWeak)return this.noopMap||null===(n=this.strongMap)||void 0===n||n.set(e,t),this;const i=this.getOrCreateId(e);return this.entriesMap.set(i,{ref:new WeakRef(e),value:t}),this}get(e){var t,n;if(!this.isWeak){if(this.noopMap)return;return null===(t=this.strongMap)||void 0===t?void 0:t.get(e)}const i=this.keyToId.get(e);if(!i)return;const o=this.entriesMap.get(i);return(null===(n=null==o?void 0:o.ref)||void 0===n?void 0:n.deref())?null==o?void 0:o.value:void 0}has(e){var t,n;if(!this.isWeak)return!this.noopMap&&null!==(n=null===(t=this.strongMap)||void 0===t?void 0:t.has(e))&&void 0!==n&&n;const i=this.keyToId.get(e);if(!i)return!1;const o=this.entriesMap.get(i);return!(!o||!o.ref.deref())}delete(e){var t,n;if(!this.isWeak)return!this.noopMap&&null!==(n=null===(t=this.strongMap)||void 0===t?void 0:t.delete(e))&&void 0!==n&&n;const i=this.keyToId.get(e);return!!i&&(this.keyToId.delete(e),this.entriesMap.delete(i))}*liveEntries(){for(const[,e]of this.entriesMap){const t=e.ref.deref();t&&(yield[t,e.value])}}entries(){var e,t;return this.isWeak?this.liveEntries():this.noopMap?[][Symbol.iterator]():null!==(t=null===(e=this.strongMap)||void 0===e?void 0:e.entries())&&void 0!==t?t:[][Symbol.iterator]()}keys(){return function*(e){for(const[t]of e.entries())yield t}(this)}values(){return function*(e){for(const[,t]of e.entries())yield t}(this)}[Symbol.iterator](){return this.entries()}get size(){var e,t;if(!this.isWeak)return this.noopMap?0:null!==(t=null===(e=this.strongMap)||void 0===e?void 0:e.size)&&void 0!==t?t:0;let n=0;for(const e of this.liveEntries())n++;return n}getFallbackMode(){return this.fallbackMode}cleanup(){if(this.isWeak)for(const[e,t]of this.entriesMap)t.ref.deref()||this.entriesMap.delete(e)}destroy(){this.isWeak&&clearInterval(this.cleanupInterval)}}t.WeakMapPlus=b},341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createControlWidget=function(e,t,n){const l=(0,i.createVisualizerElement)("div");l.style.position="fixed",l.style.top="50px",l.style.right="50px",l.style.width="400px",l.style.background="rgba(0, 0, 0, 0.7)",l.style.border="none",l.style.borderRadius="8px",l.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.3)",l.style.zIndex="999999999",l.style.display="flex",l.style.flexDirection="column",l.style.textShadow="none",l.style.boxSizing="border-box",l.style.font="9px Inter, system-ui, -apple-system, sans-serif",l.id="memory-visualization-control-widget";const a=(0,i.createVisualizerElement)("div");a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="flex-start",a.style.padding="0 8px",a.style.height="36px",l.appendChild(a);const c=(0,r.createComponentStackPanel)(n);l.appendChild(c),function(e){let t=!1,n=0,i=0;e.addEventListener("mousedown",(o=>{o.target.closest("#memory-visualization-control-widget > div:first-child")&&(t=!0,n=o.clientX-e.offsetLeft,i=o.clientY-e.offsetTop,e.style.cursor="move")})),document.addEventListener("mousemove",(o=>{t&&(e.style.left=o.clientX-n+"px",e.style.top=o.clientY-i+"px",e.style.right="")})),document.addEventListener("mouseup",(()=>{t=!1,e.style.cursor="default"}))}(l);const u=(0,s.createToggleButton)(e,t);a.appendChild(u);const d=(0,o.createStatusText)(n);return a.appendChild(d),l};const i=n(498),o=n(775),s=n(946),r=n(904)},346:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.featureFlags=t.performanceConfig=void 0,t.performanceConfig={scanIntervalMs:1e3,maxComponentStackDepth:100,memoryMeasurementIntervalMs:5e3},t.featureFlags={enableMutationObserver:!0,enableMemoryTracking:!0,enableComponentStack:!0,enableConsoleLogs:null===window||void 0===window?void 0:window.TEST_MEMORY_SCAN},t.config={performance:t.performanceConfig,features:t.featureFlags}},368:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createOverlayDiv=function(){const e=(0,i.createVisualizerElement)("div");return e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.id="memory-visualization-overlay",e};const i=n(498)},476:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getDOMElements=function(){const e=Array.from(document.querySelectorAll("*")),t=[];for(const n of e)(0,i.isVisualizerElement)(n)||t.push(new WeakRef(n));return t},t.getDOMElementCount=function(){const e=Array.from(document.querySelectorAll("*"));let t=0;for(const n of e)(0,i.isVisualizerElement)(n)||++t;return t},t.getMeaningfulName=function(e){return null==e||o(e)?null:e},t.isMinifiedName=o,t.addCountbyKey=function(e,t,n){var i;e.set(t,(null!==(i=e.get(t))&&void 0!==i?i:0)+n)},t.updateWeakRefList=function(e,t){!function(e){const t=[];for(const n of e)null!=n.deref()&&t.push(n);for(;e.length>0;)e.pop();for(const n of t)e.push(n)}(e);const n=function(e){const t=new Set;for(const n of e)t.add(n.deref());return t}(e);for(const i of t){const t=i.deref();null==t||n.has(t)||(n.add(t),e.push(new WeakRef(t)))}return e},t.getBoundingClientRect=function(e){if(null==e)return null;if("function"!=typeof e.getBoundingClientRect)return null;let t=null;try{t=e.getBoundingClientRect()}catch(e){}if(null==t)return null;const n=window.scrollY,i=window.scrollX,o={};return o.bottom=t.bottom,o.height=t.height,o.left=t.left,o.right=t.right,o.top=t.top,o.width=t.width,o.x=t.x,o.y=t.y,o.scrollLeft=i,o.scrollTop=n,o},t.consoleLog=function(...e){r.apply(s,e)},t.hasRunInSession=function(){if(!a())return!1;try{return"true"===sessionStorage.getItem(l)}catch(e){return!1}},t.setRunInSession=function(){if(a())try{sessionStorage.setItem(l,"true")}catch(e){}};const i=n(498);function o(e){return!(e.length>=5)&&(e.length<=3||!/[^a-zA-Z0-9$_]/.test(e)&&!/^[A-Z][a-z]+([A-Z][a-z]*)*$|^[a-z]+([A-Z][a-z]*)*$/.test(e))}const s=console,r=s.log,l="memory_lens_session";function a(){try{const e="__memory_lens_session_test__";return sessionStorage.setItem(e,"1"),sessionStorage.removeItem(e),!0}catch(e){return!1}}},498:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isVisualizerElement=function(e){return"true"===e.getAttribute(n)},t.createVisualizerElement=function(e){const t=document.createElement(e);return function(e){e.setAttribute(n,"true"),e.setAttribute("data-visualcompletion","ignore")}(t),t},t.tryToAttachOverlay=function(e){document.body&&document.body.appendChild(e)},t.addTrackedListener=function(e,t,n,o){var s;const r=e.deref();r&&(r.addEventListener(t,n,o),i.has(r)||i.set(r,[]),null===(s=i.get(r))||void 0===s||s.push({type:t,cb:n,options:o}))},t.removeAllListeners=function(e){const t=e.deref();if(!t)return;const n=i.get(t);if(n){for(const{type:e,cb:i,options:o}of n)t.removeEventListener(e,i,o);i.delete(t)}},t.debounce=function(e,t){let n=null;return(...i)=>{n&&clearTimeout(n),n=setTimeout((()=>{e(...i)}),t)}};const n="data-visualizer",i=new WeakMap},701:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createOverlayRectangle=function(e,t,n,i,s,c,u){var d,f;const h=t.boundingRect;if(!h)return null;const p=(0,o.createVisualizerElement)("div");p.style.position="absolute",p.style.width=`${h.width}px`,p.style.height=`${h.height}px`,p.style.top=`${h.top+h.scrollTop}px`,p.style.left=`${h.left+h.scrollLeft}px`,p.style.border="1px dotted rgba(75, 192, 192, 0.8)",p.style.borderRadius="1px",p.style.zIndex=u.toString();const v=null!==(f=(null!==(d=t.componentStack)&&void 0!==d?d:[])[0])&&void 0!==f?f:"";let m=!1,y=!1;const g=new WeakRef(p);return(0,o.addTrackedListener)(g,"mouseover",(()=>{var t;const n=`memory-id-${e}@`;l.remove(),null===(t=g.deref())||void 0===t||t.appendChild(l),l.textContent=`${v} (${n})`,l.style.display="inline-block",i(e)})),(0,o.addTrackedListener)(g,"mouseout",(()=>{l.style.display="none",l.remove(),s(e)})),(0,o.addTrackedListener)(g,"click",(()=>{c(e)})),p.__selected=()=>{y=!0,a(g,{selected:y,pinned:m})},p.__unselected=()=>{y=!1,a(g,{selected:y,pinned:m})},p.__pinned=()=>{m=!0,a(g,{selected:y,pinned:m})},p.__unpinned=()=>{m=!1,a(g,{selected:y,pinned:m})},r.observe(g,(e=>{e.isIntersecting?p.style.visibility="visible":p.style.visibility="hidden"})),p.__cleanup=()=>{const e=g.deref();null!=e&&((0,o.removeAllListeners)(g),r.unobserve(g),e.__cleanup=null,e.__selected=null,e.__unselected=null,e.__pinned=null,e.__unpinned=null)},n.appendChild(p),g};const i=n(979),o=n(498),s=""+(Math.pow(2,30)-1),r=i.IntersectionObserverManager.getInstance(),l=function(){const e=(0,o.createVisualizerElement)("div");return e.style.color="white",e.style.background="rgba(75, 192, 192, 0.8)",e.style.textShadow="none",e.style.font="9px Inter, system-ui, -apple-system, sans-serif",e.style.padding="2px 6px",e.style.borderRadius="2px",e.style.whiteSpace="nowrap",e.style.position="absolute",e.style.bottom="100%",e.style.left="0",e.style.marginBottom="2px",e.style.display="none",e.style.zIndex=s,e}();function a(e,t){const n=e.deref();if(null==n)return;const{pinned:i,selected:o}=t;i?(n.style.border="1px solid rgba(255, 215, 0, 0.9)",n.style.background="rgba(255, 215, 0, 0.08)"):o?(n.style.border="1px solid rgba(75, 192, 192, 0.8)",n.style.background="rgba(75, 192, 192, 0.02)"):(n.style.border="1px dotted rgba(75, 192, 192, 0.8)",n.style.background="")}},737:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.traverseFiber=t.getTopMostFiberWithChild=t.getTopMostHostFiber=t.getNearestHostFiber=t.isHostFiber=t.MutationMask=t.Visibility=t.Snapshot=t.Ref=t.ContentReset=t.ChildDeletion=t.Cloned=t.Update=t.Hydrating=t.DidCapture=t.Placement=t.PerformedWork=t.DEPRECATED_ASYNC_MODE_SYMBOL_STRING=t.CONCURRENT_MODE_SYMBOL_STRING=t.CONCURRENT_MODE_NUMBER=t.HostRoot=t.OffscreenComponent=t.LegacyHiddenComponent=t.Fragment=t.HostText=t.DehydratedSuspenseComponent=t.HostSingletonTag=t.HostHoistableTag=t.HostComponentTag=t.SimpleMemoComponentTag=t.MemoComponentTag=t.ForwardRefTag=t.OffscreenComponentTag=t.SuspenseComponentTag=t.ContextConsumerTag=t.FunctionComponentTag=t.ClassComponentTag=void 0,t.getFiberNodeFromElement=function(e){for(const t of s){const n=r(e).find((e=>e.startsWith(t)));if(n)return e[n]}return null},t.getReactComponentStack=function(e){const t=[],n=new Set;let i=e;for(;i&&!n.has(i);){n.add(i);const e=l(i);e&&t.push(e),i=i.return}return t},t.getDisplayNameOfFiberNode=l,t.isFunctionalComponent=function(e){return"function"==typeof(null==e?void 0:e.elementType)},t.extractReactComponentName=a;const i=n(476),o=n(847);t.ClassComponentTag=1,t.FunctionComponentTag=0,t.ContextConsumerTag=9,t.SuspenseComponentTag=13,t.OffscreenComponentTag=22,t.ForwardRefTag=11,t.MemoComponentTag=14,t.SimpleMemoComponentTag=15,t.HostComponentTag=5,t.HostHoistableTag=26,t.HostSingletonTag=27,t.DehydratedSuspenseComponent=18,t.HostText=6,t.Fragment=7,t.LegacyHiddenComponent=23,t.OffscreenComponent=22,t.HostRoot=3,t.CONCURRENT_MODE_NUMBER=60111,t.CONCURRENT_MODE_SYMBOL_STRING="Symbol(react.concurrent_mode)",t.DEPRECATED_ASYNC_MODE_SYMBOL_STRING="Symbol(react.async_mode)",t.PerformedWork=1,t.Placement=2,t.DidCapture=128,t.Hydrating=4096,t.Update=4,t.Cloned=8,t.ChildDeletion=16,t.ContentReset=32,t.Ref=512,t.Snapshot=1024,t.Visibility=8192,t.MutationMask=t.Placement|t.Update|t.ChildDeletion|t.ContentReset|t.Hydrating|t.Visibility|t.Snapshot,t.isHostFiber=e=>e.tag===t.HostComponentTag||e.tag===t.HostHoistableTag||e.tag===t.HostSingletonTag||"string"==typeof e.type,t.getNearestHostFiber=e=>{let n=(0,t.traverseFiber)(e,t.isHostFiber);return n||(n=(0,t.traverseFiber)(e,t.isHostFiber,!0)),n},t.getTopMostHostFiber=e=>{let n=null;return(0,t.traverseFiber)(e,(function(e){(0,t.isHostFiber)(e)&&(n=e)}),!0),n},t.getTopMostFiberWithChild=e=>{let n=null;return(0,t.traverseFiber)(e,(function(e){null!=e.child&&(n=e)}),!0),n},t.traverseFiber=(e,n,i=!1)=>{if(!e)return null;if(!0===n(e))return e;let o=i?e.return:e.child;for(;o;){const e=(0,t.traverseFiber)(o,n,i);if(e)return e;o=i?null:o.sibling}return null};const s=["__reactFiber$","__reactInternalInstance$","_reactRootContainer"],r=Object.getOwnPropertyNames.bind(Object);function l(e){var t,n,s,r;const l=null!==(t=e.type)&&void 0!==t?t:e.elementType;let c=null!==(n=null==l?void 0:l.displayName)&&void 0!==n?n:null==l?void 0:l.name;if(null==c)if(null==l?void 0:l.render){const e=null==l?void 0:l.render;c=null!==(s=null==e?void 0:e.displayName)&&void 0!==s?s:null==e?void 0:e.name}else(null==l?void 0:l.type)&&(c=null!==(r=l.type.displayName)&&void 0!==r?r:l.type.name);c||"function"!=typeof l||(c=l.name);const u=(0,i.getMeaningfulName)(a(c));return(0,o.isValidComponentName)(u)?u:null}function a(e){if("string"!=typeof e)return null;if(!e.includes("[")||!e.includes("]"))return e;const t=e.indexOf("["),n=e.indexOf("]");if(t>n)return e;const i=e.substring(t+1,n);return i.startsWith("from ")?i.substring(5):i}},775:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createStatusText=function(e){const t=(0,i.createVisualizerElement)("div");return t.style.marginLeft="10px",t.style.color="white",t.style.fontSize="10px",t.style.fontFamily="Inter, system-ui, sans-serif",t.style.overflow="hidden",t.style.whiteSpace="nowrap",t.style.textOverflow="ellipsis",t.textContent="",e((e=>{var n,i,s,r;const l=window.performance,a=null==l?void 0:l.memory,c=null!==(n=null==a?void 0:a.usedJSHeapSize)&&void 0!==n?n:0,u=null!==(i=null==a?void 0:a.totalJSHeapSize)&&void 0!==i?i:0,d=null!==(s=e.totalDOMElementsCount)&&void 0!==s?s:0,f=null!==(r=e.detachedDOMElementsCount)&&void 0!==r?r:0;t.textContent=`DOM: ${d} total, ${f} detached | Heap: ${o(c)} / ${o(u)}`})),t};const i=n(498);function o(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}},847:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidComponentName=function(e){return null!=e&&!n.has(e)};const n=new Set},860:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BasicExtension=void 0,t.BasicExtension=class{constructor(e){this.scanner=e}beforeScan(){}afterScan(e){}}},904:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createComponentStackPanel=function(e){const t=(0,i.createVisualizerElement)("div");t.style.width="100%",t.style.maxHeight="80vh",t.style.background="rgba(0, 0, 0, 0.5)",t.style.borderTop="1px solid rgba(255, 255, 255, 0.1)",t.style.display="none",t.style.flexDirection="column",t.style.padding="8px",t.style.boxSizing="border-box",t.style.borderRadius="8px",t.style.overflowY="scroll",t.style.overflowX="hidden",t.style.textShadow="none",t.style.font="9px Inter, system-ui, -apple-system, sans-serif",t.style.color="white",t.id="memory-visualization-component-stack-panel";let n=!1;return t.addEventListener("mouseenter",(()=>{n=!0})),t.addEventListener("mouseleave",(()=>{n=!1})),e((0,i.debounce)((e=>{var o;if(n)return;if(t.style.display=null!=e.selectedElementId?"flex":"none",t.innerHTML="",null==e.selectedElementId||!(null===(o=e.selectedReactComponentStack)||void 0===o?void 0:o.length))return;const s=(0,i.createVisualizerElement)("div");s.textContent="Component Stack:",s.style.fontWeight="bold",s.style.marginBottom="8px",t.appendChild(s);let r=0;e.selectedReactComponentStack.forEach((e=>{const n=(0,i.createVisualizerElement)("div");n.style.marginBottom="4px",n.textContent=e,t.appendChild(n),++r})),0===r&&s.remove()}),1)),t};const i=n(498)},933:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(n(282)),s=n(23),r=n(476);if(!(0,r.hasRunInSession)()){const e=new o.default({isDevMode:!0}),t=new s.DOMVisualizationExtension(e);e.registerExtension(t),e.start(),(0,r.setRunInSession)()}},946:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createToggleButton=function(e,t){const n=(0,i.createVisualizerElement)("div");n.style.width="40px",n.style.height="24px",n.style.borderRadius="9999px",n.style.backgroundColor="#34C759",n.style.cursor="pointer",n.style.position="relative",n.style.transition="background-color 0.3s ease";const o=(0,i.createVisualizerElement)("div");return o.style.width="18px",o.style.height="18px",o.style.backgroundColor="white",o.style.borderRadius="50%",o.style.position="absolute",o.style.top="3px",o.style.left="3px",o.style.transition="left 0.25s ease",n.appendChild(o),n.addEventListener("click",(()=>{t.value=!t.value,t.value?(e.style.display="none",e.style.pointerEvents="none",e.style.userSelect="none",o.style.left="19px",n.style.backgroundColor="#FF3B30"):(e.style.display="block",e.style.pointerEvents="auto",e.style.userSelect="auto",o.style.left="3px",n.style.backgroundColor="#34C759")})),n};const i=n(498)},953:function(e,t,n){var i,o,s,r,l,a,c,u=this&&this.__classPrivateFieldSet||function(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n},d=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.EventListenerTracker=void 0;const f=n(737),h=n(313);class p{constructor(){i.add(this),o.set(this,void 0),s.set(this,void 0),r.set(this,void 0),l.set(this,void 0),u(this,o,new h.WeakMapPlus({fallback:"noop",cleanupMs:100}),"f"),u(this,s,new Map,"f"),u(this,r,EventTarget.prototype.addEventListener,"f"),u(this,l,EventTarget.prototype.removeEventListener,"f"),d(this,i,"m",a).call(this)}static getInstance(){return p.instance||(p.instance=new p),p.instance}addListener(e,t,n,i){e.addEventListener(t,n,i)}removeListener(e,t,n,i){e.removeEventListener(t,n,i)}scan(e){const t=new Map;for(const[n,i]of d(this,o,"f").entries())if(n instanceof Element&&!n.isConnected)for(const o of i){if(!o.cb.deref())continue;const i=e(new WeakRef(n));t.has(i)||t.set(i,[]);const s=t.get(i);let r=null==s?void 0:s.find((e=>e.type===o.type));r||(r={type:o.type,count:0,entries:[]},null==s||s.push(r)),r.count++,r.entries.push(new WeakRef(o))}return u(this,s,t,"f"),t}getDetachedListeners(){return d(this,s,"f")}destroy(){d(this,i,"m",c).call(this),d(this,o,"f").destroy(),d(this,s,"f").clear(),p.instance=null}}t.EventListenerTracker=p,o=new WeakMap,s=new WeakMap,r=new WeakMap,l=new WeakMap,i=new WeakSet,a=function(){const e=this;EventTarget.prototype.addEventListener=function(t,n,i){var s;if(d(e,r,"f").call(this,t,n,i),this instanceof Element){const r=(0,f.getFiberNodeFromElement)(this),l={type:t,cb:new WeakRef(n),options:i,fiber:r?new WeakRef(r):void 0},a=null!==(s=d(e,o,"f").get(this))&&void 0!==s?s:[];a.push(l),d(e,o,"f").set(this,a)}},EventTarget.prototype.removeEventListener=function(t,n,i){if(d(e,l,"f").call(this,t,n,i),this instanceof Element){const s=d(e,o,"f").get(this);if(s){const r=s.findIndex((e=>e.type===t&&e.cb.deref()===n&&e.options===i));-1!==r&&s.splice(r,1),0===s.length?d(e,o,"f").delete(this):d(e,o,"f").set(this,s)}}}},c=function(){EventTarget.prototype.addEventListener=d(this,r,"f"),EventTarget.prototype.removeEventListener=d(this,l,"f")},p.instance=null},979:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IntersectionObserverManager=void 0;class n{constructor(){this.observedElements=new Map,this.observer=new IntersectionObserver((e=>{e.forEach((e=>{const t=e.target,n=this.observedElements.get(t);n&&n(e)}))}),{threshold:0,rootMargin:"50px"})}static getInstance(){return n.instance||(n.instance=new n),n.instance}observe(e,t){const n=e.deref();null!=n&&(this.observedElements.set(n,t),this.observer.observe(n))}unobserve(e){const t=e.deref();null!=t&&(this.observedElements.delete(t),this.observer.unobserve(t))}}t.IntersectionObserverManager=n}},t={};!function n(i){var o=t[i];if(void 0!==o)return o.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}(933)})();
1
+ /**
2
+ * @license MemLab
3
+ * MIT License
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ *
25
+ */
26
+ (()=>{"use strict";var e={23:function(e,t,n){var i,s=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMVisualizationExtension=void 0,r(n(150));const l=r(n(271)),a=n(860);class c extends a.BasicExtension{constructor(e){super(e),i.set(this,void 0),s(this,i,new l.default,"f")}afterScan(e){var t;const n=this.scanner;if(n.isDevMode()){const e=n.getDetachedDOMInfo();null===(t=o(this,i,"f"))||void 0===t||t.repaint(e)}}cleanup(){o(this,i,"f")&&"function"==typeof o(this,i,"f").cleanup&&o(this,i,"f").cleanup(),s(this,i,null,"f")}}t.DOMVisualizationExtension=c,i=new WeakMap},54:function(e,t,n){var i,s,o,r,l,a,c,u,d,f,h,p,v=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n},m=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMObserver=void 0;const y=n(313),g=n(498),b=(0,y.isWeakAPINative)(),w=void 0!==window.MutationObserver;t.DOMObserver=class{constructor(){i.add(this),s.set(this,void 0),o.set(this,void 0),r.set(this,void 0),l.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u.set(this,void 0),v(this,s,0,"f"),v(this,o,0,"f"),v(this,l,[],"f"),v(this,a,new WeakSet,"f"),v(this,u,[],"f"),this.startMonitoring()}register(e){m(this,u,"f").push(e)}startMonitoring(){if(!b||!w)return;if(null!=m(this,r,"f"))return;v(this,r,new MutationObserver((e=>{let t=[];const n=e=>{if(null==e)return;if(e.nodeType!=Node.ELEMENT_NODE)return;const n=e;if(!(0,g.isVisualizerElement)(n)){const e=m(this,i,"m",p).call(this,n);t=[...t,...e]}};e.forEach((e=>{e.addedNodes.forEach(n),e.removedNodes.forEach(n)})),m(this,u,"f").forEach((e=>e(t)))})),"f");const e=()=>{var t;document.body?null===(t=m(this,r,"f"))||void 0===t||t.observe(document.body,{childList:!0,subtree:!0}):setTimeout(e,0)};e(),v(this,c,window.setInterval((()=>{m(this,i,"m",d).call(this)}),3e3),"f")}stopMonitoring(){null!=m(this,r,"f")&&(m(this,r,"f").disconnect(),v(this,r,null,"f")),null!=m(this,c,"f")&&(window.clearInterval(m(this,c,"f")),v(this,c,null,"f"))}getDOMElements(){return[...m(this,l,"f")]}getStats(){try{v(this,s,m(this,i,"m",f).call(this),"f"),v(this,o,m(this,i,"m",h).call(this),"f")}catch(e){}return{elements:m(this,s,"f"),detachedElements:m(this,o,"f")}}},s=new WeakMap,o=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,i=new WeakSet,d=function(){const e=[],t=new Set;for(const n of m(this,l,"f")){const i=n.deref();null==i||t.has(i)||(e.push(n),t.add(i))}v(this,l,e,"f")},f=function(){var e,t;return v(this,s,null!==(t=null===(e=null===document||void 0===document?void 0:document.getElementsByTagName("*"))||void 0===e?void 0:e.length)&&void 0!==t?t:0,"f")},h=function(){let e=0;for(const t of m(this,l,"f")){const n=t.deref();n&&!1===n.isConnected&&++e}return v(this,o,e,"f")},p=function(e){const t=[e],n=new Set,i=[];for(;t.length>0;){const e=t.pop();if(null==e||n.has(e))continue;if((null==e?void 0:e.nodeType)!==Node.ELEMENT_NODE)continue;const s=e;if((0,g.isVisualizerElement)(s))continue;if(n.add(s),!m(this,a,"f").has(s)){const e=new WeakRef(s);m(this,l,"f").push(e),m(this,a,"f").add(s),i.push(e)}const o=s.childNodes;for(let e=0;e<o.length;++e)t.push(o[e])}return i}},150:function(e,t,n){var i,s,o,r,l,a,c,u,d=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n},f=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0});const h=n(498);t.default=class{constructor(){i.add(this),s.set(this,void 0),d(this,s,null,"f")}cleanup(){f(this,i,"m",u).call(this)}repaint(e){f(this,i,"m",u).call(this),f(this,i,"m",o).call(this,e)}},s=new WeakMap,i=new WeakSet,o=function(e){if(!f(this,s,"f")){const e=f(this,i,"m",l).call(this);d(this,s,e,"f")}f(this,i,"m",c).call(this,e)},r=function(e){document.body&&document.body.appendChild(e)},l=function(){const e=(0,h.createVisualizerElement)("canvas");return e.id="overlayCanvas",f(this,i,"m",r).call(this,e),e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="none",e.style.zIndex="99999",e.width=window.innerWidth,e.height=window.innerHeight,e},a=function(e){const{boundingRect:t}=e;return JSON.stringify({boundingRect:t})},c=function(e){const t=f(this,s,"f");if(!t)return;const n=t.getContext("2d");if(null==n)return;n.strokeStyle="rgba(75, 192, 192, 0.8)",n.lineWidth=2,n.fillStyle="rgba(75, 192, 192, 0.05)",n.font="11px Inter, system-ui, -apple-system, sans-serif";const o=new Set;e.forEach((e=>{var t;const s=e.boundingRect;if(null==s)return;const r=f(this,i,"m",a).call(this,e);if(o.has(r))return;o.add(r),n.fillRect(s.left,s.top,s.width,s.height),n.strokeRect(s.left,s.top,s.width,s.height);const l=null===(t=e.componentStack)||void 0===t?void 0:t[0];if(l){const t=e.element.deref(),i=null==t?void 0:t.detachedElementId,o=`${l}${i?` (${i})`:""}`;n.fillStyle="rgba(74, 131, 224, 1)",n.fillText(o,s.left+5,s.top+15),n.fillStyle="rgba(75, 192, 192, 0.05)"}}))},u=function(){var e;const t=f(this,s,"f");if(t){const n=t.getContext("2d");null==n||n.clearRect(0,0,t.width,t.height),null===(e=t.parentNode)||void 0===e||e.removeChild(t)}d(this,s,null,"f")}},271:function(e,t,n){var i,s,o,r,l,a,c,u,d,f,h,p,v,m,y,g,b,w,M=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n},k=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},E=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const _=E(n(150)),C=n(368),O=n(341),S=n(701),T=n(476),W=n(498);class x extends _.default{constructor(){super(),i.add(this),s.set(this,void 0),o.set(this,void 0),r.set(this,void 0),l.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u.set(this,[]),M(this,c,{value:!1},"f"),M(this,o,(0,C.createOverlayDiv)(),"f"),(0,W.tryToAttachOverlay)(k(this,o,"f")),M(this,r,(0,O.createControlWidget)(k(this,o,"f"),k(this,c,"f"),(e=>{k(this,u,"f").push(e)})),"f"),(0,W.tryToAttachOverlay)(k(this,r,"f")),M(this,s,new Map,"f"),M(this,a,k(this,i,"m",f).call(this),"f"),M(this,l,new Set,"f"),k(this,i,"m",d).call(this)}repaint(e){k(this,o,"f").remove(),k(this,i,"m",y).call(this,e),k(this,i,"m",b).call(this,e),k(this,i,"m",w).call(this),(0,W.tryToAttachOverlay)(k(this,o,"f"))}cleanup(){k(this,o,"f")&&k(this,o,"f").remove(),k(this,r,"f")&&k(this,r,"f").remove(),k(this,s,"f").clear(),k(this,l,"f").clear(),M(this,u,[],"f"),super.cleanup()}}t.default=x,s=new WeakMap,o=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,i=new WeakSet,d=function(){document.addEventListener("keydown",(e=>{"d"!==e.key&&"D"!==e.key||null!=k(this,a,"f").selectedElementId&&k(this,l,"f").add(k(this,a,"f").selectedElementId)}))},f=function(){const e={detachedDOMElementsCount:0,totalDOMElementsCount:(0,T.getDOMElementCount)(),selectedElementId:null,selectedReactComponentStack:[],pinnedElementId:null,setPinnedElementId:t=>{var n,s;if(e.pinnedElementId==t)return;const o=k(this,i,"m",h).call(this,e.pinnedElementId);null===(n=null==o?void 0:o.__unpinned)||void 0===n||n.call(o);const r=k(this,i,"m",h).call(this,t);null===(s=null==r?void 0:r.__pinned)||void 0===s||s.call(r),e.pinnedElementId=t}};return e},h=function(e){if(null==e)return null;const t=k(this,s,"f").get(e);return null==t?null:t.visualizerElementRef.deref()},p=function(e){const t=new Set;for(const n of e){const e=n.element.deref();if(null==e)continue;const i=e.detachedElementId;null!=i&&t.add(i)}return t},v=function(e,t){const n=k(this,s,"f").get(e);if(null==n)return;const i=new Set;let o=n.elementInfo.element.deref();for(;o&&!o.isConnected;){const e=o.detachedElementId,n=parseInt(e,10);if(i.has(n))break;i.add(n);const r=k(this,s,"f").get(n);if(null==r)break;const l=r.visualizerElementRef.deref();if(null==l)break;t(l),o=o.parentElement}},m=function(e){var t;const n=k(this,s,"f").get(e);if(k(this,s,"f").delete(e),null==n)return;const i=n.visualizerElementRef.deref();null!=i&&(null===(t=null==i?void 0:i.__cleanup)||void 0===t||t.call(i),i.remove())},y=function(e){for(const[e,t]of k(this,s,"f").entries())null!=e&&null==t.elementInfo.element.deref()&&k(this,i,"m",m).call(this,e);const t=k(this,i,"m",p).call(this,e);for(const[e]of k(this,s,"f").entries())null!=e&&(t.has(e)&&!k(this,l,"f").has(e)||k(this,i,"m",m).call(this,e))},g=function(e){var t;const n=e.element.deref();if(null==n)return 0;const i=n.detachedElementId;if(null==i)return 0;const s=null!==(t=e.boundingRect)&&void 0!==t?t:{width:50,height:50};let o=9999;return o+=parseInt(i,10),o+=Math.floor(1e7/(s.width*s.height)),o},b=function(e){for(const t of e){const e=t.element.deref();if(null==e)continue;const n=e.detachedElementId;if(null==n)continue;if(k(this,l,"f").has(n))continue;if(k(this,s,"f").has(n))continue;if(null==e)continue;if(e.isConnected)continue;const r=k(this,i,"m",g).call(this,t),c=(0,S.createOverlayRectangle)(n,t,k(this,o,"f"),(e=>{k(this,a,"f").selectedElementId=e,k(this,i,"m",w).call(this),null!=e&&k(this,i,"m",v).call(this,e,(e=>{var t;null===(t=null==e?void 0:e.__selected)||void 0===t||t.call(e)}))}),(e=>{k(this,a,"f").selectedElementId===e&&(k(this,a,"f").selectedElementId=null,k(this,i,"m",w).call(this)),null!=e&&k(this,i,"m",v).call(this,e,(e=>{var t;null===(t=null==e?void 0:e.__unselected)||void 0===t||t.call(e)}))}),(e=>{k(this,a,"f").pinnedElementId===e?k(this,a,"f").setPinnedElementId(null):k(this,a,"f").setPinnedElementId(e),k(this,i,"m",w).call(this)}),r);if(null==c||null==c.deref())return null;const u={elementInfo:t,visualizerElementRef:c};k(this,s,"f").set(n,u)}},w=function(){var e,t,n;const i=k(this,a,"f");null!=i.pinnedElementId&&(i.selectedElementId=i.pinnedElementId),i.detachedDOMElementsCount=k(this,s,"f").size,i.totalDOMElementsCount=(0,T.getDOMElementCount)();const o=null===(t=k(this,s,"f").get(null!==(e=i.selectedElementId)&&void 0!==e?e:-1))||void 0===t?void 0:t.elementInfo;i.selectedReactComponentStack=null!==(n=null==o?void 0:o.componentStack)&&void 0!==n?n:[];for(const e of k(this,u,"f"))e(Object.assign({},k(this,a,"f")))}},282:function(e,t,n){var i,s,o,r,l,a,c,u,d,f,h,p,v,m,y,g,b,w,M,k,E,_,C,O,S=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,s)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),T=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),W=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&S(t,e,n);return T(t,e),t},x=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n},I=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},R=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n},N=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const P=W(n(476)),F=N(n(302)),D=n(737),L=n(54),j=n(346),z=n(953);class H{constructor(e={}){var t,n,g,b;i.add(this),s.set(this,void 0),o.set(this,void 0),r.set(this,void 0),l.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u.set(this,void 0),d.set(this,void 0),f.set(this,void 0),h.set(this,void 0),p.set(this,void 0),v.set(this,void 0),m.set(this,void 0),y.set(this,void 0),x(this,s,[],"f"),x(this,o,!1,"f"),x(this,l,new WeakMap,"f"),x(this,a,new WeakMap,"f"),x(this,c,[],"f"),x(this,m,e.trackEventListenerLeaks?z.EventListenerTracker.getInstance():null,"f"),x(this,r,null,"f"),x(this,y,!1,"f"),x(this,u,new F.default,"f"),x(this,d,null!==(t=e.isDevMode)&&void 0!==t&&t,"f"),x(this,f,null!==(n=e.subscribers)&&void 0!==n?n:[],"f"),x(this,h,null!==(g=e.extensions)&&void 0!==g?g:[],"f"),x(this,p,null!==(b=e.scanIntervalMs)&&void 0!==b?b:j.config.performance.scanIntervalMs,"f")}subscribe(e){return I(this,f,"f").push(e),()=>this.unsubscribe(e)}unsubscribe(e){x(this,f,I(this,f,"f").filter((t=>t!==e)),"f")}registerExtension(e){return I(this,h,"f").push(e),()=>this.unregisterExtension(e)}unregisterExtension(e){x(this,h,I(this,h,"f").filter((t=>t!==e)),"f")}start(){I(this,y,"f")?console.warn("[Memory] ReactMemoryScan has been disposed and cannot be started again"):(x(this,o,!0,"f"),x(this,r,setInterval(I(this,i,"m",k).bind(this),I(this,p,"f")),"f"),j.config.features.enableMutationObserver&&(null==I(this,v,"f")&&x(this,v,new L.DOMObserver,"f"),I(this,v,"f").startMonitoring()),console.log("[Memory] Tracking React and DOM memory..."))}pause(){x(this,o,!1,"f")}stop(){x(this,o,!1,"f"),null!==I(this,r,"f")&&(clearInterval(I(this,r,"f")),x(this,r,null,"f")),x(this,s,[],"f"),x(this,c,[],"f"),I(this,v,"f")&&(I(this,v,"f").stopMonitoring(),x(this,v,null,"f")),x(this,l,new WeakMap,"f"),x(this,a,new WeakMap,"f"),console.log("[Memory] ReactMemoryScan stopped")}dispose(){this.stop(),x(this,f,[],"f");for(const e of I(this,h,"f"))e&&"function"==typeof e.cleanup&&e.cleanup();x(this,h,[],"f"),I(this,m,"f")&&(I(this,m,"f").destroy(),x(this,m,null,"f")),x(this,y,!0,"f"),console.log("[Memory] ReactMemoryScan disposed")}recordBoundingRectangles(e){for(const t of e){const e=t.deref();if(null==e||I(this,l,"f").has(e))continue;const n=P.getBoundingClientRect(e);null!=n&&I(this,l,"f").set(e,n)}}getDetachedDOMInfo(){var e;const t=[];for(const n of I(this,s,"f")){const i=n.deref();if(null==i||i.isConnected)continue;const s=i;if(null==s.detachedElementId){const e=H.nextElementId++;s.detachedElementIdStr=`memory-id-${e}@`,s.detachedElementId=e}const o=null!==(e=I(this,a,"f").get(i))&&void 0!==e?e:[];t.push({element:n,boundingRect:I(this,l,"f").get(i),componentStack:o})}return t}isDevMode(){return I(this,d,"f")}getCachedComponentName(e){var t;const n="<Unknown>",i=e.deref();if(null==i)return n;const s=I(this,a,"f").get(i);return null==s?n:null!==(t=s[0])&&void 0!==t?t:n}updateFiberNodes(e){const t=new WeakSet;for(const e of I(this,c,"f")){const n=e.deref();null!=n&&t.add(n)}const n=new WeakSet;for(const t of e){const e=t.deref();null!=e&&n.add(e)}const s=[],o=[];for(const e of I(this,c,"f")){const t=e.deref();null!=t&&(n.has(t)?(o.push(e),null==t.return&&s.push(e)):s.push(e))}for(const n of e){const e=n.deref();null!=e&&(t.has(e)||o.push(n))}return x(this,c,o,"f"),I(this,i,"m",g).call(this,"known fibers: ",I(this,c,"f").length),I(this,i,"m",g).call(this,"leaked fibers: ",s.length),s}packLeakedFibers(e){const t=[];for(const n of e)t.push(new B(n));return t}scan(){const e=Date.now();I(this,i,"m",C).call(this);const t=I(this,s,"f"),n=I(this,i,"m",_).call(this);I(this,i,"m",E).call(this,n),this.recordBoundingRectangles(n),P.updateWeakRefList(t,n);const o=I(this,u,"f").scan(t,I(this,a,"f")),r=this.updateFiberNodes(o.fiberNodes);o.leakedFibers=r,o.eventListenerLeaks=I(this,i,"m",O).call(this),window.leakedFibers=this.packLeakedFibers(r);const l=Date.now();return I(this,i,"m",g).call(this,`scan took ${l-e}ms`),o}}t.default=H,s=new WeakMap,o=new WeakMap,r=new WeakMap,l=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,y=new WeakMap,i=new WeakSet,g=function(...e){I(this,d,"f")&&j.config.features.enableConsoleLogs&&P.consoleLog(...e)},b=function(e){for(const t of I(this,f,"f"))t(e);const t=e.end-e.start;I(this,i,"m",g).call(this,"duration: ",`${t} ms`);const{scanner:n,leakedFibers:s,fiberNodes:o}=e,r=R(e,["scanner","leakedFibers","fiberNodes"]);I(this,i,"m",g).call(this,r)},w=function(){for(const e of I(this,h,"f"))null==e||e.beforeScan()},M=function(e){for(const t of I(this,h,"f"))null==t||t.afterScan(e)},k=function(){if(!I(this,o,"f"))return;I(this,i,"m",w).call(this);const e=performance.now(),t=this.scan(),n=performance.now(),s=Object.assign(Object.assign({},t),{start:e,end:n,scanner:this});I(this,i,"m",b).call(this,s),I(this,i,"m",M).call(this,s)},E=function(e){for(const t of e){const e=t.deref();if(null==e||I(this,a,"f").has(e))continue;const n=(0,D.getFiberNodeFromElement)(e);null!=n&&I(this,a,"f").set(e,(0,D.getReactComponentStack)(n))}},_=function(){return null==I(this,v,"f")?P.getDOMElements():[...P.getDOMElements(),...I(this,v,"f").getDOMElements()]},C=function(){null!=(null===window||void 0===window?void 0:window.gc)&&window.gc()},O=function(){var e;if(null==I(this,m,"f"))return[];const t=I(this,m,"f").scan(this.getCachedComponentName.bind(this)),n=[];for(const[i,s]of t.entries()){const t=new Map;for(const n of s){const i=null!==(e=t.get(n.type))&&void 0!==e?e:0;t.set(n.type,i+1)}for(const[e,s]of t.entries())n.push({type:e,componentName:i,count:s})}return n},H.nextElementId=0;class B{constructor(e){this.leakedFiber=e}}},302:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,s)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const r=o(n(476)),l=n(737),a=n(847);t.default=class{scan(e,t){var n;const i=new Set,s=new Set,o=new Map,c=new Map,u=new Set,d=new Set,f=[];let h=0,p=0;function v(e){(0,l.traverseFiber)(e,(e=>{if(d.has(e))return!0;d.add(e);const t=(0,l.getDisplayNameOfFiberNode)(e);return null!=t&&(0,a.isValidComponentName)(t)?(s.add(t),r.addCountbyKey(o,t,1),!0):void 0}),!0)}for(const s of e){const e=s.deref();if(null==e)continue;if(++h,!e.isConnected){if(t.has(e)){const i=(null!==(n=t.get(e))&&void 0!==n?n:[])[0];e.__component_name=i,r.addCountbyKey(c,i,1)}++p}const o=(0,l.getFiberNodeFromElement)(e);if(null==o)continue;v(o);const a=(0,l.getTopMostFiberWithChild)(o);null!=a&&(i.has(a)||(i.add(a),(0,l.traverseFiber)(a,(e=>{if(u.has(e))return!0;u.add(e),f.push(new WeakRef(e)),v(e)}),!1)))}return u.clear(),d.clear(),i.clear(),{components:s,componentToFiberNodeCount:o,totalElements:h,totalDetachedElements:p,detachedComponentToFiberNodeCount:c,fiberNodes:f,leakedFibers:[]}}}},313:(e,t)=>{var n,i,s;Object.defineProperty(t,"__esModule",{value:!0}),t.WeakMapPlus=t.isWeakAPINative=t.isWeakRefNative=t.isWeakSetNative=t.isWeakMapNative=t.getNativeWeakRefOrFallback=t.getNativeWeakRef=t.getNativeWeakSetOrFallback=t.getNativeWeakSet=t.getNativeWeakMapOrFallback=t.getNativeWeakMap=t.WeakMapNoOp=t.WeakSetNoOp=t.WeakRefNoOp=void 0;const o="undefined"!=typeof window?window:self,r=null!==(n=o.WeakMap)&&void 0!==n?n:null,l=y(),a=null!==(i=o.WeakSet)&&void 0!==i?i:null,c=g(),u=null!==(s=o.WeakRef)&&void 0!==s?s:null,d=b(),f=l&&c&&d;class h{constructor(e){}deref(){}}t.WeakRefNoOp=h;class p{constructor(e){}add(e){return this}delete(e){return!1}has(e){return!1}}t.WeakSetNoOp=p;class v{constructor(e){}delete(e){return!1}get(e){}has(e){return!1}set(e,t){return this}}function m(e){return"function"==typeof e.replace?e.replace(/\n/g," ").replace(/\s+/g," "):null}function y(){return null!==r&&"function"==typeof r.toString&&"function WeakMap() { [native code] }"===m(r.toString())}function g(){return null!==a&&"function"==typeof a.toString&&"function WeakSet() { [native code] }"===m(a.toString())}function b(){return null!==u&&"function"==typeof u.toString&&"function WeakRef() { [native code] }"===m(u.toString())}t.WeakMapNoOp=v,t.getNativeWeakMap=function(){return l?r:null},t.getNativeWeakMapOrFallback=function(){return l&&r?r:v},t.getNativeWeakSet=function(){return c?a:null},t.getNativeWeakSetOrFallback=function(){return c&&a?a:p},t.getNativeWeakRef=function(){return d?u:null},t.getNativeWeakRefOrFallback=function(){return d&&u?u:h},t.isWeakMapNative=y,t.isWeakSetNative=g,t.isWeakRefNative=b,t.isWeakAPINative=function(){return f};class w{constructor(e={}){this.strongMap=null,this.noopMap=!1,this.entriesMap=new Map,this.keyToId=new WeakMap;const{fallback:t="strong",cleanupMs:n=1e3}=e;this.isWeak=f,this.fallbackMode=t,this.isWeak?this.cleanupInterval=setInterval((()=>this.cleanup()),n):("strong"===t?this.strongMap=new Map:"noop"===t&&(this.noopMap=!0),this.cleanupInterval=-1)}getOrCreateId(e){let t=this.keyToId.get(e);return t||(t=Symbol(),this.keyToId.set(e,t)),t}set(e,t){var n;if(!this.isWeak)return this.noopMap||null===(n=this.strongMap)||void 0===n||n.set(e,t),this;const i=this.getOrCreateId(e);return this.entriesMap.set(i,{ref:new WeakRef(e),value:t}),this}get(e){var t,n;if(!this.isWeak){if(this.noopMap)return;return null===(t=this.strongMap)||void 0===t?void 0:t.get(e)}const i=this.keyToId.get(e);if(!i)return;const s=this.entriesMap.get(i);return(null===(n=null==s?void 0:s.ref)||void 0===n?void 0:n.deref())?null==s?void 0:s.value:void 0}has(e){var t,n;if(!this.isWeak)return!this.noopMap&&null!==(n=null===(t=this.strongMap)||void 0===t?void 0:t.has(e))&&void 0!==n&&n;const i=this.keyToId.get(e);if(!i)return!1;const s=this.entriesMap.get(i);return!(!s||!s.ref.deref())}delete(e){var t,n;if(!this.isWeak)return!this.noopMap&&null!==(n=null===(t=this.strongMap)||void 0===t?void 0:t.delete(e))&&void 0!==n&&n;const i=this.keyToId.get(e);return!!i&&(this.keyToId.delete(e),this.entriesMap.delete(i))}*liveEntries(){for(const[,e]of this.entriesMap){const t=e.ref.deref();t&&(yield[t,e.value])}}entries(){var e,t;return this.isWeak?this.liveEntries():this.noopMap?[][Symbol.iterator]():null!==(t=null===(e=this.strongMap)||void 0===e?void 0:e.entries())&&void 0!==t?t:[][Symbol.iterator]()}keys(){return function*(e){for(const[t]of e.entries())yield t}(this)}values(){return function*(e){for(const[,t]of e.entries())yield t}(this)}[Symbol.iterator](){return this.entries()}get size(){var e,t;if(!this.isWeak)return this.noopMap?0:null!==(t=null===(e=this.strongMap)||void 0===e?void 0:e.size)&&void 0!==t?t:0;let n=0;for(const e of this.liveEntries())n++;return n}getFallbackMode(){return this.fallbackMode}cleanup(){if(this.isWeak)for(const[e,t]of this.entriesMap)t.ref.deref()||this.entriesMap.delete(e)}destroy(){this.isWeak&&clearInterval(this.cleanupInterval)}}t.WeakMapPlus=w},341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createControlWidget=void 0;const i=n(498),s=n(775),o=n(946),r=n(904);t.createControlWidget=function(e,t,n){const l=(0,i.createVisualizerElement)("div");l.style.position="fixed",l.style.top="50px",l.style.right="50px",l.style.width="400px",l.style.background="rgba(0, 0, 0, 0.7)",l.style.border="none",l.style.borderRadius="8px",l.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.3)",l.style.zIndex="999999999",l.style.display="flex",l.style.flexDirection="column",l.style.textShadow="none",l.style.boxSizing="border-box",l.style.font="9px Inter, system-ui, -apple-system, sans-serif",l.id="memory-visualization-control-widget";const a=(0,i.createVisualizerElement)("div");a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="flex-start",a.style.padding="0 8px",a.style.height="36px",l.appendChild(a);const c=(0,r.createComponentStackPanel)(n);l.appendChild(c),function(e){let t=!1,n=0,i=0;e.addEventListener("mousedown",(s=>{s.target.closest("#memory-visualization-control-widget > div:first-child")&&(t=!0,n=s.clientX-e.offsetLeft,i=s.clientY-e.offsetTop,e.style.cursor="move")})),document.addEventListener("mousemove",(s=>{t&&(e.style.left=s.clientX-n+"px",e.style.top=s.clientY-i+"px",e.style.right="")})),document.addEventListener("mouseup",(()=>{t=!1,e.style.cursor="default"}))}(l);const u=(0,o.createToggleButton)(e,t);a.appendChild(u);const d=(0,s.createStatusText)(n);return a.appendChild(d),l}},346:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.featureFlags=t.performanceConfig=void 0,t.performanceConfig={scanIntervalMs:1e3,maxComponentStackDepth:100,memoryMeasurementIntervalMs:5e3},t.featureFlags={enableMutationObserver:!0,enableMemoryTracking:!0,enableComponentStack:!0,enableConsoleLogs:null===window||void 0===window?void 0:window.TEST_MEMORY_SCAN},t.config={performance:t.performanceConfig,features:t.featureFlags}},368:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createOverlayDiv=void 0;const i=n(498);t.createOverlayDiv=function(){const e=(0,i.createVisualizerElement)("div");return e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.id="memory-visualization-overlay",e}},476:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setRunInSession=t.hasRunInSession=t.consoleLog=t.getBoundingClientRect=t.updateWeakRefList=t.addCountbyKey=t.isMinifiedName=t.getMeaningfulName=t.getDOMElementCount=t.getDOMElements=void 0;const i=n(498);function s(e){return!(e.length>=5)&&(e.length<=3||!/[^a-zA-Z0-9$_]/.test(e)&&!/^[A-Z][a-z]+([A-Z][a-z]*)*$|^[a-z]+([A-Z][a-z]*)*$/.test(e))}t.getDOMElements=function(){const e=Array.from(document.querySelectorAll("*")),t=[];for(const n of e)(0,i.isVisualizerElement)(n)||t.push(new WeakRef(n));return t},t.getDOMElementCount=function(){const e=Array.from(document.querySelectorAll("*"));let t=0;for(const n of e)(0,i.isVisualizerElement)(n)||++t;return t},t.getMeaningfulName=function(e){return null==e||s(e)?null:e},t.isMinifiedName=s,t.addCountbyKey=function(e,t,n){var i;e.set(t,(null!==(i=e.get(t))&&void 0!==i?i:0)+n)},t.updateWeakRefList=function(e,t){!function(e){const t=[];for(const n of e)null!=n.deref()&&t.push(n);for(;e.length>0;)e.pop();for(const n of t)e.push(n)}(e);const n=function(e){const t=new Set;for(const n of e)t.add(n.deref());return t}(e);for(const i of t){const t=i.deref();null==t||n.has(t)||(n.add(t),e.push(new WeakRef(t)))}return e},t.getBoundingClientRect=function(e){if(null==e)return null;if("function"!=typeof e.getBoundingClientRect)return null;let t=null;try{t=e.getBoundingClientRect()}catch(e){}if(null==t)return null;const n=window.scrollY,i=window.scrollX,s={};return s.bottom=t.bottom,s.height=t.height,s.left=t.left,s.right=t.right,s.top=t.top,s.width=t.width,s.x=t.x,s.y=t.y,s.scrollLeft=i,s.scrollTop=n,s};const o=console,r=o.log;t.consoleLog=function(...e){r.apply(o,e)};const l="memory_lens_session";function a(){try{const e="__memory_lens_session_test__";return sessionStorage.setItem(e,"1"),sessionStorage.removeItem(e),!0}catch(e){return!1}}t.hasRunInSession=function(){if(!a())return!1;try{return"true"===sessionStorage.getItem(l)}catch(e){return!1}},t.setRunInSession=function(){if(a())try{sessionStorage.setItem(l,"true")}catch(e){}}},498:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=t.removeAllListeners=t.addTrackedListener=t.tryToAttachOverlay=t.createVisualizerElement=t.isVisualizerElement=void 0;const n="data-visualizer";t.isVisualizerElement=function(e){return"true"===e.getAttribute(n)},t.createVisualizerElement=function(e){const t=document.createElement(e);return function(e){e.setAttribute(n,"true"),e.setAttribute("data-visualcompletion","ignore")}(t),t},t.tryToAttachOverlay=function(e){document.body&&document.body.appendChild(e)};const i=new WeakMap;t.addTrackedListener=function(e,t,n,s){var o;const r=e.deref();r&&(r.addEventListener(t,n,s),i.has(r)||i.set(r,[]),null===(o=i.get(r))||void 0===o||o.push({type:t,cb:n,options:s}))},t.removeAllListeners=function(e){const t=e.deref();if(!t)return;const n=i.get(t);if(n){for(const{type:e,cb:i,options:s}of n)t.removeEventListener(e,i,s);i.delete(t)}},t.debounce=function(e,t){let n=null;return(...i)=>{n&&clearTimeout(n),n=setTimeout((()=>{e(...i)}),t)}}},701:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createOverlayRectangle=void 0;const i=n(979),s=n(498),o=""+(Math.pow(2,30)-1),r=i.IntersectionObserverManager.getInstance(),l=function(){const e=(0,s.createVisualizerElement)("div");return e.style.color="white",e.style.background="rgba(75, 192, 192, 0.8)",e.style.textShadow="none",e.style.font="9px Inter, system-ui, -apple-system, sans-serif",e.style.padding="2px 6px",e.style.borderRadius="2px",e.style.whiteSpace="nowrap",e.style.position="absolute",e.style.bottom="100%",e.style.left="0",e.style.marginBottom="2px",e.style.display="none",e.style.zIndex=o,e}();function a(e,t){const n=e.deref();if(null==n)return;const{pinned:i,selected:s}=t;i?(n.style.border="1px solid rgba(255, 215, 0, 0.9)",n.style.background="rgba(255, 215, 0, 0.08)"):s?(n.style.border="1px solid rgba(75, 192, 192, 0.8)",n.style.background="rgba(75, 192, 192, 0.02)"):(n.style.border="1px dotted rgba(75, 192, 192, 0.8)",n.style.background="")}t.createOverlayRectangle=function(e,t,n,i,o,c,u){var d,f;const h=t.boundingRect;if(!h)return null;const p=(0,s.createVisualizerElement)("div");p.style.position="absolute",p.style.width=`${h.width}px`,p.style.height=`${h.height}px`,p.style.top=`${h.top+h.scrollTop}px`,p.style.left=`${h.left+h.scrollLeft}px`,p.style.border="1px dotted rgba(75, 192, 192, 0.8)",p.style.borderRadius="1px",p.style.zIndex=u.toString();const v=null!==(f=(null!==(d=t.componentStack)&&void 0!==d?d:[])[0])&&void 0!==f?f:"";let m=!1,y=!1;const g=new WeakRef(p);return(0,s.addTrackedListener)(g,"mouseover",(()=>{var t;const n=`memory-id-${e}@`;l.remove(),null===(t=g.deref())||void 0===t||t.appendChild(l),l.textContent=`${v} (${n})`,l.style.display="inline-block",i(e)})),(0,s.addTrackedListener)(g,"mouseout",(()=>{l.style.display="none",l.remove(),o(e)})),(0,s.addTrackedListener)(g,"click",(()=>{c(e)})),p.__selected=()=>{y=!0,a(g,{selected:y,pinned:m})},p.__unselected=()=>{y=!1,a(g,{selected:y,pinned:m})},p.__pinned=()=>{m=!0,a(g,{selected:y,pinned:m})},p.__unpinned=()=>{m=!1,a(g,{selected:y,pinned:m})},r.observe(g,(e=>{e.isIntersecting?p.style.visibility="visible":p.style.visibility="hidden"})),p.__cleanup=()=>{const e=g.deref();null!=e&&((0,s.removeAllListeners)(g),r.unobserve(g),e.__cleanup=null,e.__selected=null,e.__unselected=null,e.__pinned=null,e.__unpinned=null)},n.appendChild(p),g}},737:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extractReactComponentName=t.isFunctionalComponent=t.getDisplayNameOfFiberNode=t.getReactComponentStack=t.getFiberNodeFromElement=t.traverseFiber=t.getTopMostFiberWithChild=t.getTopMostHostFiber=t.getNearestHostFiber=t.isHostFiber=t.MutationMask=t.Visibility=t.Snapshot=t.Ref=t.ContentReset=t.ChildDeletion=t.Cloned=t.Update=t.Hydrating=t.DidCapture=t.Placement=t.PerformedWork=t.DEPRECATED_ASYNC_MODE_SYMBOL_STRING=t.CONCURRENT_MODE_SYMBOL_STRING=t.CONCURRENT_MODE_NUMBER=t.HostRoot=t.OffscreenComponent=t.LegacyHiddenComponent=t.Fragment=t.HostText=t.DehydratedSuspenseComponent=t.HostSingletonTag=t.HostHoistableTag=t.HostComponentTag=t.SimpleMemoComponentTag=t.MemoComponentTag=t.ForwardRefTag=t.OffscreenComponentTag=t.SuspenseComponentTag=t.ContextConsumerTag=t.FunctionComponentTag=t.ClassComponentTag=void 0;const i=n(476),s=n(847);t.ClassComponentTag=1,t.FunctionComponentTag=0,t.ContextConsumerTag=9,t.SuspenseComponentTag=13,t.OffscreenComponentTag=22,t.ForwardRefTag=11,t.MemoComponentTag=14,t.SimpleMemoComponentTag=15,t.HostComponentTag=5,t.HostHoistableTag=26,t.HostSingletonTag=27,t.DehydratedSuspenseComponent=18,t.HostText=6,t.Fragment=7,t.LegacyHiddenComponent=23,t.OffscreenComponent=22,t.HostRoot=3,t.CONCURRENT_MODE_NUMBER=60111,t.CONCURRENT_MODE_SYMBOL_STRING="Symbol(react.concurrent_mode)",t.DEPRECATED_ASYNC_MODE_SYMBOL_STRING="Symbol(react.async_mode)",t.PerformedWork=1,t.Placement=2,t.DidCapture=128,t.Hydrating=4096,t.Update=4,t.Cloned=8,t.ChildDeletion=16,t.ContentReset=32,t.Ref=512,t.Snapshot=1024,t.Visibility=8192,t.MutationMask=t.Placement|t.Update|t.ChildDeletion|t.ContentReset|t.Hydrating|t.Visibility|t.Snapshot,t.isHostFiber=e=>e.tag===t.HostComponentTag||e.tag===t.HostHoistableTag||e.tag===t.HostSingletonTag||"string"==typeof e.type,t.getNearestHostFiber=e=>{let n=(0,t.traverseFiber)(e,t.isHostFiber);return n||(n=(0,t.traverseFiber)(e,t.isHostFiber,!0)),n},t.getTopMostHostFiber=e=>{let n=null;return(0,t.traverseFiber)(e,(function(e){(0,t.isHostFiber)(e)&&(n=e)}),!0),n},t.getTopMostFiberWithChild=e=>{let n=null;return(0,t.traverseFiber)(e,(function(e){null!=e.child&&(n=e)}),!0),n},t.traverseFiber=(e,n,i=!1)=>{if(!e)return null;if(!0===n(e))return e;let s=i?e.return:e.child;for(;s;){const e=(0,t.traverseFiber)(s,n,i);if(e)return e;s=i?null:s.sibling}return null};const o=["__reactFiber$","__reactInternalInstance$","_reactRootContainer"],r=Object.getOwnPropertyNames.bind(Object);function l(e){var t,n,o,r;const l=null!==(t=e.type)&&void 0!==t?t:e.elementType;let c=null!==(n=null==l?void 0:l.displayName)&&void 0!==n?n:null==l?void 0:l.name;if(null==c)if(null==l?void 0:l.render){const e=null==l?void 0:l.render;c=null!==(o=null==e?void 0:e.displayName)&&void 0!==o?o:null==e?void 0:e.name}else(null==l?void 0:l.type)&&(c=null!==(r=l.type.displayName)&&void 0!==r?r:l.type.name);c||"function"!=typeof l||(c=l.name);const u=(0,i.getMeaningfulName)(a(c));return(0,s.isValidComponentName)(u)?u:null}function a(e){if("string"!=typeof e)return null;if(!e.includes("[")||!e.includes("]"))return e;const t=e.indexOf("["),n=e.indexOf("]");if(t>n)return e;const i=e.substring(t+1,n);return i.startsWith("from ")?i.substring(5):i}t.getFiberNodeFromElement=function(e){for(const t of o){const n=r(e).find((e=>e.startsWith(t)));if(n)return e[n]}return null},t.getReactComponentStack=function(e){const t=[],n=new Set;let i=e;for(;i&&!n.has(i);){n.add(i);const e=l(i);e&&t.push(e),i=i.return}return t},t.getDisplayNameOfFiberNode=l,t.isFunctionalComponent=function(e){return"function"==typeof(null==e?void 0:e.elementType)},t.extractReactComponentName=a},775:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createStatusText=void 0;const i=n(498);function s(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}t.createStatusText=function(e){const t=(0,i.createVisualizerElement)("div");return t.style.marginLeft="10px",t.style.color="white",t.style.fontSize="10px",t.style.fontFamily="Inter, system-ui, sans-serif",t.style.overflow="hidden",t.style.whiteSpace="nowrap",t.style.textOverflow="ellipsis",t.textContent="",e((e=>{var n,i,o,r;const l=window.performance,a=null==l?void 0:l.memory,c=null!==(n=null==a?void 0:a.usedJSHeapSize)&&void 0!==n?n:0,u=null!==(i=null==a?void 0:a.totalJSHeapSize)&&void 0!==i?i:0,d=null!==(o=e.totalDOMElementsCount)&&void 0!==o?o:0,f=null!==(r=e.detachedDOMElementsCount)&&void 0!==r?r:0;t.textContent=`DOM: ${d} total, ${f} detached | Heap: ${s(c)} / ${s(u)}`})),t}},847:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidComponentName=void 0;const n=new Set;t.isValidComponentName=function(e){return null!=e&&!n.has(e)}},860:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BasicExtension=void 0,t.BasicExtension=class{constructor(e){this.scanner=e}beforeScan(){}afterScan(e){}}},904:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createComponentStackPanel=void 0;const i=n(498);t.createComponentStackPanel=function(e){const t=(0,i.createVisualizerElement)("div");t.style.width="100%",t.style.maxHeight="80vh",t.style.background="rgba(0, 0, 0, 0.5)",t.style.borderTop="1px solid rgba(255, 255, 255, 0.1)",t.style.display="none",t.style.flexDirection="column",t.style.padding="8px",t.style.boxSizing="border-box",t.style.borderRadius="8px",t.style.overflowY="scroll",t.style.overflowX="hidden",t.style.textShadow="none",t.style.font="9px Inter, system-ui, -apple-system, sans-serif",t.style.color="white",t.id="memory-visualization-component-stack-panel";let n=!1;return t.addEventListener("mouseenter",(()=>{n=!0})),t.addEventListener("mouseleave",(()=>{n=!1})),e((0,i.debounce)((e=>{var s;if(n)return;if(t.innerHTML="",null==e.selectedElementId||!(null===(s=e.selectedReactComponentStack)||void 0===s?void 0:s.length))return void(t.style.display="none");t.style.display="flex";const o=(0,i.createVisualizerElement)("div");o.textContent="Component Stack:",o.style.fontWeight="bold",o.style.marginBottom="8px",t.appendChild(o);let r=0;e.selectedReactComponentStack.forEach((e=>{const n=(0,i.createVisualizerElement)("div");n.style.marginBottom="4px",n.textContent=e,t.appendChild(n),++r})),0===r&&o.remove()}),1)),t}},933:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=i(n(282)),o=n(23),r=n(476);if(!(0,r.hasRunInSession)()){const e=new s.default({isDevMode:!0}),t=new o.DOMVisualizationExtension(e);e.registerExtension(t),e.start(),(0,r.setRunInSession)()}},946:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createToggleButton=void 0;const i=n(498);t.createToggleButton=function(e,t){const n=(0,i.createVisualizerElement)("div");n.style.width="40px",n.style.height="24px",n.style.borderRadius="9999px",n.style.backgroundColor="#34C759",n.style.cursor="pointer",n.style.position="relative",n.style.transition="background-color 0.3s ease";const s=(0,i.createVisualizerElement)("div");return s.style.width="18px",s.style.height="18px",s.style.backgroundColor="white",s.style.borderRadius="50%",s.style.position="absolute",s.style.top="3px",s.style.left="3px",s.style.transition="left 0.25s ease",n.appendChild(s),n.addEventListener("click",(()=>{t.value=!t.value,t.value?(e.style.display="none",e.style.pointerEvents="none",e.style.userSelect="none",s.style.left="19px",n.style.backgroundColor="#FF3B30"):(e.style.display="block",e.style.pointerEvents="auto",e.style.userSelect="auto",s.style.left="3px",n.style.backgroundColor="#34C759")})),n}},953:function(e,t,n){var i,s,o,r,l,a,c,u=this&&this.__classPrivateFieldSet||function(e,t,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,n):s?s.value=n:t.set(e,n),n},d=this&&this.__classPrivateFieldGet||function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.EventListenerTracker=void 0;const f=n(737),h=n(313);class p{constructor(){i.add(this),s.set(this,void 0),o.set(this,void 0),r.set(this,void 0),l.set(this,void 0),u(this,s,new h.WeakMapPlus({fallback:"noop",cleanupMs:100}),"f"),u(this,o,new Map,"f"),u(this,r,EventTarget.prototype.addEventListener,"f"),u(this,l,EventTarget.prototype.removeEventListener,"f"),d(this,i,"m",a).call(this)}static getInstance(){return p.instance||(p.instance=new p),p.instance}addListener(e,t,n,i){e.addEventListener(t,n,i)}removeListener(e,t,n,i){e.removeEventListener(t,n,i)}scan(e){const t=new Map;for(const[n,i]of d(this,s,"f").entries())if(n instanceof Element&&!n.isConnected)for(const s of i){if(!s.cb.deref())continue;const i=e(new WeakRef(n));t.has(i)||t.set(i,[]);const o=t.get(i);let r=null==o?void 0:o.find((e=>e.type===s.type));r||(r={type:s.type,count:0,entries:[]},null==o||o.push(r)),r.count++,r.entries.push(new WeakRef(s))}return u(this,o,t,"f"),t}getDetachedListeners(){return d(this,o,"f")}destroy(){d(this,i,"m",c).call(this),d(this,s,"f").destroy(),d(this,o,"f").clear(),p.instance=null}}t.EventListenerTracker=p,s=new WeakMap,o=new WeakMap,r=new WeakMap,l=new WeakMap,i=new WeakSet,a=function(){const e=this;EventTarget.prototype.addEventListener=function(t,n,i){var o;if(d(e,r,"f").call(this,t,n,i),this instanceof Element){const r=(0,f.getFiberNodeFromElement)(this),l={type:t,cb:new WeakRef(n),options:i,fiber:r?new WeakRef(r):void 0},a=null!==(o=d(e,s,"f").get(this))&&void 0!==o?o:[];a.push(l),d(e,s,"f").set(this,a)}},EventTarget.prototype.removeEventListener=function(t,n,i){if(d(e,l,"f").call(this,t,n,i),this instanceof Element){const o=d(e,s,"f").get(this);if(o){const r=o.findIndex((e=>e.type===t&&e.cb.deref()===n&&e.options===i));-1!==r&&o.splice(r,1),0===o.length?d(e,s,"f").delete(this):d(e,s,"f").set(this,o)}}}},c=function(){EventTarget.prototype.addEventListener=d(this,r,"f"),EventTarget.prototype.removeEventListener=d(this,l,"f")},p.instance=null},979:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IntersectionObserverManager=void 0;class n{constructor(){this.observedElements=new Map,this.observer=new IntersectionObserver((e=>{e.forEach((e=>{const t=e.target,n=this.observedElements.get(t);n&&n(e)}))}),{threshold:0,rootMargin:"50px"})}static getInstance(){return n.instance||(n.instance=new n),n.instance}observe(e,t){const n=e.deref();null!=n&&(this.observedElements.set(n,t),this.observer.observe(n))}unobserve(e){const t=e.deref();null!=t&&(this.observedElements.delete(t),this.observer.unobserve(t))}}t.IntersectionObserverManager=n}},t={};!function n(i){var s=t[i];if(void 0!==s)return s.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(933)})();
@@ -23,4 +23,5 @@ export default class DOMElementVisualizerInteractive extends DOMElementVisualize
23
23
  #private;
24
24
  constructor();
25
25
  repaint(domElementInfoList: Array<DOMElementInfo>): void;
26
+ cleanup(): void;
26
27
  }
@@ -11,5 +11,6 @@ import type { DOMElementInfo } from '../core/types';
11
11
  export default class DOMElementVisualizer {
12
12
  #private;
13
13
  constructor();
14
+ cleanup(): void;
14
15
  repaint(domElementInfoList: Array<DOMElementInfo>): void;
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memlab/lens",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "license": "MIT",
5
5
  "description": "MemLens is a tool for inspecting memory leaks in browser",
6
6
  "author": "Liang Gong <lgong@meta.com>",
@@ -34,5 +34,14 @@
34
34
  "typescript": "^5.7.2",
35
35
  "webpack": "^5.97.1",
36
36
  "webpack-cli": "^5.1.4"
37
- }
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/facebook/memlab.git",
41
+ "directory": "packages/lens"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/facebook/memlab/issues"
45
+ },
46
+ "homepage": "https://github.com/facebook/memlab#readme"
38
47
  }