"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/extends"),t=require("@babel/runtime/helpers/defineProperty"),n=require("react/jsx-runtime"),o=require("react"),a=require("lodash"),i=require("immutable"),c=require("../../LoadingIndicator/LoadingIndicator.js"),u=require("./IsolatedPage.module.css.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l,f=s(e),p=s(r),d=s(t);function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function y(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){d.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var v=function(e,r){if(e===r)return!0;if("function"==typeof e&&"function"==typeof r)return!0;var t=i.Iterable.isIterable(e),n=i.Iterable.isIterable(r);return t&&n?i.is(e,r):t===n&&a.isEqual(e,r)},O=(l={},d.default(l,"data-corva-app-iframe",!0),d.default(l,"data-testid","isolatedAppContainer"),l);exports.APP_IFRAME_ATTRIBUTE="data-corva-app-iframe",exports.IsolatedPage=function(e){var r=p.default({},e),t=o.useRef(null),a=o.useRef(null),i=o.useState(!0),s=f.default(i,2),l=s[0],d=s[1],b=o.useCallback((function(){d(!1)}),[]),g=function(e,r){if(e){var t=!e.xprops,n=!function(e,r){if(e===r)return!0;if(!e)return!1;var t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(var o=0,a=n;o<a.length;o++){var i=a[o];if(!Object.prototype.hasOwnProperty.call(e,i))return!1;if(!v(e[i],r[i]))return!1}return!0}(a.current||{},r);if(e.xprops=y({},r),a.current=r,(t||n)&&e.xpropsOnProps)try{e.xpropsOnProps(r)}catch(e){console.debug("[IsolatedPage] xpropsOnProps was not set yet:",e)}}};return o.useEffect((function(){try{var e,n=null===(e=t.current)||void 0===e?void 0:e.contentWindow;g(n,r)}catch(e){console.error("[IsolatedPage] Error accessing iframe contentWindow:",e)}})),o.useEffect((function(){return function(){try{var e,r=null===(e=t.current)||void 0===e?void 0:e.contentWindow;r&&r.xprops&&delete r.xprops}catch(e){console.error("[IsolatedPage] Error cleaning up xprops:",e)}a.current=null;var n=t.current;if(n)try{n.src="about:blank"}catch(e){console.error("[IsolatedPage] Error setting iframe src to about:blank:",e)}t.current=null}}),[]),n.jsxs("div",{className:u.container,children:[l&&n.jsx(c,{}),n.jsx("iframe",y({ref:t,src:"/DevCenterIsolatedAppPage.html",onLoad:b,className:u.iframe},O))]})};
//# sourceMappingURL=IsolatedPage.js.map
