"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),s=require("react"),o=require("prop-types"),n=require("@material-ui/core"),t=require("classnames"),i=require("moment-timezone"),c=require("./effects/useXProps.js"),u=require("./constants.js"),a=require("./utils/replaceUndefinedValuesWithNull.js"),l=require("../DevCenterAppContainer/DevCenterAppContainer.js");require("../../../icons/WithCustomSize.js");var p=require("../../../icons/IconParkProvider.js");require("../../../icons/customIcons/icons/AddMessage.js"),require("../../../icons/customIcons/icons/Attention.js"),require("../../../icons/customIcons/icons/Collapse.js"),require("../../../icons/customIcons/icons/Dashboard.js"),require("../../../icons/customIcons/icons/Expand.js"),require("../../../icons/customIcons/icons/FolderClosed.js"),require("../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../icons/customIcons/icons/FolderOpened.js"),require("../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../icons/customIcons/icons/Search.js"),require("../../../icons/customIcons/icons/Wellhub.js"),require("../../../icons/customIcons/icons/MultiRuler.js"),require("../../../icons/customIcons/icons/Checkbox.js"),require("../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../icons/customIcons/icons/Radio.js"),require("../../../icons/customIcons/icons/RadioChecked.js"),require("../../../icons/customIcons/icons/SimulFrac.js"),require("../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../icons/customIcons/icons/CautionFilled.js"),require("../../../icons/customIcons/icons/MoreApp.js");var d=require("../../../hocs/withMUIProvidersHOC.js");require("../../../hocs/withAssetEditorLockHOC.js");var m=require("../AppContext.js"),j=require("../../../constants/theme.js"),f=require("../../../CLI/hocs/constants.js"),C=require("../../../utils/themeVariables.js"),q=require("../../../CLI/hocs/utils.js"),I=require("../../../permissions/PermissionsContext.js"),h=require("../../../utils/index.js");require("../../../config/initGlobalDependencies.js"),require("../../../styles/globalStyles.js"),require("./DevCenterAppZoidComponent.js");var b=require("react/jsx-runtime");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var P=g(e),v=g(r),A=g(o),O=g(t),E=g(i),S=["appContextValue","globalMixpanelEventTracker","globalNotificationToastsAPI","onSettingChange","onSettingsChange","permissionsContextValue","timezone","userUnits"];function x(e,r){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),s.push.apply(s,o)}return s}function y(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?x(Object(s),!0).forEach((function(r){P.default(e,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):x(Object(s)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r))}))}return e}var D=d(l),T=n.makeStyles((function(){return{"@global":{body:{backgroundColor:"transparent",overflow:"hidden"}}}}));function L(e){var r,o=e.CLIAppComponent,n=e.CLIAppSettings,t=e.containerReportClassName;T();var i=c.useXProps(),l=i.appContextValue,d=i.globalMixpanelEventTracker,g=i.globalNotificationToastsAPI,P=i.onSettingChange,A=i.onSettingsChange,x=i.permissionsContextValue,L=i.timezone,w=i.userUnits,k=v.default(i,S),M=k.location.pathname.startsWith("/reports/")||q.isPDFReportView,R=null!==(r=localStorage.getItem(f.LOCAL_STORAGE_APP_THEME_KEY))&&void 0!==r?r:j.THEMES.DARK,N=!M&&R===j.THEMES.DARK;s.useEffect((function(){C.setThemeVariables(N)}),[N]),s.useEffect((function(){window[Symbol.for("notificationToasts")]=g,window[Symbol.for("logToMixpanel")]=d}),[g,d]);var V=s.useRef(!0);return V.current&&(V.current=!1,h.updateUserUnits({userUnits:w})),s.useEffect((function(){return L&&E.default.tz.setDefault(L),function(){return E.default.tz.setDefault(null)}}),[L]),b.jsx(I.PermissionsContext.Provider,{value:x,children:b.jsx(m.Provider,{value:l,children:b.jsx(p.IconParkProvider,{children:b.jsx("div",{id:u.ISOLATED_PAGE_APP_CONTAINER_ID,className:O.default(M&&t),children:b.jsx(D,y(y({},k),{},{theme:N?j.THEMES.DARK:j.THEMES.LIGHT,onSettingsChange:function(e){return A(a.replaceUndefinedValuesWithNull(e))},onSettingChange:function(e,r){return P(e,a.replaceUndefinedValuesWithNull(r))},CLIAppComponent:o,CLIAppSettings:n}))})})})})}L.propTypes={CLIAppComponent:A.default.func,CLIAppSettings:A.default.func,containerReportClassName:A.default.string},L.defaultProps={CLIAppComponent:null,CLIAppSettings:null,containerReportClassName:null},exports.DevCenterIsolatedAppPage=L;
